@angular/cdk 14.0.1 → 14.1.0-next.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/index.d.ts +3 -1
- package/collections/index.d.ts +3 -1
- package/drag-drop/index.d.ts +12 -58
- package/esm2020/a11y/a11y-module.mjs +5 -5
- package/esm2020/a11y/aria-describer/aria-describer.mjs +4 -4
- package/esm2020/a11y/focus-monitor/focus-monitor.mjs +7 -7
- package/esm2020/a11y/focus-trap/configurable-focus-trap-factory.mjs +4 -4
- package/esm2020/a11y/focus-trap/focus-trap-manager.mjs +4 -4
- package/esm2020/a11y/focus-trap/focus-trap.mjs +7 -7
- package/esm2020/a11y/high-contrast-mode/high-contrast-mode-detector.mjs +17 -5
- package/esm2020/a11y/input-modality/input-modality-detector.mjs +4 -4
- package/esm2020/a11y/interactivity-checker/interactivity-checker.mjs +4 -4
- package/esm2020/a11y/live-announcer/live-announcer.mjs +7 -7
- package/esm2020/accordion/accordion-item.mjs +4 -4
- package/esm2020/accordion/accordion-module.mjs +5 -5
- package/esm2020/accordion/accordion.mjs +4 -4
- package/esm2020/bidi/bidi-module.mjs +5 -5
- package/esm2020/bidi/dir.mjs +4 -4
- package/esm2020/bidi/directionality.mjs +4 -4
- package/esm2020/clipboard/clipboard-module.mjs +5 -5
- package/esm2020/clipboard/clipboard.mjs +4 -4
- package/esm2020/clipboard/copy-to-clipboard.mjs +4 -4
- package/esm2020/collections/selection-model.mjs +24 -3
- package/esm2020/collections/unique-selection-dispatcher.mjs +4 -4
- package/esm2020/dialog/dialog-container.mjs +4 -4
- package/esm2020/dialog/dialog-module.mjs +5 -5
- package/esm2020/dialog/dialog.mjs +4 -4
- package/esm2020/drag-drop/directives/drag-handle.mjs +4 -4
- package/esm2020/drag-drop/directives/drag-placeholder.mjs +4 -4
- package/esm2020/drag-drop/directives/drag-preview.mjs +4 -4
- package/esm2020/drag-drop/directives/drag.mjs +4 -4
- package/esm2020/drag-drop/directives/drop-list-group.mjs +4 -4
- package/esm2020/drag-drop/directives/drop-list.mjs +4 -4
- package/esm2020/drag-drop/dom/client-rect.mjs +64 -0
- package/esm2020/drag-drop/dom/clone-node.mjs +65 -0
- package/esm2020/drag-drop/dom/parent-position-tracker.mjs +76 -0
- package/esm2020/drag-drop/dom/styling.mjs +69 -0
- package/esm2020/drag-drop/dom/transition-duration.mjs +36 -0
- package/esm2020/drag-drop/drag-drop-module.mjs +5 -5
- package/esm2020/drag-drop/drag-drop-registry.mjs +4 -4
- package/esm2020/drag-drop/drag-drop.mjs +4 -4
- package/esm2020/drag-drop/drag-ref.mjs +36 -22
- package/esm2020/drag-drop/drop-list-ref.mjs +36 -295
- package/esm2020/drag-drop/sorting/drop-list-sort-strategy.mjs +9 -0
- package/esm2020/drag-drop/sorting/single-axis-sort-strategy.mjs +341 -0
- package/esm2020/layout/breakpoints-observer.mjs +4 -4
- package/esm2020/layout/layout-module.mjs +5 -5
- package/esm2020/layout/media-matcher.mjs +4 -4
- package/esm2020/menu/context-menu-trigger.mjs +7 -7
- package/esm2020/menu/menu-aim.mjs +7 -7
- package/esm2020/menu/menu-bar.mjs +4 -4
- package/esm2020/menu/menu-base.mjs +4 -4
- package/esm2020/menu/menu-group.mjs +4 -4
- package/esm2020/menu/menu-item-checkbox.mjs +4 -4
- package/esm2020/menu/menu-item-radio.mjs +4 -4
- package/esm2020/menu/menu-item-selectable.mjs +4 -4
- package/esm2020/menu/menu-item.mjs +4 -4
- package/esm2020/menu/menu-module.mjs +5 -5
- package/esm2020/menu/menu-stack.mjs +4 -4
- package/esm2020/menu/menu-trigger-base.mjs +4 -4
- package/esm2020/menu/menu-trigger.mjs +4 -4
- package/esm2020/menu/menu.mjs +4 -4
- package/esm2020/observers/observe-content.mjs +14 -14
- package/esm2020/overlay/dispatchers/base-overlay-dispatcher.mjs +4 -4
- package/esm2020/overlay/dispatchers/overlay-keyboard-dispatcher.mjs +4 -4
- package/esm2020/overlay/dispatchers/overlay-outside-click-dispatcher.mjs +4 -4
- package/esm2020/overlay/fullscreen-overlay-container.mjs +4 -4
- package/esm2020/overlay/overlay-container.mjs +4 -4
- package/esm2020/overlay/overlay-directives.mjs +7 -7
- package/esm2020/overlay/overlay-module.mjs +5 -5
- package/esm2020/overlay/overlay.mjs +4 -4
- package/esm2020/overlay/position/overlay-position-builder.mjs +4 -4
- package/esm2020/overlay/scroll/scroll-strategy-options.mjs +4 -4
- package/esm2020/platform/platform-module.mjs +5 -5
- package/esm2020/platform/platform.mjs +4 -4
- package/esm2020/portal/portal-directives.mjs +17 -17
- package/esm2020/scrolling/fixed-size-virtual-scroll.mjs +4 -4
- package/esm2020/scrolling/public-api.mjs +4 -1
- package/esm2020/scrolling/scroll-dispatcher.mjs +4 -4
- package/esm2020/scrolling/scrollable.mjs +4 -4
- package/esm2020/scrolling/scrolling-module.mjs +27 -11
- package/esm2020/scrolling/viewport-ruler.mjs +4 -4
- package/esm2020/scrolling/virtual-for-of.mjs +4 -4
- package/esm2020/scrolling/virtual-scroll-viewport.mjs +72 -21
- package/esm2020/scrolling/virtual-scrollable-element.mjs +41 -0
- package/esm2020/scrolling/virtual-scrollable-window.mjs +40 -0
- package/esm2020/scrolling/virtual-scrollable.mjs +40 -0
- package/esm2020/stepper/step-header.mjs +4 -4
- package/esm2020/stepper/step-label.mjs +4 -4
- package/esm2020/stepper/stepper-button.mjs +7 -7
- package/esm2020/stepper/stepper-module.mjs +5 -5
- package/esm2020/stepper/stepper.mjs +7 -7
- package/esm2020/table/cell.mjs +22 -22
- package/esm2020/table/coalesced-style-scheduler.mjs +4 -4
- package/esm2020/table/row.mjs +28 -28
- package/esm2020/table/table-module.mjs +5 -5
- package/esm2020/table/table.mjs +19 -19
- package/esm2020/table/text-column.mjs +4 -4
- package/esm2020/testing/testbed/fake-events/dispatch-events.mjs +5 -5
- package/esm2020/testing/testbed/fake-events/event-objects.mjs +17 -6
- package/esm2020/testing/testbed/unit-test-element.mjs +17 -12
- package/esm2020/text-field/autofill.mjs +7 -7
- package/esm2020/text-field/autosize.mjs +4 -4
- package/esm2020/text-field/text-field-module.mjs +5 -5
- package/esm2020/tree/nested-node.mjs +4 -4
- package/esm2020/tree/node.mjs +4 -4
- package/esm2020/tree/outlet.mjs +4 -4
- package/esm2020/tree/padding.mjs +4 -4
- package/esm2020/tree/toggle.mjs +4 -4
- package/esm2020/tree/tree-module.mjs +5 -5
- package/esm2020/tree/tree.mjs +7 -7
- package/esm2020/version.mjs +1 -1
- package/fesm2015/a11y.mjs +59 -40
- package/fesm2015/a11y.mjs.map +1 -1
- package/fesm2015/accordion.mjs +10 -10
- package/fesm2015/accordion.mjs.map +1 -1
- package/fesm2015/bidi.mjs +10 -10
- package/fesm2015/bidi.mjs.map +1 -1
- package/fesm2015/cdk.mjs +1 -1
- package/fesm2015/cdk.mjs.map +1 -1
- package/fesm2015/clipboard.mjs +10 -10
- package/fesm2015/clipboard.mjs.map +1 -1
- package/fesm2015/collections.mjs +26 -5
- package/fesm2015/collections.mjs.map +1 -1
- package/fesm2015/dialog.mjs +10 -10
- package/fesm2015/dialog.mjs.map +1 -1
- package/fesm2015/drag-drop.mjs +552 -459
- package/fesm2015/drag-drop.mjs.map +1 -1
- package/fesm2015/layout.mjs +10 -10
- package/fesm2015/layout.mjs.map +1 -1
- package/fesm2015/menu.mjs +49 -49
- package/fesm2015/menu.mjs.map +1 -1
- package/fesm2015/observers.mjs +13 -13
- package/fesm2015/observers.mjs.map +1 -1
- package/fesm2015/overlay.mjs +34 -34
- package/fesm2015/overlay.mjs.map +1 -1
- package/fesm2015/platform.mjs +7 -7
- package/fesm2015/platform.mjs.map +1 -1
- package/fesm2015/portal.mjs +16 -16
- package/fesm2015/portal.mjs.map +1 -1
- package/fesm2015/scrolling.mjs +194 -47
- package/fesm2015/scrolling.mjs.map +1 -1
- package/fesm2015/stepper.mjs +22 -22
- package/fesm2015/stepper.mjs.map +1 -1
- package/fesm2015/table.mjs +76 -76
- package/fesm2015/table.mjs.map +1 -1
- package/fesm2015/testing/testbed.mjs +36 -20
- package/fesm2015/testing/testbed.mjs.map +1 -1
- package/fesm2015/text-field.mjs +13 -13
- package/fesm2015/text-field.mjs.map +1 -1
- package/fesm2015/tree.mjs +25 -25
- package/fesm2015/tree.mjs.map +1 -1
- package/fesm2020/a11y.mjs +52 -40
- package/fesm2020/a11y.mjs.map +1 -1
- package/fesm2020/accordion.mjs +10 -10
- package/fesm2020/accordion.mjs.map +1 -1
- package/fesm2020/bidi.mjs +10 -10
- package/fesm2020/bidi.mjs.map +1 -1
- package/fesm2020/cdk.mjs +1 -1
- package/fesm2020/cdk.mjs.map +1 -1
- package/fesm2020/clipboard.mjs +10 -10
- package/fesm2020/clipboard.mjs.map +1 -1
- package/fesm2020/collections.mjs +26 -5
- package/fesm2020/collections.mjs.map +1 -1
- package/fesm2020/dialog.mjs +10 -10
- package/fesm2020/dialog.mjs.map +1 -1
- package/fesm2020/drag-drop.mjs +552 -459
- package/fesm2020/drag-drop.mjs.map +1 -1
- package/fesm2020/layout.mjs +10 -10
- package/fesm2020/layout.mjs.map +1 -1
- package/fesm2020/menu.mjs +49 -49
- package/fesm2020/menu.mjs.map +1 -1
- package/fesm2020/observers.mjs +13 -13
- package/fesm2020/observers.mjs.map +1 -1
- package/fesm2020/overlay.mjs +34 -34
- package/fesm2020/overlay.mjs.map +1 -1
- package/fesm2020/platform.mjs +7 -7
- package/fesm2020/platform.mjs.map +1 -1
- package/fesm2020/portal.mjs +16 -16
- package/fesm2020/portal.mjs.map +1 -1
- package/fesm2020/scrolling.mjs +208 -47
- package/fesm2020/scrolling.mjs.map +1 -1
- package/fesm2020/stepper.mjs +22 -22
- package/fesm2020/stepper.mjs.map +1 -1
- package/fesm2020/table.mjs +76 -76
- package/fesm2020/table.mjs.map +1 -1
- package/fesm2020/testing/testbed.mjs +36 -20
- package/fesm2020/testing/testbed.mjs.map +1 -1
- package/fesm2020/text-field.mjs +13 -13
- package/fesm2020/text-field.mjs.map +1 -1
- package/fesm2020/tree.mjs +25 -25
- package/fesm2020/tree.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/scrolling/index.d.ts +71 -8
- package/esm2020/drag-drop/client-rect.mjs +0 -64
- package/esm2020/drag-drop/clone-node.mjs +0 -65
- package/esm2020/drag-drop/drag-styling.mjs +0 -69
- package/esm2020/drag-drop/parent-position-tracker.mjs +0 -76
- package/esm2020/drag-drop/transition-duration.mjs +0 -36
package/fesm2015/drag-drop.mjs
CHANGED
|
@@ -467,11 +467,12 @@ class DragRef {
|
|
|
467
467
|
this._updateActiveDropContainer(constrainedPointerPosition, pointerPosition);
|
|
468
468
|
}
|
|
469
469
|
else {
|
|
470
|
+
// If there's a position constraint function, we want the element's top/left to be at the
|
|
471
|
+
// specific position on the page. Use the initial position as a reference if that's the case.
|
|
472
|
+
const offset = this.constrainPosition ? this._initialClientRect : this._pickupPositionOnPage;
|
|
470
473
|
const activeTransform = this._activeTransform;
|
|
471
|
-
activeTransform.x =
|
|
472
|
-
|
|
473
|
-
activeTransform.y =
|
|
474
|
-
constrainedPointerPosition.y - this._pickupPositionOnPage.y + this._passiveTransform.y;
|
|
474
|
+
activeTransform.x = constrainedPointerPosition.x - offset.x + this._passiveTransform.x;
|
|
475
|
+
activeTransform.y = constrainedPointerPosition.y - offset.y + this._passiveTransform.y;
|
|
475
476
|
this._applyRootElementTransform(activeTransform.x, activeTransform.y);
|
|
476
477
|
}
|
|
477
478
|
// Since this event gets fired for every pixel while dragging, we only
|
|
@@ -889,6 +890,7 @@ class DragRef {
|
|
|
889
890
|
// Avoid multiple subscriptions and memory leaks when multi touch
|
|
890
891
|
// (isDragging check above isn't enough because of possible temporal and/or dimensional delays)
|
|
891
892
|
this._removeSubscriptions();
|
|
893
|
+
this._initialClientRect = this._rootElement.getBoundingClientRect();
|
|
892
894
|
this._pointerMoveSubscription = this._dragDropRegistry.pointerMove.subscribe(this._pointerMove);
|
|
893
895
|
this._pointerUpSubscription = this._dragDropRegistry.pointerUp.subscribe(this._pointerUp);
|
|
894
896
|
this._scrollSubscription = this._dragDropRegistry
|
|
@@ -904,7 +906,7 @@ class DragRef {
|
|
|
904
906
|
this._pickupPositionInElement =
|
|
905
907
|
previewTemplate && previewTemplate.template && !previewTemplate.matchSize
|
|
906
908
|
? { x: 0, y: 0 }
|
|
907
|
-
: this._getPointerPositionInElement(referenceElement, event);
|
|
909
|
+
: this._getPointerPositionInElement(this._initialClientRect, referenceElement, event);
|
|
908
910
|
const pointerPosition = (this._pickupPositionOnPage =
|
|
909
911
|
this._lastKnownPointerPosition =
|
|
910
912
|
this._getPointerPositionOnPage(event));
|
|
@@ -923,7 +925,11 @@ class DragRef {
|
|
|
923
925
|
this._anchor.parentNode.replaceChild(this._rootElement, this._anchor);
|
|
924
926
|
this._destroyPreview();
|
|
925
927
|
this._destroyPlaceholder();
|
|
926
|
-
this.
|
|
928
|
+
this._initialClientRect =
|
|
929
|
+
this._boundaryRect =
|
|
930
|
+
this._previewRect =
|
|
931
|
+
this._initialTransform =
|
|
932
|
+
undefined;
|
|
927
933
|
// Re-enter the NgZone since we bound `document` events on the outside.
|
|
928
934
|
this._ngZone.run(() => {
|
|
929
935
|
const container = this._dropContainer;
|
|
@@ -987,7 +993,12 @@ class DragRef {
|
|
|
987
993
|
if (this.isDragging()) {
|
|
988
994
|
this._dropContainer._startScrollingIfNecessary(rawX, rawY);
|
|
989
995
|
this._dropContainer._sortItem(this, x, y, this._pointerDirectionDelta);
|
|
990
|
-
|
|
996
|
+
if (this.constrainPosition) {
|
|
997
|
+
this._applyPreviewTransform(x, y);
|
|
998
|
+
}
|
|
999
|
+
else {
|
|
1000
|
+
this._applyPreviewTransform(x - this._pickupPositionInElement.x, y - this._pickupPositionInElement.y);
|
|
1001
|
+
}
|
|
991
1002
|
}
|
|
992
1003
|
}
|
|
993
1004
|
/**
|
|
@@ -1002,7 +1013,7 @@ class DragRef {
|
|
|
1002
1013
|
if (previewTemplate && previewConfig) {
|
|
1003
1014
|
// Measure the element before we've inserted the preview
|
|
1004
1015
|
// since the insertion could throw off the measurement.
|
|
1005
|
-
const rootRect = previewConfig.matchSize ? this.
|
|
1016
|
+
const rootRect = previewConfig.matchSize ? this._initialClientRect : null;
|
|
1006
1017
|
const viewRef = previewConfig.viewContainer.createEmbeddedView(previewTemplate, previewConfig.context);
|
|
1007
1018
|
viewRef.detectChanges();
|
|
1008
1019
|
preview = getRootNode(viewRef, this._document);
|
|
@@ -1015,9 +1026,8 @@ class DragRef {
|
|
|
1015
1026
|
}
|
|
1016
1027
|
}
|
|
1017
1028
|
else {
|
|
1018
|
-
|
|
1019
|
-
preview
|
|
1020
|
-
matchElementSize(preview, element.getBoundingClientRect());
|
|
1029
|
+
preview = deepCloneNode(this._rootElement);
|
|
1030
|
+
matchElementSize(preview, this._initialClientRect);
|
|
1021
1031
|
if (this._initialTransform) {
|
|
1022
1032
|
preview.style.transform = this._initialTransform;
|
|
1023
1033
|
}
|
|
@@ -1111,8 +1121,7 @@ class DragRef {
|
|
|
1111
1121
|
* @param referenceElement Element that initiated the dragging.
|
|
1112
1122
|
* @param event Event that initiated the dragging.
|
|
1113
1123
|
*/
|
|
1114
|
-
_getPointerPositionInElement(referenceElement, event) {
|
|
1115
|
-
const elementRect = this._rootElement.getBoundingClientRect();
|
|
1124
|
+
_getPointerPositionInElement(elementRect, referenceElement, event) {
|
|
1116
1125
|
const handleElement = referenceElement === this._rootElement ? null : referenceElement;
|
|
1117
1126
|
const referenceRect = handleElement ? handleElement.getBoundingClientRect() : elementRect;
|
|
1118
1127
|
const point = isTouchEvent(event) ? event.targetTouches[0] : event;
|
|
@@ -1155,7 +1164,9 @@ class DragRef {
|
|
|
1155
1164
|
/** Gets the pointer position on the page, accounting for any position constraints. */
|
|
1156
1165
|
_getConstrainedPointerPosition(point) {
|
|
1157
1166
|
const dropContainerLock = this._dropContainer ? this._dropContainer.lockAxis : null;
|
|
1158
|
-
let { x, y } = this.constrainPosition
|
|
1167
|
+
let { x, y } = this.constrainPosition
|
|
1168
|
+
? this.constrainPosition(point, this, this._initialClientRect)
|
|
1169
|
+
: point;
|
|
1159
1170
|
if (this.lockAxis === 'x' || dropContainerLock === 'x') {
|
|
1160
1171
|
y = this._pickupPositionOnPage.y;
|
|
1161
1172
|
}
|
|
@@ -1272,8 +1283,9 @@ class DragRef {
|
|
|
1272
1283
|
if ((x === 0 && y === 0) || this.isDragging() || !this._boundaryElement) {
|
|
1273
1284
|
return;
|
|
1274
1285
|
}
|
|
1275
|
-
|
|
1286
|
+
// Note: don't use `_clientRectAtStart` here, because we want the latest position.
|
|
1276
1287
|
const elementRect = this._rootElement.getBoundingClientRect();
|
|
1288
|
+
const boundaryRect = this._boundaryElement.getBoundingClientRect();
|
|
1277
1289
|
// It's possible that the element got hidden away after dragging (e.g. by switching to a
|
|
1278
1290
|
// different tab). Don't do anything in this case so we don't clear the user's position.
|
|
1279
1291
|
if ((boundaryRect.width === 0 && boundaryRect.height === 0) ||
|
|
@@ -1391,7 +1403,9 @@ class DragRef {
|
|
|
1391
1403
|
// Cache the preview element rect if we haven't cached it already or if
|
|
1392
1404
|
// we cached it too early before the element dimensions were computed.
|
|
1393
1405
|
if (!this._previewRect || (!this._previewRect.width && !this._previewRect.height)) {
|
|
1394
|
-
this._previewRect =
|
|
1406
|
+
this._previewRect = this._preview
|
|
1407
|
+
? this._preview.getBoundingClientRect()
|
|
1408
|
+
: this._initialClientRect;
|
|
1395
1409
|
}
|
|
1396
1410
|
return this._previewRect;
|
|
1397
1411
|
}
|
|
@@ -1515,140 +1529,99 @@ function clamp(value, max) {
|
|
|
1515
1529
|
* found in the LICENSE file at https://angular.io/license
|
|
1516
1530
|
*/
|
|
1517
1531
|
/**
|
|
1518
|
-
*
|
|
1519
|
-
*
|
|
1520
|
-
|
|
1521
|
-
const DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
1522
|
-
/**
|
|
1523
|
-
* Proximity, as a ratio to width/height at which to start auto-scrolling the drop list or the
|
|
1524
|
-
* viewport. The value comes from trying it out manually until it feels right.
|
|
1525
|
-
*/
|
|
1526
|
-
const SCROLL_PROXIMITY_THRESHOLD = 0.05;
|
|
1527
|
-
/**
|
|
1528
|
-
* Reference to a drop list. Used to manipulate or dispose of the container.
|
|
1532
|
+
* Strategy that only supports sorting along a single axis.
|
|
1533
|
+
* Items are reordered using CSS transforms which allows for sorting to be animated.
|
|
1534
|
+
* @docs-private
|
|
1529
1535
|
*/
|
|
1530
|
-
class
|
|
1531
|
-
constructor(
|
|
1536
|
+
class SingleAxisSortStrategy {
|
|
1537
|
+
constructor(_element, _dragDropRegistry) {
|
|
1538
|
+
this._element = _element;
|
|
1532
1539
|
this._dragDropRegistry = _dragDropRegistry;
|
|
1533
|
-
this._ngZone = _ngZone;
|
|
1534
|
-
this._viewportRuler = _viewportRuler;
|
|
1535
|
-
/** Whether starting a dragging sequence from this container is disabled. */
|
|
1536
|
-
this.disabled = false;
|
|
1537
|
-
/** Whether sorting items within the list is disabled. */
|
|
1538
|
-
this.sortingDisabled = false;
|
|
1539
|
-
/**
|
|
1540
|
-
* Whether auto-scrolling the view when the user
|
|
1541
|
-
* moves their pointer close to the edges is disabled.
|
|
1542
|
-
*/
|
|
1543
|
-
this.autoScrollDisabled = false;
|
|
1544
|
-
/** Number of pixels to scroll for each frame when auto-scrolling an element. */
|
|
1545
|
-
this.autoScrollStep = 2;
|
|
1546
|
-
/**
|
|
1547
|
-
* Function that is used to determine whether an item
|
|
1548
|
-
* is allowed to be moved into a drop container.
|
|
1549
|
-
*/
|
|
1550
|
-
this.enterPredicate = () => true;
|
|
1551
|
-
/** Functions that is used to determine whether an item can be sorted into a particular index. */
|
|
1552
|
-
this.sortPredicate = () => true;
|
|
1553
|
-
/** Emits right before dragging has started. */
|
|
1554
|
-
this.beforeStarted = new Subject();
|
|
1555
|
-
/**
|
|
1556
|
-
* Emits when the user has moved a new drag item into this container.
|
|
1557
|
-
*/
|
|
1558
|
-
this.entered = new Subject();
|
|
1559
|
-
/**
|
|
1560
|
-
* Emits when the user removes an item from the container
|
|
1561
|
-
* by dragging it into another container.
|
|
1562
|
-
*/
|
|
1563
|
-
this.exited = new Subject();
|
|
1564
|
-
/** Emits when the user drops an item inside the container. */
|
|
1565
|
-
this.dropped = new Subject();
|
|
1566
|
-
/** Emits as the user is swapping items while actively dragging. */
|
|
1567
|
-
this.sorted = new Subject();
|
|
1568
|
-
/** Whether an item in the list is being dragged. */
|
|
1569
|
-
this._isDragging = false;
|
|
1570
1540
|
/** Cache of the dimensions of all the items inside the container. */
|
|
1571
1541
|
this._itemPositions = [];
|
|
1542
|
+
/** Direction in which the list is oriented. */
|
|
1543
|
+
this.orientation = 'vertical';
|
|
1572
1544
|
/**
|
|
1573
1545
|
* Keeps track of the item that was last swapped with the dragged item, as well as what direction
|
|
1574
1546
|
* the pointer was moving in when the swap occured and whether the user's pointer continued to
|
|
1575
1547
|
* overlap with the swapped item after the swapping occurred.
|
|
1576
1548
|
*/
|
|
1577
|
-
this._previousSwap = {
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
this._siblings = [];
|
|
1582
|
-
/** Direction in which the list is oriented. */
|
|
1583
|
-
this._orientation = 'vertical';
|
|
1584
|
-
/** Connected siblings that currently have a dragged item. */
|
|
1585
|
-
this._activeSiblings = new Set();
|
|
1586
|
-
/** Layout direction of the drop list. */
|
|
1587
|
-
this._direction = 'ltr';
|
|
1588
|
-
/** Subscription to the window being scrolled. */
|
|
1589
|
-
this._viewportScrollSubscription = Subscription.EMPTY;
|
|
1590
|
-
/** Vertical direction in which the list is currently scrolling. */
|
|
1591
|
-
this._verticalScrollDirection = 0 /* AutoScrollVerticalDirection.NONE */;
|
|
1592
|
-
/** Horizontal direction in which the list is currently scrolling. */
|
|
1593
|
-
this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
1594
|
-
/** Used to signal to the current auto-scroll sequence when to stop. */
|
|
1595
|
-
this._stopScrollTimers = new Subject();
|
|
1596
|
-
/** Shadow root of the current element. Necessary for `elementFromPoint` to resolve correctly. */
|
|
1597
|
-
this._cachedShadowRoot = null;
|
|
1598
|
-
/** Starts the interval that'll auto-scroll the element. */
|
|
1599
|
-
this._startScrollInterval = () => {
|
|
1600
|
-
this._stopScrolling();
|
|
1601
|
-
interval(0, animationFrameScheduler)
|
|
1602
|
-
.pipe(takeUntil(this._stopScrollTimers))
|
|
1603
|
-
.subscribe(() => {
|
|
1604
|
-
const node = this._scrollNode;
|
|
1605
|
-
const scrollStep = this.autoScrollStep;
|
|
1606
|
-
if (this._verticalScrollDirection === 1 /* AutoScrollVerticalDirection.UP */) {
|
|
1607
|
-
node.scrollBy(0, -scrollStep);
|
|
1608
|
-
}
|
|
1609
|
-
else if (this._verticalScrollDirection === 2 /* AutoScrollVerticalDirection.DOWN */) {
|
|
1610
|
-
node.scrollBy(0, scrollStep);
|
|
1611
|
-
}
|
|
1612
|
-
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
1613
|
-
node.scrollBy(-scrollStep, 0);
|
|
1614
|
-
}
|
|
1615
|
-
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
1616
|
-
node.scrollBy(scrollStep, 0);
|
|
1617
|
-
}
|
|
1618
|
-
});
|
|
1549
|
+
this._previousSwap = {
|
|
1550
|
+
drag: null,
|
|
1551
|
+
delta: 0,
|
|
1552
|
+
overlaps: false,
|
|
1619
1553
|
};
|
|
1620
|
-
this.element = coerceElement(element);
|
|
1621
|
-
this._document = _document;
|
|
1622
|
-
this.withScrollableParents([this.element]);
|
|
1623
|
-
_dragDropRegistry.registerDropContainer(this);
|
|
1624
|
-
this._parentPositions = new ParentPositionTracker(_document);
|
|
1625
|
-
}
|
|
1626
|
-
/** Removes the drop list functionality from the DOM element. */
|
|
1627
|
-
dispose() {
|
|
1628
|
-
this._stopScrolling();
|
|
1629
|
-
this._stopScrollTimers.complete();
|
|
1630
|
-
this._viewportScrollSubscription.unsubscribe();
|
|
1631
|
-
this.beforeStarted.complete();
|
|
1632
|
-
this.entered.complete();
|
|
1633
|
-
this.exited.complete();
|
|
1634
|
-
this.dropped.complete();
|
|
1635
|
-
this.sorted.complete();
|
|
1636
|
-
this._activeSiblings.clear();
|
|
1637
|
-
this._scrollNode = null;
|
|
1638
|
-
this._parentPositions.clear();
|
|
1639
|
-
this._dragDropRegistry.removeDropContainer(this);
|
|
1640
1554
|
}
|
|
1641
|
-
/**
|
|
1642
|
-
|
|
1643
|
-
|
|
1555
|
+
/**
|
|
1556
|
+
* To be called when the drag sequence starts.
|
|
1557
|
+
* @param items Items that are currently in the list.
|
|
1558
|
+
*/
|
|
1559
|
+
start(items) {
|
|
1560
|
+
this.withItems(items);
|
|
1644
1561
|
}
|
|
1645
|
-
/**
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1562
|
+
/**
|
|
1563
|
+
* To be called when an item is being sorted.
|
|
1564
|
+
* @param item Item to be sorted.
|
|
1565
|
+
* @param pointerX Position of the item along the X axis.
|
|
1566
|
+
* @param pointerY Position of the item along the Y axis.
|
|
1567
|
+
* @param pointerDelta Direction in which the pointer is moving along each axis.
|
|
1568
|
+
*/
|
|
1569
|
+
sort(item, pointerX, pointerY, pointerDelta) {
|
|
1570
|
+
const siblings = this._itemPositions;
|
|
1571
|
+
const newIndex = this._getItemIndexFromPointerPosition(item, pointerX, pointerY, pointerDelta);
|
|
1572
|
+
if (newIndex === -1 && siblings.length > 0) {
|
|
1573
|
+
return null;
|
|
1574
|
+
}
|
|
1575
|
+
const isHorizontal = this.orientation === 'horizontal';
|
|
1576
|
+
const currentIndex = siblings.findIndex(currentItem => currentItem.drag === item);
|
|
1577
|
+
const siblingAtNewPosition = siblings[newIndex];
|
|
1578
|
+
const currentPosition = siblings[currentIndex].clientRect;
|
|
1579
|
+
const newPosition = siblingAtNewPosition.clientRect;
|
|
1580
|
+
const delta = currentIndex > newIndex ? 1 : -1;
|
|
1581
|
+
// How many pixels the item's placeholder should be offset.
|
|
1582
|
+
const itemOffset = this._getItemOffsetPx(currentPosition, newPosition, delta);
|
|
1583
|
+
// How many pixels all the other items should be offset.
|
|
1584
|
+
const siblingOffset = this._getSiblingOffsetPx(currentIndex, siblings, delta);
|
|
1585
|
+
// Save the previous order of the items before moving the item to its new index.
|
|
1586
|
+
// We use this to check whether an item has been moved as a result of the sorting.
|
|
1587
|
+
const oldOrder = siblings.slice();
|
|
1588
|
+
// Shuffle the array in place.
|
|
1589
|
+
moveItemInArray(siblings, currentIndex, newIndex);
|
|
1590
|
+
siblings.forEach((sibling, index) => {
|
|
1591
|
+
// Don't do anything if the position hasn't changed.
|
|
1592
|
+
if (oldOrder[index] === sibling) {
|
|
1593
|
+
return;
|
|
1594
|
+
}
|
|
1595
|
+
const isDraggedItem = sibling.drag === item;
|
|
1596
|
+
const offset = isDraggedItem ? itemOffset : siblingOffset;
|
|
1597
|
+
const elementToOffset = isDraggedItem
|
|
1598
|
+
? item.getPlaceholderElement()
|
|
1599
|
+
: sibling.drag.getRootElement();
|
|
1600
|
+
// Update the offset to reflect the new position.
|
|
1601
|
+
sibling.offset += offset;
|
|
1602
|
+
// Since we're moving the items with a `transform`, we need to adjust their cached
|
|
1603
|
+
// client rects to reflect their new position, as well as swap their positions in the cache.
|
|
1604
|
+
// Note that we shouldn't use `getBoundingClientRect` here to update the cache, because the
|
|
1605
|
+
// elements may be mid-animation which will give us a wrong result.
|
|
1606
|
+
if (isHorizontal) {
|
|
1607
|
+
// Round the transforms since some browsers will
|
|
1608
|
+
// blur the elements, for sub-pixel transforms.
|
|
1609
|
+
elementToOffset.style.transform = combineTransforms(`translate3d(${Math.round(sibling.offset)}px, 0, 0)`, sibling.initialTransform);
|
|
1610
|
+
adjustClientRect(sibling.clientRect, 0, offset);
|
|
1611
|
+
}
|
|
1612
|
+
else {
|
|
1613
|
+
elementToOffset.style.transform = combineTransforms(`translate3d(0, ${Math.round(sibling.offset)}px, 0)`, sibling.initialTransform);
|
|
1614
|
+
adjustClientRect(sibling.clientRect, offset, 0);
|
|
1615
|
+
}
|
|
1616
|
+
});
|
|
1617
|
+
// Note that it's important that we do this after the client rects have been adjusted.
|
|
1618
|
+
this._previousSwap.overlaps = isInsideClientRect(newPosition, pointerX, pointerY);
|
|
1619
|
+
this._previousSwap.drag = siblingAtNewPosition.drag;
|
|
1620
|
+
this._previousSwap.delta = isHorizontal ? pointerDelta.x : pointerDelta.y;
|
|
1621
|
+
return { previousIndex: currentIndex, currentIndex: newIndex };
|
|
1649
1622
|
}
|
|
1650
1623
|
/**
|
|
1651
|
-
*
|
|
1624
|
+
* Called when an item is being moved into the container.
|
|
1652
1625
|
* @param item Item that was moved into the container.
|
|
1653
1626
|
* @param pointerX Position of the item along the X axis.
|
|
1654
1627
|
* @param pointerY Position of the item along the Y axis.
|
|
@@ -1656,21 +1629,11 @@ class DropListRef {
|
|
|
1656
1629
|
* out automatically.
|
|
1657
1630
|
*/
|
|
1658
1631
|
enter(item, pointerX, pointerY, index) {
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
// position if the user is returning it to its initial container.
|
|
1662
|
-
let newIndex;
|
|
1663
|
-
if (index == null) {
|
|
1664
|
-
newIndex = this.sortingDisabled ? this._draggables.indexOf(item) : -1;
|
|
1665
|
-
if (newIndex === -1) {
|
|
1666
|
-
// We use the coordinates of where the item entered the drop
|
|
1632
|
+
const newIndex = index == null || index < 0
|
|
1633
|
+
? // We use the coordinates of where the item entered the drop
|
|
1667
1634
|
// zone to figure out at which index it should be inserted.
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
}
|
|
1671
|
-
else {
|
|
1672
|
-
newIndex = index;
|
|
1673
|
-
}
|
|
1635
|
+
this._getItemIndexFromPointerPosition(item, pointerX, pointerY)
|
|
1636
|
+
: index;
|
|
1674
1637
|
const activeDraggables = this._activeDraggables;
|
|
1675
1638
|
const currentIndex = activeDraggables.indexOf(item);
|
|
1676
1639
|
const placeholder = item.getPlaceholderElement();
|
|
@@ -1701,78 +1664,413 @@ class DropListRef {
|
|
|
1701
1664
|
activeDraggables.splice(newIndex, 0, item);
|
|
1702
1665
|
}
|
|
1703
1666
|
else {
|
|
1704
|
-
coerceElement(this.
|
|
1667
|
+
coerceElement(this._element).appendChild(placeholder);
|
|
1705
1668
|
activeDraggables.push(item);
|
|
1706
1669
|
}
|
|
1707
1670
|
// The transform needs to be cleared so it doesn't throw off the measurements.
|
|
1708
1671
|
placeholder.style.transform = '';
|
|
1709
|
-
// Note that
|
|
1710
|
-
// but we need to refresh them since the amount
|
|
1672
|
+
// Note that usually `start` is called together with `enter` when an item goes into a new
|
|
1673
|
+
// container. This will cache item positions, but we need to refresh them since the amount
|
|
1674
|
+
// of items has changed.
|
|
1711
1675
|
this._cacheItemPositions();
|
|
1712
|
-
this._cacheParentPositions();
|
|
1713
|
-
// Notify siblings at the end so that the item has been inserted into the `activeDraggables`.
|
|
1714
|
-
this._notifyReceivingSiblings();
|
|
1715
|
-
this.entered.next({ item, container: this, currentIndex: this.getItemIndex(item) });
|
|
1716
1676
|
}
|
|
1717
|
-
/**
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
exit(item) {
|
|
1722
|
-
this._reset();
|
|
1723
|
-
this.exited.next({ item, container: this });
|
|
1677
|
+
/** Sets the items that are currently part of the list. */
|
|
1678
|
+
withItems(items) {
|
|
1679
|
+
this._activeDraggables = items.slice();
|
|
1680
|
+
this._cacheItemPositions();
|
|
1724
1681
|
}
|
|
1725
|
-
/**
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
this._reset();
|
|
1740
|
-
this.dropped.next({
|
|
1741
|
-
item,
|
|
1742
|
-
currentIndex,
|
|
1743
|
-
previousIndex,
|
|
1744
|
-
container: this,
|
|
1745
|
-
previousContainer,
|
|
1746
|
-
isPointerOverContainer,
|
|
1747
|
-
distance,
|
|
1748
|
-
dropPoint,
|
|
1749
|
-
event,
|
|
1682
|
+
/** Assigns a sort predicate to the strategy. */
|
|
1683
|
+
withSortPredicate(predicate) {
|
|
1684
|
+
this._sortPredicate = predicate;
|
|
1685
|
+
}
|
|
1686
|
+
/** Resets the strategy to its initial state before dragging was started. */
|
|
1687
|
+
reset() {
|
|
1688
|
+
// TODO(crisbeto): may have to wait for the animations to finish.
|
|
1689
|
+
this._activeDraggables.forEach(item => {
|
|
1690
|
+
var _a;
|
|
1691
|
+
const rootElement = item.getRootElement();
|
|
1692
|
+
if (rootElement) {
|
|
1693
|
+
const initialTransform = (_a = this._itemPositions.find(p => p.drag === item)) === null || _a === void 0 ? void 0 : _a.initialTransform;
|
|
1694
|
+
rootElement.style.transform = initialTransform || '';
|
|
1695
|
+
}
|
|
1750
1696
|
});
|
|
1697
|
+
this._itemPositions = [];
|
|
1698
|
+
this._activeDraggables = [];
|
|
1699
|
+
this._previousSwap.drag = null;
|
|
1700
|
+
this._previousSwap.delta = 0;
|
|
1701
|
+
this._previousSwap.overlaps = false;
|
|
1751
1702
|
}
|
|
1752
1703
|
/**
|
|
1753
|
-
*
|
|
1754
|
-
*
|
|
1704
|
+
* Gets a snapshot of items currently in the list.
|
|
1705
|
+
* Can include items that we dragged in from another list.
|
|
1755
1706
|
*/
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1707
|
+
getActiveItemsSnapshot() {
|
|
1708
|
+
return this._activeDraggables;
|
|
1709
|
+
}
|
|
1710
|
+
/** Gets the index of a specific item. */
|
|
1711
|
+
getItemIndex(item) {
|
|
1712
|
+
// Items are sorted always by top/left in the cache, however they flow differently in RTL.
|
|
1713
|
+
// The rest of the logic still stands no matter what orientation we're in, however
|
|
1714
|
+
// we need to invert the array when determining the index.
|
|
1715
|
+
const items = this.orientation === 'horizontal' && this.direction === 'rtl'
|
|
1716
|
+
? this._itemPositions.slice().reverse()
|
|
1717
|
+
: this._itemPositions;
|
|
1718
|
+
return items.findIndex(currentItem => currentItem.drag === item);
|
|
1719
|
+
}
|
|
1720
|
+
/** Used to notify the strategy that the scroll position has changed. */
|
|
1721
|
+
updateOnScroll(topDifference, leftDifference) {
|
|
1722
|
+
// Since we know the amount that the user has scrolled we can shift all of the
|
|
1723
|
+
// client rectangles ourselves. This is cheaper than re-measuring everything and
|
|
1724
|
+
// we can avoid inconsistent behavior where we might be measuring the element before
|
|
1725
|
+
// its position has changed.
|
|
1726
|
+
this._itemPositions.forEach(({ clientRect }) => {
|
|
1727
|
+
adjustClientRect(clientRect, topDifference, leftDifference);
|
|
1728
|
+
});
|
|
1729
|
+
// We need two loops for this, because we want all of the cached
|
|
1730
|
+
// positions to be up-to-date before we re-sort the item.
|
|
1731
|
+
this._itemPositions.forEach(({ drag }) => {
|
|
1732
|
+
if (this._dragDropRegistry.isDragging(drag)) {
|
|
1733
|
+
// We need to re-sort the item manually, because the pointer move
|
|
1734
|
+
// events won't be dispatched while the user is scrolling.
|
|
1735
|
+
drag._sortFromLastPointerPosition();
|
|
1736
|
+
}
|
|
1737
|
+
});
|
|
1738
|
+
}
|
|
1739
|
+
/** Refreshes the position cache of the items and sibling containers. */
|
|
1740
|
+
_cacheItemPositions() {
|
|
1741
|
+
const isHorizontal = this.orientation === 'horizontal';
|
|
1742
|
+
this._itemPositions = this._activeDraggables
|
|
1743
|
+
.map(drag => {
|
|
1744
|
+
const elementToMeasure = drag.getVisibleElement();
|
|
1745
|
+
return {
|
|
1746
|
+
drag,
|
|
1747
|
+
offset: 0,
|
|
1748
|
+
initialTransform: elementToMeasure.style.transform || '',
|
|
1749
|
+
clientRect: getMutableClientRect(elementToMeasure),
|
|
1750
|
+
};
|
|
1751
|
+
})
|
|
1752
|
+
.sort((a, b) => {
|
|
1753
|
+
return isHorizontal
|
|
1754
|
+
? a.clientRect.left - b.clientRect.left
|
|
1755
|
+
: a.clientRect.top - b.clientRect.top;
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Gets the offset in pixels by which the item that is being dragged should be moved.
|
|
1760
|
+
* @param currentPosition Current position of the item.
|
|
1761
|
+
* @param newPosition Position of the item where the current item should be moved.
|
|
1762
|
+
* @param delta Direction in which the user is moving.
|
|
1763
|
+
*/
|
|
1764
|
+
_getItemOffsetPx(currentPosition, newPosition, delta) {
|
|
1765
|
+
const isHorizontal = this.orientation === 'horizontal';
|
|
1766
|
+
let itemOffset = isHorizontal
|
|
1767
|
+
? newPosition.left - currentPosition.left
|
|
1768
|
+
: newPosition.top - currentPosition.top;
|
|
1769
|
+
// Account for differences in the item width/height.
|
|
1770
|
+
if (delta === -1) {
|
|
1771
|
+
itemOffset += isHorizontal
|
|
1772
|
+
? newPosition.width - currentPosition.width
|
|
1773
|
+
: newPosition.height - currentPosition.height;
|
|
1774
|
+
}
|
|
1775
|
+
return itemOffset;
|
|
1776
|
+
}
|
|
1777
|
+
/**
|
|
1778
|
+
* Gets the offset in pixels by which the items that aren't being dragged should be moved.
|
|
1779
|
+
* @param currentIndex Index of the item currently being dragged.
|
|
1780
|
+
* @param siblings All of the items in the list.
|
|
1781
|
+
* @param delta Direction in which the user is moving.
|
|
1782
|
+
*/
|
|
1783
|
+
_getSiblingOffsetPx(currentIndex, siblings, delta) {
|
|
1784
|
+
const isHorizontal = this.orientation === 'horizontal';
|
|
1785
|
+
const currentPosition = siblings[currentIndex].clientRect;
|
|
1786
|
+
const immediateSibling = siblings[currentIndex + delta * -1];
|
|
1787
|
+
let siblingOffset = currentPosition[isHorizontal ? 'width' : 'height'] * delta;
|
|
1788
|
+
if (immediateSibling) {
|
|
1789
|
+
const start = isHorizontal ? 'left' : 'top';
|
|
1790
|
+
const end = isHorizontal ? 'right' : 'bottom';
|
|
1791
|
+
// Get the spacing between the start of the current item and the end of the one immediately
|
|
1792
|
+
// after it in the direction in which the user is dragging, or vice versa. We add it to the
|
|
1793
|
+
// offset in order to push the element to where it will be when it's inline and is influenced
|
|
1794
|
+
// by the `margin` of its siblings.
|
|
1795
|
+
if (delta === -1) {
|
|
1796
|
+
siblingOffset -= immediateSibling.clientRect[start] - currentPosition[end];
|
|
1797
|
+
}
|
|
1798
|
+
else {
|
|
1799
|
+
siblingOffset += currentPosition[start] - immediateSibling.clientRect[end];
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
return siblingOffset;
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Checks if pointer is entering in the first position
|
|
1806
|
+
* @param pointerX Position of the user's pointer along the X axis.
|
|
1807
|
+
* @param pointerY Position of the user's pointer along the Y axis.
|
|
1808
|
+
*/
|
|
1809
|
+
_shouldEnterAsFirstChild(pointerX, pointerY) {
|
|
1810
|
+
if (!this._activeDraggables.length) {
|
|
1811
|
+
return false;
|
|
1812
|
+
}
|
|
1813
|
+
const itemPositions = this._itemPositions;
|
|
1814
|
+
const isHorizontal = this.orientation === 'horizontal';
|
|
1815
|
+
// `itemPositions` are sorted by position while `activeDraggables` are sorted by child index
|
|
1816
|
+
// check if container is using some sort of "reverse" ordering (eg: flex-direction: row-reverse)
|
|
1817
|
+
const reversed = itemPositions[0].drag !== this._activeDraggables[0];
|
|
1818
|
+
if (reversed) {
|
|
1819
|
+
const lastItemRect = itemPositions[itemPositions.length - 1].clientRect;
|
|
1820
|
+
return isHorizontal ? pointerX >= lastItemRect.right : pointerY >= lastItemRect.bottom;
|
|
1821
|
+
}
|
|
1822
|
+
else {
|
|
1823
|
+
const firstItemRect = itemPositions[0].clientRect;
|
|
1824
|
+
return isHorizontal ? pointerX <= firstItemRect.left : pointerY <= firstItemRect.top;
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
/**
|
|
1828
|
+
* Gets the index of an item in the drop container, based on the position of the user's pointer.
|
|
1829
|
+
* @param item Item that is being sorted.
|
|
1830
|
+
* @param pointerX Position of the user's pointer along the X axis.
|
|
1831
|
+
* @param pointerY Position of the user's pointer along the Y axis.
|
|
1832
|
+
* @param delta Direction in which the user is moving their pointer.
|
|
1833
|
+
*/
|
|
1834
|
+
_getItemIndexFromPointerPosition(item, pointerX, pointerY, delta) {
|
|
1835
|
+
const isHorizontal = this.orientation === 'horizontal';
|
|
1836
|
+
const index = this._itemPositions.findIndex(({ drag, clientRect }) => {
|
|
1837
|
+
// Skip the item itself.
|
|
1838
|
+
if (drag === item) {
|
|
1839
|
+
return false;
|
|
1840
|
+
}
|
|
1841
|
+
if (delta) {
|
|
1842
|
+
const direction = isHorizontal ? delta.x : delta.y;
|
|
1843
|
+
// If the user is still hovering over the same item as last time, their cursor hasn't left
|
|
1844
|
+
// the item after we made the swap, and they didn't change the direction in which they're
|
|
1845
|
+
// dragging, we don't consider it a direction swap.
|
|
1846
|
+
if (drag === this._previousSwap.drag &&
|
|
1847
|
+
this._previousSwap.overlaps &&
|
|
1848
|
+
direction === this._previousSwap.delta) {
|
|
1849
|
+
return false;
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
return isHorizontal
|
|
1853
|
+
? // Round these down since most browsers report client rects with
|
|
1854
|
+
// sub-pixel precision, whereas the pointer coordinates are rounded to pixels.
|
|
1855
|
+
pointerX >= Math.floor(clientRect.left) && pointerX < Math.floor(clientRect.right)
|
|
1856
|
+
: pointerY >= Math.floor(clientRect.top) && pointerY < Math.floor(clientRect.bottom);
|
|
1857
|
+
});
|
|
1858
|
+
return index === -1 || !this._sortPredicate(index, item) ? -1 : index;
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
/**
|
|
1863
|
+
* @license
|
|
1864
|
+
* Copyright Google LLC All Rights Reserved.
|
|
1865
|
+
*
|
|
1866
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1867
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1868
|
+
*/
|
|
1869
|
+
/**
|
|
1870
|
+
* Proximity, as a ratio to width/height, at which a
|
|
1871
|
+
* dragged item will affect the drop container.
|
|
1872
|
+
*/
|
|
1873
|
+
const DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
1874
|
+
/**
|
|
1875
|
+
* Proximity, as a ratio to width/height at which to start auto-scrolling the drop list or the
|
|
1876
|
+
* viewport. The value comes from trying it out manually until it feels right.
|
|
1877
|
+
*/
|
|
1878
|
+
const SCROLL_PROXIMITY_THRESHOLD = 0.05;
|
|
1879
|
+
/**
|
|
1880
|
+
* Reference to a drop list. Used to manipulate or dispose of the container.
|
|
1881
|
+
*/
|
|
1882
|
+
class DropListRef {
|
|
1883
|
+
constructor(element, _dragDropRegistry, _document, _ngZone, _viewportRuler) {
|
|
1884
|
+
this._dragDropRegistry = _dragDropRegistry;
|
|
1885
|
+
this._ngZone = _ngZone;
|
|
1886
|
+
this._viewportRuler = _viewportRuler;
|
|
1887
|
+
/** Whether starting a dragging sequence from this container is disabled. */
|
|
1888
|
+
this.disabled = false;
|
|
1889
|
+
/** Whether sorting items within the list is disabled. */
|
|
1890
|
+
this.sortingDisabled = false;
|
|
1891
|
+
/**
|
|
1892
|
+
* Whether auto-scrolling the view when the user
|
|
1893
|
+
* moves their pointer close to the edges is disabled.
|
|
1894
|
+
*/
|
|
1895
|
+
this.autoScrollDisabled = false;
|
|
1896
|
+
/** Number of pixels to scroll for each frame when auto-scrolling an element. */
|
|
1897
|
+
this.autoScrollStep = 2;
|
|
1898
|
+
/**
|
|
1899
|
+
* Function that is used to determine whether an item
|
|
1900
|
+
* is allowed to be moved into a drop container.
|
|
1901
|
+
*/
|
|
1902
|
+
this.enterPredicate = () => true;
|
|
1903
|
+
/** Function that is used to determine whether an item can be sorted into a particular index. */
|
|
1904
|
+
this.sortPredicate = () => true;
|
|
1905
|
+
/** Emits right before dragging has started. */
|
|
1906
|
+
this.beforeStarted = new Subject();
|
|
1907
|
+
/**
|
|
1908
|
+
* Emits when the user has moved a new drag item into this container.
|
|
1909
|
+
*/
|
|
1910
|
+
this.entered = new Subject();
|
|
1911
|
+
/**
|
|
1912
|
+
* Emits when the user removes an item from the container
|
|
1913
|
+
* by dragging it into another container.
|
|
1914
|
+
*/
|
|
1915
|
+
this.exited = new Subject();
|
|
1916
|
+
/** Emits when the user drops an item inside the container. */
|
|
1917
|
+
this.dropped = new Subject();
|
|
1918
|
+
/** Emits as the user is swapping items while actively dragging. */
|
|
1919
|
+
this.sorted = new Subject();
|
|
1920
|
+
/** Whether an item in the list is being dragged. */
|
|
1921
|
+
this._isDragging = false;
|
|
1922
|
+
/** Draggable items in the container. */
|
|
1923
|
+
this._draggables = [];
|
|
1924
|
+
/** Drop lists that are connected to the current one. */
|
|
1925
|
+
this._siblings = [];
|
|
1926
|
+
/** Connected siblings that currently have a dragged item. */
|
|
1927
|
+
this._activeSiblings = new Set();
|
|
1928
|
+
/** Subscription to the window being scrolled. */
|
|
1929
|
+
this._viewportScrollSubscription = Subscription.EMPTY;
|
|
1930
|
+
/** Vertical direction in which the list is currently scrolling. */
|
|
1931
|
+
this._verticalScrollDirection = 0 /* AutoScrollVerticalDirection.NONE */;
|
|
1932
|
+
/** Horizontal direction in which the list is currently scrolling. */
|
|
1933
|
+
this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
1934
|
+
/** Used to signal to the current auto-scroll sequence when to stop. */
|
|
1935
|
+
this._stopScrollTimers = new Subject();
|
|
1936
|
+
/** Shadow root of the current element. Necessary for `elementFromPoint` to resolve correctly. */
|
|
1937
|
+
this._cachedShadowRoot = null;
|
|
1938
|
+
/** Starts the interval that'll auto-scroll the element. */
|
|
1939
|
+
this._startScrollInterval = () => {
|
|
1940
|
+
this._stopScrolling();
|
|
1941
|
+
interval(0, animationFrameScheduler)
|
|
1942
|
+
.pipe(takeUntil(this._stopScrollTimers))
|
|
1943
|
+
.subscribe(() => {
|
|
1944
|
+
const node = this._scrollNode;
|
|
1945
|
+
const scrollStep = this.autoScrollStep;
|
|
1946
|
+
if (this._verticalScrollDirection === 1 /* AutoScrollVerticalDirection.UP */) {
|
|
1947
|
+
node.scrollBy(0, -scrollStep);
|
|
1948
|
+
}
|
|
1949
|
+
else if (this._verticalScrollDirection === 2 /* AutoScrollVerticalDirection.DOWN */) {
|
|
1950
|
+
node.scrollBy(0, scrollStep);
|
|
1951
|
+
}
|
|
1952
|
+
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
1953
|
+
node.scrollBy(-scrollStep, 0);
|
|
1954
|
+
}
|
|
1955
|
+
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
1956
|
+
node.scrollBy(scrollStep, 0);
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
};
|
|
1960
|
+
this.element = coerceElement(element);
|
|
1961
|
+
this._document = _document;
|
|
1962
|
+
this.withScrollableParents([this.element]);
|
|
1963
|
+
_dragDropRegistry.registerDropContainer(this);
|
|
1964
|
+
this._parentPositions = new ParentPositionTracker(_document);
|
|
1965
|
+
this._sortStrategy = new SingleAxisSortStrategy(this.element, _dragDropRegistry);
|
|
1966
|
+
this._sortStrategy.withSortPredicate((index, item) => this.sortPredicate(index, item, this));
|
|
1967
|
+
}
|
|
1968
|
+
/** Removes the drop list functionality from the DOM element. */
|
|
1969
|
+
dispose() {
|
|
1970
|
+
this._stopScrolling();
|
|
1971
|
+
this._stopScrollTimers.complete();
|
|
1972
|
+
this._viewportScrollSubscription.unsubscribe();
|
|
1973
|
+
this.beforeStarted.complete();
|
|
1974
|
+
this.entered.complete();
|
|
1975
|
+
this.exited.complete();
|
|
1976
|
+
this.dropped.complete();
|
|
1977
|
+
this.sorted.complete();
|
|
1978
|
+
this._activeSiblings.clear();
|
|
1979
|
+
this._scrollNode = null;
|
|
1980
|
+
this._parentPositions.clear();
|
|
1981
|
+
this._dragDropRegistry.removeDropContainer(this);
|
|
1982
|
+
}
|
|
1983
|
+
/** Whether an item from this list is currently being dragged. */
|
|
1984
|
+
isDragging() {
|
|
1985
|
+
return this._isDragging;
|
|
1986
|
+
}
|
|
1987
|
+
/** Starts dragging an item. */
|
|
1988
|
+
start() {
|
|
1989
|
+
this._draggingStarted();
|
|
1990
|
+
this._notifyReceivingSiblings();
|
|
1991
|
+
}
|
|
1992
|
+
/**
|
|
1993
|
+
* Attempts to move an item into the container.
|
|
1994
|
+
* @param item Item that was moved into the container.
|
|
1995
|
+
* @param pointerX Position of the item along the X axis.
|
|
1996
|
+
* @param pointerY Position of the item along the Y axis.
|
|
1997
|
+
* @param index Index at which the item entered. If omitted, the container will try to figure it
|
|
1998
|
+
* out automatically.
|
|
1999
|
+
*/
|
|
2000
|
+
enter(item, pointerX, pointerY, index) {
|
|
2001
|
+
this._draggingStarted();
|
|
2002
|
+
// If sorting is disabled, we want the item to return to its starting
|
|
2003
|
+
// position if the user is returning it to its initial container.
|
|
2004
|
+
if (index == null && this.sortingDisabled) {
|
|
2005
|
+
index = this._draggables.indexOf(item);
|
|
2006
|
+
}
|
|
2007
|
+
this._sortStrategy.enter(item, pointerX, pointerY, index);
|
|
2008
|
+
// Note that this usually happens inside `_draggingStarted` as well, but the dimensions
|
|
2009
|
+
// can change when the sort strategy moves the item around inside `enter`.
|
|
2010
|
+
this._cacheParentPositions();
|
|
2011
|
+
// Notify siblings at the end so that the item has been inserted into the `activeDraggables`.
|
|
2012
|
+
this._notifyReceivingSiblings();
|
|
2013
|
+
this.entered.next({ item, container: this, currentIndex: this.getItemIndex(item) });
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Removes an item from the container after it was dragged into another container by the user.
|
|
2017
|
+
* @param item Item that was dragged out.
|
|
2018
|
+
*/
|
|
2019
|
+
exit(item) {
|
|
2020
|
+
this._reset();
|
|
2021
|
+
this.exited.next({ item, container: this });
|
|
2022
|
+
}
|
|
2023
|
+
/**
|
|
2024
|
+
* Drops an item into this container.
|
|
2025
|
+
* @param item Item being dropped into the container.
|
|
2026
|
+
* @param currentIndex Index at which the item should be inserted.
|
|
2027
|
+
* @param previousIndex Index of the item when dragging started.
|
|
2028
|
+
* @param previousContainer Container from which the item got dragged in.
|
|
2029
|
+
* @param isPointerOverContainer Whether the user's pointer was over the
|
|
2030
|
+
* container when the item was dropped.
|
|
2031
|
+
* @param distance Distance the user has dragged since the start of the dragging sequence.
|
|
2032
|
+
* @param event Event that triggered the dropping sequence.
|
|
2033
|
+
*
|
|
2034
|
+
* @breaking-change 15.0.0 `previousIndex` and `event` parameters to become required.
|
|
2035
|
+
*/
|
|
2036
|
+
drop(item, currentIndex, previousIndex, previousContainer, isPointerOverContainer, distance, dropPoint, event = {}) {
|
|
2037
|
+
this._reset();
|
|
2038
|
+
this.dropped.next({
|
|
2039
|
+
item,
|
|
2040
|
+
currentIndex,
|
|
2041
|
+
previousIndex,
|
|
2042
|
+
container: this,
|
|
2043
|
+
previousContainer,
|
|
2044
|
+
isPointerOverContainer,
|
|
2045
|
+
distance,
|
|
2046
|
+
dropPoint,
|
|
2047
|
+
event,
|
|
2048
|
+
});
|
|
2049
|
+
}
|
|
2050
|
+
/**
|
|
2051
|
+
* Sets the draggable items that are a part of this list.
|
|
2052
|
+
* @param items Items that are a part of this list.
|
|
2053
|
+
*/
|
|
2054
|
+
withItems(items) {
|
|
2055
|
+
const previousItems = this._draggables;
|
|
2056
|
+
this._draggables = items;
|
|
2057
|
+
items.forEach(item => item._withDropContainer(this));
|
|
2058
|
+
if (this.isDragging()) {
|
|
2059
|
+
const draggedItems = previousItems.filter(item => item.isDragging());
|
|
2060
|
+
// If all of the items being dragged were removed
|
|
2061
|
+
// from the list, abort the current drag sequence.
|
|
2062
|
+
if (draggedItems.every(item => items.indexOf(item) === -1)) {
|
|
2063
|
+
this._reset();
|
|
2064
|
+
}
|
|
2065
|
+
else {
|
|
2066
|
+
this._sortStrategy.withItems(this._draggables);
|
|
1769
2067
|
}
|
|
1770
2068
|
}
|
|
1771
2069
|
return this;
|
|
1772
2070
|
}
|
|
1773
2071
|
/** Sets the layout direction of the drop list. */
|
|
1774
2072
|
withDirection(direction) {
|
|
1775
|
-
this.
|
|
2073
|
+
this._sortStrategy.direction = direction;
|
|
1776
2074
|
return this;
|
|
1777
2075
|
}
|
|
1778
2076
|
/**
|
|
@@ -1789,7 +2087,9 @@ class DropListRef {
|
|
|
1789
2087
|
* @param orientation New orientation for the container.
|
|
1790
2088
|
*/
|
|
1791
2089
|
withOrientation(orientation) {
|
|
1792
|
-
|
|
2090
|
+
// TODO(crisbeto): eventually we should be constructing the new sort strategy here based on
|
|
2091
|
+
// the new orientation. For now we can assume that it'll always be `SingleAxisSortStrategy`.
|
|
2092
|
+
this._sortStrategy.orientation = orientation;
|
|
1793
2093
|
return this;
|
|
1794
2094
|
}
|
|
1795
2095
|
/**
|
|
@@ -1813,16 +2113,9 @@ class DropListRef {
|
|
|
1813
2113
|
* @param item Item whose index should be determined.
|
|
1814
2114
|
*/
|
|
1815
2115
|
getItemIndex(item) {
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
// Items are sorted always by top/left in the cache, however they flow differently in RTL.
|
|
1820
|
-
// The rest of the logic still stands no matter what orientation we're in, however
|
|
1821
|
-
// we need to invert the array when determining the index.
|
|
1822
|
-
const items = this._orientation === 'horizontal' && this._direction === 'rtl'
|
|
1823
|
-
? this._itemPositions.slice().reverse()
|
|
1824
|
-
: this._itemPositions;
|
|
1825
|
-
return items.findIndex(currentItem => currentItem.drag === item);
|
|
2116
|
+
return this._isDragging
|
|
2117
|
+
? this._sortStrategy.getItemIndex(item)
|
|
2118
|
+
: this._draggables.indexOf(item);
|
|
1826
2119
|
}
|
|
1827
2120
|
/**
|
|
1828
2121
|
* Whether the list is able to receive the item that
|
|
@@ -1845,63 +2138,15 @@ class DropListRef {
|
|
|
1845
2138
|
!isPointerNearClientRect(this._clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
1846
2139
|
return;
|
|
1847
2140
|
}
|
|
1848
|
-
const
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
2141
|
+
const result = this._sortStrategy.sort(item, pointerX, pointerY, pointerDelta);
|
|
2142
|
+
if (result) {
|
|
2143
|
+
this.sorted.next({
|
|
2144
|
+
previousIndex: result.previousIndex,
|
|
2145
|
+
currentIndex: result.currentIndex,
|
|
2146
|
+
container: this,
|
|
2147
|
+
item,
|
|
2148
|
+
});
|
|
1852
2149
|
}
|
|
1853
|
-
const isHorizontal = this._orientation === 'horizontal';
|
|
1854
|
-
const currentIndex = siblings.findIndex(currentItem => currentItem.drag === item);
|
|
1855
|
-
const siblingAtNewPosition = siblings[newIndex];
|
|
1856
|
-
const currentPosition = siblings[currentIndex].clientRect;
|
|
1857
|
-
const newPosition = siblingAtNewPosition.clientRect;
|
|
1858
|
-
const delta = currentIndex > newIndex ? 1 : -1;
|
|
1859
|
-
// How many pixels the item's placeholder should be offset.
|
|
1860
|
-
const itemOffset = this._getItemOffsetPx(currentPosition, newPosition, delta);
|
|
1861
|
-
// How many pixels all the other items should be offset.
|
|
1862
|
-
const siblingOffset = this._getSiblingOffsetPx(currentIndex, siblings, delta);
|
|
1863
|
-
// Save the previous order of the items before moving the item to its new index.
|
|
1864
|
-
// We use this to check whether an item has been moved as a result of the sorting.
|
|
1865
|
-
const oldOrder = siblings.slice();
|
|
1866
|
-
// Shuffle the array in place.
|
|
1867
|
-
moveItemInArray(siblings, currentIndex, newIndex);
|
|
1868
|
-
this.sorted.next({
|
|
1869
|
-
previousIndex: currentIndex,
|
|
1870
|
-
currentIndex: newIndex,
|
|
1871
|
-
container: this,
|
|
1872
|
-
item,
|
|
1873
|
-
});
|
|
1874
|
-
siblings.forEach((sibling, index) => {
|
|
1875
|
-
// Don't do anything if the position hasn't changed.
|
|
1876
|
-
if (oldOrder[index] === sibling) {
|
|
1877
|
-
return;
|
|
1878
|
-
}
|
|
1879
|
-
const isDraggedItem = sibling.drag === item;
|
|
1880
|
-
const offset = isDraggedItem ? itemOffset : siblingOffset;
|
|
1881
|
-
const elementToOffset = isDraggedItem
|
|
1882
|
-
? item.getPlaceholderElement()
|
|
1883
|
-
: sibling.drag.getRootElement();
|
|
1884
|
-
// Update the offset to reflect the new position.
|
|
1885
|
-
sibling.offset += offset;
|
|
1886
|
-
// Since we're moving the items with a `transform`, we need to adjust their cached
|
|
1887
|
-
// client rects to reflect their new position, as well as swap their positions in the cache.
|
|
1888
|
-
// Note that we shouldn't use `getBoundingClientRect` here to update the cache, because the
|
|
1889
|
-
// elements may be mid-animation which will give us a wrong result.
|
|
1890
|
-
if (isHorizontal) {
|
|
1891
|
-
// Round the transforms since some browsers will
|
|
1892
|
-
// blur the elements, for sub-pixel transforms.
|
|
1893
|
-
elementToOffset.style.transform = combineTransforms(`translate3d(${Math.round(sibling.offset)}px, 0, 0)`, sibling.initialTransform);
|
|
1894
|
-
adjustClientRect(sibling.clientRect, 0, offset);
|
|
1895
|
-
}
|
|
1896
|
-
else {
|
|
1897
|
-
elementToOffset.style.transform = combineTransforms(`translate3d(0, ${Math.round(sibling.offset)}px, 0)`, sibling.initialTransform);
|
|
1898
|
-
adjustClientRect(sibling.clientRect, offset, 0);
|
|
1899
|
-
}
|
|
1900
|
-
});
|
|
1901
|
-
// Note that it's important that we do this after the client rects have been adjusted.
|
|
1902
|
-
this._previousSwap.overlaps = isInsideClientRect(newPosition, pointerX, pointerY);
|
|
1903
|
-
this._previousSwap.drag = siblingAtNewPosition.drag;
|
|
1904
|
-
this._previousSwap.delta = isHorizontal ? pointerDelta.x : pointerDelta.y;
|
|
1905
2150
|
}
|
|
1906
2151
|
/**
|
|
1907
2152
|
* Checks whether the user's pointer is close to the edges of either the
|
|
@@ -1974,7 +2219,8 @@ class DropListRef {
|
|
|
1974
2219
|
// that we can't increment/decrement the scroll position.
|
|
1975
2220
|
this._initialScrollSnap = styles.msScrollSnapType || styles.scrollSnapType || '';
|
|
1976
2221
|
styles.scrollSnapType = styles.msScrollSnapType = 'none';
|
|
1977
|
-
this.
|
|
2222
|
+
this._sortStrategy.start(this._draggables);
|
|
2223
|
+
this._cacheParentPositions();
|
|
1978
2224
|
this._viewportScrollSubscription.unsubscribe();
|
|
1979
2225
|
this._listenToScrollEvents();
|
|
1980
2226
|
}
|
|
@@ -1986,157 +2232,17 @@ class DropListRef {
|
|
|
1986
2232
|
// so we can take advantage of the cached `ClientRect`.
|
|
1987
2233
|
this._clientRect = this._parentPositions.positions.get(element).clientRect;
|
|
1988
2234
|
}
|
|
1989
|
-
/** Refreshes the position cache of the items and sibling containers. */
|
|
1990
|
-
_cacheItemPositions() {
|
|
1991
|
-
const isHorizontal = this._orientation === 'horizontal';
|
|
1992
|
-
this._itemPositions = this._activeDraggables
|
|
1993
|
-
.map(drag => {
|
|
1994
|
-
const elementToMeasure = drag.getVisibleElement();
|
|
1995
|
-
return {
|
|
1996
|
-
drag,
|
|
1997
|
-
offset: 0,
|
|
1998
|
-
initialTransform: elementToMeasure.style.transform || '',
|
|
1999
|
-
clientRect: getMutableClientRect(elementToMeasure),
|
|
2000
|
-
};
|
|
2001
|
-
})
|
|
2002
|
-
.sort((a, b) => {
|
|
2003
|
-
return isHorizontal
|
|
2004
|
-
? a.clientRect.left - b.clientRect.left
|
|
2005
|
-
: a.clientRect.top - b.clientRect.top;
|
|
2006
|
-
});
|
|
2007
|
-
}
|
|
2008
2235
|
/** Resets the container to its initial state. */
|
|
2009
2236
|
_reset() {
|
|
2010
2237
|
this._isDragging = false;
|
|
2011
2238
|
const styles = coerceElement(this.element).style;
|
|
2012
2239
|
styles.scrollSnapType = styles.msScrollSnapType = this._initialScrollSnap;
|
|
2013
|
-
// TODO(crisbeto): may have to wait for the animations to finish.
|
|
2014
|
-
this._activeDraggables.forEach(item => {
|
|
2015
|
-
var _a;
|
|
2016
|
-
const rootElement = item.getRootElement();
|
|
2017
|
-
if (rootElement) {
|
|
2018
|
-
const initialTransform = (_a = this._itemPositions.find(current => current.drag === item)) === null || _a === void 0 ? void 0 : _a.initialTransform;
|
|
2019
|
-
rootElement.style.transform = initialTransform || '';
|
|
2020
|
-
}
|
|
2021
|
-
});
|
|
2022
2240
|
this._siblings.forEach(sibling => sibling._stopReceiving(this));
|
|
2023
|
-
this.
|
|
2024
|
-
this._itemPositions = [];
|
|
2025
|
-
this._previousSwap.drag = null;
|
|
2026
|
-
this._previousSwap.delta = 0;
|
|
2027
|
-
this._previousSwap.overlaps = false;
|
|
2241
|
+
this._sortStrategy.reset();
|
|
2028
2242
|
this._stopScrolling();
|
|
2029
2243
|
this._viewportScrollSubscription.unsubscribe();
|
|
2030
2244
|
this._parentPositions.clear();
|
|
2031
2245
|
}
|
|
2032
|
-
/**
|
|
2033
|
-
* Gets the offset in pixels by which the items that aren't being dragged should be moved.
|
|
2034
|
-
* @param currentIndex Index of the item currently being dragged.
|
|
2035
|
-
* @param siblings All of the items in the list.
|
|
2036
|
-
* @param delta Direction in which the user is moving.
|
|
2037
|
-
*/
|
|
2038
|
-
_getSiblingOffsetPx(currentIndex, siblings, delta) {
|
|
2039
|
-
const isHorizontal = this._orientation === 'horizontal';
|
|
2040
|
-
const currentPosition = siblings[currentIndex].clientRect;
|
|
2041
|
-
const immediateSibling = siblings[currentIndex + delta * -1];
|
|
2042
|
-
let siblingOffset = currentPosition[isHorizontal ? 'width' : 'height'] * delta;
|
|
2043
|
-
if (immediateSibling) {
|
|
2044
|
-
const start = isHorizontal ? 'left' : 'top';
|
|
2045
|
-
const end = isHorizontal ? 'right' : 'bottom';
|
|
2046
|
-
// Get the spacing between the start of the current item and the end of the one immediately
|
|
2047
|
-
// after it in the direction in which the user is dragging, or vice versa. We add it to the
|
|
2048
|
-
// offset in order to push the element to where it will be when it's inline and is influenced
|
|
2049
|
-
// by the `margin` of its siblings.
|
|
2050
|
-
if (delta === -1) {
|
|
2051
|
-
siblingOffset -= immediateSibling.clientRect[start] - currentPosition[end];
|
|
2052
|
-
}
|
|
2053
|
-
else {
|
|
2054
|
-
siblingOffset += currentPosition[start] - immediateSibling.clientRect[end];
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
return siblingOffset;
|
|
2058
|
-
}
|
|
2059
|
-
/**
|
|
2060
|
-
* Gets the offset in pixels by which the item that is being dragged should be moved.
|
|
2061
|
-
* @param currentPosition Current position of the item.
|
|
2062
|
-
* @param newPosition Position of the item where the current item should be moved.
|
|
2063
|
-
* @param delta Direction in which the user is moving.
|
|
2064
|
-
*/
|
|
2065
|
-
_getItemOffsetPx(currentPosition, newPosition, delta) {
|
|
2066
|
-
const isHorizontal = this._orientation === 'horizontal';
|
|
2067
|
-
let itemOffset = isHorizontal
|
|
2068
|
-
? newPosition.left - currentPosition.left
|
|
2069
|
-
: newPosition.top - currentPosition.top;
|
|
2070
|
-
// Account for differences in the item width/height.
|
|
2071
|
-
if (delta === -1) {
|
|
2072
|
-
itemOffset += isHorizontal
|
|
2073
|
-
? newPosition.width - currentPosition.width
|
|
2074
|
-
: newPosition.height - currentPosition.height;
|
|
2075
|
-
}
|
|
2076
|
-
return itemOffset;
|
|
2077
|
-
}
|
|
2078
|
-
/**
|
|
2079
|
-
* Checks if pointer is entering in the first position
|
|
2080
|
-
* @param pointerX Position of the user's pointer along the X axis.
|
|
2081
|
-
* @param pointerY Position of the user's pointer along the Y axis.
|
|
2082
|
-
*/
|
|
2083
|
-
_shouldEnterAsFirstChild(pointerX, pointerY) {
|
|
2084
|
-
if (!this._activeDraggables.length) {
|
|
2085
|
-
return false;
|
|
2086
|
-
}
|
|
2087
|
-
const itemPositions = this._itemPositions;
|
|
2088
|
-
const isHorizontal = this._orientation === 'horizontal';
|
|
2089
|
-
// `itemPositions` are sorted by position while `activeDraggables` are sorted by child index
|
|
2090
|
-
// check if container is using some sort of "reverse" ordering (eg: flex-direction: row-reverse)
|
|
2091
|
-
const reversed = itemPositions[0].drag !== this._activeDraggables[0];
|
|
2092
|
-
if (reversed) {
|
|
2093
|
-
const lastItemRect = itemPositions[itemPositions.length - 1].clientRect;
|
|
2094
|
-
return isHorizontal ? pointerX >= lastItemRect.right : pointerY >= lastItemRect.bottom;
|
|
2095
|
-
}
|
|
2096
|
-
else {
|
|
2097
|
-
const firstItemRect = itemPositions[0].clientRect;
|
|
2098
|
-
return isHorizontal ? pointerX <= firstItemRect.left : pointerY <= firstItemRect.top;
|
|
2099
|
-
}
|
|
2100
|
-
}
|
|
2101
|
-
/**
|
|
2102
|
-
* Gets the index of an item in the drop container, based on the position of the user's pointer.
|
|
2103
|
-
* @param item Item that is being sorted.
|
|
2104
|
-
* @param pointerX Position of the user's pointer along the X axis.
|
|
2105
|
-
* @param pointerY Position of the user's pointer along the Y axis.
|
|
2106
|
-
* @param delta Direction in which the user is moving their pointer.
|
|
2107
|
-
*/
|
|
2108
|
-
_getItemIndexFromPointerPosition(item, pointerX, pointerY, delta) {
|
|
2109
|
-
const isHorizontal = this._orientation === 'horizontal';
|
|
2110
|
-
const index = this._itemPositions.findIndex(({ drag, clientRect }) => {
|
|
2111
|
-
// Skip the item itself.
|
|
2112
|
-
if (drag === item) {
|
|
2113
|
-
return false;
|
|
2114
|
-
}
|
|
2115
|
-
if (delta) {
|
|
2116
|
-
const direction = isHorizontal ? delta.x : delta.y;
|
|
2117
|
-
// If the user is still hovering over the same item as last time, their cursor hasn't left
|
|
2118
|
-
// the item after we made the swap, and they didn't change the direction in which they're
|
|
2119
|
-
// dragging, we don't consider it a direction swap.
|
|
2120
|
-
if (drag === this._previousSwap.drag &&
|
|
2121
|
-
this._previousSwap.overlaps &&
|
|
2122
|
-
direction === this._previousSwap.delta) {
|
|
2123
|
-
return false;
|
|
2124
|
-
}
|
|
2125
|
-
}
|
|
2126
|
-
return isHorizontal
|
|
2127
|
-
? // Round these down since most browsers report client rects with
|
|
2128
|
-
// sub-pixel precision, whereas the pointer coordinates are rounded to pixels.
|
|
2129
|
-
pointerX >= Math.floor(clientRect.left) && pointerX < Math.floor(clientRect.right)
|
|
2130
|
-
: pointerY >= Math.floor(clientRect.top) && pointerY < Math.floor(clientRect.bottom);
|
|
2131
|
-
});
|
|
2132
|
-
return index === -1 || !this.sortPredicate(index, item, this) ? -1 : index;
|
|
2133
|
-
}
|
|
2134
|
-
/** Caches the current items in the list and their positions. */
|
|
2135
|
-
_cacheItems() {
|
|
2136
|
-
this._activeDraggables = this._draggables.slice();
|
|
2137
|
-
this._cacheItemPositions();
|
|
2138
|
-
this._cacheParentPositions();
|
|
2139
|
-
}
|
|
2140
2246
|
/**
|
|
2141
2247
|
* Checks whether the user's pointer is positioned over the container.
|
|
2142
2248
|
* @param x Pointer position along the X axis.
|
|
@@ -2220,22 +2326,7 @@ class DropListRef {
|
|
|
2220
2326
|
if (this.isDragging()) {
|
|
2221
2327
|
const scrollDifference = this._parentPositions.handleScroll(event);
|
|
2222
2328
|
if (scrollDifference) {
|
|
2223
|
-
|
|
2224
|
-
// client rectangles ourselves. This is cheaper than re-measuring everything and
|
|
2225
|
-
// we can avoid inconsistent behavior where we might be measuring the element before
|
|
2226
|
-
// its position has changed.
|
|
2227
|
-
this._itemPositions.forEach(({ clientRect }) => {
|
|
2228
|
-
adjustClientRect(clientRect, scrollDifference.top, scrollDifference.left);
|
|
2229
|
-
});
|
|
2230
|
-
// We need two loops for this, because we want all of the cached
|
|
2231
|
-
// positions to be up-to-date before we re-sort the item.
|
|
2232
|
-
this._itemPositions.forEach(({ drag }) => {
|
|
2233
|
-
if (this._dragDropRegistry.isDragging(drag)) {
|
|
2234
|
-
// We need to re-sort the item manually, because the pointer move
|
|
2235
|
-
// events won't be dispatched while the user is scrolling.
|
|
2236
|
-
drag._sortFromLastPointerPosition();
|
|
2237
|
-
}
|
|
2238
|
-
});
|
|
2329
|
+
this._sortStrategy.updateOnScroll(scrollDifference.top, scrollDifference.left);
|
|
2239
2330
|
}
|
|
2240
2331
|
}
|
|
2241
2332
|
else if (this.isReceiving()) {
|
|
@@ -2258,7 +2349,9 @@ class DropListRef {
|
|
|
2258
2349
|
}
|
|
2259
2350
|
/** Notifies any siblings that may potentially receive the item. */
|
|
2260
2351
|
_notifyReceivingSiblings() {
|
|
2261
|
-
const draggedItems = this.
|
|
2352
|
+
const draggedItems = this._sortStrategy
|
|
2353
|
+
.getActiveItemsSnapshot()
|
|
2354
|
+
.filter(item => item.isDragging());
|
|
2262
2355
|
this._siblings.forEach(sibling => sibling._startReceiving(this, draggedItems));
|
|
2263
2356
|
}
|
|
2264
2357
|
}
|
|
@@ -2552,9 +2645,9 @@ class DragDropRegistry {
|
|
|
2552
2645
|
this._globalListeners.clear();
|
|
2553
2646
|
}
|
|
2554
2647
|
}
|
|
2555
|
-
DragDropRegistry.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
2556
|
-
DragDropRegistry.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
2557
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
2648
|
+
DragDropRegistry.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DragDropRegistry, deps: [{ token: i0.NgZone }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2649
|
+
DragDropRegistry.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DragDropRegistry, providedIn: 'root' });
|
|
2650
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DragDropRegistry, decorators: [{
|
|
2558
2651
|
type: Injectable,
|
|
2559
2652
|
args: [{ providedIn: 'root' }]
|
|
2560
2653
|
}], ctorParameters: function () {
|
|
@@ -2602,9 +2695,9 @@ class DragDrop {
|
|
|
2602
2695
|
return new DropListRef(element, this._dragDropRegistry, this._document, this._ngZone, this._viewportRuler);
|
|
2603
2696
|
}
|
|
2604
2697
|
}
|
|
2605
|
-
DragDrop.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
2606
|
-
DragDrop.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.
|
|
2607
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
2698
|
+
DragDrop.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DragDrop, deps: [{ token: DOCUMENT }, { token: i0.NgZone }, { token: i1.ViewportRuler }, { token: DragDropRegistry }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2699
|
+
DragDrop.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DragDrop, providedIn: 'root' });
|
|
2700
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DragDrop, decorators: [{
|
|
2608
2701
|
type: Injectable,
|
|
2609
2702
|
args: [{ providedIn: 'root' }]
|
|
2610
2703
|
}], ctorParameters: function () {
|
|
@@ -2665,9 +2758,9 @@ class CdkDropListGroup {
|
|
|
2665
2758
|
this._items.clear();
|
|
2666
2759
|
}
|
|
2667
2760
|
}
|
|
2668
|
-
CdkDropListGroup.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
2669
|
-
CdkDropListGroup.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
2670
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
2761
|
+
CdkDropListGroup.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CdkDropListGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2762
|
+
CdkDropListGroup.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: CdkDropListGroup, selector: "[cdkDropListGroup]", inputs: { disabled: ["cdkDropListGroupDisabled", "disabled"] }, providers: [{ provide: CDK_DROP_LIST_GROUP, useExisting: CdkDropListGroup }], exportAs: ["cdkDropListGroup"], ngImport: i0 });
|
|
2763
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CdkDropListGroup, decorators: [{
|
|
2671
2764
|
type: Directive,
|
|
2672
2765
|
args: [{
|
|
2673
2766
|
selector: '[cdkDropListGroup]',
|
|
@@ -2956,13 +3049,13 @@ class CdkDropList {
|
|
|
2956
3049
|
}
|
|
2957
3050
|
/** Keeps track of the drop lists that are currently on the page. */
|
|
2958
3051
|
CdkDropList._dropLists = [];
|
|
2959
|
-
CdkDropList.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
2960
|
-
CdkDropList.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
3052
|
+
CdkDropList.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CdkDropList, deps: [{ token: i0.ElementRef }, { token: DragDrop }, { token: i0.ChangeDetectorRef }, { token: i1.ScrollDispatcher }, { token: i3.Directionality, optional: true }, { token: CDK_DROP_LIST_GROUP, optional: true, skipSelf: true }, { token: CDK_DRAG_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3053
|
+
CdkDropList.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: { connectedTo: ["cdkDropListConnectedTo", "connectedTo"], data: ["cdkDropListData", "data"], orientation: ["cdkDropListOrientation", "orientation"], id: "id", lockAxis: ["cdkDropListLockAxis", "lockAxis"], disabled: ["cdkDropListDisabled", "disabled"], sortingDisabled: ["cdkDropListSortingDisabled", "sortingDisabled"], enterPredicate: ["cdkDropListEnterPredicate", "enterPredicate"], sortPredicate: ["cdkDropListSortPredicate", "sortPredicate"], autoScrollDisabled: ["cdkDropListAutoScrollDisabled", "autoScrollDisabled"], autoScrollStep: ["cdkDropListAutoScrollStep", "autoScrollStep"] }, outputs: { dropped: "cdkDropListDropped", entered: "cdkDropListEntered", exited: "cdkDropListExited", sorted: "cdkDropListSorted" }, host: { properties: { "attr.id": "id", "class.cdk-drop-list-disabled": "disabled", "class.cdk-drop-list-dragging": "_dropListRef.isDragging()", "class.cdk-drop-list-receiving": "_dropListRef.isReceiving()" }, classAttribute: "cdk-drop-list" }, providers: [
|
|
2961
3054
|
// Prevent child drop lists from picking up the same group as their parent.
|
|
2962
3055
|
{ provide: CDK_DROP_LIST_GROUP, useValue: undefined },
|
|
2963
3056
|
{ provide: CDK_DROP_LIST, useExisting: CdkDropList },
|
|
2964
3057
|
], exportAs: ["cdkDropList"], ngImport: i0 });
|
|
2965
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
3058
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CdkDropList, decorators: [{
|
|
2966
3059
|
type: Directive,
|
|
2967
3060
|
args: [{
|
|
2968
3061
|
selector: '[cdkDropList], cdk-drop-list',
|
|
@@ -3079,9 +3172,9 @@ class CdkDragHandle {
|
|
|
3079
3172
|
this._stateChanges.complete();
|
|
3080
3173
|
}
|
|
3081
3174
|
}
|
|
3082
|
-
CdkDragHandle.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
3083
|
-
CdkDragHandle.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
3084
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
3175
|
+
CdkDragHandle.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CdkDragHandle, deps: [{ token: i0.ElementRef }, { token: CDK_DRAG_PARENT, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3176
|
+
CdkDragHandle.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: CdkDragHandle, selector: "[cdkDragHandle]", inputs: { disabled: ["cdkDragHandleDisabled", "disabled"] }, host: { classAttribute: "cdk-drag-handle" }, providers: [{ provide: CDK_DRAG_HANDLE, useExisting: CdkDragHandle }], ngImport: i0 });
|
|
3177
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CdkDragHandle, decorators: [{
|
|
3085
3178
|
type: Directive,
|
|
3086
3179
|
args: [{
|
|
3087
3180
|
selector: '[cdkDragHandle]',
|
|
@@ -3126,9 +3219,9 @@ class CdkDragPlaceholder {
|
|
|
3126
3219
|
this.templateRef = templateRef;
|
|
3127
3220
|
}
|
|
3128
3221
|
}
|
|
3129
|
-
CdkDragPlaceholder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
3130
|
-
CdkDragPlaceholder.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
3131
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
3222
|
+
CdkDragPlaceholder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CdkDragPlaceholder, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3223
|
+
CdkDragPlaceholder.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: CdkDragPlaceholder, selector: "ng-template[cdkDragPlaceholder]", inputs: { data: "data" }, providers: [{ provide: CDK_DRAG_PLACEHOLDER, useExisting: CdkDragPlaceholder }], ngImport: i0 });
|
|
3224
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CdkDragPlaceholder, decorators: [{
|
|
3132
3225
|
type: Directive,
|
|
3133
3226
|
args: [{
|
|
3134
3227
|
selector: 'ng-template[cdkDragPlaceholder]',
|
|
@@ -3168,9 +3261,9 @@ class CdkDragPreview {
|
|
|
3168
3261
|
this._matchSize = coerceBooleanProperty(value);
|
|
3169
3262
|
}
|
|
3170
3263
|
}
|
|
3171
|
-
CdkDragPreview.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
3172
|
-
CdkDragPreview.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
3173
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
3264
|
+
CdkDragPreview.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CdkDragPreview, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3265
|
+
CdkDragPreview.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: CdkDragPreview, selector: "ng-template[cdkDragPreview]", inputs: { data: "data", matchSize: "matchSize" }, providers: [{ provide: CDK_DRAG_PREVIEW, useExisting: CdkDragPreview }], ngImport: i0 });
|
|
3266
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CdkDragPreview, decorators: [{
|
|
3174
3267
|
type: Directive,
|
|
3175
3268
|
args: [{
|
|
3176
3269
|
selector: 'ng-template[cdkDragPreview]',
|
|
@@ -3539,9 +3632,9 @@ class CdkDrag {
|
|
|
3539
3632
|
}
|
|
3540
3633
|
}
|
|
3541
3634
|
CdkDrag._dragInstances = [];
|
|
3542
|
-
CdkDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
3543
|
-
CdkDrag.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.
|
|
3544
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
3635
|
+
CdkDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CdkDrag, deps: [{ token: i0.ElementRef }, { token: CDK_DROP_LIST, optional: true, skipSelf: true }, { token: DOCUMENT }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: CDK_DRAG_CONFIG, optional: true }, { token: i3.Directionality, optional: true }, { token: DragDrop }, { token: i0.ChangeDetectorRef }, { token: CDK_DRAG_HANDLE, optional: true, self: true }, { token: CDK_DRAG_PARENT, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3636
|
+
CdkDrag.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: CdkDrag, selector: "[cdkDrag]", inputs: { data: ["cdkDragData", "data"], lockAxis: ["cdkDragLockAxis", "lockAxis"], rootElementSelector: ["cdkDragRootElement", "rootElementSelector"], boundaryElement: ["cdkDragBoundary", "boundaryElement"], dragStartDelay: ["cdkDragStartDelay", "dragStartDelay"], freeDragPosition: ["cdkDragFreeDragPosition", "freeDragPosition"], disabled: ["cdkDragDisabled", "disabled"], constrainPosition: ["cdkDragConstrainPosition", "constrainPosition"], previewClass: ["cdkDragPreviewClass", "previewClass"], previewContainer: ["cdkDragPreviewContainer", "previewContainer"] }, outputs: { started: "cdkDragStarted", released: "cdkDragReleased", ended: "cdkDragEnded", entered: "cdkDragEntered", exited: "cdkDragExited", dropped: "cdkDragDropped", moved: "cdkDragMoved" }, host: { properties: { "class.cdk-drag-disabled": "disabled", "class.cdk-drag-dragging": "_dragRef.isDragging()" }, classAttribute: "cdk-drag" }, providers: [{ provide: CDK_DRAG_PARENT, useExisting: CdkDrag }], queries: [{ propertyName: "_previewTemplate", first: true, predicate: CDK_DRAG_PREVIEW, descendants: true }, { propertyName: "_placeholderTemplate", first: true, predicate: CDK_DRAG_PLACEHOLDER, descendants: true }, { propertyName: "_handles", predicate: CDK_DRAG_HANDLE, descendants: true }], exportAs: ["cdkDrag"], usesOnChanges: true, ngImport: i0 });
|
|
3637
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CdkDrag, decorators: [{
|
|
3545
3638
|
type: Directive,
|
|
3546
3639
|
args: [{
|
|
3547
3640
|
selector: '[cdkDrag]',
|
|
@@ -3657,8 +3750,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.1", ng
|
|
|
3657
3750
|
*/
|
|
3658
3751
|
class DragDropModule {
|
|
3659
3752
|
}
|
|
3660
|
-
DragDropModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.
|
|
3661
|
-
DragDropModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.
|
|
3753
|
+
DragDropModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DragDropModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3754
|
+
DragDropModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: DragDropModule, declarations: [CdkDropList,
|
|
3662
3755
|
CdkDropListGroup,
|
|
3663
3756
|
CdkDrag,
|
|
3664
3757
|
CdkDragHandle,
|
|
@@ -3670,8 +3763,8 @@ DragDropModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version:
|
|
|
3670
3763
|
CdkDragHandle,
|
|
3671
3764
|
CdkDragPreview,
|
|
3672
3765
|
CdkDragPlaceholder] });
|
|
3673
|
-
DragDropModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.
|
|
3674
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.
|
|
3766
|
+
DragDropModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DragDropModule, providers: [DragDrop], imports: [CdkScrollableModule] });
|
|
3767
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DragDropModule, decorators: [{
|
|
3675
3768
|
type: NgModule,
|
|
3676
3769
|
args: [{
|
|
3677
3770
|
declarations: [
|