@nuralyui/table 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.js +97 -185
- package/package.json +1 -1
package/bundle.js
CHANGED
|
@@ -1,70 +1,4 @@
|
|
|
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;
|
|
57
|
-
/**
|
|
58
|
-
* @license
|
|
59
|
-
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
60
|
-
* SPDX-License-Identifier: MIT
|
|
61
|
-
*/
|
|
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}};
|
|
63
|
-
/**
|
|
64
|
-
* @license
|
|
65
|
-
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
66
|
-
* 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)})`
|
|
1
|
+
import{css as t,html as e,nothing as n,LitElement as i}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`
|
|
68
2
|
:host {
|
|
69
3
|
display: block;
|
|
70
4
|
width: 100%;
|
|
@@ -755,123 +689,107 @@ const Wt=t=>class extends t{constructor(){super(...arguments),this.handleSystemT
|
|
|
755
689
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
756
690
|
* SPDX-License-Identifier: MIT
|
|
757
691
|
*/
|
|
758
|
-
class
|
|
692
|
+
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}}}
|
|
759
693
|
/**
|
|
760
694
|
* @license
|
|
761
695
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
762
696
|
* SPDX-License-Identifier: MIT
|
|
763
|
-
*/class
|
|
697
|
+
*/class f 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,n=Math.min(e+this.host.selectedItemPerPage,this.host.selectedItems.length),i=[...this.host.selectedItems];for(let r=e;r<n;r++)i[r]=!t;this.host.selectedItems=i;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 n=t+(this.host.currentPage-1)*this.host.selectedItemPerPage;this.host.selectedItems[n]=e,this.host.selectedItems=[...this.host.selectedItems];const i=this.host.rowsCopy.filter(((t,e)=>this.host.selectedItems[e]));this.dispatchEvent(new CustomEvent("nr-select",{bubbles:!0,composed:!0,detail:{value:i}})),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 n=t+(this.host.currentPage-1)*this.host.selectedItemPerPage;this.host.selectedItems[n]=!0,this.host.selectedItems=[...this.host.selectedItems];const i=this.host.rowsCopy.filter(((t,e)=>this.host.selectedItems[e]));this.dispatchEvent(new CustomEvent("nr-select",{bubbles:!0,composed:!0,detail:{value:i}})),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}}
|
|
764
698
|
/**
|
|
765
699
|
* @license
|
|
766
700
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
767
701
|
* SPDX-License-Identifier: MIT
|
|
768
|
-
*/class
|
|
702
|
+
*/class u 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,n=e+this.host.selectedItemPerPage;this.host.displayedRows=this.host.rowsCopy.slice(e,n),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}}
|
|
769
703
|
/**
|
|
770
704
|
* @license
|
|
771
705
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
772
706
|
* SPDX-License-Identifier: MIT
|
|
773
|
-
*/class
|
|
707
|
+
*/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,n)=>{const i=this.host.headers[this.host.sortAttribute.index].key,r=JSON.stringify(e[i]),a=JSON.stringify(n[i]);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 n=this.host.rows.findIndex((e=>JSON.stringify(e)===JSON.stringify(t))),i=this.host.rows.findIndex((t=>JSON.stringify(t)===JSON.stringify(e)));return n>i?1:n<i?-1:0})),this.requestUpdate()}catch(t){this.handleError(t,"resetSort")}}isSortActive(){return this.host.sortAttribute.index>-1}isSortDefault(){return"default"===this.host.sortAttribute.order}}
|
|
774
708
|
/**
|
|
775
709
|
* @license
|
|
776
710
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
777
711
|
* SPDX-License-Identifier: MIT
|
|
778
|
-
*/class
|
|
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`
|
|
712
|
+
*/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,n])=>{const i=t[e];if(null==i)return!1;const r=String(i).toLowerCase(),a=String(n).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,n){let i=0;n&&(i+=50);for(let n=0;n<e;n++)if("left"===t[n].fixed){const e=t[n].width;i+="number"==typeof e?e:parseInt(String(e))||150}return i}function m(t){const e=[];return t.fixed&&(e.push("fixed-column"),e.push(`fixed-column-${t.fixed}`)),e.join(" ")}function y(t){const i=t.headers.some((t=>"left"===t.fixed)),r=i?"fixed-column fixed-column-left":"";return e`
|
|
795
713
|
<table>
|
|
796
714
|
<thead>
|
|
797
715
|
<tr>
|
|
798
|
-
${t.expandable||t.expansionRenderer||t.selectionMode?
|
|
799
|
-
${"multiple"===t.selectionMode?
|
|
716
|
+
${t.expandable||t.expansionRenderer||t.selectionMode?e`<th class="${r}" style="${i?"left: 0; width: 50px; min-width: 50px;":""}">
|
|
717
|
+
${"multiple"===t.selectionMode?e`<nr-checkbox
|
|
800
718
|
id="global-check"
|
|
801
719
|
@nr-change=${t.onCheckAll}
|
|
802
|
-
></nr-checkbox>`:
|
|
803
|
-
</th>`:
|
|
804
|
-
${
|
|
805
|
-
${t.expandable!==
|
|
806
|
-
class="${[
|
|
807
|
-
style="${void 0!==
|
|
720
|
+
></nr-checkbox>`:n}
|
|
721
|
+
</th>`:n}
|
|
722
|
+
${c(t.headers,((i,r)=>{const a=m(i),o=t.expandable||t.expansionRenderer||t.selectionMode,l="left"===i.fixed?x(t.headers,r,!!o):void 0,s=i.width?"number"==typeof i.width?`${i.width}px`:i.width:void 0;return e`
|
|
723
|
+
${t.expandable!==i.key?e`<th
|
|
724
|
+
class="${[i.filterable?"filterable":"",a].filter(Boolean).join(" ")}"
|
|
725
|
+
style="${void 0!==l?`left: ${l}px;`:""} ${s?`width: ${s}; min-width: ${s};`:""}">
|
|
808
726
|
<div class="th-content">
|
|
809
|
-
<span class="th-text" @click=${()=>t.onUpdateSort(
|
|
810
|
-
${
|
|
811
|
-
${
|
|
727
|
+
<span class="th-text" @click=${()=>t.onUpdateSort(r)}>
|
|
728
|
+
${i.name}
|
|
729
|
+
${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>`}
|
|
812
730
|
</span>
|
|
813
|
-
${
|
|
731
|
+
${i.filterable&&i.filterConfig?e`
|
|
814
732
|
<div class="filter-wrapper">
|
|
815
733
|
<button
|
|
816
734
|
class="filter-trigger"
|
|
817
|
-
@click=${
|
|
735
|
+
@click=${e=>{e.stopPropagation(),t.onToggleColumnFilter(i.key)}}
|
|
818
736
|
>
|
|
819
|
-
${t.activeFilterColumn,
|
|
820
|
-
<span class="filter-icon ${
|
|
737
|
+
${t.activeFilterColumn,i.key,c=t.columnFilters.has(i.key),e`
|
|
738
|
+
<span class="filter-icon ${c?"has-filter":""}">
|
|
821
739
|
<nr-icon name="filter"></nr-icon>
|
|
822
|
-
${
|
|
740
|
+
${c?e`<span class="filter-indicator"></span>`:n}
|
|
823
741
|
</span>
|
|
824
742
|
`}
|
|
825
743
|
</button>
|
|
826
|
-
${t.activeFilterColumn===
|
|
744
|
+
${t.activeFilterColumn===i.key?function(t){const{filterConfig:i,currentValue:r,onFilterChange:a,onClearFilter:o}=t;return e`
|
|
827
745
|
<div class="column-filter-dropdown">
|
|
828
746
|
<div class="column-filter-content">
|
|
829
|
-
${"select"===
|
|
747
|
+
${"select"===i.type?e`
|
|
830
748
|
<nr-select
|
|
831
|
-
.options=${
|
|
832
|
-
.value=${
|
|
833
|
-
placeholder=${
|
|
834
|
-
@nr-change=${t=>
|
|
749
|
+
.options=${i.options||[]}
|
|
750
|
+
.value=${r||""}
|
|
751
|
+
placeholder=${i.placeholder||"Filter..."}
|
|
752
|
+
@nr-change=${t=>a(t.detail.value)}
|
|
835
753
|
></nr-select>
|
|
836
|
-
`:"number"===
|
|
754
|
+
`:"number"===i.type?e`
|
|
837
755
|
<input
|
|
838
756
|
type="number"
|
|
839
757
|
class="column-filter-input"
|
|
840
|
-
placeholder=${
|
|
841
|
-
.value=${
|
|
842
|
-
@input=${t=>
|
|
758
|
+
placeholder=${i.placeholder||"Filter by number..."}
|
|
759
|
+
.value=${r||""}
|
|
760
|
+
@input=${t=>a(t.target.value)}
|
|
843
761
|
/>
|
|
844
|
-
`:"date"===
|
|
762
|
+
`:"date"===i.type?e`
|
|
845
763
|
<input
|
|
846
764
|
type="date"
|
|
847
765
|
class="column-filter-input"
|
|
848
|
-
placeholder=${
|
|
849
|
-
.value=${
|
|
850
|
-
@input=${t=>
|
|
766
|
+
placeholder=${i.placeholder||"Filter by date..."}
|
|
767
|
+
.value=${r||""}
|
|
768
|
+
@input=${t=>a(t.target.value)}
|
|
851
769
|
/>
|
|
852
|
-
`:
|
|
770
|
+
`:e`
|
|
853
771
|
<input
|
|
854
772
|
type="text"
|
|
855
773
|
class="column-filter-input"
|
|
856
|
-
placeholder=${
|
|
857
|
-
.value=${
|
|
858
|
-
@input=${t=>
|
|
774
|
+
placeholder=${i.placeholder||"Filter..."}
|
|
775
|
+
.value=${r||""}
|
|
776
|
+
@input=${t=>a(t.target.value)}
|
|
859
777
|
/>
|
|
860
778
|
`}
|
|
861
779
|
|
|
862
|
-
${
|
|
863
|
-
<button class="column-filter-clear" @click=${
|
|
780
|
+
${r?e`
|
|
781
|
+
<button class="column-filter-clear" @click=${o}>
|
|
864
782
|
<nr-icon name="times"></nr-icon>
|
|
865
783
|
</button>
|
|
866
|
-
`:
|
|
784
|
+
`:n}
|
|
867
785
|
</div>
|
|
868
786
|
</div>
|
|
869
|
-
`}({columnKey:
|
|
787
|
+
`}({columnKey:i.key,filterConfig:i.filterConfig,currentValue:t.columnFilters.get(i.key),isActive:!0,onFilterChange:e=>t.onApplyColumnFilter(i.key,e),onClearFilter:()=>t.onClearColumnFilter(i.key)}):n}
|
|
870
788
|
</div>
|
|
871
|
-
`:
|
|
789
|
+
`:n}
|
|
872
790
|
</div>
|
|
873
|
-
</th>`:
|
|
874
|
-
`;var
|
|
791
|
+
</th>`:n}
|
|
792
|
+
`;var c;
|
|
875
793
|
/**
|
|
876
794
|
* @license
|
|
877
795
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
@@ -880,30 +798,30 @@ const se=2;class oe{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i)
|
|
|
880
798
|
</tr>
|
|
881
799
|
</thead>
|
|
882
800
|
<tbody>
|
|
883
|
-
${t.loading?function(t,
|
|
884
|
-
${Array.from({length:
|
|
801
|
+
${t.loading?function(t,n=5){const i=!!t.selectionMode;return e`
|
|
802
|
+
${Array.from({length:n},(()=>e`
|
|
885
803
|
<tr class="skeleton-row">
|
|
886
|
-
${i?
|
|
804
|
+
${i?e`
|
|
887
805
|
<td class="skeleton-cell selection-skeleton">
|
|
888
806
|
<div class="skeleton-checkbox"></div>
|
|
889
807
|
</td>
|
|
890
808
|
`:""}
|
|
891
|
-
${t.headers.map((()=>
|
|
809
|
+
${t.headers.map((()=>e`
|
|
892
810
|
<td class="skeleton-cell">
|
|
893
811
|
<div class="skeleton-content"></div>
|
|
894
812
|
</td>
|
|
895
813
|
`))}
|
|
896
814
|
</tr>
|
|
897
815
|
`))}
|
|
898
|
-
`}(t.host,5):0===t.rows.length?function(t){const
|
|
816
|
+
`}(t.host,5):0===t.rows.length?function(t){const n=t.headers.length+(t.selectionMode?1:0);return e`
|
|
899
817
|
<tr class="empty-row">
|
|
900
|
-
<td colspan="${
|
|
818
|
+
<td colspan="${n}" class="empty-cell">
|
|
901
819
|
<div class="empty-state">
|
|
902
|
-
${t.emptyIcon?
|
|
820
|
+
${t.emptyIcon?e`
|
|
903
821
|
<div class="empty-icon">
|
|
904
822
|
<nr-icon name="${t.emptyIcon}"></nr-icon>
|
|
905
823
|
</div>
|
|
906
|
-
`:
|
|
824
|
+
`:e`
|
|
907
825
|
<div class="empty-icon">
|
|
908
826
|
<svg
|
|
909
827
|
width="64"
|
|
@@ -928,48 +846,48 @@ const se=2;class oe{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i)
|
|
|
928
846
|
</div>
|
|
929
847
|
</td>
|
|
930
848
|
</tr>
|
|
931
|
-
`}(t.host):
|
|
849
|
+
`}(t.host):c(t.rows,((a,o)=>e`
|
|
932
850
|
<tr>
|
|
933
|
-
${!t.expandable&&!t.expansionRenderer||t.selectionMode?t.selectionMode?
|
|
851
|
+
${!t.expandable&&!t.expansionRenderer||t.selectionMode?t.selectionMode?d(t.selectionMode,[["multiple",()=>e`<td class="${r}" style="${i?"left: 0; width: 50px; min-width: 50px;":""}">
|
|
934
852
|
<nr-checkbox
|
|
935
|
-
@nr-change=${e=>t.onCheckOne(e,
|
|
936
|
-
.checked=${t.selectedItems[
|
|
853
|
+
@nr-change=${e=>t.onCheckOne(e,o)}
|
|
854
|
+
.checked=${t.selectedItems[o+(t.currentPage-1)*t.itemPerPage]}
|
|
937
855
|
></nr-checkbox>
|
|
938
|
-
</td>`],["single",()=>
|
|
856
|
+
</td>`],["single",()=>e`<td class="${r}" style="${i?"left: 0; width: 50px; min-width: 50px;":""}">
|
|
939
857
|
<nr-radio
|
|
940
858
|
name="table-row-selection"
|
|
941
|
-
value="${
|
|
942
|
-
@nr-change=${()=>t.onSelectOne(
|
|
943
|
-
.checked=${t.selectedItems[
|
|
859
|
+
value="${o}"
|
|
860
|
+
@nr-change=${()=>t.onSelectOne(o)}
|
|
861
|
+
.checked=${t.selectedItems[o+(t.currentPage-1)*t.itemPerPage]}
|
|
944
862
|
></nr-radio>
|
|
945
|
-
</td>`]]):
|
|
863
|
+
</td>`]]):n:e`
|
|
946
864
|
<td
|
|
947
|
-
@click=${()=>t.onShowExpandedContent(
|
|
948
|
-
@keydown=${e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.onShowExpandedContent(
|
|
865
|
+
@click=${()=>t.onShowExpandedContent(o)}
|
|
866
|
+
@keydown=${e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.onShowExpandedContent(o))}}
|
|
949
867
|
tabindex="0"
|
|
950
868
|
role="button"
|
|
951
|
-
aria-expanded="${t.expand[
|
|
952
|
-
aria-label="${t.expand[
|
|
953
|
-
class="expand-icon ${t.expand[
|
|
954
|
-
style="${
|
|
869
|
+
aria-expanded="${t.expand[o]}"
|
|
870
|
+
aria-label="${t.expand[o]?"Collapse row":"Expand row"}"
|
|
871
|
+
class="expand-icon ${t.expand[o]?"expanded":""} ${r}"
|
|
872
|
+
style="${i?"left: 0; width: 50px; min-width: 50px;":""}">
|
|
955
873
|
<nr-icon name="angle-down"></nr-icon>
|
|
956
874
|
</td>
|
|
957
875
|
`}
|
|
958
|
-
${
|
|
959
|
-
class="${
|
|
960
|
-
style="${void 0!==
|
|
961
|
-
${
|
|
962
|
-
</td>`:
|
|
876
|
+
${c(t.headers,((i,r)=>{const o=m(i),l=t.expandable||t.expansionRenderer||t.selectionMode,s="left"===i.fixed?x(t.headers,r,!!l):void 0,c=i.width?"number"==typeof i.width?`${i.width}px`:i.width:void 0;return e`${t.expandable!==i.key?e`<td
|
|
877
|
+
class="${o}"
|
|
878
|
+
style="${void 0!==s?`left: ${s}px;`:""} ${c?`width: ${c}; min-width: ${c};`:""}">
|
|
879
|
+
${a[i.key]}
|
|
880
|
+
</td>`:n}`}))}
|
|
963
881
|
</tr>
|
|
964
|
-
${t.expand[
|
|
882
|
+
${t.expand[o]?e`
|
|
965
883
|
<tr class="expansion-row expanded">
|
|
966
884
|
<td colspan=${t.headers.length+(t.expandable||t.expansionRenderer||t.selectionMode?1:0)}>
|
|
967
885
|
<div class="expansion-content">
|
|
968
|
-
${t.expansionRenderer?t.expansionRenderer(
|
|
886
|
+
${t.expansionRenderer?t.expansionRenderer(a,o):t.expandable?a[t.expandable]:n}
|
|
969
887
|
</div>
|
|
970
888
|
</td>
|
|
971
889
|
</tr>
|
|
972
|
-
`:
|
|
890
|
+
`:n}
|
|
973
891
|
`))}
|
|
974
892
|
</tbody>
|
|
975
893
|
</table>
|
|
@@ -979,25 +897,25 @@ const se=2;class oe{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i)
|
|
|
979
897
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
980
898
|
* SPDX-License-Identifier: MIT
|
|
981
899
|
*/
|
|
982
|
-
var
|
|
983
|
-
${this.selectionMode&&!this.withFilter&&this.selectionController.hasSelection()?(
|
|
984
|
-
<div class="actions-container" data-size="${
|
|
985
|
-
<span>${
|
|
986
|
-
<button @click=${
|
|
900
|
+
var v=function(t,e,n,i){for(var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i,l=t.length-1;l>=0;l--)(r=t[l])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o};let w=class extends(s(i)){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 f(this),this.paginationController=new u(this),this.sortController=new g(this),this.filterController=new b(this)}connectedCallback(){super.connectedCallback(),this.selectionController.initSelection()}updated(t){var e,n;if(this.globalCheck&&(t.has("selectedItems")||t.has("currentPage")||t.has("displayedRows"))){const t=this.globalCheck,e=(this.currentPage-1)*this.selectedItemPerPage,n=Math.min(e+this.displayedRows.length,this.selectedItems.length),i=this.selectedItems.slice(e,n);i.length>0&&i.every((t=>t))?(t.checked=!0,t.indeterminate=!1):i.some((t=>t))?(t.checked=!1,t.indeterminate=!0):(t.checked=!1,t.indeterminate=!1)}this.showFilterInput&&t.has("showFilterInput")&&(null===(n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("input"))||void 0===n||n.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,i;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`
|
|
901
|
+
${this.selectionMode&&!this.withFilter&&this.selectionController.hasSelection()?(c={selectedItems:this.selectionController.getSelectedCount(),size:this.size,onCancelSelection:()=>this._handleCancelSelection()},e`
|
|
902
|
+
<div class="actions-container" data-size="${c.size}">
|
|
903
|
+
<span>${c.selectedItems} selected</span>
|
|
904
|
+
<button @click=${c.onCancelSelection}>Cancel</button>
|
|
987
905
|
</div>
|
|
988
|
-
`):this.withFilter?
|
|
906
|
+
`):this.withFilter?e`
|
|
989
907
|
<div class="filter-container">
|
|
990
|
-
${function(t){return
|
|
908
|
+
${function(t){return e`
|
|
991
909
|
<div class="filter-container">
|
|
992
|
-
${t.showInput?
|
|
910
|
+
${t.showInput?e`
|
|
993
911
|
<nr-icon name="search" class="search-icon"></nr-icon>
|
|
994
912
|
<input
|
|
995
913
|
type="text"
|
|
996
914
|
placeholder="search"
|
|
997
|
-
@blur=${t.value.trim()?
|
|
915
|
+
@blur=${t.value.trim()?n:t.onToggleInput}
|
|
998
916
|
@input=${t.onChange}
|
|
999
917
|
/>
|
|
1000
|
-
`:
|
|
918
|
+
`:e`
|
|
1001
919
|
<div class="icon-container" @click=${t.onToggleInput}>
|
|
1002
920
|
<nr-icon name="search"></nr-icon>
|
|
1003
921
|
</div>
|
|
@@ -1005,21 +923,21 @@ var me=function(t,e,i,n){for(var s,o=arguments.length,r=o<3?e:null===n?n=Object.
|
|
|
1005
923
|
</div>
|
|
1006
924
|
`}({showInput:this.showFilterInput,value:this.filterValue,onToggleInput:()=>this._toggleFilterInput(),onChange:t=>this._handleFilterInputChange(t)})}
|
|
1007
925
|
</div>
|
|
1008
|
-
`:
|
|
926
|
+
`:n}
|
|
1009
927
|
|
|
1010
928
|
<div class="table-content-wrapper ${this.fixedHeader?"fixed-header":""}"
|
|
1011
929
|
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===(
|
|
1013
|
-
${
|
|
930
|
+
${(null===(i=this.scrollConfig)||void 0===i?void 0:i.x)?`${this.fixedHeader?"width":"max-width"}: ${"number"==typeof this.scrollConfig.x?this.scrollConfig.x+"px":this.scrollConfig.x};`:""}">
|
|
931
|
+
${y({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),n=this.selectedItems.slice(t,e),i=n.every((t=>t))&&n.length>0;this._handleCheckAll({detail:{isEveryItemChecked:i}})},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
932
|
</div>
|
|
1015
933
|
|
|
1016
|
-
${function(t){const
|
|
934
|
+
${function(t){const i=t.itemPerPage.map((t=>({label:String(t),value:String(t)})));return e`
|
|
1017
935
|
<div class="pagination-container" data-size="${t.size}">
|
|
1018
936
|
<div class="left-content">
|
|
1019
937
|
<span class="select-details">
|
|
1020
938
|
<label>Items per page:</label>
|
|
1021
939
|
<nr-select
|
|
1022
|
-
.options=${
|
|
940
|
+
.options=${i}
|
|
1023
941
|
.value=${String(t.selectedItemPerPage)}
|
|
1024
942
|
size="small"
|
|
1025
943
|
@nr-change=${t.onItemPerPageChange}
|
|
@@ -1039,23 +957,17 @@ var me=function(t,e,i,n){for(var s,o=arguments.length,r=o<3?e:null===n?n=Object.
|
|
|
1039
957
|
class="left-arrow"
|
|
1040
958
|
data-enabled=${t.enablePrevious}
|
|
1041
959
|
name="caret-left"
|
|
1042
|
-
@click=${t.enablePrevious?t.onPreviousPage:
|
|
960
|
+
@click=${t.enablePrevious?t.onPreviousPage:n}
|
|
1043
961
|
></nr-icon>
|
|
1044
962
|
|
|
1045
963
|
<nr-icon
|
|
1046
964
|
class="right-arrow"
|
|
1047
965
|
data-enabled=${t.enableNext}
|
|
1048
966
|
name="caret-right"
|
|
1049
|
-
@click=${t.enableNext?t.onNextPage:
|
|
967
|
+
@click=${t.enableNext?t.onNextPage:n}
|
|
1050
968
|
></nr-icon>
|
|
1051
969
|
</span>
|
|
1052
970
|
</div>
|
|
1053
971
|
</div>
|
|
1054
|
-
`}({numberOfItems:this.rowsCopy.length,itemPerPage:this.itemPerPage,selectedItemPerPage:this.selectedItemPerPage,currentPage:this.currentPage,size:this.size,numberOfPages:
|
|
1055
|
-
`;var
|
|
1056
|
-
/**
|
|
1057
|
-
* @license
|
|
1058
|
-
* Copyright 2017 Google LLC
|
|
1059
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1060
|
-
*/
|
|
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};
|
|
972
|
+
`}({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}})}})}
|
|
973
|
+
`;var c}};w.styles=h,v([r({type:Array})],w.prototype,"headers",void 0),v([r({type:Array})],w.prototype,"rows",void 0),v([r({type:String})],w.prototype,"size",void 0),v([r({type:Boolean})],w.prototype,"withFilter",void 0),v([r({type:String})],w.prototype,"expandable",void 0),v([r({attribute:!1})],w.prototype,"expansionRenderer",void 0),v([r({type:String})],w.prototype,"selectionMode",void 0),v([r({type:Boolean})],w.prototype,"fixedHeader",void 0),v([r({type:Object})],w.prototype,"scrollConfig",void 0),v([r({type:Boolean})],w.prototype,"loading",void 0),v([r({type:String})],w.prototype,"emptyText",void 0),v([r({type:String})],w.prototype,"emptyIcon",void 0),v([a()],w.prototype,"itemPerPage",void 0),v([a()],w.prototype,"selectedItemPerPage",void 0),v([a()],w.prototype,"displayedRows",void 0),v([a()],w.prototype,"selectedItems",void 0),v([a()],w.prototype,"currentPage",void 0),v([a()],w.prototype,"rowsCopy",void 0),v([a()],w.prototype,"activeSearch",void 0),v([a()],w.prototype,"sortAttribute",void 0),v([a()],w.prototype,"expand",void 0),v([a()],w.prototype,"showFilterInput",void 0),v([a()],w.prototype,"filterValue",void 0),v([a()],w.prototype,"columnFilters",void 0),v([a()],w.prototype,"activeFilterColumn",void 0),v([o("#global-check")],w.prototype,"globalCheck",void 0),w=v([l("nr-table")],w);export{w as HyTable};
|