@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
package/esm5/scrolling.es5.js
CHANGED
|
@@ -16,16 +16,17 @@ import { ArrayDataSource, DataSource } from '@angular/cdk/collections';
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @fileoverview added by tsickle
|
|
19
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
19
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
20
20
|
*/
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
22
|
* The injection token used to specify the virtual scrolling strategy.
|
|
23
|
-
|
|
23
|
+
* @type {?}
|
|
24
|
+
*/
|
|
24
25
|
var VIRTUAL_SCROLL_STRATEGY = new InjectionToken('VIRTUAL_SCROLL_STRATEGY');
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* @fileoverview added by tsickle
|
|
28
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
29
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
29
30
|
*/
|
|
30
31
|
/**
|
|
31
32
|
* Virtual scrolling strategy for lists with items of known fixed size.
|
|
@@ -149,9 +150,7 @@ FixedSizeVirtualScrollStrategy = /** @class */ (function () {
|
|
|
149
150
|
* \@docs-private Implemented as part of VirtualScrollStrategy.
|
|
150
151
|
* @return {?}
|
|
151
152
|
*/
|
|
152
|
-
function () {
|
|
153
|
-
/* no-op */
|
|
154
|
-
};
|
|
153
|
+
function () { };
|
|
155
154
|
/** @docs-private Implemented as part of VirtualScrollStrategy. */
|
|
156
155
|
/**
|
|
157
156
|
* \@docs-private Implemented as part of VirtualScrollStrategy.
|
|
@@ -161,9 +160,7 @@ FixedSizeVirtualScrollStrategy = /** @class */ (function () {
|
|
|
161
160
|
* \@docs-private Implemented as part of VirtualScrollStrategy.
|
|
162
161
|
* @return {?}
|
|
163
162
|
*/
|
|
164
|
-
function () {
|
|
165
|
-
/* no-op */
|
|
166
|
-
};
|
|
163
|
+
function () { };
|
|
167
164
|
/**
|
|
168
165
|
* Scroll to the offset for the given index.
|
|
169
166
|
* @param index The index of the element to scroll to.
|
|
@@ -186,12 +183,15 @@ FixedSizeVirtualScrollStrategy = /** @class */ (function () {
|
|
|
186
183
|
this._viewport.scrollToOffset(index * this._itemSize, behavior);
|
|
187
184
|
}
|
|
188
185
|
};
|
|
186
|
+
/** Update the viewport's total content size. */
|
|
189
187
|
/**
|
|
190
188
|
* Update the viewport's total content size.
|
|
189
|
+
* @private
|
|
191
190
|
* @return {?}
|
|
192
191
|
*/
|
|
193
192
|
FixedSizeVirtualScrollStrategy.prototype._updateTotalContentSize = /**
|
|
194
193
|
* Update the viewport's total content size.
|
|
194
|
+
* @private
|
|
195
195
|
* @return {?}
|
|
196
196
|
*/
|
|
197
197
|
function () {
|
|
@@ -200,12 +200,15 @@ FixedSizeVirtualScrollStrategy = /** @class */ (function () {
|
|
|
200
200
|
}
|
|
201
201
|
this._viewport.setTotalContentSize(this._viewport.getDataLength() * this._itemSize);
|
|
202
202
|
};
|
|
203
|
+
/** Update the viewport's rendered range. */
|
|
203
204
|
/**
|
|
204
205
|
* Update the viewport's rendered range.
|
|
206
|
+
* @private
|
|
205
207
|
* @return {?}
|
|
206
208
|
*/
|
|
207
209
|
FixedSizeVirtualScrollStrategy.prototype._updateRenderedRange = /**
|
|
208
210
|
* Update the viewport's rendered range.
|
|
211
|
+
* @private
|
|
209
212
|
* @return {?}
|
|
210
213
|
*/
|
|
211
214
|
function () {
|
|
@@ -353,11 +356,12 @@ var CdkFixedSizeVirtualScroll = /** @class */ (function () {
|
|
|
353
356
|
|
|
354
357
|
/**
|
|
355
358
|
* @fileoverview added by tsickle
|
|
356
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
359
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
357
360
|
*/
|
|
358
|
-
/**
|
|
361
|
+
/**
|
|
359
362
|
* Time in ms to throttle the scrolling events by default.
|
|
360
|
-
|
|
363
|
+
* @type {?}
|
|
364
|
+
*/
|
|
361
365
|
var DEFAULT_SCROLL_TIME = 20;
|
|
362
366
|
/**
|
|
363
367
|
* Service contained all registered Scrollable references and emits an event when any one of the
|
|
@@ -471,10 +475,12 @@ var ScrollDispatcher = /** @class */ (function () {
|
|
|
471
475
|
if (!this._platform.isBrowser) {
|
|
472
476
|
return of();
|
|
473
477
|
}
|
|
474
|
-
return Observable
|
|
478
|
+
return new Observable(function (observer) {
|
|
475
479
|
if (!_this._globalSubscription) {
|
|
476
480
|
_this._addGlobalListener();
|
|
477
481
|
}
|
|
482
|
+
// In the case of a 0ms delay, use an observable without auditTime
|
|
483
|
+
// since it does add a perceptible delay in processing overhead.
|
|
478
484
|
/** @type {?} */
|
|
479
485
|
var subscription = auditTimeInMs > 0 ?
|
|
480
486
|
_this._scrolled.pipe(auditTime(auditTimeInMs)).subscribe(observer) :
|
|
@@ -550,14 +556,17 @@ var ScrollDispatcher = /** @class */ (function () {
|
|
|
550
556
|
});
|
|
551
557
|
return scrollingContainers;
|
|
552
558
|
};
|
|
559
|
+
/** Returns true if the element is contained within the provided Scrollable. */
|
|
553
560
|
/**
|
|
554
561
|
* Returns true if the element is contained within the provided Scrollable.
|
|
562
|
+
* @private
|
|
555
563
|
* @param {?} scrollable
|
|
556
564
|
* @param {?} elementRef
|
|
557
565
|
* @return {?}
|
|
558
566
|
*/
|
|
559
567
|
ScrollDispatcher.prototype._scrollableContainsElement = /**
|
|
560
568
|
* Returns true if the element is contained within the provided Scrollable.
|
|
569
|
+
* @private
|
|
561
570
|
* @param {?} scrollable
|
|
562
571
|
* @param {?} elementRef
|
|
563
572
|
* @return {?}
|
|
@@ -573,15 +582,18 @@ var ScrollDispatcher = /** @class */ (function () {
|
|
|
573
582
|
if (element == scrollableElement) {
|
|
574
583
|
return true;
|
|
575
584
|
}
|
|
576
|
-
} while (element = /** @type {?} */ (
|
|
585
|
+
} while (element = (/** @type {?} */ (element)).parentElement);
|
|
577
586
|
return false;
|
|
578
587
|
};
|
|
588
|
+
/** Sets up the global scroll listeners. */
|
|
579
589
|
/**
|
|
580
590
|
* Sets up the global scroll listeners.
|
|
591
|
+
* @private
|
|
581
592
|
* @return {?}
|
|
582
593
|
*/
|
|
583
594
|
ScrollDispatcher.prototype._addGlobalListener = /**
|
|
584
595
|
* Sets up the global scroll listeners.
|
|
596
|
+
* @private
|
|
585
597
|
* @return {?}
|
|
586
598
|
*/
|
|
587
599
|
function () {
|
|
@@ -590,12 +602,15 @@ var ScrollDispatcher = /** @class */ (function () {
|
|
|
590
602
|
return fromEvent(window.document, 'scroll').subscribe(function () { return _this._scrolled.next(); });
|
|
591
603
|
});
|
|
592
604
|
};
|
|
605
|
+
/** Cleans up the global scroll listener. */
|
|
593
606
|
/**
|
|
594
607
|
* Cleans up the global scroll listener.
|
|
608
|
+
* @private
|
|
595
609
|
* @return {?}
|
|
596
610
|
*/
|
|
597
611
|
ScrollDispatcher.prototype._removeGlobalListener = /**
|
|
598
612
|
* Cleans up the global scroll listener.
|
|
613
|
+
* @private
|
|
599
614
|
* @return {?}
|
|
600
615
|
*/
|
|
601
616
|
function () {
|
|
@@ -625,9 +640,10 @@ var ScrollDispatcher = /** @class */ (function () {
|
|
|
625
640
|
function SCROLL_DISPATCHER_PROVIDER_FACTORY(parentDispatcher, ngZone, platform) {
|
|
626
641
|
return parentDispatcher || new ScrollDispatcher(ngZone, platform);
|
|
627
642
|
}
|
|
628
|
-
/**
|
|
643
|
+
/**
|
|
629
644
|
* \@docs-private \@deprecated \@breaking-change 8.0.0
|
|
630
|
-
|
|
645
|
+
* @type {?}
|
|
646
|
+
*/
|
|
631
647
|
var SCROLL_DISPATCHER_PROVIDER = {
|
|
632
648
|
// If there is already a ScrollDispatcher available, use that. Otherwise, provide a new one.
|
|
633
649
|
provide: ScrollDispatcher,
|
|
@@ -637,7 +653,7 @@ var SCROLL_DISPATCHER_PROVIDER = {
|
|
|
637
653
|
|
|
638
654
|
/**
|
|
639
655
|
* @fileoverview added by tsickle
|
|
640
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
656
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
641
657
|
*/
|
|
642
658
|
/**
|
|
643
659
|
* Sends an event when the directive's element is scrolled. Registers itself with the
|
|
@@ -652,7 +668,7 @@ var CdkScrollable = /** @class */ (function () {
|
|
|
652
668
|
this.ngZone = ngZone;
|
|
653
669
|
this.dir = dir;
|
|
654
670
|
this._destroyed = new Subject();
|
|
655
|
-
this._elementScrolled = Observable
|
|
671
|
+
this._elementScrolled = new Observable(function (observer) {
|
|
656
672
|
return _this.ngZone.runOutsideAngular(function () {
|
|
657
673
|
return fromEvent(_this.elementRef.nativeElement, 'scroll').pipe(takeUntil(_this._destroyed))
|
|
658
674
|
.subscribe(observer);
|
|
@@ -739,12 +755,14 @@ var CdkScrollable = /** @class */ (function () {
|
|
|
739
755
|
options.right = options.right == null ? (isRtl ? options.start : options.end) : options.right;
|
|
740
756
|
// Rewrite the bottom offset as a top offset.
|
|
741
757
|
if (options.bottom != null) {
|
|
742
|
-
|
|
758
|
+
((/** @type {?} */ (options))).top =
|
|
759
|
+
el.scrollHeight - el.clientHeight - options.bottom;
|
|
743
760
|
}
|
|
744
761
|
// Rewrite the right offset as a left offset.
|
|
745
762
|
if (isRtl && getRtlScrollAxisType() != RtlScrollAxisType.NORMAL) {
|
|
746
763
|
if (options.left != null) {
|
|
747
|
-
|
|
764
|
+
((/** @type {?} */ (options))).right =
|
|
765
|
+
el.scrollWidth - el.clientWidth - options.left;
|
|
748
766
|
}
|
|
749
767
|
if (getRtlScrollAxisType() == RtlScrollAxisType.INVERTED) {
|
|
750
768
|
options.left = options.right;
|
|
@@ -755,16 +773,19 @@ var CdkScrollable = /** @class */ (function () {
|
|
|
755
773
|
}
|
|
756
774
|
else {
|
|
757
775
|
if (options.right != null) {
|
|
758
|
-
|
|
776
|
+
((/** @type {?} */ (options))).left =
|
|
777
|
+
el.scrollWidth - el.clientWidth - options.right;
|
|
759
778
|
}
|
|
760
779
|
}
|
|
761
780
|
this._applyScrollToOptions(options);
|
|
762
781
|
};
|
|
763
782
|
/**
|
|
783
|
+
* @private
|
|
764
784
|
* @param {?} options
|
|
765
785
|
* @return {?}
|
|
766
786
|
*/
|
|
767
787
|
CdkScrollable.prototype._applyScrollToOptions = /**
|
|
788
|
+
* @private
|
|
768
789
|
* @param {?} options
|
|
769
790
|
* @return {?}
|
|
770
791
|
*/
|
|
@@ -825,6 +846,7 @@ var CdkScrollable = /** @class */ (function () {
|
|
|
825
846
|
if (from == 'bottom') {
|
|
826
847
|
return el.scrollHeight - el.clientHeight - el.scrollTop;
|
|
827
848
|
}
|
|
849
|
+
// Rewrite start & end as left or right offsets.
|
|
828
850
|
/** @type {?} */
|
|
829
851
|
var isRtl = this.dir && this.dir.value == 'rtl';
|
|
830
852
|
if (from == 'start') {
|
|
@@ -881,7 +903,7 @@ var CdkScrollable = /** @class */ (function () {
|
|
|
881
903
|
|
|
882
904
|
/**
|
|
883
905
|
* @fileoverview added by tsickle
|
|
884
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
906
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
885
907
|
*/
|
|
886
908
|
/**
|
|
887
909
|
* Checks if the given ranges are equal.
|
|
@@ -914,10 +936,14 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
914
936
|
* The direction the viewport scrolls.
|
|
915
937
|
*/
|
|
916
938
|
_this.orientation = 'vertical';
|
|
939
|
+
// Note: we don't use the typical EventEmitter here because we need to subscribe to the scroll
|
|
940
|
+
// strategy lazily (i.e. only if the user is actually listening to the events). We do this because
|
|
941
|
+
// depending on how the strategy calculates the scrolled index, it may come at a cost to
|
|
942
|
+
// performance.
|
|
917
943
|
/**
|
|
918
944
|
* Emits when the index of the first element visible in the viewport changes.
|
|
919
945
|
*/
|
|
920
|
-
_this.scrolledIndexChange = Observable
|
|
946
|
+
_this.scrolledIndexChange = new Observable(function (observer) {
|
|
921
947
|
return _this._scrollStrategy.scrolledIndexChange.subscribe(function (index) {
|
|
922
948
|
return Promise.resolve().then(function () { return _this.ngZone.run(function () { return observer.next(index); }); });
|
|
923
949
|
});
|
|
@@ -988,7 +1014,7 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
988
1014
|
_this.elementScrolled()
|
|
989
1015
|
.pipe(
|
|
990
1016
|
// Start off with a fake scroll event so we properly detect our initial position.
|
|
991
|
-
startWith(/** @type {?} */ (
|
|
1017
|
+
startWith((/** @type {?} */ (null))),
|
|
992
1018
|
// Collect multiple events into one until the next animation frame. This way if
|
|
993
1019
|
// there are multiple scroll events in the same frame we only need to recheck
|
|
994
1020
|
// our layout once.
|
|
@@ -1085,11 +1111,20 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1085
1111
|
// setting it to something else, but its error prone and should probably be split into
|
|
1086
1112
|
// `pendingRange` and `renderedRange`, the latter reflecting whats actually in the DOM.
|
|
1087
1113
|
/** Get the current rendered range of items. */
|
|
1114
|
+
// TODO(mmalerba): This is technically out of sync with what's really rendered until a render
|
|
1115
|
+
// cycle happens. I'm being careful to only call it after the render cycle is complete and before
|
|
1116
|
+
// setting it to something else, but its error prone and should probably be split into
|
|
1117
|
+
// `pendingRange` and `renderedRange`, the latter reflecting whats actually in the DOM.
|
|
1088
1118
|
/**
|
|
1089
1119
|
* Get the current rendered range of items.
|
|
1090
1120
|
* @return {?}
|
|
1091
1121
|
*/
|
|
1092
|
-
CdkVirtualScrollViewport.prototype.getRenderedRange =
|
|
1122
|
+
CdkVirtualScrollViewport.prototype.getRenderedRange =
|
|
1123
|
+
// TODO(mmalerba): This is technically out of sync with what's really rendered until a render
|
|
1124
|
+
// cycle happens. I'm being careful to only call it after the render cycle is complete and before
|
|
1125
|
+
// setting it to something else, but its error prone and should probably be split into
|
|
1126
|
+
// `pendingRange` and `renderedRange`, the latter reflecting whats actually in the DOM.
|
|
1127
|
+
/**
|
|
1093
1128
|
* Get the current rendered range of items.
|
|
1094
1129
|
* @return {?}
|
|
1095
1130
|
*/
|
|
@@ -1174,6 +1209,8 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1174
1209
|
function (offset, to) {
|
|
1175
1210
|
var _this = this;
|
|
1176
1211
|
if (to === void 0) { to = 'to-start'; }
|
|
1212
|
+
// For a horizontal viewport in a right-to-left language we need to translate along the x-axis
|
|
1213
|
+
// in the negative direction.
|
|
1177
1214
|
/** @type {?} */
|
|
1178
1215
|
var isRtl = this.dir && this.dir.value == 'rtl';
|
|
1179
1216
|
/** @type {?} */
|
|
@@ -1334,12 +1371,15 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1334
1371
|
this._measureViewportSize();
|
|
1335
1372
|
this._scrollStrategy.onDataLengthChanged();
|
|
1336
1373
|
};
|
|
1374
|
+
/** Measure the viewport size. */
|
|
1337
1375
|
/**
|
|
1338
1376
|
* Measure the viewport size.
|
|
1377
|
+
* @private
|
|
1339
1378
|
* @return {?}
|
|
1340
1379
|
*/
|
|
1341
1380
|
CdkVirtualScrollViewport.prototype._measureViewportSize = /**
|
|
1342
1381
|
* Measure the viewport size.
|
|
1382
|
+
* @private
|
|
1343
1383
|
* @return {?}
|
|
1344
1384
|
*/
|
|
1345
1385
|
function () {
|
|
@@ -1348,13 +1388,16 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1348
1388
|
this._viewportSize = this.orientation === 'horizontal' ?
|
|
1349
1389
|
viewportEl.clientWidth : viewportEl.clientHeight;
|
|
1350
1390
|
};
|
|
1391
|
+
/** Queue up change detection to run. */
|
|
1351
1392
|
/**
|
|
1352
1393
|
* Queue up change detection to run.
|
|
1394
|
+
* @private
|
|
1353
1395
|
* @param {?=} runAfter
|
|
1354
1396
|
* @return {?}
|
|
1355
1397
|
*/
|
|
1356
1398
|
CdkVirtualScrollViewport.prototype._markChangeDetectionNeeded = /**
|
|
1357
1399
|
* Queue up change detection to run.
|
|
1400
|
+
* @private
|
|
1358
1401
|
* @param {?=} runAfter
|
|
1359
1402
|
* @return {?}
|
|
1360
1403
|
*/
|
|
@@ -1372,12 +1415,15 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1372
1415
|
}); });
|
|
1373
1416
|
}
|
|
1374
1417
|
};
|
|
1418
|
+
/** Run change detection. */
|
|
1375
1419
|
/**
|
|
1376
1420
|
* Run change detection.
|
|
1421
|
+
* @private
|
|
1377
1422
|
* @return {?}
|
|
1378
1423
|
*/
|
|
1379
1424
|
CdkVirtualScrollViewport.prototype._doChangeDetection = /**
|
|
1380
1425
|
* Run change detection.
|
|
1426
|
+
* @private
|
|
1381
1427
|
* @return {?}
|
|
1382
1428
|
*/
|
|
1383
1429
|
function () {
|
|
@@ -1407,10 +1453,14 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1407
1453
|
host: {
|
|
1408
1454
|
'class': 'cdk-virtual-scroll-viewport',
|
|
1409
1455
|
'[class.cdk-virtual-scroll-orientation-horizontal]': 'orientation === "horizontal"',
|
|
1410
|
-
'[class.cdk-virtual-scroll-orientation-vertical]': 'orientation
|
|
1456
|
+
'[class.cdk-virtual-scroll-orientation-vertical]': 'orientation !== "horizontal"',
|
|
1411
1457
|
},
|
|
1412
1458
|
encapsulation: ViewEncapsulation.None,
|
|
1413
1459
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1460
|
+
providers: [{
|
|
1461
|
+
provide: CdkScrollable,
|
|
1462
|
+
useExisting: CdkVirtualScrollViewport,
|
|
1463
|
+
}]
|
|
1414
1464
|
},] },
|
|
1415
1465
|
];
|
|
1416
1466
|
/** @nocollapse */
|
|
@@ -1432,7 +1482,7 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1432
1482
|
|
|
1433
1483
|
/**
|
|
1434
1484
|
* @fileoverview added by tsickle
|
|
1435
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1485
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1436
1486
|
*/
|
|
1437
1487
|
/**
|
|
1438
1488
|
* Helper to extract size from a DOM Node.
|
|
@@ -1442,7 +1492,7 @@ var CdkVirtualScrollViewport = /** @class */ (function (_super) {
|
|
|
1442
1492
|
*/
|
|
1443
1493
|
function getSize(orientation, node) {
|
|
1444
1494
|
/** @type {?} */
|
|
1445
|
-
var el = /** @type {?} */ (node);
|
|
1495
|
+
var el = (/** @type {?} */ (node));
|
|
1446
1496
|
if (!el.getBoundingClientRect) {
|
|
1447
1497
|
return 0;
|
|
1448
1498
|
}
|
|
@@ -1456,8 +1506,7 @@ function getSize(orientation, node) {
|
|
|
1456
1506
|
* @template T
|
|
1457
1507
|
*/
|
|
1458
1508
|
var CdkVirtualForOf = /** @class */ (function () {
|
|
1459
|
-
function CdkVirtualForOf(_viewContainerRef, _template, _differs,
|
|
1460
|
-
_viewport, ngZone) {
|
|
1509
|
+
function CdkVirtualForOf(_viewContainerRef, _template, _differs, _viewport, ngZone) {
|
|
1461
1510
|
var _this = this;
|
|
1462
1511
|
this._viewContainerRef = _viewContainerRef;
|
|
1463
1512
|
this._template = _template;
|
|
@@ -1482,7 +1531,7 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1482
1531
|
this.dataStream = this._dataSourceChanges
|
|
1483
1532
|
.pipe(
|
|
1484
1533
|
// Start off with null `DataSource`.
|
|
1485
|
-
startWith(/** @type {?} */ (
|
|
1534
|
+
startWith((/** @type {?} */ (null))),
|
|
1486
1535
|
// Bundle up the previous and current data sources so we can work with both.
|
|
1487
1536
|
pairwise(),
|
|
1488
1537
|
// Use `_changeDataSource` to disconnect from the previous data source and connect to the
|
|
@@ -1615,21 +1664,24 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1615
1664
|
if (range.start < this._renderedRange.start || range.end > this._renderedRange.end) {
|
|
1616
1665
|
throw Error("Error: attempted to measure an item that isn't rendered.");
|
|
1617
1666
|
}
|
|
1667
|
+
// The index into the list of rendered views for the first item in the range.
|
|
1618
1668
|
/** @type {?} */
|
|
1619
1669
|
var renderedStartIndex = range.start - this._renderedRange.start;
|
|
1670
|
+
// The length of the range we're measuring.
|
|
1620
1671
|
/** @type {?} */
|
|
1621
1672
|
var rangeLen = range.end - range.start;
|
|
1673
|
+
// Loop over all root nodes for all items in the range and sum up their size.
|
|
1622
1674
|
/** @type {?} */
|
|
1623
1675
|
var totalSize = 0;
|
|
1624
1676
|
/** @type {?} */
|
|
1625
1677
|
var i = rangeLen;
|
|
1626
1678
|
while (i--) {
|
|
1627
1679
|
/** @type {?} */
|
|
1628
|
-
var view = /** @type {?} */ (this._viewContainerRef.get(i + renderedStartIndex));
|
|
1680
|
+
var view = (/** @type {?} */ (this._viewContainerRef.get(i + renderedStartIndex)));
|
|
1629
1681
|
/** @type {?} */
|
|
1630
1682
|
var j = view ? view.rootNodes.length : 0;
|
|
1631
1683
|
while (j--) {
|
|
1632
|
-
totalSize += getSize(orientation, /** @type {?} */ (
|
|
1684
|
+
totalSize += getSize(orientation, (/** @type {?} */ (view)).rootNodes[j]);
|
|
1633
1685
|
}
|
|
1634
1686
|
}
|
|
1635
1687
|
return totalSize;
|
|
@@ -1642,6 +1694,9 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1642
1694
|
*/
|
|
1643
1695
|
function () {
|
|
1644
1696
|
if (this._differ && this._needsUpdate) {
|
|
1697
|
+
// TODO(mmalerba): We should differentiate needs update due to scrolling and a new portion of
|
|
1698
|
+
// this list being rendered (can use simpler algorithm) vs needs update due to data actually
|
|
1699
|
+
// changing (need to do this diff).
|
|
1645
1700
|
/** @type {?} */
|
|
1646
1701
|
var changes = this._differ.diff(this._renderedItems);
|
|
1647
1702
|
if (!changes) {
|
|
@@ -1670,12 +1725,15 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1670
1725
|
view.destroy();
|
|
1671
1726
|
}
|
|
1672
1727
|
};
|
|
1728
|
+
/** React to scroll state changes in the viewport. */
|
|
1673
1729
|
/**
|
|
1674
1730
|
* React to scroll state changes in the viewport.
|
|
1731
|
+
* @private
|
|
1675
1732
|
* @return {?}
|
|
1676
1733
|
*/
|
|
1677
1734
|
CdkVirtualForOf.prototype._onRenderedDataChange = /**
|
|
1678
1735
|
* React to scroll state changes in the viewport.
|
|
1736
|
+
* @private
|
|
1679
1737
|
* @return {?}
|
|
1680
1738
|
*/
|
|
1681
1739
|
function () {
|
|
@@ -1688,14 +1746,17 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1688
1746
|
}
|
|
1689
1747
|
this._needsUpdate = true;
|
|
1690
1748
|
};
|
|
1749
|
+
/** Swap out one `DataSource` for another. */
|
|
1691
1750
|
/**
|
|
1692
1751
|
* Swap out one `DataSource` for another.
|
|
1752
|
+
* @private
|
|
1693
1753
|
* @param {?} oldDs
|
|
1694
1754
|
* @param {?} newDs
|
|
1695
1755
|
* @return {?}
|
|
1696
1756
|
*/
|
|
1697
1757
|
CdkVirtualForOf.prototype._changeDataSource = /**
|
|
1698
1758
|
* Swap out one `DataSource` for another.
|
|
1759
|
+
* @private
|
|
1699
1760
|
* @param {?} oldDs
|
|
1700
1761
|
* @param {?} newDs
|
|
1701
1762
|
* @return {?}
|
|
@@ -1707,12 +1768,15 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1707
1768
|
this._needsUpdate = true;
|
|
1708
1769
|
return newDs.connect(this);
|
|
1709
1770
|
};
|
|
1771
|
+
/** Update the `CdkVirtualForOfContext` for all views. */
|
|
1710
1772
|
/**
|
|
1711
1773
|
* Update the `CdkVirtualForOfContext` for all views.
|
|
1774
|
+
* @private
|
|
1712
1775
|
* @return {?}
|
|
1713
1776
|
*/
|
|
1714
1777
|
CdkVirtualForOf.prototype._updateContext = /**
|
|
1715
1778
|
* Update the `CdkVirtualForOfContext` for all views.
|
|
1779
|
+
* @private
|
|
1716
1780
|
* @return {?}
|
|
1717
1781
|
*/
|
|
1718
1782
|
function () {
|
|
@@ -1722,20 +1786,23 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1722
1786
|
var i = this._viewContainerRef.length;
|
|
1723
1787
|
while (i--) {
|
|
1724
1788
|
/** @type {?} */
|
|
1725
|
-
var view = /** @type {?} */ (this._viewContainerRef.get(i));
|
|
1789
|
+
var view = (/** @type {?} */ (this._viewContainerRef.get(i)));
|
|
1726
1790
|
view.context.index = this._renderedRange.start + i;
|
|
1727
1791
|
view.context.count = count;
|
|
1728
1792
|
this._updateComputedContextProperties(view.context);
|
|
1729
1793
|
view.detectChanges();
|
|
1730
1794
|
}
|
|
1731
1795
|
};
|
|
1796
|
+
/** Apply changes to the DOM. */
|
|
1732
1797
|
/**
|
|
1733
1798
|
* Apply changes to the DOM.
|
|
1799
|
+
* @private
|
|
1734
1800
|
* @param {?} changes
|
|
1735
1801
|
* @return {?}
|
|
1736
1802
|
*/
|
|
1737
1803
|
CdkVirtualForOf.prototype._applyChanges = /**
|
|
1738
1804
|
* Apply changes to the DOM.
|
|
1805
|
+
* @private
|
|
1739
1806
|
* @param {?} changes
|
|
1740
1807
|
* @return {?}
|
|
1741
1808
|
*/
|
|
@@ -1744,18 +1811,19 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1744
1811
|
// Rearrange the views to put them in the right location.
|
|
1745
1812
|
changes.forEachOperation(function (record, adjustedPreviousIndex, currentIndex) {
|
|
1746
1813
|
if (record.previousIndex == null) { // Item added.
|
|
1814
|
+
// Item added.
|
|
1747
1815
|
/** @type {?} */
|
|
1748
1816
|
var view = _this._getViewForNewItem();
|
|
1749
|
-
_this._viewContainerRef.insert(view, /** @type {?} */ (
|
|
1817
|
+
_this._viewContainerRef.insert(view, (/** @type {?} */ (currentIndex)));
|
|
1750
1818
|
view.context.$implicit = record.item;
|
|
1751
1819
|
}
|
|
1752
1820
|
else if (currentIndex == null) { // Item removed.
|
|
1753
|
-
|
|
1754
|
-
_this._cacheView(/** @type {?} */ (_this._viewContainerRef.detach(/** @type {?} */ ((adjustedPreviousIndex)))));
|
|
1821
|
+
_this._cacheView((/** @type {?} */ (_this._viewContainerRef.detach((/** @type {?} */ (adjustedPreviousIndex))))));
|
|
1755
1822
|
}
|
|
1756
1823
|
else { // Item moved.
|
|
1824
|
+
// Item moved.
|
|
1757
1825
|
/** @type {?} */
|
|
1758
|
-
var view = /** @type {?} */ (_this._viewContainerRef.get(/** @type {?} */ (
|
|
1826
|
+
var view = (/** @type {?} */ (_this._viewContainerRef.get((/** @type {?} */ (adjustedPreviousIndex)))));
|
|
1759
1827
|
_this._viewContainerRef.move(view, currentIndex);
|
|
1760
1828
|
view.context.$implicit = record.item;
|
|
1761
1829
|
}
|
|
@@ -1763,28 +1831,32 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1763
1831
|
// Update $implicit for any items that had an identity change.
|
|
1764
1832
|
changes.forEachIdentityChange(function (record) {
|
|
1765
1833
|
/** @type {?} */
|
|
1766
|
-
var view = /** @type {?} */ (_this._viewContainerRef.get(/** @type {?} */ (
|
|
1834
|
+
var view = (/** @type {?} */ (_this._viewContainerRef.get((/** @type {?} */ (record.currentIndex)))));
|
|
1767
1835
|
view.context.$implicit = record.item;
|
|
1768
1836
|
});
|
|
1837
|
+
// Update the context variables on all items.
|
|
1769
1838
|
/** @type {?} */
|
|
1770
1839
|
var count = this._data.length;
|
|
1771
1840
|
/** @type {?} */
|
|
1772
1841
|
var i = this._viewContainerRef.length;
|
|
1773
1842
|
while (i--) {
|
|
1774
1843
|
/** @type {?} */
|
|
1775
|
-
var view = /** @type {?} */ (this._viewContainerRef.get(i));
|
|
1844
|
+
var view = (/** @type {?} */ (this._viewContainerRef.get(i)));
|
|
1776
1845
|
view.context.index = this._renderedRange.start + i;
|
|
1777
1846
|
view.context.count = count;
|
|
1778
1847
|
this._updateComputedContextProperties(view.context);
|
|
1779
1848
|
}
|
|
1780
1849
|
};
|
|
1850
|
+
/** Cache the given detached view. */
|
|
1781
1851
|
/**
|
|
1782
1852
|
* Cache the given detached view.
|
|
1853
|
+
* @private
|
|
1783
1854
|
* @param {?} view
|
|
1784
1855
|
* @return {?}
|
|
1785
1856
|
*/
|
|
1786
1857
|
CdkVirtualForOf.prototype._cacheView = /**
|
|
1787
1858
|
* Cache the given detached view.
|
|
1859
|
+
* @private
|
|
1788
1860
|
* @param {?} view
|
|
1789
1861
|
* @return {?}
|
|
1790
1862
|
*/
|
|
@@ -1806,17 +1878,20 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1806
1878
|
}
|
|
1807
1879
|
}
|
|
1808
1880
|
};
|
|
1881
|
+
/** Get a view for a new item, either from the cache or by creating a new one. */
|
|
1809
1882
|
/**
|
|
1810
1883
|
* Get a view for a new item, either from the cache or by creating a new one.
|
|
1884
|
+
* @private
|
|
1811
1885
|
* @return {?}
|
|
1812
1886
|
*/
|
|
1813
1887
|
CdkVirtualForOf.prototype._getViewForNewItem = /**
|
|
1814
1888
|
* Get a view for a new item, either from the cache or by creating a new one.
|
|
1889
|
+
* @private
|
|
1815
1890
|
* @return {?}
|
|
1816
1891
|
*/
|
|
1817
1892
|
function () {
|
|
1818
1893
|
return this._templateCache.pop() || this._viewContainerRef.createEmbeddedView(this._template, {
|
|
1819
|
-
$implicit: /** @type {?} */ (
|
|
1894
|
+
$implicit: (/** @type {?} */ (null)),
|
|
1820
1895
|
cdkVirtualForOf: this._cdkVirtualForOf,
|
|
1821
1896
|
index: -1,
|
|
1822
1897
|
count: -1,
|
|
@@ -1826,13 +1901,16 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1826
1901
|
even: false
|
|
1827
1902
|
});
|
|
1828
1903
|
};
|
|
1904
|
+
/** Update the computed properties on the `CdkVirtualForOfContext`. */
|
|
1829
1905
|
/**
|
|
1830
1906
|
* Update the computed properties on the `CdkVirtualForOfContext`.
|
|
1907
|
+
* @private
|
|
1831
1908
|
* @param {?} context
|
|
1832
1909
|
* @return {?}
|
|
1833
1910
|
*/
|
|
1834
1911
|
CdkVirtualForOf.prototype._updateComputedContextProperties = /**
|
|
1835
1912
|
* Update the computed properties on the `CdkVirtualForOfContext`.
|
|
1913
|
+
* @private
|
|
1836
1914
|
* @param {?} context
|
|
1837
1915
|
* @return {?}
|
|
1838
1916
|
*/
|
|
@@ -1866,7 +1944,7 @@ var CdkVirtualForOf = /** @class */ (function () {
|
|
|
1866
1944
|
|
|
1867
1945
|
/**
|
|
1868
1946
|
* @fileoverview added by tsickle
|
|
1869
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1947
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1870
1948
|
*/
|
|
1871
1949
|
var ScrollingModule = /** @class */ (function () {
|
|
1872
1950
|
function ScrollingModule() {
|
|
@@ -1909,11 +1987,12 @@ var ScrollDispatchModule = /** @class */ (function () {
|
|
|
1909
1987
|
|
|
1910
1988
|
/**
|
|
1911
1989
|
* @fileoverview added by tsickle
|
|
1912
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1990
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1913
1991
|
*/
|
|
1914
|
-
/**
|
|
1992
|
+
/**
|
|
1915
1993
|
* Time in ms to throttle the resize events by default.
|
|
1916
|
-
|
|
1994
|
+
* @type {?}
|
|
1995
|
+
*/
|
|
1917
1996
|
var DEFAULT_RESIZE_TIME = 20;
|
|
1918
1997
|
/**
|
|
1919
1998
|
* Simple utility for getting the bounds of the browser viewport.
|
|
@@ -1958,7 +2037,7 @@ var ViewportRuler = /** @class */ (function () {
|
|
|
1958
2037
|
var output = { width: this._viewportSize.width, height: this._viewportSize.height };
|
|
1959
2038
|
// If we're not on a browser, don't cache the size since it'll be mocked out anyway.
|
|
1960
2039
|
if (!this._platform.isBrowser) {
|
|
1961
|
-
this._viewportSize = /** @type {?} */ (
|
|
2040
|
+
this._viewportSize = (/** @type {?} */ (null));
|
|
1962
2041
|
}
|
|
1963
2042
|
return output;
|
|
1964
2043
|
};
|
|
@@ -1972,6 +2051,15 @@ var ViewportRuler = /** @class */ (function () {
|
|
|
1972
2051
|
* @return {?}
|
|
1973
2052
|
*/
|
|
1974
2053
|
function () {
|
|
2054
|
+
// Use the document element's bounding rect rather than the window scroll properties
|
|
2055
|
+
// (e.g. pageYOffset, scrollY) due to in issue in Chrome and IE where window scroll
|
|
2056
|
+
// properties and client coordinates (boundingClientRect, clientX/Y, etc.) are in different
|
|
2057
|
+
// conceptual viewports. Under most circumstances these viewports are equivalent, but they
|
|
2058
|
+
// can disagree when the page is pinch-zoomed (on devices that support touch).
|
|
2059
|
+
// See https://bugs.chromium.org/p/chromium/issues/detail?id=489206#c4
|
|
2060
|
+
// We use the documentElement instead of the body because, by default (without a css reset)
|
|
2061
|
+
// browsers typically give the document body an 8px margin, which is not included in
|
|
2062
|
+
// getBoundingClientRect().
|
|
1975
2063
|
/** @type {?} */
|
|
1976
2064
|
var scrollPosition = this.getViewportScrollPosition();
|
|
1977
2065
|
var _a = this.getViewportSize(), width = _a.width, height = _a.height;
|
|
@@ -1999,8 +2087,14 @@ var ViewportRuler = /** @class */ (function () {
|
|
|
1999
2087
|
if (!this._platform.isBrowser) {
|
|
2000
2088
|
return { top: 0, left: 0 };
|
|
2001
2089
|
}
|
|
2090
|
+
// The top-left-corner of the viewport is determined by the scroll position of the document
|
|
2091
|
+
// body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about
|
|
2092
|
+
// whether `document.body` or `document.documentElement` is the scrolled element, so reading
|
|
2093
|
+
// `scrollTop` and `scrollLeft` is inconsistent. However, using the bounding rect of
|
|
2094
|
+
// `document.documentElement` works consistently, where the `top` and `left` values will
|
|
2095
|
+
// equal negative the scroll position.
|
|
2002
2096
|
/** @type {?} */
|
|
2003
|
-
var documentElement = /** @type {?} */ (
|
|
2097
|
+
var documentElement = (/** @type {?} */ (document.documentElement));
|
|
2004
2098
|
/** @type {?} */
|
|
2005
2099
|
var documentRect = documentElement.getBoundingClientRect();
|
|
2006
2100
|
/** @type {?} */
|
|
@@ -2029,12 +2123,15 @@ var ViewportRuler = /** @class */ (function () {
|
|
|
2029
2123
|
if (throttleTime === void 0) { throttleTime = DEFAULT_RESIZE_TIME; }
|
|
2030
2124
|
return throttleTime > 0 ? this._change.pipe(auditTime(throttleTime)) : this._change;
|
|
2031
2125
|
};
|
|
2126
|
+
/** Updates the cached viewport size. */
|
|
2032
2127
|
/**
|
|
2033
2128
|
* Updates the cached viewport size.
|
|
2129
|
+
* @private
|
|
2034
2130
|
* @return {?}
|
|
2035
2131
|
*/
|
|
2036
2132
|
ViewportRuler.prototype._updateViewportSize = /**
|
|
2037
2133
|
* Updates the cached viewport size.
|
|
2134
|
+
* @private
|
|
2038
2135
|
* @return {?}
|
|
2039
2136
|
*/
|
|
2040
2137
|
function () {
|
|
@@ -2063,9 +2160,10 @@ var ViewportRuler = /** @class */ (function () {
|
|
|
2063
2160
|
function VIEWPORT_RULER_PROVIDER_FACTORY(parentRuler, platform, ngZone) {
|
|
2064
2161
|
return parentRuler || new ViewportRuler(platform, ngZone);
|
|
2065
2162
|
}
|
|
2066
|
-
/**
|
|
2163
|
+
/**
|
|
2067
2164
|
* \@docs-private \@deprecated \@breaking-change 8.0.0
|
|
2068
|
-
|
|
2165
|
+
* @type {?}
|
|
2166
|
+
*/
|
|
2069
2167
|
var VIEWPORT_RULER_PROVIDER = {
|
|
2070
2168
|
// If there is already a ViewportRuler available, use that. Otherwise, provide a new one.
|
|
2071
2169
|
provide: ViewportRuler,
|
|
@@ -2075,12 +2173,12 @@ var VIEWPORT_RULER_PROVIDER = {
|
|
|
2075
2173
|
|
|
2076
2174
|
/**
|
|
2077
2175
|
* @fileoverview added by tsickle
|
|
2078
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
2176
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2079
2177
|
*/
|
|
2080
2178
|
|
|
2081
2179
|
/**
|
|
2082
2180
|
* @fileoverview added by tsickle
|
|
2083
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
2181
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2084
2182
|
*/
|
|
2085
2183
|
|
|
2086
2184
|
export { _fixedSizeVirtualScrollStrategyFactory, FixedSizeVirtualScrollStrategy, CdkFixedSizeVirtualScroll, SCROLL_DISPATCHER_PROVIDER_FACTORY, DEFAULT_SCROLL_TIME, ScrollDispatcher, SCROLL_DISPATCHER_PROVIDER, CdkScrollable, ScrollingModule, ScrollDispatchModule, VIEWPORT_RULER_PROVIDER_FACTORY, DEFAULT_RESIZE_TIME, ViewportRuler, VIEWPORT_RULER_PROVIDER, CdkVirtualForOf, VIRTUAL_SCROLL_STRATEGY, CdkVirtualScrollViewport };
|