@angular/cdk 9.1.3 → 9.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/a11y/focus-monitor/focus-monitor.d.ts +43 -4
- package/a11y/high-contrast-mode/high-contrast-mode-detector.d.ts +2 -2
- package/a11y/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +140 -90
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +14 -7
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-coercion.umd.js +0 -1
- package/bundles/cdk-coercion.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +292 -179
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +23 -9
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.js +3 -1
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +4 -4
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +18 -3
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +2 -2
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +58 -27
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +12 -5
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.js +15 -9
- package/bundles/cdk-testing-protractor.umd.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.min.js +2 -2
- package/bundles/cdk-testing-protractor.umd.min.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.js +77 -19
- package/bundles/cdk-testing-testbed.umd.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.min.js +8 -8
- package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +9 -4
- 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 +1 -1
- 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/array.d.ts +1 -0
- package/drag-drop/client-rect.d.ts +31 -0
- package/drag-drop/directives/config.d.ts +1 -0
- package/drag-drop/directives/drop-list.d.ts +4 -3
- package/drag-drop/drag-ref.d.ts +8 -2
- package/drag-drop/drop-list-ref.d.ts +9 -8
- package/drag-drop/index.metadata.json +1 -1
- package/drag-drop/parent-position-tracker.d.ts +31 -0
- package/drag-drop/public-api.d.ts +1 -1
- package/esm2015/a11y/aria-describer/aria-reference.js +6 -6
- package/esm2015/a11y/focus-monitor/focus-monitor.js +198 -92
- package/esm2015/a11y/focus-trap/configurable-focus-trap-factory.js +3 -3
- package/esm2015/a11y/focus-trap/focus-trap.js +1 -1
- package/esm2015/a11y/high-contrast-mode/high-contrast-mode-detector.js +10 -6
- package/esm2015/a11y/live-announcer/live-announcer.js +1 -1
- package/esm2015/a11y/public-api.js +2 -2
- package/esm2015/coercion/array.js +1 -2
- package/esm2015/drag-drop/client-rect.js +75 -0
- package/esm2015/drag-drop/directives/config.js +3 -1
- package/esm2015/drag-drop/directives/drag.js +3 -2
- package/esm2015/drag-drop/directives/drop-list.js +24 -18
- package/esm2015/drag-drop/drag-drop-module.js +3 -1
- package/esm2015/drag-drop/drag-ref.js +97 -43
- package/esm2015/drag-drop/drop-list-ref.js +119 -187
- package/esm2015/drag-drop/parent-position-tracker.js +141 -0
- package/esm2015/drag-drop/public-api.js +1 -1
- package/esm2015/overlay/position/flexible-connected-position-strategy.js +1 -1
- package/esm2015/platform/features/shadow-dom.js +4 -2
- package/esm2015/scrolling/public-api.js +2 -2
- package/esm2015/scrolling/scrolling-module.js +15 -4
- package/esm2015/table/cell.js +18 -8
- package/esm2015/table/public-api.js +3 -2
- package/esm2015/table/row.js +24 -8
- package/esm2015/table/table.js +26 -12
- package/esm2015/table/text-column.js +3 -26
- package/esm2015/table/tokens.js +44 -0
- package/esm2015/testing/protractor/protractor-harness-environment.js +13 -8
- package/esm2015/testing/testbed/fake-events/dispatch-events.js +11 -4
- package/esm2015/testing/testbed/fake-events/event-objects.js +37 -3
- package/esm2015/testing/testbed/testbed-harness-environment.js +16 -10
- package/esm2015/testing/testbed/unit-test-element.js +13 -2
- package/esm2015/tree/padding.js +9 -10
- package/esm2015/tree/tree.js +2 -1
- package/esm2015/version.js +1 -1
- package/esm5/a11y/aria-describer/aria-reference.js +6 -6
- package/esm5/a11y/focus-monitor/focus-monitor.js +112 -65
- package/esm5/a11y/high-contrast-mode/high-contrast-mode-detector.js +9 -6
- package/esm5/coercion/array.js +1 -2
- package/esm5/drag-drop/client-rect.js +60 -0
- package/esm5/drag-drop/directives/config.js +1 -1
- package/esm5/drag-drop/directives/drag.js +3 -2
- package/esm5/drag-drop/directives/drop-list.js +13 -10
- package/esm5/drag-drop/drag-drop-module.js +3 -1
- package/esm5/drag-drop/drag-ref.js +62 -33
- package/esm5/drag-drop/drop-list-ref.js +89 -139
- package/esm5/drag-drop/parent-position-tracker.js +74 -0
- package/esm5/drag-drop/public-api.js +1 -1
- package/esm5/overlay/position/flexible-connected-position-strategy.js +1 -1
- package/esm5/platform/features/shadow-dom.js +4 -2
- package/esm5/scrolling/scrolling-module.js +19 -4
- package/esm5/table/cell.js +13 -8
- package/esm5/table/public-api.js +2 -1
- package/esm5/table/row.js +21 -11
- package/esm5/table/table.js +16 -11
- package/esm5/table/text-column.js +3 -4
- package/esm5/table/tokens.js +16 -0
- package/esm5/testing/protractor/protractor-harness-environment.js +17 -11
- package/esm5/testing/testbed/fake-events/dispatch-events.js +15 -7
- package/esm5/testing/testbed/fake-events/event-objects.js +43 -5
- package/esm5/testing/testbed/testbed-harness-environment.js +17 -11
- package/esm5/testing/testbed/unit-test-element.js +10 -3
- package/esm5/tree/padding.js +9 -5
- package/esm5/tree/tree.js +2 -1
- package/esm5/version.js +1 -1
- package/fesm2015/a11y.js +234 -126
- package/fesm2015/a11y.js.map +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/coercion.js +0 -1
- package/fesm2015/coercion.js.map +1 -1
- package/fesm2015/drag-drop.js +448 -247
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/platform.js +3 -1
- package/fesm2015/platform.js.map +1 -1
- package/fesm2015/scrolling.js +15 -4
- package/fesm2015/scrolling.js.map +1 -1
- package/fesm2015/table.js +98 -49
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/testing/protractor.js +13 -8
- package/fesm2015/testing/protractor.js.map +1 -1
- package/fesm2015/testing/testbed.js +71 -13
- package/fesm2015/testing/testbed.js.map +1 -1
- package/fesm2015/tree.js +9 -9
- package/fesm2015/tree.js.map +1 -1
- package/fesm5/a11y.js +141 -92
- package/fesm5/a11y.js.map +1 -1
- package/fesm5/cdk.js +1 -1
- package/fesm5/cdk.js.map +1 -1
- package/fesm5/coercion.js +0 -1
- package/fesm5/coercion.js.map +1 -1
- package/fesm5/drag-drop.js +294 -181
- package/fesm5/drag-drop.js.map +1 -1
- package/fesm5/overlay.js.map +1 -1
- package/fesm5/platform.js +3 -1
- package/fesm5/platform.js.map +1 -1
- package/fesm5/scrolling.js +18 -4
- package/fesm5/scrolling.js.map +1 -1
- package/fesm5/table.js +59 -29
- package/fesm5/table.js.map +1 -1
- package/fesm5/testing/protractor.js +17 -11
- package/fesm5/testing/protractor.js.map +1 -1
- package/fesm5/testing/testbed.js +78 -20
- package/fesm5/testing/testbed.js.map +1 -1
- package/fesm5/tree.js +9 -4
- package/fesm5/tree.js.map +1 -1
- package/overlay/position/flexible-connected-position-strategy.d.ts +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-update/devkit-file-system.d.ts +29 -0
- package/schematics/ng-update/devkit-file-system.js +67 -0
- package/schematics/ng-update/devkit-migration-rule.d.ts +25 -0
- package/schematics/ng-update/devkit-migration-rule.js +152 -0
- package/schematics/ng-update/devkit-migration.d.ts +37 -0
- package/schematics/ng-update/devkit-migration.js +29 -0
- package/schematics/ng-update/index.js +7 -7
- package/schematics/ng-update/{upgrade-rules/attribute-selectors-rule.d.ts → migrations/attribute-selectors.d.ts} +6 -6
- package/schematics/ng-update/migrations/attribute-selectors.js +76 -0
- package/schematics/ng-update/{upgrade-rules/class-inheritance-rule.d.ts → migrations/class-inheritance.d.ts} +6 -6
- package/schematics/ng-update/migrations/class-inheritance.js +67 -0
- package/schematics/ng-update/{upgrade-rules/class-names-rule.d.ts → migrations/class-names.d.ts} +6 -6
- package/schematics/ng-update/migrations/class-names.js +98 -0
- package/schematics/ng-update/{upgrade-rules/constructor-signature-rule.d.ts → migrations/constructor-signature.d.ts} +6 -6
- package/schematics/ng-update/migrations/constructor-signature.js +144 -0
- package/schematics/ng-update/{upgrade-rules/css-selectors-rule.d.ts → migrations/css-selectors.d.ts} +6 -6
- package/schematics/ng-update/migrations/css-selectors.js +83 -0
- package/schematics/ng-update/{upgrade-rules/element-selectors-rule.d.ts → migrations/element-selectors.d.ts} +6 -6
- package/schematics/ng-update/migrations/element-selectors.js +74 -0
- package/schematics/ng-update/{upgrade-rules/input-names-rule.d.ts → migrations/input-names.d.ts} +6 -6
- package/schematics/ng-update/migrations/input-names.js +69 -0
- package/schematics/ng-update/{upgrade-rules/method-call-arguments-rule.d.ts → migrations/method-call-arguments.d.ts} +6 -6
- package/schematics/ng-update/migrations/method-call-arguments.js +70 -0
- package/schematics/ng-update/{upgrade-rules/misc-template-rule.d.ts → migrations/misc-template.d.ts} +6 -6
- package/schematics/ng-update/migrations/misc-template.js +47 -0
- package/schematics/ng-update/{upgrade-rules/output-names-rule.d.ts → migrations/output-names.d.ts} +6 -6
- package/schematics/ng-update/migrations/output-names.js +56 -0
- package/schematics/ng-update/{upgrade-rules/property-names-rule.d.ts → migrations/property-names.d.ts} +6 -6
- package/schematics/ng-update/migrations/property-names.js +56 -0
- package/schematics/ng-update/public-api.d.ts +3 -2
- package/schematics/ng-update/public-api.js +5 -4
- package/schematics/ng-update/upgrade-data.d.ts +7 -8
- package/schematics/ng-update/upgrade-data.js +6 -7
- package/schematics/update-tool/component-resource-collector.d.ts +3 -1
- package/schematics/update-tool/component-resource-collector.js +8 -8
- package/schematics/update-tool/file-system.d.ts +38 -0
- package/schematics/update-tool/file-system.js +20 -0
- package/schematics/update-tool/index.d.ts +41 -11
- package/schematics/update-tool/index.js +135 -106
- package/schematics/update-tool/logger.d.ts +16 -0
- package/schematics/update-tool/logger.js +27 -0
- package/schematics/update-tool/{migration-rule.d.ts → migration.d.ts} +23 -45
- package/schematics/update-tool/migration.js +76 -0
- package/schematics/update-tool/public-api.d.ts +5 -4
- package/schematics/update-tool/public-api.js +6 -6
- package/schematics/update-tool/update-recorder.d.ts +14 -0
- package/schematics/update-tool/update-recorder.js +20 -0
- package/schematics/update-tool/utils/parse-tsconfig.js +1 -1
- package/schematics/update-tool/version-changes.js +3 -4
- package/schematics/utils/ast/ng-module-imports.js +3 -2
- package/scrolling/index.metadata.json +1 -1
- package/scrolling/scrolling-module.d.ts +2 -0
- package/table/cell.d.ts +2 -0
- package/table/index.metadata.json +1 -1
- package/table/public-api.d.ts +1 -0
- package/table/row.d.ts +6 -3
- package/table/table.d.ts +2 -0
- package/table/text-column.d.ts +2 -13
- package/table/tokens.d.ts +25 -0
- package/testing/protractor/protractor-harness-environment.d.ts +10 -3
- package/testing/testbed/fake-events/dispatch-events.d.ts +8 -3
- package/testing/testbed/fake-events/event-objects.d.ts +12 -1
- package/testing/testbed/testbed-harness-environment.d.ts +12 -4
- package/tree/index.metadata.json +1 -1
- package/tree/padding.d.ts +6 -2
- package/schematics/ng-update/upgrade-rules/attribute-selectors-rule.js +0 -76
- package/schematics/ng-update/upgrade-rules/class-inheritance-rule.js +0 -67
- package/schematics/ng-update/upgrade-rules/class-names-rule.js +0 -96
- package/schematics/ng-update/upgrade-rules/constructor-signature-rule.js +0 -144
- package/schematics/ng-update/upgrade-rules/css-selectors-rule.js +0 -83
- package/schematics/ng-update/upgrade-rules/element-selectors-rule.js +0 -74
- package/schematics/ng-update/upgrade-rules/index.d.ts +0 -22
- package/schematics/ng-update/upgrade-rules/index.js +0 -116
- package/schematics/ng-update/upgrade-rules/input-names-rule.js +0 -69
- package/schematics/ng-update/upgrade-rules/method-call-arguments-rule.js +0 -70
- package/schematics/ng-update/upgrade-rules/misc-template-rule.js +0 -47
- package/schematics/ng-update/upgrade-rules/output-names-rule.js +0 -56
- package/schematics/ng-update/upgrade-rules/property-names-rule.js +0 -56
- package/schematics/update-tool/migration-rule.js +0 -101
package/fesm2015/drag-drop.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Injectable, NgZone, Inject, ɵɵdefineInjectable, ɵɵinject, InjectionToken, Directive, ElementRef, Optional, Input, TemplateRef, EventEmitter, isDevMode, SkipSelf, ViewContainerRef, ChangeDetectorRef, ContentChildren, ContentChild, Output, NgModule } from '@angular/core';
|
|
2
2
|
import { DOCUMENT } from '@angular/common';
|
|
3
|
-
import { ViewportRuler, ScrollDispatcher } from '@angular/cdk/scrolling';
|
|
3
|
+
import { ViewportRuler, ScrollDispatcher, CdkScrollableModule } from '@angular/cdk/scrolling';
|
|
4
4
|
import { normalizePassiveListenerOptions, _getShadowRoot } from '@angular/cdk/platform';
|
|
5
5
|
import { coerceBooleanProperty, coerceElement, coerceNumberProperty, coerceArray } from '@angular/cdk/coercion';
|
|
6
6
|
import { Subject, Subscription, interval, animationFrameScheduler, Observable, merge } from 'rxjs';
|
|
7
|
-
import {
|
|
7
|
+
import { takeUntil, map, take, startWith, tap, switchMap } from 'rxjs/operators';
|
|
8
8
|
import { Directionality } from '@angular/cdk/bidi';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -137,6 +137,214 @@ function parseCssPropertyValue(computedStyle, name) {
|
|
|
137
137
|
part => part.trim()));
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
/**
|
|
141
|
+
* @fileoverview added by tsickle
|
|
142
|
+
* Generated from: src/cdk/drag-drop/client-rect.ts
|
|
143
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
144
|
+
*/
|
|
145
|
+
/**
|
|
146
|
+
* @license
|
|
147
|
+
* Copyright Google LLC All Rights Reserved.
|
|
148
|
+
*
|
|
149
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
150
|
+
* found in the LICENSE file at https://angular.io/license
|
|
151
|
+
*/
|
|
152
|
+
/**
|
|
153
|
+
* Gets a mutable version of an element's bounding `ClientRect`.
|
|
154
|
+
* @param {?} element
|
|
155
|
+
* @return {?}
|
|
156
|
+
*/
|
|
157
|
+
function getMutableClientRect(element) {
|
|
158
|
+
/** @type {?} */
|
|
159
|
+
const clientRect = element.getBoundingClientRect();
|
|
160
|
+
// We need to clone the `clientRect` here, because all the values on it are readonly
|
|
161
|
+
// and we need to be able to update them. Also we can't use a spread here, because
|
|
162
|
+
// the values on a `ClientRect` aren't own properties. See:
|
|
163
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#Notes
|
|
164
|
+
return {
|
|
165
|
+
top: clientRect.top,
|
|
166
|
+
right: clientRect.right,
|
|
167
|
+
bottom: clientRect.bottom,
|
|
168
|
+
left: clientRect.left,
|
|
169
|
+
width: clientRect.width,
|
|
170
|
+
height: clientRect.height
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Checks whether some coordinates are within a `ClientRect`.
|
|
175
|
+
* @param {?} clientRect ClientRect that is being checked.
|
|
176
|
+
* @param {?} x Coordinates along the X axis.
|
|
177
|
+
* @param {?} y Coordinates along the Y axis.
|
|
178
|
+
* @return {?}
|
|
179
|
+
*/
|
|
180
|
+
function isInsideClientRect(clientRect, x, y) {
|
|
181
|
+
const { top, bottom, left, right } = clientRect;
|
|
182
|
+
return y >= top && y <= bottom && x >= left && x <= right;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Updates the top/left positions of a `ClientRect`, as well as their bottom/right counterparts.
|
|
186
|
+
* @param {?} clientRect `ClientRect` that should be updated.
|
|
187
|
+
* @param {?} top Amount to add to the `top` position.
|
|
188
|
+
* @param {?} left Amount to add to the `left` position.
|
|
189
|
+
* @return {?}
|
|
190
|
+
*/
|
|
191
|
+
function adjustClientRect(clientRect, top, left) {
|
|
192
|
+
clientRect.top += top;
|
|
193
|
+
clientRect.bottom = clientRect.top + clientRect.height;
|
|
194
|
+
clientRect.left += left;
|
|
195
|
+
clientRect.right = clientRect.left + clientRect.width;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Checks whether the pointer coordinates are close to a ClientRect.
|
|
199
|
+
* @param {?} rect ClientRect to check against.
|
|
200
|
+
* @param {?} threshold Threshold around the ClientRect.
|
|
201
|
+
* @param {?} pointerX Coordinates along the X axis.
|
|
202
|
+
* @param {?} pointerY Coordinates along the Y axis.
|
|
203
|
+
* @return {?}
|
|
204
|
+
*/
|
|
205
|
+
function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
|
|
206
|
+
const { top, right, bottom, left, width, height } = rect;
|
|
207
|
+
/** @type {?} */
|
|
208
|
+
const xThreshold = width * threshold;
|
|
209
|
+
/** @type {?} */
|
|
210
|
+
const yThreshold = height * threshold;
|
|
211
|
+
return pointerY > top - yThreshold && pointerY < bottom + yThreshold &&
|
|
212
|
+
pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @fileoverview added by tsickle
|
|
217
|
+
* Generated from: src/cdk/drag-drop/parent-position-tracker.ts
|
|
218
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
219
|
+
*/
|
|
220
|
+
/**
|
|
221
|
+
* Object holding the scroll position of something.
|
|
222
|
+
* @record
|
|
223
|
+
*/
|
|
224
|
+
function ScrollPosition() { }
|
|
225
|
+
if (false) {
|
|
226
|
+
/** @type {?} */
|
|
227
|
+
ScrollPosition.prototype.top;
|
|
228
|
+
/** @type {?} */
|
|
229
|
+
ScrollPosition.prototype.left;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Keeps track of the scroll position and dimensions of the parents of an element.
|
|
233
|
+
*/
|
|
234
|
+
class ParentPositionTracker {
|
|
235
|
+
/**
|
|
236
|
+
* @param {?} _document
|
|
237
|
+
* @param {?} _viewportRuler
|
|
238
|
+
*/
|
|
239
|
+
constructor(_document, _viewportRuler) {
|
|
240
|
+
this._document = _document;
|
|
241
|
+
this._viewportRuler = _viewportRuler;
|
|
242
|
+
/**
|
|
243
|
+
* Cached positions of the scrollable parent elements.
|
|
244
|
+
*/
|
|
245
|
+
this.positions = new Map();
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Clears the cached positions.
|
|
249
|
+
* @return {?}
|
|
250
|
+
*/
|
|
251
|
+
clear() {
|
|
252
|
+
this.positions.clear();
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Caches the positions. Should be called at the beginning of a drag sequence.
|
|
256
|
+
* @param {?} elements
|
|
257
|
+
* @return {?}
|
|
258
|
+
*/
|
|
259
|
+
cache(elements) {
|
|
260
|
+
this.clear();
|
|
261
|
+
this.positions.set(this._document, {
|
|
262
|
+
scrollPosition: this._viewportRuler.getViewportScrollPosition(),
|
|
263
|
+
});
|
|
264
|
+
elements.forEach((/**
|
|
265
|
+
* @param {?} element
|
|
266
|
+
* @return {?}
|
|
267
|
+
*/
|
|
268
|
+
element => {
|
|
269
|
+
this.positions.set(element, {
|
|
270
|
+
scrollPosition: { top: element.scrollTop, left: element.scrollLeft },
|
|
271
|
+
clientRect: getMutableClientRect(element)
|
|
272
|
+
});
|
|
273
|
+
}));
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Handles scrolling while a drag is taking place.
|
|
277
|
+
* @param {?} event
|
|
278
|
+
* @return {?}
|
|
279
|
+
*/
|
|
280
|
+
handleScroll(event) {
|
|
281
|
+
/** @type {?} */
|
|
282
|
+
const target = (/** @type {?} */ (event.target));
|
|
283
|
+
/** @type {?} */
|
|
284
|
+
const cachedPosition = this.positions.get(target);
|
|
285
|
+
if (!cachedPosition) {
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
// Used when figuring out whether an element is inside the scroll parent. If the scrolled
|
|
289
|
+
// parent is the `document`, we use the `documentElement`, because IE doesn't support
|
|
290
|
+
// `contains` on the `document`.
|
|
291
|
+
/** @type {?} */
|
|
292
|
+
const scrolledParentNode = target === this._document ? target.documentElement : target;
|
|
293
|
+
/** @type {?} */
|
|
294
|
+
const scrollPosition = cachedPosition.scrollPosition;
|
|
295
|
+
/** @type {?} */
|
|
296
|
+
let newTop;
|
|
297
|
+
/** @type {?} */
|
|
298
|
+
let newLeft;
|
|
299
|
+
if (target === this._document) {
|
|
300
|
+
/** @type {?} */
|
|
301
|
+
const viewportScrollPosition = (/** @type {?} */ (this._viewportRuler)).getViewportScrollPosition();
|
|
302
|
+
newTop = viewportScrollPosition.top;
|
|
303
|
+
newLeft = viewportScrollPosition.left;
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
newTop = ((/** @type {?} */ (target))).scrollTop;
|
|
307
|
+
newLeft = ((/** @type {?} */ (target))).scrollLeft;
|
|
308
|
+
}
|
|
309
|
+
/** @type {?} */
|
|
310
|
+
const topDifference = scrollPosition.top - newTop;
|
|
311
|
+
/** @type {?} */
|
|
312
|
+
const leftDifference = scrollPosition.left - newLeft;
|
|
313
|
+
// Go through and update the cached positions of the scroll
|
|
314
|
+
// parents that are inside the element that was scrolled.
|
|
315
|
+
this.positions.forEach((/**
|
|
316
|
+
* @param {?} position
|
|
317
|
+
* @param {?} node
|
|
318
|
+
* @return {?}
|
|
319
|
+
*/
|
|
320
|
+
(position, node) => {
|
|
321
|
+
if (position.clientRect && target !== node && scrolledParentNode.contains(node)) {
|
|
322
|
+
adjustClientRect(position.clientRect, topDifference, leftDifference);
|
|
323
|
+
}
|
|
324
|
+
}));
|
|
325
|
+
scrollPosition.top = newTop;
|
|
326
|
+
scrollPosition.left = newLeft;
|
|
327
|
+
return { top: topDifference, left: leftDifference };
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (false) {
|
|
331
|
+
/**
|
|
332
|
+
* Cached positions of the scrollable parent elements.
|
|
333
|
+
* @type {?}
|
|
334
|
+
*/
|
|
335
|
+
ParentPositionTracker.prototype.positions;
|
|
336
|
+
/**
|
|
337
|
+
* @type {?}
|
|
338
|
+
* @private
|
|
339
|
+
*/
|
|
340
|
+
ParentPositionTracker.prototype._document;
|
|
341
|
+
/**
|
|
342
|
+
* @type {?}
|
|
343
|
+
* @private
|
|
344
|
+
*/
|
|
345
|
+
ParentPositionTracker.prototype._viewportRuler;
|
|
346
|
+
}
|
|
347
|
+
|
|
140
348
|
/**
|
|
141
349
|
* @fileoverview added by tsickle
|
|
142
350
|
* Generated from: src/cdk/drag-drop/drag-ref.ts
|
|
@@ -160,6 +368,11 @@ if (false) {
|
|
|
160
368
|
* @type {?}
|
|
161
369
|
*/
|
|
162
370
|
DragRefConfig.prototype.pointerDirectionChangeThreshold;
|
|
371
|
+
/**
|
|
372
|
+
* `z-index` for the absolutely-positioned elements that are created by the drag item.
|
|
373
|
+
* @type {?|undefined}
|
|
374
|
+
*/
|
|
375
|
+
DragRefConfig.prototype.zIndex;
|
|
163
376
|
}
|
|
164
377
|
/**
|
|
165
378
|
* Options that can be used to bind a passive event listener.
|
|
@@ -370,9 +583,9 @@ class DragRef {
|
|
|
370
583
|
// Prevent the default action as early as possible in order to block
|
|
371
584
|
// native actions like dragging the selected text or images with the mouse.
|
|
372
585
|
event.preventDefault();
|
|
586
|
+
/** @type {?} */
|
|
587
|
+
const pointerPosition = this._getPointerPositionOnPage(event);
|
|
373
588
|
if (!this._hasStartedDragging) {
|
|
374
|
-
/** @type {?} */
|
|
375
|
-
const pointerPosition = this._getPointerPositionOnPage(event);
|
|
376
589
|
/** @type {?} */
|
|
377
590
|
const distanceX = Math.abs(pointerPosition.x - this._pickupPositionOnPage.x);
|
|
378
591
|
/** @type {?} */
|
|
@@ -412,7 +625,7 @@ class DragRef {
|
|
|
412
625
|
}
|
|
413
626
|
}
|
|
414
627
|
/** @type {?} */
|
|
415
|
-
const constrainedPointerPosition = this._getConstrainedPointerPosition(
|
|
628
|
+
const constrainedPointerPosition = this._getConstrainedPointerPosition(pointerPosition);
|
|
416
629
|
this._hasMoved = true;
|
|
417
630
|
this._updatePointerDirectionDelta(constrainedPointerPosition);
|
|
418
631
|
if (this._dropContainer) {
|
|
@@ -462,6 +675,7 @@ class DragRef {
|
|
|
462
675
|
this._endDragSequence(event);
|
|
463
676
|
});
|
|
464
677
|
this.withRootElement(element);
|
|
678
|
+
this._parentPositions = new ParentPositionTracker(_document, _viewportRuler);
|
|
465
679
|
_dragDropRegistry.registerDragItem(this);
|
|
466
680
|
}
|
|
467
681
|
/**
|
|
@@ -565,8 +779,13 @@ class DragRef {
|
|
|
565
779
|
if ((/** @type {?} */ (this))._rootElement) {
|
|
566
780
|
(/** @type {?} */ (this))._removeRootElementListeners((/** @type {?} */ (this))._rootElement);
|
|
567
781
|
}
|
|
568
|
-
|
|
569
|
-
|
|
782
|
+
(/** @type {?} */ (this))._ngZone.runOutsideAngular((/**
|
|
783
|
+
* @return {?}
|
|
784
|
+
*/
|
|
785
|
+
() => {
|
|
786
|
+
element.addEventListener('mousedown', (/** @type {?} */ (this))._pointerDown, activeEventListenerOptions);
|
|
787
|
+
element.addEventListener('touchstart', (/** @type {?} */ (this))._pointerDown, passiveEventListenerOptions);
|
|
788
|
+
}));
|
|
570
789
|
(/** @type {?} */ (this))._initialTransform = undefined;
|
|
571
790
|
(/** @type {?} */ (this))._rootElement = element;
|
|
572
791
|
}
|
|
@@ -622,6 +841,7 @@ class DragRef {
|
|
|
622
841
|
this._disabledHandles.clear();
|
|
623
842
|
this._dropContainer = undefined;
|
|
624
843
|
this._resizeSubscription.unsubscribe();
|
|
844
|
+
this._parentPositions.clear();
|
|
625
845
|
this._boundaryElement = this._rootElement = this._placeholderTemplate =
|
|
626
846
|
this._previewTemplate = this._anchor = (/** @type {?} */ (null));
|
|
627
847
|
}
|
|
@@ -711,7 +931,7 @@ class DragRef {
|
|
|
711
931
|
/** @type {?} */
|
|
712
932
|
const position = this._pointerPositionAtLastDirectionChange;
|
|
713
933
|
if (position && this._dropContainer) {
|
|
714
|
-
this._updateActiveDropContainer(position);
|
|
934
|
+
this._updateActiveDropContainer(this._getConstrainedPointerPosition(position));
|
|
715
935
|
}
|
|
716
936
|
}
|
|
717
937
|
/**
|
|
@@ -820,7 +1040,9 @@ class DragRef {
|
|
|
820
1040
|
this._lastTouchEventTime = Date.now();
|
|
821
1041
|
}
|
|
822
1042
|
this._toggleNativeDragInteractions();
|
|
823
|
-
|
|
1043
|
+
/** @type {?} */
|
|
1044
|
+
const dropContainer = this._dropContainer;
|
|
1045
|
+
if (dropContainer) {
|
|
824
1046
|
/** @type {?} */
|
|
825
1047
|
const element = this._rootElement;
|
|
826
1048
|
/** @type {?} */
|
|
@@ -839,13 +1061,16 @@ class DragRef {
|
|
|
839
1061
|
element.style.display = 'none';
|
|
840
1062
|
this._document.body.appendChild(parent.replaceChild(placeholder, element));
|
|
841
1063
|
getPreviewInsertionPoint(this._document).appendChild(preview);
|
|
842
|
-
|
|
843
|
-
this._initialContainer =
|
|
844
|
-
this._initialIndex =
|
|
1064
|
+
dropContainer.start();
|
|
1065
|
+
this._initialContainer = dropContainer;
|
|
1066
|
+
this._initialIndex = dropContainer.getItemIndex(this);
|
|
845
1067
|
}
|
|
846
1068
|
else {
|
|
847
1069
|
this._initialContainer = this._initialIndex = (/** @type {?} */ (undefined));
|
|
848
1070
|
}
|
|
1071
|
+
// Important to run after we've called `start` on the parent container
|
|
1072
|
+
// so that it has had time to resolve its scrollable parents.
|
|
1073
|
+
this._parentPositions.cache(dropContainer ? dropContainer.getScrollableParents() : []);
|
|
849
1074
|
}
|
|
850
1075
|
/**
|
|
851
1076
|
* Sets up the different variables and subscriptions
|
|
@@ -897,14 +1122,15 @@ class DragRef {
|
|
|
897
1122
|
this._removeSubscriptions();
|
|
898
1123
|
this._pointerMoveSubscription = this._dragDropRegistry.pointerMove.subscribe(this._pointerMove);
|
|
899
1124
|
this._pointerUpSubscription = this._dragDropRegistry.pointerUp.subscribe(this._pointerUp);
|
|
900
|
-
this._scrollSubscription = this._dragDropRegistry.scroll.
|
|
1125
|
+
this._scrollSubscription = this._dragDropRegistry.scroll.subscribe((/**
|
|
1126
|
+
* @param {?} scrollEvent
|
|
901
1127
|
* @return {?}
|
|
902
1128
|
*/
|
|
903
|
-
|
|
904
|
-
this.
|
|
1129
|
+
scrollEvent => {
|
|
1130
|
+
this._updateOnScroll(scrollEvent);
|
|
905
1131
|
}));
|
|
906
1132
|
if (this._boundaryElement) {
|
|
907
|
-
this._boundaryRect = this._boundaryElement
|
|
1133
|
+
this._boundaryRect = getMutableClientRect(this._boundaryElement);
|
|
908
1134
|
}
|
|
909
1135
|
// If we have a custom preview we can't know ahead of time how large it'll be so we position
|
|
910
1136
|
// it next to the cursor. The exception is when the consumer has opted into making the preview
|
|
@@ -1026,14 +1252,18 @@ class DragRef {
|
|
|
1026
1252
|
const previewTemplate = previewConfig ? previewConfig.template : null;
|
|
1027
1253
|
/** @type {?} */
|
|
1028
1254
|
let preview;
|
|
1029
|
-
if (previewTemplate) {
|
|
1255
|
+
if (previewTemplate && previewConfig) {
|
|
1256
|
+
// Measure the element before we've inserted the preview
|
|
1257
|
+
// since the insertion could throw off the measurement.
|
|
1258
|
+
/** @type {?} */
|
|
1259
|
+
const rootRect = previewConfig.matchSize ? this._rootElement.getBoundingClientRect() : null;
|
|
1030
1260
|
/** @type {?} */
|
|
1031
|
-
const viewRef =
|
|
1261
|
+
const viewRef = previewConfig.viewContainer.createEmbeddedView(previewTemplate, previewConfig.context);
|
|
1032
1262
|
viewRef.detectChanges();
|
|
1033
1263
|
preview = getRootNode(viewRef, this._document);
|
|
1034
1264
|
this._previewRef = viewRef;
|
|
1035
|
-
if (
|
|
1036
|
-
matchElementSize(preview,
|
|
1265
|
+
if (previewConfig.matchSize) {
|
|
1266
|
+
matchElementSize(preview, (/** @type {?} */ (rootRect)));
|
|
1037
1267
|
}
|
|
1038
1268
|
else {
|
|
1039
1269
|
preview.style.transform =
|
|
@@ -1044,7 +1274,7 @@ class DragRef {
|
|
|
1044
1274
|
/** @type {?} */
|
|
1045
1275
|
const element = this._rootElement;
|
|
1046
1276
|
preview = deepCloneNode(element);
|
|
1047
|
-
matchElementSize(preview, element);
|
|
1277
|
+
matchElementSize(preview, element.getBoundingClientRect());
|
|
1048
1278
|
}
|
|
1049
1279
|
extendStyles(preview.style, {
|
|
1050
1280
|
// It's important that we disable the pointer events on the preview, because
|
|
@@ -1055,7 +1285,7 @@ class DragRef {
|
|
|
1055
1285
|
position: 'fixed',
|
|
1056
1286
|
top: '0',
|
|
1057
1287
|
left: '0',
|
|
1058
|
-
zIndex:
|
|
1288
|
+
zIndex: `${this._config.zIndex || 1000}`
|
|
1059
1289
|
});
|
|
1060
1290
|
toggleNativeDragInteractions(preview, false);
|
|
1061
1291
|
preview.classList.add('cdk-drag-preview');
|
|
@@ -1169,9 +1399,11 @@ class DragRef {
|
|
|
1169
1399
|
/** @type {?} */
|
|
1170
1400
|
const point = isTouchEvent(event) ? event.targetTouches[0] : event;
|
|
1171
1401
|
/** @type {?} */
|
|
1172
|
-
const
|
|
1402
|
+
const scrollPosition = this._getViewportScrollPosition();
|
|
1173
1403
|
/** @type {?} */
|
|
1174
|
-
const
|
|
1404
|
+
const x = point.pageX - referenceRect.left - scrollPosition.left;
|
|
1405
|
+
/** @type {?} */
|
|
1406
|
+
const y = point.pageY - referenceRect.top - scrollPosition.top;
|
|
1175
1407
|
return {
|
|
1176
1408
|
x: referenceRect.left - elementRect.left + x,
|
|
1177
1409
|
y: referenceRect.top - elementRect.top + y
|
|
@@ -1187,20 +1419,20 @@ class DragRef {
|
|
|
1187
1419
|
// `touches` will be empty for start/end events so we have to fall back to `changedTouches`.
|
|
1188
1420
|
/** @type {?} */
|
|
1189
1421
|
const point = isTouchEvent(event) ? (event.touches[0] || event.changedTouches[0]) : event;
|
|
1422
|
+
/** @type {?} */
|
|
1423
|
+
const scrollPosition = this._getViewportScrollPosition();
|
|
1190
1424
|
return {
|
|
1191
|
-
x: point.pageX -
|
|
1192
|
-
y: point.pageY -
|
|
1425
|
+
x: point.pageX - scrollPosition.left,
|
|
1426
|
+
y: point.pageY - scrollPosition.top
|
|
1193
1427
|
};
|
|
1194
1428
|
}
|
|
1195
1429
|
/**
|
|
1196
1430
|
* Gets the pointer position on the page, accounting for any position constraints.
|
|
1197
1431
|
* @private
|
|
1198
|
-
* @param {?}
|
|
1432
|
+
* @param {?} point
|
|
1199
1433
|
* @return {?}
|
|
1200
1434
|
*/
|
|
1201
|
-
_getConstrainedPointerPosition(
|
|
1202
|
-
/** @type {?} */
|
|
1203
|
-
const point = this._getPointerPositionOnPage(event);
|
|
1435
|
+
_getConstrainedPointerPosition(point) {
|
|
1204
1436
|
/** @type {?} */
|
|
1205
1437
|
const constrainedPoint = this.constrainPosition ? this.constrainPosition(point, this) : point;
|
|
1206
1438
|
/** @type {?} */
|
|
@@ -1329,6 +1561,7 @@ class DragRef {
|
|
|
1329
1561
|
*/
|
|
1330
1562
|
_cleanupCachedDimensions() {
|
|
1331
1563
|
this._boundaryRect = this._previewRect = undefined;
|
|
1564
|
+
this._parentPositions.clear();
|
|
1332
1565
|
}
|
|
1333
1566
|
/**
|
|
1334
1567
|
* Checks whether the element is still inside its boundary after the viewport has been resized.
|
|
@@ -1406,6 +1639,32 @@ class DragRef {
|
|
|
1406
1639
|
}
|
|
1407
1640
|
return value ? value.mouse : 0;
|
|
1408
1641
|
}
|
|
1642
|
+
/**
|
|
1643
|
+
* Updates the internal state of the draggable element when scrolling has occurred.
|
|
1644
|
+
* @private
|
|
1645
|
+
* @param {?} event
|
|
1646
|
+
* @return {?}
|
|
1647
|
+
*/
|
|
1648
|
+
_updateOnScroll(event) {
|
|
1649
|
+
/** @type {?} */
|
|
1650
|
+
const scrollDifference = this._parentPositions.handleScroll(event);
|
|
1651
|
+
// ClientRect dimensions are based on the page's scroll position so
|
|
1652
|
+
// we have to update the cached boundary ClientRect if the user has scrolled.
|
|
1653
|
+
if (this._boundaryRect && scrollDifference) {
|
|
1654
|
+
adjustClientRect(this._boundaryRect, scrollDifference.top, scrollDifference.left);
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
/**
|
|
1658
|
+
* Gets the scroll position of the viewport.
|
|
1659
|
+
* @private
|
|
1660
|
+
* @return {?}
|
|
1661
|
+
*/
|
|
1662
|
+
_getViewportScrollPosition() {
|
|
1663
|
+
/** @type {?} */
|
|
1664
|
+
const cachedPosition = this._parentPositions.positions.get(this._document);
|
|
1665
|
+
return cachedPosition ? cachedPosition.scrollPosition :
|
|
1666
|
+
this._viewportRuler.getViewportScrollPosition();
|
|
1667
|
+
}
|
|
1409
1668
|
}
|
|
1410
1669
|
if (false) {
|
|
1411
1670
|
/**
|
|
@@ -1498,11 +1757,11 @@ if (false) {
|
|
|
1498
1757
|
*/
|
|
1499
1758
|
DragRef.prototype._initialIndex;
|
|
1500
1759
|
/**
|
|
1501
|
-
* Cached
|
|
1760
|
+
* Cached positions of scrollable parent elements.
|
|
1502
1761
|
* @type {?}
|
|
1503
1762
|
* @private
|
|
1504
1763
|
*/
|
|
1505
|
-
DragRef.prototype.
|
|
1764
|
+
DragRef.prototype._parentPositions;
|
|
1506
1765
|
/**
|
|
1507
1766
|
* Emits when the item is being moved.
|
|
1508
1767
|
* @type {?}
|
|
@@ -1850,24 +2109,26 @@ function getPreviewInsertionPoint(documentRef) {
|
|
|
1850
2109
|
*/
|
|
1851
2110
|
function getRootNode(viewRef, _document) {
|
|
1852
2111
|
/** @type {?} */
|
|
1853
|
-
const
|
|
1854
|
-
if (
|
|
1855
|
-
/** @type {?} */
|
|
1856
|
-
const wrapper = _document.createElement('div');
|
|
1857
|
-
wrapper.appendChild(rootNode);
|
|
1858
|
-
return wrapper;
|
|
2112
|
+
const rootNodes = viewRef.rootNodes;
|
|
2113
|
+
if (rootNodes.length === 1 && rootNodes[0].nodeType === _document.ELEMENT_NODE) {
|
|
2114
|
+
return (/** @type {?} */ (rootNodes[0]));
|
|
1859
2115
|
}
|
|
1860
|
-
|
|
2116
|
+
/** @type {?} */
|
|
2117
|
+
const wrapper = _document.createElement('div');
|
|
2118
|
+
rootNodes.forEach((/**
|
|
2119
|
+
* @param {?} node
|
|
2120
|
+
* @return {?}
|
|
2121
|
+
*/
|
|
2122
|
+
node => wrapper.appendChild(node)));
|
|
2123
|
+
return wrapper;
|
|
1861
2124
|
}
|
|
1862
2125
|
/**
|
|
1863
2126
|
* Matches the target element's size to the source's size.
|
|
1864
2127
|
* @param {?} target Element that needs to be resized.
|
|
1865
|
-
* @param {?}
|
|
2128
|
+
* @param {?} sourceRect Dimensions of the source element.
|
|
1866
2129
|
* @return {?}
|
|
1867
2130
|
*/
|
|
1868
|
-
function matchElementSize(target,
|
|
1869
|
-
/** @type {?} */
|
|
1870
|
-
const sourceRect = source.getBoundingClientRect();
|
|
2131
|
+
function matchElementSize(target, sourceRect) {
|
|
1871
2132
|
target.style.width = `${sourceRect.width}px`;
|
|
1872
2133
|
target.style.height = `${sourceRect.height}px`;
|
|
1873
2134
|
target.style.transform = getTransform(sourceRect.left, sourceRect.top);
|
|
@@ -2002,17 +2263,6 @@ if (false) {
|
|
|
2002
2263
|
*/
|
|
2003
2264
|
CachedItemPosition.prototype.offset;
|
|
2004
2265
|
}
|
|
2005
|
-
/**
|
|
2006
|
-
* Object holding the scroll position of something.
|
|
2007
|
-
* @record
|
|
2008
|
-
*/
|
|
2009
|
-
function ScrollPosition() { }
|
|
2010
|
-
if (false) {
|
|
2011
|
-
/** @type {?} */
|
|
2012
|
-
ScrollPosition.prototype.top;
|
|
2013
|
-
/** @type {?} */
|
|
2014
|
-
ScrollPosition.prototype.left;
|
|
2015
|
-
}
|
|
2016
2266
|
/** @enum {number} */
|
|
2017
2267
|
const AutoScrollVerticalDirection = {
|
|
2018
2268
|
NONE: 0, UP: 1, DOWN: 2,
|
|
@@ -2094,10 +2344,6 @@ class DropListRef {
|
|
|
2094
2344
|
* Cache of the dimensions of all the items inside the container.
|
|
2095
2345
|
*/
|
|
2096
2346
|
this._itemPositions = [];
|
|
2097
|
-
/**
|
|
2098
|
-
* Cached positions of the scrollable parent elements.
|
|
2099
|
-
*/
|
|
2100
|
-
this._parentPositions = new Map();
|
|
2101
2347
|
/**
|
|
2102
2348
|
* Keeps track of the item that was last swapped with the dragged item, as
|
|
2103
2349
|
* well as what direction the pointer was moving in when the swap occured.
|
|
@@ -2173,6 +2419,7 @@ class DropListRef {
|
|
|
2173
2419
|
this._document = _document;
|
|
2174
2420
|
this.withScrollableParents([this.element]);
|
|
2175
2421
|
_dragDropRegistry.registerDropContainer(this);
|
|
2422
|
+
this._parentPositions = new ParentPositionTracker(_document, _viewportRuler);
|
|
2176
2423
|
}
|
|
2177
2424
|
/**
|
|
2178
2425
|
* Removes the drop list functionality from the DOM element.
|
|
@@ -2276,14 +2523,23 @@ class DropListRef {
|
|
|
2276
2523
|
activeDraggables.splice(newIndex, 0, item);
|
|
2277
2524
|
}
|
|
2278
2525
|
else {
|
|
2279
|
-
|
|
2280
|
-
|
|
2526
|
+
/** @type {?} */
|
|
2527
|
+
const element = coerceElement(this.element);
|
|
2528
|
+
if (this._shouldEnterAsFirstChild(pointerX, pointerY)) {
|
|
2529
|
+
element.insertBefore(placeholder, activeDraggables[0].getRootElement());
|
|
2530
|
+
activeDraggables.unshift(item);
|
|
2531
|
+
}
|
|
2532
|
+
else {
|
|
2533
|
+
element.appendChild(placeholder);
|
|
2534
|
+
activeDraggables.push(item);
|
|
2535
|
+
}
|
|
2281
2536
|
}
|
|
2282
2537
|
// The transform needs to be cleared so it doesn't throw off the measurements.
|
|
2283
2538
|
placeholder.style.transform = '';
|
|
2284
2539
|
// Note that the positions were already cached when we called `start` above,
|
|
2285
|
-
// but we need to refresh them since the amount of items has changed.
|
|
2540
|
+
// but we need to refresh them since the amount of items has changed and also parent rects.
|
|
2286
2541
|
this._cacheItemPositions();
|
|
2542
|
+
this._cacheParentPositions();
|
|
2287
2543
|
this.entered.next({ item, container: this, currentIndex: this.getItemIndex(item) });
|
|
2288
2544
|
}
|
|
2289
2545
|
/**
|
|
@@ -2331,6 +2587,8 @@ class DropListRef {
|
|
|
2331
2587
|
* @return {THIS}
|
|
2332
2588
|
*/
|
|
2333
2589
|
withItems(items) {
|
|
2590
|
+
/** @type {?} */
|
|
2591
|
+
const previousItems = (/** @type {?} */ (this))._draggables;
|
|
2334
2592
|
(/** @type {?} */ (this))._draggables = items;
|
|
2335
2593
|
items.forEach((/**
|
|
2336
2594
|
* @param {?} item
|
|
@@ -2338,7 +2596,24 @@ class DropListRef {
|
|
|
2338
2596
|
*/
|
|
2339
2597
|
item => item._withDropContainer((/** @type {?} */ (this)))));
|
|
2340
2598
|
if ((/** @type {?} */ (this)).isDragging()) {
|
|
2341
|
-
|
|
2599
|
+
/** @type {?} */
|
|
2600
|
+
const draggedItems = previousItems.filter((/**
|
|
2601
|
+
* @param {?} item
|
|
2602
|
+
* @return {?}
|
|
2603
|
+
*/
|
|
2604
|
+
item => item.isDragging()));
|
|
2605
|
+
// If all of the items being dragged were removed
|
|
2606
|
+
// from the list, abort the current drag sequence.
|
|
2607
|
+
if (draggedItems.every((/**
|
|
2608
|
+
* @param {?} item
|
|
2609
|
+
* @return {?}
|
|
2610
|
+
*/
|
|
2611
|
+
item => items.indexOf(item) === -1))) {
|
|
2612
|
+
(/** @type {?} */ (this))._reset();
|
|
2613
|
+
}
|
|
2614
|
+
else {
|
|
2615
|
+
(/** @type {?} */ (this))._cacheItems();
|
|
2616
|
+
}
|
|
2342
2617
|
}
|
|
2343
2618
|
return (/** @type {?} */ (this));
|
|
2344
2619
|
}
|
|
@@ -2392,6 +2667,13 @@ class DropListRef {
|
|
|
2392
2667
|
elements.indexOf(element) === -1 ? [element, ...elements] : elements.slice();
|
|
2393
2668
|
return (/** @type {?} */ (this));
|
|
2394
2669
|
}
|
|
2670
|
+
/**
|
|
2671
|
+
* Gets the scrollable parents that are registered with this drop container.
|
|
2672
|
+
* @return {?}
|
|
2673
|
+
*/
|
|
2674
|
+
getScrollableParents() {
|
|
2675
|
+
return this._scrollableElements;
|
|
2676
|
+
}
|
|
2395
2677
|
/**
|
|
2396
2678
|
* Figures out the index of an item in the container.
|
|
2397
2679
|
* @param {?} item Item whose index should be determined.
|
|
@@ -2431,7 +2713,8 @@ class DropListRef {
|
|
|
2431
2713
|
*/
|
|
2432
2714
|
_sortItem(item, pointerX, pointerY, pointerDelta) {
|
|
2433
2715
|
// Don't sort the item if sorting is disabled or it's out of range.
|
|
2434
|
-
if (this.sortingDisabled ||
|
|
2716
|
+
if (this.sortingDisabled ||
|
|
2717
|
+
!isPointerNearClientRect(this._clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
2435
2718
|
return;
|
|
2436
2719
|
}
|
|
2437
2720
|
/** @type {?} */
|
|
@@ -2530,7 +2813,7 @@ class DropListRef {
|
|
|
2530
2813
|
/** @type {?} */
|
|
2531
2814
|
let horizontalScrollDirection = 0 /* NONE */;
|
|
2532
2815
|
// Check whether we should start scrolling any of the parent containers.
|
|
2533
|
-
this._parentPositions.forEach((/**
|
|
2816
|
+
this._parentPositions.positions.forEach((/**
|
|
2534
2817
|
* @param {?} position
|
|
2535
2818
|
* @param {?} element
|
|
2536
2819
|
* @return {?}
|
|
@@ -2541,7 +2824,7 @@ class DropListRef {
|
|
|
2541
2824
|
if (element === this._document || !position.clientRect || scrollNode) {
|
|
2542
2825
|
return;
|
|
2543
2826
|
}
|
|
2544
|
-
if (isPointerNearClientRect(position.clientRect, pointerX, pointerY)) {
|
|
2827
|
+
if (isPointerNearClientRect(position.clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
2545
2828
|
[verticalScrollDirection, horizontalScrollDirection] = getElementScrollDirections((/** @type {?} */ (element)), position.clientRect, pointerX, pointerY);
|
|
2546
2829
|
if (verticalScrollDirection || horizontalScrollDirection) {
|
|
2547
2830
|
scrollNode = (/** @type {?} */ (element));
|
|
@@ -2584,28 +2867,12 @@ class DropListRef {
|
|
|
2584
2867
|
* @return {?}
|
|
2585
2868
|
*/
|
|
2586
2869
|
_cacheParentPositions() {
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
* @return {?}
|
|
2594
|
-
*/
|
|
2595
|
-
element => {
|
|
2596
|
-
/** @type {?} */
|
|
2597
|
-
const clientRect = getMutableClientRect(element);
|
|
2598
|
-
// We keep the ClientRect cached in two properties, because it's referenced in a lot of
|
|
2599
|
-
// performance-sensitive places and we want to avoid the extra lookups. The `element` is
|
|
2600
|
-
// guaranteed to always be in the `_scrollableElements` so this should always match.
|
|
2601
|
-
if (element === this.element) {
|
|
2602
|
-
this._clientRect = clientRect;
|
|
2603
|
-
}
|
|
2604
|
-
this._parentPositions.set(element, {
|
|
2605
|
-
scrollPosition: { top: element.scrollTop, left: element.scrollLeft },
|
|
2606
|
-
clientRect
|
|
2607
|
-
});
|
|
2608
|
-
}));
|
|
2870
|
+
/** @type {?} */
|
|
2871
|
+
const element = coerceElement(this.element);
|
|
2872
|
+
this._parentPositions.cache(this._scrollableElements);
|
|
2873
|
+
// The list element is always in the `scrollableElements`
|
|
2874
|
+
// so we can take advantage of the cached `ClientRect`.
|
|
2875
|
+
this._clientRect = (/** @type {?} */ ((/** @type {?} */ (this._parentPositions.positions.get(element))).clientRect));
|
|
2609
2876
|
}
|
|
2610
2877
|
/**
|
|
2611
2878
|
* Refreshes the position cache of the items and sibling containers.
|
|
@@ -2648,7 +2915,13 @@ class DropListRef {
|
|
|
2648
2915
|
* @param {?} item
|
|
2649
2916
|
* @return {?}
|
|
2650
2917
|
*/
|
|
2651
|
-
item =>
|
|
2918
|
+
item => {
|
|
2919
|
+
/** @type {?} */
|
|
2920
|
+
const rootElement = item.getRootElement();
|
|
2921
|
+
if (rootElement) {
|
|
2922
|
+
rootElement.style.transform = '';
|
|
2923
|
+
}
|
|
2924
|
+
}));
|
|
2652
2925
|
this._siblings.forEach((/**
|
|
2653
2926
|
* @param {?} sibling
|
|
2654
2927
|
* @return {?}
|
|
@@ -2718,6 +2991,36 @@ class DropListRef {
|
|
|
2718
2991
|
}
|
|
2719
2992
|
return itemOffset;
|
|
2720
2993
|
}
|
|
2994
|
+
/**
|
|
2995
|
+
* Checks if pointer is entering in the first position
|
|
2996
|
+
* @private
|
|
2997
|
+
* @param {?} pointerX Position of the user's pointer along the X axis.
|
|
2998
|
+
* @param {?} pointerY Position of the user's pointer along the Y axis.
|
|
2999
|
+
* @return {?}
|
|
3000
|
+
*/
|
|
3001
|
+
_shouldEnterAsFirstChild(pointerX, pointerY) {
|
|
3002
|
+
if (!this._activeDraggables.length) {
|
|
3003
|
+
return false;
|
|
3004
|
+
}
|
|
3005
|
+
/** @type {?} */
|
|
3006
|
+
const itemPositions = this._itemPositions;
|
|
3007
|
+
/** @type {?} */
|
|
3008
|
+
const isHorizontal = this._orientation === 'horizontal';
|
|
3009
|
+
// `itemPositions` are sorted by position while `activeDraggables` are sorted by child index
|
|
3010
|
+
// check if container is using some sort of "reverse" ordering (eg: flex-direction: row-reverse)
|
|
3011
|
+
/** @type {?} */
|
|
3012
|
+
const reversed = itemPositions[0].drag !== this._activeDraggables[0];
|
|
3013
|
+
if (reversed) {
|
|
3014
|
+
/** @type {?} */
|
|
3015
|
+
const lastItemRect = itemPositions[itemPositions.length - 1].clientRect;
|
|
3016
|
+
return isHorizontal ? pointerX >= lastItemRect.right : pointerY >= lastItemRect.bottom;
|
|
3017
|
+
}
|
|
3018
|
+
else {
|
|
3019
|
+
/** @type {?} */
|
|
3020
|
+
const firstItemRect = itemPositions[0].clientRect;
|
|
3021
|
+
return isHorizontal ? pointerX <= firstItemRect.left : pointerY <= firstItemRect.top;
|
|
3022
|
+
}
|
|
3023
|
+
}
|
|
2721
3024
|
/**
|
|
2722
3025
|
* Gets the index of an item in the drop container, based on the position of the user's pointer.
|
|
2723
3026
|
* @private
|
|
@@ -2754,8 +3057,8 @@ class DropListRef {
|
|
|
2754
3057
|
return isHorizontal ?
|
|
2755
3058
|
// Round these down since most browsers report client rects with
|
|
2756
3059
|
// sub-pixel precision, whereas the pointer coordinates are rounded to pixels.
|
|
2757
|
-
pointerX >= Math.floor(clientRect.left) && pointerX
|
|
2758
|
-
pointerY >= Math.floor(clientRect.top) && pointerY
|
|
3060
|
+
pointerX >= Math.floor(clientRect.left) && pointerX < Math.floor(clientRect.right) :
|
|
3061
|
+
pointerY >= Math.floor(clientRect.top) && pointerY < Math.floor(clientRect.bottom);
|
|
2759
3062
|
}));
|
|
2760
3063
|
}
|
|
2761
3064
|
/**
|
|
@@ -2768,64 +3071,6 @@ class DropListRef {
|
|
|
2768
3071
|
this._cacheItemPositions();
|
|
2769
3072
|
this._cacheParentPositions();
|
|
2770
3073
|
}
|
|
2771
|
-
/**
|
|
2772
|
-
* Updates the internal state of the container after a scroll event has happened.
|
|
2773
|
-
* @private
|
|
2774
|
-
* @param {?} scrolledParent Element that was scrolled.
|
|
2775
|
-
* @param {?} newTop New top scroll position.
|
|
2776
|
-
* @param {?} newLeft New left scroll position.
|
|
2777
|
-
* @return {?}
|
|
2778
|
-
*/
|
|
2779
|
-
_updateAfterScroll(scrolledParent, newTop, newLeft) {
|
|
2780
|
-
// Used when figuring out whether an element is inside the scroll parent. If the scrolled
|
|
2781
|
-
// parent is the `document`, we use the `documentElement`, because IE doesn't support `contains`
|
|
2782
|
-
// on the `document`.
|
|
2783
|
-
/** @type {?} */
|
|
2784
|
-
const scrolledParentNode = scrolledParent === this._document ? scrolledParent.documentElement : scrolledParent;
|
|
2785
|
-
/** @type {?} */
|
|
2786
|
-
const scrollPosition = (/** @type {?} */ (this._parentPositions.get(scrolledParent))).scrollPosition;
|
|
2787
|
-
/** @type {?} */
|
|
2788
|
-
const topDifference = scrollPosition.top - newTop;
|
|
2789
|
-
/** @type {?} */
|
|
2790
|
-
const leftDifference = scrollPosition.left - newLeft;
|
|
2791
|
-
// Go through and update the cached positions of the scroll
|
|
2792
|
-
// parents that are inside the element that was scrolled.
|
|
2793
|
-
this._parentPositions.forEach((/**
|
|
2794
|
-
* @param {?} position
|
|
2795
|
-
* @param {?} node
|
|
2796
|
-
* @return {?}
|
|
2797
|
-
*/
|
|
2798
|
-
(position, node) => {
|
|
2799
|
-
if (position.clientRect && scrolledParent !== node && scrolledParentNode.contains(node)) {
|
|
2800
|
-
adjustClientRect(position.clientRect, topDifference, leftDifference);
|
|
2801
|
-
}
|
|
2802
|
-
}));
|
|
2803
|
-
// Since we know the amount that the user has scrolled we can shift all of the client rectangles
|
|
2804
|
-
// ourselves. This is cheaper than re-measuring everything and we can avoid inconsistent
|
|
2805
|
-
// behavior where we might be measuring the element before its position has changed.
|
|
2806
|
-
this._itemPositions.forEach((/**
|
|
2807
|
-
* @param {?} __0
|
|
2808
|
-
* @return {?}
|
|
2809
|
-
*/
|
|
2810
|
-
({ clientRect }) => {
|
|
2811
|
-
adjustClientRect(clientRect, topDifference, leftDifference);
|
|
2812
|
-
}));
|
|
2813
|
-
// We need two loops for this, because we want all of the cached
|
|
2814
|
-
// positions to be up-to-date before we re-sort the item.
|
|
2815
|
-
this._itemPositions.forEach((/**
|
|
2816
|
-
* @param {?} __0
|
|
2817
|
-
* @return {?}
|
|
2818
|
-
*/
|
|
2819
|
-
({ drag }) => {
|
|
2820
|
-
if (this._dragDropRegistry.isDragging(drag)) {
|
|
2821
|
-
// We need to re-sort the item manually, because the pointer move
|
|
2822
|
-
// events won't be dispatched while the user is scrolling.
|
|
2823
|
-
drag._sortFromLastPointerPosition();
|
|
2824
|
-
}
|
|
2825
|
-
}));
|
|
2826
|
-
scrollPosition.top = newTop;
|
|
2827
|
-
scrollPosition.left = newLeft;
|
|
2828
|
-
}
|
|
2829
3074
|
/**
|
|
2830
3075
|
* Checks whether the user's pointer is positioned over the container.
|
|
2831
3076
|
* @param {?} x Pointer position along the X axis.
|
|
@@ -2915,25 +3160,32 @@ class DropListRef {
|
|
|
2915
3160
|
event => {
|
|
2916
3161
|
if (this.isDragging()) {
|
|
2917
3162
|
/** @type {?} */
|
|
2918
|
-
const
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
/**
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
3163
|
+
const scrollDifference = this._parentPositions.handleScroll(event);
|
|
3164
|
+
if (scrollDifference) {
|
|
3165
|
+
// Since we know the amount that the user has scrolled we can shift all of the
|
|
3166
|
+
// client rectangles ourselves. This is cheaper than re-measuring everything and
|
|
3167
|
+
// we can avoid inconsistent behavior where we might be measuring the element before
|
|
3168
|
+
// its position has changed.
|
|
3169
|
+
this._itemPositions.forEach((/**
|
|
3170
|
+
* @param {?} __0
|
|
3171
|
+
* @return {?}
|
|
3172
|
+
*/
|
|
3173
|
+
({ clientRect }) => {
|
|
3174
|
+
adjustClientRect(clientRect, scrollDifference.top, scrollDifference.left);
|
|
3175
|
+
}));
|
|
3176
|
+
// We need two loops for this, because we want all of the cached
|
|
3177
|
+
// positions to be up-to-date before we re-sort the item.
|
|
3178
|
+
this._itemPositions.forEach((/**
|
|
3179
|
+
* @param {?} __0
|
|
3180
|
+
* @return {?}
|
|
3181
|
+
*/
|
|
3182
|
+
({ drag }) => {
|
|
3183
|
+
if (this._dragDropRegistry.isDragging(drag)) {
|
|
3184
|
+
// We need to re-sort the item manually, because the pointer move
|
|
3185
|
+
// events won't be dispatched while the user is scrolling.
|
|
3186
|
+
drag._sortFromLastPointerPosition();
|
|
3187
|
+
}
|
|
3188
|
+
}));
|
|
2937
3189
|
}
|
|
2938
3190
|
}
|
|
2939
3191
|
else if (this.isReceiving()) {
|
|
@@ -3035,7 +3287,7 @@ if (false) {
|
|
|
3035
3287
|
*/
|
|
3036
3288
|
DropListRef.prototype._itemPositions;
|
|
3037
3289
|
/**
|
|
3038
|
-
*
|
|
3290
|
+
* Keeps track of the positions of any parent scrollable elements.
|
|
3039
3291
|
* @type {?}
|
|
3040
3292
|
* @private
|
|
3041
3293
|
*/
|
|
@@ -3167,35 +3419,6 @@ if (false) {
|
|
|
3167
3419
|
*/
|
|
3168
3420
|
DropListRef.prototype._viewportRuler;
|
|
3169
3421
|
}
|
|
3170
|
-
/**
|
|
3171
|
-
* Updates the top/left positions of a `ClientRect`, as well as their bottom/right counterparts.
|
|
3172
|
-
* @param {?} clientRect `ClientRect` that should be updated.
|
|
3173
|
-
* @param {?} top Amount to add to the `top` position.
|
|
3174
|
-
* @param {?} left Amount to add to the `left` position.
|
|
3175
|
-
* @return {?}
|
|
3176
|
-
*/
|
|
3177
|
-
function adjustClientRect(clientRect, top, left) {
|
|
3178
|
-
clientRect.top += top;
|
|
3179
|
-
clientRect.bottom = clientRect.top + clientRect.height;
|
|
3180
|
-
clientRect.left += left;
|
|
3181
|
-
clientRect.right = clientRect.left + clientRect.width;
|
|
3182
|
-
}
|
|
3183
|
-
/**
|
|
3184
|
-
* Checks whether the pointer coordinates are close to a ClientRect.
|
|
3185
|
-
* @param {?} rect ClientRect to check against.
|
|
3186
|
-
* @param {?} pointerX Coordinates along the X axis.
|
|
3187
|
-
* @param {?} pointerY Coordinates along the Y axis.
|
|
3188
|
-
* @return {?}
|
|
3189
|
-
*/
|
|
3190
|
-
function isPointerNearClientRect(rect, pointerX, pointerY) {
|
|
3191
|
-
const { top, right, bottom, left, width, height } = rect;
|
|
3192
|
-
/** @type {?} */
|
|
3193
|
-
const xThreshold = width * DROP_PROXIMITY_THRESHOLD;
|
|
3194
|
-
/** @type {?} */
|
|
3195
|
-
const yThreshold = height * DROP_PROXIMITY_THRESHOLD;
|
|
3196
|
-
return pointerY > top - yThreshold && pointerY < bottom + yThreshold &&
|
|
3197
|
-
pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
3198
|
-
}
|
|
3199
3422
|
/**
|
|
3200
3423
|
* Finds the index of an item that matches a predicate function. Used as an equivalent
|
|
3201
3424
|
* of `Array.prototype.findIndex` which isn't part of the standard Google typings.
|
|
@@ -3212,38 +3435,6 @@ function findIndex(array, predicate) {
|
|
|
3212
3435
|
}
|
|
3213
3436
|
return -1;
|
|
3214
3437
|
}
|
|
3215
|
-
/**
|
|
3216
|
-
* Checks whether some coordinates are within a `ClientRect`.
|
|
3217
|
-
* @param {?} clientRect ClientRect that is being checked.
|
|
3218
|
-
* @param {?} x Coordinates along the X axis.
|
|
3219
|
-
* @param {?} y Coordinates along the Y axis.
|
|
3220
|
-
* @return {?}
|
|
3221
|
-
*/
|
|
3222
|
-
function isInsideClientRect(clientRect, x, y) {
|
|
3223
|
-
const { top, bottom, left, right } = clientRect;
|
|
3224
|
-
return y >= top && y <= bottom && x >= left && x <= right;
|
|
3225
|
-
}
|
|
3226
|
-
/**
|
|
3227
|
-
* Gets a mutable version of an element's bounding `ClientRect`.
|
|
3228
|
-
* @param {?} element
|
|
3229
|
-
* @return {?}
|
|
3230
|
-
*/
|
|
3231
|
-
function getMutableClientRect(element) {
|
|
3232
|
-
/** @type {?} */
|
|
3233
|
-
const clientRect = element.getBoundingClientRect();
|
|
3234
|
-
// We need to clone the `clientRect` here, because all the values on it are readonly
|
|
3235
|
-
// and we need to be able to update them. Also we can't use a spread here, because
|
|
3236
|
-
// the values on a `ClientRect` aren't own properties. See:
|
|
3237
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#Notes
|
|
3238
|
-
return {
|
|
3239
|
-
top: clientRect.top,
|
|
3240
|
-
right: clientRect.right,
|
|
3241
|
-
bottom: clientRect.bottom,
|
|
3242
|
-
left: clientRect.left,
|
|
3243
|
-
width: clientRect.width,
|
|
3244
|
-
height: clientRect.height
|
|
3245
|
-
};
|
|
3246
|
-
}
|
|
3247
3438
|
/**
|
|
3248
3439
|
* Increments the vertical scroll position of a node.
|
|
3249
3440
|
* @param {?} node Node whose scroll position should change.
|
|
@@ -4201,6 +4392,8 @@ if (false) {
|
|
|
4201
4392
|
DragDropConfig.prototype.listAutoScrollDisabled;
|
|
4202
4393
|
/** @type {?|undefined} */
|
|
4203
4394
|
DragDropConfig.prototype.listOrientation;
|
|
4395
|
+
/** @type {?|undefined} */
|
|
4396
|
+
DragDropConfig.prototype.zIndex;
|
|
4204
4397
|
}
|
|
4205
4398
|
/**
|
|
4206
4399
|
* @deprecated No longer being used. To be removed.
|
|
@@ -4304,7 +4497,8 @@ class CdkDrag {
|
|
|
4304
4497
|
dragStartThreshold: config && config.dragStartThreshold != null ?
|
|
4305
4498
|
config.dragStartThreshold : 5,
|
|
4306
4499
|
pointerDirectionChangeThreshold: config && config.pointerDirectionChangeThreshold != null ?
|
|
4307
|
-
config.pointerDirectionChangeThreshold : 5
|
|
4500
|
+
config.pointerDirectionChangeThreshold : 5,
|
|
4501
|
+
zIndex: config === null || config === void 0 ? void 0 : config.zIndex
|
|
4308
4502
|
});
|
|
4309
4503
|
this._dragRef.data = this;
|
|
4310
4504
|
if (config) {
|
|
@@ -5051,23 +5245,6 @@ class CdkDropList {
|
|
|
5051
5245
|
// the user in a disabled state, so we also need to sync it as it's being set.
|
|
5052
5246
|
this._dropListRef.disabled = this._disabled = coerceBooleanProperty(value);
|
|
5053
5247
|
}
|
|
5054
|
-
/**
|
|
5055
|
-
* @return {?}
|
|
5056
|
-
*/
|
|
5057
|
-
ngAfterContentInit() {
|
|
5058
|
-
// @breaking-change 11.0.0 Remove null check for _scrollDispatcher once it's required.
|
|
5059
|
-
if (this._scrollDispatcher) {
|
|
5060
|
-
/** @type {?} */
|
|
5061
|
-
const scrollableParents = this._scrollDispatcher
|
|
5062
|
-
.getAncestorScrollContainers(this.element)
|
|
5063
|
-
.map((/**
|
|
5064
|
-
* @param {?} scrollable
|
|
5065
|
-
* @return {?}
|
|
5066
|
-
*/
|
|
5067
|
-
scrollable => scrollable.getElementRef().nativeElement));
|
|
5068
|
-
this._dropListRef.withScrollableParents(scrollableParents);
|
|
5069
|
-
}
|
|
5070
|
-
}
|
|
5071
5248
|
/**
|
|
5072
5249
|
* Registers an items with the drop list.
|
|
5073
5250
|
* @param {?} item
|
|
@@ -5226,6 +5403,23 @@ class CdkDropList {
|
|
|
5226
5403
|
}
|
|
5227
5404
|
}));
|
|
5228
5405
|
}
|
|
5406
|
+
// Note that we resolve the scrollable parents here so that we delay the resolution
|
|
5407
|
+
// as long as possible, ensuring that the element is in its final place in the DOM.
|
|
5408
|
+
// @breaking-change 11.0.0 Remove null check for _scrollDispatcher once it's required.
|
|
5409
|
+
if (!this._scrollableParentsResolved && this._scrollDispatcher) {
|
|
5410
|
+
/** @type {?} */
|
|
5411
|
+
const scrollableParents = this._scrollDispatcher
|
|
5412
|
+
.getAncestorScrollContainers(this.element)
|
|
5413
|
+
.map((/**
|
|
5414
|
+
* @param {?} scrollable
|
|
5415
|
+
* @return {?}
|
|
5416
|
+
*/
|
|
5417
|
+
scrollable => scrollable.getElementRef().nativeElement));
|
|
5418
|
+
this._dropListRef.withScrollableParents(scrollableParents);
|
|
5419
|
+
// Only do this once since it involves traversing the DOM and the parents
|
|
5420
|
+
// shouldn't be able to change without the drop list being destroyed.
|
|
5421
|
+
this._scrollableParentsResolved = true;
|
|
5422
|
+
}
|
|
5229
5423
|
ref.disabled = this.disabled;
|
|
5230
5424
|
ref.lockAxis = this.lockAxis;
|
|
5231
5425
|
ref.sortingDisabled = coerceBooleanProperty(this.sortingDisabled);
|
|
@@ -5405,6 +5599,12 @@ if (false) {
|
|
|
5405
5599
|
* @private
|
|
5406
5600
|
*/
|
|
5407
5601
|
CdkDropList.prototype._destroyed;
|
|
5602
|
+
/**
|
|
5603
|
+
* Whether the element's scrollable parents have been resolved.
|
|
5604
|
+
* @type {?}
|
|
5605
|
+
* @private
|
|
5606
|
+
*/
|
|
5607
|
+
CdkDropList.prototype._scrollableParentsResolved;
|
|
5408
5608
|
/**
|
|
5409
5609
|
* Reference to the underlying drop list instance.
|
|
5410
5610
|
* @type {?}
|
|
@@ -5537,6 +5737,7 @@ DragDropModule.decorators = [
|
|
|
5537
5737
|
CdkDragPlaceholder,
|
|
5538
5738
|
],
|
|
5539
5739
|
exports: [
|
|
5740
|
+
CdkScrollableModule,
|
|
5540
5741
|
CdkDropList,
|
|
5541
5742
|
CdkDropListGroup,
|
|
5542
5743
|
CdkDrag,
|