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)
98 lines (97 loc) • 2.75 kB
JavaScript
import { defineComponent as v, inject as y, reactive as g, watch as V, onBeforeUnmount as C, createVNode as o } from "vue";
import { ElPopover as S, ElSelect as F, ElOption as D } from "element-plus";
import { props as O, slots as k } from "./common.mjs";
import { SizeSymbol as z } from "../../keys.mjs";
import { t as s } from "../../locale/lang.mjs";
import { LangKey as n } from "../../locale/packages.mjs";
const p = (l, a) => typeof a == "function" ? a()[l] : a ? a[l] : "", u = /* @__PURE__ */ v({
name: "PTFSelect",
props: {
...O,
// 过滤的配置数据
propData: {
type: Object,
default: () => ({
prop: ""
})
}
},
emits: ["headerFilterChange"],
setup(l, {
emit: a,
expose: f
}) {
const m = y(z), t = g({
value: [],
options: [],
selectVisible: !1,
visible: !1
}), h = (e) => {
e ? t.selectVisible = e : t.visible = !1;
}, d = (e) => {
e.length || (e = []), a("headerFilterChange", e, l.headerData);
}, b = V(() => l.propData, (e) => {
var i, r;
if (e.filters)
Array.isArray(e.filters) ? t.options = e.filters : console.warn(l.headerData.label, "The filter attribute of the column must be an array Or set the isShowOrFilterColumn property to false");
else if (e.type === "switch") {
const c = [];
c.push({
value: s(n.Open),
key: p("activeValue", (i = e.data) == null ? void 0 : i.property) || 1
}, {
value: s(n.Close),
key: p("inactiveValue", (r = e.data) == null ? void 0 : r.property) || 0
}), t.options = c;
}
}, {
immediate: !0,
deep: !0
});
return f({
state: t,
header: l.headerData
}), C(() => {
b();
}), () => o(S, {
visible: t.visible,
"onUpdate:visible": (e) => t.visible = e,
placement: "bottom-start",
trigger: "contextmenu",
width: 200
}, {
default: () => [o(F, {
modelValue: t.value,
"onUpdate:modelValue": (e) => t.value = e,
multiple: !0,
"collapse-tags": !0,
clearable: !0,
placeholder: s(n.Select),
style: "width: 100%",
teleported: !1,
size: m,
"onVisible-change": h,
onChange: d
}, {
default: () => {
var e;
return [(e = t.options) == null ? void 0 : e.map((i, r) => o(D, {
key: r,
label: i.value,
value: i.key
}, null))];
}
})],
...k(t, l.headerData)
});
}
}), E = u;
E.install = (l) => {
l.component(u.name, u);
};
export {
u as FSelect,
E as PTFSelect,
u as default
};
//# sourceMappingURL=FSelect.mjs.map