vexip-ui
Version:
A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good
63 lines (62 loc) • 1.77 kB
JavaScript
import { defineComponent as p, inject as d, reactive as y, watch as l, onBeforeUnmount as S, renderSlot as P } from "vue";
import { useProps as g } from "@vexip-ui/config";
import { isNull as K } from "@vexip-ui/utils";
import { tableSummaryProps as i } from "./props.mjs";
import { TABLE_ACTIONS as k } from "./symbol.mjs";
const T = Object.keys(i), v = {
idKey: "key"
}, R = ["renderer"], j = ["idKey", "cellSpan", "order", "above"], a = {
default: null,
isFunc: !0,
static: !0
}, w = p({
name: "TableSummary",
props: i,
setup(c, { slots: u }) {
const t = g("tableSummary", c, {
idKey: {
default: null,
validator: (e) => !K(e),
static: !0
},
class: null,
style: null,
attrs: null,
cellSpan: a,
order: {
default: 0,
static: !0
},
above: {
default: !1,
static: !0
},
meta: null,
renderer: a
}), r = d(k, null), n = y({});
for (const e of T) {
if (R.includes(e)) continue;
const s = v[e] || e, f = j.includes(e);
n[s] = t[e], l(
() => t[e],
(m) => {
n[s] = m, f ? r == null || r.updateSummaries() : r == null || r.setSummaryProp(n.key, e, m);
}
);
}
l(() => t.renderer, o), o(), r == null || r.increaseSummary(n), S(() => {
r == null || r.decreaseSummary(n);
});
function o() {
n.renderer = (e) => typeof e.column.summaryRenderer == "function" ? e.column.summaryRenderer({
...e,
summary: n
}) : typeof u.default == "function" ? P(u, "default", e) : typeof t.renderer == "function" ? t.renderer(e) : "";
}
return () => null;
}
});
export {
w as default
};
//# sourceMappingURL=table-summary.mjs.map