vexip-ui
Version:
A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good
88 lines (87 loc) • 2.38 kB
JavaScript
import { defineComponent as O, inject as d, reactive as c, computed as S, watch as m, provide as x, onBeforeUnmount as f, renderSlot as p, createVNode as a, mergeProps as N } from "vue";
import U from "./table-column.mjs";
import { useProps as _ } from "@vexip-ui/config";
import { tableColumnGroupProps as y } from "./props.mjs";
import { TABLE_ACTIONS as j, COLUMN_GROUP_ACTIONS as C } from "./symbol.mjs";
const w = Object.keys(y), B = ["renderer", "children"], I = ["fixed", "order"], L = /* @__PURE__ */ O({
name: "TableColumnGroup",
inheritAttrs: !1,
props: y,
setup(h, {
slots: u
}) {
const t = _("tableColumn", h, {
name: {
default: "",
static: !0
},
fixed: {
default: !1,
static: !0
},
order: {
default: 0,
static: !0
},
ellipsis: null,
textAlign: "center",
renderer: {
default: null,
isFunc: !0,
static: !0
},
children: {
default: () => [],
static: !0
}
}), r = d(j, null), s = d(C, null), i = c(/* @__PURE__ */ new Set()), g = S(() => [...i]), n = c({
children: g
});
n.key = Symbol("TableColumnGroup");
for (const e of w) {
if (B.includes(e)) continue;
n[e] = t[e];
const l = I.includes(e);
m(() => t[e], (o) => {
n[e] = o, l ? r == null || r.updateColumns() : r == null || r.setColumnProp(n.key, e, o);
});
}
m(() => t.renderer, k, {
immediate: !0
}), x(C, {
increaseColumn: P,
decreaseColumn: T
}), s ? (s.increaseColumn(n), f(() => {
s.decreaseColumn(n);
})) : (r == null || r.increaseColumn(n), f(() => {
r == null || r.decreaseColumn(n);
}));
function P(e) {
i.add(e);
}
function T(e) {
i.delete(e);
}
function k() {
n.renderer = () => typeof u.head == "function" ? p(u, "head") : typeof t.renderer == "function" ? t.renderer() : t.name;
}
function G() {
return t.children.map((e) => {
if ("children" in e)
return a(L, e, null);
const {
key: l,
...o
} = e;
return a(U, N(o, {
"id-key": l
}), null);
});
}
return () => [p(u, "default"), ...G()];
}
});
export {
L as default
};
//# sourceMappingURL=table-column-group.mjs.map