From 51349b7e5171b4a7fae27f129d91c18c6b0f03bd Mon Sep 17 00:00:00 2001 From: crisbeto Date: Tue, 17 Sep 2019 21:27:38 +0200 Subject: [PATCH] refactor(drag-drop): remove deprecated APIs for 9.0.0 Cleans on the APIs that were marked as deprecated for 8.0 and 9.0. Also deprecates a few for 10.0 which were supposed to be removed in 9.0, but hadn't been marked correctly. BREAKING CHANGES: * `DropListRef.id` has been removed. * `CdkDragConfig` has been replaced with `DragRefConfig`. * `DragDropRegistry.getDropContainer` has been removed. * `CdkDropListContainer` interface has been removed. * `CDK_DROP_LIST_CONTAINER` has been replaced with `CDK_DROP_LIST`. * `CdkDrag.boundaryElementSelector` has been replaced with `CdkDrag.boundaryElement`. * `_ngZone` and `_viewportRuler` parameters in the `DropListRef` constructor are now required. * `distance` parameter in `DropListRef.drop` is now required. --- src/cdk/drag-drop/directives/drag.ts | 21 ++--- src/cdk/drag-drop/directives/drop-list.ts | 69 +++++--------- src/cdk/drag-drop/drag-drop-registry.spec.ts | 4 - src/cdk/drag-drop/drag-drop-registry.ts | 15 +-- src/cdk/drag-drop/drop-list-container.ts | 92 ------------------- src/cdk/drag-drop/drop-list-ref.ts | 45 ++------- src/cdk/drag-drop/public-api.ts | 9 -- .../schematics/ng-update/data/class-names.ts | 9 ++ .../ng-update/data/constructor-checks.ts | 4 + .../ng-update/data/method-call-checks.ts | 10 ++ .../ng-update/data/property-names.ts | 9 ++ tools/public_api_guard/cdk/drag-drop.d.ts | 50 ++-------- 12 files changed, 73 insertions(+), 264 deletions(-) delete mode 100644 src/cdk/drag-drop/drop-list-container.ts diff --git a/src/cdk/drag-drop/directives/drag.ts b/src/cdk/drag-drop/directives/drag.ts index 92b9c0de7cc5..9c028f842868 100644 --- a/src/cdk/drag-drop/directives/drag.ts +++ b/src/cdk/drag-drop/directives/drag.ts @@ -45,12 +45,17 @@ import { import {CdkDragHandle} from './drag-handle'; import {CdkDragPlaceholder} from './drag-placeholder'; import {CdkDragPreview} from './drag-preview'; -import {CDK_DROP_LIST} from '../drop-list-container'; import {CDK_DRAG_PARENT} from '../drag-parent'; import {DragRef, DragRefConfig, Point} from '../drag-ref'; import {CdkDropListInternal as CdkDropList} from './drop-list'; import {DragDrop} from '../drag-drop'; +/** + * Injection token that is used to provide a CdkDropList instance to CdkDrag. + * Used for avoiding circular imports. + */ +export const CDK_DROP_LIST = new InjectionToken('CDK_DROP_LIST'); + /** Injection token that can be used to configure the behavior of `CdkDrag`. */ export const CDK_DRAG_CONFIG = new InjectionToken('CDK_DRAG_CONFIG', { providedIn: 'root', @@ -109,20 +114,6 @@ export class CdkDrag implements AfterViewInit, OnChanges, OnDestroy { */ @Input('cdkDragBoundary') boundaryElement: string | ElementRef | HTMLElement; - /** - * Selector that will be used to determine the element to which the draggable's position will - * be constrained. Matching starts from the element's parent and goes up the DOM until a matching - * element has been found - * @deprecated Use `boundaryElement` instead. - * @breaking-change 9.0.0 - */ - get boundaryElementSelector(): string { - return typeof this.boundaryElement === 'string' ? this.boundaryElement : undefined!; - } - set boundaryElementSelector(selector: string) { - this.boundaryElement = selector; - } - /** * Amount of milliseconds to wait after the user has put their * pointer down before starting to drag the element. diff --git a/src/cdk/drag-drop/directives/drop-list.ts b/src/cdk/drag-drop/directives/drop-list.ts index c62a38cb8a5c..ffc629ce19aa 100644 --- a/src/cdk/drag-drop/directives/drop-list.ts +++ b/src/cdk/drag-drop/directives/drop-list.ts @@ -11,7 +11,6 @@ import { ContentChildren, ElementRef, EventEmitter, - forwardRef, Input, OnDestroy, Output, @@ -23,9 +22,8 @@ import { AfterContentInit, } from '@angular/core'; import {Directionality} from '@angular/cdk/bidi'; -import {CdkDrag} from './drag'; +import {CdkDrag, CDK_DROP_LIST} from './drag'; import {CdkDragDrop, CdkDragEnter, CdkDragExit, CdkDragSortEvent} from '../drag-events'; -import {CDK_DROP_LIST_CONTAINER, CdkDropListContainer} from '../drop-list-container'; import {CdkDropListGroup} from './drop-list-group'; import {DropListRef} from '../drop-list-ref'; import {DragRef} from '../drag-ref'; @@ -43,10 +41,6 @@ let _uniqueIdCounter = 0; */ export interface CdkDropListInternal extends CdkDropList {} -// @breaking-change 8.0.0 `CdkDropList` implements `CdkDropListContainer` for backwards -// compatiblity. The implements clause, as well as all the methods that it enforces can -// be removed when `CdkDropListContainer` is deleted. - /** Container that wraps a set of draggable items. */ @Directive({ selector: '[cdkDropList], cdk-drop-list', @@ -54,7 +48,7 @@ export interface CdkDropListInternal extends CdkDropList {} providers: [ // Prevent child drop lists from picking up the same group as their parent. {provide: CdkDropListGroup, useValue: undefined}, - {provide: CDK_DROP_LIST_CONTAINER, useExisting: CdkDropList}, + {provide: CDK_DROP_LIST, useExisting: CdkDropList}, ], host: { 'class': 'cdk-drop-list', @@ -64,7 +58,7 @@ export interface CdkDropListInternal extends CdkDropList {} '[class.cdk-drop-list-receiving]': '_dropListRef.isReceiving()', } }) -export class CdkDropList implements CdkDropListContainer, AfterContentInit, OnDestroy { +export class CdkDropList implements AfterContentInit, OnDestroy { /** Emits when the list has been destroyed. */ private _destroyed = new Subject(); @@ -75,7 +69,7 @@ export class CdkDropList implements CdkDropListContainer, AfterContentI _dropListRef: DropListRef>; /** Draggable items in the container. */ - @ContentChildren(forwardRef(() => CdkDrag), { + @ContentChildren(CdkDrag, { // Explicitly set to false since some of the logic below makes assumptions about it. // The `.withItems` call below should be updated if we ever need to switch this to `true`. descendants: false @@ -198,7 +192,11 @@ export class CdkDropList implements CdkDropListContainer, AfterContentI this._destroyed.complete(); } - /** Starts dragging an item. */ + /** + * Starts dragging an item. + * @deprecated No longer being used. To be removed. + * @breaking-change 10.0.0 + */ start(): void { this._dropListRef.start(); } @@ -210,11 +208,14 @@ export class CdkDropList implements CdkDropListContainer, AfterContentI * @param previousContainer Container from which the item got dragged in. * @param isPointerOverContainer Whether the user's pointer was over the * container when the item was dropped. + * + * @deprecated No longer being used. To be removed. + * @breaking-change 10.0.0 */ - drop(item: CdkDrag, currentIndex: number, previousContainer: Partial, + drop(item: CdkDrag, currentIndex: number, previousContainer: CdkDropList, isPointerOverContainer: boolean): void { - this._dropListRef.drop(item._dragRef, currentIndex, - (previousContainer as CdkDropList)._dropListRef, isPointerOverContainer); + this._dropListRef.drop(item._dragRef, currentIndex, previousContainer._dropListRef, + isPointerOverContainer, {x: 0, y: 0}); } /** @@ -222,6 +223,8 @@ export class CdkDropList implements CdkDropListContainer, AfterContentI * @param item Item that was moved into the container. * @param pointerX Position of the item along the X axis. * @param pointerY Position of the item along the Y axis. + * @deprecated No longer being used. To be removed. + * @breaking-change 10.0.0 */ enter(item: CdkDrag, pointerX: number, pointerY: number): void { this._dropListRef.enter(item._dragRef, pointerX, pointerY); @@ -230,6 +233,8 @@ export class CdkDropList implements CdkDropListContainer, AfterContentI /** * Removes an item from the container after it was dragged into another container by the user. * @param item Item that was dragged out. + * @deprecated No longer being used. To be removed. + * @breaking-change 10.0.0 */ exit(item: CdkDrag): void { this._dropListRef.exit(item._dragRef); @@ -238,45 +243,13 @@ export class CdkDropList implements CdkDropListContainer, AfterContentI /** * Figures out the index of an item in the container. * @param item Item whose index should be determined. + * @deprecated No longer being used. To be removed. + * @breaking-change 10.0.0 */ getItemIndex(item: CdkDrag): number { return this._dropListRef.getItemIndex(item._dragRef); } - /** - * Sorts an item inside the container based on its position. - * @param item Item to be sorted. - * @param pointerX Position of the item along the X axis. - * @param pointerY Position of the item along the Y axis. - * @param pointerDelta Direction in which the pointer is moving along each axis. - */ - _sortItem(item: CdkDrag, pointerX: number, pointerY: number, - pointerDelta: {x: number, y: number}): void { - return this._dropListRef._sortItem(item._dragRef, pointerX, pointerY, pointerDelta); - } - - /** - * Figures out whether an item should be moved into a sibling - * drop container, based on its current position. - * @param item Drag item that is being moved. - * @param x Position of the item along the X axis. - * @param y Position of the item along the Y axis. - */ - _getSiblingContainerFromPosition(item: CdkDrag, x: number, y: number): - CdkDropListContainer | null { - const result = this._dropListRef._getSiblingContainerFromPosition(item._dragRef, x, y); - return result ? result.data : null; - } - - /** - * Checks whether the user's pointer is positioned over the container. - * @param x Pointer position along the X axis. - * @param y Pointer position along the Y axis. - */ - _isOverContainer(x: number, y: number): boolean { - return this._dropListRef._isOverContainer(x, y); - } - /** Syncs the inputs of the CdkDropList with the options of the underlying DropListRef. */ private _syncInputs(ref: DropListRef) { if (this._dir) { diff --git a/src/cdk/drag-drop/drag-drop-registry.spec.ts b/src/cdk/drag-drop/drag-drop-registry.spec.ts index 8af6d8407ae3..f80dca4ac96d 100644 --- a/src/cdk/drag-drop/drag-drop-registry.spec.ts +++ b/src/cdk/drag-drop/drag-drop-registry.spec.ts @@ -186,10 +186,6 @@ describe('DragDropRegistry', () => { pointerMoveSubscription.unsubscribe(); }); - it('should not throw when trying to register the same container again', () => { - expect(() => registry.registerDropContainer(testComponent.dropInstances.first)).not.toThrow(); - }); - it('should not prevent the default `touchmove` actions when nothing is being dragged', () => { expect(dispatchTouchEvent(document, 'touchmove').defaultPrevented).toBe(false); }); diff --git a/src/cdk/drag-drop/drag-drop-registry.ts b/src/cdk/drag-drop/drag-drop-registry.ts index 7a46f667b696..9847bb179875 100644 --- a/src/cdk/drag-drop/drag-drop-registry.ts +++ b/src/cdk/drag-drop/drag-drop-registry.ts @@ -26,7 +26,7 @@ const activeCapturingEventOptions = normalizePassiveListenerOptions({ // to avoid circular imports. If we were to reference them here, importing the registry into the // classes that are registering themselves will introduce a circular import. @Injectable({providedIn: 'root'}) -export class DragDropRegistry implements OnDestroy { +export class DragDropRegistry implements OnDestroy { private _document: Document; /** Registered drop container instances. */ @@ -68,10 +68,6 @@ export class DragDropRegistry implements OnDestroy { /** Adds a drop container to the registry. */ registerDropContainer(drop: C) { if (!this._dropInstances.has(drop)) { - if (this.getDropContainer(drop.id)) { - throw Error(`Drop instance with id "${drop.id}" has already been registered.`); - } - this._dropInstances.add(drop); } } @@ -173,15 +169,6 @@ export class DragDropRegistry implements OnDestroy { return this._activeDragInstances.has(drag); } - /** - * Gets a drop container by its id. - * @deprecated No longer being used. To be removed. - * @breaking-change 8.0.0 - */ - getDropContainer(id: string): C | undefined { - return Array.from(this._dropInstances).find(instance => instance.id === id); - } - ngOnDestroy() { this._dragInstances.forEach(instance => this.removeDragItem(instance)); this._dropInstances.forEach(instance => this.removeDropContainer(instance)); diff --git a/src/cdk/drag-drop/drop-list-container.ts b/src/cdk/drag-drop/drop-list-container.ts deleted file mode 100644 index f9b8f2a44412..000000000000 --- a/src/cdk/drag-drop/drop-list-container.ts +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {InjectionToken, QueryList, ElementRef} from '@angular/core'; -import {CdkDrag} from './directives/drag'; - - -/** - * @deprecated To be removed. No longer being used. Previously the interface was used to avoid - * circular imports between `CdkDrag` and `CdkDropList`, however now we're using the - * `CdkDropListInternal` interface to achieve the same result, without having to maintain - * this large of an interface. - * @breaking-change 8.0.0 - */ -export interface CdkDropListContainer { - /** DOM node that corresponds to the drop container. */ - element: ElementRef; - - /** Arbitrary data to attach to all events emitted by this container. */ - data: T; - - /** Unique ID for the drop zone. */ - id: string; - - /** Direction in which the list is oriented. */ - orientation: 'horizontal' | 'vertical'; - - /** Locks the position of the draggable elements inside the container along the specified axis. */ - lockAxis: 'x' | 'y'; - - /** Whether starting a dragging sequence from this container is disabled. */ - disabled: boolean; - - /** Starts dragging an item. */ - start(): void; - - /** - * Drops an item into this container. - * @param item Item being dropped into the container. - * @param currentIndex Index at which the item should be inserted. - * @param previousContainer Container from which the item got dragged in. - * @param isPointerOverContainer Whether the user's pointer was over the - * container when the item was dropped. - */ - drop(item: CdkDrag, currentIndex: number, previousContainer: Partial, - isPointerOverContainer: boolean): void; - - /** - * Emits an event to indicate that the user moved an item into the container. - * @param item Item that was moved into the container. - * @param pointerX Position of the item along the X axis. - * @param pointerY Position of the item along the Y axis. - */ - enter(item: CdkDrag, pointerX: number, pointerY: number): void; - - /** - * Removes an item from the container after it was dragged into another container by the user. - * @param item Item that was dragged out. - */ - exit(item: CdkDrag): void; - - /** - * Figures out the index of an item in the container. - * @param item Item whose index should be determined. - */ - getItemIndex(item: CdkDrag): number; - _sortItem(item: CdkDrag, pointerX: number, pointerY: number, delta: {x: number, y: number}): void; - _draggables: QueryList; - _getSiblingContainerFromPosition(item: CdkDrag, x: number, y: number): - CdkDropListContainer | null; - _isOverContainer(x: number, y: number): boolean; -} - -/** - * Injection token that is used to provide a CdkDropList instance to CdkDrag. - * Used for avoiding circular imports. - */ -export const CDK_DROP_LIST = new InjectionToken('CDK_DROP_LIST'); - -/** - * Injection token that is used to provide a CdkDropList instance to CdkDrag. - * Used for avoiding circular imports. - * @deprecated Use `CDK_DROP_LIST` instead. - * @breaking-change 8.0.0 - */ -export const CDK_DROP_LIST_CONTAINER = CDK_DROP_LIST; - diff --git a/src/cdk/drag-drop/drop-list-ref.ts b/src/cdk/drag-drop/drop-list-ref.ts index 76e2c83c4415..470ca579509f 100644 --- a/src/cdk/drag-drop/drop-list-ref.ts +++ b/src/cdk/drag-drop/drop-list-ref.ts @@ -17,9 +17,6 @@ import {moveItemInArray} from './drag-utils'; import {DragDropRegistry} from './drag-drop-registry'; import {DragRefInternal as DragRef, Point} from './drag-ref'; -/** Counter used to generate unique ids for drop refs. */ -let _uniqueIdCounter = 0; - /** * Proximity, as a ratio to width/height, at which a * dragged item will affect the drop container. @@ -78,13 +75,6 @@ export class DropListRef { /** Element that the drop list is attached to. */ element: HTMLElement | ElementRef; - /** - * Unique ID for the drop list. - * @deprecated No longer being used. To be removed. - * @breaking-change 8.0.0 - */ - id = `cdk-drop-list-ref-${_uniqueIdCounter++}`; - /** Whether starting a dragging sequence from this container is disabled. */ disabled: boolean = false; @@ -207,12 +197,8 @@ export class DropListRef { element: ElementRef | HTMLElement, private _dragDropRegistry: DragDropRegistry, _document: any, - /** - * @deprecated _ngZone and _viewportRuler parameters to be made required. - * @breaking-change 9.0.0 - */ - private _ngZone?: NgZone, - private _viewportRuler?: ViewportRuler) { + private _ngZone: NgZone, + private _viewportRuler: ViewportRuler) { const nativeNode = this.element = coerceElement(element); this._shadowRoot = getShadowRoot(nativeNode) || _document; _dragDropRegistry.registerDropContainer(this); @@ -246,18 +232,8 @@ export class DropListRef { this._cacheItems(); this._siblings.forEach(sibling => sibling._startReceiving(this)); this._removeListeners(); - - // @breaking-change 9.0.0 Remove check for _ngZone once it's marked as a required param. - if (this._ngZone) { - this._ngZone.runOutsideAngular(() => element.addEventListener('scroll', this._handleScroll)); - } else { - element.addEventListener('scroll', this._handleScroll); - } - - // @breaking-change 9.0.0 Remove check for _viewportRuler once it's marked as a required param. - if (this._viewportRuler) { - this._listenToScrollEvents(); - } + this._ngZone.runOutsideAngular(() => element.addEventListener('scroll', this._handleScroll)); + this._listenToScrollEvents(); } /** @@ -334,10 +310,9 @@ export class DropListRef { * @param isPointerOverContainer Whether the user's pointer was over the * container when the item was dropped. * @param distance Distance the user has dragged since the start of the dragging sequence. - * @breaking-change 9.0.0 `distance` parameter to become required. */ drop(item: DragRef, currentIndex: number, previousContainer: DropListRef, - isPointerOverContainer: boolean, distance: Point = {x: 0, y: 0}): void { + isPointerOverContainer: boolean, distance: Point): void { this._reset(); this.dropped.next({ item, @@ -524,9 +499,8 @@ export class DropListRef { } } - // @breaking-change 9.0.0 Remove null check for _viewportRuler once it's a required parameter. // Otherwise check if we can start scrolling the viewport. - if (this._viewportRuler && !verticalScrollDirection && !horizontalScrollDirection) { + if (!verticalScrollDirection && !horizontalScrollDirection) { const {width, height} = this._viewportRuler.getViewportSize(); const clientRect = {width, height, top: 0, right: width, bottom: height, left: 0}; verticalScrollDirection = getVerticalScrollDirection(clientRect, pointerY); @@ -542,12 +516,7 @@ export class DropListRef { this._scrollNode = scrollNode; if ((verticalScrollDirection || horizontalScrollDirection) && scrollNode) { - // @breaking-change 9.0.0 Remove null check for `_ngZone` once it is made required. - if (this._ngZone) { - this._ngZone.runOutsideAngular(this._startScrollInterval); - } else { - this._startScrollInterval(); - } + this._ngZone.runOutsideAngular(this._startScrollInterval); } else { this._stopScrolling(); } diff --git a/src/cdk/drag-drop/public-api.ts b/src/cdk/drag-drop/public-api.ts index 473894dfde1e..18284d498230 100644 --- a/src/cdk/drag-drop/public-api.ts +++ b/src/cdk/drag-drop/public-api.ts @@ -10,7 +10,6 @@ export {DragDrop} from './drag-drop'; export {DragRef, DragRefConfig} from './drag-ref'; export {DropListRef} from './drop-list-ref'; -export * from './drop-list-container'; export * from './drag-events'; export * from './drag-utils'; export * from './drag-drop-module'; @@ -22,11 +21,3 @@ export * from './directives/drag'; export * from './directives/drag-handle'; export * from './directives/drag-preview'; export * from './directives/drag-placeholder'; - -import {DragRefConfig} from './drag-ref'; - -/** - * @deprecated Use `DragRefConfig` instead. - * @breaking-change 8.0.0 - */ -export interface CdkDragConfig extends DragRefConfig {} diff --git a/src/cdk/schematics/ng-update/data/class-names.ts b/src/cdk/schematics/ng-update/data/class-names.ts index 090e31736c2d..184f855550cc 100644 --- a/src/cdk/schematics/ng-update/data/class-names.ts +++ b/src/cdk/schematics/ng-update/data/class-names.ts @@ -17,6 +17,15 @@ export interface ClassNameUpgradeData { } export const classNames: VersionChanges = { + [TargetVersion.V9]: [{ + pr: 'https://github.com/angular/components/pull/17084', + changes: [ + {replace: 'CDK_DROP_LIST_CONTAINER', replaceWith: 'CDK_DROP_LIST'}, + {replace: 'CdkDragConfig', replaceWith: 'DragRefConfig'} + ] + }], + [TargetVersion.V8]: [], + [TargetVersion.V7]: [], [TargetVersion.V6]: [ { pr: 'https://github.com/angular/components/pull/10161', diff --git a/src/cdk/schematics/ng-update/data/constructor-checks.ts b/src/cdk/schematics/ng-update/data/constructor-checks.ts index adaa7ab931bd..05d7c2ff01cc 100644 --- a/src/cdk/schematics/ng-update/data/constructor-checks.ts +++ b/src/cdk/schematics/ng-update/data/constructor-checks.ts @@ -17,6 +17,10 @@ export type ConstructorChecksUpgradeData = string; * automatically through type checking. */ export const constructorChecks: VersionChanges = { + [TargetVersion.V9]: [{ + pr: 'https://github.com/angular/components/pull/17084', + changes: ['DropListRef'] + }], [TargetVersion.V8]: [{ pr: 'https://github.com/angular/components/pull/15647', changes: [ diff --git a/src/cdk/schematics/ng-update/data/method-call-checks.ts b/src/cdk/schematics/ng-update/data/method-call-checks.ts index a71c4808fe90..048ed0b2caed 100644 --- a/src/cdk/schematics/ng-update/data/method-call-checks.ts +++ b/src/cdk/schematics/ng-update/data/method-call-checks.ts @@ -16,6 +16,16 @@ export interface MethodCallUpgradeData { } export const methodCallChecks: VersionChanges = { + [TargetVersion.V9]: [{ + pr: 'https://github.com/angular/components/pull/17084', + changes: [{ + className: 'DropListRef', + method: 'drop', + invalidArgCounts: [{count: 4, message: 'The "distance" parameter is required'}] + }] + }], + [TargetVersion.V8]: [], + [TargetVersion.V7]: [], [TargetVersion.V6]: [{ pr: 'https://github.com/angular/components/pull/10325', changes: [{ diff --git a/src/cdk/schematics/ng-update/data/property-names.ts b/src/cdk/schematics/ng-update/data/property-names.ts index 4a6507e09a26..b30302482a61 100644 --- a/src/cdk/schematics/ng-update/data/property-names.ts +++ b/src/cdk/schematics/ng-update/data/property-names.ts @@ -22,6 +22,15 @@ export interface PropertyNameUpgradeData { } export const propertyNames: VersionChanges = { + [TargetVersion.V9]: [{ + pr: 'https://github.com/angular/components/pull/17084', + changes: [{ + replace: 'boundaryElementSelector', + replaceWith: 'boundaryElement', + whitelist: {classes: ['CdkDrag']} + }] + }], + [TargetVersion.V8]: [], [TargetVersion.V7]: [ { pr: 'https://github.com/angular/components/pull/8286', diff --git a/tools/public_api_guard/cdk/drag-drop.d.ts b/tools/public_api_guard/cdk/drag-drop.d.ts index 8cf666859fb5..4f10e3a23445 100644 --- a/tools/public_api_guard/cdk/drag-drop.d.ts +++ b/tools/public_api_guard/cdk/drag-drop.d.ts @@ -2,9 +2,7 @@ export declare const CDK_DRAG_CONFIG: InjectionToken; export declare function CDK_DRAG_CONFIG_FACTORY(): DragRefConfig; -export declare const CDK_DROP_LIST: InjectionToken>; - -export declare const CDK_DROP_LIST_CONTAINER: InjectionToken>; +export declare const CDK_DROP_LIST: InjectionToken; export declare class CdkDrag implements AfterViewInit, OnChanges, OnDestroy { _dragRef: DragRef>; @@ -12,7 +10,6 @@ export declare class CdkDrag implements AfterViewInit, OnChanges, OnDes _placeholderTemplate: CdkDragPlaceholder; _previewTemplate: CdkDragPreview; boundaryElement: string | ElementRef | HTMLElement; - boundaryElementSelector: string; constrainPosition?: (point: Point, dragRef: DragRef) => Point; data: T; disabled: boolean; @@ -47,9 +44,6 @@ export declare class CdkDrag implements AfterViewInit, OnChanges, OnDes reset(): void; } -export interface CdkDragConfig extends DragRefConfig { -} - export interface CdkDragDrop { container: CdkDropList; currentIndex: number; @@ -135,7 +129,7 @@ export interface CdkDragStart { source: CdkDrag; } -export declare class CdkDropList implements CdkDropListContainer, AfterContentInit, OnDestroy { +export declare class CdkDropList implements AfterContentInit, OnDestroy { _draggables: QueryList; _dropListRef: DropListRef>; autoScrollDisabled: boolean; @@ -154,13 +148,7 @@ export declare class CdkDropList implements CdkDropListContainer, After sortingDisabled: boolean; constructor( element: ElementRef, dragDrop: DragDrop, _changeDetectorRef: ChangeDetectorRef, _dir?: Directionality | undefined, _group?: CdkDropListGroup> | undefined); - _getSiblingContainerFromPosition(item: CdkDrag, x: number, y: number): CdkDropListContainer | null; - _isOverContainer(x: number, y: number): boolean; - _sortItem(item: CdkDrag, pointerX: number, pointerY: number, pointerDelta: { - x: number; - y: number; - }): void; - drop(item: CdkDrag, currentIndex: number, previousContainer: Partial, isPointerOverContainer: boolean): void; + drop(item: CdkDrag, currentIndex: number, previousContainer: CdkDropList, isPointerOverContainer: boolean): void; enter(item: CdkDrag, pointerX: number, pointerY: number): void; exit(item: CdkDrag): void; getItemIndex(item: CdkDrag): number; @@ -169,27 +157,6 @@ export declare class CdkDropList implements CdkDropListContainer, After start(): void; } -export interface CdkDropListContainer { - _draggables: QueryList; - data: T; - disabled: boolean; - element: ElementRef; - id: string; - lockAxis: 'x' | 'y'; - orientation: 'horizontal' | 'vertical'; - _getSiblingContainerFromPosition(item: CdkDrag, x: number, y: number): CdkDropListContainer | null; - _isOverContainer(x: number, y: number): boolean; - _sortItem(item: CdkDrag, pointerX: number, pointerY: number, delta: { - x: number; - y: number; - }): void; - drop(item: CdkDrag, currentIndex: number, previousContainer: Partial, isPointerOverContainer: boolean): void; - enter(item: CdkDrag, pointerX: number, pointerY: number): void; - exit(item: CdkDrag): void; - getItemIndex(item: CdkDrag): number; - start(): void; -} - export declare class CdkDropListGroup implements OnDestroy { readonly _items: Set; disabled: boolean; @@ -207,14 +174,11 @@ export declare class DragDrop { export declare class DragDropModule { } -export declare class DragDropRegistry implements OnDestroy { +export declare class DragDropRegistry implements OnDestroy { readonly pointerMove: Subject; readonly pointerUp: Subject; readonly scroll: Subject; constructor(_ngZone: NgZone, _document: any); - getDropContainer(id: string): C | undefined; isDragging(drag: I): boolean; ngOnDestroy(): void; registerDragItem(drag: I): void; @@ -323,7 +287,6 @@ export declare class DropListRef { item: DragRef; container: DropListRef; }>; - id: string; lockAxis: 'x' | 'y'; sorted: Subject<{ previousIndex: number; @@ -332,8 +295,7 @@ export declare class DropListRef { item: DragRef; }>; sortingDisabled: boolean; - constructor(element: ElementRef | HTMLElement, _dragDropRegistry: DragDropRegistry, _document: any, - _ngZone?: NgZone | undefined, _viewportRuler?: ViewportRuler | undefined); + constructor(element: ElementRef | HTMLElement, _dragDropRegistry: DragDropRegistry, _document: any, _ngZone: NgZone, _viewportRuler: ViewportRuler); _canReceive(item: DragRef, x: number, y: number): boolean; _getSiblingContainerFromPosition(item: DragRef, x: number, y: number): DropListRef | undefined; _isOverContainer(x: number, y: number): boolean; @@ -347,7 +309,7 @@ export declare class DropListRef { _stopScrolling(): void; connectedTo(connectedTo: DropListRef[]): this; dispose(): void; - drop(item: DragRef, currentIndex: number, previousContainer: DropListRef, isPointerOverContainer: boolean, distance?: Point): void; + drop(item: DragRef, currentIndex: number, previousContainer: DropListRef, isPointerOverContainer: boolean, distance: Point): void; enter(item: DragRef, pointerX: number, pointerY: number): void; exit(item: DragRef): void; getItemIndex(item: DragRef): number;