index-legacy.8ed1b894.js 11 KB

1
  1. !function(){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},n(t)}function t(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function e(n,t){return function(n){if(Array.isArray(n))return n}(n)||function(n,t){var e=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null==e)return;var o,i,r=[],a=!0,l=!1;try{for(e=e.call(n);!(a=(o=e.next()).done)&&(r.push(o.value),!t||r.length!==t);a=!0);}catch(c){l=!0,i=c}finally{try{a||null==e.return||e.return()}finally{if(l)throw i}}return r}(n,t)||function(n,t){if(!n)return;if("string"==typeof n)return o(n,t);var e=Object.prototype.toString.call(n).slice(8,-1);"Object"===e&&n.constructor&&(e=n.constructor.name);if("Map"===e||"Set"===e)return Array.from(n);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return o(n,t)}(n,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,o=new Array(t);e<t;e++)o[e]=n[e];return o}var i=document.createElement("style");i.innerHTML=":root{--van-picker-background-color: var(--van-background-color-light);--van-picker-toolbar-height: 1.17333rem;--van-picker-title-font-size: var(--van-font-size-lg);--van-picker-title-line-height: var(--van-line-height-md);--van-picker-action-padding: 0 var(--van-padding-md);--van-picker-action-font-size: var(--van-font-size-md);--van-picker-confirm-action-color: var(--van-text-link-color);--van-picker-cancel-action-color: var(--van-text-color-2);--van-picker-option-font-size: var(--van-font-size-lg);--van-picker-option-padding: 0 var(--van-padding-base);--van-picker-option-text-color: var(--van-text-color);--van-picker-option-disabled-opacity: .3;--van-picker-loading-icon-color: var(--van-primary-color);--van-picker-loading-mask-color: rgba(255, 255, 255, .9);--van-picker-mask-color: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .4)), linear-gradient(0deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .4))}.van-picker{position:relative;background:var(--van-picker-background-color);-webkit-user-select:none;-moz-user-select:none;user-select:none}.van-picker__toolbar{display:flex;align-items:center;justify-content:space-between;height:var(--van-picker-toolbar-height)}.van-picker__cancel,.van-picker__confirm{height:100%;padding:var(--van-picker-action-padding);font-size:var(--van-picker-action-font-size);background-color:transparent;border:none}.van-picker__confirm{color:var(--van-picker-confirm-action-color)}.van-picker__cancel{color:var(--van-picker-cancel-action-color)}.van-picker__title{max-width:50%;font-weight:var(--van-font-weight-bold);font-size:var(--van-picker-title-font-size);line-height:var(--van-picker-title-line-height);text-align:center}.van-picker__columns{position:relative;display:flex;cursor:-webkit-grab;cursor:grab}.van-picker__loading{position:absolute;top:0;right:0;bottom:0;left:0;z-index:3;display:flex;align-items:center;justify-content:center;color:var(--van-picker-loading-icon-color);background:var(--van-picker-loading-mask-color)}.van-picker__frame{position:absolute;top:50%;right:var(--van-padding-md);left:var(--van-padding-md);z-index:2;transform:translateY(-50%);pointer-events:none}.van-picker__mask{position:absolute;top:0;left:0;z-index:1;width:100%;height:100%;background-image:var(--van-picker-mask-color);background-repeat:no-repeat;background-position:top,bottom;transform:translateZ(0);pointer-events:none}.van-picker-column{flex:1;overflow:hidden;font-size:var(--van-picker-option-font-size)}.van-picker-column__wrapper{transition-timing-function:cubic-bezier(.23,1,.68,1)}.van-picker-column__item{display:flex;align-items:center;justify-content:center;padding:var(--van-picker-option-padding);color:var(--van-picker-option-text-color)}.van-picker-column__item--disabled{cursor:not-allowed;opacity:var(--van-picker-option-disabled-opacity)}\n",document.head.appendChild(i),System.register(["./index-legacy.b2528a15.js"],(function(o){"use strict";var i,r,a,l,c,u,s,f,v,d,p,m,g,b,h,y,k,x,w,I,_,S,C,z,H,T,j,O;return{setters:[function(n){i=n.M,r=n.aJ,a=n.E,l=n.d,c=n.ax,u=n.I,s=n.a_,f=n.aW,v=n.U,d=n.S,p=n.ai,m=n.at,g=n.ak,b=n.a3,h=n.i,y=n.G,k=n.aq,x=n.as,w=n.ab,I=n.H,_=n.J,S=n.a0,C=n.aj,z=n.W,H=n.ad,T=n.aS,j=n.aY,O=n.b3}],execute:function(){function N(n){if(!i(n))return n;if(Array.isArray(n))return n.map((function(n){return N(n)}));if(r(n)){var t={};return Object.keys(n).forEach((function(e){t[e]=N(n[e])})),t}return n}var V=e(a("picker-column"),2),M=V[0],B=V[1];var D=Symbol(M),A=function(n){return r(n)&&n.disabled},E=l({name:M,props:{textKey:c(String),readonly:Boolean,allowHtml:Boolean,className:u,itemHeight:c(Number),defaultIndex:s(0),swipeDuration:c(y),initialOptions:f(),visibleItemCount:c(y)},emits:["change"],setup:function(n,e){var o,i,a,l,c,u=e.emit,s=e.slots,f=v(),y=d({index:n.defaultIndex,offset:0,duration:0,options:N(n.initialOptions)}),w=p(),I=function(){return y.options.length},_=function(){return n.itemHeight*(+n.visibleItemCount-1)/2},S=function(t,e){var i=-(t=function(n){for(var t=n=x(n,0,I());t<I();t++)if(!A(y.options[t]))return t;for(var e=n-1;e>=0;e--)if(!A(y.options[e]))return e}(t)||0)*n.itemHeight,r=function(){t!==y.index&&(y.index=t,e&&u("change",t))};o&&i!==y.offset?c=r:r(),y.offset=i},C=function(t){JSON.stringify(t)!==JSON.stringify(y.options)&&(y.options=N(t),S(n.defaultIndex))},z=function(t){return r(t)&&n.textKey in t?t[n.textKey]:t},H=function(t){return x(Math.round(-t/n.itemHeight),0,I()-1)},T=function(){o=!1,y.duration=0,c&&(c(),c=null)},j=function(t){if(!n.readonly){if(w.start(t),o){var e=function(n){var t=window.getComputedStyle(n).transform,e=t.slice(7,t.length-1).split(", ")[5];return Number(e)}(f.value);y.offset=Math.min(0,e-_()),i=y.offset}else i=y.offset;y.duration=0,a=Date.now(),l=i,c=null}},O=function(t){if(!n.readonly){w.move(t),w.isVertical()&&(o=!0,k(t,!0)),y.offset=x(i+w.deltaY.value,-I()*n.itemHeight,n.itemHeight);var e=Date.now();e-a>300&&(a=e,l=y.offset)}},V=function(){if(!n.readonly){var t=y.offset-l,e=Date.now()-a;if(e<300&&Math.abs(t)>15)!function(t,e){var o=Math.abs(t/e);t=y.offset+o/.003*(t<0?-1:1);var i=H(t);y.duration=+n.swipeDuration,S(i,!0)}(t,e);else{var i=H(y.offset);y.duration=200,S(i,!0),setTimeout((function(){o=!1}),0)}}},M=function(){var e={height:"".concat(n.itemHeight,"px")};return y.options.map((function(i,r){var a=z(i),l=A(i),u={role:"button",style:e,tabindex:l?-1:0,class:B("item",{disabled:l,selected:r===y.index}),onClick:function(){return function(t){o||n.readonly||(c=null,y.duration=200,S(t,!0))}(r)}},f=t({class:"van-ellipsis"},n.allowHtml?"innerHTML":"textContent",a);return h("li",u,[s.option?s.option(i):h("div",f,null)])}))};return S(y.index),m(D),g({state:y,setIndex:S,getValue:function(){return y.options[y.index]},setValue:function(n){for(var t=y.options,e=0;e<t.length;e++)if(z(t[e])===n)return S(e)},setOptions:C,stopMomentum:T}),b((function(){return n.initialOptions}),C),b((function(){return n.defaultIndex}),(function(n){return S(n)})),function(){return h("div",{class:[B(),n.className],onTouchstart:j,onTouchmove:O,onTouchend:V,onTouchcancel:V},[h("ul",{ref:f,style:{transform:"translate3d(0, ".concat(y.offset+_(),"px, 0)"),transitionDuration:"".concat(y.duration,"ms"),transitionProperty:y.duration?"all":"none"},class:B("wrapper"),onTransitionend:T},[M()])])}}}),K=e(a("picker"),3),P=K[0],J=K[1],Y=K[2],F=o("p",{title:String,loading:Boolean,readonly:Boolean,allowHtml:Boolean,itemHeight:w(44),showToolbar:I,swipeDuration:w(1e3),visibleItemCount:w(6),cancelButtonText:String,confirmButtonText:String}),L=_({},F,{columns:f(),valueKey:String,defaultIndex:w(0),toolbarPosition:S("top"),columnsFieldNames:Object});o("s",l({name:P,props:L,emits:["confirm","cancel","change"],setup:function(e,o){var i=o.emit,r=o.slots,a=v(!1),l=v([]),c=_({text:e.valueKey||"text",values:"values",children:"children"},e.columnsFieldNames),u=c.text,s=c.values,f=c.children,d=C(D),p=d.children;(0,d.linkChildren)();var m=z((function(){return H(e.itemHeight)})),y=z((function(){var t=e.columns[0];if("object"===n(t)){if(f in t)return"cascade";if(s in t)return"object"}return"plain"})),x=function(){return p.map((function(n){return n.state.index}))},w=function(n,t){var e=p[n];e&&(e.setOptions(t),a.value=!0)},I=function(n){for(var o=t({},f,e.columns),i=x(),r=0;r<=n;r++)o=o[f][i[r]];for(;o&&o[f];)n++,w(n,o[f]),o=o[f][o.defaultIndex||0]},S=function(n){return p[n]},N=function(n){var t=S(n);if(t)return t.getValue()},V=function(n,t){var e=S(n);e&&(e.setValue(t),"cascade"===y.value&&I(n))},M=function(n){var t=S(n);if(t)return t.state.index},B=function(n,t){var e=S(n);e&&(e.setIndex(t),"cascade"===y.value&&I(n))},A=function(){return p.map((function(n){return n.getValue()}))},K=function(n){"plain"===y.value?i(n,N(0),M(0)):i(n,A(),x())},P=function(){p.forEach((function(n){return n.stopMomentum()})),K("confirm")},F=function(){return K("cancel")},L=function(){var n=e.confirmButtonText||Y("confirm");return h("button",{type:"button",class:[J("confirm"),j],onClick:P},[r.confirm?r.confirm():n])},U=function(){if(e.showToolbar){var n=r.toolbar||r.default;return h("div",{class:J("toolbar")},[n?n():[(t=e.cancelButtonText||Y("cancel"),h("button",{type:"button",class:[J("cancel"),j],onClick:F},[r.cancel?r.cancel():t])),r.title?r.title():e.title?h("div",{class:[J("title"),"van-ellipsis"]},[e.title]):void 0,L()]])}var t},W=function(){return l.value.map((function(n,t){var o;return h(E,{textKey:u,readonly:e.readonly,allowHtml:e.allowHtml,className:n.className,itemHeight:m.value,defaultIndex:null!=(o=n.defaultIndex)?o:+e.defaultIndex,swipeDuration:e.swipeDuration,initialOptions:n[s],visibleItemCount:e.visibleItemCount,onChange:function(){return function(n){"cascade"===y.value&&I(n),"plain"===y.value?i("change",N(0),M(0)):i("change",A(),n)}(t)}},{option:r.option})}))},q=function(n){if(a.value){var t={height:"".concat(m.value,"px")},e={backgroundSize:"100% ".concat((n-m.value)/2,"px")};return[h("div",{class:J("mask"),style:e},null),h("div",{class:[O,J("frame")],style:t},null)]}};return b((function(){return e.columns}),(function(){var n=e.columns;"plain"===y.value?l.value=[t({},s,n)]:"cascade"===y.value?function(){for(var n,o=[],i=t({},f,e.columns);i&&i[f];){for(var r,a=i[f],c=null!=(n=i.defaultIndex)?n:+e.defaultIndex;a[c]&&a[c].disabled;){if(!(c<a.length-1)){c=0;break}c++}o.push((t(r={},s,i[f]),t(r,"className",i.className),t(r,"defaultIndex",c),r)),i=a[c]}l.value=o}():l.value=n,a.value=l.value.some((function(n){return n[s]&&0!==n[s].length}))}),{immediate:!0}),g({confirm:P,getValues:A,setValues:function(n){n.forEach((function(n,t){V(t,n)}))},getIndexes:x,setIndexes:function(n){n.forEach((function(n,t){B(t,n)}))},getColumnIndex:M,setColumnIndex:B,getColumnValue:N,setColumnValue:V,getColumnValues:function(n){var t=S(n);if(t)return t.state.options},setColumnValues:w}),function(){var n,t,o,i;return h("div",{class:J()},["top"===e.toolbarPosition?U():null,e.loading?h(T,{class:J("loading")},null):null,null==(n=r["columns-top"])?void 0:n.call(r),(o=m.value*+e.visibleItemCount,i={height:"".concat(o,"px")},h("div",{class:J("columns"),style:i,onTouchmove:k},[W(),q(o)])),null==(t=r["columns-bottom"])?void 0:t.call(r),"bottom"===e.toolbarPosition?U():null])}}}))}}}))}();