UNPKG

tyh-ui2

Version:

The next generation ui component library of tyh-ui is based on vue3 Version, fully embrace vue3.

76 lines (75 loc) 2.45 kB
import { defineComponent as m, openBlock as e, createElementBlock as o, normalizeStyle as g, createElementVNode as r, normalizeClass as s, createCommentVNode as u, Fragment as h, renderList as d, toDisplayString as y } from "vue"; import { Props as k } from "./index2.js"; const w = ["width"], C = { class: "tyh-thead" }, z = ["height"], T = ["align"], S = ["width", "align"], B = { class: "tyh-tbody" }, E = ["height"], H = ["align"], N = ["align"], V = m({ name: "TyhTable" }), F = /* @__PURE__ */ m({ ...V, props: k, setup(b) { const i = b, p = (t) => { const c = i.important; for (const l of c) if (l === t + 1) return { background: i.importantColor }; return {}; }, a = (t) => [`tyh-${t}-td`, { "tyh-table-border": i.border }]; return (t, c) => (e(), o("div", { class: "tyh-table", style: g({ height: t.height }) }, [ r("table", { class: "tyh-table-table", border: "0", cellspacing: "0", cellpadding: "0", width: t.width }, [ r("thead", C, [ r("tr", { class: "tyh-thead-th", height: t.trHeight }, [ t.num ? (e(), o("th", { key: 0, class: s(a("thead")), align: t.align || "left" }, null, 10, T)) : u("", !0), (e(!0), o(h, null, d(t.columns, (l, n) => (e(), o("th", { key: n, class: s(a("thead")), width: l.width, align: t.align || "left" }, y(l.title), 11, S))), 128)) ], 8, z) ]), r("tbody", B, [ (e(!0), o(h, null, d(t.data, (l, n) => (e(), o("tr", { key: n, class: s([ "tyh-tbody-tr", { "tyh-tbody-tr-zebra": t.zebra } ]), height: t.trHeight, style: g(p(n)) }, [ t.num ? (e(), o("td", { key: 0, class: s(a("tbody")), align: t.align || "left" }, y(n + 1), 11, H)) : u("", !0), (e(!0), o(h, null, d(t.columns, (f, _) => (e(), o("td", { key: _, class: s(a("tbody")), align: t.align || "left" }, y(l[f.key]), 11, N))), 128)) ], 14, E))), 128)) ]) ], 8, w) ], 4)); } }); export { F as default };