Skip to content

Commit dd9b174

Browse files
author
Denis Hilt
committed
vscroll v1.6.3 - update demos
1 parent e6ff146 commit dd9b174

15 files changed

+504
-231
lines changed

demo/app/demos.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import { DemoDifferentHeightsComponent } from './samples/common/different-height
1010
import { DemoWindowViewportComponent } from './samples/common/window-viewport.component';
1111

1212
import { DemoDatasourceSignaturesComponent } from './samples/datasource/datasource-signatures.component';
13-
import {
14-
DemoBidirectionalUnlimitedDatasourceComponent
15-
} from './samples/datasource/bidirectional-unlimited-datasource.component';
13+
// eslint-disable-next-line max-len
14+
import { DemoBidirectionalUnlimitedDatasourceComponent } from './samples/datasource/bidirectional-unlimited-datasource.component';
1615
import { DemoLimitedDatasourceComponent } from './samples/datasource/limited-datasource.component';
1716
import { DemoPositiveLimitedDatasourceComponent } from './samples/datasource/positive-limited-datasource.component';
1817
import { DemoRemoteDatasourceComponent } from './samples/datasource/remote-datasource.component';
@@ -39,13 +38,15 @@ import { DemoRemoveComponent } from './samples/adapter/remove.component';
3938
import { DemoReplaceComponent } from './samples/adapter/replace.component';
4039
import { DemoClipComponent } from './samples/adapter/clip.component';
4140
import { DemoUpdateComponent } from './samples/adapter/update.component';
41+
import { DemoPauseResumeComponent } from './samples/adapter/pause-resume.component';
4242

4343
import { DemoViewportElementSettingComponent } from './samples/experimental/viewportElement-setting.component';
4444
import { DemoInverseSettingComponent } from './samples/experimental/inverse-setting.component';
4545
import { DemoAdapterFixPositionComponent } from './samples/experimental/adapter-fix-position.component';
4646
import { DemoAdapterFixUpdaterComponent } from './samples/experimental/adapter-fix-updater.component';
4747
import { DemoAdapterFixScrollToItemComponent } from './samples/experimental/adapter-fix-scrollToItem.component';
4848
import { DemoOnBeforeClipSettingComponent } from './samples/experimental/onBeforeClip-setting.component';
49+
import { DemoRoutinesComponent } from './samples/experimental/routines.component';
4950

5051
const common = [
5152
DemoBasicComponent,
@@ -57,7 +58,7 @@ const common = [
5758
DemoInfiniteComponent,
5859
DemoHorizontalComponent,
5960
DemoDifferentHeightsComponent,
60-
DemoWindowViewportComponent,
61+
DemoWindowViewportComponent
6162
];
6263

6364
const datasource = [
@@ -67,14 +68,15 @@ const datasource = [
6768
DemoPositiveLimitedDatasourceComponent,
6869
DemoRemoteDatasourceComponent,
6970
DemoInvertedDatasourceComponent,
70-
DemoPagesDatasourceComponent,
71+
DemoPagesDatasourceComponent
7172
];
7273

7374
const adapter = [
7475
DemoAdapterRelaxComponent,
7576
DemoAdapterReturnValueComponent,
7677
DemoResetComponent,
7778
DemoReloadComponent,
79+
DemoPauseResumeComponent,
7880
DemoInitComponent,
7981
DemoIsLoadingComponent,
8082
DemoPackageInfoComponent,
@@ -90,7 +92,7 @@ const adapter = [
9092
DemoRemoveComponent,
9193
DemoReplaceComponent,
9294
DemoClipComponent,
93-
DemoUpdateComponent,
95+
DemoUpdateComponent
9496
];
9597

9698
const experimental = [
@@ -100,6 +102,7 @@ const experimental = [
100102
DemoAdapterFixUpdaterComponent,
101103
DemoAdapterFixScrollToItemComponent,
102104
DemoOnBeforeClipSettingComponent,
105+
DemoRoutinesComponent
103106
];
104107

105108
export default {

demo/app/routes.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const globalScope = {
3131
experimental: {
3232
id: 'experimental',
3333
name: 'Experimental'
34-
},
34+
}
3535
};
3636

3737
const datasourceScope = {
@@ -69,7 +69,7 @@ const datasourceScope = {
6969
id: 'pages',
7070
name: 'Pages',
7171
scope: globalScope.datasource.id
72-
},
72+
}
7373
};
7474

7575
const settingsScope = {
@@ -122,7 +122,7 @@ const settingsScope = {
122122
id: 'window-viewport',
123123
name: 'Entire window scrollable',
124124
scope: globalScope.settings.id
125-
},
125+
}
126126
};
127127

128128
const adapterPropsScope = {
@@ -165,7 +165,7 @@ const adapterPropsScope = {
165165
id: 'first-last-visible-items',
166166
name: 'First and last visible items',
167167
scope: globalScope.adapterProps.id
168-
},
168+
}
169169
};
170170

171171
const adapterMethodsScope = {
@@ -189,6 +189,11 @@ const adapterMethodsScope = {
189189
name: 'Reset',
190190
scope: globalScope.adapter.id
191191
},
192+
pauseResume: {
193+
id: 'pause-resume',
194+
name: 'Pause / resume',
195+
scope: globalScope.adapterMethods.id
196+
},
192197
check: {
193198
id: 'check-size',
194199
name: 'Check size',
@@ -228,7 +233,7 @@ const adapterMethodsScope = {
228233
id: 'update',
229234
name: 'Update',
230235
scope: globalScope.adapterMethods.id
231-
},
236+
}
232237
};
233238

234239
const experimentalScope = {
@@ -262,6 +267,11 @@ const experimentalScope = {
262267
name: 'onBeforeClip setting',
263268
scope: globalScope.experimental.id
264269
},
270+
routines: {
271+
id: 'routines',
272+
name: 'Routines',
273+
scope: globalScope.experimental.id
274+
}
265275
};
266276

267277
const demos = {
@@ -275,7 +285,7 @@ const demos = {
275285
},
276286
adapter: {
277287
...globalScope.adapter,
278-
map: [],
288+
map: []
279289
},
280290
adapterProps: {
281291
...globalScope.adapterProps,
Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
11
<h1>Angular UI Scroll Adapter Demos</h1>
2-
32
<p>
4-
<em>Adapter</em> is&nbsp;a&nbsp;special object to&nbsp;assess and manipulate the Scroller.
5-
The API it&nbsp;provides is&nbsp; discussed on&nbsp;this page.
6-
In order to get an access to the <em>Adapter</em> API,
7-
the <em>Datasource</em> has to be instantiated via operator <em>new</em>:
3+
<em>Adapter</em> is&nbsp;a&nbsp;special object to&nbsp;assess and manipulate
4+
the Scroller. The API it&nbsp;provides is&nbsp; discussed on&nbsp;this page.
5+
In order to get an access to the <em>Adapter</em> API, the
6+
<em>Datasource</em> has to be instantiated via operator <em>new</em>:
87
</p>
9-
10-
<pre>{{datasourceSample}}</pre>
11-
8+
<pre>{{ datasourceSample }}</pre>
129
<p>
1310
For better typings it is recommended to provide also data item type argument:
1411
</p>
15-
16-
<pre>{{datasourceTypedSample}}</pre>
17-
12+
<pre>{{ datasourceTypedSample }}</pre>
1813
<p>
19-
The constructor argument is&nbsp;an&nbsp;object of&nbsp;<em>IDatasource</em> type which
20-
must include <em>get</em> method property and
21-
may include <em>settings</em> object property.
22-
The Scroller's augments the result <em>Datasource</em> object
23-
with the <em>Adapter</em> object property during instantiating.
24-
So, after the <em>Datasource</em> object had been instantiated, we&nbsp;may access
25-
<em>this.datasource.adapter</em> property object with its API methods and properties.
14+
The constructor argument is&nbsp;an&nbsp;object of&nbsp;<em>IDatasource</em>
15+
type which must include <em>get</em> method property and may include
16+
<em>settings</em> object property. The Scroller's augments the result
17+
<em>Datasource</em> object with the <em>Adapter</em> object property during
18+
instantiating. So, after the <em>Datasource</em> object had been instantiated,
19+
we&nbsp;may access <em>this.datasource.adapter</em> property object with its
20+
API methods and properties.
2621
</p>
27-
2822
<app-demo-init></app-demo-init>
2923
<app-demo-package-info></app-demo-package-info>
3024
<app-demo-is-loading></app-demo-is-loading>
@@ -33,16 +27,16 @@ <h1>Angular UI Scroll Adapter Demos</h1>
3327
<app-demo-buffer-info></app-demo-buffer-info>
3428
<app-demo-bof-eof></app-demo-bof-eof>
3529
<app-demo-first-last-visible-items></app-demo-first-last-visible-items>
36-
3730
<app-demo-adapter-return-value></app-demo-adapter-return-value>
3831
<app-adapter-relax></app-adapter-relax>
3932
<app-demo-reload></app-demo-reload>
4033
<app-demo-reset></app-demo-reset>
34+
<app-demo-pause-resume></app-demo-pause-resume>
4135
<app-demo-check-size></app-demo-check-size>
4236
<app-demo-clip></app-demo-clip>
4337
<app-demo-append-prepend></app-demo-append-prepend>
4438
<app-demo-append-prepend-sync></app-demo-append-prepend-sync>
4539
<app-demo-insert></app-demo-insert>
4640
<app-demo-remove></app-demo-remove>
4741
<app-demo-replace></app-demo-replace>
48-
<app-demo-update></app-demo-update>
42+
<app-demo-update></app-demo-update>
Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,71 @@
11
<ng-template #itemTemplate let-item="item" let-index="index">
2-
<span class="index">{{index}})</span> {{item.text}}
2+
<span class="index">{{ index }})</span> {{ item.text }}
33
</ng-template>
4-
5-
<app-demo
6-
[datasource]="datasource"
7-
[context]="demoContext"
8-
[sources]="sources"
9-
[itemTemplate]="itemTemplate"
10-
>
4+
<app-demo [datasource]="datasource" [context]="demoContext" [sources]="sources" [itemTemplate]="itemTemplate">
115
<div actions>
126
<button (click)="doPrepend()">Prepend</button>&nbsp;
13-
<input [ngModel]="inputPrepend" (change)="onInputChanged(true, $any($event.target))" size="2">
14-
&nbsp;items {{increasePrepend ? 'increasingly' : 'decreasingly'}} &nbsp;<input type="checkbox" [(ngModel)]="increasePrepend">
15-
<br>
7+
<input [ngModel]="inputPrepend" (change)="onInputChanged(true, $any($event.target))" size="2" />
8+
&nbsp;items
9+
{{ increasePrepend ? 'increasingly' : 'decreasingly' }} &nbsp;<input type="checkbox" [(ngModel)]="increasePrepend" />
10+
<br />
1611
<button (click)="doAppend()">Append</button>&nbsp;
17-
<input [ngModel]="inputAppend" (change)="onInputChanged(false, $any($event.target))" size="2">
18-
&nbsp;items {{decreaseAppend ? 'decreasingly' : 'increasingly'}} &nbsp;<input type="checkbox" [(ngModel)]="decreaseAppend">
12+
<input [ngModel]="inputAppend" (change)="onInputChanged(false, $any($event.target))" size="2" />
13+
&nbsp;items
14+
{{ decreaseAppend ? 'decreasingly' : 'increasingly' }} &nbsp;<input type="checkbox" [(ngModel)]="decreaseAppend" />
1915
</div>
20-
2116
<div description>
2217
<p>
23-
Along with <em>items</em> parameter both append and prepend methods
24-
have <em>eof</em>/<em>bof</em> parameter
25-
which is optional and which prevents rendering of new items
26-
when the end of the dataset (if we are speaking of <em>append</em>) or
27-
beginning of the dataset (<em>prepend</em> case) is not reached. See also
28-
<a
29-
[routerLink]="['/', adapterScope.id]"
30-
fragment="{{adapterPropsScope.map.bofEof.id}}"
31-
>bof/eof demo</a>.
18+
The <em>append</em> and <em>prepend</em> methods have parameters
19+
responsible for the virtualization of inserted items:
20+
<em>eof</em>/<em>bof</em> and <em>virtualize</em>.
21+
Only one of these parameters can be used at a time
22+
(setting both to <em>true</em> simultaneously will reset both values to <em>false</em>).
3223
</p>
3324
<p>
34-
For example, if we call <em>{{prependCallSample}}</em> when the beginning of the dataset is reached
35-
and no more items can be fetched in the backward direction, then the new items will be injected and rendered immediately.
36-
But if we are not in BOF, new items will not appear, they will be virtualized:
37-
viewport backward padding element size will be increased in accordance with
38-
the number of new items multiplied by the default item size.
39-
The same works for <em>{{appendCallSample}}</em> call
25+
If <em>eof</em>/<em>bof</em> is set to <em>true</em>,
26+
the items added via the <em>append</em>/<em>prepend</em> methods will be virtualized
27+
and will not appear in the DOM if, at the time of insertion,
28+
we are not at the beginning (in the case of prepend-bof)
29+
or at the end (in the case of append-eof) of the list.
30+
See also <a [routerLink]="['/', adapterScope.id]" fragment="{{ adapterPropsScope.map.bofEof.id }}">bof/eof demo</a>.
31+
</p>
32+
<p>
33+
For example, if we call <em>{{ prependCallSample }}</em> when the
34+
beginning of the dataset is reached and no more items can be fetched in
35+
the backward direction, then the new items will be injected and rendered
36+
immediately. But if we are not in BOF, new items will not appear, they
37+
will be virtualized: viewport backward padding element size will be
38+
increased in accordance with the number of new items multiplied by the
39+
default item size. The same works for <em>{{ appendCallSample }}</em> call
4040
adjusted for forward direction and forward padding element.
4141
</p>
4242
<p>
43-
Indexes increase by default when <em>Adapter.append</em> and
44-
decrease by default when <em>Adapter.prepend</em>.
45-
The indexing strategy can be changed by <em>decrease</em>/<em>increase</em> params.
46-
They are boolean and set to <em>false</em> by default.
47-
For example, if we call <em>{{prependIncreaseCallSample}}</em>,
48-
the topmost index remains unchanged, prepended items start with the topmost index,
49-
the rest indexes are incremented.
43+
If <em>virtualize</em> is set to <em>true</em>, the added rows will be virtualized in any case,
44+
even if we are at the beginning or end of the list.
45+
</p>
46+
<p>
47+
Indexes increase by default when <em>Adapter.append</em> and decrease by
48+
default when <em>Adapter.prepend</em>. The indexing strategy can be
49+
changed by <em>decrease</em>/<em>increase</em> params. They are boolean
50+
and set to <em>false</em> by default. For example, if we call
51+
<em>{{ prependIncreaseCallSample }}</em>, the topmost index remains unchanged, prepended items start with the
52+
topmost index, the rest indexes are incremented.
5053
</p>
5154
<p>
52-
The most important idea behind the Adapter update API is that
53-
the changes made via Adapter must be synched with the Datasource.
54-
This demo implements one of the possible ways of synching
55-
the Datasource with the Adapter.append/prepend updates.
56-
The external dataset is changed per each <em>doAppend</em> / <em>doPrepend</em> call
57-
destructively by <em>unshift</em> and <em>push</em> Array's methods.
58-
There are also some additional variables that provide index offsets and
59-
that are used in the <em>Datasource.get</em> and doPrepend/doAppend methods
60-
to guarantee a stable data flow from the App component to the Scroller.
61-
Another examples of such synchronization could be found in
62-
<a
63-
[routerLink]="['/', adapterScope.id]"
64-
fragment="{{adapterMethodsScope.map.remove.id}}"
65-
>remove</a> and
66-
<a
67-
[routerLink]="['/', adapterScope.id]"
68-
fragment="{{adapterMethodsScope.map.insert.id}}"
69-
>insert</a> demos.
55+
The most important idea behind the Adapter update API is that the changes
56+
made via Adapter must be synched with the Datasource. This demo implements
57+
one of the possible ways of synching the Datasource with the
58+
Adapter.append/prepend updates. The external dataset is changed per each
59+
<em>doAppend</em> / <em>doPrepend</em> call destructively by
60+
<em>unshift</em> and <em>push</em> Array's methods. There are also some
61+
additional variables that provide index offsets and that are used in the
62+
<em>Datasource.get</em> and doPrepend/doAppend methods to guarantee a
63+
stable data flow from the App component to the Scroller. Another examples
64+
of such synchronization could be found in
65+
<a [routerLink]="['/', adapterScope.id]" fragment="{{ adapterMethodsScope.map.remove.id }}">remove</a>
66+
and
67+
<a [routerLink]="['/', adapterScope.id]" fragment="{{ adapterMethodsScope.map.insert.id }}">insert</a>
68+
demos.
7069
</p>
7170
</div>
72-
</app-demo>
71+
</app-demo>

0 commit comments

Comments
 (0)