@cas-smartdesign/tree 4.0.5 → 4.1.1
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/docs/3_lazy_loading.js +1 -1
- package/dist/docs/doc.css +1 -1
- package/dist/docs/doc.mjs +78 -81
- package/dist/tree-with-externals.js +34 -52
- package/dist/tree-with-externals.js.map +4 -4
- package/dist/tree.mjs +206 -208
- package/dist/tree.mjs.map +1 -1
- package/npm-third-party-licenses.json +52 -47
- package/package.json +10 -10
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var window;(window||={})["@cas-smartdesign/tree"]=(()=>{var
|
|
2
|
-
\f\r]`,G=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ke=/'/g,Je=/"/g,Ze=/^(?:script|style|textarea|title)$/i,Xe=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),c=Xe(1),ns=Xe(2),B=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Ge=new WeakMap,D=L.createTreeWalker(L,129,null,!1);function et(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Fe!==void 0?Fe.createHTML(e):e}var xt=(t,e)=>{let s=t.length-1,i=[],o,n=e===2?"<svg>":"",r=G;for(let l=0;l<s;l++){let a=t[l],h,u,p=-1,v=0;for(;v<a.length&&(r.lastIndex=v,u=r.exec(a),u!==null);)v=r.lastIndex,r===G?u[1]==="!--"?r=je:u[1]!==void 0?r=qe:u[2]!==void 0?(Ze.test(u[2])&&(o=RegExp("</"+u[2],"g")),r=N):u[3]!==void 0&&(r=N):r===N?u[0]===">"?(r=o??G,p=-1):u[1]===void 0?p=-2:(p=r.lastIndex-u[2].length,h=u[1],r=u[3]===void 0?N:u[3]==='"'?Je:Ke):r===Je||r===Ke?r=N:r===je||r===qe?r=G:(r=N,o=void 0);let _=r===N&&t[l+1].startsWith("/>")?" ":"";n+=r===G?a+bt:p>=0?(i.push(h),a.slice(0,p)+ke+a.slice(p)+C+_):a+C+(p===-2?(i.push(void 0),l):_)}return[et(t,n+(t[s]||"<?>")+(e===2?"</svg>":"")),i]},Q=class t{constructor({strings:e,_$litType$:s},i){let o;this.parts=[];let n=0,r=0,l=e.length-1,a=this.parts,[h,u]=xt(e,s);if(this.el=t.createElement(h,i),D.currentNode=this.el.content,s===2){let p=this.el.content,v=p.firstChild;v.remove(),p.append(...v.childNodes)}for(;(o=D.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes()){let p=[];for(let v of o.getAttributeNames())if(v.endsWith(ke)||v.startsWith(C)){let _=u[r++];if(p.push(v),_!==void 0){let lt=o.getAttribute(_.toLowerCase()+ke).split(C),oe=/([.?@])?(.*)/.exec(_);a.push({type:1,index:n,name:oe[2],strings:lt,ctor:oe[1]==="."?Ce:oe[1]==="?"?Ae:oe[1]==="@"?Ie:V})}else a.push({type:6,index:n})}for(let v of p)o.removeAttribute(v)}if(Ze.test(o.tagName)){let p=o.textContent.split(C),v=p.length-1;if(v>0){o.textContent=z?z.emptyScript:"";for(let _=0;_<v;_++)o.append(p[_],W()),D.nextNode(),a.push({type:2,index:++n});o.append(p[v],W())}}}else if(o.nodeType===8)if(o.data===Ye)a.push({type:2,index:n});else{let p=-1;for(;(p=o.data.indexOf(C,p+1))!==-1;)a.push({type:7,index:n}),p+=C.length-1}n++}}static createElement(e,s){let i=L.createElement("template");return i.innerHTML=e,i}};function H(t,e,s=t,i){var o,n,r,l;if(e===B)return e;let a=i!==void 0?(o=s._$Co)===null||o===void 0?void 0:o[i]:s._$Cl,h=Y(e)?void 0:e._$litDirective$;return a?.constructor!==h&&((n=a?._$AO)===null||n===void 0||n.call(a,!1),h===void 0?a=void 0:(a=new h(t),a._$AT(t,s,i)),i!==void 0?((r=(l=s)._$Co)!==null&&r!==void 0?r:l._$Co=[])[i]=a:s._$Cl=a),a!==void 0&&(e=H(t,a._$AS(t,e.values),a,i)),e}var we=class{constructor(e,s){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var s;let{el:{content:i},parts:o}=this._$AD,n=((s=e?.creationScope)!==null&&s!==void 0?s:L).importNode(i,!0);D.currentNode=n;let r=D.nextNode(),l=0,a=0,h=o[0];for(;h!==void 0;){if(l===h.index){let u;h.type===2?u=new Z(r,r.nextSibling,this,e):h.type===1?u=new h.ctor(r,h.name,h.strings,this,e):h.type===6&&(u=new Ee(r,this,e)),this._$AV.push(u),h=o[++a]}l!==h?.index&&(r=D.nextNode(),l++)}return D.currentNode=L,n}v(e){let s=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,s),s+=i.strings.length-2):i._$AI(e[s])),s++}},Z=class t{constructor(e,s,i,o){var n;this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=s,this._$AM=i,this.options=o,this._$Cp=(n=o?.isConnected)===null||n===void 0||n}get _$AU(){var e,s;return(s=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&s!==void 0?s:this._$Cp}get parentNode(){let e=this._$AA.parentNode,s=this._$AM;return s!==void 0&&e?.nodeType===11&&(e=s.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,s=this){e=H(this,e,s),Y(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==B&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):mt(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==f&&Y(this._$AH)?this._$AA.nextSibling.data=e:this.$(L.createTextNode(e)),this._$AH=e}g(e){var s;let{values:i,_$litType$:o}=e,n=typeof o=="number"?this._$AC(e):(o.el===void 0&&(o.el=Q.createElement(et(o.h,o.h[0]),this.options)),o);if(((s=this._$AH)===null||s===void 0?void 0:s._$AD)===n)this._$AH.v(i);else{let r=new we(n,this),l=r.u(this.options);r.v(i),this.$(l),this._$AH=r}}_$AC(e){let s=Ge.get(e.strings);return s===void 0&&Ge.set(e.strings,s=new Q(e)),s}T(e){Qe(this._$AH)||(this._$AH=[],this._$AR());let s=this._$AH,i,o=0;for(let n of e)o===s.length?s.push(i=new t(this.k(W()),this.k(W()),this,this.options)):i=s[o],i._$AI(n),o++;o<s.length&&(this._$AR(i&&i._$AB.nextSibling,o),s.length=o)}_$AR(e=this._$AA.nextSibling,s){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,s);e&&e!==this._$AB;){let o=e.nextSibling;e.remove(),e=o}}setConnected(e){var s;this._$AM===void 0&&(this._$Cp=e,(s=this._$AP)===null||s===void 0||s.call(this,e))}},V=class{constructor(e,s,i,o,n){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=s,this._$AM=o,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=f}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,s=this,i,o){let n=this.strings,r=!1;if(n===void 0)e=H(this,e,s,0),r=!Y(e)||e!==this._$AH&&e!==B,r&&(this._$AH=e);else{let l=e,a,h;for(e=n[0],a=0;a<n.length-1;a++)h=H(this,l[i+a],s,a),h===B&&(h=this._$AH[a]),r||(r=!Y(h)||h!==this._$AH[a]),h===f?e=f:e!==f&&(e+=(h??"")+n[a+1]),this._$AH[a]=h}r&&!o&&this.j(e)}j(e){e===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Ce=class extends V{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===f?void 0:e}},yt=z?z.emptyScript:"",Ae=class extends V{constructor(){super(...arguments),this.type=4}j(e){e&&e!==f?this.element.setAttribute(this.name,yt):this.element.removeAttribute(this.name)}},Ie=class extends V{constructor(e,s,i,o,n){super(e,s,i,o,n),this.type=5}_$AI(e,s=this){var i;if((e=(i=H(this,e,s,0))!==null&&i!==void 0?i:f)===B)return;let o=this._$AH,n=e===f&&o!==f||e.capture!==o.capture||e.once!==o.once||e.passive!==o.passive,r=e!==f&&(o===f||n);n&&this.element.removeEventListener(this.name,this,o),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var s,i;typeof this._$AH=="function"?this._$AH.call((i=(s=this.options)===null||s===void 0?void 0:s.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}},Ee=class{constructor(e,s,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=s,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){H(this,e)}};var We=le.litHtmlPolyfillSupport;We?.(Q,Z),((Se=le.litHtmlVersions)!==null&&Se!==void 0?Se:le.litHtmlVersions=[]).push("2.8.0");var he=(t,e,s)=>{var i,o;let n=(i=s?.renderBefore)!==null&&i!==void 0?i:e,r=n._$litPart$;if(r===void 0){let l=(o=s?.renderBefore)!==null&&o!==void 0?o:null;n._$litPart$=r=new Z(e.insertBefore(W(),l),l,void 0,s??{})}return r._$AI(t),r};var Ne,De;var g=class extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,s;let i=super.createRenderRoot();return(e=(s=this.renderOptions).renderBefore)!==null&&e!==void 0||(s.renderBefore=i.firstChild),i}update(e){let s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=he(s,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return B}};g.finalized=!0,g._$litElement$=!0,(Ne=globalThis.litElementHydrateSupport)===null||Ne===void 0||Ne.call(globalThis,{LitElement:g});var tt=globalThis.litElementPolyfillSupport;tt?.({LitElement:g});((De=globalThis.litElementVersions)!==null&&De!==void 0?De:globalThis.litElementVersions=[]).push("3.3.3");var _t=(t,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(s){s.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(s){s.createProperty(e.key,t)}},St=(t,e,s)=>{e.constructor.createProperty(s,t)};function d(t){return(e,s)=>s!==void 0?St(t,e,s):_t(t,e)}var ce=t=>t??f;var $t=":host{display:inline-block;font-size:13px;line-height:20px;font-family:Segoe UI,Lucida Sans,Arial,sans-serif;color:#111;contain:content}:host([hidden]){display:none!important}:host([level=warn i]){color:#555}:host([level=suggest i]){color:#bf8800}:host([level=error i]){color:#cc0017}:host([level=warn]){color:#555}:host([level=suggest]){color:#bf8800}:host([level=error]){color:#cc0017}.icon{height:12px;width:12px;padding-right:4px;margin-bottom:-1px}",kt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2012%2012'%3e%3cstyle%20id='style3'%3e%20.st0{fill:%23fff}.st1{fill:%23c00}%20%3c/style%3e%3cg%20id='g5'%3e%3cpath%20class='st1'%20d='M6%20.9c2.8%200%205.1%202.3%205.1%205.1S8.8%2011.1%206%2011.1.9%208.8.9%206%203.2.9%206%20.9m0-1C2.7-.1-.1%202.7-.1%206s2.7%206.1%206.1%206.1%206.1-2.7%206.1-6.1S9.3-.1%206-.1z'%20id='path9'/%3e%3c/g%3e%3cg%20id='g11'%3e%3cpath%20class='st0'%20id='rect13'%20d='M5.5%202.5h1v4h-1z'/%3e%3cpath%20class='st1'%20d='M6%203v3-3m1-1H5v5h2V2z'%20id='path15'/%3e%3c/g%3e%3cg%20id='g17'%3e%3cpath%20class='st0'%20id='rect19'%20d='M5.5%208.5h1v1h-1z'/%3e%3cpath%20class='st1'%20id='polygon21'%20d='M7%208H5v2h2V8z'/%3e%3c/g%3e%3c/svg%3e",wt="data:image/svg+xml,%3csvg%20id='Ebene_1'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cstyle%3e%20.st0{fill:%23bf8800}%20%3c/style%3e%3cpath%20class='st0'%20d='M12%20.8l11%2019.8v1.3H1v-1.3L12%20.8zm.8-.6h-1.6L0%2020v3h24v-3L12.8.2z'/%3e%3cpath%20class='st0'%20d='M11%208h2v8h-2zm0%2010h2v2h-2z'/%3e%3c/svg%3e",Ct="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2012%2012'%3e%3cpath%20class='st1'%20d='M6%20.9c2.8%200%205.1%202.3%205.1%205.1S8.8%2011.1%206%2011.1.9%208.8.9%206%203.2.9%206%20.9m0-1C2.7-.1-.1%202.7-.1%206s2.7%206.1%206.1%206.1%206.1-2.7%206.1-6.1S9.3-.1%206-.1z'%20fill='%23555'/%3e%3cpath%20d='M6%209V6v3m-1%201h2V5H5v5zm2-8H5v2h2z'%20class='st1'%20fill='%23555'/%3e%3c/svg%3e",At=Object.defineProperty,It=Object.getOwnPropertyDescriptor,Be=(t,e,s,i)=>{for(var o=i>1?void 0:i?It(e,s):e,n=t.length-1,r;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&At(e,s,o),o},F,X=(F=class extends g{static parseLevel(t){if(t){let e=Object.keys(P).find(s=>s.toLowerCase()===t.toLowerCase());return e&&P[e]}}static get styles(){return[x`
|
|
4
|
-
${
|
|
5
|
-
`]}render(){return c`${this.iconToUse&&c`<img class="icon" src="${this.iconToUse}">`}${this.message}`}get iconToUse(){return this.icon||this._defaultIconPath}shouldUpdate(
|
|
1
|
+
var window;(window||={})["@cas-smartdesign/tree"]=(()=>{var mt=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var re=(e,t)=>{for(var s in t)mt(e,s,{get:t[s],enumerable:!0})},ae=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of oe(t))!ne.call(e,o)&&o!==s&&mt(e,o,{get:()=>t[o],enumerable:!(i=ie(t,o))||i.enumerable});return e};var de=e=>ae(mt({},"__esModule",{value:!0}),e);var Ge={};re(Ge,{CheckboxNode:()=>ft,Node:()=>it,RadioButtonNode:()=>gt,Tree:()=>se,findNode:()=>je,findNodeByPath:()=>te,findNodeIndex:()=>q,flattenNodes:()=>st,getOffsetForIndexAndAlignment:()=>ee,isCheckboxNode:()=>Zt,isFlattenedNode:()=>_,isNode:()=>Bt,isRadioButtonNode:()=>Qt});var rt=globalThis,at=rt.ShadowRoot&&(rt.ShadyCSS===void 0||rt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,bt=Symbol(),Ot=new WeakMap,K=class{constructor(t,s,i){if(this._$cssResult$=!0,i!==bt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=s}get styleSheet(){let t=this.o,s=this.t;if(at&&t===void 0){let i=s!==void 0&&s.length===1;i&&(t=Ot.get(s)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Ot.set(s,t))}return t}toString(){return this.cssText}},m=e=>new K(typeof e=="string"?e:e+"",void 0,bt),x=(e,...t)=>{let s=e.length===1?e[0]:t.reduce(((i,o,n)=>i+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+e[n+1]),e[0]);return new K(s,e,bt)},Ut=(e,t)=>{if(at)e.adoptedStyleSheets=t.map((s=>s instanceof CSSStyleSheet?s:s.styleSheet));else for(let s of t){let i=document.createElement("style"),o=rt.litNonce;o!==void 0&&i.setAttribute("nonce",o),i.textContent=s.cssText,e.appendChild(i)}},xt=at?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let s="";for(let i of t.cssRules)s+=i.cssText;return m(s)})(e):e;var{is:he,defineProperty:le,getOwnPropertyDescriptor:ce,getOwnPropertyNames:ue,getOwnPropertySymbols:pe,getPrototypeOf:fe}=Object,dt=globalThis,Mt=dt.trustedTypes,ge=Mt?Mt.emptyScript:"",me=dt.reactiveElementPolyfillSupport,J=(e,t)=>e,W={toAttribute(e,t){switch(t){case Boolean:e=e?ge:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let s=e;switch(t){case Boolean:s=e!==null;break;case Number:s=e===null?null:Number(e);break;case Object:case Array:try{s=JSON.parse(e)}catch{s=null}}return s}},ht=(e,t)=>!he(e,t),Tt={attribute:!0,type:String,converter:W,reflect:!1,useDefault:!1,hasChanged:ht};Symbol.metadata??=Symbol("metadata"),dt.litPropertyMetadata??=new WeakMap;var $=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=Tt){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){let i=Symbol(),o=this.getPropertyDescriptor(t,i,s);o!==void 0&&le(this.prototype,t,o)}}static getPropertyDescriptor(t,s,i){let{get:o,set:n}=ce(this.prototype,t)??{get(){return this[s]},set(r){this[s]=r}};return{get:o,set(r){let h=o?.call(this);n?.call(this,r),this.requestUpdate(t,h,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Tt}static _$Ei(){if(this.hasOwnProperty(J("elementProperties")))return;let t=fe(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(J("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(J("properties"))){let s=this.properties,i=[...ue(s),...pe(s)];for(let o of i)this.createProperty(o,s[o])}let t=this[Symbol.metadata];if(t!==null){let s=litPropertyMetadata.get(t);if(s!==void 0)for(let[i,o]of s)this.elementProperties.set(i,o)}this._$Eh=new Map;for(let[s,i]of this.elementProperties){let o=this._$Eu(s,i);o!==void 0&&this._$Eh.set(o,s)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let s=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let o of i)s.unshift(xt(o))}else t!==void 0&&s.push(xt(t));return s}static _$Eu(t,s){let i=s.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,s=this.constructor.elementProperties;for(let i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ut(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$ET(t,s){let i=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,i);if(o!==void 0&&i.reflect===!0){let n=(i.converter?.toAttribute!==void 0?i.converter:W).toAttribute(s,i.type);this._$Em=t,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(t,s){let i=this.constructor,o=i._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let n=i.getPropertyOptions(o),r=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:W;this._$Em=o;let h=r.fromAttribute(s,n.type);this[o]=h??this._$Ej?.get(o)??h,this._$Em=null}}requestUpdate(t,s,i){if(t!==void 0){let o=this.constructor,n=this[t];if(i??=o.getPropertyOptions(t),!((i.hasChanged??ht)(n,s)||i.useDefault&&i.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,i))))return;this.C(t,s,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,s,{useDefault:i,reflect:o,wrapped:n},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),n!==!0||r!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),o===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[o,n]of i){let{wrapped:r}=n,h=this[o];r!==!0||this._$AL.has(o)||h===void 0||this.C(o,void 0,n,h)}}let t=!1,s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((i=>i.hostUpdate?.())),this.update(s)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$EO?.forEach((s=>s.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((s=>this._$ET(s,this[s]))),this._$EM()}updated(t){}firstUpdated(t){}};$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[J("elementProperties")]=new Map,$[J("finalized")]=new Map,me?.({ReactiveElement:$}),(dt.reactiveElementVersions??=[]).push("2.1.1");var wt=globalThis,lt=wt.trustedTypes,zt=lt?lt.createPolicy("lit-html",{createHTML:e=>e}):void 0,Kt="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,Jt="?"+C,be=`<${Jt}>`,P=document,Y=()=>P.createComment(""),Z=e=>e===null||typeof e!="object"&&typeof e!="function",Ct=Array.isArray,xe=e=>Ct(e)||typeof e?.[Symbol.iterator]=="function",yt=`[
|
|
2
|
+
\f\r]`,G=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ht=/-->/g,Ft=/>/g,N=RegExp(`>|${yt}(?:([^\\s"'>=/]+)(${yt}*=${yt}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Vt=/'/g,qt=/"/g,Wt=/^(?:script|style|textarea|title)$/i,At=e=>(t,...s)=>({_$litType$:e,strings:t,values:s}),c=At(1),es=At(2),ss=At(3),L=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),jt=new WeakMap,D=P.createTreeWalker(P,129);function Gt(e,t){if(!Ct(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return zt!==void 0?zt.createHTML(t):t}var ye=(e,t)=>{let s=e.length-1,i=[],o,n=t===2?"<svg>":t===3?"<math>":"",r=G;for(let h=0;h<s;h++){let d=e[h],u,g,l=-1,S=0;for(;S<d.length&&(r.lastIndex=S,g=r.exec(d),g!==null);)S=r.lastIndex,r===G?g[1]==="!--"?r=Ht:g[1]!==void 0?r=Ft:g[2]!==void 0?(Wt.test(g[2])&&(o=RegExp("</"+g[2],"g")),r=N):g[3]!==void 0&&(r=N):r===N?g[0]===">"?(r=o??G,l=-1):g[1]===void 0?l=-2:(l=r.lastIndex-g[2].length,u=g[1],r=g[3]===void 0?N:g[3]==='"'?qt:Vt):r===qt||r===Vt?r=N:r===Ht||r===Ft?r=G:(r=N,o=void 0);let w=r===N&&e[h+1].startsWith("/>")?" ":"";n+=r===G?d+be:l>=0?(i.push(u),d.slice(0,l)+Kt+d.slice(l)+C+w):d+C+(l===-2?h:w)}return[Gt(e,n+(e[s]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},Q=class e{constructor({strings:t,_$litType$:s},i){let o;this.parts=[];let n=0,r=0,h=t.length-1,d=this.parts,[u,g]=ye(t,s);if(this.el=e.createElement(u,i),D.currentNode=this.el.content,s===2||s===3){let l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(o=D.nextNode())!==null&&d.length<h;){if(o.nodeType===1){if(o.hasAttributes())for(let l of o.getAttributeNames())if(l.endsWith(Kt)){let S=g[r++],w=o.getAttribute(l).split(C),nt=/([.?@])?(.*)/.exec(S);d.push({type:1,index:n,name:nt[2],strings:w,ctor:nt[1]==="."?_t:nt[1]==="?"?St:nt[1]==="@"?$t:H}),o.removeAttribute(l)}else l.startsWith(C)&&(d.push({type:6,index:n}),o.removeAttribute(l));if(Wt.test(o.tagName)){let l=o.textContent.split(C),S=l.length-1;if(S>0){o.textContent=lt?lt.emptyScript:"";for(let w=0;w<S;w++)o.append(l[w],Y()),D.nextNode(),d.push({type:2,index:++n});o.append(l[S],Y())}}}else if(o.nodeType===8)if(o.data===Jt)d.push({type:2,index:n});else{let l=-1;for(;(l=o.data.indexOf(C,l+1))!==-1;)d.push({type:7,index:n}),l+=C.length-1}n++}}static createElement(t,s){let i=P.createElement("template");return i.innerHTML=t,i}};function z(e,t,s=e,i){if(t===L)return t;let o=i!==void 0?s._$Co?.[i]:s._$Cl,n=Z(t)?void 0:t._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(e),o._$AT(e,s,i)),i!==void 0?(s._$Co??=[])[i]=o:s._$Cl=o),o!==void 0&&(t=z(e,o._$AS(e,t.values),o,i)),t}var vt=class{constructor(t,s){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:s},parts:i}=this._$AD,o=(t?.creationScope??P).importNode(s,!0);D.currentNode=o;let n=D.nextNode(),r=0,h=0,d=i[0];for(;d!==void 0;){if(r===d.index){let u;d.type===2?u=new X(n,n.nextSibling,this,t):d.type===1?u=new d.ctor(n,d.name,d.strings,this,t):d.type===6&&(u=new kt(n,this,t)),this._$AV.push(u),d=i[++h]}r!==d?.index&&(n=D.nextNode(),r++)}return D.currentNode=P,o}p(t){let s=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,s),s+=i.strings.length-2):i._$AI(t[s])),s++}},X=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,s,i,o){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=s,this._$AM=i,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,s=this._$AM;return s!==void 0&&t?.nodeType===11&&(t=s.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,s=this){t=z(this,t,s),Z(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==L&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):xe(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==p&&Z(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){let{values:s,_$litType$:i}=t,o=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=Q.createElement(Gt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===o)this._$AH.p(s);else{let n=new vt(o,this),r=n.u(this.options);n.p(s),this.T(r),this._$AH=n}}_$AC(t){let s=jt.get(t.strings);return s===void 0&&jt.set(t.strings,s=new Q(t)),s}k(t){Ct(this._$AH)||(this._$AH=[],this._$AR());let s=this._$AH,i,o=0;for(let n of t)o===s.length?s.push(i=new e(this.O(Y()),this.O(Y()),this,this.options)):i=s[o],i._$AI(n),o++;o<s.length&&(this._$AR(i&&i._$AB.nextSibling,o),s.length=o)}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);t!==this._$AB;){let i=t.nextSibling;t.remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},H=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,s,i,o,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=s,this._$AM=o,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=p}_$AI(t,s=this,i,o){let n=this.strings,r=!1;if(n===void 0)t=z(this,t,s,0),r=!Z(t)||t!==this._$AH&&t!==L,r&&(this._$AH=t);else{let h=t,d,u;for(t=n[0],d=0;d<n.length-1;d++)u=z(this,h[i+d],s,d),u===L&&(u=this._$AH[d]),r||=!Z(u)||u!==this._$AH[d],u===p?t=p:t!==p&&(t+=(u??"")+n[d+1]),this._$AH[d]=u}r&&!o&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},_t=class extends H{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}},St=class extends H{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}},$t=class extends H{constructor(t,s,i,o,n){super(t,s,i,o,n),this.type=5}_$AI(t,s=this){if((t=z(this,t,s,0)??p)===L)return;let i=this._$AH,o=t===p&&i!==p||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==p&&(i===p||o);o&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},kt=class{constructor(t,s,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=s,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){z(this,t)}};var ve=wt.litHtmlPolyfillSupport;ve?.(Q,X),(wt.litHtmlVersions??=[]).push("3.3.1");var ct=(e,t,s)=>{let i=s?.renderBefore??t,o=i._$litPart$;if(o===void 0){let n=s?.renderBefore??null;i._$litPart$=o=new X(t.insertBefore(Y(),n),n,void 0,s??{})}return o._$AI(e),o};var It=globalThis,f=class extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ct(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return L}};f._$litElement$=!0,f.finalized=!0,It.litElementHydrateSupport?.({LitElement:f});var _e=It.litElementPolyfillSupport;_e?.({LitElement:f});(It.litElementVersions??=[]).push("4.2.1");var Se={attribute:!0,type:String,converter:W,reflect:!1,hasChanged:ht},$e=(e=Se,t,s)=>{let{kind:i,metadata:o}=s,n=globalThis.litPropertyMetadata.get(o);if(n===void 0&&globalThis.litPropertyMetadata.set(o,n=new Map),i==="setter"&&((e=Object.create(e)).wrapped=!0),n.set(s.name,e),i==="accessor"){let{name:r}=s;return{set(h){let d=t.get.call(this);t.set.call(this,h),this.requestUpdate(r,d,e)},init(h){return h!==void 0&&this.C(r,void 0,e,h),h}}}if(i==="setter"){let{name:r}=s;return function(h){let d=this[r];t.call(this,h),this.requestUpdate(r,d,e)}}throw Error("Unsupported decorator location: "+i)};function a(e){return(t,s)=>typeof s=="object"?$e(e,t,s):((i,o,n)=>{let r=o.hasOwnProperty(n);return o.constructor.createProperty(n,i),r?Object.getOwnPropertyDescriptor(o,n):void 0})(e,t,s)}var ut=e=>e??p;var ke=":host{display:inline-block;font-size:13px;line-height:20px;font-family:Segoe UI,Lucida Sans,Arial,sans-serif;color:#111;contain:content}:host([hidden]){display:none!important}:host([level=warn i]){color:#555}:host([level=suggest i]){color:#bf8800}:host([level=error i]){color:#cc0017}:host([level=warn]){color:#555}:host([level=suggest]){color:#bf8800}:host([level=error]){color:#cc0017}.icon{height:12px;width:12px;padding-right:4px;margin-bottom:-1px}",we="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2012%2012'%3e%3cstyle%20id='style3'%3e%20.st0{fill:%23fff}.st1{fill:%23c00}%20%3c/style%3e%3cg%20id='g5'%3e%3cpath%20class='st1'%20d='M6%20.9c2.8%200%205.1%202.3%205.1%205.1S8.8%2011.1%206%2011.1.9%208.8.9%206%203.2.9%206%20.9m0-1C2.7-.1-.1%202.7-.1%206s2.7%206.1%206.1%206.1%206.1-2.7%206.1-6.1S9.3-.1%206-.1z'%20id='path9'/%3e%3c/g%3e%3cg%20id='g11'%3e%3cpath%20class='st0'%20id='rect13'%20d='M5.5%202.5h1v4h-1z'/%3e%3cpath%20class='st1'%20d='M6%203v3-3m1-1H5v5h2V2z'%20id='path15'/%3e%3c/g%3e%3cg%20id='g17'%3e%3cpath%20class='st0'%20id='rect19'%20d='M5.5%208.5h1v1h-1z'/%3e%3cpath%20class='st1'%20id='polygon21'%20d='M7%208H5v2h2V8z'/%3e%3c/g%3e%3c/svg%3e",Ce="data:image/svg+xml,%3csvg%20id='Ebene_1'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cstyle%3e%20.st0{fill:%23bf8800}%20%3c/style%3e%3cpath%20class='st0'%20d='M12%20.8l11%2019.8v1.3H1v-1.3L12%20.8zm.8-.6h-1.6L0%2020v3h24v-3L12.8.2z'/%3e%3cpath%20class='st0'%20d='M11%208h2v8h-2zm0%2010h2v2h-2z'/%3e%3c/svg%3e",Ae="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2012%2012'%3e%3cpath%20class='st1'%20d='M6%20.9c2.8%200%205.1%202.3%205.1%205.1S8.8%2011.1%206%2011.1.9%208.8.9%206%203.2.9%206%20.9m0-1C2.7-.1-.1%202.7-.1%206s2.7%206.1%206.1%206.1%206.1-2.7%206.1-6.1S9.3-.1%206-.1z'%20fill='%23555'/%3e%3cpath%20d='M6%209V6v3m-1%201h2V5H5v5zm2-8H5v2h2z'%20class='st1'%20fill='%23555'/%3e%3c/svg%3e",Ie=Object.defineProperty,Nt=(e,t,s,i)=>{for(var o=void 0,n=e.length-1,r;n>=0;n--)(r=e[n])&&(o=r(t,s,o)||o);return o&&Ie(t,s,o),o},F,tt=(F=class extends f{static parseLevel(e){if(e){let t=Object.keys(B).find(s=>s.toLowerCase()===e.toLowerCase());return t&&B[t]}}static get styles(){return[x`
|
|
4
|
+
${m(ke)}
|
|
5
|
+
`]}render(){return c`${this.iconToUse&&c`<img class="icon" src="${this.iconToUse}">`}${this.message}`}get iconToUse(){return this.icon||this._defaultIconPath}shouldUpdate(e){return e.has("level")&&(this._defaultIconPath=this.iconForLevel,!this.icon)?!0:super.shouldUpdate(e)}get iconForLevel(){switch(F.parseLevel(this.level)){case"warn":return Ae;case"suggest":return Ce;case"error":return we;default:return null}}},F.ID="sd-field-validation-message",F.levelConverter={fromAttribute(e){return F.parseLevel(e)},toAttribute(e){return e&&e.toLowerCase()}},F);Nt([a({type:String,attribute:!0})],tt.prototype,"message");Nt([a({type:String,attribute:!0})],tt.prototype,"icon");Nt([a({converter:tt.levelConverter,reflect:!0})],tt.prototype,"level");var Et=tt,B=(e=>(e.Warn="warn",e.Suggest="suggest",e.Error="error",e))(B||{});customElements.get(Et.ID)||customElements.define(Et.ID,Et);var Ee=`:host{display:block}:host,.label,.checkbox{outline:none}.checkbox-container{display:flex;flex-direction:row;align-items:flex-start}.checkbox{appearance:none;-moz-appearance:none;-webkit-appearance:none;display:block;margin:0;width:20px;height:20px;border:2px solid #767676;cursor:pointer;background-color:#fff}:host(:not([disabled]):focus) .highlight,:host(:not([disabled])[focused]) .highlight{background-color:#1467ba4d;border-radius:4px}:host(:not([disabled]):focus) .highlight .checkbox,:host(:not([disabled])[focused]) .highlight .checkbox{border-color:#1467ba}:host([checked]) .checkbox{background:#1467ba url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='15'%20height='15'%20viewBox='0%200%2020%2020'%3e%3cpath%20d='M15.9%204.6L17.4%206l-9.5%209.5-5.2-5.2%201.4-1.4%203.8%203.8%208-8.1z'%20fill='%23fff'/%3e%3c/svg%3e") no-repeat center center;border-color:#1467ba}.checkbox.indeterminate{background:#1467ba url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='32'%3e%3cpath%20fill='%23fff'%20d='M8%2014h16v4H8z'/%3e%3c/svg%3e") no-repeat center center;background-size:20px;border-color:#1467ba}.highlight{border:4px solid transparent;margin-right:6px}:host([disabled]) .checkbox-container{opacity:.6;cursor:default;filter:grayscale(100%);pointer-events:none}.validation-message{margin-left:4px}.label{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;margin-top:4px;line-height:20px}:host([oneline]) .label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}`,Ne=Object.defineProperty,De=Object.getOwnPropertyDescriptor,k=(e,t,s,i)=>{for(var o=i>1?void 0:i?De(t,s):t,n=e.length-1,r;n>=0;n--)(r=e[n])&&(o=(i?r(t,s,o):r(o))||o);return i&&o&&Ne(t,s,o),o},Pe="indeterminate",Dt="delegatesFocus"in window.ShadowRoot.prototype,A,v=(A=class extends f{constructor(){super(...arguments),this._checked=!1,this._indeterminate=!1}get checked(){return this._checked}set checked(e){let t=this._checked;this._checked=e,this._checked&&(this.indeterminate=!1),this.requestUpdate("checked",t)}get indeterminate(){return this._indeterminate}set indeterminate(e){let t=this._indeterminate;this._indeterminate=e,this._indeterminate&&(this.checked=!1),this.requestUpdate("indeterminate",t)}firstUpdated(e){super.firstUpdated(e),Dt||(this.checkboxElement.onfocus=()=>this.setAttribute("focused",""),this.checkboxElement.onblur=()=>this.removeAttribute("focused"),this.addEventListener("focus",t=>{t.target===this&&this.checkboxElement.focus()}))}focus(){this.checkboxElement?this.checkboxElement.focus():super.focus()}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),!Dt&&e==="tabindex"&&t!==s&&s==="0"&&this.removeAttribute("tabindex")}render(){return c`
|
|
6
6
|
<div class="checkbox-container">
|
|
7
7
|
<div class="highlight">
|
|
8
8
|
<input
|
|
9
9
|
type="checkbox"
|
|
10
10
|
id="input"
|
|
11
11
|
?disabled=${this.disabled}
|
|
12
|
-
tabindex=${
|
|
12
|
+
tabindex=${ut(this.tabIndex==null?void 0:this.tabIndex)}
|
|
13
13
|
.checked=${this.checked}
|
|
14
14
|
.indeterminate=${this.indeterminate}
|
|
15
|
-
class="checkbox${this.indeterminate?" "+
|
|
15
|
+
class="checkbox${this.indeterminate?" "+Pe:""}"
|
|
16
16
|
@change="${this.onInputValueChange}"
|
|
17
17
|
/>
|
|
18
18
|
</div>
|
|
@@ -27,10 +27,10 @@ var window;(window||={})["@cas-smartdesign/tree"]=(()=>{var ge=Object.defineProp
|
|
|
27
27
|
>
|
|
28
28
|
</sd-field-validation-message>
|
|
29
29
|
`}
|
|
30
|
-
`}onInputValueChange(
|
|
31
|
-
${
|
|
32
|
-
`]}},A.ID="sd-checkbox",A.ensureDefined=()=>{customElements.get(A.ID)||customElements.define(A.ID,A)},A.shadowRootOptions={...
|
|
33
|
-
${
|
|
30
|
+
`}onInputValueChange(e){e.preventDefault(),e.stopPropagation(),this.checked=e.target.checked,this.fireValueChange()}fireValueChange(){this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.checked}}))}get checkboxElement(){return this.shadowRoot.querySelector(".checkbox")}static get styles(){return[x`
|
|
31
|
+
${m(Ee)}
|
|
32
|
+
`]}},A.ID="sd-checkbox",A.ensureDefined=()=>{customElements.get(A.ID)||customElements.define(A.ID,A)},A.shadowRootOptions={...f.shadowRootOptions,delegatesFocus:Dt},A);k([a({type:Boolean,reflect:!0})],v.prototype,"disabled",2);k([a({type:String,reflect:!0})],v.prototype,"label",2);k([a({type:String})],v.prototype,"validationMessage",2);k([a({type:String})],v.prototype,"validationIconSrc",2);k([a({type:B,reflect:!0})],v.prototype,"validationLevel",2);k([a({type:Number})],v.prototype,"tabIndex",2);k([a({type:Boolean,reflect:!0})],v.prototype,"oneLine",2);k([a({type:Boolean,reflect:!0})],v.prototype,"checked",1);k([a({type:Boolean,reflect:!1,attribute:!1})],v.prototype,"indeterminate",1);var Pt=v;Pt.ensureDefined();var Le=":host{display:block}:host,.label,.checkbox{outline:none}:host([disabled]){pointer-events:none}:host([disabled]) .root{opacity:.6;cursor:default;filter:grayscale(100%)}:host(:not([disabled])[focused]) .highlight{display:block!important}:host([checked]) circle.inner{display:block!important}:host([checked]) circle.outer{stroke:var(--sd-radio-button-checked-color, #1467ba)!important}:host([oneline]) .label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.root{display:inline-flex;align-items:center;vertical-align:middle;width:100%;padding-top:6px;padding-bottom:6px}.root .radio-button-container{position:relative;display:inline-block;width:28px;height:28px;box-sizing:border-box;cursor:pointer;margin-right:5px;flex-shrink:0}.root .radio-button-container input{position:absolute;top:0;left:0;opacity:0}.root .radio-button-container circle.highlight{stroke:var(--sd-radio-button-highlight-color, rgba(20, 103, 186, .3))}.root .radio-button-container circle.inner{fill:var(--sd-radio-button-checked-color, #1467ba)}.root .radio-button-container circle.outer{stroke:var(--sd-radio-button-unchecked-color, #767676)}.root .label{font-family:Segoe UI,Lucida Sans,Arial,sans-serif;text-overflow:ellipsis;overflow-x:hidden;-webkit-user-select:none;user-select:none;cursor:pointer;padding-top:2px;padding-bottom:2px}",Be=Object.defineProperty,pt=(e,t,s,i)=>{for(var o=void 0,n=e.length-1,r;n>=0;n--)(r=e[n])&&(o=r(t,s,o)||o);return o&&Be(t,s,o),o},Re=0,I,et=(I=class extends f{constructor(){super(),this.checked=!1,this.value="",this.disabled=!1,this.label="",this.handleClick=e=>{e.preventDefault()},this.a11yID=I.ID+"_"+Re++}static get styles(){return[x`
|
|
33
|
+
${m(Le)}
|
|
34
34
|
`]}render(){return c`
|
|
35
35
|
<div class="root">
|
|
36
36
|
<div class="radio-button-container">
|
|
@@ -56,12 +56,12 @@ var window;(window||={})["@cas-smartdesign/tree"]=(()=>{var ge=Object.defineProp
|
|
|
56
56
|
</div>
|
|
57
57
|
<label class="label" for="${this.a11yID}" @click="${this.handleClick}">${this.label}</label>
|
|
58
58
|
</div>
|
|
59
|
-
`}},I.ID="sd-radio-button",I.ensureDefined=()=>{customElements.get(I.ID)||customElements.define(I.ID,I)},I);
|
|
60
|
-
${
|
|
59
|
+
`}},I.ID="sd-radio-button",I.ensureDefined=()=>{customElements.get(I.ID)||customElements.define(I.ID,I)},I);pt([a({type:Boolean,reflect:!0,attribute:!0})],et.prototype,"checked");pt([a({type:String,reflect:!0,attribute:!0})],et.prototype,"value");pt([a({type:Boolean,reflect:!0,attribute:!0})],et.prototype,"disabled");pt([a({type:String,reflect:!0,attribute:!0})],et.prototype,"label");var Lt=et,Oe=":host(:focus){outline:none}.buttons-container{display:flex}.buttons-container.vertical{flex-direction:column}.validation-message{margin-left:5px}",Ue=Object.defineProperty,O=(e,t,s,i)=>{for(var o=void 0,n=e.length-1,r;n>=0;n--)(r=e[n])&&(o=r(t,s,o)||o);return o&&Ue(t,s,o),o},R,E=(R=class extends f{constructor(){super(...arguments),this.layout="horizontal",this.value="",this.uncheckAllowed=!1,this.disabled=!1,this._focusIndex=-1,this._checkedButton=null,this.handleSlotChange=()=>{this._buttons=this.buttonsSlot.assignedElements(),this._buttons.forEach(e=>{!e.hasAttribute("disabled")&&this.disabled&&e.setAttribute("disabled",""),e.setAttribute("tabIndex","-1"),this.updateCheckedButton(e)})},this.handleFocusIn=e=>{let t=e.target,s=this._buttons.findIndex(i=>i==t);this.focusIndex=this.focusIndex>=0?this.focusIndex:this.getNextFocusIndex(s!==-1?s:0),this.updateFocused(null,this._buttons[this.focusIndex])},this.handleFocusOut=()=>{this.updateFocused(this._buttons[this.focusIndex])},this.handleButtonClick=e=>{this.focus();let t=this._buttons.find(i=>i.contains(e.target)),s=this._buttons.findIndex(i=>i==t);s>=0&&(this.focusIndex=s,this.updateChecked())},this.handleKeyDown=e=>{let t=!0;switch(e.key){case"Down":case"ArrowDown":{let s=this.getNextFocusIndex(this.focusIndex+1);this.focusIndex=s!==-1?s:this.getNextFocusIndex(0),this.uncheckAllowed||this.updateChecked();break}case"Up":case"ArrowUp":{let s=this.getPreviousFocusIndex(this.focusIndex-1);this.focusIndex=s!==-1?s:this.getPreviousFocusIndex(this.childElementCount-1),this.uncheckAllowed||this.updateChecked();break}case"Enter":{this.updateChecked();break}default:t=!1}t&&(e.preventDefault(),e.stopPropagation())}}get focusIndex(){return this._focusIndex}set focusIndex(e){if(e>=-1&&e<this.childElementCount){let t=this._focusIndex;if(this._focusIndex=e,t!==e){let s=this._buttons[t],i=this._buttons[this.focusIndex];this.updateFocused(s,i)}}}firstUpdated(e){super.firstUpdated(e),this.buttonsSlot.addEventListener("slotchange",this.handleSlotChange),this.addEventListener("focusin",this.handleFocusIn),this.addEventListener("focusout",this.handleFocusOut),this.addEventListener("keydown",this.handleKeyDown)}updated(e){super.updated(e),e.has("disabled")&&(this.disabled?this.disableButtons():this.enableButtons())}static get styles(){return[x`
|
|
60
|
+
${m(Oe)}
|
|
61
61
|
`]}render(){return c`
|
|
62
62
|
<div
|
|
63
63
|
class="buttons-container ${this.layout==="vertical"?"vertical":"horizontal"}"
|
|
64
|
-
@click="${
|
|
64
|
+
@click="${ut(this.disabled?void 0:this.handleButtonClick)}"
|
|
65
65
|
>
|
|
66
66
|
<slot></slot>
|
|
67
67
|
</div>
|
|
@@ -74,11 +74,11 @@ var window;(window||={})["@cas-smartdesign/tree"]=(()=>{var ge=Object.defineProp
|
|
|
74
74
|
>
|
|
75
75
|
</sd-field-validation-message>
|
|
76
76
|
`}
|
|
77
|
-
`}updateCheckedButton(
|
|
78
|
-
${
|
|
79
|
-
`]}render(){let
|
|
80
|
-
<li class="node" style="margin-left: ${this.depth*
|
|
81
|
-
${
|
|
77
|
+
`}updateCheckedButton(e){if(this._checkedButton&&this._checkedButton!==e)this.uncheckButton(e);else if(e.hasAttribute("checked")){this._checkedButton=e;let t=e.getAttribute("value");this.updateValue(t)}}disableButtons(){this._buttons?.forEach(e=>{e.setAttribute("disabled","")})}enableButtons(){this._buttons?.forEach(e=>{e.removeAttribute("disabled")})}fireValueChangeEvent(){this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value,selectedIndex:this.selectedIndex}}))}getNextFocusIndex(e){for(let t=e;t<this.childElementCount;t++){let s=this._buttons[t];if(this.isFocusable(s))return t}return-1}getPreviousFocusIndex(e){for(let t=e;t>=0;t--){let s=this._buttons[t];if(this.isFocusable(s))return t}return-1}isFocusable(e){return!e.hasAttribute("disabled")}updateChecked(){let e=this._checkedButton,t=this._buttons[this.focusIndex];this._checkedButton=t,e&&e!==t&&this.uncheckButton(e),t&&this.toggleButton(t)}toggleButton(e){e.hasAttribute("checked")?this.uncheckAllowed&&(this.uncheckButton(e),this._checkedButton=null,this.updateValue("")):(this.checkButton(e),this.updateValue(e.getAttribute("value")))}updateValue(e){this.value=e,this.fireValueChangeEvent()}updateFocused(e,t){e?.removeAttribute?.("focused"),t?.setAttribute?.("focused","")}checkButton(e){e.setAttribute("checked","")}uncheckButton(e){e.removeAttribute("checked")}get buttonsSlot(){return this.shadowRoot&&!this._buttonsSlot&&(this._buttonsSlot=this.shadowRoot.querySelector("slot")),this._buttonsSlot}get selectedIndex(){return this._buttons.indexOf(this._checkedButton)}},R.ID="sd-radio-button-group",R.ensureDefined=()=>{Lt.ensureDefined(),customElements.get(R.ID)||customElements.define(R.ID,R)},R);O([a({type:String,reflect:!0,attribute:!0})],E.prototype,"layout");O([a({type:String})],E.prototype,"value");O([a({type:Boolean,reflect:!0,attribute:"uncheck-allowed"})],E.prototype,"uncheckAllowed");O([a({type:Boolean,reflect:!0,attribute:!0})],E.prototype,"disabled");O([a({type:String})],E.prototype,"validationMessage");O([a({type:String})],E.prototype,"validationIconSrc");O([a({type:{fromAttribute(e){return e&&B[e.toLowerCase()]},toAttribute(e){return e&&e.toLowerCase()}},reflect:!0})],E.prototype,"validationLevel");var Me=E;Me.ensureDefined();var Yt=16,V=35,it=class{constructor(t,s,i,o){this.id=t,this.text=s,this.path=i,this.nodes=o,this.depth=0,this.selectionState="unchecked",this.expanded=!1,this.parentSelectionAllowed=!1,this.lastLoadingChild=!1,this.loading=!1,this.disabled=!1,this.parent=[],i?(this.depth=i.length-1,this.parent=i.slice(0,-1)):this.path=[t],this.childCount=o?o.length:0}updateSelectionStateOfChildren(){this.nodes.forEach(t=>{if(this.selectionState==="checked"){if(t.childrenType==="radio"||Qt(t))return;t.selectionState="checked"}else this.selectionState==="unchecked"&&(t.selectionState="unchecked");t.updateSelectionStateOfChildren()})}updateParent(){let t=this.parentNode;return t&&(!this.parentSelectionAllowed||this.selectionState!=="unchecked"||t.disabled)&&(t.updateSelectionStateByChildren(),t.updateParent()),t}get parentNode(){return this.parent.length?this.nodeGetter(this.parent):null}check(){this.selectionState!=="checked"&&(this.selectionState="checked",this.updateBranch())}uncheck(){this.selectionState!=="unchecked"&&(this.selectionState="unchecked",this.updateBranch())}hasRadioButtonDescendant(){if(this.childrenType==="radio")return!0;for(let t of this.nodes)if(t.hasRadioButtonDescendant())return!0}},Zt=e=>e?.type==="checkbox",Qt=e=>e?.type==="radio",ft=class extends it{constructor(t,s,i,o){super(t,s,i,o),this.type="checkbox"}toggle(){this.selectionState==="checked"?this.selectionState="unchecked":this.selectionState="checked",this.updateBranch()}updateBranch(){(!this.parentSelectionAllowed||this.selectionState==="unchecked")&&(this.updateSelectionStateOfChildren(),this.updateSelectionStateByChildren()),this.updateParent()}updateSelectionStateByChildren(){if(this.nodes.length===0)return;let t=this.nodes.map(i=>i.selectionState==="checked"||i.selectionState==="indeterminate"),s=t.some(Boolean);if(this.parentSelectionAllowed)this.selectionState=s?"checked":"unchecked";else{let i=t.every(Boolean),o=this.nodes.map(n=>n.selectionState).some(n=>n==="indeterminate");this.childrenType==="radio"?this.selectionState=s?"checked":"unchecked":o?this.selectionState="indeterminate":i?this.selectionState="checked":s?this.selectionState="indeterminate":this.selectionState="unchecked"}}getFlattenedSubtree(t){return t.reduce((s,i)=>s.concat(Zt(i)&&i.childCount>0&&i.expanded?[i,...this.getFlattenedSubtree(i.nodes)]:i),[])}},gt=class e extends it{constructor(t,s,i,o){super(t,s,i,o),this.type="radio"}toggle(){this.selectionState==="checked"?this.selectionState="unchecked":(this.selectionState="checked",this.clearSiblings()),this.updateBranch()}check(){this.selectionState!=="checked"&&(this.selectionState="checked",this.clearSiblings(),this.updateBranch())}updateBranch(){this.selectionState==="unchecked"&&this.updateSelectionStateOfChildren(),this.updateParent()}updateParent(){let t=super.updateParent();return t instanceof e&&t.clearSiblings(),t}updateSelectionStateByChildren(){this.nodes.length!==0&&(this.nodes.map(t=>t.selectionState==="checked").some(Boolean)?this.selectionState="checked":this.selectionState="unchecked")}clearSiblings(){this.getSiblings().forEach(t=>{t.uncheck()})}},Te=`:host{width:100%;display:block;contain:layout;position:absolute}:host([readonly][focused]){background-color:#1467ba4d}.node{height:35px;display:flex;align-items:center}.node .expander,.node .placeholder{height:28px;width:30px;flex-shrink:0}.node .expander{cursor:pointer;background-position:center;background-size:24px;flex:0 0 auto}.node .expander.more{background-image:url("data:image/svg+xml,%3csvg%20height='32'%20viewBox='0%200%2032%2032'%20width='32'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m15%2021%209.5-9.5%209.5%209.5'%20fill='none'%20stroke='%23999'%20stroke-linecap='square'%20stroke-width='2'%20transform='matrix(0%201%20-1%200%2032.25%20-8.25)'/%3e%3c/svg%3e")}.node .expander.less{background-image:url("data:image/svg+xml,%3csvg%20height='32'%20viewBox='0%200%2032%2032'%20width='32'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m19.75%206.75%209.5%209.5-9.5%209.5'%20fill='none'%20stroke='%23999'%20stroke-linecap='square'%20stroke-width='2'%20transform='matrix(0%201%20-1%200%2032.25%20-8.25)'/%3e%3c/svg%3e")}.node .label{outline:none}.node .input{overflow:hidden}.node ul{list-style-type:none;margin:0;padding:0}`,ze=Object.defineProperty,y=(e,t,s,i)=>{for(var o=void 0,n=e.length-1,r;n>=0;n--)(r=e[n])&&(o=r(t,s,o)||o);return o&&ze(t,s,o),o},U,b=(U=class extends f{constructor(){super(...arguments),this.text="",this.expanded=!1,this.childCount=0,this.focused=!1,this.readonly=!1,this.depth=0,this.path=[],this.type="checkbox",this.selectionState="unchecked",this.disabled=!1,this.loading=!1,this.onSelectionChange=()=>{if(!this.readonly){if(this.type=="checkbox"){let e=this.shadowRoot.querySelector(".input");this.selectionState=e.checked?"checked":e.indeterminate?"indeterminate":"unchecked"}else{let e=this.shadowRoot.querySelector(".input");this.selectionState=e.checked?"checked":"unchecked"}this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("selection",{detail:{path:this.path,checked:this.selectionState==="checked",indeterminate:this.selectionState==="indeterminate"},bubbles:!0,composed:!0}))})}}}static get styles(){return[x`
|
|
78
|
+
${m(Te)}
|
|
79
|
+
`]}render(){let e=this.childCount>0||this.children.length>0;return c`
|
|
80
|
+
<li class="node" style="margin-left: ${this.depth*Yt}px">
|
|
81
|
+
${e?c` <div class="expander ${this.expanded?"less":"more"}" @click="${this.toggle}"></div> `:c` <div class="placeholder"></div> `}
|
|
82
82
|
${this.readonly?c` <div class="label">${this.text}</div> `:c`
|
|
83
83
|
${this.type==="checkbox"?c`
|
|
84
84
|
<sd-checkbox
|
|
@@ -105,34 +105,34 @@ var window;(window||={})["@cas-smartdesign/tree"]=(()=>{var ge=Object.defineProp
|
|
|
105
105
|
></sd-radio-button>
|
|
106
106
|
`}
|
|
107
107
|
`}
|
|
108
|
-
${
|
|
108
|
+
${e&&this.expanded?c`
|
|
109
109
|
<ul>
|
|
110
110
|
<slot></slot>
|
|
111
111
|
</ul>
|
|
112
112
|
`:""}
|
|
113
113
|
</li>
|
|
114
|
-
`}toggle(){this.loading||(this.expanded=!this.expanded,this.dispatchExpansionEvent())}expand(){if(!this.loading){let
|
|
115
|
-
${
|
|
114
|
+
`}toggle(){this.loading||(this.expanded=!this.expanded,this.dispatchExpansionEvent())}expand(){if(!this.loading){let e=!this.expanded;this.expanded=!0,e&&this.dispatchExpansionEvent()}}collapse(){if(!this.loading){let e=this.expanded;this.expanded=!1,e&&this.dispatchExpansionEvent()}}getState(e){let t=Array.isArray(e)?[...e,this.nodeId]:[this.nodeId],s=[...this.children].map(o=>o.getState(t)),i;return this.type==="checkbox"?i=new ft(this.nodeId,this.text,t,s):i=new gt(this.nodeId,this.text,t,s),i.selectionState=this.selectionState,i.childrenType=s[0]?.type,i.expanded=this.expanded,i.disabled=this.disabled,i}dispatchExpansionEvent(){this.dispatchEvent(new CustomEvent("expansion",{detail:{path:this.path,expanded:this.expanded},bubbles:!0,composed:!0}))}},U.ID="sd-tree-node",U.ensureDefined=()=>{Lt.ensureDefined(),Pt.ensureDefined(),customElements.get(U.ID)||customElements.define(U.ID,U)},U);y([a({type:String,reflect:!0,attribute:!0})],b.prototype,"text");y([a({type:Boolean,reflect:!0,attribute:!0})],b.prototype,"expanded");y([a({type:String,reflect:!0,attribute:"node-id"})],b.prototype,"nodeId");y([a({type:Number,reflect:!0,attribute:"child-count"})],b.prototype,"childCount");y([a({type:Boolean,reflect:!0,attribute:!0})],b.prototype,"focused");y([a({type:Boolean,reflect:!0,attribute:!0})],b.prototype,"readonly");y([a({type:Number})],b.prototype,"depth");y([a({type:Array,attribute:!1})],b.prototype,"path");y([a({type:String,reflect:!0,attribute:!0})],b.prototype,"type");y([a({type:String,reflect:!0,attribute:"selection-state"})],b.prototype,"selectionState");y([a({type:Boolean,reflect:!0,attribute:!0})],b.prototype,"disabled");y([a({type:Boolean,reflect:!0,attribute:!0})],b.prototype,"loading");var He=b,Fe=":host{position:absolute;width:100%}:host([readonly]) li{padding-left:30px}li{height:35px;padding-left:34px}.text{vertical-align:middle;line-height:35px;font-family:Segoe UI,Lucida Sans,Arial,sans-serif;color:#111;font-size:16px}",Ve=Object.defineProperty,Xt=(e,t,s,i)=>{for(var o=void 0,n=e.length-1,r;n>=0;n--)(r=e[n])&&(o=r(t,s,o)||o);return o&&Ve(t,s,o),o},M,Rt=(M=class extends f{constructor(){super(...arguments),this.readonly=!1,this.depth=0}static get styles(){return[x`
|
|
115
|
+
${m(Fe)}
|
|
116
116
|
`]}render(){return c`
|
|
117
|
-
<li class="root" style="margin-left: ${this.depth*
|
|
117
|
+
<li class="root" style="margin-left: ${this.depth*Yt}px;">
|
|
118
118
|
<div class="text">
|
|
119
119
|
<slot>Loading...</slot>
|
|
120
120
|
</div>
|
|
121
121
|
</li>
|
|
122
|
-
`}},M.ID="sd-tree-loading-indicator",M.ensureDefined=()=>{customElements.get(M.ID)||customElements.define(M.ID,M)},M);
|
|
123
|
-
${
|
|
124
|
-
`]}firstUpdated(
|
|
125
|
-
<div class="root" style="height: ${this._allNodeCount*
|
|
122
|
+
`}},M.ID="sd-tree-loading-indicator",M.ensureDefined=()=>{customElements.get(M.ID)||customElements.define(M.ID,M)},M);Xt([a({type:Boolean,reflect:!0,attribute:!0})],Rt.prototype,"readonly");Xt([a({type:Number})],Rt.prototype,"depth");var qe=Rt,st=(e,t=1,s=0)=>t>0?e.reduce((i,o)=>i.concat(o.childCount>0&&o.expanded?[o,...st(o.nodes,t-1,s+1)]:o),[]):e.slice(),te=(e,t,s=0)=>{if(!t)return null;let i=t[s],o=e.find(n=>n.id===i);return t.length-1===s?o:o?.nodes.length>0?te(o.nodes,t,s+1):null},ee=(e,t,s,i,o,n)=>{let r=Math.max(0,n*i),h=Math.min(r,e*i),d=Math.max(0,e*i-o+i);switch(t){case"start":return h;case"end":return d;case"center":{let u=Math.round(d+(h-d)/2);return u<Math.ceil(o/2)?0:u>r+Math.floor(o/2)?r:u}case"auto":default:return s>=d&&s<=h?s:s<d?d:h}},Bt=e=>e&&typeof e!="string",je=(e,t)=>{let s=e.find(i=>Bt(i)&&JSON.stringify(i.path)===JSON.stringify(t));return Bt(s)?s:null},q=(e,t)=>e.findIndex(s=>typeof s=="string"&&s===JSON.stringify(t)),_=e=>typeof e=="string",Ke=":host{display:block;position:relative;contain:layout;overflow:auto}:host(:focus){outline:none}ul{list-style-type:none;margin:0;padding:0}.root{width:100%}",Je=Object.defineProperty,We=Object.getOwnPropertyDescriptor,ot=(e,t,s,i)=>{for(var o=i>1?void 0:i?We(t,s):t,n=e.length-1,r;n>=0;n--)(r=e[n])&&(o=(i?r(t,s,o):r(o))||o);return i&&o&&Je(t,s,o),o},T,j=(T=class extends f{constructor(){super(),this.pageSize=50,this.loadingText="Loading...",this.parentSelectionAllowed=!1,this.readonly=!1,this._lastKnownHeight=0,this._lastKnownScrollTop=0,this._lastRenderedScrollTop=0,this._visibleItemsNum=0,this._firstVisibleIndex=0,this._lastVisibleIndex=0,this._firstRenderedIndex=0,this._lastRenderedIndex=0,this._focusIndex=-1,this._flattenedNodes=[],this._rootItemsLoading=!1,this._rootNodeCount=0,this._loadedRootNodeCount=0,this._allNodeCount=0,this._nodeStates=new Map,this.onScroll=()=>{this._lastKnownScrollTop=this.scrollTop;let e=this._lastRenderedScrollTop-this._lastKnownScrollTop;Math.abs(e)>=V&&(this._lastRenderedScrollTop=this._lastKnownScrollTop,this.requestUpdate())},this.handleNodeExpansion=e=>{let{path:t,expanded:s}=e.detail;this.updateAfterExpansion(t,s)},this.handleKeyDown=e=>{let t=!0;switch(e.key){case"ArrowDown":{this.focusIndex=this.normalizeIndex(this.focusIndex+1);break}case"ArrowUp":{this.focusIndex=this.normalizeIndex(this.focusIndex-1);break}case"ArrowRight":{let s=this.focusedNode;if(s)if(s.childCount>0&&!s.expanded){let i=this.querySelector(`[node-id='${s.id}']`);i&&i.expand()}else this.focusIndex=this.normalizeIndex(this.focusIndex+1);break}case"ArrowLeft":{let s=this.focusedNode;if(s)if(s.childCount>0&&s.expanded){let i=this.querySelector(`[node-id='${s.id}']`);i&&i.collapse()}else this.focusIndex=this.normalizeIndex(this.focusIndex-1);break}case"Enter":{let s=this.focusedNode;s&&(this.toggleSelection(s.path),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("selection",{detail:{path:s.path,checked:s.selectionState==="checked",indeterminate:s.selectionState==="indeterminate"},bubbles:!0,composed:!0}))}));break}default:{t=!1;break}}t&&(e.preventDefault(),e.stopPropagation())},this.handleNodeSelection=e=>{if(e.target==this)return;this._reusePreviousRenderData=!0;let{path:t}=e.detail;this.focusIndex=q(this._flattenedNodes,t),this.focus(),this.toggleSelection(t),this.updateComplete.then(()=>{this._reusePreviousRenderData=!1})},this.getFlattenedNodeId=e=>JSON.stringify(e.path),this.nodeGetter=e=>e?this._nodeStates.get(JSON.stringify(e)):null,this._resizeObserver=new ResizeObserver(()=>{this._lastKnownHeight!==this.offsetHeight&&(this._lastKnownHeight=this.offsetHeight,this.requestUpdate())})}get rootNodeCount(){return this._rootNodeCount}set rootNodeCount(e){e===0?this._allNodeCount=0:e>0&&(this._allNodeCount+=e-this.rootNodeCount),this._rootNodeCount=e,this.requestUpdate()}get focusIndex(){return this._focusIndex}set focusIndex(e){if(e>=-1&&e<this._allNodeCount){let t=this._focusIndex;this._focusIndex=e,(e<=this._firstVisibleIndex||this._lastVisibleIndex<=e)&&this.scrollToNode(e),t!=e&&this.requestUpdate("focusIndex",t)}}setNodes(e){this.stopLoadingIndicator(),this.setLastLoadingChildren(e,this.rootNodeCount,e.length),e.forEach((t,s)=>{let i=[...e];i.splice(s,1),this.updateNodeMap(t,i)}),this.updateCount(e),this._loadedRootNodeCount=e.length,this._flattenedNodes=st(e,1/0).map(this.getFlattenedNodeId),this.requestUpdate()}addNodes(e,t){this.stopLoadingIndicator(t),e.forEach((i,o)=>{let n=[...e];n.splice(o,1),this.updateNodeMap(i,n)});let s=this.nodeGetter(t);s?s.expanded&&(this._allNodeCount+=e.length+this.getNodeCount(e)):this._loadedRootNodeCount+=e.length,this.updateFlattenedNodes(e,t),this.requestUpdate()}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver.disconnect()}static get styles(){return[x`
|
|
123
|
+
${m(Ke)}
|
|
124
|
+
`]}firstUpdated(e){super.firstUpdated(e),this.addEventListener("scroll",this.onScroll),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("expansion",this.handleNodeExpansion),this.addEventListener("selection",this.handleNodeSelection),this.addEventListener("focus",()=>{this.focusIndex==-1&&this.matches(":focus-visible")&&(this.focusIndex=this.normalizeIndex(0))}),this._nodeStates.size===0&&(this.children.length>0?this.syncState():this.requestData())}updated(e){super.updated(e),this.updateNodes(),e.has("parentSelectionAllowed")&&this.updateParentSelectionAllowed()}render(){return this.updateRenderData(),c`
|
|
125
|
+
<div class="root" style="height: ${this._allNodeCount*V}px">
|
|
126
126
|
<ul>
|
|
127
127
|
<slot></slot>
|
|
128
128
|
</ul>
|
|
129
129
|
</div>
|
|
130
|
-
`}scrollToNode(t
|
|
131
|
-
${
|
|
132
|
-
<sd-tree-loading-indicator .depth="${
|
|
130
|
+
`}scrollToNode(e,t="auto"){this.scrollTop=ee(this.normalizeIndex(e),t,this.scrollTop,V,this.height,this._allNodeCount)}updateNodeMap(e,t){e&&(e.nodeGetter=this.nodeGetter,e.getSiblings=()=>t,this._nodeStates.set(JSON.stringify(e.path),e),e.nodes.forEach((s,i)=>{let o=[...e.nodes];o.splice(i,1),this.updateNodeMap(s,o)}))}updateParentSelectionAllowed(){this._nodeStates.forEach(e=>{e.parentSelectionAllowed=this.parentSelectionAllowed})}updateNodes(){let e=this._flattenedNodes.slice(this._firstRenderedIndex,this._lastRenderedIndex+1);ct(c`
|
|
131
|
+
${e.map((t,s)=>{let i=s+this._firstRenderedIndex,o=this.getTopPosition(i);if(!_(t))return c`
|
|
132
|
+
<sd-tree-loading-indicator .depth="${t.depth}" style="transform: translateY(${o}px)"
|
|
133
133
|
>${this.loadingText}</sd-tree-loading-indicator
|
|
134
134
|
>
|
|
135
|
-
`;let n=this._nodeStates.get(
|
|
135
|
+
`;let n=this._nodeStates.get(t),r=i===this.focusIndex,h=n.disabled;return this.parentSelectionAllowed||(h=h||n.hasRadioButtonDescendant()),c`
|
|
136
136
|
<sd-tree-node
|
|
137
137
|
text="${n.text}"
|
|
138
138
|
selection-state="${n.selectionState}"
|
|
@@ -145,11 +145,11 @@ var window;(window||={})["@cas-smartdesign/tree"]=(()=>{var ge=Object.defineProp
|
|
|
145
145
|
type="${n.type}"
|
|
146
146
|
?expanded="${n.expanded}"
|
|
147
147
|
child-count="${n.childCount}"
|
|
148
|
-
?disabled="${
|
|
148
|
+
?disabled="${h}"
|
|
149
149
|
.loading="${n.loading}"
|
|
150
150
|
></sd-tree-node>
|
|
151
151
|
`})}
|
|
152
|
-
`,this)}getTopPosition(
|
|
152
|
+
`,this)}getTopPosition(e){return e*V}updateRenderData(){if(!this._reusePreviousRenderData)if(this._lastRenderedScrollTop=this.scrollTop,this._visibleItemsNum=Math.min(Math.ceil(this.height/V),this._allNodeCount),this._visibleItemsNum>0){this._firstVisibleIndex=this.normalizeIndex(Math.floor(this._lastRenderedScrollTop/V)),this._lastVisibleIndex=this.normalizeIndex(this._firstVisibleIndex+this._visibleItemsNum),this._firstRenderedIndex=this.normalizeIndex(this._firstVisibleIndex-2),this._lastRenderedIndex=this.normalizeIndex(this._lastVisibleIndex+2);for(let e of this._flattenedNodes.slice(this._firstRenderedIndex,this._lastRenderedIndex+1)){let t=_(e)&&this._nodeStates.get(e);if(t){if(t.lastLoadingChild){let s=t.parentNode;if(s){if(this.needsFurtherData(s)){this.requestData(s);break}}else if(this._loadedRootNodeCount<this.rootNodeCount&&!this._rootItemsLoading){this.requestData();break}}else if(this.needsFurtherData(t)){this.requestData(t);break}}}}else this._firstVisibleIndex=0,this._lastVisibleIndex=0,this._firstRenderedIndex=0,this._lastRenderedIndex=0}needsFurtherData(e){return e.expanded&&e.childCount>e.nodes.length&&this.nodeIndex(e.id)+e.nodes.length<this._lastRenderedIndex}nodeIndex(e){return this._flattenedNodes.findIndex(t=>t===e)}normalizeIndex(e){return Math.max(0,Math.min(e,this._allNodeCount-1))}get height(){return this.offsetHeight}requestData(e){if(!e?.loading){let t=e?.path;this.startLoadingIndicator(t),this.dispatchEvent(new CustomEvent("data-request",{detail:{path:t}}))}}updateAfterExpansion(e,t){let s=this._nodeStates.get(JSON.stringify(e));if(s){s.expanded=t;let i=q(this._flattenedNodes,e),o=this._flattenedNodes[this.focusIndex];if(t){let n=this.addSubtree(s,i+1),r=s.childCount>s.nodes.length,h=i+s.nodes.length<this._lastRenderedIndex;r&&h&&this.requestData(s),this._allNodeCount+=n}else{let n=this.removeSubtree(i);this._allNodeCount-=n}if(o){let n=this._flattenedNodes.findIndex(r=>r==o);n!==this.focusIndex&&(this._focusIndex=n)}}this.requestUpdate()}addSubtree(e,t){let s=this.getFlattenedSubtree(e.nodes);return this._flattenedNodes.splice(t,0,...s),s.length}getFlattenedSubtree(e){return e.reduce((t,s)=>t.concat(s&&s.childCount>0&&s.expanded?[JSON.stringify(s.path),...this.getFlattenedSubtree(s.nodes)]:JSON.stringify(s.path)),[])}removeSubtree(e){let t=this.getNextNonDescendantIndex(e),s=0;return t!==-1?(s=t-e-1,this._flattenedNodes.splice(e+1,s)):(s=this._flattenedNodes.length-e-1,this._flattenedNodes.splice(e+1)),s}getNextNonDescendantIndex(e){let t=this._flattenedNodes[e],s=_(t)&&this._nodeStates.get(t);if(s)for(let i=e+1;i<this._flattenedNodes.length;i++){let o=this._flattenedNodes[i],n=_(o)&&this._nodeStates.get(o);if(n&&n.path.length<=s.path.length)return i}return-1}get focusedNode(){let e=this._flattenedNodes[this.focusIndex];return _(e)&&this._nodeStates.get(e)}toggleSelection(e){this.nodeGetter(e).toggle(),this.requestUpdate()}updateFlattenedNodes(e,t){if(t){let s=q(this._flattenedNodes,t),i=this._flattenedNodes[s];if(_(i)){let o=this._nodeStates.get(i);if(o){let n=s+o.nodes.length+1,r=o.depth,h=st(e,1/0,r+1).map(this.getFlattenedNodeId);o.expanded&&this._flattenedNodes.splice(n,0,...h),o.nodes=[...o.nodes,...e],o.loading=!1,this.updateLastLoadingChild(o.nodes,h)}}}else{let s=st(e,1/0).map(this.getFlattenedNodeId);this.updateLastLoadingChild(this._flattenedNodes,s),this._flattenedNodes=[...this._flattenedNodes,...s]}}updateLastLoadingChild(e,t){let s=e[e.length-1],i=_(s)&&this._nodeStates.get(s),o=t[t.length-1],n=_(o)&&this._nodeStates.get(o);if(i&&(i.lastLoadingChild=!1),n){let r=n.parentNode;(r&&r.childCount>r.nodes.length||!r&&this.rootNodeCount>this._loadedRootNodeCount)&&(n.lastLoadingChild=!0)}}setLastLoadingChildren(e,t,s){if(s<t){let i=e[e.length-1];i&&(i.lastLoadingChild=!0)}e.forEach(i=>{this.setLastLoadingChildren(i.nodes,i.childCount,i.nodes.length)})}startLoadingIndicator(e){if(e){let t=this._nodeStates.get(JSON.stringify(e));if(t){let s=q(this._flattenedNodes,e);t.loading=!0,this.addPlaceholders(s,t)}}else this._rootItemsLoading=!0,this._flattenedNodes=[...this._flattenedNodes,...new Array(this.rootNodeCount-this._loadedRootNodeCount).fill({depth:0})];this.updateNodes()}addPlaceholders(e,t){let s=e+t.nodes.length+1,i=t.childCount-t.nodes.length;this._flattenedNodes.splice(s,0,...new Array(i).fill({depth:t.depth+1}))}stopLoadingIndicator(e){if(e){let t=this._nodeStates.get(JSON.stringify(e));if(t&&(t.loading=!1,t.expanded)){let s=q(this._flattenedNodes,e);this.removePlaceHolders(s,t)}}else{this._rootItemsLoading=!1;let t=this._flattenedNodes.findIndex(s=>!_(s));this._flattenedNodes.splice(t)}}removePlaceHolders(e,t){let s=e+t.nodes.length+1,i=t.childCount-t.nodes.length;this._flattenedNodes.splice(s,i)}syncState(){let e=[...this.children].map(t=>t.getState());this.addNodes(e),this.rootNodeCount=e.length,this.innerHTML=""}updateCount(e){this._allNodeCount=e.length+this.getNodeCount(e)}getNodeCount(e){let t=0;return e.forEach(s=>{s.expanded&&(t+=s.childCount+this.getNodeCount(s.nodes))}),t}},T.ID="sd-tree",T.ensureDefined=()=>{He.ensureDefined(),qe.ensureDefined(),customElements.get(T.ID)||customElements.define(T.ID,T)},T);ot([a({type:String})],j.prototype,"loadingText",2);ot([a({type:Boolean,reflect:!0,attribute:"parent-selection-allowed"})],j.prototype,"parentSelectionAllowed",2);ot([a({type:Boolean,reflect:!0,attribute:!0})],j.prototype,"readonly",2);ot([a({type:Number})],j.prototype,"rootNodeCount",1);ot([a({type:Number,attribute:"focus-index",reflect:!0})],j.prototype,"focusIndex",1);var se=j;se.ensureDefined();return de(Ge);})();
|
|
153
153
|
/*! Bundled license information:
|
|
154
154
|
|
|
155
155
|
@lit/reactive-element/css-tag.js:
|
|
@@ -160,20 +160,9 @@ var window;(window||={})["@cas-smartdesign/tree"]=(()=>{var ge=Object.defineProp
|
|
|
160
160
|
*)
|
|
161
161
|
|
|
162
162
|
@lit/reactive-element/reactive-element.js:
|
|
163
|
-
(**
|
|
164
|
-
* @license
|
|
165
|
-
* Copyright 2017 Google LLC
|
|
166
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
167
|
-
*)
|
|
168
|
-
|
|
169
163
|
lit-html/lit-html.js:
|
|
170
|
-
(**
|
|
171
|
-
* @license
|
|
172
|
-
* Copyright 2017 Google LLC
|
|
173
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
174
|
-
*)
|
|
175
|
-
|
|
176
164
|
lit-element/lit-element.js:
|
|
165
|
+
@lit/reactive-element/decorators/property.js:
|
|
177
166
|
(**
|
|
178
167
|
* @license
|
|
179
168
|
* Copyright 2017 Google LLC
|
|
@@ -187,13 +176,6 @@ lit-html/is-server.js:
|
|
|
187
176
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
188
177
|
*)
|
|
189
178
|
|
|
190
|
-
@lit/reactive-element/decorators/property.js:
|
|
191
|
-
(**
|
|
192
|
-
* @license
|
|
193
|
-
* Copyright 2017 Google LLC
|
|
194
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
195
|
-
*)
|
|
196
|
-
|
|
197
179
|
lit-html/directives/if-defined.js:
|
|
198
180
|
(**
|
|
199
181
|
* @license
|