@nanoporetech-digital/components 6.8.4 → 6.8.5
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/CHANGELOG.md +11 -0
- package/dist/cjs/{component-store-7427cb36.js → component-store-c2e19934.js} +16 -3
- package/dist/cjs/component-store-c2e19934.js.map +1 -0
- package/dist/cjs/nano-algolia-filter.cjs.entry.js +1 -1
- package/dist/cjs/nano-algolia.cjs.entry.js +1 -1
- package/dist/cjs/nano-dialog.cjs.entry.js +1 -1
- package/dist/cjs/nano-drawer.cjs.entry.js +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js +1 -1
- package/dist/cjs/nano-global-search-results.cjs.entry.js +1 -1
- package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab-group.cjs.entry.js +1 -1
- package/dist/cjs/{nano-table-80887e1e.js → nano-table-0f34020f.js} +2 -2
- package/dist/cjs/{nano-table-80887e1e.js.map → nano-table-0f34020f.js.map} +1 -1
- package/dist/cjs/nano-table.cjs.entry.js +1 -1
- package/dist/cjs/{table.worker-e47dba3a.js → table.worker-5cba101f.js} +2 -2
- package/dist/cjs/table.worker-5cba101f.js.map +1 -0
- package/dist/collection/components/checkbox/__tests__/__fixtures__/checkbox-templates.js +4 -4
- package/dist/collection/components/checkbox/__tests__/__fixtures__/checkbox-templates.js.map +1 -1
- package/dist/collection/components/global-search-results/global-search-results.js +1 -1
- package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
- package/dist/collection/utils/store/get-set.js +15 -2
- package/dist/collection/utils/store/get-set.js.map +1 -1
- package/dist/components/component-store.js +15 -2
- package/dist/components/component-store.js.map +1 -1
- package/dist/components/nano-global-search-results.js +1 -1
- package/dist/components/nano-global-search-results.js.map +1 -1
- package/dist/esm/{component-store-486d9d7a.js → component-store-64043183.js} +16 -3
- package/dist/esm/component-store-64043183.js.map +1 -0
- package/dist/esm/nano-algolia-filter.entry.js +1 -1
- package/dist/esm/nano-algolia.entry.js +1 -1
- package/dist/esm/nano-dialog.entry.js +1 -1
- package/dist/esm/nano-drawer.entry.js +1 -1
- package/dist/esm/nano-global-nav.entry.js +1 -1
- package/dist/esm/nano-global-search-results.entry.js +1 -1
- package/dist/esm/nano-global-search-results.entry.js.map +1 -1
- package/dist/esm/nano-tab-group.entry.js +1 -1
- package/dist/esm/{nano-table-b752fe01.js → nano-table-fc25f277.js} +2 -2
- package/dist/esm/{nano-table-b752fe01.js.map → nano-table-fc25f277.js.map} +1 -1
- package/dist/esm/nano-table.entry.js +1 -1
- package/dist/esm/{table.worker-c8338436.js → table.worker-55afec8e.js} +2 -2
- package/dist/esm/table.worker-55afec8e.js.map +1 -0
- package/dist/nano-components/component-store-64043183.js +5 -0
- package/dist/nano-components/component-store-64043183.js.map +1 -0
- package/dist/nano-components/nano-algolia-filter.entry.js +1 -1
- package/dist/nano-components/nano-algolia.entry.js +1 -1
- package/dist/nano-components/nano-dialog.entry.js +1 -1
- package/dist/nano-components/nano-drawer.entry.js +1 -1
- package/dist/nano-components/nano-global-nav.entry.js +1 -1
- package/dist/nano-components/nano-global-search-results.entry.js +1 -1
- package/dist/nano-components/nano-global-search-results.entry.js.map +1 -1
- package/dist/nano-components/nano-tab-group.entry.js +1 -1
- package/dist/nano-components/{nano-table-b752fe01.js → nano-table-fc25f277.js} +2 -2
- package/dist/nano-components/nano-table.entry.js +1 -1
- package/dist/nano-components/{table.worker-c8338436.js → table.worker-55afec8e.js} +2 -2
- package/docs-json.json +1 -1
- package/hydrate/index.js +16 -3
- package/package.json +2 -2
- package/dist/cjs/component-store-7427cb36.js.map +0 -1
- package/dist/cjs/table.worker-e47dba3a.js.map +0 -1
- package/dist/esm/component-store-486d9d7a.js.map +0 -1
- package/dist/esm/table.worker-c8338436.js.map +0 -1
- package/dist/nano-components/component-store-486d9d7a.js +0 -5
- package/dist/nano-components/component-store-486d9d7a.js.map +0 -1
- /package/dist/nano-components/{nano-table-b752fe01.js.map → nano-table-fc25f277.js.map} +0 -0
- /package/dist/nano-components/{table.worker-c8338436.js.map → table.worker-55afec8e.js.map} +0 -0
@@ -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 i,e as o,w as s,d as r,r as a,c as l,a as h}from"./index-9695db0a.js";import{a as c}from"./math-c02ddfda.js";import{d}from"./throttle-ac4fcefa.js";import{f as p}from"./scroll-parent-bab1cbf7.js";import{c as f}from"./index-3003356f.js";const b="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 w=new Map;const y=new Map;const v=(n,e,i)=>{const o=new Worker(n,{name:e});o.addEventListener("message",(({data:n})=>{if(n){const e=n[0];const o=n[1];const s=n[2];if(e===i){const e=n[3];const[i,r,a]=w.get(o);w.delete(o);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=>y.delete(t)))}i(s)}}else if(e===i+".cb"){try{y.get(o)(...s)}catch(n){t(n)}}}}));return o};const x=(t,n,e)=>(...i)=>new Promise(((o,s)=>{let r=m++;let a=0;let l=i.length;let h=[o,s];w.set(r,h);for(;a<l;a++){if(typeof i[a]==="function"){const t=g++;y.set(t,i[a]);i[a]=[n+".cb",t];(h[2]=h[2]||[]).push(t)}}const c=t=>t.postMessage([n,r,e,i],u(i));if(t.then){t.then(c)}else{c(t)}}));const k=import("./table.worker-c8338436.js").then((t=>t.worker));const $=x(k,"stencil.table.worker","createWorkerStore");const z=x(k,"stencil.table.worker","syncConfigToWorker");const C=x(k,"stencil.table.worker","syncDataToWorker");const S=x(k,"stencil.table.worker","workerFilter");const I=x(k,"stencil.table.worker","workerSearch");const R=x(k,"stencil.table.worker","workerSort");function P(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 T=new WeakMap;async function A(t,n,e,i){const o={data:f({rows:[]}),config:f({columns:n}),general:f({workerId:null,scrollParent:e,host:t,isReady:i})};const s=await $(o.data.state.rows,P(o.config.state.columns));o.general.state.workerId=s;T.set(t,o);o.data.use({reset:()=>{if(o.general.state.workerId)C(o.general.state.workerId,null)},dispose:()=>{if(o.general.state.workerId)C(o.general.state.workerId,null)}});o.config.use({reset:()=>{if(o.general.state.workerId)z(o.general.state.workerId,null)},dispose:()=>{if(o.general.state.workerId)z(o.general.state.workerId,null)}});return o}function M(t){return T.get(t)}function B(t){if(t instanceof Date){return"date"}if(["number","string","boolean"].includes(typeof t)){return typeof t}return"unknown"}function F(t,n){const e=T.get(t);if(!e)return;const i=e.config.state.columns;const o=i.filter((t=>t.type==="date")).reduce(((t,n)=>[...t,n.prop]),[]);const s=i.filter((t=>!t.type));n=n.map(((t,n)=>{if(s.length&&n===0){e.config.state.columns=i.map((n=>{if(s.includes(n)&&t[n.prop]&&!n.type){n.type=B(t[n.prop]);if(n.type==="date")o.push(n.prop)}return n}))}o.forEach((n=>{const e=new Date(t[n])??null;if(!!e&&Number(e))t[n]=Number(e)}));t["__index"]=n;t["__uuid"]=c(i.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 N(t,n){const e=T.get(t);if(!e)return;e.config.state.columns=n;if(e.general.state.workerId)return z(e.general.state.workerId,P(n))}async function j(t,n){const e=T.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await I(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function D(t,n){const e=T.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 O(t,n,e){const i=T.get(t);if(!i||!i.general.state.workerId)return;try{i.data.state.rows=await R(i.general.state.workerId,n,e)}catch(t){console.warn(t)}}function E(t,n){const e=L();const i=e.config.state.columns;const o=e.data.state.rows;const s=i[n];const r=s?.prop;const a=o[t];const l=a?a[i[n].prop]:"";return{prop:r,cellModel:l,column:s,rowIndex:t,rowModel:a}}function W(t){const n=L();const e=n.data.state.rows;const i=e[t];return{rowModel:i,rowIndex:t}}function H(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"){e.class+=" "+n.class}}if(n.style){e.style={...n.style,...e.style}}return e}function L(){return M(i(o()))}function J(t,n,e){const i={...e};const o=L().config.state.columns[n]?.cellProperties;if(!o)return i;const s=E(t,n);const r=o(s);if(!r)return i;return H(i,r)}function Y(t){const i=t?.columnTemplate;return i?i(n,t):n(e,null,t.title)}function q(t,n,e=false){const i={[`${b}__${t}`]:true,[`${b}__pin`]:!!n,[`${b}__pin--top`]:n==="top",[`${b}__pin--bottom`]:n==="bottom"};if(e)return K(i);return i}function K(t){let n="";Object.entries(t).forEach((([t,e])=>{if(e)n+=t+" "}));return n}function X(t,n=100){const e=t.getBoundingClientRect();const i=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-i)/e.height*100)<n)}const U=({column:t,onColumnSortClick:i,defaults:o})=>{function s(n){let e;switch(t.order){case"asc":e="desc";break;case"desc":e=null;break;default:e="asc"}i(e,t.prop,n.target.closest("th"))}function r(){return!!o.sortable&&t.sortable!==false||!o.sortable&&t.sortable===true}let a={};if(t.columnProperties){a=t.columnProperties(t)||a}const l={class:{...q("th",t.pinned),[`${b}__pin--start`]:t.pinned==="start",[`${b}__pin--end`]:t.pinned==="end",[`${b}__ordered`]:!!t.order,[`${b}__filtered`]:t.filter!==undefined&&t.filter!==null}};let h=a?H(l,a):l;const c=Y(t);if(!c)return n(e,null);h=Number(h.colSpan)>1?{...h,scope:"colgroup"}:{...h,scope:"col"};if(r()){const n=t.order?t.order==="asc"?"ascending":"descending":"none";h={...h,"aria-sort":n}}return n("th",{...h,key:t.prop},r()?n("button",{class:{[`${b}__order-btn`]:true,[`${b}__cell-content`]:true},onClick:s},Y(t),t.filter!==undefined&&t.filter!==null&&n("nano-icon",{name:"light/filter"}),!!t.order&&(t.order==="desc"?n("nano-icon",{name:"solid/long-arrow-down"}):n("nano-icon",{name:"solid/long-arrow-up"})),n("div",{class:`${b}__status-icons`},n("nano-icon",{name:"light/chevron-down"}))):n("div",{class:`${b}__cell-content`},Y(t),t.filter!==undefined&&t.filter!==null&&n("nano-icon",{name:"light/bars-filter"})))};function G(t,i){const s=L();const r=s.config.state.columns;const a=r[i]?.cellTemplate;const l=E(t,i);const h=o();if(!!l.cellModel&&r[i].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 c=false;const d=(...t)=>{c=true;return n(...t)};let p=a?a(d,l):undefined;if(p&&h.customRenderer&&p["t"]===undefined&&!(p instanceof Element)&&typeof p!=="string"&&!c){const t=document.createElement("template");const n=h.customRenderer(p,t.content);p=n&&n["then"]?n:t}return p?p:l.cellModel!==undefined&&l.cellModel!==null?n(e,null,l.cellModel?.toString()):""}const Q=(t,n=false)=>{const e=L();const i=e.config.state.columns[t];const o={[`${b}__td`]:true,[`${b}__ordered`]:!!i.order,[`${b}__pin`]:!!i.pinned,[`${b}__pin--start`]:i.pinned==="start",[`${b}__pin--end`]:i.pinned==="end"};if(n)return K(o);return o};const V=({rowIndex:t,colIndex:e,nestedContent:i})=>{const s=()=>i?i():G(t,e)||n("span",{class:"placeholder"}," ");let r="td";const a=o();const l=L();const h=l.config.state.columns[e];let c=J(t,e,{class:Q(e)});if(h.rowHeader){c=Number(c.rowSpan)>1?{...c,scope:"rowgroup"}:{...c,scope:"row"};r="th"}const d=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:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:!!h.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,...c},h.autoTooltip&&!h.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(d,null),n("span",{slot:"content"},n(s,null)))):n(d,null))};const Z=(t,e,i)=>{const o=n("div",{...t.wrapperProps,class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:t.wrap}},e);return t.header?n("th",{scope:i,...t.cellProps},o):n("td",{...t.cellProps},o)};const tt=({rowRenderer:t,rowIndex:e,rowModel:i},o,s)=>{const r=({header:t,wrap:n,cellProps:e,wrapperProps:i},o)=>Z({header:t,wrap:n,cellProps:e,wrapperProps:i},o,"row");let a={};if(!i){const t=W(e);i=t.rowModel}if(t?.rowProperties){a=t.rowProperties({rowModel:i,rowIndex:e})||a}let l;if(t?.pinned&&typeof t.pinned==="function"){l=t.pinned({rowModel:i,rowIndex:e})}const h=H({class:q("tr",l,true)},a);const c=t?.template;const d=t=>s.map(t,((t,n)=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=H({class:Q(n,true)},t.vattrs)}return t}));if(c){let t=c(n,{renderedRow:n("tr",{...h,key:i.__uuid},o),rowModel:i,rowIndex:e},r);if(Array.isArray(t)){t=s.map(t,((t,n)=>{if(t.vtag==="tr"){if(!t.vkey)t.vkey=`${i.__uuid}_${n}`;t.vattrs=H({class:q("tr",l,true)},t.vattrs);if(!!t.vchildren){t.vchildren=d(t.vchildren)}}return t}))}return t}return n("tr",{...h,key:i.__uuid},d(o))};const nt=({rowRenderer:t},e,i)=>{let o={};if(t.rowProperties){o=t.rowProperties()||{}}const s=({header:t,wrap:n,cellProps:e,wrapperProps:i},o)=>Z({header:t,wrap:n,cellProps:e,wrapperProps:i},o,"col");const r=t.pinned||null;const a={class:q("tr",r)};const l=o?H(a,o):a;const h=t?.template;if(h){let t=h(n,{renderedRow:n("tr",{...l},e)},s);if(Array.isArray(t)){t=i.map(t,(t=>{if(t.vtag==="tr"){t.vattrs=H({class:q("tr",r,true)},t.vattrs);if(!!t.vchildren){t.vchildren=i.map(t.vchildren,(t=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=H({class:q(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 it{constructor(t,n){this.cachedColMeta=new WeakMap;this._pinnedStart=[];this._pinnedEnd=[];this._cssColDimensionCacheKey="";this.cacheX=0;this.cacheY=0;this.tableEle=t;this.tableId=this.tableEle.id;this.scrollElement=n;this.startColumns=t.querySelector("thead").getElementsByClassName(`${b}__pin--start`);this.endColumns=t.querySelector("thead").getElementsByClassName(`${b}__pin--end`);this.topRows=t.getElementsByClassName(`${b}__pin--top`);this.bottomRows=t.getElementsByClassName(`${b}__pin--bottom`);this.onResize()}get pinnedStart(){return this._pinnedStart}set pinnedStart(t){this._pinnedStart=t;this.handlePinnedStartChange()}handlePinnedStartChange(){s((()=>{if(this.pinnedStart.length){this.tableEle.classList.add(`${b}__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(`${b}__pinned--start`);et(`${this.tableId}-col-start-active-style`,``)}}))}get pinnedEnd(){return this._pinnedEnd}set pinnedEnd(t){this._pinnedEnd=t;this.handlePinnedEndChange()}handlePinnedEndChange(){s((()=>{if(this.pinnedEnd.length){this.tableEle.classList.add(`${b}__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(`${b}__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()}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 i=Array.from(this.endColumns).reverse();const o=`\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 ${i.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`,o)}getParentOffsets(){const{x:t,y:n}=this.scrollElement.getBoundingClientRect();let e=t;let i=n;if(this.scrollElement===document.documentElement){e=this.scrollElement.offsetLeft;i=this.scrollElement.offsetTop}return{offsetX:e,offsetY:i}}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 i of this.topRows){const{y:o,height:r}=i.getBoundingClientRect();const a=i.parentElement;const l=getComputedStyle(i).getPropertyValue("--pin-top");const h=l!==""?parseFloat(l):t;await new Promise((l=>s((()=>{if(o-e<=h){i.classList.add(`${b}__pinned`,`${b}__pinned--top`)}else{i.classList.remove(`${b}__pinned`,`${b}__pinned--top`)}if(n!==a){a.style.setProperty("--pin-top",`${t-1}px`);t+=r-1;n=a}l()}))))}}))}if(this.bottomRows.length){const t=Array.from(this.bottomRows).reverse();r((async()=>{let n;let e=0;const{offsetY:i}=this.getParentOffsets();for(const o of t){if(!o.isConnected)continue;const{y:t,height:r}=o.getBoundingClientRect();const a=o.parentElement;const l=getComputedStyle(o).getPropertyValue("--pin-bottom");const h=l!==""?parseFloat(l):e;await new Promise((l=>s((()=>{if(this.tableDims.height+i-(t+r)<=h){o.classList.add(`${b}__pinned`,`${b}__pinned--bottom`)}else{o.classList.remove(`${b}__pinned`,`${b}__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 i=new Promise((i=>{if(this.startColumns.length){r((()=>{const{offsetX:o}=this.getParentOffsets();let s=o;e=Array.from(this.startColumns[0].parentElement.children);for(const i of this.startColumns){t=i.getBoundingClientRect();this.cachedColMeta.set(i,{width:t.width,idx:e.indexOf(i)});n=this.pinnedStart.find((t=>t===i));if(t.x<s){if(!n)this.pinnedStart=[...this.pinnedStart,i]}else if(n){this.pinnedStart=this.pinnedStart.filter((t=>t!==i))}s+=t.width}if(!this.endColumns.length)i()}))}if(this.endColumns.length){r((()=>{const o=Array.from(this.endColumns).reverse();e=Array.from(this.endColumns[0].parentElement.children);const{offsetX:s}=this.getParentOffsets();let r=0;for(const i of o){t=i.getBoundingClientRect();this.cachedColMeta.set(i,{width:t.width,idx:e.indexOf(i)});n=this.pinnedEnd.find((t=>t===i));if(this.tableDims.width+s-t.right<=r){if(!n)this.pinnedEnd=[i,...this.pinnedEnd]}else if(n){this.pinnedEnd=this.pinnedEnd.filter((t=>t!==i))}r+=t.width}i()}))}}));await i;this.generateCssCacheKey()}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 ot=':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);-webkit-clip-path:inset(50%);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;-webkit-appearance: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);-webkit-clip-path:inset(50%);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=false;function rt(t,n=false){if(!performance||!st)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 at=0;const lt=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.renderId="tbl-"+at++;this.filters=[];this.currentFilters="[]";this.currentSort="";this.measureHeight=0;this.blockHeights=[];this.unitHeight=0;this._isReady=false;this.sortStart=async(t,n,e)=>{if(this.currentSort===t+":"+n)return;this._loading=true;const i=this.nanoTblBeforeSort.emit({column:n,order:t});if(i.defaultPrevented)return;rt("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 O(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}};this.scrollHandler=()=>{let t=0;rt("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 i=this.blocks.length;while(e<i&&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++}rt("scrollHandler",true)}))};this.handleResizeChange=t=>{this.tableWrapperEle.className="";let n=[`${b}__wrap`];if(t.target?.className)n=[...t.target.className.split(" "),...n];this.tableWrapperEle.classList.add(...n.filter((t=>!!t)))};this.customRenderer=undefined;this.type="table";this.caption=undefined;this.showCaption=false;this.loading=undefined;this.internalLoading=true;this.placeholderSize=5;this.rows=undefined;this.columns=[];this.headRender={pinned:"top"};this.rowRender=undefined;this.footRender={pinned:"bottom"};this.showFooter=false;this.perBlock=50;this.searchTerm=undefined;this.customFilterFn=undefined;this.customSortFn=undefined;this.defaultSort=true;this.virtualTotalItems=0;this.blocks=[];this.activeBlocks=[0,1];this.debounceSetLoading=d(this.debounceSetLoading.bind(this),50)}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}handleRowsChange(){if(!this.rows){this._loading=true;return}this._loading=true;Promise.resolve(this.rows).then((async t=>{await F(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()}))}async handleColsChange(){await N(this.host,this.columns);if(this.isReady)this.columnInit()}get blocksLength(){return this.blocks.length}handleSearchTermChange(){this.searchStart()}virtualTotalItemsChangeHandler(){this.setBlocks()}get appliedFilters(){return this.filters}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"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()}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}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}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})}get isReady(){return this._isReady}set isReady(t){if(t===this._isReady)return;this._isReady=t;if(this.isReady)requestAnimationFrame((()=>this.handleReady()))}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()}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});rt("sort",true)}async searchStart(){this._loading=true;const t=this.nanoTblBeforeSearch.emit({term:this.searchTerm});if(t.defaultPrevented)return;rt("search");this.scrollToTop();try{await j(this.host,this.searchTerm);this.nanoTblAfterSearch.emit({term:this.searchTerm});rt("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;rt("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 D(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});rt("filter",true)}scrollToTop(t){const n=this.scrollParent.style?.scrollBehavior;const e=this.scrollParent.scrollLeft;this.scrollParent.style.scrollBehavior="auto";if(this.topAnchorEle&&!X(this.topAnchorEle,.1)){this.host.scrollIntoView()}if(t&&!X(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(`${b}__inactive`)));t()}))}))}setInitialBlockDimension(){if(!this.blockElements?.length)return;rt("blockDims");const t=async()=>{await this.setMeasureElement();if(this.unitHeight)return true;return false};const n=new Promise((async n=>{if(await t())n();else{const e=new IntersectionObserver((async()=>{if(await t()){n();e.disconnect()}}),{root:this.scrollParent});e.observe(this.tableEle)}}));n.then((()=>{rt("blockDims",true);rt("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}rt("setBlocks");let n=1;const e=this.virtualTotalItems>t.length?this.virtualTotalItems:t.length;let i=[];const o=[];for(n;n<=e;n++){i.push(this.store.data.state.rows[n-1]||{__uuid:""});if(n%this.perBlock===0){o.push({rows:i,__uuid:c(i.map((t=>t.__uuid)).join())});i=[]}}if(i.length){o.push({rows:i,__uuid:c(i.map((t=>t.__uuid)).join())})}this.blocks=o;rt("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(`${b}__inactive`))return;const e=n.getBoundingClientRect().height;const i=this.blockHeights.findIndex((n=>n.blockIndex===t));if(i>-1){this.blockHeights[i]={height:e,blockIndex:t}}else this.blockHeights.push({height:e,blockIndex:t})}))}))}processSlots(){if(!this.caption&&!this.host.querySelector('[slot="caption"]')){console.error("For accessibility you must set a `caption` prop or use the `caption` slot")}}setupActiveWatcher(){if(!this.host||!this.scrollParent||!this.store)return;if(this.activeWatcherIo){this.activeWatcherIo.disconnect();this.activeWatcherIo=undefined}const t=this.activeWatcherIo=new IntersectionObserver((async([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(){rt("init");this.store=await A(this.host,this.columns,this.scrollParent,this.isReady);await this.handleRowsChange();this.store.general.onChange("isActive",(()=>{this.scrollHandler()}));this.store.data.onChange("rows",(()=>this.setBlocks()));this.processSlots();this.setBlocks();this.scrollParent=p(this.host);this.setupActiveWatcher()}connectedCallback(){this.scrollParent=p(this.host);this.setupActiveWatcher()}componentDidLoad(){this.setInitialBlockDimension();if(!this.tablePinnedService){this.tablePinnedService=new it(this.tableEle,this.scrollParent)}}componentShouldUpdate(t,n,e){if(["rows","columns"].includes(e))return false}componentWillRender(){rt("render")}componentDidRender(){this.setMeasureElement().then((()=>this.setBlockHeight()));rt("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(h,null,n("div",{class:`${b}__top-anchor`,ref:t=>this.topAnchorEle=t}," "),n("nano-resize-observe",{states:"576w sm, 768w md",class:"sm md",onNanoResizeStateChange:this.handleResizeChange,onNanoResize:()=>{if(this.tablePinnedService)this.tablePinnedService.onResize()}}),n("div",{class:`${b}__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",{indeterminate:true,class:{[`${b}__progress-bar`]:true,[`${b}__progress-bar--show`]:this._loading}}),n("table",{role:this.type==="grid"?"grid":undefined,"aria-rowcount":this.store.data.state.rows.length,"aria-colcount":this.store.config.state.columns.length,class:`${b}`,ref:t=>this.tableEle=t,id:"nano-table-"+this.renderId},n("caption",{class:{[`${b}__caption`]:true,[`${b}__caption--hide`]:!this.showCaption},id:"nano-table-caption-"+this.renderId},n("slot",{name:"caption"},this.caption)),n("thead",null,n(nt,{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",{class:`${b}__active ${b}__loading`},[...Array(10).keys()].map((t=>n("tr",null,this.store.config.state.columns.map(((e,i)=>n(V,{rowIndex:t,colIndex:i,nestedContent:()=>n("nano-skeleton",null)}))))))),n("tr",{hidden:!!this._loading||!!this.blocks.length},n("th",{class:`${b}__th`,colSpan:this.store.config.state.columns.length},n("div",{class:"nano-tbl__cell-content nano-tbl__cell-content--no-result"},n("slot",{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:{[`${b}__inactive`]:!this.activeBlocks.includes(e),[`${b}__active`]:this.activeBlocks.includes(e)}},this.activeBlocks.includes(e)?t.rows.map(((t,i)=>{const o=e>0?e*this.perBlock+i:i;return n(tt,{rowRenderer:this.rowRender,rowModel:t,rowIndex:o},this.store.config.state.columns.map(((t,e)=>n(V,{rowIndex:o,colIndex:e}))))})):n("tr",{class:`${b}__tr--placeholder`},n("td",{colSpan:this.store.config.state.columns.length,style:{height:this.getBlockHeight(e)+"px"}}))))),this.showFooter&&n("tfoot",null,n(nt,{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",{type:"circle",class:{[`${b}__spinner`]:true,[`${b}__spinner--show`]:this._loading}})))}get host(){return i(this)}static get watchers(){return{rows:["handleRowsChange"],columns:["handleColsChange"],searchTerm:["handleSearchTermChange"],virtualTotalItems:["virtualTotalItemsChangeHandler"]}}};lt.style=ot;export{lt as T,v as c};
|
5
|
-
//# sourceMappingURL=nano-table-
|
4
|
+
import{j as t,h as n,F as e,g as i,e as o,w as s,d as r,r as a,c as l,a as h}from"./index-9695db0a.js";import{a as c}from"./math-c02ddfda.js";import{d}from"./throttle-ac4fcefa.js";import{f as p}from"./scroll-parent-bab1cbf7.js";import{c as f}from"./index-3003356f.js";const b="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 w=new Map;const y=new Map;const v=(n,e,i)=>{const o=new Worker(n,{name:e});o.addEventListener("message",(({data:n})=>{if(n){const e=n[0];const o=n[1];const s=n[2];if(e===i){const e=n[3];const[i,r,a]=w.get(o);w.delete(o);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=>y.delete(t)))}i(s)}}else if(e===i+".cb"){try{y.get(o)(...s)}catch(n){t(n)}}}}));return o};const x=(t,n,e)=>(...i)=>new Promise(((o,s)=>{let r=m++;let a=0;let l=i.length;let h=[o,s];w.set(r,h);for(;a<l;a++){if(typeof i[a]==="function"){const t=g++;y.set(t,i[a]);i[a]=[n+".cb",t];(h[2]=h[2]||[]).push(t)}}const c=t=>t.postMessage([n,r,e,i],u(i));if(t.then){t.then(c)}else{c(t)}}));const k=import("./table.worker-55afec8e.js").then((t=>t.worker));const $=x(k,"stencil.table.worker","createWorkerStore");const z=x(k,"stencil.table.worker","syncConfigToWorker");const C=x(k,"stencil.table.worker","syncDataToWorker");const S=x(k,"stencil.table.worker","workerFilter");const I=x(k,"stencil.table.worker","workerSearch");const R=x(k,"stencil.table.worker","workerSort");function P(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 T=new WeakMap;async function A(t,n,e,i){const o={data:f({rows:[]}),config:f({columns:n}),general:f({workerId:null,scrollParent:e,host:t,isReady:i})};const s=await $(o.data.state.rows,P(o.config.state.columns));o.general.state.workerId=s;T.set(t,o);o.data.use({reset:()=>{if(o.general.state.workerId)C(o.general.state.workerId,null)},dispose:()=>{if(o.general.state.workerId)C(o.general.state.workerId,null)}});o.config.use({reset:()=>{if(o.general.state.workerId)z(o.general.state.workerId,null)},dispose:()=>{if(o.general.state.workerId)z(o.general.state.workerId,null)}});return o}function M(t){return T.get(t)}function B(t){if(t instanceof Date){return"date"}if(["number","string","boolean"].includes(typeof t)){return typeof t}return"unknown"}function F(t,n){const e=T.get(t);if(!e)return;const i=e.config.state.columns;const o=i.filter((t=>t.type==="date")).reduce(((t,n)=>[...t,n.prop]),[]);const s=i.filter((t=>!t.type));n=n.map(((t,n)=>{if(s.length&&n===0){e.config.state.columns=i.map((n=>{if(s.includes(n)&&t[n.prop]&&!n.type){n.type=B(t[n.prop]);if(n.type==="date")o.push(n.prop)}return n}))}o.forEach((n=>{const e=new Date(t[n])??null;if(!!e&&Number(e))t[n]=Number(e)}));t["__index"]=n;t["__uuid"]=c(i.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 N(t,n){const e=T.get(t);if(!e)return;e.config.state.columns=n;if(e.general.state.workerId)return z(e.general.state.workerId,P(n))}async function j(t,n){const e=T.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await I(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function D(t,n){const e=T.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 O(t,n,e){const i=T.get(t);if(!i||!i.general.state.workerId)return;try{i.data.state.rows=await R(i.general.state.workerId,n,e)}catch(t){console.warn(t)}}function E(t,n){const e=L();const i=e.config.state.columns;const o=e.data.state.rows;const s=i[n];const r=s?.prop;const a=o[t];const l=a?a[i[n].prop]:"";return{prop:r,cellModel:l,column:s,rowIndex:t,rowModel:a}}function W(t){const n=L();const e=n.data.state.rows;const i=e[t];return{rowModel:i,rowIndex:t}}function H(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"){e.class+=" "+n.class}}if(n.style){e.style={...n.style,...e.style}}return e}function L(){return M(i(o()))}function J(t,n,e){const i={...e};const o=L().config.state.columns[n]?.cellProperties;if(!o)return i;const s=E(t,n);const r=o(s);if(!r)return i;return H(i,r)}function Y(t){const i=t?.columnTemplate;return i?i(n,t):n(e,null,t.title)}function q(t,n,e=false){const i={[`${b}__${t}`]:true,[`${b}__pin`]:!!n,[`${b}__pin--top`]:n==="top",[`${b}__pin--bottom`]:n==="bottom"};if(e)return K(i);return i}function K(t){let n="";Object.entries(t).forEach((([t,e])=>{if(e)n+=t+" "}));return n}function X(t,n=100){const e=t.getBoundingClientRect();const i=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-i)/e.height*100)<n)}const U=({column:t,onColumnSortClick:i,defaults:o})=>{function s(n){let e;switch(t.order){case"asc":e="desc";break;case"desc":e=null;break;default:e="asc"}i(e,t.prop,n.target.closest("th"))}function r(){return!!o.sortable&&t.sortable!==false||!o.sortable&&t.sortable===true}let a={};if(t.columnProperties){a=t.columnProperties(t)||a}const l={class:{...q("th",t.pinned),[`${b}__pin--start`]:t.pinned==="start",[`${b}__pin--end`]:t.pinned==="end",[`${b}__ordered`]:!!t.order,[`${b}__filtered`]:t.filter!==undefined&&t.filter!==null}};let h=a?H(l,a):l;const c=Y(t);if(!c)return n(e,null);h=Number(h.colSpan)>1?{...h,scope:"colgroup"}:{...h,scope:"col"};if(r()){const n=t.order?t.order==="asc"?"ascending":"descending":"none";h={...h,"aria-sort":n}}return n("th",{...h,key:t.prop},r()?n("button",{class:{[`${b}__order-btn`]:true,[`${b}__cell-content`]:true},onClick:s},Y(t),t.filter!==undefined&&t.filter!==null&&n("nano-icon",{name:"light/filter"}),!!t.order&&(t.order==="desc"?n("nano-icon",{name:"solid/long-arrow-down"}):n("nano-icon",{name:"solid/long-arrow-up"})),n("div",{class:`${b}__status-icons`},n("nano-icon",{name:"light/chevron-down"}))):n("div",{class:`${b}__cell-content`},Y(t),t.filter!==undefined&&t.filter!==null&&n("nano-icon",{name:"light/bars-filter"})))};function G(t,i){const s=L();const r=s.config.state.columns;const a=r[i]?.cellTemplate;const l=E(t,i);const h=o();if(!!l.cellModel&&r[i].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 c=false;const d=(...t)=>{c=true;return n(...t)};let p=a?a(d,l):undefined;if(p&&h.customRenderer&&p["t"]===undefined&&!(p instanceof Element)&&typeof p!=="string"&&!c){const t=document.createElement("template");const n=h.customRenderer(p,t.content);p=n&&n["then"]?n:t}return p?p:l.cellModel!==undefined&&l.cellModel!==null?n(e,null,l.cellModel?.toString()):""}const Q=(t,n=false)=>{const e=L();const i=e.config.state.columns[t];const o={[`${b}__td`]:true,[`${b}__ordered`]:!!i.order,[`${b}__pin`]:!!i.pinned,[`${b}__pin--start`]:i.pinned==="start",[`${b}__pin--end`]:i.pinned==="end"};if(n)return K(o);return o};const V=({rowIndex:t,colIndex:e,nestedContent:i})=>{const s=()=>i?i():G(t,e)||n("span",{class:"placeholder"}," ");let r="td";const a=o();const l=L();const h=l.config.state.columns[e];let c=J(t,e,{class:Q(e)});if(h.rowHeader){c=Number(c.rowSpan)>1?{...c,scope:"rowgroup"}:{...c,scope:"row"};r="th"}const d=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:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:!!h.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,...c},h.autoTooltip&&!h.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(d,null),n("span",{slot:"content"},n(s,null)))):n(d,null))};const Z=(t,e,i)=>{const o=n("div",{...t.wrapperProps,class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:t.wrap}},e);return t.header?n("th",{scope:i,...t.cellProps},o):n("td",{...t.cellProps},o)};const tt=({rowRenderer:t,rowIndex:e,rowModel:i},o,s)=>{const r=({header:t,wrap:n,cellProps:e,wrapperProps:i},o)=>Z({header:t,wrap:n,cellProps:e,wrapperProps:i},o,"row");let a={};if(!i){const t=W(e);i=t.rowModel}if(t?.rowProperties){a=t.rowProperties({rowModel:i,rowIndex:e})||a}let l;if(t?.pinned&&typeof t.pinned==="function"){l=t.pinned({rowModel:i,rowIndex:e})}const h=H({class:q("tr",l,true)},a);const c=t?.template;const d=t=>s.map(t,((t,n)=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=H({class:Q(n,true)},t.vattrs)}return t}));if(c){let t=c(n,{renderedRow:n("tr",{...h,key:i.__uuid},o),rowModel:i,rowIndex:e},r);if(Array.isArray(t)){t=s.map(t,((t,n)=>{if(t.vtag==="tr"){if(!t.vkey)t.vkey=`${i.__uuid}_${n}`;t.vattrs=H({class:q("tr",l,true)},t.vattrs);if(!!t.vchildren){t.vchildren=d(t.vchildren)}}return t}))}return t}return n("tr",{...h,key:i.__uuid},d(o))};const nt=({rowRenderer:t},e,i)=>{let o={};if(t.rowProperties){o=t.rowProperties()||{}}const s=({header:t,wrap:n,cellProps:e,wrapperProps:i},o)=>Z({header:t,wrap:n,cellProps:e,wrapperProps:i},o,"col");const r=t.pinned||null;const a={class:q("tr",r)};const l=o?H(a,o):a;const h=t?.template;if(h){let t=h(n,{renderedRow:n("tr",{...l},e)},s);if(Array.isArray(t)){t=i.map(t,(t=>{if(t.vtag==="tr"){t.vattrs=H({class:q("tr",r,true)},t.vattrs);if(!!t.vchildren){t.vchildren=i.map(t.vchildren,(t=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=H({class:q(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 it{constructor(t,n){this.cachedColMeta=new WeakMap;this._pinnedStart=[];this._pinnedEnd=[];this._cssColDimensionCacheKey="";this.cacheX=0;this.cacheY=0;this.tableEle=t;this.tableId=this.tableEle.id;this.scrollElement=n;this.startColumns=t.querySelector("thead").getElementsByClassName(`${b}__pin--start`);this.endColumns=t.querySelector("thead").getElementsByClassName(`${b}__pin--end`);this.topRows=t.getElementsByClassName(`${b}__pin--top`);this.bottomRows=t.getElementsByClassName(`${b}__pin--bottom`);this.onResize()}get pinnedStart(){return this._pinnedStart}set pinnedStart(t){this._pinnedStart=t;this.handlePinnedStartChange()}handlePinnedStartChange(){s((()=>{if(this.pinnedStart.length){this.tableEle.classList.add(`${b}__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(`${b}__pinned--start`);et(`${this.tableId}-col-start-active-style`,``)}}))}get pinnedEnd(){return this._pinnedEnd}set pinnedEnd(t){this._pinnedEnd=t;this.handlePinnedEndChange()}handlePinnedEndChange(){s((()=>{if(this.pinnedEnd.length){this.tableEle.classList.add(`${b}__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(`${b}__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()}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 i=Array.from(this.endColumns).reverse();const o=`\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 ${i.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`,o)}getParentOffsets(){const{x:t,y:n}=this.scrollElement.getBoundingClientRect();let e=t;let i=n;if(this.scrollElement===document.documentElement){e=this.scrollElement.offsetLeft;i=this.scrollElement.offsetTop}return{offsetX:e,offsetY:i}}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 i of this.topRows){const{y:o,height:r}=i.getBoundingClientRect();const a=i.parentElement;const l=getComputedStyle(i).getPropertyValue("--pin-top");const h=l!==""?parseFloat(l):t;await new Promise((l=>s((()=>{if(o-e<=h){i.classList.add(`${b}__pinned`,`${b}__pinned--top`)}else{i.classList.remove(`${b}__pinned`,`${b}__pinned--top`)}if(n!==a){a.style.setProperty("--pin-top",`${t-1}px`);t+=r-1;n=a}l()}))))}}))}if(this.bottomRows.length){const t=Array.from(this.bottomRows).reverse();r((async()=>{let n;let e=0;const{offsetY:i}=this.getParentOffsets();for(const o of t){if(!o.isConnected)continue;const{y:t,height:r}=o.getBoundingClientRect();const a=o.parentElement;const l=getComputedStyle(o).getPropertyValue("--pin-bottom");const h=l!==""?parseFloat(l):e;await new Promise((l=>s((()=>{if(this.tableDims.height+i-(t+r)<=h){o.classList.add(`${b}__pinned`,`${b}__pinned--bottom`)}else{o.classList.remove(`${b}__pinned`,`${b}__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 i=new Promise((i=>{if(this.startColumns.length){r((()=>{const{offsetX:o}=this.getParentOffsets();let s=o;e=Array.from(this.startColumns[0].parentElement.children);for(const i of this.startColumns){t=i.getBoundingClientRect();this.cachedColMeta.set(i,{width:t.width,idx:e.indexOf(i)});n=this.pinnedStart.find((t=>t===i));if(t.x<s){if(!n)this.pinnedStart=[...this.pinnedStart,i]}else if(n){this.pinnedStart=this.pinnedStart.filter((t=>t!==i))}s+=t.width}if(!this.endColumns.length)i()}))}if(this.endColumns.length){r((()=>{const o=Array.from(this.endColumns).reverse();e=Array.from(this.endColumns[0].parentElement.children);const{offsetX:s}=this.getParentOffsets();let r=0;for(const i of o){t=i.getBoundingClientRect();this.cachedColMeta.set(i,{width:t.width,idx:e.indexOf(i)});n=this.pinnedEnd.find((t=>t===i));if(this.tableDims.width+s-t.right<=r){if(!n)this.pinnedEnd=[i,...this.pinnedEnd]}else if(n){this.pinnedEnd=this.pinnedEnd.filter((t=>t!==i))}r+=t.width}i()}))}}));await i;this.generateCssCacheKey()}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 ot=':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);-webkit-clip-path:inset(50%);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;-webkit-appearance: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);-webkit-clip-path:inset(50%);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=false;function rt(t,n=false){if(!performance||!st)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 at=0;const lt=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.renderId="tbl-"+at++;this.filters=[];this.currentFilters="[]";this.currentSort="";this.measureHeight=0;this.blockHeights=[];this.unitHeight=0;this._isReady=false;this.sortStart=async(t,n,e)=>{if(this.currentSort===t+":"+n)return;this._loading=true;const i=this.nanoTblBeforeSort.emit({column:n,order:t});if(i.defaultPrevented)return;rt("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 O(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}};this.scrollHandler=()=>{let t=0;rt("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 i=this.blocks.length;while(e<i&&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++}rt("scrollHandler",true)}))};this.handleResizeChange=t=>{this.tableWrapperEle.className="";let n=[`${b}__wrap`];if(t.target?.className)n=[...t.target.className.split(" "),...n];this.tableWrapperEle.classList.add(...n.filter((t=>!!t)))};this.customRenderer=undefined;this.type="table";this.caption=undefined;this.showCaption=false;this.loading=undefined;this.internalLoading=true;this.placeholderSize=5;this.rows=undefined;this.columns=[];this.headRender={pinned:"top"};this.rowRender=undefined;this.footRender={pinned:"bottom"};this.showFooter=false;this.perBlock=50;this.searchTerm=undefined;this.customFilterFn=undefined;this.customSortFn=undefined;this.defaultSort=true;this.virtualTotalItems=0;this.blocks=[];this.activeBlocks=[0,1];this.debounceSetLoading=d(this.debounceSetLoading.bind(this),50)}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}handleRowsChange(){if(!this.rows){this._loading=true;return}this._loading=true;Promise.resolve(this.rows).then((async t=>{await F(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()}))}async handleColsChange(){await N(this.host,this.columns);if(this.isReady)this.columnInit()}get blocksLength(){return this.blocks.length}handleSearchTermChange(){this.searchStart()}virtualTotalItemsChangeHandler(){this.setBlocks()}get appliedFilters(){return this.filters}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"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()}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}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}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})}get isReady(){return this._isReady}set isReady(t){if(t===this._isReady)return;this._isReady=t;if(this.isReady)requestAnimationFrame((()=>this.handleReady()))}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()}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});rt("sort",true)}async searchStart(){this._loading=true;const t=this.nanoTblBeforeSearch.emit({term:this.searchTerm});if(t.defaultPrevented)return;rt("search");this.scrollToTop();try{await j(this.host,this.searchTerm);this.nanoTblAfterSearch.emit({term:this.searchTerm});rt("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;rt("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 D(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});rt("filter",true)}scrollToTop(t){const n=this.scrollParent.style?.scrollBehavior;const e=this.scrollParent.scrollLeft;this.scrollParent.style.scrollBehavior="auto";if(this.topAnchorEle&&!X(this.topAnchorEle,.1)){this.host.scrollIntoView()}if(t&&!X(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(`${b}__inactive`)));t()}))}))}setInitialBlockDimension(){if(!this.blockElements?.length)return;rt("blockDims");const t=async()=>{await this.setMeasureElement();if(this.unitHeight)return true;return false};const n=new Promise((async n=>{if(await t())n();else{const e=new IntersectionObserver((async()=>{if(await t()){n();e.disconnect()}}),{root:this.scrollParent});e.observe(this.tableEle)}}));n.then((()=>{rt("blockDims",true);rt("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}rt("setBlocks");let n=1;const e=this.virtualTotalItems>t.length?this.virtualTotalItems:t.length;let i=[];const o=[];for(n;n<=e;n++){i.push(this.store.data.state.rows[n-1]||{__uuid:""});if(n%this.perBlock===0){o.push({rows:i,__uuid:c(i.map((t=>t.__uuid)).join())});i=[]}}if(i.length){o.push({rows:i,__uuid:c(i.map((t=>t.__uuid)).join())})}this.blocks=o;rt("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(`${b}__inactive`))return;const e=n.getBoundingClientRect().height;const i=this.blockHeights.findIndex((n=>n.blockIndex===t));if(i>-1){this.blockHeights[i]={height:e,blockIndex:t}}else this.blockHeights.push({height:e,blockIndex:t})}))}))}processSlots(){if(!this.caption&&!this.host.querySelector('[slot="caption"]')){console.error("For accessibility you must set a `caption` prop or use the `caption` slot")}}setupActiveWatcher(){if(!this.host||!this.scrollParent||!this.store)return;if(this.activeWatcherIo){this.activeWatcherIo.disconnect();this.activeWatcherIo=undefined}const t=this.activeWatcherIo=new IntersectionObserver((async([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(){rt("init");this.store=await A(this.host,this.columns,this.scrollParent,this.isReady);await this.handleRowsChange();this.store.general.onChange("isActive",(()=>{this.scrollHandler()}));this.store.data.onChange("rows",(()=>this.setBlocks()));this.processSlots();this.setBlocks();this.scrollParent=p(this.host);this.setupActiveWatcher()}connectedCallback(){this.scrollParent=p(this.host);this.setupActiveWatcher()}componentDidLoad(){this.setInitialBlockDimension();if(!this.tablePinnedService){this.tablePinnedService=new it(this.tableEle,this.scrollParent)}}componentShouldUpdate(t,n,e){if(["rows","columns"].includes(e))return false}componentWillRender(){rt("render")}componentDidRender(){this.setMeasureElement().then((()=>this.setBlockHeight()));rt("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(h,null,n("div",{class:`${b}__top-anchor`,ref:t=>this.topAnchorEle=t}," "),n("nano-resize-observe",{states:"576w sm, 768w md",class:"sm md",onNanoResizeStateChange:this.handleResizeChange,onNanoResize:()=>{if(this.tablePinnedService)this.tablePinnedService.onResize()}}),n("div",{class:`${b}__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",{indeterminate:true,class:{[`${b}__progress-bar`]:true,[`${b}__progress-bar--show`]:this._loading}}),n("table",{role:this.type==="grid"?"grid":undefined,"aria-rowcount":this.store.data.state.rows.length,"aria-colcount":this.store.config.state.columns.length,class:`${b}`,ref:t=>this.tableEle=t,id:"nano-table-"+this.renderId},n("caption",{class:{[`${b}__caption`]:true,[`${b}__caption--hide`]:!this.showCaption},id:"nano-table-caption-"+this.renderId},n("slot",{name:"caption"},this.caption)),n("thead",null,n(nt,{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",{class:`${b}__active ${b}__loading`},[...Array(10).keys()].map((t=>n("tr",null,this.store.config.state.columns.map(((e,i)=>n(V,{rowIndex:t,colIndex:i,nestedContent:()=>n("nano-skeleton",null)}))))))),n("tr",{hidden:!!this._loading||!!this.blocks.length},n("th",{class:`${b}__th`,colSpan:this.store.config.state.columns.length},n("div",{class:"nano-tbl__cell-content nano-tbl__cell-content--no-result"},n("slot",{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:{[`${b}__inactive`]:!this.activeBlocks.includes(e),[`${b}__active`]:this.activeBlocks.includes(e)}},this.activeBlocks.includes(e)?t.rows.map(((t,i)=>{const o=e>0?e*this.perBlock+i:i;return n(tt,{rowRenderer:this.rowRender,rowModel:t,rowIndex:o},this.store.config.state.columns.map(((t,e)=>n(V,{rowIndex:o,colIndex:e}))))})):n("tr",{class:`${b}__tr--placeholder`},n("td",{colSpan:this.store.config.state.columns.length,style:{height:this.getBlockHeight(e)+"px"}}))))),this.showFooter&&n("tfoot",null,n(nt,{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",{type:"circle",class:{[`${b}__spinner`]:true,[`${b}__spinner--show`]:this._loading}})))}get host(){return i(this)}static get watchers(){return{rows:["handleRowsChange"],columns:["handleColsChange"],searchTerm:["handleSearchTermChange"],virtualTotalItems:["virtualTotalItemsChangeHandler"]}}};lt.style=ot;export{lt as T,v as c};
|
5
|
+
//# sourceMappingURL=nano-table-fc25f277.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-fc25f277.js";import"./index-9695db0a.js";import"./math-c02ddfda.js";import"./throttle-ac4fcefa.js";import"./scroll-parent-bab1cbf7.js";import"./index-3003356f.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-fc25f277.js";import"./index-9695db0a.js";import"./math-c02ddfda.js";import"./throttle-ac4fcefa.js";import"./scroll-parent-bab1cbf7.js";import"./index-3003356f.js";const o="table.worker";const r="stencil.table.worker";const e=new URL("table.worker-4aad752d.js",import.meta.url).href;const s=new Blob(['importScripts("'+e+'")'],{type:"text/javascript"});const a=URL.createObjectURL(s);const c=t(a,o,r);URL.revokeObjectURL(a);export{c as worker,r as workerMsgId,o as workerName,e as workerPath};
|
5
|
+
//# sourceMappingURL=table.worker-55afec8e.js.map
|
package/docs-json.json
CHANGED
package/hydrate/index.js
CHANGED
@@ -7937,9 +7937,11 @@ const STORAGE_NAME_SPACE = 'nano-component-store:';
|
|
7937
7937
|
const urlRead = (from = 'hash', win = window) => {
|
7938
7938
|
if (!win || !win.location)
|
7939
7939
|
return {};
|
7940
|
-
if (from === 'hash' && win.location.hash)
|
7940
|
+
if (from === 'hash' && win.location.hash && win.location.hash.match(/&|=/))
|
7941
7941
|
return parse$1(win.location.hash.replace(/^\#/, ''));
|
7942
|
-
else if (from === 'query' &&
|
7942
|
+
else if (from === 'query' &&
|
7943
|
+
win.location.search &&
|
7944
|
+
win.location.search.match(/&|=/))
|
7943
7945
|
return parse$1(win.location.search.replace(/^\?/, ''));
|
7944
7946
|
return {};
|
7945
7947
|
};
|
@@ -7979,8 +7981,19 @@ const urlSet = (id, data, to = 'hash', win = window, method = 'replace') => {
|
|
7979
7981
|
// sanitize the incoming key
|
7980
7982
|
id = Object.keys(parse$1(id))[0];
|
7981
7983
|
const object = {};
|
7984
|
+
// delete all empty incoming values
|
7985
|
+
for (const key in data) {
|
7986
|
+
if (!data[key] || (Array.isArray(data[key]) && !data[key].length)) {
|
7987
|
+
delete data[key];
|
7988
|
+
}
|
7989
|
+
}
|
7982
7990
|
object[id] = data;
|
7983
7991
|
let currentData = urlRead(to, win);
|
7992
|
+
// current data is empty and incoming data is empty
|
7993
|
+
// let's not do anything
|
7994
|
+
if (!currentData[id] && !object[id])
|
7995
|
+
return;
|
7996
|
+
// let's merge current and incoming data and write it to the url
|
7984
7997
|
currentData = { ...currentData, ...object };
|
7985
7998
|
urlSave(currentData, to, win, method);
|
7986
7999
|
};
|
@@ -18499,7 +18512,7 @@ class GlobalSearchResults {
|
|
18499
18512
|
if (goBackEvent.defaultPrevented)
|
18500
18513
|
return;
|
18501
18514
|
this.removeAllFilters();
|
18502
|
-
this.algoliaEle.query =
|
18515
|
+
this.algoliaEle.query = undefined;
|
18503
18516
|
this.algoliaEle.showResults = false;
|
18504
18517
|
};
|
18505
18518
|
this.algoliaResults = undefined;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nanoporetech-digital/components",
|
3
|
-
"version": "6.8.
|
3
|
+
"version": "6.8.5",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "https://git.oxfordnanolabs.local/Digital/nano-components"
|
@@ -127,7 +127,7 @@
|
|
127
127
|
"nanopore",
|
128
128
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AM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;MAC9D,KAAK,gBAAgB;QACnB,OAAOA,MAAa,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;MAC/D,KAAK,OAAO;QACV,OAAOC,UAAiB,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;MAC1C;QACE,OAAOC,UAAiB,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;KAC3C;GACF;;;;;","names":["getElement","debounce","getset.urlGet","getset.storageGet","getset.sessionGet","getset.urlSet","getset.storageSet","getset.sessionSet"],"sources":["./node_modules/tyqs/dist/parse.js","./node_modules/tyqs/dist/stringify.js","./src/utils/store/get-set.ts","./src/utils/store/component-store.ts"],"sourcesContent":["export function parse(searchParams, replacer) {\n const params = new URLSearchParams([...new URLSearchParams(searchParams)].map(([k, v]) => [\n k.replace(/([[\\]])/g, (_, s) => s === '[' ? '.' : ''),\n v,\n ]));\n const t = {};\n new Set(params.keys()).forEach((paramKey) => {\n const rawValue = params\n .getAll(paramKey)\n .join(',')\n .split(',')\n .map(n => decodeURIComponent(n.replace(/\\+/g, ' ')));\n const value = rawValue.length === 1 ? rawValue[0] : rawValue;\n let key = paramKey;\n let v = replacer ?\n replacer({\n firstRawValue: params.get(paramKey).split(','),\n key,\n rawValue,\n value,\n }) :\n value;\n if (key.includes('.')) {\n const [f, ...kl] = key.split('.');\n const o = (t[f] || {});\n const l = kl.pop();\n (kl.reduce((p, n) => (p[n] ??= {}), o))[l] = v;\n key = f;\n v = o;\n }\n t[key] = v;\n });\n return t;\n}\n//# sourceMappingURL=parse.js.map","export function stringify(input, replacer) {\n if (!input)\n return '';\n const stack = [['', input]];\n const sp = new URLSearchParams();\n while (stack.length) {\n const [itemKey, itemValue] = stack.pop();\n Object.entries(itemValue).forEach(([key, rawValue]) => {\n if (rawValue == null && replacer == null)\n return;\n const typeOfValue = typeof (rawValue);\n const flattenedKey = itemKey ? `${itemKey}.${key}` : key;\n if (rawValue !== null && typeOfValue === 'object' && !Array.isArray(rawValue)) {\n stack.push([flattenedKey, rawValue]);\n }\n else {\n let value = typeOfValue === 'string' ? rawValue : '';\n if (Array.isArray(rawValue))\n value = rawValue.join(',');\n else if (rawValue?.toJSON)\n value = rawValue.toJSON();\n else if (rawValue?.toString)\n value = rawValue.toString();\n else\n value = String(rawValue);\n const vv = replacer ?\n replacer({ flattenedKey, key, rawValue, value }) :\n value;\n vv != null && sp.append(flattenedKey, vv);\n }\n });\n }\n sp.sort();\n return sp.toString();\n}\n//# sourceMappingURL=stringify.js.map","import { parse, stringify } from 'tyqs';\n\nconst STORAGE_NAME_SPACE = 'nano-component-store:';\n\nconst urlRead = (\n from: 'hash' | 'query' = 'hash',\n win: Window = window\n): void | object => {\n if (!win || !win.location) return {};\n if (from === 'hash' && win.location.hash)\n return parse(win.location.hash.replace(/^\\#/, ''));\n else if (from === 'query' && win.location.search)\n return parse(win.location.search.replace(/^\\?/, ''));\n return {};\n};\n\nconst urlSave = (\n object: object,\n to: 'hash' | 'query' = 'hash',\n win: Window = window,\n method: 'replace' | 'push' = 'replace'\n) => {\n if (!win || !win.history) return;\n const oldQuery = to === 'query' ? win.location.search : win.location.hash;\n const basePath =\n to === 'query'\n ? win.location.pathname\n : win.location.pathname + win.location.search;\n let queryStr = stringify(object);\n\n if (!queryStr || !queryStr.length) {\n if (!oldQuery || !oldQuery.length) return;\n if (method === 'replace') win.history.replaceState(null, null, basePath);\n else win.history.pushState(null, null, basePath);\n return;\n }\n\n if (to === 'hash' && win.location.hash === '#' + queryStr) {\n try {\n (document.querySelector('#' + queryStr) as HTMLElement).focus();\n } catch (e) {}\n return;\n }\n queryStr = (to === 'hash' ? '#' : '?') + queryStr;\n if (queryStr === oldQuery) return;\n if (method === 'replace')\n win.history.replaceState(null, null, basePath + queryStr);\n else win.history.pushState(null, null, basePath + queryStr);\n};\n\nexport const urlSet = (\n id: string,\n data: object,\n to: 'hash' | 'query' = 'hash',\n win: Window = window,\n method: 'replace' | 'push' = 'replace'\n) => {\n // sanitize the incoming key\n id = Object.keys(parse(id))[0];\n const object = {};\n object[id] = data;\n\n let currentData = urlRead(to, win);\n currentData = { ...currentData, ...object };\n urlSave(currentData, to, win, method);\n};\n\nexport const urlGet = (\n key: string,\n to: 'hash' | 'query' = 'hash',\n win: Window = window\n) => {\n // sanitize the incoming key\n key = Object.keys(parse(key))[0];\n const currentData = urlRead(to, win);\n return currentData[key] || null;\n};\n\nexport const sessionSet = (\n key: string,\n object: object,\n win: Window = window\n) => {\n try {\n if (!object) {\n win.sessionStorage.removeItem(STORAGE_NAME_SPACE + key);\n return;\n }\n win.sessionStorage.setItem(\n STORAGE_NAME_SPACE + key,\n JSON.stringify(object)\n );\n } catch (e) {\n throw e;\n }\n};\n\nexport const sessionGet = (key: string, win: Window = window) => {\n try {\n const configStr = win.sessionStorage.getItem(STORAGE_NAME_SPACE + key);\n return configStr !== null ? JSON.parse(configStr) : null;\n } catch (e) {\n throw e;\n }\n};\n\nexport const storageSet = (\n key: string,\n object: object,\n win: Window = window\n) => {\n try {\n if (!object) {\n win.localStorage.removeItem(STORAGE_NAME_SPACE + key);\n return;\n }\n win.localStorage.setItem(STORAGE_NAME_SPACE + key, JSON.stringify(object));\n } catch (e) {\n throw e;\n }\n};\n\nexport const storageGet = (key: string, win: Window = window) => {\n try {\n const configStr = win.localStorage.getItem(STORAGE_NAME_SPACE + key);\n return configStr !== null ? JSON.parse(configStr) : null;\n } catch (e) {\n throw e;\n }\n};\n","import { getElement } from '@stencil/core';\nimport { debounce } from '../throttle';\nimport * as getset from './get-set';\n\nexport type StorageParams = Record<string, any>;\n\nexport type StorageMethods =\n | 'url-hash'\n | 'url-query'\n | 'url-hash-push'\n | 'url-query-push'\n | 'local'\n | 'session';\n\ninterface Component {\n connectedCallback?(): void;\n disconnectedCallback?(): void;\n componentDidRender?(): void;\n [key: string]: any;\n}\n\nconst store = new Map<string, Store>();\n\nexport const ComponentStore = {\n init(\n component: Component,\n keys: string[],\n method?: StorageMethods,\n id?: string\n ) {\n const getId = id || component.storeId || getElement(component).id;\n if (!getId) {\n console.error(\n 'No id set. You can only instantiate a new component store with an id. '\n );\n return;\n }\n if (store.get(getId)) {\n console.error(\n 'Duplicate store id usage. A store ID must be unique!',\n getId\n );\n return;\n }\n\n const initialState = keys.reduce((acc, key) => {\n if (typeof component[key] !== undefined) acc[key] = component[key];\n return acc;\n }, {});\n\n store.set(getId, new Store(getId, component, keys, initialState, method));\n const componentstore = store.get(getId);\n componentstore.dispatchToProps();\n\n const connectedCallback = component.connectedCallback;\n component.connectedCallback = function () {\n store.set(getId, new Store(getId, component, keys, initialState, method));\n const componentstore = store.get(getId);\n if (connectedCallback) {\n connectedCallback.call(component);\n }\n if (componentstore) componentstore.dispatchToProps();\n };\n\n const componentDidRender = component.componentDidRender;\n component.componentDidRender = function () {\n const componentstore = store.get(getId);\n if (componentDidRender) {\n componentDidRender.call(component);\n }\n if (componentstore) componentstore.savePropsToStore();\n };\n\n const disconnectedCallback = component.disconnectedCallback;\n component.disconnectedCallback = function () {\n const componentstore = store.get(getId);\n if (componentstore) componentstore.delete();\n store.delete(getId);\n if (disconnectedCallback) {\n disconnectedCallback.call(component);\n }\n };\n },\n};\n\nclass Store {\n private method: StorageMethods = 'session';\n private keys: string[];\n private id: string;\n private component: Component;\n private initialState: { [key: string]: any } = {};\n private updateStore: boolean = true;\n\n constructor(\n id: string,\n component: Component,\n keys: string[],\n initialState?: any,\n method?: StorageMethods\n ) {\n if (!id)\n throw new Error(\n 'No id set. You can only instantiate a new component store with an id'\n );\n this.id = id;\n this.keys = keys;\n this.component = component;\n if (initialState) this.initialState = initialState;\n if (method) this.method = method;\n\n this.savePropsToStore = debounce(this.savePropsToStore, 500);\n\n if (this.method === 'url-hash-push' || this.method === 'url-query-push') {\n window.addEventListener('popstate', this.onUrlChange);\n }\n }\n\n private onUrlChange = () => {\n this.dispatchToProps(false);\n };\n\n private equality(val1: any, val2: any) {\n if (typeof val1 !== typeof val2) return false;\n if (typeof val1 !== 'object') return val1 === val2;\n return JSON.stringify(val1) === JSON.stringify(val2);\n }\n\n get getData() {\n const data = this.keys.reduce((acc, key) => {\n const isEqual = this.equality(\n this.component[key],\n this.initialState[key]\n );\n if (typeof this.component[key] !== 'undefined' && !isEqual) {\n acc[key] = this.component[key];\n } else if (isEqual) delete acc[key];\n return acc;\n }, {});\n return Object.keys(data).length ? data : undefined;\n }\n\n private retrieve() {\n switch (this.method) {\n case 'url-hash':\n case 'url-hash-push':\n return getset.urlGet(this.id, 'hash');\n case 'url-query':\n case 'url-query-push':\n return getset.urlGet(this.id, 'query');\n case 'local':\n return getset.storageGet(this.id);\n default:\n return getset.sessionGet(this.id);\n }\n }\n\n private save(data: any) {\n switch (this.method) {\n case 'url-hash':\n return getset.urlSet(this.id, data, 'hash');\n case 'url-query':\n return getset.urlSet(this.id, data, 'query');\n case 'url-hash-push':\n return getset.urlSet(this.id, data, 'hash', window, 'push');\n case 'url-query-push':\n return getset.urlSet(this.id, data, 'query', window, 'push');\n case 'local':\n return getset.storageSet(this.id, data);\n default:\n return getset.sessionSet(this.id, data);\n }\n }\n\n public savePropsToStore = () => {\n if (this.updateStore) {\n this.save(this.getData);\n } else if (!this.updateStore) this.updateStore = true;\n };\n\n public dispatchToProps = (updateStore = true) => {\n const savedData = this.retrieve();\n if (!savedData && updateStore) return;\n\n // console.log('dispatching', savedData, this.id, this.initialState);\n this.updateStore = updateStore;\n\n this.keys.forEach((key) => {\n this.component[key] = savedData ? savedData[key] : undefined;\n });\n };\n\n public delete = () => {\n if (this.method === 'url-hash-push' || this.method === 'url-query-push') {\n window.removeEventListener('popstate', this.onUrlChange);\n }\n };\n}\n"],"version":3}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"file":"table.worker-e47dba3a.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
@@ -1 +0,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C;MAC/D,KAAK,OAAO;QACV,OAAOC,UAAiB,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;MAC1C;QACE,OAAOC,UAAiB,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;KAC3C;GACF;;;;;","names":["getset.urlGet","getset.storageGet","getset.sessionGet","getset.urlSet","getset.storageSet","getset.sessionSet"],"sources":["./node_modules/tyqs/dist/parse.js","./node_modules/tyqs/dist/stringify.js","./src/utils/store/get-set.ts","./src/utils/store/component-store.ts"],"sourcesContent":["export function parse(searchParams, replacer) {\n const params = new URLSearchParams([...new URLSearchParams(searchParams)].map(([k, v]) => [\n k.replace(/([[\\]])/g, (_, s) => s === '[' ? '.' : ''),\n v,\n ]));\n const t = {};\n new Set(params.keys()).forEach((paramKey) => {\n const rawValue = params\n .getAll(paramKey)\n .join(',')\n .split(',')\n .map(n => decodeURIComponent(n.replace(/\\+/g, ' ')));\n const value = rawValue.length === 1 ? rawValue[0] : rawValue;\n let key = paramKey;\n let v = replacer ?\n replacer({\n firstRawValue: params.get(paramKey).split(','),\n key,\n rawValue,\n value,\n }) :\n value;\n if (key.includes('.')) {\n const [f, ...kl] = key.split('.');\n const o = (t[f] || {});\n const l = kl.pop();\n (kl.reduce((p, n) => (p[n] ??= {}), o))[l] = v;\n key = f;\n v = o;\n }\n t[key] = v;\n });\n return t;\n}\n//# sourceMappingURL=parse.js.map","export function stringify(input, replacer) {\n if (!input)\n return '';\n const stack = [['', input]];\n const sp = new URLSearchParams();\n while (stack.length) {\n const [itemKey, itemValue] = stack.pop();\n Object.entries(itemValue).forEach(([key, rawValue]) => {\n if (rawValue == null && replacer == null)\n return;\n const typeOfValue = typeof (rawValue);\n const flattenedKey = itemKey ? `${itemKey}.${key}` : key;\n if (rawValue !== null && typeOfValue === 'object' && !Array.isArray(rawValue)) {\n stack.push([flattenedKey, rawValue]);\n }\n else {\n let value = typeOfValue === 'string' ? rawValue : '';\n if (Array.isArray(rawValue))\n value = rawValue.join(',');\n else if (rawValue?.toJSON)\n value = rawValue.toJSON();\n else if (rawValue?.toString)\n value = rawValue.toString();\n else\n value = String(rawValue);\n const vv = replacer ?\n replacer({ flattenedKey, key, rawValue, value }) :\n value;\n vv != null && sp.append(flattenedKey, vv);\n }\n });\n }\n sp.sort();\n return sp.toString();\n}\n//# sourceMappingURL=stringify.js.map","import { parse, stringify } from 'tyqs';\n\nconst STORAGE_NAME_SPACE = 'nano-component-store:';\n\nconst urlRead = (\n from: 'hash' | 'query' = 'hash',\n win: Window = window\n): void | object => {\n if (!win || !win.location) return {};\n if (from === 'hash' && win.location.hash)\n return parse(win.location.hash.replace(/^\\#/, ''));\n else if (from === 'query' && win.location.search)\n return parse(win.location.search.replace(/^\\?/, ''));\n return {};\n};\n\nconst urlSave = (\n object: object,\n to: 'hash' | 'query' = 'hash',\n win: Window = window,\n method: 'replace' | 'push' = 'replace'\n) => {\n if (!win || !win.history) return;\n const oldQuery = to === 'query' ? win.location.search : win.location.hash;\n const basePath =\n to === 'query'\n ? win.location.pathname\n : win.location.pathname + win.location.search;\n let queryStr = stringify(object);\n\n if (!queryStr || !queryStr.length) {\n if (!oldQuery || !oldQuery.length) return;\n if (method === 'replace') win.history.replaceState(null, null, basePath);\n else win.history.pushState(null, null, basePath);\n return;\n }\n\n if (to === 'hash' && win.location.hash === '#' + queryStr) {\n try {\n (document.querySelector('#' + queryStr) as HTMLElement).focus();\n } catch (e) {}\n return;\n }\n queryStr = (to === 'hash' ? '#' : '?') + queryStr;\n if (queryStr === oldQuery) return;\n if (method === 'replace')\n win.history.replaceState(null, null, basePath + queryStr);\n else win.history.pushState(null, null, basePath + queryStr);\n};\n\nexport const urlSet = (\n id: string,\n data: object,\n to: 'hash' | 'query' = 'hash',\n win: Window = window,\n method: 'replace' | 'push' = 'replace'\n) => {\n // sanitize the incoming key\n id = Object.keys(parse(id))[0];\n const object = {};\n object[id] = data;\n\n let currentData = urlRead(to, win);\n currentData = { ...currentData, ...object };\n urlSave(currentData, to, win, method);\n};\n\nexport const urlGet = (\n key: string,\n to: 'hash' | 'query' = 'hash',\n win: Window = window\n) => {\n // sanitize the incoming key\n key = Object.keys(parse(key))[0];\n const currentData = urlRead(to, win);\n return currentData[key] || null;\n};\n\nexport const sessionSet = (\n key: string,\n object: object,\n win: Window = window\n) => {\n try {\n if (!object) {\n win.sessionStorage.removeItem(STORAGE_NAME_SPACE + key);\n return;\n }\n win.sessionStorage.setItem(\n STORAGE_NAME_SPACE + key,\n JSON.stringify(object)\n );\n } catch (e) {\n throw e;\n }\n};\n\nexport const sessionGet = (key: string, win: Window = window) => {\n try {\n const configStr = win.sessionStorage.getItem(STORAGE_NAME_SPACE + key);\n return configStr !== null ? JSON.parse(configStr) : null;\n } catch (e) {\n throw e;\n }\n};\n\nexport const storageSet = (\n key: string,\n object: object,\n win: Window = window\n) => {\n try {\n if (!object) {\n win.localStorage.removeItem(STORAGE_NAME_SPACE + key);\n return;\n }\n win.localStorage.setItem(STORAGE_NAME_SPACE + key, JSON.stringify(object));\n } catch (e) {\n throw e;\n }\n};\n\nexport const storageGet = (key: string, win: Window = window) => {\n try {\n const configStr = win.localStorage.getItem(STORAGE_NAME_SPACE + key);\n return configStr !== null ? JSON.parse(configStr) : null;\n } catch (e) {\n throw e;\n }\n};\n","import { getElement } from '@stencil/core';\nimport { debounce } from '../throttle';\nimport * as getset from './get-set';\n\nexport type StorageParams = Record<string, any>;\n\nexport type StorageMethods =\n | 'url-hash'\n | 'url-query'\n | 'url-hash-push'\n | 'url-query-push'\n | 'local'\n | 'session';\n\ninterface Component {\n connectedCallback?(): void;\n disconnectedCallback?(): void;\n componentDidRender?(): void;\n [key: string]: any;\n}\n\nconst store = new Map<string, Store>();\n\nexport const ComponentStore = {\n init(\n component: Component,\n keys: string[],\n method?: StorageMethods,\n id?: string\n ) {\n const getId = id || component.storeId || getElement(component).id;\n if (!getId) {\n console.error(\n 'No id set. You can only instantiate a new component store with an id. '\n );\n return;\n }\n if (store.get(getId)) {\n console.error(\n 'Duplicate store id usage. A store ID must be unique!',\n getId\n );\n return;\n }\n\n const initialState = keys.reduce((acc, key) => {\n if (typeof component[key] !== undefined) acc[key] = component[key];\n return acc;\n }, {});\n\n store.set(getId, new Store(getId, component, keys, initialState, method));\n const componentstore = store.get(getId);\n componentstore.dispatchToProps();\n\n const connectedCallback = component.connectedCallback;\n component.connectedCallback = function () {\n store.set(getId, new Store(getId, component, keys, initialState, method));\n const componentstore = store.get(getId);\n if (connectedCallback) {\n connectedCallback.call(component);\n }\n if (componentstore) componentstore.dispatchToProps();\n };\n\n const componentDidRender = component.componentDidRender;\n component.componentDidRender = function () {\n const componentstore = store.get(getId);\n if (componentDidRender) {\n componentDidRender.call(component);\n }\n if (componentstore) componentstore.savePropsToStore();\n };\n\n const disconnectedCallback = component.disconnectedCallback;\n component.disconnectedCallback = function () {\n const componentstore = store.get(getId);\n if (componentstore) componentstore.delete();\n store.delete(getId);\n if (disconnectedCallback) {\n disconnectedCallback.call(component);\n }\n };\n },\n};\n\nclass Store {\n private method: StorageMethods = 'session';\n private keys: string[];\n private id: string;\n private component: Component;\n private initialState: { [key: string]: any } = {};\n private updateStore: boolean = true;\n\n constructor(\n id: string,\n component: Component,\n keys: string[],\n initialState?: any,\n method?: StorageMethods\n ) {\n if (!id)\n throw new Error(\n 'No id set. You can only instantiate a new component store with an id'\n );\n this.id = id;\n this.keys = keys;\n this.component = component;\n if (initialState) this.initialState = initialState;\n if (method) this.method = method;\n\n this.savePropsToStore = debounce(this.savePropsToStore, 500);\n\n if (this.method === 'url-hash-push' || this.method === 'url-query-push') {\n window.addEventListener('popstate', this.onUrlChange);\n }\n }\n\n private onUrlChange = () => {\n this.dispatchToProps(false);\n };\n\n private equality(val1: any, val2: any) {\n if (typeof val1 !== typeof val2) return false;\n if (typeof val1 !== 'object') return val1 === val2;\n return JSON.stringify(val1) === JSON.stringify(val2);\n }\n\n get getData() {\n const data = this.keys.reduce((acc, key) => {\n const isEqual = this.equality(\n this.component[key],\n this.initialState[key]\n );\n if (typeof this.component[key] !== 'undefined' && !isEqual) {\n acc[key] = this.component[key];\n } else if (isEqual) delete acc[key];\n return acc;\n }, {});\n return Object.keys(data).length ? data : undefined;\n }\n\n private retrieve() {\n switch (this.method) {\n case 'url-hash':\n case 'url-hash-push':\n return getset.urlGet(this.id, 'hash');\n case 'url-query':\n case 'url-query-push':\n return getset.urlGet(this.id, 'query');\n case 'local':\n return getset.storageGet(this.id);\n default:\n return getset.sessionGet(this.id);\n }\n }\n\n private save(data: any) {\n switch (this.method) {\n case 'url-hash':\n return getset.urlSet(this.id, data, 'hash');\n case 'url-query':\n return getset.urlSet(this.id, data, 'query');\n case 'url-hash-push':\n return getset.urlSet(this.id, data, 'hash', window, 'push');\n case 'url-query-push':\n return getset.urlSet(this.id, data, 'query', window, 'push');\n case 'local':\n return getset.storageSet(this.id, data);\n default:\n return getset.sessionSet(this.id, data);\n }\n }\n\n public savePropsToStore = () => {\n if (this.updateStore) {\n this.save(this.getData);\n } else if (!this.updateStore) this.updateStore = true;\n };\n\n public dispatchToProps = (updateStore = true) => {\n const savedData = this.retrieve();\n if (!savedData && updateStore) return;\n\n // console.log('dispatching', savedData, this.id, this.initialState);\n this.updateStore = updateStore;\n\n this.keys.forEach((key) => {\n this.component[key] = savedData ? savedData[key] : undefined;\n });\n };\n\n public delete = () => {\n if (this.method === 'url-hash-push' || this.method === 'url-query-push') {\n window.removeEventListener('popstate', this.onUrlChange);\n }\n };\n}\n"],"version":3}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"file":"table.worker-c8338436.js","mappings":";;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
@@ -1,5 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Web Components for Nanopore digital Web Apps
|
3
|
-
*/
|
4
|
-
import{g as t}from"./index-9695db0a.js";import{d as e}from"./throttle-ac4fcefa.js";function s(t,e){const s=new URLSearchParams([...new URLSearchParams(t)].map((([t,e])=>[t.replace(/([[\]])/g,((t,e)=>e==="["?".":"")),e])));const n={};new Set(s.keys()).forEach((t=>{const r=s.getAll(t).join(",").split(",").map((t=>decodeURIComponent(t.replace(/\+/g," "))));const i=r.length===1?r[0]:r;let u=t;let o=e?e({firstRawValue:s.get(t).split(","),key:u,rawValue:r,value:i}):i;if(u.includes(".")){const[t,...e]=u.split(".");const s=n[t]||{};const r=e.pop();e.reduce(((t,e)=>t[e]??={}),s)[r]=o;u=t;o=s}n[u]=o}));return n}function n(t,e){if(!t)return"";const s=[["",t]];const n=new URLSearchParams;while(s.length){const[t,r]=s.pop();Object.entries(r).forEach((([r,i])=>{if(i==null&&e==null)return;const u=typeof i;const o=t?`${t}.${r}`:r;if(i!==null&&u==="object"&&!Array.isArray(i)){s.push([o,i])}else{let t=u==="string"?i:"";if(Array.isArray(i))t=i.join(",");else if(i?.toJSON)t=i.toJSON();else if(i?.toString)t=i.toString();else t=String(i);const s=e?e({flattenedKey:o,key:r,rawValue:i,value:t}):t;s!=null&&n.append(o,s)}}))}n.sort();return n.toString()}const r="nano-component-store:";const i=(t="hash",e=window)=>{if(!e||!e.location)return{};if(t==="hash"&&e.location.hash)return s(e.location.hash.replace(/^\#/,""));else if(t==="query"&&e.location.search)return s(e.location.search.replace(/^\?/,""));return{}};const u=(t,e="hash",s=window,r="replace")=>{if(!s||!s.history)return;const i=e==="query"?s.location.search:s.location.hash;const u=e==="query"?s.location.pathname:s.location.pathname+s.location.search;let o=n(t);if(!o||!o.length){if(!i||!i.length)return;if(r==="replace")s.history.replaceState(null,null,u);else s.history.pushState(null,null,u);return}if(e==="hash"&&s.location.hash==="#"+o){try{document.querySelector("#"+o).focus()}catch(t){}return}o=(e==="hash"?"#":"?")+o;if(o===i)return;if(r==="replace")s.history.replaceState(null,null,u+o);else s.history.pushState(null,null,u+o)};const o=(t,e,n="hash",r=window,o="replace")=>{t=Object.keys(s(t))[0];const h={};h[t]=e;let c=i(n,r);c={...c,...h};u(c,n,r,o)};const h=(t,e="hash",n=window)=>{t=Object.keys(s(t))[0];const r=i(e,n);return r[t]||null};const c=(t,e,s=window)=>{try{if(!e){s.sessionStorage.removeItem(r+t);return}s.sessionStorage.setItem(r+t,JSON.stringify(e))}catch(t){throw t}};const a=(t,e=window)=>{try{const s=e.sessionStorage.getItem(r+t);return s!==null?JSON.parse(s):null}catch(t){throw t}};const l=(t,e,s=window)=>{try{if(!e){s.localStorage.removeItem(r+t);return}s.localStorage.setItem(r+t,JSON.stringify(e))}catch(t){throw t}};const f=(t,e=window)=>{try{const s=e.localStorage.getItem(r+t);return s!==null?JSON.parse(s):null}catch(t){throw t}};const w=new Map;const d={init(e,s,n,r){const i=r||e.storeId||t(e).id;if(!i){console.error("No id set. You can only instantiate a new component store with an id. ");return}if(w.get(i)){console.error("Duplicate store id usage. A store ID must be unique!",i);return}const u=s.reduce(((t,s)=>{if(typeof e[s]!==undefined)t[s]=e[s];return t}),{});w.set(i,new p(i,e,s,u,n));const o=w.get(i);o.dispatchToProps();const h=e.connectedCallback;e.connectedCallback=function(){w.set(i,new p(i,e,s,u,n));const t=w.get(i);if(h){h.call(e)}if(t)t.dispatchToProps()};const c=e.componentDidRender;e.componentDidRender=function(){const t=w.get(i);if(c){c.call(e)}if(t)t.savePropsToStore()};const a=e.disconnectedCallback;e.disconnectedCallback=function(){const t=w.get(i);if(t)t.delete();w.delete(i);if(a){a.call(e)}}}};class p{constructor(t,s,n,r,i){this.method="session";this.initialState={};this.updateStore=true;this.onUrlChange=()=>{this.dispatchToProps(false)};this.savePropsToStore=()=>{if(this.updateStore){this.save(this.getData)}else if(!this.updateStore)this.updateStore=true};this.dispatchToProps=(t=true)=>{const e=this.retrieve();if(!e&&t)return;this.updateStore=t;this.keys.forEach((t=>{this.component[t]=e?e[t]:undefined}))};this.delete=()=>{if(this.method==="url-hash-push"||this.method==="url-query-push"){window.removeEventListener("popstate",this.onUrlChange)}};if(!t)throw new Error("No id set. You can only instantiate a new component store with an id");this.id=t;this.keys=n;this.component=s;if(r)this.initialState=r;if(i)this.method=i;this.savePropsToStore=e(this.savePropsToStore,500);if(this.method==="url-hash-push"||this.method==="url-query-push"){window.addEventListener("popstate",this.onUrlChange)}}equality(t,e){if(typeof t!==typeof e)return false;if(typeof t!=="object")return t===e;return JSON.stringify(t)===JSON.stringify(e)}get getData(){const t=this.keys.reduce(((t,e)=>{const s=this.equality(this.component[e],this.initialState[e]);if(typeof this.component[e]!=="undefined"&&!s){t[e]=this.component[e]}else if(s)delete t[e];return t}),{});return Object.keys(t).length?t:undefined}retrieve(){switch(this.method){case"url-hash":case"url-hash-push":return h(this.id,"hash");case"url-query":case"url-query-push":return h(this.id,"query");case"local":return f(this.id);default:return a(this.id)}}save(t){switch(this.method){case"url-hash":return o(this.id,t,"hash");case"url-query":return o(this.id,t,"query");case"url-hash-push":return o(this.id,t,"hash",window,"push");case"url-query-push":return o(this.id,t,"query",window,"push");case"local":return l(this.id,t);default:return c(this.id,t)}}}export{d as C};
|
5
|
-
//# sourceMappingURL=component-store-486d9d7a.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["parse","searchParams","replacer","params","URLSearchParams","map","k","v","replace","_","s","t","Set","keys","forEach","paramKey","rawValue","getAll","join","split","n","decodeURIComponent","value","length","key","firstRawValue","get","includes","f","kl","o","l","pop","reduce","p","stringify","input","stack","sp","itemKey","itemValue","Object","entries","typeOfValue","flattenedKey","Array","isArray","push","toJSON","toString","String","vv","append","sort","STORAGE_NAME_SPACE","urlRead","from","win","window","location","hash","search","urlSave","object","to","method","history","oldQuery","basePath","pathname","queryStr","replaceState","pushState","document","querySelector","focus","e","urlSet","id","data","currentData","urlGet","sessionSet","sessionStorage","removeItem","setItem","JSON","sessionGet","configStr","getItem","storageSet","localStorage","storageGet","store","Map","ComponentStore","init","component","getId","storeId","getElement","console","error","initialState","acc","undefined","set","Store","componentstore","dispatchToProps","connectedCallback","call","componentDidRender","savePropsToStore","disconnectedCallback","delete","constructor","this","updateStore","onUrlChange","save","getData","savedData","retrieve","removeEventListener","Error","debounce","addEventListener","equality","val1","val2","isEqual","getset.urlGet","getset.storageGet","getset.sessionGet","getset.urlSet","getset.storageSet","getset.sessionSet"],"sources":["./node_modules/tyqs/dist/parse.js","./node_modules/tyqs/dist/stringify.js","./src/utils/store/get-set.ts","./src/utils/store/component-store.ts"],"sourcesContent":["export function parse(searchParams, replacer) {\n const params = new URLSearchParams([...new URLSearchParams(searchParams)].map(([k, v]) => [\n k.replace(/([[\\]])/g, (_, s) => s === '[' ? '.' : ''),\n v,\n ]));\n const t = {};\n new Set(params.keys()).forEach((paramKey) => {\n const rawValue = params\n .getAll(paramKey)\n .join(',')\n .split(',')\n .map(n => decodeURIComponent(n.replace(/\\+/g, ' ')));\n const value = rawValue.length === 1 ? rawValue[0] : rawValue;\n let key = paramKey;\n let v = replacer ?\n replacer({\n firstRawValue: params.get(paramKey).split(','),\n key,\n rawValue,\n value,\n }) :\n value;\n if (key.includes('.')) {\n const [f, ...kl] = key.split('.');\n const o = (t[f] || {});\n const l = kl.pop();\n (kl.reduce((p, n) => (p[n] ??= {}), o))[l] = v;\n key = f;\n v = o;\n }\n t[key] = v;\n });\n return t;\n}\n//# sourceMappingURL=parse.js.map","export function stringify(input, replacer) {\n if (!input)\n return '';\n const stack = [['', input]];\n const sp = new URLSearchParams();\n while (stack.length) {\n const [itemKey, itemValue] = stack.pop();\n Object.entries(itemValue).forEach(([key, rawValue]) => {\n if (rawValue == null && replacer == null)\n return;\n const typeOfValue = typeof (rawValue);\n const flattenedKey = itemKey ? `${itemKey}.${key}` : key;\n if (rawValue !== null && typeOfValue === 'object' && !Array.isArray(rawValue)) {\n stack.push([flattenedKey, rawValue]);\n }\n else {\n let value = typeOfValue === 'string' ? rawValue : '';\n if (Array.isArray(rawValue))\n value = rawValue.join(',');\n else if (rawValue?.toJSON)\n value = rawValue.toJSON();\n else if (rawValue?.toString)\n value = rawValue.toString();\n else\n value = String(rawValue);\n const vv = replacer ?\n replacer({ flattenedKey, key, rawValue, value }) :\n value;\n vv != null && sp.append(flattenedKey, vv);\n }\n });\n }\n sp.sort();\n return sp.toString();\n}\n//# sourceMappingURL=stringify.js.map","import { parse, stringify } from 'tyqs';\n\nconst STORAGE_NAME_SPACE = 'nano-component-store:';\n\nconst urlRead = (\n from: 'hash' | 'query' = 'hash',\n win: Window = window\n): void | object => {\n if (!win || !win.location) return {};\n if (from === 'hash' && win.location.hash)\n return parse(win.location.hash.replace(/^\\#/, ''));\n else if (from === 'query' && win.location.search)\n return parse(win.location.search.replace(/^\\?/, ''));\n return {};\n};\n\nconst urlSave = (\n object: object,\n to: 'hash' | 'query' = 'hash',\n win: Window = window,\n method: 'replace' | 'push' = 'replace'\n) => {\n if (!win || !win.history) return;\n const oldQuery = to === 'query' ? win.location.search : win.location.hash;\n const basePath =\n to === 'query'\n ? win.location.pathname\n : win.location.pathname + win.location.search;\n let queryStr = stringify(object);\n\n if (!queryStr || !queryStr.length) {\n if (!oldQuery || !oldQuery.length) return;\n if (method === 'replace') win.history.replaceState(null, null, basePath);\n else win.history.pushState(null, null, basePath);\n return;\n }\n\n if (to === 'hash' && win.location.hash === '#' + queryStr) {\n try {\n (document.querySelector('#' + queryStr) as HTMLElement).focus();\n } catch (e) {}\n return;\n }\n queryStr = (to === 'hash' ? '#' : '?') + queryStr;\n if (queryStr === oldQuery) return;\n if (method === 'replace')\n win.history.replaceState(null, null, basePath + queryStr);\n else win.history.pushState(null, null, basePath + queryStr);\n};\n\nexport const urlSet = (\n id: string,\n data: object,\n to: 'hash' | 'query' = 'hash',\n win: Window = window,\n method: 'replace' | 'push' = 'replace'\n) => {\n // sanitize the incoming key\n id = Object.keys(parse(id))[0];\n const object = {};\n object[id] = data;\n\n let currentData = urlRead(to, win);\n currentData = { ...currentData, ...object };\n urlSave(currentData, to, win, method);\n};\n\nexport const urlGet = (\n key: string,\n to: 'hash' | 'query' = 'hash',\n win: Window = window\n) => {\n // sanitize the incoming key\n key = Object.keys(parse(key))[0];\n const currentData = urlRead(to, win);\n return currentData[key] || null;\n};\n\nexport const sessionSet = (\n key: string,\n object: object,\n win: Window = window\n) => {\n try {\n if (!object) {\n win.sessionStorage.removeItem(STORAGE_NAME_SPACE + key);\n return;\n }\n win.sessionStorage.setItem(\n STORAGE_NAME_SPACE + key,\n JSON.stringify(object)\n );\n } catch (e) {\n throw e;\n }\n};\n\nexport const sessionGet = (key: string, win: Window = window) => {\n try {\n const configStr = win.sessionStorage.getItem(STORAGE_NAME_SPACE + key);\n return configStr !== null ? JSON.parse(configStr) : null;\n } catch (e) {\n throw e;\n }\n};\n\nexport const storageSet = (\n key: string,\n object: object,\n win: Window = window\n) => {\n try {\n if (!object) {\n win.localStorage.removeItem(STORAGE_NAME_SPACE + key);\n return;\n }\n win.localStorage.setItem(STORAGE_NAME_SPACE + key, JSON.stringify(object));\n } catch (e) {\n throw e;\n }\n};\n\nexport const storageGet = (key: string, win: Window = window) => {\n try {\n const configStr = win.localStorage.getItem(STORAGE_NAME_SPACE + key);\n return configStr !== null ? JSON.parse(configStr) : null;\n } catch (e) {\n throw e;\n }\n};\n","import { getElement } from '@stencil/core';\nimport { debounce } from '../throttle';\nimport * as getset from './get-set';\n\nexport type StorageParams = Record<string, any>;\n\nexport type StorageMethods =\n | 'url-hash'\n | 'url-query'\n | 'url-hash-push'\n | 'url-query-push'\n | 'local'\n | 'session';\n\ninterface Component {\n connectedCallback?(): void;\n disconnectedCallback?(): void;\n componentDidRender?(): void;\n [key: string]: any;\n}\n\nconst store = new Map<string, Store>();\n\nexport const ComponentStore = {\n init(\n component: Component,\n keys: string[],\n method?: StorageMethods,\n id?: string\n ) {\n const getId = id || component.storeId || getElement(component).id;\n if (!getId) {\n console.error(\n 'No id set. You can only instantiate a new component store with an id. '\n );\n return;\n }\n if (store.get(getId)) {\n console.error(\n 'Duplicate store id usage. A store ID must be unique!',\n getId\n );\n return;\n }\n\n const initialState = keys.reduce((acc, key) => {\n if (typeof component[key] !== undefined) acc[key] = component[key];\n return acc;\n }, {});\n\n store.set(getId, new Store(getId, component, keys, initialState, method));\n const componentstore = store.get(getId);\n componentstore.dispatchToProps();\n\n const connectedCallback = component.connectedCallback;\n component.connectedCallback = function () {\n store.set(getId, new Store(getId, component, keys, initialState, method));\n const componentstore = store.get(getId);\n if (connectedCallback) {\n connectedCallback.call(component);\n }\n if (componentstore) componentstore.dispatchToProps();\n };\n\n const componentDidRender = component.componentDidRender;\n component.componentDidRender = function () {\n const componentstore = store.get(getId);\n if (componentDidRender) {\n componentDidRender.call(component);\n }\n if (componentstore) componentstore.savePropsToStore();\n };\n\n const disconnectedCallback = component.disconnectedCallback;\n component.disconnectedCallback = function () {\n const componentstore = store.get(getId);\n if (componentstore) componentstore.delete();\n store.delete(getId);\n if (disconnectedCallback) {\n disconnectedCallback.call(component);\n }\n };\n },\n};\n\nclass Store {\n private method: StorageMethods = 'session';\n private keys: string[];\n private id: string;\n private component: Component;\n private initialState: { [key: string]: any } = {};\n private updateStore: boolean = true;\n\n constructor(\n id: string,\n component: Component,\n keys: string[],\n initialState?: any,\n method?: StorageMethods\n ) {\n if (!id)\n throw new Error(\n 'No id set. You can only instantiate a new component store with an id'\n );\n this.id = id;\n this.keys = keys;\n this.component = component;\n if (initialState) this.initialState = initialState;\n if (method) this.method = method;\n\n this.savePropsToStore = debounce(this.savePropsToStore, 500);\n\n if (this.method === 'url-hash-push' || this.method === 'url-query-push') {\n window.addEventListener('popstate', this.onUrlChange);\n }\n }\n\n private onUrlChange = () => {\n this.dispatchToProps(false);\n };\n\n private equality(val1: any, val2: any) {\n if (typeof val1 !== typeof val2) return false;\n if (typeof val1 !== 'object') return val1 === val2;\n return JSON.stringify(val1) === JSON.stringify(val2);\n }\n\n get getData() {\n const data = this.keys.reduce((acc, key) => {\n const isEqual = this.equality(\n this.component[key],\n this.initialState[key]\n );\n if (typeof this.component[key] !== 'undefined' && !isEqual) {\n acc[key] = this.component[key];\n } else if (isEqual) delete acc[key];\n return acc;\n }, {});\n return Object.keys(data).length ? data : undefined;\n }\n\n private retrieve() {\n switch (this.method) {\n case 'url-hash':\n case 'url-hash-push':\n return getset.urlGet(this.id, 'hash');\n case 'url-query':\n case 'url-query-push':\n return getset.urlGet(this.id, 'query');\n case 'local':\n return getset.storageGet(this.id);\n default:\n return getset.sessionGet(this.id);\n }\n }\n\n private save(data: any) {\n switch (this.method) {\n case 'url-hash':\n return getset.urlSet(this.id, data, 'hash');\n case 'url-query':\n return getset.urlSet(this.id, data, 'query');\n case 'url-hash-push':\n return getset.urlSet(this.id, data, 'hash', window, 'push');\n case 'url-query-push':\n return getset.urlSet(this.id, data, 'query', window, 'push');\n case 'local':\n return getset.storageSet(this.id, data);\n default:\n return getset.sessionSet(this.id, data);\n }\n }\n\n public savePropsToStore = () => {\n if (this.updateStore) {\n this.save(this.getData);\n } else if (!this.updateStore) this.updateStore = true;\n };\n\n public dispatchToProps = (updateStore = true) => {\n const savedData = this.retrieve();\n if (!savedData && updateStore) return;\n\n // console.log('dispatching', savedData, this.id, this.initialState);\n this.updateStore = updateStore;\n\n this.keys.forEach((key) => {\n this.component[key] = savedData ? savedData[key] : undefined;\n });\n };\n\n public delete = () => {\n if (this.method === 'url-hash-push' || this.method === 'url-query-push') {\n window.removeEventListener('popstate', this.onUrlChange);\n }\n };\n}\n"],"mappings":";;;mFAAO,SAASA,EAAMC,EAAcC,GAChC,MAAMC,EAAS,IAAIC,gBAAgB,IAAI,IAAIA,gBAAgBH,IAAeI,KAAI,EAAEC,EAAGC,KAAO,CACtFD,EAAEE,QAAQ,YAAY,CAACC,EAAGC,IAAMA,IAAM,IAAM,IAAM,KAClDH,MAEJ,MAAMI,EAAI,GACV,IAAIC,IAAIT,EAAOU,QAAQC,SAASC,IAC5B,MAAMC,EAAWb,EACZc,OAAOF,GACPG,KAAK,KACLC,MAAM,KACNd,KAAIe,GAAKC,mBAAmBD,EAAEZ,QAAQ,MAAO,QAClD,MAAMc,EAAQN,EAASO,SAAW,EAAIP,EAAS,GAAKA,EACpD,IAAIQ,EAAMT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