el-plus-powerful-table
Version:
## [DOCS](https://peng-xiao-shuai.github.io/vite-vue-admin-docs/zh-CN/component_directive/component/powerful-table-doc.html)
66 lines (65 loc) • 1.99 kB
JavaScript
import { defineComponent as s, inject as u, createVNode as m, Fragment as y, mergeProps as w } from "vue";
import { ElTag as g } from "element-plus";
import { filterFun as x } from "./filter.mjs";
import { powerfulTableComponentProp as T, useREmit as b, isProperty as P } from "../../powerful-table/src/powerful-table-data.mjs";
import { SizeSymbol as C } from "../../keys.mjs";
const t = /* @__PURE__ */ s({
name: "PTTags",
props: {
...T,
prop: {
type: Object,
default: () => ({})
}
},
emits: ["return-emit", "component-emit"],
setup(o, {
emit: c
}) {
const e = o.prop.data, p = u(C), {
REmit: i,
event: l
} = b(c, "tag", {
row: o.row,
index: o.index,
props: o.prop
}), f = (n, r) => typeof n != "string" ? [...n].splice(0, r) : n.split(",").splice(0, r);
return () => m(y, null, [f(o.row[o.prop.prop], (e == null ? void 0 : e.number) || 3).map((n) => m(g, w({
style: {
marginRight: "10px",
borderColor: typeof (e == null ? void 0 : e.color) == "function" ? "rgba(0,0,0,0)" : "auto",
...e == null ? void 0 : e.style
},
size: p,
key: n,
type: "primary",
color: typeof (e == null ? void 0 : e.color) == "function" && (e == null ? void 0 : e.color(o.row, n)) || "",
onClick: (r) => {
r.stopPropagation(), i("click", {
row: o.row,
index: o.index,
prop: o.prop.prop,
evt: r
}), l("click", r);
},
onClose: (...r) => {
i("close", ...r), l("close", ...r);
}
}, P({
row: o.row,
index: o.index,
props: o.prop
}, e == null ? void 0 : e.property)), {
default: () => [o.prop.filters ? typeof o.prop.filters == "function" ? o.prop.filters(o.row, o.index) : x(n, o.prop.filters) : n]
}))]);
}
});
t.install = (o) => {
o.component(t.name, t);
};
const j = t;
export {
j as PTTags,
t as default
};
//# sourceMappingURL=tags.mjs.map