@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
package/esm5/drag-drop.es5.js
CHANGED
|
@@ -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
|
-
var activeEventOptions =
|
|
64
|
+
var 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
|
|
@@ -314,6 +314,18 @@ var DragDropRegistry = /** @class */ (function () {
|
|
|
314
314
|
return DragDropRegistry;
|
|
315
315
|
}());
|
|
316
316
|
|
|
317
|
+
/**
|
|
318
|
+
* @fileoverview added by tsickle
|
|
319
|
+
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
320
|
+
*/
|
|
321
|
+
/** *
|
|
322
|
+
* Injection token that can be used for a `CdkDrag` to provide itself as a parent to the
|
|
323
|
+
* drag-specific child directive (`CdkDragHandle`, `CdkDragPreview` etc.). Used primarily
|
|
324
|
+
* to avoid circular imports.
|
|
325
|
+
* \@docs-private
|
|
326
|
+
@type {?} */
|
|
327
|
+
var CDK_DRAG_PARENT = new InjectionToken('CDK_DRAG_PARENT');
|
|
328
|
+
|
|
317
329
|
/**
|
|
318
330
|
* @fileoverview added by tsickle
|
|
319
331
|
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
@@ -322,8 +334,9 @@ var DragDropRegistry = /** @class */ (function () {
|
|
|
322
334
|
* Handle that can be used to drag and CdkDrag instance.
|
|
323
335
|
*/
|
|
324
336
|
var CdkDragHandle = /** @class */ (function () {
|
|
325
|
-
function CdkDragHandle(element) {
|
|
337
|
+
function CdkDragHandle(element, parentDrag) {
|
|
326
338
|
this.element = element;
|
|
339
|
+
this._parentDrag = parentDrag;
|
|
327
340
|
toggleNativeDragInteractions(element.nativeElement, false);
|
|
328
341
|
}
|
|
329
342
|
CdkDragHandle.decorators = [
|
|
@@ -336,7 +349,8 @@ var CdkDragHandle = /** @class */ (function () {
|
|
|
336
349
|
];
|
|
337
350
|
/** @nocollapse */
|
|
338
351
|
CdkDragHandle.ctorParameters = function () { return [
|
|
339
|
-
{ type: ElementRef }
|
|
352
|
+
{ type: ElementRef },
|
|
353
|
+
{ type: undefined, decorators: [{ type: Inject, args: [CDK_DRAG_PARENT,] }, { type: Optional }] }
|
|
340
354
|
]; };
|
|
341
355
|
return CdkDragHandle;
|
|
342
356
|
}());
|
|
@@ -402,10 +416,10 @@ var CdkDragPreview = /** @class */ (function () {
|
|
|
402
416
|
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
403
417
|
*/
|
|
404
418
|
/** *
|
|
405
|
-
* Injection token that is used to provide a
|
|
419
|
+
* Injection token that is used to provide a CdkDropList instance to CdkDrag.
|
|
406
420
|
* Used for avoiding circular imports.
|
|
407
421
|
@type {?} */
|
|
408
|
-
var
|
|
422
|
+
var CDK_DROP_LIST_CONTAINER = new InjectionToken('CDK_DROP_LIST_CONTAINER');
|
|
409
423
|
|
|
410
424
|
/**
|
|
411
425
|
* @fileoverview added by tsickle
|
|
@@ -477,8 +491,12 @@ var CDK_DRAG_CONFIG = new InjectionToken('CDK_DRAG_CONFIG', {
|
|
|
477
491
|
function CDK_DRAG_CONFIG_FACTORY() {
|
|
478
492
|
return { dragStartThreshold: 5, pointerDirectionChangeThreshold: 5 };
|
|
479
493
|
}
|
|
494
|
+
/** *
|
|
495
|
+
* Options that can be used to bind a passive event listener.
|
|
496
|
+
@type {?} */
|
|
497
|
+
var passiveEventListenerOptions = supportsPassiveEventListeners() ? /** @type {?} */ ({ passive: true }) : false;
|
|
480
498
|
/**
|
|
481
|
-
* Element that can be moved inside a
|
|
499
|
+
* Element that can be moved inside a CdkDropList container.
|
|
482
500
|
* @template T
|
|
483
501
|
*/
|
|
484
502
|
var CdkDrag = /** @class */ (function () {
|
|
@@ -558,10 +576,12 @@ var CdkDrag = /** @class */ (function () {
|
|
|
558
576
|
* Handler for the `mousedown`/`touchstart` events.
|
|
559
577
|
*/
|
|
560
578
|
this._pointerDown = function (event) {
|
|
579
|
+
/** @type {?} */
|
|
580
|
+
var handles = _this._handles.filter(function (handle) { return handle._parentDrag === _this; });
|
|
561
581
|
// Delegate the event based on whether it started from a handle or the element itself.
|
|
562
|
-
if (
|
|
582
|
+
if (handles.length) {
|
|
563
583
|
/** @type {?} */
|
|
564
|
-
var targetHandle =
|
|
584
|
+
var targetHandle = handles.find(function (handle) {
|
|
565
585
|
/** @type {?} */
|
|
566
586
|
var element = handle.element.nativeElement;
|
|
567
587
|
/** @type {?} */
|
|
@@ -587,13 +607,11 @@ var CdkDrag = /** @class */ (function () {
|
|
|
587
607
|
var distanceX = Math.abs(pointerPosition.x - _this._pickupPositionOnPage.x);
|
|
588
608
|
/** @type {?} */
|
|
589
609
|
var distanceY = Math.abs(pointerPosition.y - _this._pickupPositionOnPage.y);
|
|
590
|
-
/** @type {?} */
|
|
591
|
-
var minimumDistance = _this._config.dragStartThreshold;
|
|
592
610
|
// Only start dragging after the user has moved more than the minimum distance in either
|
|
593
611
|
// direction. Note that this is preferrable over doing something like `skip(minimumDistance)`
|
|
594
612
|
// in the `pointerMove` subscription, because we're not guaranteed to have one move event
|
|
595
613
|
// per pixel of movement (e.g. if the user moves their pointer quickly).
|
|
596
|
-
if (distanceX + distanceY >=
|
|
614
|
+
if (distanceX + distanceY >= _this._config.dragStartThreshold) {
|
|
597
615
|
_this._hasStartedDragging = true;
|
|
598
616
|
_this._ngZone.run(function () { return _this._startDragSequence(); });
|
|
599
617
|
}
|
|
@@ -612,7 +630,11 @@ var CdkDrag = /** @class */ (function () {
|
|
|
612
630
|
pointerPosition.x - _this._pickupPositionOnPage.x + _this._passiveTransform.x;
|
|
613
631
|
activeTransform.y =
|
|
614
632
|
pointerPosition.y - _this._pickupPositionOnPage.y + _this._passiveTransform.y;
|
|
615
|
-
|
|
633
|
+
/** @type {?} */
|
|
634
|
+
var transform = getTransform(activeTransform.x, activeTransform.y);
|
|
635
|
+
// Preserve the previous `transform` value, if there was one.
|
|
636
|
+
_this._rootElement.style.transform = _this._initialTransform ?
|
|
637
|
+
_this._initialTransform + ' ' + transform : transform;
|
|
616
638
|
}
|
|
617
639
|
// Since this event gets fired for every pixel while dragging, we only
|
|
618
640
|
// want to fire it if the consumer opted into it. Also we have to
|
|
@@ -698,8 +720,8 @@ var CdkDrag = /** @class */ (function () {
|
|
|
698
720
|
this._ngZone.onStable.asObservable().pipe(take(1)).subscribe(function () {
|
|
699
721
|
/** @type {?} */
|
|
700
722
|
var rootElement = _this._rootElement = _this._getRootElement();
|
|
701
|
-
rootElement.addEventListener('mousedown', _this._pointerDown);
|
|
702
|
-
rootElement.addEventListener('touchstart', _this._pointerDown);
|
|
723
|
+
rootElement.addEventListener('mousedown', _this._pointerDown, passiveEventListenerOptions);
|
|
724
|
+
rootElement.addEventListener('touchstart', _this._pointerDown, passiveEventListenerOptions);
|
|
703
725
|
toggleNativeDragInteractions(rootElement, false);
|
|
704
726
|
});
|
|
705
727
|
};
|
|
@@ -710,8 +732,8 @@ var CdkDrag = /** @class */ (function () {
|
|
|
710
732
|
* @return {?}
|
|
711
733
|
*/
|
|
712
734
|
function () {
|
|
713
|
-
this._rootElement.removeEventListener('mousedown', this._pointerDown);
|
|
714
|
-
this._rootElement.removeEventListener('touchstart', this._pointerDown);
|
|
735
|
+
this._rootElement.removeEventListener('mousedown', this._pointerDown, passiveEventListenerOptions);
|
|
736
|
+
this._rootElement.removeEventListener('touchstart', this._pointerDown, passiveEventListenerOptions);
|
|
715
737
|
this._destroyPreview();
|
|
716
738
|
this._destroyPlaceholder();
|
|
717
739
|
// Do this check before removing from the registry since it'll
|
|
@@ -759,6 +781,11 @@ var CdkDrag = /** @class */ (function () {
|
|
|
759
781
|
if (isDragging || (!this._isTouchEvent(event) && event.button !== 0)) {
|
|
760
782
|
return;
|
|
761
783
|
}
|
|
784
|
+
// Cache the previous transform amount only after the first drag sequence, because
|
|
785
|
+
// we don't want our own transforms to stack on top of each other.
|
|
786
|
+
if (this._initialTransform == null) {
|
|
787
|
+
this._initialTransform = this._rootElement.style.transform || '';
|
|
788
|
+
}
|
|
762
789
|
this._hasStartedDragging = this._hasMoved = false;
|
|
763
790
|
this._initialContainer = this.dropContainer;
|
|
764
791
|
this._pointerMoveSubscription = this._dragDropRegistry.pointerMove.subscribe(this._pointerMove);
|
|
@@ -880,7 +907,8 @@ var CdkDrag = /** @class */ (function () {
|
|
|
880
907
|
});
|
|
881
908
|
}
|
|
882
909
|
this.dropContainer._sortItem(this, x, y, this._pointerDirectionDelta);
|
|
883
|
-
this.
|
|
910
|
+
this._preview.style.transform =
|
|
911
|
+
getTransform(x - this._pickupPositionInElement.x, y - this._pickupPositionInElement.y);
|
|
884
912
|
};
|
|
885
913
|
/**
|
|
886
914
|
* Creates the element that will be rendered next to the user's pointer
|
|
@@ -900,7 +928,8 @@ var CdkDrag = /** @class */ (function () {
|
|
|
900
928
|
var viewRef = this._viewContainerRef.createEmbeddedView(this._previewTemplate.templateRef, this._previewTemplate.data);
|
|
901
929
|
preview = viewRef.rootNodes[0];
|
|
902
930
|
this._previewRef = viewRef;
|
|
903
|
-
|
|
931
|
+
preview.style.transform =
|
|
932
|
+
getTransform(this._pickupPositionOnPage.x, this._pickupPositionOnPage.y);
|
|
904
933
|
}
|
|
905
934
|
else {
|
|
906
935
|
/** @type {?} */
|
|
@@ -910,7 +939,7 @@ var CdkDrag = /** @class */ (function () {
|
|
|
910
939
|
preview = /** @type {?} */ (element.cloneNode(true));
|
|
911
940
|
preview.style.width = elementRect.width + "px";
|
|
912
941
|
preview.style.height = elementRect.height + "px";
|
|
913
|
-
|
|
942
|
+
preview.style.transform = getTransform(elementRect.left, elementRect.top);
|
|
914
943
|
}
|
|
915
944
|
extendStyles(preview.style, {
|
|
916
945
|
position: 'fixed',
|
|
@@ -992,7 +1021,7 @@ var CdkDrag = /** @class */ (function () {
|
|
|
992
1021
|
// Apply the class that adds a transition to the preview.
|
|
993
1022
|
this._preview.classList.add('cdk-drag-animating');
|
|
994
1023
|
// Move the preview to the placeholder position.
|
|
995
|
-
this.
|
|
1024
|
+
this._preview.style.transform = getTransform(placeholderRect.left, placeholderRect.top);
|
|
996
1025
|
/** @type {?} */
|
|
997
1026
|
var duration = getTransformTransitionDurationInMs(this._preview);
|
|
998
1027
|
if (duration === 0) {
|
|
@@ -1014,23 +1043,6 @@ var CdkDrag = /** @class */ (function () {
|
|
|
1014
1043
|
});
|
|
1015
1044
|
});
|
|
1016
1045
|
};
|
|
1017
|
-
/**
|
|
1018
|
-
* Sets the `transform` style on an element.
|
|
1019
|
-
* @param {?} element Element on which to set the transform.
|
|
1020
|
-
* @param {?} x Desired position of the element along the X axis.
|
|
1021
|
-
* @param {?} y Desired position of the element along the Y axis.
|
|
1022
|
-
* @return {?}
|
|
1023
|
-
*/
|
|
1024
|
-
CdkDrag.prototype._setTransform = /**
|
|
1025
|
-
* Sets the `transform` style on an element.
|
|
1026
|
-
* @param {?} element Element on which to set the transform.
|
|
1027
|
-
* @param {?} x Desired position of the element along the X axis.
|
|
1028
|
-
* @param {?} y Desired position of the element along the Y axis.
|
|
1029
|
-
* @return {?}
|
|
1030
|
-
*/
|
|
1031
|
-
function (element, x, y) {
|
|
1032
|
-
element.style.transform = "translate3d(" + x + "px, " + y + "px, 0)";
|
|
1033
|
-
};
|
|
1034
1046
|
/**
|
|
1035
1047
|
* Helper to remove an element from the DOM and to do all the necessary null checks.
|
|
1036
1048
|
* @param {?} element Element to be removed.
|
|
@@ -1212,13 +1224,17 @@ var CdkDrag = /** @class */ (function () {
|
|
|
1212
1224
|
host: {
|
|
1213
1225
|
'class': 'cdk-drag',
|
|
1214
1226
|
'[class.cdk-drag-dragging]': '_hasStartedDragging && _isDragging()',
|
|
1215
|
-
}
|
|
1227
|
+
},
|
|
1228
|
+
providers: [{
|
|
1229
|
+
provide: CDK_DRAG_PARENT,
|
|
1230
|
+
useExisting: CdkDrag
|
|
1231
|
+
}]
|
|
1216
1232
|
},] },
|
|
1217
1233
|
];
|
|
1218
1234
|
/** @nocollapse */
|
|
1219
1235
|
CdkDrag.ctorParameters = function () { return [
|
|
1220
1236
|
{ type: ElementRef },
|
|
1221
|
-
{ type: undefined, decorators: [{ type: Inject, args: [
|
|
1237
|
+
{ type: undefined, decorators: [{ type: Inject, args: [CDK_DROP_LIST_CONTAINER,] }, { type: Optional }, { type: SkipSelf }] },
|
|
1222
1238
|
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
|
1223
1239
|
{ type: NgZone },
|
|
1224
1240
|
{ type: ViewContainerRef },
|
|
@@ -1228,7 +1244,7 @@ var CdkDrag = /** @class */ (function () {
|
|
|
1228
1244
|
{ type: Directionality, decorators: [{ type: Optional }] }
|
|
1229
1245
|
]; };
|
|
1230
1246
|
CdkDrag.propDecorators = {
|
|
1231
|
-
_handles: [{ type: ContentChildren, args: [CdkDragHandle,] }],
|
|
1247
|
+
_handles: [{ type: ContentChildren, args: [CdkDragHandle, { descendants: true },] }],
|
|
1232
1248
|
_previewTemplate: [{ type: ContentChild, args: [CdkDragPreview,] }],
|
|
1233
1249
|
_placeholderTemplate: [{ type: ContentChild, args: [CdkDragPlaceholder,] }],
|
|
1234
1250
|
data: [{ type: Input, args: ['cdkDragData',] }],
|
|
@@ -1243,6 +1259,15 @@ var CdkDrag = /** @class */ (function () {
|
|
|
1243
1259
|
};
|
|
1244
1260
|
return CdkDrag;
|
|
1245
1261
|
}());
|
|
1262
|
+
/**
|
|
1263
|
+
* Gets a 3d `transform` that can be applied to an element.
|
|
1264
|
+
* @param {?} x Desired position of the element along the X axis.
|
|
1265
|
+
* @param {?} y Desired position of the element along the Y axis.
|
|
1266
|
+
* @return {?}
|
|
1267
|
+
*/
|
|
1268
|
+
function getTransform(x, y) {
|
|
1269
|
+
return "translate3d(" + x + "px, " + y + "px, 0)";
|
|
1270
|
+
}
|
|
1246
1271
|
|
|
1247
1272
|
/**
|
|
1248
1273
|
* @fileoverview added by tsickle
|
|
@@ -1292,6 +1317,24 @@ function transferArrayItem(currentArray, targetArray, currentIndex, targetIndex)
|
|
|
1292
1317
|
targetArray.splice(to, 0, currentArray.splice(from, 1)[0]);
|
|
1293
1318
|
}
|
|
1294
1319
|
}
|
|
1320
|
+
/**
|
|
1321
|
+
* Copies an item from one array to another, leaving it in its
|
|
1322
|
+
* original position in current array.
|
|
1323
|
+
* @template T
|
|
1324
|
+
* @param {?} currentArray Array from which to copy the item.
|
|
1325
|
+
* @param {?} targetArray Array into which is copy the item.
|
|
1326
|
+
* @param {?} currentIndex Index of the item in its current array.
|
|
1327
|
+
* @param {?} targetIndex Index at which to insert the item.
|
|
1328
|
+
*
|
|
1329
|
+
* @return {?}
|
|
1330
|
+
*/
|
|
1331
|
+
function copyArrayItem(currentArray, targetArray, currentIndex, targetIndex) {
|
|
1332
|
+
/** @type {?} */
|
|
1333
|
+
var to = clamp(targetIndex, targetArray.length);
|
|
1334
|
+
if (currentArray.length) {
|
|
1335
|
+
targetArray.splice(to, 0, currentArray[currentIndex]);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1295
1338
|
/**
|
|
1296
1339
|
* Clamps a number between zero and a maximum.
|
|
1297
1340
|
* @param {?} value
|
|
@@ -1319,8 +1362,8 @@ var DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
|
1319
1362
|
* Container that wraps a set of draggable items.
|
|
1320
1363
|
* @template T
|
|
1321
1364
|
*/
|
|
1322
|
-
var
|
|
1323
|
-
function
|
|
1365
|
+
var CdkDropList = /** @class */ (function () {
|
|
1366
|
+
function CdkDropList(element, _dragDropRegistry, _dir) {
|
|
1324
1367
|
this.element = element;
|
|
1325
1368
|
this._dragDropRegistry = _dragDropRegistry;
|
|
1326
1369
|
this._dir = _dir;
|
|
@@ -1336,9 +1379,9 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1336
1379
|
this.orientation = 'vertical';
|
|
1337
1380
|
/**
|
|
1338
1381
|
* Unique ID for the drop zone. Can be used as a reference
|
|
1339
|
-
* in the `connectedTo` of another `
|
|
1382
|
+
* in the `connectedTo` of another `CdkDropList`.
|
|
1340
1383
|
*/
|
|
1341
|
-
this.id = "cdk-drop-" + _uniqueIdCounter++;
|
|
1384
|
+
this.id = "cdk-drop-list-" + _uniqueIdCounter++;
|
|
1342
1385
|
/**
|
|
1343
1386
|
* Function that is used to determine whether an item
|
|
1344
1387
|
* is allowed to be moved into a drop container.
|
|
@@ -1378,7 +1421,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1378
1421
|
/**
|
|
1379
1422
|
* @return {?}
|
|
1380
1423
|
*/
|
|
1381
|
-
|
|
1424
|
+
CdkDropList.prototype.ngOnInit = /**
|
|
1382
1425
|
* @return {?}
|
|
1383
1426
|
*/
|
|
1384
1427
|
function () {
|
|
@@ -1387,7 +1430,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1387
1430
|
/**
|
|
1388
1431
|
* @return {?}
|
|
1389
1432
|
*/
|
|
1390
|
-
|
|
1433
|
+
CdkDropList.prototype.ngOnDestroy = /**
|
|
1391
1434
|
* @return {?}
|
|
1392
1435
|
*/
|
|
1393
1436
|
function () {
|
|
@@ -1398,7 +1441,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1398
1441
|
* Starts dragging an item.
|
|
1399
1442
|
* @return {?}
|
|
1400
1443
|
*/
|
|
1401
|
-
|
|
1444
|
+
CdkDropList.prototype.start = /**
|
|
1402
1445
|
* Starts dragging an item.
|
|
1403
1446
|
* @return {?}
|
|
1404
1447
|
*/
|
|
@@ -1420,7 +1463,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1420
1463
|
* @param {?} previousContainer Container from which the item got dragged in.
|
|
1421
1464
|
* @return {?}
|
|
1422
1465
|
*/
|
|
1423
|
-
|
|
1466
|
+
CdkDropList.prototype.drop = /**
|
|
1424
1467
|
* Drops an item into this container.
|
|
1425
1468
|
* @param {?} item Item being dropped into the container.
|
|
1426
1469
|
* @param {?} currentIndex Index at which the item should be inserted.
|
|
@@ -1451,7 +1494,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1451
1494
|
* @param {?} pointerY Position of the item along the Y axis.
|
|
1452
1495
|
* @return {?}
|
|
1453
1496
|
*/
|
|
1454
|
-
|
|
1497
|
+
CdkDropList.prototype.enter = /**
|
|
1455
1498
|
* Emits an event to indicate that the user moved an item into the container.
|
|
1456
1499
|
* @param {?} item Item that was moved into the container.
|
|
1457
1500
|
* @param {?} pointerX Position of the item along the X axis.
|
|
@@ -1501,7 +1544,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1501
1544
|
* @param {?} item Item that was dragged out.
|
|
1502
1545
|
* @return {?}
|
|
1503
1546
|
*/
|
|
1504
|
-
|
|
1547
|
+
CdkDropList.prototype.exit = /**
|
|
1505
1548
|
* Removes an item from the container after it was dragged into another container by the user.
|
|
1506
1549
|
* @param {?} item Item that was dragged out.
|
|
1507
1550
|
* @return {?}
|
|
@@ -1519,7 +1562,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1519
1562
|
* @param {?} item Item whose index should be determined.
|
|
1520
1563
|
* @return {?}
|
|
1521
1564
|
*/
|
|
1522
|
-
|
|
1565
|
+
CdkDropList.prototype.getItemIndex = /**
|
|
1523
1566
|
* Figures out the index of an item in the container.
|
|
1524
1567
|
* @param {?} item Item whose index should be determined.
|
|
1525
1568
|
* @return {?}
|
|
@@ -1548,7 +1591,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1548
1591
|
* @param {?} pointerDelta
|
|
1549
1592
|
* @return {?}
|
|
1550
1593
|
*/
|
|
1551
|
-
|
|
1594
|
+
CdkDropList.prototype._sortItem = /**
|
|
1552
1595
|
* Sorts an item inside the container based on its position.
|
|
1553
1596
|
* @param {?} item Item to be sorted.
|
|
1554
1597
|
* @param {?} pointerX Position of the item along the X axis.
|
|
@@ -1636,7 +1679,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1636
1679
|
* @param {?} y Position of the item along the Y axis.
|
|
1637
1680
|
* @return {?}
|
|
1638
1681
|
*/
|
|
1639
|
-
|
|
1682
|
+
CdkDropList.prototype._getSiblingContainerFromPosition = /**
|
|
1640
1683
|
* Figures out whether an item should be moved into a sibling
|
|
1641
1684
|
* drop container, based on its current position.
|
|
1642
1685
|
* @param {?} item Drag item that is being moved.
|
|
@@ -1648,7 +1691,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1648
1691
|
/** @type {?} */
|
|
1649
1692
|
var result = this._positionCache.siblings
|
|
1650
1693
|
.find(function (sibling) { return isInsideClientRect(sibling.clientRect, x, y); });
|
|
1651
|
-
return result && result.drop.enterPredicate(item,
|
|
1694
|
+
return result && result.drop.enterPredicate(item, result.drop) ? result.drop : null;
|
|
1652
1695
|
};
|
|
1653
1696
|
/**
|
|
1654
1697
|
* Checks whether an item that started in this container can be returned to it,
|
|
@@ -1665,7 +1708,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1665
1708
|
* @param {?} y Position of the item along the Y axis.
|
|
1666
1709
|
* @return {?}
|
|
1667
1710
|
*/
|
|
1668
|
-
|
|
1711
|
+
CdkDropList.prototype._canReturnItem = /**
|
|
1669
1712
|
* Checks whether an item that started in this container can be returned to it,
|
|
1670
1713
|
* after it was moved out into another container.
|
|
1671
1714
|
* @param {?} item Item that is being checked.
|
|
@@ -1680,7 +1723,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1680
1723
|
* Refreshes the position cache of the items and sibling containers.
|
|
1681
1724
|
* @return {?}
|
|
1682
1725
|
*/
|
|
1683
|
-
|
|
1726
|
+
CdkDropList.prototype._cachePositions = /**
|
|
1684
1727
|
* Refreshes the position cache of the items and sibling containers.
|
|
1685
1728
|
* @return {?}
|
|
1686
1729
|
*/
|
|
@@ -1729,7 +1772,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1729
1772
|
* Resets the container to its initial state.
|
|
1730
1773
|
* @return {?}
|
|
1731
1774
|
*/
|
|
1732
|
-
|
|
1775
|
+
CdkDropList.prototype._reset = /**
|
|
1733
1776
|
* Resets the container to its initial state.
|
|
1734
1777
|
* @return {?}
|
|
1735
1778
|
*/
|
|
@@ -1750,7 +1793,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1750
1793
|
* @param {?} left Amount to add to the `left` position.
|
|
1751
1794
|
* @return {?}
|
|
1752
1795
|
*/
|
|
1753
|
-
|
|
1796
|
+
CdkDropList.prototype._adjustClientRect = /**
|
|
1754
1797
|
* Updates the top/left positions of a `ClientRect`, as well as their bottom/right counterparts.
|
|
1755
1798
|
* @param {?} clientRect `ClientRect` that should be updated.
|
|
1756
1799
|
* @param {?} top Amount to add to the `top` position.
|
|
@@ -1771,7 +1814,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1771
1814
|
* @param {?=} delta Direction in which the user is moving their pointer.
|
|
1772
1815
|
* @return {?}
|
|
1773
1816
|
*/
|
|
1774
|
-
|
|
1817
|
+
CdkDropList.prototype._getItemIndexFromPointerPosition = /**
|
|
1775
1818
|
* Gets the index of an item in the drop container, based on the position of the user's pointer.
|
|
1776
1819
|
* @param {?} item Item that is being sorted.
|
|
1777
1820
|
* @param {?} pointerX Position of the user's pointer along the X axis.
|
|
@@ -1812,7 +1855,7 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1812
1855
|
* @param {?} pointerY Coordinates along the Y axis.
|
|
1813
1856
|
* @return {?}
|
|
1814
1857
|
*/
|
|
1815
|
-
|
|
1858
|
+
CdkDropList.prototype._isPointerNearDropContainer = /**
|
|
1816
1859
|
* Checks whether the pointer coordinates are close to the drop container.
|
|
1817
1860
|
* @param {?} pointerX Coordinates along the X axis.
|
|
1818
1861
|
* @param {?} pointerY Coordinates along the Y axis.
|
|
@@ -1827,39 +1870,39 @@ var CdkDrop = /** @class */ (function () {
|
|
|
1827
1870
|
return pointerY > top - yThreshold && pointerY < bottom + yThreshold &&
|
|
1828
1871
|
pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
1829
1872
|
};
|
|
1830
|
-
|
|
1873
|
+
CdkDropList.decorators = [
|
|
1831
1874
|
{ type: Directive, args: [{
|
|
1832
|
-
selector: '[
|
|
1833
|
-
exportAs: '
|
|
1875
|
+
selector: '[cdkDropList], cdk-drop-list',
|
|
1876
|
+
exportAs: 'cdkDropList',
|
|
1834
1877
|
providers: [
|
|
1835
|
-
{ provide:
|
|
1878
|
+
{ provide: CDK_DROP_LIST_CONTAINER, useExisting: CdkDropList },
|
|
1836
1879
|
],
|
|
1837
1880
|
host: {
|
|
1838
|
-
'class': 'cdk-drop',
|
|
1881
|
+
'class': 'cdk-drop-list',
|
|
1839
1882
|
'[id]': 'id',
|
|
1840
|
-
'[class.cdk-drop-dragging]': '_dragging'
|
|
1883
|
+
'[class.cdk-drop-list-dragging]': '_dragging'
|
|
1841
1884
|
}
|
|
1842
1885
|
},] },
|
|
1843
1886
|
];
|
|
1844
1887
|
/** @nocollapse */
|
|
1845
|
-
|
|
1888
|
+
CdkDropList.ctorParameters = function () { return [
|
|
1846
1889
|
{ type: ElementRef },
|
|
1847
1890
|
{ type: DragDropRegistry },
|
|
1848
1891
|
{ type: Directionality, decorators: [{ type: Optional }] }
|
|
1849
1892
|
]; };
|
|
1850
|
-
|
|
1893
|
+
CdkDropList.propDecorators = {
|
|
1851
1894
|
_draggables: [{ type: ContentChildren, args: [forwardRef(function () { return CdkDrag; }),] }],
|
|
1852
|
-
connectedTo: [{ type: Input, args: ['
|
|
1853
|
-
data: [{ type: Input, args: ['
|
|
1854
|
-
orientation: [{ type: Input, args: ['
|
|
1895
|
+
connectedTo: [{ type: Input, args: ['cdkDropListConnectedTo',] }],
|
|
1896
|
+
data: [{ type: Input, args: ['cdkDropListData',] }],
|
|
1897
|
+
orientation: [{ type: Input, args: ['cdkDropListOrientation',] }],
|
|
1855
1898
|
id: [{ type: Input }],
|
|
1856
|
-
lockAxis: [{ type: Input, args: ['
|
|
1857
|
-
enterPredicate: [{ type: Input, args: ['
|
|
1858
|
-
dropped: [{ type: Output, args: ['
|
|
1859
|
-
entered: [{ type: Output, args: ['
|
|
1860
|
-
exited: [{ type: Output, args: ['
|
|
1899
|
+
lockAxis: [{ type: Input, args: ['cdkDropListLockAxis',] }],
|
|
1900
|
+
enterPredicate: [{ type: Input, args: ['cdkDropListEnterPredicate',] }],
|
|
1901
|
+
dropped: [{ type: Output, args: ['cdkDropListDropped',] }],
|
|
1902
|
+
entered: [{ type: Output, args: ['cdkDropListEntered',] }],
|
|
1903
|
+
exited: [{ type: Output, args: ['cdkDropListExited',] }]
|
|
1861
1904
|
};
|
|
1862
|
-
return
|
|
1905
|
+
return CdkDropList;
|
|
1863
1906
|
}());
|
|
1864
1907
|
/**
|
|
1865
1908
|
* Finds the index of an item that matches a predicate function. Used as an equivalent
|
|
@@ -1899,14 +1942,14 @@ var DragDropModule = /** @class */ (function () {
|
|
|
1899
1942
|
DragDropModule.decorators = [
|
|
1900
1943
|
{ type: NgModule, args: [{
|
|
1901
1944
|
declarations: [
|
|
1902
|
-
|
|
1945
|
+
CdkDropList,
|
|
1903
1946
|
CdkDrag,
|
|
1904
1947
|
CdkDragHandle,
|
|
1905
1948
|
CdkDragPreview,
|
|
1906
1949
|
CdkDragPlaceholder,
|
|
1907
1950
|
],
|
|
1908
1951
|
exports: [
|
|
1909
|
-
|
|
1952
|
+
CdkDropList,
|
|
1910
1953
|
CdkDrag,
|
|
1911
1954
|
CdkDragHandle,
|
|
1912
1955
|
CdkDragPreview,
|
|
@@ -1927,5 +1970,5 @@ var DragDropModule = /** @class */ (function () {
|
|
|
1927
1970
|
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1928
1971
|
*/
|
|
1929
1972
|
|
|
1930
|
-
export {
|
|
1973
|
+
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 };
|
|
1931
1974
|
//# sourceMappingURL=drag-drop.es5.js.map
|