index-legacy.9960fd48.js 12 KB

1
  1. !function(){function n(e){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(e)}function e(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function t(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null==t)return;var o,i,a=[],r=!0,l=!1;try{for(t=t.call(n);!(r=(o=t.next()).done)&&(a.push(o.value),!e||a.length!==e);r=!0);}catch(c){l=!0,i=c}finally{try{r||null==t.return||t.return()}finally{if(l)throw i}}return a}(n,e)||function(n,e){if(!n)return;if("string"==typeof n)return o(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);"Object"===t&&n.constructor&&(t=n.constructor.name);if("Map"===t||"Set"===t)return Array.from(n);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return o(n,e)}(n,e)||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,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,o=new Array(e);t<e;t++)o[t]=n[t];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.fba2875c.js"],(function(o){"use strict";var i,a,r,l,c,u,s,f,v,d,p,m,g,b,h,y,k,x,w,I,_,S,C,z,H,T,V,j;return{setters:[function(n){i=n.L,a=n.aI,r=n.A,l=n.d,c=n.aw,u=n.H,s=n.aZ,f=n.aV,v=n.S,d=n.Q,p=n.ah,m=n.as,g=n.aj,b=n.a2,h=n.j,y=n.E,k=n.ap,x=n.ar,w=n.aa,I=n.G,_=n.I,S=n.$,C=n.ai,z=n.V,H=n.ac,T=n.aS,V=n.aX,j=n.b2}],execute:function(){function N(n){if(!i(n))return n;if(Array.isArray(n))return n.map((function(n){return N(n)}));if(a(n)){var e={};return Object.keys(n).forEach((function(t){e[t]=N(n[t])})),e}return n}var O=t(r("picker-column"),2),A=O[0],B=O[1];var D=Symbol(A),M=function(n){return a(n)&&n.disabled},K=l({name:A,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,t){var o,i,r,l,c,u=t.emit,s=t.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(e,t){var i=-(e=function(n){for(var e=n=x(n,0,I());e<I();e++)if(!M(y.options[e]))return e;for(var t=n-1;t>=0;t--)if(!M(y.options[t]))return t}(e)||0)*n.itemHeight,a=function(){e!==y.index&&(y.index=e,t&&u("change",e))};o&&i!==y.offset?c=a:a(),y.offset=i},C=function(e){JSON.stringify(e)!==JSON.stringify(y.options)&&(y.options=N(e),S(n.defaultIndex))},z=function(e){return a(e)&&n.textKey in e?e[n.textKey]:e},H=function(e){return x(Math.round(-e/n.itemHeight),0,I()-1)},T=function(){o=!1,y.duration=0,c&&(c(),c=null)},V=function(e){if(!n.readonly){if(w.start(e),o){var t=function(n){var e=window.getComputedStyle(n).transform,t=e.slice(7,e.length-1).split(", ")[5];return Number(t)}(f.value);y.offset=Math.min(0,t-_()),i=y.offset}else i=y.offset;y.duration=0,r=Date.now(),l=i,c=null}},j=function(e){if(!n.readonly){w.move(e),w.isVertical()&&(o=!0,k(e,!0)),y.offset=x(i+w.deltaY.value,-I()*n.itemHeight,n.itemHeight);var t=Date.now();t-r>300&&(r=t,l=y.offset)}},O=function(){if(!n.readonly){var e=y.offset-l,t=Date.now()-r;if(t<300&&Math.abs(e)>15)!function(e,t){var o=Math.abs(e/t);e=y.offset+o/.003*(e<0?-1:1);var i=H(e);y.duration=+n.swipeDuration,S(i,!0)}(e,t);else{var i=H(y.offset);y.duration=200,S(i,!0),setTimeout((function(){o=!1}),0)}}},A=function(){var t={height:"".concat(n.itemHeight,"px")};return y.options.map((function(i,a){var r=z(i),l=M(i),u={role:"button",style:t,tabindex:l?-1:0,class:B("item",{disabled:l,selected:a===y.index}),onClick:function(){return function(e){o||n.readonly||(c=null,y.duration=200,S(e,!0))}(a)}},f=e({class:"van-ellipsis"},n.allowHtml?"innerHTML":"textContent",r);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 e=y.options,t=0;t<e.length;t++)if(z(e[t])===n)return S(t)},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:V,onTouchmove:j,onTouchend:O,onTouchcancel:O},[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},[A()])])}}}),E=t(r("picker"),3),P=E[0],F=E[1],L=E[2],J=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}),Y=_({},J,{columns:f(),valueKey:String,defaultIndex:w(0),toolbarPosition:S("top"),columnsFieldNames:Object});o("s",l({name:P,props:Y,emits:["confirm","cancel","change"],setup:function(t,o){var i=o.emit,a=o.slots;a.default&&console.warn('[Vant] Picker: "default" slot is deprecated, please use "toolbar" slot instead.'),t.valueKey&&console.warn('[Vant] Picker: "valueKey" prop is deprecated, please use "columnsFieldNames" prop instead.');var r=v(!1),l=v([]),c=_({text:t.valueKey||"text",values:"values",children:"children"},t.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(t.itemHeight)})),y=z((function(){var e=t.columns[0];if("object"===n(e)){if(f in e)return"cascade";if(s in e)return"object"}return"plain"})),x=function(){return p.map((function(n){return n.state.index}))},w=function(n,e){var t=p[n];t&&(t.setOptions(e),r.value=!0)},I=function(n){for(var o=e({},f,t.columns),i=x(),a=0;a<=n;a++)o=o[f][i[a]];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 e=S(n);if(e)return e.getValue()},O=function(n,e){var t=S(n);t&&(t.setValue(e),"cascade"===y.value&&I(n))},A=function(n){var e=S(n);if(e)return e.state.index},B=function(n,e){var t=S(n);t&&(t.setIndex(e),"cascade"===y.value&&I(n))},M=function(){return p.map((function(n){return n.getValue()}))},E=function(n){"plain"===y.value?i(n,N(0),A(0)):i(n,M(),x())},P=function(){p.forEach((function(n){return n.stopMomentum()})),E("confirm")},J=function(){return E("cancel")},Y=function(){var n=t.confirmButtonText||L("confirm");return h("button",{type:"button",class:[F("confirm"),V],onClick:P},[a.confirm?a.confirm():n])},Z=function(){if(t.showToolbar){var n=a.toolbar||a.default;return h("div",{class:F("toolbar")},[n?n():[(e=t.cancelButtonText||L("cancel"),h("button",{type:"button",class:[F("cancel"),V],onClick:J},[a.cancel?a.cancel():e])),a.title?a.title():t.title?h("div",{class:[F("title"),"van-ellipsis"]},[t.title]):void 0,Y()]])}var e},$=function(){return l.value.map((function(n,e){var o;return h(K,{textKey:u,readonly:t.readonly,allowHtml:t.allowHtml,className:n.className,itemHeight:m.value,defaultIndex:null!=(o=n.defaultIndex)?o:+t.defaultIndex,swipeDuration:t.swipeDuration,initialOptions:n[s],visibleItemCount:t.visibleItemCount,onChange:function(){return function(n){"cascade"===y.value&&I(n),"plain"===y.value?i("change",N(0),A(0)):i("change",M(),n)}(e)}},{option:a.option})}))},G=function(n){if(r.value){var e={height:"".concat(m.value,"px")},t={backgroundSize:"100% ".concat((n-m.value)/2,"px")};return[h("div",{class:F("mask"),style:t},null),h("div",{class:[j,F("frame")],style:e},null)]}};return b((function(){return t.columns}),(function(){var n=t.columns;"plain"===y.value?l.value=[e({},s,n)]:"cascade"===y.value?function(){for(var n,o=[],i=e({},f,t.columns);i&&i[f];){for(var a,r=i[f],c=null!=(n=i.defaultIndex)?n:+t.defaultIndex;r[c]&&r[c].disabled;){if(!(c<r.length-1)){c=0;break}c++}o.push((e(a={},s,i[f]),e(a,"className",i.className),e(a,"defaultIndex",c),a)),i=r[c]}l.value=o}():l.value=n,r.value=l.value.some((function(n){return n[s]&&0!==n[s].length}))}),{immediate:!0}),g({confirm:P,getValues:M,setValues:function(n){n.forEach((function(n,e){O(e,n)}))},getIndexes:x,setIndexes:function(n){n.forEach((function(n,e){B(e,n)}))},getColumnIndex:A,setColumnIndex:B,getColumnValue:N,setColumnValue:O,getColumnValues:function(n){var e=S(n);if(e)return e.state.options},setColumnValues:w}),function(){var n,e,o,i;return h("div",{class:F()},["top"===t.toolbarPosition?Z():null,t.loading?h(T,{class:F("loading")},null):null,null==(n=a["columns-top"])?void 0:n.call(a),(o=m.value*+t.visibleItemCount,i={height:"".concat(o,"px")},h("div",{class:F("columns"),style:i,onTouchmove:k},[$(),G(o)])),null==(e=a["columns-bottom"])?void 0:e.call(a),"bottom"===t.toolbarPosition?Z():null])}}}))}}}))}();