Skip to content

Commit 9c61342

Browse files
nevechcrisbeto
authored andcommitted
refactor(cdk/listbox): convert all directives to standalone (#26211)
Converts all of the `@angular/cdk/listbox` directives to `standalone`. It provides the ability to use these directives as host directives. (cherry picked from commit 8626a26)
1 parent 97c95e6 commit 9c61342

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/cdk/listbox/listbox-module.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import {NgModule} from '@angular/core';
1010
import {CdkListbox, CdkOption} from './listbox';
1111

1212
const EXPORTED_DECLARATIONS = [CdkListbox, CdkOption];
13+
1314
@NgModule({
14-
exports: EXPORTED_DECLARATIONS,
15-
declarations: EXPORTED_DECLARATIONS,
15+
imports: [...EXPORTED_DECLARATIONS],
16+
exports: [...EXPORTED_DECLARATIONS],
1617
})
1718
export class CdkListboxModule {}

src/cdk/listbox/listbox.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class ListboxSelectionModel<T> extends SelectionModel<T> {
7878
/** A selectable option in a listbox. */
7979
@Directive({
8080
selector: '[cdkOption]',
81+
standalone: true,
8182
exportAs: 'cdkOption',
8283
host: {
8384
'role': 'option',
@@ -220,6 +221,7 @@ export class CdkOption<T = unknown> implements ListKeyManagerOption, Highlightab
220221

221222
@Directive({
222223
selector: '[cdkListbox]',
224+
standalone: true,
223225
exportAs: 'cdkListbox',
224226
host: {
225227
'role': 'listbox',

tools/public_api_guard/cdk/listbox.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class CdkListbox<T = unknown> implements AfterContentInit, OnDestroy, Con
7575
readonly valueChange: Subject<ListboxValueChangeEvent<T>>;
7676
writeValue(value: readonly T[]): void;
7777
// (undocumented)
78-
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkListbox<any>, "[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>;
78+
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkListbox<any>, "[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>;
7979
// (undocumented)
8080
static ɵfac: i0.ɵɵFactoryDeclaration<CdkListbox<any>, never>;
8181
}
@@ -87,7 +87,7 @@ export class CdkListboxModule {
8787
// (undocumented)
8888
static ɵinj: i0.ɵɵInjectorDeclaration<CdkListboxModule>;
8989
// (undocumented)
90-
static ɵmod: i0.ɵɵNgModuleDeclaration<CdkListboxModule, [typeof i1.CdkListbox, typeof i1.CdkOption], never, [typeof i1.CdkListbox, typeof i1.CdkOption]>;
90+
static ɵmod: i0.ɵɵNgModuleDeclaration<CdkListboxModule, never, [typeof i1.CdkListbox, typeof i1.CdkOption], [typeof i1.CdkListbox, typeof i1.CdkOption]>;
9191
}
9292

9393
// @public
@@ -118,7 +118,7 @@ export class CdkOption<T = unknown> implements ListKeyManagerOption, Highlightab
118118
typeaheadLabel: string;
119119
value: T;
120120
// (undocumented)
121-
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkOption<any>, "[cdkOption]", ["cdkOption"], { "id": "id"; "value": "cdkOption"; "typeaheadLabel": "cdkOptionTypeaheadLabel"; "disabled": "cdkOptionDisabled"; "enabledTabIndex": "tabindex"; }, {}, never, never, false, never>;
121+
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkOption<any>, "[cdkOption]", ["cdkOption"], { "id": "id"; "value": "cdkOption"; "typeaheadLabel": "cdkOptionTypeaheadLabel"; "disabled": "cdkOptionDisabled"; "enabledTabIndex": "tabindex"; }, {}, never, never, true, never>;
122122
// (undocumented)
123123
static ɵfac: i0.ɵɵFactoryDeclaration<CdkOption<any>, never>;
124124
}

0 commit comments

Comments
 (0)