ideaz-element
Version:
<p align="center"> <a href="" target="_blank" rel="noopener noreferrer"> <img src="./docs/public/logo.svg" alt="Ideaz Element" width="180" style="width: 180px;" /> </a> </p>
105 lines (104 loc) • 3.33 kB
JavaScript
import { defineComponent as E, createVNode as n, mergeProps as d } from "vue";
import "../../../utils/index.mjs";
import { ArrowDown as z } from "@element-plus/icons-vue";
import "../../../node_modules/.pnpm/lodash-unified@1.0.3_@types_lodash-es@4.17.12_lodash-es@4.17.21_lodash@4.17.21/node_modules/lodash-unified/import.mjs";
import { ElButton as b, ElIcon as B, ElDropdown as w, ElDropdownMenu as j, ElDropdownItem as D } from "element-plus";
import { useNamespace as O } from "../../../hooks/useNamespace.mjs";
import { useFormSize as v } from "../../../hooks/useFormSize.mjs";
import { useLocale as F } from "../../../hooks/useLocale.mjs";
import { isBoolean as T, isFunction as i, isString as y, isSlot as g } from "../../../utils/is.mjs";
import h from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/omit.mjs";
const Y = /* @__PURE__ */ E({
name: "ZTableButton",
props: {
button: {
type: Object,
default: () => ({})
},
size: {
type: String
},
scope: {
type: Object,
default: () => ({})
},
tableColumnSlots: {
type: Object,
default: () => ({})
}
},
setup(f) {
const C = O("table-column"), u = v(), {
t: S
} = F(), m = ["children", "type", "hide", "onClick"], a = (e, t, r, c) => e ? Object.keys(e).includes(t) ? T(e[t]) ? e[t] : i(e[t]) ? e[t](r) : !1 : !1 : c, k = (e, t) => {
const r = t.reference;
return i(r) ? r(e) : y(r) && g(r) ? f.tableColumnSlots[r](e) : n(b, {
type: "primary",
link: !0,
size: u.value
}, {
default: () => [y(t.reference) ? t.reference : S("table.more"), n(B, {
class: "el-icon--right"
}, {
default: () => [n(z, null, null)]
})]
});
};
return () => {
const {
button: e,
scope: t
} = f;
if (!a(e, "hide", t, !1)) {
if (e.type === "dropdown") {
const c = h(e, m);
return n(w, d({
type: "primary",
size: u.value,
trigger: "click",
class: C.e("dropdown")
}, c, {
onCommand: (o) => {
var s;
const l = (s = e.children) == null ? void 0 : s.find((p) => p.label === o);
l && i(l.onClick) && l.onClick(t);
}
}), {
default: () => [k(t, e)],
dropdown: () => n(j, null, {
default: () => {
var o;
return [(o = e.children) == null ? void 0 : o.map((l) => {
const s = h(l, m);
return (i(l.hide) ? l.hide(t) : l.hide) ? null : n(D, d(s, {
disabled: a(l, "disabled", t, !1),
command: l.label
}), {
default: () => [l.label]
});
})];
}
})
});
}
return n(b, d({
size: u.value
}, {
...e,
type: e.type,
disabled: a(e, "disabled", t, !1),
onClick: () => {
i(e.onClick) && e.onClick(t);
}
}), {
default: () => [e.label]
});
}
return null;
};
}
});
export {
Y as default
};
//# sourceMappingURL=TableButton.mjs.map