UNPKG

@aplus-frontend/ui

Version:

99 lines (98 loc) 3.38 kB
import { defineComponent as w, ref as B, computed as A, createBlock as n, openBlock as r, unref as o, normalizeClass as s, withCtx as l, createElementVNode as c, createVNode as d, normalizeProps as b, guardReactiveProps as I, renderSlot as h, createCommentVNode as C, createElementBlock as P, Fragment as D, renderList as N, mergeProps as p } from "vue"; import { Dropdown as $, Menu as L, MenuItem as V } from "@aplus-frontend/antdv"; import "../item/index.vue.mjs"; import "../item-modal/index.vue2.mjs"; import "../item-popconfirm/index.vue2.mjs"; import { IconApAdLineDown as z } from "@aplus-frontend/icon"; import "../../config-provider/index.mjs"; import { isUndefined as E, omit as F } from "lodash-unified"; import M from "../style/dropdown-item.mjs"; import { useNamespace as S } from "../../config-provider/hooks/use-namespace.mjs"; import y from "../item/index.vue2.mjs"; import U from "../item-modal/index.vue.mjs"; import x from "../item-popconfirm/index.vue.mjs"; const Z = /* @__PURE__ */ w({ 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 }, tooltip: {} }, setup(g) { const m = g, i = B(!1), { e: f, b: _ } = S("action-item-dropdown"), u = M("action-item-dropdown"), v = A(() => m.actions.filter((e) => e.visible || E(e.visible)).map((e) => ({ ...e, onAction: async (a) => { try { await e.onAction?.(a); } finally { i.value = !1; } } }))); return (e, a) => (r(), n(o($), { open: i.value, "onUpdate:open": a[0] || (a[0] = (t) => i.value = t), trigger: e.trigger, placement: e.placement, class: s(o(u)) }, { overlay: l(() => [ d(o(L), null, { default: l(() => [ (r(!0), P(D, null, N(v.value, (t, k) => (r(), n(o(V), { key: k, class: s([o(u), o(f)("item")]) }, { default: l(() => [ t.modalProps ? (r(), n(U, p({ key: 0, ref_for: !0 }, t), null, 16)) : t.popconfirmProps ? (r(), n(x, p({ key: 1, ref_for: !0 }, t), null, 16)) : (r(), n(y, p({ key: 2, ref_for: !0 }, t), null, 16)) ]), _: 2 }, 1032, ["class"]))), 128)) ]), _: 1 }) ]), default: l(() => [ c("span", { class: s(o(_)()) }, [ d(y, b(I(o(F)(m, ["actions", "trigger", "placement"]))), { default: l(() => [ h(e.$slots, "default") ]), _: 3 }, 16), c("span", { class: s(o(f)("icon")) }, [ e.showIcon ? (r(), n(o(z), { key: 0 })) : C("", !0) ], 2) ], 2) ]), _: 3 }, 8, ["open", "trigger", "placement", "class"])); } }); export { Z as default };