"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),d=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:()=>({})},wrapperTooltip:{}},setup(t){const i=e.useSlots(),a=e.createPropsRestProxy(t,["color","disabled","visible","loading","iconFirst","icon","tooltip","wrapperTooltip"]),{b:u,m:l,e:f}=y.useNamespace("action-item"),c=e.ref(!1),r=e.computed(()=>t.iconFirst&&!!(t.icon||i.icon)),m=v.default("action-item");function s(o){e.unref(n)||t.disabled||(a.onClick?.(o),a.onAction&&(c.value=!0,a.onAction(o).finally(()=>c.value=!1)))}const n=e.computed(()=>t.loading||e.unref(c)),p=e.computed(()=>t.wrapperTooltip?typeof t.wrapperTooltip=="string"?{title:t.wrapperTooltip}:{...t.wrapperTooltip}:{title:null}),k=e.computed(()=>[m.value,u(),l(t.color),r.value?l("icon-first"):null,t.disabled?l("disabled"):null,n.value?l("loading"):null].filter(Boolean));return(o,b)=>(e.openBlock(),e.createBlock(e.unref(d.Tooltip),e.normalizeProps(e.guardReactiveProps(p.value)),{default:e.withCtx(()=>[e.renderSlot(o.$slots,"trigger",{loading:n.value,disabled:t.disabled,onClick:s},()=>[t.visible?(e.openBlock(),e.createElementBlock("span",e.mergeProps({key:0},o.$attrs,{class:k.value,onClick:s}),[e.createVNode(e.unref(g),{"prefix-cls":e.unref(u)(),"exist-icon":!1,loading:n.value},null,8,["prefix-cls","loading"]),t.icon||i.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(f)("icon-wrapper"))},[e.createVNode(e.unref(d.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(o.$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)])]),_:3},16))}});exports.default=C;
