From 7722205d18c95c09d690e1c36c060b7885b6bc22 Mon Sep 17 00:00:00 2001 From: Ruslan Nevecheria Date: Thu, 8 Dec 2022 10:39:42 +0200 Subject: [PATCH] refactor(cdk/listbox): convert all directives to standalone Converts all of the `@angular/cdk/listbox` directives to `standalone`. It provides the ability to use these directives as host directives. --- src/cdk/listbox/listbox-module.ts | 5 +++-- src/cdk/listbox/listbox.ts | 2 ++ tools/public_api_guard/cdk/listbox.md | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/cdk/listbox/listbox-module.ts b/src/cdk/listbox/listbox-module.ts index fd511f78874e..b7e17d19519d 100644 --- a/src/cdk/listbox/listbox-module.ts +++ b/src/cdk/listbox/listbox-module.ts @@ -10,8 +10,9 @@ import {NgModule} from '@angular/core'; import {CdkListbox, CdkOption} from './listbox'; const EXPORTED_DECLARATIONS = [CdkListbox, CdkOption]; + @NgModule({ - exports: EXPORTED_DECLARATIONS, - declarations: EXPORTED_DECLARATIONS, + imports: [...EXPORTED_DECLARATIONS], + exports: [...EXPORTED_DECLARATIONS], }) export class CdkListboxModule {} diff --git a/src/cdk/listbox/listbox.ts b/src/cdk/listbox/listbox.ts index 197f8e34f8c7..501293c3a43b 100644 --- a/src/cdk/listbox/listbox.ts +++ b/src/cdk/listbox/listbox.ts @@ -78,6 +78,7 @@ class ListboxSelectionModel extends SelectionModel { /** A selectable option in a listbox. */ @Directive({ selector: '[cdkOption]', + standalone: true, exportAs: 'cdkOption', host: { 'role': 'option', @@ -220,6 +221,7 @@ export class CdkOption implements ListKeyManagerOption, Highlightab @Directive({ selector: '[cdkListbox]', + standalone: true, exportAs: 'cdkListbox', host: { 'role': 'listbox', diff --git a/tools/public_api_guard/cdk/listbox.md b/tools/public_api_guard/cdk/listbox.md index 556f66df3f73..dca8d99ddd12 100644 --- a/tools/public_api_guard/cdk/listbox.md +++ b/tools/public_api_guard/cdk/listbox.md @@ -75,7 +75,7 @@ export class CdkListbox implements AfterContentInit, OnDestroy, Con readonly valueChange: Subject>; writeValue(value: readonly T[]): void; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration, "[cdkListbox]", ["cdkListbox"], { "id": "id"; "enabledTabIndex": "tabindex"; "value": "cdkListboxValue"; "multiple": "cdkListboxMultiple"; "disabled": "cdkListboxDisabled"; "useActiveDescendant": "cdkListboxUseActiveDescendant"; "orientation": "cdkListboxOrientation"; "compareWith": "cdkListboxCompareWith"; "navigationWrapDisabled": "cdkListboxNavigationWrapDisabled"; "navigateDisabledOptions": "cdkListboxNavigatesDisabledOptions"; }, { "valueChange": "cdkListboxValueChange"; }, ["options"], never, false, never>; + static ɵdir: i0.ɵɵDirectiveDeclaration, "[cdkListbox]", ["cdkListbox"], { "id": "id"; "enabledTabIndex": "tabindex"; "value": "cdkListboxValue"; "multiple": "cdkListboxMultiple"; "disabled": "cdkListboxDisabled"; "useActiveDescendant": "cdkListboxUseActiveDescendant"; "orientation": "cdkListboxOrientation"; "compareWith": "cdkListboxCompareWith"; "navigationWrapDisabled": "cdkListboxNavigationWrapDisabled"; "navigateDisabledOptions": "cdkListboxNavigatesDisabledOptions"; }, { "valueChange": "cdkListboxValueChange"; }, ["options"], never, true, never>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration, never>; } @@ -87,7 +87,7 @@ export class CdkListboxModule { // (undocumented) static ɵinj: i0.ɵɵInjectorDeclaration; // (undocumented) - static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; } // @public @@ -118,7 +118,7 @@ export class CdkOption implements ListKeyManagerOption, Highlightab typeaheadLabel: string; value: T; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration, "[cdkOption]", ["cdkOption"], { "id": "id"; "value": "cdkOption"; "typeaheadLabel": "cdkOptionTypeaheadLabel"; "disabled": "cdkOptionDisabled"; "enabledTabIndex": "tabindex"; }, {}, never, never, false, never>; + static ɵdir: i0.ɵɵDirectiveDeclaration, "[cdkOption]", ["cdkOption"], { "id": "id"; "value": "cdkOption"; "typeaheadLabel": "cdkOptionTypeaheadLabel"; "disabled": "cdkOptionDisabled"; "enabledTabIndex": "tabindex"; }, {}, never, never, true, never>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration, never>; }