@angular/cdk 7.1.0 → 7.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/_a11y.scss +1 -1
- package/a11y/typings/focus-monitor/focus-monitor.d.ts +20 -5
- package/a11y/typings/focus-trap/focus-trap.d.ts +2 -0
- package/a11y/typings/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +428 -197
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +1 -1
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-accordion.umd.js +16 -9
- package/bundles/cdk-accordion.umd.js.map +1 -1
- package/bundles/cdk-accordion.umd.min.js.map +1 -1
- package/bundles/cdk-bidi.umd.js +11 -6
- package/bundles/cdk-bidi.umd.js.map +1 -1
- package/bundles/cdk-bidi.umd.min.js.map +1 -1
- package/bundles/cdk-coercion.umd.js +25 -9
- package/bundles/cdk-coercion.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.min.js +1 -1
- package/bundles/cdk-coercion.umd.min.js.map +1 -1
- package/bundles/cdk-collections.umd.js +28 -5
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +2297 -973
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +2 -1
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-keycodes.umd.js +12 -2
- package/bundles/cdk-keycodes.umd.js.map +1 -1
- package/bundles/cdk-layout.umd.js +29 -22
- package/bundles/cdk-layout.umd.js.map +1 -1
- package/bundles/cdk-layout.umd.min.js +1 -1
- package/bundles/cdk-layout.umd.min.js.map +1 -1
- package/bundles/cdk-observers.umd.js +27 -8
- package/bundles/cdk-observers.umd.js.map +1 -1
- package/bundles/cdk-observers.umd.min.js +1 -1
- package/bundles/cdk-observers.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +586 -240
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +2 -2
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +50 -28
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-portal.umd.js +17 -10
- package/bundles/cdk-portal.umd.js.map +1 -1
- package/bundles/cdk-portal.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +148 -50
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +1 -1
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-stepper.umd.js +69 -27
- package/bundles/cdk-stepper.umd.js.map +1 -1
- package/bundles/cdk-stepper.umd.min.js +1 -1
- package/bundles/cdk-stepper.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +189 -51
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +1 -1
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +76 -38
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +1 -1
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +71 -34
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js +1 -1
- package/bundles/cdk-tree.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +5 -4
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/coercion/typings/element.d.ts +13 -0
- package/coercion/typings/index.metadata.json +1 -1
- package/coercion/typings/public-api.d.ts +1 -0
- package/drag-drop/typings/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
- package/drag-drop/typings/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
- package/drag-drop/typings/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
- package/drag-drop/typings/directives/drag.d.ts +110 -0
- package/{typings/esm5/drag-drop → drag-drop/typings/directives}/drop-list-group.d.ts +3 -0
- package/drag-drop/typings/{drop-list.d.ts → directives/drop-list.d.ts} +32 -72
- package/drag-drop/typings/drag-drop-registry.d.ts +8 -3
- package/drag-drop/typings/drag-events.d.ts +14 -7
- package/{typings/esm5/drag-drop/drag.d.ts → drag-drop/typings/drag-ref.d.ts} +152 -83
- package/drag-drop/typings/drop-list-container.d.ts +19 -3
- package/drag-drop/typings/drop-list-ref.d.ts +234 -0
- package/drag-drop/typings/index.d.ts +1 -0
- package/drag-drop/typings/index.metadata.json +1 -1
- package/drag-drop/typings/public-api.d.ts +13 -6
- package/esm2015/a11y.js +306 -182
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/accordion.js +16 -11
- package/esm2015/accordion.js.map +1 -1
- package/esm2015/bidi.js +13 -8
- package/esm2015/bidi.js.map +1 -1
- package/esm2015/cdk.js +7 -6
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/coercion.js +25 -8
- package/esm2015/coercion.js.map +1 -1
- package/esm2015/collections.js +22 -7
- package/esm2015/collections.js.map +1 -1
- package/esm2015/drag-drop.js +1774 -864
- package/esm2015/drag-drop.js.map +1 -1
- package/esm2015/keycodes.js +14 -4
- package/esm2015/keycodes.js.map +1 -1
- package/esm2015/layout.js +29 -19
- package/esm2015/layout.js.map +1 -1
- package/esm2015/observers.js +16 -11
- package/esm2015/observers.js.map +1 -1
- package/esm2015/overlay.js +373 -213
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/platform.js +53 -31
- package/esm2015/platform.js.map +1 -1
- package/esm2015/portal.js +14 -10
- package/esm2015/portal.js.map +1 -1
- package/esm2015/scrolling.js +111 -51
- package/esm2015/scrolling.js.map +1 -1
- package/esm2015/stepper.js +56 -30
- package/esm2015/stepper.js.map +1 -1
- package/esm2015/table.js +96 -48
- package/esm2015/table.js.map +1 -1
- package/esm2015/text-field.js +54 -37
- package/esm2015/text-field.js.map +1 -1
- package/esm2015/tree.js +55 -36
- package/esm2015/tree.js.map +1 -1
- package/esm5/a11y.es5.js +432 -201
- package/esm5/a11y.es5.js.map +1 -1
- package/esm5/accordion.es5.js +18 -11
- package/esm5/accordion.es5.js.map +1 -1
- package/esm5/bidi.es5.js +13 -8
- package/esm5/bidi.es5.js.map +1 -1
- package/esm5/cdk.es5.js +7 -6
- package/esm5/cdk.es5.js.map +1 -1
- package/esm5/coercion.es5.js +25 -8
- package/esm5/coercion.es5.js.map +1 -1
- package/esm5/collections.es5.js +35 -7
- package/esm5/collections.es5.js.map +1 -1
- package/esm5/drag-drop.es5.js +2358 -1035
- package/esm5/drag-drop.es5.js.map +1 -1
- package/esm5/keycodes.es5.js +14 -4
- package/esm5/keycodes.es5.js.map +1 -1
- package/esm5/layout.es5.js +31 -24
- package/esm5/layout.es5.js.map +1 -1
- package/esm5/observers.es5.js +30 -11
- package/esm5/observers.es5.js.map +1 -1
- package/esm5/overlay.es5.js +590 -244
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/platform.es5.js +52 -30
- package/esm5/platform.es5.js.map +1 -1
- package/esm5/portal.es5.js +19 -12
- package/esm5/portal.es5.js.map +1 -1
- package/esm5/scrolling.es5.js +150 -52
- package/esm5/scrolling.es5.js.map +1 -1
- package/esm5/stepper.es5.js +71 -30
- package/esm5/stepper.es5.js.map +1 -1
- package/esm5/table.es5.js +191 -53
- package/esm5/table.es5.js.map +1 -1
- package/esm5/text-field.es5.js +75 -37
- package/esm5/text-field.es5.js.map +1 -1
- package/esm5/tree.es5.js +74 -37
- package/esm5/tree.es5.js.map +1 -1
- package/overlay/typings/index.metadata.json +1 -1
- package/overlay/typings/overlay-directives.d.ts +0 -2
- package/overlay/typings/overlay-ref.d.ts +1 -1
- package/package.json +4 -4
- package/portal/typings/portal.d.ts +1 -1
- package/schematics/migration.json +5 -0
- package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts +2 -2
- package/schematics/ng-update/index.d.ts +2 -0
- package/schematics/ng-update/index.js +5 -0
- package/schematics/ng-update/index.js.map +1 -1
- package/schematics/ng-update/target-version.d.ts +7 -1
- package/schematics/ng-update/target-version.js +10 -0
- package/schematics/ng-update/target-version.js.map +1 -1
- package/schematics/ng-update/upgrade-data.js +2 -1
- package/schematics/ng-update/upgrade-data.js.map +1 -1
- package/schematics/ng-update/upgrade-rules/index.js +3 -2
- package/schematics/ng-update/upgrade-rules/index.js.map +1 -1
- package/schematics/utils/ast/ng-module-imports.d.ts +1 -1
- package/schematics/utils/ast/ng-module-imports.js +25 -13
- package/schematics/utils/ast/ng-module-imports.js.map +1 -1
- package/schematics/utils/get-project.js +2 -1
- package/schematics/utils/get-project.js.map +1 -1
- package/schematics/utils/parse5-element.js +3 -2
- package/schematics/utils/parse5-element.js.map +1 -1
- package/schematics/utils/project-targets.js +2 -1
- package/schematics/utils/project-targets.js.map +1 -1
- package/schematics/utils/version-agnostic-typescript.js +3 -2
- package/schematics/utils/version-agnostic-typescript.js.map +1 -1
- package/scrolling/typings/index.metadata.json +1 -1
- package/stepper/typings/index.metadata.json +1 -1
- package/stepper/typings/stepper.d.ts +13 -1
- package/text-field/typings/autosize.d.ts +6 -0
- package/text-field/typings/index.metadata.json +1 -1
- package/tree/typings/control/base-tree-control.d.ts +1 -1
- package/tree/typings/control/nested-tree-control.d.ts +2 -2
- package/tree/typings/control/tree-control.d.ts +1 -1
- package/tree/typings/nested-node.d.ts +5 -5
- package/typings/a11y/focus-monitor/focus-monitor.d.ts +20 -5
- package/typings/a11y/focus-trap/focus-trap.d.ts +2 -0
- package/typings/a11y/index.metadata.json +1 -1
- package/typings/coercion/element.d.ts +13 -0
- package/typings/coercion/index.metadata.json +1 -1
- package/typings/coercion/public-api.d.ts +1 -0
- package/typings/drag-drop/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
- package/typings/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
- package/typings/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
- package/typings/drag-drop/directives/drag.d.ts +110 -0
- package/typings/drag-drop/{drop-list-group.d.ts → directives/drop-list-group.d.ts} +3 -0
- package/typings/{esm5/drag-drop → drag-drop/directives}/drop-list.d.ts +32 -72
- package/typings/drag-drop/drag-drop-registry.d.ts +8 -3
- package/typings/drag-drop/drag-events.d.ts +14 -7
- package/typings/drag-drop/{drag.d.ts → drag-ref.d.ts} +152 -83
- package/typings/drag-drop/drop-list-container.d.ts +19 -3
- package/typings/drag-drop/drop-list-ref.d.ts +234 -0
- package/typings/drag-drop/index.d.ts +1 -0
- package/typings/drag-drop/index.metadata.json +1 -1
- package/typings/drag-drop/public-api.d.ts +13 -6
- package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +20 -5
- package/typings/esm5/a11y/focus-trap/focus-trap.d.ts +2 -0
- package/typings/esm5/a11y/index.metadata.json +1 -1
- package/typings/esm5/coercion/element.d.ts +13 -0
- package/typings/esm5/coercion/index.metadata.json +1 -1
- package/typings/esm5/coercion/public-api.d.ts +1 -0
- package/typings/esm5/drag-drop/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
- package/typings/esm5/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
- package/typings/esm5/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
- package/typings/esm5/drag-drop/directives/drag.d.ts +110 -0
- package/{drag-drop/typings → typings/esm5/drag-drop/directives}/drop-list-group.d.ts +3 -0
- package/typings/{drag-drop → esm5/drag-drop/directives}/drop-list.d.ts +32 -72
- package/typings/esm5/drag-drop/drag-drop-registry.d.ts +8 -3
- package/typings/esm5/drag-drop/drag-events.d.ts +14 -7
- package/{drag-drop/typings/drag.d.ts → typings/esm5/drag-drop/drag-ref.d.ts} +152 -83
- package/typings/esm5/drag-drop/drop-list-container.d.ts +19 -3
- package/typings/esm5/drag-drop/drop-list-ref.d.ts +234 -0
- package/typings/esm5/drag-drop/index.d.ts +1 -0
- package/typings/esm5/drag-drop/index.metadata.json +1 -1
- package/typings/esm5/drag-drop/public-api.d.ts +13 -6
- package/typings/esm5/index.metadata.json +1 -1
- package/typings/esm5/overlay/index.metadata.json +1 -1
- package/typings/esm5/overlay/overlay-directives.d.ts +0 -2
- package/typings/esm5/overlay/overlay-ref.d.ts +1 -1
- package/typings/esm5/portal/portal.d.ts +1 -1
- package/typings/esm5/scrolling/index.metadata.json +1 -1
- package/typings/esm5/stepper/index.metadata.json +1 -1
- package/typings/esm5/stepper/stepper.d.ts +13 -1
- package/typings/esm5/text-field/autosize.d.ts +6 -0
- package/typings/esm5/text-field/index.metadata.json +1 -1
- package/typings/esm5/tree/control/base-tree-control.d.ts +1 -1
- package/typings/esm5/tree/control/nested-tree-control.d.ts +2 -2
- package/typings/esm5/tree/control/tree-control.d.ts +1 -1
- package/typings/esm5/tree/nested-node.d.ts +5 -5
- package/typings/index.metadata.json +1 -1
- package/typings/overlay/index.metadata.json +1 -1
- package/typings/overlay/overlay-directives.d.ts +0 -2
- package/typings/overlay/overlay-ref.d.ts +1 -1
- package/typings/portal/portal.d.ts +1 -1
- package/typings/schematics/ng-update/index.d.ts +2 -0
- package/typings/schematics/ng-update/target-version.d.ts +7 -1
- package/typings/schematics/utils/ast/ng-module-imports.d.ts +1 -1
- package/typings/scrolling/index.metadata.json +1 -1
- package/typings/stepper/index.metadata.json +1 -1
- package/typings/stepper/stepper.d.ts +13 -1
- package/typings/text-field/autosize.d.ts +6 -0
- package/typings/text-field/index.metadata.json +1 -1
- package/typings/tree/control/base-tree-control.d.ts +1 -1
- package/typings/tree/control/nested-tree-control.d.ts +2 -2
- package/typings/tree/control/tree-control.d.ts +1 -1
- package/typings/tree/nested-node.d.ts +5 -5
|
@@ -42,16 +42,17 @@ function __extends(d, b) {
|
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* @fileoverview added by tsickle
|
|
45
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
45
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
46
46
|
*/
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
48
|
* The injection token used to specify the virtual scrolling strategy.
|
|
49
|
-
|
|
49
|
+
* @type {?}
|
|
50
|
+
*/
|
|
50
51
|
var VIRTUAL_SCROLL_STRATEGY = new core.InjectionToken('VIRTUAL_SCROLL_STRATEGY');
|
|
51
52
|
|
|
52
53
|
/**
|
|
53
54
|
* @fileoverview added by tsickle
|
|
54
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
55
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
55
56
|
*/
|
|
56
57
|
/**
|
|
57
58
|
* Virtual scrolling strategy for lists with items of known fixed size.
|
|
@@ -175,9 +176,7 @@ FixedSizeVirtualScrollStrategy = /** @class */ (function () {
|
|
|
175
176
|
* \@docs-private Implemented as part of VirtualScrollStrategy.
|
|
176
177
|
* @return {?}
|
|
177
178
|
*/
|
|
178
|
-
function () {
|
|
179
|
-
/* no-op */
|
|
180
|
-
};
|
|
179
|
+
function () { };
|
|
181
180
|
/** @docs-private Implemented as part of VirtualScrollStrategy. */
|
|
182
181
|
/**
|
|
183
182
|
* \@docs-private Implemented as part of VirtualScrollStrategy.
|
|
@@ -187,9 +186,7 @@ FixedSizeVirtualScrollStrategy = /** @class */ (function () {
|
|
|
187
186
|
* \@docs-private Implemented as part of VirtualScrollStrategy.
|
|
188
187
|
* @return {?}
|
|
189
188
|
*/
|
|
190
|
-
function () {
|
|
191
|
-
/* no-op */
|
|
192
|
-
};
|
|
189
|
+
function () { };
|
|
193
190
|
/**
|
|
194
191
|
* Scroll to the offset for the given index.
|
|
195
192
|
* @param index The index of the element to scroll to.
|
|
@@ -212,12 +209,15 @@ FixedSizeVirtualScrollStrategy = /** @class */ (function () {
|
|
|
212
209
|
this._viewport.scrollToOffset(index * this._itemSize, behavior);
|
|
213
210
|
}
|
|
214
211
|
};
|
|
212
|
+
/** Update the viewport's total content size. */
|
|
215
213
|
/**
|
|
216
214
|
* Update the viewport's total content size.
|
|
215
|
+
* @private
|
|
217
216
|
* @return {?}
|
|
218
217
|
*/
|
|
219
218
|
FixedSizeVirtualScrollStrategy.prototype._updateTotalContentSize = /**
|
|
220
219
|
* Update the viewport's total content size.
|
|
220
|
+
* @private
|
|
221
221
|
* @return {?}
|
|
222
222
|
*/
|
|
223
223
|
function () {
|
|
@@ -226,12 +226,15 @@ FixedSizeVirtualScrollStrategy = /** @class */ (function () {
|
|
|
226
226
|
}
|
|
227
227
|
this._viewport.setTotalContentSize(this._viewport.getDataLength() * this._itemSize);
|
|
228
228
|
};
|
|
229
|
+
/** Update the viewport's rendered range. */
|
|
229
230
|
/**
|
|
230
231
|
* Update the viewport's rendered range.
|
|
232
|
+
* @private
|
|
231
233
|
* @return {?}
|
|
232
234
|
*/
|
|
233
235
|
FixedSizeVirtualScrollStrategy.prototype._updateRenderedRange = /**
|
|
234
236
|
* Update the viewport's rendered range.
|
|
237
|
+
* @private
|
|
235
238
|
* @return {?}
|
|
236
239
|
*/
|
|
237
240
|
function () {
|
|
@@ -379,11 +382,12 @@ var CdkFixedSizeVirtualScroll = /** @class */ (function () {
|
|
|
379
382
|
|
|
380
383
|
/**
|
|
381
384
|
* @fileoverview added by tsickle
|
|
382
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
385
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
383
386
|
*/
|
|
384
|
-
/**
|
|
387
|
+
/**
|
|
385
388
|
* Time in ms to throttle the scrolling events by default.
|
|
386
|
-
|
|
389
|
+
* @type {?}
|
|
390
|
+
*/
|
|
387
391
|
var DEFAULT_SCROLL_TIME = 20;
|
|
388
392
|
/**
|
|
389
393
|
* Service contained all registered Scrollable references and emits an event when any one of the
|
|
@@ -497,10 +501,12 @@ var ScrollDispatcher = /** @class */ (function () {
|
|
|
497
501
|
if (!this._platform.isBrowser) {
|
|
498
502
|
return rxjs.of();
|
|
499
503
|
}
|
|
500
|
-
return rxjs.Observable
|
|
504
|
+
return new rxjs.Observable(function (observer) {
|
|
501
505
|
if (!_this._globalSubscription) {
|
|
502
506
|
_this._addGlobalListener();
|
|
503
507
|
}
|
|
508
|
+
// In the case of a 0ms delay, use an observable without auditTime
|
|
509
|
+
// since it does add a perceptible delay in processing overhead.
|
|
504
510
|
/** @type {?} */
|
|
505
511
|
var subscription = auditTimeInMs > 0 ?
|
|
506
512
|
_this._scrolled.pipe(operators.auditTime(auditTimeInMs)).subscribe(observer) :
|
|
@@ -576,14 +582,17 @@ var ScrollDispatcher = /** @class */ (function () {
|
|
|
576
582
|
});
|
|
577
583
|
return scrollingContainers;
|
|
578
584
|
};
|
|
585
|
+
/** Returns true if the element is contained within the provided Scrollable. */
|
|
579
586
|
/**
|
|
580
587
|
* Returns true if the element is contained within the provided Scrollable.
|
|
588
|
+
* @private
|
|
581
589
|
* @param {?} scrollable
|
|
582
590
|
* @param {?} elementRef
|
|
583
591
|
* @return {?}
|
|
584
592
|
*/
|
|
585
593
|
ScrollDispatcher.prototype._scrollableContainsElement = /**
|
|
586
594
|
* Returns true if the element is contained within the provided Scrollable.
|
|
595
|
+
* @private
|
|
587
596
|
* @param {?} scrollable
|
|
588
597
|
* @param {?} elementRef
|
|
589
598
|
* @return {?}
|
|
@@ -599,15 +608,18 @@ var ScrollDispatcher = /** @class */ (function () {
|
|
|
599
608
|
if (element == scrollableElement) {
|
|
600
609
|
return true;
|
|
601
610
|
}
|
|
602
|
-
} while (element = /** @type {?} */ (
|
|
611
|
+
} while (element = (/** @type {?} */ (element)).parentElement);
|
|
603
612
|
return false;
|
|
604
613
|
};
|
|
614
|
+
/** Sets up the global scroll listeners. */
|
|
605
615
|
/**
|
|
606
616
|
* Sets up the global scroll listeners.
|
|
617
|
+
* @private
|
|
607
618
|
* @return {?}
|
|
608
619
|
*/
|
|
609
620
|
ScrollDispatcher.prototype._addGlobalListener = /**
|
|
610
621
|
* Sets up the global scroll listeners.
|
|
622
|
+
* @private
|
|
611
623
|
* @return {?}
|
|
612
624
|
*/
|
|
613
625
|
function () {
|
|
@@ -616,12 +628,15 @@ var ScrollDispatcher = /** @class */ (function () {
|
|
|
616
628
|
return rxjs.fromEvent(window.document, 'scroll').subscribe(function () { return _this._scrolled.next(); });
|
|
617
629
|
});
|
|
618
630
|
};
|
|
631
|
+
/** Cleans up the global scroll listener. */
|
|
619
632
|
/**
|
|
620
633
|
* Cleans up the global scroll listener.
|
|
634
|
+
* @private
|
|
621
635
|
* @return {?}
|
|
622
636
|
*/
|
|
623
637
|
ScrollDispatcher.prototype._removeGlobalListener = /**
|
|
624
638
|
* Cleans up the global scroll listener.
|
|
639
|
+
* @private
|
|
625
640
|
* @return {?}
|
|
626
641
|
*/
|
|
627
642
|
function () {
|
|
@@ -651,9 +666,10 @@ var ScrollDispatcher = /** @class */ (function () {
|
|
|
651
666
|
function SCROLL_DISPATCHER_PROVIDER_FACTORY(parentDispatcher, ngZone, platform$$1) {
|
|
652
667
|
return parentDispatcher || new ScrollDispatcher(ngZone, platform$$1);
|
|
653
668
|
}
|
|
654
|
-
/**
|
|
669
|
+
/**
|
|
655
670
|
* \@docs-private \@deprecated \@breaking-change 8.0.0
|
|
656
|
-
|
|
671
|
+
* @type {?}
|
|
672
|
+
*/
|
|
657
673
|
var SCROLL_DISPATCHER_PROVIDER = {
|
|
658
674
|
// If there is already a ScrollDispatcher available, use that. Otherwise, provide a new one.
|
|
659
675
|
provide: ScrollDispatcher,
|
|
@@ -663,7 +679,7 @@ var SCROLL_DISPATCHER_PROVIDER = {
|
|
|
663
679
|
|
|
664
680
|
/**
|
|
665
681
|
* @fileoverview added by tsickle
|
|
666
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
682
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
667
683
|
*/
|
|
668
684
|
/**
|
|
669
685
|
* Sends an event when the directive's element is scrolled. Registers itself with the
|
|
@@ -678,7 +694,7 @@ var CdkScrollable = /** @class */ (function () {
|
|
|
678
694
|
this.ngZone = ngZone;
|
|
679
695
|
this.dir = dir;
|
|
680
696
|
this._destroyed = new rxjs.Subject();
|
|
681
|
-
this._elementScrolled = rxjs.Observable
|
|
697
|
+
this._elementScrolled = new rxjs.Observable(function (observer) {
|
|
682
698
|
return _this.ngZone.runOutsideAngular(function () {
|
|
683
699
|
return rxjs.fromEvent(_this.elementRef.nativeElement, 'scroll').pipe(operators.takeUntil(_this._destroyed))
|
|
684
700
|
.subscribe(observer);
|
|
@@ -765,12 +781,14 @@ var CdkScrollable = /** @class */ (function () {
|
|
|
765
781
|
options.right = options.right == null ? (isRtl ? options.start : options.end) : options.right;
|
|
766
782
|
// Rewrite the bottom offset as a top offset.
|
|
767
783
|
if (options.bottom != null) {
|
|
768
|
-
|
|
784
|
+
((/** @type {?} */ (options))).top =
|
|
785
|
+
el.scrollHeight - el.clientHeight - options.bottom;
|
|
769
786
|
}
|
|
770
787
|
// Rewrite the right offset as a left offset.
|
|
771
788
|
if (isRtl && platform.getRtlScrollAxisType() != platform.RtlScrollAxisType.NORMAL) {
|
|
772
789
|
if (options.left != null) {
|
|
773
|
-
|
|
790
|
+
((/** @type {?} */ (options))).right =
|
|
791
|
+
el.scrollWidth - el.clientWidth - options.left;
|
|
774
792
|
}
|
|
775
793
|
if (platform.getRtlScrollAxisType() == platform.RtlScrollAxisType.INVERTED) {
|
|
776
794
|
options.left = options.right;
|
|
@@ -781,16 +799,19 @@ var CdkScrollable = /** @class */ (function () {
|
|
|
781
799
|
}
|
|
782
800
|
else {
|
|
783
801
|
if (options.right != null) {
|
|
784
|
-
|
|
802
|
+
((/** @type {?} */ (options))).left =
|
|
803
|
+
el.scrollWidth - el.clientWidth - options.right;
|
|
785
804
|
}
|
|
786
805
|
}
|
|
787
806
|
this._applyScrollToOptions(options);
|
|
788
807
|
};
|
|
789
808
|
/**
|
|
809
|
+
* @private
|
|
790
810
|
* @param {?} options
|
|
791
811
|
* @return {?}
|
|
792
812
|
*/
|
|
793
813
|
CdkScrollable.prototype._applyScrollToOptions = /**
|
|
814
|
+
* @private
|
|
794
815
|
* @param {?} options
|
|
795
816
|
* @return {?}
|
|
796
817
|
*/
|
|
@@ -851,6 +872,7 @@ var CdkScrollable = /** @class */ (function () {
|
|
|
851
872
|
if (from == 'bottom') {
|
|
852
873
|
return el.scrollHeight - el.clientHeight - el.scrollTop;
|
|
853
874
|
}
|
|
875
|
+
// Rewrite start & end as left or right offsets.
|
|
854
876
|
/** @type {?} */
|
|
855
877
|
var isRtl = this.dir && this.dir.value == 'rtl';
|
|
856
878
|
if (from == 'start') {
|
|
@@ -907,7 +929,7 @@ var CdkScrollable = /** @class */ (function () {
|
|
|
907
929
|
|
|
908
930
|
/**
|
|
909
931
|
* @fileoverview added by tsickle
|
|
910
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
932
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
911
933
|
*/
|
|
912
934
|
/**
|
|
913
935
|
* Checks if the given ranges are equal.
|
|
@@ -940,10 +962,14 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
940
962
|
* The direction the viewport scrolls.
|
|
941
963
|
*/
|
|
942
964
|
_this.orientation = 'vertical';
|
|
965
|
+
// Note: we don't use the typical EventEmitter here because we need to subscribe to the scroll
|
|
966
|
+
// strategy lazily (i.e. only if the user is actually listening to the events). We do this because
|
|
967
|
+
// depending on how the strategy calculates the scrolled index, it may come at a cost to
|
|
968
|
+
// performance.
|
|
943
969
|
/**
|
|
944
970
|
* Emits when the index of the first element visible in the viewport changes.
|
|
945
971
|
*/
|
|
946
|
-
_this.scrolledIndexChange = rxjs.Observable
|
|
972
|
+
_this.scrolledIndexChange = new rxjs.Observable(function (observer) {
|
|
947
973
|
return _this._scrollStrategy.scrolledIndexChange.subscribe(function (index) {
|
|
948
974
|
return Promise.resolve().then(function () { return _this.ngZone.run(function () { return observer.next(index); }); });
|
|
949
975
|
});
|
|
@@ -1014,7 +1040,7 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1014
1040
|
_this.elementScrolled()
|
|
1015
1041
|
.pipe(
|
|
1016
1042
|
// Start off with a fake scroll event so we properly detect our initial position.
|
|
1017
|
-
operators.startWith(/** @type {?} */ (
|
|
1043
|
+
operators.startWith((/** @type {?} */ (null))),
|
|
1018
1044
|
// Collect multiple events into one until the next animation frame. This way if
|
|
1019
1045
|
// there are multiple scroll events in the same frame we only need to recheck
|
|
1020
1046
|
// our layout once.
|
|
@@ -1111,11 +1137,20 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1111
1137
|
// setting it to something else, but its error prone and should probably be split into
|
|
1112
1138
|
// `pendingRange` and `renderedRange`, the latter reflecting whats actually in the DOM.
|
|
1113
1139
|
/** Get the current rendered range of items. */
|
|
1140
|
+
// TODO(mmalerba): This is technically out of sync with what's really rendered until a render
|
|
1141
|
+
// cycle happens. I'm being careful to only call it after the render cycle is complete and before
|
|
1142
|
+
// setting it to something else, but its error prone and should probably be split into
|
|
1143
|
+
// `pendingRange` and `renderedRange`, the latter reflecting whats actually in the DOM.
|
|
1114
1144
|
/**
|
|
1115
1145
|
* Get the current rendered range of items.
|
|
1116
1146
|
* @return {?}
|
|
1117
1147
|
*/
|
|
1118
|
-
CdkVirtualScrollViewport.prototype.getRenderedRange =
|
|
1148
|
+
CdkVirtualScrollViewport.prototype.getRenderedRange =
|
|
1149
|
+
// TODO(mmalerba): This is technically out of sync with what's really rendered until a render
|
|
1150
|
+
// cycle happens. I'm being careful to only call it after the render cycle is complete and before
|
|
1151
|
+
// setting it to something else, but its error prone and should probably be split into
|
|
1152
|
+
// `pendingRange` and `renderedRange`, the latter reflecting whats actually in the DOM.
|
|
1153
|
+
/**
|
|
1119
1154
|
* Get the current rendered range of items.
|
|
1120
1155
|
* @return {?}
|
|
1121
1156
|
*/
|
|
@@ -1200,6 +1235,8 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1200
1235
|
function (offset, to) {
|
|
1201
1236
|
var _this = this;
|
|
1202
1237
|
if (to === void 0) { to = 'to-start'; }
|
|
1238
|
+
// For a horizontal viewport in a right-to-left language we need to translate along the x-axis
|
|
1239
|
+
// in the negative direction.
|
|
1203
1240
|
/** @type {?} */
|
|
1204
1241
|
var isRtl = this.dir && this.dir.value == 'rtl';
|
|
1205
1242
|
/** @type {?} */
|
|
@@ -1360,12 +1397,15 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1360
1397
|
this._measureViewportSize();
|
|
1361
1398
|
this._scrollStrategy.onDataLengthChanged();
|
|
1362
1399
|
};
|
|
1400
|
+
/** Measure the viewport size. */
|
|
1363
1401
|
/**
|
|
1364
1402
|
* Measure the viewport size.
|
|
1403
|
+
* @private
|
|
1365
1404
|
* @return {?}
|
|
1366
1405
|
*/
|
|
1367
1406
|
CdkVirtualScrollViewport.prototype._measureViewportSize = /**
|
|
1368
1407
|
* Measure the viewport size.
|
|
1408
|
+
* @private
|
|
1369
1409
|
* @return {?}
|
|
1370
1410
|
*/
|
|
1371
1411
|
function () {
|
|
@@ -1374,13 +1414,16 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1374
1414
|
this._viewportSize = this.orientation === 'horizontal' ?
|
|
1375
1415
|
viewportEl.clientWidth : viewportEl.clientHeight;
|
|
1376
1416
|
};
|
|
1417
|
+
/** Queue up change detection to run. */
|
|
1377
1418
|
/**
|
|
1378
1419
|
* Queue up change detection to run.
|
|
1420
|
+
* @private
|
|
1379
1421
|
* @param {?=} runAfter
|
|
1380
1422
|
* @return {?}
|
|
1381
1423
|
*/
|
|
1382
1424
|
CdkVirtualScrollViewport.prototype._markChangeDetectionNeeded = /**
|
|
1383
1425
|
* Queue up change detection to run.
|
|
1426
|
+
* @private
|
|
1384
1427
|
* @param {?=} runAfter
|
|
1385
1428
|
* @return {?}
|
|
1386
1429
|
*/
|
|
@@ -1398,12 +1441,15 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1398
1441
|
}); });
|
|
1399
1442
|
}
|
|
1400
1443
|
};
|
|
1444
|
+
/** Run change detection. */
|
|
1401
1445
|
/**
|
|
1402
1446
|
* Run change detection.
|
|
1447
|
+
* @private
|
|
1403
1448
|
* @return {?}
|
|
1404
1449
|
*/
|
|
1405
1450
|
CdkVirtualScrollViewport.prototype._doChangeDetection = /**
|
|
1406
1451
|
* Run change detection.
|
|
1452
|
+
* @private
|
|
1407
1453
|
* @return {?}
|
|
1408
1454
|
*/
|
|
1409
1455
|
function () {
|
|
@@ -1433,10 +1479,14 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1433
1479
|
host: {
|
|
1434
1480
|
'class': 'cdk-virtual-scroll-viewport',
|
|
1435
1481
|
'[class.cdk-virtual-scroll-orientation-horizontal]': 'orientation === "horizontal"',
|
|
1436
|
-
'[class.cdk-virtual-scroll-orientation-vertical]': 'orientation
|
|
1482
|
+
'[class.cdk-virtual-scroll-orientation-vertical]': 'orientation !== "horizontal"',
|
|
1437
1483
|
},
|
|
1438
1484
|
encapsulation: core.ViewEncapsulation.None,
|
|
1439
1485
|
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
1486
|
+
providers: [{
|
|
1487
|
+
provide: CdkScrollable,
|
|
1488
|
+
useExisting: CdkVirtualScrollViewport,
|
|
1489
|
+
}]
|
|
1440
1490
|
},] },
|
|
1441
1491
|
];
|
|
1442
1492
|
/** @nocollapse */
|
|
@@ -1458,7 +1508,7 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1458
1508
|
|
|
1459
1509
|
/**
|
|
1460
1510
|
* @fileoverview added by tsickle
|
|
1461
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1511
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1462
1512
|
*/
|
|
1463
1513
|
/**
|
|
1464
1514
|
* Helper to extract size from a DOM Node.
|
|
@@ -1468,7 +1518,7 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1468
1518
|
*/
|
|
1469
1519
|
function getSize(orientation, node) {
|
|
1470
1520
|
/** @type {?} */
|
|
1471
|
-
var el = /** @type {?} */ (node);
|
|
1521
|
+
var el = (/** @type {?} */ (node));
|
|
1472
1522
|
if (!el.getBoundingClientRect) {
|
|
1473
1523
|
return 0;
|
|
1474
1524
|
}
|
|
@@ -1482,8 +1532,7 @@ function getSize(orientation, node) {
|
|
|
1482
1532
|
* @template T
|
|
1483
1533
|
*/
|
|
1484
1534
|
var CdkVirtualForOf = /** @class */ (function () {
|
|
1485
|
-
function CdkVirtualForOf(_viewContainerRef, _template, _differs,
|
|
1486
|
-
_viewport, ngZone) {
|
|
1535
|
+
function CdkVirtualForOf(_viewContainerRef, _template, _differs, _viewport, ngZone) {
|
|
1487
1536
|
var _this = this;
|
|
1488
1537
|
this._viewContainerRef = _viewContainerRef;
|
|
1489
1538
|
this._template = _template;
|
|
@@ -1508,7 +1557,7 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1508
1557
|
this.dataStream = this._dataSourceChanges
|
|
1509
1558
|
.pipe(
|
|
1510
1559
|
// Start off with null `DataSource`.
|
|
1511
|
-
operators.startWith(/** @type {?} */ (
|
|
1560
|
+
operators.startWith((/** @type {?} */ (null))),
|
|
1512
1561
|
// Bundle up the previous and current data sources so we can work with both.
|
|
1513
1562
|
operators.pairwise(),
|
|
1514
1563
|
// Use `_changeDataSource` to disconnect from the previous data source and connect to the
|
|
@@ -1641,21 +1690,24 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1641
1690
|
if (range.start < this._renderedRange.start || range.end > this._renderedRange.end) {
|
|
1642
1691
|
throw Error("Error: attempted to measure an item that isn't rendered.");
|
|
1643
1692
|
}
|
|
1693
|
+
// The index into the list of rendered views for the first item in the range.
|
|
1644
1694
|
/** @type {?} */
|
|
1645
1695
|
var renderedStartIndex = range.start - this._renderedRange.start;
|
|
1696
|
+
// The length of the range we're measuring.
|
|
1646
1697
|
/** @type {?} */
|
|
1647
1698
|
var rangeLen = range.end - range.start;
|
|
1699
|
+
// Loop over all root nodes for all items in the range and sum up their size.
|
|
1648
1700
|
/** @type {?} */
|
|
1649
1701
|
var totalSize = 0;
|
|
1650
1702
|
/** @type {?} */
|
|
1651
1703
|
var i = rangeLen;
|
|
1652
1704
|
while (i--) {
|
|
1653
1705
|
/** @type {?} */
|
|
1654
|
-
var view = /** @type {?} */ (this._viewContainerRef.get(i + renderedStartIndex));
|
|
1706
|
+
var view = (/** @type {?} */ (this._viewContainerRef.get(i + renderedStartIndex)));
|
|
1655
1707
|
/** @type {?} */
|
|
1656
1708
|
var j = view ? view.rootNodes.length : 0;
|
|
1657
1709
|
while (j--) {
|
|
1658
|
-
totalSize += getSize(orientation, /** @type {?} */ (
|
|
1710
|
+
totalSize += getSize(orientation, (/** @type {?} */ (view)).rootNodes[j]);
|
|
1659
1711
|
}
|
|
1660
1712
|
}
|
|
1661
1713
|
return totalSize;
|
|
@@ -1668,6 +1720,9 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1668
1720
|
*/
|
|
1669
1721
|
function () {
|
|
1670
1722
|
if (this._differ && this._needsUpdate) {
|
|
1723
|
+
// TODO(mmalerba): We should differentiate needs update due to scrolling and a new portion of
|
|
1724
|
+
// this list being rendered (can use simpler algorithm) vs needs update due to data actually
|
|
1725
|
+
// changing (need to do this diff).
|
|
1671
1726
|
/** @type {?} */
|
|
1672
1727
|
var changes = this._differ.diff(this._renderedItems);
|
|
1673
1728
|
if (!changes) {
|
|
@@ -1696,12 +1751,15 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1696
1751
|
view.destroy();
|
|
1697
1752
|
}
|
|
1698
1753
|
};
|
|
1754
|
+
/** React to scroll state changes in the viewport. */
|
|
1699
1755
|
/**
|
|
1700
1756
|
* React to scroll state changes in the viewport.
|
|
1757
|
+
* @private
|
|
1701
1758
|
* @return {?}
|
|
1702
1759
|
*/
|
|
1703
1760
|
CdkVirtualForOf.prototype._onRenderedDataChange = /**
|
|
1704
1761
|
* React to scroll state changes in the viewport.
|
|
1762
|
+
* @private
|
|
1705
1763
|
* @return {?}
|
|
1706
1764
|
*/
|
|
1707
1765
|
function () {
|
|
@@ -1714,14 +1772,17 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1714
1772
|
}
|
|
1715
1773
|
this._needsUpdate = true;
|
|
1716
1774
|
};
|
|
1775
|
+
/** Swap out one `DataSource` for another. */
|
|
1717
1776
|
/**
|
|
1718
1777
|
* Swap out one `DataSource` for another.
|
|
1778
|
+
* @private
|
|
1719
1779
|
* @param {?} oldDs
|
|
1720
1780
|
* @param {?} newDs
|
|
1721
1781
|
* @return {?}
|
|
1722
1782
|
*/
|
|
1723
1783
|
CdkVirtualForOf.prototype._changeDataSource = /**
|
|
1724
1784
|
* Swap out one `DataSource` for another.
|
|
1785
|
+
* @private
|
|
1725
1786
|
* @param {?} oldDs
|
|
1726
1787
|
* @param {?} newDs
|
|
1727
1788
|
* @return {?}
|
|
@@ -1733,12 +1794,15 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1733
1794
|
this._needsUpdate = true;
|
|
1734
1795
|
return newDs.connect(this);
|
|
1735
1796
|
};
|
|
1797
|
+
/** Update the `CdkVirtualForOfContext` for all views. */
|
|
1736
1798
|
/**
|
|
1737
1799
|
* Update the `CdkVirtualForOfContext` for all views.
|
|
1800
|
+
* @private
|
|
1738
1801
|
* @return {?}
|
|
1739
1802
|
*/
|
|
1740
1803
|
CdkVirtualForOf.prototype._updateContext = /**
|
|
1741
1804
|
* Update the `CdkVirtualForOfContext` for all views.
|
|
1805
|
+
* @private
|
|
1742
1806
|
* @return {?}
|
|
1743
1807
|
*/
|
|
1744
1808
|
function () {
|
|
@@ -1748,20 +1812,23 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1748
1812
|
var i = this._viewContainerRef.length;
|
|
1749
1813
|
while (i--) {
|
|
1750
1814
|
/** @type {?} */
|
|
1751
|
-
var view = /** @type {?} */ (this._viewContainerRef.get(i));
|
|
1815
|
+
var view = (/** @type {?} */ (this._viewContainerRef.get(i)));
|
|
1752
1816
|
view.context.index = this._renderedRange.start + i;
|
|
1753
1817
|
view.context.count = count;
|
|
1754
1818
|
this._updateComputedContextProperties(view.context);
|
|
1755
1819
|
view.detectChanges();
|
|
1756
1820
|
}
|
|
1757
1821
|
};
|
|
1822
|
+
/** Apply changes to the DOM. */
|
|
1758
1823
|
/**
|
|
1759
1824
|
* Apply changes to the DOM.
|
|
1825
|
+
* @private
|
|
1760
1826
|
* @param {?} changes
|
|
1761
1827
|
* @return {?}
|
|
1762
1828
|
*/
|
|
1763
1829
|
CdkVirtualForOf.prototype._applyChanges = /**
|
|
1764
1830
|
* Apply changes to the DOM.
|
|
1831
|
+
* @private
|
|
1765
1832
|
* @param {?} changes
|
|
1766
1833
|
* @return {?}
|
|
1767
1834
|
*/
|
|
@@ -1770,18 +1837,19 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1770
1837
|
// Rearrange the views to put them in the right location.
|
|
1771
1838
|
changes.forEachOperation(function (record, adjustedPreviousIndex, currentIndex) {
|
|
1772
1839
|
if (record.previousIndex == null) { // Item added.
|
|
1840
|
+
// Item added.
|
|
1773
1841
|
/** @type {?} */
|
|
1774
1842
|
var view = _this._getViewForNewItem();
|
|
1775
|
-
_this._viewContainerRef.insert(view, /** @type {?} */ (
|
|
1843
|
+
_this._viewContainerRef.insert(view, (/** @type {?} */ (currentIndex)));
|
|
1776
1844
|
view.context.$implicit = record.item;
|
|
1777
1845
|
}
|
|
1778
1846
|
else if (currentIndex == null) { // Item removed.
|
|
1779
|
-
|
|
1780
|
-
_this._cacheView(/** @type {?} */ (_this._viewContainerRef.detach(/** @type {?} */ ((adjustedPreviousIndex)))));
|
|
1847
|
+
_this._cacheView((/** @type {?} */ (_this._viewContainerRef.detach((/** @type {?} */ (adjustedPreviousIndex))))));
|
|
1781
1848
|
}
|
|
1782
1849
|
else { // Item moved.
|
|
1850
|
+
// Item moved.
|
|
1783
1851
|
/** @type {?} */
|
|
1784
|
-
var view = /** @type {?} */ (_this._viewContainerRef.get(/** @type {?} */ (
|
|
1852
|
+
var view = (/** @type {?} */ (_this._viewContainerRef.get((/** @type {?} */ (adjustedPreviousIndex)))));
|
|
1785
1853
|
_this._viewContainerRef.move(view, currentIndex);
|
|
1786
1854
|
view.context.$implicit = record.item;
|
|
1787
1855
|
}
|
|
@@ -1789,28 +1857,32 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1789
1857
|
// Update $implicit for any items that had an identity change.
|
|
1790
1858
|
changes.forEachIdentityChange(function (record) {
|
|
1791
1859
|
/** @type {?} */
|
|
1792
|
-
var view = /** @type {?} */ (_this._viewContainerRef.get(/** @type {?} */ (
|
|
1860
|
+
var view = (/** @type {?} */ (_this._viewContainerRef.get((/** @type {?} */ (record.currentIndex)))));
|
|
1793
1861
|
view.context.$implicit = record.item;
|
|
1794
1862
|
});
|
|
1863
|
+
// Update the context variables on all items.
|
|
1795
1864
|
/** @type {?} */
|
|
1796
1865
|
var count = this._data.length;
|
|
1797
1866
|
/** @type {?} */
|
|
1798
1867
|
var i = this._viewContainerRef.length;
|
|
1799
1868
|
while (i--) {
|
|
1800
1869
|
/** @type {?} */
|
|
1801
|
-
var view = /** @type {?} */ (this._viewContainerRef.get(i));
|
|
1870
|
+
var view = (/** @type {?} */ (this._viewContainerRef.get(i)));
|
|
1802
1871
|
view.context.index = this._renderedRange.start + i;
|
|
1803
1872
|
view.context.count = count;
|
|
1804
1873
|
this._updateComputedContextProperties(view.context);
|
|
1805
1874
|
}
|
|
1806
1875
|
};
|
|
1876
|
+
/** Cache the given detached view. */
|
|
1807
1877
|
/**
|
|
1808
1878
|
* Cache the given detached view.
|
|
1879
|
+
* @private
|
|
1809
1880
|
* @param {?} view
|
|
1810
1881
|
* @return {?}
|
|
1811
1882
|
*/
|
|
1812
1883
|
CdkVirtualForOf.prototype._cacheView = /**
|
|
1813
1884
|
* Cache the given detached view.
|
|
1885
|
+
* @private
|
|
1814
1886
|
* @param {?} view
|
|
1815
1887
|
* @return {?}
|
|
1816
1888
|
*/
|
|
@@ -1832,17 +1904,20 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1832
1904
|
}
|
|
1833
1905
|
}
|
|
1834
1906
|
};
|
|
1907
|
+
/** Get a view for a new item, either from the cache or by creating a new one. */
|
|
1835
1908
|
/**
|
|
1836
1909
|
* Get a view for a new item, either from the cache or by creating a new one.
|
|
1910
|
+
* @private
|
|
1837
1911
|
* @return {?}
|
|
1838
1912
|
*/
|
|
1839
1913
|
CdkVirtualForOf.prototype._getViewForNewItem = /**
|
|
1840
1914
|
* Get a view for a new item, either from the cache or by creating a new one.
|
|
1915
|
+
* @private
|
|
1841
1916
|
* @return {?}
|
|
1842
1917
|
*/
|
|
1843
1918
|
function () {
|
|
1844
1919
|
return this._templateCache.pop() || this._viewContainerRef.createEmbeddedView(this._template, {
|
|
1845
|
-
$implicit: /** @type {?} */ (
|
|
1920
|
+
$implicit: (/** @type {?} */ (null)),
|
|
1846
1921
|
cdkVirtualForOf: this._cdkVirtualForOf,
|
|
1847
1922
|
index: -1,
|
|
1848
1923
|
count: -1,
|
|
@@ -1852,13 +1927,16 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1852
1927
|
even: false
|
|
1853
1928
|
});
|
|
1854
1929
|
};
|
|
1930
|
+
/** Update the computed properties on the `CdkVirtualForOfContext`. */
|
|
1855
1931
|
/**
|
|
1856
1932
|
* Update the computed properties on the `CdkVirtualForOfContext`.
|
|
1933
|
+
* @private
|
|
1857
1934
|
* @param {?} context
|
|
1858
1935
|
* @return {?}
|
|
1859
1936
|
*/
|
|
1860
1937
|
CdkVirtualForOf.prototype._updateComputedContextProperties = /**
|
|
1861
1938
|
* Update the computed properties on the `CdkVirtualForOfContext`.
|
|
1939
|
+
* @private
|
|
1862
1940
|
* @param {?} context
|
|
1863
1941
|
* @return {?}
|
|
1864
1942
|
*/
|
|
@@ -1892,7 +1970,7 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1892
1970
|
|
|
1893
1971
|
/**
|
|
1894
1972
|
* @fileoverview added by tsickle
|
|
1895
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1973
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1896
1974
|
*/
|
|
1897
1975
|
var ScrollingModule = /** @class */ (function () {
|
|
1898
1976
|
function ScrollingModule() {
|
|
@@ -1935,11 +2013,12 @@ var ScrollDispatchModule = /** @class */ (function () {
|
|
|
1935
2013
|
|
|
1936
2014
|
/**
|
|
1937
2015
|
* @fileoverview added by tsickle
|
|
1938
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
2016
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1939
2017
|
*/
|
|
1940
|
-
/**
|
|
2018
|
+
/**
|
|
1941
2019
|
* Time in ms to throttle the resize events by default.
|
|
1942
|
-
|
|
2020
|
+
* @type {?}
|
|
2021
|
+
*/
|
|
1943
2022
|
var DEFAULT_RESIZE_TIME = 20;
|
|
1944
2023
|
/**
|
|
1945
2024
|
* Simple utility for getting the bounds of the browser viewport.
|
|
@@ -1984,7 +2063,7 @@ var ViewportRuler = /** @class */ (function () {
|
|
|
1984
2063
|
var output = { width: this._viewportSize.width, height: this._viewportSize.height };
|
|
1985
2064
|
// If we're not on a browser, don't cache the size since it'll be mocked out anyway.
|
|
1986
2065
|
if (!this._platform.isBrowser) {
|
|
1987
|
-
this._viewportSize = /** @type {?} */ (
|
|
2066
|
+
this._viewportSize = (/** @type {?} */ (null));
|
|
1988
2067
|
}
|
|
1989
2068
|
return output;
|
|
1990
2069
|
};
|
|
@@ -1998,6 +2077,15 @@ var ViewportRuler = /** @class */ (function () {
|
|
|
1998
2077
|
* @return {?}
|
|
1999
2078
|
*/
|
|
2000
2079
|
function () {
|
|
2080
|
+
// Use the document element's bounding rect rather than the window scroll properties
|
|
2081
|
+
// (e.g. pageYOffset, scrollY) due to in issue in Chrome and IE where window scroll
|
|
2082
|
+
// properties and client coordinates (boundingClientRect, clientX/Y, etc.) are in different
|
|
2083
|
+
// conceptual viewports. Under most circumstances these viewports are equivalent, but they
|
|
2084
|
+
// can disagree when the page is pinch-zoomed (on devices that support touch).
|
|
2085
|
+
// See https://bugs.chromium.org/p/chromium/issues/detail?id=489206#c4
|
|
2086
|
+
// We use the documentElement instead of the body because, by default (without a css reset)
|
|
2087
|
+
// browsers typically give the document body an 8px margin, which is not included in
|
|
2088
|
+
// getBoundingClientRect().
|
|
2001
2089
|
/** @type {?} */
|
|
2002
2090
|
var scrollPosition = this.getViewportScrollPosition();
|
|
2003
2091
|
var _a = this.getViewportSize(), width = _a.width, height = _a.height;
|
|
@@ -2025,8 +2113,14 @@ var ViewportRuler = /** @class */ (function () {
|
|
|
2025
2113
|
if (!this._platform.isBrowser) {
|
|
2026
2114
|
return { top: 0, left: 0 };
|
|
2027
2115
|
}
|
|
2116
|
+
// The top-left-corner of the viewport is determined by the scroll position of the document
|
|
2117
|
+
// body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about
|
|
2118
|
+
// whether `document.body` or `document.documentElement` is the scrolled element, so reading
|
|
2119
|
+
// `scrollTop` and `scrollLeft` is inconsistent. However, using the bounding rect of
|
|
2120
|
+
// `document.documentElement` works consistently, where the `top` and `left` values will
|
|
2121
|
+
// equal negative the scroll position.
|
|
2028
2122
|
/** @type {?} */
|
|
2029
|
-
var documentElement = /** @type {?} */ (
|
|
2123
|
+
var documentElement = (/** @type {?} */ (document.documentElement));
|
|
2030
2124
|
/** @type {?} */
|
|
2031
2125
|
var documentRect = documentElement.getBoundingClientRect();
|
|
2032
2126
|
/** @type {?} */
|
|
@@ -2055,12 +2149,15 @@ var ViewportRuler = /** @class */ (function () {
|
|
|
2055
2149
|
if (throttleTime === void 0) { throttleTime = DEFAULT_RESIZE_TIME; }
|
|
2056
2150
|
return throttleTime > 0 ? this._change.pipe(operators.auditTime(throttleTime)) : this._change;
|
|
2057
2151
|
};
|
|
2152
|
+
/** Updates the cached viewport size. */
|
|
2058
2153
|
/**
|
|
2059
2154
|
* Updates the cached viewport size.
|
|
2155
|
+
* @private
|
|
2060
2156
|
* @return {?}
|
|
2061
2157
|
*/
|
|
2062
2158
|
ViewportRuler.prototype._updateViewportSize = /**
|
|
2063
2159
|
* Updates the cached viewport size.
|
|
2160
|
+
* @private
|
|
2064
2161
|
* @return {?}
|
|
2065
2162
|
*/
|
|
2066
2163
|
function () {
|
|
@@ -2089,9 +2186,10 @@ var ViewportRuler = /** @class */ (function () {
|
|
|
2089
2186
|
function VIEWPORT_RULER_PROVIDER_FACTORY(parentRuler, platform$$1, ngZone) {
|
|
2090
2187
|
return parentRuler || new ViewportRuler(platform$$1, ngZone);
|
|
2091
2188
|
}
|
|
2092
|
-
/**
|
|
2189
|
+
/**
|
|
2093
2190
|
* \@docs-private \@deprecated \@breaking-change 8.0.0
|
|
2094
|
-
|
|
2191
|
+
* @type {?}
|
|
2192
|
+
*/
|
|
2095
2193
|
var VIEWPORT_RULER_PROVIDER = {
|
|
2096
2194
|
// If there is already a ViewportRuler available, use that. Otherwise, provide a new one.
|
|
2097
2195
|
provide: ViewportRuler,
|