TraceabilityAPP/unpackage/dist/dev/app-plus/__uniapppicker.js

34 lines
17 KiB
JavaScript
Raw Normal View History

2023-10-17 16:02:55 +08:00
"use weex:vue";
if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
Promise.prototype.finally = function(callback) {
const promise = this.constructor
return this.then(
value => promise.resolve(callback()).then(() => value),
reason => promise.resolve(callback()).then(() => {
throw reason
})
)
}
};
if (typeof uni !== 'undefined' && uni && uni.requireGlobal) {
const global = uni.requireGlobal()
ArrayBuffer = global.ArrayBuffer
Int8Array = global.Int8Array
Uint8Array = global.Uint8Array
Uint8ClampedArray = global.Uint8ClampedArray
Int16Array = global.Int16Array
Uint16Array = global.Uint16Array
Int32Array = global.Int32Array
Uint32Array = global.Uint32Array
Float32Array = global.Float32Array
Float64Array = global.Float64Array
BigInt64Array = global.BigInt64Array
BigUint64Array = global.BigUint64Array
};
(()=>{var D=Object.create;var b=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var V=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var L=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of x(t))!I.call(e,r)&&r!==a&&b(e,r,{get:()=>t[r],enumerable:!(i=C(t,r))||i.enumerable});return e};var N=(e,t,a)=>(a=e!=null?D(M(e)):{},L(t||!e||!e.__esModule?b(a,"default",{value:e,enumerable:!0}):a,e));var A=V((U,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:{}},localizationTemplate:{}}},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("-"),i=a[1];i&&(a[1]=t[i]||i),a.length=a.length>2?2:a.length,this.locale=a.join("-")},localize(e){let t=this.locale,a=t.split("-")[0],i=this.fallbackLocale,r=n=>Object.assign({},this.localization[n],(this.localizationTemplate||{})[n]);return r("messages")[e]||r(t)[e]||r(a)[e]||r(i)[e]||e}}},k={onLoad(){this.initMessage()},methods:{initMessage(){let{from:e,callback:t,runtime:a,data:i={},useGlobalEvent:r}=plus.webview.currentWebview().extras||{};this.__from=e,this.__runtime=a,this.__page=plus.webview.currentWebview().id,this.__useGlobalEvent=r,this.data=JSON.parse(JSON.stringify(i)),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}})),i=this.__from;if(this.__runtime==="v8")this.__useGlobalEvent?plus.webview.postMessageToUniNView(a,i):new BroadcastChannel(i).postMessage(a);else{let r=plus.webview.getWebviewById(i);r&&r.evalJS(`__plusMessage&&__plusMessage(${JSON.stringify({data:a})})`)}},onMessage(e){this.__onMessageCallback=e}}};var s=N(A());var m=(e,t)=>{let a=e.__vccOpts||e;for(let[i,r]of t)a[i]=r;return a};var d=e=>e>9?e:"0"+e;function w({date:e=new Date,mode:t="date"}){return t==="time"?d(e.getHours())+":"+d(e.getMinutes()):e.getFullYear()+"-"+d(e.getMonth()+1)+"-"+d(e.getDate())}var O={data(){return{darkmode:!1,theme:"light"}},onLoad(){this.initDarkmode()},created(){this.initDarkmode()},computed:{isDark(){return this.theme==="dark"}},methods:{initDarkmode(){if(this.__init)return;this.__init=!0;let e=(plus.webview.currentWebview().extras||{}).data||{};this.darkmode=e.darkmode||!1,this.darkmode&&(this.theme=e.theme||"light")}}},z={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(i=>{a[i]=t[i]})}}},Y={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-visible":{"":{opacity:1}},"uni-picker":{"":{position:"absolute",left:0,bottom:0,right:0,backgro
`)},_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=F(this);for(let r=t.start,n=t.end;r<=n;r++)e.push(String(r));var a=[];for(let r=1;r<=12;r++)a.push((r<10?"0":"")+r);var i=[];for(let r=1;r<=31;r++)i.push((r<10?"0":"")+r);this.dateArray.push(e,a,i)},_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(g=!1,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 i=Number(e[a]),r=Number(this.valueSync[a]),n=isNaN(i)?isNaN(r)?0:r:i,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}}this.$nextTick(()=>{!g&&this._setValueArray()})},_setValueArray(){g=!0;var e=this.valueSync,t;switch(this.mode){case l.MULTISELECTOR:t=[...e];break;case l.TIME:t=this._getDateValueArray(e,w({mode:l.TIME}));break;case l.DATE:t=this._getDateValueArray(e,w({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?"-":":",i=this.mode===l.DATE?this.dateArray:this.timeArray,r=3;switch(this.fields){case h.YEAR:r=1;break;case h.MONTH:r=2;break}let n=String(e).split(a),c=[];for(let o=0;o<r;o++){let u=n[o];c.push(i[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 i;switch(a){case"es":i=["enero","febrero","marzo","abril","mayo","junio","\u200B\u200Bjulio","agosto","septiembre","octubre","noviembre","diciembre"];break;case"fr":i=["janvier","f\xE9vrier","mars","avril","mai","juin","juillet","ao\xFBt","septembre","octobre","novembre","d\xE9cembre"];break;default:i=["January","February","March","April","May","June","July","August","September","October","November","December"];break}return i[Number(e)-1]}}return e}}};function B(e,t,a,i,r,n){let c=(0,s.resolveComponent)("picker-view-column"),o=(0,s.resolveComponent)("picker-view");return(0,s.openBlock)(),(0,s.createElementBlock)("div",{class:(0,s.normalizeClass)(["content",{dark:e.isDark}])},[(0,s.createElementVNode)("div",{ref:"mask",style:(0,s.normalizeStyle)(n.maskStyle),class:"uni-mask",onClick:t[0]||(t[0]=(...u)=>n._cancel&&n._cancel(...u))},null,4),(0,s.createElementVNode)("div",{style:(0,s.normalizeStyle)(`padding-bottom:${e.safeAreaInsets.bottom}px;height:${r.height+e.safeAreaInsets.bottom}px;`),ref:"picker",class:(0,s.normalizeClass)(["uni-picker",{"uni-picker-dark":e.isDark}])},[(0,s.createElementVNode)("div",{class:(0,s.normalizeClass)(["uni-picker-header",{"uni-picker-header-dark":e.isDark}])},[(0,s.createElementVNode)("u-text",{style:(0,s.normalizeStyle)(`left:${e.safeAreaInsets.left}px`),class:(0,s.normalizeClass)(["uni-picker-action uni-picker-action-cancel",{"uni-picker-action-cancel-