@angular/cdk 9.1.2 → 9.2.1
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 +42 -2
- package/a11y/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +107 -75
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +7 -7
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-clipboard.umd.js +1 -1
- package/bundles/cdk-clipboard.umd.js.map +1 -1
- package/bundles/cdk-clipboard.umd.min.js +1 -1
- package/bundles/cdk-clipboard.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 +121 -95
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +15 -8
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +2 -1
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +4 -4
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +11 -0
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +6 -6
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +41 -10
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +8 -8
- 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 +15 -9
- 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-text-field.umd.js +21 -6
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +3 -3
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +8 -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 +4 -0
- package/drag-drop/index.metadata.json +1 -1
- package/esm2015/a11y/focus-monitor/focus-monitor.js +163 -76
- 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 +8 -4
- package/esm2015/a11y/live-announcer/live-announcer.js +1 -1
- package/esm2015/a11y/public-api.js +2 -2
- package/esm2015/bidi/directionality.js +1 -1
- package/esm2015/clipboard/pending-copy.js +3 -3
- 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.js +1 -1
- package/esm2015/drag-drop/drag-ref.js +61 -25
- package/esm2015/drag-drop/drop-list-ref.js +15 -82
- package/esm2015/layout/breakpoints-observer.js +1 -1
- package/esm2015/overlay/position/flexible-connected-position-strategy.js +3 -2
- package/esm2015/overlay/position/overlay-position-builder.js +1 -1
- package/esm2015/platform/features/shadow-dom.js +16 -1
- package/esm2015/platform/public-api.js +2 -2
- package/esm2015/scrolling/scroll-dispatcher.js +38 -5
- package/esm2015/scrolling/viewport-ruler.js +44 -5
- 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/testbed-harness-environment.js +16 -10
- package/esm2015/text-field/autosize.js +38 -4
- package/esm2015/tree/padding.js +9 -10
- package/esm2015/version.js +1 -1
- package/esm5/a11y/focus-monitor/focus-monitor.js +87 -56
- package/esm5/a11y/focus-trap/configurable-focus-trap-factory.js +3 -3
- package/esm5/a11y/focus-trap/focus-trap.js +1 -1
- package/esm5/a11y/high-contrast-mode/high-contrast-mode-detector.js +7 -4
- package/esm5/a11y/live-announcer/live-announcer.js +1 -1
- package/esm5/bidi/directionality.js +1 -1
- package/esm5/clipboard/pending-copy.js +2 -2
- 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.js +1 -1
- package/esm5/drag-drop/drag-ref.js +39 -21
- package/esm5/drag-drop/drop-list-ref.js +13 -67
- package/esm5/layout/breakpoints-observer.js +1 -1
- package/esm5/overlay/position/flexible-connected-position-strategy.js +3 -2
- package/esm5/overlay/position/overlay-position-builder.js +1 -1
- package/esm5/platform/features/shadow-dom.js +11 -1
- package/esm5/scrolling/scroll-dispatcher.js +21 -5
- package/esm5/scrolling/viewport-ruler.js +24 -5
- 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/testbed-harness-environment.js +17 -11
- package/esm5/text-field/autosize.js +20 -4
- package/esm5/tree/padding.js +9 -5
- package/esm5/version.js +1 -1
- package/fesm2015/a11y.js +190 -103
- package/fesm2015/a11y.js.map +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/clipboard.js +2 -2
- package/fesm2015/clipboard.js.map +1 -1
- package/fesm2015/coercion.js +0 -1
- package/fesm2015/coercion.js.map +1 -1
- package/fesm2015/drag-drop.js +174 -123
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js +2 -1
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/platform.js +16 -1
- package/fesm2015/platform.js.map +1 -1
- package/fesm2015/scrolling.js +76 -7
- 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 +15 -9
- package/fesm2015/testing/testbed.js.map +1 -1
- package/fesm2015/text-field.js +37 -3
- package/fesm2015/text-field.js.map +1 -1
- package/fesm2015/tree.js +8 -9
- package/fesm2015/tree.js.map +1 -1
- package/fesm5/a11y.js +107 -76
- package/fesm5/a11y.js.map +1 -1
- package/fesm5/cdk.js +1 -1
- package/fesm5/cdk.js.map +1 -1
- package/fesm5/clipboard.js +1 -1
- package/fesm5/clipboard.js.map +1 -1
- package/fesm5/coercion.js +0 -1
- package/fesm5/coercion.js.map +1 -1
- package/fesm5/drag-drop.js +122 -96
- package/fesm5/drag-drop.js.map +1 -1
- package/fesm5/overlay.js +2 -1
- package/fesm5/overlay.js.map +1 -1
- package/fesm5/platform.js +11 -1
- package/fesm5/platform.js.map +1 -1
- package/fesm5/scrolling.js +39 -7
- 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 +16 -10
- package/fesm5/testing/testbed.js.map +1 -1
- package/fesm5/text-field.js +19 -3
- package/fesm5/text-field.js.map +1 -1
- package/fesm5/tree.js +8 -4
- package/fesm5/tree.js.map +1 -1
- package/package.json +1 -1
- package/platform/features/shadow-dom.d.ts +2 -0
- package/platform/index.metadata.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-update/upgrade-rules/class-names-rule.js +3 -1
- package/schematics/utils/ast/ng-module-imports.js +3 -2
- package/scrolling/index.metadata.json +1 -1
- package/scrolling/scroll-dispatcher.d.ts +9 -1
- package/scrolling/viewport-ruler.d.ts +9 -1
- 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/testbed-harness-environment.d.ts +12 -4
- package/text-field/autosize.d.ts +9 -1
- package/text-field/index.metadata.json +1 -1
- package/tree/index.metadata.json +1 -1
- package/tree/padding.d.ts +6 -2
|
@@ -78,6 +78,66 @@
|
|
|
78
78
|
return value.split(',').map(function (part) { return part.trim(); });
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* @license
|
|
83
|
+
* Copyright Google LLC All Rights Reserved.
|
|
84
|
+
*
|
|
85
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
86
|
+
* found in the LICENSE file at https://angular.io/license
|
|
87
|
+
*/
|
|
88
|
+
/** Gets a mutable version of an element's bounding `ClientRect`. */
|
|
89
|
+
function getMutableClientRect(element) {
|
|
90
|
+
var clientRect = element.getBoundingClientRect();
|
|
91
|
+
// We need to clone the `clientRect` here, because all the values on it are readonly
|
|
92
|
+
// and we need to be able to update them. Also we can't use a spread here, because
|
|
93
|
+
// the values on a `ClientRect` aren't own properties. See:
|
|
94
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#Notes
|
|
95
|
+
return {
|
|
96
|
+
top: clientRect.top,
|
|
97
|
+
right: clientRect.right,
|
|
98
|
+
bottom: clientRect.bottom,
|
|
99
|
+
left: clientRect.left,
|
|
100
|
+
width: clientRect.width,
|
|
101
|
+
height: clientRect.height
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Checks whether some coordinates are within a `ClientRect`.
|
|
106
|
+
* @param clientRect ClientRect that is being checked.
|
|
107
|
+
* @param x Coordinates along the X axis.
|
|
108
|
+
* @param y Coordinates along the Y axis.
|
|
109
|
+
*/
|
|
110
|
+
function isInsideClientRect(clientRect, x, y) {
|
|
111
|
+
var top = clientRect.top, bottom = clientRect.bottom, left = clientRect.left, right = clientRect.right;
|
|
112
|
+
return y >= top && y <= bottom && x >= left && x <= right;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Updates the top/left positions of a `ClientRect`, as well as their bottom/right counterparts.
|
|
116
|
+
* @param clientRect `ClientRect` that should be updated.
|
|
117
|
+
* @param top Amount to add to the `top` position.
|
|
118
|
+
* @param left Amount to add to the `left` position.
|
|
119
|
+
*/
|
|
120
|
+
function adjustClientRect(clientRect, top, left) {
|
|
121
|
+
clientRect.top += top;
|
|
122
|
+
clientRect.bottom = clientRect.top + clientRect.height;
|
|
123
|
+
clientRect.left += left;
|
|
124
|
+
clientRect.right = clientRect.left + clientRect.width;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Checks whether the pointer coordinates are close to a ClientRect.
|
|
128
|
+
* @param rect ClientRect to check against.
|
|
129
|
+
* @param threshold Threshold around the ClientRect.
|
|
130
|
+
* @param pointerX Coordinates along the X axis.
|
|
131
|
+
* @param pointerY Coordinates along the Y axis.
|
|
132
|
+
*/
|
|
133
|
+
function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
|
|
134
|
+
var top = rect.top, right = rect.right, bottom = rect.bottom, left = rect.left, width = rect.width, height = rect.height;
|
|
135
|
+
var xThreshold = width * threshold;
|
|
136
|
+
var yThreshold = height * threshold;
|
|
137
|
+
return pointerY > top - yThreshold && pointerY < bottom + yThreshold &&
|
|
138
|
+
pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
139
|
+
}
|
|
140
|
+
|
|
81
141
|
/**
|
|
82
142
|
* @license
|
|
83
143
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -183,8 +243,8 @@
|
|
|
183
243
|
// Prevent the default action as early as possible in order to block
|
|
184
244
|
// native actions like dragging the selected text or images with the mouse.
|
|
185
245
|
event.preventDefault();
|
|
246
|
+
var pointerPosition = _this._getPointerPositionOnPage(event);
|
|
186
247
|
if (!_this._hasStartedDragging) {
|
|
187
|
-
var pointerPosition = _this._getPointerPositionOnPage(event);
|
|
188
248
|
var distanceX = Math.abs(pointerPosition.x - _this._pickupPositionOnPage.x);
|
|
189
249
|
var distanceY = Math.abs(pointerPosition.y - _this._pickupPositionOnPage.y);
|
|
190
250
|
var isOverThreshold = distanceX + distanceY >= _this._config.dragStartThreshold;
|
|
@@ -216,7 +276,7 @@
|
|
|
216
276
|
_this._previewRect = (_this._preview || _this._rootElement).getBoundingClientRect();
|
|
217
277
|
}
|
|
218
278
|
}
|
|
219
|
-
var constrainedPointerPosition = _this._getConstrainedPointerPosition(
|
|
279
|
+
var constrainedPointerPosition = _this._getConstrainedPointerPosition(pointerPosition);
|
|
220
280
|
_this._hasMoved = true;
|
|
221
281
|
_this._updatePointerDirectionDelta(constrainedPointerPosition);
|
|
222
282
|
if (_this._dropContainer) {
|
|
@@ -319,13 +379,16 @@
|
|
|
319
379
|
* dragging on an element that you might not have access to.
|
|
320
380
|
*/
|
|
321
381
|
DragRef.prototype.withRootElement = function (rootElement) {
|
|
382
|
+
var _this = this;
|
|
322
383
|
var element = coercion.coerceElement(rootElement);
|
|
323
384
|
if (element !== this._rootElement) {
|
|
324
385
|
if (this._rootElement) {
|
|
325
386
|
this._removeRootElementListeners(this._rootElement);
|
|
326
387
|
}
|
|
327
|
-
|
|
328
|
-
|
|
388
|
+
this._ngZone.runOutsideAngular(function () {
|
|
389
|
+
element.addEventListener('mousedown', _this._pointerDown, activeEventListenerOptions);
|
|
390
|
+
element.addEventListener('touchstart', _this._pointerDown, passiveEventListenerOptions);
|
|
391
|
+
});
|
|
329
392
|
this._initialTransform = undefined;
|
|
330
393
|
this._rootElement = element;
|
|
331
394
|
}
|
|
@@ -434,7 +497,7 @@
|
|
|
434
497
|
DragRef.prototype._sortFromLastPointerPosition = function () {
|
|
435
498
|
var position = this._pointerPositionAtLastDirectionChange;
|
|
436
499
|
if (position && this._dropContainer) {
|
|
437
|
-
this._updateActiveDropContainer(position);
|
|
500
|
+
this._updateActiveDropContainer(this._getConstrainedPointerPosition(position));
|
|
438
501
|
}
|
|
439
502
|
};
|
|
440
503
|
/** Unsubscribes from the global subscriptions. */
|
|
@@ -586,10 +649,10 @@
|
|
|
586
649
|
this._pointerMoveSubscription = this._dragDropRegistry.pointerMove.subscribe(this._pointerMove);
|
|
587
650
|
this._pointerUpSubscription = this._dragDropRegistry.pointerUp.subscribe(this._pointerUp);
|
|
588
651
|
this._scrollSubscription = this._dragDropRegistry.scroll.pipe(operators.startWith(null)).subscribe(function () {
|
|
589
|
-
_this.
|
|
652
|
+
_this._updateOnScroll();
|
|
590
653
|
});
|
|
591
654
|
if (this._boundaryElement) {
|
|
592
|
-
this._boundaryRect = this._boundaryElement
|
|
655
|
+
this._boundaryRect = getMutableClientRect(this._boundaryElement);
|
|
593
656
|
}
|
|
594
657
|
// If we have a custom preview we can't know ahead of time how large it'll be so we position
|
|
595
658
|
// it next to the cursor. The exception is when the consumer has opted into making the preview
|
|
@@ -661,10 +724,10 @@
|
|
|
661
724
|
_this._dropContainer.exit(_this);
|
|
662
725
|
// Notify the new container that the item has entered.
|
|
663
726
|
_this._dropContainer = newContainer;
|
|
664
|
-
_this._dropContainer.enter(_this, x, y,
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
727
|
+
_this._dropContainer.enter(_this, x, y, newContainer === _this._initialContainer &&
|
|
728
|
+
// If we're re-entering the initial container and sorting is disabled,
|
|
729
|
+
// put item the into its starting index to begin with.
|
|
730
|
+
newContainer.sortingDisabled ? _this._initialIndex : undefined);
|
|
668
731
|
_this.entered.next({
|
|
669
732
|
item: _this,
|
|
670
733
|
container: newContainer,
|
|
@@ -688,6 +751,7 @@
|
|
|
688
751
|
var preview;
|
|
689
752
|
if (previewTemplate) {
|
|
690
753
|
var viewRef = previewConfig.viewContainer.createEmbeddedView(previewTemplate, previewConfig.context);
|
|
754
|
+
viewRef.detectChanges();
|
|
691
755
|
preview = getRootNode(viewRef, this._document);
|
|
692
756
|
this._previewRef = viewRef;
|
|
693
757
|
if (previewConfig.matchSize) {
|
|
@@ -712,7 +776,7 @@
|
|
|
712
776
|
position: 'fixed',
|
|
713
777
|
top: '0',
|
|
714
778
|
left: '0',
|
|
715
|
-
zIndex:
|
|
779
|
+
zIndex: "" + (this._config.zIndex || 1000)
|
|
716
780
|
});
|
|
717
781
|
toggleNativeDragInteractions(preview, false);
|
|
718
782
|
preview.classList.add('cdk-drag-preview');
|
|
@@ -774,6 +838,7 @@
|
|
|
774
838
|
var placeholder;
|
|
775
839
|
if (placeholderTemplate) {
|
|
776
840
|
this._placeholderRef = placeholderConfig.viewContainer.createEmbeddedView(placeholderTemplate, placeholderConfig.context);
|
|
841
|
+
this._placeholderRef.detectChanges();
|
|
777
842
|
placeholder = getRootNode(this._placeholderRef, this._document);
|
|
778
843
|
}
|
|
779
844
|
else {
|
|
@@ -809,8 +874,7 @@
|
|
|
809
874
|
};
|
|
810
875
|
};
|
|
811
876
|
/** Gets the pointer position on the page, accounting for any position constraints. */
|
|
812
|
-
DragRef.prototype._getConstrainedPointerPosition = function (
|
|
813
|
-
var point = this._getPointerPositionOnPage(event);
|
|
877
|
+
DragRef.prototype._getConstrainedPointerPosition = function (point) {
|
|
814
878
|
var constrainedPoint = this.constrainPosition ? this.constrainPosition(point, this) : point;
|
|
815
879
|
var dropContainerLock = this._dropContainer ? this._dropContainer.lockAxis : null;
|
|
816
880
|
if (this.lockAxis === 'x' || dropContainerLock === 'x') {
|
|
@@ -965,6 +1029,19 @@
|
|
|
965
1029
|
}
|
|
966
1030
|
return value ? value.mouse : 0;
|
|
967
1031
|
};
|
|
1032
|
+
/** Updates the internal state of the draggable element when scrolling has occurred. */
|
|
1033
|
+
DragRef.prototype._updateOnScroll = function () {
|
|
1034
|
+
var oldScrollPosition = this._scrollPosition;
|
|
1035
|
+
var currentScrollPosition = this._viewportRuler.getViewportScrollPosition();
|
|
1036
|
+
// ClientRect dimensions are based on the page's scroll position so
|
|
1037
|
+
// we have to update the cached boundary ClientRect if the user has scrolled.
|
|
1038
|
+
if (oldScrollPosition && this._boundaryRect) {
|
|
1039
|
+
var topDifference = oldScrollPosition.top - currentScrollPosition.top;
|
|
1040
|
+
var leftDifference = oldScrollPosition.left - currentScrollPosition.left;
|
|
1041
|
+
adjustClientRect(this._boundaryRect, topDifference, leftDifference);
|
|
1042
|
+
}
|
|
1043
|
+
this._scrollPosition = currentScrollPosition;
|
|
1044
|
+
};
|
|
968
1045
|
return DragRef;
|
|
969
1046
|
}());
|
|
970
1047
|
/**
|
|
@@ -1036,13 +1113,13 @@
|
|
|
1036
1113
|
* If the root is not an HTML element it gets wrapped in one.
|
|
1037
1114
|
*/
|
|
1038
1115
|
function getRootNode(viewRef, _document) {
|
|
1039
|
-
var
|
|
1040
|
-
if (
|
|
1041
|
-
|
|
1042
|
-
wrapper.appendChild(rootNode);
|
|
1043
|
-
return wrapper;
|
|
1116
|
+
var rootNodes = viewRef.rootNodes;
|
|
1117
|
+
if (rootNodes.length === 1 && rootNodes[0].nodeType === _document.ELEMENT_NODE) {
|
|
1118
|
+
return rootNodes[0];
|
|
1044
1119
|
}
|
|
1045
|
-
|
|
1120
|
+
var wrapper = _document.createElement('div');
|
|
1121
|
+
rootNodes.forEach(function (node) { return wrapper.appendChild(node); });
|
|
1122
|
+
return wrapper;
|
|
1046
1123
|
}
|
|
1047
1124
|
/**
|
|
1048
1125
|
* Matches the target element's size to the source's size.
|
|
@@ -1633,7 +1710,8 @@
|
|
|
1633
1710
|
*/
|
|
1634
1711
|
DropListRef.prototype._sortItem = function (item, pointerX, pointerY, pointerDelta) {
|
|
1635
1712
|
// Don't sort the item if sorting is disabled or it's out of range.
|
|
1636
|
-
if (this.sortingDisabled ||
|
|
1713
|
+
if (this.sortingDisabled ||
|
|
1714
|
+
!isPointerNearClientRect(this._clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
1637
1715
|
return;
|
|
1638
1716
|
}
|
|
1639
1717
|
var siblings = this._itemPositions;
|
|
@@ -1713,7 +1791,7 @@
|
|
|
1713
1791
|
if (element === _this._document || !position.clientRect || scrollNode) {
|
|
1714
1792
|
return;
|
|
1715
1793
|
}
|
|
1716
|
-
if (isPointerNearClientRect(position.clientRect, pointerX, pointerY)) {
|
|
1794
|
+
if (isPointerNearClientRect(position.clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
1717
1795
|
_a = __read(getElementScrollDirections(element, position.clientRect, pointerX, pointerY), 2), verticalScrollDirection = _a[0], horizontalScrollDirection = _a[1];
|
|
1718
1796
|
if (verticalScrollDirection || horizontalScrollDirection) {
|
|
1719
1797
|
scrollNode = element;
|
|
@@ -1885,13 +1963,17 @@
|
|
|
1885
1963
|
*/
|
|
1886
1964
|
DropListRef.prototype._updateAfterScroll = function (scrolledParent, newTop, newLeft) {
|
|
1887
1965
|
var _this = this;
|
|
1966
|
+
// Used when figuring out whether an element is inside the scroll parent. If the scrolled
|
|
1967
|
+
// parent is the `document`, we use the `documentElement`, because IE doesn't support `contains`
|
|
1968
|
+
// on the `document`.
|
|
1969
|
+
var scrolledParentNode = scrolledParent === this._document ? scrolledParent.documentElement : scrolledParent;
|
|
1888
1970
|
var scrollPosition = this._parentPositions.get(scrolledParent).scrollPosition;
|
|
1889
1971
|
var topDifference = scrollPosition.top - newTop;
|
|
1890
1972
|
var leftDifference = scrollPosition.left - newLeft;
|
|
1891
1973
|
// Go through and update the cached positions of the scroll
|
|
1892
1974
|
// parents that are inside the element that was scrolled.
|
|
1893
1975
|
this._parentPositions.forEach(function (position, node) {
|
|
1894
|
-
if (position.clientRect && scrolledParent !== node &&
|
|
1976
|
+
if (position.clientRect && scrolledParent !== node && scrolledParentNode.contains(node)) {
|
|
1895
1977
|
adjustClientRect(position.clientRect, topDifference, leftDifference);
|
|
1896
1978
|
}
|
|
1897
1979
|
});
|
|
@@ -2016,37 +2098,13 @@
|
|
|
2016
2098
|
*/
|
|
2017
2099
|
DropListRef.prototype._getShadowRoot = function () {
|
|
2018
2100
|
if (!this._cachedShadowRoot) {
|
|
2019
|
-
|
|
2101
|
+
var shadowRoot = platform._getShadowRoot(coercion.coerceElement(this.element));
|
|
2102
|
+
this._cachedShadowRoot = shadowRoot || this._document;
|
|
2020
2103
|
}
|
|
2021
2104
|
return this._cachedShadowRoot;
|
|
2022
2105
|
};
|
|
2023
2106
|
return DropListRef;
|
|
2024
2107
|
}());
|
|
2025
|
-
/**
|
|
2026
|
-
* Updates the top/left positions of a `ClientRect`, as well as their bottom/right counterparts.
|
|
2027
|
-
* @param clientRect `ClientRect` that should be updated.
|
|
2028
|
-
* @param top Amount to add to the `top` position.
|
|
2029
|
-
* @param left Amount to add to the `left` position.
|
|
2030
|
-
*/
|
|
2031
|
-
function adjustClientRect(clientRect, top, left) {
|
|
2032
|
-
clientRect.top += top;
|
|
2033
|
-
clientRect.bottom = clientRect.top + clientRect.height;
|
|
2034
|
-
clientRect.left += left;
|
|
2035
|
-
clientRect.right = clientRect.left + clientRect.width;
|
|
2036
|
-
}
|
|
2037
|
-
/**
|
|
2038
|
-
* Checks whether the pointer coordinates are close to a ClientRect.
|
|
2039
|
-
* @param rect ClientRect to check against.
|
|
2040
|
-
* @param pointerX Coordinates along the X axis.
|
|
2041
|
-
* @param pointerY Coordinates along the Y axis.
|
|
2042
|
-
*/
|
|
2043
|
-
function isPointerNearClientRect(rect, pointerX, pointerY) {
|
|
2044
|
-
var top = rect.top, right = rect.right, bottom = rect.bottom, left = rect.left, width = rect.width, height = rect.height;
|
|
2045
|
-
var xThreshold = width * DROP_PROXIMITY_THRESHOLD;
|
|
2046
|
-
var yThreshold = height * DROP_PROXIMITY_THRESHOLD;
|
|
2047
|
-
return pointerY > top - yThreshold && pointerY < bottom + yThreshold &&
|
|
2048
|
-
pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
2049
|
-
}
|
|
2050
2108
|
/**
|
|
2051
2109
|
* Finds the index of an item that matches a predicate function. Used as an equivalent
|
|
2052
2110
|
* of `Array.prototype.findIndex` which isn't part of the standard Google typings.
|
|
@@ -2061,32 +2119,6 @@
|
|
|
2061
2119
|
}
|
|
2062
2120
|
return -1;
|
|
2063
2121
|
}
|
|
2064
|
-
/**
|
|
2065
|
-
* Checks whether some coordinates are within a `ClientRect`.
|
|
2066
|
-
* @param clientRect ClientRect that is being checked.
|
|
2067
|
-
* @param x Coordinates along the X axis.
|
|
2068
|
-
* @param y Coordinates along the Y axis.
|
|
2069
|
-
*/
|
|
2070
|
-
function isInsideClientRect(clientRect, x, y) {
|
|
2071
|
-
var top = clientRect.top, bottom = clientRect.bottom, left = clientRect.left, right = clientRect.right;
|
|
2072
|
-
return y >= top && y <= bottom && x >= left && x <= right;
|
|
2073
|
-
}
|
|
2074
|
-
/** Gets a mutable version of an element's bounding `ClientRect`. */
|
|
2075
|
-
function getMutableClientRect(element) {
|
|
2076
|
-
var clientRect = element.getBoundingClientRect();
|
|
2077
|
-
// We need to clone the `clientRect` here, because all the values on it are readonly
|
|
2078
|
-
// and we need to be able to update them. Also we can't use a spread here, because
|
|
2079
|
-
// the values on a `ClientRect` aren't own properties. See:
|
|
2080
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#Notes
|
|
2081
|
-
return {
|
|
2082
|
-
top: clientRect.top,
|
|
2083
|
-
right: clientRect.right,
|
|
2084
|
-
bottom: clientRect.bottom,
|
|
2085
|
-
left: clientRect.left,
|
|
2086
|
-
width: clientRect.width,
|
|
2087
|
-
height: clientRect.height
|
|
2088
|
-
};
|
|
2089
|
-
}
|
|
2090
2122
|
/**
|
|
2091
2123
|
* Increments the vertical scroll position of a node.
|
|
2092
2124
|
* @param node Node whose scroll position should change.
|
|
@@ -2188,16 +2220,6 @@
|
|
|
2188
2220
|
}
|
|
2189
2221
|
return [verticalScrollDirection, horizontalScrollDirection];
|
|
2190
2222
|
}
|
|
2191
|
-
/** Gets the shadow root of an element, if any. */
|
|
2192
|
-
function getShadowRoot(element) {
|
|
2193
|
-
if (platform._supportsShadowDom()) {
|
|
2194
|
-
var rootNode = element.getRootNode ? element.getRootNode() : null;
|
|
2195
|
-
if (rootNode instanceof ShadowRoot) {
|
|
2196
|
-
return rootNode;
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
return null;
|
|
2200
|
-
}
|
|
2201
2223
|
|
|
2202
2224
|
/**
|
|
2203
2225
|
* @license
|
|
@@ -2641,7 +2663,8 @@
|
|
|
2641
2663
|
dragStartThreshold: config && config.dragStartThreshold != null ?
|
|
2642
2664
|
config.dragStartThreshold : 5,
|
|
2643
2665
|
pointerDirectionChangeThreshold: config && config.pointerDirectionChangeThreshold != null ?
|
|
2644
|
-
config.pointerDirectionChangeThreshold : 5
|
|
2666
|
+
config.pointerDirectionChangeThreshold : 5,
|
|
2667
|
+
zIndex: config === null || config === void 0 ? void 0 : config.zIndex
|
|
2645
2668
|
});
|
|
2646
2669
|
this._dragRef.data = this;
|
|
2647
2670
|
if (config) {
|
|
@@ -3073,15 +3096,6 @@
|
|
|
3073
3096
|
enumerable: true,
|
|
3074
3097
|
configurable: true
|
|
3075
3098
|
});
|
|
3076
|
-
CdkDropList.prototype.ngAfterContentInit = function () {
|
|
3077
|
-
// @breaking-change 11.0.0 Remove null check for _scrollDispatcher once it's required.
|
|
3078
|
-
if (this._scrollDispatcher) {
|
|
3079
|
-
var scrollableParents = this._scrollDispatcher
|
|
3080
|
-
.getAncestorScrollContainers(this.element)
|
|
3081
|
-
.map(function (scrollable) { return scrollable.getElementRef().nativeElement; });
|
|
3082
|
-
this._dropListRef.withScrollableParents(scrollableParents);
|
|
3083
|
-
}
|
|
3084
|
-
};
|
|
3085
3099
|
/** Registers an items with the drop list. */
|
|
3086
3100
|
CdkDropList.prototype.addItem = function (item) {
|
|
3087
3101
|
this._unsortedItems.add(item);
|
|
@@ -3190,6 +3204,18 @@
|
|
|
3190
3204
|
}
|
|
3191
3205
|
});
|
|
3192
3206
|
}
|
|
3207
|
+
// Note that we resolve the scrollable parents here so that we delay the resolution
|
|
3208
|
+
// as long as possible, ensuring that the element is in its final place in the DOM.
|
|
3209
|
+
// @breaking-change 11.0.0 Remove null check for _scrollDispatcher once it's required.
|
|
3210
|
+
if (!_this._scrollableParentsResolved && _this._scrollDispatcher) {
|
|
3211
|
+
var scrollableParents = _this._scrollDispatcher
|
|
3212
|
+
.getAncestorScrollContainers(_this.element)
|
|
3213
|
+
.map(function (scrollable) { return scrollable.getElementRef().nativeElement; });
|
|
3214
|
+
_this._dropListRef.withScrollableParents(scrollableParents);
|
|
3215
|
+
// Only do this once since it involves traversing the DOM and the parents
|
|
3216
|
+
// shouldn't be able to change without the drop list being destroyed.
|
|
3217
|
+
_this._scrollableParentsResolved = true;
|
|
3218
|
+
}
|
|
3193
3219
|
ref.disabled = _this.disabled;
|
|
3194
3220
|
ref.lockAxis = _this.lockAxis;
|
|
3195
3221
|
ref.sortingDisabled = coercion.coerceBooleanProperty(_this.sortingDisabled);
|