From a0d168d7048522d0b3db87fb3cb7f98728e4c4fe Mon Sep 17 00:00:00 2001 From: crisbeto Date: Thu, 7 May 2020 20:21:49 +0200 Subject: [PATCH] refactor(drag-drop): remove deprecated APIs for version 10 Removes some deprecated APIs that were marked to be removed in v10. Also marks some more APIs that were supposed to deprecated. BREAKING CHANGES: * `CdkDropList.start` has been removed. * `CdkDropList.drop` has been removed. * `CdkDropList.enter` has been removed. * `CdkDropList.exit` has been removed. * `CdkDropList.getItemIndex` has been removed. * `CDK_DRAG_CONFIG_FACTORY` has been removed. --- src/cdk/drag-drop/directives/config.ts | 9 ---- src/cdk/drag-drop/directives/drag.ts | 8 +++- src/cdk/drag-drop/directives/drop-list.ts | 58 ----------------------- tools/public_api_guard/cdk/drag-drop.d.ts | 7 --- 4 files changed, 7 insertions(+), 75 deletions(-) diff --git a/src/cdk/drag-drop/directives/config.ts b/src/cdk/drag-drop/directives/config.ts index 2358e536d57c..f66a2619a701 100644 --- a/src/cdk/drag-drop/directives/config.ts +++ b/src/cdk/drag-drop/directives/config.ts @@ -44,12 +44,3 @@ export interface DragDropConfig extends Partial { listOrientation?: DropListOrientation; zIndex?: number; } - -/** - * @deprecated No longer being used. To be removed. - * @breaking-change 10.0.0 - * @docs-private - */ -export function CDK_DRAG_CONFIG_FACTORY(): DragDropConfig { - return {dragStartThreshold: 5, pointerDirectionChangeThreshold: 5}; -} diff --git a/src/cdk/drag-drop/directives/drag.ts b/src/cdk/drag-drop/directives/drag.ts index ebd80933f645..c57da63ab939 100644 --- a/src/cdk/drag-drop/directives/drag.ts +++ b/src/cdk/drag-drop/directives/drag.ts @@ -226,12 +226,18 @@ export class CdkDrag implements AfterViewInit, OnChanges, OnDestroy { /** * Returns the element that is being used as a placeholder * while the current element is being dragged. + * @deprecated No longer being used to be removed. + * @breaking-change 11.0.0 */ getPlaceholderElement(): HTMLElement { return this._dragRef.getPlaceholderElement(); } - /** Returns the root draggable element. */ + /** + * Returns the root draggable element. + * @deprecated No longer being used to be removed. + * @breaking-change 11.0.0 + */ getRootElement(): HTMLElement { return this._dragRef.getRootElement(); } diff --git a/src/cdk/drag-drop/directives/drop-list.ts b/src/cdk/drag-drop/directives/drop-list.ts index 33fb95164128..041e4f60c511 100644 --- a/src/cdk/drag-drop/directives/drop-list.ts +++ b/src/cdk/drag-drop/directives/drop-list.ts @@ -233,64 +233,6 @@ export class CdkDropList implements OnDestroy { this._destroyed.complete(); } - /** - * Starts dragging an item. - * @deprecated No longer being used. To be removed. - * @breaking-change 10.0.0 - */ - start(): void { - this._dropListRef.start(); - } - - /** - * 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. - * - * @deprecated No longer being used. To be removed. - * @breaking-change 10.0.0 - */ - drop(item: CdkDrag, currentIndex: number, previousContainer: CdkDropList, - isPointerOverContainer: boolean): void { - this._dropListRef.drop(item._dragRef, currentIndex, previousContainer._dropListRef, - isPointerOverContainer, {x: 0, y: 0}); - } - - /** - * 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. - * @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); - } - - /** - * 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); - } - - /** - * 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); - } - /** Syncs the inputs of the CdkDropList with the options of the underlying DropListRef. */ private _setupInputSyncSubscription(ref: DropListRef) { if (this._dir) { diff --git a/tools/public_api_guard/cdk/drag-drop.d.ts b/tools/public_api_guard/cdk/drag-drop.d.ts index 113fbeece7fa..d37d6c947a48 100644 --- a/tools/public_api_guard/cdk/drag-drop.d.ts +++ b/tools/public_api_guard/cdk/drag-drop.d.ts @@ -1,7 +1,5 @@ export declare const CDK_DRAG_CONFIG: InjectionToken; -export declare function CDK_DRAG_CONFIG_FACTORY(): DragDropConfig; - export declare const CDK_DROP_LIST: InjectionToken; export declare class CdkDrag implements AfterViewInit, OnChanges, OnDestroy { @@ -166,14 +164,9 @@ export declare class CdkDropList implements OnDestroy { element: ElementRef, dragDrop: DragDrop, _changeDetectorRef: ChangeDetectorRef, _dir?: Directionality | undefined, _group?: CdkDropListGroup> | undefined, _scrollDispatcher?: ScrollDispatcher | undefined, config?: DragDropConfig); addItem(item: CdkDrag): 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; getSortedItems(): CdkDrag[]; ngOnDestroy(): void; removeItem(item: CdkDrag): void; - start(): void; static ngAcceptInputType_autoScrollDisabled: BooleanInput; static ngAcceptInputType_disabled: BooleanInput; static ngAcceptInputType_sortingDisabled: BooleanInput;