@aplus-frontend/ui
Version:
95 lines (94 loc) • 3.24 kB
JavaScript
import { defineComponent as _, ref as v, computed as k, createBlock as n, openBlock as r, unref as o, withCtx as l, createElementVNode as w, normalizeClass as s, createVNode as u, createCommentVNode as B, normalizeProps as A, guardReactiveProps as b, renderSlot as C, createElementBlock as I, Fragment as P, renderList as D, mergeProps as m } from "vue";
import { Dropdown as N, Menu as $, MenuItem as h } from "@aplus-frontend/antdv";
import "../item/index.vue.mjs";
import "../item-modal/index.vue2.mjs";
import "../item-popconfirm/index.vue2.mjs";
import { IconApAdLineDown as L } from "@aplus-frontend/icon";
import "../../config-provider/index.mjs";
import { isUndefined as V, omit as z } from "lodash-unified";
import { useNamespace as E } from "../../config-provider/hooks/use-namespace.mjs";
import c from "../item/index.vue2.mjs";
import F from "../item-modal/index.vue.mjs";
import M from "../item-popconfirm/index.vue.mjs";
const T = /* @__PURE__ */ _({
name: "ApActionItemDropDown",
__name: "index",
props: {
trigger: { default: () => ["hover"] },
placement: { default: "bottomLeft" },
actions: { default: () => [] },
showIcon: { type: Boolean, default: !0 },
text: {},
color: { default: "primary" },
disabled: { type: Boolean, default: !1 },
visible: { type: Boolean, default: !0 },
onClick: {},
loading: { type: Boolean, default: !1 },
icon: {},
iconFirst: { type: Boolean }
},
setup(d) {
const f = d, i = v(!1), { e: p } = E("action-item-dropdown"), g = k(() => f.actions.filter((e) => e.visible || V(e.visible)).map((e) => ({
...e,
onAction: async (a) => {
try {
await e.onAction?.(a);
} finally {
i.value = !1;
}
}
})));
return (e, a) => (r(), n(o(N), {
open: i.value,
"onUpdate:open": a[0] || (a[0] = (t) => i.value = t),
trigger: e.trigger,
placement: e.placement
}, {
overlay: l(() => [
u(o($), null, {
default: l(() => [
(r(!0), I(P, null, D(g.value, (t, y) => (r(), n(o(h), {
key: y,
class: s(o(p)("item"))
}, {
default: l(() => [
t.modalProps ? (r(), n(F, m({
key: 0,
ref_for: !0
}, t), null, 16)) : t.popconfirmProps ? (r(), n(M, m({
key: 1,
ref_for: !0
}, t), null, 16)) : (r(), n(c, m({
key: 2,
ref_for: !0
}, t), null, 16))
]),
_: 2
}, 1032, ["class"]))), 128))
]),
_: 1
})
]),
default: l(() => [
w("span", {
class: s(o(p)("wrapper"))
}, [
u(c, A(b(o(z)(f, ["actions", "trigger", "placement"]))), {
default: l(() => [
C(e.$slots, "default")
]),
_: 3
}, 16),
e.showIcon ? (r(), n(o(L), {
key: 0,
class: s(o(p)("icon"))
}, null, 8, ["class"])) : B("", !0)
], 2)
]),
_: 3
}, 8, ["open", "trigger", "placement"]));
}
});
export {
T as default
};