reneco-hierarchized-picker 0.2.2-beta → 0.2.2-beta.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.
@@ -4,6 +4,33 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-55df525c.js');
6
6
 
7
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
+
9
+ function getDefaultExportFromCjs (x) {
10
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
11
+ }
12
+
13
+ function createCommonjsModule(fn, basedir, module) {
14
+ return module = {
15
+ path: basedir,
16
+ exports: {},
17
+ require: function (path, base) {
18
+ return commonjsRequire();
19
+ }
20
+ }, fn(module, module.exports), module.exports;
21
+ }
22
+
23
+ function commonjsRequire () {
24
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
25
+ }
26
+
27
+ var vanillaContextMenu = createCommonjsModule(function (module, exports) {
28
+ /*! For license information please see vanilla-context-menu.js.LICENSE.txt */
29
+ !function(e,t){module.exports=t();}(commonjsGlobal,(()=>(()=>{var e={550:(e,t,n)=>{n.d(t,{Z:()=>s});var r=n(81),o=n.n(r),i=n(645),a=n.n(i)()(o());a.push([e.id,'.PJsSKU2kCXjeIsVSdFoI{font-family:"Open Sans",sans-serif;position:fixed;z-index:10000;width:150px;transform:scale(0);transition-property:transform;transition-timing-function:ease-in-out}.novl09c_yWe4MBqKpWyN{background:#1b1a1a}.novl09c_yWe4MBqKpWyN hr{background-color:#555}.novl09c_yWe4MBqKpWyN>*:not(hr){color:#eee}.novl09c_yWe4MBqKpWyN>*:not(hr):hover{background:#555}.F5LtzLqHVYZuI1H_SR9q{background:#fff}.F5LtzLqHVYZuI1H_SR9q hr{background-color:#e4e4e4}.F5LtzLqHVYZuI1H_SR9q>*:not(hr){color:#262626}.F5LtzLqHVYZuI1H_SR9q>*:not(hr):hover{background:#e4e4e4}.PJsSKU2kCXjeIsVSdFoI.ibAEWR3dINCWDsWq1G2P{transform:scale(1)}.PJsSKU2kCXjeIsVSdFoI hr{margin:2px 0;height:1px;border:0}.PJsSKU2kCXjeIsVSdFoI>*:not(hr){padding:8px 10px;font-size:15px;cursor:pointer;display:flex;align-items:center;gap:5px}.PJsSKU2kCXjeIsVSdFoI .gfl6YXq1tuGnYKHXwDHP{display:flex;align-items:center;justify-content:center}.PJsSKU2kCXjeIsVSdFoI .gfl6YXq1tuGnYKHXwDHP>*{margin:0;padding:0;font-size:16px}.PJsSKU2kCXjeIsVSdFoI .QkRci5U3hKz5RODdOkco{line-height:21px;font-size:26px;position:relative;margin-left:auto}',""]),a.locals={"context-menu":"PJsSKU2kCXjeIsVSdFoI","context-menu--black-theme":"novl09c_yWe4MBqKpWyN","context-menu--white-theme":"F5LtzLqHVYZuI1H_SR9q",visible:"ibAEWR3dINCWDsWq1G2P","menu-item-icon":"gfl6YXq1tuGnYKHXwDHP","nested-menu-arrow":"QkRci5U3hKz5RODdOkco"};const s=a;},645:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var s=0;s<this.length;s++){var c=this[s][0];null!=c&&(a[c]=!0);}for(var l=0;l<e.length;l++){var u=[].concat(e[l]);r&&a[u[0]]||(void 0!==i&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u));}},t};},81:e=>{e.exports=function(e){return e[1]};},856:function(e){e.exports=function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,n){return t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(e,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return !1}}function r(e,o,i){return r=n()?Reflect.construct:function(e,n,r){var o=[null];o.push.apply(o,n);var i=new(Function.bind.apply(e,o));return r&&t(i,r.prototype),i},r.apply(null,arguments)}function o(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return "Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var a=Object.hasOwnProperty,s=Object.setPrototypeOf,c=Object.isFrozen,l=Object.getPrototypeOf,u=Object.getOwnPropertyDescriptor,p=Object.freeze,f=Object.seal,m=Object.create,d="undefined"!=typeof Reflect&&Reflect,h=d.apply,y=d.construct;h||(h=function(e,t,n){return e.apply(t,n)}),p||(p=function(e){return e}),f||(f=function(e){return e}),y||(y=function(e,t){return r(e,o(t))});var g,v=A(Array.prototype.forEach),b=A(Array.prototype.pop),x=A(Array.prototype.push),T=A(String.prototype.toLowerCase),w=A(String.prototype.match),k=A(String.prototype.replace),S=A(String.prototype.indexOf),N=A(String.prototype.trim),E=A(RegExp.prototype.test),M=(g=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y(g,t)});function A(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return h(e,t,r)}}function C(e,t,n){n=n||T,s&&s(e,null);for(var r=t.length;r--;){var o=t[r];if("string"==typeof o){var i=n(o);i!==o&&(c(t)||(t[r]=i),o=i);}e[o]=!0;}return e}function O(e){var t,n=m(null);for(t in e)h(a,e,[t])&&(n[t]=e[t]);return n}function L(e,t){for(;null!==e;){var n=u(e,t);if(n){if(n.get)return A(n.get);if("function"==typeof n.value)return A(n.value)}e=l(e);}return function(e){return console.warn("fallback value for",e),null}}var _=p(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),I=p(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),D=p(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),R=p(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),H=p(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),F=p(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),j=p(["#text"]),z=p(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),U=p(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),W=p(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),P=p(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),q=f(/\{\{[\w\W]*|[\w\W]*\}\}/gm),B=f(/<%[\w\W]*|[\w\W]*%>/gm),G=f(/^data-[\-\w.\u00B7-\uFFFF]/),$=f(/^aria-[\-\w]+$/),K=f(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Y=f(/^(?:\w+script|data):/i),V=f(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),X=f(/^html$/i),J=function(){return "undefined"==typeof window?null:window},Z=function(t,n){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;var r=null,o="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(o)&&(r=n.currentScript.getAttribute(o));var i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}};return function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:J(),r=function(e){return t(e)};if(r.version="2.4.0",r.removed=[],!n||!n.document||9!==n.document.nodeType)return r.isSupported=!1,r;var i=n.document,a=n.document,s=n.DocumentFragment,c=n.HTMLTemplateElement,l=n.Node,u=n.Element,f=n.NodeFilter,m=n.NamedNodeMap,d=void 0===m?n.NamedNodeMap||n.MozNamedAttrMap:m,h=n.HTMLFormElement,y=n.DOMParser,g=n.trustedTypes,A=u.prototype,Q=L(A,"cloneNode"),ee=L(A,"nextSibling"),te=L(A,"childNodes"),ne=L(A,"parentNode");if("function"==typeof c){var re=a.createElement("template");re.content&&re.content.ownerDocument&&(a=re.content.ownerDocument);}var oe=Z(g,i),ie=oe?oe.createHTML(""):"",ae=a,se=ae.implementation,ce=ae.createNodeIterator,le=ae.createDocumentFragment,ue=ae.getElementsByTagName,pe=i.importNode,fe={};try{fe=O(a).documentMode?a.documentMode:{};}catch(e){}var me={};r.isSupported="function"==typeof ne&&se&&void 0!==se.createHTMLDocument&&9!==fe;var de,he,ye=q,ge=B,ve=G,be=$,xe=Y,Te=V,we=K,ke=null,Se=C({},[].concat(o(_),o(I),o(D),o(H),o(j))),Ne=null,Ee=C({},[].concat(o(z),o(U),o(W),o(P))),Me=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,Ce=null,Oe=!0,Le=!0,_e=!1,Ie=!1,De=!1,Re=!1,He=!1,Fe=!1,je=!1,ze=!1,Ue=!0,We=!1,Pe="user-content-",qe=!0,Be=!1,Ge={},$e=null,Ke=C({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ye=null,Ve=C({},["audio","video","img","source","image","track"]),Xe=null,Je=C({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ze="http://www.w3.org/1998/Math/MathML",Qe="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml",tt=et,nt=!1,rt=["application/xhtml+xml","text/html"],ot="text/html",it=null,at=a.createElement("form"),st=function(e){return e instanceof RegExp||e instanceof Function},ct=function(t){it&&it===t||(t&&"object"===e(t)||(t={}),t=O(t),de=de=-1===rt.indexOf(t.PARSER_MEDIA_TYPE)?ot:t.PARSER_MEDIA_TYPE,he="application/xhtml+xml"===de?function(e){return e}:T,ke="ALLOWED_TAGS"in t?C({},t.ALLOWED_TAGS,he):Se,Ne="ALLOWED_ATTR"in t?C({},t.ALLOWED_ATTR,he):Ee,Xe="ADD_URI_SAFE_ATTR"in t?C(O(Je),t.ADD_URI_SAFE_ATTR,he):Je,Ye="ADD_DATA_URI_TAGS"in t?C(O(Ve),t.ADD_DATA_URI_TAGS,he):Ve,$e="FORBID_CONTENTS"in t?C({},t.FORBID_CONTENTS,he):Ke,Ae="FORBID_TAGS"in t?C({},t.FORBID_TAGS,he):{},Ce="FORBID_ATTR"in t?C({},t.FORBID_ATTR,he):{},Ge="USE_PROFILES"in t&&t.USE_PROFILES,Oe=!1!==t.ALLOW_ARIA_ATTR,Le=!1!==t.ALLOW_DATA_ATTR,_e=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Ie=t.SAFE_FOR_TEMPLATES||!1,De=t.WHOLE_DOCUMENT||!1,Fe=t.RETURN_DOM||!1,je=t.RETURN_DOM_FRAGMENT||!1,ze=t.RETURN_TRUSTED_TYPE||!1,He=t.FORCE_BODY||!1,Ue=!1!==t.SANITIZE_DOM,We=t.SANITIZE_NAMED_PROPS||!1,qe=!1!==t.KEEP_CONTENT,Be=t.IN_PLACE||!1,we=t.ALLOWED_URI_REGEXP||we,tt=t.NAMESPACE||et,t.CUSTOM_ELEMENT_HANDLING&&st(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Me.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&st(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Me.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Me.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ie&&(Le=!1),je&&(Fe=!0),Ge&&(ke=C({},o(j)),Ne=[],!0===Ge.html&&(C(ke,_),C(Ne,z)),!0===Ge.svg&&(C(ke,I),C(Ne,U),C(Ne,P)),!0===Ge.svgFilters&&(C(ke,D),C(Ne,U),C(Ne,P)),!0===Ge.mathMl&&(C(ke,H),C(Ne,W),C(Ne,P))),t.ADD_TAGS&&(ke===Se&&(ke=O(ke)),C(ke,t.ADD_TAGS,he)),t.ADD_ATTR&&(Ne===Ee&&(Ne=O(Ne)),C(Ne,t.ADD_ATTR,he)),t.ADD_URI_SAFE_ATTR&&C(Xe,t.ADD_URI_SAFE_ATTR,he),t.FORBID_CONTENTS&&($e===Ke&&($e=O($e)),C($e,t.FORBID_CONTENTS,he)),qe&&(ke["#text"]=!0),De&&C(ke,["html","head","body"]),ke.table&&(C(ke,["tbody"]),delete Ae.tbody),p&&p(t),it=t);},lt=C({},["mi","mo","mn","ms","mtext"]),ut=C({},["foreignobject","desc","title","annotation-xml"]),pt=C({},["title","style","font","a","script"]),ft=C({},I);C(ft,D),C(ft,R);var mt=C({},H);C(mt,F);var dt=function(e){var t=ne(e);t&&t.tagName||(t={namespaceURI:et,tagName:"template"});var n=T(e.tagName),r=T(t.tagName);return e.namespaceURI===Qe?t.namespaceURI===et?"svg"===n:t.namespaceURI===Ze?"svg"===n&&("annotation-xml"===r||lt[r]):Boolean(ft[n]):e.namespaceURI===Ze?t.namespaceURI===et?"math"===n:t.namespaceURI===Qe?"math"===n&&ut[r]:Boolean(mt[n]):e.namespaceURI===et&&!(t.namespaceURI===Qe&&!ut[r])&&!(t.namespaceURI===Ze&&!lt[r])&&!mt[n]&&(pt[n]||!ft[n])},ht=function(e){x(r.removed,{element:e});try{e.parentNode.removeChild(e);}catch(t){try{e.outerHTML=ie;}catch(t){e.remove();}}},yt=function(e,t){try{x(r.removed,{attribute:t.getAttributeNode(e),from:t});}catch(e){x(r.removed,{attribute:null,from:t});}if(t.removeAttribute(e),"is"===e&&!Ne[e])if(Fe||je)try{ht(t);}catch(e){}else try{t.setAttribute(e,"");}catch(e){}},gt=function(e){var t,n;if(He)e="<remove></remove>"+e;else {var r=w(e,/^[\r\n\t ]+/);n=r&&r[0];}"application/xhtml+xml"===de&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var o=oe?oe.createHTML(e):e;if(tt===et)try{t=(new y).parseFromString(o,de);}catch(e){}if(!t||!t.documentElement){t=se.createDocument(tt,"template",null);try{t.documentElement.innerHTML=nt?"":o;}catch(e){}}var i=t.body||t.documentElement;return e&&n&&i.insertBefore(a.createTextNode(n),i.childNodes[0]||null),tt===et?ue.call(t,De?"html":"body")[0]:De?t.documentElement:i},vt=function(e){return ce.call(e.ownerDocument||e,e,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT,null,!1)},bt=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},xt=function(t){return "object"===e(l)?t instanceof l:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},Tt=function(e,t,n){me[e]&&v(me[e],(function(e){e.call(r,t,n,it);}));},wt=function(e){var t;if(Tt("beforeSanitizeElements",e,null),bt(e))return ht(e),!0;if(E(/[\u0080-\uFFFF]/,e.nodeName))return ht(e),!0;var n=he(e.nodeName);if(Tt("uponSanitizeElement",e,{tagName:n,allowedTags:ke}),e.hasChildNodes()&&!xt(e.firstElementChild)&&(!xt(e.content)||!xt(e.content.firstElementChild))&&E(/<[/\w]/g,e.innerHTML)&&E(/<[/\w]/g,e.textContent))return ht(e),!0;if("select"===n&&E(/<template/i,e.innerHTML))return ht(e),!0;if(!ke[n]||Ae[n]){if(!Ae[n]&&St(n)){if(Me.tagNameCheck instanceof RegExp&&E(Me.tagNameCheck,n))return !1;if(Me.tagNameCheck instanceof Function&&Me.tagNameCheck(n))return !1}if(qe&&!$e[n]){var o=ne(e)||e.parentNode,i=te(e)||e.childNodes;if(i&&o)for(var a=i.length-1;a>=0;--a)o.insertBefore(Q(i[a],!0),ee(e));}return ht(e),!0}return e instanceof u&&!dt(e)?(ht(e),!0):"noscript"!==n&&"noembed"!==n||!E(/<\/no(script|embed)/i,e.innerHTML)?(Ie&&3===e.nodeType&&(t=e.textContent,t=k(t,ye," "),t=k(t,ge," "),e.textContent!==t&&(x(r.removed,{element:e.cloneNode()}),e.textContent=t)),Tt("afterSanitizeElements",e,null),!1):(ht(e),!0)},kt=function(e,t,n){if(Ue&&("id"===t||"name"===t)&&(n in a||n in at))return !1;if(Le&&!Ce[t]&&E(ve,t));else if(Oe&&E(be,t));else if(!Ne[t]||Ce[t]){if(!(St(e)&&(Me.tagNameCheck instanceof RegExp&&E(Me.tagNameCheck,e)||Me.tagNameCheck instanceof Function&&Me.tagNameCheck(e))&&(Me.attributeNameCheck instanceof RegExp&&E(Me.attributeNameCheck,t)||Me.attributeNameCheck instanceof Function&&Me.attributeNameCheck(t))||"is"===t&&Me.allowCustomizedBuiltInElements&&(Me.tagNameCheck instanceof RegExp&&E(Me.tagNameCheck,n)||Me.tagNameCheck instanceof Function&&Me.tagNameCheck(n))))return !1}else if(Xe[t]);else if(E(we,k(n,Te,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==S(n,"data:")||!Ye[e])if(_e&&!E(xe,k(n,Te,"")));else if(n)return !1;return !0},St=function(e){return e.indexOf("-")>0},Nt=function(t){var n,o,i,a;Tt("beforeSanitizeAttributes",t,null);var s=t.attributes;if(s){var c={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ne};for(a=s.length;a--;){var l=n=s[a],u=l.name,p=l.namespaceURI;if(o="value"===u?n.value:N(n.value),i=he(u),c.attrName=i,c.attrValue=o,c.keepAttr=!0,c.forceKeepAttr=void 0,Tt("uponSanitizeAttribute",t,c),o=c.attrValue,!c.forceKeepAttr&&(yt(u,t),c.keepAttr))if(E(/\/>/i,o))yt(u,t);else {Ie&&(o=k(o,ye," "),o=k(o,ge," "));var f=he(t.nodeName);if(kt(f,i,o)){if(!We||"id"!==i&&"name"!==i||(yt(u,t),o=Pe+o),oe&&"object"===e(g)&&"function"==typeof g.getAttributeType)if(p);else switch(g.getAttributeType(f,i)){case"TrustedHTML":o=oe.createHTML(o);break;case"TrustedScriptURL":o=oe.createScriptURL(o);}try{p?t.setAttributeNS(p,u,o):t.setAttribute(u,o),b(r.removed);}catch(e){}}}}Tt("afterSanitizeAttributes",t,null);}},Et=function e(t){var n,r=vt(t);for(Tt("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)Tt("uponSanitizeShadowNode",n,null),wt(n)||(n.content instanceof s&&e(n.content),Nt(n));Tt("afterSanitizeShadowDOM",t,null);};return r.sanitize=function(t){var o,a,c,u,p,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((nt=!t)&&(t="\x3c!--\x3e"),"string"!=typeof t&&!xt(t)){if("function"!=typeof t.toString)throw M("toString is not a function");if("string"!=typeof(t=t.toString()))throw M("dirty is not a string, aborting")}if(!r.isSupported){if("object"===e(n.toStaticHTML)||"function"==typeof n.toStaticHTML){if("string"==typeof t)return n.toStaticHTML(t);if(xt(t))return n.toStaticHTML(t.outerHTML)}return t}if(Re||ct(f),r.removed=[],"string"==typeof t&&(Be=!1),Be){if(t.nodeName){var m=he(t.nodeName);if(!ke[m]||Ae[m])throw M("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof l)1===(a=(o=gt("\x3c!----\x3e")).ownerDocument.importNode(t,!0)).nodeType&&"BODY"===a.nodeName||"HTML"===a.nodeName?o=a:o.appendChild(a);else {if(!Fe&&!Ie&&!De&&-1===t.indexOf("<"))return oe&&ze?oe.createHTML(t):t;if(!(o=gt(t)))return Fe?null:ze?ie:""}o&&He&&ht(o.firstChild);for(var d=vt(Be?t:o);c=d.nextNode();)3===c.nodeType&&c===u||wt(c)||(c.content instanceof s&&Et(c.content),Nt(c),u=c);if(u=null,Be)return t;if(Fe){if(je)for(p=le.call(o.ownerDocument);o.firstChild;)p.appendChild(o.firstChild);else p=o;return Ne.shadowroot&&(p=pe.call(i,p,!0)),p}var h=De?o.outerHTML:o.innerHTML;return De&&ke["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&E(X,o.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+h),Ie&&(h=k(h,ye," "),h=k(h,ge," ")),oe&&ze?oe.createHTML(h):h},r.setConfig=function(e){ct(e),Re=!0;},r.clearConfig=function(){it=null,Re=!1;},r.isValidAttribute=function(e,t,n){it||ct({});var r=he(e),o=he(t);return kt(r,o,n)},r.addHook=function(e,t){"function"==typeof t&&(me[e]=me[e]||[],x(me[e],t));},r.removeHook=function(e){if(me[e])return b(me[e])},r.removeHooks=function(e){me[e]&&(me[e]=[]);},r.removeAllHooks=function(){me={};},r}()}();},138:(e,t,n)=>{var r=n(55);e.exports=function(e){var t,n="",o=e||{};return function(e,o){n=n+"<div"+r.attr("class",r.classes([`${o["context-menu"]}`],[!0]),!1,!0)+"> ",function(){var i=e;if("number"==typeof i.length)for(var a=0,s=i.length;a<s;a++)"hr"===(c=i[a])?n+="<hr>":(n=n+"<div"+r.attr("id",`context-menu-item-${c._id}`,!0,!0)+"> ",(c.iconClass||c.iconHTML)&&(n=n+"<span"+r.attr("class",r.classes([`${o["menu-item-icon"]}`],[!0]),!1,!0)+">",c.iconClass&&(n=n+"<i"+r.attr("class",r.classes([`${c.iconClass}`],[!0]),!1,!0)+"></i>"),c.iconHTML&&(n+=null==(t=c.iconHTML)?"":t),n+="</span>"),n=n+"<span>"+r.escape(null==(t=c.label)?"":t)+"</span>",c.nestedMenu&&(n=n+"<span"+r.attr("class",r.classes([`${o["nested-menu-arrow"]}`],[!0]),!1,!0)+">&#x203A;</span>"),n+="</div>");else for(var a in s=0,i){var c;s++,"hr"===(c=i[a])?n+="<hr>":(n=n+"<div"+r.attr("id",`context-menu-item-${c._id}`,!0,!0)+"> ",(c.iconClass||c.iconHTML)&&(n=n+"<span"+r.attr("class",r.classes([`${o["menu-item-icon"]}`],[!0]),!1,!0)+">",c.iconClass&&(n=n+"<i"+r.attr("class",r.classes([`${c.iconClass}`],[!0]),!1,!0)+"></i>"),c.iconHTML&&(n+=null==(t=c.iconHTML)?"":t),n+="</span>"),n=n+"<span>"+r.escape(null==(t=c.label)?"":t)+"</span>",c.nestedMenu&&(n=n+"<span"+r.attr("class",r.classes([`${o["nested-menu-arrow"]}`],[!0]),!1,!0)+">&#x203A;</span>"),n+="</div>");}}.call(this),n+="</div>";}.call(this,"menuItems"in o?o.menuItems:"undefined"!=typeof menuItems?menuItems:void 0,"style"in o?o.style:"undefined"!=typeof style?style:void 0),n};},55:(e,t,n)=>{var r=Object.prototype.hasOwnProperty;function o(e,t){return Array.isArray(e)?function(e,t){for(var n,r="",i="",a=Array.isArray(t),s=0;s<e.length;s++)(n=o(e[s]))&&(a&&t[s]&&(n=c(n)),r=r+i+n,i=" ");return r}(e,t):e&&"object"==typeof e?function(e){var t="",n="";for(var o in e)o&&e[o]&&r.call(e,o)&&(t=t+n+o,n=" ");return t}(e):e||""}function i(e){if(!e)return "";if("object"==typeof e){var t="";for(var n in e)r.call(e,n)&&(t=t+n+":"+e[n]+";");return t}return e+""}function a(e,t,n,r){if(!1===t||null==t||!t&&("class"===e||"style"===e))return "";if(!0===t)return " "+(r?e:e+'="'+e+'"');var o=typeof t;return "object"!==o&&"function"!==o||"function"!=typeof t.toJSON||(t=t.toJSON()),"string"==typeof t||(t=JSON.stringify(t),n||-1===t.indexOf('"'))?(n&&(t=c(t))," "+e+'="'+t+'"'):" "+e+"='"+t.replace(/'/g,"&#39;")+"'"}t.merge=function e(t,n){if(1===arguments.length){for(var r=t[0],o=1;o<t.length;o++)r=e(r,t[o]);return r}for(var a in n)if("class"===a){var s=t[a]||[];t[a]=(Array.isArray(s)?s:[s]).concat(n[a]||[]);}else if("style"===a){s=(s=i(t[a]))&&";"!==s[s.length-1]?s+";":s;var c=i(n[a]);c=c&&";"!==c[c.length-1]?c+";":c,t[a]=s+c;}else t[a]=n[a];return t},t.classes=o,t.style=i,t.attr=a,t.attrs=function(e,t){var n="";for(var s in e)if(r.call(e,s)){var c=e[s];if("class"===s){n=a(s,c=o(c),!1,t)+n;continue}"style"===s&&(c=i(c)),n+=a(s,c,!1,t);}return n};var s=/["&<>]/;function c(e){var t=""+e,n=s.exec(t);if(!n)return e;var r,o,i,a="";for(r=n.index,o=0;r<t.length;r++){switch(t.charCodeAt(r)){case 34:i="&quot;";break;case 38:i="&amp;";break;case 60:i="&lt;";break;case 62:i="&gt;";break;default:continue}o!==r&&(a+=t.substring(o,r)),o=r+1,a+=i;}return o!==r?a+t.substring(o,r):a}t.escape=c,t.rethrow=function e(t,r,o,i){if(!(t instanceof Error))throw t;if(!("undefined"==typeof window&&r||i))throw t.message+=" on line "+o,t;var a,s,c,l;try{i=i||n(835).readFileSync(r,{encoding:"utf8"}),a=3,s=i.split("\n"),c=Math.max(o-a,0),l=Math.min(s.length,o+a);}catch(n){return t.message+=" - could not read from "+r+" ("+n.message+")",void e(t,null,o)}a=s.slice(c,l).map((function(e,t){var n=t+c+1;return (n==o?" > ":" ")+n+"| "+e})).join("\n"),t.path=r;try{t.message=(r||"Pug")+":"+o+"\n"+a+"\n\n"+t.message;}catch(e){}throw t};},379:e=>{var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var i={},a=[],s=0;s<e.length;s++){var c=e[s],l=r.base?c[0]+r.base:c[0],u=i[l]||0,p="".concat(l," ").concat(u);i[l]=u+1;var f=n(p),m={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==f)t[f].references++,t[f].updater(m);else {var d=o(m,r);r.byIndex=s,t.splice(s,0,{identifier:p,updater:d,references:1});}a.push(p);}return a}function o(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t);}else n.remove();}}e.exports=function(e,o){var i=r(e=e||[],o=o||{});return function(e){e=e||[];for(var a=0;a<i.length;a++){var s=n(i[a]);t[s].references--;}for(var c=r(e,o),l=0;l<i.length;l++){var u=n(i[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1));}i=c;}};},569:e=>{var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head;}catch(e){n=null;}t[e]=n;}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n);};},216:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t};},565:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t);};},795:e=>{e.exports=function(e){var t=e.insertStyleElement(e);return {update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options);}(t,e,n);},remove:function(){!function(e){if(null===e.parentNode)return !1;e.parentNode.removeChild(e);}(t);}}};},589:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else {for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e));}};},835:()=>{}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]});},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.nc=void 0;var r={};return (()=>{n.d(r,{default:()=>U});var e=n(856),t=n(379),o=n.n(t),i=n(795),a=n.n(i),s=n(569),c=n.n(s),l=n(565),u=n.n(l),p=n(216),f=n.n(p),m=n(589),d=n.n(m),h=n(550),y={};y.styleTagTransform=d(),y.setAttributes=u(),y.insert=c().bind(null,"head"),y.domAPI=a(),y.insertStyleElement=f(),o()(h.Z,y);const g=h.Z&&h.Z.locals?h.Z.locals:void 0;var v=n(138),b=n.n(v);function x(e,t,n){const{x:r,y:o}=e,{left:i,top:a}=n.getBoundingClientRect(),s=o-a,c=r-i+t.clientWidth>n.clientWidth,l=s+t.clientHeight>n.clientHeight;let u=r,p=o;return c&&(u=i+n.clientWidth-t.clientWidth),l&&(p=a+n.clientHeight-t.clientHeight),{normalizedX:u,normalizedY:p}}var T,w,k,S,N,E,M,A,C,O,L,_,I,D,R,H,F=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return "m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class j{constructor(){T.add(this),w.set(this,{style:g,menuItems:[]}),k.set(this,{transformOrigin:["top","left"]}),S.set(this,{theme:"black",transitionDuration:200}),this.options={},N.set(this,(t=>t.map((t=>("object"==typeof t&&t.hasOwnProperty("iconHTML")&&(t.iconHTML=(0, e.sanitize)(t.iconHTML)),t))))),this.applyStyleOnContextMenu=(e,t,n)=>{e.style.transitionDuration=`${this.options.transitionDuration}ms`;const r=Array.from(this.options.transformOrigin);t&&(r[1]="right"),n&&(r[0]="bottom"),e.style.transformOrigin=r.join(" "),this.options.customThemeClass?e.classList.add(this.options.customThemeClass):e.classList.add(g[`context-menu--${this.options.theme}-theme`]),this.options.customClass&&e.classList.add(this.options.customClass);},this.buildContextMenu=()=>{const e=document.createElement("div");return e.innerHTML=b()(F(this,w,"f")),e.children[0]};}updateOptions(e){const t=F(this,N,"f").call(this,e.menuItems),n=F(this,T,"m",E).call(this,t);F(this,T,"m",M).call(this,n),Object.assign(this.options,F(this,S,"f")),Object.assign(this.options,Object.assign(Object.assign({},e),{menuItems:n})),Object.assign(this.options,F(this,k,"f")),F(this,w,"f").menuItems=this.options.menuItems;}}w=new WeakMap,k=new WeakMap,S=new WeakMap,N=new WeakMap,T=new WeakSet,E=function(e){return e.filter((e=>"object"==typeof e&&e.hasOwnProperty("nestedMenu"))).map((e=>{const t=e.callback;e.callback=n=>{t&&t(n),new z(Object.assign(Object.assign({},this.options),{menuItems:e.nestedMenu}),n,document.getElementById(`context-menu-item-${e._id}`));};})),e},M=function e(t){t.filter((e=>"object"==typeof e)).forEach(((t,n)=>{t._id=Date.now()+n,t.nestedMenu&&F(this,T,"m",e).call(this,t.nestedMenu);}));};class z extends j{constructor(e,t,n){super(),A.add(this),C.set(this,(()=>{var e;null===(e=document.querySelector(`.${g["context-menu"]}.nested-context-menu`))||void 0===e||e.remove();})),O.set(this,(e=>{this.options.menuItems.forEach(((t,n)=>{"hr"!==t&&t.callback&&(e.children[n].onclick=()=>{var e,n,r;t.callback(this.initialContextMenuEvent),null!==(n=null!==(e=t.preventCloseOnClick)&&void 0!==e?e:this.options.preventCloseOnClick)&&void 0!==n&&n||(F(this,C,"f").call(this),null===(r=document.querySelector(`.${g["context-menu"]}`))||void 0===r||r.remove());});}));})),this.updateOptions(e),F(this,A,"m",L).call(this,t,n);}}C=new WeakMap,O=new WeakMap,A=new WeakSet,L=function(e,t){this.initialContextMenuEvent=e,F(this,C,"f").call(this);const n=this.buildContextMenu();n.classList.add("nested-context-menu"),document.querySelector("body").append(n),this.applyStyleOnContextMenu(n,!1,!1);const{x:r,y:o}=t.getBoundingClientRect();let{normalizedX:i,normalizedY:a}=x({x:r,y:o},n,this.options.scope);i+=n.clientWidth,n.style.top=`${a}px`,n.style.left=`${i}px`,n.oncontextmenu=e=>e.preventDefault(),F(this,O,"f").call(this,n),setTimeout((()=>{n.classList.add(g.visible);}));};class U extends j{constructor(e){super(),_.set(this,(()=>{var e;F(this,I,"f").call(this),null===(e=document.querySelector(`.${g["context-menu"]}`))||void 0===e||e.remove();})),I.set(this,(()=>{document.querySelectorAll(`.${g["context-menu"]}.nested-context-menu`).forEach((e=>e.remove()));})),D.set(this,(e=>{this.options.menuItems.forEach(((t,n)=>{"hr"!==t&&t.callback&&(e.children[n].onclick=()=>{var e,n;t.callback(this.initialContextMenuEvent),null!==(n=null!==(e=t.preventCloseOnClick)&&void 0!==e?e:this.options.preventCloseOnClick)&&void 0!==n&&n||F(this,_,"f").call(this);});}));})),R.set(this,(e=>{e.preventDefault(),e.stopPropagation(),this.initialContextMenuEvent=e,F(this,_,"f").call(this);const t=this.buildContextMenu();document.querySelector("body").append(t);const{clientX:n,clientY:r}=e,{normalizedX:o,normalizedY:i}=x({x:n,y:r},t,this.options.scope);t.style.top=`${i}px`,t.style.left=`${o}px`,this.applyStyleOnContextMenu(t,n!==o,r!==i),t.oncontextmenu=e=>e.preventDefault(),F(this,D,"f").call(this,t),setTimeout((()=>{t.classList.add(g.visible);}));})),H.set(this,(e=>{e.target.closest(`.${g["context-menu"]}`)||F(this,_,"f").call(this);})),this.updateOptions(e),this.options.scope.oncontextmenu=F(this,R,"f"),document.addEventListener("click",F(this,H,"f"));}off(){document.removeEventListener("click",F(this,H,"f")),this.options.scope.oncontextmenu=null;}}_=new WeakMap,I=new WeakMap,D=new WeakMap,R=new WeakMap,H=new WeakMap;})(),r.default})()));
30
+ });
31
+
32
+ const VanillaContextMenu = /*@__PURE__*/getDefaultExportFromCjs(vanillaContextMenu);
33
+
7
34
  function deepClone(obj) {
8
35
  return JSON.parse(JSON.stringify(obj));
9
36
  }
@@ -18,8 +45,10 @@ function uniq(arr) {
18
45
  }, []);
19
46
  }
20
47
  function empty(ele) {
21
- while (ele.firstChild) {
22
- ele.removeChild(ele.firstChild);
48
+ if (ele && ele.firstChild) {
49
+ while (ele.firstChild) {
50
+ ele.removeChild(ele.firstChild);
51
+ }
23
52
  }
24
53
  }
25
54
  function animation(duration, callback) {
@@ -126,8 +155,10 @@ Tree.prototype.render = function (treeNodes) {
126
155
  catch (_a) {
127
156
  ele = this.container;
128
157
  }
129
- empty(ele);
130
- ele.appendChild(treeEle);
158
+ if (ele) {
159
+ empty(ele);
160
+ ele.appendChild(treeEle);
161
+ }
131
162
  };
132
163
  Tree.prototype.buildTree = function (nodes, depth) {
133
164
  const rootUlEle = this.createUlEle();
@@ -146,75 +177,85 @@ Tree.prototype.buildTree = function (nodes, depth) {
146
177
  return rootUlEle;
147
178
  };
148
179
  Tree.prototype.bindEvent = function (ele) {
149
- let parentOptions = {};
150
- try {
151
- parentOptions = JSON.parse(this.options.parentApi.theOptions);
180
+ var _a;
181
+ // let parentOptions:any = {};
182
+ // try{
183
+ // parentOptions = JSON.parse(this.options.parentApi.theOptions);
184
+ // }
185
+ // catch {
186
+ // parentOptions = this.options.parentApi.theOptions;
187
+ // }
188
+ // @ts-ignore
189
+ function getLi(target) {
190
+ return target.classList.contains('treejs-node') ? target : target.closest('.treejs-node');
152
191
  }
153
- catch (_a) {
154
- parentOptions = this.options.parentApi.theOptions;
192
+ if (!this.options.parentApi.isDisabled) {
193
+ const contextMenu = this.options.parentApi.theOptions.contextMenu;
194
+ if ((_a = contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.items) === null || _a === void 0 ? void 0 : _a.length) {
195
+ new VanillaContextMenu(Object.assign(Object.assign({}, contextMenu), { scope: ele, menuItems: contextMenu.items.map(item => {
196
+ return typeof item === 'string'
197
+ ? item
198
+ : Object.assign(Object.assign({}, item), { callback: e => {
199
+ const target = getLi(e.target);
200
+ this.options.parentApi.onItemContextMenuItemClick(Object.assign(Object.assign({}, e), { target, contextMenuItem: item }));
201
+ } });
202
+ }) }));
203
+ }
155
204
  }
156
- // if (!this.options.parentApi.theOptions.readonly){
157
- // const contextMenu = this.options.parentApi.theOptions.contextMenu;
158
- // if (contextMenu?.items?.length) {
159
- // new VanillaContextMenu({
160
- // ...contextMenu,
161
- // scope: ele,
162
- // menuItems: contextMenu.items.map(item => {
163
- // return typeof item === 'string'
164
- // ? item
165
- // : {
166
- // ...item,
167
- // callback: e => {
168
- // const target = getLi(e.target);
169
- // this.options.parentApi.onItemContextMenuItemClick({ ...e, target, contextMenuItem: item });
170
- // },
171
- // };
172
- // }),
173
- // });
174
- // }
175
- // }
176
205
  ele.addEventListener('click', e => {
177
- if (!parentOptions.readonly) {
178
- const { target } = e;
179
- if (target.nodeName === 'SPAN' && (target.classList.contains('treejs-checkbox') || target.classList.contains('treejs-label'))) {
180
- this.onItemClick(target.parentNode.nodeId);
181
- }
182
- else if (target.nodeName === 'LI' && target.classList.contains('treejs-node')) {
183
- this.onItemClick(target.nodeId);
184
- }
185
- else if (target.nodeName === 'SPAN' && target.classList.contains('treejs-switcher')) {
186
- this.onSwitcherClick(target);
187
- }
188
- //CUSTOM
189
- const childspans = Array.prototype.slice.call(e.target.parentNode.querySelectorAll('ul > li > span'));
190
- let hasUndefinedchild = [];
191
- //This may be a problem the day a node value is "undefined"
192
- hasUndefinedchild = childspans.filter(ele => {
193
- return ele.textContent === 'undefined';
194
- });
195
- // If the user clicked on an unloaded node
196
- if (target.nodeName === 'SPAN' && target.classList.contains('treejs-switcher') && hasUndefinedchild.length > 0) {
197
- // Clear the subnode HTML
198
- e.target.parentNode.querySelector('ul').innerHTML = '';
199
- // If source is webservice (it shouldn't be something else)
200
- if (parentOptions.source == 'webservice') {
206
+ const { target } = e;
207
+ if (target.nodeName === 'SPAN' && (target.classList.contains('treejs-checkbox') || target.classList.contains('treejs-label'))) {
208
+ this.onItemClick(target.parentNode.nodeId);
209
+ }
210
+ else if (target.nodeName === 'LI' && target.classList.contains('treejs-node')) {
211
+ this.onItemClick(target.nodeId);
212
+ }
213
+ else if (target.nodeName === 'SPAN' && target.classList.contains('treejs-switcher')) {
214
+ this.onSwitcherClick(target);
215
+ }
216
+ //CUSTOM
217
+ const childspans = Array.prototype.slice.call(e.target.parentNode.querySelectorAll('ul > li > span'));
218
+ let hasUndefinedchild = [];
219
+ //This may be a problem the day a node value is "undefined"
220
+ hasUndefinedchild = childspans.filter(ele => {
221
+ return ele.textContent === 'undefined';
222
+ });
223
+ // If the user clicked on an unloaded node
224
+ if (target.nodeName === 'SPAN' && target.classList.contains('treejs-switcher') && hasUndefinedchild.length > 0) {
225
+ // Clear the subnode HTML
226
+ e.target.parentNode.querySelector('ul').innerHTML = '';
227
+ // If source is webservice (it shouldn't be something else)
228
+ if (this.options.parentApi.theOptions.source == 'webservice') {
229
+ if (this.options.parentApi.theOptions.origin == 'classification') {
201
230
  // WS Call
202
231
  this.options.parentApi
203
- .getDataFromSource(parentOptions.url, {
232
+ .getDataFromSourceClassification(this.options.parentApi.theOptions.url, {
233
+ startNode: target.parentNode.nodeId
234
+ })
235
+ .then(data => {
236
+ this.options.parentApi.completeCurrentTreeWithTree(data, target.parentNode.nodeId);
237
+ });
238
+ }
239
+ else {
240
+ // WS Call
241
+ this.options.parentApi
242
+ .getDataFromSource(this.options.parentApi.theOptions.url, {
204
243
  StartNodeID: target.parentNode.nodeId,
205
- lng: parentOptions.options.lng,
206
- IsDeprecated: parentOptions.options.IsDeprecated,
244
+ lng: this.options.parentApi.theOptions.options.lng,
245
+ IsDeprecated: this.options.parentApi.theOptions.options.IsDeprecated,
207
246
  })
208
247
  .then(data => {
209
248
  this.options.parentApi.completeCurrentTreeWithTree(data);
210
249
  });
211
250
  }
212
- this.onSwitcherClick(target);
213
251
  }
252
+ this.onSwitcherClick(target);
214
253
  }
215
254
  }, false);
216
255
  };
217
256
  Tree.prototype.onItemClick = function (id) {
257
+ if (this.options.parentApi.isDisabled)
258
+ return;
218
259
  if (!this.options.parentApi.theOptions.multiple)
219
260
  this.emptyNodesCheckStatus();
220
261
  this.options.parentApi.setNodeAsSelected(id, this, true);
@@ -536,22 +577,6 @@ Tree.prototype.createLiEle = function (node, closed) {
536
577
  return li;
537
578
  };
538
579
 
539
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
540
-
541
- function createCommonjsModule(fn, basedir, module) {
542
- return module = {
543
- path: basedir,
544
- exports: {},
545
- require: function (path, base) {
546
- return commonjsRequire();
547
- }
548
- }, fn(module, module.exports), module.exports;
549
- }
550
-
551
- function commonjsRequire () {
552
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
553
- }
554
-
555
580
  var lodash = createCommonjsModule(function (module, exports) {
556
581
  (function() {
557
582
 
@@ -17853,7 +17878,7 @@ const HierarchizedPickerComponent = class {
17853
17878
  }
17854
17879
  isChangeInOptions(newV, oldV) {
17855
17880
  const isEqual = lodash.isEqual(newV, oldV);
17856
- const changeDefaultValue = !(newV.defaultValue.length == oldV.defaultValue.length && newV.defaultValue.every((value) => oldV.defaultValue.includes(value)));
17881
+ const changeDefaultValue = !(newV.defaultValue.length == oldV.defaultValue.length && newV.defaultValue.every(value => oldV.defaultValue.includes(value)));
17857
17882
  if (!isEqual && changeDefaultValue) {
17858
17883
  return changeDefaultValue;
17859
17884
  }
@@ -17875,12 +17900,13 @@ const HierarchizedPickerComponent = class {
17875
17900
  this.errorToLog = "options.source value '" + object.source + "' doesn't meet interface IConf requirements";
17876
17901
  }
17877
17902
  else {
17878
- if (!((object.source != 'webservice') || (object.source == 'webservice' && object.url && typeof object.url == 'string'))) {
17903
+ if (!(object.source != 'webservice' || (object.source == 'webservice' && object.url && typeof object.url == 'string'))) {
17879
17904
  toret = false;
17880
17905
  this.errorToLog = "options.url value '" + object.url + "' doesn't meet interface IConf requirements, is wrongly formated or doesn't match option.source value";
17881
17906
  }
17882
17907
  //TODO allow Function along with string
17883
- if (!((object.source != 'webservice' && !object.token) || (object.source == 'webservice' && object.token && (typeof object.token == 'string' || typeof object.token == 'function')))) {
17908
+ if (!((object.source != 'webservice' && !object.token) ||
17909
+ (object.source == 'webservice' && object.token && (typeof object.token == 'string' || typeof object.token == 'function')))) {
17884
17910
  toret = false;
17885
17911
  this.errorToLog = "options.token value doesn't meet interface IConf requirements or doesn't match option.source value :: typeof object.token == " + typeof object.token;
17886
17912
  }
@@ -17892,38 +17918,38 @@ const HierarchizedPickerComponent = class {
17892
17918
  toret = false;
17893
17919
  this.errorToLog = "options.data value doesn't meet interface IConf requirements or doesn't match option.source value";
17894
17920
  }
17895
- if (!((object.source != 'file') || (object.source == 'file' && object.url && typeof object.url == 'string'))) {
17921
+ if (!(object.source != 'file' || (object.source == 'file' && object.url && typeof object.url == 'string'))) {
17896
17922
  toret = false;
17897
17923
  this.errorToLog = "options.url value '" + object.url + "' doesn't meet interface IConf requirements or doesn't match option.source value";
17898
17924
  }
17899
17925
  }
17900
- if (!(typeof object.origin == 'string' && ['thesaurus', 'position'].indexOf(object.origin) > -1)) {
17926
+ if (!(typeof object.origin == 'string' && ['thesaurus', 'position', 'classification'].indexOf(object.origin) > -1)) {
17901
17927
  toret = false;
17902
17928
  this.errorToLog = "options.origin value '" + object.origin + "' doesn't meet interface IConf requirements";
17903
17929
  }
17904
- if (!((!object.output && typeof object.output != "boolean") || (typeof object.output == 'string' && ['fullpath', 'nodeid'].indexOf(object.output) > -1))) {
17930
+ if (!((!object.output && typeof object.output != 'boolean') || (typeof object.output == 'string' && ['fullpath', 'nodeid'].indexOf(object.output) > -1))) {
17905
17931
  toret = false;
17906
17932
  this.errorToLog = "options.output value '" + object.output + "' doesn't meet interface IConf requirements";
17907
17933
  }
17908
- if (!((!object.multiple && typeof object.multiple != "boolean") || typeof object.multiple == 'boolean')) {
17934
+ if (!((!object.multiple && typeof object.multiple != 'boolean') || typeof object.multiple == 'boolean')) {
17909
17935
  toret = false;
17910
17936
  this.errorToLog = "options.multiple value '" + object.multiple + "' doesn't meet interface IConf requirements";
17911
17937
  }
17912
- if (!((!object.mode && typeof object.mode != "boolean") || (typeof object.mode == 'string' && ['tree', 'input'].indexOf(object.mode) > -1))) {
17938
+ if (!((!object.mode && typeof object.mode != 'boolean') || (typeof object.mode == 'string' && ['tree', 'input'].indexOf(object.mode) > -1))) {
17913
17939
  this.errorToLog = "options.mode value '" + object.mode + "' doesn't meet interface IConf requirements";
17914
17940
  }
17915
17941
  if (!((!object.label && typeof object.label != "boolean") || typeof object.label == 'string')) {
17916
17942
  toret = false;
17917
17943
  this.errorToLog = "options.label value '" + object.label + "' doesn't meet interface IConf requirements";
17918
17944
  }
17919
- if (!((!object.searchPlaceholder && typeof object.searchPlaceholder != "boolean") || typeof object.searchPlaceholder == 'string')) {
17945
+ if (!((!object.searchPlaceholder && typeof object.searchPlaceholder != 'boolean') || typeof object.searchPlaceholder == 'string')) {
17920
17946
  toret = false;
17921
17947
  this.errorToLog = "options.searchPlaceholder value '" + object.searchPlaceholder + "' doesn't meet interface IConf requirements";
17922
17948
  }
17923
- if (!((!object.defaultValue && typeof object.defaultValue != "boolean") ||
17924
- ((typeof object.defaultValue == 'object' && (object.multiple == true || object.defaultValue.length <= 1)) ||
17925
- typeof object.defaultValue == 'string' ||
17926
- typeof object.defaultValue == 'number'))) {
17949
+ if (!((!object.defaultValue && typeof object.defaultValue != 'boolean') ||
17950
+ (typeof object.defaultValue == 'object' && (object.multiple == true || object.defaultValue.length <= 1)) ||
17951
+ typeof object.defaultValue == 'string' ||
17952
+ typeof object.defaultValue == 'number')) {
17927
17953
  toret = false;
17928
17954
  this.errorToLog = "options.defaultValue value '" + object.defaultValue + "' doesn't meet interface IConf requirements or doesn't match option.multiple value";
17929
17955
  }
@@ -17931,15 +17957,15 @@ const HierarchizedPickerComponent = class {
17931
17957
  toret = false;
17932
17958
  this.errorToLog = "readonly value '" + object.readonly + "' doesn't meet interface IConf requirements";
17933
17959
  }
17934
- if (!((!object.loading && typeof object.loading != "boolean") || (typeof object.loading == 'string' && ['display', 'click'].indexOf(object.loading) > -1))) {
17960
+ if (!((!object.loading && typeof object.loading != 'boolean') || (typeof object.loading == 'string' && ['display', 'click'].indexOf(object.loading) > -1))) {
17935
17961
  toret = false;
17936
17962
  this.errorToLog = "options.loading value '" + object.loading + "' doesn't meet interface IConf requirements";
17937
17963
  }
17938
- if (!((!object.displayTree && typeof object.displayTree != "boolean") || typeof object.displayTree == 'boolean')) {
17964
+ if (!((!object.displayTree && typeof object.displayTree != 'boolean') || typeof object.displayTree == 'boolean')) {
17939
17965
  toret = false;
17940
17966
  this.errorToLog = "options.displayTree value '" + object.displayTree + "' doesn't meet interface IConf requirements";
17941
17967
  }
17942
- if (!((!object.minDepth && typeof object.minDepth != "number") || typeof object.minDepth == 'number') || (object.maxDepth && object.maxDepth < object.minDepth)) {
17968
+ if (!((!object.minDepth && typeof object.minDepth != 'number') || typeof object.minDepth == 'number') || (object.maxDepth && object.maxDepth < object.minDepth)) {
17943
17969
  toret = false;
17944
17970
  this.errorToLog = "options.minDepth value '" + object.minDepth + "' doesn't meet interface IConf requirements or mismatches with maxDepth value";
17945
17971
  }
@@ -17947,15 +17973,15 @@ const HierarchizedPickerComponent = class {
17947
17973
  toret = false;
17948
17974
  this.errorToLog = "options.maxDepth value '" + object.maxDepth + "' doesn't meet interface IConf requirements or mismatches with minDepth value";
17949
17975
  }
17950
- if (!((!object.isFullpath && typeof object.isFullpath != "boolean") || typeof object.isFullpath == 'boolean')) {
17976
+ if (!((!object.isFullpath && typeof object.isFullpath != 'boolean') || typeof object.isFullpath == 'boolean')) {
17951
17977
  toret = false;
17952
17978
  this.errorToLog = "options.isFullpath value '" + object.isFullpath + "' doesn't meet interface IConf requirements";
17953
17979
  }
17954
- if (!((!object.showAutocomplete && typeof object.showAutocomplete != "boolean") || typeof object.showAutocomplete == 'boolean')) {
17980
+ if (!((!object.showAutocomplete && typeof object.showAutocomplete != 'boolean') || typeof object.showAutocomplete == 'boolean')) {
17955
17981
  toret = false;
17956
17982
  this.errorToLog = "options.showAutocomplete value '" + object.showAutocomplete + "' doesn't meet interface IConf requirements";
17957
17983
  }
17958
- if (!((!object.openTreeWhenLoaded && typeof object.openTreeWhenLoaded != "boolean") || typeof object.openTreeWhenLoaded == 'boolean')) {
17984
+ if (!((!object.openTreeWhenLoaded && typeof object.openTreeWhenLoaded != 'boolean') || typeof object.openTreeWhenLoaded == 'boolean')) {
17959
17985
  toret = false;
17960
17986
  this.errorToLog = "options.openTreeWhenLoaded value '" + object.openTreeWhenLoaded + "' doesn't meet interface IConf requirements";
17961
17987
  }
@@ -17963,6 +17989,18 @@ const HierarchizedPickerComponent = class {
17963
17989
  toret = false;
17964
17990
  this.errorToLog = "options.displayRootNode value '" + object.displayRootNode + "' doesn't meet interface IConf requirements";
17965
17991
  }
17992
+ if (!((!object.dragAndDropEnabled && typeof object.dragAndDropEnabled != "boolean") || typeof object.dragAndDropEnabled == 'boolean')) {
17993
+ toret = false;
17994
+ this.errorToLog = "options.dragAndDropEnabled value '" + object.dragAndDropEnabled + "' doesn't meet interface IConf requirements";
17995
+ }
17996
+ if (!((!object.contextMenu && typeof object.contextMenu != 'object') || typeof object.contextMenu == 'object')) {
17997
+ toret = false;
17998
+ this.errorToLog = "options.contextMenu value doesn't meet interface IConf requirements";
17999
+ }
18000
+ if (!((!object.searchResultPresentsUnMatched && typeof object.searchResultPresentsUnMatched != "boolean") || typeof object.searchResultPresentsUnMatched == 'boolean')) {
18001
+ toret = false;
18002
+ this.errorToLog = "options.searchResultPresentsUnMatched value '" + object.searchResultPresentsUnMatched + "' doesn't meet interface IConf requirements";
18003
+ }
17966
18004
  return toret;
17967
18005
  }
17968
18006
  async initComponent() {
@@ -18023,8 +18061,9 @@ const HierarchizedPickerComponent = class {
18023
18061
  });
18024
18062
  }
18025
18063
  else {
18026
- this.errorToLog = "options.options.Reach is undefined and can't be auto-assigned: either specify a 'Reach' option " +
18027
- " in your webservice call options or make sure the defaultValue property contains node IDs and not fullpath values.";
18064
+ this.errorToLog =
18065
+ "theOptions.options.Reach is undefined and can't be auto-assigned: either specify a 'Reach' option " +
18066
+ ' in your webservice call options or make sure the defaultValue property contains node IDs and not fullpath values.';
18028
18067
  }
18029
18068
  }
18030
18069
  }
@@ -18046,6 +18085,8 @@ const HierarchizedPickerComponent = class {
18046
18085
  this.theOptions.openTreeWhenLoaded = false;
18047
18086
  if (!this.theOptions.displayRootNode)
18048
18087
  this.theOptions.displayRootNode = false;
18088
+ if (!this.theOptions.dragAndDropEnabled)
18089
+ this.theOptions.dragAndDropEnabled = false;
18049
18090
  if (!this.theOptions.errorsInInput && this.theOptions.errorsInInput !== false)
18050
18091
  this.theOptions.errorsInInput = true;
18051
18092
  }
@@ -18079,10 +18120,10 @@ const HierarchizedPickerComponent = class {
18079
18120
  this.showTree("hide");
18080
18121
  }
18081
18122
  });
18082
- this.el.addEventListener("dragover", (event) => {
18123
+ this.el.addEventListener('dragover', event => {
18083
18124
  event.preventDefault();
18084
18125
  });
18085
- this.el.addEventListener("dragenter", (event) => {
18126
+ this.el.addEventListener('dragenter', event => {
18086
18127
  event.preventDefault();
18087
18128
  });
18088
18129
  }
@@ -18099,14 +18140,14 @@ const HierarchizedPickerComponent = class {
18099
18140
  myself = true;
18100
18141
  }
18101
18142
  });
18102
- return (myself);
18143
+ return myself;
18103
18144
  }
18104
18145
  amIFocused() {
18105
18146
  return (document.activeElement == document.querySelector('#hierarchized-picker-input-' + this.componentID + ' input') ||
18106
18147
  document.activeElement == document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input'));
18107
18148
  }
18108
18149
  amIShowingMyTree() {
18109
- return (document.querySelectorAll("#hierarchized-picker-" + this.componentID + " .hierarchized-picker-modal-area:not(.hidden)").length > 0);
18150
+ return document.querySelectorAll('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-modal-area:not(.hidden)').length > 0;
18110
18151
  }
18111
18152
  async getToken() {
18112
18153
  if (typeof this.theOptions.token == 'string') {
@@ -18188,6 +18229,10 @@ const HierarchizedPickerComponent = class {
18188
18229
  else if (this.theOptions.origin == 'position') {
18189
18230
  resolve(result.position.ID);
18190
18231
  }
18232
+ // TODO -> this does not exist, set accordingly to future API
18233
+ else if (this.theOptions.origin == 'classification') {
18234
+ resolve(result.node.ID);
18235
+ }
18191
18236
  }
18192
18237
  else {
18193
18238
  this.errorToLog = "The fullpath passed for defaultValue does not exist!";
@@ -18236,15 +18281,78 @@ const HierarchizedPickerComponent = class {
18236
18281
  }
18237
18282
  xhr.send(JSON.stringify(payload));
18238
18283
  }
18284
+ // TODO -> this does not exist, set accordingly to future API
18285
+ else if (this.theOptions.origin == 'classification') {
18286
+ xhr.send(JSON.stringify({
18287
+ fullpath_system: fullpath,
18288
+ }));
18289
+ }
18239
18290
  // CHECK return toret;
18240
18291
  });
18241
18292
  }
18242
18293
  // Triggers a XHR request and stores the result in this.rawData
18294
+ getDataFromSourceClassification(url, options, init = false) {
18295
+ var _a;
18296
+ let that = this;
18297
+ (_a = this.loader) === null || _a === void 0 ? void 0 : _a.classList.add('loading');
18298
+ let targetURL = url + '/' + options.startNode;
18299
+ // if (options.searchedValue) {
18300
+ // targetURL += '/' + options.searchedValue;
18301
+ // }
18302
+ let getDataPromise = new Promise((resolve, reject) => {
18303
+ this.getToken().then(token => {
18304
+ let xhr = new browser();
18305
+ xhr.open('GET', targetURL);
18306
+ // xhr.setRequestHeader('Authorization', 'Bearer ' + token);
18307
+ // xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
18308
+ xhr.onload = function (e) {
18309
+ var _a;
18310
+ (_a = that.loader) === null || _a === void 0 ? void 0 : _a.classList.remove('loading');
18311
+ that.mylog('XHR ONLOAD', e, xhr.statusText);
18312
+ if (xhr.readyState === 4) {
18313
+ if (xhr.status === 200) {
18314
+ that.mylog('XHR 200', JSON.parse(xhr.responseText));
18315
+ if (that.rawData) {
18316
+ that.rawData = that.searchAndMergeData(that.rawData, JSON.parse(xhr.responseText));
18317
+ }
18318
+ else {
18319
+ that.rawData = JSON.parse(xhr.responseText);
18320
+ }
18321
+ resolve(JSON.parse(xhr.responseText));
18322
+ if (init) {
18323
+ that.formatDefaultValue();
18324
+ that.showSelectedNodes();
18325
+ }
18326
+ that.ready = true;
18327
+ }
18328
+ else {
18329
+ that.logError(['XHR NOT 200', xhr.statusText]);
18330
+ that.errorLoadingXHR();
18331
+ reject();
18332
+ }
18333
+ }
18334
+ };
18335
+ xhr.onerror = function (e) {
18336
+ var _a;
18337
+ (_a = that.loader) === null || _a === void 0 ? void 0 : _a.classList.remove('loading');
18338
+ that.logError(['XHR ERROR', e, xhr.statusText]);
18339
+ that.errorLoadingXHR();
18340
+ reject();
18341
+ };
18342
+ xhr.send();
18343
+ });
18344
+ });
18345
+ return getDataPromise;
18346
+ }
18347
+ // Triggers a XHR request and stores the result in this.rawData
18243
18348
  getDataFromSource(url, options, init = false) {
18244
18349
  var _a;
18245
18350
  (_a = this.loader) === null || _a === void 0 ? void 0 : _a.classList.add('loading');
18351
+ // if (options.searchedValue) {
18352
+ // targetURL += '/' + options.searchedValue;
18353
+ // }
18246
18354
  let getDataPromise = new Promise((resolve, reject) => {
18247
- this.getToken().then((token) => {
18355
+ this.getToken().then(token => {
18248
18356
  let xhr = new browser();
18249
18357
  xhr.open('POST', url);
18250
18358
  xhr.setRequestHeader('Authorization', 'Bearer ' + token);
@@ -18312,7 +18420,13 @@ const HierarchizedPickerComponent = class {
18312
18420
  }
18313
18421
  }
18314
18422
  getApiSearchURL() {
18315
- return (this.theOptions.url.substring(0, this.theOptions.url.lastIndexOf("/")) + '/GetTreeFromSearch');
18423
+ if (this.theOptions.origin == 'classification') {
18424
+ return this.theOptions.url;
18425
+ // return this.theOptions.url.substring(0, this.theOptions.url.lastIndexOf('/'));
18426
+ }
18427
+ else {
18428
+ return this.theOptions.url.substring(0, this.theOptions.url.lastIndexOf('/')) + '/GetTreeFromSearch';
18429
+ }
18316
18430
  }
18317
18431
  getApiNodeFromFullpathURL() {
18318
18432
  if (this.theOptions.origin == 'thesaurus') {
@@ -18321,6 +18435,10 @@ const HierarchizedPickerComponent = class {
18321
18435
  else if (this.theOptions.origin == 'position') {
18322
18436
  return (this.theOptions.url.substring(0, this.theOptions.url.lastIndexOf("/")) + '/PositionExistByFp');
18323
18437
  }
18438
+ // TODO -> this does not exist, set accordingly to future API
18439
+ else if (this.theOptions.origin == 'classification') {
18440
+ return this.theOptions.url.substring(0, this.theOptions.url.lastIndexOf('/')) + '/exists';
18441
+ }
18324
18442
  }
18325
18443
  rawDataWatcher(dataToLoad) {
18326
18444
  //This makes the tree to be created only once after the rawData loading
@@ -18358,10 +18476,10 @@ const HierarchizedPickerComponent = class {
18358
18476
  nodes = nodes.sort(function (a, b) {
18359
18477
  var textA = a.text.toUpperCase();
18360
18478
  var textB = b.text.toUpperCase();
18361
- return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
18479
+ return textA < textB ? -1 : textA > textB ? 1 : 0;
18362
18480
  });
18363
18481
  this.clearAutocomplete();
18364
- let autocomplete_results = document.getElementById("autocomplete-results-area");
18482
+ let autocomplete_results = document.getElementById('autocomplete-results-area');
18365
18483
  autocomplete_results.innerHTML = '';
18366
18484
  if (data && searched && searched.length > 0) {
18367
18485
  for (let i = 0; i < nodes.length; i++) {
@@ -18386,19 +18504,20 @@ const HierarchizedPickerComponent = class {
18386
18504
  clearAutocomplete(eraseResults = false) {
18387
18505
  if (this.theOptions.showAutocomplete) {
18388
18506
  // setTimeout(() => {
18389
- let autocomplete_results = document.getElementById("autocomplete-results-area");
18507
+ let autocomplete_results = document.getElementById('autocomplete-results-area');
18390
18508
  autocomplete_results.style.display = 'none';
18391
18509
  if (eraseResults) {
18392
- autocomplete_results.innerHTML = "";
18510
+ autocomplete_results.innerHTML = '';
18393
18511
  }
18394
18512
  // }, 0);
18395
18513
  }
18396
18514
  }
18397
- loadSearchDataInCurrentTree(dataToLoad, searched, searchID) {
18515
+ loadSearchDataInCurrentTree(dataToLoad, searchID, searched) {
18398
18516
  let displayResults = () => {
18399
18517
  if (this.searchToDisplay > -1 && searchID == this.searchToDisplay) {
18400
18518
  this.rawData.children.forEach((value, index) => {
18401
- this.completeCurrentTreeWithTree(value);
18519
+ // this.completeCurrentTreeWithTree(value, dataToLoad);
18520
+ this.completeCurrentTreeWithTree(dataToLoad);
18402
18521
  });
18403
18522
  this.triggerTreeDisplay(this.rawData, searched);
18404
18523
  this.displayAutocompleteWithResults(this.rawData, searched);
@@ -18416,23 +18535,37 @@ const HierarchizedPickerComponent = class {
18416
18535
  }
18417
18536
  };
18418
18537
  if (this.theOptions.source == 'webservice') {
18419
- // WS Call
18420
- this.getDataFromSource(this.getApiSearchURL(), {
18421
- StartNodeID: this.theOptions.options.StartNodeID,
18422
- lng: this.theOptions.options.lng,
18423
- searchedValue: searched,
18424
- searchNameOnly: true,
18425
- deprecated: false
18426
- })
18427
- .then(displayResults)
18428
- .catch((error) => {
18429
- try {
18430
- this.errorToLog = "getDataFromSource rejected:" + JSON.stringify(error, replacer, 2);
18431
- }
18432
- catch (_a) {
18433
- console.error("getDataFromSource rejected:", JSON.stringify(error, replacer, 2));
18434
- }
18435
- });
18538
+ if (this.theOptions.origin == 'classification') {
18539
+ // WS Call
18540
+ this.getDataFromSourceClassification(this.getApiSearchURL(), {
18541
+ startNode: this.theOptions.options.startNode,
18542
+ searchedValue: searched,
18543
+ // searchNameOnly: true,
18544
+ // deprecated: false
18545
+ }).then(displayResults),
18546
+ err => {
18547
+ console.error('err', err);
18548
+ };
18549
+ }
18550
+ else {
18551
+ // WS Call
18552
+ this.getDataFromSource(this.getApiSearchURL(), {
18553
+ StartNodeID: this.theOptions.options.StartNodeID,
18554
+ lng: this.theOptions.options.lng,
18555
+ searchedValue: searched,
18556
+ searchNameOnly: true,
18557
+ deprecated: false
18558
+ })
18559
+ .then(displayResults)
18560
+ .catch((error) => {
18561
+ try {
18562
+ this.errorToLog = "getDataFromSource 1 rejected:" + JSON.stringify(error, replacer, 2);
18563
+ }
18564
+ catch (_a) {
18565
+ console.error("getDataFromSource 2 rejected:", JSON.stringify(error, replacer, 2));
18566
+ }
18567
+ });
18568
+ }
18436
18569
  }
18437
18570
  else {
18438
18571
  displayResults();
@@ -18445,10 +18578,13 @@ const HierarchizedPickerComponent = class {
18445
18578
  if (this.theOptions.origin == 'position') {
18446
18579
  this.translateDataFromPosition(dataToLoad, searched);
18447
18580
  }
18581
+ if (this.theOptions.origin == 'classification') {
18582
+ this.translateDataFromClassification(dataToLoad, searched);
18583
+ }
18448
18584
  }
18449
- translateDataForTree(dataToLoad, searched = null, searchID = null) {
18585
+ translateDataForTree(dataToLoad, searchID = null, searched = null) {
18450
18586
  if (searched != null) {
18451
- this.loadSearchDataInCurrentTree(dataToLoad, searched, searchID);
18587
+ this.loadSearchDataInCurrentTree(dataToLoad, searchID, searched);
18452
18588
  }
18453
18589
  else {
18454
18590
  this.triggerTreeDisplay(dataToLoad, searched);
@@ -18457,12 +18593,12 @@ const HierarchizedPickerComponent = class {
18457
18593
  getPropertyFromNode(node, property, logerror = true) {
18458
18594
  property = property.trim();
18459
18595
  if (!node || !property) {
18460
- return "";
18596
+ return '';
18461
18597
  }
18462
- if (node[property]) {
18598
+ if (node[property] || node[property] === 0) {
18463
18599
  return node[property];
18464
18600
  }
18465
- if (node.data && node.data[property]) {
18601
+ if (node.data && (node.data[property] || node.data[property] === 0)) {
18466
18602
  return node.data[property];
18467
18603
  }
18468
18604
  if (logerror)
@@ -18477,32 +18613,32 @@ const HierarchizedPickerComponent = class {
18477
18613
  let fillTreeWithObject = (tree, object, depth = 0) => {
18478
18614
  if (object && object.length) {
18479
18615
  object.forEach((value, _index) => {
18480
- let keyPropFromNode = this.getPropertyFromNode(value, "key");
18481
- let valueTranslatedPropFromNode = this.getPropertyFromNode(value, "valueTranslated");
18482
- let fullpathPropFromNode = this.getPropertyFromNode(value, "fullpath");
18483
- let fullpathTranslatedPropFromNode = this.getPropertyFromNode(value, "fullpathTranslated");
18484
- let hasChildrenPropFromNode = this.getPropertyFromNode(value, "hasChildren", false);
18485
- let childrenPropFromNode = this.getPropertyFromNode(value, "children", false);
18486
- let deprecated = this.getPropertyFromNode(value, "deprecated", false);
18616
+ let keyPropFromNode = this.getPropertyFromNode(value, 'key');
18617
+ let valueTranslatedPropFromNode = this.getPropertyFromNode(value, 'valueTranslated');
18618
+ let fullpathPropFromNode = this.getPropertyFromNode(value, 'fullpath');
18619
+ let fullpathTranslatedPropFromNode = this.getPropertyFromNode(value, 'fullpathTranslated');
18620
+ let hasChildrenPropFromNode = this.getPropertyFromNode(value, 'hasChildren', false);
18621
+ let childrenPropFromNode = this.getPropertyFromNode(value, 'children', false);
18622
+ let deprecated = this.getPropertyFromNode(value, 'deprecated', false);
18487
18623
  let objToPush = {
18488
18624
  id: keyPropFromNode,
18489
18625
  depth: depth,
18490
18626
  text: valueTranslatedPropFromNode,
18491
18627
  fullpath: fullpathPropFromNode,
18492
18628
  fullpathTranslated: fullpathTranslatedPropFromNode,
18493
- children: (hasChildrenPropFromNode && childrenPropFromNode && childrenPropFromNode.length == 0 ? [{}] : []),
18629
+ children: hasChildrenPropFromNode && childrenPropFromNode && childrenPropFromNode.length == 0 ? [{}] : [],
18494
18630
  deprecated: deprecated,
18495
18631
  isDesaturated: false,
18496
18632
  };
18497
18633
  let childTree = fillTreeWithObject(objToPush.children, childrenPropFromNode, depth + 1);
18498
18634
  let pushMe = false;
18499
- let searchValue = (obj) => {
18635
+ let searchValue = obj => {
18500
18636
  let toret = false;
18501
18637
  if (obj.text.toLowerCase().indexOf(searched.toLowerCase()) > -1) {
18502
18638
  toret = true;
18503
18639
  }
18504
18640
  else if (obj.children.length > 0 && Object.keys(obj.children[0]).length != 0) {
18505
- obj.children.forEach((descend) => {
18641
+ obj.children.forEach(descend => {
18506
18642
  if (searchValue(descend)) {
18507
18643
  toret = true;
18508
18644
  }
@@ -18545,7 +18681,7 @@ const HierarchizedPickerComponent = class {
18545
18681
  this.getPropertyFromNode(value, "children").length == 0 ? [{}] : []),
18546
18682
  deprecated: this.getPropertyFromNode(value, "deprecated", false),
18547
18683
  };
18548
- let childTree = fillTreeWithObject(objToPush.children, this.getPropertyFromNode(value, "children", false), depth + 1);
18684
+ let childTree = fillTreeWithObject(objToPush.children, this.getPropertyFromNode(value, 'children', false), depth + 1);
18549
18685
  let pushMe = false;
18550
18686
  let searchValue = function (obj) {
18551
18687
  let toret = false;
@@ -18577,12 +18713,56 @@ const HierarchizedPickerComponent = class {
18577
18713
  };
18578
18714
  this.displayTree(fillTreeWithObject([], !this.theOptions.displayRootNode ? dataToLoad.children : [dataToLoad]));
18579
18715
  }
18716
+ translateDataFromClassification(dataToLoad, searched = null) {
18717
+ if (this.theOptions.origin != 'classification' || !dataToLoad)
18718
+ return;
18719
+ let that = this;
18720
+ let fillTreeWithObject = function (tree, object, depth = 0) {
18721
+ if (object.length) {
18722
+ object.forEach(function (value, _index) {
18723
+ let objToPush = {
18724
+ id: that.getPropertyFromNode(value, 'ID'),
18725
+ depth: depth,
18726
+ text: that.getPropertyFromNode(value, 'Name'),
18727
+ fullpath: that.getPropertyFromNode(value, 'Properties').FullPath,
18728
+ fullpathTranslated: that.getPropertyFromNode(value, 'Properties').FullPath,
18729
+ children: [{}],
18730
+ deprecated: that.getPropertyFromNode(value, 'IsDeprecated', false),
18731
+ };
18732
+ let childTree = fillTreeWithObject(objToPush.children, that.getPropertyFromNode(value, 'children', false), depth + 1);
18733
+ let pushMe = false;
18734
+ let searchValue = function (obj) {
18735
+ let toret = false;
18736
+ if (obj.text.toLowerCase().indexOf(searched.toLowerCase()) > -1) {
18737
+ toret = true;
18738
+ }
18739
+ else if (obj.children.length > 0 && Object.keys(obj.children[0]).length != 0) {
18740
+ obj.children.forEach(descend => {
18741
+ if (searchValue(descend)) {
18742
+ toret = true;
18743
+ }
18744
+ });
18745
+ }
18746
+ return toret;
18747
+ };
18748
+ if (searched) {
18749
+ pushMe = searchValue(objToPush);
18750
+ }
18751
+ else {
18752
+ pushMe = true;
18753
+ }
18754
+ if (pushMe) {
18755
+ objToPush.children = childTree;
18756
+ tree.push(objToPush);
18757
+ }
18758
+ });
18759
+ }
18760
+ return tree;
18761
+ };
18762
+ this.displayTree(fillTreeWithObject([], !this.theOptions.displayRootNode ? dataToLoad.children : [dataToLoad]));
18763
+ }
18580
18764
  findNodeById(myTree, nodeId) {
18581
- let node = myTree.nodesById[nodeId];
18582
- if (!node) {
18583
- return null;
18584
- }
18585
- return myTree.nodesById[nodeId];
18765
+ return !myTree.nodesById[nodeId] ? null : myTree.nodesById[nodeId];
18586
18766
  }
18587
18767
  // Finds the root of the new tree in the current tree (wherever it may be), and adds the children of the new tree to it
18588
18768
  completeCurrentTreeWithTree(newTree) {
@@ -18593,20 +18773,35 @@ const HierarchizedPickerComponent = class {
18593
18773
  if ((first || (tree && tree.length != 0)) && object && Object.keys(object).length != 0 && object.length) {
18594
18774
  object.forEach((value, _index) => {
18595
18775
  let objToPush = value;
18596
- if (that.getPropertyFromNode(value, "key", false) != null) {
18597
- objToPush = {
18598
- id: that.getPropertyFromNode(value, "key"),
18599
- depth: depth,
18600
- parent: parent,
18601
- text: that.getPropertyFromNode(value, "valueTranslated"),
18602
- fullpath: that.getPropertyFromNode(value, "fullpath"),
18603
- fullpathTranslated: that.getPropertyFromNode(value, "fullpathTranslated"),
18604
- children: (that.getPropertyFromNode(value, "hasChildren", false) &&
18605
- that.getPropertyFromNode(value, "children").length == 0 ? [{}] : []),
18606
- deprecated: that.getPropertyFromNode(value, "deprecated", false),
18607
- };
18776
+ if (that.theOptions.origin == 'classification') {
18777
+ if (that.getPropertyFromNode(value, 'ID', false) != null) {
18778
+ objToPush = {
18779
+ id: that.getPropertyFromNode(value, 'ID'),
18780
+ depth: depth,
18781
+ parent: parent,
18782
+ text: that.getPropertyFromNode(value, 'Name'),
18783
+ fullpath: that.getPropertyFromNode(value.Properties, 'FullPath'),
18784
+ fullpathTranslated: that.getPropertyFromNode(value.Properties, 'FullPath'),
18785
+ children: that.getPropertyFromNode(value, 'children').length == 0 ? [{}] : [],
18786
+ deprecated: that.getPropertyFromNode(value.Properties, 'IsDeprecated', false),
18787
+ };
18788
+ }
18608
18789
  }
18609
- objToPush.children = shortFillTreeWithObject(objToPush, objToPush.children, that.getPropertyFromNode(value, "children", false), false, depth + 1);
18790
+ else {
18791
+ if (that.getPropertyFromNode(value, 'key', false) != null) {
18792
+ objToPush = {
18793
+ id: that.getPropertyFromNode(value, 'key'),
18794
+ depth: depth,
18795
+ parent: parent,
18796
+ text: that.getPropertyFromNode(value, 'valueTranslated'),
18797
+ fullpath: that.getPropertyFromNode(value, 'fullpath'),
18798
+ fullpathTranslated: that.getPropertyFromNode(value, 'fullpathTranslated'),
18799
+ children: that.getPropertyFromNode(value, 'hasChildren', false) && that.getPropertyFromNode(value, 'children').length == 0 ? [{}] : [],
18800
+ deprecated: that.getPropertyFromNode(value, 'deprecated', false),
18801
+ };
18802
+ }
18803
+ }
18804
+ objToPush.children = shortFillTreeWithObject(objToPush, objToPush.children, that.getPropertyFromNode(value, 'children', false), false, depth + 1);
18610
18805
  tree.push(objToPush);
18611
18806
  });
18612
18807
  }
@@ -18617,7 +18812,7 @@ const HierarchizedPickerComponent = class {
18617
18812
  if (targetNode != null) {
18618
18813
  // empty the children of the node in the library
18619
18814
  targetNode.children = [];
18620
- let liElmID = (newTree.key ? newTree.key : newTree.id);
18815
+ let liElmID = (newTree.key ? newTree.key : (newTree.id ? newTree.id : newTree.ID));
18621
18816
  var ulElem = this.loadedTreeJs.liElementsById[liElmID].querySelector('ul');
18622
18817
  let filledtree = shortFillTreeWithObject({
18623
18818
  id: liElmID,
@@ -18626,10 +18821,10 @@ const HierarchizedPickerComponent = class {
18626
18821
  text: this.loadedTreeJs.nodesById[liElmID].text,
18627
18822
  fullpath: this.loadedTreeJs.nodesById[liElmID].fullpath,
18628
18823
  fullpathTranslated: this.loadedTreeJs.nodesById[liElmID].fullpathTranslated,
18629
- children: this.loadedTreeJs.nodesById[liElmID].children
18824
+ children: this.loadedTreeJs.nodesById[liElmID].children,
18630
18825
  }, [], newTree.children, true, targetNode.depth + 1);
18631
18826
  if (filledtree.length > 0) {
18632
- ulElem.innerHTML = "";
18827
+ ulElem.innerHTML = '';
18633
18828
  }
18634
18829
  // this.rawData = result from WS call
18635
18830
  (filledtree).forEach((item) => {
@@ -18645,9 +18840,9 @@ const HierarchizedPickerComponent = class {
18645
18840
  this.loadedTreeJs.treeNodes.push(item);
18646
18841
  //If has children, prepare sub elements
18647
18842
  if (item.children && item.children.length > 0) {
18648
- var liElems = ulElem.querySelectorAll("li");
18843
+ var liElems = ulElem.querySelectorAll('li');
18649
18844
  liElems[liElems.length - 1].appendChild(this.loadedTreeJs.createUlEle());
18650
- liElems[liElems.length - 1].querySelector("ul").appendChild(this.loadedTreeJs.createLiEle(item.children));
18845
+ liElems[liElems.length - 1].querySelector('ul').appendChild(this.loadedTreeJs.createLiEle(item.children));
18651
18846
  this.completeCurrentTreeWithTree(item);
18652
18847
  }
18653
18848
  }
@@ -18721,7 +18916,7 @@ const HierarchizedPickerComponent = class {
18721
18916
  this.itemDropped.emit({
18722
18917
  dragEl: this.curDraggingItem,
18723
18918
  dropEl: el,
18724
- position: this.getDragOverPos(el, e)
18919
+ position: this.getDragOverPos(el, e),
18725
18920
  });
18726
18921
  }
18727
18922
  getDragOverPos(el, e) {
@@ -18799,7 +18994,7 @@ const HierarchizedPickerComponent = class {
18799
18994
  }
18800
18995
  }
18801
18996
  async setNodeAsSelected(id, treeToUpdate, userClick) {
18802
- if ((this.disabled && this.shownTree && this.setValueOnClick) ||
18997
+ if ((this.isDisabled && this.shownTree && this.setValueOnClick) ||
18803
18998
  (this.loadedTreeJs.liElementsById[id].classList.value && this.loadedTreeJs.liElementsById[id].classList.value.indexOf("readonly_node") != -1))
18804
18999
  return;
18805
19000
  this.ignoreOptionsChanges = true;
@@ -18825,21 +19020,21 @@ const HierarchizedPickerComponent = class {
18825
19020
  this.ignoreOptionsChanges = false;
18826
19021
  }
18827
19022
  async focusSearchInput() {
18828
- this.mylog("focusSearchInput");
19023
+ this.mylog('focusSearchInput');
18829
19024
  let searchInput = document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input');
18830
19025
  if (searchInput) {
18831
19026
  await searchInput.focus();
18832
19027
  }
18833
19028
  }
18834
19029
  async focusMainInput() {
18835
- this.mylog("focusMainInput");
19030
+ this.mylog('focusMainInput');
18836
19031
  let mainInput = document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-input');
18837
19032
  if (mainInput) {
18838
19033
  await mainInput.focus();
18839
19034
  }
18840
19035
  }
18841
19036
  async focusModal() {
18842
- this.mylog("focusModal");
19037
+ this.mylog('focusModal');
18843
19038
  let modalArea = document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-modal-area');
18844
19039
  if (modalArea) {
18845
19040
  await modalArea.focus();
@@ -18873,8 +19068,12 @@ const HierarchizedPickerComponent = class {
18873
19068
  removeClosedAndLookUp(parent);
18874
19069
  }
18875
19070
  };
18876
- const checkeds = document.querySelectorAll('#tree-area-' + this.componentID + ' .treejs-node__checked');
18877
- checkeds.forEach((item) => removeClosedAndLookUp(item));
19071
+ try {
19072
+ const checkeds = document.querySelectorAll('#tree-area-' + this.componentID + ' .treejs-node__checked');
19073
+ checkeds.forEach((item) => removeClosedAndLookUp(item));
19074
+ }
19075
+ catch (err) {
19076
+ }
18878
19077
  if (scrollToValue && this.scrollable) {
18879
19078
  this.scrollable.scrollTop = scrollToValue;
18880
19079
  }
@@ -18897,23 +19096,23 @@ const HierarchizedPickerComponent = class {
18897
19096
  return;
18898
19097
  this.mylog("--------- showTree-" + this.componentID, focused, this.hasFocus);
18899
19098
  // hide tree when asked to or when it is disabled
18900
- if (focused == "hide" || this.disabled) {
18901
- this.hasFocus = ["hide"];
19099
+ if (focused == 'hide' || this.isDisabled) {
19100
+ this.hasFocus = ['hide'];
18902
19101
  let elem = document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input');
18903
19102
  if (elem) {
18904
- elem.value = "";
18905
- this.translateDataForTree(this.rawData);
19103
+ elem.value = '';
18906
19104
  }
19105
+ this.search("");
18907
19106
  }
18908
19107
  else {
18909
- if (this.hasFocus.indexOf(focused) == -1 && this.hasFocus.indexOf("hide") == -1) {
19108
+ if (this.hasFocus.indexOf(focused) == -1 && this.hasFocus.indexOf('hide') == -1) {
18910
19109
  this.hasFocus.push(focused);
18911
19110
  }
18912
19111
  }
18913
19112
  if (!this.shownTree && this.theOptions.loading == "click") {
18914
19113
  this.loadDataForTree();
18915
19114
  }
18916
- if (this.hasFocus.indexOf("hide") > -1) {
19115
+ if (this.hasFocus.indexOf('hide') > -1) {
18917
19116
  this.hasFocus = [];
18918
19117
  }
18919
19118
  let previousShownTree = this.shownTree;
@@ -18922,14 +19121,14 @@ const HierarchizedPickerComponent = class {
18922
19121
  this.collapseAllNodes();
18923
19122
  this.clearAutocomplete(true);
18924
19123
  }
18925
- if (focused == "picker") {
19124
+ if (focused == 'picker') {
18926
19125
  this.focusSearchInput();
18927
19126
  }
18928
19127
  else {
18929
19128
  this.focusModal();
18930
19129
  }
18931
19130
  if (!previousShownTree && this.shownTree) {
18932
- this.showSelectedNodes();
19131
+ this.showSelectedNodes(true);
18933
19132
  }
18934
19133
  }
18935
19134
  // Changes the value of the component with passed node
@@ -18959,7 +19158,7 @@ const HierarchizedPickerComponent = class {
18959
19158
  nodeid: node.id,
18960
19159
  fullpath: node.fullpath,
18961
19160
  fullpathTranslated: node.fullpathTranslated,
18962
- shortpathTranslated: node.text
19161
+ shortpathTranslated: node.text,
18963
19162
  };
18964
19163
  }
18965
19164
  }
@@ -18977,8 +19176,9 @@ const HierarchizedPickerComponent = class {
18977
19176
  }
18978
19177
  // Search a value in the tree and triggers a search when necessary
18979
19178
  search(searched) {
18980
- if (this.theOptions.mode == 'input') {
18981
- document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input').classList.remove('fieldError');
19179
+ let searchinput = document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input');
19180
+ if (this.theOptions.mode == 'input' && searchinput) {
19181
+ searchinput.classList.remove('fieldError');
18982
19182
  }
18983
19183
  if (searched.length > 2) {
18984
19184
  this.searchToDisplay += 1;
@@ -18993,17 +19193,29 @@ const HierarchizedPickerComponent = class {
18993
19193
  }
18994
19194
  else {
18995
19195
  this.searchToDisplay = -1;
18996
- //Displays the full tree
18997
- this.translateDataForTree(this.rawData);
19196
+ if (this.theOptions.source == "webservice") {
19197
+ let rootnode = 0;
19198
+ if (this.theOptions.origin == 'classification') {
19199
+ rootnode = this.theOptions.options.startNode;
19200
+ }
19201
+ else {
19202
+ rootnode = this.theOptions.options.StartNodeID;
19203
+ }
19204
+ //Displays the full tree
19205
+ this.translateDataForTree(this.rawData, rootnode);
19206
+ }
19207
+ else {
19208
+ this.translateDataForTree(this.rawData);
19209
+ }
18998
19210
  //Reset autocomplete
18999
- this.displayAutocompleteWithResults(null, "");
19000
- //Recheck previously selected fields ? pourquoi ?
19001
- //this.checkFields(this.value, false);
19211
+ this.displayAutocompleteWithResults(null, '');
19212
+ //Recheck previously selected fields ?
19213
+ this.checkFields(this.value, false);
19002
19214
  }
19003
19215
  }
19004
19216
  // Refresh the tree with search results
19005
19217
  triggerSearch(searched, searchID) {
19006
- this.translateDataForTree(this.rawData, searched, searchID);
19218
+ this.translateDataForTree(this.rawData, searchID, searched);
19007
19219
  }
19008
19220
  displayPickerError(errorMsg = "") {
19009
19221
  try {
@@ -19013,7 +19225,7 @@ const HierarchizedPickerComponent = class {
19013
19225
  errorMsg = "There has been an error ... > [Generic error]";
19014
19226
  }
19015
19227
  this.displayedValue = errorMsg;
19016
- // this.disabled = true;
19228
+ // this.isDisabled = true;
19017
19229
  this.errorToLog = errorMsg;
19018
19230
  }
19019
19231
  }
@@ -19059,21 +19271,26 @@ const HierarchizedPickerComponent = class {
19059
19271
  }
19060
19272
  loadDataForTree(init = false) {
19061
19273
  if (this.theOptions.source == 'webservice') {
19062
- this.getDataFromSource(this.theOptions.url, this.theOptions.options, init)
19063
- .then(() => {
19064
- if (init) {
19065
- this.formatDefaultValue();
19066
- this.showSelectedNodes();
19067
- }
19068
- })
19069
- .catch((error) => {
19070
- try {
19071
- this.errorToLog = "getDataFromSource rejected:" + JSON.stringify(error, replacer, 2);
19072
- }
19073
- catch (_a) {
19074
- console.error("getDataFromSource rejected:", JSON.stringify(error, replacer, 2));
19075
- }
19076
- });
19274
+ if (this.theOptions.origin == 'classification') {
19275
+ this.getDataFromSourceClassification(this.theOptions.url, this.theOptions.options, init);
19276
+ }
19277
+ else {
19278
+ this.getDataFromSource(this.theOptions.url, this.theOptions.options, init)
19279
+ .then(() => {
19280
+ if (init) {
19281
+ this.formatDefaultValue();
19282
+ this.showSelectedNodes();
19283
+ }
19284
+ })
19285
+ .catch((error) => {
19286
+ try {
19287
+ this.errorToLog = "getDataFromSource 3 rejected:" + JSON.stringify(error, replacer, 2);
19288
+ }
19289
+ catch (_a) {
19290
+ console.error("getDataFromSource 4 rejected:", JSON.stringify(error, replacer, 2));
19291
+ }
19292
+ });
19293
+ }
19077
19294
  }
19078
19295
  if (this.theOptions.source == 'data') {
19079
19296
  this.rawData = typeof this.theOptions.data === 'object' ? this.theOptions.data : JSON.parse(this.theOptions.data);
@@ -19129,11 +19346,21 @@ const HierarchizedPickerComponent = class {
19129
19346
  if (typeof dfValue == 'string' && isNumeric(dfValue)) {
19130
19347
  dfValue = parseInt(dfValue);
19131
19348
  }
19132
- if ((typeof dfValue == 'string' && that.getPropertyFromNode(element, "fullpathTranslated") == dfValue) ||
19133
- (typeof dfValue == 'number' && that.getPropertyFromNode(element, "key") == dfValue)) {
19134
- element.nodeid = element.key;
19135
- that.checkFields([element]);
19136
- found++;
19349
+ if (that.theOptions.origin == 'classification') {
19350
+ if ((typeof dfValue == 'string' && that.getPropertyFromNode(element, 'Properties.FullPath') == dfValue) ||
19351
+ (typeof dfValue == 'number' && that.getPropertyFromNode(element, 'ID') == dfValue)) {
19352
+ element.nodeid = element.id;
19353
+ that.checkFields([element]);
19354
+ found++;
19355
+ }
19356
+ }
19357
+ else {
19358
+ if ((typeof dfValue == 'string' && that.getPropertyFromNode(element, 'fullpathTranslated') == dfValue) ||
19359
+ (typeof dfValue == 'number' && that.getPropertyFromNode(element, 'key') == dfValue)) {
19360
+ element.nodeid = element.key;
19361
+ that.checkFields([element]);
19362
+ found++;
19363
+ }
19137
19364
  }
19138
19365
  });
19139
19366
  if (element.children)
@@ -19204,21 +19431,21 @@ const HierarchizedPickerComponent = class {
19204
19431
  render() {
19205
19432
  return (this.theOptions
19206
19433
  ?
19207
- index.h("div", { id: 'hierarchized-picker-' + this.componentID, class: "hierarchized-picker " + (this.disabled ? "readonly-mode" : "") }, (this.theOptions.mode == "input"
19434
+ index.h("div", { id: 'hierarchized-picker-' + this.componentID, class: "hierarchized-picker " + (this.isDisabled ? "readonly-mode" : "") }, (this.theOptions.mode == "input"
19208
19435
  ?
19209
19436
  index.h("div", { class: "hierarchized-picker-container" }, index.h("div", { style: { display: "none" }, ref: (el => {
19210
19437
  this.loader = el;
19211
19438
  }) }), index.h("div", { class: "hierarchized-picker-input-area" }, this.theOptions.label ? index.h("label", { class: "hierarchized-picker-label" }, this.theOptions.label) : '', index.h("span", { class: 'hierarchized-picker-input ' + (this.theOptions.icon && this.theOptions.icon.length > 0 ? "hierarchized-picker-icon" : "") +
19212
- ' reneco ' + (this.theOptions.icon ? this.theOptions.icon : "") + (this.disabled ? " readonly " : "") +
19439
+ ' reneco ' + (this.theOptions.icon ? this.theOptions.icon : "") + (this.isDisabled ? " readonly " : "") +
19213
19440
  ' sc-ion-input-md-h sc-ion-input-md-s md ', id: 'hierarchized-picker-input-' + this.componentID, onClick: _event => {
19214
19441
  this.showTree("picker");
19215
19442
  }, onFocusin: _event => {
19216
19443
  this.showTree("modale");
19217
- } }, index.h("input", { class: "native-input sc-ion-input-md", "aria-labelledby": "ion-input-13-lbl", autocapitalize: "off", autocomplete: "off", autocorrect: "off", name: "ion-input-13", placeholder: "", readonly: "", spellcheck: "false", type: "text", value: this.displayedValue })), (this.displayedValue && !this.disabled && this.canload) ?
19444
+ } }, index.h("input", { class: "native-input sc-ion-input-md", "aria-labelledby": "ion-input-13-lbl", autocapitalize: "off", autocomplete: "off", autocorrect: "off", name: "ion-input-13", placeholder: "", readonly: "", spellcheck: "false", type: "text", value: this.displayedValue })), (this.displayedValue && !this.isDisabled && this.canload) ?
19218
19445
  index.h("span", { class: "reneco reneco-close", onClick: () => this.clearPicker() })
19219
19446
  : ''), index.h("div", { ref: (el) => {
19220
19447
  // Uncomment if you want the modale of picker in input mode to scroll to selected node on openning >>>
19221
- // this.scrollable = el;
19448
+ this.scrollable = el;
19222
19449
  }, class: 'hierarchized-picker-modal-area ' + (!this.shownTree ? ' hidden ' : ''), onClick: event => {
19223
19450
  this.clickPickerModalArea(event);
19224
19451
  } }, index.h("div", { class: 'hierarchized-picker-modal ' + (!this.ready ? 'hidden' : '') }, index.h("div", { id: 'hierarchized-picker-input-search-' + this.componentID, class: "hierarchized-picker-search reneco reneco-search" +
@@ -19234,15 +19461,14 @@ const HierarchizedPickerComponent = class {
19234
19461
  this.focusOutSearchEvent(event);
19235
19462
  } }, index.h("input", { class: "native-input sc-ion-input-md", autocapitalize: "off", autocomplete: "off", autocorrect: "off", name: "ion-input-0", placeholder: this.theOptions.searchPlaceholder, spellcheck: "false", type: "text" })), index.h("ul", { id: "autocomplete-results-area" }), index.h("div", { id: 'tree-area-' + this.componentID, class: 'hierarchized-picker-tree hierarchized-picker-tree-area ' + this.pickerClass }))))
19236
19463
  :
19237
- index.h("div", { class: 'hierarchized-picker-raw-tree-area' + (this.disabled ? " readonly" : ""), onClick: event => {
19464
+ index.h("div", { class: 'hierarchized-picker-raw-tree-area' + (this.isDisabled ? " readonly" : ""), onClick: event => {
19238
19465
  this.clickPickerModalArea(event);
19239
19466
  } }, index.h("div", { class: "loader", ref: (el => {
19240
19467
  this.loader = el;
19241
19468
  }) }, index.h("div", { class: "loader-inner" }, "Loading...")), index.h("div", { ref: (el) => {
19242
19469
  this.scrollable = el;
19243
19470
  }, id: 'tree-area-' + this.componentID, class: 'hierarchized-picker-tree scrollable hierarchized-picker-raw-tree ' + this.pickerClass }))))
19244
- :
19245
- index.h("div", { class: "fieldError" }, "Generic loading issue..."));
19471
+ : (index.h("div", { class: "fieldError" }, "Generic loading issue...")));
19246
19472
  }
19247
19473
  get el() { return index.getElement(this); }
19248
19474
  static get watchers() { return {