@angular/aria 22.0.0-next.4 → 22.0.0-next.6
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/fesm2022/_accordion-chunk.mjs +5 -5
- package/fesm2022/_accordion-chunk.mjs.map +1 -1
- package/fesm2022/_click-event-manager-chunk.mjs.map +1 -1
- package/fesm2022/_combobox-chunk.mjs +5 -5
- package/fesm2022/_combobox-chunk.mjs.map +1 -1
- package/fesm2022/_combobox-listbox-chunk.mjs +1 -1
- package/fesm2022/_combobox-listbox-chunk.mjs.map +1 -1
- package/fesm2022/_combobox-tree-chunk.mjs +6 -6
- package/fesm2022/_combobox-tree-chunk.mjs.map +1 -1
- package/fesm2022/_deferred-content-chunk.mjs.map +1 -1
- package/fesm2022/_element-chunk.mjs +6 -0
- package/fesm2022/_element-chunk.mjs.map +1 -0
- package/fesm2022/_expansion-chunk.mjs.map +1 -1
- package/fesm2022/_list-chunk.mjs.map +1 -1
- package/fesm2022/_list-navigation-chunk.mjs.map +1 -1
- package/fesm2022/_list-typeahead-chunk.mjs.map +1 -1
- package/fesm2022/_menu-chunk.mjs.map +1 -1
- package/fesm2022/_pointer-event-manager-chunk.mjs.map +1 -1
- package/fesm2022/_signal-like-chunk.mjs.map +1 -1
- package/fesm2022/_tabs-chunk.mjs +1 -1
- package/fesm2022/_tabs-chunk.mjs.map +1 -1
- package/fesm2022/_toolbar-widget-group-chunk.mjs.map +1 -1
- package/fesm2022/_widget-chunk.mjs +12 -166
- package/fesm2022/_widget-chunk.mjs.map +1 -1
- package/fesm2022/accordion-testing.mjs +61 -0
- package/fesm2022/accordion-testing.mjs.map +1 -0
- package/fesm2022/accordion.mjs +208 -183
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/aria.mjs +1 -1
- package/fesm2022/aria.mjs.map +1 -1
- package/fesm2022/combobox.mjs.map +1 -1
- package/fesm2022/grid.mjs +14 -85
- package/fesm2022/grid.mjs.map +1 -1
- package/fesm2022/listbox-testing.mjs +55 -0
- package/fesm2022/listbox-testing.mjs.map +1 -0
- package/fesm2022/listbox.mjs +1 -1
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/menu-testing.mjs +75 -0
- package/fesm2022/menu-testing.mjs.map +1 -0
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/private.mjs +2 -1
- package/fesm2022/private.mjs.map +1 -1
- package/fesm2022/tabs-testing.mjs +57 -0
- package/fesm2022/tabs-testing.mjs.map +1 -0
- package/fesm2022/tabs.mjs +3 -5
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/toolbar-testing.mjs +56 -0
- package/fesm2022/toolbar-testing.mjs.map +1 -0
- package/fesm2022/toolbar.mjs +8 -6
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tree-testing.mjs +88 -0
- package/fesm2022/tree-testing.mjs.map +1 -0
- package/fesm2022/tree.mjs +4 -6
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +26 -2
- package/resources/code-examples.db +0 -0
- package/types/_accordion-chunk.d.ts +10 -9
- package/types/_click-event-manager-chunk.d.ts +1 -1
- package/types/_combobox-chunk.d.ts +23 -23
- package/types/_element-chunk.d.ts +10 -0
- package/types/_expansion-chunk.d.ts +1 -1
- package/types/_grid-chunk.d.ts +11 -49
- package/types/_keyboard-event-manager-chunk.d.ts +2 -2
- package/types/_list-chunk.d.ts +19 -18
- package/types/_list-navigation-chunk.d.ts +6 -16
- package/types/_listbox-chunk.d.ts +27 -27
- package/types/_menu-chunk.d.ts +51 -51
- package/types/_pointer-event-manager-chunk.d.ts +1 -1
- package/types/_signal-like-chunk.d.ts +14 -0
- package/types/_tabs-chunk.d.ts +2 -1
- package/types/_toolbar-chunk.d.ts +1 -1
- package/types/_tree-chunk.d.ts +18 -17
- package/types/accordion-testing.d.ts +63 -0
- package/types/accordion.d.ts +69 -55
- package/types/combobox.d.ts +6 -5
- package/types/grid.d.ts +8 -14
- package/types/listbox-testing.d.ts +39 -0
- package/types/listbox.d.ts +19 -18
- package/types/menu-testing.d.ts +50 -0
- package/types/menu.d.ts +4 -3
- package/types/private.d.ts +46 -44
- package/types/tabs-testing.d.ts +57 -0
- package/types/tabs.d.ts +3 -5
- package/types/toolbar-testing.d.ts +72 -0
- package/types/toolbar.d.ts +3 -2
- package/types/tree-testing.d.ts +75 -0
- package/types/tree.d.ts +5 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_toolbar-widget-group-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar-widget.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar-widget-group.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 {computed, signal, SignalLike} from '../behaviors/signal-like/signal-like';\nimport {KeyboardEventManager} from '../behaviors/event-manager';\nimport {List, ListInputs} from '../behaviors/list/list';\nimport {ToolbarWidgetPattern} from './toolbar-widget';\n\n/** Represents the required inputs for a toolbar. */\nexport type ToolbarInputs<V> = Omit<\n ListInputs<ToolbarWidgetPattern<V>, V>,\n 'multi' | 'typeaheadDelay' | 'selectionMode' | 'focusMode'\n> & {\n /** A function that returns the toolbar item associated with a given element. */\n getItem: (e: Element) => ToolbarWidgetPattern<V> | undefined;\n};\n\n/** Controls the state of a toolbar. */\nexport class ToolbarPattern<V> {\n /** The list behavior for the toolbar. */\n readonly listBehavior: List<ToolbarWidgetPattern<V>, V>;\n\n /** Whether the toolbar has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the tablist is vertically or horizontally oriented. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** Whether disabled items in the group should be focusable. */\n readonly softDisabled: SignalLike<boolean>;\n\n /** Whether the toolbar is disabled. */\n readonly disabled = computed(() => this.listBehavior.disabled());\n\n /** The tab index of the toolbar (if using activedescendant). */\n readonly tabIndex = computed(() => this.listBehavior.tabIndex());\n\n /** The id of the current active widget (if using activedescendant). */\n readonly activeDescendant = computed(() => this.listBehavior.activeDescendant());\n\n /** The currently active item in the toolbar. */\n readonly activeItem = () => this.listBehavior.inputs.activeItem();\n\n /** The key used to navigate to the previous widget. */\n private readonly _prevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key used to navigate to the next widget. */\n private readonly _nextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The alternate key used to navigate to the previous widget. */\n private readonly _altPrevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n }\n return 'ArrowUp';\n });\n\n /** The alternate key used to navigate to the next widget. */\n private readonly _altNextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n }\n return 'ArrowDown';\n });\n\n /** The keydown event manager for the toolbar. */\n private readonly _keydown = computed(() => {\n const manager = new KeyboardEventManager();\n\n return manager\n .on(this._nextKey, () => this.listBehavior.next(), {ignoreRepeat: false})\n .on(this._prevKey, () => this.listBehavior.prev(), {ignoreRepeat: false})\n .on(this._altNextKey, () => this._groupNext(), {ignoreRepeat: false})\n .on(this._altPrevKey, () => this._groupPrev(), {ignoreRepeat: false})\n .on(' ', () => this.select())\n .on('Enter', () => this.select())\n .on('Home', () => this.listBehavior.first())\n .on('End', () => this.listBehavior.last());\n });\n\n /** Navigates to the next widget in a widget group. */\n private _groupNext() {\n const currGroup = this.inputs.activeItem()?.group();\n const nextGroup = this.listBehavior.navigationBehavior.peekNext()?.group();\n\n if (!currGroup) {\n return;\n }\n\n if (currGroup !== nextGroup) {\n this.listBehavior.goto(\n this.listBehavior.navigationBehavior.peekFirst({\n items: currGroup.inputs.items(),\n })!,\n );\n\n return;\n }\n\n this.listBehavior.next();\n }\n\n /** Navigates to the previous widget in a widget group. */\n private _groupPrev() {\n const currGroup = this.inputs.activeItem()?.group();\n const nextGroup = this.listBehavior.navigationBehavior.peekPrev()?.group();\n\n if (!currGroup) {\n return;\n }\n\n if (currGroup !== nextGroup) {\n this.listBehavior.goto(\n this.listBehavior.navigationBehavior.peekLast({\n items: currGroup.inputs.items(),\n })!,\n );\n\n return;\n }\n\n this.listBehavior.prev();\n }\n\n /** Navigates to the widget targeted by a pointer event. */\n private _goto(e: MouseEvent) {\n const item = this.inputs.getItem(e.target as Element);\n\n if (item) {\n this.listBehavior.goto(item);\n this.select();\n }\n }\n\n select() {\n const group = this.inputs.activeItem()?.group();\n\n if (!group?.multi()) {\n group?.inputs.items().forEach(i => this.listBehavior.deselect(i));\n }\n\n this.listBehavior.toggle();\n }\n\n constructor(readonly inputs: ToolbarInputs<V>) {\n this.orientation = inputs.orientation;\n this.softDisabled = inputs.softDisabled;\n\n this.listBehavior = new List({\n ...inputs,\n multi: () => true,\n focusMode: () => 'roving',\n selectionMode: () => 'explicit',\n typeaheadDelay: () => 0, // Toolbar widgets do not support typeahead.\n });\n }\n\n /** Handles keydown events for the toolbar. */\n onKeydown(event: KeyboardEvent) {\n if (this.disabled()) return;\n this.hasBeenInteracted.set(true);\n this._keydown().handle(event);\n }\n\n onPointerdown(event: PointerEvent) {\n this.hasBeenInteracted.set(true);\n event.preventDefault();\n }\n\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n\n /** Handles click events for the toolbar. */\n onClick(event: MouseEvent) {\n if (this.disabled() || (event as PointerEvent).pointerType === '') return;\n this._goto(event);\n }\n\n /**\n * Sets the toolbar to its default initial state.\n *\n * Sets the active index to the selected widget if one exists and is focusable.\n * Otherwise, sets the active index to the first focusable widget.\n */\n setDefaultState() {\n const firstItem = this.listBehavior.navigationBehavior.peekFirst({\n items: this.inputs.items(),\n });\n\n if (firstItem) {\n this.inputs.activeItem.set(firstItem);\n }\n }\n\n /** Sets the default active state of the toolbar before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\n }\n}\n","/**\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 {SignalLike, computed} from '../behaviors/signal-like/signal-like';\nimport {ListItem} from '../behaviors/list/list';\nimport type {ToolbarPattern} from './toolbar';\nimport {ToolbarWidgetGroupPattern} from './toolbar-widget-group';\n\n/** Represents the required inputs for a toolbar widget in a toolbar. */\nexport interface ToolbarWidgetInputs<V> extends Omit<\n ListItem<V>,\n 'searchTerm' | 'index' | 'selectable'\n> {\n /** A reference to the parent toolbar. */\n toolbar: SignalLike<ToolbarPattern<V>>;\n\n /** A reference to the parent widget group. */\n group: SignalLike<ToolbarWidgetGroupPattern<ToolbarWidgetPattern<V>, V> | undefined>;\n}\n\nexport class ToolbarWidgetPattern<V> implements ListItem<V> {\n /** A unique identifier for the widget. */\n readonly id = () => this.inputs.id();\n\n /** The html element that should receive focus. */\n readonly element = () => this.inputs.element();\n\n /** Whether the widget is disabled. */\n readonly disabled = () => this.inputs.disabled() || this.group()?.disabled() || false;\n\n /** A reference to the parent toolbar. */\n readonly group = () => this.inputs.group();\n\n /** A reference to the toolbar containing the widget. */\n readonly toolbar = () => this.inputs.toolbar();\n\n /** The tabindex of the widget. */\n readonly tabIndex = computed(() => this.toolbar().listBehavior.getItemTabindex(this));\n\n /** The text used by the typeahead search. */\n readonly searchTerm = () => ''; // Unused because toolbar does not support typeahead.\n\n /** The value associated with the widget. */\n readonly value = () => this.inputs.value();\n\n /** Whether the widget is selectable. */\n readonly selectable = () => true; // Unused because toolbar does not support selection.\n\n /** The position of the widget within the toolbar. */\n readonly index = computed(() => this.toolbar().inputs.items().indexOf(this) ?? -1);\n\n /** Whether the widget is selected (only relevant in a selection group). */\n readonly selected = computed(() =>\n this.toolbar().listBehavior.inputs.value().includes(this.value()),\n );\n\n /** Whether the widget is currently the active one (focused). */\n readonly active: SignalLike<boolean> = computed(() => this.toolbar().activeItem() === this);\n\n constructor(readonly inputs: ToolbarWidgetInputs<V>) {}\n}\n","/**\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 {ListItem} from '../behaviors/list/list';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport type {ToolbarPattern} from './toolbar';\n\n/** Represents the required inputs for a toolbar widget group. */\nexport interface ToolbarWidgetGroupInputs<T extends ListItem<V>, V> {\n /** A reference to the parent toolbar. */\n toolbar: SignalLike<ToolbarPattern<V> | undefined>;\n\n /** Whether the widget group is disabled. */\n disabled: SignalLike<boolean>;\n\n /** The list of items within the widget group. */\n items: SignalLike<T[]>;\n\n /** Whether the group allows multiple widgets to be selected. */\n multi: SignalLike<boolean>;\n}\n\n/** A group of widgets within a toolbar that provides nested navigation. */\nexport class ToolbarWidgetGroupPattern<T extends ListItem<V>, V> {\n /** Whether the widget is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** A reference to the parent toolbar. */\n readonly toolbar = () => this.inputs.toolbar();\n\n /** Whether the group allows multiple widgets to be selected. */\n readonly multi = () => this.inputs.multi();\n\n readonly searchTerm = () => ''; // Unused because toolbar does not support typeahead.\n readonly value = () => '' as V; // Unused because toolbar does not support selection.\n readonly selectable = () => true; // Unused because toolbar does not support selection.\n readonly element = () => undefined; // Unused because toolbar does not focus the group element.\n\n constructor(readonly inputs: ToolbarWidgetGroupInputs<T, V>) {}\n}\n"],"names":["ToolbarPattern","inputs","listBehavior","hasBeenInteracted","signal","orientation","softDisabled","disabled","computed","tabIndex","activeDescendant","activeItem","_prevKey","textDirection","_nextKey","_altPrevKey","_altNextKey","_keydown","manager","KeyboardEventManager","on","next","ignoreRepeat","prev","_groupNext","_groupPrev","select","first","last","currGroup","group","nextGroup","navigationBehavior","peekNext","goto","peekFirst","items","peekPrev","peekLast","_goto","e","item","getItem","target","multi","forEach","i","deselect","toggle","constructor","List","focusMode","selectionMode","typeaheadDelay","onKeydown","event","set","handle","onPointerdown","preventDefault","onFocusIn","onClick","pointerType","setDefaultState","firstItem","setDefaultStateEffect","length","ToolbarWidgetPattern","id","element","toolbar","getItemTabindex","searchTerm","value","selectable","index","indexOf","selected","includes","active","ToolbarWidgetGroupPattern","undefined"],"mappings":";;;MAuBaA,cAAc,CAAA;EAwIJC,MAAA;EAtIZC,YAAY;AAGZC,EAAAA,iBAAiB,GAAGC,MAAM,CAAC,KAAK,CAAC;EAGjCC,WAAW;EAGXC,YAAY;EAGZC,QAAQ,GAAGC,QAAQ,CAAC,MAAM,IAAI,CAACN,YAAY,CAACK,QAAQ,EAAE,CAAC;EAGvDE,QAAQ,GAAGD,QAAQ,CAAC,MAAM,IAAI,CAACN,YAAY,CAACO,QAAQ,EAAE,CAAC;EAGvDC,gBAAgB,GAAGF,QAAQ,CAAC,MAAM,IAAI,CAACN,YAAY,CAACQ,gBAAgB,EAAE,CAAC;EAGvEC,UAAU,GAAGA,MAAM,IAAI,CAACT,YAAY,CAACD,MAAM,CAACU,UAAU,EAAE;EAGhDC,QAAQ,GAAGJ,QAAQ,CAAC,MAAK;IACxC,IAAI,IAAI,CAACP,MAAM,CAACI,WAAW,EAAE,KAAK,UAAU,EAAE;AAC5C,MAAA,OAAO,SAAS;AAClB,IAAA;AACA,IAAA,OAAO,IAAI,CAACJ,MAAM,CAACY,aAAa,EAAE,KAAK,KAAK,GAAG,YAAY,GAAG,WAAW;AAC3E,EAAA,CAAC,CAAC;EAGeC,QA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EAAE,CAACK,QAAQ,CAAC,IAAI,CAACL,KAAK,EAAE,CAAC,CAClE;AAGQM,EAAAA,MAAM,GAAwBvE,QAAQ,CAAC,MAAM,IAAI,CAAC8D,OAAO,EAAE,CAAC3D,UAAU,EAAE,KAAK,IAAI,CAAC;EAE3FsC,WAAAA,CAAqBhD,MAA8B,EAAA;IAA9B,IAAA,CAAAA,MAAM,GAANA,MAAM;AAA2B,EAAA;AACvD;;MCrCY+E,yBAAyB,CAAA;EAef/E,MAAA;EAbZM,QAAQ,GAAGA,MAAM,IAAI,CAACN,MAAM,CAACM,QAAQ,EAAE;EAGvC+D,OAAO,GAAGA,MAAM,IAAI,CAACrE,MAAM,CAACqE,OAAO,EAAE;EAGrC1B,KAAK,GAAGA,MAAM,IAAI,CAAC3C,MAAM,CAAC2C,KAAK,EAAE;EAEjC4B,UAAU,GAAGA,MAAM,EAAE;EACrBC,KAAK,GAAGA,MAAM,EAAO;EACrBC,UAAU,GAAGA,MAAM,IAAI;EACvBL,OAAO,GAAGA,MAAMY,SAAS;EAElChC,WAAAA,CAAqBhD,MAAsC,EAAA;IAAtC,IAAA,CAAAA,MAAM,GAANA,MAAM;AAAmC,EAAA;AAC/D;;;;"}
|
|
1
|
+
{"version":3,"file":"_toolbar-widget-group-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar-widget.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar-widget-group.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 {computed, signal, SignalLike} from '../behaviors/signal-like/signal-like';\nimport {KeyboardEventManager} from '../behaviors/event-manager';\nimport {List, ListInputs} from '../behaviors/list/list';\nimport {ToolbarWidgetPattern} from './toolbar-widget';\n\n/** Represents the required inputs for a toolbar. */\nexport type ToolbarInputs<V> = Omit<\n ListInputs<ToolbarWidgetPattern<V>, V>,\n 'multi' | 'typeaheadDelay' | 'selectionMode' | 'focusMode'\n> & {\n /** A function that returns the toolbar item associated with a given element. */\n getItem: (e: Element) => ToolbarWidgetPattern<V> | undefined;\n};\n\n/** Controls the state of a toolbar. */\nexport class ToolbarPattern<V> {\n /** The list behavior for the toolbar. */\n readonly listBehavior: List<ToolbarWidgetPattern<V>, V>;\n\n /** Whether the toolbar has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the tablist is vertically or horizontally oriented. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** Whether disabled items in the group should be focusable. */\n readonly softDisabled: SignalLike<boolean>;\n\n /** Whether the toolbar is disabled. */\n readonly disabled = computed(() => this.listBehavior.disabled());\n\n /** The tab index of the toolbar (if using activedescendant). */\n readonly tabIndex = computed(() => this.listBehavior.tabIndex());\n\n /** The id of the current active widget (if using activedescendant). */\n readonly activeDescendant = computed(() => this.listBehavior.activeDescendant());\n\n /** The currently active item in the toolbar. */\n readonly activeItem = () => this.listBehavior.inputs.activeItem();\n\n /** The key used to navigate to the previous widget. */\n private readonly _prevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key used to navigate to the next widget. */\n private readonly _nextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The alternate key used to navigate to the previous widget. */\n private readonly _altPrevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n }\n return 'ArrowUp';\n });\n\n /** The alternate key used to navigate to the next widget. */\n private readonly _altNextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n }\n return 'ArrowDown';\n });\n\n /** The keydown event manager for the toolbar. */\n private readonly _keydown = computed(() => {\n const manager = new KeyboardEventManager();\n\n return manager\n .on(this._nextKey, () => this.listBehavior.next(), {ignoreRepeat: false})\n .on(this._prevKey, () => this.listBehavior.prev(), {ignoreRepeat: false})\n .on(this._altNextKey, () => this._groupNext(), {ignoreRepeat: false})\n .on(this._altPrevKey, () => this._groupPrev(), {ignoreRepeat: false})\n .on(' ', () => this.select())\n .on('Enter', () => this.select())\n .on('Home', () => this.listBehavior.first())\n .on('End', () => this.listBehavior.last());\n });\n\n /** Navigates to the next widget in a widget group. */\n private _groupNext() {\n const currGroup = this.inputs.activeItem()?.group();\n const nextGroup = this.listBehavior.navigationBehavior.peekNext()?.group();\n\n if (!currGroup) {\n return;\n }\n\n if (currGroup !== nextGroup) {\n this.listBehavior.goto(\n this.listBehavior.navigationBehavior.peekFirst({\n items: currGroup.inputs.items(),\n })!,\n );\n\n return;\n }\n\n this.listBehavior.next();\n }\n\n /** Navigates to the previous widget in a widget group. */\n private _groupPrev() {\n const currGroup = this.inputs.activeItem()?.group();\n const nextGroup = this.listBehavior.navigationBehavior.peekPrev()?.group();\n\n if (!currGroup) {\n return;\n }\n\n if (currGroup !== nextGroup) {\n this.listBehavior.goto(\n this.listBehavior.navigationBehavior.peekLast({\n items: currGroup.inputs.items(),\n })!,\n );\n\n return;\n }\n\n this.listBehavior.prev();\n }\n\n /** Navigates to the widget targeted by a pointer event. */\n private _goto(e: MouseEvent) {\n const item = this.inputs.getItem(e.target as Element);\n\n if (item) {\n this.listBehavior.goto(item);\n this.select();\n }\n }\n\n select() {\n const group = this.inputs.activeItem()?.group();\n\n if (!group?.multi()) {\n group?.inputs.items().forEach(i => this.listBehavior.deselect(i));\n }\n\n this.listBehavior.toggle();\n }\n\n constructor(readonly inputs: ToolbarInputs<V>) {\n this.orientation = inputs.orientation;\n this.softDisabled = inputs.softDisabled;\n\n this.listBehavior = new List({\n ...inputs,\n multi: () => true,\n focusMode: () => 'roving',\n selectionMode: () => 'explicit',\n typeaheadDelay: () => 0, // Toolbar widgets do not support typeahead.\n });\n }\n\n /** Handles keydown events for the toolbar. */\n onKeydown(event: KeyboardEvent) {\n if (this.disabled()) return;\n this.hasBeenInteracted.set(true);\n this._keydown().handle(event);\n }\n\n onPointerdown(event: PointerEvent) {\n this.hasBeenInteracted.set(true);\n event.preventDefault();\n }\n\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n\n /** Handles click events for the toolbar. */\n onClick(event: MouseEvent) {\n if (this.disabled() || (event as PointerEvent).pointerType === '') return;\n this._goto(event);\n }\n\n /**\n * Sets the toolbar to its default initial state.\n *\n * Sets the active index to the selected widget if one exists and is focusable.\n * Otherwise, sets the active index to the first focusable widget.\n */\n setDefaultState() {\n const firstItem = this.listBehavior.navigationBehavior.peekFirst({\n items: this.inputs.items(),\n });\n\n if (firstItem) {\n this.inputs.activeItem.set(firstItem);\n }\n }\n\n /** Sets the default active state of the toolbar before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\n }\n}\n","/**\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 {SignalLike, computed} from '../behaviors/signal-like/signal-like';\nimport {ListItem} from '../behaviors/list/list';\nimport type {ToolbarPattern} from './toolbar';\nimport {ToolbarWidgetGroupPattern} from './toolbar-widget-group';\n\n/** Represents the required inputs for a toolbar widget in a toolbar. */\nexport interface ToolbarWidgetInputs<V> extends Omit<\n ListItem<V>,\n 'searchTerm' | 'index' | 'selectable'\n> {\n /** A reference to the parent toolbar. */\n toolbar: SignalLike<ToolbarPattern<V>>;\n\n /** A reference to the parent widget group. */\n group: SignalLike<ToolbarWidgetGroupPattern<ToolbarWidgetPattern<V>, V> | undefined>;\n}\n\nexport class ToolbarWidgetPattern<V> implements ListItem<V> {\n /** A unique identifier for the widget. */\n readonly id = () => this.inputs.id();\n\n /** The html element that should receive focus. */\n readonly element = () => this.inputs.element();\n\n /** Whether the widget is disabled. */\n readonly disabled = () => this.inputs.disabled() || this.group()?.disabled() || false;\n\n /** A reference to the parent toolbar. */\n readonly group = () => this.inputs.group();\n\n /** A reference to the toolbar containing the widget. */\n readonly toolbar = () => this.inputs.toolbar();\n\n /** The tabindex of the widget. */\n readonly tabIndex = computed(() => this.toolbar().listBehavior.getItemTabindex(this));\n\n /** The text used by the typeahead search. */\n readonly searchTerm = () => ''; // Unused because toolbar does not support typeahead.\n\n /** The value associated with the widget. */\n readonly value = () => this.inputs.value();\n\n /** Whether the widget is selectable. */\n readonly selectable = () => true; // Unused because toolbar does not support selection.\n\n /** The position of the widget within the toolbar. */\n readonly index = computed(() => this.toolbar().inputs.items().indexOf(this) ?? -1);\n\n /** Whether the widget is selected (only relevant in a selection group). */\n readonly selected = computed(() =>\n this.toolbar().listBehavior.inputs.value().includes(this.value()),\n );\n\n /** Whether the widget is currently the active one (focused). */\n readonly active: SignalLike<boolean> = computed(() => this.toolbar().activeItem() === this);\n\n constructor(readonly inputs: ToolbarWidgetInputs<V>) {}\n}\n","/**\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 {ListItem} from '../behaviors/list/list';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport type {ToolbarPattern} from './toolbar';\n\n/** Represents the required inputs for a toolbar widget group. */\nexport interface ToolbarWidgetGroupInputs<T extends ListItem<V>, V> {\n /** A reference to the parent toolbar. */\n toolbar: SignalLike<ToolbarPattern<V> | undefined>;\n\n /** Whether the widget group is disabled. */\n disabled: SignalLike<boolean>;\n\n /** The list of items within the widget group. */\n items: SignalLike<T[]>;\n\n /** Whether the group allows multiple widgets to be selected. */\n multi: SignalLike<boolean>;\n}\n\n/** A group of widgets within a toolbar that provides nested navigation. */\nexport class ToolbarWidgetGroupPattern<T extends ListItem<V>, V> {\n /** Whether the widget is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** A reference to the parent toolbar. */\n readonly toolbar = () => this.inputs.toolbar();\n\n /** Whether the group allows multiple widgets to be selected. */\n readonly multi = () => this.inputs.multi();\n\n readonly searchTerm = () => ''; // Unused because toolbar does not support typeahead.\n readonly value = () => '' as V; // Unused because toolbar does not support selection.\n readonly selectable = () => true; // Unused because toolbar does not support selection.\n readonly element = () => undefined; // Unused because toolbar does not focus the group element.\n\n constructor(readonly inputs: ToolbarWidgetGroupInputs<T, V>) {}\n}\n"],"names":["ToolbarPattern","inputs","listBehavior","hasBeenInteracted","signal","orientation","softDisabled","disabled","computed","tabIndex","activeDescendant","activeItem","_prevKey","textDirection","_nextKey","_altPrevKey","_altNextKey","_keydown","manager","KeyboardEventManager","on","next","ignoreRepeat","prev","_groupNext","_groupPrev","select","first","last","currGroup","group","nextGroup","navigationBehavior","peekNext","goto","peekFirst","items","peekPrev","peekLast","_goto","e","item","getItem","target","multi","forEach","i","deselect","toggle","constructor","List","focusMode","selectionMode","typeaheadDelay","onKeydown","event","set","handle","onPointerdown","preventDefault","onFocusIn","onClick","pointerType","setDefaultState","firstItem","setDefaultStateEffect","length","ToolbarWidgetPattern","id","element","toolbar","getItemTabindex","searchTerm","value","selectable","index","indexOf","selected","includes","active","ToolbarWidgetGroupPattern","undefined"],"mappings":";;;MAuBaA,cAAc,CAAA;EAwIJC,MAAA;EAtIZC,YAAY;AAGZC,EAAAA,iBAAiB,GAAGC,MAAM,CAAC,KAAK,CAAC;EAGjCC,WAAW;EAGXC,YAAY;EAGZC,QAAQ,GAAGC,QAAQ,CAAC,MAAM,IAAI,CAACN,YAAY,CAACK,QAAQ,EAAE,CAAC;EAGvDE,QAAQ,GAAGD,QAAQ,CAAC,MAAM,IAAI,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 -1,7 +1,6 @@
|
|
|
1
1
|
import { computed, signal, linkedSignal, KeyboardEventManager, Modifier } from './_signal-like-chunk.mjs';
|
|
2
2
|
import { PointerEventManager } from './_pointer-event-manager-chunk.mjs';
|
|
3
3
|
import { untracked } from '@angular/core/primitives/signals';
|
|
4
|
-
import { ListFocus, ListNavigation } from './_list-navigation-chunk.mjs';
|
|
5
4
|
|
|
6
5
|
class GridData {
|
|
7
6
|
inputs;
|
|
@@ -603,9 +602,6 @@ class GridPattern {
|
|
|
603
602
|
dragging = signal(false);
|
|
604
603
|
prevColKey = computed(() => this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft');
|
|
605
604
|
nextColKey = computed(() => this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight');
|
|
606
|
-
acceptsPointerMove = computed(() => {
|
|
607
|
-
return !this.disabled() && this.inputs.enableSelection() && this.inputs.enableRangeSelection() && this.dragging();
|
|
608
|
-
});
|
|
609
605
|
keydown = computed(() => {
|
|
610
606
|
const manager = new KeyboardEventManager();
|
|
611
607
|
if (this.pauseNavigation()) {
|
|
@@ -626,24 +622,8 @@ class GridPattern {
|
|
|
626
622
|
if (this.inputs.enableSelection() && this.inputs.selectionMode() === 'explicit') {
|
|
627
623
|
manager.on(/Enter| /, () => this.inputs.multi() ? this.gridBehavior.toggle() : this.gridBehavior.toggleOne());
|
|
628
624
|
}
|
|
629
|
-
if (this.inputs.enableSelection() && this.inputs.
|
|
630
|
-
manager.on(Modifier.
|
|
631
|
-
anchor: true
|
|
632
|
-
})).on(Modifier.Shift, 'ArrowDown', () => this.gridBehavior.down({
|
|
633
|
-
anchor: true
|
|
634
|
-
})).on(Modifier.Shift, this.prevColKey(), () => this.gridBehavior.left({
|
|
635
|
-
anchor: true
|
|
636
|
-
})).on(Modifier.Shift, this.nextColKey(), () => this.gridBehavior.right({
|
|
637
|
-
anchor: true
|
|
638
|
-
})).on(Modifier.Shift, 'Home', () => this.gridBehavior.firstInRow({
|
|
639
|
-
anchor: true
|
|
640
|
-
})).on(Modifier.Shift, 'End', () => this.gridBehavior.lastInRow({
|
|
641
|
-
anchor: true
|
|
642
|
-
})).on([Modifier.Ctrl | Modifier.Shift], 'Home', () => this.gridBehavior.first({
|
|
643
|
-
anchor: true
|
|
644
|
-
})).on([Modifier.Ctrl | Modifier.Shift], 'End', () => this.gridBehavior.last({
|
|
645
|
-
anchor: true
|
|
646
|
-
})).on([Modifier.Ctrl, Modifier.Meta], 'A', () => {
|
|
625
|
+
if (this.inputs.enableSelection() && this.inputs.multi()) {
|
|
626
|
+
manager.on([Modifier.Ctrl, Modifier.Meta], 'A', () => {
|
|
647
627
|
if (this.gridBehavior.allSelected()) {
|
|
648
628
|
this.gridBehavior.deselectAll();
|
|
649
629
|
} else {
|
|
@@ -671,9 +651,6 @@ class GridPattern {
|
|
|
671
651
|
toggleOne: this.inputs.selectionMode() === 'explicit' && !this.inputs.multi(),
|
|
672
652
|
toggle: this.inputs.selectionMode() === 'explicit' && this.inputs.multi()
|
|
673
653
|
});
|
|
674
|
-
if (this.inputs.multi() && this.inputs.enableRangeSelection()) {
|
|
675
|
-
this.dragging.set(true);
|
|
676
|
-
}
|
|
677
654
|
});
|
|
678
655
|
if (this.inputs.multi()) {
|
|
679
656
|
manager.on([Modifier.Ctrl, Modifier.Meta], e => {
|
|
@@ -682,33 +659,11 @@ class GridPattern {
|
|
|
682
659
|
this.gridBehavior.gotoCell(cell, {
|
|
683
660
|
toggle: true
|
|
684
661
|
});
|
|
685
|
-
if (this.inputs.enableRangeSelection()) {
|
|
686
|
-
this.dragging.set(true);
|
|
687
|
-
}
|
|
688
662
|
});
|
|
689
|
-
if (this.inputs.enableRangeSelection()) {
|
|
690
|
-
manager.on(Modifier.Shift, e => {
|
|
691
|
-
const cell = this.inputs.getCell(e.target);
|
|
692
|
-
if (!cell) return;
|
|
693
|
-
this.gridBehavior.gotoCell(cell, {
|
|
694
|
-
anchor: true
|
|
695
|
-
});
|
|
696
|
-
this.dragging.set(true);
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
663
|
}
|
|
700
664
|
}
|
|
701
665
|
return manager;
|
|
702
666
|
});
|
|
703
|
-
pointerup = computed(() => {
|
|
704
|
-
const manager = new PointerEventManager();
|
|
705
|
-
if (this.inputs.enableSelection() && this.inputs.enableRangeSelection()) {
|
|
706
|
-
manager.on([Modifier.Shift, Modifier.Ctrl, Modifier.Meta, Modifier.None], () => {
|
|
707
|
-
this.dragging.set(false);
|
|
708
|
-
});
|
|
709
|
-
}
|
|
710
|
-
return manager;
|
|
711
|
-
});
|
|
712
667
|
_maybeDeletion = signal(false);
|
|
713
668
|
_deletion = signal(false);
|
|
714
669
|
_stateStale = signal(false);
|
|
@@ -730,24 +685,9 @@ class GridPattern {
|
|
|
730
685
|
this.hasBeenInteracted.set(true);
|
|
731
686
|
this.pointerdown().handle(event);
|
|
732
687
|
}
|
|
733
|
-
onPointermove(event) {
|
|
734
|
-
if (this.acceptsPointerMove()) {
|
|
735
|
-
const cell = this.inputs.getCell(event.target);
|
|
736
|
-
if (cell !== undefined) {
|
|
737
|
-
this.gridBehavior.gotoCell(cell, {
|
|
738
|
-
anchor: true
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
onPointerup(event) {
|
|
744
|
-
if (this.disabled()) return;
|
|
745
|
-
this.pointerup().handle(event);
|
|
746
|
-
}
|
|
747
688
|
onFocusIn(event) {
|
|
748
689
|
this.isFocused.set(true);
|
|
749
690
|
this.hasBeenInteracted.set(true);
|
|
750
|
-
if (this.dragging()) return;
|
|
751
691
|
const cell = this.inputs.getCell(event.target);
|
|
752
692
|
if (!cell || !this.gridBehavior.focusBehavior.isFocusable(cell)) return;
|
|
753
693
|
cell.onFocusIn(event);
|
|
@@ -844,85 +784,20 @@ class GridCellPattern {
|
|
|
844
784
|
ariaColIndex = computed(() => this.inputs.colIndex() ?? this.inputs.grid().gridBehavior.colIndex(this));
|
|
845
785
|
_tabIndex = computed(() => this.inputs.grid().gridBehavior.cellTabIndex(this));
|
|
846
786
|
tabIndex = computed(() => {
|
|
847
|
-
if (this.
|
|
787
|
+
if (this.inputs.widget()) {
|
|
848
788
|
return -1;
|
|
849
789
|
}
|
|
850
790
|
return this._tabIndex();
|
|
851
791
|
});
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
navigationDisabled = computed(() => !this.multiWidgetMode() || !this.active() || this.inputs.disabled());
|
|
855
|
-
focusBehavior;
|
|
856
|
-
navigationBehavior;
|
|
857
|
-
activeWidget = linkedSignal(() => this.inputs.widgets().length > 0 ? this.inputs.widgets()[0] : undefined);
|
|
858
|
-
navigationActivated = signal(false);
|
|
859
|
-
widgetActivated = computed(() => this.inputs.widgets().some(w => w.isActivated()));
|
|
860
|
-
isActivated = computed(() => this.navigationActivated() || this.widgetActivated());
|
|
861
|
-
prevKey = computed(() => {
|
|
862
|
-
if (this.inputs.orientation() === 'vertical') {
|
|
863
|
-
return 'ArrowUp';
|
|
864
|
-
}
|
|
865
|
-
return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
|
|
866
|
-
});
|
|
867
|
-
nextKey = computed(() => {
|
|
868
|
-
if (this.inputs.orientation() === 'vertical') {
|
|
869
|
-
return 'ArrowDown';
|
|
870
|
-
}
|
|
871
|
-
return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
|
|
872
|
-
});
|
|
873
|
-
keydown = computed(() => {
|
|
874
|
-
const manager = new KeyboardEventManager();
|
|
875
|
-
if (!this.navigationActivated()) {
|
|
876
|
-
manager.on('Enter', () => this.startNavigation());
|
|
877
|
-
return manager;
|
|
878
|
-
}
|
|
879
|
-
manager.on('Escape', () => this.stopNavigation()).on(this.prevKey(), () => this._advance(() => this.navigationBehavior.prev({
|
|
880
|
-
focusElement: false
|
|
881
|
-
})), {
|
|
882
|
-
ignoreRepeat: false
|
|
883
|
-
}).on(this.nextKey(), () => this._advance(() => this.navigationBehavior.next({
|
|
884
|
-
focusElement: false
|
|
885
|
-
})), {
|
|
886
|
-
ignoreRepeat: false
|
|
887
|
-
}).on('Home', () => this._advance(() => this.navigationBehavior.next({
|
|
888
|
-
focusElement: false
|
|
889
|
-
}))).on('End', () => this._advance(() => this.navigationBehavior.next({
|
|
890
|
-
focusElement: false
|
|
891
|
-
})));
|
|
892
|
-
return manager;
|
|
893
|
-
});
|
|
792
|
+
widget = () => this.inputs.widget();
|
|
793
|
+
isActivated = computed(() => this.widget()?.isActivated() ?? false);
|
|
894
794
|
constructor(inputs) {
|
|
895
795
|
this.inputs = inputs;
|
|
896
796
|
this.selected = inputs.selected;
|
|
897
|
-
const listNavigationInputs = {
|
|
898
|
-
...inputs,
|
|
899
|
-
items: inputs.widgets,
|
|
900
|
-
activeItem: this.activeWidget,
|
|
901
|
-
disabled: this.navigationDisabled,
|
|
902
|
-
focusMode: () => 'roving',
|
|
903
|
-
softDisabled: () => true
|
|
904
|
-
};
|
|
905
|
-
this.focusBehavior = new ListFocus(listNavigationInputs);
|
|
906
|
-
this.navigationBehavior = new ListNavigation({
|
|
907
|
-
...listNavigationInputs,
|
|
908
|
-
focusManager: this.focusBehavior
|
|
909
|
-
});
|
|
910
797
|
}
|
|
911
798
|
onKeydown(event) {
|
|
912
|
-
if (this.disabled()
|
|
913
|
-
|
|
914
|
-
this.activeWidget().onKeydown(event);
|
|
915
|
-
return;
|
|
916
|
-
}
|
|
917
|
-
if (!this.navigationActivated()) {
|
|
918
|
-
this.keydown().handle(event);
|
|
919
|
-
return;
|
|
920
|
-
}
|
|
921
|
-
const widgetActivated = this.widgetActivated();
|
|
922
|
-
this.activeWidget().onKeydown(event);
|
|
923
|
-
if (!widgetActivated) {
|
|
924
|
-
this.keydown().handle(event);
|
|
925
|
-
}
|
|
799
|
+
if (this.disabled()) return;
|
|
800
|
+
this.widget()?.onKeydown(event);
|
|
926
801
|
}
|
|
927
802
|
onFocusIn(event) {
|
|
928
803
|
this.isFocused.set(true);
|
|
@@ -930,14 +805,6 @@ class GridCellPattern {
|
|
|
930
805
|
const widget = this.inputs.getWidget(focusTarget);
|
|
931
806
|
if (!widget) return;
|
|
932
807
|
widget.onFocusIn(event);
|
|
933
|
-
if (widget !== this.activeWidget()) {
|
|
934
|
-
this.navigationBehavior.goto(widget, {
|
|
935
|
-
focusElement: false
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
if (this.multiWidgetMode()) {
|
|
939
|
-
this.navigationActivated.set(true);
|
|
940
|
-
}
|
|
941
808
|
}
|
|
942
809
|
onFocusOut(event) {
|
|
943
810
|
const blurTarget = event.target;
|
|
@@ -946,48 +813,27 @@ class GridCellPattern {
|
|
|
946
813
|
const focusTarget = event.relatedTarget;
|
|
947
814
|
if (this.element().contains(focusTarget)) return;
|
|
948
815
|
this.isFocused.set(false);
|
|
949
|
-
this.navigationActivated.set(false);
|
|
950
816
|
}
|
|
951
817
|
focus() {
|
|
952
|
-
|
|
953
|
-
|
|
818
|
+
const widget = this.widget();
|
|
819
|
+
if (widget) {
|
|
820
|
+
widget.focus();
|
|
954
821
|
} else {
|
|
955
822
|
this.element().focus();
|
|
956
823
|
}
|
|
957
824
|
}
|
|
958
825
|
widgetTabIndex() {
|
|
959
|
-
|
|
960
|
-
return this._tabIndex();
|
|
961
|
-
}
|
|
962
|
-
return this.navigationActivated() ? 0 : -1;
|
|
963
|
-
}
|
|
964
|
-
startNavigation() {
|
|
965
|
-
if (this.navigationActivated()) return;
|
|
966
|
-
this.navigationActivated.set(true);
|
|
967
|
-
this.navigationBehavior.first();
|
|
968
|
-
}
|
|
969
|
-
stopNavigation() {
|
|
970
|
-
if (!this.navigationActivated()) return;
|
|
971
|
-
this.navigationActivated.set(false);
|
|
972
|
-
this.element().focus();
|
|
973
|
-
}
|
|
974
|
-
_advance(op) {
|
|
975
|
-
const success = op();
|
|
976
|
-
if (success) {
|
|
977
|
-
this.activeWidget()?.focus();
|
|
978
|
-
}
|
|
826
|
+
return this._tabIndex();
|
|
979
827
|
}
|
|
980
828
|
}
|
|
981
829
|
|
|
982
830
|
class GridCellWidgetPattern {
|
|
983
831
|
inputs;
|
|
984
|
-
id = () => this.inputs.id();
|
|
985
832
|
element = () => this.inputs.element();
|
|
986
833
|
widgetHost = computed(() => this.inputs.focusTarget() ?? this.element());
|
|
987
|
-
index = computed(() => this.inputs.cell().inputs.widgets().indexOf(this));
|
|
988
834
|
disabled = computed(() => this.inputs.disabled() || this.inputs.cell().disabled());
|
|
989
835
|
tabIndex = computed(() => this.inputs.cell().widgetTabIndex());
|
|
990
|
-
active = computed(() => this.inputs.cell().active() && this.inputs.cell().
|
|
836
|
+
active = computed(() => this.inputs.cell().active() && this.inputs.cell().widget() === this);
|
|
991
837
|
isActivated = signal(false);
|
|
992
838
|
lastActivateEvent = signal(undefined);
|
|
993
839
|
lastDeactivateEvent = signal(undefined);
|