@angular/aria 21.0.0-next.9 → 21.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_adev_assets/aria-accordion.json +373 -0
- package/_adev_assets/aria-combobox.json +383 -0
- package/_adev_assets/aria-grid.json +647 -0
- package/_adev_assets/aria-listbox.json +511 -0
- package/_adev_assets/aria-menu.json +852 -0
- package/_adev_assets/aria-tabs.json +987 -0
- package/_adev_assets/aria-toolbar.json +696 -0
- package/_adev_assets/aria-tree.json +1071 -0
- package/fesm2022/_widget-chunk.mjs +949 -0
- package/fesm2022/_widget-chunk.mjs.map +1 -0
- package/fesm2022/accordion.mjs +372 -174
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/aria.mjs +1 -2
- package/fesm2022/aria.mjs.map +1 -1
- package/fesm2022/combobox.mjs +308 -116
- package/fesm2022/combobox.mjs.map +1 -1
- package/fesm2022/grid.mjs +566 -0
- package/fesm2022/grid.mjs.map +1 -0
- package/fesm2022/listbox.mjs +384 -184
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/menu.mjs +591 -0
- package/fesm2022/menu.mjs.map +1 -0
- package/fesm2022/private.mjs +2338 -0
- package/fesm2022/private.mjs.map +1 -0
- package/fesm2022/tabs.mjs +484 -276
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +366 -200
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tree.mjs +515 -267
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +12 -12
- package/types/_grid-chunk.d.ts +608 -0
- package/types/accordion.d.ts +8 -8
- package/types/combobox.d.ts +20 -7
- package/types/grid.d.ts +120 -0
- package/types/listbox.d.ts +9 -7
- package/types/menu.d.ts +170 -0
- package/types/{ui-patterns.d.ts → private.d.ts} +555 -433
- package/types/tabs.d.ts +8 -8
- package/types/toolbar.d.ts +31 -28
- package/types/tree.d.ts +11 -9
- package/fesm2022/deferred-content.mjs +0 -60
- package/fesm2022/deferred-content.mjs.map +0 -1
- package/fesm2022/radio-group.mjs +0 -197
- package/fesm2022/radio-group.mjs.map +0 -1
- package/fesm2022/ui-patterns.mjs +0 -2504
- package/fesm2022/ui-patterns.mjs.map +0 -1
- package/types/deferred-content.d.ts +0 -38
- package/types/radio-group.d.ts +0 -82
package/fesm2022/listbox.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listbox.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/aria/listbox/listbox.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n afterRenderEffect,\n booleanAttribute,\n computed,\n contentChildren,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n signal,\n untracked,\n} from '@angular/core';\nimport {ComboboxListboxPattern, ListboxPattern, OptionPattern} from '@angular/aria/ui-patterns';\nimport {Directionality} from '@angular/cdk/bidi';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {_IdGenerator} from '@angular/cdk/a11y';\nimport {ComboboxPopup} from '../combobox';\n\n/**\n * A listbox container.\n *\n * Listboxes are used to display a list of items for a user to select from. The Listbox is meant\n * to be used in conjunction with Option as follows:\n *\n * ```html\n * <ul ngListbox>\n * <li [value]=\"1\" ngOption>Item 1</li>\n * <li [value]=\"2\" ngOption>Item 2</li>\n * <li [value]=\"3\" ngOption>Item 3</li>\n * </ul>\n * ```\n */\n@Directive({\n selector: '[ngListbox]',\n exportAs: 'ngListbox',\n host: {\n 'role': 'listbox',\n 'class': 'ng-listbox',\n '[attr.id]': 'id()',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.aria-readonly]': 'pattern.readonly()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n '[attr.aria-orientation]': 'pattern.orientation()',\n '[attr.aria-multiselectable]': 'pattern.multi()',\n '[attr.aria-activedescendant]': 'pattern.activedescendant()',\n '(keydown)': 'pattern.onKeydown($event)',\n '(pointerdown)': 'pattern.onPointerdown($event)',\n '(focusin)': 'onFocus()',\n },\n hostDirectives: [{directive: ComboboxPopup}],\n})\nexport class Listbox<V> {\n /** A unique identifier for the listbox. */\n private readonly _generatedId = inject(_IdGenerator).getId('ng-listbox-');\n\n // TODO(wagnermaciel): https://github.com/angular/components/pull/30495#discussion_r1972601144.\n /** A unique identifier for the listbox. */\n protected id = computed(() => this._generatedId);\n\n /** A reference to the parent combobox popup, if one exists. */\n private readonly _popup = inject<ComboboxPopup<V>>(ComboboxPopup, {\n optional: true,\n });\n\n /** A reference to the listbox element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The directionality (LTR / RTL) context for the application (or a subtree of it). */\n private readonly _directionality = inject(Directionality);\n\n /** The Options nested inside of the Listbox. */\n private readonly _options = contentChildren(Option, {descendants: true});\n\n /** A signal wrapper for directionality. */\n protected textDirection = toSignal(this._directionality.change, {\n initialValue: this._directionality.value,\n });\n\n /** The Option UIPatterns of the child Options. */\n protected items = computed(() => this._options().map(option => option.pattern));\n\n /** Whether the list is vertically or horizontally oriented. */\n orientation = input<'vertical' | 'horizontal'>('vertical');\n\n /** Whether multiple items in the list can be selected at once. */\n multi = input(false, {transform: booleanAttribute});\n\n /** Whether focus should wrap when navigating. */\n wrap = input(true, {transform: booleanAttribute});\n\n /** Whether disabled items in the list should be skipped when navigating. */\n skipDisabled = input(true, {transform: booleanAttribute});\n\n /** The focus strategy used by the list. */\n focusMode = input<'roving' | 'activedescendant'>('roving');\n\n /** The selection strategy used by the list. */\n selectionMode = input<'follow' | 'explicit'>('follow');\n\n /** The amount of time before the typeahead search is reset. */\n typeaheadDelay = input<number>(0.5); // Picked arbitrarily.\n\n /** Whether the listbox is disabled. */\n disabled = input(false, {transform: booleanAttribute});\n\n /** Whether the listbox is readonly. */\n readonly = input(false, {transform: booleanAttribute});\n\n /** The values of the current selected items. */\n value = model<V[]>([]);\n\n /** The Listbox UIPattern. */\n pattern: ListboxPattern<V>;\n\n /** Whether the listbox has received focus yet. */\n private _hasFocused = signal(false);\n\n constructor() {\n const inputs = {\n ...this,\n id: this.id,\n items: this.items,\n activeItem: signal(undefined),\n textDirection: this.textDirection,\n element: () => this._elementRef.nativeElement,\n combobox: () => this._popup?.combobox?.pattern,\n };\n\n this.pattern = this._popup?.combobox\n ? new ComboboxListboxPattern<V>(inputs)\n : new ListboxPattern<V>(inputs);\n\n if (this._popup) {\n this._popup.controls.set(this.pattern as ComboboxListboxPattern<V>);\n }\n\n afterRenderEffect(() => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const violations = this.pattern.validate();\n for (const violation of violations) {\n console.error(violation);\n }\n }\n });\n\n afterRenderEffect(() => {\n if (!this._hasFocused()) {\n this.pattern.setDefaultState();\n }\n });\n\n // Ensure that if the active item is removed from\n // the list, the listbox updates it's focus state.\n afterRenderEffect(() => {\n const items = inputs.items();\n const activeItem = untracked(() => inputs.activeItem());\n\n if (!items.some(i => i === activeItem) && activeItem) {\n this.pattern.listBehavior.unfocus();\n }\n });\n\n // Ensure that the value is always in sync with the available options.\n afterRenderEffect(() => {\n const items = inputs.items();\n const value = untracked(() => this.value());\n\n if (items && value.some(v => !items.some(i => i.value() === v))) {\n this.value.set(value.filter(v => items.some(i => i.value() === v)));\n }\n });\n }\n\n onFocus() {\n this._hasFocused.set(true);\n }\n}\n\n/** A selectable option in a Listbox. */\n@Directive({\n selector: '[ngOption]',\n exportAs: 'ngOption',\n host: {\n 'role': 'option',\n 'class': 'ng-option',\n '[attr.data-active]': 'pattern.active()',\n '[attr.id]': 'pattern.id()',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.aria-selected]': 'pattern.selected()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n },\n})\nexport class Option<V> {\n /** A reference to the option element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The parent Listbox. */\n private readonly _listbox = inject(Listbox);\n\n /** A unique identifier for the option. */\n private readonly _generatedId = inject(_IdGenerator).getId('ng-option-');\n\n // TODO(wagnermaciel): https://github.com/angular/components/pull/30495#discussion_r1972601144.\n /** A unique identifier for the option. */\n protected id = computed(() => this._generatedId);\n\n // TODO(wagnermaciel): See if we want to change how we handle this since textContent is not\n // reactive. See https://github.com/angular/components/pull/30495#discussion_r1961260216.\n /** The text used by the typeahead search. */\n protected searchTerm = computed(() => this.label() ?? this.element().textContent);\n\n /** The parent Listbox UIPattern. */\n protected listbox = computed(() => this._listbox.pattern);\n\n /** A reference to the option element to be focused on navigation. */\n protected element = computed(() => this._elementRef.nativeElement);\n\n /** The value of the option. */\n value = input.required<V>();\n\n /** Whether an item is disabled. */\n disabled = input(false, {transform: booleanAttribute});\n\n /** The text used by the typeahead search. */\n label = input<string>();\n\n /** The Option UIPattern. */\n pattern = new OptionPattern<V>({\n ...this,\n id: this.id,\n value: this.value,\n listbox: this.listbox,\n element: this.element,\n searchTerm: this.searchTerm,\n });\n}\n"],"names":["i1.ComboboxPopup"],"mappings":";;;;;;;;;AA2BA;;;;;;;;;;;;;AAaG;MAoBU,OAAO,CAAA;;IAED,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;;;IAI/D,EAAE,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,IAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAC;;AAG/B,IAAA,MAAM,GAAG,MAAM,CAAmB,aAAa,EAAE;AAChE,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA,CAAC;;AAGe,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;;AAGhC,IAAA,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC;;AAGxC,IAAA,QAAQ,GAAG,eAAe,CAAC,MAAM,4CAAG,WAAW,EAAE,IAAI,EAAA,CAAA,GAAA,CAAlB,EAAC,WAAW,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"version":3,"file":"listbox.mjs","sources":["../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/aria/listbox/listbox.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n afterRenderEffect,\n booleanAttribute,\n computed,\n contentChildren,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n signal,\n untracked,\n} from '@angular/core';\nimport {ComboboxListboxPattern, ListboxPattern, OptionPattern} from '@angular/aria/private';\nimport {Directionality} from '@angular/cdk/bidi';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {_IdGenerator} from '@angular/cdk/a11y';\nimport {ComboboxPopup} from '../combobox';\n\n/**\n * A listbox container.\n *\n * Listboxes are used to display a list of items for a user to select from. The Listbox is meant\n * to be used in conjunction with Option as follows:\n *\n * ```html\n * <ul ngListbox>\n * <li [value]=\"1\" ngOption>Item 1</li>\n * <li [value]=\"2\" ngOption>Item 2</li>\n * <li [value]=\"3\" ngOption>Item 3</li>\n * </ul>\n * ```\n */\n@Directive({\n selector: '[ngListbox]',\n exportAs: 'ngListbox',\n host: {\n 'role': 'listbox',\n 'class': 'ng-listbox',\n '[attr.id]': 'id()',\n '[attr.tabindex]': '_pattern.tabIndex()',\n '[attr.aria-readonly]': '_pattern.readonly()',\n '[attr.aria-disabled]': '_pattern.disabled()',\n '[attr.aria-orientation]': '_pattern.orientation()',\n '[attr.aria-multiselectable]': '_pattern.multi()',\n '[attr.aria-activedescendant]': '_pattern.activeDescendant()',\n '(keydown)': '_pattern.onKeydown($event)',\n '(pointerdown)': '_pattern.onPointerdown($event)',\n '(focusin)': 'onFocus()',\n },\n hostDirectives: [{directive: ComboboxPopup}],\n})\nexport class Listbox<V> {\n /** A unique identifier for the listbox. */\n private readonly _generatedId = inject(_IdGenerator).getId('ng-listbox-', true);\n\n // TODO(wagnermaciel): https://github.com/angular/components/pull/30495#discussion_r1972601144.\n /** A unique identifier for the listbox. */\n protected id = computed(() => this._generatedId);\n\n /** A reference to the parent combobox popup, if one exists. */\n private readonly _popup = inject<ComboboxPopup<V>>(ComboboxPopup, {\n optional: true,\n });\n\n /** A reference to the listbox element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The directionality (LTR / RTL) context for the application (or a subtree of it). */\n private readonly _directionality = inject(Directionality);\n\n /** The Options nested inside of the Listbox. */\n private readonly _options = contentChildren(Option, {descendants: true});\n\n /** A signal wrapper for directionality. */\n protected textDirection = toSignal(this._directionality.change, {\n initialValue: this._directionality.value,\n });\n\n /** The Option UIPatterns of the child Options. */\n protected items = computed(() => this._options().map(option => option._pattern));\n\n /** Whether the list is vertically or horizontally oriented. */\n orientation = input<'vertical' | 'horizontal'>('vertical');\n\n /** Whether multiple items in the list can be selected at once. */\n multi = input(false, {transform: booleanAttribute});\n\n /** Whether focus should wrap when navigating. */\n wrap = input(true, {transform: booleanAttribute});\n\n /** Whether to allow disabled items in the list to receive focus. */\n softDisabled = input(true, {transform: booleanAttribute});\n\n /** The focus strategy used by the list. */\n focusMode = input<'roving' | 'activedescendant'>('roving');\n\n /** The selection strategy used by the list. */\n selectionMode = input<'follow' | 'explicit'>('follow');\n\n /** The amount of time before the typeahead search is reset. */\n typeaheadDelay = input<number>(0.5); // Picked arbitrarily.\n\n /** Whether the listbox is disabled. */\n disabled = input(false, {transform: booleanAttribute});\n\n /** Whether the listbox is readonly. */\n readonly = input(false, {transform: booleanAttribute});\n\n /** The values of the current selected items. */\n value = model<V[]>([]);\n\n /** The Listbox UIPattern. */\n readonly _pattern: ListboxPattern<V>;\n\n /** Whether the listbox has received focus yet. */\n private _hasFocused = signal(false);\n\n constructor() {\n const inputs = {\n ...this,\n id: this.id,\n items: this.items,\n activeItem: signal(undefined),\n textDirection: this.textDirection,\n element: () => this._elementRef.nativeElement,\n combobox: () => this._popup?.combobox?._pattern,\n };\n\n this._pattern = this._popup?.combobox\n ? new ComboboxListboxPattern<V>(inputs)\n : new ListboxPattern<V>(inputs);\n\n if (this._popup) {\n this._popup.controls.set(this._pattern as ComboboxListboxPattern<V>);\n }\n\n afterRenderEffect(() => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const violations = this._pattern.validate();\n for (const violation of violations) {\n console.error(violation);\n }\n }\n });\n\n afterRenderEffect(() => {\n if (!this._hasFocused()) {\n this._pattern.setDefaultState();\n }\n });\n\n // Ensure that if the active item is removed from\n // the list, the listbox updates it's focus state.\n afterRenderEffect(() => {\n const items = inputs.items();\n const activeItem = untracked(() => inputs.activeItem());\n\n if (!items.some(i => i === activeItem) && activeItem) {\n this._pattern.listBehavior.unfocus();\n }\n });\n\n // Ensure that the value is always in sync with the available options.\n afterRenderEffect(() => {\n const items = inputs.items();\n const value = untracked(() => this.value());\n\n if (items && value.some(v => !items.some(i => i.value() === v))) {\n this.value.set(value.filter(v => items.some(i => i.value() === v)));\n }\n });\n }\n\n onFocus() {\n this._hasFocused.set(true);\n }\n\n scrollActiveItemIntoView(options: ScrollIntoViewOptions = {block: 'nearest'}) {\n this._pattern.inputs.activeItem()?.element()?.scrollIntoView(options);\n }\n}\n\n/** A selectable option in a Listbox. */\n@Directive({\n selector: '[ngOption]',\n exportAs: 'ngOption',\n host: {\n 'role': 'option',\n 'class': 'ng-option',\n '[attr.data-active]': '_pattern.active()',\n '[attr.id]': '_pattern.id()',\n '[attr.tabindex]': '_pattern.tabIndex()',\n '[attr.aria-selected]': '_pattern.selected()',\n '[attr.aria-disabled]': '_pattern.disabled()',\n },\n})\nexport class Option<V> {\n /** A reference to the option element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The parent Listbox. */\n private readonly _listbox = inject(Listbox);\n\n /** A unique identifier for the option. */\n private readonly _generatedId = inject(_IdGenerator).getId('ng-option-', true);\n\n // TODO(wagnermaciel): https://github.com/angular/components/pull/30495#discussion_r1972601144.\n /** A unique identifier for the option. */\n protected id = computed(() => this._generatedId);\n\n // TODO(wagnermaciel): See if we want to change how we handle this since textContent is not\n // reactive. See https://github.com/angular/components/pull/30495#discussion_r1961260216.\n /** The text used by the typeahead search. */\n protected searchTerm = computed(() => this.label() ?? this.element().textContent);\n\n /** The parent Listbox UIPattern. */\n protected listbox = computed(() => this._listbox._pattern);\n\n /** A reference to the option element to be focused on navigation. */\n protected element = computed(() => this._elementRef.nativeElement);\n\n /** The value of the option. */\n value = input.required<V>();\n\n /** Whether an item is disabled. */\n disabled = input(false, {transform: booleanAttribute});\n\n /** The text used by the typeahead search. */\n label = input<string>();\n\n /** Whether the option is selected. */\n readonly selected = computed(() => this._pattern.selected());\n\n /** The Option UIPattern. */\n readonly _pattern = new OptionPattern<V>({\n ...this,\n id: this.id,\n value: this.value,\n listbox: this.listbox,\n element: this.element,\n searchTerm: this.searchTerm,\n });\n}\n"],"names":["Listbox","_generatedId","inject","_IdGenerator","getId","id","computed","ngDevMode","debugName","_popup","ComboboxPopup","optional","_elementRef","ElementRef","_directionality","Directionality","_options","contentChildren","Option","descendants","textDirection","toSignal","change","initialValue","value","items","map","option","_pattern","orientation","input","multi","transform","booleanAttribute","wrap","softDisabled","focusMode","selectionMode","typeaheadDelay","disabled","readonly","model","_hasFocused","signal","constructor","inputs","activeItem","undefined","element","nativeElement","combobox","ComboboxListboxPattern","ListboxPattern","controls","set","afterRenderEffect","violations","validate","violation","console","error","setDefaultState","untracked","some","i","listBehavior","unfocus","v","filter","onFocus","scrollActiveItemIntoView","options","block","scrollIntoView","deps","target","i0","ɵɵFactoryTarget","Directive","ɵdir","ɵɵngDeclareDirective","minVersion","version","type","isSignal","exportAs","hostDirectives","directive","i1","ngImport","decorators","args","selector","host","_listbox","searchTerm","label","textContent","listbox","required","selected","OptionPattern","isStandalone","classPropertyName","publicName","isRequired","transformFunction","attributes","properties","classAttribute"],"mappings":";;;;;;;;MA4DaA,OAAO,CAAA;EAEDC,YAAY,GAAGC,MAAM,CAACC,YAAY,CAAC,CAACC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC;EAIrEC,EAAE,G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QAAA,OAAO,EAAE,WAAW;AACpB,QAAA,oBAAoB,EAAE,mBAAmB;AACzC,QAAA,WAAW,EAAE,eAAe;AAC5B,QAAA,iBAAiB,EAAE,qBAAqB;AACxC,QAAA,sBAAsB,EAAE,qBAAqB;AAC7C,QAAA,sBAAsB,EAAE;AACzB;KACF;;;;;;"}
|
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, input, signal, computed, effect, Directive, contentChildren, output, afterRenderEffect, untracked, model } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/aria/private';
|
|
4
|
+
import { MenuTriggerPattern, DeferredContentAware, MenuPattern, MenuBarPattern, MenuItemPattern, DeferredContent } from '@angular/aria/private';
|
|
5
|
+
import { _IdGenerator } from '@angular/cdk/a11y';
|
|
6
|
+
import { Directionality } from '@angular/cdk/bidi';
|
|
7
|
+
|
|
8
|
+
class MenuTrigger {
|
|
9
|
+
_elementRef = inject(ElementRef);
|
|
10
|
+
textDirection = inject(Directionality).valueSignal;
|
|
11
|
+
element = this._elementRef.nativeElement;
|
|
12
|
+
menu = input(undefined, ...(ngDevMode ? [{
|
|
13
|
+
debugName: "menu"
|
|
14
|
+
}] : []));
|
|
15
|
+
hasBeenFocused = signal(false, ...(ngDevMode ? [{
|
|
16
|
+
debugName: "hasBeenFocused"
|
|
17
|
+
}] : []));
|
|
18
|
+
_pattern = new MenuTriggerPattern({
|
|
19
|
+
textDirection: this.textDirection,
|
|
20
|
+
element: computed(() => this._elementRef.nativeElement),
|
|
21
|
+
menu: computed(() => this.menu()?._pattern)
|
|
22
|
+
});
|
|
23
|
+
constructor() {
|
|
24
|
+
effect(() => this.menu()?.parent.set(this));
|
|
25
|
+
}
|
|
26
|
+
onFocusIn() {
|
|
27
|
+
this.hasBeenFocused.set(true);
|
|
28
|
+
}
|
|
29
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
30
|
+
minVersion: "12.0.0",
|
|
31
|
+
version: "20.2.0-next.2",
|
|
32
|
+
ngImport: i0,
|
|
33
|
+
type: MenuTrigger,
|
|
34
|
+
deps: [],
|
|
35
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
36
|
+
});
|
|
37
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
38
|
+
minVersion: "17.1.0",
|
|
39
|
+
version: "20.2.0-next.2",
|
|
40
|
+
type: MenuTrigger,
|
|
41
|
+
isStandalone: true,
|
|
42
|
+
selector: "button[ngMenuTrigger]",
|
|
43
|
+
inputs: {
|
|
44
|
+
menu: {
|
|
45
|
+
classPropertyName: "menu",
|
|
46
|
+
publicName: "menu",
|
|
47
|
+
isSignal: true,
|
|
48
|
+
isRequired: false,
|
|
49
|
+
transformFunction: null
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
host: {
|
|
53
|
+
listeners: {
|
|
54
|
+
"click": "_pattern.onClick()",
|
|
55
|
+
"keydown": "_pattern.onKeydown($event)",
|
|
56
|
+
"focusout": "_pattern.onFocusOut($event)",
|
|
57
|
+
"focusin": "onFocusIn()"
|
|
58
|
+
},
|
|
59
|
+
properties: {
|
|
60
|
+
"attr.tabindex": "_pattern.tabIndex()",
|
|
61
|
+
"attr.aria-haspopup": "_pattern.hasPopup()",
|
|
62
|
+
"attr.aria-expanded": "_pattern.expanded()",
|
|
63
|
+
"attr.aria-controls": "_pattern.menu()?.id()"
|
|
64
|
+
},
|
|
65
|
+
classAttribute: "ng-menu-trigger"
|
|
66
|
+
},
|
|
67
|
+
exportAs: ["ngMenuTrigger"],
|
|
68
|
+
ngImport: i0
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
72
|
+
minVersion: "12.0.0",
|
|
73
|
+
version: "20.2.0-next.2",
|
|
74
|
+
ngImport: i0,
|
|
75
|
+
type: MenuTrigger,
|
|
76
|
+
decorators: [{
|
|
77
|
+
type: Directive,
|
|
78
|
+
args: [{
|
|
79
|
+
selector: 'button[ngMenuTrigger]',
|
|
80
|
+
exportAs: 'ngMenuTrigger',
|
|
81
|
+
host: {
|
|
82
|
+
'class': 'ng-menu-trigger',
|
|
83
|
+
'[attr.tabindex]': '_pattern.tabIndex()',
|
|
84
|
+
'[attr.aria-haspopup]': '_pattern.hasPopup()',
|
|
85
|
+
'[attr.aria-expanded]': '_pattern.expanded()',
|
|
86
|
+
'[attr.aria-controls]': '_pattern.menu()?.id()',
|
|
87
|
+
'(click)': '_pattern.onClick()',
|
|
88
|
+
'(keydown)': '_pattern.onKeydown($event)',
|
|
89
|
+
'(focusout)': '_pattern.onFocusOut($event)',
|
|
90
|
+
'(focusin)': 'onFocusIn()'
|
|
91
|
+
}
|
|
92
|
+
}]
|
|
93
|
+
}],
|
|
94
|
+
ctorParameters: () => []
|
|
95
|
+
});
|
|
96
|
+
class Menu {
|
|
97
|
+
_deferredContentAware = inject(DeferredContentAware, {
|
|
98
|
+
optional: true
|
|
99
|
+
});
|
|
100
|
+
_allItems = contentChildren(MenuItem, ...(ngDevMode ? [{
|
|
101
|
+
debugName: "_allItems",
|
|
102
|
+
descendants: true
|
|
103
|
+
}] : [{
|
|
104
|
+
descendants: true
|
|
105
|
+
}]));
|
|
106
|
+
_items = computed(() => this._allItems().filter(i => i.parent === this), ...(ngDevMode ? [{
|
|
107
|
+
debugName: "_items"
|
|
108
|
+
}] : []));
|
|
109
|
+
_elementRef = inject(ElementRef);
|
|
110
|
+
element = this._elementRef.nativeElement;
|
|
111
|
+
textDirection = inject(Directionality).valueSignal;
|
|
112
|
+
id = input(inject(_IdGenerator).getId('ng-menu-', true), ...(ngDevMode ? [{
|
|
113
|
+
debugName: "id"
|
|
114
|
+
}] : []));
|
|
115
|
+
wrap = input(true, ...(ngDevMode ? [{
|
|
116
|
+
debugName: "wrap"
|
|
117
|
+
}] : []));
|
|
118
|
+
typeaheadDelay = input(0.5, ...(ngDevMode ? [{
|
|
119
|
+
debugName: "typeaheadDelay"
|
|
120
|
+
}] : []));
|
|
121
|
+
parent = signal(undefined, ...(ngDevMode ? [{
|
|
122
|
+
debugName: "parent"
|
|
123
|
+
}] : []));
|
|
124
|
+
_pattern;
|
|
125
|
+
items = () => this._items().map(i => i._pattern);
|
|
126
|
+
isVisible = computed(() => this._pattern.isVisible(), ...(ngDevMode ? [{
|
|
127
|
+
debugName: "isVisible"
|
|
128
|
+
}] : []));
|
|
129
|
+
onSelect = output();
|
|
130
|
+
constructor() {
|
|
131
|
+
this._pattern = new MenuPattern({
|
|
132
|
+
...this,
|
|
133
|
+
parent: computed(() => this.parent()?._pattern),
|
|
134
|
+
multi: () => false,
|
|
135
|
+
softDisabled: () => true,
|
|
136
|
+
focusMode: () => 'roving',
|
|
137
|
+
orientation: () => 'vertical',
|
|
138
|
+
selectionMode: () => 'explicit',
|
|
139
|
+
activeItem: signal(undefined),
|
|
140
|
+
element: computed(() => this._elementRef.nativeElement),
|
|
141
|
+
onSelect: value => this.onSelect.emit(value)
|
|
142
|
+
});
|
|
143
|
+
afterRenderEffect(() => {
|
|
144
|
+
const parent = this.parent();
|
|
145
|
+
if (parent instanceof MenuItem && parent.parent instanceof MenuBar) {
|
|
146
|
+
this._deferredContentAware?.contentVisible.set(true);
|
|
147
|
+
} else {
|
|
148
|
+
this._deferredContentAware?.contentVisible.set(this._pattern.isVisible() || !!this.parent()?.hasBeenFocused());
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
afterRenderEffect(() => {
|
|
152
|
+
if (this._pattern.isVisible()) {
|
|
153
|
+
const activeItem = untracked(() => this._pattern.inputs.activeItem());
|
|
154
|
+
this._pattern.listBehavior.goto(activeItem);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
afterRenderEffect(() => {
|
|
158
|
+
if (!this._pattern.hasBeenFocused()) {
|
|
159
|
+
this._pattern.setDefaultState();
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
close(opts) {
|
|
164
|
+
this._pattern.inputs.parent()?.close(opts);
|
|
165
|
+
}
|
|
166
|
+
closeAll(opts) {
|
|
167
|
+
const root = this._pattern.root();
|
|
168
|
+
if (root instanceof MenuTriggerPattern) {
|
|
169
|
+
root.close(opts);
|
|
170
|
+
}
|
|
171
|
+
if (root instanceof MenuPattern || root instanceof MenuBarPattern) {
|
|
172
|
+
root.inputs.activeItem()?.close(opts);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
176
|
+
minVersion: "12.0.0",
|
|
177
|
+
version: "20.2.0-next.2",
|
|
178
|
+
ngImport: i0,
|
|
179
|
+
type: Menu,
|
|
180
|
+
deps: [],
|
|
181
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
182
|
+
});
|
|
183
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
184
|
+
minVersion: "17.2.0",
|
|
185
|
+
version: "20.2.0-next.2",
|
|
186
|
+
type: Menu,
|
|
187
|
+
isStandalone: true,
|
|
188
|
+
selector: "[ngMenu]",
|
|
189
|
+
inputs: {
|
|
190
|
+
id: {
|
|
191
|
+
classPropertyName: "id",
|
|
192
|
+
publicName: "id",
|
|
193
|
+
isSignal: true,
|
|
194
|
+
isRequired: false,
|
|
195
|
+
transformFunction: null
|
|
196
|
+
},
|
|
197
|
+
wrap: {
|
|
198
|
+
classPropertyName: "wrap",
|
|
199
|
+
publicName: "wrap",
|
|
200
|
+
isSignal: true,
|
|
201
|
+
isRequired: false,
|
|
202
|
+
transformFunction: null
|
|
203
|
+
},
|
|
204
|
+
typeaheadDelay: {
|
|
205
|
+
classPropertyName: "typeaheadDelay",
|
|
206
|
+
publicName: "typeaheadDelay",
|
|
207
|
+
isSignal: true,
|
|
208
|
+
isRequired: false,
|
|
209
|
+
transformFunction: null
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
outputs: {
|
|
213
|
+
onSelect: "onSelect"
|
|
214
|
+
},
|
|
215
|
+
host: {
|
|
216
|
+
attributes: {
|
|
217
|
+
"role": "menu"
|
|
218
|
+
},
|
|
219
|
+
listeners: {
|
|
220
|
+
"keydown": "_pattern.onKeydown($event)",
|
|
221
|
+
"mouseover": "_pattern.onMouseOver($event)",
|
|
222
|
+
"mouseout": "_pattern.onMouseOut($event)",
|
|
223
|
+
"focusout": "_pattern.onFocusOut($event)",
|
|
224
|
+
"focusin": "_pattern.onFocusIn()",
|
|
225
|
+
"click": "_pattern.onClick($event)"
|
|
226
|
+
},
|
|
227
|
+
properties: {
|
|
228
|
+
"attr.id": "_pattern.id()",
|
|
229
|
+
"attr.data-visible": "_pattern.isVisible()"
|
|
230
|
+
},
|
|
231
|
+
classAttribute: "ng-menu"
|
|
232
|
+
},
|
|
233
|
+
queries: [{
|
|
234
|
+
propertyName: "_allItems",
|
|
235
|
+
predicate: MenuItem,
|
|
236
|
+
descendants: true,
|
|
237
|
+
isSignal: true
|
|
238
|
+
}],
|
|
239
|
+
exportAs: ["ngMenu"],
|
|
240
|
+
hostDirectives: [{
|
|
241
|
+
directive: i1.DeferredContentAware,
|
|
242
|
+
inputs: ["preserveContent", "preserveContent"]
|
|
243
|
+
}],
|
|
244
|
+
ngImport: i0
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
248
|
+
minVersion: "12.0.0",
|
|
249
|
+
version: "20.2.0-next.2",
|
|
250
|
+
ngImport: i0,
|
|
251
|
+
type: Menu,
|
|
252
|
+
decorators: [{
|
|
253
|
+
type: Directive,
|
|
254
|
+
args: [{
|
|
255
|
+
selector: '[ngMenu]',
|
|
256
|
+
exportAs: 'ngMenu',
|
|
257
|
+
host: {
|
|
258
|
+
'role': 'menu',
|
|
259
|
+
'class': 'ng-menu',
|
|
260
|
+
'[attr.id]': '_pattern.id()',
|
|
261
|
+
'[attr.data-visible]': '_pattern.isVisible()',
|
|
262
|
+
'(keydown)': '_pattern.onKeydown($event)',
|
|
263
|
+
'(mouseover)': '_pattern.onMouseOver($event)',
|
|
264
|
+
'(mouseout)': '_pattern.onMouseOut($event)',
|
|
265
|
+
'(focusout)': '_pattern.onFocusOut($event)',
|
|
266
|
+
'(focusin)': '_pattern.onFocusIn()',
|
|
267
|
+
'(click)': '_pattern.onClick($event)'
|
|
268
|
+
},
|
|
269
|
+
hostDirectives: [{
|
|
270
|
+
directive: DeferredContentAware,
|
|
271
|
+
inputs: ['preserveContent']
|
|
272
|
+
}]
|
|
273
|
+
}]
|
|
274
|
+
}],
|
|
275
|
+
ctorParameters: () => []
|
|
276
|
+
});
|
|
277
|
+
class MenuBar {
|
|
278
|
+
_allItems = contentChildren(MenuItem, ...(ngDevMode ? [{
|
|
279
|
+
debugName: "_allItems",
|
|
280
|
+
descendants: true
|
|
281
|
+
}] : [{
|
|
282
|
+
descendants: true
|
|
283
|
+
}]));
|
|
284
|
+
_items = () => this._allItems().filter(i => i.parent === this);
|
|
285
|
+
_elementRef = inject(ElementRef);
|
|
286
|
+
element = this._elementRef.nativeElement;
|
|
287
|
+
textDirection = inject(Directionality).valueSignal;
|
|
288
|
+
value = model([], ...(ngDevMode ? [{
|
|
289
|
+
debugName: "value"
|
|
290
|
+
}] : []));
|
|
291
|
+
wrap = input(true, ...(ngDevMode ? [{
|
|
292
|
+
debugName: "wrap"
|
|
293
|
+
}] : []));
|
|
294
|
+
typeaheadDelay = input(0.5, ...(ngDevMode ? [{
|
|
295
|
+
debugName: "typeaheadDelay"
|
|
296
|
+
}] : []));
|
|
297
|
+
_pattern;
|
|
298
|
+
items = signal([], ...(ngDevMode ? [{
|
|
299
|
+
debugName: "items"
|
|
300
|
+
}] : []));
|
|
301
|
+
onSelect = output();
|
|
302
|
+
constructor() {
|
|
303
|
+
this._pattern = new MenuBarPattern({
|
|
304
|
+
...this,
|
|
305
|
+
multi: () => false,
|
|
306
|
+
softDisabled: () => true,
|
|
307
|
+
focusMode: () => 'roving',
|
|
308
|
+
orientation: () => 'horizontal',
|
|
309
|
+
selectionMode: () => 'explicit',
|
|
310
|
+
onSelect: value => this.onSelect.emit(value),
|
|
311
|
+
activeItem: signal(undefined),
|
|
312
|
+
element: computed(() => this._elementRef.nativeElement)
|
|
313
|
+
});
|
|
314
|
+
afterRenderEffect(() => {
|
|
315
|
+
this.items.set(this._items().map(i => i._pattern));
|
|
316
|
+
});
|
|
317
|
+
afterRenderEffect(() => {
|
|
318
|
+
if (!this._pattern.hasBeenFocused()) {
|
|
319
|
+
this._pattern.setDefaultState();
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
324
|
+
minVersion: "12.0.0",
|
|
325
|
+
version: "20.2.0-next.2",
|
|
326
|
+
ngImport: i0,
|
|
327
|
+
type: MenuBar,
|
|
328
|
+
deps: [],
|
|
329
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
330
|
+
});
|
|
331
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
332
|
+
minVersion: "17.2.0",
|
|
333
|
+
version: "20.2.0-next.2",
|
|
334
|
+
type: MenuBar,
|
|
335
|
+
isStandalone: true,
|
|
336
|
+
selector: "[ngMenuBar]",
|
|
337
|
+
inputs: {
|
|
338
|
+
value: {
|
|
339
|
+
classPropertyName: "value",
|
|
340
|
+
publicName: "value",
|
|
341
|
+
isSignal: true,
|
|
342
|
+
isRequired: false,
|
|
343
|
+
transformFunction: null
|
|
344
|
+
},
|
|
345
|
+
wrap: {
|
|
346
|
+
classPropertyName: "wrap",
|
|
347
|
+
publicName: "wrap",
|
|
348
|
+
isSignal: true,
|
|
349
|
+
isRequired: false,
|
|
350
|
+
transformFunction: null
|
|
351
|
+
},
|
|
352
|
+
typeaheadDelay: {
|
|
353
|
+
classPropertyName: "typeaheadDelay",
|
|
354
|
+
publicName: "typeaheadDelay",
|
|
355
|
+
isSignal: true,
|
|
356
|
+
isRequired: false,
|
|
357
|
+
transformFunction: null
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
outputs: {
|
|
361
|
+
value: "valueChange",
|
|
362
|
+
onSelect: "onSelect"
|
|
363
|
+
},
|
|
364
|
+
host: {
|
|
365
|
+
attributes: {
|
|
366
|
+
"role": "menubar"
|
|
367
|
+
},
|
|
368
|
+
listeners: {
|
|
369
|
+
"keydown": "_pattern.onKeydown($event)",
|
|
370
|
+
"mouseover": "_pattern.onMouseOver($event)",
|
|
371
|
+
"click": "_pattern.onClick($event)",
|
|
372
|
+
"focusin": "_pattern.onFocusIn()",
|
|
373
|
+
"focusout": "_pattern.onFocusOut($event)"
|
|
374
|
+
},
|
|
375
|
+
classAttribute: "ng-menu-bar"
|
|
376
|
+
},
|
|
377
|
+
queries: [{
|
|
378
|
+
propertyName: "_allItems",
|
|
379
|
+
predicate: MenuItem,
|
|
380
|
+
descendants: true,
|
|
381
|
+
isSignal: true
|
|
382
|
+
}],
|
|
383
|
+
exportAs: ["ngMenuBar"],
|
|
384
|
+
ngImport: i0
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
388
|
+
minVersion: "12.0.0",
|
|
389
|
+
version: "20.2.0-next.2",
|
|
390
|
+
ngImport: i0,
|
|
391
|
+
type: MenuBar,
|
|
392
|
+
decorators: [{
|
|
393
|
+
type: Directive,
|
|
394
|
+
args: [{
|
|
395
|
+
selector: '[ngMenuBar]',
|
|
396
|
+
exportAs: 'ngMenuBar',
|
|
397
|
+
host: {
|
|
398
|
+
'role': 'menubar',
|
|
399
|
+
'class': 'ng-menu-bar',
|
|
400
|
+
'(keydown)': '_pattern.onKeydown($event)',
|
|
401
|
+
'(mouseover)': '_pattern.onMouseOver($event)',
|
|
402
|
+
'(click)': '_pattern.onClick($event)',
|
|
403
|
+
'(focusin)': '_pattern.onFocusIn()',
|
|
404
|
+
'(focusout)': '_pattern.onFocusOut($event)'
|
|
405
|
+
}
|
|
406
|
+
}]
|
|
407
|
+
}],
|
|
408
|
+
ctorParameters: () => []
|
|
409
|
+
});
|
|
410
|
+
class MenuItem {
|
|
411
|
+
_elementRef = inject(ElementRef);
|
|
412
|
+
element = this._elementRef.nativeElement;
|
|
413
|
+
id = input(inject(_IdGenerator).getId('ng-menu-item-', true), ...(ngDevMode ? [{
|
|
414
|
+
debugName: "id"
|
|
415
|
+
}] : []));
|
|
416
|
+
value = input.required(...(ngDevMode ? [{
|
|
417
|
+
debugName: "value"
|
|
418
|
+
}] : []));
|
|
419
|
+
disabled = input(false, ...(ngDevMode ? [{
|
|
420
|
+
debugName: "disabled"
|
|
421
|
+
}] : []));
|
|
422
|
+
searchTerm = model('', ...(ngDevMode ? [{
|
|
423
|
+
debugName: "searchTerm"
|
|
424
|
+
}] : []));
|
|
425
|
+
_menu = inject(Menu, {
|
|
426
|
+
optional: true
|
|
427
|
+
});
|
|
428
|
+
_menuBar = inject(MenuBar, {
|
|
429
|
+
optional: true
|
|
430
|
+
});
|
|
431
|
+
parent = this._menu ?? this._menuBar;
|
|
432
|
+
submenu = input(undefined, ...(ngDevMode ? [{
|
|
433
|
+
debugName: "submenu"
|
|
434
|
+
}] : []));
|
|
435
|
+
hasBeenFocused = signal(false, ...(ngDevMode ? [{
|
|
436
|
+
debugName: "hasBeenFocused"
|
|
437
|
+
}] : []));
|
|
438
|
+
_pattern = new MenuItemPattern({
|
|
439
|
+
id: this.id,
|
|
440
|
+
value: this.value,
|
|
441
|
+
element: computed(() => this._elementRef.nativeElement),
|
|
442
|
+
disabled: this.disabled,
|
|
443
|
+
searchTerm: this.searchTerm,
|
|
444
|
+
parent: computed(() => this.parent?._pattern),
|
|
445
|
+
submenu: computed(() => this.submenu()?._pattern)
|
|
446
|
+
});
|
|
447
|
+
constructor() {
|
|
448
|
+
effect(() => this.submenu()?.parent.set(this));
|
|
449
|
+
}
|
|
450
|
+
onFocusIn() {
|
|
451
|
+
this.hasBeenFocused.set(true);
|
|
452
|
+
}
|
|
453
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
454
|
+
minVersion: "12.0.0",
|
|
455
|
+
version: "20.2.0-next.2",
|
|
456
|
+
ngImport: i0,
|
|
457
|
+
type: MenuItem,
|
|
458
|
+
deps: [],
|
|
459
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
460
|
+
});
|
|
461
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
462
|
+
minVersion: "17.1.0",
|
|
463
|
+
version: "20.2.0-next.2",
|
|
464
|
+
type: MenuItem,
|
|
465
|
+
isStandalone: true,
|
|
466
|
+
selector: "[ngMenuItem]",
|
|
467
|
+
inputs: {
|
|
468
|
+
id: {
|
|
469
|
+
classPropertyName: "id",
|
|
470
|
+
publicName: "id",
|
|
471
|
+
isSignal: true,
|
|
472
|
+
isRequired: false,
|
|
473
|
+
transformFunction: null
|
|
474
|
+
},
|
|
475
|
+
value: {
|
|
476
|
+
classPropertyName: "value",
|
|
477
|
+
publicName: "value",
|
|
478
|
+
isSignal: true,
|
|
479
|
+
isRequired: true,
|
|
480
|
+
transformFunction: null
|
|
481
|
+
},
|
|
482
|
+
disabled: {
|
|
483
|
+
classPropertyName: "disabled",
|
|
484
|
+
publicName: "disabled",
|
|
485
|
+
isSignal: true,
|
|
486
|
+
isRequired: false,
|
|
487
|
+
transformFunction: null
|
|
488
|
+
},
|
|
489
|
+
searchTerm: {
|
|
490
|
+
classPropertyName: "searchTerm",
|
|
491
|
+
publicName: "searchTerm",
|
|
492
|
+
isSignal: true,
|
|
493
|
+
isRequired: false,
|
|
494
|
+
transformFunction: null
|
|
495
|
+
},
|
|
496
|
+
submenu: {
|
|
497
|
+
classPropertyName: "submenu",
|
|
498
|
+
publicName: "submenu",
|
|
499
|
+
isSignal: true,
|
|
500
|
+
isRequired: false,
|
|
501
|
+
transformFunction: null
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
outputs: {
|
|
505
|
+
searchTerm: "searchTermChange"
|
|
506
|
+
},
|
|
507
|
+
host: {
|
|
508
|
+
attributes: {
|
|
509
|
+
"role": "menuitem"
|
|
510
|
+
},
|
|
511
|
+
listeners: {
|
|
512
|
+
"focusin": "onFocusIn()"
|
|
513
|
+
},
|
|
514
|
+
properties: {
|
|
515
|
+
"attr.tabindex": "_pattern.tabIndex()",
|
|
516
|
+
"attr.data-active": "_pattern.isActive()",
|
|
517
|
+
"attr.aria-haspopup": "_pattern.hasPopup()",
|
|
518
|
+
"attr.aria-expanded": "_pattern.expanded()",
|
|
519
|
+
"attr.aria-disabled": "_pattern.disabled()",
|
|
520
|
+
"attr.aria-controls": "_pattern.submenu()?.id()"
|
|
521
|
+
},
|
|
522
|
+
classAttribute: "ng-menu-item"
|
|
523
|
+
},
|
|
524
|
+
exportAs: ["ngMenuItem"],
|
|
525
|
+
ngImport: i0
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
529
|
+
minVersion: "12.0.0",
|
|
530
|
+
version: "20.2.0-next.2",
|
|
531
|
+
ngImport: i0,
|
|
532
|
+
type: MenuItem,
|
|
533
|
+
decorators: [{
|
|
534
|
+
type: Directive,
|
|
535
|
+
args: [{
|
|
536
|
+
selector: '[ngMenuItem]',
|
|
537
|
+
exportAs: 'ngMenuItem',
|
|
538
|
+
host: {
|
|
539
|
+
'role': 'menuitem',
|
|
540
|
+
'class': 'ng-menu-item',
|
|
541
|
+
'(focusin)': 'onFocusIn()',
|
|
542
|
+
'[attr.tabindex]': '_pattern.tabIndex()',
|
|
543
|
+
'[attr.data-active]': '_pattern.isActive()',
|
|
544
|
+
'[attr.aria-haspopup]': '_pattern.hasPopup()',
|
|
545
|
+
'[attr.aria-expanded]': '_pattern.expanded()',
|
|
546
|
+
'[attr.aria-disabled]': '_pattern.disabled()',
|
|
547
|
+
'[attr.aria-controls]': '_pattern.submenu()?.id()'
|
|
548
|
+
}
|
|
549
|
+
}]
|
|
550
|
+
}],
|
|
551
|
+
ctorParameters: () => []
|
|
552
|
+
});
|
|
553
|
+
class MenuContent {
|
|
554
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
555
|
+
minVersion: "12.0.0",
|
|
556
|
+
version: "20.2.0-next.2",
|
|
557
|
+
ngImport: i0,
|
|
558
|
+
type: MenuContent,
|
|
559
|
+
deps: [],
|
|
560
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
561
|
+
});
|
|
562
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
563
|
+
minVersion: "14.0.0",
|
|
564
|
+
version: "20.2.0-next.2",
|
|
565
|
+
type: MenuContent,
|
|
566
|
+
isStandalone: true,
|
|
567
|
+
selector: "ng-template[ngMenuContent]",
|
|
568
|
+
exportAs: ["ngMenuContent"],
|
|
569
|
+
hostDirectives: [{
|
|
570
|
+
directive: i1.DeferredContent
|
|
571
|
+
}],
|
|
572
|
+
ngImport: i0
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
576
|
+
minVersion: "12.0.0",
|
|
577
|
+
version: "20.2.0-next.2",
|
|
578
|
+
ngImport: i0,
|
|
579
|
+
type: MenuContent,
|
|
580
|
+
decorators: [{
|
|
581
|
+
type: Directive,
|
|
582
|
+
args: [{
|
|
583
|
+
selector: 'ng-template[ngMenuContent]',
|
|
584
|
+
exportAs: 'ngMenuContent',
|
|
585
|
+
hostDirectives: [DeferredContent]
|
|
586
|
+
}]
|
|
587
|
+
}]
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
export { Menu, MenuBar, MenuContent, MenuItem, MenuTrigger };
|
|
591
|
+
//# sourceMappingURL=menu.mjs.map
|