vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
64 lines (63 loc) • 2.45 kB
JavaScript
import { defineComponent as $, useSlots as z, createElementBlock as l, openBlock as r, Fragment as i, createElementVNode as k, createCommentVNode as m, renderList as a, normalizeClass as y, unref as t, normalizeStyle as B, createBlock as p, renderSlot as C, withModifiers as E, toDisplayString as U, createSlots as w, withCtx as I, mergeProps as M } from "vue";
import T from "../../CheckBox/src/index.vue.mjs";
import { Utils as b } from "@vuux/utils";
import { Icon as D } from "@vuux/icons";
import { useTableNode as F } from "./hook/useTableNode.mjs";
const L = { key: 3 }, P = /* @__PURE__ */ $({
__name: "node",
props: {
columns: {},
item: {}
},
setup(u) {
const e = u, c = z(), { getStyle: g, classNames: v, isMore: S, handleToggle: h, selectChange: N } = F(e);
return (d, n) => (r(), l(i, null, [
k("tr", null, [
(r(!0), l(i, null, a(e.columns, (o, s) => (r(), l("td", {
key: s,
class: y([o.class, t(v)(o)])
}, [
k("div", {
class: "cell",
style: B(t(g)(s))
}, [
o.prop == "select" ? (r(), p(T, {
key: 0,
"model-value": e.item.select,
indeterminate: e.item.indeterminate,
"onUpdate:modelValue": t(N),
onClickCapture: n[0] || (n[0] = E(() => {
}, ["stop"]))
}, null, 8, ["model-value", "indeterminate", "onUpdate:modelValue"])) : m("", !0),
t(S)(e.item, s) ? (r(), p(t(D), {
key: 1,
name: "Icon6657361",
class: y(["is-more", { "is-active": e.item.open }]),
size: 18,
onClick: n[1] || (n[1] = (V) => t(h)(e.item))
}, null, 8, ["class"])) : m("", !0),
t(c)[o.prop] ? C(d.$slots, o.prop, {
key: 2,
scope: u.item.data
}) : (r(), l("span", L, U(e.item.data[o.prop]), 1))
], 4)
], 2))), 128))
]),
!t(b).isEmpty(e.item.children) && e.item.open ? (r(!0), l(i, { key: 0 }, a(e.item.children, (o, s) => (r(), p(P, {
key: s,
columns: e.columns,
item: o
}, w({ _: 2 }, [
a(t(c), (V, f) => ({
name: f,
fn: I((_) => [
C(d.$slots, f, M({ ref_for: !0 }, _ || {}))
])
}))
]), 1032, ["columns", "item"]))), 128)) : m("", !0)
], 64));
}
});
export {
P as default
};