@qualcomm-ui/angular 1.7.1 → 1.8.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.
@@ -1,4 +1,718 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, input, computed, Directive, inject, TemplateRef, Component, Injector, contentChild, NgModule } from '@angular/core';
3
+ import * as i2 from '@qualcomm-ui/angular-core/machine';
4
+ import { BaseApiContextService, createApiContext, useTrackBindings, useMachine, normalizeProps, ApiContextDirective, QBindDirective } from '@qualcomm-ui/angular-core/machine';
5
+ import { useCollapsibleContext, CollapsibleContextService, provideCollapsibleContext } from '@qualcomm-ui/angular-core/collapsible';
6
+ import { useId } from '@qualcomm-ui/angular-core/common';
7
+ import { CoreTreeBranchContentDirective, CoreTreeBranchIndentGuideDirective, CoreTreeBranchNodeDirective, CoreTreeBranchTriggerDirective, CoreTreeBranchDirective, useTreeNodeStateContext, CoreTreeLabelDirective, CoreTreeLeafNodeDirective, CoreTreeNodeActionDirective, CoreTreeNodeCheckboxDirective, TreeNodeStateContextService, CoreTreeNodeIconDirective, CoreTreeNodeIndicatorDirective, CoreTreeNodeTextDirective, useTreeContext, TreeNodePropsContextService, provideTreeNodePropsContext, provideTreeNodeStateContext, CoreTreeRootDirective, provideTreeContext } from '@qualcomm-ui/angular-core/tree';
8
+ import { collapsibleClasses } from '@qualcomm-ui/qds-core/collapsible';
9
+ import { mergeProps } from '@qualcomm-ui/utils/merge-props';
10
+ import { ChevronRight } from 'lucide-angular';
11
+ import '@qualcomm-ui/angular-core/lucide';
12
+ import * as i1 from '@qualcomm-ui/angular/icon';
13
+ import { IconDirective } from '@qualcomm-ui/angular/icon';
14
+ import * as i1$2 from '@angular/common';
15
+ import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
16
+ import { useRenderStrategyContext, provideRenderStrategyContext } from '@qualcomm-ui/angular-core/presence';
17
+ import { collapsibleMachine, createCollapsibleApi } from '@qualcomm-ui/core/collapsible';
18
+ import { useInlineIconButtonApi } from '@qualcomm-ui/angular/inline-icon-button';
19
+ import { createQdsCheckmarkApi } from '@qualcomm-ui/qds-core/checkmark';
20
+ import * as i1$1 from '@qualcomm-ui/angular/checkmark';
21
+ import { CheckmarkIconComponent } from '@qualcomm-ui/angular/checkmark';
22
+ import { createQdsTreeApi } from '@qualcomm-ui/qds-core/tree';
23
+
24
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
25
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
26
+ class QdsTreeContextService extends BaseApiContextService {
27
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: QdsTreeContextService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
28
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: QdsTreeContextService });
29
+ }
30
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: QdsTreeContextService, decorators: [{
31
+ type: Injectable
32
+ }] });
33
+ const [QDS_TREE_CONTEXT, useQdsTreeContext, provideQdsTreeContext,] = createApiContext("QdsTreeContext", QdsTreeContextService);
34
+
35
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
36
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
37
+ class TreeBranchContentDirective extends CoreTreeBranchContentDirective {
38
+ /**
39
+ * HTML {@link https://www.w3schools.com/html/html_id.asp id attribute}. If
40
+ * omitted, a unique identifier will be generated for accessibility.)
41
+ */
42
+ id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : []));
43
+ hostId = computed(() => useId(this, this.id()), ...(ngDevMode ? [{ debugName: "hostId" }] : []));
44
+ qdsContext = useQdsTreeContext();
45
+ collapsibleContext = useCollapsibleContext();
46
+ trackBindings = useTrackBindings(() => mergeProps(this.treeContext().getBranchContentBindings(this.treeNodePropsContext()), this.collapsibleContext().getRootBindings(), this.collapsibleContext().getContentBindings({ id: this.hostId() }), { class: collapsibleClasses.content }, this.qdsContext().getBranchContentBindings()));
47
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeBranchContentDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
48
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.12", type: TreeBranchContentDirective, isStandalone: false, selector: "[q-tree-branch-content]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
49
+ }
50
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeBranchContentDirective, decorators: [{
51
+ type: Directive,
52
+ args: [{
53
+ selector: "[q-tree-branch-content]",
54
+ standalone: false,
55
+ }]
56
+ }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
57
+
58
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
59
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
60
+ class TreeBranchIndentGuideDirective extends CoreTreeBranchIndentGuideDirective {
61
+ qdsContext = useQdsTreeContext();
62
+ constructor() {
63
+ super();
64
+ this.trackBindings.extendWith(computed(() => this.qdsContext().getBranchIndentGuideBindings()));
65
+ }
66
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeBranchIndentGuideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
67
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: TreeBranchIndentGuideDirective, isStandalone: false, selector: "[q-tree-branch-indent-guide]", usesInheritance: true, ngImport: i0 });
68
+ }
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeBranchIndentGuideDirective, decorators: [{
70
+ type: Directive,
71
+ args: [{
72
+ selector: "[q-tree-branch-indent-guide]",
73
+ standalone: false,
74
+ }]
75
+ }], ctorParameters: () => [] });
76
+
77
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
78
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
79
+ class TreeBranchNodeDirective extends CoreTreeBranchNodeDirective {
80
+ qdsContext = useQdsTreeContext();
81
+ constructor() {
82
+ super();
83
+ this.trackBindings.extendWith(computed(() => this.qdsContext().getBranchNodeBindings()));
84
+ }
85
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeBranchNodeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
86
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: TreeBranchNodeDirective, isStandalone: false, selector: "[q-tree-branch-node]", usesInheritance: true, ngImport: i0 });
87
+ }
88
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeBranchNodeDirective, decorators: [{
89
+ type: Directive,
90
+ args: [{
91
+ selector: "[q-tree-branch-node]",
92
+ standalone: false,
93
+ }]
94
+ }], ctorParameters: () => [] });
95
+
96
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
97
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
98
+ /**
99
+ * Structural directive that defines the template used to render leaf nodes in a
100
+ * tree. Apply this to an `ng-template` to customize how branch nodes (nodes with
101
+ * children) are displayed. Note that this template will only customize the content
102
+ * of the node. The parent `<q-tree-nodes>` component renders the branch children
103
+ * internally.
104
+ *
105
+ * @example
106
+ * ```html
107
+ * <ng-template q-tree-branch-template let-node>
108
+ * <div q-tree-branch-node>
109
+ * <span q-tree-node-text>{{ node.item.label }}</span>
110
+ * </div>
111
+ * </ng-template>
112
+ * ```
113
+ */
114
+ class TreeBranchTemplateDirective {
115
+ /**
116
+ * The root node of the tree. Used for type narrowing of the template guard.
117
+ * {@link https://angular.dev/guide/directives/structural-directives#type-narrowing-with-template-guards Learn more}
118
+ */
119
+ rootNode = input(...(ngDevMode ? [undefined, { debugName: "rootNode" }] : []));
120
+ template = inject(TemplateRef);
121
+ static ngTemplateContextGuard(dir, ctx) {
122
+ return true;
123
+ }
124
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeBranchTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
125
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.12", type: TreeBranchTemplateDirective, isStandalone: false, selector: "ng-template[q-tree-branch-template]", inputs: { rootNode: { classPropertyName: "rootNode", publicName: "rootNode", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
126
+ }
127
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeBranchTemplateDirective, decorators: [{
128
+ type: Directive,
129
+ args: [{
130
+ selector: "ng-template[q-tree-branch-template]",
131
+ standalone: false,
132
+ }]
133
+ }], propDecorators: { rootNode: [{ type: i0.Input, args: [{ isSignal: true, alias: "rootNode", required: false }] }] } });
134
+
135
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
136
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
137
+ class TreeBranchTriggerDirective extends CoreTreeBranchTriggerDirective {
138
+ /**
139
+ * @default ChevronRight
140
+ */
141
+ icon = input(ChevronRight, ...(ngDevMode ? [{ debugName: "icon" }] : []));
142
+ qdsContext = useQdsTreeContext();
143
+ constructor() {
144
+ super();
145
+ this.trackBindings.extendWith(computed(() => this.qdsContext().getBranchTriggerBindings()));
146
+ }
147
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeBranchTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Component });
148
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.12", type: TreeBranchTriggerDirective, isStandalone: false, selector: "[q-tree-branch-trigger]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
149
+ <svg [qIcon]="icon()"></svg>
150
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.IconDirective, selector: "svg[qIcon]", inputs: ["qIcon", "size", "viewBox", "xmlns", "height", "width"] }] });
151
+ }
152
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeBranchTriggerDirective, decorators: [{
153
+ type: Component,
154
+ args: [{
155
+ selector: "[q-tree-branch-trigger]",
156
+ standalone: false,
157
+ template: `
158
+ <svg [qIcon]="icon()"></svg>
159
+ `,
160
+ }]
161
+ }], ctorParameters: () => [], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }] } });
162
+
163
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
164
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
165
+ class TreeBranchDirective extends CoreTreeBranchDirective {
166
+ qdsContext = useQdsTreeContext();
167
+ collapsibleApi = inject(CollapsibleContextService);
168
+ document = inject(DOCUMENT);
169
+ injector = inject(Injector);
170
+ nodeState = useTreeNodeStateContext();
171
+ renderStrategyProps = useRenderStrategyContext();
172
+ constructor() {
173
+ super();
174
+ this.trackBindings.extendWith(computed(() => this.qdsContext().getBranchBindings()));
175
+ }
176
+ ngOnInit() {
177
+ const machine = useMachine(collapsibleMachine, computed(() => ({
178
+ defaultOpen: false,
179
+ disabled: this.nodeState().disabled,
180
+ forceMeasureOnOpen: true,
181
+ getRootNode: () => this.document,
182
+ open: this.nodeState().expanded,
183
+ })), this.injector);
184
+ this.collapsibleApi.init(computed(() => createCollapsibleApi(machine, normalizeProps)));
185
+ super.ngOnInit();
186
+ }
187
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeBranchDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
188
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: TreeBranchDirective, isStandalone: false, selector: "[q-tree-branch]", providers: [provideCollapsibleContext()], usesInheritance: true, ngImport: i0 });
189
+ }
190
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeBranchDirective, decorators: [{
191
+ type: Directive,
192
+ args: [{
193
+ providers: [provideCollapsibleContext()],
194
+ selector: "[q-tree-branch]",
195
+ standalone: false,
196
+ }]
197
+ }], ctorParameters: () => [] });
198
+
199
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
200
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
201
+ class TreeLabelDirective extends CoreTreeLabelDirective {
202
+ qdsContext = useQdsTreeContext();
203
+ constructor() {
204
+ super();
205
+ this.trackBindings.extendWith(computed(() => this.qdsContext().getLabelBindings()));
206
+ }
207
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
208
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: TreeLabelDirective, isStandalone: false, selector: "[q-tree-label]", usesInheritance: true, ngImport: i0 });
209
+ }
210
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeLabelDirective, decorators: [{
211
+ type: Directive,
212
+ args: [{
213
+ selector: "[q-tree-label]",
214
+ standalone: false,
215
+ }]
216
+ }], ctorParameters: () => [] });
217
+
218
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
219
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
220
+ class TreeLeafNodeDirective extends CoreTreeLeafNodeDirective {
221
+ qdsContext = useQdsTreeContext();
222
+ constructor() {
223
+ super();
224
+ this.trackBindings.extendWith(computed(() => this.qdsContext().getLeafNodeBindings()));
225
+ }
226
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeLeafNodeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
227
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: TreeLeafNodeDirective, isStandalone: false, selector: "[q-tree-leaf-node]", usesInheritance: true, ngImport: i0 });
228
+ }
229
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeLeafNodeDirective, decorators: [{
230
+ type: Directive,
231
+ args: [{
232
+ selector: "[q-tree-leaf-node]",
233
+ standalone: false,
234
+ }]
235
+ }], ctorParameters: () => [] });
236
+
237
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
238
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
239
+ /**
240
+ * Structural directive that defines the template used to render leaf nodes in a
241
+ * tree. Apply this to an `ng-template` to customize how leaf nodes (nodes without
242
+ * children) are displayed.
243
+ *
244
+ * @example
245
+ * ```html
246
+ * <ng-template q-tree-leaf-template let-node>
247
+ * <div q-tree-leaf-node>
248
+ * <span q-tree-node-text>{{ node.item.label }}</span>
249
+ * </div>
250
+ * </ng-template>
251
+ * ```
252
+ */
253
+ class TreeLeafTemplateDirective {
254
+ /**
255
+ * The root node of the tree. Used for type narrowing of the template guard.
256
+ * {@link https://angular.dev/guide/directives/structural-directives#type-narrowing-with-template-guards Learn more}
257
+ */
258
+ rootNode = input(...(ngDevMode ? [undefined, { debugName: "rootNode" }] : []));
259
+ template = inject(TemplateRef);
260
+ static ngTemplateContextGuard(dir, ctx) {
261
+ return true;
262
+ }
263
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeLeafTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
264
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.12", type: TreeLeafTemplateDirective, isStandalone: false, selector: "ng-template[q-tree-leaf-template]", inputs: { rootNode: { classPropertyName: "rootNode", publicName: "rootNode", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
265
+ }
266
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeLeafTemplateDirective, decorators: [{
267
+ type: Directive,
268
+ args: [{
269
+ selector: "ng-template[q-tree-leaf-template]",
270
+ standalone: false,
271
+ }]
272
+ }], propDecorators: { rootNode: [{ type: i0.Input, args: [{ isSignal: true, alias: "rootNode", required: false }] }] } });
273
+
274
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
275
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
276
+ class TreeNodeActionDirective extends CoreTreeNodeActionDirective {
277
+ /**
278
+ * Lucide icon to display inside the button.
279
+ */
280
+ icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : []));
281
+ /**
282
+ * The size of the button and its icon.
283
+ *
284
+ * @default 'md'
285
+ */
286
+ size = input("md", ...(ngDevMode ? [{ debugName: "size" }] : []));
287
+ inlineIconButtonApi = useInlineIconButtonApi({
288
+ emphasis: "neutral",
289
+ size: this.size(),
290
+ variant: "fixed",
291
+ });
292
+ qdsContext = useQdsTreeContext();
293
+ constructor() {
294
+ super();
295
+ this.trackBindings.extendWith(computed(() => mergeProps(this.inlineIconButtonApi().getRootBindings(), this.qdsContext().getNodeActionBindings())));
296
+ }
297
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodeActionDirective, deps: [], target: i0.ɵɵFactoryTarget.Component });
298
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: TreeNodeActionDirective, isStandalone: false, selector: "[q-tree-node-action]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
299
+ @if (icon()) {
300
+ <svg
301
+ [q-bind]="inlineIconButtonApi().getIconBindings()"
302
+ [qIcon]="icon()!"
303
+ ></svg>
304
+ }
305
+ <ng-content />
306
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.IconDirective, selector: "svg[qIcon]", inputs: ["qIcon", "size", "viewBox", "xmlns", "height", "width"] }, { kind: "directive", type: i2.QBindDirective, selector: "[q-bind]", inputs: ["q-bind", "q-bind-options"] }] });
307
+ }
308
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodeActionDirective, decorators: [{
309
+ type: Component,
310
+ args: [{
311
+ selector: "[q-tree-node-action]",
312
+ standalone: false,
313
+ template: `
314
+ @if (icon()) {
315
+ <svg
316
+ [q-bind]="inlineIconButtonApi().getIconBindings()"
317
+ [qIcon]="icon()!"
318
+ ></svg>
319
+ }
320
+ <ng-content />
321
+ `,
322
+ }]
323
+ }], ctorParameters: () => [], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
324
+
325
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
326
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
327
+ class TreeNodeCheckboxDirective extends CoreTreeNodeCheckboxDirective {
328
+ nodeState = useTreeNodeStateContext();
329
+ constructor() {
330
+ super();
331
+ this.trackBindings.extendWith(computed(() => createQdsCheckmarkApi({
332
+ checked: this.nodeState().checked === true,
333
+ disabled: this.nodeState().disabled,
334
+ indeterminate: this.nodeState().checked === "indeterminate",
335
+ size: "md",
336
+ }, normalizeProps).getRootBindings()));
337
+ }
338
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodeCheckboxDirective, deps: [], target: i0.ɵɵFactoryTarget.Component });
339
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: TreeNodeCheckboxDirective, isStandalone: false, selector: "[q-tree-node-checkbox]", usesInheritance: true, ngImport: i0, template: `
340
+ <ng-content>
341
+ @if (nodeState().checked) {
342
+ <q-checkmark-icon
343
+ size="md"
344
+ [indeterminate]="nodeState().checked === 'indeterminate'"
345
+ />
346
+ }
347
+ </ng-content>
348
+ `, isInline: true, dependencies: [{ kind: "component", type: i1$1.CheckmarkIconComponent, selector: "q-checkmark-icon", inputs: ["indeterminate", "size"] }] });
349
+ }
350
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodeCheckboxDirective, decorators: [{
351
+ type: Component,
352
+ args: [{
353
+ selector: "[q-tree-node-checkbox]",
354
+ standalone: false,
355
+ template: `
356
+ <ng-content>
357
+ @if (nodeState().checked) {
358
+ <q-checkmark-icon
359
+ size="md"
360
+ [indeterminate]="nodeState().checked === 'indeterminate'"
361
+ />
362
+ }
363
+ </ng-content>
364
+ `,
365
+ }]
366
+ }], ctorParameters: () => [] });
367
+
368
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
369
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
370
+ class TreeNodeContextDirective extends ApiContextDirective {
371
+ /**
372
+ * The root node of the tree. Used for type narrowing of the template guard.
373
+ * {@link https://angular.dev/guide/directives/structural-directives#type-narrowing-with-template-guards Learn more}
374
+ */
375
+ rootNode = input(...(ngDevMode ? [undefined, { debugName: "rootNode" }] : []));
376
+ constructor() {
377
+ const contextService = inject(TreeNodeStateContextService);
378
+ super(contextService, "treeNodeContext");
379
+ }
380
+ static ngTemplateContextGuard(dir, ctx) {
381
+ return true;
382
+ }
383
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodeContextDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
384
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.12", type: TreeNodeContextDirective, isStandalone: false, selector: "[treeNodeContext]", inputs: { rootNode: { classPropertyName: "rootNode", publicName: "rootNode", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
385
+ }
386
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodeContextDirective, decorators: [{
387
+ type: Directive,
388
+ args: [{
389
+ selector: "[treeNodeContext]",
390
+ standalone: false,
391
+ }]
392
+ }], ctorParameters: () => [], propDecorators: { rootNode: [{ type: i0.Input, args: [{ isSignal: true, alias: "rootNode", required: false }] }] } });
393
+
394
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
395
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
396
+ class TreeNodeIconDirective extends CoreTreeNodeIconDirective {
397
+ icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : []));
398
+ qdsContext = useQdsTreeContext();
399
+ constructor() {
400
+ super();
401
+ this.trackBindings.extendWith(computed(() => this.qdsContext().getNodeIconBindings()));
402
+ }
403
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodeIconDirective, deps: [], target: i0.ɵɵFactoryTarget.Component });
404
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: TreeNodeIconDirective, isStandalone: false, selector: "[q-tree-node-icon]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
405
+ @if (icon()) {
406
+ <svg [qIcon]="icon()!" />
407
+ }
408
+ <ng-content />
409
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.IconDirective, selector: "svg[qIcon]", inputs: ["qIcon", "size", "viewBox", "xmlns", "height", "width"] }] });
410
+ }
411
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodeIconDirective, decorators: [{
412
+ type: Component,
413
+ args: [{
414
+ selector: "[q-tree-node-icon]",
415
+ standalone: false,
416
+ template: `
417
+ @if (icon()) {
418
+ <svg [qIcon]="icon()!" />
419
+ }
420
+ <ng-content />
421
+ `,
422
+ }]
423
+ }], ctorParameters: () => [], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }] } });
424
+
425
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
426
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
427
+ class TreeNodeIndicatorDirective extends CoreTreeNodeIndicatorDirective {
428
+ qdsContext = useQdsTreeContext();
429
+ constructor() {
430
+ super();
431
+ this.trackBindings.extendWith(computed(() => this.qdsContext().getNodeIndicatorBindings()));
432
+ }
433
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodeIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
434
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: TreeNodeIndicatorDirective, isStandalone: false, selector: "[q-tree-node-indicator]", usesInheritance: true, ngImport: i0 });
435
+ }
436
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodeIndicatorDirective, decorators: [{
437
+ type: Directive,
438
+ args: [{
439
+ selector: "[q-tree-node-indicator]",
440
+ standalone: false,
441
+ }]
442
+ }], ctorParameters: () => [] });
443
+
444
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
445
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
446
+ class TreeNodeTextDirective extends CoreTreeNodeTextDirective {
447
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodeTextDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
448
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: TreeNodeTextDirective, isStandalone: false, selector: "[q-tree-node-text]", usesInheritance: true, ngImport: i0 });
449
+ }
450
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodeTextDirective, decorators: [{
451
+ type: Directive,
452
+ args: [{
453
+ selector: "[q-tree-node-text]",
454
+ standalone: false,
455
+ }]
456
+ }] });
457
+
458
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
459
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
460
+ class TreeNodesComponent {
461
+ /**
462
+ * The index path of the tree node
463
+ */
464
+ indexPath = input.required(...(ngDevMode ? [{ debugName: "indexPath" }] : []));
465
+ /**
466
+ * The tree node
467
+ *
468
+ * @inheritDoc
469
+ */
470
+ node = input.required(...(ngDevMode ? [{ debugName: "node" }] : []));
471
+ renderBranch = input(...(ngDevMode ? [undefined, { debugName: "renderBranch" }] : []));
472
+ renderLeaf = input(...(ngDevMode ? [undefined, { debugName: "renderLeaf" }] : []));
473
+ treeBranchContentChild = contentChild((TreeBranchTemplateDirective), ...(ngDevMode ? [{ debugName: "treeBranchContentChild" }] : []));
474
+ treeLeafContentChild = contentChild((TreeLeafTemplateDirective), ...(ngDevMode ? [{ debugName: "treeLeafContentChild" }] : []));
475
+ branchTemplate = computed(() => {
476
+ const branchInput = this.renderBranch();
477
+ const branchTemplate = this.treeBranchContentChild();
478
+ return branchInput || branchTemplate?.template;
479
+ }, ...(ngDevMode ? [{ debugName: "branchTemplate" }] : []));
480
+ leafTemplate = computed(() => {
481
+ const leafInput = this.renderLeaf();
482
+ const leafTemplate = this.treeLeafContentChild();
483
+ return (leafInput || leafTemplate?.template);
484
+ }, ...(ngDevMode ? [{ debugName: "leafTemplate" }] : []));
485
+ treeContext = useTreeContext();
486
+ injector = inject(Injector, { self: true });
487
+ templateContext = computed(() => ({
488
+ $implicit: {
489
+ indexPath: this.indexPath(),
490
+ node: this.node(),
491
+ },
492
+ }), ...(ngDevMode ? [{ debugName: "templateContext" }] : []));
493
+ childNodes = computed(() => {
494
+ return this.treeContext().collection.getNodeChildren(this.node());
495
+ }, ...(ngDevMode ? [{ debugName: "childNodes" }] : []));
496
+ treeNodePropsContextService = inject(TreeNodePropsContextService, { self: true });
497
+ treeNodeStateContextService = inject(TreeNodeStateContextService, {
498
+ self: true,
499
+ });
500
+ ngOnInit() {
501
+ const nodeProps = computed(() => ({
502
+ indexPath: this.indexPath(),
503
+ node: this.node(),
504
+ }), ...(ngDevMode ? [{ debugName: "nodeProps" }] : []));
505
+ this.treeNodePropsContextService.init(nodeProps);
506
+ this.treeNodeStateContextService.init(computed(() => this.treeContext().getNodeState(nodeProps())));
507
+ }
508
+ getChildIndexPath(index) {
509
+ return [...this.indexPath(), index];
510
+ }
511
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
512
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: TreeNodesComponent, isStandalone: false, selector: "q-tree-nodes", inputs: { indexPath: { classPropertyName: "indexPath", publicName: "indexPath", isSignal: true, isRequired: true, transformFunction: null }, node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, renderBranch: { classPropertyName: "renderBranch", publicName: "renderBranch", isSignal: true, isRequired: false, transformFunction: null }, renderLeaf: { classPropertyName: "renderLeaf", publicName: "renderLeaf", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideTreeNodePropsContext(), provideTreeNodeStateContext()], queries: [{ propertyName: "treeBranchContentChild", first: true, predicate: (TreeBranchTemplateDirective), descendants: true, isSignal: true }, { propertyName: "treeLeafContentChild", first: true, predicate: (TreeLeafTemplateDirective), descendants: true, isSignal: true }], ngImport: i0, template: `
513
+ @if (childNodes().length) {
514
+ <div q-tree-branch>
515
+ <ng-template
516
+ [ngTemplateOutlet]="branchTemplate()!"
517
+ [ngTemplateOutletContext]="templateContext()"
518
+ [ngTemplateOutletInjector]="injector"
519
+ />
520
+
521
+ <div q-tree-branch-content>
522
+ @for (
523
+ child of childNodes();
524
+ let i = $index;
525
+ track treeContext().collection.getNodeValue(child)
526
+ ) {
527
+ <q-tree-nodes
528
+ [indexPath]="getChildIndexPath(i)"
529
+ [node]="child"
530
+ [renderBranch]="branchTemplate()"
531
+ [renderLeaf]="leafTemplate()"
532
+ />
533
+ }
534
+ </div>
535
+ </div>
536
+ } @else {
537
+ <ng-template
538
+ [ngTemplateOutlet]="leafTemplate()!"
539
+ [ngTemplateOutletContext]="templateContext()"
540
+ [ngTemplateOutletInjector]="injector"
541
+ />
542
+ }
543
+ `, isInline: true, styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: i1$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TreeBranchDirective, selector: "[q-tree-branch]" }, { kind: "directive", type: TreeBranchContentDirective, selector: "[q-tree-branch-content]", inputs: ["id"] }, { kind: "component", type: TreeNodesComponent, selector: "q-tree-nodes", inputs: ["indexPath", "node", "renderBranch", "renderLeaf"] }] });
544
+ }
545
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeNodesComponent, decorators: [{
546
+ type: Component,
547
+ args: [{ providers: [provideTreeNodePropsContext(), provideTreeNodeStateContext()], selector: "q-tree-nodes", standalone: false, template: `
548
+ @if (childNodes().length) {
549
+ <div q-tree-branch>
550
+ <ng-template
551
+ [ngTemplateOutlet]="branchTemplate()!"
552
+ [ngTemplateOutletContext]="templateContext()"
553
+ [ngTemplateOutletInjector]="injector"
554
+ />
555
+
556
+ <div q-tree-branch-content>
557
+ @for (
558
+ child of childNodes();
559
+ let i = $index;
560
+ track treeContext().collection.getNodeValue(child)
561
+ ) {
562
+ <q-tree-nodes
563
+ [indexPath]="getChildIndexPath(i)"
564
+ [node]="child"
565
+ [renderBranch]="branchTemplate()"
566
+ [renderLeaf]="leafTemplate()"
567
+ />
568
+ }
569
+ </div>
570
+ </div>
571
+ } @else {
572
+ <ng-template
573
+ [ngTemplateOutlet]="leafTemplate()!"
574
+ [ngTemplateOutletContext]="templateContext()"
575
+ [ngTemplateOutletInjector]="injector"
576
+ />
577
+ }
578
+ `, styles: [":host{display:contents}\n"] }]
579
+ }], propDecorators: { indexPath: [{ type: i0.Input, args: [{ isSignal: true, alias: "indexPath", required: true }] }], node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: true }] }], renderBranch: [{ type: i0.Input, args: [{ isSignal: true, alias: "renderBranch", required: false }] }], renderLeaf: [{ type: i0.Input, args: [{ isSignal: true, alias: "renderLeaf", required: false }] }], treeBranchContentChild: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TreeBranchTemplateDirective), { isSignal: true }] }], treeLeafContentChild: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TreeLeafTemplateDirective), { isSignal: true }] }] } });
580
+
581
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
582
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
583
+ class TreeRootDirective extends CoreTreeRootDirective {
584
+ /**
585
+ * The size of the tree and its elements. Governs properties like font size,
586
+ * item padding, and icon sizes.
587
+ *
588
+ * @default 'md'
589
+ */
590
+ size = input(...(ngDevMode ? [undefined, { debugName: "size" }] : []));
591
+ qdsTreeService = inject(QdsTreeContextService);
592
+ constructor() {
593
+ super();
594
+ this.trackBindings.extendWith(computed(() => this.qdsTreeService.context().getRootBindings()));
595
+ }
596
+ ngOnInit() {
597
+ this.qdsTreeService.init(computed(() => createQdsTreeApi({ size: this.size() }, normalizeProps)));
598
+ super.ngOnInit();
599
+ }
600
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
601
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.12", type: TreeRootDirective, isStandalone: false, selector: "[q-tree-root]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
602
+ provideTreeContext(),
603
+ provideRenderStrategyContext(),
604
+ provideQdsTreeContext(),
605
+ ], exportAs: ["treeRoot"], usesInheritance: true, ngImport: i0 });
606
+ }
607
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeRootDirective, decorators: [{
608
+ type: Directive,
609
+ args: [{
610
+ exportAs: "treeRoot",
611
+ providers: [
612
+ provideTreeContext(),
613
+ provideRenderStrategyContext(),
614
+ provideQdsTreeContext(),
615
+ ],
616
+ selector: "[q-tree-root]",
617
+ standalone: false,
618
+ }]
619
+ }], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
620
+
621
+ // Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
622
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
623
+ class TreeModule {
624
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
625
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: TreeModule, declarations: [TreeRootDirective,
626
+ TreeBranchDirective,
627
+ TreeBranchContentDirective,
628
+ TreeBranchIndentGuideDirective,
629
+ TreeBranchNodeDirective,
630
+ TreeBranchTriggerDirective,
631
+ TreeLabelDirective,
632
+ TreeLeafNodeDirective,
633
+ TreeNodeActionDirective,
634
+ TreeNodeIconDirective,
635
+ TreeNodeIndicatorDirective,
636
+ TreeNodeTextDirective,
637
+ TreeLeafTemplateDirective,
638
+ TreeBranchTemplateDirective,
639
+ TreeNodeContextDirective,
640
+ TreeNodeCheckboxDirective,
641
+ TreeNodesComponent], imports: [IconDirective,
642
+ QBindDirective,
643
+ NgTemplateOutlet,
644
+ CheckmarkIconComponent], exports: [TreeRootDirective,
645
+ TreeBranchDirective,
646
+ TreeBranchContentDirective,
647
+ TreeBranchIndentGuideDirective,
648
+ TreeBranchNodeDirective,
649
+ TreeBranchTriggerDirective,
650
+ TreeLabelDirective,
651
+ TreeLeafNodeDirective,
652
+ TreeNodeActionDirective,
653
+ TreeNodeIconDirective,
654
+ TreeNodeIndicatorDirective,
655
+ TreeNodeTextDirective,
656
+ TreeBranchTemplateDirective,
657
+ TreeLeafTemplateDirective,
658
+ TreeNodeContextDirective,
659
+ TreeNodeCheckboxDirective,
660
+ TreeNodesComponent] });
661
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeModule, imports: [CheckmarkIconComponent] });
662
+ }
663
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TreeModule, decorators: [{
664
+ type: NgModule,
665
+ args: [{
666
+ declarations: [
667
+ TreeRootDirective,
668
+ TreeBranchDirective,
669
+ TreeBranchContentDirective,
670
+ TreeBranchIndentGuideDirective,
671
+ TreeBranchNodeDirective,
672
+ TreeBranchTriggerDirective,
673
+ TreeLabelDirective,
674
+ TreeLeafNodeDirective,
675
+ TreeNodeActionDirective,
676
+ TreeNodeIconDirective,
677
+ TreeNodeIndicatorDirective,
678
+ TreeNodeTextDirective,
679
+ TreeLeafTemplateDirective,
680
+ TreeBranchTemplateDirective,
681
+ TreeNodeContextDirective,
682
+ TreeNodeCheckboxDirective,
683
+ TreeNodesComponent,
684
+ ],
685
+ exports: [
686
+ TreeRootDirective,
687
+ TreeBranchDirective,
688
+ TreeBranchContentDirective,
689
+ TreeBranchIndentGuideDirective,
690
+ TreeBranchNodeDirective,
691
+ TreeBranchTriggerDirective,
692
+ TreeLabelDirective,
693
+ TreeLeafNodeDirective,
694
+ TreeNodeActionDirective,
695
+ TreeNodeIconDirective,
696
+ TreeNodeIndicatorDirective,
697
+ TreeNodeTextDirective,
698
+ TreeBranchTemplateDirective,
699
+ TreeLeafTemplateDirective,
700
+ TreeNodeContextDirective,
701
+ TreeNodeCheckboxDirective,
702
+ TreeNodesComponent,
703
+ ],
704
+ imports: [
705
+ IconDirective,
706
+ QBindDirective,
707
+ NgTemplateOutlet,
708
+ CheckmarkIconComponent,
709
+ ],
710
+ }]
711
+ }] });
712
+
1
713
  /**
2
714
  * Generated bundle index. Do not edit.
3
715
  */
716
+
717
+ export { QDS_TREE_CONTEXT, QdsTreeContextService, TreeBranchContentDirective, TreeBranchDirective, TreeBranchIndentGuideDirective, TreeBranchNodeDirective, TreeBranchTemplateDirective, TreeBranchTriggerDirective, TreeLabelDirective, TreeLeafNodeDirective, TreeLeafTemplateDirective, TreeModule, TreeNodeActionDirective, TreeNodeCheckboxDirective, TreeNodeContextDirective, TreeNodeIconDirective, TreeNodeIndicatorDirective, TreeNodeTextDirective, TreeNodesComponent, TreeRootDirective, provideQdsTreeContext, useQdsTreeContext };
4
718
  //# sourceMappingURL=qualcomm-ui-angular-tree.mjs.map