@nyx-ds/treeview 0.1.5 → 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.js CHANGED
@@ -1,5 +1,5 @@
1
- import { LitElement as Z, nothing as m, html as h, unsafeCSS as Y } from "lit";
2
- import { property as J, state as v } from "lit/decorators.js";
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
3
  import { repeat as Q } from "lit/directives/repeat.js";
4
4
  import { classMap as g } from "lit/directives/class-map.js";
5
5
  import { chevronRightRegular as X, magnifyingGlass as ee } from "@nyx-ds/core";
@@ -9,61 +9,61 @@ import "@nyx-ds/checkbox";
9
9
  import "@nyx-ds/radio";
10
10
  import "@nyx-ds/icon";
11
11
  import "@nyx-ds/button";
12
- function te(n, e) {
12
+ function te(o, e) {
13
13
  return function(t, i) {
14
- const { native: s = !1, ...r } = i || {}, o = s ? new Event(e, r) : new CustomEvent(e, { detail: t, ...r });
15
- n.dispatchEvent(o);
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 ie(n) {
18
+ function ie(o) {
19
19
  return (e, t) => {
20
20
  Object.defineProperty(e, t, {
21
21
  get() {
22
- return te(this, n);
22
+ return te(this, o);
23
23
  },
24
24
  enumerable: !0,
25
25
  configurable: !0
26
26
  });
27
27
  };
28
28
  }
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: 15px;--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}.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){display:flex;justify-content:center;align-items:center;--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 C(n, e) {
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 ? n.toLowerCase().includes(t) : !1;
32
+ return t ? o.toLowerCase().includes(t) : !1;
33
33
  }
34
- function z(n, e) {
35
- return n.includes(e);
34
+ function E(o, e) {
35
+ return o.includes(e);
36
36
  }
37
- function L(n) {
37
+ function T(o) {
38
38
  var s;
39
39
  const e = /* @__PURE__ */ new Map(), t = [], i = [];
40
- for (let r = n.length - 1; r >= 0; r--)
41
- i.push({ node: n[r], parentId: null });
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: o } = i.pop(), l = ((s = r.children) == null ? void 0 : s.map((a) => a.id)) ?? [];
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: o,
46
+ parentId: n,
47
47
  normalizedLabel: r.label.toLowerCase(),
48
48
  childIds: l,
49
49
  hasChildren: l.length > 0
50
- }), o === null && t.push(r.id), r.children)
50
+ }), n === null && t.push(r.id), r.children)
51
51
  for (let a = r.children.length - 1; a >= 0; a--)
52
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 ne(n) {
56
+ function ne(o) {
57
57
  const e = [], t = [];
58
- for (let i = n.roots.length - 1; i >= 0; i--)
59
- t.push({ id: n.roots[i], visited: !1 });
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 = n.byId.get(i.id);
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 ne(n) {
71
71
  }
72
72
  return e;
73
73
  }
74
- function oe(n, e, t) {
74
+ function oe(o, e, t) {
75
75
  const i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
76
- for (const o of ne(n)) {
77
- const l = n.byId.get(o);
76
+ for (const n of ne(o)) {
77
+ const l = o.byId.get(n);
78
78
  if (!l) continue;
79
- const a = z(
79
+ const a = E(
80
80
  l.normalizedLabel,
81
81
  e
82
82
  );
83
83
  let d = !1;
84
- for (const f of l.childIds)
85
- if (r.get(f)) {
84
+ for (const h of l.childIds)
85
+ if (r.get(h)) {
86
86
  d = !0;
87
87
  break;
88
88
  }
89
89
  const c = a || d;
90
- if (r.set(o, c), !c || (i.add(o), !l.hasChildren || !d)) continue;
90
+ if (r.set(n, c), !c || (i.add(n), !l.hasChildren || !d)) continue;
91
91
  let u = !1;
92
- for (const f of l.childIds) {
93
- const w = n.byId.get(f);
94
- if (w && z(w.normalizedLabel, e)) {
92
+ for (const h of l.childIds) {
93
+ const _ = o.byId.get(h);
94
+ if (_ && E(_.normalizedLabel, e)) {
95
95
  u = !0;
96
96
  break;
97
97
  }
98
98
  }
99
- !t.has(o) && (!a || u) && s.add(o);
99
+ !t.has(n) && (!a || u) && s.add(n);
100
100
  }
101
101
  return { visibleIds: i, expandIds: s };
102
102
  }
103
- function le(n, e) {
103
+ function le(o, e) {
104
104
  const t = e.trim().toLowerCase();
105
105
  if (!t) return 0;
106
- const i = Array.isArray(n) ? L(n) : n;
106
+ const i = Array.isArray(o) ? T(o) : o;
107
107
  let s = 0;
108
108
  for (const r of i.byId.values())
109
- z(r.normalizedLabel, t) && s++;
109
+ E(r.normalizedLabel, t) && s++;
110
110
  return s;
111
111
  }
112
- function ae(n, e, t = /* @__PURE__ */ new Set()) {
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(n) ? L(n) : n;
116
+ const s = Array.isArray(o) ? T(o) : o;
117
117
  return oe(s, i, t);
118
118
  }
119
- function B(n, e, t = "") {
120
- const i = n.children ?? [], s = t.trim().toLowerCase();
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) || C(r.label, s)
122
+ (r) => e.has(r.id) || R(r.label, s)
123
123
  ) : i.filter((r) => e.has(r.id));
124
124
  }
125
- function de(n, e, t) {
125
+ function de(o, e, t) {
126
126
  const i = e.trim().toLowerCase();
127
127
  if (!i) return !1;
128
- const s = [n];
128
+ const s = [o];
129
129
  for (; s.length > 0; ) {
130
130
  const r = s.pop();
131
- for (const o of t(r) ?? []) {
132
- if (C(o.label, i)) return !0;
133
- s.push(o.id);
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 ce(n, e, t) {
139
- const i = [n];
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,30 +146,30 @@ function ce(n, e, t) {
146
146
  }
147
147
  return !1;
148
148
  }
149
- function E(n, e, t, i, s, r) {
150
- return H(n, e, t) && !ce(i, s, r) && !de(i, e, r);
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 H(n, e, t) {
153
- return C(n, e) && !t;
152
+ function H(o, e, t) {
153
+ return R(o, e) && !t;
154
154
  }
155
- function O(n, e, t, i) {
156
- return t || H(n, e, i);
155
+ function O(o, e, t, i) {
156
+ return t || H(o, e, i);
157
157
  }
158
- function k(n, e) {
158
+ function k(o, e) {
159
159
  var t, i;
160
160
  if (e) {
161
- if (n.selected) return !0;
162
- } else if ((((t = n.selectedColumns) == null ? void 0 : t.length) ?? 0) > 0)
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 = n.children) == null ? void 0 : i.some(
164
+ return ((i = o.children) == null ? void 0 : i.some(
165
165
  (s) => k(s, e)
166
166
  )) ?? !1;
167
167
  }
168
- function j(n, e) {
169
- const t = n.map((i, s) => ({ node: i, index: s }));
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), o = k(s.node, e);
172
- return r !== o ? r ? -1 : 1 : i.index - s.index;
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 ? {
@@ -179,266 +179,266 @@ function j(n, e) {
179
179
  });
180
180
  }
181
181
  const y = 50;
182
- function he(n) {
183
- const e = [], t = n.map((s) => ({ node: s, depth: 0, parentId: null }));
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: o, parentId: l } = s, a = !!(r.children && r.children.length > 0);
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: o,
189
+ depth: n,
190
190
  parentId: l,
191
191
  hasChildrenInSource: a
192
192
  }), a)
193
193
  for (const d of r.children)
194
- t.push({ node: d, depth: o + 1, parentId: r.id });
194
+ t.push({ node: d, depth: n + 1, parentId: r.id });
195
195
  }
196
196
  return e;
197
197
  }
198
- function ue(n, e = y) {
198
+ function ue(o, e = y) {
199
199
  const t = /* @__PURE__ */ new Set();
200
- for (const i of n)
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 fe(n, e, t) {
205
+ function _e(o, e, t) {
206
206
  const i = [];
207
- for (const s of n)
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 _e(n, e) {
213
- return n.some((t) => t.depth === 0 && !e.has(t.id));
212
+ function fe(o, e) {
213
+ return o.some((t) => t.depth === 0 && !e.has(t.id));
214
214
  }
215
- function pe(n, e, t) {
216
- return T(e, n).some((i) => !t.has(i));
215
+ function pe(o, e, t) {
216
+ return A(e, o).some((i) => !t.has(i));
217
217
  }
218
- function W(n, e, t) {
218
+ function G(o, e, t) {
219
219
  return e.some(
220
- (i) => i.parentId === n && !t.has(i.id)
220
+ (i) => i.parentId === o && !t.has(i.id)
221
221
  );
222
222
  }
223
- function we(n, e) {
224
- const t = n[e];
223
+ function we(o, e) {
224
+ const t = o[e];
225
225
  if (!t) return e;
226
226
  let i = e;
227
- for (let s = e + 1; s < n.length && !(n[s].level <= t.level); s++)
227
+ for (let s = e + 1; s < o.length && !(o[s].level <= t.level); s++)
228
228
  i = s;
229
229
  return i;
230
230
  }
231
- function ve(n, e, t, i, s, r, o = 0) {
232
- if (n.length === 0) return;
231
+ function me(o, e, t, i, s, r, n = 0) {
232
+ if (o.length === 0) return;
233
233
  const l = Math.min(
234
234
  Math.max(0, e),
235
- Math.max(0, n.length - 1)
235
+ Math.max(0, o.length - 1)
236
236
  ), a = Math.min(
237
237
  Math.max(l, t),
238
- Math.max(0, n.length - 1)
239
- ), d = Math.max(0, Math.floor(o));
238
+ Math.max(0, o.length - 1)
239
+ ), d = Math.max(0, Math.floor(n));
240
240
  let c;
241
- for (let u = 0; u < n.length; u++) {
242
- const f = n[u];
243
- if (!i.has(f.node.id) || !W(f.node.id, s, r)) continue;
244
- const w = we(n, u), b = Math.max(u, w - d);
245
- l <= w && a >= b && (c = f.node.id);
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
246
  }
247
247
  return c;
248
248
  }
249
- function me(n, e) {
249
+ function ve(o, e) {
250
250
  const t = [];
251
- let i = e.get(n);
251
+ let i = e.get(o);
252
252
  for (; (i == null ? void 0 : i.parentId) != null; )
253
253
  t.push(i.parentId), i = e.get(i.parentId);
254
254
  return t;
255
255
  }
256
- function V(n, e, t) {
256
+ function V(o, e, t) {
257
257
  if (t < 0) return [];
258
- const i = $(n), s = [];
258
+ const i = M(o), s = [];
259
259
  for (const r of e) {
260
- const o = [
260
+ const n = [
261
261
  { id: r, level: 0 }
262
262
  ];
263
- for (; o.length > 0; ) {
264
- const l = o.pop();
263
+ for (; n.length > 0; ) {
264
+ const l = n.pop();
265
265
  if (l.level > t) continue;
266
266
  s.push(l.id);
267
267
  const a = i.get(l.id);
268
268
  if (!(!(a != null && a.length) || l.level >= t))
269
269
  for (let d = a.length - 1; d >= 0; d--)
270
- o.push({ id: a[d], level: l.level + 1 });
270
+ n.push({ id: a[d], level: l.level + 1 });
271
271
  }
272
272
  }
273
273
  return s;
274
274
  }
275
- function xe(n, e, t) {
275
+ function xe(o, e, t) {
276
276
  if (t <= 0) return [];
277
- const i = $(n), s = [];
277
+ const i = M(o), s = [];
278
278
  for (const r of e) {
279
- const o = [
279
+ const n = [
280
280
  { id: r, level: 0 }
281
281
  ];
282
- for (; o.length > 0; ) {
283
- const l = o.pop();
282
+ for (; n.length > 0; ) {
283
+ const l = n.pop();
284
284
  if (l.level >= t) continue;
285
285
  const a = i.get(l.id);
286
286
  if (a != null && a.length) {
287
287
  s.push(l.id);
288
288
  for (let d = a.length - 1; d >= 0; d--)
289
- o.push({ id: a[d], level: l.level + 1 });
289
+ n.push({ id: a[d], level: l.level + 1 });
290
290
  }
291
291
  }
292
292
  }
293
293
  return s;
294
294
  }
295
- function P(n, e, t, i) {
296
- const s = [], r = (o) => {
297
- s.length >= t || !e.has(o) && !s.includes(o) && s.push(o);
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);
298
298
  };
299
299
  if (i != null) {
300
- const o = T(n, i);
301
- for (const l of o) r(l);
300
+ const n = A(o, i);
301
+ for (const l of n) r(l);
302
302
  }
303
- for (const o of n)
304
- if (r(o.id), s.length >= t) break;
303
+ for (const n of o)
304
+ if (r(n.id), s.length >= t) break;
305
305
  return s;
306
306
  }
307
- function T(n, e) {
308
- const t = $(n), i = [], s = [e];
307
+ function A(o, e) {
308
+ const t = M(o), i = [], s = [e];
309
309
  for (; s.length > 0; ) {
310
310
  const r = s.pop();
311
311
  i.push(r);
312
- const o = t.get(r);
313
- if (o != null && o.length)
314
- for (let l = o.length - 1; l >= 0; l--)
315
- s.push(o[l]);
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]);
316
316
  }
317
317
  return i;
318
318
  }
319
- function $(n) {
319
+ function M(o) {
320
320
  const e = /* @__PURE__ */ new Map();
321
- for (const t of n) {
321
+ for (const t of o) {
322
322
  const i = t.parentId;
323
323
  e.has(i) || e.set(i, []), e.get(i).push(t.id);
324
324
  }
325
325
  return e;
326
326
  }
327
- function be(n, e, t) {
328
- return T(n, e).filter((i) => !t.has(i));
327
+ function be(o, e, t) {
328
+ return A(o, e).filter((i) => !t.has(i));
329
329
  }
330
- function ge(n, e, t, i = y) {
331
- return be(n, e, t).slice(0, i);
330
+ function ge(o, e, t, i = y) {
331
+ return be(o, e, t).slice(0, i);
332
332
  }
333
- function M(n) {
333
+ function D(o) {
334
334
  var e;
335
335
  return {
336
- ...n,
337
- selectedColumns: n.selectedColumns ? [...n.selectedColumns] : void 0,
338
- disabledColumns: n.disabledColumns ? [...n.disabledColumns] : void 0,
339
- children: (e = n.children) == null ? void 0 : e.map((t) => M(t)),
340
- data: n.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
341
341
  };
342
342
  }
343
- function ye(n) {
343
+ function ye(o) {
344
344
  const e = /* @__PURE__ */ new Map(), t = (i) => {
345
345
  var s;
346
346
  e.set(i.id, i), (s = i.children) == null || s.forEach(t);
347
347
  };
348
- return n.forEach(t), e;
348
+ return o.forEach(t), e;
349
349
  }
350
- function Ie(n, e, t) {
350
+ function Se(o, e, t) {
351
351
  const i = (s) => {
352
352
  if (!e.has(s.id)) return null;
353
- const r = t.get(s.id) ?? s, o = (r.children ?? []).map((a) => i(a)).filter((a) => a !== null), l = M(r);
354
- return l.children = o.length > 0 ? o : void 0, l;
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;
355
355
  };
356
- return n.map((s) => i(s)).filter((s) => s !== null);
356
+ return o.map((s) => i(s)).filter((s) => s !== null);
357
357
  }
358
- function U(n) {
359
- const e = [], t = n.searchTerm.trim().toLowerCase(), i = (s, r, o, l, a = !1) => {
360
- const d = n.hasSearch && !a ? s.filter((c) => n.searchVisibleIds.has(c.id)) : s;
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;
361
361
  for (const c of d) {
362
- const u = n.hasSearch && !!t && c.label.toLowerCase().includes(t), f = O(
362
+ const u = o.hasSearch && !!t && c.label.toLowerCase().includes(t), h = O(
363
363
  c.label,
364
364
  t,
365
- o,
365
+ n,
366
366
  l
367
- ), w = l || !!u;
367
+ ), _ = l || !!u;
368
368
  if (e.push({
369
369
  node: c,
370
370
  level: r,
371
- revealSubtree: f,
372
- parentLabelMatched: w,
373
- hasChildrenInSource: n.sourceHasChildren(c.id)
374
- }), !n.expandedIds.has(c.id)) continue;
375
- const A = n.getSourceChildren ?? ((R) => {
376
- var D;
377
- return (D = n.items.find((K) => K.id === R)) == null ? void 0 : D.children;
378
- }), I = !n.hasSearch || f && E(
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(
379
379
  c.label,
380
380
  t,
381
381
  l,
382
382
  c.id,
383
- n.searchVisibleIds,
384
- A
385
- ) ? c.children ?? [] : B(
383
+ o.searchVisibleIds,
384
+ S
385
+ ) ? c.children ?? [] : q(
386
386
  c,
387
- n.searchVisibleIds,
388
- n.searchTerm
387
+ o.searchVisibleIds,
388
+ o.searchTerm
389
389
  );
390
- I.length > 0 && i(I, r + 1, f, w, !0);
390
+ I.length > 0 && i(I, r + 1, h, _, !0);
391
391
  }
392
392
  };
393
- return i(n.items, 0, !1, !1), e;
393
+ return i(o.items, 0, !1, !1), e;
394
394
  }
395
- function S(n, e) {
396
- for (const t of n)
395
+ function C(o, e) {
396
+ for (const t of o)
397
397
  if (!e.has(t)) return !0;
398
398
  return !1;
399
399
  }
400
- function G(n, e, t, i = y) {
401
- const s = [], r = (o) => {
402
- s.length >= i || !e.has(o) && !s.includes(o) && s.push(o);
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);
403
403
  };
404
- for (const o of n)
405
- if (!e.has(o)) {
406
- r(o);
407
- for (const l of me(o, t))
404
+ for (const n of o)
405
+ if (!e.has(n)) {
406
+ r(n);
407
+ for (const l of ve(n, t))
408
408
  r(l);
409
409
  if (s.length >= i) break;
410
410
  }
411
411
  return s;
412
412
  }
413
- function F(n, e, t, i = y) {
414
- const s = G(
415
- n,
413
+ function F(o, e, t, i = y) {
414
+ const s = W(
415
+ o,
416
416
  e,
417
417
  t,
418
418
  i
419
419
  );
420
420
  return s.length === 0 ? !1 : (s.forEach((r) => e.add(r)), !0);
421
421
  }
422
- function Se(n, e) {
423
- return e ? `Collapse ${n}` : `Expand ${n}`;
422
+ function Ie(o, e) {
423
+ return e ? `Collapse ${o}` : `Expand ${o}`;
424
424
  }
425
- function q(n) {
426
- return `Select ${n}`;
425
+ function U(o) {
426
+ return `Select ${o}`;
427
427
  }
428
- function Ce(n, e) {
429
- return `${n}, ${e}`;
428
+ function Ce(o, e) {
429
+ return `${o}, ${e}`;
430
430
  }
431
- function Re(n) {
432
- return n === 0 ? "No results found" : n === 1 ? "1 result found" : `${n} results found`;
431
+ function Re(o) {
432
+ return o === 0 ? "No results found" : o === 1 ? "1 result found" : `${o} results found`;
433
433
  }
434
- var ze = Object.defineProperty, Ee = Object.getOwnPropertyDescriptor, p = (n, e, t, i) => {
435
- for (var s = i > 1 ? void 0 : i ? Ee(e, t) : e, r = n.length - 1, o; r >= 0; r--)
436
- (o = n[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
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);
437
437
  return i && s && ze(e, t, s), s;
438
438
  }, x;
439
- const _ = (x = class extends Z {
439
+ const p = (x = class extends Z {
440
440
  constructor() {
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._searchIndex = null, this._searchIndexSourceRef = null, this._searchDebounceTimer = null;
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;
442
442
  }
443
443
  get options() {
444
444
  return this._options;
@@ -477,7 +477,7 @@ const _ = (x = class extends Z {
477
477
  }
478
478
  _applyItemsFromOptions(e) {
479
479
  var i;
480
- let t = e.map((s) => M(s));
480
+ let t = e.map((s) => D(s));
481
481
  return this._usesUniqueRowSelection() && this._applyUniqueSelectionConstraint(t), (i = this.options) != null && i.sortSelectedFirst && (t = j(t, this._usesSimpleRowSelection())), t;
482
482
  }
483
483
  _applyUniqueSelectionConstraint(e) {
@@ -491,7 +491,7 @@ const _ = (x = class extends Z {
491
491
  }
492
492
  _applyOptionsChange() {
493
493
  if (this.options) {
494
- if (this._isLazyEnabled()) {
494
+ if (this._invalidateSelectionStats(), this._isLazyEnabled()) {
495
495
  this.options.items !== this._lazyItemsSourceRef && (this._initLazyState(), this._resetSearchDerivedState(), this._searchTerm.trim() && this._recomputeSearchFilter());
496
496
  return;
497
497
  }
@@ -508,7 +508,7 @@ const _ = (x = class extends Z {
508
508
  }
509
509
  _initLazyState() {
510
510
  var s;
511
- this._lazyItemsSourceRef = this.options.items, this._sourceItems = this._applyItemsFromOptions(this.options.items), this._invalidateSearchIndex(), this._treeIndex = he(this._sourceItems), this._indexById = new Map(this._treeIndex.map((r) => [r.id, r])), this._sourceById = ye(this._sourceItems);
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
512
  const e = (s = this.options) == null ? void 0 : s.defaultExpandedLevel, t = this._getLazyPageSize(), i = ue(this._treeIndex, t);
513
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();
514
514
  }
@@ -523,7 +523,7 @@ const _ = (x = class extends Z {
523
523
  ), this._expandedIds = new Set(this._expandedIds);
524
524
  }
525
525
  _rebuildMaterializedItems() {
526
- this._items = Ie(
526
+ this._items = Se(
527
527
  this._sourceItems,
528
528
  this._loadedIds,
529
529
  this._sourceById
@@ -536,6 +536,42 @@ const _ = (x = class extends Z {
536
536
  _selectionNode(e) {
537
537
  return this._isLazyEnabled() ? this._sourceById.get(e.id) ?? e : e;
538
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
+ }
539
575
  _invalidateSearchIndex() {
540
576
  this._searchIndex = null, this._searchIndexSourceRef = null;
541
577
  }
@@ -545,11 +581,28 @@ const _ = (x = class extends Z {
545
581
  }
546
582
  _ensureSearchIndex() {
547
583
  const e = this._selectionRoots();
548
- return this._searchIndex && this._searchIndexSourceRef === e ? this._searchIndex : (this._searchIndexSourceRef = e, this._searchIndex = L(e), this._searchIndex);
584
+ return this._searchIndex && this._searchIndexSourceRef === e ? this._searchIndex : (this._searchIndexSourceRef = e, this._searchIndex = T(e), this._searchIndex);
549
585
  }
550
586
  disconnectedCallback() {
551
587
  super.disconnectedCallback(), this._searchDebounceTimer !== null && (clearTimeout(this._searchDebounceTimer), this._searchDebounceTimer = null);
552
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
+ }
553
606
  _findNodeById(e, t) {
554
607
  for (const i of e) {
555
608
  if (i.id === t) return i;
@@ -560,11 +613,11 @@ const _ = (x = class extends Z {
560
613
  }
561
614
  }
562
615
  _forEachInSubtree(e, t, i) {
563
- const s = this._findNodeById(e, t);
616
+ const s = this._isLazyEnabled() ? this._sourceById.get(t) : this._findNodeById(e, t);
564
617
  if (!s) return;
565
- const r = (o) => {
618
+ const r = (n) => {
566
619
  var l;
567
- i(o), (l = o.children) == null || l.forEach(r);
620
+ i(n), (l = n.children) == null || l.forEach(r);
568
621
  };
569
622
  r(s);
570
623
  }
@@ -573,20 +626,20 @@ const _ = (x = class extends Z {
573
626
  return t == null ? void 0 : t.children;
574
627
  }
575
628
  _loadMoreNodes(e) {
576
- var o, l;
629
+ var n, l;
577
630
  if (!this._isLazyEnabled()) return;
578
631
  const t = this._getLazyPageSize();
579
632
  let i, s = [];
580
633
  if (this._isSearchActive())
581
- if (S(this._searchVisibleIds, this._loadedIds))
582
- i = G(
634
+ if (C(this._searchVisibleIds, this._loadedIds))
635
+ i = W(
583
636
  this._searchVisibleIds,
584
637
  this._loadedIds,
585
638
  this._indexById,
586
639
  t
587
640
  );
588
641
  else if (e != null && this._hasExclusiveSearchFolderWithUnloadedChildren())
589
- i = P(
642
+ i = B(
590
643
  this._treeIndex,
591
644
  this._loadedIds,
592
645
  t,
@@ -595,19 +648,19 @@ const _ = (x = class extends Z {
595
648
  else
596
649
  return;
597
650
  else if (e != null)
598
- i = P(
651
+ i = B(
599
652
  this._treeIndex,
600
653
  this._loadedIds,
601
654
  t,
602
655
  e
603
656
  );
604
657
  else {
605
- s = fe(
658
+ s = _e(
606
659
  this._treeIndex,
607
660
  this._loadedIds,
608
661
  t
609
662
  ), i = [...s];
610
- const a = (o = this.options) == null ? void 0 : o.defaultExpandedLevel;
663
+ const a = (n = this.options) == null ? void 0 : n.defaultExpandedLevel;
611
664
  a !== void 0 && a > 0 && i.push(
612
665
  ...V(
613
666
  this._treeIndex,
@@ -636,10 +689,10 @@ const _ = (x = class extends Z {
636
689
  }
637
690
  /** Refresh lazy flat rows after intentional lazy state mutations. */
638
691
  _commitLazyRows() {
639
- this._isLazyEnabled() && this._syncFlatRows();
692
+ this._isLazyEnabled() && (this._syncFlatRows(), this._generateLightDomIcons());
640
693
  }
641
694
  _syncFlatRows() {
642
- this._flatRows = U({
695
+ this._flatRows = P({
643
696
  items: this._items,
644
697
  expandedIds: this._expandedIds,
645
698
  hasSearch: !!this._searchTerm.trim(),
@@ -680,14 +733,14 @@ const _ = (x = class extends Z {
680
733
  _getSearchScrollTargetIndex() {
681
734
  const e = this._searchTerm.trim().toLowerCase();
682
735
  if (!e || this._flatRows.length === 0) return 0;
683
- const t = this._flatRows.map((r, o) => ({ row: r, index: o })).filter(({ row: r }) => C(r.node.label, e));
736
+ const t = this._flatRows.map((r, n) => ({ row: r, index: n })).filter(({ row: r }) => R(r.node.label, e));
684
737
  if (t.length === 0) return 0;
685
738
  const i = t.reduce(
686
- (r, o) => o.row.level >= r.row.level ? o : r
739
+ (r, n) => n.row.level >= r.row.level ? n : r
687
740
  ), [s] = t;
688
741
  if (t.length > 1 && s.row.hasChildrenInSource && this._expandedIds.has(s.row.node.id)) {
689
742
  const r = t.find(
690
- ({ row: o }) => o.level === s.row.level + 1 && o.node.label.toLowerCase() === s.row.node.label.toLowerCase()
743
+ ({ row: n }) => n.level === s.row.level + 1 && n.node.label.toLowerCase() === s.row.node.label.toLowerCase()
691
744
  );
692
745
  if (r) return r.index;
693
746
  }
@@ -695,8 +748,8 @@ const _ = (x = class extends Z {
695
748
  }
696
749
  _loadUntilSearchTargetVisible() {
697
750
  let e = 0;
698
- for (; e++ < 100 && !(this._getSearchScrollTargetIndex() < this._flatRows.length || !S(this._searchVisibleIds, this._loadedIds) && !this._hasExpandedUnloadedSubtree()); ) {
699
- if (S(this._searchVisibleIds, this._loadedIds)) {
751
+ for (; e++ < 100 && !(this._getSearchScrollTargetIndex() < this._flatRows.length || !C(this._searchVisibleIds, this._loadedIds) && !this._hasExpandedUnloadedSubtree()); ) {
752
+ if (C(this._searchVisibleIds, this._loadedIds)) {
700
753
  if (!F(
701
754
  this._searchVisibleIds,
702
755
  this._loadedIds,
@@ -718,7 +771,7 @@ const _ = (x = class extends Z {
718
771
  }
719
772
  _hasExpandedUnloadedSubtree() {
720
773
  for (const e of this._expandedIds)
721
- if (W(e, this._treeIndex, this._loadedIds))
774
+ if (G(e, this._treeIndex, this._loadedIds))
722
775
  return !0;
723
776
  return !1;
724
777
  }
@@ -729,7 +782,7 @@ const _ = (x = class extends Z {
729
782
  if (!e) return !1;
730
783
  for (const t of this._expandedIds) {
731
784
  const i = this._sourceById.get(t);
732
- if (i && pe(t, this._treeIndex, this._loadedIds) && E(
785
+ if (i && pe(t, this._treeIndex, this._loadedIds) && L(
733
786
  i.label,
734
787
  e,
735
788
  !1,
@@ -742,16 +795,16 @@ const _ = (x = class extends Z {
742
795
  return !1;
743
796
  }
744
797
  _shouldLoadMoreOnScroll() {
745
- return this._isLazyEnabled() ? this._isSearchActive() ? S(
798
+ return this._isLazyEnabled() ? this._isSearchActive() ? C(
746
799
  this._searchVisibleIds,
747
800
  this._loadedIds
748
801
  ) || this._hasExclusiveSearchFolderWithUnloadedChildren() : this._hasExpandedUnloadedSubtree() ? this._treeIndex.some(
749
802
  (e) => !this._loadedIds.has(e.id)
750
- ) : _e(this._treeIndex, this._loadedIds) : !1;
803
+ ) : fe(this._treeIndex, this._loadedIds) : !1;
751
804
  }
752
805
  _getLazyLoadPriorityNodeId(e, t) {
753
806
  if (!(!this._isSearchActive() && !this._hasExpandedUnloadedSubtree()))
754
- return ve(
807
+ return me(
755
808
  this._flatRows,
756
809
  e,
757
810
  t,
@@ -766,13 +819,13 @@ const _ = (x = class extends Z {
766
819
  }
767
820
  _onVirtualizerVisibilityChanged(e) {
768
821
  const t = e, i = t.first, s = t.last;
769
- if (s == null || !this._shouldLoadMoreOnScroll() || this._lazyScrollLoading)
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)
770
823
  return;
771
- const r = this._getLazyLoadPriorityNodeId(i ?? s, s), o = Math.max(
824
+ const r = this._getLazyLoadPriorityNodeId(i ?? s, s), n = Math.max(
772
825
  0,
773
826
  this._flatRows.length - this._getScrollPrefetchMargin()
774
827
  );
775
- r == null && s < o || (this._lazyScrollLoading = !0, this._loadMoreNodes(r), this.updateComplete.then(() => {
828
+ r == null && s < n || (this._lazyScrollLoading = !0, this._loadMoreNodes(r), this.updateComplete.then(() => {
776
829
  this._lazyScrollLoading = !1;
777
830
  }));
778
831
  }
@@ -781,17 +834,17 @@ const _ = (x = class extends Z {
781
834
  return ((t = (e = this.options) == null ? void 0 : e.title) == null ? void 0 : t.trim()) || "Treeview";
782
835
  }
783
836
  _renderTreeRow(e, t, i) {
784
- const { isExpanded: s, hasChildren: r, isRowHighlighted: o, isSelectable: l } = i;
785
- return h`
837
+ const { isExpanded: s, hasChildren: r, isRowHighlighted: n, isSelectable: l } = i;
838
+ return f`
786
839
  <div
787
840
  id=${this._rowDomId(e.id)}
788
841
  role="treeitem"
789
842
  aria-level=${t + 1}
790
- aria-expanded=${r ? s ? "true" : "false" : m}
843
+ aria-expanded=${r ? s ? "true" : "false" : b}
791
844
  class=${g({
792
845
  "node-row": !0,
793
846
  selectable: l,
794
- selected: o
847
+ selected: n
795
848
  })}
796
849
  style="--treeview-row-level: ${t}"
797
850
  tabindex=${this._getRowTabIndex(e.id)}
@@ -811,14 +864,14 @@ const _ = (x = class extends Z {
811
864
  `;
812
865
  }
813
866
  _renderExpanderCell(e, t, i) {
814
- return i ? h`
867
+ return i ? f`
815
868
  <nyx-button
816
869
  class="expander"
817
870
  size="small"
818
871
  button-icon
819
872
  tabindex="-1"
820
873
  hierarchy="ghost"
821
- aria-label=${Se(e.label, t)}
874
+ aria-label=${Ie(e.label, t)}
822
875
  @click=${() => this._toggleExpand(e, !1)}
823
876
  @keydown=${(s) => {
824
877
  (s.key === "Enter" || s.key === " ") && (s.preventDefault(), s.stopPropagation(), this._toggleExpand(e, !0));
@@ -830,32 +883,32 @@ const _ = (x = class extends Z {
830
883
  .svg=${X}
831
884
  ></nyx-icon>
832
885
  </nyx-button>
833
- ` : h`<span class="expander-placeholder" aria-hidden="true"></span>`;
834
- }
835
- _renderNodeTypeIcon(e) {
836
- const t = e.icon;
837
- return t ? typeof t == "string" ? h`<nyx-icon name=${t} variant="regular"></nyx-icon>` : h`
838
- <nyx-icon
839
- name=${t.name ?? m}
840
- variant=${t.variant ?? "regular"}
841
- src=${t.src ?? m}
842
- .svg=${t.svg}
843
- ></nyx-icon>
844
- ` : m;
886
+ ` : f`<span class="expander-placeholder" aria-hidden="true"></span>`;
845
887
  }
846
888
  _generateLightDomIcons() {
847
- var i;
848
- if (this.querySelectorAll("[data-auto-generated]").forEach((s) => s.remove()), !this.options || (this._hasColumnPermissions() && ((i = this.options.columns) == null || i.forEach((s, r) => {
849
- s.icon && this._createIconElement(s.icon, `generated-header-icon-${r}`);
850
- })), this._isLazyEnabled() || !this._showNodeIcons())) return;
851
- const t = (s) => {
852
- var r;
853
- s.icon && this._createIconElement(
854
- s.icon,
855
- `generated-tree-icon-${s.id}`
856
- ), (r = s.children) == null || r.forEach(t);
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);
857
901
  };
858
- this._items.forEach(t);
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);
859
912
  }
860
913
  _createIconElement(e, t) {
861
914
  const i = document.createElement("nyx-icon");
@@ -875,13 +928,14 @@ const _ = (x = class extends Z {
875
928
  }
876
929
  _isIndeterminate(e, t) {
877
930
  if (e = this._selectionNode(e), !e.children || e.children.length === 0) return !1;
878
- const i = this._getFlatDescendants(e), s = i.filter(
879
- (r) => this._isNodeSelected(r, t)
880
- ).length;
881
- 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;
882
933
  }
883
934
  _allDescendantsSelected(e, t) {
884
- return e = this._selectionNode(e), !e.children || e.children.length === 0 ? this._isNodeSelected(e, t) : this._getFlatDescendants(e).every((s) => this._isNodeSelected(s, t));
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;
885
939
  }
886
940
  _getFlatDescendants(e) {
887
941
  e = this._selectionNode(e);
@@ -894,17 +948,17 @@ const _ = (x = class extends Z {
894
948
  /** Transitive set of prerequisite column ids for `columnId` (excludes itself). */
895
949
  _requiredClosure(e) {
896
950
  var l, a, d;
897
- 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]), o = [...((a = i.get(e)) == null ? void 0 : a.requires) ?? []];
898
- for (; o.length; ) {
899
- const c = o.pop();
900
- r.has(c) || (r.add(c), s.push(c), o.push(...((d = i.get(c)) == null ? void 0 : d.requires) ?? []));
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) ?? []));
901
955
  }
902
956
  return s;
903
957
  }
904
958
  /** Transitive set of column ids that depend on `columnId` (excludes itself). */
905
959
  _dependentsClosure(e) {
906
- var o;
907
- const t = ((o = this.options) == null ? void 0 : o.columns) ?? [], i = [], s = /* @__PURE__ */ new Set([e]), r = [e];
960
+ var n;
961
+ const t = ((n = this.options) == null ? void 0 : n.columns) ?? [], i = [], s = /* @__PURE__ */ new Set([e]), r = [e];
908
962
  for (; r.length; ) {
909
963
  const l = r.pop();
910
964
  for (const a of t)
@@ -920,22 +974,20 @@ const _ = (x = class extends Z {
920
974
  _handleCheck(e, t) {
921
975
  const i = this._selectionNode(e);
922
976
  if (this._isColumnDisabled(i, t)) return;
923
- const r = !this._isNodeSelected(i, t), o = this._requiredClosure(t), l = r ? [t, ...o] : [t, ...this._dependentsClosure(t)];
977
+ const r = !this._isNodeSelected(i, t), n = this._requiredClosure(t), l = r ? [t, ...n] : [t, ...this._dependentsClosure(t)];
924
978
  this._forEachInSubtree(this._selectionRoots(), e.id, (a) => {
925
- r && o.some(
979
+ r && n.some(
926
980
  (c) => this._isColumnDisabled(a, c)
927
981
  ) || l.forEach(
928
982
  (d) => this._toggleNodeState(a, d, r)
929
983
  );
930
- }), l.forEach(
931
- (a) => this._updateParents(this._selectionRoots(), e.id, a)
932
- ), this._triggerChange();
984
+ }), l.forEach((a) => this._updateColumnAncestors(e.id, a)), this._triggerChange();
933
985
  }
934
986
  _toggleNodeState(e, t, i) {
935
987
  if (this._isColumnDisabled(e, t)) return;
936
988
  e.selectedColumns || (e.selectedColumns = []);
937
989
  const s = e.selectedColumns.indexOf(t);
938
- 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());
939
991
  }
940
992
  _updateParents(e, t, i) {
941
993
  for (const s of e)
@@ -943,7 +995,7 @@ const _ = (x = class extends Z {
943
995
  (r) => r.id === t || this._updateParents(s.children, t, i)
944
996
  )) {
945
997
  const r = s.children.every(
946
- (o) => this._allDescendantsSelected(o, i)
998
+ (n) => this._allDescendantsSelected(n, i)
947
999
  );
948
1000
  return this._toggleNodeState(
949
1001
  s,
@@ -953,6 +1005,29 @@ const _ = (x = class extends Z {
953
1005
  }
954
1006
  return !1;
955
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
+ }
956
1031
  _isRowAllSelected(e) {
957
1032
  var i;
958
1033
  if (e = this._selectionNode(e), !((i = this.options) != null && i.columns)) return !1;
@@ -971,15 +1046,19 @@ const _ = (x = class extends Z {
971
1046
  }
972
1047
  _isSimpleRowAllSelected(e) {
973
1048
  var t;
974
- return e = this._selectionNode(e), (t = e.children) != null && t.length ? e.children.every((i) => this._isSimpleRowAllSelected(i)) : !!e.selected;
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;
975
1054
  }
976
1055
  _isSimpleRowIndeterminate(e) {
977
- var s;
978
- return e = this._selectionNode(e), this._isSimpleRowAllSelected(e) || !((s = e.children) != null && s.length) ? !1 : this._getFlatDescendants(e).filter((r) => r.selected).length > 0;
1056
+ var t;
1057
+ return e = this._selectionNode(e), this._isSimpleRowAllSelected(e) || !((t = e.children) != null && t.length) ? !1 : this._getSelectionStats(e).simpleSelectedDescendantCount > 0;
979
1058
  }
980
1059
  _setSimpleRowSelected(e, t) {
981
1060
  this._forEachInSubtree(this._selectionRoots(), e, (i) => {
982
- i.selected = t;
1061
+ i.selected !== t && (i.selected = t, this._invalidateSelectionStats());
983
1062
  });
984
1063
  }
985
1064
  _updateSimpleRowParents(e, t) {
@@ -987,12 +1066,33 @@ const _ = (x = class extends Z {
987
1066
  for (const s of e)
988
1067
  if ((i = s.children) != null && i.some(
989
1068
  (r) => r.id === t || this._updateSimpleRowParents(s.children, t)
990
- ))
991
- return s.selected = s.children.every(
992
- (r) => this._isSimpleRowAllSelected(r)
993
- ), !0;
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
+ }
994
1075
  return !1;
995
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
+ }
996
1096
  _isRowCheckboxChecked(e) {
997
1097
  const t = this._selectionNode(e);
998
1098
  return this._usesUniqueRowSelection() ? !!t.selected : this._usesSimpleRowSelection() ? this._isSimpleRowAllSelected(t) : this._isRowAllSelected(t);
@@ -1007,8 +1107,8 @@ const _ = (x = class extends Z {
1007
1107
  let t = !1;
1008
1108
  const i = (s) => {
1009
1109
  s.forEach((r) => {
1010
- const o = r.id === e;
1011
- !!r.selected !== o && (r.selected = o, t = !0), r.children && i(r.children);
1110
+ const n = r.id === e;
1111
+ !!r.selected !== n && (r.selected = n, this._invalidateSelectionStats(), t = !0), r.children && i(r.children);
1012
1112
  });
1013
1113
  };
1014
1114
  return i(this._selectionRoots()), t;
@@ -1020,17 +1120,23 @@ const _ = (x = class extends Z {
1020
1120
  return;
1021
1121
  }
1022
1122
  const i = !this._isRowCheckboxChecked(e);
1023
- this._usesSimpleRowSelection() ? (this._setSimpleRowSelected(e.id, i), this._updateSimpleRowParents(this._selectionRoots(), e.id)) : (this._toggleRowRecursively(e.id, i), (s = this.options) != null && s.columns && this.options.columns.forEach((r) => {
1024
- this._updateParents(this._selectionRoots(), e.id, r.id);
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);
1025
1125
  })), this._triggerChange();
1026
1126
  }
1027
1127
  _applyRowColumnsToNode(e, t) {
1028
1128
  var i;
1029
- (i = this.options) != null && i.columns && (t ? this.options.columns.forEach((s) => {
1030
- this._canEnableColumn(e, s.id) && (e.selectedColumns || (e.selectedColumns = []), e.selectedColumns.includes(s.id) || e.selectedColumns.push(s.id));
1031
- }) : e.selectedColumns = (e.selectedColumns ?? []).filter(
1032
- (s) => this._isColumnDisabled(e, s)
1033
- ));
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
+ }
1034
1140
  }
1035
1141
  _toggleRowRecursively(e, t) {
1036
1142
  this._forEachInSubtree(this._selectionRoots(), e, (i) => {
@@ -1072,8 +1178,8 @@ const _ = (x = class extends Z {
1072
1178
  e,
1073
1179
  this._searchUserCollapsedIds
1074
1180
  ), r = new Set(s);
1075
- this._searchManualExpandedIds.forEach((o) => {
1076
- this._searchUserCollapsedIds.has(o) || r.add(o);
1181
+ this._searchManualExpandedIds.forEach((n) => {
1182
+ this._searchUserCollapsedIds.has(n) || r.add(n);
1077
1183
  }), this._searchVisibleIds = i, this._expandedIds = r, this._isLazyEnabled() ? (F(
1078
1184
  i,
1079
1185
  this._loadedIds,
@@ -1101,7 +1207,7 @@ const _ = (x = class extends Z {
1101
1207
  return this._isLazyEnabled() ? this._sourceHasChildren(e.id) : !!(e.children && e.children.length > 0);
1102
1208
  }
1103
1209
  _getVisibleTreeRows() {
1104
- return this._isLazyEnabled() ? this._flatRows : U({
1210
+ return this._isLazyEnabled() ? this._flatRows : P({
1105
1211
  items: this._items,
1106
1212
  expandedIds: this._expandedIds,
1107
1213
  hasSearch: this._isSearchActive(),
@@ -1121,10 +1227,10 @@ const _ = (x = class extends Z {
1121
1227
  return r ?? void 0;
1122
1228
  }
1123
1229
  let t;
1124
- const i = (r, o) => {
1230
+ const i = (r, n) => {
1125
1231
  for (const l of r) {
1126
1232
  if (l.id === e)
1127
- return t = o ?? void 0, !0;
1233
+ return t = n ?? void 0, !0;
1128
1234
  if (l.children && i(l.children, l.id))
1129
1235
  return !0;
1130
1236
  }
@@ -1136,12 +1242,12 @@ const _ = (x = class extends Z {
1136
1242
  this._setActiveRow(e), this.updateComplete.then(() => {
1137
1243
  var i, s, r;
1138
1244
  if (this._isLazyEnabled()) {
1139
- const o = this._flatRows.findIndex((l) => l.node.id === e);
1140
- if (o >= 0) {
1245
+ const n = this._flatRows.findIndex((l) => l.node.id === e);
1246
+ if (n >= 0) {
1141
1247
  const l = (i = this.shadowRoot) == null ? void 0 : i.querySelector(
1142
1248
  "lit-virtualizer"
1143
1249
  );
1144
- (s = l == null ? void 0 : l.scrollToIndex) == null || s.call(l, o, "nearest");
1250
+ (s = l == null ? void 0 : l.scrollToIndex) == null || s.call(l, n, "nearest");
1145
1251
  }
1146
1252
  }
1147
1253
  const t = (r = this.shadowRoot) == null ? void 0 : r.querySelector(
@@ -1165,7 +1271,7 @@ const _ = (x = class extends Z {
1165
1271
  const i = e.currentTarget;
1166
1272
  if (e.target !== i)
1167
1273
  return;
1168
- const s = this._getVisibleTreeRows(), r = s.findIndex((d) => d.node.id === t.id), o = this._nodeHasChildren(t), l = this._expandedIds.has(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);
1169
1275
  if (e.key === "ArrowDown" || e.key === "ArrowUp") {
1170
1276
  const d = e.key === "ArrowDown" ? r + 1 : r - 1;
1171
1277
  d >= 0 && d < s.length && (e.preventDefault(), this._focusRowById(s[d].node.id));
@@ -1179,7 +1285,7 @@ const _ = (x = class extends Z {
1179
1285
  return;
1180
1286
  }
1181
1287
  if (e.key === "ArrowRight") {
1182
- if (!o) return;
1288
+ if (!n) return;
1183
1289
  if (e.preventDefault(), !l) {
1184
1290
  await this._toggleExpand(t, !0);
1185
1291
  return;
@@ -1188,7 +1294,7 @@ const _ = (x = class extends Z {
1188
1294
  return;
1189
1295
  }
1190
1296
  if (e.key === "ArrowLeft") {
1191
- if (e.preventDefault(), o && l) {
1297
+ if (e.preventDefault(), n && l) {
1192
1298
  await this._toggleExpand(t, !1), i.focus();
1193
1299
  return;
1194
1300
  }
@@ -1234,7 +1340,7 @@ const _ = (x = class extends Z {
1234
1340
  });
1235
1341
  }
1236
1342
  _renderRowSelectionCheckbox(e) {
1237
- return this._showRowSelection() ? this._usesUniqueRowSelection() ? h`
1343
+ return this._showRowSelection() ? this._usesUniqueRowSelection() ? f`
1238
1344
  <div class="row-checkbox">
1239
1345
  <nyx-radio
1240
1346
  ?checked=${this._isRowCheckboxChecked(e)}
@@ -1248,14 +1354,14 @@ const _ = (x = class extends Z {
1248
1354
  tabindex="-1"
1249
1355
  name=${this._rowSelectionRadioName}
1250
1356
  .checked=${this._isRowCheckboxChecked(e)}
1251
- aria-label=${q(e.label)}
1357
+ aria-label=${U(e.label)}
1252
1358
  />
1253
1359
  </nyx-radio>
1254
1360
  </div>
1255
- ` : h`
1361
+ ` : f`
1256
1362
  <div class="row-checkbox">
1257
1363
  <nyx-checkbox
1258
- aria-label=${q(e.label)}
1364
+ aria-label=${U(e.label)}
1259
1365
  ?checked=${this._isRowCheckboxChecked(e)}
1260
1366
  ?indeterminate=${this._isRowCheckboxIndeterminate(e)}
1261
1367
  @click=${(t) => {
@@ -1265,20 +1371,20 @@ const _ = (x = class extends Z {
1265
1371
  <input type="checkbox" slot="input" tabindex="-1" />
1266
1372
  </nyx-checkbox>
1267
1373
  </div>
1268
- ` : m;
1374
+ ` : b;
1269
1375
  }
1270
1376
  _renderNodeIconCell(e) {
1271
- return this._showNodeIcons() ? h`
1377
+ return this._showNodeIcons() ? f`
1272
1378
  <div class="node-type-icon-wrapper">
1273
- ${this._isLazyEnabled() ? this._renderNodeTypeIcon(e) : h`<slot name="generated-tree-icon-${e.id}"></slot>`}
1379
+ <slot name="generated-tree-icon-${e.id}"></slot>
1274
1380
  </div>
1275
- ` : m;
1381
+ ` : b;
1276
1382
  }
1277
1383
  _renderColumnCheckboxes(e) {
1278
- return this._hasColumnPermissions() ? h`
1384
+ return this._hasColumnPermissions() ? f`
1279
1385
  <div class="node-columns">
1280
1386
  ${this.options.columns.map(
1281
- (t) => h`
1387
+ (t) => f`
1282
1388
  <div class="col-cell">
1283
1389
  <nyx-checkbox
1284
1390
  aria-label=${Ce(
@@ -1311,12 +1417,15 @@ const _ = (x = class extends Z {
1311
1417
  `
1312
1418
  )}
1313
1419
  </div>
1314
- ` : m;
1420
+ ` : b;
1315
1421
  }
1316
1422
  render() {
1317
- var i, s, r;
1318
- const e = this._hasColumnPermissions(), t = e ? ((s = (i = this.options) == null ? void 0 : i.columns) == null ? void 0 : s.length) ?? 0 : 0;
1319
- return h`
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`
1320
1429
  <div
1321
1430
  class=${g({
1322
1431
  "nyx-treeview": !0,
@@ -1324,7 +1433,7 @@ const _ = (x = class extends Z {
1324
1433
  "nyx-treeview--row-selection": this._showRowSelection(),
1325
1434
  "nyx-treeview--virtual": this._isLazyEnabled()
1326
1435
  })}
1327
- style=${`--treeview-column-count: ${t};`}
1436
+ style=${i}
1328
1437
  @mousedown=${() => this._clearAllFocus()}
1329
1438
  >
1330
1439
  <div class="search-container">
@@ -1356,18 +1465,18 @@ const _ = (x = class extends Z {
1356
1465
  "tree-header--no-columns": !e
1357
1466
  })}
1358
1467
  >
1359
- <div class="tree-title">${(r = this.options) == null ? void 0 : r.title}</div>
1360
- ${e ? h`
1468
+ <div class="tree-title">${(n = this.options) == null ? void 0 : n.title}</div>
1469
+ ${e ? f`
1361
1470
  <div class="header-columns">
1362
1471
  ${this.options.columns.map(
1363
- (o, l) => h`
1364
- <div class="col-cell" title="${o.title || ""}">
1365
- <slot name="generated-header-icon-${l}"></slot>
1472
+ (l, a) => f`
1473
+ <div class="col-cell" title="${l.title || ""}">
1474
+ <slot name="generated-header-icon-${a}"></slot>
1366
1475
  </div>
1367
1476
  `
1368
1477
  )}
1369
1478
  </div>
1370
- ` : m}
1479
+ ` : b}
1371
1480
  </div>
1372
1481
 
1373
1482
  <div
@@ -1378,13 +1487,13 @@ const _ = (x = class extends Z {
1378
1487
  role="tree"
1379
1488
  aria-label=${this._getTreeAriaLabel()}
1380
1489
  >
1381
- ${this._isLazyEnabled() ? h`
1490
+ ${this._isLazyEnabled() ? f`
1382
1491
  <lit-virtualizer
1383
1492
  scroller
1384
1493
  class="tree-virtualizer"
1385
1494
  .items=${this._flatRows}
1386
1495
  .estimateSize=${48}
1387
- .renderItem=${(o) => this._renderFlatRow(o)}
1496
+ .renderItem=${(l) => this._renderFlatRow(l)}
1388
1497
  @visibilityChanged=${this._onVirtualizerVisibilityChanged}
1389
1498
  ></lit-virtualizer>
1390
1499
  ` : this._renderNodes(this._items, 0)}
@@ -1394,11 +1503,11 @@ const _ = (x = class extends Z {
1394
1503
  `;
1395
1504
  }
1396
1505
  _renderFlatRow(e) {
1397
- const { node: t, level: i, revealSubtree: s, parentLabelMatched: r } = e, o = this._expandedIds.has(t.id), l = e.hasChildrenInSource, a = this._showRowSelection(), d = this._isRowCheckboxChecked(t) || this._isRowCheckboxIndeterminate(t);
1398
- return h`
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`
1399
1508
  <div class="node-wrapper node-wrapper--flat">
1400
1509
  ${this._renderTreeRow(t, i, {
1401
- isExpanded: o,
1510
+ isExpanded: n,
1402
1511
  hasChildren: l,
1403
1512
  isRowHighlighted: d,
1404
1513
  isSelectable: a
@@ -1407,37 +1516,37 @@ const _ = (x = class extends Z {
1407
1516
  `;
1408
1517
  }
1409
1518
  _renderNodes(e, t, i = !1, s = !1, r = !1) {
1410
- const o = !!this._searchTerm.trim(), l = this._searchTerm.trim().toLowerCase(), a = o && !r ? e.filter((d) => this._searchVisibleIds.has(d.id)) : e;
1519
+ const n = !!this._searchTerm.trim(), l = this._searchTerm.trim().toLowerCase(), a = n && !r ? e.filter((d) => this._searchVisibleIds.has(d.id)) : e;
1411
1520
  return Q(
1412
1521
  a,
1413
1522
  (d) => d.id,
1414
1523
  (d) => {
1415
- const c = this._expandedIds.has(d.id), u = this._isLazyEnabled() ? this._sourceHasChildren(d.id) : !!(d.children && d.children.length > 0), f = this._isRowCheckboxChecked(d) || this._isRowCheckboxIndeterminate(d), w = this._showRowSelection(), b = O(
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(
1416
1525
  d.label,
1417
1526
  l,
1418
1527
  i,
1419
1528
  s
1420
- ), N = !o || b && E(
1529
+ ), $ = !n || v && L(
1421
1530
  d.label,
1422
1531
  l,
1423
1532
  s,
1424
1533
  d.id,
1425
1534
  this._searchVisibleIds,
1426
- (R) => this._getSourceChildren(R)
1427
- ) ? d.children : B(d, this._searchVisibleIds, l), I = s || o && !!l && d.label.toLowerCase().includes(l);
1428
- return h`
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`
1429
1538
  <div class="node-wrapper">
1430
1539
  ${this._renderTreeRow(d, t, {
1431
1540
  isExpanded: c,
1432
1541
  hasChildren: u,
1433
- isRowHighlighted: f,
1434
- isSelectable: w
1542
+ isRowHighlighted: h,
1543
+ isSelectable: _
1435
1544
  })}
1436
- ${c && u ? h`<div class="node-children" role="group">
1545
+ ${c && u ? f`<div class="node-children" role="group">
1437
1546
  ${this._renderNodes(
1438
- N,
1547
+ $,
1439
1548
  t + 1,
1440
- b,
1549
+ v,
1441
1550
  I,
1442
1551
  !0
1443
1552
  )}
@@ -1448,44 +1557,47 @@ const _ = (x = class extends Z {
1448
1557
  );
1449
1558
  }
1450
1559
  }, x._nextTreeviewId = 0, x.styles = Y(se), x);
1451
- p([
1560
+ w([
1452
1561
  J({ type: Object, noAccessor: !0 })
1453
- ], _.prototype, "options", 1);
1454
- p([
1455
- v()
1456
- ], _.prototype, "_items", 2);
1457
- p([
1458
- v()
1459
- ], _.prototype, "_expandedIds", 2);
1460
- p([
1461
- v()
1462
- ], _.prototype, "_searchTerm", 2);
1463
- p([
1464
- v()
1465
- ], _.prototype, "_searchStatusMessage", 2);
1466
- p([
1467
- v()
1468
- ], _.prototype, "_searchVisibleIds", 2);
1469
- p([
1470
- v()
1471
- ], _.prototype, "_searchUserCollapsedIds", 2);
1472
- p([
1473
- v()
1474
- ], _.prototype, "_searchManualExpandedIds", 2);
1475
- p([
1476
- v()
1477
- ], _.prototype, "_flatRows", 2);
1478
- p([
1479
- v()
1480
- ], _.prototype, "_loadedIds", 2);
1481
- p([
1482
- v()
1483
- ], _.prototype, "_activeRowId", 2);
1484
- p([
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([
1485
1597
  ie("nyx-change")
1486
- ], _.prototype, "onChange", 2);
1487
- let ke = _;
1488
- customElements.get("nyx-treeview") || customElements.define("nyx-treeview", ke);
1598
+ ], p.prototype, "onChange", 2);
1599
+ let Le = p;
1600
+ customElements.get("nyx-treeview") || customElements.define("nyx-treeview", Le);
1489
1601
  export {
1490
- ke as NyxTreeview
1602
+ Le as NyxTreeview
1491
1603
  };