@nyx-ds/treeview 0.1.4 → 0.1.6
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/dist/treeview-lazy.d.ts +5 -0
- package/dist/treeview.d.ts +17 -3
- package/dist/treeview.js +563 -443
- package/dist/treeview.umd.cjs +36 -43
- package/package.json +2 -2
package/dist/treeview.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { property as
|
|
3
|
-
import { repeat as
|
|
4
|
-
import { classMap as
|
|
5
|
-
import { chevronRightRegular as
|
|
1
|
+
import { LitElement as Z, nothing as b, html as f, unsafeCSS as Y } from "lit";
|
|
2
|
+
import { property as J, state as m } from "lit/decorators.js";
|
|
3
|
+
import { repeat as Q } from "lit/directives/repeat.js";
|
|
4
|
+
import { classMap as g } from "lit/directives/class-map.js";
|
|
5
|
+
import { chevronRightRegular as X, magnifyingGlass as ee } from "@nyx-ds/core";
|
|
6
6
|
import "@lit-labs/virtualizer";
|
|
7
7
|
import "@nyx-ds/input";
|
|
8
8
|
import "@nyx-ds/checkbox";
|
|
9
9
|
import "@nyx-ds/radio";
|
|
10
10
|
import "@nyx-ds/icon";
|
|
11
11
|
import "@nyx-ds/button";
|
|
12
|
-
function
|
|
12
|
+
function te(o, e) {
|
|
13
13
|
return function(t, i) {
|
|
14
|
-
const { native: s = !1, ...r } = i || {},
|
|
15
|
-
|
|
14
|
+
const { native: s = !1, ...r } = i || {}, n = s ? new Event(e, r) : new CustomEvent(e, { detail: t, ...r });
|
|
15
|
+
o.dispatchEvent(n);
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function ie(o) {
|
|
19
19
|
return (e, t) => {
|
|
20
20
|
Object.defineProperty(e, t, {
|
|
21
21
|
get() {
|
|
22
|
-
return
|
|
22
|
+
return te(this, o);
|
|
23
23
|
},
|
|
24
24
|
enumerable: !0,
|
|
25
25
|
configurable: !0
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
function
|
|
29
|
+
const se = ":host{display:flex;flex-direction:column;width:100%;--treeview-radius: var(--nyx-radii-s);--treeview-search-padding: var(--nyx-sizing-1-25) var(--nyx-sizing-1-75) 0 var(--nyx-sizing-1-75);--treeview-header-padding: var(--nyx-sizing-2) var(--nyx-sizing-2) var(--nyx-sizing-1-75) var(--nyx-sizing-2);--treeview-row-padding: var(--nyx-sizing-1) var(--nyx-sizing-2);--treeview-row-gap: var(--nyx-sizing-2);--treeview-col-gap: var(--nyx-sizing-1);--treeview-node-gap: var(--nyx-sizing-1);--treeview-row-min-height: 48px;--treeview-indent-base: 16px;--treeview-indent-step: 24px;--treeview-expander-wrapper-size: var(--nyx-sizing-4);--treeview-expander-padding: var(--nyx-sizing-1-25);--treeview-col-width: var(--treeview-header-icon-size);--treeview-column-count: 0;--treeview-scrollbar-gutter: 0px;--treeview-background: var(--nyx-color-neutral-background-primary);--treeview-border-color: var(--nyx-color-neutral-border-tertiary);--treeview-content-color: var(--nyx-color-neutral-content-primary);--treeview-focus-border-color: var(--nyx-color-brand-border-default);--treeview-row-selected-background: var(--nyx-color-brand-background-softer);--treeview-row-selected-hover-background: var( --nyx-color-brand-background-softer-hover );--treeview-row-selected-color: var(--nyx-color-neutral-content-primary);--treeview-font-family: var(--nyx-font-family-font-family);--treeview-title-font-size: var(--nyx-label-medium-font-size);--treeview-title-line-height: var(--nyx-label-medium-line-height);--treeview-text-font-size: var(--nyx-label-medium-font-size);--treeview-text-line-height: var(--nyx-label-medium-line-height);--treeview-header-icon-size: var(--nyx-label-large-font-size);--treeview-node-icon-size: var(--nyx-label-medium-font-size);--treeview-expander-icon-size: var(--nyx-label-large-font-size);--treeview-row-hover-background: var(--nyx-color-neutral-background-secondary);--treeview-row-hover-color: var(--nyx-color-brand-content-hover)}.nyx-treeview{display:flex;flex-direction:column;width:100%;font-family:var(--treeview-font-family);align-items:flex-start;border-radius:var(--treeview-radius);border:1px solid var(--treeview-border-color);background:var(--treeview-background);box-sizing:border-box}.search-container{display:flex;padding:var(--treeview-search-padding);flex-direction:column;align-items:flex-start;align-self:stretch}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.tree-scroll{width:100%;display:flex;flex-direction:column;min-height:0}.tree-body--virtual{display:flex;flex-direction:column;flex:1 1 auto;min-height:280px;max-height:var(--treeview-max-height, 480px);overflow:hidden}.tree-virtualizer{flex:1 1 auto;width:100%;min-height:280px;scrollbar-gutter:stable}.node-wrapper--flat{width:100%}.tree-header{display:flex;justify-content:space-between;align-items:center;align-self:stretch;padding:var(--treeview-header-padding);border-bottom:.5px solid var(--treeview-border-color);box-sizing:border-box}.tree-title{color:var(--treeview-content-color);font-size:var(--treeview-title-font-size);line-height:var(--treeview-title-line-height);font-weight:600;flex:1 1 auto;min-width:0}.tree-header--no-columns .tree-title{flex:1 1 auto}.nyx-treeview--no-columns .header-columns,.nyx-treeview--no-columns .node-columns{display:none}.nyx-treeview--no-columns .tree-header{padding-inline-end:var(--nyx-sizing-2, 16px)}.header-columns,.node-columns{display:flex;align-items:center;justify-content:flex-end;gap:var(--treeview-col-gap);flex-shrink:0}.header-columns{padding-inline-end:0}.header-columns .col-cell{height:var(--treeview-header-icon-size);line-height:0}.header-columns slot{align-items:center;display:flex;height:100%;justify-content:center;line-height:0;width:100%}.nyx-treeview--virtual .header-columns{padding-inline-end:var(--treeview-scrollbar-gutter)}.col-cell{min-width:var(--treeview-col-width);width:var(--treeview-col-width);flex:0 0 auto;display:flex;justify-content:center;align-items:center;box-sizing:border-box}.header-columns ::slotted(nyx-icon){align-items:center;display:inline-flex;height:var(--treeview-header-icon-size);justify-content:center;line-height:0;width:var(--treeview-header-icon-size);--nyx-icon-size: var(--treeview-header-icon-size);color:var(--treeview-content-color)}.tree-body{width:100%;display:flex;flex-direction:column}.node-wrapper{display:flex;flex-direction:column;width:100%}.node-row{--treeview-row-level: 0;display:flex;align-items:center;justify-content:space-between;min-height:var(--treeview-row-min-height);border-bottom:.5px solid var(--treeview-border-color);gap:var(--treeview-row-gap);padding:var(--treeview-row-padding);padding-left:calc(var(--treeview-indent-base) + var(--treeview-row-level) * var(--treeview-indent-step));box-sizing:border-box;background:transparent;color:var(--treeview-content-color);outline:none;cursor:default}.node-row:hover{background:var(--treeview-row-hover-background);color:var(--treeview-row-hover-color)}.node-row:focus-within{background:var(--treeview-row-hover-background)!important;color:var(--treeview-row-hover-color)!important}.node-row:hover .expander nyx-icon,.node-row:hover .node-type-icon-wrapper ::slotted(nyx-icon){color:var(--treeview-row-hover-color)}.node-row:focus-within .expander nyx-icon,.node-row:focus-within .node-type-icon-wrapper ::slotted(nyx-icon){color:var(--treeview-row-hover-color)}.node-row.selectable.selected{background-color:var(--treeview-row-selected-background);color:var(--treeview-row-selected-color)}.node-row.selectable.selected .expander nyx-icon,.node-row.selectable.selected .node-type-icon-wrapper ::slotted(nyx-icon){color:var(--treeview-row-selected-color)}.node-row.selectable.selected:hover{background-color:var(--treeview-row-selected-hover-background);color:var(--treeview-row-selected-color)}.node-row.selectable.selected:focus-within{background-color:var(--treeview-row-selected-background)!important;color:var(--treeview-row-selected-color)!important}.node-row.selectable.selected:focus-within .expander nyx-icon,.node-row.selectable.selected:focus-within .node-type-icon-wrapper ::slotted(nyx-icon){color:var(--treeview-row-selected-color)}.node-row.selectable.selected:hover:focus-within{background-color:var(--treeview-row-selected-hover-background)!important}.node-row:focus-visible{position:relative;z-index:2;outline:2px solid var(--treeview-focus-border-color);outline-offset:-3px;background:var(--treeview-row-hover-background)!important;color:var(--treeview-row-hover-color)}.row-checkbox{display:flex;align-items:center;margin-right:4px}.node-info{display:flex;align-items:center;gap:var(--treeview-node-gap);flex:1 0 0;overflow:hidden;min-height:32px;padding-left:4px}.expander{--button-icon-color: inherit;flex-shrink:0;width:var(--treeview-expander-wrapper-size);min-width:var(--treeview-expander-wrapper-size)}.expander-placeholder{display:block;flex-shrink:0;width:var(--treeview-expander-wrapper-size);min-width:var(--treeview-expander-wrapper-size);height:var(--treeview-expander-wrapper-size)}.expander nyx-icon{--nyx-icon-size: var(--treeview-expander-icon-size);transition:transform .2s ease;transform-origin:center}.expander nyx-icon.expanded{transform:rotate(90deg)}.expander:hover,.expander:focus-within{--button-icon-color: var(--treeview-content-color) !important}.expander:hover nyx-icon,.expander:focus-within nyx-icon{color:var(--treeview-content-color)!important;--nyx-icon-color: var(--treeview-content-color) !important}.node-row:hover .expander:hover,.node-row:hover .expander:focus-within{--button-icon-color: var(--treeview-row-hover-color) !important}.node-row:hover .expander:hover nyx-icon,.node-row:hover .expander:focus-within nyx-icon{color:var(--treeview-row-hover-color)!important;--nyx-icon-color: var(--treeview-row-hover-color) !important}.node-type-icon-wrapper{display:flex;align-items:center;justify-content:center;flex-shrink:0}.node-type-icon-wrapper ::slotted(nyx-icon){--nyx-icon-size: var(--treeview-node-icon-size)}.node-text{font-size:var(--treeview-text-font-size);line-height:var(--treeview-text-line-height);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.node-children{width:100%}@media(max-width:768px){.tree-scroll{overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}.tree-header,.tree-body{min-width:calc(250px + ((var(--treeview-col-width) + var(--treeview-col-gap)) * var(--treeview-column-count)))}.node-text{white-space:normal;display:-webkit-box;line-clamp:2;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}}", re = 200;
|
|
30
|
+
function R(o, e) {
|
|
31
31
|
const t = e.trim().toLowerCase();
|
|
32
|
-
return t ?
|
|
32
|
+
return t ? o.toLowerCase().includes(t) : !1;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
34
|
+
function E(o, e) {
|
|
35
|
+
return o.includes(e);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function T(o) {
|
|
38
38
|
var s;
|
|
39
39
|
const e = /* @__PURE__ */ new Map(), t = [], i = [];
|
|
40
|
-
for (let r =
|
|
41
|
-
i.push({ node:
|
|
40
|
+
for (let r = o.length - 1; r >= 0; r--)
|
|
41
|
+
i.push({ node: o[r], parentId: null });
|
|
42
42
|
for (; i.length > 0; ) {
|
|
43
|
-
const { node: r, parentId:
|
|
43
|
+
const { node: r, parentId: n } = i.pop(), l = ((s = r.children) == null ? void 0 : s.map((a) => a.id)) ?? [];
|
|
44
44
|
if (e.set(r.id, {
|
|
45
45
|
id: r.id,
|
|
46
|
-
parentId:
|
|
46
|
+
parentId: n,
|
|
47
47
|
normalizedLabel: r.label.toLowerCase(),
|
|
48
|
-
childIds:
|
|
49
|
-
hasChildren:
|
|
50
|
-
}),
|
|
51
|
-
for (let
|
|
52
|
-
i.push({ node: r.children[
|
|
48
|
+
childIds: l,
|
|
49
|
+
hasChildren: l.length > 0
|
|
50
|
+
}), n === null && t.push(r.id), r.children)
|
|
51
|
+
for (let a = r.children.length - 1; a >= 0; a--)
|
|
52
|
+
i.push({ node: r.children[a], parentId: r.id });
|
|
53
53
|
}
|
|
54
54
|
return { roots: t, byId: e, size: e.size };
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function ne(o) {
|
|
57
57
|
const e = [], t = [];
|
|
58
|
-
for (let i =
|
|
59
|
-
t.push({ id:
|
|
58
|
+
for (let i = o.roots.length - 1; i >= 0; i--)
|
|
59
|
+
t.push({ id: o.roots[i], visited: !1 });
|
|
60
60
|
for (; t.length > 0; ) {
|
|
61
61
|
const i = t[t.length - 1];
|
|
62
62
|
if (i.visited)
|
|
63
63
|
t.pop(), e.push(i.id);
|
|
64
64
|
else {
|
|
65
65
|
i.visited = !0;
|
|
66
|
-
const s =
|
|
66
|
+
const s = o.byId.get(i.id);
|
|
67
67
|
if (!s) continue;
|
|
68
68
|
for (let r = s.childIds.length - 1; r >= 0; r--)
|
|
69
69
|
t.push({ id: s.childIds[r], visited: !1 });
|
|
@@ -71,72 +71,72 @@ function oe(n) {
|
|
|
71
71
|
}
|
|
72
72
|
return e;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function oe(o, e, t) {
|
|
75
75
|
const i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
|
|
76
|
-
for (const
|
|
77
|
-
const
|
|
78
|
-
if (!
|
|
79
|
-
const
|
|
80
|
-
|
|
76
|
+
for (const n of ne(o)) {
|
|
77
|
+
const l = o.byId.get(n);
|
|
78
|
+
if (!l) continue;
|
|
79
|
+
const a = E(
|
|
80
|
+
l.normalizedLabel,
|
|
81
81
|
e
|
|
82
82
|
);
|
|
83
83
|
let d = !1;
|
|
84
|
-
for (const
|
|
85
|
-
if (r.get(
|
|
84
|
+
for (const h of l.childIds)
|
|
85
|
+
if (r.get(h)) {
|
|
86
86
|
d = !0;
|
|
87
87
|
break;
|
|
88
88
|
}
|
|
89
|
-
const c =
|
|
90
|
-
if (r.set(
|
|
91
|
-
let
|
|
92
|
-
for (const
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
95
|
-
|
|
89
|
+
const c = a || d;
|
|
90
|
+
if (r.set(n, c), !c || (i.add(n), !l.hasChildren || !d)) continue;
|
|
91
|
+
let u = !1;
|
|
92
|
+
for (const h of l.childIds) {
|
|
93
|
+
const _ = o.byId.get(h);
|
|
94
|
+
if (_ && E(_.normalizedLabel, e)) {
|
|
95
|
+
u = !0;
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
!t.has(
|
|
99
|
+
!t.has(n) && (!a || u) && s.add(n);
|
|
100
100
|
}
|
|
101
101
|
return { visibleIds: i, expandIds: s };
|
|
102
102
|
}
|
|
103
|
-
function le(
|
|
103
|
+
function le(o, e) {
|
|
104
104
|
const t = e.trim().toLowerCase();
|
|
105
105
|
if (!t) return 0;
|
|
106
|
-
const i = Array.isArray(
|
|
106
|
+
const i = Array.isArray(o) ? T(o) : o;
|
|
107
107
|
let s = 0;
|
|
108
108
|
for (const r of i.byId.values())
|
|
109
|
-
|
|
109
|
+
E(r.normalizedLabel, t) && s++;
|
|
110
110
|
return s;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function ae(o, e, t = /* @__PURE__ */ new Set()) {
|
|
113
113
|
const i = e.trim().toLowerCase();
|
|
114
114
|
if (!i)
|
|
115
115
|
return { visibleIds: /* @__PURE__ */ new Set(), expandIds: /* @__PURE__ */ new Set() };
|
|
116
|
-
const s = Array.isArray(
|
|
117
|
-
return
|
|
116
|
+
const s = Array.isArray(o) ? T(o) : o;
|
|
117
|
+
return oe(s, i, t);
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
const i =
|
|
119
|
+
function q(o, e, t = "") {
|
|
120
|
+
const i = o.children ?? [], s = t.trim().toLowerCase();
|
|
121
121
|
return s ? i.filter(
|
|
122
|
-
(r) => e.has(r.id) ||
|
|
122
|
+
(r) => e.has(r.id) || R(r.label, s)
|
|
123
123
|
) : i.filter((r) => e.has(r.id));
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function de(o, e, t) {
|
|
126
126
|
const i = e.trim().toLowerCase();
|
|
127
127
|
if (!i) return !1;
|
|
128
|
-
const s = [
|
|
128
|
+
const s = [o];
|
|
129
129
|
for (; s.length > 0; ) {
|
|
130
130
|
const r = s.pop();
|
|
131
|
-
for (const
|
|
132
|
-
if (
|
|
133
|
-
s.push(
|
|
131
|
+
for (const n of t(r) ?? []) {
|
|
132
|
+
if (R(n.label, i)) return !0;
|
|
133
|
+
s.push(n.id);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
return !1;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
const i = [
|
|
138
|
+
function ce(o, e, t) {
|
|
139
|
+
const i = [o];
|
|
140
140
|
for (; i.length > 0; ) {
|
|
141
141
|
const s = i.pop();
|
|
142
142
|
for (const r of t(s) ?? []) {
|
|
@@ -146,292 +146,299 @@ function he(n, e, t) {
|
|
|
146
146
|
}
|
|
147
147
|
return !1;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
return
|
|
149
|
+
function L(o, e, t, i, s, r) {
|
|
150
|
+
return H(o, e, t) && !ce(i, s, r) && !de(i, e, r);
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
return
|
|
152
|
+
function H(o, e, t) {
|
|
153
|
+
return R(o, e) && !t;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
return t ||
|
|
155
|
+
function O(o, e, t, i) {
|
|
156
|
+
return t || H(o, e, i);
|
|
157
157
|
}
|
|
158
|
-
function k(
|
|
158
|
+
function k(o, e) {
|
|
159
159
|
var t, i;
|
|
160
160
|
if (e) {
|
|
161
|
-
if (
|
|
162
|
-
} else if ((((t =
|
|
161
|
+
if (o.selected) return !0;
|
|
162
|
+
} else if ((((t = o.selectedColumns) == null ? void 0 : t.length) ?? 0) > 0)
|
|
163
163
|
return !0;
|
|
164
|
-
return ((i =
|
|
164
|
+
return ((i = o.children) == null ? void 0 : i.some(
|
|
165
165
|
(s) => k(s, e)
|
|
166
166
|
)) ?? !1;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
const t =
|
|
168
|
+
function j(o, e) {
|
|
169
|
+
const t = o.map((i, s) => ({ node: i, index: s }));
|
|
170
170
|
return t.sort((i, s) => {
|
|
171
|
-
const r = k(i.node, e),
|
|
172
|
-
return r !==
|
|
171
|
+
const r = k(i.node, e), n = k(s.node, e);
|
|
172
|
+
return r !== n ? r ? -1 : 1 : i.index - s.index;
|
|
173
173
|
}), t.map(({ node: i }) => {
|
|
174
174
|
var s;
|
|
175
175
|
return (s = i.children) != null && s.length ? {
|
|
176
176
|
...i,
|
|
177
|
-
children:
|
|
177
|
+
children: j(i.children, e)
|
|
178
178
|
} : i;
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
|
-
const
|
|
182
|
-
function
|
|
183
|
-
const e = [], t =
|
|
181
|
+
const y = 50;
|
|
182
|
+
function he(o) {
|
|
183
|
+
const e = [], t = o.map((s) => ({ node: s, depth: 0, parentId: null }));
|
|
184
184
|
let i = 0;
|
|
185
185
|
for (; i < t.length; ) {
|
|
186
|
-
const s = t[i++], { node: r, depth:
|
|
186
|
+
const s = t[i++], { node: r, depth: n, parentId: l } = s, a = !!(r.children && r.children.length > 0);
|
|
187
187
|
if (e.push({
|
|
188
188
|
id: r.id,
|
|
189
|
-
depth:
|
|
190
|
-
parentId:
|
|
191
|
-
hasChildrenInSource:
|
|
192
|
-
}),
|
|
189
|
+
depth: n,
|
|
190
|
+
parentId: l,
|
|
191
|
+
hasChildrenInSource: a
|
|
192
|
+
}), a)
|
|
193
193
|
for (const d of r.children)
|
|
194
|
-
t.push({ node: d, depth:
|
|
194
|
+
t.push({ node: d, depth: n + 1, parentId: r.id });
|
|
195
195
|
}
|
|
196
196
|
return e;
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function ue(o, e = y) {
|
|
199
199
|
const t = /* @__PURE__ */ new Set();
|
|
200
|
-
for (const i of
|
|
200
|
+
for (const i of o)
|
|
201
201
|
if (i.depth === 0 && (t.add(i.id), t.size >= e))
|
|
202
202
|
break;
|
|
203
203
|
return t;
|
|
204
204
|
}
|
|
205
|
-
function _e(
|
|
205
|
+
function _e(o, e, t) {
|
|
206
206
|
const i = [];
|
|
207
|
-
for (const s of
|
|
207
|
+
for (const s of o)
|
|
208
208
|
if (s.depth === 0 && !e.has(s.id) && (i.push(s.id), i.length >= t))
|
|
209
209
|
break;
|
|
210
210
|
return i;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
return
|
|
212
|
+
function fe(o, e) {
|
|
213
|
+
return o.some((t) => t.depth === 0 && !e.has(t.id));
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
return
|
|
215
|
+
function pe(o, e, t) {
|
|
216
|
+
return A(e, o).some((i) => !t.has(i));
|
|
217
217
|
}
|
|
218
|
-
function G(
|
|
218
|
+
function G(o, e, t) {
|
|
219
219
|
return e.some(
|
|
220
|
-
(i) => i.parentId ===
|
|
220
|
+
(i) => i.parentId === o && !t.has(i.id)
|
|
221
221
|
);
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
223
|
+
function we(o, e) {
|
|
224
|
+
const t = o[e];
|
|
225
|
+
if (!t) return e;
|
|
226
|
+
let i = e;
|
|
227
|
+
for (let s = e + 1; s < o.length && !(o[s].level <= t.level); s++)
|
|
228
|
+
i = s;
|
|
229
|
+
return i;
|
|
229
230
|
}
|
|
230
|
-
function
|
|
231
|
-
|
|
231
|
+
function me(o, e, t, i, s, r, n = 0) {
|
|
232
|
+
if (o.length === 0) return;
|
|
233
|
+
const l = Math.min(
|
|
232
234
|
Math.max(0, e),
|
|
233
|
-
Math.max(0,
|
|
234
|
-
)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
235
|
+
Math.max(0, o.length - 1)
|
|
236
|
+
), a = Math.min(
|
|
237
|
+
Math.max(l, t),
|
|
238
|
+
Math.max(0, o.length - 1)
|
|
239
|
+
), d = Math.max(0, Math.floor(n));
|
|
240
|
+
let c;
|
|
241
|
+
for (let u = 0; u < o.length; u++) {
|
|
242
|
+
const h = o[u];
|
|
243
|
+
if (!i.has(h.node.id) || !G(h.node.id, s, r)) continue;
|
|
244
|
+
const _ = we(o, u), v = Math.max(u, _ - d);
|
|
245
|
+
l <= _ && a >= v && (c = h.node.id);
|
|
246
|
+
}
|
|
247
|
+
return c;
|
|
241
248
|
}
|
|
242
|
-
function
|
|
249
|
+
function ve(o, e) {
|
|
243
250
|
const t = [];
|
|
244
|
-
let i = e.get(
|
|
251
|
+
let i = e.get(o);
|
|
245
252
|
for (; (i == null ? void 0 : i.parentId) != null; )
|
|
246
253
|
t.push(i.parentId), i = e.get(i.parentId);
|
|
247
254
|
return t;
|
|
248
255
|
}
|
|
249
|
-
function V(
|
|
256
|
+
function V(o, e, t) {
|
|
250
257
|
if (t < 0) return [];
|
|
251
|
-
const i =
|
|
258
|
+
const i = M(o), s = [];
|
|
252
259
|
for (const r of e) {
|
|
253
|
-
const
|
|
260
|
+
const n = [
|
|
254
261
|
{ id: r, level: 0 }
|
|
255
262
|
];
|
|
256
|
-
for (;
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
259
|
-
s.push(
|
|
260
|
-
const
|
|
261
|
-
if (!(!(
|
|
262
|
-
for (let d =
|
|
263
|
-
|
|
263
|
+
for (; n.length > 0; ) {
|
|
264
|
+
const l = n.pop();
|
|
265
|
+
if (l.level > t) continue;
|
|
266
|
+
s.push(l.id);
|
|
267
|
+
const a = i.get(l.id);
|
|
268
|
+
if (!(!(a != null && a.length) || l.level >= t))
|
|
269
|
+
for (let d = a.length - 1; d >= 0; d--)
|
|
270
|
+
n.push({ id: a[d], level: l.level + 1 });
|
|
264
271
|
}
|
|
265
272
|
}
|
|
266
273
|
return s;
|
|
267
274
|
}
|
|
268
|
-
function xe(
|
|
275
|
+
function xe(o, e, t) {
|
|
269
276
|
if (t <= 0) return [];
|
|
270
|
-
const i =
|
|
277
|
+
const i = M(o), s = [];
|
|
271
278
|
for (const r of e) {
|
|
272
|
-
const
|
|
279
|
+
const n = [
|
|
273
280
|
{ id: r, level: 0 }
|
|
274
281
|
];
|
|
275
|
-
for (;
|
|
276
|
-
const
|
|
277
|
-
if (
|
|
278
|
-
const
|
|
279
|
-
if (
|
|
280
|
-
s.push(
|
|
281
|
-
for (let d =
|
|
282
|
-
|
|
282
|
+
for (; n.length > 0; ) {
|
|
283
|
+
const l = n.pop();
|
|
284
|
+
if (l.level >= t) continue;
|
|
285
|
+
const a = i.get(l.id);
|
|
286
|
+
if (a != null && a.length) {
|
|
287
|
+
s.push(l.id);
|
|
288
|
+
for (let d = a.length - 1; d >= 0; d--)
|
|
289
|
+
n.push({ id: a[d], level: l.level + 1 });
|
|
283
290
|
}
|
|
284
291
|
}
|
|
285
292
|
}
|
|
286
293
|
return s;
|
|
287
294
|
}
|
|
288
|
-
function
|
|
289
|
-
const s = [], r = (
|
|
290
|
-
s.length >= t || !e.has(
|
|
295
|
+
function B(o, e, t, i) {
|
|
296
|
+
const s = [], r = (n) => {
|
|
297
|
+
s.length >= t || !e.has(n) && !s.includes(n) && s.push(n);
|
|
291
298
|
};
|
|
292
299
|
if (i != null) {
|
|
293
|
-
const
|
|
294
|
-
for (const
|
|
300
|
+
const n = A(o, i);
|
|
301
|
+
for (const l of n) r(l);
|
|
295
302
|
}
|
|
296
|
-
for (const
|
|
297
|
-
if (r(
|
|
303
|
+
for (const n of o)
|
|
304
|
+
if (r(n.id), s.length >= t) break;
|
|
298
305
|
return s;
|
|
299
306
|
}
|
|
300
|
-
function
|
|
301
|
-
const t =
|
|
307
|
+
function A(o, e) {
|
|
308
|
+
const t = M(o), i = [], s = [e];
|
|
302
309
|
for (; s.length > 0; ) {
|
|
303
310
|
const r = s.pop();
|
|
304
311
|
i.push(r);
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
307
|
-
for (let
|
|
308
|
-
s.push(
|
|
312
|
+
const n = t.get(r);
|
|
313
|
+
if (n != null && n.length)
|
|
314
|
+
for (let l = n.length - 1; l >= 0; l--)
|
|
315
|
+
s.push(n[l]);
|
|
309
316
|
}
|
|
310
317
|
return i;
|
|
311
318
|
}
|
|
312
|
-
function
|
|
319
|
+
function M(o) {
|
|
313
320
|
const e = /* @__PURE__ */ new Map();
|
|
314
|
-
for (const t of
|
|
321
|
+
for (const t of o) {
|
|
315
322
|
const i = t.parentId;
|
|
316
323
|
e.has(i) || e.set(i, []), e.get(i).push(t.id);
|
|
317
324
|
}
|
|
318
325
|
return e;
|
|
319
326
|
}
|
|
320
|
-
function be(
|
|
321
|
-
return
|
|
327
|
+
function be(o, e, t) {
|
|
328
|
+
return A(o, e).filter((i) => !t.has(i));
|
|
322
329
|
}
|
|
323
|
-
function ge(
|
|
324
|
-
return be(
|
|
330
|
+
function ge(o, e, t, i = y) {
|
|
331
|
+
return be(o, e, t).slice(0, i);
|
|
325
332
|
}
|
|
326
|
-
function
|
|
333
|
+
function D(o) {
|
|
327
334
|
var e;
|
|
328
335
|
return {
|
|
329
|
-
...
|
|
330
|
-
selectedColumns:
|
|
331
|
-
disabledColumns:
|
|
332
|
-
children: (e =
|
|
333
|
-
data:
|
|
336
|
+
...o,
|
|
337
|
+
selectedColumns: o.selectedColumns ? [...o.selectedColumns] : void 0,
|
|
338
|
+
disabledColumns: o.disabledColumns ? [...o.disabledColumns] : void 0,
|
|
339
|
+
children: (e = o.children) == null ? void 0 : e.map((t) => D(t)),
|
|
340
|
+
data: o.data
|
|
334
341
|
};
|
|
335
342
|
}
|
|
336
|
-
function ye(
|
|
343
|
+
function ye(o) {
|
|
337
344
|
const e = /* @__PURE__ */ new Map(), t = (i) => {
|
|
338
345
|
var s;
|
|
339
346
|
e.set(i.id, i), (s = i.children) == null || s.forEach(t);
|
|
340
347
|
};
|
|
341
|
-
return
|
|
348
|
+
return o.forEach(t), e;
|
|
342
349
|
}
|
|
343
|
-
function
|
|
350
|
+
function Se(o, e, t) {
|
|
344
351
|
const i = (s) => {
|
|
345
352
|
if (!e.has(s.id)) return null;
|
|
346
|
-
const r = t.get(s.id) ?? s,
|
|
347
|
-
return
|
|
353
|
+
const r = t.get(s.id) ?? s, n = (r.children ?? []).map((a) => i(a)).filter((a) => a !== null), l = D(r);
|
|
354
|
+
return l.children = n.length > 0 ? n : void 0, l;
|
|
348
355
|
};
|
|
349
|
-
return
|
|
356
|
+
return o.map((s) => i(s)).filter((s) => s !== null);
|
|
350
357
|
}
|
|
351
|
-
function
|
|
352
|
-
const e = [], t =
|
|
353
|
-
const d =
|
|
358
|
+
function P(o) {
|
|
359
|
+
const e = [], t = o.searchTerm.trim().toLowerCase(), i = (s, r, n, l, a = !1) => {
|
|
360
|
+
const d = o.hasSearch && !a ? s.filter((c) => o.searchVisibleIds.has(c.id)) : s;
|
|
354
361
|
for (const c of d) {
|
|
355
|
-
const
|
|
362
|
+
const u = o.hasSearch && !!t && c.label.toLowerCase().includes(t), h = O(
|
|
356
363
|
c.label,
|
|
357
364
|
t,
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
),
|
|
365
|
+
n,
|
|
366
|
+
l
|
|
367
|
+
), _ = l || !!u;
|
|
361
368
|
if (e.push({
|
|
362
369
|
node: c,
|
|
363
370
|
level: r,
|
|
364
|
-
revealSubtree:
|
|
365
|
-
parentLabelMatched:
|
|
366
|
-
hasChildrenInSource:
|
|
367
|
-
}), !
|
|
368
|
-
const
|
|
369
|
-
var
|
|
370
|
-
return (
|
|
371
|
-
}),
|
|
371
|
+
revealSubtree: h,
|
|
372
|
+
parentLabelMatched: _,
|
|
373
|
+
hasChildrenInSource: o.sourceHasChildren(c.id)
|
|
374
|
+
}), !o.expandedIds.has(c.id)) continue;
|
|
375
|
+
const S = o.getSourceChildren ?? ((z) => {
|
|
376
|
+
var N;
|
|
377
|
+
return (N = o.items.find((K) => K.id === z)) == null ? void 0 : N.children;
|
|
378
|
+
}), I = !o.hasSearch || h && L(
|
|
372
379
|
c.label,
|
|
373
380
|
t,
|
|
374
|
-
|
|
381
|
+
l,
|
|
375
382
|
c.id,
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
) ? c.children ?? [] :
|
|
383
|
+
o.searchVisibleIds,
|
|
384
|
+
S
|
|
385
|
+
) ? c.children ?? [] : q(
|
|
379
386
|
c,
|
|
380
|
-
|
|
381
|
-
|
|
387
|
+
o.searchVisibleIds,
|
|
388
|
+
o.searchTerm
|
|
382
389
|
);
|
|
383
|
-
|
|
390
|
+
I.length > 0 && i(I, r + 1, h, _, !0);
|
|
384
391
|
}
|
|
385
392
|
};
|
|
386
|
-
return i(
|
|
393
|
+
return i(o.items, 0, !1, !1), e;
|
|
387
394
|
}
|
|
388
|
-
function
|
|
389
|
-
for (const t of
|
|
395
|
+
function C(o, e) {
|
|
396
|
+
for (const t of o)
|
|
390
397
|
if (!e.has(t)) return !0;
|
|
391
398
|
return !1;
|
|
392
399
|
}
|
|
393
|
-
function
|
|
394
|
-
const s = [], r = (
|
|
395
|
-
s.length >= i || !e.has(
|
|
400
|
+
function W(o, e, t, i = y) {
|
|
401
|
+
const s = [], r = (n) => {
|
|
402
|
+
s.length >= i || !e.has(n) && !s.includes(n) && s.push(n);
|
|
396
403
|
};
|
|
397
|
-
for (const
|
|
398
|
-
if (!e.has(
|
|
399
|
-
r(
|
|
400
|
-
for (const
|
|
401
|
-
r(
|
|
404
|
+
for (const n of o)
|
|
405
|
+
if (!e.has(n)) {
|
|
406
|
+
r(n);
|
|
407
|
+
for (const l of ve(n, t))
|
|
408
|
+
r(l);
|
|
402
409
|
if (s.length >= i) break;
|
|
403
410
|
}
|
|
404
411
|
return s;
|
|
405
412
|
}
|
|
406
|
-
function
|
|
407
|
-
const s =
|
|
408
|
-
|
|
413
|
+
function F(o, e, t, i = y) {
|
|
414
|
+
const s = W(
|
|
415
|
+
o,
|
|
409
416
|
e,
|
|
410
417
|
t,
|
|
411
418
|
i
|
|
412
419
|
);
|
|
413
420
|
return s.length === 0 ? !1 : (s.forEach((r) => e.add(r)), !0);
|
|
414
421
|
}
|
|
415
|
-
function
|
|
416
|
-
return e ? `Collapse ${
|
|
422
|
+
function Ie(o, e) {
|
|
423
|
+
return e ? `Collapse ${o}` : `Expand ${o}`;
|
|
417
424
|
}
|
|
418
|
-
function
|
|
419
|
-
return `Select ${
|
|
425
|
+
function U(o) {
|
|
426
|
+
return `Select ${o}`;
|
|
420
427
|
}
|
|
421
|
-
function Ce(
|
|
422
|
-
return `${
|
|
428
|
+
function Ce(o, e) {
|
|
429
|
+
return `${o}, ${e}`;
|
|
423
430
|
}
|
|
424
|
-
function Re(
|
|
425
|
-
return
|
|
431
|
+
function Re(o) {
|
|
432
|
+
return o === 0 ? "No results found" : o === 1 ? "1 result found" : `${o} results found`;
|
|
426
433
|
}
|
|
427
|
-
var ze = Object.defineProperty, Ee = Object.getOwnPropertyDescriptor,
|
|
428
|
-
for (var s = i > 1 ? void 0 : i ? Ee(e, t) : e, r =
|
|
429
|
-
(
|
|
434
|
+
var ze = Object.defineProperty, Ee = Object.getOwnPropertyDescriptor, w = (o, e, t, i) => {
|
|
435
|
+
for (var s = i > 1 ? void 0 : i ? Ee(e, t) : e, r = o.length - 1, n; r >= 0; r--)
|
|
436
|
+
(n = o[r]) && (s = (i ? n(e, t, s) : n(s)) || s);
|
|
430
437
|
return i && s && ze(e, t, s), s;
|
|
431
|
-
},
|
|
432
|
-
const
|
|
438
|
+
}, x;
|
|
439
|
+
const p = (x = class extends Z {
|
|
433
440
|
constructor() {
|
|
434
|
-
super(...arguments), this._rowSelectionRadioName = `nyx-treeview-row-selection-${
|
|
441
|
+
super(...arguments), this._rowSelectionRadioName = `nyx-treeview-row-selection-${x._nextTreeviewId++}`, this._items = [], this._expandedIds = /* @__PURE__ */ new Set(), this._searchTerm = "", this._searchStatusMessage = "", this._searchVisibleIds = /* @__PURE__ */ new Set(), this._searchUserCollapsedIds = /* @__PURE__ */ new Set(), this._searchManualExpandedIds = /* @__PURE__ */ new Set(), this._expandedIdsBeforeSearch = null, this._flatRows = [], this._loadedIds = /* @__PURE__ */ new Set(), this._activeRowId = null, this._sourceItems = [], this._lazyItemsSourceRef = null, this._treeIndex = [], this._indexById = /* @__PURE__ */ new Map(), this._sourceById = /* @__PURE__ */ new Map(), this._lazyScrollLoading = !1, this._lazyVisibleFirst = 0, this._lazyVisibleLast = 9, this._scrollbarGutter = 0, this._searchIndex = null, this._searchIndexSourceRef = null, this._searchDebounceTimer = null, this._selectionStatsById = /* @__PURE__ */ new Map(), this._selectionStatsDirty = !0;
|
|
435
442
|
}
|
|
436
443
|
get options() {
|
|
437
444
|
return this._options;
|
|
@@ -447,7 +454,7 @@ const u = (v = class extends Y {
|
|
|
447
454
|
_getLazyPageSize() {
|
|
448
455
|
var t;
|
|
449
456
|
const e = (t = this.options) == null ? void 0 : t.lazyLoadPageSize;
|
|
450
|
-
return e == null || !Number.isFinite(e) ?
|
|
457
|
+
return e == null || !Number.isFinite(e) ? y : Math.max(1, Math.floor(e));
|
|
451
458
|
}
|
|
452
459
|
_hasColumnPermissions() {
|
|
453
460
|
var e, t, i;
|
|
@@ -470,8 +477,8 @@ const u = (v = class extends Y {
|
|
|
470
477
|
}
|
|
471
478
|
_applyItemsFromOptions(e) {
|
|
472
479
|
var i;
|
|
473
|
-
let t = e.map((s) =>
|
|
474
|
-
return this._usesUniqueRowSelection() && this._applyUniqueSelectionConstraint(t), (i = this.options) != null && i.sortSelectedFirst && (t =
|
|
480
|
+
let t = e.map((s) => D(s));
|
|
481
|
+
return this._usesUniqueRowSelection() && this._applyUniqueSelectionConstraint(t), (i = this.options) != null && i.sortSelectedFirst && (t = j(t, this._usesSimpleRowSelection())), t;
|
|
475
482
|
}
|
|
476
483
|
_applyUniqueSelectionConstraint(e) {
|
|
477
484
|
let t = !1;
|
|
@@ -484,7 +491,7 @@ const u = (v = class extends Y {
|
|
|
484
491
|
}
|
|
485
492
|
_applyOptionsChange() {
|
|
486
493
|
if (this.options) {
|
|
487
|
-
if (this._isLazyEnabled()) {
|
|
494
|
+
if (this._invalidateSelectionStats(), this._isLazyEnabled()) {
|
|
488
495
|
this.options.items !== this._lazyItemsSourceRef && (this._initLazyState(), this._resetSearchDerivedState(), this._searchTerm.trim() && this._recomputeSearchFilter());
|
|
489
496
|
return;
|
|
490
497
|
}
|
|
@@ -501,8 +508,8 @@ const u = (v = class extends Y {
|
|
|
501
508
|
}
|
|
502
509
|
_initLazyState() {
|
|
503
510
|
var s;
|
|
504
|
-
this._lazyItemsSourceRef = this.options.items, this._sourceItems = this._applyItemsFromOptions(this.options.items), this._invalidateSearchIndex(), this._treeIndex =
|
|
505
|
-
const e = (s = this.options) == null ? void 0 : s.defaultExpandedLevel, t = this._getLazyPageSize(), i =
|
|
511
|
+
this._lazyItemsSourceRef = this.options.items, this._sourceItems = this._applyItemsFromOptions(this.options.items), this._invalidateSelectionStats(), this._invalidateSearchIndex(), this._treeIndex = he(this._sourceItems), this._indexById = new Map(this._treeIndex.map((r) => [r.id, r])), this._sourceById = ye(this._sourceItems);
|
|
512
|
+
const e = (s = this.options) == null ? void 0 : s.defaultExpandedLevel, t = this._getLazyPageSize(), i = ue(this._treeIndex, t);
|
|
506
513
|
this._loadedIds = new Set(i), e !== void 0 && e > 0 && this._loadDefaultExpandedLevelForRoots(i, e), this._expandedIds = /* @__PURE__ */ new Set(), e !== void 0 && e > 0 && this._applyLazyDefaultExpansion(i, e), this._activeRowId = null, this._rebuildMaterializedItems(), this._commitLazyRows();
|
|
507
514
|
}
|
|
508
515
|
_loadDefaultExpandedLevelForRoots(e, t) {
|
|
@@ -516,7 +523,7 @@ const u = (v = class extends Y {
|
|
|
516
523
|
), this._expandedIds = new Set(this._expandedIds);
|
|
517
524
|
}
|
|
518
525
|
_rebuildMaterializedItems() {
|
|
519
|
-
this._items =
|
|
526
|
+
this._items = Se(
|
|
520
527
|
this._sourceItems,
|
|
521
528
|
this._loadedIds,
|
|
522
529
|
this._sourceById
|
|
@@ -529,6 +536,42 @@ const u = (v = class extends Y {
|
|
|
529
536
|
_selectionNode(e) {
|
|
530
537
|
return this._isLazyEnabled() ? this._sourceById.get(e.id) ?? e : e;
|
|
531
538
|
}
|
|
539
|
+
_invalidateSelectionStats() {
|
|
540
|
+
this._selectionStatsDirty = !0;
|
|
541
|
+
}
|
|
542
|
+
_prepareSelectionStatsCache() {
|
|
543
|
+
this._selectionStatsDirty && (this._selectionStatsById.clear(), this._selectionStatsDirty = !1);
|
|
544
|
+
}
|
|
545
|
+
_buildSelectionStats(e) {
|
|
546
|
+
var d, c, u;
|
|
547
|
+
const t = ((c = (d = this.options) == null ? void 0 : d.columns) == null ? void 0 : c.map((h) => h.id)) ?? [], i = new Map(
|
|
548
|
+
t.map((h) => [h, 0])
|
|
549
|
+
);
|
|
550
|
+
let s = 0, r = 0, n = 0, l = 0;
|
|
551
|
+
for (const h of e.children ?? []) {
|
|
552
|
+
const _ = this._getSelectionStats(h);
|
|
553
|
+
s += 1 + _.descendantCount, h.selected && l++, l += _.simpleSelectedDescendantCount, (u = h.children) != null && u.length ? (r += _.simpleLeafCount, n += _.simpleSelectedLeafCount) : (r++, h.selected && n++);
|
|
554
|
+
for (const v of t) {
|
|
555
|
+
const S = this._isNodeSelected(h, v) ? 1 : 0;
|
|
556
|
+
i.set(
|
|
557
|
+
v,
|
|
558
|
+
(i.get(v) ?? 0) + S + (_.selectedDescendantCountByColumn.get(v) ?? 0)
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
const a = {
|
|
563
|
+
descendantCount: s,
|
|
564
|
+
selectedDescendantCountByColumn: i,
|
|
565
|
+
simpleLeafCount: r,
|
|
566
|
+
simpleSelectedLeafCount: n,
|
|
567
|
+
simpleSelectedDescendantCount: l
|
|
568
|
+
};
|
|
569
|
+
return this._selectionStatsById.set(e.id, a), a;
|
|
570
|
+
}
|
|
571
|
+
_getSelectionStats(e) {
|
|
572
|
+
const t = this._selectionNode(e);
|
|
573
|
+
return this._prepareSelectionStatsCache(), this._selectionStatsById.get(t.id) ?? this._buildSelectionStats(t);
|
|
574
|
+
}
|
|
532
575
|
_invalidateSearchIndex() {
|
|
533
576
|
this._searchIndex = null, this._searchIndexSourceRef = null;
|
|
534
577
|
}
|
|
@@ -538,11 +581,28 @@ const u = (v = class extends Y {
|
|
|
538
581
|
}
|
|
539
582
|
_ensureSearchIndex() {
|
|
540
583
|
const e = this._selectionRoots();
|
|
541
|
-
return this._searchIndex && this._searchIndexSourceRef === e ? this._searchIndex : (this._searchIndexSourceRef = e, this._searchIndex =
|
|
584
|
+
return this._searchIndex && this._searchIndexSourceRef === e ? this._searchIndex : (this._searchIndexSourceRef = e, this._searchIndex = T(e), this._searchIndex);
|
|
542
585
|
}
|
|
543
586
|
disconnectedCallback() {
|
|
544
587
|
super.disconnectedCallback(), this._searchDebounceTimer !== null && (clearTimeout(this._searchDebounceTimer), this._searchDebounceTimer = null);
|
|
545
588
|
}
|
|
589
|
+
updated(e) {
|
|
590
|
+
if (super.updated(e), !this._isLazyEnabled()) {
|
|
591
|
+
this._scrollbarGutter !== 0 && (this._scrollbarGutter = 0);
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
requestAnimationFrame(() => this._syncScrollbarGutter());
|
|
595
|
+
}
|
|
596
|
+
_syncScrollbarGutter() {
|
|
597
|
+
var i;
|
|
598
|
+
const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(
|
|
599
|
+
".tree-virtualizer"
|
|
600
|
+
), t = Math.max(
|
|
601
|
+
0,
|
|
602
|
+
((e == null ? void 0 : e.offsetWidth) ?? 0) - ((e == null ? void 0 : e.clientWidth) ?? 0)
|
|
603
|
+
);
|
|
604
|
+
this._scrollbarGutter !== t && (this._scrollbarGutter = t);
|
|
605
|
+
}
|
|
546
606
|
_findNodeById(e, t) {
|
|
547
607
|
for (const i of e) {
|
|
548
608
|
if (i.id === t) return i;
|
|
@@ -553,11 +613,11 @@ const u = (v = class extends Y {
|
|
|
553
613
|
}
|
|
554
614
|
}
|
|
555
615
|
_forEachInSubtree(e, t, i) {
|
|
556
|
-
const s = this._findNodeById(e, t);
|
|
616
|
+
const s = this._isLazyEnabled() ? this._sourceById.get(t) : this._findNodeById(e, t);
|
|
557
617
|
if (!s) return;
|
|
558
|
-
const r = (
|
|
559
|
-
var
|
|
560
|
-
i(
|
|
618
|
+
const r = (n) => {
|
|
619
|
+
var l;
|
|
620
|
+
i(n), (l = n.children) == null || l.forEach(r);
|
|
561
621
|
};
|
|
562
622
|
r(s);
|
|
563
623
|
}
|
|
@@ -566,20 +626,20 @@ const u = (v = class extends Y {
|
|
|
566
626
|
return t == null ? void 0 : t.children;
|
|
567
627
|
}
|
|
568
628
|
_loadMoreNodes(e) {
|
|
569
|
-
var
|
|
629
|
+
var n, l;
|
|
570
630
|
if (!this._isLazyEnabled()) return;
|
|
571
631
|
const t = this._getLazyPageSize();
|
|
572
632
|
let i, s = [];
|
|
573
633
|
if (this._isSearchActive())
|
|
574
|
-
if (
|
|
575
|
-
i =
|
|
634
|
+
if (C(this._searchVisibleIds, this._loadedIds))
|
|
635
|
+
i = W(
|
|
576
636
|
this._searchVisibleIds,
|
|
577
637
|
this._loadedIds,
|
|
578
638
|
this._indexById,
|
|
579
639
|
t
|
|
580
640
|
);
|
|
581
641
|
else if (e != null && this._hasExclusiveSearchFolderWithUnloadedChildren())
|
|
582
|
-
i =
|
|
642
|
+
i = B(
|
|
583
643
|
this._treeIndex,
|
|
584
644
|
this._loadedIds,
|
|
585
645
|
t,
|
|
@@ -588,7 +648,7 @@ const u = (v = class extends Y {
|
|
|
588
648
|
else
|
|
589
649
|
return;
|
|
590
650
|
else if (e != null)
|
|
591
|
-
i =
|
|
651
|
+
i = B(
|
|
592
652
|
this._treeIndex,
|
|
593
653
|
this._loadedIds,
|
|
594
654
|
t,
|
|
@@ -600,18 +660,18 @@ const u = (v = class extends Y {
|
|
|
600
660
|
this._loadedIds,
|
|
601
661
|
t
|
|
602
662
|
), i = [...s];
|
|
603
|
-
const
|
|
604
|
-
|
|
663
|
+
const a = (n = this.options) == null ? void 0 : n.defaultExpandedLevel;
|
|
664
|
+
a !== void 0 && a > 0 && i.push(
|
|
605
665
|
...V(
|
|
606
666
|
this._treeIndex,
|
|
607
667
|
s,
|
|
608
|
-
|
|
668
|
+
a
|
|
609
669
|
)
|
|
610
670
|
);
|
|
611
671
|
}
|
|
612
672
|
if (i.length === 0) return;
|
|
613
|
-
i.forEach((
|
|
614
|
-
const r = (
|
|
673
|
+
i.forEach((a) => this._loadedIds.add(a));
|
|
674
|
+
const r = (l = this.options) == null ? void 0 : l.defaultExpandedLevel;
|
|
615
675
|
s.length > 0 && r !== void 0 && r > 0 && this._applyLazyDefaultExpansion(s, r), this._loadedIds = new Set(this._loadedIds), this._rebuildMaterializedItems(), this._commitLazyRows();
|
|
616
676
|
}
|
|
617
677
|
_loadSubtreeForExpand(e) {
|
|
@@ -629,10 +689,10 @@ const u = (v = class extends Y {
|
|
|
629
689
|
}
|
|
630
690
|
/** Refresh lazy flat rows after intentional lazy state mutations. */
|
|
631
691
|
_commitLazyRows() {
|
|
632
|
-
this._isLazyEnabled() && this._syncFlatRows();
|
|
692
|
+
this._isLazyEnabled() && (this._syncFlatRows(), this._generateLightDomIcons());
|
|
633
693
|
}
|
|
634
694
|
_syncFlatRows() {
|
|
635
|
-
this._flatRows =
|
|
695
|
+
this._flatRows = P({
|
|
636
696
|
items: this._items,
|
|
637
697
|
expandedIds: this._expandedIds,
|
|
638
698
|
hasSearch: !!this._searchTerm.trim(),
|
|
@@ -673,14 +733,14 @@ const u = (v = class extends Y {
|
|
|
673
733
|
_getSearchScrollTargetIndex() {
|
|
674
734
|
const e = this._searchTerm.trim().toLowerCase();
|
|
675
735
|
if (!e || this._flatRows.length === 0) return 0;
|
|
676
|
-
const t = this._flatRows.map((r,
|
|
736
|
+
const t = this._flatRows.map((r, n) => ({ row: r, index: n })).filter(({ row: r }) => R(r.node.label, e));
|
|
677
737
|
if (t.length === 0) return 0;
|
|
678
738
|
const i = t.reduce(
|
|
679
|
-
(r,
|
|
739
|
+
(r, n) => n.row.level >= r.row.level ? n : r
|
|
680
740
|
), [s] = t;
|
|
681
741
|
if (t.length > 1 && s.row.hasChildrenInSource && this._expandedIds.has(s.row.node.id)) {
|
|
682
742
|
const r = t.find(
|
|
683
|
-
({ row:
|
|
743
|
+
({ row: n }) => n.level === s.row.level + 1 && n.node.label.toLowerCase() === s.row.node.label.toLowerCase()
|
|
684
744
|
);
|
|
685
745
|
if (r) return r.index;
|
|
686
746
|
}
|
|
@@ -688,9 +748,9 @@ const u = (v = class extends Y {
|
|
|
688
748
|
}
|
|
689
749
|
_loadUntilSearchTargetVisible() {
|
|
690
750
|
let e = 0;
|
|
691
|
-
for (; e++ < 100 && !(this._getSearchScrollTargetIndex() < this._flatRows.length || !
|
|
692
|
-
if (
|
|
693
|
-
if (!
|
|
751
|
+
for (; e++ < 100 && !(this._getSearchScrollTargetIndex() < this._flatRows.length || !C(this._searchVisibleIds, this._loadedIds) && !this._hasExpandedUnloadedSubtree()); ) {
|
|
752
|
+
if (C(this._searchVisibleIds, this._loadedIds)) {
|
|
753
|
+
if (!F(
|
|
694
754
|
this._searchVisibleIds,
|
|
695
755
|
this._loadedIds,
|
|
696
756
|
this._indexById,
|
|
@@ -722,7 +782,7 @@ const u = (v = class extends Y {
|
|
|
722
782
|
if (!e) return !1;
|
|
723
783
|
for (const t of this._expandedIds) {
|
|
724
784
|
const i = this._sourceById.get(t);
|
|
725
|
-
if (i &&
|
|
785
|
+
if (i && pe(t, this._treeIndex, this._loadedIds) && L(
|
|
726
786
|
i.label,
|
|
727
787
|
e,
|
|
728
788
|
!1,
|
|
@@ -735,36 +795,37 @@ const u = (v = class extends Y {
|
|
|
735
795
|
return !1;
|
|
736
796
|
}
|
|
737
797
|
_shouldLoadMoreOnScroll() {
|
|
738
|
-
return this._isLazyEnabled() ? this._isSearchActive() ?
|
|
798
|
+
return this._isLazyEnabled() ? this._isSearchActive() ? C(
|
|
739
799
|
this._searchVisibleIds,
|
|
740
800
|
this._loadedIds
|
|
741
801
|
) || this._hasExclusiveSearchFolderWithUnloadedChildren() : this._hasExpandedUnloadedSubtree() ? this._treeIndex.some(
|
|
742
802
|
(e) => !this._loadedIds.has(e.id)
|
|
743
|
-
) :
|
|
803
|
+
) : fe(this._treeIndex, this._loadedIds) : !1;
|
|
744
804
|
}
|
|
745
|
-
|
|
805
|
+
_getLazyLoadPriorityNodeId(e, t) {
|
|
746
806
|
if (!(!this._isSearchActive() && !this._hasExpandedUnloadedSubtree()))
|
|
747
|
-
return
|
|
807
|
+
return me(
|
|
748
808
|
this._flatRows,
|
|
749
809
|
e,
|
|
810
|
+
t,
|
|
750
811
|
this._expandedIds,
|
|
751
812
|
this._treeIndex,
|
|
752
813
|
this._loadedIds,
|
|
753
|
-
this.
|
|
814
|
+
this._getScrollPrefetchMargin()
|
|
754
815
|
);
|
|
755
816
|
}
|
|
756
817
|
_getScrollPrefetchMargin() {
|
|
757
818
|
return Math.min(20, Math.max(5, Math.floor(this._getLazyPageSize() / 4)));
|
|
758
819
|
}
|
|
759
820
|
_onVirtualizerVisibilityChanged(e) {
|
|
760
|
-
const i =
|
|
761
|
-
if (i == null || !this._shouldLoadMoreOnScroll() || this._lazyScrollLoading)
|
|
821
|
+
const t = e, i = t.first, s = t.last;
|
|
822
|
+
if (i != null && (this._lazyVisibleFirst = Math.max(0, i)), s != null && (this._lazyVisibleLast = Math.max(this._lazyVisibleFirst, s), this._generateLightDomIcons()), s == null || !this._shouldLoadMoreOnScroll() || this._lazyScrollLoading)
|
|
762
823
|
return;
|
|
763
|
-
const s = Math.max(
|
|
824
|
+
const r = this._getLazyLoadPriorityNodeId(i ?? s, s), n = Math.max(
|
|
764
825
|
0,
|
|
765
826
|
this._flatRows.length - this._getScrollPrefetchMargin()
|
|
766
827
|
);
|
|
767
|
-
|
|
828
|
+
r == null && s < n || (this._lazyScrollLoading = !0, this._loadMoreNodes(r), this.updateComplete.then(() => {
|
|
768
829
|
this._lazyScrollLoading = !1;
|
|
769
830
|
}));
|
|
770
831
|
}
|
|
@@ -773,23 +834,23 @@ const u = (v = class extends Y {
|
|
|
773
834
|
return ((t = (e = this.options) == null ? void 0 : e.title) == null ? void 0 : t.trim()) || "Treeview";
|
|
774
835
|
}
|
|
775
836
|
_renderTreeRow(e, t, i) {
|
|
776
|
-
const { isExpanded: s, hasChildren: r, isRowHighlighted:
|
|
777
|
-
return
|
|
837
|
+
const { isExpanded: s, hasChildren: r, isRowHighlighted: n, isSelectable: l } = i;
|
|
838
|
+
return f`
|
|
778
839
|
<div
|
|
779
840
|
id=${this._rowDomId(e.id)}
|
|
780
841
|
role="treeitem"
|
|
781
842
|
aria-level=${t + 1}
|
|
782
|
-
aria-expanded=${r ? s ? "true" : "false" :
|
|
783
|
-
class=${
|
|
843
|
+
aria-expanded=${r ? s ? "true" : "false" : b}
|
|
844
|
+
class=${g({
|
|
784
845
|
"node-row": !0,
|
|
785
|
-
selectable:
|
|
786
|
-
selected:
|
|
846
|
+
selectable: l,
|
|
847
|
+
selected: n
|
|
787
848
|
})}
|
|
788
849
|
style="--treeview-row-level: ${t}"
|
|
789
850
|
tabindex=${this._getRowTabIndex(e.id)}
|
|
790
|
-
@mousedown=${(
|
|
851
|
+
@mousedown=${(a) => a.preventDefault()}
|
|
791
852
|
@focus=${() => this._setActiveRow(e.id)}
|
|
792
|
-
@keydown=${(
|
|
853
|
+
@keydown=${(a) => this._handleRowKeyDown(a, e)}
|
|
793
854
|
@focusout=${this._handleRowFocusOut}
|
|
794
855
|
>
|
|
795
856
|
<div class="node-info">
|
|
@@ -803,14 +864,14 @@ const u = (v = class extends Y {
|
|
|
803
864
|
`;
|
|
804
865
|
}
|
|
805
866
|
_renderExpanderCell(e, t, i) {
|
|
806
|
-
return i ?
|
|
867
|
+
return i ? f`
|
|
807
868
|
<nyx-button
|
|
808
869
|
class="expander"
|
|
809
870
|
size="small"
|
|
810
871
|
button-icon
|
|
811
872
|
tabindex="-1"
|
|
812
873
|
hierarchy="ghost"
|
|
813
|
-
aria-label=${
|
|
874
|
+
aria-label=${Ie(e.label, t)}
|
|
814
875
|
@click=${() => this._toggleExpand(e, !1)}
|
|
815
876
|
@keydown=${(s) => {
|
|
816
877
|
(s.key === "Enter" || s.key === " ") && (s.preventDefault(), s.stopPropagation(), this._toggleExpand(e, !0));
|
|
@@ -818,36 +879,36 @@ const u = (v = class extends Y {
|
|
|
818
879
|
>
|
|
819
880
|
<nyx-icon
|
|
820
881
|
slot="icon"
|
|
821
|
-
class=${
|
|
822
|
-
.svg=${
|
|
882
|
+
class=${g({ expanded: t })}
|
|
883
|
+
.svg=${X}
|
|
823
884
|
></nyx-icon>
|
|
824
885
|
</nyx-button>
|
|
825
|
-
` :
|
|
826
|
-
}
|
|
827
|
-
_renderNodeTypeIcon(e) {
|
|
828
|
-
const t = e.icon;
|
|
829
|
-
return t ? typeof t == "string" ? h`<nyx-icon name=${t} variant="regular"></nyx-icon>` : h`
|
|
830
|
-
<nyx-icon
|
|
831
|
-
name=${t.name ?? w}
|
|
832
|
-
variant=${t.variant ?? "regular"}
|
|
833
|
-
src=${t.src ?? w}
|
|
834
|
-
.svg=${t.svg}
|
|
835
|
-
></nyx-icon>
|
|
836
|
-
` : w;
|
|
886
|
+
` : f`<span class="expander-placeholder" aria-hidden="true"></span>`;
|
|
837
887
|
}
|
|
838
888
|
_generateLightDomIcons() {
|
|
839
|
-
var
|
|
840
|
-
if (this.querySelectorAll("[data-auto-generated]").forEach((
|
|
841
|
-
|
|
842
|
-
})),
|
|
843
|
-
const t = (
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
889
|
+
var s;
|
|
890
|
+
if (this.querySelectorAll("[data-auto-generated]").forEach((r) => r.remove()), !this.options || (this._hasColumnPermissions() && ((s = this.options.columns) == null || s.forEach((r, n) => {
|
|
891
|
+
r.icon && this._createIconElement(r.icon, `generated-header-icon-${n}`);
|
|
892
|
+
})), !this._showNodeIcons())) return;
|
|
893
|
+
const t = (r) => {
|
|
894
|
+
r.icon && this._createIconElement(
|
|
895
|
+
r.icon,
|
|
896
|
+
`generated-tree-icon-${r.id}`
|
|
897
|
+
);
|
|
898
|
+
}, i = (r) => {
|
|
899
|
+
var n;
|
|
900
|
+
t(r), (n = r.children) == null || n.forEach(i);
|
|
849
901
|
};
|
|
850
|
-
this.
|
|
902
|
+
if (this._isLazyEnabled()) {
|
|
903
|
+
const r = Math.min(
|
|
904
|
+
this._flatRows.length - 1,
|
|
905
|
+
this._lazyVisibleLast
|
|
906
|
+
);
|
|
907
|
+
if (r < 0) return;
|
|
908
|
+
this._flatRows.slice(this._lazyVisibleFirst, r + 1).forEach((n) => t(n.node));
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
this._items.forEach(i);
|
|
851
912
|
}
|
|
852
913
|
_createIconElement(e, t) {
|
|
853
914
|
const i = document.createElement("nyx-icon");
|
|
@@ -867,13 +928,14 @@ const u = (v = class extends Y {
|
|
|
867
928
|
}
|
|
868
929
|
_isIndeterminate(e, t) {
|
|
869
930
|
if (e = this._selectionNode(e), !e.children || e.children.length === 0) return !1;
|
|
870
|
-
const i = this.
|
|
871
|
-
|
|
872
|
-
).length;
|
|
873
|
-
return s > 0 && s < i.length;
|
|
931
|
+
const i = this._getSelectionStats(e), s = i.selectedDescendantCountByColumn.get(t) ?? 0;
|
|
932
|
+
return s > 0 && s < i.descendantCount;
|
|
874
933
|
}
|
|
875
934
|
_allDescendantsSelected(e, t) {
|
|
876
|
-
|
|
935
|
+
if (e = this._selectionNode(e), !e.children || e.children.length === 0)
|
|
936
|
+
return this._isNodeSelected(e, t);
|
|
937
|
+
const i = this._getSelectionStats(e);
|
|
938
|
+
return i.descendantCount > 0 && (i.selectedDescendantCountByColumn.get(t) ?? 0) === i.descendantCount;
|
|
877
939
|
}
|
|
878
940
|
_getFlatDescendants(e) {
|
|
879
941
|
e = this._selectionNode(e);
|
|
@@ -885,22 +947,22 @@ const u = (v = class extends Y {
|
|
|
885
947
|
}
|
|
886
948
|
/** Transitive set of prerequisite column ids for `columnId` (excludes itself). */
|
|
887
949
|
_requiredClosure(e) {
|
|
888
|
-
var
|
|
889
|
-
const t = ((
|
|
890
|
-
for (;
|
|
891
|
-
const c =
|
|
892
|
-
r.has(c) || (r.add(c), s.push(c),
|
|
950
|
+
var l, a, d;
|
|
951
|
+
const t = ((l = this.options) == null ? void 0 : l.columns) ?? [], i = new Map(t.map((c) => [c.id, c])), s = [], r = /* @__PURE__ */ new Set([e]), n = [...((a = i.get(e)) == null ? void 0 : a.requires) ?? []];
|
|
952
|
+
for (; n.length; ) {
|
|
953
|
+
const c = n.pop();
|
|
954
|
+
r.has(c) || (r.add(c), s.push(c), n.push(...((d = i.get(c)) == null ? void 0 : d.requires) ?? []));
|
|
893
955
|
}
|
|
894
956
|
return s;
|
|
895
957
|
}
|
|
896
958
|
/** Transitive set of column ids that depend on `columnId` (excludes itself). */
|
|
897
959
|
_dependentsClosure(e) {
|
|
898
|
-
var
|
|
899
|
-
const t = ((
|
|
960
|
+
var n;
|
|
961
|
+
const t = ((n = this.options) == null ? void 0 : n.columns) ?? [], i = [], s = /* @__PURE__ */ new Set([e]), r = [e];
|
|
900
962
|
for (; r.length; ) {
|
|
901
|
-
const
|
|
902
|
-
for (const
|
|
903
|
-
(
|
|
963
|
+
const l = r.pop();
|
|
964
|
+
for (const a of t)
|
|
965
|
+
(a.requires ?? []).includes(l) && !s.has(a.id) && (s.add(a.id), i.push(a.id), r.push(a.id));
|
|
904
966
|
}
|
|
905
967
|
return i;
|
|
906
968
|
}
|
|
@@ -912,22 +974,20 @@ const u = (v = class extends Y {
|
|
|
912
974
|
_handleCheck(e, t) {
|
|
913
975
|
const i = this._selectionNode(e);
|
|
914
976
|
if (this._isColumnDisabled(i, t)) return;
|
|
915
|
-
const r = !this._isNodeSelected(i, t),
|
|
916
|
-
this._forEachInSubtree(this._selectionRoots(), e.id, (
|
|
917
|
-
r &&
|
|
918
|
-
(c) => this._isColumnDisabled(
|
|
919
|
-
) ||
|
|
920
|
-
(d) => this._toggleNodeState(
|
|
977
|
+
const r = !this._isNodeSelected(i, t), n = this._requiredClosure(t), l = r ? [t, ...n] : [t, ...this._dependentsClosure(t)];
|
|
978
|
+
this._forEachInSubtree(this._selectionRoots(), e.id, (a) => {
|
|
979
|
+
r && n.some(
|
|
980
|
+
(c) => this._isColumnDisabled(a, c)
|
|
981
|
+
) || l.forEach(
|
|
982
|
+
(d) => this._toggleNodeState(a, d, r)
|
|
921
983
|
);
|
|
922
|
-
}),
|
|
923
|
-
(l) => this._updateParents(this._selectionRoots(), e.id, l)
|
|
924
|
-
), this._triggerChange();
|
|
984
|
+
}), l.forEach((a) => this._updateColumnAncestors(e.id, a)), this._triggerChange();
|
|
925
985
|
}
|
|
926
986
|
_toggleNodeState(e, t, i) {
|
|
927
987
|
if (this._isColumnDisabled(e, t)) return;
|
|
928
988
|
e.selectedColumns || (e.selectedColumns = []);
|
|
929
989
|
const s = e.selectedColumns.indexOf(t);
|
|
930
|
-
i && s === -1 ? e.selectedColumns.push(t) : !i && s > -1 && e.selectedColumns.splice(s, 1);
|
|
990
|
+
i && s === -1 ? (e.selectedColumns.push(t), this._invalidateSelectionStats()) : !i && s > -1 && (e.selectedColumns.splice(s, 1), this._invalidateSelectionStats());
|
|
931
991
|
}
|
|
932
992
|
_updateParents(e, t, i) {
|
|
933
993
|
for (const s of e)
|
|
@@ -935,7 +995,7 @@ const u = (v = class extends Y {
|
|
|
935
995
|
(r) => r.id === t || this._updateParents(s.children, t, i)
|
|
936
996
|
)) {
|
|
937
997
|
const r = s.children.every(
|
|
938
|
-
(
|
|
998
|
+
(n) => this._allDescendantsSelected(n, i)
|
|
939
999
|
);
|
|
940
1000
|
return this._toggleNodeState(
|
|
941
1001
|
s,
|
|
@@ -945,6 +1005,29 @@ const u = (v = class extends Y {
|
|
|
945
1005
|
}
|
|
946
1006
|
return !1;
|
|
947
1007
|
}
|
|
1008
|
+
_updateLazyColumnAncestors(e, t) {
|
|
1009
|
+
var s, r, n;
|
|
1010
|
+
let i = (s = this._indexById.get(e)) == null ? void 0 : s.parentId;
|
|
1011
|
+
for (; i != null; ) {
|
|
1012
|
+
const l = this._sourceById.get(i);
|
|
1013
|
+
if (!((r = l == null ? void 0 : l.children) != null && r.length)) return;
|
|
1014
|
+
const a = l.children.every(
|
|
1015
|
+
(d) => this._allDescendantsSelected(d, t)
|
|
1016
|
+
);
|
|
1017
|
+
this._toggleNodeState(
|
|
1018
|
+
l,
|
|
1019
|
+
t,
|
|
1020
|
+
a && this._canEnableColumn(l, t)
|
|
1021
|
+
), i = (n = this._indexById.get(i)) == null ? void 0 : n.parentId;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
_updateColumnAncestors(e, t) {
|
|
1025
|
+
if (this._isLazyEnabled()) {
|
|
1026
|
+
this._updateLazyColumnAncestors(e, t);
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1029
|
+
this._updateParents(this._selectionRoots(), e, t);
|
|
1030
|
+
}
|
|
948
1031
|
_isRowAllSelected(e) {
|
|
949
1032
|
var i;
|
|
950
1033
|
if (e = this._selectionNode(e), !((i = this.options) != null && i.columns)) return !1;
|
|
@@ -963,15 +1046,19 @@ const u = (v = class extends Y {
|
|
|
963
1046
|
}
|
|
964
1047
|
_isSimpleRowAllSelected(e) {
|
|
965
1048
|
var t;
|
|
966
|
-
|
|
1049
|
+
if (e = this._selectionNode(e), (t = e.children) != null && t.length) {
|
|
1050
|
+
const i = this._getSelectionStats(e);
|
|
1051
|
+
return i.simpleLeafCount > 0 && i.simpleSelectedLeafCount === i.simpleLeafCount;
|
|
1052
|
+
}
|
|
1053
|
+
return !!e.selected;
|
|
967
1054
|
}
|
|
968
1055
|
_isSimpleRowIndeterminate(e) {
|
|
969
|
-
var
|
|
970
|
-
return e = this._selectionNode(e), this._isSimpleRowAllSelected(e) || !((
|
|
1056
|
+
var t;
|
|
1057
|
+
return e = this._selectionNode(e), this._isSimpleRowAllSelected(e) || !((t = e.children) != null && t.length) ? !1 : this._getSelectionStats(e).simpleSelectedDescendantCount > 0;
|
|
971
1058
|
}
|
|
972
1059
|
_setSimpleRowSelected(e, t) {
|
|
973
1060
|
this._forEachInSubtree(this._selectionRoots(), e, (i) => {
|
|
974
|
-
i.selected = t;
|
|
1061
|
+
i.selected !== t && (i.selected = t, this._invalidateSelectionStats());
|
|
975
1062
|
});
|
|
976
1063
|
}
|
|
977
1064
|
_updateSimpleRowParents(e, t) {
|
|
@@ -979,12 +1066,33 @@ const u = (v = class extends Y {
|
|
|
979
1066
|
for (const s of e)
|
|
980
1067
|
if ((i = s.children) != null && i.some(
|
|
981
1068
|
(r) => r.id === t || this._updateSimpleRowParents(s.children, t)
|
|
982
|
-
))
|
|
983
|
-
|
|
984
|
-
(
|
|
985
|
-
)
|
|
1069
|
+
)) {
|
|
1070
|
+
const r = s.children.every(
|
|
1071
|
+
(n) => this._isSimpleRowAllSelected(n)
|
|
1072
|
+
);
|
|
1073
|
+
return s.selected !== r && (s.selected = r, this._invalidateSelectionStats()), !0;
|
|
1074
|
+
}
|
|
986
1075
|
return !1;
|
|
987
1076
|
}
|
|
1077
|
+
_updateLazySimpleRowAncestors(e) {
|
|
1078
|
+
var i, s, r;
|
|
1079
|
+
let t = (i = this._indexById.get(e)) == null ? void 0 : i.parentId;
|
|
1080
|
+
for (; t != null; ) {
|
|
1081
|
+
const n = this._sourceById.get(t);
|
|
1082
|
+
if (!((s = n == null ? void 0 : n.children) != null && s.length)) return;
|
|
1083
|
+
const l = n.children.every(
|
|
1084
|
+
(a) => this._isSimpleRowAllSelected(a)
|
|
1085
|
+
);
|
|
1086
|
+
n.selected !== l && (n.selected = l, this._invalidateSelectionStats()), t = (r = this._indexById.get(t)) == null ? void 0 : r.parentId;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
_updateSimpleRowAncestors(e) {
|
|
1090
|
+
if (this._isLazyEnabled()) {
|
|
1091
|
+
this._updateLazySimpleRowAncestors(e);
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
this._updateSimpleRowParents(this._selectionRoots(), e);
|
|
1095
|
+
}
|
|
988
1096
|
_isRowCheckboxChecked(e) {
|
|
989
1097
|
const t = this._selectionNode(e);
|
|
990
1098
|
return this._usesUniqueRowSelection() ? !!t.selected : this._usesSimpleRowSelection() ? this._isSimpleRowAllSelected(t) : this._isRowAllSelected(t);
|
|
@@ -999,8 +1107,8 @@ const u = (v = class extends Y {
|
|
|
999
1107
|
let t = !1;
|
|
1000
1108
|
const i = (s) => {
|
|
1001
1109
|
s.forEach((r) => {
|
|
1002
|
-
const
|
|
1003
|
-
!!r.selected !==
|
|
1110
|
+
const n = r.id === e;
|
|
1111
|
+
!!r.selected !== n && (r.selected = n, this._invalidateSelectionStats(), t = !0), r.children && i(r.children);
|
|
1004
1112
|
});
|
|
1005
1113
|
};
|
|
1006
1114
|
return i(this._selectionRoots()), t;
|
|
@@ -1012,17 +1120,23 @@ const u = (v = class extends Y {
|
|
|
1012
1120
|
return;
|
|
1013
1121
|
}
|
|
1014
1122
|
const i = !this._isRowCheckboxChecked(e);
|
|
1015
|
-
this._usesSimpleRowSelection() ? (this._setSimpleRowSelected(e.id, i), this.
|
|
1016
|
-
this.
|
|
1123
|
+
this._usesSimpleRowSelection() ? (this._setSimpleRowSelected(e.id, i), this._updateSimpleRowAncestors(e.id)) : (this._toggleRowRecursively(e.id, i), (s = this.options) != null && s.columns && this.options.columns.forEach((r) => {
|
|
1124
|
+
this._updateColumnAncestors(e.id, r.id);
|
|
1017
1125
|
})), this._triggerChange();
|
|
1018
1126
|
}
|
|
1019
1127
|
_applyRowColumnsToNode(e, t) {
|
|
1020
1128
|
var i;
|
|
1021
|
-
(i = this.options) != null && i.columns
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1129
|
+
if ((i = this.options) != null && i.columns)
|
|
1130
|
+
if (t)
|
|
1131
|
+
this.options.columns.forEach((s) => {
|
|
1132
|
+
this._canEnableColumn(e, s.id) && (e.selectedColumns || (e.selectedColumns = []), e.selectedColumns.includes(s.id) || (e.selectedColumns.push(s.id), this._invalidateSelectionStats()));
|
|
1133
|
+
});
|
|
1134
|
+
else {
|
|
1135
|
+
const s = (e.selectedColumns ?? []).filter(
|
|
1136
|
+
(r) => this._isColumnDisabled(e, r)
|
|
1137
|
+
);
|
|
1138
|
+
s.length !== (e.selectedColumns ?? []).length && (e.selectedColumns = s, this._invalidateSelectionStats());
|
|
1139
|
+
}
|
|
1026
1140
|
}
|
|
1027
1141
|
_toggleRowRecursively(e, t) {
|
|
1028
1142
|
this._forEachInSubtree(this._selectionRoots(), e, (i) => {
|
|
@@ -1047,7 +1161,7 @@ const u = (v = class extends Y {
|
|
|
1047
1161
|
}
|
|
1048
1162
|
this._searchDebounceTimer = setTimeout(() => {
|
|
1049
1163
|
this._searchDebounceTimer = null, this._applySearchTerm(t, i);
|
|
1050
|
-
},
|
|
1164
|
+
}, re);
|
|
1051
1165
|
}
|
|
1052
1166
|
_applySearchTerm(e, t) {
|
|
1053
1167
|
const i = t.trim(), s = e.trim();
|
|
@@ -1059,14 +1173,14 @@ const u = (v = class extends Y {
|
|
|
1059
1173
|
this._searchVisibleIds = /* @__PURE__ */ new Set(), this._expandedIdsBeforeSearch && (this._expandedIds = new Set(this._expandedIdsBeforeSearch), this._expandedIdsBeforeSearch = null), this._isLazyEnabled() ? this._commitLazyRows() : this._syncActiveRowWithVisibleRows(), this._updateSearchStatusMessage();
|
|
1060
1174
|
return;
|
|
1061
1175
|
}
|
|
1062
|
-
const t = this._ensureSearchIndex(), { visibleIds: i, expandIds: s } =
|
|
1176
|
+
const t = this._ensureSearchIndex(), { visibleIds: i, expandIds: s } = ae(
|
|
1063
1177
|
t,
|
|
1064
1178
|
e,
|
|
1065
1179
|
this._searchUserCollapsedIds
|
|
1066
1180
|
), r = new Set(s);
|
|
1067
|
-
this._searchManualExpandedIds.forEach((
|
|
1068
|
-
this._searchUserCollapsedIds.has(
|
|
1069
|
-
}), this._searchVisibleIds = i, this._expandedIds = r, this._isLazyEnabled() ? (
|
|
1181
|
+
this._searchManualExpandedIds.forEach((n) => {
|
|
1182
|
+
this._searchUserCollapsedIds.has(n) || r.add(n);
|
|
1183
|
+
}), this._searchVisibleIds = i, this._expandedIds = r, this._isLazyEnabled() ? (F(
|
|
1070
1184
|
i,
|
|
1071
1185
|
this._loadedIds,
|
|
1072
1186
|
this._indexById,
|
|
@@ -1093,7 +1207,7 @@ const u = (v = class extends Y {
|
|
|
1093
1207
|
return this._isLazyEnabled() ? this._sourceHasChildren(e.id) : !!(e.children && e.children.length > 0);
|
|
1094
1208
|
}
|
|
1095
1209
|
_getVisibleTreeRows() {
|
|
1096
|
-
return this._isLazyEnabled() ? this._flatRows :
|
|
1210
|
+
return this._isLazyEnabled() ? this._flatRows : P({
|
|
1097
1211
|
items: this._items,
|
|
1098
1212
|
expandedIds: this._expandedIds,
|
|
1099
1213
|
hasSearch: this._isSearchActive(),
|
|
@@ -1113,11 +1227,11 @@ const u = (v = class extends Y {
|
|
|
1113
1227
|
return r ?? void 0;
|
|
1114
1228
|
}
|
|
1115
1229
|
let t;
|
|
1116
|
-
const i = (r,
|
|
1117
|
-
for (const
|
|
1118
|
-
if (
|
|
1119
|
-
return t =
|
|
1120
|
-
if (
|
|
1230
|
+
const i = (r, n) => {
|
|
1231
|
+
for (const l of r) {
|
|
1232
|
+
if (l.id === e)
|
|
1233
|
+
return t = n ?? void 0, !0;
|
|
1234
|
+
if (l.children && i(l.children, l.id))
|
|
1121
1235
|
return !0;
|
|
1122
1236
|
}
|
|
1123
1237
|
return !1;
|
|
@@ -1128,12 +1242,12 @@ const u = (v = class extends Y {
|
|
|
1128
1242
|
this._setActiveRow(e), this.updateComplete.then(() => {
|
|
1129
1243
|
var i, s, r;
|
|
1130
1244
|
if (this._isLazyEnabled()) {
|
|
1131
|
-
const
|
|
1132
|
-
if (
|
|
1133
|
-
const
|
|
1245
|
+
const n = this._flatRows.findIndex((l) => l.node.id === e);
|
|
1246
|
+
if (n >= 0) {
|
|
1247
|
+
const l = (i = this.shadowRoot) == null ? void 0 : i.querySelector(
|
|
1134
1248
|
"lit-virtualizer"
|
|
1135
1249
|
);
|
|
1136
|
-
(s =
|
|
1250
|
+
(s = l == null ? void 0 : l.scrollToIndex) == null || s.call(l, n, "nearest");
|
|
1137
1251
|
}
|
|
1138
1252
|
}
|
|
1139
1253
|
const t = (r = this.shadowRoot) == null ? void 0 : r.querySelector(
|
|
@@ -1153,11 +1267,11 @@ const u = (v = class extends Y {
|
|
|
1153
1267
|
}
|
|
1154
1268
|
}
|
|
1155
1269
|
async _handleRowKeyDown(e, t) {
|
|
1156
|
-
var
|
|
1270
|
+
var a;
|
|
1157
1271
|
const i = e.currentTarget;
|
|
1158
1272
|
if (e.target !== i)
|
|
1159
1273
|
return;
|
|
1160
|
-
const s = this._getVisibleTreeRows(), r = s.findIndex((d) => d.node.id === t.id),
|
|
1274
|
+
const s = this._getVisibleTreeRows(), r = s.findIndex((d) => d.node.id === t.id), n = this._nodeHasChildren(t), l = this._expandedIds.has(t.id);
|
|
1161
1275
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
1162
1276
|
const d = e.key === "ArrowDown" ? r + 1 : r - 1;
|
|
1163
1277
|
d >= 0 && d < s.length && (e.preventDefault(), this._focusRowById(s[d].node.id));
|
|
@@ -1171,8 +1285,8 @@ const u = (v = class extends Y {
|
|
|
1171
1285
|
return;
|
|
1172
1286
|
}
|
|
1173
1287
|
if (e.key === "ArrowRight") {
|
|
1174
|
-
if (!
|
|
1175
|
-
if (e.preventDefault(), !
|
|
1288
|
+
if (!n) return;
|
|
1289
|
+
if (e.preventDefault(), !l) {
|
|
1176
1290
|
await this._toggleExpand(t, !0);
|
|
1177
1291
|
return;
|
|
1178
1292
|
}
|
|
@@ -1180,7 +1294,7 @@ const u = (v = class extends Y {
|
|
|
1180
1294
|
return;
|
|
1181
1295
|
}
|
|
1182
1296
|
if (e.key === "ArrowLeft") {
|
|
1183
|
-
if (e.preventDefault(),
|
|
1297
|
+
if (e.preventDefault(), n && l) {
|
|
1184
1298
|
await this._toggleExpand(t, !1), i.focus();
|
|
1185
1299
|
return;
|
|
1186
1300
|
}
|
|
@@ -1197,7 +1311,7 @@ const u = (v = class extends Y {
|
|
|
1197
1311
|
if (d instanceof HTMLInputElement)
|
|
1198
1312
|
d.focus();
|
|
1199
1313
|
else {
|
|
1200
|
-
const c = (
|
|
1314
|
+
const c = (a = d.shadowRoot) == null ? void 0 : a.querySelector("button");
|
|
1201
1315
|
c == null || c.focus();
|
|
1202
1316
|
}
|
|
1203
1317
|
return;
|
|
@@ -1226,7 +1340,7 @@ const u = (v = class extends Y {
|
|
|
1226
1340
|
});
|
|
1227
1341
|
}
|
|
1228
1342
|
_renderRowSelectionCheckbox(e) {
|
|
1229
|
-
return this._showRowSelection() ? this._usesUniqueRowSelection() ?
|
|
1343
|
+
return this._showRowSelection() ? this._usesUniqueRowSelection() ? f`
|
|
1230
1344
|
<div class="row-checkbox">
|
|
1231
1345
|
<nyx-radio
|
|
1232
1346
|
?checked=${this._isRowCheckboxChecked(e)}
|
|
@@ -1240,14 +1354,14 @@ const u = (v = class extends Y {
|
|
|
1240
1354
|
tabindex="-1"
|
|
1241
1355
|
name=${this._rowSelectionRadioName}
|
|
1242
1356
|
.checked=${this._isRowCheckboxChecked(e)}
|
|
1243
|
-
aria-label=${
|
|
1357
|
+
aria-label=${U(e.label)}
|
|
1244
1358
|
/>
|
|
1245
1359
|
</nyx-radio>
|
|
1246
1360
|
</div>
|
|
1247
|
-
` :
|
|
1361
|
+
` : f`
|
|
1248
1362
|
<div class="row-checkbox">
|
|
1249
1363
|
<nyx-checkbox
|
|
1250
|
-
aria-label=${
|
|
1364
|
+
aria-label=${U(e.label)}
|
|
1251
1365
|
?checked=${this._isRowCheckboxChecked(e)}
|
|
1252
1366
|
?indeterminate=${this._isRowCheckboxIndeterminate(e)}
|
|
1253
1367
|
@click=${(t) => {
|
|
@@ -1257,20 +1371,20 @@ const u = (v = class extends Y {
|
|
|
1257
1371
|
<input type="checkbox" slot="input" tabindex="-1" />
|
|
1258
1372
|
</nyx-checkbox>
|
|
1259
1373
|
</div>
|
|
1260
|
-
` :
|
|
1374
|
+
` : b;
|
|
1261
1375
|
}
|
|
1262
1376
|
_renderNodeIconCell(e) {
|
|
1263
|
-
return this._showNodeIcons() ?
|
|
1377
|
+
return this._showNodeIcons() ? f`
|
|
1264
1378
|
<div class="node-type-icon-wrapper">
|
|
1265
|
-
|
|
1379
|
+
<slot name="generated-tree-icon-${e.id}"></slot>
|
|
1266
1380
|
</div>
|
|
1267
|
-
` :
|
|
1381
|
+
` : b;
|
|
1268
1382
|
}
|
|
1269
1383
|
_renderColumnCheckboxes(e) {
|
|
1270
|
-
return this._hasColumnPermissions() ?
|
|
1384
|
+
return this._hasColumnPermissions() ? f`
|
|
1271
1385
|
<div class="node-columns">
|
|
1272
1386
|
${this.options.columns.map(
|
|
1273
|
-
(t) =>
|
|
1387
|
+
(t) => f`
|
|
1274
1388
|
<div class="col-cell">
|
|
1275
1389
|
<nyx-checkbox
|
|
1276
1390
|
aria-label=${Ce(
|
|
@@ -1303,25 +1417,28 @@ const u = (v = class extends Y {
|
|
|
1303
1417
|
`
|
|
1304
1418
|
)}
|
|
1305
1419
|
</div>
|
|
1306
|
-
` :
|
|
1420
|
+
` : b;
|
|
1307
1421
|
}
|
|
1308
1422
|
render() {
|
|
1309
|
-
var
|
|
1310
|
-
const e = this._hasColumnPermissions(),
|
|
1311
|
-
|
|
1423
|
+
var s, r, n;
|
|
1424
|
+
const e = this._hasColumnPermissions(), i = [
|
|
1425
|
+
`--treeview-column-count: ${e ? ((r = (s = this.options) == null ? void 0 : s.columns) == null ? void 0 : r.length) ?? 0 : 0};`,
|
|
1426
|
+
`--treeview-scrollbar-gutter: ${this._scrollbarGutter}px;`
|
|
1427
|
+
].join(" ");
|
|
1428
|
+
return f`
|
|
1312
1429
|
<div
|
|
1313
|
-
class=${
|
|
1430
|
+
class=${g({
|
|
1314
1431
|
"nyx-treeview": !0,
|
|
1315
1432
|
"nyx-treeview--no-columns": !e,
|
|
1316
1433
|
"nyx-treeview--row-selection": this._showRowSelection(),
|
|
1317
1434
|
"nyx-treeview--virtual": this._isLazyEnabled()
|
|
1318
1435
|
})}
|
|
1319
|
-
style=${
|
|
1436
|
+
style=${i}
|
|
1320
1437
|
@mousedown=${() => this._clearAllFocus()}
|
|
1321
1438
|
>
|
|
1322
1439
|
<div class="search-container">
|
|
1323
1440
|
<nyx-input>
|
|
1324
|
-
<nyx-icon .svg=${
|
|
1441
|
+
<nyx-icon .svg=${ee} slot="iconLeft"></nyx-icon>
|
|
1325
1442
|
<input
|
|
1326
1443
|
class="search-input"
|
|
1327
1444
|
type="text"
|
|
@@ -1343,40 +1460,40 @@ const u = (v = class extends Y {
|
|
|
1343
1460
|
|
|
1344
1461
|
<div class="tree-scroll">
|
|
1345
1462
|
<div
|
|
1346
|
-
class=${
|
|
1463
|
+
class=${g({
|
|
1347
1464
|
"tree-header": !0,
|
|
1348
1465
|
"tree-header--no-columns": !e
|
|
1349
1466
|
})}
|
|
1350
1467
|
>
|
|
1351
|
-
<div class="tree-title">${(
|
|
1352
|
-
${e ?
|
|
1468
|
+
<div class="tree-title">${(n = this.options) == null ? void 0 : n.title}</div>
|
|
1469
|
+
${e ? f`
|
|
1353
1470
|
<div class="header-columns">
|
|
1354
1471
|
${this.options.columns.map(
|
|
1355
|
-
(
|
|
1356
|
-
<div class="col-cell" title="${
|
|
1472
|
+
(l, a) => f`
|
|
1473
|
+
<div class="col-cell" title="${l.title || ""}">
|
|
1357
1474
|
<slot name="generated-header-icon-${a}"></slot>
|
|
1358
1475
|
</div>
|
|
1359
1476
|
`
|
|
1360
1477
|
)}
|
|
1361
1478
|
</div>
|
|
1362
|
-
` :
|
|
1479
|
+
` : b}
|
|
1363
1480
|
</div>
|
|
1364
1481
|
|
|
1365
1482
|
<div
|
|
1366
|
-
class=${
|
|
1483
|
+
class=${g({
|
|
1367
1484
|
"tree-body": !0,
|
|
1368
1485
|
"tree-body--virtual": this._isLazyEnabled()
|
|
1369
1486
|
})}
|
|
1370
1487
|
role="tree"
|
|
1371
1488
|
aria-label=${this._getTreeAriaLabel()}
|
|
1372
1489
|
>
|
|
1373
|
-
${this._isLazyEnabled() ?
|
|
1490
|
+
${this._isLazyEnabled() ? f`
|
|
1374
1491
|
<lit-virtualizer
|
|
1375
1492
|
scroller
|
|
1376
1493
|
class="tree-virtualizer"
|
|
1377
1494
|
.items=${this._flatRows}
|
|
1378
1495
|
.estimateSize=${48}
|
|
1379
|
-
.renderItem=${(
|
|
1496
|
+
.renderItem=${(l) => this._renderFlatRow(l)}
|
|
1380
1497
|
@visibilityChanged=${this._onVirtualizerVisibilityChanged}
|
|
1381
1498
|
></lit-virtualizer>
|
|
1382
1499
|
` : this._renderNodes(this._items, 0)}
|
|
@@ -1386,51 +1503,51 @@ const u = (v = class extends Y {
|
|
|
1386
1503
|
`;
|
|
1387
1504
|
}
|
|
1388
1505
|
_renderFlatRow(e) {
|
|
1389
|
-
const { node: t, level: i, revealSubtree: s, parentLabelMatched: r } = e,
|
|
1390
|
-
return
|
|
1506
|
+
const { node: t, level: i, revealSubtree: s, parentLabelMatched: r } = e, n = this._expandedIds.has(t.id), l = e.hasChildrenInSource, a = this._showRowSelection(), d = this._isRowCheckboxChecked(t) || this._isRowCheckboxIndeterminate(t);
|
|
1507
|
+
return f`
|
|
1391
1508
|
<div class="node-wrapper node-wrapper--flat">
|
|
1392
1509
|
${this._renderTreeRow(t, i, {
|
|
1393
|
-
isExpanded:
|
|
1394
|
-
hasChildren:
|
|
1510
|
+
isExpanded: n,
|
|
1511
|
+
hasChildren: l,
|
|
1395
1512
|
isRowHighlighted: d,
|
|
1396
|
-
isSelectable:
|
|
1513
|
+
isSelectable: a
|
|
1397
1514
|
})}
|
|
1398
1515
|
</div>
|
|
1399
1516
|
`;
|
|
1400
1517
|
}
|
|
1401
1518
|
_renderNodes(e, t, i = !1, s = !1, r = !1) {
|
|
1402
|
-
const
|
|
1403
|
-
return
|
|
1404
|
-
|
|
1519
|
+
const n = !!this._searchTerm.trim(), l = this._searchTerm.trim().toLowerCase(), a = n && !r ? e.filter((d) => this._searchVisibleIds.has(d.id)) : e;
|
|
1520
|
+
return Q(
|
|
1521
|
+
a,
|
|
1405
1522
|
(d) => d.id,
|
|
1406
1523
|
(d) => {
|
|
1407
|
-
const c = this._expandedIds.has(d.id),
|
|
1524
|
+
const c = this._expandedIds.has(d.id), u = this._isLazyEnabled() ? this._sourceHasChildren(d.id) : !!(d.children && d.children.length > 0), h = this._isRowCheckboxChecked(d) || this._isRowCheckboxIndeterminate(d), _ = this._showRowSelection(), v = O(
|
|
1408
1525
|
d.label,
|
|
1409
|
-
|
|
1526
|
+
l,
|
|
1410
1527
|
i,
|
|
1411
1528
|
s
|
|
1412
|
-
),
|
|
1529
|
+
), $ = !n || v && L(
|
|
1413
1530
|
d.label,
|
|
1414
|
-
|
|
1531
|
+
l,
|
|
1415
1532
|
s,
|
|
1416
1533
|
d.id,
|
|
1417
1534
|
this._searchVisibleIds,
|
|
1418
|
-
(
|
|
1419
|
-
) ? d.children :
|
|
1420
|
-
return
|
|
1535
|
+
(z) => this._getSourceChildren(z)
|
|
1536
|
+
) ? d.children : q(d, this._searchVisibleIds, l), I = s || n && !!l && d.label.toLowerCase().includes(l);
|
|
1537
|
+
return f`
|
|
1421
1538
|
<div class="node-wrapper">
|
|
1422
1539
|
${this._renderTreeRow(d, t, {
|
|
1423
1540
|
isExpanded: c,
|
|
1424
|
-
hasChildren:
|
|
1425
|
-
isRowHighlighted:
|
|
1426
|
-
isSelectable:
|
|
1541
|
+
hasChildren: u,
|
|
1542
|
+
isRowHighlighted: h,
|
|
1543
|
+
isSelectable: _
|
|
1427
1544
|
})}
|
|
1428
|
-
${c &&
|
|
1545
|
+
${c && u ? f`<div class="node-children" role="group">
|
|
1429
1546
|
${this._renderNodes(
|
|
1430
|
-
|
|
1547
|
+
$,
|
|
1431
1548
|
t + 1,
|
|
1432
|
-
|
|
1433
|
-
|
|
1549
|
+
v,
|
|
1550
|
+
I,
|
|
1434
1551
|
!0
|
|
1435
1552
|
)}
|
|
1436
1553
|
</div>` : ""}
|
|
@@ -1439,45 +1556,48 @@ const u = (v = class extends Y {
|
|
|
1439
1556
|
}
|
|
1440
1557
|
);
|
|
1441
1558
|
}
|
|
1442
|
-
},
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
],
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
],
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
],
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
],
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
],
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
],
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
],
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
],
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
],
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
],
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
],
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
],
|
|
1479
|
-
|
|
1480
|
-
|
|
1559
|
+
}, x._nextTreeviewId = 0, x.styles = Y(se), x);
|
|
1560
|
+
w([
|
|
1561
|
+
J({ type: Object, noAccessor: !0 })
|
|
1562
|
+
], p.prototype, "options", 1);
|
|
1563
|
+
w([
|
|
1564
|
+
m()
|
|
1565
|
+
], p.prototype, "_items", 2);
|
|
1566
|
+
w([
|
|
1567
|
+
m()
|
|
1568
|
+
], p.prototype, "_expandedIds", 2);
|
|
1569
|
+
w([
|
|
1570
|
+
m()
|
|
1571
|
+
], p.prototype, "_searchTerm", 2);
|
|
1572
|
+
w([
|
|
1573
|
+
m()
|
|
1574
|
+
], p.prototype, "_searchStatusMessage", 2);
|
|
1575
|
+
w([
|
|
1576
|
+
m()
|
|
1577
|
+
], p.prototype, "_searchVisibleIds", 2);
|
|
1578
|
+
w([
|
|
1579
|
+
m()
|
|
1580
|
+
], p.prototype, "_searchUserCollapsedIds", 2);
|
|
1581
|
+
w([
|
|
1582
|
+
m()
|
|
1583
|
+
], p.prototype, "_searchManualExpandedIds", 2);
|
|
1584
|
+
w([
|
|
1585
|
+
m()
|
|
1586
|
+
], p.prototype, "_flatRows", 2);
|
|
1587
|
+
w([
|
|
1588
|
+
m()
|
|
1589
|
+
], p.prototype, "_loadedIds", 2);
|
|
1590
|
+
w([
|
|
1591
|
+
m()
|
|
1592
|
+
], p.prototype, "_activeRowId", 2);
|
|
1593
|
+
w([
|
|
1594
|
+
m()
|
|
1595
|
+
], p.prototype, "_scrollbarGutter", 2);
|
|
1596
|
+
w([
|
|
1597
|
+
ie("nyx-change")
|
|
1598
|
+
], p.prototype, "onChange", 2);
|
|
1599
|
+
let Le = p;
|
|
1600
|
+
customElements.get("nyx-treeview") || customElements.define("nyx-treeview", Le);
|
|
1481
1601
|
export {
|
|
1482
|
-
|
|
1602
|
+
Le as NyxTreeview
|
|
1483
1603
|
};
|