Skip to content

Commit

Permalink
refactor(cdk/listbox): convert all directives to standalone (#26211)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
nevech authored and crisbeto committed Dec 14, 2022
1 parent 97c95e6 commit 9c61342
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/cdk/listbox/listbox-module.ts
Expand Up @@ -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 {}
2 changes: 2 additions & 0 deletions src/cdk/listbox/listbox.ts
Expand Up @@ -78,6 +78,7 @@ class ListboxSelectionModel<T> extends SelectionModel<T> {
/** A selectable option in a listbox. */
@Directive({
selector: '[cdkOption]',
standalone: true,
exportAs: 'cdkOption',
host: {
'role': 'option',
Expand Down Expand Up @@ -220,6 +221,7 @@ export class CdkOption<T = unknown> implements ListKeyManagerOption, Highlightab

@Directive({
selector: '[cdkListbox]',
standalone: true,
exportAs: 'cdkListbox',
host: {
'role': 'listbox',
Expand Down
6 changes: 3 additions & 3 deletions tools/public_api_guard/cdk/listbox.md
Expand Up @@ -75,7 +75,7 @@ export class CdkListbox<T = unknown> implements AfterContentInit, OnDestroy, Con
readonly valueChange: Subject<ListboxValueChangeEvent<T>>;
writeValue(value: readonly T[]): void;
// (undocumented)
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>;
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>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<CdkListbox<any>, never>;
}
Expand All @@ -87,7 +87,7 @@ export class CdkListboxModule {
// (undocumented)
static ɵinj: i0.ɵɵInjectorDeclaration<CdkListboxModule>;
// (undocumented)
static ɵmod: i0.ɵɵNgModuleDeclaration<CdkListboxModule, [typeof i1.CdkListbox, typeof i1.CdkOption], never, [typeof i1.CdkListbox, typeof i1.CdkOption]>;
static ɵmod: i0.ɵɵNgModuleDeclaration<CdkListboxModule, never, [typeof i1.CdkListbox, typeof i1.CdkOption], [typeof i1.CdkListbox, typeof i1.CdkOption]>;
}

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

0 comments on commit 9c61342

Please sign in to comment.