@stonecrop/atable 0.2.63 → 0.2.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index.css +1 -1
- package/dist/atable.d.ts +3 -3
- package/dist/atable.js +1742 -779
- package/dist/atable.js.map +1 -1
- package/dist/atable.umd.cjs +12 -2
- package/dist/atable.umd.cjs.map +1 -1
- package/dist/index.js +5 -2
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/stores/table.d.ts +320 -0
- package/dist/src/stores/table.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +3 -2
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/stores/table.js +174 -0
- package/package.json +5 -4
- package/src/components/ACell.vue +32 -63
- package/src/components/AExpansionRow.vue +9 -10
- package/src/components/ARow.vue +14 -33
- package/src/components/ATable.vue +47 -57
- package/src/components/ATableHeader.vue +10 -19
- package/src/components/ATableModal.vue +5 -8
- package/src/index.ts +6 -2
- package/src/stores/table.ts +208 -0
- package/src/types/index.ts +1 -3
- package/dist/components/index.js +0 -97
- package/dist/src/components/index.d.ts +0 -23
- package/dist/src/components/index.d.ts.map +0 -1
- package/src/components/index.ts +0 -120
package/dist/atable.umd.cjs
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`,document.head.appendChild(A);function ee(e){return o.getCurrentScope()?(o.onScopeDispose(e),!0):!1}function P(e){return typeof e=="function"?e():o.unref(e)}const xe=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const ke=e=>e!=null,Ee=Object.prototype.toString,ve=e=>Ee.call(e)==="[object Object]",Ce=()=>{},T=xe?window:void 0;function D(e){var t;const n=P(e);return(t=n==null?void 0:n.$el)!=null?t:n}function O(...e){let t,n,r,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,r,a]=e,t=T):[t,n,r,a]=e,!t)return Ce;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const i=[],l=()=>{i.forEach(f=>f()),i.length=0},c=(f,m,d,u)=>(f.addEventListener(m,d,u),()=>f.removeEventListener(m,d,u)),p=o.watch(()=>[D(t),P(a)],([f,m])=>{if(l(),!f)return;const d=ve(m)?{...m}:m;i.push(...n.flatMap(u=>r.map(b=>c(f,u,b,d))))},{immediate:!0,flush:"post"}),s=()=>{p(),l()};return ee(s),s}function Se(){const e=o.ref(!1),t=o.getCurrentInstance();return t&&o.onMounted(()=>{e.value=!0},t),e}function Ae(e){const t=Se();return o.computed(()=>(t.value,!!e()))}function Ie(e,t,n={}){const{window:r=T,...a}=n;let i;const l=Ae(()=>r&&"MutationObserver"in r),c=()=>{i&&(i.disconnect(),i=void 0)},p=o.computed(()=>{const d=P(e),u=(Array.isArray(d)?d:[d]).map(D).filter(ke);return new Set(u)}),s=o.watch(()=>p.value,d=>{c(),l.value&&d.size&&(i=new MutationObserver(t),d.forEach(u=>i.observe(u,a)))},{immediate:!0,flush:"post"}),f=()=>i==null?void 0:i.takeRecords(),m=()=>{s(),c()};return ee(m),{isSupported:l,stop:m,takeRecords:f}}function Te(e={}){var t;const{window:n=T,deep:r=!0,triggerOnRemoval:a=!1}=e,i=(t=e.document)!=null?t:n==null?void 0:n.document,l=()=>{var s;let f=i==null?void 0:i.activeElement;if(r)for(;f!=null&&f.shadowRoot;)f=(s=f==null?void 0:f.shadowRoot)==null?void 0:s.activeElement;return f},c=o.ref(),p=()=>{c.value=l()};return n&&(O(n,"blur",s=>{s.relatedTarget===null&&p()},!0),O(n,"focus",p,!0)),a&&Ie(i,s=>{s.filter(f=>f.removedNodes.length).map(f=>Array.from(f.removedNodes)).flat().forEach(f=>{f===c.value&&p()})},{childList:!0,subtree:!0}),p(),c}const De="focusin",Oe="focusout";function Me(e,t={}){const{window:n=T}=t,r=o.computed(()=>D(e)),a=o.ref(!1),i=o.computed(()=>a.value),l=Te(t);return!n||!l.value?{focused:i}:(O(r,De,()=>a.value=!0),O(r,Oe,()=>a.value=!1),{focused:i})}function Be(e,{window:t=T,scrollTarget:n}={}){const r=o.ref(!1),a=()=>{if(!t)return;const i=t.document,l=D(e);if(!l)r.value=!1;else{const c=l.getBoundingClientRect();r.value=c.top<=(t.innerHeight||i.documentElement.clientHeight)&&c.left<=(t.innerWidth||i.documentElement.clientWidth)&&c.bottom>=0&&c.right>=0}};return o.watch(()=>D(e),()=>a(),{immediate:!0,flush:"post"}),t&&O(n||t,"scroll",a,{capture:!1,passive:!0}),r}const v=e=>{let t=Be(e).value;return t=t&&e.offsetHeight>0,t},C=e=>e.tabIndex>=0,te=e=>{const t=e.target;return N(t)},N=e=>{var t;let n;if(e instanceof HTMLTableCellElement){const r=(t=e.parentElement)==null?void 0:t.previousElementSibling;if(r){const a=Array.from(r.children)[e.cellIndex];a&&(n=a)}}else if(e instanceof HTMLTableRowElement){const r=e.previousElementSibling;r&&(n=r)}return n&&(!C(n)||!v(n))?N(n):n},$e=e=>{var t;const n=e.target;let r;if(n instanceof HTMLTableCellElement){const a=(t=n.parentElement)==null?void 0:t.parentElement;if(a){const i=a.firstElementChild.children[n.cellIndex];i&&(r=i)}}else if(n instanceof HTMLTableRowElement){const a=n.parentElement;if(a){const i=a.firstElementChild;i&&(r=i)}}return r&&(!C(r)||!v(r))?j(r):r},oe=e=>{const t=e.target;return j(t)},j=e=>{var t;let n;if(e instanceof HTMLTableCellElement){const r=(t=e.parentElement)==null?void 0:t.nextElementSibling;if(r){const a=Array.from(r.children)[e.cellIndex];a&&(n=a)}}else if(e instanceof HTMLTableRowElement){const r=e.nextElementSibling;r&&(n=r)}return n&&(!C(n)||!v(n))?j(n):n},Re=e=>{var t;const n=e.target;let r;if(n instanceof HTMLTableCellElement){const a=(t=n.parentElement)==null?void 0:t.parentElement;if(a){const i=a.lastElementChild.children[n.cellIndex];i&&(r=i)}}else if(n instanceof HTMLTableRowElement){const a=n.parentElement;if(a){const i=a.lastElementChild;i&&(r=i)}}return r&&(!C(r)||!v(r))?N(r):r},ne=e=>{const t=e.target;return W(t)},W=e=>{var t;let n;if(e.previousElementSibling)n=e.previousElementSibling;else{const r=(t=e.parentElement)==null?void 0:t.previousElementSibling;n=r==null?void 0:r.lastElementChild}return n&&(!C(n)||!v(n))?W(n):n},re=e=>{const t=e.target;return H(t)},H=e=>{var t;let n;if(e.nextElementSibling)n=e.nextElementSibling;else{const r=(t=e.parentElement)==null?void 0:t.nextElementSibling;n=r==null?void 0:r.firstElementChild}return n&&(!C(n)||!v(n))?H(n):n},le=e=>{const t=e.target.parentElement.firstElementChild;return t&&(!C(t)||!v(t))?H(t):t},ae=e=>{const t=e.target.parentElement.lastElementChild;return t&&(!C(t)||!v(t))?W(t):t},R=["alt","control","shift","meta"],Le={ArrowUp:"up",ArrowDown:"down",ArrowLeft:"left",ArrowRight:"right"},V={"keydown.up":e=>{const t=te(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.down":e=>{const t=oe(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.left":e=>{const t=ne(e);e.preventDefault(),e.stopPropagation(),t&&t.focus()},"keydown.right":e=>{const t=re(e);e.preventDefault(),e.stopPropagation(),t&&t.focus()},"keydown.control.up":e=>{const t=$e(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.control.down":e=>{const t=Re(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.control.left":e=>{const t=le(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.control.right":e=>{const t=ae(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.end":e=>{const t=ae(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.enter":e=>{if(e.target instanceof HTMLTableCellElement){e.preventDefault(),e.stopPropagation();const t=oe(e);t&&t.focus()}},"keydown.shift.enter":e=>{if(e.target instanceof HTMLTableCellElement){e.preventDefault(),e.stopPropagation();const t=te(e);t&&t.focus()}},"keydown.home":e=>{const t=le(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.tab":e=>{const t=re(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.shift.tab":e=>{const t=ne(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())}};function F(e){const t=l=>{let c=null;return l.parent&&(typeof l.parent=="string"?c=document.querySelector(l.parent):l.parent instanceof HTMLElement?c=l.parent:c=l.parent.value),c},n=l=>{const c=t(l);let p=[];if(typeof l.selectors=="string")p=c?Array.from(c.querySelectorAll(l.selectors)):Array.from(document.querySelectorAll(l.selectors));else if(Array.isArray(l.selectors))for(const s of l.selectors)s instanceof HTMLElement?p.push(s):p.push(s.$el);else if(l.selectors instanceof HTMLElement)p.push(l.selectors);else if(Array.isArray(l.selectors.value))for(const s of l.selectors.value)s instanceof HTMLElement?p.push(s):p.push(s.$el);else p.push(l.selectors.value);return p},r=l=>{const c=t(l);let p=[];return l.selectors?p=n(l):c&&(p=Array.from(c.children).filter(s=>C(s)&&v(s))),p},a=l=>c=>{const p=Le[c.key]||c.key.toLowerCase();if(R.includes(p))return;const s=l.handlers||V;for(const f of Object.keys(s)){const[m,...d]=f.split(".");if(m==="keydown"&&d.includes(p)){const u=s[f],b=d.filter(w=>R.includes(w)),y=R.some(w=>{const x=w.charAt(0).toUpperCase()+w.slice(1);return c.getModifierState(x)});if(b.length>0){if(y){for(const w of R)if(d.includes(w)){const x=w.charAt(0).toUpperCase()+w.slice(1);c.getModifierState(x)&&u(c)}}}else y||u(c)}}},i=[];o.onMounted(()=>{for(const l of e){const c=t(l),p=r(l),s=a(l),f=c?[c]:p;for(const m of f){const{focused:d}=Me(o.ref(m)),u=o.watch(d,b=>{b?m.addEventListener("keydown",s):m.removeEventListener("keydown",s)});i.push(u)}}}),o.onBeforeUnmount(()=>{for(const l of i)l()})}function q(e){return o.getCurrentScope()?(o.onScopeDispose(e),!0):!1}function L(e){return typeof e=="function"?e():o.unref(e)}const ze=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Pe=e=>e!=null,Ne=Object.prototype.toString,je=e=>Ne.call(e)==="[object Object]",We=()=>{};function He(e){return o.getCurrentInstance()}function Ve(e,t=!0,n){He()?o.onMounted(e,n):t?e():o.nextTick(e)}const G=ze?window:void 0;function I(e){var t;const n=L(e);return(t=n==null?void 0:n.$el)!=null?t:n}function ie(...e){let t,n,r,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,r,a]=e,t=G):[t,n,r,a]=e,!t)return We;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const i=[],l=()=>{i.forEach(f=>f()),i.length=0},c=(f,m,d,u)=>(f.addEventListener(m,d,u),()=>f.removeEventListener(m,d,u)),p=o.watch(()=>[I(t),L(a)],([f,m])=>{if(l(),!f)return;const d=je(m)?{...m}:m;i.push(...n.flatMap(u=>r.map(b=>c(f,u,b,d))))},{immediate:!0,flush:"post"}),s=()=>{p(),l()};return q(s),s}function Fe(){const e=o.ref(!1),t=o.getCurrentInstance();return t&&o.onMounted(()=>{e.value=!0},t),e}function se(e){const t=Fe();return o.computed(()=>(t.value,!!e()))}function ce(e,t,n={}){const{window:r=G,...a}=n;let i;const l=se(()=>r&&"MutationObserver"in r),c=()=>{i&&(i.disconnect(),i=void 0)},p=o.computed(()=>{const d=L(e),u=(Array.isArray(d)?d:[d]).map(I).filter(Pe);return new Set(u)}),s=o.watch(()=>p.value,d=>{c(),l.value&&d.size&&(i=new MutationObserver(t),d.forEach(u=>i.observe(u,a)))},{immediate:!0,flush:"post"}),f=()=>i==null?void 0:i.takeRecords(),m=()=>{s(),c()};return q(m),{isSupported:l,stop:m,takeRecords:f}}function qe(e,t,n={}){const{window:r=G,...a}=n;let i;const l=se(()=>r&&"ResizeObserver"in r),c=()=>{i&&(i.disconnect(),i=void 0)},p=o.computed(()=>{const m=L(e);return Array.isArray(m)?m.map(d=>I(d)):[I(m)]}),s=o.watch(p,m=>{if(c(),l.value&&r){i=new ResizeObserver(t);for(const d of m)d&&i.observe(d,a)}},{immediate:!0,flush:"post"}),f=()=>{c(),s()};return q(f),{isSupported:l,stop:f}}function Ge(e,t={}){const{reset:n=!0,windowResize:r=!0,windowScroll:a=!0,immediate:i=!0,updateTiming:l="sync"}=t,c=o.ref(0),p=o.ref(0),s=o.ref(0),f=o.ref(0),m=o.ref(0),d=o.ref(0),u=o.ref(0),b=o.ref(0);function y(){const x=I(e);if(!x){n&&(c.value=0,p.value=0,s.value=0,f.value=0,m.value=0,d.value=0,u.value=0,b.value=0);return}const k=x.getBoundingClientRect();c.value=k.height,p.value=k.bottom,s.value=k.left,f.value=k.right,m.value=k.top,d.value=k.width,u.value=k.x,b.value=k.y}function w(){l==="sync"?y():l==="next-frame"&&requestAnimationFrame(()=>y())}return qe(e,w),o.watch(()=>I(e),x=>!x&&w()),ce(e,w,{attributeFilter:["style","class"]}),a&&ie("scroll",w,{capture:!0,passive:!0}),r&&ie("resize",w,{passive:!0}),Ve(()=>{i&&w()}),{height:c,bottom:p,left:s,right:f,top:m,width:d,x:u,y:b,update:w}}const Ue=e=>{const t=new DOMParser().parseFromString(e,"text/html");return Array.from(t.body.childNodes).some(n=>n.nodeType===1)},Ye=["data-colindex","data-rowindex","data-editable","contenteditable","tabindex"],Xe=["innerHTML"],Je={key:2},U=o.defineComponent({__name:"ACell",props:{colIndex:{},rowIndex:{},tableid:{},addNavigation:{type:[Boolean,Object],default:!0},tabIndex:{default:0},pinned:{type:Boolean}},setup(e){const t=o.inject(e.tableid),n=o.useTemplateRef("cell"),{bottom:r,left:a}=Ge(n),i=t.cellData(e.colIndex,e.rowIndex),l=o.ref(""),c=o.ref(!1),p=t.table,s=t.columns[e.colIndex],f=t.rows[e.rowIndex],m=s.align||"center",d=s.width||"40ch",u=o.computed(()=>typeof y.value=="string"?Ue(y.value):!1),b=o.computed(()=>{var g;return{textAlign:m,width:d,backgroundColor:c.value?"var(--sc-cell-modified)":"inherit",fontWeight:c.value?"bold":"inherit",paddingLeft:ft(e.colIndex,(g=t.display[e.rowIndex])==null?void 0:g.indent)}}),y=o.computed(()=>{const g=t.cellData(e.colIndex,e.rowIndex);return w(g)}),w=g=>{const E=s.format;return E?typeof E=="function"?E(g,{table:p,row:f,column:s}):typeof E=="string"?Function(`"use strict";return (${E})`)()(g,{table:p,row:f,column:s}):g:g},x=()=>{s.mask,s.modalComponent&&(t.modal.visible=!0,t.modal.colIndex=e.colIndex,t.modal.rowIndex=e.rowIndex,t.modal.parent=n.value,t.modal.top=r.value,t.modal.left=a.value,t.modal.width=d,typeof s.modalComponent=="function"?t.modal.component=s.modalComponent({table:p,row:f,column:s}):t.modal.component=s.modalComponent,t.modal.componentProps=s.modalComponentExtraProps)};if(e.addNavigation){let g={...V,"keydown.f2":x,"keydown.alt.up":x,"keydown.alt.down":x,"keydown.alt.left":x,"keydown.alt.right":x};typeof e.addNavigation=="object"&&(g={...g,...e.addNavigation}),F([{selectors:n,handlers:g}])}const k=()=>{n.value&&(l.value=n.value.textContent)},_=()=>{n.value&&(s.format?c.value=n.value.textContent!==w(i):c.value=n.value.textContent!==i,n.value.textContent!==l.value&&(l.value=n.value.textContent,n.value.dispatchEvent(new Event("change")),s.format||t.setCellData(e.rowIndex,e.colIndex,l.value)))},ft=(g,E)=>E&&g===0&&E>0?`${E}ch`:"inherit";return(g,E)=>(o.openBlock(),o.createElementBlock("td",{ref:"cell","data-colindex":g.colIndex,"data-rowindex":g.rowIndex,"data-editable":o.unref(s).edit,contenteditable:o.unref(s).edit,tabindex:g.tabIndex,spellcheck:!1,style:o.normalizeStyle(b.value),onFocus:k,onPaste:_,onBlur:_,onInput:_,onClick:x,onMousedown:x,class:o.normalizeClass(["atable-cell",g.pinned?"sticky-column":""])},[o.unref(s).cellComponent?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(s).cellComponent),o.mergeProps({key:0,value:y.value},o.unref(s).cellComponentProps),null,16,["value"])):u.value?(o.openBlock(),o.createElementBlock("span",{key:1,innerHTML:y.value},null,8,Xe)):(o.openBlock(),o.createElementBlock("span",Je,o.toDisplayString(y.value),1))],46,Ye))}}),Qe=["tabindex"],Ze=["tabindex"],Ke=["colspan"],de=o.defineComponent({__name:"AExpansionRow",props:{rowIndex:{},tableid:{},tabIndex:{default:()=>-1},addNavigation:{type:[Boolean,Object]}},setup(e){const t=o.inject(e.tableid),n=o.useTemplateRef("rowEl"),r=o.computed(()=>t.display[e.rowIndex].expanded?"▼":"►");if(e.addNavigation){const a={"keydown.control.g":i=>{i.stopPropagation(),i.preventDefault(),t.toggleRowExpand(e.rowIndex)}};typeof e.addNavigation=="object"&&Object.assign(a,e.addNavigation),F([{selectors:n,handlers:a}])}return(a,i)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("tr",o.mergeProps(a.$attrs,{ref:"rowEl",tabindex:a.tabIndex,class:"expandable-row"}),[o.createElementVNode("td",{tabIndex:-1,onClick:i[0]||(i[0]=l=>o.unref(t).toggleRowExpand(a.rowIndex)),class:"row-index"},o.toDisplayString(r.value),1),o.renderSlot(a.$slots,"row")],16,Qe),o.unref(t).display[a.rowIndex].expanded?(o.openBlock(),o.createElementBlock("tr",{key:0,ref:"rowExpanded",tabindex:a.tabIndex,class:"expanded-row"},[o.createElementVNode("td",{tabIndex:-1,colspan:o.unref(t).columns.length+1,class:"expanded-row-content"},[o.renderSlot(a.$slots,"content")],8,Ke)],8,Ze)):o.createCommentVNode("",!0)],64))}}),_e=["tabindex"],Y=o.defineComponent({__name:"ARow",props:{rowIndex:{},tableid:{},tabIndex:{default:()=>-1},addNavigation:{type:[Boolean,Object],default:!1}},setup(e){const t=o.inject(e.tableid),n=o.useTemplateRef("rowEl"),r=o.computed(()=>t.columns.some(c=>c.pinned)),a=o.computed(()=>t.config.view!=="tree"||t.display[e.rowIndex].isRoot||t.display[e.rowIndex].open),i=o.computed(()=>t.config.view!=="tree"?"":t.display[e.rowIndex].isRoot||t.display[e.rowIndex].isParent?t.display[e.rowIndex].childrenOpen?"-":"+":""),l=c=>{t.toggleRowExpand(c)};if(e.addNavigation){let c=V;typeof e.addNavigation=="object"&&(c={...c,...e.addNavigation}),F([{selectors:n,handlers:c}])}return(c,p)=>o.withDirectives((o.openBlock(),o.createElementBlock("tr",{ref:"rowEl",tabindex:c.tabIndex,class:"table-row"},[o.unref(t).config.view!=="uncounted"?o.renderSlot(c.$slots,"index",{key:0},()=>[o.unref(t).config.view==="list"?(o.openBlock(),o.createElementBlock("td",{key:0,tabIndex:-1,class:o.normalizeClass(["list-index",r.value?"sticky-index":""])},o.toDisplayString(c.rowIndex+1),3)):o.unref(t).config.view==="tree"?(o.openBlock(),o.createElementBlock("td",{key:1,tabIndex:-1,class:o.normalizeClass(["tree-index",r.value?"sticky-index":""]),onClick:p[0]||(p[0]=s=>l(c.rowIndex))},o.toDisplayString(i.value),3)):o.createCommentVNode("",!0)]):o.createCommentVNode("",!0),o.renderSlot(c.$slots,"default")],8,_e)),[[o.vShow,a.value]])}});function fe(e){return o.getCurrentScope()?(o.onScopeDispose(e),!0):!1}function M(e){return typeof e=="function"?e():o.unref(e)}const ue=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const et=Object.prototype.toString,tt=e=>et.call(e)==="[object Object]",B=()=>{},X=ot();function ot(){var e,t;return ue&&((e=window==null?void 0:window.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window==null?void 0:window.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}const pe={mounted:"mounted",updated:"updated",unmounted:"unmounted"};function nt(...e){if(e.length!==1)return o.toRef(...e);const t=e[0];return typeof t=="function"?o.readonly(o.customRef(()=>({get:t,set:B}))):o.ref(t)}function $(e){var t;const n=M(e);return(t=n==null?void 0:n.$el)!=null?t:n}const me=ue?window:void 0;function z(...e){let t,n,r,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,r,a]=e,t=me):[t,n,r,a]=e,!t)return B;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const i=[],l=()=>{i.forEach(f=>f()),i.length=0},c=(f,m,d,u)=>(f.addEventListener(m,d,u),()=>f.removeEventListener(m,d,u)),p=o.watch(()=>[$(t),M(a)],([f,m])=>{if(l(),!f)return;const d=tt(m)?{...m}:m;i.push(...n.flatMap(u=>r.map(b=>c(f,u,b,d))))},{immediate:!0,flush:"post"}),s=()=>{p(),l()};return fe(s),s}let be=!1;function we(e,t,n={}){const{window:r=me,ignore:a=[],capture:i=!0,detectIframe:l=!1}=n;if(!r)return B;X&&!be&&(be=!0,Array.from(r.document.body.children).forEach(d=>d.addEventListener("click",B)),r.document.documentElement.addEventListener("click",B));let c=!0;const p=d=>a.some(u=>{if(typeof u=="string")return Array.from(r.document.querySelectorAll(u)).some(b=>b===d.target||d.composedPath().includes(b));{const b=$(u);return b&&(d.target===b||d.composedPath().includes(b))}}),f=[z(r,"click",d=>{const u=$(e);if(!(!u||u===d.target||d.composedPath().includes(u))){if(d.detail===0&&(c=!p(d)),!c){c=!0;return}t(d)}},{passive:!0,capture:i}),z(r,"pointerdown",d=>{const u=$(e);c=!p(d)&&!!(u&&!d.composedPath().includes(u))},{passive:!0}),l&&z(r,"blur",d=>{setTimeout(()=>{var u;const b=$(e);((u=r.document.activeElement)==null?void 0:u.tagName)==="IFRAME"&&!(b!=null&&b.contains(r.document.activeElement))&&t(d)},0)})].filter(Boolean);return()=>f.forEach(d=>d())}const rt={[pe.mounted](e,t){const n=!t.modifiers.bubble;if(typeof t.value=="function")e.__onClickOutside_stop=we(e,t.value,{capture:n});else{const[r,a]=t.value;e.__onClickOutside_stop=we(e,r,Object.assign({capture:n},a))}},[pe.unmounted](e){e.__onClickOutside_stop()}};function J(e){return typeof Window<"u"&&e instanceof Window?e.document.documentElement:typeof Document<"u"&&e instanceof Document?e.documentElement:e}function he(e){const t=window.getComputedStyle(e);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&e.clientWidth<e.scrollWidth||t.overflowY==="auto"&&e.clientHeight<e.scrollHeight)return!0;{const n=e.parentNode;return!n||n.tagName==="BODY"?!1:he(n)}}function lt(e){const t=e||window.event,n=t.target;return he(n)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}const Q=new WeakMap;function at(e,t=!1){const n=o.ref(t);let r=null,a="";o.watch(nt(e),c=>{const p=J(M(c));if(p){const s=p;if(Q.get(s)||Q.set(s,s.style.overflow),s.style.overflow!=="hidden"&&(a=s.style.overflow),s.style.overflow==="hidden")return n.value=!0;if(n.value)return s.style.overflow="hidden"}},{immediate:!0});const i=()=>{const c=J(M(e));!c||n.value||(X&&(r=z(c,"touchmove",p=>{lt(p)},{passive:!1})),c.style.overflow="hidden",n.value=!0)},l=()=>{const c=J(M(e));!c||!n.value||(X&&(r==null||r()),c.style.overflow=a,Q.delete(c),n.value=!1)};return fe(l),o.computed({get(){return n.value},set(c){c?i():l()}})}function it(){let e=!1;const t=o.ref(!1);return(n,r)=>{if(t.value=r.value,e)return;e=!0;const a=at(n,r.value);o.watch(t,i=>a.value=i)}}it();class ge{constructor(t,n,r,a,i,l){S(this,"id");S(this,"rows");S(this,"columns");S(this,"config");S(this,"table");S(this,"display");S(this,"modal");this.id=t||crypto.randomUUID(),this.rows=r,this.columns=o.reactive(n),this.config=o.reactive(a),this.table=i||o.reactive(this.createTableObject()),this.display=this.createDisplayObject(l),this.modal=o.reactive({visible:!1})}createTableObject(){const t={};for(const[n,r]of this.columns.entries())for(const[a,i]of this.rows.entries())t[`${n}:${a}`]=i[r.name];return t}createDisplayObject(t){const n=[Object.assign({},{rowModified:!1})];if(t&&"0:0"in t)return t;const r=new Set;for(let a=this.rows.length-1;a>=0;a--){const i=this.rows[a];i.parent&&r.add(i.parent),n[a]={childrenOpen:!1,expanded:!1,indent:i.indent||null,isParent:r.has(a),isRoot:i.parent===null||i.parent===void 0,rowModified:!1,open:i.parent===null||i.parent===void 0,parent:i.parent}}return o.reactive(n)}get zeroColumn(){return["list","tree","list-expansion"].includes(this.config.view)}get numberedRowWidth(){return o.computed(()=>String(Math.ceil(this.rows.length/100)+1)+"ch")}cellData(t,n){return this.table[`${t}:${n}`]}setCellData(t,n,r){const a=`${n}:${t}`,i=this.columns[n];return this.table[a]!==r&&(this.display[t].rowModified=!0),this.table[a]=r,this.rows[t][i.name]=r,this.table[a]}toggleRowExpand(t){if(this.config.view==="tree"){this.display[t].childrenOpen=!this.display[t].childrenOpen;for(let n=this.rows.length-1;n>=0;n--)this.display[n].parent===t&&(this.display[n].open=!this.display[n].open,this.display[n].childrenOpen&&this.toggleRowExpand(n))}else this.config.view==="list-expansion"&&(this.display[t].expanded=!this.display[t].expanded)}}const st={key:0,id:"resizable"},ct={class:"atable-header-row",tabindex:"-1"},Z=o.defineComponent({__name:"ATableHeader",props:{columns:{},tableid:{}},setup(e){const t=o.inject(e.tableid),n=o.computed(()=>t.columns.some(a=>a.pinned)),r=a=>({minWidth:a.width||"40ch",textAlign:a.align||"center",width:t.config.fullWidth?"auto":null});return(a,i)=>a.columns.length?(o.openBlock(),o.createElementBlock("thead",st,[o.createElementVNode("tr",ct,[o.unref(t).zeroColumn?(o.openBlock(),o.createElementBlock("th",{key:0,id:"header-index",class:o.normalizeClass([[n.value?"sticky-index":"",o.unref(t).config.view==="tree"?"tree-index":"",o.unref(t).config.view==="list-expansion"?"list-expansion-index":""],"list-index"])},null,2)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.columns,(l,c)=>(o.openBlock(),o.createElementBlock("th",{key:l.name,tabindex:"-1",style:o.normalizeStyle(r(l)),class:o.normalizeClass(l.pinned?"sticky-column":"")},[o.renderSlot(a.$slots,"default",{},()=>[o.createTextVNode(o.toDisplayString(l.label||String.fromCharCode(c+97).toUpperCase()),1)])],6))),128))])])):o.createCommentVNode("",!0)}}),K=o.defineComponent({__name:"ATableModal",props:{colIndex:{},rowIndex:{},tableid:{}},setup(e){const t=n=>{n.stopPropagation()};return(n,r)=>(o.openBlock(),o.createElementBlock("div",{class:"amodal",tabindex:"-1",onClick:t,onInput:t},[o.renderSlot(n.$slots,"default")],32))}}),ye=((e,t)=>{const n=e.__vccOpts||e;for(const[r,a]of t)n[r]=a;return n})(o.defineComponent({__name:"ATable",props:{id:{},modelValue:{},columns:{},rows:{default:()=>[]},config:{default:()=>new Object}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const r=n,a=o.useTemplateRef("table"),i=e.modelValue?e.modelValue:e.rows,l=new ge(e.id,e.columns,i,e.config);o.provide(l.id,l),o.watch(()=>l.rows,s=>{r("update:modelValue",s)},{deep:!0}),o.onMounted(()=>{e.columns.some(s=>s.pinned)&&(c(),l.config.view==="tree"&&ce(a,c,{childList:!0,subtree:!0}))});const c=()=>{const s=a.value,f=s.rows[0],m=s.rows[1],d=f?Array.from(f.cells):[];for(const[u,b]of d.entries()){const y=m.cells[u];y&&(b.style.width=`${y.offsetWidth}px`)}for(const u of s.rows){let b=0;const y=[];for(const w of u.cells)(w.classList.contains("sticky-column")||w.classList.contains("sticky-index"))&&(w.style.left=`${b}px`,b+=w.offsetWidth,y.push(w));y.length>0&&y[y.length-1].classList.add("sticky-column-edge")}},p=s=>{var f;s.target instanceof Node&&(f=l.modal.parent)!=null&&f.contains(s.target)||l.modal.visible&&(l.modal.visible=!1)};return window.addEventListener("keydown",s=>{if(s.key==="Escape"&&l.modal.visible){l.modal.visible=!1;const f=l.modal.parent;f&&o.nextTick().then(()=>{f.focus()})}}),t({tableData:l}),(s,f)=>o.withDirectives((o.openBlock(),o.createElementBlock("table",{ref:"table",class:"atable",style:o.normalizeStyle({width:o.unref(l).config.fullWidth?"100%":"auto"})},[o.renderSlot(s.$slots,"header",{data:o.unref(l)},()=>[o.createVNode(Z,{columns:o.unref(l).columns,tableid:o.unref(l).id},null,8,["columns","tableid"])],!0),o.createElementVNode("tbody",null,[o.renderSlot(s.$slots,"body",{data:o.unref(l)},()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(l).rows,(m,d)=>(o.openBlock(),o.createBlock(Y,{key:m.id,row:m,rowIndex:d,tableid:o.unref(l).id},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(l).columns,(u,b)=>(o.openBlock(),o.createBlock(U,{key:u.name,tableid:o.unref(l).id,col:u,spellcheck:"false",pinned:u.pinned,rowIndex:d,colIndex:b,component:u.cellComponent,style:o.normalizeStyle({textAlign:(u==null?void 0:u.align)||"center",minWidth:(u==null?void 0:u.width)||"40ch",width:o.unref(l).config.fullWidth?"auto":null})},null,8,["tableid","col","pinned","rowIndex","colIndex","component","style"]))),128))]),_:2},1032,["row","rowIndex","tableid"]))),128))],!0)]),o.renderSlot(s.$slots,"footer",{data:o.unref(l)},void 0,!0),o.renderSlot(s.$slots,"modal",{data:o.unref(l)},()=>[o.withDirectives(o.createVNode(K,{colIndex:o.unref(l).modal.colIndex,rowIndex:o.unref(l).modal.rowIndex,tableid:o.unref(l).id,style:o.normalizeStyle({left:o.unref(l).modal.left+"px",top:o.unref(l).modal.top+"px",maxWidth:o.unref(l).modal.width+"px"})},{default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(l).modal.component),o.mergeProps({key:`${o.unref(l).modal.rowIndex}:${o.unref(l).modal.colIndex}`,colIndex:o.unref(l).modal.colIndex,rowIndex:o.unref(l).modal.rowIndex,tableid:o.unref(l).id},o.unref(l).modal.componentProps),null,16,["colIndex","rowIndex","tableid"]))]),_:1},8,["colIndex","rowIndex","tableid","style"]),[[o.vShow,o.unref(l).modal.visible]])],!0)],4)),[[o.unref(rt),p]])}}),[["__scopeId","data-v-183c4dd3"]]);function dt(e){e.component("ACell",U),e.component("AExpansionRow",de),e.component("ARow",Y),e.component("ATable",ye),e.component("ATableHeader",Z),e.component("ATableModal",K)}h.ACell=U,h.AExpansionRow=de,h.ARow=Y,h.ATable=ye,h.ATableHeader=Z,h.ATableModal=K,h.TableDataStore=ge,h.install=dt,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(C,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(C=typeof globalThis<"u"?globalThis:C||self,r(C["@stonecrop/atable"]={},C.Vue))})(this,function(C,r){"use strict";var je=document.createElement("style");je.textContent=`@import"https://fonts.googleapis.com/css2?family=Arimo:ital,wght@0,400..700;1,400..700&display=swap";.atable-cell{border-radius:0;box-sizing:border-box;margin:0;outline:none;box-shadow:none;color:var(--sc-cell-text-color);padding-left:.5ch!important;padding-right:.5ch;padding-top:var(--sc-atable-row-padding);padding-bottom:var(--sc-atable-row-padding);border-spacing:0px;border-collapse:collapse;overflow:hidden;text-overflow:ellipsis;order:1;white-space:nowrap;max-width:40ch}.atable-cell a{color:var(--sc-cell-text-color);text-decoration:none}.atable-cell:focus,.atable-cell:focus-within{background-color:var(--sc-focus-cell-background);outline-width:var(--sc-atable-cell-border-width);outline-style:solid;outline-offset:calc(var(--sc-atable-cell-border-width) * -1);outline-color:var(--sc-focus-cell-outline);box-shadow:none;overflow:hidden;text-wrap:nowrap;box-sizing:border-box}.row-index{color:var(--sc-header-text-color);font-weight:700;text-align:center;-webkit-user-select:none;user-select:none;width:2ch;display:flex;align-items:center;justify-content:center}.expandable-row{border-top:1px solid var(--sc-row-border-color);height:var(--sc-atable-row-height);border-left:4px solid var(--sc-row-border-color);display:flex}.expanded-row{border-bottom:1px solid var(--sc-row-border-color);border-top:1px solid var(--sc-row-border-color)}.expanded-row-content{border-bottom:1px solid var(--sc-row-border-color);border-top:1px solid var(--sc-row-border-color);padding:1.5rem}.table-row{border-top:1px solid var(--sc-row-border-color);display:flex;background-color:#fff}.list-index{color:var(--sc-header-text-color);font-weight:700;padding-left:var(--sc-atable-row-padding);padding-right:.5em;text-align:left;-webkit-user-select:none;user-select:none;width:7ch;text-overflow:ellipsis;overflow:hidden;box-sizing:border-box;padding-top:var(--sc-atable-row-padding);padding-bottom:var(--sc-atable-row-padding)}.tree-index{color:var(--sc-header-text-color);font-weight:700;text-align:center;-webkit-user-select:none;user-select:none;width:2ch;box-sizing:border-box;padding-top:var(--sc-atable-row-padding);padding-bottom:var(--sc-atable-row-padding)}.atable-header-row{display:flex}.atable-header-row th{padding-left:.5ch!important;font-weight:700;padding-top:var(--sc-atable-row-padding);padding-bottom:var(--sc-atable-row-padding);box-sizing:border-box;color:var(--sc-header-text-color)}#header-index{padding-left:var(--sc-atable-row-padding);box-sizing:border-box}.tree-index{padding-right:0}th{order:1}.list-expansion-index{width:2ch;margin-left:5px}:root{--sc-primary-color: #0098c9;--sc-primary-text-color: #ffffff;--sc-brand-color: #202a44;--sc-gray-5: #f2f2f2;--sc-gray-10: #e6e6e6;--sc-gray-20: #cccccc;--sc-gray-50: #808080;--sc-gray-60: #666666;--sc-gray-80: #333333;--sc-brand-danger: #e63c28;--sc-brand-success: #155724;--sc-brand-warning: #b99d3e;--sc-active-cell-background: #ffffff;--sc-active-cell-outline: #e6a92d;--sc-cell-border-color: #ffffff;--sc-cell-text-color: #3a3c41;--sc-focus-cell-background: #ffffff;--sc-focus-cell-outline: #000000;--sc-header-border-color: #ffffff;--sc-header-text-color: var(--sc-gray-20);--sc-row-border-color: var(--sc-gray-20);--sc-row-color-zebra-dark: #dddddd;--sc-row-color-zebra-light: #eeeeee;--sc-row-number-background-color: #ffffff;--sc-input-active-border-color: #000000;--sc-input-active-label-color: #000000;--sc-input-border-color: var(--sc-gray-20);--sc-input-label-color: var(--sc-gray-60);--sc-required-border: #e63c28;--sc-cell-modified: #ffffb1;--sc-form-border: var(--sc-gray-5);--sc-form-background: #ffffff;--sc-input-field-background: #ffffff;--sc-input-field-disabled-background: var(--sc-gray-5);--sc-font-size: 10px;--sc-font-family: Arimo, Arial, sans-serif;--sc-table-font-size: 16px;--sc-atable-font-family: "Arimo", sans-serif;--sc-atable-row-padding: 5px;--sc-atable-row-height: 1.5em;--sc-atable-cell-border-width: 2px;--sc-btn-border: #cccccc;--sc-btn-color: white;--sc-btn-hover: #f2f2f2;--sc-btn-label-color: black}.amodal{position:fixed;background-color:var(--sc-row-color-zebra-dark);z-index:100}.sticky-index{position:sticky;left:0;z-index:1;order:0}.sticky-column,th.sticky-column,td.sticky-column,th.sticky-index,td.sticky-index{position:sticky;z-index:1;order:0;background:#fff}.sticky-column-edge,.atable th.sticky-column-edge{border-right:1px solid var(--sc-row-border-color);border-right-width:1px}[data-v-20244978]:root{--sc-primary-color: #0098c9;--sc-primary-text-color: #ffffff;--sc-brand-color: #202a44;--sc-gray-5: #f2f2f2;--sc-gray-10: #e6e6e6;--sc-gray-20: #cccccc;--sc-gray-50: #808080;--sc-gray-60: #666666;--sc-gray-80: #333333;--sc-brand-danger: #e63c28;--sc-brand-success: #155724;--sc-brand-warning: #b99d3e;--sc-active-cell-background: #ffffff;--sc-active-cell-outline: #e6a92d;--sc-cell-border-color: #ffffff;--sc-cell-text-color: #3a3c41;--sc-focus-cell-background: #ffffff;--sc-focus-cell-outline: #000000;--sc-header-border-color: #ffffff;--sc-header-text-color: var(--sc-gray-20);--sc-row-border-color: var(--sc-gray-20);--sc-row-color-zebra-dark: #dddddd;--sc-row-color-zebra-light: #eeeeee;--sc-row-number-background-color: #ffffff;--sc-input-active-border-color: #000000;--sc-input-active-label-color: #000000;--sc-input-border-color: var(--sc-gray-20);--sc-input-label-color: var(--sc-gray-60);--sc-required-border: #e63c28;--sc-cell-modified: #ffffb1;--sc-form-border: var(--sc-gray-5);--sc-form-background: #ffffff;--sc-input-field-background: #ffffff;--sc-input-field-disabled-background: var(--sc-gray-5);--sc-font-size: 10px;--sc-font-family: Arimo, Arial, sans-serif;--sc-table-font-size: 16px;--sc-atable-font-family: "Arimo", sans-serif;--sc-atable-row-padding: 5px;--sc-atable-row-height: 1.5em;--sc-atable-cell-border-width: 2px;--sc-btn-border: #cccccc;--sc-btn-color: white;--sc-btn-hover: #f2f2f2;--sc-btn-label-color: black}.atable[data-v-20244978]{font-family:var(--sc-atable-font-family);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:var(--sc-table-font-size);border-collapse:collapse;box-sizing:border-box;table-layout:auto;width:auto}.atable th[data-v-20244978]{border-width:0px;border-style:solid;border-radius:0;padding-left:.5ch;padding-right:.5ch;padding-top:var(--sc-atable-row-padding);padding-bottom:var(--sc-atable-row-padding);color:var(--sc-gray-60);height:var(--sc-atable-row-height);font-weight:300;letter-spacing:.05rem;order:1;box-sizing:border-box}.atable th[data-v-20244978]:focus{outline:none}
|
|
2
|
+
`,document.head.appendChild(je);var Me=!1;function ne(e,t,n){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,n),n):(e[t]=n,n)}function pe(e,t){if(Array.isArray(e)){e.splice(t,1);return}delete e[t]}function Ot(){return Be().__VUE_DEVTOOLS_GLOBAL_HOOK__}function Be(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const _t=typeof Proxy=="function",It="devtools-plugin:setup",Ct="plugin:settings:set";let H,me;function At(){var e;return H!==void 0||(typeof window<"u"&&window.performance?(H=!0,me=window.performance):typeof globalThis<"u"&&(!((e=globalThis.perf_hooks)===null||e===void 0)&&e.performance)?(H=!0,me=globalThis.perf_hooks.performance):H=!1),H}function Nt(){return At()?me.now():Date.now()}class Tt{constructor(t,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=t,this.hook=n;const o={};if(t.settings)for(const s in t.settings){const l=t.settings[s];o[s]=l.defaultValue}const a=`__vue-devtools-plugin-settings__${t.id}`;let i=Object.assign({},o);try{const s=localStorage.getItem(a),l=JSON.parse(s);Object.assign(i,l)}catch{}this.fallbacks={getSettings(){return i},setSettings(s){try{localStorage.setItem(a,JSON.stringify(s))}catch{}i=s},now(){return Nt()}},n&&n.on(Ct,(s,l)=>{s===this.plugin.id&&this.fallbacks.setSettings(l)}),this.proxiedOn=new Proxy({},{get:(s,l)=>this.target?this.target.on[l]:(...c)=>{this.onQueue.push({method:l,args:c})}}),this.proxiedTarget=new Proxy({},{get:(s,l)=>this.target?this.target[l]:l==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(l)?(...c)=>(this.targetQueue.push({method:l,args:c,resolve:()=>{}}),this.fallbacks[l](...c)):(...c)=>new Promise(d=>{this.targetQueue.push({method:l,args:c,resolve:d})})})}async setRealTarget(t){this.target=t;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function ze(e,t){const n=e,o=Be(),a=Ot(),i=_t&&n.enableEarlyProxy;if(a&&(o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!i))a.emit(It,e,t);else{const s=i?new Tt(n,a):null;(o.__VUE_DEVTOOLS_PLUGINS__=o.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:t,proxy:s}),s&&t(s.proxiedTarget)}}/*!
|
|
3
|
+
* pinia v2.3.0
|
|
4
|
+
* (c) 2024 Eduardo San Martin Morote
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/let J;const q=e=>J=e,He=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();function M(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var P;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(P||(P={}));const L=typeof window<"u",Ue=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:typeof globalThis=="object"?globalThis:{HTMLElement:null};function $t(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function he(e,t,n){const o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){Ge(o.response,t,n)},o.onerror=function(){console.error("could not download file")},o.send()}function We(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function re(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{const n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(n)}}const se=typeof navigator=="object"?navigator:{userAgent:""},Fe=/Macintosh/.test(se.userAgent)&&/AppleWebKit/.test(se.userAgent)&&!/Safari/.test(se.userAgent),Ge=L?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!Fe?Pt:"msSaveOrOpenBlob"in se?Dt:Rt:()=>{};function Pt(e,t="download",n){const o=document.createElement("a");o.download=t,o.rel="noopener",typeof e=="string"?(o.href=e,o.origin!==location.origin?We(o.href)?he(e,t,n):(o.target="_blank",re(o)):re(o)):(o.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(o.href)},4e4),setTimeout(function(){re(o)},0))}function Dt(e,t="download",n){if(typeof e=="string")if(We(e))he(e,t,n);else{const o=document.createElement("a");o.href=e,o.target="_blank",setTimeout(function(){re(o)})}else navigator.msSaveOrOpenBlob($t(e,n),t)}function Rt(e,t,n,o){if(o=o||open("","_blank"),o&&(o.document.title=o.document.body.innerText="downloading..."),typeof e=="string")return he(e,t,n);const a=e.type==="application/octet-stream",i=/constructor/i.test(String(Ue.HTMLElement))||"safari"in Ue,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||a&&i||Fe)&&typeof FileReader<"u"){const l=new FileReader;l.onloadend=function(){let c=l.result;if(typeof c!="string")throw o=null,new Error("Wrong reader.result type");c=s?c:c.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=c:location.assign(c),o=null},l.readAsDataURL(e)}else{const l=URL.createObjectURL(e);o?o.location.assign(l):location.href=l,o=null,setTimeout(function(){URL.revokeObjectURL(l)},4e4)}}function O(e,t){const n="🍍 "+e;typeof __VUE_DEVTOOLS_TOAST__=="function"?__VUE_DEVTOOLS_TOAST__(n,t):t==="error"?console.error(n):t==="warn"?console.warn(n):console.log(n)}function ge(e){return"_a"in e&&"install"in e}function Je(){if(!("clipboard"in navigator))return O("Your browser doesn't support the Clipboard API","error"),!0}function qe(e){return e instanceof Error&&e.message.toLowerCase().includes("document is not focused")?(O('You need to activate the "Emulate a focused page" setting in the "Rendering" panel of devtools.',"warn"),!0):!1}async function Vt(e){if(!Je())try{await navigator.clipboard.writeText(JSON.stringify(e.state.value)),O("Global state copied to clipboard.")}catch(t){if(qe(t))return;O("Failed to serialize the state. Check the console for more details.","error"),console.error(t)}}async function Lt(e){if(!Je())try{Ye(e,JSON.parse(await navigator.clipboard.readText())),O("Global state pasted from clipboard.")}catch(t){if(qe(t))return;O("Failed to deserialize the state from clipboard. Check the console for more details.","error"),console.error(t)}}async function jt(e){try{Ge(new Blob([JSON.stringify(e.state.value)],{type:"text/plain;charset=utf-8"}),"pinia-state.json")}catch(t){O("Failed to export the state as JSON. Check the console for more details.","error"),console.error(t)}}let D;function Mt(){D||(D=document.createElement("input"),D.type="file",D.accept=".json");function e(){return new Promise((t,n)=>{D.onchange=async()=>{const o=D.files;if(!o)return t(null);const a=o.item(0);return t(a?{text:await a.text(),file:a}:null)},D.oncancel=()=>t(null),D.onerror=n,D.click()})}return e}async function Bt(e){try{const n=await Mt()();if(!n)return;const{text:o,file:a}=n;Ye(e,JSON.parse(o)),O(`Global state imported from "${a.name}".`)}catch(t){O("Failed to import the state from JSON. Check the console for more details.","error"),console.error(t)}}function Ye(e,t){for(const n in t){const o=e.state.value[n];o?Object.assign(o,t[n]):e.state.value[n]=t[n]}}function $(e){return{_custom:{display:e}}}const Qe="🍍 Pinia (root)",ae="_root";function zt(e){return ge(e)?{id:ae,label:Qe}:{id:e.$id,label:e.$id}}function Ht(e){if(ge(e)){const n=Array.from(e._s.keys()),o=e._s;return{state:n.map(i=>({editable:!0,key:i,value:e.state.value[i]})),getters:n.filter(i=>o.get(i)._getters).map(i=>{const s=o.get(i);return{editable:!1,key:i,value:s._getters.reduce((l,c)=>(l[c]=s[c],l),{})}})}}const t={state:Object.keys(e.$state).map(n=>({editable:!0,key:n,value:e.$state[n]}))};return e._getters&&e._getters.length&&(t.getters=e._getters.map(n=>({editable:!1,key:n,value:e[n]}))),e._customProperties.size&&(t.customProperties=Array.from(e._customProperties).map(n=>({editable:!0,key:n,value:e[n]}))),t}function Ut(e){return e?Array.isArray(e)?e.reduce((t,n)=>(t.keys.push(n.key),t.operations.push(n.type),t.oldValue[n.key]=n.oldValue,t.newValue[n.key]=n.newValue,t),{oldValue:{},keys:[],operations:[],newValue:{}}):{operation:$(e.type),key:$(e.key),oldValue:e.oldValue,newValue:e.newValue}:{}}function Wt(e){switch(e){case P.direct:return"mutation";case P.patchFunction:return"$patch";case P.patchObject:return"$patch";default:return"unknown"}}let U=!0;const le=[],B="pinia:mutations",I="pinia",{assign:Ft}=Object,ie=e=>"🍍 "+e;function Gt(e,t){ze({id:"dev.esm.pinia",label:"Pinia 🍍",logo:"https://pinia.vuejs.org/logo.svg",packageName:"pinia",homepage:"https://pinia.vuejs.org",componentStateTypes:le,app:e},n=>{typeof n.now!="function"&&O("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."),n.addTimelineLayer({id:B,label:"Pinia 🍍",color:15064968}),n.addInspector({id:I,label:"Pinia 🍍",icon:"storage",treeFilterPlaceholder:"Search stores",actions:[{icon:"content_copy",action:()=>{Vt(t)},tooltip:"Serialize and copy the state"},{icon:"content_paste",action:async()=>{await Lt(t),n.sendInspectorTree(I),n.sendInspectorState(I)},tooltip:"Replace the state with the content of your clipboard"},{icon:"save",action:()=>{jt(t)},tooltip:"Save the state as a JSON file"},{icon:"folder_open",action:async()=>{await Bt(t),n.sendInspectorTree(I),n.sendInspectorState(I)},tooltip:"Import the state from a JSON file"}],nodeActions:[{icon:"restore",tooltip:'Reset the state (with "$reset")',action:o=>{const a=t._s.get(o);a?typeof a.$reset!="function"?O(`Cannot reset "${o}" store because it doesn't have a "$reset" method implemented.`,"warn"):(a.$reset(),O(`Store "${o}" reset.`)):O(`Cannot reset "${o}" store because it wasn't found.`,"warn")}}]}),n.on.inspectComponent((o,a)=>{const i=o.componentInstance&&o.componentInstance.proxy;if(i&&i._pStores){const s=o.componentInstance.proxy._pStores;Object.values(s).forEach(l=>{o.instanceData.state.push({type:ie(l.$id),key:"state",editable:!0,value:l._isOptionsAPI?{_custom:{value:r.toRaw(l.$state),actions:[{icon:"restore",tooltip:"Reset the state of this store",action:()=>l.$reset()}]}}:Object.keys(l.$state).reduce((c,d)=>(c[d]=l.$state[d],c),{})}),l._getters&&l._getters.length&&o.instanceData.state.push({type:ie(l.$id),key:"getters",editable:!1,value:l._getters.reduce((c,d)=>{try{c[d]=l[d]}catch(u){c[d]=u}return c},{})})})}}),n.on.getInspectorTree(o=>{if(o.app===e&&o.inspectorId===I){let a=[t];a=a.concat(Array.from(t._s.values())),o.rootNodes=(o.filter?a.filter(i=>"$id"in i?i.$id.toLowerCase().includes(o.filter.toLowerCase()):Qe.toLowerCase().includes(o.filter.toLowerCase())):a).map(zt)}}),globalThis.$pinia=t,n.on.getInspectorState(o=>{if(o.app===e&&o.inspectorId===I){const a=o.nodeId===ae?t:t._s.get(o.nodeId);if(!a)return;a&&(o.nodeId!==ae&&(globalThis.$store=r.toRaw(a)),o.state=Ht(a))}}),n.on.editInspectorState((o,a)=>{if(o.app===e&&o.inspectorId===I){const i=o.nodeId===ae?t:t._s.get(o.nodeId);if(!i)return O(`store "${o.nodeId}" not found`,"error");const{path:s}=o;ge(i)?s.unshift("state"):(s.length!==1||!i._customProperties.has(s[0])||s[0]in i.$state)&&s.unshift("$state"),U=!1,o.set(i,s,o.state.value),U=!0}}),n.on.editComponentState(o=>{if(o.type.startsWith("🍍")){const a=o.type.replace(/^🍍\s*/,""),i=t._s.get(a);if(!i)return O(`store "${a}" not found`,"error");const{path:s}=o;if(s[0]!=="state")return O(`Invalid path for store "${a}":
|
|
7
|
+
${s}
|
|
8
|
+
Only state can be modified.`);s[0]="$state",U=!1,o.set(i,s,o.state.value),U=!0}})})}function Jt(e,t){le.includes(ie(t.$id))||le.push(ie(t.$id)),ze({id:"dev.esm.pinia",label:"Pinia 🍍",logo:"https://pinia.vuejs.org/logo.svg",packageName:"pinia",homepage:"https://pinia.vuejs.org",componentStateTypes:le,app:e,settings:{logStoreChanges:{label:"Notify about new/deleted stores",type:"boolean",defaultValue:!0}}},n=>{const o=typeof n.now=="function"?n.now.bind(n):Date.now;t.$onAction(({after:s,onError:l,name:c,args:d})=>{const u=Xe++;n.addTimelineEvent({layerId:B,event:{time:o(),title:"🛫 "+c,subtitle:"start",data:{store:$(t.$id),action:$(c),args:d},groupId:u}}),s(p=>{j=void 0,n.addTimelineEvent({layerId:B,event:{time:o(),title:"🛬 "+c,subtitle:"end",data:{store:$(t.$id),action:$(c),args:d,result:p},groupId:u}})}),l(p=>{j=void 0,n.addTimelineEvent({layerId:B,event:{time:o(),logType:"error",title:"💥 "+c,subtitle:"end",data:{store:$(t.$id),action:$(c),args:d,error:p},groupId:u}})})},!0),t._customProperties.forEach(s=>{r.watch(()=>r.unref(t[s]),(l,c)=>{n.notifyComponentUpdate(),n.sendInspectorState(I),U&&n.addTimelineEvent({layerId:B,event:{time:o(),title:"Change",subtitle:s,data:{newValue:l,oldValue:c},groupId:j}})},{deep:!0})}),t.$subscribe(({events:s,type:l},c)=>{if(n.notifyComponentUpdate(),n.sendInspectorState(I),!U)return;const d={time:o(),title:Wt(l),data:Ft({store:$(t.$id)},Ut(s)),groupId:j};l===P.patchFunction?d.subtitle="⤵️":l===P.patchObject?d.subtitle="🧩":s&&!Array.isArray(s)&&(d.subtitle=s.type),s&&(d.data["rawEvent(s)"]={_custom:{display:"DebuggerEvent",type:"object",tooltip:"raw DebuggerEvent[]",value:s}}),n.addTimelineEvent({layerId:B,event:d})},{detached:!0,flush:"sync"});const a=t._hotUpdate;t._hotUpdate=r.markRaw(s=>{a(s),n.addTimelineEvent({layerId:B,event:{time:o(),title:"🔥 "+t.$id,subtitle:"HMR update",data:{store:$(t.$id),info:$("HMR update")}}}),n.notifyComponentUpdate(),n.sendInspectorTree(I),n.sendInspectorState(I)});const{$dispose:i}=t;t.$dispose=()=>{i(),n.notifyComponentUpdate(),n.sendInspectorTree(I),n.sendInspectorState(I),n.getSettings().logStoreChanges&&O(`Disposed "${t.$id}" store 🗑`)},n.notifyComponentUpdate(),n.sendInspectorTree(I),n.sendInspectorState(I),n.getSettings().logStoreChanges&&O(`"${t.$id}" store installed 🆕`)})}let Xe=0,j;function Ze(e,t,n){const o=t.reduce((a,i)=>(a[i]=r.toRaw(e)[i],a),{});for(const a in o)e[a]=function(){const i=Xe,s=n?new Proxy(e,{get(...c){return j=i,Reflect.get(...c)},set(...c){return j=i,Reflect.set(...c)}}):e;j=i;const l=o[a].apply(s,arguments);return j=void 0,l}}function qt({app:e,store:t,options:n}){if(!t.$id.startsWith("__hot:")){if(t._isOptionsAPI=!!n.state,!t._p._testing){Ze(t,Object.keys(n.actions),t._isOptionsAPI);const o=t._hotUpdate;r.toRaw(t)._hotUpdate=function(a){o.apply(this,arguments),Ze(t,Object.keys(a._hmrPayload.actions),!!t._isOptionsAPI)}}Jt(e,t)}}function Yt(){const e=r.effectScope(!0),t=e.run(()=>r.ref({}));let n=[],o=[];const a=r.markRaw({install(i){q(a),a._a=i,i.provide(He,a),i.config.globalProperties.$pinia=a,process.env.NODE_ENV!=="production"&&process.env.NODE_ENV!=="test"&&L&&Gt(i,a),o.forEach(s=>n.push(s)),o=[]},use(i){return!this._a&&!Me?o.push(i):n.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return process.env.NODE_ENV!=="production"&&process.env.NODE_ENV!=="test"&&L&&typeof Proxy<"u"&&a.use(qt),a}function Ke(e,t){for(const n in t){const o=t[n];if(!(n in e))continue;const a=e[n];M(a)&&M(o)&&!r.isRef(o)&&!r.isReactive(o)?e[n]=Ke(a,o):e[n]=o}return e}const et=()=>{};function tt(e,t,n,o=et){e.push(t);const a=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),o())};return!n&&r.getCurrentScope()&&r.onScopeDispose(a),a}function W(e,...t){e.slice().forEach(n=>{n(...t)})}const Qt=e=>e(),ot=Symbol(),be=Symbol();function we(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,o)=>e.set(o,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const o=t[n],a=e[n];M(a)&&M(o)&&e.hasOwnProperty(n)&&!r.isRef(o)&&!r.isReactive(o)?e[n]=we(a,o):e[n]=o}return e}const Xt=process.env.NODE_ENV!=="production"?Symbol("pinia:skipHydration"):Symbol();function Zt(e){return!M(e)||!e.hasOwnProperty(Xt)}const{assign:N}=Object;function nt(e){return!!(r.isRef(e)&&e.effect)}function rt(e,t,n,o){const{state:a,actions:i,getters:s}=t,l=n.state.value[e];let c;function d(){!l&&(process.env.NODE_ENV==="production"||!o)&&(n.state.value[e]=a?a():{});const u=process.env.NODE_ENV!=="production"&&o?r.toRefs(r.ref(a?a():{}).value):r.toRefs(n.state.value[e]);return N(u,i,Object.keys(s||{}).reduce((p,f)=>(process.env.NODE_ENV!=="production"&&f in u&&console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${f}" in store "${e}".`),p[f]=r.markRaw(r.computed(()=>{q(n);const h=n._s.get(e);return s[f].call(h,h)})),p),{}))}return c=ye(e,d,t,n,o,!0),c}function ye(e,t,n={},o,a,i){let s;const l=N({actions:{}},n);if(process.env.NODE_ENV!=="production"&&!o._e.active)throw new Error("Pinia destroyed");const c={deep:!0};process.env.NODE_ENV!=="production"&&!Me&&(c.onTrigger=g=>{d?h=g:d==!1&&!y._hotUpdating&&(Array.isArray(h)?h.push(g):console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."))});let d,u,p=[],f=[],h;const b=o.state.value[e];!i&&!b&&(process.env.NODE_ENV==="production"||!a)&&(o.state.value[e]={});const S=r.ref({});let k;function x(g){let m;d=u=!1,process.env.NODE_ENV!=="production"&&(h=[]),typeof g=="function"?(g(o.state.value[e]),m={type:P.patchFunction,storeId:e,events:h}):(we(o.state.value[e],g),m={type:P.patchObject,payload:g,storeId:e,events:h});const E=k=Symbol();r.nextTick().then(()=>{k===E&&(d=!0)}),u=!0,W(p,m,o.state.value[e])}const A=i?function(){const{state:m}=n,E=m?m():{};this.$patch(_=>{N(_,E)})}:process.env.NODE_ENV!=="production"?()=>{throw new Error(`🍍: Store "${e}" is built using the setup syntax and does not implement $reset().`)}:et;function ue(){s.stop(),p=[],f=[],o._s.delete(e)}const te=(g,m="")=>{if(ot in g)return g[be]=m,g;const E=function(){q(o);const _=Array.from(arguments),G=[],Le=[];function Go(T){G.push(T)}function Jo(T){Le.push(T)}W(f,{args:_,name:E[be],store:y,after:Go,onError:Jo});let oe;try{oe=g.apply(this&&this.$id===e?this:y,_)}catch(T){throw W(Le,T),T}return oe instanceof Promise?oe.then(T=>(W(G,T),T)).catch(T=>(W(Le,T),Promise.reject(T))):(W(G,oe),oe)};return E[ot]=!0,E[be]=m,E},z=r.markRaw({actions:{},getters:{},state:[],hotState:S}),Ve={_p:o,$id:e,$onAction:tt.bind(null,f),$patch:x,$reset:A,$subscribe(g,m={}){const E=tt(p,g,m.detached,()=>_()),_=s.run(()=>r.watch(()=>o.state.value[e],G=>{(m.flush==="sync"?u:d)&&g({storeId:e,type:P.direct,events:h},G)},N({},c,m)));return E},$dispose:ue},y=r.reactive(process.env.NODE_ENV!=="production"||process.env.NODE_ENV!=="production"&&process.env.NODE_ENV!=="test"&&L?N({_hmrPayload:z,_customProperties:r.markRaw(new Set)},Ve):Ve);o._s.set(e,y);const v=(o._a&&o._a.runWithContext||Qt)(()=>o._e.run(()=>(s=r.effectScope()).run(()=>t({action:te}))));for(const g in v){const m=v[g];if(r.isRef(m)&&!nt(m)||r.isReactive(m))process.env.NODE_ENV!=="production"&&a?ne(S.value,g,r.toRef(v,g)):i||(b&&Zt(m)&&(r.isRef(m)?m.value=b[g]:we(m,b[g])),o.state.value[e][g]=m),process.env.NODE_ENV!=="production"&&z.state.push(g);else if(typeof m=="function"){const E=process.env.NODE_ENV!=="production"&&a?m:te(m,g);v[g]=E,process.env.NODE_ENV!=="production"&&(z.actions[g]=m),l.actions[g]=m}else process.env.NODE_ENV!=="production"&&nt(m)&&(z.getters[g]=i?n.getters[g]:m,L&&(v._getters||(v._getters=r.markRaw([]))).push(g))}if(N(y,v),N(r.toRaw(y),v),Object.defineProperty(y,"$state",{get:()=>process.env.NODE_ENV!=="production"&&a?S.value:o.state.value[e],set:g=>{if(process.env.NODE_ENV!=="production"&&a)throw new Error("cannot set hotState");x(m=>{N(m,g)})}}),process.env.NODE_ENV!=="production"&&(y._hotUpdate=r.markRaw(g=>{y._hotUpdating=!0,g._hmrPayload.state.forEach(m=>{if(m in y.$state){const E=g.$state[m],_=y.$state[m];typeof E=="object"&&M(E)&&M(_)?Ke(E,_):g.$state[m]=_}ne(y,m,r.toRef(g.$state,m))}),Object.keys(y.$state).forEach(m=>{m in g.$state||pe(y,m)}),d=!1,u=!1,o.state.value[e]=r.toRef(g._hmrPayload,"hotState"),u=!0,r.nextTick().then(()=>{d=!0});for(const m in g._hmrPayload.actions){const E=g[m];ne(y,m,te(E,m))}for(const m in g._hmrPayload.getters){const E=g._hmrPayload.getters[m],_=i?r.computed(()=>(q(o),E.call(y,y))):E;ne(y,m,_)}Object.keys(y._hmrPayload.getters).forEach(m=>{m in g._hmrPayload.getters||pe(y,m)}),Object.keys(y._hmrPayload.actions).forEach(m=>{m in g._hmrPayload.actions||pe(y,m)}),y._hmrPayload=g._hmrPayload,y._getters=g._getters,y._hotUpdating=!1})),process.env.NODE_ENV!=="production"&&process.env.NODE_ENV!=="test"&&L){const g={writable:!0,configurable:!0,enumerable:!1};["_p","_hmrPayload","_getters","_customProperties"].forEach(m=>{Object.defineProperty(y,m,N({value:y[m]},g))})}return o._p.forEach(g=>{if(process.env.NODE_ENV!=="production"&&process.env.NODE_ENV!=="test"&&L){const m=s.run(()=>g({store:y,app:o._a,pinia:o,options:l}));Object.keys(m||{}).forEach(E=>y._customProperties.add(E)),N(y,m)}else N(y,s.run(()=>g({store:y,app:o._a,pinia:o,options:l})))}),process.env.NODE_ENV!=="production"&&y.$state&&typeof y.$state=="object"&&typeof y.$state.constructor=="function"&&!y.$state.constructor.toString().includes("[native code]")&&console.warn(`[🍍]: The "state" must be a plain object. It cannot be
|
|
9
|
+
state: () => new MyClass()
|
|
10
|
+
Found in store "${y.$id}".`),b&&i&&n.hydrate&&n.hydrate(y.$state,b),d=!0,u=!0,y}/*! #__NO_SIDE_EFFECTS__ */function Kt(e,t,n){let o,a;const i=typeof t=="function";if(typeof e=="string")o=e,a=i?n:t;else if(a=e,o=e.id,process.env.NODE_ENV!=="production"&&typeof o!="string")throw new Error('[🍍]: "defineStore()" must be passed a store id as its first argument.');function s(l,c){const d=r.hasInjectionContext();if(l=(process.env.NODE_ENV==="test"&&J&&J._testing?null:l)||(d?r.inject(He,null):null),l&&q(l),process.env.NODE_ENV!=="production"&&!J)throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
|
|
11
|
+
See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
|
|
12
|
+
This will fail in production.`);l=J,l._s.has(o)||(i?ye(o,t,a,l):rt(o,a,l),process.env.NODE_ENV!=="production"&&(s._pinia=l));const u=l._s.get(o);if(process.env.NODE_ENV!=="production"&&c){const p="__hot:"+o,f=i?ye(p,t,a,l,!0):rt(p,N({},a),l,!0);c._hotUpdate(f),delete l.state.value[p],l._s.delete(p)}if(process.env.NODE_ENV!=="production"&&L){const p=r.getCurrentInstance();if(p&&p.proxy&&!c){const f=p.proxy,h="_pStores"in f?f._pStores:f._pStores={};h[o]=u}}return u}return s.$id=o,s}function st(e){return r.getCurrentScope()?(r.onScopeDispose(e),!0):!1}function Ee(e){return typeof e=="function"?e():r.unref(e)}const eo=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const to=e=>e!=null,oo=Object.prototype.toString,no=e=>oo.call(e)==="[object Object]",ro=()=>{},Y=eo?window:void 0;function Q(e){var t;const n=Ee(e);return(t=n==null?void 0:n.$el)!=null?t:n}function X(...e){let t,n,o,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,a]=e,t=Y):[t,n,o,a]=e,!t)return ro;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const i=[],s=()=>{i.forEach(u=>u()),i.length=0},l=(u,p,f,h)=>(u.addEventListener(p,f,h),()=>u.removeEventListener(p,f,h)),c=r.watch(()=>[Q(t),Ee(a)],([u,p])=>{if(s(),!u)return;const f=no(p)?{...p}:p;i.push(...n.flatMap(h=>o.map(b=>l(u,h,b,f))))},{immediate:!0,flush:"post"}),d=()=>{c(),s()};return st(d),d}function so(){const e=r.ref(!1),t=r.getCurrentInstance();return t&&r.onMounted(()=>{e.value=!0},t),e}function ao(e){const t=so();return r.computed(()=>(t.value,!!e()))}function lo(e,t,n={}){const{window:o=Y,...a}=n;let i;const s=ao(()=>o&&"MutationObserver"in o),l=()=>{i&&(i.disconnect(),i=void 0)},c=r.computed(()=>{const f=Ee(e),h=(Array.isArray(f)?f:[f]).map(Q).filter(to);return new Set(h)}),d=r.watch(()=>c.value,f=>{l(),s.value&&f.size&&(i=new MutationObserver(t),f.forEach(h=>i.observe(h,a)))},{immediate:!0,flush:"post"}),u=()=>i==null?void 0:i.takeRecords(),p=()=>{d(),l()};return st(p),{isSupported:s,stop:p,takeRecords:u}}function io(e={}){var t;const{window:n=Y,deep:o=!0,triggerOnRemoval:a=!1}=e,i=(t=e.document)!=null?t:n==null?void 0:n.document,s=()=>{var d;let u=i==null?void 0:i.activeElement;if(o)for(;u!=null&&u.shadowRoot;)u=(d=u==null?void 0:u.shadowRoot)==null?void 0:d.activeElement;return u},l=r.ref(),c=()=>{l.value=s()};return n&&(X(n,"blur",d=>{d.relatedTarget===null&&c()},!0),X(n,"focus",c,!0)),a&&lo(i,d=>{d.filter(u=>u.removedNodes.length).map(u=>Array.from(u.removedNodes)).flat().forEach(u=>{u===l.value&&c()})},{childList:!0,subtree:!0}),c(),l}const co="focusin",fo="focusout";function uo(e,t={}){const{window:n=Y}=t,o=r.computed(()=>Q(e)),a=r.ref(!1),i=r.computed(()=>a.value),s=io(t);return!n||!s.value?{focused:i}:(X(o,co,()=>a.value=!0),X(o,fo,()=>a.value=!1),{focused:i})}function po(e,{window:t=Y,scrollTarget:n}={}){const o=r.ref(!1),a=()=>{if(!t)return;const i=t.document,s=Q(e);if(!s)o.value=!1;else{const l=s.getBoundingClientRect();o.value=l.top<=(t.innerHeight||i.documentElement.clientHeight)&&l.left<=(t.innerWidth||i.documentElement.clientWidth)&&l.bottom>=0&&l.right>=0}};return r.watch(()=>Q(e),()=>a(),{immediate:!0,flush:"post"}),t&&X(n||t,"scroll",a,{capture:!1,passive:!0}),o}const R=e=>{let t=po(e).value;return t=t&&e.offsetHeight>0,t},V=e=>e.tabIndex>=0,at=e=>{const t=e.target;return ve(t)},ve=e=>{var t;let n;if(e instanceof HTMLTableCellElement){const o=(t=e.parentElement)==null?void 0:t.previousElementSibling;if(o){const a=Array.from(o.children)[e.cellIndex];a&&(n=a)}}else if(e instanceof HTMLTableRowElement){const o=e.previousElementSibling;o&&(n=o)}return n&&(!V(n)||!R(n))?ve(n):n},mo=e=>{var t;const n=e.target;let o;if(n instanceof HTMLTableCellElement){const a=(t=n.parentElement)==null?void 0:t.parentElement;if(a){const i=a.firstElementChild.children[n.cellIndex];i&&(o=i)}}else if(n instanceof HTMLTableRowElement){const a=n.parentElement;if(a){const i=a.firstElementChild;i&&(o=i)}}return o&&(!V(o)||!R(o))?xe(o):o},lt=e=>{const t=e.target;return xe(t)},xe=e=>{var t;let n;if(e instanceof HTMLTableCellElement){const o=(t=e.parentElement)==null?void 0:t.nextElementSibling;if(o){const a=Array.from(o.children)[e.cellIndex];a&&(n=a)}}else if(e instanceof HTMLTableRowElement){const o=e.nextElementSibling;o&&(n=o)}return n&&(!V(n)||!R(n))?xe(n):n},ho=e=>{var t;const n=e.target;let o;if(n instanceof HTMLTableCellElement){const a=(t=n.parentElement)==null?void 0:t.parentElement;if(a){const i=a.lastElementChild.children[n.cellIndex];i&&(o=i)}}else if(n instanceof HTMLTableRowElement){const a=n.parentElement;if(a){const i=a.lastElementChild;i&&(o=i)}}return o&&(!V(o)||!R(o))?ve(o):o},it=e=>{const t=e.target;return ke(t)},ke=e=>{var t;let n;if(e.previousElementSibling)n=e.previousElementSibling;else{const o=(t=e.parentElement)==null?void 0:t.previousElementSibling;n=o==null?void 0:o.lastElementChild}return n&&(!V(n)||!R(n))?ke(n):n},ct=e=>{const t=e.target;return Se(t)},Se=e=>{var t;let n;if(e.nextElementSibling)n=e.nextElementSibling;else{const o=(t=e.parentElement)==null?void 0:t.nextElementSibling;n=o==null?void 0:o.firstElementChild}return n&&(!V(n)||!R(n))?Se(n):n},dt=e=>{const t=e.target.parentElement.firstElementChild;return t&&(!V(t)||!R(t))?Se(t):t},ft=e=>{const t=e.target.parentElement.lastElementChild;return t&&(!V(t)||!R(t))?ke(t):t},ce=["alt","control","shift","meta"],go={ArrowUp:"up",ArrowDown:"down",ArrowLeft:"left",ArrowRight:"right"},Oe={"keydown.up":e=>{const t=at(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.down":e=>{const t=lt(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.left":e=>{const t=it(e);e.preventDefault(),e.stopPropagation(),t&&t.focus()},"keydown.right":e=>{const t=ct(e);e.preventDefault(),e.stopPropagation(),t&&t.focus()},"keydown.control.up":e=>{const t=mo(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.control.down":e=>{const t=ho(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.control.left":e=>{const t=dt(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.control.right":e=>{const t=ft(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.end":e=>{const t=ft(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.enter":e=>{if(e.target instanceof HTMLTableCellElement){e.preventDefault(),e.stopPropagation();const t=lt(e);t&&t.focus()}},"keydown.shift.enter":e=>{if(e.target instanceof HTMLTableCellElement){e.preventDefault(),e.stopPropagation();const t=at(e);t&&t.focus()}},"keydown.home":e=>{const t=dt(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.tab":e=>{const t=ct(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.shift.tab":e=>{const t=it(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())}};function _e(e){const t=s=>{let l=null;return s.parent&&(typeof s.parent=="string"?l=document.querySelector(s.parent):s.parent instanceof HTMLElement?l=s.parent:l=s.parent.value),l},n=s=>{const l=t(s);let c=[];if(typeof s.selectors=="string")c=l?Array.from(l.querySelectorAll(s.selectors)):Array.from(document.querySelectorAll(s.selectors));else if(Array.isArray(s.selectors))for(const d of s.selectors)d instanceof HTMLElement?c.push(d):c.push(d.$el);else if(s.selectors instanceof HTMLElement)c.push(s.selectors);else if(Array.isArray(s.selectors.value))for(const d of s.selectors.value)d instanceof HTMLElement?c.push(d):c.push(d.$el);else c.push(s.selectors.value);return c},o=s=>{const l=t(s);let c=[];return s.selectors?c=n(s):l&&(c=Array.from(l.children).filter(d=>V(d)&&R(d))),c},a=s=>l=>{const c=go[l.key]||l.key.toLowerCase();if(ce.includes(c))return;const d=s.handlers||Oe;for(const u of Object.keys(d)){const[p,...f]=u.split(".");if(p==="keydown"&&f.includes(c)){const h=d[u],b=f.filter(k=>ce.includes(k)),S=ce.some(k=>{const x=k.charAt(0).toUpperCase()+k.slice(1);return l.getModifierState(x)});if(b.length>0){if(S){for(const k of ce)if(f.includes(k)){const x=k.charAt(0).toUpperCase()+k.slice(1);l.getModifierState(x)&&h(l)}}}else S||h(l)}}},i=[];r.onMounted(()=>{for(const s of e){const l=t(s),c=o(s),d=a(s),u=l?[l]:c;for(const p of u){const{focused:f}=uo(r.ref(p)),h=r.watch(f,b=>{b?p.addEventListener("keydown",d):p.removeEventListener("keydown",d)});i.push(h)}}}),r.onBeforeUnmount(()=>{for(const s of i)s()})}function ut(e){return r.getCurrentScope()?(r.onScopeDispose(e),!0):!1}function Z(e){return typeof e=="function"?e():r.unref(e)}const pt=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const bo=Object.prototype.toString,wo=e=>bo.call(e)==="[object Object]",K=()=>{},Ie=yo();function yo(){var e,t;return pt&&((e=window==null?void 0:window.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window==null?void 0:window.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}const mt={mounted:"mounted",updated:"updated",unmounted:"unmounted"};function Eo(...e){if(e.length!==1)return r.toRef(...e);const t=e[0];return typeof t=="function"?r.readonly(r.customRef(()=>({get:t,set:K}))):r.ref(t)}function ee(e){var t;const n=Z(e);return(t=n==null?void 0:n.$el)!=null?t:n}const ht=pt?window:void 0;function de(...e){let t,n,o,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,a]=e,t=ht):[t,n,o,a]=e,!t)return K;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const i=[],s=()=>{i.forEach(u=>u()),i.length=0},l=(u,p,f,h)=>(u.addEventListener(p,f,h),()=>u.removeEventListener(p,f,h)),c=r.watch(()=>[ee(t),Z(a)],([u,p])=>{if(s(),!u)return;const f=wo(p)?{...p}:p;i.push(...n.flatMap(h=>o.map(b=>l(u,h,b,f))))},{immediate:!0,flush:"post"}),d=()=>{c(),s()};return ut(d),d}let gt=!1;function bt(e,t,n={}){const{window:o=ht,ignore:a=[],capture:i=!0,detectIframe:s=!1}=n;if(!o)return K;Ie&&!gt&&(gt=!0,Array.from(o.document.body.children).forEach(f=>f.addEventListener("click",K)),o.document.documentElement.addEventListener("click",K));let l=!0;const c=f=>a.some(h=>{if(typeof h=="string")return Array.from(o.document.querySelectorAll(h)).some(b=>b===f.target||f.composedPath().includes(b));{const b=ee(h);return b&&(f.target===b||f.composedPath().includes(b))}}),u=[de(o,"click",f=>{const h=ee(e);if(!(!h||h===f.target||f.composedPath().includes(h))){if(f.detail===0&&(l=!c(f)),!l){l=!0;return}t(f)}},{passive:!0,capture:i}),de(o,"pointerdown",f=>{const h=ee(e);l=!c(f)&&!!(h&&!f.composedPath().includes(h))},{passive:!0}),s&&de(o,"blur",f=>{setTimeout(()=>{var h;const b=ee(e);((h=o.document.activeElement)==null?void 0:h.tagName)==="IFRAME"&&!(b!=null&&b.contains(o.document.activeElement))&&t(f)},0)})].filter(Boolean);return()=>u.forEach(f=>f())}const vo={[mt.mounted](e,t){const n=!t.modifiers.bubble;if(typeof t.value=="function")e.__onClickOutside_stop=bt(e,t.value,{capture:n});else{const[o,a]=t.value;e.__onClickOutside_stop=bt(e,o,Object.assign({capture:n},a))}},[mt.unmounted](e){e.__onClickOutside_stop()}};function Ce(e){return typeof Window<"u"&&e instanceof Window?e.document.documentElement:typeof Document<"u"&&e instanceof Document?e.documentElement:e}function wt(e){const t=window.getComputedStyle(e);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&e.clientWidth<e.scrollWidth||t.overflowY==="auto"&&e.clientHeight<e.scrollHeight)return!0;{const n=e.parentNode;return!n||n.tagName==="BODY"?!1:wt(n)}}function xo(e){const t=e||window.event,n=t.target;return wt(n)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}const Ae=new WeakMap;function ko(e,t=!1){const n=r.ref(t);let o=null,a="";r.watch(Eo(e),l=>{const c=Ce(Z(l));if(c){const d=c;if(Ae.get(d)||Ae.set(d,d.style.overflow),d.style.overflow!=="hidden"&&(a=d.style.overflow),d.style.overflow==="hidden")return n.value=!0;if(n.value)return d.style.overflow="hidden"}},{immediate:!0});const i=()=>{const l=Ce(Z(e));!l||n.value||(Ie&&(o=de(l,"touchmove",c=>{xo(c)},{passive:!1})),l.style.overflow="hidden",n.value=!0)},s=()=>{const l=Ce(Z(e));!l||!n.value||(Ie&&(o==null||o()),l.style.overflow=a,Ae.delete(l),n.value=!1)};return ut(s),r.computed({get(){return n.value},set(l){l?i():s()}})}function So(){let e=!1;const t=r.ref(!1);return(n,o)=>{if(t.value=o.value,e)return;e=!0;const a=ko(n,o.value);r.watch(t,i=>a.value=i)}}So();function Ne(e){return r.getCurrentScope()?(r.onScopeDispose(e),!0):!1}function fe(e){return typeof e=="function"?e():r.unref(e)}const Oo=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const _o=e=>e!=null,Io=Object.prototype.toString,Co=e=>Io.call(e)==="[object Object]",Ao=()=>{};function No(e){return r.getCurrentInstance()}function To(e,t=!0,n){No()?r.onMounted(e,n):t?e():r.nextTick(e)}const Te=Oo?window:void 0;function F(e){var t;const n=fe(e);return(t=n==null?void 0:n.$el)!=null?t:n}function yt(...e){let t,n,o,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,a]=e,t=Te):[t,n,o,a]=e,!t)return Ao;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const i=[],s=()=>{i.forEach(u=>u()),i.length=0},l=(u,p,f,h)=>(u.addEventListener(p,f,h),()=>u.removeEventListener(p,f,h)),c=r.watch(()=>[F(t),fe(a)],([u,p])=>{if(s(),!u)return;const f=Co(p)?{...p}:p;i.push(...n.flatMap(h=>o.map(b=>l(u,h,b,f))))},{immediate:!0,flush:"post"}),d=()=>{c(),s()};return Ne(d),d}function $o(){const e=r.ref(!1),t=r.getCurrentInstance();return t&&r.onMounted(()=>{e.value=!0},t),e}function Et(e){const t=$o();return r.computed(()=>(t.value,!!e()))}function vt(e,t,n={}){const{window:o=Te,...a}=n;let i;const s=Et(()=>o&&"MutationObserver"in o),l=()=>{i&&(i.disconnect(),i=void 0)},c=r.computed(()=>{const f=fe(e),h=(Array.isArray(f)?f:[f]).map(F).filter(_o);return new Set(h)}),d=r.watch(()=>c.value,f=>{l(),s.value&&f.size&&(i=new MutationObserver(t),f.forEach(h=>i.observe(h,a)))},{immediate:!0,flush:"post"}),u=()=>i==null?void 0:i.takeRecords(),p=()=>{d(),l()};return Ne(p),{isSupported:s,stop:p,takeRecords:u}}function Po(e,t,n={}){const{window:o=Te,...a}=n;let i;const s=Et(()=>o&&"ResizeObserver"in o),l=()=>{i&&(i.disconnect(),i=void 0)},c=r.computed(()=>{const p=fe(e);return Array.isArray(p)?p.map(f=>F(f)):[F(p)]}),d=r.watch(c,p=>{if(l(),s.value&&o){i=new ResizeObserver(t);for(const f of p)f&&i.observe(f,a)}},{immediate:!0,flush:"post"}),u=()=>{l(),d()};return Ne(u),{isSupported:s,stop:u}}function Do(e,t={}){const{reset:n=!0,windowResize:o=!0,windowScroll:a=!0,immediate:i=!0,updateTiming:s="sync"}=t,l=r.ref(0),c=r.ref(0),d=r.ref(0),u=r.ref(0),p=r.ref(0),f=r.ref(0),h=r.ref(0),b=r.ref(0);function S(){const x=F(e);if(!x){n&&(l.value=0,c.value=0,d.value=0,u.value=0,p.value=0,f.value=0,h.value=0,b.value=0);return}const A=x.getBoundingClientRect();l.value=A.height,c.value=A.bottom,d.value=A.left,u.value=A.right,p.value=A.top,f.value=A.width,h.value=A.x,b.value=A.y}function k(){s==="sync"?S():s==="next-frame"&&requestAnimationFrame(()=>S())}return Po(e,k),r.watch(()=>F(e),x=>!x&&k()),vt(e,k,{attributeFilter:["style","class"]}),a&&yt("scroll",k,{capture:!0,passive:!0}),o&&yt("resize",k,{passive:!0}),To(()=>{i&&k()}),{height:l,bottom:c,left:d,right:u,top:p,width:f,x:h,y:b,update:k}}const Ro=e=>{const t=new DOMParser().parseFromString(e,"text/html");return Array.from(t.body.childNodes).some(n=>n.nodeType===1)},Vo=["data-colindex","data-rowindex","data-editable","contenteditable","tabindex"],Lo=["innerHTML"],jo={key:2},$e=r.defineComponent({__name:"ACell",props:{colIndex:{},rowIndex:{},store:{},addNavigation:{type:[Boolean,Object],default:!0},tabIndex:{default:0},pinned:{type:Boolean}},setup(e){const t=r.useTemplateRef("cell"),{bottom:n,left:o}=Do(t),a=e.store.getCellData(e.colIndex,e.rowIndex),i=e.store.getCellDisplayValue(e.colIndex,e.rowIndex),s=r.ref(""),l=r.ref(!1),c=e.store.columns[e.colIndex],d=e.store.rows[e.rowIndex],u=c.align||"center",p=c.width||"40ch",f=r.computed(()=>typeof i=="string"?Ro(i):!1),h=r.computed(()=>{var x;return{textAlign:u,width:p,backgroundColor:l.value?"var(--sc-cell-modified)":"inherit",fontWeight:l.value?"bold":"inherit",paddingLeft:e.store.getIndent(e.colIndex,(x=e.store.display[e.rowIndex])==null?void 0:x.indent)}}),b=()=>{c.mask,c.modalComponent&&e.store.$patch(x=>{x.modal.visible=!0,x.modal.colIndex=e.colIndex,x.modal.rowIndex=e.rowIndex,x.modal.parent=t.value,x.modal.top=n.value,x.modal.left=o.value,x.modal.width=p,typeof c.modalComponent=="function"?x.modal.component=c.modalComponent({table:x.table,row:d,column:c}):x.modal.component=c.modalComponent,x.modal.componentProps=c.modalComponentExtraProps})};if(e.addNavigation){let x={...Oe,"keydown.f2":b,"keydown.alt.up":b,"keydown.alt.down":b,"keydown.alt.left":b,"keydown.alt.right":b};typeof e.addNavigation=="object"&&(x={...x,...e.addNavigation}),_e([{selectors:t,handlers:x}])}const S=()=>{t.value&&(s.value=t.value.textContent)},k=()=>{t.value&&(c.format?l.value=t.value.textContent!==e.store.getFormattedValue(e.colIndex,e.rowIndex,a):l.value=t.value.textContent!==a,t.value.textContent!==s.value&&(s.value=t.value.textContent,t.value.dispatchEvent(new Event("change")),c.format||e.store.setCellData(e.colIndex,e.rowIndex,s.value)))};return(x,A)=>r.withDirectives((r.openBlock(),r.createElementBlock("td",{ref:"cell","data-colindex":x.colIndex,"data-rowindex":x.rowIndex,"data-editable":r.unref(c).edit,contenteditable:r.unref(c).edit,tabindex:x.tabIndex,spellcheck:!1,style:r.normalizeStyle(h.value),onFocus:S,onPaste:k,onBlur:k,onInput:k,onClick:b,class:r.normalizeClass(["atable-cell",x.pinned?"sticky-column":""])},[r.unref(c).cellComponent?(r.openBlock(),r.createBlock(r.resolveDynamicComponent(r.unref(c).cellComponent),r.mergeProps({key:0,value:r.unref(i)},r.unref(c).cellComponentProps),null,16,["value"])):f.value?(r.openBlock(),r.createElementBlock("span",{key:1,innerHTML:r.unref(i)},null,8,Lo)):(r.openBlock(),r.createElementBlock("span",jo,r.toDisplayString(r.unref(i)),1))],46,Vo)),[[r.unref(vo),x.store.closeModal]])}}),Mo=["tabindex"],Bo=["tabindex"],zo=["colspan"],xt=r.defineComponent({__name:"AExpansionRow",props:{rowIndex:{},store:{},tabIndex:{default:()=>-1},addNavigation:{type:[Boolean,Object]}},setup(e){const t=r.useTemplateRef("rowEl"),n=r.computed(()=>e.store.display[e.rowIndex].expanded?"▼":"►");if(e.addNavigation){const o={"keydown.control.g":a=>{a.stopPropagation(),a.preventDefault(),e.store.toggleRowExpand(e.rowIndex)}};typeof e.addNavigation=="object"&&Object.assign(o,e.addNavigation),_e([{selectors:t,handlers:o}])}return(o,a)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("tr",r.mergeProps(o.$attrs,{ref:"rowEl",tabindex:o.tabIndex,class:"expandable-row"}),[r.createElementVNode("td",{tabIndex:-1,onClick:a[0]||(a[0]=i=>o.store.toggleRowExpand(o.rowIndex)),class:"row-index"},r.toDisplayString(n.value),1),r.renderSlot(o.$slots,"row")],16,Mo),o.store.display[o.rowIndex].expanded?(r.openBlock(),r.createElementBlock("tr",{key:0,ref:"rowExpanded",tabindex:o.tabIndex,class:"expanded-row"},[r.createElementVNode("td",{tabIndex:-1,colspan:o.store.columns.length+1,class:"expanded-row-content"},[r.renderSlot(o.$slots,"content")],8,zo)],8,Bo)):r.createCommentVNode("",!0)],64))}}),Ho=["tabindex"],Pe=r.defineComponent({__name:"ARow",props:{rowIndex:{},store:{},tabIndex:{default:()=>-1},addNavigation:{type:[Boolean,Object],default:!1}},setup(e){const t=r.useTemplateRef("rowEl"),n=e.store.isRowVisible(e.rowIndex),o=e.store.getRowExpandSymbol(e.rowIndex);if(e.addNavigation){let a=Oe;typeof e.addNavigation=="object"&&(a={...a,...e.addNavigation}),_e([{selectors:t,handlers:a}])}return(a,i)=>r.withDirectives((r.openBlock(),r.createElementBlock("tr",{ref:"rowEl",tabindex:a.tabIndex,class:"table-row"},[a.store.config.view!=="uncounted"?r.renderSlot(a.$slots,"index",{key:0},()=>[a.store.config.view==="list"?(r.openBlock(),r.createElementBlock("td",{key:0,tabIndex:-1,class:r.normalizeClass(["list-index",a.store.hasPinnedColumns?"sticky-index":""])},r.toDisplayString(a.rowIndex+1),3)):a.store.config.view==="tree"?(r.openBlock(),r.createElementBlock("td",{key:1,tabIndex:-1,class:r.normalizeClass(["tree-index",a.store.hasPinnedColumns?"sticky-index":""]),onClick:i[0]||(i[0]=s=>a.store.toggleRowExpand(a.rowIndex))},r.toDisplayString(r.unref(o)),3)):r.createCommentVNode("",!0)]):r.createCommentVNode("",!0),r.renderSlot(a.$slots,"default")],8,Ho)),[[r.vShow,r.unref(n)]])}}),Uo={key:0,id:"resizable"},Wo={class:"atable-header-row",tabindex:"-1"},De=r.defineComponent({__name:"ATableHeader",props:{columns:{},store:{}},setup(e){return(t,n)=>t.columns.length?(r.openBlock(),r.createElementBlock("thead",Uo,[r.createElementVNode("tr",Wo,[t.store.zeroColumn?(r.openBlock(),r.createElementBlock("th",{key:0,id:"header-index",class:r.normalizeClass([[t.store.hasPinnedColumns?"sticky-index":"",t.store.config.view==="tree"?"tree-index":"",t.store.config.view==="list-expansion"?"list-expansion-index":""],"list-index"])},null,2)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(t.columns,(o,a)=>(r.openBlock(),r.createElementBlock("th",{key:o.name,tabindex:"-1",style:r.normalizeStyle(t.store.getHeaderCellStyle(o)),class:r.normalizeClass(o.pinned?"sticky-column":"")},[r.renderSlot(t.$slots,"default",{},()=>[r.createTextVNode(r.toDisplayString(o.label||String.fromCharCode(a+97).toUpperCase()),1)])],6))),128))])])):r.createCommentVNode("",!0)}}),Re=r.defineComponent({__name:"ATableModal",props:{colIndex:{},rowIndex:{},store:{}},setup(e){const t=n=>{n.stopPropagation()};return(n,o)=>(r.openBlock(),r.createElementBlock("div",{class:"amodal",tabindex:"-1",onClick:t,onInput:t},[r.renderSlot(n.$slots,"default")],32))}}),kt=e=>{const t=e.id||crypto.randomUUID();return Kt(`table-${t}`,()=>{const o=()=>{const w={};for(const[v,g]of i.value.entries())for(const[m,E]of s.value.entries())w[`${v}:${m}`]=E[g.name];return w},a=w=>{const v=[Object.assign({},{rowModified:!1})];if(w&&"0:0"in w)return w;const g=new Set;for(let m=s.value.length-1;m>=0;m--){const E=s.value[m];E.parent&&g.add(E.parent),v[m]={childrenOpen:!1,expanded:!1,indent:E.indent||null,isParent:g.has(m),isRoot:E.parent===null||E.parent===void 0,rowModified:!1,open:E.parent===null||E.parent===void 0,parent:E.parent}}return v},i=r.ref(e.columns),s=r.ref(e.rows),l=r.ref(e.config||{}),c=r.ref(e.table||o()),d=r.ref(a(e.display)),u=r.ref(e.modal||{visible:!1}),p=r.computed(()=>i.value.some(w=>w.pinned)),f=r.computed(()=>`${Math.ceil(s.value.length/100+1)}ch`),h=r.computed(()=>["list","tree","list-expansion"].includes(l.value.view)),b=(w,v)=>c.value[`${w}:${v}`],S=(w,v,g)=>{const m=`${w}:${v}`,E=i.value[w];c.value[m]!==g&&(d.value[v].rowModified=!0),c.value[m]=g,s.value[v][E.name]=g},k=w=>({minWidth:w.width||"40ch",textAlign:w.align||"center",width:l.value.fullWidth?"auto":null}),x=w=>l.value.view!=="tree"||d.value[w].isRoot||d.value[w].open,A=w=>l.value.view!=="tree"?"":d.value[w].isRoot||d.value[w].isParent?d.value[w].childrenOpen?"-":"+":"",ue=w=>{if(l.value.view==="tree"){d.value[w].childrenOpen=!d.value[w].childrenOpen;for(let v=s.value.length-1;v>=0;v--)d.value[v].parent===w&&(d.value[v].open=!d.value[v].open,d.value[v].childrenOpen&&ue(v))}else l.value.view==="list-expansion"&&(d.value[w].expanded=!d.value[w].expanded)},te=(w,v)=>{const g=b(w,v);return z(w,v,g)},z=(w,v,g)=>{const m=i.value[w],E=s.value[v],_=m.format;return _?typeof _=="function"?_(g,{table:c.value,row:E,column:m}):typeof _=="string"?Function(`"use strict";return (${_})`)()(g,{table:c.value,row:E,column:m}):g:g};return{columns:i,rows:s,config:l,table:c,display:d,modal:u,hasPinnedColumns:p,numberedRowWidth:f,zeroColumn:h,closeModal:w=>{var v;w.target instanceof Node&&(v=u.value.parent)!=null&&v.contains(w.target)||u.value.visible&&(u.value.visible=!1)},getCellData:b,getCellDisplayValue:te,getFormattedValue:z,getHeaderCellStyle:k,getIndent:(w,v)=>v&&w===0&&v>0?`${v}ch`:"inherit",getRowExpandSymbol:A,isRowVisible:x,setCellData:S,toggleRowExpand:ue}})()},St=((e,t)=>{const n=e.__vccOpts||e;for(const[o,a]of t)n[o]=a;return n})(r.defineComponent({__name:"ATable",props:{id:{},modelValue:{},columns:{},rows:{default:()=>[]},config:{default:()=>new Object}},emits:["update:modelValue","cellUpdate"],setup(e,{expose:t,emit:n}){const o=n,a=r.useTemplateRef("table"),i=e.modelValue?e.modelValue:e.rows,s=kt({columns:e.columns,rows:i,id:e.id,config:e.config});s.$onAction(({name:c,store:d,args:u})=>{if(c==="setCellData"){const[p,f,h]=u,b=d.getCellData(p,f);o("cellUpdate",[p,f,h,b])}}),r.watch(()=>s.rows,c=>{o("update:modelValue",c)},{deep:!0}),r.onMounted(()=>{e.columns.some(c=>c.pinned)&&(l(),s.config.view==="tree"&&vt(a,l,{childList:!0,subtree:!0}))});const l=()=>{const c=a.value,d=c.rows[0],u=c.rows[1],p=d?Array.from(d.cells):[];for(const[f,h]of p.entries()){const b=u.cells[f];b&&(h.style.width=`${b.offsetWidth}px`)}for(const f of c.rows){let h=0;const b=[];for(const S of f.cells)(S.classList.contains("sticky-column")||S.classList.contains("sticky-index"))&&(S.style.left=`${h}px`,h+=S.offsetWidth,b.push(S));b.length>0&&b[b.length-1].classList.add("sticky-column-edge")}};return window.addEventListener("keydown",c=>{if(c.key==="Escape"&&s.modal.visible){s.modal.visible=!1;const d=s.modal.parent;d&&r.nextTick().then(()=>{d.focus()})}}),t({store:s}),(c,d)=>(r.openBlock(),r.createElementBlock("table",{ref:"table",class:"atable",style:r.normalizeStyle({width:r.unref(s).config.fullWidth?"100%":"auto"})},[r.renderSlot(c.$slots,"header",{data:r.unref(s)},()=>[r.createVNode(De,{columns:r.unref(s).columns,store:r.unref(s)},null,8,["columns","store"])],!0),r.createElementVNode("tbody",null,[r.renderSlot(c.$slots,"body",{data:r.unref(s)},()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(s).rows,(u,p)=>(r.openBlock(),r.createBlock(Pe,{key:u.id,row:u,rowIndex:p,store:r.unref(s)},{default:r.withCtx(()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(s).columns,(f,h)=>(r.openBlock(),r.createBlock($e,{key:f.name,store:r.unref(s),col:f,spellcheck:"false",pinned:f.pinned,rowIndex:p,colIndex:h,component:f.cellComponent,style:r.normalizeStyle({textAlign:(f==null?void 0:f.align)||"center",minWidth:(f==null?void 0:f.width)||"40ch",width:r.unref(s).config.fullWidth?"auto":null})},null,8,["store","col","pinned","rowIndex","colIndex","component","style"]))),128))]),_:2},1032,["row","rowIndex","store"]))),128))],!0)]),r.renderSlot(c.$slots,"footer",{data:r.unref(s)},void 0,!0),r.renderSlot(c.$slots,"modal",{data:r.unref(s)},()=>[r.withDirectives(r.createVNode(Re,{colIndex:r.unref(s).modal.colIndex,rowIndex:r.unref(s).modal.rowIndex,store:r.unref(s),style:r.normalizeStyle({left:r.unref(s).modal.left+"px",top:r.unref(s).modal.top+"px",maxWidth:r.unref(s).modal.width+"px"})},{default:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(r.unref(s).modal.component),r.mergeProps({key:`${r.unref(s).modal.rowIndex}:${r.unref(s).modal.colIndex}`,colIndex:r.unref(s).modal.colIndex,rowIndex:r.unref(s).modal.rowIndex,store:r.unref(s)},r.unref(s).modal.componentProps),null,16,["colIndex","rowIndex","store"]))]),_:1},8,["colIndex","rowIndex","store","style"]),[[r.vShow,r.unref(s).modal.visible]])],!0)],4))}}),[["__scopeId","data-v-20244978"]]);function Fo(e){const t=Yt();e.use(t),e.component("ACell",$e),e.component("AExpansionRow",xt),e.component("ARow",Pe),e.component("ATable",St),e.component("ATableHeader",De),e.component("ATableModal",Re)}C.ACell=$e,C.AExpansionRow=xt,C.ARow=Pe,C.ATable=St,C.ATableHeader=De,C.ATableModal=Re,C.createTableStore=kt,C.install=Fo,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
|
3
13
|
//# sourceMappingURL=atable.umd.cjs.map
|