vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
78 lines (77 loc) • 2.74 kB
JavaScript
import { defineComponent as z, useSlots as P, useTemplateRef as E, createElementBlock as a, openBlock as t, normalizeStyle as V, normalizeClass as D, unref as e, createVNode as B, withCtx as m, createElementVNode as x, createCommentVNode as n, createBlock as k, createSlots as g, renderList as i, renderSlot as v, normalizeProps as F, guardReactiveProps as R, Fragment as H, mergeProps as L } from "vue";
import U from "./node.vue.mjs";
import j from "./header.vue.mjs";
import q from "./empyt.vue.mjs";
import { ScrollBar as A } from "../../ScrollBar/index.mjs";
import { useTable as G } from "./hook/useTable.mjs";
import { Utils as c } from "@vuux/utils";
const I = { key: 1 }, J = {
key: 0,
class: "is-empty"
}, Z = /* @__PURE__ */ z({
name: "Table",
__name: "index",
props: {
columns: {},
data: {},
border: { type: Boolean },
stripe: { type: Boolean },
width: { default: "100%" },
height: { default: "100%" }
},
emits: ["select"],
setup($, { emit: S }) {
const o = $, w = S, u = P(), d = E("tableBoxEl"), p = E("tableEl"), { state: s, tableData: r, isFixedHead: C, classNames: N } = G(o, d, p, w);
return (f, b) => (t(), a("div", {
ref_key: "tableBoxEl",
ref: d,
class: D(["app-table", e(N)]),
style: V(`width: ${o.width}; height: ${o.height}`)
}, [
B(e(A), null, {
default: m(() => [
x("table", {
ref_key: "tableEl",
ref: p
}, [
e(c).isEmpty(o.columns) ? n("", !0) : (t(), k(j, {
key: 0,
columns: e(s).columns,
"table-data": e(r),
"is-fixed-head": e(C)
}, g({ _: 2 }, [
i(e(u), (_, l) => ({
name: l,
fn: m((y) => [
v(f.$slots, l, F(R(y || {})))
])
}))
]), 1032, ["columns", "table-data", "is-fixed-head"])),
e(c).isEmpty(e(r)) ? n("", !0) : (t(), a("tbody", I, [
(t(!0), a(H, null, i(e(s).tableData, (_, l) => (t(), k(U, {
key: l,
columns: e(s).columns,
item: _
}, g({ _: 2 }, [
i(e(u), (y, h) => ({
name: h,
fn: m((T) => [
v(f.$slots, h, L({ ref_for: !0 }, T || {}))
])
}))
]), 1032, ["columns", "item"]))), 128))
]))
], 512),
e(c).isEmpty(e(r)) ? (t(), a("div", J, [
B(q),
b[0] || (b[0] = x("div", { class: "empty-tip" }, "暂无数据", -1))
])) : n("", !0)
]),
_: 3
})
], 6));
}
});
export {
Z as default
};