@extclp/vexip-ui
Version:
A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good
68 lines (67 loc) • 2.73 kB
JavaScript
import { defineComponent as k, inject as E, computed as c, createElementBlock as s, openBlock as o, normalizeStyle as v, normalizeClass as B, unref as L, Fragment as x, renderList as g, createBlock as C, withCtx as R, createCommentVNode as $ } from "vue";
import "./table-head-cell.vue.mjs";
import "./table-row.vue.mjs";
import { useNameHelper as b } from "@vexip-ui/config";
import { getLast as d } from "@vexip-ui/utils";
import { TABLE_STORE as S, TABLE_HEAD_PREFIX as T } from "./symbol.mjs";
import W from "./table-row.vue2.mjs";
import A from "./table-head-cell.vue2.mjs";
const V = /* @__PURE__ */ k({
name: "TableHead",
__name: "table-head",
props: {
fixed: {
type: String,
default: null
}
},
setup(m) {
const r = m, { state: e, getters: u, mutations: _ } = E(S), w = b("table"), y = c(() => {
const l = e.leftFixedColumns.length, n = e.allColumns[0].length - e.rightFixedColumns.length;
return r.fixed === "left" ? e.allColumns.map((t) => t.slice(0, l)) : r.fixed === "right" ? e.allColumns.map((t) => t.slice(n, e.allColumns[0].length)) : e.allColumns.map((t) => t.slice(l, n));
}), h = c(() => r.fixed === "left" ? e.leftFixedColumns : r.fixed === "right" ? e.rightFixedColumns : e.normalColumns), F = c(() => {
var i, a;
const l = r.fixed === "left" ? d(u.leftFixedWidths) : r.fixed === "right" ? d(u.rightFixedWidths) : d(u.normalWidths), n = ((i = h.value[0]) == null ? void 0 : i.fixed) === "left" && e.sidePadding[0] || 0, t = ((a = d(h.value)) == null ? void 0 : a.fixed) === "right" && e.sidePadding[1] || 0;
return {
minWidth: l && `${l + n + t}px`
};
});
function p(l) {
const n = `${T}${l}`;
return e.rowMap.get(n) || _.createMinRowState(n);
}
return (l, n) => (o(), s("div", {
class: B(L(w).be("head")),
role: "rowgroup",
style: v(F.value)
}, [
(o(!0), s(x, null, g(y.value, (t, i) => (o(), C(W, {
key: i,
index: i,
"is-head": "",
fixed: m.fixed,
row: p(i),
"aria-rowindex": i
}, {
default: R(() => [
(o(!0), s(x, null, g(t, (a, f) => (o(), s(x, { key: f }, [
a ? (o(), C(A, {
key: 0,
column: a,
index: f,
row: p(i),
"row-index": i,
fixed: m.fixed,
"aria-colindex": f
}, null, 8, ["column", "index", "row", "row-index", "fixed", "aria-colindex"])) : $("", !0)
], 64))), 128))
]),
_: 2
}, 1032, ["index", "fixed", "row", "aria-rowindex"]))), 128))
], 6));
}
});
export {
V as default
};
//# sourceMappingURL=table-head.vue2.mjs.map