officialAccount/unpackage/dist/build/web/assets/u-modal.BB9A0sdf.js

2 lines
15 KiB
JavaScript

import{o as e,c as t,n as o,d as l,e as i,i as s,w as a,Y as n,k as r,b as u,x as c,g as d,h,Q as m,a as p,S as y,t as f,F as g}from"./index-DaJpSunw.js";import{_ as b}from"./_plugin-vue_export-helper.BCo6x5W8.js";import{r as S}from"./uni-app.es.ClZiJTbk.js";const k=b({name:"u-loading",props:{mode:{type:String,default:"circle"},color:{type:String,default:"#c7c7c7"},size:{type:[String,Number],default:"34"},show:{type:Boolean,default:!0}},computed:{cricleStyle(){let e={};return e.width=this.size+"rpx",e.height=this.size+"rpx","circle"==this.mode&&(e.borderColor=`#e4e4e4 #e4e4e4 #e4e4e4 ${this.color?this.color:"#c7c7c7"}`),e}}},[["render",function(a,n,r,u,c,d){const h=s;return r.show?(e(),t(h,{key:0,class:o(["u-loading","circle"==r.mode?"u-loading-circle":"u-loading-flower"]),style:l([d.cricleStyle])},null,8,["class","style"])):i("",!0)}],["__scopeId","data-v-ae8dd367"]]);const C=b({name:"u-mask",emits:["click"],props:{show:{type:Boolean,default:!1},zIndex:{type:[Number,String],default:""},customStyle:{type:Object,default:()=>({})},zoom:{type:Boolean,default:!0},duration:{type:[Number,String],default:300},maskClickAble:{type:Boolean,default:!0},blur:{type:[Number,String],default:0}},data:()=>({zoomStyle:{transform:""},scale:"scale(1.2, 1.2)"}),watch:{show(e){e&&this.zoom?this.zoomStyle.transform="scale(1, 1)":!e&&this.zoom&&(this.zoomStyle.transform=this.scale)}},computed:{maskStyle(){let e={backgroundColor:"rgba(0, 0, 0, 0.6)"};return this.show?e.zIndex=this.zIndex?this.zIndex:this.$u.zIndex.mask:e.zIndex=-1,e.transition=`all ${this.duration/1e3}s ease-in-out`,Object.keys(this.customStyle).length&&(e={...e,...this.customStyle}),e},filterStyle(){let{blur:e}=this,t={};return e&&(t.backdropFilter=`blur(${e}rpx)`),t}},methods:{click(){this.maskClickAble&&this.$emit("click")}}},[["render",function(i,u,c,d,h,m){const p=s;return e(),t(p,{class:o(["u-mask",{"u-mask-zoom":c.zoom,"u-mask-show":c.show}]),"hover-stop-propagation":"",style:l([m.maskStyle,h.zoomStyle,m.filterStyle]),onClick:m.click,onTouchmove:r((()=>{}),["stop","prevent"])},{default:a((()=>[n(i.$slots,"default",{},void 0,!0)])),_:3},8,["style","onClick","class"])}],["__scopeId","data-v-005d3602"]]);const _=b({name:"u-icon",emits:["click","touchstart"],props:{name:{type:String,default:""},color:{type:[String,null],default:""},size:{type:[Number,String],default:"inherit"},bold:{type:Boolean,default:!1},index:{type:[Number,String],default:""},hoverClass:{type:String,default:""},customPrefix:{type:String,default:"uicon"},label:{type:[String,Number],default:""},labelPos:{type:String,default:"right"},labelSize:{type:[String,Number],default:"28"},labelColor:{type:String,default:"#606266"},marginLeft:{type:[String,Number],default:"6"},marginTop:{type:[String,Number],default:"6"},marginRight:{type:[String,Number],default:"6"},marginBottom:{type:[String,Number],default:"6"},imgMode:{type:String,default:"widthFix"},customStyle:{type:Object,default:()=>({})},width:{type:[String,Number],default:""},height:{type:[String,Number],default:""},top:{type:[String,Number],default:0},showDecimalIcon:{type:Boolean,default:!1},inactiveColor:{type:String,default:"#ececec"},percent:{type:[Number,String],default:"50"}},computed:{customClass(){let e=[],{customPrefix:t,name:o}=this,l=o.indexOf("-icon-");return l>-1?(t=o.substring(0,l+5),e.push(o)):e.push(`${t}-${o}`),"uicon"===t?e.push("u-iconfont"):e.push(t),this.showDecimalIcon&&this.inactiveColor&&this.$u.config.type.includes(this.inactiveColor)?e.push("u-icon__icon--"+this.inactiveColor):this.color&&this.$u.config.type.includes(this.color)&&e.push("u-icon__icon--"+this.color),e},iconStyle(){let e={};return e={fontSize:"inherit"==this.size?"inherit":this.$u.addUnit(this.size),fontWeight:this.bold?"bold":"normal",top:this.$u.addUnit(this.top)},this.showDecimalIcon&&this.inactiveColor&&!this.$u.config.type.includes(this.inactiveColor)?e.color=this.inactiveColor:this.color&&!this.$u.config.type.includes(this.color)&&(e.color=this.color),e},isImg(){return-1!==this.name.indexOf("/")},imgStyle(){let e={};return e.width=this.width?this.$u.addUnit(this.width):this.$u.addUnit(this.size),e.height=this.height?this.$u.addUnit(this.height):this.$u.addUnit(this.size),e},decimalIconStyle(){let e={};return e={fontSize:"inherit"==this.size?"inherit":this.$u.addUnit(this.size),fontWeight:this.bold?"bold":"normal",top:this.$u.addUnit(this.top),width:this.percent+"%"},this.color&&!this.$u.config.type.includes(this.color)&&(e.color=this.color),e},decimalIconClass(){let e=[];return e.push(this.customPrefix+"-"+this.name),"uicon"==this.customPrefix?e.push("u-iconfont"):e.push(this.customPrefix),this.color&&this.$u.config.type.includes(this.color)?e.push("u-icon__icon--"+this.color):e.push("u-icon__icon--primary"),e}},methods:{click(){this.$emit("click",this.index)},touchstart(){this.$emit("touchstart",this.index)}}},[["render",function(n,r,m,p,y,f){const g=d,b=h,S=s;return e(),t(S,{style:l([m.customStyle]),class:o(["u-icon",["u-icon--"+m.labelPos]]),onClick:f.click},{default:a((()=>[f.isImg?(e(),t(g,{key:0,class:"u-icon__img",src:m.name,mode:m.imgMode,style:l([f.imgStyle])},null,8,["src","mode","style"])):(e(),t(S,{key:1,class:o(["u-icon__icon",f.customClass]),style:l([f.iconStyle]),"hover-class":m.hoverClass,onTouchstart:f.touchstart},{default:a((()=>[m.showDecimalIcon?(e(),t(b,{key:0,style:l([f.decimalIconStyle]),class:o([f.decimalIconClass,"u-icon__decimal"]),"hover-class":m.hoverClass},null,8,["style","class","hover-class"])):i("",!0)])),_:1},8,["class","style","hover-class","onTouchstart"])),""!==m.label&&null!==m.label?(e(),t(b,{key:2,class:"u-icon__label",style:l({color:m.labelColor,fontSize:n.$u.addUnit(m.labelSize),marginLeft:"right"==m.labelPos?n.$u.addUnit(m.marginLeft):0,marginTop:"bottom"==m.labelPos?n.$u.addUnit(m.marginTop):0,marginRight:"left"==m.labelPos?n.$u.addUnit(m.marginRight):0,marginBottom:"top"==m.labelPos?n.$u.addUnit(m.marginBottom):0})},{default:a((()=>[u(c(m.label),1)])),_:1},8,["style"])):i("",!0)])),_:1},8,["style","onClick","class"])}],["__scopeId","data-v-32e6a46e"]]);const x=b({name:"u-popup",emits:["update:modelValue","input","open","close"],props:{value:{type:Boolean,default:!1},modelValue:{type:Boolean,default:!1},show:{type:Boolean,default:!1},mode:{type:String,default:"left"},mask:{type:Boolean,default:!0},length:{type:[Number,String],default:"auto"},zoom:{type:Boolean,default:!0},safeAreaInsetBottom:{type:Boolean,default:!1},maskCloseAble:{type:Boolean,default:!0},customStyle:{type:Object,default:()=>({})},popup:{type:Boolean,default:!0},borderRadius:{type:[Number,String],default:0},zIndex:{type:[Number,String],default:""},closeable:{type:Boolean,default:!1},closeIcon:{type:String,default:"close"},closeIconPos:{type:String,default:"top-right"},closeIconColor:{type:String,default:"#909399"},closeIconSize:{type:[String,Number],default:"30"},width:{type:String,default:""},height:{type:String,default:""},negativeTop:{type:[String,Number],default:0},maskCustomStyle:{type:Object,default:()=>({})},duration:{type:[String,Number],default:250},blur:{type:[String,Number],default:0},backgroundColor:{type:String,default:"#ffffff"}},data:()=>({visibleSync:!1,showDrawer:!1,timer:null,closeFromInner:!1}),computed:{valueCom(){return this.modelValue},style(){let e={};if("left"==this.mode||"right"==this.mode?e={width:this.width?this.getUnitValue(this.width):this.getUnitValue(this.length),height:"100%",transform:`translate3D(${"left"==this.mode?"-100%":"100%"},0px,0px)`}:"top"!=this.mode&&"bottom"!=this.mode||(e={width:"100%",height:this.height?this.getUnitValue(this.height):this.getUnitValue(this.length),transform:`translate3D(0px,${"top"==this.mode?"-100%":"100%"},0px)`}),e.zIndex=this.uZindex,this.borderRadius){switch(this.mode){case"left":e.borderRadius=`0 ${this.borderRadius}rpx ${this.borderRadius}rpx 0`;break;case"top":e.borderRadius=`0 0 ${this.borderRadius}rpx ${this.borderRadius}rpx`;break;case"right":e.borderRadius=`${this.borderRadius}rpx 0 0 ${this.borderRadius}rpx`;break;case"bottom":e.borderRadius=`${this.borderRadius}rpx ${this.borderRadius}rpx 0 0`}e.overflow="hidden"}return this.duration&&(e.transition=`all ${this.duration/1e3}s linear`),e},centerStyle(){let e={};return e.width=this.width?this.getUnitValue(this.width):this.getUnitValue(this.length),e.height=this.height?this.getUnitValue(this.height):"auto",e.zIndex=this.uZindex,e.marginTop=`-${this.$u.addUnit(this.negativeTop)}`,this.borderRadius&&(e.borderRadius=`${this.borderRadius}rpx`,e.overflow="hidden"),e},uZindex(){return this.zIndex?this.zIndex:this.$u.zIndex.popup}},watch:{valueCom:{handler(e){e?this.open():this.closeFromInner||this.close(),this.closeFromInner=!1}}},mounted(){this.valueCom&&this.open()},methods:{getUnitValue:e=>/(%|px|rpx|auto)$/.test(e)?e:e+"rpx",maskClick(){this.close()},close(){this.closeFromInner=!0,this.change("showDrawer","visibleSync",!1)},modeCenterClose(e){"center"==e&&this.maskCloseAble&&this.close()},open(){this.change("visibleSync","showDrawer",!0)},change(e,t,o){1==this.popup&&(this.$emit("input",o),this.$emit("update:modelValue",o)),this[e]=o,this.timer=o?setTimeout((()=>{this[t]=o,this.$emit(o?"open":"close")}),50):setTimeout((()=>{this[t]=o,this.$emit(o?"open":"close")}),this.duration)}}},[["render",function(u,c,d,h,f,g){const b=S(m("u-mask"),C),k=S(m("u-icon"),_),x=y,$=s;return f.visibleSync?(e(),t($,{key:0,style:l([d.customStyle,{zIndex:g.uZindex-1,"--bgcolor":d.backgroundColor}]),class:"u-drawer","hover-stop-propagation":""},{default:a((()=>[p(b,{blur:d.blur,duration:d.duration,"custom-style":d.maskCustomStyle,maskClickAble:d.maskCloseAble,"z-index":g.uZindex-2,show:f.showDrawer&&d.mask,onClick:g.maskClick},null,8,["blur","duration","custom-style","maskClickAble","z-index","show","onClick"]),p($,{class:o(["u-drawer-content",[d.safeAreaInsetBottom?"safe-area-inset-bottom":"","u-drawer-"+d.mode,f.showDrawer?"u-drawer-content-visible":"",d.zoom&&"center"==d.mode?"u-animation-zoom":""]]),onClick:c[2]||(c[2]=e=>g.modeCenterClose(d.mode)),onTouchmove:c[3]||(c[3]=r((()=>{}),["stop","prevent"])),style:l([g.style])},{default:a((()=>["center"==d.mode?(e(),t($,{key:0,class:"u-mode-center-box",onClick:c[0]||(c[0]=r((()=>{}),["stop","prevent"])),onTouchmove:c[1]||(c[1]=r((()=>{}),["stop","prevent"])),style:l([g.centerStyle])},{default:a((()=>[d.closeable?(e(),t(k,{key:0,onClick:g.close,class:o(["u-close",["u-close--"+d.closeIconPos]]),name:d.closeIcon,color:d.closeIconColor,size:d.closeIconSize},null,8,["onClick","class","name","color","size"])):i("",!0),p(x,{class:"u-drawer__scroll-view","scroll-y":"true"},{default:a((()=>[n(u.$slots,"default",{},void 0,!0)])),_:3})])),_:3},8,["style"])):(e(),t(x,{key:1,class:"u-drawer__scroll-view","scroll-y":"true"},{default:a((()=>[n(u.$slots,"default",{},void 0,!0)])),_:3})),p($,{onClick:g.close,class:o(["u-close",["u-close--"+d.closeIconPos]])},{default:a((()=>["center"!=d.mode&&d.closeable?(e(),t(k,{key:0,name:d.closeIcon,color:d.closeIconColor,size:d.closeIconSize},null,8,["name","color","size"])):i("",!0)])),_:1},8,["onClick","class"])])),_:3},8,["class","style"])])),_:3},8,["style"])):i("",!0)}],["__scopeId","data-v-347b63c9"]]);const $=b({name:"u-modal",emits:["update:modelValue","input","confirm","cancel"],props:{value:{type:Boolean,default:!1},modelValue:{type:Boolean,default:!1},zIndex:{type:[Number,String],default:""},title:{type:[String],default:"提示"},width:{type:[Number,String],default:600},content:{type:String,default:"内容"},showTitle:{type:Boolean,default:!0},showConfirmButton:{type:Boolean,default:!0},showCancelButton:{type:Boolean,default:!1},confirmText:{type:String,default:"确认"},cancelText:{type:String,default:"取消"},confirmColor:{type:String,default:"#2979ff"},cancelColor:{type:String,default:"#606266"},borderRadius:{type:[Number,String],default:16},titleStyle:{type:Object,default:()=>({})},contentStyle:{type:Object,default:()=>({})},cancelStyle:{type:Object,default:()=>({})},confirmStyle:{type:Object,default:()=>({})},zoom:{type:Boolean,default:!0},asyncClose:{type:Boolean,default:!1},maskCloseAble:{type:Boolean,default:!1},negativeTop:{type:[String,Number],default:0},blur:{type:[Number,String],default:0}},data:()=>({loading:!1,popupValue:!1}),computed:{valueCom(){return this.modelValue},cancelBtnStyle(){return Object.assign({color:this.cancelColor},this.cancelStyle)},confirmBtnStyle(){return Object.assign({color:this.confirmColor},this.confirmStyle)},uZIndex(){return this.zIndex?this.zIndex:this.$u.zIndex.popup}},watch:{valueCom:{immediate:!0,handler(e){!0===e&&(this.loading=!1),this.popupValue=e}}},methods:{confirm(){this.asyncClose?this.loading=!0:(this.$emit("input",!1),this.$emit("update:modelValue",!1)),this.$emit("confirm")},cancel(){this.$emit("cancel"),this.$emit("input",!1),this.$emit("update:modelValue",!1),setTimeout((()=>{this.loading=!1}),300)},popupClose(){this.$emit("input",!1),this.$emit("update:modelValue",!1)},clearLoading(){this.loading=!1}}},[["render",function(o,r,d,h,y,b){const C=s,_=S(m("u-loading"),k),$=S(m("u-popup"),x);return e(),t(C,null,{default:a((()=>[p($,{blur:d.blur,zoom:d.zoom,mode:"center",popup:!1,"z-index":b.uZIndex,modelValue:y.popupValue,"onUpdate:modelValue":r[0]||(r[0]=e=>y.popupValue=e),length:d.width,"mask-close-able":d.maskCloseAble,"border-radius":d.borderRadius,onClose:b.popupClose,"negative-top":d.negativeTop},{default:a((()=>[p(C,{class:"u-model"},{default:a((()=>[d.showTitle?(e(),t(C,{key:0,class:"u-model__title u-line-1",style:l([d.titleStyle])},{default:a((()=>[u(c(d.title),1)])),_:1},8,["style"])):i("",!0),p(C,{class:"u-model__content"},{default:a((()=>[o.$slots.default||o.$slots.$default?(e(),t(C,{key:0,style:l([d.contentStyle])},{default:a((()=>[n(o.$slots,"default",{},void 0,!0)])),_:3},8,["style"])):(e(),t(C,{key:1,class:"u-model__content__message",style:l([d.contentStyle])},{default:a((()=>[u(c(d.content),1)])),_:1},8,["style"]))])),_:3}),d.showCancelButton||d.showConfirmButton?(e(),t(C,{key:1,class:"u-model__footer u-border-top"},{default:a((()=>[d.showCancelButton?(e(),t(C,{key:0,"hover-stay-time":100,"hover-class":"u-model__btn--hover",class:"u-model__footer__button",style:l([b.cancelBtnStyle]),onClick:b.cancel},{default:a((()=>[u(c(d.cancelText),1)])),_:1},8,["style","onClick"])):i("",!0),d.showConfirmButton||o.$slots["confirm-button"]?(e(),t(C,{key:1,"hover-stay-time":100,"hover-class":d.asyncClose?"none":"u-model__btn--hover",class:"u-model__footer__button hairline-left",style:l([b.confirmBtnStyle]),onClick:b.confirm},{default:a((()=>[o.$slots["confirm-button"]?n(o.$slots,"confirm-button",{key:0},void 0,!0):(e(),f(g,{key:1},[y.loading?(e(),t(_,{key:0,mode:"circle",color:d.confirmColor},null,8,["color"])):(e(),f(g,{key:1},[u(c(d.confirmText),1)],64))],64))])),_:3},8,["hover-class","style","onClick"])):i("",!0)])),_:3})):i("",!0)])),_:3})])),_:3},8,["blur","zoom","z-index","modelValue","length","mask-close-able","border-radius","onClose","negative-top"])])),_:3})}],["__scopeId","data-v-4aed7a24"]]);export{$ as _,x as a};