@angular/cdk-experimental 20.2.0-next.2 → 20.2.0-next.3
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/accordion/index.d.ts +3 -3
- package/{accordion.d-CC6dGMlv.d.ts → accordion.d.d.ts} +7 -5
- package/{expansion.d-Zkcf-XJU.d.ts → expansion.d.d.ts} +3 -3
- package/fesm2022/accordion.mjs +17 -17
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/{accordion-D9JoxtzT.mjs → accordion2.mjs} +8 -6
- package/fesm2022/accordion2.mjs.map +1 -0
- package/fesm2022/cdk-experimental.mjs +1 -1
- package/fesm2022/cdk-experimental.mjs.map +1 -1
- package/fesm2022/column-resize.mjs +54 -54
- package/fesm2022/combobox.mjs +10 -10
- package/fesm2022/deferred-content.mjs +6 -6
- package/fesm2022/{expansion-C9iQLHOG.mjs → expansion.mjs} +2 -2
- package/fesm2022/expansion.mjs.map +1 -0
- package/fesm2022/{list-focus-Czul8jzR.mjs → list-navigation.mjs} +63 -62
- package/fesm2022/list-navigation.mjs.map +1 -0
- package/fesm2022/list.mjs +355 -0
- package/fesm2022/list.mjs.map +1 -0
- package/fesm2022/listbox.mjs +10 -11
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/option.mjs +231 -0
- package/fesm2022/option.mjs.map +1 -0
- package/fesm2022/{polyfill-CXksG4af.mjs → polyfill.mjs} +2 -2
- package/fesm2022/polyfill.mjs.map +1 -0
- package/fesm2022/popover-edit.mjs +44 -44
- package/fesm2022/{radio-button-92xc4w-A.mjs → radio-button.mjs} +33 -70
- package/fesm2022/radio-button.mjs.map +1 -0
- package/fesm2022/radio-group.mjs +10 -10
- package/fesm2022/radio-group.mjs.map +1 -1
- package/fesm2022/scrolling.mjs +7 -7
- package/fesm2022/selection.mjs +19 -19
- package/fesm2022/table-scroll-container.mjs +7 -7
- package/fesm2022/tabs.mjs +20 -20
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/{tabs-hMdwtXv2.mjs → tabs2.mjs} +34 -70
- package/fesm2022/tabs2.mjs.map +1 -0
- package/fesm2022/tree.mjs +87 -159
- package/fesm2022/tree.mjs.map +1 -1
- package/fesm2022/ui-patterns.mjs +7 -8
- package/fesm2022/ui-patterns.mjs.map +1 -1
- package/list.d.d.ts +207 -0
- package/listbox/index.d.ts +3 -4
- package/{listbox.d-Ckp1is82.d.ts → listbox.d.d.ts} +9 -62
- package/package.json +2 -2
- package/{pointer-event-manager.d-BqSm9Jh5.d.ts → pointer-event-manager.d.d.ts} +12 -8
- package/radio-group/index.d.ts +4 -4
- package/{radio-group.d-CFC0aKQM.d.ts → radio-group.d.d.ts} +12 -31
- package/tabs/index.d.ts +4 -4
- package/{tabs.d-Db8oTrMB.d.ts → tabs.d.d.ts} +15 -30
- package/tree/index.d.ts +10 -39
- package/ui-patterns/index.d.ts +7 -8
- package/fesm2022/accordion-D9JoxtzT.mjs.map +0 -1
- package/fesm2022/expansion-C9iQLHOG.mjs.map +0 -1
- package/fesm2022/list-focus-Czul8jzR.mjs.map +0 -1
- package/fesm2022/list-selection-C41ApAbt.mjs +0 -136
- package/fesm2022/list-selection-C41ApAbt.mjs.map +0 -1
- package/fesm2022/list-typeahead-DIIbNJrP.mjs +0 -64
- package/fesm2022/list-typeahead-DIIbNJrP.mjs.map +0 -1
- package/fesm2022/option-CgeKz9_Q.mjs +0 -321
- package/fesm2022/option-CgeKz9_Q.mjs.map +0 -1
- package/fesm2022/polyfill-CXksG4af.mjs.map +0 -1
- package/fesm2022/radio-button-92xc4w-A.mjs.map +0 -1
- package/fesm2022/tabs-hMdwtXv2.mjs.map +0 -1
- package/list-selection.d-fbAPr_N_.d.ts +0 -69
- package/list-typeahead.d-ljh3nJ9y.d.ts +0 -48
package/fesm2022/tree.mjs
CHANGED
|
@@ -4,16 +4,17 @@ import { _IdGenerator } from '@angular/cdk/a11y';
|
|
|
4
4
|
import { Directionality } from '@angular/cdk/bidi';
|
|
5
5
|
import * as i1 from '@angular/cdk-experimental/deferred-content';
|
|
6
6
|
import { DeferredContentAware, DeferredContent } from '@angular/cdk-experimental/deferred-content';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { E as ExpansionControl, L as ListExpansion } from './expansion-C9iQLHOG.mjs';
|
|
7
|
+
import { List } from './list.mjs';
|
|
8
|
+
import { ExpansionControl, ListExpansion } from './expansion.mjs';
|
|
9
|
+
import { Modifier, KeyboardEventManager, PointerEventManager } from './list-navigation.mjs';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Represents an item in a Tree.
|
|
14
13
|
*/
|
|
15
14
|
class TreeItemPattern {
|
|
16
15
|
inputs;
|
|
16
|
+
/** The position of this item among its siblings. */
|
|
17
|
+
index = computed(() => this.tree().visibleItems().indexOf(this));
|
|
17
18
|
/** The unique identifier used by the expansion behavior. */
|
|
18
19
|
expansionId;
|
|
19
20
|
/** Controls expansion for child items. */
|
|
@@ -33,9 +34,9 @@ class TreeItemPattern {
|
|
|
33
34
|
/** The position of this item among its siblings (1-based). */
|
|
34
35
|
posinset = computed(() => this.parent().children().indexOf(this) + 1);
|
|
35
36
|
/** Whether the item is active. */
|
|
36
|
-
active = computed(() => this.tree().
|
|
37
|
+
active = computed(() => this.tree().activeItem() === this);
|
|
37
38
|
/** The tabindex of the item. */
|
|
38
|
-
tabindex = computed(() => this.tree().
|
|
39
|
+
tabindex = computed(() => this.tree().listBehavior.getItemTabindex(this));
|
|
39
40
|
/** Whether the item is selected. */
|
|
40
41
|
selected = computed(() => {
|
|
41
42
|
if (this.tree().nav()) {
|
|
@@ -81,14 +82,8 @@ class TreeItemPattern {
|
|
|
81
82
|
/** Controls the state and interactions of a tree view. */
|
|
82
83
|
class TreePattern {
|
|
83
84
|
inputs;
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
-
/** Controls navigation for all visible tree items. */
|
|
87
|
-
navigationManager;
|
|
88
|
-
/** Controls selection for all visible tree items. */
|
|
89
|
-
selectionManager;
|
|
90
|
-
/** Controls typeahead for all visible tree items. */
|
|
91
|
-
typeaheadManager;
|
|
85
|
+
/** The list behavior for the tree. */
|
|
86
|
+
listBehavior;
|
|
92
87
|
/** Controls expansion for direct children of the tree root (top-level items). */
|
|
93
88
|
expansionManager;
|
|
94
89
|
/** The root level is 0. */
|
|
@@ -96,11 +91,9 @@ class TreePattern {
|
|
|
96
91
|
/** The root is always expanded. */
|
|
97
92
|
expanded = () => true;
|
|
98
93
|
/** The tabindex of the tree. */
|
|
99
|
-
tabindex = computed(() => this.
|
|
94
|
+
tabindex = computed(() => this.listBehavior.tabindex());
|
|
100
95
|
/** The id of the current active item. */
|
|
101
|
-
activedescendant = computed(() => this.
|
|
102
|
-
/** Whether the tree is performing a range selection. */
|
|
103
|
-
inSelection = signal(false);
|
|
96
|
+
activedescendant = computed(() => this.listBehavior.activedescendant());
|
|
104
97
|
/** The direct children of the root (top-level tree items). */
|
|
105
98
|
children = computed(() => this.inputs.allItems().filter(item => item.level() === this.level() + 1));
|
|
106
99
|
/** All currently visible tree items. An item is visible if their parent is expanded. */
|
|
@@ -136,67 +129,62 @@ class TreePattern {
|
|
|
136
129
|
return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
|
|
137
130
|
});
|
|
138
131
|
/** Represents the space key. Does nothing when the user is actively using typeahead. */
|
|
139
|
-
dynamicSpaceKey = computed(() => (this.
|
|
132
|
+
dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));
|
|
140
133
|
/** Regular expression to match characters for typeahead. */
|
|
141
134
|
typeaheadRegexp = /^.$/;
|
|
142
|
-
/** Uncommitted tree item for selecting a range of tree items. */
|
|
143
|
-
anchorItem = signal(undefined);
|
|
144
|
-
/**
|
|
145
|
-
* Uncommitted tree item index for selecting a range of tree items.
|
|
146
|
-
*
|
|
147
|
-
* The index is computed in case the tree item position is changed caused by tree expansions.
|
|
148
|
-
*/
|
|
149
|
-
anchorIndex = computed(() => this.anchorItem() ? this.visibleItems().indexOf(this.anchorItem()) : -1);
|
|
150
135
|
/** The keydown event manager for the tree. */
|
|
151
136
|
keydown = computed(() => {
|
|
152
137
|
const manager = new KeyboardEventManager();
|
|
138
|
+
const list = this.listBehavior;
|
|
153
139
|
if (!this.followFocus()) {
|
|
154
140
|
manager
|
|
155
|
-
.on(this.prevKey, () =>
|
|
156
|
-
.on(this.nextKey, () =>
|
|
157
|
-
.on('Home', () =>
|
|
158
|
-
.on('End', () =>
|
|
159
|
-
.on(this.typeaheadRegexp, e =>
|
|
141
|
+
.on(this.prevKey, () => list.prev())
|
|
142
|
+
.on(this.nextKey, () => list.next())
|
|
143
|
+
.on('Home', () => list.first())
|
|
144
|
+
.on('End', () => list.last())
|
|
145
|
+
.on(this.typeaheadRegexp, e => list.search(e.key));
|
|
160
146
|
}
|
|
161
147
|
if (this.followFocus()) {
|
|
162
148
|
manager
|
|
163
|
-
.on(this.prevKey, () =>
|
|
164
|
-
.on(this.nextKey, () =>
|
|
165
|
-
.on('Home', () =>
|
|
166
|
-
.on('End', () =>
|
|
167
|
-
.on(this.typeaheadRegexp, e =>
|
|
149
|
+
.on(this.prevKey, () => list.prev({ selectOne: true }))
|
|
150
|
+
.on(this.nextKey, () => list.next({ selectOne: true }))
|
|
151
|
+
.on('Home', () => list.first({ selectOne: true }))
|
|
152
|
+
.on('End', () => list.last({ selectOne: true }))
|
|
153
|
+
.on(this.typeaheadRegexp, e => list.search(e.key, { selectOne: true }));
|
|
168
154
|
}
|
|
169
155
|
if (this.inputs.multi()) {
|
|
170
156
|
manager
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
.on(Modifier.
|
|
174
|
-
.on(
|
|
175
|
-
.on(
|
|
176
|
-
.on(Modifier.Shift, '
|
|
177
|
-
.on(Modifier.Shift,
|
|
157
|
+
// TODO: Tracking the anchor by index can break if the
|
|
158
|
+
// tree is expanded or collapsed causing the index to change.
|
|
159
|
+
.on(Modifier.Any, 'Shift', () => list.anchor(this.listBehavior.activeIndex()))
|
|
160
|
+
.on(Modifier.Shift, this.prevKey, () => list.prev({ selectRange: true }))
|
|
161
|
+
.on(Modifier.Shift, this.nextKey, () => list.next({ selectRange: true }))
|
|
162
|
+
.on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'Home', () => list.first({ selectRange: true, anchor: false }))
|
|
163
|
+
.on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'End', () => list.last({ selectRange: true, anchor: false }))
|
|
164
|
+
.on(Modifier.Shift, 'Enter', () => list.updateSelection({ selectRange: true, anchor: false }))
|
|
165
|
+
.on(Modifier.Shift, this.dynamicSpaceKey, () => list.updateSelection({ selectRange: true, anchor: false }));
|
|
178
166
|
}
|
|
179
167
|
if (!this.followFocus() && this.inputs.multi()) {
|
|
180
168
|
manager
|
|
181
|
-
.on(this.dynamicSpaceKey, () =>
|
|
182
|
-
.on('Enter', () =>
|
|
183
|
-
.on([Modifier.Ctrl, Modifier.Meta], 'A', () =>
|
|
169
|
+
.on(this.dynamicSpaceKey, () => list.toggle())
|
|
170
|
+
.on('Enter', () => list.toggle())
|
|
171
|
+
.on([Modifier.Ctrl, Modifier.Meta], 'A', () => list.toggleAll());
|
|
184
172
|
}
|
|
185
173
|
if (!this.followFocus() && !this.inputs.multi()) {
|
|
186
|
-
manager.on(this.dynamicSpaceKey, () =>
|
|
187
|
-
manager.on('Enter', () =>
|
|
174
|
+
manager.on(this.dynamicSpaceKey, () => list.toggleOne());
|
|
175
|
+
manager.on('Enter', () => list.toggleOne());
|
|
188
176
|
}
|
|
189
177
|
if (this.inputs.multi() && this.followFocus()) {
|
|
190
178
|
manager
|
|
191
|
-
.on([Modifier.Ctrl, Modifier.Meta], this.prevKey, () =>
|
|
192
|
-
.on([Modifier.Ctrl, Modifier.Meta], this.nextKey, () =>
|
|
193
|
-
.on([Modifier.Ctrl, Modifier.Meta], ' ', () =>
|
|
194
|
-
.on([Modifier.Ctrl, Modifier.Meta], 'Enter', () =>
|
|
195
|
-
.on([Modifier.Ctrl, Modifier.Meta], 'Home', () =>
|
|
196
|
-
.on([Modifier.Ctrl, Modifier.Meta], 'End', () =>
|
|
179
|
+
.on([Modifier.Ctrl, Modifier.Meta], this.prevKey, () => list.prev())
|
|
180
|
+
.on([Modifier.Ctrl, Modifier.Meta], this.nextKey, () => list.next())
|
|
181
|
+
.on([Modifier.Ctrl, Modifier.Meta], ' ', () => list.toggle())
|
|
182
|
+
.on([Modifier.Ctrl, Modifier.Meta], 'Enter', () => list.toggle())
|
|
183
|
+
.on([Modifier.Ctrl, Modifier.Meta], 'Home', () => list.first())
|
|
184
|
+
.on([Modifier.Ctrl, Modifier.Meta], 'End', () => list.last())
|
|
197
185
|
.on([Modifier.Ctrl, Modifier.Meta], 'A', () => {
|
|
198
|
-
|
|
199
|
-
|
|
186
|
+
list.toggleAll();
|
|
187
|
+
list.select(); // Ensure the currect item remains selected.
|
|
200
188
|
});
|
|
201
189
|
}
|
|
202
190
|
manager
|
|
@@ -234,34 +222,19 @@ class TreePattern {
|
|
|
234
222
|
this.allItems = inputs.allItems;
|
|
235
223
|
this.focusMode = inputs.focusMode;
|
|
236
224
|
this.disabled = inputs.disabled;
|
|
237
|
-
this.
|
|
225
|
+
this.activeItem = inputs.activeItem;
|
|
238
226
|
this.skipDisabled = inputs.skipDisabled;
|
|
239
227
|
this.wrap = inputs.wrap;
|
|
240
228
|
this.orientation = inputs.orientation;
|
|
241
229
|
this.textDirection = inputs.textDirection;
|
|
242
230
|
this.multi = computed(() => (this.nav() ? false : this.inputs.multi()));
|
|
243
|
-
this.value = inputs.value;
|
|
244
231
|
this.selectionMode = inputs.selectionMode;
|
|
245
232
|
this.typeaheadDelay = inputs.typeaheadDelay;
|
|
246
|
-
this.
|
|
247
|
-
|
|
248
|
-
items: this.visibleItems,
|
|
249
|
-
});
|
|
250
|
-
this.navigationManager = new ListNavigation({
|
|
251
|
-
...inputs,
|
|
252
|
-
wrap: computed(() => this.inputs.wrap() && !this.inSelection()),
|
|
253
|
-
items: this.visibleItems,
|
|
254
|
-
focusManager: this.focusManager,
|
|
255
|
-
});
|
|
256
|
-
this.selectionManager = new ListSelection({
|
|
257
|
-
...inputs,
|
|
258
|
-
items: this.visibleItems,
|
|
259
|
-
focusManager: this.focusManager,
|
|
260
|
-
});
|
|
261
|
-
this.typeaheadManager = new ListTypeahead({
|
|
233
|
+
this.value = inputs.value;
|
|
234
|
+
this.listBehavior = new List({
|
|
262
235
|
...inputs,
|
|
263
236
|
items: this.visibleItems,
|
|
264
|
-
|
|
237
|
+
multi: this.multi,
|
|
265
238
|
});
|
|
266
239
|
this.expansionManager = new ListExpansion({
|
|
267
240
|
multiExpandable: () => true,
|
|
@@ -278,22 +251,22 @@ class TreePattern {
|
|
|
278
251
|
* Otherwise, sets focus to the first focusable tree item.
|
|
279
252
|
*/
|
|
280
253
|
setDefaultState() {
|
|
281
|
-
let
|
|
282
|
-
for (const
|
|
254
|
+
let firstItem;
|
|
255
|
+
for (const item of this.allItems()) {
|
|
283
256
|
if (!item.visible())
|
|
284
257
|
continue;
|
|
285
|
-
if (!this.
|
|
258
|
+
if (!this.listBehavior.isFocusable(item))
|
|
286
259
|
continue;
|
|
287
|
-
if (
|
|
288
|
-
|
|
260
|
+
if (firstItem === undefined) {
|
|
261
|
+
firstItem = item;
|
|
289
262
|
}
|
|
290
263
|
if (item.selected()) {
|
|
291
|
-
this.
|
|
264
|
+
this.activeItem.set(item);
|
|
292
265
|
return;
|
|
293
266
|
}
|
|
294
267
|
}
|
|
295
|
-
if (
|
|
296
|
-
this.
|
|
268
|
+
if (firstItem !== undefined) {
|
|
269
|
+
this.activeItem.set(firstItem);
|
|
297
270
|
}
|
|
298
271
|
}
|
|
299
272
|
/** Handles keydown events on the tree. */
|
|
@@ -308,36 +281,18 @@ class TreePattern {
|
|
|
308
281
|
this.pointerdown().handle(event);
|
|
309
282
|
}
|
|
310
283
|
}
|
|
311
|
-
/** Navigates to the first visible tree item in the tree. */
|
|
312
|
-
first(opts) {
|
|
313
|
-
this._navigate(opts, () => this.navigationManager.first());
|
|
314
|
-
}
|
|
315
|
-
/** Navigates to the last visible tree item in the tree. */
|
|
316
|
-
last(opts) {
|
|
317
|
-
this._navigate(opts, () => this.navigationManager.last());
|
|
318
|
-
}
|
|
319
|
-
/** Navigates to the next visible tree item in the tree. */
|
|
320
|
-
next(opts) {
|
|
321
|
-
this._navigate(opts, () => this.navigationManager.next());
|
|
322
|
-
}
|
|
323
|
-
/** Navigates to the previous visible tree item in the tree. */
|
|
324
|
-
prev(opts) {
|
|
325
|
-
this._navigate(opts, () => this.navigationManager.prev());
|
|
326
|
-
}
|
|
327
284
|
/** Navigates to the given tree item in the tree. */
|
|
328
|
-
goto(
|
|
329
|
-
const item = this._getItem(
|
|
330
|
-
|
|
285
|
+
goto(e, opts) {
|
|
286
|
+
const item = this._getItem(e);
|
|
287
|
+
if (!item)
|
|
288
|
+
return;
|
|
289
|
+
this.listBehavior.goto(item, opts);
|
|
331
290
|
this.toggleExpansion(item);
|
|
332
291
|
}
|
|
333
|
-
/** Handles typeahead search navigation for the tree. */
|
|
334
|
-
search(char, opts) {
|
|
335
|
-
this._navigate(opts, () => this.typeaheadManager.search(char));
|
|
336
|
-
}
|
|
337
292
|
/** Toggles to expand or collapse a tree item. */
|
|
338
293
|
toggleExpansion(item) {
|
|
339
|
-
item ??= this.
|
|
340
|
-
if (!item || !this.
|
|
294
|
+
item ??= this.activeItem();
|
|
295
|
+
if (!item || !this.listBehavior.isFocusable(item))
|
|
341
296
|
return;
|
|
342
297
|
if (!item.expandable())
|
|
343
298
|
return;
|
|
@@ -350,67 +305,40 @@ class TreePattern {
|
|
|
350
305
|
}
|
|
351
306
|
/** Expands a tree item. */
|
|
352
307
|
expand(item) {
|
|
353
|
-
item ??= this.
|
|
354
|
-
if (!item || !this.
|
|
308
|
+
item ??= this.activeItem();
|
|
309
|
+
if (!item || !this.listBehavior.isFocusable(item))
|
|
355
310
|
return;
|
|
356
311
|
if (item.expandable() && !item.expanded()) {
|
|
357
312
|
item.expansion.open();
|
|
358
313
|
}
|
|
359
314
|
else if (item.expanded() && item.children().length > 0) {
|
|
360
315
|
const firstChild = item.children()[0];
|
|
361
|
-
if (this.
|
|
362
|
-
this.
|
|
316
|
+
if (this.listBehavior.isFocusable(firstChild)) {
|
|
317
|
+
this.listBehavior.goto(firstChild);
|
|
363
318
|
}
|
|
364
319
|
}
|
|
365
320
|
}
|
|
366
321
|
/** Expands all sibling tree items including itself. */
|
|
367
322
|
expandSiblings(item) {
|
|
368
|
-
item ??= this.
|
|
369
|
-
const siblings = item
|
|
323
|
+
item ??= this.activeItem();
|
|
324
|
+
const siblings = item?.parent()?.children();
|
|
370
325
|
siblings?.forEach(item => this.expand(item));
|
|
371
326
|
}
|
|
372
327
|
/** Collapses a tree item. */
|
|
373
328
|
collapse(item) {
|
|
374
|
-
item ??= this.
|
|
375
|
-
if (!item || !this.
|
|
329
|
+
item ??= this.activeItem();
|
|
330
|
+
if (!item || !this.listBehavior.isFocusable(item))
|
|
376
331
|
return;
|
|
377
332
|
if (item.expandable() && item.expanded()) {
|
|
378
333
|
item.expansion.close();
|
|
379
334
|
}
|
|
380
335
|
else if (item.parent() && item.parent() !== this) {
|
|
381
336
|
const parentItem = item.parent();
|
|
382
|
-
if (parentItem instanceof TreeItemPattern && this.
|
|
383
|
-
this.
|
|
337
|
+
if (parentItem instanceof TreeItemPattern && this.listBehavior.isFocusable(parentItem)) {
|
|
338
|
+
this.listBehavior.goto(parentItem);
|
|
384
339
|
}
|
|
385
340
|
}
|
|
386
341
|
}
|
|
387
|
-
/** Safely performs a navigation operation. */
|
|
388
|
-
_navigate(opts = {}, operation) {
|
|
389
|
-
if (opts?.selectRange) {
|
|
390
|
-
this.inSelection.set(true);
|
|
391
|
-
this.selectionManager.rangeStartIndex.set(this.anchorIndex());
|
|
392
|
-
}
|
|
393
|
-
const moved = operation();
|
|
394
|
-
if (moved) {
|
|
395
|
-
this._updateSelection(opts);
|
|
396
|
-
}
|
|
397
|
-
this.inSelection.set(false);
|
|
398
|
-
}
|
|
399
|
-
/** Handles updating selection for the tree. */
|
|
400
|
-
_updateSelection(opts = { anchor: true }) {
|
|
401
|
-
if (opts.toggle) {
|
|
402
|
-
this.selectionManager.toggle();
|
|
403
|
-
}
|
|
404
|
-
if (opts.selectOne) {
|
|
405
|
-
this.selectionManager.selectOne();
|
|
406
|
-
}
|
|
407
|
-
if (opts.selectRange) {
|
|
408
|
-
this.selectionManager.selectRange();
|
|
409
|
-
}
|
|
410
|
-
if (!opts.anchor) {
|
|
411
|
-
this.anchorItem.set(this.visibleItems()[this.selectionManager.rangeStartIndex()]);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
342
|
/** Retrieves the TreeItemPattern associated with a DOM event, if any. */
|
|
415
343
|
_getItem(event) {
|
|
416
344
|
if (!(event.target instanceof HTMLElement)) {
|
|
@@ -483,7 +411,7 @@ class CdkTree {
|
|
|
483
411
|
pattern = new TreePattern({
|
|
484
412
|
...this,
|
|
485
413
|
allItems: computed(() => [...this._unorderedItems()].sort(sortDirectives).map(item => item.pattern)),
|
|
486
|
-
|
|
414
|
+
activeItem: signal(undefined),
|
|
487
415
|
});
|
|
488
416
|
/** Whether the tree has received focus yet. */
|
|
489
417
|
_hasFocused = signal(false, ...(ngDevMode ? [{ debugName: "_hasFocused" }] : []));
|
|
@@ -517,10 +445,10 @@ class CdkTree {
|
|
|
517
445
|
this._unorderedItems.set(new Set(this._unorderedItems()));
|
|
518
446
|
}
|
|
519
447
|
}
|
|
520
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
521
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.
|
|
448
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTree, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
449
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: CdkTree, isStandalone: true, selector: "[cdkTree]", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, multi: { classPropertyName: "multi", publicName: "multi", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, focusMode: { classPropertyName: "focusMode", publicName: "focusMode", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null }, skipDisabled: { classPropertyName: "skipDisabled", publicName: "skipDisabled", isSignal: true, isRequired: false, transformFunction: null }, typeaheadDelay: { classPropertyName: "typeaheadDelay", publicName: "typeaheadDelay", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, nav: { classPropertyName: "nav", publicName: "nav", isSignal: true, isRequired: false, transformFunction: null }, currentType: { classPropertyName: "currentType", publicName: "currentType", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "tree" }, listeners: { "keydown": "pattern.onKeydown($event)", "pointerdown": "pattern.onPointerdown($event)", "focusin": "onFocus()" }, properties: { "attr.aria-orientation": "pattern.orientation()", "attr.aria-multiselectable": "pattern.multi()", "attr.aria-disabled": "pattern.disabled()", "attr.aria-activedescendant": "pattern.activedescendant()", "tabindex": "pattern.tabindex()" }, classAttribute: "cdk-tree" }, exportAs: ["cdkTree"], ngImport: i0 });
|
|
522
450
|
}
|
|
523
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
451
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTree, decorators: [{
|
|
524
452
|
type: Directive,
|
|
525
453
|
args: [{
|
|
526
454
|
selector: '[cdkTree]',
|
|
@@ -600,10 +528,10 @@ class CdkTreeItem {
|
|
|
600
528
|
this._tree.deregister(this);
|
|
601
529
|
this._parentGroup?.deregister(this);
|
|
602
530
|
}
|
|
603
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
604
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.
|
|
531
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTreeItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
532
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: CdkTreeItem, isStandalone: true, selector: "[cdkTreeItem]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "treeitem" }, properties: { "class.cdk-active": "pattern.active()", "id": "pattern.id()", "attr.aria-expanded": "pattern.expandable() ? pattern.expanded() : null", "attr.aria-selected": "pattern.selected()", "attr.aria-current": "pattern.current()", "attr.aria-disabled": "pattern.disabled()", "attr.aria-level": "pattern.level()", "attr.aria-owns": "group()?.id", "attr.aria-setsize": "pattern.setsize()", "attr.aria-posinset": "pattern.posinset()", "attr.tabindex": "pattern.tabindex()", "attr.inert": "pattern.visible() ? null : true" }, classAttribute: "cdk-treeitem" }, exportAs: ["cdkTreeItem"], ngImport: i0 });
|
|
605
533
|
}
|
|
606
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
534
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTreeItem, decorators: [{
|
|
607
535
|
type: Directive,
|
|
608
536
|
args: [{
|
|
609
537
|
selector: '[cdkTreeItem]',
|
|
@@ -668,10 +596,10 @@ class CdkTreeItemGroup {
|
|
|
668
596
|
this._unorderedItems().delete(child);
|
|
669
597
|
this._unorderedItems.set(new Set(this._unorderedItems()));
|
|
670
598
|
}
|
|
671
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
672
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.
|
|
599
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTreeItemGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
600
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: CdkTreeItemGroup, isStandalone: true, selector: "[cdkTreeItemGroup]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "id": "id", "attr.inert": "visible() ? null : true" }, classAttribute: "cdk-treeitem-group" }, exportAs: ["cdkTreeItemGroup"], hostDirectives: [{ directive: i1.DeferredContentAware, inputs: ["preserveContent", "preserveContent"] }], ngImport: i0 });
|
|
673
601
|
}
|
|
674
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
602
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTreeItemGroup, decorators: [{
|
|
675
603
|
type: Directive,
|
|
676
604
|
args: [{
|
|
677
605
|
selector: '[cdkTreeItemGroup]',
|
|
@@ -695,10 +623,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.1",
|
|
|
695
623
|
* for a `CdkTreeItemGroup`. This content can be lazily loaded.
|
|
696
624
|
*/
|
|
697
625
|
class CdkTreeItemGroupContent {
|
|
698
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
699
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.
|
|
626
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTreeItemGroupContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
627
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkTreeItemGroupContent, isStandalone: true, selector: "ng-template[cdkTreeItemGroupContent]", hostDirectives: [{ directive: i1.DeferredContent }], ngImport: i0 });
|
|
700
628
|
}
|
|
701
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
629
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTreeItemGroupContent, decorators: [{
|
|
702
630
|
type: Directive,
|
|
703
631
|
args: [{
|
|
704
632
|
selector: 'ng-template[cdkTreeItemGroupContent]',
|