@angular/cdk-experimental 21.0.0-next.6 → 21.0.0-next.8
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/_polyfill-chunk.mjs.map +1 -1
- package/fesm2022/cdk-experimental.mjs +1 -1
- package/fesm2022/cdk-experimental.mjs.map +1 -1
- package/fesm2022/column-resize.mjs.map +1 -1
- package/fesm2022/popover-edit.mjs.map +1 -1
- package/fesm2022/scrolling.mjs.map +1 -1
- package/fesm2022/selection.mjs.map +1 -1
- package/fesm2022/table-scroll-container.mjs.map +1 -1
- package/package.json +3 -38
- package/types/column-resize.d.ts +37 -37
- package/types/popover-edit.d.ts +30 -30
- package/types/scrolling.d.ts +6 -6
- package/types/selection.d.ts +14 -14
- package/types/table-scroll-container.d.ts +6 -6
- package/fesm2022/_accordion-chunk.mjs +0 -153
- package/fesm2022/_accordion-chunk.mjs.map +0 -1
- package/fesm2022/_combobox-chunk.mjs +0 -278
- package/fesm2022/_combobox-chunk.mjs.map +0 -1
- package/fesm2022/_combobox-listbox-chunk.mjs +0 -278
- package/fesm2022/_combobox-listbox-chunk.mjs.map +0 -1
- package/fesm2022/_combobox-tree-chunk.mjs +0 -398
- package/fesm2022/_combobox-tree-chunk.mjs.map +0 -1
- package/fesm2022/_expansion-chunk.mjs +0 -87
- package/fesm2022/_expansion-chunk.mjs.map +0 -1
- package/fesm2022/_list-chunk.mjs +0 -374
- package/fesm2022/_list-chunk.mjs.map +0 -1
- package/fesm2022/_list-navigation-chunk.mjs +0 -131
- package/fesm2022/_list-navigation-chunk.mjs.map +0 -1
- package/fesm2022/_pointer-event-manager-chunk.mjs +0 -145
- package/fesm2022/_pointer-event-manager-chunk.mjs.map +0 -1
- package/fesm2022/_tabs-chunk.mjs +0 -211
- package/fesm2022/_tabs-chunk.mjs.map +0 -1
- package/fesm2022/_toolbar-chunk.mjs +0 -273
- package/fesm2022/_toolbar-chunk.mjs.map +0 -1
- package/fesm2022/_toolbar-radio-group-chunk.mjs +0 -222
- package/fesm2022/_toolbar-radio-group-chunk.mjs.map +0 -1
- package/fesm2022/accordion.mjs +0 -195
- package/fesm2022/accordion.mjs.map +0 -1
- package/fesm2022/combobox.mjs +0 -131
- package/fesm2022/combobox.mjs.map +0 -1
- package/fesm2022/deferred-content.mjs +0 -59
- package/fesm2022/deferred-content.mjs.map +0 -1
- package/fesm2022/listbox.mjs +0 -204
- package/fesm2022/listbox.mjs.map +0 -1
- package/fesm2022/radio-group.mjs +0 -200
- package/fesm2022/radio-group.mjs.map +0 -1
- package/fesm2022/tabs.mjs +0 -303
- package/fesm2022/tabs.mjs.map +0 -1
- package/fesm2022/toolbar.mjs +0 -221
- package/fesm2022/toolbar.mjs.map +0 -1
- package/fesm2022/tree.mjs +0 -333
- package/fesm2022/tree.mjs.map +0 -1
- package/fesm2022/ui-patterns.mjs +0 -24
- package/fesm2022/ui-patterns.mjs.map +0 -1
- package/types/_accordion-chunk.d.ts +0 -90
- package/types/_combobox-chunk.d.ts +0 -138
- package/types/_expansion-chunk.d.ts +0 -71
- package/types/_list-chunk.d.ts +0 -209
- package/types/_list-navigation-chunk.d.ts +0 -101
- package/types/_listbox-chunk.d.ts +0 -105
- package/types/_pointer-event-manager-chunk.d.ts +0 -98
- package/types/_radio-group-chunk.d.ts +0 -92
- package/types/_tabs-chunk.d.ts +0 -138
- package/types/_toolbar-chunk.d.ts +0 -150
- package/types/_tree-chunk.d.ts +0 -139
- package/types/accordion.d.ts +0 -95
- package/types/combobox.d.ts +0 -54
- package/types/deferred-content.d.ts +0 -37
- package/types/listbox.d.ts +0 -99
- package/types/radio-group.d.ts +0 -85
- package/types/tabs.d.ts +0 -160
- package/types/toolbar.d.ts +0 -115
- package/types/tree.d.ts +0 -155
- package/types/ui-patterns.d.ts +0 -157
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/** Bit flag representation of the possible modifier keys that can be present on an event. */
|
|
2
|
-
var Modifier;
|
|
3
|
-
(function (Modifier) {
|
|
4
|
-
Modifier[Modifier["None"] = 0] = "None";
|
|
5
|
-
Modifier[Modifier["Ctrl"] = 1] = "Ctrl";
|
|
6
|
-
Modifier[Modifier["Shift"] = 2] = "Shift";
|
|
7
|
-
Modifier[Modifier["Alt"] = 4] = "Alt";
|
|
8
|
-
Modifier[Modifier["Meta"] = 8] = "Meta";
|
|
9
|
-
Modifier["Any"] = "Any";
|
|
10
|
-
})(Modifier || (Modifier = {}));
|
|
11
|
-
/**
|
|
12
|
-
* Abstract base class for all event managers.
|
|
13
|
-
*
|
|
14
|
-
* Event managers are designed to normalize how event handlers are authored and create a safety net
|
|
15
|
-
* for common event handling gotchas like remembering to call preventDefault or stopPropagation.
|
|
16
|
-
*/
|
|
17
|
-
class EventManager {
|
|
18
|
-
configs = [];
|
|
19
|
-
/** Runs the handlers that match with the given event. */
|
|
20
|
-
handle(event) {
|
|
21
|
-
for (const config of this.configs) {
|
|
22
|
-
if (config.matcher(event)) {
|
|
23
|
-
config.handler(event);
|
|
24
|
-
if (config.preventDefault) {
|
|
25
|
-
event.preventDefault();
|
|
26
|
-
}
|
|
27
|
-
if (config.stopPropagation) {
|
|
28
|
-
event.stopPropagation();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/** Gets bit flag representation of the modifier keys present on the given event. */
|
|
35
|
-
function getModifiers(event) {
|
|
36
|
-
return ((+event.ctrlKey && Modifier.Ctrl) |
|
|
37
|
-
(+event.shiftKey && Modifier.Shift) |
|
|
38
|
-
(+event.altKey && Modifier.Alt) |
|
|
39
|
-
(+event.metaKey && Modifier.Meta));
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Checks if the given event has modifiers that are an exact match for any of the given modifier
|
|
43
|
-
* flag combinations.
|
|
44
|
-
*/
|
|
45
|
-
function hasModifiers(event, modifiers) {
|
|
46
|
-
const eventModifiers = getModifiers(event);
|
|
47
|
-
const modifiersList = Array.isArray(modifiers) ? modifiers : [modifiers];
|
|
48
|
-
if (modifiersList.includes(Modifier.Any)) {
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
return modifiersList.some(modifiers => eventModifiers === modifiers);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* An event manager that is specialized for handling keyboard events. By default this manager stops
|
|
56
|
-
* propagation and prevents default on all events it handles.
|
|
57
|
-
*/
|
|
58
|
-
class KeyboardEventManager extends EventManager {
|
|
59
|
-
options = {
|
|
60
|
-
preventDefault: true,
|
|
61
|
-
stopPropagation: true,
|
|
62
|
-
};
|
|
63
|
-
on(...args) {
|
|
64
|
-
const { modifiers, key, handler } = this._normalizeInputs(...args);
|
|
65
|
-
this.configs.push({
|
|
66
|
-
handler: handler,
|
|
67
|
-
matcher: event => this._isMatch(event, key, modifiers),
|
|
68
|
-
...this.options,
|
|
69
|
-
});
|
|
70
|
-
return this;
|
|
71
|
-
}
|
|
72
|
-
_normalizeInputs(...args) {
|
|
73
|
-
const key = args.length === 3 ? args[1] : args[0];
|
|
74
|
-
const handler = args.length === 3 ? args[2] : args[1];
|
|
75
|
-
const modifiers = args.length === 3 ? args[0] : Modifier.None;
|
|
76
|
-
return {
|
|
77
|
-
key: key,
|
|
78
|
-
handler: handler,
|
|
79
|
-
modifiers: modifiers,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
_isMatch(event, key, modifiers) {
|
|
83
|
-
if (!hasModifiers(event, modifiers)) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
if (key instanceof RegExp) {
|
|
87
|
-
return key.test(event.key);
|
|
88
|
-
}
|
|
89
|
-
const keyStr = typeof key === 'string' ? key : key();
|
|
90
|
-
return keyStr.toLowerCase() === event.key.toLowerCase();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* The different mouse buttons that may appear on a pointer event.
|
|
96
|
-
*/
|
|
97
|
-
var MouseButton;
|
|
98
|
-
(function (MouseButton) {
|
|
99
|
-
MouseButton[MouseButton["Main"] = 0] = "Main";
|
|
100
|
-
MouseButton[MouseButton["Auxiliary"] = 1] = "Auxiliary";
|
|
101
|
-
MouseButton[MouseButton["Secondary"] = 2] = "Secondary";
|
|
102
|
-
})(MouseButton || (MouseButton = {}));
|
|
103
|
-
/** An event manager that is specialized for handling pointer events. */
|
|
104
|
-
class PointerEventManager extends EventManager {
|
|
105
|
-
options = {
|
|
106
|
-
preventDefault: false,
|
|
107
|
-
stopPropagation: false,
|
|
108
|
-
};
|
|
109
|
-
on(...args) {
|
|
110
|
-
const { button, handler, modifiers } = this._normalizeInputs(...args);
|
|
111
|
-
this.configs.push({
|
|
112
|
-
handler,
|
|
113
|
-
matcher: event => this._isMatch(event, button, modifiers),
|
|
114
|
-
...this.options,
|
|
115
|
-
});
|
|
116
|
-
return this;
|
|
117
|
-
}
|
|
118
|
-
_normalizeInputs(...args) {
|
|
119
|
-
if (args.length === 3) {
|
|
120
|
-
return {
|
|
121
|
-
button: args[0],
|
|
122
|
-
modifiers: args[1],
|
|
123
|
-
handler: args[2],
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
if (typeof args[0] === 'number' && typeof args[1] === 'function') {
|
|
127
|
-
return {
|
|
128
|
-
button: MouseButton.Main,
|
|
129
|
-
modifiers: args[0],
|
|
130
|
-
handler: args[1],
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
button: MouseButton.Main,
|
|
135
|
-
modifiers: Modifier.None,
|
|
136
|
-
handler: args[0],
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
_isMatch(event, button, modifiers) {
|
|
140
|
-
return button === (event.button ?? 0) && hasModifiers(event, modifiers);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export { KeyboardEventManager, Modifier, PointerEventManager };
|
|
145
|
-
//# sourceMappingURL=_pointer-event-manager-chunk.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_pointer-event-manager-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/behaviors/event-manager/event-manager.ts","../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/behaviors/event-manager/keyboard-event-manager.ts","../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/behaviors/event-manager/pointer-event-manager.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\n/**\n * An event that supports modifier keys.\n *\n * Matches the native KeyboardEvent, MouseEvent, and TouchEvent.\n */\nexport interface EventWithModifiers extends Event {\n ctrlKey: boolean;\n shiftKey: boolean;\n altKey: boolean;\n metaKey: boolean;\n}\n\n/**\n * Options that are applicable to all event handlers.\n *\n * This library has not yet had a need for stopPropagationImmediate.\n */\nexport interface EventHandlerOptions {\n stopPropagation: boolean;\n preventDefault: boolean;\n}\n\n/** A basic event handler. */\nexport type EventHandler<T extends Event> = (event: T) => void;\n\n/** A function that determines whether an event is to be handled. */\nexport type EventMatcher<T extends Event> = (event: T) => boolean;\n\n/** A config that specifies how to handle a particular event. */\nexport interface EventHandlerConfig<T extends Event> extends EventHandlerOptions {\n matcher: EventMatcher<T>;\n handler: EventHandler<T>;\n}\n\n/** Bit flag representation of the possible modifier keys that can be present on an event. */\nexport enum Modifier {\n None = 0,\n Ctrl = 0b1,\n Shift = 0b10,\n Alt = 0b100,\n Meta = 0b1000,\n Any = 'Any',\n}\n\nexport type ModifierInputs = Modifier | Modifier[];\n\n/**\n * Abstract base class for all event managers.\n *\n * Event managers are designed to normalize how event handlers are authored and create a safety net\n * for common event handling gotchas like remembering to call preventDefault or stopPropagation.\n */\nexport abstract class EventManager<T extends Event> {\n protected configs: EventHandlerConfig<T>[] = [];\n abstract options: EventHandlerOptions;\n\n /** Runs the handlers that match with the given event. */\n handle(event: T): void {\n for (const config of this.configs) {\n if (config.matcher(event)) {\n config.handler(event);\n\n if (config.preventDefault) {\n event.preventDefault();\n }\n\n if (config.stopPropagation) {\n event.stopPropagation();\n }\n }\n }\n }\n\n /** Configures the event manager to handle specific events. (See subclasses for more). */\n abstract on(...args: [...unknown[]]): this;\n}\n\n/** Gets bit flag representation of the modifier keys present on the given event. */\nexport function getModifiers(event: EventWithModifiers): number {\n return (\n (+event.ctrlKey && Modifier.Ctrl) |\n (+event.shiftKey && Modifier.Shift) |\n (+event.altKey && Modifier.Alt) |\n (+event.metaKey && Modifier.Meta)\n );\n}\n\n/**\n * Checks if the given event has modifiers that are an exact match for any of the given modifier\n * flag combinations.\n */\nexport function hasModifiers(event: EventWithModifiers, modifiers: ModifierInputs): boolean {\n const eventModifiers = getModifiers(event);\n const modifiersList = Array.isArray(modifiers) ? modifiers : [modifiers];\n\n if (modifiersList.includes(Modifier.Any)) {\n return true;\n }\n\n return modifiersList.some(modifiers => eventModifiers === modifiers);\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} from '../signal-like/signal-like';\nimport {\n EventHandler,\n EventHandlerOptions,\n EventManager,\n hasModifiers,\n ModifierInputs,\n Modifier,\n} from './event-manager';\n\n/**\n * Used to represent a keycode.\n *\n * This is used to match whether an events keycode should be handled. The ability to match using a\n * string, SignalLike, or Regexp gives us more flexibility when authoring event handlers.\n */\ntype KeyCode = string | SignalLike<string> | RegExp;\n\n/**\n * An event manager that is specialized for handling keyboard events. By default this manager stops\n * propagation and prevents default on all events it handles.\n */\nexport class KeyboardEventManager<T extends KeyboardEvent> extends EventManager<T> {\n options: EventHandlerOptions = {\n preventDefault: true,\n stopPropagation: true,\n };\n\n /** Configures this event manager to handle events with a specific key and no modifiers. */\n on(key: KeyCode, handler: EventHandler<T>): this;\n\n /** Configures this event manager to handle events with a specific modifer and key combination. */\n on(modifiers: ModifierInputs, key: KeyCode, handler: EventHandler<T>): this;\n\n on(...args: any[]) {\n const {modifiers, key, handler} = this._normalizeInputs(...args);\n\n this.configs.push({\n handler: handler,\n matcher: event => this._isMatch(event, key, modifiers),\n ...this.options,\n });\n\n return this;\n }\n\n private _normalizeInputs(...args: any[]) {\n const key = args.length === 3 ? args[1] : args[0];\n const handler = args.length === 3 ? args[2] : args[1];\n const modifiers = args.length === 3 ? args[0] : Modifier.None;\n\n return {\n key: key as KeyCode,\n handler: handler as EventHandler<T>,\n modifiers: modifiers as ModifierInputs,\n };\n }\n\n private _isMatch(event: T, key: KeyCode, modifiers: ModifierInputs) {\n if (!hasModifiers(event, modifiers)) {\n return false;\n }\n\n if (key instanceof RegExp) {\n return key.test(event.key);\n }\n\n const keyStr = typeof key === 'string' ? key : key();\n return keyStr.toLowerCase() === event.key.toLowerCase();\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 {\n EventHandler,\n EventHandlerOptions,\n EventManager,\n hasModifiers,\n ModifierInputs,\n Modifier,\n} from './event-manager';\n\n/**\n * The different mouse buttons that may appear on a pointer event.\n */\nexport enum MouseButton {\n Main = 0,\n Auxiliary = 1,\n Secondary = 2,\n}\n\n/** An event manager that is specialized for handling pointer events. */\nexport class PointerEventManager<T extends PointerEvent> extends EventManager<T> {\n options: EventHandlerOptions = {\n preventDefault: false,\n stopPropagation: false,\n };\n\n /**\n * Configures this event manager to handle events with a specific modifer and mouse button\n * combination.\n */\n on(button: MouseButton, modifiers: ModifierInputs, handler: EventHandler<T>): this;\n\n /**\n * Configures this event manager to handle events with a specific mouse button and no modifiers.\n */\n on(modifiers: ModifierInputs, handler: EventHandler<T>): this;\n\n /**\n * Configures this event manager to handle events with the main mouse button and no modifiers.\n *\n * @param handler The handler function\n * @param options Options for whether to stop propagation or prevent default.\n */\n on(handler: EventHandler<T>): this;\n\n on(...args: any[]) {\n const {button, handler, modifiers} = this._normalizeInputs(...args);\n\n this.configs.push({\n handler,\n matcher: event => this._isMatch(event, button, modifiers),\n ...this.options,\n });\n return this;\n }\n\n private _normalizeInputs(...args: any[]) {\n if (args.length === 3) {\n return {\n button: args[0] as MouseButton,\n modifiers: args[1] as ModifierInputs,\n handler: args[2] as EventHandler<T>,\n };\n }\n\n if (typeof args[0] === 'number' && typeof args[1] === 'function') {\n return {\n button: MouseButton.Main,\n modifiers: args[0] as ModifierInputs,\n handler: args[1] as EventHandler<T>,\n };\n }\n\n return {\n button: MouseButton.Main,\n modifiers: Modifier.None,\n handler: args[0] as EventHandler<T>,\n };\n }\n\n _isMatch(event: PointerEvent, button: MouseButton, modifiers: ModifierInputs) {\n return button === (event.button ?? 0) && hasModifiers(event, modifiers);\n }\n}\n"],"names":[],"mappings":"AA0CA;IACY;AAAZ,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ;AACR,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAU;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAY;AACZ,IAAA,QAAA,CAAA,QAAA,CAAA,KAAA,CAAA,GAAA,CAAA,CAAA,GAAA,KAAW;AACX,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAa;AACb,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACb,CAAC,EAPW,QAAQ,KAAR,QAAQ,GAOnB,EAAA,CAAA,CAAA;AAID;;;;;AAKG;MACmB,YAAY,CAAA;IACtB,OAAO,GAA4B,EAAE;;AAI/C,IAAA,MAAM,CAAC,KAAQ,EAAA;AACb,QAAA,KAAK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AC,CAAC,KAAK,UAAU,EAAE;YAChE,OAAO;gBACL,MAAM,EAAE,WAAW,CAAC,IAAI;AACxB,gBAAA,SAAS,EAAE,IAAI,CAAC,CAAC,CAAmB;AACpC,gBAAA,OAAO,EAAE,IAAI,CAAC,CAAC,CAAoB;aACpC;;QAGH,OAAO;YACL,MAAM,EAAE,WAAW,CAAC,IAAI;YACxB,SAAS,EAAE,QAAQ,CAAC,IAAI;AACxB,YAAA,OAAO,EAAE,IAAI,CAAC,CAAC,CAAoB;SACpC;;AAGH,IAAA,QAAQ,CAAC,KAAmB,EAAE,MAAmB,EAAE,SAAyB,EAAA;AAC1E,QAAA,OAAO,MAAM,MAAM,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC;;AAE1E;;;;"}
|
package/fesm2022/_tabs-chunk.mjs
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { computed } from '@angular/core';
|
|
2
|
-
import { ExpansionControl, ListExpansion } from './_expansion-chunk.mjs';
|
|
3
|
-
import { List } from './_list-chunk.mjs';
|
|
4
|
-
import { KeyboardEventManager, PointerEventManager } from './_pointer-event-manager-chunk.mjs';
|
|
5
|
-
|
|
6
|
-
/** Controls label and description of an element. */
|
|
7
|
-
class LabelControl {
|
|
8
|
-
inputs;
|
|
9
|
-
/** The `aria-label`. */
|
|
10
|
-
label = computed(() => this.inputs.label?.());
|
|
11
|
-
/** The `aria-labelledby` ids. */
|
|
12
|
-
labelledBy = computed(() => {
|
|
13
|
-
const label = this.label();
|
|
14
|
-
const labelledBy = this.inputs.labelledBy?.();
|
|
15
|
-
const defaultLabelledBy = this.inputs.defaultLabelledBy();
|
|
16
|
-
if (labelledBy && labelledBy.length > 0) {
|
|
17
|
-
return labelledBy;
|
|
18
|
-
}
|
|
19
|
-
// If an aria-label is provided by developers, do not set aria-labelledby with the
|
|
20
|
-
// defaultLabelledBy value because if both attributes are set, aria-labelledby will be used.
|
|
21
|
-
if (label) {
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
return defaultLabelledBy;
|
|
25
|
-
});
|
|
26
|
-
constructor(inputs) {
|
|
27
|
-
this.inputs = inputs;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** A tab in a tablist. */
|
|
32
|
-
class TabPattern {
|
|
33
|
-
inputs;
|
|
34
|
-
/** Controls expansion for this tab. */
|
|
35
|
-
expansion;
|
|
36
|
-
/** A global unique identifier for the tab. */
|
|
37
|
-
id;
|
|
38
|
-
/** The index of the tab. */
|
|
39
|
-
index = computed(() => this.inputs.tablist().inputs.items().indexOf(this));
|
|
40
|
-
/** A local unique identifier for the tab. */
|
|
41
|
-
value;
|
|
42
|
-
/** Whether the tab is disabled. */
|
|
43
|
-
disabled;
|
|
44
|
-
/** The html element that should receive focus. */
|
|
45
|
-
element;
|
|
46
|
-
/** The text used by the typeahead search. */
|
|
47
|
-
searchTerm = () => ''; // Unused because tabs do not support typeahead.
|
|
48
|
-
/** Whether this tab has expandable content. */
|
|
49
|
-
expandable = computed(() => this.expansion.expandable());
|
|
50
|
-
/** The unique identifier used by the expansion behavior. */
|
|
51
|
-
expansionId = computed(() => this.expansion.expansionId());
|
|
52
|
-
/** Whether the tab is expanded. */
|
|
53
|
-
expanded = computed(() => this.expansion.isExpanded());
|
|
54
|
-
/** Whether the tab is active. */
|
|
55
|
-
active = computed(() => this.inputs.tablist().inputs.activeItem() === this);
|
|
56
|
-
/** Whether the tab is selected. */
|
|
57
|
-
selected = computed(() => !!this.inputs.tablist().inputs.value().includes(this.value()));
|
|
58
|
-
/** The tabindex of the tab. */
|
|
59
|
-
tabindex = computed(() => this.inputs.tablist().listBehavior.getItemTabindex(this));
|
|
60
|
-
/** The id of the tabpanel associated with the tab. */
|
|
61
|
-
controls = computed(() => this.inputs.tabpanel()?.id());
|
|
62
|
-
constructor(inputs) {
|
|
63
|
-
this.inputs = inputs;
|
|
64
|
-
this.id = inputs.id;
|
|
65
|
-
this.value = inputs.value;
|
|
66
|
-
this.disabled = inputs.disabled;
|
|
67
|
-
this.element = inputs.element;
|
|
68
|
-
this.expansion = new ExpansionControl({
|
|
69
|
-
...inputs,
|
|
70
|
-
expansionId: inputs.value,
|
|
71
|
-
expandable: () => true,
|
|
72
|
-
expansionManager: inputs.tablist().expansionManager,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
/** A tabpanel associated with a tab. */
|
|
77
|
-
class TabPanelPattern {
|
|
78
|
-
inputs;
|
|
79
|
-
/** A global unique identifier for the tabpanel. */
|
|
80
|
-
id;
|
|
81
|
-
/** A local unique identifier for the tabpanel. */
|
|
82
|
-
value;
|
|
83
|
-
/** Controls label for this tabpanel. */
|
|
84
|
-
labelManager;
|
|
85
|
-
/** Whether the tabpanel is hidden. */
|
|
86
|
-
hidden = computed(() => this.inputs.tab()?.expanded() === false);
|
|
87
|
-
/** The tabindex of this tabpanel. */
|
|
88
|
-
tabindex = computed(() => (this.hidden() ? -1 : 0));
|
|
89
|
-
/** The aria-labelledby value for this tabpanel. */
|
|
90
|
-
labelledBy = computed(() => this.labelManager.labelledBy().length > 0
|
|
91
|
-
? this.labelManager.labelledBy().join(' ')
|
|
92
|
-
: undefined);
|
|
93
|
-
constructor(inputs) {
|
|
94
|
-
this.inputs = inputs;
|
|
95
|
-
this.id = inputs.id;
|
|
96
|
-
this.value = inputs.value;
|
|
97
|
-
this.labelManager = new LabelControl({
|
|
98
|
-
...inputs,
|
|
99
|
-
defaultLabelledBy: computed(() => (this.inputs.tab() ? [this.inputs.tab().id()] : [])),
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/** Controls the state of a tablist. */
|
|
104
|
-
class TabListPattern {
|
|
105
|
-
inputs;
|
|
106
|
-
/** The list behavior for the tablist. */
|
|
107
|
-
listBehavior;
|
|
108
|
-
/** Controls expansion for the tablist. */
|
|
109
|
-
expansionManager;
|
|
110
|
-
/** Whether the tablist is vertically or horizontally oriented. */
|
|
111
|
-
orientation;
|
|
112
|
-
/** Whether the tablist is disabled. */
|
|
113
|
-
disabled;
|
|
114
|
-
/** The tabindex of the tablist. */
|
|
115
|
-
tabindex = computed(() => this.listBehavior.tabindex());
|
|
116
|
-
/** The id of the current active tab. */
|
|
117
|
-
activedescendant = computed(() => this.listBehavior.activedescendant());
|
|
118
|
-
/** Whether selection should follow focus. */
|
|
119
|
-
followFocus = computed(() => this.inputs.selectionMode() === 'follow');
|
|
120
|
-
/** The key used to navigate to the previous tab in the tablist. */
|
|
121
|
-
prevKey = computed(() => {
|
|
122
|
-
if (this.inputs.orientation() === 'vertical') {
|
|
123
|
-
return 'ArrowUp';
|
|
124
|
-
}
|
|
125
|
-
return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
|
|
126
|
-
});
|
|
127
|
-
/** The key used to navigate to the next item in the list. */
|
|
128
|
-
nextKey = computed(() => {
|
|
129
|
-
if (this.inputs.orientation() === 'vertical') {
|
|
130
|
-
return 'ArrowDown';
|
|
131
|
-
}
|
|
132
|
-
return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
|
|
133
|
-
});
|
|
134
|
-
/** The keydown event manager for the tablist. */
|
|
135
|
-
keydown = computed(() => {
|
|
136
|
-
return new KeyboardEventManager()
|
|
137
|
-
.on(this.prevKey, () => this.listBehavior.prev({ select: this.followFocus() }))
|
|
138
|
-
.on(this.nextKey, () => this.listBehavior.next({ select: this.followFocus() }))
|
|
139
|
-
.on('Home', () => this.listBehavior.first({ select: this.followFocus() }))
|
|
140
|
-
.on('End', () => this.listBehavior.last({ select: this.followFocus() }))
|
|
141
|
-
.on(' ', () => this.listBehavior.select())
|
|
142
|
-
.on('Enter', () => this.listBehavior.select());
|
|
143
|
-
});
|
|
144
|
-
/** The pointerdown event manager for the tablist. */
|
|
145
|
-
pointerdown = computed(() => {
|
|
146
|
-
return new PointerEventManager().on(e => this.listBehavior.goto(this._getItem(e), { select: true }));
|
|
147
|
-
});
|
|
148
|
-
constructor(inputs) {
|
|
149
|
-
this.inputs = inputs;
|
|
150
|
-
this.disabled = inputs.disabled;
|
|
151
|
-
this.orientation = inputs.orientation;
|
|
152
|
-
this.listBehavior = new List({
|
|
153
|
-
...inputs,
|
|
154
|
-
multi: () => false,
|
|
155
|
-
typeaheadDelay: () => 0, // Tabs do not support typeahead.
|
|
156
|
-
});
|
|
157
|
-
this.expansionManager = new ListExpansion({
|
|
158
|
-
...inputs,
|
|
159
|
-
multiExpandable: () => false,
|
|
160
|
-
expandedIds: this.inputs.value,
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Sets the tablist to its default initial state.
|
|
165
|
-
*
|
|
166
|
-
* Sets the active index of the tablist to the first focusable selected
|
|
167
|
-
* tab if one exists. Otherwise, sets focus to the first focusable tab.
|
|
168
|
-
*
|
|
169
|
-
* This method should be called once the tablist and its tabs are properly initialized.
|
|
170
|
-
*/
|
|
171
|
-
setDefaultState() {
|
|
172
|
-
let firstItem;
|
|
173
|
-
for (const item of this.inputs.items()) {
|
|
174
|
-
if (!this.listBehavior.isFocusable(item))
|
|
175
|
-
continue;
|
|
176
|
-
if (firstItem === undefined) {
|
|
177
|
-
firstItem = item;
|
|
178
|
-
}
|
|
179
|
-
if (item.selected()) {
|
|
180
|
-
this.inputs.activeItem.set(item);
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
if (firstItem !== undefined) {
|
|
185
|
-
this.inputs.activeItem.set(firstItem);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
/** Handles keydown events for the tablist. */
|
|
189
|
-
onKeydown(event) {
|
|
190
|
-
if (!this.disabled()) {
|
|
191
|
-
this.keydown().handle(event);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
/** The pointerdown event manager for the tablist. */
|
|
195
|
-
onPointerdown(event) {
|
|
196
|
-
if (!this.disabled()) {
|
|
197
|
-
this.pointerdown().handle(event);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
/** Returns the tab item associated with the given pointer event. */
|
|
201
|
-
_getItem(e) {
|
|
202
|
-
if (!(e.target instanceof HTMLElement)) {
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
const element = e.target.closest('[role="tab"]');
|
|
206
|
-
return this.inputs.items().find(i => i.element() === element);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export { TabListPattern, TabPanelPattern, TabPattern };
|
|
211
|
-
//# sourceMappingURL=_tabs-chunk.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_tabs-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/behaviors/label/label.ts","../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/tabs/tabs.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} from '../signal-like/signal-like';\n\n/** Represents the required inputs for the label control. */\nexport interface LabelControlInputs {\n /** The default `aria-labelledby` ids. */\n defaultLabelledBy: SignalLike<string[]>;\n}\n\n/** Represents the optional inputs for the label control. */\nexport interface LabelControlOptionalInputs {\n /** The `aria-label`. */\n label?: SignalLike<string | undefined>;\n\n /** The user-provided `aria-labelledby` ids. */\n labelledBy?: SignalLike<string[]>;\n}\n\n/** Controls label and description of an element. */\nexport class LabelControl {\n /** The `aria-label`. */\n readonly label = computed(() => this.inputs.label?.());\n\n /** The `aria-labelledby` ids. */\n readonly labelledBy = computed(() => {\n const label = this.label();\n const labelledBy = this.inputs.labelledBy?.();\n const defaultLabelledBy = this.inputs.defaultLabelledBy();\n\n if (labelledBy && labelledBy.length > 0) {\n return labelledBy;\n }\n\n // If an aria-label is provided by developers, do not set aria-labelledby with the\n // defaultLabelledBy value because if both attributes are set, aria-labelledby will be used.\n if (label) {\n return [];\n }\n\n return defaultLabelledBy;\n });\n\n constructor(readonly inputs: LabelControlInputs & LabelControlOptionalInputs) {}\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 {KeyboardEventManager, PointerEventManager} from '../behaviors/event-manager';\nimport {\n ExpansionItem,\n ExpansionControl,\n ListExpansionInputs,\n ListExpansion,\n} from '../behaviors/expansion/expansion';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport {LabelControl, LabelControlOptionalInputs} from '../behaviors/label/label';\nimport {List, ListInputs, ListItem} from '../behaviors/list/list';\n\n/** The required inputs to tabs. */\nexport interface TabInputs\n extends Omit<ListItem<string>, 'searchTerm' | 'index'>,\n Omit<ExpansionItem, 'expansionId' | 'expandable'> {\n /** The parent tablist that controls the tab. */\n tablist: SignalLike<TabListPattern>;\n\n /** The remote tabpanel controlled by the tab. */\n tabpanel: SignalLike<TabPanelPattern | undefined>;\n}\n\n/** A tab in a tablist. */\nexport class TabPattern {\n /** Controls expansion for this tab. */\n readonly expansion: ExpansionControl;\n\n /** A global unique identifier for the tab. */\n readonly id: SignalLike<string>;\n\n /** The index of the tab. */\n readonly index = computed(() => this.inputs.tablist().inputs.items().indexOf(this));\n\n /** A local unique identifier for the tab. */\n readonly value: SignalLike<string>;\n\n /** Whether the tab is disabled. */\n readonly disabled: SignalLike<boolean>;\n\n /** The html element that should receive focus. */\n readonly element: SignalLike<HTMLElement>;\n\n /** The text used by the typeahead search. */\n readonly searchTerm = () => ''; // Unused because tabs do not support typeahead.\n\n /** Whether this tab has expandable content. */\n readonly expandable = computed(() => this.expansion.expandable());\n\n /** The unique identifier used by the expansion behavior. */\n readonly expansionId = computed(() => this.expansion.expansionId());\n\n /** Whether the tab is expanded. */\n readonly expanded = computed(() => this.expansion.isExpanded());\n\n /** Whether the tab is active. */\n readonly active = computed(() => this.inputs.tablist().inputs.activeItem() === this);\n\n /** Whether the tab is selected. */\n readonly selected = computed(() => !!this.inputs.tablist().inputs.value().includes(this.value()));\n\n /** The tabindex of the tab. */\n readonly tabindex = computed(() => this.inputs.tablist().listBehavior.getItemTabindex(this));\n\n /** The id of the tabpanel associated with the tab. */\n readonly controls = computed(() => this.inputs.tabpanel()?.id());\n\n constructor(readonly inputs: TabInputs) {\n this.id = inputs.id;\n this.value = inputs.value;\n this.disabled = inputs.disabled;\n this.element = inputs.element;\n this.expansion = new ExpansionControl({\n ...inputs,\n expansionId: inputs.value,\n expandable: () => true,\n expansionManager: inputs.tablist().expansionManager,\n });\n }\n}\n\n/** The required inputs for the tabpanel. */\nexport interface TabPanelInputs extends LabelControlOptionalInputs {\n id: SignalLike<string>;\n tab: SignalLike<TabPattern | undefined>;\n value: SignalLike<string>;\n}\n\n/** A tabpanel associated with a tab. */\nexport class TabPanelPattern {\n /** A global unique identifier for the tabpanel. */\n readonly id: SignalLike<string>;\n\n /** A local unique identifier for the tabpanel. */\n readonly value: SignalLike<string>;\n\n /** Controls label for this tabpanel. */\n readonly labelManager: LabelControl;\n\n /** Whether the tabpanel is hidden. */\n readonly hidden = computed(() => this.inputs.tab()?.expanded() === false);\n\n /** The tabindex of this tabpanel. */\n readonly tabindex = computed(() => (this.hidden() ? -1 : 0));\n\n /** The aria-labelledby value for this tabpanel. */\n readonly labelledBy = computed(() =>\n this.labelManager.labelledBy().length > 0\n ? this.labelManager.labelledBy().join(' ')\n : undefined,\n );\n\n constructor(readonly inputs: TabPanelInputs) {\n this.id = inputs.id;\n this.value = inputs.value;\n this.labelManager = new LabelControl({\n ...inputs,\n defaultLabelledBy: computed(() => (this.inputs.tab() ? [this.inputs.tab()!.id()] : [])),\n });\n }\n}\n\n/** The required inputs for the tablist. */\nexport type TabListInputs = Omit<ListInputs<TabPattern, string>, 'multi' | 'typeaheadDelay'> &\n Omit<ListExpansionInputs, 'multiExpandable' | 'expandedIds' | 'items'>;\n\n/** Controls the state of a tablist. */\nexport class TabListPattern {\n /** The list behavior for the tablist. */\n readonly listBehavior: List<TabPattern, string>;\n\n /** Controls expansion for the tablist. */\n readonly expansionManager: ListExpansion;\n\n /** Whether the tablist is vertically or horizontally oriented. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** Whether the tablist is disabled. */\n readonly disabled: SignalLike<boolean>;\n\n /** The tabindex of the tablist. */\n readonly tabindex = computed(() => this.listBehavior.tabindex());\n\n /** The id of the current active tab. */\n readonly activedescendant = computed(() => this.listBehavior.activedescendant());\n\n /** Whether selection should follow focus. */\n readonly followFocus = computed(() => this.inputs.selectionMode() === 'follow');\n\n /** The key used to navigate to the previous tab in the tablist. */\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 used to navigate to the next item in the list. */\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 keydown event manager for the tablist. */\n readonly keydown = computed(() => {\n return new KeyboardEventManager()\n .on(this.prevKey, () => this.listBehavior.prev({select: this.followFocus()}))\n .on(this.nextKey, () => this.listBehavior.next({select: this.followFocus()}))\n .on('Home', () => this.listBehavior.first({select: this.followFocus()}))\n .on('End', () => this.listBehavior.last({select: this.followFocus()}))\n .on(' ', () => this.listBehavior.select())\n .on('Enter', () => this.listBehavior.select());\n });\n\n /** The pointerdown event manager for the tablist. */\n readonly pointerdown = computed(() => {\n return new PointerEventManager().on(e =>\n this.listBehavior.goto(this._getItem(e)!, {select: true}),\n );\n });\n\n constructor(readonly inputs: TabListInputs) {\n this.disabled = inputs.disabled;\n this.orientation = inputs.orientation;\n\n this.listBehavior = new List({\n ...inputs,\n multi: () => false,\n typeaheadDelay: () => 0, // Tabs do not support typeahead.\n });\n\n this.expansionManager = new ListExpansion({\n ...inputs,\n multiExpandable: () => false,\n expandedIds: this.inputs.value,\n });\n }\n\n /**\n * Sets the tablist to its default initial state.\n *\n * Sets the active index of the tablist to the first focusable selected\n * tab if one exists. Otherwise, sets focus to the first focusable tab.\n *\n * This method should be called once the tablist and its tabs are properly initialized.\n */\n setDefaultState() {\n let firstItem: TabPattern | undefined;\n\n for (const item of this.inputs.items()) {\n if (!this.listBehavior.isFocusable(item)) continue;\n\n if (firstItem === undefined) {\n firstItem = item;\n }\n\n if (item.selected()) {\n this.inputs.activeItem.set(item);\n return;\n }\n }\n if (firstItem !== undefined) {\n this.inputs.activeItem.set(firstItem);\n }\n }\n\n /** Handles keydown events for the tablist. */\n onKeydown(event: KeyboardEvent) {\n if (!this.disabled()) {\n this.keydown().handle(event);\n }\n }\n\n /** The pointerdown event manager for the tablist. */\n onPointerdown(event: PointerEvent) {\n if (!this.disabled()) {\n this.pointerdown().handle(event);\n }\n }\n\n /** Returns the tab item associated with the given pointer event. */\n private _getItem(e: PointerEvent) {\n if (!(e.target instanceof HTMLElement)) {\n return;\n }\n\n const element = e.target.closest('[role=\"tab\"]');\n return this.inputs.items().find(i => i.element() === element);\n }\n}\n"],"names":[],"mappings":";;;;;AAyBA;MACa,YAAY,CAAA;AAuBF,IAAA,MAAA;;AArBZ,IAAA,KAAK,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;;AAG7C,IAAA,UAAU,GAAG,QAAQ,CAAC,MAAK;AAClC,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE;QAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI;QAC7C,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE;QAEzD,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,G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