@nanoporetech-digital/components 7.4.0 → 7.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-93d8b419.js.map +1 -1
- package/dist/cjs/{nano-table-60774c5f.js → nano-table-e2957379.js} +2 -2
- package/dist/cjs/{nano-table-60774c5f.js.map → nano-table-e2957379.js.map} +1 -1
- package/dist/cjs/nano-table.cjs.entry.js +1 -1
- package/dist/cjs/{table.worker-bf995b67.js → table.worker-d399e24b.js} +2 -2
- package/dist/cjs/table.worker-d399e24b.js.map +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/esm/app-globals-d4ab01f2.js.map +1 -1
- package/dist/esm/{nano-table-ecd4f4b5.js → nano-table-83296fde.js} +2 -2
- package/dist/esm/{nano-table-ecd4f4b5.js.map → nano-table-83296fde.js.map} +1 -1
- package/dist/esm/nano-table.entry.js +1 -1
- package/dist/esm/{table.worker-d9e7db75.js → table.worker-899871ed.js} +2 -2
- package/dist/esm/table.worker-899871ed.js.map +1 -0
- package/dist/nano-components/app-globals-d4ab01f2.js.map +1 -1
- package/dist/nano-components/{nano-table-ecd4f4b5.js → nano-table-83296fde.js} +2 -2
- package/dist/nano-components/nano-table.entry.js +1 -1
- package/dist/nano-components/{table.worker-d9e7db75.js → table.worker-899871ed.js} +2 -2
- package/docs-json.json +1 -1
- package/package.json +1 -1
- package/dist/cjs/table.worker-bf995b67.js.map +0 -1
- package/dist/esm/table.worker-d9e7db75.js.map +0 -1
- /package/dist/nano-components/{nano-table-ecd4f4b5.js.map → nano-table-83296fde.js.map} +0 -0
- /package/dist/nano-components/{table.worker-d9e7db75.js.map → table.worker-899871ed.js.map} +0 -0
- /package/dist/types/builds/{a3vME3LE → ZCT-PoHy}/0/Digital/nano-components/packages/components/.stencil/generators/custom-element-doc-generator.d.ts +0 -0
- /package/dist/types/builds/{a3vME3LE → ZCT-PoHy}/0/Digital/nano-components/packages/components/.stencil/generators/vue/generate-vue-component.d.ts +0 -0
- /package/dist/types/builds/{a3vME3LE → ZCT-PoHy}/0/Digital/nano-components/packages/components/.stencil/generators/vue/index.d.ts +0 -0
- /package/dist/types/builds/{a3vME3LE → ZCT-PoHy}/0/Digital/nano-components/packages/components/.stencil/generators/vue/output-vue.d.ts +0 -0
- /package/dist/types/builds/{a3vME3LE → ZCT-PoHy}/0/Digital/nano-components/packages/components/.stencil/generators/vue/plugin.d.ts +0 -0
- /package/dist/types/builds/{a3vME3LE → ZCT-PoHy}/0/Digital/nano-components/packages/components/.stencil/generators/vue/types.d.ts +0 -0
- /package/dist/types/builds/{a3vME3LE → ZCT-PoHy}/0/Digital/nano-components/packages/components/.stencil/generators/vue/utils.d.ts +0 -0
- /package/dist/types/builds/{a3vME3LE → ZCT-PoHy}/0/Digital/nano-components/packages/components/.stencil/stencil.config.d.ts +0 -0
- /package/dist/types/builds/{a3vME3LE → ZCT-PoHy}/0/Digital/nano-components/packages/components/.stencil/stencil.config.prod.d.ts +0 -0
- /package/dist/types/builds/{a3vME3LE → ZCT-PoHy}/0/Digital/nano-components/packages/components/.stencil/testing/mocks/intersection-observer.d.ts +0 -0
- /package/dist/types/builds/{a3vME3LE → ZCT-PoHy}/0/Digital/nano-components/packages/components/.stencil/wdio.conf.d.ts +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
/*!
|
2
2
|
* Web Components for Nanopore digital Web Apps
|
3
3
|
*/
|
4
|
-
export { T as nano_table } from './nano-table-
|
4
|
+
export { T as nano_table } from './nano-table-83296fde.js';
|
5
5
|
import './index-815d3f98.js';
|
6
6
|
import './math-d160f8a6.js';
|
7
7
|
import './throttle-df960210.js';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/*!
|
2
2
|
* Web Components for Nanopore digital Web Apps
|
3
3
|
*/
|
4
|
-
import { c as createWorker } from './nano-table-
|
4
|
+
import { c as createWorker } from './nano-table-83296fde.js';
|
5
5
|
import './index-815d3f98.js';
|
6
6
|
import './math-d160f8a6.js';
|
7
7
|
import './throttle-df960210.js';
|
@@ -25,4 +25,4 @@ try {
|
|
25
25
|
|
26
26
|
export { worker, workerMsgId, workerName, workerPath };
|
27
27
|
|
28
|
-
//# sourceMappingURL=table.worker-
|
28
|
+
//# sourceMappingURL=table.worker-899871ed.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"file":"table.worker-899871ed.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["globalThis","window","docEle","document","documentElement","docIsReady","classList","contains","dispatchEvent","CustomEvent","mutationO","MutationObserver","_","disconnect","observe","childList","subtree","attributes","globalScripts","appGlobalScript"],"sources":["src/global/script/global.ts","@stencil/core/internal/app-globals"],"sourcesContent":["if (\n globalThis.window &&\n 'MutationObserver' in globalThis.window &&\n globalThis['document']\n) {\n // fire global 'ready' event when everything is hydrated\n\n const docEle = document.documentElement;\n const docIsReady = () => {\n if (!docEle.classList.contains('hydrated')) return false;\n docEle.dispatchEvent(new CustomEvent('nanoComponentsReady'));\n return true;\n };\n\n if (!docIsReady()) {\n let mutationO = new MutationObserver((_) => {\n if (!docIsReady()) return;\n\n mutationO.disconnect();\n mutationO = null;\n });\n\n mutationO.observe(docEle, {\n childList: false,\n subtree: false,\n attributes: true,\n });\n }\n}\n","import appGlobalScript from '/builds/
|
1
|
+
{"version":3,"names":["globalThis","window","docEle","document","documentElement","docIsReady","classList","contains","dispatchEvent","CustomEvent","mutationO","MutationObserver","_","disconnect","observe","childList","subtree","attributes","globalScripts","appGlobalScript"],"sources":["src/global/script/global.ts","@stencil/core/internal/app-globals"],"sourcesContent":["if (\n globalThis.window &&\n 'MutationObserver' in globalThis.window &&\n globalThis['document']\n) {\n // fire global 'ready' event when everything is hydrated\n\n const docEle = document.documentElement;\n const docIsReady = () => {\n if (!docEle.classList.contains('hydrated')) return false;\n docEle.dispatchEvent(new CustomEvent('nanoComponentsReady'));\n return true;\n };\n\n if (!docIsReady()) {\n let mutationO = new MutationObserver((_) => {\n if (!docIsReady()) return;\n\n mutationO.disconnect();\n mutationO = null;\n });\n\n mutationO.observe(docEle, {\n childList: false,\n subtree: false,\n attributes: true,\n });\n }\n}\n","import appGlobalScript from '/builds/ZCT-PoHy/0/Digital/nano-components/packages/components/src/global/script/global.ts';\nexport const globalScripts = appGlobalScript;\n"],"mappings":";;;AAAA,GACEA,WAAWC,QACX,qBAAsBD,WAAWC,QACjCD,WAAW,YACX,CAGA,MAAME,EAASC,SAASC,gBACxB,MAAMC,EAAa,KACjB,IAAKH,EAAOI,UAAUC,SAAS,YAAa,OAAO,MACnDL,EAAOM,cAAc,IAAIC,YAAY,wBACrC,OAAO,IAAI,EAGb,IAAKJ,IAAc,CACjB,IAAIK,EAAY,IAAIC,kBAAkBC,IACpC,IAAKP,IAAc,OAEnBK,EAAUG,aACVH,EAAY,IAAI,IAGlBA,EAAUI,QAAQZ,EAAQ,CACxBa,UAAW,MACXC,QAAS,MACTC,WAAY,M,CAGlB,C,yBC3BY,MAACC,EAAgBC,S","ignoreList":[]}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
2
|
* Web Components for Nanopore digital Web Apps
|
3
3
|
*/
|
4
|
-
import{j as t,h as n,F as e,g as o,e as i,w as s,d as r,r as a,c as l,a as c}from"./index-815d3f98.js";import{a as d}from"./math-d160f8a6.js";import{d as h}from"./throttle-df960210.js";import{f as b}from"./scroll-parent-be39fbd0.js";import{c as f}from"./index-32d24a05.js";const p="nano-tbl";const _=(t,n)=>{const e=globalThis[n];return e!=null&&t instanceof e};const u=t=>{if(t!=null){if(_(t,"ArrayBuffer")||_(t,"MessagePort")||_(t,"ImageBitmap")||_(t,"OffscreenCanvas")){return[t]}if(typeof t==="object"){if(t.constructor===Object){t=Object.values(t)}if(Array.isArray(t)){return t.flatMap(u)}return u(t.buffer)}}return[]};let m=0;let g=0;const y=new Map;const w=new Map;const v=(n,e,o)=>{const i=new Worker(n,{name:e});i.addEventListener("message",(({data:n})=>{if(n){const e=n[0];const i=n[1];const s=n[2];if(e===o){const e=n[3];const[o,r,a]=y.get(i);y.delete(i);if(e){const n=e.isError?Object.assign(new Error(e.value.message),e.value):e.value;t(n);r(n)}else{if(a){a.forEach((t=>w.delete(t)))}o(s)}}else if(e===o+".cb"){try{w.get(i)(...s)}catch(n){t(n)}}}}));return i};const k=(t,n,e)=>(...o)=>new Promise(((i,s)=>{let r=m++;let a=0;let l=o.length;let c=[i,s];y.set(r,c);for(;a<l;a++){if(typeof o[a]==="function"){const t=g++;w.set(t,o[a]);o[a]=[n+".cb",t];(c[2]=c[2]||[]).push(t)}}const d=t=>t.postMessage([n,r,e,o],u(o));if(t.then){t.then(d)}else{d(t)}}));const x=import("./table.worker-d9e7db75.js").then((t=>t.worker));const $=k(x,"stencil.table.worker","createWorkerStore");const z=k(x,"stencil.table.worker","syncConfigToWorker");const C=k(x,"stencil.table.worker","syncDataToWorker");const S=k(x,"stencil.table.worker","workerFilter");const R=k(x,"stencil.table.worker","workerSearch");const T=k(x,"stencil.table.worker","workerSort");function I(t){const n=JSON.parse(JSON.stringify(t));t.forEach((t=>{if(t?.sortCompareFn){const e=n.find((n=>n.prop===t.prop));e.sortCompareFn=t.sortCompareFn.toString()}}));return n}const B=new WeakMap;async function P(t,n,e,o){const i={data:f({rows:[]}),config:f({columns:n}),general:f({workerId:null,scrollParent:e,host:t,isReady:o})};const s=await $(i.data.state.rows,I(i.config.state.columns));i.general.state.workerId=s;B.set(t,i);i.data.use({reset:()=>{if(i.general.state.workerId)C(i.general.state.workerId,null)},dispose:()=>{if(i.general.state.workerId)C(i.general.state.workerId,null)}});i.config.use({reset:()=>{if(i.general.state.workerId)z(i.general.state.workerId,null)},dispose:()=>{if(i.general.state.workerId)z(i.general.state.workerId,null)}});return i}function A(t){return B.get(t)}function F(t){if(t instanceof Date){return"date"}if(["number","string","boolean"].includes(typeof t)){return typeof t}return"unknown"}function E(t,n){const e=B.get(t);if(!e)return;const o=e.config.state.columns;const i=o.filter((t=>t.type==="date")).reduce(((t,n)=>[...t,n.prop]),[]);const s=o.filter((t=>!t.type));n=n.map(((t,n)=>{if(s.length&&n===0){e.config.state.columns=o.map((n=>{if(s.includes(n)&&t[n.prop]&&!n.type){n.type=F(t[n.prop]);if(n.type==="date")i.push(n.prop)}return n}))}i.forEach((n=>{const e=new Date(t[n]);if(!!e&&Number(e))t[n]=Number(e)}));t["__index"]=n;t["__uuid"]=d(o.map((n=>t[n.prop])).join());return t}));e.data.state.rows=n;if(e.general.state.workerId)return C(e.general.state.workerId,n)}function M(t,n){const e=B.get(t);if(!e)return;e.config.state.columns=n;if(e.general.state.workerId)return z(e.general.state.workerId,I(n))}async function D(t,n){const e=B.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await R(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function N(t,n){const e=B.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await S(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function j(t,n,e){const o=B.get(t);if(!o||!o.general.state.workerId)return;try{o.data.state.rows=await T(o.general.state.workerId,n,e)}catch(t){console.warn(t)}}function H(t,n){const e=L();const o=e.config.state.columns;const i=e.data.state.rows;const s=o[n];const r=s?.prop;const a=i[t];const l=a?a[o[n].prop]:"";return{prop:r,cellModel:l,column:s,rowIndex:t,rowModel:a}}function O(t){const n=L();const e=n.data.state.rows;const o=e[t];return{rowModel:o,rowIndex:t}}function W(t,n){if(!n)return t;const e={...n,...t};if(n.class){if(typeof n.class==="object"&&typeof e.class==="object"){e.class={...n.class,...e.class}}else if(typeof n.class==="string"&&typeof e.class==="object"){e.class[n.class]=true}else if(typeof e.class==="string"&&typeof n.class==="string"){e.class+=" "+n.class}}if(n.style){e.style={...n.style,...e.style}}return e}function L(){return A(o(i()))}function Y(t,n,e){const o={...e};const i=L().config.state.columns[n]?.cellProperties;if(!i)return o;const s=H(t,n);const r=i(s);if(!r)return o;return W(o,r)}function J(t){const o=t?.columnTemplate;return o?o(n,t):n(e,null,t.title)}function K(t,n,e=false){const o={[`${p}__${t}`]:true,[`${p}__pin`]:!!n,[`${p}__pin--top`]:n==="top",[`${p}__pin--bottom`]:n==="bottom"};if(e)return X(o);return o}function X(t){let n="";Object.entries(t).forEach((([t,e])=>{if(e)n+=t+" "}));return n}function q(t,n=100){const e=t.getBoundingClientRect();const o=window.innerHeight||document.documentElement.clientHeight;if(!e.bottom&&!e.top&&!e.left&&!e.right&&!e.height&&!e.width&&!e.x&&!e.y)return false;return!(Math.floor(100-(e.top>=0?0:e.top)/+-e.height*100)<n||Math.floor(100-(e.bottom-o)/e.height*100)<n)}const U=({column:t,onColumnSortClick:o,defaults:i})=>{function s(n){let e;switch(t.order){case"asc":e="desc";break;case"desc":e=null;break;default:e="asc"}o(e,t.prop,n.target.closest("th"))}function r(){return!!i.sortable&&t.sortable!==false||!i.sortable&&t.sortable===true}let a={};if(t.columnProperties){a=t.columnProperties(t)||a}const l={class:{...K("th",t.pinned),[`${p}__pin--start`]:t.pinned==="start",[`${p}__pin--end`]:t.pinned==="end",[`${p}__ordered`]:!!t.order,[`${p}__filtered`]:t.filter!==undefined&&t.filter!==null}};let c=a?W(l,a):l;const d=J(t);if(!d)return n(e,null);c=Number(c.colSpan)>1?{...c,scope:"colgroup"}:{...c,scope:"col"};if(r()){const n=t.order?t.order==="asc"?"ascending":"descending":"none";c={...c,"aria-sort":n}}return n("th",{...c,key:t.prop},r()?n("button",{class:{[`${p}__order-btn`]:true,[`${p}__cell-content`]:true},onClick:s},J(t),t.filter!==undefined&&t.filter!==null&&n("nano-icon",{name:"light/filter"}),!!t.order&&(t.order==="desc"?n("nano-icon",{name:"solid/arrow-down-long"}):n("nano-icon",{name:"solid/arrow-up-long"})),n("div",{class:`${p}__status-icons`},n("nano-icon",{name:"light/chevron-down"}))):n("div",{class:`${p}__cell-content`},J(t),t.filter!==undefined&&t.filter!==null&&n("nano-icon",{name:"light/bars-filter"})))};function G(t,o){const s=L();const r=s.config.state.columns;const a=r[o]?.cellTemplate;const l=H(t,o);const c=i();if(!!l.cellModel&&r[o].type==="date"){const t=new Date(l.cellModel);if(t instanceof Date&&!isNaN(t)){l.cellModel=!a?`${new Date(l.cellModel).toLocaleDateString()} ${new Date(l.cellModel).toLocaleTimeString()}`:t}}let d=false;const h=(...t)=>{d=true;return n(...t)};let b=a?a(h,l):undefined;if(b&&c.customRenderer&&b["t"]===undefined&&!(b instanceof Element)&&typeof b!=="string"&&!d){const t=document.createElement("template");const n=c.customRenderer(b,t.content);b=n&&n["then"]?n:t}return b?b:l.cellModel!==undefined&&l.cellModel!==null?n(e,null,l.cellModel?.toString()):""}const Q=(t,n=false)=>{const e=L();const o=e.config.state.columns[t];const i={[`${p}__td`]:true,[`${p}__ordered`]:!!o.order,[`${p}__pin`]:!!o.pinned,[`${p}__pin--start`]:o.pinned==="start",[`${p}__pin--end`]:o.pinned==="end"};if(n)return X(i);return i};const V=({rowIndex:t,colIndex:e,nestedContent:o})=>{const s=()=>o?o():G(t,e)||n("span",{class:"placeholder"}," ");let r="td";const a=i();const l=L();const c=l.config.state.columns[e];let d=Y(t,e,{class:Q(e)});if(c.rowHeader){d=Number(d.rowSpan)>1?{...d,scope:"rowgroup"}:{...d,scope:"row"};r="th"}const h=t=>{const e=s();return n("div",{ref:t=>{if(!t)return;if(e instanceof Element){t.replaceChildren();t.append(e["content"]||e)}else if(e["then"]){e.then((n=>t.innerHTML=n))}},...t,class:{[`${p}__cell-content`]:true,[`${p}__cell-content--wrap`]:!!c.wrap},innerHTML:typeof e==="string"&&e.includes("<")?e:undefined},(typeof e!=="string"||!e.includes("<"))&&!e["then"]&&!(e instanceof Element)&&e)};return n(r,{role:a.type==="grid"?"gridcell":undefined,...d},c.autoTooltip&&!c.wrap?n("nano-resize-observe",{notifyContentFit:"x",onNanoResizeContentFitChange:t=>t.target.firstElementChild.disabled=t.detail.x},n("nano-tooltip",{disabled:true,placement:"top",onNanoShow:t=>t.target.closest(r).style.zIndex="100",onNanoHide:t=>t.target.closest(r).style.zIndex=""},n(h,null),n("span",{slot:"content"},n(s,null)))):n(h,null))};const Z=(t,e,o)=>{const i=n("div",{...t.wrapperProps,class:{[`${p}__cell-content`]:true,[`${p}__cell-content--wrap`]:t.wrap}},e);return t.header?n("th",{scope:o,...t.cellProps},i):n("td",{...t.cellProps},i)};const tt=({rowRenderer:t,rowIndex:e,rowModel:o},i,s)=>{const r=({header:t,wrap:n,cellProps:e,wrapperProps:o},i)=>Z({header:t,wrap:n,cellProps:e,wrapperProps:o},i,"row");let a={};if(!o){const t=O(e);o=t.rowModel}if(t?.rowProperties){a=t.rowProperties({rowModel:o,rowIndex:e})||a}let l;if(t?.pinned&&typeof t.pinned==="function"){l=t.pinned({rowModel:o,rowIndex:e})}const c=W({class:K("tr",l,true)},a);const d=t?.template;const h=t=>s.map(t,((t,n)=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=W({class:Q(n,true)},t.vattrs)}return t}));if(d){let t=d(n,{renderedRow:n("tr",{...c,key:o.__uuid},i),rowModel:o,rowIndex:e},r);if(Array.isArray(t)){t=s.map(t,((t,n)=>{if(t.vtag==="tr"){if(!t.vkey)t.vkey=`${o.__uuid}_${n}`;t.vattrs=W({class:K("tr",l,true)},t.vattrs);if(t.vchildren){t.vchildren=h(t.vchildren)}}return t}))}return t}return n("tr",{...c,key:o.__uuid},h(i))};const nt=({rowRenderer:t},e,o)=>{let i={};if(t.rowProperties){i=t.rowProperties()||{}}const s=({header:t,wrap:n,cellProps:e,wrapperProps:o},i)=>Z({header:t,wrap:n,cellProps:e,wrapperProps:o},i,"col");const r=t.pinned||null;const a={class:K("tr",r)};const l=i?W(a,i):a;const c=t?.template;if(c){let t=c(n,{renderedRow:n("tr",{...l},e)},s);if(Array.isArray(t)){t=o.map(t,(t=>{if(t.vtag==="tr"){t.vattrs=W({class:K("tr",r,true)},t.vattrs);if(t.vchildren){t.vchildren=o.map(t.vchildren,(t=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=W({class:K(t.vtag.toString(),r,true)},t.vattrs)}return t}))}}return t}))}return t}return n("tr",{...l},e)};function et(t,n){const e=document.getElementById(t)||document.createElement("style");e.id=t;e.innerHTML=n;if(!e.isConnected)document.head.append(e)}class ot{cachedColMeta=new WeakMap;tableId;tableEle;scrollElement;startColumns;endColumns;topRows;bottomRows;tableDims;constructor(t,n){this.tableEle=t;this.tableId=this.tableEle.id;this.scrollElement=n;this.startColumns=t.querySelector("thead").getElementsByClassName(`${p}__pin--start`);this.endColumns=t.querySelector("thead").getElementsByClassName(`${p}__pin--end`);this.topRows=t.getElementsByClassName(`${p}__pin--top`);this.bottomRows=t.getElementsByClassName(`${p}__pin--bottom`);this.onResize()}get pinnedStart(){return this._pinnedStart}set pinnedStart(t){this._pinnedStart=t;this.handlePinnedStartChange()}_pinnedStart=[];handlePinnedStartChange(){s((()=>{if(this.pinnedStart.length){this.tableEle.classList.add(`${p}__pinned--start`);const t=this.cachedColMeta.get(this.pinnedStart[this.pinnedStart.length-1]);et(`${this.tableId}-col-start-active-style`,`\n #${this.tableId} tr > :nth-child(${t.idx+1}) {\n --pin-start-active: 1;\n }\n `)}else{this.tableEle.classList.remove(`${p}__pinned--start`);et(`${this.tableId}-col-start-active-style`,``)}}))}get pinnedEnd(){return this._pinnedEnd}set pinnedEnd(t){this._pinnedEnd=t;this.handlePinnedEndChange()}_pinnedEnd=[];handlePinnedEndChange(){s((()=>{if(this.pinnedEnd.length){this.tableEle.classList.add(`${p}__pinned--end`);const t=this.cachedColMeta.get(this.pinnedEnd[0]);et(`${this.tableId}-col-end-active-style`,`\n #${this.tableId} tr > :nth-child(${t.idx+1}) { --pin-end-active: 1; }\n `)}else{this.tableEle.classList.remove(`${p}__pinned--end`);et(`${this.tableId}-col-end-active-style`,``)}}))}get cssColDimensionCacheKey(){return this._cssColDimensionCacheKey}set cssColDimensionCacheKey(t){if(t===this._cssColDimensionCacheKey)return;this._cssColDimensionCacheKey=t;this.createPinnedColDimensionStyles()}_cssColDimensionCacheKey="";generateCssCacheKey(){let t="";for(const n of this.startColumns){const e=this.cachedColMeta.get(n);t+=`${e.idx}-start-${e.width}`}for(const n of this.endColumns){const e=this.cachedColMeta.get(n);t+=`${e.idx}-start-${e.width}`}this.cssColDimensionCacheKey=t}createPinnedColDimensionStyles(){let t=0;let n=0;const e=Array.from(this.startColumns);const o=Array.from(this.endColumns).reverse();const i=`\n ${e.map((n=>{const e=this.cachedColMeta.get(n);t+=e.width-1||-1;return`\n #${this.tableId} tr > :nth-child(${e.idx+1}) ~ td,\n #${this.tableId} tr > :nth-child(${e.idx+1}) ~ th {\n --pin-start: ${t-1}px;\n }\n `})).join("")}\n ${o.map((t=>{const e=this.cachedColMeta.get(t);n+=e.width-1||-1;return`\n #${this.tableId} tr > td:has(~ :nth-child(${e.idx+1})),\n #${this.tableId} tr > th:has(~ :nth-child(${e.idx+1})) {\n --pin-end: ${n-1}px;\n }\n `})).join("")}\n `;et(`${this.tableId}-dimension-style`,i)}getParentOffsets(){const{x:t,y:n}=this.scrollElement.getBoundingClientRect();let e=t;let o=n;if(this.scrollElement===document.documentElement){e=this.scrollElement.offsetLeft;o=this.scrollElement.offsetTop}return{offsetX:e,offsetY:o}}assessRows(){if(!this.topRows.length&&!this.bottomRows.length)return;if(this.topRows.length){r((async()=>{let t=0;let n;const{offsetY:e}=this.getParentOffsets();for(const o of this.topRows){const{y:i,height:r}=o.getBoundingClientRect();const a=o.parentElement;const l=getComputedStyle(o).getPropertyValue("--pin-top");const c=l!==""?parseFloat(l):t;s((()=>{if(i-e<=c){o.classList.add(`${p}__pinned`,`${p}__pinned--top`)}else{o.classList.remove(`${p}__pinned`,`${p}__pinned--top`)}if(n!==a){a.style.setProperty("--pin-top",`${t-1}px`);t+=r-1;n=a}}))}}))}if(this.bottomRows.length){const t=Array.from(this.bottomRows).reverse();r((async()=>{let n;let e=0;const{offsetY:o}=this.getParentOffsets();for(const i of t){if(!i.isConnected)continue;const{y:t,height:r}=i.getBoundingClientRect();const a=i.parentElement;const l=getComputedStyle(i).getPropertyValue("--pin-bottom");const c=l!==""?parseFloat(l):e;await new Promise((l=>s((()=>{if(this.tableDims.height+o-(t+r)<=c){i.classList.add(`${p}__pinned`,`${p}__pinned--bottom`)}else{i.classList.remove(`${p}__pinned`,`${p}__pinned--bottom`)}if(n!==a){a.style.setProperty("--pin-bottom",`${e-1}px`);e+=r-1;n=a}l()}))))}}))}}async assessCols(){if(!this.startColumns.length&&!this.endColumns.length)return;let t;let n;let e;const o=new Promise((o=>{if(this.startColumns.length){r((()=>{const{offsetX:i}=this.getParentOffsets();let s=i;e=Array.from(this.startColumns[0].parentElement.children);for(const o of this.startColumns){t=o.getBoundingClientRect();this.cachedColMeta.set(o,{width:t.width,idx:e.indexOf(o)});n=this.pinnedStart.find((t=>t===o));if(t.x<s){if(!n)this.pinnedStart=[...this.pinnedStart,o]}else if(n){this.pinnedStart=this.pinnedStart.filter((t=>t!==o))}s+=t.width}if(!this.endColumns.length)o()}))}if(this.endColumns.length){r((()=>{const i=Array.from(this.endColumns).reverse();e=Array.from(this.endColumns[0].parentElement.children);const{offsetX:s}=this.getParentOffsets();let r=0;for(const o of i){t=o.getBoundingClientRect();this.cachedColMeta.set(o,{width:t.width,idx:e.indexOf(o)});n=this.pinnedEnd.find((t=>t===o));if(this.tableDims.width+s-t.right<=r){if(!n)this.pinnedEnd=[o,...this.pinnedEnd]}else if(n){this.pinnedEnd=this.pinnedEnd.filter((t=>t!==o))}r+=t.width}o()}))}}));await o;this.generateCssCacheKey()}cacheX=0;cacheY=0;onScroll(t){if(this.cacheX!==t.x){this.cacheX=t.x;this.assessCols()}if(this.cacheY!==t.y){this.cacheY=t.y;this.assessRows()}}onResize(){const t=this.scrollElement.clientWidth;const n=this.scrollElement.clientHeight;this.tableDims={width:t,height:n};this.assessCols();this.assessRows()}}const it=':host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}nano-table{display:block;inline-size:100%;--max-col-width:clamp(200px, 500px, 50vw);--color:var(--nano-color-mediumgrey, #68767e);--font-size:0.87rem;--cell-line-height:1.5;--thead-font-size:0.95rem;--thead-color:#455560;--tfoot-color:#455560;--border-color:#dddbda;--border-style:thin solid var(--border-color);--border-tint-color:#0084a9;--border-tint-style:3px solid var(--border-tint-color);--cell-bg-rgb:var(--nano-color-white-rgb, 255 255 255);--head-bg-rgb:250 250 249;--foot-bg-rgb:var(--head-bg-rgb);--th-row-bg-rgb:var(--cell-bg-rgb);--ordered-bg-rgb:var(--nano-color-offwhite-rgb, 249 249 251);--td-padding-start:0.625rem;--td-padding-end:0.625rem;--td-padding-top:0.6rem;--td-padding-bottom:0.6125rem;--th-padding-start:0.725rem;--th-padding-end:0.625rem;--th-padding-top:0.875rem;--th-padding-bottom:0.6875rem;--td-padding-v:var(--td-padding-top) var(--td-padding-bottom);--td-padding-h:var(--td-padding-start) var(--td-padding-end);--th-padding-v:var(--th-padding-top) var(--th-padding-bottom);--th-padding-h:var(--th-padding-start) var(--th-padding-end);--foot-th-padding-v:var(--td-padding-top) var(--td-padding-bottom);--foot-th-padding-h:var(--td-padding-start) var(--td-padding-end);--head-th-padding-v:var(--th-padding-top) var(--th-padding-bottom);--head-th-padding-h:var(--th-padding-start) var(--th-padding-end);--bookend-col-padding:2rem}.nano-tbl{color:var(--color);text-align:start;inline-size:100%;font-size:var(--font-size);border-spacing:0 0;border-collapse:separate;background:rgb(var(--cell-bg-rgb));border-inline-end:1px solid transparent;border-block-start:1px solid transparent;position:relative;z-index:1}.nano-tbl__wrap{display:table;min-inline-size:100%}.nano-tbl__top-anchor{clip:rect(1px, 1px, 1px, 1px);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;position:relative}.nano-tbl__ordered{background-color:var(--ordered-bg);border-inline-start:var(--border-style);border-inline-end:var(--border-style)}.nano-tbl__order-btn{padding:0;border:none;outline:none;font:inherit;background:none;appearance:none;color:inherit;display:flex;gap:10px;align-items:center;inline-size:100%}.nano-tbl__order-btn:focus-visible{outline:none;box-shadow:var(--nano-control-focus-shadow, 0 0 0 0.1875rem var(--nano-control-focus-color, rgba(144, 198, 231, 0.8))) inset}.nano-tbl__status-icons{margin-inline:auto 10px;display:flex;gap:10px}.nano-tbl__progress-bar{font-size:0.2rem;position:sticky;inset-block-start:0;inset-inline:0;z-index:10;transition:scale 0.25s;transform:scale(0);inline-size:100%;block-size:0}.nano-tbl__progress-bar--show{transform:scale(1);block-size:auto}.nano-tbl__caption--hide{clip:rect(1px, 1px, 1px, 1px);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute}.nano-tbl__td,.nano-tbl__th{line-height:var(--cell-line-height);text-align:start;border-block-start:var(--border-style);max-inline-size:var(--max-col-width);background-color:rgb(var(--cell-bg-rgb))}tbody:first-of-type tr:first-child .nano-tbl__td,tbody:first-of-type tr:first-child .nano-tbl__th{border-block-start:none}tbody:last-of-type tr:last-child .nano-tbl__td,tbody:last-of-type tr:last-child .nano-tbl__th{border-block-end:var(--border-style)}.md .nano-tbl__td:first-child .nano-tbl__cell-content,.md .nano-tbl__th:first-child .nano-tbl__cell-content{padding-inline-start:var(--bookend-col-padding)}.md .nano-tbl__td:last-child .nano-tbl__cell-content,.md .nano-tbl__th:last-child .nano-tbl__cell-content{padding-inline-end:var(--bookend-col-padding)}@media (max-width: 768px){.nano-tbl__td:first-child .nano-tbl__cell-content,.nano-tbl__th:first-child .nano-tbl__cell-content{padding-inline-start:var(--td-padding-start) !important}.nano-tbl__td:last-child .nano-tbl__cell-content,.nano-tbl__th:last-child .nano-tbl__cell-content{padding-inline-end:var(--td-padding-end) !important}}thead .nano-tbl__td,thead .nano-tbl__th{color:var(--thead-color);font-weight:800;background:rgb(var(--head-bg-rgb)/100%);font-size:var(--thead-font-size);border-block-start:none !important}thead .nano-tbl__td .nano-tbl__cell-content,thead .nano-tbl__th .nano-tbl__cell-content{padding-block:var(--head-th-padding-v);padding-inline:var(--head-th-padding-h)}thead .nano-tbl__td .nano-sortable__keyboard-handle,thead .nano-tbl__th .nano-sortable__keyboard-handle{position:absolute;inset-inline-end:5px;inset-block-start:50%;transform:translateY(-50%);background:white;z-index:10}tfoot .nano-tbl__td,tfoot .nano-tbl__th{color:var(--tfoot-color);font-weight:800;border-block-start:none;background:rgb(var(--foot-bg-rgb)/100%);font-size:var(--thead-font-size)}tfoot .nano-tbl__td .nano-tbl__cell-content,tfoot .nano-tbl__th .nano-tbl__cell-content{padding-block:var(--foot-th-padding-v);padding-inline:var(--foot-th-padding-h)}.nano-tbl__td.nano-tbl__ordered,.nano-tbl__th.nano-tbl__ordered{background-color:rgb(var(--ordered-bg-rgb)/80%) !important}.nano-tbl__cell-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-block:var(--td-padding-v);padding-inline:var(--td-padding-h)}.nano-tbl__cell-content--no-result{padding-block:2rem}.nano-tbl__cell-content--wrap{white-space:normal;overflow:visible}.nano-tbl tbody{will-change:scroll-position;opacity:1;transition:0.1s ease opacity}.nano-tbl tbody.nano-tbl__loading{z-index:-1;position:relative}.nano-tbl tbody.nano-tbl__inactive{opacity:0}.nano-tbl tbody .nano-tbl__tr:has(~.nano-tbl__tr--placeholder){display:none}.nano-tbl tbody .nano-tbl__tr--placeholder~.nano-tbl__tr{display:none}.nano-tbl th[scope=row]{font-weight:800;margin:0}.nano-tbl__tr{--base-z:0}.nano-tbl__pin{z-index:var(--z, var(--base-z, 0))}.nano-tbl__pin .nano-tbl__th,.nano-tbl__pin .nano-tbl__td{z-index:var(--z, var(--base-z, 0))}.nano-tbl__pin--start{position:sticky;inset-inline-start:var(--pin-start, -1px)}.nano-tbl__pin--start::after{content:"";position:absolute;inset:0;box-shadow:5px 0 4px -1px rgba(0, 0, 0, 0.2);opacity:var(--pin-start-active, 0);z-index:-1}.nano-tbl__pinned--start .nano-tbl__pin--start{--z:calc(var(--base-z) + 3) !important}.nano-tbl__pin--end{position:sticky}.nano-tbl__pin--start+.nano-tbl__pin--end{inset-inline-end:auto !important}.nano-tbl__pin--start+.nano-tbl__pin--end::after{display:none}.sm .nano-tbl__pin--end{inset-inline-end:var(--pin-end, -1px);max-inline-size:min(50vw, 200px)}.sm .nano-tbl__pin--end::after{display:block !important;content:"";position:absolute;inset:0;box-shadow:-5px 1px 4px -1px rgba(0, 0, 0, 0.2);opacity:var(--pin-end-active, 0);z-index:-1}.sm .nano-tbl__pinned--end .nano-tbl__pin--end{--z:calc(var(--base-z) + 2) !important}.nano-tbl__pin--top .nano-tbl__th,.nano-tbl__pin--top .nano-tbl__td{position:sticky;inset-block-start:var(--pin-top, -1px)}.nano-tbl__pin--top .nano-tbl__pin--end,.nano-tbl__pin--top .nano-tbl__pin--start{--z:calc(var(--base-z) + 1)}.nano-tbl__pin--top.nano-tbl__pinned--top{--base-z:4}tbody .nano-tbl__pin--top.nano-tbl__pinned--top .nano-tbl__th,tbody .nano-tbl__pin--top.nano-tbl__pinned--top .nano-tbl__td{box-shadow:1px 3px 4px -1px rgba(0, 0, 0, 0.1)}.nano-tbl__pin--bottom .nano-tbl__th,.nano-tbl__pin--bottom .nano-tbl__td{position:sticky;inset-block-end:var(--pin-bottom, -1px)}.nano-tbl__pin--bottom .nano-tbl__pin--end,.nano-tbl__pin--bottom .nano-tbl__pin--start{--z:calc(var(--base-z) + 1)}.nano-tbl__pin--bottom.nano-tbl__pinned--bottom{--base-z:5}.nano-tbl__pin--bottom.nano-tbl__pinned--bottom:has(.nano-tbl__pin--bottom.nano-tbl__pinned--bottom) .nano-tbl__pin{--base-z:6}tbody .nano-tbl__pin--bottom.nano-tbl__pinned--bottom .nano-tbl__th,tbody .nano-tbl__pin--bottom.nano-tbl__pinned--bottom .nano-tbl__td{box-shadow:1px -3px 4px -1px rgba(0, 0, 0, 0.07)}.nano-tbl thead tr:last-of-type td,.nano-tbl thead tr:last-of-type th{border-block-end:var(--border-tint-style)}.nano-tbl tfoot tr:first-of-type td,.nano-tbl tfoot tr:first-of-type th{border-block-start:none}.nano-tbl tfoot tr:last-of-type td,.nano-tbl tfoot tr:last-of-type th{border-block-start:var(--border-style);border-block-end:var(--border-tint-style)}.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:first-of-type td,.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:first-of-type th{border-block-start:var(--border-tint-style) !important}.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:last-of-type td,.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:last-of-type th{border-block-end:none !important}.nano-tbl .unlimited-width{max-inline-size:none}.nano-tbl__spinner{font-size:1.5rem;transition:scale 0.25s;scale:0;padding:0.5rem;position:absolute;inset-block-end:0;inset-inline-start:calc(50% - 0.75rem);z-index:0}.nano-tbl__spinner--show{scale:1;position:sticky}.nano-tbl nano-skeleton{line-height:var(--cell-line-height)}';const st=it;const rt=false;function at(t,n=false){if(!performance||!rt)return;if(n){performance?.mark("end"+t);performance?.measure(t,"start"+t,"end"+t);const n=performance?.getEntriesByName(t);console.info(n[n.length?n.length-1:0])}else{performance?.mark("start"+t)}}let lt=0;const ct=class{constructor(t){a(this,t);this.nanoTblReady=l(this,"nanoTblReady",7);this.nanoTblBlockRendered=l(this,"nanoTblBlockRendered",7);this.nanoTblBeforeSort=l(this,"nanoTblBeforeSort",7);this.nanoTblAfterSort=l(this,"nanoTblAfterSort",7);this.nanoTblBeforeFilter=l(this,"nanoTblBeforeFilter",7);this.nanoTblAfterFilter=l(this,"nanoTblAfterFilter",7);this.nanoTblBeforeSearch=l(this,"nanoTblBeforeSearch",7);this.nanoTblAfterSearch=l(this,"nanoTblAfterSearch",7);this.nanoTblBeforeEdit=l(this,"nanoTblBeforeEdit",7);this.debounceSetLoading=h(this.debounceSetLoading.bind(this),50)}customRenderer;type="table";caption;showCaption=false;loading=undefined;get _loading(){return this.loading!==undefined?this.loading:this.internalLoading}set _loading(t){if(this.loading!==undefined)return;this.debounceSetLoading(t)}debounceSetLoading(t){this.internalLoading=t}internalLoading=true;placeholderSize=5;rows;handleRowsChange(){if(!this.rows){this._loading=true;return}this._loading=true;Promise.resolve(this.rows).then((async t=>{await E(this.host,t);this.currentFilters="";this.currentSort="";await this.columnInit();if(!this.isReady)requestAnimationFrame((()=>this.setInitialBlockDimension()));this._loading=false;if(this.tablePinnedService)this.tablePinnedService.assessRows()}))}columns=[];async handleColsChange(){await M(this.host,this.columns);if(this.isReady)this.columnInit()}headRender={pinned:"top"};rowRender;footRender={pinned:"bottom"};showFooter=false;perBlock=50;get blocksLength(){return this.blocks.length}searchTerm;customFilterFn;customSortFn;defaultSort=true;handleSearchTermChange(){this.searchStart()}virtualTotalItems=0;virtualTotalItemsChangeHandler(){this.setBlocks()}get appliedFilters(){return this.filters}nanoTblReady;nanoTblBlockRendered;nanoTblBeforeSort;nanoTblAfterSort;nanoTblBeforeFilter;nanoTblAfterFilter;nanoTblBeforeSearch;nanoTblAfterSearch;nanoTblBeforeEdit;async resetSorting(){const t=this.columns.find((t=>!!t.order));if(!t)return;return this.sortStart(null,t.prop)}async addSort(t,n){const e=this.columns.find((n=>n.prop===t));if(!e)throw new Error("Cannot find column with "+t);return this.sortStart(n,e.prop)}async resetFilters(){this.filters=[];return this.filterStart()}async addFilters(t,n=true){if(!n)this.filters=[];return this.filterStart(t,n)}async removeFilters(t){this.filters=this.filters.filter((n=>!t.includes(n.prop)));return this.filterStart()}async updateRow(t,n){this.rows.splice(n,1,t);this.handleRowsChange()}get host(){return o(this)}renderId="tbl-"+lt++;store;filters=[];currentFilters="[]";currentSort="";tableEle;topAnchorEle;tableWrapperEle;activeWatcherIo;tablePinnedService;blocks=[];activeBlocks=[0,1];measureHeight=0;blockElements;blockHeights=[];set measureEle(t){if(!t)return;const n=t.getBoundingClientRect().height;this.measureHeight=Math.abs(this.measureHeight-n)<5?this.measureHeight:n;this.unitHeight=t.querySelector("tr")?.getBoundingClientRect().height||this.unitHeight}unitHeight=0;get scrollParent(){return this._scrollParent}set scrollParent(t){if(t===this._scrollParent)return;if(this._scrollParent){(this._scrollParent===document.documentElement?document:this._scrollParent).removeEventListener("scroll",this.scrollHandler)}(t===document.documentElement?document:t).addEventListener("scroll",this.scrollHandler);this._scrollParent=t}_scrollParent;get primaryBlockIndex(){return this._primaryBlockIndex}set primaryBlockIndex(t){if(this._primaryBlockIndex===t)return;this._primaryBlockIndex=t;this.nanoTblBlockRendered.emit({block:t,totalBlocks:this.blockElements.length})}_primaryBlockIndex;get isReady(){return this._isReady}set isReady(t){if(t===this._isReady)return;this._isReady=t;if(this.isReady)requestAnimationFrame((()=>this.handleReady()))}_isReady=false;handleReady(){const t=window.location.hash;if(t.length>1){try{const n=document.querySelector(t);if(n)n.scrollIntoView()}catch(t){}}this.nanoTblReady.emit()}sortStart=async(t,n,e)=>{if(this.currentSort===t+":"+n)return;this._loading=true;const o=this.nanoTblBeforeSort.emit({column:n,order:t});if(o.defaultPrevented)return;at("sort");this.currentSort=t+":"+n;this.scrollToTop(e);if(this.customSortFn){try{const e=await this.customSortFn(n,t);if(e===true){this.sortComplete(t,n);this._loading=false;return}}catch(t){console.warn("custom sort failed",t);this.currentSort="";this._loading=false;return}}try{await j(this.host,n,t);this.sortComplete(t,n)}catch(t){console.warn("sort failed",t);this.currentSort=""}finally{if(this.blocks.length)this._loading=false}};sortComplete(t,n){this.columns=this.columns.map((e=>{if(e.prop===n)return{...e,order:t};return{...e,order:null}}));this.nanoTblAfterSort.emit({column:n,order:t});at("sort",true)}async searchStart(){this._loading=true;const t=this.nanoTblBeforeSearch.emit({term:this.searchTerm});if(t.defaultPrevented)return;at("search");this.scrollToTop();try{await D(this.host,this.searchTerm);this.nanoTblAfterSearch.emit({term:this.searchTerm});at("search",true)}catch(t){console.warn("search failed",t)}finally{this._loading=false}}async filterStart(t,n=true){if(t){if(n){this.filters=[...this.filters.filter((n=>!t.find((t=>t.prop===n.prop)))),...t]}else{this.filters=t}}if(this.currentFilters===JSON.stringify(this.filters))return;this._loading=true;const e=this.nanoTblBeforeFilter.emit({filters:this.filters});if(e.defaultPrevented)return;at("filter");this.currentFilters=JSON.stringify(this.filters);this.scrollToTop();if(this.customFilterFn){try{const t=await this.customFilterFn(this.filters);if(t===true){this.filterComplete();this._loading=false;return}}catch(t){console.warn("custom filter failed",t);this.currentFilters="";this._loading=false;return}}try{await N(this.host,this.filters);this.filterComplete()}catch(t){console.warn("filter failed",t)}finally{this._loading=false}}filterComplete(){this.columns=this.columns.map((t=>{const n=this.filters.find((n=>n.prop===t.prop));if(n&&(typeof n.filter!=="boolean"&&n.filter.length||typeof n.filter==="boolean"))t.filter=n.filter;else if(t.filter!==null&&t.filter!==undefined||!!t.filter&&typeof t.filter!=="boolean"&&!t.filter.length)t.filter=undefined;return t}));this.nanoTblAfterFilter.emit({filters:this.filters});at("filter",true)}scrollToTop(t){const n=this.scrollParent.style?.scrollBehavior;const e=this.scrollParent.scrollLeft;this.scrollParent.style.scrollBehavior="auto";if(this.topAnchorEle&&!q(this.topAnchorEle,.1)){this.host.scrollIntoView()}if(t&&!q(t,1))setTimeout((()=>t.scrollIntoView({block:"start"})),500);if(e)this.scrollParent.scrollLeft=e;if(n)this.scrollParent.style.scrollBehavior=n;this.scrollHandler()}setMeasureElement(){return new Promise((t=>{r((()=>{this.measureEle=this.blockElements.find((t=>!t?.classList?.contains(`${p}__inactive`)));t()}))}))}setInitialBlockDimension(){if(!this.blockElements?.length)return;at("blockDims");const t=async()=>{await this.setMeasureElement();if(this.unitHeight)return true;return false};const n=new Promise((n=>{t().then((async e=>{if(e)n();else{const e=new IntersectionObserver((async()=>{if(await t()){n();e.disconnect()}}),{root:this.scrollParent});e.observe(this.tableEle)}}))}));n.then((()=>{at("blockDims",true);at("init",true);requestAnimationFrame((()=>this.isReady=true))}))}async columnInit(){this.filters=this.columns.filter((t=>t.filter!==undefined&&t.filter!==null)).map((t=>{const{filter:n,prop:e}=t;return{filter:n,prop:e}}));if(this.searchTerm){await this.searchStart()}if(this.filters.length){await this.filterStart()}const t=this.columns.find((t=>!!t.order));if(t){await this.sortStart(t.order,t.prop)}if(this.tablePinnedService)this.tablePinnedService.assessCols()}setBlocks(){const t=this.store.data.state.rows;if(!t.length){this.blocks=[];return}at("setBlocks");let n=1;const e=this.virtualTotalItems>t.length?this.virtualTotalItems:t.length;let o=[];const i=[];for(n;n<=e;n++){o.push(this.store.data.state.rows[n-1]||{__uuid:""});if(n%this.perBlock===0){i.push({rows:o,__uuid:d(o.map((t=>t.__uuid)).join())});o=[]}}if(o.length){i.push({rows:o,__uuid:d(o.map((t=>t.__uuid)).join())})}this.blocks=i;at("setBlocks",true)}getBlockHeight(t){if(this.blockHeights.length){const n=this.blockHeights.find((n=>n.blockIndex===t));if(n&&n.height)return n.height}const n=this.blocks[t].rows.length;if(n===this.perBlock&&this.measureHeight){return this.measureHeight}return this.unitHeight?this.unitHeight*n:100}setBlockHeight(){this.activeBlocks.forEach((t=>{const n=this.blockElements[t];if(!n)return;r((()=>{if(n.classList.contains(`${p}__inactive`))return;const e=n.getBoundingClientRect().height;const o=this.blockHeights.findIndex((n=>n.blockIndex===t));if(o>-1){this.blockHeights[o]={height:e,blockIndex:t}}else this.blockHeights.push({height:e,blockIndex:t})}))}))}scrollHandler=()=>{let t=0;at("scrollHandler");if(!this.store?.general.state.isActive||!this.rows)return;if(this.primaryBlockIndex===undefined)this.primaryBlockIndex=0;r((()=>{t=typeof this.scrollParent.scrollTop!=="undefined"?this.scrollParent.scrollTop:window.scrollY;t+=this.host.offsetTop;if(this.tablePinnedService){this.tablePinnedService.onScroll({x:typeof this.scrollParent.scrollLeft!=="undefined"?this.scrollParent.scrollLeft:window.scrollX,y:t})}let n=this.host.offsetTop;let e=0;const o=this.blocks.length;while(e<o&&t>=n){n+=this.getBlockHeight(e);if(t<n){const t=[e,e+1];if(t.toString()!==this.activeBlocks.toString()){this.activeBlocks=t}this.primaryBlockIndex=e}e++}at("scrollHandler",true)}))};processSlots(){if(!this.caption&&!this.host.querySelector('[slot="caption"]')){console.error("For accessibility you must set a `caption` prop or use the `caption` slot")}}handleResizeChange=t=>{this.tableWrapperEle.className="";let n=[`${p}__wrap`];if(t.target?.className)n=[...t.target.className.split(" "),...n];this.tableWrapperEle.classList.add(...n.filter((t=>!!t)))};setupActiveWatcher(){if(!this.host||!this.scrollParent||!this.store)return;if(this.activeWatcherIo){this.activeWatcherIo.disconnect();this.activeWatcherIo=undefined}const t=this.activeWatcherIo=new IntersectionObserver((([t])=>{if(t.isIntersecting)this.store.general.state.isActive=true;else this.store.general.state.isActive=false}),{root:this.scrollParent,threshold:0});t.observe(this.host)}async componentWillLoad(){at("init");this.store=await P(this.host,this.columns,this.scrollParent,this.isReady);this.handleRowsChange();this.store.general.onChange("isActive",(()=>{this.scrollHandler()}));this.store.data.onChange("rows",(()=>this.setBlocks()));this.processSlots();this.setBlocks();this.scrollParent=b(this.host);this.setupActiveWatcher()}connectedCallback(){this.scrollParent=b(this.host);this.setupActiveWatcher()}componentDidLoad(){this.setInitialBlockDimension();if(!this.tablePinnedService){this.tablePinnedService=new ot(this.tableEle,this.scrollParent)}}componentShouldUpdate(t,n,e){if(["rows","columns"].includes(e))return false}componentWillRender(){at("render")}componentDidRender(){this.setMeasureElement().then((()=>this.setBlockHeight()));at("render",true)}disconnectedCallback(){if(!this.activeWatcherIo)return;this.activeWatcherIo.disconnect();this.activeWatcherIo=undefined;(this.scrollParent===document.documentElement?document:this.scrollParent).removeEventListener("scroll",this.scrollHandler)}render(){this.blockElements=[];return n(c,{key:"1e4ab2278e29d76d159067a99e0c39d487c5f5e8"},n("div",{key:"add91a783072a129791ae15e9e38469b608a9a42",class:`${p}__top-anchor`,ref:t=>this.topAnchorEle=t}," "),n("nano-resize-observe",{key:"42473dfa05d70d78e6a04a454fe15a871681ee73",states:"576w sm, 768w md",class:"sm md",onNanoResizeStateChange:this.handleResizeChange,onNanoResize:()=>{if(this.tablePinnedService)this.tablePinnedService.onResize()}}),n("div",{key:"b6bb33e682eae1701ae77b8c26212f14006bf1f0",class:`${p}__wrap sm md`,ref:t=>this.tableWrapperEle=t,"aria-labelledby":"nano-table-caption-"+this.renderId,tabindex:this.type==="grid"?"0":undefined},n("nano-progress-bar",{key:"a3ca4d3463ec4abd8060883c72eb5545602616b5",indeterminate:true,class:{[`${p}__progress-bar`]:true,[`${p}__progress-bar--show`]:this._loading}}),n("table",{key:"3a407d34ed95b772d39d91825035f6c8c5eae54e",role:this.type==="grid"?"grid":undefined,"aria-rowcount":this.store.data.state.rows.length,"aria-colcount":this.store.config.state.columns.length,class:`${p}`,ref:t=>this.tableEle=t,id:"nano-table-"+this.renderId},n("caption",{key:"b8555c7d0a7db2b09ba41c28fd4b81774422d45f",class:{[`${p}__caption`]:true,[`${p}__caption--hide`]:!this.showCaption},id:"nano-table-caption-"+this.renderId},n("slot",{key:"ca460b7fbad86981c43688851fe2449b9e886818",name:"caption"},this.caption)),n("thead",{key:"82e89f137736b85d916e24a81aea18b077de5ee9"},n(nt,{key:"3a09721cbb3c6341baa68a0e3e817b4ce7990a53",rowRenderer:this.headRender},this.store.config.state.columns.map((t=>[n(U,{column:t,headRenderer:this.headRender,onColumnSortClick:this.sortStart,defaults:{sortable:this.defaultSort}})])))),this._loading&&!this.blocks.length&&n("tbody",{key:"8c5914b4725653f0bb762c973c9a6a211383eb81",class:`${p}__active ${p}__loading`},[...Array(10).keys()].map((t=>n("tr",null,this.store.config.state.columns.map(((e,o)=>n(V,{rowIndex:t,colIndex:o,nestedContent:()=>n("nano-skeleton",null)}))))))),n("tr",{key:"a71542721bc459a6be7c9d00deee74461200f144",hidden:!!this._loading||!!this.blocks.length},n("th",{key:"d9b360896d32387502b086b765e8f7cfda99ddc1",class:`${p}__th`,colSpan:this.store.config.state.columns.length},n("div",{key:"59b8bde2817030fc5b67c18e03bb2e6e98392f6c",class:"nano-tbl__cell-content nano-tbl__cell-content--no-result"},n("slot",{key:"4bda7c0a503b9e9fc4dd3503207c869ba2ca7833",name:"no-results"},"No results found")))),this.blocks.map(((t,e)=>n("tbody",{key:t.__uuid,id:`tbody-${this.renderId}-${e}`,ref:t=>{this.blockElements.push(t)},class:{[`${p}__inactive`]:!this.activeBlocks.includes(e),[`${p}__active`]:this.activeBlocks.includes(e)}},this.activeBlocks.includes(e)?t.rows.map(((t,o)=>{const i=e>0?e*this.perBlock+o:o;return n(tt,{rowRenderer:this.rowRender,rowModel:t,rowIndex:i},this.store.config.state.columns.map(((t,e)=>n(V,{rowIndex:i,colIndex:e}))))})):n("tr",{class:`${p}__tr--placeholder`},n("td",{colSpan:this.store.config.state.columns.length,style:{height:this.getBlockHeight(e)+"px"}}))))),this.showFooter&&n("tfoot",{key:"b7b123eddfbd95767e533c35319f69294d3688c9"},n(nt,{key:"6c87f4710eb25f3fb4302ccd7a29329491da8d49",rowRenderer:this.footRender},this.store.config.state.columns.map((t=>[n(U,{column:t,headRenderer:this.footRender,onColumnSortClick:this.sortStart,defaults:{sortable:this.defaultSort}})]))))),!!this.blocks.length&&n("nano-spinner",{key:"3d0bb686da28cce7e7c90286b8fd82e4b84a8b2b",type:"circle",class:{[`${p}__spinner`]:true,[`${p}__spinner--show`]:this._loading}})))}static get watchers(){return{rows:["handleRowsChange"],columns:["handleColsChange"],searchTerm:["handleSearchTermChange"],virtualTotalItems:["virtualTotalItemsChangeHandler"]}}};ct.style=st;export{ct as T,v as c};
|
5
|
-
//# sourceMappingURL=nano-table-
|
4
|
+
import{j as t,h as n,F as e,g as o,e as i,w as s,d as r,r as a,c as l,a as c}from"./index-815d3f98.js";import{a as d}from"./math-d160f8a6.js";import{d as h}from"./throttle-df960210.js";import{f as b}from"./scroll-parent-be39fbd0.js";import{c as f}from"./index-32d24a05.js";const p="nano-tbl";const _=(t,n)=>{const e=globalThis[n];return e!=null&&t instanceof e};const u=t=>{if(t!=null){if(_(t,"ArrayBuffer")||_(t,"MessagePort")||_(t,"ImageBitmap")||_(t,"OffscreenCanvas")){return[t]}if(typeof t==="object"){if(t.constructor===Object){t=Object.values(t)}if(Array.isArray(t)){return t.flatMap(u)}return u(t.buffer)}}return[]};let m=0;let g=0;const y=new Map;const w=new Map;const v=(n,e,o)=>{const i=new Worker(n,{name:e});i.addEventListener("message",(({data:n})=>{if(n){const e=n[0];const i=n[1];const s=n[2];if(e===o){const e=n[3];const[o,r,a]=y.get(i);y.delete(i);if(e){const n=e.isError?Object.assign(new Error(e.value.message),e.value):e.value;t(n);r(n)}else{if(a){a.forEach((t=>w.delete(t)))}o(s)}}else if(e===o+".cb"){try{w.get(i)(...s)}catch(n){t(n)}}}}));return i};const k=(t,n,e)=>(...o)=>new Promise(((i,s)=>{let r=m++;let a=0;let l=o.length;let c=[i,s];y.set(r,c);for(;a<l;a++){if(typeof o[a]==="function"){const t=g++;w.set(t,o[a]);o[a]=[n+".cb",t];(c[2]=c[2]||[]).push(t)}}const d=t=>t.postMessage([n,r,e,o],u(o));if(t.then){t.then(d)}else{d(t)}}));const x=import("./table.worker-899871ed.js").then((t=>t.worker));const $=k(x,"stencil.table.worker","createWorkerStore");const z=k(x,"stencil.table.worker","syncConfigToWorker");const C=k(x,"stencil.table.worker","syncDataToWorker");const S=k(x,"stencil.table.worker","workerFilter");const R=k(x,"stencil.table.worker","workerSearch");const T=k(x,"stencil.table.worker","workerSort");function I(t){const n=JSON.parse(JSON.stringify(t));t.forEach((t=>{if(t?.sortCompareFn){const e=n.find((n=>n.prop===t.prop));e.sortCompareFn=t.sortCompareFn.toString()}}));return n}const B=new WeakMap;async function P(t,n,e,o){const i={data:f({rows:[]}),config:f({columns:n}),general:f({workerId:null,scrollParent:e,host:t,isReady:o})};const s=await $(i.data.state.rows,I(i.config.state.columns));i.general.state.workerId=s;B.set(t,i);i.data.use({reset:()=>{if(i.general.state.workerId)C(i.general.state.workerId,null)},dispose:()=>{if(i.general.state.workerId)C(i.general.state.workerId,null)}});i.config.use({reset:()=>{if(i.general.state.workerId)z(i.general.state.workerId,null)},dispose:()=>{if(i.general.state.workerId)z(i.general.state.workerId,null)}});return i}function A(t){return B.get(t)}function F(t){if(t instanceof Date){return"date"}if(["number","string","boolean"].includes(typeof t)){return typeof t}return"unknown"}function E(t,n){const e=B.get(t);if(!e)return;const o=e.config.state.columns;const i=o.filter((t=>t.type==="date")).reduce(((t,n)=>[...t,n.prop]),[]);const s=o.filter((t=>!t.type));n=n.map(((t,n)=>{if(s.length&&n===0){e.config.state.columns=o.map((n=>{if(s.includes(n)&&t[n.prop]&&!n.type){n.type=F(t[n.prop]);if(n.type==="date")i.push(n.prop)}return n}))}i.forEach((n=>{const e=new Date(t[n]);if(!!e&&Number(e))t[n]=Number(e)}));t["__index"]=n;t["__uuid"]=d(o.map((n=>t[n.prop])).join());return t}));e.data.state.rows=n;if(e.general.state.workerId)return C(e.general.state.workerId,n)}function M(t,n){const e=B.get(t);if(!e)return;e.config.state.columns=n;if(e.general.state.workerId)return z(e.general.state.workerId,I(n))}async function D(t,n){const e=B.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await R(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function N(t,n){const e=B.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await S(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function j(t,n,e){const o=B.get(t);if(!o||!o.general.state.workerId)return;try{o.data.state.rows=await T(o.general.state.workerId,n,e)}catch(t){console.warn(t)}}function H(t,n){const e=L();const o=e.config.state.columns;const i=e.data.state.rows;const s=o[n];const r=s?.prop;const a=i[t];const l=a?a[o[n].prop]:"";return{prop:r,cellModel:l,column:s,rowIndex:t,rowModel:a}}function O(t){const n=L();const e=n.data.state.rows;const o=e[t];return{rowModel:o,rowIndex:t}}function W(t,n){if(!n)return t;const e={...n,...t};if(n.class){if(typeof n.class==="object"&&typeof e.class==="object"){e.class={...n.class,...e.class}}else if(typeof n.class==="string"&&typeof e.class==="object"){e.class[n.class]=true}else if(typeof e.class==="string"&&typeof n.class==="string"){e.class+=" "+n.class}}if(n.style){e.style={...n.style,...e.style}}return e}function L(){return A(o(i()))}function Y(t,n,e){const o={...e};const i=L().config.state.columns[n]?.cellProperties;if(!i)return o;const s=H(t,n);const r=i(s);if(!r)return o;return W(o,r)}function J(t){const o=t?.columnTemplate;return o?o(n,t):n(e,null,t.title)}function K(t,n,e=false){const o={[`${p}__${t}`]:true,[`${p}__pin`]:!!n,[`${p}__pin--top`]:n==="top",[`${p}__pin--bottom`]:n==="bottom"};if(e)return X(o);return o}function X(t){let n="";Object.entries(t).forEach((([t,e])=>{if(e)n+=t+" "}));return n}function q(t,n=100){const e=t.getBoundingClientRect();const o=window.innerHeight||document.documentElement.clientHeight;if(!e.bottom&&!e.top&&!e.left&&!e.right&&!e.height&&!e.width&&!e.x&&!e.y)return false;return!(Math.floor(100-(e.top>=0?0:e.top)/+-e.height*100)<n||Math.floor(100-(e.bottom-o)/e.height*100)<n)}const U=({column:t,onColumnSortClick:o,defaults:i})=>{function s(n){let e;switch(t.order){case"asc":e="desc";break;case"desc":e=null;break;default:e="asc"}o(e,t.prop,n.target.closest("th"))}function r(){return!!i.sortable&&t.sortable!==false||!i.sortable&&t.sortable===true}let a={};if(t.columnProperties){a=t.columnProperties(t)||a}const l={class:{...K("th",t.pinned),[`${p}__pin--start`]:t.pinned==="start",[`${p}__pin--end`]:t.pinned==="end",[`${p}__ordered`]:!!t.order,[`${p}__filtered`]:t.filter!==undefined&&t.filter!==null}};let c=a?W(l,a):l;const d=J(t);if(!d)return n(e,null);c=Number(c.colSpan)>1?{...c,scope:"colgroup"}:{...c,scope:"col"};if(r()){const n=t.order?t.order==="asc"?"ascending":"descending":"none";c={...c,"aria-sort":n}}return n("th",{...c,key:t.prop},r()?n("button",{class:{[`${p}__order-btn`]:true,[`${p}__cell-content`]:true},onClick:s},J(t),t.filter!==undefined&&t.filter!==null&&n("nano-icon",{name:"light/filter"}),!!t.order&&(t.order==="desc"?n("nano-icon",{name:"solid/arrow-down-long"}):n("nano-icon",{name:"solid/arrow-up-long"})),n("div",{class:`${p}__status-icons`},n("nano-icon",{name:"light/chevron-down"}))):n("div",{class:`${p}__cell-content`},J(t),t.filter!==undefined&&t.filter!==null&&n("nano-icon",{name:"light/bars-filter"})))};function G(t,o){const s=L();const r=s.config.state.columns;const a=r[o]?.cellTemplate;const l=H(t,o);const c=i();if(!!l.cellModel&&r[o].type==="date"){const t=new Date(l.cellModel);if(t instanceof Date&&!isNaN(t)){l.cellModel=!a?`${new Date(l.cellModel).toLocaleDateString()} ${new Date(l.cellModel).toLocaleTimeString()}`:t}}let d=false;const h=(...t)=>{d=true;return n(...t)};let b=a?a(h,l):undefined;if(b&&c.customRenderer&&b["t"]===undefined&&!(b instanceof Element)&&typeof b!=="string"&&!d){const t=document.createElement("template");const n=c.customRenderer(b,t.content);b=n&&n["then"]?n:t}return b?b:l.cellModel!==undefined&&l.cellModel!==null?n(e,null,l.cellModel?.toString()):""}const Q=(t,n=false)=>{const e=L();const o=e.config.state.columns[t];const i={[`${p}__td`]:true,[`${p}__ordered`]:!!o.order,[`${p}__pin`]:!!o.pinned,[`${p}__pin--start`]:o.pinned==="start",[`${p}__pin--end`]:o.pinned==="end"};if(n)return X(i);return i};const V=({rowIndex:t,colIndex:e,nestedContent:o})=>{const s=()=>o?o():G(t,e)||n("span",{class:"placeholder"}," ");let r="td";const a=i();const l=L();const c=l.config.state.columns[e];let d=Y(t,e,{class:Q(e)});if(c.rowHeader){d=Number(d.rowSpan)>1?{...d,scope:"rowgroup"}:{...d,scope:"row"};r="th"}const h=t=>{const e=s();return n("div",{ref:t=>{if(!t)return;if(e instanceof Element){t.replaceChildren();t.append(e["content"]||e)}else if(e["then"]){e.then((n=>t.innerHTML=n))}},...t,class:{[`${p}__cell-content`]:true,[`${p}__cell-content--wrap`]:!!c.wrap},innerHTML:typeof e==="string"&&e.includes("<")?e:undefined},(typeof e!=="string"||!e.includes("<"))&&!e["then"]&&!(e instanceof Element)&&e)};return n(r,{role:a.type==="grid"?"gridcell":undefined,...d},c.autoTooltip&&!c.wrap?n("nano-resize-observe",{notifyContentFit:"x",onNanoResizeContentFitChange:t=>t.target.firstElementChild.disabled=t.detail.x},n("nano-tooltip",{disabled:true,placement:"top",onNanoShow:t=>t.target.closest(r).style.zIndex="100",onNanoHide:t=>t.target.closest(r).style.zIndex=""},n(h,null),n("span",{slot:"content"},n(s,null)))):n(h,null))};const Z=(t,e,o)=>{const i=n("div",{...t.wrapperProps,class:{[`${p}__cell-content`]:true,[`${p}__cell-content--wrap`]:t.wrap}},e);return t.header?n("th",{scope:o,...t.cellProps},i):n("td",{...t.cellProps},i)};const tt=({rowRenderer:t,rowIndex:e,rowModel:o},i,s)=>{const r=({header:t,wrap:n,cellProps:e,wrapperProps:o},i)=>Z({header:t,wrap:n,cellProps:e,wrapperProps:o},i,"row");let a={};if(!o){const t=O(e);o=t.rowModel}if(t?.rowProperties){a=t.rowProperties({rowModel:o,rowIndex:e})||a}let l;if(t?.pinned&&typeof t.pinned==="function"){l=t.pinned({rowModel:o,rowIndex:e})}const c=W({class:K("tr",l,true)},a);const d=t?.template;const h=t=>s.map(t,((t,n)=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=W({class:Q(n,true)},t.vattrs)}return t}));if(d){let t=d(n,{renderedRow:n("tr",{...c,key:o.__uuid},i),rowModel:o,rowIndex:e},r);if(Array.isArray(t)){t=s.map(t,((t,n)=>{if(t.vtag==="tr"){if(!t.vkey)t.vkey=`${o.__uuid}_${n}`;t.vattrs=W({class:K("tr",l,true)},t.vattrs);if(t.vchildren){t.vchildren=h(t.vchildren)}}return t}))}return t}return n("tr",{...c,key:o.__uuid},h(i))};const nt=({rowRenderer:t},e,o)=>{let i={};if(t.rowProperties){i=t.rowProperties()||{}}const s=({header:t,wrap:n,cellProps:e,wrapperProps:o},i)=>Z({header:t,wrap:n,cellProps:e,wrapperProps:o},i,"col");const r=t.pinned||null;const a={class:K("tr",r)};const l=i?W(a,i):a;const c=t?.template;if(c){let t=c(n,{renderedRow:n("tr",{...l},e)},s);if(Array.isArray(t)){t=o.map(t,(t=>{if(t.vtag==="tr"){t.vattrs=W({class:K("tr",r,true)},t.vattrs);if(t.vchildren){t.vchildren=o.map(t.vchildren,(t=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=W({class:K(t.vtag.toString(),r,true)},t.vattrs)}return t}))}}return t}))}return t}return n("tr",{...l},e)};function et(t,n){const e=document.getElementById(t)||document.createElement("style");e.id=t;e.innerHTML=n;if(!e.isConnected)document.head.append(e)}class ot{cachedColMeta=new WeakMap;tableId;tableEle;scrollElement;startColumns;endColumns;topRows;bottomRows;tableDims;constructor(t,n){this.tableEle=t;this.tableId=this.tableEle.id;this.scrollElement=n;this.startColumns=t.querySelector("thead").getElementsByClassName(`${p}__pin--start`);this.endColumns=t.querySelector("thead").getElementsByClassName(`${p}__pin--end`);this.topRows=t.getElementsByClassName(`${p}__pin--top`);this.bottomRows=t.getElementsByClassName(`${p}__pin--bottom`);this.onResize()}get pinnedStart(){return this._pinnedStart}set pinnedStart(t){this._pinnedStart=t;this.handlePinnedStartChange()}_pinnedStart=[];handlePinnedStartChange(){s((()=>{if(this.pinnedStart.length){this.tableEle.classList.add(`${p}__pinned--start`);const t=this.cachedColMeta.get(this.pinnedStart[this.pinnedStart.length-1]);et(`${this.tableId}-col-start-active-style`,`\n #${this.tableId} tr > :nth-child(${t.idx+1}) {\n --pin-start-active: 1;\n }\n `)}else{this.tableEle.classList.remove(`${p}__pinned--start`);et(`${this.tableId}-col-start-active-style`,``)}}))}get pinnedEnd(){return this._pinnedEnd}set pinnedEnd(t){this._pinnedEnd=t;this.handlePinnedEndChange()}_pinnedEnd=[];handlePinnedEndChange(){s((()=>{if(this.pinnedEnd.length){this.tableEle.classList.add(`${p}__pinned--end`);const t=this.cachedColMeta.get(this.pinnedEnd[0]);et(`${this.tableId}-col-end-active-style`,`\n #${this.tableId} tr > :nth-child(${t.idx+1}) { --pin-end-active: 1; }\n `)}else{this.tableEle.classList.remove(`${p}__pinned--end`);et(`${this.tableId}-col-end-active-style`,``)}}))}get cssColDimensionCacheKey(){return this._cssColDimensionCacheKey}set cssColDimensionCacheKey(t){if(t===this._cssColDimensionCacheKey)return;this._cssColDimensionCacheKey=t;this.createPinnedColDimensionStyles()}_cssColDimensionCacheKey="";generateCssCacheKey(){let t="";for(const n of this.startColumns){const e=this.cachedColMeta.get(n);t+=`${e.idx}-start-${e.width}`}for(const n of this.endColumns){const e=this.cachedColMeta.get(n);t+=`${e.idx}-start-${e.width}`}this.cssColDimensionCacheKey=t}createPinnedColDimensionStyles(){let t=0;let n=0;const e=Array.from(this.startColumns);const o=Array.from(this.endColumns).reverse();const i=`\n ${e.map((n=>{const e=this.cachedColMeta.get(n);t+=e.width-1||-1;return`\n #${this.tableId} tr > :nth-child(${e.idx+1}) ~ td,\n #${this.tableId} tr > :nth-child(${e.idx+1}) ~ th {\n --pin-start: ${t-1}px;\n }\n `})).join("")}\n ${o.map((t=>{const e=this.cachedColMeta.get(t);n+=e.width-1||-1;return`\n #${this.tableId} tr > td:has(~ :nth-child(${e.idx+1})),\n #${this.tableId} tr > th:has(~ :nth-child(${e.idx+1})) {\n --pin-end: ${n-1}px;\n }\n `})).join("")}\n `;et(`${this.tableId}-dimension-style`,i)}getParentOffsets(){const{x:t,y:n}=this.scrollElement.getBoundingClientRect();let e=t;let o=n;if(this.scrollElement===document.documentElement){e=this.scrollElement.offsetLeft;o=this.scrollElement.offsetTop}return{offsetX:e,offsetY:o}}assessRows(){if(!this.topRows.length&&!this.bottomRows.length)return;if(this.topRows.length){r((async()=>{let t=0;let n;const{offsetY:e}=this.getParentOffsets();for(const o of this.topRows){const{y:i,height:r}=o.getBoundingClientRect();const a=o.parentElement;const l=getComputedStyle(o).getPropertyValue("--pin-top");const c=l!==""?parseFloat(l):t;s((()=>{if(i-e<=c){o.classList.add(`${p}__pinned`,`${p}__pinned--top`)}else{o.classList.remove(`${p}__pinned`,`${p}__pinned--top`)}if(n!==a){a.style.setProperty("--pin-top",`${t-1}px`);t+=r-1;n=a}}))}}))}if(this.bottomRows.length){const t=Array.from(this.bottomRows).reverse();r((async()=>{let n;let e=0;const{offsetY:o}=this.getParentOffsets();for(const i of t){if(!i.isConnected)continue;const{y:t,height:r}=i.getBoundingClientRect();const a=i.parentElement;const l=getComputedStyle(i).getPropertyValue("--pin-bottom");const c=l!==""?parseFloat(l):e;await new Promise((l=>s((()=>{if(this.tableDims.height+o-(t+r)<=c){i.classList.add(`${p}__pinned`,`${p}__pinned--bottom`)}else{i.classList.remove(`${p}__pinned`,`${p}__pinned--bottom`)}if(n!==a){a.style.setProperty("--pin-bottom",`${e-1}px`);e+=r-1;n=a}l()}))))}}))}}async assessCols(){if(!this.startColumns.length&&!this.endColumns.length)return;let t;let n;let e;const o=new Promise((o=>{if(this.startColumns.length){r((()=>{const{offsetX:i}=this.getParentOffsets();let s=i;e=Array.from(this.startColumns[0].parentElement.children);for(const o of this.startColumns){t=o.getBoundingClientRect();this.cachedColMeta.set(o,{width:t.width,idx:e.indexOf(o)});n=this.pinnedStart.find((t=>t===o));if(t.x<s){if(!n)this.pinnedStart=[...this.pinnedStart,o]}else if(n){this.pinnedStart=this.pinnedStart.filter((t=>t!==o))}s+=t.width}if(!this.endColumns.length)o()}))}if(this.endColumns.length){r((()=>{const i=Array.from(this.endColumns).reverse();e=Array.from(this.endColumns[0].parentElement.children);const{offsetX:s}=this.getParentOffsets();let r=0;for(const o of i){t=o.getBoundingClientRect();this.cachedColMeta.set(o,{width:t.width,idx:e.indexOf(o)});n=this.pinnedEnd.find((t=>t===o));if(this.tableDims.width+s-t.right<=r){if(!n)this.pinnedEnd=[o,...this.pinnedEnd]}else if(n){this.pinnedEnd=this.pinnedEnd.filter((t=>t!==o))}r+=t.width}o()}))}}));await o;this.generateCssCacheKey()}cacheX=0;cacheY=0;onScroll(t){if(this.cacheX!==t.x){this.cacheX=t.x;this.assessCols()}if(this.cacheY!==t.y){this.cacheY=t.y;this.assessRows()}}onResize(){const t=this.scrollElement.clientWidth;const n=this.scrollElement.clientHeight;this.tableDims={width:t,height:n};this.assessCols();this.assessRows()}}const it=':host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}nano-table{display:block;inline-size:100%;--max-col-width:clamp(200px, 500px, 50vw);--color:var(--nano-color-mediumgrey, #68767e);--font-size:0.87rem;--cell-line-height:1.5;--thead-font-size:0.95rem;--thead-color:#455560;--tfoot-color:#455560;--border-color:#dddbda;--border-style:thin solid var(--border-color);--border-tint-color:#0084a9;--border-tint-style:3px solid var(--border-tint-color);--cell-bg-rgb:var(--nano-color-white-rgb, 255 255 255);--head-bg-rgb:250 250 249;--foot-bg-rgb:var(--head-bg-rgb);--th-row-bg-rgb:var(--cell-bg-rgb);--ordered-bg-rgb:var(--nano-color-offwhite-rgb, 249 249 251);--td-padding-start:0.625rem;--td-padding-end:0.625rem;--td-padding-top:0.6rem;--td-padding-bottom:0.6125rem;--th-padding-start:0.725rem;--th-padding-end:0.625rem;--th-padding-top:0.875rem;--th-padding-bottom:0.6875rem;--td-padding-v:var(--td-padding-top) var(--td-padding-bottom);--td-padding-h:var(--td-padding-start) var(--td-padding-end);--th-padding-v:var(--th-padding-top) var(--th-padding-bottom);--th-padding-h:var(--th-padding-start) var(--th-padding-end);--foot-th-padding-v:var(--td-padding-top) var(--td-padding-bottom);--foot-th-padding-h:var(--td-padding-start) var(--td-padding-end);--head-th-padding-v:var(--th-padding-top) var(--th-padding-bottom);--head-th-padding-h:var(--th-padding-start) var(--th-padding-end);--bookend-col-padding:2rem}.nano-tbl{color:var(--color);text-align:start;inline-size:100%;font-size:var(--font-size);border-spacing:0 0;border-collapse:separate;background:rgb(var(--cell-bg-rgb));border-inline-end:1px solid transparent;border-block-start:1px solid transparent;position:relative;z-index:1}.nano-tbl__wrap{display:table;min-inline-size:100%}.nano-tbl__top-anchor{clip:rect(1px, 1px, 1px, 1px);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;position:relative}.nano-tbl__ordered{background-color:var(--ordered-bg);border-inline-start:var(--border-style);border-inline-end:var(--border-style)}.nano-tbl__order-btn{padding:0;border:none;outline:none;font:inherit;background:none;appearance:none;color:inherit;display:flex;gap:10px;align-items:center;inline-size:100%}.nano-tbl__order-btn:focus-visible{outline:none;box-shadow:var(--nano-control-focus-shadow, 0 0 0 0.1875rem var(--nano-control-focus-color, rgba(144, 198, 231, 0.8))) inset}.nano-tbl__status-icons{margin-inline:auto 10px;display:flex;gap:10px}.nano-tbl__progress-bar{font-size:0.2rem;position:sticky;inset-block-start:0;inset-inline:0;z-index:10;transition:scale 0.25s;transform:scale(0);inline-size:100%;block-size:0}.nano-tbl__progress-bar--show{transform:scale(1);block-size:auto}.nano-tbl__caption--hide{clip:rect(1px, 1px, 1px, 1px);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute}.nano-tbl__td,.nano-tbl__th{line-height:var(--cell-line-height);text-align:start;border-block-start:var(--border-style);max-inline-size:var(--max-col-width);background-color:rgb(var(--cell-bg-rgb))}tbody:first-of-type tr:first-child .nano-tbl__td,tbody:first-of-type tr:first-child .nano-tbl__th{border-block-start:none}tbody:last-of-type tr:last-child .nano-tbl__td,tbody:last-of-type tr:last-child .nano-tbl__th{border-block-end:var(--border-style)}.md .nano-tbl__td:first-child .nano-tbl__cell-content,.md .nano-tbl__th:first-child .nano-tbl__cell-content{padding-inline-start:var(--bookend-col-padding)}.md .nano-tbl__td:last-child .nano-tbl__cell-content,.md .nano-tbl__th:last-child .nano-tbl__cell-content{padding-inline-end:var(--bookend-col-padding)}@media (max-width: 768px){.nano-tbl__td:first-child .nano-tbl__cell-content,.nano-tbl__th:first-child .nano-tbl__cell-content{padding-inline-start:var(--td-padding-start) !important}.nano-tbl__td:last-child .nano-tbl__cell-content,.nano-tbl__th:last-child .nano-tbl__cell-content{padding-inline-end:var(--td-padding-end) !important}}thead .nano-tbl__td,thead .nano-tbl__th{color:var(--thead-color);font-weight:800;background:rgb(var(--head-bg-rgb)/100%);font-size:var(--thead-font-size);border-block-start:none !important}thead .nano-tbl__td .nano-tbl__cell-content,thead .nano-tbl__th .nano-tbl__cell-content{padding-block:var(--head-th-padding-v);padding-inline:var(--head-th-padding-h)}thead .nano-tbl__td .nano-sortable__keyboard-handle,thead .nano-tbl__th .nano-sortable__keyboard-handle{position:absolute;inset-inline-end:5px;inset-block-start:50%;transform:translateY(-50%);background:white;z-index:10}tfoot .nano-tbl__td,tfoot .nano-tbl__th{color:var(--tfoot-color);font-weight:800;border-block-start:none;background:rgb(var(--foot-bg-rgb)/100%);font-size:var(--thead-font-size)}tfoot .nano-tbl__td .nano-tbl__cell-content,tfoot .nano-tbl__th .nano-tbl__cell-content{padding-block:var(--foot-th-padding-v);padding-inline:var(--foot-th-padding-h)}.nano-tbl__td.nano-tbl__ordered,.nano-tbl__th.nano-tbl__ordered{background-color:rgb(var(--ordered-bg-rgb)/80%) !important}.nano-tbl__cell-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-block:var(--td-padding-v);padding-inline:var(--td-padding-h)}.nano-tbl__cell-content--no-result{padding-block:2rem}.nano-tbl__cell-content--wrap{white-space:normal;overflow:visible}.nano-tbl tbody{will-change:scroll-position;opacity:1;transition:0.1s ease opacity}.nano-tbl tbody.nano-tbl__loading{z-index:-1;position:relative}.nano-tbl tbody.nano-tbl__inactive{opacity:0}.nano-tbl tbody .nano-tbl__tr:has(~.nano-tbl__tr--placeholder){display:none}.nano-tbl tbody .nano-tbl__tr--placeholder~.nano-tbl__tr{display:none}.nano-tbl th[scope=row]{font-weight:800;margin:0}.nano-tbl__tr{--base-z:0}.nano-tbl__pin{z-index:var(--z, var(--base-z, 0))}.nano-tbl__pin .nano-tbl__th,.nano-tbl__pin .nano-tbl__td{z-index:var(--z, var(--base-z, 0))}.nano-tbl__pin--start{position:sticky;inset-inline-start:var(--pin-start, -1px)}.nano-tbl__pin--start::after{content:"";position:absolute;inset:0;box-shadow:5px 0 4px -1px rgba(0, 0, 0, 0.2);opacity:var(--pin-start-active, 0);z-index:-1}.nano-tbl__pinned--start .nano-tbl__pin--start{--z:calc(var(--base-z) + 3) !important}.nano-tbl__pin--end{position:sticky}.nano-tbl__pin--start+.nano-tbl__pin--end{inset-inline-end:auto !important}.nano-tbl__pin--start+.nano-tbl__pin--end::after{display:none}.sm .nano-tbl__pin--end{inset-inline-end:var(--pin-end, -1px);max-inline-size:min(50vw, 200px)}.sm .nano-tbl__pin--end::after{display:block !important;content:"";position:absolute;inset:0;box-shadow:-5px 1px 4px -1px rgba(0, 0, 0, 0.2);opacity:var(--pin-end-active, 0);z-index:-1}.sm .nano-tbl__pinned--end .nano-tbl__pin--end{--z:calc(var(--base-z) + 2) !important}.nano-tbl__pin--top .nano-tbl__th,.nano-tbl__pin--top .nano-tbl__td{position:sticky;inset-block-start:var(--pin-top, -1px)}.nano-tbl__pin--top .nano-tbl__pin--end,.nano-tbl__pin--top .nano-tbl__pin--start{--z:calc(var(--base-z) + 1)}.nano-tbl__pin--top.nano-tbl__pinned--top{--base-z:4}tbody .nano-tbl__pin--top.nano-tbl__pinned--top .nano-tbl__th,tbody .nano-tbl__pin--top.nano-tbl__pinned--top .nano-tbl__td{box-shadow:1px 3px 4px -1px rgba(0, 0, 0, 0.1)}.nano-tbl__pin--bottom .nano-tbl__th,.nano-tbl__pin--bottom .nano-tbl__td{position:sticky;inset-block-end:var(--pin-bottom, -1px)}.nano-tbl__pin--bottom .nano-tbl__pin--end,.nano-tbl__pin--bottom .nano-tbl__pin--start{--z:calc(var(--base-z) + 1)}.nano-tbl__pin--bottom.nano-tbl__pinned--bottom{--base-z:5}.nano-tbl__pin--bottom.nano-tbl__pinned--bottom:has(.nano-tbl__pin--bottom.nano-tbl__pinned--bottom) .nano-tbl__pin{--base-z:6}tbody .nano-tbl__pin--bottom.nano-tbl__pinned--bottom .nano-tbl__th,tbody .nano-tbl__pin--bottom.nano-tbl__pinned--bottom .nano-tbl__td{box-shadow:1px -3px 4px -1px rgba(0, 0, 0, 0.07)}.nano-tbl thead tr:last-of-type td,.nano-tbl thead tr:last-of-type th{border-block-end:var(--border-tint-style)}.nano-tbl tfoot tr:first-of-type td,.nano-tbl tfoot tr:first-of-type th{border-block-start:none}.nano-tbl tfoot tr:last-of-type td,.nano-tbl tfoot tr:last-of-type th{border-block-start:var(--border-style);border-block-end:var(--border-tint-style)}.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:first-of-type td,.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:first-of-type th{border-block-start:var(--border-tint-style) !important}.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:last-of-type td,.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:last-of-type th{border-block-end:none !important}.nano-tbl .unlimited-width{max-inline-size:none}.nano-tbl__spinner{font-size:1.5rem;transition:scale 0.25s;scale:0;padding:0.5rem;position:absolute;inset-block-end:0;inset-inline-start:calc(50% - 0.75rem);z-index:0}.nano-tbl__spinner--show{scale:1;position:sticky}.nano-tbl nano-skeleton{line-height:var(--cell-line-height)}';const st=it;const rt=false;function at(t,n=false){if(!performance||!rt)return;if(n){performance?.mark("end"+t);performance?.measure(t,"start"+t,"end"+t);const n=performance?.getEntriesByName(t);console.info(n[n.length?n.length-1:0])}else{performance?.mark("start"+t)}}let lt=0;const ct=class{constructor(t){a(this,t);this.nanoTblReady=l(this,"nanoTblReady",7);this.nanoTblBlockRendered=l(this,"nanoTblBlockRendered",7);this.nanoTblBeforeSort=l(this,"nanoTblBeforeSort",7);this.nanoTblAfterSort=l(this,"nanoTblAfterSort",7);this.nanoTblBeforeFilter=l(this,"nanoTblBeforeFilter",7);this.nanoTblAfterFilter=l(this,"nanoTblAfterFilter",7);this.nanoTblBeforeSearch=l(this,"nanoTblBeforeSearch",7);this.nanoTblAfterSearch=l(this,"nanoTblAfterSearch",7);this.nanoTblBeforeEdit=l(this,"nanoTblBeforeEdit",7);this.debounceSetLoading=h(this.debounceSetLoading.bind(this),50)}customRenderer;type="table";caption;showCaption=false;loading=undefined;get _loading(){return this.loading!==undefined?this.loading:this.internalLoading}set _loading(t){if(this.loading!==undefined)return;this.debounceSetLoading(t)}debounceSetLoading(t){this.internalLoading=t}internalLoading=true;placeholderSize=5;rows;handleRowsChange(){if(!this.rows){this._loading=true;return}this._loading=true;Promise.resolve(this.rows).then((async t=>{await E(this.host,t);this.currentFilters="";this.currentSort="";await this.columnInit();if(!this.isReady)requestAnimationFrame((()=>this.setInitialBlockDimension()));this._loading=false;if(this.tablePinnedService)this.tablePinnedService.assessRows()}))}columns=[];async handleColsChange(){await M(this.host,this.columns);if(this.isReady)this.columnInit()}headRender={pinned:"top"};rowRender;footRender={pinned:"bottom"};showFooter=false;perBlock=50;get blocksLength(){return this.blocks.length}searchTerm;customFilterFn;customSortFn;defaultSort=true;handleSearchTermChange(){this.searchStart()}virtualTotalItems=0;virtualTotalItemsChangeHandler(){this.setBlocks()}get appliedFilters(){return this.filters}nanoTblReady;nanoTblBlockRendered;nanoTblBeforeSort;nanoTblAfterSort;nanoTblBeforeFilter;nanoTblAfterFilter;nanoTblBeforeSearch;nanoTblAfterSearch;nanoTblBeforeEdit;async resetSorting(){const t=this.columns.find((t=>!!t.order));if(!t)return;return this.sortStart(null,t.prop)}async addSort(t,n){const e=this.columns.find((n=>n.prop===t));if(!e)throw new Error("Cannot find column with "+t);return this.sortStart(n,e.prop)}async resetFilters(){this.filters=[];return this.filterStart()}async addFilters(t,n=true){if(!n)this.filters=[];return this.filterStart(t,n)}async removeFilters(t){this.filters=this.filters.filter((n=>!t.includes(n.prop)));return this.filterStart()}async updateRow(t,n){this.rows.splice(n,1,t);this.handleRowsChange()}get host(){return o(this)}renderId="tbl-"+lt++;store;filters=[];currentFilters="[]";currentSort="";tableEle;topAnchorEle;tableWrapperEle;activeWatcherIo;tablePinnedService;blocks=[];activeBlocks=[0,1];measureHeight=0;blockElements;blockHeights=[];set measureEle(t){if(!t)return;const n=t.getBoundingClientRect().height;this.measureHeight=Math.abs(this.measureHeight-n)<5?this.measureHeight:n;this.unitHeight=t.querySelector("tr")?.getBoundingClientRect().height||this.unitHeight}unitHeight=0;get scrollParent(){return this._scrollParent}set scrollParent(t){if(t===this._scrollParent)return;if(this._scrollParent){(this._scrollParent===document.documentElement?document:this._scrollParent).removeEventListener("scroll",this.scrollHandler)}(t===document.documentElement?document:t).addEventListener("scroll",this.scrollHandler);this._scrollParent=t}_scrollParent;get primaryBlockIndex(){return this._primaryBlockIndex}set primaryBlockIndex(t){if(this._primaryBlockIndex===t)return;this._primaryBlockIndex=t;this.nanoTblBlockRendered.emit({block:t,totalBlocks:this.blockElements.length})}_primaryBlockIndex;get isReady(){return this._isReady}set isReady(t){if(t===this._isReady)return;this._isReady=t;if(this.isReady)requestAnimationFrame((()=>this.handleReady()))}_isReady=false;handleReady(){const t=window.location.hash;if(t.length>1){try{const n=document.querySelector(t);if(n)n.scrollIntoView()}catch(t){}}this.nanoTblReady.emit()}sortStart=async(t,n,e)=>{if(this.currentSort===t+":"+n)return;this._loading=true;const o=this.nanoTblBeforeSort.emit({column:n,order:t});if(o.defaultPrevented)return;at("sort");this.currentSort=t+":"+n;this.scrollToTop(e);if(this.customSortFn){try{const e=await this.customSortFn(n,t);if(e===true){this.sortComplete(t,n);this._loading=false;return}}catch(t){console.warn("custom sort failed",t);this.currentSort="";this._loading=false;return}}try{await j(this.host,n,t);this.sortComplete(t,n)}catch(t){console.warn("sort failed",t);this.currentSort=""}finally{if(this.blocks.length)this._loading=false}};sortComplete(t,n){this.columns=this.columns.map((e=>{if(e.prop===n)return{...e,order:t};return{...e,order:null}}));this.nanoTblAfterSort.emit({column:n,order:t});at("sort",true)}async searchStart(){this._loading=true;const t=this.nanoTblBeforeSearch.emit({term:this.searchTerm});if(t.defaultPrevented)return;at("search");this.scrollToTop();try{await D(this.host,this.searchTerm);this.nanoTblAfterSearch.emit({term:this.searchTerm});at("search",true)}catch(t){console.warn("search failed",t)}finally{this._loading=false}}async filterStart(t,n=true){if(t){if(n){this.filters=[...this.filters.filter((n=>!t.find((t=>t.prop===n.prop)))),...t]}else{this.filters=t}}if(this.currentFilters===JSON.stringify(this.filters))return;this._loading=true;const e=this.nanoTblBeforeFilter.emit({filters:this.filters});if(e.defaultPrevented)return;at("filter");this.currentFilters=JSON.stringify(this.filters);this.scrollToTop();if(this.customFilterFn){try{const t=await this.customFilterFn(this.filters);if(t===true){this.filterComplete();this._loading=false;return}}catch(t){console.warn("custom filter failed",t);this.currentFilters="";this._loading=false;return}}try{await N(this.host,this.filters);this.filterComplete()}catch(t){console.warn("filter failed",t)}finally{this._loading=false}}filterComplete(){this.columns=this.columns.map((t=>{const n=this.filters.find((n=>n.prop===t.prop));if(n&&(typeof n.filter!=="boolean"&&n.filter.length||typeof n.filter==="boolean"))t.filter=n.filter;else if(t.filter!==null&&t.filter!==undefined||!!t.filter&&typeof t.filter!=="boolean"&&!t.filter.length)t.filter=undefined;return t}));this.nanoTblAfterFilter.emit({filters:this.filters});at("filter",true)}scrollToTop(t){const n=this.scrollParent.style?.scrollBehavior;const e=this.scrollParent.scrollLeft;this.scrollParent.style.scrollBehavior="auto";if(this.topAnchorEle&&!q(this.topAnchorEle,.1)){this.host.scrollIntoView()}if(t&&!q(t,1))setTimeout((()=>t.scrollIntoView({block:"start"})),500);if(e)this.scrollParent.scrollLeft=e;if(n)this.scrollParent.style.scrollBehavior=n;this.scrollHandler()}setMeasureElement(){return new Promise((t=>{r((()=>{this.measureEle=this.blockElements.find((t=>!t?.classList?.contains(`${p}__inactive`)));t()}))}))}setInitialBlockDimension(){if(!this.blockElements?.length)return;at("blockDims");const t=async()=>{await this.setMeasureElement();if(this.unitHeight)return true;return false};const n=new Promise((n=>{t().then((async e=>{if(e)n();else{const e=new IntersectionObserver((async()=>{if(await t()){n();e.disconnect()}}),{root:this.scrollParent});e.observe(this.tableEle)}}))}));n.then((()=>{at("blockDims",true);at("init",true);requestAnimationFrame((()=>this.isReady=true))}))}async columnInit(){this.filters=this.columns.filter((t=>t.filter!==undefined&&t.filter!==null)).map((t=>{const{filter:n,prop:e}=t;return{filter:n,prop:e}}));if(this.searchTerm){await this.searchStart()}if(this.filters.length){await this.filterStart()}const t=this.columns.find((t=>!!t.order));if(t){await this.sortStart(t.order,t.prop)}if(this.tablePinnedService)this.tablePinnedService.assessCols()}setBlocks(){const t=this.store.data.state.rows;if(!t.length){this.blocks=[];return}at("setBlocks");let n=1;const e=this.virtualTotalItems>t.length?this.virtualTotalItems:t.length;let o=[];const i=[];for(n;n<=e;n++){o.push(this.store.data.state.rows[n-1]||{__uuid:""});if(n%this.perBlock===0){i.push({rows:o,__uuid:d(o.map((t=>t.__uuid)).join())});o=[]}}if(o.length){i.push({rows:o,__uuid:d(o.map((t=>t.__uuid)).join())})}this.blocks=i;at("setBlocks",true)}getBlockHeight(t){if(this.blockHeights.length){const n=this.blockHeights.find((n=>n.blockIndex===t));if(n&&n.height)return n.height}const n=this.blocks[t].rows.length;if(n===this.perBlock&&this.measureHeight){return this.measureHeight}return this.unitHeight?this.unitHeight*n:100}setBlockHeight(){this.activeBlocks.forEach((t=>{const n=this.blockElements[t];if(!n)return;r((()=>{if(n.classList.contains(`${p}__inactive`))return;const e=n.getBoundingClientRect().height;const o=this.blockHeights.findIndex((n=>n.blockIndex===t));if(o>-1){this.blockHeights[o]={height:e,blockIndex:t}}else this.blockHeights.push({height:e,blockIndex:t})}))}))}scrollHandler=()=>{let t=0;at("scrollHandler");if(!this.store?.general.state.isActive||!this.rows)return;if(this.primaryBlockIndex===undefined)this.primaryBlockIndex=0;r((()=>{t=typeof this.scrollParent.scrollTop!=="undefined"?this.scrollParent.scrollTop:window.scrollY;t+=this.host.offsetTop;if(this.tablePinnedService){this.tablePinnedService.onScroll({x:typeof this.scrollParent.scrollLeft!=="undefined"?this.scrollParent.scrollLeft:window.scrollX,y:t})}let n=this.host.offsetTop;let e=0;const o=this.blocks.length;while(e<o&&t>=n){n+=this.getBlockHeight(e);if(t<n){const t=[e,e+1];if(t.toString()!==this.activeBlocks.toString()){this.activeBlocks=t}this.primaryBlockIndex=e}e++}at("scrollHandler",true)}))};processSlots(){if(!this.caption&&!this.host.querySelector('[slot="caption"]')){console.error("For accessibility you must set a `caption` prop or use the `caption` slot")}}handleResizeChange=t=>{this.tableWrapperEle.className="";let n=[`${p}__wrap`];if(t.target?.className)n=[...t.target.className.split(" "),...n];this.tableWrapperEle.classList.add(...n.filter((t=>!!t)))};setupActiveWatcher(){if(!this.host||!this.scrollParent||!this.store)return;if(this.activeWatcherIo){this.activeWatcherIo.disconnect();this.activeWatcherIo=undefined}const t=this.activeWatcherIo=new IntersectionObserver((([t])=>{if(t.isIntersecting)this.store.general.state.isActive=true;else this.store.general.state.isActive=false}),{root:this.scrollParent,threshold:0});t.observe(this.host)}async componentWillLoad(){at("init");this.store=await P(this.host,this.columns,this.scrollParent,this.isReady);this.handleRowsChange();this.store.general.onChange("isActive",(()=>{this.scrollHandler()}));this.store.data.onChange("rows",(()=>this.setBlocks()));this.processSlots();this.setBlocks();this.scrollParent=b(this.host);this.setupActiveWatcher()}connectedCallback(){this.scrollParent=b(this.host);this.setupActiveWatcher()}componentDidLoad(){this.setInitialBlockDimension();if(!this.tablePinnedService){this.tablePinnedService=new ot(this.tableEle,this.scrollParent)}}componentShouldUpdate(t,n,e){if(["rows","columns"].includes(e))return false}componentWillRender(){at("render")}componentDidRender(){this.setMeasureElement().then((()=>this.setBlockHeight()));at("render",true)}disconnectedCallback(){if(!this.activeWatcherIo)return;this.activeWatcherIo.disconnect();this.activeWatcherIo=undefined;(this.scrollParent===document.documentElement?document:this.scrollParent).removeEventListener("scroll",this.scrollHandler)}render(){this.blockElements=[];return n(c,{key:"1e4ab2278e29d76d159067a99e0c39d487c5f5e8"},n("div",{key:"add91a783072a129791ae15e9e38469b608a9a42",class:`${p}__top-anchor`,ref:t=>this.topAnchorEle=t}," "),n("nano-resize-observe",{key:"42473dfa05d70d78e6a04a454fe15a871681ee73",states:"576w sm, 768w md",class:"sm md",onNanoResizeStateChange:this.handleResizeChange,onNanoResize:()=>{if(this.tablePinnedService)this.tablePinnedService.onResize()}}),n("div",{key:"b6bb33e682eae1701ae77b8c26212f14006bf1f0",class:`${p}__wrap sm md`,ref:t=>this.tableWrapperEle=t,"aria-labelledby":"nano-table-caption-"+this.renderId,tabindex:this.type==="grid"?"0":undefined},n("nano-progress-bar",{key:"a3ca4d3463ec4abd8060883c72eb5545602616b5",indeterminate:true,class:{[`${p}__progress-bar`]:true,[`${p}__progress-bar--show`]:this._loading}}),n("table",{key:"3a407d34ed95b772d39d91825035f6c8c5eae54e",role:this.type==="grid"?"grid":undefined,"aria-rowcount":this.store.data.state.rows.length,"aria-colcount":this.store.config.state.columns.length,class:`${p}`,ref:t=>this.tableEle=t,id:"nano-table-"+this.renderId},n("caption",{key:"b8555c7d0a7db2b09ba41c28fd4b81774422d45f",class:{[`${p}__caption`]:true,[`${p}__caption--hide`]:!this.showCaption},id:"nano-table-caption-"+this.renderId},n("slot",{key:"ca460b7fbad86981c43688851fe2449b9e886818",name:"caption"},this.caption)),n("thead",{key:"82e89f137736b85d916e24a81aea18b077de5ee9"},n(nt,{key:"3a09721cbb3c6341baa68a0e3e817b4ce7990a53",rowRenderer:this.headRender},this.store.config.state.columns.map((t=>[n(U,{column:t,headRenderer:this.headRender,onColumnSortClick:this.sortStart,defaults:{sortable:this.defaultSort}})])))),this._loading&&!this.blocks.length&&n("tbody",{key:"8c5914b4725653f0bb762c973c9a6a211383eb81",class:`${p}__active ${p}__loading`},[...Array(10).keys()].map((t=>n("tr",null,this.store.config.state.columns.map(((e,o)=>n(V,{rowIndex:t,colIndex:o,nestedContent:()=>n("nano-skeleton",null)}))))))),n("tr",{key:"a71542721bc459a6be7c9d00deee74461200f144",hidden:!!this._loading||!!this.blocks.length},n("th",{key:"d9b360896d32387502b086b765e8f7cfda99ddc1",class:`${p}__th`,colSpan:this.store.config.state.columns.length},n("div",{key:"59b8bde2817030fc5b67c18e03bb2e6e98392f6c",class:"nano-tbl__cell-content nano-tbl__cell-content--no-result"},n("slot",{key:"4bda7c0a503b9e9fc4dd3503207c869ba2ca7833",name:"no-results"},"No results found")))),this.blocks.map(((t,e)=>n("tbody",{key:t.__uuid,id:`tbody-${this.renderId}-${e}`,ref:t=>{this.blockElements.push(t)},class:{[`${p}__inactive`]:!this.activeBlocks.includes(e),[`${p}__active`]:this.activeBlocks.includes(e)}},this.activeBlocks.includes(e)?t.rows.map(((t,o)=>{const i=e>0?e*this.perBlock+o:o;return n(tt,{rowRenderer:this.rowRender,rowModel:t,rowIndex:i},this.store.config.state.columns.map(((t,e)=>n(V,{rowIndex:i,colIndex:e}))))})):n("tr",{class:`${p}__tr--placeholder`},n("td",{colSpan:this.store.config.state.columns.length,style:{height:this.getBlockHeight(e)+"px"}}))))),this.showFooter&&n("tfoot",{key:"b7b123eddfbd95767e533c35319f69294d3688c9"},n(nt,{key:"6c87f4710eb25f3fb4302ccd7a29329491da8d49",rowRenderer:this.footRender},this.store.config.state.columns.map((t=>[n(U,{column:t,headRenderer:this.footRender,onColumnSortClick:this.sortStart,defaults:{sortable:this.defaultSort}})]))))),!!this.blocks.length&&n("nano-spinner",{key:"3d0bb686da28cce7e7c90286b8fd82e4b84a8b2b",type:"circle",class:{[`${p}__spinner`]:true,[`${p}__spinner--show`]:this._loading}})))}static get watchers(){return{rows:["handleRowsChange"],columns:["handleColsChange"],searchTerm:["handleSearchTermChange"],virtualTotalItems:["virtualTotalItemsChangeHandler"]}}};ct.style=st;export{ct as T,v as c};
|
5
|
+
//# sourceMappingURL=nano-table-83296fde.js.map
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
2
|
* Web Components for Nanopore digital Web Apps
|
3
3
|
*/
|
4
|
-
export{T as nano_table}from"./nano-table-
|
4
|
+
export{T as nano_table}from"./nano-table-83296fde.js";import"./index-815d3f98.js";import"./math-d160f8a6.js";import"./throttle-df960210.js";import"./scroll-parent-be39fbd0.js";import"./index-32d24a05.js";
|
5
5
|
//# sourceMappingURL=nano-table.entry.js.map
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
2
|
* Web Components for Nanopore digital Web Apps
|
3
3
|
*/
|
4
|
-
import{c as t}from"./nano-table-
|
5
|
-
//# sourceMappingURL=table.worker-
|
4
|
+
import{c as t}from"./nano-table-83296fde.js";import"./index-815d3f98.js";import"./math-d160f8a6.js";import"./throttle-df960210.js";import"./scroll-parent-be39fbd0.js";import"./index-32d24a05.js";const e="table.worker";const o="stencil.table.worker";const r=new URL("table.worker-5b29550e.js",import.meta.url).href;let s;try{s=t(r,e,o)}catch(a){const i=new Blob(['importScripts("'+r+'")'],{type:"text/javascript"});const n=URL.createObjectURL(i);s=t(n,e,o);URL.revokeObjectURL(n)}export{s as worker,o as workerMsgId,e as workerName,r as workerPath};
|
5
|
+
//# sourceMappingURL=table.worker-899871ed.js.map
|
package/docs-json.json
CHANGED
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
{"file":"table.worker-bf995b67.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"file":"table.worker-d9e7db75.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|