ngx-core-components 0.3.28 → 0.3.30
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/ai/ai-chat/ai-chat.component.d.ts +9 -1
- package/ai/ai-chat-widget/ai-chat-widget.component.d.ts +3 -1
- package/ai/ai-prompt-editor/ai-prompt-editor.component.d.ts +14 -1
- package/ai/ai-rag-inspector/ai-rag-inspector.component.d.ts +6 -0
- package/charts/bar-chart/bar-chart.component.d.ts +2 -1
- package/charts/calendar-heatmap/calendar-heatmap.component.d.ts +49 -0
- package/charts/gauge-chart/gauge-chart.component.d.ts +18 -2
- package/charts/multi-needle-gauge/multi-needle-gauge.component.d.ts +74 -0
- package/charts/nested-donut-chart/nested-donut-chart.component.d.ts +70 -0
- package/charts/org-chart/org-chart.component.d.ts +69 -0
- package/charts/pie-chart/pie-chart.component.d.ts +3 -1
- package/charts/public-api.d.ts +24 -0
- package/charts/pyramid-chart/pyramid-chart.component.d.ts +58 -0
- package/charts/range-bar-chart/range-bar-chart.component.d.ts +61 -0
- package/charts/shared/chart-annotations.d.ts +26 -0
- package/charts/shared/chart-brush-zoom.component.d.ts +53 -0
- package/charts/shared/chart-skeleton.component.d.ts +10 -0
- package/charts/shared/chart-sync-group.directive.d.ts +14 -0
- package/charts/shared/chart-theme.service.d.ts +21 -0
- package/charts/shared/chart-tooltip.service.d.ts +28 -0
- package/charts/step-line-chart/step-line-chart.component.d.ts +71 -0
- package/charts/timeline-chart/timeline-chart.component.d.ts +63 -0
- package/fesm2022/ngx-core-components-ai.mjs +633 -258
- package/fesm2022/ngx-core-components-ai.mjs.map +1 -1
- package/fesm2022/ngx-core-components-charts.mjs +3347 -39
- package/fesm2022/ngx-core-components-charts.mjs.map +1 -1
- package/fesm2022/ngx-core-components-grid.mjs +3635 -892
- package/fesm2022/ngx-core-components-grid.mjs.map +1 -1
- package/fesm2022/ngx-core-components-inputs.mjs +894 -542
- package/fesm2022/ngx-core-components-inputs.mjs.map +1 -1
- package/fesm2022/ngx-core-components-views.mjs +306 -117
- package/fesm2022/ngx-core-components-views.mjs.map +1 -1
- package/fesm2022/ngx-core-components.mjs +2 -2
- package/fesm2022/ngx-core-components.mjs.map +1 -1
- package/grid/data-grid/components/grid-filter-builder/grid-filter-builder.component.d.ts +70 -0
- package/grid/data-grid/components/grid-status-bar/grid-status-bar.component.d.ts +25 -0
- package/grid/data-grid/data-grid.component.d.ts +18 -1
- package/grid/data-grid/models.d.ts +65 -0
- package/grid/data-grid/services/grid-clipboard.service.d.ts +40 -0
- package/grid/data-grid/services/grid-edit.service.d.ts +48 -0
- package/grid/data-grid/services/grid-export-xlsx.service.d.ts +67 -0
- package/grid/data-grid/services/grid-keyboard.service.d.ts +70 -0
- package/grid/data-grid/services/grid-selection.service.d.ts +36 -0
- package/grid/data-grid/services/grid-state.service.d.ts +41 -0
- package/grid/data-grid/services/grid-virtualization.service.d.ts +81 -0
- package/grid/data-grid/utils/grid-aggregate.util.d.ts +13 -0
- package/grid/data-grid/utils/grid-filter.util.d.ts +11 -0
- package/grid/data-grid/utils/grid-sort.util.d.ts +17 -0
- package/grid/pivot-grid/pivot-grid.component.d.ts +15 -2
- package/grid/public-api.d.ts +17 -1
- package/inputs/date-picker/date-picker.component.d.ts +32 -33
- package/inputs/directives/mask.directive.d.ts +9 -0
- package/inputs/form-builder/form-builder.component.d.ts +22 -31
- package/inputs/numeric-textbox/numeric-textbox.component.d.ts +33 -23
- package/inputs/pipes/form-error.pipe.d.ts +9 -0
- package/inputs/public-api.d.ts +8 -1
- package/inputs/segmented-control/segmented-control.component.d.ts +12 -3
- package/inputs/services/form-error.service.d.ts +33 -0
- package/inputs/textbox/textbox.component.d.ts +3 -1
- package/inputs/utils/mask.util.d.ts +16 -0
- package/package.json +1 -1
- package/public-api.d.ts +18 -1
- package/views/tree-view/tree-view.component.d.ts +20 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, signal, ChangeDetectionStrategy, Component, inject,
|
|
2
|
+
import { input, output, signal, computed, ChangeDetectionStrategy, Component, inject, effect, ContentChild, ViewChildren, Directive, contentChild, TemplateRef, HostListener, ViewChild, model } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
|
-
import {
|
|
4
|
+
import { CommonModule, NgTemplateOutlet } from '@angular/common';
|
|
5
5
|
import { NGX_CORE_I18N } from 'ngx-core-components/i18n';
|
|
6
6
|
import * as i1$1 from '@angular/forms';
|
|
7
7
|
import { FormsModule } from '@angular/forms';
|
|
@@ -12,23 +12,94 @@ class TreeViewComponent {
|
|
|
12
12
|
checkable = input(false);
|
|
13
13
|
selectedId = input(null);
|
|
14
14
|
expandedIds = input([]);
|
|
15
|
+
showSearch = input(false);
|
|
16
|
+
searchPlaceholder = input('Search nodes...');
|
|
17
|
+
showActions = input(false);
|
|
18
|
+
theme = input('light');
|
|
19
|
+
// Outputs
|
|
15
20
|
nodeSelect = output();
|
|
16
21
|
nodeExpand = output();
|
|
17
22
|
nodeCollapse = output();
|
|
18
23
|
checkChange = output();
|
|
24
|
+
actionClick = output();
|
|
25
|
+
// State Signals
|
|
19
26
|
expandedSet = signal(new Set());
|
|
20
27
|
checkedSet = signal(new Set());
|
|
28
|
+
indeterminateSet = signal(new Set());
|
|
21
29
|
focusedId = signal(null);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
searchQuery = signal('');
|
|
31
|
+
ngOnInit() {
|
|
32
|
+
// Sync initial expanded ids
|
|
33
|
+
if (this.expandedIds().length > 0) {
|
|
34
|
+
this.expandedSet.set(new Set(this.expandedIds()));
|
|
35
|
+
}
|
|
36
|
+
this.updateAncestorCheckStates();
|
|
37
|
+
}
|
|
38
|
+
isExpanded(id) {
|
|
39
|
+
return this.expandedSet().has(id) || this.expandedIds().includes(id);
|
|
40
|
+
}
|
|
41
|
+
isChecked(id) {
|
|
42
|
+
return this.checkedSet().has(id);
|
|
43
|
+
}
|
|
44
|
+
isIndeterminate(id) {
|
|
45
|
+
return this.indeterminateSet().has(id);
|
|
46
|
+
}
|
|
47
|
+
hasNodeChildren(node) {
|
|
48
|
+
return !!(node.children?.length || node.hasChildren);
|
|
49
|
+
}
|
|
50
|
+
// Computed signal that filters the nodes reactively based on searchQuery
|
|
51
|
+
filteredNodes = computed(() => {
|
|
52
|
+
const query = this.searchQuery().trim().toLowerCase();
|
|
53
|
+
if (!query) {
|
|
54
|
+
return this.nodes();
|
|
55
|
+
}
|
|
56
|
+
const expanded = new Set(this.expandedSet());
|
|
57
|
+
const filterList = (list) => {
|
|
58
|
+
const match = [];
|
|
59
|
+
let hasAnyMatch = false;
|
|
60
|
+
for (const node of list) {
|
|
61
|
+
const matchesSelf = node.label.toLowerCase().includes(query);
|
|
62
|
+
let childrenMatches = [];
|
|
63
|
+
let hasChildrenMatch = false;
|
|
64
|
+
if (node.children) {
|
|
65
|
+
const res = filterList(node.children);
|
|
66
|
+
childrenMatches = res.match;
|
|
67
|
+
hasChildrenMatch = res.hasMatch;
|
|
68
|
+
}
|
|
69
|
+
if (matchesSelf || hasChildrenMatch) {
|
|
70
|
+
hasAnyMatch = true;
|
|
71
|
+
// Auto-expand paths to matching elements
|
|
72
|
+
if (hasChildrenMatch) {
|
|
73
|
+
expanded.add(node.id);
|
|
74
|
+
}
|
|
75
|
+
match.push({
|
|
76
|
+
...node,
|
|
77
|
+
children: node.children ? childrenMatches : undefined
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return { match, hasMatch: hasAnyMatch };
|
|
82
|
+
};
|
|
83
|
+
const result = filterList(this.nodes()).match;
|
|
84
|
+
// Trigger expansion outside signal computation loop
|
|
85
|
+
setTimeout(() => {
|
|
86
|
+
this.expandedSet.set(expanded);
|
|
87
|
+
}, 0);
|
|
88
|
+
return result;
|
|
89
|
+
});
|
|
90
|
+
onSearchInput(event) {
|
|
91
|
+
const val = event.target.value;
|
|
92
|
+
this.searchQuery.set(val);
|
|
93
|
+
}
|
|
94
|
+
clearSearch() {
|
|
95
|
+
this.searchQuery.set('');
|
|
96
|
+
}
|
|
25
97
|
onNodeClick(node, e) {
|
|
26
98
|
e.stopPropagation();
|
|
27
99
|
this.focusedId.set(node.id);
|
|
28
|
-
if (this.selectable())
|
|
100
|
+
if (this.selectable()) {
|
|
29
101
|
this.nodeSelect.emit({ node });
|
|
30
|
-
|
|
31
|
-
this.toggleExpand(node, e);
|
|
102
|
+
}
|
|
32
103
|
}
|
|
33
104
|
toggleExpand(node, e) {
|
|
34
105
|
e.stopPropagation();
|
|
@@ -46,10 +117,67 @@ class TreeViewComponent {
|
|
|
46
117
|
onCheck(node) {
|
|
47
118
|
const s = new Set(this.checkedSet());
|
|
48
119
|
const checked = !s.has(node.id);
|
|
49
|
-
|
|
120
|
+
// Recursively check/uncheck descendants
|
|
121
|
+
const toggleDescendants = (n, checkVal) => {
|
|
122
|
+
if (checkVal) {
|
|
123
|
+
s.add(n.id);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
s.delete(n.id);
|
|
127
|
+
}
|
|
128
|
+
if (n.children) {
|
|
129
|
+
for (const child of n.children) {
|
|
130
|
+
toggleDescendants(child, checkVal);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
toggleDescendants(node, checked);
|
|
50
135
|
this.checkedSet.set(s);
|
|
136
|
+
// Calculate indeterminate and checked states up the chain
|
|
137
|
+
this.updateAncestorCheckStates();
|
|
51
138
|
this.checkChange.emit({ node, checked });
|
|
52
139
|
}
|
|
140
|
+
updateAncestorCheckStates() {
|
|
141
|
+
const checked = new Set(this.checkedSet());
|
|
142
|
+
const indeterminate = new Set();
|
|
143
|
+
const evaluate = (n) => {
|
|
144
|
+
if (!n.children || n.children.length === 0) {
|
|
145
|
+
return checked.has(n.id) ? 'checked' : 'unchecked';
|
|
146
|
+
}
|
|
147
|
+
let checkedCount = 0;
|
|
148
|
+
let indeterminateCount = 0;
|
|
149
|
+
for (const child of n.children) {
|
|
150
|
+
const state = evaluate(child);
|
|
151
|
+
if (state === 'checked')
|
|
152
|
+
checkedCount++;
|
|
153
|
+
else if (state === 'indeterminate')
|
|
154
|
+
indeterminateCount++;
|
|
155
|
+
}
|
|
156
|
+
if (checkedCount === n.children.length) {
|
|
157
|
+
checked.add(n.id);
|
|
158
|
+
indeterminate.delete(n.id);
|
|
159
|
+
return 'checked';
|
|
160
|
+
}
|
|
161
|
+
else if (checkedCount > 0 || indeterminateCount > 0) {
|
|
162
|
+
checked.delete(n.id);
|
|
163
|
+
indeterminate.add(n.id);
|
|
164
|
+
return 'indeterminate';
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
checked.delete(n.id);
|
|
168
|
+
indeterminate.delete(n.id);
|
|
169
|
+
return 'unchecked';
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
for (const root of this.nodes()) {
|
|
173
|
+
evaluate(root);
|
|
174
|
+
}
|
|
175
|
+
this.checkedSet.set(checked);
|
|
176
|
+
this.indeterminateSet.set(indeterminate);
|
|
177
|
+
}
|
|
178
|
+
onAction(node, action) {
|
|
179
|
+
this.actionClick.emit({ node, action });
|
|
180
|
+
}
|
|
53
181
|
onKeyDown(e) {
|
|
54
182
|
const flat = this.flatVisibleIds();
|
|
55
183
|
const cur = this.focusedId();
|
|
@@ -67,8 +195,9 @@ class TreeViewComponent {
|
|
|
67
195
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
68
196
|
if (cur) {
|
|
69
197
|
const node = this.findNode(cur, this.nodes());
|
|
70
|
-
if (node)
|
|
198
|
+
if (node) {
|
|
71
199
|
this.nodeSelect.emit({ node });
|
|
200
|
+
}
|
|
72
201
|
}
|
|
73
202
|
}
|
|
74
203
|
}
|
|
@@ -81,7 +210,7 @@ class TreeViewComponent {
|
|
|
81
210
|
collect(n.children);
|
|
82
211
|
}
|
|
83
212
|
};
|
|
84
|
-
collect(this.
|
|
213
|
+
collect(this.filteredNodes());
|
|
85
214
|
return ids;
|
|
86
215
|
}
|
|
87
216
|
findNode(id, nodes) {
|
|
@@ -116,131 +245,191 @@ class TreeViewComponent {
|
|
|
116
245
|
this.expandedSet.set(new Set());
|
|
117
246
|
}
|
|
118
247
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TreeViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
119
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: TreeViewComponent, isStandalone: true, selector: "ngx-tree-view", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, checkable: { classPropertyName: "checkable", publicName: "checkable", isSignal: true, isRequired: false, transformFunction: null }, selectedId: { classPropertyName: "selectedId", publicName: "selectedId", isSignal: true, isRequired: false, transformFunction: null }, expandedIds: { classPropertyName: "expandedIds", publicName: "expandedIds", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodeSelect: "nodeSelect", nodeExpand: "nodeExpand", nodeCollapse: "nodeCollapse", checkChange: "checkChange" }, ngImport: i0, template: `
|
|
120
|
-
<div class="ngx-tree-
|
|
121
|
-
|
|
122
|
-
|
|
248
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: TreeViewComponent, isStandalone: true, selector: "ngx-tree-view", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, checkable: { classPropertyName: "checkable", publicName: "checkable", isSignal: true, isRequired: false, transformFunction: null }, selectedId: { classPropertyName: "selectedId", publicName: "selectedId", isSignal: true, isRequired: false, transformFunction: null }, expandedIds: { classPropertyName: "expandedIds", publicName: "expandedIds", isSignal: true, isRequired: false, transformFunction: null }, showSearch: { classPropertyName: "showSearch", publicName: "showSearch", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, showActions: { classPropertyName: "showActions", publicName: "showActions", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodeSelect: "nodeSelect", nodeExpand: "nodeExpand", nodeCollapse: "nodeCollapse", checkChange: "checkChange", actionClick: "actionClick" }, ngImport: i0, template: `
|
|
249
|
+
<div class="ngx-tree-wrapper" [class.dark]="theme() === 'dark'">
|
|
250
|
+
<!-- Search Panel -->
|
|
251
|
+
@if (showSearch()) {
|
|
252
|
+
<div class="tree-search-bar">
|
|
253
|
+
<input
|
|
254
|
+
type="text"
|
|
255
|
+
class="tree-search-input"
|
|
256
|
+
[placeholder]="searchPlaceholder()"
|
|
257
|
+
[value]="searchQuery()"
|
|
258
|
+
(input)="onSearchInput($event)"
|
|
259
|
+
/>
|
|
260
|
+
@if (searchQuery()) {
|
|
261
|
+
<button class="tree-clear-btn" (click)="clearSearch()">✕</button>
|
|
262
|
+
}
|
|
263
|
+
</div>
|
|
123
264
|
}
|
|
124
265
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
[class.focused]="focusedId() === node.id"
|
|
131
|
-
[class.disabled]="node.disabled"
|
|
132
|
-
role="treeitem"
|
|
133
|
-
[attr.aria-expanded]="isExpanded(node.id)"
|
|
134
|
-
[attr.aria-selected]="selectedId() === node.id"
|
|
135
|
-
[attr.aria-disabled]="node.disabled || null"
|
|
136
|
-
(click)="!node.disabled && onNodeClick(node, $event)"
|
|
137
|
-
>
|
|
138
|
-
<!-- Expand/collapse -->
|
|
139
|
-
@if (hasNodeChildren(node)) {
|
|
140
|
-
<button
|
|
141
|
-
class="tree-expand-btn"
|
|
142
|
-
(click)="toggleExpand(node, $event)"
|
|
143
|
-
[attr.aria-label]="isExpanded(node.id) ? 'Collapse' : 'Expand'"
|
|
144
|
-
>
|
|
145
|
-
<span class="expand-icon" [class.expanded]="isExpanded(node.id)">►</span>
|
|
146
|
-
</button>
|
|
147
|
-
} @else {
|
|
148
|
-
<span class="tree-leaf-spacer"></span>
|
|
149
|
-
}
|
|
266
|
+
<!-- Tree Nodes Scroll Container -->
|
|
267
|
+
<div class="ngx-tree-view" role="tree" (keydown)="onKeyDown($event)" tabindex="0">
|
|
268
|
+
@for (node of filteredNodes(); track node.id) {
|
|
269
|
+
<ng-container *ngTemplateOutlet="nodeTemplate; context: { node: node, depth: 0 }"/>
|
|
270
|
+
}
|
|
150
271
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
272
|
+
<ng-template #nodeTemplate let-node="node" let-depth="depth">
|
|
273
|
+
<div
|
|
274
|
+
class="tree-node"
|
|
275
|
+
[class.selected]="selectedId() === node.id"
|
|
276
|
+
[class.focused]="focusedId() === node.id"
|
|
277
|
+
[class.disabled]="node.disabled"
|
|
278
|
+
role="treeitem"
|
|
279
|
+
[attr.aria-expanded]="isExpanded(node.id)"
|
|
280
|
+
[attr.aria-selected]="selectedId() === node.id"
|
|
281
|
+
[attr.aria-disabled]="node.disabled || null"
|
|
282
|
+
(click)="!node.disabled && onNodeClick(node, $event)"
|
|
283
|
+
>
|
|
284
|
+
<!-- Expand/collapse -->
|
|
285
|
+
@if (hasNodeChildren(node)) {
|
|
286
|
+
<button
|
|
287
|
+
class="tree-expand-btn"
|
|
288
|
+
(click)="toggleExpand(node, $event)"
|
|
289
|
+
[attr.aria-label]="isExpanded(node.id) ? 'Collapse' : 'Expand'"
|
|
290
|
+
>
|
|
291
|
+
<span class="expand-icon" [class.expanded]="isExpanded(node.id)">▶</span>
|
|
292
|
+
</button>
|
|
293
|
+
} @else {
|
|
294
|
+
<span class="tree-leaf-spacer"></span>
|
|
295
|
+
}
|
|
161
296
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
297
|
+
<!-- Checkbox -->
|
|
298
|
+
@if (checkable()) {
|
|
299
|
+
<input
|
|
300
|
+
type="checkbox"
|
|
301
|
+
class="tree-checkbox"
|
|
302
|
+
[checked]="isChecked(node.id)"
|
|
303
|
+
[indeterminate]="isIndeterminate(node.id)"
|
|
304
|
+
(change)="onCheck(node)"
|
|
305
|
+
(click)="$event.stopPropagation()"
|
|
306
|
+
/>
|
|
307
|
+
}
|
|
166
308
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
309
|
+
<!-- Icon -->
|
|
310
|
+
@if (node.icon) {
|
|
311
|
+
<span class="tree-icon">{{ node.icon }}</span>
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
<!-- Label -->
|
|
315
|
+
<span class="tree-label">{{ node.label }}</span>
|
|
170
316
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
317
|
+
<!-- Inline Hover Actions -->
|
|
318
|
+
@if (showActions() && !node.disabled) {
|
|
319
|
+
<div class="tree-node-actions" (click)="$event.stopPropagation()">
|
|
320
|
+
<button class="action-btn add" (click)="onAction(node, 'add')" title="Add Subnode">➕</button>
|
|
321
|
+
<button class="action-btn edit" (click)="onAction(node, 'edit')" title="Edit Node">✏️</button>
|
|
322
|
+
<button class="action-btn delete" (click)="onAction(node, 'delete')" title="Delete Node">🗑️</button>
|
|
323
|
+
</div>
|
|
324
|
+
}
|
|
325
|
+
</div>
|
|
326
|
+
|
|
327
|
+
<!-- Nested Children with गाइड Lines -->
|
|
328
|
+
@if (isExpanded(node.id) && node.children) {
|
|
329
|
+
<div class="tree-node-children-group">
|
|
330
|
+
@for (child of node.children; track child.id) {
|
|
331
|
+
<ng-container *ngTemplateOutlet="nodeTemplate; context: { node: child, depth: depth + 1 }"/>
|
|
332
|
+
}
|
|
333
|
+
</div>
|
|
175
334
|
}
|
|
176
|
-
|
|
177
|
-
</
|
|
335
|
+
</ng-template>
|
|
336
|
+
</div>
|
|
178
337
|
</div>
|
|
179
|
-
`, isInline: true, styles: [":host{display:block}.ngx-tree-
|
|
338
|
+
`, isInline: true, styles: [":host{display:block;width:100%}.ngx-tree-wrapper{display:flex;flex-direction:column;gap:8px;width:100%}.tree-search-bar{position:relative;display:flex;align-items:center;width:100%}.tree-search-input{width:100%;padding:8px 32px 8px 12px;font-size:13px;border:1px solid var(--border-color, #cbd5e1);border-radius:8px;outline:none;background:var(--bg-secondary, #ffffff);color:var(--text-primary, #0f172a);transition:all .2s ease}.tree-search-input:focus{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px #4f46e51f}.tree-clear-btn{position:absolute;right:10px;background:none;border:none;cursor:pointer;color:#94a3b8;font-size:11px;padding:4px}.tree-clear-btn:hover{color:#64748b}.ngx-tree-view{background:var(--bg-primary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;padding:8px;overflow-y:auto;max-height:480px;font-family:var(--ngx-font-family, system-ui, sans-serif);outline:none}.dark .ngx-tree-view{background:var(--bg-secondary, #1e293b);border-color:#ffffff14}.tree-node{display:flex;align-items:center;gap:6px;height:34px;padding:0 8px;cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:8px;margin:1px 0;transition:background .15s ease,color .15s ease;position:relative}.tree-node:hover{background:#0f172a0a}.dark .tree-node:hover{background:#ffffff0a}.tree-node.selected{background:#4f46e514;color:var(--primary-color, #4f46e5)}.dark .tree-node.selected{background:#6366f129;color:#818cf8}.tree-node.focused{box-shadow:inset 0 0 0 1.5px var(--primary-color, #4f46e5)}.tree-node.disabled{opacity:.45;cursor:not-allowed;pointer-events:none}.tree-expand-btn{width:20px;height:20px;background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:4px;color:#94a3b8;transition:background .15s}.tree-expand-btn:hover{background:#0f172a14;color:#475569}.dark .tree-expand-btn:hover{background:#ffffff14;color:#cbd5e1}.expand-icon{font-size:8px;transition:transform .2s cubic-bezier(.2,.8,.2,1);display:inline-block}.expand-icon.expanded{transform:rotate(90deg)}.tree-leaf-spacer{width:20px;flex-shrink:0}.tree-checkbox{width:14px;height:14px;cursor:pointer;flex-shrink:0;accent-color:var(--primary-color, #4f46e5);border-radius:4px}.tree-icon{font-size:14px;flex-shrink:0}.tree-label{font-size:13px;color:var(--text-primary, #1e293b);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.selected .tree-label{font-weight:600}.dark .tree-label{color:#cbd5e1}.tree-node-actions{display:none;align-items:center;gap:4px;margin-left:auto;padding-left:8px}.tree-node:hover .tree-node-actions{display:flex}.action-btn{background:none;border:none;cursor:pointer;font-size:10px;padding:4px;border-radius:4px;transition:all .15s;opacity:.65}.action-btn:hover{opacity:1;background:#0f172a14}.dark .action-btn:hover{background:#ffffff14}.tree-node-children-group{position:relative;border-left:1px solid rgba(15,23,42,.08);margin-left:17px;padding-left:10px}.dark .tree-node-children-group{border-left-color:#ffffff14}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
180
339
|
}
|
|
181
340
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TreeViewComponent, decorators: [{
|
|
182
341
|
type: Component,
|
|
183
|
-
args: [{ selector: 'ngx-tree-view', standalone: true, imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
184
|
-
<div class="ngx-tree-
|
|
185
|
-
|
|
186
|
-
|
|
342
|
+
args: [{ selector: 'ngx-tree-view', standalone: true, imports: [CommonModule, NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
343
|
+
<div class="ngx-tree-wrapper" [class.dark]="theme() === 'dark'">
|
|
344
|
+
<!-- Search Panel -->
|
|
345
|
+
@if (showSearch()) {
|
|
346
|
+
<div class="tree-search-bar">
|
|
347
|
+
<input
|
|
348
|
+
type="text"
|
|
349
|
+
class="tree-search-input"
|
|
350
|
+
[placeholder]="searchPlaceholder()"
|
|
351
|
+
[value]="searchQuery()"
|
|
352
|
+
(input)="onSearchInput($event)"
|
|
353
|
+
/>
|
|
354
|
+
@if (searchQuery()) {
|
|
355
|
+
<button class="tree-clear-btn" (click)="clearSearch()">✕</button>
|
|
356
|
+
}
|
|
357
|
+
</div>
|
|
187
358
|
}
|
|
188
359
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
[class.focused]="focusedId() === node.id"
|
|
195
|
-
[class.disabled]="node.disabled"
|
|
196
|
-
role="treeitem"
|
|
197
|
-
[attr.aria-expanded]="isExpanded(node.id)"
|
|
198
|
-
[attr.aria-selected]="selectedId() === node.id"
|
|
199
|
-
[attr.aria-disabled]="node.disabled || null"
|
|
200
|
-
(click)="!node.disabled && onNodeClick(node, $event)"
|
|
201
|
-
>
|
|
202
|
-
<!-- Expand/collapse -->
|
|
203
|
-
@if (hasNodeChildren(node)) {
|
|
204
|
-
<button
|
|
205
|
-
class="tree-expand-btn"
|
|
206
|
-
(click)="toggleExpand(node, $event)"
|
|
207
|
-
[attr.aria-label]="isExpanded(node.id) ? 'Collapse' : 'Expand'"
|
|
208
|
-
>
|
|
209
|
-
<span class="expand-icon" [class.expanded]="isExpanded(node.id)">►</span>
|
|
210
|
-
</button>
|
|
211
|
-
} @else {
|
|
212
|
-
<span class="tree-leaf-spacer"></span>
|
|
213
|
-
}
|
|
360
|
+
<!-- Tree Nodes Scroll Container -->
|
|
361
|
+
<div class="ngx-tree-view" role="tree" (keydown)="onKeyDown($event)" tabindex="0">
|
|
362
|
+
@for (node of filteredNodes(); track node.id) {
|
|
363
|
+
<ng-container *ngTemplateOutlet="nodeTemplate; context: { node: node, depth: 0 }"/>
|
|
364
|
+
}
|
|
214
365
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
366
|
+
<ng-template #nodeTemplate let-node="node" let-depth="depth">
|
|
367
|
+
<div
|
|
368
|
+
class="tree-node"
|
|
369
|
+
[class.selected]="selectedId() === node.id"
|
|
370
|
+
[class.focused]="focusedId() === node.id"
|
|
371
|
+
[class.disabled]="node.disabled"
|
|
372
|
+
role="treeitem"
|
|
373
|
+
[attr.aria-expanded]="isExpanded(node.id)"
|
|
374
|
+
[attr.aria-selected]="selectedId() === node.id"
|
|
375
|
+
[attr.aria-disabled]="node.disabled || null"
|
|
376
|
+
(click)="!node.disabled && onNodeClick(node, $event)"
|
|
377
|
+
>
|
|
378
|
+
<!-- Expand/collapse -->
|
|
379
|
+
@if (hasNodeChildren(node)) {
|
|
380
|
+
<button
|
|
381
|
+
class="tree-expand-btn"
|
|
382
|
+
(click)="toggleExpand(node, $event)"
|
|
383
|
+
[attr.aria-label]="isExpanded(node.id) ? 'Collapse' : 'Expand'"
|
|
384
|
+
>
|
|
385
|
+
<span class="expand-icon" [class.expanded]="isExpanded(node.id)">▶</span>
|
|
386
|
+
</button>
|
|
387
|
+
} @else {
|
|
388
|
+
<span class="tree-leaf-spacer"></span>
|
|
389
|
+
}
|
|
225
390
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
391
|
+
<!-- Checkbox -->
|
|
392
|
+
@if (checkable()) {
|
|
393
|
+
<input
|
|
394
|
+
type="checkbox"
|
|
395
|
+
class="tree-checkbox"
|
|
396
|
+
[checked]="isChecked(node.id)"
|
|
397
|
+
[indeterminate]="isIndeterminate(node.id)"
|
|
398
|
+
(change)="onCheck(node)"
|
|
399
|
+
(click)="$event.stopPropagation()"
|
|
400
|
+
/>
|
|
401
|
+
}
|
|
230
402
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
403
|
+
<!-- Icon -->
|
|
404
|
+
@if (node.icon) {
|
|
405
|
+
<span class="tree-icon">{{ node.icon }}</span>
|
|
406
|
+
}
|
|
234
407
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
408
|
+
<!-- Label -->
|
|
409
|
+
<span class="tree-label">{{ node.label }}</span>
|
|
410
|
+
|
|
411
|
+
<!-- Inline Hover Actions -->
|
|
412
|
+
@if (showActions() && !node.disabled) {
|
|
413
|
+
<div class="tree-node-actions" (click)="$event.stopPropagation()">
|
|
414
|
+
<button class="action-btn add" (click)="onAction(node, 'add')" title="Add Subnode">➕</button>
|
|
415
|
+
<button class="action-btn edit" (click)="onAction(node, 'edit')" title="Edit Node">✏️</button>
|
|
416
|
+
<button class="action-btn delete" (click)="onAction(node, 'delete')" title="Delete Node">🗑️</button>
|
|
417
|
+
</div>
|
|
418
|
+
}
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
<!-- Nested Children with गाइड Lines -->
|
|
422
|
+
@if (isExpanded(node.id) && node.children) {
|
|
423
|
+
<div class="tree-node-children-group">
|
|
424
|
+
@for (child of node.children; track child.id) {
|
|
425
|
+
<ng-container *ngTemplateOutlet="nodeTemplate; context: { node: child, depth: depth + 1 }"/>
|
|
426
|
+
}
|
|
427
|
+
</div>
|
|
239
428
|
}
|
|
240
|
-
|
|
241
|
-
</
|
|
429
|
+
</ng-template>
|
|
430
|
+
</div>
|
|
242
431
|
</div>
|
|
243
|
-
`, styles: [":host{display:block}.ngx-tree-
|
|
432
|
+
`, styles: [":host{display:block;width:100%}.ngx-tree-wrapper{display:flex;flex-direction:column;gap:8px;width:100%}.tree-search-bar{position:relative;display:flex;align-items:center;width:100%}.tree-search-input{width:100%;padding:8px 32px 8px 12px;font-size:13px;border:1px solid var(--border-color, #cbd5e1);border-radius:8px;outline:none;background:var(--bg-secondary, #ffffff);color:var(--text-primary, #0f172a);transition:all .2s ease}.tree-search-input:focus{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px #4f46e51f}.tree-clear-btn{position:absolute;right:10px;background:none;border:none;cursor:pointer;color:#94a3b8;font-size:11px;padding:4px}.tree-clear-btn:hover{color:#64748b}.ngx-tree-view{background:var(--bg-primary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;padding:8px;overflow-y:auto;max-height:480px;font-family:var(--ngx-font-family, system-ui, sans-serif);outline:none}.dark .ngx-tree-view{background:var(--bg-secondary, #1e293b);border-color:#ffffff14}.tree-node{display:flex;align-items:center;gap:6px;height:34px;padding:0 8px;cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:8px;margin:1px 0;transition:background .15s ease,color .15s ease;position:relative}.tree-node:hover{background:#0f172a0a}.dark .tree-node:hover{background:#ffffff0a}.tree-node.selected{background:#4f46e514;color:var(--primary-color, #4f46e5)}.dark .tree-node.selected{background:#6366f129;color:#818cf8}.tree-node.focused{box-shadow:inset 0 0 0 1.5px var(--primary-color, #4f46e5)}.tree-node.disabled{opacity:.45;cursor:not-allowed;pointer-events:none}.tree-expand-btn{width:20px;height:20px;background:none;border:none;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:4px;color:#94a3b8;transition:background .15s}.tree-expand-btn:hover{background:#0f172a14;color:#475569}.dark .tree-expand-btn:hover{background:#ffffff14;color:#cbd5e1}.expand-icon{font-size:8px;transition:transform .2s cubic-bezier(.2,.8,.2,1);display:inline-block}.expand-icon.expanded{transform:rotate(90deg)}.tree-leaf-spacer{width:20px;flex-shrink:0}.tree-checkbox{width:14px;height:14px;cursor:pointer;flex-shrink:0;accent-color:var(--primary-color, #4f46e5);border-radius:4px}.tree-icon{font-size:14px;flex-shrink:0}.tree-label{font-size:13px;color:var(--text-primary, #1e293b);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.selected .tree-label{font-weight:600}.dark .tree-label{color:#cbd5e1}.tree-node-actions{display:none;align-items:center;gap:4px;margin-left:auto;padding-left:8px}.tree-node:hover .tree-node-actions{display:flex}.action-btn{background:none;border:none;cursor:pointer;font-size:10px;padding:4px;border-radius:4px;transition:all .15s;opacity:.65}.action-btn:hover{opacity:1;background:#0f172a14}.dark .action-btn:hover{background:#ffffff14}.tree-node-children-group{position:relative;border-left:1px solid rgba(15,23,42,.08);margin-left:17px;padding-left:10px}.dark .tree-node-children-group{border-left-color:#ffffff14}\n"] }]
|
|
244
433
|
}] });
|
|
245
434
|
|
|
246
435
|
class ListViewComponent {
|