Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Contrib > Infinite scroll component #1696

Merged
merged 61 commits into from
Jun 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
3f4222e
Resolving Card action bar still visable after hiding with *ngIf #1421
blackbaud-conorwright Mar 7, 2018
a450054
Addressed PR style comments
blackbaud-conorwright Mar 8, 2018
4b809aa
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 9, 2018
d55f351
Merge branch 'master' into master
Blackbaud-SteveBrush Mar 9, 2018
833bcc7
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 12, 2018
b553659
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 15, 2018
ab82ba3
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 19, 2018
644a25b
began implementation of the infinite scroll component
blackbaud-conorwright Mar 20, 2018
5e288fb
fixed skywait and implemented better IsLoading tracking
blackbaud-conorwright Mar 21, 2018
c71cd80
changed demo back to window scrolling instead of a parent element
blackbaud-conorwright Mar 21, 2018
15dcac6
created initial unit testing for infinite scroll
blackbaud-conorwright Mar 23, 2018
5299091
switched to triggering window scroll in test
blackbaud-conorwright Mar 23, 2018
a41fe27
cleaned up style. Added unit tests for infinite scroll.
blackbaud-conorwright Mar 27, 2018
db21c76
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 27, 2018
34a90b8
Merge remote-tracking branch 'origin/master' into infinite-scroll-com…
blackbaud-conorwright Mar 27, 2018
3985535
fixed minor linting issue in infinite scroll
blackbaud-conorwright Mar 27, 2018
0d0e142
added visual tests
blackbaud-conorwright Mar 27, 2018
8b2a046
fixed naming issue for inf scroll visual tests
blackbaud-conorwright Mar 27, 2018
a282a86
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 30, 2018
e8a490b
Merge remote-tracking branch 'origin/master' into infinite-scroll-com…
blackbaud-conorwright Mar 30, 2018
8c0f691
Fixed state issue with the isLoading observable
blackbaud-conorwright Apr 2, 2018
9df881d
switched to sky-margin for infinite scroll margin
blackbaud-conorwright Apr 2, 2018
2db1fa1
Doubled the margin of the infinite scroll cmpnt
blackbaud-conorwright Apr 2, 2018
52278c4
adapted new tests to the new isloading setup
blackbaud-conorwright Apr 2, 2018
f62cc75
fixed up the window scroll unit tests
blackbaud-conorwright Apr 3, 2018
8a1f2d4
removed unnecessary check and added ondestroy to code coverage
blackbaud-conorwright Apr 3, 2018
c7d82f8
removed leftover fdescribe
blackbaud-conorwright Apr 3, 2018
5d1d3f1
switched to the more common scrollTo() function
blackbaud-conorwright Apr 3, 2018
2757ede
removed scrollTo methods since they aren't supported in IE
blackbaud-conorwright Apr 3, 2018
1595f99
altered scroll depth for smaller resolutions
blackbaud-conorwright Apr 3, 2018
a47c666
fixed infinite scroll IE11 support
blackbaud-conorwright Apr 4, 2018
d210c2b
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Apr 10, 2018
efd7c86
Merge branch 'master' into infinite-scroll-component
blackbaud-conorwright Apr 10, 2018
4192936
updated to the new location of TestUtility
blackbaud-conorwright Apr 11, 2018
35e789d
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Apr 17, 2018
c637cf2
Merge remote-tracking branch 'origin/master' into infinite-scroll-com…
blackbaud-conorwright Apr 18, 2018
5131fcd
fixed style issues from review
blackbaud-conorwright Apr 18, 2018
e56d69f
first set of fixes for review comments
blackbaud-conorwright Apr 23, 2018
8b5f764
finished PR comment fixes
blackbaud-conorwright Apr 23, 2018
636c5dd
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Apr 23, 2018
cda26a8
Merge remote-tracking branch 'origin/master' into infinite-scroll-com…
blackbaud-conorwright Apr 23, 2018
1c4d028
removed unused import
blackbaud-conorwright Apr 25, 2018
bdc97a6
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 1, 2018
7f77274
Merge remote-tracking branch 'origin/master' into infinite-scroll-com…
blackbaud-conorwright May 1, 2018
6104aaf
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 2, 2018
ec18ec9
Merge remote-tracking branch 'origin/master' into infinite-scroll-com…
blackbaud-conorwright May 2, 2018
b0d8dc0
updated for PR comments
blackbaud-conorwright May 3, 2018
217df6f
cleaned up style
blackbaud-conorwright May 4, 2018
68fb231
Merge branch 'master' into infinite-scroll-component
Blackbaud-SteveBrush May 8, 2018
37f50ec
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 8, 2018
2682511
Merge branch 'master' into infinite-scroll-component
Blackbaud-SteveBrush May 11, 2018
76279cd
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 14, 2018
8012e6b
Merge remote-tracking branch 'origin/master' into infinite-scroll-com…
blackbaud-conorwright May 14, 2018
b784d06
updated demo to use an observable list
blackbaud-conorwright May 15, 2018
85f5aad
renamed onLoad and hasMore to scrollEnd and enabled
blackbaud-conorwright May 15, 2018
7f9e27c
removed excess css; added window service to dom adapter
blackbaud-conorwright May 15, 2018
dfcad8c
switched to using a mutation observer rather than the obserable of a …
blackbaud-conorwright May 15, 2018
bc0ffe1
accounted for scroll parents without positions
blackbaud-conorwright May 16, 2018
8a08f19
Updated unit tests
Blackbaud-SteveBrush May 17, 2018
cddf0f9
Merge branch 'master' into contrib-infinite-scroll-component
Blackbaud-SteveBrush May 22, 2018
36198ca
Merge branch 'master' into contrib-infinite-scroll-component
Blackbaud-SteveBrush Jun 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions skyux-spa-visual-tests/src/app/infinite-scroll/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<infinite-scroll-visual></infinite-scroll-visual>
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<div id="screenshot-infinite-scroll">
<sky-repeater>
<sky-repeater-item>
<sky-repeater-item-title>
Title 1
</sky-repeater-item-title>
<sky-repeater-item-content>
Content 1
</sky-repeater-item-content>
</sky-repeater-item>
<sky-repeater-item>
<sky-repeater-item-title>
Title 2
</sky-repeater-item-title>
<sky-repeater-item-content>
Content 2
</sky-repeater-item-content>
</sky-repeater-item>
</sky-repeater>
<sky-infinite-scroll
[enabled]="true"
>
</sky-infinite-scroll>
</div>

<div id="screenshot-infinite-scroll-nobutton">
<sky-repeater>
<sky-repeater-item>
<sky-repeater-item-title>
Title 1
</sky-repeater-item-title>
<sky-repeater-item-content>
Content 1
</sky-repeater-item-content>
</sky-repeater-item>
<sky-repeater-item>
<sky-repeater-item-title>
Title 2
</sky-repeater-item-title>
<sky-repeater-item-content>
Content 2
</sky-repeater-item-content>
</sky-repeater-item>
</sky-repeater>
<sky-infinite-scroll
[enabled]="false"
>
</sky-infinite-scroll>
</div>

<div id="screenshot-infinite-scroll-wait">
<sky-repeater>
<sky-repeater-item>
<sky-repeater-item-title>
Title 1
</sky-repeater-item-title>
<sky-repeater-item-content>
Content 1
</sky-repeater-item-content>
</sky-repeater-item>
<sky-repeater-item>
<sky-repeater-item-title>
Title 2
</sky-repeater-item-title>
<sky-repeater-item-content>
Content 2
</sky-repeater-item-content>
</sky-repeater-item>
</sky-repeater>
<sky-infinite-scroll
[enabled]="true"
>
</sky-infinite-scroll>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {
Component
} from '@angular/core';

@Component({
selector: 'infinite-scroll-visual',
templateUrl: './infinite-scroll-visual.component.html'
})
export class InfiniteScrollVisualComponent { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// #region imports
import {
SkyVisualTest
} from '../../../config/utils/visual-test-commands';

import {
by,
element
} from 'protractor';
// #endregion

describe('Infinite Scroll', () => {
it('should match previous infinite scroll screenshot', () => {
return SkyVisualTest
.setupTest('infinite-scroll')
.then(() => {
return SkyVisualTest.compareScreenshot({
screenshotName: 'infinite-scroll',
selector: '#screenshot-infinite-scroll'
});
});
});

it('should match previous infinite scroll screenshot when hasMore is false', () => {
return SkyVisualTest.setupTest('infinite-scroll')
.then(() => {
return SkyVisualTest.compareScreenshot({
screenshotName: 'infinite-scroll-nobutton',
selector: '#screenshot-infinite-scroll-nobutton'
});
});
});

it('should match previous infinite scroll screenshot in wait mode', () => {
return SkyVisualTest.setupTest('infinite-scroll')
.then(() => {
element(by.css('.sky-btn')).click();
return SkyVisualTest.compareScreenshot({
screenshotName: 'infinite-scroll-wait',
selector: '#screenshot-infinite-scroll-wait'
});
});
});
});
3 changes: 3 additions & 0 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { SkyFluidGridModule } from './modules/fluid-grid/fluid-grid.module';
import { SkyFlyoutModule } from './modules/flyout/flyout.module';
import { SkyGridModule } from './modules/grid';
import { SkyHelpInlineModule } from './modules/help-inline';
import { SkyInfiniteScrollModule } from './modules/infinite-scroll';
import { SkyKeyInfoModule } from './modules/key-info';
import { SkyLabelModule } from './modules/label';
import { SkyLinkRecordsModule } from './modules/link-records';
Expand Down Expand Up @@ -95,6 +96,7 @@ import { SkyWaitModule } from './modules/wait';
SkyFlyoutModule,
SkyGridModule,
SkyHelpInlineModule,
SkyInfiniteScrollModule,
SkyKeyInfoModule,
SkyLabelModule,
SkyLinkRecordsModule,
Expand Down Expand Up @@ -159,6 +161,7 @@ export * from './modules/flyout';
export * from './modules/format';
export * from './modules/grid';
export * from './modules/help-inline';
export * from './modules/infinite-scroll';
export * from './modules/key-info';
export * from './modules/label';
export * from './modules/link-records';
Expand Down
2 changes: 2 additions & 0 deletions src/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
SkyFlyoutDemoComponent,
SkyGridDemoComponent,
SkyHelpInlineDemoComponent,
SkyInfiniteScrollDemoComponent,
SkyKeyInfoDemoComponent,
SkyLabelDemoComponent,
SkyLinkRecordsDemoComponent,
Expand Down Expand Up @@ -119,6 +120,7 @@ const components = [
SkyFlyoutDemoInternalComponent,
SkyGridDemoComponent,
SkyHelpInlineDemoComponent,
SkyInfiniteScrollDemoComponent,
SkyKeyInfoDemoComponent,
SkyLabelDemoComponent,
SkyLinkRecordsDemoComponent,
Expand Down
21 changes: 21 additions & 0 deletions src/demos/demo.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
SkyFlyoutDemoComponent,
SkyGridDemoComponent,
SkyHelpInlineDemoComponent,
SkyInfiniteScrollDemoComponent,
SkyKeyInfoDemoComponent,
SkyLabelDemoComponent,
SkyLinkRecordsDemoComponent,
Expand Down Expand Up @@ -450,6 +451,26 @@ export class SkyDemoService {
}
]
},
{
name: 'Infinite scroll',
component: SkyInfiniteScrollDemoComponent,
files: [
{
name: 'infinite-scroll-demo.component.html',
fileContents: require('!!raw-loader!./infinite-scroll/infinite-scroll-demo.component.html')
},
{
name: 'infinite-scroll-demo.component.scss',
fileContents: require('!!raw-loader!./infinite-scroll/infinite-scroll-demo.component.scss')
},
{
name: 'infinite-scroll-demo.component.ts',
fileContents: require('!!raw-loader!./infinite-scroll/infinite-scroll-demo.component.ts'),
componentName: 'SkyInfiniteScrollDemoComponent',
bootstrapSelector: 'sky-infinite-scroll-demo'
}
]
},
{
name: 'Key info',
component: SkyKeyInfoDemoComponent,
Expand Down
1 change: 1 addition & 0 deletions src/demos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export * from './fluid-grid';
export * from './flyout';
export * from './grid';
export * from './help-inline';
export * from './infinite-scroll';
export * from './key-info';
export * from './label';
export * from './link-records';
Expand Down
1 change: 1 addition & 0 deletions src/demos/infinite-scroll/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './infinite-scroll-demo.component';
16 changes: 16 additions & 0 deletions src/demos/infinite-scroll/infinite-scroll-demo.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="sky-infinite-scroll-demo">
<sky-repeater>
<sky-repeater-item *ngFor="let item of data">
<sky-repeater-item-title>
<div class="pull-left">
{{ item.name }}
</div>
</sky-repeater-item-title>
</sky-repeater-item>
</sky-repeater>
<sky-infinite-scroll
[enabled]="hasMore"
(scrollEnd)="onScrollEnd()"
>
</sky-infinite-scroll>
</div>
5 changes: 5 additions & 0 deletions src/demos/infinite-scroll/infinite-scroll-demo.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.sky-infinite-scroll-demo {
overflow-y: auto;
max-height: 400px;
position: relative;
}
53 changes: 53 additions & 0 deletions src/demos/infinite-scroll/infinite-scroll-demo.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import {
Component,
OnInit
} from '@angular/core';

let nextId = 0;

@Component({
selector: 'sky-infinite-scroll-demo',
templateUrl: './infinite-scroll-demo.component.html',
styleUrls: ['./infinite-scroll-demo.component.scss']
})
export class SkyInfiniteScrollDemoComponent implements OnInit {
public data: any[] = [];
public hasMore = true;

public ngOnInit(): void {
this.addData();
}

public onScrollEnd(): void {
if (this.hasMore) {
this.addData();
}
}

private addData(): void {
this.mockRemote().then((result: any) => {
this.data = this.data.concat(result.data);
this.hasMore = result.hasMore;
});
}

private mockRemote(): Promise<any> {
const data: any[] = [];

for (let i = 0; i < 8; i++) {
data.push({
name: `Item #${++nextId}`
});
}

// Simulate async request.
return new Promise((resolve: any) => {
setTimeout(() => {
resolve({
data,
hasMore: (nextId < 50)
});
}, 1000);
});
}
}
4 changes: 4 additions & 0 deletions src/locales/resources_en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,10 @@
"_description": "The title for the help button.",
"message": "Show help content"
},
"infinite_scroll_load_more_button": {
"_description": "Text for loading more in the infinite scroll button",
"message": "Load more"
},
"link_records_item_info_match": {
"_description": "",
"message": "A possible match has been identified for this record. Would you like to link it?"
Expand Down
2 changes: 2 additions & 0 deletions src/modules/infinite-scroll/fixtures/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './infinite-scroll-fixtures.module';
export * from './infinite-scroll.component.fixture';
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// #region imports
import {
NgModule
} from '@angular/core';

import {
CommonModule
} from '@angular/common';

import {
SkyWindowRefService
} from '../../window';

import {
SkyInfiniteScrollModule
} from '../infinite-scroll.module';

import {
SkyInfiniteScrollTestComponent
} from './infinite-scroll.component.fixture';
// #endregion

@NgModule({
declarations: [
SkyInfiniteScrollTestComponent
],
imports: [
CommonModule,
SkyInfiniteScrollModule
],
exports: [
SkyInfiniteScrollTestComponent
],
providers: [
SkyWindowRefService
]
})
export class SkyInfiniteScrollFixturesModule { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div #wrapper>
<ul>
<li *ngFor="let item of items">
{{ item.name }}
</li>
</ul>

<sky-infinite-scroll
[enabled]="enabled"
(scrollEnd)="onScrollEnd()"
#infiniteScrollComponent
>
</sky-infinite-scroll>
</div>
Loading