@nyx-ds/treeview 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(p,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("lit"),require("lit/decorators.js"),require("lit/directives/repeat.js"),require("lit/directives/class-map.js"),require("@nyx-ds/core"),require("@lit-labs/virtualizer"),require("@nyx-ds/input"),require("@nyx-ds/checkbox"),require("@nyx-ds/radio"),require("@nyx-ds/icon"),require("@nyx-ds/button")):typeof define=="function"&&define.amd?define(["exports","lit","lit/decorators.js","lit/directives/repeat.js","lit/directives/class-map.js","@nyx-ds/core","@lit-labs/virtualizer","@nyx-ds/input","@nyx-ds/checkbox","@nyx-ds/radio","@nyx-ds/icon","@nyx-ds/button"],c):(p=typeof globalThis<"u"?globalThis:p||self,c(p.treeview={},p.lit,p.litDecorators,p.litRepeat,p.litClassMap,p.NyxCore))})(this,(function(p,c,_,J,b,M){"use strict";var v;function Q(n,e){return function(t,i){const{native:s=!1,...r}=i||{},o=s?new Event(e,r):new CustomEvent(e,{detail:t,...r});n.dispatchEvent(o)}}function X(n){return(e,t)=>{Object.defineProperty(e,t,{get(){return Q(this,n)},enumerable:!0,configurable:!0})}}const ee=":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}}",te=200;function y(n,e){const t=e.trim().toLowerCase();return t?n.toLowerCase().includes(t):!1}function C(n,e){return n.includes(e)}function R(n){var s;const e=new Map,t=[],i=[];for(let r=n.length-1;r>=0;r--)i.push({node:n[r],parentId:null});for(;i.length>0;){const{node:r,parentId:o}=i.pop(),a=((s=r.children)==null?void 0:s.map(l=>l.id))??[];if(e.set(r.id,{id:r.id,parentId:o,normalizedLabel:r.label.toLowerCase(),childIds:a,hasChildren:a.length>0}),o===null&&t.push(r.id),r.children)for(let l=r.children.length-1;l>=0;l--)i.push({node:r.children[l],parentId:r.id})}return{roots:t,byId:e,size:e.size}}function ie(n){const e=[],t=[];for(let i=n.roots.length-1;i>=0;i--)t.push({id:n.roots[i],visited:!1});for(;t.length>0;){const i=t[t.length-1];if(i.visited)t.pop(),e.push(i.id);else{i.visited=!0;const s=n.byId.get(i.id);if(!s)continue;for(let r=s.childIds.length-1;r>=0;r--)t.push({id:s.childIds[r],visited:!1})}}return e}function se(n,e,t){const i=new Set,s=new Set,r=new Map;for(const o of ie(n)){const a=n.byId.get(o);if(!a)continue;const l=C(a.normalizedLabel,e);let d=!1;for(const w of a.childIds)if(r.get(w)){d=!0;break}const h=l||d;if(r.set(o,h),!h||(i.add(o),!a.hasChildren||!d))continue;let m=!1;for(const w of a.childIds){const x=n.byId.get(w);if(x&&C(x.normalizedLabel,e)){m=!0;break}}!t.has(o)&&(!l||m)&&s.add(o)}return{visibleIds:i,expandIds:s}}function re(n,e){const t=e.trim().toLowerCase();if(!t)return 0;const i=Array.isArray(n)?R(n):n;let s=0;for(const r of i.byId.values())C(r.normalizedLabel,t)&&s++;return s}function ne(n,e,t=new Set){const i=e.trim().toLowerCase();if(!i)return{visibleIds:new Set,expandIds:new Set};const s=Array.isArray(n)?R(n):n;return se(s,i,t)}function N(n,e,t=""){const i=n.children??[],s=t.trim().toLowerCase();return s?i.filter(r=>e.has(r.id)||y(r.label,s)):i.filter(r=>e.has(r.id))}function oe(n,e,t){const i=e.trim().toLowerCase();if(!i)return!1;const s=[n];for(;s.length>0;){const r=s.pop();for(const o of t(r)??[]){if(y(o.label,i))return!0;s.push(o.id)}}return!1}function ae(n,e,t){const i=[n];for(;i.length>0;){const s=i.pop();for(const r of t(s)??[]){if(e.has(r.id))return!0;i.push(r.id)}}return!1}function z(n,e,t,i,s,r){return D(n,e,t)&&!ae(i,s,r)&&!oe(i,e,r)}function D(n,e,t){return y(n,e)&&!t}function P(n,e,t,i){return t||D(n,e,i)}function E(n,e){var t,i;if(e){if(n.selected)return!0}else if((((t=n.selectedColumns)==null?void 0:t.length)??0)>0)return!0;return((i=n.children)==null?void 0:i.some(s=>E(s,e)))??!1}function V(n,e){const t=n.map((i,s)=>({node:i,index:s}));return t.sort((i,s)=>{const r=E(i.node,e),o=E(s.node,e);return r!==o?r?-1:1:i.index-s.index}),t.map(({node:i})=>{var s;return(s=i.children)!=null&&s.length?{...i,children:V(i.children,e)}:i})}const g=50;function le(n){const e=[],t=n.map(s=>({node:s,depth:0,parentId:null}));let i=0;for(;i<t.length;){const s=t[i++],{node:r,depth:o,parentId:a}=s,l=!!(r.children&&r.children.length>0);if(e.push({id:r.id,depth:o,parentId:a,hasChildrenInSource:l}),l)for(const d of r.children)t.push({node:d,depth:o+1,parentId:r.id})}return e}function de(n,e=g){const t=new Set;for(const i of n)if(i.depth===0&&(t.add(i.id),t.size>=e))break;return t}function ce(n,e,t){const i=[];for(const s of n)if(s.depth===0&&!e.has(s.id)&&(i.push(s.id),i.length>=t))break;return i}function he(n,e){return n.some(t=>t.depth===0&&!e.has(t.id))}function ue(n,e,t){return k(e,n).some(i=>!t.has(i))}function q(n,e,t){return e.some(i=>i.parentId===n&&!t.has(i.id))}function U(n,e){if(!n)return;let t=n.node.id,i=e.get(t);for(;(i==null?void 0:i.parentId)!=null;)t=i.parentId,i=e.get(t);return t}function fe(n,e,t,i,s,r){const o=Math.min(Math.max(0,e),Math.max(0,n.length-1));for(let a=o;a>=0;a--){const l=n[a];if(t.has(l.node.id)&&q(l.node.id,i,s))return U(l,r)}return U(n[o],r)}function pe(n,e){const t=[];let i=e.get(n);for(;(i==null?void 0:i.parentId)!=null;)t.push(i.parentId),i=e.get(i.parentId);return t}function F(n,e,t){if(t<0)return[];const i=L(n),s=[];for(const r of e){const o=[{id:r,level:0}];for(;o.length>0;){const a=o.pop();if(a.level>t)continue;s.push(a.id);const l=i.get(a.id);if(!(!(l!=null&&l.length)||a.level>=t))for(let d=l.length-1;d>=0;d--)o.push({id:l[d],level:a.level+1})}}return s}function _e(n,e,t){if(t<=0)return[];const i=L(n),s=[];for(const r of e){const o=[{id:r,level:0}];for(;o.length>0;){const a=o.pop();if(a.level>=t)continue;const l=i.get(a.id);if(l!=null&&l.length){s.push(a.id);for(let d=l.length-1;d>=0;d--)o.push({id:l[d],level:a.level+1})}}}return s}function B(n,e,t,i){const s=[],r=o=>{s.length>=t||!e.has(o)&&!s.includes(o)&&s.push(o)};if(i!=null){const o=k(n,i);for(const a of o)r(a)}for(const o of n)if(r(o.id),s.length>=t)break;return s}function k(n,e){const t=L(n),i=[],s=[e];for(;s.length>0;){const r=s.pop();i.push(r);const o=t.get(r);if(o!=null&&o.length)for(let a=o.length-1;a>=0;a--)s.push(o[a])}return i}function L(n){const e=new Map;for(const t of n){const i=t.parentId;e.has(i)||e.set(i,[]),e.get(i).push(t.id)}return e}function we(n,e,t){return k(n,e).filter(i=>!t.has(i))}function ve(n,e,t,i=g){return we(n,e,t).slice(0,i)}function T(n){var e;return{...n,selectedColumns:n.selectedColumns?[...n.selectedColumns]:void 0,disabledColumns:n.disabledColumns?[...n.disabledColumns]:void 0,children:(e=n.children)==null?void 0:e.map(t=>T(t)),data:n.data}}function me(n){const e=new Map,t=i=>{var s;e.set(i.id,i),(s=i.children)==null||s.forEach(t)};return n.forEach(t),e}function xe(n,e,t){const i=s=>{if(!e.has(s.id))return null;const r=t.get(s.id)??s,o=(r.children??[]).map(l=>i(l)).filter(l=>l!==null),a=T(r);return a.children=o.length>0?o:void 0,a};return n.map(s=>i(s)).filter(s=>s!==null)}function H(n){const e=[],t=n.searchTerm.trim().toLowerCase(),i=(s,r,o,a,l=!1)=>{const d=n.hasSearch&&!l?s.filter(h=>n.searchVisibleIds.has(h.id)):s;for(const h of d){const m=n.hasSearch&&!!t&&h.label.toLowerCase().includes(t),w=P(h.label,t,o,a),x=a||!!m;if(e.push({node:h,level:r,revealSubtree:w,parentLabelMatched:x,hasChildrenInSource:n.sourceHasChildren(h.id)}),!n.expandedIds.has(h.id))continue;const K=n.getSourceChildren??(A=>{var Y;return(Y=n.items.find(Ce=>Ce.id===A))==null?void 0:Y.children}),S=!n.hasSearch||w&&z(h.label,t,a,h.id,n.searchVisibleIds,K)?h.children??[]:N(h,n.searchVisibleIds,n.searchTerm);S.length>0&&i(S,r+1,w,x,!0)}};return i(n.items,0,!1,!1),e}function I(n,e){for(const t of n)if(!e.has(t))return!0;return!1}function O(n,e,t,i=g){const s=[],r=o=>{s.length>=i||!e.has(o)&&!s.includes(o)&&s.push(o)};for(const o of n)if(!e.has(o)){r(o);for(const a of pe(o,t))r(a);if(s.length>=i)break}return s}function W(n,e,t,i=g){const s=O(n,e,t,i);return s.length===0?!1:(s.forEach(r=>e.add(r)),!0)}function be(n,e){return e?`Collapse ${n}`:`Expand ${n}`}function j(n){return`Select ${n}`}function ge(n,e){return`${n}, ${e}`}function ye(n){return n===0?"No results found":n===1?"1 result found":`${n} results found`}var Ie=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,f=(n,e,t,i)=>{for(var s=i>1?void 0:i?Se(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&Ie(e,t,s),s};const u=(v=class extends c.LitElement{constructor(){super(...arguments),this._rowSelectionRadioName=`nyx-treeview-row-selection-${v._nextTreeviewId++}`,this._items=[],this._expandedIds=new Set,this._searchTerm="",this._searchStatusMessage="",this._searchVisibleIds=new Set,this._searchUserCollapsedIds=new Set,this._searchManualExpandedIds=new Set,this._expandedIdsBeforeSearch=null,this._flatRows=[],this._loadedIds=new Set,this._activeRowId=null,this._sourceItems=[],this._lazyItemsSourceRef=null,this._treeIndex=[],this._indexById=new Map,this._sourceById=new Map,this._lazyScrollLoading=!1,this._searchIndex=null,this._searchIndexSourceRef=null,this._searchDebounceTimer=null}get options(){return this._options}set options(e){const t=this._options;t!==e&&(this._options=e,e&&(this._applyOptionsChange(),this._generateLightDomIcons()),this.requestUpdate("options",t))}_isLazyEnabled(){var e;return!!((e=this.options)!=null&&e.lazyLoad)}_getLazyPageSize(){var t;const e=(t=this.options)==null?void 0:t.lazyLoadPageSize;return e==null||!Number.isFinite(e)?g:Math.max(1,Math.floor(e))}_hasColumnPermissions(){var e,t,i;return((e=this.options)==null?void 0:e.showColumnPermissions)===!1?!1:(((i=(t=this.options)==null?void 0:t.columns)==null?void 0:i.length)??0)>0}_showRowSelection(){var e;return!!((e=this.options)!=null&&e.showRowSelection)}_usesUniqueRowSelection(){var e;return this._showRowSelection()&&!!((e=this.options)!=null&&e.uniqueSelection)}_showNodeIcons(){var e;return((e=this.options)==null?void 0:e.showNodeIcons)!==!1}_usesSimpleRowSelection(){return this._showRowSelection()&&!this._usesUniqueRowSelection()&&!this._hasColumnPermissions()}_applyItemsFromOptions(e){var i;let t=e.map(s=>T(s));return this._usesUniqueRowSelection()&&this._applyUniqueSelectionConstraint(t),(i=this.options)!=null&&i.sortSelectedFirst&&(t=V(t,this._usesSimpleRowSelection())),t}_applyUniqueSelectionConstraint(e){let t=!1;const i=s=>{s.forEach(r=>{r.selected&&(t?r.selected=!1:t=!0),r.children&&i(r.children)})};i(e)}_applyOptionsChange(){if(this.options){if(this._isLazyEnabled()){this.options.items!==this._lazyItemsSourceRef&&(this._initLazyState(),this._resetSearchDerivedState(),this._searchTerm.trim()&&this._recomputeSearchFilter());return}if(this._items=this._applyItemsFromOptions(this.options.items),this._invalidateSearchIndex(),this._activeRowId=null,this._resetSearchDerivedState(),this._searchTerm.trim()){this._recomputeSearchFilter();return}this.options.defaultExpandedLevel!==void 0&&this._expandedIds.size===0&&this._expandToLevel(this._items,0,this.options.defaultExpandedLevel),this._syncActiveRowWithVisibleRows()}}_initLazyState(){var s;this._lazyItemsSourceRef=this.options.items,this._sourceItems=this._applyItemsFromOptions(this.options.items),this._invalidateSearchIndex(),this._treeIndex=le(this._sourceItems),this._indexById=new Map(this._treeIndex.map(r=>[r.id,r])),this._sourceById=me(this._sourceItems);const e=(s=this.options)==null?void 0:s.defaultExpandedLevel,t=this._getLazyPageSize(),i=de(this._treeIndex,t);this._loadedIds=new Set(i),e!==void 0&&e>0&&this._loadDefaultExpandedLevelForRoots(i,e),this._expandedIds=new Set,e!==void 0&&e>0&&this._applyLazyDefaultExpansion(i,e),this._activeRowId=null,this._rebuildMaterializedItems(),this._commitLazyRows()}_loadDefaultExpandedLevelForRoots(e,t){F(this._treeIndex,e,t).forEach(i=>this._loadedIds.add(i))}_applyLazyDefaultExpansion(e,t){_e(this._treeIndex,e,t).forEach(i=>this._expandedIds.add(i)),this._expandedIds=new Set(this._expandedIds)}_rebuildMaterializedItems(){this._items=xe(this._sourceItems,this._loadedIds,this._sourceById)}_selectionRoots(){return this._isLazyEnabled()?this._sourceItems:this._items}_selectionNode(e){return this._isLazyEnabled()?this._sourceById.get(e.id)??e:e}_invalidateSearchIndex(){this._searchIndex=null,this._searchIndexSourceRef=null}_resetSearchDerivedState(){this._searchVisibleIds=new Set,this._searchUserCollapsedIds=new Set,this._searchManualExpandedIds=new Set,this._searchStatusMessage=""}_ensureSearchIndex(){const e=this._selectionRoots();return this._searchIndex&&this._searchIndexSourceRef===e?this._searchIndex:(this._searchIndexSourceRef=e,this._searchIndex=R(e),this._searchIndex)}disconnectedCallback(){super.disconnectedCallback(),this._searchDebounceTimer!==null&&(clearTimeout(this._searchDebounceTimer),this._searchDebounceTimer=null)}_findNodeById(e,t){for(const i of e){if(i.id===t)return i;if(i.children){const s=this._findNodeById(i.children,t);if(s)return s}}}_forEachInSubtree(e,t,i){const s=this._findNodeById(e,t);if(!s)return;const r=o=>{var a;i(o),(a=o.children)==null||a.forEach(r)};r(s)}_getSourceChildren(e){const t=this._isLazyEnabled()?this._sourceById.get(e):this._findNodeById(this._items,e);return t==null?void 0:t.children}_loadMoreNodes(e){var o,a;if(!this._isLazyEnabled())return;const t=this._getLazyPageSize();let i,s=[];if(this._isSearchActive())if(I(this._searchVisibleIds,this._loadedIds))i=O(this._searchVisibleIds,this._loadedIds,this._indexById,t);else if(e!=null&&this._hasExclusiveSearchFolderWithUnloadedChildren())i=B(this._treeIndex,this._loadedIds,t,e);else return;else if(e!=null)i=B(this._treeIndex,this._loadedIds,t,e);else{s=ce(this._treeIndex,this._loadedIds,t),i=[...s];const l=(o=this.options)==null?void 0:o.defaultExpandedLevel;l!==void 0&&l>0&&i.push(...F(this._treeIndex,s,l))}if(i.length===0)return;i.forEach(l=>this._loadedIds.add(l));const r=(a=this.options)==null?void 0:a.defaultExpandedLevel;s.length>0&&r!==void 0&&r>0&&this._applyLazyDefaultExpansion(s,r),this._loadedIds=new Set(this._loadedIds),this._rebuildMaterializedItems(),this._commitLazyRows()}_loadSubtreeForExpand(e){const t=ve(this._treeIndex,e,this._loadedIds,this._getLazyPageSize());t.length!==0&&(t.forEach(i=>this._loadedIds.add(i)),this._loadedIds=new Set(this._loadedIds),this._rebuildMaterializedItems())}_sourceHasChildren(e){var t,i;return!!((i=(t=this._sourceById.get(e))==null?void 0:t.children)!=null&&i.length)}_commitLazyRows(){this._isLazyEnabled()&&this._syncFlatRows()}_syncFlatRows(){this._flatRows=H({items:this._items,expandedIds:this._expandedIds,hasSearch:!!this._searchTerm.trim(),searchTerm:this._searchTerm,searchVisibleIds:this._searchVisibleIds,sourceHasChildren:e=>this._sourceHasChildren(e),getSourceChildren:e=>this._getSourceChildren(e)}),this._syncActiveRowWithVisibleRows()}_setActiveRow(e){this._activeRowId!==e&&(this._activeRowId=e)}_syncActiveRowWithVisibleRows(){const e=this._getVisibleTreeRows();if(e.length===0){this._activeRowId!==null&&(this._activeRowId=null);return}const t=e.some(i=>i.node.id===this._activeRowId);(this._activeRowId===null||!t)&&(this._activeRowId=e[0].node.id)}_getRowTabIndex(e){const t=this._getVisibleTreeRows();if(t.length===0)return-1;const i=this._activeRowId??t[0].node.id;return e===i?0:-1}_rowDomId(e){return`row-${String(e)}`}_rowSelector(e){return`#${CSS.escape(this._rowDomId(e))}`}_isSearchActive(){return!!this._searchTerm.trim()}_getSearchScrollTargetIndex(){const e=this._searchTerm.trim().toLowerCase();if(!e||this._flatRows.length===0)return 0;const t=this._flatRows.map((r,o)=>({row:r,index:o})).filter(({row:r})=>y(r.node.label,e));if(t.length===0)return 0;const i=t.reduce((r,o)=>o.row.level>=r.row.level?o:r),[s]=t;if(t.length>1&&s.row.hasChildrenInSource&&this._expandedIds.has(s.row.node.id)){const r=t.find(({row:o})=>o.level===s.row.level+1&&o.node.label.toLowerCase()===s.row.node.label.toLowerCase());if(r)return r.index}return i.index}_loadUntilSearchTargetVisible(){let e=0;for(;e++<100&&!(this._getSearchScrollTargetIndex()<this._flatRows.length||!I(this._searchVisibleIds,this._loadedIds)&&!this._hasExpandedUnloadedSubtree());){if(I(this._searchVisibleIds,this._loadedIds)){if(!W(this._searchVisibleIds,this._loadedIds,this._indexById,this._getLazyPageSize()))break}else break;this._loadedIds=new Set(this._loadedIds),this._rebuildMaterializedItems(),this._commitLazyRows()}}_scrollToSearchTarget(){!this._isLazyEnabled()||!this._isSearchActive()||this.updateComplete.then(()=>{var i;const e=(i=this.shadowRoot)==null?void 0:i.querySelector("lit-virtualizer"),t=this._getSearchScrollTargetIndex();!(e!=null&&e.scrollToIndex)||t<0||e.scrollToIndex(t,"start")})}_hasExpandedUnloadedSubtree(){for(const e of this._expandedIds)if(q(e,this._treeIndex,this._loadedIds))return!0;return!1}_hasExclusiveSearchFolderWithUnloadedChildren(){if(!this._isSearchActive())return!1;const e=this._searchTerm.trim();if(!e)return!1;for(const t of this._expandedIds){const i=this._sourceById.get(t);if(i&&ue(t,this._treeIndex,this._loadedIds)&&z(i.label,e,!1,t,this._searchVisibleIds,s=>this._getSourceChildren(s)))return!0}return!1}_shouldLoadMoreOnScroll(){return this._isLazyEnabled()?this._isSearchActive()?I(this._searchVisibleIds,this._loadedIds)||this._hasExclusiveSearchFolderWithUnloadedChildren():this._hasExpandedUnloadedSubtree()?this._treeIndex.some(e=>!this._loadedIds.has(e.id)):he(this._treeIndex,this._loadedIds):!1}_getLazyLoadPriorityRootId(e){if(!(!this._isSearchActive()&&!this._hasExpandedUnloadedSubtree()))return fe(this._flatRows,e,this._expandedIds,this._treeIndex,this._loadedIds,this._indexById)}_getScrollPrefetchMargin(){return Math.min(20,Math.max(5,Math.floor(this._getLazyPageSize()/4)))}_onVirtualizerVisibilityChanged(e){const i=e.last;if(i==null||!this._shouldLoadMoreOnScroll()||this._lazyScrollLoading)return;const s=Math.max(0,this._flatRows.length-this._getScrollPrefetchMargin());i<s||(this._lazyScrollLoading=!0,this._loadMoreNodes(this._getLazyLoadPriorityRootId(i)),this.updateComplete.then(()=>{this._lazyScrollLoading=!1}))}_getTreeAriaLabel(){var e,t;return((t=(e=this.options)==null?void 0:e.title)==null?void 0:t.trim())||"Treeview"}_renderTreeRow(e,t,i){const{isExpanded:s,hasChildren:r,isRowHighlighted:o,isSelectable:a}=i;return c.html`
1
+ (function(w,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("lit"),require("lit/decorators.js"),require("lit/directives/repeat.js"),require("lit/directives/class-map.js"),require("@nyx-ds/core"),require("@lit-labs/virtualizer"),require("@nyx-ds/input"),require("@nyx-ds/checkbox"),require("@nyx-ds/radio"),require("@nyx-ds/icon"),require("@nyx-ds/button")):typeof define=="function"&&define.amd?define(["exports","lit","lit/decorators.js","lit/directives/repeat.js","lit/directives/class-map.js","@nyx-ds/core","@lit-labs/virtualizer","@nyx-ds/input","@nyx-ds/checkbox","@nyx-ds/radio","@nyx-ds/icon","@nyx-ds/button"],c):(w=typeof globalThis<"u"?globalThis:w||self,c(w.treeview={},w.lit,w.litDecorators,w.litRepeat,w.litClassMap,w.NyxCore))})(this,(function(w,c,v,Y,b,A){"use strict";var x;function J(n,e){return function(t,i){const{native:s=!1,...r}=i||{},o=s?new Event(e,r):new CustomEvent(e,{detail:t,...r});n.dispatchEvent(o)}}function Q(n){return(e,t)=>{Object.defineProperty(e,t,{get(){return J(this,n)},enumerable:!0,configurable:!0})}}const X=":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}}",ee=200;function I(n,e){const t=e.trim().toLowerCase();return t?n.toLowerCase().includes(t):!1}function R(n,e){return n.includes(e)}function z(n){var s;const e=new Map,t=[],i=[];for(let r=n.length-1;r>=0;r--)i.push({node:n[r],parentId:null});for(;i.length>0;){const{node:r,parentId:o}=i.pop(),a=((s=r.children)==null?void 0:s.map(l=>l.id))??[];if(e.set(r.id,{id:r.id,parentId:o,normalizedLabel:r.label.toLowerCase(),childIds:a,hasChildren:a.length>0}),o===null&&t.push(r.id),r.children)for(let l=r.children.length-1;l>=0;l--)i.push({node:r.children[l],parentId:r.id})}return{roots:t,byId:e,size:e.size}}function te(n){const e=[],t=[];for(let i=n.roots.length-1;i>=0;i--)t.push({id:n.roots[i],visited:!1});for(;t.length>0;){const i=t[t.length-1];if(i.visited)t.pop(),e.push(i.id);else{i.visited=!0;const s=n.byId.get(i.id);if(!s)continue;for(let r=s.childIds.length-1;r>=0;r--)t.push({id:s.childIds[r],visited:!1})}}return e}function ie(n,e,t){const i=new Set,s=new Set,r=new Map;for(const o of te(n)){const a=n.byId.get(o);if(!a)continue;const l=R(a.normalizedLabel,e);let d=!1;for(const p of a.childIds)if(r.get(p)){d=!0;break}const h=l||d;if(r.set(o,h),!h||(i.add(o),!a.hasChildren||!d))continue;let f=!1;for(const p of a.childIds){const m=n.byId.get(p);if(m&&R(m.normalizedLabel,e)){f=!0;break}}!t.has(o)&&(!l||f)&&s.add(o)}return{visibleIds:i,expandIds:s}}function se(n,e){const t=e.trim().toLowerCase();if(!t)return 0;const i=Array.isArray(n)?z(n):n;let s=0;for(const r of i.byId.values())R(r.normalizedLabel,t)&&s++;return s}function re(n,e,t=new Set){const i=e.trim().toLowerCase();if(!i)return{visibleIds:new Set,expandIds:new Set};const s=Array.isArray(n)?z(n):n;return ie(s,i,t)}function N(n,e,t=""){const i=n.children??[],s=t.trim().toLowerCase();return s?i.filter(r=>e.has(r.id)||I(r.label,s)):i.filter(r=>e.has(r.id))}function ne(n,e,t){const i=e.trim().toLowerCase();if(!i)return!1;const s=[n];for(;s.length>0;){const r=s.pop();for(const o of t(r)??[]){if(I(o.label,i))return!0;s.push(o.id)}}return!1}function oe(n,e,t){const i=[n];for(;i.length>0;){const s=i.pop();for(const r of t(s)??[]){if(e.has(r.id))return!0;i.push(r.id)}}return!1}function E(n,e,t,i,s,r){return D(n,e,t)&&!oe(i,s,r)&&!ne(i,e,r)}function D(n,e,t){return I(n,e)&&!t}function P(n,e,t,i){return t||D(n,e,i)}function k(n,e){var t,i;if(e){if(n.selected)return!0}else if((((t=n.selectedColumns)==null?void 0:t.length)??0)>0)return!0;return((i=n.children)==null?void 0:i.some(s=>k(s,e)))??!1}function V(n,e){const t=n.map((i,s)=>({node:i,index:s}));return t.sort((i,s)=>{const r=k(i.node,e),o=k(s.node,e);return r!==o?r?-1:1:i.index-s.index}),t.map(({node:i})=>{var s;return(s=i.children)!=null&&s.length?{...i,children:V(i.children,e)}:i})}const g=50;function ae(n){const e=[],t=n.map(s=>({node:s,depth:0,parentId:null}));let i=0;for(;i<t.length;){const s=t[i++],{node:r,depth:o,parentId:a}=s,l=!!(r.children&&r.children.length>0);if(e.push({id:r.id,depth:o,parentId:a,hasChildrenInSource:l}),l)for(const d of r.children)t.push({node:d,depth:o+1,parentId:r.id})}return e}function le(n,e=g){const t=new Set;for(const i of n)if(i.depth===0&&(t.add(i.id),t.size>=e))break;return t}function de(n,e,t){const i=[];for(const s of n)if(s.depth===0&&!e.has(s.id)&&(i.push(s.id),i.length>=t))break;return i}function he(n,e){return n.some(t=>t.depth===0&&!e.has(t.id))}function ce(n,e,t){return L(e,n).some(i=>!t.has(i))}function q(n,e,t){return e.some(i=>i.parentId===n&&!t.has(i.id))}function ue(n,e){const t=n[e];if(!t)return e;let i=e;for(let s=e+1;s<n.length&&!(n[s].level<=t.level);s++)i=s;return i}function fe(n,e,t,i,s,r,o=0){if(n.length===0)return;const a=Math.min(Math.max(0,e),Math.max(0,n.length-1)),l=Math.min(Math.max(a,t),Math.max(0,n.length-1)),d=Math.max(0,Math.floor(o));let h;for(let f=0;f<n.length;f++){const p=n[f];if(!i.has(p.node.id)||!q(p.node.id,s,r))continue;const m=ue(n,f),y=Math.max(f,m-d);a<=m&&l>=y&&(h=p.node.id)}return h}function pe(n,e){const t=[];let i=e.get(n);for(;(i==null?void 0:i.parentId)!=null;)t.push(i.parentId),i=e.get(i.parentId);return t}function U(n,e,t){if(t<0)return[];const i=T(n),s=[];for(const r of e){const o=[{id:r,level:0}];for(;o.length>0;){const a=o.pop();if(a.level>t)continue;s.push(a.id);const l=i.get(a.id);if(!(!(l!=null&&l.length)||a.level>=t))for(let d=l.length-1;d>=0;d--)o.push({id:l[d],level:a.level+1})}}return s}function _e(n,e,t){if(t<=0)return[];const i=T(n),s=[];for(const r of e){const o=[{id:r,level:0}];for(;o.length>0;){const a=o.pop();if(a.level>=t)continue;const l=i.get(a.id);if(l!=null&&l.length){s.push(a.id);for(let d=l.length-1;d>=0;d--)o.push({id:l[d],level:a.level+1})}}}return s}function F(n,e,t,i){const s=[],r=o=>{s.length>=t||!e.has(o)&&!s.includes(o)&&s.push(o)};if(i!=null){const o=L(n,i);for(const a of o)r(a)}for(const o of n)if(r(o.id),s.length>=t)break;return s}function L(n,e){const t=T(n),i=[],s=[e];for(;s.length>0;){const r=s.pop();i.push(r);const o=t.get(r);if(o!=null&&o.length)for(let a=o.length-1;a>=0;a--)s.push(o[a])}return i}function T(n){const e=new Map;for(const t of n){const i=t.parentId;e.has(i)||e.set(i,[]),e.get(i).push(t.id)}return e}function we(n,e,t){return L(n,e).filter(i=>!t.has(i))}function ve(n,e,t,i=g){return we(n,e,t).slice(0,i)}function $(n){var e;return{...n,selectedColumns:n.selectedColumns?[...n.selectedColumns]:void 0,disabledColumns:n.disabledColumns?[...n.disabledColumns]:void 0,children:(e=n.children)==null?void 0:e.map(t=>$(t)),data:n.data}}function me(n){const e=new Map,t=i=>{var s;e.set(i.id,i),(s=i.children)==null||s.forEach(t)};return n.forEach(t),e}function xe(n,e,t){const i=s=>{if(!e.has(s.id))return null;const r=t.get(s.id)??s,o=(r.children??[]).map(l=>i(l)).filter(l=>l!==null),a=$(r);return a.children=o.length>0?o:void 0,a};return n.map(s=>i(s)).filter(s=>s!==null)}function B(n){const e=[],t=n.searchTerm.trim().toLowerCase(),i=(s,r,o,a,l=!1)=>{const d=n.hasSearch&&!l?s.filter(h=>n.searchVisibleIds.has(h.id)):s;for(const h of d){const f=n.hasSearch&&!!t&&h.label.toLowerCase().includes(t),p=P(h.label,t,o,a),m=a||!!f;if(e.push({node:h,level:r,revealSubtree:p,parentLabelMatched:m,hasChildrenInSource:n.sourceHasChildren(h.id)}),!n.expandedIds.has(h.id))continue;const G=n.getSourceChildren??(M=>{var Z;return(Z=n.items.find(Ce=>Ce.id===M))==null?void 0:Z.children}),C=!n.hasSearch||p&&E(h.label,t,a,h.id,n.searchVisibleIds,G)?h.children??[]:N(h,n.searchVisibleIds,n.searchTerm);C.length>0&&i(C,r+1,p,m,!0)}};return i(n.items,0,!1,!1),e}function S(n,e){for(const t of n)if(!e.has(t))return!0;return!1}function H(n,e,t,i=g){const s=[],r=o=>{s.length>=i||!e.has(o)&&!s.includes(o)&&s.push(o)};for(const o of n)if(!e.has(o)){r(o);for(const a of pe(o,t))r(a);if(s.length>=i)break}return s}function O(n,e,t,i=g){const s=H(n,e,t,i);return s.length===0?!1:(s.forEach(r=>e.add(r)),!0)}function be(n,e){return e?`Collapse ${n}`:`Expand ${n}`}function W(n){return`Select ${n}`}function ge(n,e){return`${n}, ${e}`}function ye(n){return n===0?"No results found":n===1?"1 result found":`${n} results found`}var Ie=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,_=(n,e,t,i)=>{for(var s=i>1?void 0:i?Se(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&Ie(e,t,s),s};const u=(x=class extends c.LitElement{constructor(){super(...arguments),this._rowSelectionRadioName=`nyx-treeview-row-selection-${x._nextTreeviewId++}`,this._items=[],this._expandedIds=new Set,this._searchTerm="",this._searchStatusMessage="",this._searchVisibleIds=new Set,this._searchUserCollapsedIds=new Set,this._searchManualExpandedIds=new Set,this._expandedIdsBeforeSearch=null,this._flatRows=[],this._loadedIds=new Set,this._activeRowId=null,this._sourceItems=[],this._lazyItemsSourceRef=null,this._treeIndex=[],this._indexById=new Map,this._sourceById=new Map,this._lazyScrollLoading=!1,this._searchIndex=null,this._searchIndexSourceRef=null,this._searchDebounceTimer=null}get options(){return this._options}set options(e){const t=this._options;t!==e&&(this._options=e,e&&(this._applyOptionsChange(),this._generateLightDomIcons()),this.requestUpdate("options",t))}_isLazyEnabled(){var e;return!!((e=this.options)!=null&&e.lazyLoad)}_getLazyPageSize(){var t;const e=(t=this.options)==null?void 0:t.lazyLoadPageSize;return e==null||!Number.isFinite(e)?g:Math.max(1,Math.floor(e))}_hasColumnPermissions(){var e,t,i;return((e=this.options)==null?void 0:e.showColumnPermissions)===!1?!1:(((i=(t=this.options)==null?void 0:t.columns)==null?void 0:i.length)??0)>0}_showRowSelection(){var e;return!!((e=this.options)!=null&&e.showRowSelection)}_usesUniqueRowSelection(){var e;return this._showRowSelection()&&!!((e=this.options)!=null&&e.uniqueSelection)}_showNodeIcons(){var e;return((e=this.options)==null?void 0:e.showNodeIcons)!==!1}_usesSimpleRowSelection(){return this._showRowSelection()&&!this._usesUniqueRowSelection()&&!this._hasColumnPermissions()}_applyItemsFromOptions(e){var i;let t=e.map(s=>$(s));return this._usesUniqueRowSelection()&&this._applyUniqueSelectionConstraint(t),(i=this.options)!=null&&i.sortSelectedFirst&&(t=V(t,this._usesSimpleRowSelection())),t}_applyUniqueSelectionConstraint(e){let t=!1;const i=s=>{s.forEach(r=>{r.selected&&(t?r.selected=!1:t=!0),r.children&&i(r.children)})};i(e)}_applyOptionsChange(){if(this.options){if(this._isLazyEnabled()){this.options.items!==this._lazyItemsSourceRef&&(this._initLazyState(),this._resetSearchDerivedState(),this._searchTerm.trim()&&this._recomputeSearchFilter());return}if(this._items=this._applyItemsFromOptions(this.options.items),this._invalidateSearchIndex(),this._activeRowId=null,this._resetSearchDerivedState(),this._searchTerm.trim()){this._recomputeSearchFilter();return}this.options.defaultExpandedLevel!==void 0&&this._expandedIds.size===0&&this._expandToLevel(this._items,0,this.options.defaultExpandedLevel),this._syncActiveRowWithVisibleRows()}}_initLazyState(){var s;this._lazyItemsSourceRef=this.options.items,this._sourceItems=this._applyItemsFromOptions(this.options.items),this._invalidateSearchIndex(),this._treeIndex=ae(this._sourceItems),this._indexById=new Map(this._treeIndex.map(r=>[r.id,r])),this._sourceById=me(this._sourceItems);const e=(s=this.options)==null?void 0:s.defaultExpandedLevel,t=this._getLazyPageSize(),i=le(this._treeIndex,t);this._loadedIds=new Set(i),e!==void 0&&e>0&&this._loadDefaultExpandedLevelForRoots(i,e),this._expandedIds=new Set,e!==void 0&&e>0&&this._applyLazyDefaultExpansion(i,e),this._activeRowId=null,this._rebuildMaterializedItems(),this._commitLazyRows()}_loadDefaultExpandedLevelForRoots(e,t){U(this._treeIndex,e,t).forEach(i=>this._loadedIds.add(i))}_applyLazyDefaultExpansion(e,t){_e(this._treeIndex,e,t).forEach(i=>this._expandedIds.add(i)),this._expandedIds=new Set(this._expandedIds)}_rebuildMaterializedItems(){this._items=xe(this._sourceItems,this._loadedIds,this._sourceById)}_selectionRoots(){return this._isLazyEnabled()?this._sourceItems:this._items}_selectionNode(e){return this._isLazyEnabled()?this._sourceById.get(e.id)??e:e}_invalidateSearchIndex(){this._searchIndex=null,this._searchIndexSourceRef=null}_resetSearchDerivedState(){this._searchVisibleIds=new Set,this._searchUserCollapsedIds=new Set,this._searchManualExpandedIds=new Set,this._searchStatusMessage=""}_ensureSearchIndex(){const e=this._selectionRoots();return this._searchIndex&&this._searchIndexSourceRef===e?this._searchIndex:(this._searchIndexSourceRef=e,this._searchIndex=z(e),this._searchIndex)}disconnectedCallback(){super.disconnectedCallback(),this._searchDebounceTimer!==null&&(clearTimeout(this._searchDebounceTimer),this._searchDebounceTimer=null)}_findNodeById(e,t){for(const i of e){if(i.id===t)return i;if(i.children){const s=this._findNodeById(i.children,t);if(s)return s}}}_forEachInSubtree(e,t,i){const s=this._findNodeById(e,t);if(!s)return;const r=o=>{var a;i(o),(a=o.children)==null||a.forEach(r)};r(s)}_getSourceChildren(e){const t=this._isLazyEnabled()?this._sourceById.get(e):this._findNodeById(this._items,e);return t==null?void 0:t.children}_loadMoreNodes(e){var o,a;if(!this._isLazyEnabled())return;const t=this._getLazyPageSize();let i,s=[];if(this._isSearchActive())if(S(this._searchVisibleIds,this._loadedIds))i=H(this._searchVisibleIds,this._loadedIds,this._indexById,t);else if(e!=null&&this._hasExclusiveSearchFolderWithUnloadedChildren())i=F(this._treeIndex,this._loadedIds,t,e);else return;else if(e!=null)i=F(this._treeIndex,this._loadedIds,t,e);else{s=de(this._treeIndex,this._loadedIds,t),i=[...s];const l=(o=this.options)==null?void 0:o.defaultExpandedLevel;l!==void 0&&l>0&&i.push(...U(this._treeIndex,s,l))}if(i.length===0)return;i.forEach(l=>this._loadedIds.add(l));const r=(a=this.options)==null?void 0:a.defaultExpandedLevel;s.length>0&&r!==void 0&&r>0&&this._applyLazyDefaultExpansion(s,r),this._loadedIds=new Set(this._loadedIds),this._rebuildMaterializedItems(),this._commitLazyRows()}_loadSubtreeForExpand(e){const t=ve(this._treeIndex,e,this._loadedIds,this._getLazyPageSize());t.length!==0&&(t.forEach(i=>this._loadedIds.add(i)),this._loadedIds=new Set(this._loadedIds),this._rebuildMaterializedItems())}_sourceHasChildren(e){var t,i;return!!((i=(t=this._sourceById.get(e))==null?void 0:t.children)!=null&&i.length)}_commitLazyRows(){this._isLazyEnabled()&&this._syncFlatRows()}_syncFlatRows(){this._flatRows=B({items:this._items,expandedIds:this._expandedIds,hasSearch:!!this._searchTerm.trim(),searchTerm:this._searchTerm,searchVisibleIds:this._searchVisibleIds,sourceHasChildren:e=>this._sourceHasChildren(e),getSourceChildren:e=>this._getSourceChildren(e)}),this._syncActiveRowWithVisibleRows()}_setActiveRow(e){this._activeRowId!==e&&(this._activeRowId=e)}_syncActiveRowWithVisibleRows(){const e=this._getVisibleTreeRows();if(e.length===0){this._activeRowId!==null&&(this._activeRowId=null);return}const t=e.some(i=>i.node.id===this._activeRowId);(this._activeRowId===null||!t)&&(this._activeRowId=e[0].node.id)}_getRowTabIndex(e){const t=this._getVisibleTreeRows();if(t.length===0)return-1;const i=this._activeRowId??t[0].node.id;return e===i?0:-1}_rowDomId(e){return`row-${String(e)}`}_rowSelector(e){return`#${CSS.escape(this._rowDomId(e))}`}_isSearchActive(){return!!this._searchTerm.trim()}_getSearchScrollTargetIndex(){const e=this._searchTerm.trim().toLowerCase();if(!e||this._flatRows.length===0)return 0;const t=this._flatRows.map((r,o)=>({row:r,index:o})).filter(({row:r})=>I(r.node.label,e));if(t.length===0)return 0;const i=t.reduce((r,o)=>o.row.level>=r.row.level?o:r),[s]=t;if(t.length>1&&s.row.hasChildrenInSource&&this._expandedIds.has(s.row.node.id)){const r=t.find(({row:o})=>o.level===s.row.level+1&&o.node.label.toLowerCase()===s.row.node.label.toLowerCase());if(r)return r.index}return i.index}_loadUntilSearchTargetVisible(){let e=0;for(;e++<100&&!(this._getSearchScrollTargetIndex()<this._flatRows.length||!S(this._searchVisibleIds,this._loadedIds)&&!this._hasExpandedUnloadedSubtree());){if(S(this._searchVisibleIds,this._loadedIds)){if(!O(this._searchVisibleIds,this._loadedIds,this._indexById,this._getLazyPageSize()))break}else break;this._loadedIds=new Set(this._loadedIds),this._rebuildMaterializedItems(),this._commitLazyRows()}}_scrollToSearchTarget(){!this._isLazyEnabled()||!this._isSearchActive()||this.updateComplete.then(()=>{var i;const e=(i=this.shadowRoot)==null?void 0:i.querySelector("lit-virtualizer"),t=this._getSearchScrollTargetIndex();!(e!=null&&e.scrollToIndex)||t<0||e.scrollToIndex(t,"start")})}_hasExpandedUnloadedSubtree(){for(const e of this._expandedIds)if(q(e,this._treeIndex,this._loadedIds))return!0;return!1}_hasExclusiveSearchFolderWithUnloadedChildren(){if(!this._isSearchActive())return!1;const e=this._searchTerm.trim();if(!e)return!1;for(const t of this._expandedIds){const i=this._sourceById.get(t);if(i&&ce(t,this._treeIndex,this._loadedIds)&&E(i.label,e,!1,t,this._searchVisibleIds,s=>this._getSourceChildren(s)))return!0}return!1}_shouldLoadMoreOnScroll(){return this._isLazyEnabled()?this._isSearchActive()?S(this._searchVisibleIds,this._loadedIds)||this._hasExclusiveSearchFolderWithUnloadedChildren():this._hasExpandedUnloadedSubtree()?this._treeIndex.some(e=>!this._loadedIds.has(e.id)):he(this._treeIndex,this._loadedIds):!1}_getLazyLoadPriorityNodeId(e,t){if(!(!this._isSearchActive()&&!this._hasExpandedUnloadedSubtree()))return fe(this._flatRows,e,t,this._expandedIds,this._treeIndex,this._loadedIds,this._getScrollPrefetchMargin())}_getScrollPrefetchMargin(){return Math.min(20,Math.max(5,Math.floor(this._getLazyPageSize()/4)))}_onVirtualizerVisibilityChanged(e){const t=e,i=t.first,s=t.last;if(s==null||!this._shouldLoadMoreOnScroll()||this._lazyScrollLoading)return;const r=this._getLazyLoadPriorityNodeId(i??s,s),o=Math.max(0,this._flatRows.length-this._getScrollPrefetchMargin());r==null&&s<o||(this._lazyScrollLoading=!0,this._loadMoreNodes(r),this.updateComplete.then(()=>{this._lazyScrollLoading=!1}))}_getTreeAriaLabel(){var e,t;return((t=(e=this.options)==null?void 0:e.title)==null?void 0:t.trim())||"Treeview"}_renderTreeRow(e,t,i){const{isExpanded:s,hasChildren:r,isRowHighlighted:o,isSelectable:a}=i;return c.html`
2
2
  <div
3
3
  id=${this._rowDomId(e.id)}
4
4
  role="treeitem"
@@ -34,7 +34,7 @@
34
34
  <nyx-icon
35
35
  slot="icon"
36
36
  class=${b.classMap({expanded:t})}
37
- .svg=${M.chevronRightRegular}
37
+ .svg=${A.chevronRightRegular}
38
38
  ></nyx-icon>
39
39
  </nyx-button>
40
40
  `:c.html`<span class="expander-placeholder" aria-hidden="true"></span>`}_renderNodeTypeIcon(e){const t=e.icon;return t?typeof t=="string"?c.html`<nyx-icon name=${t} variant="regular"></nyx-icon>`:c.html`
@@ -44,7 +44,7 @@
44
44
  src=${t.src??c.nothing}
45
45
  .svg=${t.svg}
46
46
  ></nyx-icon>
47
- `:c.nothing}_generateLightDomIcons(){var i;if(this.querySelectorAll("[data-auto-generated]").forEach(s=>s.remove()),!this.options||(this._hasColumnPermissions()&&((i=this.options.columns)==null||i.forEach((s,r)=>{s.icon&&this._createIconElement(s.icon,`generated-header-icon-${r}`)})),this._isLazyEnabled()||!this._showNodeIcons()))return;const t=s=>{var r;s.icon&&this._createIconElement(s.icon,`generated-tree-icon-${s.id}`),(r=s.children)==null||r.forEach(t)};this._items.forEach(t)}_createIconElement(e,t){const i=document.createElement("nyx-icon");let s="regular";typeof e=="string"?i.setAttribute("name",e):(e.name&&i.setAttribute("name",e.name),e.variant&&(s=e.variant),e.src&&i.setAttribute("src",e.src),e.svg&&(i.svg=e.svg)),i.setAttribute("variant",s),i.setAttribute("slot",t),i.setAttribute("data-auto-generated",""),this.appendChild(i)}_expandToLevel(e,t,i){e.forEach(s=>{t<i&&(this._expandedIds.add(s.id),s.children&&this._expandToLevel(s.children,t+1,i))})}_isColumnDisabled(e,t){return!!e.disabledColumns&&e.disabledColumns.includes(t)}_isNodeSelected(e,t){return this._isColumnDisabled(e,t)?!1:(e.selectedColumns||[]).includes(t)}_isIndeterminate(e,t){if(e=this._selectionNode(e),!e.children||e.children.length===0)return!1;const i=this._getFlatDescendants(e),s=i.filter(r=>this._isNodeSelected(r,t)).length;return s>0&&s<i.length}_allDescendantsSelected(e,t){return e=this._selectionNode(e),!e.children||e.children.length===0?this._isNodeSelected(e,t):this._getFlatDescendants(e).every(s=>this._isNodeSelected(s,t))}_getFlatDescendants(e){e=this._selectionNode(e);let t=[];return e.children&&e.children.forEach(i=>{const s=this._selectionNode(i);t.push(s),t=t.concat(this._getFlatDescendants(s))}),t}_requiredClosure(e){var a,l,d;const t=((a=this.options)==null?void 0:a.columns)??[],i=new Map(t.map(h=>[h.id,h])),s=[],r=new Set([e]),o=[...((l=i.get(e))==null?void 0:l.requires)??[]];for(;o.length;){const h=o.pop();r.has(h)||(r.add(h),s.push(h),o.push(...((d=i.get(h))==null?void 0:d.requires)??[]))}return s}_dependentsClosure(e){var o;const t=((o=this.options)==null?void 0:o.columns)??[],i=[],s=new Set([e]),r=[e];for(;r.length;){const a=r.pop();for(const l of t)(l.requires??[]).includes(a)&&!s.has(l.id)&&(s.add(l.id),i.push(l.id),r.push(l.id))}return i}_canEnableColumn(e,t){return this._isColumnDisabled(e,t)?!1:this._requiredClosure(t).every(i=>!this._isColumnDisabled(e,i))}_handleCheck(e,t){const i=this._selectionNode(e);if(this._isColumnDisabled(i,t))return;const r=!this._isNodeSelected(i,t),o=this._requiredClosure(t),a=r?[t,...o]:[t,...this._dependentsClosure(t)];this._forEachInSubtree(this._selectionRoots(),e.id,l=>{r&&o.some(h=>this._isColumnDisabled(l,h))||a.forEach(d=>this._toggleNodeState(l,d,r))}),a.forEach(l=>this._updateParents(this._selectionRoots(),e.id,l)),this._triggerChange()}_toggleNodeState(e,t,i){if(this._isColumnDisabled(e,t))return;e.selectedColumns||(e.selectedColumns=[]);const s=e.selectedColumns.indexOf(t);i&&s===-1?e.selectedColumns.push(t):!i&&s>-1&&e.selectedColumns.splice(s,1)}_updateParents(e,t,i){for(const s of e)if(s.children&&s.children.some(r=>r.id===t||this._updateParents(s.children,t,i))){const r=s.children.every(o=>this._allDescendantsSelected(o,i));return this._toggleNodeState(s,i,r&&this._canEnableColumn(s,i)),!0}return!1}_isRowAllSelected(e){var i;if(e=this._selectionNode(e),!((i=this.options)!=null&&i.columns))return!1;const t=this.options.columns.every(s=>this._isColumnDisabled(e,s.id)?!0:this._isNodeSelected(e,s.id));return e.children&&e.children.length>0?t&&e.children.every(s=>this._isRowAllSelected(s)):t}_isRowIndeterminate(e){var s;if(e=this._selectionNode(e),this._isRowAllSelected(e)||!((s=this.options)!=null&&s.columns))return!1;const t=this.options.columns.some(r=>this._isNodeSelected(e,r.id)),i=e.children?e.children.some(r=>this._isRowAllSelected(r)||this._isRowIndeterminate(r)):!1;return t||i}_isSimpleRowAllSelected(e){var t;return e=this._selectionNode(e),(t=e.children)!=null&&t.length?e.children.every(i=>this._isSimpleRowAllSelected(i)):!!e.selected}_isSimpleRowIndeterminate(e){var s;return e=this._selectionNode(e),this._isSimpleRowAllSelected(e)||!((s=e.children)!=null&&s.length)?!1:this._getFlatDescendants(e).filter(r=>r.selected).length>0}_setSimpleRowSelected(e,t){this._forEachInSubtree(this._selectionRoots(),e,i=>{i.selected=t})}_updateSimpleRowParents(e,t){var i;for(const s of e)if((i=s.children)!=null&&i.some(r=>r.id===t||this._updateSimpleRowParents(s.children,t)))return s.selected=s.children.every(r=>this._isSimpleRowAllSelected(r)),!0;return!1}_isRowCheckboxChecked(e){const t=this._selectionNode(e);return this._usesUniqueRowSelection()?!!t.selected:this._usesSimpleRowSelection()?this._isSimpleRowAllSelected(t):this._isRowAllSelected(t)}_isRowCheckboxIndeterminate(e){if(this._usesUniqueRowSelection())return!1;const t=this._selectionNode(e);return this._usesSimpleRowSelection()?this._isSimpleRowIndeterminate(t):this._isRowIndeterminate(t)}_setUniqueRowSelected(e){let t=!1;const i=s=>{s.forEach(r=>{const o=r.id===e;!!r.selected!==o&&(r.selected=o,t=!0),r.children&&i(r.children)})};return i(this._selectionRoots()),t}_handleRowCheck(e){var s;if(this._usesUniqueRowSelection()){this._setUniqueRowSelected(e.id)&&this._triggerChange();return}const i=!this._isRowCheckboxChecked(e);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=>{this._updateParents(this._selectionRoots(),e.id,r.id)})),this._triggerChange()}_applyRowColumnsToNode(e,t){var i;(i=this.options)!=null&&i.columns&&(t?this.options.columns.forEach(s=>{this._canEnableColumn(e,s.id)&&(e.selectedColumns||(e.selectedColumns=[]),e.selectedColumns.includes(s.id)||e.selectedColumns.push(s.id))}):e.selectedColumns=(e.selectedColumns??[]).filter(s=>this._isColumnDisabled(e,s)))}_toggleRowRecursively(e,t){this._forEachInSubtree(this._selectionRoots(),e,i=>{this._applyRowColumnsToNode(i,t)})}_triggerChange(){if(this._isLazyEnabled()){this._rebuildMaterializedItems(),this._commitLazyRows(),this.onChange({items:this._sourceItems},{bubbles:!0,composed:!0});return}this._items=[...this._items],this._invalidateSearchIndex(),this._searchTerm.trim()&&this._recomputeSearchFilter(),this.onChange({items:this._items},{bubbles:!0,composed:!0})}_handleSearchInput(e){const t=e.target.value,i=this._searchTerm,s=t.trim();if(this._searchDebounceTimer!==null&&(clearTimeout(this._searchDebounceTimer),this._searchDebounceTimer=null),!s&&i.trim()){this._applySearchTerm(t,i);return}this._searchDebounceTimer=setTimeout(()=>{this._searchDebounceTimer=null,this._applySearchTerm(t,i)},te)}_applySearchTerm(e,t){const i=t.trim(),s=e.trim();!i&&s?(this._expandedIdsBeforeSearch=new Set(this._expandedIds),this._searchManualExpandedIds=new Set,this._searchUserCollapsedIds=new Set):i&&!s?(this._searchUserCollapsedIds=new Set,this._searchManualExpandedIds=new Set):i&&s&&i.toLowerCase()!==s.toLowerCase()&&(this._searchUserCollapsedIds=new Set,this._searchManualExpandedIds=new Set),this._searchTerm=e,this._recomputeSearchFilter()}_recomputeSearchFilter(){const e=this._searchTerm.trim();if(!e){this._searchVisibleIds=new Set,this._expandedIdsBeforeSearch&&(this._expandedIds=new Set(this._expandedIdsBeforeSearch),this._expandedIdsBeforeSearch=null),this._isLazyEnabled()?this._commitLazyRows():this._syncActiveRowWithVisibleRows(),this._updateSearchStatusMessage();return}const t=this._ensureSearchIndex(),{visibleIds:i,expandIds:s}=ne(t,e,this._searchUserCollapsedIds),r=new Set(s);this._searchManualExpandedIds.forEach(o=>{this._searchUserCollapsedIds.has(o)||r.add(o)}),this._searchVisibleIds=i,this._expandedIds=r,this._isLazyEnabled()?(W(i,this._loadedIds,this._indexById,this._getLazyPageSize())&&(this._loadedIds=new Set(this._loadedIds),this._rebuildMaterializedItems()),this._commitLazyRows(),this._loadUntilSearchTargetVisible(),this._scrollToSearchTarget()):this._syncActiveRowWithVisibleRows(),this._updateSearchStatusMessage()}_updateSearchStatusMessage(){const e=this._searchTerm.trim();if(!e){this._searchStatusMessage="";return}const t=this._ensureSearchIndex();this._searchStatusMessage=ye(re(t,e))}async _toggleExpand(e,t=!1){if(!(this._isLazyEnabled()?this._sourceHasChildren(e.id):!!(e.children&&e.children.length>0)))return;const s=this._expandedIds.has(e.id);s?(this._expandedIds.delete(e.id),this._searchTerm.trim()&&(this._searchUserCollapsedIds.add(e.id),this._searchUserCollapsedIds=new Set(this._searchUserCollapsedIds),this._searchManualExpandedIds.delete(e.id),this._searchManualExpandedIds=new Set(this._searchManualExpandedIds))):(this._expandedIds.add(e.id),this._searchTerm.trim()&&(this._searchManualExpandedIds.add(e.id),this._searchManualExpandedIds=new Set(this._searchManualExpandedIds),this._searchUserCollapsedIds.delete(e.id),this._searchUserCollapsedIds=new Set(this._searchUserCollapsedIds)),this._isLazyEnabled()&&this._loadSubtreeForExpand(e.id)),this._expandedIds=new Set(this._expandedIds),this._isLazyEnabled()?this._commitLazyRows():this._syncActiveRowWithVisibleRows(),!s&&t&&(await this.updateComplete,this._focusFirstVisibleChild(e.id))}_nodeHasChildren(e){return this._isLazyEnabled()?this._sourceHasChildren(e.id):!!(e.children&&e.children.length>0)}_getVisibleTreeRows(){return this._isLazyEnabled()?this._flatRows:H({items:this._items,expandedIds:this._expandedIds,hasSearch:this._isSearchActive(),searchTerm:this._searchTerm,searchVisibleIds:this._searchVisibleIds,sourceHasChildren:e=>{var t;return!!((t=this._getSourceChildren(e))!=null&&t.length)},getSourceChildren:e=>this._getSourceChildren(e)})}_getParentId(e){var s;if(this._isLazyEnabled()){const r=(s=this._indexById.get(e))==null?void 0:s.parentId;return r??void 0}let t;const i=(r,o)=>{for(const a of r){if(a.id===e)return t=o??void 0,!0;if(a.children&&i(a.children,a.id))return!0}return!1};return i(this._items,null),t}_focusRowById(e){this._setActiveRow(e),this.updateComplete.then(()=>{var i,s,r;if(this._isLazyEnabled()){const o=this._flatRows.findIndex(a=>a.node.id===e);if(o>=0){const a=(i=this.shadowRoot)==null?void 0:i.querySelector("lit-virtualizer");(s=a==null?void 0:a.scrollToIndex)==null||s.call(a,o,"nearest")}}const t=(r=this.shadowRoot)==null?void 0:r.querySelector(this._rowSelector(e));t==null||t.focus()})}_focusFirstVisibleChild(e){const t=this._getVisibleTreeRows(),i=t.findIndex(r=>r.node.id===e);if(i<0)return;const s=t[i].level;for(let r=i+1;r<t.length&&!(t[r].level<=s);r++)if(t[r].level===s+1){this._focusRowById(t[r].node.id);return}}async _handleRowKeyDown(e,t){var l;const i=e.currentTarget;if(e.target!==i)return;const s=this._getVisibleTreeRows(),r=s.findIndex(d=>d.node.id===t.id),o=this._nodeHasChildren(t),a=this._expandedIds.has(t.id);if(e.key==="ArrowDown"||e.key==="ArrowUp"){const d=e.key==="ArrowDown"?r+1:r-1;d>=0&&d<s.length&&(e.preventDefault(),this._focusRowById(s[d].node.id));return}if(e.key==="Home"||e.key==="End"){if(s.length===0)return;e.preventDefault();const d=e.key==="Home"?s[0]:s[s.length-1];this._focusRowById(d.node.id);return}if(e.key==="ArrowRight"){if(!o)return;if(e.preventDefault(),!a){await this._toggleExpand(t,!0);return}this._focusFirstVisibleChild(t.id);return}if(e.key==="ArrowLeft"){if(e.preventDefault(),o&&a){await this._toggleExpand(t,!1),i.focus();return}const d=this._getParentId(t.id);d!==void 0&&this._focusRowById(d);return}if(e.key==="Enter"||e.key===" "){e.preventDefault(),this._enableChildren(i);const d=i.querySelector("nyx-checkbox input, nyx-radio input, nyx-button:not([disabled])");if(d)if(d instanceof HTMLInputElement)d.focus();else{const h=(l=d.shadowRoot)==null?void 0:l.querySelector("button");h==null||h.focus()}return}e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),this._disableChildren(i),i.focus())}_handleRowFocusOut(e){const t=e.currentTarget;t.contains(e.relatedTarget)||this._disableChildren(t)}_enableChildren(e){const t=e.querySelectorAll('input[slot="input"]'),i=e.querySelectorAll("nyx-button");t.forEach(s=>s.setAttribute("tabindex","0")),i.forEach(s=>s.removeAttribute("tabindex"))}_disableChildren(e){const t=e.querySelectorAll('input[slot="input"]'),i=e.querySelectorAll("nyx-button");t.forEach(s=>s.setAttribute("tabindex","-1")),i.forEach(s=>s.setAttribute("tabindex","-1"))}_clearAllFocus(){var i,s;const e=(i=this.shadowRoot)==null?void 0:i.activeElement;e==null||e.blur();const t=(s=this.shadowRoot)==null?void 0:s.querySelectorAll(".node-row");t==null||t.forEach(r=>{this._disableChildren(r)})}_renderRowSelectionCheckbox(e){return this._showRowSelection()?this._usesUniqueRowSelection()?c.html`
47
+ `:c.nothing}_generateLightDomIcons(){var i;if(this.querySelectorAll("[data-auto-generated]").forEach(s=>s.remove()),!this.options||(this._hasColumnPermissions()&&((i=this.options.columns)==null||i.forEach((s,r)=>{s.icon&&this._createIconElement(s.icon,`generated-header-icon-${r}`)})),this._isLazyEnabled()||!this._showNodeIcons()))return;const t=s=>{var r;s.icon&&this._createIconElement(s.icon,`generated-tree-icon-${s.id}`),(r=s.children)==null||r.forEach(t)};this._items.forEach(t)}_createIconElement(e,t){const i=document.createElement("nyx-icon");let s="regular";typeof e=="string"?i.setAttribute("name",e):(e.name&&i.setAttribute("name",e.name),e.variant&&(s=e.variant),e.src&&i.setAttribute("src",e.src),e.svg&&(i.svg=e.svg)),i.setAttribute("variant",s),i.setAttribute("slot",t),i.setAttribute("data-auto-generated",""),this.appendChild(i)}_expandToLevel(e,t,i){e.forEach(s=>{t<i&&(this._expandedIds.add(s.id),s.children&&this._expandToLevel(s.children,t+1,i))})}_isColumnDisabled(e,t){return!!e.disabledColumns&&e.disabledColumns.includes(t)}_isNodeSelected(e,t){return this._isColumnDisabled(e,t)?!1:(e.selectedColumns||[]).includes(t)}_isIndeterminate(e,t){if(e=this._selectionNode(e),!e.children||e.children.length===0)return!1;const i=this._getFlatDescendants(e),s=i.filter(r=>this._isNodeSelected(r,t)).length;return s>0&&s<i.length}_allDescendantsSelected(e,t){return e=this._selectionNode(e),!e.children||e.children.length===0?this._isNodeSelected(e,t):this._getFlatDescendants(e).every(s=>this._isNodeSelected(s,t))}_getFlatDescendants(e){e=this._selectionNode(e);let t=[];return e.children&&e.children.forEach(i=>{const s=this._selectionNode(i);t.push(s),t=t.concat(this._getFlatDescendants(s))}),t}_requiredClosure(e){var a,l,d;const t=((a=this.options)==null?void 0:a.columns)??[],i=new Map(t.map(h=>[h.id,h])),s=[],r=new Set([e]),o=[...((l=i.get(e))==null?void 0:l.requires)??[]];for(;o.length;){const h=o.pop();r.has(h)||(r.add(h),s.push(h),o.push(...((d=i.get(h))==null?void 0:d.requires)??[]))}return s}_dependentsClosure(e){var o;const t=((o=this.options)==null?void 0:o.columns)??[],i=[],s=new Set([e]),r=[e];for(;r.length;){const a=r.pop();for(const l of t)(l.requires??[]).includes(a)&&!s.has(l.id)&&(s.add(l.id),i.push(l.id),r.push(l.id))}return i}_canEnableColumn(e,t){return this._isColumnDisabled(e,t)?!1:this._requiredClosure(t).every(i=>!this._isColumnDisabled(e,i))}_handleCheck(e,t){const i=this._selectionNode(e);if(this._isColumnDisabled(i,t))return;const r=!this._isNodeSelected(i,t),o=this._requiredClosure(t),a=r?[t,...o]:[t,...this._dependentsClosure(t)];this._forEachInSubtree(this._selectionRoots(),e.id,l=>{r&&o.some(h=>this._isColumnDisabled(l,h))||a.forEach(d=>this._toggleNodeState(l,d,r))}),a.forEach(l=>this._updateParents(this._selectionRoots(),e.id,l)),this._triggerChange()}_toggleNodeState(e,t,i){if(this._isColumnDisabled(e,t))return;e.selectedColumns||(e.selectedColumns=[]);const s=e.selectedColumns.indexOf(t);i&&s===-1?e.selectedColumns.push(t):!i&&s>-1&&e.selectedColumns.splice(s,1)}_updateParents(e,t,i){for(const s of e)if(s.children&&s.children.some(r=>r.id===t||this._updateParents(s.children,t,i))){const r=s.children.every(o=>this._allDescendantsSelected(o,i));return this._toggleNodeState(s,i,r&&this._canEnableColumn(s,i)),!0}return!1}_isRowAllSelected(e){var i;if(e=this._selectionNode(e),!((i=this.options)!=null&&i.columns))return!1;const t=this.options.columns.every(s=>this._isColumnDisabled(e,s.id)?!0:this._isNodeSelected(e,s.id));return e.children&&e.children.length>0?t&&e.children.every(s=>this._isRowAllSelected(s)):t}_isRowIndeterminate(e){var s;if(e=this._selectionNode(e),this._isRowAllSelected(e)||!((s=this.options)!=null&&s.columns))return!1;const t=this.options.columns.some(r=>this._isNodeSelected(e,r.id)),i=e.children?e.children.some(r=>this._isRowAllSelected(r)||this._isRowIndeterminate(r)):!1;return t||i}_isSimpleRowAllSelected(e){var t;return e=this._selectionNode(e),(t=e.children)!=null&&t.length?e.children.every(i=>this._isSimpleRowAllSelected(i)):!!e.selected}_isSimpleRowIndeterminate(e){var s;return e=this._selectionNode(e),this._isSimpleRowAllSelected(e)||!((s=e.children)!=null&&s.length)?!1:this._getFlatDescendants(e).filter(r=>r.selected).length>0}_setSimpleRowSelected(e,t){this._forEachInSubtree(this._selectionRoots(),e,i=>{i.selected=t})}_updateSimpleRowParents(e,t){var i;for(const s of e)if((i=s.children)!=null&&i.some(r=>r.id===t||this._updateSimpleRowParents(s.children,t)))return s.selected=s.children.every(r=>this._isSimpleRowAllSelected(r)),!0;return!1}_isRowCheckboxChecked(e){const t=this._selectionNode(e);return this._usesUniqueRowSelection()?!!t.selected:this._usesSimpleRowSelection()?this._isSimpleRowAllSelected(t):this._isRowAllSelected(t)}_isRowCheckboxIndeterminate(e){if(this._usesUniqueRowSelection())return!1;const t=this._selectionNode(e);return this._usesSimpleRowSelection()?this._isSimpleRowIndeterminate(t):this._isRowIndeterminate(t)}_setUniqueRowSelected(e){let t=!1;const i=s=>{s.forEach(r=>{const o=r.id===e;!!r.selected!==o&&(r.selected=o,t=!0),r.children&&i(r.children)})};return i(this._selectionRoots()),t}_handleRowCheck(e){var s;if(this._usesUniqueRowSelection()){this._setUniqueRowSelected(e.id)&&this._triggerChange();return}const i=!this._isRowCheckboxChecked(e);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=>{this._updateParents(this._selectionRoots(),e.id,r.id)})),this._triggerChange()}_applyRowColumnsToNode(e,t){var i;(i=this.options)!=null&&i.columns&&(t?this.options.columns.forEach(s=>{this._canEnableColumn(e,s.id)&&(e.selectedColumns||(e.selectedColumns=[]),e.selectedColumns.includes(s.id)||e.selectedColumns.push(s.id))}):e.selectedColumns=(e.selectedColumns??[]).filter(s=>this._isColumnDisabled(e,s)))}_toggleRowRecursively(e,t){this._forEachInSubtree(this._selectionRoots(),e,i=>{this._applyRowColumnsToNode(i,t)})}_triggerChange(){if(this._isLazyEnabled()){this._rebuildMaterializedItems(),this._commitLazyRows(),this.onChange({items:this._sourceItems},{bubbles:!0,composed:!0});return}this._items=[...this._items],this._invalidateSearchIndex(),this._searchTerm.trim()&&this._recomputeSearchFilter(),this.onChange({items:this._items},{bubbles:!0,composed:!0})}_handleSearchInput(e){const t=e.target.value,i=this._searchTerm,s=t.trim();if(this._searchDebounceTimer!==null&&(clearTimeout(this._searchDebounceTimer),this._searchDebounceTimer=null),!s&&i.trim()){this._applySearchTerm(t,i);return}this._searchDebounceTimer=setTimeout(()=>{this._searchDebounceTimer=null,this._applySearchTerm(t,i)},ee)}_applySearchTerm(e,t){const i=t.trim(),s=e.trim();!i&&s?(this._expandedIdsBeforeSearch=new Set(this._expandedIds),this._searchManualExpandedIds=new Set,this._searchUserCollapsedIds=new Set):i&&!s?(this._searchUserCollapsedIds=new Set,this._searchManualExpandedIds=new Set):i&&s&&i.toLowerCase()!==s.toLowerCase()&&(this._searchUserCollapsedIds=new Set,this._searchManualExpandedIds=new Set),this._searchTerm=e,this._recomputeSearchFilter()}_recomputeSearchFilter(){const e=this._searchTerm.trim();if(!e){this._searchVisibleIds=new Set,this._expandedIdsBeforeSearch&&(this._expandedIds=new Set(this._expandedIdsBeforeSearch),this._expandedIdsBeforeSearch=null),this._isLazyEnabled()?this._commitLazyRows():this._syncActiveRowWithVisibleRows(),this._updateSearchStatusMessage();return}const t=this._ensureSearchIndex(),{visibleIds:i,expandIds:s}=re(t,e,this._searchUserCollapsedIds),r=new Set(s);this._searchManualExpandedIds.forEach(o=>{this._searchUserCollapsedIds.has(o)||r.add(o)}),this._searchVisibleIds=i,this._expandedIds=r,this._isLazyEnabled()?(O(i,this._loadedIds,this._indexById,this._getLazyPageSize())&&(this._loadedIds=new Set(this._loadedIds),this._rebuildMaterializedItems()),this._commitLazyRows(),this._loadUntilSearchTargetVisible(),this._scrollToSearchTarget()):this._syncActiveRowWithVisibleRows(),this._updateSearchStatusMessage()}_updateSearchStatusMessage(){const e=this._searchTerm.trim();if(!e){this._searchStatusMessage="";return}const t=this._ensureSearchIndex();this._searchStatusMessage=ye(se(t,e))}async _toggleExpand(e,t=!1){if(!(this._isLazyEnabled()?this._sourceHasChildren(e.id):!!(e.children&&e.children.length>0)))return;const s=this._expandedIds.has(e.id);s?(this._expandedIds.delete(e.id),this._searchTerm.trim()&&(this._searchUserCollapsedIds.add(e.id),this._searchUserCollapsedIds=new Set(this._searchUserCollapsedIds),this._searchManualExpandedIds.delete(e.id),this._searchManualExpandedIds=new Set(this._searchManualExpandedIds))):(this._expandedIds.add(e.id),this._searchTerm.trim()&&(this._searchManualExpandedIds.add(e.id),this._searchManualExpandedIds=new Set(this._searchManualExpandedIds),this._searchUserCollapsedIds.delete(e.id),this._searchUserCollapsedIds=new Set(this._searchUserCollapsedIds)),this._isLazyEnabled()&&this._loadSubtreeForExpand(e.id)),this._expandedIds=new Set(this._expandedIds),this._isLazyEnabled()?this._commitLazyRows():this._syncActiveRowWithVisibleRows(),!s&&t&&(await this.updateComplete,this._focusFirstVisibleChild(e.id))}_nodeHasChildren(e){return this._isLazyEnabled()?this._sourceHasChildren(e.id):!!(e.children&&e.children.length>0)}_getVisibleTreeRows(){return this._isLazyEnabled()?this._flatRows:B({items:this._items,expandedIds:this._expandedIds,hasSearch:this._isSearchActive(),searchTerm:this._searchTerm,searchVisibleIds:this._searchVisibleIds,sourceHasChildren:e=>{var t;return!!((t=this._getSourceChildren(e))!=null&&t.length)},getSourceChildren:e=>this._getSourceChildren(e)})}_getParentId(e){var s;if(this._isLazyEnabled()){const r=(s=this._indexById.get(e))==null?void 0:s.parentId;return r??void 0}let t;const i=(r,o)=>{for(const a of r){if(a.id===e)return t=o??void 0,!0;if(a.children&&i(a.children,a.id))return!0}return!1};return i(this._items,null),t}_focusRowById(e){this._setActiveRow(e),this.updateComplete.then(()=>{var i,s,r;if(this._isLazyEnabled()){const o=this._flatRows.findIndex(a=>a.node.id===e);if(o>=0){const a=(i=this.shadowRoot)==null?void 0:i.querySelector("lit-virtualizer");(s=a==null?void 0:a.scrollToIndex)==null||s.call(a,o,"nearest")}}const t=(r=this.shadowRoot)==null?void 0:r.querySelector(this._rowSelector(e));t==null||t.focus()})}_focusFirstVisibleChild(e){const t=this._getVisibleTreeRows(),i=t.findIndex(r=>r.node.id===e);if(i<0)return;const s=t[i].level;for(let r=i+1;r<t.length&&!(t[r].level<=s);r++)if(t[r].level===s+1){this._focusRowById(t[r].node.id);return}}async _handleRowKeyDown(e,t){var l;const i=e.currentTarget;if(e.target!==i)return;const s=this._getVisibleTreeRows(),r=s.findIndex(d=>d.node.id===t.id),o=this._nodeHasChildren(t),a=this._expandedIds.has(t.id);if(e.key==="ArrowDown"||e.key==="ArrowUp"){const d=e.key==="ArrowDown"?r+1:r-1;d>=0&&d<s.length&&(e.preventDefault(),this._focusRowById(s[d].node.id));return}if(e.key==="Home"||e.key==="End"){if(s.length===0)return;e.preventDefault();const d=e.key==="Home"?s[0]:s[s.length-1];this._focusRowById(d.node.id);return}if(e.key==="ArrowRight"){if(!o)return;if(e.preventDefault(),!a){await this._toggleExpand(t,!0);return}this._focusFirstVisibleChild(t.id);return}if(e.key==="ArrowLeft"){if(e.preventDefault(),o&&a){await this._toggleExpand(t,!1),i.focus();return}const d=this._getParentId(t.id);d!==void 0&&this._focusRowById(d);return}if(e.key==="Enter"||e.key===" "){e.preventDefault(),this._enableChildren(i);const d=i.querySelector("nyx-checkbox input, nyx-radio input, nyx-button:not([disabled])");if(d)if(d instanceof HTMLInputElement)d.focus();else{const h=(l=d.shadowRoot)==null?void 0:l.querySelector("button");h==null||h.focus()}return}e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),this._disableChildren(i),i.focus())}_handleRowFocusOut(e){const t=e.currentTarget;t.contains(e.relatedTarget)||this._disableChildren(t)}_enableChildren(e){const t=e.querySelectorAll('input[slot="input"]'),i=e.querySelectorAll("nyx-button");t.forEach(s=>s.setAttribute("tabindex","0")),i.forEach(s=>s.removeAttribute("tabindex"))}_disableChildren(e){const t=e.querySelectorAll('input[slot="input"]'),i=e.querySelectorAll("nyx-button");t.forEach(s=>s.setAttribute("tabindex","-1")),i.forEach(s=>s.setAttribute("tabindex","-1"))}_clearAllFocus(){var i,s;const e=(i=this.shadowRoot)==null?void 0:i.activeElement;e==null||e.blur();const t=(s=this.shadowRoot)==null?void 0:s.querySelectorAll(".node-row");t==null||t.forEach(r=>{this._disableChildren(r)})}_renderRowSelectionCheckbox(e){return this._showRowSelection()?this._usesUniqueRowSelection()?c.html`
48
48
  <div class="row-checkbox">
49
49
  <nyx-radio
50
50
  ?checked=${this._isRowCheckboxChecked(e)}
@@ -56,14 +56,14 @@
56
56
  tabindex="-1"
57
57
  name=${this._rowSelectionRadioName}
58
58
  .checked=${this._isRowCheckboxChecked(e)}
59
- aria-label=${j(e.label)}
59
+ aria-label=${W(e.label)}
60
60
  />
61
61
  </nyx-radio>
62
62
  </div>
63
63
  `:c.html`
64
64
  <div class="row-checkbox">
65
65
  <nyx-checkbox
66
- aria-label=${j(e.label)}
66
+ aria-label=${W(e.label)}
67
67
  ?checked=${this._isRowCheckboxChecked(e)}
68
68
  ?indeterminate=${this._isRowCheckboxIndeterminate(e)}
69
69
  @click=${t=>{t.stopPropagation(),this._handleRowCheck(e)}}
@@ -99,7 +99,7 @@
99
99
  >
100
100
  <div class="search-container">
101
101
  <nyx-input>
102
- <nyx-icon .svg=${M.magnifyingGlass} slot="iconLeft"></nyx-icon>
102
+ <nyx-icon .svg=${A.magnifyingGlass} slot="iconLeft"></nyx-icon>
103
103
  <input
104
104
  class="search-input"
105
105
  type="text"
@@ -157,11 +157,11 @@
157
157
  <div class="node-wrapper node-wrapper--flat">
158
158
  ${this._renderTreeRow(t,i,{isExpanded:o,hasChildren:a,isRowHighlighted:d,isSelectable:l})}
159
159
  </div>
160
- `}_renderNodes(e,t,i=!1,s=!1,r=!1){const o=!!this._searchTerm.trim(),a=this._searchTerm.trim().toLowerCase(),l=o&&!r?e.filter(d=>this._searchVisibleIds.has(d.id)):e;return J.repeat(l,d=>d.id,d=>{const h=this._expandedIds.has(d.id),m=this._isLazyEnabled()?this._sourceHasChildren(d.id):!!(d.children&&d.children.length>0),w=this._isRowCheckboxChecked(d)||this._isRowCheckboxIndeterminate(d),x=this._showRowSelection(),$=P(d.label,a,i,s),Z=!o||$&&z(d.label,a,s,d.id,this._searchVisibleIds,A=>this._getSourceChildren(A))?d.children:N(d,this._searchVisibleIds,a),S=s||o&&!!a&&d.label.toLowerCase().includes(a);return c.html`
160
+ `}_renderNodes(e,t,i=!1,s=!1,r=!1){const o=!!this._searchTerm.trim(),a=this._searchTerm.trim().toLowerCase(),l=o&&!r?e.filter(d=>this._searchVisibleIds.has(d.id)):e;return Y.repeat(l,d=>d.id,d=>{const h=this._expandedIds.has(d.id),f=this._isLazyEnabled()?this._sourceHasChildren(d.id):!!(d.children&&d.children.length>0),p=this._isRowCheckboxChecked(d)||this._isRowCheckboxIndeterminate(d),m=this._showRowSelection(),y=P(d.label,a,i,s),K=!o||y&&E(d.label,a,s,d.id,this._searchVisibleIds,M=>this._getSourceChildren(M))?d.children:N(d,this._searchVisibleIds,a),C=s||o&&!!a&&d.label.toLowerCase().includes(a);return c.html`
161
161
  <div class="node-wrapper">
162
- ${this._renderTreeRow(d,t,{isExpanded:h,hasChildren:m,isRowHighlighted:w,isSelectable:x})}
163
- ${h&&m?c.html`<div class="node-children" role="group">
164
- ${this._renderNodes(Z,t+1,$,S,!0)}
162
+ ${this._renderTreeRow(d,t,{isExpanded:h,hasChildren:f,isRowHighlighted:p,isSelectable:m})}
163
+ ${h&&f?c.html`<div class="node-children" role="group">
164
+ ${this._renderNodes(K,t+1,y,C,!0)}
165
165
  </div>`:""}
166
166
  </div>
167
- `})}},v._nextTreeviewId=0,v.styles=c.unsafeCSS(ee),v);f([_.property({type:Object,noAccessor:!0})],u.prototype,"options",1),f([_.state()],u.prototype,"_items",2),f([_.state()],u.prototype,"_expandedIds",2),f([_.state()],u.prototype,"_searchTerm",2),f([_.state()],u.prototype,"_searchStatusMessage",2),f([_.state()],u.prototype,"_searchVisibleIds",2),f([_.state()],u.prototype,"_searchUserCollapsedIds",2),f([_.state()],u.prototype,"_searchManualExpandedIds",2),f([_.state()],u.prototype,"_flatRows",2),f([_.state()],u.prototype,"_loadedIds",2),f([_.state()],u.prototype,"_activeRowId",2),f([X("nyx-change")],u.prototype,"onChange",2);let G=u;customElements.get("nyx-treeview")||customElements.define("nyx-treeview",G),p.NyxTreeview=G,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
167
+ `})}},x._nextTreeviewId=0,x.styles=c.unsafeCSS(X),x);_([v.property({type:Object,noAccessor:!0})],u.prototype,"options",1),_([v.state()],u.prototype,"_items",2),_([v.state()],u.prototype,"_expandedIds",2),_([v.state()],u.prototype,"_searchTerm",2),_([v.state()],u.prototype,"_searchStatusMessage",2),_([v.state()],u.prototype,"_searchVisibleIds",2),_([v.state()],u.prototype,"_searchUserCollapsedIds",2),_([v.state()],u.prototype,"_searchManualExpandedIds",2),_([v.state()],u.prototype,"_flatRows",2),_([v.state()],u.prototype,"_loadedIds",2),_([v.state()],u.prototype,"_activeRowId",2),_([Q("nyx-change")],u.prototype,"onChange",2);let j=u;customElements.get("nyx-treeview")||customElements.define("nyx-treeview",j),w.NyxTreeview=j,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nyx-ds/treeview",
3
3
  "private": false,
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "type": "module",
6
6
  "main": "dist/treeview.js",
7
7
  "module": "dist/treeview.js",
@@ -39,5 +39,5 @@
39
39
  "lit": "3.2.1",
40
40
  "lit-html": "3.2.1"
41
41
  },
42
- "gitHead": "373efdd99d1fe0ad6cb8155772154031e6e75128"
42
+ "gitHead": "f568d9bb674402af90878b11881dd4abe5a965b9"
43
43
  }