reneco-hierarchized-picker 0.2.2-beta → 0.2.2-classifications
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/reneco-hierarchized-picker.cjs.entry.js +771 -635
- package/dist/cjs/reneco-hierarchized-picker.cjs.js +1 -1
- package/dist/collection/components/hierarchized-picker/hierarchized-picker.css +28 -47
- package/dist/collection/components/hierarchized-picker/hierarchized-picker.js +542 -538
- package/dist/collection/components/hierarchized-picker/treejs/index.js +152 -107
- package/dist/custom-elements/index.js +770 -634
- package/dist/esm/loader.js +1 -1
- package/dist/esm/reneco-hierarchized-picker.entry.js +771 -635
- package/dist/esm/reneco-hierarchized-picker.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/reneco-hierarchized-picker.entry.js +3 -1
- package/dist/esm-es5/reneco-hierarchized-picker.js +1 -1
- package/dist/reneco-hierarchized-picker/p-2348e5a5.system.entry.js +3 -0
- package/dist/reneco-hierarchized-picker/p-69fd17ef.entry.js +1 -0
- package/dist/reneco-hierarchized-picker/p-73168a50.system.js +1 -1
- package/dist/reneco-hierarchized-picker/reneco-hierarchized-picker.esm.js +1 -1
- package/dist/types/components/hierarchized-picker/hierarchized-picker.d.ts +17 -24
- package/dist/types/components.d.ts +0 -1
- package/dist/types/utils/utils.d.ts +2 -3
- package/package.json +6 -21
- package/dist/reneco-hierarchized-picker/p-d654ceba.system.entry.js +0 -1
- package/dist/reneco-hierarchized-picker/p-dabba4ce.entry.js +0 -1
- package/dist/types/components/hierarchized-picker/treejs/index.d.ts +0 -11
|
@@ -4,9 +4,86 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-55df525c.js');
|
|
6
6
|
|
|
7
|
+
function ajax(_options) {
|
|
8
|
+
const defaultOptions = {
|
|
9
|
+
method: 'GET',
|
|
10
|
+
url: '',
|
|
11
|
+
async: true,
|
|
12
|
+
success: null,
|
|
13
|
+
failed: null,
|
|
14
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
15
|
+
};
|
|
16
|
+
const options = Object.assign(defaultOptions, _options);
|
|
17
|
+
const xhr = new XMLHttpRequest();
|
|
18
|
+
|
|
19
|
+
const postData = Object.entries(options.data)
|
|
20
|
+
.reduce((acc, [key, value]) => {
|
|
21
|
+
acc.push(`${key}=${value}`);
|
|
22
|
+
return acc;
|
|
23
|
+
}, [])
|
|
24
|
+
.join('&');
|
|
25
|
+
|
|
26
|
+
if (options.method.toUpperCase() === 'POST') {
|
|
27
|
+
xhr.open(options.method, options.url, options.async);
|
|
28
|
+
xhr.setRequestHeader('Content-Type', options['Content-Type']);
|
|
29
|
+
xhr.send(postData);
|
|
30
|
+
} else if (options.method.toUpperCase() === 'GET') {
|
|
31
|
+
let {url} = options;
|
|
32
|
+
if (postData) {
|
|
33
|
+
if (url.indexOf('?') !== -1) {
|
|
34
|
+
url += `&${postData}`;
|
|
35
|
+
} else {
|
|
36
|
+
url += `&${postData}`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
xhr.open(options.method, url, options.async);
|
|
40
|
+
xhr.setRequestHeader('Content-Type', options['Content-Type']);
|
|
41
|
+
xhr.send(null);
|
|
42
|
+
}
|
|
43
|
+
xhr.onreadystatechange = function() {
|
|
44
|
+
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
45
|
+
let res = xhr.responseText;
|
|
46
|
+
if (options['Content-Type'] === defaultOptions['Content-Type']) {
|
|
47
|
+
res = JSON.parse(res);
|
|
48
|
+
}
|
|
49
|
+
options.success && options.success(res);
|
|
50
|
+
} else {
|
|
51
|
+
options.failed && options.failed(xhr.status);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
57
|
+
|
|
58
|
+
function getDefaultExportFromCjs (x) {
|
|
59
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function createCommonjsModule(fn, basedir, module) {
|
|
63
|
+
return module = {
|
|
64
|
+
path: basedir,
|
|
65
|
+
exports: {},
|
|
66
|
+
require: function (path, base) {
|
|
67
|
+
return commonjsRequire();
|
|
68
|
+
}
|
|
69
|
+
}, fn(module, module.exports), module.exports;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function commonjsRequire () {
|
|
73
|
+
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
var vanillaContextMenu = createCommonjsModule(function (module, exports) {
|
|
77
|
+
/*! For license information please see vanilla-context-menu.js.LICENSE.txt */
|
|
78
|
+
!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)+">›</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)+">›</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,"'")+"'"}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=""";break;case 38:i="&";break;case 60:i="<";break;case 62:i=">";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})()));
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const VanillaContextMenu = /*@__PURE__*/getDefaultExportFromCjs(vanillaContextMenu);
|
|
82
|
+
|
|
7
83
|
function deepClone(obj) {
|
|
8
84
|
return JSON.parse(JSON.stringify(obj));
|
|
9
85
|
}
|
|
86
|
+
|
|
10
87
|
function uniq(arr) {
|
|
11
88
|
const map = {};
|
|
12
89
|
return arr.reduce((acc, item) => {
|
|
@@ -17,11 +94,13 @@ function uniq(arr) {
|
|
|
17
94
|
return acc;
|
|
18
95
|
}, []);
|
|
19
96
|
}
|
|
97
|
+
|
|
20
98
|
function empty(ele) {
|
|
21
99
|
while (ele.firstChild) {
|
|
22
100
|
ele.removeChild(ele.firstChild);
|
|
23
101
|
}
|
|
24
102
|
}
|
|
103
|
+
|
|
25
104
|
function animation(duration, callback) {
|
|
26
105
|
requestAnimationFrame(() => {
|
|
27
106
|
callback.enter();
|
|
@@ -33,6 +112,7 @@ function animation(duration, callback) {
|
|
|
33
112
|
});
|
|
34
113
|
});
|
|
35
114
|
}
|
|
115
|
+
|
|
36
116
|
function Tree(container, options) {
|
|
37
117
|
const defaultOptions = {
|
|
38
118
|
selectMode: 'checkbox',
|
|
@@ -51,6 +131,7 @@ function Tree(container, options) {
|
|
|
51
131
|
this.willUpdateNodesById = {};
|
|
52
132
|
this.container = container;
|
|
53
133
|
this.options = Object.assign(defaultOptions, options);
|
|
134
|
+
|
|
54
135
|
Object.defineProperties(this, {
|
|
55
136
|
values: {
|
|
56
137
|
get() {
|
|
@@ -98,37 +179,58 @@ function Tree(container, options) {
|
|
|
98
179
|
},
|
|
99
180
|
},
|
|
100
181
|
});
|
|
101
|
-
|
|
182
|
+
|
|
183
|
+
if (this.options.url) {
|
|
184
|
+
this.load(data => {
|
|
185
|
+
this.init(data);
|
|
186
|
+
});
|
|
187
|
+
} else {
|
|
188
|
+
this.init(this.options.data);
|
|
189
|
+
}
|
|
102
190
|
}
|
|
191
|
+
|
|
103
192
|
Tree.prototype.init = function (data) {
|
|
193
|
+
console.time('init');
|
|
104
194
|
let { treeNodes, nodesById, leafNodesById, defaultValues, defaultDisables } = Tree.parseTreeData(data);
|
|
105
195
|
this.treeNodes = treeNodes;
|
|
106
196
|
this.nodesById = nodesById;
|
|
107
197
|
this.leafNodesById = leafNodesById;
|
|
108
198
|
this.render(this.treeNodes);
|
|
109
199
|
const { values, disables, loaded } = this.options;
|
|
110
|
-
if (values && values.length)
|
|
111
|
-
defaultValues = values;
|
|
200
|
+
if (values && values.length) defaultValues = values;
|
|
112
201
|
defaultValues.length && this.setValues(defaultValues);
|
|
113
|
-
if (disables && disables.length)
|
|
114
|
-
defaultDisables = disables;
|
|
202
|
+
if (disables && disables.length) defaultDisables = disables;
|
|
115
203
|
defaultDisables.length && this.setDisables(defaultDisables);
|
|
116
204
|
loaded && loaded.call(this);
|
|
205
|
+
console.timeEnd('init');
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
Tree.prototype.load = function (callback) {
|
|
209
|
+
console.time('load');
|
|
210
|
+
const { url, method, beforeLoad } = this.options;
|
|
211
|
+
ajax({
|
|
212
|
+
url,
|
|
213
|
+
method,
|
|
214
|
+
success: result => {
|
|
215
|
+
let data = result;
|
|
216
|
+
console.timeEnd('load');
|
|
217
|
+
if (beforeLoad) {
|
|
218
|
+
data = beforeLoad(result);
|
|
219
|
+
}
|
|
220
|
+
callback(data);
|
|
221
|
+
},
|
|
222
|
+
});
|
|
117
223
|
};
|
|
224
|
+
|
|
118
225
|
Tree.prototype.render = function (treeNodes) {
|
|
119
226
|
const treeEle = Tree.createRootEle();
|
|
120
227
|
treeEle.appendChild(this.buildTree(treeNodes, 0));
|
|
121
228
|
this.bindEvent(treeEle);
|
|
122
|
-
|
|
123
|
-
try {
|
|
124
|
-
ele = document.querySelector(this.container);
|
|
125
|
-
}
|
|
126
|
-
catch (_a) {
|
|
127
|
-
ele = this.container;
|
|
128
|
-
}
|
|
229
|
+
const ele = document.querySelector(this.container);
|
|
129
230
|
empty(ele);
|
|
130
231
|
ele.appendChild(treeEle);
|
|
131
232
|
};
|
|
233
|
+
|
|
132
234
|
Tree.prototype.buildTree = function (nodes, depth) {
|
|
133
235
|
const rootUlEle = this.createUlEle();
|
|
134
236
|
if (nodes && nodes.length) {
|
|
@@ -145,88 +247,102 @@ Tree.prototype.buildTree = function (nodes, depth) {
|
|
|
145
247
|
}
|
|
146
248
|
return rootUlEle;
|
|
147
249
|
};
|
|
250
|
+
|
|
148
251
|
Tree.prototype.bindEvent = function (ele) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
parentOptions = JSON.parse(this.options.parentApi.theOptions);
|
|
252
|
+
function getLi(target) {
|
|
253
|
+
return target.classList.contains('treejs-node') ? target : target.closest('.treejs-node');
|
|
152
254
|
}
|
|
153
|
-
|
|
154
|
-
|
|
255
|
+
const contextMenu = this.options.parentApi.options.contextMenu;
|
|
256
|
+
if (contextMenu?.items?.length) {
|
|
257
|
+
new VanillaContextMenu({
|
|
258
|
+
...contextMenu,
|
|
259
|
+
scope: ele,
|
|
260
|
+
menuItems: contextMenu.items.map(item => {
|
|
261
|
+
return typeof item === 'string'
|
|
262
|
+
? item
|
|
263
|
+
: {
|
|
264
|
+
...item,
|
|
265
|
+
callback: e => {
|
|
266
|
+
const target = getLi(e.target);
|
|
267
|
+
this.options.parentApi.onItemContextMenuItemClick({ ...e, target, contextMenuItem: item });
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
}),
|
|
271
|
+
});
|
|
155
272
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
-
ele.addEventListener('click', e => {
|
|
177
|
-
if (!parentOptions.readonly) {
|
|
273
|
+
ele.addEventListener(
|
|
274
|
+
'click',
|
|
275
|
+
e => {
|
|
178
276
|
const { target } = e;
|
|
179
277
|
if (target.nodeName === 'SPAN' && (target.classList.contains('treejs-checkbox') || target.classList.contains('treejs-label'))) {
|
|
180
278
|
this.onItemClick(target.parentNode.nodeId);
|
|
181
|
-
}
|
|
182
|
-
else if (target.nodeName === 'LI' && target.classList.contains('treejs-node')) {
|
|
279
|
+
} else if (target.nodeName === 'LI' && target.classList.contains('treejs-node')) {
|
|
183
280
|
this.onItemClick(target.nodeId);
|
|
184
|
-
}
|
|
185
|
-
else if (target.nodeName === 'SPAN' && target.classList.contains('treejs-switcher')) {
|
|
281
|
+
} else if (target.nodeName === 'SPAN' && target.classList.contains('treejs-switcher')) {
|
|
186
282
|
this.onSwitcherClick(target);
|
|
187
283
|
}
|
|
284
|
+
|
|
188
285
|
//CUSTOM
|
|
189
|
-
const childspans = Array.prototype.slice.call(e.target.parentNode.querySelectorAll('ul > li > span'));
|
|
286
|
+
const childspans = Array.prototype.slice.call(e.target.parentNode.querySelectorAll(':scope > ul > li > span'));
|
|
190
287
|
let hasUndefinedchild = [];
|
|
288
|
+
|
|
191
289
|
//This may be a problem the day a node value is "undefined"
|
|
192
290
|
hasUndefinedchild = childspans.filter(ele => {
|
|
193
291
|
return ele.textContent === 'undefined';
|
|
194
292
|
});
|
|
293
|
+
|
|
195
294
|
// If the user clicked on an unloaded node
|
|
196
295
|
if (target.nodeName === 'SPAN' && target.classList.contains('treejs-switcher') && hasUndefinedchild.length > 0) {
|
|
197
296
|
// Clear the subnode HTML
|
|
198
297
|
e.target.parentNode.querySelector('ul').innerHTML = '';
|
|
298
|
+
|
|
199
299
|
// If source is webservice (it shouldn't be something else)
|
|
200
|
-
if (
|
|
300
|
+
if (this.options.parentApi.options.source == 'webservice') {
|
|
301
|
+
|
|
302
|
+
if (this.options.parentApi.options.origin == 'classification') {
|
|
201
303
|
// WS Call
|
|
202
304
|
this.options.parentApi
|
|
203
|
-
.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
IsDeprecated: parentOptions.options.IsDeprecated,
|
|
207
|
-
})
|
|
305
|
+
.getDataFromSourceClassification(this.options.parentApi.options.url, {
|
|
306
|
+
startNode: target.parentNode.nodeId
|
|
307
|
+
})
|
|
208
308
|
.then(data => {
|
|
209
|
-
|
|
210
|
-
|
|
309
|
+
debugger;
|
|
310
|
+
this.options.parentApi.completeCurrentTreeWithTree(data, target.parentNode.nodeId);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
// WS Call
|
|
315
|
+
this.options.parentApi
|
|
316
|
+
.getDataFromSource(this.options.parentApi.options.url, {
|
|
317
|
+
StartNodeID: target.parentNode.nodeId,
|
|
318
|
+
lng: this.options.parentApi.options.options.lng,
|
|
319
|
+
IsDeprecated: this.options.parentApi.options.options.IsDeprecated,
|
|
320
|
+
})
|
|
321
|
+
.then(data => {
|
|
322
|
+
this.options.parentApi.completeCurrentTreeWithTree(data, target.parentNode.nodeId);
|
|
323
|
+
});
|
|
324
|
+
}
|
|
211
325
|
}
|
|
326
|
+
|
|
212
327
|
this.onSwitcherClick(target);
|
|
213
328
|
}
|
|
214
|
-
}
|
|
215
|
-
|
|
329
|
+
},
|
|
330
|
+
false,
|
|
331
|
+
);
|
|
216
332
|
};
|
|
333
|
+
|
|
217
334
|
Tree.prototype.onItemClick = function (id) {
|
|
218
|
-
if (!this.options.parentApi.theOptions.multiple)
|
|
219
|
-
this.emptyNodesCheckStatus();
|
|
220
335
|
this.options.parentApi.setNodeAsSelected(id, this, true);
|
|
221
336
|
};
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
337
|
+
|
|
338
|
+
Tree.prototype.unCheckElement = id => {
|
|
339
|
+
undefined.setValue(id);
|
|
340
|
+
undefined.updateLiElements();
|
|
225
341
|
};
|
|
342
|
+
|
|
226
343
|
Tree.prototype.setValue = function (value) {
|
|
227
344
|
const node = this.nodesById[value];
|
|
228
|
-
if (!node)
|
|
229
|
-
return;
|
|
345
|
+
if (!node) return;
|
|
230
346
|
const childrenStatus = getChildrenStatus(node);
|
|
231
347
|
const prevStatus = node.status;
|
|
232
348
|
let status = null;
|
|
@@ -234,8 +350,7 @@ Tree.prototype.setValue = function (value) {
|
|
|
234
350
|
if (childrenStatus) {
|
|
235
351
|
status = prevStatus === 1 ? 2 : 1;
|
|
236
352
|
// No child selected default comportement
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
353
|
+
} else {
|
|
239
354
|
status = prevStatus === 1 || prevStatus === 2 ? 0 : 2;
|
|
240
355
|
}
|
|
241
356
|
node.status = status;
|
|
@@ -243,16 +358,17 @@ Tree.prototype.setValue = function (value) {
|
|
|
243
358
|
this.walkUp(node, 'status');
|
|
244
359
|
this.walkDown(node, 'status');
|
|
245
360
|
};
|
|
361
|
+
|
|
246
362
|
function getChildrenStatus(node) {
|
|
247
363
|
if (node.children && node.children.length) {
|
|
248
364
|
const childrenChecked = node.children.reduce((acc, child) => {
|
|
249
|
-
if (!isNaN(child.status))
|
|
250
|
-
return acc + child.status;
|
|
365
|
+
if (!isNaN(child.status)) return acc + child.status;
|
|
251
366
|
return acc;
|
|
252
367
|
}, 0);
|
|
253
368
|
return childrenChecked;
|
|
254
369
|
}
|
|
255
370
|
}
|
|
371
|
+
|
|
256
372
|
Tree.prototype.getValues = function () {
|
|
257
373
|
const values = [];
|
|
258
374
|
for (let id in this.leafNodesById) {
|
|
@@ -264,6 +380,7 @@ Tree.prototype.getValues = function () {
|
|
|
264
380
|
}
|
|
265
381
|
return values;
|
|
266
382
|
};
|
|
383
|
+
|
|
267
384
|
Tree.prototype.setValues = function (values) {
|
|
268
385
|
this.emptyNodesCheckStatus();
|
|
269
386
|
values.forEach(value => {
|
|
@@ -273,10 +390,10 @@ Tree.prototype.setValues = function (values) {
|
|
|
273
390
|
const { onChange } = this.options;
|
|
274
391
|
onChange && onChange.call(this);
|
|
275
392
|
};
|
|
393
|
+
|
|
276
394
|
Tree.prototype.setDisable = function (value) {
|
|
277
395
|
const node = this.nodesById[value];
|
|
278
|
-
if (!node)
|
|
279
|
-
return;
|
|
396
|
+
if (!node) return;
|
|
280
397
|
const prevDisabled = node.disabled;
|
|
281
398
|
if (!prevDisabled) {
|
|
282
399
|
node.disabled = true;
|
|
@@ -285,6 +402,7 @@ Tree.prototype.setDisable = function (value) {
|
|
|
285
402
|
this.walkDown(node, 'disabled');
|
|
286
403
|
}
|
|
287
404
|
};
|
|
405
|
+
|
|
288
406
|
Tree.prototype.getDisables = function () {
|
|
289
407
|
const values = [];
|
|
290
408
|
for (let id in this.leafNodesById) {
|
|
@@ -296,6 +414,7 @@ Tree.prototype.getDisables = function () {
|
|
|
296
414
|
}
|
|
297
415
|
return values;
|
|
298
416
|
};
|
|
417
|
+
|
|
299
418
|
Tree.prototype.setDisables = function (values) {
|
|
300
419
|
this.emptyNodesDisable();
|
|
301
420
|
values.forEach(value => {
|
|
@@ -303,19 +422,21 @@ Tree.prototype.setDisables = function (values) {
|
|
|
303
422
|
});
|
|
304
423
|
this.updateLiElements();
|
|
305
424
|
};
|
|
425
|
+
|
|
306
426
|
Tree.prototype.emptyNodesCheckStatus = function () {
|
|
307
427
|
this.willUpdateNodesById = this.getSelectedNodesById();
|
|
308
|
-
Object.values(this.willUpdateNodesById).forEach(
|
|
309
|
-
if (!node.disabled)
|
|
310
|
-
node.status = 0;
|
|
428
|
+
Object.values(this.willUpdateNodesById).forEach(node => {
|
|
429
|
+
if (!node.disabled) node.status = 0;
|
|
311
430
|
});
|
|
312
431
|
};
|
|
432
|
+
|
|
313
433
|
Tree.prototype.emptyNodesDisable = function () {
|
|
314
434
|
this.willUpdateNodesById = this.getDisabledNodesById();
|
|
315
|
-
Object.values(this.willUpdateNodesById).forEach(
|
|
435
|
+
Object.values(this.willUpdateNodesById).forEach(node => {
|
|
316
436
|
node.disabled = false;
|
|
317
437
|
});
|
|
318
438
|
};
|
|
439
|
+
|
|
319
440
|
Tree.prototype.getSelectedNodesById = function () {
|
|
320
441
|
return Object.entries(this.nodesById).reduce((acc, [id, node]) => {
|
|
321
442
|
if (node.status === 1 || node.status === 2) {
|
|
@@ -324,6 +445,7 @@ Tree.prototype.getSelectedNodesById = function () {
|
|
|
324
445
|
return acc;
|
|
325
446
|
}, {});
|
|
326
447
|
};
|
|
448
|
+
|
|
327
449
|
Tree.prototype.getDisabledNodesById = function () {
|
|
328
450
|
return Object.entries(this.nodesById).reduce((acc, [id, node]) => {
|
|
329
451
|
if (node.disabled) {
|
|
@@ -332,15 +454,18 @@ Tree.prototype.getDisabledNodesById = function () {
|
|
|
332
454
|
return acc;
|
|
333
455
|
}, {});
|
|
334
456
|
};
|
|
457
|
+
|
|
335
458
|
Tree.prototype.updateLiElements = function () {
|
|
336
459
|
Object.values(this.willUpdateNodesById).forEach(node => {
|
|
337
460
|
this.updateLiElement(node);
|
|
338
461
|
});
|
|
339
462
|
this.willUpdateNodesById = {};
|
|
340
463
|
};
|
|
464
|
+
|
|
341
465
|
Tree.prototype.markWillUpdateNode = function (node) {
|
|
342
466
|
this.willUpdateNodesById[node.id] = node;
|
|
343
467
|
};
|
|
468
|
+
|
|
344
469
|
Tree.prototype.onSwitcherClick = function (target) {
|
|
345
470
|
const liEle = target.parentNode;
|
|
346
471
|
const ele = liEle.lastChild;
|
|
@@ -361,8 +486,7 @@ Tree.prototype.onSwitcherClick = function (target) {
|
|
|
361
486
|
liEle.classList.remove('treejs-node__close');
|
|
362
487
|
},
|
|
363
488
|
});
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
489
|
+
} else {
|
|
366
490
|
animation(150, {
|
|
367
491
|
enter() {
|
|
368
492
|
ele.style.height = `${height}px`;
|
|
@@ -380,6 +504,7 @@ Tree.prototype.onSwitcherClick = function (target) {
|
|
|
380
504
|
});
|
|
381
505
|
}
|
|
382
506
|
};
|
|
507
|
+
|
|
383
508
|
Tree.prototype.walkUp = function (node, changeState) {
|
|
384
509
|
const { parent } = node;
|
|
385
510
|
if (parent) {
|
|
@@ -387,36 +512,33 @@ Tree.prototype.walkUp = function (node, changeState) {
|
|
|
387
512
|
let pStatus = null;
|
|
388
513
|
// reduce status of selected children
|
|
389
514
|
const statusCount = parent.children.reduce((acc, child) => {
|
|
390
|
-
if (!isNaN(child.status))
|
|
391
|
-
return acc + child.status;
|
|
515
|
+
if (!isNaN(child.status)) return acc + child.status;
|
|
392
516
|
return acc;
|
|
393
517
|
}, 0);
|
|
394
518
|
// at least one child selected or halfchecked (status 1)
|
|
395
519
|
if (statusCount) {
|
|
396
520
|
// at least one child selected and parent is selected : status 2 else 1
|
|
397
521
|
pStatus = statusCount >= 2 && parent.status === 2 ? 2 : 1;
|
|
398
|
-
}
|
|
399
|
-
else {
|
|
522
|
+
} else {
|
|
400
523
|
pStatus = 0;
|
|
401
524
|
}
|
|
402
|
-
if (parent.status === pStatus || parent.status === 2)
|
|
403
|
-
return;
|
|
525
|
+
if (parent.status === pStatus || parent.status === 2) return;
|
|
404
526
|
parent.status = pStatus;
|
|
405
527
|
if (parent.parent) {
|
|
406
528
|
parent.parent.children.find(item => item.id === parent.id).status = pStatus;
|
|
407
529
|
}
|
|
408
|
-
}
|
|
409
|
-
else {
|
|
530
|
+
} else {
|
|
410
531
|
const pDisabled = parent.children.reduce((acc, child) => acc && child.disabled, true);
|
|
411
|
-
if (parent.disabled === pDisabled)
|
|
412
|
-
return;
|
|
532
|
+
if (parent.disabled === pDisabled) return;
|
|
413
533
|
parent.disabled = pDisabled;
|
|
414
534
|
}
|
|
415
535
|
this.markWillUpdateNode(parent);
|
|
416
536
|
this.walkUp(parent, changeState);
|
|
417
537
|
}
|
|
418
538
|
};
|
|
419
|
-
|
|
539
|
+
|
|
540
|
+
Tree.prototype.walkDown = function (node, changeState) {};
|
|
541
|
+
|
|
420
542
|
Tree.prototype.updateLiElement = function (node) {
|
|
421
543
|
const { classList } = this.liElementsById[node.id];
|
|
422
544
|
switch (node.status) {
|
|
@@ -432,17 +554,17 @@ Tree.prototype.updateLiElement = function (node) {
|
|
|
432
554
|
classList.add('treejs-node__checked');
|
|
433
555
|
break;
|
|
434
556
|
}
|
|
557
|
+
|
|
435
558
|
switch (node.disabled) {
|
|
436
559
|
case true:
|
|
437
|
-
if (!classList.contains('treejs-node__disabled'))
|
|
438
|
-
classList.add('treejs-node__disabled');
|
|
560
|
+
if (!classList.contains('treejs-node__disabled')) classList.add('treejs-node__disabled');
|
|
439
561
|
break;
|
|
440
562
|
case false:
|
|
441
|
-
if (classList.contains('treejs-node__disabled'))
|
|
442
|
-
classList.remove('treejs-node__disabled');
|
|
563
|
+
if (classList.contains('treejs-node__disabled')) classList.remove('treejs-node__disabled');
|
|
443
564
|
break;
|
|
444
565
|
}
|
|
445
566
|
};
|
|
567
|
+
|
|
446
568
|
Tree.parseTreeData = function (data) {
|
|
447
569
|
const treeNodes = deepClone(data);
|
|
448
570
|
const nodesById = {};
|
|
@@ -452,21 +574,17 @@ Tree.parseTreeData = function (data) {
|
|
|
452
574
|
const walkTree = function (nodes, parent) {
|
|
453
575
|
nodes.forEach(node => {
|
|
454
576
|
nodesById[node.id] = node;
|
|
455
|
-
if (node.checked)
|
|
456
|
-
|
|
457
|
-
if (node.
|
|
458
|
-
disables.push(node.id);
|
|
459
|
-
if (parent)
|
|
460
|
-
node.parent = parent;
|
|
577
|
+
if (node.checked) values.push(node.id);
|
|
578
|
+
if (node.disabled) disables.push(node.id);
|
|
579
|
+
if (parent) node.parent = parent;
|
|
461
580
|
if (node.children && node.children.length) {
|
|
462
581
|
walkTree(node.children, node);
|
|
463
|
-
}
|
|
464
|
-
else {
|
|
582
|
+
} else {
|
|
465
583
|
leafNodesById[node.id] = node;
|
|
466
584
|
}
|
|
467
585
|
});
|
|
468
586
|
};
|
|
469
|
-
walkTree(treeNodes
|
|
587
|
+
walkTree(treeNodes);
|
|
470
588
|
return {
|
|
471
589
|
treeNodes,
|
|
472
590
|
nodesById,
|
|
@@ -475,16 +593,19 @@ Tree.parseTreeData = function (data) {
|
|
|
475
593
|
defaultDisables: disables,
|
|
476
594
|
};
|
|
477
595
|
};
|
|
596
|
+
|
|
478
597
|
Tree.createRootEle = function () {
|
|
479
598
|
const div = document.createElement('div');
|
|
480
599
|
div.classList.add('treejs');
|
|
481
600
|
return div;
|
|
482
601
|
};
|
|
602
|
+
|
|
483
603
|
Tree.prototype.createUlEle = function () {
|
|
484
604
|
const ul = document.createElement('ul');
|
|
485
605
|
ul.classList.add('treejs-nodes');
|
|
486
606
|
return ul;
|
|
487
607
|
};
|
|
608
|
+
|
|
488
609
|
Tree.prototype.createLiEle = function (node, closed) {
|
|
489
610
|
const li = document.createElement('li');
|
|
490
611
|
li.classList.add('treejs-node');
|
|
@@ -494,29 +615,29 @@ Tree.prototype.createLiEle = function (node, closed) {
|
|
|
494
615
|
if (node.isDesaturated) {
|
|
495
616
|
li.classList.add('treejs-node__desaturated');
|
|
496
617
|
}
|
|
497
|
-
if (closed)
|
|
498
|
-
li.classList.add('treejs-node__close');
|
|
618
|
+
if (closed) li.classList.add('treejs-node__close');
|
|
499
619
|
if (node.children && node.children.length) {
|
|
500
620
|
const switcher = document.createElement('span');
|
|
501
621
|
switcher.classList.add('treejs-switcher');
|
|
502
622
|
li.appendChild(switcher);
|
|
503
|
-
}
|
|
504
|
-
else {
|
|
623
|
+
} else {
|
|
505
624
|
li.classList.add('treejs-placeholder');
|
|
506
625
|
}
|
|
507
|
-
|
|
626
|
+
|
|
627
|
+
if (!this.options.parentApi || (this.options.parentApi && this.options.parentApi.options.multiple)) {
|
|
508
628
|
const checkbox = document.createElement('span');
|
|
509
629
|
checkbox.classList.add('treejs-checkbox');
|
|
510
630
|
li.appendChild(checkbox);
|
|
511
631
|
}
|
|
632
|
+
|
|
512
633
|
const label = document.createElement('span');
|
|
513
634
|
label.classList.add('treejs-label');
|
|
514
635
|
const text = document.createTextNode(node.text);
|
|
515
636
|
label.appendChild(text);
|
|
516
637
|
li.appendChild(label);
|
|
517
638
|
li.nodeId = node.id;
|
|
518
|
-
if (this.options.parentApi.
|
|
519
|
-
li.setAttribute('draggable',
|
|
639
|
+
if (this.options.parentApi.options.dragAndDropEnabled) {
|
|
640
|
+
li.setAttribute('draggable', true);
|
|
520
641
|
li.addEventListener('dragstart', e => {
|
|
521
642
|
this.options.parentApi.onItemDragStart(li, e);
|
|
522
643
|
});
|
|
@@ -533,25 +654,10 @@ Tree.prototype.createLiEle = function (node, closed) {
|
|
|
533
654
|
this.options.parentApi.onItemDrop(li, e);
|
|
534
655
|
});
|
|
535
656
|
}
|
|
657
|
+
|
|
536
658
|
return li;
|
|
537
659
|
};
|
|
538
660
|
|
|
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
661
|
var lodash = createCommonjsModule(function (module, exports) {
|
|
556
662
|
(function() {
|
|
557
663
|
|
|
@@ -17742,23 +17848,13 @@ var lodash = createCommonjsModule(function (module, exports) {
|
|
|
17742
17848
|
}.call(commonjsGlobal));
|
|
17743
17849
|
});
|
|
17744
17850
|
|
|
17745
|
-
var browser = XMLHttpRequest;
|
|
17746
|
-
|
|
17747
|
-
const hierarchizedPickerCss = "reneco-hierarchized-picker .hierarchized-picker-raw-tree-area{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box}reneco-hierarchized-picker .loader{position:absolute;z-index:1;min-width:100%;min-height:100%;background:#FFFFFF99;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:10px;-webkit-box-sizing:border-box;box-sizing:border-box}reneco-hierarchized-picker .loader .loader-inner{background:#FFF;padding:20px;-webkit-box-shadow:0 0 5px #000;box-shadow:0 0 5px #000;-webkit-box-sizing:border-box;box-sizing:border-box}reneco-hierarchized-picker .loader:not(.loading){display:none}reneco-hierarchized-picker .scrollable{overflow-y:auto;position:relative}reneco-hierarchized-picker .treejs{-webkit-box-sizing:border-box;box-sizing:border-box;font-size:14px}reneco-hierarchized-picker .treejs *:after,reneco-hierarchized-picker .treejs *:before{-webkit-box-sizing:border-box;box-sizing:border-box}reneco-hierarchized-picker .treejs>.treejs-node{padding-left:0}reneco-hierarchized-picker .treejs .treejs-nodes{list-style:none;padding-left:20px;overflow:hidden;-webkit-transition:height 150ms ease-out, opacity 150ms ease-out;-o-transition:height 150ms ease-out, opacity 150ms ease-out;transition:height 150ms ease-out, opacity 150ms ease-out}reneco-hierarchized-picker .treejs .treejs-node{cursor:pointer;overflow:hidden;position:relative}reneco-hierarchized-picker .treejs .treejs-node.treejs-placeholder{padding-left:20px}reneco-hierarchized-picker .treejs .treejs-switcher{display:inline-block;vertical-align:middle;width:20px;height:20px;cursor:pointer;position:relative;-webkit-transition:-webkit-transform 150ms ease-out;transition:-webkit-transform 150ms ease-out;-o-transition:transform 150ms ease-out;transition:transform 150ms ease-out;transition:transform 150ms ease-out, -webkit-transform 150ms ease-out}reneco-hierarchized-picker .treejs .treejs-switcher:before{position:absolute;top:8px;left:6px;display:block;content:' ';border:4px solid transparent;border-top:4px solid rgba(0, 0, 0, 0.4);-webkit-transition:border-color 150ms;-o-transition:border-color 150ms;transition:border-color 150ms}reneco-hierarchized-picker .treejs .treejs-switcher:hover:before{border-top:4px solid rgba(0, 0, 0, 0.65)}reneco-hierarchized-picker .treejs .treejs-node__close>.treejs-switcher{-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg)}reneco-hierarchized-picker .treejs .treejs-node__close>.treejs-nodes{height:0}reneco-hierarchized-picker .treejs .treejs-checkbox{display:inline-block;vertical-align:middle;width:20px;height:20px;cursor:pointer;position:relative}reneco-hierarchized-picker .treejs .treejs-checkbox:before{-webkit-transition:all 0.3s;-o-transition:all 0.3s;transition:all 0.3s;cursor:pointer;position:absolute;top:2px;content:' ';display:block;width:16px;height:16px;border:1px solid #d9d9d9;border-radius:2px}reneco-hierarchized-picker .treejs .treejs-checkbox:hover:before{-webkit-box-shadow:0 0 2px 1px #1890ff;box-shadow:0 0 2px 1px #1890ff}reneco-hierarchized-picker .treejs .treejs-node__checked>.treejs-checkbox:before{background-color:#1890ff;border-color:#1890ff}reneco-hierarchized-picker .treejs .treejs-node__checked>.treejs-checkbox:after{position:absolute;content:' ';display:block;top:4px;left:5px;width:5px;height:9px;border:2px solid #fff;border-top:none;border-left:none;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}reneco-hierarchized-picker .treejs .treejs-node__halfchecked>.treejs-checkbox:before{background-color:#1890ff;border-color:#1890ff}reneco-hierarchized-picker .treejs .treejs-node__halfchecked>.treejs-checkbox:after{position:absolute;content:' ';display:block;top:9px;left:3px;width:10px;height:2px;background-color:#fff}reneco-hierarchized-picker .treejs .treejs-node__disabled{cursor:not-allowed;color:rgba(0, 0, 0, 0.25)}reneco-hierarchized-picker .treejs .treejs-node__disabled .treejs-checkbox{cursor:not-allowed}reneco-hierarchized-picker .treejs .treejs-node__disabled .treejs-checkbox:before{cursor:not-allowed;border-color:#d9d9d9 !important;background-color:#f5f5f5 !important}reneco-hierarchized-picker .treejs .treejs-node__disabled .treejs-checkbox:hover:before{-webkit-box-shadow:none !important;box-shadow:none !important}reneco-hierarchized-picker .treejs .treejs-node__disabled .treejs-node__checked>.treejs-checkbox:after{border-color:#d9d9d9}reneco-hierarchized-picker .treejs .treejs-node__disabled .treejs-node__halfchecked>.treejs-checkbox:after{background-color:#d9d9d9}reneco-hierarchized-picker .treejs .treejs-node__disabled.treejs-node__checked>.treejs-checkbox:after{border-color:#d9d9d9}reneco-hierarchized-picker .treejs .treejs-node__disabled.treejs-node__halfchecked>.treejs-checkbox:after{background-color:#d9d9d9}reneco-hierarchized-picker .treejs .treejs-label{vertical-align:middle}reneco-hierarchized-picker .treejs .treejs-node__deprecated>.treejs-label{text-decoration:line-through}reneco-hierarchized-picker .treejs .treejs-node__desaturated>.treejs-label{opacity:.5}reneco-hierarchized-picker .treejs .dragging{background:yellow;display:inline;opacity:.9;padding:11px 0px;display:block}reneco-hierarchized-picker .treejs .dragover{background:#CCC}reneco-hierarchized-picker .treejs .dragover-over::after{content:\"\";display:block;width:2px;height:100%;position:absolute;top:0;left:0;background:red}reneco-hierarchized-picker .treejs .dragover-before::after{content:\"\";display:block;height:2px;width:100%;position:absolute;top:0;left:0;background:red}reneco-hierarchized-picker .treejs .dragover-after::after{content:\"\";display:block;height:2px;width:100%;position:absolute;bottom:0;left:0;background:red}reneco-hierarchized-picker .fieldError{color:red !important}reneco-hierarchized-picker .hidden{display:none;opacity:0}reneco-hierarchized-picker ul.treejs-nodes:first-child{padding-left:0px !important;margin-top:0px !important;margin-left:0px !important}reneco-hierarchized-picker ul.treejs-nodes:not(:first-child){margin:0 !important;padding-left:15px !important;background-color:var(--ion-color-light-tint, #FFF)}reneco-hierarchized-picker ul.treejs-nodes{margin-left:15px !important;padding-left:0px !important}reneco-hierarchized-picker .hierarchized-picker-raw-tree li.treejs-node ul.treejs-nodes{margin:11px 0 0 0 !important}reneco-hierarchized-picker .hierarchized-picker-raw-tree li.treejs-node__close ul.treejs-nodes{margin:0 !important}reneco-hierarchized-picker li.treejs-node__close{background-color:var(--ion-color-light, #FAFAFA)}reneco-hierarchized-picker li:not(.treejs-node__close){background-color:var(--ion-color-medium, #bdbdbd7d);padding-bottom:0px !important}reneco-hierarchized-picker li:not(.treejs-node__close) ul.treejs-nodes li{margin-top:2px !important}reneco-hierarchized-picker ul li:last-child{margin-bottom:0px !important}reneco-hierarchized-picker li.treejs-node__checked{background-color:var(--ion-color-background, var(--mui-palette-background-default, rgba(221, 169, 37, 0.18)))}reneco-hierarchized-picker li.treejs-node{padding:2px 0px;margin-bottom:2px}reneco-hierarchized-picker .treejs-node.readonly_node{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:darkgrey}reneco-hierarchized-picker .treejs-node:not(.readonly_node){-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:black}reneco-hierarchized-picker .hierarchized-picker-container{position:relative;width:100%}reneco-hierarchized-picker .hierarchized-picker-input-area{background-color:transparent !important;display:inline;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}reneco-hierarchized-picker .hierarchized-picker-input-area .input-wrapper{padding-left:10px !important}reneco-hierarchized-picker .hierarchized-picker-input{-ms-flex:2;flex:2}reneco-hierarchized-picker .hierarchized-picker-input.readonly{pointer-events:none;cursor:initial}reneco-hierarchized-picker .hierarchized-picker-input.hierarchized-picker-icon{margin-left:8px}reneco-hierarchized-picker .hierarchized-picker-label{position:stacked;margin-left:5px}reneco-hierarchized-picker .hierarchized-picker-input input,reneco-hierarchized-picker .hierarchized-picker-search input{padding-left:5px !important;text-overflow:ellipsis !important;border:0;background:transparent;outline:none}reneco-hierarchized-picker .hierarchized-picker-search input{width:90%}reneco-hierarchized-picker .hierarchized-picker-search{background-color:var(--ion-color-medium-tint, #E0E0E0);position:absolute !important;width:333px !important;margin-top:10px;border-radius:4px;padding:8.5px}reneco-hierarchized-picker .hierarchized-picker-tree-area{width:333px !important;padding-top:48px}reneco-hierarchized-picker .hierarchized-picker-modal-area{background-color:var(--ion-color-light-tint, #FFF) !important;position:absolute;z-index:10;padding-left:15px;overflow:scroll;top:20px;min-height:100px;max-height:200px;-webkit-box-shadow:0 0px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 0px 15px 0 rgba(0, 0, 0, 0.2);border-radius:4px;margin-right:0px !important}reneco-hierarchized-picker .hierarchized-picker-modal{display:inline-block;width:357px}reneco-hierarchized-picker .hierarchized-picker{display:-ms-flexbox;display:flex;width:100%;font-family:'Roboto', sans-serif}reneco-hierarchized-picker .hierarchized-picker-spinner{margin:35px 0px 0px 145px}reneco-hierarchized-picker .reneco:before{position:relative;top:1px}reneco-hierarchized-picker .hierarchized-picker-input-area span.reneco{padding:10px 15px}reneco-hierarchized-picker .hierarchized-picker-input-area span.reneco:hover{cursor:pointer}reneco-hierarchized-picker .hierarchized-picker-input-area span.reneco-close{-webkit-transform:translate(5px, -8px);transform:translate(5px, -8px);color:var(--ion-color-danger, red) !important}reneco-hierarchized-picker .treejs .treejs-switcher:before{border-top:4px solid var(--ion-color-dark-shade, #121212)}reneco-hierarchized-picker .treejs .treejs-checkbox:before{-webkit-box-shadow:none !important;box-shadow:none !important}reneco-hierarchized-picker .treejs .treejs-node__checked>.treejs-checkbox:before,reneco-hierarchized-picker .treejs .treejs-node__halfchecked>.treejs-checkbox:before{background-color:var(--ion-color-primary, var(--mui-palette-primary-main, #d58433)) !important;border-color:var(--ion-color-primary, var(--mui-palette-primary-main, #d58433)) !important;-webkit-box-shadow:none !important;box-shadow:none !important}reneco-hierarchized-picker #searchInTree{padding:8.5px 8px;background:var(--ion-color-background, var(--mui-palette-background-default, rgba(221, 169, 37, 0.18)));border:none !important;border-radius:4px}reneco-hierarchized-picker #searchInTree:focus{border:none !important;outline:none !important;-webkit-box-shadow:none !important;box-shadow:none !important}reneco-hierarchized-picker #autocomplete-results-area{position:absolute;margin-top:48px;background-color:white;left:15px;z-index:10;padding:0px 5px;max-width:340px;max-height:110px;overflow:auto}reneco-hierarchized-picker #autocomplete-results-area li{list-style-type:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;margin:1px}reneco-hierarchized-picker .hierarchized-picker-raw-tree-area li.treejs-node{padding:11px 0px;display:block}.hierarchized-picker-raw-tree-area.readonly li.treejs-node{cursor:initial;pointer-events:none}.hierarchized-picker-raw-tree-area.readonly li.treejs-node .treejs-switcher{pointer-events:all}::-webkit-scrollbar-thumb{background:var(--ion-color-primary, var(--mui-palette-primary-main, #d58433));width:8px;margin:5px;border-radius:5px}::-webkit-scrollbar{background:var(--ion-color-medium-tint, #E0E0E0);width:8px;height:8px;margin:5px;cursor:pointer;border-radius:5px}::-webkit-scrollbar-corner{background-color:var(--ion-color-light-tint, #FFF)}[class$=\"-dark\"] reneco-hierarchized-picker li.treejs-node__close{background-color:var(--ion-color-dark-tint, #424242);color:var(--ion-color-dark-contrast, #fff)}[class$=\"-dark\"] reneco-hierarchized-picker li:not(.treejs-node__close){background-color:var(--ion-color-dark, #212121);color:var(--ion-color-dark-contrast, #fff)}[class$=\"-dark\"] reneco-hierarchized-picker li.treejs-node__checked{background-color:var(--ion-color-background, var(--mui-palette-background-default, rgba(221, 169, 37, 0.18)));color:var(--ion-color-primary-contrast, #fff) !important}[class$=\"-dark\"] reneco-hierarchized-picker .treejs-switcher:before{border-top-color:var(--ion-color-dark-contrast, #fff) !important}[class$=\"-dark\"] reneco-hierarchized-picker li.treejs-node__checked .treejs-switcher:before{color:var(--ion-color-light-contrast, #111111) !important}[class$=\"-dark\"] reneco-hierarchized-picker ul.treejs-nodes:not(:first-child){background-color:var(--ion-color-light-contrast, #111111) !important}";
|
|
17851
|
+
const hierarchizedPickerCss = "reneco-hierarchized-picker .hierarchized-picker-raw-tree-area{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box}reneco-hierarchized-picker .loader{position:absolute;z-index:1;min-width:100%;min-height:100%;background:#FFFFFF99;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:10px;-webkit-box-sizing:border-box;box-sizing:border-box}reneco-hierarchized-picker .loader .loader-inner{background:#FFF;padding:20px;-webkit-box-shadow:0 0 5px #000;box-shadow:0 0 5px #000;-webkit-box-sizing:border-box;box-sizing:border-box}reneco-hierarchized-picker .loader:not(.loading){display:none}reneco-hierarchized-picker .scrollable{overflow-y:auto;position:relative}reneco-hierarchized-picker .treejs{-webkit-box-sizing:border-box;box-sizing:border-box;font-size:14px}reneco-hierarchized-picker .treejs *:after,reneco-hierarchized-picker .treejs *:before{-webkit-box-sizing:border-box;box-sizing:border-box}reneco-hierarchized-picker .treejs>.treejs-node{padding-left:0}reneco-hierarchized-picker .treejs .treejs-nodes{list-style:none;padding-left:20px;overflow:hidden;-webkit-transition:height 150ms ease-out, opacity 150ms ease-out;-o-transition:height 150ms ease-out, opacity 150ms ease-out;transition:height 150ms ease-out, opacity 150ms ease-out}reneco-hierarchized-picker .treejs .treejs-node{cursor:pointer;overflow:hidden;position:relative}reneco-hierarchized-picker .treejs .treejs-node.treejs-placeholder{padding-left:20px}reneco-hierarchized-picker .treejs .treejs-switcher{display:inline-block;vertical-align:middle;width:20px;height:20px;cursor:pointer;position:relative;-webkit-transition:-webkit-transform 150ms ease-out;transition:-webkit-transform 150ms ease-out;-o-transition:transform 150ms ease-out;transition:transform 150ms ease-out;transition:transform 150ms ease-out, -webkit-transform 150ms ease-out}reneco-hierarchized-picker .treejs .treejs-switcher:before{position:absolute;top:8px;left:6px;display:block;content:' ';border:4px solid transparent;border-top:4px solid rgba(0, 0, 0, 0.4);-webkit-transition:border-color 150ms;-o-transition:border-color 150ms;transition:border-color 150ms}reneco-hierarchized-picker .treejs .treejs-switcher:hover:before{border-top:4px solid rgba(0, 0, 0, 0.65)}reneco-hierarchized-picker .treejs .treejs-node__close>.treejs-switcher{-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg)}reneco-hierarchized-picker .treejs .treejs-node__close>.treejs-nodes{height:0}reneco-hierarchized-picker .treejs .treejs-checkbox{display:inline-block;vertical-align:middle;width:20px;height:20px;cursor:pointer;position:relative}reneco-hierarchized-picker .treejs .treejs-checkbox:before{-webkit-transition:all 0.3s;-o-transition:all 0.3s;transition:all 0.3s;cursor:pointer;position:absolute;top:2px;content:' ';display:block;width:16px;height:16px;border:1px solid #d9d9d9;border-radius:2px}reneco-hierarchized-picker .treejs .treejs-checkbox:hover:before{-webkit-box-shadow:0 0 2px 1px #1890ff;box-shadow:0 0 2px 1px #1890ff}reneco-hierarchized-picker .treejs .treejs-node__checked>.treejs-checkbox:before{background-color:#1890ff;border-color:#1890ff}reneco-hierarchized-picker .treejs .treejs-node__checked>.treejs-checkbox:after{position:absolute;content:' ';display:block;top:4px;left:5px;width:5px;height:9px;border:2px solid #fff;border-top:none;border-left:none;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}reneco-hierarchized-picker .treejs .treejs-node__halfchecked>.treejs-checkbox:before{background-color:#1890ff;border-color:#1890ff}reneco-hierarchized-picker .treejs .treejs-node__halfchecked>.treejs-checkbox:after{position:absolute;content:' ';display:block;top:9px;left:3px;width:10px;height:2px;background-color:#fff}reneco-hierarchized-picker .treejs .treejs-node__disabled{cursor:not-allowed;color:rgba(0, 0, 0, 0.25)}reneco-hierarchized-picker .treejs .treejs-node__disabled .treejs-checkbox{cursor:not-allowed}reneco-hierarchized-picker .treejs .treejs-node__disabled .treejs-checkbox:before{cursor:not-allowed;border-color:#d9d9d9 !important;background-color:#f5f5f5 !important}reneco-hierarchized-picker .treejs .treejs-node__disabled .treejs-checkbox:hover:before{-webkit-box-shadow:none !important;box-shadow:none !important}reneco-hierarchized-picker .treejs .treejs-node__disabled .treejs-node__checked>.treejs-checkbox:after{border-color:#d9d9d9}reneco-hierarchized-picker .treejs .treejs-node__disabled .treejs-node__halfchecked>.treejs-checkbox:after{background-color:#d9d9d9}reneco-hierarchized-picker .treejs .treejs-node__disabled.treejs-node__checked>.treejs-checkbox:after{border-color:#d9d9d9}reneco-hierarchized-picker .treejs .treejs-node__disabled.treejs-node__halfchecked>.treejs-checkbox:after{background-color:#d9d9d9}reneco-hierarchized-picker .treejs .treejs-label{vertical-align:middle}reneco-hierarchized-picker .treejs .treejs-node__deprecated>.treejs-label{text-decoration:line-through}reneco-hierarchized-picker .treejs .treejs-node__desaturated>.treejs-label{opacity:.5}reneco-hierarchized-picker .treejs .dragging{background:yellow;display:inline;opacity:.9}reneco-hierarchized-picker .treejs .dragover{background:#CCC}reneco-hierarchized-picker .treejs .dragover-over::after{content:\"\";display:block;width:2px;height:100%;position:absolute;top:0;left:0;background:red}reneco-hierarchized-picker .treejs .dragover-before::after{content:\"\";display:block;height:2px;width:100%;position:absolute;top:0;left:0;background:red}reneco-hierarchized-picker .treejs .dragover-after::after{content:\"\";display:block;height:2px;width:100%;position:absolute;bottom:0;left:0;background:red}reneco-hierarchized-picker .fieldError{color:red !important}reneco-hierarchized-picker .readonly-mode{color:grey}reneco-hierarchized-picker .hidden{display:none;opacity:0}reneco-hierarchized-picker ul.treejs-nodes:first-child{padding-left:0px !important;margin-top:0px !important;margin-left:0px !important}reneco-hierarchized-picker ul.treejs-nodes:not(:first-child){margin:0 !important;padding-left:15px !important;background-color:var(--ion-color-light-tint, #F0F0F0)}reneco-hierarchized-picker ul.treejs-nodes{margin-left:15px !important;padding-left:0px !important}reneco-hierarchized-picker .hierarchized-picker-raw-tree li.treejs-node ul.treejs-nodes{margin:11px 0 0 0 !important}reneco-hierarchized-picker .hierarchized-picker-raw-tree li.treejs-node__close ul.treejs-nodes{margin:0 !important}reneco-hierarchized-picker li.treejs-node__close{background-color:var(--ion-color-light)}reneco-hierarchized-picker li:not(.treejs-node__close){background-color:var(--ion-color-medium);padding-bottom:0px !important}reneco-hierarchized-picker li:not(.treejs-node__close) ul.treejs-nodes li{margin-top:2px !important}reneco-hierarchized-picker ul li:last-child{margin-bottom:0px !important}reneco-hierarchized-picker li.treejs-node__checked{background-color:var(--ion-color-background, initial)}reneco-hierarchized-picker li.treejs-node{padding:2px 0px;margin-bottom:2px}reneco-hierarchized-picker .treejs-node.readonly_node{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:darkgrey}reneco-hierarchized-picker .treejs-node:not(.readonly_node){-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:black}reneco-hierarchized-picker .hierarchized-picker-container{position:relative;width:100%}reneco-hierarchized-picker .hierarchized-picker-input-area{background-color:transparent !important;display:inline;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}reneco-hierarchized-picker .hierarchized-picker-input-area .input-wrapper{padding-left:10px !important}reneco-hierarchized-picker .hierarchized-picker-input{-ms-flex:2;flex:2}reneco-hierarchized-picker .hierarchized-picker-input.hierarchized-picker-icon{margin-left:8px}reneco-hierarchized-picker .hierarchized-picker-label{position:stacked;margin-left:5px}reneco-hierarchized-picker .hierarchized-picker-input input,reneco-hierarchized-picker .hierarchized-picker-search input{padding-left:5px !important;text-overflow:ellipsis !important;border:0;background:transparent;outline:none}reneco-hierarchized-picker .hierarchized-picker-search input{width:90%}reneco-hierarchized-picker .hierarchized-picker-search{background-color:var(--ion-color-medium-tint);position:absolute !important;width:333px !important;margin-top:10px;border-radius:4px;padding:8.5px}reneco-hierarchized-picker .hierarchized-picker-tree-area{width:333px !important;padding-top:45px}reneco-hierarchized-picker .hierarchized-picker-modal-area{background-color:var(--ion-color-light-tint) !important;position:absolute;z-index:10;padding-left:15px;overflow:auto;top:30px;min-height:100px;max-height:200px;-webkit-box-shadow:0 0px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 0px 15px 0 rgba(0, 0, 0, 0.2);border-radius:4px;margin-right:0px !important}reneco-hierarchized-picker .hierarchized-picker-modal{display:inline-block;width:357px}reneco-hierarchized-picker .hierarchized-picker{display:-ms-flexbox;display:flex;width:100%;font-family:'Roboto', sans-serif}reneco-hierarchized-picker .hierarchized-picker-spinner{margin:35px 0px 0px 145px}reneco-hierarchized-picker .reneco:before{position:relative;top:1px}reneco-hierarchized-picker .hierarchized-picker-input-area span.reneco{padding:10px 15px}reneco-hierarchized-picker .hierarchized-picker-input-area span.reneco:hover{cursor:pointer}reneco-hierarchized-picker .hierarchized-picker-input-area span.reneco-close{-webkit-transform:translate(5px, -8px);transform:translate(5px, -8px);color:var(--ion-color-danger, red) !important}reneco-hierarchized-picker .treejs .treejs-switcher:before{border-top:4px solid var(--ion-color-dark-shade, #121212)}reneco-hierarchized-picker .treejs .treejs-checkbox:before{-webkit-box-shadow:none !important;box-shadow:none !important}reneco-hierarchized-picker .treejs .treejs-node__checked>.treejs-checkbox:before,reneco-hierarchized-picker .treejs .treejs-node__halfchecked>.treejs-checkbox:before{background-color:var(--ion-color-primary) !important;border-color:var(--ion-color-primary) !important;-webkit-box-shadow:none !important;box-shadow:none !important}reneco-hierarchized-picker #searchInTree{padding:8.5px 8px;background:var(--ion-color-background);border:none !important;border-radius:4px}reneco-hierarchized-picker #searchInTree:focus{border:none !important;outline:none !important;-webkit-box-shadow:none !important;box-shadow:none !important}reneco-hierarchized-picker #autocomplete-results-area{position:absolute;margin-top:28px;background-color:white;left:20px;z-index:10;padding:0px 5px;max-width:300px;max-height:110px;overflow:auto}reneco-hierarchized-picker #autocomplete-results-area li{list-style-type:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}reneco-hierarchized-picker .hierarchized-picker-raw-tree-area li.treejs-node{padding:11px 0px}::-webkit-scrollbar-thumb{background:var(--ion-color-primary);width:8px;margin:5px;border-radius:5px}::-webkit-scrollbar{background:var(--ion-color-medium-tint);width:8px;height:8px;margin:5px;cursor:pointer;border-radius:5px}::-webkit-scrollbar-corner{background-color:var(--ion-color-light-tint)}[class$=\"-dark\"] reneco-hierarchized-picker li.treejs-node__close{background-color:var(--ion-color-dark-tint);color:var(--ion-color-dark-contrast)}[class$=\"-dark\"] reneco-hierarchized-picker li:not(.treejs-node__close){background-color:var(--ion-color-dark);color:var(--ion-color-dark-contrast)}[class$=\"-dark\"] reneco-hierarchized-picker li.treejs-node__checked{background-color:var(--ion-color-background, initial);color:var(--ion-color-primary-contrast) !important}[class$=\"-dark\"] reneco-hierarchized-picker .treejs-switcher:before{border-top-color:var(--ion-color-dark-contrast, #fff) !important}[class$=\"-dark\"] reneco-hierarchized-picker li.treejs-node__checked .treejs-switcher:before{color:var(--ion-color-light-contrast) !important}[class$=\"-dark\"] reneco-hierarchized-picker ul.treejs-nodes:not(:first-child){background-color:var(--ion-color-light-contrast) !important}";
|
|
17748
17852
|
|
|
17749
|
-
const waitBeforeTriggerSearch =
|
|
17853
|
+
const waitBeforeTriggerSearch = 200;
|
|
17750
17854
|
function isNumeric(n) {
|
|
17751
17855
|
return !isNaN(parseFloat(n)) && isFinite(n);
|
|
17752
17856
|
}
|
|
17753
|
-
|
|
17754
|
-
if (typeof value === "object" && value !== null) {
|
|
17755
|
-
if (value instanceof browser) {
|
|
17756
|
-
return "[XMLHttpRequest object]";
|
|
17757
|
-
}
|
|
17758
|
-
}
|
|
17759
|
-
return value;
|
|
17760
|
-
}
|
|
17761
|
-
const HierarchizedPickerComponent = class {
|
|
17857
|
+
const MyComponent = class {
|
|
17762
17858
|
constructor(hostRef) {
|
|
17763
17859
|
index.registerInstance(this, hostRef);
|
|
17764
17860
|
this.valueChange = index.createEvent(this, "valueChange", 7);
|
|
@@ -17770,19 +17866,9 @@ const HierarchizedPickerComponent = class {
|
|
|
17770
17866
|
this.ignoreOptionsChanges = true; // Determines wether the options @Prop under @Watch will be ignored (to avoid circular calls)
|
|
17771
17867
|
this.setValueOnClick = true; // Tells wether we edit the picker value on click in the tree
|
|
17772
17868
|
this.mylog = console.log; // Custom log function for debug purposes
|
|
17773
|
-
// Used to control wether we're draging over the same node, prevents the same event to be called multiple times
|
|
17774
|
-
this.lastDragedOverNodeId = null;
|
|
17775
|
-
// Used to control wether an event is being triggered one extra unwanted time on anscend of the targeted element
|
|
17776
|
-
this.lastDragedOverTimeForAscendent = new Date().getTime();
|
|
17777
|
-
// Used to remember when was last triggered the event over the target
|
|
17778
|
-
this.lastDragedOverTimeForLevel = new Date().getTime();
|
|
17779
|
-
// Used to accept the event being triggered on the same node multiple times after a delay to allow different drop modes
|
|
17780
|
-
this.acceptableDelayBetweenSimilarActions = 300;
|
|
17781
17869
|
this.options = undefined;
|
|
17782
17870
|
this.valueChangeCallback = undefined;
|
|
17783
17871
|
this.disabled = undefined;
|
|
17784
|
-
this.isDisabled = undefined;
|
|
17785
|
-
this.theOptions = undefined;
|
|
17786
17872
|
this.newoptions = undefined;
|
|
17787
17873
|
this.newfilter = undefined;
|
|
17788
17874
|
this.componentID = undefined;
|
|
@@ -17796,8 +17882,8 @@ const HierarchizedPickerComponent = class {
|
|
|
17796
17882
|
}
|
|
17797
17883
|
getValue() {
|
|
17798
17884
|
var _a, _b, _c, _d;
|
|
17799
|
-
if (!this.
|
|
17800
|
-
if (this.
|
|
17885
|
+
if (!this.options.output) {
|
|
17886
|
+
if (this.options.multiple) {
|
|
17801
17887
|
return Promise.resolve(this.value);
|
|
17802
17888
|
}
|
|
17803
17889
|
else {
|
|
@@ -17805,37 +17891,33 @@ const HierarchizedPickerComponent = class {
|
|
|
17805
17891
|
}
|
|
17806
17892
|
}
|
|
17807
17893
|
else {
|
|
17808
|
-
if (this.
|
|
17809
|
-
return Promise.resolve((_b = this.value) === null || _b === void 0 ? void 0 : _b.map(item => item[this.
|
|
17894
|
+
if (this.options.multiple) {
|
|
17895
|
+
return Promise.resolve((_b = this.value) === null || _b === void 0 ? void 0 : _b.map(item => item[this.options.output]));
|
|
17810
17896
|
}
|
|
17811
17897
|
else {
|
|
17812
|
-
return Promise.resolve((_d = (_c = this.value) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d[this.
|
|
17898
|
+
return Promise.resolve((_d = (_c = this.value) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d[this.options.output]);
|
|
17813
17899
|
}
|
|
17814
17900
|
}
|
|
17815
17901
|
}
|
|
17816
17902
|
logError(messageToLog) {
|
|
17817
|
-
|
|
17818
|
-
console.error('--- Hierarchized picker ' + this.componentID + ' ERROR ---', messageToLog);
|
|
17819
|
-
}
|
|
17820
|
-
catch (_a) {
|
|
17821
|
-
console.error('--- Hierarchized picker generic ERROR ---');
|
|
17822
|
-
}
|
|
17903
|
+
console.error('--- Hierarchized picker ' + this.componentID + ' ERROR ---', messageToLog);
|
|
17823
17904
|
}
|
|
17824
17905
|
reloadCurrentValues() {
|
|
17825
17906
|
let savedValues = this.value;
|
|
17907
|
+
debugger;
|
|
17826
17908
|
this.value = [];
|
|
17827
17909
|
savedValues.forEach(element => {
|
|
17828
17910
|
this.editValue(element.nodeid);
|
|
17829
17911
|
});
|
|
17830
17912
|
}
|
|
17831
|
-
|
|
17913
|
+
setNewOption(newValue, oldValue = null) {
|
|
17832
17914
|
this.canload = true;
|
|
17833
|
-
this.
|
|
17834
|
-
if (this.
|
|
17915
|
+
this.options = newValue;
|
|
17916
|
+
if (this.options.source != "file") {
|
|
17835
17917
|
this.rawData = null;
|
|
17836
17918
|
}
|
|
17837
17919
|
this.ready = false;
|
|
17838
|
-
|
|
17920
|
+
this.loadHierarchizedPicker();
|
|
17839
17921
|
this.displayWhenLoaded();
|
|
17840
17922
|
//NOTE: This could work in a synchronous environment => this.reloadCurrentValues();
|
|
17841
17923
|
}
|
|
@@ -17846,7 +17928,7 @@ const HierarchizedPickerComponent = class {
|
|
|
17846
17928
|
this.filterTree(newfilter);
|
|
17847
17929
|
}
|
|
17848
17930
|
optionsChange(newValue) {
|
|
17849
|
-
if (!this.
|
|
17931
|
+
if (!this.options || !this.ready || this.ignoreOptionsChanges) {
|
|
17850
17932
|
return;
|
|
17851
17933
|
}
|
|
17852
17934
|
this.setNewOption(newValue);
|
|
@@ -17882,7 +17964,7 @@ const HierarchizedPickerComponent = class {
|
|
|
17882
17964
|
//TODO allow Function along with string
|
|
17883
17965
|
if (!((object.source != 'webservice' && !object.token) || (object.source == 'webservice' && object.token && (typeof object.token == 'string' || typeof object.token == 'function')))) {
|
|
17884
17966
|
toret = false;
|
|
17885
|
-
this.errorToLog = "options.token value doesn't meet interface IConf requirements or doesn't match option.source value
|
|
17967
|
+
this.errorToLog = "options.token value doesn't meet interface IConf requirements or doesn't match option.source value";
|
|
17886
17968
|
}
|
|
17887
17969
|
if (!((object.source != 'webservice' && !object.options) || (object.source == 'webservice' && object.options && typeof object.options == 'object'))) {
|
|
17888
17970
|
toret = false;
|
|
@@ -17897,7 +17979,7 @@ const HierarchizedPickerComponent = class {
|
|
|
17897
17979
|
this.errorToLog = "options.url value '" + object.url + "' doesn't meet interface IConf requirements or doesn't match option.source value";
|
|
17898
17980
|
}
|
|
17899
17981
|
}
|
|
17900
|
-
if (!(typeof object.origin == 'string' && ['thesaurus', 'position'].indexOf(object.origin) > -1)) {
|
|
17982
|
+
if (!(typeof object.origin == 'string' && ['thesaurus', 'position', 'classification'].indexOf(object.origin) > -1)) {
|
|
17901
17983
|
toret = false;
|
|
17902
17984
|
this.errorToLog = "options.origin value '" + object.origin + "' doesn't meet interface IConf requirements";
|
|
17903
17985
|
}
|
|
@@ -17927,7 +18009,7 @@ const HierarchizedPickerComponent = class {
|
|
|
17927
18009
|
toret = false;
|
|
17928
18010
|
this.errorToLog = "options.defaultValue value '" + object.defaultValue + "' doesn't meet interface IConf requirements or doesn't match option.multiple value";
|
|
17929
18011
|
}
|
|
17930
|
-
if (!((!object.
|
|
18012
|
+
if (!((!object.disabled && typeof object.disabled != "boolean") || typeof object.disabled == 'boolean')) {
|
|
17931
18013
|
toret = false;
|
|
17932
18014
|
this.errorToLog = "readonly value '" + object.readonly + "' doesn't meet interface IConf requirements";
|
|
17933
18015
|
}
|
|
@@ -17943,7 +18025,7 @@ const HierarchizedPickerComponent = class {
|
|
|
17943
18025
|
toret = false;
|
|
17944
18026
|
this.errorToLog = "options.minDepth value '" + object.minDepth + "' doesn't meet interface IConf requirements or mismatches with maxDepth value";
|
|
17945
18027
|
}
|
|
17946
|
-
if (!((!object.
|
|
18028
|
+
if (!((!object.minDepth && typeof object.maxDepth != "number") || typeof object.maxDepth == 'number') || (object.minDepth && object.minDepth > object.maxDepth)) {
|
|
17947
18029
|
toret = false;
|
|
17948
18030
|
this.errorToLog = "options.maxDepth value '" + object.maxDepth + "' doesn't meet interface IConf requirements or mismatches with minDepth value";
|
|
17949
18031
|
}
|
|
@@ -17959,42 +18041,31 @@ const HierarchizedPickerComponent = class {
|
|
|
17959
18041
|
toret = false;
|
|
17960
18042
|
this.errorToLog = "options.openTreeWhenLoaded value '" + object.openTreeWhenLoaded + "' doesn't meet interface IConf requirements";
|
|
17961
18043
|
}
|
|
17962
|
-
if (!((!object.displayRootNode && typeof object.displayRootNode != "boolean") || typeof object.displayRootNode == 'boolean')) {
|
|
17963
|
-
toret = false;
|
|
17964
|
-
this.errorToLog = "options.displayRootNode value '" + object.displayRootNode + "' doesn't meet interface IConf requirements";
|
|
17965
|
-
}
|
|
17966
18044
|
return toret;
|
|
17967
18045
|
}
|
|
17968
|
-
|
|
18046
|
+
initComponent() {
|
|
17969
18047
|
// Setup default values
|
|
17970
|
-
if (!this.
|
|
17971
|
-
this.
|
|
17972
|
-
if (!this.
|
|
17973
|
-
this.
|
|
17974
|
-
if (!this.
|
|
17975
|
-
this.
|
|
18048
|
+
if (!this.options.multiple)
|
|
18049
|
+
this.options.multiple = false;
|
|
18050
|
+
if (!this.options.mode)
|
|
18051
|
+
this.options.mode = 'input';
|
|
18052
|
+
if (!this.options.defaultValue) {
|
|
18053
|
+
this.options.defaultValue = [];
|
|
17976
18054
|
}
|
|
17977
|
-
else if (typeof this.
|
|
17978
|
-
this.
|
|
18055
|
+
else if (typeof this.options.defaultValue != 'object') {
|
|
18056
|
+
this.options.defaultValue = [this.options.defaultValue];
|
|
17979
18057
|
}
|
|
17980
|
-
let
|
|
18058
|
+
let isNumeric = function (str) {
|
|
17981
18059
|
if (typeof str != "string")
|
|
17982
18060
|
return false;
|
|
17983
18061
|
return !isNaN(str) &&
|
|
17984
18062
|
!isNaN(parseFloat(str));
|
|
17985
18063
|
};
|
|
17986
18064
|
let autoAssignReach = true;
|
|
17987
|
-
let defaultFromFullpaths =
|
|
17988
|
-
|
|
17989
|
-
|
|
17990
|
-
|
|
17991
|
-
catch (error) {
|
|
17992
|
-
this.errorToLog = "There's an issue with your defaultValue format: " + this.theOptions.defaultValue.toString();
|
|
17993
|
-
return;
|
|
17994
|
-
}
|
|
17995
|
-
await Promise.all(this.theOptions.defaultValue.map(async (element) => {
|
|
17996
|
-
if (!(typeof element == 'number') && !strIsNumeric(element)) {
|
|
17997
|
-
if (this.theOptions.source !== "webservice") {
|
|
18065
|
+
let defaultFromFullpaths = [];
|
|
18066
|
+
this.options.defaultValue.forEach(element => {
|
|
18067
|
+
if (!(typeof element == 'number') && !isNumeric(element)) {
|
|
18068
|
+
if (this.options.source != "webservice") {
|
|
17998
18069
|
let errormsg = 'The loading of nodes based on fullpath is only available on webservice mode for now!';
|
|
17999
18070
|
this.displayPickerError(errormsg);
|
|
18000
18071
|
this.errorToLog = errormsg;
|
|
@@ -18002,23 +18073,17 @@ const HierarchizedPickerComponent = class {
|
|
|
18002
18073
|
return;
|
|
18003
18074
|
}
|
|
18004
18075
|
else {
|
|
18005
|
-
|
|
18006
|
-
defaultFromFullpaths = [];
|
|
18007
|
-
}
|
|
18008
|
-
const valtopush = await this.getNodeIdFromFullpath(element).catch((err) => { });
|
|
18009
|
-
if (valtopush) {
|
|
18010
|
-
defaultFromFullpaths.push(valtopush);
|
|
18011
|
-
}
|
|
18076
|
+
defaultFromFullpaths.push(this.getNodeIdFromFullpath(element));
|
|
18012
18077
|
}
|
|
18013
18078
|
}
|
|
18014
|
-
})
|
|
18015
|
-
if (defaultFromFullpaths) {
|
|
18016
|
-
this.
|
|
18079
|
+
});
|
|
18080
|
+
if (defaultFromFullpaths.length > 0) {
|
|
18081
|
+
this.options.defaultValue = defaultFromFullpaths;
|
|
18017
18082
|
}
|
|
18018
|
-
if (this.
|
|
18019
|
-
if (!this.
|
|
18083
|
+
if (this.options.options) {
|
|
18084
|
+
if (!this.options.options.Reach && this.options.defaultValue.length > 0) {
|
|
18020
18085
|
if (autoAssignReach) {
|
|
18021
|
-
this.
|
|
18086
|
+
this.options.options.Reach = this.options.defaultValue.map(element => {
|
|
18022
18087
|
return Number(element);
|
|
18023
18088
|
});
|
|
18024
18089
|
}
|
|
@@ -18028,74 +18093,63 @@ const HierarchizedPickerComponent = class {
|
|
|
18028
18093
|
}
|
|
18029
18094
|
}
|
|
18030
18095
|
}
|
|
18031
|
-
if (!this.
|
|
18032
|
-
this.
|
|
18033
|
-
if (this.
|
|
18034
|
-
this.
|
|
18035
|
-
if (!this.
|
|
18036
|
-
this.
|
|
18037
|
-
if (!this.theOptions.displayTree && this.theOptions.displayTree != false)
|
|
18038
|
-
this.theOptions.displayTree = true;
|
|
18096
|
+
if (!this.disabled)
|
|
18097
|
+
this.disabled = false;
|
|
18098
|
+
if (!this.options.loading)
|
|
18099
|
+
this.options.loading = "display";
|
|
18100
|
+
if (!this.options.displayTree && this.options.displayTree != false)
|
|
18101
|
+
this.options.displayTree = true;
|
|
18039
18102
|
if (!this.hasFocus)
|
|
18040
18103
|
this.hasFocus = [];
|
|
18041
|
-
if (!this.
|
|
18042
|
-
this.
|
|
18043
|
-
if (!this.
|
|
18044
|
-
this.
|
|
18045
|
-
if (!this.
|
|
18046
|
-
this.
|
|
18047
|
-
if (!this.
|
|
18048
|
-
this.
|
|
18049
|
-
if (!this.theOptions.errorsInInput && this.theOptions.errorsInInput !== false)
|
|
18050
|
-
this.theOptions.errorsInInput = true;
|
|
18104
|
+
if (!this.options.isFullpath && this.options.isFullpath != false)
|
|
18105
|
+
this.options.isFullpath = true;
|
|
18106
|
+
if (!this.options.showAutocomplete)
|
|
18107
|
+
this.options.showAutocomplete = false;
|
|
18108
|
+
if (!this.options.openTreeWhenLoaded)
|
|
18109
|
+
this.options.openTreeWhenLoaded = false;
|
|
18110
|
+
if (!this.options.displayRootNode)
|
|
18111
|
+
this.options.displayRootNode = false;
|
|
18051
18112
|
}
|
|
18052
|
-
|
|
18113
|
+
loadHierarchizedPicker() {
|
|
18053
18114
|
if (this.el.getAttribute("options") && typeof this.el.getAttribute("options") == "string") {
|
|
18054
|
-
this.
|
|
18115
|
+
this.options = JSON.parse(this.el.getAttribute("options"));
|
|
18055
18116
|
}
|
|
18117
|
+
let that = this;
|
|
18056
18118
|
// If not in a debug mode, disable logs
|
|
18057
18119
|
{
|
|
18058
18120
|
this.mylog = function () { };
|
|
18059
18121
|
console.time = function () { };
|
|
18060
|
-
console.timeEnd = function () { };
|
|
18061
18122
|
}
|
|
18062
18123
|
// Setup component unique ID
|
|
18063
|
-
if (this.
|
|
18064
|
-
this.componentID = this.
|
|
18124
|
+
if (this.options.id)
|
|
18125
|
+
this.componentID = this.options.id;
|
|
18065
18126
|
else if (!this.componentID)
|
|
18066
|
-
this.componentID = (
|
|
18067
|
-
if (!this.
|
|
18127
|
+
this.componentID = (document.querySelectorAll('[id^="tree-area-"]').length + 1).toString();
|
|
18128
|
+
if (!this.options)
|
|
18068
18129
|
return;
|
|
18069
|
-
if (this.
|
|
18070
|
-
delete this.
|
|
18130
|
+
if (this.options.defaultValue != undefined && this.options.defaultValue.length === 0) {
|
|
18131
|
+
delete this.options.defaultValue;
|
|
18071
18132
|
}
|
|
18072
|
-
this.canload = this.isInstanceOfIConf(this.
|
|
18073
|
-
|
|
18133
|
+
this.canload = this.isInstanceOfIConf(this.options);
|
|
18134
|
+
this.initComponent();
|
|
18074
18135
|
// Displays option values
|
|
18075
|
-
this.mylog(this.
|
|
18076
|
-
window.addEventListener("click", (evt)
|
|
18077
|
-
let myself =
|
|
18078
|
-
if (!myself &&
|
|
18079
|
-
|
|
18136
|
+
this.mylog(this.options);
|
|
18137
|
+
window.addEventListener("click", function (evt) {
|
|
18138
|
+
let myself = that.amIFocusedByEvent(evt);
|
|
18139
|
+
if (!myself && that.options.mode != "tree") {
|
|
18140
|
+
that.showTree("hide");
|
|
18080
18141
|
}
|
|
18081
18142
|
});
|
|
18082
|
-
this.el.addEventListener("dragover", (event) => {
|
|
18083
|
-
event.preventDefault();
|
|
18084
|
-
});
|
|
18085
|
-
this.el.addEventListener("dragenter", (event) => {
|
|
18086
|
-
event.preventDefault();
|
|
18087
|
-
});
|
|
18088
18143
|
}
|
|
18089
|
-
|
|
18090
|
-
this.
|
|
18091
|
-
this.
|
|
18092
|
-
await this.loadHierarchizedPicker();
|
|
18093
|
-
this.mylog("----- componentWillLoad ending -----");
|
|
18144
|
+
componentWillLoad() {
|
|
18145
|
+
this.loadHierarchizedPicker();
|
|
18146
|
+
this.mylog("----- componentWillLoad ending");
|
|
18094
18147
|
}
|
|
18095
18148
|
amIFocusedByEvent(evt) {
|
|
18149
|
+
let that = this;
|
|
18096
18150
|
let myself = false;
|
|
18097
|
-
evt.composedPath().forEach((value, _index)
|
|
18098
|
-
if (value.id == 'hierarchized-picker-' +
|
|
18151
|
+
evt.composedPath().forEach(function (value, _index) {
|
|
18152
|
+
if (value.id == 'hierarchized-picker-' + that.componentID) {
|
|
18099
18153
|
myself = true;
|
|
18100
18154
|
}
|
|
18101
18155
|
});
|
|
@@ -18109,17 +18163,11 @@ const HierarchizedPickerComponent = class {
|
|
|
18109
18163
|
return (document.querySelectorAll("#hierarchized-picker-" + this.componentID + " .hierarchized-picker-modal-area:not(.hidden)").length > 0);
|
|
18110
18164
|
}
|
|
18111
18165
|
async getToken() {
|
|
18112
|
-
if (typeof this.
|
|
18113
|
-
|
|
18114
|
-
if (this.theOptions.token.length > 200) {
|
|
18115
|
-
return this.theOptions.token;
|
|
18116
|
-
}
|
|
18117
|
-
else {
|
|
18118
|
-
return window.localStorage.getItem(this.theOptions.token);
|
|
18119
|
-
}
|
|
18166
|
+
if (typeof this.options.token == 'string') {
|
|
18167
|
+
return this.options.token;
|
|
18120
18168
|
}
|
|
18121
|
-
if (typeof this.
|
|
18122
|
-
return await this.
|
|
18169
|
+
if (typeof this.options.token == 'function') {
|
|
18170
|
+
return await this.options.token();
|
|
18123
18171
|
}
|
|
18124
18172
|
}
|
|
18125
18173
|
mergeData(source, toadd) {
|
|
@@ -18168,128 +18216,170 @@ const HierarchizedPickerComponent = class {
|
|
|
18168
18216
|
return source;
|
|
18169
18217
|
}
|
|
18170
18218
|
getNodeIdFromFullpath(fullpath) {
|
|
18171
|
-
|
|
18172
|
-
|
|
18173
|
-
|
|
18174
|
-
|
|
18175
|
-
|
|
18176
|
-
|
|
18177
|
-
|
|
18178
|
-
|
|
18179
|
-
|
|
18219
|
+
let toret = null;
|
|
18220
|
+
let that = this;
|
|
18221
|
+
let token = this.options.token;
|
|
18222
|
+
let xhr = new XMLHttpRequest();
|
|
18223
|
+
xhr.open('POST', this.getApiNodeFromFullpathURL(), false);
|
|
18224
|
+
xhr.setRequestHeader('Authorization', 'Bearer ' + token);
|
|
18225
|
+
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
|
|
18226
|
+
xhr.onload = function (e) {
|
|
18227
|
+
that.mylog('XHR ONLOAD', e, xhr.statusText);
|
|
18228
|
+
if (xhr.readyState === 4) {
|
|
18229
|
+
if (xhr.status === 200) {
|
|
18230
|
+
that.mylog('XHR 200', JSON.parse(xhr.responseText));
|
|
18231
|
+
if (that.options.origin == 'thesaurus') {
|
|
18232
|
+
toret = (JSON.parse(xhr.responseText).topic.TTop_PK_ID);
|
|
18233
|
+
}
|
|
18234
|
+
else if (that.options.origin == 'position') {
|
|
18235
|
+
let result = JSON.parse(xhr.responseText);
|
|
18236
|
+
if (result.exist) {
|
|
18237
|
+
toret = (result.position.ID);
|
|
18238
|
+
}
|
|
18239
|
+
else {
|
|
18240
|
+
that.errorToLog = "The fullpath passed for defaultValue does not exist!";
|
|
18241
|
+
}
|
|
18242
|
+
}
|
|
18243
|
+
// TODO -> this does not exist, set accordingly to future API
|
|
18244
|
+
else if (that.options.origin == 'classification') {
|
|
18245
|
+
let result = JSON.parse(xhr.responseText);
|
|
18246
|
+
if (result.exist) {
|
|
18247
|
+
toret = (result.node.ID);
|
|
18248
|
+
}
|
|
18249
|
+
else {
|
|
18250
|
+
that.errorToLog = "The fullpath passed for defaultValue does not exist!";
|
|
18251
|
+
}
|
|
18252
|
+
}
|
|
18253
|
+
}
|
|
18254
|
+
else {
|
|
18255
|
+
that.logError(['XHR NOT 200', xhr.statusText]);
|
|
18256
|
+
}
|
|
18257
|
+
}
|
|
18258
|
+
};
|
|
18259
|
+
xhr.onerror = function (e) {
|
|
18260
|
+
var _a;
|
|
18261
|
+
(_a = that.loader) === null || _a === void 0 ? void 0 : _a.classList.remove('loading');
|
|
18262
|
+
that.logError(['XHR ERROR', e, xhr.statusText]);
|
|
18263
|
+
};
|
|
18264
|
+
if (this.options.origin == 'thesaurus') {
|
|
18265
|
+
xhr.send(JSON.stringify({
|
|
18266
|
+
"sValue": fullpath,
|
|
18267
|
+
"sTypeField": "fullpath"
|
|
18268
|
+
}));
|
|
18269
|
+
}
|
|
18270
|
+
else if (this.options.origin == 'position') {
|
|
18271
|
+
xhr.send(JSON.stringify({
|
|
18272
|
+
"value": fullpath
|
|
18273
|
+
}));
|
|
18274
|
+
}
|
|
18275
|
+
// TODO -> this does not exist, set accordingly to future API
|
|
18276
|
+
else if (this.options.origin == 'classification') {
|
|
18277
|
+
xhr.send(JSON.stringify({
|
|
18278
|
+
"fullpath_system": fullpath
|
|
18279
|
+
}));
|
|
18280
|
+
}
|
|
18281
|
+
return toret;
|
|
18282
|
+
}
|
|
18283
|
+
// Triggers a XHR request and stores the result in this.rawData
|
|
18284
|
+
getDataFromSourceClassification(url, options, init = false) {
|
|
18285
|
+
var _a;
|
|
18286
|
+
let that = this;
|
|
18287
|
+
(_a = this.loader) === null || _a === void 0 ? void 0 : _a.classList.add('loading');
|
|
18288
|
+
let targetURL = url + "/" + options.startNode;
|
|
18289
|
+
if (options.searchedValue) {
|
|
18290
|
+
targetURL += "/" + options.searchedValue;
|
|
18291
|
+
}
|
|
18292
|
+
let getDataPromise = new Promise((resolve, reject) => {
|
|
18293
|
+
this.getToken().then((token) => {
|
|
18294
|
+
let xhr = new XMLHttpRequest();
|
|
18295
|
+
xhr.open('GET', targetURL);
|
|
18296
|
+
xhr.setRequestHeader('Authorization', 'Bearer ' + token);
|
|
18297
|
+
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
|
|
18298
|
+
xhr.onload = function (e) {
|
|
18299
|
+
var _a;
|
|
18300
|
+
(_a = that.loader) === null || _a === void 0 ? void 0 : _a.classList.remove('loading');
|
|
18301
|
+
that.mylog('XHR ONLOAD', e, xhr.statusText);
|
|
18180
18302
|
if (xhr.readyState === 4) {
|
|
18181
18303
|
if (xhr.status === 200) {
|
|
18182
|
-
|
|
18183
|
-
|
|
18184
|
-
|
|
18185
|
-
if (this.theOptions.origin == "thesaurus") {
|
|
18186
|
-
resolve(result.topic.TTop_PK_ID);
|
|
18187
|
-
}
|
|
18188
|
-
else if (this.theOptions.origin == 'position') {
|
|
18189
|
-
resolve(result.position.ID);
|
|
18190
|
-
}
|
|
18304
|
+
that.mylog('XHR 200', JSON.parse(xhr.responseText));
|
|
18305
|
+
if (that.rawData) {
|
|
18306
|
+
that.rawData = that.searchAndMergeData(that.rawData, JSON.parse(xhr.responseText));
|
|
18191
18307
|
}
|
|
18192
18308
|
else {
|
|
18193
|
-
|
|
18194
|
-
|
|
18195
|
-
|
|
18196
|
-
|
|
18197
|
-
|
|
18309
|
+
that.rawData = JSON.parse(xhr.responseText);
|
|
18310
|
+
}
|
|
18311
|
+
resolve(JSON.parse(xhr.responseText));
|
|
18312
|
+
if (init) {
|
|
18313
|
+
that.formatDefaultValue();
|
|
18314
|
+
that.showSelectedNodes();
|
|
18198
18315
|
}
|
|
18316
|
+
that.ready = true;
|
|
18199
18317
|
}
|
|
18200
18318
|
else {
|
|
18201
|
-
|
|
18202
|
-
|
|
18319
|
+
that.logError(['XHR NOT 200', xhr.statusText]);
|
|
18320
|
+
that.errorLoadingXHR();
|
|
18321
|
+
reject();
|
|
18203
18322
|
}
|
|
18204
18323
|
}
|
|
18205
|
-
}
|
|
18206
|
-
catch (error) {
|
|
18207
|
-
this.logError("There has been an issue with xhr.onload in getNodeIdFromFullpath: " + error.toString());
|
|
18208
|
-
reject("null 3");
|
|
18209
|
-
}
|
|
18210
|
-
};
|
|
18211
|
-
xhr.onerror = (e) => {
|
|
18212
|
-
var _a;
|
|
18213
|
-
(_a = this.loader) === null || _a === void 0 ? void 0 : _a.classList.remove('loading');
|
|
18214
|
-
this.logError(['getNodeIdFromFullpath XHR ERROR', e, xhr.statusText]);
|
|
18215
|
-
reject("null 4");
|
|
18216
|
-
};
|
|
18217
|
-
if (this.theOptions.origin == 'thesaurus') {
|
|
18218
|
-
let payload = {
|
|
18219
|
-
"sValue": fullpath,
|
|
18220
|
-
"sTypeField": "fullpath"
|
|
18221
18324
|
};
|
|
18222
|
-
|
|
18223
|
-
|
|
18224
|
-
|
|
18225
|
-
|
|
18226
|
-
|
|
18227
|
-
|
|
18228
|
-
xhr.send(JSON.stringify(payload));
|
|
18229
|
-
}
|
|
18230
|
-
else if (this.theOptions.origin == 'position') {
|
|
18231
|
-
let payload = {
|
|
18232
|
-
"value": fullpath
|
|
18325
|
+
xhr.onerror = function (e) {
|
|
18326
|
+
var _a;
|
|
18327
|
+
(_a = that.loader) === null || _a === void 0 ? void 0 : _a.classList.remove('loading');
|
|
18328
|
+
that.logError(['XHR ERROR', e, xhr.statusText]);
|
|
18329
|
+
that.errorLoadingXHR();
|
|
18330
|
+
reject();
|
|
18233
18331
|
};
|
|
18234
|
-
|
|
18235
|
-
|
|
18236
|
-
}
|
|
18237
|
-
xhr.send(JSON.stringify(payload));
|
|
18238
|
-
}
|
|
18239
|
-
// CHECK return toret;
|
|
18332
|
+
xhr.send();
|
|
18333
|
+
});
|
|
18240
18334
|
});
|
|
18335
|
+
return getDataPromise;
|
|
18241
18336
|
}
|
|
18242
18337
|
// Triggers a XHR request and stores the result in this.rawData
|
|
18243
18338
|
getDataFromSource(url, options, init = false) {
|
|
18244
18339
|
var _a;
|
|
18340
|
+
let that = this;
|
|
18245
18341
|
(_a = this.loader) === null || _a === void 0 ? void 0 : _a.classList.add('loading');
|
|
18246
18342
|
let getDataPromise = new Promise((resolve, reject) => {
|
|
18247
18343
|
this.getToken().then((token) => {
|
|
18248
|
-
let xhr = new
|
|
18344
|
+
let xhr = new XMLHttpRequest();
|
|
18249
18345
|
xhr.open('POST', url);
|
|
18250
18346
|
xhr.setRequestHeader('Authorization', 'Bearer ' + token);
|
|
18251
18347
|
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
|
|
18252
|
-
xhr.onload = (e)
|
|
18348
|
+
xhr.onload = function (e) {
|
|
18253
18349
|
var _a;
|
|
18254
|
-
|
|
18255
|
-
|
|
18256
|
-
|
|
18257
|
-
if (xhr.
|
|
18258
|
-
|
|
18259
|
-
|
|
18260
|
-
|
|
18261
|
-
this.rawData = this.searchAndMergeData(this.rawData, JSON.parse(xhr.responseText));
|
|
18262
|
-
}
|
|
18263
|
-
else {
|
|
18264
|
-
this.rawData = JSON.parse(xhr.responseText);
|
|
18265
|
-
}
|
|
18266
|
-
resolve(JSON.parse(xhr.responseText));
|
|
18267
|
-
this.ready = true;
|
|
18350
|
+
(_a = that.loader) === null || _a === void 0 ? void 0 : _a.classList.remove('loading');
|
|
18351
|
+
that.mylog('XHR ONLOAD', e, xhr.statusText);
|
|
18352
|
+
if (xhr.readyState === 4) {
|
|
18353
|
+
if (xhr.status === 200) {
|
|
18354
|
+
that.mylog('XHR 200', JSON.parse(xhr.responseText));
|
|
18355
|
+
if (that.rawData) {
|
|
18356
|
+
that.rawData = that.searchAndMergeData(that.rawData, JSON.parse(xhr.responseText));
|
|
18268
18357
|
}
|
|
18269
18358
|
else {
|
|
18270
|
-
|
|
18271
|
-
this.errorLoadingXHR();
|
|
18272
|
-
reject('getDataFromSource XHR NOT 200');
|
|
18359
|
+
that.rawData = JSON.parse(xhr.responseText);
|
|
18273
18360
|
}
|
|
18361
|
+
resolve(JSON.parse(xhr.responseText));
|
|
18362
|
+
if (init) {
|
|
18363
|
+
that.formatDefaultValue();
|
|
18364
|
+
that.showSelectedNodes();
|
|
18365
|
+
}
|
|
18366
|
+
that.ready = true;
|
|
18367
|
+
}
|
|
18368
|
+
else {
|
|
18369
|
+
that.logError(['XHR NOT 200', xhr.statusText]);
|
|
18370
|
+
that.errorLoadingXHR();
|
|
18371
|
+
reject();
|
|
18274
18372
|
}
|
|
18275
|
-
}
|
|
18276
|
-
catch (error) {
|
|
18277
|
-
this.logError("There has been an issue with xhr.onload in getDataFromSource: " + error.toString());
|
|
18278
18373
|
}
|
|
18279
18374
|
};
|
|
18280
|
-
xhr.onerror = (e)
|
|
18375
|
+
xhr.onerror = function (e) {
|
|
18281
18376
|
var _a;
|
|
18282
|
-
(_a =
|
|
18283
|
-
|
|
18284
|
-
|
|
18285
|
-
reject(
|
|
18377
|
+
(_a = that.loader) === null || _a === void 0 ? void 0 : _a.classList.remove('loading');
|
|
18378
|
+
that.logError(['XHR ERROR', e, xhr.statusText]);
|
|
18379
|
+
that.errorLoadingXHR();
|
|
18380
|
+
reject();
|
|
18286
18381
|
};
|
|
18287
|
-
|
|
18288
|
-
xhr.send(JSON.stringify(options));
|
|
18289
|
-
}
|
|
18290
|
-
catch (error) {
|
|
18291
|
-
this.logError("There has been an issue with xhr.send in getDataFromSource: " + error.toString());
|
|
18292
|
-
}
|
|
18382
|
+
xhr.send(JSON.stringify(options));
|
|
18293
18383
|
});
|
|
18294
18384
|
});
|
|
18295
18385
|
return getDataPromise;
|
|
@@ -18298,35 +18388,46 @@ const HierarchizedPickerComponent = class {
|
|
|
18298
18388
|
errorLoadingXHR() {
|
|
18299
18389
|
var _a;
|
|
18300
18390
|
this.displayPickerError('Error loading webservice data!');
|
|
18301
|
-
|
|
18302
|
-
|
|
18303
|
-
|
|
18304
|
-
|
|
18305
|
-
|
|
18306
|
-
|
|
18307
|
-
|
|
18308
|
-
this.ignoreOptionsChanges = false;
|
|
18309
|
-
}
|
|
18310
|
-
catch (_b) {
|
|
18311
|
-
console.error('Error loading webservice data!');
|
|
18312
|
-
}
|
|
18391
|
+
document.querySelector('#tree-area-' + this.componentID).innerHTML = 'Error loading webservice data!';
|
|
18392
|
+
// NB: Maybe shouldnt be removed but hidden ...
|
|
18393
|
+
(_a = document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
18394
|
+
this.canload = false;
|
|
18395
|
+
this.showTree("hide");
|
|
18396
|
+
this.ready = true;
|
|
18397
|
+
this.ignoreOptionsChanges = false;
|
|
18313
18398
|
}
|
|
18314
18399
|
getApiSearchURL() {
|
|
18315
|
-
|
|
18400
|
+
if (this.options.origin == "classification") {
|
|
18401
|
+
return (this.options.url.substring(0, this.options.url.lastIndexOf("/")) + '/search-tree');
|
|
18402
|
+
}
|
|
18403
|
+
else {
|
|
18404
|
+
return (this.options.url.substring(0, this.options.url.lastIndexOf("/")) + '/GetTreeFromSearch');
|
|
18405
|
+
}
|
|
18316
18406
|
}
|
|
18317
18407
|
getApiNodeFromFullpathURL() {
|
|
18318
|
-
if (this.
|
|
18319
|
-
return (this.
|
|
18408
|
+
if (this.options.origin == 'thesaurus') {
|
|
18409
|
+
return (this.options.url.substring(0, this.options.url.lastIndexOf("/")) + '/existBy');
|
|
18320
18410
|
}
|
|
18321
|
-
else if (this.
|
|
18322
|
-
return (this.
|
|
18411
|
+
else if (this.options.origin == 'position') {
|
|
18412
|
+
return (this.options.url.substring(0, this.options.url.lastIndexOf("/")) + '/PositionExistByFp');
|
|
18413
|
+
}
|
|
18414
|
+
// TODO -> this does not exist, set accordingly to future API
|
|
18415
|
+
else if (this.options.origin == 'classification') {
|
|
18416
|
+
return (this.options.url.substring(0, this.options.url.lastIndexOf("/")) + '/exists');
|
|
18323
18417
|
}
|
|
18324
18418
|
}
|
|
18325
18419
|
rawDataWatcher(dataToLoad) {
|
|
18420
|
+
let rootnode = 0;
|
|
18421
|
+
if (this.options.origin == "classification") {
|
|
18422
|
+
rootnode = this.options.options.startNode;
|
|
18423
|
+
}
|
|
18424
|
+
else {
|
|
18425
|
+
rootnode = this.options.options.StartNodeID;
|
|
18426
|
+
}
|
|
18326
18427
|
//This makes the tree to be created only once after the rawData loading
|
|
18327
18428
|
if (!this.ready) {
|
|
18328
|
-
this.translateDataForTree(dataToLoad);
|
|
18329
|
-
if (this.
|
|
18429
|
+
this.translateDataForTree(dataToLoad, rootnode);
|
|
18430
|
+
if (this.options.openTreeWhenLoaded) {
|
|
18330
18431
|
this.showTree("modale");
|
|
18331
18432
|
}
|
|
18332
18433
|
}
|
|
@@ -18353,7 +18454,8 @@ const HierarchizedPickerComponent = class {
|
|
|
18353
18454
|
return toret;
|
|
18354
18455
|
}
|
|
18355
18456
|
displayAutocompleteWithResults(data, searched) {
|
|
18356
|
-
if (data && this.
|
|
18457
|
+
if (data && this.options.showAutocomplete) {
|
|
18458
|
+
var that = this;
|
|
18357
18459
|
var nodes = this.getNodesFromSearch(data, searched);
|
|
18358
18460
|
nodes = nodes.sort(function (a, b) {
|
|
18359
18461
|
var textA = a.text.toUpperCase();
|
|
@@ -18368,9 +18470,9 @@ const HierarchizedPickerComponent = class {
|
|
|
18368
18470
|
autocomplete_results.innerHTML += '<li title="' + nodes[i].text + '" nodeid="' + nodes[i].id + '">' + nodes[i].text + '</li>';
|
|
18369
18471
|
}
|
|
18370
18472
|
autocomplete_results.querySelectorAll("li").forEach((item) => {
|
|
18371
|
-
item.addEventListener("click", (evt)
|
|
18372
|
-
|
|
18373
|
-
|
|
18473
|
+
item.addEventListener("click", function (evt) {
|
|
18474
|
+
that.editValue(that.findNodeById(that.loadedTreeJs, this.attributes.getNamedItem("nodeid").value));
|
|
18475
|
+
that.showTree("hide");
|
|
18374
18476
|
});
|
|
18375
18477
|
});
|
|
18376
18478
|
this.showAutocomplete();
|
|
@@ -18378,13 +18480,13 @@ const HierarchizedPickerComponent = class {
|
|
|
18378
18480
|
}
|
|
18379
18481
|
}
|
|
18380
18482
|
showAutocomplete() {
|
|
18381
|
-
if (this.
|
|
18483
|
+
if (this.options.showAutocomplete) {
|
|
18382
18484
|
let autocomplete_results = document.getElementById("autocomplete-results-area");
|
|
18383
18485
|
autocomplete_results.style.display = 'block';
|
|
18384
18486
|
}
|
|
18385
18487
|
}
|
|
18386
18488
|
clearAutocomplete(eraseResults = false) {
|
|
18387
|
-
if (this.
|
|
18489
|
+
if (this.options.showAutocomplete) {
|
|
18388
18490
|
// setTimeout(() => {
|
|
18389
18491
|
let autocomplete_results = document.getElementById("autocomplete-results-area");
|
|
18390
18492
|
autocomplete_results.style.display = 'none';
|
|
@@ -18394,18 +18496,18 @@ const HierarchizedPickerComponent = class {
|
|
|
18394
18496
|
// }, 0);
|
|
18395
18497
|
}
|
|
18396
18498
|
}
|
|
18397
|
-
loadSearchDataInCurrentTree(dataToLoad,
|
|
18499
|
+
loadSearchDataInCurrentTree(dataToLoad, rootnode, searched) {
|
|
18398
18500
|
let displayResults = () => {
|
|
18399
|
-
if (this.searchToDisplay > -1
|
|
18501
|
+
if (this.searchToDisplay > -1) {
|
|
18400
18502
|
this.rawData.children.forEach((value, index) => {
|
|
18401
|
-
this.completeCurrentTreeWithTree(value);
|
|
18503
|
+
this.completeCurrentTreeWithTree(value, rootnode);
|
|
18402
18504
|
});
|
|
18403
18505
|
this.triggerTreeDisplay(this.rawData, searched);
|
|
18404
18506
|
this.displayAutocompleteWithResults(this.rawData, searched);
|
|
18405
18507
|
// Deploys all nodes
|
|
18406
18508
|
document.querySelectorAll('#tree-area-' + this.componentID + ' .treejs-node').forEach((item) => {
|
|
18407
18509
|
var _a;
|
|
18408
|
-
const childspans = Array.prototype.slice.call(item.querySelectorAll("ul > li > span"));
|
|
18510
|
+
const childspans = Array.prototype.slice.call(item.querySelectorAll(":scope > ul > li > span"));
|
|
18409
18511
|
let hasUndefinedchild = childspans.filter((ele) => {
|
|
18410
18512
|
return ele.textContent === "undefined";
|
|
18411
18513
|
});
|
|
@@ -18415,40 +18517,51 @@ const HierarchizedPickerComponent = class {
|
|
|
18415
18517
|
});
|
|
18416
18518
|
}
|
|
18417
18519
|
};
|
|
18418
|
-
if (this.
|
|
18419
|
-
|
|
18420
|
-
|
|
18421
|
-
|
|
18422
|
-
|
|
18423
|
-
|
|
18424
|
-
|
|
18425
|
-
|
|
18426
|
-
|
|
18427
|
-
|
|
18428
|
-
|
|
18429
|
-
|
|
18430
|
-
|
|
18431
|
-
|
|
18432
|
-
|
|
18433
|
-
|
|
18434
|
-
|
|
18435
|
-
|
|
18520
|
+
if (this.options.source == 'webservice') {
|
|
18521
|
+
if (this.options.origin == "classification") {
|
|
18522
|
+
// WS Call
|
|
18523
|
+
this.getDataFromSourceClassification(this.getApiSearchURL(), {
|
|
18524
|
+
startNode: this.options.options.startNode,
|
|
18525
|
+
searchedValue: searched,
|
|
18526
|
+
// searchNameOnly: true,
|
|
18527
|
+
// deprecated: false
|
|
18528
|
+
}).then(displayResults),
|
|
18529
|
+
(err) => {
|
|
18530
|
+
console.error('err', err);
|
|
18531
|
+
};
|
|
18532
|
+
}
|
|
18533
|
+
else {
|
|
18534
|
+
// WS Call
|
|
18535
|
+
this.getDataFromSource(this.getApiSearchURL(), {
|
|
18536
|
+
StartNodeID: this.options.options.StartNodeID,
|
|
18537
|
+
lng: this.options.options.lng,
|
|
18538
|
+
searchedValue: searched,
|
|
18539
|
+
searchNameOnly: true,
|
|
18540
|
+
deprecated: false
|
|
18541
|
+
}).then(displayResults),
|
|
18542
|
+
(err) => {
|
|
18543
|
+
console.error('err', err);
|
|
18544
|
+
};
|
|
18545
|
+
}
|
|
18436
18546
|
}
|
|
18437
18547
|
else {
|
|
18438
18548
|
displayResults();
|
|
18439
18549
|
}
|
|
18440
18550
|
}
|
|
18441
18551
|
triggerTreeDisplay(dataToLoad, searched) {
|
|
18442
|
-
if (this.
|
|
18552
|
+
if (this.options.origin == 'thesaurus') {
|
|
18443
18553
|
this.translateDataFromThesaurus(dataToLoad, searched);
|
|
18444
18554
|
}
|
|
18445
|
-
if (this.
|
|
18555
|
+
if (this.options.origin == 'position') {
|
|
18446
18556
|
this.translateDataFromPosition(dataToLoad, searched);
|
|
18447
18557
|
}
|
|
18558
|
+
if (this.options.origin == 'classification') {
|
|
18559
|
+
this.translateDataFromClassification(dataToLoad, searched);
|
|
18560
|
+
}
|
|
18448
18561
|
}
|
|
18449
|
-
translateDataForTree(dataToLoad,
|
|
18562
|
+
translateDataForTree(dataToLoad, rootnode, searched = null) {
|
|
18450
18563
|
if (searched != null) {
|
|
18451
|
-
this.loadSearchDataInCurrentTree(dataToLoad,
|
|
18564
|
+
this.loadSearchDataInCurrentTree(dataToLoad, rootnode, searched);
|
|
18452
18565
|
}
|
|
18453
18566
|
else {
|
|
18454
18567
|
this.triggerTreeDisplay(dataToLoad, searched);
|
|
@@ -18459,10 +18572,10 @@ const HierarchizedPickerComponent = class {
|
|
|
18459
18572
|
if (!node || !property) {
|
|
18460
18573
|
return "";
|
|
18461
18574
|
}
|
|
18462
|
-
if (node[property]) {
|
|
18575
|
+
if (node[property] || node[property] === 0) {
|
|
18463
18576
|
return node[property];
|
|
18464
18577
|
}
|
|
18465
|
-
if (node.data && node.data[property]) {
|
|
18578
|
+
if (node.data && (node.data[property] || node.data[property] === 0)) {
|
|
18466
18579
|
return node.data[property];
|
|
18467
18580
|
}
|
|
18468
18581
|
if (logerror)
|
|
@@ -18471,9 +18584,9 @@ const HierarchizedPickerComponent = class {
|
|
|
18471
18584
|
}
|
|
18472
18585
|
// Translates datas from Thesaurus into an understandable object to pass to treejs dependency
|
|
18473
18586
|
translateDataFromThesaurus(dataToLoad, searched = null) {
|
|
18474
|
-
if (this.
|
|
18587
|
+
if (this.options.origin != 'thesaurus' || !dataToLoad)
|
|
18475
18588
|
return;
|
|
18476
|
-
this.mylog('Translate from Thesaurus ! (' + this.
|
|
18589
|
+
this.mylog('Translate from Thesaurus ! (' + this.options.source + ')', dataToLoad);
|
|
18477
18590
|
let fillTreeWithObject = (tree, object, depth = 0) => {
|
|
18478
18591
|
if (object && object.length) {
|
|
18479
18592
|
object.forEach((value, _index) => {
|
|
@@ -18513,7 +18626,7 @@ const HierarchizedPickerComponent = class {
|
|
|
18513
18626
|
if (searched) {
|
|
18514
18627
|
const matched = searchValue(objToPush);
|
|
18515
18628
|
objToPush.isDesaturated = !matched;
|
|
18516
|
-
pushMe = matched || this.
|
|
18629
|
+
pushMe = matched || this.options.searchResultPresentsUnMatched;
|
|
18517
18630
|
}
|
|
18518
18631
|
else {
|
|
18519
18632
|
pushMe = true;
|
|
@@ -18526,26 +18639,27 @@ const HierarchizedPickerComponent = class {
|
|
|
18526
18639
|
}
|
|
18527
18640
|
return tree;
|
|
18528
18641
|
};
|
|
18529
|
-
this.displayTree(fillTreeWithObject([], !this.
|
|
18642
|
+
this.displayTree(fillTreeWithObject([], !this.options.displayRootNode ? dataToLoad.children : [dataToLoad]));
|
|
18530
18643
|
}
|
|
18531
18644
|
// Translates datas from Position into an understandable object to pass to treejs dependency
|
|
18532
18645
|
translateDataFromPosition(dataToLoad, searched = null) {
|
|
18533
|
-
if (this.
|
|
18646
|
+
if (this.options.origin != 'position' || !dataToLoad)
|
|
18534
18647
|
return;
|
|
18535
|
-
let
|
|
18648
|
+
let that = this;
|
|
18649
|
+
let fillTreeWithObject = function (tree, object, depth = 0) {
|
|
18536
18650
|
if (object.length) {
|
|
18537
|
-
object.forEach((value, _index)
|
|
18651
|
+
object.forEach(function (value, _index) {
|
|
18538
18652
|
let objToPush = {
|
|
18539
|
-
id:
|
|
18653
|
+
id: that.getPropertyFromNode(value, "key"),
|
|
18540
18654
|
depth: depth,
|
|
18541
|
-
text:
|
|
18542
|
-
fullpath:
|
|
18543
|
-
fullpathTranslated:
|
|
18544
|
-
children: (
|
|
18545
|
-
|
|
18546
|
-
deprecated:
|
|
18655
|
+
text: that.getPropertyFromNode(value, "valueTranslated"),
|
|
18656
|
+
fullpath: that.getPropertyFromNode(value, "fullpath"),
|
|
18657
|
+
fullpathTranslated: that.getPropertyFromNode(value, "fullpathTranslated"),
|
|
18658
|
+
children: (that.getPropertyFromNode(value, "hasChildren", false) &&
|
|
18659
|
+
that.getPropertyFromNode(value, "children").length == 0 ? [{}] : []),
|
|
18660
|
+
deprecated: that.getPropertyFromNode(value, "deprecated", false),
|
|
18547
18661
|
};
|
|
18548
|
-
let childTree = fillTreeWithObject(objToPush.children,
|
|
18662
|
+
let childTree = fillTreeWithObject(objToPush.children, that.getPropertyFromNode(value, "children", false), depth + 1);
|
|
18549
18663
|
let pushMe = false;
|
|
18550
18664
|
let searchValue = function (obj) {
|
|
18551
18665
|
let toret = false;
|
|
@@ -18575,7 +18689,56 @@ const HierarchizedPickerComponent = class {
|
|
|
18575
18689
|
}
|
|
18576
18690
|
return tree;
|
|
18577
18691
|
};
|
|
18578
|
-
this.displayTree(fillTreeWithObject([], !this.
|
|
18692
|
+
this.displayTree(fillTreeWithObject([], !this.options.displayRootNode ? dataToLoad.children : [dataToLoad]));
|
|
18693
|
+
}
|
|
18694
|
+
translateDataFromClassification(dataToLoad, searched = null) {
|
|
18695
|
+
if (this.options.origin != 'classification' || !dataToLoad)
|
|
18696
|
+
return;
|
|
18697
|
+
let that = this;
|
|
18698
|
+
let fillTreeWithObject = function (tree, object, depth = 0) {
|
|
18699
|
+
if (object.length) {
|
|
18700
|
+
object.forEach(function (value, _index) {
|
|
18701
|
+
let objToPush = {
|
|
18702
|
+
id: that.getPropertyFromNode(value, "ID"),
|
|
18703
|
+
depth: depth,
|
|
18704
|
+
text: that.getPropertyFromNode(value, "Name"),
|
|
18705
|
+
fullpath: that.getPropertyFromNode(value, "FullPath"),
|
|
18706
|
+
fullpathTranslated: that.getPropertyFromNode(value, "FullPath"),
|
|
18707
|
+
children: (that.getPropertyFromNode(value, "children", false).length > 0 &&
|
|
18708
|
+
that.getPropertyFromNode(value, "children").length == 0 ? [{}] : []),
|
|
18709
|
+
deprecated: that.getPropertyFromNode(value, "IsDeprecated", false),
|
|
18710
|
+
};
|
|
18711
|
+
let childTree = fillTreeWithObject(objToPush.children, that.getPropertyFromNode(value, "children", false), depth + 1);
|
|
18712
|
+
let pushMe = false;
|
|
18713
|
+
let searchValue = function (obj) {
|
|
18714
|
+
let toret = false;
|
|
18715
|
+
if (obj.text.toLowerCase().indexOf(searched.toLowerCase()) > -1) {
|
|
18716
|
+
toret = true;
|
|
18717
|
+
}
|
|
18718
|
+
else if (obj.children.length > 0 && Object.keys(obj.children[0]).length != 0) {
|
|
18719
|
+
obj.children.forEach((descend) => {
|
|
18720
|
+
if (searchValue(descend)) {
|
|
18721
|
+
toret = true;
|
|
18722
|
+
}
|
|
18723
|
+
});
|
|
18724
|
+
}
|
|
18725
|
+
return toret;
|
|
18726
|
+
};
|
|
18727
|
+
if (searched) {
|
|
18728
|
+
pushMe = searchValue(objToPush);
|
|
18729
|
+
}
|
|
18730
|
+
else {
|
|
18731
|
+
pushMe = true;
|
|
18732
|
+
}
|
|
18733
|
+
if (pushMe) {
|
|
18734
|
+
objToPush.children = childTree;
|
|
18735
|
+
tree.push(objToPush);
|
|
18736
|
+
}
|
|
18737
|
+
});
|
|
18738
|
+
}
|
|
18739
|
+
return tree;
|
|
18740
|
+
};
|
|
18741
|
+
this.displayTree(fillTreeWithObject([], !this.options.displayRootNode ? dataToLoad.children : [dataToLoad]));
|
|
18579
18742
|
}
|
|
18580
18743
|
findNodeById(myTree, nodeId) {
|
|
18581
18744
|
let node = myTree.nodesById[nodeId];
|
|
@@ -18585,26 +18748,43 @@ const HierarchizedPickerComponent = class {
|
|
|
18585
18748
|
return myTree.nodesById[nodeId];
|
|
18586
18749
|
}
|
|
18587
18750
|
// 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
|
-
completeCurrentTreeWithTree(newTree) {
|
|
18751
|
+
completeCurrentTreeWithTree(newTree, rootnode) {
|
|
18589
18752
|
let that = this;
|
|
18590
18753
|
// Creates a new tree with results from WS call
|
|
18591
18754
|
let shortFillTreeWithObject = function (parent, tree, object, first, depth) {
|
|
18592
18755
|
// If passed node has elements
|
|
18593
18756
|
if ((first || (tree && tree.length != 0)) && object && Object.keys(object).length != 0 && object.length) {
|
|
18594
|
-
object.forEach((value, _index)
|
|
18757
|
+
object.forEach(function (value, _index) {
|
|
18595
18758
|
let objToPush = value;
|
|
18596
|
-
if (that.
|
|
18597
|
-
|
|
18598
|
-
|
|
18599
|
-
|
|
18600
|
-
|
|
18601
|
-
|
|
18602
|
-
|
|
18603
|
-
|
|
18604
|
-
|
|
18605
|
-
that.getPropertyFromNode(value, "children").length
|
|
18606
|
-
|
|
18607
|
-
|
|
18759
|
+
if (that.options.origin == "classification") {
|
|
18760
|
+
if (that.getPropertyFromNode(value, "ID", false) != null) {
|
|
18761
|
+
objToPush = {
|
|
18762
|
+
id: that.getPropertyFromNode(value, "ID"),
|
|
18763
|
+
depth: depth,
|
|
18764
|
+
parent: parent,
|
|
18765
|
+
text: that.getPropertyFromNode(value, "Name"),
|
|
18766
|
+
fullpath: that.getPropertyFromNode(value, "FullPath"),
|
|
18767
|
+
fullpathTranslated: that.getPropertyFromNode(value, "FullPath"),
|
|
18768
|
+
children: (that.getPropertyFromNode(value, "children", false).length > 0 &&
|
|
18769
|
+
that.getPropertyFromNode(value, "children").length == 0 ? [{}] : []),
|
|
18770
|
+
deprecated: that.getPropertyFromNode(value, "IsDeprecated", false),
|
|
18771
|
+
};
|
|
18772
|
+
}
|
|
18773
|
+
}
|
|
18774
|
+
else {
|
|
18775
|
+
if (that.getPropertyFromNode(value, "key", false) != null) {
|
|
18776
|
+
objToPush = {
|
|
18777
|
+
id: that.getPropertyFromNode(value, "key"),
|
|
18778
|
+
depth: depth,
|
|
18779
|
+
parent: parent,
|
|
18780
|
+
text: that.getPropertyFromNode(value, "valueTranslated"),
|
|
18781
|
+
fullpath: that.getPropertyFromNode(value, "fullpath"),
|
|
18782
|
+
fullpathTranslated: that.getPropertyFromNode(value, "fullpathTranslated"),
|
|
18783
|
+
children: (that.getPropertyFromNode(value, "hasChildren", false) &&
|
|
18784
|
+
that.getPropertyFromNode(value, "children").length == 0 ? [{}] : []),
|
|
18785
|
+
deprecated: that.getPropertyFromNode(value, "deprecated", false),
|
|
18786
|
+
};
|
|
18787
|
+
}
|
|
18608
18788
|
}
|
|
18609
18789
|
objToPush.children = shortFillTreeWithObject(objToPush, objToPush.children, that.getPropertyFromNode(value, "children", false), false, depth + 1);
|
|
18610
18790
|
tree.push(objToPush);
|
|
@@ -18613,11 +18793,11 @@ const HierarchizedPickerComponent = class {
|
|
|
18613
18793
|
return tree;
|
|
18614
18794
|
};
|
|
18615
18795
|
// targetNode = an object stored by the library
|
|
18616
|
-
let targetNode = this.findNodeById(this.loadedTreeJs,
|
|
18796
|
+
let targetNode = this.findNodeById(this.loadedTreeJs, rootnode);
|
|
18617
18797
|
if (targetNode != null) {
|
|
18618
18798
|
// empty the children of the node in the library
|
|
18619
18799
|
targetNode.children = [];
|
|
18620
|
-
let liElmID =
|
|
18800
|
+
let liElmID = rootnode;
|
|
18621
18801
|
var ulElem = this.loadedTreeJs.liElementsById[liElmID].querySelector('ul');
|
|
18622
18802
|
let filledtree = shortFillTreeWithObject({
|
|
18623
18803
|
id: liElmID,
|
|
@@ -18631,7 +18811,7 @@ const HierarchizedPickerComponent = class {
|
|
|
18631
18811
|
if (filledtree.length > 0) {
|
|
18632
18812
|
ulElem.innerHTML = "";
|
|
18633
18813
|
}
|
|
18634
|
-
//
|
|
18814
|
+
// that.rawData = result from WS call
|
|
18635
18815
|
(filledtree).forEach((item) => {
|
|
18636
18816
|
if (Object.keys(item).length != 0) {
|
|
18637
18817
|
//Foreach item in the newly created tree, create the DOM elements to inject - BEGIN
|
|
@@ -18648,7 +18828,7 @@ const HierarchizedPickerComponent = class {
|
|
|
18648
18828
|
var liElems = ulElem.querySelectorAll("li");
|
|
18649
18829
|
liElems[liElems.length - 1].appendChild(this.loadedTreeJs.createUlEle());
|
|
18650
18830
|
liElems[liElems.length - 1].querySelector("ul").appendChild(this.loadedTreeJs.createLiEle(item.children));
|
|
18651
|
-
|
|
18831
|
+
that.completeCurrentTreeWithTree(item, item.id);
|
|
18652
18832
|
}
|
|
18653
18833
|
}
|
|
18654
18834
|
});
|
|
@@ -18656,10 +18836,10 @@ const HierarchizedPickerComponent = class {
|
|
|
18656
18836
|
this.deactivateNodesOutOfDepthSettings();
|
|
18657
18837
|
}
|
|
18658
18838
|
deactivateNodesOutOfDepthSettings() {
|
|
18659
|
-
if (this.
|
|
18839
|
+
if (this.options.maxDepth || this.options.minDepth) {
|
|
18660
18840
|
for (let index in this.loadedTreeJs.nodesById) {
|
|
18661
18841
|
let element = this.loadedTreeJs.nodesById[index];
|
|
18662
|
-
if (element.depth < this.
|
|
18842
|
+
if (element.depth < this.options.minDepth || element.depth > this.options.maxDepth) {
|
|
18663
18843
|
this.loadedTreeJs.liElementsById[element.id].classList.add('readonly_node');
|
|
18664
18844
|
}
|
|
18665
18845
|
}
|
|
@@ -18679,20 +18859,6 @@ const HierarchizedPickerComponent = class {
|
|
|
18679
18859
|
});
|
|
18680
18860
|
}
|
|
18681
18861
|
onItemDragOver(el, e) {
|
|
18682
|
-
let now = new Date().getTime();
|
|
18683
|
-
if (now - this.lastDragedOverTimeForAscendent < 50 && el.nodeId != this.lastDragedOverNodeId) {
|
|
18684
|
-
return;
|
|
18685
|
-
}
|
|
18686
|
-
this.lastDragedOverTimeForAscendent = now;
|
|
18687
|
-
if (el.nodeId == this.lastDragedOverNodeId) {
|
|
18688
|
-
if (now - this.lastDragedOverTimeForLevel < this.acceptableDelayBetweenSimilarActions) {
|
|
18689
|
-
return;
|
|
18690
|
-
}
|
|
18691
|
-
this.lastDragedOverTimeForLevel = now;
|
|
18692
|
-
}
|
|
18693
|
-
else {
|
|
18694
|
-
this.lastDragedOverNodeId = el.nodeId;
|
|
18695
|
-
}
|
|
18696
18862
|
this.clearDragOverPos(el);
|
|
18697
18863
|
if (el == this.curDraggingItem) {
|
|
18698
18864
|
el.classList.remove('dragover');
|
|
@@ -18753,29 +18919,30 @@ const HierarchizedPickerComponent = class {
|
|
|
18753
18919
|
}
|
|
18754
18920
|
// Displays the tree
|
|
18755
18921
|
async displayTree(treeData) {
|
|
18756
|
-
|
|
18922
|
+
let that = this;
|
|
18923
|
+
if (!this.options.displayTree && this.ready)
|
|
18757
18924
|
return;
|
|
18758
18925
|
if (treeData.length == 0) {
|
|
18759
|
-
|
|
18926
|
+
document.querySelector('#tree-area-' + this.componentID).innerHTML = 'No search results ...';
|
|
18760
18927
|
return;
|
|
18761
18928
|
}
|
|
18762
18929
|
let myTree = new Tree('#tree-area-' + this.componentID, {
|
|
18763
18930
|
parentApi: this,
|
|
18764
18931
|
data: treeData,
|
|
18765
|
-
onChange: async ()
|
|
18932
|
+
onChange: async function () {
|
|
18766
18933
|
let oldValue;
|
|
18767
18934
|
try {
|
|
18768
|
-
oldValue = await
|
|
18935
|
+
oldValue = await that.getValue();
|
|
18769
18936
|
}
|
|
18770
18937
|
catch (error) {
|
|
18771
18938
|
oldValue = null;
|
|
18772
18939
|
}
|
|
18773
18940
|
let emitValueChange = async () => {
|
|
18774
|
-
let newValue = await
|
|
18775
|
-
if (
|
|
18776
|
-
|
|
18941
|
+
let newValue = await that.getValue();
|
|
18942
|
+
if (that.valueChangeCallback && that.ready && !that.shownTree) {
|
|
18943
|
+
that.valueChangeCallback(newValue);
|
|
18777
18944
|
}
|
|
18778
|
-
|
|
18945
|
+
that.valueChange.emit({ oldValue: oldValue, newValue: newValue, value: newValue });
|
|
18779
18946
|
};
|
|
18780
18947
|
// TODO > Try to find why this has been previously added
|
|
18781
18948
|
// setTimeout(() => {
|
|
@@ -18794,13 +18961,13 @@ const HierarchizedPickerComponent = class {
|
|
|
18794
18961
|
this.showSelectedNodes();
|
|
18795
18962
|
this.deactivateNodesOutOfDepthSettings();
|
|
18796
18963
|
// Hides checkboxes in non multiple context
|
|
18797
|
-
if (!this.
|
|
18964
|
+
if (!this.options.multiple) {
|
|
18798
18965
|
document.querySelectorAll('#tree-area-' + this.componentID + ' .treejs-checkbox').forEach((item) => (item.style.display = 'none'));
|
|
18799
18966
|
}
|
|
18800
18967
|
}
|
|
18801
18968
|
async setNodeAsSelected(id, treeToUpdate, userClick) {
|
|
18802
18969
|
if ((this.disabled && this.shownTree && this.setValueOnClick) ||
|
|
18803
|
-
|
|
18970
|
+
this.loadedTreeJs.liElementsById[id].classList.value.indexOf("readonly_node") != -1)
|
|
18804
18971
|
return;
|
|
18805
18972
|
this.ignoreOptionsChanges = true;
|
|
18806
18973
|
// Override of treejs normal workaround =>> DONT EDIT IT!
|
|
@@ -18817,7 +18984,7 @@ const HierarchizedPickerComponent = class {
|
|
|
18817
18984
|
this.editValue(node);
|
|
18818
18985
|
if (this.shownTree && userClick) {
|
|
18819
18986
|
await this.focusMainInput();
|
|
18820
|
-
if (!this.
|
|
18987
|
+
if (!this.options.multiple) {
|
|
18821
18988
|
this.showTree("hide");
|
|
18822
18989
|
}
|
|
18823
18990
|
}
|
|
@@ -18850,50 +19017,34 @@ const HierarchizedPickerComponent = class {
|
|
|
18850
19017
|
document.querySelectorAll('#tree-area-' + this.componentID + ' .treejs-node').forEach((item) => item.classList.add('treejs-node__close'));
|
|
18851
19018
|
}
|
|
18852
19019
|
// Displays all selected nodes by deploying nodes that contain selected
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
|
|
18856
|
-
|
|
18857
|
-
|
|
18858
|
-
|
|
18859
|
-
|
|
18860
|
-
|
|
18861
|
-
|
|
18862
|
-
|
|
18863
|
-
|
|
18864
|
-
|
|
18865
|
-
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
}
|
|
18870
|
-
scrollToValue += element.offsetTop;
|
|
18871
|
-
const parent = (_d = element.parentNode) === null || _d === void 0 ? void 0 : _d.closest('.treejs-node');
|
|
18872
|
-
if (parent) {
|
|
18873
|
-
removeClosedAndLookUp(parent);
|
|
18874
|
-
}
|
|
18875
|
-
};
|
|
18876
|
-
const checkeds = document.querySelectorAll('#tree-area-' + this.componentID + ' .treejs-node__checked');
|
|
18877
|
-
checkeds.forEach((item) => removeClosedAndLookUp(item));
|
|
18878
|
-
if (scrollToValue && this.scrollable) {
|
|
18879
|
-
this.scrollable.scrollTop = scrollToValue;
|
|
19020
|
+
showSelectedNodes() {
|
|
19021
|
+
let scrollToValue = 0;
|
|
19022
|
+
let removeClosedAndLookUp = (element) => {
|
|
19023
|
+
var _a, _b, _c, _d;
|
|
19024
|
+
const nodeId = element === null || element === void 0 ? void 0 : element.nodeId;
|
|
19025
|
+
if (!element || !nodeId) {
|
|
19026
|
+
return;
|
|
19027
|
+
}
|
|
19028
|
+
const node = this.loadedTreeJs.nodesById[nodeId];
|
|
19029
|
+
if ((_b = (_a = node === null || node === void 0 ? void 0 : node.children) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.id) {
|
|
19030
|
+
(_c = element.classList) === null || _c === void 0 ? void 0 : _c.remove('treejs-node__close');
|
|
19031
|
+
}
|
|
19032
|
+
scrollToValue += element.offsetTop;
|
|
19033
|
+
const parent = (_d = element.parentNode) === null || _d === void 0 ? void 0 : _d.closest('.treejs-node');
|
|
19034
|
+
if (parent) {
|
|
19035
|
+
removeClosedAndLookUp(parent);
|
|
18880
19036
|
}
|
|
18881
19037
|
};
|
|
18882
|
-
|
|
18883
|
-
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
}
|
|
18887
|
-
else {
|
|
18888
|
-
scrollToNode();
|
|
19038
|
+
const checkeds = document.querySelectorAll('#tree-area-' + this.componentID + ' .treejs-node__checked');
|
|
19039
|
+
checkeds.forEach((item) => removeClosedAndLookUp(item));
|
|
19040
|
+
if (scrollToValue && this.scrollable) {
|
|
19041
|
+
this.scrollable.scrollTop = scrollToValue;
|
|
18889
19042
|
}
|
|
18890
19043
|
}
|
|
18891
19044
|
// Event to manage the Display/Hide of the tree
|
|
18892
19045
|
showTree(focused) {
|
|
18893
|
-
if (!this.hasFocus)
|
|
18894
|
-
this.hasFocus = [];
|
|
18895
19046
|
this.clearAutocomplete();
|
|
18896
|
-
if (!this.canload || !this.
|
|
19047
|
+
if (!this.canload || !this.options.displayTree)
|
|
18897
19048
|
return;
|
|
18898
19049
|
this.mylog("--------- showTree-" + this.componentID, focused, this.hasFocus);
|
|
18899
19050
|
// hide tree when asked to or when it is disabled
|
|
@@ -18902,15 +19053,15 @@ const HierarchizedPickerComponent = class {
|
|
|
18902
19053
|
let elem = document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input');
|
|
18903
19054
|
if (elem) {
|
|
18904
19055
|
elem.value = "";
|
|
18905
|
-
this.translateDataForTree(this.rawData);
|
|
18906
19056
|
}
|
|
19057
|
+
// this.search("");
|
|
18907
19058
|
}
|
|
18908
19059
|
else {
|
|
18909
19060
|
if (this.hasFocus.indexOf(focused) == -1 && this.hasFocus.indexOf("hide") == -1) {
|
|
18910
19061
|
this.hasFocus.push(focused);
|
|
18911
19062
|
}
|
|
18912
19063
|
}
|
|
18913
|
-
if (!this.shownTree && this.
|
|
19064
|
+
if (!this.shownTree && this.options.loading == "click") {
|
|
18914
19065
|
this.loadDataForTree();
|
|
18915
19066
|
}
|
|
18916
19067
|
if (this.hasFocus.indexOf("hide") > -1) {
|
|
@@ -18918,6 +19069,9 @@ const HierarchizedPickerComponent = class {
|
|
|
18918
19069
|
}
|
|
18919
19070
|
let previousShownTree = this.shownTree;
|
|
18920
19071
|
this.shownTree = this.hasFocus.length > 0;
|
|
19072
|
+
if (!previousShownTree && this.shownTree) {
|
|
19073
|
+
this.showSelectedNodes();
|
|
19074
|
+
}
|
|
18921
19075
|
if (!this.shownTree) {
|
|
18922
19076
|
this.collapseAllNodes();
|
|
18923
19077
|
this.clearAutocomplete(true);
|
|
@@ -18928,9 +19082,6 @@ const HierarchizedPickerComponent = class {
|
|
|
18928
19082
|
else {
|
|
18929
19083
|
this.focusModal();
|
|
18930
19084
|
}
|
|
18931
|
-
if (!previousShownTree && this.shownTree) {
|
|
18932
|
-
this.showSelectedNodes();
|
|
18933
|
-
}
|
|
18934
19085
|
}
|
|
18935
19086
|
// Changes the value of the component with passed node
|
|
18936
19087
|
editValue(node) {
|
|
@@ -18946,7 +19097,7 @@ const HierarchizedPickerComponent = class {
|
|
|
18946
19097
|
this.value.splice(result, 1);
|
|
18947
19098
|
} // Else, add the node to the array of values
|
|
18948
19099
|
else {
|
|
18949
|
-
if (this.
|
|
19100
|
+
if (this.options.multiple) {
|
|
18950
19101
|
this.value = [...this.value, {
|
|
18951
19102
|
nodeid: node.id,
|
|
18952
19103
|
fullpath: node.fullpath,
|
|
@@ -18969,7 +19120,7 @@ const HierarchizedPickerComponent = class {
|
|
|
18969
19120
|
setDisplayedValue(value = null) {
|
|
18970
19121
|
if (!value)
|
|
18971
19122
|
value = this.value;
|
|
18972
|
-
this.displayedValue = value.map(item => (this.
|
|
19123
|
+
this.displayedValue = value.map(item => (this.options.isFullpath
|
|
18973
19124
|
?
|
|
18974
19125
|
item.fullpathTranslated
|
|
18975
19126
|
:
|
|
@@ -18977,7 +19128,7 @@ const HierarchizedPickerComponent = class {
|
|
|
18977
19128
|
}
|
|
18978
19129
|
// Search a value in the tree and triggers a search when necessary
|
|
18979
19130
|
search(searched) {
|
|
18980
|
-
if (this.
|
|
19131
|
+
if (this.options.mode == 'input') {
|
|
18981
19132
|
document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input').classList.remove('fieldError');
|
|
18982
19133
|
}
|
|
18983
19134
|
if (searched.length > 2) {
|
|
@@ -18985,7 +19136,7 @@ const HierarchizedPickerComponent = class {
|
|
|
18985
19136
|
let me = this.searchToDisplay;
|
|
18986
19137
|
setTimeout(() => {
|
|
18987
19138
|
if (this.searchToDisplay == me) {
|
|
18988
|
-
this.triggerSearch(searched
|
|
19139
|
+
this.triggerSearch(searched);
|
|
18989
19140
|
//Recheck previously selected fields ?
|
|
18990
19141
|
this.checkFields(this.value, false);
|
|
18991
19142
|
}
|
|
@@ -18993,54 +19144,54 @@ const HierarchizedPickerComponent = class {
|
|
|
18993
19144
|
}
|
|
18994
19145
|
else {
|
|
18995
19146
|
this.searchToDisplay = -1;
|
|
19147
|
+
let rootnode = 0;
|
|
19148
|
+
if (this.options.origin == "classification") {
|
|
19149
|
+
rootnode = this.options.options.startNode;
|
|
19150
|
+
}
|
|
19151
|
+
else {
|
|
19152
|
+
rootnode = this.options.options.StartNodeID;
|
|
19153
|
+
}
|
|
18996
19154
|
//Displays the full tree
|
|
18997
|
-
this.translateDataForTree(this.rawData);
|
|
19155
|
+
this.translateDataForTree(this.rawData, rootnode);
|
|
18998
19156
|
//Reset autocomplete
|
|
18999
19157
|
this.displayAutocompleteWithResults(null, "");
|
|
19000
|
-
//Recheck previously selected fields ?
|
|
19001
|
-
|
|
19158
|
+
//Recheck previously selected fields ?
|
|
19159
|
+
this.checkFields(this.value, false);
|
|
19002
19160
|
}
|
|
19003
19161
|
}
|
|
19004
19162
|
// Refresh the tree with search results
|
|
19005
|
-
triggerSearch(searched
|
|
19006
|
-
|
|
19163
|
+
triggerSearch(searched) {
|
|
19164
|
+
let rootnode = 0;
|
|
19165
|
+
if (this.options.origin == "classification") {
|
|
19166
|
+
rootnode = this.options.options.startNode;
|
|
19167
|
+
}
|
|
19168
|
+
else {
|
|
19169
|
+
rootnode = this.options.options.StartNodeID;
|
|
19170
|
+
}
|
|
19171
|
+
this.translateDataForTree(this.rawData, rootnode, searched);
|
|
19007
19172
|
}
|
|
19008
19173
|
displayPickerError(errorMsg = "") {
|
|
19009
|
-
|
|
19010
|
-
|
|
19011
|
-
|
|
19012
|
-
if (errorMsg == "") {
|
|
19013
|
-
errorMsg = "There has been an error ... > [Generic error]";
|
|
19014
|
-
}
|
|
19015
|
-
this.displayedValue = errorMsg;
|
|
19016
|
-
// this.disabled = true;
|
|
19017
|
-
this.errorToLog = errorMsg;
|
|
19018
|
-
}
|
|
19019
|
-
}
|
|
19020
|
-
catch (_a) {
|
|
19021
|
-
console.error(errorMsg);
|
|
19174
|
+
document.querySelector('#hierarchized-picker-' + this.componentID).classList.add('fieldError');
|
|
19175
|
+
if (errorMsg == "") {
|
|
19176
|
+
errorMsg = "There has been an error ... [Generic]";
|
|
19022
19177
|
}
|
|
19178
|
+
this.displayedValue = errorMsg;
|
|
19023
19179
|
}
|
|
19024
19180
|
setRawDataFromFile(filePath) {
|
|
19025
19181
|
try {
|
|
19026
|
-
var rawFile = new
|
|
19182
|
+
var rawFile = new XMLHttpRequest();
|
|
19027
19183
|
rawFile.open("GET", filePath);
|
|
19028
19184
|
rawFile.onreadystatechange = () => {
|
|
19029
|
-
|
|
19030
|
-
if (rawFile.
|
|
19031
|
-
|
|
19032
|
-
|
|
19033
|
-
|
|
19034
|
-
|
|
19035
|
-
|
|
19036
|
-
|
|
19037
|
-
|
|
19038
|
-
this.displayPickerError('Error loading Data from path "' + filePath + '"!');
|
|
19039
|
-
}
|
|
19185
|
+
if (rawFile.readyState === 4) {
|
|
19186
|
+
if (rawFile.status === 200 || rawFile.status == 0) {
|
|
19187
|
+
var allText = rawFile.responseText;
|
|
19188
|
+
this.rawData = JSON.parse(allText);
|
|
19189
|
+
this.formatDefaultValue();
|
|
19190
|
+
this.showSelectedNodes();
|
|
19191
|
+
}
|
|
19192
|
+
else {
|
|
19193
|
+
this.displayPickerError('Error loading Data from path "' + filePath + '"!');
|
|
19040
19194
|
}
|
|
19041
|
-
}
|
|
19042
|
-
catch (err) {
|
|
19043
|
-
this.displayPickerError('Error loading Data from path "' + filePath + '"!');
|
|
19044
19195
|
}
|
|
19045
19196
|
};
|
|
19046
19197
|
if (!this.rawData) {
|
|
@@ -19058,62 +19209,48 @@ const HierarchizedPickerComponent = class {
|
|
|
19058
19209
|
}
|
|
19059
19210
|
}
|
|
19060
19211
|
loadDataForTree(init = false) {
|
|
19061
|
-
if (this.
|
|
19062
|
-
|
|
19063
|
-
.
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
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
|
-
});
|
|
19212
|
+
if (this.options.source == 'webservice') {
|
|
19213
|
+
if (this.options.origin == "classification") {
|
|
19214
|
+
this.getDataFromSourceClassification(this.options.url, this.options.options, init);
|
|
19215
|
+
}
|
|
19216
|
+
else {
|
|
19217
|
+
this.getDataFromSource(this.options.url, this.options.options, init);
|
|
19218
|
+
}
|
|
19077
19219
|
}
|
|
19078
|
-
if (this.
|
|
19079
|
-
this.rawData = typeof this.
|
|
19080
|
-
this.formatDefaultValue();
|
|
19220
|
+
if (this.options.source == 'data') {
|
|
19221
|
+
this.rawData = typeof this.options.data === 'object' ? this.options.data : JSON.parse(this.options.data);
|
|
19081
19222
|
}
|
|
19082
|
-
if (this.
|
|
19083
|
-
this.setRawDataFromFile(this.
|
|
19223
|
+
if (this.options.source == 'file') {
|
|
19224
|
+
this.setRawDataFromFile(this.options.url);
|
|
19084
19225
|
}
|
|
19085
19226
|
}
|
|
19086
19227
|
componentWillRender() {
|
|
19087
|
-
this.mylog("----- componentWillRender beginning
|
|
19228
|
+
this.mylog("----- componentWillRender beginning");
|
|
19088
19229
|
}
|
|
19089
19230
|
componentDidRender() {
|
|
19090
|
-
this.mylog("----- componentDidRender beginning
|
|
19231
|
+
this.mylog("----- componentDidRender beginning");
|
|
19091
19232
|
}
|
|
19092
19233
|
displayWhenLoaded() {
|
|
19093
19234
|
if (!this.canload) {
|
|
19094
19235
|
this.displayPickerError('Error(s) in the picker configuration!');
|
|
19095
19236
|
return;
|
|
19096
19237
|
}
|
|
19097
|
-
if (this.
|
|
19238
|
+
if (this.options && this.options.loading == "display") {
|
|
19098
19239
|
this.loadDataForTree(true);
|
|
19099
19240
|
}
|
|
19100
19241
|
}
|
|
19101
19242
|
componentDidLoad() {
|
|
19102
|
-
this.mylog("----- componentDidLoad beginning
|
|
19243
|
+
this.mylog("----- componentDidLoad beginning");
|
|
19103
19244
|
this.displayWhenLoaded();
|
|
19104
19245
|
}
|
|
19105
19246
|
checkFields(values, allowSetValueOnClick = true) {
|
|
19247
|
+
let that = this;
|
|
19106
19248
|
this.setValueOnClick = allowSetValueOnClick;
|
|
19107
19249
|
if (values) {
|
|
19108
|
-
values.forEach(
|
|
19109
|
-
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
}
|
|
19113
|
-
if (Object.keys(this.loadedTreeJs.liElementsById).indexOf(element.nodeid) > -1) {
|
|
19114
|
-
if ((this.loadedTreeJs.liElementsById[element.nodeid].classList.value && this.loadedTreeJs.liElementsById[element.nodeid].classList.value.indexOf("treejs-node__checked") == -1) ||
|
|
19115
|
-
this.theOptions.defaultValue.indexOf(intNodeid) != -1) {
|
|
19116
|
-
this.setNodeAsSelected(element.nodeid, this.loadedTreeJs, false);
|
|
19250
|
+
values.forEach(element => {
|
|
19251
|
+
if (Object.keys(this.loadedTreeJs.liElementsById).indexOf(element.nodeid.toString()) > -1) {
|
|
19252
|
+
if (this.loadedTreeJs.liElementsById[element.nodeid].classList.value.indexOf("treejs-node__checked") == -1) {
|
|
19253
|
+
that.setNodeAsSelected(element.nodeid, this.loadedTreeJs, false);
|
|
19117
19254
|
}
|
|
19118
19255
|
}
|
|
19119
19256
|
});
|
|
@@ -19121,19 +19258,29 @@ const HierarchizedPickerComponent = class {
|
|
|
19121
19258
|
this.setValueOnClick = true;
|
|
19122
19259
|
}
|
|
19123
19260
|
formatDefaultValue() {
|
|
19124
|
-
let found = 0;
|
|
19125
19261
|
let that = this;
|
|
19262
|
+
let found = 0;
|
|
19126
19263
|
let recursive = function (children) {
|
|
19127
|
-
children.forEach(
|
|
19128
|
-
that.
|
|
19264
|
+
children.forEach(element => {
|
|
19265
|
+
that.options.defaultValue.forEach(dfValue => {
|
|
19129
19266
|
if (typeof dfValue == 'string' && isNumeric(dfValue)) {
|
|
19130
19267
|
dfValue = parseInt(dfValue);
|
|
19131
19268
|
}
|
|
19132
|
-
if (
|
|
19133
|
-
(typeof dfValue == '
|
|
19134
|
-
|
|
19135
|
-
|
|
19136
|
-
|
|
19269
|
+
if (that.options.origin == "classification") {
|
|
19270
|
+
if ((typeof dfValue == 'string' && that.getPropertyFromNode(element, "FullPath") == dfValue) ||
|
|
19271
|
+
(typeof dfValue == 'number' && that.getPropertyFromNode(element, "ID") == dfValue)) {
|
|
19272
|
+
element.nodeid = element.id;
|
|
19273
|
+
that.checkFields([element]);
|
|
19274
|
+
found++;
|
|
19275
|
+
}
|
|
19276
|
+
}
|
|
19277
|
+
else {
|
|
19278
|
+
if ((typeof dfValue == 'string' && that.getPropertyFromNode(element, "fullpathTranslated") == dfValue) ||
|
|
19279
|
+
(typeof dfValue == 'number' && that.getPropertyFromNode(element, "key") == dfValue)) {
|
|
19280
|
+
element.nodeid = element.key;
|
|
19281
|
+
that.checkFields([element]);
|
|
19282
|
+
found++;
|
|
19283
|
+
}
|
|
19137
19284
|
}
|
|
19138
19285
|
});
|
|
19139
19286
|
if (element.children)
|
|
@@ -19143,20 +19290,14 @@ const HierarchizedPickerComponent = class {
|
|
|
19143
19290
|
if (this.rawData) {
|
|
19144
19291
|
recursive([this.rawData]);
|
|
19145
19292
|
}
|
|
19146
|
-
if (this.
|
|
19293
|
+
if (this.options.defaultValue.length != found) {
|
|
19147
19294
|
if (found == 0) {
|
|
19148
|
-
|
|
19149
|
-
this.
|
|
19150
|
-
this.theOptions.defaultValue.map(item => item).join(',');
|
|
19151
|
-
}
|
|
19152
|
-
catch (_a) {
|
|
19153
|
-
this.errorToLog = "The loaded tree doesn't contain the nodes passed to options.defaultValue : there's an issue with your defaultValue > " +
|
|
19154
|
-
this.theOptions.defaultValue.toString();
|
|
19155
|
-
}
|
|
19295
|
+
this.errorToLog = "The loaded tree doesn't contain the nodes passed to options.defaultValue : " +
|
|
19296
|
+
this.options.defaultValue.map(item => item).join(',');
|
|
19156
19297
|
}
|
|
19157
19298
|
else {
|
|
19158
19299
|
this.errorToLog = "The loaded tree contains multiple nodes of what has been passed to options.defaultValue : " +
|
|
19159
|
-
this.
|
|
19300
|
+
this.options.defaultValue.map(item => item).join(',');
|
|
19160
19301
|
}
|
|
19161
19302
|
this.displayPickerError('Error(s) when loading tree default value(s)!');
|
|
19162
19303
|
}
|
|
@@ -19202,45 +19343,40 @@ const HierarchizedPickerComponent = class {
|
|
|
19202
19343
|
this.search(event.target.value);
|
|
19203
19344
|
}
|
|
19204
19345
|
render() {
|
|
19205
|
-
return (this.
|
|
19206
|
-
?
|
|
19207
|
-
index.h("div", {
|
|
19208
|
-
|
|
19209
|
-
|
|
19210
|
-
|
|
19211
|
-
|
|
19212
|
-
|
|
19213
|
-
|
|
19214
|
-
|
|
19215
|
-
|
|
19216
|
-
|
|
19217
|
-
|
|
19218
|
-
|
|
19219
|
-
|
|
19220
|
-
|
|
19221
|
-
|
|
19222
|
-
|
|
19223
|
-
|
|
19224
|
-
|
|
19225
|
-
|
|
19226
|
-
|
|
19227
|
-
|
|
19228
|
-
|
|
19229
|
-
|
|
19230
|
-
|
|
19231
|
-
|
|
19232
|
-
|
|
19233
|
-
|
|
19234
|
-
|
|
19235
|
-
|
|
19236
|
-
|
|
19237
|
-
|
|
19238
|
-
|
|
19239
|
-
} }, index.h("div", { class: "loader", ref: (el => {
|
|
19240
|
-
this.loader = el;
|
|
19241
|
-
}) }, index.h("div", { class: "loader-inner" }, "Loading...")), index.h("div", { ref: (el) => {
|
|
19242
|
-
this.scrollable = el;
|
|
19243
|
-
}, id: 'tree-area-' + this.componentID, class: 'hierarchized-picker-tree scrollable hierarchized-picker-raw-tree ' + this.pickerClass }))))
|
|
19346
|
+
return (this.options ?
|
|
19347
|
+
index.h("div", { id: 'hierarchized-picker-' + this.componentID, class: "hierarchized-picker " + (this.disabled ? "readonly-mode" : "") }, (this.options.mode == "input" ?
|
|
19348
|
+
index.h("div", { class: "hierarchized-picker-container" }, index.h("div", { style: { display: "none" }, ref: (el => {
|
|
19349
|
+
this.loader = el;
|
|
19350
|
+
}) }, "TODO"), index.h("div", { class: "hierarchized-picker-input-area" }, this.options.label ? index.h("label", { class: "hierarchized-picker-label" }, this.options.label) : '', index.h("span", { class: 'hierarchized-picker-input ' + (this.options.icon && this.options.icon.length > 0 ? "hierarchized-picker-icon" : "") +
|
|
19351
|
+
' reneco ' + (this.options.icon ? this.options.icon : "") + (this.disabled ? " readonly " : "") +
|
|
19352
|
+
' sc-ion-input-md-h sc-ion-input-md-s md ', id: 'hierarchized-picker-input-' + this.componentID, onClick: _event => {
|
|
19353
|
+
this.showTree("picker");
|
|
19354
|
+
}, onFocusin: _event => {
|
|
19355
|
+
this.showTree("modale");
|
|
19356
|
+
} }, 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) ?
|
|
19357
|
+
index.h("span", { class: "reneco reneco-close", onClick: () => this.clearPicker() })
|
|
19358
|
+
: ''), index.h("div", { class: 'hierarchized-picker-modal-area ' + (!this.shownTree ? ' hidden ' : ''), onClick: event => {
|
|
19359
|
+
this.clickPickerModalArea(event);
|
|
19360
|
+
} }, 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" +
|
|
19361
|
+
" sc-ion-input-md-h sc-ion-input-md-s md", onKeyUp: event => {
|
|
19362
|
+
this.keyUpPickerSearchInput(event);
|
|
19363
|
+
}, onFocusin: event => {
|
|
19364
|
+
setTimeout(() => {
|
|
19365
|
+
this.showAutocomplete();
|
|
19366
|
+
}, 500);
|
|
19367
|
+
if (this.hasFocus.length == 0)
|
|
19368
|
+
this.focusInSearchEvent(event);
|
|
19369
|
+
}, onFocusout: event => {
|
|
19370
|
+
this.focusOutSearchEvent(event);
|
|
19371
|
+
} }, index.h("input", { class: "native-input sc-ion-input-md", autocapitalize: "off", autocomplete: "off", autocorrect: "off", name: "ion-input-0", placeholder: this.options.searchPlaceholder, spellcheck: "false", type: "text" })), index.h("ul", { id: "autocomplete-results-area" }), index.h("div", { id: 'tree-area-' + this.componentID, class: 'hierarchized-picker-tree-area ' + this.pickerClass }))))
|
|
19372
|
+
:
|
|
19373
|
+
index.h("div", { class: 'hierarchized-picker-raw-tree-area', onClick: event => {
|
|
19374
|
+
this.clickPickerModalArea(event);
|
|
19375
|
+
} }, index.h("div", { class: "loader", ref: (el => {
|
|
19376
|
+
this.loader = el;
|
|
19377
|
+
}) }, index.h("div", { class: "loader-inner" }, "Loading...")), index.h("div", { ref: (el) => {
|
|
19378
|
+
this.scrollable = el;
|
|
19379
|
+
}, id: 'tree-area-' + this.componentID, class: 'scrollable hierarchized-picker-raw-tree ' + this.pickerClass }))))
|
|
19244
19380
|
:
|
|
19245
19381
|
index.h("div", { class: "fieldError" }, "Generic loading issue..."));
|
|
19246
19382
|
}
|
|
@@ -19253,6 +19389,6 @@ const HierarchizedPickerComponent = class {
|
|
|
19253
19389
|
"rawData": ["rawDataWatcher"]
|
|
19254
19390
|
}; }
|
|
19255
19391
|
};
|
|
19256
|
-
|
|
19392
|
+
MyComponent.style = hierarchizedPickerCss;
|
|
19257
19393
|
|
|
19258
|
-
exports.reneco_hierarchized_picker =
|
|
19394
|
+
exports.reneco_hierarchized_picker = MyComponent;
|