@nuralyui/table 0.0.8 → 0.0.9

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.
Files changed (2) hide show
  1. package/bundle.js +8 -1031
  2. package/package.json +1 -1
package/bundle.js CHANGED
@@ -1,1061 +1,38 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- const t=window,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),n=new WeakMap;class s{constructor(t,e,n){if(this._$cssResult$=!0,n!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=n.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(i,t))}return t}toString(){return this.cssText}}const o=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new s("string"==typeof t?t:t+"",void 0,i))(e)})(t):t
7
- /**
8
- * @license
9
- * Copyright 2017 Google LLC
10
- * SPDX-License-Identifier: BSD-3-Clause
11
- */;var r;const a=window,l=a.trustedTypes,h=l?l.emptyScript:"",c=a.reactiveElementPolyfillSupport,d={toAttribute(t,e){switch(e){case Boolean:t=t?h:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},u=(t,e)=>e!==t&&(e==e||t==t),p={attribute:!0,type:String,converter:d,reflect:!1,hasChanged:u},f="finalized";class v extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=p){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const s=this[t];this[e]=n,this.requestUpdate(t,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||p}static finalize(){if(this.hasOwnProperty(f))return!1;this[f]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(o(t))}else void 0!==t&&e.push(o(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var i;const n=null!==(i=this.shadowRoot)&&void 0!==i?i:this.attachShadow(this.constructor.shadowRootOptions);return((i,n)=>{e?i.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((e=>{const n=document.createElement("style"),s=t.litNonce;void 0!==s&&n.setAttribute("nonce",s),n.textContent=e.cssText,i.appendChild(n)}))})(n,this.constructor.elementStyles),n}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=p){var n;const s=this.constructor._$Ep(t,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:d).toAttribute(e,i.type);this._$El=t,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,s=n._$Ev.get(t);if(void 0!==s&&this._$El!==s){const t=n.getPropertyOptions(s),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:d;this._$El=s,this[s]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||u)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}
12
- /**
13
- * @license
14
- * Copyright 2017 Google LLC
15
- * SPDX-License-Identifier: BSD-3-Clause
16
- */
17
- var g;v[f]=!0,v.elementProperties=new Map,v.elementStyles=[],v.shadowRootOptions={mode:"open"},null==c||c({ReactiveElement:v}),(null!==(r=a.reactiveElementVersions)&&void 0!==r?r:a.reactiveElementVersions=[]).push("1.6.3");const b=window,y=b.trustedTypes,m=y?y.createPolicy("lit-html",{createHTML:t=>t}):void 0,x="$lit$",w=`lit$${(Math.random()+"").slice(9)}$`,$="?"+w,k=`<${$}>`,S=document,C=()=>S.createComment(""),A=t=>null===t||"object"!=typeof t&&"function"!=typeof t,E=Array.isArray,_=t=>E(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),z="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,j=/>/g,F=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),I=/'/g,M=/"/g,T=/^(?:script|style|textarea|title)$/i,N=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),R=new WeakMap,D=S.createTreeWalker(S,129,null,!1);function V(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==m?m.createHTML(e):e}const L=(t,e)=>{const i=t.length-1,n=[];let s,o=2===e?"<svg>":"",r=P;for(let e=0;e<i;e++){const i=t[e];let a,l,h=-1,c=0;for(;c<i.length&&(r.lastIndex=c,l=r.exec(i),null!==l);)c=r.lastIndex,r===P?"!--"===l[1]?r=O:void 0!==l[1]?r=j:void 0!==l[2]?(T.test(l[2])&&(s=RegExp("</"+l[2],"g")),r=F):void 0!==l[3]&&(r=F):r===F?">"===l[0]?(r=null!=s?s:P,h=-1):void 0===l[1]?h=-2:(h=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?F:'"'===l[3]?M:I):r===M||r===I?r=F:r===O||r===j?r=P:(r=F,s=void 0);const d=r===F&&t[e+1].startsWith("/>")?" ":"";o+=r===P?i+k:h>=0?(n.push(a),i.slice(0,h)+x+i.slice(h)+w+d):i+w+(-2===h?(n.push(void 0),e):d)}return[V(t,o+(t[i]||"<?>")+(2===e?"</svg>":"")),n]};class J{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let s=0,o=0;const r=t.length-1,a=this.parts,[l,h]=L(t,e);if(this.el=J.createElement(l,i),D.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=D.nextNode())&&a.length<r;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const e of n.getAttributeNames())if(e.endsWith(x)||e.startsWith(w)){const i=h[o++];if(t.push(e),void 0!==i){const t=n.getAttribute(i.toLowerCase()+x).split(w),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:s,name:e[2],strings:t,ctor:"."===e[1]?W:"?"===e[1]?Y:"@"===e[1]?G:K})}else a.push({type:6,index:s})}for(const e of t)n.removeAttribute(e)}if(T.test(n.tagName)){const t=n.textContent.split(w),e=t.length-1;if(e>0){n.textContent=y?y.emptyScript:"";for(let i=0;i<e;i++)n.append(t[i],C()),D.nextNode(),a.push({type:2,index:++s});n.append(t[e],C())}}}else if(8===n.nodeType)if(n.data===$)a.push({type:2,index:s});else{let t=-1;for(;-1!==(t=n.data.indexOf(w,t+1));)a.push({type:7,index:s}),t+=w.length-1}s++}}static createElement(t,e){const i=S.createElement("template");return i.innerHTML=t,i}}function q(t,e,i=t,n){var s,o,r,a;if(e===N)return e;let l=void 0!==n?null===(s=i._$Co)||void 0===s?void 0:s[n]:i._$Cl;const h=A(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==h&&(null===(o=null==l?void 0:l._$AO)||void 0===o||o.call(l,!1),void 0===h?l=void 0:(l=new h(t),l._$AT(t,i,n)),void 0!==n?(null!==(r=(a=i)._$Co)&&void 0!==r?r:a._$Co=[])[n]=l:i._$Cl=l),void 0!==l&&(e=q(t,l._$AS(t,e.values),l,n)),e}class B{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:n}=this._$AD,s=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:S).importNode(i,!0);D.currentNode=s;let o=D.nextNode(),r=0,a=0,l=n[0];for(;void 0!==l;){if(r===l.index){let e;2===l.type?e=new H(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new Q(o,this,t)),this._$AV.push(e),l=n[++a]}r!==(null==l?void 0:l.index)&&(o=D.nextNode(),r++)}return D.currentNode=S,s}v(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class H{constructor(t,e,i,n){var s;this.type=2,this._$AH=U,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cp=null===(s=null==n?void 0:n.isConnected)||void 0===s||s}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=q(this,t,e),A(t)?t===U||null==t||""===t?(this._$AH!==U&&this._$AR(),this._$AH=U):t!==this._$AH&&t!==N&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):_(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==U&&A(this._$AH)?this._$AA.nextSibling.data=t:this.$(S.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:n}=t,s="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=J.createElement(V(n.h,n.h[0]),this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===s)this._$AH.v(i);else{const t=new B(s,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=R.get(t.strings);return void 0===e&&R.set(t.strings,e=new J(t)),e}T(t){E(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const s of t)n===e.length?e.push(i=new H(this.k(C()),this.k(C()),this,this.options)):i=e[n],i._$AI(s),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class K{constructor(t,e,i,n,s){this.type=1,this._$AH=U,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=U}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const s=this.strings;let o=!1;if(void 0===s)t=q(this,t,e,0),o=!A(t)||t!==this._$AH&&t!==N,o&&(this._$AH=t);else{const n=t;let r,a;for(t=s[0],r=0;r<s.length-1;r++)a=q(this,n[i+r],e,r),a===N&&(a=this._$AH[r]),o||(o=!A(a)||a!==this._$AH[r]),a===U?t=U:t!==U&&(t+=(null!=a?a:"")+s[r+1]),this._$AH[r]=a}o&&!n&&this.j(t)}j(t){t===U?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class W extends K{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===U?void 0:t}}const Z=y?y.emptyScript:"";class Y extends K{constructor(){super(...arguments),this.type=4}j(t){t&&t!==U?this.element.setAttribute(this.name,Z):this.element.removeAttribute(this.name)}}class G extends K{constructor(t,e,i,n,s){super(t,e,i,n,s),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=q(this,t,e,0))&&void 0!==i?i:U)===N)return;const n=this._$AH,s=t===U&&n!==U||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==U&&(n===U||s);s&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class Q{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){q(this,t)}}const X={O:x,P:w,A:$,C:1,M:L,L:B,R:_,D:q,I:H,V:K,H:Y,N:G,U:W,F:Q},tt=b.litHtmlPolyfillSupport;
18
- /**
19
- * @license
20
- * Copyright 2017 Google LLC
21
- * SPDX-License-Identifier: BSD-3-Clause
22
- */
23
- var et;null==tt||tt(J,H),(null!==(g=b.litHtmlVersions)&&void 0!==g?g:b.litHtmlVersions=[]).push("2.8.0");const it=window,nt=it.trustedTypes,st=nt?nt.createPolicy("lit-html",{createHTML:t=>t}):void 0,ot="$lit$",rt=`lit$${(Math.random()+"").slice(9)}$`,at="?"+rt,lt=`<${at}>`,ht=document,ct=()=>ht.createComment(""),dt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,ut=Array.isArray,pt="[ \t\n\f\r]",ft=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,vt=/-->/g,gt=/>/g,bt=RegExp(`>|${pt}(?:([^\\s"'>=/]+)(${pt}*=${pt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),yt=/'/g,mt=/"/g,xt=/^(?:script|style|textarea|title)$/i,wt=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),$t=Symbol.for("lit-noChange"),kt=Symbol.for("lit-nothing"),St=new WeakMap,Ct=ht.createTreeWalker(ht,129,null,!1);function At(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==st?st.createHTML(e):e}const Et=(t,e)=>{const i=t.length-1,n=[];let s,o=2===e?"<svg>":"",r=ft;for(let e=0;e<i;e++){const i=t[e];let a,l,h=-1,c=0;for(;c<i.length&&(r.lastIndex=c,l=r.exec(i),null!==l);)c=r.lastIndex,r===ft?"!--"===l[1]?r=vt:void 0!==l[1]?r=gt:void 0!==l[2]?(xt.test(l[2])&&(s=RegExp("</"+l[2],"g")),r=bt):void 0!==l[3]&&(r=bt):r===bt?">"===l[0]?(r=null!=s?s:ft,h=-1):void 0===l[1]?h=-2:(h=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?bt:'"'===l[3]?mt:yt):r===mt||r===yt?r=bt:r===vt||r===gt?r=ft:(r=bt,s=void 0);const d=r===bt&&t[e+1].startsWith("/>")?" ":"";o+=r===ft?i+lt:h>=0?(n.push(a),i.slice(0,h)+ot+i.slice(h)+rt+d):i+rt+(-2===h?(n.push(void 0),e):d)}return[At(t,o+(t[i]||"<?>")+(2===e?"</svg>":"")),n]};class _t{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let s=0,o=0;const r=t.length-1,a=this.parts,[l,h]=Et(t,e);if(this.el=_t.createElement(l,i),Ct.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=Ct.nextNode())&&a.length<r;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const e of n.getAttributeNames())if(e.endsWith(ot)||e.startsWith(rt)){const i=h[o++];if(t.push(e),void 0!==i){const t=n.getAttribute(i.toLowerCase()+ot).split(rt),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:s,name:e[2],strings:t,ctor:"."===e[1]?Ft:"?"===e[1]?Mt:"@"===e[1]?Tt:jt})}else a.push({type:6,index:s})}for(const e of t)n.removeAttribute(e)}if(xt.test(n.tagName)){const t=n.textContent.split(rt),e=t.length-1;if(e>0){n.textContent=nt?nt.emptyScript:"";for(let i=0;i<e;i++)n.append(t[i],ct()),Ct.nextNode(),a.push({type:2,index:++s});n.append(t[e],ct())}}}else if(8===n.nodeType)if(n.data===at)a.push({type:2,index:s});else{let t=-1;for(;-1!==(t=n.data.indexOf(rt,t+1));)a.push({type:7,index:s}),t+=rt.length-1}s++}}static createElement(t,e){const i=ht.createElement("template");return i.innerHTML=t,i}}function zt(t,e,i=t,n){var s,o,r,a;if(e===$t)return e;let l=void 0!==n?null===(s=i._$Co)||void 0===s?void 0:s[n]:i._$Cl;const h=dt(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==h&&(null===(o=null==l?void 0:l._$AO)||void 0===o||o.call(l,!1),void 0===h?l=void 0:(l=new h(t),l._$AT(t,i,n)),void 0!==n?(null!==(r=(a=i)._$Co)&&void 0!==r?r:a._$Co=[])[n]=l:i._$Cl=l),void 0!==l&&(e=zt(t,l._$AS(t,e.values),l,n)),e}class Pt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:n}=this._$AD,s=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:ht).importNode(i,!0);Ct.currentNode=s;let o=Ct.nextNode(),r=0,a=0,l=n[0];for(;void 0!==l;){if(r===l.index){let e;2===l.type?e=new Ot(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new Nt(o,this,t)),this._$AV.push(e),l=n[++a]}r!==(null==l?void 0:l.index)&&(o=Ct.nextNode(),r++)}return Ct.currentNode=ht,s}v(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class Ot{constructor(t,e,i,n){var s;this.type=2,this._$AH=kt,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cp=null===(s=null==n?void 0:n.isConnected)||void 0===s||s}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=zt(this,t,e),dt(t)?t===kt||null==t||""===t?(this._$AH!==kt&&this._$AR(),this._$AH=kt):t!==this._$AH&&t!==$t&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>ut(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==kt&&dt(this._$AH)?this._$AA.nextSibling.data=t:this.$(ht.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:n}=t,s="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=_t.createElement(At(n.h,n.h[0]),this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===s)this._$AH.v(i);else{const t=new Pt(s,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=St.get(t.strings);return void 0===e&&St.set(t.strings,e=new _t(t)),e}T(t){ut(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const s of t)n===e.length?e.push(i=new Ot(this.k(ct()),this.k(ct()),this,this.options)):i=e[n],i._$AI(s),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class jt{constructor(t,e,i,n,s){this.type=1,this._$AH=kt,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=kt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const s=this.strings;let o=!1;if(void 0===s)t=zt(this,t,e,0),o=!dt(t)||t!==this._$AH&&t!==$t,o&&(this._$AH=t);else{const n=t;let r,a;for(t=s[0],r=0;r<s.length-1;r++)a=zt(this,n[i+r],e,r),a===$t&&(a=this._$AH[r]),o||(o=!dt(a)||a!==this._$AH[r]),a===kt?t=kt:t!==kt&&(t+=(null!=a?a:"")+s[r+1]),this._$AH[r]=a}o&&!n&&this.j(t)}j(t){t===kt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Ft extends jt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===kt?void 0:t}}const It=nt?nt.emptyScript:"";class Mt extends jt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==kt?this.element.setAttribute(this.name,It):this.element.removeAttribute(this.name)}}class Tt extends jt{constructor(t,e,i,n,s){super(t,e,i,n,s),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=zt(this,t,e,0))&&void 0!==i?i:kt)===$t)return;const n=this._$AH,s=t===kt&&n!==kt||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==kt&&(n===kt||s);s&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class Nt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){zt(this,t)}}const Ut=it.litHtmlPolyfillSupport;null==Ut||Ut(_t,Ot),(null!==(et=it.litHtmlVersions)&&void 0!==et?et:it.litHtmlVersions=[]).push("2.8.0");
24
- /**
25
- * @license
26
- * Copyright 2017 Google LLC
27
- * SPDX-License-Identifier: BSD-3-Clause
28
- */
29
- var Rt,Dt;class Vt extends v{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{var n,s;const o=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let r=o._$litPart$;if(void 0===r){const t=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:null;o._$litPart$=r=new Ot(e.insertBefore(ct(),t),t,void 0,null!=i?i:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return $t}}Vt.finalized=!0,Vt._$litElement$=!0,null===(Rt=globalThis.litElementHydrateSupport)||void 0===Rt||Rt.call(globalThis,{LitElement:Vt});const Lt=globalThis.litElementPolyfillSupport;null==Lt||Lt({LitElement:Vt}),(null!==(Dt=globalThis.litElementVersions)&&void 0!==Dt?Dt:globalThis.litElementVersions=[]).push("3.3.3");
30
- /**
31
- * @license
32
- * Copyright 2017 Google LLC
33
- * SPDX-License-Identifier: BSD-3-Clause
34
- */
35
- const Jt=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}},qt=(t,e,i)=>{e.constructor.createProperty(i,t)};
36
- /**
37
- * @license
38
- * Copyright 2017 Google LLC
39
- * SPDX-License-Identifier: BSD-3-Clause
40
- */function Bt(t){return(e,i)=>void 0!==i?qt(t,e,i):Jt(t,e)
41
- /**
42
- * @license
43
- * Copyright 2017 Google LLC
44
- * SPDX-License-Identifier: BSD-3-Clause
45
- */}function Ht(t){return Bt({...t,state:!0})}
46
- /**
47
- * @license
48
- * Copyright 2017 Google LLC
49
- * SPDX-License-Identifier: BSD-3-Clause
50
- */
51
- /**
52
- * @license
53
- * Copyright 2021 Google LLC
54
- * SPDX-License-Identifier: BSD-3-Clause
55
- */
56
- var Kt;null===(Kt=window.HTMLSlotElement)||void 0===Kt||Kt.prototype.assignedElements;
1
+ import{css as t,html as e,nothing as i,LitElement as n}from"lit";import{property as r,state as a,query as o,customElement as l}from"lit/decorators.js";import{NuralyUIBaseMixin as s}from"@nuralyui/common/mixins";import{repeat as c}from"lit/directives/repeat.js";import{choose as d}from"lit/directives/choose.js";var h=t`:host{display:block;width:100%;font-family:var(--nuraly-font-family,Arial,sans-serif);color:var(--nuraly-color-text);background-color:var(--nuraly-color-background)}.filter-container{display:flex;justify-content:flex-end;width:100%;padding:var(--nuraly-spacing-2,.5rem) 0;position:relative;margin-bottom:5px}.filter-container input{padding:5px;padding-left:30px;width:100%;box-sizing:border-box;background-color:var(--nuraly-table-filter-background,#fff);color:var(--nuraly-table-filter-text,#000)}.filter-container input:focus{outline-style:none;border:1px solid var(--nuraly-table-filter-border,#1890ff)}.filter-container .icon-container{height:25px;width:35px;cursor:pointer;display:flex;justify-content:center;align-items:center}.filter-container .search-icon{position:absolute;left:10px;top:25%}.actions-container{background-color:var(--nuraly-table-action-color,#0f62fe);padding:10px;box-sizing:border-box;display:flex;justify-content:space-between;color:var(--nuraly-table-background,#fff)}.table-content-wrapper.fixed-header{overflow-y:auto;overflow-x:auto}.table-content-wrapper.fixed-header table{border-collapse:separate;border-spacing:0}.table-content-wrapper.fixed-header thead{background-color:var(--nuraly-table-header-background,#fafafa)}.table-content-wrapper.fixed-header thead th{position:sticky;top:0;z-index:10;background-color:var(--nuraly-table-header-background,#fafafa);border-bottom:var(--nuraly-table-border-width,1px) solid var(--nuraly-table-row-border-color,#f0f0f0)}.table-content-wrapper.fixed-header thead tr{box-shadow:0 1px 0 0 var(--nuraly-table-row-border-color,#f0f0f0)}.actions-container button{cursor:pointer;border:none;color:var(--nuraly-table-background,#fff);background-color:var(--nuraly-table-action-color,#0f62fe)}.actions-container[data-size=small]{padding:5px}.actions-container[data-size=large]{padding:15px}.table-content-wrapper{display:block;overflow:auto}input[type=checkbox][data-indeterminate=true]::after{width:13px;height:13px;background-color:var(--nuraly-table-checkbox-checked,#161616);color:var(--nuraly-table-background,#fff);display:flex;justify-content:center;align-items:center;content:'-'}table{width:100%;border-spacing:0;color:var(--nuraly-table-text-color)}td{text-align:center;border-bottom:var(--nuraly-table-border-width,1px) solid var(--nuraly-table-row-border-color,#f0f0f0);padding:10px}th{cursor:pointer;padding:10px}th span{display:flex;justify-content:center;gap:10px}nr-icon{display:flex;justify-content:center;align-items:center;--nuraly-icon-color:var(--nuraly-table-text-color)}tbody tr{background-color:var(--nuraly-table-row-background,#fff)}tbody tr:hover{background-color:var(--nuraly-table-row-hover-background,#f5f5f5)}thead tr{background-color:var(--nuraly-table-header-background,#fafafa)}tbody tr:has(input:checked){background-color:var(--nuraly-table-row-selected-background,#e6f7ff)}.expand-icon,input{cursor:pointer;accent-color:var(--nuraly-table-checkbox-checked,#1890ff)}:host([size=small]) td,:host([size=small]) th{padding:5px}:host([size=large]) td,:host([size=large]) th{padding:15px}.pagination-container{display:flex;justify-content:space-between;align-items:center;background-color:var(--nuraly-pagination-background-color);color:var(--nuraly-pagination-text-color)}.pagination-container .left-content{display:flex;align-items:center}.pagination-container .left-content .items-details{border-left:var(--nuraly-pagination-borders);padding:10px}.pagination-container .left-content .select-details{display:flex;align-items:center;gap:8px;padding:10px}.pagination-container .left-content .select-details label{font-size:var(--nuraly-font-size-input,14px);color:var(--nuraly-table-pagination-text,#000);white-space:nowrap}.pagination-container .left-content .select-details nr-select{min-width:60px;max-width:80px;--select-border-color:var(--nuraly-table-border-color, #d9d9d9);--select-background:var(--nuraly-table-pagination-background, #fafafa);--select-text-color:var(--nuraly-table-pagination-text, #000000)}.pagination-container .right-content{display:flex;align-items:center;border-left:var(--nuraly-pagination-borders)}.pagination-container .right-content .icon-container{display:flex;align-items:center;border-left:var(--nuraly-pagination-borders)}.pagination-container .right-content .page-details{padding:10px}.pagination-container .icon-container .left-arrow,.pagination-container .icon-container .right-arrow{padding:10px;--nuraly-icon-color:var(--nuraly-pagination-text-color)}.pagination-container .icon-container .left-arrow{border-right:var(--nuraly-pagination-borders)}.pagination-container nr-icon[data-enabled=false]{cursor:not-allowed}.pagination-container nr-icon[data-enabled=true]{cursor:pointer}.pagination-container[data-size=small] .left-content .items-details{padding:5px}.pagination-container[data-size=large] .left-content .items-details{padding:15px}.pagination-container[data-size=small] .left-content .select-details{padding:5px;gap:6px}.pagination-container[data-size=large] .left-content .select-details{padding:15px;gap:10px}.pagination-container[data-size=small] .right-content .page-details{padding:5px}.pagination-container[data-size=large] .right-content .page-details{padding:15px}.pagination-container[data-size=small] .icon-container .left-arrow,.pagination-container[data-size=small] .icon-container .right-arrow{padding:5px}.pagination-container[data-size=large] .icon-container .left-arrow,.pagination-container[data-size=large] .icon-container .right-arrow{padding:15px}th .th-content{display:flex;align-items:center;justify-content:space-between;gap:8px;position:relative}th .th-text{display:flex;align-items:center;gap:10px;flex:1}th .filter-wrapper{position:relative;display:flex;align-items:center}.filter-trigger{background:0 0;border:none;cursor:pointer;padding:4px;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:background-color .2s}.filter-trigger:hover{background-color:var(--nuraly-table-filter-hover,rgba(0,0,0,.04))}.filter-icon{position:relative;display:flex;align-items:center;justify-content:center}.filter-icon.has-filter{color:var(--nuraly-table-filter-active,#1890ff)}.filter-indicator{position:absolute;top:-2px;right:-2px;width:6px;height:6px;border-radius:50%;background-color:var(--nuraly-table-filter-active,#1890ff)}.column-filter-dropdown{position:absolute;top:calc(100% + 4px);right:0;background:var(--nuraly-table-background,#fff);border:1px solid var(--nuraly-table-row-border-color,#f0f0f0);border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);z-index:100;min-width:200px;padding:8px}.column-filter-content{display:flex;flex-direction:column;gap:8px}.column-filter-input{padding:8px;border:1px solid var(--nuraly-table-row-border-color,#d9d9d9);border-radius:4px;font-size:14px;width:100%;box-sizing:border-box}.column-filter-input:focus{outline:0;border-color:var(--nuraly-table-filter-active,#1890ff);box-shadow:0 0 0 2px rgba(24,144,255,.2)}.column-filter-clear{background:0 0;border:none;cursor:pointer;padding:4px;display:flex;align-items:center;justify-content:center;color:var(--nuraly-table-text-color,#000);align-self:flex-end}.column-filter-clear:hover{color:var(--nuraly-table-filter-active,#1890ff)}td.fixed-column,th.fixed-column{position:sticky;background-color:var(--nuraly-table-row-background,#fff)}thead th.fixed-column{z-index:20;background-color:var(--nuraly-table-header-background,#fafafa)}.table-content-wrapper.fixed-header thead th.fixed-column{z-index:25;background-color:var(--nuraly-table-header-background,#fafafa)}tbody td.fixed-column{z-index:8;background-color:var(--nuraly-table-row-background,#fff)}tbody tr td.fixed-column{background-color:var(--nuraly-table-row-background,#fff)}tbody tr:hover td.fixed-column{background-color:var(--nuraly-table-row-hover-background,#f5f5f5)}td.fixed-column-left,th.fixed-column-left{left:0;border-right:1px solid var(--nuraly-table-row-border-color,#f0f0f0)}td.fixed-column-right,th.fixed-column-right{right:0;border-left:1px solid var(--nuraly-table-row-border-color,#f0f0f0)}td.fixed-column-left::after,th.fixed-column-left::after{content:'';position:absolute;top:0;right:-10px;bottom:0;width:10px;pointer-events:none;transition:box-shadow .3s;box-shadow:none}.table-content-wrapper.has-scroll td.fixed-column-left::after,.table-content-wrapper.has-scroll th.fixed-column-left::after{box-shadow:inset -10px 0 8px -8px rgba(0,0,0,.15)}td.fixed-column-right::before,th.fixed-column-right::before{content:'';position:absolute;top:0;left:-10px;bottom:0;width:10px;pointer-events:none;transition:box-shadow .3s;box-shadow:none}.table-content-wrapper.has-scroll td.fixed-column-right::before,.table-content-wrapper.has-scroll th.fixed-column-right::before{box-shadow:inset 10px 0 8px -8px rgba(0,0,0,.15)}.skeleton-row{animation:skeleton-pulse 1.5s ease-in-out infinite}.skeleton-cell{padding:var(--nuraly-spacing-3,.75rem) var(--nuraly-spacing-4,1rem);border-bottom:1px solid var(--nuraly-table-border-color,#f0f0f0)}.skeleton-cell.selection-skeleton{width:48px;text-align:center}.skeleton-checkbox{width:16px;height:16px;background:linear-gradient(90deg,#f0f0f0 25%,#e0e0e0 50%,#f0f0f0 75%);background-size:200% 100%;animation:skeleton-shimmer 1.5s ease-in-out infinite;border-radius:2px;margin:0 auto}.skeleton-content{height:16px;background:linear-gradient(90deg,#f0f0f0 25%,#e0e0e0 50%,#f0f0f0 75%);background-size:200% 100%;animation:skeleton-shimmer 1.5s ease-in-out infinite;border-radius:4px;width:80%}@keyframes skeleton-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}@keyframes skeleton-pulse{0%,100%{opacity:1}50%{opacity:.6}}.loading-row{background-color:var(--nuraly-table-row-background,#fff)}.loading-cell{padding:var(--nuraly-spacing-8,2rem) var(--nuraly-spacing-4,1rem);text-align:center;border-bottom:1px solid var(--nuraly-table-border-color,#f0f0f0)}.loading-spinner-container{display:flex;flex-direction:column;align-items:center;gap:var(--nuraly-spacing-4,1rem)}.loading-spinner{width:40px;height:40px;border:4px solid var(--nuraly-table-border-color,#f0f0f0);border-top-color:var(--nuraly-color-primary,#1890ff);border-radius:50%;animation:spinner-rotate .8s linear infinite}@keyframes spinner-rotate{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.loading-text{margin:0;color:var(--nuraly-color-text-secondary,#666);font-size:14px}.empty-row{background:var(--nuraly-table-row-bg-color,#fff)}.empty-row:hover{background:var(--nuraly-table-row-bg-color,#fff)}.empty-cell{padding:64px 24px;text-align:center;border-bottom:1px solid var(--nuraly-table-border-color,#f0f0f0)}.empty-state{display:flex;flex-direction:column;align-items:center;gap:16px}.empty-icon{width:64px;height:64px;color:var(--nuraly-color-text-quaternary,#bfbfbf);display:flex;align-items:center;justify-content:center}.empty-icon svg{width:100%;height:100%}.empty-icon nr-icon{font-size:64px}.empty-text{margin:0;color:var(--nuraly-color-text-secondary,#666);font-size:14px;line-height:1.5}.expand-icon{text-align:center;vertical-align:middle;transition:transform .3s ease;outline:0}.expand-icon:hover{background-color:var(--nuraly-color-fill-tertiary,#f5f5f5)}.expand-icon:focus{background-color:var(--nuraly-color-fill-tertiary,#f5f5f5);box-shadow:inset 0 0 0 2px var(--nuraly-color-primary,#1890ff)}.expand-icon nr-icon{transition:transform .3s ease}.expand-icon.expanded nr-icon{transform:rotate(180deg)}.expansion-row{transition:all .3s ease}.expansion-row.collapsed{opacity:0;height:0;overflow:hidden}.expansion-row.expanded{opacity:1;animation:slideDown .3s ease}.expansion-content{padding:16px;background-color:var(--nuraly-color-fill-quaternary,#fafafa);border-top:1px solid var(--nuraly-color-border,#d9d9d9)}@keyframes slideDown{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}`;
57
2
  /**
58
3
  * @license
59
4
  * Copyright 2023 Nuraly, Laabidi Aymen
60
5
  * SPDX-License-Identifier: MIT
61
6
  */
62
- const Wt=t=>class extends t{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var t,e,i;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(e=this.designSystemObserver)||void 0===e||e.disconnect(),null===(i=this.mediaQuery)||void 0===i||i.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,e;const i=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return i||((null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const e=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===e?e:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver((()=>{this.requestUpdate()})),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver((()=>{this.requestUpdate()})),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}},Zt=()=>{var t;return void 0!==globalThis.litElementVersions||"undefined"!=typeof process&&"development"===(null===(t=process.env)||void 0===t?void 0:t.NODE_ENV)||"undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)},Yt=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(Zt())for(const t of this.requiredComponents)if(!this.isComponentAvailable(t))throw new Error(`Required component "${t}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}. Example: import '@nuralyui/${t}';`)}validateDependenciesWithHandler(t){if(!Zt())return!0;let e=!0;for(const i of this.requiredComponents)if(!this.isComponentAvailable(i)){e=!1;const n=new Error(`Required component "${i}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(i,n):console.error(n.message)}return e}isComponentAvailable(t){return!!customElements.get(t)}getMissingDependencies(){return this.requiredComponents.filter((t=>!this.isComponentAvailable(t)))}areDependenciesAvailable(){return this.requiredComponents.every((t=>this.isComponentAvailable(t)))}addRequiredComponent(t){this.requiredComponents.includes(t)||this.requiredComponents.push(t)}removeRequiredComponent(t){const e=this.requiredComponents.indexOf(t);e>-1&&this.requiredComponents.splice(e,1)}},Gt=t=>class extends t{dispatchCustomEvent(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,e){var i;const n=Object.assign(Object.assign({},e),{timestamp:Date.now(),componentName:(null===(i=this.tagName)||void 0===i?void 0:i.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,n)}dispatchInputEvent(t,e){const i=Object.assign({target:e.target||this,value:e.value,originalEvent:e.originalEvent},e);this.dispatchCustomEvent(t,i)}dispatchFocusEvent(t,e){const i=Object.assign({target:e.target||this,value:e.value,focused:e.focused,cursorPosition:e.cursorPosition,selectedText:e.selectedText},e);this.dispatchCustomEvent(t,i)}dispatchValidationEvent(t,e){var i;const n=Object.assign({target:e.target||this,value:e.value,isValid:null!==(i=e.isValid)&&void 0!==i&&i,error:e.error},e);this.dispatchCustomEvent(t,n)}dispatchActionEvent(t,e){const i=Object.assign({target:e.target||this,action:e.action,previousValue:e.previousValue,newValue:e.newValue},e);this.dispatchCustomEvent(t,i)}isReadonlyKeyAllowed(t){if(t.ctrlKey||t.metaKey){return["KeyA","KeyC"].includes(t.code)}return["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)}isActivationKey(t){return"Enter"===t.key||" "===t.key}};
7
+ class p{constructor(t){this._host=t,this._host.addController(this)}get host(){return this._host}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}handleError(t,e){console.error(`[TableController:${this.constructor.name}] Error in ${e}:`,t),this._host.dispatchEvent(new CustomEvent("nr-table-error",{detail:{error:t.message,context:e,controller:this.constructor.name},bubbles:!0,composed:!0}))}requestUpdate(){try{this._host.requestUpdate()}catch(t){this.handleError(t,"requestUpdate")}}dispatchEvent(t){try{return this._host.dispatchEvent(t)}catch(t){return this.handleError(t,"dispatchEvent"),!1}}}
63
8
  /**
64
9
  * @license
65
10
  * Copyright 2023 Nuraly, Laabidi Aymen
66
11
  * SPDX-License-Identifier: MIT
67
- */var Qt=((t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,i,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[n+1]),t[0]);return new s(n,t,i)})`
68
- :host {
69
- display: block;
70
- width: 100%;
71
- font-family: var(--nuraly-font-family, Arial, sans-serif);
72
- color: var(--nuraly-color-text);
73
- background-color: var(--nuraly-color-background);
74
- }
75
-
76
- /* Filter Container Styles */
77
- .filter-container {
78
- display: flex;
79
- justify-content: flex-end;
80
- width: 100%;
81
- padding: var(--nuraly-spacing-2, 0.5rem) 0;
82
- position: relative;
83
- margin-bottom: 5px;
84
- }
85
-
86
- .filter-container input {
87
- padding: 5px;
88
- padding-left: 30px;
89
- width: 100%;
90
- box-sizing: border-box;
91
- background-color: var(--nuraly-table-filter-background, #ffffff);
92
- color: var(--nuraly-table-filter-text, #000000);
93
- }
94
-
95
- .filter-container input:focus {
96
- outline-style: none;
97
- border: 1px solid var(--nuraly-table-filter-border, #1890ff);
98
- }
99
-
100
- .filter-container .icon-container {
101
- height: 25px;
102
- width: 35px;
103
- cursor: pointer;
104
- display: flex;
105
- justify-content: center;
106
- align-items: center;
107
- }
108
-
109
- .filter-container .search-icon {
110
- position: absolute;
111
- left: 10px;
112
- top: 25%;
113
- }
114
-
115
- /* Actions Bar Styles */
116
- .actions-container {
117
- background-color: var(--nuraly-table-action-color, #0f62fe);
118
- padding: 10px;
119
- box-sizing: border-box;
120
- display: flex;
121
- justify-content: space-between;
122
- color: var(--nuraly-table-background, #ffffff);
123
- }
124
-
125
- /* Fixed Header Styles */
126
- .table-content-wrapper.fixed-header {
127
- overflow-y: auto;
128
- overflow-x: auto;
129
- }
130
-
131
- .table-content-wrapper.fixed-header table {
132
- border-collapse: separate;
133
- border-spacing: 0;
134
- }
135
-
136
- .table-content-wrapper.fixed-header thead {
137
- background-color: var(--nuraly-table-header-background, #fafafa);
138
- }
139
-
140
- .table-content-wrapper.fixed-header thead th {
141
- position: sticky;
142
- top: 0;
143
- z-index: 10;
144
- background-color: var(--nuraly-table-header-background, #fafafa);
145
- border-bottom: var(--nuraly-table-border-width, 1px) solid var(--nuraly-table-row-border-color, #f0f0f0);
146
- }
147
-
148
- .table-content-wrapper.fixed-header thead tr {
149
- box-shadow: 0 1px 0 0 var(--nuraly-table-row-border-color, #f0f0f0);
150
- }
151
-
152
- .actions-container button {
153
- cursor: pointer;
154
- border: none;
155
- color: var(--nuraly-table-background, #ffffff);
156
- background-color: var(--nuraly-table-action-color, #0f62fe);
157
- }
158
-
159
- .actions-container[data-size='small'] {
160
- padding: 5px;
161
- }
162
-
163
- .actions-container[data-size='large'] {
164
- padding: 15px;
165
- }
166
-
167
- /* Table Content Wrapper Styles */
168
- .table-content-wrapper {
169
- display: block;
170
- overflow: auto;
171
- }
172
-
173
- input[type='checkbox'][data-indeterminate='true']::after {
174
- width: 13px;
175
- height: 13px;
176
- background-color: var(--nuraly-table-checkbox-checked, #161616);
177
- color: var(--nuraly-table-background, #ffffff);
178
- display: flex;
179
- justify-content: center;
180
- align-items: center;
181
- content: '-';
182
- }
183
-
184
- /* Table Styles */
185
- table {
186
- width: 100%;
187
- border-spacing: 0px;
188
- color: var(--nuraly-table-text-color);
189
- }
190
-
191
- td {
192
- text-align: center;
193
- border-bottom: var(--nuraly-table-border-width, 1px) solid var(--nuraly-table-row-border-color, #f0f0f0);
194
- padding: 10px;
195
- }
196
-
197
- th {
198
- cursor: pointer;
199
- padding: 10px;
200
- }
201
-
202
- th span {
203
- display: flex;
204
- justify-content: center;
205
- gap: 10px;
206
- }
207
-
208
- nr-icon {
209
- display: flex;
210
- justify-content: center;
211
- align-items: center;
212
- --nuraly-icon-color: var(--nuraly-table-text-color);
213
- }
214
-
215
- tbody tr {
216
- background-color: var(--nuraly-table-row-background, #ffffff);
217
- }
218
-
219
- tbody tr:hover {
220
- background-color: var(--nuraly-table-row-hover-background, #f5f5f5);
221
- }
222
-
223
- thead tr {
224
- background-color: var(--nuraly-table-header-background, #fafafa);
225
- }
226
-
227
- tbody tr:has(input:checked) {
228
- background-color: var(--nuraly-table-row-selected-background, #e6f7ff);
229
- }
230
-
231
- input,
232
- .expand-icon {
233
- cursor: pointer;
234
- accent-color: var(--nuraly-table-checkbox-checked, #1890ff);
235
- }
236
-
237
- /* Size Variants for Table Content */
238
- :host([size='small']) td,
239
- :host([size='small']) th {
240
- padding: 5px;
241
- }
242
-
243
- :host([size='large']) td,
244
- :host([size='large']) th {
245
- padding: 15px;
246
- }
247
-
248
- /* Pagination Styles */
249
- .pagination-container {
250
- display: flex;
251
- justify-content: space-between;
252
- align-items: center;
253
- background-color: var(--nuraly-pagination-background-color);
254
- color: var(--nuraly-pagination-text-color);
255
- }
256
-
257
- .pagination-container .left-content {
258
- display: flex;
259
- align-items: center;
260
- }
261
-
262
- .pagination-container .left-content .items-details {
263
- border-left: var(--nuraly-pagination-borders);
264
- padding: 10px;
265
- }
266
-
267
- .pagination-container .left-content .select-details {
268
- display: flex;
269
- align-items: center;
270
- gap: 8px;
271
- padding: 10px;
272
- }
273
-
274
- .pagination-container .left-content .select-details label {
275
- font-size: var(--nuraly-font-size-input, 14px);
276
- color: var(--nuraly-table-pagination-text, #000000);
277
- white-space: nowrap;
278
- }
279
-
280
- .pagination-container .left-content .select-details nr-select {
281
- min-width: 60px;
282
- max-width: 80px;
283
- --select-border-color: var(--nuraly-table-border-color, #d9d9d9);
284
- --select-background: var(--nuraly-table-pagination-background, #fafafa);
285
- --select-text-color: var(--nuraly-table-pagination-text, #000000);
286
- }
287
-
288
- .pagination-container .right-content {
289
- display: flex;
290
- align-items: center;
291
- border-left: var(--nuraly-pagination-borders);
292
- }
293
-
294
- .pagination-container .right-content .icon-container {
295
- display: flex;
296
- align-items: center;
297
- border-left: var(--nuraly-pagination-borders);
298
- }
299
-
300
- .pagination-container .right-content .page-details {
301
- padding: 10px;
302
- }
303
-
304
- .pagination-container .icon-container .left-arrow,
305
- .pagination-container .icon-container .right-arrow {
306
- padding: 10px;
307
- --nuraly-icon-color: var(--nuraly-pagination-text-color);
308
- }
309
-
310
- .pagination-container .icon-container .left-arrow {
311
- border-right: var(--nuraly-pagination-borders);
312
- }
313
-
314
- .pagination-container nr-icon[data-enabled='false'] {
315
- cursor: not-allowed;
316
- }
317
-
318
- .pagination-container nr-icon[data-enabled='true'] {
319
- cursor: pointer;
320
- }
321
-
322
- /* Size Variants for Pagination */
323
- .pagination-container[data-size='small'] .left-content .items-details {
324
- padding: 5px;
325
- }
326
-
327
- .pagination-container[data-size='large'] .left-content .items-details {
328
- padding: 15px;
329
- }
330
-
331
- .pagination-container[data-size='small'] .left-content .select-details {
332
- padding: 5px;
333
- gap: 6px;
334
- }
335
-
336
- .pagination-container[data-size='large'] .left-content .select-details {
337
- padding: 15px;
338
- gap: 10px;
339
- }
340
-
341
- .pagination-container[data-size='small'] .right-content .page-details {
342
- padding: 5px;
343
- }
344
-
345
- .pagination-container[data-size='large'] .right-content .page-details {
346
- padding: 15px;
347
- }
348
-
349
- .pagination-container[data-size='small'] .icon-container .left-arrow,
350
- .pagination-container[data-size='small'] .icon-container .right-arrow {
351
- padding: 5px;
352
- }
353
-
354
- .pagination-container[data-size='large'] .icon-container .left-arrow,
355
- .pagination-container[data-size='large'] .icon-container .right-arrow {
356
- padding: 15px;
357
- }
358
-
359
- /* Column Filter Styles */
360
- th .th-content {
361
- display: flex;
362
- align-items: center;
363
- justify-content: space-between;
364
- gap: 8px;
365
- position: relative;
366
- }
367
-
368
- th .th-text {
369
- display: flex;
370
- align-items: center;
371
- gap: 10px;
372
- flex: 1;
373
- }
374
-
375
- th .filter-wrapper {
376
- position: relative;
377
- display: flex;
378
- align-items: center;
379
- }
380
-
381
- .filter-trigger {
382
- background: transparent;
383
- border: none;
384
- cursor: pointer;
385
- padding: 4px;
386
- display: flex;
387
- align-items: center;
388
- justify-content: center;
389
- border-radius: 4px;
390
- transition: background-color 0.2s;
391
- }
392
-
393
- .filter-trigger:hover {
394
- background-color: var(--nuraly-table-filter-hover, rgba(0, 0, 0, 0.04));
395
- }
396
-
397
- .filter-icon {
398
- position: relative;
399
- display: flex;
400
- align-items: center;
401
- justify-content: center;
402
- }
403
-
404
- .filter-icon.has-filter {
405
- color: var(--nuraly-table-filter-active, #1890ff);
406
- }
407
-
408
- .filter-indicator {
409
- position: absolute;
410
- top: -2px;
411
- right: -2px;
412
- width: 6px;
413
- height: 6px;
414
- border-radius: 50%;
415
- background-color: var(--nuraly-table-filter-active, #1890ff);
416
- }
417
-
418
- .column-filter-dropdown {
419
- position: absolute;
420
- top: calc(100% + 4px);
421
- right: 0;
422
- background: var(--nuraly-table-background, #ffffff);
423
- border: 1px solid var(--nuraly-table-row-border-color, #f0f0f0);
424
- border-radius: 4px;
425
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
426
- z-index: 100;
427
- min-width: 200px;
428
- padding: 8px;
429
- }
430
-
431
- .column-filter-content {
432
- display: flex;
433
- flex-direction: column;
434
- gap: 8px;
435
- }
436
-
437
- .column-filter-input {
438
- padding: 8px;
439
- border: 1px solid var(--nuraly-table-row-border-color, #d9d9d9);
440
- border-radius: 4px;
441
- font-size: 14px;
442
- width: 100%;
443
- box-sizing: border-box;
444
- }
445
-
446
- .column-filter-input:focus {
447
- outline: none;
448
- border-color: var(--nuraly-table-filter-active, #1890ff);
449
- box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
450
- }
451
-
452
- .column-filter-clear {
453
- background: transparent;
454
- border: none;
455
- cursor: pointer;
456
- padding: 4px;
457
- display: flex;
458
- align-items: center;
459
- justify-content: center;
460
- color: var(--nuraly-table-text-color, #000);
461
- align-self: flex-end;
462
- }
463
-
464
- .column-filter-clear:hover {
465
- color: var(--nuraly-table-filter-active, #1890ff);
466
- }
467
-
468
- /* Fixed Columns Styles */
469
- th.fixed-column,
470
- td.fixed-column {
471
- position: sticky;
472
- background-color: var(--nuraly-table-row-background, #ffffff);
473
- }
474
-
475
- /* Fixed columns in header - highest priority */
476
- thead th.fixed-column {
477
- z-index: 20;
478
- background-color: var(--nuraly-table-header-background, #fafafa);
479
- }
480
-
481
- /* When table has fixed header, fixed columns in header need even higher z-index */
482
- .table-content-wrapper.fixed-header thead th.fixed-column {
483
- z-index: 25;
484
- background-color: var(--nuraly-table-header-background, #fafafa);
485
- }
486
-
487
- /* Fixed columns in body */
488
- tbody td.fixed-column {
489
- z-index: 8;
490
- background-color: var(--nuraly-table-row-background, #ffffff);
491
- }
492
-
493
- /* Ensure fixed columns in tbody have proper background */
494
- tbody tr td.fixed-column {
495
- background-color: var(--nuraly-table-row-background, #ffffff);
496
- }
497
-
498
- tbody tr:hover td.fixed-column {
499
- background-color: var(--nuraly-table-row-hover-background, #f5f5f5);
500
- }
501
-
502
- th.fixed-column-left,
503
- td.fixed-column-left {
504
- left: 0;
505
- border-right: 1px solid var(--nuraly-table-row-border-color, #f0f0f0);
506
- }
507
-
508
- th.fixed-column-right,
509
- td.fixed-column-right {
510
- right: 0;
511
- border-left: 1px solid var(--nuraly-table-row-border-color, #f0f0f0);
512
- }
513
-
514
- /* Shadow effect for fixed columns */
515
- th.fixed-column-left::after,
516
- td.fixed-column-left::after {
517
- content: '';
518
- position: absolute;
519
- top: 0;
520
- right: -10px;
521
- bottom: 0;
522
- width: 10px;
523
- pointer-events: none;
524
- transition: box-shadow 0.3s;
525
- box-shadow: none;
526
- }
527
-
528
- .table-content-wrapper.has-scroll th.fixed-column-left::after,
529
- .table-content-wrapper.has-scroll td.fixed-column-left::after {
530
- box-shadow: inset -10px 0 8px -8px rgba(0, 0, 0, 0.15);
531
- }
532
-
533
- th.fixed-column-right::before,
534
- td.fixed-column-right::before {
535
- content: '';
536
- position: absolute;
537
- top: 0;
538
- left: -10px;
539
- bottom: 0;
540
- width: 10px;
541
- pointer-events: none;
542
- transition: box-shadow 0.3s;
543
- box-shadow: none;
544
- }
545
-
546
- .table-content-wrapper.has-scroll th.fixed-column-right::before,
547
- .table-content-wrapper.has-scroll td.fixed-column-right::before {
548
- box-shadow: inset 10px 0 8px -8px rgba(0, 0, 0, 0.15);
549
- }
550
-
551
- /* ============================================ */
552
- /* Loading State Styles */
553
- /* ============================================ */
554
-
555
- /* Skeleton Loading Rows */
556
- .skeleton-row {
557
- animation: skeleton-pulse 1.5s ease-in-out infinite;
558
- }
559
-
560
- .skeleton-cell {
561
- padding: var(--nuraly-spacing-3, 0.75rem) var(--nuraly-spacing-4, 1rem);
562
- border-bottom: 1px solid var(--nuraly-table-border-color, #f0f0f0);
563
- }
564
-
565
- .skeleton-cell.selection-skeleton {
566
- width: 48px;
567
- text-align: center;
568
- }
569
-
570
- .skeleton-checkbox {
571
- width: 16px;
572
- height: 16px;
573
- background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
574
- background-size: 200% 100%;
575
- animation: skeleton-shimmer 1.5s ease-in-out infinite;
576
- border-radius: 2px;
577
- margin: 0 auto;
578
- }
579
-
580
- .skeleton-content {
581
- height: 16px;
582
- background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
583
- background-size: 200% 100%;
584
- animation: skeleton-shimmer 1.5s ease-in-out infinite;
585
- border-radius: 4px;
586
- width: 80%;
587
- }
588
-
589
- @keyframes skeleton-shimmer {
590
- 0% {
591
- background-position: 200% 0;
592
- }
593
- 100% {
594
- background-position: -200% 0;
595
- }
596
- }
597
-
598
- @keyframes skeleton-pulse {
599
- 0%, 100% {
600
- opacity: 1;
601
- }
602
- 50% {
603
- opacity: 0.6;
604
- }
605
- }
606
-
607
- /* Spinner Loading */
608
- .loading-row {
609
- background-color: var(--nuraly-table-row-background, #ffffff);
610
- }
611
-
612
- .loading-cell {
613
- padding: var(--nuraly-spacing-8, 2rem) var(--nuraly-spacing-4, 1rem);
614
- text-align: center;
615
- border-bottom: 1px solid var(--nuraly-table-border-color, #f0f0f0);
616
- }
617
-
618
- .loading-spinner-container {
619
- display: flex;
620
- flex-direction: column;
621
- align-items: center;
622
- gap: var(--nuraly-spacing-4, 1rem);
623
- }
624
-
625
- .loading-spinner {
626
- width: 40px;
627
- height: 40px;
628
- border: 4px solid var(--nuraly-table-border-color, #f0f0f0);
629
- border-top-color: var(--nuraly-color-primary, #1890ff);
630
- border-radius: 50%;
631
- animation: spinner-rotate 0.8s linear infinite;
632
- }
633
-
634
- @keyframes spinner-rotate {
635
- 0% {
636
- transform: rotate(0deg);
637
- }
638
- 100% {
639
- transform: rotate(360deg);
640
- }
641
- }
642
-
643
- .loading-text {
644
- margin: 0;
645
- color: var(--nuraly-color-text-secondary, #666666);
646
- font-size: 14px;
647
- }
648
-
649
- /* Empty State Styles */
650
- .empty-row {
651
- background: var(--nuraly-table-row-bg-color, #ffffff);
652
- }
653
-
654
- .empty-row:hover {
655
- background: var(--nuraly-table-row-bg-color, #ffffff);
656
- }
657
-
658
- .empty-cell {
659
- padding: 64px 24px;
660
- text-align: center;
661
- border-bottom: 1px solid var(--nuraly-table-border-color, #f0f0f0);
662
- }
663
-
664
- .empty-state {
665
- display: flex;
666
- flex-direction: column;
667
- align-items: center;
668
- gap: 16px;
669
- }
670
-
671
- .empty-icon {
672
- width: 64px;
673
- height: 64px;
674
- color: var(--nuraly-color-text-quaternary, #bfbfbf);
675
- display: flex;
676
- align-items: center;
677
- justify-content: center;
678
- }
679
-
680
- .empty-icon svg {
681
- width: 100%;
682
- height: 100%;
683
- }
684
-
685
- .empty-icon nr-icon {
686
- font-size: 64px;
687
- }
688
-
689
- .empty-text {
690
- margin: 0;
691
- color: var(--nuraly-color-text-secondary, #666666);
692
- font-size: 14px;
693
- line-height: 1.5;
694
- }
695
-
696
- /* Expansion Row Styles */
697
- .expand-icon {
698
- text-align: center;
699
- vertical-align: middle;
700
- transition: transform 0.3s ease;
701
- outline: none;
702
- }
703
-
704
- .expand-icon:hover {
705
- background-color: var(--nuraly-color-fill-tertiary, #f5f5f5);
706
- }
707
-
708
- .expand-icon:focus {
709
- background-color: var(--nuraly-color-fill-tertiary, #f5f5f5);
710
- box-shadow: inset 0 0 0 2px var(--nuraly-color-primary, #1890ff);
711
- }
712
-
713
- .expand-icon nr-icon {
714
- transition: transform 0.3s ease;
715
- }
716
-
717
- .expand-icon.expanded nr-icon {
718
- transform: rotate(180deg);
719
- }
720
-
721
- .expansion-row {
722
- transition: all 0.3s ease;
723
- }
724
-
725
- .expansion-row.collapsed {
726
- opacity: 0;
727
- height: 0;
728
- overflow: hidden;
729
- }
730
-
731
- .expansion-row.expanded {
732
- opacity: 1;
733
- animation: slideDown 0.3s ease;
734
- }
735
-
736
- .expansion-content {
737
- padding: 16px;
738
- background-color: var(--nuraly-color-fill-quaternary, #fafafa);
739
- border-top: 1px solid var(--nuraly-color-border, #d9d9d9);
740
- }
741
-
742
- @keyframes slideDown {
743
- from {
744
- opacity: 0;
745
- transform: translateY(-10px);
746
- }
747
- to {
748
- opacity: 1;
749
- transform: translateY(0);
750
- }
751
- }
752
- `;
12
+ */class u extends p{initSelection(){this.host.selectionMode&&(this.host.selectedItems=Array(this.host.rows.length).fill(!1))}handleCheckAll(t){try{const e=(this.host.currentPage-1)*this.host.selectedItemPerPage,i=Math.min(e+this.host.selectedItemPerPage,this.host.selectedItems.length),n=[...this.host.selectedItems];for(let r=e;r<i;r++)n[r]=!t;this.host.selectedItems=n;const r=this.host.rowsCopy.filter(((t,e)=>this.host.selectedItems[e]));this.dispatchEvent(new CustomEvent("onSelect",{bubbles:!0,composed:!0,detail:{value:r}})),this.requestUpdate()}catch(t){this.handleError(t,"handleCheckAll")}}handleCheckOne(t,e){try{const i=t+(this.host.currentPage-1)*this.host.selectedItemPerPage;this.host.selectedItems[i]=e,this.host.selectedItems=[...this.host.selectedItems];const n=this.host.rowsCopy.filter(((t,e)=>this.host.selectedItems[e]));this.dispatchEvent(new CustomEvent("nr-select",{bubbles:!0,composed:!0,detail:{value:n}})),this.requestUpdate()}catch(t){this.handleError(t,"handleCheckOne")}}handleSelectOne(t){try{const e=this.host.selectedItems.findIndex((t=>t));e>-1&&(this.host.selectedItems[e]=!1);const i=t+(this.host.currentPage-1)*this.host.selectedItemPerPage;this.host.selectedItems[i]=!0,this.host.selectedItems=[...this.host.selectedItems];const n=this.host.rowsCopy.filter(((t,e)=>this.host.selectedItems[e]));this.dispatchEvent(new CustomEvent("nr-select",{bubbles:!0,composed:!0,detail:{value:n}})),this.requestUpdate()}catch(t){this.handleError(t,"handleSelectOne")}}cancelSelection(){try{this.host.selectedItems=this.host.selectedItems.map((()=>!1)),this.dispatchEvent(new CustomEvent("nr-select",{bubbles:!0,composed:!0,detail:{value:[]}})),this.requestUpdate()}catch(t){this.handleError(t,"cancelSelection")}}hasSelection(){return this.host.selectedItems.some((t=>t))}getSelectedCount(){return this.host.selectedItems.filter((t=>t)).length}}
753
13
  /**
754
14
  * @license
755
15
  * Copyright 2023 Nuraly, Laabidi Aymen
756
16
  * SPDX-License-Identifier: MIT
757
- */
758
- class Xt{constructor(t){this._host=t,this._host.addController(this)}get host(){return this._host}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}handleError(t,e){console.error(`[TableController:${this.constructor.name}] Error in ${e}:`,t),this._host.dispatchEvent(new CustomEvent("nr-table-error",{detail:{error:t.message,context:e,controller:this.constructor.name},bubbles:!0,composed:!0}))}requestUpdate(){try{this._host.requestUpdate()}catch(t){this.handleError(t,"requestUpdate")}}dispatchEvent(t){try{return this._host.dispatchEvent(t)}catch(t){return this.handleError(t,"dispatchEvent"),!1}}}
17
+ */class f extends p{initPagination(){try{this.host.displayedRows=this.host.rowsCopy.slice(0,this.host.selectedItemPerPage),this.host.currentPage=this.host.rowsCopy.length>0?1:0,this.requestUpdate()}catch(t){this.handleError(t,"initPagination")}}handleItemPerPageChange(t){try{this.host.selectedItemPerPage=t,this.initPagination()}catch(t){this.handleError(t,"handleItemPerPageChange")}}handlePageChange(t){try{this.host.currentPage=t;const e=(t-1)*this.host.selectedItemPerPage,i=e+this.host.selectedItemPerPage;this.host.displayedRows=this.host.rowsCopy.slice(e,i),this.dispatchEvent(new CustomEvent("onPaginate",{bubbles:!0,composed:!0,detail:{value:this.host.currentPage}})),this.requestUpdate()}catch(t){this.handleError(t,"handlePageChange")}}getTotalPages(){return Math.ceil(this.host.rowsCopy.length/this.host.selectedItemPerPage)}hasNextPage(){return this.host.currentPage<this.getTotalPages()}hasPreviousPage(){return this.host.currentPage>1}}
759
18
  /**
760
19
  * @license
761
20
  * Copyright 2023 Nuraly, Laabidi Aymen
762
21
  * SPDX-License-Identifier: MIT
763
- */class te extends Xt{initSelection(){this.host.selectionMode&&(this.host.selectedItems=Array(this.host.rows.length).fill(!1))}handleCheckAll(t){try{const e=(this.host.currentPage-1)*this.host.selectedItemPerPage,i=Math.min(e+this.host.selectedItemPerPage,this.host.selectedItems.length),n=[...this.host.selectedItems];for(let s=e;s<i;s++)n[s]=!t;this.host.selectedItems=n;const s=this.host.rowsCopy.filter(((t,e)=>this.host.selectedItems[e]));this.dispatchEvent(new CustomEvent("onSelect",{bubbles:!0,composed:!0,detail:{value:s}})),this.requestUpdate()}catch(t){this.handleError(t,"handleCheckAll")}}handleCheckOne(t,e){try{const i=t+(this.host.currentPage-1)*this.host.selectedItemPerPage;this.host.selectedItems[i]=e,this.host.selectedItems=[...this.host.selectedItems];const n=this.host.rowsCopy.filter(((t,e)=>this.host.selectedItems[e]));this.dispatchEvent(new CustomEvent("nr-select",{bubbles:!0,composed:!0,detail:{value:n}})),this.requestUpdate()}catch(t){this.handleError(t,"handleCheckOne")}}handleSelectOne(t){try{const e=this.host.selectedItems.findIndex((t=>t));e>-1&&(this.host.selectedItems[e]=!1);const i=t+(this.host.currentPage-1)*this.host.selectedItemPerPage;this.host.selectedItems[i]=!0,this.host.selectedItems=[...this.host.selectedItems];const n=this.host.rowsCopy.filter(((t,e)=>this.host.selectedItems[e]));this.dispatchEvent(new CustomEvent("nr-select",{bubbles:!0,composed:!0,detail:{value:n}})),this.requestUpdate()}catch(t){this.handleError(t,"handleSelectOne")}}cancelSelection(){try{this.host.selectedItems=this.host.selectedItems.map((()=>!1)),this.dispatchEvent(new CustomEvent("nr-select",{bubbles:!0,composed:!0,detail:{value:[]}})),this.requestUpdate()}catch(t){this.handleError(t,"cancelSelection")}}hasSelection(){return this.host.selectedItems.some((t=>t))}getSelectedCount(){return this.host.selectedItems.filter((t=>t)).length}}
22
+ */class g extends p{handleSortOrderChange(t){try{t!==this.host.sortAttribute.index?(this.host.sortAttribute.index=t,this.host.sortAttribute.order="ascending"):"default"===this.host.sortAttribute.order?this.host.sortAttribute.order="ascending":"ascending"===this.host.sortAttribute.order?this.host.sortAttribute.order="descending":this.host.sortAttribute.order="default",this.host.sortAttribute=Object.assign({},this.host.sortAttribute),this.requestUpdate()}catch(t){this.handleError(t,"handleSortOrderChange")}}sort(){try{if(!this.host.rowsCopy.length)return;const t="default"===this.host.sortAttribute.order?0:"ascending"===this.host.sortAttribute.order?1:-1;this.host.rowsCopy.sort(((e,i)=>{const n=this.host.headers[this.host.sortAttribute.index].key,r=JSON.stringify(e[n]),a=JSON.stringify(i[n]);return(r<a?-1:r>a?1:0)*t})),this.dispatchEvent(new CustomEvent("onSort",{bubbles:!0,composed:!0,detail:{value:this.host.rowsCopy}})),this.requestUpdate()}catch(t){this.handleError(t,"sort")}}resetSort(){try{this.host.rowsCopy.sort(((t,e)=>{const i=this.host.rows.findIndex((e=>JSON.stringify(e)===JSON.stringify(t))),n=this.host.rows.findIndex((t=>JSON.stringify(t)===JSON.stringify(e)));return i>n?1:i<n?-1:0})),this.requestUpdate()}catch(t){this.handleError(t,"resetSort")}}isSortActive(){return this.host.sortAttribute.index>-1}isSortDefault(){return"default"===this.host.sortAttribute.order}}
764
23
  /**
765
24
  * @license
766
25
  * Copyright 2023 Nuraly, Laabidi Aymen
767
26
  * SPDX-License-Identifier: MIT
768
- */class ee extends Xt{initPagination(){try{this.host.displayedRows=this.host.rowsCopy.slice(0,this.host.selectedItemPerPage),this.host.currentPage=this.host.rowsCopy.length>0?1:0,this.requestUpdate()}catch(t){this.handleError(t,"initPagination")}}handleItemPerPageChange(t){try{this.host.selectedItemPerPage=t,this.initPagination()}catch(t){this.handleError(t,"handleItemPerPageChange")}}handlePageChange(t){try{this.host.currentPage=t;const e=(t-1)*this.host.selectedItemPerPage,i=e+this.host.selectedItemPerPage;this.host.displayedRows=this.host.rowsCopy.slice(e,i),this.dispatchEvent(new CustomEvent("onPaginate",{bubbles:!0,composed:!0,detail:{value:this.host.currentPage}})),this.requestUpdate()}catch(t){this.handleError(t,"handlePageChange")}}getTotalPages(){return Math.ceil(this.host.rowsCopy.length/this.host.selectedItemPerPage)}hasNextPage(){return this.host.currentPage<this.getTotalPages()}hasPreviousPage(){return this.host.currentPage>1}}
27
+ */class b extends p{handleSearch(t){try{t.trim().length>0?(this.host.activeSearch=!0,this.host.rowsCopy=this.host.rows.filter((e=>Object.values(e).some((e=>JSON.stringify(e).includes(t))))),this.dispatchEvent(new CustomEvent("onSearch",{bubbles:!0,composed:!0,detail:{value:this.host.rowsCopy}}))):this.clearSearch(),this.requestUpdate()}catch(t){this.handleError(t,"handleSearch")}}clearSearch(){try{this.host.activeSearch=!1,this.requestUpdate()}catch(t){this.handleError(t,"clearSearch")}}isSearchActive(){return this.host.activeSearch}getFilteredCount(){return this.host.rowsCopy.length}applyColumnFilter(t,e){try{""===e||null==e?this.host.columnFilters.delete(t):this.host.columnFilters.set(t,e),this.filterRows(),this.requestUpdate()}catch(t){this.handleError(t,"applyColumnFilter")}}clearColumnFilter(t){try{this.host.columnFilters.delete(t),this.filterRows(),this.requestUpdate()}catch(t){this.handleError(t,"clearColumnFilter")}}clearAllColumnFilters(){try{this.host.columnFilters.clear(),this.filterRows(),this.requestUpdate()}catch(t){this.handleError(t,"clearAllColumnFilters")}}toggleColumnFilterDropdown(t){try{this.host.activeFilterColumn=this.host.activeFilterColumn===t?null:t,this.requestUpdate()}catch(t){this.handleError(t,"toggleColumnFilterDropdown")}}filterRows(){var t;let e=[...this.host.rows];this.host.columnFilters.size>0&&(e=e.filter((t=>Array.from(this.host.columnFilters.entries()).every((([e,i])=>{const n=t[e];if(null==n)return!1;const r=String(n).toLowerCase(),a=String(i).toLowerCase();return r.includes(a)}))))),this.host.activeSearch&&this.host.filterValue&&(e=e.filter((t=>Object.values(t).some((t=>JSON.stringify(t).toLowerCase().includes(this.host.filterValue.toLowerCase())))))),this.host.rowsCopy=e,this.host.activeSearch=this.host.columnFilters.size>0||(null===(t=this.host.filterValue)||void 0===t?void 0:t.length)>0}}function x(t,e,i){let n=0;i&&(n+=50);for(let i=0;i<e;i++)if("left"===t[i].fixed){const e=t[i].width;n+="number"==typeof e?e:parseInt(String(e))||150}return n}function v(t){const e=[];return t.fixed&&(e.push("fixed-column"),e.push(`fixed-column-${t.fixed}`)),e.join(" ")}function m(t){const n=t.headers.some((t=>"left"===t.fixed)),r=n?"fixed-column fixed-column-left":"";return e`<table><thead><tr>${t.expandable||t.expansionRenderer||t.selectionMode?e`<th class="${r}" style="${n?"left: 0; width: 50px; min-width: 50px;":""}">${"multiple"===t.selectionMode?e`<nr-checkbox id="global-check" @nr-change="${t.onCheckAll}"></nr-checkbox>`:i}</th>`:i} ${c(t.headers,((n,r)=>{const a=v(n),o=t.expandable||t.expansionRenderer||t.selectionMode,l="left"===n.fixed?x(t.headers,r,!!o):void 0,s=n.width?"number"==typeof n.width?`${n.width}px`:n.width:void 0;return e`${t.expandable!==n.key?e`<th class="${[n.filterable?"filterable":"",a].filter(Boolean).join(" ")}" style="${void 0!==l?`left: ${l}px;`:""}${s?`width: ${s}; min-width: ${s};`:""}"><div class="th-content"><span class="th-text" @click="${()=>t.onUpdateSort(r)}">${n.name} ${r===t.sortAttribute.index?d(t.sortAttribute.order,[["default",()=>e`<nr-icon name="arrows-v"></nr-icon>`],["ascending",()=>e`<nr-icon name="long-arrow-up"></nr-icon>`],["descending",()=>e`<nr-icon name="long-arrow-down"></nr-icon>`]]):e`<nr-icon name="arrows-v"></nr-icon>`} </span>${n.filterable&&n.filterConfig?e`<div class="filter-wrapper"><button class="filter-trigger" @click="${e=>{e.stopPropagation(),t.onToggleColumnFilter(n.key)}}">${t.activeFilterColumn,n.key,c=t.columnFilters.has(n.key),e`<span class="filter-icon ${c?"has-filter":""}"><nr-icon name="filter"></nr-icon>${c?e`<span class="filter-indicator"></span>`:i}</span>`}</button> ${t.activeFilterColumn===n.key?function(t){const{filterConfig:n,currentValue:r,onFilterChange:a,onClearFilter:o}=t;return e`<div class="column-filter-dropdown"><div class="column-filter-content">${"select"===n.type?e`<nr-select .options="${n.options||[]}" .value="${r||""}" placeholder="${n.placeholder||"Filter..."}" @nr-change="${t=>a(t.detail.value)}"></nr-select>`:"number"===n.type?e`<input type="number" class="column-filter-input" placeholder="${n.placeholder||"Filter by number..."}" .value="${r||""}" @input="${t=>a(t.target.value)}">`:"date"===n.type?e`<input type="date" class="column-filter-input" placeholder="${n.placeholder||"Filter by date..."}" .value="${r||""}" @input="${t=>a(t.target.value)}">`:e`<input type="text" class="column-filter-input" placeholder="${n.placeholder||"Filter..."}" .value="${r||""}" @input="${t=>a(t.target.value)}">`} ${r?e`<button class="column-filter-clear" @click="${o}"><nr-icon name="times"></nr-icon></button>`:i}</div></div>`}({columnKey:n.key,filterConfig:n.filterConfig,currentValue:t.columnFilters.get(n.key),isActive:!0,onFilterChange:e=>t.onApplyColumnFilter(n.key,e),onClearFilter:()=>t.onClearColumnFilter(n.key)}):i}</div>`:i}</div></th>`:i}`;var c;
769
28
  /**
770
29
  * @license
771
30
  * Copyright 2023 Nuraly, Laabidi Aymen
772
31
  * SPDX-License-Identifier: MIT
773
- */class ie extends Xt{handleSortOrderChange(t){try{t!==this.host.sortAttribute.index?(this.host.sortAttribute.index=t,this.host.sortAttribute.order="ascending"):"default"===this.host.sortAttribute.order?this.host.sortAttribute.order="ascending":"ascending"===this.host.sortAttribute.order?this.host.sortAttribute.order="descending":this.host.sortAttribute.order="default",this.host.sortAttribute=Object.assign({},this.host.sortAttribute),this.requestUpdate()}catch(t){this.handleError(t,"handleSortOrderChange")}}sort(){try{if(!this.host.rowsCopy.length)return;const t="default"===this.host.sortAttribute.order?0:"ascending"===this.host.sortAttribute.order?1:-1;this.host.rowsCopy.sort(((e,i)=>{const n=this.host.headers[this.host.sortAttribute.index].key,s=JSON.stringify(e[n]),o=JSON.stringify(i[n]);return(s<o?-1:s>o?1:0)*t})),this.dispatchEvent(new CustomEvent("onSort",{bubbles:!0,composed:!0,detail:{value:this.host.rowsCopy}})),this.requestUpdate()}catch(t){this.handleError(t,"sort")}}resetSort(){try{this.host.rowsCopy.sort(((t,e)=>{const i=this.host.rows.findIndex((e=>JSON.stringify(e)===JSON.stringify(t))),n=this.host.rows.findIndex((t=>JSON.stringify(t)===JSON.stringify(e)));return i>n?1:i<n?-1:0})),this.requestUpdate()}catch(t){this.handleError(t,"resetSort")}}isSortActive(){return this.host.sortAttribute.index>-1}isSortDefault(){return"default"===this.host.sortAttribute.order}}
32
+ */}))}</tr></thead><tbody>${t.loading?function(t,i=5){const n=!!t.selectionMode;return e`${Array.from({length:i},(()=>e`<tr class="skeleton-row">${n?e`<td class="skeleton-cell selection-skeleton"><div class="skeleton-checkbox"></div></td>`:""} ${t.headers.map((()=>e`<td class="skeleton-cell"><div class="skeleton-content"></div></td>`))}</tr>`))}`}(t.host,5):0===t.rows.length?function(t){const i=t.headers.length+(t.selectionMode?1:0);return e`<tr class="empty-row"><td colspan="${i}" class="empty-cell"><div class="empty-state">${t.emptyIcon?e`<div class="empty-icon"><nr-icon name="${t.emptyIcon}"></nr-icon></div>`:e`<div class="empty-icon"><svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M32 8C18.745 8 8 18.745 8 32s10.745 24 24 24 24-10.745 24-24S45.255 8 32 8zm0 44c-11.028 0-20-8.972-20-20s8.972-20 20-20 20 8.972 20 20-8.972 20-20 20z" fill="currentColor" opacity="0.3"/><path d="M32 20c-1.105 0-2 .895-2 2v12c0 1.105.895 2 2 2s2-.895 2-2V22c0-1.105-.895-2-2-2zm0 20c-1.105 0-2 .895-2 2s.895 2 2 2 2-.895 2-2-.895-2-2-2z" fill="currentColor"/></svg></div>`}<div class="empty-text">${t.emptyText}</div></div></td></tr>`}(t.host):c(t.rows,((a,o)=>e`<tr>${!t.expandable&&!t.expansionRenderer||t.selectionMode?t.selectionMode?d(t.selectionMode,[["multiple",()=>e`<td class="${r}" style="${n?"left: 0; width: 50px; min-width: 50px;":""}"><nr-checkbox @nr-change="${e=>t.onCheckOne(e,o)}" .checked="${t.selectedItems[o+(t.currentPage-1)*t.itemPerPage]}"></nr-checkbox></td>`],["single",()=>e`<td class="${r}" style="${n?"left: 0; width: 50px; min-width: 50px;":""}"><nr-radio name="table-row-selection" value="${o}" @nr-change="${()=>t.onSelectOne(o)}" .checked="${t.selectedItems[o+(t.currentPage-1)*t.itemPerPage]}"></nr-radio></td>`]]):i:e`<td @click="${()=>t.onShowExpandedContent(o)}" @keydown="${e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.onShowExpandedContent(o))}}" tabindex="0" role="button" aria-expanded="${t.expand[o]}" aria-label="${t.expand[o]?"Collapse row":"Expand row"}" class="expand-icon ${t.expand[o]?"expanded":""} ${r}" style="${n?"left: 0; width: 50px; min-width: 50px;":""}"><nr-icon name="angle-down"></nr-icon></td>`} ${c(t.headers,((n,r)=>{const o=v(n),l=t.expandable||t.expansionRenderer||t.selectionMode,s="left"===n.fixed?x(t.headers,r,!!l):void 0,c=n.width?"number"==typeof n.width?`${n.width}px`:n.width:void 0;return e`${t.expandable!==n.key?e`<td class="${o}" style="${void 0!==s?`left: ${s}px;`:""}${c?`width: ${c}; min-width: ${c};`:""}">${a[n.key]}</td>`:i}`}))}</tr>${t.expand[o]?e`<tr class="expansion-row expanded"><td colspan="${t.headers.length+(t.expandable||t.expansionRenderer||t.selectionMode?1:0)}"><div class="expansion-content">${t.expansionRenderer?t.expansionRenderer(a,o):t.expandable?a[t.expandable]:i}</div></td></tr>`:i}`))}</tbody></table>`}
774
33
  /**
775
34
  * @license
776
35
  * Copyright 2023 Nuraly, Laabidi Aymen
777
36
  * SPDX-License-Identifier: MIT
778
- */class ne extends Xt{handleSearch(t){try{t.trim().length>0?(this.host.activeSearch=!0,this.host.rowsCopy=this.host.rows.filter((e=>Object.values(e).some((e=>JSON.stringify(e).includes(t))))),this.dispatchEvent(new CustomEvent("onSearch",{bubbles:!0,composed:!0,detail:{value:this.host.rowsCopy}}))):this.clearSearch(),this.requestUpdate()}catch(t){this.handleError(t,"handleSearch")}}clearSearch(){try{this.host.activeSearch=!1,this.requestUpdate()}catch(t){this.handleError(t,"clearSearch")}}isSearchActive(){return this.host.activeSearch}getFilteredCount(){return this.host.rowsCopy.length}applyColumnFilter(t,e){try{""===e||null==e?this.host.columnFilters.delete(t):this.host.columnFilters.set(t,e),this.filterRows(),this.requestUpdate()}catch(t){this.handleError(t,"applyColumnFilter")}}clearColumnFilter(t){try{this.host.columnFilters.delete(t),this.filterRows(),this.requestUpdate()}catch(t){this.handleError(t,"clearColumnFilter")}}clearAllColumnFilters(){try{this.host.columnFilters.clear(),this.filterRows(),this.requestUpdate()}catch(t){this.handleError(t,"clearAllColumnFilters")}}toggleColumnFilterDropdown(t){try{this.host.activeFilterColumn=this.host.activeFilterColumn===t?null:t,this.requestUpdate()}catch(t){this.handleError(t,"toggleColumnFilterDropdown")}}filterRows(){var t;let e=[...this.host.rows];this.host.columnFilters.size>0&&(e=e.filter((t=>Array.from(this.host.columnFilters.entries()).every((([e,i])=>{const n=t[e];if(null==n)return!1;const s=String(n).toLowerCase(),o=String(i).toLowerCase();return s.includes(o)}))))),this.host.activeSearch&&this.host.filterValue&&(e=e.filter((t=>Object.values(t).some((t=>JSON.stringify(t).toLowerCase().includes(this.host.filterValue.toLowerCase())))))),this.host.rowsCopy=e,this.host.activeSearch=this.host.columnFilters.size>0||(null===(t=this.host.filterValue)||void 0===t?void 0:t.length)>0}}
779
- /**
780
- * @license
781
- * Copyright 2017 Google LLC
782
- * SPDX-License-Identifier: BSD-3-Clause
783
- */
784
- const se=2;class oe{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
785
- /**
786
- * @license
787
- * Copyright 2020 Google LLC
788
- * SPDX-License-Identifier: BSD-3-Clause
789
- */const{I:re}=X,ae=()=>document.createComment(""),le=(t,e,i)=>{var n;const s=t._$AA.parentNode,o=void 0===e?t._$AB:e._$AA;if(void 0===i){const e=s.insertBefore(ae(),o),n=s.insertBefore(ae(),o);i=new re(e,n,t,t.options)}else{const e=i._$AB.nextSibling,r=i._$AM,a=r!==t;if(a){let e;null===(n=i._$AQ)||void 0===n||n.call(i,t),i._$AM=t,void 0!==i._$AP&&(e=t._$AU)!==r._$AU&&i._$AP(e)}if(e!==o||a){let t=i._$AA;for(;t!==e;){const e=t.nextSibling;s.insertBefore(t,o),t=e}}}return i},he=(t,e,i=t)=>(t._$AI(e,i),t),ce={},de=(t,e=ce)=>t._$AH=e,ue=t=>{var e;null===(e=t._$AP)||void 0===e||e.call(t,!1,!0);let i=t._$AA;const n=t._$AB.nextSibling;for(;i!==n;){const t=i.nextSibling;i.remove(),i=t}},pe=(t,e,i)=>{const n=new Map;for(let s=e;s<=i;s++)n.set(t[s],s);return n},fe=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends oe{constructor(t){if(super(t),t.type!==se)throw Error("repeat() can only be used in text expressions")}ct(t,e,i){let n;void 0===i?i=e:void 0!==e&&(n=e);const s=[],o=[];let r=0;for(const e of t)s[r]=n?n(e,r):r,o[r]=i(e,r),r++;return{values:o,keys:s}}render(t,e,i){return this.ct(t,e,i).values}update(t,[e,i,n]){var s;const o=(t=>t._$AH)(t),{values:r,keys:a}=this.ct(e,i,n);if(!Array.isArray(o))return this.ut=a,r;const l=null!==(s=this.ut)&&void 0!==s?s:this.ut=[],h=[];let c,d,u=0,p=o.length-1,f=0,v=r.length-1;for(;u<=p&&f<=v;)if(null===o[u])u++;else if(null===o[p])p--;else if(l[u]===a[f])h[f]=he(o[u],r[f]),u++,f++;else if(l[p]===a[v])h[v]=he(o[p],r[v]),p--,v--;else if(l[u]===a[v])h[v]=he(o[u],r[v]),le(t,h[v+1],o[u]),u++,v--;else if(l[p]===a[f])h[f]=he(o[p],r[f]),le(t,o[u],o[p]),p--,f++;else if(void 0===c&&(c=pe(a,f,v),d=pe(l,u,p)),c.has(l[u]))if(c.has(l[p])){const e=d.get(a[f]),i=void 0!==e?o[e]:null;if(null===i){const e=le(t,o[u]);he(e,r[f]),h[f]=e}else h[f]=he(i,r[f]),le(t,o[u],i),o[e]=null;f++}else ue(o[p]),p--;else ue(o[u]),u++;for(;f<=v;){const e=le(t,h[v+1]);he(e,r[f]),h[f++]=e}for(;u<=p;){const t=o[u++];null!==t&&ue(t)}return this.ut=a,de(t,h),N}}),ve=(t,e,i)=>{for(const i of e)if(i[0]===t)return(0,i[1])();return null==i?void 0:i()};
790
- /**
791
- * @license
792
- * Copyright 2017 Google LLC
793
- * SPDX-License-Identifier: BSD-3-Clause
794
- */function ge(t,e,i){let n=0;i&&(n+=50);for(let i=0;i<e;i++)if("left"===t[i].fixed){const e=t[i].width;n+="number"==typeof e?e:parseInt(String(e))||150}return n}function be(t){const e=[];return t.fixed&&(e.push("fixed-column"),e.push(`fixed-column-${t.fixed}`)),e.join(" ")}function ye(t){const e=t.headers.some((t=>"left"===t.fixed)),i=e?"fixed-column fixed-column-left":"";return wt`
795
- <table>
796
- <thead>
797
- <tr>
798
- ${t.expandable||t.expansionRenderer||t.selectionMode?wt`<th class="${i}" style="${e?"left: 0; width: 50px; min-width: 50px;":""}">
799
- ${"multiple"===t.selectionMode?wt`<nr-checkbox
800
- id="global-check"
801
- @nr-change=${t.onCheckAll}
802
- ></nr-checkbox>`:kt}
803
- </th>`:kt}
804
- ${fe(t.headers,((e,i)=>{const n=be(e),s=t.expandable||t.expansionRenderer||t.selectionMode,o="left"===e.fixed?ge(t.headers,i,!!s):void 0,r=e.width?"number"==typeof e.width?`${e.width}px`:e.width:void 0;return wt`
805
- ${t.expandable!==e.key?wt`<th
806
- class="${[e.filterable?"filterable":"",n].filter(Boolean).join(" ")}"
807
- style="${void 0!==o?`left: ${o}px;`:""} ${r?`width: ${r}; min-width: ${r};`:""}">
808
- <div class="th-content">
809
- <span class="th-text" @click=${()=>t.onUpdateSort(i)}>
810
- ${e.name}
811
- ${i===t.sortAttribute.index?ve(t.sortAttribute.order,[["default",()=>wt`<nr-icon name="arrows-v"></nr-icon>`],["ascending",()=>wt`<nr-icon name="long-arrow-up"></nr-icon>`],["descending",()=>wt`<nr-icon name="long-arrow-down"></nr-icon>`]]):wt`<nr-icon name="arrows-v"></nr-icon>`}
812
- </span>
813
- ${e.filterable&&e.filterConfig?wt`
814
- <div class="filter-wrapper">
815
- <button
816
- class="filter-trigger"
817
- @click=${i=>{i.stopPropagation(),t.onToggleColumnFilter(e.key)}}
818
- >
819
- ${t.activeFilterColumn,e.key,a=t.columnFilters.has(e.key),wt`
820
- <span class="filter-icon ${a?"has-filter":""}">
821
- <nr-icon name="filter"></nr-icon>
822
- ${a?wt`<span class="filter-indicator"></span>`:kt}
823
- </span>
824
- `}
825
- </button>
826
- ${t.activeFilterColumn===e.key?function(t){const{filterConfig:e,currentValue:i,onFilterChange:n,onClearFilter:s}=t;return wt`
827
- <div class="column-filter-dropdown">
828
- <div class="column-filter-content">
829
- ${"select"===e.type?wt`
830
- <nr-select
831
- .options=${e.options||[]}
832
- .value=${i||""}
833
- placeholder=${e.placeholder||"Filter..."}
834
- @nr-change=${t=>n(t.detail.value)}
835
- ></nr-select>
836
- `:"number"===e.type?wt`
837
- <input
838
- type="number"
839
- class="column-filter-input"
840
- placeholder=${e.placeholder||"Filter by number..."}
841
- .value=${i||""}
842
- @input=${t=>n(t.target.value)}
843
- />
844
- `:"date"===e.type?wt`
845
- <input
846
- type="date"
847
- class="column-filter-input"
848
- placeholder=${e.placeholder||"Filter by date..."}
849
- .value=${i||""}
850
- @input=${t=>n(t.target.value)}
851
- />
852
- `:wt`
853
- <input
854
- type="text"
855
- class="column-filter-input"
856
- placeholder=${e.placeholder||"Filter..."}
857
- .value=${i||""}
858
- @input=${t=>n(t.target.value)}
859
- />
860
- `}
861
-
862
- ${i?wt`
863
- <button class="column-filter-clear" @click=${s}>
864
- <nr-icon name="times"></nr-icon>
865
- </button>
866
- `:kt}
867
- </div>
868
- </div>
869
- `}({columnKey:e.key,filterConfig:e.filterConfig,currentValue:t.columnFilters.get(e.key),isActive:!0,onFilterChange:i=>t.onApplyColumnFilter(e.key,i),onClearFilter:()=>t.onClearColumnFilter(e.key)}):kt}
870
- </div>
871
- `:kt}
872
- </div>
873
- </th>`:kt}
874
- `;var a;
875
- /**
876
- * @license
877
- * Copyright 2023 Nuraly, Laabidi Aymen
878
- * SPDX-License-Identifier: MIT
879
- */}))}
880
- </tr>
881
- </thead>
882
- <tbody>
883
- ${t.loading?function(t,e=5){const i=!!t.selectionMode;return wt`
884
- ${Array.from({length:e},(()=>wt`
885
- <tr class="skeleton-row">
886
- ${i?wt`
887
- <td class="skeleton-cell selection-skeleton">
888
- <div class="skeleton-checkbox"></div>
889
- </td>
890
- `:""}
891
- ${t.headers.map((()=>wt`
892
- <td class="skeleton-cell">
893
- <div class="skeleton-content"></div>
894
- </td>
895
- `))}
896
- </tr>
897
- `))}
898
- `}(t.host,5):0===t.rows.length?function(t){const e=t.headers.length+(t.selectionMode?1:0);return wt`
899
- <tr class="empty-row">
900
- <td colspan="${e}" class="empty-cell">
901
- <div class="empty-state">
902
- ${t.emptyIcon?wt`
903
- <div class="empty-icon">
904
- <nr-icon name="${t.emptyIcon}"></nr-icon>
905
- </div>
906
- `:wt`
907
- <div class="empty-icon">
908
- <svg
909
- width="64"
910
- height="64"
911
- viewBox="0 0 64 64"
912
- fill="none"
913
- xmlns="http://www.w3.org/2000/svg"
914
- >
915
- <path
916
- d="M32 8C18.745 8 8 18.745 8 32s10.745 24 24 24 24-10.745 24-24S45.255 8 32 8zm0 44c-11.028 0-20-8.972-20-20s8.972-20 20-20 20 8.972 20 20-8.972 20-20 20z"
917
- fill="currentColor"
918
- opacity="0.3"
919
- />
920
- <path
921
- d="M32 20c-1.105 0-2 .895-2 2v12c0 1.105.895 2 2 2s2-.895 2-2V22c0-1.105-.895-2-2-2zm0 20c-1.105 0-2 .895-2 2s.895 2 2 2 2-.895 2-2-.895-2-2-2z"
922
- fill="currentColor"
923
- />
924
- </svg>
925
- </div>
926
- `}
927
- <div class="empty-text">${t.emptyText}</div>
928
- </div>
929
- </td>
930
- </tr>
931
- `}(t.host):fe(t.rows,((n,s)=>wt`
932
- <tr>
933
- ${!t.expandable&&!t.expansionRenderer||t.selectionMode?t.selectionMode?ve(t.selectionMode,[["multiple",()=>wt`<td class="${i}" style="${e?"left: 0; width: 50px; min-width: 50px;":""}">
934
- <nr-checkbox
935
- @nr-change=${e=>t.onCheckOne(e,s)}
936
- .checked=${t.selectedItems[s+(t.currentPage-1)*t.itemPerPage]}
937
- ></nr-checkbox>
938
- </td>`],["single",()=>wt`<td class="${i}" style="${e?"left: 0; width: 50px; min-width: 50px;":""}">
939
- <nr-radio
940
- name="table-row-selection"
941
- value="${s}"
942
- @nr-change=${()=>t.onSelectOne(s)}
943
- .checked=${t.selectedItems[s+(t.currentPage-1)*t.itemPerPage]}
944
- ></nr-radio>
945
- </td>`]]):kt:wt`
946
- <td
947
- @click=${()=>t.onShowExpandedContent(s)}
948
- @keydown=${e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.onShowExpandedContent(s))}}
949
- tabindex="0"
950
- role="button"
951
- aria-expanded="${t.expand[s]}"
952
- aria-label="${t.expand[s]?"Collapse row":"Expand row"}"
953
- class="expand-icon ${t.expand[s]?"expanded":""} ${i}"
954
- style="${e?"left: 0; width: 50px; min-width: 50px;":""}">
955
- <nr-icon name="angle-down"></nr-icon>
956
- </td>
957
- `}
958
- ${fe(t.headers,((e,i)=>{const s=be(e),o=t.expandable||t.expansionRenderer||t.selectionMode,r="left"===e.fixed?ge(t.headers,i,!!o):void 0,a=e.width?"number"==typeof e.width?`${e.width}px`:e.width:void 0;return wt`${t.expandable!==e.key?wt`<td
959
- class="${s}"
960
- style="${void 0!==r?`left: ${r}px;`:""} ${a?`width: ${a}; min-width: ${a};`:""}">
961
- ${n[e.key]}
962
- </td>`:kt}`}))}
963
- </tr>
964
- ${t.expand[s]?wt`
965
- <tr class="expansion-row expanded">
966
- <td colspan=${t.headers.length+(t.expandable||t.expansionRenderer||t.selectionMode?1:0)}>
967
- <div class="expansion-content">
968
- ${t.expansionRenderer?t.expansionRenderer(n,s):t.expandable?n[t.expandable]:kt}
969
- </div>
970
- </td>
971
- </tr>
972
- `:kt}
973
- `))}
974
- </tbody>
975
- </table>
976
- `}
977
- /**
978
- * @license
979
- * Copyright 2023 Nuraly, Laabidi Aymen
980
- * SPDX-License-Identifier: MIT
981
- */
982
- var me=function(t,e,i,n){for(var s,o=arguments.length,r=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(s=t[a])&&(r=(o<3?s(r):o>3?s(e,i,r):s(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};let xe=class extends((t=>Yt(Wt(Gt(t))))(Vt)){constructor(){super(...arguments),this.rows=[],this.size="normal",this.withFilter=!1,this.fixedHeader=!1,this.loading=!1,this.emptyText="No data available",this.itemPerPage=[5,10,15,20],this.selectedItemPerPage=this.itemPerPage[0],this.displayedRows=[],this.selectedItems=[],this.rowsCopy=[],this.activeSearch=!1,this.sortAttribute={index:-1,order:"default"},this.expand=[],this.showFilterInput=!1,this.filterValue="",this.columnFilters=new Map,this.activeFilterColumn=null,this.requiredComponents=["nr-select","nr-icon","nr-checkbox","nr-radio"],this.selectionController=new te(this),this.paginationController=new ee(this),this.sortController=new ie(this),this.filterController=new ne(this)}connectedCallback(){super.connectedCallback(),this.selectionController.initSelection()}updated(t){var e,i;if(this.globalCheck&&(t.has("selectedItems")||t.has("currentPage")||t.has("displayedRows"))){const t=this.globalCheck,e=(this.currentPage-1)*this.selectedItemPerPage,i=Math.min(e+this.displayedRows.length,this.selectedItems.length),n=this.selectedItems.slice(e,i);n.length>0&&n.every((t=>t))?(t.checked=!0,t.indeterminate=!1):n.some((t=>t))?(t.checked=!1,t.indeterminate=!0):(t.checked=!1,t.indeterminate=!1)}this.showFilterInput&&t.has("showFilterInput")&&(null===(i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("input"))||void 0===i||i.focus())}willUpdate(t){t.has("rows")&&(this.expand=Array(this.rows.length).fill(!1)),t.has("sortAttribute")&&this.sortController.isSortActive()&&(this._initPagination(),this.selectionController.initSelection()),t.has("rowsCopy")&&this.filterController.isSearchActive()&&this._initPagination(),(t.has("activeSearch")||t.has("rows"))&&(this.filterController.isSearchActive()||(this.rowsCopy=[...this.rows],this._initPagination()))}_initPagination(){this.sortController.isSortActive()&&(this.sortController.isSortDefault()?this.sortController.resetSort():this.sortController.sort()),this.paginationController.initPagination()}_handleItemPerPage(t){const e=t.detail.value||t.detail.selectedItemPerPage;this.paginationController.handleItemPerPageChange(Number(e))}_handleUpdatePage(t){this.paginationController.handlePageChange(t.detail.page)}_handleCheckAll(t){this.selectionController.handleCheckAll(t.detail.isEveryItemChecked)}_handleCheckOne(t){this.selectionController.handleCheckOne(t.detail.index,t.detail.value)}_handleSelectOne(t){this.selectionController.handleSelectOne(t.detail.index)}_handleCancelSelection(){this.selectionController.cancelSelection()}_handleSearch(t){this.filterController.handleSearch(t.detail.value)}_handleSortOrder(t){this.sortController.handleSortOrderChange(t.detail.index)}_showExpandedContent(t){this.expand[t]=!this.expand[t],this.requestUpdate()}_toggleFilterInput(){this.showFilterInput=!this.showFilterInput}_handleFilterInputChange(t){this.filterValue=t.target.value,this.filterController.handleSearch(this.filterValue)}render(){var t,e;const i=Math.ceil(this.rowsCopy.length/this.selectedItemPerPage),n=this.currentPage>0?this.currentPage*this.selectedItemPerPage-this.selectedItemPerPage+1:0,s=this.currentPage*this.selectedItemPerPage<=this.rowsCopy.length?this.currentPage*this.selectedItemPerPage:this.rowsCopy.length,o=s<this.rowsCopy.length,r=n>1;return wt`
983
- ${this.selectionMode&&!this.withFilter&&this.selectionController.hasSelection()?(a={selectedItems:this.selectionController.getSelectedCount(),size:this.size,onCancelSelection:()=>this._handleCancelSelection()},wt`
984
- <div class="actions-container" data-size="${a.size}">
985
- <span>${a.selectedItems} selected</span>
986
- <button @click=${a.onCancelSelection}>Cancel</button>
987
- </div>
988
- `):this.withFilter?wt`
989
- <div class="filter-container">
990
- ${function(t){return wt`
991
- <div class="filter-container">
992
- ${t.showInput?wt`
993
- <nr-icon name="search" class="search-icon"></nr-icon>
994
- <input
995
- type="text"
996
- placeholder="search"
997
- @blur=${t.value.trim()?kt:t.onToggleInput}
998
- @input=${t.onChange}
999
- />
1000
- `:wt`
1001
- <div class="icon-container" @click=${t.onToggleInput}>
1002
- <nr-icon name="search"></nr-icon>
1003
- </div>
1004
- `}
1005
- </div>
1006
- `}({showInput:this.showFilterInput,value:this.filterValue,onToggleInput:()=>this._toggleFilterInput(),onChange:t=>this._handleFilterInputChange(t)})}
1007
- </div>
1008
- `:kt}
1009
-
1010
- <div class="table-content-wrapper ${this.fixedHeader?"fixed-header":""}"
1011
- style="${(null===(t=this.scrollConfig)||void 0===t?void 0:t.y)?`${this.fixedHeader?"height":"max-height"}: ${"number"==typeof this.scrollConfig.y?this.scrollConfig.y+"px":this.scrollConfig.y};`:""}
1012
- ${(null===(e=this.scrollConfig)||void 0===e?void 0:e.x)?`${this.fixedHeader?"width":"max-width"}: ${"number"==typeof this.scrollConfig.x?this.scrollConfig.x+"px":this.scrollConfig.x};`:""}">
1013
- ${ye({headers:this.headers,rows:this.displayedRows,expandable:this.expandable&&!this.selectionMode?this.expandable:void 0,expansionRenderer:this.selectionMode?void 0:this.expansionRenderer,selectionMode:this.selectionMode&&!this.withFilter?this.selectionMode:void 0,selectedItems:this.selectedItems,currentPage:this.currentPage,itemPerPage:this.selectedItemPerPage,sortAttribute:this.sortAttribute,expand:this.expand,columnFilters:this.columnFilters,activeFilterColumn:this.activeFilterColumn,loading:this.loading,host:this,onCheckAll:()=>{const t=(this.currentPage-1)*this.selectedItemPerPage,e=Math.min(t+this.selectedItemPerPage,this.selectedItems.length),i=this.selectedItems.slice(t,e),n=i.every((t=>t))&&i.length>0;this._handleCheckAll({detail:{isEveryItemChecked:n}})},onCheckOne:(t,e)=>this._handleCheckOne({detail:{index:e,value:t.detail.checked}}),onSelectOne:t=>this._handleSelectOne({detail:{index:t}}),onUpdateSort:t=>this._handleSortOrder({detail:{index:t}}),onShowExpandedContent:t=>this._showExpandedContent(t),onToggleColumnFilter:t=>this.filterController.toggleColumnFilterDropdown(t),onApplyColumnFilter:(t,e)=>this.filterController.applyColumnFilter(t,e),onClearColumnFilter:t=>this.filterController.clearColumnFilter(t)})}
1014
- </div>
1015
-
1016
- ${function(t){const e=t.itemPerPage.map((t=>({label:String(t),value:String(t)})));return wt`
1017
- <div class="pagination-container" data-size="${t.size}">
1018
- <div class="left-content">
1019
- <span class="select-details">
1020
- <label>Items per page:</label>
1021
- <nr-select
1022
- .options=${e}
1023
- .value=${String(t.selectedItemPerPage)}
1024
- size="small"
1025
- @nr-change=${t.onItemPerPageChange}
1026
- ></nr-select>
1027
- </span>
1028
- <span class="items-details">
1029
- ${t.fromItem} - ${t.toItem} of ${t.numberOfItems} items
1030
- </span>
1031
- </div>
1032
-
1033
- <div class="right-content">
1034
- <span class="page-details">
1035
- ${t.currentPage} of ${t.numberOfPages} pages
1036
- </span>
1037
- <span class="icon-container">
1038
- <nr-icon
1039
- class="left-arrow"
1040
- data-enabled=${t.enablePrevious}
1041
- name="caret-left"
1042
- @click=${t.enablePrevious?t.onPreviousPage:kt}
1043
- ></nr-icon>
1044
-
1045
- <nr-icon
1046
- class="right-arrow"
1047
- data-enabled=${t.enableNext}
1048
- name="caret-right"
1049
- @click=${t.enableNext?t.onNextPage:kt}
1050
- ></nr-icon>
1051
- </span>
1052
- </div>
1053
- </div>
1054
- `}({numberOfItems:this.rowsCopy.length,itemPerPage:this.itemPerPage,selectedItemPerPage:this.selectedItemPerPage,currentPage:this.currentPage,size:this.size,numberOfPages:i,fromItem:n,toItem:s,enableNext:o,enablePrevious:r,onItemPerPageChange:t=>this._handleItemPerPage(t),onNextPage:()=>{this.currentPage++,this._handleUpdatePage({detail:{page:this.currentPage}})},onPreviousPage:()=>{this.currentPage--,this._handleUpdatePage({detail:{page:this.currentPage}})}})}
1055
- `;var a}};xe.styles=Qt,me([Bt({type:Array})],xe.prototype,"headers",void 0),me([Bt({type:Array})],xe.prototype,"rows",void 0),me([Bt({type:String})],xe.prototype,"size",void 0),me([Bt({type:Boolean})],xe.prototype,"withFilter",void 0),me([Bt({type:String})],xe.prototype,"expandable",void 0),me([Bt({attribute:!1})],xe.prototype,"expansionRenderer",void 0),me([Bt({type:String})],xe.prototype,"selectionMode",void 0),me([Bt({type:Boolean})],xe.prototype,"fixedHeader",void 0),me([Bt({type:Object})],xe.prototype,"scrollConfig",void 0),me([Bt({type:Boolean})],xe.prototype,"loading",void 0),me([Bt({type:String})],xe.prototype,"emptyText",void 0),me([Bt({type:String})],xe.prototype,"emptyIcon",void 0),me([Ht()],xe.prototype,"itemPerPage",void 0),me([Ht()],xe.prototype,"selectedItemPerPage",void 0),me([Ht()],xe.prototype,"displayedRows",void 0),me([Ht()],xe.prototype,"selectedItems",void 0),me([Ht()],xe.prototype,"currentPage",void 0),me([Ht()],xe.prototype,"rowsCopy",void 0),me([Ht()],xe.prototype,"activeSearch",void 0),me([Ht()],xe.prototype,"sortAttribute",void 0),me([Ht()],xe.prototype,"expand",void 0),me([Ht()],xe.prototype,"showFilterInput",void 0),me([Ht()],xe.prototype,"filterValue",void 0),me([Ht()],xe.prototype,"columnFilters",void 0),me([Ht()],xe.prototype,"activeFilterColumn",void 0),me([
1056
- /**
1057
- * @license
1058
- * Copyright 2017 Google LLC
1059
- * SPDX-License-Identifier: BSD-3-Clause
1060
37
  */
1061
- function(t,e){return(({finisher:t,descriptor:e})=>(i,n)=>{var s;if(void 0===n){const n=null!==(s=i.originalKey)&&void 0!==s?s:i.key,o=null!=e?{kind:"method",placement:"prototype",key:n,descriptor:e(i.key)}:{...i,key:n};return null!=t&&(o.finisher=function(e){t(e,n)}),o}{const s=i.constructor;void 0!==e&&Object.defineProperty(i,n,e(n)),null==t||t(s,n)}})({descriptor:i=>{const n={get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==i?i:null},enumerable:!0,configurable:!0};if(e){const e="symbol"==typeof i?Symbol():"__"+i;n.get=function(){var i,n;return void 0===this[e]&&(this[e]=null!==(n=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(t))&&void 0!==n?n:null),this[e]}}return n}})}("#global-check")],xe.prototype,"globalCheck",void 0),xe=me([(t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:n}=e;return{kind:i,elements:n,finisher(e){customElements.define(t,e)}}})(t,e))("nr-table")],xe);export{xe as HyTable};
38
+ var y=function(t,e,i,n){for(var r,a=arguments.length,o=a<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,l=t.length-1;l>=0;l--)(r=t[l])&&(o=(a<3?r(o):a>3?r(e,i,o):r(e,i))||o);return a>3&&o&&Object.defineProperty(e,i,o),o};let w=class extends(s(n)){constructor(){super(...arguments),this.rows=[],this.size="normal",this.withFilter=!1,this.fixedHeader=!1,this.loading=!1,this.emptyText="No data available",this.itemPerPage=[5,10,15,20],this.selectedItemPerPage=this.itemPerPage[0],this.displayedRows=[],this.selectedItems=[],this.rowsCopy=[],this.activeSearch=!1,this.sortAttribute={index:-1,order:"default"},this.expand=[],this.showFilterInput=!1,this.filterValue="",this.columnFilters=new Map,this.activeFilterColumn=null,this.requiredComponents=["nr-select","nr-icon","nr-checkbox","nr-radio"],this.selectionController=new u(this),this.paginationController=new f(this),this.sortController=new g(this),this.filterController=new b(this)}connectedCallback(){super.connectedCallback(),this.selectionController.initSelection()}updated(t){var e,i;if(this.globalCheck&&(t.has("selectedItems")||t.has("currentPage")||t.has("displayedRows"))){const t=this.globalCheck,e=(this.currentPage-1)*this.selectedItemPerPage,i=Math.min(e+this.displayedRows.length,this.selectedItems.length),n=this.selectedItems.slice(e,i);n.length>0&&n.every((t=>t))?(t.checked=!0,t.indeterminate=!1):n.some((t=>t))?(t.checked=!1,t.indeterminate=!0):(t.checked=!1,t.indeterminate=!1)}this.showFilterInput&&t.has("showFilterInput")&&(null===(i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("input"))||void 0===i||i.focus())}willUpdate(t){t.has("rows")&&(this.expand=Array(this.rows.length).fill(!1)),t.has("sortAttribute")&&this.sortController.isSortActive()&&(this._initPagination(),this.selectionController.initSelection()),t.has("rowsCopy")&&this.filterController.isSearchActive()&&this._initPagination(),(t.has("activeSearch")||t.has("rows"))&&(this.filterController.isSearchActive()||(this.rowsCopy=[...this.rows],this._initPagination()))}_initPagination(){this.sortController.isSortActive()&&(this.sortController.isSortDefault()?this.sortController.resetSort():this.sortController.sort()),this.paginationController.initPagination()}_handleItemPerPage(t){const e=t.detail.value||t.detail.selectedItemPerPage;this.paginationController.handleItemPerPageChange(Number(e))}_handleUpdatePage(t){this.paginationController.handlePageChange(t.detail.page)}_handleCheckAll(t){this.selectionController.handleCheckAll(t.detail.isEveryItemChecked)}_handleCheckOne(t){this.selectionController.handleCheckOne(t.detail.index,t.detail.value)}_handleSelectOne(t){this.selectionController.handleSelectOne(t.detail.index)}_handleCancelSelection(){this.selectionController.cancelSelection()}_handleSearch(t){this.filterController.handleSearch(t.detail.value)}_handleSortOrder(t){this.sortController.handleSortOrderChange(t.detail.index)}_showExpandedContent(t){this.expand[t]=!this.expand[t],this.requestUpdate()}_toggleFilterInput(){this.showFilterInput=!this.showFilterInput}_handleFilterInputChange(t){this.filterValue=t.target.value,this.filterController.handleSearch(this.filterValue)}render(){var t,n;const r=Math.ceil(this.rowsCopy.length/this.selectedItemPerPage),a=this.currentPage>0?this.currentPage*this.selectedItemPerPage-this.selectedItemPerPage+1:0,o=this.currentPage*this.selectedItemPerPage<=this.rowsCopy.length?this.currentPage*this.selectedItemPerPage:this.rowsCopy.length,l=o<this.rowsCopy.length,s=a>1;return e`${this.selectionMode&&!this.withFilter&&this.selectionController.hasSelection()?(c={selectedItems:this.selectionController.getSelectedCount(),size:this.size,onCancelSelection:()=>this._handleCancelSelection()},e`<div class="actions-container" data-size="${c.size}"><span>${c.selectedItems} selected</span> <button @click="${c.onCancelSelection}">Cancel</button></div>`):this.withFilter?e`<div class="filter-container">${function(t){return e`<div class="filter-container">${t.showInput?e`<nr-icon name="search" class="search-icon"></nr-icon><input type="text" placeholder="search" @blur="${t.value.trim()?i:t.onToggleInput}" @input="${t.onChange}">`:e`<div class="icon-container" @click="${t.onToggleInput}"><nr-icon name="search"></nr-icon></div>`}</div>`}({showInput:this.showFilterInput,value:this.filterValue,onToggleInput:()=>this._toggleFilterInput(),onChange:t=>this._handleFilterInputChange(t)})}</div>`:i}<div class="table-content-wrapper ${this.fixedHeader?"fixed-header":""}" style="${(null===(t=this.scrollConfig)||void 0===t?void 0:t.y)?`${this.fixedHeader?"height":"max-height"}: ${"number"==typeof this.scrollConfig.y?this.scrollConfig.y+"px":this.scrollConfig.y};`:""}${(null===(n=this.scrollConfig)||void 0===n?void 0:n.x)?`${this.fixedHeader?"width":"max-width"}: ${"number"==typeof this.scrollConfig.x?this.scrollConfig.x+"px":this.scrollConfig.x};`:""}">${m({headers:this.headers,rows:this.displayedRows,expandable:this.expandable&&!this.selectionMode?this.expandable:void 0,expansionRenderer:this.selectionMode?void 0:this.expansionRenderer,selectionMode:this.selectionMode&&!this.withFilter?this.selectionMode:void 0,selectedItems:this.selectedItems,currentPage:this.currentPage,itemPerPage:this.selectedItemPerPage,sortAttribute:this.sortAttribute,expand:this.expand,columnFilters:this.columnFilters,activeFilterColumn:this.activeFilterColumn,loading:this.loading,host:this,onCheckAll:()=>{const t=(this.currentPage-1)*this.selectedItemPerPage,e=Math.min(t+this.selectedItemPerPage,this.selectedItems.length),i=this.selectedItems.slice(t,e),n=i.every((t=>t))&&i.length>0;this._handleCheckAll({detail:{isEveryItemChecked:n}})},onCheckOne:(t,e)=>this._handleCheckOne({detail:{index:e,value:t.detail.checked}}),onSelectOne:t=>this._handleSelectOne({detail:{index:t}}),onUpdateSort:t=>this._handleSortOrder({detail:{index:t}}),onShowExpandedContent:t=>this._showExpandedContent(t),onToggleColumnFilter:t=>this.filterController.toggleColumnFilterDropdown(t),onApplyColumnFilter:(t,e)=>this.filterController.applyColumnFilter(t,e),onClearColumnFilter:t=>this.filterController.clearColumnFilter(t)})}</div>${function(t){const n=t.itemPerPage.map((t=>({label:String(t),value:String(t)})));return e`<div class="pagination-container" data-size="${t.size}"><div class="left-content"><span class="select-details"><label>Items per page:</label><nr-select .options="${n}" .value="${String(t.selectedItemPerPage)}" size="small" @nr-change="${t.onItemPerPageChange}"></nr-select></span><span class="items-details">${t.fromItem} - ${t.toItem} of ${t.numberOfItems} items</span></div><div class="right-content"><span class="page-details">${t.currentPage} of ${t.numberOfPages} pages </span><span class="icon-container"><nr-icon class="left-arrow" data-enabled="${t.enablePrevious}" name="caret-left" @click="${t.enablePrevious?t.onPreviousPage:i}"></nr-icon><nr-icon class="right-arrow" data-enabled="${t.enableNext}" name="caret-right" @click="${t.enableNext?t.onNextPage:i}"></nr-icon></span></div></div>`}({numberOfItems:this.rowsCopy.length,itemPerPage:this.itemPerPage,selectedItemPerPage:this.selectedItemPerPage,currentPage:this.currentPage,size:this.size,numberOfPages:r,fromItem:a,toItem:o,enableNext:l,enablePrevious:s,onItemPerPageChange:t=>this._handleItemPerPage(t),onNextPage:()=>{this.currentPage++,this._handleUpdatePage({detail:{page:this.currentPage}})},onPreviousPage:()=>{this.currentPage--,this._handleUpdatePage({detail:{page:this.currentPage}})}})}`;var c}};w.styles=h,y([r({type:Array})],w.prototype,"headers",void 0),y([r({type:Array})],w.prototype,"rows",void 0),y([r({type:String})],w.prototype,"size",void 0),y([r({type:Boolean})],w.prototype,"withFilter",void 0),y([r({type:String})],w.prototype,"expandable",void 0),y([r({attribute:!1})],w.prototype,"expansionRenderer",void 0),y([r({type:String})],w.prototype,"selectionMode",void 0),y([r({type:Boolean})],w.prototype,"fixedHeader",void 0),y([r({type:Object})],w.prototype,"scrollConfig",void 0),y([r({type:Boolean})],w.prototype,"loading",void 0),y([r({type:String})],w.prototype,"emptyText",void 0),y([r({type:String})],w.prototype,"emptyIcon",void 0),y([a()],w.prototype,"itemPerPage",void 0),y([a()],w.prototype,"selectedItemPerPage",void 0),y([a()],w.prototype,"displayedRows",void 0),y([a()],w.prototype,"selectedItems",void 0),y([a()],w.prototype,"currentPage",void 0),y([a()],w.prototype,"rowsCopy",void 0),y([a()],w.prototype,"activeSearch",void 0),y([a()],w.prototype,"sortAttribute",void 0),y([a()],w.prototype,"expand",void 0),y([a()],w.prototype,"showFilterInput",void 0),y([a()],w.prototype,"filterValue",void 0),y([a()],w.prototype,"columnFilters",void 0),y([a()],w.prototype,"activeFilterColumn",void 0),y([o("#global-check")],w.prototype,"globalCheck",void 0),w=y([l("nr-table")],w);export{w as HyTable};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuralyui/table",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",