@angular/cdk 16.0.2 → 16.0.3

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.
Files changed (31) hide show
  1. package/drag-drop/index.d.ts +26 -51
  2. package/esm2022/drag-drop/directives/drag.mjs +8 -3
  3. package/esm2022/drag-drop/directives/drop-list.mjs +3 -8
  4. package/esm2022/drag-drop/drag-events.mjs +1 -1
  5. package/esm2022/drag-drop/drag-ref.mjs +1 -1
  6. package/esm2022/drag-drop/drop-list-ref.mjs +1 -1
  7. package/esm2022/drag-drop/public-api.mjs +2 -2
  8. package/esm2022/overlay/dispatchers/base-overlay-dispatcher.mjs +1 -1
  9. package/esm2022/overlay/dispatchers/overlay-keyboard-dispatcher.mjs +1 -1
  10. package/esm2022/overlay/dispatchers/overlay-outside-click-dispatcher.mjs +1 -1
  11. package/esm2022/overlay/overlay-ref.mjs +1 -1
  12. package/esm2022/overlay/position/flexible-connected-position-strategy.mjs +1 -1
  13. package/esm2022/overlay/position/global-position-strategy.mjs +1 -1
  14. package/esm2022/overlay/position/position-strategy.mjs +1 -1
  15. package/esm2022/overlay/scroll/close-scroll-strategy.mjs +1 -1
  16. package/esm2022/overlay/scroll/reposition-scroll-strategy.mjs +1 -1
  17. package/esm2022/overlay/scroll/scroll-strategy.mjs +1 -1
  18. package/esm2022/scrolling/scroll-dispatcher.mjs +1 -1
  19. package/esm2022/scrolling/virtual-scroll-strategy.mjs +1 -1
  20. package/esm2022/version.mjs +1 -1
  21. package/fesm2022/cdk.mjs +1 -1
  22. package/fesm2022/cdk.mjs.map +1 -1
  23. package/fesm2022/drag-drop.mjs +733 -733
  24. package/fesm2022/drag-drop.mjs.map +1 -1
  25. package/fesm2022/overlay.mjs.map +1 -1
  26. package/fesm2022/scrolling.mjs.map +1 -1
  27. package/overlay/index.d.ts +12 -42
  28. package/package.json +1 -1
  29. package/schematics/ng-add/index.js +1 -1
  30. package/schematics/ng-add/index.mjs +1 -1
  31. package/esm2022/overlay/overlay-reference.mjs +0 -9
@@ -1,14 +1,14 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Inject, InjectionToken, Directive, Input, EventEmitter, Optional, SkipSelf, Output, Self, ContentChildren, ContentChild, NgModule } from '@angular/core';
2
+ import { Injectable, Inject, InjectionToken, Directive, Optional, SkipSelf, Input, EventEmitter, Self, ContentChildren, ContentChild, Output, NgModule } from '@angular/core';
3
3
  import { DOCUMENT } from '@angular/common';
4
4
  import * as i1 from '@angular/cdk/scrolling';
5
5
  import { CdkScrollableModule } from '@angular/cdk/scrolling';
6
6
  import { _getEventTarget, normalizePassiveListenerOptions, _getShadowRoot } from '@angular/cdk/platform';
7
- import { coerceBooleanProperty, coerceElement, coerceArray, coerceNumberProperty } from '@angular/cdk/coercion';
7
+ import { coerceBooleanProperty, coerceElement, coerceNumberProperty, coerceArray } from '@angular/cdk/coercion';
8
8
  import { isFakeTouchstartFromScreenReader, isFakeMousedownFromScreenReader } from '@angular/cdk/a11y';
9
9
  import { Subject, Subscription, interval, animationFrameScheduler, Observable, merge } from 'rxjs';
10
- import { takeUntil, startWith, map, take, tap, switchMap } from 'rxjs/operators';
11
- import * as i3 from '@angular/cdk/bidi';
10
+ import { takeUntil, map, take, startWith, tap, switchMap } from 'rxjs/operators';
11
+ import * as i1$1 from '@angular/cdk/bidi';
12
12
 
13
13
  /**
14
14
  * Shallow-extends a stylesheet object with another stylesheet-like object.
@@ -2640,270 +2640,431 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
2640
2640
  const CDK_DRAG_PARENT = new InjectionToken('CDK_DRAG_PARENT');
2641
2641
 
2642
2642
  /**
2643
- * Injection token that can be used to reference instances of `CdkDropListGroup`. It serves as
2644
- * alternative token to the actual `CdkDropListGroup` class which could cause unnecessary
2645
- * retention of the class and its directive metadata.
2643
+ * Asserts that a particular node is an element.
2644
+ * @param node Node to be checked.
2645
+ * @param name Name to attach to the error message.
2646
2646
  */
2647
- const CDK_DROP_LIST_GROUP = new InjectionToken('CdkDropListGroup');
2647
+ function assertElementNode(node, name) {
2648
+ if (node.nodeType !== 1) {
2649
+ throw Error(`${name} must be attached to an element node. ` + `Currently attached to "${node.nodeName}".`);
2650
+ }
2651
+ }
2652
+
2648
2653
  /**
2649
- * Declaratively connects sibling `cdkDropList` instances together. All of the `cdkDropList`
2650
- * elements that are placed inside a `cdkDropListGroup` will be connected to each other
2651
- * automatically. Can be used as an alternative to the `cdkDropListConnectedTo` input
2652
- * from `cdkDropList`.
2654
+ * Injection token that can be used to reference instances of `CdkDragHandle`. It serves as
2655
+ * alternative token to the actual `CdkDragHandle` class which could cause unnecessary
2656
+ * retention of the class and its directive metadata.
2653
2657
  */
2654
- class CdkDropListGroup {
2655
- constructor() {
2656
- /** Drop lists registered inside the group. */
2657
- this._items = new Set();
2658
- this._disabled = false;
2659
- }
2660
- /** Whether starting a dragging sequence from inside this group is disabled. */
2658
+ const CDK_DRAG_HANDLE = new InjectionToken('CdkDragHandle');
2659
+ /** Handle that can be used to drag a CdkDrag instance. */
2660
+ class CdkDragHandle {
2661
+ /** Whether starting to drag through this handle is disabled. */
2661
2662
  get disabled() {
2662
2663
  return this._disabled;
2663
2664
  }
2664
2665
  set disabled(value) {
2665
2666
  this._disabled = coerceBooleanProperty(value);
2667
+ this._stateChanges.next(this);
2668
+ }
2669
+ constructor(element, parentDrag) {
2670
+ this.element = element;
2671
+ /** Emits when the state of the handle has changed. */
2672
+ this._stateChanges = new Subject();
2673
+ this._disabled = false;
2674
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
2675
+ assertElementNode(element.nativeElement, 'cdkDragHandle');
2676
+ }
2677
+ this._parentDrag = parentDrag;
2666
2678
  }
2667
2679
  ngOnDestroy() {
2668
- this._items.clear();
2680
+ this._stateChanges.complete();
2669
2681
  }
2670
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDropListGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2671
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkDropListGroup, isStandalone: true, selector: "[cdkDropListGroup]", inputs: { disabled: ["cdkDropListGroupDisabled", "disabled"] }, providers: [{ provide: CDK_DROP_LIST_GROUP, useExisting: CdkDropListGroup }], exportAs: ["cdkDropListGroup"], ngImport: i0 }); }
2682
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDragHandle, deps: [{ token: i0.ElementRef }, { token: CDK_DRAG_PARENT, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive }); }
2683
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkDragHandle, isStandalone: true, selector: "[cdkDragHandle]", inputs: { disabled: ["cdkDragHandleDisabled", "disabled"] }, host: { classAttribute: "cdk-drag-handle" }, providers: [{ provide: CDK_DRAG_HANDLE, useExisting: CdkDragHandle }], ngImport: i0 }); }
2672
2684
  }
2673
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDropListGroup, decorators: [{
2685
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDragHandle, decorators: [{
2674
2686
  type: Directive,
2675
2687
  args: [{
2676
- selector: '[cdkDropListGroup]',
2677
- exportAs: 'cdkDropListGroup',
2688
+ selector: '[cdkDragHandle]',
2678
2689
  standalone: true,
2679
- providers: [{ provide: CDK_DROP_LIST_GROUP, useExisting: CdkDropListGroup }],
2690
+ host: {
2691
+ 'class': 'cdk-drag-handle',
2692
+ },
2693
+ providers: [{ provide: CDK_DRAG_HANDLE, useExisting: CdkDragHandle }],
2680
2694
  }]
2681
- }], propDecorators: { disabled: [{
2695
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: undefined, decorators: [{
2696
+ type: Inject,
2697
+ args: [CDK_DRAG_PARENT]
2698
+ }, {
2699
+ type: Optional
2700
+ }, {
2701
+ type: SkipSelf
2702
+ }] }]; }, propDecorators: { disabled: [{
2682
2703
  type: Input,
2683
- args: ['cdkDropListGroupDisabled']
2704
+ args: ['cdkDragHandleDisabled']
2684
2705
  }] } });
2685
2706
 
2686
2707
  /**
2687
- * Injection token that can be used to configure the
2688
- * behavior of the drag&drop-related components.
2708
+ * Injection token that can be used to reference instances of `CdkDragPlaceholder`. It serves as
2709
+ * alternative token to the actual `CdkDragPlaceholder` class which could cause unnecessary
2710
+ * retention of the class and its directive metadata.
2689
2711
  */
2690
- const CDK_DRAG_CONFIG = new InjectionToken('CDK_DRAG_CONFIG');
2712
+ const CDK_DRAG_PLACEHOLDER = new InjectionToken('CdkDragPlaceholder');
2713
+ /**
2714
+ * Element that will be used as a template for the placeholder of a CdkDrag when
2715
+ * it is being dragged. The placeholder is displayed in place of the element being dragged.
2716
+ */
2717
+ class CdkDragPlaceholder {
2718
+ constructor(templateRef) {
2719
+ this.templateRef = templateRef;
2720
+ }
2721
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDragPlaceholder, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
2722
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkDragPlaceholder, isStandalone: true, selector: "ng-template[cdkDragPlaceholder]", inputs: { data: "data" }, providers: [{ provide: CDK_DRAG_PLACEHOLDER, useExisting: CdkDragPlaceholder }], ngImport: i0 }); }
2723
+ }
2724
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDragPlaceholder, decorators: [{
2725
+ type: Directive,
2726
+ args: [{
2727
+ selector: 'ng-template[cdkDragPlaceholder]',
2728
+ standalone: true,
2729
+ providers: [{ provide: CDK_DRAG_PLACEHOLDER, useExisting: CdkDragPlaceholder }],
2730
+ }]
2731
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { data: [{
2732
+ type: Input
2733
+ }] } });
2691
2734
 
2692
2735
  /**
2693
- * Asserts that a particular node is an element.
2694
- * @param node Node to be checked.
2695
- * @param name Name to attach to the error message.
2736
+ * Injection token that can be used to reference instances of `CdkDragPreview`. It serves as
2737
+ * alternative token to the actual `CdkDragPreview` class which could cause unnecessary
2738
+ * retention of the class and its directive metadata.
2696
2739
  */
2697
- function assertElementNode(node, name) {
2698
- if (node.nodeType !== 1) {
2699
- throw Error(`${name} must be attached to an element node. ` + `Currently attached to "${node.nodeName}".`);
2740
+ const CDK_DRAG_PREVIEW = new InjectionToken('CdkDragPreview');
2741
+ /**
2742
+ * Element that will be used as a template for the preview
2743
+ * of a CdkDrag when it is being dragged.
2744
+ */
2745
+ class CdkDragPreview {
2746
+ /** Whether the preview should preserve the same size as the item that is being dragged. */
2747
+ get matchSize() {
2748
+ return this._matchSize;
2749
+ }
2750
+ set matchSize(value) {
2751
+ this._matchSize = coerceBooleanProperty(value);
2752
+ }
2753
+ constructor(templateRef) {
2754
+ this.templateRef = templateRef;
2755
+ this._matchSize = false;
2700
2756
  }
2757
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDragPreview, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
2758
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkDragPreview, isStandalone: true, selector: "ng-template[cdkDragPreview]", inputs: { data: "data", matchSize: "matchSize" }, providers: [{ provide: CDK_DRAG_PREVIEW, useExisting: CdkDragPreview }], ngImport: i0 }); }
2701
2759
  }
2760
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDragPreview, decorators: [{
2761
+ type: Directive,
2762
+ args: [{
2763
+ selector: 'ng-template[cdkDragPreview]',
2764
+ standalone: true,
2765
+ providers: [{ provide: CDK_DRAG_PREVIEW, useExisting: CdkDragPreview }],
2766
+ }]
2767
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { data: [{
2768
+ type: Input
2769
+ }], matchSize: [{
2770
+ type: Input
2771
+ }] } });
2702
2772
 
2703
- /** Counter used to generate unique ids for drop zones. */
2704
- let _uniqueIdCounter = 0;
2773
+ /**
2774
+ * Injection token that can be used to configure the
2775
+ * behavior of the drag&drop-related components.
2776
+ */
2777
+ const CDK_DRAG_CONFIG = new InjectionToken('CDK_DRAG_CONFIG');
2778
+
2779
+ const DRAG_HOST_CLASS = 'cdk-drag';
2705
2780
  /**
2706
2781
  * Injection token that can be used to reference instances of `CdkDropList`. It serves as
2707
2782
  * alternative token to the actual `CdkDropList` class which could cause unnecessary
2708
2783
  * retention of the class and its directive metadata.
2709
2784
  */
2710
2785
  const CDK_DROP_LIST = new InjectionToken('CdkDropList');
2711
- /** Container that wraps a set of draggable items. */
2712
- class CdkDropList {
2713
- /** Keeps track of the drop lists that are currently on the page. */
2714
- static { this._dropLists = []; }
2715
- /** Whether starting a dragging sequence from this container is disabled. */
2786
+ /** Element that can be moved inside a CdkDropList container. */
2787
+ class CdkDrag {
2788
+ static { this._dragInstances = []; }
2789
+ /** Whether starting to drag this element is disabled. */
2716
2790
  get disabled() {
2717
- return this._disabled || (!!this._group && this._group.disabled);
2791
+ return this._disabled || (this.dropContainer && this.dropContainer.disabled);
2718
2792
  }
2719
2793
  set disabled(value) {
2720
- // Usually we sync the directive and ref state right before dragging starts, in order to have
2721
- // a single point of failure and to avoid having to use setters for everything. `disabled` is
2722
- // a special case, because it can prevent the `beforeStarted` event from firing, which can lock
2723
- // the user in a disabled state, so we also need to sync it as it's being set.
2724
- this._dropListRef.disabled = this._disabled = coerceBooleanProperty(value);
2794
+ this._disabled = coerceBooleanProperty(value);
2795
+ this._dragRef.disabled = this._disabled;
2725
2796
  }
2726
2797
  constructor(
2727
- /** Element that the drop list is attached to. */
2728
- element, dragDrop, _changeDetectorRef, _scrollDispatcher, _dir, _group, config) {
2798
+ /** Element that the draggable is attached to. */
2799
+ element,
2800
+ /** Droppable container that the draggable is a part of. */
2801
+ dropContainer,
2802
+ /**
2803
+ * @deprecated `_document` parameter no longer being used and will be removed.
2804
+ * @breaking-change 12.0.0
2805
+ */
2806
+ _document, _ngZone, _viewContainerRef, config, _dir, dragDrop, _changeDetectorRef, _selfHandle, _parentDrag) {
2729
2807
  this.element = element;
2730
- this._changeDetectorRef = _changeDetectorRef;
2731
- this._scrollDispatcher = _scrollDispatcher;
2808
+ this.dropContainer = dropContainer;
2809
+ this._ngZone = _ngZone;
2810
+ this._viewContainerRef = _viewContainerRef;
2732
2811
  this._dir = _dir;
2733
- this._group = _group;
2734
- /** Emits when the list has been destroyed. */
2812
+ this._changeDetectorRef = _changeDetectorRef;
2813
+ this._selfHandle = _selfHandle;
2814
+ this._parentDrag = _parentDrag;
2735
2815
  this._destroyed = new Subject();
2736
- /**
2737
- * Other draggable containers that this container is connected to and into which the
2738
- * container's items can be transferred. Can either be references to other drop containers,
2739
- * or their unique IDs.
2740
- */
2741
- this.connectedTo = [];
2742
- /**
2743
- * Unique ID for the drop zone. Can be used as a reference
2744
- * in the `connectedTo` of another `CdkDropList`.
2745
- */
2746
- this.id = `cdk-drop-list-${_uniqueIdCounter++}`;
2747
- /**
2748
- * Function that is used to determine whether an item
2749
- * is allowed to be moved into a drop container.
2750
- */
2751
- this.enterPredicate = () => true;
2752
- /** Functions that is used to determine whether an item can be sorted into a particular index. */
2753
- this.sortPredicate = () => true;
2754
- /** Emits when the user drops an item inside the container. */
2755
- this.dropped = new EventEmitter();
2756
- /**
2757
- * Emits when the user has moved a new drag item into this container.
2758
- */
2816
+ /** Emits when the user starts dragging the item. */
2817
+ this.started = new EventEmitter();
2818
+ /** Emits when the user has released a drag item, before any animations have started. */
2819
+ this.released = new EventEmitter();
2820
+ /** Emits when the user stops dragging an item in the container. */
2821
+ this.ended = new EventEmitter();
2822
+ /** Emits when the user has moved the item into a new container. */
2759
2823
  this.entered = new EventEmitter();
2760
- /**
2761
- * Emits when the user removes an item from the container
2762
- * by dragging it into another container.
2763
- */
2824
+ /** Emits when the user removes the item its container by dragging it into another container. */
2764
2825
  this.exited = new EventEmitter();
2765
- /** Emits as the user is swapping items while actively dragging. */
2766
- this.sorted = new EventEmitter();
2826
+ /** Emits when the user drops the item inside a container. */
2827
+ this.dropped = new EventEmitter();
2767
2828
  /**
2768
- * Keeps track of the items that are registered with this container. Historically we used to
2769
- * do this with a `ContentChildren` query, however queries don't handle transplanted views very
2770
- * well which means that we can't handle cases like dragging the headers of a `mat-table`
2771
- * correctly. What we do instead is to have the items register themselves with the container
2772
- * and then we sort them based on their position in the DOM.
2829
+ * Emits as the user is dragging the item. Use with caution,
2830
+ * because this event will fire for every pixel that the user has dragged.
2773
2831
  */
2774
- this._unsortedItems = new Set();
2775
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
2776
- assertElementNode(element.nativeElement, 'cdkDropList');
2777
- }
2778
- this._dropListRef = dragDrop.createDropList(element);
2779
- this._dropListRef.data = this;
2780
- if (config) {
2781
- this._assignDefaults(config);
2782
- }
2783
- this._dropListRef.enterPredicate = (drag, drop) => {
2784
- return this.enterPredicate(drag.data, drop.data);
2785
- };
2786
- this._dropListRef.sortPredicate = (index, drag, drop) => {
2787
- return this.sortPredicate(index, drag.data, drop.data);
2788
- };
2789
- this._setupInputSyncSubscription(this._dropListRef);
2790
- this._handleEvents(this._dropListRef);
2791
- CdkDropList._dropLists.push(this);
2792
- if (_group) {
2793
- _group._items.add(this);
2794
- }
2795
- }
2796
- /** Registers an items with the drop list. */
2797
- addItem(item) {
2798
- this._unsortedItems.add(item);
2799
- if (this._dropListRef.isDragging()) {
2800
- this._syncItemsWithRef();
2832
+ this.moved = new Observable((observer) => {
2833
+ const subscription = this._dragRef.moved
2834
+ .pipe(map(movedEvent => ({
2835
+ source: this,
2836
+ pointerPosition: movedEvent.pointerPosition,
2837
+ event: movedEvent.event,
2838
+ delta: movedEvent.delta,
2839
+ distance: movedEvent.distance,
2840
+ })))
2841
+ .subscribe(observer);
2842
+ return () => {
2843
+ subscription.unsubscribe();
2844
+ };
2845
+ });
2846
+ this._dragRef = dragDrop.createDrag(element, {
2847
+ dragStartThreshold: config && config.dragStartThreshold != null ? config.dragStartThreshold : 5,
2848
+ pointerDirectionChangeThreshold: config && config.pointerDirectionChangeThreshold != null
2849
+ ? config.pointerDirectionChangeThreshold
2850
+ : 5,
2851
+ zIndex: config?.zIndex,
2852
+ });
2853
+ this._dragRef.data = this;
2854
+ // We have to keep track of the drag instances in order to be able to match an element to
2855
+ // a drag instance. We can't go through the global registry of `DragRef`, because the root
2856
+ // element could be different.
2857
+ CdkDrag._dragInstances.push(this);
2858
+ if (config) {
2859
+ this._assignDefaults(config);
2801
2860
  }
2802
- }
2803
- /** Removes an item from the drop list. */
2804
- removeItem(item) {
2805
- this._unsortedItems.delete(item);
2806
- if (this._dropListRef.isDragging()) {
2807
- this._syncItemsWithRef();
2861
+ // Note that usually the container is assigned when the drop list is picks up the item, but in
2862
+ // some cases (mainly transplanted views with OnPush, see #18341) we may end up in a situation
2863
+ // where there are no items on the first change detection pass, but the items get picked up as
2864
+ // soon as the user triggers another pass by dragging. This is a problem, because the item would
2865
+ // have to switch from standalone mode to drag mode in the middle of the dragging sequence which
2866
+ // is too late since the two modes save different kinds of information. We work around it by
2867
+ // assigning the drop container both from here and the list.
2868
+ if (dropContainer) {
2869
+ this._dragRef._withDropContainer(dropContainer._dropListRef);
2870
+ dropContainer.addItem(this);
2808
2871
  }
2872
+ this._syncInputs(this._dragRef);
2873
+ this._handleEvents(this._dragRef);
2809
2874
  }
2810
- /** Gets the registered items in the list, sorted by their position in the DOM. */
2811
- getSortedItems() {
2812
- return Array.from(this._unsortedItems).sort((a, b) => {
2813
- const documentPosition = a._dragRef
2814
- .getVisibleElement()
2815
- .compareDocumentPosition(b._dragRef.getVisibleElement());
2816
- // `compareDocumentPosition` returns a bitmask so we have to use a bitwise operator.
2817
- // https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
2818
- // tslint:disable-next-line:no-bitwise
2819
- return documentPosition & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
2875
+ /**
2876
+ * Returns the element that is being used as a placeholder
2877
+ * while the current element is being dragged.
2878
+ */
2879
+ getPlaceholderElement() {
2880
+ return this._dragRef.getPlaceholderElement();
2881
+ }
2882
+ /** Returns the root draggable element. */
2883
+ getRootElement() {
2884
+ return this._dragRef.getRootElement();
2885
+ }
2886
+ /** Resets a standalone drag item to its initial position. */
2887
+ reset() {
2888
+ this._dragRef.reset();
2889
+ }
2890
+ /**
2891
+ * Gets the pixel coordinates of the draggable outside of a drop container.
2892
+ */
2893
+ getFreeDragPosition() {
2894
+ return this._dragRef.getFreeDragPosition();
2895
+ }
2896
+ /**
2897
+ * Sets the current position in pixels the draggable outside of a drop container.
2898
+ * @param value New position to be set.
2899
+ */
2900
+ setFreeDragPosition(value) {
2901
+ this._dragRef.setFreeDragPosition(value);
2902
+ }
2903
+ ngAfterViewInit() {
2904
+ // Normally this isn't in the zone, but it can cause major performance regressions for apps
2905
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
2906
+ this._ngZone.runOutsideAngular(() => {
2907
+ // We need to wait for the zone to stabilize, in order for the reference
2908
+ // element to be in the proper place in the DOM. This is mostly relevant
2909
+ // for draggable elements inside portals since they get stamped out in
2910
+ // their original DOM position and then they get transferred to the portal.
2911
+ this._ngZone.onStable.pipe(take(1), takeUntil(this._destroyed)).subscribe(() => {
2912
+ this._updateRootElement();
2913
+ this._setupHandlesListener();
2914
+ if (this.freeDragPosition) {
2915
+ this._dragRef.setFreeDragPosition(this.freeDragPosition);
2916
+ }
2917
+ });
2820
2918
  });
2821
2919
  }
2920
+ ngOnChanges(changes) {
2921
+ const rootSelectorChange = changes['rootElementSelector'];
2922
+ const positionChange = changes['freeDragPosition'];
2923
+ // We don't have to react to the first change since it's being
2924
+ // handled in `ngAfterViewInit` where it needs to be deferred.
2925
+ if (rootSelectorChange && !rootSelectorChange.firstChange) {
2926
+ this._updateRootElement();
2927
+ }
2928
+ // Skip the first change since it's being handled in `ngAfterViewInit`.
2929
+ if (positionChange && !positionChange.firstChange && this.freeDragPosition) {
2930
+ this._dragRef.setFreeDragPosition(this.freeDragPosition);
2931
+ }
2932
+ }
2822
2933
  ngOnDestroy() {
2823
- const index = CdkDropList._dropLists.indexOf(this);
2934
+ if (this.dropContainer) {
2935
+ this.dropContainer.removeItem(this);
2936
+ }
2937
+ const index = CdkDrag._dragInstances.indexOf(this);
2824
2938
  if (index > -1) {
2825
- CdkDropList._dropLists.splice(index, 1);
2939
+ CdkDrag._dragInstances.splice(index, 1);
2826
2940
  }
2827
- if (this._group) {
2828
- this._group._items.delete(this);
2941
+ // Unnecessary in most cases, but used to avoid extra change detections with `zone-paths-rxjs`.
2942
+ this._ngZone.runOutsideAngular(() => {
2943
+ this._destroyed.next();
2944
+ this._destroyed.complete();
2945
+ this._dragRef.dispose();
2946
+ });
2947
+ }
2948
+ /** Syncs the root element with the `DragRef`. */
2949
+ _updateRootElement() {
2950
+ const element = this.element.nativeElement;
2951
+ let rootElement = element;
2952
+ if (this.rootElementSelector) {
2953
+ rootElement =
2954
+ element.closest !== undefined
2955
+ ? element.closest(this.rootElementSelector)
2956
+ : // Comment tag doesn't have closest method, so use parent's one.
2957
+ element.parentElement?.closest(this.rootElementSelector);
2829
2958
  }
2830
- this._unsortedItems.clear();
2831
- this._dropListRef.dispose();
2832
- this._destroyed.next();
2833
- this._destroyed.complete();
2959
+ if (rootElement && (typeof ngDevMode === 'undefined' || ngDevMode)) {
2960
+ assertElementNode(rootElement, 'cdkDrag');
2961
+ }
2962
+ this._dragRef.withRootElement(rootElement || element);
2834
2963
  }
2835
- /** Syncs the inputs of the CdkDropList with the options of the underlying DropListRef. */
2836
- _setupInputSyncSubscription(ref) {
2837
- if (this._dir) {
2838
- this._dir.change
2839
- .pipe(startWith(this._dir.value), takeUntil(this._destroyed))
2840
- .subscribe(value => ref.withDirection(value));
2964
+ /** Gets the boundary element, based on the `boundaryElement` value. */
2965
+ _getBoundaryElement() {
2966
+ const boundary = this.boundaryElement;
2967
+ if (!boundary) {
2968
+ return null;
2969
+ }
2970
+ if (typeof boundary === 'string') {
2971
+ return this.element.nativeElement.closest(boundary);
2841
2972
  }
2973
+ return coerceElement(boundary);
2974
+ }
2975
+ /** Syncs the inputs of the CdkDrag with the options of the underlying DragRef. */
2976
+ _syncInputs(ref) {
2842
2977
  ref.beforeStarted.subscribe(() => {
2843
- const siblings = coerceArray(this.connectedTo).map(drop => {
2844
- if (typeof drop === 'string') {
2845
- const correspondingDropList = CdkDropList._dropLists.find(list => list.id === drop);
2846
- if (!correspondingDropList && (typeof ngDevMode === 'undefined' || ngDevMode)) {
2847
- console.warn(`CdkDropList could not find connected drop list with id "${drop}"`);
2978
+ if (!ref.isDragging()) {
2979
+ const dir = this._dir;
2980
+ const dragStartDelay = this.dragStartDelay;
2981
+ const placeholder = this._placeholderTemplate
2982
+ ? {
2983
+ template: this._placeholderTemplate.templateRef,
2984
+ context: this._placeholderTemplate.data,
2985
+ viewContainer: this._viewContainerRef,
2848
2986
  }
2849
- return correspondingDropList;
2850
- }
2851
- return drop;
2852
- });
2853
- if (this._group) {
2854
- this._group._items.forEach(drop => {
2855
- if (siblings.indexOf(drop) === -1) {
2856
- siblings.push(drop);
2987
+ : null;
2988
+ const preview = this._previewTemplate
2989
+ ? {
2990
+ template: this._previewTemplate.templateRef,
2991
+ context: this._previewTemplate.data,
2992
+ matchSize: this._previewTemplate.matchSize,
2993
+ viewContainer: this._viewContainerRef,
2857
2994
  }
2858
- });
2995
+ : null;
2996
+ ref.disabled = this.disabled;
2997
+ ref.lockAxis = this.lockAxis;
2998
+ ref.dragStartDelay =
2999
+ typeof dragStartDelay === 'object' && dragStartDelay
3000
+ ? dragStartDelay
3001
+ : coerceNumberProperty(dragStartDelay);
3002
+ ref.constrainPosition = this.constrainPosition;
3003
+ ref.previewClass = this.previewClass;
3004
+ ref
3005
+ .withBoundaryElement(this._getBoundaryElement())
3006
+ .withPlaceholderTemplate(placeholder)
3007
+ .withPreviewTemplate(preview)
3008
+ .withPreviewContainer(this.previewContainer || 'global');
3009
+ if (dir) {
3010
+ ref.withDirection(dir.value);
3011
+ }
2859
3012
  }
2860
- // Note that we resolve the scrollable parents here so that we delay the resolution
2861
- // as long as possible, ensuring that the element is in its final place in the DOM.
2862
- if (!this._scrollableParentsResolved) {
2863
- const scrollableParents = this._scrollDispatcher
2864
- .getAncestorScrollContainers(this.element)
2865
- .map(scrollable => scrollable.getElementRef().nativeElement);
2866
- this._dropListRef.withScrollableParents(scrollableParents);
2867
- // Only do this once since it involves traversing the DOM and the parents
2868
- // shouldn't be able to change without the drop list being destroyed.
2869
- this._scrollableParentsResolved = true;
3013
+ });
3014
+ // This only needs to be resolved once.
3015
+ ref.beforeStarted.pipe(take(1)).subscribe(() => {
3016
+ // If we managed to resolve a parent through DI, use it.
3017
+ if (this._parentDrag) {
3018
+ ref.withParent(this._parentDrag._dragRef);
3019
+ return;
3020
+ }
3021
+ // Otherwise fall back to resolving the parent by looking up the DOM. This can happen if
3022
+ // the item was projected into another item by something like `ngTemplateOutlet`.
3023
+ let parent = this.element.nativeElement.parentElement;
3024
+ while (parent) {
3025
+ if (parent.classList.contains(DRAG_HOST_CLASS)) {
3026
+ ref.withParent(CdkDrag._dragInstances.find(drag => {
3027
+ return drag.element.nativeElement === parent;
3028
+ })?._dragRef || null);
3029
+ break;
3030
+ }
3031
+ parent = parent.parentElement;
2870
3032
  }
2871
- ref.disabled = this.disabled;
2872
- ref.lockAxis = this.lockAxis;
2873
- ref.sortingDisabled = coerceBooleanProperty(this.sortingDisabled);
2874
- ref.autoScrollDisabled = coerceBooleanProperty(this.autoScrollDisabled);
2875
- ref.autoScrollStep = coerceNumberProperty(this.autoScrollStep, 2);
2876
- ref
2877
- .connectedTo(siblings.filter(drop => drop && drop !== this).map(list => list._dropListRef))
2878
- .withOrientation(this.orientation);
2879
3033
  });
2880
3034
  }
2881
- /** Handles events from the underlying DropListRef. */
3035
+ /** Handles the events from the underlying `DragRef`. */
2882
3036
  _handleEvents(ref) {
2883
- ref.beforeStarted.subscribe(() => {
2884
- this._syncItemsWithRef();
3037
+ ref.started.subscribe(startEvent => {
3038
+ this.started.emit({ source: this, event: startEvent.event });
3039
+ // Since all of these events run outside of change detection,
3040
+ // we need to ensure that everything is marked correctly.
2885
3041
  this._changeDetectorRef.markForCheck();
2886
3042
  });
2887
- ref.entered.subscribe(event => {
2888
- this.entered.emit({
2889
- container: this,
2890
- item: event.item.data,
2891
- currentIndex: event.currentIndex,
2892
- });
3043
+ ref.released.subscribe(releaseEvent => {
3044
+ this.released.emit({ source: this, event: releaseEvent.event });
2893
3045
  });
2894
- ref.exited.subscribe(event => {
2895
- this.exited.emit({
2896
- container: this,
2897
- item: event.item.data,
3046
+ ref.ended.subscribe(endEvent => {
3047
+ this.ended.emit({
3048
+ source: this,
3049
+ distance: endEvent.distance,
3050
+ dropPoint: endEvent.dropPoint,
3051
+ event: endEvent.event,
2898
3052
  });
3053
+ // Since all of these events run outside of change detection,
3054
+ // we need to ensure that everything is marked correctly.
2899
3055
  this._changeDetectorRef.markForCheck();
2900
3056
  });
2901
- ref.sorted.subscribe(event => {
2902
- this.sorted.emit({
2903
- previousIndex: event.previousIndex,
2904
- currentIndex: event.currentIndex,
2905
- container: this,
2906
- item: event.item.data,
3057
+ ref.entered.subscribe(enterEvent => {
3058
+ this.entered.emit({
3059
+ container: enterEvent.container.data,
3060
+ item: this,
3061
+ currentIndex: enterEvent.currentIndex,
3062
+ });
3063
+ });
3064
+ ref.exited.subscribe(exitEvent => {
3065
+ this.exited.emit({
3066
+ container: exitEvent.container.data,
3067
+ item: this,
2907
3068
  });
2908
3069
  });
2909
3070
  ref.dropped.subscribe(dropEvent => {
@@ -2912,522 +3073,420 @@ class CdkDropList {
2912
3073
  currentIndex: dropEvent.currentIndex,
2913
3074
  previousContainer: dropEvent.previousContainer.data,
2914
3075
  container: dropEvent.container.data,
2915
- item: dropEvent.item.data,
2916
3076
  isPointerOverContainer: dropEvent.isPointerOverContainer,
3077
+ item: this,
2917
3078
  distance: dropEvent.distance,
2918
3079
  dropPoint: dropEvent.dropPoint,
2919
3080
  event: dropEvent.event,
2920
3081
  });
2921
- // Mark for check since all of these events run outside of change
2922
- // detection and we're not guaranteed for something else to have triggered it.
2923
- this._changeDetectorRef.markForCheck();
2924
3082
  });
2925
- merge(ref.receivingStarted, ref.receivingStopped).subscribe(() => this._changeDetectorRef.markForCheck());
2926
3083
  }
2927
3084
  /** Assigns the default input values based on a provided config object. */
2928
3085
  _assignDefaults(config) {
2929
- const { lockAxis, draggingDisabled, sortingDisabled, listAutoScrollDisabled, listOrientation } = config;
3086
+ const { lockAxis, dragStartDelay, constrainPosition, previewClass, boundaryElement, draggingDisabled, rootElementSelector, previewContainer, } = config;
2930
3087
  this.disabled = draggingDisabled == null ? false : draggingDisabled;
2931
- this.sortingDisabled = sortingDisabled == null ? false : sortingDisabled;
2932
- this.autoScrollDisabled = listAutoScrollDisabled == null ? false : listAutoScrollDisabled;
2933
- this.orientation = listOrientation || 'vertical';
3088
+ this.dragStartDelay = dragStartDelay || 0;
2934
3089
  if (lockAxis) {
2935
3090
  this.lockAxis = lockAxis;
2936
3091
  }
3092
+ if (constrainPosition) {
3093
+ this.constrainPosition = constrainPosition;
3094
+ }
3095
+ if (previewClass) {
3096
+ this.previewClass = previewClass;
3097
+ }
3098
+ if (boundaryElement) {
3099
+ this.boundaryElement = boundaryElement;
3100
+ }
3101
+ if (rootElementSelector) {
3102
+ this.rootElementSelector = rootElementSelector;
3103
+ }
3104
+ if (previewContainer) {
3105
+ this.previewContainer = previewContainer;
3106
+ }
2937
3107
  }
2938
- /** Syncs up the registered drag items with underlying drop list ref. */
2939
- _syncItemsWithRef() {
2940
- this._dropListRef.withItems(this.getSortedItems().map(item => item._dragRef));
3108
+ /** Sets up the listener that syncs the handles with the drag ref. */
3109
+ _setupHandlesListener() {
3110
+ // Listen for any newly-added handles.
3111
+ this._handles.changes
3112
+ .pipe(startWith(this._handles),
3113
+ // Sync the new handles with the DragRef.
3114
+ tap((handles) => {
3115
+ const childHandleElements = handles
3116
+ .filter(handle => handle._parentDrag === this)
3117
+ .map(handle => handle.element);
3118
+ // Usually handles are only allowed to be a descendant of the drag element, but if
3119
+ // the consumer defined a different drag root, we should allow the drag element
3120
+ // itself to be a handle too.
3121
+ if (this._selfHandle && this.rootElementSelector) {
3122
+ childHandleElements.push(this.element);
3123
+ }
3124
+ this._dragRef.withHandles(childHandleElements);
3125
+ }),
3126
+ // Listen if the state of any of the handles changes.
3127
+ switchMap((handles) => {
3128
+ return merge(...handles.map(item => {
3129
+ return item._stateChanges.pipe(startWith(item));
3130
+ }));
3131
+ }), takeUntil(this._destroyed))
3132
+ .subscribe(handleInstance => {
3133
+ // Enabled/disable the handle that changed in the DragRef.
3134
+ const dragRef = this._dragRef;
3135
+ const handle = handleInstance.element.nativeElement;
3136
+ handleInstance.disabled ? dragRef.disableHandle(handle) : dragRef.enableHandle(handle);
3137
+ });
2941
3138
  }
2942
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", 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 }); }
2943
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkDropList, isStandalone: true, 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: [
2944
- // Prevent child drop lists from picking up the same group as their parent.
2945
- { provide: CDK_DROP_LIST_GROUP, useValue: undefined },
2946
- { provide: CDK_DROP_LIST, useExisting: CdkDropList },
2947
- ], exportAs: ["cdkDropList"], ngImport: i0 }); }
3139
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", 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: i1$1.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 }); }
3140
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkDrag, isStandalone: true, 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 }); }
2948
3141
  }
2949
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDropList, decorators: [{
3142
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDrag, decorators: [{
2950
3143
  type: Directive,
2951
3144
  args: [{
2952
- selector: '[cdkDropList], cdk-drop-list',
2953
- exportAs: 'cdkDropList',
3145
+ selector: '[cdkDrag]',
3146
+ exportAs: 'cdkDrag',
2954
3147
  standalone: true,
2955
- providers: [
2956
- // Prevent child drop lists from picking up the same group as their parent.
2957
- { provide: CDK_DROP_LIST_GROUP, useValue: undefined },
2958
- { provide: CDK_DROP_LIST, useExisting: CdkDropList },
2959
- ],
2960
3148
  host: {
2961
- 'class': 'cdk-drop-list',
2962
- '[attr.id]': 'id',
2963
- '[class.cdk-drop-list-disabled]': 'disabled',
2964
- '[class.cdk-drop-list-dragging]': '_dropListRef.isDragging()',
2965
- '[class.cdk-drop-list-receiving]': '_dropListRef.isReceiving()',
3149
+ 'class': DRAG_HOST_CLASS,
3150
+ '[class.cdk-drag-disabled]': 'disabled',
3151
+ '[class.cdk-drag-dragging]': '_dragRef.isDragging()',
2966
3152
  },
3153
+ providers: [{ provide: CDK_DRAG_PARENT, useExisting: CdkDrag }],
2967
3154
  }]
2968
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: DragDrop }, { type: i0.ChangeDetectorRef }, { type: i1.ScrollDispatcher }, { type: i3.Directionality, decorators: [{
2969
- type: Optional
2970
- }] }, { type: CdkDropListGroup, decorators: [{
2971
- type: Optional
2972
- }, {
3155
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: undefined, decorators: [{
2973
3156
  type: Inject,
2974
- args: [CDK_DROP_LIST_GROUP]
3157
+ args: [CDK_DROP_LIST]
3158
+ }, {
3159
+ type: Optional
2975
3160
  }, {
2976
3161
  type: SkipSelf
2977
3162
  }] }, { type: undefined, decorators: [{
3163
+ type: Inject,
3164
+ args: [DOCUMENT]
3165
+ }] }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
2978
3166
  type: Optional
2979
3167
  }, {
2980
3168
  type: Inject,
2981
3169
  args: [CDK_DRAG_CONFIG]
2982
- }] }]; }, propDecorators: { connectedTo: [{
2983
- type: Input,
2984
- args: ['cdkDropListConnectedTo']
2985
- }], data: [{
2986
- type: Input,
2987
- args: ['cdkDropListData']
2988
- }], orientation: [{
2989
- type: Input,
2990
- args: ['cdkDropListOrientation']
2991
- }], id: [{
2992
- type: Input
3170
+ }] }, { type: i1$1.Directionality, decorators: [{
3171
+ type: Optional
3172
+ }] }, { type: DragDrop }, { type: i0.ChangeDetectorRef }, { type: CdkDragHandle, decorators: [{
3173
+ type: Optional
3174
+ }, {
3175
+ type: Self
3176
+ }, {
3177
+ type: Inject,
3178
+ args: [CDK_DRAG_HANDLE]
3179
+ }] }, { type: CdkDrag, decorators: [{
3180
+ type: Optional
3181
+ }, {
3182
+ type: SkipSelf
3183
+ }, {
3184
+ type: Inject,
3185
+ args: [CDK_DRAG_PARENT]
3186
+ }] }]; }, propDecorators: { _handles: [{
3187
+ type: ContentChildren,
3188
+ args: [CDK_DRAG_HANDLE, { descendants: true }]
3189
+ }], _previewTemplate: [{
3190
+ type: ContentChild,
3191
+ args: [CDK_DRAG_PREVIEW]
3192
+ }], _placeholderTemplate: [{
3193
+ type: ContentChild,
3194
+ args: [CDK_DRAG_PLACEHOLDER]
3195
+ }], data: [{
3196
+ type: Input,
3197
+ args: ['cdkDragData']
2993
3198
  }], lockAxis: [{
2994
3199
  type: Input,
2995
- args: ['cdkDropListLockAxis']
2996
- }], disabled: [{
3200
+ args: ['cdkDragLockAxis']
3201
+ }], rootElementSelector: [{
2997
3202
  type: Input,
2998
- args: ['cdkDropListDisabled']
2999
- }], sortingDisabled: [{
3203
+ args: ['cdkDragRootElement']
3204
+ }], boundaryElement: [{
3000
3205
  type: Input,
3001
- args: ['cdkDropListSortingDisabled']
3002
- }], enterPredicate: [{
3206
+ args: ['cdkDragBoundary']
3207
+ }], dragStartDelay: [{
3003
3208
  type: Input,
3004
- args: ['cdkDropListEnterPredicate']
3005
- }], sortPredicate: [{
3209
+ args: ['cdkDragStartDelay']
3210
+ }], freeDragPosition: [{
3006
3211
  type: Input,
3007
- args: ['cdkDropListSortPredicate']
3008
- }], autoScrollDisabled: [{
3212
+ args: ['cdkDragFreeDragPosition']
3213
+ }], disabled: [{
3009
3214
  type: Input,
3010
- args: ['cdkDropListAutoScrollDisabled']
3011
- }], autoScrollStep: [{
3215
+ args: ['cdkDragDisabled']
3216
+ }], constrainPosition: [{
3012
3217
  type: Input,
3013
- args: ['cdkDropListAutoScrollStep']
3014
- }], dropped: [{
3218
+ args: ['cdkDragConstrainPosition']
3219
+ }], previewClass: [{
3220
+ type: Input,
3221
+ args: ['cdkDragPreviewClass']
3222
+ }], previewContainer: [{
3223
+ type: Input,
3224
+ args: ['cdkDragPreviewContainer']
3225
+ }], started: [{
3015
3226
  type: Output,
3016
- args: ['cdkDropListDropped']
3227
+ args: ['cdkDragStarted']
3228
+ }], released: [{
3229
+ type: Output,
3230
+ args: ['cdkDragReleased']
3231
+ }], ended: [{
3232
+ type: Output,
3233
+ args: ['cdkDragEnded']
3017
3234
  }], entered: [{
3018
3235
  type: Output,
3019
- args: ['cdkDropListEntered']
3236
+ args: ['cdkDragEntered']
3020
3237
  }], exited: [{
3021
3238
  type: Output,
3022
- args: ['cdkDropListExited']
3023
- }], sorted: [{
3239
+ args: ['cdkDragExited']
3240
+ }], dropped: [{
3024
3241
  type: Output,
3025
- args: ['cdkDropListSorted']
3242
+ args: ['cdkDragDropped']
3243
+ }], moved: [{
3244
+ type: Output,
3245
+ args: ['cdkDragMoved']
3026
3246
  }] } });
3027
3247
 
3028
3248
  /**
3029
- * Injection token that can be used to reference instances of `CdkDragHandle`. It serves as
3030
- * alternative token to the actual `CdkDragHandle` class which could cause unnecessary
3249
+ * Injection token that can be used to reference instances of `CdkDropListGroup`. It serves as
3250
+ * alternative token to the actual `CdkDropListGroup` class which could cause unnecessary
3031
3251
  * retention of the class and its directive metadata.
3032
3252
  */
3033
- const CDK_DRAG_HANDLE = new InjectionToken('CdkDragHandle');
3034
- /** Handle that can be used to drag a CdkDrag instance. */
3035
- class CdkDragHandle {
3036
- /** Whether starting to drag through this handle is disabled. */
3253
+ const CDK_DROP_LIST_GROUP = new InjectionToken('CdkDropListGroup');
3254
+ /**
3255
+ * Declaratively connects sibling `cdkDropList` instances together. All of the `cdkDropList`
3256
+ * elements that are placed inside a `cdkDropListGroup` will be connected to each other
3257
+ * automatically. Can be used as an alternative to the `cdkDropListConnectedTo` input
3258
+ * from `cdkDropList`.
3259
+ */
3260
+ class CdkDropListGroup {
3261
+ constructor() {
3262
+ /** Drop lists registered inside the group. */
3263
+ this._items = new Set();
3264
+ this._disabled = false;
3265
+ }
3266
+ /** Whether starting a dragging sequence from inside this group is disabled. */
3037
3267
  get disabled() {
3038
3268
  return this._disabled;
3039
3269
  }
3040
3270
  set disabled(value) {
3041
3271
  this._disabled = coerceBooleanProperty(value);
3042
- this._stateChanges.next(this);
3043
- }
3044
- constructor(element, parentDrag) {
3045
- this.element = element;
3046
- /** Emits when the state of the handle has changed. */
3047
- this._stateChanges = new Subject();
3048
- this._disabled = false;
3049
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
3050
- assertElementNode(element.nativeElement, 'cdkDragHandle');
3051
- }
3052
- this._parentDrag = parentDrag;
3053
3272
  }
3054
3273
  ngOnDestroy() {
3055
- this._stateChanges.complete();
3274
+ this._items.clear();
3056
3275
  }
3057
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDragHandle, deps: [{ token: i0.ElementRef }, { token: CDK_DRAG_PARENT, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive }); }
3058
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkDragHandle, isStandalone: true, selector: "[cdkDragHandle]", inputs: { disabled: ["cdkDragHandleDisabled", "disabled"] }, host: { classAttribute: "cdk-drag-handle" }, providers: [{ provide: CDK_DRAG_HANDLE, useExisting: CdkDragHandle }], ngImport: i0 }); }
3276
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDropListGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3277
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkDropListGroup, isStandalone: true, selector: "[cdkDropListGroup]", inputs: { disabled: ["cdkDropListGroupDisabled", "disabled"] }, providers: [{ provide: CDK_DROP_LIST_GROUP, useExisting: CdkDropListGroup }], exportAs: ["cdkDropListGroup"], ngImport: i0 }); }
3059
3278
  }
3060
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDragHandle, decorators: [{
3279
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDropListGroup, decorators: [{
3061
3280
  type: Directive,
3062
3281
  args: [{
3063
- selector: '[cdkDragHandle]',
3282
+ selector: '[cdkDropListGroup]',
3283
+ exportAs: 'cdkDropListGroup',
3064
3284
  standalone: true,
3065
- host: {
3066
- 'class': 'cdk-drag-handle',
3067
- },
3068
- providers: [{ provide: CDK_DRAG_HANDLE, useExisting: CdkDragHandle }],
3285
+ providers: [{ provide: CDK_DROP_LIST_GROUP, useExisting: CdkDropListGroup }],
3069
3286
  }]
3070
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: undefined, decorators: [{
3071
- type: Inject,
3072
- args: [CDK_DRAG_PARENT]
3073
- }, {
3074
- type: Optional
3075
- }, {
3076
- type: SkipSelf
3077
- }] }]; }, propDecorators: { disabled: [{
3287
+ }], propDecorators: { disabled: [{
3078
3288
  type: Input,
3079
- args: ['cdkDragHandleDisabled']
3080
- }] } });
3081
-
3082
- /**
3083
- * Injection token that can be used to reference instances of `CdkDragPlaceholder`. It serves as
3084
- * alternative token to the actual `CdkDragPlaceholder` class which could cause unnecessary
3085
- * retention of the class and its directive metadata.
3086
- */
3087
- const CDK_DRAG_PLACEHOLDER = new InjectionToken('CdkDragPlaceholder');
3088
- /**
3089
- * Element that will be used as a template for the placeholder of a CdkDrag when
3090
- * it is being dragged. The placeholder is displayed in place of the element being dragged.
3091
- */
3092
- class CdkDragPlaceholder {
3093
- constructor(templateRef) {
3094
- this.templateRef = templateRef;
3095
- }
3096
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDragPlaceholder, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
3097
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkDragPlaceholder, isStandalone: true, selector: "ng-template[cdkDragPlaceholder]", inputs: { data: "data" }, providers: [{ provide: CDK_DRAG_PLACEHOLDER, useExisting: CdkDragPlaceholder }], ngImport: i0 }); }
3098
- }
3099
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDragPlaceholder, decorators: [{
3100
- type: Directive,
3101
- args: [{
3102
- selector: 'ng-template[cdkDragPlaceholder]',
3103
- standalone: true,
3104
- providers: [{ provide: CDK_DRAG_PLACEHOLDER, useExisting: CdkDragPlaceholder }],
3105
- }]
3106
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { data: [{
3107
- type: Input
3108
- }] } });
3109
-
3110
- /**
3111
- * Injection token that can be used to reference instances of `CdkDragPreview`. It serves as
3112
- * alternative token to the actual `CdkDragPreview` class which could cause unnecessary
3113
- * retention of the class and its directive metadata.
3114
- */
3115
- const CDK_DRAG_PREVIEW = new InjectionToken('CdkDragPreview');
3116
- /**
3117
- * Element that will be used as a template for the preview
3118
- * of a CdkDrag when it is being dragged.
3119
- */
3120
- class CdkDragPreview {
3121
- /** Whether the preview should preserve the same size as the item that is being dragged. */
3122
- get matchSize() {
3123
- return this._matchSize;
3124
- }
3125
- set matchSize(value) {
3126
- this._matchSize = coerceBooleanProperty(value);
3127
- }
3128
- constructor(templateRef) {
3129
- this.templateRef = templateRef;
3130
- this._matchSize = false;
3131
- }
3132
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDragPreview, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
3133
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkDragPreview, isStandalone: true, selector: "ng-template[cdkDragPreview]", inputs: { data: "data", matchSize: "matchSize" }, providers: [{ provide: CDK_DRAG_PREVIEW, useExisting: CdkDragPreview }], ngImport: i0 }); }
3134
- }
3135
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDragPreview, decorators: [{
3136
- type: Directive,
3137
- args: [{
3138
- selector: 'ng-template[cdkDragPreview]',
3139
- standalone: true,
3140
- providers: [{ provide: CDK_DRAG_PREVIEW, useExisting: CdkDragPreview }],
3141
- }]
3142
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { data: [{
3143
- type: Input
3144
- }], matchSize: [{
3145
- type: Input
3289
+ args: ['cdkDropListGroupDisabled']
3146
3290
  }] } });
3147
3291
 
3148
- const DRAG_HOST_CLASS = 'cdk-drag';
3149
- /** Element that can be moved inside a CdkDropList container. */
3150
- class CdkDrag {
3151
- static { this._dragInstances = []; }
3152
- /** Whether starting to drag this element is disabled. */
3292
+ /** Counter used to generate unique ids for drop zones. */
3293
+ let _uniqueIdCounter = 0;
3294
+ /** Container that wraps a set of draggable items. */
3295
+ class CdkDropList {
3296
+ /** Keeps track of the drop lists that are currently on the page. */
3297
+ static { this._dropLists = []; }
3298
+ /** Whether starting a dragging sequence from this container is disabled. */
3153
3299
  get disabled() {
3154
- return this._disabled || (this.dropContainer && this.dropContainer.disabled);
3300
+ return this._disabled || (!!this._group && this._group.disabled);
3155
3301
  }
3156
3302
  set disabled(value) {
3157
- this._disabled = coerceBooleanProperty(value);
3158
- this._dragRef.disabled = this._disabled;
3303
+ // Usually we sync the directive and ref state right before dragging starts, in order to have
3304
+ // a single point of failure and to avoid having to use setters for everything. `disabled` is
3305
+ // a special case, because it can prevent the `beforeStarted` event from firing, which can lock
3306
+ // the user in a disabled state, so we also need to sync it as it's being set.
3307
+ this._dropListRef.disabled = this._disabled = coerceBooleanProperty(value);
3159
3308
  }
3160
3309
  constructor(
3161
- /** Element that the draggable is attached to. */
3162
- element,
3163
- /** Droppable container that the draggable is a part of. */
3164
- dropContainer,
3165
- /**
3166
- * @deprecated `_document` parameter no longer being used and will be removed.
3167
- * @breaking-change 12.0.0
3168
- */
3169
- _document, _ngZone, _viewContainerRef, config, _dir, dragDrop, _changeDetectorRef, _selfHandle, _parentDrag) {
3310
+ /** Element that the drop list is attached to. */
3311
+ element, dragDrop, _changeDetectorRef, _scrollDispatcher, _dir, _group, config) {
3170
3312
  this.element = element;
3171
- this.dropContainer = dropContainer;
3172
- this._ngZone = _ngZone;
3173
- this._viewContainerRef = _viewContainerRef;
3174
- this._dir = _dir;
3175
3313
  this._changeDetectorRef = _changeDetectorRef;
3176
- this._selfHandle = _selfHandle;
3177
- this._parentDrag = _parentDrag;
3314
+ this._scrollDispatcher = _scrollDispatcher;
3315
+ this._dir = _dir;
3316
+ this._group = _group;
3317
+ /** Emits when the list has been destroyed. */
3178
3318
  this._destroyed = new Subject();
3179
- /** Emits when the user starts dragging the item. */
3180
- this.started = new EventEmitter();
3181
- /** Emits when the user has released a drag item, before any animations have started. */
3182
- this.released = new EventEmitter();
3183
- /** Emits when the user stops dragging an item in the container. */
3184
- this.ended = new EventEmitter();
3185
- /** Emits when the user has moved the item into a new container. */
3319
+ /**
3320
+ * Other draggable containers that this container is connected to and into which the
3321
+ * container's items can be transferred. Can either be references to other drop containers,
3322
+ * or their unique IDs.
3323
+ */
3324
+ this.connectedTo = [];
3325
+ /**
3326
+ * Unique ID for the drop zone. Can be used as a reference
3327
+ * in the `connectedTo` of another `CdkDropList`.
3328
+ */
3329
+ this.id = `cdk-drop-list-${_uniqueIdCounter++}`;
3330
+ /**
3331
+ * Function that is used to determine whether an item
3332
+ * is allowed to be moved into a drop container.
3333
+ */
3334
+ this.enterPredicate = () => true;
3335
+ /** Functions that is used to determine whether an item can be sorted into a particular index. */
3336
+ this.sortPredicate = () => true;
3337
+ /** Emits when the user drops an item inside the container. */
3338
+ this.dropped = new EventEmitter();
3339
+ /**
3340
+ * Emits when the user has moved a new drag item into this container.
3341
+ */
3186
3342
  this.entered = new EventEmitter();
3187
- /** Emits when the user removes the item its container by dragging it into another container. */
3343
+ /**
3344
+ * Emits when the user removes an item from the container
3345
+ * by dragging it into another container.
3346
+ */
3188
3347
  this.exited = new EventEmitter();
3189
- /** Emits when the user drops the item inside a container. */
3190
- this.dropped = new EventEmitter();
3348
+ /** Emits as the user is swapping items while actively dragging. */
3349
+ this.sorted = new EventEmitter();
3191
3350
  /**
3192
- * Emits as the user is dragging the item. Use with caution,
3193
- * because this event will fire for every pixel that the user has dragged.
3351
+ * Keeps track of the items that are registered with this container. Historically we used to
3352
+ * do this with a `ContentChildren` query, however queries don't handle transplanted views very
3353
+ * well which means that we can't handle cases like dragging the headers of a `mat-table`
3354
+ * correctly. What we do instead is to have the items register themselves with the container
3355
+ * and then we sort them based on their position in the DOM.
3194
3356
  */
3195
- this.moved = new Observable((observer) => {
3196
- const subscription = this._dragRef.moved
3197
- .pipe(map(movedEvent => ({
3198
- source: this,
3199
- pointerPosition: movedEvent.pointerPosition,
3200
- event: movedEvent.event,
3201
- delta: movedEvent.delta,
3202
- distance: movedEvent.distance,
3203
- })))
3204
- .subscribe(observer);
3205
- return () => {
3206
- subscription.unsubscribe();
3207
- };
3208
- });
3209
- this._dragRef = dragDrop.createDrag(element, {
3210
- dragStartThreshold: config && config.dragStartThreshold != null ? config.dragStartThreshold : 5,
3211
- pointerDirectionChangeThreshold: config && config.pointerDirectionChangeThreshold != null
3212
- ? config.pointerDirectionChangeThreshold
3213
- : 5,
3214
- zIndex: config?.zIndex,
3215
- });
3216
- this._dragRef.data = this;
3217
- // We have to keep track of the drag instances in order to be able to match an element to
3218
- // a drag instance. We can't go through the global registry of `DragRef`, because the root
3219
- // element could be different.
3220
- CdkDrag._dragInstances.push(this);
3357
+ this._unsortedItems = new Set();
3358
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
3359
+ assertElementNode(element.nativeElement, 'cdkDropList');
3360
+ }
3361
+ this._dropListRef = dragDrop.createDropList(element);
3362
+ this._dropListRef.data = this;
3221
3363
  if (config) {
3222
3364
  this._assignDefaults(config);
3223
3365
  }
3224
- // Note that usually the container is assigned when the drop list is picks up the item, but in
3225
- // some cases (mainly transplanted views with OnPush, see #18341) we may end up in a situation
3226
- // where there are no items on the first change detection pass, but the items get picked up as
3227
- // soon as the user triggers another pass by dragging. This is a problem, because the item would
3228
- // have to switch from standalone mode to drag mode in the middle of the dragging sequence which
3229
- // is too late since the two modes save different kinds of information. We work around it by
3230
- // assigning the drop container both from here and the list.
3231
- if (dropContainer) {
3232
- this._dragRef._withDropContainer(dropContainer._dropListRef);
3233
- dropContainer.addItem(this);
3366
+ this._dropListRef.enterPredicate = (drag, drop) => {
3367
+ return this.enterPredicate(drag.data, drop.data);
3368
+ };
3369
+ this._dropListRef.sortPredicate = (index, drag, drop) => {
3370
+ return this.sortPredicate(index, drag.data, drop.data);
3371
+ };
3372
+ this._setupInputSyncSubscription(this._dropListRef);
3373
+ this._handleEvents(this._dropListRef);
3374
+ CdkDropList._dropLists.push(this);
3375
+ if (_group) {
3376
+ _group._items.add(this);
3234
3377
  }
3235
- this._syncInputs(this._dragRef);
3236
- this._handleEvents(this._dragRef);
3237
- }
3238
- /**
3239
- * Returns the element that is being used as a placeholder
3240
- * while the current element is being dragged.
3241
- */
3242
- getPlaceholderElement() {
3243
- return this._dragRef.getPlaceholderElement();
3244
- }
3245
- /** Returns the root draggable element. */
3246
- getRootElement() {
3247
- return this._dragRef.getRootElement();
3248
3378
  }
3249
- /** Resets a standalone drag item to its initial position. */
3250
- reset() {
3251
- this._dragRef.reset();
3252
- }
3253
- /**
3254
- * Gets the pixel coordinates of the draggable outside of a drop container.
3255
- */
3256
- getFreeDragPosition() {
3257
- return this._dragRef.getFreeDragPosition();
3379
+ /** Registers an items with the drop list. */
3380
+ addItem(item) {
3381
+ this._unsortedItems.add(item);
3382
+ if (this._dropListRef.isDragging()) {
3383
+ this._syncItemsWithRef();
3384
+ }
3258
3385
  }
3259
- /**
3260
- * Sets the current position in pixels the draggable outside of a drop container.
3261
- * @param value New position to be set.
3262
- */
3263
- setFreeDragPosition(value) {
3264
- this._dragRef.setFreeDragPosition(value);
3386
+ /** Removes an item from the drop list. */
3387
+ removeItem(item) {
3388
+ this._unsortedItems.delete(item);
3389
+ if (this._dropListRef.isDragging()) {
3390
+ this._syncItemsWithRef();
3391
+ }
3265
3392
  }
3266
- ngAfterViewInit() {
3267
- // Normally this isn't in the zone, but it can cause major performance regressions for apps
3268
- // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
3269
- this._ngZone.runOutsideAngular(() => {
3270
- // We need to wait for the zone to stabilize, in order for the reference
3271
- // element to be in the proper place in the DOM. This is mostly relevant
3272
- // for draggable elements inside portals since they get stamped out in
3273
- // their original DOM position and then they get transferred to the portal.
3274
- this._ngZone.onStable.pipe(take(1), takeUntil(this._destroyed)).subscribe(() => {
3275
- this._updateRootElement();
3276
- this._setupHandlesListener();
3277
- if (this.freeDragPosition) {
3278
- this._dragRef.setFreeDragPosition(this.freeDragPosition);
3279
- }
3280
- });
3393
+ /** Gets the registered items in the list, sorted by their position in the DOM. */
3394
+ getSortedItems() {
3395
+ return Array.from(this._unsortedItems).sort((a, b) => {
3396
+ const documentPosition = a._dragRef
3397
+ .getVisibleElement()
3398
+ .compareDocumentPosition(b._dragRef.getVisibleElement());
3399
+ // `compareDocumentPosition` returns a bitmask so we have to use a bitwise operator.
3400
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
3401
+ // tslint:disable-next-line:no-bitwise
3402
+ return documentPosition & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
3281
3403
  });
3282
3404
  }
3283
- ngOnChanges(changes) {
3284
- const rootSelectorChange = changes['rootElementSelector'];
3285
- const positionChange = changes['freeDragPosition'];
3286
- // We don't have to react to the first change since it's being
3287
- // handled in `ngAfterViewInit` where it needs to be deferred.
3288
- if (rootSelectorChange && !rootSelectorChange.firstChange) {
3289
- this._updateRootElement();
3290
- }
3291
- // Skip the first change since it's being handled in `ngAfterViewInit`.
3292
- if (positionChange && !positionChange.firstChange && this.freeDragPosition) {
3293
- this._dragRef.setFreeDragPosition(this.freeDragPosition);
3294
- }
3295
- }
3296
3405
  ngOnDestroy() {
3297
- if (this.dropContainer) {
3298
- this.dropContainer.removeItem(this);
3299
- }
3300
- const index = CdkDrag._dragInstances.indexOf(this);
3406
+ const index = CdkDropList._dropLists.indexOf(this);
3301
3407
  if (index > -1) {
3302
- CdkDrag._dragInstances.splice(index, 1);
3303
- }
3304
- // Unnecessary in most cases, but used to avoid extra change detections with `zone-paths-rxjs`.
3305
- this._ngZone.runOutsideAngular(() => {
3306
- this._destroyed.next();
3307
- this._destroyed.complete();
3308
- this._dragRef.dispose();
3309
- });
3310
- }
3311
- /** Syncs the root element with the `DragRef`. */
3312
- _updateRootElement() {
3313
- const element = this.element.nativeElement;
3314
- let rootElement = element;
3315
- if (this.rootElementSelector) {
3316
- rootElement =
3317
- element.closest !== undefined
3318
- ? element.closest(this.rootElementSelector)
3319
- : // Comment tag doesn't have closest method, so use parent's one.
3320
- element.parentElement?.closest(this.rootElementSelector);
3408
+ CdkDropList._dropLists.splice(index, 1);
3321
3409
  }
3322
- if (rootElement && (typeof ngDevMode === 'undefined' || ngDevMode)) {
3323
- assertElementNode(rootElement, 'cdkDrag');
3410
+ if (this._group) {
3411
+ this._group._items.delete(this);
3324
3412
  }
3325
- this._dragRef.withRootElement(rootElement || element);
3413
+ this._unsortedItems.clear();
3414
+ this._dropListRef.dispose();
3415
+ this._destroyed.next();
3416
+ this._destroyed.complete();
3326
3417
  }
3327
- /** Gets the boundary element, based on the `boundaryElement` value. */
3328
- _getBoundaryElement() {
3329
- const boundary = this.boundaryElement;
3330
- if (!boundary) {
3331
- return null;
3332
- }
3333
- if (typeof boundary === 'string') {
3334
- return this.element.nativeElement.closest(boundary);
3418
+ /** Syncs the inputs of the CdkDropList with the options of the underlying DropListRef. */
3419
+ _setupInputSyncSubscription(ref) {
3420
+ if (this._dir) {
3421
+ this._dir.change
3422
+ .pipe(startWith(this._dir.value), takeUntil(this._destroyed))
3423
+ .subscribe(value => ref.withDirection(value));
3335
3424
  }
3336
- return coerceElement(boundary);
3337
- }
3338
- /** Syncs the inputs of the CdkDrag with the options of the underlying DragRef. */
3339
- _syncInputs(ref) {
3340
3425
  ref.beforeStarted.subscribe(() => {
3341
- if (!ref.isDragging()) {
3342
- const dir = this._dir;
3343
- const dragStartDelay = this.dragStartDelay;
3344
- const placeholder = this._placeholderTemplate
3345
- ? {
3346
- template: this._placeholderTemplate.templateRef,
3347
- context: this._placeholderTemplate.data,
3348
- viewContainer: this._viewContainerRef,
3349
- }
3350
- : null;
3351
- const preview = this._previewTemplate
3352
- ? {
3353
- template: this._previewTemplate.templateRef,
3354
- context: this._previewTemplate.data,
3355
- matchSize: this._previewTemplate.matchSize,
3356
- viewContainer: this._viewContainerRef,
3426
+ const siblings = coerceArray(this.connectedTo).map(drop => {
3427
+ if (typeof drop === 'string') {
3428
+ const correspondingDropList = CdkDropList._dropLists.find(list => list.id === drop);
3429
+ if (!correspondingDropList && (typeof ngDevMode === 'undefined' || ngDevMode)) {
3430
+ console.warn(`CdkDropList could not find connected drop list with id "${drop}"`);
3357
3431
  }
3358
- : null;
3359
- ref.disabled = this.disabled;
3360
- ref.lockAxis = this.lockAxis;
3361
- ref.dragStartDelay =
3362
- typeof dragStartDelay === 'object' && dragStartDelay
3363
- ? dragStartDelay
3364
- : coerceNumberProperty(dragStartDelay);
3365
- ref.constrainPosition = this.constrainPosition;
3366
- ref.previewClass = this.previewClass;
3367
- ref
3368
- .withBoundaryElement(this._getBoundaryElement())
3369
- .withPlaceholderTemplate(placeholder)
3370
- .withPreviewTemplate(preview)
3371
- .withPreviewContainer(this.previewContainer || 'global');
3372
- if (dir) {
3373
- ref.withDirection(dir.value);
3374
- }
3375
- }
3376
- });
3377
- // This only needs to be resolved once.
3378
- ref.beforeStarted.pipe(take(1)).subscribe(() => {
3379
- // If we managed to resolve a parent through DI, use it.
3380
- if (this._parentDrag) {
3381
- ref.withParent(this._parentDrag._dragRef);
3382
- return;
3383
- }
3384
- // Otherwise fall back to resolving the parent by looking up the DOM. This can happen if
3385
- // the item was projected into another item by something like `ngTemplateOutlet`.
3386
- let parent = this.element.nativeElement.parentElement;
3387
- while (parent) {
3388
- if (parent.classList.contains(DRAG_HOST_CLASS)) {
3389
- ref.withParent(CdkDrag._dragInstances.find(drag => {
3390
- return drag.element.nativeElement === parent;
3391
- })?._dragRef || null);
3392
- break;
3432
+ return correspondingDropList;
3393
3433
  }
3394
- parent = parent.parentElement;
3434
+ return drop;
3435
+ });
3436
+ if (this._group) {
3437
+ this._group._items.forEach(drop => {
3438
+ if (siblings.indexOf(drop) === -1) {
3439
+ siblings.push(drop);
3440
+ }
3441
+ });
3442
+ }
3443
+ // Note that we resolve the scrollable parents here so that we delay the resolution
3444
+ // as long as possible, ensuring that the element is in its final place in the DOM.
3445
+ if (!this._scrollableParentsResolved) {
3446
+ const scrollableParents = this._scrollDispatcher
3447
+ .getAncestorScrollContainers(this.element)
3448
+ .map(scrollable => scrollable.getElementRef().nativeElement);
3449
+ this._dropListRef.withScrollableParents(scrollableParents);
3450
+ // Only do this once since it involves traversing the DOM and the parents
3451
+ // shouldn't be able to change without the drop list being destroyed.
3452
+ this._scrollableParentsResolved = true;
3395
3453
  }
3454
+ ref.disabled = this.disabled;
3455
+ ref.lockAxis = this.lockAxis;
3456
+ ref.sortingDisabled = coerceBooleanProperty(this.sortingDisabled);
3457
+ ref.autoScrollDisabled = coerceBooleanProperty(this.autoScrollDisabled);
3458
+ ref.autoScrollStep = coerceNumberProperty(this.autoScrollStep, 2);
3459
+ ref
3460
+ .connectedTo(siblings.filter(drop => drop && drop !== this).map(list => list._dropListRef))
3461
+ .withOrientation(this.orientation);
3396
3462
  });
3397
3463
  }
3398
- /** Handles the events from the underlying `DragRef`. */
3464
+ /** Handles events from the underlying DropListRef. */
3399
3465
  _handleEvents(ref) {
3400
- ref.started.subscribe(startEvent => {
3401
- this.started.emit({ source: this, event: startEvent.event });
3402
- // Since all of these events run outside of change detection,
3403
- // we need to ensure that everything is marked correctly.
3404
- this._changeDetectorRef.markForCheck();
3405
- });
3406
- ref.released.subscribe(releaseEvent => {
3407
- this.released.emit({ source: this, event: releaseEvent.event });
3408
- });
3409
- ref.ended.subscribe(endEvent => {
3410
- this.ended.emit({
3411
- source: this,
3412
- distance: endEvent.distance,
3413
- dropPoint: endEvent.dropPoint,
3414
- event: endEvent.event,
3415
- });
3416
- // Since all of these events run outside of change detection,
3417
- // we need to ensure that everything is marked correctly.
3466
+ ref.beforeStarted.subscribe(() => {
3467
+ this._syncItemsWithRef();
3418
3468
  this._changeDetectorRef.markForCheck();
3419
3469
  });
3420
- ref.entered.subscribe(enterEvent => {
3470
+ ref.entered.subscribe(event => {
3421
3471
  this.entered.emit({
3422
- container: enterEvent.container.data,
3423
- item: this,
3424
- currentIndex: enterEvent.currentIndex,
3472
+ container: this,
3473
+ item: event.item.data,
3474
+ currentIndex: event.currentIndex,
3425
3475
  });
3426
3476
  });
3427
- ref.exited.subscribe(exitEvent => {
3477
+ ref.exited.subscribe(event => {
3428
3478
  this.exited.emit({
3429
- container: exitEvent.container.data,
3430
- item: this,
3479
+ container: this,
3480
+ item: event.item.data,
3481
+ });
3482
+ this._changeDetectorRef.markForCheck();
3483
+ });
3484
+ ref.sorted.subscribe(event => {
3485
+ this.sorted.emit({
3486
+ previousIndex: event.previousIndex,
3487
+ currentIndex: event.currentIndex,
3488
+ container: this,
3489
+ item: event.item.data,
3431
3490
  });
3432
3491
  });
3433
3492
  ref.dropped.subscribe(dropEvent => {
@@ -3436,176 +3495,117 @@ class CdkDrag {
3436
3495
  currentIndex: dropEvent.currentIndex,
3437
3496
  previousContainer: dropEvent.previousContainer.data,
3438
3497
  container: dropEvent.container.data,
3498
+ item: dropEvent.item.data,
3439
3499
  isPointerOverContainer: dropEvent.isPointerOverContainer,
3440
- item: this,
3441
3500
  distance: dropEvent.distance,
3442
3501
  dropPoint: dropEvent.dropPoint,
3443
3502
  event: dropEvent.event,
3444
3503
  });
3504
+ // Mark for check since all of these events run outside of change
3505
+ // detection and we're not guaranteed for something else to have triggered it.
3506
+ this._changeDetectorRef.markForCheck();
3445
3507
  });
3508
+ merge(ref.receivingStarted, ref.receivingStopped).subscribe(() => this._changeDetectorRef.markForCheck());
3446
3509
  }
3447
3510
  /** Assigns the default input values based on a provided config object. */
3448
3511
  _assignDefaults(config) {
3449
- const { lockAxis, dragStartDelay, constrainPosition, previewClass, boundaryElement, draggingDisabled, rootElementSelector, previewContainer, } = config;
3512
+ const { lockAxis, draggingDisabled, sortingDisabled, listAutoScrollDisabled, listOrientation } = config;
3450
3513
  this.disabled = draggingDisabled == null ? false : draggingDisabled;
3451
- this.dragStartDelay = dragStartDelay || 0;
3514
+ this.sortingDisabled = sortingDisabled == null ? false : sortingDisabled;
3515
+ this.autoScrollDisabled = listAutoScrollDisabled == null ? false : listAutoScrollDisabled;
3516
+ this.orientation = listOrientation || 'vertical';
3452
3517
  if (lockAxis) {
3453
3518
  this.lockAxis = lockAxis;
3454
3519
  }
3455
- if (constrainPosition) {
3456
- this.constrainPosition = constrainPosition;
3457
- }
3458
- if (previewClass) {
3459
- this.previewClass = previewClass;
3460
- }
3461
- if (boundaryElement) {
3462
- this.boundaryElement = boundaryElement;
3463
- }
3464
- if (rootElementSelector) {
3465
- this.rootElementSelector = rootElementSelector;
3466
- }
3467
- if (previewContainer) {
3468
- this.previewContainer = previewContainer;
3469
- }
3470
3520
  }
3471
- /** Sets up the listener that syncs the handles with the drag ref. */
3472
- _setupHandlesListener() {
3473
- // Listen for any newly-added handles.
3474
- this._handles.changes
3475
- .pipe(startWith(this._handles),
3476
- // Sync the new handles with the DragRef.
3477
- tap((handles) => {
3478
- const childHandleElements = handles
3479
- .filter(handle => handle._parentDrag === this)
3480
- .map(handle => handle.element);
3481
- // Usually handles are only allowed to be a descendant of the drag element, but if
3482
- // the consumer defined a different drag root, we should allow the drag element
3483
- // itself to be a handle too.
3484
- if (this._selfHandle && this.rootElementSelector) {
3485
- childHandleElements.push(this.element);
3486
- }
3487
- this._dragRef.withHandles(childHandleElements);
3488
- }),
3489
- // Listen if the state of any of the handles changes.
3490
- switchMap((handles) => {
3491
- return merge(...handles.map(item => {
3492
- return item._stateChanges.pipe(startWith(item));
3493
- }));
3494
- }), takeUntil(this._destroyed))
3495
- .subscribe(handleInstance => {
3496
- // Enabled/disable the handle that changed in the DragRef.
3497
- const dragRef = this._dragRef;
3498
- const handle = handleInstance.element.nativeElement;
3499
- handleInstance.disabled ? dragRef.disableHandle(handle) : dragRef.enableHandle(handle);
3500
- });
3521
+ /** Syncs up the registered drag items with underlying drop list ref. */
3522
+ _syncItemsWithRef() {
3523
+ this._dropListRef.withItems(this.getSortedItems().map(item => item._dragRef));
3501
3524
  }
3502
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", 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 }); }
3503
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkDrag, isStandalone: true, 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 }); }
3525
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDropList, deps: [{ token: i0.ElementRef }, { token: DragDrop }, { token: i0.ChangeDetectorRef }, { token: i1.ScrollDispatcher }, { token: i1$1.Directionality, optional: true }, { token: CDK_DROP_LIST_GROUP, optional: true, skipSelf: true }, { token: CDK_DRAG_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
3526
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkDropList, isStandalone: true, 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: [
3527
+ // Prevent child drop lists from picking up the same group as their parent.
3528
+ { provide: CDK_DROP_LIST_GROUP, useValue: undefined },
3529
+ { provide: CDK_DROP_LIST, useExisting: CdkDropList },
3530
+ ], exportAs: ["cdkDropList"], ngImport: i0 }); }
3504
3531
  }
3505
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDrag, decorators: [{
3532
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkDropList, decorators: [{
3506
3533
  type: Directive,
3507
3534
  args: [{
3508
- selector: '[cdkDrag]',
3509
- exportAs: 'cdkDrag',
3535
+ selector: '[cdkDropList], cdk-drop-list',
3536
+ exportAs: 'cdkDropList',
3510
3537
  standalone: true,
3538
+ providers: [
3539
+ // Prevent child drop lists from picking up the same group as their parent.
3540
+ { provide: CDK_DROP_LIST_GROUP, useValue: undefined },
3541
+ { provide: CDK_DROP_LIST, useExisting: CdkDropList },
3542
+ ],
3511
3543
  host: {
3512
- 'class': DRAG_HOST_CLASS,
3513
- '[class.cdk-drag-disabled]': 'disabled',
3514
- '[class.cdk-drag-dragging]': '_dragRef.isDragging()',
3544
+ 'class': 'cdk-drop-list',
3545
+ '[attr.id]': 'id',
3546
+ '[class.cdk-drop-list-disabled]': 'disabled',
3547
+ '[class.cdk-drop-list-dragging]': '_dropListRef.isDragging()',
3548
+ '[class.cdk-drop-list-receiving]': '_dropListRef.isReceiving()',
3515
3549
  },
3516
- providers: [{ provide: CDK_DRAG_PARENT, useExisting: CdkDrag }],
3517
3550
  }]
3518
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: undefined, decorators: [{
3519
- type: Inject,
3520
- args: [CDK_DROP_LIST]
3521
- }, {
3522
- type: Optional
3523
- }, {
3524
- type: SkipSelf
3525
- }] }, { type: undefined, decorators: [{
3526
- type: Inject,
3527
- args: [DOCUMENT]
3528
- }] }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
3551
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: DragDrop }, { type: i0.ChangeDetectorRef }, { type: i1.ScrollDispatcher }, { type: i1$1.Directionality, decorators: [{
3529
3552
  type: Optional
3530
- }, {
3531
- type: Inject,
3532
- args: [CDK_DRAG_CONFIG]
3533
- }] }, { type: i3.Directionality, decorators: [{
3534
- type: Optional
3535
- }] }, { type: DragDrop }, { type: i0.ChangeDetectorRef }, { type: CdkDragHandle, decorators: [{
3553
+ }] }, { type: CdkDropListGroup, decorators: [{
3536
3554
  type: Optional
3537
- }, {
3538
- type: Self
3539
3555
  }, {
3540
3556
  type: Inject,
3541
- args: [CDK_DRAG_HANDLE]
3542
- }] }, { type: CdkDrag, decorators: [{
3543
- type: Optional
3557
+ args: [CDK_DROP_LIST_GROUP]
3544
3558
  }, {
3545
3559
  type: SkipSelf
3560
+ }] }, { type: undefined, decorators: [{
3561
+ type: Optional
3546
3562
  }, {
3547
3563
  type: Inject,
3548
- args: [CDK_DRAG_PARENT]
3549
- }] }]; }, propDecorators: { _handles: [{
3550
- type: ContentChildren,
3551
- args: [CDK_DRAG_HANDLE, { descendants: true }]
3552
- }], _previewTemplate: [{
3553
- type: ContentChild,
3554
- args: [CDK_DRAG_PREVIEW]
3555
- }], _placeholderTemplate: [{
3556
- type: ContentChild,
3557
- args: [CDK_DRAG_PLACEHOLDER]
3558
- }], data: [{
3564
+ args: [CDK_DRAG_CONFIG]
3565
+ }] }]; }, propDecorators: { connectedTo: [{
3559
3566
  type: Input,
3560
- args: ['cdkDragData']
3561
- }], lockAxis: [{
3567
+ args: ['cdkDropListConnectedTo']
3568
+ }], data: [{
3562
3569
  type: Input,
3563
- args: ['cdkDragLockAxis']
3564
- }], rootElementSelector: [{
3570
+ args: ['cdkDropListData']
3571
+ }], orientation: [{
3565
3572
  type: Input,
3566
- args: ['cdkDragRootElement']
3567
- }], boundaryElement: [{
3573
+ args: ['cdkDropListOrientation']
3574
+ }], id: [{
3575
+ type: Input
3576
+ }], lockAxis: [{
3568
3577
  type: Input,
3569
- args: ['cdkDragBoundary']
3570
- }], dragStartDelay: [{
3578
+ args: ['cdkDropListLockAxis']
3579
+ }], disabled: [{
3571
3580
  type: Input,
3572
- args: ['cdkDragStartDelay']
3573
- }], freeDragPosition: [{
3581
+ args: ['cdkDropListDisabled']
3582
+ }], sortingDisabled: [{
3574
3583
  type: Input,
3575
- args: ['cdkDragFreeDragPosition']
3576
- }], disabled: [{
3584
+ args: ['cdkDropListSortingDisabled']
3585
+ }], enterPredicate: [{
3577
3586
  type: Input,
3578
- args: ['cdkDragDisabled']
3579
- }], constrainPosition: [{
3587
+ args: ['cdkDropListEnterPredicate']
3588
+ }], sortPredicate: [{
3580
3589
  type: Input,
3581
- args: ['cdkDragConstrainPosition']
3582
- }], previewClass: [{
3590
+ args: ['cdkDropListSortPredicate']
3591
+ }], autoScrollDisabled: [{
3583
3592
  type: Input,
3584
- args: ['cdkDragPreviewClass']
3585
- }], previewContainer: [{
3593
+ args: ['cdkDropListAutoScrollDisabled']
3594
+ }], autoScrollStep: [{
3586
3595
  type: Input,
3587
- args: ['cdkDragPreviewContainer']
3588
- }], started: [{
3589
- type: Output,
3590
- args: ['cdkDragStarted']
3591
- }], released: [{
3592
- type: Output,
3593
- args: ['cdkDragReleased']
3594
- }], ended: [{
3596
+ args: ['cdkDropListAutoScrollStep']
3597
+ }], dropped: [{
3595
3598
  type: Output,
3596
- args: ['cdkDragEnded']
3599
+ args: ['cdkDropListDropped']
3597
3600
  }], entered: [{
3598
3601
  type: Output,
3599
- args: ['cdkDragEntered']
3602
+ args: ['cdkDropListEntered']
3600
3603
  }], exited: [{
3601
3604
  type: Output,
3602
- args: ['cdkDragExited']
3603
- }], dropped: [{
3604
- type: Output,
3605
- args: ['cdkDragDropped']
3606
- }], moved: [{
3605
+ args: ['cdkDropListExited']
3606
+ }], sorted: [{
3607
3607
  type: Output,
3608
- args: ['cdkDragMoved']
3608
+ args: ['cdkDropListSorted']
3609
3609
  }] } });
3610
3610
 
3611
3611
  const DRAG_DROP_DIRECTIVES = [