"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k=require("@aplus-frontend/antdv"),g=require("@aplus-frontend/antdv/es/button/LoadingIcon");require("../../config-provider/index.js");const v=require("../style/index.js"),y=require("../../config-provider/hooks/use-namespace.js"),B={key:1},C=e.defineComponent({name:"ApActionItem",__name:"index",props:{text:{},color:{default:"primary"},disabled:{type:Boolean,default:!1},visible:{type:Boolean,default:!0},onAction:{type:Function},onClick:{type:Function},loading:{type:Boolean,default:!1},icon:{},iconFirst:{type:Boolean,default:!1},tooltip:{default:()=>({})}},setup(t){const i=e.useSlots(),a=e.createPropsRestProxy(t,["color","disabled","visible","loading","iconFirst","icon","tooltip"]),{b:s,m:o,e:d}=y.useNamespace("action-item"),c=e.ref(!1),r=e.computed(()=>t.iconFirst&&!!(t.icon||i.icon)),f=v.default("action-item");function u(n){e.unref(l)||t.disabled||(a.onClick?.(n),a.onAction&&(c.value=!0,a.onAction(n).finally(()=>c.value=!1)))}const l=e.computed(()=>t.loading||e.unref(c)),m=e.computed(()=>[f.value,s(),o(t.color),r.value?o("icon-first"):null,t.disabled?o("disabled"):null,l.value?o("loading"):null].filter(Boolean));return(n,b)=>e.renderSlot(n.$slots,"trigger",{loading:l.value,disabled:t.disabled,onClick:u},()=>[t.visible?(e.openBlock(),e.createElementBlock("span",e.mergeProps({key:0},n.$attrs,{class:m.value,onClick:u}),[e.createVNode(e.unref(g),{"prefix-cls":e.unref(s)(),"exist-icon":!1,loading:l.value},null,8,["prefix-cls","loading"]),t.icon||i.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(d)("icon-wrapper"))},[e.createVNode(e.unref(k.Tooltip),e.mergeProps({title:r.value?t.text:null},t.tooltip),{default:e.withCtx(()=>[e.createElementVNode("span",null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon||i.icon)))])]),_:1},16,["title"])],2)):e.createCommentVNode("",!0),r.value?e.createCommentVNode("",!0):e.renderSlot(n.$slots,"default",{key:1},()=>[e.isVNode(t.text)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.text),{key:0})):(e.openBlock(),e.createElementBlock("span",B,e.toDisplayString(t.text||""),1))])],16)):e.createCommentVNode("",!0)])}});exports.default=C;
