@angular/aria 21.0.0-next.8 → 21.0.0-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/aria.mjs +1 -1
- package/fesm2022/aria.mjs.map +1 -1
- package/fesm2022/deferred-content.mjs +4 -3
- package/fesm2022/deferred-content.mjs.map +1 -1
- package/fesm2022/tree.mjs +17 -60
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +2 -2
- package/types/deferred-content.d.ts +1 -0
- package/types/tree.d.ts +10 -28
package/fesm2022/aria.mjs
CHANGED
package/fesm2022/aria.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aria.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/aria/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the CDK Experimental package. */\nexport const VERSION = new Version('21.0.0-next.
|
|
1
|
+
{"version":3,"file":"aria.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/aria/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the CDK Experimental package. */\nexport const VERSION = new Version('21.0.0-next.9');\n"],"names":[],"mappings":";;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;;;"}
|
|
@@ -29,20 +29,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2",
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
class DeferredContent {
|
|
32
|
-
_deferredContentAware = inject(DeferredContentAware);
|
|
32
|
+
_deferredContentAware = inject(DeferredContentAware, { optional: true });
|
|
33
33
|
_templateRef = inject(TemplateRef);
|
|
34
34
|
_viewContainerRef = inject(ViewContainerRef);
|
|
35
35
|
_isRendered = false;
|
|
36
|
+
deferredContentAware = signal(this._deferredContentAware, ...(ngDevMode ? [{ debugName: "deferredContentAware" }] : []));
|
|
36
37
|
constructor() {
|
|
37
38
|
afterRenderEffect(() => {
|
|
38
|
-
if (this.
|
|
39
|
+
if (this.deferredContentAware()?.contentVisible()) {
|
|
39
40
|
if (this._isRendered)
|
|
40
41
|
return;
|
|
41
42
|
this._viewContainerRef.clear();
|
|
42
43
|
this._viewContainerRef.createEmbeddedView(this._templateRef);
|
|
43
44
|
this._isRendered = true;
|
|
44
45
|
}
|
|
45
|
-
else if (!this.
|
|
46
|
+
else if (!this.deferredContentAware()?.preserveContent()) {
|
|
46
47
|
this._viewContainerRef.clear();
|
|
47
48
|
this._isRendered = false;
|
|
48
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deferred-content.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/aria/deferred-content/deferred-content.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n afterRenderEffect,\n Directive,\n inject,\n TemplateRef,\n signal,\n ViewContainerRef,\n model,\n} from '@angular/core';\n\n/**\n * A container directive controls the visibility of its content.\n */\n@Directive()\nexport class DeferredContentAware {\n readonly contentVisible = signal(false);\n readonly preserveContent = model(false);\n}\n\n/**\n * DeferredContent loads/unloads the content based on the visibility.\n * The visibilty signal is sent from a parent directive implements\n * DeferredContentAware.\n *\n * Use this directive as a host directive. For example:\n *\n * ```ts\n * @Directive({\n * selector: 'ng-template[AccordionContent]',\n * hostDirectives: [DeferredContent],\n * })\n * class AccordionContent {}\n * ```\n */\n@Directive()\nexport class DeferredContent {\n private readonly _deferredContentAware = inject(DeferredContentAware);\n private readonly _templateRef = inject(TemplateRef);\n private readonly _viewContainerRef = inject(ViewContainerRef);\n private _isRendered = false;\n\n constructor() {\n afterRenderEffect(() => {\n if (this.
|
|
1
|
+
{"version":3,"file":"deferred-content.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/aria/deferred-content/deferred-content.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n afterRenderEffect,\n Directive,\n inject,\n TemplateRef,\n signal,\n ViewContainerRef,\n model,\n} from '@angular/core';\n\n/**\n * A container directive controls the visibility of its content.\n */\n@Directive()\nexport class DeferredContentAware {\n readonly contentVisible = signal(false);\n readonly preserveContent = model(false);\n}\n\n/**\n * DeferredContent loads/unloads the content based on the visibility.\n * The visibilty signal is sent from a parent directive implements\n * DeferredContentAware.\n *\n * Use this directive as a host directive. For example:\n *\n * ```ts\n * @Directive({\n * selector: 'ng-template[AccordionContent]',\n * hostDirectives: [DeferredContent],\n * })\n * class AccordionContent {}\n * ```\n */\n@Directive()\nexport class DeferredContent {\n private readonly _deferredContentAware = inject(DeferredContentAware, {optional: true});\n private readonly _templateRef = inject(TemplateRef);\n private readonly _viewContainerRef = inject(ViewContainerRef);\n private _isRendered = false;\n\n readonly deferredContentAware = signal(this._deferredContentAware);\n\n constructor() {\n afterRenderEffect(() => {\n if (this.deferredContentAware()?.contentVisible()) {\n if (this._isRendered) return;\n this._viewContainerRef.clear();\n this._viewContainerRef.createEmbeddedView(this._templateRef);\n this._isRendered = true;\n } else if (!this.deferredContentAware()?.preserveContent()) {\n this._viewContainerRef.clear();\n this._isRendered = false;\n }\n });\n }\n}\n"],"names":[],"mappings":";;;AAkBA;;AAEG;MAEU,oBAAoB,CAAA;AACtB,IAAA,cAAc,GAAG,MAAM,CAAC,KAAK,0DAAC;AAC9B,IAAA,eAAe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,KAAK,EAAE;AAC9B,gBAAA,IAAI,CAAC,WAAW,GAAG,KAAK;;AAE5B,SAAC,CAAC;;8GAnBO,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;kGAAf,eAAe,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;kGAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B;;;;;"}
|
package/fesm2022/tree.mjs
CHANGED
|
@@ -151,15 +151,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2",
|
|
|
151
151
|
/**
|
|
152
152
|
* A selectable and expandable Tree Item in a Tree.
|
|
153
153
|
*/
|
|
154
|
-
class TreeItem {
|
|
154
|
+
class TreeItem extends DeferredContentAware {
|
|
155
155
|
/** A reference to the tree item element. */
|
|
156
156
|
_elementRef = inject(ElementRef);
|
|
157
157
|
/** A unique identifier for the tree item. */
|
|
158
158
|
_id = inject(_IdGenerator).getId('ng-tree-item-');
|
|
159
159
|
/** The owned tree item group. */
|
|
160
160
|
_group = signal(undefined, ...(ngDevMode ? [{ debugName: "_group" }] : []));
|
|
161
|
-
/** The id of the owned group. */
|
|
162
|
-
ownsId = computed(() => this._group()?.id, ...(ngDevMode ? [{ debugName: "ownsId" }] : []));
|
|
163
161
|
/** The host native element. */
|
|
164
162
|
element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{ debugName: "element" }] : []));
|
|
165
163
|
/** The value of the tree item. */
|
|
@@ -182,9 +180,13 @@ class TreeItem {
|
|
|
182
180
|
/** The UI pattern for this item. */
|
|
183
181
|
pattern;
|
|
184
182
|
constructor() {
|
|
185
|
-
|
|
183
|
+
super();
|
|
184
|
+
this.preserveContent.set(true);
|
|
185
|
+
// Connect the group's hidden state to the DeferredContentAware's visibility.
|
|
186
186
|
afterRenderEffect(() => {
|
|
187
|
-
this.
|
|
187
|
+
this.tree().pattern instanceof ComboboxTreePattern
|
|
188
|
+
? this.contentVisible.set(true)
|
|
189
|
+
: this.contentVisible.set(this.pattern.expanded());
|
|
188
190
|
});
|
|
189
191
|
}
|
|
190
192
|
ngOnInit() {
|
|
@@ -202,9 +204,7 @@ class TreeItem {
|
|
|
202
204
|
id: () => this._id,
|
|
203
205
|
tree: treePattern,
|
|
204
206
|
parent: parentPattern,
|
|
205
|
-
children: computed(() => this._group()
|
|
206
|
-
?.children()
|
|
207
|
-
.map(item => item.pattern) ?? []),
|
|
207
|
+
children: computed(() => this._group()?.children() ?? []),
|
|
208
208
|
hasChildren: computed(() => !!this._group()),
|
|
209
209
|
});
|
|
210
210
|
}
|
|
@@ -219,7 +219,7 @@ class TreeItem {
|
|
|
219
219
|
this._group.set(undefined);
|
|
220
220
|
}
|
|
221
221
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: TreeItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
222
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: TreeItem, isStandalone: true, selector: "[ngTreeItem]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, parent: { classPropertyName: "parent", publicName: "parent", 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: { "attr.data-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-
|
|
222
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: TreeItem, isStandalone: true, selector: "[ngTreeItem]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, parent: { classPropertyName: "parent", publicName: "parent", 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: { "attr.data-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-setsize": "pattern.setsize()", "attr.aria-posinset": "pattern.posinset()", "attr.tabindex": "pattern.tabindex()" }, classAttribute: "ng-treeitem" }, exportAs: ["ngTreeItem"], usesInheritance: true, ngImport: i0 });
|
|
223
223
|
}
|
|
224
224
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: TreeItem, decorators: [{
|
|
225
225
|
type: Directive,
|
|
@@ -236,7 +236,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2",
|
|
|
236
236
|
'[attr.aria-current]': 'pattern.current()',
|
|
237
237
|
'[attr.aria-disabled]': 'pattern.disabled()',
|
|
238
238
|
'[attr.aria-level]': 'pattern.level()',
|
|
239
|
-
'[attr.aria-owns]': 'ownsId()',
|
|
240
239
|
'[attr.aria-setsize]': 'pattern.setsize()',
|
|
241
240
|
'[attr.aria-posinset]': 'pattern.posinset()',
|
|
242
241
|
'[attr.tabindex]': 'pattern.tabindex()',
|
|
@@ -244,35 +243,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2",
|
|
|
244
243
|
}]
|
|
245
244
|
}], ctorParameters: () => [] });
|
|
246
245
|
/**
|
|
247
|
-
*
|
|
246
|
+
* Contains children tree itmes.
|
|
248
247
|
*/
|
|
249
248
|
class TreeItemGroup {
|
|
250
|
-
/**
|
|
251
|
-
|
|
252
|
-
/** The DeferredContentAware host directive. */
|
|
253
|
-
_deferredContentAware = inject(DeferredContentAware);
|
|
249
|
+
/** The DeferredContent host directive. */
|
|
250
|
+
_deferredContent = inject(DeferredContent);
|
|
254
251
|
/** All groupable items that are descendants of the group. */
|
|
255
252
|
_unorderedItems = signal(new Set(), ...(ngDevMode ? [{ debugName: "_unorderedItems" }] : []));
|
|
256
|
-
/** The host native element. */
|
|
257
|
-
element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{ debugName: "element" }] : []));
|
|
258
|
-
/** Unique ID for the group. */
|
|
259
|
-
id = inject(_IdGenerator).getId('ng-tree-group-');
|
|
260
|
-
/** Whether the group is visible. */
|
|
261
|
-
visible = signal(true, ...(ngDevMode ? [{ debugName: "visible" }] : []));
|
|
262
253
|
/** Child items within this group. */
|
|
263
|
-
children = computed(() => [...this._unorderedItems()].sort(sortDirectives), ...(ngDevMode ? [{ debugName: "children" }] : []));
|
|
254
|
+
children = computed(() => [...this._unorderedItems()].sort(sortDirectives).map(c => c.pattern), ...(ngDevMode ? [{ debugName: "children" }] : []));
|
|
264
255
|
/** Tree item that owns the group. */
|
|
265
256
|
ownedBy = input.required(...(ngDevMode ? [{ debugName: "ownedBy" }] : []));
|
|
266
|
-
constructor() {
|
|
267
|
-
this._deferredContentAware.preserveContent.set(true);
|
|
268
|
-
// Connect the group's hidden state to the DeferredContentAware's visibility.
|
|
269
|
-
afterRenderEffect(() => {
|
|
270
|
-
this.ownedBy().tree().pattern instanceof ComboboxTreePattern
|
|
271
|
-
? this._deferredContentAware.contentVisible.set(true)
|
|
272
|
-
: this._deferredContentAware.contentVisible.set(this.visible());
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
257
|
ngOnInit() {
|
|
258
|
+
this._deferredContent.deferredContentAware.set(this.ownedBy());
|
|
276
259
|
this.ownedBy().register(this);
|
|
277
260
|
}
|
|
278
261
|
ngOnDestroy() {
|
|
@@ -287,42 +270,16 @@ class TreeItemGroup {
|
|
|
287
270
|
this._unorderedItems.set(new Set(this._unorderedItems()));
|
|
288
271
|
}
|
|
289
272
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: TreeItemGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
290
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: TreeItemGroup, isStandalone: true, selector: "[ngTreeItemGroup]", inputs: { ownedBy: { classPropertyName: "ownedBy", publicName: "ownedBy", isSignal: true, isRequired: true, transformFunction: null } },
|
|
273
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: TreeItemGroup, isStandalone: true, selector: "ng-template[ngTreeItemGroup]", inputs: { ownedBy: { classPropertyName: "ownedBy", publicName: "ownedBy", isSignal: true, isRequired: true, transformFunction: null } }, exportAs: ["ngTreeItemGroup"], hostDirectives: [{ directive: i1.DeferredContent }], ngImport: i0 });
|
|
291
274
|
}
|
|
292
275
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: TreeItemGroup, decorators: [{
|
|
293
276
|
type: Directive,
|
|
294
277
|
args: [{
|
|
295
|
-
selector: '[ngTreeItemGroup]',
|
|
278
|
+
selector: 'ng-template[ngTreeItemGroup]',
|
|
296
279
|
exportAs: 'ngTreeItemGroup',
|
|
297
|
-
hostDirectives: [
|
|
298
|
-
{
|
|
299
|
-
directive: DeferredContentAware,
|
|
300
|
-
inputs: ['preserveContent'],
|
|
301
|
-
},
|
|
302
|
-
],
|
|
303
|
-
host: {
|
|
304
|
-
'class': 'ng-treeitem-group',
|
|
305
|
-
'role': 'group',
|
|
306
|
-
'[id]': 'id',
|
|
307
|
-
'[attr.inert]': 'visible() ? null : true',
|
|
308
|
-
},
|
|
309
|
-
}]
|
|
310
|
-
}], ctorParameters: () => [] });
|
|
311
|
-
/**
|
|
312
|
-
* A structural directive that marks the `ng-template` to be used as the content
|
|
313
|
-
* for a `TreeItemGroup`. This content can be lazily loaded.
|
|
314
|
-
*/
|
|
315
|
-
class TreeItemGroupContent {
|
|
316
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: TreeItemGroupContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
317
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: TreeItemGroupContent, isStandalone: true, selector: "ng-template[ngTreeItemGroupContent]", hostDirectives: [{ directive: i1.DeferredContent }], ngImport: i0 });
|
|
318
|
-
}
|
|
319
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: TreeItemGroupContent, decorators: [{
|
|
320
|
-
type: Directive,
|
|
321
|
-
args: [{
|
|
322
|
-
selector: 'ng-template[ngTreeItemGroupContent]',
|
|
323
280
|
hostDirectives: [DeferredContent],
|
|
324
281
|
}]
|
|
325
282
|
}] });
|
|
326
283
|
|
|
327
|
-
export { Tree, TreeItem, TreeItemGroup
|
|
284
|
+
export { Tree, TreeItem, TreeItemGroup };
|
|
328
285
|
//# sourceMappingURL=tree.mjs.map
|
package/fesm2022/tree.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/aria/tree/tree.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n Directive,\n ElementRef,\n afterRenderEffect,\n booleanAttribute,\n computed,\n inject,\n input,\n model,\n signal,\n Signal,\n OnInit,\n OnDestroy,\n untracked,\n} from '@angular/core';\nimport {_IdGenerator} from '@angular/cdk/a11y';\nimport {Directionality} from '@angular/cdk/bidi';\nimport {DeferredContent, DeferredContentAware} from '@angular/aria/deferred-content';\nimport {ComboboxTreePattern, TreeItemPattern, TreePattern} from '@angular/aria/ui-patterns';\nimport {ComboboxPopup} from '../combobox';\n\ninterface HasElement {\n element: Signal<HTMLElement>;\n}\n\n/**\n * Sort directives by their document order.\n */\nfunction sortDirectives(a: HasElement, b: HasElement) {\n return (a.element().compareDocumentPosition(b.element()) & Node.DOCUMENT_POSITION_PRECEDING) > 0\n ? 1\n : -1;\n}\n\n/**\n * A Tree container.\n *\n * Transforms nested lists into an accessible, ARIA-compliant tree structure.\n *\n * ```html\n * <ul ngTree [(value)]=\"selectedItems\" [multi]=\"true\">\n * <li ngTreeItem [value]=\"'leaf1'\">Leaf Item 1</li>\n * <li ngTreeItem [value]=\"'parent1'\">\n * Parent Item 1\n * <ul ngTreeItemGroup [value]=\"'parent1'\">\n * <ng-template ngTreeItemGroupContent>\n * <li ngTreeItem [value]=\"'child1.1'\">Child Item 1.1</li>\n * <li ngTreeItem [value]=\"'child1.2'\">Child Item 1.2</li>\n * </ng-template>\n * </ul>\n * </li>\n * <li ngTreeItem [value]=\"'leaf2'\" [disabled]=\"true\">Disabled Leaf Item 2</li>\n * </ul>\n * ```\n */\n@Directive({\n selector: '[ngTree]',\n exportAs: 'ngTree',\n host: {\n 'class': 'ng-tree',\n 'role': 'tree',\n '[attr.id]': 'id()',\n '[attr.aria-orientation]': 'pattern.orientation()',\n '[attr.aria-multiselectable]': 'pattern.multi()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n '[attr.aria-activedescendant]': 'pattern.activedescendant()',\n '[tabindex]': 'pattern.tabindex()',\n '(keydown)': 'pattern.onKeydown($event)',\n '(pointerdown)': 'pattern.onPointerdown($event)',\n '(focusin)': 'onFocus()',\n },\n hostDirectives: [{directive: ComboboxPopup}],\n})\nexport class Tree<V> {\n /** A unique identifier for the tree. */\n private readonly _generatedId = inject(_IdGenerator).getId('ng-tree-');\n\n // TODO(wagnermaciel): https://github.com/angular/components/pull/30495#discussion_r1972601144.\n /** A unique identifier for the tree. */\n protected id = computed(() => this._generatedId);\n\n /** A reference to the parent combobox popup, if one exists. */\n private readonly _popup = inject<ComboboxPopup<V>>(ComboboxPopup, {\n optional: true,\n });\n\n /** A reference to the tree element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** All TreeItem instances within this tree. */\n private readonly _unorderedItems = signal(new Set<TreeItem<V>>());\n\n /** Orientation of the tree. */\n readonly orientation = input<'vertical' | 'horizontal'>('vertical');\n\n /** Whether multi-selection is allowed. */\n readonly multi = input(false, {transform: booleanAttribute});\n\n /** Whether the tree is disabled. */\n readonly disabled = input(false, {transform: booleanAttribute});\n\n /** The selection strategy used by the tree. */\n readonly selectionMode = input<'explicit' | 'follow'>('explicit');\n\n /** The focus strategy used by the tree. */\n readonly focusMode = input<'roving' | 'activedescendant'>('roving');\n\n /** Whether navigation wraps. */\n readonly wrap = input(true, {transform: booleanAttribute});\n\n /** Whether to skip disabled items during navigation. */\n readonly skipDisabled = input(true, {transform: booleanAttribute});\n\n /** Typeahead delay. */\n readonly typeaheadDelay = input(0.5);\n\n /** Selected item values. */\n readonly value = model<V[]>([]);\n\n /** Text direction. */\n readonly textDirection = inject(Directionality).valueSignal;\n\n /** Whether the tree is in navigation mode. */\n readonly nav = input(false);\n\n /** The aria-current type. */\n readonly currentType = input<'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false'>(\n 'page',\n );\n\n /** The UI pattern for the tree. */\n readonly pattern: TreePattern<V>;\n\n /** Whether the tree has received focus yet. */\n private _hasFocused = signal(false);\n\n constructor() {\n const inputs = {\n ...this,\n id: this.id,\n allItems: computed(() =>\n [...this._unorderedItems()].sort(sortDirectives).map(item => item.pattern),\n ),\n activeItem: signal<TreeItemPattern<V> | undefined>(undefined),\n element: () => this._elementRef.nativeElement,\n combobox: () => this._popup?.combobox?.pattern,\n };\n\n this.pattern = this._popup?.combobox\n ? new ComboboxTreePattern<V>(inputs)\n : new TreePattern<V>(inputs);\n\n if (this._popup?.combobox) {\n this._popup?.controls?.set(this.pattern as ComboboxTreePattern<V>);\n }\n\n afterRenderEffect(() => {\n if (!this._hasFocused()) {\n this.pattern.setDefaultState();\n }\n });\n\n afterRenderEffect(() => {\n const items = inputs.allItems();\n const activeItem = untracked(() => inputs.activeItem());\n\n if (!items.some(i => i === activeItem) && activeItem) {\n this.pattern.listBehavior.unfocus();\n }\n });\n\n afterRenderEffect(() => {\n const items = inputs.allItems();\n const value = untracked(() => this.value());\n\n if (items && value.some(v => !items.some(i => i.value() === v))) {\n this.value.set(value.filter(v => items.some(i => i.value() === v)));\n }\n });\n }\n\n onFocus() {\n this._hasFocused.set(true);\n }\n\n register(child: TreeItem<V>) {\n this._unorderedItems().add(child);\n this._unorderedItems.set(new Set(this._unorderedItems()));\n }\n\n unregister(child: TreeItem<V>) {\n this._unorderedItems().delete(child);\n this._unorderedItems.set(new Set(this._unorderedItems()));\n }\n}\n\n/**\n * A selectable and expandable Tree Item in a Tree.\n */\n@Directive({\n selector: '[ngTreeItem]',\n exportAs: 'ngTreeItem',\n host: {\n 'class': 'ng-treeitem',\n '[attr.data-active]': 'pattern.active()',\n 'role': 'treeitem',\n '[id]': 'pattern.id()',\n '[attr.aria-expanded]': 'pattern.expandable() ? pattern.expanded() : null',\n '[attr.aria-selected]': 'pattern.selected()',\n '[attr.aria-current]': 'pattern.current()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n '[attr.aria-level]': 'pattern.level()',\n '[attr.aria-owns]': 'ownsId()',\n '[attr.aria-setsize]': 'pattern.setsize()',\n '[attr.aria-posinset]': 'pattern.posinset()',\n '[attr.tabindex]': 'pattern.tabindex()',\n },\n})\nexport class TreeItem<V> implements OnInit, OnDestroy, HasElement {\n /** A reference to the tree item element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** A unique identifier for the tree item. */\n private readonly _id = inject(_IdGenerator).getId('ng-tree-item-');\n\n /** The owned tree item group. */\n private readonly _group = signal<TreeItemGroup<V> | undefined>(undefined);\n\n /** The id of the owned group. */\n readonly ownsId = computed(() => this._group()?.id);\n\n /** The host native element. */\n readonly element = computed(() => this._elementRef.nativeElement);\n\n /** The value of the tree item. */\n readonly value = input.required<V>();\n\n /** The parent tree root or tree item group. */\n readonly parent = input.required<Tree<V> | TreeItemGroup<V>>();\n\n /** Whether the tree item is disabled. */\n readonly disabled = input(false, {transform: booleanAttribute});\n\n /** Optional label for typeahead. Defaults to the element's textContent. */\n readonly label = input<string>();\n\n /** Search term for typeahead. */\n readonly searchTerm = computed(() => this.label() ?? this.element().textContent);\n\n /** The tree root. */\n readonly tree: Signal<Tree<V>> = computed(() => {\n if (this.parent() instanceof Tree) {\n return this.parent() as Tree<V>;\n }\n return (this.parent() as TreeItemGroup<V>).ownedBy().tree();\n });\n\n /** The UI pattern for this item. */\n pattern: TreeItemPattern<V>;\n\n constructor() {\n // Updates the visibility of the owned group.\n afterRenderEffect(() => {\n this._group()?.visible.set(this.pattern.expanded());\n });\n }\n\n ngOnInit() {\n this.parent().register(this);\n this.tree().register(this);\n\n const treePattern = computed(() => this.tree().pattern);\n const parentPattern = computed(() => {\n if (this.parent() instanceof Tree) {\n return treePattern();\n }\n return (this.parent() as TreeItemGroup<V>).ownedBy().pattern;\n });\n this.pattern = new TreeItemPattern<V>({\n ...this,\n id: () => this._id,\n tree: treePattern,\n parent: parentPattern,\n children: computed(\n () =>\n this._group()\n ?.children()\n .map(item => (item as TreeItem<V>).pattern) ?? [],\n ),\n hasChildren: computed(() => !!this._group()),\n });\n }\n\n ngOnDestroy() {\n this.parent().unregister(this);\n this.tree().unregister(this);\n }\n\n register(group: TreeItemGroup<V>) {\n this._group.set(group);\n }\n\n unregister() {\n this._group.set(undefined);\n }\n}\n\n/**\n * Container that designates content as a group.\n */\n@Directive({\n selector: '[ngTreeItemGroup]',\n exportAs: 'ngTreeItemGroup',\n hostDirectives: [\n {\n directive: DeferredContentAware,\n inputs: ['preserveContent'],\n },\n ],\n host: {\n 'class': 'ng-treeitem-group',\n 'role': 'group',\n '[id]': 'id',\n '[attr.inert]': 'visible() ? null : true',\n },\n})\nexport class TreeItemGroup<V> implements OnInit, OnDestroy, HasElement {\n /** A reference to the group element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The DeferredContentAware host directive. */\n private readonly _deferredContentAware = inject(DeferredContentAware);\n\n /** All groupable items that are descendants of the group. */\n private readonly _unorderedItems = signal(new Set<TreeItem<V>>());\n\n /** The host native element. */\n readonly element = computed(() => this._elementRef.nativeElement);\n\n /** Unique ID for the group. */\n readonly id = inject(_IdGenerator).getId('ng-tree-group-');\n\n /** Whether the group is visible. */\n readonly visible = signal(true);\n\n /** Child items within this group. */\n readonly children = computed(() => [...this._unorderedItems()].sort(sortDirectives));\n\n /** Tree item that owns the group. */\n readonly ownedBy = input.required<TreeItem<V>>();\n\n constructor() {\n this._deferredContentAware.preserveContent.set(true);\n // Connect the group's hidden state to the DeferredContentAware's visibility.\n afterRenderEffect(() => {\n this.ownedBy().tree().pattern instanceof ComboboxTreePattern\n ? this._deferredContentAware.contentVisible.set(true)\n : this._deferredContentAware.contentVisible.set(this.visible());\n });\n }\n\n ngOnInit() {\n this.ownedBy().register(this);\n }\n\n ngOnDestroy() {\n this.ownedBy().unregister();\n }\n\n register(child: TreeItem<V>) {\n this._unorderedItems().add(child);\n this._unorderedItems.set(new Set(this._unorderedItems()));\n }\n\n unregister(child: TreeItem<V>) {\n this._unorderedItems().delete(child);\n this._unorderedItems.set(new Set(this._unorderedItems()));\n }\n}\n\n/**\n * A structural directive that marks the `ng-template` to be used as the content\n * for a `TreeItemGroup`. This content can be lazily loaded.\n */\n@Directive({\n selector: 'ng-template[ngTreeItemGroupContent]',\n hostDirectives: [DeferredContent],\n})\nexport class TreeItemGroupContent {}\n"],"names":["i1.ComboboxPopup","i2"],"mappings":";;;;;;;;;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c,EAAE,CAAC,eAAe,CAAC;AAClC,iBAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"tree.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/aria/tree/tree.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n Directive,\n ElementRef,\n afterRenderEffect,\n booleanAttribute,\n computed,\n inject,\n input,\n model,\n signal,\n Signal,\n OnInit,\n OnDestroy,\n untracked,\n} from '@angular/core';\nimport {_IdGenerator} from '@angular/cdk/a11y';\nimport {Directionality} from '@angular/cdk/bidi';\nimport {DeferredContent, DeferredContentAware} from '@angular/aria/deferred-content';\nimport {ComboboxTreePattern, TreeItemPattern, TreePattern} from '@angular/aria/ui-patterns';\nimport {ComboboxPopup} from '../combobox';\n\ninterface HasElement {\n element: Signal<HTMLElement>;\n}\n\n/**\n * Sort directives by their document order.\n */\nfunction sortDirectives(a: HasElement, b: HasElement) {\n return (a.element().compareDocumentPosition(b.element()) & Node.DOCUMENT_POSITION_PRECEDING) > 0\n ? 1\n : -1;\n}\n\n/**\n * A Tree container.\n *\n * Transforms nested lists into an accessible, ARIA-compliant tree structure.\n *\n * ```html\n * <ul ngTree [(value)]=\"selectedItems\" [multi]=\"true\">\n * <li ngTreeItem [value]=\"'leaf1'\">Leaf Item 1</li>\n * <li ngTreeItem [value]=\"'parent1'\">\n * Parent Item 1\n * <ul ngTreeItemGroup [value]=\"'parent1'\">\n * <ng-template ngTreeItemGroupContent>\n * <li ngTreeItem [value]=\"'child1.1'\">Child Item 1.1</li>\n * <li ngTreeItem [value]=\"'child1.2'\">Child Item 1.2</li>\n * </ng-template>\n * </ul>\n * </li>\n * <li ngTreeItem [value]=\"'leaf2'\" [disabled]=\"true\">Disabled Leaf Item 2</li>\n * </ul>\n * ```\n */\n@Directive({\n selector: '[ngTree]',\n exportAs: 'ngTree',\n host: {\n 'class': 'ng-tree',\n 'role': 'tree',\n '[attr.id]': 'id()',\n '[attr.aria-orientation]': 'pattern.orientation()',\n '[attr.aria-multiselectable]': 'pattern.multi()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n '[attr.aria-activedescendant]': 'pattern.activedescendant()',\n '[tabindex]': 'pattern.tabindex()',\n '(keydown)': 'pattern.onKeydown($event)',\n '(pointerdown)': 'pattern.onPointerdown($event)',\n '(focusin)': 'onFocus()',\n },\n hostDirectives: [{directive: ComboboxPopup}],\n})\nexport class Tree<V> {\n /** A unique identifier for the tree. */\n private readonly _generatedId = inject(_IdGenerator).getId('ng-tree-');\n\n // TODO(wagnermaciel): https://github.com/angular/components/pull/30495#discussion_r1972601144.\n /** A unique identifier for the tree. */\n protected id = computed(() => this._generatedId);\n\n /** A reference to the parent combobox popup, if one exists. */\n private readonly _popup = inject<ComboboxPopup<V>>(ComboboxPopup, {\n optional: true,\n });\n\n /** A reference to the tree element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** All TreeItem instances within this tree. */\n private readonly _unorderedItems = signal(new Set<TreeItem<V>>());\n\n /** Orientation of the tree. */\n readonly orientation = input<'vertical' | 'horizontal'>('vertical');\n\n /** Whether multi-selection is allowed. */\n readonly multi = input(false, {transform: booleanAttribute});\n\n /** Whether the tree is disabled. */\n readonly disabled = input(false, {transform: booleanAttribute});\n\n /** The selection strategy used by the tree. */\n readonly selectionMode = input<'explicit' | 'follow'>('explicit');\n\n /** The focus strategy used by the tree. */\n readonly focusMode = input<'roving' | 'activedescendant'>('roving');\n\n /** Whether navigation wraps. */\n readonly wrap = input(true, {transform: booleanAttribute});\n\n /** Whether to skip disabled items during navigation. */\n readonly skipDisabled = input(true, {transform: booleanAttribute});\n\n /** Typeahead delay. */\n readonly typeaheadDelay = input(0.5);\n\n /** Selected item values. */\n readonly value = model<V[]>([]);\n\n /** Text direction. */\n readonly textDirection = inject(Directionality).valueSignal;\n\n /** Whether the tree is in navigation mode. */\n readonly nav = input(false);\n\n /** The aria-current type. */\n readonly currentType = input<'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false'>(\n 'page',\n );\n\n /** The UI pattern for the tree. */\n readonly pattern: TreePattern<V>;\n\n /** Whether the tree has received focus yet. */\n private _hasFocused = signal(false);\n\n constructor() {\n const inputs = {\n ...this,\n id: this.id,\n allItems: computed(() =>\n [...this._unorderedItems()].sort(sortDirectives).map(item => item.pattern),\n ),\n activeItem: signal<TreeItemPattern<V> | undefined>(undefined),\n element: () => this._elementRef.nativeElement,\n combobox: () => this._popup?.combobox?.pattern,\n };\n\n this.pattern = this._popup?.combobox\n ? new ComboboxTreePattern<V>(inputs)\n : new TreePattern<V>(inputs);\n\n if (this._popup?.combobox) {\n this._popup?.controls?.set(this.pattern as ComboboxTreePattern<V>);\n }\n\n afterRenderEffect(() => {\n if (!this._hasFocused()) {\n this.pattern.setDefaultState();\n }\n });\n\n afterRenderEffect(() => {\n const items = inputs.allItems();\n const activeItem = untracked(() => inputs.activeItem());\n\n if (!items.some(i => i === activeItem) && activeItem) {\n this.pattern.listBehavior.unfocus();\n }\n });\n\n afterRenderEffect(() => {\n const items = inputs.allItems();\n const value = untracked(() => this.value());\n\n if (items && value.some(v => !items.some(i => i.value() === v))) {\n this.value.set(value.filter(v => items.some(i => i.value() === v)));\n }\n });\n }\n\n onFocus() {\n this._hasFocused.set(true);\n }\n\n register(child: TreeItem<V>) {\n this._unorderedItems().add(child);\n this._unorderedItems.set(new Set(this._unorderedItems()));\n }\n\n unregister(child: TreeItem<V>) {\n this._unorderedItems().delete(child);\n this._unorderedItems.set(new Set(this._unorderedItems()));\n }\n}\n\n/**\n * A selectable and expandable Tree Item in a Tree.\n */\n@Directive({\n selector: '[ngTreeItem]',\n exportAs: 'ngTreeItem',\n host: {\n 'class': 'ng-treeitem',\n '[attr.data-active]': 'pattern.active()',\n 'role': 'treeitem',\n '[id]': 'pattern.id()',\n '[attr.aria-expanded]': 'pattern.expandable() ? pattern.expanded() : null',\n '[attr.aria-selected]': 'pattern.selected()',\n '[attr.aria-current]': 'pattern.current()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n '[attr.aria-level]': 'pattern.level()',\n '[attr.aria-setsize]': 'pattern.setsize()',\n '[attr.aria-posinset]': 'pattern.posinset()',\n '[attr.tabindex]': 'pattern.tabindex()',\n },\n})\nexport class TreeItem<V> extends DeferredContentAware implements OnInit, OnDestroy, HasElement {\n /** A reference to the tree item element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** A unique identifier for the tree item. */\n private readonly _id = inject(_IdGenerator).getId('ng-tree-item-');\n\n /** The owned tree item group. */\n private readonly _group = signal<TreeItemGroup<V> | undefined>(undefined);\n\n /** The host native element. */\n readonly element = computed(() => this._elementRef.nativeElement);\n\n /** The value of the tree item. */\n readonly value = input.required<V>();\n\n /** The parent tree root or tree item group. */\n readonly parent = input.required<Tree<V> | TreeItemGroup<V>>();\n\n /** Whether the tree item is disabled. */\n readonly disabled = input(false, {transform: booleanAttribute});\n\n /** Optional label for typeahead. Defaults to the element's textContent. */\n readonly label = input<string>();\n\n /** Search term for typeahead. */\n readonly searchTerm = computed(() => this.label() ?? this.element().textContent);\n\n /** The tree root. */\n readonly tree: Signal<Tree<V>> = computed(() => {\n if (this.parent() instanceof Tree) {\n return this.parent() as Tree<V>;\n }\n return (this.parent() as TreeItemGroup<V>).ownedBy().tree();\n });\n\n /** The UI pattern for this item. */\n pattern: TreeItemPattern<V>;\n\n constructor() {\n super();\n this.preserveContent.set(true);\n // Connect the group's hidden state to the DeferredContentAware's visibility.\n afterRenderEffect(() => {\n this.tree().pattern instanceof ComboboxTreePattern\n ? this.contentVisible.set(true)\n : this.contentVisible.set(this.pattern.expanded());\n });\n }\n\n ngOnInit() {\n this.parent().register(this);\n this.tree().register(this);\n\n const treePattern = computed(() => this.tree().pattern);\n const parentPattern = computed(() => {\n if (this.parent() instanceof Tree) {\n return treePattern();\n }\n return (this.parent() as TreeItemGroup<V>).ownedBy().pattern;\n });\n this.pattern = new TreeItemPattern<V>({\n ...this,\n id: () => this._id,\n tree: treePattern,\n parent: parentPattern,\n children: computed(() => this._group()?.children() ?? []),\n hasChildren: computed(() => !!this._group()),\n });\n }\n\n ngOnDestroy() {\n this.parent().unregister(this);\n this.tree().unregister(this);\n }\n\n register(group: TreeItemGroup<V>) {\n this._group.set(group);\n }\n\n unregister() {\n this._group.set(undefined);\n }\n}\n\n/**\n * Contains children tree itmes.\n */\n@Directive({\n selector: 'ng-template[ngTreeItemGroup]',\n exportAs: 'ngTreeItemGroup',\n hostDirectives: [DeferredContent],\n})\nexport class TreeItemGroup<V> implements OnInit, OnDestroy {\n /** The DeferredContent host directive. */\n private readonly _deferredContent = inject(DeferredContent);\n\n /** All groupable items that are descendants of the group. */\n private readonly _unorderedItems = signal(new Set<TreeItem<V>>());\n\n /** Child items within this group. */\n readonly children = computed<TreeItemPattern<V>[]>(() =>\n [...this._unorderedItems()].sort(sortDirectives).map(c => c.pattern),\n );\n\n /** Tree item that owns the group. */\n readonly ownedBy = input.required<TreeItem<V>>();\n\n ngOnInit() {\n this._deferredContent.deferredContentAware.set(this.ownedBy());\n this.ownedBy().register(this);\n }\n\n ngOnDestroy() {\n this.ownedBy().unregister();\n }\n\n register(child: TreeItem<V>) {\n this._unorderedItems().add(child);\n this._unorderedItems.set(new Set(this._unorderedItems()));\n }\n\n unregister(child: TreeItem<V>) {\n this._unorderedItems().delete(child);\n this._unorderedItems.set(new Set(this._unorderedItems()));\n }\n}\n"],"names":["i1.ComboboxPopup","i2"],"mappings":";;;;;;;;;AAiCA;;AAEG;AACH,SAAS,cAAc,CAAC,CAAa,EAAE,CAAa,EAAA;AAClD,IAAA,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,2BAA2B,IAAI;AAC7F,UAAE;UACA,CAAC,CAAC;AACR;AAEA;;;;;;;;;;;;;;;;;;;;AAoBG;MAmBU,I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C,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;;8GA/BhD,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;kGAAb,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,8BAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,iBAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAAC,EAAA,CAAA,eAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;kGAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBALzB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,8BAA8B;AACxC,oBAAA,QAAQ,EAAE,iBAAiB;oBAC3B,cAAc,EAAE,CAAC,eAAe,CAAC;AAClC,iBAAA;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/aria",
|
|
3
|
-
"version": "21.0.0-next.
|
|
3
|
+
"version": "21.0.0-next.9",
|
|
4
4
|
"description": "Angular Aria",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"homepage": "https://github.com/angular/components#readme",
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@angular/cdk": "21.0.0-next.
|
|
15
|
+
"@angular/cdk": "21.0.0-next.9",
|
|
16
16
|
"@angular/core": "^21.0.0-0 || ^21.1.0-0 || ^21.2.0-0 || ^21.3.0-0 || ^22.0.0-0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
@@ -29,6 +29,7 @@ declare class DeferredContent {
|
|
|
29
29
|
private readonly _templateRef;
|
|
30
30
|
private readonly _viewContainerRef;
|
|
31
31
|
private _isRendered;
|
|
32
|
+
readonly deferredContentAware: _angular_core.WritableSignal<DeferredContentAware | null>;
|
|
32
33
|
constructor();
|
|
33
34
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DeferredContent, never>;
|
|
34
35
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DeferredContent, never, never, {}, {}, never, never, true, never>;
|
package/types/tree.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as _angular_cdk_bidi from '@angular/cdk/bidi';
|
|
2
2
|
import * as _angular_core from '@angular/core';
|
|
3
3
|
import { Signal, OnInit, OnDestroy } from '@angular/core';
|
|
4
|
+
import * as i1 from '@angular/aria/deferred-content';
|
|
5
|
+
import { DeferredContentAware } from '@angular/aria/deferred-content';
|
|
4
6
|
import { TreePattern, TreeItemPattern } from '@angular/aria/ui-patterns';
|
|
5
7
|
import { ComboboxPopup } from './combobox.js';
|
|
6
|
-
import * as i1 from '@angular/aria/deferred-content';
|
|
7
8
|
|
|
8
9
|
interface HasElement {
|
|
9
10
|
element: Signal<HTMLElement>;
|
|
@@ -78,15 +79,13 @@ declare class Tree<V> {
|
|
|
78
79
|
/**
|
|
79
80
|
* A selectable and expandable Tree Item in a Tree.
|
|
80
81
|
*/
|
|
81
|
-
declare class TreeItem<V> implements OnInit, OnDestroy, HasElement {
|
|
82
|
+
declare class TreeItem<V> extends DeferredContentAware implements OnInit, OnDestroy, HasElement {
|
|
82
83
|
/** A reference to the tree item element. */
|
|
83
84
|
private readonly _elementRef;
|
|
84
85
|
/** A unique identifier for the tree item. */
|
|
85
86
|
private readonly _id;
|
|
86
87
|
/** The owned tree item group. */
|
|
87
88
|
private readonly _group;
|
|
88
|
-
/** The id of the owned group. */
|
|
89
|
-
readonly ownsId: Signal<string | undefined>;
|
|
90
89
|
/** The host native element. */
|
|
91
90
|
readonly element: Signal<any>;
|
|
92
91
|
/** The value of the tree item. */
|
|
@@ -112,40 +111,23 @@ declare class TreeItem<V> implements OnInit, OnDestroy, HasElement {
|
|
|
112
111
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TreeItem<any>, "[ngTreeItem]", ["ngTreeItem"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; "parent": { "alias": "parent"; "required": true; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
113
112
|
}
|
|
114
113
|
/**
|
|
115
|
-
*
|
|
114
|
+
* Contains children tree itmes.
|
|
116
115
|
*/
|
|
117
|
-
declare class TreeItemGroup<V> implements OnInit, OnDestroy
|
|
118
|
-
/**
|
|
119
|
-
private readonly
|
|
120
|
-
/** The DeferredContentAware host directive. */
|
|
121
|
-
private readonly _deferredContentAware;
|
|
116
|
+
declare class TreeItemGroup<V> implements OnInit, OnDestroy {
|
|
117
|
+
/** The DeferredContent host directive. */
|
|
118
|
+
private readonly _deferredContent;
|
|
122
119
|
/** All groupable items that are descendants of the group. */
|
|
123
120
|
private readonly _unorderedItems;
|
|
124
|
-
/** The host native element. */
|
|
125
|
-
readonly element: Signal<any>;
|
|
126
|
-
/** Unique ID for the group. */
|
|
127
|
-
readonly id: string;
|
|
128
|
-
/** Whether the group is visible. */
|
|
129
|
-
readonly visible: _angular_core.WritableSignal<boolean>;
|
|
130
121
|
/** Child items within this group. */
|
|
131
|
-
readonly children: Signal<
|
|
122
|
+
readonly children: Signal<TreeItemPattern<V>[]>;
|
|
132
123
|
/** Tree item that owns the group. */
|
|
133
124
|
readonly ownedBy: _angular_core.InputSignal<TreeItem<V>>;
|
|
134
|
-
constructor();
|
|
135
125
|
ngOnInit(): void;
|
|
136
126
|
ngOnDestroy(): void;
|
|
137
127
|
register(child: TreeItem<V>): void;
|
|
138
128
|
unregister(child: TreeItem<V>): void;
|
|
139
129
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TreeItemGroup<any>, never>;
|
|
140
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TreeItemGroup<any>, "[ngTreeItemGroup]", ["ngTreeItemGroup"], { "ownedBy": { "alias": "ownedBy"; "required": true; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* A structural directive that marks the `ng-template` to be used as the content
|
|
144
|
-
* for a `TreeItemGroup`. This content can be lazily loaded.
|
|
145
|
-
*/
|
|
146
|
-
declare class TreeItemGroupContent {
|
|
147
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TreeItemGroupContent, never>;
|
|
148
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TreeItemGroupContent, "ng-template[ngTreeItemGroupContent]", never, {}, {}, never, never, true, [{ directive: typeof i1.DeferredContent; inputs: {}; outputs: {}; }]>;
|
|
130
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TreeItemGroup<any>, "ng-template[ngTreeItemGroup]", ["ngTreeItemGroup"], { "ownedBy": { "alias": "ownedBy"; "required": true; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.DeferredContent; inputs: {}; outputs: {}; }]>;
|
|
149
131
|
}
|
|
150
132
|
|
|
151
|
-
export { Tree, TreeItem, TreeItemGroup
|
|
133
|
+
export { Tree, TreeItem, TreeItemGroup };
|