@angular/cdk 7.1.1 → 7.3.0

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 (228) hide show
  1. package/LICENSE +1 -1
  2. package/_a11y.scss +1 -1
  3. package/a11y/typings/focus-monitor/focus-monitor.d.ts +0 -1
  4. package/a11y/typings/focus-trap/focus-trap.d.ts +2 -0
  5. package/a11y/typings/index.metadata.json +1 -1
  6. package/bundles/cdk-a11y.umd.js +30 -24
  7. package/bundles/cdk-a11y.umd.js.map +1 -1
  8. package/bundles/cdk-a11y.umd.min.js +1 -1
  9. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  10. package/bundles/cdk-coercion.umd.js +20 -4
  11. package/bundles/cdk-coercion.umd.js.map +1 -1
  12. package/bundles/cdk-coercion.umd.min.js +1 -1
  13. package/bundles/cdk-coercion.umd.min.js.map +1 -1
  14. package/bundles/cdk-drag-drop.umd.js +3246 -1894
  15. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  16. package/bundles/cdk-drag-drop.umd.min.js +2 -1
  17. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  18. package/bundles/cdk-observers.umd.js +2 -2
  19. package/bundles/cdk-observers.umd.js.map +1 -1
  20. package/bundles/cdk-observers.umd.min.js +1 -1
  21. package/bundles/cdk-observers.umd.min.js.map +1 -1
  22. package/bundles/cdk-overlay.umd.js +107 -45
  23. package/bundles/cdk-overlay.umd.js.map +1 -1
  24. package/bundles/cdk-overlay.umd.min.js +2 -2
  25. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  26. package/bundles/cdk-portal.umd.js +3 -3
  27. package/bundles/cdk-portal.umd.js.map +1 -1
  28. package/bundles/cdk-portal.umd.min.js.map +1 -1
  29. package/bundles/cdk-scrolling.umd.js +9 -6
  30. package/bundles/cdk-scrolling.umd.js.map +1 -1
  31. package/bundles/cdk-scrolling.umd.min.js +1 -1
  32. package/bundles/cdk-scrolling.umd.min.js.map +1 -1
  33. package/bundles/cdk-stepper.umd.js +36 -16
  34. package/bundles/cdk-stepper.umd.js.map +1 -1
  35. package/bundles/cdk-stepper.umd.min.js +1 -1
  36. package/bundles/cdk-stepper.umd.min.js.map +1 -1
  37. package/bundles/cdk-table.umd.js +8 -4
  38. package/bundles/cdk-table.umd.js.map +1 -1
  39. package/bundles/cdk-table.umd.min.js +1 -1
  40. package/bundles/cdk-table.umd.min.js.map +1 -1
  41. package/bundles/cdk-text-field.umd.js +47 -22
  42. package/bundles/cdk-text-field.umd.js.map +1 -1
  43. package/bundles/cdk-text-field.umd.min.js +1 -1
  44. package/bundles/cdk-text-field.umd.min.js.map +1 -1
  45. package/bundles/cdk-tree.umd.js +1 -1
  46. package/bundles/cdk-tree.umd.js.map +1 -1
  47. package/bundles/cdk-tree.umd.min.js +1 -1
  48. package/bundles/cdk-tree.umd.min.js.map +1 -1
  49. package/bundles/cdk.umd.js +1 -1
  50. package/bundles/cdk.umd.js.map +1 -1
  51. package/bundles/cdk.umd.min.js +1 -1
  52. package/bundles/cdk.umd.min.js.map +1 -1
  53. package/coercion/typings/element.d.ts +13 -0
  54. package/coercion/typings/index.metadata.json +1 -1
  55. package/coercion/typings/public-api.d.ts +1 -0
  56. package/drag-drop/typings/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
  57. package/drag-drop/typings/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  58. package/drag-drop/typings/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  59. package/drag-drop/typings/directives/drag.d.ts +114 -0
  60. package/{typings/esm5/drag-drop → drag-drop/typings/directives}/drop-list-group.d.ts +3 -0
  61. package/drag-drop/typings/{drop-list.d.ts → directives/drop-list.d.ts} +44 -70
  62. package/drag-drop/typings/drag-drop-registry.d.ts +8 -3
  63. package/drag-drop/typings/drag-drop.d.ts +33 -0
  64. package/drag-drop/typings/drag-events.d.ts +14 -7
  65. package/{typings/esm5/drag-drop/drag.d.ts → drag-drop/typings/drag-ref.d.ts} +162 -86
  66. package/drag-drop/typings/drop-list-container.d.ts +19 -3
  67. package/drag-drop/typings/drop-list-ref.d.ts +238 -0
  68. package/drag-drop/typings/index.d.ts +2 -1
  69. package/drag-drop/typings/index.metadata.json +1 -1
  70. package/drag-drop/typings/public-api.d.ts +16 -6
  71. package/esm2015/a11y.js +30 -20
  72. package/esm2015/a11y.js.map +1 -1
  73. package/esm2015/cdk.js +1 -1
  74. package/esm2015/cdk.js.map +1 -1
  75. package/esm2015/coercion.js +18 -1
  76. package/esm2015/coercion.js.map +1 -1
  77. package/esm2015/drag-drop.js +2281 -1289
  78. package/esm2015/drag-drop.js.map +1 -1
  79. package/esm2015/observers.js +3 -3
  80. package/esm2015/observers.js.map +1 -1
  81. package/esm2015/overlay.js +75 -31
  82. package/esm2015/overlay.js.map +1 -1
  83. package/esm2015/portal.js +1 -1
  84. package/esm2015/portal.js.map +1 -1
  85. package/esm2015/scrolling.js +9 -6
  86. package/esm2015/scrolling.js.map +1 -1
  87. package/esm2015/stepper.js +30 -16
  88. package/esm2015/stepper.js.map +1 -1
  89. package/esm2015/table.js +8 -4
  90. package/esm2015/table.js.map +1 -1
  91. package/esm2015/text-field.js +31 -19
  92. package/esm2015/text-field.js.map +1 -1
  93. package/esm2015/tree.js +2 -2
  94. package/esm2015/tree.js.map +1 -1
  95. package/esm5/a11y.es5.js +31 -25
  96. package/esm5/a11y.es5.js.map +1 -1
  97. package/esm5/cdk.es5.js +1 -1
  98. package/esm5/cdk.es5.js.map +1 -1
  99. package/esm5/coercion.es5.js +18 -1
  100. package/esm5/coercion.es5.js.map +1 -1
  101. package/esm5/drag-drop.es5.js +3247 -1899
  102. package/esm5/drag-drop.es5.js.map +1 -1
  103. package/esm5/observers.es5.js +3 -3
  104. package/esm5/observers.es5.js.map +1 -1
  105. package/esm5/overlay.es5.js +107 -45
  106. package/esm5/overlay.es5.js.map +1 -1
  107. package/esm5/portal.es5.js +3 -3
  108. package/esm5/portal.es5.js.map +1 -1
  109. package/esm5/scrolling.es5.js +9 -6
  110. package/esm5/scrolling.es5.js.map +1 -1
  111. package/esm5/stepper.es5.js +36 -17
  112. package/esm5/stepper.es5.js.map +1 -1
  113. package/esm5/table.es5.js +8 -4
  114. package/esm5/table.es5.js.map +1 -1
  115. package/esm5/text-field.es5.js +44 -19
  116. package/esm5/text-field.es5.js.map +1 -1
  117. package/esm5/tree.es5.js +2 -2
  118. package/esm5/tree.es5.js.map +1 -1
  119. package/overlay/typings/index.metadata.json +1 -1
  120. package/overlay/typings/overlay-directives.d.ts +0 -2
  121. package/overlay/typings/overlay-ref.d.ts +5 -1
  122. package/overlay/typings/position/flexible-connected-position-strategy.d.ts +17 -4
  123. package/overlay/typings/position/overlay-position-builder.d.ts +3 -3
  124. package/package.json +4 -4
  125. package/portal/typings/portal.d.ts +1 -1
  126. package/schematics/migration.json +5 -0
  127. package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts +2 -2
  128. package/schematics/ng-update/index.d.ts +2 -0
  129. package/schematics/ng-update/index.js +5 -0
  130. package/schematics/ng-update/index.js.map +1 -1
  131. package/schematics/ng-update/target-version.d.ts +7 -1
  132. package/schematics/ng-update/target-version.js +10 -0
  133. package/schematics/ng-update/target-version.js.map +1 -1
  134. package/schematics/ng-update/upgrade-data.js +2 -1
  135. package/schematics/ng-update/upgrade-data.js.map +1 -1
  136. package/schematics/ng-update/upgrade-rules/index.js +3 -2
  137. package/schematics/ng-update/upgrade-rules/index.js.map +1 -1
  138. package/schematics/utils/ast/ng-module-imports.d.ts +1 -1
  139. package/schematics/utils/ast/ng-module-imports.js +25 -13
  140. package/schematics/utils/ast/ng-module-imports.js.map +1 -1
  141. package/schematics/utils/get-project.js +2 -1
  142. package/schematics/utils/get-project.js.map +1 -1
  143. package/schematics/utils/parse5-element.js +3 -2
  144. package/schematics/utils/parse5-element.js.map +1 -1
  145. package/schematics/utils/project-targets.js +2 -1
  146. package/schematics/utils/project-targets.js.map +1 -1
  147. package/schematics/utils/version-agnostic-typescript.js +3 -2
  148. package/schematics/utils/version-agnostic-typescript.js.map +1 -1
  149. package/stepper/typings/index.metadata.json +1 -1
  150. package/stepper/typings/stepper.d.ts +14 -2
  151. package/text-field/typings/autosize.d.ts +6 -0
  152. package/text-field/typings/index.metadata.json +1 -1
  153. package/tree/typings/control/base-tree-control.d.ts +1 -1
  154. package/tree/typings/control/nested-tree-control.d.ts +2 -2
  155. package/tree/typings/control/tree-control.d.ts +1 -1
  156. package/typings/a11y/focus-monitor/focus-monitor.d.ts +0 -1
  157. package/typings/a11y/focus-trap/focus-trap.d.ts +2 -0
  158. package/typings/a11y/index.metadata.json +1 -1
  159. package/typings/coercion/element.d.ts +13 -0
  160. package/typings/coercion/index.metadata.json +1 -1
  161. package/typings/coercion/public-api.d.ts +1 -0
  162. package/typings/drag-drop/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
  163. package/typings/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  164. package/typings/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  165. package/typings/drag-drop/directives/drag.d.ts +114 -0
  166. package/typings/drag-drop/{drop-list-group.d.ts → directives/drop-list-group.d.ts} +3 -0
  167. package/typings/{esm5/drag-drop → drag-drop/directives}/drop-list.d.ts +44 -70
  168. package/typings/drag-drop/drag-drop-registry.d.ts +8 -3
  169. package/typings/drag-drop/drag-drop.d.ts +33 -0
  170. package/typings/drag-drop/drag-events.d.ts +14 -7
  171. package/typings/drag-drop/{drag.d.ts → drag-ref.d.ts} +162 -86
  172. package/typings/drag-drop/drop-list-container.d.ts +19 -3
  173. package/typings/drag-drop/drop-list-ref.d.ts +238 -0
  174. package/typings/drag-drop/index.d.ts +2 -1
  175. package/typings/drag-drop/index.metadata.json +1 -1
  176. package/typings/drag-drop/public-api.d.ts +16 -6
  177. package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +0 -1
  178. package/typings/esm5/a11y/focus-trap/focus-trap.d.ts +2 -0
  179. package/typings/esm5/a11y/index.metadata.json +1 -1
  180. package/typings/esm5/coercion/element.d.ts +13 -0
  181. package/typings/esm5/coercion/index.metadata.json +1 -1
  182. package/typings/esm5/coercion/public-api.d.ts +1 -0
  183. package/typings/esm5/drag-drop/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
  184. package/typings/esm5/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  185. package/typings/esm5/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  186. package/typings/esm5/drag-drop/directives/drag.d.ts +114 -0
  187. package/{drag-drop/typings → typings/esm5/drag-drop/directives}/drop-list-group.d.ts +3 -0
  188. package/typings/{drag-drop → esm5/drag-drop/directives}/drop-list.d.ts +44 -70
  189. package/typings/esm5/drag-drop/drag-drop-registry.d.ts +8 -3
  190. package/typings/esm5/drag-drop/drag-drop.d.ts +33 -0
  191. package/typings/esm5/drag-drop/drag-events.d.ts +14 -7
  192. package/{drag-drop/typings/drag.d.ts → typings/esm5/drag-drop/drag-ref.d.ts} +162 -86
  193. package/typings/esm5/drag-drop/drop-list-container.d.ts +19 -3
  194. package/typings/esm5/drag-drop/drop-list-ref.d.ts +238 -0
  195. package/typings/esm5/drag-drop/index.d.ts +2 -1
  196. package/typings/esm5/drag-drop/index.metadata.json +1 -1
  197. package/typings/esm5/drag-drop/public-api.d.ts +16 -6
  198. package/typings/esm5/index.metadata.json +1 -1
  199. package/typings/esm5/overlay/index.metadata.json +1 -1
  200. package/typings/esm5/overlay/overlay-directives.d.ts +0 -2
  201. package/typings/esm5/overlay/overlay-ref.d.ts +5 -1
  202. package/typings/esm5/overlay/position/flexible-connected-position-strategy.d.ts +17 -4
  203. package/typings/esm5/overlay/position/overlay-position-builder.d.ts +3 -3
  204. package/typings/esm5/portal/portal.d.ts +1 -1
  205. package/typings/esm5/stepper/index.metadata.json +1 -1
  206. package/typings/esm5/stepper/stepper.d.ts +14 -2
  207. package/typings/esm5/text-field/autosize.d.ts +6 -0
  208. package/typings/esm5/text-field/index.metadata.json +1 -1
  209. package/typings/esm5/tree/control/base-tree-control.d.ts +1 -1
  210. package/typings/esm5/tree/control/nested-tree-control.d.ts +2 -2
  211. package/typings/esm5/tree/control/tree-control.d.ts +1 -1
  212. package/typings/index.metadata.json +1 -1
  213. package/typings/overlay/index.metadata.json +1 -1
  214. package/typings/overlay/overlay-directives.d.ts +0 -2
  215. package/typings/overlay/overlay-ref.d.ts +5 -1
  216. package/typings/overlay/position/flexible-connected-position-strategy.d.ts +17 -4
  217. package/typings/overlay/position/overlay-position-builder.d.ts +3 -3
  218. package/typings/portal/portal.d.ts +1 -1
  219. package/typings/schematics/ng-update/index.d.ts +2 -0
  220. package/typings/schematics/ng-update/target-version.d.ts +7 -1
  221. package/typings/schematics/utils/ast/ng-module-imports.d.ts +1 -1
  222. package/typings/stepper/index.metadata.json +1 -1
  223. package/typings/stepper/stepper.d.ts +14 -2
  224. package/typings/text-field/autosize.d.ts +6 -0
  225. package/typings/text-field/index.metadata.json +1 -1
  226. package/typings/tree/control/base-tree-control.d.ts +1 -1
  227. package/typings/tree/control/nested-tree-control.d.ts +2 -2
  228. package/typings/tree/control/tree-control.d.ts +1 -1
@@ -0,0 +1,114 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Directionality } from '@angular/cdk/bidi';
9
+ import { ViewportRuler } from '@angular/cdk/scrolling';
10
+ import { AfterViewInit, ElementRef, EventEmitter, InjectionToken, NgZone, OnDestroy, QueryList, ViewContainerRef, OnChanges, SimpleChanges } from '@angular/core';
11
+ import { Observable } from 'rxjs';
12
+ import { DragDropRegistry } from '../drag-drop-registry';
13
+ import { CdkDragDrop, CdkDragEnd, CdkDragEnter, CdkDragExit, CdkDragMove, CdkDragStart, CdkDragRelease } from '../drag-events';
14
+ import { CdkDragHandle } from './drag-handle';
15
+ import { CdkDragPlaceholder } from './drag-placeholder';
16
+ import { CdkDragPreview } from './drag-preview';
17
+ import { DragRef, DragRefConfig } from '../drag-ref';
18
+ import { DropListRef } from '../drop-list-ref';
19
+ import { CdkDropListInternal as CdkDropList } from './drop-list';
20
+ import { DragDrop } from '../drag-drop';
21
+ /** Injection token that can be used to configure the behavior of `CdkDrag`. */
22
+ export declare const CDK_DRAG_CONFIG: InjectionToken<DragRefConfig>;
23
+ /** @docs-private */
24
+ export declare function CDK_DRAG_CONFIG_FACTORY(): DragRefConfig;
25
+ /** Element that can be moved inside a CdkDropList container. */
26
+ export declare class CdkDrag<T = any> implements AfterViewInit, OnChanges, OnDestroy {
27
+ /** Element that the draggable is attached to. */
28
+ element: ElementRef<HTMLElement>;
29
+ /** Droppable container that the draggable is a part of. */
30
+ dropContainer: CdkDropList;
31
+ private _document;
32
+ private _ngZone;
33
+ private _viewContainerRef;
34
+ private _dir;
35
+ private _destroyed;
36
+ /** Reference to the underlying drag instance. */
37
+ _dragRef: DragRef<CdkDrag<T>>;
38
+ /** Elements that can be used to drag the draggable item. */
39
+ _handles: QueryList<CdkDragHandle>;
40
+ /** Element that will be used as a template to create the draggable item's preview. */
41
+ _previewTemplate: CdkDragPreview;
42
+ /** Template for placeholder element rendered to show where a draggable would be dropped. */
43
+ _placeholderTemplate: CdkDragPlaceholder;
44
+ /** Arbitrary data to attach to this drag instance. */
45
+ data: T;
46
+ /** Locks the position of the dragged element along the specified axis. */
47
+ lockAxis: 'x' | 'y';
48
+ /**
49
+ * Selector that will be used to determine the root draggable element, starting from
50
+ * the `cdkDrag` element and going up the DOM. Passing an alternate root element is useful
51
+ * when trying to enable dragging on an element that you might not have access to.
52
+ */
53
+ rootElementSelector: string;
54
+ /**
55
+ * Selector that will be used to determine the element to which the draggable's position will
56
+ * be constrained. Matching starts from the element's parent and goes up the DOM until a matching
57
+ * element has been found.
58
+ */
59
+ boundaryElementSelector: string;
60
+ /** Whether starting to drag this element is disabled. */
61
+ disabled: boolean;
62
+ private _disabled;
63
+ /** Emits when the user starts dragging the item. */
64
+ started: EventEmitter<CdkDragStart>;
65
+ /** Emits when the user has released a drag item, before any animations have started. */
66
+ released: EventEmitter<CdkDragRelease>;
67
+ /** Emits when the user stops dragging an item in the container. */
68
+ ended: EventEmitter<CdkDragEnd>;
69
+ /** Emits when the user has moved the item into a new container. */
70
+ entered: EventEmitter<CdkDragEnter<any>>;
71
+ /** Emits when the user removes the item its container by dragging it into another container. */
72
+ exited: EventEmitter<CdkDragExit<any>>;
73
+ /** Emits when the user drops the item inside a container. */
74
+ dropped: EventEmitter<CdkDragDrop<any>>;
75
+ /**
76
+ * Emits as the user is dragging the item. Use with caution,
77
+ * because this event will fire for every pixel that the user has dragged.
78
+ */
79
+ moved: Observable<CdkDragMove<T>>;
80
+ constructor(
81
+ /** Element that the draggable is attached to. */
82
+ element: ElementRef<HTMLElement>,
83
+ /** Droppable container that the draggable is a part of. */
84
+ dropContainer: CdkDropList, _document: any, _ngZone: NgZone, _viewContainerRef: ViewContainerRef, viewportRuler: ViewportRuler, dragDropRegistry: DragDropRegistry<DragRef, DropListRef>, config: DragRefConfig, _dir: Directionality,
85
+ /**
86
+ * @deprecated `viewportRuler` and `dragDropRegistry` parameters
87
+ * to be removed. Also `dragDrop` parameter to be made required.
88
+ * @breaking-change 8.0.0.
89
+ */
90
+ dragDrop?: DragDrop);
91
+ /**
92
+ * Returns the element that is being used as a placeholder
93
+ * while the current element is being dragged.
94
+ */
95
+ getPlaceholderElement(): HTMLElement;
96
+ /** Returns the root draggable element. */
97
+ getRootElement(): HTMLElement;
98
+ /** Resets a standalone drag item to its initial position. */
99
+ reset(): void;
100
+ ngAfterViewInit(): void;
101
+ ngOnChanges(changes: SimpleChanges): void;
102
+ ngOnDestroy(): void;
103
+ /** Syncs the root element with the `DragRef`. */
104
+ private _updateRootElement;
105
+ /** Gets the boundary element, based on the `boundaryElementSelector`. */
106
+ private _getBoundaryElement;
107
+ /** Syncs the inputs of the CdkDrag with the options of the underlying DragRef. */
108
+ private _syncInputs;
109
+ /**
110
+ * Proxies the events from a DragRef to events that
111
+ * match the interfaces of the CdkDrag outputs.
112
+ */
113
+ private _proxyEvents;
114
+ }
@@ -15,5 +15,8 @@ import { OnDestroy } from '@angular/core';
15
15
  export declare class CdkDropListGroup<T> implements OnDestroy {
16
16
  /** Drop lists registered inside the group. */
17
17
  readonly _items: Set<T>;
18
+ /** Whether starting a dragging sequence from inside this group is disabled. */
19
+ disabled: boolean;
20
+ private _disabled;
18
21
  ngOnDestroy(): void;
19
22
  }
@@ -5,19 +5,36 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- import { ElementRef, EventEmitter, OnDestroy, OnInit, QueryList, ChangeDetectorRef } from '@angular/core';
8
+ import { ElementRef, EventEmitter, OnDestroy, QueryList, ChangeDetectorRef, AfterContentInit } from '@angular/core';
9
9
  import { Directionality } from '@angular/cdk/bidi';
10
10
  import { CdkDrag } from './drag';
11
- import { DragDropRegistry } from './drag-drop-registry';
12
- import { CdkDragDrop, CdkDragEnter, CdkDragExit, CdkDragSortEvent } from './drag-events';
11
+ import { DragDropRegistry } from '../drag-drop-registry';
12
+ import { CdkDragDrop, CdkDragEnter, CdkDragExit, CdkDragSortEvent } from '../drag-events';
13
+ import { CdkDropListContainer } from '../drop-list-container';
13
14
  import { CdkDropListGroup } from './drop-list-group';
15
+ import { DropListRef } from '../drop-list-ref';
16
+ import { DragRef } from '../drag-ref';
17
+ import { DragDrop } from '../drag-drop';
18
+ /**
19
+ * Internal compile-time-only representation of a `CdkDropList`.
20
+ * Used to avoid circular import issues between the `CdkDropList` and the `CdkDrag`.
21
+ * @docs-private
22
+ */
23
+ export interface CdkDropListInternal extends CdkDropList {
24
+ }
14
25
  /** Container that wraps a set of draggable items. */
15
- export declare class CdkDropList<T = any> implements OnInit, OnDestroy {
26
+ export declare class CdkDropList<T = any> implements CdkDropListContainer, AfterContentInit, OnDestroy {
27
+ /** Element that the drop list is attached to. */
16
28
  element: ElementRef<HTMLElement>;
17
- private _dragDropRegistry;
18
29
  private _changeDetectorRef;
19
30
  private _dir?;
20
31
  private _group?;
32
+ /** Emits when the list has been destroyed. */
33
+ private _destroyed;
34
+ /** Keeps track of the drop lists that are currently on the page. */
35
+ private static _dropLists;
36
+ /** Reference to the underlying drop list instance. */
37
+ _dropListRef: DropListRef<CdkDropList<T>>;
21
38
  /** Draggable items in the container. */
22
39
  _draggables: QueryList<CdkDrag>;
23
40
  /**
@@ -58,24 +75,17 @@ export declare class CdkDropList<T = any> implements OnInit, OnDestroy {
58
75
  exited: EventEmitter<CdkDragExit<T>>;
59
76
  /** Emits as the user is swapping items while actively dragging. */
60
77
  sorted: EventEmitter<CdkDragSortEvent<T>>;
61
- constructor(element: ElementRef<HTMLElement>, _dragDropRegistry: DragDropRegistry<CdkDrag, CdkDropList<T>>, _changeDetectorRef: ChangeDetectorRef, _dir?: Directionality | undefined, _group?: CdkDropListGroup<CdkDropList<any>> | undefined);
62
- ngOnInit(): void;
63
- ngOnDestroy(): void;
64
- /** Whether an item in the container is being dragged. */
65
- _dragging: boolean;
66
- /** Cache of the dimensions of all the items and the sibling containers. */
67
- private _positionCache;
68
- /**
69
- * Draggable items that are currently active inside the container. Includes the items
70
- * from `_draggables`, as well as any items that have been dragged in, but haven't
71
- * been dropped yet.
72
- */
73
- private _activeDraggables;
78
+ constructor(
79
+ /** Element that the drop list is attached to. */
80
+ element: ElementRef<HTMLElement>, dragDropRegistry: DragDropRegistry<DragRef, DropListRef>, _changeDetectorRef: ChangeDetectorRef, _dir?: Directionality | undefined, _group?: CdkDropListGroup<CdkDropList<any>> | undefined, _document?: any,
74
81
  /**
75
- * Keeps track of the item that was last swapped with the dragged item, as
76
- * well as what direction the pointer was moving in when the swap occured.
82
+ * @deprecated `dragDropRegistry` and `_document` parameters to be removed.
83
+ * Also `dragDrop` parameter to be made required.
84
+ * @breaking-change 8.0.0.
77
85
  */
78
- private _previousSwap;
86
+ dragDrop?: DragDrop);
87
+ ngAfterContentInit(): void;
88
+ ngOnDestroy(): void;
79
89
  /** Starts dragging an item. */
80
90
  start(): void;
81
91
  /**
@@ -83,8 +93,10 @@ export declare class CdkDropList<T = any> implements OnInit, OnDestroy {
83
93
  * @param item Item being dropped into the container.
84
94
  * @param currentIndex Index at which the item should be inserted.
85
95
  * @param previousContainer Container from which the item got dragged in.
96
+ * @param isPointerOverContainer Whether the user's pointer was over the
97
+ * container when the item was dropped.
86
98
  */
87
- drop(item: CdkDrag, currentIndex: number, previousContainer: CdkDropList): void;
99
+ drop(item: CdkDrag, currentIndex: number, previousContainer: Partial<CdkDropListContainer>, isPointerOverContainer: boolean): void;
88
100
  /**
89
101
  * Emits an event to indicate that the user moved an item into the container.
90
102
  * @param item Item that was moved into the container.
@@ -107,7 +119,7 @@ export declare class CdkDropList<T = any> implements OnInit, OnDestroy {
107
119
  * @param item Item to be sorted.
108
120
  * @param pointerX Position of the item along the X axis.
109
121
  * @param pointerY Position of the item along the Y axis.
110
- * @param pointerDeta Direction in which the pointer is moving along each axis.
122
+ * @param pointerDelta Direction in which the pointer is moving along each axis.
111
123
  */
112
124
  _sortItem(item: CdkDrag, pointerX: number, pointerY: number, pointerDelta: {
113
125
  x: number;
@@ -120,53 +132,15 @@ export declare class CdkDropList<T = any> implements OnInit, OnDestroy {
120
132
  * @param x Position of the item along the X axis.
121
133
  * @param y Position of the item along the Y axis.
122
134
  */
123
- _getSiblingContainerFromPosition(item: CdkDrag, x: number, y: number): CdkDropList | null;
124
- /**
125
- * Checks whether an item that started in this container can be returned to it,
126
- * after it was moved out into another container.
127
- * @param x Position of the item along the X axis.
128
- * @param y Position of the item along the Y axis.
129
- */
130
- _canReturnItem(x: number, y: number): boolean;
131
- /** Refreshes the position cache of the items and sibling containers. */
132
- private _cachePositions;
133
- /** Resets the container to its initial state. */
134
- private _reset;
135
- /**
136
- * Updates the top/left positions of a `ClientRect`, as well as their bottom/right counterparts.
137
- * @param clientRect `ClientRect` that should be updated.
138
- * @param top Amount to add to the `top` position.
139
- * @param left Amount to add to the `left` position.
140
- */
141
- private _adjustClientRect;
142
- /**
143
- * Gets the index of an item in the drop container, based on the position of the user's pointer.
144
- * @param item Item that is being sorted.
145
- * @param pointerX Position of the user's pointer along the X axis.
146
- * @param pointerY Position of the user's pointer along the Y axis.
147
- * @param delta Direction in which the user is moving their pointer.
148
- */
149
- private _getItemIndexFromPointerPosition;
150
- /**
151
- * Checks whether the pointer coordinates are close to the drop container.
152
- * @param pointerX Coordinates along the X axis.
153
- * @param pointerY Coordinates along the Y axis.
154
- */
155
- private _isPointerNearDropContainer;
156
- /**
157
- * Gets the offset in pixels by which the item that is being dragged should be moved.
158
- * @param currentPosition Current position of the item.
159
- * @param newPosition Position of the item where the current item should be moved.
160
- * @param delta Direction in which the user is moving.
161
- */
162
- private _getItemOffsetPx;
135
+ _getSiblingContainerFromPosition(item: CdkDrag, x: number, y: number): CdkDropListContainer | null;
163
136
  /**
164
- * Gets the offset in pixels by which the items that aren't being dragged should be moved.
165
- * @param currentIndex Index of the item currently being dragged.
166
- * @param siblings All of the items in the list.
167
- * @param delta Direction in which the user is moving.
137
+ * Checks whether the user's pointer is positioned over the container.
138
+ * @param x Pointer position along the X axis.
139
+ * @param y Pointer position along the Y axis.
168
140
  */
169
- private _getSiblingOffsetPx;
170
- /** Gets an array of unique drop lists that the current list is connected to. */
171
- private _getConnectedLists;
141
+ _isOverContainer(x: number, y: number): boolean;
142
+ /** Syncs the inputs of the CdkDropList with the options of the underlying DropListRef. */
143
+ private _syncInputs;
144
+ /** Handles events from the underlying DropListRef. */
145
+ private _handleEvents;
172
146
  }
@@ -54,13 +54,18 @@ export declare class DragDropRegistry<I, C extends {
54
54
  stopDragging(drag: I): void;
55
55
  /** Gets whether a drag item instance is currently being dragged. */
56
56
  isDragging(drag: I): boolean;
57
- /** Gets a drop container by its id. */
57
+ /**
58
+ * Gets a drop container by its id.
59
+ * @deprecated No longer being used. To be removed.
60
+ * @breaking-change 8.0.0
61
+ */
58
62
  getDropContainer(id: string): C | undefined;
59
63
  ngOnDestroy(): void;
60
64
  /**
61
- * Listener used to prevent `touchmove` and `wheel` events while the element is being dragged.
65
+ * Event listener that will prevent the default browser action while the user is dragging.
66
+ * @param event Event whose default action should be prevented.
62
67
  */
63
- private _preventScrollListener;
68
+ private _preventDefaultWhileDragging;
64
69
  /** Clears out the global event listeners from the `document`. */
65
70
  private _clearGlobalListeners;
66
71
  }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { NgZone, ElementRef } from '@angular/core';
9
+ import { ViewportRuler } from '@angular/cdk/scrolling';
10
+ import { DragRef, DragRefConfig } from './drag-ref';
11
+ import { DropListRef } from './drop-list-ref';
12
+ import { DragDropRegistry } from './drag-drop-registry';
13
+ /**
14
+ * Service that allows for drag-and-drop functionality to be attached to DOM elements.
15
+ */
16
+ export declare class DragDrop {
17
+ private _document;
18
+ private _ngZone;
19
+ private _viewportRuler;
20
+ private _dragDropRegistry;
21
+ constructor(_document: any, _ngZone: NgZone, _viewportRuler: ViewportRuler, _dragDropRegistry: DragDropRegistry<DragRef, DropListRef>);
22
+ /**
23
+ * Turns an element into a draggable item.
24
+ * @param element Element to which to attach the dragging functionality.
25
+ * @param config Object used to configure the dragging behavior.
26
+ */
27
+ createDrag<T = any>(element: ElementRef<HTMLElement> | HTMLElement, config?: DragRefConfig): DragRef<T>;
28
+ /**
29
+ * Turns an element into a drop list.
30
+ * @param element Element to which to attach the drop list functionality.
31
+ */
32
+ createDropList<T = any>(element: ElementRef<HTMLElement> | HTMLElement): DropListRef<T>;
33
+ }
@@ -5,13 +5,18 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- import { CdkDrag } from './drag';
9
- import { CdkDropListContainer } from './drop-list-container';
8
+ import { CdkDrag } from './directives/drag';
9
+ import { CdkDropList } from './directives/drop-list';
10
10
  /** Event emitted when the user starts dragging a draggable. */
11
11
  export interface CdkDragStart<T = any> {
12
12
  /** Draggable that emitted the event. */
13
13
  source: CdkDrag<T>;
14
14
  }
15
+ /** Event emitted when the user releases an item, before any animations have started. */
16
+ export interface CdkDragRelease<T = any> {
17
+ /** Draggable that emitted the event. */
18
+ source: CdkDrag<T>;
19
+ }
15
20
  /** Event emitted when the user stops dragging a draggable. */
16
21
  export interface CdkDragEnd<T = any> {
17
22
  /** Draggable that emitted the event. */
@@ -20,7 +25,7 @@ export interface CdkDragEnd<T = any> {
20
25
  /** Event emitted when the user moves an item into a new drop container. */
21
26
  export interface CdkDragEnter<T = any, I = T> {
22
27
  /** Container into which the user has moved the item. */
23
- container: CdkDropListContainer<T>;
28
+ container: CdkDropList<T>;
24
29
  /** Item that was removed from the container. */
25
30
  item: CdkDrag<I>;
26
31
  }
@@ -30,7 +35,7 @@ export interface CdkDragEnter<T = any, I = T> {
30
35
  */
31
36
  export interface CdkDragExit<T = any, I = T> {
32
37
  /** Container from which the user has a removed an item. */
33
- container: CdkDropListContainer<T>;
38
+ container: CdkDropList<T>;
34
39
  /** Item that was removed from the container. */
35
40
  item: CdkDrag<I>;
36
41
  }
@@ -43,9 +48,11 @@ export interface CdkDragDrop<T, O = T> {
43
48
  /** Item that is being dropped. */
44
49
  item: CdkDrag;
45
50
  /** Container in which the item was dropped. */
46
- container: CdkDropListContainer<T>;
51
+ container: CdkDropList<T>;
47
52
  /** Container from which the item was picked up. Can be the same as the `container`. */
48
- previousContainer: CdkDropListContainer<O>;
53
+ previousContainer: CdkDropList<O>;
54
+ /** Whether the user's pointer was over the container when the item was dropped. */
55
+ isPointerOverContainer: boolean;
49
56
  }
50
57
  /** Event emitted as the user is dragging a draggable item. */
51
58
  export interface CdkDragMove<T = any> {
@@ -76,7 +83,7 @@ export interface CdkDragSortEvent<T = any, I = T> {
76
83
  /** Index that the item is currently in. */
77
84
  currentIndex: number;
78
85
  /** Container that the item belongs to. */
79
- container: CdkDropListContainer<T>;
86
+ container: CdkDropList<T>;
80
87
  /** Item that is being sorted. */
81
88
  item: CdkDrag<I>;
82
89
  }