@stonecrop/atable 0.3.2 → 0.3.4

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.
@@ -1,3 +1,3 @@
1
- (function(k,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","vue","pinia"],t):(k=typeof globalThis<"u"?globalThis:k||self,t(k["@stonecrop/atable"]={},k.Vue,k.pinia))})(this,function(k,t,ve){"use strict";var oe=document.createElement("style");oe.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);display:flex}.expandable-row>td:first-child{border-left:4px solid var(--sc-row-border-color)}.expanded-row{display:flex;border-left:2px solid var(--sc-row-border-color)}.expandable-row:last-child{border-bottom:1px solid var(--sc-row-border-color)}.expanded-row-content{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}.table-row>td:first-child{border-left:4px solid var(--sc-row-border-color)}.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-changed-color: #d8edff;--sc-form-border: var(--sc-gray-20);--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: .125rem;--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-a7848db7]: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-changed-color: #d8edff;--sc-form-border: var(--sc-gray-20);--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: .125rem;--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-a7848db7]{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-a7848db7]{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-a7848db7]:focus{outline:none}
2
- /*$vite$:1*/`,document.head.appendChild(oe);function ne(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function W(e){return typeof e=="function"?e():t.unref(e)}const Ee=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ce=e=>e!=null,Ae=Object.prototype.toString,Se=e=>Ae.call(e)==="[object Object]",Ie=()=>{},B=Ee?window:void 0;function R(e){var o;const n=W(e);return(o=n==null?void 0:n.$el)!=null?o:n}function O(...e){let o,n,r,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,r,a]=e,o=B):[o,n,r,a]=e,!o)return Ie;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const c=[],l=()=>{c.forEach(f=>f()),c.length=0},i=(f,p,u,b)=>(f.addEventListener(p,u,b),()=>f.removeEventListener(p,u,b)),s=t.watch(()=>[R(o),W(a)],([f,p])=>{if(l(),!f)return;const u=Se(p)?{...p}:p;c.push(...n.flatMap(b=>r.map(y=>i(f,b,y,u))))},{immediate:!0,flush:"post"}),d=()=>{s(),l()};return ne(d),d}function Te(){const e=t.ref(!1),o=t.getCurrentInstance();return o&&t.onMounted(()=>{e.value=!0},o),e}function Me(e){const o=Te();return t.computed(()=>(o.value,!!e()))}function $e(e,o,n={}){const{window:r=B,...a}=n;let c;const l=Me(()=>r&&"MutationObserver"in r),i=()=>{c&&(c.disconnect(),c=void 0)},s=t.computed(()=>{const u=W(e),b=(Array.isArray(u)?u:[u]).map(R).filter(Ce);return new Set(b)}),d=t.watch(()=>s.value,u=>{i(),l.value&&u.size&&(c=new MutationObserver(o),u.forEach(b=>c.observe(b,a)))},{immediate:!0,flush:"post"}),f=()=>c==null?void 0:c.takeRecords(),p=()=>{d(),i()};return ne(p),{isSupported:l,stop:p,takeRecords:f}}function Be(e={}){var o;const{window:n=B,deep:r=!0,triggerOnRemoval:a=!1}=e,c=(o=e.document)!=null?o:n==null?void 0:n.document,l=()=>{var d;let f=c==null?void 0:c.activeElement;if(r)for(;f!=null&&f.shadowRoot;)f=(d=f==null?void 0:f.shadowRoot)==null?void 0:d.activeElement;return f},i=t.ref(),s=()=>{i.value=l()};return n&&(O(n,"blur",d=>{d.relatedTarget===null&&s()},!0),O(n,"focus",s,!0)),a&&$e(c,d=>{d.filter(f=>f.removedNodes.length).map(f=>Array.from(f.removedNodes)).flat().forEach(f=>{f===i.value&&s()})},{childList:!0,subtree:!0}),s(),i}const Re="focusin",Oe="focusout";function De(e,o={}){const{window:n=B}=o,r=t.computed(()=>R(e)),a=t.ref(!1),c=t.computed(()=>a.value),l=Be(o);return!n||!l.value?{focused:c}:(O(r,Re,()=>a.value=!0),O(r,Oe,()=>a.value=!1),{focused:c})}function Le(e,{window:o=B,scrollTarget:n}={}){const r=t.ref(!1),a=()=>{if(!o)return;const c=o.document,l=R(e);if(!l)r.value=!1;else{const i=l.getBoundingClientRect();r.value=i.top<=(o.innerHeight||c.documentElement.clientHeight)&&i.left<=(o.innerWidth||c.documentElement.clientWidth)&&i.bottom>=0&&i.right>=0}};return t.watch(()=>R(e),()=>a(),{immediate:!0,flush:"post"}),o&&O(n||o,"scroll",a,{capture:!1,passive:!0}),r}const I=e=>{let o=Le(e).value;return o=o&&e.offsetHeight>0,o},T=e=>e.tabIndex>=0,re=e=>{const o=e.target;return H(o)},H=e=>{var o;let n;if(e instanceof HTMLTableCellElement){const r=(o=e.parentElement)==null?void 0:o.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&&(!T(n)||!I(n))?H(n):n},ze=e=>{var o;const n=e.target;let r;if(n instanceof HTMLTableCellElement){const a=(o=n.parentElement)==null?void 0:o.parentElement;if(a){const c=a.firstElementChild.children[n.cellIndex];c&&(r=c)}}else if(n instanceof HTMLTableRowElement){const a=n.parentElement;if(a){const c=a.firstElementChild;c&&(r=c)}}return r&&(!T(r)||!I(r))?j(r):r},le=e=>{const o=e.target;return j(o)},j=e=>{var o;let n;if(e instanceof HTMLTableCellElement){const r=(o=e.parentElement)==null?void 0:o.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&&(!T(n)||!I(n))?j(n):n},Pe=e=>{var o;const n=e.target;let r;if(n instanceof HTMLTableCellElement){const a=(o=n.parentElement)==null?void 0:o.parentElement;if(a){const c=a.lastElementChild.children[n.cellIndex];c&&(r=c)}}else if(n instanceof HTMLTableRowElement){const a=n.parentElement;if(a){const c=a.lastElementChild;c&&(r=c)}}return r&&(!T(r)||!I(r))?H(r):r},ae=e=>{const o=e.target;return F(o)},F=e=>{var o;let n;if(e.previousElementSibling)n=e.previousElementSibling;else{const r=(o=e.parentElement)==null?void 0:o.previousElementSibling;n=r==null?void 0:r.lastElementChild}return n&&(!T(n)||!I(n))?F(n):n},se=e=>{const o=e.target;return q(o)},q=e=>{var o;let n;if(e.nextElementSibling)n=e.nextElementSibling;else{const r=(o=e.parentElement)==null?void 0:o.nextElementSibling;n=r==null?void 0:r.firstElementChild}return n&&(!T(n)||!I(n))?q(n):n},ce=e=>{const o=e.target.parentElement.firstElementChild;return o&&(!T(o)||!I(o))?q(o):o},ie=e=>{const o=e.target.parentElement.lastElementChild;return o&&(!T(o)||!I(o))?F(o):o},N=["alt","control","shift","meta"],Ne={ArrowUp:"up",ArrowDown:"down",ArrowLeft:"left",ArrowRight:"right"},U={"keydown.up":e=>{const o=re(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.down":e=>{const o=le(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.left":e=>{const o=ae(e);e.preventDefault(),e.stopPropagation(),o&&o.focus()},"keydown.right":e=>{const o=se(e);e.preventDefault(),e.stopPropagation(),o&&o.focus()},"keydown.control.up":e=>{const o=ze(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.control.down":e=>{const o=Pe(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.control.left":e=>{const o=ce(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.control.right":e=>{const o=ie(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.end":e=>{const o=ie(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.enter":e=>{if(e.target instanceof HTMLTableCellElement){e.preventDefault(),e.stopPropagation();const o=le(e);o&&o.focus()}},"keydown.shift.enter":e=>{if(e.target instanceof HTMLTableCellElement){e.preventDefault(),e.stopPropagation();const o=re(e);o&&o.focus()}},"keydown.home":e=>{const o=ce(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.tab":e=>{const o=se(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.shift.tab":e=>{const o=ae(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())}};function G(e){const o=l=>{let i=null;return l.parent&&(typeof l.parent=="string"?i=document.querySelector(l.parent):l.parent instanceof HTMLElement?i=l.parent:i=l.parent.value),i},n=l=>{const i=o(l);let s=[];if(typeof l.selectors=="string")s=i?Array.from(i.querySelectorAll(l.selectors)):Array.from(document.querySelectorAll(l.selectors));else if(Array.isArray(l.selectors))for(const d of l.selectors)d instanceof HTMLElement?s.push(d):s.push(d.$el);else if(l.selectors instanceof HTMLElement)s.push(l.selectors);else if(Array.isArray(l.selectors.value))for(const d of l.selectors.value)d instanceof HTMLElement?s.push(d):s.push(d.$el);else s.push(l.selectors.value);return s},r=l=>{const i=o(l);let s=[];return l.selectors?s=n(l):i&&(s=Array.from(i.children).filter(d=>T(d)&&I(d))),s},a=l=>i=>{const s=Ne[i.key]||i.key.toLowerCase();if(N.includes(s))return;const d=l.handlers||U;for(const f of Object.keys(d)){const[p,...u]=f.split(".");if(p==="keydown"&&u.includes(s)){const b=d[f],y=u.filter(g=>N.includes(g)),w=N.some(g=>{const m=g.charAt(0).toUpperCase()+g.slice(1);return i.getModifierState(m)});if(y.length>0){if(w){for(const g of N)if(u.includes(g)){const m=g.charAt(0).toUpperCase()+g.slice(1);i.getModifierState(m)&&b(i)}}}else w||b(i)}}},c=[];t.onMounted(()=>{for(const l of e){const i=o(l),s=r(l),d=a(l),f=i?[i]:s;for(const p of f){const{focused:u}=De(t.ref(p)),b=t.watch(u,y=>{y?p.addEventListener("keydown",d):p.removeEventListener("keydown",d)});c.push(b)}}}),t.onBeforeUnmount(()=>{for(const l of c)l()})}function D(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function S(e){return typeof e=="function"?e():t.unref(e)}const Y=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ve=e=>e!=null,We=Object.prototype.toString,de=e=>We.call(e)==="[object Object]",M=()=>{},X=He();function He(){var e,o;return Y&&((e=window==null?void 0:window.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((o=window==null?void 0:window.navigator)==null?void 0:o.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function je(e){return t.getCurrentInstance()}function Fe(...e){if(e.length!==1)return t.toRef(...e);const o=e[0];return typeof o=="function"?t.readonly(t.customRef(()=>({get:o,set:M}))):t.ref(o)}function qe(e,o=!0,n){je()?t.onMounted(e,n):o?e():t.nextTick(e)}const J=Y?window:void 0;function $(e){var o;const n=S(e);return(o=n==null?void 0:n.$el)!=null?o:n}function fe(...e){let o,n,r,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,r,a]=e,o=J):[o,n,r,a]=e,!o)return M;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const c=[],l=()=>{c.forEach(f=>f()),c.length=0},i=(f,p,u,b)=>(f.addEventListener(p,u,b),()=>f.removeEventListener(p,u,b)),s=t.watch(()=>[$(o),S(a)],([f,p])=>{if(l(),!f)return;const u=de(p)?{...p}:p;c.push(...n.flatMap(b=>r.map(y=>i(f,b,y,u))))},{immediate:!0,flush:"post"}),d=()=>{s(),l()};return D(d),d}function Ue(){const e=t.ref(!1),o=t.getCurrentInstance();return o&&t.onMounted(()=>{e.value=!0},o),e}function ue(e){const o=Ue();return t.computed(()=>(o.value,!!e()))}function pe(e,o,n={}){const{window:r=J,...a}=n;let c;const l=ue(()=>r&&"MutationObserver"in r),i=()=>{c&&(c.disconnect(),c=void 0)},s=t.computed(()=>{const u=S(e),b=(Array.isArray(u)?u:[u]).map($).filter(Ve);return new Set(b)}),d=t.watch(()=>s.value,u=>{i(),l.value&&u.size&&(c=new MutationObserver(o),u.forEach(b=>c.observe(b,a)))},{immediate:!0,flush:"post"}),f=()=>c==null?void 0:c.takeRecords(),p=()=>{d(),i()};return D(p),{isSupported:l,stop:p,takeRecords:f}}function Ge(e,o,n={}){const{window:r=J,...a}=n;let c;const l=ue(()=>r&&"ResizeObserver"in r),i=()=>{c&&(c.disconnect(),c=void 0)},s=t.computed(()=>{const p=S(e);return Array.isArray(p)?p.map(u=>$(u)):[$(p)]}),d=t.watch(s,p=>{if(i(),l.value&&r){c=new ResizeObserver(o);for(const u of p)u&&c.observe(u,a)}},{immediate:!0,flush:"post"}),f=()=>{i(),d()};return D(f),{isSupported:l,stop:f}}function Ye(e,o={}){const{reset:n=!0,windowResize:r=!0,windowScroll:a=!0,immediate:c=!0,updateTiming:l="sync"}=o,i=t.ref(0),s=t.ref(0),d=t.ref(0),f=t.ref(0),p=t.ref(0),u=t.ref(0),b=t.ref(0),y=t.ref(0);function w(){const m=$(e);if(!m){n&&(i.value=0,s.value=0,d.value=0,f.value=0,p.value=0,u.value=0,b.value=0,y.value=0);return}const v=m.getBoundingClientRect();i.value=v.height,s.value=v.bottom,d.value=v.left,f.value=v.right,p.value=v.top,u.value=v.width,b.value=v.x,y.value=v.y}function g(){l==="sync"?w():l==="next-frame"&&requestAnimationFrame(()=>w())}return Ge(e,g),t.watch(()=>$(e),m=>!m&&g()),pe(e,g,{attributeFilter:["style","class"]}),a&&fe("scroll",g,{capture:!0,passive:!0}),r&&fe("resize",g,{passive:!0}),qe(()=>{c&&g()}),{height:i,bottom:s,left:d,right:f,top:p,width:u,x:b,y,update:g}}const Xe=e=>{const o=new DOMParser().parseFromString(e,"text/html");return Array.from(o.body.childNodes).some(n=>n.nodeType===1)},Je=["data-colindex","data-rowindex","data-editable","contenteditable","tabindex"],Qe=["innerHTML"],Ze={key:2},Q=t.defineComponent({__name:"ACell",props:{colIndex:{},rowIndex:{},store:{},addNavigation:{type:[Boolean,Object],default:!0},tabIndex:{default:0},pinned:{type:Boolean}},setup(e){const o=t.useTemplateRef("cell"),{bottom:n,left:r}=Ye(o),a=e.store.getCellData(e.colIndex,e.rowIndex),c=t.ref(e.store.getCellDisplayValue(e.colIndex,e.rowIndex)),l=t.ref(""),i=t.ref(!1),s=e.store.columns[e.colIndex],d=e.store.rows[e.rowIndex],f=s.align||"center",p=s.width||"40ch";t.watch(()=>e.store.getCellData(e.colIndex,e.rowIndex),m=>{c.value=e.store.getFormattedValue(e.colIndex,e.rowIndex,m)});const u=t.computed(()=>typeof c.value=="string"?Xe(c.value):!1),b=t.computed(()=>{var m;return{textAlign:f,width:p,backgroundColor:i.value?"var(--sc-cell-changed-color)":"inherit",fontWeight:i.value?"bold":"inherit",paddingLeft:e.store.getIndent(e.colIndex,(m=e.store.display[e.rowIndex])==null?void 0:m.indent)}}),y=()=>{s.mask,s.modalComponent&&e.store.$patch(m=>{m.modal.visible=!0,m.modal.colIndex=e.colIndex,m.modal.rowIndex=e.rowIndex,m.modal.parent=o.value,m.modal.top=n.value,m.modal.left=r.value,m.modal.width=p,typeof s.modalComponent=="function"?m.modal.component=s.modalComponent({table:m.table,row:d,column:s}):m.modal.component=s.modalComponent,m.modal.componentProps=s.modalComponentExtraProps})};if(e.addNavigation){let m={...U,"keydown.f2":y,"keydown.alt.up":y,"keydown.alt.down":y,"keydown.alt.left":y,"keydown.alt.right":y};typeof e.addNavigation=="object"&&(m={...m,...e.addNavigation}),G([{selectors:o,handlers:m}])}const w=()=>{o.value&&(l.value=o.value.textContent)},g=()=>{o.value&&(s.format?i.value=o.value.textContent!==e.store.getFormattedValue(e.colIndex,e.rowIndex,a):i.value=o.value.textContent!==a,o.value.textContent!==l.value&&(l.value=o.value.textContent,o.value.dispatchEvent(new Event("change")),s.format||e.store.setCellData(e.colIndex,e.rowIndex,l.value)))};return(m,v)=>(t.openBlock(),t.createElementBlock("td",{ref:"cell","data-colindex":m.colIndex,"data-rowindex":m.rowIndex,"data-editable":t.unref(s).edit,contenteditable:t.unref(s).edit,tabindex:m.tabIndex,spellcheck:!1,style:t.normalizeStyle(b.value),onFocus:w,onPaste:g,onBlur:g,onInput:g,onClick:y,class:t.normalizeClass(["atable-cell",m.pinned?"sticky-column":""])},[t.unref(s).cellComponent?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(s).cellComponent),t.mergeProps({key:0,value:c.value},t.unref(s).cellComponentProps),null,16,["value"])):u.value?(t.openBlock(),t.createElementBlock("span",{key:1,innerHTML:c.value},null,8,Qe)):(t.openBlock(),t.createElementBlock("span",Ze,t.toDisplayString(c.value),1))],46,Je))}}),Ke=["tabindex"],_e=["tabindex"],et=["colspan"],me=t.defineComponent({__name:"AExpansionRow",props:{rowIndex:{},store:{},tabIndex:{default:()=>-1},addNavigation:{type:[Boolean,Object]}},setup(e){const o=t.useTemplateRef("rowEl"),n=t.computed(()=>e.store.display[e.rowIndex].expanded?"▼":"►");if(e.addNavigation){const r={"keydown.control.g":a=>{a.stopPropagation(),a.preventDefault(),e.store.toggleRowExpand(e.rowIndex)}};typeof e.addNavigation=="object"&&Object.assign(r,e.addNavigation),G([{selectors:o,handlers:r}])}return(r,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("tr",t.mergeProps(r.$attrs,{ref:"rowEl",tabindex:r.tabIndex,class:"expandable-row"}),[t.createElementVNode("td",{tabIndex:-1,onClick:a[0]||(a[0]=c=>r.store.toggleRowExpand(r.rowIndex)),class:"row-index"},t.toDisplayString(n.value),1),t.renderSlot(r.$slots,"row")],16,Ke),r.store.display[r.rowIndex].expanded?(t.openBlock(),t.createElementBlock("tr",{key:0,ref:"rowExpanded",tabindex:r.tabIndex,class:"expanded-row"},[t.createElementVNode("td",{tabIndex:-1,colspan:r.store.columns.length+1,class:"expanded-row-content"},[t.renderSlot(r.$slots,"content")],8,et)],8,_e)):t.createCommentVNode("",!0)],64))}}),tt=["tabindex"],Z=t.defineComponent({__name:"ARow",props:{rowIndex:{},store:{},tabIndex:{default:()=>-1},addNavigation:{type:[Boolean,Object],default:!1}},setup(e){const o=t.useTemplateRef("rowEl"),n=e.store.isRowVisible(e.rowIndex),r=e.store.getRowExpandSymbol(e.rowIndex);if(e.addNavigation){let a=U;typeof e.addNavigation=="object"&&(a={...a,...e.addNavigation}),G([{selectors:o,handlers:a}])}return(a,c)=>t.withDirectives((t.openBlock(),t.createElementBlock("tr",{ref:"rowEl",tabindex:a.tabIndex,class:"table-row"},[a.store.config.view!=="uncounted"?t.renderSlot(a.$slots,"index",{key:0},()=>[a.store.config.view==="list"?(t.openBlock(),t.createElementBlock("td",{key:0,tabIndex:-1,class:t.normalizeClass(["list-index",a.store.hasPinnedColumns?"sticky-index":""])},t.toDisplayString(a.rowIndex+1),3)):a.store.config.view==="tree"?(t.openBlock(),t.createElementBlock("td",{key:1,tabIndex:-1,class:t.normalizeClass(["tree-index",a.store.hasPinnedColumns?"sticky-index":""]),onClick:c[0]||(c[0]=l=>a.store.toggleRowExpand(a.rowIndex))},t.toDisplayString(t.unref(r)),3)):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(a.$slots,"default")],8,tt)),[[t.vShow,t.unref(n)]])}}),be=Y?window:void 0;function L(e){var o;const n=S(e);return(o=n==null?void 0:n.$el)!=null?o:n}function V(...e){let o,n,r,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,r,a]=e,o=be):[o,n,r,a]=e,!o)return M;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const c=[],l=()=>{c.forEach(f=>f()),c.length=0},i=(f,p,u,b)=>(f.addEventListener(p,u,b),()=>f.removeEventListener(p,u,b)),s=t.watch(()=>[L(o),S(a)],([f,p])=>{if(l(),!f)return;const u=de(p)?{...p}:p;c.push(...n.flatMap(b=>r.map(y=>i(f,b,y,u))))},{immediate:!0,flush:"post"}),d=()=>{s(),l()};return D(d),d}let we=!1;function ge(e,o,n={}){const{window:r=be,ignore:a=[],capture:c=!0,detectIframe:l=!1}=n;if(!r)return M;X&&!we&&(we=!0,Array.from(r.document.body.children).forEach(w=>w.addEventListener("click",M)),r.document.documentElement.addEventListener("click",M));let i=!0;const s=w=>S(a).some(g=>{if(typeof g=="string")return Array.from(r.document.querySelectorAll(g)).some(m=>m===w.target||w.composedPath().includes(m));{const m=L(g);return m&&(w.target===m||w.composedPath().includes(m))}});function d(w){const g=S(w);return g&&g.$.subTree.shapeFlag===16}function f(w,g){const m=S(w),v=m.$.subTree&&m.$.subTree.children;return v==null||!Array.isArray(v)?!1:v.some(z=>z.el===g.target||g.composedPath().includes(z.el))}const p=w=>{const g=L(e);if(w.target!=null&&!(!(g instanceof Element)&&d(e)&&f(e,w))&&!(!g||g===w.target||w.composedPath().includes(g))){if(w.detail===0&&(i=!s(w)),!i){i=!0;return}o(w)}};let u=!1;const b=[V(r,"click",w=>{u||(u=!0,setTimeout(()=>{u=!1},0),p(w))},{passive:!0,capture:c}),V(r,"pointerdown",w=>{const g=L(e);i=!s(w)&&!!(g&&!w.composedPath().includes(g))},{passive:!0}),l&&V(r,"blur",w=>{setTimeout(()=>{var g;const m=L(e);((g=r.document.activeElement)==null?void 0:g.tagName)==="IFRAME"&&!(m!=null&&m.contains(r.document.activeElement))&&o(w)},0)})].filter(Boolean);return()=>b.forEach(w=>w())}const ot={mounted(e,o){const n=!o.modifiers.bubble;if(typeof o.value=="function")e.__onClickOutside_stop=ge(e,o.value,{capture:n});else{const[r,a]=o.value;e.__onClickOutside_stop=ge(e,r,Object.assign({capture:n},a))}},unmounted(e){e.__onClickOutside_stop()}};function K(e){return typeof Window<"u"&&e instanceof Window?e.document.documentElement:typeof Document<"u"&&e instanceof Document?e.documentElement:e}function he(e){const o=window.getComputedStyle(e);if(o.overflowX==="scroll"||o.overflowY==="scroll"||o.overflowX==="auto"&&e.clientWidth<e.scrollWidth||o.overflowY==="auto"&&e.clientHeight<e.scrollHeight)return!0;{const n=e.parentNode;return!n||n.tagName==="BODY"?!1:he(n)}}function nt(e){const o=e||window.event,n=o.target;return he(n)?!1:o.touches.length>1?!0:(o.preventDefault&&o.preventDefault(),!1)}const _=new WeakMap;function rt(e,o=!1){const n=t.ref(o);let r=null,a="";t.watch(Fe(e),i=>{const s=K(S(i));if(s){const d=s;if(_.get(d)||_.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 c=()=>{const i=K(S(e));!i||n.value||(X&&(r=V(i,"touchmove",s=>{nt(s)},{passive:!1})),i.style.overflow="hidden",n.value=!0)},l=()=>{const i=K(S(e));!i||!n.value||(X&&(r==null||r()),i.style.overflow=a,_.delete(i),n.value=!1)};return D(l),t.computed({get(){return n.value},set(i){i?c():l()}})}function lt(){let e=!1;const o=t.ref(!1);return(n,r)=>{if(o.value=r.value,e)return;e=!0;const a=rt(n,r.value);t.watch(o,c=>a.value=c)}}lt();const at={key:0,id:"resizable"},st={class:"atable-header-row",tabindex:"-1"},ee=t.defineComponent({__name:"ATableHeader",props:{columns:{},store:{}},setup(e){return(o,n)=>o.columns.length?(t.openBlock(),t.createElementBlock("thead",at,[t.createElementVNode("tr",st,[o.store.zeroColumn?(t.openBlock(),t.createElementBlock("th",{key:0,id:"header-index",class:t.normalizeClass([[o.store.hasPinnedColumns?"sticky-index":"",o.store.config.view==="tree"?"tree-index":"",o.store.config.view==="list-expansion"?"list-expansion-index":""],"list-index"])},null,2)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.columns,(r,a)=>(t.openBlock(),t.createElementBlock("th",{key:r.name,tabindex:"-1",style:t.normalizeStyle(o.store.getHeaderCellStyle(r)),class:t.normalizeClass(r.pinned?"sticky-column":"")},[t.renderSlot(o.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(r.label||String.fromCharCode(a+97).toUpperCase()),1)])],6))),128))])])):t.createCommentVNode("",!0)}}),te=t.defineComponent({__name:"ATableModal",props:{colIndex:{},rowIndex:{},store:{}},setup(e){const o=n=>{n.stopPropagation()};return(n,r)=>(t.openBlock(),t.createElementBlock("div",{class:"amodal",tabindex:"-1",onClick:o,onInput:o},[t.renderSlot(n.$slots,"default")],32))}}),ye=e=>{const o=e.id||crypto.randomUUID();return ve.defineStore(`table-${o}`,()=>{const r=()=>{const h={};for(const[x,E]of c.value.entries())for(const[A,C]of l.value.entries())h[`${x}:${A}`]=C[E.name];return h},a=h=>{const x=[Object.assign({},{rowModified:!1})];if(h&&"0:0"in h)return h;const E=new Set;for(let A=l.value.length-1;A>=0;A--){const C=l.value[A];C.parent&&E.add(C.parent),x[A]={childrenOpen:!1,expanded:!1,indent:C.indent||null,isParent:E.has(A),isRoot:C.parent===null||C.parent===void 0,rowModified:!1,open:C.parent===null||C.parent===void 0,parent:C.parent}}return x},c=t.ref(e.columns),l=t.ref(e.rows),i=t.ref(e.config||{}),s=t.ref(e.table||r()),d=t.ref(a(e.display)),f=t.ref(e.modal||{visible:!1}),p=t.computed(()=>c.value.some(h=>h.pinned)),u=t.computed(()=>`${Math.ceil(l.value.length/100+1)}ch`),b=t.computed(()=>["list","tree","list-expansion"].includes(i.value.view)),y=(h,x)=>s.value[`${h}:${x}`],w=(h,x,E)=>{const A=`${h}:${x}`,C=c.value[h];s.value[A]!==E&&(d.value[x].rowModified=!0),s.value[A]=E,l.value[x][C.name]=E},g=h=>({minWidth:h.width||"40ch",textAlign:h.align||"center",width:i.value.fullWidth?"auto":null}),m=h=>i.value.view!=="tree"||d.value[h].isRoot||d.value[h].open,v=h=>i.value.view!=="tree"?"":d.value[h].isRoot||d.value[h].isParent?d.value[h].childrenOpen?"-":"+":"",z=h=>{if(i.value.view==="tree"){d.value[h].childrenOpen=!d.value[h].childrenOpen;for(let x=l.value.length-1;x>=0;x--)d.value[x].parent===h&&(d.value[x].open=!d.value[x].open,d.value[x].childrenOpen&&z(x))}else i.value.view==="list-expansion"&&(d.value[h].expanded=!d.value[h].expanded)},it=(h,x)=>{const E=y(h,x);return ke(h,x,E)},ke=(h,x,E)=>{const A=c.value[h],C=l.value[x],P=A.format;return P?typeof P=="function"?P(E,{table:s.value,row:C,column:A}):typeof P=="string"?Function(`"use strict";return (${P})`)()(E,{table:s.value,row:C,column:A}):E:E};return{columns:c,rows:l,config:i,table:s,display:d,modal:f,hasPinnedColumns:p,numberedRowWidth:u,zeroColumn:b,closeModal:h=>{var x;h.target instanceof Node&&(x=f.value.parent)!=null&&x.contains(h.target)||f.value.visible&&(f.value.visible=!1)},getCellData:y,getCellDisplayValue:it,getFormattedValue:ke,getHeaderCellStyle:g,getIndent:(h,x)=>x&&h===0&&x>0?`${x}ch`:"inherit",getRowExpandSymbol:v,isRowVisible:m,setCellData:w,toggleRowExpand:z}})()},xe=((e,o)=>{const n=e.__vccOpts||e;for(const[r,a]of o)n[r]=a;return n})(t.defineComponent({__name:"ATable",props:{id:{},modelValue:{},columns:{},rows:{default:()=>[]},config:{default:()=>new Object}},emits:["update:modelValue","cellUpdate"],setup(e,{expose:o,emit:n}){const r=n,a=t.useTemplateRef("table"),c=e.modelValue?e.modelValue:e.rows,l=ye({columns:e.columns,rows:c,id:e.id,config:e.config});l.$onAction(({name:s,store:d,args:f})=>{if(s==="setCellData"){const[p,u,b]=f,y=d.getCellData(p,u);r("cellUpdate",[p,u,b,y])}}),t.watch(()=>l.rows,s=>{r("update:modelValue",s)},{deep:!0}),t.onMounted(()=>{e.columns.some(s=>s.pinned)&&(i(),l.config.view==="tree"&&pe(a,i,{childList:!0,subtree:!0}))});const i=()=>{const s=a.value,d=s.rows[0],f=s.rows[1],p=d?Array.from(d.cells):[];for(const[u,b]of p.entries()){const y=f==null?void 0:f.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")}};return window.addEventListener("keydown",s=>{if(s.key==="Escape"&&l.modal.visible){l.modal.visible=!1;const d=l.modal.parent;d&&t.nextTick().then(()=>{d.focus()})}}),o({store:l}),(s,d)=>t.withDirectives((t.openBlock(),t.createElementBlock("table",{ref:"table",class:"atable",style:t.normalizeStyle({width:t.unref(l).config.fullWidth?"100%":"auto"})},[t.renderSlot(s.$slots,"header",{data:t.unref(l)},()=>[t.createVNode(ee,{columns:t.unref(l).columns,store:t.unref(l)},null,8,["columns","store"])],!0),t.createElementVNode("tbody",null,[t.renderSlot(s.$slots,"body",{data:t.unref(l)},()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).rows,(f,p)=>(t.openBlock(),t.createBlock(Z,{key:f.id,row:f,rowIndex:p,store:t.unref(l)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).columns,(u,b)=>(t.openBlock(),t.createBlock(Q,{key:u.name,store:t.unref(l),col:u,spellcheck:"false",pinned:u.pinned,rowIndex:p,colIndex:b,component:u.cellComponent,style:t.normalizeStyle({textAlign:(u==null?void 0:u.align)||"center",minWidth:(u==null?void 0:u.width)||"40ch",width:t.unref(l).config.fullWidth?"auto":null})},null,8,["store","col","pinned","rowIndex","colIndex","component","style"]))),128))]),_:2},1032,["row","rowIndex","store"]))),128))],!0)]),t.renderSlot(s.$slots,"footer",{data:t.unref(l)},void 0,!0),t.renderSlot(s.$slots,"modal",{data:t.unref(l)},()=>[t.withDirectives(t.createVNode(te,{colIndex:t.unref(l).modal.colIndex,rowIndex:t.unref(l).modal.rowIndex,store:t.unref(l),style:t.normalizeStyle({left:t.unref(l).modal.left+"px",top:t.unref(l).modal.top+"px",maxWidth:t.unref(l).modal.width+"px"})},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(l).modal.component),t.mergeProps({key:`${t.unref(l).modal.rowIndex}:${t.unref(l).modal.colIndex}`,colIndex:t.unref(l).modal.colIndex,rowIndex:t.unref(l).modal.rowIndex,store:t.unref(l)},t.unref(l).modal.componentProps),null,16,["colIndex","rowIndex","store"]))]),_:1},8,["colIndex","rowIndex","store","style"]),[[t.vShow,t.unref(l).modal.visible]])],!0)],4)),[[t.unref(ot),t.unref(l).closeModal]])}}),[["__scopeId","data-v-a7848db7"]]);function ct(e){e.component("ACell",Q),e.component("AExpansionRow",me),e.component("ARow",Z),e.component("ATable",xe),e.component("ATableHeader",ee),e.component("ATableModal",te)}k.ACell=Q,k.AExpansionRow=me,k.ARow=Z,k.ATable=xe,k.ATableHeader=ee,k.ATableModal=te,k.createTableStore=ye,k.install=ct,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
1
+ (function(S,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","vue","pinia"],t):(S=typeof globalThis<"u"?globalThis:S||self,t(S["@stonecrop/atable"]={},S.Vue,S.pinia))})(this,function(S,t,Se){"use strict";var ne=document.createElement("style");ne.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);display:flex}.expandable-row>td:first-child{border-left:4px solid var(--sc-row-border-color)}.expanded-row{display:flex;border-left:2px solid var(--sc-row-border-color)}.expandable-row:last-child{border-bottom:1px solid var(--sc-row-border-color)}.expanded-row-content{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}.table-row>td:first-child{border-left:4px solid var(--sc-row-border-color)}.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-changed-color: #d8edff;--sc-form-border: var(--sc-gray-20);--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: .125rem;--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:absolute;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-7480394f]: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-changed-color: #d8edff;--sc-form-border: var(--sc-gray-20);--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: .125rem;--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-7480394f]{position:relative;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-7480394f]{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-7480394f]:focus{outline:none}
2
+ /*$vite$:1*/`,document.head.appendChild(ne);function re(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function W(e){return typeof e=="function"?e():t.unref(e)}const Ae=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ie=e=>e!=null,Te=Object.prototype.toString,$e=e=>Te.call(e)==="[object Object]",Me=()=>{},O=Ae?window:void 0;function L(e){var o;const r=W(e);return(o=r==null?void 0:r.$el)!=null?o:r}function D(...e){let o,r,n,s;if(typeof e[0]=="string"||Array.isArray(e[0])?([r,n,s]=e,o=O):[o,r,n,s]=e,!o)return Me;Array.isArray(r)||(r=[r]),Array.isArray(n)||(n=[n]);const c=[],l=()=>{c.forEach(d=>d()),c.length=0},i=(d,u,m,p)=>(d.addEventListener(u,m,p),()=>d.removeEventListener(u,m,p)),f=t.watch(()=>[L(o),W(s)],([d,u])=>{if(l(),!d)return;const m=$e(u)?{...u}:u;c.push(...r.flatMap(p=>n.map(x=>i(d,p,x,m))))},{immediate:!0,flush:"post"}),a=()=>{f(),l()};return re(a),a}function Re(){const e=t.ref(!1),o=t.getCurrentInstance();return o&&t.onMounted(()=>{e.value=!0},o),e}function Be(e){const o=Re();return t.computed(()=>(o.value,!!e()))}function Oe(e,o,r={}){const{window:n=O,...s}=r;let c;const l=Be(()=>n&&"MutationObserver"in n),i=()=>{c&&(c.disconnect(),c=void 0)},f=t.computed(()=>{const m=W(e),p=(Array.isArray(m)?m:[m]).map(L).filter(Ie);return new Set(p)}),a=t.watch(()=>f.value,m=>{i(),l.value&&m.size&&(c=new MutationObserver(o),m.forEach(p=>c.observe(p,s)))},{immediate:!0,flush:"post"}),d=()=>c==null?void 0:c.takeRecords(),u=()=>{a(),i()};return re(u),{isSupported:l,stop:u,takeRecords:d}}function Le(e={}){var o;const{window:r=O,deep:n=!0,triggerOnRemoval:s=!1}=e,c=(o=e.document)!=null?o:r==null?void 0:r.document,l=()=>{var a;let d=c==null?void 0:c.activeElement;if(n)for(;d!=null&&d.shadowRoot;)d=(a=d==null?void 0:d.shadowRoot)==null?void 0:a.activeElement;return d},i=t.ref(),f=()=>{i.value=l()};return r&&(D(r,"blur",a=>{a.relatedTarget===null&&f()},!0),D(r,"focus",f,!0)),s&&Oe(c,a=>{a.filter(d=>d.removedNodes.length).map(d=>Array.from(d.removedNodes)).flat().forEach(d=>{d===i.value&&f()})},{childList:!0,subtree:!0}),f(),i}const De="focusin",ze="focusout";function Pe(e,o={}){const{window:r=O}=o,n=t.computed(()=>L(e)),s=t.ref(!1),c=t.computed(()=>s.value),l=Le(o);return!r||!l.value?{focused:c}:(D(n,De,()=>s.value=!0),D(n,ze,()=>s.value=!1),{focused:c})}function Ne(e,{window:o=O,scrollTarget:r}={}){const n=t.ref(!1),s=()=>{if(!o)return;const c=o.document,l=L(e);if(!l)n.value=!1;else{const i=l.getBoundingClientRect();n.value=i.top<=(o.innerHeight||c.documentElement.clientHeight)&&i.left<=(o.innerWidth||c.documentElement.clientWidth)&&i.bottom>=0&&i.right>=0}};return t.watch(()=>L(e),()=>s(),{immediate:!0,flush:"post"}),o&&D(r||o,"scroll",s,{capture:!1,passive:!0}),n}const $=e=>{let o=Ne(e).value;return o=o&&e.offsetHeight>0,o},M=e=>e.tabIndex>=0,le=e=>{const o=e.target;return j(o)},j=e=>{var o;let r;if(e instanceof HTMLTableCellElement){const n=(o=e.parentElement)==null?void 0:o.previousElementSibling;if(n){const s=Array.from(n.children)[e.cellIndex];s&&(r=s)}}else if(e instanceof HTMLTableRowElement){const n=e.previousElementSibling;n&&(r=n)}return r&&(!M(r)||!$(r))?j(r):r},He=e=>{var o;const r=e.target;let n;if(r instanceof HTMLTableCellElement){const s=(o=r.parentElement)==null?void 0:o.parentElement;if(s){const c=s.firstElementChild.children[r.cellIndex];c&&(n=c)}}else if(r instanceof HTMLTableRowElement){const s=r.parentElement;if(s){const c=s.firstElementChild;c&&(n=c)}}return n&&(!M(n)||!$(n))?F(n):n},ae=e=>{const o=e.target;return F(o)},F=e=>{var o;let r;if(e instanceof HTMLTableCellElement){const n=(o=e.parentElement)==null?void 0:o.nextElementSibling;if(n){const s=Array.from(n.children)[e.cellIndex];s&&(r=s)}}else if(e instanceof HTMLTableRowElement){const n=e.nextElementSibling;n&&(r=n)}return r&&(!M(r)||!$(r))?F(r):r},Ve=e=>{var o;const r=e.target;let n;if(r instanceof HTMLTableCellElement){const s=(o=r.parentElement)==null?void 0:o.parentElement;if(s){const c=s.lastElementChild.children[r.cellIndex];c&&(n=c)}}else if(r instanceof HTMLTableRowElement){const s=r.parentElement;if(s){const c=s.lastElementChild;c&&(n=c)}}return n&&(!M(n)||!$(n))?j(n):n},se=e=>{const o=e.target;return q(o)},q=e=>{var o;let r;if(e.previousElementSibling)r=e.previousElementSibling;else{const n=(o=e.parentElement)==null?void 0:o.previousElementSibling;r=n==null?void 0:n.lastElementChild}return r&&(!M(r)||!$(r))?q(r):r},ce=e=>{const o=e.target;return U(o)},U=e=>{var o;let r;if(e.nextElementSibling)r=e.nextElementSibling;else{const n=(o=e.parentElement)==null?void 0:o.nextElementSibling;r=n==null?void 0:n.firstElementChild}return r&&(!M(r)||!$(r))?U(r):r},ie=e=>{const o=e.target.parentElement.firstElementChild;return o&&(!M(o)||!$(o))?U(o):o},de=e=>{const o=e.target.parentElement.lastElementChild;return o&&(!M(o)||!$(o))?q(o):o},H=["alt","control","shift","meta"],We={ArrowUp:"up",ArrowDown:"down",ArrowLeft:"left",ArrowRight:"right"},G={"keydown.up":e=>{const o=le(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.down":e=>{const o=ae(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.left":e=>{const o=se(e);e.preventDefault(),e.stopPropagation(),o&&o.focus()},"keydown.right":e=>{const o=ce(e);e.preventDefault(),e.stopPropagation(),o&&o.focus()},"keydown.control.up":e=>{const o=He(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.control.down":e=>{const o=Ve(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.control.left":e=>{const o=ie(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.control.right":e=>{const o=de(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.end":e=>{const o=de(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.enter":e=>{if(e.target instanceof HTMLTableCellElement){e.preventDefault(),e.stopPropagation();const o=ae(e);o&&o.focus()}},"keydown.shift.enter":e=>{if(e.target instanceof HTMLTableCellElement){e.preventDefault(),e.stopPropagation();const o=le(e);o&&o.focus()}},"keydown.home":e=>{const o=ie(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.tab":e=>{const o=ce(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())},"keydown.shift.tab":e=>{const o=se(e);o&&(e.preventDefault(),e.stopPropagation(),o.focus())}};function Y(e){const o=l=>{let i=null;return l.parent&&(typeof l.parent=="string"?i=document.querySelector(l.parent):l.parent instanceof HTMLElement?i=l.parent:i=l.parent.value),i},r=l=>{const i=o(l);let f=[];if(typeof l.selectors=="string")f=i?Array.from(i.querySelectorAll(l.selectors)):Array.from(document.querySelectorAll(l.selectors));else if(Array.isArray(l.selectors))for(const a of l.selectors)a instanceof HTMLElement?f.push(a):f.push(a.$el);else if(l.selectors instanceof HTMLElement)f.push(l.selectors);else if(Array.isArray(l.selectors.value))for(const a of l.selectors.value)a instanceof HTMLElement?f.push(a):f.push(a.$el);else f.push(l.selectors.value);return f},n=l=>{const i=o(l);let f=[];return l.selectors?f=r(l):i&&(f=Array.from(i.children).filter(a=>M(a)&&$(a))),f},s=l=>i=>{const f=We[i.key]||i.key.toLowerCase();if(H.includes(f))return;const a=l.handlers||G;for(const d of Object.keys(a)){const[u,...m]=d.split(".");if(u==="keydown"&&m.includes(f)){const p=a[d],x=m.filter(b=>H.includes(b)),w=H.some(b=>{const k=b.charAt(0).toUpperCase()+b.slice(1);return i.getModifierState(k)});if(x.length>0){if(w){for(const b of H)if(m.includes(b)){const k=b.charAt(0).toUpperCase()+b.slice(1);i.getModifierState(k)&&p(i)}}}else w||p(i)}}},c=[];t.onMounted(()=>{for(const l of e){const i=o(l),f=n(l),a=s(l),d=i?[i]:f;for(const u of d){const{focused:m}=Pe(t.ref(u)),p=t.watch(m,x=>{x?u.addEventListener("keydown",a):u.removeEventListener("keydown",a)});c.push(p)}}}),t.onBeforeUnmount(()=>{for(const l of c)l()})}function z(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function I(e){return typeof e=="function"?e():t.unref(e)}const X=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const je=e=>e!=null,Fe=Object.prototype.toString,fe=e=>Fe.call(e)==="[object Object]",R=()=>{},J=qe();function qe(){var e,o;return X&&((e=window==null?void 0:window.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((o=window==null?void 0:window.navigator)==null?void 0:o.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function Ue(e){return t.getCurrentInstance()}function Ge(...e){if(e.length!==1)return t.toRef(...e);const o=e[0];return typeof o=="function"?t.readonly(t.customRef(()=>({get:o,set:R}))):t.ref(o)}function Ye(e,o=!0,r){Ue()?t.onMounted(e,r):o?e():t.nextTick(e)}const Q=X?window:void 0;function B(e){var o;const r=I(e);return(o=r==null?void 0:r.$el)!=null?o:r}function ue(...e){let o,r,n,s;if(typeof e[0]=="string"||Array.isArray(e[0])?([r,n,s]=e,o=Q):[o,r,n,s]=e,!o)return R;Array.isArray(r)||(r=[r]),Array.isArray(n)||(n=[n]);const c=[],l=()=>{c.forEach(d=>d()),c.length=0},i=(d,u,m,p)=>(d.addEventListener(u,m,p),()=>d.removeEventListener(u,m,p)),f=t.watch(()=>[B(o),I(s)],([d,u])=>{if(l(),!d)return;const m=fe(u)?{...u}:u;c.push(...r.flatMap(p=>n.map(x=>i(d,p,x,m))))},{immediate:!0,flush:"post"}),a=()=>{f(),l()};return z(a),a}function Xe(){const e=t.ref(!1),o=t.getCurrentInstance();return o&&t.onMounted(()=>{e.value=!0},o),e}function me(e){const o=Xe();return t.computed(()=>(o.value,!!e()))}function pe(e,o,r={}){const{window:n=Q,...s}=r;let c;const l=me(()=>n&&"MutationObserver"in n),i=()=>{c&&(c.disconnect(),c=void 0)},f=t.computed(()=>{const m=I(e),p=(Array.isArray(m)?m:[m]).map(B).filter(je);return new Set(p)}),a=t.watch(()=>f.value,m=>{i(),l.value&&m.size&&(c=new MutationObserver(o),m.forEach(p=>c.observe(p,s)))},{immediate:!0,flush:"post"}),d=()=>c==null?void 0:c.takeRecords(),u=()=>{a(),i()};return z(u),{isSupported:l,stop:u,takeRecords:d}}function Je(e,o,r={}){const{window:n=Q,...s}=r;let c;const l=me(()=>n&&"ResizeObserver"in n),i=()=>{c&&(c.disconnect(),c=void 0)},f=t.computed(()=>{const u=I(e);return Array.isArray(u)?u.map(m=>B(m)):[B(u)]}),a=t.watch(f,u=>{if(i(),l.value&&n){c=new ResizeObserver(o);for(const m of u)m&&c.observe(m,s)}},{immediate:!0,flush:"post"}),d=()=>{i(),a()};return z(d),{isSupported:l,stop:d}}function be(e,o={}){const{reset:r=!0,windowResize:n=!0,windowScroll:s=!0,immediate:c=!0,updateTiming:l="sync"}=o,i=t.ref(0),f=t.ref(0),a=t.ref(0),d=t.ref(0),u=t.ref(0),m=t.ref(0),p=t.ref(0),x=t.ref(0);function w(){const k=B(e);if(!k){r&&(i.value=0,f.value=0,a.value=0,d.value=0,u.value=0,m.value=0,p.value=0,x.value=0);return}const E=k.getBoundingClientRect();i.value=E.height,f.value=E.bottom,a.value=E.left,d.value=E.right,u.value=E.top,m.value=E.width,p.value=E.x,x.value=E.y}function b(){l==="sync"?w():l==="next-frame"&&requestAnimationFrame(()=>w())}return Je(e,b),t.watch(()=>B(e),k=>!k&&b()),pe(e,b,{attributeFilter:["style","class"]}),s&&ue("scroll",b,{capture:!0,passive:!0}),n&&ue("resize",b,{passive:!0}),Ye(()=>{c&&b()}),{height:i,bottom:f,left:a,right:d,top:u,width:m,x:p,y:x,update:b}}const Qe=e=>{const o=new DOMParser().parseFromString(e,"text/html");return Array.from(o.body.childNodes).some(r=>r.nodeType===1)},Ze=["data-colindex","data-rowindex","data-editable","contenteditable","tabindex"],Ke=["innerHTML"],_e={key:2},Z=t.defineComponent({__name:"ACell",props:{colIndex:{},rowIndex:{},store:{},addNavigation:{type:[Boolean,Object],default:!0},tabIndex:{default:0},pinned:{type:Boolean}},emits:["cellInput"],setup(e,{emit:o}){const r=o,n=t.useTemplateRef("cell"),{width:s,height:c}=be(n),l=e.store.getCellData(e.colIndex,e.rowIndex),i=t.ref(""),f=t.ref(!1),a=e.store.columns[e.colIndex],d=e.store.rows[e.rowIndex],u=a.align||"center",m=a.width||"40ch",p=t.computed(()=>e.store.getCellDisplayValue(e.colIndex,e.rowIndex)),x=t.computed(()=>typeof p.value=="string"?Qe(p.value):!1),w=t.computed(()=>{var y;return{textAlign:u,width:m,backgroundColor:f.value?"var(--sc-cell-changed-color)":"inherit",fontWeight:f.value?"bold":"inherit",paddingLeft:e.store.getIndent(e.colIndex,(y=e.store.display[e.rowIndex])==null?void 0:y.indent)}}),b=()=>{a.mask,a.modalComponent&&e.store.$patch(y=>{y.modal.visible=!0,y.modal.colIndex=e.colIndex,y.modal.rowIndex=e.rowIndex,y.modal.parent=n.value,y.modal.top=n.value.offsetTop+n.value.offsetHeight,y.modal.left=n.value.offsetLeft,y.modal.width=s.value,y.modal.height=c.value,typeof a.modalComponent=="function"?y.modal.component=a.modalComponent({table:y.table,row:d,column:a}):y.modal.component=a.modalComponent,y.modal.componentProps=a.modalComponentExtraProps})};if(e.addNavigation){let y={...G,"keydown.f2":b,"keydown.alt.up":b,"keydown.alt.down":b,"keydown.alt.left":b,"keydown.alt.right":b};typeof e.addNavigation=="object"&&(y={...y,...e.addNavigation}),Y([{selectors:n,handlers:y}])}const k=()=>{n.value&&(i.value=n.value.textContent)},E=y=>{const T=y.target;T.textContent!==i.value&&(r("cellInput",e.colIndex,e.rowIndex,T.textContent,i.value),i.value=T.textContent,a.format?(f.value=T.textContent!==e.store.getFormattedValue(e.colIndex,e.rowIndex,l),e.store.setCellText(e.colIndex,e.rowIndex,T.textContent)):(f.value=T.textContent!==l,e.store.setCellData(e.colIndex,e.rowIndex,T.textContent)))};return(y,T)=>(t.openBlock(),t.createElementBlock("td",{ref:"cell","data-colindex":y.colIndex,"data-rowindex":y.rowIndex,"data-editable":t.unref(a).edit,contenteditable:t.unref(a).edit,tabindex:y.tabIndex,spellcheck:!1,style:t.normalizeStyle(w.value),onFocus:k,onPaste:E,onInput:E,onClick:b,class:t.normalizeClass(["atable-cell",y.pinned?"sticky-column":""])},[t.unref(a).cellComponent?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(a).cellComponent),t.mergeProps({key:0,value:p.value},t.unref(a).cellComponentProps),null,16,["value"])):x.value?(t.openBlock(),t.createElementBlock("span",{key:1,innerHTML:p.value},null,8,Ke)):(t.openBlock(),t.createElementBlock("span",_e,t.toDisplayString(p.value),1))],46,Ze))}}),et=["tabindex"],tt=["tabindex"],ot=["colspan"],we=t.defineComponent({__name:"AExpansionRow",props:{rowIndex:{},store:{},tabIndex:{default:()=>-1},addNavigation:{type:[Boolean,Object]}},setup(e){const o=t.useTemplateRef("rowEl"),r=t.computed(()=>e.store.display[e.rowIndex].expanded?"▼":"►");if(e.addNavigation){const n={"keydown.control.g":s=>{s.stopPropagation(),s.preventDefault(),e.store.toggleRowExpand(e.rowIndex)}};typeof e.addNavigation=="object"&&Object.assign(n,e.addNavigation),Y([{selectors:o,handlers:n}])}return(n,s)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("tr",t.mergeProps(n.$attrs,{ref:"rowEl",tabindex:n.tabIndex,class:"expandable-row"}),[t.createElementVNode("td",{tabIndex:-1,onClick:s[0]||(s[0]=c=>n.store.toggleRowExpand(n.rowIndex)),class:"row-index"},t.toDisplayString(r.value),1),t.renderSlot(n.$slots,"row")],16,et),n.store.display[n.rowIndex].expanded?(t.openBlock(),t.createElementBlock("tr",{key:0,ref:"rowExpanded",tabindex:n.tabIndex,class:"expanded-row"},[t.createElementVNode("td",{tabIndex:-1,colspan:n.store.columns.length+1,class:"expanded-row-content"},[t.renderSlot(n.$slots,"content")],8,ot)],8,tt)):t.createCommentVNode("",!0)],64))}}),nt=["tabindex"],K=t.defineComponent({__name:"ARow",props:{rowIndex:{},store:{},tabIndex:{default:()=>-1},addNavigation:{type:[Boolean,Object],default:!1}},setup(e){const o=t.useTemplateRef("rowEl"),r=e.store.isRowVisible(e.rowIndex),n=e.store.getRowExpandSymbol(e.rowIndex);if(e.addNavigation){let s=G;typeof e.addNavigation=="object"&&(s={...s,...e.addNavigation}),Y([{selectors:o,handlers:s}])}return(s,c)=>t.withDirectives((t.openBlock(),t.createElementBlock("tr",{ref:"rowEl",tabindex:s.tabIndex,class:"table-row"},[s.store.config.view!=="uncounted"?t.renderSlot(s.$slots,"index",{key:0},()=>[s.store.config.view==="list"?(t.openBlock(),t.createElementBlock("td",{key:0,tabIndex:-1,class:t.normalizeClass(["list-index",s.store.hasPinnedColumns?"sticky-index":""])},t.toDisplayString(s.rowIndex+1),3)):s.store.config.view==="tree"?(t.openBlock(),t.createElementBlock("td",{key:1,tabIndex:-1,class:t.normalizeClass(["tree-index",s.store.hasPinnedColumns?"sticky-index":""]),onClick:c[0]||(c[0]=l=>s.store.toggleRowExpand(s.rowIndex))},t.toDisplayString(t.unref(n)),3)):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(s.$slots,"default")],8,nt)),[[t.vShow,t.unref(r)]])}}),ge=X?window:void 0;function P(e){var o;const r=I(e);return(o=r==null?void 0:r.$el)!=null?o:r}function V(...e){let o,r,n,s;if(typeof e[0]=="string"||Array.isArray(e[0])?([r,n,s]=e,o=ge):[o,r,n,s]=e,!o)return R;Array.isArray(r)||(r=[r]),Array.isArray(n)||(n=[n]);const c=[],l=()=>{c.forEach(d=>d()),c.length=0},i=(d,u,m,p)=>(d.addEventListener(u,m,p),()=>d.removeEventListener(u,m,p)),f=t.watch(()=>[P(o),I(s)],([d,u])=>{if(l(),!d)return;const m=fe(u)?{...u}:u;c.push(...r.flatMap(p=>n.map(x=>i(d,p,x,m))))},{immediate:!0,flush:"post"}),a=()=>{f(),l()};return z(a),a}let he=!1;function ye(e,o,r={}){const{window:n=ge,ignore:s=[],capture:c=!0,detectIframe:l=!1}=r;if(!n)return R;J&&!he&&(he=!0,Array.from(n.document.body.children).forEach(w=>w.addEventListener("click",R)),n.document.documentElement.addEventListener("click",R));let i=!0;const f=w=>I(s).some(b=>{if(typeof b=="string")return Array.from(n.document.querySelectorAll(b)).some(k=>k===w.target||w.composedPath().includes(k));{const k=P(b);return k&&(w.target===k||w.composedPath().includes(k))}});function a(w){const b=I(w);return b&&b.$.subTree.shapeFlag===16}function d(w,b){const k=I(w),E=k.$.subTree&&k.$.subTree.children;return E==null||!Array.isArray(E)?!1:E.some(y=>y.el===b.target||b.composedPath().includes(y.el))}const u=w=>{const b=P(e);if(w.target!=null&&!(!(b instanceof Element)&&a(e)&&d(e,w))&&!(!b||b===w.target||w.composedPath().includes(b))){if(w.detail===0&&(i=!f(w)),!i){i=!0;return}o(w)}};let m=!1;const p=[V(n,"click",w=>{m||(m=!0,setTimeout(()=>{m=!1},0),u(w))},{passive:!0,capture:c}),V(n,"pointerdown",w=>{const b=P(e);i=!f(w)&&!!(b&&!w.composedPath().includes(b))},{passive:!0}),l&&V(n,"blur",w=>{setTimeout(()=>{var b;const k=P(e);((b=n.document.activeElement)==null?void 0:b.tagName)==="IFRAME"&&!(k!=null&&k.contains(n.document.activeElement))&&o(w)},0)})].filter(Boolean);return()=>p.forEach(w=>w())}const rt={mounted(e,o){const r=!o.modifiers.bubble;if(typeof o.value=="function")e.__onClickOutside_stop=ye(e,o.value,{capture:r});else{const[n,s]=o.value;e.__onClickOutside_stop=ye(e,n,Object.assign({capture:r},s))}},unmounted(e){e.__onClickOutside_stop()}};function _(e){return typeof Window<"u"&&e instanceof Window?e.document.documentElement:typeof Document<"u"&&e instanceof Document?e.documentElement:e}function xe(e){const o=window.getComputedStyle(e);if(o.overflowX==="scroll"||o.overflowY==="scroll"||o.overflowX==="auto"&&e.clientWidth<e.scrollWidth||o.overflowY==="auto"&&e.clientHeight<e.scrollHeight)return!0;{const r=e.parentNode;return!r||r.tagName==="BODY"?!1:xe(r)}}function lt(e){const o=e||window.event,r=o.target;return xe(r)?!1:o.touches.length>1?!0:(o.preventDefault&&o.preventDefault(),!1)}const ee=new WeakMap;function at(e,o=!1){const r=t.ref(o);let n=null,s="";t.watch(Ge(e),i=>{const f=_(I(i));if(f){const a=f;if(ee.get(a)||ee.set(a,a.style.overflow),a.style.overflow!=="hidden"&&(s=a.style.overflow),a.style.overflow==="hidden")return r.value=!0;if(r.value)return a.style.overflow="hidden"}},{immediate:!0});const c=()=>{const i=_(I(e));!i||r.value||(J&&(n=V(i,"touchmove",f=>{lt(f)},{passive:!1})),i.style.overflow="hidden",r.value=!0)},l=()=>{const i=_(I(e));!i||!r.value||(J&&(n==null||n()),i.style.overflow=s,ee.delete(i),r.value=!1)};return z(l),t.computed({get(){return r.value},set(i){i?c():l()}})}function st(){let e=!1;const o=t.ref(!1);return(r,n)=>{if(o.value=n.value,e)return;e=!0;const s=at(r,n.value);t.watch(o,c=>s.value=c)}}st();const ct={key:0,id:"resizable"},it={class:"atable-header-row",tabindex:"-1"},te=t.defineComponent({__name:"ATableHeader",props:{columns:{},store:{}},setup(e){return(o,r)=>o.columns.length?(t.openBlock(),t.createElementBlock("thead",ct,[t.createElementVNode("tr",it,[o.store.zeroColumn?(t.openBlock(),t.createElementBlock("th",{key:0,id:"header-index",class:t.normalizeClass([[o.store.hasPinnedColumns?"sticky-index":"",o.store.config.view==="tree"?"tree-index":"",o.store.config.view==="list-expansion"?"list-expansion-index":""],"list-index"])},null,2)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.columns,(n,s)=>(t.openBlock(),t.createElementBlock("th",{key:n.name,tabindex:"-1",style:t.normalizeStyle(o.store.getHeaderCellStyle(n)),class:t.normalizeClass(n.pinned?"sticky-column":"")},[t.renderSlot(o.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(n.label||String.fromCharCode(s+97).toUpperCase()),1)])],6))),128))])])):t.createCommentVNode("",!0)}}),oe=t.defineComponent({__name:"ATableModal",props:{colIndex:{},rowIndex:{},store:{},container:{}},setup(e){const o=t.useTemplateRef("amodal"),{width:r,height:n}=be(o),s=t.computed(()=>{var d,u;const l=((d=e.container)==null?void 0:d.offsetWidth)||0,i=((u=e.container)==null?void 0:u.offsetHeight)||0,f=e.store.modal.left+r.value>l?e.store.modal.left-(r.value-e.store.modal.width):e.store.modal.left,a=e.store.modal.top+n.value>i?e.store.modal.top-n.value-e.store.modal.height:e.store.modal.top;return{left:`${f}px`,top:`${a}px`}}),c=l=>{l.stopPropagation()};return(l,i)=>(t.openBlock(),t.createElementBlock("div",{class:"amodal",ref:"amodal",tabindex:"-1",onClick:c,onInput:c,style:t.normalizeStyle(s.value)},[t.renderSlot(l.$slots,"default")],36))}}),ke=e=>{const o=e.id||crypto.randomUUID();return Se.defineStore(`table-${o}`,()=>{const n=()=>{const g={};for(const[h,v]of c.value.entries())for(const[C,A]of l.value.entries())g[`${h}:${C}`]=A[v.name];return g},s=g=>{const h=[Object.assign({},{rowModified:!1})];if(g&&"0:0"in g)return g;const v=new Set;for(let C=l.value.length-1;C>=0;C--){const A=l.value[C];A.parent&&v.add(A.parent),h[C]={childrenOpen:!1,expanded:!1,indent:A.indent||null,isParent:v.has(C),isRoot:A.parent===null||A.parent===void 0,rowModified:!1,open:A.parent===null||A.parent===void 0,parent:A.parent}}return h},c=t.ref(e.columns),l=t.ref(e.rows),i=t.ref(e.config||{}),f=t.ref(e.table||n()),a=t.ref(s(e.display)),d=t.ref(e.modal||{visible:!1}),u=t.ref({}),m=t.computed(()=>c.value.some(g=>g.pinned)),p=t.computed(()=>`${Math.ceil(l.value.length/100+1)}ch`),x=t.computed(()=>["list","tree","list-expansion"].includes(i.value.view)),w=(g,h)=>f.value[`${g}:${h}`],b=(g,h,v)=>{const C=`${g}:${h}`,A=c.value[g];f.value[C]!==v&&(a.value[h].rowModified=!0),f.value[C]=v,l.value[h][A.name]=v},k=(g,h,v)=>{const C=`${g}:${h}`;f.value[C]!==v&&(a.value[h].rowModified=!0,u.value[C]=v)},E=g=>({minWidth:g.width||"40ch",textAlign:g.align||"center",width:i.value.fullWidth?"auto":null}),y=g=>i.value.view!=="tree"||a.value[g].isRoot||a.value[g].open,T=g=>i.value.view!=="tree"?"":a.value[g].isRoot||a.value[g].isParent?a.value[g].childrenOpen?"-":"+":"",Ee=g=>{if(i.value.view==="tree"){a.value[g].childrenOpen=!a.value[g].childrenOpen;for(let h=l.value.length-1;h>=0;h--)a.value[h].parent===g&&(a.value[h].open=!a.value[h].open,a.value[h].childrenOpen&&Ee(h))}else i.value.view==="list-expansion"&&(a.value[g].expanded=!a.value[g].expanded)},ft=(g,h)=>{const v=w(g,h);return Ce(g,h,v)},Ce=(g,h,v)=>{const C=c.value[g],A=l.value[h],N=C.format;return N?typeof N=="function"?N(v,{table:f.value,row:A,column:C}):typeof N=="string"?Function(`"use strict";return (${N})`)()(v,{table:f.value,row:A,column:C}):v:v};return{columns:c,config:i,display:a,modal:d,rows:l,table:f,updates:u,hasPinnedColumns:m,numberedRowWidth:p,zeroColumn:x,closeModal:g=>{var h;g.target instanceof Node&&(h=d.value.parent)!=null&&h.contains(g.target)||d.value.visible&&(d.value.visible=!1)},getCellData:w,getCellDisplayValue:ft,getFormattedValue:Ce,getHeaderCellStyle:E,getIndent:(g,h)=>h&&g===0&&h>0?`${h}ch`:"inherit",getRowExpandSymbol:T,isRowVisible:y,setCellData:b,setCellText:k,toggleRowExpand:Ee}})()},ve=((e,o)=>{const r=e.__vccOpts||e;for(const[n,s]of o)r[n]=s;return r})(t.defineComponent({__name:"ATable",props:{id:{},modelValue:{},columns:{},rows:{default:()=>[]},config:{default:()=>new Object}},emits:["update:modelValue","cellUpdate"],setup(e,{expose:o,emit:r}){const n=r,s=t.useTemplateRef("table"),c=e.modelValue?e.modelValue:e.rows,l=ke({columns:e.columns,rows:c,id:e.id,config:e.config});l.$onAction(({name:a,store:d,args:u,after:m})=>{if(a==="setCellData"){const[p,x,w]=u,b=d.getCellData(p,x);m(()=>{n("cellUpdate",p,x,w,b)})}}),t.watch(()=>l.rows,a=>{n("update:modelValue",a)},{deep:!0}),t.onMounted(()=>{e.columns.some(a=>a.pinned)&&(f(),l.config.view==="tree"&&pe(s,f,{childList:!0,subtree:!0}))});const i=(a,d,u,m)=>{n("cellUpdate",a,d,u,m)},f=()=>{const a=s.value,d=a.rows[0],u=a.rows[1],m=d?Array.from(d.cells):[];for(const[p,x]of m.entries()){const w=u==null?void 0:u.cells[p];w&&(x.style.width=`${w.offsetWidth}px`)}for(const p of a.rows){let x=0;const w=[];for(const b of p.cells)(b.classList.contains("sticky-column")||b.classList.contains("sticky-index"))&&(b.style.left=`${x}px`,x+=b.offsetWidth,w.push(b));w.length>0&&w[w.length-1].classList.add("sticky-column-edge")}};return window.addEventListener("keydown",a=>{if(a.key==="Escape"&&l.modal.visible){l.modal.visible=!1;const d=l.modal.parent;d&&t.nextTick().then(()=>{d.focus()})}}),o({store:l}),(a,d)=>t.withDirectives((t.openBlock(),t.createElementBlock("table",{ref:"table",class:"atable",style:t.normalizeStyle({width:t.unref(l).config.fullWidth?"100%":"auto"})},[t.renderSlot(a.$slots,"header",{data:t.unref(l)},()=>[t.createVNode(te,{columns:t.unref(l).columns,store:t.unref(l)},null,8,["columns","store"])],!0),t.createElementVNode("tbody",null,[t.renderSlot(a.$slots,"body",{data:t.unref(l)},()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).rows,(u,m)=>(t.openBlock(),t.createBlock(K,{key:u.id,row:u,rowIndex:m,store:t.unref(l)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).columns,(p,x)=>(t.openBlock(),t.createBlock(Z,{key:p.name,store:t.unref(l),col:p,spellcheck:"false",pinned:p.pinned,rowIndex:m,colIndex:x,component:p.cellComponent,style:t.normalizeStyle({textAlign:(p==null?void 0:p.align)||"center",minWidth:(p==null?void 0:p.width)||"40ch",width:t.unref(l).config.fullWidth?"auto":null}),onCellInput:i},null,8,["store","col","pinned","rowIndex","colIndex","component","style"]))),128))]),_:2},1032,["row","rowIndex","store"]))),128))],!0)]),t.renderSlot(a.$slots,"footer",{data:t.unref(l)},void 0,!0),t.renderSlot(a.$slots,"modal",{data:t.unref(l)},()=>[t.withDirectives(t.createVNode(oe,{colIndex:t.unref(l).modal.colIndex,rowIndex:t.unref(l).modal.rowIndex,store:t.unref(l),container:t.unref(s)},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(l).modal.component),t.mergeProps({key:`${t.unref(l).modal.rowIndex}:${t.unref(l).modal.colIndex}`,colIndex:t.unref(l).modal.colIndex,rowIndex:t.unref(l).modal.rowIndex,store:t.unref(l)},t.unref(l).modal.componentProps),null,16,["colIndex","rowIndex","store"]))]),_:1},8,["colIndex","rowIndex","store","container"]),[[t.vShow,t.unref(l).modal.visible]])],!0)],4)),[[t.unref(rt),t.unref(l).closeModal]])}}),[["__scopeId","data-v-7480394f"]]);function dt(e){e.component("ACell",Z),e.component("AExpansionRow",we),e.component("ARow",K),e.component("ATable",ve),e.component("ATableHeader",te),e.component("ATableModal",oe)}S.ACell=Z,S.AExpansionRow=we,S.ARow=K,S.ATable=ve,S.ATableHeader=te,S.ATableModal=oe,S.createTableStore=ke,S.install=dt,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
3
3
  //# sourceMappingURL=atable.umd.cjs.map