@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.
- package/_a11y.scss +32 -0
- package/_overlay.scss +141 -0
- package/_text-field.scss +63 -0
- package/a11y/typings/aria-describer/aria-describer.d.ts +2 -2
- package/a11y/typings/focus-monitor/focus-monitor.d.ts +2 -2
- package/a11y/typings/index.metadata.json +1 -1
- package/a11y/typings/key-manager/list-key-manager.d.ts +1 -1
- package/a11y/typings/live-announcer/live-announcer.d.ts +2 -2
- package/bundles/cdk-a11y.umd.js +26 -21
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +1 -1
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +126 -81
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +1 -1
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +22 -22
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +13 -2
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +1 -1
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +10 -6
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +1 -1
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-stepper.umd.js +1 -1
- package/bundles/cdk-stepper.umd.js.map +1 -1
- package/bundles/cdk-stepper.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +5 -1
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +1 -1
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +10 -3
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +1 -1
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/drag-drop/typings/drag-events.d.ts +5 -5
- package/drag-drop/typings/drag-handle.d.ts +3 -1
- package/drag-drop/typings/drag-parent.d.ts +15 -0
- package/drag-drop/typings/drag-utils.d.ts +10 -0
- package/drag-drop/typings/drag.d.ts +6 -11
- package/drag-drop/typings/{drop-container.d.ts → drop-list-container.d.ts} +5 -5
- package/{typings/drag-drop/drop.d.ts → drag-drop/typings/drop-list.d.ts} +7 -7
- package/drag-drop/typings/index.d.ts +1 -0
- package/drag-drop/typings/index.metadata.json +1 -1
- package/drag-drop/typings/public-api.d.ts +2 -2
- package/esm2015/a11y.js +25 -20
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/cdk.js +1 -1
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/drag-drop.js +108 -57
- package/esm2015/drag-drop.js.map +1 -1
- package/esm2015/overlay.js +12 -12
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/platform.js +13 -3
- package/esm2015/platform.js.map +1 -1
- package/esm2015/scrolling.js +10 -6
- package/esm2015/scrolling.js.map +1 -1
- package/esm2015/stepper.js +1 -1
- package/esm2015/stepper.js.map +1 -1
- package/esm2015/table.js +5 -1
- package/esm2015/table.js.map +1 -1
- package/esm2015/text-field.js +11 -4
- package/esm2015/text-field.js.map +1 -1
- package/esm5/a11y.es5.js +27 -22
- package/esm5/a11y.es5.js.map +1 -1
- package/esm5/cdk.es5.js +1 -1
- package/esm5/cdk.es5.js.map +1 -1
- package/esm5/drag-drop.es5.js +124 -81
- package/esm5/drag-drop.es5.js.map +1 -1
- package/esm5/overlay.es5.js +22 -22
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/platform.es5.js +13 -3
- package/esm5/platform.es5.js.map +1 -1
- package/esm5/scrolling.es5.js +10 -6
- package/esm5/scrolling.es5.js.map +1 -1
- package/esm5/stepper.es5.js +1 -1
- package/esm5/stepper.es5.js.map +1 -1
- package/esm5/table.es5.js +5 -1
- package/esm5/table.es5.js.map +1 -1
- package/esm5/text-field.es5.js +11 -4
- package/esm5/text-field.es5.js.map +1 -1
- package/overlay/typings/keyboard/overlay-keyboard-dispatcher.d.ts +2 -2
- package/overlay/typings/overlay-container.d.ts +2 -2
- package/overlay/typings/overlay-directives.d.ts +1 -1
- package/overlay/typings/overlay-module.d.ts +1 -1
- package/overlay/typings/position/connected-position-strategy.d.ts +1 -1
- package/overlay/typings/position/global-position-strategy.d.ts +2 -2
- package/overlay/typings/position/overlay-position-builder.d.ts +1 -1
- package/package.json +6 -6
- package/platform/typings/features/passive-listeners.d.ts +7 -0
- package/platform/typings/index.metadata.json +1 -1
- package/platform/typings/platform.d.ts +1 -1
- package/schematics/index.d.ts +0 -1
- package/schematics/index.js +0 -1
- package/schematics/index.js.map +1 -1
- package/schematics/ng-add/index.d.ts +4 -0
- package/schematics/ng-add/index.js +7 -3
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html +4 -4
- package/schematics/ng-generate/drag-drop/schema.json +2 -1
- package/schematics/ng-update/index.js +8 -2
- package/schematics/ng-update/index.js.map +1 -1
- package/schematics/utils/build-component.d.ts +7 -0
- package/schematics/utils/build-component.js +4 -5
- package/schematics/utils/build-component.js.map +1 -1
- package/schematics/utils/html-head-element.d.ts +13 -0
- package/schematics/utils/html-head-element.js +54 -0
- package/schematics/utils/html-head-element.js.map +1 -0
- package/schematics/utils/index.d.ts +1 -0
- package/schematics/utils/index.js +1 -0
- package/schematics/utils/index.js.map +1 -1
- package/scrolling/typings/index.metadata.json +1 -1
- package/scrolling/typings/scroll-dispatcher.d.ts +2 -2
- package/scrolling/typings/viewport-ruler.d.ts +2 -2
- package/table/typings/index.metadata.json +1 -1
- package/text-field/typings/autosize.d.ts +7 -1
- package/text-field/typings/index.metadata.json +1 -1
- package/typings/a11y/aria-describer/aria-describer.d.ts +2 -2
- package/typings/a11y/focus-monitor/focus-monitor.d.ts +2 -2
- package/typings/a11y/index.metadata.json +1 -1
- package/typings/a11y/key-manager/list-key-manager.d.ts +1 -1
- package/typings/a11y/live-announcer/live-announcer.d.ts +2 -2
- package/typings/drag-drop/drag-events.d.ts +5 -5
- package/typings/drag-drop/drag-handle.d.ts +3 -1
- package/typings/drag-drop/drag-parent.d.ts +15 -0
- package/typings/drag-drop/drag-utils.d.ts +10 -0
- package/typings/drag-drop/drag.d.ts +6 -11
- package/typings/drag-drop/{drop-container.d.ts → drop-list-container.d.ts} +5 -5
- package/{drag-drop/typings/drop.d.ts → typings/drag-drop/drop-list.d.ts} +7 -7
- package/typings/drag-drop/index.d.ts +1 -0
- package/typings/drag-drop/index.metadata.json +1 -1
- package/typings/drag-drop/public-api.d.ts +2 -2
- package/typings/esm5/a11y/aria-describer/aria-describer.d.ts +2 -2
- package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +2 -2
- package/typings/esm5/a11y/index.metadata.json +1 -1
- package/typings/esm5/a11y/key-manager/list-key-manager.d.ts +1 -1
- package/typings/esm5/a11y/live-announcer/live-announcer.d.ts +2 -2
- package/typings/esm5/drag-drop/drag-events.d.ts +5 -5
- package/typings/esm5/drag-drop/drag-handle.d.ts +3 -1
- package/typings/esm5/drag-drop/drag-parent.d.ts +15 -0
- package/typings/esm5/drag-drop/drag-utils.d.ts +10 -0
- package/typings/esm5/drag-drop/drag.d.ts +6 -11
- package/typings/esm5/drag-drop/{drop-container.d.ts → drop-list-container.d.ts} +5 -5
- package/typings/esm5/drag-drop/{drop.d.ts → drop-list.d.ts} +7 -7
- package/typings/esm5/drag-drop/index.d.ts +1 -0
- package/typings/esm5/drag-drop/index.metadata.json +1 -1
- package/typings/esm5/drag-drop/public-api.d.ts +2 -2
- package/typings/esm5/index.metadata.json +1 -1
- package/typings/esm5/overlay/keyboard/overlay-keyboard-dispatcher.d.ts +2 -2
- package/typings/esm5/overlay/overlay-container.d.ts +2 -2
- package/typings/esm5/overlay/overlay-directives.d.ts +1 -1
- package/typings/esm5/overlay/overlay-module.d.ts +1 -1
- package/typings/esm5/overlay/position/connected-position-strategy.d.ts +1 -1
- package/typings/esm5/overlay/position/global-position-strategy.d.ts +2 -2
- package/typings/esm5/overlay/position/overlay-position-builder.d.ts +1 -1
- package/typings/esm5/platform/features/passive-listeners.d.ts +7 -0
- package/typings/esm5/platform/index.metadata.json +1 -1
- package/typings/esm5/platform/platform.d.ts +1 -1
- package/typings/esm5/scrolling/index.metadata.json +1 -1
- package/typings/esm5/scrolling/scroll-dispatcher.d.ts +2 -2
- package/typings/esm5/scrolling/viewport-ruler.d.ts +2 -2
- package/typings/esm5/table/index.metadata.json +1 -1
- package/typings/esm5/text-field/autosize.d.ts +7 -1
- package/typings/esm5/text-field/index.metadata.json +1 -1
- package/typings/index.metadata.json +1 -1
- package/typings/overlay/keyboard/overlay-keyboard-dispatcher.d.ts +2 -2
- package/typings/overlay/overlay-container.d.ts +2 -2
- package/typings/overlay/overlay-directives.d.ts +1 -1
- package/typings/overlay/overlay-module.d.ts +1 -1
- package/typings/overlay/position/connected-position-strategy.d.ts +1 -1
- package/typings/overlay/position/global-position-strategy.d.ts +2 -2
- package/typings/overlay/position/overlay-position-builder.d.ts +1 -1
- package/typings/platform/features/passive-listeners.d.ts +7 -0
- package/typings/platform/index.metadata.json +1 -1
- package/typings/platform/platform.d.ts +1 -1
- package/typings/schematics/index.d.ts +0 -1
- package/typings/schematics/ng-add/index.d.ts +4 -0
- package/typings/schematics/utils/build-component.d.ts +7 -0
- package/typings/schematics/utils/html-head-element.d.ts +13 -0
- package/typings/schematics/utils/index.d.ts +1 -0
- package/typings/scrolling/index.metadata.json +1 -1
- package/typings/scrolling/scroll-dispatcher.d.ts +2 -2
- package/typings/scrolling/viewport-ruler.d.ts +2 -2
- package/typings/table/index.metadata.json +1 -1
- package/typings/text-field/autosize.d.ts +7 -1
- package/typings/text-field/index.metadata.json +1 -1
- package/schematics/testing/index.d.ts +0 -9
- package/schematics/testing/index.js +0 -15
- package/schematics/testing/index.js.map +0 -1
- package/schematics/testing/post-scheduled-tasks.d.ts +0 -18
- package/schematics/testing/post-scheduled-tasks.js +0 -35
- package/schematics/testing/post-scheduled-tasks.js.map +0 -1
- package/schematics/testing/test-app.d.ts +0 -10
- package/schematics/testing/test-app.js +0 -20
- package/schematics/testing/test-app.js.map +0 -1
- package/typings/schematics/testing/index.d.ts +0 -9
- package/typings/schematics/testing/post-scheduled-tasks.d.ts +0 -18
- package/typings/schematics/testing/test-app.d.ts +0 -10
|
@@ -58,7 +58,7 @@ function toggleNativeDragInteractions(element, enable) {
|
|
|
58
58
|
/** *
|
|
59
59
|
* Event options that can be used to bind an active event.
|
|
60
60
|
@type {?} */
|
|
61
|
-
var activeEventOptions = platform.
|
|
61
|
+
var activeEventOptions = platform.normalizePassiveListenerOptions({ passive: false });
|
|
62
62
|
// unsupported: template constraints.
|
|
63
63
|
/**
|
|
64
64
|
* Service that keeps track of all the drag item and drop container
|
|
@@ -311,6 +311,18 @@ var DragDropRegistry = /** @class */ (function () {
|
|
|
311
311
|
return DragDropRegistry;
|
|
312
312
|
}());
|
|
313
313
|
|
|
314
|
+
/**
|
|
315
|
+
* @fileoverview added by tsickle
|
|
316
|
+
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
317
|
+
*/
|
|
318
|
+
/** *
|
|
319
|
+
* Injection token that can be used for a `CdkDrag` to provide itself as a parent to the
|
|
320
|
+
* drag-specific child directive (`CdkDragHandle`, `CdkDragPreview` etc.). Used primarily
|
|
321
|
+
* to avoid circular imports.
|
|
322
|
+
* \@docs-private
|
|
323
|
+
@type {?} */
|
|
324
|
+
var CDK_DRAG_PARENT = new core.InjectionToken('CDK_DRAG_PARENT');
|
|
325
|
+
|
|
314
326
|
/**
|
|
315
327
|
* @fileoverview added by tsickle
|
|
316
328
|
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
@@ -319,8 +331,9 @@ var DragDropRegistry = /** @class */ (function () {
|
|
|
319
331
|
* Handle that can be used to drag and CdkDrag instance.
|
|
320
332
|
*/
|
|
321
333
|
var CdkDragHandle = /** @class */ (function () {
|
|
322
|
-
function CdkDragHandle(element) {
|
|
334
|
+
function CdkDragHandle(element, parentDrag) {
|
|
323
335
|
this.element = element;
|
|
336
|
+
this._parentDrag = parentDrag;
|
|
324
337
|
toggleNativeDragInteractions(element.nativeElement, false);
|
|
325
338
|
}
|
|
326
339
|
CdkDragHandle.decorators = [
|
|
@@ -333,7 +346,8 @@ var CdkDragHandle = /** @class */ (function () {
|
|
|
333
346
|
];
|
|
334
347
|
/** @nocollapse */
|
|
335
348
|
CdkDragHandle.ctorParameters = function () { return [
|
|
336
|
-
{ type: core.ElementRef }
|
|
349
|
+
{ type: core.ElementRef },
|
|
350
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [CDK_DRAG_PARENT,] }, { type: core.Optional }] }
|
|
337
351
|
]; };
|
|
338
352
|
return CdkDragHandle;
|
|
339
353
|
}());
|
|
@@ -399,10 +413,10 @@ var CdkDragPreview = /** @class */ (function () {
|
|
|
399
413
|
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
400
414
|
*/
|
|
401
415
|
/** *
|
|
402
|
-
* Injection token that is used to provide a
|
|
416
|
+
* Injection token that is used to provide a CdkDropList instance to CdkDrag.
|
|
403
417
|
* Used for avoiding circular imports.
|
|
404
418
|
@type {?} */
|
|
405
|
-
var
|
|
419
|
+
var CDK_DROP_LIST_CONTAINER = new core.InjectionToken('CDK_DROP_LIST_CONTAINER');
|
|
406
420
|
|
|
407
421
|
/**
|
|
408
422
|
* @fileoverview added by tsickle
|
|
@@ -474,8 +488,12 @@ var CDK_DRAG_CONFIG = new core.InjectionToken('CDK_DRAG_CONFIG', {
|
|
|
474
488
|
function CDK_DRAG_CONFIG_FACTORY() {
|
|
475
489
|
return { dragStartThreshold: 5, pointerDirectionChangeThreshold: 5 };
|
|
476
490
|
}
|
|
491
|
+
/** *
|
|
492
|
+
* Options that can be used to bind a passive event listener.
|
|
493
|
+
@type {?} */
|
|
494
|
+
var passiveEventListenerOptions = platform.supportsPassiveEventListeners() ? /** @type {?} */ ({ passive: true }) : false;
|
|
477
495
|
/**
|
|
478
|
-
* Element that can be moved inside a
|
|
496
|
+
* Element that can be moved inside a CdkDropList container.
|
|
479
497
|
* @template T
|
|
480
498
|
*/
|
|
481
499
|
var CdkDrag = /** @class */ (function () {
|
|
@@ -555,10 +573,12 @@ var CdkDrag = /** @class */ (function () {
|
|
|
555
573
|
* Handler for the `mousedown`/`touchstart` events.
|
|
556
574
|
*/
|
|
557
575
|
this._pointerDown = function (event) {
|
|
576
|
+
/** @type {?} */
|
|
577
|
+
var handles = _this._handles.filter(function (handle) { return handle._parentDrag === _this; });
|
|
558
578
|
// Delegate the event based on whether it started from a handle or the element itself.
|
|
559
|
-
if (
|
|
579
|
+
if (handles.length) {
|
|
560
580
|
/** @type {?} */
|
|
561
|
-
var targetHandle =
|
|
581
|
+
var targetHandle = handles.find(function (handle) {
|
|
562
582
|
/** @type {?} */
|
|
563
583
|
var element = handle.element.nativeElement;
|
|
564
584
|
/** @type {?} */
|
|
@@ -584,13 +604,11 @@ var CdkDrag = /** @class */ (function () {
|
|
|
584
604
|
var distanceX = Math.abs(pointerPosition.x - _this._pickupPositionOnPage.x);
|
|
585
605
|
/** @type {?} */
|
|
586
606
|
var distanceY = Math.abs(pointerPosition.y - _this._pickupPositionOnPage.y);
|
|
587
|
-
/** @type {?} */
|
|
588
|
-
var minimumDistance = _this._config.dragStartThreshold;
|
|
589
607
|
// Only start dragging after the user has moved more than the minimum distance in either
|
|
590
608
|
// direction. Note that this is preferrable over doing something like `skip(minimumDistance)`
|
|
591
609
|
// in the `pointerMove` subscription, because we're not guaranteed to have one move event
|
|
592
610
|
// per pixel of movement (e.g. if the user moves their pointer quickly).
|
|
593
|
-
if (distanceX + distanceY >=
|
|
611
|
+
if (distanceX + distanceY >= _this._config.dragStartThreshold) {
|
|
594
612
|
_this._hasStartedDragging = true;
|
|
595
613
|
_this._ngZone.run(function () { return _this._startDragSequence(); });
|
|
596
614
|
}
|
|
@@ -609,7 +627,11 @@ var CdkDrag = /** @class */ (function () {
|
|
|
609
627
|
pointerPosition.x - _this._pickupPositionOnPage.x + _this._passiveTransform.x;
|
|
610
628
|
activeTransform.y =
|
|
611
629
|
pointerPosition.y - _this._pickupPositionOnPage.y + _this._passiveTransform.y;
|
|
612
|
-
|
|
630
|
+
/** @type {?} */
|
|
631
|
+
var transform = getTransform(activeTransform.x, activeTransform.y);
|
|
632
|
+
// Preserve the previous `transform` value, if there was one.
|
|
633
|
+
_this._rootElement.style.transform = _this._initialTransform ?
|
|
634
|
+
_this._initialTransform + ' ' + transform : transform;
|
|
613
635
|
}
|
|
614
636
|
// Since this event gets fired for every pixel while dragging, we only
|
|
615
637
|
// want to fire it if the consumer opted into it. Also we have to
|
|
@@ -695,8 +717,8 @@ var CdkDrag = /** @class */ (function () {
|
|
|
695
717
|
this._ngZone.onStable.asObservable().pipe(operators.take(1)).subscribe(function () {
|
|
696
718
|
/** @type {?} */
|
|
697
719
|
var rootElement = _this._rootElement = _this._getRootElement();
|
|
698
|
-
rootElement.addEventListener('mousedown', _this._pointerDown);
|
|
699
|
-
rootElement.addEventListener('touchstart', _this._pointerDown);
|
|
720
|
+
rootElement.addEventListener('mousedown', _this._pointerDown, passiveEventListenerOptions);
|
|
721
|
+
rootElement.addEventListener('touchstart', _this._pointerDown, passiveEventListenerOptions);
|
|
700
722
|
toggleNativeDragInteractions(rootElement, false);
|
|
701
723
|
});
|
|
702
724
|
};
|
|
@@ -707,8 +729,8 @@ var CdkDrag = /** @class */ (function () {
|
|
|
707
729
|
* @return {?}
|
|
708
730
|
*/
|
|
709
731
|
function () {
|
|
710
|
-
this._rootElement.removeEventListener('mousedown', this._pointerDown);
|
|
711
|
-
this._rootElement.removeEventListener('touchstart', this._pointerDown);
|
|
732
|
+
this._rootElement.removeEventListener('mousedown', this._pointerDown, passiveEventListenerOptions);
|
|
733
|
+
this._rootElement.removeEventListener('touchstart', this._pointerDown, passiveEventListenerOptions);
|
|
712
734
|
this._destroyPreview();
|
|
713
735
|
this._destroyPlaceholder();
|
|
714
736
|
// Do this check before removing from the registry since it'll
|
|
@@ -756,6 +778,11 @@ var CdkDrag = /** @class */ (function () {
|
|
|
756
778
|
if (isDragging || (!this._isTouchEvent(event) && event.button !== 0)) {
|
|
757
779
|
return;
|
|
758
780
|
}
|
|
781
|
+
// Cache the previous transform amount only after the first drag sequence, because
|
|
782
|
+
// we don't want our own transforms to stack on top of each other.
|
|
783
|
+
if (this._initialTransform == null) {
|
|
784
|
+
this._initialTransform = this._rootElement.style.transform || '';
|
|
785
|
+
}
|
|
759
786
|
this._hasStartedDragging = this._hasMoved = false;
|
|
760
787
|
this._initialContainer = this.dropContainer;
|
|
761
788
|
this._pointerMoveSubscription = this._dragDropRegistry.pointerMove.subscribe(this._pointerMove);
|
|
@@ -877,7 +904,8 @@ var CdkDrag = /** @class */ (function () {
|
|
|
877
904
|
});
|
|
878
905
|
}
|
|
879
906
|
this.dropContainer._sortItem(this, x, y, this._pointerDirectionDelta);
|
|
880
|
-
this.
|
|
907
|
+
this._preview.style.transform =
|
|
908
|
+
getTransform(x - this._pickupPositionInElement.x, y - this._pickupPositionInElement.y);
|
|
881
909
|
};
|
|
882
910
|
/**
|
|
883
911
|
* Creates the element that will be rendered next to the user's pointer
|
|
@@ -897,7 +925,8 @@ var CdkDrag = /** @class */ (function () {
|
|
|
897
925
|
var viewRef = this._viewContainerRef.createEmbeddedView(this._previewTemplate.templateRef, this._previewTemplate.data);
|
|
898
926
|
preview = viewRef.rootNodes[0];
|
|
899
927
|
this._previewRef = viewRef;
|
|
900
|
-
|
|
928
|
+
preview.style.transform =
|
|
929
|
+
getTransform(this._pickupPositionOnPage.x, this._pickupPositionOnPage.y);
|
|
901
930
|
}
|
|
902
931
|
else {
|
|
903
932
|
/** @type {?} */
|
|
@@ -907,7 +936,7 @@ var CdkDrag = /** @class */ (function () {
|
|
|
907
936
|
preview = /** @type {?} */ (element.cloneNode(true));
|
|
908
937
|
preview.style.width = elementRect.width + "px";
|
|
909
938
|
preview.style.height = elementRect.height + "px";
|
|
910
|
-
|
|
939
|
+
preview.style.transform = getTransform(elementRect.left, elementRect.top);
|
|
911
940
|
}
|
|
912
941
|
extendStyles(preview.style, {
|
|
913
942
|
position: 'fixed',
|
|
@@ -989,7 +1018,7 @@ var CdkDrag = /** @class */ (function () {
|
|
|
989
1018
|
// Apply the class that adds a transition to the preview.
|
|
990
1019
|
this._preview.classList.add('cdk-drag-animating');
|
|
991
1020
|
// Move the preview to the placeholder position.
|
|
992
|
-
this.
|
|
1021
|
+
this._preview.style.transform = getTransform(placeholderRect.left, placeholderRect.top);
|
|
993
1022
|
/** @type {?} */
|
|
994
1023
|
var duration = getTransformTransitionDurationInMs(this._preview);
|
|
995
1024
|
if (duration === 0) {
|
|
@@ -1011,23 +1040,6 @@ var CdkDrag = /** @class */ (function () {
|
|
|
1011
1040
|
});
|
|
1012
1041
|
});
|
|
1013
1042
|
};
|
|
1014
|
-
/**
|
|
1015
|
-
* Sets the `transform` style on an element.
|
|
1016
|
-
* @param {?} element Element on which to set the transform.
|
|
1017
|
-
* @param {?} x Desired position of the element along the X axis.
|
|
1018
|
-
* @param {?} y Desired position of the element along the Y axis.
|
|
1019
|
-
* @return {?}
|
|
1020
|
-
*/
|
|
1021
|
-
CdkDrag.prototype._setTransform = /**
|
|
1022
|
-
* Sets the `transform` style on an element.
|
|
1023
|
-
* @param {?} element Element on which to set the transform.
|
|
1024
|
-
* @param {?} x Desired position of the element along the X axis.
|
|
1025
|
-
* @param {?} y Desired position of the element along the Y axis.
|
|
1026
|
-
* @return {?}
|
|
1027
|
-
*/
|
|
1028
|
-
function (element, x, y) {
|
|
1029
|
-
element.style.transform = "translate3d(" + x + "px, " + y + "px, 0)";
|
|
1030
|
-
};
|
|
1031
1043
|
/**
|
|
1032
1044
|
* Helper to remove an element from the DOM and to do all the necessary null checks.
|
|
1033
1045
|
* @param {?} element Element to be removed.
|
|
@@ -1209,13 +1221,17 @@ var CdkDrag = /** @class */ (function () {
|
|
|
1209
1221
|
host: {
|
|
1210
1222
|
'class': 'cdk-drag',
|
|
1211
1223
|
'[class.cdk-drag-dragging]': '_hasStartedDragging && _isDragging()',
|
|
1212
|
-
}
|
|
1224
|
+
},
|
|
1225
|
+
providers: [{
|
|
1226
|
+
provide: CDK_DRAG_PARENT,
|
|
1227
|
+
useExisting: CdkDrag
|
|
1228
|
+
}]
|
|
1213
1229
|
},] },
|
|
1214
1230
|
];
|
|
1215
1231
|
/** @nocollapse */
|
|
1216
1232
|
CdkDrag.ctorParameters = function () { return [
|
|
1217
1233
|
{ type: core.ElementRef },
|
|
1218
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [
|
|
1234
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [CDK_DROP_LIST_CONTAINER,] }, { type: core.Optional }, { type: core.SkipSelf }] },
|
|
1219
1235
|
{ type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
|
|
1220
1236
|
{ type: core.NgZone },
|
|
1221
1237
|
{ type: core.ViewContainerRef },
|
|
@@ -1225,7 +1241,7 @@ var CdkDrag = /** @class */ (function () {
|
|
|
1225
1241
|
{ type: bidi.Directionality, decorators: [{ type: core.Optional }] }
|
|
1226
1242
|
]; };
|
|
1227
1243
|
CdkDrag.propDecorators = {
|
|
1228
|
-
_handles: [{ type: core.ContentChildren, args: [CdkDragHandle,] }],
|
|
1244
|
+
_handles: [{ type: core.ContentChildren, args: [CdkDragHandle, { descendants: true },] }],
|
|
1229
1245
|
_previewTemplate: [{ type: core.ContentChild, args: [CdkDragPreview,] }],
|
|
1230
1246
|
_placeholderTemplate: [{ type: core.ContentChild, args: [CdkDragPlaceholder,] }],
|
|
1231
1247
|
data: [{ type: core.Input, args: ['cdkDragData',] }],
|
|
@@ -1240,6 +1256,15 @@ var CdkDrag = /** @class */ (function () {
|
|
|
1240
1256
|
};
|
|
1241
1257
|
return CdkDrag;
|
|
1242
1258
|
}());
|
|
1259
|
+
/**
|
|
1260
|
+
* Gets a 3d `transform` that can be applied to an element.
|
|
1261
|
+
* @param {?} x Desired position of the element along the X axis.
|
|
1262
|
+
* @param {?} y Desired position of the element along the Y axis.
|
|
1263
|
+
* @return {?}
|
|
1264
|
+
*/
|
|
1265
|
+
function getTransform(x, y) {
|
|
1266
|
+
return "translate3d(" + x + "px, " + y + "px, 0)";
|
|
1267
|
+
}
|
|
1243
1268
|
|
|
1244
1269
|
/**
|
|
1245
1270
|
* @fileoverview added by tsickle
|
|
@@ -1289,6 +1314,24 @@ function transferArrayItem(currentArray, targetArray, currentIndex, targetIndex)
|
|
|
1289
1314
|
targetArray.splice(to, 0, currentArray.splice(from, 1)[0]);
|
|
1290
1315
|
}
|
|
1291
1316
|
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Copies an item from one array to another, leaving it in its
|
|
1319
|
+
* original position in current array.
|
|
1320
|
+
* @template T
|
|
1321
|
+
* @param {?} currentArray Array from which to copy the item.
|
|
1322
|
+
* @param {?} targetArray Array into which is copy the item.
|
|
1323
|
+
* @param {?} currentIndex Index of the item in its current array.
|
|
1324
|
+
* @param {?} targetIndex Index at which to insert the item.
|
|
1325
|
+
*
|
|
1326
|
+
* @return {?}
|
|
1327
|
+
*/
|
|
1328
|
+
function copyArrayItem(currentArray, targetArray, currentIndex, targetIndex) {
|
|
1329
|
+
/** @type {?} */
|
|
1330
|
+
var to = clamp(targetIndex, targetArray.length);
|
|
1331
|
+
if (currentArray.length) {
|
|
1332
|
+
targetArray.splice(to, 0, currentArray[currentIndex]);
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1292
1335
|
/**
|
|
1293
1336
|
* Clamps a number between zero and a maximum.
|
|
1294
1337
|
* @param {?} value
|
|
@@ -1316,8 +1359,8 @@ var DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
|
1316
1359
|
* Container that wraps a set of draggable items.
|
|
1317
1360
|
* @template T
|
|
1318
1361
|
*/
|
|
1319
|
-
var
|
|
1320
|
-
function
|
|
1362
|
+
var CdkDropList = /** @class */ (function () {
|
|
1363
|
+
function CdkDropList(element, _dragDropRegistry, _dir) {
|
|
1321
1364
|
this.element = element;
|
|
1322
1365
|
this._dragDropRegistry = _dragDropRegistry;
|
|
1323
1366
|
this._dir = _dir;
|
|
@@ -1333,9 +1376,9 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1333
1376
|
this.orientation = 'vertical';
|
|
1334
1377
|
/**
|
|
1335
1378
|
* Unique ID for the drop zone. Can be used as a reference
|
|
1336
|
-
* in the `connectedTo` of another `
|
|
1379
|
+
* in the `connectedTo` of another `CdkDropList`.
|
|
1337
1380
|
*/
|
|
1338
|
-
this.id = "cdk-drop-" + _uniqueIdCounter++;
|
|
1381
|
+
this.id = "cdk-drop-list-" + _uniqueIdCounter++;
|
|
1339
1382
|
/**
|
|
1340
1383
|
* Function that is used to determine whether an item
|
|
1341
1384
|
* is allowed to be moved into a drop container.
|
|
@@ -1375,7 +1418,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1375
1418
|
/**
|
|
1376
1419
|
* @return {?}
|
|
1377
1420
|
*/
|
|
1378
|
-
|
|
1421
|
+
CdkDropList.prototype.ngOnInit = /**
|
|
1379
1422
|
* @return {?}
|
|
1380
1423
|
*/
|
|
1381
1424
|
function () {
|
|
@@ -1384,7 +1427,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1384
1427
|
/**
|
|
1385
1428
|
* @return {?}
|
|
1386
1429
|
*/
|
|
1387
|
-
|
|
1430
|
+
CdkDropList.prototype.ngOnDestroy = /**
|
|
1388
1431
|
* @return {?}
|
|
1389
1432
|
*/
|
|
1390
1433
|
function () {
|
|
@@ -1395,7 +1438,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1395
1438
|
* Starts dragging an item.
|
|
1396
1439
|
* @return {?}
|
|
1397
1440
|
*/
|
|
1398
|
-
|
|
1441
|
+
CdkDropList.prototype.start = /**
|
|
1399
1442
|
* Starts dragging an item.
|
|
1400
1443
|
* @return {?}
|
|
1401
1444
|
*/
|
|
@@ -1417,7 +1460,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1417
1460
|
* @param {?} previousContainer Container from which the item got dragged in.
|
|
1418
1461
|
* @return {?}
|
|
1419
1462
|
*/
|
|
1420
|
-
|
|
1463
|
+
CdkDropList.prototype.drop = /**
|
|
1421
1464
|
* Drops an item into this container.
|
|
1422
1465
|
* @param {?} item Item being dropped into the container.
|
|
1423
1466
|
* @param {?} currentIndex Index at which the item should be inserted.
|
|
@@ -1448,7 +1491,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1448
1491
|
* @param {?} pointerY Position of the item along the Y axis.
|
|
1449
1492
|
* @return {?}
|
|
1450
1493
|
*/
|
|
1451
|
-
|
|
1494
|
+
CdkDropList.prototype.enter = /**
|
|
1452
1495
|
* Emits an event to indicate that the user moved an item into the container.
|
|
1453
1496
|
* @param {?} item Item that was moved into the container.
|
|
1454
1497
|
* @param {?} pointerX Position of the item along the X axis.
|
|
@@ -1498,7 +1541,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1498
1541
|
* @param {?} item Item that was dragged out.
|
|
1499
1542
|
* @return {?}
|
|
1500
1543
|
*/
|
|
1501
|
-
|
|
1544
|
+
CdkDropList.prototype.exit = /**
|
|
1502
1545
|
* Removes an item from the container after it was dragged into another container by the user.
|
|
1503
1546
|
* @param {?} item Item that was dragged out.
|
|
1504
1547
|
* @return {?}
|
|
@@ -1516,7 +1559,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1516
1559
|
* @param {?} item Item whose index should be determined.
|
|
1517
1560
|
* @return {?}
|
|
1518
1561
|
*/
|
|
1519
|
-
|
|
1562
|
+
CdkDropList.prototype.getItemIndex = /**
|
|
1520
1563
|
* Figures out the index of an item in the container.
|
|
1521
1564
|
* @param {?} item Item whose index should be determined.
|
|
1522
1565
|
* @return {?}
|
|
@@ -1545,7 +1588,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1545
1588
|
* @param {?} pointerDelta
|
|
1546
1589
|
* @return {?}
|
|
1547
1590
|
*/
|
|
1548
|
-
|
|
1591
|
+
CdkDropList.prototype._sortItem = /**
|
|
1549
1592
|
* Sorts an item inside the container based on its position.
|
|
1550
1593
|
* @param {?} item Item to be sorted.
|
|
1551
1594
|
* @param {?} pointerX Position of the item along the X axis.
|
|
@@ -1633,7 +1676,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1633
1676
|
* @param {?} y Position of the item along the Y axis.
|
|
1634
1677
|
* @return {?}
|
|
1635
1678
|
*/
|
|
1636
|
-
|
|
1679
|
+
CdkDropList.prototype._getSiblingContainerFromPosition = /**
|
|
1637
1680
|
* Figures out whether an item should be moved into a sibling
|
|
1638
1681
|
* drop container, based on its current position.
|
|
1639
1682
|
* @param {?} item Drag item that is being moved.
|
|
@@ -1645,7 +1688,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1645
1688
|
/** @type {?} */
|
|
1646
1689
|
var result = this._positionCache.siblings
|
|
1647
1690
|
.find(function (sibling) { return isInsideClientRect(sibling.clientRect, x, y); });
|
|
1648
|
-
return result && result.drop.enterPredicate(item,
|
|
1691
|
+
return result && result.drop.enterPredicate(item, result.drop) ? result.drop : null;
|
|
1649
1692
|
};
|
|
1650
1693
|
/**
|
|
1651
1694
|
* Checks whether an item that started in this container can be returned to it,
|
|
@@ -1662,7 +1705,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1662
1705
|
* @param {?} y Position of the item along the Y axis.
|
|
1663
1706
|
* @return {?}
|
|
1664
1707
|
*/
|
|
1665
|
-
|
|
1708
|
+
CdkDropList.prototype._canReturnItem = /**
|
|
1666
1709
|
* Checks whether an item that started in this container can be returned to it,
|
|
1667
1710
|
* after it was moved out into another container.
|
|
1668
1711
|
* @param {?} item Item that is being checked.
|
|
@@ -1677,7 +1720,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1677
1720
|
* Refreshes the position cache of the items and sibling containers.
|
|
1678
1721
|
* @return {?}
|
|
1679
1722
|
*/
|
|
1680
|
-
|
|
1723
|
+
CdkDropList.prototype._cachePositions = /**
|
|
1681
1724
|
* Refreshes the position cache of the items and sibling containers.
|
|
1682
1725
|
* @return {?}
|
|
1683
1726
|
*/
|
|
@@ -1726,7 +1769,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1726
1769
|
* Resets the container to its initial state.
|
|
1727
1770
|
* @return {?}
|
|
1728
1771
|
*/
|
|
1729
|
-
|
|
1772
|
+
CdkDropList.prototype._reset = /**
|
|
1730
1773
|
* Resets the container to its initial state.
|
|
1731
1774
|
* @return {?}
|
|
1732
1775
|
*/
|
|
@@ -1747,7 +1790,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1747
1790
|
* @param {?} left Amount to add to the `left` position.
|
|
1748
1791
|
* @return {?}
|
|
1749
1792
|
*/
|
|
1750
|
-
|
|
1793
|
+
CdkDropList.prototype._adjustClientRect = /**
|
|
1751
1794
|
* Updates the top/left positions of a `ClientRect`, as well as their bottom/right counterparts.
|
|
1752
1795
|
* @param {?} clientRect `ClientRect` that should be updated.
|
|
1753
1796
|
* @param {?} top Amount to add to the `top` position.
|
|
@@ -1768,7 +1811,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1768
1811
|
* @param {?=} delta Direction in which the user is moving their pointer.
|
|
1769
1812
|
* @return {?}
|
|
1770
1813
|
*/
|
|
1771
|
-
|
|
1814
|
+
CdkDropList.prototype._getItemIndexFromPointerPosition = /**
|
|
1772
1815
|
* Gets the index of an item in the drop container, based on the position of the user's pointer.
|
|
1773
1816
|
* @param {?} item Item that is being sorted.
|
|
1774
1817
|
* @param {?} pointerX Position of the user's pointer along the X axis.
|
|
@@ -1809,7 +1852,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1809
1852
|
* @param {?} pointerY Coordinates along the Y axis.
|
|
1810
1853
|
* @return {?}
|
|
1811
1854
|
*/
|
|
1812
|
-
|
|
1855
|
+
CdkDropList.prototype._isPointerNearDropContainer = /**
|
|
1813
1856
|
* Checks whether the pointer coordinates are close to the drop container.
|
|
1814
1857
|
* @param {?} pointerX Coordinates along the X axis.
|
|
1815
1858
|
* @param {?} pointerY Coordinates along the Y axis.
|
|
@@ -1824,39 +1867,39 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1824
1867
|
return pointerY > top - yThreshold && pointerY < bottom + yThreshold &&
|
|
1825
1868
|
pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
1826
1869
|
};
|
|
1827
|
-
|
|
1870
|
+
CdkDropList.decorators = [
|
|
1828
1871
|
{ type: core.Directive, args: [{
|
|
1829
|
-
selector: '[
|
|
1830
|
-
exportAs: '
|
|
1872
|
+
selector: '[cdkDropList], cdk-drop-list',
|
|
1873
|
+
exportAs: 'cdkDropList',
|
|
1831
1874
|
providers: [
|
|
1832
|
-
{ provide:
|
|
1875
|
+
{ provide: CDK_DROP_LIST_CONTAINER, useExisting: CdkDropList },
|
|
1833
1876
|
],
|
|
1834
1877
|
host: {
|
|
1835
|
-
'class': 'cdk-drop',
|
|
1878
|
+
'class': 'cdk-drop-list',
|
|
1836
1879
|
'[id]': 'id',
|
|
1837
|
-
'[class.cdk-drop-dragging]': '_dragging'
|
|
1880
|
+
'[class.cdk-drop-list-dragging]': '_dragging'
|
|
1838
1881
|
}
|
|
1839
1882
|
},] },
|
|
1840
1883
|
];
|
|
1841
1884
|
/** @nocollapse */
|
|
1842
|
-
|
|
1885
|
+
CdkDropList.ctorParameters = function () { return [
|
|
1843
1886
|
{ type: core.ElementRef },
|
|
1844
1887
|
{ type: DragDropRegistry },
|
|
1845
1888
|
{ type: bidi.Directionality, decorators: [{ type: core.Optional }] }
|
|
1846
1889
|
]; };
|
|
1847
|
-
|
|
1890
|
+
CdkDropList.propDecorators = {
|
|
1848
1891
|
_draggables: [{ type: core.ContentChildren, args: [core.forwardRef(function () { return CdkDrag; }),] }],
|
|
1849
|
-
connectedTo: [{ type: core.Input, args: ['
|
|
1850
|
-
data: [{ type: core.Input, args: ['
|
|
1851
|
-
orientation: [{ type: core.Input, args: ['
|
|
1892
|
+
connectedTo: [{ type: core.Input, args: ['cdkDropListConnectedTo',] }],
|
|
1893
|
+
data: [{ type: core.Input, args: ['cdkDropListData',] }],
|
|
1894
|
+
orientation: [{ type: core.Input, args: ['cdkDropListOrientation',] }],
|
|
1852
1895
|
id: [{ type: core.Input }],
|
|
1853
|
-
lockAxis: [{ type: core.Input, args: ['
|
|
1854
|
-
enterPredicate: [{ type: core.Input, args: ['
|
|
1855
|
-
dropped: [{ type: core.Output, args: ['
|
|
1856
|
-
entered: [{ type: core.Output, args: ['
|
|
1857
|
-
exited: [{ type: core.Output, args: ['
|
|
1896
|
+
lockAxis: [{ type: core.Input, args: ['cdkDropListLockAxis',] }],
|
|
1897
|
+
enterPredicate: [{ type: core.Input, args: ['cdkDropListEnterPredicate',] }],
|
|
1898
|
+
dropped: [{ type: core.Output, args: ['cdkDropListDropped',] }],
|
|
1899
|
+
entered: [{ type: core.Output, args: ['cdkDropListEntered',] }],
|
|
1900
|
+
exited: [{ type: core.Output, args: ['cdkDropListExited',] }]
|
|
1858
1901
|
};
|
|
1859
|
-
return
|
|
1902
|
+
return CdkDropList;
|
|
1860
1903
|
}());
|
|
1861
1904
|
/**
|
|
1862
1905
|
* Finds the index of an item that matches a predicate function. Used as an equivalent
|
|
@@ -1896,14 +1939,14 @@ var DragDropModule = /** @class */ (function () {
|
|
|
1896
1939
|
DragDropModule.decorators = [
|
|
1897
1940
|
{ type: core.NgModule, args: [{
|
|
1898
1941
|
declarations: [
|
|
1899
|
-
|
|
1942
|
+
CdkDropList,
|
|
1900
1943
|
CdkDrag,
|
|
1901
1944
|
CdkDragHandle,
|
|
1902
1945
|
CdkDragPreview,
|
|
1903
1946
|
CdkDragPlaceholder,
|
|
1904
1947
|
],
|
|
1905
1948
|
exports: [
|
|
1906
|
-
|
|
1949
|
+
CdkDropList,
|
|
1907
1950
|
CdkDrag,
|
|
1908
1951
|
CdkDragHandle,
|
|
1909
1952
|
CdkDragPreview,
|
|
@@ -1914,18 +1957,20 @@ var DragDropModule = /** @class */ (function () {
|
|
|
1914
1957
|
return DragDropModule;
|
|
1915
1958
|
}());
|
|
1916
1959
|
|
|
1917
|
-
exports.
|
|
1918
|
-
exports.
|
|
1960
|
+
exports.CdkDropList = CdkDropList;
|
|
1961
|
+
exports.CDK_DROP_LIST_CONTAINER = CDK_DROP_LIST_CONTAINER;
|
|
1919
1962
|
exports.CDK_DRAG_CONFIG_FACTORY = CDK_DRAG_CONFIG_FACTORY;
|
|
1920
1963
|
exports.CDK_DRAG_CONFIG = CDK_DRAG_CONFIG;
|
|
1921
1964
|
exports.CdkDrag = CdkDrag;
|
|
1922
1965
|
exports.CdkDragHandle = CdkDragHandle;
|
|
1923
1966
|
exports.moveItemInArray = moveItemInArray;
|
|
1924
1967
|
exports.transferArrayItem = transferArrayItem;
|
|
1968
|
+
exports.copyArrayItem = copyArrayItem;
|
|
1925
1969
|
exports.CdkDragPreview = CdkDragPreview;
|
|
1926
1970
|
exports.CdkDragPlaceholder = CdkDragPlaceholder;
|
|
1927
1971
|
exports.DragDropModule = DragDropModule;
|
|
1928
1972
|
exports.DragDropRegistry = DragDropRegistry;
|
|
1973
|
+
exports.ɵa = CDK_DRAG_PARENT;
|
|
1929
1974
|
|
|
1930
1975
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1931
1976
|
|