UNPKG

vexip-ui

Version:

A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good

3 lines (2 loc) 21.1 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Xt=require("../tree/hooks.cjs"),S=require("vue"),m=require("@vexip-ui/utils"),N=require("./symbol.cjs"),ae=Object.freeze({sum:NaN,min:NaN,max:NaN});let qt=1;function B(){return`__vxp-table-key-${qt++}`}function Gt(D){return D+1}function Yt(D){const t=S.reactive({...D,columns:[],normalColumns:[],allColumns:[],summaries:[],data:[],dataKey:D.dataKey??N.DEFAULT_KEY_FIELD,rowData:[],treeRowData:[],width:0,rightFixedColumns:[],leftFixedColumns:[],aboveSummaries:[],belowSummaries:[],rowMinHeight:D.rowMinHeight||36,rowDraggable:!!D.rowDraggable,columnMap:new Map,rowMap:new Map,summaryMap:new Map,idMaps:new WeakMap,checkedAll:!1,partial:!1,widths:new Map,sorters:new Map,filters:new Map,resized:new Set,bodyYScroll:0,bodyXScroll:0,padTop:0,startRow:0,endRow:0,dragging:!1,heightBITree:null,virtualData:[],totalHeight:D.rowMinHeight*D.data.length,colResizing:!1,resizeLeft:0,cellSpanMap:new Map,collapseMap:new Map,sidePadding:D.sidePadding||[0,0],locked:!1,barScrolling:!1,heightTrigger:0});J(D.columns),Q(D.summaries),Z(D.data);const q=S.computed(()=>typeof t.dataFilter=="function"?t.rowData.filter(e=>t.dataFilter(e.data)):t.rowData),j=S.computed(()=>t.customFilter?q.value:Lt(t.filters,q.value,t.singleFilter)),G=S.computed(()=>t.customSorter?j.value:_t(t.sorters,j.value,t.columns,t.singleSorter)),W=S.computed(()=>{const e=Pt(t.currentPage,t.pageSize,G.value);for(let n=0,o=e.length;n<o;++n)e[n].listIndex=n,e[n].last=n===o-1;return e}),ie=S.computed(()=>new Set(W.value.map(e=>e.key))),Y=S.computed(()=>{const e=W.value,n=t.columns.find(l=>l.type==="selection"),o=new Set;if(n&&typeof n.disableRow=="function"){const l=n.disableRow;for(let a=0,i=e.length;a<i;++a){const r=e[a];l(r.data)&&o.add(r.key)}}return o}),re=S.computed(()=>{const e=W.value,n=t.columns.find(l=>l.type==="expand"),o=new Set;if(n&&typeof n.disableRow=="function"){const l=n.disableRow;for(let a=0,i=e.length;a<i;++a){const r=e[a];l(r.data)&&o.add(r.key)}}return o}),ce=S.computed(()=>{const e=W.value,n=t.columns.find(l=>l.type==="drag"),o=new Set;if(n&&typeof n.disableRow=="function"){const l=n.disableRow;for(let a=0,i=e.length;a<i;++a){const r=e[a];l(r.data)&&o.add(r.key)}}return o}),U=S.computed(()=>!t.disabledTree&&t.rowData.some(e=>{var n;return(n=e.children)==null?void 0:n.length})),de=S.computed(()=>!!t.columns.find(e=>"type"in e&&e.type==="drag")),ue=S.computed(()=>!!W.value.find(e=>e.dragging)),fe=S.computed(()=>_()),he=S.computed(()=>_(t.normalColumns)),pe=S.computed(()=>_(t.leftFixedColumns)),ge=S.computed(()=>_(t.rightFixedColumns)),me=S.computed(()=>t.columns.find(e=>e.type==="expand")),we=S.computed(()=>{const{columns:e,summaries:n,data:o}=t,l=new Map;if(!n.length)return l;for(const a of e){const i=a.key;if(a.type||a.noSummary){l.set(i,ae);continue}const r=typeof a.accessor=="function"?a.accessor:c=>c[i];let f=0,u=1/0,h=-1/0,d=!1;for(let c=0,s=o.length;c<s;++c){const p=r(o[c],c),w=parseFloat(p);Number.isNaN(w)||(f+=w,u=Math.min(u,w),h=Math.max(h,w),d=!0)}d?l.set(i,{sum:f,min:u,max:h}):l.set(i,ae)}return l}),ye=S.computed(()=>V(t.aboveSummaries)),be=S.computed(()=>V()),xe=S.computed(()=>t.columns.find(e=>!e.type&&e.indented)),Se=S.computed(()=>!!(t.leftFixedColumns.length||t.rightFixedColumns.length)),T=S.reactive({filteredData:j,sortedData:G,processedData:W,visibleKeys:ie,disableCheckRows:Y,disableExpandRows:re,disableDragRows:ce,usingTree:U,hasDragColumn:de,rowDragging:ue,totalWidths:fe,normalWidths:he,leftFixedWidths:pe,rightFixedWidths:ge,expandColumn:me,summaryData:we,topFixedHeights:ye,bottomFixedHeights:be,indentedColumn:xe,hasFixedColumn:Se}),Ce={setColumns:m.debounceMinor(J),setSummaries:m.debounceMinor(Q),setData:m.debounceMinor(Z),updateTotalHeight:m.debounceMinor(le),isGroupColumn:O,buildSummaryKey:L,setColumnProp:Re,setSummaryProp:ve,setDataKey:De,setCurrentPage:Te,setPageSize:Ae,setRowClass:We,setRowStyle:Ee,setRowAttrs:Ne,setCellClass:He,setCellStyle:Ie,setCellAttrs:Ke,setHeadClass:Le,setHeadStyle:_e,setHeadAttrs:Pe,setFootClass:$e,setFootStyle:ze,setFootAttrs:Be,setTableWidth:je,setRowHeight:Xe,setRowMinHeight:qe,setCellHeight:Ge,setVirtual:et,setRowDraggable:Ye,setBodyYScroll:Ue,setBodyXScroll:Ve,setBorder:Je,setStripe:Qe,setHighlight:Ze,setRowProp:tt,setLocale:nt,setTooltipTheme:ot,setTooltipWidth:st,setSingleSorter:lt,setSingleFilter:at,setDragging:it,setKeyConfig:rt,setDisabledTree:ct,setNoCascaded:dt,setColResizable:ut,setCustomSorter:ft,setCustomFilter:ht,setColumnResizing:pt,setResizeLeft:gt,setExpandRenderer:mt,setCellSpan:wt,setSidePadding:yt,setBorderWidth:bt,setDataFilter:xt,setEllipsis:St,setLocked:Ct,setBarScrolling:kt,handleSort:Mt,clearSort:te,handleFilter:Rt,clearFilter:ne,toggleFilterItemActive:Ht,refreshRowIndex:X,handleCheck:Tt,handleCheckAll:At,clearCheckAll:oe,setRenderRows:se,handleExpand:Wt,handleDrag:Et,collectUnderRows:P,setTreeExpanded:Nt,getParentRow:$t,handleColumnResize:zt,getCurrentData:jt,createMinRowState:K,flatTreeRows:ee,refreshRowDepth:Fe,triggerHeightChange:ke,queryRow:Ot};S.watchEffect(()=>{t.heightBITree=m.createBITree(W.value.length,t.rowHeight||t.rowMinHeight),t.totalHeight=-1,le()}),S.watchEffect(Bt);function ke(){++t.heightTrigger,t.heightTrigger>=Number.MAX_SAFE_INTEGER&&(t.heightTrigger=0)}function _(e=t.columns){const n=t.widths,o=[0];let l=0;for(let a=0,i=e.length;a<i;++a){const f=e[a].key,u=n.get(f)||0;l+=u,o.push(l)}return o}function V(e=t.belowSummaries){const n=t.rowMap,o=[0];let l=0;for(let a=0,i=e.length;a<i;++a){const r=e[a],f=L(r.key),u=n.get(f);u&&(l+=u.height||0),o.push(l)}return o}function K(e){return{key:e,cellHeights:{},height:t.rowHeight??t.rowMinHeight}}function O(e){var n;return!!((n=e.children)!=null&&n.length)}function Me(e){const n=[],o=[],l=new Map,a=new Set,i=u=>u===!0||u==="left"?-1:u==="right"?1:0,r=(u,h,d=0,c=[])=>{u=u.filter(g=>!("children"in g)||O(g)).sort((g,y)=>(g.order||0)-(y.order||0)).sort((g,y)=>i(g.fixed)-i(y.fixed)),h=h===!0?"left":h;const s=u,p=c[d]??(c[d]=[]);let w=d>0?c[d-1].length-1:0;for(const{...g}of s){if(m.isNull(h)||(g.fixed=h),p[w]=g,O(g)){const y=r(g.children,g.fixed,d+1,c);g.key=Symbol("TableColumnGroup"),g.headSpan=y-w,w=y}else{const y=g.type&&N.columnTypes.includes(g.type);y&&(a.has(g.type)&&console.warn(`[vexip-ui:Table] Table has duplicate column with type '${g.type}'`),a.add(g.type));let C=g.key;m.isNull(C)&&(y?C=`__vxp_${g.type}`:(console.warn("[vexip-ui:Table] Table column requires key prop, but missing"),C=B())),g.key=C,o.push(g),w+=1}l.set(g.key,g)}return w};r(e,void 0,0,n);let f=0;for(const u of n)f=Math.max(u.length,f);for(const u of n)u.length&&(m.getLast(u).last=!0),u.length=f;for(let u=0,h=n.length;u<f;++u){let d=1;for(let c=h-1;c>=0;--c){const s=n[c][u];s?(s.colIndex=u,s.rowSpan=d,d=1):++d}}return{allColumns:n,baseColumns:o,columnMap:l}}function J(e){const{widths:n,sorters:o,filters:l}=t,{allColumns:a,baseColumns:i,columnMap:r}=Me(e),f=[],u=[],h=[];for(let d=0,c=i.length;d<c;++d){const s=i[d];if(s.first=!1,s.last=!1,s.index=d,s.type&&N.columnTypes.includes(s.type)){switch(s.type){case"order":{s.truthIndex=!!s.truthIndex,typeof s.orderLabel!="function"&&(s.orderLabel=Gt),m.isNull(s.width)&&(s.width=60);break}case"selection":{s.selectionSize=s.selectionSize||"default",typeof s.disableRow!="function"&&(s.disableRow=m.toFalse),m.isNull(s.width)&&(s.width=40);break}case"expand":{typeof s.disableRow!="function"&&(s.disableRow=m.toFalse),m.isNull(s.width)&&(s.width=40);break}case"drag":{typeof s.disableRow!="function"&&(s.disableRow=m.toFalse),m.isNull(s.width)&&(s.width=40);break}}s.key||(s.key=`__vxp_${s.type}-${d}`)}else s.type=void 0;n.set(s.key,typeof s.width=="string"?100:s.width||100),o.set(s.key,It(s.sorter)),l.set(s.key,Kt(s.filter));const p=s.fixed;p===!0||p==="left"?h.push(s):p==="right"?u.push(s):f.push(s)}if(t.allColumns.length>a.length)for(let d=a.length-1,c=t.allColumns.length;d<c;++d)t.rowMap.delete(`${N.TABLE_HEAD_PREFIX}${d}`);for(let d=0,c=a.length;d<c;++d){const s=`${N.TABLE_HEAD_PREFIX}${d}`;t.rowMap.set(s,K(s))}if(t.columnMap=r,t.columns=Array.from(h).concat(f,u),t.normalColumns=f,t.allColumns=a,t.columns.length){for(const d of t.columns)if(!d.type){d.first=!0;break}m.getLast(t.columns).last=!0}h.length&&(t.leftFixedColumns=h),u.length&&(t.rightFixedColumns=u)}function Re(e,n,o){t.columnMap.has(e)&&(t.columnMap.get(e)[n]=o)}function L(e){return typeof e=="symbol"?e:`${N.TABLE_FOOT_PREFIX}${e}`}function Q(e){e=Array.from(e).sort((i,r)=>(i.order||0)-(r.order||0));const n=new Set(t.summaries.map(i=>i.key)),o=[],l=[],a=new Map;for(let i=0,r=e.length;i<r;++i){const f={...e[i]};let u=f.key;if(m.isNull(u)&&(console.error("[vexip-ui:Table] Table summary requires key prop, but missing"),u=B()),f.key=u,(f.above?o:l).push(f),!n.has(f.key)){const h=L(f.key);t.rowMap.set(h,K(h))}n.delete(f.key),a.set(f.key,f)}if(t.summaries=Array.from(o).concat(l),t.summaryMap=a,o.length&&(t.aboveSummaries=o),l.length&&(t.belowSummaries=l),n.size)for(const i of n)t.rowMap.delete(L(i))}function ve(e,n,o){t.summaryMap.has(e)&&(t.summaryMap.get(e)[n]=o)}function De(e){const n=t.dataKey;if(!m.isNull(e)&&n!==e){const{rowData:o,idMaps:l}=t;t.dataKey=e,o.forEach(a=>{let i=a.data[e];m.isNull(i)&&(i=B()),a.key=i,l.set(a.data,i)})}}function P(e,n=[]){var o;if(e.treeExpanded&&((o=e.children)!=null&&o.length))for(const l of e.children)n.push(l),P(l,n);return n}function Z(e){const n=[],o=new Map,{allColumns:l,dataKey:a,keyConfig:i,idMaps:r,disabledTree:f}=t,u=t.rowMap,h=!!t.virtual,{children:d,checked:c,height:s,expanded:p,treeExpanded:w}=i;for(let y=0,C=l.length;y<C;++y){const k=`${N.TABLE_HEAD_PREFIX}${y}`;o.set(k,u.get(k)||K(k))}for(const y of t.summaries){const C=L(y.key);o.set(C,u.get(C)||K(C))}const g=(y,C,k)=>{for(let M=0,R=y.length;M<R;++M){const x=y[M];let v=x[a];m.isNull(v)&&(v=r.get(x),m.isNull(v)&&(v=B()));let b;if(u.has(v)){b=u.get(v);const{[c]:E,[s]:I,[p]:F,[w]:z}=b.data!==x?Object.assign(b.data,x):b.data;b.checked=m.isNull(E)?b.checked:!!E,b.height=m.isNull(I)?b.height:m.toNumber(I),b.expanded=m.isNull(F)?b.expanded:!!F,b.treeExpanded=m.isNull(z)?b.treeExpanded:!!z}else{const{[c]:E,[s]:I,[p]:F,[w]:z}=x;b={key:v,hidden:h,checked:!!E,height:m.toNumber(I),expanded:!!F,hover:!1,expandHeight:0,index:-1,children:[],depth:0,treeExpanded:!!z,partial:!1,dragging:!1,listIndex:0,cellHeights:S.reactive({}),last:!1,expandAnimate:!1,data:x},r.set(x,v)}k&&(b.parent=k.key,b.depth=k.depth+1),b.children=[];const A=b.data[d];A!=null&&A.length&&g(A,b.children,b),C.push(b),o.set(v,b)}};g(e,n),t.rowMap=o,t.treeRowData=n,f?t.rowData=n:ee(),t.data=e,X(),$()}function ee(){if(t.disabledTree)return;const e=[];for(const n of t.treeRowData)e.push(n),P(n,e);t.rowData=e}function Fe(){m.walkTree(t.treeRowData,(e,n)=>{e.depth=n})}function Te(e){t.currentPage=e??1}function Ae(e){t.pageSize=e||0}function We(e){t.rowClass=e??""}function Ee(e){t.rowStyle=e??""}function Ne(e){t.rowAttrs=e??null}function He(e){t.cellClass=e??""}function Ie(e){t.cellStyle=e??""}function Ke(e){t.cellAttrs=e??null}function Le(e){t.headClass=e??""}function _e(e){t.headStyle=e??""}function Pe(e){t.headAttrs=e??null}function $e(e){t.footClass=e??""}function ze(e){t.footStyle=e??""}function Be(e){t.footAttrs=e??null}function je(e){e=m.toNumber(e);const{columns:n,widths:o,resized:l,sidePadding:a}=t,i=[],r=[];let f=e-(a[0]||0)-(a[1]||0);for(let c=0,s=n.length;c<s;++c){const p=n[c],{minWidth:w=0,maxWidth:g=1/0}=p;if(l.has(p.key))f-=o.get(p.key),i.push(p);else if(p.width)if(typeof p.width=="string"){const y=m.boundRange(m.toNumber(p.width),0,100);if(y){const C=Math.round(m.boundRange(e*y/100,w,g));f-=C,o.set(p.key,C),i.push(p)}else r.push(p)}else f-=m.boundRange(p.width,w,g),i.push(p);else r.push(p)}const u=r.length,h=Oe(r,f);let d=0;for(let c=0;c<u;++c){const s=r[c],p=Math[c%2?"ceil":"floor"](h[c]);c<u-1&&(d+=p),o.set(s.key,p)}u&&f>=d+m.getLast(h)&&o.set(m.getLast(r).key,f-d),t.width=e}function Oe(e,n){const o=e.length,l=Math.max(n/o,100),a=e.map(c=>{let s=l;return c.minWidth!=null&&(s=Math.max(s,c.minWidth)),c.maxWidth!=null&&(s=Math.min(s,c.maxWidth)),s}),i=a.reduce((c,s)=>c+s,0);let r=n-i;const f=c=>e[c].maxWidth==null||a[c]<e[c].maxWidth,u=c=>e[c].minWidth==null||a[c]>e[c].minWidth,h=.1;let d=!1;for(;Math.abs(r)>h;){const c=a.map((p,w)=>r>0&&f(w)||r<0&&u(w)?w:-1).filter(p=>p!==-1);if(c.length===0){d=!1;break}const s=r/c.length;for(const p of c){const w=a[p];let g=w+s;e[p].minWidth!=null&&(g=Math.max(g,e[p].minWidth)),e[p].maxWidth!=null&&(g=Math.min(g,e[p].maxWidth)),r-=g-w,a[p]=g}d=!0}return!d&&r>h&&(a[o-1]+=r),a}function Xe(e){t.rowHeight=e}function qe(e){t.rowMinHeight=e}function Ge(e,n,o){!m.isNull(o)&&t.rowMap.has(e)&&(t.rowMap.get(e).cellHeights[n]=o)}function Ye(e){t.rowDraggable=!!e}function Ue(e){t.bodyYScroll=e}function Ve(e){t.bodyXScroll=e}function Je(e){t.border=!!e}function Qe(e){t.stripe=!!e}function Ze(e){t.highlight=!!e}function et(e){t.virtual=!!e}function tt(e,n,o){const l=t.rowMap.get(e);l&&l[n]!==o&&(l[n]=o)}function nt(e){t.locale=e}function ot(e){t.tooltipTheme=e}function st(e){t.tooltipWidth=e}function lt(e){t.singleSorter=!!e}function at(e){t.singleFilter=!!e}function it(e){t.dragging=!!e}function rt(e){t.keyConfig=e}function ct(e){t.disabledTree=!!e}function dt(e){t.noCascaded=!!e}function ut(e){t.colResizable=e===!0?"lazy":e}function ft(e){t.customSorter=!!e}function ht(e){t.customFilter=!!e}function pt(e){t.colResizing=!!e}function gt(e){t.resizeLeft=e}function mt(e){t.expandRenderer=e}function wt(e){t.cellSpan=e}function yt(e){t.sidePadding=Array.isArray(e)?e:[e,e]}function bt(e){t.borderWidth=Math.max(e,0)}function xt(e){t.dataFilter=e}function St(e){t.ellipsis=e}function Ct(e){t.locked=e}function kt(e){t.barScrolling=e}function Mt(e,n){t.sorters.has(e)&&(t.singleSorter&&n&&te(),t.sorters.get(e).type=n)}function te(){const e=t.sorters;for(const n of e.values())n.type=null}function Rt(e,n){t.filters.has(e)&&(t.singleFilter&&(Array.isArray(n)?n.length:n)&&ne(),t.filters.get(e).active=Array.isArray(n)?Array.from(n):n)}function ne(){const e=t.filters;for(const n of e.values()){n.active=null;for(const o of n.options)o.active=!1}}const{updateCheckedUpward:vt,updateCheckedDown:Dt}=Xt.useCascadedChecked({getNode:e=>t.rowMap.get(e),disableNode:e=>Y.value.has(e.key)});function Ft(e){const{rowMap:n,rowData:o}=t,{disableCheckRows:l}=T;if(!n.has(e))return;const a=[n.get(e)].concat(o.filter(i=>l.has(i.key)&&i.checked));for(let i=0,r=a.length;i<r;++i)vt(a[i].key),Dt(a[i].key)}function Tt(e,n,o=!1){const{rowMap:l,noCascaded:a}=t,{disableCheckRows:i}=T,r=l.get(e);r&&(o&&(oe(!0),r.checked=!!n),i.has(e)||(r.checked=!!n,r.partial=!1),!a&&Ft(e),$())}function At(){const{rowData:e,checkedAll:n}=t,{disableCheckRows:o}=T;let l=!n;if(o.size){let a=!0;for(const i of e)if(!o.has(i.key)&&!i.checked){a=!1;break}l=!a}for(const a of e)o.has(a.key)||(a.checked=l);t.checkedAll=l,t.partial=!1,$()}function oe(e=!1){const{rowData:n}=t,{disableCheckRows:o}=T;for(const l of n)(e||!o.has(l.key))&&(l.checked=!1),e&&(l.partial=!1);t.checkedAll=!1,t.partial=!1,!e&&$()}function $(){const e=t.rowData;let n=!1,o=!1,l=!1;for(let a=0,i=e.length;a<i;++a)if(e[a].checked?n=!0:o=!0,n&&o){l=!0;break}n&&!l?t.checkedAll=!0:t.checkedAll=!1,t.partial=l}function se(e,n,o=!1){const{startRow:l,endRow:a,heightBITree:i,virtualData:r}=t;if(!o&&e===l&&n===a)return;const{processedData:f}=T;if(!f.length){r.length=0;return}const u=new Set([...r]),h=[],d=[];for(let s=0,p=f.length;s<p;++s){const w=f[s];w.hidden=!(s>=e&&s<n),w.hidden?(w.hover=!1,u.has(w)&&d.push(w)):u.has(w)||h.push(w),u.delete(w)}d.push(...u);const c=Math.min(h.length,d.length);for(let s=0;s<c;++s)r[r.indexOf(d[s])]=h[s];h.length>d.length?r.push(...h.slice(c)):h.length<d.length&&(t.virtualData=r.filter(s=>!d.includes(s))),t.padTop=(i==null?void 0:i.sum(e))??0,t.startRow=e,t.endRow=n}function Wt(e,n){const{rowMap:o}=t,{disableExpandRows:l}=T;o.has(e)&&!l.has(e)&&(o.get(e).expanded=!!n)}function Et(e,n){const{rowMap:o}=t,{disableDragRows:l}=T;o.has(e)&&!l.has(e)&&(o.get(e).dragging=!!n)}function Nt(e,n){var f;if(!U.value)return;const{rowMap:o,rowData:l,virtual:a}=t,i=o.get(e);if(!((f=i==null?void 0:i.children)!=null&&f.length))return;const r=P({...i,treeExpanded:!0});n?l.splice(i.index+1,0,...r):l.splice(i.index+1,r.length),i.treeExpanded=!!n,X(),a&&se(t.startRow,t.endRow,!0)}function Ht(e){const{key:n,value:o,active:l=!1,disableOthers:a=!1}=e;if(t.filters.has(n)){const i=t.filters.get(n).options;if(a)for(let f=0,u=i.length;f<u;++f)i[f].active=!1;const r=i.find(f=>f.value===o);r&&(r.active=l)}}function X(){const e=t.rowData;for(let n=0,o=e.length;n<o;++n)e[n].index=n}function le(){const{heightBITree:e}=t;e?t.totalHeight=e.sum()??0:t.totalHeight=0}function It(e=!1){const n=typeof e=="boolean"?{able:e}:e,{able:o=!0,type:l=null,order:a=0,method:i=null}=n;return{able:o,type:l,order:a,method:i}}function Kt(e){e=e||{able:!1,options:[]};const{able:n=!0,custom:o=!1,multiple:l=!1,active:a=null,method:i=null,meta:r}=e,f=m.deepClone(e.options??[]),u=[];for(let h=0,d=f.length;h<d;++h){const c=f[h],s=typeof c=="string"?{value:c}:{...c};s.label=s.label??s.value.toString();let p=!1;l&&Array.isArray(a)?p=a.includes(s.value):m.isNull(a)||(p=Object.is(s.value,a)),s.active=p,u.push(s)}return{able:n,custom:o,meta:r,options:u,multiple:l,active:a,method:i}}function Lt(e,n,o){const l=[],a=[];for(const r of e.values()){const{able:f,active:u,method:h}=r;if(f&&u&&typeof h=="function"&&(l.push(r),o))break}const i=l.length;for(let r=0,f=n.length;r<f;++r){const u=n[r];let h=!0;for(let d=0;d<i;d++){const{active:c,method:s}=l[d];if(h=s(c,u.data),!h)break}h&&a.push(u)}return a}function _t(e,n,o,l){const a=[];for(const[i,r]of e){const f=i,{able:u,type:h,order:d,method:c}=r;if(u&&h){const s=o.find(w=>w.key===f),p=s==null?void 0:s.accessor;if(a.push({able:u,key:f,order:d,type:h,method:c??void 0,accessor(w){return typeof p=="function"?p(w.data,w.index):w.data[f]}}),l)break}}return a.sort((i,r)=>i.order-r.order),m.sortByProps(n,a)}function Pt(e,n,o){return n>0?o.slice((e-1)*n,e*n):o}function $t(e){const{rowMap:n}=t,o=n.get(e);return m.isNull(o==null?void 0:o.parent)?null:n.get(o.parent)??null}let H;function zt(e,n){const{resized:o,widths:l,columns:a,columnMap:i,width:r}=t,f=e.length;if(!a.length||!f)return;const u=n/f,h=m.getLast(a).key;for(let c=0;c<f;++c){const s=e[c],p=i.get(s);if(!p)continue;const w=f===1?Math.round(u):Math[c%2?"ceil":"floor"](u),{minWidth:g=0,maxWidth:y=1/0}=p;o.add(s),l.set(s,m.boundRange(w,g,y))}let d=0;for(const c of l.values())d+=c;d=m.toFixed(d,1),d-l.get(h)<r-(H??l.get(h))?(H||(H=l.get(h)),l.set(h,l.get(h)+r-d)):H&&(l.set(h,H),H=void 0)}function Bt(){const{normalColumns:e,leftFixedColumns:n,rightFixedColumns:o,aboveSummaries:l,belowSummaries:a,rowData:i,cellSpanMap:r,collapseMap:f}=t,{processedData:u}=T;for(const d of["left","default","right"])r.set(d,new Map),f.set(d,new Map);function h(d,c,s,p,w=""){const g=`${w}${d},${c}`,y=f.get(s);if(y.has(g)){r.get(s).set(g,{colSpan:0,rowSpan:0});return}const C=p(),{colSpan:k,rowSpan:M}=C;for(let R=0;R<k;++R)for(let x=0;x<M;++x){if(!R&&!x)continue;const v=`${w}${d+x},${c+R}`;let b=y.get(v);b||(b=new Set,y.set(v,b)),b.add(g)}r.get(s).set(g,C)}for(const d of[e,n,o]){if(!d.length)continue;const c=d[0].fixed===!0?"left":d[0].fixed||"default",s=d[0].fixed===!0?"left":d[0].fixed||void 0,p=t.leftFixedColumns.length,w=t.allColumns[0].length-t.rightFixedColumns.length;let g;c==="left"?g=t.allColumns.map(y=>y.slice(0,p)):c==="right"?g=t.allColumns.map(y=>y.slice(w,t.allColumns[0].length)):g=t.allColumns.map(y=>y.slice(p,w));for(let y=0,C=g.length;y<C;++y){const k=g[y];for(let M=0,R=k.length;M<R;++M){const x=k[M];if(!x)continue;const v=x.fixed===!0?"left":x.fixed||"default";h(y,M,v,()=>{const b=v==="left"?n:v==="right"?o:e;return{colSpan:m.boundRange(x.headSpan??1,0,b.length-M),rowSpan:x.rowSpan}},"h")}}for(let y=0,C=d.length;y<C;++y){const k=d[y];for(const M of i)h(M.index,k.index,c,()=>{let R;typeof k.cellSpan=="function"?R=k.cellSpan({row:M.data,index:M.index,fixed:s}):typeof t.cellSpan=="function"&&(R=t.cellSpan({row:M.data,rowIndex:M.index,column:k,columnIndex:k.index,fixed:s})),R=R||{colSpan:1,rowSpan:1};const x={colSpan:R.colSpan??1,rowSpan:R.rowSpan??1};return x.colSpan=m.boundRange(x.colSpan,0,d.length-y),x.rowSpan=m.boundRange(x.rowSpan,0,u.length-M.listIndex),x});for(const{prefix:M,summaries:R}of[{prefix:"af",summaries:l},{prefix:"bf",summaries:a}])for(let x=0,v=R.length;x<v;++x){const b=R[x];h(x,k.index,c,()=>{let A;typeof b.cellSpan=="function"&&(A=b.cellSpan({column:k,index:k.index,fixed:s}));const{colSpan:E,rowSpan:I}=A||{colSpan:1,rowSpan:1},F={colSpan:E??1,rowSpan:I??1};return F.colSpan=m.boundRange(F.colSpan,0,d.length-y),F.rowSpan=m.boundRange(F.rowSpan,0,R.length-x),F},M)}}}}function jt(){const{treeRowData:e,disabledTree:n,keyConfig:o}=t;return n?e.map(l=>({...l.data})):m.mapTree(e,l=>({...l.data}),{childField:o.children})}function Ot(e){const{dataKey:n,rowMap:o,idMaps:l}=t;let a;return typeof e=="object"?a=l.get(e)??e[n]:a=e,m.isNull(a)?void 0:o.get(a)}return{state:t,getters:T,mutations:Ce}}exports.useStore=Yt; //# sourceMappingURL=store.cjs.map