@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/esm2015/scrolling.js
CHANGED
|
@@ -15,16 +15,17 @@ import { ArrayDataSource, DataSource } from '@angular/cdk/collections';
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @fileoverview added by tsickle
|
|
18
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
18
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
19
19
|
*/
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
21
|
* The injection token used to specify the virtual scrolling strategy.
|
|
22
|
-
|
|
22
|
+
* @type {?}
|
|
23
|
+
*/
|
|
23
24
|
const VIRTUAL_SCROLL_STRATEGY = new InjectionToken('VIRTUAL_SCROLL_STRATEGY');
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* @fileoverview added by tsickle
|
|
27
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
28
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
28
29
|
*/
|
|
29
30
|
/**
|
|
30
31
|
* Virtual scrolling strategy for lists with items of known fixed size.
|
|
@@ -103,16 +104,12 @@ class FixedSizeVirtualScrollStrategy {
|
|
|
103
104
|
* \@docs-private Implemented as part of VirtualScrollStrategy.
|
|
104
105
|
* @return {?}
|
|
105
106
|
*/
|
|
106
|
-
onContentRendered() {
|
|
107
|
-
/* no-op */
|
|
108
|
-
}
|
|
107
|
+
onContentRendered() { }
|
|
109
108
|
/**
|
|
110
109
|
* \@docs-private Implemented as part of VirtualScrollStrategy.
|
|
111
110
|
* @return {?}
|
|
112
111
|
*/
|
|
113
|
-
onRenderedOffsetChanged() {
|
|
114
|
-
/* no-op */
|
|
115
|
-
}
|
|
112
|
+
onRenderedOffsetChanged() { }
|
|
116
113
|
/**
|
|
117
114
|
* Scroll to the offset for the given index.
|
|
118
115
|
* @param {?} index The index of the element to scroll to.
|
|
@@ -126,6 +123,7 @@ class FixedSizeVirtualScrollStrategy {
|
|
|
126
123
|
}
|
|
127
124
|
/**
|
|
128
125
|
* Update the viewport's total content size.
|
|
126
|
+
* @private
|
|
129
127
|
* @return {?}
|
|
130
128
|
*/
|
|
131
129
|
_updateTotalContentSize() {
|
|
@@ -136,6 +134,7 @@ class FixedSizeVirtualScrollStrategy {
|
|
|
136
134
|
}
|
|
137
135
|
/**
|
|
138
136
|
* Update the viewport's rendered range.
|
|
137
|
+
* @private
|
|
139
138
|
* @return {?}
|
|
140
139
|
*/
|
|
141
140
|
_updateRenderedRange() {
|
|
@@ -258,11 +257,12 @@ CdkFixedSizeVirtualScroll.propDecorators = {
|
|
|
258
257
|
|
|
259
258
|
/**
|
|
260
259
|
* @fileoverview added by tsickle
|
|
261
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
260
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
262
261
|
*/
|
|
263
|
-
/**
|
|
262
|
+
/**
|
|
264
263
|
* Time in ms to throttle the scrolling events by default.
|
|
265
|
-
|
|
264
|
+
* @type {?}
|
|
265
|
+
*/
|
|
266
266
|
const DEFAULT_SCROLL_TIME = 20;
|
|
267
267
|
/**
|
|
268
268
|
* Service contained all registered Scrollable references and emits an event when any one of the
|
|
@@ -335,10 +335,12 @@ class ScrollDispatcher {
|
|
|
335
335
|
if (!this._platform.isBrowser) {
|
|
336
336
|
return of();
|
|
337
337
|
}
|
|
338
|
-
return Observable
|
|
338
|
+
return new Observable((observer) => {
|
|
339
339
|
if (!this._globalSubscription) {
|
|
340
340
|
this._addGlobalListener();
|
|
341
341
|
}
|
|
342
|
+
// In the case of a 0ms delay, use an observable without auditTime
|
|
343
|
+
// since it does add a perceptible delay in processing overhead.
|
|
342
344
|
/** @type {?} */
|
|
343
345
|
const subscription = auditTimeInMs > 0 ?
|
|
344
346
|
this._scrolled.pipe(auditTime(auditTimeInMs)).subscribe(observer) :
|
|
@@ -392,6 +394,7 @@ class ScrollDispatcher {
|
|
|
392
394
|
}
|
|
393
395
|
/**
|
|
394
396
|
* Returns true if the element is contained within the provided Scrollable.
|
|
397
|
+
* @private
|
|
395
398
|
* @param {?} scrollable
|
|
396
399
|
* @param {?} elementRef
|
|
397
400
|
* @return {?}
|
|
@@ -407,11 +410,12 @@ class ScrollDispatcher {
|
|
|
407
410
|
if (element == scrollableElement) {
|
|
408
411
|
return true;
|
|
409
412
|
}
|
|
410
|
-
} while (element = /** @type {?} */ (
|
|
413
|
+
} while (element = (/** @type {?} */ (element)).parentElement);
|
|
411
414
|
return false;
|
|
412
415
|
}
|
|
413
416
|
/**
|
|
414
417
|
* Sets up the global scroll listeners.
|
|
418
|
+
* @private
|
|
415
419
|
* @return {?}
|
|
416
420
|
*/
|
|
417
421
|
_addGlobalListener() {
|
|
@@ -421,6 +425,7 @@ class ScrollDispatcher {
|
|
|
421
425
|
}
|
|
422
426
|
/**
|
|
423
427
|
* Cleans up the global scroll listener.
|
|
428
|
+
* @private
|
|
424
429
|
* @return {?}
|
|
425
430
|
*/
|
|
426
431
|
_removeGlobalListener() {
|
|
@@ -449,9 +454,10 @@ ScrollDispatcher.ctorParameters = () => [
|
|
|
449
454
|
function SCROLL_DISPATCHER_PROVIDER_FACTORY(parentDispatcher, ngZone, platform) {
|
|
450
455
|
return parentDispatcher || new ScrollDispatcher(ngZone, platform);
|
|
451
456
|
}
|
|
452
|
-
/**
|
|
457
|
+
/**
|
|
453
458
|
* \@docs-private \@deprecated \@breaking-change 8.0.0
|
|
454
|
-
|
|
459
|
+
* @type {?}
|
|
460
|
+
*/
|
|
455
461
|
const SCROLL_DISPATCHER_PROVIDER = {
|
|
456
462
|
// If there is already a ScrollDispatcher available, use that. Otherwise, provide a new one.
|
|
457
463
|
provide: ScrollDispatcher,
|
|
@@ -461,7 +467,7 @@ const SCROLL_DISPATCHER_PROVIDER = {
|
|
|
461
467
|
|
|
462
468
|
/**
|
|
463
469
|
* @fileoverview added by tsickle
|
|
464
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
470
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
465
471
|
*/
|
|
466
472
|
/**
|
|
467
473
|
* Sends an event when the directive's element is scrolled. Registers itself with the
|
|
@@ -481,7 +487,7 @@ class CdkScrollable {
|
|
|
481
487
|
this.ngZone = ngZone;
|
|
482
488
|
this.dir = dir;
|
|
483
489
|
this._destroyed = new Subject();
|
|
484
|
-
this._elementScrolled = Observable
|
|
490
|
+
this._elementScrolled = new Observable((observer) => this.ngZone.runOutsideAngular(() => fromEvent(this.elementRef.nativeElement, 'scroll').pipe(takeUntil(this._destroyed))
|
|
485
491
|
.subscribe(observer)));
|
|
486
492
|
}
|
|
487
493
|
/**
|
|
@@ -531,12 +537,14 @@ class CdkScrollable {
|
|
|
531
537
|
options.right = options.right == null ? (isRtl ? options.start : options.end) : options.right;
|
|
532
538
|
// Rewrite the bottom offset as a top offset.
|
|
533
539
|
if (options.bottom != null) {
|
|
534
|
-
|
|
540
|
+
((/** @type {?} */ (options))).top =
|
|
541
|
+
el.scrollHeight - el.clientHeight - options.bottom;
|
|
535
542
|
}
|
|
536
543
|
// Rewrite the right offset as a left offset.
|
|
537
544
|
if (isRtl && getRtlScrollAxisType() != RtlScrollAxisType.NORMAL) {
|
|
538
545
|
if (options.left != null) {
|
|
539
|
-
|
|
546
|
+
((/** @type {?} */ (options))).right =
|
|
547
|
+
el.scrollWidth - el.clientWidth - options.left;
|
|
540
548
|
}
|
|
541
549
|
if (getRtlScrollAxisType() == RtlScrollAxisType.INVERTED) {
|
|
542
550
|
options.left = options.right;
|
|
@@ -547,12 +555,14 @@ class CdkScrollable {
|
|
|
547
555
|
}
|
|
548
556
|
else {
|
|
549
557
|
if (options.right != null) {
|
|
550
|
-
|
|
558
|
+
((/** @type {?} */ (options))).left =
|
|
559
|
+
el.scrollWidth - el.clientWidth - options.right;
|
|
551
560
|
}
|
|
552
561
|
}
|
|
553
562
|
this._applyScrollToOptions(options);
|
|
554
563
|
}
|
|
555
564
|
/**
|
|
565
|
+
* @private
|
|
556
566
|
* @param {?} options
|
|
557
567
|
* @return {?}
|
|
558
568
|
*/
|
|
@@ -594,6 +604,7 @@ class CdkScrollable {
|
|
|
594
604
|
if (from == 'bottom') {
|
|
595
605
|
return el.scrollHeight - el.clientHeight - el.scrollTop;
|
|
596
606
|
}
|
|
607
|
+
// Rewrite start & end as left or right offsets.
|
|
597
608
|
/** @type {?} */
|
|
598
609
|
const isRtl = this.dir && this.dir.value == 'rtl';
|
|
599
610
|
if (from == 'start') {
|
|
@@ -649,7 +660,7 @@ CdkScrollable.ctorParameters = () => [
|
|
|
649
660
|
|
|
650
661
|
/**
|
|
651
662
|
* @fileoverview added by tsickle
|
|
652
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
663
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
653
664
|
*/
|
|
654
665
|
/**
|
|
655
666
|
* Checks if the given ranges are equal.
|
|
@@ -689,10 +700,14 @@ class CdkVirtualScrollViewport extends CdkScrollable {
|
|
|
689
700
|
* The direction the viewport scrolls.
|
|
690
701
|
*/
|
|
691
702
|
this.orientation = 'vertical';
|
|
703
|
+
// Note: we don't use the typical EventEmitter here because we need to subscribe to the scroll
|
|
704
|
+
// strategy lazily (i.e. only if the user is actually listening to the events). We do this because
|
|
705
|
+
// depending on how the strategy calculates the scrolled index, it may come at a cost to
|
|
706
|
+
// performance.
|
|
692
707
|
/**
|
|
693
708
|
* Emits when the index of the first element visible in the viewport changes.
|
|
694
709
|
*/
|
|
695
|
-
this.scrolledIndexChange = Observable
|
|
710
|
+
this.scrolledIndexChange = new Observable((observer) => this._scrollStrategy.scrolledIndexChange.subscribe(index => Promise.resolve().then(() => this.ngZone.run(() => observer.next(index)))));
|
|
696
711
|
/**
|
|
697
712
|
* A stream that emits whenever the rendered range changes.
|
|
698
713
|
*/
|
|
@@ -754,7 +769,7 @@ class CdkVirtualScrollViewport extends CdkScrollable {
|
|
|
754
769
|
this.elementScrolled()
|
|
755
770
|
.pipe(
|
|
756
771
|
// Start off with a fake scroll event so we properly detect our initial position.
|
|
757
|
-
startWith(/** @type {?} */ (
|
|
772
|
+
startWith((/** @type {?} */ (null))),
|
|
758
773
|
// Collect multiple events into one until the next animation frame. This way if
|
|
759
774
|
// there are multiple scroll events in the same frame we only need to recheck
|
|
760
775
|
// our layout once.
|
|
@@ -821,6 +836,10 @@ class CdkVirtualScrollViewport extends CdkScrollable {
|
|
|
821
836
|
getViewportSize() {
|
|
822
837
|
return this._viewportSize;
|
|
823
838
|
}
|
|
839
|
+
// TODO(mmalerba): This is technically out of sync with what's really rendered until a render
|
|
840
|
+
// cycle happens. I'm being careful to only call it after the render cycle is complete and before
|
|
841
|
+
// setting it to something else, but its error prone and should probably be split into
|
|
842
|
+
// `pendingRange` and `renderedRange`, the latter reflecting whats actually in the DOM.
|
|
824
843
|
/**
|
|
825
844
|
* Get the current rendered range of items.
|
|
826
845
|
* @return {?}
|
|
@@ -869,6 +888,8 @@ class CdkVirtualScrollViewport extends CdkScrollable {
|
|
|
869
888
|
* @return {?}
|
|
870
889
|
*/
|
|
871
890
|
setRenderedContentOffset(offset, to = 'to-start') {
|
|
891
|
+
// For a horizontal viewport in a right-to-left language we need to translate along the x-axis
|
|
892
|
+
// in the negative direction.
|
|
872
893
|
/** @type {?} */
|
|
873
894
|
const isRtl = this.dir && this.dir.value == 'rtl';
|
|
874
895
|
/** @type {?} */
|
|
@@ -972,6 +993,7 @@ class CdkVirtualScrollViewport extends CdkScrollable {
|
|
|
972
993
|
}
|
|
973
994
|
/**
|
|
974
995
|
* Measure the viewport size.
|
|
996
|
+
* @private
|
|
975
997
|
* @return {?}
|
|
976
998
|
*/
|
|
977
999
|
_measureViewportSize() {
|
|
@@ -982,6 +1004,7 @@ class CdkVirtualScrollViewport extends CdkScrollable {
|
|
|
982
1004
|
}
|
|
983
1005
|
/**
|
|
984
1006
|
* Queue up change detection to run.
|
|
1007
|
+
* @private
|
|
985
1008
|
* @param {?=} runAfter
|
|
986
1009
|
* @return {?}
|
|
987
1010
|
*/
|
|
@@ -1000,6 +1023,7 @@ class CdkVirtualScrollViewport extends CdkScrollable {
|
|
|
1000
1023
|
}
|
|
1001
1024
|
/**
|
|
1002
1025
|
* Run change detection.
|
|
1026
|
+
* @private
|
|
1003
1027
|
* @return {?}
|
|
1004
1028
|
*/
|
|
1005
1029
|
_doChangeDetection() {
|
|
@@ -1028,10 +1052,14 @@ CdkVirtualScrollViewport.decorators = [
|
|
|
1028
1052
|
host: {
|
|
1029
1053
|
'class': 'cdk-virtual-scroll-viewport',
|
|
1030
1054
|
'[class.cdk-virtual-scroll-orientation-horizontal]': 'orientation === "horizontal"',
|
|
1031
|
-
'[class.cdk-virtual-scroll-orientation-vertical]': 'orientation
|
|
1055
|
+
'[class.cdk-virtual-scroll-orientation-vertical]': 'orientation !== "horizontal"',
|
|
1032
1056
|
},
|
|
1033
1057
|
encapsulation: ViewEncapsulation.None,
|
|
1034
1058
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1059
|
+
providers: [{
|
|
1060
|
+
provide: CdkScrollable,
|
|
1061
|
+
useExisting: CdkVirtualScrollViewport,
|
|
1062
|
+
}]
|
|
1035
1063
|
},] },
|
|
1036
1064
|
];
|
|
1037
1065
|
/** @nocollapse */
|
|
@@ -1051,7 +1079,7 @@ CdkVirtualScrollViewport.propDecorators = {
|
|
|
1051
1079
|
|
|
1052
1080
|
/**
|
|
1053
1081
|
* @fileoverview added by tsickle
|
|
1054
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1082
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1055
1083
|
*/
|
|
1056
1084
|
/**
|
|
1057
1085
|
* Helper to extract size from a DOM Node.
|
|
@@ -1061,7 +1089,7 @@ CdkVirtualScrollViewport.propDecorators = {
|
|
|
1061
1089
|
*/
|
|
1062
1090
|
function getSize(orientation, node) {
|
|
1063
1091
|
/** @type {?} */
|
|
1064
|
-
const el = /** @type {?} */ (node);
|
|
1092
|
+
const el = (/** @type {?} */ (node));
|
|
1065
1093
|
if (!el.getBoundingClientRect) {
|
|
1066
1094
|
return 0;
|
|
1067
1095
|
}
|
|
@@ -1082,8 +1110,7 @@ class CdkVirtualForOf {
|
|
|
1082
1110
|
* @param {?} _viewport
|
|
1083
1111
|
* @param {?} ngZone
|
|
1084
1112
|
*/
|
|
1085
|
-
constructor(_viewContainerRef, _template, _differs,
|
|
1086
|
-
_viewport, ngZone) {
|
|
1113
|
+
constructor(_viewContainerRef, _template, _differs, _viewport, ngZone) {
|
|
1087
1114
|
this._viewContainerRef = _viewContainerRef;
|
|
1088
1115
|
this._template = _template;
|
|
1089
1116
|
this._differs = _differs;
|
|
@@ -1107,7 +1134,7 @@ class CdkVirtualForOf {
|
|
|
1107
1134
|
this.dataStream = this._dataSourceChanges
|
|
1108
1135
|
.pipe(
|
|
1109
1136
|
// Start off with null `DataSource`.
|
|
1110
|
-
startWith(/** @type {?} */ (
|
|
1137
|
+
startWith((/** @type {?} */ (null))),
|
|
1111
1138
|
// Bundle up the previous and current data sources so we can work with both.
|
|
1112
1139
|
pairwise(),
|
|
1113
1140
|
// Use `_changeDataSource` to disconnect from the previous data source and connect to the
|
|
@@ -1205,21 +1232,24 @@ class CdkVirtualForOf {
|
|
|
1205
1232
|
if (range.start < this._renderedRange.start || range.end > this._renderedRange.end) {
|
|
1206
1233
|
throw Error(`Error: attempted to measure an item that isn't rendered.`);
|
|
1207
1234
|
}
|
|
1235
|
+
// The index into the list of rendered views for the first item in the range.
|
|
1208
1236
|
/** @type {?} */
|
|
1209
1237
|
const renderedStartIndex = range.start - this._renderedRange.start;
|
|
1238
|
+
// The length of the range we're measuring.
|
|
1210
1239
|
/** @type {?} */
|
|
1211
1240
|
const rangeLen = range.end - range.start;
|
|
1241
|
+
// Loop over all root nodes for all items in the range and sum up their size.
|
|
1212
1242
|
/** @type {?} */
|
|
1213
1243
|
let totalSize = 0;
|
|
1214
1244
|
/** @type {?} */
|
|
1215
1245
|
let i = rangeLen;
|
|
1216
1246
|
while (i--) {
|
|
1217
1247
|
/** @type {?} */
|
|
1218
|
-
const view = /** @type {?} */ (this._viewContainerRef.get(i + renderedStartIndex));
|
|
1248
|
+
const view = (/** @type {?} */ (this._viewContainerRef.get(i + renderedStartIndex)));
|
|
1219
1249
|
/** @type {?} */
|
|
1220
1250
|
let j = view ? view.rootNodes.length : 0;
|
|
1221
1251
|
while (j--) {
|
|
1222
|
-
totalSize += getSize(orientation, /** @type {?} */ (
|
|
1252
|
+
totalSize += getSize(orientation, (/** @type {?} */ (view)).rootNodes[j]);
|
|
1223
1253
|
}
|
|
1224
1254
|
}
|
|
1225
1255
|
return totalSize;
|
|
@@ -1229,6 +1259,9 @@ class CdkVirtualForOf {
|
|
|
1229
1259
|
*/
|
|
1230
1260
|
ngDoCheck() {
|
|
1231
1261
|
if (this._differ && this._needsUpdate) {
|
|
1262
|
+
// TODO(mmalerba): We should differentiate needs update due to scrolling and a new portion of
|
|
1263
|
+
// this list being rendered (can use simpler algorithm) vs needs update due to data actually
|
|
1264
|
+
// changing (need to do this diff).
|
|
1232
1265
|
/** @type {?} */
|
|
1233
1266
|
const changes = this._differ.diff(this._renderedItems);
|
|
1234
1267
|
if (!changes) {
|
|
@@ -1255,6 +1288,7 @@ class CdkVirtualForOf {
|
|
|
1255
1288
|
}
|
|
1256
1289
|
/**
|
|
1257
1290
|
* React to scroll state changes in the viewport.
|
|
1291
|
+
* @private
|
|
1258
1292
|
* @return {?}
|
|
1259
1293
|
*/
|
|
1260
1294
|
_onRenderedDataChange() {
|
|
@@ -1269,6 +1303,7 @@ class CdkVirtualForOf {
|
|
|
1269
1303
|
}
|
|
1270
1304
|
/**
|
|
1271
1305
|
* Swap out one `DataSource` for another.
|
|
1306
|
+
* @private
|
|
1272
1307
|
* @param {?} oldDs
|
|
1273
1308
|
* @param {?} newDs
|
|
1274
1309
|
* @return {?}
|
|
@@ -1282,6 +1317,7 @@ class CdkVirtualForOf {
|
|
|
1282
1317
|
}
|
|
1283
1318
|
/**
|
|
1284
1319
|
* Update the `CdkVirtualForOfContext` for all views.
|
|
1320
|
+
* @private
|
|
1285
1321
|
* @return {?}
|
|
1286
1322
|
*/
|
|
1287
1323
|
_updateContext() {
|
|
@@ -1291,7 +1327,7 @@ class CdkVirtualForOf {
|
|
|
1291
1327
|
let i = this._viewContainerRef.length;
|
|
1292
1328
|
while (i--) {
|
|
1293
1329
|
/** @type {?} */
|
|
1294
|
-
let view = /** @type {?} */ (this._viewContainerRef.get(i));
|
|
1330
|
+
let view = (/** @type {?} */ (this._viewContainerRef.get(i)));
|
|
1295
1331
|
view.context.index = this._renderedRange.start + i;
|
|
1296
1332
|
view.context.count = count;
|
|
1297
1333
|
this._updateComputedContextProperties(view.context);
|
|
@@ -1300,6 +1336,7 @@ class CdkVirtualForOf {
|
|
|
1300
1336
|
}
|
|
1301
1337
|
/**
|
|
1302
1338
|
* Apply changes to the DOM.
|
|
1339
|
+
* @private
|
|
1303
1340
|
* @param {?} changes
|
|
1304
1341
|
* @return {?}
|
|
1305
1342
|
*/
|
|
@@ -1307,18 +1344,19 @@ class CdkVirtualForOf {
|
|
|
1307
1344
|
// Rearrange the views to put them in the right location.
|
|
1308
1345
|
changes.forEachOperation((record, adjustedPreviousIndex, currentIndex) => {
|
|
1309
1346
|
if (record.previousIndex == null) { // Item added.
|
|
1347
|
+
// Item added.
|
|
1310
1348
|
/** @type {?} */
|
|
1311
1349
|
const view = this._getViewForNewItem();
|
|
1312
|
-
this._viewContainerRef.insert(view, /** @type {?} */ (
|
|
1350
|
+
this._viewContainerRef.insert(view, (/** @type {?} */ (currentIndex)));
|
|
1313
1351
|
view.context.$implicit = record.item;
|
|
1314
1352
|
}
|
|
1315
1353
|
else if (currentIndex == null) { // Item removed.
|
|
1316
|
-
|
|
1317
|
-
this._cacheView(/** @type {?} */ (this._viewContainerRef.detach(/** @type {?} */ ((adjustedPreviousIndex)))));
|
|
1354
|
+
this._cacheView((/** @type {?} */ (this._viewContainerRef.detach((/** @type {?} */ (adjustedPreviousIndex))))));
|
|
1318
1355
|
}
|
|
1319
1356
|
else { // Item moved.
|
|
1357
|
+
// Item moved.
|
|
1320
1358
|
/** @type {?} */
|
|
1321
|
-
const view = /** @type {?} */ (this._viewContainerRef.get(/** @type {?} */ (
|
|
1359
|
+
const view = (/** @type {?} */ (this._viewContainerRef.get((/** @type {?} */ (adjustedPreviousIndex)))));
|
|
1322
1360
|
this._viewContainerRef.move(view, currentIndex);
|
|
1323
1361
|
view.context.$implicit = record.item;
|
|
1324
1362
|
}
|
|
@@ -1326,16 +1364,17 @@ class CdkVirtualForOf {
|
|
|
1326
1364
|
// Update $implicit for any items that had an identity change.
|
|
1327
1365
|
changes.forEachIdentityChange((record) => {
|
|
1328
1366
|
/** @type {?} */
|
|
1329
|
-
const view = /** @type {?} */ (this._viewContainerRef.get(/** @type {?} */ (
|
|
1367
|
+
const view = (/** @type {?} */ (this._viewContainerRef.get((/** @type {?} */ (record.currentIndex)))));
|
|
1330
1368
|
view.context.$implicit = record.item;
|
|
1331
1369
|
});
|
|
1370
|
+
// Update the context variables on all items.
|
|
1332
1371
|
/** @type {?} */
|
|
1333
1372
|
const count = this._data.length;
|
|
1334
1373
|
/** @type {?} */
|
|
1335
1374
|
let i = this._viewContainerRef.length;
|
|
1336
1375
|
while (i--) {
|
|
1337
1376
|
/** @type {?} */
|
|
1338
|
-
const view = /** @type {?} */ (this._viewContainerRef.get(i));
|
|
1377
|
+
const view = (/** @type {?} */ (this._viewContainerRef.get(i)));
|
|
1339
1378
|
view.context.index = this._renderedRange.start + i;
|
|
1340
1379
|
view.context.count = count;
|
|
1341
1380
|
this._updateComputedContextProperties(view.context);
|
|
@@ -1343,6 +1382,7 @@ class CdkVirtualForOf {
|
|
|
1343
1382
|
}
|
|
1344
1383
|
/**
|
|
1345
1384
|
* Cache the given detached view.
|
|
1385
|
+
* @private
|
|
1346
1386
|
* @param {?} view
|
|
1347
1387
|
* @return {?}
|
|
1348
1388
|
*/
|
|
@@ -1366,11 +1406,12 @@ class CdkVirtualForOf {
|
|
|
1366
1406
|
}
|
|
1367
1407
|
/**
|
|
1368
1408
|
* Get a view for a new item, either from the cache or by creating a new one.
|
|
1409
|
+
* @private
|
|
1369
1410
|
* @return {?}
|
|
1370
1411
|
*/
|
|
1371
1412
|
_getViewForNewItem() {
|
|
1372
1413
|
return this._templateCache.pop() || this._viewContainerRef.createEmbeddedView(this._template, {
|
|
1373
|
-
$implicit: /** @type {?} */ (
|
|
1414
|
+
$implicit: (/** @type {?} */ (null)),
|
|
1374
1415
|
cdkVirtualForOf: this._cdkVirtualForOf,
|
|
1375
1416
|
index: -1,
|
|
1376
1417
|
count: -1,
|
|
@@ -1382,6 +1423,7 @@ class CdkVirtualForOf {
|
|
|
1382
1423
|
}
|
|
1383
1424
|
/**
|
|
1384
1425
|
* Update the computed properties on the `CdkVirtualForOfContext`.
|
|
1426
|
+
* @private
|
|
1385
1427
|
* @param {?} context
|
|
1386
1428
|
* @return {?}
|
|
1387
1429
|
*/
|
|
@@ -1414,7 +1456,7 @@ CdkVirtualForOf.propDecorators = {
|
|
|
1414
1456
|
|
|
1415
1457
|
/**
|
|
1416
1458
|
* @fileoverview added by tsickle
|
|
1417
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1459
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1418
1460
|
*/
|
|
1419
1461
|
class ScrollingModule {
|
|
1420
1462
|
}
|
|
@@ -1451,11 +1493,12 @@ ScrollDispatchModule.decorators = [
|
|
|
1451
1493
|
|
|
1452
1494
|
/**
|
|
1453
1495
|
* @fileoverview added by tsickle
|
|
1454
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1496
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1455
1497
|
*/
|
|
1456
|
-
/**
|
|
1498
|
+
/**
|
|
1457
1499
|
* Time in ms to throttle the resize events by default.
|
|
1458
|
-
|
|
1500
|
+
* @type {?}
|
|
1501
|
+
*/
|
|
1459
1502
|
const DEFAULT_RESIZE_TIME = 20;
|
|
1460
1503
|
/**
|
|
1461
1504
|
* Simple utility for getting the bounds of the browser viewport.
|
|
@@ -1495,7 +1538,7 @@ class ViewportRuler {
|
|
|
1495
1538
|
const output = { width: this._viewportSize.width, height: this._viewportSize.height };
|
|
1496
1539
|
// If we're not on a browser, don't cache the size since it'll be mocked out anyway.
|
|
1497
1540
|
if (!this._platform.isBrowser) {
|
|
1498
|
-
this._viewportSize = /** @type {?} */ (
|
|
1541
|
+
this._viewportSize = (/** @type {?} */ (null));
|
|
1499
1542
|
}
|
|
1500
1543
|
return output;
|
|
1501
1544
|
}
|
|
@@ -1504,6 +1547,15 @@ class ViewportRuler {
|
|
|
1504
1547
|
* @return {?}
|
|
1505
1548
|
*/
|
|
1506
1549
|
getViewportRect() {
|
|
1550
|
+
// Use the document element's bounding rect rather than the window scroll properties
|
|
1551
|
+
// (e.g. pageYOffset, scrollY) due to in issue in Chrome and IE where window scroll
|
|
1552
|
+
// properties and client coordinates (boundingClientRect, clientX/Y, etc.) are in different
|
|
1553
|
+
// conceptual viewports. Under most circumstances these viewports are equivalent, but they
|
|
1554
|
+
// can disagree when the page is pinch-zoomed (on devices that support touch).
|
|
1555
|
+
// See https://bugs.chromium.org/p/chromium/issues/detail?id=489206#c4
|
|
1556
|
+
// We use the documentElement instead of the body because, by default (without a css reset)
|
|
1557
|
+
// browsers typically give the document body an 8px margin, which is not included in
|
|
1558
|
+
// getBoundingClientRect().
|
|
1507
1559
|
/** @type {?} */
|
|
1508
1560
|
const scrollPosition = this.getViewportScrollPosition();
|
|
1509
1561
|
const { width, height } = this.getViewportSize();
|
|
@@ -1526,8 +1578,14 @@ class ViewportRuler {
|
|
|
1526
1578
|
if (!this._platform.isBrowser) {
|
|
1527
1579
|
return { top: 0, left: 0 };
|
|
1528
1580
|
}
|
|
1581
|
+
// The top-left-corner of the viewport is determined by the scroll position of the document
|
|
1582
|
+
// body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about
|
|
1583
|
+
// whether `document.body` or `document.documentElement` is the scrolled element, so reading
|
|
1584
|
+
// `scrollTop` and `scrollLeft` is inconsistent. However, using the bounding rect of
|
|
1585
|
+
// `document.documentElement` works consistently, where the `top` and `left` values will
|
|
1586
|
+
// equal negative the scroll position.
|
|
1529
1587
|
/** @type {?} */
|
|
1530
|
-
const documentElement = /** @type {?} */ (
|
|
1588
|
+
const documentElement = (/** @type {?} */ (document.documentElement));
|
|
1531
1589
|
/** @type {?} */
|
|
1532
1590
|
const documentRect = documentElement.getBoundingClientRect();
|
|
1533
1591
|
/** @type {?} */
|
|
@@ -1548,6 +1606,7 @@ class ViewportRuler {
|
|
|
1548
1606
|
}
|
|
1549
1607
|
/**
|
|
1550
1608
|
* Updates the cached viewport size.
|
|
1609
|
+
* @private
|
|
1551
1610
|
* @return {?}
|
|
1552
1611
|
*/
|
|
1553
1612
|
_updateViewportSize() {
|
|
@@ -1575,9 +1634,10 @@ ViewportRuler.ctorParameters = () => [
|
|
|
1575
1634
|
function VIEWPORT_RULER_PROVIDER_FACTORY(parentRuler, platform, ngZone) {
|
|
1576
1635
|
return parentRuler || new ViewportRuler(platform, ngZone);
|
|
1577
1636
|
}
|
|
1578
|
-
/**
|
|
1637
|
+
/**
|
|
1579
1638
|
* \@docs-private \@deprecated \@breaking-change 8.0.0
|
|
1580
|
-
|
|
1639
|
+
* @type {?}
|
|
1640
|
+
*/
|
|
1581
1641
|
const VIEWPORT_RULER_PROVIDER = {
|
|
1582
1642
|
// If there is already a ViewportRuler available, use that. Otherwise, provide a new one.
|
|
1583
1643
|
provide: ViewportRuler,
|
|
@@ -1587,12 +1647,12 @@ const VIEWPORT_RULER_PROVIDER = {
|
|
|
1587
1647
|
|
|
1588
1648
|
/**
|
|
1589
1649
|
* @fileoverview added by tsickle
|
|
1590
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1650
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1591
1651
|
*/
|
|
1592
1652
|
|
|
1593
1653
|
/**
|
|
1594
1654
|
* @fileoverview added by tsickle
|
|
1595
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1655
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1596
1656
|
*/
|
|
1597
1657
|
|
|
1598
1658
|
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 };
|