"use strict";const e=require("../uni-popup/popup.js"),t=require("../../../../common/vendor.js"),o=require("../uni-popup/i18n/index.js"),{t:i}=t.initVueI18n(o.messages),l={name:"uniPopupDialog",mixins:[e.popup],emits:["confirm","close","update:modelValue","input"],props:{inputType:{type:String,default:"text"},showClose:{type:Boolean,default:!0},modelValue:{type:[Number,String],default:""},placeholder:{type:[String,Number],default:""},type:{type:String,default:"error"},mode:{type:String,default:"base"},title:{type:String,default:""},content:{type:String,default:""},beforeClose:{type:Boolean,default:!1},cancelText:{type:String,default:""},confirmText:{type:String,default:""},maxlength:{type:Number,default:-1},focus:{type:Boolean,default:!0}},data:()=>({dialogType:"error",val:""}),computed:{okText(){return this.confirmText||i("uni-popup.ok")},closeText(){return this.cancelText||i("uni-popup.cancel")},placeholderText(){return this.placeholder||i("uni-popup.placeholder")},titleText(){return this.title||i("uni-popup.title")}},watch:{type(e){this.dialogType=e},mode(e){"input"===e&&(this.dialogType="info")},value(e){-1!=this.maxlength&&"input"===this.mode?this.val=e.slice(0,this.maxlength):this.val=e},val(e){this.$emit("update:modelValue",e)}},created(){this.popup.disableMask(),"input"===this.mode?(this.dialogType="info",this.val=this.value,this.val=this.modelValue):this.dialogType=this.type},methods:{onOk(){"input"===this.mode?this.$emit("confirm",this.val):this.$emit("confirm"),this.beforeClose||this.popup.close()},closeDialog(){this.$emit("close"),this.beforeClose||this.popup.close()},close(){this.popup.close()}}};const p=t._export_sfc(l,[["render",function(e,o,i,l,p,s){return t.e({a:t.t(s.titleText),b:t.n("uni-popup__"+p.dialogType),c:"base"===i.mode},"base"===i.mode?{d:t.t(i.content)}:{e:i.maxlength,f:i.inputType,g:s.placeholderText,h:i.focus,i:p.val,j:t.o((e=>p.val=e.detail.value))},{k:i.showClose},i.showClose?{l:t.t(s.closeText),m:t.o(((...e)=>s.closeDialog&&s.closeDialog(...e)))}:{},{n:t.t(s.okText),o:t.n(i.showClose?"uni-border-left":""),p:t.o(((...e)=>s.onOk&&s.onOk(...e)))})}]]);wx.createComponent(p);
