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)
70 lines (69 loc) • 2.13 kB
JavaScript
import { defineComponent as u, inject as s, createVNode as c, Fragment as y, mergeProps as w } from "vue";
import { ElTag as x } from "element-plus";
import { filterFun as g } from "./filter.mjs";
import { powerfulTableComponentProp as T, isData as d, useREmit as b, isProperty as P } from "../../powerful-table/src/powerful-table-data.mjs";
import { SizeSymbol as C } from "../../keys.mjs";
const i = /* @__PURE__ */ u({
name: "PTTags",
props: {
...T,
prop: {
type: Object,
default: () => ({})
}
},
emits: ["return-emit", "component-emit"],
setup(e, {
emit: m
}) {
const o = d({
row: e.row,
index: e.index,
props: e.prop
}, e.prop.data), f = s(C), {
REmit: t,
event: l
} = b(m, "tag", {
row: e.row,
index: e.index,
props: e.prop
}), p = (r, n) => r == null ? [] : typeof r != "string" ? Array.isArray(r) ? r.slice(0, n) : [r].slice(0, n) : r.split(",").slice(0, n);
return () => c(y, null, [p(e.row[e.prop.prop], (o == null ? void 0 : o.number) || 3).map((r) => c(x, w({
style: {
marginRight: "10px",
borderColor: typeof (o == null ? void 0 : o.color) == "function" ? "rgba(0,0,0,0)" : "auto",
...o == null ? void 0 : o.style
},
size: f,
key: r,
type: "primary",
color: typeof (o == null ? void 0 : o.color) == "function" && (o == null ? void 0 : o.color(e.row, r)) || "",
onClick: (n) => {
n.stopPropagation(), t("click", {
row: e.row,
index: e.index,
prop: e.prop.prop,
evt: n
}), l("click", n);
},
onClose: (...n) => {
t("close", ...n), l("close", ...n);
}
}, P({
row: e.row,
index: e.index,
props: e.prop
}, o == null ? void 0 : o.property)), {
default: () => [e.prop.filters ? typeof e.prop.filters == "function" ? e.prop.filters(e.row, e.index) : g(r, e.prop.filters) : r]
}))]);
}
});
i.install = (e) => {
e.component(i.name, i);
};
const j = i;
export {
j as PTTags,
i as default
};
//# sourceMappingURL=tags.mjs.map