UNPKG

vexip-ui

Version:

A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good

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