@angular/cdk-experimental 21.0.0-next.6 → 21.0.0-next.9

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.
Files changed (74) hide show
  1. package/fesm2022/_polyfill-chunk.mjs.map +1 -1
  2. package/fesm2022/cdk-experimental.mjs +1 -1
  3. package/fesm2022/cdk-experimental.mjs.map +1 -1
  4. package/fesm2022/column-resize.mjs.map +1 -1
  5. package/fesm2022/popover-edit.mjs.map +1 -1
  6. package/fesm2022/scrolling.mjs.map +1 -1
  7. package/fesm2022/selection.mjs.map +1 -1
  8. package/fesm2022/table-scroll-container.mjs.map +1 -1
  9. package/package.json +3 -38
  10. package/types/column-resize.d.ts +37 -37
  11. package/types/popover-edit.d.ts +30 -30
  12. package/types/scrolling.d.ts +6 -6
  13. package/types/selection.d.ts +14 -14
  14. package/types/table-scroll-container.d.ts +6 -6
  15. package/fesm2022/_accordion-chunk.mjs +0 -153
  16. package/fesm2022/_accordion-chunk.mjs.map +0 -1
  17. package/fesm2022/_combobox-chunk.mjs +0 -278
  18. package/fesm2022/_combobox-chunk.mjs.map +0 -1
  19. package/fesm2022/_combobox-listbox-chunk.mjs +0 -278
  20. package/fesm2022/_combobox-listbox-chunk.mjs.map +0 -1
  21. package/fesm2022/_combobox-tree-chunk.mjs +0 -398
  22. package/fesm2022/_combobox-tree-chunk.mjs.map +0 -1
  23. package/fesm2022/_expansion-chunk.mjs +0 -87
  24. package/fesm2022/_expansion-chunk.mjs.map +0 -1
  25. package/fesm2022/_list-chunk.mjs +0 -374
  26. package/fesm2022/_list-chunk.mjs.map +0 -1
  27. package/fesm2022/_list-navigation-chunk.mjs +0 -131
  28. package/fesm2022/_list-navigation-chunk.mjs.map +0 -1
  29. package/fesm2022/_pointer-event-manager-chunk.mjs +0 -145
  30. package/fesm2022/_pointer-event-manager-chunk.mjs.map +0 -1
  31. package/fesm2022/_tabs-chunk.mjs +0 -211
  32. package/fesm2022/_tabs-chunk.mjs.map +0 -1
  33. package/fesm2022/_toolbar-chunk.mjs +0 -273
  34. package/fesm2022/_toolbar-chunk.mjs.map +0 -1
  35. package/fesm2022/_toolbar-radio-group-chunk.mjs +0 -222
  36. package/fesm2022/_toolbar-radio-group-chunk.mjs.map +0 -1
  37. package/fesm2022/accordion.mjs +0 -195
  38. package/fesm2022/accordion.mjs.map +0 -1
  39. package/fesm2022/combobox.mjs +0 -131
  40. package/fesm2022/combobox.mjs.map +0 -1
  41. package/fesm2022/deferred-content.mjs +0 -59
  42. package/fesm2022/deferred-content.mjs.map +0 -1
  43. package/fesm2022/listbox.mjs +0 -204
  44. package/fesm2022/listbox.mjs.map +0 -1
  45. package/fesm2022/radio-group.mjs +0 -200
  46. package/fesm2022/radio-group.mjs.map +0 -1
  47. package/fesm2022/tabs.mjs +0 -303
  48. package/fesm2022/tabs.mjs.map +0 -1
  49. package/fesm2022/toolbar.mjs +0 -221
  50. package/fesm2022/toolbar.mjs.map +0 -1
  51. package/fesm2022/tree.mjs +0 -333
  52. package/fesm2022/tree.mjs.map +0 -1
  53. package/fesm2022/ui-patterns.mjs +0 -24
  54. package/fesm2022/ui-patterns.mjs.map +0 -1
  55. package/types/_accordion-chunk.d.ts +0 -90
  56. package/types/_combobox-chunk.d.ts +0 -138
  57. package/types/_expansion-chunk.d.ts +0 -71
  58. package/types/_list-chunk.d.ts +0 -209
  59. package/types/_list-navigation-chunk.d.ts +0 -101
  60. package/types/_listbox-chunk.d.ts +0 -105
  61. package/types/_pointer-event-manager-chunk.d.ts +0 -98
  62. package/types/_radio-group-chunk.d.ts +0 -92
  63. package/types/_tabs-chunk.d.ts +0 -138
  64. package/types/_toolbar-chunk.d.ts +0 -150
  65. package/types/_tree-chunk.d.ts +0 -139
  66. package/types/accordion.d.ts +0 -95
  67. package/types/combobox.d.ts +0 -54
  68. package/types/deferred-content.d.ts +0 -37
  69. package/types/listbox.d.ts +0 -99
  70. package/types/radio-group.d.ts +0 -85
  71. package/types/tabs.d.ts +0 -160
  72. package/types/toolbar.d.ts +0 -115
  73. package/types/tree.d.ts +0 -155
  74. package/types/ui-patterns.d.ts +0 -157
@@ -1 +0,0 @@
1
- {"version":3,"file":"_combobox-listbox-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/listbox/listbox.ts","../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/listbox/option.ts","../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/listbox/combobox-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 {OptionPattern} from './option';\nimport {KeyboardEventManager, PointerEventManager, Modifier} from '../behaviors/event-manager';\nimport {computed, signal} from '@angular/core';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport {List, ListInputs} from '../behaviors/list/list';\n\n/** Represents the required inputs for a listbox. */\nexport type ListboxInputs<V> = ListInputs<OptionPattern<V>, V> & {\n /** A unique identifier for the listbox. */\n id: SignalLike<string>;\n\n /** Whether the listbox is readonly. */\n readonly: SignalLike<boolean>;\n};\n\n/** Controls the state of a listbox. */\nexport class ListboxPattern<V> {\n listBehavior: List<OptionPattern<V>, V>;\n\n /** Whether the list is vertically or horizontally oriented. */\n orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** Whether the listbox is disabled. */\n disabled = computed(() => this.listBehavior.disabled());\n\n /** Whether the listbox is readonly. */\n readonly: SignalLike<boolean>;\n\n /** The tabindex of the listbox. */\n tabindex: SignalLike<-1 | 0> = computed(() => this.listBehavior.tabindex());\n\n /** The id of the current active item. */\n activedescendant = computed(() => this.listBehavior.activedescendant());\n\n /** Whether multiple items in the list can be selected at once. */\n multi: SignalLike<boolean>;\n\n /** The number of items in the listbox. */\n setsize = computed(() => this.inputs.items().length);\n\n /** Whether the listbox selection follows focus. */\n followFocus = computed(() => this.inputs.selectionMode() === 'follow');\n\n /** Whether the listbox should wrap. Used to disable wrapping while range selecting. */\n wrap = signal(true);\n\n /** The key used to navigate to the previous item in the list. */\n 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 item in the list. */\n nextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** Represents the space key. Does nothing when the user is actively using typeahead. */\n dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));\n\n /** The regexp used to decide if a key should trigger typeahead. */\n typeaheadRegexp = /^.$/; // TODO: Ignore spaces?\n\n /** The keydown event manager for the listbox. */\n keydown = computed(() => {\n const manager = new KeyboardEventManager();\n\n if (this.readonly()) {\n return manager\n .on(this.prevKey, () => this.listBehavior.prev())\n .on(this.nextKey, () => this.listBehavior.next())\n .on('Home', () => this.listBehavior.first())\n .on('End', () => this.listBehavior.last())\n .on(this.typeaheadRegexp, e => this.listBehavior.search(e.key));\n }\n\n if (!this.followFocus()) {\n manager\n .on(this.prevKey, () => this.listBehavior.prev())\n .on(this.nextKey, () => this.listBehavior.next())\n .on('Home', () => this.listBehavior.first())\n .on('End', () => this.listBehavior.last())\n .on(this.typeaheadRegexp, e => this.listBehavior.search(e.key));\n }\n\n if (this.followFocus()) {\n manager\n .on(this.prevKey, () => this.listBehavior.prev({selectOne: true}))\n .on(this.nextKey, () => this.listBehavior.next({selectOne: true}))\n .on('Home', () => this.listBehavior.first({selectOne: true}))\n .on('End', () => this.listBehavior.last({selectOne: true}))\n .on(this.typeaheadRegexp, e => this.listBehavior.search(e.key, {selectOne: true}));\n }\n\n if (this.inputs.multi()) {\n manager\n .on(Modifier.Any, 'Shift', () => this.listBehavior.anchor(this.listBehavior.activeIndex()))\n .on(Modifier.Shift, this.prevKey, () => this.listBehavior.prev({selectRange: true}))\n .on(Modifier.Shift, this.nextKey, () => this.listBehavior.next({selectRange: true}))\n .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'Home', () =>\n this.listBehavior.first({selectRange: true, anchor: false}),\n )\n .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'End', () =>\n this.listBehavior.last({selectRange: true, anchor: false}),\n )\n .on(Modifier.Shift, 'Enter', () =>\n this.listBehavior.updateSelection({selectRange: true, anchor: false}),\n )\n .on(Modifier.Shift, this.dynamicSpaceKey, () =>\n this.listBehavior.updateSelection({selectRange: true, anchor: false}),\n );\n }\n\n if (!this.followFocus() && this.inputs.multi()) {\n manager\n .on(this.dynamicSpaceKey, () => this.listBehavior.toggle())\n .on('Enter', () => this.listBehavior.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'A', () => this.listBehavior.toggleAll());\n }\n\n if (!this.followFocus() && !this.inputs.multi()) {\n manager.on(this.dynamicSpaceKey, () => this.listBehavior.toggleOne());\n manager.on('Enter', () => this.listBehavior.toggleOne());\n }\n\n if (this.inputs.multi() && this.followFocus()) {\n manager\n .on([Modifier.Ctrl, Modifier.Meta], this.prevKey, () => this.listBehavior.prev())\n .on([Modifier.Ctrl, Modifier.Meta], this.nextKey, () => this.listBehavior.next())\n .on([Modifier.Ctrl, Modifier.Meta], ' ', () => this.listBehavior.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'Enter', () => this.listBehavior.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'Home', () => this.listBehavior.first())\n .on([Modifier.Ctrl, Modifier.Meta], 'End', () => this.listBehavior.last())\n .on([Modifier.Ctrl, Modifier.Meta], 'A', () => {\n this.listBehavior.toggleAll();\n this.listBehavior.select(); // Ensure the currect option remains selected.\n });\n }\n\n return manager;\n });\n\n /** The pointerdown event manager for the listbox. */\n pointerdown = computed(() => {\n const manager = new PointerEventManager();\n\n if (this.readonly()) {\n return manager.on(e => this.listBehavior.goto(this._getItem(e)!));\n }\n\n if (this.multi()) {\n manager.on(Modifier.Shift, e =>\n this.listBehavior.goto(this._getItem(e)!, {selectRange: true}),\n );\n }\n\n if (!this.multi() && this.followFocus()) {\n return manager.on(e => this.listBehavior.goto(this._getItem(e)!, {selectOne: true}));\n }\n\n if (!this.multi() && !this.followFocus()) {\n return manager.on(e => this.listBehavior.goto(this._getItem(e)!, {toggle: true}));\n }\n\n if (this.multi() && this.followFocus()) {\n return manager\n .on(e => this.listBehavior.goto(this._getItem(e)!, {selectOne: true}))\n .on(Modifier.Ctrl, e => this.listBehavior.goto(this._getItem(e)!, {toggle: true}));\n }\n\n if (this.multi() && !this.followFocus()) {\n return manager.on(e => this.listBehavior.goto(this._getItem(e)!, {toggle: true}));\n }\n\n return manager;\n });\n\n constructor(readonly inputs: ListboxInputs<V>) {\n this.readonly = inputs.readonly;\n this.orientation = inputs.orientation;\n this.multi = inputs.multi;\n this.listBehavior = new List(inputs);\n }\n\n /** Returns a set of violations */\n validate(): string[] {\n const violations: string[] = [];\n\n if (!this.inputs.multi() && this.inputs.value().length > 1) {\n violations.push(\n `A single-select listbox should not have multiple selected options. Selected options: ${this.inputs.value().join(', ')}`,\n );\n }\n\n return violations;\n }\n\n /** Handles keydown events for the listbox. */\n onKeydown(event: KeyboardEvent) {\n if (!this.disabled()) {\n this.keydown().handle(event);\n }\n }\n\n onPointerdown(event: PointerEvent) {\n if (!this.disabled()) {\n this.pointerdown().handle(event);\n }\n }\n\n /**\n * Sets the listbox to it's default initial state.\n *\n * Sets the active index of the listbox to the first focusable selected\n * item if one exists. Otherwise, sets focus to the first focusable item.\n *\n * This method should be called once the listbox and it's options are properly initialized,\n * meaning the ListboxPattern and OptionPatterns should have references to each other before this\n * is called.\n */\n setDefaultState() {\n let firstItem: OptionPattern<V> | null = null;\n\n for (const item of this.inputs.items()) {\n if (this.listBehavior.isFocusable(item)) {\n if (!firstItem) {\n firstItem = item;\n }\n if (item.selected()) {\n this.inputs.activeItem.set(item);\n return;\n }\n }\n }\n\n if (firstItem) {\n this.inputs.activeItem.set(firstItem);\n }\n }\n\n protected _getItem(e: PointerEvent) {\n if (!(e.target instanceof HTMLElement)) {\n return;\n }\n\n const element = e.target.closest('[role=\"option\"]');\n return this.inputs.items().find(i => i.element() === element);\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 {computed} from '@angular/core';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport {List, ListInputs, ListItem} from '../behaviors/list/list';\n\n/**\n * Represents the properties exposed by a listbox that need to be accessed by an option.\n * This exists to avoid circular dependency errors between the listbox and option.\n */\ninterface ListboxPattern<V> {\n inputs: ListInputs<OptionPattern<V>, V>;\n listBehavior: List<OptionPattern<V>, V>;\n}\n\n/** Represents the required inputs for an option in a listbox. */\nexport interface OptionInputs<V> extends Omit<ListItem<V>, 'index'> {\n listbox: SignalLike<ListboxPattern<V> | undefined>;\n}\n\n/** Represents an option in a listbox. */\nexport class OptionPattern<V> {\n /** A unique identifier for the option. */\n id: SignalLike<string>;\n\n /** The value of the option. */\n value: SignalLike<V>;\n\n /** The position of the option in the list. */\n index = computed(() => this.listbox()?.inputs.items().indexOf(this) ?? -1);\n\n /** Whether the option is active. */\n active = computed(() => this.listbox()?.inputs.activeItem() === this);\n\n /** Whether the option is selected. */\n selected = computed(() => this.listbox()?.inputs.value().includes(this.value()));\n\n /** Whether the option is disabled. */\n disabled: SignalLike<boolean>;\n\n /** The text used by the typeahead search. */\n searchTerm: SignalLike<string>;\n\n /** A reference to the parent listbox. */\n listbox: SignalLike<ListboxPattern<V> | undefined>;\n\n /** The tabindex of the option. */\n tabindex = computed(() => this.listbox()?.listBehavior.getItemTabindex(this));\n\n /** The html element that should receive focus. */\n element: SignalLike<HTMLElement>;\n\n constructor(args: OptionInputs<V>) {\n this.id = args.id;\n this.value = args.value;\n this.listbox = args.listbox;\n this.element = args.element;\n this.disabled = args.disabled;\n this.searchTerm = args.searchTerm;\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 {computed} from '@angular/core';\nimport {ListboxInputs, ListboxPattern} from './listbox';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport {OptionPattern} from './option';\nimport {ComboboxPattern, ComboboxListboxControls} from '../combobox/combobox';\n\nexport type ComboboxListboxInputs<V> = ListboxInputs<V> & {\n /** The combobox controlling the listbox. */\n combobox: SignalLike<ComboboxPattern<OptionPattern<V>, V> | undefined>;\n};\n\nexport class ComboboxListboxPattern<V>\n extends ListboxPattern<V>\n implements ComboboxListboxControls<OptionPattern<V>, V>\n{\n /** A unique identifier for the popup. */\n id = computed(() => this.inputs.id());\n\n /** The ARIA role for the listbox. */\n role = computed(() => 'listbox' as const);\n\n /** The id of the active (focused) item in the listbox. */\n activeId = computed(() => this.listBehavior.activedescendant());\n\n /** The list of options in the listbox. */\n items: SignalLike<OptionPattern<V>[]> = computed(() => this.inputs.items());\n\n /** The tabindex for the listbox. Always -1 because the combobox handles focus. */\n override tabindex: SignalLike<-1 | 0> = () => -1;\n\n constructor(override readonly inputs: ComboboxListboxInputs<V>) {\n if (inputs.combobox()) {\n inputs.multi = () => false;\n inputs.focusMode = () => 'activedescendant';\n inputs.element = inputs.combobox()!.inputs.inputEl;\n }\n\n super(inputs);\n }\n\n /** Noop. The combobox handles keydown events. */\n override onKeydown(_: KeyboardEvent): void {}\n\n /** Noop. The combobox handles pointerdown events. */\n override onPointerdown(_: PointerEvent): void {}\n\n /** Noop. The combobox controls the open state. */\n override setDefaultState(): void {}\n\n /** Navigates to the specified item in the listbox. */\n focus = (item: OptionPattern<V>) => this.listBehavior.goto(item);\n\n /** Navigates to the next focusable item in the listbox. */\n next = () => this.listBehavior.next();\n\n /** Navigates to the previous focusable item in the listbox. */\n prev = () => this.listBehavior.prev();\n\n /** Navigates to the last focusable item in the listbox. */\n last = () => this.listBehavior.last();\n\n /** Navigates to the first focusable item in the listbox. */\n first = () => this.listBehavior.first();\n\n /** Unfocuses the currently focused item in the listbox. */\n unfocus = () => this.listBehavior.unfocus();\n\n /** Selects the specified item in the listbox. */\n select = (item?: OptionPattern<V>) => this.listBehavior.select(item);\n\n /** Clears the selection in the listbox. */\n clearSelection = () => this.listBehavior.deselectAll();\n\n /** Retrieves the OptionPattern associated with a pointer event. */\n getItem = (e: PointerEvent) => this._getItem(e);\n\n /** Retrieves the currently selected item in the listbox. */\n getSelectedItem = () => this.inputs.items().find(i => i.selected());\n\n /** Sets the value of the combobox listbox. */\n setValue = (value: V | undefined) => this.inputs.value.set(value ? [value] : []);\n}\n"],"names":[],"mappings":";;;;AAuBA;MACa,cAAc,CAAA;AAsKJ,IAAA,MAAA;AArKrB,IAAA,YAAY;;AAGZ,IAAA,WAAW;;AAGX,IAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;;AAGvD,IAAA,QAAQ;;AAGR,IAAA,QAAQ,GAAuB,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;;AAG3E,IAAA,gBAAgB,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,CAAC;;AAGvE,IAAA,KAAK;;AAGL,IAAA,OAAO,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC;;AAGpD,IAAA,WAAW,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,QAAQ,CAAC;;AAGtE,IAAA,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;;AAGnB,IAAA,OAAO,GAAG,QAAQ,CAAC,MAAK;QACtB,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MAAA,GAAN,MAAM;;;IAW3B,SAAS,CAAC,CAAgB,EAAA;;IAG1B,aAAa,CAAC,CAAe,EAAA;;AAG7B,IAAA,eAAe;;AAGxB,IAAA,KAAK,GAAG,CAAC,IAAsB,KAAK,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;;IAGhE,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;;IAGrC,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;;IAGrC,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;;IAGrC,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE;;IAGvC,OAAO,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;;AAG3C,IAAA,MAAM,GAAG,CAAC,IAAuB,KAAK,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC;;IAGpE,cAAc,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE;;AAGtD,IAAA,OAAO,GAAG,CAAC,CAAe,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;;IAG/C,eAAe,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;;IAGnE,QAAQ,GAAG,CAAC,KAAoB,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AACjF;;;;"}
@@ -1,398 +0,0 @@
1
- import { computed, signal } from '@angular/core';
2
- import { List } from './_list-chunk.mjs';
3
- import { ExpansionControl, ListExpansion } from './_expansion-chunk.mjs';
4
- import { Modifier, KeyboardEventManager, PointerEventManager } from './_pointer-event-manager-chunk.mjs';
5
-
6
- /**
7
- * Represents an item in a Tree.
8
- */
9
- class TreeItemPattern {
10
- inputs;
11
- /** The position of this item among its siblings. */
12
- index = computed(() => this.tree().visibleItems().indexOf(this));
13
- /** The unique identifier used by the expansion behavior. */
14
- expansionId;
15
- /** Controls expansion for child items. */
16
- expansionManager;
17
- /** Controls expansion for this item. */
18
- expansion;
19
- /** Whether the item is expandable. It's expandable if children item exist. */
20
- expandable;
21
- /** The level of the current item in a tree. */
22
- level = computed(() => this.parent().level() + 1);
23
- /** Whether this item is currently expanded. */
24
- expanded = computed(() => this.expansion.isExpanded());
25
- /** Whether this item is visible. */
26
- visible = computed(() => this.parent().expanded());
27
- /** The number of items under the same parent at the same level. */
28
- setsize = computed(() => this.parent().children().length);
29
- /** The position of this item among its siblings (1-based). */
30
- posinset = computed(() => this.parent().children().indexOf(this) + 1);
31
- /** Whether the item is active. */
32
- active = computed(() => this.tree().activeItem() === this);
33
- /** The tabindex of the item. */
34
- tabindex = computed(() => this.tree().listBehavior.getItemTabindex(this));
35
- /** Whether the item is selected. */
36
- selected = computed(() => {
37
- if (this.tree().nav()) {
38
- return undefined;
39
- }
40
- return this.tree().value().includes(this.value());
41
- });
42
- /** The current type of this item. */
43
- current = computed(() => {
44
- if (!this.tree().nav()) {
45
- return undefined;
46
- }
47
- return this.tree().value().includes(this.value()) ? this.tree().currentType() : undefined;
48
- });
49
- constructor(inputs) {
50
- this.inputs = inputs;
51
- this.id = inputs.id;
52
- this.value = inputs.value;
53
- this.element = inputs.element;
54
- this.disabled = inputs.disabled;
55
- this.searchTerm = inputs.searchTerm;
56
- this.expansionId = inputs.id;
57
- this.tree = inputs.tree;
58
- this.parent = inputs.parent;
59
- this.children = inputs.children;
60
- this.expandable = inputs.hasChildren;
61
- this.expansion = new ExpansionControl({
62
- ...inputs,
63
- expandable: this.expandable,
64
- expansionId: this.expansionId,
65
- expansionManager: this.parent().expansionManager,
66
- });
67
- this.expansionManager = new ListExpansion({
68
- ...inputs,
69
- multiExpandable: () => true,
70
- // TODO(ok7sai): allow pre-expanded tree items.
71
- expandedIds: signal([]),
72
- items: this.children,
73
- disabled: computed(() => this.tree()?.disabled() ?? false),
74
- });
75
- }
76
- }
77
- /** Controls the state and interactions of a tree view. */
78
- class TreePattern {
79
- inputs;
80
- /** The list behavior for the tree. */
81
- listBehavior;
82
- /** Controls expansion for direct children of the tree root (top-level items). */
83
- expansionManager;
84
- /** The root level is 0. */
85
- level = () => 0;
86
- /** The root is always expanded. */
87
- expanded = () => true;
88
- /** The tabindex of the tree. */
89
- tabindex = computed(() => this.listBehavior.tabindex());
90
- /** The id of the current active item. */
91
- activedescendant = computed(() => this.listBehavior.activedescendant());
92
- /** The direct children of the root (top-level tree items). */
93
- children = computed(() => this.inputs.allItems().filter(item => item.level() === this.level() + 1));
94
- /** All currently visible tree items. An item is visible if their parent is expanded. */
95
- visibleItems = computed(() => this.inputs.allItems().filter(item => item.visible()));
96
- /** Whether the tree selection follows focus. */
97
- followFocus = computed(() => this.inputs.selectionMode() === 'follow');
98
- /** The key for navigating to the previous item. */
99
- prevKey = computed(() => {
100
- if (this.inputs.orientation() === 'vertical') {
101
- return 'ArrowUp';
102
- }
103
- return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
104
- });
105
- /** The key for navigating to the next item. */
106
- nextKey = computed(() => {
107
- if (this.inputs.orientation() === 'vertical') {
108
- return 'ArrowDown';
109
- }
110
- return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
111
- });
112
- /** The key for collapsing an item or moving to its parent. */
113
- collapseKey = computed(() => {
114
- if (this.inputs.orientation() === 'horizontal') {
115
- return 'ArrowUp';
116
- }
117
- return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
118
- });
119
- /** The key for expanding an item or moving to its first child. */
120
- expandKey = computed(() => {
121
- if (this.inputs.orientation() === 'horizontal') {
122
- return 'ArrowDown';
123
- }
124
- return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
125
- });
126
- /** Represents the space key. Does nothing when the user is actively using typeahead. */
127
- dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));
128
- /** Regular expression to match characters for typeahead. */
129
- typeaheadRegexp = /^.$/;
130
- /** The keydown event manager for the tree. */
131
- keydown = computed(() => {
132
- const manager = new KeyboardEventManager();
133
- const list = this.listBehavior;
134
- manager
135
- .on(this.prevKey, () => list.prev({ selectOne: this.followFocus() }))
136
- .on(this.nextKey, () => list.next({ selectOne: this.followFocus() }))
137
- .on('Home', () => list.first({ selectOne: this.followFocus() }))
138
- .on('End', () => list.last({ selectOne: this.followFocus() }))
139
- .on(this.typeaheadRegexp, e => list.search(e.key, { selectOne: this.followFocus() }))
140
- .on(this.expandKey, () => this.expand({ selectOne: this.followFocus() }))
141
- .on(this.collapseKey, () => this.collapse({ selectOne: this.followFocus() }))
142
- .on(Modifier.Shift, '*', () => this.expandSiblings());
143
- if (this.inputs.multi()) {
144
- manager
145
- // TODO: Tracking the anchor by index can break if the
146
- // tree is expanded or collapsed causing the index to change.
147
- .on(Modifier.Any, 'Shift', () => list.anchor(this.listBehavior.activeIndex()))
148
- .on(Modifier.Shift, this.prevKey, () => list.prev({ selectRange: true }))
149
- .on(Modifier.Shift, this.nextKey, () => list.next({ selectRange: true }))
150
- .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'Home', () => list.first({ selectRange: true, anchor: false }))
151
- .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'End', () => list.last({ selectRange: true, anchor: false }))
152
- .on(Modifier.Shift, 'Enter', () => list.updateSelection({ selectRange: true, anchor: false }))
153
- .on(Modifier.Shift, this.dynamicSpaceKey, () => list.updateSelection({ selectRange: true, anchor: false }));
154
- }
155
- if (!this.followFocus() && this.inputs.multi()) {
156
- manager
157
- .on(this.dynamicSpaceKey, () => list.toggle())
158
- .on('Enter', () => list.toggle())
159
- .on([Modifier.Ctrl, Modifier.Meta], 'A', () => list.toggleAll());
160
- }
161
- if (!this.followFocus() && !this.inputs.multi()) {
162
- manager.on(this.dynamicSpaceKey, () => list.selectOne());
163
- manager.on('Enter', () => list.selectOne());
164
- }
165
- if (this.inputs.multi() && this.followFocus()) {
166
- manager
167
- .on([Modifier.Ctrl, Modifier.Meta], this.prevKey, () => list.prev())
168
- .on([Modifier.Ctrl, Modifier.Meta], this.nextKey, () => list.next())
169
- .on([Modifier.Ctrl, Modifier.Meta], this.expandKey, () => this.expand())
170
- .on([Modifier.Ctrl, Modifier.Meta], this.collapseKey, () => this.collapse())
171
- .on([Modifier.Ctrl, Modifier.Meta], ' ', () => list.toggle())
172
- .on([Modifier.Ctrl, Modifier.Meta], 'Enter', () => list.toggle())
173
- .on([Modifier.Ctrl, Modifier.Meta], 'Home', () => list.first())
174
- .on([Modifier.Ctrl, Modifier.Meta], 'End', () => list.last())
175
- .on([Modifier.Ctrl, Modifier.Meta], 'A', () => {
176
- list.toggleAll();
177
- list.select(); // Ensure the currect item remains selected.
178
- });
179
- }
180
- return manager;
181
- });
182
- /** The pointerdown event manager for the tree. */
183
- pointerdown = computed(() => {
184
- const manager = new PointerEventManager();
185
- if (this.multi()) {
186
- manager.on(Modifier.Shift, e => this.goto(e, { selectRange: true }));
187
- }
188
- if (!this.multi()) {
189
- return manager.on(e => this.goto(e, { selectOne: true }));
190
- }
191
- if (this.multi() && this.followFocus()) {
192
- return manager
193
- .on(e => this.goto(e, { selectOne: true }))
194
- .on(Modifier.Ctrl, e => this.goto(e, { toggle: true }));
195
- }
196
- if (this.multi() && !this.followFocus()) {
197
- return manager.on(e => this.goto(e, { toggle: true }));
198
- }
199
- return manager;
200
- });
201
- constructor(inputs) {
202
- this.inputs = inputs;
203
- this.id = inputs.id;
204
- this.nav = inputs.nav;
205
- this.currentType = inputs.currentType;
206
- this.allItems = inputs.allItems;
207
- this.focusMode = inputs.focusMode;
208
- this.disabled = inputs.disabled;
209
- this.activeItem = inputs.activeItem;
210
- this.skipDisabled = inputs.skipDisabled;
211
- this.wrap = inputs.wrap;
212
- this.orientation = inputs.orientation;
213
- this.textDirection = inputs.textDirection;
214
- this.multi = computed(() => (this.nav() ? false : this.inputs.multi()));
215
- this.selectionMode = inputs.selectionMode;
216
- this.typeaheadDelay = inputs.typeaheadDelay;
217
- this.value = inputs.value;
218
- this.listBehavior = new List({
219
- ...inputs,
220
- items: this.visibleItems,
221
- multi: this.multi,
222
- });
223
- this.expansionManager = new ListExpansion({
224
- multiExpandable: () => true,
225
- // TODO(ok7sai): allow pre-expanded tree items.
226
- expandedIds: signal([]),
227
- items: this.children,
228
- disabled: this.disabled,
229
- });
230
- }
231
- /**
232
- * Sets the tree to it's default initial state.
233
- *
234
- * Sets the active index of the tree to the first focusable selected tree item if one exists.
235
- * Otherwise, sets focus to the first focusable tree item.
236
- */
237
- setDefaultState() {
238
- let firstItem;
239
- for (const item of this.allItems()) {
240
- if (!item.visible())
241
- continue;
242
- if (!this.listBehavior.isFocusable(item))
243
- continue;
244
- if (firstItem === undefined) {
245
- firstItem = item;
246
- }
247
- if (item.selected()) {
248
- this.activeItem.set(item);
249
- return;
250
- }
251
- }
252
- if (firstItem !== undefined) {
253
- this.activeItem.set(firstItem);
254
- }
255
- }
256
- /** Handles keydown events on the tree. */
257
- onKeydown(event) {
258
- if (!this.disabled()) {
259
- this.keydown().handle(event);
260
- }
261
- }
262
- /** Handles pointerdown events on the tree. */
263
- onPointerdown(event) {
264
- if (!this.disabled()) {
265
- this.pointerdown().handle(event);
266
- }
267
- }
268
- /** Navigates to the given tree item in the tree. */
269
- goto(e, opts) {
270
- const item = this._getItem(e);
271
- if (!item)
272
- return;
273
- this.listBehavior.goto(item, opts);
274
- this.toggleExpansion(item);
275
- }
276
- /** Toggles to expand or collapse a tree item. */
277
- toggleExpansion(item) {
278
- item ??= this.activeItem();
279
- if (!item || !this.listBehavior.isFocusable(item))
280
- return;
281
- if (!item.expandable())
282
- return;
283
- if (item.expanded()) {
284
- this.collapse();
285
- }
286
- else {
287
- item.expansion.open();
288
- }
289
- }
290
- /** Expands a tree item. */
291
- expand(opts) {
292
- const item = this.activeItem();
293
- if (!item || !this.listBehavior.isFocusable(item))
294
- return;
295
- if (item.expandable() && !item.expanded()) {
296
- item.expansion.open();
297
- }
298
- else if (item.expanded() &&
299
- item.children().some(item => this.listBehavior.isFocusable(item))) {
300
- this.listBehavior.next(opts);
301
- }
302
- }
303
- /** Expands all sibling tree items including itself. */
304
- expandSiblings(item) {
305
- item ??= this.activeItem();
306
- const siblings = item?.parent()?.children();
307
- siblings?.forEach(item => item.expansion.open());
308
- }
309
- /** Collapses a tree item. */
310
- collapse(opts) {
311
- const item = this.activeItem();
312
- if (!item || !this.listBehavior.isFocusable(item))
313
- return;
314
- if (item.expandable() && item.expanded()) {
315
- item.expansion.close();
316
- }
317
- else if (item.parent() && item.parent() !== this) {
318
- const parentItem = item.parent();
319
- if (parentItem instanceof TreeItemPattern && this.listBehavior.isFocusable(parentItem)) {
320
- this.listBehavior.goto(parentItem, opts);
321
- }
322
- }
323
- }
324
- /** Retrieves the TreeItemPattern associated with a DOM event, if any. */
325
- _getItem(event) {
326
- if (!(event.target instanceof HTMLElement)) {
327
- return;
328
- }
329
- const element = event.target.closest('[role="treeitem"]');
330
- return this.inputs.allItems().find(i => i.element() === element);
331
- }
332
- }
333
-
334
- class ComboboxTreePattern extends TreePattern {
335
- inputs;
336
- /** Whether the currently focused item is collapsible. */
337
- isItemCollapsible = () => this.activeItem()?.parent() instanceof TreeItemPattern;
338
- /** The ARIA role for the tree. */
339
- role = () => 'tree';
340
- /* The id of the active (focused) item in the tree. */
341
- activeId = computed(() => this.listBehavior.activedescendant());
342
- /** The list of items in the tree. */
343
- items = computed(() => this.inputs.allItems());
344
- /** The tabindex for the tree. Always -1 because the combobox handles focus. */
345
- tabindex = () => -1;
346
- constructor(inputs) {
347
- if (inputs.combobox()) {
348
- inputs.multi = () => false;
349
- inputs.focusMode = () => 'activedescendant';
350
- inputs.element = inputs.combobox().inputs.inputEl;
351
- }
352
- super(inputs);
353
- this.inputs = inputs;
354
- }
355
- /** Noop. The combobox handles keydown events. */
356
- onKeydown(_) { }
357
- /** Noop. The combobox handles pointerdown events. */
358
- onPointerdown(_) { }
359
- /** Noop. The combobox controls the open state. */
360
- setDefaultState() { }
361
- /** Navigates to the specified item in the tree. */
362
- focus = (item) => this.listBehavior.goto(item);
363
- /** Navigates to the next focusable item in the tree. */
364
- next = () => this.listBehavior.next();
365
- /** Navigates to the previous focusable item in the tree. */
366
- prev = () => this.listBehavior.prev();
367
- /** Navigates to the last focusable item in the tree. */
368
- last = () => this.listBehavior.last();
369
- /** Navigates to the first focusable item in the tree. */
370
- first = () => this.listBehavior.first();
371
- /** Unfocuses the currently focused item in the tree. */
372
- unfocus = () => this.listBehavior.unfocus();
373
- /** Selects the specified item in the tree or the current active item if not provided. */
374
- select = (item) => this.listBehavior.select(item);
375
- /** Clears the selection in the tree. */
376
- clearSelection = () => this.listBehavior.deselectAll();
377
- /** Retrieves the TreeItemPattern associated with a pointer event. */
378
- getItem = (e) => this._getItem(e);
379
- /** Retrieves the currently selected item in the tree */
380
- getSelectedItem = () => this.inputs.allItems().find(i => i.selected());
381
- /** Sets the value of the combobox tree. */
382
- setValue = (value) => this.inputs.value.set(value ? [value] : []);
383
- /** Expands the currently focused item if it is expandable. */
384
- expandItem = () => this.expand();
385
- /** Collapses the currently focused item if it is expandable. */
386
- collapseItem = () => this.collapse();
387
- /** Whether the specified item or the currently active item is expandable. */
388
- isItemExpandable(item = this.activeItem()) {
389
- return item ? item.expandable() : false;
390
- }
391
- /** Expands all of the tree items. */
392
- expandAll = () => this.items().forEach(item => item.expansion.open());
393
- /** Collapses all of the tree items. */
394
- collapseAll = () => this.items().forEach(item => item.expansion.close());
395
- }
396
-
397
- export { ComboboxTreePattern, TreeItemPattern, TreePattern };
398
- //# sourceMappingURL=_combobox-tree-chunk.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_combobox-tree-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/tree/tree.ts","../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/tree/combobox-tree.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} from '@angular/core';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport {List, ListInputs, ListItem} from '../behaviors/list/list';\nimport {ExpansionItem, ExpansionControl, ListExpansion} from '../behaviors/expansion/expansion';\nimport {KeyboardEventManager, PointerEventManager, Modifier} from '../behaviors/event-manager';\n\n/** Represents the required inputs for a tree item. */\nexport interface TreeItemInputs<V> extends Omit<ListItem<V>, 'index'> {\n /** The parent item. */\n parent: SignalLike<TreeItemPattern<V> | TreePattern<V>>;\n\n /** Whether this item has children. Children can be lazily loaded. */\n hasChildren: SignalLike<boolean>;\n\n /** The children items. */\n children: SignalLike<TreeItemPattern<V>[]>;\n\n /** The tree pattern this item belongs to. */\n tree: SignalLike<TreePattern<V>>;\n}\n\nexport interface TreeItemPattern<V> extends TreeItemInputs<V> {}\n/**\n * Represents an item in a Tree.\n */\nexport class TreeItemPattern<V> implements ExpansionItem {\n /** The position of this item among its siblings. */\n readonly index = computed(() => this.tree().visibleItems().indexOf(this));\n\n /** The unique identifier used by the expansion behavior. */\n readonly expansionId: SignalLike<string>;\n\n /** Controls expansion for child items. */\n readonly expansionManager: ListExpansion;\n\n /** Controls expansion for this item. */\n readonly expansion: ExpansionControl;\n\n /** Whether the item is expandable. It's expandable if children item exist. */\n readonly expandable: SignalLike<boolean>;\n\n /** The level of the current item in a tree. */\n readonly level: SignalLike<number> = computed(() => this.parent().level() + 1);\n\n /** Whether this item is currently expanded. */\n readonly expanded = computed(() => this.expansion.isExpanded());\n\n /** Whether this item is visible. */\n readonly visible = computed(() => this.parent().expanded());\n\n /** The number of items under the same parent at the same level. */\n readonly setsize = computed(() => this.parent().children().length);\n\n /** The position of this item among its siblings (1-based). */\n readonly posinset = computed(() => this.parent().children().indexOf(this) + 1);\n\n /** Whether the item is active. */\n readonly active = computed(() => this.tree().activeItem() === this);\n\n /** The tabindex of the item. */\n readonly tabindex = computed(() => this.tree().listBehavior.getItemTabindex(this));\n\n /** Whether the item is selected. */\n readonly selected = computed(() => {\n if (this.tree().nav()) {\n return undefined;\n }\n return this.tree().value().includes(this.value());\n });\n\n /** The current type of this item. */\n readonly current = computed(() => {\n if (!this.tree().nav()) {\n return undefined;\n }\n return this.tree().value().includes(this.value()) ? this.tree().currentType() : undefined;\n });\n\n constructor(readonly inputs: TreeItemInputs<V>) {\n this.id = inputs.id;\n this.value = inputs.value;\n this.element = inputs.element;\n this.disabled = inputs.disabled;\n this.searchTerm = inputs.searchTerm;\n this.expansionId = inputs.id;\n this.tree = inputs.tree;\n this.parent = inputs.parent;\n this.children = inputs.children;\n this.expandable = inputs.hasChildren;\n this.expansion = new ExpansionControl({\n ...inputs,\n expandable: this.expandable,\n expansionId: this.expansionId,\n expansionManager: this.parent().expansionManager,\n });\n this.expansionManager = new ListExpansion({\n ...inputs,\n multiExpandable: () => true,\n // TODO(ok7sai): allow pre-expanded tree items.\n expandedIds: signal([]),\n items: this.children,\n disabled: computed(() => this.tree()?.disabled() ?? false),\n });\n }\n}\n\n/** The selection operations that the tree can perform. */\ninterface SelectOptions {\n toggle?: boolean;\n selectOne?: boolean;\n selectRange?: boolean;\n anchor?: boolean;\n}\n\n/** Represents the required inputs for a tree. */\nexport interface TreeInputs<V> extends Omit<ListInputs<TreeItemPattern<V>, V>, 'items'> {\n /** A unique identifier for the tree. */\n id: SignalLike<string>;\n\n /** All items in the tree, in document order (DFS-like, a flattened list). */\n allItems: SignalLike<TreeItemPattern<V>[]>;\n\n /** Whether the tree is in navigation mode. */\n nav: SignalLike<boolean>;\n\n /** The aria-current type. */\n currentType: SignalLike<'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false'>;\n}\n\nexport interface TreePattern<V> extends TreeInputs<V> {}\n/** Controls the state and interactions of a tree view. */\nexport class TreePattern<V> {\n /** The list behavior for the tree. */\n readonly listBehavior: List<TreeItemPattern<V>, V>;\n\n /** Controls expansion for direct children of the tree root (top-level items). */\n readonly expansionManager: ListExpansion;\n\n /** The root level is 0. */\n readonly level = () => 0;\n\n /** The root is always expanded. */\n readonly expanded = () => true;\n\n /** The tabindex of the tree. */\n tabindex: SignalLike<-1 | 0> = computed(() => this.listBehavior.tabindex());\n\n /** The id of the current active item. */\n readonly activedescendant = computed(() => this.listBehavior.activedescendant());\n\n /** The direct children of the root (top-level tree items). */\n readonly children = computed(() =>\n this.inputs.allItems().filter(item => item.level() === this.level() + 1),\n );\n\n /** All currently visible tree items. An item is visible if their parent is expanded. */\n readonly visibleItems = computed(() => this.inputs.allItems().filter(item => item.visible()));\n\n /** Whether the tree selection follows focus. */\n readonly followFocus = computed(() => this.inputs.selectionMode() === 'follow');\n\n /** The key for navigating to the previous item. */\n 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 for navigating to the next item. */\n 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 key for collapsing an item or moving to its parent. */\n readonly collapseKey = computed(() => {\n if (this.inputs.orientation() === 'horizontal') {\n return 'ArrowUp';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key for expanding an item or moving to its first child. */\n readonly expandKey = computed(() => {\n if (this.inputs.orientation() === 'horizontal') {\n return 'ArrowDown';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** Represents the space key. Does nothing when the user is actively using typeahead. */\n readonly dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));\n\n /** Regular expression to match characters for typeahead. */\n readonly typeaheadRegexp = /^.$/;\n\n /** The keydown event manager for the tree. */\n readonly keydown = computed(() => {\n const manager = new KeyboardEventManager();\n const list = this.listBehavior;\n\n manager\n .on(this.prevKey, () => list.prev({selectOne: this.followFocus()}))\n .on(this.nextKey, () => list.next({selectOne: this.followFocus()}))\n .on('Home', () => list.first({selectOne: this.followFocus()}))\n .on('End', () => list.last({selectOne: this.followFocus()}))\n .on(this.typeaheadRegexp, e => list.search(e.key, {selectOne: this.followFocus()}))\n .on(this.expandKey, () => this.expand({selectOne: this.followFocus()}))\n .on(this.collapseKey, () => this.collapse({selectOne: this.followFocus()}))\n .on(Modifier.Shift, '*', () => this.expandSiblings());\n\n if (this.inputs.multi()) {\n manager\n // TODO: Tracking the anchor by index can break if the\n // tree is expanded or collapsed causing the index to change.\n .on(Modifier.Any, 'Shift', () => list.anchor(this.listBehavior.activeIndex()))\n .on(Modifier.Shift, this.prevKey, () => list.prev({selectRange: true}))\n .on(Modifier.Shift, this.nextKey, () => list.next({selectRange: true}))\n .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'Home', () =>\n list.first({selectRange: true, anchor: false}),\n )\n .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'End', () =>\n list.last({selectRange: true, anchor: false}),\n )\n .on(Modifier.Shift, 'Enter', () => list.updateSelection({selectRange: true, anchor: false}))\n .on(Modifier.Shift, this.dynamicSpaceKey, () =>\n list.updateSelection({selectRange: true, anchor: false}),\n );\n }\n\n if (!this.followFocus() && this.inputs.multi()) {\n manager\n .on(this.dynamicSpaceKey, () => list.toggle())\n .on('Enter', () => list.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'A', () => list.toggleAll());\n }\n\n if (!this.followFocus() && !this.inputs.multi()) {\n manager.on(this.dynamicSpaceKey, () => list.selectOne());\n manager.on('Enter', () => list.selectOne());\n }\n\n if (this.inputs.multi() && this.followFocus()) {\n manager\n .on([Modifier.Ctrl, Modifier.Meta], this.prevKey, () => list.prev())\n .on([Modifier.Ctrl, Modifier.Meta], this.nextKey, () => list.next())\n .on([Modifier.Ctrl, Modifier.Meta], this.expandKey, () => this.expand())\n .on([Modifier.Ctrl, Modifier.Meta], this.collapseKey, () => this.collapse())\n .on([Modifier.Ctrl, Modifier.Meta], ' ', () => list.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'Enter', () => list.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'Home', () => list.first())\n .on([Modifier.Ctrl, Modifier.Meta], 'End', () => list.last())\n .on([Modifier.Ctrl, Modifier.Meta], 'A', () => {\n list.toggleAll();\n list.select(); // Ensure the currect item remains selected.\n });\n }\n\n return manager;\n });\n\n /** The pointerdown event manager for the tree. */\n pointerdown = computed(() => {\n const manager = new PointerEventManager();\n\n if (this.multi()) {\n manager.on(Modifier.Shift, e => this.goto(e, {selectRange: true}));\n }\n\n if (!this.multi()) {\n return manager.on(e => this.goto(e, {selectOne: true}));\n }\n\n if (this.multi() && this.followFocus()) {\n return manager\n .on(e => this.goto(e, {selectOne: true}))\n .on(Modifier.Ctrl, e => this.goto(e, {toggle: true}));\n }\n\n if (this.multi() && !this.followFocus()) {\n return manager.on(e => this.goto(e, {toggle: true}));\n }\n\n return manager;\n });\n\n constructor(readonly inputs: TreeInputs<V>) {\n this.id = inputs.id;\n this.nav = inputs.nav;\n this.currentType = inputs.currentType;\n this.allItems = inputs.allItems;\n this.focusMode = inputs.focusMode;\n this.disabled = inputs.disabled;\n this.activeItem = inputs.activeItem;\n this.skipDisabled = inputs.skipDisabled;\n this.wrap = inputs.wrap;\n this.orientation = inputs.orientation;\n this.textDirection = inputs.textDirection;\n this.multi = computed(() => (this.nav() ? false : this.inputs.multi()));\n this.selectionMode = inputs.selectionMode;\n this.typeaheadDelay = inputs.typeaheadDelay;\n this.value = inputs.value;\n\n this.listBehavior = new List({\n ...inputs,\n items: this.visibleItems,\n multi: this.multi,\n });\n\n this.expansionManager = new ListExpansion({\n multiExpandable: () => true,\n // TODO(ok7sai): allow pre-expanded tree items.\n expandedIds: signal([]),\n items: this.children,\n disabled: this.disabled,\n });\n }\n\n /**\n * Sets the tree to it's default initial state.\n *\n * Sets the active index of the tree to the first focusable selected tree item if one exists.\n * Otherwise, sets focus to the first focusable tree item.\n */\n setDefaultState() {\n let firstItem: TreeItemPattern<V> | undefined;\n\n for (const item of this.allItems()) {\n if (!item.visible()) continue;\n if (!this.listBehavior.isFocusable(item)) continue;\n\n if (firstItem === undefined) {\n firstItem = item;\n }\n\n if (item.selected()) {\n this.activeItem.set(item);\n return;\n }\n }\n\n if (firstItem !== undefined) {\n this.activeItem.set(firstItem);\n }\n }\n\n /** Handles keydown events on the tree. */\n onKeydown(event: KeyboardEvent) {\n if (!this.disabled()) {\n this.keydown().handle(event);\n }\n }\n\n /** Handles pointerdown events on the tree. */\n onPointerdown(event: PointerEvent) {\n if (!this.disabled()) {\n this.pointerdown().handle(event);\n }\n }\n\n /** Navigates to the given tree item in the tree. */\n goto(e: PointerEvent, opts?: SelectOptions) {\n const item = this._getItem(e);\n if (!item) return;\n\n this.listBehavior.goto(item, opts);\n this.toggleExpansion(item);\n }\n\n /** Toggles to expand or collapse a tree item. */\n toggleExpansion(item?: TreeItemPattern<V>) {\n item ??= this.activeItem();\n if (!item || !this.listBehavior.isFocusable(item)) return;\n\n if (!item.expandable()) return;\n if (item.expanded()) {\n this.collapse();\n } else {\n item.expansion.open();\n }\n }\n\n /** Expands a tree item. */\n expand(opts?: SelectOptions) {\n const item = this.activeItem();\n if (!item || !this.listBehavior.isFocusable(item)) return;\n\n if (item.expandable() && !item.expanded()) {\n item.expansion.open();\n } else if (\n item.expanded() &&\n item.children().some(item => this.listBehavior.isFocusable(item))\n ) {\n this.listBehavior.next(opts);\n }\n }\n\n /** Expands all sibling tree items including itself. */\n expandSiblings(item?: TreeItemPattern<V>) {\n item ??= this.activeItem();\n const siblings = item?.parent()?.children();\n siblings?.forEach(item => item.expansion.open());\n }\n\n /** Collapses a tree item. */\n collapse(opts?: SelectOptions) {\n const item = this.activeItem();\n if (!item || !this.listBehavior.isFocusable(item)) return;\n\n if (item.expandable() && item.expanded()) {\n item.expansion.close();\n } else if (item.parent() && item.parent() !== this) {\n const parentItem = item.parent();\n if (parentItem instanceof TreeItemPattern && this.listBehavior.isFocusable(parentItem)) {\n this.listBehavior.goto(parentItem, opts);\n }\n }\n }\n\n /** Retrieves the TreeItemPattern associated with a DOM event, if any. */\n protected _getItem(event: Event): TreeItemPattern<V> | undefined {\n if (!(event.target instanceof HTMLElement)) {\n return;\n }\n const element = event.target.closest('[role=\"treeitem\"]');\n return this.inputs.allItems().find(i => i.element() === element);\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 {computed} from '@angular/core';\nimport {TreeInputs, TreePattern, TreeItemPattern} from './tree';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport {ComboboxPattern, ComboboxTreeControls} from '../combobox/combobox';\n\nexport type ComboboxTreeInputs<V> = TreeInputs<V> & {\n /** The combobox controlling the tree. */\n combobox: SignalLike<ComboboxPattern<TreeItemPattern<V>, V> | undefined>;\n};\n\nexport class ComboboxTreePattern<V>\n extends TreePattern<V>\n implements ComboboxTreeControls<TreeItemPattern<V>, V>\n{\n /** Whether the currently focused item is collapsible. */\n isItemCollapsible = () => this.activeItem()?.parent() instanceof TreeItemPattern;\n\n /** The ARIA role for the tree. */\n role = () => 'tree' as const;\n\n /* The id of the active (focused) item in the tree. */\n activeId = computed(() => this.listBehavior.activedescendant());\n\n /** The list of items in the tree. */\n items = computed(() => this.inputs.allItems());\n\n /** The tabindex for the tree. Always -1 because the combobox handles focus. */\n override tabindex: SignalLike<-1 | 0> = () => -1;\n\n constructor(override readonly inputs: ComboboxTreeInputs<V>) {\n if (inputs.combobox()) {\n inputs.multi = () => false;\n inputs.focusMode = () => 'activedescendant';\n inputs.element = inputs.combobox()!.inputs.inputEl;\n }\n\n super(inputs);\n }\n\n /** Noop. The combobox handles keydown events. */\n override onKeydown(_: KeyboardEvent): void {}\n\n /** Noop. The combobox handles pointerdown events. */\n override onPointerdown(_: PointerEvent): void {}\n\n /** Noop. The combobox controls the open state. */\n override setDefaultState(): void {}\n\n /** Navigates to the specified item in the tree. */\n focus = (item: TreeItemPattern<V>) => this.listBehavior.goto(item);\n\n /** Navigates to the next focusable item in the tree. */\n next = () => this.listBehavior.next();\n\n /** Navigates to the previous focusable item in the tree. */\n prev = () => this.listBehavior.prev();\n\n /** Navigates to the last focusable item in the tree. */\n last = () => this.listBehavior.last();\n\n /** Navigates to the first focusable item in the tree. */\n first = () => this.listBehavior.first();\n\n /** Unfocuses the currently focused item in the tree. */\n unfocus = () => this.listBehavior.unfocus();\n\n /** Selects the specified item in the tree or the current active item if not provided. */\n select = (item?: TreeItemPattern<V>) => this.listBehavior.select(item);\n\n /** Clears the selection in the tree. */\n clearSelection = () => this.listBehavior.deselectAll();\n\n /** Retrieves the TreeItemPattern associated with a pointer event. */\n getItem = (e: PointerEvent) => this._getItem(e);\n\n /** Retrieves the currently selected item in the tree */\n getSelectedItem = () => this.inputs.allItems().find(i => i.selected());\n\n /** Sets the value of the combobox tree. */\n setValue = (value: V | undefined) => this.inputs.value.set(value ? [value] : []);\n\n /** Expands the currently focused item if it is expandable. */\n expandItem = () => this.expand();\n\n /** Collapses the currently focused item if it is expandable. */\n collapseItem = () => this.collapse();\n\n /** Whether the specified item or the currently active item is expandable. */\n isItemExpandable(item: TreeItemPattern<V> | undefined = this.activeItem()) {\n return item ? item.expandable() : false;\n }\n\n /** Expands all of the tree items. */\n expandAll = () => this.items().forEach(item => item.expansion.open());\n\n /** Collapses all of the tree items. */\n collapseAll = () => this.items().forEach(item => item.expansion.close());\n}\n"],"names":[],"mappings":";;;;;AA8BA;;AAEG;MACU,eAA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,KAAK,EAAE;;IAGvC,OAAO,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;;AAG3C,IAAA,MAAM,GAAG,CAAC,IAAyB,KAAK,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC;;IAGtE,cAAc,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE;;AAGtD,IAAA,OAAO,GAAG,CAAC,CAAe,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;;IAG/C,eAAe,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;;IAGtE,QAAQ,GAAG,CAAC,KAAoB,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;;IAGhF,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE;;IAGhC,YAAY,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE;;AAGpC,IAAA,gBAAgB,CAAC,IAAA,GAAuC,IAAI,CAAC,UAAU,EAAE,EAAA;AACvE,QAAA,OAAO,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,KAAK;;;IAIzC,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;;IAGrE,WAAW,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;AACzE;;;;"}
@@ -1,87 +0,0 @@
1
- import { computed } from '@angular/core';
2
-
3
- /**
4
- * Controls a single item's expansion state and interactions,
5
- * delegating actual state changes to an Expansion manager.
6
- */
7
- class ExpansionControl {
8
- inputs;
9
- /** Whether this specific item is currently expanded. Derived from the Expansion manager. */
10
- isExpanded = computed(() => this.inputs.expansionManager.isExpanded(this));
11
- /** Whether this item can be expanded. */
12
- isExpandable = computed(() => this.inputs.expansionManager.isExpandable(this));
13
- constructor(inputs) {
14
- this.inputs = inputs;
15
- this.expansionId = inputs.expansionId;
16
- this.expandable = inputs.expandable;
17
- this.disabled = inputs.disabled;
18
- }
19
- /** Requests the Expansion manager to open this item. */
20
- open() {
21
- this.inputs.expansionManager.open(this);
22
- }
23
- /** Requests the Expansion manager to close this item. */
24
- close() {
25
- this.inputs.expansionManager.close(this);
26
- }
27
- /** Requests the Expansion manager to toggle this item. */
28
- toggle() {
29
- this.inputs.expansionManager.toggle(this);
30
- }
31
- }
32
- /** Manages the expansion state of a list of items. */
33
- class ListExpansion {
34
- inputs;
35
- /** A signal holding an array of ids of the currently expanded items. */
36
- expandedIds;
37
- constructor(inputs) {
38
- this.inputs = inputs;
39
- this.expandedIds = inputs.expandedIds;
40
- }
41
- /** Opens the specified item. */
42
- open(item) {
43
- if (!this.isExpandable(item))
44
- return;
45
- if (this.isExpanded(item))
46
- return;
47
- if (!this.inputs.multiExpandable()) {
48
- this.closeAll();
49
- }
50
- this.expandedIds.update(ids => ids.concat(item.expansionId()));
51
- }
52
- /** Closes the specified item. */
53
- close(item) {
54
- if (this.isExpandable(item)) {
55
- this.expandedIds.update(ids => ids.filter(id => id !== item.expansionId()));
56
- }
57
- }
58
- /** Toggles the expansion state of the specified item. */
59
- toggle(item) {
60
- this.expandedIds().includes(item.expansionId()) ? this.close(item) : this.open(item);
61
- }
62
- /** Opens all focusable items in the list. */
63
- openAll() {
64
- if (this.inputs.multiExpandable()) {
65
- for (const item of this.inputs.items()) {
66
- this.open(item);
67
- }
68
- }
69
- }
70
- /** Closes all focusable items in the list. */
71
- closeAll() {
72
- for (const item of this.inputs.items()) {
73
- this.close(item);
74
- }
75
- }
76
- /** Checks whether the specified item is expandable / collapsible. */
77
- isExpandable(item) {
78
- return !this.inputs.disabled() && !item.disabled() && item.expandable();
79
- }
80
- /** Checks whether the specified item is currently expanded. */
81
- isExpanded(item) {
82
- return this.expandedIds().includes(item.expansionId());
83
- }
84
- }
85
-
86
- export { ExpansionControl, ListExpansion };
87
- //# sourceMappingURL=_expansion-chunk.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_expansion-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/behaviors/expansion/expansion.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 */\nimport {computed} from '@angular/core';\nimport {SignalLike, WritableSignalLike} from '../signal-like/signal-like';\n\n/** Represents an item that can be expanded or collapsed. */\nexport interface ExpansionItem {\n /** Whether the item is expandable. */\n expandable: SignalLike<boolean>;\n\n /** Used to uniquely identify an expansion item. */\n expansionId: SignalLike<string>;\n\n /** Whether the expansion is disabled. */\n disabled: SignalLike<boolean>;\n}\n\nexport interface ExpansionControl extends ExpansionItem {}\n/**\n * Controls a single item's expansion state and interactions,\n * delegating actual state changes to an Expansion manager.\n */\nexport class ExpansionControl {\n /** Whether this specific item is currently expanded. Derived from the Expansion manager. */\n readonly isExpanded = computed(() => this.inputs.expansionManager.isExpanded(this));\n\n /** Whether this item can be expanded. */\n readonly isExpandable = computed(() => this.inputs.expansionManager.isExpandable(this));\n\n constructor(readonly inputs: ExpansionItem & {expansionManager: ListExpansion}) {\n this.expansionId = inputs.expansionId;\n this.expandable = inputs.expandable;\n this.disabled = inputs.disabled;\n }\n\n /** Requests the Expansion manager to open this item. */\n open() {\n this.inputs.expansionManager.open(this);\n }\n\n /** Requests the Expansion manager to close this item. */\n close() {\n this.inputs.expansionManager.close(this);\n }\n\n /** Requests the Expansion manager to toggle this item. */\n toggle() {\n this.inputs.expansionManager.toggle(this);\n }\n}\n\n/** Represents the required inputs for an expansion behavior. */\nexport interface ListExpansionInputs {\n /** Whether multiple items can be expanded at once. */\n multiExpandable: SignalLike<boolean>;\n\n /** An array of ids of the currently expanded items. */\n expandedIds: WritableSignalLike<string[]>;\n\n /** An array of expansion items. */\n items: SignalLike<ExpansionItem[]>;\n\n /** Whether all expansions are disabled. */\n disabled: SignalLike<boolean>;\n}\n\n/** Manages the expansion state of a list of items. */\nexport class ListExpansion {\n /** A signal holding an array of ids of the currently expanded items. */\n expandedIds: WritableSignalLike<string[]>;\n\n constructor(readonly inputs: ListExpansionInputs) {\n this.expandedIds = inputs.expandedIds;\n }\n\n /** Opens the specified item. */\n open(item: ExpansionItem) {\n if (!this.isExpandable(item)) return;\n if (this.isExpanded(item)) return;\n if (!this.inputs.multiExpandable()) {\n this.closeAll();\n }\n this.expandedIds.update(ids => ids.concat(item.expansionId()));\n }\n\n /** Closes the specified item. */\n close(item: ExpansionItem) {\n if (this.isExpandable(item)) {\n this.expandedIds.update(ids => ids.filter(id => id !== item.expansionId()));\n }\n }\n\n /** Toggles the expansion state of the specified item. */\n toggle(item: ExpansionItem) {\n this.expandedIds().includes(item.expansionId()) ? this.close(item) : this.open(item);\n }\n\n /** Opens all focusable items in the list. */\n openAll() {\n if (this.inputs.multiExpandable()) {\n for (const item of this.inputs.items()) {\n this.open(item);\n }\n }\n }\n\n /** Closes all focusable items in the list. */\n closeAll() {\n for (const item of this.inputs.items()) {\n this.close(item);\n }\n }\n\n /** Checks whether the specified item is expandable / collapsible. */\n isExpandable(item: ExpansionItem) {\n return !this.inputs.disabled() && !item.disabled() && item.expandable();\n }\n\n /** Checks whether the specified item is currently expanded. */\n isExpanded(item: ExpansionItem): boolean {\n return this.expandedIds().includes(item.expansionId());\n }\n}\n"],"names":[],"mappings":";;AAuBA;;;AAGG;MACU,gBAAgB,CAAA;AAON,IAAA,MAAA;;AALZ,IAAA,UAAU,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;;AAG1E,IA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