"use strict";const e=require("vue"),a=require("../Shared/base-iCmnU-fv.js"),b=require("../Shared/Index.vue_vue_type_script_setup_true_lang-DxWcQL_8.js"),I=require("../Web/__directive__/Waves.cjs"),V=require("../Shared/_plugin-vue_export-helper-BHFhmbuH.js"),D={class:"panel-btn-parent"},L=["disabled"],T={key:1,class:"btn-label"},P={key:0,class:"btn-loading"},q={class:"btn-body-backdrop-container"},W={class:"btn-body-backdrop-text"},$=e.defineComponent({name:"ClButton",directives:{clwaves:I.wavesBind},__name:"Index",props:{className:{type:String,default:""},label:{type:String,default:""},icon:{type:String,default:""},color:{type:String,default:"default"},size:{type:String,default:""},disabled:{type:Boolean,default:!1},isShowLoad:{type:Boolean,default:!1},loadPos:{type:String,default:"right",validator:n=>["right","zoom-out","fixedCenter"].indexOf(n)!==-1},loadTheme:{type:String,default:"rotaryLine"},loadDrift:{type:Boolean,default:!0},loadText:{type:String,default:""},isShowBackDrop:{type:Boolean,default:!1},isShowWaves:{type:Boolean,default:!0},wavesColor:{type:String,default:"white"},loadStatusIsIng:{type:[Boolean,null],default:null}},emits:["onClick"],setup(n,{expose:y,emit:h}){const o=n;a.CommonBase.isEmpty(o.label)&&a.CommonBase.isEmpty(o.icon)&&console.warn('[ClButton] Warning: Either "label" or "icon" prop is required.');const k=h,i=e.ref(null),s=e.ref(!1),c=e.ref(!1),u=e.ref(!1),p=e.computed(()=>!a.CommonBase.isEmpty(o.label)),d=e.computed(()=>!a.CommonBase.isEmpty(o.icon)),C=e.computed(()=>o.disabled?!0:s.value),r=e.computed(()=>o.loadPos==="fixedCenter"),_=e.computed(()=>{let t=o.wavesColor||"white";return(a.CommonBase.isExistValue(o.color,"white")||a.CommonBase.isExistValue(o.color,"grayLight"))&&(t="black"),t}),f=e.computed(()=>{let t=o.loadPos||"right";return a.CommonBase.isExistValue(o.className,"btn-circle")&&a.CommonBase.isExistValue(t,"right")&&(t="zoom-out"),t}),v=e.computed(()=>{let t="large";switch(o.loadTheme){case"rotaryLine":t=o.size==="small"?"small":"large",a.CommonBase.isExistValue(o.className,"btn-circle")&&(t="small");break;case"circleNotch":t="large";break;case"circleBubble":t="small";break}return t}),E=e.computed(()=>{const t={"btn-parent":!0,btn:!0};return a.CommonBase.isEmpty(o.color)||(t[`btn-${o.color}`]=!0),a.CommonBase.isEmpty(o.className)||o.className?.split(" ").forEach(l=>{a.CommonBase.isEmpty(l)||(t[l]=!0)}),a.CommonBase.isEmpty(o.size)||(t[`btn-${o.size}`]=!0),t["btn-load-ing"]=s.value,s.value&&(t[`btn-load-${f.value}`]=!0,t[`btn-load-${o.loadTheme}`]=!0,t["btn-load-nodrift"]=!o.loadDrift),i.value&&i.value.className&&i.value.className.split(" ").forEach(l=>{a.CommonBase.isEmpty(l)||a.CommonBase.isExistJsonKey(t,l)||(t[l]=!0)}),t}),g=e.computed(()=>{const t={"btn-icon":!0};return d.value&&o.icon?.split(" ").forEach(l=>{a.CommonBase.isEmpty(l)||(t[l]=!0)}),t}),S=e.computed(()=>{const t=s.value&&r.value;return{"btn-body-backdrop-main":!0,animated:!0,zoomIn:t,zoomOut:!t}}),w=e.computed(()=>{const t={};return(p.value||d.value)&&f.value==="zoom-out"&&s.value&&!r.value&&(t.opacity=0),t}),m=()=>{s.value||(o.isShowBackDrop&&(c.value=!0,u.value=!0),s.value=!0)},B=()=>{o.isShowBackDrop&&(r.value?e.nextTick(()=>{setTimeout(()=>{c.value=!1,u.value=!1},200)}):c.value=!1),s.value=!1};e.watch(()=>o.loadStatusIsIng,t=>{a.CommonBase.isBoolean(t)&&(t?m():B())});const x=()=>{k("onClick")},z=()=>{o.disabled||(o.isShowLoad&&m(),x())};return y({loadStart:()=>{m()},loadStop:()=>{B()}}),(t,l)=>{const N=e.resolveDirective("clwaves");return e.openBlock(),e.createElementBlock("span",D,[e.withDirectives((e.openBlock(),e.createElementBlock("button",{ref_key:"refElTopParent",ref:i,type:"button",class:e.normalizeClass(E.value),disabled:C.value,onClick:z},[e.createElementVNode("span",{style:e.normalizeStyle(w.value)},[d.value?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(g.value)},null,2)):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createElementBlock("span",T,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0)],4),s.value&&!r.value?(e.openBlock(),e.createElementBlock("span",P,[e.createVNode(b._sfc_main,{theme:n.loadTheme,size:v.value},null,8,["theme","size"])])):e.createCommentVNode("",!0)],10,L)),[[N,{color:_.value}]]),c.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l[0]||(l[0]=e.createElementVNode("div",{class:"btn-body-backdrop"},null,-1)),r.value&&u.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(S.value)},[e.createElementVNode("div",q,[e.createVNode(b._sfc_main,{theme:n.loadTheme,size:v.value},null,8,["theme","size"]),e.createElementVNode("div",W,e.toDisplayString(n.loadText||"加载中"),1)])],2)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)])}}}),R=V._export_sfc($,[["__scopeId","data-v-3215c07e"]]);module.exports=R;
//# sourceMappingURL=ClButton.cjs.map
