treeselectjs 0.13.3 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(f,m){typeof exports=="object"&&typeof module<"u"?module.exports=m():typeof define=="function"&&define.amd?define(m):(f=typeof globalThis<"u"?globalThis:f||self,f.Treeselect=m())})(this,function(){"use strict";var Ts=Object.defineProperty;var _e=f=>{throw TypeError(f)};var As=(f,m,w)=>m in f?Ts(f,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):f[m]=w;var c=(f,m,w)=>As(f,typeof m!="symbol"?m+"":m,w),ae=(f,m,w)=>m.has(f)||_e("Cannot "+w);var n=(f,m,w)=>(ae(f,m,"read from private field"),w?w.call(f):m.get(f)),C=(f,m,w)=>m.has(f)?_e("Cannot add the same private member more than once"):m instanceof WeakSet?m.add(f):m.set(f,w),E=(f,m,w,Q)=>(ae(f,m,"write to private field"),Q?Q.call(f,w):m.set(f,w),w),a=(f,m,w)=>(ae(f,m,"access private method"),w);var H,T,G,A,h,Oe,X,He,Pe,Z,F,Ve,Be,De,Ge,Me,Re,Fe,$e,je,We,Ue,ze,Ye,qe,Ke,Xe,re,M,V,R,Y,o,J,Ze,Je,Qe,et,tt,st,ce,it,lt,nt,oe,at,rt,ct,ot,ht,dt,ut,mt,pt,he,ft,gt,de,te,ue,bt,p,g,$,q,j,N,_,I,B,d,me,pe,Ct,Et,wt,vt,kt,fe,Lt,St,xt,yt,ge,be,Ce,Ee,we,Tt,ve,At,It,Nt,_t,Ot;const f={arrowUp:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 15l-6-6-6 6"/></svg>',arrowDown:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>',arrowRight:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18l6-6-6-6"/></svg>',attention:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',clear:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg>',cross:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',check:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>',partialCheck:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line></svg>'},m=(l,e)=>{if(e.innerHTML="",typeof l=="string")e.innerHTML=l;else{const t=l.cloneNode(!0);e.appendChild(t)}},w=l=>{const e=l?{...l}:{};return Object.keys(f).forEach(t=>{e[t]||(e[t]=f[t])}),e},Q=l=>l.reduce((e,{name:t},s)=>(e+=t,s<l.length-1&&(e+=", "),e),"");class Ht{constructor({value:e,showTags:t,tagsCountText:s,clearable:i,isAlwaysOpened:r,searchable:u,placeholder:b,disabled:L,isSingleSelect:x,id:k,ariaLabel:v,iconElements:S,inputCallback:y,searchCallback:O,openCallback:P,closeCallback:D,keydownCallback:K,focusCallback:W,nameChangeCallback:ne}){C(this,h);c(this,"value");c(this,"showTags");c(this,"tagsCountText");c(this,"clearable");c(this,"isAlwaysOpened");c(this,"searchable");c(this,"placeholder");c(this,"disabled");c(this,"isSingleSelect");c(this,"id");c(this,"ariaLabel");c(this,"iconElements");c(this,"isOpened");c(this,"searchText");c(this,"srcElement");C(this,H);C(this,T);C(this,G);C(this,A);c(this,"inputCallback");c(this,"searchCallback");c(this,"openCallback");c(this,"closeCallback");c(this,"keydownCallback");c(this,"focusCallback");c(this,"nameChangeCallback");this.value=e,this.showTags=t,this.tagsCountText=s,this.searchable=u,this.placeholder=b,this.clearable=i,this.isAlwaysOpened=r,this.disabled=L,this.isSingleSelect=x,this.id=k,this.ariaLabel=v,this.iconElements=S,this.isOpened=!1,this.searchText="",E(this,H,a(this,h,De).call(this)),E(this,T,a(this,h,je).call(this)),E(this,G,a(this,h,ze).call(this)),E(this,A,null),this.inputCallback=y,this.searchCallback=O,this.openCallback=P,this.closeCallback=D,this.keydownCallback=K,this.focusCallback=W,this.nameChangeCallback=ne,this.srcElement=a(this,h,Ve).call(this,{htmlTagsSection:n(this,H),htmlEditControl:n(this,T),htmlOperators:n(this,G)}),a(this,h,Oe).call(this)}focus(){setTimeout(()=>n(this,T).focus(),0)}blur(){this.isOpened&&a(this,h,F).call(this),this.clearSearch(),n(this,T).blur()}updateValue(e){this.value=e,a(this,h,X).call(this),a(this,h,Z).call(this)}removeItem(e){this.value=this.value.filter(t=>t.id!==e),a(this,h,re).call(this),a(this,h,X).call(this),a(this,h,Z).call(this)}clear(){this.value=[],a(this,h,re).call(this),a(this,h,X).call(this),this.clearSearch()}openClose(){a(this,h,F).call(this)}clearSearch(){this.searchText="",this.searchCallback(""),a(this,h,Z).call(this)}}H=new WeakMap,T=new WeakMap,G=new WeakMap,A=new WeakMap,h=new WeakSet,Oe=function(){a(this,h,X).call(this),a(this,h,Z).call(this),a(this,h,He).call(this)},X=function(){if(n(this,H).innerHTML="",this.showTags){n(this,H).append(...a(this,h,Ge).call(this));const e=Q(this.value);this.nameChangeCallback(e)}else{const e=a(this,h,$e).call(this);n(this,H).appendChild(e),this.nameChangeCallback(e.innerText)}n(this,H).appendChild(n(this,T))},He=function(){const e=[];n(this,G).innerHTML="",this.clearable&&e.push(a(this,h,Ye).call(this)),this.isAlwaysOpened||e.push(a(this,h,Ke).call(this,this.isOpened)),e.length&&n(this,G).append(...e)},Pe=function(){if(!this.isAlwaysOpened&&n(this,A)){const e=this.isOpened?this.iconElements.arrowUp:this.iconElements.arrowDown;m(e,n(this,A))}},Z=function(){var e;(e=this.value)!=null&&e.length?(n(this,T).removeAttribute("placeholder"),this.srcElement.classList.remove("treeselect-input--value-not-selected")):(n(this,T).setAttribute("placeholder",this.placeholder),this.srcElement.classList.add("treeselect-input--value-not-selected")),this.searchable?this.srcElement.classList.remove("treeselect-input--unsearchable"):this.srcElement.classList.add("treeselect-input--unsearchable"),this.isSingleSelect?this.srcElement.classList.add("treeselect-input--is-single-select"):this.srcElement.classList.remove("treeselect-input--is-single-select"),n(this,T).value=this.searchText},F=function(){this.isOpened=!this.isOpened,a(this,h,Pe).call(this),this.isOpened?this.openCallback():this.closeCallback()},Ve=function({htmlTagsSection:e,htmlEditControl:t,htmlOperators:s}){const i=document.createElement("div");return i.classList.add("treeselect-input"),i.setAttribute("tabindex","-1"),i.addEventListener("mousedown",r=>a(this,h,Be).call(this,r)),i.addEventListener("focus",()=>this.focusCallback(),!0),e.appendChild(t),i.append(e,s),i},Be=function(e){e.stopPropagation(),this.isOpened||a(this,h,F).call(this),this.focus()},De=function(){const e=document.createElement("div");return e.classList.add("treeselect-input__tags"),e},Ge=function(){return this.value.map(e=>{const t=document.createElement("div");t.classList.add("treeselect-input__tags-element"),t.setAttribute("tabindex","-1"),t.setAttribute("tag-id",e.id.toString()),t.setAttribute("title",e.name);const s=a(this,h,Re).call(this,e.name),i=a(this,h,Fe).call(this);return t.addEventListener("mousedown",r=>a(this,h,Me).call(this,r,e.id)),t.append(s,i),t})},Me=function(e,t){e.preventDefault(),e.stopPropagation(),this.removeItem(t),this.focus()},Re=function(e){const t=document.createElement("span");return t.classList.add("treeselect-input__tags-name"),t.textContent=e,t},Fe=function(){const e=document.createElement("span");return e.classList.add("treeselect-input__tags-cross"),m(this.iconElements.cross,e),e},$e=function(){const e=document.createElement("span");if(e.classList.add("treeselect-input__tags-count"),!this.value.length)return e.textContent="",e.setAttribute("title",""),e;const t=this.value.length===1?this.value[0].name:`${this.value.length} ${this.tagsCountText}`;return e.textContent=t,e.setAttribute("title",t),e},je=function(){const e=document.createElement("input");return e.classList.add("treeselect-input__edit"),this.id&&e.setAttribute("id",this.id),(!this.searchable||this.disabled)&&e.setAttribute("readonly","readonly"),this.disabled&&e.setAttribute("tabindex","-1"),this.ariaLabel.length&&e.setAttribute("aria-label",this.ariaLabel),e.addEventListener("keydown",t=>a(this,h,We).call(this,t)),e.addEventListener("input",t=>a(this,h,Ue).call(this,t,e)),e},We=function(e){e.stopPropagation();const t=e.key;t==="Backspace"&&!this.searchText.length&&this.value.length&&!this.showTags&&this.clear(),t==="Backspace"&&!this.searchText.length&&this.value.length&&this.removeItem(this.value[this.value.length-1].id),e.code==="Space"&&(!this.searchText||!this.searchable)&&a(this,h,F).call(this),(t==="Enter"||t==="ArrowDown"||t==="ArrowUp")&&e.preventDefault(),this.keydownCallback(e),t!=="Tab"&&this.focus()},Ue=function(e,t){e.stopPropagation();const s=this.searchText,i=t.value.trim();if(s.length===0&&i.length===0){t.value="";return}if(this.searchable){const r=e.target.value;this.searchCallback(r),this.isOpened||a(this,h,F).call(this)}else t.value="";this.searchText=t.value},ze=function(){const e=document.createElement("div");return e.classList.add("treeselect-input__operators"),e},Ye=function(){const e=document.createElement("span");return e.classList.add("treeselect-input__clear"),e.setAttribute("tabindex","-1"),m(this.iconElements.clear,e),e.addEventListener("mousedown",t=>a(this,h,qe).call(this,t)),e},qe=function(e){e.preventDefault(),e.stopPropagation(),(this.searchText.length||this.value.length)&&this.clear(),this.focus()},Ke=function(e){E(this,A,document.createElement("span")),n(this,A).classList.add("treeselect-input__arrow");const t=e?this.iconElements.arrowUp:this.iconElements.arrowDown;return m(t,n(this,A)),n(this,A).addEventListener("mousedown",s=>a(this,h,Xe).call(this,s)),n(this,A)},Xe=function(e){e.stopPropagation(),e.preventDefault(),this.focus(),a(this,h,F).call(this)},re=function(){this.inputCallback(this.value)};const ke=({newValue:l,optionsTreeMap:e,isSingleSelect:t,isIndependentNodes:s})=>{Dt(e);const i=l.map(u=>e.get(u)??null).filter(u=>u!==null&&!u.disabled),[r]=i;if(t&&i.length&&r){r.checked=!0;return}i.forEach(u=>{u.checked=!0;const b=se({option:u,optionsTreeMap:e,isIndependentNodes:s});u.checked=b})},se=({option:{id:l,checked:e},optionsTreeMap:t,isIndependentNodes:s})=>{const i=t.get(l)??null;if(i===null)return!1;if(s)return i.checked=!i.disabled&&e,i.checked;const r=Le({checked:e,currentOption:i,optionsTreeMap:t});return Se({childOption:i,optionsTreeMap:t}),r},Le=({checked:l,currentOption:e,optionsTreeMap:t})=>{if(!e.isGroup)return e.checked=!e.disabled&&l,e.isPartialChecked=!1,e.checked;const s=U({id:e.id,optionsTreeMap:t});return!l||e.disabled||e.isPartialChecked?(e.checked=!1,e.isPartialChecked=!1,ie({option:e,children:s,optionsTreeMap:t}),e.checked):xe({children:s,optionsTreeMap:t})?ye(s)?(e.checked=!1,e.isPartialChecked=!1,e.disabled=!0,e.checked):(e.checked=!1,e.isPartialChecked=!0,s.forEach(b=>{Le({checked:l,currentOption:b,optionsTreeMap:t})}),e.checked):(e.checked=!0,e.isPartialChecked=!1,ie({option:e,children:s,optionsTreeMap:t}),e.checked)},Se=({childOption:l,optionsTreeMap:e})=>{const t=e.get(l.childOf)??null;t!==null&&(Pt({parentOption:t,optionsTreeMap:e}),Se({childOption:t,optionsTreeMap:e}))},Pt=({parentOption:l,optionsTreeMap:e})=>{const t=U({id:l.id,optionsTreeMap:e});if(ye(t)){l.checked=!1,l.isPartialChecked=!1,l.disabled=!0;return}if(Vt(t)){l.checked=!0,l.isPartialChecked=!1;return}if(Bt(t)){l.checked=!1,l.isPartialChecked=!0;return}l.checked=!1,l.isPartialChecked=!1},ie=({option:{checked:l,disabled:e},children:t,optionsTreeMap:s})=>{t.forEach(i=>{i.disabled=e||i.disabled,i.checked=l&&!i.disabled,i.isPartialChecked=!1;const r=U({id:i.id,optionsTreeMap:s});ie({option:{checked:l,disabled:e},children:r,optionsTreeMap:s})})},xe=({children:l,optionsTreeMap:e})=>l.some(s=>s.disabled)?!0:l.some(s=>{if(!s.isGroup)return!1;const i=U({id:s.id,optionsTreeMap:e});return xe({children:i,optionsTreeMap:e})}),ye=l=>l.every(e=>!!e.disabled),Vt=l=>l.every(e=>e.checked),Bt=l=>l.some(e=>e.checked||e.isPartialChecked),Dt=l=>{l.forEach(e=>{e.checked=!1,e.isPartialChecked=!1})},Gt=({options:l,openLevel:e,isIndependentNodes:t})=>{const s={level:0,groupId:""},i=new Map;return Te({optionsTreeMap:i,options:l,openLevel:e,groupId:s.groupId,level:s.level}),Ft({optionsTreeMap:i,isIndependentNodes:t}),i},Te=({optionsTreeMap:l,options:e,openLevel:t,groupId:s,level:i})=>{e.forEach(r=>{var v,S;const u=(((v=r.children)==null?void 0:v.length)??0)>0,b=i>=t&&u,L=i>t,x=((S=r.children)==null?void 0:S.map(y=>y.value))??[],k=r.value;l.has(k)&&console.error(`Validation: You have duplicated option value: ${k}! You should use unique values. Duplicates will lead to unexpected behavior.`),l.set(k,{id:k,name:r.name,childOf:s,isGroup:u,checked:!1,isPartialChecked:!1,level:i,isClosed:b,hidden:L,disabled:r.disabled??!1,isGroupSelectable:!u||(r.isGroupSelectable??!0),children:x,checkboxHtmlElement:null,itemHtmlElement:null,arrowItemHtmlElement:null,checkboxIconHtmlElement:null}),u&&Te({optionsTreeMap:l,options:r.children,openLevel:t,groupId:k,level:i+1})})},Mt=(l,e)=>l===null?null:e.get(l)??e.get(parseInt(l))??null,U=({id:l,optionsTreeMap:e})=>{const t=e.get(l)??null;return t===null?[]:t.children.reduce((s,i)=>{const r=e.get(i)??null;return r!==null&&s.push(r),s},[])},Rt=l=>{const e=[],t=[],s=[];l.forEach(r=>{r.checked&&(s.push(r),r.isGroup?t.push(r):e.push(r))});const i=s.filter(r=>!t.some(({id:u})=>u===r.childOf));return{ungroupedNodes:e,groupedNodes:i,allNodes:s}},Ft=({optionsTreeMap:l,isIndependentNodes:e})=>{const t=[];l.forEach(s=>{s.disabled&&t.push(s)}),t.forEach(({id:s})=>se({option:{id:s,checked:!1},optionsTreeMap:l,isIndependentNodes:e}))},z=(l,{id:e,isClosed:t})=>{U({id:e,optionsTreeMap:l}).forEach(i=>{i.hidden=t??!1,i.isGroup&&!i.isClosed&&z(l,{id:i.id,isClosed:t})})},$t=(l,e)=>{if(e){jt(l);return}l.forEach(t=>{t.checked&&le(t.childOf,l),t.isGroup&&!t.disabled&&(t.checked||t.isPartialChecked)&&(t.isClosed=!1,z(l,t))})},jt=l=>{let e=null;for(const[t,s]of l)if(s.checked&&!s.disabled){e=s;break}e&&(e.isGroup&&(e.isClosed=!1,z(l,e)),le(e.childOf,l))},le=(l,e)=>{const t=e.get(l)??null;t&&(t.isClosed=!1,z(e,t),le(t.childOf,e))},Wt=(l,e)=>{l.forEach(t=>{const s=t.name.toLowerCase().includes(e.toLowerCase());s&&(t.isGroup&&(t.isClosed=!0),t.childOf&&Ae(t.childOf,l)),t.hidden=!s})},Ae=(l,e)=>{const t=e.get(l)??null;t&&(t.hidden=!1,t.isClosed=!1,Ae(t.childOf,e))},Ut=({optionsTreeMap:l,beforeSearchStateMap:e})=>{l.forEach(t=>{const s=e.get(t.id);s&&(t.hidden=s.hidden,t.isClosed=s.isClosed)}),e.clear()},zt=({optionsTreeMap:l,beforeSearchStateMap:e})=>{e.clear(),l.forEach(t=>{e.set(t.id,{hidden:t.hidden,isClosed:t.isClosed})})},Yt=l=>new IntersectionObserver(e=>{e.forEach(t=>{t.target.classList.toggle("treeselect-list__item--scroll-not-visible",!t.isIntersecting)})},{root:l,threshold:.5}),qt=({optionsTreeMap:l,emptyListHtmlElement:e,iconElements:t,previousSingleSelectedValue:s,rtl:i})=>{l.forEach(r=>{const u=r.checkboxHtmlElement;u&&(u.checked=r.checked),Jt({option:r,previousSingleSelectedValue:s}),Qt(r),es(r),ts({option:r,iconElements:t}),ss(r),Kt({option:r,optionsTreeMap:l,rtl:i}),is({option:r,iconElements:t}),ls(r)}),Xt({optionsTreeMap:l,emptyListHtmlElement:e})},Kt=({option:l,optionsTreeMap:e,rtl:t})=>{const s=l.level===0,i=20,r=5;let u="0";if(s){let L=!1;for(const[k,v]of e)if(v.isGroup&&v.level===l.level){L=!0;break}const x=!l.isGroup&&L?`${i}px`:`${r}px`;u=l.isGroup?"0":x}else u=l.isGroup?`${l.level*i}px`:`${l.level*i+i}px`;const b=l.itemHtmlElement;b&&(t?b.style.paddingRight=u:b.style.paddingLeft=u,b.setAttribute("level",l.level.toString()),b.setAttribute("group",l.isGroup.toString()))},Xt=({optionsTreeMap:l,emptyListHtmlElement:e})=>{let t=!1;for(const[s,i]of l)if(!i.hidden){t=!0;break}e==null||e.classList.toggle("treeselect-list__empty--hidden",t)},Zt=(l,e)=>{e&&Object.keys(e).forEach(t=>{const s=e[t];typeof s=="string"&&l.setAttribute(t,s)})},Jt=({option:l,previousSingleSelectedValue:e})=>{const t=l.itemHtmlElement;t==null||t.classList.toggle("treeselect-list__item--checked",l.checked);const s=Array.isArray(e)&&e[0]===l.id&&!l.disabled;t==null||t.classList.toggle("treeselect-list__item--single-selected",s)},Qt=l=>{const e=l.itemHtmlElement;e==null||e.classList.toggle("treeselect-list__item--partial-checked",l.isPartialChecked)},es=l=>{const e=l.itemHtmlElement;e==null||e.classList.toggle("treeselect-list__item--disabled",l.disabled)},ts=({option:l,iconElements:e})=>{const t=l.arrowItemHtmlElement;if(l.isGroup&&t){const s=l.isClosed?e.arrowRight:e.arrowDown;m(s,t);const i=l.itemHtmlElement;i==null||i.classList.toggle("treeselect-list__item--closed",l.isClosed)}},ss=l=>{const e=l.itemHtmlElement;e==null||e.classList.toggle("treeselect-list__item--hidden",l.hidden)},is=({option:l,iconElements:e})=>{const t=l.checkboxIconHtmlElement;t&&(l.checked?m(e.check,t):l.isPartialChecked?m(e.partialCheck,t):t.innerHTML="")},ls=l=>{const e=l.itemHtmlElement;e==null||e.classList.toggle("treeselect-list__item--non-selectable-group",!l.isGroupSelectable)},ns=({newValue:l,optionsTreeMap:e,isSingleSelect:t,expandSelected:s,isFirstValueUpdate:i,isIndependentNodes:r})=>{ke({newValue:l,optionsTreeMap:e,isSingleSelect:t,isIndependentNodes:r}),i&&s&&$t(e,t)};class as{constructor({options:e,value:t,openLevel:s,listSlotHtmlComponent:i,tagsSortFn:r,emptyText:u,isSingleSelect:b,iconElements:L,showCount:x,disabledBranchNode:k,expandSelected:v,isIndependentNodes:S,rtl:y,listClassName:O,isBoostedRendering:P,inputCallback:D,arrowClickCallback:K,mouseupCallback:W}){C(this,o);c(this,"options");c(this,"value");c(this,"openLevel");c(this,"listSlotHtmlComponent");c(this,"tagsSortFn");c(this,"emptyText");c(this,"isSingleSelect");c(this,"showCount");c(this,"disabledBranchNode");c(this,"expandSelected");c(this,"isIndependentNodes");c(this,"rtl");c(this,"listClassName");c(this,"isBoostedRendering");c(this,"iconElements");c(this,"searchText");c(this,"intersectionItemsObserver");c(this,"selectedNodes");c(this,"optionsTreeMap");c(this,"beforeSearchStateMap");c(this,"emptyListHtmlElement");c(this,"srcElement");c(this,"inputCallback");c(this,"arrowClickCallback");c(this,"mouseupCallback");C(this,M,null);C(this,V,!0);C(this,R,[]);C(this,Y,!0);this.options=e,this.value=t,this.openLevel=s??0,this.listSlotHtmlComponent=i??null,this.tagsSortFn=r??null,this.emptyText=u??"No results found...",this.isSingleSelect=b??!1,this.showCount=x??!1,this.disabledBranchNode=k??!1,this.expandSelected=v??!1,this.isIndependentNodes=S??!1,this.rtl=y??!1,this.listClassName=O??"",this.isBoostedRendering=P,this.iconElements=L,this.searchText="",this.intersectionItemsObserver=null,this.selectedNodes={nodes:[],groupedNodes:[],allNodes:[]},this.optionsTreeMap=Gt({options:this.options,openLevel:this.openLevel,isIndependentNodes:this.isIndependentNodes}),this.beforeSearchStateMap=new Map,this.emptyListHtmlElement=null,this.srcElement=a(this,o,Qe).call(this),this.inputCallback=D,this.arrowClickCallback=K,this.mouseupCallback=W}updateValue(e){this.value=e,E(this,R,this.isSingleSelect?this.value:[]),ns({newValue:e,optionsTreeMap:this.optionsTreeMap,isSingleSelect:this.isSingleSelect,expandSelected:this.expandSelected,isFirstValueUpdate:n(this,Y),isIndependentNodes:this.isIndependentNodes}),a(this,o,J).call(this),E(this,Y,!1),a(this,o,ue).call(this)}updateSearchValue(e){if(e===this.searchText)return;const t=this.searchText===""&&e!=="";this.searchText=e,t&&zt({beforeSearchStateMap:this.beforeSearchStateMap,optionsTreeMap:this.optionsTreeMap}),this.searchText===""&&Ut({beforeSearchStateMap:this.beforeSearchStateMap,optionsTreeMap:this.optionsTreeMap}),this.searchText&&Wt(this.optionsTreeMap,e),a(this,o,J).call(this),this.focusFirstListElement()}callKeyAction(e){E(this,V,!1);const t=this.srcElement.querySelector(".treeselect-list__item--focused");if(t==null?void 0:t.classList.contains("treeselect-list__item--hidden"))return;const i=e.key;i==="Enter"&&t&&t.dispatchEvent(new Event("mousedown")),(i==="ArrowLeft"||i==="ArrowRight")&&a(this,o,Ze).call(this,t,e),(i==="ArrowDown"||i==="ArrowUp")&&a(this,o,Je).call(this,t,i)}focusFirstListElement(){const e="treeselect-list__item--focused",t=this.srcElement.querySelector(`.${e}`),s=a(this,o,he).call(this);if(!s.length)return;t&&t.classList.remove(e);const[i]=s;i.classList.add(e)}isLastFocusedElementExist(){return!!n(this,M)}destroy(){this.intersectionItemsObserver&&this.intersectionItemsObserver.disconnect()}}M=new WeakMap,V=new WeakMap,R=new WeakMap,Y=new WeakMap,o=new WeakSet,J=function(){qt({optionsTreeMap:this.optionsTreeMap,emptyListHtmlElement:this.emptyListHtmlElement,iconElements:this.iconElements,previousSingleSelectedValue:n(this,R),rtl:this.rtl})},Ze=function(e,t){if(!e)return;const s=t.key,r=e.querySelector(".treeselect-list__item-checkbox").getAttribute("input-id"),u=Mt(r,this.optionsTreeMap),b=u.arrowItemHtmlElement;s==="ArrowLeft"&&!u.isClosed&&u.isGroup&&(b.dispatchEvent(new Event("mousedown")),t.preventDefault()),s==="ArrowRight"&&u.isClosed&&u.isGroup&&(b.dispatchEvent(new Event("mousedown")),t.preventDefault())},Je=function(e,t){var r;const s=a(this,o,he).call(this);if(!s.length)return;const i="treeselect-list__item--focused";if(e){const u=s.findIndex(P=>P.classList.contains(i));s[u].classList.remove(i);const L=t==="ArrowDown"?u+1:u-1,x=t==="ArrowDown"?0:s.length-1,k=!s[L],v=s[L]??s[x];v.classList.add(i);const S=this.srcElement.getBoundingClientRect(),y=v.getBoundingClientRect();if(k&&t==="ArrowDown"){this.srcElement.scroll(0,0);return}if(k&&t==="ArrowUp"){this.srcElement.scroll(0,this.srcElement.scrollHeight);return}const O=((r=this.listSlotHtmlComponent)==null?void 0:r.clientHeight)??0;if(S.y+S.height<y.y+y.height+O){this.srcElement.scroll(0,this.srcElement.scrollTop+y.height);return}if(S.y>y.y){this.srcElement.scroll(0,this.srcElement.scrollTop-y.height);return}}else{const[u]=s;u.classList.add(i)}},Qe=function(){const e=a(this,o,et).call(this),t=a(this,o,ce).call(this,this.options);e.append(...t);const s=a(this,o,lt).call(this);e.append(s);const i=a(this,o,it).call(this);return i&&e.append(i),e},et=function(){const e=document.createElement("div");if(e.classList.add("treeselect-list"),this.listClassName.length>0){const t=this.listClassName.split(" ");e.classList.add(...t)}return this.isSingleSelect&&e.classList.add("treeselect-list--single-select"),this.disabledBranchNode&&e.classList.add("treeselect-list--disabled-branch-node"),e.addEventListener("mouseout",t=>a(this,o,tt).call(this,t)),e.addEventListener("mousemove",()=>a(this,o,st).call(this)),e.addEventListener("mouseup",()=>this.mouseupCallback(),!0),this.isBoostedRendering&&(this.intersectionItemsObserver=Yt(e)),e},tt=function(e){e.stopPropagation(),n(this,M)&&n(this,V)&&n(this,M).classList.add("treeselect-list__item--focused")},st=function(){E(this,V,!0)},ce=function(e){return e.reduce((t,s)=>{var r;if((r=s.children)!=null&&r.length){const u=a(this,o,nt).call(this,s),b=a(this,o,ce).call(this,s.children);return u.append(...b),t.push(u),t}const i=a(this,o,oe).call(this,s,!1);return t.push(i),t},[])},it=function(){if(!this.listSlotHtmlComponent)return null;const e=document.createElement("div");return e.classList.add("treeselect-list__slot"),e.appendChild(this.listSlotHtmlComponent),e},lt=function(){const e=document.createElement("div");e.classList.add("treeselect-list__empty"),e.setAttribute("title",this.emptyText);const t=document.createElement("span");t.classList.add("treeselect-list__empty-icon"),m(this.iconElements.attention,t);const s=document.createElement("span");return s.classList.add("treeselect-list__empty-text"),s.textContent=this.emptyText,e.append(t,s),this.emptyListHtmlElement=e,e},nt=function(e){const t=document.createElement("div");t.setAttribute("group-container-id",e.value.toString()),t.classList.add("treeselect-list__group-container");const s=a(this,o,oe).call(this,e,!0);return t.appendChild(s),t},oe=function(e,t){const s=a(this,o,at).call(this,e);if(t){const u=a(this,o,ht).call(this,e);s.appendChild(u),s.classList.add("treeselect-list__item--group")}const i=a(this,o,ut).call(this,e),r=a(this,o,mt).call(this,e,t);return s.append(i,r),s},at=function(e){const t=document.createElement("div");t.setAttribute("tabindex","-1"),t.setAttribute("title",e.name),Zt(t,e.htmlAttr),t.classList.add("treeselect-list__item"),t.addEventListener("mouseover",()=>a(this,o,rt).call(this,t),!0),t.addEventListener("mouseout",()=>a(this,o,ct).call(this,t),!0),t.addEventListener("mousedown",i=>a(this,o,ot).call(this,i,e)),this.intersectionItemsObserver&&this.intersectionItemsObserver.observe(t);const s=this.optionsTreeMap.get(e.value);return s&&(s.itemHtmlElement=t),t},rt=function(e){n(this,V)&&a(this,o,de).call(this,!0,e)},ct=function(e){n(this,V)&&(a(this,o,de).call(this,!1,e),E(this,M,e))},ot=function(e,t){e.preventDefault(),e.stopPropagation();const s=this.optionsTreeMap.get(t.value)??null;if(s!=null&&s.disabled)return;const i=s==null?void 0:s.checkboxHtmlElement;i&&(i.checked=!i.checked,a(this,o,ft).call(this,i,t))},ht=function(e){const t=document.createElement("span");t.setAttribute("tabindex","-1"),t.classList.add("treeselect-list__item-icon"),m(this.iconElements.arrowDown,t),t.addEventListener("mousedown",i=>a(this,o,dt).call(this,i,e));const s=this.optionsTreeMap.get(e.value);return s&&(s.arrowItemHtmlElement=t),t},dt=function(e,t){e.preventDefault(),e.stopPropagation(),a(this,o,gt).call(this,t)},ut=function(e){const t=document.createElement("div");t.classList.add("treeselect-list__item-checkbox-container");const s=document.createElement("span");s.classList.add("treeselect-list__item-checkbox-icon"),s.innerHTML="";const i=document.createElement("input");i.setAttribute("tabindex","-1"),i.setAttribute("type","checkbox"),i.setAttribute("input-id",e.value.toString()),i.classList.add("treeselect-list__item-checkbox"),t.append(s,i);const r=this.optionsTreeMap.get(e.value);return r&&(r.checkboxHtmlElement=i,r.checkboxIconHtmlElement=s),t},mt=function(e,t){const s=document.createElement("label");if(s.textContent=e.name,s.classList.add("treeselect-list__item-label"),t&&this.showCount){const i=a(this,o,pt).call(this,e);s.appendChild(i)}return s},pt=function(e){var i;const t=document.createElement("span"),s=((i=this.optionsTreeMap.get(e.value))==null?void 0:i.children)??[];return t.textContent=`(${s.length})`,t.classList.add("treeselect-list__item-label-counter"),t},he=function(){const e=[];return this.optionsTreeMap.forEach(t=>{!t.hidden&&t.itemHtmlElement&&e.push(t.itemHtmlElement)}),e},ft=function(e,t){const s=this.optionsTreeMap.get(t.value)??null;if(s===null)return;const i=s.isGroupSelectable??!0;if(s.isGroup&&(this.disabledBranchNode||!i)){const r=s.arrowItemHtmlElement;r==null||r.dispatchEvent(new Event("mousedown"));return}if(this.isSingleSelect){const[r]=n(this,R);if(s.id===r)return;E(this,R,[s.id]),ke({newValue:[s.id],optionsTreeMap:this.optionsTreeMap,isSingleSelect:this.isSingleSelect,isIndependentNodes:this.isIndependentNodes})}else{s.checked=e.checked;const r=se({option:s,optionsTreeMap:this.optionsTreeMap,isIndependentNodes:this.isIndependentNodes});e.checked=r}a(this,o,J).call(this),a(this,o,bt).call(this)},gt=function(e){const t=this.optionsTreeMap.get(e.value)??null;t!==null&&(t.isClosed=!t.isClosed,z(this.optionsTreeMap,t),a(this,o,J).call(this),this.arrowClickCallback(t.id,t.isClosed))},de=function(e,t){const s="treeselect-list__item--focused";if(e){const i=Array.from(this.srcElement.querySelectorAll(`.${s}`));i.length&&i.forEach(r=>r.classList.remove(s)),t.classList.add(s)}else t.classList.remove(s)},te=function(e){return this.tagsSortFn===null?e:[...e].sort((t,s)=>this.tagsSortFn({value:t.id,name:t.name},{value:s.id,name:s.name}))},ue=function(){const{ungroupedNodes:e,groupedNodes:t,allNodes:s}=Rt(this.optionsTreeMap);this.selectedNodes={nodes:a(this,o,te).call(this,e),groupedNodes:a(this,o,te).call(this,t),allNodes:a(this,o,te).call(this,s)}},bt=function(){a(this,o,ue).call(this),this.inputCallback(this.selectedNodes),this.value=this.selectedNodes.nodes.map(e=>e.id)};const Ie=({parentHtmlContainer:l,staticList:e,appendToBody:t,isSingleSelect:s,value:i,direction:r})=>{l||console.error("Validation: parentHtmlContainer prop is required!"),e&&t&&console.error("Validation: You should set staticList to false if you use appendToBody!"),s&&Array.isArray(i)&&console.error("Validation: if you use isSingleSelect prop, you should pass a single value!"),!s&&!Array.isArray(i)&&console.error("Validation: you should pass an array as a value!"),r&&r!=="auto"&&r!=="bottom"&&r!=="top"&&console.error("Validation: you should pass (auto | top | bottom | undefined) as a value for the direction prop!")},ee=l=>l.map(e=>e.id),rs=l=>l==null?[]:Array.isArray(l)?l:[l],cs=(l,e)=>{if(e){const[t]=l;return t??null}return l};class os{constructor({parentHtmlContainer:e,value:t,options:s,openLevel:i,appendToBody:r,alwaysOpen:u,showTags:b,tagsCountText:L,tagsSortFn:x,clearable:k,searchable:v,placeholder:S,grouped:y,isGroupedValue:O,listSlotHtmlComponent:P,disabled:D,emptyText:K,staticList:W,id:ne,ariaLabel:hs,isSingleSelect:Ne,showCount:ds,disabledBranchNode:us,direction:ms,expandSelected:ps,saveScrollPosition:fs,isIndependentNodes:gs,rtl:bs,listClassName:Cs,isBoostedRendering:Es,iconElements:ws,inputCallback:vs,openCallback:ks,closeCallback:Ls,nameChangeCallback:Ss,searchCallback:xs,openCloseGroupCallback:ys}){C(this,d);c(this,"parentHtmlContainer");c(this,"value");c(this,"options");c(this,"openLevel");c(this,"appendToBody");c(this,"alwaysOpen");c(this,"showTags");c(this,"tagsCountText");c(this,"tagsSortFn");c(this,"clearable");c(this,"searchable");c(this,"placeholder");c(this,"grouped");c(this,"isGroupedValue");c(this,"listSlotHtmlComponent");c(this,"disabled");c(this,"emptyText");c(this,"staticList");c(this,"id");c(this,"ariaLabel");c(this,"isSingleSelect");c(this,"showCount");c(this,"disabledBranchNode");c(this,"direction");c(this,"expandSelected");c(this,"saveScrollPosition");c(this,"isIndependentNodes");c(this,"rtl");c(this,"listClassName");c(this,"isBoostedRendering");c(this,"iconElements");c(this,"inputCallback");c(this,"openCallback");c(this,"closeCallback");c(this,"nameChangeCallback");c(this,"searchCallback");c(this,"openCloseGroupCallback");c(this,"ungroupedValue");c(this,"groupedValue");c(this,"allValue");c(this,"isListOpened");c(this,"selectedName");c(this,"srcElement");C(this,p,null);C(this,g,null);C(this,$,null);C(this,q,0);C(this,j,0);C(this,N,null);C(this,_,null);C(this,I,null);C(this,B,null);Ie({parentHtmlContainer:e,value:t,staticList:W,appendToBody:r,isSingleSelect:Ne}),this.parentHtmlContainer=e,this.value=[],this.options=s??[],this.openLevel=i??0,this.appendToBody=r??!1,this.alwaysOpen=!!(u&&!D),this.showTags=b??!0,this.tagsCountText=L??"elements selected",this.tagsSortFn=x??null,this.clearable=k??!0,this.searchable=v??!0,this.placeholder=S??"Search...",this.grouped=y??!0,this.isGroupedValue=O??!1,this.listSlotHtmlComponent=P??null,this.disabled=D??!1,this.emptyText=K??"No results found...",this.staticList=!!(W&&!this.appendToBody),this.id=ne??"",this.ariaLabel=hs??"",this.isSingleSelect=Ne??!1,this.showCount=ds??!1,this.disabledBranchNode=us??!1,this.direction=ms??"auto",this.expandSelected=ps??!1,this.saveScrollPosition=fs??!0,this.isIndependentNodes=gs??!1,this.rtl=bs??!1,this.listClassName=Cs??"",this.isBoostedRendering=Es??!1,this.iconElements=w(ws),this.inputCallback=vs,this.openCallback=ks,this.closeCallback=Ls,this.nameChangeCallback=Ss,this.searchCallback=xs,this.openCloseGroupCallback=ys,this.ungroupedValue=[],this.groupedValue=[],this.allValue=[],this.isListOpened=!1,this.selectedName="",this.srcElement=null,a(this,d,me).call(this,t)}mount(){Ie({parentHtmlContainer:this.parentHtmlContainer,value:this.value,staticList:this.staticList,appendToBody:this.appendToBody,isSingleSelect:this.isSingleSelect}),this.iconElements=w(this.iconElements),a(this,d,me).call(this,this.value)}updateValue(e){const t=rs(e),s=n(this,p);s&&(s.updateValue(t),a(this,d,fe).call(this,s==null?void 0:s.selectedNodes))}destroy(){var e;this.srcElement&&(a(this,d,ge).call(this),this.srcElement.innerHTML="",this.srcElement=null,a(this,d,we).call(this,!0),(e=n(this,p))==null||e.destroy())}focus(){n(this,g)&&n(this,g).focus()}toggleOpenClose(){n(this,g)&&(n(this,g).openClose(),n(this,g).focus())}scrollWindowHandler(){this.updateListPosition()}focusWindowHandler(e){var i,r;let t=e.target;t!=null&&t.shadowRoot&&e.composedPath().length>0&&(t=e.composedPath()[0]),((i=this.srcElement)==null?void 0:i.contains(t))||((r=n(this,p))==null?void 0:r.srcElement.contains(t))||this.blurWindowHandler()}blurWindowHandler(){var e;(e=n(this,g))==null||e.blur(),a(this,d,we).call(this,!1),a(this,d,Ce).call(this,!1)}updateListPosition(){var O;const e=this.srcElement,t=(O=n(this,p))==null?void 0:O.srcElement;if(!e||!t)return;if(this.staticList){t.setAttribute("direction","bottom"),a(this,d,be).call(this,!1,this.appendToBody);return}const{height:s}=t.getBoundingClientRect(),{x:i,y:r,height:u,width:b}=e.getBoundingClientRect(),L=window.innerHeight,x=r,k=L-r-u;let v=x>k&&x>=s&&k<s;if(this.direction!=="auto"&&(v=this.direction==="top"),this.appendToBody){(t.style.top!=="0px"||t.style.left!=="0px")&&(t.style.top="0px",t.style.left="0px");const P=i+window.scrollX,D=v?r+window.scrollY-s:r+window.scrollY+u;t.style.transform=`translate(${P}px,${D}px)`,t.style.width=`${b}px`}const S=v?"top":"bottom";t.getAttribute("direction")!==S&&(t.setAttribute("direction",S),a(this,d,be).call(this,v,this.appendToBody))}}return p=new WeakMap,g=new WeakMap,$=new WeakMap,q=new WeakMap,j=new WeakMap,N=new WeakMap,_=new WeakMap,I=new WeakMap,B=new WeakMap,d=new WeakSet,me=function(e){var r;this.destroy();const{container:t,list:s,input:i}=a(this,d,Ct).call(this);this.srcElement=t,E(this,p,s),E(this,g,i),E(this,N,this.scrollWindowHandler.bind(this)),E(this,_,this.scrollWindowHandler.bind(this)),E(this,I,this.focusWindowHandler.bind(this)),E(this,B,this.blurWindowHandler.bind(this)),this.alwaysOpen&&((r=n(this,g))==null||r.openClose()),this.disabled?this.srcElement.classList.add("treeselect--disabled"):this.srcElement.classList.remove("treeselect--disabled"),this.updateValue(e??this.value)},pe=function({groupedNodes:e,nodes:t,allNodes:s}){this.ungroupedValue=t?ee(t):[],this.groupedValue=e?ee(e):[],this.allValue=s?ee(s):[];let i=[];this.isIndependentNodes||this.isSingleSelect?i=this.allValue:this.isGroupedValue?i=this.groupedValue:i=this.ungroupedValue,this.value=cs(i,this.isSingleSelect)},Ct=function(){const e=this.parentHtmlContainer;e.classList.add("treeselect");const t=new as({value:[],options:this.options,openLevel:this.openLevel,listSlotHtmlComponent:this.listSlotHtmlComponent,tagsSortFn:this.tagsSortFn,emptyText:this.emptyText,isSingleSelect:this.isSingleSelect,showCount:this.showCount,disabledBranchNode:this.disabledBranchNode,expandSelected:this.expandSelected,isIndependentNodes:this.isIndependentNodes,rtl:this.rtl,listClassName:this.listClassName,isBoostedRendering:this.isBoostedRendering,iconElements:this.iconElements,inputCallback:i=>a(this,d,Lt).call(this,i),arrowClickCallback:(i,r)=>a(this,d,St).call(this,i,r),mouseupCallback:()=>{var i;return(i=n(this,g))==null?void 0:i.focus()}}),s=new Ht({value:[],showTags:this.showTags,tagsCountText:this.tagsCountText,clearable:this.clearable,isAlwaysOpened:this.alwaysOpen,searchable:this.searchable,placeholder:this.placeholder,disabled:this.disabled,isSingleSelect:this.isSingleSelect,id:this.id,ariaLabel:this.ariaLabel,iconElements:this.iconElements,inputCallback:i=>a(this,d,Et).call(this,i),searchCallback:i=>a(this,d,vt).call(this,i),openCallback:()=>a(this,d,yt).call(this),closeCallback:()=>a(this,d,ge).call(this),keydownCallback:i=>a(this,d,wt).call(this,i),focusCallback:()=>a(this,d,kt).call(this),nameChangeCallback:i=>a(this,d,xt).call(this,i)});return this.rtl&&(e.setAttribute("dir","rtl"),t.srcElement.setAttribute("dir","rtl")),this.appendToBody&&E(this,$,new ResizeObserver(()=>this.updateListPosition())),e.append(s.srcElement),{container:e,list:t,input:s}},Et=function(e){var i,r;const t=ee(e);(i=n(this,p))==null||i.updateValue(t);const s=((r=n(this,p))==null?void 0:r.selectedNodes)??{};a(this,d,pe).call(this,s),a(this,d,ve).call(this)},wt=function(e){var t;this.isListOpened&&((t=n(this,p))==null||t.callKeyAction(e))},vt=function(e){n(this,j)&&clearTimeout(n(this,j)),E(this,j,window.setTimeout(()=>{var t;(t=n(this,p))==null||t.updateSearchValue(e),this.updateListPosition()},350)),a(this,d,_t).call(this,e)},kt=function(){a(this,d,Ce).call(this,!0),n(this,I)&&n(this,I)&&n(this,B)&&(document.addEventListener("mousedown",n(this,I),!0),document.addEventListener("focus",n(this,I),!0),window.addEventListener("blur",n(this,B),{capture:!1}))},fe=function(e){var s;if(!e)return;let t=[];this.isIndependentNodes||this.isSingleSelect?t=e.allNodes:this.grouped?t=e.groupedNodes:t=e.nodes,(s=n(this,g))==null||s.updateValue(t),a(this,d,pe).call(this,e)},Lt=function(e){var t,s,i;a(this,d,fe).call(this,e),this.isSingleSelect&&!this.alwaysOpen&&((t=n(this,g))==null||t.openClose(),(s=n(this,g))==null||s.clearSearch()),(i=n(this,g))==null||i.focus(),a(this,d,ve).call(this)},St=function(e,t){var s;(s=n(this,g))==null||s.focus(),this.updateListPosition(),a(this,d,Ot).call(this,e,t)},xt=function(e){this.selectedName!==e&&(this.selectedName=e,a(this,d,At).call(this))},yt=function(){var e;this.isListOpened=!0,n(this,N)&&n(this,_)&&(window.addEventListener("scroll",n(this,N),!0),window.addEventListener("resize",n(this,_))),!(!n(this,p)||!this.srcElement)&&(this.appendToBody?(document.body.appendChild(n(this,p).srcElement),(e=n(this,$))==null||e.observe(this.srcElement)):this.srcElement.appendChild(n(this,p).srcElement),this.updateListPosition(),a(this,d,Ee).call(this,!0),a(this,d,Tt).call(this),a(this,d,It).call(this))},ge=function(){var t;this.alwaysOpen||(this.isListOpened=!1,n(this,N)&&n(this,_)&&(window.removeEventListener("scroll",n(this,N),!0),window.removeEventListener("resize",n(this,_))),!n(this,p)||!this.srcElement)||!(this.appendToBody?document.body.contains(n(this,p).srcElement):this.srcElement.contains(n(this,p).srcElement))||(E(this,q,n(this,p).srcElement.scrollTop),this.appendToBody?(document.body.removeChild(n(this,p).srcElement),(t=n(this,$))==null||t.disconnect()):this.srcElement.removeChild(n(this,p).srcElement),a(this,d,Ee).call(this,!1),a(this,d,Nt).call(this))},be=function(e,t){if(!n(this,p)||!n(this,g))return;const s=t?"treeselect-list--top-to-body":"treeselect-list--top",i=t?"treeselect-list--bottom-to-body":"treeselect-list--bottom";e?(n(this,p).srcElement.classList.add(s),n(this,p).srcElement.classList.remove(i),n(this,g).srcElement.classList.add("treeselect-input--top"),n(this,g).srcElement.classList.remove("treeselect-input--bottom")):(n(this,p).srcElement.classList.remove(s),n(this,p).srcElement.classList.add(i),n(this,g).srcElement.classList.remove("treeselect-input--top"),n(this,g).srcElement.classList.add("treeselect-input--bottom"))},Ce=function(e){!n(this,g)||!n(this,p)||(e?(n(this,g).srcElement.classList.add("treeselect-input--focused"),n(this,p).srcElement.classList.add("treeselect-list--focused")):(n(this,g).srcElement.classList.remove("treeselect-input--focused"),n(this,p).srcElement.classList.remove("treeselect-list--focused")))},Ee=function(e){var t,s,i,r;e?(t=n(this,g))==null||t.srcElement.classList.add("treeselect-input--opened"):(s=n(this,g))==null||s.srcElement.classList.remove("treeselect-input--opened"),this.staticList?(i=n(this,p))==null||i.srcElement.classList.add("treeselect-list--static"):(r=n(this,p))==null||r.srcElement.classList.remove("treeselect-list--static")},we=function(e){!n(this,N)||!n(this,_)||!n(this,I)||!n(this,B)||((!this.alwaysOpen||e)&&(window.removeEventListener("scroll",n(this,N),!0),window.removeEventListener("resize",n(this,_))),document.removeEventListener("mousedown",n(this,I),!0),document.removeEventListener("focus",n(this,I),!0),window.removeEventListener("blur",n(this,B),{capture:!1}))},Tt=function(){var t,s,i;const e=(t=n(this,p))==null?void 0:t.isLastFocusedElementExist();this.saveScrollPosition&&e?(s=n(this,p))==null||s.srcElement.scroll(0,n(this,q)):(i=n(this,p))==null||i.focusFirstListElement()},ve=function(){var e;(e=this.srcElement)==null||e.dispatchEvent(new CustomEvent("input",{detail:this.value})),this.inputCallback&&this.inputCallback(this.value)},At=function(){var e;(e=this.srcElement)==null||e.dispatchEvent(new CustomEvent("name-change",{detail:this.selectedName})),this.nameChangeCallback&&this.nameChangeCallback(this.selectedName)},It=function(){var e;this.alwaysOpen||((e=this.srcElement)==null||e.dispatchEvent(new CustomEvent("open",{detail:this.value})),this.openCallback&&this.openCallback(this.value))},Nt=function(){var e;this.alwaysOpen||((e=this.srcElement)==null||e.dispatchEvent(new CustomEvent("close",{detail:this.value})),this.closeCallback&&this.closeCallback(this.value))},_t=function(e){var s;const t=(e==null?void 0:e.trim())??"";(s=this.srcElement)==null||s.dispatchEvent(new CustomEvent("search",{detail:t})),this.searchCallback&&this.searchCallback(t)},Ot=function(e,t){var s;(s=this.srcElement)==null||s.dispatchEvent(new CustomEvent("open-close-group",{detail:{groupId:e,isClosed:t}})),this.openCloseGroupCallback&&this.openCloseGroupCallback(e,t)},os});
1
+ (function(o,c){typeof exports=="object"&&typeof module<"u"?module.exports=c():typeof define=="function"&&define.amd?define(c):(o=typeof globalThis<"u"?globalThis:o||self,o.Treeselect=c())})(this,(function(){"use strict";function o(i,...e){i&&i.classList.add(...e)}function c(i,...e){i&&i.classList.remove(...e)}const _={arrowUp:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 15l-6-6-6 6"/></svg>',arrowDown:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>',arrowRight:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18l6-6-6-6"/></svg>',attention:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',clear:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg>',cross:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',check:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>',partialCheck:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line></svg>'},f=(i,e)=>{if(e.innerHTML="",typeof i=="string")e.innerHTML=i;else{const t=i.cloneNode(!0);e.appendChild(t)}},N=i=>{const e=i?{...i}:{};return Object.keys(_).forEach(t=>{e[t]||(e[t]=_[t])}),e},U=i=>i.reduce((e,{name:t},s)=>(e+=t,s<i.length-1&&(e+=", "),e),"");class ${value;showTags;tagsCountText;clearable;isAlwaysOpened;searchable;placeholder;disabled;isSingleSelect;id;ariaLabel;iconElements;isOpened;searchText;srcElement;#e;#t;#l;#s;inputCallback;searchCallback;openCallback;closeCallback;keydownCallback;focusCallback;nameChangeCallback;constructor({value:e,showTags:t,tagsCountText:s,clearable:l,isAlwaysOpened:n,searchable:a,placeholder:r,disabled:p,isSingleSelect:d,id:h,ariaLabel:u,iconElements:m,inputCallback:b,searchCallback:g,openCallback:C,closeCallback:E,keydownCallback:L,focusCallback:w,nameChangeCallback:A}){this.value=e,this.showTags=t,this.tagsCountText=s,this.searchable=a,this.placeholder=r,this.clearable=l,this.isAlwaysOpened=n,this.disabled=p,this.isSingleSelect=d,this.id=h,this.ariaLabel=u,this.iconElements=m,this.isOpened=!1,this.searchText="",this.#e=this.#w(),this.#t=this.#S(),this.#l=this.#f(),this.#s=null,this.inputCallback=b,this.searchCallback=g,this.openCallback=C,this.closeCallback=E,this.keydownCallback=L,this.focusCallback=w,this.nameChangeCallback=A,this.srcElement=this.#d({htmlTagsSection:this.#e,htmlEditControl:this.#t,htmlOperators:this.#l}),this.#a()}focus(){setTimeout(()=>this.#t.focus(),0)}blur(){this.isOpened&&this.#c(),this.clearSearch(),this.#t.blur()}updateValue(e){this.value=e,this.#i(),this.#n()}removeItem(e){this.value=this.value.filter(t=>t.id!==e),this.#E(),this.#i(),this.#n()}clear(){this.value=[],this.#E(),this.#i(),this.clearSearch()}openClose(){this.#c()}clearSearch(){this.searchText="",this.searchCallback(""),this.#n()}#a(){this.#i(),this.#n(),this.#r()}#i(){if(this.#e.innerHTML="",this.showTags){this.#e.append(...this.#k());const e=U(this.value);this.nameChangeCallback(e)}else{const e=this.#L();this.#e.appendChild(e),this.nameChangeCallback(e.innerText)}this.#e.appendChild(this.#t)}#r(){const e=[];this.#l.innerHTML="",this.clearable&&e.push(this.#g()),this.isAlwaysOpened||e.push(this.#C(this.isOpened)),e.length&&this.#l.append(...e)}#o(){if(!this.isAlwaysOpened&&this.#s){const e=this.isOpened?this.iconElements.arrowUp:this.iconElements.arrowDown;f(e,this.#s)}}#n(){this.value?.length?(this.#t.removeAttribute("placeholder"),c(this.srcElement,"treeselect-input--value-not-selected")):(this.#t.setAttribute("placeholder",this.placeholder),o(this.srcElement,"treeselect-input--value-not-selected")),this.searchable?c(this.srcElement,"treeselect-input--unsearchable"):o(this.srcElement,"treeselect-input--unsearchable"),this.isSingleSelect?o(this.srcElement,"treeselect-input--is-single-select"):c(this.srcElement,"treeselect-input--is-single-select"),this.#t.value=this.searchText}#c(){this.isOpened=!this.isOpened,this.#o(),this.isOpened?this.openCallback():this.closeCallback()}#d({htmlTagsSection:e,htmlEditControl:t,htmlOperators:s}){const l=document.createElement("div");return l.classList.add("treeselect-input"),l.setAttribute("tabindex","-1"),l.addEventListener("mousedown",n=>this.#u(n)),l.addEventListener("focus",()=>this.focusCallback(),!0),e.appendChild(t),l.append(e,s),l}#u(e){e.stopPropagation(),this.isOpened||this.#c(),this.focus()}#w(){const e=document.createElement("div");return e.classList.add("treeselect-input__tags"),e}#k(){return this.value.map(e=>{const t=document.createElement("div");t.classList.add("treeselect-input__tags-element"),t.setAttribute("tabindex","-1"),t.setAttribute("tag-id",e.id.toString()),t.setAttribute("title",e.name);const s=this.#m(e.name),l=this.#p();return t.addEventListener("mousedown",n=>this.#v(n,e.id)),t.append(s,l),t})}#v(e,t){e.preventDefault(),e.stopPropagation(),this.removeItem(t),this.focus()}#m(e){const t=document.createElement("span");return t.classList.add("treeselect-input__tags-name"),t.textContent=e,t}#p(){const e=document.createElement("span");return e.classList.add("treeselect-input__tags-cross"),f(this.iconElements.cross,e),e}#L(){const e=document.createElement("span");if(e.classList.add("treeselect-input__tags-count"),!this.value.length)return e.textContent="",e.setAttribute("title",""),e;const t=this.value.length===1?this.value[0].name:`${this.value.length} ${this.tagsCountText}`;return e.textContent=t,e.setAttribute("title",t),e}#S(){const e=document.createElement("input");return e.classList.add("treeselect-input__edit"),this.id&&e.setAttribute("id",this.id),(!this.searchable||this.disabled)&&e.setAttribute("readonly","readonly"),this.disabled&&e.setAttribute("tabindex","-1"),this.ariaLabel.length&&e.setAttribute("aria-label",this.ariaLabel),e.addEventListener("keydown",t=>this.#x(t)),e.addEventListener("input",t=>this.#y(t,e)),e}#x(e){e.stopPropagation();const t=e.key;t==="Backspace"&&!this.searchText.length&&this.value.length&&!this.showTags&&this.clear(),t==="Backspace"&&!this.searchText.length&&this.value.length&&this.removeItem(this.value[this.value.length-1].id),e.code==="Space"&&(!this.searchText||!this.searchable)&&this.#c(),(t==="Enter"||t==="ArrowDown"||t==="ArrowUp")&&e.preventDefault(),this.keydownCallback(e),t!=="Tab"&&this.focus()}#y(e,t){e.stopPropagation();const s=this.searchText,l=t.value.trim();if(s.length===0&&l.length===0){t.value="";return}if(this.searchable){const n=e.target.value;this.searchCallback(n),this.isOpened||this.#c()}else t.value="";this.searchText=t.value}#f(){const e=document.createElement("div");return e.classList.add("treeselect-input__operators"),e}#g(){const e=document.createElement("span");return e.classList.add("treeselect-input__clear"),e.setAttribute("tabindex","-1"),f(this.iconElements.clear,e),e.addEventListener("mousedown",t=>this.#b(t)),e}#b(e){e.preventDefault(),e.stopPropagation(),(this.searchText.length||this.value.length)&&this.clear(),this.focus()}#C(e){this.#s=document.createElement("span"),this.#s.classList.add("treeselect-input__arrow");const t=e?this.iconElements.arrowUp:this.iconElements.arrowDown;return f(t,this.#s),this.#s.addEventListener("mousedown",s=>this.#h(s)),this.#s}#h(e){e.stopPropagation(),e.preventDefault(),this.focus(),this.#c()}#E(){this.inputCallback(this.value)}}const O="No results found...",j="Search...",W="elements selected",Y=350,S=20,z=5,H=({newValue:i,optionsTreeMap:e,isSingleSelect:t,isIndependentNodes:s})=>{Z(e);const l=i.map(a=>e.get(a)??null).filter(a=>a!==null&&!a.disabled),[n]=l;if(t&&l.length&&n){n.checked=!0;return}l.forEach(a=>{a.checked=!0;const r=y({option:a,optionsTreeMap:e,isIndependentNodes:s});a.checked=r})},y=({option:{id:i,checked:e},optionsTreeMap:t,isIndependentNodes:s})=>{const l=t.get(i)??null;if(l===null)return!1;if(s)return l.checked=!l.disabled&&e,l.checked;const n=P({checked:e,currentOption:l,optionsTreeMap:t});return D({childOption:l,optionsTreeMap:t}),n},P=({checked:i,currentOption:e,optionsTreeMap:t})=>{if(!e.isGroup)return e.checked=!e.disabled&&i,e.isPartialChecked=!1,e.checked;const s=k({id:e.id,optionsTreeMap:t});return!i||e.disabled||e.isPartialChecked?(e.checked=!1,e.isPartialChecked=!1,T({option:e,children:s,optionsTreeMap:t}),e.checked):V({children:s,optionsTreeMap:t})?B(s)?(e.checked=!1,e.isPartialChecked=!1,e.disabled=!0,e.checked):(e.checked=!1,e.isPartialChecked=!0,s.forEach(r=>{P({checked:i,currentOption:r,optionsTreeMap:t})}),e.checked):(e.checked=!0,e.isPartialChecked=!1,T({option:e,children:s,optionsTreeMap:t}),e.checked)},D=({childOption:i,optionsTreeMap:e})=>{const t=e.get(i.childOf)??null;t!==null&&(q({parentOption:t,optionsTreeMap:e}),D({childOption:t,optionsTreeMap:e}))},q=({parentOption:i,optionsTreeMap:e})=>{const t=k({id:i.id,optionsTreeMap:e});if(B(t)){i.checked=!1,i.isPartialChecked=!1,i.disabled=!0;return}if(X(t)){i.checked=!0,i.isPartialChecked=!1;return}if(K(t)){i.checked=!1,i.isPartialChecked=!0;return}i.checked=!1,i.isPartialChecked=!1},T=({option:{checked:i,disabled:e},children:t,optionsTreeMap:s})=>{t.forEach(l=>{l.disabled=e||l.disabled,l.checked=i&&!l.disabled,l.isPartialChecked=!1;const n=k({id:l.id,optionsTreeMap:s});T({option:{checked:i,disabled:e},children:n,optionsTreeMap:s})})},V=({children:i,optionsTreeMap:e})=>i.some(s=>s.disabled)?!0:i.some(s=>{if(!s.isGroup)return!1;const l=k({id:s.id,optionsTreeMap:e});return V({children:l,optionsTreeMap:e})}),B=i=>i.every(e=>!!e.disabled),X=i=>i.every(e=>e.checked),K=i=>i.some(e=>e.checked||e.isPartialChecked),Z=i=>{i.forEach(e=>{e.checked=!1,e.isPartialChecked=!1})},J=({options:i,openLevel:e,isIndependentNodes:t})=>{const s={level:0,groupId:""},l=new Map;return G({optionsTreeMap:l,options:i,openLevel:e,groupId:s.groupId,level:s.level}),te({optionsTreeMap:l,isIndependentNodes:t}),l},G=({optionsTreeMap:i,options:e,openLevel:t,groupId:s,level:l})=>{e.forEach(n=>{const a=(n.children?.length??0)>0,r=l>=t&&a,p=l>t,d=n.children?.map(u=>u.value)??[],h=n.value;i.has(h)&&console.error(`Validation: You have duplicated option value: ${h}! You should use unique values. Duplicates will lead to unexpected behavior.`),i.set(h,{id:h,name:n.name,childOf:s,isGroup:a,checked:!1,isPartialChecked:!1,level:l,isClosed:r,hidden:p,disabled:n.disabled??!1,isGroupSelectable:!a||(n.isGroupSelectable??!0),children:d,checkboxHtmlElement:null,itemHtmlElement:null,arrowItemHtmlElement:null,checkboxIconHtmlElement:null}),a&&G({optionsTreeMap:i,options:n.children,openLevel:t,groupId:h,level:l+1})})},Q=(i,e)=>i===null?null:e.get(i)??e.get(parseInt(i))??null,k=({id:i,optionsTreeMap:e})=>{const t=e.get(i)??null;return t===null?[]:t.children.reduce((s,l)=>{const n=e.get(l)??null;return n!==null&&s.push(n),s},[])},ee=i=>{const e=[],t=[],s=[];i.forEach(n=>{n.checked&&(s.push(n),n.isGroup?t.push(n):e.push(n))});const l=s.filter(n=>!t.some(({id:a})=>a===n.childOf));return{ungroupedNodes:e,groupedNodes:l,allNodes:s}},te=({optionsTreeMap:i,isIndependentNodes:e})=>{const t=[];i.forEach(s=>{s.disabled&&t.push(s)}),t.forEach(({id:s})=>{y({option:{id:s,checked:!1},optionsTreeMap:i,isIndependentNodes:e})})},v=(i,{id:e,isClosed:t})=>{k({id:e,optionsTreeMap:i}).forEach(l=>{l.hidden=t??!1,l.isGroup&&!l.isClosed&&v(i,{id:l.id,isClosed:t})})},se=(i,e)=>{if(e){ie(i);return}i.forEach(t=>{t.checked&&I(t.childOf,i),t.isGroup&&!t.disabled&&(t.checked||t.isPartialChecked)&&(t.isClosed=!1,v(i,t))})},ie=i=>{let e=null;for(const[t,s]of i)if(s.checked&&!s.disabled){e=s;break}e&&(e.isGroup&&(e.isClosed=!1,v(i,e)),I(e.childOf,i))},I=(i,e)=>{const t=e.get(i)??null;t&&(t.isClosed=!1,v(e,t),I(t.childOf,e))},le=(i,e)=>{i.forEach(t=>{const s=t.name.toLowerCase().includes(e.toLowerCase());s&&(t.isGroup&&(t.isClosed=!0),t.childOf&&M(t.childOf,i)),t.hidden=!s})},M=(i,e)=>{const t=e.get(i)??null;t&&(t.hidden=!1,t.isClosed=!1,M(t.childOf,e))},ne=({optionsTreeMap:i,beforeSearchStateMap:e})=>{i.forEach(t=>{const s=e.get(t.id);s&&(t.hidden=s.hidden,t.isClosed=s.isClosed)}),e.clear()},ae=({optionsTreeMap:i,beforeSearchStateMap:e})=>{e.clear(),i.forEach(t=>{e.set(t.id,{hidden:t.hidden,isClosed:t.isClosed})})},re=i=>new IntersectionObserver(e=>{e.forEach(t=>{t.target.classList.toggle("treeselect-list__item--scroll-not-visible",!t.isIntersecting)})},{root:i,threshold:.5}),oe=({optionsTreeMap:i,emptyListHtmlElement:e,iconElements:t,previousSingleSelectedValue:s,rtl:l})=>{i.forEach(n=>{const a=n.checkboxHtmlElement;a&&(a.checked=n.checked),ue({option:n,previousSingleSelectedValue:s}),me(n),pe(n),fe({option:n,iconElements:t}),ge(n),ce({option:n,optionsTreeMap:i,rtl:l}),be({option:n,iconElements:t}),Ce(n)}),he({optionsTreeMap:i,emptyListHtmlElement:e})},ce=({option:i,optionsTreeMap:e,rtl:t})=>{const s=i.level===0;let l="0";if(s){let a=!1;for(const[p,d]of e)if(d.isGroup&&d.level===i.level){a=!0;break}const r=!i.isGroup&&a?`${S}px`:`${z}px`;l=i.isGroup?"0":r}else l=i.isGroup?`${i.level*S}px`:`${i.level*S+S}px`;const n=i.itemHtmlElement;n&&(t?n.style.paddingRight=l:n.style.paddingLeft=l,n.setAttribute("level",i.level.toString()),n.setAttribute("group",i.isGroup.toString()))},he=({optionsTreeMap:i,emptyListHtmlElement:e})=>{let t=!1;for(const[s,l]of i)if(!l.hidden){t=!0;break}e?.classList.toggle("treeselect-list__empty--hidden",t)},de=(i,e)=>{e&&Object.keys(e).forEach(t=>{const s=e[t];typeof s=="string"&&i.setAttribute(t,s)})},ue=({option:i,previousSingleSelectedValue:e})=>{const t=i.itemHtmlElement;t?.classList.toggle("treeselect-list__item--checked",i.checked);const s=Array.isArray(e)&&e[0]===i.id&&!i.disabled;t?.classList.toggle("treeselect-list__item--single-selected",s)},me=i=>{i.itemHtmlElement?.classList.toggle("treeselect-list__item--partial-checked",i.isPartialChecked)},pe=i=>{i.itemHtmlElement?.classList.toggle("treeselect-list__item--disabled",i.disabled)},fe=({option:i,iconElements:e})=>{const t=i.arrowItemHtmlElement;if(i.isGroup&&t){const s=i.isClosed?e.arrowRight:e.arrowDown;f(s,t),i.itemHtmlElement?.classList.toggle("treeselect-list__item--closed",i.isClosed)}},ge=i=>{i.itemHtmlElement?.classList.toggle("treeselect-list__item--hidden",i.hidden)},be=({option:i,iconElements:e})=>{const t=i.checkboxIconHtmlElement;t&&(i.checked?f(e.check,t):i.isPartialChecked?f(e.partialCheck,t):t.innerHTML="")},Ce=i=>{i.itemHtmlElement?.classList.toggle("treeselect-list__item--non-selectable-group",!i.isGroupSelectable)},Ee=({newValue:i,optionsTreeMap:e,isSingleSelect:t,expandSelected:s,isFirstValueUpdate:l,isIndependentNodes:n})=>{H({newValue:i,optionsTreeMap:e,isSingleSelect:t,isIndependentNodes:n}),l&&s&&se(e,t)};class we{options;value;openLevel;listSlotHtmlComponent;tagsSortFn;emptyText;isSingleSelect;showCount;disabledBranchNode;expandSelected;isIndependentNodes;rtl;listClassName;isBoostedRendering;iconElements;searchText;intersectionItemsObserver;selectedNodes;optionsTreeMap;beforeSearchStateMap;emptyListHtmlElement;srcElement;inputCallback;arrowClickCallback;mouseupCallback;#e=null;#t=!0;#l=[];#s=!0;constructor({options:e,value:t,openLevel:s,listSlotHtmlComponent:l,tagsSortFn:n,emptyText:a,isSingleSelect:r,iconElements:p,showCount:d,disabledBranchNode:h,expandSelected:u,isIndependentNodes:m,rtl:b,listClassName:g,isBoostedRendering:C,inputCallback:E,arrowClickCallback:L,mouseupCallback:w}){this.options=e,this.value=t,this.openLevel=s??0,this.listSlotHtmlComponent=l??null,this.tagsSortFn=n??null,this.emptyText=a??O,this.isSingleSelect=r??!1,this.showCount=d??!1,this.disabledBranchNode=h??!1,this.expandSelected=u??!1,this.isIndependentNodes=m??!1,this.rtl=b??!1,this.listClassName=g??"",this.isBoostedRendering=C,this.iconElements=p,this.searchText="",this.intersectionItemsObserver=null,this.selectedNodes={nodes:[],groupedNodes:[],allNodes:[]},this.optionsTreeMap=J({options:this.options,openLevel:this.openLevel,isIndependentNodes:this.isIndependentNodes}),this.beforeSearchStateMap=new Map,this.emptyListHtmlElement=null,this.srcElement=this.#o(),this.inputCallback=E,this.arrowClickCallback=L,this.mouseupCallback=w}updateValue(e){this.value=e,this.#l=this.isSingleSelect?this.value:[],Ee({newValue:e,optionsTreeMap:this.optionsTreeMap,isSingleSelect:this.isSingleSelect,expandSelected:this.expandSelected,isFirstValueUpdate:this.#s,isIndependentNodes:this.isIndependentNodes}),this.#a(),this.#s=!1,this.#_()}updateSearchValue(e){if(e===this.searchText)return;const t=this.searchText===""&&e!=="";this.searchText=e,t&&ae({beforeSearchStateMap:this.beforeSearchStateMap,optionsTreeMap:this.optionsTreeMap}),this.searchText===""&&ne({beforeSearchStateMap:this.beforeSearchStateMap,optionsTreeMap:this.optionsTreeMap}),this.searchText&&le(this.optionsTreeMap,e),this.#a(),this.focusFirstListElement()}callKeyAction(e){this.#t=!1;const t=this.srcElement.querySelector(".treeselect-list__item--focused");if(t?.classList.contains("treeselect-list__item--hidden"))return;const l=e.key;l==="Enter"&&t&&t.dispatchEvent(new Event("mousedown")),(l==="ArrowLeft"||l==="ArrowRight")&&this.#i(t,e),(l==="ArrowDown"||l==="ArrowUp")&&this.#r(t,l)}focusFirstListElement(){const e="treeselect-list__item--focused",t=this.srcElement.querySelector(`.${e}`),s=this.#h();if(!s.length)return;t&&c(t,e);const[l]=s;o(l,e)}isLastFocusedElementExist(){return!!this.#e}destroy(){this.intersectionItemsObserver&&this.intersectionItemsObserver.disconnect()}#a(){oe({optionsTreeMap:this.optionsTreeMap,emptyListHtmlElement:this.emptyListHtmlElement,iconElements:this.iconElements,previousSingleSelectedValue:this.#l,rtl:this.rtl})}#i(e,t){if(!e)return;const s=t.key,n=(e.querySelector(".treeselect-list__item-checkbox")??null)?.getAttribute("input-id")??null,a=Q(n,this.optionsTreeMap)??null,r=a?.arrowItemHtmlElement??null;a===null||r===null||(s==="ArrowLeft"&&!a.isClosed&&a.isGroup&&(r.dispatchEvent(new Event("mousedown")),t.preventDefault()),s==="ArrowRight"&&a.isClosed&&a.isGroup&&(r.dispatchEvent(new Event("mousedown")),t.preventDefault()))}#r(e,t){const s=this.#h();if(!s.length)return;const l="treeselect-list__item--focused";if(e){const n=s.findIndex(g=>g.classList.contains(l)),a=s[n];c(a,l);const r=t==="ArrowDown"?n+1:n-1,p=t==="ArrowDown"?0:s.length-1,d=!s[r],h=s[r]??s[p];o(h,l);const u=this.srcElement.getBoundingClientRect(),m=h.getBoundingClientRect();if(d&&t==="ArrowDown"){this.srcElement.scroll(0,0);return}if(d&&t==="ArrowUp"){this.srcElement.scroll(0,this.srcElement.scrollHeight);return}const b=this.listSlotHtmlComponent?.clientHeight??0;if(u.y+u.height<m.y+m.height+b){this.srcElement.scroll(0,this.srcElement.scrollTop+m.height);return}if(u.y>m.y){this.srcElement.scroll(0,this.srcElement.scrollTop-m.height);return}}else{const[n]=s;o(n,l)}}#o(){const e=this.#n(),t=this.#u(this.options);e.append(...t);const s=this.#k();e.append(s);const l=this.#w();return l&&e.append(l),e}#n(){const e=document.createElement("div");if(e.classList.add("treeselect-list"),this.listClassName.length>0){const t=this.listClassName.split(" ");e.classList.add(...t)}return this.isSingleSelect&&e.classList.add("treeselect-list--single-select"),this.disabledBranchNode&&e.classList.add("treeselect-list--disabled-branch-node"),e.addEventListener("mouseout",t=>this.#c(t)),e.addEventListener("mousemove",()=>this.#d()),e.addEventListener("mouseup",()=>this.mouseupCallback(),!0),this.isBoostedRendering&&(this.intersectionItemsObserver=re(e)),e}#c(e){e.stopPropagation(),this.#e&&this.#t&&o(this.#e,"treeselect-list__item--focused")}#d(){this.#t=!0}#u(e){return e.reduce((t,s)=>{if(s.children?.length){const n=this.#v(s),a=this.#u(s.children);return n.append(...a),t.push(n),t}const l=this.#m(s,!1);return t.push(l),t},[])}#w(){if(!this.listSlotHtmlComponent)return null;const e=document.createElement("div");return e.classList.add("treeselect-list__slot"),e.appendChild(this.listSlotHtmlComponent),e}#k(){const e=document.createElement("div");e.classList.add("treeselect-list__empty"),e.setAttribute("title",this.emptyText);const t=document.createElement("span");t.classList.add("treeselect-list__empty-icon"),f(this.iconElements.attention,t);const s=document.createElement("span");return s.classList.add("treeselect-list__empty-text"),s.textContent=this.emptyText,e.append(t,s),this.emptyListHtmlElement=e,e}#v(e){const t=document.createElement("div");t.setAttribute("group-container-id",e.value.toString()),t.classList.add("treeselect-list__group-container");const s=this.#m(e,!0);return t.appendChild(s),t}#m(e,t){const s=this.#p(e);if(t){const a=this.#y(e);s.appendChild(a),s.classList.add("treeselect-list__item--group")}const l=this.#g(e),n=this.#b(e,t);return s.append(l,n),s}#p(e){const t=document.createElement("div");t.setAttribute("tabindex","-1"),t.setAttribute("title",e.name),de(t,e.htmlAttr),t.classList.add("treeselect-list__item"),t.addEventListener("mouseover",()=>this.#L(t),!0),t.addEventListener("mouseout",()=>this.#S(t),!0),t.addEventListener("mousedown",l=>this.#x(l,e)),this.intersectionItemsObserver&&this.intersectionItemsObserver.observe(t);const s=this.optionsTreeMap.get(e.value);return s&&(s.itemHtmlElement=t),t}#L(e){this.#t&&this.#A(!0,e)}#S(e){this.#t&&(this.#A(!1,e),this.#e=e)}#x(e,t){e.preventDefault(),e.stopPropagation();const s=this.optionsTreeMap.get(t.value)??null;if(s?.disabled)return;const l=s?.checkboxHtmlElement;l&&(l.checked=!l.checked,this.#E(l,t))}#y(e){const t=document.createElement("span");t.setAttribute("tabindex","-1"),t.classList.add("treeselect-list__item-icon"),f(this.iconElements.arrowDown,t),t.addEventListener("mousedown",l=>this.#f(l,e));const s=this.optionsTreeMap.get(e.value);return s&&(s.arrowItemHtmlElement=t),t}#f(e,t){e.preventDefault(),e.stopPropagation(),this.#I(t)}#g(e){const t=document.createElement("div");t.classList.add("treeselect-list__item-checkbox-container");const s=document.createElement("span");s.classList.add("treeselect-list__item-checkbox-icon"),s.innerHTML="";const l=document.createElement("input");l.setAttribute("tabindex","-1"),l.setAttribute("type","checkbox"),l.setAttribute("input-id",e.value.toString()),l.classList.add("treeselect-list__item-checkbox"),t.append(s,l);const n=this.optionsTreeMap.get(e.value);return n&&(n.checkboxHtmlElement=l,n.checkboxIconHtmlElement=s),t}#b(e,t){const s=document.createElement("label");if(s.textContent=e.name,s.classList.add("treeselect-list__item-label"),t&&this.showCount){const l=this.#C(e);s.appendChild(l)}return s}#C(e){const t=document.createElement("span"),s=this.optionsTreeMap.get(e.value)?.children??[];return t.textContent=`(${s.length})`,t.classList.add("treeselect-list__item-label-counter"),t}#h(){const e=[];return this.optionsTreeMap.forEach(t=>{!t.hidden&&t.itemHtmlElement&&e.push(t.itemHtmlElement)}),e}#E(e,t){const s=this.optionsTreeMap.get(t.value)??null;if(s===null)return;const l=s.isGroupSelectable??!0;if(s.isGroup&&(this.disabledBranchNode||!l)){s.arrowItemHtmlElement?.dispatchEvent(new Event("mousedown"));return}if(this.isSingleSelect){const[n]=this.#l;if(s.id===n)return;this.#l=[s.id],H({newValue:[s.id],optionsTreeMap:this.optionsTreeMap,isSingleSelect:this.isSingleSelect,isIndependentNodes:this.isIndependentNodes})}else{s.checked=e.checked;const n=y({option:s,optionsTreeMap:this.optionsTreeMap,isIndependentNodes:this.isIndependentNodes});e.checked=n}this.#a(),this.#N()}#I(e){const t=this.optionsTreeMap.get(e.value)??null;t!==null&&(t.isClosed=!t.isClosed,v(this.optionsTreeMap,t),this.#a(),this.arrowClickCallback(t.id,t.isClosed))}#A(e,t){const s="treeselect-list__item--focused";if(e){const l=Array.from(this.srcElement.querySelectorAll(`.${s}`));l.length&&l.forEach(n=>{c(n,s)}),o(t,s)}else c(t,s)}#T(e){const t=this.tagsSortFn??null;return t===null?e:[...e].sort((s,l)=>t({value:s.id,name:s.name},{value:l.id,name:l.name}))}#_(){const{ungroupedNodes:e,groupedNodes:t,allNodes:s}=ee(this.optionsTreeMap);this.selectedNodes={nodes:this.#T(e),groupedNodes:this.#T(t),allNodes:this.#T(s)}}#N(){this.#_(),this.inputCallback(this.selectedNodes),this.value=this.selectedNodes.nodes.map(e=>e.id)}}const F=({parentHtmlContainer:i,staticList:e,appendToBody:t,isSingleSelect:s,value:l,direction:n})=>{i||console.error("Validation: parentHtmlContainer prop is required!"),e&&t&&console.error("Validation: You should set staticList to false if you use appendToBody!"),s&&Array.isArray(l)&&console.error("Validation: if you use isSingleSelect prop, you should pass a single value!"),!s&&!Array.isArray(l)&&console.error("Validation: you should pass an array as a value!"),n&&n!=="auto"&&n!=="bottom"&&n!=="top"&&console.error("Validation: you should pass (auto | top | bottom | undefined) as a value for the direction prop!")},x=i=>i.map(e=>e.id),ke=i=>i==null?[]:Array.isArray(i)?i:[i],ve=(i,e)=>{if(e){const[t]=i;return t??null}return i};class Le{parentHtmlContainer;value;options;openLevel;appendToBody;alwaysOpen;showTags;tagsCountText;tagsSortFn;clearable;searchable;placeholder;grouped;isGroupedValue;listSlotHtmlComponent;disabled;emptyText;staticList;id;ariaLabel;isSingleSelect;showCount;disabledBranchNode;direction;expandSelected;saveScrollPosition;isIndependentNodes;rtl;listClassName;isBoostedRendering;iconElements;inputCallback;openCallback;closeCallback;nameChangeCallback;searchCallback;openCloseGroupCallback;ungroupedValue;groupedValue;allValue;isListOpened;selectedName;srcElement;#e=null;#t=null;#l=null;#s=0;#a=0;#i=null;#r=null;#o=null;#n=null;constructor({parentHtmlContainer:e,value:t,options:s,openLevel:l,appendToBody:n,alwaysOpen:a,showTags:r,tagsCountText:p,tagsSortFn:d,clearable:h,searchable:u,placeholder:m,grouped:b,isGroupedValue:g,listSlotHtmlComponent:C,disabled:E,emptyText:L,staticList:w,id:A,ariaLabel:Se,isSingleSelect:R,showCount:xe,disabledBranchNode:ye,direction:Te,expandSelected:Ie,saveScrollPosition:Ae,isIndependentNodes:_e,rtl:Ne,listClassName:Oe,isBoostedRendering:He,iconElements:Pe,inputCallback:De,openCallback:Ve,closeCallback:Be,nameChangeCallback:Ge,searchCallback:Me,openCloseGroupCallback:Fe}){F({parentHtmlContainer:e,value:t,staticList:w,appendToBody:n,isSingleSelect:R}),this.parentHtmlContainer=e,this.value=[],this.options=s??[],this.openLevel=l??0,this.appendToBody=n??!1,this.alwaysOpen=!!(a&&!E),this.showTags=r??!0,this.tagsCountText=p??W,this.tagsSortFn=d??null,this.clearable=h??!0,this.searchable=u??!0,this.placeholder=m??j,this.grouped=b??!0,this.isGroupedValue=g??!1,this.listSlotHtmlComponent=C??null,this.disabled=E??!1,this.emptyText=L??O,this.staticList=!!(w&&!this.appendToBody),this.id=A??"",this.ariaLabel=Se??"",this.isSingleSelect=R??!1,this.showCount=xe??!1,this.disabledBranchNode=ye??!1,this.direction=Te??"auto",this.expandSelected=Ie??!1,this.saveScrollPosition=Ae??!0,this.isIndependentNodes=_e??!1,this.rtl=Ne??!1,this.listClassName=Oe??"",this.isBoostedRendering=He??!1,this.iconElements=N(Pe),this.inputCallback=De,this.openCallback=Ve,this.closeCallback=Be,this.nameChangeCallback=Ge,this.searchCallback=Me,this.openCloseGroupCallback=Fe,this.ungroupedValue=[],this.groupedValue=[],this.allValue=[],this.isListOpened=!1,this.selectedName="",this.srcElement=null,this.#c(t)}mount(){F({parentHtmlContainer:this.parentHtmlContainer,value:this.value,staticList:this.staticList,appendToBody:this.appendToBody,isSingleSelect:this.isSingleSelect}),this.iconElements=N(this.iconElements),this.#c(this.value)}#c(e){this.destroy();const{container:t,list:s,input:l}=this.#u();this.srcElement=t,this.#e=s,this.#t=l,this.#i=this.scrollWindowHandler.bind(this),this.#r=this.scrollWindowHandler.bind(this),this.#o=this.focusWindowHandler.bind(this),this.#n=this.blurWindowHandler.bind(this),this.alwaysOpen&&this.#t?.openClose(),this.disabled?o(this.srcElement,"treeselect--disabled"):c(this.srcElement,"treeselect--disabled"),this.updateValue(e??this.value)}updateValue(e){const t=ke(e),s=this.#e;s&&(s.updateValue(t),this.#p(s?.selectedNodes))}destroy(){this.srcElement&&(this.#f(),this.srcElement.innerHTML="",this.srcElement=null,this.#h(!0),this.#e?.destroy(),clearTimeout(this.#a))}focus(){this.#t&&this.#t.focus()}toggleOpenClose(){this.#t&&(this.#t.openClose(),this.#t.focus())}#d({groupedNodes:e,nodes:t,allNodes:s}){this.ungroupedValue=t?x(t):[],this.groupedValue=e?x(e):[],this.allValue=s?x(s):[];let l=[];this.isIndependentNodes||this.isSingleSelect?l=this.allValue:this.isGroupedValue?l=this.groupedValue:l=this.ungroupedValue,this.value=ve(l,this.isSingleSelect)}#u(){const e=this.parentHtmlContainer;e.classList.add("treeselect");const t=new we({value:[],options:this.options,openLevel:this.openLevel,listSlotHtmlComponent:this.listSlotHtmlComponent,tagsSortFn:this.tagsSortFn,emptyText:this.emptyText,isSingleSelect:this.isSingleSelect,showCount:this.showCount,disabledBranchNode:this.disabledBranchNode,expandSelected:this.expandSelected,isIndependentNodes:this.isIndependentNodes,rtl:this.rtl,listClassName:this.listClassName,isBoostedRendering:this.isBoostedRendering,iconElements:this.iconElements,inputCallback:l=>this.#L(l),arrowClickCallback:(l,n)=>this.#S(l,n),mouseupCallback:()=>this.#t?.focus()}),s=new $({value:[],showTags:this.showTags,tagsCountText:this.tagsCountText,clearable:this.clearable,isAlwaysOpened:this.alwaysOpen,searchable:this.searchable,placeholder:this.placeholder,disabled:this.disabled,isSingleSelect:this.isSingleSelect,id:this.id,ariaLabel:this.ariaLabel,iconElements:this.iconElements,inputCallback:l=>this.#w(l),searchCallback:l=>this.#v(l),openCallback:()=>this.#y(),closeCallback:()=>this.#f(),keydownCallback:l=>this.#k(l),focusCallback:()=>this.#m(),nameChangeCallback:l=>this.#x(l)});return this.rtl&&(e.setAttribute("dir","rtl"),t.srcElement.setAttribute("dir","rtl")),this.appendToBody&&(this.#l=new ResizeObserver(()=>this.updateListPosition())),e.append(s.srcElement),{container:e,list:t,input:s}}#w(e){const t=x(e);this.#e?.updateValue(t);const s=this.#e?.selectedNodes??{};this.#d(s),this.#I()}#k(e){this.isListOpened&&this.#e?.callKeyAction(e)}#v(e){this.#a&&clearTimeout(this.#a),this.#a=window.setTimeout(()=>{this.#e?.updateSearchValue(e),this.updateListPosition()},Y),this.#N(e)}#m(){this.#b(!0),this.#o&&this.#n&&(document.addEventListener("mousedown",this.#o,!0),document.addEventListener("focus",this.#o,!0),window.addEventListener("blur",this.#n,{capture:!1}))}#p(e){if(!e)return;let t=[];this.isIndependentNodes||this.isSingleSelect?t=e.allNodes:this.grouped?t=e.groupedNodes:t=e.nodes,this.#t?.updateValue(t),this.#d(e)}#L(e){this.#p(e),this.isSingleSelect&&!this.alwaysOpen&&(this.#t?.openClose(),this.#t?.clearSearch()),this.#t?.focus(),this.#I()}#S(e,t){this.#t?.focus(),this.updateListPosition(),this.#O(e,t)}#x(e){this.selectedName!==e&&(this.selectedName=e,this.#A())}#y(){this.isListOpened=!0,this.#i&&this.#r&&(window.addEventListener("scroll",this.#i,!0),window.addEventListener("resize",this.#r)),!(!this.#e||!this.srcElement)&&(this.appendToBody?(document.body.appendChild(this.#e.srcElement),this.#l?.observe(this.srcElement)):this.srcElement.appendChild(this.#e.srcElement),this.updateListPosition(),this.#C(!0),this.#E(),this.#T())}#f(){this.alwaysOpen||(this.isListOpened=!1,this.#i&&this.#r&&(window.removeEventListener("scroll",this.#i,!0),window.removeEventListener("resize",this.#r)),!this.#e||!this.srcElement)||!(this.appendToBody?document.body.contains(this.#e.srcElement):this.srcElement.contains(this.#e.srcElement))||(this.#s=this.#e.srcElement.scrollTop,this.appendToBody?(document.body.removeChild(this.#e.srcElement),this.#l?.disconnect()):this.srcElement.removeChild(this.#e.srcElement),this.#C(!1),this.#_())}#g(e,t){if(!this.#e||!this.#t)return;const s=t?"treeselect-list--top-to-body":"treeselect-list--top",l=t?"treeselect-list--bottom-to-body":"treeselect-list--bottom";e?(o(this.#e.srcElement,s),c(this.#e.srcElement,l),o(this.#t.srcElement,"treeselect-input--top"),c(this.#t.srcElement,"treeselect-input--bottom")):(c(this.#e.srcElement,s),o(this.#e.srcElement,l),c(this.#t.srcElement,"treeselect-input--top"),o(this.#t.srcElement,"treeselect-input--bottom"))}#b(e){!this.#t||!this.#e||(e?(o(this.#t.srcElement,"treeselect-input--focused"),o(this.#e.srcElement,"treeselect-list--focused")):(c(this.#t.srcElement,"treeselect-input--focused"),c(this.#e.srcElement,"treeselect-list--focused")))}#C(e){e?o(this.#t?.srcElement,"treeselect-input--opened"):c(this.#t?.srcElement,"treeselect-input--opened"),this.staticList?o(this.#e?.srcElement,"treeselect-list--static"):c(this.#e?.srcElement,"treeselect-list--static")}#h(e){!this.#i||!this.#r||!this.#o||!this.#n||((!this.alwaysOpen||e)&&(window.removeEventListener("scroll",this.#i,!0),window.removeEventListener("resize",this.#r)),document.removeEventListener("mousedown",this.#o,!0),document.removeEventListener("focus",this.#o,!0),window.removeEventListener("blur",this.#n,{capture:!1}))}#E(){const e=this.#e?.isLastFocusedElementExist();this.saveScrollPosition&&e?this.#e?.srcElement.scroll(0,this.#s):this.#e?.focusFirstListElement()}scrollWindowHandler(){this.updateListPosition()}focusWindowHandler(e){let t=e.target;t?.shadowRoot&&e.composedPath().length>0&&(t=e.composedPath()[0]),this.srcElement?.contains(t)||this.#e?.srcElement.contains(t)||this.blurWindowHandler()}blurWindowHandler(){this.#t?.blur(),this.#h(!1),this.#b(!1)}updateListPosition(){const e=this.srcElement,t=this.#e?.srcElement;if(!e||!t)return;if(this.staticList){t.setAttribute("direction","bottom"),this.#g(!1,this.appendToBody);return}const{height:s}=t.getBoundingClientRect(),{x:l,y:n,height:a,width:r}=e.getBoundingClientRect(),p=window.innerHeight,d=n,h=p-n-a;let u=d>h&&d>=s&&h<s;if(this.direction!=="auto"&&(u=this.direction==="top"),this.appendToBody){(t.style.top!=="0px"||t.style.left!=="0px")&&(t.style.top="0px",t.style.left="0px");const g=l+window.scrollX,C=u?n+window.scrollY-s:n+window.scrollY+a;t.style.transform=`translate(${g}px,${C}px)`,t.style.width=`${r}px`}const m=u?"top":"bottom";t.getAttribute("direction")!==m&&(t.setAttribute("direction",m),this.#g(u,this.appendToBody))}#I(){this.srcElement?.dispatchEvent(new CustomEvent("input",{detail:this.value})),this.inputCallback&&this.inputCallback(this.value)}#A(){this.srcElement?.dispatchEvent(new CustomEvent("name-change",{detail:this.selectedName})),this.nameChangeCallback&&this.nameChangeCallback(this.selectedName)}#T(){this.alwaysOpen||(this.srcElement?.dispatchEvent(new CustomEvent("open",{detail:this.value})),this.openCallback&&this.openCallback(this.value))}#_(){this.alwaysOpen||(this.srcElement?.dispatchEvent(new CustomEvent("close",{detail:this.value})),this.closeCallback&&this.closeCallback(this.value))}#N(e){const t=e?.trim()??"";this.srcElement?.dispatchEvent(new CustomEvent("search",{detail:t})),this.searchCallback&&this.searchCallback(t)}#O(e,t){this.srcElement?.dispatchEvent(new CustomEvent("open-close-group",{detail:{groupId:e,isClosed:t}})),this.openCloseGroupCallback&&this.openCloseGroupCallback(e,t)}}return Le}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "treeselectjs",
3
- "version": "0.13.3",
3
+ "version": "0.14.0",
4
4
  "description": "Treeselect JS",
5
5
  "main": "./dist/treeselectjs.umd.js",
6
6
  "module": "./dist/treeselectjs.mjs",
@@ -25,8 +25,10 @@
25
25
  "dev": "vite --port 5173",
26
26
  "build": "tsc && vite build",
27
27
  "typecheck": "tsc --project tsconfig.app.json --noEmit && tsc --project tsconfig.jest.json --noEmit && tsc --project tsconfig.cypress.json --noEmit",
28
- "preview": "vite preview",
29
- "prettier": "prettier --w .",
28
+ "format": "biome format --write",
29
+ "lint": "biome lint",
30
+ "lint:fix": "biome lint --write",
31
+ "check": "biome check --write",
30
32
  "jest:watch": "jest --watch",
31
33
  "jest:run": "jest",
32
34
  "cypress:open": "cypress open",
@@ -35,7 +37,7 @@
35
37
  },
36
38
  "repository": {
37
39
  "type": "git",
38
- "url": "https://github.com/dipson88/treeselectjs.git"
40
+ "url": "git+https://github.com/dipson88/treeselectjs.git"
39
41
  },
40
42
  "keywords": [
41
43
  "treeselect",
@@ -53,21 +55,24 @@
53
55
  },
54
56
  "homepage": "https://github.com/dipson88/treeselectjs#readme",
55
57
  "devDependencies": {
58
+ "@biomejs/biome": "^2.4.4",
56
59
  "@testing-library/dom": "^10.4.0",
57
60
  "@testing-library/jest-dom": "^6.6.3",
58
61
  "@types/jest": "^29.5.14",
59
62
  "cypress": "^13.17.0",
60
63
  "identity-obj-proxy": "^3.0.0",
61
- "intersection-observer": "^0.12.2",
62
64
  "jest": "^29.7.0",
63
65
  "jest-environment-jsdom": "^29.7.0",
64
- "prettier": "^3.5.1",
65
66
  "resize-observer-polyfill": "^1.5.1",
66
- "ts-jest": "^29.2.5",
67
+ "ts-jest": "^29.4.6",
67
68
  "ts-node": "^10.9.2",
68
- "typescript": "^5.7.3",
69
- "vite": "^6.2.0",
70
- "vite-plugin-dts": "^4.5.0"
69
+ "typescript": "^5.8.2",
70
+ "vite": "^7.3.1",
71
+ "vite-plugin-dts": "^4.5.4"
72
+ },
73
+ "overrides": {
74
+ "ajv": ">=8.18.0",
75
+ "minimatch": ">=10.2.1"
71
76
  },
72
77
  "files": [
73
78
  "dist"