"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),a=require("@aplus-frontend/antdv"),g=require("@aplus-frontend/icon"),i=require("lodash-unified");require("../../config-provider/index.js");require("../item/index.vue.js");require("../item-modal/index.vue2.js");require("../item-popconfirm/index.vue2.js");const k=require("../style/dropdown-item.js"),v=require("../../config-provider/hooks/use-namespace.js"),d=require("../item/index.vue2.js"),B=require("../item-modal/index.vue.js"),y=require("../item-popconfirm/index.vue.js"),C=e.defineComponent({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(r){const u=r,l=e.ref(!1),{e:c,b:p}=v.useNamespace("action-item-dropdown"),s=k.default("action-item-dropdown"),f=(t,o)=>{(o.source==="trigger"||t)&&(l.value=t)},m=e.computed(()=>u.actions.filter(t=>t.visible||i.isUndefined(t.visible)).map(t=>({...t,onClick:o=>{t.onClick?.(o),!t.onAction&&(l.value=!1)},onAction:t.onAction?async o=>{try{await t.onAction?.(o)}finally{l.value=!1}}:void 0})));return(t,o)=>(e.openBlock(),e.createBlock(e.unref(a.Dropdown),{open:l.value,trigger:r.trigger,placement:r.placement,class:e.normalizeClass(e.unref(s)),onOpenChange:f},{overlay:e.withCtx(()=>[e.createVNode(e.unref(a.Menu),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(n,_)=>(e.openBlock(),e.createBlock(e.unref(a.MenuItem),{key:_,class:e.normalizeClass([e.unref(s),e.unref(c)("item")])},{default:e.withCtx(()=>[n.modalProps?(e.openBlock(),e.createBlock(B.default,e.mergeProps({key:0,ref_for:!0},n),null,16)):n.popconfirmProps?(e.openBlock(),e.createBlock(y.default,e.mergeProps({key:1,ref_for:!0},n),null,16)):(e.openBlock(),e.createBlock(d.default,e.mergeProps({key:2,ref_for:!0},n),null,16))]),_:2},1032,["class"]))),128))]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("span",{class:e.normalizeClass(e.unref(p)())},[e.createVNode(d.default,e.normalizeProps(e.guardReactiveProps(e.unref(i.omit)(u,["actions","trigger","placement","text"]))),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(()=>r.text)))]),e.createElementVNode("span",{class:e.normalizeClass(e.unref(c)("icon"))},[r.showIcon?(e.openBlock(),e.createBlock(e.unref(g.IconApAdLineDown),{key:0})):e.createCommentVNode("",!0)],2)]),_:3},16)],2)]),_:3},8,["open","trigger","placement","class"]))}});exports.default=C;
