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)
103 lines (102 loc) • 2.88 kB
JavaScript
import { defineComponent as b, inject as v, reactive as y, watch as g, onBeforeUnmount as V, createVNode as a } from "vue";
import { ElPopover as C, ElSelect as S, ElOption as D } from "element-plus";
import { props as F, slots as O } from "./common.mjs";
import { SizeSymbol as k } from "../../keys.mjs";
import { t as s } from "../../locale/lang.mjs";
import { isData as x } from "../../powerful-table/src/powerful-table-data.mjs";
import { LangKey as n } from "../../locale/packages.mjs";
const p = (l, r) => typeof r == "function" ? r()[l] : r ? r[l] : "", c = /* @__PURE__ */ b({
name: "PTFSelect",
props: {
...F,
// 过滤的配置数据
propData: {
type: Object,
default: () => ({
prop: ""
})
}
},
emits: ["headerFilterChange"],
setup(l, {
emit: r,
expose: u
}) {
const m = v(k), t = y({
value: [],
options: [],
selectVisible: !1,
visible: !1
}), f = (e) => {
e ? t.selectVisible = e : t.visible = !1;
}, h = (e) => {
e.length || (e = []), r("headerFilterChange", e, l.headerData);
}, d = g(() => l.propData, (e) => {
const o = x({
row: {},
index: 0,
props: e
}, e.data);
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 i = [];
i.push({
value: s(n.Open),
key: p("activeValue", o == null ? void 0 : o.property) || 1
}, {
value: s(n.Close),
key: p("inactiveValue", o == null ? void 0 : o.property) || 0
}), t.options = i;
}
}, {
immediate: !0,
deep: !0
});
return u({
state: t,
header: l.headerData
}), V(() => {
d();
}), () => a(C, {
visible: t.visible,
"onUpdate:visible": (e) => t.visible = e,
placement: "bottom-start",
trigger: "contextmenu",
width: 200
}, {
default: () => [a(S, {
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": f,
onChange: h
}, {
default: () => {
var e;
return [(e = t.options) == null ? void 0 : e.map((o, i) => a(D, {
key: i,
label: o.value,
value: o.key
}, null))];
}
})],
...O(t, l.headerData)
});
}
}), z = c;
z.install = (l) => {
l.component(c.name, c);
};
export {
c as FSelect,
z as PTFSelect,
c as default
};
//# sourceMappingURL=FSelect.mjs.map