import{d as j,dc as L,a4 as _,bU as z,ci as O,aR as R,h as d,o as n,j as p,w as o,c as s,D as i,F as y,a9 as $,aI as q,p as f,A as c,B as E,aa as g,c6 as k,ca as S,df as G,G as M,dg as U,ab as H,i as B,N as J,l as K,c2 as Q}from"./index-9PRMimni.js";import{_ as W}from"./Flex-CTSf12gq.js";const X={class:"tableAction"},Y={class:"flex items-center"},te=j({__name:"TableAction",props:{actions:{type:Array,default:null,required:!0},dropDownActions:{type:Array,default:null},style:{type:String,default:"button"},gap:{type:Number,default:0},select:{type:Function,default:()=>{}},dropDownProps:{type:Object,default:()=>({label:"更多"})}},setup(a){const{hasPermission:x}=L(),r=a,b=r.style==="button"?"default":r.style==="text"?"primary":"default",v=r.style==="button"?void 0:r.style==="text"?!0:void 0,m=_(()=>{const{dropDownProps:e}=r;return{text:v,type:b,size:"small",...e}}),N=_(()=>r.style==="text"?[r.gap,0]:[5,r.gap]),h=_(()=>(z(r.dropDownActions)||[]).filter(e=>x(e.auth)&&C(e)).map(e=>{const{popConfirm:l}=e;return{size:"small",text:v,type:b,...e,...l,onConfirm:l?.confirm,onCancel:l?.cancel}}));function C(e){const l=e.ifShow;let u=!0;return O(l)&&(u=l),R(l)&&(u=l(e)),u}const w=_(()=>(z(r.actions)||[]).filter(e=>x(e.auth)&&C(e)).map(e=>{const{popConfirm:l}=e;return{size:"small",text:v,type:b,labelShow:!0,...e,...l||{},onConfirm:l?.confirm,onCancel:l?.cancel,enable:!!l}}));return(e,l)=>{const u=E,D=q,P=G,A=M,F=J,I=U,T=W;return n(),d("div",X,[p(T,{size:N.value,align:"center",justify:"center"},{default:o(()=>[(n(!0),d(y,null,$(w.value,(t,V)=>(n(),d(y,{key:t.label},[t.isConfirm?(n(),s(P,g({key:1,ref_for:!0},t),{trigger:o(()=>[p(u,g({ref_for:!0},t),k({default:o(()=>[t.labelShow?(n(),d(y,{key:0},[f(c(t.label),1)],64)):i("",!0)]),_:2},[t.icon?{name:"icon",fn:o(()=>[p(D,{disabled:!t.label,trigger:"hover"},{trigger:o(()=>[(n(),s(S(t.icon)))]),default:o(()=>[f(" "+c(t.label),1)]),_:2},1032,["disabled"])]),key:"0"}:void 0]),1040)]),default:o(()=>[f(" "+c(t.confirmContent),1)]),_:2},1040)):(n(),s(D,{key:0,disabled:!t.label,trigger:"hover"},{trigger:o(()=>[p(u,g({ref_for:!0},t),k({default:o(()=>[t.labelShow?(n(),d(y,{key:0},[f(c(t.label),1)],64)):i("",!0)]),_:2},[t.icon?{name:"icon",fn:o(()=>[(n(),s(S(t.icon)))]),key:"0"}:void 0]),1040)]),default:o(()=>[f(" "+c(t.label),1)]),_:2},1032,["disabled"])),a.style!=="button"&&V<w.value.length-1?(n(),s(A,{key:2,vertical:""})):i("",!0)],64))),128)),a.style!=="button"&&w.value.length&&a.dropDownActions&&h.value.length?(n(),s(A,{key:0,vertical:""})):i("",!0),a.dropDownActions&&h.value.length?(n(),s(I,{key:1,trigger:"hover",options:h.value,onSelect:a.select},{default:o(()=>[H(e.$slots,"more"),e.$slots.more?i("",!0):(n(),s(u,g({key:0,"icon-placement":"right"},m.value),k({default:o(()=>[B("div",Y,[B("span",null,c(a.dropDownProps.label),1),m.value.icon?i("",!0):(n(),s(F,{key:0,size:"14",class:"ml-1"},{default:o(()=>[p(K(Q))]),_:1}))])]),_:2},[m.value.icon?{name:"icon",fn:o(()=>[(n(),s(S(m.value.icon)))]),key:"0"}:void 0]),1040))]),_:3},8,["options","onSelect"])):i("",!0)]),_:3},8,["size"])])}}});export{te as _};
