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