@ids-group-ltd/ids-design-system 1.0.2 → 1.1.0
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/CHANGELOG.md +261 -3
- package/agent/INDEX.md +12 -2
- package/agent/feedback/ds-attachment.md +12 -0
- package/agent/feedback/ds-chat-attachment.md +10 -0
- package/agent/feedback/ds-chat-message.md +11 -0
- package/agent/feedback/ds-chat-step.md +10 -0
- package/agent/feedback/ds-chat-steps.md +10 -0
- package/agent/feedback/ds-chat-thread.md +11 -0
- package/agent/feedback/ds-timeline-item.md +3 -1
- package/agent/feedback/ds-timeline.md +9 -0
- package/agent/feedback/ds-toast.md +1 -1
- package/agent/feedback/ds-tree.md +3 -1
- package/agent/forms/ds-chat-input.md +16 -0
- package/agent/forms/ds-inline-edit.md +14 -0
- package/agent/foundations/tokens.md +3 -3
- package/agent/navigation/ds-splitter.md +14 -0
- package/agent/platform/toast-service.md +3 -2
- package/agent/tables/ds-table.md +1 -1
- package/components.md +107 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs +7 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chat.mjs +858 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-chat.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-inline-edit.mjs +107 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-inline-edit.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-splitter.mjs +359 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-splitter.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs +74 -17
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs +163 -20
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs +146 -24
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +54 -0
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +4 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/1.0.2.json +28 -0
- package/migrations/1.0.3.json +15 -0
- package/migrations/1.1.0.json +183 -0
- package/package.json +25 -1
- package/schematics/check-overrides/surface.json +181 -5
- package/styles/_dropdown-overlay.scss +6 -4
- package/styles/_step-marker.scss +51 -0
- package/styles/_tokens.scss +5 -3
- package/themes/README.md +2 -1
- package/themes/_semantic.scss +10 -0
- package/themes/dark/_palette.scss +1 -2
- package/themes/dark/_theme.scss +24 -3
- package/types/ids-group-ltd-ids-design-system-components-avatar.d.ts +3 -1
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +2 -2
- package/types/ids-group-ltd-ids-design-system-components-chart.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-chat.d.ts +340 -0
- package/types/ids-group-ltd-ids-design-system-components-inline-edit.d.ts +43 -0
- package/types/ids-group-ltd-ids-design-system-components-pie-chart.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-splitter.d.ts +83 -0
- package/types/ids-group-ltd-ids-design-system-components-timeline.d.ts +34 -5
- package/types/ids-group-ltd-ids-design-system-components-toast.d.ts +53 -4
- package/types/ids-group-ltd-ids-design-system-components-tree.d.ts +51 -7
- package/types/ids-group-ltd-ids-design-system-core.d.ts +104 -0
- package/types/ids-group-ltd-ids-design-system.d.ts +6 -3
|
@@ -1,18 +1,63 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, input, model, output, signal, computed, ViewEncapsulation, Component } from '@angular/core';
|
|
2
|
+
import { inject, TemplateRef, Directive, ElementRef, input, model, output, contentChild, signal, computed, afterEveryRender, ViewEncapsulation, Component } from '@angular/core';
|
|
3
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
3
4
|
import { IconComponent } from '@ids-group-ltd/ids-design-system/icons';
|
|
4
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Content drawn at the end of every `ds-tree` row: a badge, a count, a small icon button.
|
|
8
|
+
*
|
|
9
|
+
* ```html
|
|
10
|
+
* <ds-tree [nodes]="layers">
|
|
11
|
+
* <ng-template dsTreeTrailing let-node>
|
|
12
|
+
* <ds-badge size="sm">{{ node.id }}</ds-badge>
|
|
13
|
+
* </ng-template>
|
|
14
|
+
* </ds-tree>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* A click inside it neither selects nor toggles the row. Its controls are tab stops only on
|
|
18
|
+
* the focused row: Tab from that row reaches them, and the other rows' controls stay out of
|
|
19
|
+
* the tab order.
|
|
20
|
+
*/
|
|
21
|
+
class TreeTrailingDirective {
|
|
22
|
+
template = inject(TemplateRef);
|
|
23
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: TreeTrailingDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
27
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: TreeTrailingDirective, isStandalone: true, selector: "ng-template[dsTreeTrailing]", ngImport: i0 });
|
|
28
|
+
}
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: TreeTrailingDirective, decorators: [{
|
|
30
|
+
type: Directive,
|
|
31
|
+
args: [{
|
|
32
|
+
selector: 'ng-template[dsTreeTrailing]',
|
|
33
|
+
standalone: true,
|
|
34
|
+
}]
|
|
35
|
+
}] });
|
|
36
|
+
|
|
37
|
+
const FOCUSABLE = 'a[href], button, input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
38
|
+
const PARKED_TABINDEX = 'data-ds-tree-tabindex';
|
|
39
|
+
let nextId = 0;
|
|
5
40
|
class TreeComponent {
|
|
6
41
|
host = inject(ElementRef);
|
|
7
42
|
/** Root-level nodes; nest via `children`. */
|
|
8
43
|
nodes = input([], ...(ngDevMode ? [{ debugName: "nodes" }] : /* istanbul ignore next */ []));
|
|
9
44
|
/** Ids of the expanded nodes. */
|
|
10
45
|
expandedIds = model(new Set(), ...(ngDevMode ? [{ debugName: "expandedIds" }] : /* istanbul ignore next */ []));
|
|
11
|
-
/**
|
|
46
|
+
/** `'multiple'` reads and writes `selectedIds`; `'single'` reads and writes `selectedId`. */
|
|
47
|
+
selection = input('single', ...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
48
|
+
/** Id of the selected node, in `'single'` selection. */
|
|
12
49
|
selectedId = model(null, ...(ngDevMode ? [{ debugName: "selectedId" }] : /* istanbul ignore next */ []));
|
|
13
|
-
/**
|
|
50
|
+
/** Ids of the selected nodes, in `'multiple'` selection. */
|
|
51
|
+
selectedIds = model([], ...(ngDevMode ? [{ debugName: "selectedIds" }] : /* istanbul ignore next */ []));
|
|
52
|
+
/** Fires with the node when a row is selected (click or Enter/Space), not when one is deselected. */
|
|
14
53
|
nodeSelected = output();
|
|
54
|
+
/** Fires with the node under the pointer or newly focused, and `null` when the pointer leaves the tree. */
|
|
55
|
+
nodeHover = output();
|
|
56
|
+
trailing = contentChild(TreeTrailingDirective, ...(ngDevMode ? [{ debugName: "trailing" }] : /* istanbul ignore next */ []));
|
|
57
|
+
idPrefix = `ds-tree-${++nextId}`;
|
|
15
58
|
activeId = signal(null, ...(ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []));
|
|
59
|
+
hoveredId = null;
|
|
60
|
+
multiple = computed(() => this.selection() === 'multiple', ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
16
61
|
visibleNodes = computed(() => {
|
|
17
62
|
const out = [];
|
|
18
63
|
const walk = (list, level) => {
|
|
@@ -29,25 +74,44 @@ class TreeComponent {
|
|
|
29
74
|
return out;
|
|
30
75
|
}, ...(ngDevMode ? [{ debugName: "visibleNodes" }] : /* istanbul ignore next */ []));
|
|
31
76
|
effectiveActiveId = computed(() => this.activeId() ?? this.visibleNodes()[0]?.node.id ?? null, ...(ngDevMode ? [{ debugName: "effectiveActiveId" }] : /* istanbul ignore next */ []));
|
|
77
|
+
constructor() {
|
|
78
|
+
// Content inside a trailing template can change without a signal of the tree changing,
|
|
79
|
+
// so its tab stops are re-parked after every render.
|
|
80
|
+
afterEveryRender({ write: () => this.parkTrailingTabStops() });
|
|
81
|
+
}
|
|
32
82
|
isExpanded(id) {
|
|
33
83
|
return this.expandedIds().has(id);
|
|
34
84
|
}
|
|
35
85
|
isSelected(id) {
|
|
36
|
-
return this.
|
|
86
|
+
return this.multiple()
|
|
87
|
+
? this.selectedIds().includes(id)
|
|
88
|
+
: this.selectedId() === id;
|
|
37
89
|
}
|
|
38
90
|
isActive(id) {
|
|
39
91
|
return this.effectiveActiveId() === id;
|
|
40
92
|
}
|
|
41
|
-
onRowClick(entry) {
|
|
42
|
-
if (
|
|
93
|
+
onRowClick(entry, event) {
|
|
94
|
+
if (this.fromTrailing(event)) {
|
|
43
95
|
return;
|
|
44
96
|
}
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
97
|
+
this.activate(entry, event.shiftKey || event.ctrlKey || event.metaKey);
|
|
98
|
+
}
|
|
99
|
+
onRowFocus(entry) {
|
|
100
|
+
this.activeId.set(entry.node.id);
|
|
101
|
+
this.hover(entry.node);
|
|
102
|
+
}
|
|
103
|
+
hover(node) {
|
|
104
|
+
const id = node?.id ?? null;
|
|
105
|
+
if (id === this.hoveredId) {
|
|
106
|
+
return;
|
|
48
107
|
}
|
|
108
|
+
this.hoveredId = id;
|
|
109
|
+
this.nodeHover.emit(node);
|
|
49
110
|
}
|
|
50
111
|
onKeydown(event) {
|
|
112
|
+
if (this.fromTrailing(event)) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
51
115
|
const visible = this.visibleNodes();
|
|
52
116
|
const index = visible.findIndex((entry) => entry.node.id === this.effectiveActiveId());
|
|
53
117
|
if (index < 0) {
|
|
@@ -83,12 +147,47 @@ class TreeComponent {
|
|
|
83
147
|
this.moveToParent(visible, index);
|
|
84
148
|
}
|
|
85
149
|
break;
|
|
150
|
+
case 'Enter':
|
|
151
|
+
case ' ':
|
|
152
|
+
if (!event.repeat) {
|
|
153
|
+
this.activate(current, event.shiftKey || event.ctrlKey || event.metaKey);
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
86
156
|
default:
|
|
87
|
-
// Enter and Space activate through the row button's native click.
|
|
88
157
|
return;
|
|
89
158
|
}
|
|
90
159
|
event.preventDefault();
|
|
91
160
|
}
|
|
161
|
+
// A modified activation in multiple selection only adds or removes the node; every other
|
|
162
|
+
// activation selects the node alone and toggles a parent.
|
|
163
|
+
activate(entry, modified) {
|
|
164
|
+
const node = entry.node;
|
|
165
|
+
if (node.disabled) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
this.activeId.set(node.id);
|
|
169
|
+
if (this.multiple() && modified) {
|
|
170
|
+
const ids = this.selectedIds();
|
|
171
|
+
if (ids.includes(node.id)) {
|
|
172
|
+
this.selectedIds.set(ids.filter((id) => id !== node.id));
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
this.selectedIds.set([...ids, node.id]);
|
|
176
|
+
this.nodeSelected.emit(node);
|
|
177
|
+
}
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (this.multiple()) {
|
|
181
|
+
this.selectedIds.set([node.id]);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
this.selectedId.set(node.id);
|
|
185
|
+
}
|
|
186
|
+
this.nodeSelected.emit(node);
|
|
187
|
+
if (entry.hasChildren) {
|
|
188
|
+
this.toggle(node);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
92
191
|
toggle(node) {
|
|
93
192
|
if (node.disabled || !node.children?.length) {
|
|
94
193
|
return;
|
|
@@ -102,14 +201,6 @@ class TreeComponent {
|
|
|
102
201
|
}
|
|
103
202
|
this.expandedIds.set(next);
|
|
104
203
|
}
|
|
105
|
-
select(node) {
|
|
106
|
-
if (node.disabled) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
this.selectedId.set(node.id);
|
|
110
|
-
this.activeId.set(node.id);
|
|
111
|
-
this.nodeSelected.emit(node);
|
|
112
|
-
}
|
|
113
204
|
moveActive(targetIndex) {
|
|
114
205
|
const visible = this.visibleNodes();
|
|
115
206
|
if (targetIndex < 0 || targetIndex >= visible.length) {
|
|
@@ -129,23 +220,54 @@ class TreeComponent {
|
|
|
129
220
|
focusNode(id) {
|
|
130
221
|
this.activeId.set(id);
|
|
131
222
|
this.host.nativeElement
|
|
132
|
-
.querySelector(`[data-node-id="${id}"]`)
|
|
223
|
+
.querySelector(`[data-node-id="${CSS.escape(id)}"]`)
|
|
133
224
|
?.focus();
|
|
134
225
|
}
|
|
226
|
+
fromTrailing(event) {
|
|
227
|
+
return (event.target instanceof Element && !!event.target.closest('.trailing'));
|
|
228
|
+
}
|
|
229
|
+
// The tree keeps one tab stop: controls in a trailing template are tabbable on the active
|
|
230
|
+
// row only, and get their own tabindex back when their row becomes active.
|
|
231
|
+
parkTrailingTabStops() {
|
|
232
|
+
const activeId = this.effectiveActiveId();
|
|
233
|
+
for (const area of this.host.nativeElement.querySelectorAll('.trailing')) {
|
|
234
|
+
const onActiveRow = area.closest('[data-node-id]')?.getAttribute('data-node-id') ===
|
|
235
|
+
activeId;
|
|
236
|
+
const controls = area.querySelectorAll(onActiveRow ? `[${PARKED_TABINDEX}]` : FOCUSABLE);
|
|
237
|
+
for (const control of controls) {
|
|
238
|
+
if (onActiveRow) {
|
|
239
|
+
const own = control.getAttribute(PARKED_TABINDEX);
|
|
240
|
+
control.removeAttribute(PARKED_TABINDEX);
|
|
241
|
+
if (own) {
|
|
242
|
+
control.setAttribute('tabindex', own);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
control.removeAttribute('tabindex');
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else if (!control.hasAttribute(PARKED_TABINDEX)) {
|
|
249
|
+
control.setAttribute(PARKED_TABINDEX, control.getAttribute('tabindex') ?? '');
|
|
250
|
+
control.setAttribute('tabindex', '-1');
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
135
255
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: TreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
136
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: TreeComponent, isStandalone: true, selector: "ds-tree", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: false, transformFunction: null }, expandedIds: { classPropertyName: "expandedIds", publicName: "expandedIds", isSignal: true, isRequired: false, transformFunction: null }, selectedId: { classPropertyName: "selectedId", publicName: "selectedId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expandedIds: "expandedIdsChange", selectedId: "selectedIdChange", nodeSelected: "nodeSelected" }, host: { attributes: { "role": "tree" }, listeners: { "keydown": "onKeydown($event)" } }, ngImport: i0, template: "@for (entry of visibleNodes(); track entry.node.id) {\n <
|
|
256
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: TreeComponent, isStandalone: true, selector: "ds-tree", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: false, transformFunction: null }, expandedIds: { classPropertyName: "expandedIds", publicName: "expandedIds", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, selectedId: { classPropertyName: "selectedId", publicName: "selectedId", isSignal: true, isRequired: false, transformFunction: null }, selectedIds: { classPropertyName: "selectedIds", publicName: "selectedIds", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expandedIds: "expandedIdsChange", selectedId: "selectedIdChange", selectedIds: "selectedIdsChange", nodeSelected: "nodeSelected", nodeHover: "nodeHover" }, host: { attributes: { "role": "tree" }, listeners: { "keydown": "onKeydown($event)", "pointerleave": "hover(null)" }, properties: { "attr.aria-multiselectable": "multiple() ? 'true' : null" } }, queries: [{ propertyName: "trailing", first: true, predicate: TreeTrailingDirective, descendants: true, isSignal: true }], ngImport: i0, template: "@for (entry of visibleNodes(); track entry.node.id; let index = $index) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -- Enter and Space reach the host keydown handler, which activates the focused row -->\n <div\n class=\"row\"\n role=\"treeitem\"\n [attr.data-node-id]=\"entry.node.id\"\n [attr.aria-level]=\"entry.level + 1\"\n [attr.aria-expanded]=\"entry.hasChildren ? entry.expanded : null\"\n [attr.aria-selected]=\"isSelected(entry.node.id)\"\n [attr.aria-disabled]=\"entry.node.disabled ? 'true' : null\"\n [attr.aria-labelledby]=\"idPrefix + '-' + index\"\n [attr.aria-describedby]=\"\n trailing() ? idPrefix + '-' + index + '-trailing' : null\n \"\n [attr.tabindex]=\"isActive(entry.node.id) ? 0 : -1\"\n [class.selected]=\"isSelected(entry.node.id)\"\n [style.--_level]=\"entry.level\"\n (click)=\"onRowClick(entry, $event)\"\n (focus)=\"onRowFocus(entry)\"\n (pointerenter)=\"hover(entry.node)\">\n @if (entry.hasChildren) {\n <ds-icon\n class=\"caret\"\n [name]=\"entry.expanded ? 'chevronDown' : 'chevronRight'\"\n [size]=\"16\" />\n } @else {\n <span class=\"caret-spacer\"></span>\n }\n\n @if (entry.node.icon; as icon) {\n <ds-icon\n class=\"node-icon\"\n [name]=\"icon\"\n [size]=\"16\" />\n }\n\n <span\n class=\"label\"\n [id]=\"idPrefix + '-' + index\">\n {{ entry.node.label }}\n </span>\n\n @if (trailing(); as trailing) {\n <span\n class=\"trailing\"\n [id]=\"idPrefix + '-' + index + '-trailing'\">\n <ng-container\n *ngTemplateOutlet=\"\n trailing.template;\n context: { $implicit: entry.node, node: entry.node }\n \" />\n </span>\n }\n </div>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_tree-indent: var(--ds-tree-indent, var(--tree-indent));--_tree-row-padding-y: var(--ds-tree-row-padding-y, var(--tree-row-pad-y));--_tree-row-padding-x: var(--ds-tree-row-padding-x, var(--tree-row-pad-x));--_tree-row-hover-bg-color: var(--ds-tree-row-hover-bg-color, var(--surface-secondary));--_tree-row-selected-bg-color: var(--ds-tree-row-selected-bg-color, var(--accent-surface-tint));--_tree-row-selected-text-color: var(--ds-tree-row-selected-text-color, var(--accent-strong));--_tree-row-selected-icon-color: var(--ds-tree-row-selected-icon-color, var(--_tree-row-selected-text-color));--_tree-row-text-color: var(--ds-tree-row-text-color, var(--text-primary));--_tree-caret-icon-color: var(--ds-tree-caret-icon-color, var(--text-tertiary));display:flex;flex-direction:column}.row{display:flex;align-items:center;gap:var(--space-2);width:100%;padding:var(--_tree-row-padding-y) var(--_tree-row-padding-x) var(--_tree-row-padding-y) calc(var(--_tree-row-padding-x) + var(--_level, 0) * var(--_tree-indent));border:0;background:transparent;border-radius:var(--focus-ring-radius);color:var(--_tree-row-text-color);font:var(--font-weight-regular) var(--font-size-s)/var(--line-height-base) var(--font-sans);text-align:left;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--duration-fast) var(--ease-standard)}.row:hover{background-color:var(--_tree-row-hover-bg-color)}.row:active:not([aria-disabled=true],:has(.trailing:active)){background-color:var(--surface-muted)}.row:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(-1 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.row[aria-disabled=true]{color:var(--text-disabled);cursor:not-allowed}.row.selected{background-color:var(--_tree-row-selected-bg-color);color:var(--_tree-row-selected-text-color);font-weight:var(--font-weight-semibold)}.caret{flex:none;color:var(--_tree-caret-icon-color)}.caret-spacer{flex:none;width:var(--space-4)}.node-icon{flex:none;color:var(--icon-default, var(--text-secondary))}.row.selected .node-icon{color:var(--_tree-row-selected-icon-color)}.label{min-width:0;overflow:clip visible;text-overflow:ellipsis;white-space:nowrap}.trailing{display:flex;flex:none;align-items:center;gap:var(--space-1);margin-block:calc(-1 * var(--_tree-row-padding-y));margin-inline-start:auto;font-weight:var(--font-weight-regular);cursor:default}.trailing:focus-within{position:relative;z-index:1}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "ds-icon", inputs: ["name", "size", "stroke", "ariaLabel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
137
257
|
}
|
|
138
258
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: TreeComponent, decorators: [{
|
|
139
259
|
type: Component,
|
|
140
|
-
args: [{ selector: 'ds-tree', standalone: true, imports: [IconComponent], encapsulation: ViewEncapsulation.Emulated, host: {
|
|
260
|
+
args: [{ selector: 'ds-tree', standalone: true, imports: [IconComponent, NgTemplateOutlet], encapsulation: ViewEncapsulation.Emulated, host: {
|
|
141
261
|
role: 'tree',
|
|
262
|
+
'[attr.aria-multiselectable]': "multiple() ? 'true' : null",
|
|
142
263
|
'(keydown)': 'onKeydown($event)',
|
|
143
|
-
|
|
144
|
-
|
|
264
|
+
'(pointerleave)': 'hover(null)',
|
|
265
|
+
}, template: "@for (entry of visibleNodes(); track entry.node.id; let index = $index) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -- Enter and Space reach the host keydown handler, which activates the focused row -->\n <div\n class=\"row\"\n role=\"treeitem\"\n [attr.data-node-id]=\"entry.node.id\"\n [attr.aria-level]=\"entry.level + 1\"\n [attr.aria-expanded]=\"entry.hasChildren ? entry.expanded : null\"\n [attr.aria-selected]=\"isSelected(entry.node.id)\"\n [attr.aria-disabled]=\"entry.node.disabled ? 'true' : null\"\n [attr.aria-labelledby]=\"idPrefix + '-' + index\"\n [attr.aria-describedby]=\"\n trailing() ? idPrefix + '-' + index + '-trailing' : null\n \"\n [attr.tabindex]=\"isActive(entry.node.id) ? 0 : -1\"\n [class.selected]=\"isSelected(entry.node.id)\"\n [style.--_level]=\"entry.level\"\n (click)=\"onRowClick(entry, $event)\"\n (focus)=\"onRowFocus(entry)\"\n (pointerenter)=\"hover(entry.node)\">\n @if (entry.hasChildren) {\n <ds-icon\n class=\"caret\"\n [name]=\"entry.expanded ? 'chevronDown' : 'chevronRight'\"\n [size]=\"16\" />\n } @else {\n <span class=\"caret-spacer\"></span>\n }\n\n @if (entry.node.icon; as icon) {\n <ds-icon\n class=\"node-icon\"\n [name]=\"icon\"\n [size]=\"16\" />\n }\n\n <span\n class=\"label\"\n [id]=\"idPrefix + '-' + index\">\n {{ entry.node.label }}\n </span>\n\n @if (trailing(); as trailing) {\n <span\n class=\"trailing\"\n [id]=\"idPrefix + '-' + index + '-trailing'\">\n <ng-container\n *ngTemplateOutlet=\"\n trailing.template;\n context: { $implicit: entry.node, node: entry.node }\n \" />\n </span>\n }\n </div>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_tree-indent: var(--ds-tree-indent, var(--tree-indent));--_tree-row-padding-y: var(--ds-tree-row-padding-y, var(--tree-row-pad-y));--_tree-row-padding-x: var(--ds-tree-row-padding-x, var(--tree-row-pad-x));--_tree-row-hover-bg-color: var(--ds-tree-row-hover-bg-color, var(--surface-secondary));--_tree-row-selected-bg-color: var(--ds-tree-row-selected-bg-color, var(--accent-surface-tint));--_tree-row-selected-text-color: var(--ds-tree-row-selected-text-color, var(--accent-strong));--_tree-row-selected-icon-color: var(--ds-tree-row-selected-icon-color, var(--_tree-row-selected-text-color));--_tree-row-text-color: var(--ds-tree-row-text-color, var(--text-primary));--_tree-caret-icon-color: var(--ds-tree-caret-icon-color, var(--text-tertiary));display:flex;flex-direction:column}.row{display:flex;align-items:center;gap:var(--space-2);width:100%;padding:var(--_tree-row-padding-y) var(--_tree-row-padding-x) var(--_tree-row-padding-y) calc(var(--_tree-row-padding-x) + var(--_level, 0) * var(--_tree-indent));border:0;background:transparent;border-radius:var(--focus-ring-radius);color:var(--_tree-row-text-color);font:var(--font-weight-regular) var(--font-size-s)/var(--line-height-base) var(--font-sans);text-align:left;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--duration-fast) var(--ease-standard)}.row:hover{background-color:var(--_tree-row-hover-bg-color)}.row:active:not([aria-disabled=true],:has(.trailing:active)){background-color:var(--surface-muted)}.row:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(-1 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.row[aria-disabled=true]{color:var(--text-disabled);cursor:not-allowed}.row.selected{background-color:var(--_tree-row-selected-bg-color);color:var(--_tree-row-selected-text-color);font-weight:var(--font-weight-semibold)}.caret{flex:none;color:var(--_tree-caret-icon-color)}.caret-spacer{flex:none;width:var(--space-4)}.node-icon{flex:none;color:var(--icon-default, var(--text-secondary))}.row.selected .node-icon{color:var(--_tree-row-selected-icon-color)}.label{min-width:0;overflow:clip visible;text-overflow:ellipsis;white-space:nowrap}.trailing{display:flex;flex:none;align-items:center;gap:var(--space-1);margin-block:calc(-1 * var(--_tree-row-padding-y));margin-inline-start:auto;font-weight:var(--font-weight-regular);cursor:default}.trailing:focus-within{position:relative;z-index:1}\n"] }]
|
|
266
|
+
}], ctorParameters: () => [], propDecorators: { nodes: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodes", required: false }] }], expandedIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandedIds", required: false }] }, { type: i0.Output, args: ["expandedIdsChange"] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], selectedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedId", required: false }] }, { type: i0.Output, args: ["selectedIdChange"] }], selectedIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedIds", required: false }] }, { type: i0.Output, args: ["selectedIdsChange"] }], nodeSelected: [{ type: i0.Output, args: ["nodeSelected"] }], nodeHover: [{ type: i0.Output, args: ["nodeHover"] }], trailing: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TreeTrailingDirective), { isSignal: true }] }] } });
|
|
145
267
|
|
|
146
268
|
/**
|
|
147
269
|
* Generated bundle index. Do not edit.
|
|
148
270
|
*/
|
|
149
271
|
|
|
150
|
-
export { TreeComponent };
|
|
272
|
+
export { TreeComponent, TreeTrailingDirective };
|
|
151
273
|
//# sourceMappingURL=ids-group-ltd-ids-design-system-components-tree.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids-group-ltd-ids-design-system-components-tree.mjs","sources":["../../../src/lib/components/tree/tree.component.ts","../../../src/lib/components/tree/tree.component.html","../../../src/lib/components/tree/ids-group-ltd-ids-design-system-components-tree.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport { IconComponent } from '@ids-group-ltd/ids-design-system/icons';\nimport type { TreeNode } from './tree.types';\n\ninterface VisibleNode {\n node: TreeNode;\n level: number;\n hasChildren: boolean;\n expanded: boolean;\n}\n\n@Component({\n selector: 'ds-tree',\n standalone: true,\n imports: [IconComponent],\n templateUrl: './tree.component.html',\n styleUrl: './tree.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n role: 'tree',\n '(keydown)': 'onKeydown($event)',\n },\n})\nexport class TreeComponent {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Root-level nodes; nest via `children`. */\n readonly nodes = input<readonly TreeNode[]>([]);\n /** Ids of the expanded nodes. */\n readonly expandedIds = model<Set<string>>(new Set());\n /** Id of the selected node. */\n readonly selectedId = model<string | null>(null);\n /** Fires with the node when a row is selected (click or Enter/Space). */\n readonly nodeSelected = output<TreeNode>();\n\n private readonly activeId = signal<string | null>(null);\n\n protected readonly visibleNodes = computed<VisibleNode[]>(() => {\n const out: VisibleNode[] = [];\n const walk = (list: readonly TreeNode[], level: number): void => {\n for (const node of list) {\n const hasChildren = !!node.children?.length;\n const expanded = this.isExpanded(node.id);\n out.push({ node, level, hasChildren, expanded });\n if (hasChildren && expanded) {\n walk(node.children ?? [], level + 1);\n }\n }\n };\n walk(this.nodes(), 0);\n\n return out;\n });\n\n protected readonly effectiveActiveId = computed(\n () => this.activeId() ?? this.visibleNodes()[0]?.node.id ?? null,\n );\n\n protected isExpanded(id: string): boolean {\n return this.expandedIds().has(id);\n }\n\n protected isSelected(id: string): boolean {\n return this.selectedId() === id;\n }\n\n protected isActive(id: string): boolean {\n return this.effectiveActiveId() === id;\n }\n\n protected onRowClick(entry: VisibleNode): void {\n if (entry.node.disabled) {\n return;\n }\n this.select(entry.node);\n if (entry.hasChildren) {\n this.toggle(entry.node);\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const visible = this.visibleNodes();\n const index = visible.findIndex(\n (entry) => entry.node.id === this.effectiveActiveId(),\n );\n if (index < 0) {\n return;\n }\n const current = visible[index];\n switch (event.key) {\n case 'ArrowDown':\n this.moveActive(index + 1);\n break;\n case 'ArrowUp':\n this.moveActive(index - 1);\n break;\n case 'Home':\n this.moveActive(0);\n break;\n case 'End':\n this.moveActive(visible.length - 1);\n break;\n case 'ArrowRight':\n if (current.hasChildren && !current.expanded) {\n this.toggle(current.node);\n } else if (current.hasChildren) {\n this.moveActive(index + 1);\n }\n break;\n case 'ArrowLeft':\n if (current.hasChildren && current.expanded) {\n this.toggle(current.node);\n } else {\n this.moveToParent(visible, index);\n }\n break;\n default:\n // Enter and Space activate through the row button's native click.\n return;\n }\n event.preventDefault();\n }\n\n private toggle(node: TreeNode): void {\n if (node.disabled || !node.children?.length) {\n return;\n }\n const next = new Set(this.expandedIds());\n if (next.has(node.id)) {\n next.delete(node.id);\n } else {\n next.add(node.id);\n }\n this.expandedIds.set(next);\n }\n\n private select(node: TreeNode): void {\n if (node.disabled) {\n return;\n }\n this.selectedId.set(node.id);\n this.activeId.set(node.id);\n this.nodeSelected.emit(node);\n }\n\n private moveActive(targetIndex: number): void {\n const visible = this.visibleNodes();\n if (targetIndex < 0 || targetIndex >= visible.length) {\n return;\n }\n this.focusNode(visible[targetIndex].node.id);\n }\n\n private moveToParent(visible: VisibleNode[], index: number): void {\n const level = visible[index].level;\n for (let i = index - 1; i >= 0; i--) {\n if (visible[i].level < level) {\n this.focusNode(visible[i].node.id);\n\n return;\n }\n }\n }\n\n private focusNode(id: string): void {\n this.activeId.set(id);\n this.host.nativeElement\n .querySelector<HTMLElement>(`[data-node-id=\"${id}\"]`)\n ?.focus();\n }\n}\n","@for (entry of visibleNodes(); track entry.node.id) {\n <button\n type=\"button\"\n class=\"row\"\n role=\"treeitem\"\n [attr.data-node-id]=\"entry.node.id\"\n [attr.aria-level]=\"entry.level + 1\"\n [attr.aria-expanded]=\"entry.hasChildren ? entry.expanded : null\"\n [attr.aria-selected]=\"isSelected(entry.node.id)\"\n [attr.tabindex]=\"isActive(entry.node.id) ? 0 : -1\"\n [class.selected]=\"isSelected(entry.node.id)\"\n [disabled]=\"entry.node.disabled\"\n [style.--_level]=\"entry.level\"\n (click)=\"onRowClick(entry)\">\n @if (entry.hasChildren) {\n <ds-icon\n class=\"caret\"\n [name]=\"entry.expanded ? 'chevronDown' : 'chevronRight'\"\n [size]=\"16\" />\n } @else {\n <span class=\"caret-spacer\"></span>\n }\n\n @if (entry.node.icon; as icon) {\n <ds-icon\n class=\"node-icon\"\n [name]=\"icon\"\n [size]=\"16\" />\n }\n\n <span class=\"label\">\n {{ entry.node.label }}\n </span>\n </button>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAiCa,aAAa,CAAA;AACP,IAAA,IAAI,GAAG,MAAM,CAA0B,UAAU,CAAC;;AAG1D,IAAA,KAAK,GAAG,KAAK,CAAsB,EAAE,4EAAC;;AAEtC,IAAA,WAAW,GAAG,KAAK,CAAc,IAAI,GAAG,EAAE,kFAAC;;AAE3C,IAAA,UAAU,GAAG,KAAK,CAAgB,IAAI,iFAAC;;IAEvC,YAAY,GAAG,MAAM,EAAY;AAEzB,IAAA,QAAQ,GAAG,MAAM,CAAgB,IAAI,+EAAC;AAEpC,IAAA,YAAY,GAAG,QAAQ,CAAgB,MAAK;QAC7D,MAAM,GAAG,GAAkB,EAAE;AAC7B,QAAA,MAAM,IAAI,GAAG,CAAC,IAAyB,EAAE,KAAa,KAAU;AAC9D,YAAA,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;gBACvB,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM;gBAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE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AAA,EAAA,SAAA,EAAA,EAAA,SAAA,EAAA,mBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECjC1B,ygCAmCA,EAAA,MAAA,EAAA,CAAA,ouFAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDXY,aAAa,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,MAAA,EAAA,QAAA,EAAA,WAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;4FASZ,aAAa,EAAA,UAAA,EAAA,CAAA;kBAZzB,SAAS;+BACE,SAAS,EAAA,UAAA,EACP,IAAI,EAAA,OAAA,EACP,CAAC,aAAa,CAAC,EAAA,aAAA,EAGT,iBAAiB,CAAC,QAAQ,EAAA,IAAA,EACnC;AACJ,wBAAA,IAAI,EAAE,MAAM;AACZ,wBAAA,WAAW,EAAE,mBAAmB;AACjC,qBAAA,EAAA,QAAA,EAAA,ygCAAA,EAAA,MAAA,EAAA,CAAA,ouFAAA,CAAA,EAAA;;;AE/BH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ids-group-ltd-ids-design-system-components-tree.mjs","sources":["../../../src/lib/components/tree/tree-trailing.directive.ts","../../../src/lib/components/tree/tree.component.ts","../../../src/lib/components/tree/tree.component.html","../../../src/lib/components/tree/ids-group-ltd-ids-design-system-components-tree.ts"],"sourcesContent":["import { Directive, TemplateRef, inject } from '@angular/core';\nimport type { TreeNode } from './tree.types';\n\n/** What a `dsTreeTrailing` template is handed: the row's node, as `$implicit` and again as `node`. */\nexport interface TreeTrailingContext {\n readonly $implicit: TreeNode;\n readonly node: TreeNode;\n}\n\n/**\n * Content drawn at the end of every `ds-tree` row: a badge, a count, a small icon button.\n *\n * ```html\n * <ds-tree [nodes]=\"layers\">\n * <ng-template dsTreeTrailing let-node>\n * <ds-badge size=\"sm\">{{ node.id }}</ds-badge>\n * </ng-template>\n * </ds-tree>\n * ```\n *\n * A click inside it neither selects nor toggles the row. Its controls are tab stops only on\n * the focused row: Tab from that row reaches them, and the other rows' controls stay out of\n * the tab order.\n */\n@Directive({\n selector: 'ng-template[dsTreeTrailing]',\n standalone: true,\n})\nexport class TreeTrailingDirective {\n readonly template = inject<TemplateRef<TreeTrailingContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _directive: TreeTrailingDirective,\n _context: unknown,\n ): _context is TreeTrailingContext {\n return true;\n }\n}\n","import {\n Component,\n ElementRef,\n ViewEncapsulation,\n afterEveryRender,\n computed,\n contentChild,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { IconComponent } from '@ids-group-ltd/ids-design-system/icons';\nimport { TreeTrailingDirective } from './tree-trailing.directive';\nimport type { TreeNode, TreeSelection } from './tree.types';\n\ninterface VisibleNode {\n node: TreeNode;\n level: number;\n hasChildren: boolean;\n expanded: boolean;\n}\n\nconst FOCUSABLE =\n 'a[href], button, input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\nconst PARKED_TABINDEX = 'data-ds-tree-tabindex';\n\nlet nextId = 0;\n\n@Component({\n selector: 'ds-tree',\n standalone: true,\n imports: [IconComponent, NgTemplateOutlet],\n templateUrl: './tree.component.html',\n styleUrl: './tree.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n role: 'tree',\n '[attr.aria-multiselectable]': \"multiple() ? 'true' : null\",\n '(keydown)': 'onKeydown($event)',\n '(pointerleave)': 'hover(null)',\n },\n})\nexport class TreeComponent {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Root-level nodes; nest via `children`. */\n readonly nodes = input<readonly TreeNode[]>([]);\n /** Ids of the expanded nodes. */\n readonly expandedIds = model<Set<string>>(new Set());\n /** `'multiple'` reads and writes `selectedIds`; `'single'` reads and writes `selectedId`. */\n readonly selection = input<TreeSelection>('single');\n /** Id of the selected node, in `'single'` selection. */\n readonly selectedId = model<string | null>(null);\n /** Ids of the selected nodes, in `'multiple'` selection. */\n readonly selectedIds = model<string[]>([]);\n /** Fires with the node when a row is selected (click or Enter/Space), not when one is deselected. */\n readonly nodeSelected = output<TreeNode>();\n /** Fires with the node under the pointer or newly focused, and `null` when the pointer leaves the tree. */\n readonly nodeHover = output<TreeNode | null>();\n\n protected readonly trailing = contentChild(TreeTrailingDirective);\n protected readonly idPrefix = `ds-tree-${++nextId}`;\n\n private readonly activeId = signal<string | null>(null);\n private hoveredId: string | null = null;\n\n protected readonly multiple = computed(() => this.selection() === 'multiple');\n\n protected readonly visibleNodes = computed<VisibleNode[]>(() => {\n const out: VisibleNode[] = [];\n const walk = (list: readonly TreeNode[], level: number): void => {\n for (const node of list) {\n const hasChildren = !!node.children?.length;\n const expanded = this.isExpanded(node.id);\n out.push({ node, level, hasChildren, expanded });\n if (hasChildren && expanded) {\n walk(node.children ?? [], level + 1);\n }\n }\n };\n walk(this.nodes(), 0);\n\n return out;\n });\n\n protected readonly effectiveActiveId = computed(\n () => this.activeId() ?? this.visibleNodes()[0]?.node.id ?? null,\n );\n\n constructor() {\n // Content inside a trailing template can change without a signal of the tree changing,\n // so its tab stops are re-parked after every render.\n afterEveryRender({ write: () => this.parkTrailingTabStops() });\n }\n\n protected isExpanded(id: string): boolean {\n return this.expandedIds().has(id);\n }\n\n protected isSelected(id: string): boolean {\n return this.multiple()\n ? this.selectedIds().includes(id)\n : this.selectedId() === id;\n }\n\n protected isActive(id: string): boolean {\n return this.effectiveActiveId() === id;\n }\n\n protected onRowClick(entry: VisibleNode, event: MouseEvent): void {\n if (this.fromTrailing(event)) {\n return;\n }\n this.activate(entry, event.shiftKey || event.ctrlKey || event.metaKey);\n }\n\n protected onRowFocus(entry: VisibleNode): void {\n this.activeId.set(entry.node.id);\n this.hover(entry.node);\n }\n\n protected hover(node: TreeNode | null): void {\n const id = node?.id ?? null;\n if (id === this.hoveredId) {\n return;\n }\n this.hoveredId = id;\n this.nodeHover.emit(node);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.fromTrailing(event)) {\n return;\n }\n const visible = this.visibleNodes();\n const index = visible.findIndex(\n (entry) => entry.node.id === this.effectiveActiveId(),\n );\n if (index < 0) {\n return;\n }\n const current = visible[index];\n switch (event.key) {\n case 'ArrowDown':\n this.moveActive(index + 1);\n break;\n case 'ArrowUp':\n this.moveActive(index - 1);\n break;\n case 'Home':\n this.moveActive(0);\n break;\n case 'End':\n this.moveActive(visible.length - 1);\n break;\n case 'ArrowRight':\n if (current.hasChildren && !current.expanded) {\n this.toggle(current.node);\n } else if (current.hasChildren) {\n this.moveActive(index + 1);\n }\n break;\n case 'ArrowLeft':\n if (current.hasChildren && current.expanded) {\n this.toggle(current.node);\n } else {\n this.moveToParent(visible, index);\n }\n break;\n case 'Enter':\n case ' ':\n if (!event.repeat) {\n this.activate(\n current,\n event.shiftKey || event.ctrlKey || event.metaKey,\n );\n }\n break;\n default:\n return;\n }\n event.preventDefault();\n }\n\n // A modified activation in multiple selection only adds or removes the node; every other\n // activation selects the node alone and toggles a parent.\n private activate(entry: VisibleNode, modified: boolean): void {\n const node = entry.node;\n if (node.disabled) {\n return;\n }\n this.activeId.set(node.id);\n if (this.multiple() && modified) {\n const ids = this.selectedIds();\n if (ids.includes(node.id)) {\n this.selectedIds.set(ids.filter((id) => id !== node.id));\n } else {\n this.selectedIds.set([...ids, node.id]);\n this.nodeSelected.emit(node);\n }\n\n return;\n }\n if (this.multiple()) {\n this.selectedIds.set([node.id]);\n } else {\n this.selectedId.set(node.id);\n }\n this.nodeSelected.emit(node);\n if (entry.hasChildren) {\n this.toggle(node);\n }\n }\n\n private toggle(node: TreeNode): void {\n if (node.disabled || !node.children?.length) {\n return;\n }\n const next = new Set(this.expandedIds());\n if (next.has(node.id)) {\n next.delete(node.id);\n } else {\n next.add(node.id);\n }\n this.expandedIds.set(next);\n }\n\n private moveActive(targetIndex: number): void {\n const visible = this.visibleNodes();\n if (targetIndex < 0 || targetIndex >= visible.length) {\n return;\n }\n this.focusNode(visible[targetIndex].node.id);\n }\n\n private moveToParent(visible: VisibleNode[], index: number): void {\n const level = visible[index].level;\n for (let i = index - 1; i >= 0; i--) {\n if (visible[i].level < level) {\n this.focusNode(visible[i].node.id);\n\n return;\n }\n }\n }\n\n private focusNode(id: string): void {\n this.activeId.set(id);\n this.host.nativeElement\n .querySelector<HTMLElement>(`[data-node-id=\"${CSS.escape(id)}\"]`)\n ?.focus();\n }\n\n private fromTrailing(event: Event): boolean {\n return (\n event.target instanceof Element && !!event.target.closest('.trailing')\n );\n }\n\n // The tree keeps one tab stop: controls in a trailing template are tabbable on the active\n // row only, and get their own tabindex back when their row becomes active.\n private parkTrailingTabStops(): void {\n const activeId = this.effectiveActiveId();\n for (const area of this.host.nativeElement.querySelectorAll('.trailing')) {\n const onActiveRow =\n area.closest('[data-node-id]')?.getAttribute('data-node-id') ===\n activeId;\n const controls = area.querySelectorAll<HTMLElement>(\n onActiveRow ? `[${PARKED_TABINDEX}]` : FOCUSABLE,\n );\n for (const control of controls) {\n if (onActiveRow) {\n const own = control.getAttribute(PARKED_TABINDEX);\n control.removeAttribute(PARKED_TABINDEX);\n if (own) {\n control.setAttribute('tabindex', own);\n } else {\n control.removeAttribute('tabindex');\n }\n } else if (!control.hasAttribute(PARKED_TABINDEX)) {\n control.setAttribute(\n PARKED_TABINDEX,\n control.getAttribute('tabindex') ?? '',\n );\n control.setAttribute('tabindex', '-1');\n }\n }\n }\n }\n}\n","@for (entry of visibleNodes(); track entry.node.id; let index = $index) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -- Enter and Space reach the host keydown handler, which activates the focused row -->\n <div\n class=\"row\"\n role=\"treeitem\"\n [attr.data-node-id]=\"entry.node.id\"\n [attr.aria-level]=\"entry.level + 1\"\n [attr.aria-expanded]=\"entry.hasChildren ? entry.expanded : null\"\n [attr.aria-selected]=\"isSelected(entry.node.id)\"\n [attr.aria-disabled]=\"entry.node.disabled ? 'true' : null\"\n [attr.aria-labelledby]=\"idPrefix + '-' + index\"\n [attr.aria-describedby]=\"\n trailing() ? idPrefix + '-' + index + '-trailing' : null\n \"\n [attr.tabindex]=\"isActive(entry.node.id) ? 0 : -1\"\n [class.selected]=\"isSelected(entry.node.id)\"\n [style.--_level]=\"entry.level\"\n (click)=\"onRowClick(entry, $event)\"\n (focus)=\"onRowFocus(entry)\"\n (pointerenter)=\"hover(entry.node)\">\n @if (entry.hasChildren) {\n <ds-icon\n class=\"caret\"\n [name]=\"entry.expanded ? 'chevronDown' : 'chevronRight'\"\n [size]=\"16\" />\n } @else {\n <span class=\"caret-spacer\"></span>\n }\n\n @if (entry.node.icon; as icon) {\n <ds-icon\n class=\"node-icon\"\n [name]=\"icon\"\n [size]=\"16\" />\n }\n\n <span\n class=\"label\"\n [id]=\"idPrefix + '-' + index\">\n {{ entry.node.label }}\n </span>\n\n @if (trailing(); as trailing) {\n <span\n class=\"trailing\"\n [id]=\"idPrefix + '-' + index + '-trailing'\">\n <ng-container\n *ngTemplateOutlet=\"\n trailing.template;\n context: { $implicit: entry.node, node: entry.node }\n \" />\n </span>\n }\n </div>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AASA;;;;;;;;;;;;;;AAcG;MAKU,qBAAqB,CAAA;AACvB,IAAA,QAAQ,GAAG,MAAM,CAAmC,WAAW,CAAC;AAEzE,IAAA,OAAO,sBAAsB,CAC3B,UAAiC,EACjC,QAAiB,EAAA;AAEjB,QAAA,OAAO,IAAI;IACb;wGARW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,6BAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAJjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;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uDA,EAAA,MAAA,EAAA,CAAA,ujGAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDrBY,aAAa,qGAAE,gBAAgB,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,kBAAA,EAAA,0BAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;4FAW9B,aAAa,EAAA,UAAA,EAAA,CAAA;kBAdzB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,SAAS,EAAA,UAAA,EACP,IAAI,EAAA,OAAA,EACP,CAAC,aAAa,EAAE,gBAAgB,CAAC,EAAA,aAAA,EAG3B,iBAAiB,CAAC,QAAQ,EAAA,IAAA,EACnC;AACJ,wBAAA,IAAI,EAAE,MAAM;AACZ,wBAAA,6BAA6B,EAAE,4BAA4B;AAC3D,wBAAA,WAAW,EAAE,mBAAmB;AAChC,wBAAA,gBAAgB,EAAE,aAAa;AAChC,qBAAA,EAAA,QAAA,EAAA,ozDAAA,EAAA,MAAA,EAAA,CAAA,ujGAAA,CAAA,EAAA;42BAoB0C,qBAAqB,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE/DlE;;AAEG;;;;"}
|
|
@@ -296,10 +296,32 @@ const DS_INTL_DEFAULTS = {
|
|
|
296
296
|
},
|
|
297
297
|
toast: {
|
|
298
298
|
region: 'Notifications',
|
|
299
|
+
showAll: 'Show all',
|
|
300
|
+
hide: 'Hide',
|
|
301
|
+
dismissAll: 'Dismiss all',
|
|
302
|
+
repeated: (message, count) => `${message}, ${count} times`,
|
|
303
|
+
},
|
|
304
|
+
attachment: {
|
|
305
|
+
remove: (name) => `Remove ${name}`,
|
|
306
|
+
pdf: 'PDF document',
|
|
307
|
+
doc: 'Word document',
|
|
308
|
+
image: 'Image',
|
|
309
|
+
file: 'File',
|
|
310
|
+
},
|
|
311
|
+
chatInput: {
|
|
312
|
+
label: 'Message',
|
|
313
|
+
send: 'Send',
|
|
299
314
|
},
|
|
300
315
|
spinner: {
|
|
301
316
|
label: 'Loading',
|
|
302
317
|
},
|
|
318
|
+
splitter: {
|
|
319
|
+
label: 'Resize panes',
|
|
320
|
+
},
|
|
321
|
+
inlineEdit: {
|
|
322
|
+
rename: 'Rename',
|
|
323
|
+
saved: 'Saved',
|
|
324
|
+
},
|
|
303
325
|
breadcrumbs: {
|
|
304
326
|
label: 'Breadcrumb',
|
|
305
327
|
},
|
|
@@ -332,6 +354,38 @@ const DS_INTL_DEFAULTS = {
|
|
|
332
354
|
label: 'Progress',
|
|
333
355
|
step: (position, label, state) => `Step ${position}: ${label} (${state})`,
|
|
334
356
|
},
|
|
357
|
+
timeline: {
|
|
358
|
+
done: 'Done',
|
|
359
|
+
running: 'In progress',
|
|
360
|
+
pending: 'Not started',
|
|
361
|
+
error: 'Failed',
|
|
362
|
+
details: (heading) => (heading ? `Details: ${heading}` : 'Details'),
|
|
363
|
+
},
|
|
364
|
+
chat: {
|
|
365
|
+
user: 'You',
|
|
366
|
+
assistant: 'Assistant',
|
|
367
|
+
thread: 'Conversation',
|
|
368
|
+
working: 'Assistant is working',
|
|
369
|
+
newMessages: (count) => count === 1 ? '1 new message' : `${count} new messages`,
|
|
370
|
+
latest: 'Jump to latest',
|
|
371
|
+
today: 'Today',
|
|
372
|
+
yesterday: 'Yesterday',
|
|
373
|
+
sending: 'Sending',
|
|
374
|
+
sent: 'Sent',
|
|
375
|
+
notSent: 'Not sent',
|
|
376
|
+
retry: 'Retry',
|
|
377
|
+
steps: (count) => (count === 1 ? '1 step' : `${count} steps`),
|
|
378
|
+
stepsFailed: (count) => `${count} failed`,
|
|
379
|
+
stepsFolded: (count, failed) => failed
|
|
380
|
+
? `Steps folded, ${count}, ${failed} failed`
|
|
381
|
+
: `Steps folded, ${count}`,
|
|
382
|
+
stepDone: 'Done',
|
|
383
|
+
stepRunning: 'In progress',
|
|
384
|
+
stepPending: 'Not started',
|
|
385
|
+
stepWaiting: 'Waiting for your approval',
|
|
386
|
+
stepFailed: 'Failed',
|
|
387
|
+
stepDetails: (heading) => (heading ? `Details: ${heading}` : 'Details'),
|
|
388
|
+
},
|
|
335
389
|
tabs: {
|
|
336
390
|
close: (label) => `Close ${label}`,
|
|
337
391
|
},
|