diff --git a/src/cdk/drag-drop/directives/drag-handle.ts b/src/cdk/drag-drop/directives/drag-handle.ts index 0cf5223ba97e..3af26eeceda6 100644 --- a/src/cdk/drag-drop/directives/drag-handle.ts +++ b/src/cdk/drag-drop/directives/drag-handle.ts @@ -31,6 +31,7 @@ export const CDK_DRAG_HANDLE = new InjectionToken('CdkDragHandle' /** Handle that can be used to drag a CdkDrag instance. */ @Directive({ selector: '[cdkDragHandle]', + standalone: true, host: { 'class': 'cdk-drag-handle', }, diff --git a/src/cdk/drag-drop/directives/drag-placeholder.ts b/src/cdk/drag-drop/directives/drag-placeholder.ts index b3f603c4f14f..a98fa094b4b9 100644 --- a/src/cdk/drag-drop/directives/drag-placeholder.ts +++ b/src/cdk/drag-drop/directives/drag-placeholder.ts @@ -21,6 +21,7 @@ export const CDK_DRAG_PLACEHOLDER = new InjectionToken('CdkD */ @Directive({ selector: 'ng-template[cdkDragPlaceholder]', + standalone: true, providers: [{provide: CDK_DRAG_PLACEHOLDER, useExisting: CdkDragPlaceholder}], }) export class CdkDragPlaceholder { diff --git a/src/cdk/drag-drop/directives/drag-preview.ts b/src/cdk/drag-drop/directives/drag-preview.ts index 64f189d8924a..0aecd9440b04 100644 --- a/src/cdk/drag-drop/directives/drag-preview.ts +++ b/src/cdk/drag-drop/directives/drag-preview.ts @@ -22,6 +22,7 @@ export const CDK_DRAG_PREVIEW = new InjectionToken('CdkDragPrevi */ @Directive({ selector: 'ng-template[cdkDragPreview]', + standalone: true, providers: [{provide: CDK_DRAG_PREVIEW, useExisting: CdkDragPreview}], }) export class CdkDragPreview { diff --git a/src/cdk/drag-drop/directives/drag.ts b/src/cdk/drag-drop/directives/drag.ts index 043ac5306b44..1061beee63b0 100644 --- a/src/cdk/drag-drop/directives/drag.ts +++ b/src/cdk/drag-drop/directives/drag.ts @@ -62,6 +62,7 @@ const DRAG_HOST_CLASS = 'cdk-drag'; @Directive({ selector: '[cdkDrag]', exportAs: 'cdkDrag', + standalone: true, host: { 'class': DRAG_HOST_CLASS, '[class.cdk-drag-disabled]': 'disabled', diff --git a/src/cdk/drag-drop/directives/drop-list-group.ts b/src/cdk/drag-drop/directives/drop-list-group.ts index fe4bece12a19..148a5319993b 100644 --- a/src/cdk/drag-drop/directives/drop-list-group.ts +++ b/src/cdk/drag-drop/directives/drop-list-group.ts @@ -27,6 +27,7 @@ export const CDK_DROP_LIST_GROUP = new InjectionToken> @Directive({ selector: '[cdkDropListGroup]', exportAs: 'cdkDropListGroup', + standalone: true, providers: [{provide: CDK_DROP_LIST_GROUP, useExisting: CdkDropListGroup}], }) export class CdkDropListGroup implements OnDestroy { diff --git a/src/cdk/drag-drop/directives/drop-list.ts b/src/cdk/drag-drop/directives/drop-list.ts index 7d678cbde23d..357f1c692534 100644 --- a/src/cdk/drag-drop/directives/drop-list.ts +++ b/src/cdk/drag-drop/directives/drop-list.ts @@ -60,6 +60,7 @@ export const CDK_DROP_LIST = new InjectionToken('CdkDropList'); @Directive({ selector: '[cdkDropList], cdk-drop-list', exportAs: 'cdkDropList', + standalone: true, providers: [ // Prevent child drop lists from picking up the same group as their parent. {provide: CDK_DROP_LIST_GROUP, useValue: undefined}, diff --git a/src/cdk/drag-drop/drag-drop-module.ts b/src/cdk/drag-drop/drag-drop-module.ts index 8a10d5625007..2cb9997db254 100644 --- a/src/cdk/drag-drop/drag-drop-module.ts +++ b/src/cdk/drag-drop/drag-drop-module.ts @@ -16,24 +16,18 @@ import {CdkDragPreview} from './directives/drag-preview'; import {CdkDragPlaceholder} from './directives/drag-placeholder'; import {DragDrop} from './drag-drop'; +const DRAG_DROP_DIRECTIVES = [ + CdkDropList, + CdkDropListGroup, + CdkDrag, + CdkDragHandle, + CdkDragPreview, + CdkDragPlaceholder, +]; + @NgModule({ - declarations: [ - CdkDropList, - CdkDropListGroup, - CdkDrag, - CdkDragHandle, - CdkDragPreview, - CdkDragPlaceholder, - ], - exports: [ - CdkScrollableModule, - CdkDropList, - CdkDropListGroup, - CdkDrag, - CdkDragHandle, - CdkDragPreview, - CdkDragPlaceholder, - ], + imports: DRAG_DROP_DIRECTIVES, + exports: [CdkScrollableModule, ...DRAG_DROP_DIRECTIVES], providers: [DragDrop], }) export class DragDropModule {} diff --git a/tools/public_api_guard/cdk/drag-drop.md b/tools/public_api_guard/cdk/drag-drop.md index 9adde80ab381..6d3426946205 100644 --- a/tools/public_api_guard/cdk/drag-drop.md +++ b/tools/public_api_guard/cdk/drag-drop.md @@ -90,7 +90,7 @@ export class CdkDrag implements AfterViewInit, OnChanges, OnDestroy { setFreeDragPosition(value: Point): void; readonly started: EventEmitter; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration, "[cdkDrag]", ["cdkDrag"], { "data": "cdkDragData"; "lockAxis": "cdkDragLockAxis"; "rootElementSelector": "cdkDragRootElement"; "boundaryElement": "cdkDragBoundary"; "dragStartDelay": "cdkDragStartDelay"; "freeDragPosition": "cdkDragFreeDragPosition"; "disabled": "cdkDragDisabled"; "constrainPosition": "cdkDragConstrainPosition"; "previewClass": "cdkDragPreviewClass"; "previewContainer": "cdkDragPreviewContainer"; }, { "started": "cdkDragStarted"; "released": "cdkDragReleased"; "ended": "cdkDragEnded"; "entered": "cdkDragEntered"; "exited": "cdkDragExited"; "dropped": "cdkDragDropped"; "moved": "cdkDragMoved"; }, ["_previewTemplate", "_placeholderTemplate", "_handles"], never, false, never>; + static ɵdir: i0.ɵɵDirectiveDeclaration, "[cdkDrag]", ["cdkDrag"], { "data": "cdkDragData"; "lockAxis": "cdkDragLockAxis"; "rootElementSelector": "cdkDragRootElement"; "boundaryElement": "cdkDragBoundary"; "dragStartDelay": "cdkDragStartDelay"; "freeDragPosition": "cdkDragFreeDragPosition"; "disabled": "cdkDragDisabled"; "constrainPosition": "cdkDragConstrainPosition"; "previewClass": "cdkDragPreviewClass"; "previewContainer": "cdkDragPreviewContainer"; }, { "started": "cdkDragStarted"; "released": "cdkDragReleased"; "ended": "cdkDragEnded"; "entered": "cdkDragEntered"; "exited": "cdkDragExited"; "dropped": "cdkDragDropped"; "moved": "cdkDragMoved"; }, ["_previewTemplate", "_placeholderTemplate", "_handles"], never, true, never>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration, [null, { optional: true; skipSelf: true; }, null, null, null, { optional: true; }, { optional: true; }, null, null, { optional: true; self: true; }, { optional: true; skipSelf: true; }]>; } @@ -153,7 +153,7 @@ export class CdkDragHandle implements OnDestroy { _parentDrag: {} | undefined; readonly _stateChanges: Subject; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -183,7 +183,7 @@ export class CdkDragPlaceholder { // (undocumented) templateRef: TemplateRef; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration, "ng-template[cdkDragPlaceholder]", never, { "data": "data"; }, {}, never, never, false, never>; + static ɵdir: i0.ɵɵDirectiveDeclaration, "ng-template[cdkDragPlaceholder]", never, { "data": "data"; }, {}, never, never, true, never>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration, never>; } @@ -197,7 +197,7 @@ export class CdkDragPreview { // (undocumented) templateRef: TemplateRef; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration, "ng-template[cdkDragPreview]", never, { "data": "data"; "matchSize": "matchSize"; }, {}, never, never, false, never>; + static ɵdir: i0.ɵɵDirectiveDeclaration, "ng-template[cdkDragPreview]", never, { "data": "data"; "matchSize": "matchSize"; }, {}, never, never, true, never>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration, never>; } @@ -250,7 +250,7 @@ export class CdkDropList implements OnDestroy { sortingDisabled: BooleanInput; sortPredicate: (index: number, drag: CdkDrag, drop: CdkDropList) => boolean; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration, "[cdkDropList], cdk-drop-list", ["cdkDropList"], { "connectedTo": "cdkDropListConnectedTo"; "data": "cdkDropListData"; "orientation": "cdkDropListOrientation"; "id": "id"; "lockAxis": "cdkDropListLockAxis"; "disabled": "cdkDropListDisabled"; "sortingDisabled": "cdkDropListSortingDisabled"; "enterPredicate": "cdkDropListEnterPredicate"; "sortPredicate": "cdkDropListSortPredicate"; "autoScrollDisabled": "cdkDropListAutoScrollDisabled"; "autoScrollStep": "cdkDropListAutoScrollStep"; }, { "dropped": "cdkDropListDropped"; "entered": "cdkDropListEntered"; "exited": "cdkDropListExited"; "sorted": "cdkDropListSorted"; }, never, never, false, never>; + static ɵdir: i0.ɵɵDirectiveDeclaration, "[cdkDropList], cdk-drop-list", ["cdkDropList"], { "connectedTo": "cdkDropListConnectedTo"; "data": "cdkDropListData"; "orientation": "cdkDropListOrientation"; "id": "id"; "lockAxis": "cdkDropListLockAxis"; "disabled": "cdkDropListDisabled"; "sortingDisabled": "cdkDropListSortingDisabled"; "enterPredicate": "cdkDropListEnterPredicate"; "sortPredicate": "cdkDropListSortPredicate"; "autoScrollDisabled": "cdkDropListAutoScrollDisabled"; "autoScrollStep": "cdkDropListAutoScrollStep"; }, { "dropped": "cdkDropListDropped"; "entered": "cdkDropListEntered"; "exited": "cdkDropListExited"; "sorted": "cdkDropListSorted"; }, never, never, true, never>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration, [null, null, null, null, { optional: true; }, { optional: true; skipSelf: true; }, { optional: true; }]>; } @@ -263,7 +263,7 @@ export class CdkDropListGroup implements OnDestroy { // (undocumented) ngOnDestroy(): void; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration, "[cdkDropListGroup]", ["cdkDropListGroup"], { "disabled": "cdkDropListGroupDisabled"; }, {}, never, never, false, never>; + static ɵdir: i0.ɵɵDirectiveDeclaration, "[cdkDropListGroup]", ["cdkDropListGroup"], { "disabled": "cdkDropListGroupDisabled"; }, {}, never, never, true, never>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration, never>; } @@ -323,7 +323,7 @@ export class DragDropModule { // (undocumented) static ɵinj: i0.ɵɵInjectorDeclaration; // (undocumented) - static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; } // @public