sci-pro
Version:
2 lines (1 loc) • 24.7 kB
JavaScript
;Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),le=require("../tooltip/index.js");require("./style/index.css");const vt={class:"sci-pivot__table sci-pivot__table--head"},yt=["rowspan"],kt=["colspan","rowspan","onClick"],gt={class:"sci-pivot__head-content"},wt=["onClick"],_t={key:2},Ct=["rowspan"],Bt=["colspan","rowspan","onClick"],Tt={class:"sci-pivot__head-content"},Ft=["onClick"],xt={key:2},St=["rowspan"],Et={class:"sci-pivot__table sci-pivot__table--body"},Rt=["colspan","rowspan","onClick"],bt={class:"sci-pivot__row-head-content"},Vt=["onClick"],Nt={key:2},It=["onClick"],At=["onClick"],Gt={key:0},Dt=["colspan"],Lt=["onClick"],zt={key:1,class:"sci-pivot__body-scroll"},Mt={class:"sci-pivot__empty-overlay"},Ht=t.defineComponent({name:"sci-pivot-table"}),Pt=t.defineComponent({...Ht,props:{dataSource:{},showBorders:{type:Boolean,default:!0},height:{},showRowGrandTotals:{type:Boolean,default:!1},showColumnGrandTotals:{type:Boolean,default:!1},showRowExpandButtons:{type:Boolean,default:!0},showColumnExpandButtons:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!1},fixedRowHeader:{type:Boolean,default:!0},rowGrandTotalText:{default:"Grand Total"},columnGrandTotalText:{default:"Grand Total"},noDataText:{default:"No data"},emptyValueText:{default:"-"},valueFormatter:{},columnWidths:{},sortMethod:{},ellipsis:{type:Boolean,default:!1},headerCellStyle:{},bodyCellStyle:{}},emits:["toggle","cellClick"],setup(Ee,{emit:Re}){const C=Re,be="(Blank)",z="||",M="__@@__",I="__ROOT__",Ve=16,oe=200,Ne=100,Ie=40,Ae=25,i=Ee,A=t.computed(()=>{var e;return((e=i.dataSource)==null?void 0:e.store)??[]}),j=t.computed(()=>{var e;return((e=i.dataSource)==null?void 0:e.fields)??[]}),s=t.computed(()=>j.value.filter(e=>e.area==="row").map(e=>({dataField:e.dataField,caption:e.caption??e.dataField,sortOrder:e.sortOrder??"asc"}))),B=t.computed(()=>j.value.filter(e=>e.area==="column").map(e=>({dataField:e.dataField,caption:e.caption??e.dataField,sortOrder:e.sortOrder??"asc"}))),p=t.computed(()=>{const e=j.value.filter(n=>n.area==="data").map(n=>({dataField:n.dataField,caption:n.caption??n.dataField,summaryType:n.summaryType??"sum",format:n.format}));if(e.length>0)return e[0];const l=ct(A.value);if(l)return{dataField:l,caption:l,summaryType:"sum"}}),G=t.computed(()=>A.value.length>0&&s.value.length>0&&B.value.length>0&&!!p.value),Ge=new Intl.NumberFormat("en-US",{style:"decimal",maximumFractionDigits:2}),ae=t.ref(null),D=t.ref(null),H=t.ref([]),q=t.ref(0),De=t.ref([]),Le=t.computed(()=>({width:"100%",height:i.height==null||i.height===""?"100%":typeof i.height=="number"?`${i.height}px`:i.height})),ze=t.computed(()=>({paddingRight:`${q.value}px`})),R=t.computed(()=>i.ellipsis?"text-ellipsis":"");function U(e){return e==null?"":String(e)}const Y=t.computed(()=>Te(A.value,s.value,"row")),J=t.computed(()=>Te(A.value,B.value,"column")),L=t.ref(new Set),f=t.ref(new Set);t.watch(()=>Y.value,e=>{L.value=i.defaultExpandAll?new Set(xe(e)):new Set},{immediate:!0}),t.watch(()=>J.value,e=>{f.value=i.defaultExpandAll?new Set(xe(e)):new Set},{immediate:!0});const h=t.computed(()=>s.value.length===0?[{key:I,path:[],values:[],depth:0,hasChildren:!1,isCollapsedGroup:!1,groupControls:{}}]:dt(Y.value,L.value,s.value.length)),m=t.ref(0),y=t.ref(null),_=t.ref(null),b=t.computed(()=>m.value<=0?[]:h.value.slice(0,m.value));t.watch(()=>h.value,e=>{$e(e.length)},{immediate:!0}),t.watch(()=>m.value,()=>{t.nextTick(()=>{x()})});const T=t.computed(()=>B.value.length===0?[{key:I,path:[],value:i.columnGrandTotalText}]:pt(J.value,f.value).map(l=>({key:l.key,path:l.path,value:l.value}))),k=t.computed(()=>{const e=[];for(const l of s.value)e.push({key:`row:${l.dataField}`,kind:"row",dataField:l.dataField});for(const l of T.value)e.push({key:`data:${l.key}`,kind:"data"});return i.showRowGrandTotals&&G.value&&e.push({key:"row-grand",kind:"row-grand"}),e});function F(e){return!!e&&i.fixedRowHeader}const re=t.computed(()=>{const e=new Map;let l=0;for(let n=0;n<s.value.length;n+=1){const o=s.value[n];F(o.dataField)&&(e.set(o.dataField,l),l+=Ke(n))}return e}),P=t.computed(()=>{if(B.value.length===0)return[];const e=mt(J.value,f.value),l=e.reduce((n,o,a)=>o.length>0?a+1:n,1);return e.map((n,o)=>n.map(a=>({...a,rowspan:a.isLeaf?l-o:1}))).filter(n=>n.length>0)}),ue=t.computed(()=>B.value.length>0?Math.max(P.value.length,1):1),Me=t.computed(()=>ut(h.value,s.value.length)),ce=t.computed(()=>{const e=new Map,l=p.value;if(!l)return e;const n=(o,a,r)=>{const u=ne(o,a,l.dataField);let c=e.get(u);c||(c={sum:0,count:0,min:0,max:0,hasNumber:!1},e.set(u,c)),r!=null&&r!==""&&(c.count+=1);const d=it(r);if(d!=null){if(c.sum+=d,!c.hasNumber){c.min=d,c.max=d,c.hasNumber=!0;return}d<c.min&&(c.min=d),d>c.max&&(c.max=d)}};for(const o of A.value){const a=s.value.map(d=>ee(o[d.dataField])),r=B.value.map(d=>ee(o[d.dataField])),u=Be(a),c=Be(r);for(const d of u)for(const N of c)n(d,N,o[l.dataField])}return e});t.computed(()=>{const e=T.value.length,l=i.showRowGrandTotals&&G.value?1:0;return Math.max(s.value.length,1)+e+l});const He=t.computed(()=>{const e=[];e.push(s.value.map(n=>n.caption).join(z)),e.push(T.value.map(n=>String(n.value??"")).join(z)),i.showRowGrandTotals&&G.value&&e.push(i.rowGrandTotalText);const l=h.value[0];if(!l)return e.join(M);for(let n=0;n<s.value.length;n+=1)e.push(E(l,n));for(const n of T.value)e.push(v(l.path,n.path));return i.showRowGrandTotals&&G.value&&e.push(v(l.path,[])),e.join(M)});t.watch(()=>[k.value.map(e=>e.key).join("|"),JSON.stringify(i.columnWidths??null),He.value],()=>{t.nextTick(()=>{fe(),x()})},{immediate:!0}),t.onMounted(()=>{window.addEventListener("resize",x),t.nextTick(()=>{fe(),x()})}),t.onBeforeUnmount(()=>{window.removeEventListener("resize",x),X()});function X(){y.value!=null&&(_.value==="idle"&&typeof window.cancelIdleCallback=="function"?window.cancelIdleCallback(y.value):_.value==="raf"&&typeof window.cancelAnimationFrame=="function"?window.cancelAnimationFrame(y.value):window.clearTimeout(y.value),y.value=null,_.value=null)}function $(){if(X(),m.value>=h.value.length)return;const e=Pe();if(typeof window.requestIdleCallback=="function"){_.value="idle",y.value=window.requestIdleCallback(l=>{for(;m.value<h.value.length&&(l.timeRemaining()>0||l.didTimeout);)m.value=Math.min(m.value+e,h.value.length);m.value<h.value.length?$():(y.value=null,_.value=null)},{timeout:120});return}if(typeof window.requestAnimationFrame=="function"){_.value="raf",y.value=window.requestAnimationFrame(()=>{m.value=Math.min(m.value+e,h.value.length),m.value<h.value.length?$():(y.value=null,_.value=null)});return}_.value="timeout",y.value=window.setTimeout(()=>{m.value=Math.min(m.value+e,h.value.length),m.value<h.value.length?$():(y.value=null,_.value=null)},16)}function Pe(){var l;const e=((l=D.value)==null?void 0:l.clientHeight)??0;return e<=0?Ae:Math.max(1,Math.ceil(e/Ie))}function $e(e){X(),m.value=Math.min(e,Ne),m.value<e&&$()}function Z(e,l){De.value[l]=e??null}function x(){const e=D.value;if(!e){q.value=0;return}q.value=Math.max(0,e.offsetWidth-e.clientWidth)}function Oe(e){if(!e)return 0;const l=Number.parseFloat(e);return Number.isFinite(l)?l:0}function We(e){if(e!=null)return typeof e=="number"?`${e}px`:e}function ie(e,l){const n=i.columnWidths;if(!n)return;const o=Array.isArray(n)?n[e]:n[l],a=We(o);if(a)return a}function se(e,l){const n=ie(e,l);return n||H.value[e]}function Ke(e){var l;return Oe(se(e,((l=k.value[e])==null?void 0:l.key)??""))}function de(e,l){const n=se(e,l);return n?{width:n,minWidth:n}:{}}function je(e,l){var n,o;if(l.kind==="row")return((n=s.value[e])==null?void 0:n.caption)??"";if(l.kind==="data"){const a=e-s.value.length;return String(((o=T.value[a])==null?void 0:o.value)??"")}return l.kind==="row-grand"?i.rowGrandTotalText:""}function qe(e,l){const n=h.value[0];if(!n)return"";if(l.kind==="row")return E(n,e);if(l.kind==="data"){const o=e-s.value.length,a=T.value[o];return a?v(n.path,a.path):""}return l.kind==="row-grand"?v(n.path,[]):""}function pe(e){const l=String(e??""),n=Math.max(1,l.length)*Ve;return Math.min(oe,n)}function me(e,l){return l==null||l===""?e:e==null||e===""?l:[e,l]}function S(e,l={}){var n;return me(l,(n=i.headerCellStyle)==null?void 0:n.call(i,e))}function V(e,l={}){var n;return me(l,(n=i.bodyCellStyle)==null?void 0:n.call(i,e))}function he(e){return(e?F(e):!1)?{position:"sticky",left:`${re.value.get(e)??0}px`,zIndex:4}:{}}function Ue(e){return F(e)?{position:"sticky",left:`${re.value.get(e)??0}px`,zIndex:3}:{}}function Ye(){return s.value.length===0||!F(s.value[0].dataField)?{}:{position:"sticky",left:"0px",zIndex:3}}function Je(e){const l=D.value;l&&e.shiftKey&&(e.preventDefault(),l.scrollLeft+=e.deltaY)}function Xe(){const e=ae.value,l=D.value;!e||!l||(e.scrollLeft=l.scrollLeft)}function fe(){const e=k.value;if(e.length===0){H.value=[];return}const l=[];for(let n=0;n<e.length;n+=1){const o=e[n].key,a=e[n],r=ie(n,o);if(r){l[n]=r;continue}const u=pe(je(n,a)),c=pe(qe(n,a));l[n]=`${Math.min(oe,Math.max(u,c))}px`}l.join("|")!==H.value.join("|")&&(H.value=l)}function ve(e){return f.value.has(e)}function Ze(e){const l=new Set(L.value),n=new Set(L.value),o=_e(Y.value,e);if(n.has(e)){if(n.delete(e),o){const r=Ce(o);for(const u of r)n.delete(u)}}else if(n.add(e),o){const r=Ce(o);for(const u of r)n.add(u)}L.value=n;const a=ge(l,n);C("toggle",{axis:"row",key:e,expanded:n.has(e),changedKeys:a,expandedKeys:Array.from(n)}),t.nextTick(()=>{x()})}function ye(e){const l=new Set(f.value);f.value.has(e)?f.value.delete(e):f.value.add(e),f.value=new Set(f.value);const n=ge(l,f.value);C("toggle",{axis:"column",key:e,expanded:f.value.has(e),changedKeys:n,expandedKeys:Array.from(f.value)}),t.nextTick(()=>{x()})}function ke(e,l,n){var o,a;C("cellClick",{type:"column-header",rowIndex:l,columnIndex:n,rowPath:[],columnPath:e.node.path,rowValues:[],columnValues:[...e.node.path],value:String(e.node.value??""),dataField:(o=p.value)==null?void 0:o.dataField,summaryType:(a=p.value)==null?void 0:a.summaryType,isFooter:!1,isGrandTotal:!1,columnKey:e.node.key})}function Qe(e,l,n){var o,a;C("cellClick",{type:"row-header",rowIndex:n,columnIndex:l,rowPath:e.path,columnPath:[],rowValues:[...e.path],columnValues:[],value:E(e,l),dataField:(o=p.value)==null?void 0:o.dataField,summaryType:(a=p.value)==null?void 0:a.summaryType,isFooter:!1,isGrandTotal:!1,rowKey:e.key})}function et(e,l,n,o){var r,u;const a=K(e.path,l.path);C("cellClick",{type:"data",rowIndex:n,columnIndex:s.value.length+o,rowPath:e.path,columnPath:l.path,rowValues:[...e.path],columnValues:[...l.path],value:v(e.path,l.path),rawValue:a,dataField:(r=p.value)==null?void 0:r.dataField,summaryType:(u=p.value)==null?void 0:u.summaryType,isFooter:!1,isGrandTotal:!1,rowKey:e.key,columnKey:l.key})}function tt(e,l){var o,a;const n=K(e.path,[]);C("cellClick",{type:"row-grand-total",rowIndex:l,columnIndex:k.value.length-1,rowPath:e.path,columnPath:[],rowValues:[...e.path],columnValues:[],value:v(e.path,[]),rawValue:n,dataField:(o=p.value)==null?void 0:o.dataField,summaryType:(a=p.value)==null?void 0:a.summaryType,isFooter:!1,isGrandTotal:!0,rowKey:e.key})}function nt(e,l){var o,a;const n=K([],e.path);C("cellClick",{type:"column-grand-total",rowIndex:b.value.length,columnIndex:s.value.length+l,rowPath:[],columnPath:e.path,rowValues:[],columnValues:[...e.path],value:v([],e.path),rawValue:n,dataField:(o=p.value)==null?void 0:o.dataField,summaryType:(a=p.value)==null?void 0:a.summaryType,isFooter:!0,isGrandTotal:!0,columnKey:e.key})}function lt(){var l,n;const e=K([],[]);C("cellClick",{type:"all-grand-total",rowIndex:b.value.length,columnIndex:k.value.length-1,rowPath:[],columnPath:[],rowValues:[],columnValues:[],value:v([],[]),rawValue:e,dataField:(l=p.value)==null?void 0:l.dataField,summaryType:(n=p.value)==null?void 0:n.summaryType,isFooter:!0,isGrandTotal:!0})}function ge(e,l){const n=[];for(const o of e)l.has(o)||n.push(o);for(const o of l)e.has(o)||n.push(o);return n}function ot(e,l,n){return O(e,l)?we(e,l,n)>0:!1}function at(e,l){return e.isCollapsedGroup&&l===e.depth-1?Math.max(1,s.value.length-e.depth+1):1}function we(e,l,n){var o;return O(e,l)?Q(e,l)?1:((o=Me.value[n])==null?void 0:o[l])??1:0}function O(e,l){return e.isCollapsedGroup?l<=e.depth-1:!0}function Q(e,l){return e.isCollapsedGroup&&l===e.depth-1}function W(e,l){return e.groupControls[l]}function rt(e,l){var n;return!!((n=W(e,l))!=null&&n.hasChildren)}function E(e,l){const n=W(e,l);return n?n.value:e.values[l]??""}function _e(e,l){if(e.key===l)return e;for(const n of e.children){const o=_e(n,l);if(o)return o}}function Ce(e){const l=[],n=o=>{for(const a of o.children)a.children.length>0&&(l.push(a.key),n(a))};return n(e),l}function ut(e,l){const n=e.map(()=>new Array(l).fill(0)),o=(r,u)=>E(r,u),a=(r,u)=>u<=0?"":Array.from({length:u},(c,d)=>o(r,d)).join(z);for(let r=0;r<l;r+=1){let u=0;for(;u<e.length;){const c=e[u];if(!O(c,r)){n[u][r]=0,u+=1;continue}if(Q(c,r)){n[u][r]=1,u+=1;continue}const d=a(c,r),N=o(c,r);let g=u+1;for(;g<e.length;){const w=e[g];if(!O(w,r)||Q(w,r)||a(w,r)!==d||o(w,r)!==N)break;g+=1}n[u][r]=g-u;for(let w=u+1;w<g;w+=1)n[w][r]=0;u=g}}return n}function ct(e){const l=e[0];if(!l)return"";for(const n of Object.keys(l))if(typeof l[n]=="number")return n;return""}function ee(e){return e==null||e===""?be:String(e)}function it(e){const l=Number(e);return Number.isFinite(l)?l:void 0}function te(e){return!Array.isArray(e)||e.length===0?I:e.join(z)}function ne(e,l,n){return`${te(e)}${M}${te(l)}${M}${n}`}function Be(e){const l=[[]];for(let n=1;n<=e.length;n+=1)l.push(e.slice(0,n));return l}function st(e,l,n,o,a){if(a){const u=a(e,l,o);if(typeof u=="number"&&Number.isFinite(u))return u}const r=e.localeCompare(l,void 0,{numeric:!0});return n==="desc"?-r:r}function Te(e,l,n){const o={key:I,value:I,path:[],depth:0,children:[]};if(l.length===0)return o;for(const a of e){const r=l.map(c=>ee(a[c.dataField]));let u=o;for(let c=0;c<r.length;c+=1){const d=r.slice(0,c+1),N=te(d);let g=u.children.find(w=>w.key===N);g||(g={key:N,value:r[c],path:d,depth:c+1,children:[]},u.children.push(g)),u=g}}return Fe(o,l,n),o}function Fe(e,l,n){if(e.children.length===0)return;const o=l[e.depth],a=(o==null?void 0:o.sortOrder)??"asc",r=i.sortMethod;e.children.sort((u,c)=>st(u.value,c.value,a,{axis:n,depth:e.depth+1,dataField:(o==null?void 0:o.dataField)??"",sortOrder:a,aNode:u,bNode:c},r));for(const u of e.children)Fe(u,l,n)}function xe(e){const l=[],n=o=>{if(o.children.length>0){l.push(o.key);for(const a of o.children)n(a)}};for(const o of e.children)n(o);return l}function dt(e,l,n){const o=[],a=(u,c)=>({key:u.key,path:u.path,values:ht(u.path,n),depth:u.depth,hasChildren:u.children.length>0,isCollapsedGroup:c,groupControls:c?{[u.depth-1]:{key:u.key,value:u.value,expanded:!1,hasChildren:!0}}:{}}),r=u=>{if(u.children.length===0){o.push(a(u,!1));return}if(!l.has(u.key)){o.push(a(u,!0));return}const c=o.length;for(const d of u.children)r(d);o[c]&&(o[c].groupControls[u.depth-1]={key:u.key,value:u.value,expanded:!0,hasChildren:!0})};for(const u of e.children)r(u);return o}function pt(e,l){const n=[],o=a=>{if(a.children.length===0||!l.has(a.key)){n.push(a);return}for(const r of a.children)o(r)};for(const a of e.children)o(a);return n}function mt(e,l){const n=[],o=r=>{if(r.children.length===0||!l.has(r.key))return 1;let u=0;for(const c of r.children)u+=o(c);return u},a=r=>{const u=r.depth-1;n[u]||(n[u]=[]);const c=r.children.length===0||!l.has(r.key);if(n[u].push({node:r,depth:r.depth,colspan:o(r),rowspan:1,isLeaf:c}),!c)for(const d of r.children)a(d)};for(const r of e.children)a(r);return n}function ht(e,l){const n=new Array(l).fill("");for(let o=0;o<e.length;o+=1)n[o]=e[o];return n}function Se(e){const l=p.value;return!l||!e?0:l.summaryType==="count"?e.count:l.summaryType==="avg"?e.count>0?e.sum/e.count:0:l.summaryType==="min"?e.hasNumber?e.min:0:l.summaryType==="max"?e.hasNumber?e.max:0:e.sum}function ft(e){if(!Number.isFinite(e))return i.emptyValueText;const l=p.value;return l?l.format?l.format(e):i.valueFormatter?i.valueFormatter(e,l.dataField):Ge.format(e):i.emptyValueText}function v(e,l){const n=p.value;if(!n)return i.emptyValueText;const o=ne(e,l,n.dataField),a=ce.value.get(o),r=Se(a);return ft(r)}function K(e,l){const n=p.value;if(!n)return 0;const o=ne(e,l,n.dataField),a=ce.value.get(o);return Se(a)}return(e,l)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["sci-pivot",{"is-borderless":!e.showBorders}]),style:t.normalizeStyle(Le.value)},[G.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",{ref_key:"headScrollRef",ref:ae,class:"sci-pivot__head-scroll",style:t.normalizeStyle(ze.value)},[t.createElementVNode("table",vt,[t.createElementVNode("colgroup",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,(n,o)=>(t.openBlock(),t.createElementBlock("col",{key:`col-${n.key}`,style:t.normalizeStyle(de(o,n.key))},null,4))),128))]),t.createElementVNode("thead",null,[B.value.length>0?(t.openBlock(),t.createElementBlock("tr",{key:0,ref:n=>Z(n,0)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,(n,o)=>(t.openBlock(),t.createElementBlock("th",{key:`row-caption-${n.dataField}`,"data-row-header":"true",class:t.normalizeClass(["sci-pivot__head",{"is-fixed-col":F(n.dataField)}]),rowspan:ue.value,style:t.normalizeStyle(S({rowIndex:0,columnIndex:o,type:"row-header",field:n},he(n.dataField)))},t.toDisplayString(n.caption),15,yt))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(P.value[0],(n,o)=>(t.openBlock(),t.createElementBlock("th",{key:`column-header-0-${n.node.key}`,class:"sci-pivot__head",colspan:n.colspan,rowspan:n.rowspan,style:t.normalizeStyle(S({rowIndex:0,columnIndex:s.value.length+o,type:"column-header",header:n})),onClick:a=>ke(n,0,s.value.length+o)},[t.createElementVNode("div",gt,[e.showColumnExpandButtons&&n.node.children.length>0?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"sci-pivot__toggle",onClick:t.withModifiers(a=>ye(n.node.key),["stop"])},t.toDisplayString(ve(n.node.key)?"-":"+"),9,wt)):t.createCommentVNode("",!0),R.value?(t.openBlock(),t.createBlock(t.unref(le.Tooltip),{key:1,content:U(n.node.value),placement:"top"},{default:t.withCtx(()=>[t.createElementVNode("span",{class:t.normalizeClass(R.value)},t.toDisplayString(n.node.value),3)]),_:2},1032,["content"])):(t.openBlock(),t.createElementBlock("span",_t,t.toDisplayString(n.node.value),1))])],12,kt))),128)),e.showRowGrandTotals?(t.openBlock(),t.createElementBlock("th",{key:0,class:"sci-pivot__head sci-pivot__head--total",rowspan:P.value.length,style:t.normalizeStyle(S({rowIndex:0,columnIndex:k.value.length-1,type:"row-grand-total"}))},t.toDisplayString(e.rowGrandTotalText),13,Ct)):t.createCommentVNode("",!0)],512)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(P.value.slice(1),(n,o)=>(t.openBlock(),t.createElementBlock("tr",{key:`column-header-row-${o+1}`,ref_for:!0,ref:a=>Z(a,o+1)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n,(a,r)=>(t.openBlock(),t.createElementBlock("th",{key:`column-header-${o+1}-${a.node.key}`,class:"sci-pivot__head",colspan:a.colspan,rowspan:a.rowspan,style:t.normalizeStyle(S({rowIndex:o+1,columnIndex:s.value.length+r,type:"column-header",header:a})),onClick:u=>ke(a,o+1,s.value.length+r)},[t.createElementVNode("div",Tt,[e.showColumnExpandButtons&&a.node.children.length>0?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"sci-pivot__toggle",onClick:t.withModifiers(u=>ye(a.node.key),["stop"])},t.toDisplayString(ve(a.node.key)?"-":"+"),9,Ft)):t.createCommentVNode("",!0),R.value?(t.openBlock(),t.createBlock(t.unref(le.Tooltip),{key:1,content:U(a.node.value),placement:"top"},{default:t.withCtx(()=>[t.createElementVNode("span",{class:t.normalizeClass(R.value)},t.toDisplayString(a.node.value),3)]),_:2},1032,["content"])):(t.openBlock(),t.createElementBlock("span",xt,t.toDisplayString(a.node.value),1))])],12,Bt))),128))]))),128)),B.value.length===0?(t.openBlock(),t.createElementBlock("tr",{key:1,ref:n=>Z(n,0)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,(n,o)=>(t.openBlock(),t.createElementBlock("th",{key:`row-caption-simple-${n.dataField}`,"data-row-header":"true",class:t.normalizeClass(["sci-pivot__head",{"is-fixed-col":F(n.dataField)}]),rowspan:ue.value,style:t.normalizeStyle(S({rowIndex:0,columnIndex:o,type:"row-header",field:n},he(n.dataField)))},t.toDisplayString(n.caption),15,St))),128)),t.createElementVNode("th",{class:"sci-pivot__head",style:t.normalizeStyle(S({rowIndex:0,columnIndex:s.value.length,type:"column-grand-total"}))},t.toDisplayString(e.columnGrandTotalText),5),e.showRowGrandTotals?(t.openBlock(),t.createElementBlock("th",{key:0,class:"sci-pivot__head sci-pivot__head--total",style:t.normalizeStyle(S({rowIndex:0,columnIndex:k.value.length-1,type:"row-grand-total"}))},t.toDisplayString(e.rowGrandTotalText),5)):t.createCommentVNode("",!0)],512)):t.createCommentVNode("",!0)])])],4),t.createElementVNode("div",{ref_key:"bodyScrollRef",ref:D,class:"sci-pivot__body-scroll",onScroll:Xe,onWheel:Je},[t.createElementVNode("table",Et,[t.createElementVNode("colgroup",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,(n,o)=>(t.openBlock(),t.createElementBlock("col",{key:`body-col-${n.key}`,style:t.normalizeStyle(de(o,n.key))},null,4))),128))]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,(n,o)=>(t.openBlock(),t.createElementBlock("tr",{key:`row-${n.key}`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:`row-head-${n.key}-${a.dataField}`},[ot(n,r,o)?(t.openBlock(),t.createElementBlock("th",{key:0,class:t.normalizeClass(["sci-pivot__row-head",{"is-fixed-col":F(a.dataField)}]),colspan:at(n,r),rowspan:we(n,r,o),style:t.normalizeStyle(V({rowIndex:o,columnIndex:r,type:"row-header",row:n,field:a},Ue(a.dataField))),onClick:u=>Qe(n,r,o)},[t.createElementVNode("div",bt,[e.showRowExpandButtons&&rt(n,r)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"sci-pivot__toggle",onClick:t.withModifiers(u=>Ze(W(n,r).key),["stop"])},t.toDisplayString(W(n,r).expanded?"-":"+"),9,Vt)):t.createCommentVNode("",!0),R.value?(t.openBlock(),t.createBlock(t.unref(le.Tooltip),{key:1,content:U(E(n,r)),placement:"top"},{default:t.withCtx(()=>[t.createElementVNode("span",{class:t.normalizeClass(R.value)},t.toDisplayString(E(n,r)),3)]),_:2},1032,["content"])):(t.openBlock(),t.createElementBlock("span",Nt,t.toDisplayString(E(n,r)),1))])],14,Rt)):t.createCommentVNode("",!0)],64))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.value,(a,r)=>(t.openBlock(),t.createElementBlock("td",{key:`cell-${n.key}-${a.key}`,class:"sci-pivot__cell",style:t.normalizeStyle(V({rowIndex:o,columnIndex:s.value.length+r,type:"data",row:n,column:a})),onClick:u=>et(n,a,o,r)},t.toDisplayString(v(n.path,a.path)),13,It))),128)),e.showRowGrandTotals?(t.openBlock(),t.createElementBlock("td",{key:`row-grand-${n.key}`,class:"sci-pivot__cell sci-pivot__cell--total",style:t.normalizeStyle(V({rowIndex:o,columnIndex:k.value.length-1,type:"row-grand-total",row:n})),onClick:a=>tt(n,o)},t.toDisplayString(v(n.path,[])),13,At)):t.createCommentVNode("",!0)]))),128))]),e.showColumnGrandTotals&&h.value.length>0?(t.openBlock(),t.createElementBlock("tfoot",Gt,[t.createElementVNode("tr",null,[t.createElementVNode("th",{colspan:Math.max(s.value.length,1),class:"sci-pivot__foot-head",style:t.normalizeStyle(V({rowIndex:b.value.length,columnIndex:0,type:"column-grand-total",isFooter:!0},Ye()))},t.toDisplayString(e.columnGrandTotalText),13,Dt),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.value,(n,o)=>(t.openBlock(),t.createElementBlock("td",{key:`foot-${n.key}`,class:"sci-pivot__cell sci-pivot__cell--total",style:t.normalizeStyle(V({rowIndex:b.value.length,columnIndex:s.value.length+o,type:"column-grand-total",column:n,isFooter:!0})),onClick:a=>nt(n,o)},t.toDisplayString(v([],n.path)),13,Lt))),128)),e.showRowGrandTotals?(t.openBlock(),t.createElementBlock("td",{key:0,class:"sci-pivot__cell sci-pivot__cell--total",style:t.normalizeStyle(V({rowIndex:b.value.length,columnIndex:k.value.length-1,type:"all-grand-total",isFooter:!0})),onClick:l[0]||(l[0]=n=>lt())},t.toDisplayString(v([],[])),5)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)])],544)],64)):(t.openBlock(),t.createElementBlock("div",zt,[t.createElementVNode("div",Mt,t.toDisplayString(e.noDataText),1)]))],6))}});exports.default=Pt;