@angular/cdk 20.0.0-next.0 → 20.0.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.
Files changed (179) hide show
  1. package/a11y/index.d.ts +330 -1234
  2. package/a11y-module.d-7d03e079.d.ts +313 -0
  3. package/accordion/index.d.ts +8 -27
  4. package/activedescendant-key-manager.d-11921e3a.d.ts +31 -0
  5. package/bidi/index.d.ts +3 -62
  6. package/bidi-module.d-f8648621.d.ts +53 -0
  7. package/clipboard/index.d.ts +61 -75
  8. package/coercion/index.d.ts +10 -33
  9. package/coercion/private/index.d.ts +2 -2
  10. package/collections/index.d.ts +13 -291
  11. package/data-source.d-7cab2c9d.d.ts +42 -0
  12. package/dialog/index.d.ts +204 -249
  13. package/drag-drop/index.d.ts +1077 -1157
  14. package/fesm2022/a11y-module-e6996d20.mjs +952 -0
  15. package/fesm2022/a11y-module-e6996d20.mjs.map +1 -0
  16. package/fesm2022/a11y.mjs +47 -2445
  17. package/fesm2022/a11y.mjs.map +1 -1
  18. package/fesm2022/accordion.mjs +12 -16
  19. package/fesm2022/accordion.mjs.map +1 -1
  20. package/fesm2022/activedescendant-key-manager-1351a9d3.mjs +16 -0
  21. package/fesm2022/activedescendant-key-manager-1351a9d3.mjs.map +1 -0
  22. package/fesm2022/array-ee3b4bab.mjs +6 -0
  23. package/fesm2022/array-ee3b4bab.mjs.map +1 -0
  24. package/fesm2022/backwards-compatibility-bcbe473e.mjs +25 -0
  25. package/fesm2022/backwards-compatibility-bcbe473e.mjs.map +1 -0
  26. package/fesm2022/bidi-module-0726b65c.mjs +78 -0
  27. package/fesm2022/bidi-module-0726b65c.mjs.map +1 -0
  28. package/fesm2022/bidi.mjs +4 -143
  29. package/fesm2022/bidi.mjs.map +1 -1
  30. package/fesm2022/breakpoints-observer-d4584b66.mjs +179 -0
  31. package/fesm2022/breakpoints-observer-d4584b66.mjs.map +1 -0
  32. package/fesm2022/cdk.mjs +1 -1
  33. package/fesm2022/cdk.mjs.map +1 -1
  34. package/fesm2022/clipboard.mjs +10 -14
  35. package/fesm2022/clipboard.mjs.map +1 -1
  36. package/fesm2022/coercion/private.mjs +2 -18
  37. package/fesm2022/coercion/private.mjs.map +1 -1
  38. package/fesm2022/coercion.mjs +5 -39
  39. package/fesm2022/coercion.mjs.map +1 -1
  40. package/fesm2022/collections.mjs +7 -476
  41. package/fesm2022/collections.mjs.map +1 -1
  42. package/fesm2022/css-pixel-value-286c9a60.mjs +10 -0
  43. package/fesm2022/css-pixel-value-286c9a60.mjs.map +1 -0
  44. package/fesm2022/data-source-5320b6fd.mjs +15 -0
  45. package/fesm2022/data-source-5320b6fd.mjs.map +1 -0
  46. package/fesm2022/dialog.mjs +37 -39
  47. package/fesm2022/dialog.mjs.map +1 -1
  48. package/fesm2022/directionality-7ea26429.mjs +72 -0
  49. package/fesm2022/directionality-7ea26429.mjs.map +1 -0
  50. package/fesm2022/dispose-view-repeater-strategy-b11b87ea.mjs +44 -0
  51. package/fesm2022/dispose-view-repeater-strategy-b11b87ea.mjs.map +1 -0
  52. package/fesm2022/drag-drop.mjs +48 -50
  53. package/fesm2022/drag-drop.mjs.map +1 -1
  54. package/fesm2022/element-705567fe.mjs +29 -0
  55. package/fesm2022/element-705567fe.mjs.map +1 -0
  56. package/fesm2022/fake-event-detection-7055b1bd.mjs +24 -0
  57. package/fesm2022/fake-event-detection-7055b1bd.mjs.map +1 -0
  58. package/fesm2022/focus-key-manager-58d29acd.mjs +22 -0
  59. package/fesm2022/focus-key-manager-58d29acd.mjs.map +1 -0
  60. package/fesm2022/focus-monitor-cebaa0d1.mjs +629 -0
  61. package/fesm2022/focus-monitor-cebaa0d1.mjs.map +1 -0
  62. package/fesm2022/id-generator-fba495fb.mjs +37 -0
  63. package/fesm2022/id-generator-fba495fb.mjs.map +1 -0
  64. package/fesm2022/keycodes-107cd3e4.mjs +122 -0
  65. package/fesm2022/keycodes-107cd3e4.mjs.map +1 -0
  66. package/fesm2022/keycodes.mjs +2 -136
  67. package/fesm2022/keycodes.mjs.map +1 -1
  68. package/fesm2022/layout.mjs +12 -184
  69. package/fesm2022/layout.mjs.map +1 -1
  70. package/fesm2022/list-key-manager-c7b5cefb.mjs +360 -0
  71. package/fesm2022/list-key-manager-c7b5cefb.mjs.map +1 -0
  72. package/fesm2022/listbox.mjs +21 -20
  73. package/fesm2022/listbox.mjs.map +1 -1
  74. package/fesm2022/menu.mjs +76 -60
  75. package/fesm2022/menu.mjs.map +1 -1
  76. package/fesm2022/modifiers-33a5859e.mjs +13 -0
  77. package/fesm2022/modifiers-33a5859e.mjs.map +1 -0
  78. package/fesm2022/observable-97c0792c.mjs +15 -0
  79. package/fesm2022/observable-97c0792c.mjs.map +1 -0
  80. package/fesm2022/observe-content-d2a6b5a0.mjs +210 -0
  81. package/fesm2022/observe-content-d2a6b5a0.mjs.map +1 -0
  82. package/fesm2022/observers/private.mjs +3 -7
  83. package/fesm2022/observers/private.mjs.map +1 -1
  84. package/fesm2022/observers.mjs +5 -213
  85. package/fesm2022/observers.mjs.map +1 -1
  86. package/fesm2022/overlay-module-863b82c9.mjs +3029 -0
  87. package/fesm2022/overlay-module-863b82c9.mjs.map +1 -0
  88. package/fesm2022/overlay.mjs +28 -3019
  89. package/fesm2022/overlay.mjs.map +1 -1
  90. package/fesm2022/passive-listeners-c0bdc49f.mjs +31 -0
  91. package/fesm2022/passive-listeners-c0bdc49f.mjs.map +1 -0
  92. package/fesm2022/platform-1be098b0.mjs +77 -0
  93. package/fesm2022/platform-1be098b0.mjs.map +1 -0
  94. package/fesm2022/platform.mjs +13 -293
  95. package/fesm2022/platform.mjs.map +1 -1
  96. package/fesm2022/portal-directives-c88fea11.mjs +615 -0
  97. package/fesm2022/portal-directives-c88fea11.mjs.map +1 -0
  98. package/fesm2022/portal.mjs +3 -650
  99. package/fesm2022/portal.mjs.map +1 -1
  100. package/fesm2022/private.mjs +3 -63
  101. package/fesm2022/private.mjs.map +1 -1
  102. package/fesm2022/recycle-view-repeater-strategy-c1712813.mjs +156 -0
  103. package/fesm2022/recycle-view-repeater-strategy-c1712813.mjs.map +1 -0
  104. package/fesm2022/scrolling-61955dd1.mjs +99 -0
  105. package/fesm2022/scrolling-61955dd1.mjs.map +1 -0
  106. package/fesm2022/scrolling-module-aa9eeac5.mjs +1463 -0
  107. package/fesm2022/scrolling-module-aa9eeac5.mjs.map +1 -0
  108. package/fesm2022/scrolling.mjs +12 -1463
  109. package/fesm2022/scrolling.mjs.map +1 -1
  110. package/fesm2022/selection-model-30243dba.mjs +221 -0
  111. package/fesm2022/selection-model-30243dba.mjs.map +1 -0
  112. package/fesm2022/shadow-dom-9f403d00.mjs +49 -0
  113. package/fesm2022/shadow-dom-9f403d00.mjs.map +1 -0
  114. package/fesm2022/stepper.mjs +32 -30
  115. package/fesm2022/stepper.mjs.map +1 -1
  116. package/fesm2022/style-loader-e14dc585.mjs +47 -0
  117. package/fesm2022/style-loader-e14dc585.mjs.map +1 -0
  118. package/fesm2022/table.mjs +88 -132
  119. package/fesm2022/table.mjs.map +1 -1
  120. package/fesm2022/test-environment-34eef1ee.mjs +19 -0
  121. package/fesm2022/test-environment-34eef1ee.mjs.map +1 -0
  122. package/fesm2022/testing/selenium-webdriver.mjs +2 -1
  123. package/fesm2022/testing/selenium-webdriver.mjs.map +1 -1
  124. package/fesm2022/testing/testbed.mjs +33 -74
  125. package/fesm2022/testing/testbed.mjs.map +1 -1
  126. package/fesm2022/testing.mjs +2 -697
  127. package/fesm2022/testing.mjs.map +1 -1
  128. package/fesm2022/text-field.mjs +20 -23
  129. package/fesm2022/text-field.mjs.map +1 -1
  130. package/fesm2022/text-filtering-b60ba8a2.mjs +698 -0
  131. package/fesm2022/text-filtering-b60ba8a2.mjs.map +1 -0
  132. package/fesm2022/tree-key-manager-2f20c79c.mjs +360 -0
  133. package/fesm2022/tree-key-manager-2f20c79c.mjs.map +1 -0
  134. package/fesm2022/tree.mjs +33 -33
  135. package/fesm2022/tree.mjs.map +1 -1
  136. package/fesm2022/typeahead-11ae39bd.mjs +88 -0
  137. package/fesm2022/typeahead-11ae39bd.mjs.map +1 -0
  138. package/fesm2022/unique-selection-dispatcher-1d6f91d8.mjs +49 -0
  139. package/fesm2022/unique-selection-dispatcher-1d6f91d8.mjs.map +1 -0
  140. package/fesm2022/visually-hidden-83aea4a0.mjs +18 -0
  141. package/fesm2022/visually-hidden-83aea4a0.mjs.map +1 -0
  142. package/focus-key-manager.d-415a6958.d.ts +33 -0
  143. package/focus-monitor.d-810a02e6.d.ts +209 -0
  144. package/harness-environment.d-4d615248.d.ts +619 -0
  145. package/index.d.ts +2 -2
  146. package/keycodes/index.d.ts +123 -244
  147. package/layout/index.d.ts +23 -25
  148. package/list-key-manager.d-72e9a2e7.d.ts +164 -0
  149. package/listbox/index.d.ts +91 -107
  150. package/menu/index.d.ts +596 -682
  151. package/number-property.d-ce316715.d.ts +15 -0
  152. package/observe-content.d-c08bc882.d.ts +84 -0
  153. package/observers/index.d.ts +4 -90
  154. package/observers/private/index.d.ts +3 -3
  155. package/overlay/index.d.ts +110 -951
  156. package/overlay-module.d-5d06db8a.d.ts +790 -0
  157. package/package.json +1 -1
  158. package/platform/index.d.ts +45 -86
  159. package/platform.d-0a5b4792.d.ts +33 -0
  160. package/portal/index.d.ts +5 -264
  161. package/portal-directives.d-d345bd53.d.ts +210 -0
  162. package/private/index.d.ts +3 -20
  163. package/schematics/ng-add/index.js +1 -1
  164. package/schematics/ng-add/index.mjs +1 -1
  165. package/scrolling/index.d.ts +7 -687
  166. package/scrolling-module.d-a08a462d.d.ts +551 -0
  167. package/selection-model.d-1a70542c.d.ts +111 -0
  168. package/stepper/index.d.ts +74 -124
  169. package/style-loader.d-19baab84.d.ts +21 -0
  170. package/table/index.d.ts +329 -453
  171. package/testing/index.d.ts +32 -675
  172. package/testing/selenium-webdriver/index.d.ts +30 -20
  173. package/testing/testbed/index.d.ts +9 -19
  174. package/text-field/index.d.ts +9 -30
  175. package/tree/index.d.ts +205 -271
  176. package/tree-key-manager-strategy.d-603161dd.d.ts +116 -0
  177. package/unique-selection-dispatcher.d-7993b9f5.d.ts +32 -0
  178. package/view-repeater.d-79039e1f.d.ts +88 -0
  179. package/viewport-ruler.d-f3d3e82f.d.ts +57 -0
@@ -1,419 +1,346 @@
1
- import { AfterViewInit } from '@angular/core';
2
- import { Direction } from '@angular/cdk/bidi';
3
- import { ElementRef } from '@angular/core';
4
- import { EventEmitter } from '@angular/core';
5
1
  import * as i0 from '@angular/core';
6
- import * as i7 from '@angular/cdk/scrolling';
7
- import { InjectionToken } from '@angular/core';
8
- import { NgZone } from '@angular/core';
9
- import { NumberInput } from '@angular/cdk/coercion';
10
- import { Observable } from 'rxjs';
11
- import { OnChanges } from '@angular/core';
12
- import { OnDestroy } from '@angular/core';
13
- import { Renderer2 } from '@angular/core';
14
- import { SimpleChanges } from '@angular/core';
15
- import { Subject } from 'rxjs';
16
- import { TemplateRef } from '@angular/core';
17
- import { ViewContainerRef } from '@angular/core';
18
- import { ViewportRuler } from '@angular/cdk/scrolling';
2
+ import { InjectionToken, ElementRef, NgZone, OnDestroy, EventEmitter, AfterViewInit, TemplateRef, OnChanges, SimpleChanges, ViewContainerRef, Renderer2 } from '@angular/core';
3
+ import { a as Direction } from '../bidi-module.d-f8648621.js';
4
+ import { Subject, Observable } from 'rxjs';
5
+ import { V as ViewportRuler } from '../viewport-ruler.d-f3d3e82f.js';
6
+ import { N as NumberInput } from '../number-property.d-ce316715.js';
7
+ import { a as CdkScrollableModule } from '../scrolling-module.d-a08a462d.js';
8
+ import '../data-source.d-7cab2c9d.js';
19
9
 
10
+ /** Possible values that can be used to configure the drag start delay. */
11
+ type DragStartDelay = number | {
12
+ touch: number;
13
+ mouse: number;
14
+ };
15
+ /** Possible axis along which dragging can be locked. */
16
+ type DragAxis = 'x' | 'y';
17
+ /** Possible orientations for a drop list. */
18
+ type DropListOrientation = 'horizontal' | 'vertical' | 'mixed';
20
19
  /**
21
20
  * Injection token that can be used to configure the
22
21
  * behavior of the drag&drop-related components.
23
22
  */
24
- export declare const CDK_DRAG_CONFIG: InjectionToken<DragDropConfig>;
25
-
26
- /**
27
- * Injection token that can be used to reference instances of `CdkDragHandle`. It serves as
28
- * alternative token to the actual `CdkDragHandle` class which could cause unnecessary
29
- * retention of the class and its directive metadata.
30
- */
31
- export declare const CDK_DRAG_HANDLE: InjectionToken<CdkDragHandle>;
32
-
33
- /**
34
- * Injection token that can be used for a `CdkDrag` to provide itself as a parent to the
35
- * drag-specific child directive (`CdkDragHandle`, `CdkDragPreview` etc.). Used primarily
36
- * to avoid circular imports.
37
- * @docs-private
38
- */
39
- export declare const CDK_DRAG_PARENT: InjectionToken<CdkDrag<any>>;
40
-
41
- /**
42
- * Injection token that can be used to reference instances of `CdkDragPlaceholder`. It serves as
43
- * alternative token to the actual `CdkDragPlaceholder` class which could cause unnecessary
44
- * retention of the class and its directive metadata.
45
- */
46
- export declare const CDK_DRAG_PLACEHOLDER: InjectionToken<CdkDragPlaceholder<any>>;
47
-
48
- /**
49
- * Injection token that can be used to reference instances of `CdkDragPreview`. It serves as
50
- * alternative token to the actual `CdkDragPreview` class which could cause unnecessary
51
- * retention of the class and its directive metadata.
52
- */
53
- export declare const CDK_DRAG_PREVIEW: InjectionToken<CdkDragPreview<any>>;
54
-
23
+ declare const CDK_DRAG_CONFIG: InjectionToken<DragDropConfig>;
55
24
  /**
56
- * Injection token that can be used to reference instances of `CdkDropList`. It serves as
57
- * alternative token to the actual `CdkDropList` class which could cause unnecessary
58
- * retention of the class and its directive metadata.
25
+ * Object that can be used to configure the drag
26
+ * items and drop lists within a module or a component.
59
27
  */
60
- export declare const CDK_DROP_LIST: InjectionToken<CdkDropList<any>>;
28
+ interface DragDropConfig extends Partial<DragRefConfig> {
29
+ lockAxis?: DragAxis;
30
+ dragStartDelay?: DragStartDelay;
31
+ constrainPosition?: DragConstrainPosition;
32
+ previewClass?: string | string[];
33
+ boundaryElement?: string;
34
+ rootElementSelector?: string;
35
+ draggingDisabled?: boolean;
36
+ sortingDisabled?: boolean;
37
+ listAutoScrollDisabled?: boolean;
38
+ listOrientation?: DropListOrientation;
39
+ zIndex?: number;
40
+ previewContainer?: 'global' | 'parent';
41
+ }
61
42
 
62
43
  /**
63
- * Injection token that can be used to reference instances of `CdkDropListGroup`. It serves as
64
- * alternative token to the actual `CdkDropListGroup` class which could cause unnecessary
65
- * retention of the class and its directive metadata.
44
+ * Reference to a drop list. Used to manipulate or dispose of the container.
66
45
  */
67
- export declare const CDK_DROP_LIST_GROUP: InjectionToken<CdkDropListGroup<unknown>>;
68
-
69
- /** Element that can be moved inside a CdkDropList container. */
70
- export declare class CdkDrag<T = any> implements AfterViewInit, OnChanges, OnDestroy {
71
- element: ElementRef<HTMLElement>;
72
- dropContainer: CdkDropList<any>;
73
- private _ngZone;
74
- private _viewContainerRef;
75
- private _dir;
76
- private _changeDetectorRef;
77
- private _selfHandle;
78
- private _parentDrag;
46
+ declare class DropListRef<T = any> {
79
47
  private _dragDropRegistry;
80
- private readonly _destroyed;
81
- private _handles;
82
- private _previewTemplate;
83
- private _placeholderTemplate;
84
- /** Reference to the underlying drag instance. */
85
- _dragRef: DragRef<CdkDrag<T>>;
86
- /** Arbitrary data to attach to this drag instance. */
87
- data: T;
88
- /** Locks the position of the dragged element along the specified axis. */
89
- lockAxis: DragAxis;
48
+ private _ngZone;
49
+ private _viewportRuler;
50
+ /** Element that the drop list is attached to. */
51
+ element: HTMLElement | ElementRef<HTMLElement>;
52
+ /** Whether starting a dragging sequence from this container is disabled. */
53
+ disabled: boolean;
54
+ /** Whether sorting items within the list is disabled. */
55
+ sortingDisabled: boolean;
56
+ /** Locks the position of the draggable elements inside the container along the specified axis. */
57
+ lockAxis: 'x' | 'y';
90
58
  /**
91
- * Selector that will be used to determine the root draggable element, starting from
92
- * the `cdkDrag` element and going up the DOM. Passing an alternate root element is useful
93
- * when trying to enable dragging on an element that you might not have access to.
59
+ * Whether auto-scrolling the view when the user
60
+ * moves their pointer close to the edges is disabled.
94
61
  */
95
- rootElementSelector: string;
62
+ autoScrollDisabled: boolean;
63
+ /** Number of pixels to scroll for each frame when auto-scrolling an element. */
64
+ autoScrollStep: number;
96
65
  /**
97
- * Node or selector that will be used to determine the element to which the draggable's
98
- * position will be constrained. If a string is passed in, it'll be used as a selector that
99
- * will be matched starting from the element's parent and going up the DOM until a match
100
- * has been found.
66
+ * Function that is used to determine whether an item
67
+ * is allowed to be moved into a drop container.
101
68
  */
102
- boundaryElement: string | ElementRef<HTMLElement> | HTMLElement;
69
+ enterPredicate: (drag: DragRef, drop: DropListRef) => boolean;
70
+ /** Function that is used to determine whether an item can be sorted into a particular index. */
71
+ sortPredicate: (index: number, drag: DragRef, drop: DropListRef) => boolean;
72
+ /** Emits right before dragging has started. */
73
+ readonly beforeStarted: Subject<void>;
103
74
  /**
104
- * Amount of milliseconds to wait after the user has put their
105
- * pointer down before starting to drag the element.
75
+ * Emits when the user has moved a new drag item into this container.
106
76
  */
107
- dragStartDelay: DragStartDelay;
77
+ readonly entered: Subject<{
78
+ item: DragRef;
79
+ container: DropListRef;
80
+ currentIndex: number;
81
+ }>;
108
82
  /**
109
- * Sets the position of a `CdkDrag` that is outside of a drop container.
110
- * Can be used to restore the element's position for a returning user.
83
+ * Emits when the user removes an item from the container
84
+ * by dragging it into another container.
111
85
  */
112
- freeDragPosition: Point;
113
- /** Whether starting to drag this element is disabled. */
114
- get disabled(): boolean;
115
- set disabled(value: boolean);
116
- private _disabled;
86
+ readonly exited: Subject<{
87
+ item: DragRef;
88
+ container: DropListRef;
89
+ }>;
90
+ /** Emits when the user drops an item inside the container. */
91
+ readonly dropped: Subject<{
92
+ item: DragRef;
93
+ currentIndex: number;
94
+ previousIndex: number;
95
+ container: DropListRef;
96
+ previousContainer: DropListRef;
97
+ isPointerOverContainer: boolean;
98
+ distance: Point;
99
+ dropPoint: Point;
100
+ event: MouseEvent | TouchEvent;
101
+ }>;
102
+ /** Emits as the user is swapping items while actively dragging. */
103
+ readonly sorted: Subject<{
104
+ previousIndex: number;
105
+ currentIndex: number;
106
+ container: DropListRef;
107
+ item: DragRef;
108
+ }>;
109
+ /** Emits when a dragging sequence is started in a list connected to the current one. */
110
+ readonly receivingStarted: Subject<{
111
+ receiver: DropListRef;
112
+ initiator: DropListRef;
113
+ items: DragRef[];
114
+ }>;
115
+ /** Emits when a dragging sequence is stopped from a list connected to the current one. */
116
+ readonly receivingStopped: Subject<{
117
+ receiver: DropListRef;
118
+ initiator: DropListRef;
119
+ }>;
120
+ /** Arbitrary data that can be attached to the drop list. */
121
+ data: T;
122
+ /** Element that is the direct parent of the drag items. */
123
+ private _container;
124
+ /** Whether an item in the list is being dragged. */
125
+ private _isDragging;
126
+ /** Keeps track of the positions of any parent scrollable elements. */
127
+ private _parentPositions;
128
+ /** Strategy being used to sort items within the list. */
129
+ private _sortStrategy;
130
+ /** Cached `DOMRect` of the drop list. */
131
+ private _domRect;
132
+ /** Draggable items in the container. */
133
+ private _draggables;
134
+ /** Drop lists that are connected to the current one. */
135
+ private _siblings;
136
+ /** Connected siblings that currently have a dragged item. */
137
+ private _activeSiblings;
138
+ /** Subscription to the window being scrolled. */
139
+ private _viewportScrollSubscription;
140
+ /** Vertical direction in which the list is currently scrolling. */
141
+ private _verticalScrollDirection;
142
+ /** Horizontal direction in which the list is currently scrolling. */
143
+ private _horizontalScrollDirection;
144
+ /** Node that is being auto-scrolled. */
145
+ private _scrollNode;
146
+ /** Used to signal to the current auto-scroll sequence when to stop. */
147
+ private readonly _stopScrollTimers;
148
+ /** Shadow root of the current element. Necessary for `elementFromPoint` to resolve correctly. */
149
+ private _cachedShadowRoot;
150
+ /** Reference to the document. */
151
+ private _document;
152
+ /** Elements that can be scrolled while the user is dragging. */
153
+ private _scrollableElements;
154
+ /** Initial value for the element's `scroll-snap-type` style. */
155
+ private _initialScrollSnap;
156
+ /** Direction of the list's layout. */
157
+ private _direction;
158
+ constructor(element: ElementRef<HTMLElement> | HTMLElement, _dragDropRegistry: DragDropRegistry, _document: any, _ngZone: NgZone, _viewportRuler: ViewportRuler);
159
+ /** Removes the drop list functionality from the DOM element. */
160
+ dispose(): void;
161
+ /** Whether an item from this list is currently being dragged. */
162
+ isDragging(): boolean;
163
+ /** Starts dragging an item. */
164
+ start(): void;
117
165
  /**
118
- * Function that can be used to customize the logic of how the position of the drag item
119
- * is limited while it's being dragged. Gets called with a point containing the current position
120
- * of the user's pointer on the page, a reference to the item being dragged and its dimensions.
121
- * Should return a point describing where the item should be rendered.
166
+ * Attempts to move an item into the container.
167
+ * @param item Item that was moved into the container.
168
+ * @param pointerX Position of the item along the X axis.
169
+ * @param pointerY Position of the item along the Y axis.
170
+ * @param index Index at which the item entered. If omitted, the container will try to figure it
171
+ * out automatically.
122
172
  */
123
- constrainPosition?: DragConstrainPosition;
124
- /** Class to be added to the preview element. */
125
- previewClass: string | string[];
173
+ enter(item: DragRef, pointerX: number, pointerY: number, index?: number): void;
126
174
  /**
127
- * Configures the place into which the preview of the item will be inserted. Can be configured
128
- * globally through `CDK_DROP_LIST`. Possible values:
129
- * - `global` - Preview will be inserted at the bottom of the `<body>`. The advantage is that
130
- * you don't have to worry about `overflow: hidden` or `z-index`, but the item won't retain
131
- * its inherited styles.
132
- * - `parent` - Preview will be inserted into the parent of the drag item. The advantage is that
133
- * inherited styles will be preserved, but it may be clipped by `overflow: hidden` or not be
134
- * visible due to `z-index`. Furthermore, the preview is going to have an effect over selectors
135
- * like `:nth-child` and some flexbox configurations.
136
- * - `ElementRef<HTMLElement> | HTMLElement` - Preview will be inserted into a specific element.
137
- * Same advantages and disadvantages as `parent`.
175
+ * Removes an item from the container after it was dragged into another container by the user.
176
+ * @param item Item that was dragged out.
138
177
  */
139
- previewContainer: PreviewContainer;
178
+ exit(item: DragRef): void;
140
179
  /**
141
- * If the parent of the dragged element has a `scale` transform, it can throw off the
142
- * positioning when the user starts dragging. Use this input to notify the CDK of the scale.
180
+ * Drops an item into this container.
181
+ * @param item Item being dropped into the container.
182
+ * @param currentIndex Index at which the item should be inserted.
183
+ * @param previousIndex Index of the item when dragging started.
184
+ * @param previousContainer Container from which the item got dragged in.
185
+ * @param isPointerOverContainer Whether the user's pointer was over the
186
+ * container when the item was dropped.
187
+ * @param distance Distance the user has dragged since the start of the dragging sequence.
188
+ * @param event Event that triggered the dropping sequence.
189
+ *
190
+ * @breaking-change 15.0.0 `previousIndex` and `event` parameters to become required.
143
191
  */
144
- scale: number;
145
- /** Emits when the user starts dragging the item. */
146
- readonly started: EventEmitter<CdkDragStart>;
147
- /** Emits when the user has released a drag item, before any animations have started. */
148
- readonly released: EventEmitter<CdkDragRelease>;
149
- /** Emits when the user stops dragging an item in the container. */
150
- readonly ended: EventEmitter<CdkDragEnd>;
151
- /** Emits when the user has moved the item into a new container. */
152
- readonly entered: EventEmitter<CdkDragEnter<any>>;
153
- /** Emits when the user removes the item its container by dragging it into another container. */
154
- readonly exited: EventEmitter<CdkDragExit<any>>;
155
- /** Emits when the user drops the item inside a container. */
156
- readonly dropped: EventEmitter<CdkDragDrop<any>>;
192
+ drop(item: DragRef, currentIndex: number, previousIndex: number, previousContainer: DropListRef, isPointerOverContainer: boolean, distance: Point, dropPoint: Point, event?: MouseEvent | TouchEvent): void;
157
193
  /**
158
- * Emits as the user is dragging the item. Use with caution,
159
- * because this event will fire for every pixel that the user has dragged.
194
+ * Sets the draggable items that are a part of this list.
195
+ * @param items Items that are a part of this list.
160
196
  */
161
- readonly moved: Observable<CdkDragMove<T>>;
162
- private _injector;
163
- constructor(...args: unknown[]);
197
+ withItems(items: DragRef[]): this;
198
+ /** Sets the layout direction of the drop list. */
199
+ withDirection(direction: Direction): this;
164
200
  /**
165
- * Returns the element that is being used as a placeholder
166
- * while the current element is being dragged.
201
+ * Sets the containers that are connected to this one. When two or more containers are
202
+ * connected, the user will be allowed to transfer items between them.
203
+ * @param connectedTo Other containers that the current containers should be connected to.
167
204
  */
168
- getPlaceholderElement(): HTMLElement;
169
- /** Returns the root draggable element. */
170
- getRootElement(): HTMLElement;
171
- /** Resets a standalone drag item to its initial position. */
172
- reset(): void;
205
+ connectedTo(connectedTo: DropListRef[]): this;
173
206
  /**
174
- * Gets the pixel coordinates of the draggable outside of a drop container.
207
+ * Sets the orientation of the container.
208
+ * @param orientation New orientation for the container.
175
209
  */
176
- getFreeDragPosition(): Readonly<Point>;
210
+ withOrientation(orientation: DropListOrientation): this;
177
211
  /**
178
- * Sets the current position in pixels the draggable outside of a drop container.
179
- * @param value New position to be set.
212
+ * Sets which parent elements are can be scrolled while the user is dragging.
213
+ * @param elements Elements that can be scrolled.
180
214
  */
181
- setFreeDragPosition(value: Point): void;
182
- ngAfterViewInit(): void;
183
- ngOnChanges(changes: SimpleChanges): void;
184
- ngOnDestroy(): void;
185
- _addHandle(handle: CdkDragHandle): void;
186
- _removeHandle(handle: CdkDragHandle): void;
187
- _setPreviewTemplate(preview: CdkDragPreview): void;
188
- _resetPreviewTemplate(preview: CdkDragPreview): void;
189
- _setPlaceholderTemplate(placeholder: CdkDragPlaceholder): void;
190
- _resetPlaceholderTemplate(placeholder: CdkDragPlaceholder): void;
191
- /** Syncs the root element with the `DragRef`. */
192
- private _updateRootElement;
193
- /** Gets the boundary element, based on the `boundaryElement` value. */
194
- private _getBoundaryElement;
195
- /** Syncs the inputs of the CdkDrag with the options of the underlying DragRef. */
196
- private _syncInputs;
197
- /** Handles the events from the underlying `DragRef`. */
198
- private _handleEvents;
199
- /** Assigns the default input values based on a provided config object. */
200
- private _assignDefaults;
201
- /** Sets up the listener that syncs the handles with the drag ref. */
202
- private _setupHandlesListener;
203
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkDrag<any>, never>;
204
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkDrag<any>, "[cdkDrag]", ["cdkDrag"], { "data": { "alias": "cdkDragData"; "required": false; }; "lockAxis": { "alias": "cdkDragLockAxis"; "required": false; }; "rootElementSelector": { "alias": "cdkDragRootElement"; "required": false; }; "boundaryElement": { "alias": "cdkDragBoundary"; "required": false; }; "dragStartDelay": { "alias": "cdkDragStartDelay"; "required": false; }; "freeDragPosition": { "alias": "cdkDragFreeDragPosition"; "required": false; }; "disabled": { "alias": "cdkDragDisabled"; "required": false; }; "constrainPosition": { "alias": "cdkDragConstrainPosition"; "required": false; }; "previewClass": { "alias": "cdkDragPreviewClass"; "required": false; }; "previewContainer": { "alias": "cdkDragPreviewContainer"; "required": false; }; "scale": { "alias": "cdkDragScale"; "required": false; }; }, { "started": "cdkDragStarted"; "released": "cdkDragReleased"; "ended": "cdkDragEnded"; "entered": "cdkDragEntered"; "exited": "cdkDragExited"; "dropped": "cdkDragDropped"; "moved": "cdkDragMoved"; }, never, never, true, never>;
205
- static ngAcceptInputType_disabled: unknown;
206
- static ngAcceptInputType_scale: unknown;
207
- }
208
-
209
- /** Event emitted when the user drops a draggable item inside a drop container. */
210
- export declare interface CdkDragDrop<T, O = T, I = any> {
211
- /** Index of the item when it was picked up. */
212
- previousIndex: number;
213
- /** Current index of the item. */
214
- currentIndex: number;
215
- /** Item that is being dropped. */
216
- item: CdkDrag<I>;
217
- /** Container in which the item was dropped. */
218
- container: CdkDropList<T>;
219
- /** Container from which the item was picked up. Can be the same as the `container`. */
220
- previousContainer: CdkDropList<O>;
221
- /** Whether the user's pointer was over the container when the item was dropped. */
222
- isPointerOverContainer: boolean;
223
- /** Distance in pixels that the user has dragged since the drag sequence started. */
224
- distance: {
225
- x: number;
226
- y: number;
227
- };
228
- /** Position where the pointer was when the item was dropped */
229
- dropPoint: {
230
- x: number;
231
- y: number;
232
- };
233
- /** Native event that caused the drop event. */
234
- event: MouseEvent | TouchEvent;
235
- }
236
-
237
- /** Event emitted when the user stops dragging a draggable. */
238
- export declare interface CdkDragEnd<T = any> {
239
- /** Draggable that emitted the event. */
240
- source: CdkDrag<T>;
241
- /** Distance in pixels that the user has dragged since the drag sequence started. */
242
- distance: {
243
- x: number;
244
- y: number;
245
- };
246
- /** Position where the pointer was when the item was dropped */
247
- dropPoint: {
215
+ withScrollableParents(elements: HTMLElement[]): this;
216
+ /**
217
+ * Configures the drop list so that a different element is used as the container for the
218
+ * dragged items. This is useful for the cases when one might not have control over the
219
+ * full DOM that sets up the dragging.
220
+ * Note that the alternate container needs to be a descendant of the drop list.
221
+ * @param container New element container to be assigned.
222
+ */
223
+ withElementContainer(container: HTMLElement): this;
224
+ /** Gets the scrollable parents that are registered with this drop container. */
225
+ getScrollableParents(): readonly HTMLElement[];
226
+ /**
227
+ * Figures out the index of an item in the container.
228
+ * @param item Item whose index should be determined.
229
+ */
230
+ getItemIndex(item: DragRef): number;
231
+ /**
232
+ * Whether the list is able to receive the item that
233
+ * is currently being dragged inside a connected drop list.
234
+ */
235
+ isReceiving(): boolean;
236
+ /**
237
+ * Sorts an item inside the container based on its position.
238
+ * @param item Item to be sorted.
239
+ * @param pointerX Position of the item along the X axis.
240
+ * @param pointerY Position of the item along the Y axis.
241
+ * @param pointerDelta Direction in which the pointer is moving along each axis.
242
+ */
243
+ _sortItem(item: DragRef, pointerX: number, pointerY: number, pointerDelta: {
248
244
  x: number;
249
245
  y: number;
250
- };
251
- /** Native event that caused the dragging to stop. */
252
- event: MouseEvent | TouchEvent;
253
- }
254
-
255
- /** Event emitted when the user moves an item into a new drop container. */
256
- export declare interface CdkDragEnter<T = any, I = T> {
257
- /** Container into which the user has moved the item. */
258
- container: CdkDropList<T>;
259
- /** Item that was moved into the container. */
260
- item: CdkDrag<I>;
261
- /** Index at which the item has entered the container. */
262
- currentIndex: number;
263
- }
264
-
265
- /**
266
- * Event emitted when the user removes an item from a
267
- * drop container by moving it into another one.
268
- */
269
- export declare interface CdkDragExit<T = any, I = T> {
270
- /** Container from which the user has a removed an item. */
271
- container: CdkDropList<T>;
272
- /** Item that was removed from the container. */
273
- item: CdkDrag<I>;
246
+ }): void;
247
+ /**
248
+ * Checks whether the user's pointer is close to the edges of either the
249
+ * viewport or the drop list and starts the auto-scroll sequence.
250
+ * @param pointerX User's pointer position along the x axis.
251
+ * @param pointerY User's pointer position along the y axis.
252
+ */
253
+ _startScrollingIfNecessary(pointerX: number, pointerY: number): void;
254
+ /** Stops any currently-running auto-scroll sequences. */
255
+ _stopScrolling(): void;
256
+ /** Starts the dragging sequence within the list. */
257
+ private _draggingStarted;
258
+ /** Caches the positions of the configured scrollable parents. */
259
+ private _cacheParentPositions;
260
+ /** Resets the container to its initial state. */
261
+ private _reset;
262
+ /** Starts the interval that'll auto-scroll the element. */
263
+ private _startScrollInterval;
264
+ /**
265
+ * Checks whether the user's pointer is positioned over the container.
266
+ * @param x Pointer position along the X axis.
267
+ * @param y Pointer position along the Y axis.
268
+ */
269
+ _isOverContainer(x: number, y: number): boolean;
270
+ /**
271
+ * Figures out whether an item should be moved into a sibling
272
+ * drop container, based on its current position.
273
+ * @param item Drag item that is being moved.
274
+ * @param x Position of the item along the X axis.
275
+ * @param y Position of the item along the Y axis.
276
+ */
277
+ _getSiblingContainerFromPosition(item: DragRef, x: number, y: number): DropListRef | undefined;
278
+ /**
279
+ * Checks whether the drop list can receive the passed-in item.
280
+ * @param item Item that is being dragged into the list.
281
+ * @param x Position of the item along the X axis.
282
+ * @param y Position of the item along the Y axis.
283
+ */
284
+ _canReceive(item: DragRef, x: number, y: number): boolean;
285
+ /**
286
+ * Called by one of the connected drop lists when a dragging sequence has started.
287
+ * @param sibling Sibling in which dragging has started.
288
+ */
289
+ _startReceiving(sibling: DropListRef, items: DragRef[]): void;
290
+ /**
291
+ * Called by a connected drop list when dragging has stopped.
292
+ * @param sibling Sibling whose dragging has stopped.
293
+ */
294
+ _stopReceiving(sibling: DropListRef): void;
295
+ /**
296
+ * Starts listening to scroll events on the viewport.
297
+ * Used for updating the internal state of the list.
298
+ */
299
+ private _listenToScrollEvents;
300
+ /**
301
+ * Lazily resolves and returns the shadow root of the element. We do this in a function, rather
302
+ * than saving it in property directly on init, because we want to resolve it as late as possible
303
+ * in order to ensure that the element has been moved into the shadow DOM. Doing it inside the
304
+ * constructor might be too early if the element is inside of something like `ngFor` or `ngIf`.
305
+ */
306
+ private _getShadowRoot;
307
+ /** Notifies any siblings that may potentially receive the item. */
308
+ private _notifyReceivingSiblings;
274
309
  }
275
310
 
276
- /** Handle that can be used to drag a CdkDrag instance. */
277
- export declare class CdkDragHandle implements AfterViewInit, OnDestroy {
311
+ /** Container that wraps a set of draggable items. */
312
+ declare class CdkDropList<T = any> implements OnDestroy {
278
313
  element: ElementRef<HTMLElement>;
279
- private _parentDrag;
280
- private _dragDropRegistry;
281
- /** Emits when the state of the handle has changed. */
282
- readonly _stateChanges: Subject<CdkDragHandle>;
283
- /** Whether starting to drag through this handle is disabled. */
284
- get disabled(): boolean;
285
- set disabled(value: boolean);
286
- private _disabled;
287
- constructor(...args: unknown[]);
288
- ngAfterViewInit(): void;
289
- ngOnDestroy(): void;
290
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkDragHandle, never>;
291
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkDragHandle, "[cdkDragHandle]", never, { "disabled": { "alias": "cdkDragHandleDisabled"; "required": false; }; }, {}, never, never, true, never>;
292
- static ngAcceptInputType_disabled: unknown;
293
- }
294
-
295
- /** Event emitted as the user is dragging a draggable item. */
296
- export declare interface CdkDragMove<T = any> {
297
- /** Item that is being dragged. */
298
- source: CdkDrag<T>;
299
- /** Position of the user's pointer on the page. */
300
- pointerPosition: {
301
- x: number;
302
- y: number;
303
- };
304
- /** Native event that is causing the dragging. */
305
- event: MouseEvent | TouchEvent;
306
- /** Distance in pixels that the user has dragged since the drag sequence started. */
307
- distance: {
308
- x: number;
309
- y: number;
310
- };
311
- /**
312
- * Indicates the direction in which the user is dragging the element along each axis.
313
- * `1` means that the position is increasing (e.g. the user is moving to the right or downwards),
314
- * whereas `-1` means that it's decreasing (they're moving to the left or upwards). `0` means
315
- * that the position hasn't changed.
316
- */
317
- delta: {
318
- x: -1 | 0 | 1;
319
- y: -1 | 0 | 1;
320
- };
321
- }
322
-
323
- /**
324
- * Element that will be used as a template for the placeholder of a CdkDrag when
325
- * it is being dragged. The placeholder is displayed in place of the element being dragged.
326
- */
327
- export declare class CdkDragPlaceholder<T = any> implements OnDestroy {
328
- templateRef: TemplateRef<T>;
329
- private _drag;
330
- /** Context data to be added to the placeholder template instance. */
331
- data: T;
332
- constructor(...args: unknown[]);
333
- ngOnDestroy(): void;
334
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkDragPlaceholder<any>, never>;
335
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkDragPlaceholder<any>, "ng-template[cdkDragPlaceholder]", never, { "data": { "alias": "data"; "required": false; }; }, {}, never, never, true, never>;
336
- }
337
-
338
- /**
339
- * Element that will be used as a template for the preview
340
- * of a CdkDrag when it is being dragged.
341
- */
342
- export declare class CdkDragPreview<T = any> implements OnDestroy {
343
- templateRef: TemplateRef<T>;
344
- private _drag;
345
- /** Context data to be added to the preview template instance. */
346
- data: T;
347
- /** Whether the preview should preserve the same size as the item that is being dragged. */
348
- matchSize: boolean;
349
- constructor(...args: unknown[]);
350
- ngOnDestroy(): void;
351
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkDragPreview<any>, never>;
352
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkDragPreview<any>, "ng-template[cdkDragPreview]", never, { "data": { "alias": "data"; "required": false; }; "matchSize": { "alias": "matchSize"; "required": false; }; }, {}, never, never, true, never>;
353
- static ngAcceptInputType_matchSize: unknown;
354
- }
355
-
356
- /** Event emitted when the user releases an item, before any animations have started. */
357
- export declare interface CdkDragRelease<T = any> {
358
- /** Draggable that emitted the event. */
359
- source: CdkDrag<T>;
360
- /** Native event that caused the release event. */
361
- event: MouseEvent | TouchEvent;
362
- }
363
-
364
- /** Event emitted when the user swaps the position of two drag items. */
365
- export declare interface CdkDragSortEvent<T = any, I = T> {
366
- /** Index from which the item was sorted previously. */
367
- previousIndex: number;
368
- /** Index that the item is currently in. */
369
- currentIndex: number;
370
- /** Container that the item belongs to. */
371
- container: CdkDropList<T>;
372
- /** Item that is being sorted. */
373
- item: CdkDrag<I>;
374
- }
375
-
376
- /** Event emitted when the user starts dragging a draggable. */
377
- export declare interface CdkDragStart<T = any> {
378
- /** Draggable that emitted the event. */
379
- source: CdkDrag<T>;
380
- /** Native event that started the drag sequence. */
381
- event: MouseEvent | TouchEvent;
382
- }
383
-
384
- /** Container that wraps a set of draggable items. */
385
- export declare class CdkDropList<T = any> implements OnDestroy {
386
- element: ElementRef<HTMLElement>;
387
- private _changeDetectorRef;
388
- private _scrollDispatcher;
389
- private _dir;
390
- private _group;
391
- /** Emits when the list has been destroyed. */
392
- private readonly _destroyed;
393
- /** Whether the element's scrollable parents have been resolved. */
394
- private _scrollableParentsResolved;
395
- /** Keeps track of the drop lists that are currently on the page. */
396
- private static _dropLists;
397
- /** Reference to the underlying drop list instance. */
398
- _dropListRef: DropListRef<CdkDropList<T>>;
399
- /**
400
- * Other draggable containers that this container is connected to and into which the
401
- * container's items can be transferred. Can either be references to other drop containers,
402
- * or their unique IDs.
403
- */
404
- connectedTo: (CdkDropList | string)[] | CdkDropList | string;
405
- /** Arbitrary data to attach to this container. */
406
- data: T;
407
- /** Direction in which the list is oriented. */
408
- orientation: DropListOrientation;
409
- /**
410
- * Unique ID for the drop zone. Can be used as a reference
411
- * in the `connectedTo` of another `CdkDropList`.
412
- */
413
- id: string;
414
- /** Locks the position of the draggable elements inside the container along the specified axis. */
415
- lockAxis: DragAxis;
416
- /** Whether starting a dragging sequence from this container is disabled. */
314
+ private _changeDetectorRef;
315
+ private _scrollDispatcher;
316
+ private _dir;
317
+ private _group;
318
+ /** Emits when the list has been destroyed. */
319
+ private readonly _destroyed;
320
+ /** Whether the element's scrollable parents have been resolved. */
321
+ private _scrollableParentsResolved;
322
+ /** Keeps track of the drop lists that are currently on the page. */
323
+ private static _dropLists;
324
+ /** Reference to the underlying drop list instance. */
325
+ _dropListRef: DropListRef<CdkDropList<T>>;
326
+ /**
327
+ * Other draggable containers that this container is connected to and into which the
328
+ * container's items can be transferred. Can either be references to other drop containers,
329
+ * or their unique IDs.
330
+ */
331
+ connectedTo: (CdkDropList | string)[] | CdkDropList | string;
332
+ /** Arbitrary data to attach to this container. */
333
+ data: T;
334
+ /** Direction in which the list is oriented. */
335
+ orientation: DropListOrientation;
336
+ /**
337
+ * Unique ID for the drop zone. Can be used as a reference
338
+ * in the `connectedTo` of another `CdkDropList`.
339
+ */
340
+ id: string;
341
+ /** Locks the position of the draggable elements inside the container along the specified axis. */
342
+ lockAxis: DragAxis;
343
+ /** Whether starting a dragging sequence from this container is disabled. */
417
344
  get disabled(): boolean;
418
345
  set disabled(value: boolean);
419
346
  private _disabled;
@@ -489,419 +416,293 @@ export declare class CdkDropList<T = any> implements OnDestroy {
489
416
  static ngAcceptInputType_autoScrollDisabled: unknown;
490
417
  }
491
418
 
419
+ /** Event emitted when the user starts dragging a draggable. */
420
+ interface CdkDragStart<T = any> {
421
+ /** Draggable that emitted the event. */
422
+ source: CdkDrag<T>;
423
+ /** Native event that started the drag sequence. */
424
+ event: MouseEvent | TouchEvent;
425
+ }
426
+ /** Event emitted when the user releases an item, before any animations have started. */
427
+ interface CdkDragRelease<T = any> {
428
+ /** Draggable that emitted the event. */
429
+ source: CdkDrag<T>;
430
+ /** Native event that caused the release event. */
431
+ event: MouseEvent | TouchEvent;
432
+ }
433
+ /** Event emitted when the user stops dragging a draggable. */
434
+ interface CdkDragEnd<T = any> {
435
+ /** Draggable that emitted the event. */
436
+ source: CdkDrag<T>;
437
+ /** Distance in pixels that the user has dragged since the drag sequence started. */
438
+ distance: {
439
+ x: number;
440
+ y: number;
441
+ };
442
+ /** Position where the pointer was when the item was dropped */
443
+ dropPoint: {
444
+ x: number;
445
+ y: number;
446
+ };
447
+ /** Native event that caused the dragging to stop. */
448
+ event: MouseEvent | TouchEvent;
449
+ }
450
+ /** Event emitted when the user moves an item into a new drop container. */
451
+ interface CdkDragEnter<T = any, I = T> {
452
+ /** Container into which the user has moved the item. */
453
+ container: CdkDropList<T>;
454
+ /** Item that was moved into the container. */
455
+ item: CdkDrag<I>;
456
+ /** Index at which the item has entered the container. */
457
+ currentIndex: number;
458
+ }
459
+ /**
460
+ * Event emitted when the user removes an item from a
461
+ * drop container by moving it into another one.
462
+ */
463
+ interface CdkDragExit<T = any, I = T> {
464
+ /** Container from which the user has a removed an item. */
465
+ container: CdkDropList<T>;
466
+ /** Item that was removed from the container. */
467
+ item: CdkDrag<I>;
468
+ }
469
+ /** Event emitted when the user drops a draggable item inside a drop container. */
470
+ interface CdkDragDrop<T, O = T, I = any> {
471
+ /** Index of the item when it was picked up. */
472
+ previousIndex: number;
473
+ /** Current index of the item. */
474
+ currentIndex: number;
475
+ /** Item that is being dropped. */
476
+ item: CdkDrag<I>;
477
+ /** Container in which the item was dropped. */
478
+ container: CdkDropList<T>;
479
+ /** Container from which the item was picked up. Can be the same as the `container`. */
480
+ previousContainer: CdkDropList<O>;
481
+ /** Whether the user's pointer was over the container when the item was dropped. */
482
+ isPointerOverContainer: boolean;
483
+ /** Distance in pixels that the user has dragged since the drag sequence started. */
484
+ distance: {
485
+ x: number;
486
+ y: number;
487
+ };
488
+ /** Position where the pointer was when the item was dropped */
489
+ dropPoint: {
490
+ x: number;
491
+ y: number;
492
+ };
493
+ /** Native event that caused the drop event. */
494
+ event: MouseEvent | TouchEvent;
495
+ }
496
+ /** Event emitted as the user is dragging a draggable item. */
497
+ interface CdkDragMove<T = any> {
498
+ /** Item that is being dragged. */
499
+ source: CdkDrag<T>;
500
+ /** Position of the user's pointer on the page. */
501
+ pointerPosition: {
502
+ x: number;
503
+ y: number;
504
+ };
505
+ /** Native event that is causing the dragging. */
506
+ event: MouseEvent | TouchEvent;
507
+ /** Distance in pixels that the user has dragged since the drag sequence started. */
508
+ distance: {
509
+ x: number;
510
+ y: number;
511
+ };
512
+ /**
513
+ * Indicates the direction in which the user is dragging the element along each axis.
514
+ * `1` means that the position is increasing (e.g. the user is moving to the right or downwards),
515
+ * whereas `-1` means that it's decreasing (they're moving to the left or upwards). `0` means
516
+ * that the position hasn't changed.
517
+ */
518
+ delta: {
519
+ x: -1 | 0 | 1;
520
+ y: -1 | 0 | 1;
521
+ };
522
+ }
523
+ /** Event emitted when the user swaps the position of two drag items. */
524
+ interface CdkDragSortEvent<T = any, I = T> {
525
+ /** Index from which the item was sorted previously. */
526
+ previousIndex: number;
527
+ /** Index that the item is currently in. */
528
+ currentIndex: number;
529
+ /** Container that the item belongs to. */
530
+ container: CdkDropList<T>;
531
+ /** Item that is being sorted. */
532
+ item: CdkDrag<I>;
533
+ }
534
+
492
535
  /**
493
- * Declaratively connects sibling `cdkDropList` instances together. All of the `cdkDropList`
494
- * elements that are placed inside a `cdkDropListGroup` will be connected to each other
495
- * automatically. Can be used as an alternative to the `cdkDropListConnectedTo` input
496
- * from `cdkDropList`.
536
+ * Injection token that can be used to reference instances of `CdkDragHandle`. It serves as
537
+ * alternative token to the actual `CdkDragHandle` class which could cause unnecessary
538
+ * retention of the class and its directive metadata.
497
539
  */
498
- export declare class CdkDropListGroup<T> implements OnDestroy {
499
- /** Drop lists registered inside the group. */
500
- readonly _items: Set<T>;
501
- /** Whether starting a dragging sequence from inside this group is disabled. */
502
- disabled: boolean;
540
+ declare const CDK_DRAG_HANDLE: InjectionToken<CdkDragHandle>;
541
+ /** Handle that can be used to drag a CdkDrag instance. */
542
+ declare class CdkDragHandle implements AfterViewInit, OnDestroy {
543
+ element: ElementRef<HTMLElement>;
544
+ private _parentDrag;
545
+ private _dragDropRegistry;
546
+ /** Emits when the state of the handle has changed. */
547
+ readonly _stateChanges: Subject<CdkDragHandle>;
548
+ /** Whether starting to drag through this handle is disabled. */
549
+ get disabled(): boolean;
550
+ set disabled(value: boolean);
551
+ private _disabled;
552
+ constructor(...args: unknown[]);
553
+ ngAfterViewInit(): void;
503
554
  ngOnDestroy(): void;
504
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkDropListGroup<any>, never>;
505
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkDropListGroup<any>, "[cdkDropListGroup]", ["cdkDropListGroup"], { "disabled": { "alias": "cdkDropListGroupDisabled"; "required": false; }; }, {}, never, never, true, never>;
555
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkDragHandle, never>;
556
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkDragHandle, "[cdkDragHandle]", never, { "disabled": { "alias": "cdkDragHandleDisabled"; "required": false; }; }, {}, never, never, true, never>;
506
557
  static ngAcceptInputType_disabled: unknown;
507
558
  }
508
559
 
509
560
  /**
510
- * Copies an item from one array to another, leaving it in its
511
- * original position in current array.
512
- * @param currentArray Array from which to copy the item.
513
- * @param targetArray Array into which is copy the item.
514
- * @param currentIndex Index of the item in its current array.
515
- * @param targetIndex Index at which to insert the item.
516
- *
561
+ * Injection token that can be used to reference instances of `CdkDragPlaceholder`. It serves as
562
+ * alternative token to the actual `CdkDragPlaceholder` class which could cause unnecessary
563
+ * retention of the class and its directive metadata.
517
564
  */
518
- export declare function copyArrayItem<T = any>(currentArray: T[], targetArray: T[], currentIndex: number, targetIndex: number): void;
519
-
520
- /** Possible axis along which dragging can be locked. */
521
- export declare type DragAxis = 'x' | 'y';
522
-
523
- /** Function that can be used to constrain the position of a dragged element. */
524
- export declare type DragConstrainPosition = (userPointerPosition: Point, dragRef: DragRef, dimensions: DOMRect, pickupPositionInElement: Point) => Point;
525
-
565
+ declare const CDK_DRAG_PLACEHOLDER: InjectionToken<CdkDragPlaceholder<any>>;
526
566
  /**
527
- * Service that allows for drag-and-drop functionality to be attached to DOM elements.
567
+ * Element that will be used as a template for the placeholder of a CdkDrag when
568
+ * it is being dragged. The placeholder is displayed in place of the element being dragged.
528
569
  */
529
- export declare class DragDrop {
530
- private _document;
531
- private _ngZone;
532
- private _viewportRuler;
533
- private _dragDropRegistry;
534
- private _renderer;
570
+ declare class CdkDragPlaceholder<T = any> implements OnDestroy {
571
+ templateRef: TemplateRef<T>;
572
+ private _drag;
573
+ /** Context data to be added to the placeholder template instance. */
574
+ data: T;
535
575
  constructor(...args: unknown[]);
536
- /**
537
- * Turns an element into a draggable item.
538
- * @param element Element to which to attach the dragging functionality.
539
- * @param config Object used to configure the dragging behavior.
540
- */
541
- createDrag<T = any>(element: ElementRef<HTMLElement> | HTMLElement, config?: DragRefConfig): DragRef<T>;
542
- /**
543
- * Turns an element into a drop list.
544
- * @param element Element to which to attach the drop list functionality.
545
- */
546
- createDropList<T = any>(element: ElementRef<HTMLElement> | HTMLElement): DropListRef<T>;
547
- static ɵfac: i0.ɵɵFactoryDeclaration<DragDrop, never>;
548
- static ɵprov: i0.ɵɵInjectableDeclaration<DragDrop>;
576
+ ngOnDestroy(): void;
577
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkDragPlaceholder<any>, never>;
578
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkDragPlaceholder<any>, "ng-template[cdkDragPlaceholder]", never, { "data": { "alias": "data"; "required": false; }; }, {}, never, never, true, never>;
549
579
  }
550
580
 
551
581
  /**
552
- * Object that can be used to configure the drag
553
- * items and drop lists within a module or a component.
582
+ * Injection token that can be used to reference instances of `CdkDragPreview`. It serves as
583
+ * alternative token to the actual `CdkDragPreview` class which could cause unnecessary
584
+ * retention of the class and its directive metadata.
554
585
  */
555
- export declare interface DragDropConfig extends Partial<DragRefConfig> {
556
- lockAxis?: DragAxis;
557
- dragStartDelay?: DragStartDelay;
558
- constrainPosition?: DragConstrainPosition;
559
- previewClass?: string | string[];
560
- boundaryElement?: string;
561
- rootElementSelector?: string;
562
- draggingDisabled?: boolean;
563
- sortingDisabled?: boolean;
564
- listAutoScrollDisabled?: boolean;
565
- listOrientation?: DropListOrientation;
566
- zIndex?: number;
567
- previewContainer?: 'global' | 'parent';
568
- }
569
-
570
- export declare class DragDropModule {
571
- static ɵfac: i0.ɵɵFactoryDeclaration<DragDropModule, never>;
572
- static ɵmod: i0.ɵɵNgModuleDeclaration<DragDropModule, never, [typeof i1.CdkDropList, typeof i2.CdkDropListGroup, typeof i3.CdkDrag, typeof i4.CdkDragHandle, typeof i5.CdkDragPreview, typeof i6.CdkDragPlaceholder], [typeof i7.CdkScrollableModule, typeof i1.CdkDropList, typeof i2.CdkDropListGroup, typeof i3.CdkDrag, typeof i4.CdkDragHandle, typeof i5.CdkDragPreview, typeof i6.CdkDragPlaceholder]>;
573
- static ɵinj: i0.ɵɵInjectorDeclaration<DragDropModule>;
574
- }
575
-
586
+ declare const CDK_DRAG_PREVIEW: InjectionToken<CdkDragPreview<any>>;
576
587
  /**
577
- * Service that keeps track of all the drag item and drop container
578
- * instances, and manages global event listeners on the `document`.
579
- * @docs-private
588
+ * Element that will be used as a template for the preview
589
+ * of a CdkDrag when it is being dragged.
580
590
  */
581
- export declare class DragDropRegistry<_ = unknown, __ = unknown> implements OnDestroy {
582
- private _ngZone;
583
- private _document;
584
- private _styleLoader;
585
- private _renderer;
586
- private _cleanupDocumentTouchmove;
587
- /** Registered drop container instances. */
588
- private _dropInstances;
589
- /** Registered drag item instances. */
590
- private _dragInstances;
591
- /** Drag item instances that are currently being dragged. */
592
- private _activeDragInstances;
593
- /** Keeps track of the event listeners that we've bound to the `document`. */
594
- private _globalListeners;
595
- /**
596
- * Predicate function to check if an item is being dragged. Moved out into a property,
597
- * because it'll be called a lot and we don't want to create a new function every time.
598
- */
599
- private _draggingPredicate;
600
- /**
601
- * Map tracking DOM nodes and their corresponding drag directives. Note that this is different
602
- * from looking through the `_dragInstances` and getting their root node, because the root node
603
- * isn't necessarily the node that the directive is set on.
604
- */
605
- private _domNodesToDirectives;
606
- /**
607
- * Emits the `touchmove` or `mousemove` events that are dispatched
608
- * while the user is dragging a drag item instance.
609
- */
610
- readonly pointerMove: Subject<TouchEvent | MouseEvent>;
611
- /**
612
- * Emits the `touchend` or `mouseup` events that are dispatched
613
- * while the user is dragging a drag item instance.
614
- */
615
- readonly pointerUp: Subject<TouchEvent | MouseEvent>;
616
- /**
617
- * Emits when the viewport has been scrolled while the user is dragging an item.
618
- * @deprecated To be turned into a private member. Use the `scrolled` method instead.
619
- * @breaking-change 13.0.0
620
- */
621
- readonly scroll: Subject<Event>;
591
+ declare class CdkDragPreview<T = any> implements OnDestroy {
592
+ templateRef: TemplateRef<T>;
593
+ private _drag;
594
+ /** Context data to be added to the preview template instance. */
595
+ data: T;
596
+ /** Whether the preview should preserve the same size as the item that is being dragged. */
597
+ matchSize: boolean;
622
598
  constructor(...args: unknown[]);
623
- /** Adds a drop container to the registry. */
624
- registerDropContainer(drop: DropListRef): void;
625
- /** Adds a drag item instance to the registry. */
626
- registerDragItem(drag: DragRef): void;
627
- /** Removes a drop container from the registry. */
628
- removeDropContainer(drop: DropListRef): void;
629
- /** Removes a drag item instance from the registry. */
630
- removeDragItem(drag: DragRef): void;
631
- /**
632
- * Starts the dragging sequence for a drag instance.
633
- * @param drag Drag instance which is being dragged.
634
- * @param event Event that initiated the dragging.
635
- */
636
- startDragging(drag: DragRef, event: TouchEvent | MouseEvent): void;
637
- /** Stops dragging a drag item instance. */
638
- stopDragging(drag: DragRef): void;
639
- /** Gets whether a drag item instance is currently being dragged. */
640
- isDragging(drag: DragRef): boolean;
641
- /**
642
- * Gets a stream that will emit when any element on the page is scrolled while an item is being
643
- * dragged.
644
- * @param shadowRoot Optional shadow root that the current dragging sequence started from.
645
- * Top-level listeners won't pick up events coming from the shadow DOM so this parameter can
646
- * be used to include an additional top-level listener at the shadow root level.
647
- */
648
- scrolled(shadowRoot?: DocumentOrShadowRoot | null): Observable<Event>;
649
- /**
650
- * Tracks the DOM node which has a draggable directive.
651
- * @param node Node to track.
652
- * @param dragRef Drag directive set on the node.
653
- */
654
- registerDirectiveNode(node: Node, dragRef: CdkDrag): void;
655
- /**
656
- * Stops tracking a draggable directive node.
657
- * @param node Node to stop tracking.
658
- */
659
- removeDirectiveNode(node: Node): void;
660
- /**
661
- * Gets the drag directive corresponding to a specific DOM node, if any.
662
- * @param node Node for which to do the lookup.
663
- */
664
- getDragDirectiveForNode(node: Node): CdkDrag | null;
665
599
  ngOnDestroy(): void;
666
- /**
667
- * Event listener that will prevent the default browser action while the user is dragging.
668
- * @param event Event whose default action should be prevented.
669
- */
670
- private _preventDefaultWhileDragging;
671
- /** Event listener for `touchmove` that is bound even if no dragging is happening. */
672
- private _persistentTouchmoveListener;
673
- /** Clears out the global event listeners from the `document`. */
674
- private _clearGlobalListeners;
675
- static ɵfac: i0.ɵɵFactoryDeclaration<DragDropRegistry<any, any>, never>;
676
- static ɵprov: i0.ɵɵInjectableDeclaration<DragDropRegistry<any, any>>;
677
- }
678
-
679
- /** Template that can be used to create a drag helper element (e.g. a preview or a placeholder). */
680
- declare interface DragHelperTemplate<T = any> {
681
- template: TemplateRef<T> | null;
682
- viewContainer: ViewContainerRef;
683
- context: T;
684
- }
685
-
686
- /** Template that can be used to create a drag preview element. */
687
- declare interface DragPreviewTemplate<T = any> {
688
- matchSize?: boolean;
689
- template: TemplateRef<T> | null;
690
- viewContainer: ViewContainerRef;
691
- context: T;
600
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkDragPreview<any>, never>;
601
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkDragPreview<any>, "ng-template[cdkDragPreview]", never, { "data": { "alias": "data"; "required": false; }; "matchSize": { "alias": "matchSize"; "required": false; }; }, {}, never, never, true, never>;
602
+ static ngAcceptInputType_matchSize: unknown;
692
603
  }
693
604
 
694
605
  /**
695
- * Reference to a draggable item. Used to manipulate or dispose of the item.
606
+ * Injection token that can be used to reference instances of `CdkDropList`. It serves as
607
+ * alternative token to the actual `CdkDropList` class which could cause unnecessary
608
+ * retention of the class and its directive metadata.
696
609
  */
697
- export declare class DragRef<T = any> {
698
- private _config;
699
- private _document;
610
+ declare const CDK_DROP_LIST: InjectionToken<CdkDropList<any>>;
611
+ /** Element that can be moved inside a CdkDropList container. */
612
+ declare class CdkDrag<T = any> implements AfterViewInit, OnChanges, OnDestroy {
613
+ element: ElementRef<HTMLElement>;
614
+ dropContainer: CdkDropList<any>;
700
615
  private _ngZone;
701
- private _viewportRuler;
616
+ private _viewContainerRef;
617
+ private _dir;
618
+ private _changeDetectorRef;
619
+ private _selfHandle;
620
+ private _parentDrag;
702
621
  private _dragDropRegistry;
703
- private _renderer;
704
- private _rootElementCleanups;
705
- private _cleanupShadowRootSelectStart;
706
- /** Element displayed next to the user's pointer while the element is dragged. */
707
- private _preview;
708
- /** Container into which to insert the preview. */
709
- private _previewContainer;
710
- /** Reference to the view of the placeholder element. */
711
- private _placeholderRef;
712
- /** Element that is rendered instead of the draggable item while it is being sorted. */
713
- private _placeholder;
714
- /** Coordinates within the element at which the user picked up the element. */
715
- private _pickupPositionInElement;
716
- /** Coordinates on the page at which the user picked up the element. */
717
- private _pickupPositionOnPage;
718
- /**
719
- * Anchor node used to save the place in the DOM where the element was
720
- * picked up so that it can be restored at the end of the drag sequence.
721
- */
722
- private _anchor;
723
- /**
724
- * CSS `transform` applied to the element when it isn't being dragged. We need a
725
- * passive transform in order for the dragged element to retain its new position
726
- * after the user has stopped dragging and because we need to know the relative
727
- * position in case they start dragging again. This corresponds to `element.style.transform`.
728
- */
729
- private _passiveTransform;
730
- /** CSS `transform` that is applied to the element while it's being dragged. */
731
- private _activeTransform;
732
- /** Inline `transform` value that the element had before the first dragging sequence. */
733
- private _initialTransform?;
734
- /**
735
- * Whether the dragging sequence has been started. Doesn't
736
- * necessarily mean that the element has been moved.
737
- */
738
- private _hasStartedDragging;
739
- /** Whether the element has moved since the user started dragging it. */
740
- private _hasMoved;
741
- /** Drop container in which the DragRef resided when dragging began. */
742
- private _initialContainer;
743
- /** Index at which the item started in its initial container. */
744
- private _initialIndex;
745
- /** Cached positions of scrollable parent elements. */
746
- private _parentPositions;
747
- /** Emits when the item is being moved. */
748
- private readonly _moveEvents;
749
- /** Keeps track of the direction in which the user is dragging along each axis. */
750
- private _pointerDirectionDelta;
751
- /** Pointer position at which the last change in the delta occurred. */
752
- private _pointerPositionAtLastDirectionChange;
753
- /** Position of the pointer at the last pointer event. */
754
- private _lastKnownPointerPosition;
755
- /**
756
- * Root DOM node of the drag instance. This is the element that will
757
- * be moved around as the user is dragging.
758
- */
759
- private _rootElement;
760
- /**
761
- * Nearest ancestor SVG, relative to which coordinates are calculated if dragging SVGElement
762
- */
763
- private _ownerSVGElement;
764
- /**
765
- * Inline style value of `-webkit-tap-highlight-color` at the time the
766
- * dragging was started. Used to restore the value once we're done dragging.
767
- */
768
- private _rootElementTapHighlight;
769
- /** Subscription to pointer movement events. */
770
- private _pointerMoveSubscription;
771
- /** Subscription to the event that is dispatched when the user lifts their pointer. */
772
- private _pointerUpSubscription;
773
- /** Subscription to the viewport being scrolled. */
774
- private _scrollSubscription;
775
- /** Subscription to the viewport being resized. */
776
- private _resizeSubscription;
777
- /**
778
- * Time at which the last touch event occurred. Used to avoid firing the same
779
- * events multiple times on touch devices where the browser will fire a fake
780
- * mouse event for each touch event, after a certain time.
781
- */
782
- private _lastTouchEventTime;
783
- /** Time at which the last dragging sequence was started. */
784
- private _dragStartTime;
785
- /** Cached reference to the boundary element. */
786
- private _boundaryElement;
787
- /** Whether the native dragging interactions have been enabled on the root element. */
788
- private _nativeInteractionsEnabled;
789
- /** Client rect of the root element when the dragging sequence has started. */
790
- private _initialDomRect?;
791
- /** Cached dimensions of the preview element. Should be read via `_getPreviewRect`. */
792
- private _previewRect?;
793
- /** Cached dimensions of the boundary element. */
794
- private _boundaryRect?;
795
- /** Element that will be used as a template to create the draggable item's preview. */
796
- private _previewTemplate?;
797
- /** Template for placeholder element rendered to show where a draggable would be dropped. */
798
- private _placeholderTemplate?;
799
- /** Elements that can be used to drag the draggable item. */
800
- private _handles;
801
- /** Registered handles that are currently disabled. */
802
- private _disabledHandles;
803
- /** Droppable container that the draggable is a part of. */
804
- private _dropContainer?;
805
- /** Layout direction of the item. */
806
- private _direction;
807
- /** Ref that the current drag item is nested in. */
808
- private _parentDragRef;
622
+ private readonly _destroyed;
623
+ private _handles;
624
+ private _previewTemplate;
625
+ private _placeholderTemplate;
626
+ /** Reference to the underlying drag instance. */
627
+ _dragRef: DragRef<CdkDrag<T>>;
628
+ /** Arbitrary data to attach to this drag instance. */
629
+ data: T;
630
+ /** Locks the position of the dragged element along the specified axis. */
631
+ lockAxis: DragAxis;
809
632
  /**
810
- * Cached shadow root that the element is placed in. `null` means that the element isn't in
811
- * the shadow DOM and `undefined` means that it hasn't been resolved yet. Should be read via
812
- * `_getShadowRoot`, not directly.
633
+ * Selector that will be used to determine the root draggable element, starting from
634
+ * the `cdkDrag` element and going up the DOM. Passing an alternate root element is useful
635
+ * when trying to enable dragging on an element that you might not have access to.
813
636
  */
814
- private _cachedShadowRoot;
815
- /** Axis along which dragging is locked. */
816
- lockAxis: 'x' | 'y';
637
+ rootElementSelector: string;
638
+ /**
639
+ * Node or selector that will be used to determine the element to which the draggable's
640
+ * position will be constrained. If a string is passed in, it'll be used as a selector that
641
+ * will be matched starting from the element's parent and going up the DOM until a match
642
+ * has been found.
643
+ */
644
+ boundaryElement: string | ElementRef<HTMLElement> | HTMLElement;
817
645
  /**
818
646
  * Amount of milliseconds to wait after the user has put their
819
647
  * pointer down before starting to drag the element.
820
648
  */
821
- dragStartDelay: number | {
822
- touch: number;
823
- mouse: number;
824
- };
825
- /** Class to be added to the preview element. */
826
- previewClass: string | string[] | undefined;
649
+ dragStartDelay: DragStartDelay;
827
650
  /**
828
- * If the parent of the dragged element has a `scale` transform, it can throw off the
829
- * positioning when the user starts dragging. Use this input to notify the CDK of the scale.
651
+ * Sets the position of a `CdkDrag` that is outside of a drop container.
652
+ * Can be used to restore the element's position for a returning user.
830
653
  */
831
- scale: number;
654
+ freeDragPosition: Point;
832
655
  /** Whether starting to drag this element is disabled. */
833
656
  get disabled(): boolean;
834
657
  set disabled(value: boolean);
835
658
  private _disabled;
836
- /** Emits as the drag sequence is being prepared. */
837
- readonly beforeStarted: Subject<void>;
659
+ /**
660
+ * Function that can be used to customize the logic of how the position of the drag item
661
+ * is limited while it's being dragged. Gets called with a point containing the current position
662
+ * of the user's pointer on the page, a reference to the item being dragged and its dimensions.
663
+ * Should return a point describing where the item should be rendered.
664
+ */
665
+ constrainPosition?: DragConstrainPosition;
666
+ /** Class to be added to the preview element. */
667
+ previewClass: string | string[];
668
+ /**
669
+ * Configures the place into which the preview of the item will be inserted. Can be configured
670
+ * globally through `CDK_DROP_LIST`. Possible values:
671
+ * - `global` - Preview will be inserted at the bottom of the `<body>`. The advantage is that
672
+ * you don't have to worry about `overflow: hidden` or `z-index`, but the item won't retain
673
+ * its inherited styles.
674
+ * - `parent` - Preview will be inserted into the parent of the drag item. The advantage is that
675
+ * inherited styles will be preserved, but it may be clipped by `overflow: hidden` or not be
676
+ * visible due to `z-index`. Furthermore, the preview is going to have an effect over selectors
677
+ * like `:nth-child` and some flexbox configurations.
678
+ * - `ElementRef<HTMLElement> | HTMLElement` - Preview will be inserted into a specific element.
679
+ * Same advantages and disadvantages as `parent`.
680
+ */
681
+ previewContainer: PreviewContainer;
682
+ /**
683
+ * If the parent of the dragged element has a `scale` transform, it can throw off the
684
+ * positioning when the user starts dragging. Use this input to notify the CDK of the scale.
685
+ */
686
+ scale: number;
838
687
  /** Emits when the user starts dragging the item. */
839
- readonly started: Subject<{
840
- source: DragRef;
841
- event: MouseEvent | TouchEvent;
842
- }>;
688
+ readonly started: EventEmitter<CdkDragStart>;
843
689
  /** Emits when the user has released a drag item, before any animations have started. */
844
- readonly released: Subject<{
845
- source: DragRef;
846
- event: MouseEvent | TouchEvent;
847
- }>;
690
+ readonly released: EventEmitter<CdkDragRelease>;
848
691
  /** Emits when the user stops dragging an item in the container. */
849
- readonly ended: Subject<{
850
- source: DragRef;
851
- distance: Point;
852
- dropPoint: Point;
853
- event: MouseEvent | TouchEvent;
854
- }>;
692
+ readonly ended: EventEmitter<CdkDragEnd>;
855
693
  /** Emits when the user has moved the item into a new container. */
856
- readonly entered: Subject<{
857
- container: DropListRef;
858
- item: DragRef;
859
- currentIndex: number;
860
- }>;
694
+ readonly entered: EventEmitter<CdkDragEnter<any>>;
861
695
  /** Emits when the user removes the item its container by dragging it into another container. */
862
- readonly exited: Subject<{
863
- container: DropListRef;
864
- item: DragRef;
865
- }>;
696
+ readonly exited: EventEmitter<CdkDragExit<any>>;
866
697
  /** Emits when the user drops the item inside a container. */
867
- readonly dropped: Subject<{
868
- previousIndex: number;
869
- currentIndex: number;
870
- item: DragRef;
871
- container: DropListRef;
872
- previousContainer: DropListRef;
873
- distance: Point;
874
- dropPoint: Point;
875
- isPointerOverContainer: boolean;
876
- event: MouseEvent | TouchEvent;
877
- }>;
698
+ readonly dropped: EventEmitter<CdkDragDrop<any>>;
878
699
  /**
879
700
  * Emits as the user is dragging the item. Use with caution,
880
701
  * because this event will fire for every pixel that the user has dragged.
881
702
  */
882
- readonly moved: Observable<{
883
- source: DragRef;
884
- pointerPosition: {
885
- x: number;
886
- y: number;
887
- };
888
- event: MouseEvent | TouchEvent;
889
- distance: Point;
890
- delta: {
891
- x: -1 | 0 | 1;
892
- y: -1 | 0 | 1;
893
- };
894
- }>;
895
- /** Arbitrary data that can be attached to the drag item. */
896
- data: T;
897
- /**
898
- * Function that can be used to customize the logic of how the position of the drag item
899
- * is limited while it's being dragged. Gets called with a point containing the current position
900
- * of the user's pointer on the page, a reference to the item being dragged and its dimensions.
901
- * Should return a point describing where the item should be rendered.
902
- */
903
- constrainPosition?: DragConstrainPosition;
904
- constructor(element: ElementRef<HTMLElement> | HTMLElement, _config: DragRefConfig, _document: Document, _ngZone: NgZone, _viewportRuler: ViewportRuler, _dragDropRegistry: DragDropRegistry, _renderer: Renderer2);
703
+ readonly moved: Observable<CdkDragMove<T>>;
704
+ private _injector;
705
+ constructor(...args: unknown[]);
905
706
  /**
906
707
  * Returns the element that is being used as a placeholder
907
708
  * while the current element is being dragged.
@@ -909,458 +710,562 @@ export declare class DragRef<T = any> {
909
710
  getPlaceholderElement(): HTMLElement;
910
711
  /** Returns the root draggable element. */
911
712
  getRootElement(): HTMLElement;
713
+ /** Resets a standalone drag item to its initial position. */
714
+ reset(): void;
912
715
  /**
913
- * Gets the currently-visible element that represents the drag item.
914
- * While dragging this is the placeholder, otherwise it's the root element.
716
+ * Gets the pixel coordinates of the draggable outside of a drop container.
915
717
  */
916
- getVisibleElement(): HTMLElement;
917
- /** Registers the handles that can be used to drag the element. */
918
- withHandles(handles: (HTMLElement | ElementRef<HTMLElement>)[]): this;
718
+ getFreeDragPosition(): Readonly<Point>;
919
719
  /**
920
- * Registers the template that should be used for the drag preview.
921
- * @param template Template that from which to stamp out the preview.
720
+ * Sets the current position in pixels the draggable outside of a drop container.
721
+ * @param value New position to be set.
922
722
  */
923
- withPreviewTemplate(template: DragPreviewTemplate | null): this;
723
+ setFreeDragPosition(value: Point): void;
724
+ ngAfterViewInit(): void;
725
+ ngOnChanges(changes: SimpleChanges): void;
726
+ ngOnDestroy(): void;
727
+ _addHandle(handle: CdkDragHandle): void;
728
+ _removeHandle(handle: CdkDragHandle): void;
729
+ _setPreviewTemplate(preview: CdkDragPreview): void;
730
+ _resetPreviewTemplate(preview: CdkDragPreview): void;
731
+ _setPlaceholderTemplate(placeholder: CdkDragPlaceholder): void;
732
+ _resetPlaceholderTemplate(placeholder: CdkDragPlaceholder): void;
733
+ /** Syncs the root element with the `DragRef`. */
734
+ private _updateRootElement;
735
+ /** Gets the boundary element, based on the `boundaryElement` value. */
736
+ private _getBoundaryElement;
737
+ /** Syncs the inputs of the CdkDrag with the options of the underlying DragRef. */
738
+ private _syncInputs;
739
+ /** Handles the events from the underlying `DragRef`. */
740
+ private _handleEvents;
741
+ /** Assigns the default input values based on a provided config object. */
742
+ private _assignDefaults;
743
+ /** Sets up the listener that syncs the handles with the drag ref. */
744
+ private _setupHandlesListener;
745
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkDrag<any>, never>;
746
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkDrag<any>, "[cdkDrag]", ["cdkDrag"], { "data": { "alias": "cdkDragData"; "required": false; }; "lockAxis": { "alias": "cdkDragLockAxis"; "required": false; }; "rootElementSelector": { "alias": "cdkDragRootElement"; "required": false; }; "boundaryElement": { "alias": "cdkDragBoundary"; "required": false; }; "dragStartDelay": { "alias": "cdkDragStartDelay"; "required": false; }; "freeDragPosition": { "alias": "cdkDragFreeDragPosition"; "required": false; }; "disabled": { "alias": "cdkDragDisabled"; "required": false; }; "constrainPosition": { "alias": "cdkDragConstrainPosition"; "required": false; }; "previewClass": { "alias": "cdkDragPreviewClass"; "required": false; }; "previewContainer": { "alias": "cdkDragPreviewContainer"; "required": false; }; "scale": { "alias": "cdkDragScale"; "required": false; }; }, { "started": "cdkDragStarted"; "released": "cdkDragReleased"; "ended": "cdkDragEnded"; "entered": "cdkDragEntered"; "exited": "cdkDragExited"; "dropped": "cdkDragDropped"; "moved": "cdkDragMoved"; }, never, never, true, never>;
747
+ static ngAcceptInputType_disabled: unknown;
748
+ static ngAcceptInputType_scale: unknown;
749
+ }
750
+
751
+ /**
752
+ * Service that keeps track of all the drag item and drop container
753
+ * instances, and manages global event listeners on the `document`.
754
+ * @docs-private
755
+ */
756
+ declare class DragDropRegistry implements OnDestroy {
757
+ private _ngZone;
758
+ private _document;
759
+ private _styleLoader;
760
+ private _renderer;
761
+ private _cleanupDocumentTouchmove;
762
+ private _scroll;
763
+ /** Registered drop container instances. */
764
+ private _dropInstances;
765
+ /** Registered drag item instances. */
766
+ private _dragInstances;
767
+ /** Drag item instances that are currently being dragged. */
768
+ private _activeDragInstances;
769
+ /** Keeps track of the event listeners that we've bound to the `document`. */
770
+ private _globalListeners;
924
771
  /**
925
- * Registers the template that should be used for the drag placeholder.
926
- * @param template Template that from which to stamp out the placeholder.
772
+ * Predicate function to check if an item is being dragged. Moved out into a property,
773
+ * because it'll be called a lot and we don't want to create a new function every time.
927
774
  */
928
- withPlaceholderTemplate(template: DragHelperTemplate | null): this;
775
+ private _draggingPredicate;
929
776
  /**
930
- * Sets an alternate drag root element. The root element is the element that will be moved as
931
- * the user is dragging. Passing an alternate root element is useful when trying to enable
932
- * dragging on an element that you might not have access to.
777
+ * Map tracking DOM nodes and their corresponding drag directives. Note that this is different
778
+ * from looking through the `_dragInstances` and getting their root node, because the root node
779
+ * isn't necessarily the node that the directive is set on.
933
780
  */
934
- withRootElement(rootElement: ElementRef<HTMLElement> | HTMLElement): this;
781
+ private _domNodesToDirectives;
935
782
  /**
936
- * Element to which the draggable's position will be constrained.
783
+ * Emits the `touchmove` or `mousemove` events that are dispatched
784
+ * while the user is dragging a drag item instance.
937
785
  */
938
- withBoundaryElement(boundaryElement: ElementRef<HTMLElement> | HTMLElement | null): this;
939
- /** Sets the parent ref that the ref is nested in. */
940
- withParent(parent: DragRef<unknown> | null): this;
941
- /** Removes the dragging functionality from the DOM element. */
942
- dispose(): void;
943
- /** Checks whether the element is currently being dragged. */
944
- isDragging(): boolean;
945
- /** Resets a standalone drag item to its initial position. */
946
- reset(): void;
786
+ readonly pointerMove: Subject<TouchEvent | MouseEvent>;
947
787
  /**
948
- * Sets a handle as disabled. While a handle is disabled, it'll capture and interrupt dragging.
949
- * @param handle Handle element that should be disabled.
788
+ * Emits the `touchend` or `mouseup` events that are dispatched
789
+ * while the user is dragging a drag item instance.
950
790
  */
951
- disableHandle(handle: HTMLElement): void;
791
+ readonly pointerUp: Subject<TouchEvent | MouseEvent>;
792
+ constructor(...args: unknown[]);
793
+ /** Adds a drop container to the registry. */
794
+ registerDropContainer(drop: DropListRef): void;
795
+ /** Adds a drag item instance to the registry. */
796
+ registerDragItem(drag: DragRef): void;
797
+ /** Removes a drop container from the registry. */
798
+ removeDropContainer(drop: DropListRef): void;
799
+ /** Removes a drag item instance from the registry. */
800
+ removeDragItem(drag: DragRef): void;
952
801
  /**
953
- * Enables a handle, if it has been disabled.
954
- * @param handle Handle element to be enabled.
802
+ * Starts the dragging sequence for a drag instance.
803
+ * @param drag Drag instance which is being dragged.
804
+ * @param event Event that initiated the dragging.
955
805
  */
956
- enableHandle(handle: HTMLElement): void;
957
- /** Sets the layout direction of the draggable item. */
958
- withDirection(direction: Direction): this;
959
- /** Sets the container that the item is part of. */
960
- _withDropContainer(container: DropListRef): void;
806
+ startDragging(drag: DragRef, event: TouchEvent | MouseEvent): void;
807
+ /** Stops dragging a drag item instance. */
808
+ stopDragging(drag: DragRef): void;
809
+ /** Gets whether a drag item instance is currently being dragged. */
810
+ isDragging(drag: DragRef): boolean;
961
811
  /**
962
- * Gets the current position in pixels the draggable outside of a drop container.
812
+ * Gets a stream that will emit when any element on the page is scrolled while an item is being
813
+ * dragged.
814
+ * @param shadowRoot Optional shadow root that the current dragging sequence started from.
815
+ * Top-level listeners won't pick up events coming from the shadow DOM so this parameter can
816
+ * be used to include an additional top-level listener at the shadow root level.
963
817
  */
964
- getFreeDragPosition(): Readonly<Point>;
818
+ scrolled(shadowRoot?: DocumentOrShadowRoot | null): Observable<Event>;
965
819
  /**
966
- * Sets the current position in pixels the draggable outside of a drop container.
967
- * @param value New position to be set.
820
+ * Tracks the DOM node which has a draggable directive.
821
+ * @param node Node to track.
822
+ * @param dragRef Drag directive set on the node.
968
823
  */
969
- setFreeDragPosition(value: Point): this;
824
+ registerDirectiveNode(node: Node, dragRef: CdkDrag): void;
970
825
  /**
971
- * Sets the container into which to insert the preview element.
972
- * @param value Container into which to insert the preview.
826
+ * Stops tracking a draggable directive node.
827
+ * @param node Node to stop tracking.
973
828
  */
974
- withPreviewContainer(value: PreviewContainer): this;
975
- /** Updates the item's sort order based on the last-known pointer position. */
976
- _sortFromLastPointerPosition(): void;
977
- /** Unsubscribes from the global subscriptions. */
978
- private _removeListeners;
979
- /** Destroys the preview element and its ViewRef. */
980
- private _destroyPreview;
981
- /** Destroys the placeholder element and its ViewRef. */
982
- private _destroyPlaceholder;
983
- /** Handler for the `mousedown`/`touchstart` events. */
984
- private _pointerDown;
985
- /** Handler that is invoked when the user moves their pointer after they've initiated a drag. */
986
- private _pointerMove;
987
- /** Handler that is invoked when the user lifts their pointer up, after initiating a drag. */
988
- private _pointerUp;
829
+ removeDirectiveNode(node: Node): void;
989
830
  /**
990
- * Clears subscriptions and stops the dragging sequence.
991
- * @param event Browser event object that ended the sequence.
831
+ * Gets the drag directive corresponding to a specific DOM node, if any.
832
+ * @param node Node for which to do the lookup.
992
833
  */
993
- private _endDragSequence;
994
- /** Starts the dragging sequence. */
995
- private _startDragSequence;
834
+ getDragDirectiveForNode(node: Node): CdkDrag | null;
835
+ ngOnDestroy(): void;
996
836
  /**
997
- * Sets up the different variables and subscriptions
998
- * that will be necessary for the dragging sequence.
999
- * @param referenceElement Element that started the drag sequence.
1000
- * @param event Browser event object that started the sequence.
837
+ * Event listener that will prevent the default browser action while the user is dragging.
838
+ * @param event Event whose default action should be prevented.
1001
839
  */
1002
- private _initializeDragSequence;
1003
- /** Cleans up the DOM artifacts that were added to facilitate the element being dragged. */
1004
- private _cleanupDragArtifacts;
840
+ private _preventDefaultWhileDragging;
841
+ /** Event listener for `touchmove` that is bound even if no dragging is happening. */
842
+ private _persistentTouchmoveListener;
843
+ /** Clears out the global event listeners from the `document`. */
844
+ private _clearGlobalListeners;
845
+ static ɵfac: i0.ɵɵFactoryDeclaration<DragDropRegistry, never>;
846
+ static ɵprov: i0.ɵɵInjectableDeclaration<DragDropRegistry>;
847
+ }
848
+
849
+ /** Template that can be used to create a drag preview element. */
850
+ interface DragPreviewTemplate<T = any> {
851
+ matchSize?: boolean;
852
+ template: TemplateRef<T> | null;
853
+ viewContainer: ViewContainerRef;
854
+ context: T;
855
+ }
856
+
857
+ /** Object that can be used to configure the behavior of DragRef. */
858
+ interface DragRefConfig {
1005
859
  /**
1006
- * Updates the item's position in its drop container, or moves it
1007
- * into a new one, depending on its current drag position.
860
+ * Minimum amount of pixels that the user should
861
+ * drag, before the CDK initiates a drag sequence.
1008
862
  */
1009
- private _updateActiveDropContainer;
863
+ dragStartThreshold: number;
1010
864
  /**
1011
- * Animates the preview element from its current position to the location of the drop placeholder.
1012
- * @returns Promise that resolves when the animation completes.
865
+ * Amount the pixels the user should drag before the CDK
866
+ * considers them to have changed the drag direction.
1013
867
  */
1014
- private _animatePreviewToPlaceholder;
1015
- /** Creates an element that will be shown instead of the current element while dragging. */
1016
- private _createPlaceholderElement;
868
+ pointerDirectionChangeThreshold: number;
869
+ /** `z-index` for the absolutely-positioned elements that are created by the drag item. */
870
+ zIndex?: number;
871
+ /** Ref that the current drag item is nested in. */
872
+ parentDragRef?: DragRef;
873
+ }
874
+ /** Function that can be used to constrain the position of a dragged element. */
875
+ type DragConstrainPosition = (userPointerPosition: Point, dragRef: DragRef, dimensions: DOMRect, pickupPositionInElement: Point) => Point;
876
+ /** Template that can be used to create a drag helper element (e.g. a preview or a placeholder). */
877
+ interface DragHelperTemplate<T = any> {
878
+ template: TemplateRef<T> | null;
879
+ viewContainer: ViewContainerRef;
880
+ context: T;
881
+ }
882
+ /** Point on the page or within an element. */
883
+ interface Point {
884
+ x: number;
885
+ y: number;
886
+ }
887
+ /**
888
+ * Possible places into which the preview of a drag item can be inserted.
889
+ * - `global` - Preview will be inserted at the bottom of the `<body>`. The advantage is that
890
+ * you don't have to worry about `overflow: hidden` or `z-index`, but the item won't retain
891
+ * its inherited styles.
892
+ * - `parent` - Preview will be inserted into the parent of the drag item. The advantage is that
893
+ * inherited styles will be preserved, but it may be clipped by `overflow: hidden` or not be
894
+ * visible due to `z-index`. Furthermore, the preview is going to have an effect over selectors
895
+ * like `:nth-child` and some flexbox configurations.
896
+ * - `ElementRef<HTMLElement> | HTMLElement` - Preview will be inserted into a specific element.
897
+ * Same advantages and disadvantages as `parent`.
898
+ */
899
+ type PreviewContainer = 'global' | 'parent' | ElementRef<HTMLElement> | HTMLElement;
900
+ /**
901
+ * Reference to a draggable item. Used to manipulate or dispose of the item.
902
+ */
903
+ declare class DragRef<T = any> {
904
+ private _config;
905
+ private _document;
906
+ private _ngZone;
907
+ private _viewportRuler;
908
+ private _dragDropRegistry;
909
+ private _renderer;
910
+ private _rootElementCleanups;
911
+ private _cleanupShadowRootSelectStart;
912
+ /** Element displayed next to the user's pointer while the element is dragged. */
913
+ private _preview;
914
+ /** Container into which to insert the preview. */
915
+ private _previewContainer;
916
+ /** Reference to the view of the placeholder element. */
917
+ private _placeholderRef;
918
+ /** Element that is rendered instead of the draggable item while it is being sorted. */
919
+ private _placeholder;
920
+ /** Coordinates within the element at which the user picked up the element. */
921
+ private _pickupPositionInElement;
922
+ /** Coordinates on the page at which the user picked up the element. */
923
+ private _pickupPositionOnPage;
1017
924
  /**
1018
- * Figures out the coordinates at which an element was picked up.
1019
- * @param referenceElement Element that initiated the dragging.
1020
- * @param event Event that initiated the dragging.
925
+ * Anchor node used to save the place in the DOM where the element was
926
+ * picked up so that it can be restored at the end of the drag sequence.
1021
927
  */
1022
- private _getPointerPositionInElement;
1023
- /** Determines the point of the page that was touched by the user. */
1024
- private _getPointerPositionOnPage;
1025
- /** Gets the pointer position on the page, accounting for any position constraints. */
1026
- private _getConstrainedPointerPosition;
1027
- /** Updates the current drag delta, based on the user's current pointer position on the page. */
1028
- private _updatePointerDirectionDelta;
1029
- /** Toggles the native drag interactions, based on how many handles are registered. */
1030
- private _toggleNativeDragInteractions;
1031
- /** Removes the manually-added event listeners from the root element. */
1032
- private _removeRootElementListeners;
928
+ private _anchor;
1033
929
  /**
1034
- * Applies a `transform` to the root element, taking into account any existing transforms on it.
1035
- * @param x New transform value along the X axis.
1036
- * @param y New transform value along the Y axis.
930
+ * CSS `transform` applied to the element when it isn't being dragged. We need a
931
+ * passive transform in order for the dragged element to retain its new position
932
+ * after the user has stopped dragging and because we need to know the relative
933
+ * position in case they start dragging again. This corresponds to `element.style.transform`.
1037
934
  */
1038
- private _applyRootElementTransform;
935
+ private _passiveTransform;
936
+ /** CSS `transform` that is applied to the element while it's being dragged. */
937
+ private _activeTransform;
938
+ /** Inline `transform` value that the element had before the first dragging sequence. */
939
+ private _initialTransform?;
1039
940
  /**
1040
- * Applies a `transform` to the preview, taking into account any existing transforms on it.
1041
- * @param x New transform value along the X axis.
1042
- * @param y New transform value along the Y axis.
941
+ * Whether the dragging sequence has been started. Doesn't
942
+ * necessarily mean that the element has been moved.
1043
943
  */
1044
- private _applyPreviewTransform;
944
+ private _hasStartedDragging;
945
+ /** Whether the element has moved since the user started dragging it. */
946
+ private _hasMoved;
947
+ /** Drop container in which the DragRef resided when dragging began. */
948
+ private _initialContainer;
949
+ /** Index at which the item started in its initial container. */
950
+ private _initialIndex;
951
+ /** Cached positions of scrollable parent elements. */
952
+ private _parentPositions;
953
+ /** Emits when the item is being moved. */
954
+ private readonly _moveEvents;
955
+ /** Keeps track of the direction in which the user is dragging along each axis. */
956
+ private _pointerDirectionDelta;
957
+ /** Pointer position at which the last change in the delta occurred. */
958
+ private _pointerPositionAtLastDirectionChange;
959
+ /** Position of the pointer at the last pointer event. */
960
+ private _lastKnownPointerPosition;
1045
961
  /**
1046
- * Gets the distance that the user has dragged during the current drag sequence.
1047
- * @param currentPosition Current position of the user's pointer.
962
+ * Root DOM node of the drag instance. This is the element that will
963
+ * be moved around as the user is dragging.
1048
964
  */
1049
- private _getDragDistance;
1050
- /** Cleans up any cached element dimensions that we don't need after dragging has stopped. */
1051
- private _cleanupCachedDimensions;
965
+ private _rootElement;
1052
966
  /**
1053
- * Checks whether the element is still inside its boundary after the viewport has been resized.
1054
- * If not, the position is adjusted so that the element fits again.
967
+ * Nearest ancestor SVG, relative to which coordinates are calculated if dragging SVGElement
1055
968
  */
1056
- private _containInsideBoundaryOnResize;
1057
- /** Gets the drag start delay, based on the event type. */
1058
- private _getDragStartDelay;
1059
- /** Updates the internal state of the draggable element when scrolling has occurred. */
1060
- private _updateOnScroll;
1061
- /** Gets the scroll position of the viewport. */
1062
- private _getViewportScrollPosition;
969
+ private _ownerSVGElement;
1063
970
  /**
1064
- * Lazily resolves and returns the shadow root of the element. We do this in a function, rather
1065
- * than saving it in property directly on init, because we want to resolve it as late as possible
1066
- * in order to ensure that the element has been moved into the shadow DOM. Doing it inside the
1067
- * constructor might be too early if the element is inside of something like `ngFor` or `ngIf`.
971
+ * Inline style value of `-webkit-tap-highlight-color` at the time the
972
+ * dragging was started. Used to restore the value once we're done dragging.
1068
973
  */
1069
- private _getShadowRoot;
1070
- /** Gets the element into which the drag preview should be inserted. */
1071
- private _getPreviewInsertionPoint;
1072
- /** Lazily resolves and returns the dimensions of the preview. */
1073
- private _getPreviewRect;
1074
- /** Handles a native `dragstart` event. */
1075
- private _nativeDragStart;
1076
- /** Gets a handle that is the target of an event. */
1077
- private _getTargetHandle;
1078
- }
1079
-
1080
- /** Object that can be used to configure the behavior of DragRef. */
1081
- export declare interface DragRefConfig {
974
+ private _rootElementTapHighlight;
975
+ /** Subscription to pointer movement events. */
976
+ private _pointerMoveSubscription;
977
+ /** Subscription to the event that is dispatched when the user lifts their pointer. */
978
+ private _pointerUpSubscription;
979
+ /** Subscription to the viewport being scrolled. */
980
+ private _scrollSubscription;
981
+ /** Subscription to the viewport being resized. */
982
+ private _resizeSubscription;
1082
983
  /**
1083
- * Minimum amount of pixels that the user should
1084
- * drag, before the CDK initiates a drag sequence.
984
+ * Time at which the last touch event occurred. Used to avoid firing the same
985
+ * events multiple times on touch devices where the browser will fire a fake
986
+ * mouse event for each touch event, after a certain time.
1085
987
  */
1086
- dragStartThreshold: number;
988
+ private _lastTouchEventTime;
989
+ /** Time at which the last dragging sequence was started. */
990
+ private _dragStartTime;
991
+ /** Cached reference to the boundary element. */
992
+ private _boundaryElement;
993
+ /** Whether the native dragging interactions have been enabled on the root element. */
994
+ private _nativeInteractionsEnabled;
995
+ /** Client rect of the root element when the dragging sequence has started. */
996
+ private _initialDomRect?;
997
+ /** Cached dimensions of the preview element. Should be read via `_getPreviewRect`. */
998
+ private _previewRect?;
999
+ /** Cached dimensions of the boundary element. */
1000
+ private _boundaryRect?;
1001
+ /** Element that will be used as a template to create the draggable item's preview. */
1002
+ private _previewTemplate?;
1003
+ /** Template for placeholder element rendered to show where a draggable would be dropped. */
1004
+ private _placeholderTemplate?;
1005
+ /** Elements that can be used to drag the draggable item. */
1006
+ private _handles;
1007
+ /** Registered handles that are currently disabled. */
1008
+ private _disabledHandles;
1009
+ /** Droppable container that the draggable is a part of. */
1010
+ private _dropContainer?;
1011
+ /** Layout direction of the item. */
1012
+ private _direction;
1013
+ /** Ref that the current drag item is nested in. */
1014
+ private _parentDragRef;
1087
1015
  /**
1088
- * Amount the pixels the user should drag before the CDK
1089
- * considers them to have changed the drag direction.
1016
+ * Cached shadow root that the element is placed in. `null` means that the element isn't in
1017
+ * the shadow DOM and `undefined` means that it hasn't been resolved yet. Should be read via
1018
+ * `_getShadowRoot`, not directly.
1090
1019
  */
1091
- pointerDirectionChangeThreshold: number;
1092
- /** `z-index` for the absolutely-positioned elements that are created by the drag item. */
1093
- zIndex?: number;
1094
- /** Ref that the current drag item is nested in. */
1095
- parentDragRef?: DragRef;
1096
- }
1097
-
1098
- /** Possible values that can be used to configure the drag start delay. */
1099
- export declare type DragStartDelay = number | {
1100
- touch: number;
1101
- mouse: number;
1102
- };
1103
-
1104
- /** Possible orientations for a drop list. */
1105
- export declare type DropListOrientation = 'horizontal' | 'vertical' | 'mixed';
1106
-
1107
- /**
1108
- * Reference to a drop list. Used to manipulate or dispose of the container.
1109
- */
1110
- export declare class DropListRef<T = any> {
1111
- private _dragDropRegistry;
1112
- private _ngZone;
1113
- private _viewportRuler;
1114
- /** Element that the drop list is attached to. */
1115
- element: HTMLElement | ElementRef<HTMLElement>;
1116
- /** Whether starting a dragging sequence from this container is disabled. */
1117
- disabled: boolean;
1118
- /** Whether sorting items within the list is disabled. */
1119
- sortingDisabled: boolean;
1120
- /** Locks the position of the draggable elements inside the container along the specified axis. */
1020
+ private _cachedShadowRoot;
1021
+ /** Axis along which dragging is locked. */
1121
1022
  lockAxis: 'x' | 'y';
1122
1023
  /**
1123
- * Whether auto-scrolling the view when the user
1124
- * moves their pointer close to the edges is disabled.
1024
+ * Amount of milliseconds to wait after the user has put their
1025
+ * pointer down before starting to drag the element.
1125
1026
  */
1126
- autoScrollDisabled: boolean;
1127
- /** Number of pixels to scroll for each frame when auto-scrolling an element. */
1128
- autoScrollStep: number;
1027
+ dragStartDelay: number | {
1028
+ touch: number;
1029
+ mouse: number;
1030
+ };
1031
+ /** Class to be added to the preview element. */
1032
+ previewClass: string | string[] | undefined;
1129
1033
  /**
1130
- * Function that is used to determine whether an item
1131
- * is allowed to be moved into a drop container.
1034
+ * If the parent of the dragged element has a `scale` transform, it can throw off the
1035
+ * positioning when the user starts dragging. Use this input to notify the CDK of the scale.
1132
1036
  */
1133
- enterPredicate: (drag: DragRef, drop: DropListRef) => boolean;
1134
- /** Function that is used to determine whether an item can be sorted into a particular index. */
1135
- sortPredicate: (index: number, drag: DragRef, drop: DropListRef) => boolean;
1136
- /** Emits right before dragging has started. */
1037
+ scale: number;
1038
+ /** Whether starting to drag this element is disabled. */
1039
+ get disabled(): boolean;
1040
+ set disabled(value: boolean);
1041
+ private _disabled;
1042
+ /** Emits as the drag sequence is being prepared. */
1137
1043
  readonly beforeStarted: Subject<void>;
1138
- /**
1139
- * Emits when the user has moved a new drag item into this container.
1140
- */
1044
+ /** Emits when the user starts dragging the item. */
1045
+ readonly started: Subject<{
1046
+ source: DragRef;
1047
+ event: MouseEvent | TouchEvent;
1048
+ }>;
1049
+ /** Emits when the user has released a drag item, before any animations have started. */
1050
+ readonly released: Subject<{
1051
+ source: DragRef;
1052
+ event: MouseEvent | TouchEvent;
1053
+ }>;
1054
+ /** Emits when the user stops dragging an item in the container. */
1055
+ readonly ended: Subject<{
1056
+ source: DragRef;
1057
+ distance: Point;
1058
+ dropPoint: Point;
1059
+ event: MouseEvent | TouchEvent;
1060
+ }>;
1061
+ /** Emits when the user has moved the item into a new container. */
1141
1062
  readonly entered: Subject<{
1142
- item: DragRef;
1143
1063
  container: DropListRef;
1064
+ item: DragRef;
1144
1065
  currentIndex: number;
1145
1066
  }>;
1146
- /**
1147
- * Emits when the user removes an item from the container
1148
- * by dragging it into another container.
1149
- */
1067
+ /** Emits when the user removes the item its container by dragging it into another container. */
1150
1068
  readonly exited: Subject<{
1151
- item: DragRef;
1152
1069
  container: DropListRef;
1070
+ item: DragRef;
1153
1071
  }>;
1154
- /** Emits when the user drops an item inside the container. */
1072
+ /** Emits when the user drops the item inside a container. */
1155
1073
  readonly dropped: Subject<{
1156
- item: DragRef;
1157
- currentIndex: number;
1158
1074
  previousIndex: number;
1075
+ currentIndex: number;
1076
+ item: DragRef;
1159
1077
  container: DropListRef;
1160
1078
  previousContainer: DropListRef;
1161
- isPointerOverContainer: boolean;
1162
1079
  distance: Point;
1163
1080
  dropPoint: Point;
1081
+ isPointerOverContainer: boolean;
1164
1082
  event: MouseEvent | TouchEvent;
1165
1083
  }>;
1166
- /** Emits as the user is swapping items while actively dragging. */
1167
- readonly sorted: Subject<{
1168
- previousIndex: number;
1169
- currentIndex: number;
1170
- container: DropListRef;
1171
- item: DragRef;
1172
- }>;
1173
- /** Emits when a dragging sequence is started in a list connected to the current one. */
1174
- readonly receivingStarted: Subject<{
1175
- receiver: DropListRef;
1176
- initiator: DropListRef;
1177
- items: DragRef[];
1178
- }>;
1179
- /** Emits when a dragging sequence is stopped from a list connected to the current one. */
1180
- readonly receivingStopped: Subject<{
1181
- receiver: DropListRef;
1182
- initiator: DropListRef;
1084
+ /**
1085
+ * Emits as the user is dragging the item. Use with caution,
1086
+ * because this event will fire for every pixel that the user has dragged.
1087
+ */
1088
+ readonly moved: Observable<{
1089
+ source: DragRef;
1090
+ pointerPosition: {
1091
+ x: number;
1092
+ y: number;
1093
+ };
1094
+ event: MouseEvent | TouchEvent;
1095
+ distance: Point;
1096
+ delta: {
1097
+ x: -1 | 0 | 1;
1098
+ y: -1 | 0 | 1;
1099
+ };
1183
1100
  }>;
1184
- /** Arbitrary data that can be attached to the drop list. */
1101
+ /** Arbitrary data that can be attached to the drag item. */
1185
1102
  data: T;
1186
- /** Element that is the direct parent of the drag items. */
1187
- private _container;
1188
- /** Whether an item in the list is being dragged. */
1189
- private _isDragging;
1190
- /** Keeps track of the positions of any parent scrollable elements. */
1191
- private _parentPositions;
1192
- /** Strategy being used to sort items within the list. */
1193
- private _sortStrategy;
1194
- /** Cached `DOMRect` of the drop list. */
1195
- private _domRect;
1196
- /** Draggable items in the container. */
1197
- private _draggables;
1198
- /** Drop lists that are connected to the current one. */
1199
- private _siblings;
1200
- /** Connected siblings that currently have a dragged item. */
1201
- private _activeSiblings;
1202
- /** Subscription to the window being scrolled. */
1203
- private _viewportScrollSubscription;
1204
- /** Vertical direction in which the list is currently scrolling. */
1205
- private _verticalScrollDirection;
1206
- /** Horizontal direction in which the list is currently scrolling. */
1207
- private _horizontalScrollDirection;
1208
- /** Node that is being auto-scrolled. */
1209
- private _scrollNode;
1210
- /** Used to signal to the current auto-scroll sequence when to stop. */
1211
- private readonly _stopScrollTimers;
1212
- /** Shadow root of the current element. Necessary for `elementFromPoint` to resolve correctly. */
1213
- private _cachedShadowRoot;
1214
- /** Reference to the document. */
1215
- private _document;
1216
- /** Elements that can be scrolled while the user is dragging. */
1217
- private _scrollableElements;
1218
- /** Initial value for the element's `scroll-snap-type` style. */
1219
- private _initialScrollSnap;
1220
- /** Direction of the list's layout. */
1221
- private _direction;
1222
- constructor(element: ElementRef<HTMLElement> | HTMLElement, _dragDropRegistry: DragDropRegistry, _document: any, _ngZone: NgZone, _viewportRuler: ViewportRuler);
1223
- /** Removes the drop list functionality from the DOM element. */
1224
- dispose(): void;
1225
- /** Whether an item from this list is currently being dragged. */
1226
- isDragging(): boolean;
1227
- /** Starts dragging an item. */
1228
- start(): void;
1229
1103
  /**
1230
- * Attempts to move an item into the container.
1231
- * @param item Item that was moved into the container.
1232
- * @param pointerX Position of the item along the X axis.
1233
- * @param pointerY Position of the item along the Y axis.
1234
- * @param index Index at which the item entered. If omitted, the container will try to figure it
1235
- * out automatically.
1104
+ * Function that can be used to customize the logic of how the position of the drag item
1105
+ * is limited while it's being dragged. Gets called with a point containing the current position
1106
+ * of the user's pointer on the page, a reference to the item being dragged and its dimensions.
1107
+ * Should return a point describing where the item should be rendered.
1236
1108
  */
1237
- enter(item: DragRef, pointerX: number, pointerY: number, index?: number): void;
1109
+ constrainPosition?: DragConstrainPosition;
1110
+ constructor(element: ElementRef<HTMLElement> | HTMLElement, _config: DragRefConfig, _document: Document, _ngZone: NgZone, _viewportRuler: ViewportRuler, _dragDropRegistry: DragDropRegistry, _renderer: Renderer2);
1238
1111
  /**
1239
- * Removes an item from the container after it was dragged into another container by the user.
1240
- * @param item Item that was dragged out.
1112
+ * Returns the element that is being used as a placeholder
1113
+ * while the current element is being dragged.
1241
1114
  */
1242
- exit(item: DragRef): void;
1115
+ getPlaceholderElement(): HTMLElement;
1116
+ /** Returns the root draggable element. */
1117
+ getRootElement(): HTMLElement;
1243
1118
  /**
1244
- * Drops an item into this container.
1245
- * @param item Item being dropped into the container.
1246
- * @param currentIndex Index at which the item should be inserted.
1247
- * @param previousIndex Index of the item when dragging started.
1248
- * @param previousContainer Container from which the item got dragged in.
1249
- * @param isPointerOverContainer Whether the user's pointer was over the
1250
- * container when the item was dropped.
1251
- * @param distance Distance the user has dragged since the start of the dragging sequence.
1252
- * @param event Event that triggered the dropping sequence.
1253
- *
1254
- * @breaking-change 15.0.0 `previousIndex` and `event` parameters to become required.
1119
+ * Gets the currently-visible element that represents the drag item.
1120
+ * While dragging this is the placeholder, otherwise it's the root element.
1255
1121
  */
1256
- drop(item: DragRef, currentIndex: number, previousIndex: number, previousContainer: DropListRef, isPointerOverContainer: boolean, distance: Point, dropPoint: Point, event?: MouseEvent | TouchEvent): void;
1122
+ getVisibleElement(): HTMLElement;
1123
+ /** Registers the handles that can be used to drag the element. */
1124
+ withHandles(handles: (HTMLElement | ElementRef<HTMLElement>)[]): this;
1257
1125
  /**
1258
- * Sets the draggable items that are a part of this list.
1259
- * @param items Items that are a part of this list.
1126
+ * Registers the template that should be used for the drag preview.
1127
+ * @param template Template that from which to stamp out the preview.
1260
1128
  */
1261
- withItems(items: DragRef[]): this;
1262
- /** Sets the layout direction of the drop list. */
1263
- withDirection(direction: Direction): this;
1129
+ withPreviewTemplate(template: DragPreviewTemplate | null): this;
1264
1130
  /**
1265
- * Sets the containers that are connected to this one. When two or more containers are
1266
- * connected, the user will be allowed to transfer items between them.
1267
- * @param connectedTo Other containers that the current containers should be connected to.
1131
+ * Registers the template that should be used for the drag placeholder.
1132
+ * @param template Template that from which to stamp out the placeholder.
1133
+ */
1134
+ withPlaceholderTemplate(template: DragHelperTemplate | null): this;
1135
+ /**
1136
+ * Sets an alternate drag root element. The root element is the element that will be moved as
1137
+ * the user is dragging. Passing an alternate root element is useful when trying to enable
1138
+ * dragging on an element that you might not have access to.
1139
+ */
1140
+ withRootElement(rootElement: ElementRef<HTMLElement> | HTMLElement): this;
1141
+ /**
1142
+ * Element to which the draggable's position will be constrained.
1143
+ */
1144
+ withBoundaryElement(boundaryElement: ElementRef<HTMLElement> | HTMLElement | null): this;
1145
+ /** Sets the parent ref that the ref is nested in. */
1146
+ withParent(parent: DragRef<unknown> | null): this;
1147
+ /** Removes the dragging functionality from the DOM element. */
1148
+ dispose(): void;
1149
+ /** Checks whether the element is currently being dragged. */
1150
+ isDragging(): boolean;
1151
+ /** Resets a standalone drag item to its initial position. */
1152
+ reset(): void;
1153
+ /**
1154
+ * Sets a handle as disabled. While a handle is disabled, it'll capture and interrupt dragging.
1155
+ * @param handle Handle element that should be disabled.
1268
1156
  */
1269
- connectedTo(connectedTo: DropListRef[]): this;
1157
+ disableHandle(handle: HTMLElement): void;
1270
1158
  /**
1271
- * Sets the orientation of the container.
1272
- * @param orientation New orientation for the container.
1159
+ * Enables a handle, if it has been disabled.
1160
+ * @param handle Handle element to be enabled.
1273
1161
  */
1274
- withOrientation(orientation: DropListOrientation): this;
1162
+ enableHandle(handle: HTMLElement): void;
1163
+ /** Sets the layout direction of the draggable item. */
1164
+ withDirection(direction: Direction): this;
1165
+ /** Sets the container that the item is part of. */
1166
+ _withDropContainer(container: DropListRef): void;
1275
1167
  /**
1276
- * Sets which parent elements are can be scrolled while the user is dragging.
1277
- * @param elements Elements that can be scrolled.
1168
+ * Gets the current position in pixels the draggable outside of a drop container.
1278
1169
  */
1279
- withScrollableParents(elements: HTMLElement[]): this;
1170
+ getFreeDragPosition(): Readonly<Point>;
1280
1171
  /**
1281
- * Configures the drop list so that a different element is used as the container for the
1282
- * dragged items. This is useful for the cases when one might not have control over the
1283
- * full DOM that sets up the dragging.
1284
- * Note that the alternate container needs to be a descendant of the drop list.
1285
- * @param container New element container to be assigned.
1172
+ * Sets the current position in pixels the draggable outside of a drop container.
1173
+ * @param value New position to be set.
1286
1174
  */
1287
- withElementContainer(container: HTMLElement): this;
1288
- /** Gets the scrollable parents that are registered with this drop container. */
1289
- getScrollableParents(): readonly HTMLElement[];
1175
+ setFreeDragPosition(value: Point): this;
1290
1176
  /**
1291
- * Figures out the index of an item in the container.
1292
- * @param item Item whose index should be determined.
1177
+ * Sets the container into which to insert the preview element.
1178
+ * @param value Container into which to insert the preview.
1293
1179
  */
1294
- getItemIndex(item: DragRef): number;
1180
+ withPreviewContainer(value: PreviewContainer): this;
1181
+ /** Updates the item's sort order based on the last-known pointer position. */
1182
+ _sortFromLastPointerPosition(): void;
1183
+ /** Unsubscribes from the global subscriptions. */
1184
+ private _removeListeners;
1185
+ /** Destroys the preview element and its ViewRef. */
1186
+ private _destroyPreview;
1187
+ /** Destroys the placeholder element and its ViewRef. */
1188
+ private _destroyPlaceholder;
1189
+ /** Handler for the `mousedown`/`touchstart` events. */
1190
+ private _pointerDown;
1191
+ /** Handler that is invoked when the user moves their pointer after they've initiated a drag. */
1192
+ private _pointerMove;
1193
+ /** Handler that is invoked when the user lifts their pointer up, after initiating a drag. */
1194
+ private _pointerUp;
1295
1195
  /**
1296
- * Whether the list is able to receive the item that
1297
- * is currently being dragged inside a connected drop list.
1196
+ * Clears subscriptions and stops the dragging sequence.
1197
+ * @param event Browser event object that ended the sequence.
1298
1198
  */
1299
- isReceiving(): boolean;
1199
+ private _endDragSequence;
1200
+ /** Starts the dragging sequence. */
1201
+ private _startDragSequence;
1300
1202
  /**
1301
- * Sorts an item inside the container based on its position.
1302
- * @param item Item to be sorted.
1303
- * @param pointerX Position of the item along the X axis.
1304
- * @param pointerY Position of the item along the Y axis.
1305
- * @param pointerDelta Direction in which the pointer is moving along each axis.
1203
+ * Sets up the different variables and subscriptions
1204
+ * that will be necessary for the dragging sequence.
1205
+ * @param referenceElement Element that started the drag sequence.
1206
+ * @param event Browser event object that started the sequence.
1306
1207
  */
1307
- _sortItem(item: DragRef, pointerX: number, pointerY: number, pointerDelta: {
1308
- x: number;
1309
- y: number;
1310
- }): void;
1208
+ private _initializeDragSequence;
1209
+ /** Cleans up the DOM artifacts that were added to facilitate the element being dragged. */
1210
+ private _cleanupDragArtifacts;
1311
1211
  /**
1312
- * Checks whether the user's pointer is close to the edges of either the
1313
- * viewport or the drop list and starts the auto-scroll sequence.
1314
- * @param pointerX User's pointer position along the x axis.
1315
- * @param pointerY User's pointer position along the y axis.
1212
+ * Updates the item's position in its drop container, or moves it
1213
+ * into a new one, depending on its current drag position.
1316
1214
  */
1317
- _startScrollingIfNecessary(pointerX: number, pointerY: number): void;
1318
- /** Stops any currently-running auto-scroll sequences. */
1319
- _stopScrolling(): void;
1320
- /** Starts the dragging sequence within the list. */
1321
- private _draggingStarted;
1322
- /** Caches the positions of the configured scrollable parents. */
1323
- private _cacheParentPositions;
1324
- /** Resets the container to its initial state. */
1325
- private _reset;
1326
- /** Starts the interval that'll auto-scroll the element. */
1327
- private _startScrollInterval;
1215
+ private _updateActiveDropContainer;
1328
1216
  /**
1329
- * Checks whether the user's pointer is positioned over the container.
1330
- * @param x Pointer position along the X axis.
1331
- * @param y Pointer position along the Y axis.
1217
+ * Animates the preview element from its current position to the location of the drop placeholder.
1218
+ * @returns Promise that resolves when the animation completes.
1332
1219
  */
1333
- _isOverContainer(x: number, y: number): boolean;
1220
+ private _animatePreviewToPlaceholder;
1221
+ /** Creates an element that will be shown instead of the current element while dragging. */
1222
+ private _createPlaceholderElement;
1334
1223
  /**
1335
- * Figures out whether an item should be moved into a sibling
1336
- * drop container, based on its current position.
1337
- * @param item Drag item that is being moved.
1338
- * @param x Position of the item along the X axis.
1339
- * @param y Position of the item along the Y axis.
1224
+ * Figures out the coordinates at which an element was picked up.
1225
+ * @param referenceElement Element that initiated the dragging.
1226
+ * @param event Event that initiated the dragging.
1340
1227
  */
1341
- _getSiblingContainerFromPosition(item: DragRef, x: number, y: number): DropListRef | undefined;
1228
+ private _getPointerPositionInElement;
1229
+ /** Determines the point of the page that was touched by the user. */
1230
+ private _getPointerPositionOnPage;
1231
+ /** Gets the pointer position on the page, accounting for any position constraints. */
1232
+ private _getConstrainedPointerPosition;
1233
+ /** Updates the current drag delta, based on the user's current pointer position on the page. */
1234
+ private _updatePointerDirectionDelta;
1235
+ /** Toggles the native drag interactions, based on how many handles are registered. */
1236
+ private _toggleNativeDragInteractions;
1237
+ /** Removes the manually-added event listeners from the root element. */
1238
+ private _removeRootElementListeners;
1342
1239
  /**
1343
- * Checks whether the drop list can receive the passed-in item.
1344
- * @param item Item that is being dragged into the list.
1345
- * @param x Position of the item along the X axis.
1346
- * @param y Position of the item along the Y axis.
1240
+ * Applies a `transform` to the root element, taking into account any existing transforms on it.
1241
+ * @param x New transform value along the X axis.
1242
+ * @param y New transform value along the Y axis.
1347
1243
  */
1348
- _canReceive(item: DragRef, x: number, y: number): boolean;
1244
+ private _applyRootElementTransform;
1349
1245
  /**
1350
- * Called by one of the connected drop lists when a dragging sequence has started.
1351
- * @param sibling Sibling in which dragging has started.
1246
+ * Applies a `transform` to the preview, taking into account any existing transforms on it.
1247
+ * @param x New transform value along the X axis.
1248
+ * @param y New transform value along the Y axis.
1352
1249
  */
1353
- _startReceiving(sibling: DropListRef, items: DragRef[]): void;
1250
+ private _applyPreviewTransform;
1354
1251
  /**
1355
- * Called by a connected drop list when dragging has stopped.
1356
- * @param sibling Sibling whose dragging has stopped.
1252
+ * Gets the distance that the user has dragged during the current drag sequence.
1253
+ * @param currentPosition Current position of the user's pointer.
1357
1254
  */
1358
- _stopReceiving(sibling: DropListRef): void;
1255
+ private _getDragDistance;
1256
+ /** Cleans up any cached element dimensions that we don't need after dragging has stopped. */
1257
+ private _cleanupCachedDimensions;
1359
1258
  /**
1360
- * Starts listening to scroll events on the viewport.
1361
- * Used for updating the internal state of the list.
1259
+ * Checks whether the element is still inside its boundary after the viewport has been resized.
1260
+ * If not, the position is adjusted so that the element fits again.
1362
1261
  */
1363
- private _listenToScrollEvents;
1262
+ private _containInsideBoundaryOnResize;
1263
+ /** Gets the drag start delay, based on the event type. */
1264
+ private _getDragStartDelay;
1265
+ /** Updates the internal state of the draggable element when scrolling has occurred. */
1266
+ private _updateOnScroll;
1267
+ /** Gets the scroll position of the viewport. */
1268
+ private _getViewportScrollPosition;
1364
1269
  /**
1365
1270
  * Lazily resolves and returns the shadow root of the element. We do this in a function, rather
1366
1271
  * than saving it in property directly on init, because we want to resolve it as late as possible
@@ -1368,51 +1273,48 @@ export declare class DropListRef<T = any> {
1368
1273
  * constructor might be too early if the element is inside of something like `ngFor` or `ngIf`.
1369
1274
  */
1370
1275
  private _getShadowRoot;
1371
- /** Notifies any siblings that may potentially receive the item. */
1372
- private _notifyReceivingSiblings;
1373
- }
1374
-
1375
- declare namespace i1 {
1376
- export {
1377
- CdkDropList
1378
- }
1379
- }
1380
-
1381
- declare namespace i2 {
1382
- export {
1383
- CDK_DROP_LIST_GROUP,
1384
- CdkDropListGroup
1385
- }
1386
- }
1387
-
1388
- declare namespace i3 {
1389
- export {
1390
- CDK_DROP_LIST,
1391
- CdkDrag
1392
- }
1393
- }
1394
-
1395
- declare namespace i4 {
1396
- export {
1397
- CDK_DRAG_HANDLE,
1398
- CdkDragHandle
1399
- }
1400
- }
1401
-
1402
- declare namespace i5 {
1403
- export {
1404
- CDK_DRAG_PREVIEW,
1405
- CdkDragPreview
1406
- }
1276
+ /** Gets the element into which the drag preview should be inserted. */
1277
+ private _getPreviewInsertionPoint;
1278
+ /** Lazily resolves and returns the dimensions of the preview. */
1279
+ private _getPreviewRect;
1280
+ /** Handles a native `dragstart` event. */
1281
+ private _nativeDragStart;
1282
+ /** Gets a handle that is the target of an event. */
1283
+ private _getTargetHandle;
1407
1284
  }
1408
1285
 
1409
- declare namespace i6 {
1410
- export {
1411
- CDK_DRAG_PLACEHOLDER,
1412
- CdkDragPlaceholder
1413
- }
1286
+ /**
1287
+ * Service that allows for drag-and-drop functionality to be attached to DOM elements.
1288
+ */
1289
+ declare class DragDrop {
1290
+ private _document;
1291
+ private _ngZone;
1292
+ private _viewportRuler;
1293
+ private _dragDropRegistry;
1294
+ private _renderer;
1295
+ constructor(...args: unknown[]);
1296
+ /**
1297
+ * Turns an element into a draggable item.
1298
+ * @param element Element to which to attach the dragging functionality.
1299
+ * @param config Object used to configure the dragging behavior.
1300
+ */
1301
+ createDrag<T = any>(element: ElementRef<HTMLElement> | HTMLElement, config?: DragRefConfig): DragRef<T>;
1302
+ /**
1303
+ * Turns an element into a drop list.
1304
+ * @param element Element to which to attach the drop list functionality.
1305
+ */
1306
+ createDropList<T = any>(element: ElementRef<HTMLElement> | HTMLElement): DropListRef<T>;
1307
+ static ɵfac: i0.ɵɵFactoryDeclaration<DragDrop, never>;
1308
+ static ɵprov: i0.ɵɵInjectableDeclaration<DragDrop>;
1414
1309
  }
1415
1310
 
1311
+ /**
1312
+ * Injection token that can be used for a `CdkDrag` to provide itself as a parent to the
1313
+ * drag-specific child directive (`CdkDragHandle`, `CdkDragPreview` etc.). Used primarily
1314
+ * to avoid circular imports.
1315
+ * @docs-private
1316
+ */
1317
+ declare const CDK_DRAG_PARENT: InjectionToken<CdkDrag<any>>;
1416
1318
 
1417
1319
  /**
1418
1320
  * Moves an item one index in an array to another.
@@ -1420,28 +1322,7 @@ declare namespace i6 {
1420
1322
  * @param fromIndex Starting index of the item.
1421
1323
  * @param toIndex Index to which the item should be moved.
1422
1324
  */
1423
- export declare function moveItemInArray<T = any>(array: T[], fromIndex: number, toIndex: number): void;
1424
-
1425
- /** Point on the page or within an element. */
1426
- export declare interface Point {
1427
- x: number;
1428
- y: number;
1429
- }
1430
-
1431
- /**
1432
- * Possible places into which the preview of a drag item can be inserted.
1433
- * - `global` - Preview will be inserted at the bottom of the `<body>`. The advantage is that
1434
- * you don't have to worry about `overflow: hidden` or `z-index`, but the item won't retain
1435
- * its inherited styles.
1436
- * - `parent` - Preview will be inserted into the parent of the drag item. The advantage is that
1437
- * inherited styles will be preserved, but it may be clipped by `overflow: hidden` or not be
1438
- * visible due to `z-index`. Furthermore, the preview is going to have an effect over selectors
1439
- * like `:nth-child` and some flexbox configurations.
1440
- * - `ElementRef<HTMLElement> | HTMLElement` - Preview will be inserted into a specific element.
1441
- * Same advantages and disadvantages as `parent`.
1442
- */
1443
- export declare type PreviewContainer = 'global' | 'parent' | ElementRef<HTMLElement> | HTMLElement;
1444
-
1325
+ declare function moveItemInArray<T = any>(array: T[], fromIndex: number, toIndex: number): void;
1445
1326
  /**
1446
1327
  * Moves an item from one array to another.
1447
1328
  * @param currentArray Array from which to transfer the item.
@@ -1449,6 +1330,45 @@ export declare type PreviewContainer = 'global' | 'parent' | ElementRef<HTMLElem
1449
1330
  * @param currentIndex Index of the item in its current array.
1450
1331
  * @param targetIndex Index at which to insert the item.
1451
1332
  */
1452
- export declare function transferArrayItem<T = any>(currentArray: T[], targetArray: T[], currentIndex: number, targetIndex: number): void;
1333
+ declare function transferArrayItem<T = any>(currentArray: T[], targetArray: T[], currentIndex: number, targetIndex: number): void;
1334
+ /**
1335
+ * Copies an item from one array to another, leaving it in its
1336
+ * original position in current array.
1337
+ * @param currentArray Array from which to copy the item.
1338
+ * @param targetArray Array into which is copy the item.
1339
+ * @param currentIndex Index of the item in its current array.
1340
+ * @param targetIndex Index at which to insert the item.
1341
+ *
1342
+ */
1343
+ declare function copyArrayItem<T = any>(currentArray: T[], targetArray: T[], currentIndex: number, targetIndex: number): void;
1344
+
1345
+ /**
1346
+ * Injection token that can be used to reference instances of `CdkDropListGroup`. It serves as
1347
+ * alternative token to the actual `CdkDropListGroup` class which could cause unnecessary
1348
+ * retention of the class and its directive metadata.
1349
+ */
1350
+ declare const CDK_DROP_LIST_GROUP: InjectionToken<CdkDropListGroup<unknown>>;
1351
+ /**
1352
+ * Declaratively connects sibling `cdkDropList` instances together. All of the `cdkDropList`
1353
+ * elements that are placed inside a `cdkDropListGroup` will be connected to each other
1354
+ * automatically. Can be used as an alternative to the `cdkDropListConnectedTo` input
1355
+ * from `cdkDropList`.
1356
+ */
1357
+ declare class CdkDropListGroup<T> implements OnDestroy {
1358
+ /** Drop lists registered inside the group. */
1359
+ readonly _items: Set<T>;
1360
+ /** Whether starting a dragging sequence from inside this group is disabled. */
1361
+ disabled: boolean;
1362
+ ngOnDestroy(): void;
1363
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkDropListGroup<any>, never>;
1364
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkDropListGroup<any>, "[cdkDropListGroup]", ["cdkDropListGroup"], { "disabled": { "alias": "cdkDropListGroupDisabled"; "required": false; }; }, {}, never, never, true, never>;
1365
+ static ngAcceptInputType_disabled: unknown;
1366
+ }
1367
+
1368
+ declare class DragDropModule {
1369
+ static ɵfac: i0.ɵɵFactoryDeclaration<DragDropModule, never>;
1370
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DragDropModule, never, [typeof CdkDropList, typeof CdkDropListGroup, typeof CdkDrag, typeof CdkDragHandle, typeof CdkDragPreview, typeof CdkDragPlaceholder], [typeof CdkScrollableModule, typeof CdkDropList, typeof CdkDropListGroup, typeof CdkDrag, typeof CdkDragHandle, typeof CdkDragPreview, typeof CdkDragPlaceholder]>;
1371
+ static ɵinj: i0.ɵɵInjectorDeclaration<DragDropModule>;
1372
+ }
1453
1373
 
1454
- export { }
1374
+ export { CDK_DRAG_CONFIG, CDK_DRAG_HANDLE, CDK_DRAG_PARENT, CDK_DRAG_PLACEHOLDER, CDK_DRAG_PREVIEW, CDK_DROP_LIST, CDK_DROP_LIST_GROUP, CdkDrag, type CdkDragDrop, type CdkDragEnd, type CdkDragEnter, type CdkDragExit, CdkDragHandle, type CdkDragMove, CdkDragPlaceholder, CdkDragPreview, type CdkDragRelease, type CdkDragSortEvent, type CdkDragStart, CdkDropList, CdkDropListGroup, type DragAxis, type DragConstrainPosition, DragDrop, type DragDropConfig, DragDropModule, DragDropRegistry, DragRef, type DragRefConfig, type DragStartDelay, type DropListOrientation, DropListRef, type Point, type PreviewContainer, copyArrayItem, moveItemInArray, transferArrayItem };