phizclip-uniapp-demo/finclip-uniapp-test/unpackage/resources/__UNI__87380BE/www/__uniapppicker.js

4 lines
15 KiB
JavaScript
Raw Normal View History

2022-06-08 11:57:35 +08:00
"use weex:vue";
(()=>{var T=Object.create;var d=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var I=e=>d(e,"__esModule",{value:!0});var L=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var V=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of M(t))!D.call(e,s)&&(a||s!=="default")&&d(e,s,{get:()=>t[s],enumerable:!(r=x(t,s))||r.enumerable});return e},N=(e,t)=>V(I(d(e!=null?T(C(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var A=L((K,v)=>{v.exports=Vue});var _={data(){return{locale:"en",fallbackLocale:"en",localization:{en:{done:"OK",cancel:"Cancel"},zh:{done:"\u5B8C\u6210",cancel:"\u53D6\u6D88"},"zh-hans":{},"zh-hant":{},messages:{}}}},onLoad(){this.initLocale()},created(){this.initLocale()},methods:{initLocale(){if(this.__initLocale)return;this.__initLocale=!0;let e=(plus.webview.currentWebview().extras||{}).data||{};if(e.messages&&(this.localization.messages=e.messages),e.locale){this.locale=e.locale.toLowerCase();return}let t={chs:"hans",cn:"hans",sg:"hans",cht:"hant",tw:"hant",hk:"hant",mo:"hant"},a=plus.os.language.toLowerCase().split("/")[0].replace("_","-").split("-"),r=a[1];r&&(a[1]=t[r]||r),a.length=a.length>2?2:a.length,this.locale=a.join("-")},localize(e){let t=this.locale,a=t.split("-")[0],r=this.fallbackLocale,s=this.localization;function n(c){return s[c]||{}}return n("messages")[e]||n(t)[e]||n(a)[e]||n(r)[e]||e}}},b={onLoad(){this.initMessage()},methods:{initMessage(){let{from:e,callback:t,runtime:a,data:r={},useGlobalEvent:s}=plus.webview.currentWebview().extras||{};this.__from=e,this.__runtime=a,this.__page=plus.webview.currentWebview().id,this.__useGlobalEvent=s,this.data=JSON.parse(JSON.stringify(r)),plus.key.addEventListener("backbutton",()=>{typeof this.onClose=="function"?this.onClose():plus.webview.currentWebview().close("auto")});let n=this,c=function(o){let u=o.data&&o.data.__message;!u||n.__onMessageCallback&&n.__onMessageCallback(u.data)};if(this.__useGlobalEvent)weex.requireModule("globalEvent").addEventListener("plusMessage",c);else{let o=new BroadcastChannel(this.__page);o.onmessage=c}},postMessage(e={},t=!1){let a=JSON.parse(JSON.stringify({__message:{__page:this.__page,data:e,keep:t}})),r=this.__from;if(this.__runtime==="v8")this.__useGlobalEvent?plus.webview.postMessageToUniNView(a,r):new BroadcastChannel(r).postMessage(a);else{let s=plus.webview.getWebviewById(r);s&&s.evalJS(`__plusMessage&&__plusMessage(${JSON.stringify({data:a})})`)}},onMessage(e){this.__onMessageCallback=e}}};var i=N(A());var m=(e,t)=>{let a=e.__vccOpts||e;for(let[r,s]of t)a[r]=s;return a};var f=e=>e>9?e:"0"+e;function E({date:e=new Date,mode:t="date"}){return t==="time"?f(e.getHours())+":"+f(e.getMinutes()):e.getFullYear()+"-"+f(e.getMonth()+1)+"-"+f(e.getDate())}var O={data(){return{safeAreaInsets:{left:0,right:0,top:0,bottom:0}}},onLoad(){this.initSafeAreaInsets()},created(){this.initSafeAreaInsets()},methods:{initSafeAreaInsets(){if(this.__initSafeAreaInsets)return;this.__initSafeAreaInsets=!0;let e=plus.webview.currentWebview();e.addEventListener("resize",()=>{setTimeout(()=>{this.updateSafeAreaInsets(e)},20)}),this.updateSafeAreaInsets(e)},updateSafeAreaInsets(e){let t=e.getSafeAreaInsets(),a=this.safeAreaInsets;Object.keys(a).forEach(r=>{a[r]=t[r]})}}},z={content:{"":{position:"absolute",top:0,left:0,bottom:0,right:0}},"uni-mask":{"":{position:"absolute",top:0,left:0,bottom:0,right:0,backgroundColor:"rgba(0,0,0,0.4)",opacity:0,transitionProperty:"opacity",transitionDuration:200,transitionTimingFunction:"linear"}},"uni-mask-android":{"":{backgroundColor:"rgba(0,0,0,0.6)"}},"uni-mask-visible":{"":{opacity:1}},"uni-picker":{"":{position:"absolute",left:0,bottom:0,right:0,backgroundColor:"#ffffff",color:"#000000",flexDirection:"column",transform:"translateY(295px)"}},"uni-picker-header":{"":{height:45,borderBottomWidth:0,backgroundColor:"#E6E6E6",fontSize:20}},"uni-picker-action":{"":{position:"absolute",textAlign:"center",top:0,height:45,paddi
`)},_createTime(){var e=[],t=[];e.splice(0,e.length);for(let a=0;a<24;a++)e.push((a<10?"0":"")+a);t.splice(0,t.length);for(let a=0;a<60;a++)t.push((a<10?"0":"")+a);this.timeArray.push(e,t)},_createDate(){var e=[],t=new Date().getFullYear();for(let s=t-61,n=t+61;s<=n;s++)e.push(String(s));var a=[];for(let s=1;s<=12;s++)a.push((s<10?"0":"")+s);var r=[];for(let s=1;s<=31;s++)r.push((s<10?"0":"")+s);this.dateArray.push(e,a,r)},_getTimeValue(e){return e[0]*60+e[1]},_getDateValue(e){return e[0]*31*12+(e[1]||0)*31+(e[2]||0)},_cloneArray(e,t){for(let a=0;a<e.length&&a<t.length;a++)e[a]=t[a]},_setValueSync(){let e=this.value;switch(this.mode){case l.MULTISELECTOR:Array.isArray(e)||(e=[]),Array.isArray(this.valueSync)||(this.valueSync=[]);let t=this.valueSync.length=Math.max(e.length,this.range.length);for(let a=0;a<t;a++){let r=Number(e[a]),s=Number(this.valueSync[a]),n=isNaN(r)?isNaN(s)?0:s:r,c=this.range[a]?this.range[a].length-1:0;this.valueSync.splice(a,1,n<0||n>c?0:n)}break;case l.TIME:case l.DATE:this.valueSync=String(e);break;default:{let a=Number(e);this.valueSync=a<0?0:a;break}}},_setValueArray(){var e=this.valueSync,t;switch(this.mode){case l.MULTISELECTOR:t=[...e];break;case l.TIME:t=this._getDateValueArray(e,E({mode:l.TIME}));break;case l.DATE:t=this._getDateValueArray(e,E({mode:l.DATE}));break;default:t=[e];break}this.oldValueArray=[...t],this.valueArray=[...t]},_getValue(){var e=this.valueArray;switch(this.mode){case l.SELECTOR:return e[0];case l.MULTISELECTOR:return e.map(t=>t);case l.TIME:return this.valueArray.map((t,a)=>this.timeArray[a][t]).join(":");case l.DATE:return this.valueArray.map((t,a)=>this.dateArray[a][t]).join("-")}},_getDateValueArray(e,t){let a=this.mode===l.DATE?"-":":",r=this.mode===l.DATE?this.dateArray:this.timeArray,s=3;switch(this.fields){case h.YEAR:s=1;break;case h.MONTH:s=2;break}let n=String(e).split(a),c=[];for(let o=0;o<s;o++){let u=n[o];c.push(r[o].indexOf(u))}return c.indexOf(-1)>=0&&(c=t?this._getDateValueArray(t):c.map(()=>0)),c},_change(){this.$emit("change",{value:this._getValue()})},_cancel(){this.$emit("cancel")},_pickerViewChange(e){this.valueArray=this._l10nColumn(e.detail.value,!0)},_l10nColumn(e,t){if(this.mode===l.DATE){let a=this.locale;if(!a.startsWith("zh"))switch(this.fields){case h.YEAR:return e;case h.MONTH:return[e[1],e[0]];default:switch(a){case"es":case"fr":return[e[2],e[1],e[0]];default:return t?[e[2],e[0],e[1]]:[e[1],e[2],e[0]]}}}return e},_l10nItem(e,t){if(this.mode===l.DATE){let a=this.locale;if(a.startsWith("zh"))return e+["\u5E74","\u6708","\u65E5"][t];if(this.fields!==h.YEAR&&t===(this.fields!==h.MONTH&&(a==="es"||a==="fr")?1:0)){let r;switch(a){case"es":r=["enero","febrero","marzo","abril","mayo","junio","\u200B\u200Bjulio","agosto","septiembre","octubre","noviembre","diciembre"];break;case"fr":r=["janvier","f\xE9vrier","mars","avril","mai","juin","juillet","ao\xFBt","septembre","octobre","novembre","d\xE9cembre"];break;default:r=["January","February","March","April","May","June","July","August","September","October","November","December"];break}return r[Number(e)-1]}}return e}}};function Y(e,t,a,r,s,n){let c=(0,i.resolveComponent)("picker-view-column"),o=(0,i.resolveComponent)("picker-view");return(0,i.openBlock)(),(0,i.createElementBlock)("div",{class:"content"},[(0,i.createElementVNode)("div",{ref:"mask",class:"uni-mask",style:(0,i.normalizeStyle)({opacity:a.visible?1:0,"background-color":s.android?"rgba(0, 0, 0, 0.6)":"rgba(0, 0, 0, 0.4)"}),onClick:t[0]||(t[0]=(...u)=>n._cancel&&n._cancel(...u))},null,4),(0,i.createElementVNode)("div",{style:(0,i.normalizeStyle)(`padding-bottom:${e.safeAreaInsets.bottom}px;height:${s.height+e.safeAreaInsets.bottom}px;`),ref:"picker",class:"uni-picker"},[(0,i.createElementVNode)("div",{class:"uni-picker-header"},[(0,i.createElementVNode)("u-text",{style:(0,i.normalizeStyle)(`left:${e.safeAreaInsets.left}px`),class:"uni-picker-action uni-picker-action-cancel",onClick:t[1]||(t[1]=(...u)=>n._cancel&&n._cancel(...u))},(0,i.toDisplayString)(e.localize("cancel")),5),(0,i.createElementVNode)("u-text",{style:(0,i.normalizeStyl