@angular/cdk 7.0.0-rc.1 → 7.0.2

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 (205) hide show
  1. package/_a11y.scss +32 -0
  2. package/_overlay.scss +141 -0
  3. package/_text-field.scss +63 -0
  4. package/a11y/typings/aria-describer/aria-describer.d.ts +2 -2
  5. package/a11y/typings/focus-monitor/focus-monitor.d.ts +2 -2
  6. package/a11y/typings/index.metadata.json +1 -1
  7. package/a11y/typings/key-manager/list-key-manager.d.ts +1 -1
  8. package/a11y/typings/live-announcer/live-announcer.d.ts +2 -2
  9. package/bundles/cdk-a11y.umd.js +26 -21
  10. package/bundles/cdk-a11y.umd.js.map +1 -1
  11. package/bundles/cdk-a11y.umd.min.js +1 -1
  12. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  13. package/bundles/cdk-drag-drop.umd.js +126 -81
  14. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  15. package/bundles/cdk-drag-drop.umd.min.js +1 -1
  16. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  17. package/bundles/cdk-overlay.umd.js +22 -22
  18. package/bundles/cdk-overlay.umd.js.map +1 -1
  19. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  20. package/bundles/cdk-platform.umd.js +13 -2
  21. package/bundles/cdk-platform.umd.js.map +1 -1
  22. package/bundles/cdk-platform.umd.min.js +1 -1
  23. package/bundles/cdk-platform.umd.min.js.map +1 -1
  24. package/bundles/cdk-scrolling.umd.js +10 -6
  25. package/bundles/cdk-scrolling.umd.js.map +1 -1
  26. package/bundles/cdk-scrolling.umd.min.js +1 -1
  27. package/bundles/cdk-scrolling.umd.min.js.map +1 -1
  28. package/bundles/cdk-stepper.umd.js +1 -1
  29. package/bundles/cdk-stepper.umd.js.map +1 -1
  30. package/bundles/cdk-stepper.umd.min.js.map +1 -1
  31. package/bundles/cdk-table.umd.js +5 -1
  32. package/bundles/cdk-table.umd.js.map +1 -1
  33. package/bundles/cdk-table.umd.min.js +1 -1
  34. package/bundles/cdk-table.umd.min.js.map +1 -1
  35. package/bundles/cdk-text-field.umd.js +10 -3
  36. package/bundles/cdk-text-field.umd.js.map +1 -1
  37. package/bundles/cdk-text-field.umd.min.js +1 -1
  38. package/bundles/cdk-text-field.umd.min.js.map +1 -1
  39. package/bundles/cdk.umd.js +1 -1
  40. package/bundles/cdk.umd.js.map +1 -1
  41. package/bundles/cdk.umd.min.js +1 -1
  42. package/bundles/cdk.umd.min.js.map +1 -1
  43. package/drag-drop/typings/drag-events.d.ts +5 -5
  44. package/drag-drop/typings/drag-handle.d.ts +3 -1
  45. package/drag-drop/typings/drag-parent.d.ts +15 -0
  46. package/drag-drop/typings/drag-utils.d.ts +10 -0
  47. package/drag-drop/typings/drag.d.ts +6 -11
  48. package/drag-drop/typings/{drop-container.d.ts → drop-list-container.d.ts} +5 -5
  49. package/{typings/drag-drop/drop.d.ts → drag-drop/typings/drop-list.d.ts} +7 -7
  50. package/drag-drop/typings/index.d.ts +1 -0
  51. package/drag-drop/typings/index.metadata.json +1 -1
  52. package/drag-drop/typings/public-api.d.ts +2 -2
  53. package/esm2015/a11y.js +25 -20
  54. package/esm2015/a11y.js.map +1 -1
  55. package/esm2015/cdk.js +1 -1
  56. package/esm2015/cdk.js.map +1 -1
  57. package/esm2015/drag-drop.js +108 -57
  58. package/esm2015/drag-drop.js.map +1 -1
  59. package/esm2015/overlay.js +12 -12
  60. package/esm2015/overlay.js.map +1 -1
  61. package/esm2015/platform.js +13 -3
  62. package/esm2015/platform.js.map +1 -1
  63. package/esm2015/scrolling.js +10 -6
  64. package/esm2015/scrolling.js.map +1 -1
  65. package/esm2015/stepper.js +1 -1
  66. package/esm2015/stepper.js.map +1 -1
  67. package/esm2015/table.js +5 -1
  68. package/esm2015/table.js.map +1 -1
  69. package/esm2015/text-field.js +11 -4
  70. package/esm2015/text-field.js.map +1 -1
  71. package/esm5/a11y.es5.js +27 -22
  72. package/esm5/a11y.es5.js.map +1 -1
  73. package/esm5/cdk.es5.js +1 -1
  74. package/esm5/cdk.es5.js.map +1 -1
  75. package/esm5/drag-drop.es5.js +124 -81
  76. package/esm5/drag-drop.es5.js.map +1 -1
  77. package/esm5/overlay.es5.js +22 -22
  78. package/esm5/overlay.es5.js.map +1 -1
  79. package/esm5/platform.es5.js +13 -3
  80. package/esm5/platform.es5.js.map +1 -1
  81. package/esm5/scrolling.es5.js +10 -6
  82. package/esm5/scrolling.es5.js.map +1 -1
  83. package/esm5/stepper.es5.js +1 -1
  84. package/esm5/stepper.es5.js.map +1 -1
  85. package/esm5/table.es5.js +5 -1
  86. package/esm5/table.es5.js.map +1 -1
  87. package/esm5/text-field.es5.js +11 -4
  88. package/esm5/text-field.es5.js.map +1 -1
  89. package/overlay/typings/keyboard/overlay-keyboard-dispatcher.d.ts +2 -2
  90. package/overlay/typings/overlay-container.d.ts +2 -2
  91. package/overlay/typings/overlay-directives.d.ts +1 -1
  92. package/overlay/typings/overlay-module.d.ts +1 -1
  93. package/overlay/typings/position/connected-position-strategy.d.ts +1 -1
  94. package/overlay/typings/position/global-position-strategy.d.ts +2 -2
  95. package/overlay/typings/position/overlay-position-builder.d.ts +1 -1
  96. package/package.json +6 -6
  97. package/platform/typings/features/passive-listeners.d.ts +7 -0
  98. package/platform/typings/index.metadata.json +1 -1
  99. package/platform/typings/platform.d.ts +1 -1
  100. package/schematics/index.d.ts +0 -1
  101. package/schematics/index.js +0 -1
  102. package/schematics/index.js.map +1 -1
  103. package/schematics/ng-add/index.d.ts +4 -0
  104. package/schematics/ng-add/index.js +7 -3
  105. package/schematics/ng-add/index.js.map +1 -1
  106. package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html +4 -4
  107. package/schematics/ng-generate/drag-drop/schema.json +2 -1
  108. package/schematics/ng-update/index.js +8 -2
  109. package/schematics/ng-update/index.js.map +1 -1
  110. package/schematics/utils/build-component.d.ts +7 -0
  111. package/schematics/utils/build-component.js +4 -5
  112. package/schematics/utils/build-component.js.map +1 -1
  113. package/schematics/utils/html-head-element.d.ts +13 -0
  114. package/schematics/utils/html-head-element.js +54 -0
  115. package/schematics/utils/html-head-element.js.map +1 -0
  116. package/schematics/utils/index.d.ts +1 -0
  117. package/schematics/utils/index.js +1 -0
  118. package/schematics/utils/index.js.map +1 -1
  119. package/scrolling/typings/index.metadata.json +1 -1
  120. package/scrolling/typings/scroll-dispatcher.d.ts +2 -2
  121. package/scrolling/typings/viewport-ruler.d.ts +2 -2
  122. package/table/typings/index.metadata.json +1 -1
  123. package/text-field/typings/autosize.d.ts +7 -1
  124. package/text-field/typings/index.metadata.json +1 -1
  125. package/typings/a11y/aria-describer/aria-describer.d.ts +2 -2
  126. package/typings/a11y/focus-monitor/focus-monitor.d.ts +2 -2
  127. package/typings/a11y/index.metadata.json +1 -1
  128. package/typings/a11y/key-manager/list-key-manager.d.ts +1 -1
  129. package/typings/a11y/live-announcer/live-announcer.d.ts +2 -2
  130. package/typings/drag-drop/drag-events.d.ts +5 -5
  131. package/typings/drag-drop/drag-handle.d.ts +3 -1
  132. package/typings/drag-drop/drag-parent.d.ts +15 -0
  133. package/typings/drag-drop/drag-utils.d.ts +10 -0
  134. package/typings/drag-drop/drag.d.ts +6 -11
  135. package/typings/drag-drop/{drop-container.d.ts → drop-list-container.d.ts} +5 -5
  136. package/{drag-drop/typings/drop.d.ts → typings/drag-drop/drop-list.d.ts} +7 -7
  137. package/typings/drag-drop/index.d.ts +1 -0
  138. package/typings/drag-drop/index.metadata.json +1 -1
  139. package/typings/drag-drop/public-api.d.ts +2 -2
  140. package/typings/esm5/a11y/aria-describer/aria-describer.d.ts +2 -2
  141. package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +2 -2
  142. package/typings/esm5/a11y/index.metadata.json +1 -1
  143. package/typings/esm5/a11y/key-manager/list-key-manager.d.ts +1 -1
  144. package/typings/esm5/a11y/live-announcer/live-announcer.d.ts +2 -2
  145. package/typings/esm5/drag-drop/drag-events.d.ts +5 -5
  146. package/typings/esm5/drag-drop/drag-handle.d.ts +3 -1
  147. package/typings/esm5/drag-drop/drag-parent.d.ts +15 -0
  148. package/typings/esm5/drag-drop/drag-utils.d.ts +10 -0
  149. package/typings/esm5/drag-drop/drag.d.ts +6 -11
  150. package/typings/esm5/drag-drop/{drop-container.d.ts → drop-list-container.d.ts} +5 -5
  151. package/typings/esm5/drag-drop/{drop.d.ts → drop-list.d.ts} +7 -7
  152. package/typings/esm5/drag-drop/index.d.ts +1 -0
  153. package/typings/esm5/drag-drop/index.metadata.json +1 -1
  154. package/typings/esm5/drag-drop/public-api.d.ts +2 -2
  155. package/typings/esm5/index.metadata.json +1 -1
  156. package/typings/esm5/overlay/keyboard/overlay-keyboard-dispatcher.d.ts +2 -2
  157. package/typings/esm5/overlay/overlay-container.d.ts +2 -2
  158. package/typings/esm5/overlay/overlay-directives.d.ts +1 -1
  159. package/typings/esm5/overlay/overlay-module.d.ts +1 -1
  160. package/typings/esm5/overlay/position/connected-position-strategy.d.ts +1 -1
  161. package/typings/esm5/overlay/position/global-position-strategy.d.ts +2 -2
  162. package/typings/esm5/overlay/position/overlay-position-builder.d.ts +1 -1
  163. package/typings/esm5/platform/features/passive-listeners.d.ts +7 -0
  164. package/typings/esm5/platform/index.metadata.json +1 -1
  165. package/typings/esm5/platform/platform.d.ts +1 -1
  166. package/typings/esm5/scrolling/index.metadata.json +1 -1
  167. package/typings/esm5/scrolling/scroll-dispatcher.d.ts +2 -2
  168. package/typings/esm5/scrolling/viewport-ruler.d.ts +2 -2
  169. package/typings/esm5/table/index.metadata.json +1 -1
  170. package/typings/esm5/text-field/autosize.d.ts +7 -1
  171. package/typings/esm5/text-field/index.metadata.json +1 -1
  172. package/typings/index.metadata.json +1 -1
  173. package/typings/overlay/keyboard/overlay-keyboard-dispatcher.d.ts +2 -2
  174. package/typings/overlay/overlay-container.d.ts +2 -2
  175. package/typings/overlay/overlay-directives.d.ts +1 -1
  176. package/typings/overlay/overlay-module.d.ts +1 -1
  177. package/typings/overlay/position/connected-position-strategy.d.ts +1 -1
  178. package/typings/overlay/position/global-position-strategy.d.ts +2 -2
  179. package/typings/overlay/position/overlay-position-builder.d.ts +1 -1
  180. package/typings/platform/features/passive-listeners.d.ts +7 -0
  181. package/typings/platform/index.metadata.json +1 -1
  182. package/typings/platform/platform.d.ts +1 -1
  183. package/typings/schematics/index.d.ts +0 -1
  184. package/typings/schematics/ng-add/index.d.ts +4 -0
  185. package/typings/schematics/utils/build-component.d.ts +7 -0
  186. package/typings/schematics/utils/html-head-element.d.ts +13 -0
  187. package/typings/schematics/utils/index.d.ts +1 -0
  188. package/typings/scrolling/index.metadata.json +1 -1
  189. package/typings/scrolling/scroll-dispatcher.d.ts +2 -2
  190. package/typings/scrolling/viewport-ruler.d.ts +2 -2
  191. package/typings/table/index.metadata.json +1 -1
  192. package/typings/text-field/autosize.d.ts +7 -1
  193. package/typings/text-field/index.metadata.json +1 -1
  194. package/schematics/testing/index.d.ts +0 -9
  195. package/schematics/testing/index.js +0 -15
  196. package/schematics/testing/index.js.map +0 -1
  197. package/schematics/testing/post-scheduled-tasks.d.ts +0 -18
  198. package/schematics/testing/post-scheduled-tasks.js +0 -35
  199. package/schematics/testing/post-scheduled-tasks.js.map +0 -1
  200. package/schematics/testing/test-app.d.ts +0 -10
  201. package/schematics/testing/test-app.js +0 -20
  202. package/schematics/testing/test-app.js.map +0 -1
  203. package/typings/schematics/testing/index.d.ts +0 -9
  204. package/typings/schematics/testing/post-scheduled-tasks.d.ts +0 -18
  205. package/typings/schematics/testing/test-app.d.ts +0 -10
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Injectable, NgZone, Inject, ContentChildren, ElementRef, EventEmitter, forwardRef, Input, Output, Optional, Directive, ContentChild, InjectionToken, SkipSelf, ViewContainerRef, TemplateRef, NgModule, defineInjectable, inject } from '@angular/core';
9
9
  import { DOCUMENT } from '@angular/common';
10
- import { supportsPassiveEventListeners } from '@angular/cdk/platform';
10
+ import { normalizePassiveListenerOptions, supportsPassiveEventListeners } from '@angular/cdk/platform';
11
11
  import { Subject, Observable, Subscription } from 'rxjs';
12
12
  import { Directionality } from '@angular/cdk/bidi';
13
13
  import { ViewportRuler } from '@angular/cdk/scrolling';
@@ -61,7 +61,7 @@ function toggleNativeDragInteractions(element, enable) {
61
61
  /** *
62
62
  * Event options that can be used to bind an active event.
63
63
  @type {?} */
64
- const activeEventOptions = supportsPassiveEventListeners() ? { passive: false } : false;
64
+ const activeEventOptions = normalizePassiveListenerOptions({ passive: false });
65
65
  // unsupported: template constraints.
66
66
  /**
67
67
  * Service that keeps track of all the drag item and drop container
@@ -252,6 +252,18 @@ DragDropRegistry.ctorParameters = () => [
252
252
  ];
253
253
  /** @nocollapse */ DragDropRegistry.ngInjectableDef = defineInjectable({ factory: function DragDropRegistry_Factory() { return new DragDropRegistry(inject(NgZone), inject(DOCUMENT)); }, token: DragDropRegistry, providedIn: "root" });
254
254
 
255
+ /**
256
+ * @fileoverview added by tsickle
257
+ * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
258
+ */
259
+ /** *
260
+ * Injection token that can be used for a `CdkDrag` to provide itself as a parent to the
261
+ * drag-specific child directive (`CdkDragHandle`, `CdkDragPreview` etc.). Used primarily
262
+ * to avoid circular imports.
263
+ * \@docs-private
264
+ @type {?} */
265
+ const CDK_DRAG_PARENT = new InjectionToken('CDK_DRAG_PARENT');
266
+
255
267
  /**
256
268
  * @fileoverview added by tsickle
257
269
  * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
@@ -262,9 +274,11 @@ DragDropRegistry.ctorParameters = () => [
262
274
  class CdkDragHandle {
263
275
  /**
264
276
  * @param {?} element
277
+ * @param {?=} parentDrag
265
278
  */
266
- constructor(element) {
279
+ constructor(element, parentDrag) {
267
280
  this.element = element;
281
+ this._parentDrag = parentDrag;
268
282
  toggleNativeDragInteractions(element.nativeElement, false);
269
283
  }
270
284
  }
@@ -278,7 +292,8 @@ CdkDragHandle.decorators = [
278
292
  ];
279
293
  /** @nocollapse */
280
294
  CdkDragHandle.ctorParameters = () => [
281
- { type: ElementRef }
295
+ { type: ElementRef },
296
+ { type: undefined, decorators: [{ type: Inject, args: [CDK_DRAG_PARENT,] }, { type: Optional }] }
282
297
  ];
283
298
 
284
299
  /**
@@ -346,10 +361,10 @@ CdkDragPreview.propDecorators = {
346
361
  * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
347
362
  */
348
363
  /** *
349
- * Injection token that is used to provide a CdkDrop instance to CdkDrag.
364
+ * Injection token that is used to provide a CdkDropList instance to CdkDrag.
350
365
  * Used for avoiding circular imports.
351
366
  @type {?} */
352
- const CDK_DROP_CONTAINER = new InjectionToken('CDK_DROP_CONTAINER');
367
+ const CDK_DROP_LIST_CONTAINER = new InjectionToken('CDK_DROP_LIST_CONTAINER');
353
368
 
354
369
  /**
355
370
  * @fileoverview added by tsickle
@@ -421,8 +436,12 @@ const CDK_DRAG_CONFIG = new InjectionToken('CDK_DRAG_CONFIG', {
421
436
  function CDK_DRAG_CONFIG_FACTORY() {
422
437
  return { dragStartThreshold: 5, pointerDirectionChangeThreshold: 5 };
423
438
  }
439
+ /** *
440
+ * Options that can be used to bind a passive event listener.
441
+ @type {?} */
442
+ const passiveEventListenerOptions = supportsPassiveEventListeners() ? /** @type {?} */ ({ passive: true }) : false;
424
443
  /**
425
- * Element that can be moved inside a CdkDrop container.
444
+ * Element that can be moved inside a CdkDropList container.
426
445
  * @template T
427
446
  */
428
447
  class CdkDrag {
@@ -512,10 +531,12 @@ class CdkDrag {
512
531
  * Handler for the `mousedown`/`touchstart` events.
513
532
  */
514
533
  this._pointerDown = (event) => {
534
+ /** @type {?} */
535
+ const handles = this._handles.filter(handle => handle._parentDrag === this);
515
536
  // Delegate the event based on whether it started from a handle or the element itself.
516
- if (this._handles.length) {
537
+ if (handles.length) {
517
538
  /** @type {?} */
518
- const targetHandle = this._handles.find(handle => {
539
+ const targetHandle = handles.find(handle => {
519
540
  /** @type {?} */
520
541
  const element = handle.element.nativeElement;
521
542
  /** @type {?} */
@@ -541,13 +562,11 @@ class CdkDrag {
541
562
  const distanceX = Math.abs(pointerPosition.x - this._pickupPositionOnPage.x);
542
563
  /** @type {?} */
543
564
  const distanceY = Math.abs(pointerPosition.y - this._pickupPositionOnPage.y);
544
- /** @type {?} */
545
- const minimumDistance = this._config.dragStartThreshold;
546
565
  // Only start dragging after the user has moved more than the minimum distance in either
547
566
  // direction. Note that this is preferrable over doing something like `skip(minimumDistance)`
548
567
  // in the `pointerMove` subscription, because we're not guaranteed to have one move event
549
568
  // per pixel of movement (e.g. if the user moves their pointer quickly).
550
- if (distanceX + distanceY >= minimumDistance) {
569
+ if (distanceX + distanceY >= this._config.dragStartThreshold) {
551
570
  this._hasStartedDragging = true;
552
571
  this._ngZone.run(() => this._startDragSequence());
553
572
  }
@@ -566,7 +585,11 @@ class CdkDrag {
566
585
  pointerPosition.x - this._pickupPositionOnPage.x + this._passiveTransform.x;
567
586
  activeTransform.y =
568
587
  pointerPosition.y - this._pickupPositionOnPage.y + this._passiveTransform.y;
569
- this._setTransform(this._rootElement, activeTransform.x, activeTransform.y);
588
+ /** @type {?} */
589
+ const transform = getTransform(activeTransform.x, activeTransform.y);
590
+ // Preserve the previous `transform` value, if there was one.
591
+ this._rootElement.style.transform = this._initialTransform ?
592
+ this._initialTransform + ' ' + transform : transform;
570
593
  }
571
594
  // Since this event gets fired for every pixel while dragging, we only
572
595
  // want to fire it if the consumer opted into it. Also we have to
@@ -634,8 +657,8 @@ class CdkDrag {
634
657
  this._ngZone.onStable.asObservable().pipe(take(1)).subscribe(() => {
635
658
  /** @type {?} */
636
659
  const rootElement = this._rootElement = this._getRootElement();
637
- rootElement.addEventListener('mousedown', this._pointerDown);
638
- rootElement.addEventListener('touchstart', this._pointerDown);
660
+ rootElement.addEventListener('mousedown', this._pointerDown, passiveEventListenerOptions);
661
+ rootElement.addEventListener('touchstart', this._pointerDown, passiveEventListenerOptions);
639
662
  toggleNativeDragInteractions(rootElement, false);
640
663
  });
641
664
  }
@@ -643,8 +666,8 @@ class CdkDrag {
643
666
  * @return {?}
644
667
  */
645
668
  ngOnDestroy() {
646
- this._rootElement.removeEventListener('mousedown', this._pointerDown);
647
- this._rootElement.removeEventListener('touchstart', this._pointerDown);
669
+ this._rootElement.removeEventListener('mousedown', this._pointerDown, passiveEventListenerOptions);
670
+ this._rootElement.removeEventListener('touchstart', this._pointerDown, passiveEventListenerOptions);
648
671
  this._destroyPreview();
649
672
  this._destroyPlaceholder();
650
673
  // Do this check before removing from the registry since it'll
@@ -680,6 +703,11 @@ class CdkDrag {
680
703
  if (isDragging || (!this._isTouchEvent(event) && event.button !== 0)) {
681
704
  return;
682
705
  }
706
+ // Cache the previous transform amount only after the first drag sequence, because
707
+ // we don't want our own transforms to stack on top of each other.
708
+ if (this._initialTransform == null) {
709
+ this._initialTransform = this._rootElement.style.transform || '';
710
+ }
683
711
  this._hasStartedDragging = this._hasMoved = false;
684
712
  this._initialContainer = this.dropContainer;
685
713
  this._pointerMoveSubscription = this._dragDropRegistry.pointerMove.subscribe(this._pointerMove);
@@ -784,7 +812,8 @@ class CdkDrag {
784
812
  });
785
813
  }
786
814
  this.dropContainer._sortItem(this, x, y, this._pointerDirectionDelta);
787
- this._setTransform(this._preview, x - this._pickupPositionInElement.x, y - this._pickupPositionInElement.y);
815
+ this._preview.style.transform =
816
+ getTransform(x - this._pickupPositionInElement.x, y - this._pickupPositionInElement.y);
788
817
  }
789
818
  /**
790
819
  * Creates the element that will be rendered next to the user's pointer
@@ -799,7 +828,8 @@ class CdkDrag {
799
828
  const viewRef = this._viewContainerRef.createEmbeddedView(this._previewTemplate.templateRef, this._previewTemplate.data);
800
829
  preview = viewRef.rootNodes[0];
801
830
  this._previewRef = viewRef;
802
- this._setTransform(preview, this._pickupPositionOnPage.x, this._pickupPositionOnPage.y);
831
+ preview.style.transform =
832
+ getTransform(this._pickupPositionOnPage.x, this._pickupPositionOnPage.y);
803
833
  }
804
834
  else {
805
835
  /** @type {?} */
@@ -809,7 +839,7 @@ class CdkDrag {
809
839
  preview = /** @type {?} */ (element.cloneNode(true));
810
840
  preview.style.width = `${elementRect.width}px`;
811
841
  preview.style.height = `${elementRect.height}px`;
812
- this._setTransform(preview, elementRect.left, elementRect.top);
842
+ preview.style.transform = getTransform(elementRect.left, elementRect.top);
813
843
  }
814
844
  extendStyles(preview.style, {
815
845
  position: 'fixed',
@@ -876,7 +906,7 @@ class CdkDrag {
876
906
  // Apply the class that adds a transition to the preview.
877
907
  this._preview.classList.add('cdk-drag-animating');
878
908
  // Move the preview to the placeholder position.
879
- this._setTransform(this._preview, placeholderRect.left, placeholderRect.top);
909
+ this._preview.style.transform = getTransform(placeholderRect.left, placeholderRect.top);
880
910
  /** @type {?} */
881
911
  const duration = getTransformTransitionDurationInMs(this._preview);
882
912
  if (duration === 0) {
@@ -898,16 +928,6 @@ class CdkDrag {
898
928
  });
899
929
  });
900
930
  }
901
- /**
902
- * Sets the `transform` style on an element.
903
- * @param {?} element Element on which to set the transform.
904
- * @param {?} x Desired position of the element along the X axis.
905
- * @param {?} y Desired position of the element along the Y axis.
906
- * @return {?}
907
- */
908
- _setTransform(element, x, y) {
909
- element.style.transform = `translate3d(${x}px, ${y}px, 0)`;
910
- }
911
931
  /**
912
932
  * Helper to remove an element from the DOM and to do all the necessary null checks.
913
933
  * @param {?} element Element to be removed.
@@ -1049,13 +1069,17 @@ CdkDrag.decorators = [
1049
1069
  host: {
1050
1070
  'class': 'cdk-drag',
1051
1071
  '[class.cdk-drag-dragging]': '_hasStartedDragging && _isDragging()',
1052
- }
1072
+ },
1073
+ providers: [{
1074
+ provide: CDK_DRAG_PARENT,
1075
+ useExisting: CdkDrag
1076
+ }]
1053
1077
  },] },
1054
1078
  ];
1055
1079
  /** @nocollapse */
1056
1080
  CdkDrag.ctorParameters = () => [
1057
1081
  { type: ElementRef },
1058
- { type: undefined, decorators: [{ type: Inject, args: [CDK_DROP_CONTAINER,] }, { type: Optional }, { type: SkipSelf }] },
1082
+ { type: undefined, decorators: [{ type: Inject, args: [CDK_DROP_LIST_CONTAINER,] }, { type: Optional }, { type: SkipSelf }] },
1059
1083
  { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
1060
1084
  { type: NgZone },
1061
1085
  { type: ViewContainerRef },
@@ -1065,7 +1089,7 @@ CdkDrag.ctorParameters = () => [
1065
1089
  { type: Directionality, decorators: [{ type: Optional }] }
1066
1090
  ];
1067
1091
  CdkDrag.propDecorators = {
1068
- _handles: [{ type: ContentChildren, args: [CdkDragHandle,] }],
1092
+ _handles: [{ type: ContentChildren, args: [CdkDragHandle, { descendants: true },] }],
1069
1093
  _previewTemplate: [{ type: ContentChild, args: [CdkDragPreview,] }],
1070
1094
  _placeholderTemplate: [{ type: ContentChild, args: [CdkDragPlaceholder,] }],
1071
1095
  data: [{ type: Input, args: ['cdkDragData',] }],
@@ -1078,6 +1102,15 @@ CdkDrag.propDecorators = {
1078
1102
  dropped: [{ type: Output, args: ['cdkDragDropped',] }],
1079
1103
  moved: [{ type: Output, args: ['cdkDragMoved',] }]
1080
1104
  };
1105
+ /**
1106
+ * Gets a 3d `transform` that can be applied to an element.
1107
+ * @param {?} x Desired position of the element along the X axis.
1108
+ * @param {?} y Desired position of the element along the Y axis.
1109
+ * @return {?}
1110
+ */
1111
+ function getTransform(x, y) {
1112
+ return `translate3d(${x}px, ${y}px, 0)`;
1113
+ }
1081
1114
 
1082
1115
  /**
1083
1116
  * @fileoverview added by tsickle
@@ -1127,6 +1160,24 @@ function transferArrayItem(currentArray, targetArray, currentIndex, targetIndex)
1127
1160
  targetArray.splice(to, 0, currentArray.splice(from, 1)[0]);
1128
1161
  }
1129
1162
  }
1163
+ /**
1164
+ * Copies an item from one array to another, leaving it in its
1165
+ * original position in current array.
1166
+ * @template T
1167
+ * @param {?} currentArray Array from which to copy the item.
1168
+ * @param {?} targetArray Array into which is copy the item.
1169
+ * @param {?} currentIndex Index of the item in its current array.
1170
+ * @param {?} targetIndex Index at which to insert the item.
1171
+ *
1172
+ * @return {?}
1173
+ */
1174
+ function copyArrayItem(currentArray, targetArray, currentIndex, targetIndex) {
1175
+ /** @type {?} */
1176
+ const to = clamp(targetIndex, targetArray.length);
1177
+ if (currentArray.length) {
1178
+ targetArray.splice(to, 0, currentArray[currentIndex]);
1179
+ }
1180
+ }
1130
1181
  /**
1131
1182
  * Clamps a number between zero and a maximum.
1132
1183
  * @param {?} value
@@ -1154,7 +1205,7 @@ const DROP_PROXIMITY_THRESHOLD = 0.05;
1154
1205
  * Container that wraps a set of draggable items.
1155
1206
  * @template T
1156
1207
  */
1157
- class CdkDrop {
1208
+ class CdkDropList {
1158
1209
  /**
1159
1210
  * @param {?} element
1160
1211
  * @param {?} _dragDropRegistry
@@ -1176,9 +1227,9 @@ class CdkDrop {
1176
1227
  this.orientation = 'vertical';
1177
1228
  /**
1178
1229
  * Unique ID for the drop zone. Can be used as a reference
1179
- * in the `connectedTo` of another `CdkDrop`.
1230
+ * in the `connectedTo` of another `CdkDropList`.
1180
1231
  */
1181
- this.id = `cdk-drop-${_uniqueIdCounter++}`;
1232
+ this.id = `cdk-drop-list-${_uniqueIdCounter++}`;
1182
1233
  /**
1183
1234
  * Function that is used to determine whether an item
1184
1235
  * is allowed to be moved into a drop container.
@@ -1402,7 +1453,7 @@ class CdkDrop {
1402
1453
  /** @type {?} */
1403
1454
  const result = this._positionCache.siblings
1404
1455
  .find(sibling => isInsideClientRect(sibling.clientRect, x, y));
1405
- return result && result.drop.enterPredicate(item, this) ? result.drop : null;
1456
+ return result && result.drop.enterPredicate(item, result.drop) ? result.drop : null;
1406
1457
  }
1407
1458
  /**
1408
1459
  * Checks whether an item that started in this container can be returned to it,
@@ -1535,37 +1586,37 @@ class CdkDrop {
1535
1586
  pointerX > left - xThreshold && pointerX < right + xThreshold;
1536
1587
  }
1537
1588
  }
1538
- CdkDrop.decorators = [
1589
+ CdkDropList.decorators = [
1539
1590
  { type: Directive, args: [{
1540
- selector: '[cdkDrop], cdk-drop',
1541
- exportAs: 'cdkDrop',
1591
+ selector: '[cdkDropList], cdk-drop-list',
1592
+ exportAs: 'cdkDropList',
1542
1593
  providers: [
1543
- { provide: CDK_DROP_CONTAINER, useExisting: CdkDrop },
1594
+ { provide: CDK_DROP_LIST_CONTAINER, useExisting: CdkDropList },
1544
1595
  ],
1545
1596
  host: {
1546
- 'class': 'cdk-drop',
1597
+ 'class': 'cdk-drop-list',
1547
1598
  '[id]': 'id',
1548
- '[class.cdk-drop-dragging]': '_dragging'
1599
+ '[class.cdk-drop-list-dragging]': '_dragging'
1549
1600
  }
1550
1601
  },] },
1551
1602
  ];
1552
1603
  /** @nocollapse */
1553
- CdkDrop.ctorParameters = () => [
1604
+ CdkDropList.ctorParameters = () => [
1554
1605
  { type: ElementRef },
1555
1606
  { type: DragDropRegistry },
1556
1607
  { type: Directionality, decorators: [{ type: Optional }] }
1557
1608
  ];
1558
- CdkDrop.propDecorators = {
1609
+ CdkDropList.propDecorators = {
1559
1610
  _draggables: [{ type: ContentChildren, args: [forwardRef(() => CdkDrag),] }],
1560
- connectedTo: [{ type: Input, args: ['cdkDropConnectedTo',] }],
1561
- data: [{ type: Input, args: ['cdkDropData',] }],
1562
- orientation: [{ type: Input, args: ['cdkDropOrientation',] }],
1611
+ connectedTo: [{ type: Input, args: ['cdkDropListConnectedTo',] }],
1612
+ data: [{ type: Input, args: ['cdkDropListData',] }],
1613
+ orientation: [{ type: Input, args: ['cdkDropListOrientation',] }],
1563
1614
  id: [{ type: Input }],
1564
- lockAxis: [{ type: Input, args: ['cdkDropLockAxis',] }],
1565
- enterPredicate: [{ type: Input, args: ['cdkDropEnterPredication',] }],
1566
- dropped: [{ type: Output, args: ['cdkDropDropped',] }],
1567
- entered: [{ type: Output, args: ['cdkDropEntered',] }],
1568
- exited: [{ type: Output, args: ['cdkDropExited',] }]
1615
+ lockAxis: [{ type: Input, args: ['cdkDropListLockAxis',] }],
1616
+ enterPredicate: [{ type: Input, args: ['cdkDropListEnterPredicate',] }],
1617
+ dropped: [{ type: Output, args: ['cdkDropListDropped',] }],
1618
+ entered: [{ type: Output, args: ['cdkDropListEntered',] }],
1619
+ exited: [{ type: Output, args: ['cdkDropListExited',] }]
1569
1620
  };
1570
1621
  /**
1571
1622
  * Finds the index of an item that matches a predicate function. Used as an equivalent
@@ -1604,14 +1655,14 @@ class DragDropModule {
1604
1655
  DragDropModule.decorators = [
1605
1656
  { type: NgModule, args: [{
1606
1657
  declarations: [
1607
- CdkDrop,
1658
+ CdkDropList,
1608
1659
  CdkDrag,
1609
1660
  CdkDragHandle,
1610
1661
  CdkDragPreview,
1611
1662
  CdkDragPlaceholder,
1612
1663
  ],
1613
1664
  exports: [
1614
- CdkDrop,
1665
+ CdkDropList,
1615
1666
  CdkDrag,
1616
1667
  CdkDragHandle,
1617
1668
  CdkDragPreview,
@@ -1630,5 +1681,5 @@ DragDropModule.decorators = [
1630
1681
  * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1631
1682
  */
1632
1683
 
1633
- export { CdkDrop, CDK_DROP_CONTAINER, CDK_DRAG_CONFIG_FACTORY, CDK_DRAG_CONFIG, CdkDrag, CdkDragHandle, moveItemInArray, transferArrayItem, CdkDragPreview, CdkDragPlaceholder, DragDropModule, DragDropRegistry };
1684
+ export { CdkDropList, CDK_DROP_LIST_CONTAINER, CDK_DRAG_CONFIG_FACTORY, CDK_DRAG_CONFIG, CdkDrag, CdkDragHandle, moveItemInArray, transferArrayItem, copyArrayItem, CdkDragPreview, CdkDragPlaceholder, DragDropModule, DragDropRegistry, CDK_DRAG_PARENT as ɵa };
1634
1685
  //# sourceMappingURL=drag-drop.js.map