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