@extclp/vexip-ui
Version:
A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good
77 lines (76 loc) • 2.93 kB
JavaScript
import { defineComponent as H, inject as S, toRef as B, computed as x, openBlock as n, createElementBlock as l, normalizeClass as y, unref as v, normalizeStyle as k, Fragment as h, renderList as w, createBlock as b, withCtx as L, renderSlot as T, createTextVNode as W, toDisplayString as D, createCommentVNode as E } from "vue";
import "./table-cell.vue.mjs";
import "./table-row.vue.mjs";
import { useNameHelper as N } from "@vexip-ui/config";
import { getLast as f } from "@vexip-ui/utils";
import { TABLE_STORE as R } from "./symbol.mjs";
import _ from "./table-row.vue2.mjs";
import z from "./table-cell.vue2.mjs";
const I = /* @__PURE__ */ H({
name: "TableBody",
__name: "table-body",
props: {
fixed: {
type: String,
default: null
}
},
setup(r) {
const o = r, { state: e, getters: a } = S(R), c = N("table"), C = B(e, "locale"), u = x(() => o.fixed === "left" ? e.leftFixedColumns : o.fixed === "right" ? e.rightFixedColumns : e.normalColumns), g = x(() => e.virtual ? e.virtualData : a.processedData), $ = x(() => {
var s, m;
const t = o.fixed === "left" ? f(a.leftFixedWidths) : o.fixed === "right" ? f(a.rightFixedWidths) : f(a.normalWidths), d = ((s = u.value[0]) == null ? void 0 : s.fixed) === "left" && e.sidePadding[0] || 0, i = ((m = f(u.value)) == null ? void 0 : m.fixed) === "right" && e.sidePadding[1] || 0;
return {
[c.cv("expanded-fix-width")]: o.fixed === "right" && t ? `${t + d + i}px` : "0px",
minWidth: t && `${t + d + i}px`,
minHeight: `${e.totalHeight}px`
};
}), F = x(() => {
const { rowHeight: t, rowMinHeight: d } = e;
return {
minHeight: `${t || d}px`
};
});
return (t, d) => (n(), l("div", {
class: y(v(c).be("body")),
role: "rowgroup",
style: k($.value)
}, [
g.value.length ? (n(!0), l(h, { key: 0 }, w(g.value, (i, s) => (n(), b(_, {
key: s,
row: i,
index: i.listIndex,
fixed: r.fixed,
"aria-rowindex": i.index
}, {
default: L(() => [
(n(!0), l(h, null, w(u.value, (m, p) => (n(), b(z, {
key: p,
row: i,
"row-index": i.listIndex,
column: m,
"col-index": p,
fixed: r.fixed,
"aria-colindex": p
}, null, 8, ["row", "row-index", "column", "col-index", "fixed", "aria-colindex"]))), 128))
]),
_: 2
}, 1032, ["row", "index", "fixed", "aria-rowindex"]))), 128)) : (n(), l("div", {
key: 1,
class: y(v(c).be("empty")),
style: k(F.value)
}, [
T(t.$slots, "empty", {
isFixed: !!r.fixed
}, () => [
r.fixed ? E("", !0) : (n(), l(h, { key: 0 }, [
W(D(C.value.empty), 1)
], 64))
])
], 6))
], 6));
}
});
export {
I as default
};
//# sourceMappingURL=table-body.vue2.mjs.map