vant.js 601 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory(require("vue"));
  4. else if(typeof define === 'function' && define.amd)
  5. define("vant", ["vue"], factory);
  6. else if(typeof exports === 'object')
  7. exports["vant"] = factory(require("vue"));
  8. else
  9. root["vant"] = factory(root["Vue"]);
  10. })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__3__) {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = 11);
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ([
  98. /* 0 */
  99. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  100. "use strict";
  101. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return inBrowser; });
  102. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return isServer; });
  103. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return noop; });
  104. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isDef; });
  105. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isFunction; });
  106. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isObject; });
  107. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isPromise; });
  108. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return get; });
  109. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isEmpty; });
  110. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
  111. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  112. var inBrowser = typeof window !== 'undefined';
  113. var isServer = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer; // eslint-disable-next-line @typescript-eslint/no-empty-function
  114. function noop() {}
  115. function isDef(val) {
  116. return val !== undefined && val !== null;
  117. }
  118. function isFunction(val) {
  119. return typeof val === 'function';
  120. }
  121. function isObject(val) {
  122. return val !== null && typeof val === 'object';
  123. }
  124. function isPromise(val) {
  125. return isObject(val) && isFunction(val.then) && isFunction(val.catch);
  126. }
  127. function get(object, path) {
  128. var keys = path.split('.');
  129. var result = object;
  130. keys.forEach(function (key) {
  131. var _result$key;
  132. result = isObject(result) ? (_result$key = result[key]) != null ? _result$key : '' : '';
  133. });
  134. return result;
  135. }
  136. /**
  137. * Checks if `value` is an empty object, collection, map, or set.
  138. *
  139. * Objects are considered empty if they have no own enumerable string keyed
  140. * properties.
  141. *
  142. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  143. * jQuery-like collections are considered empty if they have a `length` of `0`.
  144. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  145. *
  146. * @function isEmpty
  147. * @param {*} value The value to check.
  148. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  149. * @example
  150. *
  151. * _.isEmpty(null);
  152. * // => true
  153. *
  154. * _.isEmpty(true);
  155. * // => true
  156. *
  157. * _.isEmpty(1);
  158. * // => true
  159. *
  160. * _.isEmpty([1, 2, 3]);
  161. * // => false
  162. *
  163. * _.isEmpty({ 'a': 1 });
  164. * // => false
  165. */
  166. function isEmpty(value) {
  167. if (value == null) {
  168. return true;
  169. }
  170. if (typeof value !== 'object') {
  171. return true;
  172. }
  173. return Object.keys(value).length === 0;
  174. }
  175. /***/ }),
  176. /* 1 */
  177. /***/ (function(module, exports, __webpack_require__) {
  178. "use strict";
  179. function _extends() {
  180. return _extends = Object.assign || function (a) {
  181. for (var b, c = 1; c < arguments.length; c++) {
  182. for (var d in b = arguments[c], b) {
  183. Object.prototype.hasOwnProperty.call(b, d) && (a[d] = b[d]);
  184. }
  185. }
  186. return a;
  187. }, _extends.apply(this, arguments);
  188. }
  189. var normalMerge = ["attrs", "props", "domProps"],
  190. toArrayMerge = ["class", "style", "directives"],
  191. functionalMerge = ["on", "nativeOn"],
  192. mergeJsxProps = function mergeJsxProps(a) {
  193. return a.reduce(function (c, a) {
  194. for (var b in a) {
  195. if (!c[b]) c[b] = a[b];else if (-1 !== normalMerge.indexOf(b)) c[b] = _extends({}, c[b], a[b]);else if (-1 !== toArrayMerge.indexOf(b)) {
  196. var d = c[b] instanceof Array ? c[b] : [c[b]],
  197. e = a[b] instanceof Array ? a[b] : [a[b]];
  198. c[b] = d.concat(e);
  199. } else if (-1 !== functionalMerge.indexOf(b)) {
  200. for (var f in a[b]) {
  201. if (c[b][f]) {
  202. var g = c[b][f] instanceof Array ? c[b][f] : [c[b][f]],
  203. h = a[b][f] instanceof Array ? a[b][f] : [a[b][f]];
  204. c[b][f] = g.concat(h);
  205. } else c[b][f] = a[b][f];
  206. }
  207. } else if ("hook" == b) for (var i in a[b]) {
  208. c[b][i] = c[b][i] ? mergeFn(c[b][i], a[b][i]) : a[b][i];
  209. } else c[b] = a[b];
  210. }
  211. return c;
  212. }, {});
  213. },
  214. mergeFn = function mergeFn(a, b) {
  215. return function () {
  216. a && a.apply(this, arguments), b && b.apply(this, arguments);
  217. };
  218. };
  219. module.exports = mergeJsxProps;
  220. /***/ }),
  221. /* 2 */
  222. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  223. "use strict";
  224. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return camelize; });
  225. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return padZero; });
  226. var camelizeRE = /-(\w)/g;
  227. function camelize(str) {
  228. return str.replace(camelizeRE, function (_, c) {
  229. return c.toUpperCase();
  230. });
  231. }
  232. function padZero(num, targetLength) {
  233. if (targetLength === void 0) {
  234. targetLength = 2;
  235. }
  236. var str = num + '';
  237. while (str.length < targetLength) {
  238. str = '0' + str;
  239. }
  240. return str;
  241. }
  242. /***/ }),
  243. /* 3 */
  244. /***/ (function(module, exports) {
  245. module.exports = __WEBPACK_EXTERNAL_MODULE__3__;
  246. /***/ }),
  247. /* 4 */
  248. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  249. "use strict";
  250. /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return raf; });
  251. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return doubleRaf; });
  252. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cancelRaf; });
  253. /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
  254. /**
  255. * requestAnimationFrame polyfill
  256. */
  257. var prev = Date.now();
  258. /* istanbul ignore next */
  259. function fallback(fn) {
  260. var curr = Date.now();
  261. var ms = Math.max(0, 16 - (curr - prev));
  262. var id = setTimeout(fn, ms);
  263. prev = curr + ms;
  264. return id;
  265. }
  266. /* istanbul ignore next */
  267. var root = ___WEBPACK_IMPORTED_MODULE_0__[/* isServer */ "h"] ? global : window;
  268. /* istanbul ignore next */
  269. var iRaf = root.requestAnimationFrame || fallback;
  270. /* istanbul ignore next */
  271. var iCancel = root.cancelAnimationFrame || root.clearTimeout;
  272. function raf(fn) {
  273. return iRaf.call(root, fn);
  274. } // double raf for animation
  275. function doubleRaf(fn) {
  276. raf(function () {
  277. raf(fn);
  278. });
  279. }
  280. function cancelRaf(id) {
  281. iCancel.call(root, id);
  282. }
  283. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(10)))
  284. /***/ }),
  285. /* 5 */
  286. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  287. "use strict";
  288. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isNumeric; });
  289. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isNaN; });
  290. function isNumeric(val) {
  291. return /^\d+(\.\d+)?$/.test(val);
  292. }
  293. function isNaN(val) {
  294. if (Number.isNaN) {
  295. return Number.isNaN(val);
  296. } // eslint-disable-next-line no-self-compare
  297. return val !== val;
  298. }
  299. /***/ }),
  300. /* 6 */
  301. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  302. "use strict";
  303. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addUnit; });
  304. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return unitToPx; });
  305. /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
  306. /* harmony import */ var _validate_number__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
  307. function addUnit(value) {
  308. if (!Object(___WEBPACK_IMPORTED_MODULE_0__[/* isDef */ "c"])(value)) {
  309. return undefined;
  310. }
  311. value = String(value);
  312. return Object(_validate_number__WEBPACK_IMPORTED_MODULE_1__[/* isNumeric */ "b"])(value) ? value + "px" : value;
  313. } // cache
  314. var rootFontSize;
  315. function getRootFontSize() {
  316. if (!rootFontSize) {
  317. var doc = document.documentElement;
  318. var fontSize = doc.style.fontSize || window.getComputedStyle(doc).fontSize;
  319. rootFontSize = parseFloat(fontSize);
  320. }
  321. return rootFontSize;
  322. }
  323. function convertRem(value) {
  324. value = value.replace(/rem/g, '');
  325. return +value * getRootFontSize();
  326. }
  327. function convertVw(value) {
  328. value = value.replace(/vw/g, '');
  329. return +value * window.innerWidth / 100;
  330. }
  331. function convertVh(value) {
  332. value = value.replace(/vh/g, '');
  333. return +value * window.innerHeight / 100;
  334. }
  335. function unitToPx(value) {
  336. if (typeof value === 'number') {
  337. return value;
  338. }
  339. if (___WEBPACK_IMPORTED_MODULE_0__[/* inBrowser */ "b"]) {
  340. if (value.indexOf('rem') !== -1) {
  341. return convertRem(value);
  342. }
  343. if (value.indexOf('vw') !== -1) {
  344. return convertVw(value);
  345. }
  346. if (value.indexOf('vh') !== -1) {
  347. return convertVh(value);
  348. }
  349. }
  350. return parseFloat(value);
  351. }
  352. /***/ }),
  353. /* 7 */
  354. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  355. "use strict";
  356. // EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
  357. var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(3);
  358. var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default = /*#__PURE__*/__webpack_require__.n(external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_);
  359. // EXTERNAL MODULE: ./es/utils/index.js
  360. var utils = __webpack_require__(0);
  361. // CONCATENATED MODULE: ./es/utils/deep-assign.js
  362. var deep_assign_hasOwnProperty = Object.prototype.hasOwnProperty;
  363. function assignKey(to, from, key) {
  364. var val = from[key];
  365. if (!Object(utils["c" /* isDef */])(val)) {
  366. return;
  367. }
  368. if (!deep_assign_hasOwnProperty.call(to, key) || !Object(utils["f" /* isObject */])(val)) {
  369. to[key] = val;
  370. } else {
  371. // eslint-disable-next-line @typescript-eslint/no-use-before-define
  372. to[key] = deepAssign(Object(to[key]), from[key]);
  373. }
  374. }
  375. function deepAssign(to, from) {
  376. Object.keys(from).forEach(function (key) {
  377. assignKey(to, from, key);
  378. });
  379. return to;
  380. }
  381. // CONCATENATED MODULE: ./es/locale/lang/zh-CN.js
  382. /* harmony default export */ var zh_CN = ({
  383. name: '姓名',
  384. tel: '电话',
  385. save: '保存',
  386. confirm: '确认',
  387. cancel: '取消',
  388. delete: '删除',
  389. complete: '完成',
  390. loading: '加载中...',
  391. telEmpty: '请填写电话',
  392. nameEmpty: '请填写姓名',
  393. nameInvalid: '请输入正确的姓名',
  394. confirmDelete: '确定要删除吗',
  395. telInvalid: '请输入正确的手机号',
  396. vanCalendar: {
  397. end: '结束',
  398. start: '开始',
  399. title: '日期选择',
  400. confirm: '确定',
  401. startEnd: '开始/结束',
  402. weekdays: ['日', '一', '二', '三', '四', '五', '六'],
  403. monthTitle: function monthTitle(year, month) {
  404. return year + "\u5E74" + month + "\u6708";
  405. },
  406. rangePrompt: function rangePrompt(maxRange) {
  407. return "\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 " + maxRange + " \u5929";
  408. }
  409. },
  410. vanCascader: {
  411. select: '请选择'
  412. },
  413. vanContactCard: {
  414. addText: '添加联系人'
  415. },
  416. vanContactList: {
  417. addText: '新建联系人'
  418. },
  419. vanPagination: {
  420. prev: '上一页',
  421. next: '下一页'
  422. },
  423. vanPullRefresh: {
  424. pulling: '下拉即可刷新...',
  425. loosing: '释放即可刷新...'
  426. },
  427. vanSubmitBar: {
  428. label: '合计:'
  429. },
  430. vanCoupon: {
  431. unlimited: '无使用门槛',
  432. discount: function discount(_discount) {
  433. return _discount + "\u6298";
  434. },
  435. condition: function condition(_condition) {
  436. return "\u6EE1" + _condition + "\u5143\u53EF\u7528";
  437. }
  438. },
  439. vanCouponCell: {
  440. title: '优惠券',
  441. tips: '暂无可用',
  442. count: function count(_count) {
  443. return _count + "\u5F20\u53EF\u7528";
  444. }
  445. },
  446. vanCouponList: {
  447. empty: '暂无优惠券',
  448. exchange: '兑换',
  449. close: '不使用优惠券',
  450. enable: '可用',
  451. disabled: '不可用',
  452. placeholder: '请输入优惠码'
  453. },
  454. vanAddressEdit: {
  455. area: '地区',
  456. postal: '邮政编码',
  457. areaEmpty: '请选择地区',
  458. addressEmpty: '请填写详细地址',
  459. postalEmpty: '邮政编码格式不正确',
  460. defaultAddress: '设为默认收货地址',
  461. telPlaceholder: '收货人手机号',
  462. namePlaceholder: '收货人姓名',
  463. areaPlaceholder: '选择省 / 市 / 区'
  464. },
  465. vanAddressEditDetail: {
  466. label: '详细地址',
  467. placeholder: '街道门牌、楼层房间号等信息'
  468. },
  469. vanAddressList: {
  470. add: '新增地址'
  471. }
  472. });
  473. // CONCATENATED MODULE: ./es/locale/index.js
  474. var proto = external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype;
  475. var defineReactive = external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.util.defineReactive;
  476. defineReactive(proto, '$vantLang', 'zh-CN');
  477. defineReactive(proto, '$vantMessages', {
  478. 'zh-CN': zh_CN
  479. });
  480. /* harmony default export */ var locale = __webpack_exports__["a"] = ({
  481. messages: function messages() {
  482. return proto.$vantMessages[proto.$vantLang];
  483. },
  484. use: function use(lang, messages) {
  485. var _this$add;
  486. proto.$vantLang = lang;
  487. this.add((_this$add = {}, _this$add[lang] = messages, _this$add));
  488. },
  489. add: function add(messages) {
  490. if (messages === void 0) {
  491. messages = {};
  492. }
  493. deepAssign(proto.$vantMessages, messages);
  494. }
  495. });
  496. /***/ }),
  497. /* 8 */
  498. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  499. "use strict";
  500. // EXPORTS
  501. __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ createNamespace; });
  502. // CONCATENATED MODULE: ./es/utils/create/bem.js
  503. /**
  504. * bem helper
  505. * b() // 'button'
  506. * b('text') // 'button__text'
  507. * b({ disabled }) // 'button button--disabled'
  508. * b('text', { disabled }) // 'button__text button__text--disabled'
  509. * b(['disabled', 'primary']) // 'button button--disabled button--primary'
  510. */
  511. function gen(name, mods) {
  512. if (!mods) {
  513. return '';
  514. }
  515. if (typeof mods === 'string') {
  516. return " " + name + "--" + mods;
  517. }
  518. if (Array.isArray(mods)) {
  519. return mods.reduce(function (ret, item) {
  520. return ret + gen(name, item);
  521. }, '');
  522. }
  523. return Object.keys(mods).reduce(function (ret, key) {
  524. return ret + (mods[key] ? gen(name, key) : '');
  525. }, '');
  526. }
  527. function createBEM(name) {
  528. return function (el, mods) {
  529. if (el && typeof el !== 'string') {
  530. mods = el;
  531. el = '';
  532. }
  533. el = el ? name + "__" + el : name;
  534. return "" + el + gen(el, mods);
  535. };
  536. }
  537. // EXTERNAL MODULE: ./es/utils/index.js
  538. var utils = __webpack_require__(0);
  539. // EXTERNAL MODULE: ./es/utils/format/string.js
  540. var string = __webpack_require__(2);
  541. // CONCATENATED MODULE: ./es/mixins/slots.js
  542. /**
  543. * Use scopedSlots in Vue 2.6+
  544. * downgrade to slots in lower version
  545. */
  546. var SlotsMixin = {
  547. methods: {
  548. slots: function slots(name, props) {
  549. if (name === void 0) {
  550. name = 'default';
  551. }
  552. var $slots = this.$slots,
  553. $scopedSlots = this.$scopedSlots;
  554. var scopedSlot = $scopedSlots[name];
  555. if (scopedSlot) {
  556. return scopedSlot(props);
  557. }
  558. return $slots[name];
  559. }
  560. }
  561. };
  562. // EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
  563. var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(3);
  564. // CONCATENATED MODULE: ./es/utils/create/component.js
  565. /**
  566. * Create a basic component with common options
  567. */
  568. function install(Vue) {
  569. var name = this.name;
  570. Vue.component(name, this);
  571. Vue.component(Object(string["a" /* camelize */])("-" + name), this);
  572. } // unify slots & scopedSlots
  573. function unifySlots(context) {
  574. // use data.scopedSlots in lower Vue version
  575. var scopedSlots = context.scopedSlots || context.data.scopedSlots || {};
  576. var slots = context.slots();
  577. Object.keys(slots).forEach(function (key) {
  578. if (!scopedSlots[key]) {
  579. scopedSlots[key] = function () {
  580. return slots[key];
  581. };
  582. }
  583. });
  584. return scopedSlots;
  585. } // should be removed after Vue 3
  586. function transformFunctionComponent(pure) {
  587. return {
  588. functional: true,
  589. props: pure.props,
  590. model: pure.model,
  591. render: function render(h, context) {
  592. return pure(h, context.props, unifySlots(context), context);
  593. }
  594. };
  595. }
  596. function createComponent(name) {
  597. return function (sfc) {
  598. if (Object(utils["e" /* isFunction */])(sfc)) {
  599. sfc = transformFunctionComponent(sfc);
  600. }
  601. if (!sfc.functional) {
  602. sfc.mixins = sfc.mixins || [];
  603. sfc.mixins.push(SlotsMixin);
  604. }
  605. sfc.name = name;
  606. sfc.install = install;
  607. return sfc;
  608. };
  609. }
  610. // EXTERNAL MODULE: ./es/locale/index.js + 2 modules
  611. var locale = __webpack_require__(7);
  612. // CONCATENATED MODULE: ./es/utils/create/i18n.js
  613. function createI18N(name) {
  614. var prefix = Object(string["a" /* camelize */])(name) + '.';
  615. return function (path) {
  616. var messages = locale["a" /* default */].messages();
  617. var message = Object(utils["a" /* get */])(messages, prefix + path) || Object(utils["a" /* get */])(messages, path);
  618. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  619. args[_key - 1] = arguments[_key];
  620. }
  621. return Object(utils["e" /* isFunction */])(message) ? message.apply(void 0, args) : message;
  622. };
  623. }
  624. // CONCATENATED MODULE: ./es/utils/create/index.js
  625. function createNamespace(name) {
  626. name = 'van-' + name;
  627. return [createComponent(name), createBEM(name), createI18N(name)];
  628. }
  629. /***/ }),
  630. /* 9 */
  631. /***/ (function(module, exports, __webpack_require__) {
  632. /*!
  633. * Vue-Lazyload.js v1.2.3
  634. * (c) 2018 Awe <hilongjw@gmail.com>
  635. * Released under the MIT License.
  636. */
  637. !function (e, t) {
  638. true ? module.exports = t() : undefined;
  639. }(this, function () {
  640. "use strict";
  641. function e(e) {
  642. return e.constructor && "function" == typeof e.constructor.isBuffer && e.constructor.isBuffer(e);
  643. }
  644. function t(e) {
  645. e = e || {};
  646. var t = arguments.length,
  647. i = 0;
  648. if (1 === t) return e;
  649. for (; ++i < t;) {
  650. var o = arguments[i];
  651. g(e) && (e = o), r(o) && n(e, o);
  652. }
  653. return e;
  654. }
  655. function n(e, n) {
  656. m(e, n);
  657. for (var o in n) {
  658. if ("__proto__" !== o && i(n, o)) {
  659. var a = n[o];
  660. r(a) ? ("undefined" === L(e[o]) && "function" === L(a) && (e[o] = a), e[o] = t(e[o] || {}, a)) : e[o] = a;
  661. }
  662. }
  663. return e;
  664. }
  665. function r(e) {
  666. return "object" === L(e) || "function" === L(e);
  667. }
  668. function i(e, t) {
  669. return Object.prototype.hasOwnProperty.call(e, t);
  670. }
  671. function o(e, t) {
  672. if (e.length) {
  673. var n = e.indexOf(t);
  674. return n > -1 ? e.splice(n, 1) : void 0;
  675. }
  676. }
  677. function a(e, t) {
  678. for (var n = !1, r = 0, i = e.length; r < i; r++) {
  679. if (t(e[r])) {
  680. n = !0;
  681. break;
  682. }
  683. }
  684. return n;
  685. }
  686. function s(e, t) {
  687. if ("IMG" === e.tagName && e.getAttribute("data-srcset")) {
  688. var n = e.getAttribute("data-srcset"),
  689. r = [],
  690. i = e.parentNode,
  691. o = i.offsetWidth * t,
  692. a = void 0,
  693. s = void 0,
  694. u = void 0;
  695. n = n.trim().split(","), n.map(function (e) {
  696. e = e.trim(), a = e.lastIndexOf(" "), -1 === a ? (s = e, u = 999998) : (s = e.substr(0, a), u = parseInt(e.substr(a + 1, e.length - a - 2), 10)), r.push([u, s]);
  697. }), r.sort(function (e, t) {
  698. if (e[0] < t[0]) return -1;
  699. if (e[0] > t[0]) return 1;
  700. if (e[0] === t[0]) {
  701. if (-1 !== t[1].indexOf(".webp", t[1].length - 5)) return 1;
  702. if (-1 !== e[1].indexOf(".webp", e[1].length - 5)) return -1;
  703. }
  704. return 0;
  705. });
  706. for (var l = "", d = void 0, c = r.length, h = 0; h < c; h++) {
  707. if (d = r[h], d[0] >= o) {
  708. l = d[1];
  709. break;
  710. }
  711. }
  712. return l;
  713. }
  714. }
  715. function u(e, t) {
  716. for (var n = void 0, r = 0, i = e.length; r < i; r++) {
  717. if (t(e[r])) {
  718. n = e[r];
  719. break;
  720. }
  721. }
  722. return n;
  723. }
  724. function l() {
  725. if (!k) return !1;
  726. var e = !0,
  727. t = document;
  728. try {
  729. var n = t.createElement("object");
  730. n.type = "image/webp", n.style.visibility = "hidden", n.innerHTML = "!", t.body.appendChild(n), e = !n.offsetWidth, t.body.removeChild(n);
  731. } catch (t) {
  732. e = !1;
  733. }
  734. return e;
  735. }
  736. function d(e, t) {
  737. var n = null,
  738. r = 0;
  739. return function () {
  740. if (!n) {
  741. var i = Date.now() - r,
  742. o = this,
  743. a = arguments,
  744. s = function s() {
  745. r = Date.now(), n = !1, e.apply(o, a);
  746. };
  747. i >= t ? s() : n = setTimeout(s, t);
  748. }
  749. };
  750. }
  751. function c(e) {
  752. return null !== e && "object" === (void 0 === e ? "undefined" : p(e));
  753. }
  754. function h(e) {
  755. if (!(e instanceof Object)) return [];
  756. if (Object.keys) return Object.keys(e);
  757. var t = [];
  758. for (var n in e) {
  759. e.hasOwnProperty(n) && t.push(n);
  760. }
  761. return t;
  762. }
  763. function f(e) {
  764. for (var t = e.length, n = [], r = 0; r < t; r++) {
  765. n.push(e[r]);
  766. }
  767. return n;
  768. }
  769. function v() {}
  770. var p = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
  771. return typeof e;
  772. } : function (e) {
  773. return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
  774. },
  775. b = function b(e, t) {
  776. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
  777. },
  778. y = function () {
  779. function e(e, t) {
  780. for (var n = 0; n < t.length; n++) {
  781. var r = t[n];
  782. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
  783. }
  784. }
  785. return function (t, n, r) {
  786. return n && e(t.prototype, n), r && e(t, r), t;
  787. };
  788. }(),
  789. g = function g(e) {
  790. return null == e || "function" != typeof e && "object" !== (void 0 === e ? "undefined" : p(e));
  791. },
  792. m = function m(e, t) {
  793. if (null === e || void 0 === e) throw new TypeError("expected first argument to be an object.");
  794. if (void 0 === t || "undefined" == typeof Symbol) return e;
  795. if ("function" != typeof Object.getOwnPropertySymbols) return e;
  796. for (var n = Object.prototype.propertyIsEnumerable, r = Object(e), i = arguments.length, o = 0; ++o < i;) {
  797. for (var a = Object(arguments[o]), s = Object.getOwnPropertySymbols(a), u = 0; u < s.length; u++) {
  798. var l = s[u];
  799. n.call(a, l) && (r[l] = a[l]);
  800. }
  801. }
  802. return r;
  803. },
  804. w = Object.prototype.toString,
  805. L = function L(t) {
  806. var n = void 0 === t ? "undefined" : p(t);
  807. return "undefined" === n ? "undefined" : null === t ? "null" : !0 === t || !1 === t || t instanceof Boolean ? "boolean" : "string" === n || t instanceof String ? "string" : "number" === n || t instanceof Number ? "number" : "function" === n || t instanceof Function ? void 0 !== t.constructor.name && "Generator" === t.constructor.name.slice(0, 9) ? "generatorfunction" : "function" : void 0 !== Array.isArray && Array.isArray(t) ? "array" : t instanceof RegExp ? "regexp" : t instanceof Date ? "date" : (n = w.call(t), "[object RegExp]" === n ? "regexp" : "[object Date]" === n ? "date" : "[object Arguments]" === n ? "arguments" : "[object Error]" === n ? "error" : "[object Promise]" === n ? "promise" : e(t) ? "buffer" : "[object Set]" === n ? "set" : "[object WeakSet]" === n ? "weakset" : "[object Map]" === n ? "map" : "[object WeakMap]" === n ? "weakmap" : "[object Symbol]" === n ? "symbol" : "[object Map Iterator]" === n ? "mapiterator" : "[object Set Iterator]" === n ? "setiterator" : "[object String Iterator]" === n ? "stringiterator" : "[object Array Iterator]" === n ? "arrayiterator" : "[object Int8Array]" === n ? "int8array" : "[object Uint8Array]" === n ? "uint8array" : "[object Uint8ClampedArray]" === n ? "uint8clampedarray" : "[object Int16Array]" === n ? "int16array" : "[object Uint16Array]" === n ? "uint16array" : "[object Int32Array]" === n ? "int32array" : "[object Uint32Array]" === n ? "uint32array" : "[object Float32Array]" === n ? "float32array" : "[object Float64Array]" === n ? "float64array" : "object");
  808. },
  809. _ = t,
  810. k = "undefined" != typeof window,
  811. E = k && "IntersectionObserver" in window,
  812. A = {
  813. event: "event",
  814. observer: "observer"
  815. },
  816. j = function () {
  817. function e(e, t) {
  818. t = t || {
  819. bubbles: !1,
  820. cancelable: !1,
  821. detail: void 0
  822. };
  823. var n = document.createEvent("CustomEvent");
  824. return n.initCustomEvent(e, t.bubbles, t.cancelable, t.detail), n;
  825. }
  826. if (k) return "function" == typeof window.CustomEvent ? window.CustomEvent : (e.prototype = window.Event.prototype, e);
  827. }(),
  828. z = function z() {
  829. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1;
  830. return k ? window.devicePixelRatio || e : e;
  831. },
  832. T = function () {
  833. if (k) {
  834. var e = !1;
  835. try {
  836. var t = Object.defineProperty({}, "passive", {
  837. get: function get() {
  838. e = !0;
  839. }
  840. });
  841. window.addEventListener("test", null, t);
  842. } catch (e) {}
  843. return e;
  844. }
  845. }(),
  846. O = {
  847. on: function on(e, t, n) {
  848. var r = arguments.length > 3 && void 0 !== arguments[3] && arguments[3];
  849. T ? e.addEventListener(t, n, {
  850. capture: r,
  851. passive: !0
  852. }) : e.addEventListener(t, n, r);
  853. },
  854. off: function off(e, t, n) {
  855. var r = arguments.length > 3 && void 0 !== arguments[3] && arguments[3];
  856. e.removeEventListener(t, n, r);
  857. }
  858. },
  859. I = function I(e, t, n) {
  860. var r = new Image();
  861. r.src = e.src, r.onload = function () {
  862. t({
  863. naturalHeight: r.naturalHeight,
  864. naturalWidth: r.naturalWidth,
  865. src: r.src
  866. });
  867. }, r.onerror = function (e) {
  868. n(e);
  869. };
  870. },
  871. x = function x(e, t) {
  872. return "undefined" != typeof getComputedStyle ? getComputedStyle(e, null).getPropertyValue(t) : e.style[t];
  873. },
  874. S = function S(e) {
  875. return x(e, "overflow") + x(e, "overflow-y") + x(e, "overflow-x");
  876. },
  877. $ = function $(e) {
  878. if (k) {
  879. if (!(e instanceof HTMLElement)) return window;
  880. for (var t = e; t && t !== document.body && t !== document.documentElement && t.parentNode;) {
  881. if (/(scroll|auto)/.test(S(t))) return t;
  882. t = t.parentNode;
  883. }
  884. return window;
  885. }
  886. },
  887. H = {},
  888. Q = function () {
  889. function e(t) {
  890. var n = t.el,
  891. r = t.src,
  892. i = t.error,
  893. o = t.loading,
  894. a = t.bindType,
  895. s = t.$parent,
  896. u = t.options,
  897. l = t.elRenderer;
  898. b(this, e), this.el = n, this.src = r, this.error = i, this.loading = o, this.bindType = a, this.attempt = 0, this.naturalHeight = 0, this.naturalWidth = 0, this.options = u, this.rect = null, this.$parent = s, this.elRenderer = l, this.performanceData = {
  899. init: Date.now(),
  900. loadStart: 0,
  901. loadEnd: 0
  902. }, this.filter(), this.initState(), this.render("loading", !1);
  903. }
  904. return y(e, [{
  905. key: "initState",
  906. value: function value() {
  907. this.el.dataset.src = this.src, this.state = {
  908. error: !1,
  909. loaded: !1,
  910. rendered: !1
  911. };
  912. }
  913. }, {
  914. key: "record",
  915. value: function value(e) {
  916. this.performanceData[e] = Date.now();
  917. }
  918. }, {
  919. key: "update",
  920. value: function value(e) {
  921. var t = e.src,
  922. n = e.loading,
  923. r = e.error,
  924. i = this.src;
  925. this.src = t, this.loading = n, this.error = r, this.filter(), i !== this.src && (this.attempt = 0, this.initState());
  926. }
  927. }, {
  928. key: "getRect",
  929. value: function value() {
  930. this.rect = this.el.getBoundingClientRect();
  931. }
  932. }, {
  933. key: "checkInView",
  934. value: function value() {
  935. return this.getRect(), this.rect.top < window.innerHeight * this.options.preLoad && this.rect.bottom > this.options.preLoadTop && this.rect.left < window.innerWidth * this.options.preLoad && this.rect.right > 0;
  936. }
  937. }, {
  938. key: "filter",
  939. value: function value() {
  940. var e = this;
  941. h(this.options.filter).map(function (t) {
  942. e.options.filter[t](e, e.options);
  943. });
  944. }
  945. }, {
  946. key: "renderLoading",
  947. value: function value(e) {
  948. var t = this;
  949. I({
  950. src: this.loading
  951. }, function (n) {
  952. t.render("loading", !1), e();
  953. }, function () {
  954. e(), t.options.silent || console.warn("VueLazyload log: load failed with loading image(" + t.loading + ")");
  955. });
  956. }
  957. }, {
  958. key: "load",
  959. value: function value() {
  960. var e = this,
  961. t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : v;
  962. return this.attempt > this.options.attempt - 1 && this.state.error ? (this.options.silent || console.log("VueLazyload log: " + this.src + " tried too more than " + this.options.attempt + " times"), void t()) : this.state.loaded || H[this.src] ? (this.state.loaded = !0, t(), this.render("loaded", !0)) : void this.renderLoading(function () {
  963. e.attempt++, e.record("loadStart"), I({
  964. src: e.src
  965. }, function (n) {
  966. e.naturalHeight = n.naturalHeight, e.naturalWidth = n.naturalWidth, e.state.loaded = !0, e.state.error = !1, e.record("loadEnd"), e.render("loaded", !1), H[e.src] = 1, t();
  967. }, function (t) {
  968. !e.options.silent && console.error(t), e.state.error = !0, e.state.loaded = !1, e.render("error", !1);
  969. });
  970. });
  971. }
  972. }, {
  973. key: "render",
  974. value: function value(e, t) {
  975. this.elRenderer(this, e, t);
  976. }
  977. }, {
  978. key: "performance",
  979. value: function value() {
  980. var e = "loading",
  981. t = 0;
  982. return this.state.loaded && (e = "loaded", t = (this.performanceData.loadEnd - this.performanceData.loadStart) / 1e3), this.state.error && (e = "error"), {
  983. src: this.src,
  984. state: e,
  985. time: t
  986. };
  987. }
  988. }, {
  989. key: "destroy",
  990. value: function value() {
  991. this.el = null, this.src = null, this.error = null, this.loading = null, this.bindType = null, this.attempt = 0;
  992. }
  993. }]), e;
  994. }(),
  995. C = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
  996. R = ["scroll", "wheel", "mousewheel", "resize", "animationend", "transitionend", "touchmove"],
  997. W = {
  998. rootMargin: "0px",
  999. threshold: 0
  1000. },
  1001. D = function D(e) {
  1002. return function () {
  1003. function t(e) {
  1004. var n = e.preLoad,
  1005. r = e.error,
  1006. i = e.throttleWait,
  1007. o = e.preLoadTop,
  1008. a = e.dispatchEvent,
  1009. s = e.loading,
  1010. u = e.attempt,
  1011. c = e.silent,
  1012. h = void 0 === c || c,
  1013. f = e.scale,
  1014. v = e.listenEvents,
  1015. p = (e.hasbind, e.filter),
  1016. y = e.adapter,
  1017. g = e.observer,
  1018. m = e.observerOptions;
  1019. b(this, t), this.version = "1.2.3", this.mode = A.event, this.ListenerQueue = [], this.TargetIndex = 0, this.TargetQueue = [], this.options = {
  1020. silent: h,
  1021. dispatchEvent: !!a,
  1022. throttleWait: i || 200,
  1023. preLoad: n || 1.3,
  1024. preLoadTop: o || 0,
  1025. error: r || C,
  1026. loading: s || C,
  1027. attempt: u || 3,
  1028. scale: f || z(f),
  1029. ListenEvents: v || R,
  1030. hasbind: !1,
  1031. supportWebp: l(),
  1032. filter: p || {},
  1033. adapter: y || {},
  1034. observer: !!g,
  1035. observerOptions: m || W
  1036. }, this._initEvent(), this.lazyLoadHandler = d(this._lazyLoadHandler.bind(this), this.options.throttleWait), this.setMode(this.options.observer ? A.observer : A.event);
  1037. }
  1038. return y(t, [{
  1039. key: "config",
  1040. value: function value() {
  1041. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  1042. _(this.options, e);
  1043. }
  1044. }, {
  1045. key: "performance",
  1046. value: function value() {
  1047. var e = [];
  1048. return this.ListenerQueue.map(function (t) {
  1049. e.push(t.performance());
  1050. }), e;
  1051. }
  1052. }, {
  1053. key: "addLazyBox",
  1054. value: function value(e) {
  1055. this.ListenerQueue.push(e), k && (this._addListenerTarget(window), this._observer && this._observer.observe(e.el), e.$el && e.$el.parentNode && this._addListenerTarget(e.$el.parentNode));
  1056. }
  1057. }, {
  1058. key: "add",
  1059. value: function value(t, n, r) {
  1060. var i = this;
  1061. if (a(this.ListenerQueue, function (e) {
  1062. return e.el === t;
  1063. })) return this.update(t, n), e.nextTick(this.lazyLoadHandler);
  1064. var o = this._valueFormatter(n.value),
  1065. u = o.src,
  1066. l = o.loading,
  1067. d = o.error;
  1068. e.nextTick(function () {
  1069. u = s(t, i.options.scale) || u, i._observer && i._observer.observe(t);
  1070. var o = Object.keys(n.modifiers)[0],
  1071. a = void 0;
  1072. o && (a = r.context.$refs[o], a = a ? a.$el || a : document.getElementById(o)), a || (a = $(t));
  1073. var c = new Q({
  1074. bindType: n.arg,
  1075. $parent: a,
  1076. el: t,
  1077. loading: l,
  1078. error: d,
  1079. src: u,
  1080. elRenderer: i._elRenderer.bind(i),
  1081. options: i.options
  1082. });
  1083. i.ListenerQueue.push(c), k && (i._addListenerTarget(window), i._addListenerTarget(a)), i.lazyLoadHandler(), e.nextTick(function () {
  1084. return i.lazyLoadHandler();
  1085. });
  1086. });
  1087. }
  1088. }, {
  1089. key: "update",
  1090. value: function value(t, n) {
  1091. var r = this,
  1092. i = this._valueFormatter(n.value),
  1093. o = i.src,
  1094. a = i.loading,
  1095. l = i.error;
  1096. o = s(t, this.options.scale) || o;
  1097. var d = u(this.ListenerQueue, function (e) {
  1098. return e.el === t;
  1099. });
  1100. d && d.update({
  1101. src: o,
  1102. loading: a,
  1103. error: l
  1104. }), this._observer && (this._observer.unobserve(t), this._observer.observe(t)), this.lazyLoadHandler(), e.nextTick(function () {
  1105. return r.lazyLoadHandler();
  1106. });
  1107. }
  1108. }, {
  1109. key: "remove",
  1110. value: function value(e) {
  1111. if (e) {
  1112. this._observer && this._observer.unobserve(e);
  1113. var t = u(this.ListenerQueue, function (t) {
  1114. return t.el === e;
  1115. });
  1116. t && (this._removeListenerTarget(t.$parent), this._removeListenerTarget(window), o(this.ListenerQueue, t) && t.destroy());
  1117. }
  1118. }
  1119. }, {
  1120. key: "removeComponent",
  1121. value: function value(e) {
  1122. e && (o(this.ListenerQueue, e), this._observer && this._observer.unobserve(e.el), e.$parent && e.$el.parentNode && this._removeListenerTarget(e.$el.parentNode), this._removeListenerTarget(window));
  1123. }
  1124. }, {
  1125. key: "setMode",
  1126. value: function value(e) {
  1127. var t = this;
  1128. E || e !== A.observer || (e = A.event), this.mode = e, e === A.event ? (this._observer && (this.ListenerQueue.forEach(function (e) {
  1129. t._observer.unobserve(e.el);
  1130. }), this._observer = null), this.TargetQueue.forEach(function (e) {
  1131. t._initListen(e.el, !0);
  1132. })) : (this.TargetQueue.forEach(function (e) {
  1133. t._initListen(e.el, !1);
  1134. }), this._initIntersectionObserver());
  1135. }
  1136. }, {
  1137. key: "_addListenerTarget",
  1138. value: function value(e) {
  1139. if (e) {
  1140. var t = u(this.TargetQueue, function (t) {
  1141. return t.el === e;
  1142. });
  1143. return t ? t.childrenCount++ : (t = {
  1144. el: e,
  1145. id: ++this.TargetIndex,
  1146. childrenCount: 1,
  1147. listened: !0
  1148. }, this.mode === A.event && this._initListen(t.el, !0), this.TargetQueue.push(t)), this.TargetIndex;
  1149. }
  1150. }
  1151. }, {
  1152. key: "_removeListenerTarget",
  1153. value: function value(e) {
  1154. var t = this;
  1155. this.TargetQueue.forEach(function (n, r) {
  1156. n.el === e && (--n.childrenCount || (t._initListen(n.el, !1), t.TargetQueue.splice(r, 1), n = null));
  1157. });
  1158. }
  1159. }, {
  1160. key: "_initListen",
  1161. value: function value(e, t) {
  1162. var n = this;
  1163. this.options.ListenEvents.forEach(function (r) {
  1164. return O[t ? "on" : "off"](e, r, n.lazyLoadHandler);
  1165. });
  1166. }
  1167. }, {
  1168. key: "_initEvent",
  1169. value: function value() {
  1170. var e = this;
  1171. this.Event = {
  1172. listeners: {
  1173. loading: [],
  1174. loaded: [],
  1175. error: []
  1176. }
  1177. }, this.$on = function (t, n) {
  1178. e.Event.listeners[t].push(n);
  1179. }, this.$once = function (t, n) {
  1180. function r() {
  1181. i.$off(t, r), n.apply(i, arguments);
  1182. }
  1183. var i = e;
  1184. e.$on(t, r);
  1185. }, this.$off = function (t, n) {
  1186. if (!n) return void (e.Event.listeners[t] = []);
  1187. o(e.Event.listeners[t], n);
  1188. }, this.$emit = function (t, n, r) {
  1189. e.Event.listeners[t].forEach(function (e) {
  1190. return e(n, r);
  1191. });
  1192. };
  1193. }
  1194. }, {
  1195. key: "_lazyLoadHandler",
  1196. value: function value() {
  1197. var e = this,
  1198. t = !1;
  1199. this.ListenerQueue.forEach(function (n, r) {
  1200. n.state.loaded || (t = n.checkInView()) && n.load(function () {
  1201. !n.error && n.loaded && e.ListenerQueue.splice(r, 1);
  1202. });
  1203. });
  1204. }
  1205. }, {
  1206. key: "_initIntersectionObserver",
  1207. value: function value() {
  1208. var e = this;
  1209. E && (this._observer = new IntersectionObserver(this._observerHandler.bind(this), this.options.observerOptions), this.ListenerQueue.length && this.ListenerQueue.forEach(function (t) {
  1210. e._observer.observe(t.el);
  1211. }));
  1212. }
  1213. }, {
  1214. key: "_observerHandler",
  1215. value: function value(e, t) {
  1216. var n = this;
  1217. e.forEach(function (e) {
  1218. e.isIntersecting && n.ListenerQueue.forEach(function (t) {
  1219. if (t.el === e.target) {
  1220. if (t.state.loaded) return n._observer.unobserve(t.el);
  1221. t.load();
  1222. }
  1223. });
  1224. });
  1225. }
  1226. }, {
  1227. key: "_elRenderer",
  1228. value: function value(e, t, n) {
  1229. if (e.el) {
  1230. var r = e.el,
  1231. i = e.bindType,
  1232. o = void 0;
  1233. switch (t) {
  1234. case "loading":
  1235. o = e.loading;
  1236. break;
  1237. case "error":
  1238. o = e.error;
  1239. break;
  1240. default:
  1241. o = e.src;
  1242. }
  1243. if (i ? r.style[i] = 'url("' + o + '")' : r.getAttribute("src") !== o && r.setAttribute("src", o), r.setAttribute("lazy", t), this.$emit(t, e, n), this.options.adapter[t] && this.options.adapter[t](e, this.options), this.options.dispatchEvent) {
  1244. var a = new j(t, {
  1245. detail: e
  1246. });
  1247. r.dispatchEvent(a);
  1248. }
  1249. }
  1250. }
  1251. }, {
  1252. key: "_valueFormatter",
  1253. value: function value(e) {
  1254. var t = e,
  1255. n = this.options.loading,
  1256. r = this.options.error;
  1257. return c(e) && (e.src || this.options.silent || console.error("Vue Lazyload warning: miss src with " + e), t = e.src, n = e.loading || this.options.loading, r = e.error || this.options.error), {
  1258. src: t,
  1259. loading: n,
  1260. error: r
  1261. };
  1262. }
  1263. }]), t;
  1264. }();
  1265. },
  1266. B = function B(e) {
  1267. return {
  1268. props: {
  1269. tag: {
  1270. type: String,
  1271. default: "div"
  1272. }
  1273. },
  1274. render: function render(e) {
  1275. return !1 === this.show ? e(this.tag) : e(this.tag, null, this.$slots.default);
  1276. },
  1277. data: function data() {
  1278. return {
  1279. el: null,
  1280. state: {
  1281. loaded: !1
  1282. },
  1283. rect: {},
  1284. show: !1
  1285. };
  1286. },
  1287. mounted: function mounted() {
  1288. this.el = this.$el, e.addLazyBox(this), e.lazyLoadHandler();
  1289. },
  1290. beforeDestroy: function beforeDestroy() {
  1291. e.removeComponent(this);
  1292. },
  1293. methods: {
  1294. getRect: function getRect() {
  1295. this.rect = this.$el.getBoundingClientRect();
  1296. },
  1297. checkInView: function checkInView() {
  1298. return this.getRect(), k && this.rect.top < window.innerHeight * e.options.preLoad && this.rect.bottom > 0 && this.rect.left < window.innerWidth * e.options.preLoad && this.rect.right > 0;
  1299. },
  1300. load: function load() {
  1301. this.show = !0, this.state.loaded = !0, this.$emit("show", this);
  1302. }
  1303. }
  1304. };
  1305. },
  1306. V = function () {
  1307. function e(t) {
  1308. var n = t.lazy;
  1309. b(this, e), this.lazy = n, n.lazyContainerMananger = this, this._queue = [];
  1310. }
  1311. return y(e, [{
  1312. key: "bind",
  1313. value: function value(e, t, n) {
  1314. var r = new N({
  1315. el: e,
  1316. binding: t,
  1317. vnode: n,
  1318. lazy: this.lazy
  1319. });
  1320. this._queue.push(r);
  1321. }
  1322. }, {
  1323. key: "update",
  1324. value: function value(e, t, n) {
  1325. var r = u(this._queue, function (t) {
  1326. return t.el === e;
  1327. });
  1328. r && r.update({
  1329. el: e,
  1330. binding: t,
  1331. vnode: n
  1332. });
  1333. }
  1334. }, {
  1335. key: "unbind",
  1336. value: function value(e, t, n) {
  1337. var r = u(this._queue, function (t) {
  1338. return t.el === e;
  1339. });
  1340. r && (r.clear(), o(this._queue, r));
  1341. }
  1342. }]), e;
  1343. }(),
  1344. M = {
  1345. selector: "img"
  1346. },
  1347. N = function () {
  1348. function e(t) {
  1349. var n = t.el,
  1350. r = t.binding,
  1351. i = t.vnode,
  1352. o = t.lazy;
  1353. b(this, e), this.el = null, this.vnode = i, this.binding = r, this.options = {}, this.lazy = o, this._queue = [], this.update({
  1354. el: n,
  1355. binding: r
  1356. });
  1357. }
  1358. return y(e, [{
  1359. key: "update",
  1360. value: function value(e) {
  1361. var t = this,
  1362. n = e.el,
  1363. r = e.binding;
  1364. this.el = n, this.options = _({}, M, r.value), this.getImgs().forEach(function (e) {
  1365. t.lazy.add(e, _({}, t.binding, {
  1366. value: {
  1367. src: e.dataset.src,
  1368. error: e.dataset.error,
  1369. loading: e.dataset.loading
  1370. }
  1371. }), t.vnode);
  1372. });
  1373. }
  1374. }, {
  1375. key: "getImgs",
  1376. value: function value() {
  1377. return f(this.el.querySelectorAll(this.options.selector));
  1378. }
  1379. }, {
  1380. key: "clear",
  1381. value: function value() {
  1382. var e = this;
  1383. this.getImgs().forEach(function (t) {
  1384. return e.lazy.remove(t);
  1385. }), this.vnode = null, this.binding = null, this.lazy = null;
  1386. }
  1387. }]), e;
  1388. }();
  1389. return {
  1390. install: function install(e) {
  1391. var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
  1392. n = D(e),
  1393. r = new n(t),
  1394. i = new V({
  1395. lazy: r
  1396. }),
  1397. o = "2" === e.version.split(".")[0];
  1398. e.prototype.$Lazyload = r, t.lazyComponent && e.component("lazy-component", B(r)), o ? (e.directive("lazy", {
  1399. bind: r.add.bind(r),
  1400. update: r.update.bind(r),
  1401. componentUpdated: r.lazyLoadHandler.bind(r),
  1402. unbind: r.remove.bind(r)
  1403. }), e.directive("lazy-container", {
  1404. bind: i.bind.bind(i),
  1405. update: i.update.bind(i),
  1406. unbind: i.unbind.bind(i)
  1407. })) : (e.directive("lazy", {
  1408. bind: r.lazyLoadHandler.bind(r),
  1409. update: function update(e, t) {
  1410. _(this.vm.$refs, this.vm.$els), r.add(this.el, {
  1411. modifiers: this.modifiers || {},
  1412. arg: this.arg,
  1413. value: e,
  1414. oldValue: t
  1415. }, {
  1416. context: this.vm
  1417. });
  1418. },
  1419. unbind: function unbind() {
  1420. r.remove(this.el);
  1421. }
  1422. }), e.directive("lazy-container", {
  1423. update: function update(e, t) {
  1424. i.update(this.el, {
  1425. modifiers: this.modifiers || {},
  1426. arg: this.arg,
  1427. value: e,
  1428. oldValue: t
  1429. }, {
  1430. context: this.vm
  1431. });
  1432. },
  1433. unbind: function unbind() {
  1434. i.unbind(this.el);
  1435. }
  1436. }));
  1437. }
  1438. };
  1439. });
  1440. /***/ }),
  1441. /* 10 */
  1442. /***/ (function(module, exports) {
  1443. var g; // This works in non-strict mode
  1444. g = function () {
  1445. return this;
  1446. }();
  1447. try {
  1448. // This works if eval is allowed (see CSP)
  1449. g = g || new Function("return this")();
  1450. } catch (e) {
  1451. // This works if the window reference is available
  1452. if (typeof window === "object") g = window;
  1453. } // g can still be undefined, but nothing to do about it...
  1454. // We return undefined, instead of nothing here, so it's
  1455. // easier to handle this case. if(!global) { ...}
  1456. module.exports = g;
  1457. /***/ }),
  1458. /* 11 */
  1459. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1460. "use strict";
  1461. // ESM COMPAT FLAG
  1462. __webpack_require__.r(__webpack_exports__);
  1463. // EXPORTS
  1464. __webpack_require__.d(__webpack_exports__, "install", function() { return /* binding */ install; });
  1465. __webpack_require__.d(__webpack_exports__, "version", function() { return /* binding */ version; });
  1466. __webpack_require__.d(__webpack_exports__, "ActionSheet", function() { return /* reexport */ action_sheet; });
  1467. __webpack_require__.d(__webpack_exports__, "AddressEdit", function() { return /* reexport */ address_edit; });
  1468. __webpack_require__.d(__webpack_exports__, "AddressList", function() { return /* reexport */ address_list; });
  1469. __webpack_require__.d(__webpack_exports__, "Area", function() { return /* reexport */ es_area; });
  1470. __webpack_require__.d(__webpack_exports__, "Badge", function() { return /* reexport */ badge; });
  1471. __webpack_require__.d(__webpack_exports__, "Button", function() { return /* reexport */ es_button; });
  1472. __webpack_require__.d(__webpack_exports__, "Calendar", function() { return /* reexport */ calendar; });
  1473. __webpack_require__.d(__webpack_exports__, "Card", function() { return /* reexport */ card; });
  1474. __webpack_require__.d(__webpack_exports__, "Cascader", function() { return /* reexport */ cascader; });
  1475. __webpack_require__.d(__webpack_exports__, "Cell", function() { return /* reexport */ cell; });
  1476. __webpack_require__.d(__webpack_exports__, "CellGroup", function() { return /* reexport */ cell_group; });
  1477. __webpack_require__.d(__webpack_exports__, "Checkbox", function() { return /* reexport */ es_checkbox; });
  1478. __webpack_require__.d(__webpack_exports__, "CheckboxGroup", function() { return /* reexport */ checkbox_group; });
  1479. __webpack_require__.d(__webpack_exports__, "Circle", function() { return /* reexport */ circle; });
  1480. __webpack_require__.d(__webpack_exports__, "Col", function() { return /* reexport */ col; });
  1481. __webpack_require__.d(__webpack_exports__, "Collapse", function() { return /* reexport */ collapse; });
  1482. __webpack_require__.d(__webpack_exports__, "CollapseItem", function() { return /* reexport */ collapse_item; });
  1483. __webpack_require__.d(__webpack_exports__, "ContactCard", function() { return /* reexport */ contact_card; });
  1484. __webpack_require__.d(__webpack_exports__, "ContactEdit", function() { return /* reexport */ contact_edit; });
  1485. __webpack_require__.d(__webpack_exports__, "ContactList", function() { return /* reexport */ contact_list; });
  1486. __webpack_require__.d(__webpack_exports__, "CountDown", function() { return /* reexport */ count_down; });
  1487. __webpack_require__.d(__webpack_exports__, "Coupon", function() { return /* reexport */ es_coupon; });
  1488. __webpack_require__.d(__webpack_exports__, "CouponCell", function() { return /* reexport */ coupon_cell; });
  1489. __webpack_require__.d(__webpack_exports__, "CouponList", function() { return /* reexport */ coupon_list; });
  1490. __webpack_require__.d(__webpack_exports__, "DatetimePicker", function() { return /* reexport */ datetime_picker; });
  1491. __webpack_require__.d(__webpack_exports__, "Dialog", function() { return /* reexport */ dialog; });
  1492. __webpack_require__.d(__webpack_exports__, "Divider", function() { return /* reexport */ divider; });
  1493. __webpack_require__.d(__webpack_exports__, "DropdownItem", function() { return /* reexport */ dropdown_item; });
  1494. __webpack_require__.d(__webpack_exports__, "DropdownMenu", function() { return /* reexport */ dropdown_menu; });
  1495. __webpack_require__.d(__webpack_exports__, "Empty", function() { return /* reexport */ empty; });
  1496. __webpack_require__.d(__webpack_exports__, "Field", function() { return /* reexport */ es_field; });
  1497. __webpack_require__.d(__webpack_exports__, "Form", function() { return /* reexport */ es_form; });
  1498. __webpack_require__.d(__webpack_exports__, "GoodsAction", function() { return /* reexport */ goods_action; });
  1499. __webpack_require__.d(__webpack_exports__, "GoodsActionButton", function() { return /* reexport */ goods_action_button; });
  1500. __webpack_require__.d(__webpack_exports__, "GoodsActionIcon", function() { return /* reexport */ goods_action_icon; });
  1501. __webpack_require__.d(__webpack_exports__, "Grid", function() { return /* reexport */ grid; });
  1502. __webpack_require__.d(__webpack_exports__, "GridItem", function() { return /* reexport */ grid_item; });
  1503. __webpack_require__.d(__webpack_exports__, "Icon", function() { return /* reexport */ es_icon; });
  1504. __webpack_require__.d(__webpack_exports__, "Image", function() { return /* reexport */ es_image; });
  1505. __webpack_require__.d(__webpack_exports__, "ImagePreview", function() { return /* reexport */ image_preview; });
  1506. __webpack_require__.d(__webpack_exports__, "IndexAnchor", function() { return /* reexport */ index_anchor; });
  1507. __webpack_require__.d(__webpack_exports__, "IndexBar", function() { return /* reexport */ index_bar; });
  1508. __webpack_require__.d(__webpack_exports__, "Info", function() { return /* reexport */ es_info; });
  1509. __webpack_require__.d(__webpack_exports__, "Lazyload", function() { return /* reexport */ lazyload; });
  1510. __webpack_require__.d(__webpack_exports__, "List", function() { return /* reexport */ es_list; });
  1511. __webpack_require__.d(__webpack_exports__, "Loading", function() { return /* reexport */ es_loading; });
  1512. __webpack_require__.d(__webpack_exports__, "Locale", function() { return /* reexport */ locale["a" /* default */]; });
  1513. __webpack_require__.d(__webpack_exports__, "NavBar", function() { return /* reexport */ nav_bar; });
  1514. __webpack_require__.d(__webpack_exports__, "NoticeBar", function() { return /* reexport */ notice_bar; });
  1515. __webpack_require__.d(__webpack_exports__, "Notify", function() { return /* reexport */ notify; });
  1516. __webpack_require__.d(__webpack_exports__, "NumberKeyboard", function() { return /* reexport */ number_keyboard; });
  1517. __webpack_require__.d(__webpack_exports__, "Overlay", function() { return /* reexport */ es_overlay; });
  1518. __webpack_require__.d(__webpack_exports__, "Pagination", function() { return /* reexport */ pagination; });
  1519. __webpack_require__.d(__webpack_exports__, "Panel", function() { return /* reexport */ panel; });
  1520. __webpack_require__.d(__webpack_exports__, "PasswordInput", function() { return /* reexport */ password_input; });
  1521. __webpack_require__.d(__webpack_exports__, "Picker", function() { return /* reexport */ es_picker; });
  1522. __webpack_require__.d(__webpack_exports__, "Popover", function() { return /* reexport */ popover; });
  1523. __webpack_require__.d(__webpack_exports__, "Popup", function() { return /* reexport */ popup; });
  1524. __webpack_require__.d(__webpack_exports__, "Progress", function() { return /* reexport */ es_progress; });
  1525. __webpack_require__.d(__webpack_exports__, "PullRefresh", function() { return /* reexport */ pull_refresh; });
  1526. __webpack_require__.d(__webpack_exports__, "Radio", function() { return /* reexport */ es_radio; });
  1527. __webpack_require__.d(__webpack_exports__, "RadioGroup", function() { return /* reexport */ radio_group; });
  1528. __webpack_require__.d(__webpack_exports__, "Rate", function() { return /* reexport */ es_rate; });
  1529. __webpack_require__.d(__webpack_exports__, "Row", function() { return /* reexport */ row; });
  1530. __webpack_require__.d(__webpack_exports__, "Search", function() { return /* reexport */ search; });
  1531. __webpack_require__.d(__webpack_exports__, "ShareSheet", function() { return /* reexport */ share_sheet; });
  1532. __webpack_require__.d(__webpack_exports__, "Sidebar", function() { return /* reexport */ sidebar; });
  1533. __webpack_require__.d(__webpack_exports__, "SidebarItem", function() { return /* reexport */ sidebar_item; });
  1534. __webpack_require__.d(__webpack_exports__, "Skeleton", function() { return /* reexport */ skeleton; });
  1535. __webpack_require__.d(__webpack_exports__, "Sku", function() { return /* reexport */ es_sku; });
  1536. __webpack_require__.d(__webpack_exports__, "Slider", function() { return /* reexport */ slider; });
  1537. __webpack_require__.d(__webpack_exports__, "Step", function() { return /* reexport */ es_step; });
  1538. __webpack_require__.d(__webpack_exports__, "Stepper", function() { return /* reexport */ stepper; });
  1539. __webpack_require__.d(__webpack_exports__, "Steps", function() { return /* reexport */ steps; });
  1540. __webpack_require__.d(__webpack_exports__, "Sticky", function() { return /* reexport */ es_sticky; });
  1541. __webpack_require__.d(__webpack_exports__, "SubmitBar", function() { return /* reexport */ submit_bar; });
  1542. __webpack_require__.d(__webpack_exports__, "Swipe", function() { return /* reexport */ swipe; });
  1543. __webpack_require__.d(__webpack_exports__, "SwipeCell", function() { return /* reexport */ swipe_cell; });
  1544. __webpack_require__.d(__webpack_exports__, "SwipeItem", function() { return /* reexport */ swipe_item; });
  1545. __webpack_require__.d(__webpack_exports__, "Switch", function() { return /* reexport */ es_switch; });
  1546. __webpack_require__.d(__webpack_exports__, "SwitchCell", function() { return /* reexport */ switch_cell; });
  1547. __webpack_require__.d(__webpack_exports__, "Tab", function() { return /* reexport */ tab; });
  1548. __webpack_require__.d(__webpack_exports__, "Tabbar", function() { return /* reexport */ tabbar; });
  1549. __webpack_require__.d(__webpack_exports__, "TabbarItem", function() { return /* reexport */ tabbar_item; });
  1550. __webpack_require__.d(__webpack_exports__, "Tabs", function() { return /* reexport */ tabs; });
  1551. __webpack_require__.d(__webpack_exports__, "Tag", function() { return /* reexport */ es_tag; });
  1552. __webpack_require__.d(__webpack_exports__, "Toast", function() { return /* reexport */ es_toast; });
  1553. __webpack_require__.d(__webpack_exports__, "TreeSelect", function() { return /* reexport */ tree_select; });
  1554. __webpack_require__.d(__webpack_exports__, "Uploader", function() { return /* reexport */ uploader; });
  1555. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  1556. function _extends() {
  1557. _extends = Object.assign || function (target) {
  1558. for (var i = 1; i < arguments.length; i++) {
  1559. var source = arguments[i];
  1560. for (var key in source) {
  1561. if (Object.prototype.hasOwnProperty.call(source, key)) {
  1562. target[key] = source[key];
  1563. }
  1564. }
  1565. }
  1566. return target;
  1567. };
  1568. return _extends.apply(this, arguments);
  1569. }
  1570. // EXTERNAL MODULE: ./node_modules/@vue/babel-helper-vue-jsx-merge-props/dist/helper.js
  1571. var helper = __webpack_require__(1);
  1572. var helper_default = /*#__PURE__*/__webpack_require__.n(helper);
  1573. // EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
  1574. var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(3);
  1575. var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default = /*#__PURE__*/__webpack_require__.n(external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_);
  1576. // EXTERNAL MODULE: ./es/utils/create/index.js + 4 modules
  1577. var create = __webpack_require__(8);
  1578. // CONCATENATED MODULE: ./es/utils/functional.js
  1579. var inheritKey = ['ref', 'key', 'style', 'class', 'attrs', 'refInFor', 'nativeOn', 'directives', 'staticClass', 'staticStyle'];
  1580. var mapInheritKey = {
  1581. nativeOn: 'on'
  1582. }; // inherit partial context, map nativeOn to on
  1583. function inherit(context, inheritListeners) {
  1584. var result = inheritKey.reduce(function (obj, key) {
  1585. if (context.data[key]) {
  1586. obj[mapInheritKey[key] || key] = context.data[key];
  1587. }
  1588. return obj;
  1589. }, {});
  1590. if (inheritListeners) {
  1591. result.on = result.on || {};
  1592. _extends(result.on, context.data.on);
  1593. }
  1594. return result;
  1595. } // emit event
  1596. function functional_emit(context, eventName) {
  1597. for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
  1598. args[_key - 2] = arguments[_key];
  1599. }
  1600. var listeners = context.listeners[eventName];
  1601. if (listeners) {
  1602. if (Array.isArray(listeners)) {
  1603. listeners.forEach(function (listener) {
  1604. listener.apply(void 0, args);
  1605. });
  1606. } else {
  1607. listeners.apply(void 0, args);
  1608. }
  1609. }
  1610. } // mount functional component
  1611. function mount(Component, data) {
  1612. var instance = new external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a({
  1613. el: document.createElement('div'),
  1614. props: Component.props,
  1615. render: function render(h) {
  1616. return h(Component, _extends({
  1617. props: this.$props
  1618. }, data));
  1619. }
  1620. });
  1621. document.body.appendChild(instance.$el);
  1622. return instance;
  1623. }
  1624. // CONCATENATED MODULE: ./es/mixins/popup/context.js
  1625. var context_context = {
  1626. zIndex: 2000,
  1627. lockCount: 0,
  1628. stack: [],
  1629. find: function find(vm) {
  1630. return this.stack.filter(function (item) {
  1631. return item.vm === vm;
  1632. })[0];
  1633. },
  1634. remove: function remove(vm) {
  1635. var item = this.find(vm);
  1636. if (!item) return;
  1637. item.vm = null;
  1638. item.overlay = null;
  1639. var index = this.stack.indexOf(item);
  1640. this.stack.splice(index, 1);
  1641. }
  1642. };
  1643. // EXTERNAL MODULE: ./es/utils/index.js
  1644. var utils = __webpack_require__(0);
  1645. // CONCATENATED MODULE: ./es/utils/dom/event.js
  1646. // eslint-disable-next-line import/no-mutable-exports
  1647. var supportsPassive = false;
  1648. if (!utils["h" /* isServer */]) {
  1649. try {
  1650. var opts = {};
  1651. Object.defineProperty(opts, 'passive', {
  1652. // eslint-disable-next-line getter-return
  1653. get: function get() {
  1654. /* istanbul ignore next */
  1655. supportsPassive = true;
  1656. }
  1657. });
  1658. window.addEventListener('test-passive', null, opts); // eslint-disable-next-line no-empty
  1659. } catch (e) {}
  1660. }
  1661. function event_on(target, event, handler, passive) {
  1662. if (passive === void 0) {
  1663. passive = false;
  1664. }
  1665. if (!utils["h" /* isServer */]) {
  1666. target.addEventListener(event, handler, supportsPassive ? {
  1667. capture: false,
  1668. passive: passive
  1669. } : false);
  1670. }
  1671. }
  1672. function off(target, event, handler) {
  1673. if (!utils["h" /* isServer */]) {
  1674. target.removeEventListener(event, handler);
  1675. }
  1676. }
  1677. function event_stopPropagation(event) {
  1678. event.stopPropagation();
  1679. }
  1680. function preventDefault(event, isStopPropagation) {
  1681. /* istanbul ignore else */
  1682. if (typeof event.cancelable !== 'boolean' || event.cancelable) {
  1683. event.preventDefault();
  1684. }
  1685. if (isStopPropagation) {
  1686. event_stopPropagation(event);
  1687. }
  1688. }
  1689. // CONCATENATED MODULE: ./es/overlay/index.js
  1690. // Utils
  1691. // Types
  1692. var _createNamespace = Object(create["a" /* createNamespace */])('overlay'),
  1693. createComponent = _createNamespace[0],
  1694. overlay_bem = _createNamespace[1];
  1695. function preventTouchMove(event) {
  1696. preventDefault(event, true);
  1697. }
  1698. function Overlay(h, props, slots, ctx) {
  1699. var style = _extends({
  1700. zIndex: props.zIndex
  1701. }, props.customStyle);
  1702. if (Object(utils["c" /* isDef */])(props.duration)) {
  1703. style.animationDuration = props.duration + "s";
  1704. }
  1705. return h("transition", {
  1706. "attrs": {
  1707. "name": "van-fade"
  1708. }
  1709. }, [h("div", helper_default()([{
  1710. "directives": [{
  1711. name: "show",
  1712. value: props.show
  1713. }],
  1714. "style": style,
  1715. "class": [overlay_bem(), props.className],
  1716. "on": {
  1717. "touchmove": props.lockScroll ? preventTouchMove : utils["i" /* noop */]
  1718. }
  1719. }, inherit(ctx, true)]), [slots.default == null ? void 0 : slots.default()])]);
  1720. }
  1721. Overlay.props = {
  1722. show: Boolean,
  1723. zIndex: [Number, String],
  1724. duration: [Number, String],
  1725. className: null,
  1726. customStyle: Object,
  1727. lockScroll: {
  1728. type: Boolean,
  1729. default: true
  1730. }
  1731. };
  1732. /* harmony default export */ var es_overlay = (createComponent(Overlay));
  1733. // CONCATENATED MODULE: ./es/utils/dom/node.js
  1734. function removeNode(el) {
  1735. var parent = el.parentNode;
  1736. if (parent) {
  1737. parent.removeChild(el);
  1738. }
  1739. }
  1740. // CONCATENATED MODULE: ./es/mixins/popup/overlay.js
  1741. var defaultConfig = {
  1742. className: '',
  1743. customStyle: {}
  1744. };
  1745. function mountOverlay(vm) {
  1746. return mount(es_overlay, {
  1747. on: {
  1748. // close popup when overlay clicked & closeOnClickOverlay is true
  1749. click: function click() {
  1750. vm.$emit('click-overlay');
  1751. if (vm.closeOnClickOverlay) {
  1752. if (vm.onClickOverlay) {
  1753. vm.onClickOverlay();
  1754. } else {
  1755. vm.close();
  1756. }
  1757. }
  1758. }
  1759. }
  1760. });
  1761. }
  1762. function updateOverlay(vm) {
  1763. var item = context_context.find(vm);
  1764. if (item) {
  1765. var el = vm.$el;
  1766. var config = item.config,
  1767. overlay = item.overlay;
  1768. if (el && el.parentNode) {
  1769. el.parentNode.insertBefore(overlay.$el, el);
  1770. }
  1771. _extends(overlay, defaultConfig, config, {
  1772. show: true
  1773. });
  1774. }
  1775. }
  1776. function openOverlay(vm, config) {
  1777. var item = context_context.find(vm);
  1778. if (item) {
  1779. item.config = config;
  1780. } else {
  1781. var overlay = mountOverlay(vm);
  1782. context_context.stack.push({
  1783. vm: vm,
  1784. config: config,
  1785. overlay: overlay
  1786. });
  1787. }
  1788. updateOverlay(vm);
  1789. }
  1790. function closeOverlay(vm) {
  1791. var item = context_context.find(vm);
  1792. if (item) {
  1793. item.overlay.show = false;
  1794. }
  1795. }
  1796. function removeOverlay(vm) {
  1797. var item = context_context.find(vm);
  1798. if (item) {
  1799. removeNode(item.overlay.$el);
  1800. context_context.remove(vm);
  1801. }
  1802. }
  1803. // CONCATENATED MODULE: ./es/utils/dom/scroll.js
  1804. function isWindow(val) {
  1805. return val === window;
  1806. } // get nearest scroll element
  1807. // https://github.com/vant-ui/vant/issues/3823
  1808. var overflowScrollReg = /scroll|auto|overlay/i;
  1809. function getScroller(el, root) {
  1810. if (root === void 0) {
  1811. root = window;
  1812. }
  1813. var node = el;
  1814. while (node && node.tagName !== 'HTML' && node.tagName !== 'BODY' && node.nodeType === 1 && node !== root) {
  1815. var _window$getComputedSt = window.getComputedStyle(node),
  1816. overflowY = _window$getComputedSt.overflowY;
  1817. if (overflowScrollReg.test(overflowY)) {
  1818. return node;
  1819. }
  1820. node = node.parentNode;
  1821. }
  1822. return root;
  1823. }
  1824. function getScrollTop(el) {
  1825. var top = 'scrollTop' in el ? el.scrollTop : el.pageYOffset; // iOS scroll bounce cause minus scrollTop
  1826. return Math.max(top, 0);
  1827. }
  1828. function setScrollTop(el, value) {
  1829. if ('scrollTop' in el) {
  1830. el.scrollTop = value;
  1831. } else {
  1832. el.scrollTo(el.scrollX, value);
  1833. }
  1834. }
  1835. function getRootScrollTop() {
  1836. return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
  1837. }
  1838. function setRootScrollTop(value) {
  1839. setScrollTop(window, value);
  1840. setScrollTop(document.body, value);
  1841. } // get distance from element top to page top or scroller top
  1842. function getElementTop(el, scroller) {
  1843. if (isWindow(el)) {
  1844. return 0;
  1845. }
  1846. var scrollTop = scroller ? getScrollTop(scroller) : getRootScrollTop();
  1847. return el.getBoundingClientRect().top + scrollTop;
  1848. }
  1849. function getVisibleHeight(el) {
  1850. if (isWindow(el)) {
  1851. return el.innerHeight;
  1852. }
  1853. return el.getBoundingClientRect().height;
  1854. }
  1855. function getVisibleTop(el) {
  1856. if (isWindow(el)) {
  1857. return 0;
  1858. }
  1859. return el.getBoundingClientRect().top;
  1860. }
  1861. // CONCATENATED MODULE: ./es/mixins/touch.js
  1862. function getDirection(x, y) {
  1863. if (x > y) {
  1864. return 'horizontal';
  1865. }
  1866. if (y > x) {
  1867. return 'vertical';
  1868. }
  1869. return '';
  1870. }
  1871. var TouchMixin = {
  1872. data: function data() {
  1873. return {
  1874. direction: ''
  1875. };
  1876. },
  1877. methods: {
  1878. touchStart: function touchStart(event) {
  1879. this.resetTouchStatus();
  1880. this.startX = event.touches[0].clientX;
  1881. this.startY = event.touches[0].clientY;
  1882. },
  1883. touchMove: function touchMove(event) {
  1884. var touch = event.touches[0]; // safari back will set clientX to negative number
  1885. this.deltaX = touch.clientX < 0 ? 0 : touch.clientX - this.startX;
  1886. this.deltaY = touch.clientY - this.startY;
  1887. this.offsetX = Math.abs(this.deltaX);
  1888. this.offsetY = Math.abs(this.deltaY); // lock direction when distance is greater than a certain value
  1889. var LOCK_DIRECTION_DISTANCE = 10;
  1890. if (!this.direction || this.offsetX < LOCK_DIRECTION_DISTANCE && this.offsetY < LOCK_DIRECTION_DISTANCE) {
  1891. this.direction = getDirection(this.offsetX, this.offsetY);
  1892. }
  1893. },
  1894. resetTouchStatus: function resetTouchStatus() {
  1895. this.direction = '';
  1896. this.deltaX = 0;
  1897. this.deltaY = 0;
  1898. this.offsetX = 0;
  1899. this.offsetY = 0;
  1900. },
  1901. // avoid Vue 2.6 event bubble issues by manually binding events
  1902. // https://github.com/vant-ui/vant/issues/3015
  1903. bindTouchEvent: function bindTouchEvent(el) {
  1904. var onTouchStart = this.onTouchStart,
  1905. onTouchMove = this.onTouchMove,
  1906. onTouchEnd = this.onTouchEnd;
  1907. event_on(el, 'touchstart', onTouchStart);
  1908. event_on(el, 'touchmove', onTouchMove);
  1909. if (onTouchEnd) {
  1910. event_on(el, 'touchend', onTouchEnd);
  1911. event_on(el, 'touchcancel', onTouchEnd);
  1912. }
  1913. }
  1914. }
  1915. };
  1916. // CONCATENATED MODULE: ./es/mixins/portal.js
  1917. function getElement(selector) {
  1918. if (typeof selector === 'string') {
  1919. return document.querySelector(selector);
  1920. }
  1921. return selector();
  1922. }
  1923. function PortalMixin(_temp) {
  1924. var _ref = _temp === void 0 ? {} : _temp,
  1925. ref = _ref.ref,
  1926. afterPortal = _ref.afterPortal;
  1927. return {
  1928. props: {
  1929. getContainer: [String, Function]
  1930. },
  1931. watch: {
  1932. getContainer: 'portal'
  1933. },
  1934. mounted: function mounted() {
  1935. if (this.getContainer) {
  1936. this.portal();
  1937. }
  1938. },
  1939. methods: {
  1940. portal: function portal() {
  1941. var getContainer = this.getContainer;
  1942. var el = ref ? this.$refs[ref] : this.$el;
  1943. var container;
  1944. if (getContainer) {
  1945. container = getElement(getContainer);
  1946. } else if (this.$parent) {
  1947. container = this.$parent.$el;
  1948. }
  1949. if (container && container !== el.parentNode) {
  1950. container.appendChild(el);
  1951. }
  1952. if (afterPortal) {
  1953. afterPortal.call(this);
  1954. }
  1955. }
  1956. }
  1957. };
  1958. }
  1959. // CONCATENATED MODULE: ./es/mixins/bind-event.js
  1960. /**
  1961. * Bind event when mounted or activated
  1962. */
  1963. var uid = 0;
  1964. function BindEventMixin(handler) {
  1965. var key = "binded_" + uid++;
  1966. function bind() {
  1967. if (!this[key]) {
  1968. handler.call(this, event_on, true);
  1969. this[key] = true;
  1970. }
  1971. }
  1972. function unbind() {
  1973. if (this[key]) {
  1974. handler.call(this, off, false);
  1975. this[key] = false;
  1976. }
  1977. }
  1978. return {
  1979. mounted: bind,
  1980. activated: bind,
  1981. deactivated: unbind,
  1982. beforeDestroy: unbind
  1983. };
  1984. }
  1985. // CONCATENATED MODULE: ./es/mixins/close-on-popstate.js
  1986. var CloseOnPopstateMixin = {
  1987. mixins: [BindEventMixin(function (bind, isBind) {
  1988. this.handlePopstate(isBind && this.closeOnPopstate);
  1989. })],
  1990. props: {
  1991. closeOnPopstate: Boolean
  1992. },
  1993. data: function data() {
  1994. return {
  1995. bindStatus: false
  1996. };
  1997. },
  1998. watch: {
  1999. closeOnPopstate: function closeOnPopstate(val) {
  2000. this.handlePopstate(val);
  2001. }
  2002. },
  2003. methods: {
  2004. onPopstate: function onPopstate() {
  2005. this.close();
  2006. this.shouldReopen = false;
  2007. },
  2008. handlePopstate: function handlePopstate(bind) {
  2009. /* istanbul ignore if */
  2010. if (this.$isServer) {
  2011. return;
  2012. }
  2013. if (this.bindStatus !== bind) {
  2014. this.bindStatus = bind;
  2015. var action = bind ? event_on : off;
  2016. action(window, 'popstate', this.onPopstate);
  2017. }
  2018. }
  2019. }
  2020. };
  2021. // CONCATENATED MODULE: ./es/mixins/popup/index.js
  2022. // Context
  2023. // Utils
  2024. // Mixins
  2025. var popupMixinProps = {
  2026. // Initial rendering animation
  2027. transitionAppear: Boolean,
  2028. // whether to show popup
  2029. value: Boolean,
  2030. // whether to show overlay
  2031. overlay: Boolean,
  2032. // overlay custom style
  2033. overlayStyle: Object,
  2034. // overlay custom class name
  2035. overlayClass: String,
  2036. // whether to close popup when overlay is clicked
  2037. closeOnClickOverlay: Boolean,
  2038. // z-index
  2039. zIndex: [Number, String],
  2040. // prevent body scroll
  2041. lockScroll: {
  2042. type: Boolean,
  2043. default: true
  2044. },
  2045. // whether to lazy render
  2046. lazyRender: {
  2047. type: Boolean,
  2048. default: true
  2049. }
  2050. };
  2051. function PopupMixin(options) {
  2052. if (options === void 0) {
  2053. options = {};
  2054. }
  2055. return {
  2056. mixins: [TouchMixin, CloseOnPopstateMixin, PortalMixin({
  2057. afterPortal: function afterPortal() {
  2058. if (this.overlay) {
  2059. updateOverlay();
  2060. }
  2061. }
  2062. })],
  2063. provide: function provide() {
  2064. return {
  2065. vanPopup: this
  2066. };
  2067. },
  2068. props: popupMixinProps,
  2069. data: function data() {
  2070. this.onReopenCallback = [];
  2071. return {
  2072. inited: this.value
  2073. };
  2074. },
  2075. computed: {
  2076. shouldRender: function shouldRender() {
  2077. return this.inited || !this.lazyRender;
  2078. }
  2079. },
  2080. watch: {
  2081. value: function value(val) {
  2082. var type = val ? 'open' : 'close';
  2083. this.inited = this.inited || this.value;
  2084. this[type]();
  2085. if (!options.skipToggleEvent) {
  2086. this.$emit(type);
  2087. }
  2088. },
  2089. overlay: 'renderOverlay'
  2090. },
  2091. mounted: function mounted() {
  2092. if (this.value) {
  2093. this.open();
  2094. }
  2095. },
  2096. /* istanbul ignore next */
  2097. activated: function activated() {
  2098. if (this.shouldReopen) {
  2099. this.$emit('input', true);
  2100. this.shouldReopen = false;
  2101. }
  2102. },
  2103. beforeDestroy: function beforeDestroy() {
  2104. removeOverlay(this);
  2105. if (this.opened) {
  2106. this.removeLock();
  2107. }
  2108. if (this.getContainer) {
  2109. removeNode(this.$el);
  2110. }
  2111. },
  2112. /* istanbul ignore next */
  2113. deactivated: function deactivated() {
  2114. if (this.value) {
  2115. this.close();
  2116. this.shouldReopen = true;
  2117. }
  2118. },
  2119. methods: {
  2120. open: function open() {
  2121. /* istanbul ignore next */
  2122. if (this.$isServer || this.opened) {
  2123. return;
  2124. } // cover default zIndex
  2125. if (this.zIndex !== undefined) {
  2126. context_context.zIndex = this.zIndex;
  2127. }
  2128. this.opened = true;
  2129. this.renderOverlay();
  2130. this.addLock();
  2131. this.onReopenCallback.forEach(function (callback) {
  2132. callback();
  2133. });
  2134. },
  2135. addLock: function addLock() {
  2136. if (this.lockScroll) {
  2137. event_on(document, 'touchstart', this.touchStart);
  2138. event_on(document, 'touchmove', this.onTouchMove);
  2139. if (!context_context.lockCount) {
  2140. document.body.classList.add('van-overflow-hidden');
  2141. }
  2142. context_context.lockCount++;
  2143. }
  2144. },
  2145. removeLock: function removeLock() {
  2146. if (this.lockScroll && context_context.lockCount) {
  2147. context_context.lockCount--;
  2148. off(document, 'touchstart', this.touchStart);
  2149. off(document, 'touchmove', this.onTouchMove);
  2150. if (!context_context.lockCount) {
  2151. document.body.classList.remove('van-overflow-hidden');
  2152. }
  2153. }
  2154. },
  2155. close: function close() {
  2156. if (!this.opened) {
  2157. return;
  2158. }
  2159. closeOverlay(this);
  2160. this.opened = false;
  2161. this.removeLock();
  2162. this.$emit('input', false);
  2163. },
  2164. onTouchMove: function onTouchMove(event) {
  2165. this.touchMove(event);
  2166. var direction = this.deltaY > 0 ? '10' : '01';
  2167. var el = getScroller(event.target, this.$el);
  2168. var scrollHeight = el.scrollHeight,
  2169. offsetHeight = el.offsetHeight,
  2170. scrollTop = el.scrollTop;
  2171. var status = '11';
  2172. /* istanbul ignore next */
  2173. if (scrollTop === 0) {
  2174. status = offsetHeight >= scrollHeight ? '00' : '01';
  2175. } else if (scrollTop + offsetHeight >= scrollHeight) {
  2176. status = '10';
  2177. }
  2178. /* istanbul ignore next */
  2179. if (status !== '11' && this.direction === 'vertical' && !(parseInt(status, 2) & parseInt(direction, 2))) {
  2180. preventDefault(event, true);
  2181. }
  2182. },
  2183. renderOverlay: function renderOverlay() {
  2184. var _this = this;
  2185. if (this.$isServer || !this.value) {
  2186. return;
  2187. }
  2188. this.$nextTick(function () {
  2189. _this.updateZIndex(_this.overlay ? 1 : 0);
  2190. if (_this.overlay) {
  2191. openOverlay(_this, {
  2192. zIndex: context_context.zIndex++,
  2193. duration: _this.duration,
  2194. className: _this.overlayClass,
  2195. customStyle: _this.overlayStyle
  2196. });
  2197. } else {
  2198. closeOverlay(_this);
  2199. }
  2200. });
  2201. },
  2202. updateZIndex: function updateZIndex(value) {
  2203. if (value === void 0) {
  2204. value = 0;
  2205. }
  2206. this.$el.style.zIndex = ++context_context.zIndex + value;
  2207. },
  2208. onReopen: function onReopen(callback) {
  2209. this.onReopenCallback.push(callback);
  2210. }
  2211. }
  2212. };
  2213. }
  2214. // EXTERNAL MODULE: ./es/utils/format/unit.js
  2215. var unit = __webpack_require__(6);
  2216. // CONCATENATED MODULE: ./es/info/index.js
  2217. // Utils
  2218. // Types
  2219. var info_createNamespace = Object(create["a" /* createNamespace */])('info'),
  2220. info_createComponent = info_createNamespace[0],
  2221. info_bem = info_createNamespace[1];
  2222. function info_Info(h, props, slots, ctx) {
  2223. var dot = props.dot,
  2224. info = props.info;
  2225. var showInfo = Object(utils["c" /* isDef */])(info) && info !== '';
  2226. if (!dot && !showInfo) {
  2227. return;
  2228. }
  2229. return h("div", helper_default()([{
  2230. "class": info_bem({
  2231. dot: dot
  2232. })
  2233. }, inherit(ctx, true)]), [dot ? '' : props.info]);
  2234. }
  2235. info_Info.props = {
  2236. dot: Boolean,
  2237. info: [Number, String]
  2238. };
  2239. /* harmony default export */ var es_info = (info_createComponent(info_Info));
  2240. // CONCATENATED MODULE: ./es/icon/index.js
  2241. // Utils
  2242. // Components
  2243. // Types
  2244. var icon_createNamespace = Object(create["a" /* createNamespace */])('icon'),
  2245. icon_createComponent = icon_createNamespace[0],
  2246. icon_bem = icon_createNamespace[1];
  2247. function isImage(name) {
  2248. return name ? name.indexOf('/') !== -1 : false;
  2249. } // compatible with legacy usage, should be removed in next major version
  2250. var LEGACY_MAP = {
  2251. medel: 'medal',
  2252. 'medel-o': 'medal-o',
  2253. 'calender-o': 'calendar-o'
  2254. };
  2255. function correctName(name) {
  2256. return name && LEGACY_MAP[name] || name;
  2257. }
  2258. function Icon(h, props, slots, ctx) {
  2259. var _props$badge;
  2260. var name = correctName(props.name);
  2261. var imageIcon = isImage(name);
  2262. if (false) {}
  2263. return h(props.tag, helper_default()([{
  2264. "class": [props.classPrefix, imageIcon ? '' : props.classPrefix + "-" + name],
  2265. "style": {
  2266. color: props.color,
  2267. fontSize: Object(unit["a" /* addUnit */])(props.size)
  2268. }
  2269. }, inherit(ctx, true)]), [slots.default && slots.default(), imageIcon && h("img", {
  2270. "class": icon_bem('image'),
  2271. "attrs": {
  2272. "src": name
  2273. }
  2274. }), h(es_info, {
  2275. "attrs": {
  2276. "dot": props.dot,
  2277. "info": (_props$badge = props.badge) != null ? _props$badge : props.info
  2278. }
  2279. })]);
  2280. }
  2281. Icon.props = {
  2282. dot: Boolean,
  2283. name: String,
  2284. size: [Number, String],
  2285. // @deprecated
  2286. // should be removed in next major version
  2287. info: [Number, String],
  2288. badge: [Number, String],
  2289. color: String,
  2290. tag: {
  2291. type: String,
  2292. default: 'i'
  2293. },
  2294. classPrefix: {
  2295. type: String,
  2296. default: icon_bem()
  2297. }
  2298. };
  2299. /* harmony default export */ var es_icon = (icon_createComponent(Icon));
  2300. // CONCATENATED MODULE: ./es/popup/index.js
  2301. var popup_createNamespace = Object(create["a" /* createNamespace */])('popup'),
  2302. popup_createComponent = popup_createNamespace[0],
  2303. popup_bem = popup_createNamespace[1];
  2304. /* harmony default export */ var popup = (popup_createComponent({
  2305. mixins: [PopupMixin()],
  2306. props: {
  2307. round: Boolean,
  2308. duration: [Number, String],
  2309. closeable: Boolean,
  2310. transition: String,
  2311. safeAreaInsetBottom: Boolean,
  2312. closeIcon: {
  2313. type: String,
  2314. default: 'cross'
  2315. },
  2316. closeIconPosition: {
  2317. type: String,
  2318. default: 'top-right'
  2319. },
  2320. position: {
  2321. type: String,
  2322. default: 'center'
  2323. },
  2324. overlay: {
  2325. type: Boolean,
  2326. default: true
  2327. },
  2328. closeOnClickOverlay: {
  2329. type: Boolean,
  2330. default: true
  2331. }
  2332. },
  2333. beforeCreate: function beforeCreate() {
  2334. var _this = this;
  2335. var createEmitter = function createEmitter(eventName) {
  2336. return function (event) {
  2337. return _this.$emit(eventName, event);
  2338. };
  2339. };
  2340. this.onClick = createEmitter('click');
  2341. this.onOpened = createEmitter('opened');
  2342. this.onClosed = createEmitter('closed');
  2343. },
  2344. methods: {
  2345. onClickCloseIcon: function onClickCloseIcon(event) {
  2346. this.$emit('click-close-icon', event);
  2347. this.close();
  2348. }
  2349. },
  2350. render: function render() {
  2351. var _bem;
  2352. var h = arguments[0];
  2353. if (!this.shouldRender) {
  2354. return;
  2355. }
  2356. var round = this.round,
  2357. position = this.position,
  2358. duration = this.duration;
  2359. var isCenter = position === 'center';
  2360. var transitionName = this.transition || (isCenter ? 'van-fade' : "van-popup-slide-" + position);
  2361. var style = {};
  2362. if (Object(utils["c" /* isDef */])(duration)) {
  2363. var key = isCenter ? 'animationDuration' : 'transitionDuration';
  2364. style[key] = duration + "s";
  2365. }
  2366. return h("transition", {
  2367. "attrs": {
  2368. "appear": this.transitionAppear,
  2369. "name": transitionName
  2370. },
  2371. "on": {
  2372. "afterEnter": this.onOpened,
  2373. "afterLeave": this.onClosed
  2374. }
  2375. }, [h("div", {
  2376. "directives": [{
  2377. name: "show",
  2378. value: this.value
  2379. }],
  2380. "style": style,
  2381. "class": popup_bem((_bem = {
  2382. round: round
  2383. }, _bem[position] = position, _bem['safe-area-inset-bottom'] = this.safeAreaInsetBottom, _bem)),
  2384. "on": {
  2385. "click": this.onClick
  2386. }
  2387. }, [this.slots(), this.closeable && h(es_icon, {
  2388. "attrs": {
  2389. "role": "button",
  2390. "tabindex": "0",
  2391. "name": this.closeIcon
  2392. },
  2393. "class": popup_bem('close-icon', this.closeIconPosition),
  2394. "on": {
  2395. "click": this.onClickCloseIcon
  2396. }
  2397. })])]);
  2398. }
  2399. }));
  2400. // CONCATENATED MODULE: ./es/loading/index.js
  2401. // Utils
  2402. // Types
  2403. var loading_createNamespace = Object(create["a" /* createNamespace */])('loading'),
  2404. loading_createComponent = loading_createNamespace[0],
  2405. loading_bem = loading_createNamespace[1];
  2406. function LoadingIcon(h, props) {
  2407. if (props.type === 'spinner') {
  2408. var Spin = [];
  2409. for (var i = 0; i < 12; i++) {
  2410. Spin.push(h("i"));
  2411. }
  2412. return Spin;
  2413. }
  2414. return h("svg", {
  2415. "class": loading_bem('circular'),
  2416. "attrs": {
  2417. "viewBox": "25 25 50 50"
  2418. }
  2419. }, [h("circle", {
  2420. "attrs": {
  2421. "cx": "50",
  2422. "cy": "50",
  2423. "r": "20",
  2424. "fill": "none"
  2425. }
  2426. })]);
  2427. }
  2428. function LoadingText(h, props, slots) {
  2429. if (slots.default) {
  2430. var _props$textColor;
  2431. var style = {
  2432. fontSize: Object(unit["a" /* addUnit */])(props.textSize),
  2433. color: (_props$textColor = props.textColor) != null ? _props$textColor : props.color
  2434. };
  2435. return h("span", {
  2436. "class": loading_bem('text'),
  2437. "style": style
  2438. }, [slots.default()]);
  2439. }
  2440. }
  2441. function Loading(h, props, slots, ctx) {
  2442. var color = props.color,
  2443. size = props.size,
  2444. type = props.type;
  2445. var style = {
  2446. color: color
  2447. };
  2448. if (size) {
  2449. var iconSize = Object(unit["a" /* addUnit */])(size);
  2450. style.width = iconSize;
  2451. style.height = iconSize;
  2452. }
  2453. return h("div", helper_default()([{
  2454. "class": loading_bem([type, {
  2455. vertical: props.vertical
  2456. }])
  2457. }, inherit(ctx, true)]), [h("span", {
  2458. "class": loading_bem('spinner', type),
  2459. "style": style
  2460. }, [LoadingIcon(h, props)]), LoadingText(h, props, slots)]);
  2461. }
  2462. Loading.props = {
  2463. color: String,
  2464. size: [Number, String],
  2465. vertical: Boolean,
  2466. textSize: [Number, String],
  2467. textColor: String,
  2468. type: {
  2469. type: String,
  2470. default: 'circular'
  2471. }
  2472. };
  2473. /* harmony default export */ var es_loading = (loading_createComponent(Loading));
  2474. // CONCATENATED MODULE: ./es/action-sheet/index.js
  2475. // Utils
  2476. // Mixins
  2477. // Components
  2478. // Types
  2479. var action_sheet_createNamespace = Object(create["a" /* createNamespace */])('action-sheet'),
  2480. action_sheet_createComponent = action_sheet_createNamespace[0],
  2481. action_sheet_bem = action_sheet_createNamespace[1];
  2482. function ActionSheet(h, props, slots, ctx) {
  2483. var title = props.title,
  2484. cancelText = props.cancelText,
  2485. closeable = props.closeable;
  2486. function onCancel() {
  2487. functional_emit(ctx, 'input', false);
  2488. functional_emit(ctx, 'cancel');
  2489. }
  2490. function Header() {
  2491. if (title) {
  2492. return h("div", {
  2493. "class": action_sheet_bem('header')
  2494. }, [title, closeable && h(es_icon, {
  2495. "attrs": {
  2496. "name": props.closeIcon
  2497. },
  2498. "class": action_sheet_bem('close'),
  2499. "on": {
  2500. "click": onCancel
  2501. }
  2502. })]);
  2503. }
  2504. }
  2505. function Option(item, index) {
  2506. var disabled = item.disabled,
  2507. loading = item.loading,
  2508. callback = item.callback;
  2509. function onClickOption(event) {
  2510. event.stopPropagation();
  2511. if (disabled || loading) {
  2512. return;
  2513. }
  2514. if (callback) {
  2515. callback(item);
  2516. }
  2517. if (props.closeOnClickAction) {
  2518. functional_emit(ctx, 'input', false);
  2519. }
  2520. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.nextTick(function () {
  2521. functional_emit(ctx, 'select', item, index);
  2522. });
  2523. }
  2524. function OptionContent() {
  2525. if (loading) {
  2526. return h(es_loading, {
  2527. "class": action_sheet_bem('loading-icon')
  2528. });
  2529. }
  2530. return [h("span", {
  2531. "class": action_sheet_bem('name')
  2532. }, [item.name]), item.subname && h("div", {
  2533. "class": action_sheet_bem('subname')
  2534. }, [item.subname])];
  2535. }
  2536. return h("button", {
  2537. "attrs": {
  2538. "type": "button"
  2539. },
  2540. "class": [action_sheet_bem('item', {
  2541. disabled: disabled,
  2542. loading: loading
  2543. }), item.className],
  2544. "style": {
  2545. color: item.color
  2546. },
  2547. "on": {
  2548. "click": onClickOption
  2549. }
  2550. }, [OptionContent()]);
  2551. }
  2552. function CancelText() {
  2553. if (cancelText) {
  2554. return [h("div", {
  2555. "class": action_sheet_bem('gap')
  2556. }), h("button", {
  2557. "attrs": {
  2558. "type": "button"
  2559. },
  2560. "class": action_sheet_bem('cancel'),
  2561. "on": {
  2562. "click": onCancel
  2563. }
  2564. }, [cancelText])];
  2565. }
  2566. }
  2567. function Description() {
  2568. var description = (slots.description == null ? void 0 : slots.description()) || props.description;
  2569. if (description) {
  2570. return h("div", {
  2571. "class": action_sheet_bem('description')
  2572. }, [description]);
  2573. }
  2574. }
  2575. return h(popup, helper_default()([{
  2576. "class": action_sheet_bem(),
  2577. "attrs": {
  2578. "position": "bottom",
  2579. "round": props.round,
  2580. "value": props.value,
  2581. "overlay": props.overlay,
  2582. "duration": props.duration,
  2583. "lazyRender": props.lazyRender,
  2584. "lockScroll": props.lockScroll,
  2585. "getContainer": props.getContainer,
  2586. "closeOnPopstate": props.closeOnPopstate,
  2587. "closeOnClickOverlay": props.closeOnClickOverlay,
  2588. "safeAreaInsetBottom": props.safeAreaInsetBottom
  2589. }
  2590. }, inherit(ctx, true)]), [Header(), Description(), h("div", {
  2591. "class": action_sheet_bem('content')
  2592. }, [props.actions && props.actions.map(Option), slots.default == null ? void 0 : slots.default()]), CancelText()]);
  2593. }
  2594. ActionSheet.props = _extends({}, popupMixinProps, {
  2595. title: String,
  2596. actions: Array,
  2597. duration: [Number, String],
  2598. cancelText: String,
  2599. description: String,
  2600. getContainer: [String, Function],
  2601. closeOnPopstate: Boolean,
  2602. closeOnClickAction: Boolean,
  2603. round: {
  2604. type: Boolean,
  2605. default: true
  2606. },
  2607. closeable: {
  2608. type: Boolean,
  2609. default: true
  2610. },
  2611. closeIcon: {
  2612. type: String,
  2613. default: 'cross'
  2614. },
  2615. safeAreaInsetBottom: {
  2616. type: Boolean,
  2617. default: true
  2618. },
  2619. overlay: {
  2620. type: Boolean,
  2621. default: true
  2622. },
  2623. closeOnClickOverlay: {
  2624. type: Boolean,
  2625. default: true
  2626. }
  2627. });
  2628. /* harmony default export */ var action_sheet = (action_sheet_createComponent(ActionSheet));
  2629. // CONCATENATED MODULE: ./es/utils/validate/mobile.js
  2630. function isMobile(value) {
  2631. value = value.replace(/[^-|\d]/g, '');
  2632. return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
  2633. }
  2634. // CONCATENATED MODULE: ./es/picker/shared.js
  2635. var DEFAULT_ITEM_HEIGHT = 44;
  2636. var pickerProps = {
  2637. title: String,
  2638. loading: Boolean,
  2639. readonly: Boolean,
  2640. itemHeight: [Number, String],
  2641. showToolbar: Boolean,
  2642. cancelButtonText: String,
  2643. confirmButtonText: String,
  2644. allowHtml: {
  2645. type: Boolean,
  2646. default: true
  2647. },
  2648. visibleItemCount: {
  2649. type: [Number, String],
  2650. default: 6
  2651. },
  2652. swipeDuration: {
  2653. type: [Number, String],
  2654. default: 1000
  2655. }
  2656. };
  2657. // CONCATENATED MODULE: ./es/utils/constant.js
  2658. // color
  2659. var RED = '#ee0a24'; // border
  2660. var BORDER = 'van-hairline';
  2661. var BORDER_TOP = BORDER + "--top";
  2662. var BORDER_LEFT = BORDER + "--left";
  2663. var BORDER_BOTTOM = BORDER + "--bottom";
  2664. var BORDER_SURROUND = BORDER + "--surround";
  2665. var BORDER_TOP_BOTTOM = BORDER + "--top-bottom";
  2666. var BORDER_UNSET_TOP_BOTTOM = BORDER + "-unset--top-bottom";
  2667. // CONCATENATED MODULE: ./es/utils/deep-clone.js
  2668. function deepClone(obj) {
  2669. if (!Object(utils["c" /* isDef */])(obj)) {
  2670. return obj;
  2671. }
  2672. if (Array.isArray(obj)) {
  2673. return obj.map(function (item) {
  2674. return deepClone(item);
  2675. });
  2676. }
  2677. if (typeof obj === 'object') {
  2678. var to = {};
  2679. Object.keys(obj).forEach(function (key) {
  2680. to[key] = deepClone(obj[key]);
  2681. });
  2682. return to;
  2683. }
  2684. return obj;
  2685. }
  2686. // CONCATENATED MODULE: ./es/utils/format/number.js
  2687. function range(num, min, max) {
  2688. return Math.min(Math.max(num, min), max);
  2689. }
  2690. function trimExtraChar(value, _char, regExp) {
  2691. var index = value.indexOf(_char);
  2692. var prefix = '';
  2693. if (index === -1) {
  2694. return value;
  2695. }
  2696. if (_char === '-' && index !== 0) {
  2697. return value.slice(0, index);
  2698. }
  2699. if (_char === '.' && value.match(/^(\.|-\.)/)) {
  2700. prefix = index ? '-0' : '0';
  2701. }
  2702. return prefix + value.slice(0, index + 1) + value.slice(index).replace(regExp, '');
  2703. }
  2704. function number_formatNumber(value, allowDot, allowMinus) {
  2705. if (allowDot === void 0) {
  2706. allowDot = true;
  2707. }
  2708. if (allowMinus === void 0) {
  2709. allowMinus = true;
  2710. }
  2711. if (allowDot) {
  2712. value = trimExtraChar(value, '.', /\./g);
  2713. } else {
  2714. value = value.split('.')[0];
  2715. }
  2716. if (allowMinus) {
  2717. value = trimExtraChar(value, '-', /-/g);
  2718. } else {
  2719. value = value.replace(/-/, '');
  2720. }
  2721. var regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
  2722. return value.replace(regExp, '');
  2723. } // add num and avoid float number
  2724. function addNumber(num1, num2) {
  2725. var cardinal = Math.pow(10, 10);
  2726. return Math.round((num1 + num2) * cardinal) / cardinal;
  2727. }
  2728. // CONCATENATED MODULE: ./es/picker/PickerColumn.js
  2729. var DEFAULT_DURATION = 200; // 惯性滑动思路:
  2730. // 在手指离开屏幕时,如果和上一次 move 时的间隔小于 `MOMENTUM_LIMIT_TIME` 且 move
  2731. // 距离大于 `MOMENTUM_LIMIT_DISTANCE` 时,执行惯性滑动
  2732. var MOMENTUM_LIMIT_TIME = 300;
  2733. var MOMENTUM_LIMIT_DISTANCE = 15;
  2734. var PickerColumn_createNamespace = Object(create["a" /* createNamespace */])('picker-column'),
  2735. PickerColumn_createComponent = PickerColumn_createNamespace[0],
  2736. PickerColumn_bem = PickerColumn_createNamespace[1];
  2737. function getElementTranslateY(element) {
  2738. var style = window.getComputedStyle(element);
  2739. var transform = style.transform || style.webkitTransform;
  2740. var translateY = transform.slice(7, transform.length - 1).split(', ')[5];
  2741. return Number(translateY);
  2742. }
  2743. function isOptionDisabled(option) {
  2744. return Object(utils["f" /* isObject */])(option) && option.disabled;
  2745. } // use standard WheelEvent:
  2746. // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
  2747. var supportMousewheel = utils["b" /* inBrowser */] && 'onwheel' in window;
  2748. var mousewheelTimer = null;
  2749. /* harmony default export */ var PickerColumn = (PickerColumn_createComponent({
  2750. mixins: [TouchMixin],
  2751. props: {
  2752. valueKey: String,
  2753. readonly: Boolean,
  2754. allowHtml: Boolean,
  2755. className: String,
  2756. itemHeight: Number,
  2757. defaultIndex: Number,
  2758. swipeDuration: [Number, String],
  2759. visibleItemCount: [Number, String],
  2760. initialOptions: {
  2761. type: Array,
  2762. default: function _default() {
  2763. return [];
  2764. }
  2765. }
  2766. },
  2767. data: function data() {
  2768. return {
  2769. offset: 0,
  2770. duration: 0,
  2771. options: deepClone(this.initialOptions),
  2772. currentIndex: this.defaultIndex
  2773. };
  2774. },
  2775. created: function created() {
  2776. if (this.$parent.children) {
  2777. this.$parent.children.push(this);
  2778. }
  2779. this.setIndex(this.currentIndex);
  2780. },
  2781. mounted: function mounted() {
  2782. this.bindTouchEvent(this.$el);
  2783. if (supportMousewheel) {
  2784. event_on(this.$el, 'wheel', this.onMouseWheel, false);
  2785. }
  2786. },
  2787. destroyed: function destroyed() {
  2788. var children = this.$parent.children;
  2789. if (children) {
  2790. children.splice(children.indexOf(this), 1);
  2791. }
  2792. if (supportMousewheel) {
  2793. off(this.$el, 'wheel');
  2794. }
  2795. },
  2796. watch: {
  2797. initialOptions: 'setOptions',
  2798. defaultIndex: function defaultIndex(val) {
  2799. this.setIndex(val);
  2800. }
  2801. },
  2802. computed: {
  2803. count: function count() {
  2804. return this.options.length;
  2805. },
  2806. baseOffset: function baseOffset() {
  2807. return this.itemHeight * (this.visibleItemCount - 1) / 2;
  2808. }
  2809. },
  2810. methods: {
  2811. setOptions: function setOptions(options) {
  2812. if (JSON.stringify(options) !== JSON.stringify(this.options)) {
  2813. this.options = deepClone(options);
  2814. this.setIndex(this.defaultIndex);
  2815. }
  2816. },
  2817. onTouchStart: function onTouchStart(event) {
  2818. if (this.readonly) {
  2819. return;
  2820. }
  2821. this.touchStart(event);
  2822. if (this.moving) {
  2823. var translateY = getElementTranslateY(this.$refs.wrapper);
  2824. this.offset = Math.min(0, translateY - this.baseOffset);
  2825. this.startOffset = this.offset;
  2826. } else {
  2827. this.startOffset = this.offset;
  2828. }
  2829. this.duration = 0;
  2830. this.transitionEndTrigger = null;
  2831. this.touchStartTime = Date.now();
  2832. this.momentumOffset = this.startOffset;
  2833. },
  2834. onTouchMove: function onTouchMove(event) {
  2835. if (this.readonly) {
  2836. return;
  2837. }
  2838. this.touchMove(event);
  2839. if (this.direction === 'vertical') {
  2840. this.moving = true;
  2841. preventDefault(event, true);
  2842. }
  2843. this.offset = range(this.startOffset + this.deltaY, -(this.count * this.itemHeight), this.itemHeight);
  2844. var now = Date.now();
  2845. if (now - this.touchStartTime > MOMENTUM_LIMIT_TIME) {
  2846. this.touchStartTime = now;
  2847. this.momentumOffset = this.offset;
  2848. }
  2849. },
  2850. onTouchEnd: function onTouchEnd() {
  2851. var _this = this;
  2852. if (this.readonly) {
  2853. return;
  2854. }
  2855. var distance = this.offset - this.momentumOffset;
  2856. var duration = Date.now() - this.touchStartTime;
  2857. var allowMomentum = duration < MOMENTUM_LIMIT_TIME && Math.abs(distance) > MOMENTUM_LIMIT_DISTANCE;
  2858. if (allowMomentum) {
  2859. this.momentum(distance, duration);
  2860. return;
  2861. }
  2862. var index = this.getIndexByOffset(this.offset);
  2863. this.duration = DEFAULT_DURATION;
  2864. this.setIndex(index, true); // compatible with desktop scenario
  2865. // use setTimeout to skip the click event Emitted after touchstart
  2866. setTimeout(function () {
  2867. _this.moving = false;
  2868. }, 0);
  2869. },
  2870. onMouseWheel: function onMouseWheel(event) {
  2871. var _this2 = this;
  2872. if (this.readonly) {
  2873. return;
  2874. }
  2875. preventDefault(event, true); // simply combine touchstart and touchmove
  2876. var translateY = getElementTranslateY(this.$refs.wrapper);
  2877. this.startOffset = Math.min(0, translateY - this.baseOffset);
  2878. this.momentumOffset = this.startOffset;
  2879. this.transitionEndTrigger = null; // directly use deltaY, see https://caniuse.com/?search=deltaY
  2880. // use deltaY to detect direction for not special setting device
  2881. // https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event
  2882. var deltaY = event.deltaY;
  2883. if (this.startOffset === 0 && deltaY < 0) {
  2884. return;
  2885. } // Calculate the offset based on itemHeight
  2886. var itemOffset = this.itemHeight * (deltaY > 0 ? -1 : 1);
  2887. this.offset = range(this.startOffset + itemOffset, -(this.count * this.itemHeight), this.itemHeight);
  2888. if (mousewheelTimer) {
  2889. clearTimeout(mousewheelTimer);
  2890. }
  2891. mousewheelTimer = setTimeout(function () {
  2892. _this2.onTouchEnd();
  2893. _this2.touchStartTime = 0;
  2894. }, MOMENTUM_LIMIT_TIME);
  2895. },
  2896. onTransitionEnd: function onTransitionEnd() {
  2897. this.stopMomentum();
  2898. },
  2899. onClickItem: function onClickItem(index) {
  2900. if (this.moving || this.readonly) {
  2901. return;
  2902. }
  2903. this.transitionEndTrigger = null;
  2904. this.duration = DEFAULT_DURATION;
  2905. this.setIndex(index, true);
  2906. },
  2907. adjustIndex: function adjustIndex(index) {
  2908. index = range(index, 0, this.count);
  2909. for (var i = index; i < this.count; i++) {
  2910. if (!isOptionDisabled(this.options[i])) return i;
  2911. }
  2912. for (var _i = index - 1; _i >= 0; _i--) {
  2913. if (!isOptionDisabled(this.options[_i])) return _i;
  2914. }
  2915. },
  2916. getOptionText: function getOptionText(option) {
  2917. if (Object(utils["f" /* isObject */])(option) && this.valueKey in option) {
  2918. return option[this.valueKey];
  2919. }
  2920. return option;
  2921. },
  2922. setIndex: function setIndex(index, emitChange) {
  2923. var _this3 = this;
  2924. index = this.adjustIndex(index) || 0;
  2925. var offset = -index * this.itemHeight;
  2926. var trigger = function trigger() {
  2927. if (index !== _this3.currentIndex) {
  2928. _this3.currentIndex = index;
  2929. if (emitChange) {
  2930. _this3.$emit('change', index);
  2931. }
  2932. }
  2933. }; // trigger the change event after transitionend when moving
  2934. if (this.moving && offset !== this.offset) {
  2935. this.transitionEndTrigger = trigger;
  2936. } else {
  2937. trigger();
  2938. }
  2939. this.offset = offset;
  2940. },
  2941. setValue: function setValue(value) {
  2942. var options = this.options;
  2943. for (var i = 0; i < options.length; i++) {
  2944. if (this.getOptionText(options[i]) === value) {
  2945. return this.setIndex(i);
  2946. }
  2947. }
  2948. },
  2949. getValue: function getValue() {
  2950. return this.options[this.currentIndex];
  2951. },
  2952. getIndexByOffset: function getIndexByOffset(offset) {
  2953. return range(Math.round(-offset / this.itemHeight), 0, this.count - 1);
  2954. },
  2955. momentum: function momentum(distance, duration) {
  2956. var speed = Math.abs(distance / duration);
  2957. distance = this.offset + speed / 0.003 * (distance < 0 ? -1 : 1);
  2958. var index = this.getIndexByOffset(distance);
  2959. this.duration = +this.swipeDuration;
  2960. this.setIndex(index, true);
  2961. },
  2962. stopMomentum: function stopMomentum() {
  2963. this.moving = false;
  2964. this.duration = 0;
  2965. if (this.transitionEndTrigger) {
  2966. this.transitionEndTrigger();
  2967. this.transitionEndTrigger = null;
  2968. }
  2969. },
  2970. genOptions: function genOptions() {
  2971. var _this4 = this;
  2972. var h = this.$createElement;
  2973. var optionStyle = {
  2974. height: this.itemHeight + "px"
  2975. };
  2976. return this.options.map(function (option, index) {
  2977. var _domProps;
  2978. var text = _this4.getOptionText(option);
  2979. var disabled = isOptionDisabled(option);
  2980. var data = {
  2981. style: optionStyle,
  2982. attrs: {
  2983. role: 'button',
  2984. tabindex: disabled ? -1 : 0
  2985. },
  2986. class: [PickerColumn_bem('item', {
  2987. disabled: disabled,
  2988. selected: index === _this4.currentIndex
  2989. })],
  2990. on: {
  2991. click: function click() {
  2992. _this4.onClickItem(index);
  2993. }
  2994. }
  2995. };
  2996. var childData = {
  2997. class: 'van-ellipsis',
  2998. domProps: (_domProps = {}, _domProps[_this4.allowHtml ? 'innerHTML' : 'textContent'] = text, _domProps)
  2999. };
  3000. return h("li", helper_default()([{}, data]), [_this4.slots('option', option) || h("div", helper_default()([{}, childData]))]);
  3001. });
  3002. }
  3003. },
  3004. render: function render() {
  3005. var h = arguments[0];
  3006. var wrapperStyle = {
  3007. transform: "translate3d(0, " + (this.offset + this.baseOffset) + "px, 0)",
  3008. transitionDuration: this.duration + "ms",
  3009. transitionProperty: this.duration ? 'all' : 'none'
  3010. };
  3011. return h("div", {
  3012. "class": [PickerColumn_bem(), this.className]
  3013. }, [h("ul", {
  3014. "ref": "wrapper",
  3015. "style": wrapperStyle,
  3016. "class": PickerColumn_bem('wrapper'),
  3017. "on": {
  3018. "transitionend": this.onTransitionEnd
  3019. }
  3020. }, [this.genOptions()])]);
  3021. }
  3022. }));
  3023. // CONCATENATED MODULE: ./es/picker/index.js
  3024. // Utils
  3025. // Components
  3026. var picker_createNamespace = Object(create["a" /* createNamespace */])('picker'),
  3027. picker_createComponent = picker_createNamespace[0],
  3028. picker_bem = picker_createNamespace[1],
  3029. t = picker_createNamespace[2];
  3030. /* harmony default export */ var es_picker = (picker_createComponent({
  3031. props: _extends({}, pickerProps, {
  3032. defaultIndex: {
  3033. type: [Number, String],
  3034. default: 0
  3035. },
  3036. columns: {
  3037. type: Array,
  3038. default: function _default() {
  3039. return [];
  3040. }
  3041. },
  3042. toolbarPosition: {
  3043. type: String,
  3044. default: 'top'
  3045. },
  3046. valueKey: {
  3047. type: String,
  3048. default: 'text'
  3049. }
  3050. }),
  3051. data: function data() {
  3052. return {
  3053. children: [],
  3054. formattedColumns: []
  3055. };
  3056. },
  3057. computed: {
  3058. itemPxHeight: function itemPxHeight() {
  3059. return this.itemHeight ? Object(unit["b" /* unitToPx */])(this.itemHeight) : DEFAULT_ITEM_HEIGHT;
  3060. },
  3061. dataType: function dataType() {
  3062. var columns = this.columns;
  3063. var firstColumn = columns[0] || {};
  3064. if (firstColumn.children) {
  3065. return 'cascade';
  3066. }
  3067. if (firstColumn.values) {
  3068. return 'object';
  3069. }
  3070. return 'text';
  3071. }
  3072. },
  3073. watch: {
  3074. columns: {
  3075. handler: 'format',
  3076. immediate: true
  3077. }
  3078. },
  3079. methods: {
  3080. format: function format() {
  3081. var columns = this.columns,
  3082. dataType = this.dataType;
  3083. if (dataType === 'text') {
  3084. this.formattedColumns = [{
  3085. values: columns
  3086. }];
  3087. } else if (dataType === 'cascade') {
  3088. this.formatCascade();
  3089. } else {
  3090. this.formattedColumns = columns;
  3091. }
  3092. },
  3093. formatCascade: function formatCascade() {
  3094. var formatted = [];
  3095. var cursor = {
  3096. children: this.columns
  3097. };
  3098. while (cursor && cursor.children) {
  3099. var _cursor$defaultIndex;
  3100. var _cursor = cursor,
  3101. children = _cursor.children;
  3102. var defaultIndex = (_cursor$defaultIndex = cursor.defaultIndex) != null ? _cursor$defaultIndex : +this.defaultIndex;
  3103. while (children[defaultIndex] && children[defaultIndex].disabled) {
  3104. if (defaultIndex < children.length - 1) {
  3105. defaultIndex++;
  3106. } else {
  3107. defaultIndex = 0;
  3108. break;
  3109. }
  3110. }
  3111. formatted.push({
  3112. values: cursor.children,
  3113. className: cursor.className,
  3114. defaultIndex: defaultIndex
  3115. });
  3116. cursor = children[defaultIndex];
  3117. }
  3118. this.formattedColumns = formatted;
  3119. },
  3120. emit: function emit(event) {
  3121. var _this = this;
  3122. if (this.dataType === 'text') {
  3123. this.$emit(event, this.getColumnValue(0), this.getColumnIndex(0));
  3124. } else {
  3125. var values = this.getValues(); // compatible with old version of wrong parameters
  3126. // should be removed in next major version
  3127. // see: https://github.com/vant-ui/vant/issues/5905
  3128. if (this.dataType === 'cascade') {
  3129. values = values.map(function (item) {
  3130. return item[_this.valueKey];
  3131. });
  3132. }
  3133. this.$emit(event, values, this.getIndexes());
  3134. }
  3135. },
  3136. onCascadeChange: function onCascadeChange(columnIndex) {
  3137. var cursor = {
  3138. children: this.columns
  3139. };
  3140. var indexes = this.getIndexes();
  3141. for (var i = 0; i <= columnIndex; i++) {
  3142. cursor = cursor.children[indexes[i]];
  3143. }
  3144. while (cursor && cursor.children) {
  3145. columnIndex++;
  3146. this.setColumnValues(columnIndex, cursor.children);
  3147. cursor = cursor.children[cursor.defaultIndex || 0];
  3148. }
  3149. },
  3150. onChange: function onChange(columnIndex) {
  3151. var _this2 = this;
  3152. if (this.dataType === 'cascade') {
  3153. this.onCascadeChange(columnIndex);
  3154. }
  3155. if (this.dataType === 'text') {
  3156. this.$emit('change', this, this.getColumnValue(0), this.getColumnIndex(0));
  3157. } else {
  3158. var values = this.getValues(); // compatible with old version of wrong parameters
  3159. // should be removed in next major version
  3160. // see: https://github.com/vant-ui/vant/issues/5905
  3161. if (this.dataType === 'cascade') {
  3162. values = values.map(function (item) {
  3163. return item[_this2.valueKey];
  3164. });
  3165. }
  3166. this.$emit('change', this, values, columnIndex);
  3167. }
  3168. },
  3169. // get column instance by index
  3170. getColumn: function getColumn(index) {
  3171. return this.children[index];
  3172. },
  3173. // @exposed-api
  3174. // get column value by index
  3175. getColumnValue: function getColumnValue(index) {
  3176. var column = this.getColumn(index);
  3177. return column && column.getValue();
  3178. },
  3179. // @exposed-api
  3180. // set column value by index
  3181. setColumnValue: function setColumnValue(index, value) {
  3182. var column = this.getColumn(index);
  3183. if (column) {
  3184. column.setValue(value);
  3185. if (this.dataType === 'cascade') {
  3186. this.onCascadeChange(index);
  3187. }
  3188. }
  3189. },
  3190. // @exposed-api
  3191. // get column option index by column index
  3192. getColumnIndex: function getColumnIndex(columnIndex) {
  3193. return (this.getColumn(columnIndex) || {}).currentIndex;
  3194. },
  3195. // @exposed-api
  3196. // set column option index by column index
  3197. setColumnIndex: function setColumnIndex(columnIndex, optionIndex) {
  3198. var column = this.getColumn(columnIndex);
  3199. if (column) {
  3200. column.setIndex(optionIndex);
  3201. if (this.dataType === 'cascade') {
  3202. this.onCascadeChange(columnIndex);
  3203. }
  3204. }
  3205. },
  3206. // @exposed-api
  3207. // get options of column by index
  3208. getColumnValues: function getColumnValues(index) {
  3209. return (this.children[index] || {}).options;
  3210. },
  3211. // @exposed-api
  3212. // set options of column by index
  3213. setColumnValues: function setColumnValues(index, options) {
  3214. var column = this.children[index];
  3215. if (column) {
  3216. column.setOptions(options);
  3217. }
  3218. },
  3219. // @exposed-api
  3220. // get values of all columns
  3221. getValues: function getValues() {
  3222. return this.children.map(function (child) {
  3223. return child.getValue();
  3224. });
  3225. },
  3226. // @exposed-api
  3227. // set values of all columns
  3228. setValues: function setValues(values) {
  3229. var _this3 = this;
  3230. values.forEach(function (value, index) {
  3231. _this3.setColumnValue(index, value);
  3232. });
  3233. },
  3234. // @exposed-api
  3235. // get indexes of all columns
  3236. getIndexes: function getIndexes() {
  3237. return this.children.map(function (child) {
  3238. return child.currentIndex;
  3239. });
  3240. },
  3241. // @exposed-api
  3242. // set indexes of all columns
  3243. setIndexes: function setIndexes(indexes) {
  3244. var _this4 = this;
  3245. indexes.forEach(function (optionIndex, columnIndex) {
  3246. _this4.setColumnIndex(columnIndex, optionIndex);
  3247. });
  3248. },
  3249. // @exposed-api
  3250. confirm: function confirm() {
  3251. this.children.forEach(function (child) {
  3252. return child.stopMomentum();
  3253. });
  3254. this.emit('confirm');
  3255. },
  3256. cancel: function cancel() {
  3257. this.emit('cancel');
  3258. },
  3259. genTitle: function genTitle() {
  3260. var h = this.$createElement;
  3261. var titleSlot = this.slots('title');
  3262. if (titleSlot) {
  3263. return titleSlot;
  3264. }
  3265. if (this.title) {
  3266. return h("div", {
  3267. "class": ['van-ellipsis', picker_bem('title')]
  3268. }, [this.title]);
  3269. }
  3270. },
  3271. genCancel: function genCancel() {
  3272. var h = this.$createElement;
  3273. return h("button", {
  3274. "attrs": {
  3275. "type": "button"
  3276. },
  3277. "class": picker_bem('cancel'),
  3278. "on": {
  3279. "click": this.cancel
  3280. }
  3281. }, [this.slots('cancel') || this.cancelButtonText || t('cancel')]);
  3282. },
  3283. genConfirm: function genConfirm() {
  3284. var h = this.$createElement;
  3285. return h("button", {
  3286. "attrs": {
  3287. "type": "button"
  3288. },
  3289. "class": picker_bem('confirm'),
  3290. "on": {
  3291. "click": this.confirm
  3292. }
  3293. }, [this.slots('confirm') || this.confirmButtonText || t('confirm')]);
  3294. },
  3295. genToolbar: function genToolbar() {
  3296. var h = this.$createElement;
  3297. if (this.showToolbar) {
  3298. return h("div", {
  3299. "class": picker_bem('toolbar')
  3300. }, [this.slots() || [this.genCancel(), this.genTitle(), this.genConfirm()]]);
  3301. }
  3302. },
  3303. genColumns: function genColumns() {
  3304. var h = this.$createElement;
  3305. var itemPxHeight = this.itemPxHeight;
  3306. var wrapHeight = itemPxHeight * this.visibleItemCount;
  3307. var frameStyle = {
  3308. height: itemPxHeight + "px"
  3309. };
  3310. var columnsStyle = {
  3311. height: wrapHeight + "px"
  3312. };
  3313. var maskStyle = {
  3314. backgroundSize: "100% " + (wrapHeight - itemPxHeight) / 2 + "px"
  3315. };
  3316. return h("div", {
  3317. "class": picker_bem('columns'),
  3318. "style": columnsStyle,
  3319. "on": {
  3320. "touchmove": preventDefault
  3321. }
  3322. }, [this.genColumnItems(), h("div", {
  3323. "class": picker_bem('mask'),
  3324. "style": maskStyle
  3325. }), h("div", {
  3326. "class": [BORDER_UNSET_TOP_BOTTOM, picker_bem('frame')],
  3327. "style": frameStyle
  3328. })]);
  3329. },
  3330. genColumnItems: function genColumnItems() {
  3331. var _this5 = this;
  3332. var h = this.$createElement;
  3333. return this.formattedColumns.map(function (item, columnIndex) {
  3334. var _item$defaultIndex;
  3335. return h(PickerColumn, {
  3336. "attrs": {
  3337. "readonly": _this5.readonly,
  3338. "valueKey": _this5.valueKey,
  3339. "allowHtml": _this5.allowHtml,
  3340. "className": item.className,
  3341. "itemHeight": _this5.itemPxHeight,
  3342. "defaultIndex": (_item$defaultIndex = item.defaultIndex) != null ? _item$defaultIndex : +_this5.defaultIndex,
  3343. "swipeDuration": _this5.swipeDuration,
  3344. "visibleItemCount": _this5.visibleItemCount,
  3345. "initialOptions": item.values
  3346. },
  3347. "scopedSlots": {
  3348. option: _this5.$scopedSlots.option
  3349. },
  3350. "on": {
  3351. "change": function change() {
  3352. _this5.onChange(columnIndex);
  3353. }
  3354. }
  3355. });
  3356. });
  3357. }
  3358. },
  3359. render: function render(h) {
  3360. return h("div", {
  3361. "class": picker_bem()
  3362. }, [this.toolbarPosition === 'top' ? this.genToolbar() : h(), this.loading ? h(es_loading, {
  3363. "class": picker_bem('loading')
  3364. }) : h(), this.slots('columns-top'), this.genColumns(), this.slots('columns-bottom'), this.toolbarPosition === 'bottom' ? this.genToolbar() : h()]);
  3365. }
  3366. }));
  3367. // CONCATENATED MODULE: ./es/area/index.js
  3368. var area_createNamespace = Object(create["a" /* createNamespace */])('area'),
  3369. area_createComponent = area_createNamespace[0],
  3370. area_bem = area_createNamespace[1];
  3371. var PLACEHOLDER_CODE = '000000';
  3372. function isOverseaCode(code) {
  3373. return code[0] === '9';
  3374. }
  3375. function pickSlots(instance, keys) {
  3376. var $slots = instance.$slots,
  3377. $scopedSlots = instance.$scopedSlots;
  3378. var scopedSlots = {};
  3379. keys.forEach(function (key) {
  3380. if ($scopedSlots[key]) {
  3381. scopedSlots[key] = $scopedSlots[key];
  3382. } else if ($slots[key]) {
  3383. scopedSlots[key] = function () {
  3384. return $slots[key];
  3385. };
  3386. }
  3387. });
  3388. return scopedSlots;
  3389. }
  3390. /* harmony default export */ var es_area = (area_createComponent({
  3391. props: _extends({}, pickerProps, {
  3392. value: String,
  3393. areaList: {
  3394. type: Object,
  3395. default: function _default() {
  3396. return {};
  3397. }
  3398. },
  3399. columnsNum: {
  3400. type: [Number, String],
  3401. default: 3
  3402. },
  3403. isOverseaCode: {
  3404. type: Function,
  3405. default: isOverseaCode
  3406. },
  3407. columnsPlaceholder: {
  3408. type: Array,
  3409. default: function _default() {
  3410. return [];
  3411. }
  3412. }
  3413. }),
  3414. data: function data() {
  3415. return {
  3416. code: this.value,
  3417. columns: [{
  3418. values: []
  3419. }, {
  3420. values: []
  3421. }, {
  3422. values: []
  3423. }]
  3424. };
  3425. },
  3426. computed: {
  3427. province: function province() {
  3428. return this.areaList.province_list || {};
  3429. },
  3430. city: function city() {
  3431. return this.areaList.city_list || {};
  3432. },
  3433. county: function county() {
  3434. return this.areaList.county_list || {};
  3435. },
  3436. displayColumns: function displayColumns() {
  3437. return this.columns.slice(0, +this.columnsNum);
  3438. },
  3439. placeholderMap: function placeholderMap() {
  3440. return {
  3441. province: this.columnsPlaceholder[0] || '',
  3442. city: this.columnsPlaceholder[1] || '',
  3443. county: this.columnsPlaceholder[2] || ''
  3444. };
  3445. }
  3446. },
  3447. watch: {
  3448. value: function value(val) {
  3449. this.code = val;
  3450. this.setValues();
  3451. },
  3452. areaList: {
  3453. deep: true,
  3454. handler: 'setValues'
  3455. },
  3456. columnsNum: function columnsNum() {
  3457. var _this = this;
  3458. this.$nextTick(function () {
  3459. _this.setValues();
  3460. });
  3461. }
  3462. },
  3463. mounted: function mounted() {
  3464. this.setValues();
  3465. },
  3466. methods: {
  3467. // get list by code
  3468. getList: function getList(type, code) {
  3469. var result = [];
  3470. if (type !== 'province' && !code) {
  3471. return result;
  3472. }
  3473. var list = this[type];
  3474. result = Object.keys(list).map(function (listCode) {
  3475. return {
  3476. code: listCode,
  3477. name: list[listCode]
  3478. };
  3479. });
  3480. if (code) {
  3481. // oversea code
  3482. if (this.isOverseaCode(code) && type === 'city') {
  3483. code = '9';
  3484. }
  3485. result = result.filter(function (item) {
  3486. return item.code.indexOf(code) === 0;
  3487. });
  3488. }
  3489. if (this.placeholderMap[type] && result.length) {
  3490. // set columns placeholder
  3491. var codeFill = '';
  3492. if (type === 'city') {
  3493. codeFill = PLACEHOLDER_CODE.slice(2, 4);
  3494. } else if (type === 'county') {
  3495. codeFill = PLACEHOLDER_CODE.slice(4, 6);
  3496. }
  3497. result.unshift({
  3498. code: "" + code + codeFill,
  3499. name: this.placeholderMap[type]
  3500. });
  3501. }
  3502. return result;
  3503. },
  3504. // get index by code
  3505. getIndex: function getIndex(type, code) {
  3506. var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
  3507. var list = this.getList(type, code.slice(0, compareNum - 2)); // oversea code
  3508. if (this.isOverseaCode(code) && type === 'province') {
  3509. compareNum = 1;
  3510. }
  3511. code = code.slice(0, compareNum);
  3512. for (var i = 0; i < list.length; i++) {
  3513. if (list[i].code.slice(0, compareNum) === code) {
  3514. return i;
  3515. }
  3516. }
  3517. return 0;
  3518. },
  3519. // parse output columns data
  3520. parseOutputValues: function parseOutputValues(values) {
  3521. var _this2 = this;
  3522. return values.map(function (value, index) {
  3523. // save undefined value
  3524. if (!value) return value;
  3525. value = JSON.parse(JSON.stringify(value));
  3526. if (!value.code || value.name === _this2.columnsPlaceholder[index]) {
  3527. value.code = '';
  3528. value.name = '';
  3529. }
  3530. return value;
  3531. });
  3532. },
  3533. onChange: function onChange(picker, values, index) {
  3534. this.code = values[index].code;
  3535. this.setValues();
  3536. var parsedValues = this.parseOutputValues(picker.getValues());
  3537. this.$emit('change', picker, parsedValues, index);
  3538. },
  3539. onConfirm: function onConfirm(values, index) {
  3540. values = this.parseOutputValues(values);
  3541. this.setValues();
  3542. this.$emit('confirm', values, index);
  3543. },
  3544. getDefaultCode: function getDefaultCode() {
  3545. if (this.columnsPlaceholder.length) {
  3546. return PLACEHOLDER_CODE;
  3547. }
  3548. var countyCodes = Object.keys(this.county);
  3549. if (countyCodes[0]) {
  3550. return countyCodes[0];
  3551. }
  3552. var cityCodes = Object.keys(this.city);
  3553. if (cityCodes[0]) {
  3554. return cityCodes[0];
  3555. }
  3556. return '';
  3557. },
  3558. setValues: function setValues() {
  3559. var code = this.code;
  3560. if (!code) {
  3561. code = this.getDefaultCode();
  3562. }
  3563. var picker = this.$refs.picker;
  3564. var province = this.getList('province');
  3565. var city = this.getList('city', code.slice(0, 2));
  3566. if (!picker) {
  3567. return;
  3568. }
  3569. picker.setColumnValues(0, province);
  3570. picker.setColumnValues(1, city);
  3571. if (city.length && code.slice(2, 4) === '00' && !this.isOverseaCode(code)) {
  3572. code = city[0].code;
  3573. }
  3574. picker.setColumnValues(2, this.getList('county', code.slice(0, 4)));
  3575. picker.setIndexes([this.getIndex('province', code), this.getIndex('city', code), this.getIndex('county', code)]);
  3576. },
  3577. getValues: function getValues() {
  3578. var picker = this.$refs.picker;
  3579. var getValues = picker ? picker.getValues().filter(function (value) {
  3580. return !!value;
  3581. }) : [];
  3582. getValues = this.parseOutputValues(getValues);
  3583. return getValues;
  3584. },
  3585. getArea: function getArea() {
  3586. var values = this.getValues();
  3587. var area = {
  3588. code: '',
  3589. country: '',
  3590. province: '',
  3591. city: '',
  3592. county: ''
  3593. };
  3594. if (!values.length) {
  3595. return area;
  3596. }
  3597. var names = values.map(function (item) {
  3598. return item.name;
  3599. });
  3600. var validValues = values.filter(function (value) {
  3601. return !!value.code;
  3602. });
  3603. area.code = validValues.length ? validValues[validValues.length - 1].code : '';
  3604. if (this.isOverseaCode(area.code)) {
  3605. area.country = names[1] || '';
  3606. area.province = names[2] || '';
  3607. } else {
  3608. area.province = names[0] || '';
  3609. area.city = names[1] || '';
  3610. area.county = names[2] || '';
  3611. }
  3612. return area;
  3613. },
  3614. // @exposed-api
  3615. reset: function reset(code) {
  3616. this.code = code || '';
  3617. this.setValues();
  3618. }
  3619. },
  3620. render: function render() {
  3621. var h = arguments[0];
  3622. var on = _extends({}, this.$listeners, {
  3623. change: this.onChange,
  3624. confirm: this.onConfirm
  3625. });
  3626. return h(es_picker, {
  3627. "ref": "picker",
  3628. "class": area_bem(),
  3629. "attrs": {
  3630. "showToolbar": true,
  3631. "valueKey": "name",
  3632. "title": this.title,
  3633. "columns": this.displayColumns,
  3634. "loading": this.loading,
  3635. "readonly": this.readonly,
  3636. "itemHeight": this.itemHeight,
  3637. "swipeDuration": this.swipeDuration,
  3638. "visibleItemCount": this.visibleItemCount,
  3639. "cancelButtonText": this.cancelButtonText,
  3640. "confirmButtonText": this.confirmButtonText
  3641. },
  3642. "scopedSlots": pickSlots(this, ['title', 'columns-top', 'columns-bottom']),
  3643. "on": _extends({}, on)
  3644. });
  3645. }
  3646. }));
  3647. // CONCATENATED MODULE: ./es/utils/router.js
  3648. /**
  3649. * Vue Router support
  3650. */
  3651. function isRedundantNavigation(err) {
  3652. return err.name === 'NavigationDuplicated' || // compatible with vue-router@3.3
  3653. err.message && err.message.indexOf('redundant navigation') !== -1;
  3654. }
  3655. function route(router, config) {
  3656. var to = config.to,
  3657. url = config.url,
  3658. replace = config.replace;
  3659. if (to && router) {
  3660. var promise = router[replace ? 'replace' : 'push'](to);
  3661. /* istanbul ignore else */
  3662. if (promise && promise.catch) {
  3663. promise.catch(function (err) {
  3664. if (err && !isRedundantNavigation(err)) {
  3665. throw err;
  3666. }
  3667. });
  3668. }
  3669. } else if (url) {
  3670. replace ? location.replace(url) : location.href = url;
  3671. }
  3672. }
  3673. function functionalRoute(context) {
  3674. route(context.parent && context.parent.$router, context.props);
  3675. }
  3676. var routeProps = {
  3677. url: String,
  3678. replace: Boolean,
  3679. to: [String, Object]
  3680. };
  3681. // CONCATENATED MODULE: ./es/cell/shared.js
  3682. var cellProps = {
  3683. icon: String,
  3684. size: String,
  3685. center: Boolean,
  3686. isLink: Boolean,
  3687. required: Boolean,
  3688. iconPrefix: String,
  3689. titleStyle: null,
  3690. titleClass: null,
  3691. valueClass: null,
  3692. labelClass: null,
  3693. title: [Number, String],
  3694. value: [Number, String],
  3695. label: [Number, String],
  3696. arrowDirection: String,
  3697. border: {
  3698. type: Boolean,
  3699. default: true
  3700. },
  3701. clickable: {
  3702. type: Boolean,
  3703. default: null
  3704. }
  3705. };
  3706. // CONCATENATED MODULE: ./es/cell/index.js
  3707. // Utils
  3708. // Components
  3709. // Types
  3710. var cell_createNamespace = Object(create["a" /* createNamespace */])('cell'),
  3711. cell_createComponent = cell_createNamespace[0],
  3712. cell_bem = cell_createNamespace[1];
  3713. function Cell(h, props, slots, ctx) {
  3714. var _props$clickable;
  3715. var icon = props.icon,
  3716. size = props.size,
  3717. title = props.title,
  3718. label = props.label,
  3719. value = props.value,
  3720. isLink = props.isLink;
  3721. var showTitle = slots.title || Object(utils["c" /* isDef */])(title);
  3722. function Label() {
  3723. var showLabel = slots.label || Object(utils["c" /* isDef */])(label);
  3724. if (showLabel) {
  3725. return h("div", {
  3726. "class": [cell_bem('label'), props.labelClass]
  3727. }, [slots.label ? slots.label() : label]);
  3728. }
  3729. }
  3730. function Title() {
  3731. if (showTitle) {
  3732. return h("div", {
  3733. "class": [cell_bem('title'), props.titleClass],
  3734. "style": props.titleStyle
  3735. }, [slots.title ? slots.title() : h("span", [title]), Label()]);
  3736. }
  3737. }
  3738. function Value() {
  3739. var showValue = slots.default || Object(utils["c" /* isDef */])(value);
  3740. if (showValue) {
  3741. return h("div", {
  3742. "class": [cell_bem('value', {
  3743. alone: !showTitle
  3744. }), props.valueClass]
  3745. }, [slots.default ? slots.default() : h("span", [value])]);
  3746. }
  3747. }
  3748. function LeftIcon() {
  3749. if (slots.icon) {
  3750. return slots.icon();
  3751. }
  3752. if (icon) {
  3753. return h(es_icon, {
  3754. "class": cell_bem('left-icon'),
  3755. "attrs": {
  3756. "name": icon,
  3757. "classPrefix": props.iconPrefix
  3758. }
  3759. });
  3760. }
  3761. }
  3762. function RightIcon() {
  3763. var rightIconSlot = slots['right-icon'];
  3764. if (rightIconSlot) {
  3765. return rightIconSlot();
  3766. }
  3767. if (isLink) {
  3768. var arrowDirection = props.arrowDirection;
  3769. return h(es_icon, {
  3770. "class": cell_bem('right-icon'),
  3771. "attrs": {
  3772. "name": arrowDirection ? "arrow-" + arrowDirection : 'arrow'
  3773. }
  3774. });
  3775. }
  3776. }
  3777. function onClick(event) {
  3778. functional_emit(ctx, 'click', event);
  3779. functionalRoute(ctx);
  3780. }
  3781. var clickable = (_props$clickable = props.clickable) != null ? _props$clickable : isLink;
  3782. var classes = {
  3783. clickable: clickable,
  3784. center: props.center,
  3785. required: props.required,
  3786. borderless: !props.border
  3787. };
  3788. if (size) {
  3789. classes[size] = size;
  3790. }
  3791. return h("div", helper_default()([{
  3792. "class": cell_bem(classes),
  3793. "attrs": {
  3794. "role": clickable ? 'button' : null,
  3795. "tabindex": clickable ? 0 : null
  3796. },
  3797. "on": {
  3798. "click": onClick
  3799. }
  3800. }, inherit(ctx)]), [LeftIcon(), Title(), Value(), RightIcon(), slots.extra == null ? void 0 : slots.extra()]);
  3801. }
  3802. Cell.props = _extends({}, cellProps, routeProps);
  3803. /* harmony default export */ var cell = (cell_createComponent(Cell));
  3804. // CONCATENATED MODULE: ./es/utils/validate/system.js
  3805. function isAndroid() {
  3806. /* istanbul ignore next */
  3807. return utils["h" /* isServer */] ? false : /android/.test(navigator.userAgent.toLowerCase());
  3808. }
  3809. function isIOS() {
  3810. /* istanbul ignore next */
  3811. return utils["h" /* isServer */] ? false : /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase());
  3812. }
  3813. // CONCATENATED MODULE: ./es/utils/dom/reset-scroll.js
  3814. /**
  3815. * Hack for iOS12 page scroll
  3816. * https://developers.weixin.qq.com/community/develop/doc/00044ae90742f8c82fb78fcae56800
  3817. */
  3818. var reset_scroll_isIOS = isIOS();
  3819. /* istanbul ignore next */
  3820. function resetScroll() {
  3821. if (reset_scroll_isIOS) {
  3822. setRootScrollTop(getRootScrollTop());
  3823. }
  3824. }
  3825. // CONCATENATED MODULE: ./es/field/index.js
  3826. // Utils
  3827. // Components
  3828. var field_createNamespace = Object(create["a" /* createNamespace */])('field'),
  3829. field_createComponent = field_createNamespace[0],
  3830. field_bem = field_createNamespace[1];
  3831. /* harmony default export */ var es_field = (field_createComponent({
  3832. inheritAttrs: false,
  3833. provide: function provide() {
  3834. return {
  3835. vanField: this
  3836. };
  3837. },
  3838. inject: {
  3839. vanForm: {
  3840. default: null
  3841. }
  3842. },
  3843. props: _extends({}, cellProps, {
  3844. name: String,
  3845. rules: Array,
  3846. disabled: {
  3847. type: Boolean,
  3848. default: null
  3849. },
  3850. readonly: {
  3851. type: Boolean,
  3852. default: null
  3853. },
  3854. autosize: [Boolean, Object],
  3855. leftIcon: String,
  3856. rightIcon: String,
  3857. clearable: Boolean,
  3858. formatter: Function,
  3859. maxlength: [Number, String],
  3860. labelWidth: [Number, String],
  3861. labelClass: null,
  3862. labelAlign: String,
  3863. inputAlign: String,
  3864. placeholder: String,
  3865. errorMessage: String,
  3866. errorMessageAlign: String,
  3867. showWordLimit: Boolean,
  3868. value: {
  3869. type: [Number, String],
  3870. default: ''
  3871. },
  3872. type: {
  3873. type: String,
  3874. default: 'text'
  3875. },
  3876. error: {
  3877. type: Boolean,
  3878. default: null
  3879. },
  3880. colon: {
  3881. type: Boolean,
  3882. default: null
  3883. },
  3884. clearTrigger: {
  3885. type: String,
  3886. default: 'focus'
  3887. },
  3888. formatTrigger: {
  3889. type: String,
  3890. default: 'onChange'
  3891. }
  3892. }),
  3893. data: function data() {
  3894. return {
  3895. focused: false,
  3896. validateFailed: false,
  3897. validateMessage: ''
  3898. };
  3899. },
  3900. watch: {
  3901. value: function value() {
  3902. this.updateValue(this.value);
  3903. this.resetValidation();
  3904. this.validateWithTrigger('onChange');
  3905. this.$nextTick(this.adjustSize);
  3906. }
  3907. },
  3908. mounted: function mounted() {
  3909. this.updateValue(this.value, this.formatTrigger);
  3910. this.$nextTick(this.adjustSize);
  3911. if (this.vanForm) {
  3912. this.vanForm.addField(this);
  3913. }
  3914. },
  3915. beforeDestroy: function beforeDestroy() {
  3916. if (this.vanForm) {
  3917. this.vanForm.removeField(this);
  3918. }
  3919. },
  3920. computed: {
  3921. showClear: function showClear() {
  3922. var readonly = this.getProp('readonly');
  3923. if (this.clearable && !readonly) {
  3924. var hasValue = Object(utils["c" /* isDef */])(this.value) && this.value !== '';
  3925. var trigger = this.clearTrigger === 'always' || this.clearTrigger === 'focus' && this.focused;
  3926. return hasValue && trigger;
  3927. }
  3928. },
  3929. showError: function showError() {
  3930. if (this.error !== null) {
  3931. return this.error;
  3932. }
  3933. if (this.vanForm && this.vanForm.showError && this.validateFailed) {
  3934. return true;
  3935. }
  3936. },
  3937. listeners: function listeners() {
  3938. return _extends({}, this.$listeners, {
  3939. blur: this.onBlur,
  3940. focus: this.onFocus,
  3941. input: this.onInput,
  3942. click: this.onClickInput,
  3943. keypress: this.onKeypress
  3944. });
  3945. },
  3946. labelStyle: function labelStyle() {
  3947. var labelWidth = this.getProp('labelWidth');
  3948. if (labelWidth) {
  3949. return {
  3950. width: Object(unit["a" /* addUnit */])(labelWidth)
  3951. };
  3952. }
  3953. },
  3954. formValue: function formValue() {
  3955. if (this.children && (this.$scopedSlots.input || this.$slots.input)) {
  3956. return this.children.value;
  3957. }
  3958. return this.value;
  3959. }
  3960. },
  3961. methods: {
  3962. // @exposed-api
  3963. focus: function focus() {
  3964. if (this.$refs.input) {
  3965. this.$refs.input.focus();
  3966. }
  3967. },
  3968. // @exposed-api
  3969. blur: function blur() {
  3970. if (this.$refs.input) {
  3971. this.$refs.input.blur();
  3972. }
  3973. },
  3974. runValidator: function runValidator(value, rule) {
  3975. return new Promise(function (resolve) {
  3976. var returnVal = rule.validator(value, rule);
  3977. if (Object(utils["g" /* isPromise */])(returnVal)) {
  3978. return returnVal.then(resolve);
  3979. }
  3980. resolve(returnVal);
  3981. });
  3982. },
  3983. isEmptyValue: function isEmptyValue(value) {
  3984. if (Array.isArray(value)) {
  3985. return !value.length;
  3986. }
  3987. if (value === 0) {
  3988. return false;
  3989. }
  3990. return !value;
  3991. },
  3992. runSyncRule: function runSyncRule(value, rule) {
  3993. if (rule.required && this.isEmptyValue(value)) {
  3994. return false;
  3995. }
  3996. if (rule.pattern && !rule.pattern.test(value)) {
  3997. return false;
  3998. }
  3999. return true;
  4000. },
  4001. getRuleMessage: function getRuleMessage(value, rule) {
  4002. var message = rule.message;
  4003. if (Object(utils["e" /* isFunction */])(message)) {
  4004. return message(value, rule);
  4005. }
  4006. return message;
  4007. },
  4008. runRules: function runRules(rules) {
  4009. var _this = this;
  4010. return rules.reduce(function (promise, rule) {
  4011. return promise.then(function () {
  4012. if (_this.validateFailed) {
  4013. return;
  4014. }
  4015. var value = _this.formValue;
  4016. if (rule.formatter) {
  4017. value = rule.formatter(value, rule);
  4018. }
  4019. if (!_this.runSyncRule(value, rule)) {
  4020. _this.validateFailed = true;
  4021. _this.validateMessage = _this.getRuleMessage(value, rule);
  4022. return;
  4023. }
  4024. if (rule.validator) {
  4025. return _this.runValidator(value, rule).then(function (result) {
  4026. if (result === false) {
  4027. _this.validateFailed = true;
  4028. _this.validateMessage = _this.getRuleMessage(value, rule);
  4029. }
  4030. });
  4031. }
  4032. });
  4033. }, Promise.resolve());
  4034. },
  4035. validate: function validate(rules) {
  4036. var _this2 = this;
  4037. if (rules === void 0) {
  4038. rules = this.rules;
  4039. }
  4040. return new Promise(function (resolve) {
  4041. if (!rules) {
  4042. resolve();
  4043. }
  4044. _this2.resetValidation();
  4045. _this2.runRules(rules).then(function () {
  4046. if (_this2.validateFailed) {
  4047. resolve({
  4048. name: _this2.name,
  4049. message: _this2.validateMessage
  4050. });
  4051. } else {
  4052. resolve();
  4053. }
  4054. });
  4055. });
  4056. },
  4057. validateWithTrigger: function validateWithTrigger(trigger) {
  4058. if (this.vanForm && this.rules) {
  4059. var defaultTrigger = this.vanForm.validateTrigger === trigger;
  4060. var rules = this.rules.filter(function (rule) {
  4061. if (rule.trigger) {
  4062. return rule.trigger === trigger;
  4063. }
  4064. return defaultTrigger;
  4065. });
  4066. if (rules.length) {
  4067. this.validate(rules);
  4068. }
  4069. }
  4070. },
  4071. resetValidation: function resetValidation() {
  4072. if (this.validateFailed) {
  4073. this.validateFailed = false;
  4074. this.validateMessage = '';
  4075. }
  4076. },
  4077. updateValue: function updateValue(value, trigger) {
  4078. if (trigger === void 0) {
  4079. trigger = 'onChange';
  4080. }
  4081. value = Object(utils["c" /* isDef */])(value) ? String(value) : ''; // native maxlength have incorrect line-break counting
  4082. // see: https://github.com/vant-ui/vant/issues/5033
  4083. var maxlength = this.maxlength;
  4084. if (Object(utils["c" /* isDef */])(maxlength) && value.length > maxlength) {
  4085. if (this.value && this.value.length === +maxlength) {
  4086. value = this.value;
  4087. } else {
  4088. value = value.slice(0, maxlength);
  4089. }
  4090. }
  4091. if (this.type === 'number' || this.type === 'digit') {
  4092. var isNumber = this.type === 'number';
  4093. value = number_formatNumber(value, isNumber, isNumber);
  4094. }
  4095. if (this.formatter && trigger === this.formatTrigger) {
  4096. value = this.formatter(value);
  4097. }
  4098. var input = this.$refs.input;
  4099. if (input && value !== input.value) {
  4100. input.value = value;
  4101. }
  4102. if (value !== this.value) {
  4103. this.$emit('input', value);
  4104. }
  4105. },
  4106. onInput: function onInput(event) {
  4107. // not update v-model when composing
  4108. if (event.target.composing) {
  4109. return;
  4110. }
  4111. this.updateValue(event.target.value);
  4112. },
  4113. onFocus: function onFocus(event) {
  4114. this.focused = true;
  4115. this.$emit('focus', event); // https://github.com/vant-ui/vant/issues/9715
  4116. this.$nextTick(this.adjustSize); // readonly not work in legacy mobile safari
  4117. /* istanbul ignore if */
  4118. if (this.getProp('readonly')) {
  4119. this.blur();
  4120. }
  4121. },
  4122. onBlur: function onBlur(event) {
  4123. if (this.getProp('readonly')) {
  4124. return;
  4125. }
  4126. this.focused = false;
  4127. this.updateValue(this.value, 'onBlur');
  4128. this.$emit('blur', event);
  4129. this.validateWithTrigger('onBlur');
  4130. this.$nextTick(this.adjustSize);
  4131. resetScroll();
  4132. },
  4133. onClick: function onClick(event) {
  4134. this.$emit('click', event);
  4135. },
  4136. onClickInput: function onClickInput(event) {
  4137. this.$emit('click-input', event);
  4138. },
  4139. onClickLeftIcon: function onClickLeftIcon(event) {
  4140. this.$emit('click-left-icon', event);
  4141. },
  4142. onClickRightIcon: function onClickRightIcon(event) {
  4143. this.$emit('click-right-icon', event);
  4144. },
  4145. onClear: function onClear(event) {
  4146. preventDefault(event);
  4147. this.$emit('input', '');
  4148. this.$emit('clear', event);
  4149. },
  4150. onKeypress: function onKeypress(event) {
  4151. var ENTER_CODE = 13;
  4152. if (event.keyCode === ENTER_CODE) {
  4153. var submitOnEnter = this.getProp('submitOnEnter');
  4154. if (!submitOnEnter && this.type !== 'textarea') {
  4155. preventDefault(event);
  4156. } // trigger blur after click keyboard search button
  4157. if (this.type === 'search') {
  4158. this.blur();
  4159. }
  4160. }
  4161. this.$emit('keypress', event);
  4162. },
  4163. adjustSize: function adjustSize() {
  4164. var input = this.$refs.input;
  4165. if (!(this.type === 'textarea' && this.autosize) || !input) {
  4166. return;
  4167. }
  4168. var scrollTop = getRootScrollTop();
  4169. input.style.height = 'auto';
  4170. var height = input.scrollHeight;
  4171. if (Object(utils["f" /* isObject */])(this.autosize)) {
  4172. var _this$autosize = this.autosize,
  4173. maxHeight = _this$autosize.maxHeight,
  4174. minHeight = _this$autosize.minHeight;
  4175. if (maxHeight) {
  4176. height = Math.min(height, maxHeight);
  4177. }
  4178. if (minHeight) {
  4179. height = Math.max(height, minHeight);
  4180. }
  4181. }
  4182. if (height) {
  4183. input.style.height = height + 'px'; // https://github.com/vant-ui/vant/issues/9178
  4184. setRootScrollTop(scrollTop);
  4185. }
  4186. },
  4187. genInput: function genInput() {
  4188. var h = this.$createElement;
  4189. var type = this.type;
  4190. var disabled = this.getProp('disabled');
  4191. var readonly = this.getProp('readonly');
  4192. var inputSlot = this.slots('input');
  4193. var inputAlign = this.getProp('inputAlign');
  4194. if (inputSlot) {
  4195. return h("div", {
  4196. "class": field_bem('control', [inputAlign, 'custom']),
  4197. "on": {
  4198. "click": this.onClickInput
  4199. }
  4200. }, [inputSlot]);
  4201. }
  4202. var inputProps = {
  4203. ref: 'input',
  4204. class: field_bem('control', inputAlign),
  4205. domProps: {
  4206. value: this.value
  4207. },
  4208. attrs: _extends({}, this.$attrs, {
  4209. name: this.name,
  4210. disabled: disabled,
  4211. readonly: readonly,
  4212. placeholder: this.placeholder
  4213. }),
  4214. on: this.listeners,
  4215. // add model directive to skip IME composition
  4216. directives: [{
  4217. name: 'model',
  4218. value: this.value
  4219. }]
  4220. };
  4221. if (type === 'textarea') {
  4222. return h("textarea", helper_default()([{}, inputProps]));
  4223. }
  4224. var inputType = type;
  4225. var inputMode; // type="number" is weird in iOS, and can't prevent dot in Android
  4226. // so use inputmode to set keyboard in modern browsers
  4227. if (type === 'number') {
  4228. inputType = 'text';
  4229. inputMode = 'decimal';
  4230. }
  4231. if (type === 'digit') {
  4232. inputType = 'tel';
  4233. inputMode = 'numeric';
  4234. }
  4235. return h("input", helper_default()([{
  4236. "attrs": {
  4237. "type": inputType,
  4238. "inputmode": inputMode
  4239. }
  4240. }, inputProps]));
  4241. },
  4242. genLeftIcon: function genLeftIcon() {
  4243. var h = this.$createElement;
  4244. var showLeftIcon = this.slots('left-icon') || this.leftIcon;
  4245. if (showLeftIcon) {
  4246. return h("div", {
  4247. "class": field_bem('left-icon'),
  4248. "on": {
  4249. "click": this.onClickLeftIcon
  4250. }
  4251. }, [this.slots('left-icon') || h(es_icon, {
  4252. "attrs": {
  4253. "name": this.leftIcon,
  4254. "classPrefix": this.iconPrefix
  4255. }
  4256. })]);
  4257. }
  4258. },
  4259. genRightIcon: function genRightIcon() {
  4260. var h = this.$createElement;
  4261. var slots = this.slots;
  4262. var showRightIcon = slots('right-icon') || this.rightIcon;
  4263. if (showRightIcon) {
  4264. return h("div", {
  4265. "class": field_bem('right-icon'),
  4266. "on": {
  4267. "click": this.onClickRightIcon
  4268. }
  4269. }, [slots('right-icon') || h(es_icon, {
  4270. "attrs": {
  4271. "name": this.rightIcon,
  4272. "classPrefix": this.iconPrefix
  4273. }
  4274. })]);
  4275. }
  4276. },
  4277. genWordLimit: function genWordLimit() {
  4278. var h = this.$createElement;
  4279. if (this.showWordLimit && this.maxlength) {
  4280. var count = (this.value || '').length;
  4281. return h("div", {
  4282. "class": field_bem('word-limit')
  4283. }, [h("span", {
  4284. "class": field_bem('word-num')
  4285. }, [count]), "/", this.maxlength]);
  4286. }
  4287. },
  4288. genMessage: function genMessage() {
  4289. var h = this.$createElement;
  4290. if (this.vanForm && this.vanForm.showErrorMessage === false) {
  4291. return;
  4292. }
  4293. var message = this.errorMessage || this.validateMessage;
  4294. if (message) {
  4295. var errorMessageAlign = this.getProp('errorMessageAlign');
  4296. return h("div", {
  4297. "class": field_bem('error-message', errorMessageAlign)
  4298. }, [message]);
  4299. }
  4300. },
  4301. getProp: function getProp(key) {
  4302. if (Object(utils["c" /* isDef */])(this[key])) {
  4303. return this[key];
  4304. }
  4305. if (this.vanForm && Object(utils["c" /* isDef */])(this.vanForm[key])) {
  4306. return this.vanForm[key];
  4307. }
  4308. },
  4309. genLabel: function genLabel() {
  4310. var h = this.$createElement;
  4311. var colon = this.getProp('colon') ? ':' : '';
  4312. if (this.slots('label')) {
  4313. return [this.slots('label'), colon];
  4314. }
  4315. if (this.label) {
  4316. return h("span", [this.label + colon]);
  4317. }
  4318. }
  4319. },
  4320. render: function render() {
  4321. var _bem;
  4322. var h = arguments[0];
  4323. var slots = this.slots;
  4324. var disabled = this.getProp('disabled');
  4325. var labelAlign = this.getProp('labelAlign');
  4326. var scopedSlots = {
  4327. icon: this.genLeftIcon
  4328. };
  4329. var Label = this.genLabel();
  4330. if (Label) {
  4331. scopedSlots.title = function () {
  4332. return Label;
  4333. };
  4334. }
  4335. var extra = this.slots('extra');
  4336. if (extra) {
  4337. scopedSlots.extra = function () {
  4338. return extra;
  4339. };
  4340. }
  4341. return h(cell, {
  4342. "attrs": {
  4343. "icon": this.leftIcon,
  4344. "size": this.size,
  4345. "center": this.center,
  4346. "border": this.border,
  4347. "isLink": this.isLink,
  4348. "required": this.required,
  4349. "clickable": this.clickable,
  4350. "titleStyle": this.labelStyle,
  4351. "valueClass": field_bem('value'),
  4352. "titleClass": [field_bem('label', labelAlign), this.labelClass],
  4353. "arrowDirection": this.arrowDirection
  4354. },
  4355. "scopedSlots": scopedSlots,
  4356. "class": field_bem((_bem = {
  4357. error: this.showError,
  4358. disabled: disabled
  4359. }, _bem["label-" + labelAlign] = labelAlign, _bem['min-height'] = this.type === 'textarea' && !this.autosize, _bem)),
  4360. "on": {
  4361. "click": this.onClick
  4362. }
  4363. }, [h("div", {
  4364. "class": field_bem('body')
  4365. }, [this.genInput(), this.showClear && h(es_icon, {
  4366. "attrs": {
  4367. "name": "clear"
  4368. },
  4369. "class": field_bem('clear'),
  4370. "on": {
  4371. "touchstart": this.onClear
  4372. }
  4373. }), this.genRightIcon(), slots('button') && h("div", {
  4374. "class": field_bem('button')
  4375. }, [slots('button')])]), this.genWordLimit(), this.genMessage()]);
  4376. }
  4377. }));
  4378. // CONCATENATED MODULE: ./es/toast/lock-click.js
  4379. var lockCount = 0;
  4380. function lockClick(lock) {
  4381. if (lock) {
  4382. if (!lockCount) {
  4383. document.body.classList.add('van-toast--unclickable');
  4384. }
  4385. lockCount++;
  4386. } else {
  4387. lockCount--;
  4388. if (!lockCount) {
  4389. document.body.classList.remove('van-toast--unclickable');
  4390. }
  4391. }
  4392. }
  4393. // CONCATENATED MODULE: ./es/toast/Toast.js
  4394. // Utils
  4395. // Mixins
  4396. // Components
  4397. var Toast_createNamespace = Object(create["a" /* createNamespace */])('toast'),
  4398. Toast_createComponent = Toast_createNamespace[0],
  4399. Toast_bem = Toast_createNamespace[1];
  4400. /* harmony default export */ var Toast = (Toast_createComponent({
  4401. mixins: [PopupMixin()],
  4402. props: {
  4403. icon: String,
  4404. className: null,
  4405. iconPrefix: String,
  4406. loadingType: String,
  4407. forbidClick: Boolean,
  4408. closeOnClick: Boolean,
  4409. message: [Number, String],
  4410. type: {
  4411. type: String,
  4412. default: 'text'
  4413. },
  4414. position: {
  4415. type: String,
  4416. default: 'middle'
  4417. },
  4418. transition: {
  4419. type: String,
  4420. default: 'van-fade'
  4421. },
  4422. lockScroll: {
  4423. type: Boolean,
  4424. default: false
  4425. }
  4426. },
  4427. data: function data() {
  4428. return {
  4429. clickable: false
  4430. };
  4431. },
  4432. mounted: function mounted() {
  4433. this.toggleClickable();
  4434. },
  4435. destroyed: function destroyed() {
  4436. this.toggleClickable();
  4437. },
  4438. watch: {
  4439. value: 'toggleClickable',
  4440. forbidClick: 'toggleClickable'
  4441. },
  4442. methods: {
  4443. onClick: function onClick() {
  4444. if (this.closeOnClick) {
  4445. this.close();
  4446. }
  4447. },
  4448. toggleClickable: function toggleClickable() {
  4449. var clickable = this.value && this.forbidClick;
  4450. if (this.clickable !== clickable) {
  4451. this.clickable = clickable;
  4452. lockClick(clickable);
  4453. }
  4454. },
  4455. /* istanbul ignore next */
  4456. onAfterEnter: function onAfterEnter() {
  4457. this.$emit('opened');
  4458. if (this.onOpened) {
  4459. this.onOpened();
  4460. }
  4461. },
  4462. onAfterLeave: function onAfterLeave() {
  4463. this.$emit('closed');
  4464. },
  4465. genIcon: function genIcon() {
  4466. var h = this.$createElement;
  4467. var icon = this.icon,
  4468. type = this.type,
  4469. iconPrefix = this.iconPrefix,
  4470. loadingType = this.loadingType;
  4471. var hasIcon = icon || type === 'success' || type === 'fail';
  4472. if (hasIcon) {
  4473. return h(es_icon, {
  4474. "class": Toast_bem('icon'),
  4475. "attrs": {
  4476. "classPrefix": iconPrefix,
  4477. "name": icon || type
  4478. }
  4479. });
  4480. }
  4481. if (type === 'loading') {
  4482. return h(es_loading, {
  4483. "class": Toast_bem('loading'),
  4484. "attrs": {
  4485. "type": loadingType
  4486. }
  4487. });
  4488. }
  4489. },
  4490. genMessage: function genMessage() {
  4491. var h = this.$createElement;
  4492. var type = this.type,
  4493. message = this.message;
  4494. if (!Object(utils["c" /* isDef */])(message) || message === '') {
  4495. return;
  4496. }
  4497. if (type === 'html') {
  4498. return h("div", {
  4499. "class": Toast_bem('text'),
  4500. "domProps": {
  4501. "innerHTML": message
  4502. }
  4503. });
  4504. }
  4505. return h("div", {
  4506. "class": Toast_bem('text')
  4507. }, [message]);
  4508. }
  4509. },
  4510. render: function render() {
  4511. var _ref;
  4512. var h = arguments[0];
  4513. return h("transition", {
  4514. "attrs": {
  4515. "name": this.transition
  4516. },
  4517. "on": {
  4518. "afterEnter": this.onAfterEnter,
  4519. "afterLeave": this.onAfterLeave
  4520. }
  4521. }, [h("div", {
  4522. "directives": [{
  4523. name: "show",
  4524. value: this.value
  4525. }],
  4526. "class": [Toast_bem([this.position, (_ref = {}, _ref[this.type] = !this.icon, _ref)]), this.className],
  4527. "on": {
  4528. "click": this.onClick
  4529. }
  4530. }, [this.genIcon(), this.genMessage()])]);
  4531. }
  4532. }));
  4533. // CONCATENATED MODULE: ./es/toast/index.js
  4534. var toast_defaultOptions = {
  4535. icon: '',
  4536. type: 'text',
  4537. // @deprecated
  4538. mask: false,
  4539. value: true,
  4540. message: '',
  4541. className: '',
  4542. overlay: false,
  4543. onClose: null,
  4544. onOpened: null,
  4545. duration: 2000,
  4546. iconPrefix: undefined,
  4547. position: 'middle',
  4548. transition: 'van-fade',
  4549. forbidClick: false,
  4550. loadingType: undefined,
  4551. getContainer: 'body',
  4552. overlayStyle: null,
  4553. closeOnClick: false,
  4554. closeOnClickOverlay: false
  4555. }; // default options of specific type
  4556. var defaultOptionsMap = {};
  4557. var queue = [];
  4558. var toast_multiple = false;
  4559. var currentOptions = _extends({}, toast_defaultOptions);
  4560. function parseOptions(message) {
  4561. if (Object(utils["f" /* isObject */])(message)) {
  4562. return message;
  4563. }
  4564. return {
  4565. message: message
  4566. };
  4567. }
  4568. function isInDocument(element) {
  4569. return document.body.contains(element);
  4570. }
  4571. function createInstance() {
  4572. /* istanbul ignore if */
  4573. if (utils["h" /* isServer */]) {
  4574. return {};
  4575. }
  4576. queue = queue.filter(function (item) {
  4577. return !item.$el.parentNode || isInDocument(item.$el);
  4578. });
  4579. if (!queue.length || toast_multiple) {
  4580. var toast = new (external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.extend(Toast))({
  4581. el: document.createElement('div')
  4582. });
  4583. toast.$on('input', function (value) {
  4584. toast.value = value;
  4585. });
  4586. queue.push(toast);
  4587. }
  4588. return queue[queue.length - 1];
  4589. } // transform toast options to popup props
  4590. function transformOptions(options) {
  4591. return _extends({}, options, {
  4592. overlay: options.mask || options.overlay,
  4593. mask: undefined,
  4594. duration: undefined
  4595. });
  4596. }
  4597. function toast_Toast(options) {
  4598. if (options === void 0) {
  4599. options = {};
  4600. }
  4601. var toast = createInstance(); // should add z-index if previous toast has not disappeared
  4602. if (toast.value) {
  4603. toast.updateZIndex();
  4604. }
  4605. options = parseOptions(options);
  4606. options = _extends({}, currentOptions, defaultOptionsMap[options.type || currentOptions.type], options);
  4607. if (false) {}
  4608. options.clear = function () {
  4609. toast.value = false;
  4610. if (options.onClose) {
  4611. options.onClose();
  4612. options.onClose = null;
  4613. }
  4614. if (toast_multiple && !utils["h" /* isServer */]) {
  4615. toast.$on('closed', function () {
  4616. clearTimeout(toast.timer);
  4617. queue = queue.filter(function (item) {
  4618. return item !== toast;
  4619. });
  4620. removeNode(toast.$el);
  4621. toast.$destroy();
  4622. });
  4623. }
  4624. };
  4625. _extends(toast, transformOptions(options));
  4626. clearTimeout(toast.timer);
  4627. if (options.duration > 0) {
  4628. toast.timer = setTimeout(function () {
  4629. toast.clear();
  4630. }, options.duration);
  4631. }
  4632. return toast;
  4633. }
  4634. var toast_createMethod = function createMethod(type) {
  4635. return function (options) {
  4636. return toast_Toast(_extends({
  4637. type: type
  4638. }, parseOptions(options)));
  4639. };
  4640. };
  4641. ['loading', 'success', 'fail'].forEach(function (method) {
  4642. toast_Toast[method] = toast_createMethod(method);
  4643. });
  4644. toast_Toast.clear = function (all) {
  4645. if (queue.length) {
  4646. if (all) {
  4647. queue.forEach(function (toast) {
  4648. toast.clear();
  4649. });
  4650. queue = [];
  4651. } else if (!toast_multiple) {
  4652. queue[0].clear();
  4653. } else {
  4654. queue.shift().clear();
  4655. }
  4656. }
  4657. };
  4658. toast_Toast.setDefaultOptions = function (type, options) {
  4659. if (typeof type === 'string') {
  4660. defaultOptionsMap[type] = options;
  4661. } else {
  4662. _extends(currentOptions, type);
  4663. }
  4664. };
  4665. toast_Toast.resetDefaultOptions = function (type) {
  4666. if (typeof type === 'string') {
  4667. defaultOptionsMap[type] = null;
  4668. } else {
  4669. currentOptions = _extends({}, toast_defaultOptions);
  4670. defaultOptionsMap = {};
  4671. }
  4672. };
  4673. toast_Toast.allowMultiple = function (value) {
  4674. if (value === void 0) {
  4675. value = true;
  4676. }
  4677. toast_multiple = value;
  4678. };
  4679. toast_Toast.install = function () {
  4680. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.use(Toast);
  4681. };
  4682. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$toast = toast_Toast;
  4683. /* harmony default export */ var es_toast = (toast_Toast);
  4684. // CONCATENATED MODULE: ./es/button/index.js
  4685. // Utils
  4686. // Components
  4687. // Types
  4688. var button_createNamespace = Object(create["a" /* createNamespace */])('button'),
  4689. button_createComponent = button_createNamespace[0],
  4690. button_bem = button_createNamespace[1];
  4691. function Button(h, props, slots, ctx) {
  4692. var _ref;
  4693. var tag = props.tag,
  4694. icon = props.icon,
  4695. type = props.type,
  4696. color = props.color,
  4697. plain = props.plain,
  4698. disabled = props.disabled,
  4699. loading = props.loading,
  4700. hairline = props.hairline,
  4701. loadingText = props.loadingText,
  4702. iconPosition = props.iconPosition;
  4703. var style = {};
  4704. if (color) {
  4705. style.color = plain ? color : 'white';
  4706. if (!plain) {
  4707. // Use background instead of backgroundColor to make linear-gradient work
  4708. style.background = color;
  4709. } // hide border when color is linear-gradient
  4710. if (color.indexOf('gradient') !== -1) {
  4711. style.border = 0;
  4712. } else {
  4713. style.borderColor = color;
  4714. }
  4715. }
  4716. function onClick(event) {
  4717. if (props.loading) {
  4718. event.preventDefault();
  4719. }
  4720. if (!loading && !disabled) {
  4721. functional_emit(ctx, 'click', event);
  4722. functionalRoute(ctx);
  4723. }
  4724. }
  4725. function onTouchstart(event) {
  4726. functional_emit(ctx, 'touchstart', event);
  4727. }
  4728. var classes = [button_bem([type, props.size, {
  4729. plain: plain,
  4730. loading: loading,
  4731. disabled: disabled,
  4732. hairline: hairline,
  4733. block: props.block,
  4734. round: props.round,
  4735. square: props.square
  4736. }]), (_ref = {}, _ref[BORDER_SURROUND] = hairline, _ref)];
  4737. function renderIcon() {
  4738. if (loading) {
  4739. return slots.loading ? slots.loading() : h(es_loading, {
  4740. "class": button_bem('loading'),
  4741. "attrs": {
  4742. "size": props.loadingSize,
  4743. "type": props.loadingType,
  4744. "color": "currentColor"
  4745. }
  4746. });
  4747. }
  4748. if (slots.icon) {
  4749. return h("div", {
  4750. "class": button_bem('icon')
  4751. }, [slots.icon()]);
  4752. }
  4753. if (icon) {
  4754. return h(es_icon, {
  4755. "attrs": {
  4756. "name": icon,
  4757. "classPrefix": props.iconPrefix
  4758. },
  4759. "class": button_bem('icon')
  4760. });
  4761. }
  4762. }
  4763. function renderContent() {
  4764. var content = [];
  4765. if (iconPosition === 'left') {
  4766. content.push(renderIcon());
  4767. }
  4768. var text;
  4769. if (loading) {
  4770. text = loadingText;
  4771. } else {
  4772. text = slots.default ? slots.default() : props.text;
  4773. }
  4774. if (text) {
  4775. content.push(h("span", {
  4776. "class": button_bem('text')
  4777. }, [text]));
  4778. }
  4779. if (iconPosition === 'right') {
  4780. content.push(renderIcon());
  4781. }
  4782. return content;
  4783. }
  4784. return h(tag, helper_default()([{
  4785. "style": style,
  4786. "class": classes,
  4787. "attrs": {
  4788. "type": props.nativeType,
  4789. "disabled": disabled
  4790. },
  4791. "on": {
  4792. "click": onClick,
  4793. "touchstart": onTouchstart
  4794. }
  4795. }, inherit(ctx)]), [h("div", {
  4796. "class": button_bem('content')
  4797. }, [renderContent()])]);
  4798. }
  4799. Button.props = _extends({}, routeProps, {
  4800. text: String,
  4801. icon: String,
  4802. color: String,
  4803. block: Boolean,
  4804. plain: Boolean,
  4805. round: Boolean,
  4806. square: Boolean,
  4807. loading: Boolean,
  4808. hairline: Boolean,
  4809. disabled: Boolean,
  4810. iconPrefix: String,
  4811. nativeType: String,
  4812. loadingText: String,
  4813. loadingType: String,
  4814. tag: {
  4815. type: String,
  4816. default: 'button'
  4817. },
  4818. type: {
  4819. type: String,
  4820. default: 'default'
  4821. },
  4822. size: {
  4823. type: String,
  4824. default: 'normal'
  4825. },
  4826. loadingSize: {
  4827. type: String,
  4828. default: '20px'
  4829. },
  4830. iconPosition: {
  4831. type: String,
  4832. default: 'left'
  4833. }
  4834. });
  4835. /* harmony default export */ var es_button = (button_createComponent(Button));
  4836. // CONCATENATED MODULE: ./es/utils/vnodes.js
  4837. function flattenVNodes(vnodes) {
  4838. var result = [];
  4839. function traverse(vnodes) {
  4840. vnodes.forEach(function (vnode) {
  4841. result.push(vnode);
  4842. if (vnode.componentInstance) {
  4843. traverse(vnode.componentInstance.$children.map(function (item) {
  4844. return item.$vnode;
  4845. }));
  4846. }
  4847. if (vnode.children) {
  4848. traverse(vnode.children);
  4849. }
  4850. });
  4851. }
  4852. traverse(vnodes);
  4853. return result;
  4854. } // sort children instances by vnodes order
  4855. function sortChildren(children, parent) {
  4856. var componentOptions = parent.$vnode.componentOptions;
  4857. if (!componentOptions || !componentOptions.children) {
  4858. return;
  4859. }
  4860. var vnodes = flattenVNodes(componentOptions.children);
  4861. children.sort(function (a, b) {
  4862. return vnodes.indexOf(a.$vnode) - vnodes.indexOf(b.$vnode);
  4863. });
  4864. }
  4865. // CONCATENATED MODULE: ./es/mixins/relation.js
  4866. function ChildrenMixin(_parent, options) {
  4867. var _inject, _computed;
  4868. if (options === void 0) {
  4869. options = {};
  4870. }
  4871. var indexKey = options.indexKey || 'index';
  4872. return {
  4873. inject: (_inject = {}, _inject[_parent] = {
  4874. default: null
  4875. }, _inject),
  4876. computed: (_computed = {
  4877. parent: function parent() {
  4878. if (this.disableBindRelation) {
  4879. return null;
  4880. }
  4881. return this[_parent];
  4882. }
  4883. }, _computed[indexKey] = function () {
  4884. this.bindRelation();
  4885. if (this.parent) {
  4886. return this.parent.children.indexOf(this);
  4887. }
  4888. return null;
  4889. }, _computed),
  4890. watch: {
  4891. disableBindRelation: function disableBindRelation(val) {
  4892. if (!val) {
  4893. this.bindRelation();
  4894. }
  4895. }
  4896. },
  4897. mounted: function mounted() {
  4898. this.bindRelation();
  4899. },
  4900. beforeDestroy: function beforeDestroy() {
  4901. var _this = this;
  4902. if (this.parent) {
  4903. this.parent.children = this.parent.children.filter(function (item) {
  4904. return item !== _this;
  4905. });
  4906. }
  4907. },
  4908. methods: {
  4909. bindRelation: function bindRelation() {
  4910. if (!this.parent || this.parent.children.indexOf(this) !== -1) {
  4911. return;
  4912. }
  4913. var children = [].concat(this.parent.children, [this]);
  4914. sortChildren(children, this.parent);
  4915. this.parent.children = children;
  4916. }
  4917. }
  4918. };
  4919. }
  4920. function ParentMixin(parent) {
  4921. return {
  4922. provide: function provide() {
  4923. var _ref;
  4924. return _ref = {}, _ref[parent] = this, _ref;
  4925. },
  4926. data: function data() {
  4927. return {
  4928. children: []
  4929. };
  4930. }
  4931. };
  4932. }
  4933. // CONCATENATED MODULE: ./es/goods-action/index.js
  4934. var goods_action_createNamespace = Object(create["a" /* createNamespace */])('goods-action'),
  4935. goods_action_createComponent = goods_action_createNamespace[0],
  4936. goods_action_bem = goods_action_createNamespace[1];
  4937. /* harmony default export */ var goods_action = (goods_action_createComponent({
  4938. mixins: [ParentMixin('vanGoodsAction')],
  4939. props: {
  4940. safeAreaInsetBottom: {
  4941. type: Boolean,
  4942. default: true
  4943. }
  4944. },
  4945. render: function render() {
  4946. var h = arguments[0];
  4947. return h("div", {
  4948. "class": goods_action_bem({
  4949. unfit: !this.safeAreaInsetBottom
  4950. })
  4951. }, [this.slots()]);
  4952. }
  4953. }));
  4954. // CONCATENATED MODULE: ./es/goods-action-button/index.js
  4955. var goods_action_button_createNamespace = Object(create["a" /* createNamespace */])('goods-action-button'),
  4956. goods_action_button_createComponent = goods_action_button_createNamespace[0],
  4957. goods_action_button_bem = goods_action_button_createNamespace[1];
  4958. /* harmony default export */ var goods_action_button = (goods_action_button_createComponent({
  4959. mixins: [ChildrenMixin('vanGoodsAction')],
  4960. props: _extends({}, routeProps, {
  4961. type: String,
  4962. text: String,
  4963. icon: String,
  4964. color: String,
  4965. loading: Boolean,
  4966. disabled: Boolean
  4967. }),
  4968. computed: {
  4969. isFirst: function isFirst() {
  4970. var prev = this.parent && this.parent.children[this.index - 1];
  4971. return !prev || prev.$options.name !== this.$options.name;
  4972. },
  4973. isLast: function isLast() {
  4974. var next = this.parent && this.parent.children[this.index + 1];
  4975. return !next || next.$options.name !== this.$options.name;
  4976. }
  4977. },
  4978. methods: {
  4979. onClick: function onClick(event) {
  4980. this.$emit('click', event);
  4981. route(this.$router, this);
  4982. }
  4983. },
  4984. render: function render() {
  4985. var h = arguments[0];
  4986. return h(es_button, {
  4987. "class": goods_action_button_bem([{
  4988. first: this.isFirst,
  4989. last: this.isLast
  4990. }, this.type]),
  4991. "attrs": {
  4992. "size": "large",
  4993. "type": this.type,
  4994. "icon": this.icon,
  4995. "color": this.color,
  4996. "loading": this.loading,
  4997. "disabled": this.disabled
  4998. },
  4999. "on": {
  5000. "click": this.onClick
  5001. }
  5002. }, [this.slots() || this.text]);
  5003. }
  5004. }));
  5005. // CONCATENATED MODULE: ./es/dialog/Dialog.js
  5006. var Dialog_createNamespace = Object(create["a" /* createNamespace */])('dialog'),
  5007. Dialog_createComponent = Dialog_createNamespace[0],
  5008. Dialog_bem = Dialog_createNamespace[1],
  5009. Dialog_t = Dialog_createNamespace[2];
  5010. /* harmony default export */ var Dialog = (Dialog_createComponent({
  5011. mixins: [PopupMixin()],
  5012. props: {
  5013. title: String,
  5014. theme: String,
  5015. width: [Number, String],
  5016. message: String,
  5017. className: null,
  5018. callback: Function,
  5019. beforeClose: Function,
  5020. messageAlign: String,
  5021. cancelButtonText: String,
  5022. cancelButtonColor: String,
  5023. confirmButtonText: String,
  5024. confirmButtonColor: String,
  5025. showCancelButton: Boolean,
  5026. overlay: {
  5027. type: Boolean,
  5028. default: true
  5029. },
  5030. allowHtml: {
  5031. type: Boolean,
  5032. default: true
  5033. },
  5034. transition: {
  5035. type: String,
  5036. default: 'van-dialog-bounce'
  5037. },
  5038. showConfirmButton: {
  5039. type: Boolean,
  5040. default: true
  5041. },
  5042. closeOnPopstate: {
  5043. type: Boolean,
  5044. default: true
  5045. },
  5046. closeOnClickOverlay: {
  5047. type: Boolean,
  5048. default: false
  5049. }
  5050. },
  5051. data: function data() {
  5052. return {
  5053. loading: {
  5054. confirm: false,
  5055. cancel: false
  5056. }
  5057. };
  5058. },
  5059. methods: {
  5060. onClickOverlay: function onClickOverlay() {
  5061. this.handleAction('overlay');
  5062. },
  5063. handleAction: function handleAction(action) {
  5064. var _this = this;
  5065. this.$emit(action); // show not trigger close event when hidden
  5066. if (!this.value) {
  5067. return;
  5068. }
  5069. if (this.beforeClose) {
  5070. this.loading[action] = true;
  5071. this.beforeClose(action, function (state) {
  5072. if (state !== false && _this.loading[action]) {
  5073. _this.onClose(action);
  5074. }
  5075. _this.loading.confirm = false;
  5076. _this.loading.cancel = false;
  5077. });
  5078. } else {
  5079. this.onClose(action);
  5080. }
  5081. },
  5082. onClose: function onClose(action) {
  5083. this.close();
  5084. if (this.callback) {
  5085. this.callback(action);
  5086. }
  5087. },
  5088. onOpened: function onOpened() {
  5089. var _this2 = this;
  5090. this.$emit('opened');
  5091. this.$nextTick(function () {
  5092. var _this2$$refs$dialog;
  5093. (_this2$$refs$dialog = _this2.$refs.dialog) == null ? void 0 : _this2$$refs$dialog.focus();
  5094. });
  5095. },
  5096. onClosed: function onClosed() {
  5097. this.$emit('closed');
  5098. },
  5099. onKeydown: function onKeydown(event) {
  5100. var _this3 = this;
  5101. if (event.key === 'Escape' || event.key === 'Enter') {
  5102. // skip keyboard events of child elements
  5103. if (event.target !== this.$refs.dialog) {
  5104. return;
  5105. }
  5106. var onEventType = {
  5107. Enter: this.showConfirmButton ? function () {
  5108. return _this3.handleAction('confirm');
  5109. } : utils["i" /* noop */],
  5110. Escape: this.showCancelButton ? function () {
  5111. return _this3.handleAction('cancel');
  5112. } : utils["i" /* noop */]
  5113. };
  5114. onEventType[event.key]();
  5115. this.$emit('keydown', event);
  5116. }
  5117. },
  5118. genRoundButtons: function genRoundButtons() {
  5119. var _this4 = this;
  5120. var h = this.$createElement;
  5121. return h(goods_action, {
  5122. "class": Dialog_bem('footer')
  5123. }, [this.showCancelButton && h(goods_action_button, {
  5124. "attrs": {
  5125. "size": "large",
  5126. "type": "warning",
  5127. "text": this.cancelButtonText || Dialog_t('cancel'),
  5128. "color": this.cancelButtonColor,
  5129. "loading": this.loading.cancel
  5130. },
  5131. "class": Dialog_bem('cancel'),
  5132. "on": {
  5133. "click": function click() {
  5134. _this4.handleAction('cancel');
  5135. }
  5136. }
  5137. }), this.showConfirmButton && h(goods_action_button, {
  5138. "attrs": {
  5139. "size": "large",
  5140. "type": "danger",
  5141. "text": this.confirmButtonText || Dialog_t('confirm'),
  5142. "color": this.confirmButtonColor,
  5143. "loading": this.loading.confirm
  5144. },
  5145. "class": Dialog_bem('confirm'),
  5146. "on": {
  5147. "click": function click() {
  5148. _this4.handleAction('confirm');
  5149. }
  5150. }
  5151. })]);
  5152. },
  5153. genButtons: function genButtons() {
  5154. var _this5 = this,
  5155. _ref;
  5156. var h = this.$createElement;
  5157. var multiple = this.showCancelButton && this.showConfirmButton;
  5158. return h("div", {
  5159. "class": [BORDER_TOP, Dialog_bem('footer')]
  5160. }, [this.showCancelButton && h(es_button, {
  5161. "attrs": {
  5162. "size": "large",
  5163. "loading": this.loading.cancel,
  5164. "text": this.cancelButtonText || Dialog_t('cancel'),
  5165. "nativeType": "button"
  5166. },
  5167. "class": Dialog_bem('cancel'),
  5168. "style": {
  5169. color: this.cancelButtonColor
  5170. },
  5171. "on": {
  5172. "click": function click() {
  5173. _this5.handleAction('cancel');
  5174. }
  5175. }
  5176. }), this.showConfirmButton && h(es_button, {
  5177. "attrs": {
  5178. "size": "large",
  5179. "loading": this.loading.confirm,
  5180. "text": this.confirmButtonText || Dialog_t('confirm'),
  5181. "nativeType": "button"
  5182. },
  5183. "class": [Dialog_bem('confirm'), (_ref = {}, _ref[BORDER_LEFT] = multiple, _ref)],
  5184. "style": {
  5185. color: this.confirmButtonColor
  5186. },
  5187. "on": {
  5188. "click": function click() {
  5189. _this5.handleAction('confirm');
  5190. }
  5191. }
  5192. })]);
  5193. },
  5194. genContent: function genContent(hasTitle, messageSlot) {
  5195. var h = this.$createElement;
  5196. if (messageSlot) {
  5197. return h("div", {
  5198. "class": Dialog_bem('content')
  5199. }, [messageSlot]);
  5200. }
  5201. var message = this.message,
  5202. messageAlign = this.messageAlign;
  5203. if (message) {
  5204. var _bem, _domProps;
  5205. var data = {
  5206. class: Dialog_bem('message', (_bem = {
  5207. 'has-title': hasTitle
  5208. }, _bem[messageAlign] = messageAlign, _bem)),
  5209. domProps: (_domProps = {}, _domProps[this.allowHtml ? 'innerHTML' : 'textContent'] = message, _domProps)
  5210. };
  5211. return h("div", {
  5212. "class": Dialog_bem('content', {
  5213. isolated: !hasTitle
  5214. })
  5215. }, [h("div", helper_default()([{}, data]))]);
  5216. }
  5217. }
  5218. },
  5219. render: function render() {
  5220. var h = arguments[0];
  5221. if (!this.shouldRender) {
  5222. return;
  5223. }
  5224. var message = this.message;
  5225. var messageSlot = this.slots();
  5226. var title = this.slots('title') || this.title;
  5227. var Title = title && h("div", {
  5228. "class": Dialog_bem('header', {
  5229. isolated: !message && !messageSlot
  5230. })
  5231. }, [title]);
  5232. return h("transition", {
  5233. "attrs": {
  5234. "name": this.transition
  5235. },
  5236. "on": {
  5237. "afterEnter": this.onOpened,
  5238. "afterLeave": this.onClosed
  5239. }
  5240. }, [h("div", {
  5241. "directives": [{
  5242. name: "show",
  5243. value: this.value
  5244. }],
  5245. "attrs": {
  5246. "role": "dialog",
  5247. "aria-labelledby": this.title || message,
  5248. "tabIndex": 0
  5249. },
  5250. "class": [Dialog_bem([this.theme]), this.className],
  5251. "style": {
  5252. width: Object(unit["a" /* addUnit */])(this.width)
  5253. },
  5254. "ref": "dialog",
  5255. "on": {
  5256. "keydown": this.onKeydown
  5257. }
  5258. }, [Title, this.genContent(title, messageSlot), this.theme === 'round-button' ? this.genRoundButtons() : this.genButtons()])]);
  5259. }
  5260. }));
  5261. // CONCATENATED MODULE: ./es/dialog/index.js
  5262. var dialog_instance;
  5263. function dialog_isInDocument(element) {
  5264. return document.body.contains(element);
  5265. }
  5266. function dialog_initInstance() {
  5267. if (dialog_instance) {
  5268. dialog_instance.$destroy();
  5269. }
  5270. dialog_instance = new (external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.extend(Dialog))({
  5271. el: document.createElement('div'),
  5272. // avoid missing animation when first rendered
  5273. propsData: {
  5274. lazyRender: false
  5275. }
  5276. });
  5277. dialog_instance.$on('input', function (value) {
  5278. dialog_instance.value = value;
  5279. });
  5280. }
  5281. function dialog_Dialog(options) {
  5282. /* istanbul ignore if */
  5283. if (utils["h" /* isServer */]) {
  5284. return Promise.resolve();
  5285. }
  5286. return new Promise(function (resolve, reject) {
  5287. if (!dialog_instance || !dialog_isInDocument(dialog_instance.$el)) {
  5288. dialog_initInstance();
  5289. }
  5290. _extends(dialog_instance, dialog_Dialog.currentOptions, options, {
  5291. resolve: resolve,
  5292. reject: reject
  5293. });
  5294. });
  5295. }
  5296. dialog_Dialog.defaultOptions = {
  5297. value: true,
  5298. title: '',
  5299. width: '',
  5300. theme: null,
  5301. message: '',
  5302. overlay: true,
  5303. className: '',
  5304. allowHtml: true,
  5305. lockScroll: true,
  5306. transition: 'van-dialog-bounce',
  5307. beforeClose: null,
  5308. overlayClass: '',
  5309. overlayStyle: null,
  5310. messageAlign: '',
  5311. getContainer: 'body',
  5312. cancelButtonText: '',
  5313. cancelButtonColor: null,
  5314. confirmButtonText: '',
  5315. confirmButtonColor: null,
  5316. showConfirmButton: true,
  5317. showCancelButton: false,
  5318. closeOnPopstate: true,
  5319. closeOnClickOverlay: false,
  5320. callback: function callback(action) {
  5321. dialog_instance[action === 'confirm' ? 'resolve' : 'reject'](action);
  5322. }
  5323. };
  5324. dialog_Dialog.alert = dialog_Dialog;
  5325. dialog_Dialog.confirm = function (options) {
  5326. return dialog_Dialog(_extends({
  5327. showCancelButton: true
  5328. }, options));
  5329. };
  5330. dialog_Dialog.close = function () {
  5331. if (dialog_instance) {
  5332. dialog_instance.value = false;
  5333. }
  5334. };
  5335. dialog_Dialog.setDefaultOptions = function (options) {
  5336. _extends(dialog_Dialog.currentOptions, options);
  5337. };
  5338. dialog_Dialog.resetDefaultOptions = function () {
  5339. dialog_Dialog.currentOptions = _extends({}, dialog_Dialog.defaultOptions);
  5340. };
  5341. dialog_Dialog.resetDefaultOptions();
  5342. dialog_Dialog.install = function () {
  5343. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.use(Dialog);
  5344. };
  5345. dialog_Dialog.Component = Dialog;
  5346. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$dialog = dialog_Dialog;
  5347. /* harmony default export */ var dialog = (dialog_Dialog);
  5348. // CONCATENATED MODULE: ./es/address-edit/Detail.js
  5349. // Utils
  5350. // Components
  5351. var Detail_createNamespace = Object(create["a" /* createNamespace */])('address-edit-detail'),
  5352. Detail_createComponent = Detail_createNamespace[0],
  5353. Detail_bem = Detail_createNamespace[1],
  5354. Detail_t = Detail_createNamespace[2];
  5355. var android = isAndroid();
  5356. /* harmony default export */ var Detail = (Detail_createComponent({
  5357. props: {
  5358. value: String,
  5359. errorMessage: String,
  5360. focused: Boolean,
  5361. detailRows: [Number, String],
  5362. searchResult: Array,
  5363. detailMaxlength: [Number, String],
  5364. showSearchResult: Boolean
  5365. },
  5366. computed: {
  5367. shouldShowSearchResult: function shouldShowSearchResult() {
  5368. return this.focused && this.searchResult && this.showSearchResult;
  5369. }
  5370. },
  5371. methods: {
  5372. onSelect: function onSelect(express) {
  5373. this.$emit('select-search', express);
  5374. this.$emit('input', ((express.address || '') + " " + (express.name || '')).trim());
  5375. },
  5376. onFinish: function onFinish() {
  5377. this.$refs.field.blur();
  5378. },
  5379. genFinish: function genFinish() {
  5380. var h = this.$createElement;
  5381. var show = this.value && this.focused && android;
  5382. if (show) {
  5383. return h("div", {
  5384. "class": Detail_bem('finish'),
  5385. "on": {
  5386. "click": this.onFinish
  5387. }
  5388. }, [Detail_t('complete')]);
  5389. }
  5390. },
  5391. genSearchResult: function genSearchResult() {
  5392. var _this = this;
  5393. var h = this.$createElement;
  5394. var value = this.value,
  5395. shouldShowSearchResult = this.shouldShowSearchResult,
  5396. searchResult = this.searchResult;
  5397. if (shouldShowSearchResult) {
  5398. return searchResult.map(function (express) {
  5399. return h(cell, {
  5400. "key": express.name + express.address,
  5401. "attrs": {
  5402. "clickable": true,
  5403. "border": false,
  5404. "icon": "location-o",
  5405. "label": express.address
  5406. },
  5407. "class": Detail_bem('search-item'),
  5408. "on": {
  5409. "click": function click() {
  5410. _this.onSelect(express);
  5411. }
  5412. },
  5413. "scopedSlots": {
  5414. title: function title() {
  5415. if (express.name) {
  5416. var text = express.name.replace(value, "<span class=" + Detail_bem('keyword') + ">" + value + "</span>");
  5417. return h("div", {
  5418. "domProps": {
  5419. "innerHTML": text
  5420. }
  5421. });
  5422. }
  5423. }
  5424. }
  5425. });
  5426. });
  5427. }
  5428. }
  5429. },
  5430. render: function render() {
  5431. var h = arguments[0];
  5432. return h(cell, {
  5433. "class": Detail_bem()
  5434. }, [h(es_field, {
  5435. "attrs": {
  5436. "autosize": true,
  5437. "rows": this.detailRows,
  5438. "clearable": !android,
  5439. "type": "textarea",
  5440. "value": this.value,
  5441. "errorMessage": this.errorMessage,
  5442. "border": !this.shouldShowSearchResult,
  5443. "label": Detail_t('label'),
  5444. "maxlength": this.detailMaxlength,
  5445. "placeholder": Detail_t('placeholder')
  5446. },
  5447. "ref": "field",
  5448. "scopedSlots": {
  5449. icon: this.genFinish
  5450. },
  5451. "on": _extends({}, this.$listeners)
  5452. }), this.genSearchResult()]);
  5453. }
  5454. }));
  5455. // CONCATENATED MODULE: ./es/switch/shared.js
  5456. /**
  5457. * Common Switch Props
  5458. */
  5459. var switchProps = {
  5460. size: [Number, String],
  5461. value: null,
  5462. loading: Boolean,
  5463. disabled: Boolean,
  5464. activeColor: String,
  5465. inactiveColor: String,
  5466. activeValue: {
  5467. type: null,
  5468. default: true
  5469. },
  5470. inactiveValue: {
  5471. type: null,
  5472. default: false
  5473. }
  5474. };
  5475. // CONCATENATED MODULE: ./es/mixins/field.js
  5476. var FieldMixin = {
  5477. inject: {
  5478. vanField: {
  5479. default: null
  5480. }
  5481. },
  5482. watch: {
  5483. value: function value() {
  5484. var field = this.vanField;
  5485. if (field) {
  5486. field.resetValidation();
  5487. field.validateWithTrigger('onChange');
  5488. }
  5489. }
  5490. },
  5491. created: function created() {
  5492. var field = this.vanField;
  5493. if (field && !field.children) {
  5494. field.children = this;
  5495. }
  5496. }
  5497. };
  5498. // CONCATENATED MODULE: ./es/switch/index.js
  5499. // Utils
  5500. // Mixins
  5501. // Components
  5502. var switch_createNamespace = Object(create["a" /* createNamespace */])('switch'),
  5503. switch_createComponent = switch_createNamespace[0],
  5504. switch_bem = switch_createNamespace[1];
  5505. /* harmony default export */ var es_switch = (switch_createComponent({
  5506. mixins: [FieldMixin],
  5507. props: switchProps,
  5508. computed: {
  5509. checked: function checked() {
  5510. return this.value === this.activeValue;
  5511. },
  5512. style: function style() {
  5513. return {
  5514. fontSize: Object(unit["a" /* addUnit */])(this.size),
  5515. backgroundColor: this.checked ? this.activeColor : this.inactiveColor
  5516. };
  5517. }
  5518. },
  5519. methods: {
  5520. onClick: function onClick(event) {
  5521. this.$emit('click', event);
  5522. if (!this.disabled && !this.loading) {
  5523. var newValue = this.checked ? this.inactiveValue : this.activeValue;
  5524. this.$emit('input', newValue);
  5525. this.$emit('change', newValue);
  5526. }
  5527. },
  5528. genLoading: function genLoading() {
  5529. var h = this.$createElement;
  5530. if (this.loading) {
  5531. var color = this.checked ? this.activeColor : this.inactiveColor;
  5532. return h(es_loading, {
  5533. "class": switch_bem('loading'),
  5534. "attrs": {
  5535. "color": color
  5536. }
  5537. });
  5538. }
  5539. }
  5540. },
  5541. render: function render() {
  5542. var h = arguments[0];
  5543. var checked = this.checked,
  5544. loading = this.loading,
  5545. disabled = this.disabled;
  5546. return h("div", {
  5547. "class": switch_bem({
  5548. on: checked,
  5549. loading: loading,
  5550. disabled: disabled
  5551. }),
  5552. "attrs": {
  5553. "role": "switch",
  5554. "aria-checked": String(checked)
  5555. },
  5556. "style": this.style,
  5557. "on": {
  5558. "click": this.onClick
  5559. }
  5560. }, [h("div", {
  5561. "class": switch_bem('node')
  5562. }, [this.genLoading()])]);
  5563. }
  5564. }));
  5565. // CONCATENATED MODULE: ./es/address-edit/index.js
  5566. // Utils
  5567. // Components
  5568. var address_edit_createNamespace = Object(create["a" /* createNamespace */])('address-edit'),
  5569. address_edit_createComponent = address_edit_createNamespace[0],
  5570. address_edit_bem = address_edit_createNamespace[1],
  5571. address_edit_t = address_edit_createNamespace[2];
  5572. var defaultData = {
  5573. name: '',
  5574. tel: '',
  5575. country: '',
  5576. province: '',
  5577. city: '',
  5578. county: '',
  5579. areaCode: '',
  5580. postalCode: '',
  5581. addressDetail: '',
  5582. isDefault: false
  5583. };
  5584. function isPostal(value) {
  5585. return /^\d{6}$/.test(value);
  5586. }
  5587. /* harmony default export */ var address_edit = (address_edit_createComponent({
  5588. props: {
  5589. areaList: Object,
  5590. isSaving: Boolean,
  5591. isDeleting: Boolean,
  5592. validator: Function,
  5593. showDelete: Boolean,
  5594. showPostal: Boolean,
  5595. searchResult: Array,
  5596. telMaxlength: [Number, String],
  5597. showSetDefault: Boolean,
  5598. saveButtonText: String,
  5599. areaPlaceholder: String,
  5600. deleteButtonText: String,
  5601. showSearchResult: Boolean,
  5602. showArea: {
  5603. type: Boolean,
  5604. default: true
  5605. },
  5606. showDetail: {
  5607. type: Boolean,
  5608. default: true
  5609. },
  5610. disableArea: Boolean,
  5611. detailRows: {
  5612. type: [Number, String],
  5613. default: 1
  5614. },
  5615. detailMaxlength: {
  5616. type: [Number, String],
  5617. default: 200
  5618. },
  5619. addressInfo: {
  5620. type: Object,
  5621. default: function _default() {
  5622. return _extends({}, defaultData);
  5623. }
  5624. },
  5625. telValidator: {
  5626. type: Function,
  5627. default: isMobile
  5628. },
  5629. postalValidator: {
  5630. type: Function,
  5631. default: isPostal
  5632. },
  5633. areaColumnsPlaceholder: {
  5634. type: Array,
  5635. default: function _default() {
  5636. return [];
  5637. }
  5638. }
  5639. },
  5640. data: function data() {
  5641. return {
  5642. data: {},
  5643. showAreaPopup: false,
  5644. detailFocused: false,
  5645. errorInfo: {
  5646. tel: '',
  5647. name: '',
  5648. areaCode: '',
  5649. postalCode: '',
  5650. addressDetail: ''
  5651. }
  5652. };
  5653. },
  5654. computed: {
  5655. areaListLoaded: function areaListLoaded() {
  5656. return Object(utils["f" /* isObject */])(this.areaList) && Object.keys(this.areaList).length;
  5657. },
  5658. areaText: function areaText() {
  5659. var _this$data = this.data,
  5660. country = _this$data.country,
  5661. province = _this$data.province,
  5662. city = _this$data.city,
  5663. county = _this$data.county,
  5664. areaCode = _this$data.areaCode;
  5665. if (areaCode) {
  5666. var arr = [country, province, city, county];
  5667. if (province && province === city) {
  5668. arr.splice(1, 1);
  5669. }
  5670. return arr.filter(function (text) {
  5671. return text;
  5672. }).join('/');
  5673. }
  5674. return '';
  5675. },
  5676. // hide bottom field when use search && detail get focused
  5677. hideBottomFields: function hideBottomFields() {
  5678. var searchResult = this.searchResult;
  5679. return searchResult && searchResult.length && this.detailFocused;
  5680. }
  5681. },
  5682. watch: {
  5683. addressInfo: {
  5684. handler: function handler(val) {
  5685. this.data = _extends({}, defaultData, val);
  5686. this.setAreaCode(val.areaCode);
  5687. },
  5688. deep: true,
  5689. immediate: true
  5690. },
  5691. areaList: function areaList() {
  5692. this.setAreaCode(this.data.areaCode);
  5693. }
  5694. },
  5695. methods: {
  5696. onFocus: function onFocus(key) {
  5697. this.errorInfo[key] = '';
  5698. this.detailFocused = key === 'addressDetail';
  5699. this.$emit('focus', key);
  5700. },
  5701. onChangeDetail: function onChangeDetail(val) {
  5702. this.data.addressDetail = val;
  5703. this.$emit('change-detail', val);
  5704. },
  5705. onAreaConfirm: function onAreaConfirm(values) {
  5706. values = values.filter(function (value) {
  5707. return !!value;
  5708. });
  5709. if (values.some(function (value) {
  5710. return !value.code;
  5711. })) {
  5712. es_toast(address_edit_t('areaEmpty'));
  5713. return;
  5714. }
  5715. this.showAreaPopup = false;
  5716. this.assignAreaValues();
  5717. this.$emit('change-area', values);
  5718. },
  5719. assignAreaValues: function assignAreaValues() {
  5720. var area = this.$refs.area;
  5721. if (area) {
  5722. var detail = area.getArea();
  5723. detail.areaCode = detail.code;
  5724. delete detail.code;
  5725. _extends(this.data, detail);
  5726. }
  5727. },
  5728. onSave: function onSave() {
  5729. var _this = this;
  5730. var items = ['name', 'tel'];
  5731. if (this.showArea) {
  5732. items.push('areaCode');
  5733. }
  5734. if (this.showDetail) {
  5735. items.push('addressDetail');
  5736. }
  5737. if (this.showPostal) {
  5738. items.push('postalCode');
  5739. }
  5740. var isValid = items.every(function (item) {
  5741. var msg = _this.getErrorMessage(item);
  5742. if (msg) {
  5743. _this.errorInfo[item] = msg;
  5744. }
  5745. return !msg;
  5746. });
  5747. if (isValid && !this.isSaving) {
  5748. this.$emit('save', this.data);
  5749. }
  5750. },
  5751. getErrorMessage: function getErrorMessage(key) {
  5752. var value = String(this.data[key] || '').trim();
  5753. if (this.validator) {
  5754. var message = this.validator(key, value);
  5755. if (message) {
  5756. return message;
  5757. }
  5758. }
  5759. switch (key) {
  5760. case 'name':
  5761. return value ? '' : address_edit_t('nameEmpty');
  5762. case 'tel':
  5763. return this.telValidator(value) ? '' : address_edit_t('telInvalid');
  5764. case 'areaCode':
  5765. return value ? '' : address_edit_t('areaEmpty');
  5766. case 'addressDetail':
  5767. return value ? '' : address_edit_t('addressEmpty');
  5768. case 'postalCode':
  5769. return value && !this.postalValidator(value) ? address_edit_t('postalEmpty') : '';
  5770. }
  5771. },
  5772. onDelete: function onDelete() {
  5773. var _this2 = this;
  5774. dialog.confirm({
  5775. title: address_edit_t('confirmDelete')
  5776. }).then(function () {
  5777. _this2.$emit('delete', _this2.data);
  5778. }).catch(function () {
  5779. _this2.$emit('cancel-delete', _this2.data);
  5780. });
  5781. },
  5782. // get values of area component
  5783. getArea: function getArea() {
  5784. return this.$refs.area ? this.$refs.area.getValues() : [];
  5785. },
  5786. // set area code to area component
  5787. setAreaCode: function setAreaCode(code) {
  5788. this.data.areaCode = code || '';
  5789. if (code) {
  5790. this.$nextTick(this.assignAreaValues);
  5791. }
  5792. },
  5793. // @exposed-api
  5794. setAddressDetail: function setAddressDetail(value) {
  5795. this.data.addressDetail = value;
  5796. },
  5797. onDetailBlur: function onDetailBlur() {
  5798. var _this3 = this; // await for click search event
  5799. setTimeout(function () {
  5800. _this3.detailFocused = false;
  5801. });
  5802. },
  5803. genSetDefaultCell: function genSetDefaultCell(h) {
  5804. var _this4 = this;
  5805. if (this.showSetDefault) {
  5806. var slots = {
  5807. 'right-icon': function rightIcon() {
  5808. return h(es_switch, {
  5809. "attrs": {
  5810. "size": "24"
  5811. },
  5812. "on": {
  5813. "change": function change(event) {
  5814. _this4.$emit('change-default', event);
  5815. }
  5816. },
  5817. "model": {
  5818. value: _this4.data.isDefault,
  5819. callback: function callback($$v) {
  5820. _this4.$set(_this4.data, "isDefault", $$v);
  5821. }
  5822. }
  5823. });
  5824. }
  5825. };
  5826. return h(cell, {
  5827. "directives": [{
  5828. name: "show",
  5829. value: !this.hideBottomFields
  5830. }],
  5831. "attrs": {
  5832. "center": true,
  5833. "title": address_edit_t('defaultAddress')
  5834. },
  5835. "class": address_edit_bem('default'),
  5836. "scopedSlots": slots
  5837. });
  5838. }
  5839. return h();
  5840. }
  5841. },
  5842. render: function render(h) {
  5843. var _this5 = this;
  5844. var data = this.data,
  5845. errorInfo = this.errorInfo,
  5846. disableArea = this.disableArea,
  5847. hideBottomFields = this.hideBottomFields;
  5848. var onFocus = function onFocus(name) {
  5849. return function () {
  5850. return _this5.onFocus(name);
  5851. };
  5852. };
  5853. return h("div", {
  5854. "class": address_edit_bem()
  5855. }, [h("div", {
  5856. "class": address_edit_bem('fields')
  5857. }, [h(es_field, {
  5858. "attrs": {
  5859. "clearable": true,
  5860. "label": address_edit_t('name'),
  5861. "placeholder": address_edit_t('namePlaceholder'),
  5862. "errorMessage": errorInfo.name
  5863. },
  5864. "on": {
  5865. "focus": onFocus('name')
  5866. },
  5867. "model": {
  5868. value: data.name,
  5869. callback: function callback($$v) {
  5870. _this5.$set(data, "name", $$v);
  5871. }
  5872. }
  5873. }), h(es_field, {
  5874. "attrs": {
  5875. "clearable": true,
  5876. "type": "tel",
  5877. "label": address_edit_t('tel'),
  5878. "maxlength": this.telMaxlength,
  5879. "placeholder": address_edit_t('telPlaceholder'),
  5880. "errorMessage": errorInfo.tel
  5881. },
  5882. "on": {
  5883. "focus": onFocus('tel')
  5884. },
  5885. "model": {
  5886. value: data.tel,
  5887. callback: function callback($$v) {
  5888. _this5.$set(data, "tel", $$v);
  5889. }
  5890. }
  5891. }), h(es_field, {
  5892. "directives": [{
  5893. name: "show",
  5894. value: this.showArea
  5895. }],
  5896. "attrs": {
  5897. "readonly": true,
  5898. "clickable": !disableArea,
  5899. "label": address_edit_t('area'),
  5900. "placeholder": this.areaPlaceholder || address_edit_t('areaPlaceholder'),
  5901. "errorMessage": errorInfo.areaCode,
  5902. "rightIcon": !disableArea ? 'arrow' : null,
  5903. "value": this.areaText
  5904. },
  5905. "on": {
  5906. "focus": onFocus('areaCode'),
  5907. "click": function click() {
  5908. _this5.$emit('click-area');
  5909. _this5.showAreaPopup = !disableArea;
  5910. }
  5911. }
  5912. }), h(Detail, {
  5913. "directives": [{
  5914. name: "show",
  5915. value: this.showDetail
  5916. }],
  5917. "attrs": {
  5918. "focused": this.detailFocused,
  5919. "value": data.addressDetail,
  5920. "errorMessage": errorInfo.addressDetail,
  5921. "detailRows": this.detailRows,
  5922. "detailMaxlength": this.detailMaxlength,
  5923. "searchResult": this.searchResult,
  5924. "showSearchResult": this.showSearchResult
  5925. },
  5926. "on": {
  5927. "focus": onFocus('addressDetail'),
  5928. "blur": this.onDetailBlur,
  5929. "input": this.onChangeDetail,
  5930. "select-search": function selectSearch(event) {
  5931. _this5.$emit('select-search', event);
  5932. }
  5933. }
  5934. }), this.showPostal && h(es_field, {
  5935. "directives": [{
  5936. name: "show",
  5937. value: !hideBottomFields
  5938. }],
  5939. "attrs": {
  5940. "type": "tel",
  5941. "maxlength": "6",
  5942. "label": address_edit_t('postal'),
  5943. "placeholder": address_edit_t('postal'),
  5944. "errorMessage": errorInfo.postalCode
  5945. },
  5946. "on": {
  5947. "focus": onFocus('postalCode')
  5948. },
  5949. "model": {
  5950. value: data.postalCode,
  5951. callback: function callback($$v) {
  5952. _this5.$set(data, "postalCode", $$v);
  5953. }
  5954. }
  5955. }), this.slots()]), this.genSetDefaultCell(h), h("div", {
  5956. "directives": [{
  5957. name: "show",
  5958. value: !hideBottomFields
  5959. }],
  5960. "class": address_edit_bem('buttons')
  5961. }, [h(es_button, {
  5962. "attrs": {
  5963. "block": true,
  5964. "round": true,
  5965. "loading": this.isSaving,
  5966. "type": "danger",
  5967. "text": this.saveButtonText || address_edit_t('save')
  5968. },
  5969. "on": {
  5970. "click": this.onSave
  5971. }
  5972. }), this.showDelete && h(es_button, {
  5973. "attrs": {
  5974. "block": true,
  5975. "round": true,
  5976. "loading": this.isDeleting,
  5977. "text": this.deleteButtonText || address_edit_t('delete')
  5978. },
  5979. "on": {
  5980. "click": this.onDelete
  5981. }
  5982. })]), h(popup, {
  5983. "attrs": {
  5984. "round": true,
  5985. "position": "bottom",
  5986. "lazyRender": false,
  5987. "getContainer": "body"
  5988. },
  5989. "model": {
  5990. value: _this5.showAreaPopup,
  5991. callback: function callback($$v) {
  5992. _this5.showAreaPopup = $$v;
  5993. }
  5994. }
  5995. }, [h(es_area, {
  5996. "ref": "area",
  5997. "attrs": {
  5998. "value": data.areaCode,
  5999. "loading": !this.areaListLoaded,
  6000. "areaList": this.areaList,
  6001. "columnsPlaceholder": this.areaColumnsPlaceholder
  6002. },
  6003. "on": {
  6004. "confirm": this.onAreaConfirm,
  6005. "cancel": function cancel() {
  6006. _this5.showAreaPopup = false;
  6007. }
  6008. }
  6009. })])]);
  6010. }
  6011. }));
  6012. // CONCATENATED MODULE: ./es/radio-group/index.js
  6013. var radio_group_createNamespace = Object(create["a" /* createNamespace */])('radio-group'),
  6014. radio_group_createComponent = radio_group_createNamespace[0],
  6015. radio_group_bem = radio_group_createNamespace[1];
  6016. /* harmony default export */ var radio_group = (radio_group_createComponent({
  6017. mixins: [ParentMixin('vanRadio'), FieldMixin],
  6018. props: {
  6019. value: null,
  6020. disabled: Boolean,
  6021. direction: String,
  6022. checkedColor: String,
  6023. iconSize: [Number, String]
  6024. },
  6025. watch: {
  6026. value: function value(_value) {
  6027. this.$emit('change', _value);
  6028. }
  6029. },
  6030. render: function render() {
  6031. var h = arguments[0];
  6032. return h("div", {
  6033. "class": radio_group_bem([this.direction]),
  6034. "attrs": {
  6035. "role": "radiogroup"
  6036. }
  6037. }, [this.slots()]);
  6038. }
  6039. }));
  6040. // CONCATENATED MODULE: ./es/tag/index.js
  6041. // Utils
  6042. // Components
  6043. // Types
  6044. var tag_createNamespace = Object(create["a" /* createNamespace */])('tag'),
  6045. tag_createComponent = tag_createNamespace[0],
  6046. tag_bem = tag_createNamespace[1];
  6047. function Tag(h, props, slots, ctx) {
  6048. var _style;
  6049. var type = props.type,
  6050. mark = props.mark,
  6051. plain = props.plain,
  6052. color = props.color,
  6053. round = props.round,
  6054. size = props.size,
  6055. textColor = props.textColor;
  6056. var key = plain ? 'color' : 'backgroundColor';
  6057. var style = (_style = {}, _style[key] = color, _style);
  6058. if (plain) {
  6059. style.color = textColor || color;
  6060. style.borderColor = color;
  6061. } else {
  6062. style.color = textColor;
  6063. style.background = color;
  6064. }
  6065. var classes = {
  6066. mark: mark,
  6067. plain: plain,
  6068. round: round
  6069. };
  6070. if (size) {
  6071. classes[size] = size;
  6072. }
  6073. var CloseIcon = props.closeable && h(es_icon, {
  6074. "attrs": {
  6075. "name": "cross"
  6076. },
  6077. "class": tag_bem('close'),
  6078. "on": {
  6079. "click": function click(event) {
  6080. event.stopPropagation();
  6081. functional_emit(ctx, 'close');
  6082. }
  6083. }
  6084. });
  6085. return h("transition", {
  6086. "attrs": {
  6087. "name": props.closeable ? 'van-fade' : null
  6088. }
  6089. }, [h("span", helper_default()([{
  6090. "key": "content",
  6091. "style": style,
  6092. "class": tag_bem([classes, type])
  6093. }, inherit(ctx, true)]), [slots.default == null ? void 0 : slots.default(), CloseIcon])]);
  6094. }
  6095. Tag.props = {
  6096. size: String,
  6097. mark: Boolean,
  6098. color: String,
  6099. plain: Boolean,
  6100. round: Boolean,
  6101. textColor: String,
  6102. closeable: Boolean,
  6103. type: {
  6104. type: String,
  6105. default: 'default'
  6106. }
  6107. };
  6108. /* harmony default export */ var es_tag = (tag_createComponent(Tag));
  6109. // CONCATENATED MODULE: ./es/mixins/checkbox.js
  6110. /**
  6111. * Common part of Checkbox & Radio
  6112. */
  6113. var checkbox_CheckboxMixin = function CheckboxMixin(_ref) {
  6114. var parent = _ref.parent,
  6115. bem = _ref.bem,
  6116. role = _ref.role;
  6117. return {
  6118. mixins: [ChildrenMixin(parent), FieldMixin],
  6119. props: {
  6120. name: null,
  6121. value: null,
  6122. disabled: Boolean,
  6123. iconSize: [Number, String],
  6124. checkedColor: String,
  6125. labelPosition: String,
  6126. labelDisabled: Boolean,
  6127. shape: {
  6128. type: String,
  6129. default: 'round'
  6130. },
  6131. bindGroup: {
  6132. type: Boolean,
  6133. default: true
  6134. }
  6135. },
  6136. computed: {
  6137. disableBindRelation: function disableBindRelation() {
  6138. return !this.bindGroup;
  6139. },
  6140. isDisabled: function isDisabled() {
  6141. return this.parent && this.parent.disabled || this.disabled;
  6142. },
  6143. direction: function direction() {
  6144. return this.parent && this.parent.direction || null;
  6145. },
  6146. iconStyle: function iconStyle() {
  6147. var checkedColor = this.checkedColor || this.parent && this.parent.checkedColor;
  6148. if (checkedColor && this.checked && !this.isDisabled) {
  6149. return {
  6150. borderColor: checkedColor,
  6151. backgroundColor: checkedColor
  6152. };
  6153. }
  6154. },
  6155. tabindex: function tabindex() {
  6156. if (this.isDisabled || role === 'radio' && !this.checked) {
  6157. return -1;
  6158. }
  6159. return 0;
  6160. }
  6161. },
  6162. methods: {
  6163. onClick: function onClick(event) {
  6164. var _this = this;
  6165. var target = event.target;
  6166. var icon = this.$refs.icon;
  6167. var iconClicked = icon === target || (icon == null ? void 0 : icon.contains(target));
  6168. if (!this.isDisabled && (iconClicked || !this.labelDisabled)) {
  6169. this.toggle(); // wait for toggle method to complete
  6170. // so we can get the changed value in the click event listener
  6171. setTimeout(function () {
  6172. _this.$emit('click', event);
  6173. });
  6174. } else {
  6175. this.$emit('click', event);
  6176. }
  6177. },
  6178. genIcon: function genIcon() {
  6179. var h = this.$createElement;
  6180. var checked = this.checked;
  6181. var iconSize = this.iconSize || this.parent && this.parent.iconSize;
  6182. return h("div", {
  6183. "ref": "icon",
  6184. "class": bem('icon', [this.shape, {
  6185. disabled: this.isDisabled,
  6186. checked: checked
  6187. }]),
  6188. "style": {
  6189. fontSize: Object(unit["a" /* addUnit */])(iconSize)
  6190. }
  6191. }, [this.slots('icon', {
  6192. checked: checked
  6193. }) || h(es_icon, {
  6194. "attrs": {
  6195. "name": "success"
  6196. },
  6197. "style": this.iconStyle
  6198. })]);
  6199. },
  6200. genLabel: function genLabel() {
  6201. var h = this.$createElement;
  6202. var slot = this.slots();
  6203. if (slot) {
  6204. return h("span", {
  6205. "class": bem('label', [this.labelPosition, {
  6206. disabled: this.isDisabled
  6207. }])
  6208. }, [slot]);
  6209. }
  6210. }
  6211. },
  6212. render: function render() {
  6213. var h = arguments[0];
  6214. var Children = [this.genIcon()];
  6215. if (this.labelPosition === 'left') {
  6216. Children.unshift(this.genLabel());
  6217. } else {
  6218. Children.push(this.genLabel());
  6219. }
  6220. return h("div", {
  6221. "attrs": {
  6222. "role": role,
  6223. "tabindex": this.tabindex,
  6224. "aria-checked": String(this.checked)
  6225. },
  6226. "class": bem([{
  6227. disabled: this.isDisabled,
  6228. 'label-disabled': this.labelDisabled
  6229. }, this.direction]),
  6230. "on": {
  6231. "click": this.onClick
  6232. }
  6233. }, [Children]);
  6234. }
  6235. };
  6236. };
  6237. // CONCATENATED MODULE: ./es/radio/index.js
  6238. var radio_createNamespace = Object(create["a" /* createNamespace */])('radio'),
  6239. radio_createComponent = radio_createNamespace[0],
  6240. radio_bem = radio_createNamespace[1];
  6241. /* harmony default export */ var es_radio = (radio_createComponent({
  6242. mixins: [checkbox_CheckboxMixin({
  6243. bem: radio_bem,
  6244. role: 'radio',
  6245. parent: 'vanRadio'
  6246. })],
  6247. computed: {
  6248. currentValue: {
  6249. get: function get() {
  6250. return this.parent ? this.parent.value : this.value;
  6251. },
  6252. set: function set(val) {
  6253. (this.parent || this).$emit('input', val);
  6254. }
  6255. },
  6256. checked: function checked() {
  6257. return this.currentValue === this.name;
  6258. }
  6259. },
  6260. methods: {
  6261. toggle: function toggle() {
  6262. this.currentValue = this.name;
  6263. }
  6264. }
  6265. }));
  6266. // CONCATENATED MODULE: ./es/address-list/Item.js
  6267. // Utils
  6268. // Components
  6269. // Types
  6270. var Item_createNamespace = Object(create["a" /* createNamespace */])('address-item'),
  6271. Item_createComponent = Item_createNamespace[0],
  6272. Item_bem = Item_createNamespace[1];
  6273. function AddressItem(h, props, slots, ctx) {
  6274. var disabled = props.disabled,
  6275. switchable = props.switchable;
  6276. function onClick() {
  6277. if (switchable) {
  6278. functional_emit(ctx, 'select');
  6279. }
  6280. functional_emit(ctx, 'click');
  6281. }
  6282. var genRightIcon = function genRightIcon() {
  6283. return h(es_icon, {
  6284. "attrs": {
  6285. "name": "edit"
  6286. },
  6287. "class": Item_bem('edit'),
  6288. "on": {
  6289. "click": function click(event) {
  6290. event.stopPropagation();
  6291. functional_emit(ctx, 'edit');
  6292. functional_emit(ctx, 'click');
  6293. }
  6294. }
  6295. });
  6296. };
  6297. function genTag() {
  6298. if (slots.tag) {
  6299. return slots.tag(_extends({}, props.data));
  6300. }
  6301. if (props.data.isDefault && props.defaultTagText) {
  6302. return h(es_tag, {
  6303. "attrs": {
  6304. "type": "danger",
  6305. "round": true
  6306. },
  6307. "class": Item_bem('tag')
  6308. }, [props.defaultTagText]);
  6309. }
  6310. }
  6311. function genContent() {
  6312. var data = props.data;
  6313. var Info = [h("div", {
  6314. "class": Item_bem('name')
  6315. }, [data.name + " " + data.tel, genTag()]), h("div", {
  6316. "class": Item_bem('address')
  6317. }, [data.address])];
  6318. if (switchable && !disabled) {
  6319. return h(es_radio, {
  6320. "attrs": {
  6321. "name": data.id,
  6322. "iconSize": 18
  6323. }
  6324. }, [Info]);
  6325. }
  6326. return Info;
  6327. }
  6328. return h("div", {
  6329. "class": Item_bem({
  6330. disabled: disabled
  6331. }),
  6332. "on": {
  6333. "click": onClick
  6334. }
  6335. }, [h(cell, helper_default()([{
  6336. "attrs": {
  6337. "border": false,
  6338. "valueClass": Item_bem('value')
  6339. },
  6340. "scopedSlots": {
  6341. default: genContent,
  6342. 'right-icon': genRightIcon
  6343. }
  6344. }, inherit(ctx)])), slots.bottom == null ? void 0 : slots.bottom(_extends({}, props.data, {
  6345. disabled: disabled
  6346. }))]);
  6347. }
  6348. AddressItem.props = {
  6349. data: Object,
  6350. disabled: Boolean,
  6351. switchable: Boolean,
  6352. defaultTagText: String
  6353. };
  6354. /* harmony default export */ var Item = (Item_createComponent(AddressItem));
  6355. // CONCATENATED MODULE: ./es/address-list/index.js
  6356. // Utils
  6357. // Components
  6358. // Types
  6359. var address_list_createNamespace = Object(create["a" /* createNamespace */])('address-list'),
  6360. address_list_createComponent = address_list_createNamespace[0],
  6361. address_list_bem = address_list_createNamespace[1],
  6362. address_list_t = address_list_createNamespace[2];
  6363. function AddressList(h, props, slots, ctx) {
  6364. function genList(list, disabled) {
  6365. if (!list) {
  6366. return;
  6367. }
  6368. return list.map(function (item, index) {
  6369. return h(Item, {
  6370. "attrs": {
  6371. "data": item,
  6372. "disabled": disabled,
  6373. "switchable": props.switchable,
  6374. "defaultTagText": props.defaultTagText
  6375. },
  6376. "key": item.id,
  6377. "scopedSlots": {
  6378. bottom: slots['item-bottom'],
  6379. tag: slots.tag
  6380. },
  6381. "on": {
  6382. "select": function select() {
  6383. functional_emit(ctx, disabled ? 'select-disabled' : 'select', item, index);
  6384. if (!disabled) {
  6385. functional_emit(ctx, 'input', item.id);
  6386. }
  6387. },
  6388. "edit": function edit() {
  6389. functional_emit(ctx, disabled ? 'edit-disabled' : 'edit', item, index);
  6390. },
  6391. "click": function click() {
  6392. functional_emit(ctx, 'click-item', item, index);
  6393. }
  6394. }
  6395. });
  6396. });
  6397. }
  6398. var List = genList(props.list);
  6399. var DisabledList = genList(props.disabledList, true);
  6400. return h("div", helper_default()([{
  6401. "class": address_list_bem()
  6402. }, inherit(ctx)]), [slots.top == null ? void 0 : slots.top(), h(radio_group, {
  6403. "attrs": {
  6404. "value": props.value
  6405. }
  6406. }, [List]), props.disabledText && h("div", {
  6407. "class": address_list_bem('disabled-text')
  6408. }, [props.disabledText]), DisabledList, slots.default == null ? void 0 : slots.default(), h("div", {
  6409. "class": address_list_bem('bottom')
  6410. }, [h(es_button, {
  6411. "attrs": {
  6412. "round": true,
  6413. "block": true,
  6414. "type": "danger",
  6415. "text": props.addButtonText || address_list_t('add')
  6416. },
  6417. "class": address_list_bem('add'),
  6418. "on": {
  6419. "click": function click() {
  6420. functional_emit(ctx, 'add');
  6421. }
  6422. }
  6423. })])]);
  6424. }
  6425. AddressList.props = {
  6426. list: Array,
  6427. value: [Number, String],
  6428. disabledList: Array,
  6429. disabledText: String,
  6430. addButtonText: String,
  6431. defaultTagText: String,
  6432. switchable: {
  6433. type: Boolean,
  6434. default: true
  6435. }
  6436. };
  6437. /* harmony default export */ var address_list = (address_list_createComponent(AddressList));
  6438. // EXTERNAL MODULE: ./es/utils/validate/number.js
  6439. var number = __webpack_require__(5);
  6440. // CONCATENATED MODULE: ./es/badge/index.js
  6441. var badge_createNamespace = Object(create["a" /* createNamespace */])('badge'),
  6442. badge_createComponent = badge_createNamespace[0],
  6443. badge_bem = badge_createNamespace[1];
  6444. /* harmony default export */ var badge = (badge_createComponent({
  6445. props: {
  6446. dot: Boolean,
  6447. max: [Number, String],
  6448. color: String,
  6449. content: [Number, String],
  6450. tag: {
  6451. type: String,
  6452. default: 'div'
  6453. }
  6454. },
  6455. methods: {
  6456. hasContent: function hasContent() {
  6457. return !!(this.$scopedSlots.content || Object(utils["c" /* isDef */])(this.content) && this.content !== '');
  6458. },
  6459. renderContent: function renderContent() {
  6460. var dot = this.dot,
  6461. max = this.max,
  6462. content = this.content;
  6463. if (!dot && this.hasContent()) {
  6464. if (this.$scopedSlots.content) {
  6465. return this.$scopedSlots.content();
  6466. }
  6467. if (Object(utils["c" /* isDef */])(max) && Object(number["b" /* isNumeric */])(content) && +content > max) {
  6468. return max + "+";
  6469. }
  6470. return content;
  6471. }
  6472. },
  6473. renderBadge: function renderBadge() {
  6474. var h = this.$createElement;
  6475. if (this.hasContent() || this.dot) {
  6476. return h("div", {
  6477. "class": badge_bem({
  6478. dot: this.dot,
  6479. fixed: !!this.$scopedSlots.default
  6480. }),
  6481. "style": {
  6482. background: this.color
  6483. }
  6484. }, [this.renderContent()]);
  6485. }
  6486. }
  6487. },
  6488. render: function render() {
  6489. var h = arguments[0];
  6490. if (this.$scopedSlots.default) {
  6491. var tag = this.tag;
  6492. return h(tag, {
  6493. "class": badge_bem('wrapper')
  6494. }, [this.$scopedSlots.default(), this.renderBadge()]);
  6495. }
  6496. return this.renderBadge();
  6497. }
  6498. }));
  6499. // EXTERNAL MODULE: ./es/utils/dom/raf.js
  6500. var raf = __webpack_require__(4);
  6501. // CONCATENATED MODULE: ./es/utils/validate/date.js
  6502. function isDate(val) {
  6503. return Object.prototype.toString.call(val) === '[object Date]' && !Object(number["a" /* isNaN */])(val.getTime());
  6504. }
  6505. // CONCATENATED MODULE: ./es/calendar/utils.js
  6506. var utils_createNamespace = Object(create["a" /* createNamespace */])('calendar'),
  6507. utils_createComponent = utils_createNamespace[0],
  6508. utils_bem = utils_createNamespace[1],
  6509. utils_t = utils_createNamespace[2];
  6510. function formatMonthTitle(date) {
  6511. return utils_t('monthTitle', date.getFullYear(), date.getMonth() + 1);
  6512. }
  6513. function compareMonth(date1, date2) {
  6514. var year1 = date1.getFullYear();
  6515. var year2 = date2.getFullYear();
  6516. var month1 = date1.getMonth();
  6517. var month2 = date2.getMonth();
  6518. if (year1 === year2) {
  6519. return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
  6520. }
  6521. return year1 > year2 ? 1 : -1;
  6522. }
  6523. function compareDay(day1, day2) {
  6524. var compareMonthResult = compareMonth(day1, day2);
  6525. if (compareMonthResult === 0) {
  6526. var date1 = day1.getDate();
  6527. var date2 = day2.getDate();
  6528. return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
  6529. }
  6530. return compareMonthResult;
  6531. }
  6532. function getDayByOffset(date, offset) {
  6533. date = new Date(date);
  6534. date.setDate(date.getDate() + offset);
  6535. return date;
  6536. }
  6537. function getPrevDay(date) {
  6538. return getDayByOffset(date, -1);
  6539. }
  6540. function getNextDay(date) {
  6541. return getDayByOffset(date, 1);
  6542. }
  6543. function calcDateNum(date) {
  6544. var day1 = date[0].getTime();
  6545. var day2 = date[1].getTime();
  6546. return (day2 - day1) / (1000 * 60 * 60 * 24) + 1;
  6547. }
  6548. function copyDate(dates) {
  6549. return new Date(dates);
  6550. }
  6551. function copyDates(dates) {
  6552. if (Array.isArray(dates)) {
  6553. return dates.map(function (date) {
  6554. if (date === null) {
  6555. return date;
  6556. }
  6557. return copyDate(date);
  6558. });
  6559. }
  6560. return copyDate(dates);
  6561. }
  6562. // CONCATENATED MODULE: ./es/datetime-picker/utils.js
  6563. function times(n, iteratee) {
  6564. if (n < 0) {
  6565. return [];
  6566. }
  6567. var index = -1;
  6568. var result = Array(n);
  6569. while (++index < n) {
  6570. result[index] = iteratee(index);
  6571. }
  6572. return result;
  6573. }
  6574. function getTrueValue(value) {
  6575. if (!value) {
  6576. return 0;
  6577. }
  6578. while (Object(number["a" /* isNaN */])(parseInt(value, 10))) {
  6579. if (value.length > 1) {
  6580. value = value.slice(1);
  6581. } else {
  6582. return 0;
  6583. }
  6584. }
  6585. return parseInt(value, 10);
  6586. }
  6587. function getMonthEndDay(year, month) {
  6588. return 32 - new Date(year, month - 1, 32).getDate();
  6589. }
  6590. // CONCATENATED MODULE: ./es/calendar/components/Month.js
  6591. var Month_createNamespace = Object(create["a" /* createNamespace */])('calendar-month'),
  6592. Month_createComponent = Month_createNamespace[0];
  6593. /* harmony default export */ var Month = (Month_createComponent({
  6594. props: {
  6595. date: Date,
  6596. type: String,
  6597. color: String,
  6598. minDate: Date,
  6599. maxDate: Date,
  6600. showMark: Boolean,
  6601. rowHeight: [Number, String],
  6602. formatter: Function,
  6603. lazyRender: Boolean,
  6604. currentDate: [Date, Array],
  6605. allowSameDay: Boolean,
  6606. showSubtitle: Boolean,
  6607. showMonthTitle: Boolean,
  6608. firstDayOfWeek: Number
  6609. },
  6610. data: function data() {
  6611. return {
  6612. visible: false
  6613. };
  6614. },
  6615. computed: {
  6616. title: function title() {
  6617. return formatMonthTitle(this.date);
  6618. },
  6619. rowHeightWithUnit: function rowHeightWithUnit() {
  6620. return Object(unit["a" /* addUnit */])(this.rowHeight);
  6621. },
  6622. offset: function offset() {
  6623. var firstDayOfWeek = this.firstDayOfWeek;
  6624. var realDay = this.date.getDay();
  6625. if (!firstDayOfWeek) {
  6626. return realDay;
  6627. }
  6628. return (realDay + 7 - this.firstDayOfWeek) % 7;
  6629. },
  6630. totalDay: function totalDay() {
  6631. return getMonthEndDay(this.date.getFullYear(), this.date.getMonth() + 1);
  6632. },
  6633. shouldRender: function shouldRender() {
  6634. return this.visible || !this.lazyRender;
  6635. },
  6636. placeholders: function placeholders() {
  6637. var rows = [];
  6638. var count = Math.ceil((this.totalDay + this.offset) / 7);
  6639. for (var day = 1; day <= count; day++) {
  6640. rows.push({
  6641. type: 'placeholder'
  6642. });
  6643. }
  6644. return rows;
  6645. },
  6646. days: function days() {
  6647. var days = [];
  6648. var year = this.date.getFullYear();
  6649. var month = this.date.getMonth();
  6650. for (var day = 1; day <= this.totalDay; day++) {
  6651. var date = new Date(year, month, day);
  6652. var type = this.getDayType(date);
  6653. var config = {
  6654. date: date,
  6655. type: type,
  6656. text: day,
  6657. bottomInfo: this.getBottomInfo(type)
  6658. };
  6659. if (this.formatter) {
  6660. config = this.formatter(config);
  6661. }
  6662. days.push(config);
  6663. }
  6664. return days;
  6665. }
  6666. },
  6667. methods: {
  6668. getHeight: function getHeight() {
  6669. var _this$$el;
  6670. return ((_this$$el = this.$el) == null ? void 0 : _this$$el.getBoundingClientRect().height) || 0;
  6671. },
  6672. scrollIntoView: function scrollIntoView(body) {
  6673. var _this$$refs = this.$refs,
  6674. days = _this$$refs.days,
  6675. month = _this$$refs.month;
  6676. var el = this.showSubtitle ? days : month;
  6677. var scrollTop = el.getBoundingClientRect().top - body.getBoundingClientRect().top + body.scrollTop;
  6678. setScrollTop(body, scrollTop);
  6679. },
  6680. getMultipleDayType: function getMultipleDayType(day) {
  6681. var _this = this;
  6682. var isSelected = function isSelected(date) {
  6683. return _this.currentDate.some(function (item) {
  6684. return compareDay(item, date) === 0;
  6685. });
  6686. };
  6687. if (isSelected(day)) {
  6688. var prevDay = getPrevDay(day);
  6689. var nextDay = getNextDay(day);
  6690. var prevSelected = isSelected(prevDay);
  6691. var nextSelected = isSelected(nextDay);
  6692. if (prevSelected && nextSelected) {
  6693. return 'multiple-middle';
  6694. }
  6695. if (prevSelected) {
  6696. return 'end';
  6697. }
  6698. return nextSelected ? 'start' : 'multiple-selected';
  6699. }
  6700. return '';
  6701. },
  6702. getRangeDayType: function getRangeDayType(day) {
  6703. var _this$currentDate = this.currentDate,
  6704. startDay = _this$currentDate[0],
  6705. endDay = _this$currentDate[1];
  6706. if (!startDay) {
  6707. return '';
  6708. }
  6709. var compareToStart = compareDay(day, startDay);
  6710. if (!endDay) {
  6711. return compareToStart === 0 ? 'start' : '';
  6712. }
  6713. var compareToEnd = compareDay(day, endDay);
  6714. if (compareToStart === 0 && compareToEnd === 0 && this.allowSameDay) {
  6715. return 'start-end';
  6716. }
  6717. if (compareToStart === 0) {
  6718. return 'start';
  6719. }
  6720. if (compareToEnd === 0) {
  6721. return 'end';
  6722. }
  6723. if (compareToStart > 0 && compareToEnd < 0) {
  6724. return 'middle';
  6725. }
  6726. },
  6727. getDayType: function getDayType(day) {
  6728. var type = this.type,
  6729. minDate = this.minDate,
  6730. maxDate = this.maxDate,
  6731. currentDate = this.currentDate;
  6732. if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) {
  6733. return 'disabled';
  6734. }
  6735. if (currentDate === null) {
  6736. return;
  6737. }
  6738. if (type === 'single') {
  6739. return compareDay(day, currentDate) === 0 ? 'selected' : '';
  6740. }
  6741. if (type === 'multiple') {
  6742. return this.getMultipleDayType(day);
  6743. }
  6744. /* istanbul ignore else */
  6745. if (type === 'range') {
  6746. return this.getRangeDayType(day);
  6747. }
  6748. },
  6749. getBottomInfo: function getBottomInfo(type) {
  6750. if (this.type === 'range') {
  6751. if (type === 'start' || type === 'end') {
  6752. return utils_t(type);
  6753. }
  6754. if (type === 'start-end') {
  6755. return utils_t('startEnd');
  6756. }
  6757. }
  6758. },
  6759. getDayStyle: function getDayStyle(type, index) {
  6760. var style = {
  6761. height: this.rowHeightWithUnit
  6762. };
  6763. if (type === 'placeholder') {
  6764. style.width = '100%';
  6765. return style;
  6766. }
  6767. if (index === 0) {
  6768. style.marginLeft = 100 * this.offset / 7 + "%";
  6769. }
  6770. if (this.color) {
  6771. if (type === 'start' || type === 'end' || type === 'start-end' || type === 'multiple-selected' || type === 'multiple-middle') {
  6772. style.background = this.color;
  6773. } else if (type === 'middle') {
  6774. style.color = this.color;
  6775. }
  6776. }
  6777. return style;
  6778. },
  6779. genTitle: function genTitle() {
  6780. var h = this.$createElement;
  6781. if (this.showMonthTitle) {
  6782. return h("div", {
  6783. "class": utils_bem('month-title')
  6784. }, [this.title]);
  6785. }
  6786. },
  6787. genMark: function genMark() {
  6788. var h = this.$createElement;
  6789. if (this.showMark && this.shouldRender) {
  6790. return h("div", {
  6791. "class": utils_bem('month-mark')
  6792. }, [this.date.getMonth() + 1]);
  6793. }
  6794. },
  6795. genDays: function genDays() {
  6796. var h = this.$createElement;
  6797. var days = this.shouldRender ? this.days : this.placeholders;
  6798. return h("div", {
  6799. "ref": "days",
  6800. "attrs": {
  6801. "role": "grid"
  6802. },
  6803. "class": utils_bem('days')
  6804. }, [this.genMark(), days.map(this.genDay)]);
  6805. },
  6806. genTopInfo: function genTopInfo(item) {
  6807. var h = this.$createElement;
  6808. var slot = this.$scopedSlots['top-info'];
  6809. if (item.topInfo || slot) {
  6810. return h("div", {
  6811. "class": utils_bem('top-info')
  6812. }, [slot ? slot(item) : item.topInfo]);
  6813. }
  6814. },
  6815. genBottomInfo: function genBottomInfo(item) {
  6816. var h = this.$createElement;
  6817. var slot = this.$scopedSlots['bottom-info'];
  6818. if (item.bottomInfo || slot) {
  6819. return h("div", {
  6820. "class": utils_bem('bottom-info')
  6821. }, [slot ? slot(item) : item.bottomInfo]);
  6822. }
  6823. },
  6824. genDay: function genDay(item, index) {
  6825. var _this2 = this;
  6826. var h = this.$createElement;
  6827. var type = item.type;
  6828. var style = this.getDayStyle(type, index);
  6829. var disabled = type === 'disabled';
  6830. var onClick = function onClick() {
  6831. if (!disabled) {
  6832. _this2.$emit('click', item);
  6833. }
  6834. };
  6835. if (type === 'selected') {
  6836. return h("div", {
  6837. "attrs": {
  6838. "role": "gridcell",
  6839. "tabindex": -1
  6840. },
  6841. "style": style,
  6842. "class": [utils_bem('day'), item.className],
  6843. "on": {
  6844. "click": onClick
  6845. }
  6846. }, [h("div", {
  6847. "class": utils_bem('selected-day'),
  6848. "style": {
  6849. width: this.rowHeightWithUnit,
  6850. height: this.rowHeightWithUnit,
  6851. background: this.color
  6852. }
  6853. }, [this.genTopInfo(item), item.text, this.genBottomInfo(item)])]);
  6854. }
  6855. return h("div", {
  6856. "attrs": {
  6857. "role": "gridcell",
  6858. "tabindex": disabled ? null : -1
  6859. },
  6860. "style": style,
  6861. "class": [utils_bem('day', type), item.className],
  6862. "on": {
  6863. "click": onClick
  6864. }
  6865. }, [this.genTopInfo(item), item.text, this.genBottomInfo(item)]);
  6866. }
  6867. },
  6868. render: function render() {
  6869. var h = arguments[0];
  6870. return h("div", {
  6871. "class": utils_bem('month'),
  6872. "ref": "month"
  6873. }, [this.genTitle(), this.genDays()]);
  6874. }
  6875. }));
  6876. // CONCATENATED MODULE: ./es/calendar/components/Header.js
  6877. var Header_createNamespace = Object(create["a" /* createNamespace */])('calendar-header'),
  6878. Header_createComponent = Header_createNamespace[0];
  6879. /* harmony default export */ var components_Header = (Header_createComponent({
  6880. props: {
  6881. title: String,
  6882. subtitle: String,
  6883. showTitle: Boolean,
  6884. showSubtitle: Boolean,
  6885. firstDayOfWeek: Number
  6886. },
  6887. methods: {
  6888. genTitle: function genTitle() {
  6889. var h = this.$createElement;
  6890. if (this.showTitle) {
  6891. var title = this.slots('title') || this.title || utils_t('title');
  6892. return h("div", {
  6893. "class": utils_bem('header-title')
  6894. }, [title]);
  6895. }
  6896. },
  6897. genSubtitle: function genSubtitle() {
  6898. var h = this.$createElement;
  6899. if (this.showSubtitle) {
  6900. return h("div", {
  6901. "class": utils_bem('header-subtitle')
  6902. }, [this.subtitle]);
  6903. }
  6904. },
  6905. genWeekDays: function genWeekDays() {
  6906. var h = this.$createElement;
  6907. var weekdays = utils_t('weekdays');
  6908. var firstDayOfWeek = this.firstDayOfWeek;
  6909. var renderWeekDays = [].concat(weekdays.slice(firstDayOfWeek, 7), weekdays.slice(0, firstDayOfWeek));
  6910. return h("div", {
  6911. "class": utils_bem('weekdays')
  6912. }, [renderWeekDays.map(function (item) {
  6913. return h("span", {
  6914. "class": utils_bem('weekday')
  6915. }, [item]);
  6916. })]);
  6917. }
  6918. },
  6919. render: function render() {
  6920. var h = arguments[0];
  6921. return h("div", {
  6922. "class": utils_bem('header')
  6923. }, [this.genTitle(), this.genSubtitle(), this.genWeekDays()]);
  6924. }
  6925. }));
  6926. // CONCATENATED MODULE: ./es/calendar/index.js
  6927. // Utils
  6928. // Components
  6929. /* harmony default export */ var calendar = (utils_createComponent({
  6930. props: {
  6931. title: String,
  6932. color: String,
  6933. value: Boolean,
  6934. readonly: Boolean,
  6935. formatter: Function,
  6936. rowHeight: [Number, String],
  6937. confirmText: String,
  6938. rangePrompt: String,
  6939. defaultDate: [Date, Array],
  6940. getContainer: [String, Function],
  6941. allowSameDay: Boolean,
  6942. confirmDisabledText: String,
  6943. type: {
  6944. type: String,
  6945. default: 'single'
  6946. },
  6947. round: {
  6948. type: Boolean,
  6949. default: true
  6950. },
  6951. position: {
  6952. type: String,
  6953. default: 'bottom'
  6954. },
  6955. poppable: {
  6956. type: Boolean,
  6957. default: true
  6958. },
  6959. maxRange: {
  6960. type: [Number, String],
  6961. default: null
  6962. },
  6963. lazyRender: {
  6964. type: Boolean,
  6965. default: true
  6966. },
  6967. showMark: {
  6968. type: Boolean,
  6969. default: true
  6970. },
  6971. showTitle: {
  6972. type: Boolean,
  6973. default: true
  6974. },
  6975. showConfirm: {
  6976. type: Boolean,
  6977. default: true
  6978. },
  6979. showSubtitle: {
  6980. type: Boolean,
  6981. default: true
  6982. },
  6983. closeOnPopstate: {
  6984. type: Boolean,
  6985. default: true
  6986. },
  6987. closeOnClickOverlay: {
  6988. type: Boolean,
  6989. default: true
  6990. },
  6991. safeAreaInsetBottom: {
  6992. type: Boolean,
  6993. default: true
  6994. },
  6995. minDate: {
  6996. type: Date,
  6997. validator: isDate,
  6998. default: function _default() {
  6999. return new Date();
  7000. }
  7001. },
  7002. maxDate: {
  7003. type: Date,
  7004. validator: isDate,
  7005. default: function _default() {
  7006. var now = new Date();
  7007. return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
  7008. }
  7009. },
  7010. firstDayOfWeek: {
  7011. type: [Number, String],
  7012. default: 0,
  7013. validator: function validator(val) {
  7014. return val >= 0 && val <= 6;
  7015. }
  7016. }
  7017. },
  7018. inject: {
  7019. vanPopup: {
  7020. default: null
  7021. }
  7022. },
  7023. data: function data() {
  7024. return {
  7025. subtitle: '',
  7026. currentDate: this.getInitialDate()
  7027. };
  7028. },
  7029. computed: {
  7030. months: function months() {
  7031. var months = [];
  7032. var cursor = new Date(this.minDate);
  7033. cursor.setDate(1);
  7034. do {
  7035. months.push(new Date(cursor));
  7036. cursor.setMonth(cursor.getMonth() + 1);
  7037. } while (compareMonth(cursor, this.maxDate) !== 1);
  7038. return months;
  7039. },
  7040. buttonDisabled: function buttonDisabled() {
  7041. var type = this.type,
  7042. currentDate = this.currentDate;
  7043. if (currentDate) {
  7044. if (type === 'range') {
  7045. return !currentDate[0] || !currentDate[1];
  7046. }
  7047. if (type === 'multiple') {
  7048. return !currentDate.length;
  7049. }
  7050. }
  7051. return !currentDate;
  7052. },
  7053. dayOffset: function dayOffset() {
  7054. return this.firstDayOfWeek ? this.firstDayOfWeek % 7 : 0;
  7055. }
  7056. },
  7057. watch: {
  7058. value: 'init',
  7059. type: function type() {
  7060. this.reset();
  7061. },
  7062. defaultDate: function defaultDate(val) {
  7063. this.currentDate = val;
  7064. this.scrollIntoView();
  7065. }
  7066. },
  7067. mounted: function mounted() {
  7068. this.init(); // https://github.com/vant-ui/vant/issues/9845
  7069. if (!this.poppable) {
  7070. var _this$vanPopup;
  7071. (_this$vanPopup = this.vanPopup) == null ? void 0 : _this$vanPopup.$on('opened', this.onScroll);
  7072. }
  7073. },
  7074. /* istanbul ignore next */
  7075. activated: function activated() {
  7076. this.init();
  7077. },
  7078. methods: {
  7079. // @exposed-api
  7080. reset: function reset(date) {
  7081. if (date === void 0) {
  7082. date = this.getInitialDate();
  7083. }
  7084. this.currentDate = date;
  7085. this.scrollIntoView();
  7086. },
  7087. init: function init() {
  7088. var _this = this;
  7089. if (this.poppable && !this.value) {
  7090. return;
  7091. }
  7092. this.$nextTick(function () {
  7093. // add Math.floor to avoid decimal height issues
  7094. // https://github.com/vant-ui/vant/issues/5640
  7095. _this.bodyHeight = Math.floor(_this.$refs.body.getBoundingClientRect().height);
  7096. _this.onScroll();
  7097. _this.scrollIntoView();
  7098. });
  7099. },
  7100. // @exposed-api
  7101. scrollToDate: function scrollToDate(targetDate) {
  7102. var _this2 = this;
  7103. Object(raf["c" /* raf */])(function () {
  7104. var displayed = _this2.value || !_this2.poppable;
  7105. /* istanbul ignore if */
  7106. if (!targetDate || !displayed) {
  7107. return;
  7108. }
  7109. _this2.months.some(function (month, index) {
  7110. if (compareMonth(month, targetDate) === 0) {
  7111. var _this2$$refs = _this2.$refs,
  7112. body = _this2$$refs.body,
  7113. months = _this2$$refs.months;
  7114. months[index].scrollIntoView(body);
  7115. return true;
  7116. }
  7117. return false;
  7118. });
  7119. _this2.onScroll();
  7120. });
  7121. },
  7122. // scroll to current month
  7123. scrollIntoView: function scrollIntoView() {
  7124. var currentDate = this.currentDate;
  7125. if (currentDate) {
  7126. var targetDate = this.type === 'single' ? currentDate : currentDate[0];
  7127. this.scrollToDate(targetDate);
  7128. }
  7129. },
  7130. getInitialDate: function getInitialDate() {
  7131. var type = this.type,
  7132. minDate = this.minDate,
  7133. maxDate = this.maxDate,
  7134. defaultDate = this.defaultDate;
  7135. if (defaultDate === null) {
  7136. return defaultDate;
  7137. }
  7138. var defaultVal = new Date();
  7139. if (compareDay(defaultVal, minDate) === -1) {
  7140. defaultVal = minDate;
  7141. } else if (compareDay(defaultVal, maxDate) === 1) {
  7142. defaultVal = maxDate;
  7143. }
  7144. if (type === 'range') {
  7145. var _ref = defaultDate || [],
  7146. startDay = _ref[0],
  7147. endDay = _ref[1];
  7148. return [startDay || defaultVal, endDay || getNextDay(defaultVal)];
  7149. }
  7150. if (type === 'multiple') {
  7151. return defaultDate || [defaultVal];
  7152. }
  7153. return defaultDate || defaultVal;
  7154. },
  7155. // calculate the position of the elements
  7156. // and find the elements that needs to be rendered
  7157. onScroll: function onScroll() {
  7158. var _this$$refs = this.$refs,
  7159. body = _this$$refs.body,
  7160. months = _this$$refs.months;
  7161. var top = getScrollTop(body);
  7162. var bottom = top + this.bodyHeight;
  7163. var heights = months.map(function (item) {
  7164. return item.getHeight();
  7165. });
  7166. var heightSum = heights.reduce(function (a, b) {
  7167. return a + b;
  7168. }, 0); // iOS scroll bounce may exceed the range
  7169. if (bottom > heightSum && top > 0) {
  7170. return;
  7171. }
  7172. var height = 0;
  7173. var currentMonth;
  7174. var visibleRange = [-1, -1];
  7175. for (var i = 0; i < months.length; i++) {
  7176. var visible = height <= bottom && height + heights[i] >= top;
  7177. if (visible) {
  7178. visibleRange[1] = i;
  7179. if (!currentMonth) {
  7180. currentMonth = months[i];
  7181. visibleRange[0] = i;
  7182. }
  7183. if (!months[i].showed) {
  7184. months[i].showed = true;
  7185. this.$emit('month-show', {
  7186. date: months[i].date,
  7187. title: months[i].title
  7188. });
  7189. }
  7190. }
  7191. height += heights[i];
  7192. }
  7193. months.forEach(function (month, index) {
  7194. month.visible = index >= visibleRange[0] - 1 && index <= visibleRange[1] + 1;
  7195. });
  7196. /* istanbul ignore else */
  7197. if (currentMonth) {
  7198. this.subtitle = currentMonth.title;
  7199. }
  7200. },
  7201. onClickDay: function onClickDay(item) {
  7202. if (this.readonly) {
  7203. return;
  7204. }
  7205. var date = item.date;
  7206. var type = this.type,
  7207. currentDate = this.currentDate;
  7208. if (type === 'range') {
  7209. if (!currentDate) {
  7210. this.select([date, null]);
  7211. return;
  7212. }
  7213. var startDay = currentDate[0],
  7214. endDay = currentDate[1];
  7215. if (startDay && !endDay) {
  7216. var compareToStart = compareDay(date, startDay);
  7217. if (compareToStart === 1) {
  7218. this.select([startDay, date], true);
  7219. } else if (compareToStart === -1) {
  7220. this.select([date, null]);
  7221. } else if (this.allowSameDay) {
  7222. this.select([date, date], true);
  7223. }
  7224. } else {
  7225. this.select([date, null]);
  7226. }
  7227. } else if (type === 'multiple') {
  7228. if (!currentDate) {
  7229. this.select([date]);
  7230. return;
  7231. }
  7232. var selectedIndex;
  7233. var selected = this.currentDate.some(function (dateItem, index) {
  7234. var equal = compareDay(dateItem, date) === 0;
  7235. if (equal) {
  7236. selectedIndex = index;
  7237. }
  7238. return equal;
  7239. });
  7240. if (selected) {
  7241. var _currentDate$splice = currentDate.splice(selectedIndex, 1),
  7242. unselectedDate = _currentDate$splice[0];
  7243. this.$emit('unselect', copyDate(unselectedDate));
  7244. } else if (this.maxRange && currentDate.length >= this.maxRange) {
  7245. es_toast(this.rangePrompt || utils_t('rangePrompt', this.maxRange));
  7246. } else {
  7247. this.select([].concat(currentDate, [date]));
  7248. }
  7249. } else {
  7250. this.select(date, true);
  7251. }
  7252. },
  7253. togglePopup: function togglePopup(val) {
  7254. this.$emit('input', val);
  7255. },
  7256. select: function select(date, complete) {
  7257. var _this3 = this;
  7258. var emit = function emit(date) {
  7259. _this3.currentDate = date;
  7260. _this3.$emit('select', copyDates(_this3.currentDate));
  7261. };
  7262. if (complete && this.type === 'range') {
  7263. var valid = this.checkRange(date);
  7264. if (!valid) {
  7265. // auto selected to max range if showConfirm
  7266. if (this.showConfirm) {
  7267. emit([date[0], getDayByOffset(date[0], this.maxRange - 1)]);
  7268. } else {
  7269. emit(date);
  7270. }
  7271. return;
  7272. }
  7273. }
  7274. emit(date);
  7275. if (complete && !this.showConfirm) {
  7276. this.onConfirm();
  7277. }
  7278. },
  7279. checkRange: function checkRange(date) {
  7280. var maxRange = this.maxRange,
  7281. rangePrompt = this.rangePrompt;
  7282. if (maxRange && calcDateNum(date) > maxRange) {
  7283. es_toast(rangePrompt || utils_t('rangePrompt', maxRange));
  7284. return false;
  7285. }
  7286. return true;
  7287. },
  7288. onConfirm: function onConfirm() {
  7289. this.$emit('confirm', copyDates(this.currentDate));
  7290. },
  7291. genMonth: function genMonth(date, index) {
  7292. var h = this.$createElement;
  7293. var showMonthTitle = index !== 0 || !this.showSubtitle;
  7294. return h(Month, {
  7295. "ref": "months",
  7296. "refInFor": true,
  7297. "attrs": {
  7298. "date": date,
  7299. "type": this.type,
  7300. "color": this.color,
  7301. "minDate": this.minDate,
  7302. "maxDate": this.maxDate,
  7303. "showMark": this.showMark,
  7304. "formatter": this.formatter,
  7305. "rowHeight": this.rowHeight,
  7306. "lazyRender": this.lazyRender,
  7307. "currentDate": this.currentDate,
  7308. "showSubtitle": this.showSubtitle,
  7309. "allowSameDay": this.allowSameDay,
  7310. "showMonthTitle": showMonthTitle,
  7311. "firstDayOfWeek": this.dayOffset
  7312. },
  7313. "scopedSlots": {
  7314. 'top-info': this.$scopedSlots['top-info'],
  7315. 'bottom-info': this.$scopedSlots['bottom-info']
  7316. },
  7317. "on": {
  7318. "click": this.onClickDay
  7319. }
  7320. });
  7321. },
  7322. genFooterContent: function genFooterContent() {
  7323. var h = this.$createElement;
  7324. var slot = this.slots('footer');
  7325. if (slot) {
  7326. return slot;
  7327. }
  7328. if (this.showConfirm) {
  7329. var text = this.buttonDisabled ? this.confirmDisabledText : this.confirmText;
  7330. return h(es_button, {
  7331. "attrs": {
  7332. "round": true,
  7333. "block": true,
  7334. "type": "danger",
  7335. "color": this.color,
  7336. "disabled": this.buttonDisabled,
  7337. "nativeType": "button"
  7338. },
  7339. "class": utils_bem('confirm'),
  7340. "on": {
  7341. "click": this.onConfirm
  7342. }
  7343. }, [text || utils_t('confirm')]);
  7344. }
  7345. },
  7346. genFooter: function genFooter() {
  7347. var h = this.$createElement;
  7348. return h("div", {
  7349. "class": utils_bem('footer', {
  7350. unfit: !this.safeAreaInsetBottom
  7351. })
  7352. }, [this.genFooterContent()]);
  7353. },
  7354. genCalendar: function genCalendar() {
  7355. var _this4 = this;
  7356. var h = this.$createElement;
  7357. return h("div", {
  7358. "class": utils_bem()
  7359. }, [h(components_Header, {
  7360. "attrs": {
  7361. "title": this.title,
  7362. "showTitle": this.showTitle,
  7363. "subtitle": this.subtitle,
  7364. "showSubtitle": this.showSubtitle,
  7365. "firstDayOfWeek": this.dayOffset
  7366. },
  7367. "scopedSlots": {
  7368. title: function title() {
  7369. return _this4.slots('title');
  7370. }
  7371. }
  7372. }), h("div", {
  7373. "ref": "body",
  7374. "class": utils_bem('body'),
  7375. "on": {
  7376. "scroll": this.onScroll
  7377. }
  7378. }, [this.months.map(this.genMonth)]), this.genFooter()]);
  7379. }
  7380. },
  7381. render: function render() {
  7382. var _this5 = this;
  7383. var h = arguments[0];
  7384. if (this.poppable) {
  7385. var _attrs;
  7386. var createListener = function createListener(name) {
  7387. return function () {
  7388. return _this5.$emit(name);
  7389. };
  7390. };
  7391. return h(popup, {
  7392. "attrs": (_attrs = {
  7393. "round": true,
  7394. "value": this.value
  7395. }, _attrs["round"] = this.round, _attrs["position"] = this.position, _attrs["closeable"] = this.showTitle || this.showSubtitle, _attrs["getContainer"] = this.getContainer, _attrs["closeOnPopstate"] = this.closeOnPopstate, _attrs["closeOnClickOverlay"] = this.closeOnClickOverlay, _attrs),
  7396. "class": utils_bem('popup'),
  7397. "on": {
  7398. "input": this.togglePopup,
  7399. "open": createListener('open'),
  7400. "opened": createListener('opened'),
  7401. "close": createListener('close'),
  7402. "closed": createListener('closed')
  7403. }
  7404. }, [this.genCalendar()]);
  7405. }
  7406. return this.genCalendar();
  7407. }
  7408. }));
  7409. // CONCATENATED MODULE: ./es/image/index.js
  7410. var image_createNamespace = Object(create["a" /* createNamespace */])('image'),
  7411. image_createComponent = image_createNamespace[0],
  7412. image_bem = image_createNamespace[1];
  7413. /* harmony default export */ var es_image = (image_createComponent({
  7414. props: {
  7415. src: String,
  7416. fit: String,
  7417. alt: String,
  7418. round: Boolean,
  7419. width: [Number, String],
  7420. height: [Number, String],
  7421. radius: [Number, String],
  7422. lazyLoad: Boolean,
  7423. iconPrefix: String,
  7424. showError: {
  7425. type: Boolean,
  7426. default: true
  7427. },
  7428. showLoading: {
  7429. type: Boolean,
  7430. default: true
  7431. },
  7432. errorIcon: {
  7433. type: String,
  7434. default: 'photo-fail'
  7435. },
  7436. loadingIcon: {
  7437. type: String,
  7438. default: 'photo'
  7439. }
  7440. },
  7441. data: function data() {
  7442. return {
  7443. loading: true,
  7444. error: false
  7445. };
  7446. },
  7447. watch: {
  7448. src: function src() {
  7449. this.loading = true;
  7450. this.error = false;
  7451. }
  7452. },
  7453. computed: {
  7454. style: function style() {
  7455. var style = {};
  7456. if (Object(utils["c" /* isDef */])(this.width)) {
  7457. style.width = Object(unit["a" /* addUnit */])(this.width);
  7458. }
  7459. if (Object(utils["c" /* isDef */])(this.height)) {
  7460. style.height = Object(unit["a" /* addUnit */])(this.height);
  7461. }
  7462. if (Object(utils["c" /* isDef */])(this.radius)) {
  7463. style.overflow = 'hidden';
  7464. style.borderRadius = Object(unit["a" /* addUnit */])(this.radius);
  7465. }
  7466. return style;
  7467. }
  7468. },
  7469. created: function created() {
  7470. var $Lazyload = this.$Lazyload;
  7471. if ($Lazyload && utils["b" /* inBrowser */]) {
  7472. $Lazyload.$on('loaded', this.onLazyLoaded);
  7473. $Lazyload.$on('error', this.onLazyLoadError);
  7474. }
  7475. },
  7476. beforeDestroy: function beforeDestroy() {
  7477. var $Lazyload = this.$Lazyload;
  7478. if ($Lazyload) {
  7479. $Lazyload.$off('loaded', this.onLazyLoaded);
  7480. $Lazyload.$off('error', this.onLazyLoadError);
  7481. }
  7482. },
  7483. methods: {
  7484. onLoad: function onLoad(event) {
  7485. this.loading = false;
  7486. this.$emit('load', event);
  7487. },
  7488. onLazyLoaded: function onLazyLoaded(_ref) {
  7489. var el = _ref.el;
  7490. if (el === this.$refs.image && this.loading) {
  7491. this.onLoad();
  7492. }
  7493. },
  7494. onLazyLoadError: function onLazyLoadError(_ref2) {
  7495. var el = _ref2.el;
  7496. if (el === this.$refs.image && !this.error) {
  7497. this.onError();
  7498. }
  7499. },
  7500. onError: function onError(event) {
  7501. this.error = true;
  7502. this.loading = false;
  7503. this.$emit('error', event);
  7504. },
  7505. onClick: function onClick(event) {
  7506. this.$emit('click', event);
  7507. },
  7508. genPlaceholder: function genPlaceholder() {
  7509. var h = this.$createElement;
  7510. if (this.loading && this.showLoading) {
  7511. return h("div", {
  7512. "class": image_bem('loading')
  7513. }, [this.slots('loading') || h(es_icon, {
  7514. "attrs": {
  7515. "name": this.loadingIcon,
  7516. "classPrefix": this.iconPrefix
  7517. },
  7518. "class": image_bem('loading-icon')
  7519. })]);
  7520. }
  7521. if (this.error && this.showError) {
  7522. return h("div", {
  7523. "class": image_bem('error')
  7524. }, [this.slots('error') || h(es_icon, {
  7525. "attrs": {
  7526. "name": this.errorIcon,
  7527. "classPrefix": this.iconPrefix
  7528. },
  7529. "class": image_bem('error-icon')
  7530. })]);
  7531. }
  7532. },
  7533. genImage: function genImage() {
  7534. var h = this.$createElement;
  7535. var imgData = {
  7536. class: image_bem('img'),
  7537. attrs: {
  7538. alt: this.alt
  7539. },
  7540. style: {
  7541. objectFit: this.fit
  7542. }
  7543. };
  7544. if (this.error) {
  7545. return;
  7546. }
  7547. if (this.lazyLoad) {
  7548. return h("img", helper_default()([{
  7549. "ref": "image",
  7550. "directives": [{
  7551. name: "lazy",
  7552. value: this.src
  7553. }]
  7554. }, imgData]));
  7555. }
  7556. return h("img", helper_default()([{
  7557. "attrs": {
  7558. "src": this.src
  7559. },
  7560. "on": {
  7561. "load": this.onLoad,
  7562. "error": this.onError
  7563. }
  7564. }, imgData]));
  7565. }
  7566. },
  7567. render: function render() {
  7568. var h = arguments[0];
  7569. return h("div", {
  7570. "class": image_bem({
  7571. round: this.round
  7572. }),
  7573. "style": this.style,
  7574. "on": {
  7575. "click": this.onClick
  7576. }
  7577. }, [this.genImage(), this.genPlaceholder(), this.slots()]);
  7578. }
  7579. }));
  7580. // CONCATENATED MODULE: ./es/card/index.js
  7581. // Utils
  7582. // Components
  7583. // Types
  7584. var card_createNamespace = Object(create["a" /* createNamespace */])('card'),
  7585. card_createComponent = card_createNamespace[0],
  7586. card_bem = card_createNamespace[1];
  7587. function Card(h, props, slots, ctx) {
  7588. var _slots$priceTop;
  7589. var thumb = props.thumb;
  7590. var showNum = slots.num || Object(utils["c" /* isDef */])(props.num);
  7591. var showPrice = slots.price || Object(utils["c" /* isDef */])(props.price);
  7592. var showOriginPrice = slots['origin-price'] || Object(utils["c" /* isDef */])(props.originPrice);
  7593. var showBottom = showNum || showPrice || showOriginPrice || slots.bottom;
  7594. function onThumbClick(event) {
  7595. functional_emit(ctx, 'click-thumb', event);
  7596. }
  7597. function ThumbTag() {
  7598. if (slots.tag || props.tag) {
  7599. return h("div", {
  7600. "class": card_bem('tag')
  7601. }, [slots.tag ? slots.tag() : h(es_tag, {
  7602. "attrs": {
  7603. "mark": true,
  7604. "type": "danger"
  7605. }
  7606. }, [props.tag])]);
  7607. }
  7608. }
  7609. function Thumb() {
  7610. if (slots.thumb || thumb) {
  7611. return h("a", {
  7612. "attrs": {
  7613. "href": props.thumbLink
  7614. },
  7615. "class": card_bem('thumb'),
  7616. "on": {
  7617. "click": onThumbClick
  7618. }
  7619. }, [slots.thumb ? slots.thumb() : h(es_image, {
  7620. "attrs": {
  7621. "src": thumb,
  7622. "width": "100%",
  7623. "height": "100%",
  7624. "fit": "cover",
  7625. "lazy-load": props.lazyLoad
  7626. }
  7627. }), ThumbTag()]);
  7628. }
  7629. }
  7630. function Title() {
  7631. if (slots.title) {
  7632. return slots.title();
  7633. }
  7634. if (props.title) {
  7635. return h("div", {
  7636. "class": [card_bem('title'), 'van-multi-ellipsis--l2']
  7637. }, [props.title]);
  7638. }
  7639. }
  7640. function Desc() {
  7641. if (slots.desc) {
  7642. return slots.desc();
  7643. }
  7644. if (props.desc) {
  7645. return h("div", {
  7646. "class": [card_bem('desc'), 'van-ellipsis']
  7647. }, [props.desc]);
  7648. }
  7649. }
  7650. function PriceContent() {
  7651. var priceArr = props.price.toString().split('.');
  7652. return h("div", [h("span", {
  7653. "class": card_bem('price-currency')
  7654. }, [props.currency]), h("span", {
  7655. "class": card_bem('price-integer')
  7656. }, [priceArr[0]]), ".", h("span", {
  7657. "class": card_bem('price-decimal')
  7658. }, [priceArr[1]])]);
  7659. }
  7660. function Price() {
  7661. if (showPrice) {
  7662. return h("div", {
  7663. "class": card_bem('price')
  7664. }, [slots.price ? slots.price() : PriceContent()]);
  7665. }
  7666. }
  7667. function OriginPrice() {
  7668. if (showOriginPrice) {
  7669. var slot = slots['origin-price'];
  7670. return h("div", {
  7671. "class": card_bem('origin-price')
  7672. }, [slot ? slot() : props.currency + " " + props.originPrice]);
  7673. }
  7674. }
  7675. function Num() {
  7676. if (showNum) {
  7677. return h("div", {
  7678. "class": card_bem('num')
  7679. }, [slots.num ? slots.num() : "x" + props.num]);
  7680. }
  7681. }
  7682. function Footer() {
  7683. if (slots.footer) {
  7684. return h("div", {
  7685. "class": card_bem('footer')
  7686. }, [slots.footer()]);
  7687. }
  7688. }
  7689. return h("div", helper_default()([{
  7690. "class": card_bem()
  7691. }, inherit(ctx, true)]), [h("div", {
  7692. "class": card_bem('header')
  7693. }, [Thumb(), h("div", {
  7694. "class": card_bem('content', {
  7695. centered: props.centered
  7696. })
  7697. }, [h("div", [Title(), Desc(), slots.tags == null ? void 0 : slots.tags()]), showBottom && h("div", {
  7698. "class": "van-card__bottom"
  7699. }, [(_slots$priceTop = slots['price-top']) == null ? void 0 : _slots$priceTop.call(slots), Price(), OriginPrice(), Num(), slots.bottom == null ? void 0 : slots.bottom()])])]), Footer()]);
  7700. }
  7701. Card.props = {
  7702. tag: String,
  7703. desc: String,
  7704. thumb: String,
  7705. title: String,
  7706. centered: Boolean,
  7707. lazyLoad: Boolean,
  7708. thumbLink: String,
  7709. num: [Number, String],
  7710. price: [Number, String],
  7711. originPrice: [Number, String],
  7712. currency: {
  7713. type: String,
  7714. default: '¥'
  7715. }
  7716. };
  7717. /* harmony default export */ var card = (card_createComponent(Card));
  7718. // CONCATENATED MODULE: ./es/tab/index.js
  7719. var tab_createNamespace = Object(create["a" /* createNamespace */])('tab'),
  7720. tab_createComponent = tab_createNamespace[0],
  7721. tab_bem = tab_createNamespace[1];
  7722. /* harmony default export */ var tab = (tab_createComponent({
  7723. mixins: [ChildrenMixin('vanTabs')],
  7724. props: _extends({}, routeProps, {
  7725. dot: Boolean,
  7726. name: [Number, String],
  7727. // @deprecated
  7728. info: [Number, String],
  7729. badge: [Number, String],
  7730. title: String,
  7731. titleStyle: null,
  7732. titleClass: null,
  7733. disabled: Boolean
  7734. }),
  7735. data: function data() {
  7736. return {
  7737. inited: false
  7738. };
  7739. },
  7740. computed: {
  7741. computedName: function computedName() {
  7742. var _this$name;
  7743. return (_this$name = this.name) != null ? _this$name : this.index;
  7744. },
  7745. isActive: function isActive() {
  7746. var active = this.computedName === this.parent.currentName;
  7747. if (active) {
  7748. this.inited = true;
  7749. }
  7750. return active;
  7751. }
  7752. },
  7753. watch: {
  7754. title: function title() {
  7755. this.parent.setLine();
  7756. this.parent.scrollIntoView();
  7757. },
  7758. inited: function inited(val) {
  7759. var _this = this;
  7760. if (this.parent.lazyRender && val) {
  7761. this.$nextTick(function () {
  7762. _this.parent.$emit('rendered', _this.computedName, _this.title);
  7763. });
  7764. }
  7765. }
  7766. },
  7767. render: function render(h) {
  7768. var slots = this.slots,
  7769. parent = this.parent,
  7770. isActive = this.isActive;
  7771. var slotContent = slots();
  7772. if (false) {}
  7773. if (!slotContent && !parent.animated) {
  7774. return;
  7775. }
  7776. var show = parent.scrollspy || isActive;
  7777. var shouldRender = this.inited || parent.scrollspy || !parent.lazyRender;
  7778. var Content = shouldRender ? slotContent : h();
  7779. if (parent.animated) {
  7780. return h("div", {
  7781. "attrs": {
  7782. "role": "tabpanel",
  7783. "aria-hidden": !isActive
  7784. },
  7785. "class": tab_bem('pane-wrapper', {
  7786. inactive: !isActive
  7787. })
  7788. }, [h("div", {
  7789. "class": tab_bem('pane')
  7790. }, [Content])]);
  7791. }
  7792. return h("div", {
  7793. "directives": [{
  7794. name: "show",
  7795. value: show
  7796. }],
  7797. "attrs": {
  7798. "role": "tabpanel"
  7799. },
  7800. "class": tab_bem('pane')
  7801. }, [Content]);
  7802. }
  7803. }));
  7804. // CONCATENATED MODULE: ./es/tabs/utils.js
  7805. function scrollLeftTo(scroller, to, duration) {
  7806. var count = 0;
  7807. var from = scroller.scrollLeft;
  7808. var frames = duration === 0 ? 1 : Math.round(duration * 1000 / 16);
  7809. function animate() {
  7810. scroller.scrollLeft += (to - from) / frames;
  7811. if (++count < frames) {
  7812. Object(raf["c" /* raf */])(animate);
  7813. }
  7814. }
  7815. animate();
  7816. }
  7817. function scrollTopTo(scroller, to, duration, callback) {
  7818. var current = getScrollTop(scroller);
  7819. var isDown = current < to;
  7820. var frames = duration === 0 ? 1 : Math.round(duration * 1000 / 16);
  7821. var step = (to - current) / frames;
  7822. function animate() {
  7823. current += step;
  7824. if (isDown && current > to || !isDown && current < to) {
  7825. current = to;
  7826. }
  7827. setScrollTop(scroller, current);
  7828. if (isDown && current < to || !isDown && current > to) {
  7829. Object(raf["c" /* raf */])(animate);
  7830. } else if (callback) {
  7831. Object(raf["c" /* raf */])(callback);
  7832. }
  7833. }
  7834. animate();
  7835. }
  7836. // CONCATENATED MODULE: ./es/utils/dom/style.js
  7837. function isHidden(el) {
  7838. var style = window.getComputedStyle(el);
  7839. var hidden = style.display === 'none'; // offsetParent returns null in the following situations:
  7840. // 1. The element or its parent element has the display property set to none.
  7841. // 2. The element has the position property set to fixed
  7842. var parentHidden = el.offsetParent === null && style.position !== 'fixed';
  7843. return hidden || parentHidden;
  7844. }
  7845. // CONCATENATED MODULE: ./es/utils/interceptor.js
  7846. function callInterceptor(options) {
  7847. var interceptor = options.interceptor,
  7848. args = options.args,
  7849. done = options.done;
  7850. if (interceptor) {
  7851. var returnVal = interceptor.apply(void 0, args);
  7852. if (Object(utils["g" /* isPromise */])(returnVal)) {
  7853. returnVal.then(function (value) {
  7854. if (value) {
  7855. done();
  7856. }
  7857. }).catch(utils["i" /* noop */]);
  7858. } else if (returnVal) {
  7859. done();
  7860. }
  7861. } else {
  7862. done();
  7863. }
  7864. }
  7865. // CONCATENATED MODULE: ./es/tabs/Title.js
  7866. var Title_createNamespace = Object(create["a" /* createNamespace */])('tab'),
  7867. Title_createComponent = Title_createNamespace[0],
  7868. Title_bem = Title_createNamespace[1];
  7869. /* harmony default export */ var tabs_Title = (Title_createComponent({
  7870. props: {
  7871. dot: Boolean,
  7872. type: String,
  7873. info: [Number, String],
  7874. color: String,
  7875. title: String,
  7876. isActive: Boolean,
  7877. disabled: Boolean,
  7878. scrollable: Boolean,
  7879. activeColor: String,
  7880. inactiveColor: String
  7881. },
  7882. computed: {
  7883. style: function style() {
  7884. var style = {};
  7885. var color = this.color,
  7886. isActive = this.isActive;
  7887. var isCard = this.type === 'card'; // card theme color
  7888. if (color && isCard) {
  7889. style.borderColor = color;
  7890. if (!this.disabled) {
  7891. if (isActive) {
  7892. style.backgroundColor = color;
  7893. } else {
  7894. style.color = color;
  7895. }
  7896. }
  7897. }
  7898. var titleColor = isActive ? this.activeColor : this.inactiveColor;
  7899. if (titleColor) {
  7900. style.color = titleColor;
  7901. }
  7902. return style;
  7903. }
  7904. },
  7905. methods: {
  7906. onClick: function onClick() {
  7907. this.$emit('click');
  7908. },
  7909. genText: function genText() {
  7910. var h = this.$createElement;
  7911. var Text = h("span", {
  7912. "class": Title_bem('text', {
  7913. ellipsis: !this.scrollable
  7914. })
  7915. }, [this.slots() || this.title]);
  7916. if (this.dot || Object(utils["c" /* isDef */])(this.info) && this.info !== '') {
  7917. return h("span", {
  7918. "class": Title_bem('text-wrapper')
  7919. }, [Text, h(es_info, {
  7920. "attrs": {
  7921. "dot": this.dot,
  7922. "info": this.info
  7923. }
  7924. })]);
  7925. }
  7926. return Text;
  7927. }
  7928. },
  7929. render: function render() {
  7930. var h = arguments[0];
  7931. return h("div", {
  7932. "attrs": {
  7933. "role": "tab",
  7934. "aria-selected": this.isActive
  7935. },
  7936. "class": [Title_bem({
  7937. active: this.isActive,
  7938. disabled: this.disabled
  7939. })],
  7940. "style": this.style,
  7941. "on": {
  7942. "click": this.onClick
  7943. }
  7944. }, [this.genText()]);
  7945. }
  7946. }));
  7947. // CONCATENATED MODULE: ./es/sticky/index.js
  7948. var sticky_createNamespace = Object(create["a" /* createNamespace */])('sticky'),
  7949. sticky_createComponent = sticky_createNamespace[0],
  7950. sticky_bem = sticky_createNamespace[1];
  7951. /* harmony default export */ var es_sticky = (sticky_createComponent({
  7952. mixins: [BindEventMixin(function (bind, isBind) {
  7953. if (!this.scroller) {
  7954. this.scroller = getScroller(this.$el);
  7955. }
  7956. if (this.observer) {
  7957. var method = isBind ? 'observe' : 'unobserve';
  7958. this.observer[method](this.$el);
  7959. }
  7960. bind(this.scroller, 'scroll', this.onScroll, true);
  7961. this.onScroll();
  7962. })],
  7963. props: {
  7964. zIndex: [Number, String],
  7965. container: null,
  7966. offsetTop: {
  7967. type: [Number, String],
  7968. default: 0
  7969. }
  7970. },
  7971. data: function data() {
  7972. return {
  7973. fixed: false,
  7974. height: 0,
  7975. transform: 0
  7976. };
  7977. },
  7978. computed: {
  7979. offsetTopPx: function offsetTopPx() {
  7980. return Object(unit["b" /* unitToPx */])(this.offsetTop);
  7981. },
  7982. style: function style() {
  7983. if (!this.fixed) {
  7984. return;
  7985. }
  7986. var style = {};
  7987. if (Object(utils["c" /* isDef */])(this.zIndex)) {
  7988. style.zIndex = this.zIndex;
  7989. }
  7990. if (this.offsetTopPx && this.fixed) {
  7991. style.top = this.offsetTopPx + "px";
  7992. }
  7993. if (this.transform) {
  7994. style.transform = "translate3d(0, " + this.transform + "px, 0)";
  7995. }
  7996. return style;
  7997. }
  7998. },
  7999. watch: {
  8000. fixed: function fixed(isFixed) {
  8001. this.$emit('change', isFixed);
  8002. }
  8003. },
  8004. created: function created() {
  8005. var _this = this; // compatibility: https://caniuse.com/#feat=intersectionobserver
  8006. if (!utils["h" /* isServer */] && window.IntersectionObserver) {
  8007. this.observer = new IntersectionObserver(function (entries) {
  8008. // trigger scroll when visibility changed
  8009. if (entries[0].intersectionRatio > 0) {
  8010. _this.onScroll();
  8011. }
  8012. }, {
  8013. root: document.body
  8014. });
  8015. }
  8016. },
  8017. methods: {
  8018. onScroll: function onScroll() {
  8019. var _this2 = this;
  8020. if (isHidden(this.$el)) {
  8021. return;
  8022. }
  8023. this.height = this.$el.offsetHeight;
  8024. var container = this.container,
  8025. offsetTopPx = this.offsetTopPx;
  8026. var scrollTop = getScrollTop(window);
  8027. var topToPageTop = getElementTop(this.$el);
  8028. var emitScrollEvent = function emitScrollEvent() {
  8029. _this2.$emit('scroll', {
  8030. scrollTop: scrollTop,
  8031. isFixed: _this2.fixed
  8032. });
  8033. }; // The sticky component should be kept inside the container element
  8034. if (container) {
  8035. var bottomToPageTop = topToPageTop + container.offsetHeight;
  8036. if (scrollTop + offsetTopPx + this.height > bottomToPageTop) {
  8037. var distanceToBottom = this.height + scrollTop - bottomToPageTop;
  8038. if (distanceToBottom < this.height) {
  8039. this.fixed = true;
  8040. this.transform = -(distanceToBottom + offsetTopPx);
  8041. } else {
  8042. this.fixed = false;
  8043. }
  8044. emitScrollEvent();
  8045. return;
  8046. }
  8047. }
  8048. if (scrollTop + offsetTopPx > topToPageTop) {
  8049. this.fixed = true;
  8050. this.transform = 0;
  8051. } else {
  8052. this.fixed = false;
  8053. }
  8054. emitScrollEvent();
  8055. }
  8056. },
  8057. render: function render() {
  8058. var h = arguments[0];
  8059. var fixed = this.fixed;
  8060. var style = {
  8061. height: fixed ? this.height + "px" : null
  8062. };
  8063. return h("div", {
  8064. "style": style
  8065. }, [h("div", {
  8066. "class": sticky_bem({
  8067. fixed: fixed
  8068. }),
  8069. "style": this.style
  8070. }, [this.slots()])]);
  8071. }
  8072. }));
  8073. // CONCATENATED MODULE: ./es/tabs/Content.js
  8074. var Content_createNamespace = Object(create["a" /* createNamespace */])('tabs'),
  8075. Content_createComponent = Content_createNamespace[0],
  8076. Content_bem = Content_createNamespace[1];
  8077. var MIN_SWIPE_DISTANCE = 50;
  8078. /* harmony default export */ var tabs_Content = (Content_createComponent({
  8079. mixins: [TouchMixin],
  8080. props: {
  8081. count: Number,
  8082. duration: [Number, String],
  8083. animated: Boolean,
  8084. swipeable: Boolean,
  8085. currentIndex: Number
  8086. },
  8087. computed: {
  8088. style: function style() {
  8089. if (this.animated) {
  8090. return {
  8091. transform: "translate3d(" + -1 * this.currentIndex * 100 + "%, 0, 0)",
  8092. transitionDuration: this.duration + "s"
  8093. };
  8094. }
  8095. },
  8096. listeners: function listeners() {
  8097. if (this.swipeable) {
  8098. return {
  8099. touchstart: this.touchStart,
  8100. touchmove: this.touchMove,
  8101. touchend: this.onTouchEnd,
  8102. touchcancel: this.onTouchEnd
  8103. };
  8104. }
  8105. }
  8106. },
  8107. methods: {
  8108. // watch swipe touch end
  8109. onTouchEnd: function onTouchEnd() {
  8110. var direction = this.direction,
  8111. deltaX = this.deltaX,
  8112. currentIndex = this.currentIndex;
  8113. /* istanbul ignore else */
  8114. if (direction === 'horizontal' && this.offsetX >= MIN_SWIPE_DISTANCE) {
  8115. /* istanbul ignore else */
  8116. if (deltaX > 0 && currentIndex !== 0) {
  8117. this.$emit('change', currentIndex - 1);
  8118. } else if (deltaX < 0 && currentIndex !== this.count - 1) {
  8119. this.$emit('change', currentIndex + 1);
  8120. }
  8121. }
  8122. },
  8123. genChildren: function genChildren() {
  8124. var h = this.$createElement;
  8125. if (this.animated) {
  8126. return h("div", {
  8127. "class": Content_bem('track'),
  8128. "style": this.style
  8129. }, [this.slots()]);
  8130. }
  8131. return this.slots();
  8132. }
  8133. },
  8134. render: function render() {
  8135. var h = arguments[0];
  8136. return h("div", {
  8137. "class": Content_bem('content', {
  8138. animated: this.animated
  8139. }),
  8140. "on": _extends({}, this.listeners)
  8141. }, [this.genChildren()]);
  8142. }
  8143. }));
  8144. // CONCATENATED MODULE: ./es/tabs/index.js
  8145. // Utils
  8146. // Mixins
  8147. // Components
  8148. var tabs_createNamespace = Object(create["a" /* createNamespace */])('tabs'),
  8149. tabs_createComponent = tabs_createNamespace[0],
  8150. tabs_bem = tabs_createNamespace[1];
  8151. /* harmony default export */ var tabs = (tabs_createComponent({
  8152. mixins: [ParentMixin('vanTabs'), BindEventMixin(function (bind) {
  8153. if (!this.scroller) {
  8154. this.scroller = getScroller(this.$el);
  8155. }
  8156. bind(window, 'resize', this.resize, true);
  8157. if (this.scrollspy) {
  8158. bind(this.scroller, 'scroll', this.onScroll, true);
  8159. }
  8160. })],
  8161. inject: {
  8162. vanPopup: {
  8163. default: null
  8164. }
  8165. },
  8166. model: {
  8167. prop: 'active'
  8168. },
  8169. props: {
  8170. color: String,
  8171. border: Boolean,
  8172. sticky: Boolean,
  8173. animated: Boolean,
  8174. swipeable: Boolean,
  8175. scrollspy: Boolean,
  8176. background: String,
  8177. lineWidth: [Number, String],
  8178. lineHeight: [Number, String],
  8179. beforeChange: Function,
  8180. titleActiveColor: String,
  8181. titleInactiveColor: String,
  8182. type: {
  8183. type: String,
  8184. default: 'line'
  8185. },
  8186. active: {
  8187. type: [Number, String],
  8188. default: 0
  8189. },
  8190. ellipsis: {
  8191. type: Boolean,
  8192. default: true
  8193. },
  8194. duration: {
  8195. type: [Number, String],
  8196. default: 0.3
  8197. },
  8198. offsetTop: {
  8199. type: [Number, String],
  8200. default: 0
  8201. },
  8202. lazyRender: {
  8203. type: Boolean,
  8204. default: true
  8205. },
  8206. swipeThreshold: {
  8207. type: [Number, String],
  8208. default: 5
  8209. }
  8210. },
  8211. data: function data() {
  8212. return {
  8213. position: '',
  8214. currentIndex: null,
  8215. lineStyle: {
  8216. backgroundColor: this.color
  8217. }
  8218. };
  8219. },
  8220. computed: {
  8221. // whether the nav is scrollable
  8222. scrollable: function scrollable() {
  8223. return this.children.length > this.swipeThreshold || !this.ellipsis;
  8224. },
  8225. navStyle: function navStyle() {
  8226. return {
  8227. borderColor: this.color,
  8228. background: this.background
  8229. };
  8230. },
  8231. currentName: function currentName() {
  8232. var activeTab = this.children[this.currentIndex];
  8233. if (activeTab) {
  8234. return activeTab.computedName;
  8235. }
  8236. },
  8237. offsetTopPx: function offsetTopPx() {
  8238. return Object(unit["b" /* unitToPx */])(this.offsetTop);
  8239. },
  8240. scrollOffset: function scrollOffset() {
  8241. if (this.sticky) {
  8242. return this.offsetTopPx + this.tabHeight;
  8243. }
  8244. return 0;
  8245. }
  8246. },
  8247. watch: {
  8248. color: 'setLine',
  8249. active: function active(name) {
  8250. if (name !== this.currentName) {
  8251. this.setCurrentIndexByName(name);
  8252. }
  8253. },
  8254. children: function children() {
  8255. var _this = this;
  8256. this.setCurrentIndexByName(this.active);
  8257. this.setLine();
  8258. this.$nextTick(function () {
  8259. _this.scrollIntoView(true);
  8260. });
  8261. },
  8262. currentIndex: function currentIndex() {
  8263. this.scrollIntoView();
  8264. this.setLine(); // scroll to correct position
  8265. if (this.stickyFixed && !this.scrollspy) {
  8266. setRootScrollTop(Math.ceil(getElementTop(this.$el) - this.offsetTopPx));
  8267. }
  8268. },
  8269. scrollspy: function scrollspy(val) {
  8270. if (val) {
  8271. event_on(this.scroller, 'scroll', this.onScroll, true);
  8272. } else {
  8273. off(this.scroller, 'scroll', this.onScroll);
  8274. }
  8275. }
  8276. },
  8277. mounted: function mounted() {
  8278. var _this2 = this;
  8279. this.init(); // https://github.com/vant-ui/vant/issues/7959
  8280. if (this.vanPopup) {
  8281. this.vanPopup.onReopen(function () {
  8282. _this2.setLine();
  8283. });
  8284. }
  8285. },
  8286. activated: function activated() {
  8287. this.init();
  8288. this.setLine();
  8289. },
  8290. methods: {
  8291. // @exposed-api
  8292. resize: function resize() {
  8293. this.setLine();
  8294. },
  8295. init: function init() {
  8296. var _this3 = this;
  8297. this.$nextTick(function () {
  8298. _this3.inited = true;
  8299. _this3.tabHeight = getVisibleHeight(_this3.$refs.wrap);
  8300. _this3.scrollIntoView(true);
  8301. });
  8302. },
  8303. // update nav bar style
  8304. setLine: function setLine() {
  8305. var _this4 = this;
  8306. var shouldAnimate = this.inited;
  8307. this.$nextTick(function () {
  8308. var titles = _this4.$refs.titles;
  8309. if (!titles || !titles[_this4.currentIndex] || _this4.type !== 'line' || isHidden(_this4.$el)) {
  8310. return;
  8311. }
  8312. var title = titles[_this4.currentIndex].$el;
  8313. var lineWidth = _this4.lineWidth,
  8314. lineHeight = _this4.lineHeight;
  8315. var left = title.offsetLeft + title.offsetWidth / 2;
  8316. var lineStyle = {
  8317. width: Object(unit["a" /* addUnit */])(lineWidth),
  8318. backgroundColor: _this4.color,
  8319. transform: "translateX(" + left + "px) translateX(-50%)"
  8320. };
  8321. if (shouldAnimate) {
  8322. lineStyle.transitionDuration = _this4.duration + "s";
  8323. }
  8324. if (Object(utils["c" /* isDef */])(lineHeight)) {
  8325. var height = Object(unit["a" /* addUnit */])(lineHeight);
  8326. lineStyle.height = height;
  8327. lineStyle.borderRadius = height;
  8328. }
  8329. _this4.lineStyle = lineStyle;
  8330. });
  8331. },
  8332. // correct the index of active tab
  8333. setCurrentIndexByName: function setCurrentIndexByName(name) {
  8334. var matched = this.children.filter(function (tab) {
  8335. return tab.computedName === name;
  8336. });
  8337. var defaultIndex = (this.children[0] || {}).index || 0;
  8338. this.setCurrentIndex(matched.length ? matched[0].index : defaultIndex);
  8339. },
  8340. setCurrentIndex: function setCurrentIndex(currentIndex) {
  8341. var newIndex = this.findAvailableTab(currentIndex);
  8342. if (!Object(utils["c" /* isDef */])(newIndex)) {
  8343. return;
  8344. }
  8345. var newTab = this.children[newIndex];
  8346. var newName = newTab.computedName;
  8347. var shouldEmitChange = this.currentIndex !== null;
  8348. this.currentIndex = newIndex;
  8349. if (newName !== this.active) {
  8350. this.$emit('input', newName);
  8351. if (shouldEmitChange) {
  8352. this.$emit('change', newName, newTab.title);
  8353. }
  8354. }
  8355. },
  8356. findAvailableTab: function findAvailableTab(index) {
  8357. var diff = index < this.currentIndex ? -1 : 1;
  8358. while (index >= 0 && index < this.children.length) {
  8359. if (!this.children[index].disabled) {
  8360. return index;
  8361. }
  8362. index += diff;
  8363. }
  8364. },
  8365. // emit event when clicked
  8366. onClick: function onClick(item, index) {
  8367. var _this5 = this;
  8368. var _this$children$index = this.children[index],
  8369. title = _this$children$index.title,
  8370. disabled = _this$children$index.disabled,
  8371. computedName = _this$children$index.computedName;
  8372. if (disabled) {
  8373. this.$emit('disabled', computedName, title);
  8374. } else {
  8375. callInterceptor({
  8376. interceptor: this.beforeChange,
  8377. args: [computedName],
  8378. done: function done() {
  8379. _this5.setCurrentIndex(index);
  8380. _this5.scrollToCurrentContent();
  8381. }
  8382. });
  8383. this.$emit('click', computedName, title);
  8384. route(item.$router, item);
  8385. }
  8386. },
  8387. // scroll active tab into view
  8388. scrollIntoView: function scrollIntoView(immediate) {
  8389. var titles = this.$refs.titles;
  8390. if (!this.scrollable || !titles || !titles[this.currentIndex]) {
  8391. return;
  8392. }
  8393. var nav = this.$refs.nav;
  8394. var title = titles[this.currentIndex].$el;
  8395. var to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
  8396. scrollLeftTo(nav, to, immediate ? 0 : +this.duration);
  8397. },
  8398. onSticktScroll: function onSticktScroll(params) {
  8399. this.stickyFixed = params.isFixed;
  8400. this.$emit('scroll', params);
  8401. },
  8402. // @exposed-api
  8403. scrollTo: function scrollTo(name) {
  8404. var _this6 = this;
  8405. this.$nextTick(function () {
  8406. _this6.setCurrentIndexByName(name);
  8407. _this6.scrollToCurrentContent(true);
  8408. });
  8409. },
  8410. scrollToCurrentContent: function scrollToCurrentContent(immediate) {
  8411. var _this7 = this;
  8412. if (immediate === void 0) {
  8413. immediate = false;
  8414. }
  8415. if (this.scrollspy) {
  8416. var target = this.children[this.currentIndex];
  8417. var el = target == null ? void 0 : target.$el;
  8418. if (el) {
  8419. var to = getElementTop(el, this.scroller) - this.scrollOffset;
  8420. this.lockScroll = true;
  8421. scrollTopTo(this.scroller, to, immediate ? 0 : +this.duration, function () {
  8422. _this7.lockScroll = false;
  8423. });
  8424. }
  8425. }
  8426. },
  8427. onScroll: function onScroll() {
  8428. if (this.scrollspy && !this.lockScroll) {
  8429. var index = this.getCurrentIndexOnScroll();
  8430. this.setCurrentIndex(index);
  8431. }
  8432. },
  8433. getCurrentIndexOnScroll: function getCurrentIndexOnScroll() {
  8434. var children = this.children;
  8435. for (var index = 0; index < children.length; index++) {
  8436. var top = getVisibleTop(children[index].$el);
  8437. if (top > this.scrollOffset) {
  8438. return index === 0 ? 0 : index - 1;
  8439. }
  8440. }
  8441. return children.length - 1;
  8442. }
  8443. },
  8444. render: function render() {
  8445. var _this8 = this,
  8446. _ref;
  8447. var h = arguments[0];
  8448. var type = this.type,
  8449. animated = this.animated,
  8450. scrollable = this.scrollable;
  8451. var Nav = this.children.map(function (item, index) {
  8452. var _item$badge;
  8453. return h(tabs_Title, {
  8454. "ref": "titles",
  8455. "refInFor": true,
  8456. "attrs": {
  8457. "type": type,
  8458. "dot": item.dot,
  8459. "info": (_item$badge = item.badge) != null ? _item$badge : item.info,
  8460. "title": item.title,
  8461. "color": _this8.color,
  8462. "isActive": index === _this8.currentIndex,
  8463. "disabled": item.disabled,
  8464. "scrollable": scrollable,
  8465. "activeColor": _this8.titleActiveColor,
  8466. "inactiveColor": _this8.titleInactiveColor
  8467. },
  8468. "style": item.titleStyle,
  8469. "class": item.titleClass,
  8470. "scopedSlots": {
  8471. default: function _default() {
  8472. return item.slots('title');
  8473. }
  8474. },
  8475. "on": {
  8476. "click": function click() {
  8477. _this8.onClick(item, index);
  8478. }
  8479. }
  8480. });
  8481. });
  8482. var Wrap = h("div", {
  8483. "ref": "wrap",
  8484. "class": [tabs_bem('wrap', {
  8485. scrollable: scrollable
  8486. }), (_ref = {}, _ref[BORDER_TOP_BOTTOM] = type === 'line' && this.border, _ref)]
  8487. }, [h("div", {
  8488. "ref": "nav",
  8489. "attrs": {
  8490. "role": "tablist"
  8491. },
  8492. "class": tabs_bem('nav', [type, {
  8493. complete: this.scrollable
  8494. }]),
  8495. "style": this.navStyle
  8496. }, [this.slots('nav-left'), Nav, type === 'line' && h("div", {
  8497. "class": tabs_bem('line'),
  8498. "style": this.lineStyle
  8499. }), this.slots('nav-right')])]);
  8500. return h("div", {
  8501. "class": tabs_bem([type])
  8502. }, [this.sticky ? h(es_sticky, {
  8503. "attrs": {
  8504. "container": this.$el,
  8505. "offsetTop": this.offsetTop
  8506. },
  8507. "on": {
  8508. "scroll": this.onSticktScroll
  8509. }
  8510. }, [Wrap]) : Wrap, h(tabs_Content, {
  8511. "attrs": {
  8512. "count": this.children.length,
  8513. "animated": animated,
  8514. "duration": this.duration,
  8515. "swipeable": this.swipeable,
  8516. "currentIndex": this.currentIndex
  8517. },
  8518. "on": {
  8519. "change": this.setCurrentIndex
  8520. }
  8521. }, [this.slots()])]);
  8522. }
  8523. }));
  8524. // CONCATENATED MODULE: ./es/cascader/index.js
  8525. var cascader_createNamespace = Object(create["a" /* createNamespace */])('cascader'),
  8526. cascader_createComponent = cascader_createNamespace[0],
  8527. cascader_bem = cascader_createNamespace[1],
  8528. cascader_t = cascader_createNamespace[2];
  8529. /* harmony default export */ var cascader = (cascader_createComponent({
  8530. props: {
  8531. title: String,
  8532. value: [Number, String],
  8533. fieldNames: Object,
  8534. placeholder: String,
  8535. activeColor: String,
  8536. options: {
  8537. type: Array,
  8538. default: function _default() {
  8539. return [];
  8540. }
  8541. },
  8542. closeable: {
  8543. type: Boolean,
  8544. default: true
  8545. },
  8546. showHeader: {
  8547. type: Boolean,
  8548. default: true
  8549. }
  8550. },
  8551. data: function data() {
  8552. return {
  8553. tabs: [],
  8554. activeTab: 0
  8555. };
  8556. },
  8557. computed: {
  8558. textKey: function textKey() {
  8559. var _this$fieldNames;
  8560. return ((_this$fieldNames = this.fieldNames) == null ? void 0 : _this$fieldNames.text) || 'text';
  8561. },
  8562. valueKey: function valueKey() {
  8563. var _this$fieldNames2;
  8564. return ((_this$fieldNames2 = this.fieldNames) == null ? void 0 : _this$fieldNames2.value) || 'value';
  8565. },
  8566. childrenKey: function childrenKey() {
  8567. var _this$fieldNames3;
  8568. return ((_this$fieldNames3 = this.fieldNames) == null ? void 0 : _this$fieldNames3.children) || 'children';
  8569. }
  8570. },
  8571. watch: {
  8572. options: {
  8573. deep: true,
  8574. handler: 'updateTabs'
  8575. },
  8576. value: function value(_value) {
  8577. var _this = this;
  8578. if (_value || _value === 0) {
  8579. var values = this.tabs.map(function (tab) {
  8580. var _tab$selectedOption;
  8581. return (_tab$selectedOption = tab.selectedOption) == null ? void 0 : _tab$selectedOption[_this.valueKey];
  8582. });
  8583. if (values.indexOf(_value) !== -1) {
  8584. return;
  8585. }
  8586. }
  8587. this.updateTabs();
  8588. }
  8589. },
  8590. created: function created() {
  8591. this.updateTabs();
  8592. },
  8593. methods: {
  8594. getSelectedOptionsByValue: function getSelectedOptionsByValue(options, value) {
  8595. for (var i = 0; i < options.length; i++) {
  8596. var option = options[i];
  8597. if (option[this.valueKey] === value) {
  8598. return [option];
  8599. }
  8600. if (option[this.childrenKey]) {
  8601. var selectedOptions = this.getSelectedOptionsByValue(option[this.childrenKey], value);
  8602. if (selectedOptions) {
  8603. return [option].concat(selectedOptions);
  8604. }
  8605. }
  8606. }
  8607. },
  8608. updateTabs: function updateTabs() {
  8609. var _this2 = this;
  8610. if (this.value || this.value === 0) {
  8611. var selectedOptions = this.getSelectedOptionsByValue(this.options, this.value);
  8612. if (selectedOptions) {
  8613. var optionsCursor = this.options;
  8614. this.tabs = selectedOptions.map(function (option) {
  8615. var tab = {
  8616. options: optionsCursor,
  8617. selectedOption: option
  8618. };
  8619. var next = optionsCursor.filter(function (item) {
  8620. return item[_this2.valueKey] === option[_this2.valueKey];
  8621. });
  8622. if (next.length) {
  8623. optionsCursor = next[0][_this2.childrenKey];
  8624. }
  8625. return tab;
  8626. });
  8627. if (optionsCursor) {
  8628. this.tabs.push({
  8629. options: optionsCursor,
  8630. selectedOption: null
  8631. });
  8632. }
  8633. this.$nextTick(function () {
  8634. _this2.activeTab = _this2.tabs.length - 1;
  8635. });
  8636. return;
  8637. }
  8638. }
  8639. this.tabs = [{
  8640. options: this.options,
  8641. selectedOption: null
  8642. }];
  8643. },
  8644. onSelect: function onSelect(option, tabIndex) {
  8645. var _this3 = this;
  8646. this.tabs[tabIndex].selectedOption = option;
  8647. if (this.tabs.length > tabIndex + 1) {
  8648. this.tabs = this.tabs.slice(0, tabIndex + 1);
  8649. }
  8650. if (option[this.childrenKey]) {
  8651. var nextTab = {
  8652. options: option[this.childrenKey],
  8653. selectedOption: null
  8654. };
  8655. if (this.tabs[tabIndex + 1]) {
  8656. this.$set(this.tabs, tabIndex + 1, nextTab);
  8657. } else {
  8658. this.tabs.push(nextTab);
  8659. }
  8660. this.$nextTick(function () {
  8661. _this3.activeTab++;
  8662. });
  8663. }
  8664. var selectedOptions = this.tabs.map(function (tab) {
  8665. return tab.selectedOption;
  8666. }).filter(function (item) {
  8667. return !!item;
  8668. });
  8669. var eventParams = {
  8670. value: option[this.valueKey],
  8671. tabIndex: tabIndex,
  8672. selectedOptions: selectedOptions
  8673. };
  8674. this.$emit('input', option[this.valueKey]);
  8675. this.$emit('change', eventParams);
  8676. if (!option[this.childrenKey]) {
  8677. this.$emit('finish', eventParams);
  8678. }
  8679. },
  8680. onClose: function onClose() {
  8681. this.$emit('close');
  8682. },
  8683. renderHeader: function renderHeader() {
  8684. var h = this.$createElement;
  8685. if (this.showHeader) {
  8686. return h("div", {
  8687. "class": cascader_bem('header')
  8688. }, [h("h2", {
  8689. "class": cascader_bem('title')
  8690. }, [this.slots('title') || this.title]), this.closeable ? h(es_icon, {
  8691. "attrs": {
  8692. "name": "cross"
  8693. },
  8694. "class": cascader_bem('close-icon'),
  8695. "on": {
  8696. "click": this.onClose
  8697. }
  8698. }) : null]);
  8699. }
  8700. },
  8701. renderOptions: function renderOptions(options, selectedOption, tabIndex) {
  8702. var _this4 = this;
  8703. var h = this.$createElement;
  8704. var renderOption = function renderOption(option) {
  8705. var isSelected = selectedOption && option[_this4.valueKey] === selectedOption[_this4.valueKey];
  8706. var Text = _this4.slots('option', {
  8707. option: option,
  8708. selected: isSelected
  8709. }) || h("span", [option[_this4.textKey]]);
  8710. return h("li", {
  8711. "class": cascader_bem('option', {
  8712. selected: isSelected
  8713. }),
  8714. "style": {
  8715. color: isSelected ? _this4.activeColor : null
  8716. },
  8717. "on": {
  8718. "click": function click() {
  8719. _this4.onSelect(option, tabIndex);
  8720. }
  8721. }
  8722. }, [Text, isSelected ? h(es_icon, {
  8723. "attrs": {
  8724. "name": "success"
  8725. },
  8726. "class": cascader_bem('selected-icon')
  8727. }) : null]);
  8728. };
  8729. return h("ul", {
  8730. "class": cascader_bem('options')
  8731. }, [options.map(renderOption)]);
  8732. },
  8733. renderTab: function renderTab(item, tabIndex) {
  8734. var h = this.$createElement;
  8735. var options = item.options,
  8736. selectedOption = item.selectedOption;
  8737. var title = selectedOption ? selectedOption[this.textKey] : this.placeholder || cascader_t('select');
  8738. return h(tab, {
  8739. "attrs": {
  8740. "title": title,
  8741. "titleClass": cascader_bem('tab', {
  8742. unselected: !selectedOption
  8743. })
  8744. }
  8745. }, [this.renderOptions(options, selectedOption, tabIndex)]);
  8746. },
  8747. renderTabs: function renderTabs() {
  8748. var _this5 = this;
  8749. var h = this.$createElement;
  8750. return h(tabs, {
  8751. "attrs": {
  8752. "animated": true,
  8753. "swipeable": true,
  8754. "swipeThreshold": 0,
  8755. "color": this.activeColor
  8756. },
  8757. "class": cascader_bem('tabs'),
  8758. "model": {
  8759. value: _this5.activeTab,
  8760. callback: function callback($$v) {
  8761. _this5.activeTab = $$v;
  8762. }
  8763. }
  8764. }, [this.tabs.map(this.renderTab)]);
  8765. }
  8766. },
  8767. render: function render() {
  8768. var h = arguments[0];
  8769. return h("div", {
  8770. "class": cascader_bem()
  8771. }, [this.renderHeader(), this.renderTabs()]);
  8772. }
  8773. }));
  8774. // CONCATENATED MODULE: ./es/cell-group/index.js
  8775. // Utils
  8776. // Types
  8777. var cell_group_createNamespace = Object(create["a" /* createNamespace */])('cell-group'),
  8778. cell_group_createComponent = cell_group_createNamespace[0],
  8779. cell_group_bem = cell_group_createNamespace[1];
  8780. function CellGroup(h, props, slots, ctx) {
  8781. var _ref;
  8782. var Group = h("div", helper_default()([{
  8783. "class": [cell_group_bem({
  8784. inset: props.inset
  8785. }), (_ref = {}, _ref[BORDER_TOP_BOTTOM] = props.border, _ref)]
  8786. }, inherit(ctx, true)]), [slots.default == null ? void 0 : slots.default()]);
  8787. if (props.title || slots.title) {
  8788. return h("div", {
  8789. "key": ctx.data.key
  8790. }, [h("div", {
  8791. "class": cell_group_bem('title', {
  8792. inset: props.inset
  8793. })
  8794. }, [slots.title ? slots.title() : props.title]), Group]);
  8795. }
  8796. return Group;
  8797. }
  8798. CellGroup.props = {
  8799. title: String,
  8800. inset: Boolean,
  8801. border: {
  8802. type: Boolean,
  8803. default: true
  8804. }
  8805. };
  8806. /* harmony default export */ var cell_group = (cell_group_createComponent(CellGroup));
  8807. // CONCATENATED MODULE: ./es/checkbox/index.js
  8808. var checkbox_createNamespace = Object(create["a" /* createNamespace */])('checkbox'),
  8809. checkbox_createComponent = checkbox_createNamespace[0],
  8810. checkbox_bem = checkbox_createNamespace[1];
  8811. /* harmony default export */ var es_checkbox = (checkbox_createComponent({
  8812. mixins: [checkbox_CheckboxMixin({
  8813. bem: checkbox_bem,
  8814. role: 'checkbox',
  8815. parent: 'vanCheckbox'
  8816. })],
  8817. computed: {
  8818. checked: {
  8819. get: function get() {
  8820. if (this.parent) {
  8821. return this.parent.value.indexOf(this.name) !== -1;
  8822. }
  8823. return this.value;
  8824. },
  8825. set: function set(val) {
  8826. if (this.parent) {
  8827. this.setParentValue(val);
  8828. } else {
  8829. this.$emit('input', val);
  8830. }
  8831. }
  8832. }
  8833. },
  8834. watch: {
  8835. value: function value(val) {
  8836. this.$emit('change', val);
  8837. }
  8838. },
  8839. methods: {
  8840. // @exposed-api
  8841. toggle: function toggle(checked) {
  8842. var _this = this;
  8843. if (checked === void 0) {
  8844. checked = !this.checked;
  8845. } // When toggle method is called multiple times at the same time,
  8846. // only the last call is valid.
  8847. // This is a hack for usage inside Cell.
  8848. clearTimeout(this.toggleTask);
  8849. this.toggleTask = setTimeout(function () {
  8850. _this.checked = checked;
  8851. });
  8852. },
  8853. setParentValue: function setParentValue(val) {
  8854. var parent = this.parent;
  8855. var value = parent.value.slice();
  8856. if (val) {
  8857. if (parent.max && value.length >= parent.max) {
  8858. return;
  8859. }
  8860. /* istanbul ignore else */
  8861. if (value.indexOf(this.name) === -1) {
  8862. value.push(this.name);
  8863. parent.$emit('input', value);
  8864. }
  8865. } else {
  8866. var index = value.indexOf(this.name);
  8867. /* istanbul ignore else */
  8868. if (index !== -1) {
  8869. value.splice(index, 1);
  8870. parent.$emit('input', value);
  8871. }
  8872. }
  8873. }
  8874. }
  8875. }));
  8876. // CONCATENATED MODULE: ./es/checkbox-group/index.js
  8877. var checkbox_group_createNamespace = Object(create["a" /* createNamespace */])('checkbox-group'),
  8878. checkbox_group_createComponent = checkbox_group_createNamespace[0],
  8879. checkbox_group_bem = checkbox_group_createNamespace[1];
  8880. /* harmony default export */ var checkbox_group = (checkbox_group_createComponent({
  8881. mixins: [ParentMixin('vanCheckbox'), FieldMixin],
  8882. props: {
  8883. max: [Number, String],
  8884. disabled: Boolean,
  8885. direction: String,
  8886. iconSize: [Number, String],
  8887. checkedColor: String,
  8888. value: {
  8889. type: Array,
  8890. default: function _default() {
  8891. return [];
  8892. }
  8893. }
  8894. },
  8895. watch: {
  8896. value: function value(val) {
  8897. this.$emit('change', val);
  8898. }
  8899. },
  8900. methods: {
  8901. // @exposed-api
  8902. toggleAll: function toggleAll(options) {
  8903. if (options === void 0) {
  8904. options = {};
  8905. }
  8906. if (typeof options === 'boolean') {
  8907. options = {
  8908. checked: options
  8909. };
  8910. }
  8911. var _options = options,
  8912. checked = _options.checked,
  8913. skipDisabled = _options.skipDisabled;
  8914. var children = this.children.filter(function (item) {
  8915. if (item.disabled && skipDisabled) {
  8916. return item.checked;
  8917. }
  8918. return checked != null ? checked : !item.checked;
  8919. });
  8920. var names = children.map(function (item) {
  8921. return item.name;
  8922. });
  8923. this.$emit('input', names);
  8924. }
  8925. },
  8926. render: function render() {
  8927. var h = arguments[0];
  8928. return h("div", {
  8929. "class": checkbox_group_bem([this.direction])
  8930. }, [this.slots()]);
  8931. }
  8932. }));
  8933. // CONCATENATED MODULE: ./es/circle/index.js
  8934. var circle_createNamespace = Object(create["a" /* createNamespace */])('circle'),
  8935. circle_createComponent = circle_createNamespace[0],
  8936. circle_bem = circle_createNamespace[1];
  8937. var PERIMETER = 3140;
  8938. var circle_uid = 0;
  8939. function circle_format(rate) {
  8940. return Math.min(Math.max(rate, 0), 100);
  8941. }
  8942. function getPath(clockwise, viewBoxSize) {
  8943. var sweepFlag = clockwise ? 1 : 0;
  8944. return "M " + viewBoxSize / 2 + " " + viewBoxSize / 2 + " m 0, -500 a 500, 500 0 1, " + sweepFlag + " 0, 1000 a 500, 500 0 1, " + sweepFlag + " 0, -1000";
  8945. }
  8946. /* harmony default export */ var circle = (circle_createComponent({
  8947. props: {
  8948. text: String,
  8949. size: [Number, String],
  8950. color: [String, Object],
  8951. layerColor: String,
  8952. strokeLinecap: String,
  8953. value: {
  8954. type: Number,
  8955. default: 0
  8956. },
  8957. speed: {
  8958. type: [Number, String],
  8959. default: 0
  8960. },
  8961. fill: {
  8962. type: String,
  8963. default: 'none'
  8964. },
  8965. rate: {
  8966. type: [Number, String],
  8967. default: 100
  8968. },
  8969. strokeWidth: {
  8970. type: [Number, String],
  8971. default: 40
  8972. },
  8973. clockwise: {
  8974. type: Boolean,
  8975. default: true
  8976. }
  8977. },
  8978. beforeCreate: function beforeCreate() {
  8979. this.uid = "van-circle-gradient-" + circle_uid++;
  8980. },
  8981. computed: {
  8982. style: function style() {
  8983. var size = Object(unit["a" /* addUnit */])(this.size);
  8984. return {
  8985. width: size,
  8986. height: size
  8987. };
  8988. },
  8989. path: function path() {
  8990. return getPath(this.clockwise, this.viewBoxSize);
  8991. },
  8992. viewBoxSize: function viewBoxSize() {
  8993. return +this.strokeWidth + 1000;
  8994. },
  8995. layerStyle: function layerStyle() {
  8996. return {
  8997. fill: "" + this.fill,
  8998. stroke: "" + this.layerColor,
  8999. strokeWidth: this.strokeWidth + "px"
  9000. };
  9001. },
  9002. hoverStyle: function hoverStyle() {
  9003. var offset = PERIMETER * this.value / 100;
  9004. return {
  9005. stroke: "" + (this.gradient ? "url(#" + this.uid + ")" : this.color),
  9006. strokeWidth: +this.strokeWidth + 1 + "px",
  9007. strokeLinecap: this.strokeLinecap,
  9008. strokeDasharray: offset + "px " + PERIMETER + "px"
  9009. };
  9010. },
  9011. gradient: function gradient() {
  9012. return Object(utils["f" /* isObject */])(this.color);
  9013. },
  9014. LinearGradient: function LinearGradient() {
  9015. var _this = this;
  9016. var h = this.$createElement;
  9017. if (!this.gradient) {
  9018. return;
  9019. }
  9020. var Stops = Object.keys(this.color).sort(function (a, b) {
  9021. return parseFloat(a) - parseFloat(b);
  9022. }).map(function (key, index) {
  9023. return h("stop", {
  9024. "key": index,
  9025. "attrs": {
  9026. "offset": key,
  9027. "stop-color": _this.color[key]
  9028. }
  9029. });
  9030. });
  9031. return h("defs", [h("linearGradient", {
  9032. "attrs": {
  9033. "id": this.uid,
  9034. "x1": "100%",
  9035. "y1": "0%",
  9036. "x2": "0%",
  9037. "y2": "0%"
  9038. }
  9039. }, [Stops])]);
  9040. }
  9041. },
  9042. watch: {
  9043. rate: {
  9044. handler: function handler(rate) {
  9045. this.startTime = Date.now();
  9046. this.startRate = this.value;
  9047. this.endRate = circle_format(rate);
  9048. this.increase = this.endRate > this.startRate;
  9049. this.duration = Math.abs((this.startRate - this.endRate) * 1000 / this.speed);
  9050. if (this.speed) {
  9051. Object(raf["a" /* cancelRaf */])(this.rafId);
  9052. this.rafId = Object(raf["c" /* raf */])(this.animate);
  9053. } else {
  9054. this.$emit('input', this.endRate);
  9055. }
  9056. },
  9057. immediate: true
  9058. }
  9059. },
  9060. methods: {
  9061. animate: function animate() {
  9062. var now = Date.now();
  9063. var progress = Math.min((now - this.startTime) / this.duration, 1);
  9064. var rate = progress * (this.endRate - this.startRate) + this.startRate;
  9065. this.$emit('input', circle_format(parseFloat(rate.toFixed(1))));
  9066. if (this.increase ? rate < this.endRate : rate > this.endRate) {
  9067. this.rafId = Object(raf["c" /* raf */])(this.animate);
  9068. }
  9069. }
  9070. },
  9071. render: function render() {
  9072. var h = arguments[0];
  9073. return h("div", {
  9074. "class": circle_bem(),
  9075. "style": this.style
  9076. }, [h("svg", {
  9077. "attrs": {
  9078. "viewBox": "0 0 " + this.viewBoxSize + " " + this.viewBoxSize
  9079. }
  9080. }, [this.LinearGradient, h("path", {
  9081. "class": circle_bem('layer'),
  9082. "style": this.layerStyle,
  9083. "attrs": {
  9084. "d": this.path
  9085. }
  9086. }), h("path", {
  9087. "attrs": {
  9088. "d": this.path
  9089. },
  9090. "class": circle_bem('hover'),
  9091. "style": this.hoverStyle
  9092. })]), this.slots() || this.text && h("div", {
  9093. "class": circle_bem('text')
  9094. }, [this.text])]);
  9095. }
  9096. }));
  9097. // CONCATENATED MODULE: ./es/col/index.js
  9098. var col_createNamespace = Object(create["a" /* createNamespace */])('col'),
  9099. col_createComponent = col_createNamespace[0],
  9100. col_bem = col_createNamespace[1];
  9101. /* harmony default export */ var col = (col_createComponent({
  9102. mixins: [ChildrenMixin('vanRow')],
  9103. props: {
  9104. span: [Number, String],
  9105. offset: [Number, String],
  9106. tag: {
  9107. type: String,
  9108. default: 'div'
  9109. }
  9110. },
  9111. computed: {
  9112. style: function style() {
  9113. var index = this.index;
  9114. var _ref = this.parent || {},
  9115. spaces = _ref.spaces;
  9116. if (spaces && spaces[index]) {
  9117. var _spaces$index = spaces[index],
  9118. left = _spaces$index.left,
  9119. right = _spaces$index.right;
  9120. return {
  9121. paddingLeft: left ? left + "px" : null,
  9122. paddingRight: right ? right + "px" : null
  9123. };
  9124. }
  9125. }
  9126. },
  9127. methods: {
  9128. onClick: function onClick(event) {
  9129. this.$emit('click', event);
  9130. }
  9131. },
  9132. render: function render() {
  9133. var _bem;
  9134. var h = arguments[0];
  9135. var span = this.span,
  9136. offset = this.offset;
  9137. return h(this.tag, {
  9138. "style": this.style,
  9139. "class": col_bem((_bem = {}, _bem[span] = span, _bem["offset-" + offset] = offset, _bem)),
  9140. "on": {
  9141. "click": this.onClick
  9142. }
  9143. }, [this.slots()]);
  9144. }
  9145. }));
  9146. // CONCATENATED MODULE: ./es/collapse/index.js
  9147. var collapse_createNamespace = Object(create["a" /* createNamespace */])('collapse'),
  9148. collapse_createComponent = collapse_createNamespace[0],
  9149. collapse_bem = collapse_createNamespace[1];
  9150. /* harmony default export */ var collapse = (collapse_createComponent({
  9151. mixins: [ParentMixin('vanCollapse')],
  9152. props: {
  9153. accordion: Boolean,
  9154. value: [String, Number, Array],
  9155. border: {
  9156. type: Boolean,
  9157. default: true
  9158. }
  9159. },
  9160. methods: {
  9161. switch: function _switch(name, expanded) {
  9162. if (!this.accordion) {
  9163. name = expanded ? this.value.concat(name) : this.value.filter(function (activeName) {
  9164. return activeName !== name;
  9165. });
  9166. }
  9167. this.$emit('change', name);
  9168. this.$emit('input', name);
  9169. }
  9170. },
  9171. render: function render() {
  9172. var _ref;
  9173. var h = arguments[0];
  9174. return h("div", {
  9175. "class": [collapse_bem(), (_ref = {}, _ref[BORDER_TOP_BOTTOM] = this.border, _ref)]
  9176. }, [this.slots()]);
  9177. }
  9178. }));
  9179. // CONCATENATED MODULE: ./es/collapse-item/index.js
  9180. // Utils
  9181. // Mixins
  9182. // Components
  9183. var collapse_item_createNamespace = Object(create["a" /* createNamespace */])('collapse-item'),
  9184. collapse_item_createComponent = collapse_item_createNamespace[0],
  9185. collapse_item_bem = collapse_item_createNamespace[1];
  9186. var CELL_SLOTS = ['title', 'icon', 'right-icon'];
  9187. /* harmony default export */ var collapse_item = (collapse_item_createComponent({
  9188. mixins: [ChildrenMixin('vanCollapse')],
  9189. props: _extends({}, cellProps, {
  9190. name: [Number, String],
  9191. disabled: Boolean,
  9192. lazyRender: {
  9193. type: Boolean,
  9194. default: true
  9195. },
  9196. isLink: {
  9197. type: Boolean,
  9198. default: true
  9199. }
  9200. }),
  9201. data: function data() {
  9202. return {
  9203. show: null,
  9204. inited: null
  9205. };
  9206. },
  9207. computed: {
  9208. currentName: function currentName() {
  9209. var _this$name;
  9210. return (_this$name = this.name) != null ? _this$name : this.index;
  9211. },
  9212. expanded: function expanded() {
  9213. var _this = this;
  9214. if (!this.parent) {
  9215. return null;
  9216. }
  9217. var _this$parent = this.parent,
  9218. value = _this$parent.value,
  9219. accordion = _this$parent.accordion;
  9220. if (false) {}
  9221. return accordion ? value === this.currentName : value.some(function (name) {
  9222. return name === _this.currentName;
  9223. });
  9224. }
  9225. },
  9226. created: function created() {
  9227. this.show = this.expanded;
  9228. this.inited = this.expanded;
  9229. },
  9230. watch: {
  9231. expanded: function expanded(_expanded, prev) {
  9232. var _this2 = this;
  9233. if (prev === null) {
  9234. return;
  9235. }
  9236. if (_expanded) {
  9237. this.show = true;
  9238. this.inited = true;
  9239. } // Use raf: flick when opened in safari
  9240. // Use nextTick: closing animation failed when set `user-select: none`
  9241. var nextTick = _expanded ? this.$nextTick : raf["c" /* raf */];
  9242. nextTick(function () {
  9243. var _this2$$refs = _this2.$refs,
  9244. content = _this2$$refs.content,
  9245. wrapper = _this2$$refs.wrapper;
  9246. if (!content || !wrapper) {
  9247. return;
  9248. }
  9249. var offsetHeight = content.offsetHeight;
  9250. if (offsetHeight) {
  9251. var contentHeight = offsetHeight + "px";
  9252. wrapper.style.height = _expanded ? 0 : contentHeight; // use double raf to ensure animation can start
  9253. Object(raf["b" /* doubleRaf */])(function () {
  9254. wrapper.style.height = _expanded ? contentHeight : 0;
  9255. });
  9256. } else {
  9257. _this2.onTransitionEnd();
  9258. }
  9259. });
  9260. }
  9261. },
  9262. methods: {
  9263. onClick: function onClick() {
  9264. if (!this.disabled) {
  9265. this.toggle();
  9266. }
  9267. },
  9268. // @exposed-api
  9269. toggle: function toggle(expanded) {
  9270. if (expanded === void 0) {
  9271. expanded = !this.expanded;
  9272. }
  9273. var parent = this.parent,
  9274. currentName = this.currentName;
  9275. var close = parent.accordion && currentName === parent.value;
  9276. var name = close ? '' : currentName;
  9277. this.parent.switch(name, expanded);
  9278. },
  9279. onTransitionEnd: function onTransitionEnd() {
  9280. if (!this.expanded) {
  9281. this.show = false;
  9282. } else {
  9283. this.$refs.wrapper.style.height = '';
  9284. }
  9285. },
  9286. genTitle: function genTitle() {
  9287. var _this3 = this;
  9288. var h = this.$createElement;
  9289. var border = this.border,
  9290. disabled = this.disabled,
  9291. expanded = this.expanded;
  9292. var titleSlots = CELL_SLOTS.reduce(function (slots, name) {
  9293. if (_this3.slots(name)) {
  9294. slots[name] = function () {
  9295. return _this3.slots(name);
  9296. };
  9297. }
  9298. return slots;
  9299. }, {});
  9300. if (this.slots('value')) {
  9301. titleSlots.default = function () {
  9302. return _this3.slots('value');
  9303. };
  9304. }
  9305. return h(cell, {
  9306. "attrs": {
  9307. "role": "button",
  9308. "tabindex": disabled ? -1 : 0,
  9309. "aria-expanded": String(expanded)
  9310. },
  9311. "class": collapse_item_bem('title', {
  9312. disabled: disabled,
  9313. expanded: expanded,
  9314. borderless: !border
  9315. }),
  9316. "on": {
  9317. "click": this.onClick
  9318. },
  9319. "scopedSlots": titleSlots,
  9320. "props": _extends({}, this.$props)
  9321. });
  9322. },
  9323. genContent: function genContent() {
  9324. var h = this.$createElement;
  9325. if (this.inited || !this.lazyRender) {
  9326. return h("div", {
  9327. "directives": [{
  9328. name: "show",
  9329. value: this.show
  9330. }],
  9331. "ref": "wrapper",
  9332. "class": collapse_item_bem('wrapper'),
  9333. "on": {
  9334. "transitionend": this.onTransitionEnd
  9335. }
  9336. }, [h("div", {
  9337. "ref": "content",
  9338. "class": collapse_item_bem('content')
  9339. }, [this.slots()])]);
  9340. }
  9341. }
  9342. },
  9343. render: function render() {
  9344. var h = arguments[0];
  9345. return h("div", {
  9346. "class": [collapse_item_bem({
  9347. border: this.index && this.border
  9348. })]
  9349. }, [this.genTitle(), this.genContent()]);
  9350. }
  9351. }));
  9352. // CONCATENATED MODULE: ./es/contact-card/index.js
  9353. // Utils
  9354. // Components
  9355. // Types
  9356. var contact_card_createNamespace = Object(create["a" /* createNamespace */])('contact-card'),
  9357. contact_card_createComponent = contact_card_createNamespace[0],
  9358. contact_card_bem = contact_card_createNamespace[1],
  9359. contact_card_t = contact_card_createNamespace[2];
  9360. function ContactCard(h, props, slots, ctx) {
  9361. var type = props.type,
  9362. editable = props.editable;
  9363. function onClick(event) {
  9364. if (editable) {
  9365. functional_emit(ctx, 'click', event);
  9366. }
  9367. }
  9368. function Content() {
  9369. if (type === 'add') {
  9370. return props.addText || contact_card_t('addText');
  9371. }
  9372. return [h("div", [contact_card_t('name') + "\uFF1A" + props.name]), h("div", [contact_card_t('tel') + "\uFF1A" + props.tel])];
  9373. }
  9374. return h(cell, helper_default()([{
  9375. "attrs": {
  9376. "center": true,
  9377. "border": false,
  9378. "isLink": editable,
  9379. "valueClass": contact_card_bem('value'),
  9380. "icon": type === 'edit' ? 'contact' : 'add-square'
  9381. },
  9382. "class": contact_card_bem([type]),
  9383. "on": {
  9384. "click": onClick
  9385. }
  9386. }, inherit(ctx)]), [Content()]);
  9387. }
  9388. ContactCard.props = {
  9389. tel: String,
  9390. name: String,
  9391. addText: String,
  9392. editable: {
  9393. type: Boolean,
  9394. default: true
  9395. },
  9396. type: {
  9397. type: String,
  9398. default: 'add'
  9399. }
  9400. };
  9401. /* harmony default export */ var contact_card = (contact_card_createComponent(ContactCard));
  9402. // CONCATENATED MODULE: ./es/contact-edit/index.js
  9403. // Utils
  9404. // Components
  9405. var contact_edit_createNamespace = Object(create["a" /* createNamespace */])('contact-edit'),
  9406. contact_edit_createComponent = contact_edit_createNamespace[0],
  9407. contact_edit_bem = contact_edit_createNamespace[1],
  9408. contact_edit_t = contact_edit_createNamespace[2];
  9409. var defaultContact = {
  9410. tel: '',
  9411. name: ''
  9412. };
  9413. /* harmony default export */ var contact_edit = (contact_edit_createComponent({
  9414. props: {
  9415. isEdit: Boolean,
  9416. isSaving: Boolean,
  9417. isDeleting: Boolean,
  9418. showSetDefault: Boolean,
  9419. setDefaultLabel: String,
  9420. contactInfo: {
  9421. type: Object,
  9422. default: function _default() {
  9423. return _extends({}, defaultContact);
  9424. }
  9425. },
  9426. telValidator: {
  9427. type: Function,
  9428. default: isMobile
  9429. }
  9430. },
  9431. data: function data() {
  9432. return {
  9433. data: _extends({}, defaultContact, this.contactInfo),
  9434. errorInfo: {
  9435. name: '',
  9436. tel: ''
  9437. }
  9438. };
  9439. },
  9440. watch: {
  9441. contactInfo: function contactInfo(val) {
  9442. this.data = _extends({}, defaultContact, val);
  9443. }
  9444. },
  9445. methods: {
  9446. onFocus: function onFocus(key) {
  9447. this.errorInfo[key] = '';
  9448. },
  9449. getErrorMessageByKey: function getErrorMessageByKey(key) {
  9450. var value = this.data[key].trim();
  9451. switch (key) {
  9452. case 'name':
  9453. return value ? '' : contact_edit_t('nameInvalid');
  9454. case 'tel':
  9455. return this.telValidator(value) ? '' : contact_edit_t('telInvalid');
  9456. }
  9457. },
  9458. onSave: function onSave() {
  9459. var _this = this;
  9460. var isValid = ['name', 'tel'].every(function (item) {
  9461. var msg = _this.getErrorMessageByKey(item);
  9462. if (msg) {
  9463. _this.errorInfo[item] = msg;
  9464. }
  9465. return !msg;
  9466. });
  9467. if (isValid && !this.isSaving) {
  9468. this.$emit('save', this.data);
  9469. }
  9470. },
  9471. onDelete: function onDelete() {
  9472. var _this2 = this;
  9473. dialog.confirm({
  9474. title: contact_edit_t('confirmDelete')
  9475. }).then(function () {
  9476. _this2.$emit('delete', _this2.data);
  9477. });
  9478. }
  9479. },
  9480. render: function render() {
  9481. var _this3 = this;
  9482. var h = arguments[0];
  9483. var data = this.data,
  9484. errorInfo = this.errorInfo;
  9485. var onFocus = function onFocus(name) {
  9486. return function () {
  9487. return _this3.onFocus(name);
  9488. };
  9489. };
  9490. return h("div", {
  9491. "class": contact_edit_bem()
  9492. }, [h("div", {
  9493. "class": contact_edit_bem('fields')
  9494. }, [h(es_field, {
  9495. "attrs": {
  9496. "clearable": true,
  9497. "maxlength": "30",
  9498. "label": contact_edit_t('name'),
  9499. "placeholder": contact_edit_t('nameEmpty'),
  9500. "errorMessage": errorInfo.name
  9501. },
  9502. "on": {
  9503. "focus": onFocus('name')
  9504. },
  9505. "model": {
  9506. value: data.name,
  9507. callback: function callback($$v) {
  9508. _this3.$set(data, "name", $$v);
  9509. }
  9510. }
  9511. }), h(es_field, {
  9512. "attrs": {
  9513. "clearable": true,
  9514. "type": "tel",
  9515. "label": contact_edit_t('tel'),
  9516. "placeholder": contact_edit_t('telEmpty'),
  9517. "errorMessage": errorInfo.tel
  9518. },
  9519. "on": {
  9520. "focus": onFocus('tel')
  9521. },
  9522. "model": {
  9523. value: data.tel,
  9524. callback: function callback($$v) {
  9525. _this3.$set(data, "tel", $$v);
  9526. }
  9527. }
  9528. })]), this.showSetDefault && h(cell, {
  9529. "attrs": {
  9530. "title": this.setDefaultLabel,
  9531. "border": false
  9532. },
  9533. "class": contact_edit_bem('switch-cell')
  9534. }, [h(es_switch, {
  9535. "attrs": {
  9536. "size": 24
  9537. },
  9538. "slot": "right-icon",
  9539. "on": {
  9540. "change": function change(event) {
  9541. _this3.$emit('change-default', event);
  9542. }
  9543. },
  9544. "model": {
  9545. value: data.isDefault,
  9546. callback: function callback($$v) {
  9547. _this3.$set(data, "isDefault", $$v);
  9548. }
  9549. }
  9550. })]), h("div", {
  9551. "class": contact_edit_bem('buttons')
  9552. }, [h(es_button, {
  9553. "attrs": {
  9554. "block": true,
  9555. "round": true,
  9556. "type": "danger",
  9557. "text": contact_edit_t('save'),
  9558. "loading": this.isSaving
  9559. },
  9560. "on": {
  9561. "click": this.onSave
  9562. }
  9563. }), this.isEdit && h(es_button, {
  9564. "attrs": {
  9565. "block": true,
  9566. "round": true,
  9567. "text": contact_edit_t('delete'),
  9568. "loading": this.isDeleting
  9569. },
  9570. "on": {
  9571. "click": this.onDelete
  9572. }
  9573. })])]);
  9574. }
  9575. }));
  9576. // CONCATENATED MODULE: ./es/contact-list/index.js
  9577. // Utils
  9578. // Components
  9579. // Types
  9580. var contact_list_createNamespace = Object(create["a" /* createNamespace */])('contact-list'),
  9581. contact_list_createComponent = contact_list_createNamespace[0],
  9582. contact_list_bem = contact_list_createNamespace[1],
  9583. contact_list_t = contact_list_createNamespace[2];
  9584. function ContactList(h, props, slots, ctx) {
  9585. var List = props.list && props.list.map(function (item, index) {
  9586. function onClick() {
  9587. functional_emit(ctx, 'input', item.id);
  9588. functional_emit(ctx, 'select', item, index);
  9589. }
  9590. function RightIcon() {
  9591. return h(es_radio, {
  9592. "attrs": {
  9593. "name": item.id,
  9594. "iconSize": 16,
  9595. "checkedColor": RED
  9596. },
  9597. "on": {
  9598. "click": onClick
  9599. }
  9600. });
  9601. }
  9602. function LeftIcon() {
  9603. return h(es_icon, {
  9604. "attrs": {
  9605. "name": "edit"
  9606. },
  9607. "class": contact_list_bem('edit'),
  9608. "on": {
  9609. "click": function click(event) {
  9610. event.stopPropagation();
  9611. functional_emit(ctx, 'edit', item, index);
  9612. }
  9613. }
  9614. });
  9615. }
  9616. function Content() {
  9617. var nodes = [item.name + "\uFF0C" + item.tel];
  9618. if (item.isDefault && props.defaultTagText) {
  9619. nodes.push(h(es_tag, {
  9620. "attrs": {
  9621. "type": "danger",
  9622. "round": true
  9623. },
  9624. "class": contact_list_bem('item-tag')
  9625. }, [props.defaultTagText]));
  9626. }
  9627. return nodes;
  9628. }
  9629. return h(cell, {
  9630. "key": item.id,
  9631. "attrs": {
  9632. "isLink": true,
  9633. "center": true,
  9634. "valueClass": contact_list_bem('item-value')
  9635. },
  9636. "class": contact_list_bem('item'),
  9637. "scopedSlots": {
  9638. icon: LeftIcon,
  9639. default: Content,
  9640. 'right-icon': RightIcon
  9641. },
  9642. "on": {
  9643. "click": onClick
  9644. }
  9645. });
  9646. });
  9647. return h("div", helper_default()([{
  9648. "class": contact_list_bem()
  9649. }, inherit(ctx)]), [h(radio_group, {
  9650. "attrs": {
  9651. "value": props.value
  9652. },
  9653. "class": contact_list_bem('group')
  9654. }, [List]), h("div", {
  9655. "class": contact_list_bem('bottom')
  9656. }, [h(es_button, {
  9657. "attrs": {
  9658. "round": true,
  9659. "block": true,
  9660. "type": "danger",
  9661. "text": props.addText || contact_list_t('addText')
  9662. },
  9663. "class": contact_list_bem('add'),
  9664. "on": {
  9665. "click": function click() {
  9666. functional_emit(ctx, 'add');
  9667. }
  9668. }
  9669. })])]);
  9670. }
  9671. ContactList.props = {
  9672. value: null,
  9673. list: Array,
  9674. addText: String,
  9675. defaultTagText: String
  9676. };
  9677. /* harmony default export */ var contact_list = (contact_list_createComponent(ContactList));
  9678. // EXTERNAL MODULE: ./es/utils/format/string.js
  9679. var string = __webpack_require__(2);
  9680. // CONCATENATED MODULE: ./es/count-down/utils.js
  9681. var SECOND = 1000;
  9682. var MINUTE = 60 * SECOND;
  9683. var HOUR = 60 * MINUTE;
  9684. var DAY = 24 * HOUR;
  9685. function parseTimeData(time) {
  9686. var days = Math.floor(time / DAY);
  9687. var hours = Math.floor(time % DAY / HOUR);
  9688. var minutes = Math.floor(time % HOUR / MINUTE);
  9689. var seconds = Math.floor(time % MINUTE / SECOND);
  9690. var milliseconds = Math.floor(time % SECOND);
  9691. return {
  9692. days: days,
  9693. hours: hours,
  9694. minutes: minutes,
  9695. seconds: seconds,
  9696. milliseconds: milliseconds
  9697. };
  9698. }
  9699. function parseFormat(format, timeData) {
  9700. var days = timeData.days;
  9701. var hours = timeData.hours,
  9702. minutes = timeData.minutes,
  9703. seconds = timeData.seconds,
  9704. milliseconds = timeData.milliseconds;
  9705. if (format.indexOf('DD') === -1) {
  9706. hours += days * 24;
  9707. } else {
  9708. format = format.replace('DD', Object(string["b" /* padZero */])(days));
  9709. }
  9710. if (format.indexOf('HH') === -1) {
  9711. minutes += hours * 60;
  9712. } else {
  9713. format = format.replace('HH', Object(string["b" /* padZero */])(hours));
  9714. }
  9715. if (format.indexOf('mm') === -1) {
  9716. seconds += minutes * 60;
  9717. } else {
  9718. format = format.replace('mm', Object(string["b" /* padZero */])(minutes));
  9719. }
  9720. if (format.indexOf('ss') === -1) {
  9721. milliseconds += seconds * 1000;
  9722. } else {
  9723. format = format.replace('ss', Object(string["b" /* padZero */])(seconds));
  9724. }
  9725. if (format.indexOf('S') !== -1) {
  9726. var ms = Object(string["b" /* padZero */])(milliseconds, 3);
  9727. if (format.indexOf('SSS') !== -1) {
  9728. format = format.replace('SSS', ms);
  9729. } else if (format.indexOf('SS') !== -1) {
  9730. format = format.replace('SS', ms.slice(0, 2));
  9731. } else {
  9732. format = format.replace('S', ms.charAt(0));
  9733. }
  9734. }
  9735. return format;
  9736. }
  9737. function isSameSecond(time1, time2) {
  9738. return Math.floor(time1 / 1000) === Math.floor(time2 / 1000);
  9739. }
  9740. // CONCATENATED MODULE: ./es/count-down/index.js
  9741. var count_down_createNamespace = Object(create["a" /* createNamespace */])('count-down'),
  9742. count_down_createComponent = count_down_createNamespace[0],
  9743. count_down_bem = count_down_createNamespace[1];
  9744. /* harmony default export */ var count_down = (count_down_createComponent({
  9745. props: {
  9746. millisecond: Boolean,
  9747. time: {
  9748. type: [Number, String],
  9749. default: 0
  9750. },
  9751. format: {
  9752. type: String,
  9753. default: 'HH:mm:ss'
  9754. },
  9755. autoStart: {
  9756. type: Boolean,
  9757. default: true
  9758. }
  9759. },
  9760. data: function data() {
  9761. return {
  9762. remain: 0
  9763. };
  9764. },
  9765. computed: {
  9766. timeData: function timeData() {
  9767. return parseTimeData(this.remain);
  9768. },
  9769. formattedTime: function formattedTime() {
  9770. return parseFormat(this.format, this.timeData);
  9771. }
  9772. },
  9773. watch: {
  9774. time: {
  9775. immediate: true,
  9776. handler: 'reset'
  9777. }
  9778. },
  9779. activated: function activated() {
  9780. if (this.keepAlivePaused) {
  9781. this.counting = true;
  9782. this.keepAlivePaused = false;
  9783. this.tick();
  9784. }
  9785. },
  9786. deactivated: function deactivated() {
  9787. if (this.counting) {
  9788. this.pause();
  9789. this.keepAlivePaused = true;
  9790. }
  9791. },
  9792. beforeDestroy: function beforeDestroy() {
  9793. this.pause();
  9794. },
  9795. methods: {
  9796. // @exposed-api
  9797. start: function start() {
  9798. if (this.counting) {
  9799. return;
  9800. }
  9801. this.counting = true;
  9802. this.endTime = Date.now() + this.remain;
  9803. this.tick();
  9804. },
  9805. // @exposed-api
  9806. pause: function pause() {
  9807. this.counting = false;
  9808. Object(raf["a" /* cancelRaf */])(this.rafId);
  9809. },
  9810. // @exposed-api
  9811. reset: function reset() {
  9812. this.pause();
  9813. this.remain = +this.time;
  9814. if (this.autoStart) {
  9815. this.start();
  9816. }
  9817. },
  9818. tick: function tick() {
  9819. // should not start counting in server
  9820. // see: https://github.com/vant-ui/vant/issues/7807
  9821. if (!utils["b" /* inBrowser */]) {
  9822. return;
  9823. }
  9824. if (this.millisecond) {
  9825. this.microTick();
  9826. } else {
  9827. this.macroTick();
  9828. }
  9829. },
  9830. microTick: function microTick() {
  9831. var _this = this;
  9832. this.rafId = Object(raf["c" /* raf */])(function () {
  9833. /* istanbul ignore if */
  9834. // in case of call reset immediately after finish
  9835. if (!_this.counting) {
  9836. return;
  9837. }
  9838. _this.setRemain(_this.getRemain());
  9839. if (_this.remain > 0) {
  9840. _this.microTick();
  9841. }
  9842. });
  9843. },
  9844. macroTick: function macroTick() {
  9845. var _this2 = this;
  9846. this.rafId = Object(raf["c" /* raf */])(function () {
  9847. /* istanbul ignore if */
  9848. // in case of call reset immediately after finish
  9849. if (!_this2.counting) {
  9850. return;
  9851. }
  9852. var remain = _this2.getRemain();
  9853. if (!isSameSecond(remain, _this2.remain) || remain === 0) {
  9854. _this2.setRemain(remain);
  9855. }
  9856. if (_this2.remain > 0) {
  9857. _this2.macroTick();
  9858. }
  9859. });
  9860. },
  9861. getRemain: function getRemain() {
  9862. return Math.max(this.endTime - Date.now(), 0);
  9863. },
  9864. setRemain: function setRemain(remain) {
  9865. this.remain = remain;
  9866. this.$emit('change', this.timeData);
  9867. if (remain === 0) {
  9868. this.pause();
  9869. this.$emit('finish');
  9870. }
  9871. }
  9872. },
  9873. render: function render() {
  9874. var h = arguments[0];
  9875. return h("div", {
  9876. "class": count_down_bem()
  9877. }, [this.slots('default', this.timeData) || this.formattedTime]);
  9878. }
  9879. }));
  9880. // CONCATENATED MODULE: ./es/coupon/index.js
  9881. var coupon_createNamespace = Object(create["a" /* createNamespace */])('coupon'),
  9882. coupon_createComponent = coupon_createNamespace[0],
  9883. coupon_bem = coupon_createNamespace[1],
  9884. coupon_t = coupon_createNamespace[2];
  9885. function formatTimeStamp(timeStamp) {
  9886. // compatible when the timestamp is seconds
  9887. if (timeStamp < Math.pow(10, 12)) {
  9888. return timeStamp * 1000;
  9889. }
  9890. return +timeStamp;
  9891. }
  9892. function getDate(timeStamp) {
  9893. var date = new Date(formatTimeStamp(timeStamp));
  9894. return date.getFullYear() + "." + Object(string["b" /* padZero */])(date.getMonth() + 1) + "." + Object(string["b" /* padZero */])(date.getDate());
  9895. }
  9896. function formatDiscount(discount) {
  9897. return (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
  9898. }
  9899. function formatAmount(amount) {
  9900. return (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
  9901. }
  9902. /* harmony default export */ var es_coupon = (coupon_createComponent({
  9903. props: {
  9904. coupon: Object,
  9905. chosen: Boolean,
  9906. disabled: Boolean,
  9907. currency: {
  9908. type: String,
  9909. default: '¥'
  9910. }
  9911. },
  9912. computed: {
  9913. validPeriod: function validPeriod() {
  9914. var _this$coupon = this.coupon,
  9915. startAt = _this$coupon.startAt,
  9916. endAt = _this$coupon.endAt,
  9917. customValidPeriod = _this$coupon.customValidPeriod;
  9918. return customValidPeriod || getDate(startAt) + " - " + getDate(endAt);
  9919. },
  9920. faceAmount: function faceAmount() {
  9921. var coupon = this.coupon;
  9922. if (coupon.valueDesc) {
  9923. return coupon.valueDesc + "<span>" + (coupon.unitDesc || '') + "</span>";
  9924. }
  9925. if (coupon.denominations) {
  9926. var denominations = formatAmount(coupon.denominations);
  9927. return "<span>" + this.currency + "</span> " + denominations;
  9928. }
  9929. if (coupon.discount) {
  9930. return coupon_t('discount', formatDiscount(coupon.discount));
  9931. }
  9932. return '';
  9933. },
  9934. conditionMessage: function conditionMessage() {
  9935. var condition = formatAmount(this.coupon.originCondition);
  9936. return condition === '0' ? coupon_t('unlimited') : coupon_t('condition', condition);
  9937. }
  9938. },
  9939. render: function render() {
  9940. var h = arguments[0];
  9941. var coupon = this.coupon,
  9942. disabled = this.disabled;
  9943. var description = disabled && coupon.reason || coupon.description;
  9944. return h("div", {
  9945. "class": coupon_bem({
  9946. disabled: disabled
  9947. })
  9948. }, [h("div", {
  9949. "class": coupon_bem('content')
  9950. }, [h("div", {
  9951. "class": coupon_bem('head')
  9952. }, [h("h2", {
  9953. "class": coupon_bem('amount'),
  9954. "domProps": {
  9955. "innerHTML": this.faceAmount
  9956. }
  9957. }), h("p", {
  9958. "class": coupon_bem('condition')
  9959. }, [this.coupon.condition || this.conditionMessage])]), h("div", {
  9960. "class": coupon_bem('body')
  9961. }, [h("p", {
  9962. "class": coupon_bem('name')
  9963. }, [coupon.name]), h("p", {
  9964. "class": coupon_bem('valid')
  9965. }, [this.validPeriod]), !this.disabled && h(es_checkbox, {
  9966. "attrs": {
  9967. "size": 18,
  9968. "value": this.chosen,
  9969. "checkedColor": RED
  9970. },
  9971. "class": coupon_bem('corner')
  9972. })])]), description && h("p", {
  9973. "class": coupon_bem('description')
  9974. }, [description])]);
  9975. }
  9976. }));
  9977. // CONCATENATED MODULE: ./es/coupon-cell/index.js
  9978. // Utils
  9979. // Components
  9980. // Types
  9981. var coupon_cell_createNamespace = Object(create["a" /* createNamespace */])('coupon-cell'),
  9982. coupon_cell_createComponent = coupon_cell_createNamespace[0],
  9983. coupon_cell_bem = coupon_cell_createNamespace[1],
  9984. coupon_cell_t = coupon_cell_createNamespace[2];
  9985. function coupon_cell_formatValue(props) {
  9986. var coupons = props.coupons,
  9987. chosenCoupon = props.chosenCoupon,
  9988. currency = props.currency;
  9989. var coupon = coupons[+chosenCoupon];
  9990. if (coupon) {
  9991. var value = 0;
  9992. if (Object(utils["c" /* isDef */])(coupon.value)) {
  9993. value = coupon.value;
  9994. } else if (Object(utils["c" /* isDef */])(coupon.denominations)) {
  9995. value = coupon.denominations;
  9996. }
  9997. return "-" + currency + " " + (value / 100).toFixed(2);
  9998. }
  9999. return coupons.length === 0 ? coupon_cell_t('tips') : coupon_cell_t('count', coupons.length);
  10000. }
  10001. function CouponCell(h, props, slots, ctx) {
  10002. var selected = props.coupons[+props.chosenCoupon];
  10003. var value = coupon_cell_formatValue(props);
  10004. return h(cell, helper_default()([{
  10005. "class": coupon_cell_bem(),
  10006. "attrs": {
  10007. "value": value,
  10008. "title": props.title || coupon_cell_t('title'),
  10009. "border": props.border,
  10010. "isLink": props.editable,
  10011. "valueClass": coupon_cell_bem('value', {
  10012. selected: selected
  10013. })
  10014. }
  10015. }, inherit(ctx, true)]));
  10016. }
  10017. CouponCell.model = {
  10018. prop: 'chosenCoupon'
  10019. };
  10020. CouponCell.props = {
  10021. title: String,
  10022. coupons: {
  10023. type: Array,
  10024. default: function _default() {
  10025. return [];
  10026. }
  10027. },
  10028. currency: {
  10029. type: String,
  10030. default: '¥'
  10031. },
  10032. border: {
  10033. type: Boolean,
  10034. default: true
  10035. },
  10036. editable: {
  10037. type: Boolean,
  10038. default: true
  10039. },
  10040. chosenCoupon: {
  10041. type: [Number, String],
  10042. default: -1
  10043. }
  10044. };
  10045. /* harmony default export */ var coupon_cell = (coupon_cell_createComponent(CouponCell));
  10046. // CONCATENATED MODULE: ./es/coupon-list/index.js
  10047. // Utils
  10048. // Components
  10049. var coupon_list_createNamespace = Object(create["a" /* createNamespace */])('coupon-list'),
  10050. coupon_list_createComponent = coupon_list_createNamespace[0],
  10051. coupon_list_bem = coupon_list_createNamespace[1],
  10052. coupon_list_t = coupon_list_createNamespace[2];
  10053. var EMPTY_IMAGE = 'https://img01.yzcdn.cn/vant/coupon-empty.png';
  10054. /* harmony default export */ var coupon_list = (coupon_list_createComponent({
  10055. model: {
  10056. prop: 'code'
  10057. },
  10058. props: {
  10059. code: String,
  10060. closeButtonText: String,
  10061. inputPlaceholder: String,
  10062. enabledTitle: String,
  10063. disabledTitle: String,
  10064. exchangeButtonText: String,
  10065. exchangeButtonLoading: Boolean,
  10066. exchangeButtonDisabled: Boolean,
  10067. exchangeMinLength: {
  10068. type: Number,
  10069. default: 1
  10070. },
  10071. chosenCoupon: {
  10072. type: Number,
  10073. default: -1
  10074. },
  10075. coupons: {
  10076. type: Array,
  10077. default: function _default() {
  10078. return [];
  10079. }
  10080. },
  10081. disabledCoupons: {
  10082. type: Array,
  10083. default: function _default() {
  10084. return [];
  10085. }
  10086. },
  10087. displayedCouponIndex: {
  10088. type: Number,
  10089. default: -1
  10090. },
  10091. showExchangeBar: {
  10092. type: Boolean,
  10093. default: true
  10094. },
  10095. showCloseButton: {
  10096. type: Boolean,
  10097. default: true
  10098. },
  10099. showCount: {
  10100. type: Boolean,
  10101. default: true
  10102. },
  10103. currency: {
  10104. type: String,
  10105. default: '¥'
  10106. },
  10107. emptyImage: {
  10108. type: String,
  10109. default: EMPTY_IMAGE
  10110. }
  10111. },
  10112. data: function data() {
  10113. return {
  10114. tab: 0,
  10115. winHeight: window.innerHeight,
  10116. currentCode: this.code || ''
  10117. };
  10118. },
  10119. computed: {
  10120. buttonDisabled: function buttonDisabled() {
  10121. return !this.exchangeButtonLoading && (this.exchangeButtonDisabled || !this.currentCode || this.currentCode.length < this.exchangeMinLength);
  10122. },
  10123. listStyle: function listStyle() {
  10124. return {
  10125. height: this.winHeight - (this.showExchangeBar ? 140 : 94) + 'px'
  10126. };
  10127. }
  10128. },
  10129. watch: {
  10130. code: function code(_code) {
  10131. this.currentCode = _code;
  10132. },
  10133. currentCode: function currentCode(code) {
  10134. this.$emit('input', code);
  10135. },
  10136. displayedCouponIndex: 'scrollToShowCoupon'
  10137. },
  10138. mounted: function mounted() {
  10139. this.scrollToShowCoupon(this.displayedCouponIndex);
  10140. },
  10141. methods: {
  10142. onClickExchangeButton: function onClickExchangeButton() {
  10143. this.$emit('exchange', this.currentCode); // auto clear currentCode when not use vModel
  10144. if (!this.code) {
  10145. this.currentCode = '';
  10146. }
  10147. },
  10148. // scroll to show specific coupon
  10149. scrollToShowCoupon: function scrollToShowCoupon(index) {
  10150. var _this = this;
  10151. if (index === -1) {
  10152. return;
  10153. }
  10154. this.$nextTick(function () {
  10155. var _this$$refs = _this.$refs,
  10156. card = _this$$refs.card,
  10157. list = _this$$refs.list;
  10158. /* istanbul ignore next */
  10159. if (list && card && card[index]) {
  10160. list.scrollTop = card[index].$el.offsetTop - 100;
  10161. }
  10162. });
  10163. },
  10164. genEmpty: function genEmpty() {
  10165. var h = this.$createElement;
  10166. return h("div", {
  10167. "class": coupon_list_bem('empty')
  10168. }, [h("img", {
  10169. "attrs": {
  10170. "src": this.emptyImage
  10171. }
  10172. }), h("p", [coupon_list_t('empty')])]);
  10173. },
  10174. genExchangeButton: function genExchangeButton() {
  10175. var h = this.$createElement;
  10176. return h(es_button, {
  10177. "attrs": {
  10178. "plain": true,
  10179. "type": "danger",
  10180. "text": this.exchangeButtonText || coupon_list_t('exchange'),
  10181. "loading": this.exchangeButtonLoading,
  10182. "disabled": this.buttonDisabled
  10183. },
  10184. "class": coupon_list_bem('exchange'),
  10185. "on": {
  10186. "click": this.onClickExchangeButton
  10187. }
  10188. });
  10189. }
  10190. },
  10191. render: function render() {
  10192. var _this2 = this;
  10193. var h = arguments[0];
  10194. var coupons = this.coupons,
  10195. disabledCoupons = this.disabledCoupons;
  10196. var count = this.showCount ? " (" + coupons.length + ")" : '';
  10197. var title = (this.enabledTitle || coupon_list_t('enable')) + count;
  10198. var disabledCount = this.showCount ? " (" + disabledCoupons.length + ")" : '';
  10199. var disabledTitle = (this.disabledTitle || coupon_list_t('disabled')) + disabledCount;
  10200. var ExchangeBar = this.showExchangeBar && h("div", {
  10201. "class": coupon_list_bem('exchange-bar')
  10202. }, [h(es_field, {
  10203. "attrs": {
  10204. "clearable": true,
  10205. "border": false,
  10206. "placeholder": this.inputPlaceholder || coupon_list_t('placeholder'),
  10207. "maxlength": "20"
  10208. },
  10209. "class": coupon_list_bem('field'),
  10210. "model": {
  10211. value: _this2.currentCode,
  10212. callback: function callback($$v) {
  10213. _this2.currentCode = $$v;
  10214. }
  10215. }
  10216. }), this.genExchangeButton()]);
  10217. var onChange = function onChange(index) {
  10218. return function () {
  10219. return _this2.$emit('change', index);
  10220. };
  10221. };
  10222. var CouponTab = h(tab, {
  10223. "attrs": {
  10224. "title": title
  10225. }
  10226. }, [h("div", {
  10227. "class": coupon_list_bem('list', {
  10228. 'with-bottom': this.showCloseButton
  10229. }),
  10230. "style": this.listStyle
  10231. }, [coupons.map(function (coupon, index) {
  10232. return h(es_coupon, {
  10233. "ref": "card",
  10234. "key": coupon.id,
  10235. "attrs": {
  10236. "coupon": coupon,
  10237. "currency": _this2.currency,
  10238. "chosen": index === _this2.chosenCoupon
  10239. },
  10240. "nativeOn": {
  10241. "click": onChange(index)
  10242. }
  10243. });
  10244. }), !coupons.length && this.genEmpty(), this.slots('list-footer')])]);
  10245. var DisabledCouponTab = h(tab, {
  10246. "attrs": {
  10247. "title": disabledTitle
  10248. }
  10249. }, [h("div", {
  10250. "class": coupon_list_bem('list', {
  10251. 'with-bottom': this.showCloseButton
  10252. }),
  10253. "style": this.listStyle
  10254. }, [disabledCoupons.map(function (coupon) {
  10255. return h(es_coupon, {
  10256. "attrs": {
  10257. "disabled": true,
  10258. "coupon": coupon,
  10259. "currency": _this2.currency
  10260. },
  10261. "key": coupon.id
  10262. });
  10263. }), !disabledCoupons.length && this.genEmpty(), this.slots('disabled-list-footer')])]);
  10264. return h("div", {
  10265. "class": coupon_list_bem()
  10266. }, [ExchangeBar, h(tabs, {
  10267. "class": coupon_list_bem('tab'),
  10268. "attrs": {
  10269. "border": false
  10270. },
  10271. "model": {
  10272. value: _this2.tab,
  10273. callback: function callback($$v) {
  10274. _this2.tab = $$v;
  10275. }
  10276. }
  10277. }, [CouponTab, DisabledCouponTab]), h("div", {
  10278. "class": coupon_list_bem('bottom')
  10279. }, [h(es_button, {
  10280. "directives": [{
  10281. name: "show",
  10282. value: this.showCloseButton
  10283. }],
  10284. "attrs": {
  10285. "round": true,
  10286. "type": "danger",
  10287. "block": true,
  10288. "text": this.closeButtonText || coupon_list_t('close')
  10289. },
  10290. "class": coupon_list_bem('close'),
  10291. "on": {
  10292. "click": onChange(-1)
  10293. }
  10294. })])]);
  10295. }
  10296. }));
  10297. // CONCATENATED MODULE: ./es/datetime-picker/shared.js
  10298. var sharedProps = _extends({}, pickerProps, {
  10299. value: null,
  10300. filter: Function,
  10301. columnsOrder: Array,
  10302. showToolbar: {
  10303. type: Boolean,
  10304. default: true
  10305. },
  10306. formatter: {
  10307. type: Function,
  10308. default: function _default(type, value) {
  10309. return value;
  10310. }
  10311. }
  10312. });
  10313. var TimePickerMixin = {
  10314. data: function data() {
  10315. return {
  10316. innerValue: this.formatValue(this.value)
  10317. };
  10318. },
  10319. computed: {
  10320. originColumns: function originColumns() {
  10321. var _this = this;
  10322. return this.ranges.map(function (_ref) {
  10323. var type = _ref.type,
  10324. rangeArr = _ref.range;
  10325. var values = times(rangeArr[1] - rangeArr[0] + 1, function (index) {
  10326. var value = Object(string["b" /* padZero */])(rangeArr[0] + index);
  10327. return value;
  10328. });
  10329. if (_this.filter) {
  10330. values = _this.filter(type, values);
  10331. }
  10332. return {
  10333. type: type,
  10334. values: values
  10335. };
  10336. });
  10337. },
  10338. columns: function columns() {
  10339. var _this2 = this;
  10340. return this.originColumns.map(function (column) {
  10341. return {
  10342. values: column.values.map(function (value) {
  10343. return _this2.formatter(column.type, value);
  10344. })
  10345. };
  10346. });
  10347. }
  10348. },
  10349. watch: {
  10350. columns: 'updateColumnValue',
  10351. innerValue: function innerValue(val, oldVal) {
  10352. if (!oldVal) {
  10353. this.$emit('input', null);
  10354. } else {
  10355. this.$emit('input', val);
  10356. }
  10357. }
  10358. },
  10359. mounted: function mounted() {
  10360. var _this3 = this;
  10361. this.updateColumnValue();
  10362. this.$nextTick(function () {
  10363. _this3.updateInnerValue();
  10364. });
  10365. },
  10366. methods: {
  10367. getPicker: function getPicker() {
  10368. return this.$refs.picker;
  10369. },
  10370. // https://github.com/vant-ui/vant/issues/10013
  10371. getProxiedPicker: function getProxiedPicker() {
  10372. var _this4 = this;
  10373. var picker = this.$refs.picker;
  10374. if (picker) {
  10375. var proxy = function proxy(fn) {
  10376. return function () {
  10377. picker[fn].apply(picker, arguments);
  10378. _this4.updateInnerValue();
  10379. };
  10380. };
  10381. return _extends({}, picker, {
  10382. setValues: proxy('setValues'),
  10383. setIndexes: proxy('setIndexes'),
  10384. setColumnIndex: proxy('setColumnIndex'),
  10385. setColumnValue: proxy('setColumnValue')
  10386. });
  10387. }
  10388. },
  10389. onConfirm: function onConfirm() {
  10390. this.$emit('input', this.innerValue);
  10391. this.$emit('confirm', this.innerValue);
  10392. },
  10393. onCancel: function onCancel() {
  10394. this.$emit('cancel');
  10395. }
  10396. },
  10397. render: function render() {
  10398. var _this5 = this;
  10399. var h = arguments[0];
  10400. var props = {};
  10401. Object.keys(pickerProps).forEach(function (key) {
  10402. props[key] = _this5[key];
  10403. });
  10404. return h(es_picker, {
  10405. "ref": "picker",
  10406. "attrs": {
  10407. "columns": this.columns,
  10408. "readonly": this.readonly
  10409. },
  10410. "scopedSlots": this.$scopedSlots,
  10411. "on": {
  10412. "change": this.onChange,
  10413. "confirm": this.onConfirm,
  10414. "cancel": this.onCancel
  10415. },
  10416. "props": _extends({}, props)
  10417. });
  10418. }
  10419. };
  10420. // CONCATENATED MODULE: ./es/datetime-picker/TimePicker.js
  10421. var TimePicker_createNamespace = Object(create["a" /* createNamespace */])('time-picker'),
  10422. TimePicker_createComponent = TimePicker_createNamespace[0];
  10423. /* harmony default export */ var TimePicker = (TimePicker_createComponent({
  10424. mixins: [TimePickerMixin],
  10425. props: _extends({}, sharedProps, {
  10426. minHour: {
  10427. type: [Number, String],
  10428. default: 0
  10429. },
  10430. maxHour: {
  10431. type: [Number, String],
  10432. default: 23
  10433. },
  10434. minMinute: {
  10435. type: [Number, String],
  10436. default: 0
  10437. },
  10438. maxMinute: {
  10439. type: [Number, String],
  10440. default: 59
  10441. }
  10442. }),
  10443. computed: {
  10444. ranges: function ranges() {
  10445. return [{
  10446. type: 'hour',
  10447. range: [+this.minHour, +this.maxHour]
  10448. }, {
  10449. type: 'minute',
  10450. range: [+this.minMinute, +this.maxMinute]
  10451. }];
  10452. }
  10453. },
  10454. watch: {
  10455. filter: 'updateInnerValue',
  10456. minHour: function minHour() {
  10457. var _this = this;
  10458. this.$nextTick(function () {
  10459. _this.updateInnerValue();
  10460. });
  10461. },
  10462. maxHour: function maxHour(value) {
  10463. var _this$innerValue$spli = this.innerValue.split(':'),
  10464. hour = _this$innerValue$spli[0],
  10465. minute = _this$innerValue$spli[1];
  10466. if (hour >= value) {
  10467. this.innerValue = this.formatValue(value + ":" + minute);
  10468. this.updateColumnValue();
  10469. } else {
  10470. this.updateInnerValue();
  10471. }
  10472. },
  10473. minMinute: 'updateInnerValue',
  10474. maxMinute: function maxMinute(value) {
  10475. var _this$innerValue$spli2 = this.innerValue.split(':'),
  10476. hour = _this$innerValue$spli2[0],
  10477. minute = _this$innerValue$spli2[1];
  10478. if (minute >= value) {
  10479. this.innerValue = this.formatValue(hour + ":" + value);
  10480. this.updateColumnValue();
  10481. } else {
  10482. this.updateInnerValue();
  10483. }
  10484. },
  10485. value: function value(val) {
  10486. val = this.formatValue(val);
  10487. if (val !== this.innerValue) {
  10488. this.innerValue = val;
  10489. this.updateColumnValue();
  10490. }
  10491. }
  10492. },
  10493. methods: {
  10494. formatValue: function formatValue(value) {
  10495. if (!value) {
  10496. value = Object(string["b" /* padZero */])(this.minHour) + ":" + Object(string["b" /* padZero */])(this.minMinute);
  10497. }
  10498. var _value$split = value.split(':'),
  10499. hour = _value$split[0],
  10500. minute = _value$split[1];
  10501. hour = Object(string["b" /* padZero */])(range(hour, this.minHour, this.maxHour));
  10502. minute = Object(string["b" /* padZero */])(range(minute, this.minMinute, this.maxMinute));
  10503. return hour + ":" + minute;
  10504. },
  10505. updateInnerValue: function updateInnerValue() {
  10506. var _this$getPicker$getIn = this.getPicker().getIndexes(),
  10507. hourIndex = _this$getPicker$getIn[0],
  10508. minuteIndex = _this$getPicker$getIn[1];
  10509. var _this$originColumns = this.originColumns,
  10510. hourColumn = _this$originColumns[0],
  10511. minuteColumn = _this$originColumns[1];
  10512. var hour = hourColumn.values[hourIndex] || hourColumn.values[0];
  10513. var minute = minuteColumn.values[minuteIndex] || minuteColumn.values[0];
  10514. this.innerValue = this.formatValue(hour + ":" + minute);
  10515. this.updateColumnValue();
  10516. },
  10517. onChange: function onChange(picker) {
  10518. var _this2 = this;
  10519. this.updateInnerValue();
  10520. this.$nextTick(function () {
  10521. _this2.$nextTick(function () {
  10522. // https://github.com/vant-ui/vant/issues/9775
  10523. _this2.updateInnerValue();
  10524. _this2.$emit('change', picker);
  10525. });
  10526. });
  10527. },
  10528. updateColumnValue: function updateColumnValue() {
  10529. var _this3 = this;
  10530. var formatter = this.formatter;
  10531. var pair = this.innerValue.split(':');
  10532. var values = [formatter('hour', pair[0]), formatter('minute', pair[1])];
  10533. this.$nextTick(function () {
  10534. _this3.getPicker().setValues(values);
  10535. });
  10536. }
  10537. }
  10538. }));
  10539. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
  10540. function _setPrototypeOf(o, p) {
  10541. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  10542. o.__proto__ = p;
  10543. return o;
  10544. };
  10545. return _setPrototypeOf(o, p);
  10546. }
  10547. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js
  10548. function _isNativeReflectConstruct() {
  10549. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  10550. if (Reflect.construct.sham) return false;
  10551. if (typeof Proxy === "function") return true;
  10552. try {
  10553. Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
  10554. return true;
  10555. } catch (e) {
  10556. return false;
  10557. }
  10558. }
  10559. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/construct.js
  10560. function construct_construct(Parent, args, Class) {
  10561. if (_isNativeReflectConstruct()) {
  10562. construct_construct = Reflect.construct;
  10563. } else {
  10564. construct_construct = function _construct(Parent, args, Class) {
  10565. var a = [null];
  10566. a.push.apply(a, args);
  10567. var Constructor = Function.bind.apply(Parent, a);
  10568. var instance = new Constructor();
  10569. if (Class) _setPrototypeOf(instance, Class.prototype);
  10570. return instance;
  10571. };
  10572. }
  10573. return construct_construct.apply(null, arguments);
  10574. }
  10575. // CONCATENATED MODULE: ./es/datetime-picker/DatePicker.js
  10576. var currentYear = new Date().getFullYear();
  10577. var DatePicker_createNamespace = Object(create["a" /* createNamespace */])('date-picker'),
  10578. DatePicker_createComponent = DatePicker_createNamespace[0];
  10579. /* harmony default export */ var DatePicker = (DatePicker_createComponent({
  10580. mixins: [TimePickerMixin],
  10581. props: _extends({}, sharedProps, {
  10582. type: {
  10583. type: String,
  10584. default: 'datetime'
  10585. },
  10586. minDate: {
  10587. type: Date,
  10588. default: function _default() {
  10589. return new Date(currentYear - 10, 0, 1);
  10590. },
  10591. validator: isDate
  10592. },
  10593. maxDate: {
  10594. type: Date,
  10595. default: function _default() {
  10596. return new Date(currentYear + 10, 11, 31);
  10597. },
  10598. validator: isDate
  10599. }
  10600. }),
  10601. watch: {
  10602. filter: 'updateInnerValue',
  10603. minDate: function minDate() {
  10604. var _this = this;
  10605. this.$nextTick(function () {
  10606. _this.updateInnerValue();
  10607. });
  10608. },
  10609. maxDate: function maxDate(value) {
  10610. if (this.innerValue.valueOf() >= value.valueOf()) {
  10611. this.innerValue = value;
  10612. } else {
  10613. this.updateInnerValue();
  10614. }
  10615. },
  10616. value: function value(val) {
  10617. val = this.formatValue(val);
  10618. if (val && val.valueOf() !== this.innerValue.valueOf()) {
  10619. this.innerValue = val;
  10620. }
  10621. }
  10622. },
  10623. computed: {
  10624. ranges: function ranges() {
  10625. var _this$getBoundary = this.getBoundary('max', this.innerValue ? this.innerValue : this.minDate),
  10626. maxYear = _this$getBoundary.maxYear,
  10627. maxDate = _this$getBoundary.maxDate,
  10628. maxMonth = _this$getBoundary.maxMonth,
  10629. maxHour = _this$getBoundary.maxHour,
  10630. maxMinute = _this$getBoundary.maxMinute;
  10631. var _this$getBoundary2 = this.getBoundary('min', this.innerValue ? this.innerValue : this.minDate),
  10632. minYear = _this$getBoundary2.minYear,
  10633. minDate = _this$getBoundary2.minDate,
  10634. minMonth = _this$getBoundary2.minMonth,
  10635. minHour = _this$getBoundary2.minHour,
  10636. minMinute = _this$getBoundary2.minMinute;
  10637. var result = [{
  10638. type: 'year',
  10639. range: [minYear, maxYear]
  10640. }, {
  10641. type: 'month',
  10642. range: [minMonth, maxMonth]
  10643. }, {
  10644. type: 'day',
  10645. range: [minDate, maxDate]
  10646. }, {
  10647. type: 'hour',
  10648. range: [minHour, maxHour]
  10649. }, {
  10650. type: 'minute',
  10651. range: [minMinute, maxMinute]
  10652. }];
  10653. switch (this.type) {
  10654. case 'date':
  10655. result = result.slice(0, 3);
  10656. break;
  10657. case 'year-month':
  10658. result = result.slice(0, 2);
  10659. break;
  10660. case 'month-day':
  10661. result = result.slice(1, 3);
  10662. break;
  10663. case 'datehour':
  10664. result = result.slice(0, 4);
  10665. break;
  10666. }
  10667. if (this.columnsOrder) {
  10668. var columnsOrder = this.columnsOrder.concat(result.map(function (column) {
  10669. return column.type;
  10670. }));
  10671. result.sort(function (a, b) {
  10672. return columnsOrder.indexOf(a.type) - columnsOrder.indexOf(b.type);
  10673. });
  10674. }
  10675. return result;
  10676. }
  10677. },
  10678. methods: {
  10679. formatValue: function formatValue(value) {
  10680. var _this2 = this;
  10681. if (!isDate(value)) {
  10682. return null;
  10683. }
  10684. var minDate = new Date(this.minDate);
  10685. var maxDate = new Date(this.maxDate);
  10686. var dateMethods = {
  10687. year: 'getFullYear',
  10688. month: 'getMonth',
  10689. day: 'getDate',
  10690. hour: 'getHours',
  10691. minute: 'getMinutes'
  10692. };
  10693. if (this.originColumns) {
  10694. var dateColumns = this.originColumns.map(function (_ref, index) {
  10695. var type = _ref.type,
  10696. values = _ref.values;
  10697. var range = _this2.ranges[index].range;
  10698. var minDateVal = minDate[dateMethods[type]]();
  10699. var maxDateVal = maxDate[dateMethods[type]]();
  10700. var min = type === 'month' ? +values[0] - 1 : +values[0];
  10701. var max = type === 'month' ? +values[values.length - 1] - 1 : +values[values.length - 1];
  10702. return {
  10703. type: type,
  10704. values: [minDateVal < range[0] ? Math.max(minDateVal, min) : min || minDateVal, maxDateVal > range[1] ? Math.min(maxDateVal, max) : max || maxDateVal]
  10705. };
  10706. });
  10707. if (this.type === 'month-day') {
  10708. var year = (this.innerValue || this.minDate).getFullYear();
  10709. dateColumns.unshift({
  10710. type: 'year',
  10711. values: [year, year]
  10712. });
  10713. }
  10714. var dates = Object.keys(dateMethods).map(function (type) {
  10715. var _dateColumns$filter$;
  10716. return (_dateColumns$filter$ = dateColumns.filter(function (item) {
  10717. return item.type === type;
  10718. })[0]) == null ? void 0 : _dateColumns$filter$.values;
  10719. }).filter(function (item) {
  10720. return item;
  10721. });
  10722. minDate = construct_construct(Date, dates.map(function (val) {
  10723. return getTrueValue(val[0]);
  10724. }));
  10725. maxDate = construct_construct(Date, dates.map(function (val) {
  10726. return getTrueValue(val[1]);
  10727. }));
  10728. }
  10729. value = Math.max(value, minDate.getTime());
  10730. value = Math.min(value, maxDate.getTime());
  10731. return new Date(value);
  10732. },
  10733. getBoundary: function getBoundary(type, value) {
  10734. var _ref2;
  10735. var boundary = this[type + "Date"];
  10736. var year = boundary.getFullYear();
  10737. var month = 1;
  10738. var date = 1;
  10739. var hour = 0;
  10740. var minute = 0;
  10741. if (type === 'max') {
  10742. month = 12;
  10743. date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
  10744. hour = 23;
  10745. minute = 59;
  10746. }
  10747. if (value.getFullYear() === year) {
  10748. month = boundary.getMonth() + 1;
  10749. if (value.getMonth() + 1 === month) {
  10750. date = boundary.getDate();
  10751. if (value.getDate() === date) {
  10752. hour = boundary.getHours();
  10753. if (value.getHours() === hour) {
  10754. minute = boundary.getMinutes();
  10755. }
  10756. }
  10757. }
  10758. }
  10759. return _ref2 = {}, _ref2[type + "Year"] = year, _ref2[type + "Month"] = month, _ref2[type + "Date"] = date, _ref2[type + "Hour"] = hour, _ref2[type + "Minute"] = minute, _ref2;
  10760. },
  10761. updateInnerValue: function updateInnerValue() {
  10762. var _this3 = this;
  10763. var type = this.type;
  10764. var indexes = this.getPicker().getIndexes();
  10765. var getValue = function getValue(type) {
  10766. var index = 0;
  10767. _this3.originColumns.forEach(function (column, columnIndex) {
  10768. if (type === column.type) {
  10769. index = columnIndex;
  10770. }
  10771. });
  10772. var values = _this3.originColumns[index].values;
  10773. return getTrueValue(values[indexes[index]]);
  10774. };
  10775. var year;
  10776. var month;
  10777. var day;
  10778. if (type === 'month-day') {
  10779. year = (this.innerValue || this.minDate).getFullYear();
  10780. month = getValue('month');
  10781. day = getValue('day');
  10782. } else {
  10783. year = getValue('year');
  10784. month = getValue('month');
  10785. day = type === 'year-month' ? 1 : getValue('day');
  10786. }
  10787. var maxDay = getMonthEndDay(year, month);
  10788. day = day > maxDay ? maxDay : day;
  10789. var hour = 0;
  10790. var minute = 0;
  10791. if (type === 'datehour') {
  10792. hour = getValue('hour');
  10793. }
  10794. if (type === 'datetime') {
  10795. hour = getValue('hour');
  10796. minute = getValue('minute');
  10797. }
  10798. var value = new Date(year, month - 1, day, hour, minute);
  10799. this.innerValue = this.formatValue(value);
  10800. },
  10801. onChange: function onChange(picker) {
  10802. var _this4 = this;
  10803. this.updateInnerValue();
  10804. this.$nextTick(function () {
  10805. _this4.$nextTick(function () {
  10806. // https://github.com/vant-ui/vant/issues/9775
  10807. _this4.updateInnerValue();
  10808. _this4.$emit('change', picker);
  10809. });
  10810. });
  10811. },
  10812. updateColumnValue: function updateColumnValue() {
  10813. var _this5 = this;
  10814. var value = this.innerValue ? this.innerValue : this.minDate;
  10815. var formatter = this.formatter;
  10816. var values = this.originColumns.map(function (column) {
  10817. switch (column.type) {
  10818. case 'year':
  10819. return formatter('year', "" + value.getFullYear());
  10820. case 'month':
  10821. return formatter('month', Object(string["b" /* padZero */])(value.getMonth() + 1));
  10822. case 'day':
  10823. return formatter('day', Object(string["b" /* padZero */])(value.getDate()));
  10824. case 'hour':
  10825. return formatter('hour', Object(string["b" /* padZero */])(value.getHours()));
  10826. case 'minute':
  10827. return formatter('minute', Object(string["b" /* padZero */])(value.getMinutes()));
  10828. default:
  10829. // no default
  10830. return null;
  10831. }
  10832. });
  10833. this.$nextTick(function () {
  10834. _this5.getPicker().setValues(values);
  10835. });
  10836. }
  10837. }
  10838. }));
  10839. // CONCATENATED MODULE: ./es/datetime-picker/index.js
  10840. var datetime_picker_createNamespace = Object(create["a" /* createNamespace */])('datetime-picker'),
  10841. datetime_picker_createComponent = datetime_picker_createNamespace[0],
  10842. datetime_picker_bem = datetime_picker_createNamespace[1];
  10843. /* harmony default export */ var datetime_picker = (datetime_picker_createComponent({
  10844. props: _extends({}, TimePicker.props, DatePicker.props),
  10845. methods: {
  10846. // @exposed-api
  10847. getPicker: function getPicker() {
  10848. return this.$refs.root.getProxiedPicker();
  10849. }
  10850. },
  10851. render: function render() {
  10852. var h = arguments[0];
  10853. var Component = this.type === 'time' ? TimePicker : DatePicker;
  10854. return h(Component, {
  10855. "ref": "root",
  10856. "class": datetime_picker_bem(),
  10857. "scopedSlots": this.$scopedSlots,
  10858. "props": _extends({}, this.$props),
  10859. "on": _extends({}, this.$listeners)
  10860. });
  10861. }
  10862. }));
  10863. // CONCATENATED MODULE: ./es/divider/index.js
  10864. // Utils
  10865. // Types
  10866. var divider_createNamespace = Object(create["a" /* createNamespace */])('divider'),
  10867. divider_createComponent = divider_createNamespace[0],
  10868. divider_bem = divider_createNamespace[1];
  10869. function Divider(h, props, slots, ctx) {
  10870. var _bem;
  10871. return h("div", helper_default()([{
  10872. "attrs": {
  10873. "role": "separator"
  10874. },
  10875. "style": {
  10876. borderColor: props.borderColor
  10877. },
  10878. "class": divider_bem((_bem = {
  10879. dashed: props.dashed,
  10880. hairline: props.hairline
  10881. }, _bem["content-" + props.contentPosition] = slots.default, _bem))
  10882. }, inherit(ctx, true)]), [slots.default && slots.default()]);
  10883. }
  10884. Divider.props = {
  10885. dashed: Boolean,
  10886. hairline: {
  10887. type: Boolean,
  10888. default: true
  10889. },
  10890. contentPosition: {
  10891. type: String,
  10892. default: 'center'
  10893. }
  10894. };
  10895. /* harmony default export */ var divider = (divider_createComponent(Divider));
  10896. // CONCATENATED MODULE: ./es/dropdown-item/index.js
  10897. // Utils
  10898. // Mixins
  10899. // Components
  10900. var dropdown_item_createNamespace = Object(create["a" /* createNamespace */])('dropdown-item'),
  10901. dropdown_item_createComponent = dropdown_item_createNamespace[0],
  10902. dropdown_item_bem = dropdown_item_createNamespace[1];
  10903. /* harmony default export */ var dropdown_item = (dropdown_item_createComponent({
  10904. mixins: [PortalMixin({
  10905. ref: 'wrapper'
  10906. }), ChildrenMixin('vanDropdownMenu')],
  10907. props: {
  10908. value: null,
  10909. title: String,
  10910. disabled: Boolean,
  10911. titleClass: String,
  10912. options: {
  10913. type: Array,
  10914. default: function _default() {
  10915. return [];
  10916. }
  10917. },
  10918. lazyRender: {
  10919. type: Boolean,
  10920. default: true
  10921. }
  10922. },
  10923. data: function data() {
  10924. return {
  10925. transition: true,
  10926. showPopup: false,
  10927. showWrapper: false
  10928. };
  10929. },
  10930. computed: {
  10931. displayTitle: function displayTitle() {
  10932. var _this = this;
  10933. if (this.title) {
  10934. return this.title;
  10935. }
  10936. var match = this.options.filter(function (option) {
  10937. return option.value === _this.value;
  10938. });
  10939. return match.length ? match[0].text : '';
  10940. }
  10941. },
  10942. watch: {
  10943. showPopup: function showPopup(val) {
  10944. this.bindScroll(val);
  10945. }
  10946. },
  10947. beforeCreate: function beforeCreate() {
  10948. var _this2 = this;
  10949. var createEmitter = function createEmitter(eventName) {
  10950. return function () {
  10951. return _this2.$emit(eventName);
  10952. };
  10953. };
  10954. this.onOpen = createEmitter('open');
  10955. this.onClose = createEmitter('close');
  10956. this.onOpened = createEmitter('opened');
  10957. },
  10958. methods: {
  10959. // @exposed-api
  10960. toggle: function toggle(show, options) {
  10961. if (show === void 0) {
  10962. show = !this.showPopup;
  10963. }
  10964. if (options === void 0) {
  10965. options = {};
  10966. }
  10967. if (show === this.showPopup) {
  10968. return;
  10969. }
  10970. this.transition = !options.immediate;
  10971. this.showPopup = show;
  10972. if (show) {
  10973. this.parent.updateOffset();
  10974. this.showWrapper = true;
  10975. }
  10976. },
  10977. bindScroll: function bindScroll(bind) {
  10978. var scroller = this.parent.scroller;
  10979. var action = bind ? event_on : off;
  10980. action(scroller, 'scroll', this.onScroll, true);
  10981. },
  10982. onScroll: function onScroll() {
  10983. this.parent.updateOffset();
  10984. },
  10985. onClickWrapper: function onClickWrapper(event) {
  10986. // prevent being identified as clicking outside and closed when use get-contaienr
  10987. if (this.getContainer) {
  10988. event.stopPropagation();
  10989. }
  10990. }
  10991. },
  10992. render: function render() {
  10993. var _this3 = this;
  10994. var h = arguments[0];
  10995. var _this$parent = this.parent,
  10996. zIndex = _this$parent.zIndex,
  10997. offset = _this$parent.offset,
  10998. overlay = _this$parent.overlay,
  10999. duration = _this$parent.duration,
  11000. direction = _this$parent.direction,
  11001. activeColor = _this$parent.activeColor,
  11002. closeOnClickOverlay = _this$parent.closeOnClickOverlay;
  11003. var Options = this.options.map(function (option) {
  11004. var active = option.value === _this3.value;
  11005. return h(cell, {
  11006. "attrs": {
  11007. "clickable": true,
  11008. "icon": option.icon,
  11009. "title": option.text
  11010. },
  11011. "key": option.value,
  11012. "class": dropdown_item_bem('option', {
  11013. active: active
  11014. }),
  11015. "style": {
  11016. color: active ? activeColor : ''
  11017. },
  11018. "on": {
  11019. "click": function click() {
  11020. _this3.showPopup = false;
  11021. if (option.value !== _this3.value) {
  11022. _this3.$emit('input', option.value);
  11023. _this3.$emit('change', option.value);
  11024. }
  11025. }
  11026. }
  11027. }, [active && h(es_icon, {
  11028. "class": dropdown_item_bem('icon'),
  11029. "attrs": {
  11030. "color": activeColor,
  11031. "name": "success"
  11032. }
  11033. })]);
  11034. });
  11035. var style = {
  11036. zIndex: zIndex
  11037. };
  11038. if (direction === 'down') {
  11039. style.top = offset + "px";
  11040. } else {
  11041. style.bottom = offset + "px";
  11042. }
  11043. return h("div", [h("div", {
  11044. "directives": [{
  11045. name: "show",
  11046. value: this.showWrapper
  11047. }],
  11048. "ref": "wrapper",
  11049. "style": style,
  11050. "class": dropdown_item_bem([direction]),
  11051. "on": {
  11052. "click": this.onClickWrapper
  11053. }
  11054. }, [h(popup, {
  11055. "attrs": {
  11056. "overlay": overlay,
  11057. "position": direction === 'down' ? 'top' : 'bottom',
  11058. "duration": this.transition ? duration : 0,
  11059. "lazyRender": this.lazyRender,
  11060. "overlayStyle": {
  11061. position: 'absolute'
  11062. },
  11063. "closeOnClickOverlay": closeOnClickOverlay
  11064. },
  11065. "class": dropdown_item_bem('content'),
  11066. "on": {
  11067. "open": this.onOpen,
  11068. "close": this.onClose,
  11069. "opened": this.onOpened,
  11070. "closed": function closed() {
  11071. _this3.showWrapper = false;
  11072. _this3.$emit('closed');
  11073. }
  11074. },
  11075. "model": {
  11076. value: _this3.showPopup,
  11077. callback: function callback($$v) {
  11078. _this3.showPopup = $$v;
  11079. }
  11080. }
  11081. }, [Options, this.slots('default')])])]);
  11082. }
  11083. }));
  11084. // CONCATENATED MODULE: ./es/mixins/click-outside.js
  11085. /**
  11086. * Listen to click outside event
  11087. */
  11088. var click_outside_ClickOutsideMixin = function ClickOutsideMixin(config) {
  11089. return {
  11090. props: {
  11091. closeOnClickOutside: {
  11092. type: Boolean,
  11093. default: true
  11094. }
  11095. },
  11096. data: function data() {
  11097. var _this = this;
  11098. var clickOutsideHandler = function clickOutsideHandler(event) {
  11099. if (_this.closeOnClickOutside && !_this.$el.contains(event.target)) {
  11100. _this[config.method]();
  11101. }
  11102. };
  11103. return {
  11104. clickOutsideHandler: clickOutsideHandler
  11105. };
  11106. },
  11107. mounted: function mounted() {
  11108. event_on(document, config.event, this.clickOutsideHandler);
  11109. },
  11110. beforeDestroy: function beforeDestroy() {
  11111. off(document, config.event, this.clickOutsideHandler);
  11112. }
  11113. };
  11114. };
  11115. // CONCATENATED MODULE: ./es/dropdown-menu/index.js
  11116. // Utils
  11117. // Mixins
  11118. var dropdown_menu_createNamespace = Object(create["a" /* createNamespace */])('dropdown-menu'),
  11119. dropdown_menu_createComponent = dropdown_menu_createNamespace[0],
  11120. dropdown_menu_bem = dropdown_menu_createNamespace[1];
  11121. /* harmony default export */ var dropdown_menu = (dropdown_menu_createComponent({
  11122. mixins: [ParentMixin('vanDropdownMenu'), click_outside_ClickOutsideMixin({
  11123. event: 'click',
  11124. method: 'onClickOutside'
  11125. })],
  11126. props: {
  11127. zIndex: [Number, String],
  11128. activeColor: String,
  11129. overlay: {
  11130. type: Boolean,
  11131. default: true
  11132. },
  11133. duration: {
  11134. type: [Number, String],
  11135. default: 0.2
  11136. },
  11137. direction: {
  11138. type: String,
  11139. default: 'down'
  11140. },
  11141. closeOnClickOverlay: {
  11142. type: Boolean,
  11143. default: true
  11144. }
  11145. },
  11146. data: function data() {
  11147. return {
  11148. offset: 0
  11149. };
  11150. },
  11151. computed: {
  11152. scroller: function scroller() {
  11153. return getScroller(this.$el);
  11154. },
  11155. opened: function opened() {
  11156. return this.children.some(function (item) {
  11157. return item.showWrapper;
  11158. });
  11159. },
  11160. barStyle: function barStyle() {
  11161. if (this.opened && Object(utils["c" /* isDef */])(this.zIndex)) {
  11162. return {
  11163. zIndex: 1 + this.zIndex
  11164. };
  11165. }
  11166. }
  11167. },
  11168. methods: {
  11169. updateOffset: function updateOffset() {
  11170. if (!this.$refs.bar) {
  11171. return;
  11172. }
  11173. var rect = this.$refs.bar.getBoundingClientRect();
  11174. if (this.direction === 'down') {
  11175. this.offset = rect.bottom;
  11176. } else {
  11177. this.offset = window.innerHeight - rect.top;
  11178. }
  11179. },
  11180. toggleItem: function toggleItem(active) {
  11181. this.children.forEach(function (item, index) {
  11182. if (index === active) {
  11183. item.toggle();
  11184. } else if (item.showPopup) {
  11185. item.toggle(false, {
  11186. immediate: true
  11187. });
  11188. }
  11189. });
  11190. },
  11191. onClickOutside: function onClickOutside() {
  11192. this.children.forEach(function (item) {
  11193. item.toggle(false);
  11194. });
  11195. }
  11196. },
  11197. render: function render() {
  11198. var _this = this;
  11199. var h = arguments[0];
  11200. var Titles = this.children.map(function (item, index) {
  11201. return h("div", {
  11202. "attrs": {
  11203. "role": "button",
  11204. "tabindex": item.disabled ? -1 : 0
  11205. },
  11206. "class": dropdown_menu_bem('item', {
  11207. disabled: item.disabled
  11208. }),
  11209. "on": {
  11210. "click": function click() {
  11211. if (!item.disabled) {
  11212. _this.toggleItem(index);
  11213. }
  11214. }
  11215. }
  11216. }, [h("span", {
  11217. "class": [dropdown_menu_bem('title', {
  11218. active: item.showPopup,
  11219. down: item.showPopup === (_this.direction === 'down')
  11220. }), item.titleClass],
  11221. "style": {
  11222. color: item.showPopup ? _this.activeColor : ''
  11223. }
  11224. }, [h("div", {
  11225. "class": "van-ellipsis"
  11226. }, [item.slots('title') || item.displayTitle])])]);
  11227. });
  11228. return h("div", {
  11229. "class": dropdown_menu_bem()
  11230. }, [h("div", {
  11231. "ref": "bar",
  11232. "style": this.barStyle,
  11233. "class": dropdown_menu_bem('bar', {
  11234. opened: this.opened
  11235. })
  11236. }, [Titles]), this.slots('default')]);
  11237. }
  11238. }));
  11239. // CONCATENATED MODULE: ./es/empty/Network.js
  11240. var prefix = 'van-empty-network-';
  11241. /* harmony default export */ var Network = ({
  11242. render: function render() {
  11243. var h = arguments[0];
  11244. var genStop = function genStop(color, offset, opacity) {
  11245. return h("stop", {
  11246. "attrs": {
  11247. "stop-color": color,
  11248. "offset": offset + "%",
  11249. "stop-opacity": opacity
  11250. }
  11251. });
  11252. };
  11253. return h("svg", {
  11254. "attrs": {
  11255. "viewBox": "0 0 160 160",
  11256. "xmlns": "http://www.w3.org/2000/svg"
  11257. }
  11258. }, [h("defs", [h("linearGradient", {
  11259. "attrs": {
  11260. "id": prefix + "1",
  11261. "x1": "64.022%",
  11262. "y1": "100%",
  11263. "x2": "64.022%",
  11264. "y2": "0%"
  11265. }
  11266. }, [genStop('#FFF', 0, 0.5), genStop('#F2F3F5', 100)]), h("linearGradient", {
  11267. "attrs": {
  11268. "id": prefix + "2",
  11269. "x1": "50%",
  11270. "y1": "0%",
  11271. "x2": "50%",
  11272. "y2": "84.459%"
  11273. }
  11274. }, [genStop('#EBEDF0', 0), genStop('#DCDEE0', 100, 0)]), h("linearGradient", {
  11275. "attrs": {
  11276. "id": prefix + "3",
  11277. "x1": "100%",
  11278. "y1": "0%",
  11279. "x2": "100%",
  11280. "y2": "100%"
  11281. }
  11282. }, [genStop('#EAEDF0', 0), genStop('#DCDEE0', 100)]), h("linearGradient", {
  11283. "attrs": {
  11284. "id": prefix + "4",
  11285. "x1": "100%",
  11286. "y1": "100%",
  11287. "x2": "100%",
  11288. "y2": "0%"
  11289. }
  11290. }, [genStop('#EAEDF0', 0), genStop('#DCDEE0', 100)]), h("linearGradient", {
  11291. "attrs": {
  11292. "id": prefix + "5",
  11293. "x1": "0%",
  11294. "y1": "43.982%",
  11295. "x2": "100%",
  11296. "y2": "54.703%"
  11297. }
  11298. }, [genStop('#EAEDF0', 0), genStop('#DCDEE0', 100)]), h("linearGradient", {
  11299. "attrs": {
  11300. "id": prefix + "6",
  11301. "x1": "94.535%",
  11302. "y1": "43.837%",
  11303. "x2": "5.465%",
  11304. "y2": "54.948%"
  11305. }
  11306. }, [genStop('#EAEDF0', 0), genStop('#DCDEE0', 100)]), h("radialGradient", {
  11307. "attrs": {
  11308. "id": prefix + "7",
  11309. "cx": "50%",
  11310. "cy": "0%",
  11311. "fx": "50%",
  11312. "fy": "0%",
  11313. "r": "100%",
  11314. "gradientTransform": "matrix(0 1 -.54835 0 .5 -.5)"
  11315. }
  11316. }, [genStop('#EBEDF0', 0), genStop('#FFF', 100, 0)])]), h("g", {
  11317. "attrs": {
  11318. "fill": "none",
  11319. "fill-rule": "evenodd"
  11320. }
  11321. }, [h("g", {
  11322. "attrs": {
  11323. "opacity": ".8"
  11324. }
  11325. }, [h("path", {
  11326. "attrs": {
  11327. "d": "M0 124V46h20v20h14v58H0z",
  11328. "fill": "url(#" + prefix + "1)",
  11329. "transform": "matrix(-1 0 0 1 36 7)"
  11330. }
  11331. }), h("path", {
  11332. "attrs": {
  11333. "d": "M121 8h22.231v14H152v77.37h-31V8z",
  11334. "fill": "url(#" + prefix + "1)",
  11335. "transform": "translate(2 7)"
  11336. }
  11337. })]), h("path", {
  11338. "attrs": {
  11339. "fill": "url(#" + prefix + "7)",
  11340. "d": "M0 139h160v21H0z"
  11341. }
  11342. }), h("path", {
  11343. "attrs": {
  11344. "d": "M37 18a7 7 0 013 13.326v26.742c0 1.23-.997 2.227-2.227 2.227h-1.546A2.227 2.227 0 0134 58.068V31.326A7 7 0 0137 18z",
  11345. "fill": "url(#" + prefix + "2)",
  11346. "fill-rule": "nonzero",
  11347. "transform": "translate(43 36)"
  11348. }
  11349. }), h("g", {
  11350. "attrs": {
  11351. "opacity": ".6",
  11352. "stroke-linecap": "round",
  11353. "stroke-width": "7"
  11354. }
  11355. }, [h("path", {
  11356. "attrs": {
  11357. "d": "M20.875 11.136a18.868 18.868 0 00-5.284 13.121c0 5.094 2.012 9.718 5.284 13.12",
  11358. "stroke": "url(#" + prefix + "3)",
  11359. "transform": "translate(43 36)"
  11360. }
  11361. }), h("path", {
  11362. "attrs": {
  11363. "d": "M9.849 0C3.756 6.225 0 14.747 0 24.146c0 9.398 3.756 17.92 9.849 24.145",
  11364. "stroke": "url(#" + prefix + "3)",
  11365. "transform": "translate(43 36)"
  11366. }
  11367. }), h("path", {
  11368. "attrs": {
  11369. "d": "M57.625 11.136a18.868 18.868 0 00-5.284 13.121c0 5.094 2.012 9.718 5.284 13.12",
  11370. "stroke": "url(#" + prefix + "4)",
  11371. "transform": "rotate(-180 76.483 42.257)"
  11372. }
  11373. }), h("path", {
  11374. "attrs": {
  11375. "d": "M73.216 0c-6.093 6.225-9.849 14.747-9.849 24.146 0 9.398 3.756 17.92 9.849 24.145",
  11376. "stroke": "url(#" + prefix + "4)",
  11377. "transform": "rotate(-180 89.791 42.146)"
  11378. }
  11379. })]), h("g", {
  11380. "attrs": {
  11381. "transform": "translate(31 105)",
  11382. "fill-rule": "nonzero"
  11383. }
  11384. }, [h("rect", {
  11385. "attrs": {
  11386. "fill": "url(#" + prefix + "5)",
  11387. "width": "98",
  11388. "height": "34",
  11389. "rx": "2"
  11390. }
  11391. }), h("rect", {
  11392. "attrs": {
  11393. "fill": "#FFF",
  11394. "x": "9",
  11395. "y": "8",
  11396. "width": "80",
  11397. "height": "18",
  11398. "rx": "1.114"
  11399. }
  11400. }), h("rect", {
  11401. "attrs": {
  11402. "fill": "url(#" + prefix + "6)",
  11403. "x": "15",
  11404. "y": "12",
  11405. "width": "18",
  11406. "height": "6",
  11407. "rx": "1.114"
  11408. }
  11409. })])])]);
  11410. }
  11411. });
  11412. // CONCATENATED MODULE: ./es/empty/index.js
  11413. var empty_createNamespace = Object(create["a" /* createNamespace */])('empty'),
  11414. empty_createComponent = empty_createNamespace[0],
  11415. empty_bem = empty_createNamespace[1];
  11416. var PRESETS = ['error', 'search', 'default'];
  11417. /* harmony default export */ var empty = (empty_createComponent({
  11418. props: {
  11419. imageSize: [Number, String],
  11420. description: String,
  11421. image: {
  11422. type: String,
  11423. default: 'default'
  11424. }
  11425. },
  11426. methods: {
  11427. genImageContent: function genImageContent() {
  11428. var h = this.$createElement;
  11429. var slots = this.slots('image');
  11430. if (slots) {
  11431. return slots;
  11432. }
  11433. if (this.image === 'network') {
  11434. return h(Network);
  11435. }
  11436. var image = this.image;
  11437. if (PRESETS.indexOf(image) !== -1) {
  11438. image = "https://img01.yzcdn.cn/vant/empty-image-" + image + ".png";
  11439. }
  11440. return h("img", {
  11441. "attrs": {
  11442. "src": image
  11443. }
  11444. });
  11445. },
  11446. genImage: function genImage() {
  11447. var h = this.$createElement;
  11448. var imageStyle = {
  11449. width: Object(unit["a" /* addUnit */])(this.imageSize),
  11450. height: Object(unit["a" /* addUnit */])(this.imageSize)
  11451. };
  11452. return h("div", {
  11453. "class": empty_bem('image'),
  11454. "style": imageStyle
  11455. }, [this.genImageContent()]);
  11456. },
  11457. genDescription: function genDescription() {
  11458. var h = this.$createElement;
  11459. var description = this.slots('description') || this.description;
  11460. if (description) {
  11461. return h("p", {
  11462. "class": empty_bem('description')
  11463. }, [description]);
  11464. }
  11465. },
  11466. genBottom: function genBottom() {
  11467. var h = this.$createElement;
  11468. var slot = this.slots();
  11469. if (slot) {
  11470. return h("div", {
  11471. "class": empty_bem('bottom')
  11472. }, [slot]);
  11473. }
  11474. }
  11475. },
  11476. render: function render() {
  11477. var h = arguments[0];
  11478. return h("div", {
  11479. "class": empty_bem()
  11480. }, [this.genImage(), this.genDescription(), this.genBottom()]);
  11481. }
  11482. }));
  11483. // CONCATENATED MODULE: ./es/form/index.js
  11484. var form_createNamespace = Object(create["a" /* createNamespace */])('form'),
  11485. form_createComponent = form_createNamespace[0],
  11486. form_bem = form_createNamespace[1];
  11487. /* harmony default export */ var es_form = (form_createComponent({
  11488. props: {
  11489. colon: Boolean,
  11490. disabled: Boolean,
  11491. readonly: Boolean,
  11492. labelWidth: [Number, String],
  11493. labelAlign: String,
  11494. inputAlign: String,
  11495. scrollToError: Boolean,
  11496. validateFirst: Boolean,
  11497. errorMessageAlign: String,
  11498. submitOnEnter: {
  11499. type: Boolean,
  11500. default: true
  11501. },
  11502. validateTrigger: {
  11503. type: String,
  11504. default: 'onBlur'
  11505. },
  11506. showError: {
  11507. type: Boolean,
  11508. default: true
  11509. },
  11510. showErrorMessage: {
  11511. type: Boolean,
  11512. default: true
  11513. }
  11514. },
  11515. provide: function provide() {
  11516. return {
  11517. vanForm: this
  11518. };
  11519. },
  11520. data: function data() {
  11521. return {
  11522. fields: []
  11523. };
  11524. },
  11525. methods: {
  11526. getFieldsByNames: function getFieldsByNames(names) {
  11527. if (names) {
  11528. return this.fields.filter(function (field) {
  11529. return names.indexOf(field.name) !== -1;
  11530. });
  11531. }
  11532. return this.fields;
  11533. },
  11534. validateSeq: function validateSeq(names) {
  11535. var _this = this;
  11536. return new Promise(function (resolve, reject) {
  11537. var errors = [];
  11538. var fields = _this.getFieldsByNames(names);
  11539. fields.reduce(function (promise, field) {
  11540. return promise.then(function () {
  11541. if (!errors.length) {
  11542. return field.validate().then(function (error) {
  11543. if (error) {
  11544. errors.push(error);
  11545. }
  11546. });
  11547. }
  11548. });
  11549. }, Promise.resolve()).then(function () {
  11550. if (errors.length) {
  11551. reject(errors);
  11552. } else {
  11553. resolve();
  11554. }
  11555. });
  11556. });
  11557. },
  11558. validateFields: function validateFields(names) {
  11559. var _this2 = this;
  11560. return new Promise(function (resolve, reject) {
  11561. var fields = _this2.getFieldsByNames(names);
  11562. Promise.all(fields.map(function (item) {
  11563. return item.validate();
  11564. })).then(function (errors) {
  11565. errors = errors.filter(function (item) {
  11566. return item;
  11567. });
  11568. if (errors.length) {
  11569. reject(errors);
  11570. } else {
  11571. resolve();
  11572. }
  11573. });
  11574. });
  11575. },
  11576. // @exposed-api
  11577. validate: function validate(name) {
  11578. if (name && !Array.isArray(name)) {
  11579. return this.validateField(name);
  11580. }
  11581. return this.validateFirst ? this.validateSeq(name) : this.validateFields(name);
  11582. },
  11583. validateField: function validateField(name) {
  11584. var matched = this.fields.filter(function (item) {
  11585. return item.name === name;
  11586. });
  11587. if (matched.length) {
  11588. return new Promise(function (resolve, reject) {
  11589. matched[0].validate().then(function (error) {
  11590. if (error) {
  11591. reject(error);
  11592. } else {
  11593. resolve();
  11594. }
  11595. });
  11596. });
  11597. }
  11598. return Promise.reject();
  11599. },
  11600. // @exposed-api
  11601. resetValidation: function resetValidation(name) {
  11602. if (name && !Array.isArray(name)) {
  11603. name = [name];
  11604. }
  11605. var fields = this.getFieldsByNames(name);
  11606. fields.forEach(function (item) {
  11607. item.resetValidation();
  11608. });
  11609. },
  11610. // @exposed-api
  11611. scrollToField: function scrollToField(name, options) {
  11612. this.fields.some(function (item) {
  11613. if (item.name === name) {
  11614. item.$el.scrollIntoView(options);
  11615. return true;
  11616. }
  11617. return false;
  11618. });
  11619. },
  11620. addField: function addField(field) {
  11621. this.fields.push(field);
  11622. sortChildren(this.fields, this);
  11623. },
  11624. removeField: function removeField(field) {
  11625. this.fields = this.fields.filter(function (item) {
  11626. return item !== field;
  11627. });
  11628. },
  11629. getValues: function getValues() {
  11630. return this.fields.reduce(function (form, field) {
  11631. form[field.name] = field.formValue;
  11632. return form;
  11633. }, {});
  11634. },
  11635. onSubmit: function onSubmit(event) {
  11636. event.preventDefault();
  11637. this.submit();
  11638. },
  11639. // @exposed-api
  11640. submit: function submit() {
  11641. var _this3 = this;
  11642. var values = this.getValues();
  11643. this.validate().then(function () {
  11644. _this3.$emit('submit', values);
  11645. }).catch(function (errors) {
  11646. _this3.$emit('failed', {
  11647. values: values,
  11648. errors: errors
  11649. });
  11650. if (_this3.scrollToError) {
  11651. _this3.scrollToField(errors[0].name);
  11652. }
  11653. });
  11654. }
  11655. },
  11656. render: function render() {
  11657. var h = arguments[0];
  11658. return h("form", {
  11659. "class": form_bem(),
  11660. "on": {
  11661. "submit": this.onSubmit
  11662. }
  11663. }, [this.slots()]);
  11664. }
  11665. }));
  11666. // CONCATENATED MODULE: ./es/goods-action-icon/index.js
  11667. var goods_action_icon_createNamespace = Object(create["a" /* createNamespace */])('goods-action-icon'),
  11668. goods_action_icon_createComponent = goods_action_icon_createNamespace[0],
  11669. goods_action_icon_bem = goods_action_icon_createNamespace[1];
  11670. /* harmony default export */ var goods_action_icon = (goods_action_icon_createComponent({
  11671. mixins: [ChildrenMixin('vanGoodsAction')],
  11672. props: _extends({}, routeProps, {
  11673. dot: Boolean,
  11674. text: String,
  11675. icon: String,
  11676. color: String,
  11677. // @deprecated
  11678. info: [Number, String],
  11679. badge: [Number, String],
  11680. iconClass: null
  11681. }),
  11682. methods: {
  11683. onClick: function onClick(event) {
  11684. this.$emit('click', event);
  11685. route(this.$router, this);
  11686. },
  11687. genIcon: function genIcon() {
  11688. var _this$badge;
  11689. var h = this.$createElement;
  11690. var slot = this.slots('icon');
  11691. var info = (_this$badge = this.badge) != null ? _this$badge : this.info;
  11692. if (false) {}
  11693. if (slot) {
  11694. return h("div", {
  11695. "class": goods_action_icon_bem('icon')
  11696. }, [slot, h(es_info, {
  11697. "attrs": {
  11698. "dot": this.dot,
  11699. "info": info
  11700. }
  11701. })]);
  11702. }
  11703. return h(es_icon, {
  11704. "class": [goods_action_icon_bem('icon'), this.iconClass],
  11705. "attrs": {
  11706. "tag": "div",
  11707. "dot": this.dot,
  11708. "name": this.icon,
  11709. "badge": info,
  11710. "color": this.color
  11711. }
  11712. });
  11713. }
  11714. },
  11715. render: function render() {
  11716. var h = arguments[0];
  11717. return h("div", {
  11718. "attrs": {
  11719. "role": "button",
  11720. "tabindex": "0"
  11721. },
  11722. "class": goods_action_icon_bem(),
  11723. "on": {
  11724. "click": this.onClick
  11725. }
  11726. }, [this.genIcon(), this.slots() || this.text]);
  11727. }
  11728. }));
  11729. // CONCATENATED MODULE: ./es/grid/index.js
  11730. var grid_createNamespace = Object(create["a" /* createNamespace */])('grid'),
  11731. grid_createComponent = grid_createNamespace[0],
  11732. grid_bem = grid_createNamespace[1];
  11733. /* harmony default export */ var grid = (grid_createComponent({
  11734. mixins: [ParentMixin('vanGrid')],
  11735. props: {
  11736. square: Boolean,
  11737. gutter: [Number, String],
  11738. iconSize: [Number, String],
  11739. direction: String,
  11740. clickable: Boolean,
  11741. columnNum: {
  11742. type: [Number, String],
  11743. default: 4
  11744. },
  11745. center: {
  11746. type: Boolean,
  11747. default: true
  11748. },
  11749. border: {
  11750. type: Boolean,
  11751. default: true
  11752. }
  11753. },
  11754. computed: {
  11755. style: function style() {
  11756. var gutter = this.gutter;
  11757. if (gutter) {
  11758. return {
  11759. paddingLeft: Object(unit["a" /* addUnit */])(gutter)
  11760. };
  11761. }
  11762. }
  11763. },
  11764. render: function render() {
  11765. var _ref;
  11766. var h = arguments[0];
  11767. return h("div", {
  11768. "style": this.style,
  11769. "class": [grid_bem(), (_ref = {}, _ref[BORDER_TOP] = this.border && !this.gutter, _ref)]
  11770. }, [this.slots()]);
  11771. }
  11772. }));
  11773. // CONCATENATED MODULE: ./es/grid-item/index.js
  11774. // Utils
  11775. // Mixins
  11776. // Components
  11777. var grid_item_createNamespace = Object(create["a" /* createNamespace */])('grid-item'),
  11778. grid_item_createComponent = grid_item_createNamespace[0],
  11779. grid_item_bem = grid_item_createNamespace[1];
  11780. /* harmony default export */ var grid_item = (grid_item_createComponent({
  11781. mixins: [ChildrenMixin('vanGrid')],
  11782. props: _extends({}, routeProps, {
  11783. dot: Boolean,
  11784. text: String,
  11785. icon: String,
  11786. iconPrefix: String,
  11787. // @deprecated
  11788. info: [Number, String],
  11789. badge: [Number, String]
  11790. }),
  11791. computed: {
  11792. style: function style() {
  11793. var _this$parent = this.parent,
  11794. square = _this$parent.square,
  11795. gutter = _this$parent.gutter,
  11796. columnNum = _this$parent.columnNum;
  11797. var percent = 100 / columnNum + "%";
  11798. var style = {
  11799. flexBasis: percent
  11800. };
  11801. if (square) {
  11802. style.paddingTop = percent;
  11803. } else if (gutter) {
  11804. var gutterValue = Object(unit["a" /* addUnit */])(gutter);
  11805. style.paddingRight = gutterValue;
  11806. if (this.index >= columnNum) {
  11807. style.marginTop = gutterValue;
  11808. }
  11809. }
  11810. return style;
  11811. },
  11812. contentStyle: function contentStyle() {
  11813. var _this$parent2 = this.parent,
  11814. square = _this$parent2.square,
  11815. gutter = _this$parent2.gutter;
  11816. if (square && gutter) {
  11817. var gutterValue = Object(unit["a" /* addUnit */])(gutter);
  11818. return {
  11819. right: gutterValue,
  11820. bottom: gutterValue,
  11821. height: 'auto'
  11822. };
  11823. }
  11824. }
  11825. },
  11826. methods: {
  11827. onClick: function onClick(event) {
  11828. this.$emit('click', event);
  11829. route(this.$router, this);
  11830. },
  11831. genIcon: function genIcon() {
  11832. var _this$badge;
  11833. var h = this.$createElement;
  11834. var iconSlot = this.slots('icon');
  11835. var info = (_this$badge = this.badge) != null ? _this$badge : this.info;
  11836. if (false) {}
  11837. if (iconSlot) {
  11838. return h("div", {
  11839. "class": grid_item_bem('icon-wrapper')
  11840. }, [iconSlot, h(es_info, {
  11841. "attrs": {
  11842. "dot": this.dot,
  11843. "info": info
  11844. }
  11845. })]);
  11846. }
  11847. if (this.icon) {
  11848. return h(es_icon, {
  11849. "attrs": {
  11850. "name": this.icon,
  11851. "dot": this.dot,
  11852. "badge": info,
  11853. "size": this.parent.iconSize,
  11854. "classPrefix": this.iconPrefix
  11855. },
  11856. "class": grid_item_bem('icon')
  11857. });
  11858. }
  11859. },
  11860. getText: function getText() {
  11861. var h = this.$createElement;
  11862. var textSlot = this.slots('text');
  11863. if (textSlot) {
  11864. return textSlot;
  11865. }
  11866. if (this.text) {
  11867. return h("span", {
  11868. "class": grid_item_bem('text')
  11869. }, [this.text]);
  11870. }
  11871. },
  11872. genContent: function genContent() {
  11873. var slot = this.slots();
  11874. if (slot) {
  11875. return slot;
  11876. }
  11877. return [this.genIcon(), this.getText()];
  11878. }
  11879. },
  11880. render: function render() {
  11881. var _ref;
  11882. var h = arguments[0];
  11883. var _this$parent3 = this.parent,
  11884. center = _this$parent3.center,
  11885. border = _this$parent3.border,
  11886. square = _this$parent3.square,
  11887. gutter = _this$parent3.gutter,
  11888. direction = _this$parent3.direction,
  11889. clickable = _this$parent3.clickable;
  11890. return h("div", {
  11891. "class": [grid_item_bem({
  11892. square: square
  11893. })],
  11894. "style": this.style
  11895. }, [h("div", {
  11896. "style": this.contentStyle,
  11897. "attrs": {
  11898. "role": clickable ? 'button' : null,
  11899. "tabindex": clickable ? 0 : null
  11900. },
  11901. "class": [grid_item_bem('content', [direction, {
  11902. center: center,
  11903. square: square,
  11904. clickable: clickable,
  11905. surround: border && gutter
  11906. }]), (_ref = {}, _ref[BORDER] = border, _ref)],
  11907. "on": {
  11908. "click": this.onClick
  11909. }
  11910. }, [this.genContent()])]);
  11911. }
  11912. }));
  11913. // CONCATENATED MODULE: ./es/image-preview/shared.js
  11914. var shared_createNamespace = Object(create["a" /* createNamespace */])('image-preview'),
  11915. shared_createComponent = shared_createNamespace[0],
  11916. shared_bem = shared_createNamespace[1];
  11917. // CONCATENATED MODULE: ./es/swipe/index.js
  11918. // Utils
  11919. // Mixins
  11920. var swipe_createNamespace = Object(create["a" /* createNamespace */])('swipe'),
  11921. swipe_createComponent = swipe_createNamespace[0],
  11922. swipe_bem = swipe_createNamespace[1];
  11923. /* harmony default export */ var swipe = (swipe_createComponent({
  11924. mixins: [TouchMixin, ParentMixin('vanSwipe'), BindEventMixin(function (bind, isBind) {
  11925. bind(window, 'resize', this.resize, true);
  11926. bind(window, 'orientationchange', this.resize, true);
  11927. bind(window, 'visibilitychange', this.onVisibilityChange);
  11928. if (isBind) {
  11929. this.initialize();
  11930. } else {
  11931. this.clear();
  11932. }
  11933. })],
  11934. props: {
  11935. width: [Number, String],
  11936. height: [Number, String],
  11937. autoplay: [Number, String],
  11938. vertical: Boolean,
  11939. lazyRender: Boolean,
  11940. indicatorColor: String,
  11941. loop: {
  11942. type: Boolean,
  11943. default: true
  11944. },
  11945. duration: {
  11946. type: [Number, String],
  11947. default: 500
  11948. },
  11949. touchable: {
  11950. type: Boolean,
  11951. default: true
  11952. },
  11953. initialSwipe: {
  11954. type: [Number, String],
  11955. default: 0
  11956. },
  11957. showIndicators: {
  11958. type: Boolean,
  11959. default: true
  11960. },
  11961. stopPropagation: {
  11962. type: Boolean,
  11963. default: true
  11964. }
  11965. },
  11966. data: function data() {
  11967. return {
  11968. rect: null,
  11969. offset: 0,
  11970. active: 0,
  11971. deltaX: 0,
  11972. deltaY: 0,
  11973. swiping: false,
  11974. computedWidth: 0,
  11975. computedHeight: 0
  11976. };
  11977. },
  11978. watch: {
  11979. children: function children() {
  11980. this.initialize();
  11981. },
  11982. initialSwipe: function initialSwipe() {
  11983. this.initialize();
  11984. },
  11985. autoplay: function autoplay(_autoplay) {
  11986. if (_autoplay > 0) {
  11987. this.autoPlay();
  11988. } else {
  11989. this.clear();
  11990. }
  11991. }
  11992. },
  11993. computed: {
  11994. count: function count() {
  11995. return this.children.length;
  11996. },
  11997. maxCount: function maxCount() {
  11998. return Math.ceil(Math.abs(this.minOffset) / this.size);
  11999. },
  12000. delta: function delta() {
  12001. return this.vertical ? this.deltaY : this.deltaX;
  12002. },
  12003. size: function size() {
  12004. return this[this.vertical ? 'computedHeight' : 'computedWidth'];
  12005. },
  12006. trackSize: function trackSize() {
  12007. return this.count * this.size;
  12008. },
  12009. activeIndicator: function activeIndicator() {
  12010. return (this.active + this.count) % this.count;
  12011. },
  12012. isCorrectDirection: function isCorrectDirection() {
  12013. var expect = this.vertical ? 'vertical' : 'horizontal';
  12014. return this.direction === expect;
  12015. },
  12016. trackStyle: function trackStyle() {
  12017. var style = {
  12018. transitionDuration: (this.swiping ? 0 : this.duration) + "ms",
  12019. transform: "translate" + (this.vertical ? 'Y' : 'X') + "(" + this.offset + "px)"
  12020. };
  12021. if (this.size) {
  12022. var mainAxis = this.vertical ? 'height' : 'width';
  12023. var crossAxis = this.vertical ? 'width' : 'height';
  12024. style[mainAxis] = this.trackSize + "px";
  12025. style[crossAxis] = this[crossAxis] ? this[crossAxis] + "px" : '';
  12026. }
  12027. return style;
  12028. },
  12029. indicatorStyle: function indicatorStyle() {
  12030. return {
  12031. backgroundColor: this.indicatorColor
  12032. };
  12033. },
  12034. minOffset: function minOffset() {
  12035. return (this.vertical ? this.rect.height : this.rect.width) - this.size * this.count;
  12036. }
  12037. },
  12038. mounted: function mounted() {
  12039. this.bindTouchEvent(this.$refs.track);
  12040. },
  12041. methods: {
  12042. // initialize swipe position
  12043. initialize: function initialize(active) {
  12044. if (active === void 0) {
  12045. active = +this.initialSwipe;
  12046. }
  12047. if (!this.$el || isHidden(this.$el)) {
  12048. return;
  12049. }
  12050. clearTimeout(this.timer);
  12051. var rect = {
  12052. width: this.$el.offsetWidth,
  12053. height: this.$el.offsetHeight
  12054. };
  12055. this.rect = rect;
  12056. this.swiping = true;
  12057. this.active = active;
  12058. this.computedWidth = +this.width || rect.width;
  12059. this.computedHeight = +this.height || rect.height;
  12060. this.offset = this.getTargetOffset(active);
  12061. this.children.forEach(function (swipe) {
  12062. swipe.offset = 0;
  12063. });
  12064. this.autoPlay();
  12065. },
  12066. // @exposed-api
  12067. resize: function resize() {
  12068. this.initialize(this.activeIndicator);
  12069. },
  12070. onVisibilityChange: function onVisibilityChange() {
  12071. if (document.hidden) {
  12072. this.clear();
  12073. } else {
  12074. this.autoPlay();
  12075. }
  12076. },
  12077. onTouchStart: function onTouchStart(event) {
  12078. if (!this.touchable) return;
  12079. this.clear();
  12080. this.touchStartTime = Date.now();
  12081. this.touchStart(event);
  12082. this.correctPosition();
  12083. },
  12084. onTouchMove: function onTouchMove(event) {
  12085. if (!this.touchable || !this.swiping) return;
  12086. this.touchMove(event);
  12087. if (this.isCorrectDirection) {
  12088. preventDefault(event, this.stopPropagation);
  12089. this.move({
  12090. offset: this.delta
  12091. });
  12092. }
  12093. },
  12094. onTouchEnd: function onTouchEnd() {
  12095. if (!this.touchable || !this.swiping) return;
  12096. var size = this.size,
  12097. delta = this.delta;
  12098. var duration = Date.now() - this.touchStartTime;
  12099. var speed = delta / duration;
  12100. var shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(delta) > size / 2;
  12101. if (shouldSwipe && this.isCorrectDirection) {
  12102. var offset = this.vertical ? this.offsetY : this.offsetX;
  12103. var pace = 0;
  12104. if (this.loop) {
  12105. pace = offset > 0 ? delta > 0 ? -1 : 1 : 0;
  12106. } else {
  12107. pace = -Math[delta > 0 ? 'ceil' : 'floor'](delta / size);
  12108. }
  12109. this.move({
  12110. pace: pace,
  12111. emitChange: true
  12112. });
  12113. } else if (delta) {
  12114. this.move({
  12115. pace: 0
  12116. });
  12117. }
  12118. this.swiping = false;
  12119. this.autoPlay();
  12120. },
  12121. getTargetActive: function getTargetActive(pace) {
  12122. var active = this.active,
  12123. count = this.count,
  12124. maxCount = this.maxCount;
  12125. if (pace) {
  12126. if (this.loop) {
  12127. return range(active + pace, -1, count);
  12128. }
  12129. return range(active + pace, 0, maxCount);
  12130. }
  12131. return active;
  12132. },
  12133. getTargetOffset: function getTargetOffset(targetActive, offset) {
  12134. if (offset === void 0) {
  12135. offset = 0;
  12136. }
  12137. var currentPosition = targetActive * this.size;
  12138. if (!this.loop) {
  12139. currentPosition = Math.min(currentPosition, -this.minOffset);
  12140. }
  12141. var targetOffset = offset - currentPosition;
  12142. if (!this.loop) {
  12143. targetOffset = range(targetOffset, this.minOffset, 0);
  12144. }
  12145. return targetOffset;
  12146. },
  12147. move: function move(_ref) {
  12148. var _ref$pace = _ref.pace,
  12149. pace = _ref$pace === void 0 ? 0 : _ref$pace,
  12150. _ref$offset = _ref.offset,
  12151. offset = _ref$offset === void 0 ? 0 : _ref$offset,
  12152. emitChange = _ref.emitChange;
  12153. var loop = this.loop,
  12154. count = this.count,
  12155. active = this.active,
  12156. children = this.children,
  12157. trackSize = this.trackSize,
  12158. minOffset = this.minOffset;
  12159. if (count <= 1) {
  12160. return;
  12161. }
  12162. var targetActive = this.getTargetActive(pace);
  12163. var targetOffset = this.getTargetOffset(targetActive, offset); // auto move first and last swipe in loop mode
  12164. if (loop) {
  12165. if (children[0] && targetOffset !== minOffset) {
  12166. var outRightBound = targetOffset < minOffset;
  12167. children[0].offset = outRightBound ? trackSize : 0;
  12168. }
  12169. if (children[count - 1] && targetOffset !== 0) {
  12170. var outLeftBound = targetOffset > 0;
  12171. children[count - 1].offset = outLeftBound ? -trackSize : 0;
  12172. }
  12173. }
  12174. this.active = targetActive;
  12175. this.offset = targetOffset;
  12176. if (emitChange && targetActive !== active) {
  12177. this.$emit('change', this.activeIndicator);
  12178. }
  12179. },
  12180. // @exposed-api
  12181. prev: function prev() {
  12182. var _this = this;
  12183. this.correctPosition();
  12184. this.resetTouchStatus();
  12185. Object(raf["b" /* doubleRaf */])(function () {
  12186. _this.swiping = false;
  12187. _this.move({
  12188. pace: -1,
  12189. emitChange: true
  12190. });
  12191. });
  12192. },
  12193. // @exposed-api
  12194. next: function next() {
  12195. var _this2 = this;
  12196. this.correctPosition();
  12197. this.resetTouchStatus();
  12198. Object(raf["b" /* doubleRaf */])(function () {
  12199. _this2.swiping = false;
  12200. _this2.move({
  12201. pace: 1,
  12202. emitChange: true
  12203. });
  12204. });
  12205. },
  12206. // @exposed-api
  12207. swipeTo: function swipeTo(index, options) {
  12208. var _this3 = this;
  12209. if (options === void 0) {
  12210. options = {};
  12211. }
  12212. this.correctPosition();
  12213. this.resetTouchStatus();
  12214. Object(raf["b" /* doubleRaf */])(function () {
  12215. var targetIndex;
  12216. if (_this3.loop && index === _this3.count) {
  12217. targetIndex = _this3.active === 0 ? 0 : index;
  12218. } else {
  12219. targetIndex = index % _this3.count;
  12220. }
  12221. if (options.immediate) {
  12222. Object(raf["b" /* doubleRaf */])(function () {
  12223. _this3.swiping = false;
  12224. });
  12225. } else {
  12226. _this3.swiping = false;
  12227. }
  12228. _this3.move({
  12229. pace: targetIndex - _this3.active,
  12230. emitChange: true
  12231. });
  12232. });
  12233. },
  12234. correctPosition: function correctPosition() {
  12235. this.swiping = true;
  12236. if (this.active <= -1) {
  12237. this.move({
  12238. pace: this.count
  12239. });
  12240. }
  12241. if (this.active >= this.count) {
  12242. this.move({
  12243. pace: -this.count
  12244. });
  12245. }
  12246. },
  12247. clear: function clear() {
  12248. clearTimeout(this.timer);
  12249. },
  12250. autoPlay: function autoPlay() {
  12251. var _this4 = this;
  12252. var autoplay = this.autoplay;
  12253. if (autoplay > 0 && this.count > 1) {
  12254. this.clear();
  12255. this.timer = setTimeout(function () {
  12256. _this4.next();
  12257. _this4.autoPlay();
  12258. }, autoplay);
  12259. }
  12260. },
  12261. genIndicator: function genIndicator() {
  12262. var _this5 = this;
  12263. var h = this.$createElement;
  12264. var count = this.count,
  12265. activeIndicator = this.activeIndicator;
  12266. var slot = this.slots('indicator');
  12267. if (slot) {
  12268. return slot;
  12269. }
  12270. if (this.showIndicators && count > 1) {
  12271. return h("div", {
  12272. "class": swipe_bem('indicators', {
  12273. vertical: this.vertical
  12274. })
  12275. }, [Array.apply(void 0, Array(count)).map(function (empty, index) {
  12276. return h("i", {
  12277. "class": swipe_bem('indicator', {
  12278. active: index === activeIndicator
  12279. }),
  12280. "style": index === activeIndicator ? _this5.indicatorStyle : null
  12281. });
  12282. })]);
  12283. }
  12284. }
  12285. },
  12286. render: function render() {
  12287. var h = arguments[0];
  12288. return h("div", {
  12289. "class": swipe_bem()
  12290. }, [h("div", {
  12291. "ref": "track",
  12292. "style": this.trackStyle,
  12293. "class": swipe_bem('track', {
  12294. vertical: this.vertical
  12295. })
  12296. }, [this.slots()]), this.genIndicator()]);
  12297. }
  12298. }));
  12299. // CONCATENATED MODULE: ./es/swipe-item/index.js
  12300. var swipe_item_createNamespace = Object(create["a" /* createNamespace */])('swipe-item'),
  12301. swipe_item_createComponent = swipe_item_createNamespace[0],
  12302. swipe_item_bem = swipe_item_createNamespace[1];
  12303. /* harmony default export */ var swipe_item = (swipe_item_createComponent({
  12304. mixins: [ChildrenMixin('vanSwipe')],
  12305. data: function data() {
  12306. return {
  12307. offset: 0,
  12308. inited: false,
  12309. mounted: false
  12310. };
  12311. },
  12312. mounted: function mounted() {
  12313. var _this = this;
  12314. this.$nextTick(function () {
  12315. _this.mounted = true;
  12316. });
  12317. },
  12318. computed: {
  12319. style: function style() {
  12320. var style = {};
  12321. var _this$parent = this.parent,
  12322. size = _this$parent.size,
  12323. vertical = _this$parent.vertical;
  12324. if (size) {
  12325. style[vertical ? 'height' : 'width'] = size + "px";
  12326. }
  12327. if (this.offset) {
  12328. style.transform = "translate" + (vertical ? 'Y' : 'X') + "(" + this.offset + "px)";
  12329. }
  12330. return style;
  12331. },
  12332. shouldRender: function shouldRender() {
  12333. var index = this.index,
  12334. inited = this.inited,
  12335. parent = this.parent,
  12336. mounted = this.mounted;
  12337. if (!parent.lazyRender || inited) {
  12338. return true;
  12339. } // wait for all item to mount, so we can get the exact count
  12340. if (!mounted) {
  12341. return false;
  12342. }
  12343. var active = parent.activeIndicator;
  12344. var maxActive = parent.count - 1;
  12345. var prevActive = active === 0 && parent.loop ? maxActive : active - 1;
  12346. var nextActive = active === maxActive && parent.loop ? 0 : active + 1;
  12347. var shouldRender = index === active || index === prevActive || index === nextActive;
  12348. if (shouldRender) {
  12349. this.inited = true;
  12350. }
  12351. return shouldRender;
  12352. }
  12353. },
  12354. render: function render() {
  12355. var h = arguments[0];
  12356. return h("div", {
  12357. "class": swipe_item_bem(),
  12358. "style": this.style,
  12359. "on": _extends({}, this.$listeners)
  12360. }, [this.shouldRender && this.slots()]);
  12361. }
  12362. }));
  12363. // CONCATENATED MODULE: ./es/image-preview/ImagePreviewItem.js
  12364. // Utils
  12365. // Mixins
  12366. // Component
  12367. function getDistance(touches) {
  12368. return Math.sqrt(Math.pow(touches[0].clientX - touches[1].clientX, 2) + Math.pow(touches[0].clientY - touches[1].clientY, 2));
  12369. }
  12370. /* harmony default export */ var ImagePreviewItem = ({
  12371. mixins: [TouchMixin],
  12372. props: {
  12373. src: String,
  12374. show: Boolean,
  12375. active: Number,
  12376. minZoom: [Number, String],
  12377. maxZoom: [Number, String],
  12378. rootWidth: Number,
  12379. rootHeight: Number
  12380. },
  12381. data: function data() {
  12382. return {
  12383. scale: 1,
  12384. moveX: 0,
  12385. moveY: 0,
  12386. moving: false,
  12387. zooming: false,
  12388. imageRatio: 0,
  12389. displayWidth: 0,
  12390. displayHeight: 0
  12391. };
  12392. },
  12393. computed: {
  12394. vertical: function vertical() {
  12395. var rootWidth = this.rootWidth,
  12396. rootHeight = this.rootHeight;
  12397. var rootRatio = rootHeight / rootWidth;
  12398. return this.imageRatio > rootRatio;
  12399. },
  12400. imageStyle: function imageStyle() {
  12401. var scale = this.scale;
  12402. var style = {
  12403. transitionDuration: this.zooming || this.moving ? '0s' : '.3s'
  12404. };
  12405. if (scale !== 1) {
  12406. var offsetX = this.moveX / scale;
  12407. var offsetY = this.moveY / scale;
  12408. style.transform = "scale(" + scale + ", " + scale + ") translate(" + offsetX + "px, " + offsetY + "px)";
  12409. }
  12410. return style;
  12411. },
  12412. maxMoveX: function maxMoveX() {
  12413. if (this.imageRatio) {
  12414. var displayWidth = this.vertical ? this.rootHeight / this.imageRatio : this.rootWidth;
  12415. return Math.max(0, (this.scale * displayWidth - this.rootWidth) / 2);
  12416. }
  12417. return 0;
  12418. },
  12419. maxMoveY: function maxMoveY() {
  12420. if (this.imageRatio) {
  12421. var displayHeight = this.vertical ? this.rootHeight : this.rootWidth * this.imageRatio;
  12422. return Math.max(0, (this.scale * displayHeight - this.rootHeight) / 2);
  12423. }
  12424. return 0;
  12425. }
  12426. },
  12427. watch: {
  12428. active: 'resetScale',
  12429. show: function show(val) {
  12430. if (!val) {
  12431. this.resetScale();
  12432. }
  12433. }
  12434. },
  12435. mounted: function mounted() {
  12436. this.bindTouchEvent(this.$el);
  12437. },
  12438. methods: {
  12439. resetScale: function resetScale() {
  12440. this.setScale(1);
  12441. this.moveX = 0;
  12442. this.moveY = 0;
  12443. },
  12444. setScale: function setScale(scale) {
  12445. scale = range(scale, +this.minZoom, +this.maxZoom);
  12446. if (scale !== this.scale) {
  12447. this.scale = scale;
  12448. this.$emit('scale', {
  12449. scale: this.scale,
  12450. index: this.active
  12451. });
  12452. }
  12453. },
  12454. toggleScale: function toggleScale() {
  12455. var scale = this.scale > 1 ? 1 : 2;
  12456. this.setScale(scale);
  12457. this.moveX = 0;
  12458. this.moveY = 0;
  12459. },
  12460. onTouchStart: function onTouchStart(event) {
  12461. var touches = event.touches;
  12462. var _this$offsetX = this.offsetX,
  12463. offsetX = _this$offsetX === void 0 ? 0 : _this$offsetX;
  12464. this.touchStart(event);
  12465. this.touchStartTime = new Date();
  12466. this.fingerNum = touches.length;
  12467. this.startMoveX = this.moveX;
  12468. this.startMoveY = this.moveY;
  12469. this.moving = this.fingerNum === 1 && this.scale !== 1;
  12470. this.zooming = this.fingerNum === 2 && !offsetX;
  12471. if (this.zooming) {
  12472. this.startScale = this.scale;
  12473. this.startDistance = getDistance(event.touches);
  12474. }
  12475. },
  12476. onTouchMove: function onTouchMove(event) {
  12477. var touches = event.touches;
  12478. this.touchMove(event);
  12479. if (this.moving || this.zooming) {
  12480. preventDefault(event, true);
  12481. }
  12482. if (this.moving) {
  12483. var moveX = this.deltaX + this.startMoveX;
  12484. var moveY = this.deltaY + this.startMoveY;
  12485. this.moveX = range(moveX, -this.maxMoveX, this.maxMoveX);
  12486. this.moveY = range(moveY, -this.maxMoveY, this.maxMoveY);
  12487. }
  12488. if (this.zooming && touches.length === 2) {
  12489. var distance = getDistance(touches);
  12490. var scale = this.startScale * distance / this.startDistance;
  12491. this.setScale(scale);
  12492. }
  12493. },
  12494. onTouchEnd: function onTouchEnd(event) {
  12495. var stopPropagation = false;
  12496. /* istanbul ignore else */
  12497. if (this.moving || this.zooming) {
  12498. stopPropagation = true;
  12499. if (this.moving && this.startMoveX === this.moveX && this.startMoveY === this.moveY) {
  12500. stopPropagation = false;
  12501. }
  12502. if (!event.touches.length) {
  12503. if (this.zooming) {
  12504. this.moveX = range(this.moveX, -this.maxMoveX, this.maxMoveX);
  12505. this.moveY = range(this.moveY, -this.maxMoveY, this.maxMoveY);
  12506. this.zooming = false;
  12507. }
  12508. this.moving = false;
  12509. this.startMoveX = 0;
  12510. this.startMoveY = 0;
  12511. this.startScale = 1;
  12512. if (this.scale < 1) {
  12513. this.resetScale();
  12514. }
  12515. }
  12516. } // eliminate tap delay on safari
  12517. preventDefault(event, stopPropagation);
  12518. this.checkTap();
  12519. this.resetTouchStatus();
  12520. },
  12521. checkTap: function checkTap() {
  12522. var _this = this;
  12523. if (this.fingerNum > 1) {
  12524. return;
  12525. }
  12526. var _this$offsetX2 = this.offsetX,
  12527. offsetX = _this$offsetX2 === void 0 ? 0 : _this$offsetX2,
  12528. _this$offsetY = this.offsetY,
  12529. offsetY = _this$offsetY === void 0 ? 0 : _this$offsetY;
  12530. var deltaTime = new Date() - this.touchStartTime;
  12531. var TAP_TIME = 250;
  12532. var TAP_OFFSET = 5;
  12533. if (offsetX < TAP_OFFSET && offsetY < TAP_OFFSET && deltaTime < TAP_TIME) {
  12534. if (this.doubleTapTimer) {
  12535. clearTimeout(this.doubleTapTimer);
  12536. this.doubleTapTimer = null;
  12537. this.toggleScale();
  12538. } else {
  12539. this.doubleTapTimer = setTimeout(function () {
  12540. _this.$emit('close');
  12541. _this.doubleTapTimer = null;
  12542. }, TAP_TIME);
  12543. }
  12544. }
  12545. },
  12546. onLoad: function onLoad(event) {
  12547. var _event$target = event.target,
  12548. naturalWidth = _event$target.naturalWidth,
  12549. naturalHeight = _event$target.naturalHeight;
  12550. this.imageRatio = naturalHeight / naturalWidth;
  12551. }
  12552. },
  12553. render: function render() {
  12554. var h = arguments[0];
  12555. var imageSlots = {
  12556. loading: function loading() {
  12557. return h(es_loading, {
  12558. "attrs": {
  12559. "type": "spinner"
  12560. }
  12561. });
  12562. }
  12563. };
  12564. return h(swipe_item, {
  12565. "class": shared_bem('swipe-item')
  12566. }, [h(es_image, {
  12567. "attrs": {
  12568. "src": this.src,
  12569. "fit": "contain"
  12570. },
  12571. "class": shared_bem('image', {
  12572. vertical: this.vertical
  12573. }),
  12574. "style": this.imageStyle,
  12575. "scopedSlots": imageSlots,
  12576. "on": {
  12577. "load": this.onLoad
  12578. }
  12579. })]);
  12580. }
  12581. });
  12582. // CONCATENATED MODULE: ./es/image-preview/ImagePreview.js
  12583. // Utils
  12584. // Mixins
  12585. // Components
  12586. /* harmony default export */ var image_preview_ImagePreview = (shared_createComponent({
  12587. mixins: [TouchMixin, PopupMixin({
  12588. skipToggleEvent: true
  12589. }), BindEventMixin(function (bind) {
  12590. bind(window, 'resize', this.resize, true);
  12591. bind(window, 'orientationchange', this.resize, true);
  12592. })],
  12593. props: {
  12594. className: null,
  12595. closeable: Boolean,
  12596. asyncClose: Boolean,
  12597. overlayStyle: Object,
  12598. showIndicators: Boolean,
  12599. images: {
  12600. type: Array,
  12601. default: function _default() {
  12602. return [];
  12603. }
  12604. },
  12605. loop: {
  12606. type: Boolean,
  12607. default: true
  12608. },
  12609. overlay: {
  12610. type: Boolean,
  12611. default: true
  12612. },
  12613. minZoom: {
  12614. type: [Number, String],
  12615. default: 1 / 3
  12616. },
  12617. maxZoom: {
  12618. type: [Number, String],
  12619. default: 3
  12620. },
  12621. transition: {
  12622. type: String,
  12623. default: 'van-fade'
  12624. },
  12625. showIndex: {
  12626. type: Boolean,
  12627. default: true
  12628. },
  12629. swipeDuration: {
  12630. type: [Number, String],
  12631. default: 300
  12632. },
  12633. startPosition: {
  12634. type: [Number, String],
  12635. default: 0
  12636. },
  12637. overlayClass: {
  12638. type: String,
  12639. default: shared_bem('overlay')
  12640. },
  12641. closeIcon: {
  12642. type: String,
  12643. default: 'clear'
  12644. },
  12645. closeOnPopstate: {
  12646. type: Boolean,
  12647. default: true
  12648. },
  12649. closeIconPosition: {
  12650. type: String,
  12651. default: 'top-right'
  12652. }
  12653. },
  12654. data: function data() {
  12655. return {
  12656. active: 0,
  12657. rootWidth: 0,
  12658. rootHeight: 0,
  12659. doubleClickTimer: null
  12660. };
  12661. },
  12662. mounted: function mounted() {
  12663. this.resize();
  12664. },
  12665. watch: {
  12666. startPosition: 'setActive',
  12667. value: function value(val) {
  12668. var _this = this;
  12669. if (val) {
  12670. this.setActive(+this.startPosition);
  12671. this.$nextTick(function () {
  12672. _this.resize();
  12673. _this.$refs.swipe.swipeTo(+_this.startPosition, {
  12674. immediate: true
  12675. });
  12676. });
  12677. } else {
  12678. this.$emit('close', {
  12679. index: this.active,
  12680. url: this.images[this.active]
  12681. });
  12682. }
  12683. }
  12684. },
  12685. methods: {
  12686. resize: function resize() {
  12687. if (this.$el && this.$el.getBoundingClientRect) {
  12688. var rect = this.$el.getBoundingClientRect();
  12689. this.rootWidth = rect.width;
  12690. this.rootHeight = rect.height;
  12691. }
  12692. },
  12693. emitClose: function emitClose() {
  12694. if (!this.asyncClose) {
  12695. this.$emit('input', false);
  12696. }
  12697. },
  12698. emitScale: function emitScale(args) {
  12699. this.$emit('scale', args);
  12700. },
  12701. setActive: function setActive(active) {
  12702. if (active !== this.active) {
  12703. this.active = active;
  12704. this.$emit('change', active);
  12705. }
  12706. },
  12707. genIndex: function genIndex() {
  12708. var h = this.$createElement;
  12709. if (this.showIndex) {
  12710. return h("div", {
  12711. "class": shared_bem('index')
  12712. }, [this.slots('index', {
  12713. index: this.active
  12714. }) || this.active + 1 + " / " + this.images.length]);
  12715. }
  12716. },
  12717. genCover: function genCover() {
  12718. var h = this.$createElement;
  12719. var cover = this.slots('cover');
  12720. if (cover) {
  12721. return h("div", {
  12722. "class": shared_bem('cover')
  12723. }, [cover]);
  12724. }
  12725. },
  12726. genImages: function genImages() {
  12727. var _this2 = this;
  12728. var h = this.$createElement;
  12729. return h(swipe, {
  12730. "ref": "swipe",
  12731. "attrs": {
  12732. "lazyRender": true,
  12733. "loop": this.loop,
  12734. "duration": this.swipeDuration,
  12735. "initialSwipe": this.startPosition,
  12736. "showIndicators": this.showIndicators,
  12737. "indicatorColor": "white"
  12738. },
  12739. "class": shared_bem('swipe'),
  12740. "on": {
  12741. "change": this.setActive
  12742. }
  12743. }, [this.images.map(function (image) {
  12744. return h(ImagePreviewItem, {
  12745. "attrs": {
  12746. "src": image,
  12747. "show": _this2.value,
  12748. "active": _this2.active,
  12749. "maxZoom": _this2.maxZoom,
  12750. "minZoom": _this2.minZoom,
  12751. "rootWidth": _this2.rootWidth,
  12752. "rootHeight": _this2.rootHeight
  12753. },
  12754. "on": {
  12755. "scale": _this2.emitScale,
  12756. "close": _this2.emitClose
  12757. }
  12758. });
  12759. })]);
  12760. },
  12761. genClose: function genClose() {
  12762. var h = this.$createElement;
  12763. if (this.closeable) {
  12764. return h(es_icon, {
  12765. "attrs": {
  12766. "role": "button",
  12767. "name": this.closeIcon
  12768. },
  12769. "class": shared_bem('close-icon', this.closeIconPosition),
  12770. "on": {
  12771. "click": this.emitClose
  12772. }
  12773. });
  12774. }
  12775. },
  12776. onClosed: function onClosed() {
  12777. this.$emit('closed');
  12778. },
  12779. // @exposed-api
  12780. swipeTo: function swipeTo(index, options) {
  12781. if (this.$refs.swipe) {
  12782. this.$refs.swipe.swipeTo(index, options);
  12783. }
  12784. }
  12785. },
  12786. render: function render() {
  12787. var h = arguments[0];
  12788. return h("transition", {
  12789. "attrs": {
  12790. "name": this.transition
  12791. },
  12792. "on": {
  12793. "afterLeave": this.onClosed
  12794. }
  12795. }, [this.shouldRender ? h("div", {
  12796. "directives": [{
  12797. name: "show",
  12798. value: this.value
  12799. }],
  12800. "class": [shared_bem(), this.className]
  12801. }, [this.genClose(), this.genImages(), this.genIndex(), this.genCover()]) : null]);
  12802. }
  12803. }));
  12804. // CONCATENATED MODULE: ./es/image-preview/index.js
  12805. var image_preview_instance;
  12806. var image_preview_defaultConfig = {
  12807. loop: true,
  12808. value: true,
  12809. images: [],
  12810. maxZoom: 3,
  12811. minZoom: 1 / 3,
  12812. onClose: null,
  12813. onChange: null,
  12814. className: '',
  12815. showIndex: true,
  12816. closeable: false,
  12817. closeIcon: 'clear',
  12818. asyncClose: false,
  12819. transition: 'van-fade',
  12820. getContainer: 'body',
  12821. overlayStyle: null,
  12822. startPosition: 0,
  12823. swipeDuration: 300,
  12824. showIndicators: false,
  12825. closeOnPopstate: true,
  12826. closeIconPosition: 'top-right'
  12827. };
  12828. var image_preview_initInstance = function initInstance() {
  12829. image_preview_instance = new (external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.extend(image_preview_ImagePreview))({
  12830. el: document.createElement('div')
  12831. });
  12832. document.body.appendChild(image_preview_instance.$el);
  12833. image_preview_instance.$on('change', function (index) {
  12834. if (image_preview_instance.onChange) {
  12835. image_preview_instance.onChange(index);
  12836. }
  12837. });
  12838. image_preview_instance.$on('scale', function (data) {
  12839. if (image_preview_instance.onScale) {
  12840. image_preview_instance.onScale(data);
  12841. }
  12842. });
  12843. };
  12844. var es_image_preview_ImagePreview = function ImagePreview(images, startPosition) {
  12845. if (startPosition === void 0) {
  12846. startPosition = 0;
  12847. }
  12848. /* istanbul ignore if */
  12849. if (utils["h" /* isServer */]) {
  12850. return;
  12851. }
  12852. if (!image_preview_instance) {
  12853. image_preview_initInstance();
  12854. }
  12855. var options = Array.isArray(images) ? {
  12856. images: images,
  12857. startPosition: startPosition
  12858. } : images;
  12859. _extends(image_preview_instance, image_preview_defaultConfig, options);
  12860. image_preview_instance.$once('input', function (show) {
  12861. image_preview_instance.value = show;
  12862. });
  12863. image_preview_instance.$once('closed', function () {
  12864. image_preview_instance.images = [];
  12865. });
  12866. if (options.onClose) {
  12867. image_preview_instance.$off('close');
  12868. image_preview_instance.$once('close', options.onClose);
  12869. }
  12870. return image_preview_instance;
  12871. };
  12872. es_image_preview_ImagePreview.Component = image_preview_ImagePreview;
  12873. es_image_preview_ImagePreview.install = function () {
  12874. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.use(image_preview_ImagePreview);
  12875. };
  12876. /* harmony default export */ var image_preview = (es_image_preview_ImagePreview);
  12877. // CONCATENATED MODULE: ./es/index-anchor/index.js
  12878. var index_anchor_createNamespace = Object(create["a" /* createNamespace */])('index-anchor'),
  12879. index_anchor_createComponent = index_anchor_createNamespace[0],
  12880. index_anchor_bem = index_anchor_createNamespace[1];
  12881. /* harmony default export */ var index_anchor = (index_anchor_createComponent({
  12882. mixins: [ChildrenMixin('vanIndexBar', {
  12883. indexKey: 'childrenIndex'
  12884. })],
  12885. props: {
  12886. index: [Number, String]
  12887. },
  12888. data: function data() {
  12889. return {
  12890. top: 0,
  12891. left: null,
  12892. rect: {
  12893. top: 0,
  12894. height: 0
  12895. },
  12896. width: null,
  12897. active: false
  12898. };
  12899. },
  12900. computed: {
  12901. sticky: function sticky() {
  12902. return this.active && this.parent.sticky;
  12903. },
  12904. anchorStyle: function anchorStyle() {
  12905. if (this.sticky) {
  12906. return {
  12907. zIndex: "" + this.parent.zIndex,
  12908. left: this.left ? this.left + "px" : null,
  12909. width: this.width ? this.width + "px" : null,
  12910. transform: "translate3d(0, " + this.top + "px, 0)",
  12911. color: this.parent.highlightColor
  12912. };
  12913. }
  12914. }
  12915. },
  12916. mounted: function mounted() {
  12917. var rect = this.$el.getBoundingClientRect();
  12918. this.rect.height = rect.height;
  12919. },
  12920. methods: {
  12921. scrollIntoView: function scrollIntoView() {
  12922. this.$el.scrollIntoView();
  12923. },
  12924. getRect: function getRect(scroller, scrollerRect) {
  12925. var el = this.$el;
  12926. var elRect = el.getBoundingClientRect();
  12927. this.rect.height = elRect.height;
  12928. if (scroller === window || scroller === document.body) {
  12929. this.rect.top = elRect.top + getRootScrollTop();
  12930. } else {
  12931. this.rect.top = elRect.top + getScrollTop(scroller) - scrollerRect.top;
  12932. }
  12933. return this.rect;
  12934. }
  12935. },
  12936. render: function render() {
  12937. var _ref;
  12938. var h = arguments[0];
  12939. var sticky = this.sticky;
  12940. return h("div", {
  12941. "style": {
  12942. height: sticky ? this.rect.height + "px" : null
  12943. }
  12944. }, [h("div", {
  12945. "style": this.anchorStyle,
  12946. "class": [index_anchor_bem({
  12947. sticky: sticky
  12948. }), (_ref = {}, _ref[BORDER_BOTTOM] = sticky, _ref)]
  12949. }, [this.slots('default') || this.index])]);
  12950. }
  12951. }));
  12952. // CONCATENATED MODULE: ./es/index-bar/index.js
  12953. // Utils
  12954. // Mixins
  12955. function genAlphabet() {
  12956. var indexList = [];
  12957. var charCodeOfA = 'A'.charCodeAt(0);
  12958. for (var i = 0; i < 26; i++) {
  12959. indexList.push(String.fromCharCode(charCodeOfA + i));
  12960. }
  12961. return indexList;
  12962. }
  12963. var index_bar_createNamespace = Object(create["a" /* createNamespace */])('index-bar'),
  12964. index_bar_createComponent = index_bar_createNamespace[0],
  12965. index_bar_bem = index_bar_createNamespace[1];
  12966. /* harmony default export */ var index_bar = (index_bar_createComponent({
  12967. mixins: [TouchMixin, ParentMixin('vanIndexBar'), BindEventMixin(function (bind) {
  12968. if (!this.scroller) {
  12969. this.scroller = getScroller(this.$el);
  12970. }
  12971. bind(this.scroller, 'scroll', this.onScroll);
  12972. })],
  12973. props: {
  12974. zIndex: [Number, String],
  12975. highlightColor: String,
  12976. sticky: {
  12977. type: Boolean,
  12978. default: true
  12979. },
  12980. stickyOffsetTop: {
  12981. type: Number,
  12982. default: 0
  12983. },
  12984. indexList: {
  12985. type: Array,
  12986. default: genAlphabet
  12987. }
  12988. },
  12989. data: function data() {
  12990. return {
  12991. activeAnchorIndex: null
  12992. };
  12993. },
  12994. computed: {
  12995. sidebarStyle: function sidebarStyle() {
  12996. if (Object(utils["c" /* isDef */])(this.zIndex)) {
  12997. return {
  12998. zIndex: this.zIndex + 1
  12999. };
  13000. }
  13001. },
  13002. highlightStyle: function highlightStyle() {
  13003. var highlightColor = this.highlightColor;
  13004. if (highlightColor) {
  13005. return {
  13006. color: highlightColor
  13007. };
  13008. }
  13009. }
  13010. },
  13011. watch: {
  13012. indexList: function indexList() {
  13013. this.$nextTick(this.onScroll);
  13014. },
  13015. activeAnchorIndex: function activeAnchorIndex(value) {
  13016. if (value) {
  13017. this.$emit('change', value);
  13018. }
  13019. }
  13020. },
  13021. methods: {
  13022. onScroll: function onScroll() {
  13023. var _this = this;
  13024. if (isHidden(this.$el)) {
  13025. return;
  13026. }
  13027. var scrollTop = getScrollTop(this.scroller);
  13028. var scrollerRect = this.getScrollerRect();
  13029. var rects = this.children.map(function (item) {
  13030. return item.getRect(_this.scroller, scrollerRect);
  13031. });
  13032. var active = this.getActiveAnchorIndex(scrollTop, rects);
  13033. this.activeAnchorIndex = this.indexList[active];
  13034. if (this.sticky) {
  13035. this.children.forEach(function (item, index) {
  13036. if (index === active || index === active - 1) {
  13037. var rect = item.$el.getBoundingClientRect();
  13038. item.left = rect.left;
  13039. item.width = rect.width;
  13040. } else {
  13041. item.left = null;
  13042. item.width = null;
  13043. }
  13044. if (index === active) {
  13045. item.active = true;
  13046. item.top = Math.max(_this.stickyOffsetTop, rects[index].top - scrollTop) + scrollerRect.top;
  13047. } else if (index === active - 1) {
  13048. var activeItemTop = rects[active].top - scrollTop;
  13049. item.active = activeItemTop > 0;
  13050. item.top = activeItemTop + scrollerRect.top - rects[index].height;
  13051. } else {
  13052. item.active = false;
  13053. }
  13054. });
  13055. }
  13056. },
  13057. getScrollerRect: function getScrollerRect() {
  13058. if (this.scroller.getBoundingClientRect) {
  13059. return this.scroller.getBoundingClientRect();
  13060. }
  13061. return {
  13062. top: 0,
  13063. left: 0
  13064. };
  13065. },
  13066. getActiveAnchorIndex: function getActiveAnchorIndex(scrollTop, rects) {
  13067. for (var i = this.children.length - 1; i >= 0; i--) {
  13068. var prevHeight = i > 0 ? rects[i - 1].height : 0;
  13069. var reachTop = this.sticky ? prevHeight + this.stickyOffsetTop : 0;
  13070. if (scrollTop + reachTop >= rects[i].top) {
  13071. return i;
  13072. }
  13073. }
  13074. return -1;
  13075. },
  13076. onClick: function onClick(event) {
  13077. this.scrollToElement(event.target);
  13078. },
  13079. onTouchMove: function onTouchMove(event) {
  13080. this.touchMove(event);
  13081. if (this.direction === 'vertical') {
  13082. preventDefault(event);
  13083. var _event$touches$ = event.touches[0],
  13084. clientX = _event$touches$.clientX,
  13085. clientY = _event$touches$.clientY;
  13086. var target = document.elementFromPoint(clientX, clientY);
  13087. if (target) {
  13088. var index = target.dataset.index;
  13089. /* istanbul ignore else */
  13090. if (this.touchActiveIndex !== index) {
  13091. this.touchActiveIndex = index;
  13092. this.scrollToElement(target);
  13093. }
  13094. }
  13095. }
  13096. },
  13097. scrollTo: function scrollTo(index) {
  13098. var match = this.children.filter(function (item) {
  13099. return String(item.index) === index;
  13100. });
  13101. if (match[0]) {
  13102. match[0].scrollIntoView();
  13103. if (this.sticky && this.stickyOffsetTop) {
  13104. setRootScrollTop(getRootScrollTop() - this.stickyOffsetTop);
  13105. }
  13106. this.$emit('select', match[0].index);
  13107. }
  13108. },
  13109. scrollToElement: function scrollToElement(element) {
  13110. var index = element.dataset.index;
  13111. this.scrollTo(index);
  13112. },
  13113. onTouchEnd: function onTouchEnd() {
  13114. this.active = null;
  13115. }
  13116. },
  13117. render: function render() {
  13118. var _this2 = this;
  13119. var h = arguments[0];
  13120. var Indexes = this.indexList.map(function (index) {
  13121. var active = index === _this2.activeAnchorIndex;
  13122. return h("span", {
  13123. "class": index_bar_bem('index', {
  13124. active: active
  13125. }),
  13126. "style": active ? _this2.highlightStyle : null,
  13127. "attrs": {
  13128. "data-index": index
  13129. }
  13130. }, [index]);
  13131. });
  13132. return h("div", {
  13133. "class": index_bar_bem()
  13134. }, [h("div", {
  13135. "class": index_bar_bem('sidebar'),
  13136. "style": this.sidebarStyle,
  13137. "on": {
  13138. "click": this.onClick,
  13139. "touchstart": this.touchStart,
  13140. "touchmove": this.onTouchMove,
  13141. "touchend": this.onTouchEnd,
  13142. "touchcancel": this.onTouchEnd
  13143. }
  13144. }, [Indexes]), this.slots('default')]);
  13145. }
  13146. }));
  13147. // EXTERNAL MODULE: ./node_modules/vue-lazyload/vue-lazyload.js
  13148. var vue_lazyload = __webpack_require__(9);
  13149. var vue_lazyload_default = /*#__PURE__*/__webpack_require__.n(vue_lazyload);
  13150. // CONCATENATED MODULE: ./es/lazyload/index.js
  13151. /* harmony default export */ var lazyload = (vue_lazyload_default.a);
  13152. // CONCATENATED MODULE: ./es/list/index.js
  13153. // Utils
  13154. // Mixins
  13155. // Components
  13156. var list_createNamespace = Object(create["a" /* createNamespace */])('list'),
  13157. list_createComponent = list_createNamespace[0],
  13158. list_bem = list_createNamespace[1],
  13159. list_t = list_createNamespace[2];
  13160. /* harmony default export */ var es_list = (list_createComponent({
  13161. mixins: [BindEventMixin(function (bind) {
  13162. if (!this.scroller) {
  13163. this.scroller = getScroller(this.$el);
  13164. }
  13165. bind(this.scroller, 'scroll', this.check);
  13166. })],
  13167. model: {
  13168. prop: 'loading'
  13169. },
  13170. props: {
  13171. error: Boolean,
  13172. loading: Boolean,
  13173. finished: Boolean,
  13174. errorText: String,
  13175. loadingText: String,
  13176. finishedText: String,
  13177. immediateCheck: {
  13178. type: Boolean,
  13179. default: true
  13180. },
  13181. offset: {
  13182. type: [Number, String],
  13183. default: 300
  13184. },
  13185. direction: {
  13186. type: String,
  13187. default: 'down'
  13188. }
  13189. },
  13190. data: function data() {
  13191. return {
  13192. // use sync innerLoading state to avoid repeated loading in some edge cases
  13193. innerLoading: this.loading
  13194. };
  13195. },
  13196. updated: function updated() {
  13197. this.innerLoading = this.loading;
  13198. },
  13199. mounted: function mounted() {
  13200. if (this.immediateCheck) {
  13201. this.check();
  13202. }
  13203. },
  13204. watch: {
  13205. loading: 'check',
  13206. finished: 'check'
  13207. },
  13208. methods: {
  13209. // @exposed-api
  13210. check: function check() {
  13211. var _this = this;
  13212. this.$nextTick(function () {
  13213. if (_this.innerLoading || _this.finished || _this.error) {
  13214. return;
  13215. }
  13216. var el = _this.$el,
  13217. scroller = _this.scroller,
  13218. offset = _this.offset,
  13219. direction = _this.direction;
  13220. var scrollerRect;
  13221. if (scroller.getBoundingClientRect) {
  13222. scrollerRect = scroller.getBoundingClientRect();
  13223. } else {
  13224. scrollerRect = {
  13225. top: 0,
  13226. bottom: scroller.innerHeight
  13227. };
  13228. }
  13229. var scrollerHeight = scrollerRect.bottom - scrollerRect.top;
  13230. /* istanbul ignore next */
  13231. if (!scrollerHeight || isHidden(el)) {
  13232. return false;
  13233. }
  13234. var isReachEdge = false;
  13235. var placeholderRect = _this.$refs.placeholder.getBoundingClientRect();
  13236. if (direction === 'up') {
  13237. isReachEdge = scrollerRect.top - placeholderRect.top <= offset;
  13238. } else {
  13239. isReachEdge = placeholderRect.bottom - scrollerRect.bottom <= offset;
  13240. }
  13241. if (isReachEdge) {
  13242. _this.innerLoading = true;
  13243. _this.$emit('input', true);
  13244. _this.$emit('load');
  13245. }
  13246. });
  13247. },
  13248. clickErrorText: function clickErrorText() {
  13249. this.$emit('update:error', false);
  13250. this.check();
  13251. },
  13252. genLoading: function genLoading() {
  13253. var h = this.$createElement;
  13254. if (this.innerLoading && !this.finished) {
  13255. return h("div", {
  13256. "key": "loading",
  13257. "class": list_bem('loading')
  13258. }, [this.slots('loading') || h(es_loading, {
  13259. "attrs": {
  13260. "size": "16"
  13261. }
  13262. }, [this.loadingText || list_t('loading')])]);
  13263. }
  13264. },
  13265. genFinishedText: function genFinishedText() {
  13266. var h = this.$createElement;
  13267. if (this.finished) {
  13268. var text = this.slots('finished') || this.finishedText;
  13269. if (text) {
  13270. return h("div", {
  13271. "class": list_bem('finished-text')
  13272. }, [text]);
  13273. }
  13274. }
  13275. },
  13276. genErrorText: function genErrorText() {
  13277. var h = this.$createElement;
  13278. if (this.error) {
  13279. var text = this.slots('error') || this.errorText;
  13280. if (text) {
  13281. return h("div", {
  13282. "on": {
  13283. "click": this.clickErrorText
  13284. },
  13285. "class": list_bem('error-text')
  13286. }, [text]);
  13287. }
  13288. }
  13289. }
  13290. },
  13291. render: function render() {
  13292. var h = arguments[0];
  13293. var Placeholder = h("div", {
  13294. "ref": "placeholder",
  13295. "key": "placeholder",
  13296. "class": list_bem('placeholder')
  13297. });
  13298. return h("div", {
  13299. "class": list_bem(),
  13300. "attrs": {
  13301. "role": "feed",
  13302. "aria-busy": this.innerLoading
  13303. }
  13304. }, [this.direction === 'down' ? this.slots() : Placeholder, this.genLoading(), this.genFinishedText(), this.genErrorText(), this.direction === 'up' ? this.slots() : Placeholder]);
  13305. }
  13306. }));
  13307. // EXTERNAL MODULE: ./es/locale/index.js + 2 modules
  13308. var locale = __webpack_require__(7);
  13309. // CONCATENATED MODULE: ./es/nav-bar/index.js
  13310. // Utils
  13311. // Components
  13312. var nav_bar_createNamespace = Object(create["a" /* createNamespace */])('nav-bar'),
  13313. nav_bar_createComponent = nav_bar_createNamespace[0],
  13314. nav_bar_bem = nav_bar_createNamespace[1];
  13315. /* harmony default export */ var nav_bar = (nav_bar_createComponent({
  13316. props: {
  13317. title: String,
  13318. fixed: Boolean,
  13319. zIndex: [Number, String],
  13320. leftText: String,
  13321. rightText: String,
  13322. leftArrow: Boolean,
  13323. placeholder: Boolean,
  13324. safeAreaInsetTop: Boolean,
  13325. border: {
  13326. type: Boolean,
  13327. default: true
  13328. }
  13329. },
  13330. data: function data() {
  13331. return {
  13332. height: null
  13333. };
  13334. },
  13335. mounted: function mounted() {
  13336. var _this = this;
  13337. if (this.placeholder && this.fixed) {
  13338. var setHeight = function setHeight() {
  13339. _this.height = _this.$refs.navBar.getBoundingClientRect().height;
  13340. };
  13341. setHeight(); // https://github.com/vant-ui/vant/issues/10131
  13342. setTimeout(setHeight, 100);
  13343. }
  13344. },
  13345. methods: {
  13346. genLeft: function genLeft() {
  13347. var h = this.$createElement;
  13348. var leftSlot = this.slots('left');
  13349. if (leftSlot) {
  13350. return leftSlot;
  13351. }
  13352. return [this.leftArrow && h(es_icon, {
  13353. "class": nav_bar_bem('arrow'),
  13354. "attrs": {
  13355. "name": "arrow-left"
  13356. }
  13357. }), this.leftText && h("span", {
  13358. "class": nav_bar_bem('text')
  13359. }, [this.leftText])];
  13360. },
  13361. genRight: function genRight() {
  13362. var h = this.$createElement;
  13363. var rightSlot = this.slots('right');
  13364. if (rightSlot) {
  13365. return rightSlot;
  13366. }
  13367. if (this.rightText) {
  13368. return h("span", {
  13369. "class": nav_bar_bem('text')
  13370. }, [this.rightText]);
  13371. }
  13372. },
  13373. genNavBar: function genNavBar() {
  13374. var _ref;
  13375. var h = this.$createElement;
  13376. return h("div", {
  13377. "ref": "navBar",
  13378. "style": {
  13379. zIndex: this.zIndex
  13380. },
  13381. "class": [nav_bar_bem({
  13382. fixed: this.fixed,
  13383. 'safe-area-inset-top': this.safeAreaInsetTop
  13384. }), (_ref = {}, _ref[BORDER_BOTTOM] = this.border, _ref)]
  13385. }, [h("div", {
  13386. "class": nav_bar_bem('content')
  13387. }, [this.hasLeft() && h("div", {
  13388. "class": nav_bar_bem('left'),
  13389. "on": {
  13390. "click": this.onClickLeft
  13391. }
  13392. }, [this.genLeft()]), h("div", {
  13393. "class": [nav_bar_bem('title'), 'van-ellipsis']
  13394. }, [this.slots('title') || this.title]), this.hasRight() && h("div", {
  13395. "class": nav_bar_bem('right'),
  13396. "on": {
  13397. "click": this.onClickRight
  13398. }
  13399. }, [this.genRight()])])]);
  13400. },
  13401. hasLeft: function hasLeft() {
  13402. return this.leftArrow || this.leftText || this.slots('left');
  13403. },
  13404. hasRight: function hasRight() {
  13405. return this.rightText || this.slots('right');
  13406. },
  13407. onClickLeft: function onClickLeft(event) {
  13408. this.$emit('click-left', event);
  13409. },
  13410. onClickRight: function onClickRight(event) {
  13411. this.$emit('click-right', event);
  13412. }
  13413. },
  13414. render: function render() {
  13415. var h = arguments[0];
  13416. if (this.placeholder && this.fixed) {
  13417. return h("div", {
  13418. "class": nav_bar_bem('placeholder'),
  13419. "style": {
  13420. height: this.height + "px"
  13421. }
  13422. }, [this.genNavBar()]);
  13423. }
  13424. return this.genNavBar();
  13425. }
  13426. }));
  13427. // CONCATENATED MODULE: ./es/notice-bar/index.js
  13428. var notice_bar_createNamespace = Object(create["a" /* createNamespace */])('notice-bar'),
  13429. notice_bar_createComponent = notice_bar_createNamespace[0],
  13430. notice_bar_bem = notice_bar_createNamespace[1];
  13431. /* harmony default export */ var notice_bar = (notice_bar_createComponent({
  13432. mixins: [BindEventMixin(function (bind) {
  13433. // fix cache issues with forwards and back history in safari
  13434. // see: https://guwii.com/cache-issues-with-forwards-and-back-history-in-safari/
  13435. bind(window, 'pageshow', this.reset);
  13436. })],
  13437. inject: {
  13438. vanPopup: {
  13439. default: null
  13440. }
  13441. },
  13442. props: {
  13443. text: String,
  13444. mode: String,
  13445. color: String,
  13446. leftIcon: String,
  13447. wrapable: Boolean,
  13448. background: String,
  13449. scrollable: {
  13450. type: Boolean,
  13451. default: null
  13452. },
  13453. delay: {
  13454. type: [Number, String],
  13455. default: 1
  13456. },
  13457. speed: {
  13458. type: [Number, String],
  13459. default: 60
  13460. }
  13461. },
  13462. data: function data() {
  13463. return {
  13464. show: true,
  13465. offset: 0,
  13466. duration: 0,
  13467. wrapWidth: 0,
  13468. contentWidth: 0
  13469. };
  13470. },
  13471. watch: {
  13472. scrollable: 'reset',
  13473. text: {
  13474. handler: 'reset',
  13475. immediate: true
  13476. }
  13477. },
  13478. created: function created() {
  13479. // https://github.com/vant-ui/vant/issues/8634
  13480. if (this.vanPopup) {
  13481. this.vanPopup.onReopen(this.reset);
  13482. }
  13483. },
  13484. activated: function activated() {
  13485. this.reset();
  13486. },
  13487. methods: {
  13488. onClickIcon: function onClickIcon(event) {
  13489. if (this.mode === 'closeable') {
  13490. this.show = false;
  13491. this.$emit('close', event);
  13492. }
  13493. },
  13494. onTransitionEnd: function onTransitionEnd() {
  13495. var _this = this;
  13496. this.offset = this.wrapWidth;
  13497. this.duration = 0; // wait for Vue to render offset
  13498. // using nextTick won't work in iOS14
  13499. Object(raf["c" /* raf */])(function () {
  13500. // use double raf to ensure animation can start
  13501. Object(raf["b" /* doubleRaf */])(function () {
  13502. _this.offset = -_this.contentWidth;
  13503. _this.duration = (_this.contentWidth + _this.wrapWidth) / _this.speed;
  13504. _this.$emit('replay');
  13505. });
  13506. });
  13507. },
  13508. // not an exposed-api, but may used by some users
  13509. start: function start() {
  13510. this.reset();
  13511. },
  13512. // @exposed-api
  13513. reset: function reset() {
  13514. var _this2 = this;
  13515. var delay = Object(utils["c" /* isDef */])(this.delay) ? this.delay * 1000 : 0;
  13516. this.offset = 0;
  13517. this.duration = 0;
  13518. this.wrapWidth = 0;
  13519. this.contentWidth = 0;
  13520. clearTimeout(this.startTimer);
  13521. this.startTimer = setTimeout(function () {
  13522. var _this2$$refs = _this2.$refs,
  13523. wrap = _this2$$refs.wrap,
  13524. content = _this2$$refs.content;
  13525. if (!wrap || !content || _this2.scrollable === false) {
  13526. return;
  13527. }
  13528. var wrapWidth = wrap.getBoundingClientRect().width;
  13529. var contentWidth = content.getBoundingClientRect().width;
  13530. if (_this2.scrollable || contentWidth > wrapWidth) {
  13531. Object(raf["b" /* doubleRaf */])(function () {
  13532. _this2.offset = -contentWidth;
  13533. _this2.duration = contentWidth / _this2.speed;
  13534. _this2.wrapWidth = wrapWidth;
  13535. _this2.contentWidth = contentWidth;
  13536. });
  13537. }
  13538. }, delay);
  13539. }
  13540. },
  13541. render: function render() {
  13542. var _this3 = this;
  13543. var h = arguments[0];
  13544. var slots = this.slots,
  13545. mode = this.mode,
  13546. leftIcon = this.leftIcon,
  13547. onClickIcon = this.onClickIcon;
  13548. var barStyle = {
  13549. color: this.color,
  13550. background: this.background
  13551. };
  13552. var contentStyle = {
  13553. transform: this.offset ? "translateX(" + this.offset + "px)" : '',
  13554. transitionDuration: this.duration + 's'
  13555. };
  13556. function LeftIcon() {
  13557. var slot = slots('left-icon');
  13558. if (slot) {
  13559. return slot;
  13560. }
  13561. if (leftIcon) {
  13562. return h(es_icon, {
  13563. "class": notice_bar_bem('left-icon'),
  13564. "attrs": {
  13565. "name": leftIcon
  13566. }
  13567. });
  13568. }
  13569. }
  13570. function RightIcon() {
  13571. var slot = slots('right-icon');
  13572. if (slot) {
  13573. return slot;
  13574. }
  13575. var iconName;
  13576. if (mode === 'closeable') {
  13577. iconName = 'cross';
  13578. } else if (mode === 'link') {
  13579. iconName = 'arrow';
  13580. }
  13581. if (iconName) {
  13582. return h(es_icon, {
  13583. "class": notice_bar_bem('right-icon'),
  13584. "attrs": {
  13585. "name": iconName
  13586. },
  13587. "on": {
  13588. "click": onClickIcon
  13589. }
  13590. });
  13591. }
  13592. }
  13593. return h("div", {
  13594. "attrs": {
  13595. "role": "alert"
  13596. },
  13597. "directives": [{
  13598. name: "show",
  13599. value: this.show
  13600. }],
  13601. "class": notice_bar_bem({
  13602. wrapable: this.wrapable
  13603. }),
  13604. "style": barStyle,
  13605. "on": {
  13606. "click": function click(event) {
  13607. _this3.$emit('click', event);
  13608. }
  13609. }
  13610. }, [LeftIcon(), h("div", {
  13611. "ref": "wrap",
  13612. "class": notice_bar_bem('wrap'),
  13613. "attrs": {
  13614. "role": "marquee"
  13615. }
  13616. }, [h("div", {
  13617. "ref": "content",
  13618. "class": [notice_bar_bem('content'), {
  13619. 'van-ellipsis': this.scrollable === false && !this.wrapable
  13620. }],
  13621. "style": contentStyle,
  13622. "on": {
  13623. "transitionend": this.onTransitionEnd
  13624. }
  13625. }, [this.slots() || this.text])]), RightIcon()]);
  13626. }
  13627. }));
  13628. // CONCATENATED MODULE: ./es/notify/Notify.js
  13629. // Utils
  13630. // Mixins
  13631. // Components
  13632. // Types
  13633. var Notify_createNamespace = Object(create["a" /* createNamespace */])('notify'),
  13634. Notify_createComponent = Notify_createNamespace[0],
  13635. Notify_bem = Notify_createNamespace[1];
  13636. function Notify(h, props, slots, ctx) {
  13637. var style = {
  13638. color: props.color,
  13639. background: props.background
  13640. };
  13641. return h(popup, helper_default()([{
  13642. "attrs": {
  13643. "value": props.value,
  13644. "position": "top",
  13645. "overlay": false,
  13646. "duration": 0.2,
  13647. "lockScroll": false
  13648. },
  13649. "style": style,
  13650. "class": [Notify_bem([props.type]), props.className]
  13651. }, inherit(ctx, true)]), [(slots.default == null ? void 0 : slots.default()) || props.message]);
  13652. }
  13653. Notify.props = _extends({}, popupMixinProps, {
  13654. color: String,
  13655. message: [Number, String],
  13656. duration: [Number, String],
  13657. className: null,
  13658. background: String,
  13659. getContainer: [String, Function],
  13660. type: {
  13661. type: String,
  13662. default: 'danger'
  13663. }
  13664. });
  13665. /* harmony default export */ var notify_Notify = (Notify_createComponent(Notify));
  13666. // CONCATENATED MODULE: ./es/notify/index.js
  13667. var timer;
  13668. var notify_instance;
  13669. function notify_parseOptions(message) {
  13670. return Object(utils["f" /* isObject */])(message) ? message : {
  13671. message: message
  13672. };
  13673. }
  13674. function es_notify_Notify(options) {
  13675. /* istanbul ignore if */
  13676. if (utils["h" /* isServer */]) {
  13677. return;
  13678. }
  13679. if (!notify_instance) {
  13680. notify_instance = mount(notify_Notify, {
  13681. on: {
  13682. click: function click(event) {
  13683. if (notify_instance.onClick) {
  13684. notify_instance.onClick(event);
  13685. }
  13686. },
  13687. close: function close() {
  13688. if (notify_instance.onClose) {
  13689. notify_instance.onClose();
  13690. }
  13691. },
  13692. opened: function opened() {
  13693. if (notify_instance.onOpened) {
  13694. notify_instance.onOpened();
  13695. }
  13696. }
  13697. }
  13698. });
  13699. }
  13700. options = _extends({}, es_notify_Notify.currentOptions, notify_parseOptions(options));
  13701. _extends(notify_instance, options);
  13702. clearTimeout(timer);
  13703. if (options.duration && options.duration > 0) {
  13704. timer = setTimeout(es_notify_Notify.clear, options.duration);
  13705. }
  13706. return notify_instance;
  13707. }
  13708. function notify_defaultOptions() {
  13709. return {
  13710. type: 'danger',
  13711. value: true,
  13712. message: '',
  13713. color: undefined,
  13714. background: undefined,
  13715. duration: 3000,
  13716. className: '',
  13717. onClose: null,
  13718. onClick: null,
  13719. onOpened: null
  13720. };
  13721. }
  13722. es_notify_Notify.clear = function () {
  13723. if (notify_instance) {
  13724. notify_instance.value = false;
  13725. }
  13726. };
  13727. es_notify_Notify.currentOptions = notify_defaultOptions();
  13728. es_notify_Notify.setDefaultOptions = function (options) {
  13729. _extends(es_notify_Notify.currentOptions, options);
  13730. };
  13731. es_notify_Notify.resetDefaultOptions = function () {
  13732. es_notify_Notify.currentOptions = notify_defaultOptions();
  13733. };
  13734. es_notify_Notify.install = function () {
  13735. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.use(notify_Notify);
  13736. };
  13737. es_notify_Notify.Component = notify_Notify;
  13738. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$notify = es_notify_Notify;
  13739. /* harmony default export */ var notify = (es_notify_Notify);
  13740. // CONCATENATED MODULE: ./es/number-keyboard/DeleteIcon.js
  13741. /* harmony default export */ var number_keyboard_DeleteIcon = ({
  13742. render: function render() {
  13743. var h = arguments[0];
  13744. return h("svg", {
  13745. "attrs": {
  13746. "viewBox": "0 0 32 22",
  13747. "xmlns": "http://www.w3.org/2000/svg"
  13748. }
  13749. }, [h("path", {
  13750. "attrs": {
  13751. "d": "M28.016 0A3.991 3.991 0 0132 3.987v14.026c0 2.2-1.787 3.987-3.98 3.987H10.382c-.509 0-.996-.206-1.374-.585L.89 13.09C.33 12.62 0 11.84 0 11.006c0-.86.325-1.62.887-2.08L9.01.585A1.936 1.936 0 0110.383 0zm0 1.947H10.368L2.24 10.28c-.224.226-.312.432-.312.73 0 .287.094.51.312.729l8.128 8.333h17.648a2.041 2.041 0 002.037-2.04V3.987c0-1.127-.915-2.04-2.037-2.04zM23.028 6a.96.96 0 01.678.292.95.95 0 01-.003 1.377l-3.342 3.348 3.326 3.333c.189.188.292.43.292.679 0 .248-.103.49-.292.679a.96.96 0 01-.678.292.959.959 0 01-.677-.292L18.99 12.36l-3.343 3.345a.96.96 0 01-.677.292.96.96 0 01-.678-.292.962.962 0 01-.292-.68c0-.248.104-.49.292-.679l3.342-3.348-3.342-3.348A.963.963 0 0114 6.971c0-.248.104-.49.292-.679A.96.96 0 0114.97 6a.96.96 0 01.677.292l3.358 3.348 3.345-3.348A.96.96 0 0123.028 6z",
  13752. "fill": "currentColor"
  13753. }
  13754. })]);
  13755. }
  13756. });
  13757. // CONCATENATED MODULE: ./es/number-keyboard/CollapseIcon.js
  13758. /* harmony default export */ var CollapseIcon = ({
  13759. render: function render() {
  13760. var h = arguments[0];
  13761. return h("svg", {
  13762. "attrs": {
  13763. "viewBox": "0 0 30 24",
  13764. "xmlns": "http://www.w3.org/2000/svg"
  13765. }
  13766. }, [h("path", {
  13767. "attrs": {
  13768. "d": "M25.877 12.843h-1.502c-.188 0-.188 0-.188.19v1.512c0 .188 0 .188.188.188h1.5c.187 0 .187 0 .187-.188v-1.511c0-.19 0-.191-.185-.191zM17.999 10.2c0 .188 0 .188.188.188h1.687c.188 0 .188 0 .188-.188V8.688c0-.187.004-.187-.186-.19h-1.69c-.187 0-.187 0-.187.19V10.2zm2.25-3.967h1.5c.188 0 .188 0 .188-.188v-1.7c0-.19 0-.19-.188-.19h-1.5c-.189 0-.189 0-.189.19v1.7c0 .188 0 .188.19.188zm2.063 4.157h3.563c.187 0 .187 0 .187-.189V4.346c0-.19.004-.19-.185-.19h-1.69c-.187 0-.187 0-.187.188v4.155h-1.688c-.187 0-.187 0-.187.189v1.514c0 .19 0 .19.187.19zM14.812 24l2.812-3.4H12l2.813 3.4zm-9-11.157H4.31c-.188 0-.188 0-.188.19v1.512c0 .188 0 .188.188.188h1.502c.187 0 .187 0 .187-.188v-1.511c0-.19.01-.191-.189-.191zm15.937 0H8.25c-.188 0-.188 0-.188.19v1.512c0 .188 0 .188.188.188h13.5c.188 0 .188 0 .188-.188v-1.511c0-.19 0-.191-.188-.191zm-11.438-2.454h1.5c.188 0 .188 0 .188-.188V8.688c0-.187 0-.187-.188-.189h-1.5c-.187 0-.187 0-.187.189V10.2c0 .188 0 .188.187.188zM27.94 0c.563 0 .917.21 1.313.567.518.466.748.757.748 1.51v14.92c0 .567-.188 1.134-.562 1.512-.376.378-.938.566-1.313.566H2.063c-.563 0-.938-.188-1.313-.566-.562-.378-.75-.945-.75-1.511V2.078C0 1.51.188.944.562.567.938.189 1.5 0 1.875 0zm-.062 2H2v14.92h25.877V2zM5.81 4.157c.19 0 .19 0 .19.189v1.762c-.003.126-.024.126-.188.126H4.249c-.126-.003-.126-.023-.126-.188v-1.7c-.187-.19 0-.19.188-.19zm10.5 2.077h1.503c.187 0 .187 0 .187-.188v-1.7c0-.19 0-.19-.187-.19h-1.502c-.188 0-.188.001-.188.19v1.7c0 .188 0 .188.188.188zM7.875 8.5c.187 0 .187.002.187.189V10.2c0 .188 0 .188-.187.188H4.249c-.126-.002-.126-.023-.126-.188V8.625c.003-.126.024-.126.188-.126zm7.875 0c.19.002.19.002.19.189v1.575c-.003.126-.024.126-.19.126h-1.563c-.126-.002-.126-.023-.126-.188V8.625c.002-.126.023-.126.189-.126zm-6-4.342c.187 0 .187 0 .187.189v1.7c0 .188 0 .188-.187.188H8.187c-.126-.003-.126-.023-.126-.188V4.283c.003-.126.024-.126.188-.126zm3.94 0c.185 0 .372 0 .372.189v1.762c-.002.126-.023.126-.187.126h-1.75C12 6.231 12 6.211 12 6.046v-1.7c0-.19.187-.19.187-.19z",
  13769. "fill": "currentColor"
  13770. }
  13771. })]);
  13772. }
  13773. });
  13774. // CONCATENATED MODULE: ./es/number-keyboard/Key.js
  13775. var Key_createNamespace = Object(create["a" /* createNamespace */])('key'),
  13776. Key_createComponent = Key_createNamespace[0],
  13777. Key_bem = Key_createNamespace[1];
  13778. /* harmony default export */ var Key = (Key_createComponent({
  13779. mixins: [TouchMixin],
  13780. props: {
  13781. type: String,
  13782. text: [Number, String],
  13783. color: String,
  13784. wider: Boolean,
  13785. large: Boolean,
  13786. loading: Boolean
  13787. },
  13788. data: function data() {
  13789. return {
  13790. active: false
  13791. };
  13792. },
  13793. mounted: function mounted() {
  13794. this.bindTouchEvent(this.$el);
  13795. },
  13796. methods: {
  13797. onTouchStart: function onTouchStart(event) {
  13798. // compatible with Vue 2.6 event bubble bug
  13799. event.stopPropagation();
  13800. this.touchStart(event);
  13801. this.active = true;
  13802. },
  13803. onTouchMove: function onTouchMove(event) {
  13804. this.touchMove(event);
  13805. if (this.direction) {
  13806. this.active = false;
  13807. }
  13808. },
  13809. onTouchEnd: function onTouchEnd(event) {
  13810. if (this.active) {
  13811. // eliminate tap delay on safari
  13812. // see: https://github.com/vant-ui/vant/issues/6836
  13813. if (!this.slots('default')) {
  13814. event.preventDefault();
  13815. }
  13816. this.active = false;
  13817. this.$emit('press', this.text, this.type);
  13818. }
  13819. },
  13820. genContent: function genContent() {
  13821. var h = this.$createElement;
  13822. var isExtra = this.type === 'extra';
  13823. var isDelete = this.type === 'delete';
  13824. var text = this.slots('default') || this.text;
  13825. if (this.loading) {
  13826. return h(es_loading, {
  13827. "class": Key_bem('loading-icon')
  13828. });
  13829. }
  13830. if (isDelete) {
  13831. return text || h(number_keyboard_DeleteIcon, {
  13832. "class": Key_bem('delete-icon')
  13833. });
  13834. }
  13835. if (isExtra) {
  13836. return text || h(CollapseIcon, {
  13837. "class": Key_bem('collapse-icon')
  13838. });
  13839. }
  13840. return text;
  13841. }
  13842. },
  13843. render: function render() {
  13844. var h = arguments[0];
  13845. return h("div", {
  13846. "class": Key_bem('wrapper', {
  13847. wider: this.wider
  13848. })
  13849. }, [h("div", {
  13850. "attrs": {
  13851. "role": "button",
  13852. "tabindex": "0"
  13853. },
  13854. "class": Key_bem([this.color, {
  13855. large: this.large,
  13856. active: this.active,
  13857. delete: this.type === 'delete'
  13858. }])
  13859. }, [this.genContent()])]);
  13860. }
  13861. }));
  13862. // CONCATENATED MODULE: ./es/number-keyboard/index.js
  13863. var number_keyboard_createNamespace = Object(create["a" /* createNamespace */])('number-keyboard'),
  13864. number_keyboard_createComponent = number_keyboard_createNamespace[0],
  13865. number_keyboard_bem = number_keyboard_createNamespace[1];
  13866. /* harmony default export */ var number_keyboard = (number_keyboard_createComponent({
  13867. mixins: [PortalMixin(), BindEventMixin(function (bind) {
  13868. if (this.hideOnClickOutside) {
  13869. bind(document.body, 'touchstart', this.onBlur);
  13870. }
  13871. })],
  13872. model: {
  13873. event: 'update:value'
  13874. },
  13875. props: {
  13876. show: Boolean,
  13877. title: String,
  13878. zIndex: [Number, String],
  13879. randomKeyOrder: Boolean,
  13880. closeButtonText: String,
  13881. deleteButtonText: String,
  13882. closeButtonLoading: Boolean,
  13883. theme: {
  13884. type: String,
  13885. default: 'default'
  13886. },
  13887. value: {
  13888. type: String,
  13889. default: ''
  13890. },
  13891. extraKey: {
  13892. type: [String, Array],
  13893. default: ''
  13894. },
  13895. maxlength: {
  13896. type: [Number, String],
  13897. default: Number.MAX_VALUE
  13898. },
  13899. transition: {
  13900. type: Boolean,
  13901. default: true
  13902. },
  13903. showDeleteKey: {
  13904. type: Boolean,
  13905. default: true
  13906. },
  13907. hideOnClickOutside: {
  13908. type: Boolean,
  13909. default: true
  13910. },
  13911. safeAreaInsetBottom: {
  13912. type: Boolean,
  13913. default: true
  13914. }
  13915. },
  13916. watch: {
  13917. show: function show(val) {
  13918. if (!this.transition) {
  13919. this.$emit(val ? 'show' : 'hide');
  13920. }
  13921. }
  13922. },
  13923. computed: {
  13924. keys: function keys() {
  13925. if (this.theme === 'custom') {
  13926. return this.genCustomKeys();
  13927. }
  13928. return this.genDefaultKeys();
  13929. }
  13930. },
  13931. methods: {
  13932. genBasicKeys: function genBasicKeys() {
  13933. var keys = [];
  13934. for (var i = 1; i <= 9; i++) {
  13935. keys.push({
  13936. text: i
  13937. });
  13938. }
  13939. if (this.randomKeyOrder) {
  13940. keys.sort(function () {
  13941. return Math.random() > 0.5 ? 1 : -1;
  13942. });
  13943. }
  13944. return keys;
  13945. },
  13946. genDefaultKeys: function genDefaultKeys() {
  13947. return [].concat(this.genBasicKeys(), [{
  13948. text: this.extraKey,
  13949. type: 'extra'
  13950. }, {
  13951. text: 0
  13952. }, {
  13953. text: this.showDeleteKey ? this.deleteButtonText : '',
  13954. type: this.showDeleteKey ? 'delete' : ''
  13955. }]);
  13956. },
  13957. genCustomKeys: function genCustomKeys() {
  13958. var keys = this.genBasicKeys();
  13959. var extraKey = this.extraKey;
  13960. var extraKeys = Array.isArray(extraKey) ? extraKey : [extraKey];
  13961. if (extraKeys.length === 1) {
  13962. keys.push({
  13963. text: 0,
  13964. wider: true
  13965. }, {
  13966. text: extraKeys[0],
  13967. type: 'extra'
  13968. });
  13969. } else if (extraKeys.length === 2) {
  13970. keys.push({
  13971. text: extraKeys[0],
  13972. type: 'extra'
  13973. }, {
  13974. text: 0
  13975. }, {
  13976. text: extraKeys[1],
  13977. type: 'extra'
  13978. });
  13979. }
  13980. return keys;
  13981. },
  13982. onBlur: function onBlur() {
  13983. this.show && this.$emit('blur');
  13984. },
  13985. onClose: function onClose() {
  13986. this.$emit('close');
  13987. this.onBlur();
  13988. },
  13989. onAnimationEnd: function onAnimationEnd() {
  13990. this.$emit(this.show ? 'show' : 'hide');
  13991. },
  13992. onPress: function onPress(text, type) {
  13993. if (text === '') {
  13994. if (type === 'extra') {
  13995. this.onBlur();
  13996. }
  13997. return;
  13998. }
  13999. var value = this.value;
  14000. if (type === 'delete') {
  14001. this.$emit('delete');
  14002. this.$emit('update:value', value.slice(0, value.length - 1));
  14003. } else if (type === 'close') {
  14004. this.onClose();
  14005. } else if (value.length < this.maxlength) {
  14006. this.$emit('input', text);
  14007. this.$emit('update:value', value + text);
  14008. }
  14009. },
  14010. genTitle: function genTitle() {
  14011. var h = this.$createElement;
  14012. var title = this.title,
  14013. theme = this.theme,
  14014. closeButtonText = this.closeButtonText;
  14015. var titleLeft = this.slots('title-left');
  14016. var showClose = closeButtonText && theme === 'default';
  14017. var showTitle = title || showClose || titleLeft;
  14018. if (!showTitle) {
  14019. return;
  14020. }
  14021. return h("div", {
  14022. "class": number_keyboard_bem('header')
  14023. }, [titleLeft && h("span", {
  14024. "class": number_keyboard_bem('title-left')
  14025. }, [titleLeft]), title && h("h2", {
  14026. "class": number_keyboard_bem('title')
  14027. }, [title]), showClose && h("button", {
  14028. "attrs": {
  14029. "type": "button"
  14030. },
  14031. "class": number_keyboard_bem('close'),
  14032. "on": {
  14033. "click": this.onClose
  14034. }
  14035. }, [closeButtonText])]);
  14036. },
  14037. genKeys: function genKeys() {
  14038. var _this = this;
  14039. var h = this.$createElement;
  14040. return this.keys.map(function (key) {
  14041. return h(Key, {
  14042. "key": key.text,
  14043. "attrs": {
  14044. "text": key.text,
  14045. "type": key.type,
  14046. "wider": key.wider,
  14047. "color": key.color
  14048. },
  14049. "on": {
  14050. "press": _this.onPress
  14051. }
  14052. }, [key.type === 'delete' && _this.slots('delete'), key.type === 'extra' && _this.slots('extra-key')]);
  14053. });
  14054. },
  14055. genSidebar: function genSidebar() {
  14056. var h = this.$createElement;
  14057. if (this.theme === 'custom') {
  14058. return h("div", {
  14059. "class": number_keyboard_bem('sidebar')
  14060. }, [this.showDeleteKey && h(Key, {
  14061. "attrs": {
  14062. "large": true,
  14063. "text": this.deleteButtonText,
  14064. "type": "delete"
  14065. },
  14066. "on": {
  14067. "press": this.onPress
  14068. }
  14069. }, [this.slots('delete')]), h(Key, {
  14070. "attrs": {
  14071. "large": true,
  14072. "text": this.closeButtonText,
  14073. "type": "close",
  14074. "color": "blue",
  14075. "loading": this.closeButtonLoading
  14076. },
  14077. "on": {
  14078. "press": this.onPress
  14079. }
  14080. })]);
  14081. }
  14082. }
  14083. },
  14084. render: function render() {
  14085. var h = arguments[0];
  14086. var Title = this.genTitle();
  14087. return h("transition", {
  14088. "attrs": {
  14089. "name": this.transition ? 'van-slide-up' : ''
  14090. }
  14091. }, [h("div", {
  14092. "directives": [{
  14093. name: "show",
  14094. value: this.show
  14095. }],
  14096. "style": {
  14097. zIndex: this.zIndex
  14098. },
  14099. "class": number_keyboard_bem({
  14100. unfit: !this.safeAreaInsetBottom,
  14101. 'with-title': Title
  14102. }),
  14103. "on": {
  14104. "touchstart": event_stopPropagation,
  14105. "animationend": this.onAnimationEnd,
  14106. "webkitAnimationEnd": this.onAnimationEnd
  14107. }
  14108. }, [Title, h("div", {
  14109. "class": number_keyboard_bem('body')
  14110. }, [h("div", {
  14111. "class": number_keyboard_bem('keys')
  14112. }, [this.genKeys()]), this.genSidebar()])])]);
  14113. }
  14114. }));
  14115. // CONCATENATED MODULE: ./es/pagination/index.js
  14116. var pagination_createNamespace = Object(create["a" /* createNamespace */])('pagination'),
  14117. pagination_createComponent = pagination_createNamespace[0],
  14118. pagination_bem = pagination_createNamespace[1],
  14119. pagination_t = pagination_createNamespace[2];
  14120. function makePage(number, text, active) {
  14121. return {
  14122. number: number,
  14123. text: text,
  14124. active: active
  14125. };
  14126. }
  14127. /* harmony default export */ var pagination = (pagination_createComponent({
  14128. props: {
  14129. prevText: String,
  14130. nextText: String,
  14131. forceEllipses: Boolean,
  14132. mode: {
  14133. type: String,
  14134. default: 'multi'
  14135. },
  14136. value: {
  14137. type: Number,
  14138. default: 0
  14139. },
  14140. pageCount: {
  14141. type: [Number, String],
  14142. default: 0
  14143. },
  14144. totalItems: {
  14145. type: [Number, String],
  14146. default: 0
  14147. },
  14148. itemsPerPage: {
  14149. type: [Number, String],
  14150. default: 10
  14151. },
  14152. showPageSize: {
  14153. type: [Number, String],
  14154. default: 5
  14155. }
  14156. },
  14157. computed: {
  14158. count: function count() {
  14159. var count = this.pageCount || Math.ceil(this.totalItems / this.itemsPerPage);
  14160. return Math.max(1, count);
  14161. },
  14162. pages: function pages() {
  14163. var pages = [];
  14164. var pageCount = this.count;
  14165. var showPageSize = +this.showPageSize;
  14166. if (this.mode !== 'multi') {
  14167. return pages;
  14168. } // Default page limits
  14169. var startPage = 1;
  14170. var endPage = pageCount;
  14171. var isMaxSized = showPageSize < pageCount; // recompute if showPageSize
  14172. if (isMaxSized) {
  14173. // Current page is displayed in the middle of the visible ones
  14174. startPage = Math.max(this.value - Math.floor(showPageSize / 2), 1);
  14175. endPage = startPage + showPageSize - 1; // Adjust if limit is exceeded
  14176. if (endPage > pageCount) {
  14177. endPage = pageCount;
  14178. startPage = endPage - showPageSize + 1;
  14179. }
  14180. } // Add page number links
  14181. for (var number = startPage; number <= endPage; number++) {
  14182. var page = makePage(number, number, number === this.value);
  14183. pages.push(page);
  14184. } // Add links to move between page sets
  14185. if (isMaxSized && showPageSize > 0 && this.forceEllipses) {
  14186. if (startPage > 1) {
  14187. var previousPageSet = makePage(startPage - 1, '...', false);
  14188. pages.unshift(previousPageSet);
  14189. }
  14190. if (endPage < pageCount) {
  14191. var nextPageSet = makePage(endPage + 1, '...', false);
  14192. pages.push(nextPageSet);
  14193. }
  14194. }
  14195. return pages;
  14196. }
  14197. },
  14198. watch: {
  14199. value: {
  14200. handler: function handler(page) {
  14201. this.select(page || this.value);
  14202. },
  14203. immediate: true
  14204. }
  14205. },
  14206. methods: {
  14207. select: function select(page, emitChange) {
  14208. page = Math.min(this.count, Math.max(1, page));
  14209. if (this.value !== page) {
  14210. this.$emit('input', page);
  14211. if (emitChange) {
  14212. this.$emit('change', page);
  14213. }
  14214. }
  14215. }
  14216. },
  14217. render: function render() {
  14218. var _this = this,
  14219. _this$slots,
  14220. _this$slots3;
  14221. var h = arguments[0];
  14222. var value = this.value;
  14223. var simple = this.mode !== 'multi';
  14224. var onSelect = function onSelect(value) {
  14225. return function () {
  14226. _this.select(value, true);
  14227. };
  14228. };
  14229. return h("ul", {
  14230. "class": pagination_bem({
  14231. simple: simple
  14232. })
  14233. }, [h("li", {
  14234. "class": [pagination_bem('item', {
  14235. disabled: value === 1
  14236. }), pagination_bem('prev'), BORDER],
  14237. "on": {
  14238. "click": onSelect(value - 1)
  14239. }
  14240. }, [((_this$slots = this.slots('prev-text')) != null ? _this$slots : this.prevText) || pagination_t('prev')]), this.pages.map(function (page) {
  14241. var _this$slots2;
  14242. return h("li", {
  14243. "class": [pagination_bem('item', {
  14244. active: page.active
  14245. }), pagination_bem('page'), BORDER],
  14246. "on": {
  14247. "click": onSelect(page.number)
  14248. }
  14249. }, [(_this$slots2 = _this.slots('page', page)) != null ? _this$slots2 : page.text]);
  14250. }), simple && h("li", {
  14251. "class": pagination_bem('page-desc')
  14252. }, [this.slots('pageDesc') || value + "/" + this.count]), h("li", {
  14253. "class": [pagination_bem('item', {
  14254. disabled: value === this.count
  14255. }), pagination_bem('next'), BORDER],
  14256. "on": {
  14257. "click": onSelect(value + 1)
  14258. }
  14259. }, [((_this$slots3 = this.slots('next-text')) != null ? _this$slots3 : this.nextText) || pagination_t('next')])]);
  14260. }
  14261. }));
  14262. // CONCATENATED MODULE: ./es/panel/index.js
  14263. // Utils
  14264. // Components
  14265. // Types
  14266. var panel_createNamespace = Object(create["a" /* createNamespace */])('panel'),
  14267. panel_createComponent = panel_createNamespace[0],
  14268. panel_bem = panel_createNamespace[1];
  14269. function Panel(h, props, slots, ctx) {
  14270. var Content = function Content() {
  14271. return [slots.header ? slots.header() : h(cell, {
  14272. "attrs": {
  14273. "icon": props.icon,
  14274. "label": props.desc,
  14275. "title": props.title,
  14276. "value": props.status,
  14277. "valueClass": panel_bem('header-value')
  14278. },
  14279. "class": panel_bem('header')
  14280. }), h("div", {
  14281. "class": panel_bem('content')
  14282. }, [slots.default && slots.default()]), slots.footer && h("div", {
  14283. "class": [panel_bem('footer'), BORDER_TOP]
  14284. }, [slots.footer()])];
  14285. };
  14286. return h(cell_group, helper_default()([{
  14287. "class": panel_bem(),
  14288. "scopedSlots": {
  14289. default: Content
  14290. }
  14291. }, inherit(ctx, true)]));
  14292. }
  14293. Panel.props = {
  14294. icon: String,
  14295. desc: String,
  14296. title: String,
  14297. status: String
  14298. };
  14299. /* harmony default export */ var panel = (panel_createComponent(Panel));
  14300. // CONCATENATED MODULE: ./es/password-input/index.js
  14301. // Utils
  14302. // Types
  14303. var password_input_createNamespace = Object(create["a" /* createNamespace */])('password-input'),
  14304. password_input_createComponent = password_input_createNamespace[0],
  14305. password_input_bem = password_input_createNamespace[1];
  14306. function PasswordInput(h, props, slots, ctx) {
  14307. var _ref2;
  14308. var mask = props.mask,
  14309. value = props.value,
  14310. length = props.length,
  14311. gutter = props.gutter,
  14312. focused = props.focused,
  14313. errorInfo = props.errorInfo;
  14314. var info = errorInfo || props.info;
  14315. var Points = [];
  14316. for (var i = 0; i < length; i++) {
  14317. var _ref;
  14318. var _char = value[i];
  14319. var showBorder = i !== 0 && !gutter;
  14320. var showCursor = focused && i === value.length;
  14321. var style = void 0;
  14322. if (i !== 0 && gutter) {
  14323. style = {
  14324. marginLeft: Object(unit["a" /* addUnit */])(gutter)
  14325. };
  14326. }
  14327. Points.push(h("li", {
  14328. "class": [(_ref = {}, _ref[BORDER_LEFT] = showBorder, _ref), password_input_bem('item', {
  14329. focus: showCursor
  14330. })],
  14331. "style": style
  14332. }, [mask ? h("i", {
  14333. "style": {
  14334. visibility: _char ? 'visible' : 'hidden'
  14335. }
  14336. }) : _char, showCursor && h("div", {
  14337. "class": password_input_bem('cursor')
  14338. })]));
  14339. }
  14340. return h("div", {
  14341. "class": password_input_bem()
  14342. }, [h("ul", helper_default()([{
  14343. "class": [password_input_bem('security'), (_ref2 = {}, _ref2[BORDER_SURROUND] = !gutter, _ref2)],
  14344. "on": {
  14345. "touchstart": function touchstart(event) {
  14346. event.stopPropagation();
  14347. functional_emit(ctx, 'focus', event);
  14348. }
  14349. }
  14350. }, inherit(ctx, true)]), [Points]), info && h("div", {
  14351. "class": password_input_bem(errorInfo ? 'error-info' : 'info')
  14352. }, [info])]);
  14353. }
  14354. PasswordInput.props = {
  14355. info: String,
  14356. gutter: [Number, String],
  14357. focused: Boolean,
  14358. errorInfo: String,
  14359. mask: {
  14360. type: Boolean,
  14361. default: true
  14362. },
  14363. value: {
  14364. type: String,
  14365. default: ''
  14366. },
  14367. length: {
  14368. type: [Number, String],
  14369. default: 6
  14370. }
  14371. };
  14372. /* harmony default export */ var password_input = (password_input_createComponent(PasswordInput));
  14373. // CONCATENATED MODULE: ./node_modules/@vant/popperjs/dist/esm/index.js
  14374. function getBoundingClientRect(element) {
  14375. var rect = element.getBoundingClientRect();
  14376. return {
  14377. width: rect.width,
  14378. height: rect.height,
  14379. top: rect.top,
  14380. right: rect.right,
  14381. bottom: rect.bottom,
  14382. left: rect.left,
  14383. x: rect.left,
  14384. y: rect.top
  14385. };
  14386. }
  14387. function getWindow(node) {
  14388. if (node == null) {
  14389. return window;
  14390. }
  14391. if (node.toString() !== '[object Window]') {
  14392. var ownerDocument = node.ownerDocument;
  14393. return ownerDocument ? ownerDocument.defaultView || window : window;
  14394. }
  14395. return node;
  14396. }
  14397. function getWindowScroll(node) {
  14398. var win = getWindow(node);
  14399. var scrollLeft = win.pageXOffset;
  14400. var scrollTop = win.pageYOffset;
  14401. return {
  14402. scrollLeft: scrollLeft,
  14403. scrollTop: scrollTop
  14404. };
  14405. }
  14406. function isElement(node) {
  14407. var OwnElement = getWindow(node).Element;
  14408. return node instanceof OwnElement || node instanceof Element;
  14409. }
  14410. function isHTMLElement(node) {
  14411. var OwnElement = getWindow(node).HTMLElement;
  14412. return node instanceof OwnElement || node instanceof HTMLElement;
  14413. }
  14414. function isShadowRoot(node) {
  14415. // IE 11 has no ShadowRoot
  14416. if (typeof ShadowRoot === 'undefined') {
  14417. return false;
  14418. }
  14419. var OwnElement = getWindow(node).ShadowRoot;
  14420. return node instanceof OwnElement || node instanceof ShadowRoot;
  14421. }
  14422. function getHTMLElementScroll(element) {
  14423. return {
  14424. scrollLeft: element.scrollLeft,
  14425. scrollTop: element.scrollTop
  14426. };
  14427. }
  14428. function getNodeScroll(node) {
  14429. if (node === getWindow(node) || !isHTMLElement(node)) {
  14430. return getWindowScroll(node);
  14431. } else {
  14432. return getHTMLElementScroll(node);
  14433. }
  14434. }
  14435. function getNodeName(element) {
  14436. return element ? (element.nodeName || '').toLowerCase() : null;
  14437. }
  14438. function getDocumentElement(element) {
  14439. // $FlowFixMe[incompatible-return]: assume body is always available
  14440. return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
  14441. element.document) || window.document).documentElement;
  14442. }
  14443. function getWindowScrollBarX(element) {
  14444. // If <html> has a CSS width greater than the viewport, then this will be
  14445. // incorrect for RTL.
  14446. // Popper 1 is broken in this case and never had a bug report so let's assume
  14447. // it's not an issue. I don't think anyone ever specifies width on <html>
  14448. // anyway.
  14449. // Browsers where the left scrollbar doesn't cause an issue report `0` for
  14450. // this (e.g. Edge 2019, IE11, Safari)
  14451. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  14452. }
  14453. function getComputedStyle(element) {
  14454. return getWindow(element).getComputedStyle(element);
  14455. }
  14456. function isScrollParent(element) {
  14457. // Firefox wants us to check `-x` and `-y` variations as well
  14458. var _getComputedStyle = getComputedStyle(element),
  14459. overflow = _getComputedStyle.overflow,
  14460. overflowX = _getComputedStyle.overflowX,
  14461. overflowY = _getComputedStyle.overflowY;
  14462. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  14463. } // Composite means it takes into account transforms as well as layout.
  14464. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  14465. if (isFixed === void 0) {
  14466. isFixed = false;
  14467. }
  14468. var documentElement = getDocumentElement(offsetParent);
  14469. var rect = getBoundingClientRect(elementOrVirtualElement);
  14470. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  14471. var scroll = {
  14472. scrollLeft: 0,
  14473. scrollTop: 0
  14474. };
  14475. var offsets = {
  14476. x: 0,
  14477. y: 0
  14478. };
  14479. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  14480. if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
  14481. isScrollParent(documentElement)) {
  14482. scroll = getNodeScroll(offsetParent);
  14483. }
  14484. if (isHTMLElement(offsetParent)) {
  14485. offsets = getBoundingClientRect(offsetParent);
  14486. offsets.x += offsetParent.clientLeft;
  14487. offsets.y += offsetParent.clientTop;
  14488. } else if (documentElement) {
  14489. offsets.x = getWindowScrollBarX(documentElement);
  14490. }
  14491. }
  14492. return {
  14493. x: rect.left + scroll.scrollLeft - offsets.x,
  14494. y: rect.top + scroll.scrollTop - offsets.y,
  14495. width: rect.width,
  14496. height: rect.height
  14497. };
  14498. } // means it doesn't take into account transforms.
  14499. function getLayoutRect(element) {
  14500. var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
  14501. // Fixes https://github.com/popperjs/popper-core/issues/1223
  14502. var width = element.offsetWidth;
  14503. var height = element.offsetHeight;
  14504. if (Math.abs(clientRect.width - width) <= 1) {
  14505. width = clientRect.width;
  14506. }
  14507. if (Math.abs(clientRect.height - height) <= 1) {
  14508. height = clientRect.height;
  14509. }
  14510. return {
  14511. x: element.offsetLeft,
  14512. y: element.offsetTop,
  14513. width: width,
  14514. height: height
  14515. };
  14516. }
  14517. function getParentNode(element) {
  14518. if (getNodeName(element) === 'html') {
  14519. return element;
  14520. }
  14521. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  14522. // $FlowFixMe[incompatible-return]
  14523. // $FlowFixMe[prop-missing]
  14524. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  14525. element.parentNode || ( // DOM Element detected
  14526. isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  14527. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  14528. getDocumentElement(element) // fallback
  14529. );
  14530. }
  14531. function getScrollParent(node) {
  14532. if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
  14533. // $FlowFixMe[incompatible-return]: assume body is always available
  14534. return node.ownerDocument.body;
  14535. }
  14536. if (isHTMLElement(node) && isScrollParent(node)) {
  14537. return node;
  14538. }
  14539. return getScrollParent(getParentNode(node));
  14540. }
  14541. /*
  14542. given a DOM element, return the list of all scroll parents, up the list of ancesors
  14543. until we get to the top window object. This list is what we attach scroll listeners
  14544. to, because if any of these parent elements scroll, we'll need to re-calculate the
  14545. reference element's position.
  14546. */
  14547. function listScrollParents(element, list) {
  14548. var _element$ownerDocumen;
  14549. if (list === void 0) {
  14550. list = [];
  14551. }
  14552. var scrollParent = getScrollParent(element);
  14553. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  14554. var win = getWindow(scrollParent);
  14555. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  14556. var updatedList = list.concat(target);
  14557. return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  14558. updatedList.concat(listScrollParents(getParentNode(target)));
  14559. }
  14560. function isTableElement(element) {
  14561. return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
  14562. }
  14563. function getTrueOffsetParent(element) {
  14564. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  14565. getComputedStyle(element).position === 'fixed') {
  14566. return null;
  14567. }
  14568. return element.offsetParent;
  14569. } // `.offsetParent` reports `null` for fixed elements, while absolute elements
  14570. // return the containing block
  14571. function getContainingBlock(element) {
  14572. var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
  14573. var isIE = navigator.userAgent.indexOf('Trident') !== -1;
  14574. if (isIE && isHTMLElement(element)) {
  14575. // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
  14576. var elementCss = getComputedStyle(element);
  14577. if (elementCss.position === 'fixed') {
  14578. return null;
  14579. }
  14580. }
  14581. var currentNode = getParentNode(element);
  14582. while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
  14583. var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
  14584. // create a containing block.
  14585. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  14586. if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
  14587. return currentNode;
  14588. } else {
  14589. currentNode = currentNode.parentNode;
  14590. }
  14591. }
  14592. return null;
  14593. } // Gets the closest ancestor positioned element. Handles some edge cases,
  14594. // such as table ancestors and cross browser bugs.
  14595. function getOffsetParent(element) {
  14596. var window = getWindow(element);
  14597. var offsetParent = getTrueOffsetParent(element);
  14598. while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
  14599. offsetParent = getTrueOffsetParent(offsetParent);
  14600. }
  14601. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
  14602. return window;
  14603. }
  14604. return offsetParent || getContainingBlock(element) || window;
  14605. }
  14606. var esm_top = 'top';
  14607. var esm_bottom = 'bottom';
  14608. var right = 'right';
  14609. var esm_left = 'left';
  14610. var auto = 'auto';
  14611. var basePlacements = [esm_top, esm_bottom, right, esm_left];
  14612. var start = 'start';
  14613. var end = 'end';
  14614. var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
  14615. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  14616. }, []); // modifiers that need to read the DOM
  14617. var beforeRead = 'beforeRead';
  14618. var read = 'read';
  14619. var afterRead = 'afterRead'; // pure-logic modifiers
  14620. var beforeMain = 'beforeMain';
  14621. var main = 'main';
  14622. var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
  14623. var beforeWrite = 'beforeWrite';
  14624. var write = 'write';
  14625. var afterWrite = 'afterWrite';
  14626. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  14627. function order(modifiers) {
  14628. var map = new Map();
  14629. var visited = new Set();
  14630. var result = [];
  14631. modifiers.forEach(function (modifier) {
  14632. map.set(modifier.name, modifier);
  14633. }); // On visiting object, check for its dependencies and visit them recursively
  14634. function sort(modifier) {
  14635. visited.add(modifier.name);
  14636. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  14637. requires.forEach(function (dep) {
  14638. if (!visited.has(dep)) {
  14639. var depModifier = map.get(dep);
  14640. if (depModifier) {
  14641. sort(depModifier);
  14642. }
  14643. }
  14644. });
  14645. result.push(modifier);
  14646. }
  14647. modifiers.forEach(function (modifier) {
  14648. if (!visited.has(modifier.name)) {
  14649. // check for visited object
  14650. sort(modifier);
  14651. }
  14652. });
  14653. return result;
  14654. }
  14655. function orderModifiers(modifiers) {
  14656. // order based on dependencies
  14657. var orderedModifiers = order(modifiers); // order based on phase
  14658. return modifierPhases.reduce(function (acc, phase) {
  14659. return acc.concat(orderedModifiers.filter(function (modifier) {
  14660. return modifier.phase === phase;
  14661. }));
  14662. }, []);
  14663. }
  14664. function debounce(fn) {
  14665. var pending;
  14666. return function () {
  14667. if (!pending) {
  14668. pending = new Promise(function (resolve) {
  14669. Promise.resolve().then(function () {
  14670. pending = undefined;
  14671. resolve(fn());
  14672. });
  14673. });
  14674. }
  14675. return pending;
  14676. };
  14677. }
  14678. function esm_format(str) {
  14679. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  14680. args[_key - 1] = arguments[_key];
  14681. }
  14682. return [].concat(args).reduce(function (p, c) {
  14683. return p.replace(/%s/, c);
  14684. }, str);
  14685. }
  14686. var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
  14687. var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
  14688. var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
  14689. function validateModifiers(modifiers) {
  14690. modifiers.forEach(function (modifier) {
  14691. Object.keys(modifier).forEach(function (key) {
  14692. switch (key) {
  14693. case 'name':
  14694. if (typeof modifier.name !== 'string') {
  14695. console.error(esm_format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
  14696. }
  14697. break;
  14698. case 'enabled':
  14699. if (typeof modifier.enabled !== 'boolean') {
  14700. console.error(esm_format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
  14701. }
  14702. case 'phase':
  14703. if (modifierPhases.indexOf(modifier.phase) < 0) {
  14704. console.error(esm_format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
  14705. }
  14706. break;
  14707. case 'fn':
  14708. if (typeof modifier.fn !== 'function') {
  14709. console.error(esm_format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
  14710. }
  14711. break;
  14712. case 'effect':
  14713. if (typeof modifier.effect !== 'function') {
  14714. console.error(esm_format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
  14715. }
  14716. break;
  14717. case 'requires':
  14718. if (!Array.isArray(modifier.requires)) {
  14719. console.error(esm_format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
  14720. }
  14721. break;
  14722. case 'requiresIfExists':
  14723. if (!Array.isArray(modifier.requiresIfExists)) {
  14724. console.error(esm_format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
  14725. }
  14726. break;
  14727. case 'options':
  14728. case 'data':
  14729. break;
  14730. default:
  14731. console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
  14732. return "\"" + s + "\"";
  14733. }).join(', ') + "; but \"" + key + "\" was provided.");
  14734. }
  14735. modifier.requires && modifier.requires.forEach(function (requirement) {
  14736. if (modifiers.find(function (mod) {
  14737. return mod.name === requirement;
  14738. }) == null) {
  14739. console.error(esm_format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
  14740. }
  14741. });
  14742. });
  14743. });
  14744. }
  14745. function uniqueBy(arr, fn) {
  14746. var identifiers = new Set();
  14747. return arr.filter(function (item) {
  14748. var identifier = fn(item);
  14749. if (!identifiers.has(identifier)) {
  14750. identifiers.add(identifier);
  14751. return true;
  14752. }
  14753. });
  14754. }
  14755. function getBasePlacement(placement) {
  14756. return placement.split('-')[0];
  14757. }
  14758. function mergeByName(modifiers) {
  14759. var merged = modifiers.reduce(function (merged, current) {
  14760. var existing = merged[current.name];
  14761. merged[current.name] = existing ? _extends({}, existing, current, {
  14762. options: _extends({}, existing.options, current.options),
  14763. data: _extends({}, existing.data, current.data)
  14764. }) : current;
  14765. return merged;
  14766. }, {}); // IE11 does not support Object.values
  14767. return Object.keys(merged).map(function (key) {
  14768. return merged[key];
  14769. });
  14770. }
  14771. var esm_round = Math.round;
  14772. function getVariation(placement) {
  14773. return placement.split('-')[1];
  14774. }
  14775. function getMainAxisFromPlacement(placement) {
  14776. return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
  14777. }
  14778. function computeOffsets(_ref) {
  14779. var reference = _ref.reference,
  14780. element = _ref.element,
  14781. placement = _ref.placement;
  14782. var basePlacement = placement ? getBasePlacement(placement) : null;
  14783. var variation = placement ? getVariation(placement) : null;
  14784. var commonX = reference.x + reference.width / 2 - element.width / 2;
  14785. var commonY = reference.y + reference.height / 2 - element.height / 2;
  14786. var offsets;
  14787. switch (basePlacement) {
  14788. case esm_top:
  14789. offsets = {
  14790. x: commonX,
  14791. y: reference.y - element.height
  14792. };
  14793. break;
  14794. case esm_bottom:
  14795. offsets = {
  14796. x: commonX,
  14797. y: reference.y + reference.height
  14798. };
  14799. break;
  14800. case right:
  14801. offsets = {
  14802. x: reference.x + reference.width,
  14803. y: commonY
  14804. };
  14805. break;
  14806. case esm_left:
  14807. offsets = {
  14808. x: reference.x - element.width,
  14809. y: commonY
  14810. };
  14811. break;
  14812. default:
  14813. offsets = {
  14814. x: reference.x,
  14815. y: reference.y
  14816. };
  14817. }
  14818. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  14819. if (mainAxis != null) {
  14820. var len = mainAxis === 'y' ? 'height' : 'width';
  14821. switch (variation) {
  14822. case start:
  14823. offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
  14824. break;
  14825. case end:
  14826. offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
  14827. break;
  14828. }
  14829. }
  14830. return offsets;
  14831. }
  14832. var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
  14833. var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
  14834. var DEFAULT_OPTIONS = {
  14835. placement: 'bottom',
  14836. modifiers: [],
  14837. strategy: 'absolute'
  14838. };
  14839. function areValidElements() {
  14840. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  14841. args[_key] = arguments[_key];
  14842. }
  14843. return !args.some(function (element) {
  14844. return !(element && typeof element.getBoundingClientRect === 'function');
  14845. });
  14846. }
  14847. function popperGenerator(generatorOptions) {
  14848. if (generatorOptions === void 0) {
  14849. generatorOptions = {};
  14850. }
  14851. var _generatorOptions = generatorOptions,
  14852. _generatorOptions$def = _generatorOptions.defaultModifiers,
  14853. defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
  14854. _generatorOptions$def2 = _generatorOptions.defaultOptions,
  14855. defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  14856. return function createPopper(reference, popper, options) {
  14857. if (options === void 0) {
  14858. options = defaultOptions;
  14859. }
  14860. var state = {
  14861. placement: 'bottom',
  14862. orderedModifiers: [],
  14863. options: _extends({}, DEFAULT_OPTIONS, defaultOptions),
  14864. modifiersData: {},
  14865. elements: {
  14866. reference: reference,
  14867. popper: popper
  14868. },
  14869. attributes: {},
  14870. styles: {}
  14871. };
  14872. var effectCleanupFns = [];
  14873. var isDestroyed = false;
  14874. var instance = {
  14875. state: state,
  14876. setOptions: function setOptions(options) {
  14877. cleanupModifierEffects();
  14878. state.options = _extends({}, defaultOptions, state.options, options);
  14879. state.scrollParents = {
  14880. reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
  14881. popper: listScrollParents(popper)
  14882. }; // Orders the modifiers based on their dependencies and `phase`
  14883. // properties
  14884. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
  14885. state.orderedModifiers = orderedModifiers.filter(function (m) {
  14886. return m.enabled;
  14887. }); // Validate the provided modifiers so that the consumer will get warned
  14888. // if one of the modifiers is invalid for any reason
  14889. if (false) { var _getComputedStyle, marginTop, marginRight, marginBottom, marginLeft, flipModifier, modifiers; }
  14890. runModifierEffects();
  14891. return instance.update();
  14892. },
  14893. // Sync update – it will always be executed, even if not necessary. This
  14894. // is useful for low frequency updates where sync behavior simplifies the
  14895. // logic.
  14896. // For high frequency updates (e.g. `resize` and `scroll` events), always
  14897. // prefer the async Popper#update method
  14898. forceUpdate: function forceUpdate() {
  14899. if (isDestroyed) {
  14900. return;
  14901. }
  14902. var _state$elements = state.elements,
  14903. reference = _state$elements.reference,
  14904. popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
  14905. // anymore
  14906. if (!areValidElements(reference, popper)) {
  14907. if (false) {}
  14908. return;
  14909. } // Store the reference and popper rects to be read by modifiers
  14910. state.rects = {
  14911. reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
  14912. popper: getLayoutRect(popper)
  14913. }; // Modifiers have the ability to reset the current update cycle. The
  14914. // most common use case for this is the `flip` modifier changing the
  14915. // placement, which then needs to re-run all the modifiers, because the
  14916. // logic was previously ran for the previous placement and is therefore
  14917. // stale/incorrect
  14918. state.reset = false;
  14919. state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
  14920. // is filled with the initial data specified by the modifier. This means
  14921. // it doesn't persist and is fresh on each update.
  14922. // To ensure persistent data, use `${name}#persistent`
  14923. state.orderedModifiers.forEach(function (modifier) {
  14924. return state.modifiersData[modifier.name] = _extends({}, modifier.data);
  14925. });
  14926. var __debug_loops__ = 0;
  14927. for (var index = 0; index < state.orderedModifiers.length; index++) {
  14928. if (false) {}
  14929. if (state.reset === true) {
  14930. state.reset = false;
  14931. index = -1;
  14932. continue;
  14933. }
  14934. var _state$orderedModifie = state.orderedModifiers[index],
  14935. fn = _state$orderedModifie.fn,
  14936. _state$orderedModifie2 = _state$orderedModifie.options,
  14937. _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
  14938. name = _state$orderedModifie.name;
  14939. if (typeof fn === 'function') {
  14940. state = fn({
  14941. state: state,
  14942. options: _options,
  14943. name: name,
  14944. instance: instance
  14945. }) || state;
  14946. }
  14947. }
  14948. },
  14949. // Async and optimistically optimized update – it will not be executed if
  14950. // not necessary (debounced to run at most once-per-tick)
  14951. update: debounce(function () {
  14952. return new Promise(function (resolve) {
  14953. instance.forceUpdate();
  14954. resolve(state);
  14955. });
  14956. }),
  14957. destroy: function destroy() {
  14958. cleanupModifierEffects();
  14959. isDestroyed = true;
  14960. }
  14961. };
  14962. if (!areValidElements(reference, popper)) {
  14963. if (false) {}
  14964. return instance;
  14965. }
  14966. instance.setOptions(options).then(function (state) {
  14967. if (!isDestroyed && options.onFirstUpdate) {
  14968. options.onFirstUpdate(state);
  14969. }
  14970. }); // Modifiers have the ability to execute arbitrary code before the first
  14971. // update cycle runs. They will be executed in the same order as the update
  14972. // cycle. This is useful when a modifier adds some persistent data that
  14973. // other modifiers need to use, but the modifier is run after the dependent
  14974. // one.
  14975. function runModifierEffects() {
  14976. state.orderedModifiers.forEach(function (_ref3) {
  14977. var name = _ref3.name,
  14978. _ref3$options = _ref3.options,
  14979. options = _ref3$options === void 0 ? {} : _ref3$options,
  14980. effect = _ref3.effect;
  14981. if (typeof effect === 'function') {
  14982. var cleanupFn = effect({
  14983. state: state,
  14984. name: name,
  14985. instance: instance,
  14986. options: options
  14987. });
  14988. var noopFn = function noopFn() {};
  14989. effectCleanupFns.push(cleanupFn || noopFn);
  14990. }
  14991. });
  14992. }
  14993. function cleanupModifierEffects() {
  14994. effectCleanupFns.forEach(function (fn) {
  14995. return fn();
  14996. });
  14997. effectCleanupFns = [];
  14998. }
  14999. return instance;
  15000. };
  15001. }
  15002. var esm_passive = {
  15003. passive: true
  15004. };
  15005. function effect(_ref) {
  15006. var state = _ref.state,
  15007. instance = _ref.instance,
  15008. options = _ref.options;
  15009. var _options$scroll = options.scroll,
  15010. scroll = _options$scroll === void 0 ? true : _options$scroll,
  15011. _options$resize = options.resize,
  15012. resize = _options$resize === void 0 ? true : _options$resize;
  15013. var window = getWindow(state.elements.popper);
  15014. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  15015. if (scroll) {
  15016. scrollParents.forEach(function (scrollParent) {
  15017. scrollParent.addEventListener('scroll', instance.update, esm_passive);
  15018. });
  15019. }
  15020. if (resize) {
  15021. window.addEventListener('resize', instance.update, esm_passive);
  15022. }
  15023. return function () {
  15024. if (scroll) {
  15025. scrollParents.forEach(function (scrollParent) {
  15026. scrollParent.removeEventListener('scroll', instance.update, esm_passive);
  15027. });
  15028. }
  15029. if (resize) {
  15030. window.removeEventListener('resize', instance.update, esm_passive);
  15031. }
  15032. };
  15033. } // eslint-disable-next-line import/no-unused-modules
  15034. var eventListeners = {
  15035. name: 'eventListeners',
  15036. enabled: true,
  15037. phase: 'write',
  15038. fn: function fn() {},
  15039. effect: effect,
  15040. data: {}
  15041. };
  15042. function popperOffsets(_ref) {
  15043. var state = _ref.state,
  15044. name = _ref.name; // Offsets are the actual position the popper needs to have to be
  15045. // properly positioned near its reference element
  15046. // This is the most basic placement, and will be adjusted by
  15047. // the modifiers in the next step
  15048. state.modifiersData[name] = computeOffsets({
  15049. reference: state.rects.reference,
  15050. element: state.rects.popper,
  15051. strategy: 'absolute',
  15052. placement: state.placement
  15053. });
  15054. } // eslint-disable-next-line import/no-unused-modules
  15055. var popperOffsets$1 = {
  15056. name: 'popperOffsets',
  15057. enabled: true,
  15058. phase: 'read',
  15059. fn: popperOffsets,
  15060. data: {}
  15061. };
  15062. var unsetSides = {
  15063. top: 'auto',
  15064. right: 'auto',
  15065. bottom: 'auto',
  15066. left: 'auto'
  15067. }; // Round the offsets to the nearest suitable subpixel based on the DPR.
  15068. // Zooming can change the DPR, but it seems to report a value that will
  15069. // cleanly divide the values into the appropriate subpixels.
  15070. function roundOffsetsByDPR(_ref) {
  15071. var x = _ref.x,
  15072. y = _ref.y;
  15073. var win = window;
  15074. var dpr = win.devicePixelRatio || 1;
  15075. return {
  15076. x: esm_round(esm_round(x * dpr) / dpr) || 0,
  15077. y: esm_round(esm_round(y * dpr) / dpr) || 0
  15078. };
  15079. }
  15080. function mapToStyles(_ref2) {
  15081. var _Object$assign2;
  15082. var popper = _ref2.popper,
  15083. popperRect = _ref2.popperRect,
  15084. placement = _ref2.placement,
  15085. offsets = _ref2.offsets,
  15086. position = _ref2.position,
  15087. gpuAcceleration = _ref2.gpuAcceleration,
  15088. adaptive = _ref2.adaptive,
  15089. roundOffsets = _ref2.roundOffsets;
  15090. var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
  15091. _ref3$x = _ref3.x,
  15092. x = _ref3$x === void 0 ? 0 : _ref3$x,
  15093. _ref3$y = _ref3.y,
  15094. y = _ref3$y === void 0 ? 0 : _ref3$y;
  15095. var hasX = offsets.hasOwnProperty('x');
  15096. var hasY = offsets.hasOwnProperty('y');
  15097. var sideX = esm_left;
  15098. var sideY = esm_top;
  15099. var win = window;
  15100. if (adaptive) {
  15101. var offsetParent = getOffsetParent(popper);
  15102. var heightProp = 'clientHeight';
  15103. var widthProp = 'clientWidth';
  15104. if (offsetParent === getWindow(popper)) {
  15105. offsetParent = getDocumentElement(popper);
  15106. if (getComputedStyle(offsetParent).position !== 'static') {
  15107. heightProp = 'scrollHeight';
  15108. widthProp = 'scrollWidth';
  15109. }
  15110. } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
  15111. offsetParent = offsetParent;
  15112. if (placement === esm_top) {
  15113. sideY = esm_bottom; // $FlowFixMe[prop-missing]
  15114. y -= offsetParent[heightProp] - popperRect.height;
  15115. y *= gpuAcceleration ? 1 : -1;
  15116. }
  15117. if (placement === esm_left) {
  15118. sideX = right; // $FlowFixMe[prop-missing]
  15119. x -= offsetParent[widthProp] - popperRect.width;
  15120. x *= gpuAcceleration ? 1 : -1;
  15121. }
  15122. }
  15123. var commonStyles = _extends({
  15124. position: position
  15125. }, adaptive && unsetSides);
  15126. if (gpuAcceleration) {
  15127. var _Object$assign;
  15128. return _extends({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
  15129. }
  15130. return _extends({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
  15131. }
  15132. function computeStyles(_ref4) {
  15133. var state = _ref4.state,
  15134. options = _ref4.options;
  15135. var _options$gpuAccelerat = options.gpuAcceleration,
  15136. gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
  15137. _options$adaptive = options.adaptive,
  15138. adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
  15139. _options$roundOffsets = options.roundOffsets,
  15140. roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  15141. if (false) { var transitionProperty; }
  15142. var commonStyles = {
  15143. placement: getBasePlacement(state.placement),
  15144. popper: state.elements.popper,
  15145. popperRect: state.rects.popper,
  15146. gpuAcceleration: gpuAcceleration
  15147. };
  15148. if (state.modifiersData.popperOffsets != null) {
  15149. state.styles.popper = _extends({}, state.styles.popper, mapToStyles(_extends({}, commonStyles, {
  15150. offsets: state.modifiersData.popperOffsets,
  15151. position: state.options.strategy,
  15152. adaptive: adaptive,
  15153. roundOffsets: roundOffsets
  15154. })));
  15155. }
  15156. if (state.modifiersData.arrow != null) {
  15157. state.styles.arrow = _extends({}, state.styles.arrow, mapToStyles(_extends({}, commonStyles, {
  15158. offsets: state.modifiersData.arrow,
  15159. position: 'absolute',
  15160. adaptive: false,
  15161. roundOffsets: roundOffsets
  15162. })));
  15163. }
  15164. state.attributes.popper = _extends({}, state.attributes.popper, {
  15165. 'data-popper-placement': state.placement
  15166. });
  15167. } // eslint-disable-next-line import/no-unused-modules
  15168. var computeStyles$1 = {
  15169. name: 'computeStyles',
  15170. enabled: true,
  15171. phase: 'beforeWrite',
  15172. fn: computeStyles,
  15173. data: {}
  15174. }; // and applies them to the HTMLElements such as popper and arrow
  15175. function applyStyles(_ref) {
  15176. var state = _ref.state;
  15177. Object.keys(state.elements).forEach(function (name) {
  15178. var style = state.styles[name] || {};
  15179. var attributes = state.attributes[name] || {};
  15180. var element = state.elements[name]; // arrow is optional + virtual elements
  15181. if (!isHTMLElement(element) || !getNodeName(element)) {
  15182. return;
  15183. } // Flow doesn't support to extend this property, but it's the most
  15184. // effective way to apply styles to an HTMLElement
  15185. // $FlowFixMe[cannot-write]
  15186. _extends(element.style, style);
  15187. Object.keys(attributes).forEach(function (name) {
  15188. var value = attributes[name];
  15189. if (value === false) {
  15190. element.removeAttribute(name);
  15191. } else {
  15192. element.setAttribute(name, value === true ? '' : value);
  15193. }
  15194. });
  15195. });
  15196. }
  15197. function effect$1(_ref2) {
  15198. var state = _ref2.state;
  15199. var initialStyles = {
  15200. popper: {
  15201. position: state.options.strategy,
  15202. left: '0',
  15203. top: '0',
  15204. margin: '0'
  15205. },
  15206. arrow: {
  15207. position: 'absolute'
  15208. },
  15209. reference: {}
  15210. };
  15211. _extends(state.elements.popper.style, initialStyles.popper);
  15212. state.styles = initialStyles;
  15213. if (state.elements.arrow) {
  15214. _extends(state.elements.arrow.style, initialStyles.arrow);
  15215. }
  15216. return function () {
  15217. Object.keys(state.elements).forEach(function (name) {
  15218. var element = state.elements[name];
  15219. var attributes = state.attributes[name] || {};
  15220. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
  15221. var style = styleProperties.reduce(function (style, property) {
  15222. style[property] = '';
  15223. return style;
  15224. }, {}); // arrow is optional + virtual elements
  15225. if (!isHTMLElement(element) || !getNodeName(element)) {
  15226. return;
  15227. }
  15228. _extends(element.style, style);
  15229. Object.keys(attributes).forEach(function (attribute) {
  15230. element.removeAttribute(attribute);
  15231. });
  15232. });
  15233. };
  15234. } // eslint-disable-next-line import/no-unused-modules
  15235. var applyStyles$1 = {
  15236. name: 'applyStyles',
  15237. enabled: true,
  15238. phase: 'write',
  15239. fn: applyStyles,
  15240. effect: effect$1,
  15241. requires: ['computeStyles']
  15242. };
  15243. var esm_defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1];
  15244. var esm_createPopper = /*#__PURE__*/popperGenerator({
  15245. defaultModifiers: esm_defaultModifiers
  15246. }); // eslint-disable-next-line import/no-unused-modules
  15247. function distanceAndSkiddingToXY(placement, rects, offset) {
  15248. var basePlacement = getBasePlacement(placement);
  15249. var invertDistance = [esm_left, esm_top].indexOf(basePlacement) >= 0 ? -1 : 1;
  15250. var _ref = typeof offset === 'function' ? offset(_extends({}, rects, {
  15251. placement: placement
  15252. })) : offset,
  15253. skidding = _ref[0],
  15254. distance = _ref[1];
  15255. skidding = skidding || 0;
  15256. distance = (distance || 0) * invertDistance;
  15257. return [esm_left, right].indexOf(basePlacement) >= 0 ? {
  15258. x: distance,
  15259. y: skidding
  15260. } : {
  15261. x: skidding,
  15262. y: distance
  15263. };
  15264. }
  15265. function esm_offset(_ref2) {
  15266. var state = _ref2.state,
  15267. options = _ref2.options,
  15268. name = _ref2.name;
  15269. var _options$offset = options.offset,
  15270. offset = _options$offset === void 0 ? [0, 0] : _options$offset;
  15271. var data = placements.reduce(function (acc, placement) {
  15272. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
  15273. return acc;
  15274. }, {});
  15275. var _data$state$placement = data[state.placement],
  15276. x = _data$state$placement.x,
  15277. y = _data$state$placement.y;
  15278. if (state.modifiersData.popperOffsets != null) {
  15279. state.modifiersData.popperOffsets.x += x;
  15280. state.modifiersData.popperOffsets.y += y;
  15281. }
  15282. state.modifiersData[name] = data;
  15283. } // eslint-disable-next-line import/no-unused-modules
  15284. var offset$1 = {
  15285. name: 'offset',
  15286. enabled: true,
  15287. phase: 'main',
  15288. requires: ['popperOffsets'],
  15289. fn: esm_offset
  15290. };
  15291. // CONCATENATED MODULE: ./es/popover/index.js
  15292. // Mixins
  15293. // Components
  15294. var popover_createNamespace = Object(create["a" /* createNamespace */])('popover'),
  15295. popover_createComponent = popover_createNamespace[0],
  15296. popover_bem = popover_createNamespace[1];
  15297. /* harmony default export */ var popover = (popover_createComponent({
  15298. mixins: [click_outside_ClickOutsideMixin({
  15299. event: 'touchstart',
  15300. method: 'onClickOutside'
  15301. })],
  15302. props: {
  15303. value: Boolean,
  15304. trigger: String,
  15305. overlay: Boolean,
  15306. offset: {
  15307. type: Array,
  15308. default: function _default() {
  15309. return [0, 8];
  15310. }
  15311. },
  15312. theme: {
  15313. type: String,
  15314. default: 'light'
  15315. },
  15316. actions: {
  15317. type: Array,
  15318. default: function _default() {
  15319. return [];
  15320. }
  15321. },
  15322. placement: {
  15323. type: String,
  15324. default: 'bottom'
  15325. },
  15326. getContainer: {
  15327. type: [String, Function],
  15328. default: 'body'
  15329. },
  15330. closeOnClickAction: {
  15331. type: Boolean,
  15332. default: true
  15333. }
  15334. },
  15335. watch: {
  15336. value: 'updateLocation',
  15337. placement: 'updateLocation'
  15338. },
  15339. mounted: function mounted() {
  15340. this.updateLocation();
  15341. },
  15342. beforeDestroy: function beforeDestroy() {
  15343. if (this.popper) {
  15344. if (!utils["h" /* isServer */]) {
  15345. window.removeEventListener('animationend', this.updateLocation);
  15346. window.removeEventListener('transitionend', this.updateLocation);
  15347. }
  15348. this.popper.destroy();
  15349. this.popper = null;
  15350. }
  15351. },
  15352. methods: {
  15353. createPopper: function createPopper() {
  15354. var popper = esm_createPopper(this.$refs.wrapper, this.$refs.popover.$el, {
  15355. placement: this.placement,
  15356. modifiers: [{
  15357. name: 'computeStyles',
  15358. options: {
  15359. adaptive: false,
  15360. gpuAcceleration: false
  15361. }
  15362. }, _extends({}, offset$1, {
  15363. options: {
  15364. offset: this.offset
  15365. }
  15366. })]
  15367. });
  15368. if (!utils["h" /* isServer */]) {
  15369. window.addEventListener('animationend', this.updateLocation);
  15370. window.addEventListener('transitionend', this.updateLocation);
  15371. }
  15372. return popper;
  15373. },
  15374. updateLocation: function updateLocation() {
  15375. var _this = this;
  15376. this.$nextTick(function () {
  15377. if (!_this.value) {
  15378. return;
  15379. }
  15380. if (!_this.popper) {
  15381. _this.popper = _this.createPopper();
  15382. } else {
  15383. _this.popper.setOptions({
  15384. placement: _this.placement
  15385. });
  15386. }
  15387. });
  15388. },
  15389. renderAction: function renderAction(action, index) {
  15390. var _this2 = this;
  15391. var h = this.$createElement;
  15392. var icon = action.icon,
  15393. text = action.text,
  15394. disabled = action.disabled,
  15395. className = action.className;
  15396. return h("div", {
  15397. "attrs": {
  15398. "role": "menuitem"
  15399. },
  15400. "class": [popover_bem('action', {
  15401. disabled: disabled,
  15402. 'with-icon': icon
  15403. }), className],
  15404. "on": {
  15405. "click": function click() {
  15406. return _this2.onClickAction(action, index);
  15407. }
  15408. }
  15409. }, [icon && h(es_icon, {
  15410. "attrs": {
  15411. "name": icon
  15412. },
  15413. "class": popover_bem('action-icon')
  15414. }), h("div", {
  15415. "class": [popover_bem('action-text'), BORDER_BOTTOM]
  15416. }, [text])]);
  15417. },
  15418. onToggle: function onToggle(value) {
  15419. this.$emit('input', value);
  15420. },
  15421. onClickWrapper: function onClickWrapper() {
  15422. if (this.trigger === 'click') {
  15423. this.onToggle(!this.value);
  15424. }
  15425. },
  15426. onTouchstart: function onTouchstart(event) {
  15427. event.stopPropagation();
  15428. this.$emit('touchstart', event);
  15429. },
  15430. onClickAction: function onClickAction(action, index) {
  15431. if (action.disabled) {
  15432. return;
  15433. }
  15434. this.$emit('select', action, index);
  15435. if (this.closeOnClickAction) {
  15436. this.$emit('input', false);
  15437. }
  15438. },
  15439. onClickOutside: function onClickOutside() {
  15440. this.$emit('input', false);
  15441. },
  15442. onOpen: function onOpen() {
  15443. this.$emit('open');
  15444. },
  15445. /* istanbul ignore next */
  15446. onOpened: function onOpened() {
  15447. this.$emit('opened');
  15448. },
  15449. onClose: function onClose() {
  15450. this.$emit('close');
  15451. },
  15452. /* istanbul ignore next */
  15453. onClosed: function onClosed() {
  15454. this.$emit('closed');
  15455. }
  15456. },
  15457. render: function render() {
  15458. var h = arguments[0];
  15459. return h("span", {
  15460. "ref": "wrapper",
  15461. "class": popover_bem('wrapper'),
  15462. "on": {
  15463. "click": this.onClickWrapper
  15464. }
  15465. }, [h(popup, {
  15466. "ref": "popover",
  15467. "attrs": {
  15468. "value": this.value,
  15469. "overlay": this.overlay,
  15470. "position": null,
  15471. "transition": "van-popover-zoom",
  15472. "lockScroll": false,
  15473. "getContainer": this.getContainer
  15474. },
  15475. "class": popover_bem([this.theme]),
  15476. "on": {
  15477. "open": this.onOpen,
  15478. "close": this.onClose,
  15479. "input": this.onToggle,
  15480. "opened": this.onOpened,
  15481. "closed": this.onClosed
  15482. },
  15483. "nativeOn": {
  15484. "touchstart": this.onTouchstart
  15485. }
  15486. }, [h("div", {
  15487. "class": popover_bem('arrow')
  15488. }), h("div", {
  15489. "class": popover_bem('content'),
  15490. "attrs": {
  15491. "role": "menu"
  15492. }
  15493. }, [this.slots('default') || this.actions.map(this.renderAction)])]), this.slots('reference')]);
  15494. }
  15495. }));
  15496. // CONCATENATED MODULE: ./es/progress/index.js
  15497. var progress_createNamespace = Object(create["a" /* createNamespace */])('progress'),
  15498. progress_createComponent = progress_createNamespace[0],
  15499. progress_bem = progress_createNamespace[1];
  15500. /* harmony default export */ var es_progress = (progress_createComponent({
  15501. mixins: [BindEventMixin(function (bind) {
  15502. bind(window, 'resize', this.resize, true);
  15503. bind(window, 'orientationchange', this.resize, true);
  15504. })],
  15505. props: {
  15506. color: String,
  15507. inactive: Boolean,
  15508. pivotText: String,
  15509. textColor: String,
  15510. pivotColor: String,
  15511. trackColor: String,
  15512. strokeWidth: [Number, String],
  15513. percentage: {
  15514. type: [Number, String],
  15515. required: true,
  15516. validator: function validator(value) {
  15517. return value >= 0 && value <= 100;
  15518. }
  15519. },
  15520. showPivot: {
  15521. type: Boolean,
  15522. default: true
  15523. }
  15524. },
  15525. data: function data() {
  15526. return {
  15527. pivotWidth: 0,
  15528. progressWidth: 0
  15529. };
  15530. },
  15531. mounted: function mounted() {
  15532. this.resize();
  15533. },
  15534. watch: {
  15535. showPivot: 'resize',
  15536. pivotText: 'resize'
  15537. },
  15538. methods: {
  15539. // @exposed-api
  15540. resize: function resize() {
  15541. var _this = this;
  15542. this.$nextTick(function () {
  15543. _this.progressWidth = _this.$el.offsetWidth;
  15544. _this.pivotWidth = _this.$refs.pivot ? _this.$refs.pivot.offsetWidth : 0;
  15545. });
  15546. }
  15547. },
  15548. render: function render() {
  15549. var h = arguments[0];
  15550. var pivotText = this.pivotText,
  15551. percentage = this.percentage;
  15552. var text = pivotText != null ? pivotText : percentage + '%';
  15553. var showPivot = this.showPivot && text;
  15554. var background = this.inactive ? '#cacaca' : this.color;
  15555. var pivotStyle = {
  15556. color: this.textColor,
  15557. left: (this.progressWidth - this.pivotWidth) * percentage / 100 + "px",
  15558. background: this.pivotColor || background
  15559. };
  15560. var portionStyle = {
  15561. background: background,
  15562. width: this.progressWidth * percentage / 100 + 'px'
  15563. };
  15564. var wrapperStyle = {
  15565. background: this.trackColor,
  15566. height: Object(unit["a" /* addUnit */])(this.strokeWidth)
  15567. };
  15568. return h("div", {
  15569. "class": progress_bem(),
  15570. "style": wrapperStyle
  15571. }, [h("span", {
  15572. "class": progress_bem('portion'),
  15573. "style": portionStyle
  15574. }, [showPivot && h("span", {
  15575. "ref": "pivot",
  15576. "style": pivotStyle,
  15577. "class": progress_bem('pivot')
  15578. }, [text])])]);
  15579. }
  15580. }));
  15581. // CONCATENATED MODULE: ./es/pull-refresh/index.js
  15582. // Utils
  15583. // Mixins
  15584. // Components
  15585. var pull_refresh_createNamespace = Object(create["a" /* createNamespace */])('pull-refresh'),
  15586. pull_refresh_createComponent = pull_refresh_createNamespace[0],
  15587. pull_refresh_bem = pull_refresh_createNamespace[1],
  15588. pull_refresh_t = pull_refresh_createNamespace[2];
  15589. var DEFAULT_HEAD_HEIGHT = 50;
  15590. var TEXT_STATUS = ['pulling', 'loosing', 'success'];
  15591. /* harmony default export */ var pull_refresh = (pull_refresh_createComponent({
  15592. mixins: [TouchMixin],
  15593. props: {
  15594. disabled: Boolean,
  15595. successText: String,
  15596. pullingText: String,
  15597. loosingText: String,
  15598. loadingText: String,
  15599. pullDistance: [Number, String],
  15600. value: {
  15601. type: Boolean,
  15602. required: true
  15603. },
  15604. successDuration: {
  15605. type: [Number, String],
  15606. default: 500
  15607. },
  15608. animationDuration: {
  15609. type: [Number, String],
  15610. default: 300
  15611. },
  15612. headHeight: {
  15613. type: [Number, String],
  15614. default: DEFAULT_HEAD_HEIGHT
  15615. }
  15616. },
  15617. data: function data() {
  15618. return {
  15619. status: 'normal',
  15620. distance: 0,
  15621. duration: 0
  15622. };
  15623. },
  15624. computed: {
  15625. touchable: function touchable() {
  15626. return this.status !== 'loading' && this.status !== 'success' && !this.disabled;
  15627. },
  15628. headStyle: function headStyle() {
  15629. if (this.headHeight !== DEFAULT_HEAD_HEIGHT) {
  15630. return {
  15631. height: this.headHeight + "px"
  15632. };
  15633. }
  15634. }
  15635. },
  15636. watch: {
  15637. value: function value(loading) {
  15638. this.duration = this.animationDuration;
  15639. if (loading) {
  15640. this.setStatus(+this.headHeight, true);
  15641. } else if (this.slots('success') || this.successText) {
  15642. this.showSuccessTip();
  15643. } else {
  15644. this.setStatus(0, false);
  15645. }
  15646. }
  15647. },
  15648. mounted: function mounted() {
  15649. this.bindTouchEvent(this.$refs.track);
  15650. this.scrollEl = getScroller(this.$el);
  15651. },
  15652. methods: {
  15653. checkPullStart: function checkPullStart(event) {
  15654. this.ceiling = getScrollTop(this.scrollEl) === 0;
  15655. if (this.ceiling) {
  15656. this.duration = 0;
  15657. this.touchStart(event);
  15658. }
  15659. },
  15660. onTouchStart: function onTouchStart(event) {
  15661. if (this.touchable) {
  15662. this.checkPullStart(event);
  15663. }
  15664. },
  15665. onTouchMove: function onTouchMove(event) {
  15666. if (!this.touchable) {
  15667. return;
  15668. }
  15669. if (!this.ceiling) {
  15670. this.checkPullStart(event);
  15671. }
  15672. this.touchMove(event);
  15673. if (this.ceiling && this.deltaY >= 0 && this.direction === 'vertical') {
  15674. preventDefault(event);
  15675. this.setStatus(this.ease(this.deltaY));
  15676. }
  15677. },
  15678. onTouchEnd: function onTouchEnd() {
  15679. var _this = this;
  15680. if (this.touchable && this.ceiling && this.deltaY) {
  15681. this.duration = this.animationDuration;
  15682. if (this.status === 'loosing') {
  15683. this.setStatus(+this.headHeight, true);
  15684. this.$emit('input', true); // ensure value change can be watched
  15685. this.$nextTick(function () {
  15686. _this.$emit('refresh');
  15687. });
  15688. } else {
  15689. this.setStatus(0);
  15690. }
  15691. }
  15692. },
  15693. ease: function ease(distance) {
  15694. var pullDistance = +(this.pullDistance || this.headHeight);
  15695. if (distance > pullDistance) {
  15696. if (distance < pullDistance * 2) {
  15697. distance = pullDistance + (distance - pullDistance) / 2;
  15698. } else {
  15699. distance = pullDistance * 1.5 + (distance - pullDistance * 2) / 4;
  15700. }
  15701. }
  15702. return Math.round(distance);
  15703. },
  15704. setStatus: function setStatus(distance, isLoading) {
  15705. var status;
  15706. if (isLoading) {
  15707. status = 'loading';
  15708. } else if (distance === 0) {
  15709. status = 'normal';
  15710. } else {
  15711. status = distance < (this.pullDistance || this.headHeight) ? 'pulling' : 'loosing';
  15712. }
  15713. this.distance = distance;
  15714. if (status !== this.status) {
  15715. this.status = status;
  15716. }
  15717. },
  15718. genStatus: function genStatus() {
  15719. var h = this.$createElement;
  15720. var status = this.status,
  15721. distance = this.distance;
  15722. var slot = this.slots(status, {
  15723. distance: distance
  15724. });
  15725. if (slot) {
  15726. return slot;
  15727. }
  15728. var nodes = [];
  15729. var text = this[status + "Text"] || pull_refresh_t(status);
  15730. if (TEXT_STATUS.indexOf(status) !== -1) {
  15731. nodes.push(h("div", {
  15732. "class": pull_refresh_bem('text')
  15733. }, [text]));
  15734. }
  15735. if (status === 'loading') {
  15736. nodes.push(h(es_loading, {
  15737. "attrs": {
  15738. "size": "16"
  15739. }
  15740. }, [text]));
  15741. }
  15742. return nodes;
  15743. },
  15744. showSuccessTip: function showSuccessTip() {
  15745. var _this2 = this;
  15746. this.status = 'success';
  15747. setTimeout(function () {
  15748. _this2.setStatus(0);
  15749. }, this.successDuration);
  15750. }
  15751. },
  15752. render: function render() {
  15753. var h = arguments[0];
  15754. var trackStyle = {
  15755. transitionDuration: this.duration + "ms",
  15756. transform: this.distance ? "translate3d(0," + this.distance + "px, 0)" : ''
  15757. };
  15758. return h("div", {
  15759. "class": pull_refresh_bem()
  15760. }, [h("div", {
  15761. "ref": "track",
  15762. "class": pull_refresh_bem('track'),
  15763. "style": trackStyle
  15764. }, [h("div", {
  15765. "class": pull_refresh_bem('head'),
  15766. "style": this.headStyle
  15767. }, [this.genStatus()]), this.slots()])]);
  15768. }
  15769. }));
  15770. // CONCATENATED MODULE: ./es/rate/index.js
  15771. // Utils
  15772. // Mixins
  15773. // Components
  15774. var rate_createNamespace = Object(create["a" /* createNamespace */])('rate'),
  15775. rate_createComponent = rate_createNamespace[0],
  15776. rate_bem = rate_createNamespace[1];
  15777. function getRateStatus(value, index, allowHalf) {
  15778. if (value >= index) {
  15779. return 'full';
  15780. }
  15781. if (value + 0.5 >= index && allowHalf) {
  15782. return 'half';
  15783. }
  15784. return 'void';
  15785. }
  15786. /* harmony default export */ var es_rate = (rate_createComponent({
  15787. mixins: [TouchMixin, FieldMixin],
  15788. props: {
  15789. size: [Number, String],
  15790. color: String,
  15791. gutter: [Number, String],
  15792. readonly: Boolean,
  15793. disabled: Boolean,
  15794. allowHalf: Boolean,
  15795. voidColor: String,
  15796. iconPrefix: String,
  15797. disabledColor: String,
  15798. value: {
  15799. type: Number,
  15800. default: 0
  15801. },
  15802. icon: {
  15803. type: String,
  15804. default: 'star'
  15805. },
  15806. voidIcon: {
  15807. type: String,
  15808. default: 'star-o'
  15809. },
  15810. count: {
  15811. type: [Number, String],
  15812. default: 5
  15813. },
  15814. touchable: {
  15815. type: Boolean,
  15816. default: true
  15817. }
  15818. },
  15819. computed: {
  15820. list: function list() {
  15821. var list = [];
  15822. for (var i = 1; i <= this.count; i++) {
  15823. list.push(getRateStatus(this.value, i, this.allowHalf));
  15824. }
  15825. return list;
  15826. },
  15827. sizeWithUnit: function sizeWithUnit() {
  15828. return Object(unit["a" /* addUnit */])(this.size);
  15829. },
  15830. gutterWithUnit: function gutterWithUnit() {
  15831. return Object(unit["a" /* addUnit */])(this.gutter);
  15832. }
  15833. },
  15834. mounted: function mounted() {
  15835. this.bindTouchEvent(this.$el);
  15836. },
  15837. methods: {
  15838. select: function select(index) {
  15839. if (!this.disabled && !this.readonly && index !== this.value) {
  15840. this.$emit('input', index);
  15841. this.$emit('change', index);
  15842. }
  15843. },
  15844. onTouchStart: function onTouchStart(event) {
  15845. var _this = this;
  15846. if (this.readonly || this.disabled || !this.touchable) {
  15847. return;
  15848. }
  15849. this.touchStart(event);
  15850. var rects = this.$refs.items.map(function (item) {
  15851. return item.getBoundingClientRect();
  15852. });
  15853. var ranges = [];
  15854. rects.forEach(function (rect, index) {
  15855. if (_this.allowHalf) {
  15856. ranges.push({
  15857. score: index + 0.5,
  15858. left: rect.left
  15859. }, {
  15860. score: index + 1,
  15861. left: rect.left + rect.width / 2
  15862. });
  15863. } else {
  15864. ranges.push({
  15865. score: index + 1,
  15866. left: rect.left
  15867. });
  15868. }
  15869. });
  15870. this.ranges = ranges;
  15871. },
  15872. onTouchMove: function onTouchMove(event) {
  15873. if (this.readonly || this.disabled || !this.touchable) {
  15874. return;
  15875. }
  15876. this.touchMove(event);
  15877. if (this.direction === 'horizontal') {
  15878. preventDefault(event);
  15879. var clientX = event.touches[0].clientX;
  15880. this.select(this.getScoreByPosition(clientX));
  15881. }
  15882. },
  15883. getScoreByPosition: function getScoreByPosition(x) {
  15884. for (var i = this.ranges.length - 1; i > 0; i--) {
  15885. if (x > this.ranges[i].left) {
  15886. return this.ranges[i].score;
  15887. }
  15888. }
  15889. return this.allowHalf ? 0.5 : 1;
  15890. },
  15891. genStar: function genStar(status, index) {
  15892. var _this2 = this;
  15893. var h = this.$createElement;
  15894. var icon = this.icon,
  15895. color = this.color,
  15896. count = this.count,
  15897. voidIcon = this.voidIcon,
  15898. disabled = this.disabled,
  15899. voidColor = this.voidColor,
  15900. disabledColor = this.disabledColor;
  15901. var score = index + 1;
  15902. var isFull = status === 'full';
  15903. var isVoid = status === 'void';
  15904. var style;
  15905. if (this.gutterWithUnit && score !== +count) {
  15906. style = {
  15907. paddingRight: this.gutterWithUnit
  15908. };
  15909. }
  15910. return h("div", {
  15911. "ref": "items",
  15912. "refInFor": true,
  15913. "key": index,
  15914. "attrs": {
  15915. "role": "radio",
  15916. "tabindex": "0",
  15917. "aria-setsize": count,
  15918. "aria-posinset": score,
  15919. "aria-checked": String(!isVoid)
  15920. },
  15921. "style": style,
  15922. "class": rate_bem('item')
  15923. }, [h(es_icon, {
  15924. "attrs": {
  15925. "size": this.sizeWithUnit,
  15926. "name": isFull ? icon : voidIcon,
  15927. "color": disabled ? disabledColor : isFull ? color : voidColor,
  15928. "classPrefix": this.iconPrefix,
  15929. "data-score": score
  15930. },
  15931. "class": rate_bem('icon', {
  15932. disabled: disabled,
  15933. full: isFull
  15934. }),
  15935. "on": {
  15936. "click": function click() {
  15937. _this2.select(score);
  15938. }
  15939. }
  15940. }), this.allowHalf && h(es_icon, {
  15941. "attrs": {
  15942. "size": this.sizeWithUnit,
  15943. "name": isVoid ? voidIcon : icon,
  15944. "color": disabled ? disabledColor : isVoid ? voidColor : color,
  15945. "classPrefix": this.iconPrefix,
  15946. "data-score": score - 0.5
  15947. },
  15948. "class": rate_bem('icon', ['half', {
  15949. disabled: disabled,
  15950. full: !isVoid
  15951. }]),
  15952. "on": {
  15953. "click": function click() {
  15954. _this2.select(score - 0.5);
  15955. }
  15956. }
  15957. })]);
  15958. }
  15959. },
  15960. render: function render() {
  15961. var _this3 = this;
  15962. var h = arguments[0];
  15963. return h("div", {
  15964. "class": rate_bem({
  15965. readonly: this.readonly,
  15966. disabled: this.disabled
  15967. }),
  15968. "attrs": {
  15969. "tabindex": "0",
  15970. "role": "radiogroup"
  15971. }
  15972. }, [this.list.map(function (status, index) {
  15973. return _this3.genStar(status, index);
  15974. })]);
  15975. }
  15976. }));
  15977. // CONCATENATED MODULE: ./es/row/index.js
  15978. var row_createNamespace = Object(create["a" /* createNamespace */])('row'),
  15979. row_createComponent = row_createNamespace[0],
  15980. row_bem = row_createNamespace[1];
  15981. /* harmony default export */ var row = (row_createComponent({
  15982. mixins: [ParentMixin('vanRow')],
  15983. props: {
  15984. type: String,
  15985. align: String,
  15986. justify: String,
  15987. tag: {
  15988. type: String,
  15989. default: 'div'
  15990. },
  15991. gutter: {
  15992. type: [Number, String],
  15993. default: 0
  15994. }
  15995. },
  15996. computed: {
  15997. spaces: function spaces() {
  15998. var gutter = Number(this.gutter);
  15999. if (!gutter) {
  16000. return;
  16001. }
  16002. var spaces = [];
  16003. var groups = [[]];
  16004. var totalSpan = 0;
  16005. this.children.forEach(function (item, index) {
  16006. totalSpan += Number(item.span);
  16007. if (totalSpan > 24) {
  16008. groups.push([index]);
  16009. totalSpan -= 24;
  16010. } else {
  16011. groups[groups.length - 1].push(index);
  16012. }
  16013. });
  16014. groups.forEach(function (group) {
  16015. var averagePadding = gutter * (group.length - 1) / group.length;
  16016. group.forEach(function (item, index) {
  16017. if (index === 0) {
  16018. spaces.push({
  16019. right: averagePadding
  16020. });
  16021. } else {
  16022. var left = gutter - spaces[item - 1].right;
  16023. var right = averagePadding - left;
  16024. spaces.push({
  16025. left: left,
  16026. right: right
  16027. });
  16028. }
  16029. });
  16030. });
  16031. return spaces;
  16032. }
  16033. },
  16034. methods: {
  16035. onClick: function onClick(event) {
  16036. this.$emit('click', event);
  16037. }
  16038. },
  16039. render: function render() {
  16040. var _bem;
  16041. var h = arguments[0];
  16042. var align = this.align,
  16043. justify = this.justify;
  16044. var flex = this.type === 'flex';
  16045. return h(this.tag, {
  16046. "class": row_bem((_bem = {
  16047. flex: flex
  16048. }, _bem["align-" + align] = flex && align, _bem["justify-" + justify] = flex && justify, _bem)),
  16049. "on": {
  16050. "click": this.onClick
  16051. }
  16052. }, [this.slots()]);
  16053. }
  16054. }));
  16055. // CONCATENATED MODULE: ./es/search/index.js
  16056. // Utils
  16057. // Components
  16058. // Types
  16059. var search_createNamespace = Object(create["a" /* createNamespace */])('search'),
  16060. search_createComponent = search_createNamespace[0],
  16061. search_bem = search_createNamespace[1],
  16062. search_t = search_createNamespace[2];
  16063. function Search(h, props, slots, ctx) {
  16064. function Label() {
  16065. if (slots.label || props.label) {
  16066. return h("div", {
  16067. "class": search_bem('label')
  16068. }, [slots.label ? slots.label() : props.label]);
  16069. }
  16070. }
  16071. function Action() {
  16072. if (!props.showAction) {
  16073. return;
  16074. }
  16075. function onCancel() {
  16076. if (slots.action) {
  16077. return;
  16078. }
  16079. functional_emit(ctx, 'input', '');
  16080. functional_emit(ctx, 'cancel');
  16081. }
  16082. return h("div", {
  16083. "class": search_bem('action'),
  16084. "attrs": {
  16085. "role": "button",
  16086. "tabindex": "0"
  16087. },
  16088. "on": {
  16089. "click": onCancel
  16090. }
  16091. }, [slots.action ? slots.action() : props.actionText || search_t('cancel')]);
  16092. }
  16093. var fieldData = {
  16094. attrs: ctx.data.attrs,
  16095. on: _extends({}, ctx.listeners, {
  16096. keypress: function keypress(event) {
  16097. // press enter
  16098. if (event.keyCode === 13) {
  16099. preventDefault(event);
  16100. functional_emit(ctx, 'search', props.value);
  16101. }
  16102. functional_emit(ctx, 'keypress', event);
  16103. }
  16104. })
  16105. };
  16106. var inheritData = inherit(ctx);
  16107. inheritData.attrs = undefined;
  16108. return h("div", helper_default()([{
  16109. "class": search_bem({
  16110. 'show-action': props.showAction
  16111. }),
  16112. "style": {
  16113. background: props.background
  16114. }
  16115. }, inheritData]), [slots.left == null ? void 0 : slots.left(), h("div", {
  16116. "class": search_bem('content', props.shape)
  16117. }, [Label(), h(es_field, helper_default()([{
  16118. "attrs": {
  16119. "type": "search",
  16120. "border": false,
  16121. "value": props.value,
  16122. "leftIcon": props.leftIcon,
  16123. "rightIcon": props.rightIcon,
  16124. "clearable": props.clearable,
  16125. "clearTrigger": props.clearTrigger
  16126. },
  16127. "scopedSlots": {
  16128. 'left-icon': slots['left-icon'],
  16129. 'right-icon': slots['right-icon']
  16130. }
  16131. }, fieldData]))]), Action()]);
  16132. }
  16133. Search.props = {
  16134. value: String,
  16135. label: String,
  16136. rightIcon: String,
  16137. actionText: String,
  16138. background: String,
  16139. showAction: Boolean,
  16140. clearTrigger: String,
  16141. shape: {
  16142. type: String,
  16143. default: 'square'
  16144. },
  16145. clearable: {
  16146. type: Boolean,
  16147. default: true
  16148. },
  16149. leftIcon: {
  16150. type: String,
  16151. default: 'search'
  16152. }
  16153. };
  16154. /* harmony default export */ var search = (search_createComponent(Search));
  16155. // CONCATENATED MODULE: ./es/share-sheet/index.js
  16156. // Utils
  16157. // Mixins
  16158. // Components
  16159. var PRESET_ICONS = ['qq', 'link', 'weibo', 'wechat', 'poster', 'qrcode', 'weapp-qrcode', 'wechat-moments'];
  16160. var share_sheet_createNamespace = Object(create["a" /* createNamespace */])('share-sheet'),
  16161. share_sheet_createComponent = share_sheet_createNamespace[0],
  16162. share_sheet_bem = share_sheet_createNamespace[1],
  16163. share_sheet_t = share_sheet_createNamespace[2];
  16164. /* harmony default export */ var share_sheet = (share_sheet_createComponent({
  16165. props: _extends({}, popupMixinProps, {
  16166. title: String,
  16167. duration: String,
  16168. cancelText: String,
  16169. description: String,
  16170. getContainer: [String, Function],
  16171. options: {
  16172. type: Array,
  16173. default: function _default() {
  16174. return [];
  16175. }
  16176. },
  16177. overlay: {
  16178. type: Boolean,
  16179. default: true
  16180. },
  16181. closeOnPopstate: {
  16182. type: Boolean,
  16183. default: true
  16184. },
  16185. safeAreaInsetBottom: {
  16186. type: Boolean,
  16187. default: true
  16188. },
  16189. closeOnClickOverlay: {
  16190. type: Boolean,
  16191. default: true
  16192. }
  16193. }),
  16194. methods: {
  16195. onCancel: function onCancel() {
  16196. this.toggle(false);
  16197. this.$emit('cancel');
  16198. },
  16199. onSelect: function onSelect(option, index) {
  16200. this.$emit('select', option, index);
  16201. },
  16202. toggle: function toggle(val) {
  16203. this.$emit('input', val);
  16204. },
  16205. getIconURL: function getIconURL(icon) {
  16206. if (PRESET_ICONS.indexOf(icon) !== -1) {
  16207. return "https://img01.yzcdn.cn/vant/share-sheet-" + icon + ".png";
  16208. }
  16209. return icon;
  16210. },
  16211. genHeader: function genHeader() {
  16212. var h = this.$createElement;
  16213. var title = this.slots('title') || this.title;
  16214. var description = this.slots('description') || this.description;
  16215. if (!title && !description) {
  16216. return;
  16217. }
  16218. return h("div", {
  16219. "class": share_sheet_bem('header')
  16220. }, [title && h("h2", {
  16221. "class": share_sheet_bem('title')
  16222. }, [title]), description && h("span", {
  16223. "class": share_sheet_bem('description')
  16224. }, [description])]);
  16225. },
  16226. genOptions: function genOptions(options, showBorder) {
  16227. var _this = this;
  16228. var h = this.$createElement;
  16229. return h("div", {
  16230. "class": share_sheet_bem('options', {
  16231. border: showBorder
  16232. })
  16233. }, [options.map(function (option, index) {
  16234. return h("div", {
  16235. "attrs": {
  16236. "role": "button",
  16237. "tabindex": "0"
  16238. },
  16239. "class": [share_sheet_bem('option'), option.className],
  16240. "on": {
  16241. "click": function click() {
  16242. _this.onSelect(option, index);
  16243. }
  16244. }
  16245. }, [h("img", {
  16246. "attrs": {
  16247. "src": _this.getIconURL(option.icon)
  16248. },
  16249. "class": share_sheet_bem('icon')
  16250. }), option.name && h("span", {
  16251. "class": share_sheet_bem('name')
  16252. }, [option.name]), option.description && h("span", {
  16253. "class": share_sheet_bem('option-description')
  16254. }, [option.description])]);
  16255. })]);
  16256. },
  16257. genRows: function genRows() {
  16258. var _this2 = this;
  16259. var options = this.options;
  16260. if (Array.isArray(options[0])) {
  16261. return options.map(function (item, index) {
  16262. return _this2.genOptions(item, index !== 0);
  16263. });
  16264. }
  16265. return this.genOptions(options);
  16266. },
  16267. genCancelText: function genCancelText() {
  16268. var _this$cancelText;
  16269. var h = this.$createElement;
  16270. var cancelText = (_this$cancelText = this.cancelText) != null ? _this$cancelText : share_sheet_t('cancel');
  16271. if (cancelText) {
  16272. return h("button", {
  16273. "attrs": {
  16274. "type": "button"
  16275. },
  16276. "class": share_sheet_bem('cancel'),
  16277. "on": {
  16278. "click": this.onCancel
  16279. }
  16280. }, [cancelText]);
  16281. }
  16282. },
  16283. onClickOverlay: function onClickOverlay() {
  16284. this.$emit('click-overlay');
  16285. }
  16286. },
  16287. render: function render() {
  16288. var h = arguments[0];
  16289. return h(popup, {
  16290. "attrs": {
  16291. "round": true,
  16292. "value": this.value,
  16293. "position": "bottom",
  16294. "overlay": this.overlay,
  16295. "duration": this.duration,
  16296. "lazyRender": this.lazyRender,
  16297. "lockScroll": this.lockScroll,
  16298. "getContainer": this.getContainer,
  16299. "closeOnPopstate": this.closeOnPopstate,
  16300. "closeOnClickOverlay": this.closeOnClickOverlay,
  16301. "safeAreaInsetBottom": this.safeAreaInsetBottom
  16302. },
  16303. "class": share_sheet_bem(),
  16304. "on": {
  16305. "input": this.toggle,
  16306. "click-overlay": this.onClickOverlay
  16307. }
  16308. }, [this.genHeader(), this.genRows(), this.genCancelText()]);
  16309. }
  16310. }));
  16311. // CONCATENATED MODULE: ./es/sidebar/index.js
  16312. var sidebar_createNamespace = Object(create["a" /* createNamespace */])('sidebar'),
  16313. sidebar_createComponent = sidebar_createNamespace[0],
  16314. sidebar_bem = sidebar_createNamespace[1];
  16315. /* harmony default export */ var sidebar = (sidebar_createComponent({
  16316. mixins: [ParentMixin('vanSidebar')],
  16317. model: {
  16318. prop: 'activeKey'
  16319. },
  16320. props: {
  16321. activeKey: {
  16322. type: [Number, String],
  16323. default: 0
  16324. }
  16325. },
  16326. data: function data() {
  16327. return {
  16328. index: +this.activeKey
  16329. };
  16330. },
  16331. watch: {
  16332. activeKey: function activeKey() {
  16333. this.setIndex(+this.activeKey);
  16334. }
  16335. },
  16336. methods: {
  16337. setIndex: function setIndex(index) {
  16338. if (index !== this.index) {
  16339. this.index = index;
  16340. this.$emit('change', index);
  16341. }
  16342. }
  16343. },
  16344. render: function render() {
  16345. var h = arguments[0];
  16346. return h("div", {
  16347. "class": sidebar_bem()
  16348. }, [this.slots()]);
  16349. }
  16350. }));
  16351. // CONCATENATED MODULE: ./es/sidebar-item/index.js
  16352. var sidebar_item_createNamespace = Object(create["a" /* createNamespace */])('sidebar-item'),
  16353. sidebar_item_createComponent = sidebar_item_createNamespace[0],
  16354. sidebar_item_bem = sidebar_item_createNamespace[1];
  16355. /* harmony default export */ var sidebar_item = (sidebar_item_createComponent({
  16356. mixins: [ChildrenMixin('vanSidebar')],
  16357. props: _extends({}, routeProps, {
  16358. dot: Boolean,
  16359. // @deprecated
  16360. info: [Number, String],
  16361. badge: [Number, String],
  16362. title: String,
  16363. disabled: Boolean
  16364. }),
  16365. computed: {
  16366. select: function select() {
  16367. return this.index === +this.parent.activeKey;
  16368. }
  16369. },
  16370. methods: {
  16371. onClick: function onClick() {
  16372. if (this.disabled) {
  16373. return;
  16374. }
  16375. this.$emit('click', this.index);
  16376. this.parent.$emit('input', this.index);
  16377. this.parent.setIndex(this.index);
  16378. route(this.$router, this);
  16379. }
  16380. },
  16381. render: function render() {
  16382. var _this$slots, _this$badge;
  16383. var h = arguments[0];
  16384. if (false) {}
  16385. return h("a", {
  16386. "class": sidebar_item_bem({
  16387. select: this.select,
  16388. disabled: this.disabled
  16389. }),
  16390. "on": {
  16391. "click": this.onClick
  16392. }
  16393. }, [h("div", {
  16394. "class": sidebar_item_bem('text')
  16395. }, [(_this$slots = this.slots('title')) != null ? _this$slots : this.title, h(es_info, {
  16396. "attrs": {
  16397. "dot": this.dot,
  16398. "info": (_this$badge = this.badge) != null ? _this$badge : this.info
  16399. },
  16400. "class": sidebar_item_bem('info')
  16401. })])]);
  16402. }
  16403. }));
  16404. // CONCATENATED MODULE: ./es/skeleton/index.js
  16405. // Utils
  16406. // Types
  16407. var skeleton_createNamespace = Object(create["a" /* createNamespace */])('skeleton'),
  16408. skeleton_createComponent = skeleton_createNamespace[0],
  16409. skeleton_bem = skeleton_createNamespace[1];
  16410. var DEFAULT_ROW_WIDTH = '100%';
  16411. var DEFAULT_LAST_ROW_WIDTH = '60%';
  16412. function Skeleton(h, props, slots, ctx) {
  16413. if (!props.loading) {
  16414. return slots.default && slots.default();
  16415. }
  16416. function Title() {
  16417. if (props.title) {
  16418. return h("h3", {
  16419. "class": skeleton_bem('title'),
  16420. "style": {
  16421. width: Object(unit["a" /* addUnit */])(props.titleWidth)
  16422. }
  16423. });
  16424. }
  16425. }
  16426. function Rows() {
  16427. var Rows = [];
  16428. var rowWidth = props.rowWidth;
  16429. function getRowWidth(index) {
  16430. if (rowWidth === DEFAULT_ROW_WIDTH && index === +props.row - 1) {
  16431. return DEFAULT_LAST_ROW_WIDTH;
  16432. }
  16433. if (Array.isArray(rowWidth)) {
  16434. return rowWidth[index];
  16435. }
  16436. return rowWidth;
  16437. }
  16438. for (var i = 0; i < props.row; i++) {
  16439. Rows.push(h("div", {
  16440. "class": skeleton_bem('row'),
  16441. "style": {
  16442. width: Object(unit["a" /* addUnit */])(getRowWidth(i))
  16443. }
  16444. }));
  16445. }
  16446. return Rows;
  16447. }
  16448. function Avatar() {
  16449. if (props.avatar) {
  16450. var size = Object(unit["a" /* addUnit */])(props.avatarSize);
  16451. return h("div", {
  16452. "class": skeleton_bem('avatar', props.avatarShape),
  16453. "style": {
  16454. width: size,
  16455. height: size
  16456. }
  16457. });
  16458. }
  16459. }
  16460. return h("div", helper_default()([{
  16461. "class": skeleton_bem({
  16462. animate: props.animate,
  16463. round: props.round
  16464. })
  16465. }, inherit(ctx)]), [Avatar(), h("div", {
  16466. "class": skeleton_bem('content')
  16467. }, [Title(), Rows()])]);
  16468. }
  16469. Skeleton.props = {
  16470. title: Boolean,
  16471. round: Boolean,
  16472. avatar: Boolean,
  16473. titleWidth: [Number, String],
  16474. avatarSize: [Number, String],
  16475. row: {
  16476. type: [Number, String],
  16477. default: 0
  16478. },
  16479. loading: {
  16480. type: Boolean,
  16481. default: true
  16482. },
  16483. animate: {
  16484. type: Boolean,
  16485. default: true
  16486. },
  16487. avatarShape: {
  16488. type: String,
  16489. default: 'round'
  16490. },
  16491. rowWidth: {
  16492. type: [Number, String, Array],
  16493. default: DEFAULT_ROW_WIDTH
  16494. }
  16495. };
  16496. /* harmony default export */ var skeleton = (skeleton_createComponent(Skeleton));
  16497. // CONCATENATED MODULE: ./es/sku/lang.js
  16498. /**
  16499. * Sku only provide zh-CN lang by default
  16500. */
  16501. /* harmony default export */ var lang = ({
  16502. 'zh-CN': {
  16503. vanSku: {
  16504. select: '请选择',
  16505. selected: '已选',
  16506. selectSku: '请先选择商品规格',
  16507. soldout: '库存不足',
  16508. originPrice: '原价',
  16509. minusTip: '至少选择一件',
  16510. minusStartTip: function minusStartTip(start) {
  16511. return start + "\u4EF6\u8D77\u552E";
  16512. },
  16513. unavailable: '商品已经无法购买啦',
  16514. stock: '剩余',
  16515. stockUnit: '件',
  16516. quotaTip: function quotaTip(quota) {
  16517. return "\u6BCF\u4EBA\u9650\u8D2D" + quota + "\u4EF6";
  16518. },
  16519. quotaUsedTip: function quotaUsedTip(quota, count) {
  16520. return "\u6BCF\u4EBA\u9650\u8D2D" + quota + "\u4EF6\uFF0C\u4F60\u5DF2\u8D2D\u4E70" + count + "\u4EF6";
  16521. }
  16522. },
  16523. vanSkuActions: {
  16524. buy: '立即购买',
  16525. addCart: '加入购物车'
  16526. },
  16527. vanSkuImgUploader: {
  16528. oversize: function oversize(maxSize) {
  16529. return "\u6700\u5927\u53EF\u4E0A\u4F20\u56FE\u7247\u4E3A" + maxSize + "MB\uFF0C\u8BF7\u5C1D\u8BD5\u538B\u7F29\u56FE\u7247\u5C3A\u5BF8";
  16530. },
  16531. fail: '上传失败',
  16532. uploading: '上传中...'
  16533. },
  16534. vanSkuStepper: {
  16535. quotaLimit: function quotaLimit(quota) {
  16536. return "\u9650\u8D2D" + quota + "\u4EF6";
  16537. },
  16538. quotaStart: function quotaStart(start) {
  16539. return start + "\u4EF6\u8D77\u552E";
  16540. },
  16541. comma: ',',
  16542. num: '购买数量'
  16543. },
  16544. vanSkuMessages: {
  16545. fill: '请填写',
  16546. upload: '请上传',
  16547. imageLabel: '仅限一张',
  16548. invalid: {
  16549. tel: '请填写正确的数字格式留言',
  16550. mobile: '手机号长度为6-20位数字',
  16551. email: '请填写正确的邮箱',
  16552. id_no: '请填写正确的身份证号码'
  16553. },
  16554. placeholder: {
  16555. id_no: '请填写身份证号',
  16556. text: '请填写留言',
  16557. tel: '请填写数字',
  16558. email: '请填写邮箱',
  16559. date: '请选择日期',
  16560. time: '请选择时间',
  16561. textarea: '请填写留言',
  16562. mobile: '请填写手机号'
  16563. }
  16564. },
  16565. vanSkuRow: {
  16566. multiple: '可多选'
  16567. },
  16568. vanSkuDatetimeField: {
  16569. title: {
  16570. date: '选择年月日',
  16571. time: '选择时间',
  16572. datetime: '选择日期时间'
  16573. },
  16574. format: {
  16575. year: '年',
  16576. month: '月',
  16577. day: '日',
  16578. hour: '时',
  16579. minute: '分'
  16580. }
  16581. }
  16582. }
  16583. });
  16584. // CONCATENATED MODULE: ./es/sku/constants.js
  16585. var LIMIT_TYPE = {
  16586. QUOTA_LIMIT: 0,
  16587. STOCK_LIMIT: 1
  16588. };
  16589. var UNSELECTED_SKU_VALUE_ID = '';
  16590. /* harmony default export */ var constants = ({
  16591. LIMIT_TYPE: LIMIT_TYPE,
  16592. UNSELECTED_SKU_VALUE_ID: UNSELECTED_SKU_VALUE_ID
  16593. });
  16594. // CONCATENATED MODULE: ./es/sku/utils/sku-helper.js
  16595. /*
  16596. normalize sku tree
  16597. [
  16598. {
  16599. count: 2,
  16600. k: "品种", // 规格名称 skuKeyName
  16601. k_id: "1200", // skuKeyId
  16602. k_s: "s1" // skuKeyStr
  16603. v: [ // skuValues
  16604. { // skuValue
  16605. id: "1201", // skuValueId
  16606. name: "萌" // 具体的规格值 skuValueName
  16607. }, {
  16608. id: "973",
  16609. name: "帅"
  16610. }
  16611. ]
  16612. },
  16613. ...
  16614. ]
  16615. |
  16616. v
  16617. {
  16618. s1: [{
  16619. id: "1201",
  16620. name: "萌"
  16621. }, {
  16622. id: "973",
  16623. name: "帅"
  16624. }],
  16625. ...
  16626. }
  16627. */
  16628. var normalizeSkuTree = function normalizeSkuTree(skuTree) {
  16629. var normalizedTree = {};
  16630. skuTree.forEach(function (treeItem) {
  16631. normalizedTree[treeItem.k_s] = treeItem.v;
  16632. });
  16633. return normalizedTree;
  16634. };
  16635. var normalizePropList = function normalizePropList(propList) {
  16636. var normalizedProp = {};
  16637. propList.forEach(function (item) {
  16638. var itemObj = {};
  16639. item.v.forEach(function (it) {
  16640. itemObj[it.id] = it;
  16641. });
  16642. normalizedProp[item.k_id] = itemObj;
  16643. });
  16644. return normalizedProp;
  16645. }; // 判断是否所有的sku都已经选中
  16646. var sku_helper_isAllSelected = function isAllSelected(skuTree, selectedSku) {
  16647. // 筛选selectedSku对象中key值不为空的值
  16648. var selected = Object.keys(selectedSku).filter(function (skuKeyStr) {
  16649. return selectedSku[skuKeyStr] !== UNSELECTED_SKU_VALUE_ID;
  16650. });
  16651. return skuTree.length === selected.length;
  16652. }; // 根据已选择的 sku 获取 skuComb
  16653. var getSkuComb = function getSkuComb(skuList, selectedSku) {
  16654. var skuComb = skuList.filter(function (item) {
  16655. return Object.keys(selectedSku).every(function (skuKeyStr) {
  16656. return String(item[skuKeyStr]) === String(selectedSku[skuKeyStr]);
  16657. });
  16658. });
  16659. return skuComb[0];
  16660. }; // 获取已选择的sku名称
  16661. var sku_helper_getSelectedSkuValues = function getSelectedSkuValues(skuTree, selectedSku) {
  16662. var normalizedTree = normalizeSkuTree(skuTree);
  16663. return Object.keys(selectedSku).reduce(function (selectedValues, skuKeyStr) {
  16664. var skuValues = normalizedTree[skuKeyStr] || [];
  16665. var skuValueId = selectedSku[skuKeyStr];
  16666. if (skuValueId !== UNSELECTED_SKU_VALUE_ID && skuValues.length > 0) {
  16667. var skuValue = skuValues.filter(function (value) {
  16668. return value.id === skuValueId;
  16669. })[0];
  16670. skuValue && selectedValues.push(skuValue);
  16671. }
  16672. return selectedValues;
  16673. }, []);
  16674. }; // 判断sku是否可选
  16675. var sku_helper_isSkuChoosable = function isSkuChoosable(skuList, selectedSku, skuToChoose) {
  16676. var _extends2;
  16677. var key = skuToChoose.key,
  16678. valueId = skuToChoose.valueId; // 先假设sku已选中,拼入已选中sku对象中
  16679. var matchedSku = _extends({}, selectedSku, (_extends2 = {}, _extends2[key] = valueId, _extends2)); // 再判断剩余sku是否全部不可选,若不可选则当前sku不可选中
  16680. var skusToCheck = Object.keys(matchedSku).filter(function (skuKey) {
  16681. return matchedSku[skuKey] !== UNSELECTED_SKU_VALUE_ID;
  16682. });
  16683. var filteredSku = skuList.filter(function (sku) {
  16684. return skusToCheck.every(function (skuKey) {
  16685. return String(matchedSku[skuKey]) === String(sku[skuKey]);
  16686. });
  16687. });
  16688. var stock = filteredSku.reduce(function (total, sku) {
  16689. total += sku.stock_num;
  16690. return total;
  16691. }, 0);
  16692. return stock > 0;
  16693. };
  16694. var sku_helper_getSelectedPropValues = function getSelectedPropValues(propList, selectedProp) {
  16695. var normalizeProp = normalizePropList(propList);
  16696. return Object.keys(selectedProp).reduce(function (acc, cur) {
  16697. selectedProp[cur].forEach(function (it) {
  16698. acc.push(_extends({}, normalizeProp[cur][it]));
  16699. });
  16700. return acc;
  16701. }, []);
  16702. };
  16703. var sku_helper_getSelectedProperties = function getSelectedProperties(propList, selectedProp) {
  16704. var list = [];
  16705. (propList || []).forEach(function (prop) {
  16706. if (selectedProp[prop.k_id] && selectedProp[prop.k_id].length > 0) {
  16707. var v = [];
  16708. prop.v.forEach(function (it) {
  16709. if (selectedProp[prop.k_id].indexOf(it.id) > -1) {
  16710. v.push(_extends({}, it));
  16711. }
  16712. });
  16713. list.push(_extends({}, prop, {
  16714. v: v
  16715. }));
  16716. }
  16717. });
  16718. return list;
  16719. };
  16720. /* harmony default export */ var sku_helper = ({
  16721. normalizeSkuTree: normalizeSkuTree,
  16722. getSkuComb: getSkuComb,
  16723. getSelectedSkuValues: sku_helper_getSelectedSkuValues,
  16724. isAllSelected: sku_helper_isAllSelected,
  16725. isSkuChoosable: sku_helper_isSkuChoosable,
  16726. getSelectedPropValues: sku_helper_getSelectedPropValues,
  16727. getSelectedProperties: sku_helper_getSelectedProperties
  16728. });
  16729. // CONCATENATED MODULE: ./es/sku/components/SkuHeader.js
  16730. // Utils
  16731. // Components
  16732. // Types
  16733. var SkuHeader_createNamespace = Object(create["a" /* createNamespace */])('sku-header'),
  16734. SkuHeader_createComponent = SkuHeader_createNamespace[0],
  16735. SkuHeader_bem = SkuHeader_createNamespace[1];
  16736. function getSkuImgValue(sku, selectedSku) {
  16737. var imgValue;
  16738. sku.tree.some(function (item) {
  16739. var id = selectedSku[item.k_s];
  16740. if (id && item.v) {
  16741. var matchedSku = item.v.filter(function (skuValue) {
  16742. return skuValue.id === id;
  16743. })[0] || {};
  16744. var img = matchedSku.previewImgUrl || matchedSku.imgUrl || matchedSku.img_url;
  16745. if (img) {
  16746. imgValue = _extends({}, matchedSku, {
  16747. ks: item.k_s,
  16748. imgUrl: img
  16749. });
  16750. return true;
  16751. }
  16752. }
  16753. return false;
  16754. });
  16755. return imgValue;
  16756. }
  16757. function SkuHeader(h, props, slots, ctx) {
  16758. var _slots$skuHeaderIma;
  16759. var sku = props.sku,
  16760. goods = props.goods,
  16761. skuEventBus = props.skuEventBus,
  16762. selectedSku = props.selectedSku,
  16763. _props$showHeaderImag = props.showHeaderImage,
  16764. showHeaderImage = _props$showHeaderImag === void 0 ? true : _props$showHeaderImag;
  16765. var selectedValue = getSkuImgValue(sku, selectedSku);
  16766. var imgUrl = selectedValue ? selectedValue.imgUrl : goods.picture;
  16767. var previewImage = function previewImage() {
  16768. skuEventBus.$emit('sku:previewImage', selectedValue);
  16769. };
  16770. return h("div", helper_default()([{
  16771. "class": [SkuHeader_bem(), BORDER_BOTTOM]
  16772. }, inherit(ctx)]), [showHeaderImage && h(es_image, {
  16773. "attrs": {
  16774. "fit": "cover",
  16775. "src": imgUrl
  16776. },
  16777. "class": SkuHeader_bem('img-wrap'),
  16778. "on": {
  16779. "click": previewImage
  16780. }
  16781. }, [(_slots$skuHeaderIma = slots['sku-header-image-extra']) == null ? void 0 : _slots$skuHeaderIma.call(slots)]), h("div", {
  16782. "class": SkuHeader_bem('goods-info')
  16783. }, [slots.default == null ? void 0 : slots.default()])]);
  16784. }
  16785. SkuHeader.props = {
  16786. sku: Object,
  16787. goods: Object,
  16788. skuEventBus: Object,
  16789. selectedSku: Object,
  16790. showHeaderImage: Boolean
  16791. };
  16792. /* harmony default export */ var components_SkuHeader = (SkuHeader_createComponent(SkuHeader));
  16793. // CONCATENATED MODULE: ./es/sku/components/SkuHeaderItem.js
  16794. // Utils
  16795. // Types
  16796. var SkuHeaderItem_createNamespace = Object(create["a" /* createNamespace */])('sku-header-item'),
  16797. SkuHeaderItem_createComponent = SkuHeaderItem_createNamespace[0],
  16798. SkuHeaderItem_bem = SkuHeaderItem_createNamespace[1];
  16799. function SkuHeaderItem_SkuHeader(h, props, slots, ctx) {
  16800. return h("div", helper_default()([{
  16801. "class": SkuHeaderItem_bem()
  16802. }, inherit(ctx)]), [slots.default && slots.default()]);
  16803. }
  16804. /* harmony default export */ var SkuHeaderItem = (SkuHeaderItem_createComponent(SkuHeaderItem_SkuHeader));
  16805. // CONCATENATED MODULE: ./es/sku/components/SkuRow.js
  16806. // Utils
  16807. // Mixins
  16808. var SkuRow_createNamespace = Object(create["a" /* createNamespace */])('sku-row'),
  16809. SkuRow_createComponent = SkuRow_createNamespace[0],
  16810. SkuRow_bem = SkuRow_createNamespace[1],
  16811. SkuRow_t = SkuRow_createNamespace[2];
  16812. /* harmony default export */ var SkuRow = (SkuRow_createComponent({
  16813. mixins: [ParentMixin('vanSkuRows'), BindEventMixin(function (bind) {
  16814. if (this.scrollable && this.$refs.scroller) {
  16815. bind(this.$refs.scroller, 'scroll', this.onScroll);
  16816. }
  16817. })],
  16818. props: {
  16819. skuRow: Object
  16820. },
  16821. data: function data() {
  16822. return {
  16823. progress: 0
  16824. };
  16825. },
  16826. computed: {
  16827. scrollable: function scrollable() {
  16828. return this.skuRow.largeImageMode && this.skuRow.v.length > 6;
  16829. }
  16830. },
  16831. methods: {
  16832. onScroll: function onScroll() {
  16833. var _this$$refs = this.$refs,
  16834. scroller = _this$$refs.scroller,
  16835. row = _this$$refs.row;
  16836. var distance = row.offsetWidth - scroller.offsetWidth;
  16837. this.progress = scroller.scrollLeft / distance;
  16838. },
  16839. genTitle: function genTitle() {
  16840. var h = this.$createElement;
  16841. return h("div", {
  16842. "class": SkuRow_bem('title')
  16843. }, [this.skuRow.k, this.skuRow.is_multiple && h("span", {
  16844. "class": SkuRow_bem('title-multiple')
  16845. }, ["\uFF08", SkuRow_t('multiple'), "\uFF09"])]);
  16846. },
  16847. genIndicator: function genIndicator() {
  16848. var h = this.$createElement;
  16849. if (this.scrollable) {
  16850. var style = {
  16851. transform: "translate3d(" + this.progress * 20 + "px, 0, 0)"
  16852. };
  16853. return h("div", {
  16854. "class": SkuRow_bem('indicator-wrapper')
  16855. }, [h("div", {
  16856. "class": SkuRow_bem('indicator')
  16857. }, [h("div", {
  16858. "class": SkuRow_bem('indicator-slider'),
  16859. "style": style
  16860. })])]);
  16861. }
  16862. },
  16863. genContent: function genContent() {
  16864. var h = this.$createElement;
  16865. var nodes = this.slots();
  16866. if (this.skuRow.largeImageMode) {
  16867. var top = [];
  16868. var bottom = [];
  16869. nodes.forEach(function (node, index) {
  16870. var group = Math.floor(index / 3) % 2 === 0 ? top : bottom;
  16871. group.push(node);
  16872. });
  16873. return h("div", {
  16874. "class": SkuRow_bem('scroller'),
  16875. "ref": "scroller"
  16876. }, [h("div", {
  16877. "class": SkuRow_bem('row'),
  16878. "ref": "row"
  16879. }, [top]), bottom.length ? h("div", {
  16880. "class": SkuRow_bem('row')
  16881. }, [bottom]) : null]);
  16882. }
  16883. return nodes;
  16884. },
  16885. centerItem: function centerItem(selectSkuId) {
  16886. if (!this.skuRow.largeImageMode || !selectSkuId) {
  16887. return;
  16888. }
  16889. var _this$children = this.children,
  16890. children = _this$children === void 0 ? [] : _this$children;
  16891. var _this$$refs2 = this.$refs,
  16892. scroller = _this$$refs2.scroller,
  16893. row = _this$$refs2.row;
  16894. var child = children.find(function (it) {
  16895. return +it.skuValue.id === +selectSkuId;
  16896. });
  16897. if (scroller && row && child && child.$el) {
  16898. var target = child.$el;
  16899. var to = target.offsetLeft - (scroller.offsetWidth - target.offsetWidth) / 2;
  16900. scroller.scrollLeft = to;
  16901. }
  16902. }
  16903. },
  16904. render: function render() {
  16905. var h = arguments[0];
  16906. return h("div", {
  16907. "class": [SkuRow_bem(), BORDER_BOTTOM]
  16908. }, [this.genTitle(), this.genContent(), this.genIndicator()]);
  16909. }
  16910. }));
  16911. // CONCATENATED MODULE: ./es/sku/components/SkuRowItem.js
  16912. var SkuRowItem_createNamespace = Object(create["a" /* createNamespace */])('sku-row-item'),
  16913. SkuRowItem_createComponent = SkuRowItem_createNamespace[0];
  16914. /* harmony default export */ var SkuRowItem = (SkuRowItem_createComponent({
  16915. mixins: [ChildrenMixin('vanSkuRows')],
  16916. props: {
  16917. lazyLoad: Boolean,
  16918. skuValue: Object,
  16919. skuKeyStr: String,
  16920. skuEventBus: Object,
  16921. selectedSku: Object,
  16922. largeImageMode: Boolean,
  16923. disableSoldoutSku: Boolean,
  16924. skuList: {
  16925. type: Array,
  16926. default: function _default() {
  16927. return [];
  16928. }
  16929. }
  16930. },
  16931. computed: {
  16932. imgUrl: function imgUrl() {
  16933. var url = this.skuValue.imgUrl || this.skuValue.img_url;
  16934. return this.largeImageMode ? url || 'https://img01.yzcdn.cn/upload_files/2020/06/24/FmKWDg0bN9rMcTp9ne8MXiQWGtLn.png' : url;
  16935. },
  16936. choosable: function choosable() {
  16937. if (!this.disableSoldoutSku) {
  16938. return true;
  16939. }
  16940. return sku_helper_isSkuChoosable(this.skuList, this.selectedSku, {
  16941. key: this.skuKeyStr,
  16942. valueId: this.skuValue.id
  16943. });
  16944. }
  16945. },
  16946. methods: {
  16947. onSelect: function onSelect() {
  16948. if (this.choosable) {
  16949. this.skuEventBus.$emit('sku:select', _extends({}, this.skuValue, {
  16950. skuKeyStr: this.skuKeyStr
  16951. }));
  16952. }
  16953. },
  16954. onPreviewImg: function onPreviewImg(event) {
  16955. event.stopPropagation();
  16956. var skuValue = this.skuValue,
  16957. skuKeyStr = this.skuKeyStr;
  16958. this.skuEventBus.$emit('sku:previewImage', _extends({}, skuValue, {
  16959. ks: skuKeyStr,
  16960. imgUrl: skuValue.imgUrl || skuValue.img_url
  16961. }));
  16962. },
  16963. genImage: function genImage(classPrefix) {
  16964. var h = this.$createElement;
  16965. if (this.imgUrl) {
  16966. return h(es_image, {
  16967. "attrs": {
  16968. "fit": "cover",
  16969. "src": this.imgUrl,
  16970. "lazyLoad": this.lazyLoad
  16971. },
  16972. "class": classPrefix + "-img"
  16973. });
  16974. }
  16975. }
  16976. },
  16977. render: function render() {
  16978. var h = arguments[0];
  16979. var choosed = this.skuValue.id === this.selectedSku[this.skuKeyStr];
  16980. var classPrefix = this.largeImageMode ? SkuRow_bem('image-item') : SkuRow_bem('item');
  16981. return h("span", {
  16982. "class": [classPrefix, choosed ? classPrefix + "--active" : '', !this.choosable ? classPrefix + "--disabled" : ''],
  16983. "on": {
  16984. "click": this.onSelect
  16985. }
  16986. }, [this.genImage(classPrefix), h("div", {
  16987. "class": classPrefix + "-name"
  16988. }, [this.largeImageMode ? h("span", {
  16989. "class": {
  16990. 'van-multi-ellipsis--l2': this.largeImageMode
  16991. }
  16992. }, [this.skuValue.name]) : this.skuValue.name]), this.largeImageMode && h(es_icon, {
  16993. "attrs": {
  16994. "name": "enlarge"
  16995. },
  16996. "class": classPrefix + "-img-icon",
  16997. "on": {
  16998. "click": this.onPreviewImg
  16999. }
  17000. })]);
  17001. }
  17002. }));
  17003. // CONCATENATED MODULE: ./es/sku/components/SkuRowPropItem.js
  17004. var SkuRowPropItem_createNamespace = Object(create["a" /* createNamespace */])('sku-row-prop-item'),
  17005. SkuRowPropItem_createComponent = SkuRowPropItem_createNamespace[0];
  17006. /* harmony default export */ var SkuRowPropItem = (SkuRowPropItem_createComponent({
  17007. props: {
  17008. skuValue: Object,
  17009. skuKeyStr: String,
  17010. skuEventBus: Object,
  17011. selectedProp: Object,
  17012. multiple: Boolean,
  17013. disabled: Boolean
  17014. },
  17015. computed: {
  17016. choosed: function choosed() {
  17017. var selectedProp = this.selectedProp,
  17018. skuKeyStr = this.skuKeyStr,
  17019. skuValue = this.skuValue;
  17020. if (selectedProp && selectedProp[skuKeyStr]) {
  17021. return selectedProp[skuKeyStr].indexOf(skuValue.id) > -1;
  17022. }
  17023. return false;
  17024. }
  17025. },
  17026. methods: {
  17027. onSelect: function onSelect() {
  17028. if (this.disabled) return;
  17029. this.skuEventBus.$emit('sku:propSelect', _extends({}, this.skuValue, {
  17030. skuKeyStr: this.skuKeyStr,
  17031. multiple: this.multiple
  17032. }));
  17033. }
  17034. },
  17035. render: function render() {
  17036. var h = arguments[0];
  17037. return h("span", {
  17038. "class": ['van-sku-row__item', {
  17039. 'van-sku-row__item--active': this.choosed
  17040. }, {
  17041. 'van-sku-row__item--disabled': this.disabled
  17042. }],
  17043. "on": {
  17044. "click": this.onSelect
  17045. }
  17046. }, [h("span", {
  17047. "class": "van-sku-row__item-name"
  17048. }, [this.skuValue.name])]);
  17049. }
  17050. }));
  17051. // CONCATENATED MODULE: ./es/stepper/index.js
  17052. var stepper_createNamespace = Object(create["a" /* createNamespace */])('stepper'),
  17053. stepper_createComponent = stepper_createNamespace[0],
  17054. stepper_bem = stepper_createNamespace[1];
  17055. var LONG_PRESS_START_TIME = 600;
  17056. var LONG_PRESS_INTERVAL = 200;
  17057. function stepper_equal(value1, value2) {
  17058. return String(value1) === String(value2);
  17059. }
  17060. /* harmony default export */ var stepper = (stepper_createComponent({
  17061. mixins: [FieldMixin],
  17062. props: {
  17063. value: null,
  17064. theme: String,
  17065. integer: Boolean,
  17066. disabled: Boolean,
  17067. allowEmpty: Boolean,
  17068. inputWidth: [Number, String],
  17069. buttonSize: [Number, String],
  17070. asyncChange: Boolean,
  17071. placeholder: String,
  17072. disablePlus: Boolean,
  17073. disableMinus: Boolean,
  17074. disableInput: Boolean,
  17075. decimalLength: [Number, String],
  17076. name: {
  17077. type: [Number, String],
  17078. default: ''
  17079. },
  17080. min: {
  17081. type: [Number, String],
  17082. default: 1
  17083. },
  17084. max: {
  17085. type: [Number, String],
  17086. default: Infinity
  17087. },
  17088. step: {
  17089. type: [Number, String],
  17090. default: 1
  17091. },
  17092. defaultValue: {
  17093. type: [Number, String],
  17094. default: 1
  17095. },
  17096. showPlus: {
  17097. type: Boolean,
  17098. default: true
  17099. },
  17100. showMinus: {
  17101. type: Boolean,
  17102. default: true
  17103. },
  17104. showInput: {
  17105. type: Boolean,
  17106. default: true
  17107. },
  17108. longPress: {
  17109. type: Boolean,
  17110. default: true
  17111. }
  17112. },
  17113. data: function data() {
  17114. var _this$value;
  17115. var defaultValue = (_this$value = this.value) != null ? _this$value : this.defaultValue;
  17116. var value = this.format(defaultValue);
  17117. if (!stepper_equal(value, this.value)) {
  17118. this.$emit('input', value);
  17119. }
  17120. return {
  17121. currentValue: value
  17122. };
  17123. },
  17124. computed: {
  17125. minusDisabled: function minusDisabled() {
  17126. return this.disabled || this.disableMinus || this.currentValue <= +this.min;
  17127. },
  17128. plusDisabled: function plusDisabled() {
  17129. return this.disabled || this.disablePlus || this.currentValue >= +this.max;
  17130. },
  17131. inputStyle: function inputStyle() {
  17132. var style = {};
  17133. if (this.inputWidth) {
  17134. style.width = Object(unit["a" /* addUnit */])(this.inputWidth);
  17135. }
  17136. if (this.buttonSize) {
  17137. style.height = Object(unit["a" /* addUnit */])(this.buttonSize);
  17138. }
  17139. return style;
  17140. },
  17141. buttonStyle: function buttonStyle() {
  17142. if (this.buttonSize) {
  17143. var size = Object(unit["a" /* addUnit */])(this.buttonSize);
  17144. return {
  17145. width: size,
  17146. height: size
  17147. };
  17148. }
  17149. }
  17150. },
  17151. watch: {
  17152. max: 'check',
  17153. min: 'check',
  17154. integer: 'check',
  17155. decimalLength: 'check',
  17156. value: function value(val) {
  17157. if (!stepper_equal(val, this.currentValue)) {
  17158. this.currentValue = this.format(val);
  17159. }
  17160. },
  17161. currentValue: function currentValue(val) {
  17162. this.$emit('input', val);
  17163. this.$emit('change', val, {
  17164. name: this.name
  17165. });
  17166. }
  17167. },
  17168. methods: {
  17169. check: function check() {
  17170. var val = this.format(this.currentValue);
  17171. if (!stepper_equal(val, this.currentValue)) {
  17172. this.currentValue = val;
  17173. }
  17174. },
  17175. // formatNumber illegal characters
  17176. formatNumber: function formatNumber(value) {
  17177. return number_formatNumber(String(value), !this.integer);
  17178. },
  17179. format: function format(value) {
  17180. if (this.allowEmpty && value === '') {
  17181. return value;
  17182. }
  17183. value = this.formatNumber(value); // format range
  17184. value = value === '' ? 0 : +value;
  17185. value = Object(number["a" /* isNaN */])(value) ? this.min : value;
  17186. value = Math.max(Math.min(this.max, value), this.min); // format decimal
  17187. if (Object(utils["c" /* isDef */])(this.decimalLength)) {
  17188. value = value.toFixed(this.decimalLength);
  17189. }
  17190. return value;
  17191. },
  17192. onInput: function onInput(event) {
  17193. var value = event.target.value;
  17194. var formatted = this.formatNumber(value); // limit max decimal length
  17195. if (Object(utils["c" /* isDef */])(this.decimalLength) && formatted.indexOf('.') !== -1) {
  17196. var pair = formatted.split('.');
  17197. formatted = pair[0] + "." + pair[1].slice(0, this.decimalLength);
  17198. }
  17199. if (!stepper_equal(value, formatted)) {
  17200. event.target.value = formatted;
  17201. } // prefer number type
  17202. if (formatted === String(+formatted)) {
  17203. formatted = +formatted;
  17204. }
  17205. this.emitChange(formatted);
  17206. },
  17207. emitChange: function emitChange(value) {
  17208. if (this.asyncChange) {
  17209. this.$emit('input', value);
  17210. this.$emit('change', value, {
  17211. name: this.name
  17212. });
  17213. } else {
  17214. this.currentValue = value;
  17215. }
  17216. },
  17217. onChange: function onChange() {
  17218. var type = this.type;
  17219. if (this[type + "Disabled"]) {
  17220. this.$emit('overlimit', type);
  17221. return;
  17222. }
  17223. var diff = type === 'minus' ? -this.step : +this.step;
  17224. var value = this.format(addNumber(+this.currentValue, diff));
  17225. this.emitChange(value);
  17226. this.$emit(type);
  17227. },
  17228. onFocus: function onFocus(event) {
  17229. // readonly not work in legacy mobile safari
  17230. if (this.disableInput && this.$refs.input) {
  17231. this.$refs.input.blur();
  17232. } else {
  17233. this.$emit('focus', event);
  17234. }
  17235. },
  17236. onBlur: function onBlur(event) {
  17237. var value = this.format(event.target.value);
  17238. event.target.value = value;
  17239. this.emitChange(value);
  17240. this.$emit('blur', event);
  17241. resetScroll();
  17242. },
  17243. longPressStep: function longPressStep() {
  17244. var _this = this;
  17245. this.longPressTimer = setTimeout(function () {
  17246. _this.onChange();
  17247. _this.longPressStep(_this.type);
  17248. }, LONG_PRESS_INTERVAL);
  17249. },
  17250. onTouchStart: function onTouchStart() {
  17251. var _this2 = this;
  17252. if (!this.longPress) {
  17253. return;
  17254. }
  17255. clearTimeout(this.longPressTimer);
  17256. this.isLongPress = false;
  17257. this.longPressTimer = setTimeout(function () {
  17258. _this2.isLongPress = true;
  17259. _this2.onChange();
  17260. _this2.longPressStep();
  17261. }, LONG_PRESS_START_TIME);
  17262. },
  17263. onTouchEnd: function onTouchEnd(event) {
  17264. if (!this.longPress) {
  17265. return;
  17266. }
  17267. clearTimeout(this.longPressTimer);
  17268. if (this.isLongPress) {
  17269. preventDefault(event);
  17270. }
  17271. },
  17272. onMousedown: function onMousedown(event) {
  17273. // fix mobile safari page scroll down issue
  17274. // see: https://github.com/vant-ui/vant/issues/7690
  17275. if (this.disableInput) {
  17276. event.preventDefault();
  17277. }
  17278. }
  17279. },
  17280. render: function render() {
  17281. var _this3 = this;
  17282. var h = arguments[0];
  17283. var createListeners = function createListeners(type) {
  17284. return {
  17285. on: {
  17286. click: function click(e) {
  17287. // disable double tap scrolling on mobile safari
  17288. e.preventDefault();
  17289. _this3.type = type;
  17290. _this3.onChange();
  17291. },
  17292. touchstart: function touchstart() {
  17293. _this3.type = type;
  17294. _this3.onTouchStart();
  17295. },
  17296. touchend: _this3.onTouchEnd,
  17297. touchcancel: _this3.onTouchEnd
  17298. }
  17299. };
  17300. };
  17301. return h("div", {
  17302. "class": stepper_bem([this.theme])
  17303. }, [h("button", helper_default()([{
  17304. "directives": [{
  17305. name: "show",
  17306. value: this.showMinus
  17307. }],
  17308. "attrs": {
  17309. "type": "button"
  17310. },
  17311. "style": this.buttonStyle,
  17312. "class": stepper_bem('minus', {
  17313. disabled: this.minusDisabled
  17314. })
  17315. }, createListeners('minus')])), h("input", {
  17316. "directives": [{
  17317. name: "show",
  17318. value: this.showInput
  17319. }],
  17320. "ref": "input",
  17321. "attrs": {
  17322. "type": this.integer ? 'tel' : 'text',
  17323. "role": "spinbutton",
  17324. "disabled": this.disabled,
  17325. "readonly": this.disableInput,
  17326. "inputmode": this.integer ? 'numeric' : 'decimal',
  17327. "placeholder": this.placeholder,
  17328. "aria-valuemax": this.max,
  17329. "aria-valuemin": this.min,
  17330. "aria-valuenow": this.currentValue
  17331. },
  17332. "class": stepper_bem('input'),
  17333. "domProps": {
  17334. "value": this.currentValue
  17335. },
  17336. "style": this.inputStyle,
  17337. "on": {
  17338. "input": this.onInput,
  17339. "focus": this.onFocus,
  17340. "blur": this.onBlur,
  17341. "mousedown": this.onMousedown
  17342. }
  17343. }), h("button", helper_default()([{
  17344. "directives": [{
  17345. name: "show",
  17346. value: this.showPlus
  17347. }],
  17348. "attrs": {
  17349. "type": "button"
  17350. },
  17351. "style": this.buttonStyle,
  17352. "class": stepper_bem('plus', {
  17353. disabled: this.plusDisabled
  17354. })
  17355. }, createListeners('plus')]))]);
  17356. }
  17357. }));
  17358. // CONCATENATED MODULE: ./es/sku/components/SkuStepper.js
  17359. var namespace = Object(create["a" /* createNamespace */])('sku-stepper');
  17360. var SkuStepper_createComponent = namespace[0];
  17361. var SkuStepper_t = namespace[2];
  17362. var QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT,
  17363. STOCK_LIMIT = LIMIT_TYPE.STOCK_LIMIT;
  17364. /* harmony default export */ var SkuStepper = (SkuStepper_createComponent({
  17365. props: {
  17366. stock: Number,
  17367. skuEventBus: Object,
  17368. skuStockNum: Number,
  17369. selectedNum: Number,
  17370. stepperTitle: String,
  17371. disableStepperInput: Boolean,
  17372. customStepperConfig: Object,
  17373. hideQuotaText: Boolean,
  17374. quota: {
  17375. type: Number,
  17376. default: 0
  17377. },
  17378. quotaUsed: {
  17379. type: Number,
  17380. default: 0
  17381. },
  17382. startSaleNum: {
  17383. type: Number,
  17384. default: 1
  17385. }
  17386. },
  17387. data: function data() {
  17388. return {
  17389. currentNum: this.selectedNum,
  17390. // 购买限制类型: 限购/库存
  17391. limitType: STOCK_LIMIT
  17392. };
  17393. },
  17394. watch: {
  17395. currentNum: function currentNum(num) {
  17396. var intValue = parseInt(num, 10);
  17397. if (intValue >= this.stepperMinLimit && intValue <= this.stepperLimit) {
  17398. this.skuEventBus.$emit('sku:numChange', intValue);
  17399. }
  17400. },
  17401. stepperLimit: function stepperLimit(limit) {
  17402. if (limit < this.currentNum && this.stepperMinLimit <= limit) {
  17403. this.currentNum = limit;
  17404. }
  17405. this.checkState(this.stepperMinLimit, limit);
  17406. },
  17407. stepperMinLimit: function stepperMinLimit(start) {
  17408. if (start > this.currentNum || start > this.stepperLimit) {
  17409. this.currentNum = start;
  17410. }
  17411. this.checkState(start, this.stepperLimit);
  17412. }
  17413. },
  17414. computed: {
  17415. stepperLimit: function stepperLimit() {
  17416. var quotaLimit = this.quota - this.quotaUsed;
  17417. var limit; // 无限购时直接取库存,有限购时取限购数和库存数中小的那个
  17418. if (this.quota > 0 && quotaLimit <= this.stock) {
  17419. // 修正负的limit
  17420. limit = quotaLimit < 0 ? 0 : quotaLimit;
  17421. this.limitType = QUOTA_LIMIT;
  17422. } else {
  17423. limit = this.stock;
  17424. this.limitType = STOCK_LIMIT;
  17425. }
  17426. return limit;
  17427. },
  17428. stepperMinLimit: function stepperMinLimit() {
  17429. return this.startSaleNum < 1 ? 1 : this.startSaleNum;
  17430. },
  17431. quotaText: function quotaText() {
  17432. var _this$customStepperCo = this.customStepperConfig,
  17433. quotaText = _this$customStepperCo.quotaText,
  17434. hideQuotaText = _this$customStepperCo.hideQuotaText;
  17435. if (hideQuotaText) return '';
  17436. var text = '';
  17437. if (quotaText) {
  17438. text = quotaText;
  17439. } else {
  17440. var textArr = [];
  17441. if (this.startSaleNum > 1) {
  17442. textArr.push(SkuStepper_t('quotaStart', this.startSaleNum));
  17443. }
  17444. if (this.quota > 0) {
  17445. textArr.push(SkuStepper_t('quotaLimit', this.quota));
  17446. }
  17447. text = textArr.join(SkuStepper_t('comma'));
  17448. }
  17449. return text;
  17450. }
  17451. },
  17452. created: function created() {
  17453. this.checkState(this.stepperMinLimit, this.stepperLimit);
  17454. },
  17455. methods: {
  17456. setCurrentNum: function setCurrentNum(num) {
  17457. this.currentNum = num;
  17458. this.checkState(this.stepperMinLimit, this.stepperLimit);
  17459. },
  17460. onOverLimit: function onOverLimit(action) {
  17461. this.skuEventBus.$emit('sku:overLimit', {
  17462. action: action,
  17463. limitType: this.limitType,
  17464. quota: this.quota,
  17465. quotaUsed: this.quotaUsed,
  17466. startSaleNum: this.startSaleNum
  17467. });
  17468. },
  17469. onChange: function onChange(currentValue) {
  17470. var intValue = parseInt(currentValue, 10);
  17471. var handleStepperChange = this.customStepperConfig.handleStepperChange;
  17472. handleStepperChange && handleStepperChange(intValue);
  17473. this.$emit('change', intValue);
  17474. },
  17475. checkState: function checkState(min, max) {
  17476. // 如果选择小于起售,则强制变为起售
  17477. if (this.currentNum < min || min > max) {
  17478. this.currentNum = min;
  17479. } else if (this.currentNum > max) {
  17480. // 当前选择数量大于最大可选时,需要重置已选数量
  17481. this.currentNum = max;
  17482. }
  17483. this.skuEventBus.$emit('sku:stepperState', {
  17484. valid: min <= max,
  17485. min: min,
  17486. max: max,
  17487. limitType: this.limitType,
  17488. quota: this.quota,
  17489. quotaUsed: this.quotaUsed,
  17490. startSaleNum: this.startSaleNum
  17491. });
  17492. }
  17493. },
  17494. render: function render() {
  17495. var _this = this;
  17496. var h = arguments[0];
  17497. return h("div", {
  17498. "class": "van-sku-stepper-stock"
  17499. }, [h("div", {
  17500. "class": "van-sku__stepper-title"
  17501. }, [this.stepperTitle || SkuStepper_t('num')]), h(stepper, {
  17502. "attrs": {
  17503. "integer": true,
  17504. "min": this.stepperMinLimit,
  17505. "max": this.stepperLimit,
  17506. "disableInput": this.disableStepperInput
  17507. },
  17508. "class": "van-sku__stepper",
  17509. "on": {
  17510. "overlimit": this.onOverLimit,
  17511. "change": this.onChange
  17512. },
  17513. "model": {
  17514. value: _this.currentNum,
  17515. callback: function callback($$v) {
  17516. _this.currentNum = $$v;
  17517. }
  17518. }
  17519. }), !this.hideQuotaText && this.quotaText && h("span", {
  17520. "class": "van-sku__stepper-quota"
  17521. }, ["(", this.quotaText, ")"])]);
  17522. }
  17523. }));
  17524. // CONCATENATED MODULE: ./es/utils/validate/email.js
  17525. /* eslint-disable */
  17526. function isEmail(value) {
  17527. var reg = /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/;
  17528. return reg.test(value.trim());
  17529. }
  17530. // CONCATENATED MODULE: ./es/uploader/utils.js
  17531. function toArray(item) {
  17532. if (Array.isArray(item)) {
  17533. return item;
  17534. }
  17535. return [item];
  17536. }
  17537. function utils_readFile(file, resultType) {
  17538. return new Promise(function (resolve) {
  17539. if (resultType === 'file') {
  17540. resolve(null);
  17541. return;
  17542. }
  17543. var reader = new FileReader();
  17544. reader.onload = function (event) {
  17545. resolve(event.target.result);
  17546. };
  17547. if (resultType === 'dataUrl') {
  17548. reader.readAsDataURL(file);
  17549. } else if (resultType === 'text') {
  17550. reader.readAsText(file);
  17551. }
  17552. });
  17553. }
  17554. function isOversize(files, maxSize) {
  17555. return toArray(files).some(function (file) {
  17556. if (file) {
  17557. if (Object(utils["e" /* isFunction */])(maxSize)) {
  17558. return maxSize(file);
  17559. }
  17560. return file.size > maxSize;
  17561. }
  17562. return false;
  17563. });
  17564. }
  17565. var IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
  17566. function isImageUrl(url) {
  17567. return IMAGE_REGEXP.test(url);
  17568. }
  17569. function isImageFile(item) {
  17570. // some special urls cannot be recognized
  17571. // user can add `isImage` flag to mark it as an image url
  17572. if (item.isImage) {
  17573. return true;
  17574. }
  17575. if (item.file && item.file.type) {
  17576. return item.file.type.indexOf('image') === 0;
  17577. }
  17578. if (item.url) {
  17579. return isImageUrl(item.url);
  17580. }
  17581. if (item.content) {
  17582. return item.content.indexOf('data:image') === 0;
  17583. }
  17584. return false;
  17585. }
  17586. // CONCATENATED MODULE: ./es/uploader/index.js
  17587. // Utils
  17588. // Mixins
  17589. // Components
  17590. var uploader_createNamespace = Object(create["a" /* createNamespace */])('uploader'),
  17591. uploader_createComponent = uploader_createNamespace[0],
  17592. uploader_bem = uploader_createNamespace[1];
  17593. /* harmony default export */ var uploader = (uploader_createComponent({
  17594. inheritAttrs: false,
  17595. mixins: [FieldMixin],
  17596. model: {
  17597. prop: 'fileList'
  17598. },
  17599. props: {
  17600. disabled: Boolean,
  17601. readonly: Boolean,
  17602. lazyLoad: Boolean,
  17603. uploadText: String,
  17604. afterRead: Function,
  17605. beforeRead: Function,
  17606. beforeDelete: Function,
  17607. previewSize: [Number, String],
  17608. previewOptions: Object,
  17609. name: {
  17610. type: [Number, String],
  17611. default: ''
  17612. },
  17613. accept: {
  17614. type: String,
  17615. default: 'image/*'
  17616. },
  17617. fileList: {
  17618. type: Array,
  17619. default: function _default() {
  17620. return [];
  17621. }
  17622. },
  17623. maxSize: {
  17624. type: [Number, String, Function],
  17625. default: Number.MAX_VALUE
  17626. },
  17627. maxCount: {
  17628. type: [Number, String],
  17629. default: Number.MAX_VALUE
  17630. },
  17631. deletable: {
  17632. type: Boolean,
  17633. default: true
  17634. },
  17635. showUpload: {
  17636. type: Boolean,
  17637. default: true
  17638. },
  17639. previewImage: {
  17640. type: Boolean,
  17641. default: true
  17642. },
  17643. previewFullImage: {
  17644. type: Boolean,
  17645. default: true
  17646. },
  17647. imageFit: {
  17648. type: String,
  17649. default: 'cover'
  17650. },
  17651. resultType: {
  17652. type: String,
  17653. default: 'dataUrl'
  17654. },
  17655. uploadIcon: {
  17656. type: String,
  17657. default: 'photograph'
  17658. }
  17659. },
  17660. computed: {
  17661. previewSizeWithUnit: function previewSizeWithUnit() {
  17662. return Object(unit["a" /* addUnit */])(this.previewSize);
  17663. },
  17664. // for form
  17665. value: function value() {
  17666. return this.fileList;
  17667. }
  17668. },
  17669. created: function created() {
  17670. this.urls = [];
  17671. },
  17672. beforeDestroy: function beforeDestroy() {
  17673. this.urls.forEach(function (url) {
  17674. return URL.revokeObjectURL(url);
  17675. });
  17676. },
  17677. methods: {
  17678. getDetail: function getDetail(index) {
  17679. if (index === void 0) {
  17680. index = this.fileList.length;
  17681. }
  17682. return {
  17683. name: this.name,
  17684. index: index
  17685. };
  17686. },
  17687. onChange: function onChange(event) {
  17688. var _this = this;
  17689. var files = event.target.files;
  17690. if (this.disabled || !files.length) {
  17691. return;
  17692. }
  17693. files = files.length === 1 ? files[0] : [].slice.call(files);
  17694. if (this.beforeRead) {
  17695. var response = this.beforeRead(files, this.getDetail());
  17696. if (!response) {
  17697. this.resetInput();
  17698. return;
  17699. }
  17700. if (Object(utils["g" /* isPromise */])(response)) {
  17701. response.then(function (data) {
  17702. if (data) {
  17703. _this.readFile(data);
  17704. } else {
  17705. _this.readFile(files);
  17706. }
  17707. }).catch(this.resetInput);
  17708. return;
  17709. }
  17710. }
  17711. this.readFile(files);
  17712. },
  17713. readFile: function readFile(files) {
  17714. var _this2 = this;
  17715. var oversize = isOversize(files, this.maxSize);
  17716. if (Array.isArray(files)) {
  17717. var maxCount = this.maxCount - this.fileList.length;
  17718. if (files.length > maxCount) {
  17719. files = files.slice(0, maxCount);
  17720. }
  17721. Promise.all(files.map(function (file) {
  17722. return utils_readFile(file, _this2.resultType);
  17723. })).then(function (contents) {
  17724. var fileList = files.map(function (file, index) {
  17725. var result = {
  17726. file: file,
  17727. status: '',
  17728. message: ''
  17729. };
  17730. if (contents[index]) {
  17731. result.content = contents[index];
  17732. }
  17733. return result;
  17734. });
  17735. _this2.onAfterRead(fileList, oversize);
  17736. });
  17737. } else {
  17738. utils_readFile(files, this.resultType).then(function (content) {
  17739. var result = {
  17740. file: files,
  17741. status: '',
  17742. message: ''
  17743. };
  17744. if (content) {
  17745. result.content = content;
  17746. }
  17747. _this2.onAfterRead(result, oversize);
  17748. });
  17749. }
  17750. },
  17751. onAfterRead: function onAfterRead(files, oversize) {
  17752. var _this3 = this;
  17753. this.resetInput();
  17754. var validFiles = files;
  17755. if (oversize) {
  17756. var oversizeFiles = files;
  17757. if (Array.isArray(files)) {
  17758. oversizeFiles = [];
  17759. validFiles = [];
  17760. files.forEach(function (item) {
  17761. if (item.file) {
  17762. if (isOversize(item.file, _this3.maxSize)) {
  17763. oversizeFiles.push(item);
  17764. } else {
  17765. validFiles.push(item);
  17766. }
  17767. }
  17768. });
  17769. } else {
  17770. validFiles = null;
  17771. }
  17772. this.$emit('oversize', oversizeFiles, this.getDetail());
  17773. }
  17774. var isValidFiles = Array.isArray(validFiles) ? Boolean(validFiles.length) : Boolean(validFiles);
  17775. if (isValidFiles) {
  17776. this.$emit('input', [].concat(this.fileList, toArray(validFiles)));
  17777. if (this.afterRead) {
  17778. this.afterRead(validFiles, this.getDetail());
  17779. }
  17780. }
  17781. },
  17782. onDelete: function onDelete(file, index) {
  17783. var _file$beforeDelete,
  17784. _this4 = this;
  17785. var beforeDelete = (_file$beforeDelete = file.beforeDelete) != null ? _file$beforeDelete : this.beforeDelete;
  17786. if (beforeDelete) {
  17787. var response = beforeDelete(file, this.getDetail(index));
  17788. if (!response) {
  17789. return;
  17790. }
  17791. if (Object(utils["g" /* isPromise */])(response)) {
  17792. response.then(function () {
  17793. _this4.deleteFile(file, index);
  17794. }).catch(utils["i" /* noop */]);
  17795. return;
  17796. }
  17797. }
  17798. this.deleteFile(file, index);
  17799. },
  17800. deleteFile: function deleteFile(file, index) {
  17801. var fileList = this.fileList.slice(0);
  17802. fileList.splice(index, 1);
  17803. this.$emit('input', fileList);
  17804. this.$emit('delete', file, this.getDetail(index));
  17805. },
  17806. resetInput: function resetInput() {
  17807. /* istanbul ignore else */
  17808. if (this.$refs.input) {
  17809. this.$refs.input.value = '';
  17810. }
  17811. },
  17812. onClickUpload: function onClickUpload(event) {
  17813. this.$emit('click-upload', event);
  17814. },
  17815. onPreviewImage: function onPreviewImage(item) {
  17816. var _this5 = this;
  17817. if (!this.previewFullImage) {
  17818. return;
  17819. }
  17820. var imageFiles = this.fileList.filter(function (item) {
  17821. return isImageFile(item);
  17822. });
  17823. var imageContents = imageFiles.map(function (item) {
  17824. if (item.file && !item.url && item.status !== 'failed') {
  17825. item.url = URL.createObjectURL(item.file);
  17826. _this5.urls.push(item.url);
  17827. }
  17828. return item.url;
  17829. });
  17830. this.imagePreview = image_preview(_extends({
  17831. images: imageContents,
  17832. startPosition: imageFiles.indexOf(item),
  17833. onClose: function onClose() {
  17834. _this5.$emit('close-preview');
  17835. }
  17836. }, this.previewOptions));
  17837. },
  17838. // @exposed-api
  17839. closeImagePreview: function closeImagePreview() {
  17840. if (this.imagePreview) {
  17841. this.imagePreview.close();
  17842. }
  17843. },
  17844. // @exposed-api
  17845. chooseFile: function chooseFile() {
  17846. if (this.disabled) {
  17847. return;
  17848. }
  17849. /* istanbul ignore else */
  17850. if (this.$refs.input) {
  17851. this.$refs.input.click();
  17852. }
  17853. },
  17854. genPreviewMask: function genPreviewMask(item) {
  17855. var h = this.$createElement;
  17856. var status = item.status,
  17857. message = item.message;
  17858. if (status === 'uploading' || status === 'failed') {
  17859. var MaskIcon = status === 'failed' ? h(es_icon, {
  17860. "attrs": {
  17861. "name": "close"
  17862. },
  17863. "class": uploader_bem('mask-icon')
  17864. }) : h(es_loading, {
  17865. "class": uploader_bem('loading')
  17866. });
  17867. var showMessage = Object(utils["c" /* isDef */])(message) && message !== '';
  17868. return h("div", {
  17869. "class": uploader_bem('mask')
  17870. }, [MaskIcon, showMessage && h("div", {
  17871. "class": uploader_bem('mask-message')
  17872. }, [message])]);
  17873. }
  17874. },
  17875. genPreviewItem: function genPreviewItem(item, index) {
  17876. var _item$deletable,
  17877. _this6 = this,
  17878. _item$previewSize,
  17879. _item$imageFit;
  17880. var h = this.$createElement;
  17881. var deleteAble = (_item$deletable = item.deletable) != null ? _item$deletable : this.deletable;
  17882. var showDelete = item.status !== 'uploading' && deleteAble;
  17883. var DeleteIcon = showDelete && h("div", {
  17884. "class": uploader_bem('preview-delete'),
  17885. "on": {
  17886. "click": function click(event) {
  17887. event.stopPropagation();
  17888. _this6.onDelete(item, index);
  17889. }
  17890. }
  17891. }, [h(es_icon, {
  17892. "attrs": {
  17893. "name": "cross"
  17894. },
  17895. "class": uploader_bem('preview-delete-icon')
  17896. })]);
  17897. var PreviewCoverContent = this.slots('preview-cover', _extends({
  17898. index: index
  17899. }, item));
  17900. var PreviewCover = PreviewCoverContent && h("div", {
  17901. "class": uploader_bem('preview-cover')
  17902. }, [PreviewCoverContent]);
  17903. var previewSize = (_item$previewSize = item.previewSize) != null ? _item$previewSize : this.previewSize;
  17904. var imageFit = (_item$imageFit = item.imageFit) != null ? _item$imageFit : this.imageFit;
  17905. var Preview = isImageFile(item) ? h(es_image, {
  17906. "attrs": {
  17907. "fit": imageFit,
  17908. "src": item.content || item.url,
  17909. "width": previewSize,
  17910. "height": previewSize,
  17911. "lazyLoad": this.lazyLoad
  17912. },
  17913. "class": uploader_bem('preview-image'),
  17914. "on": {
  17915. "click": function click() {
  17916. _this6.onPreviewImage(item);
  17917. }
  17918. }
  17919. }, [PreviewCover]) : h("div", {
  17920. "class": uploader_bem('file'),
  17921. "style": {
  17922. width: this.previewSizeWithUnit,
  17923. height: this.previewSizeWithUnit
  17924. }
  17925. }, [h(es_icon, {
  17926. "class": uploader_bem('file-icon'),
  17927. "attrs": {
  17928. "name": "description"
  17929. }
  17930. }), h("div", {
  17931. "class": [uploader_bem('file-name'), 'van-ellipsis']
  17932. }, [item.file ? item.file.name : item.url]), PreviewCover]);
  17933. return h("div", {
  17934. "class": uploader_bem('preview'),
  17935. "on": {
  17936. "click": function click() {
  17937. _this6.$emit('click-preview', item, _this6.getDetail(index));
  17938. }
  17939. }
  17940. }, [Preview, this.genPreviewMask(item), DeleteIcon]);
  17941. },
  17942. genPreviewList: function genPreviewList() {
  17943. if (this.previewImage) {
  17944. return this.fileList.map(this.genPreviewItem);
  17945. }
  17946. },
  17947. genUpload: function genUpload() {
  17948. var h = this.$createElement;
  17949. if (this.fileList.length >= this.maxCount) {
  17950. return;
  17951. }
  17952. var slot = this.slots();
  17953. var Input = this.readonly ? null : h("input", {
  17954. "attrs": _extends({}, this.$attrs, {
  17955. "type": "file",
  17956. "accept": this.accept,
  17957. "disabled": this.disabled
  17958. }),
  17959. "ref": "input",
  17960. "class": uploader_bem('input'),
  17961. "on": {
  17962. "change": this.onChange
  17963. }
  17964. });
  17965. if (slot) {
  17966. return h("div", {
  17967. "class": uploader_bem('input-wrapper'),
  17968. "key": "input-wrapper",
  17969. "on": {
  17970. "click": this.onClickUpload
  17971. }
  17972. }, [slot, Input]);
  17973. }
  17974. var style;
  17975. if (this.previewSize) {
  17976. var size = this.previewSizeWithUnit;
  17977. style = {
  17978. width: size,
  17979. height: size
  17980. };
  17981. }
  17982. return h("div", {
  17983. "directives": [{
  17984. name: "show",
  17985. value: this.showUpload
  17986. }],
  17987. "class": uploader_bem('upload', {
  17988. readonly: this.readonly
  17989. }),
  17990. "style": style,
  17991. "on": {
  17992. "click": this.onClickUpload
  17993. }
  17994. }, [h(es_icon, {
  17995. "attrs": {
  17996. "name": this.uploadIcon
  17997. },
  17998. "class": uploader_bem('upload-icon')
  17999. }), this.uploadText && h("span", {
  18000. "class": uploader_bem('upload-text')
  18001. }, [this.uploadText]), Input]);
  18002. }
  18003. },
  18004. render: function render() {
  18005. var h = arguments[0];
  18006. return h("div", {
  18007. "class": uploader_bem()
  18008. }, [h("div", {
  18009. "class": uploader_bem('wrapper', {
  18010. disabled: this.disabled
  18011. })
  18012. }, [this.genPreviewList(), this.genUpload()])]);
  18013. }
  18014. }));
  18015. // CONCATENATED MODULE: ./es/sku/components/SkuImgUploader.js
  18016. // Utils
  18017. // Components
  18018. var SkuImgUploader_namespace = Object(create["a" /* createNamespace */])('sku-img-uploader');
  18019. var SkuImgUploader_createComponent = SkuImgUploader_namespace[0];
  18020. var SkuImgUploader_t = SkuImgUploader_namespace[2];
  18021. /* harmony default export */ var SkuImgUploader = (SkuImgUploader_createComponent({
  18022. props: {
  18023. value: String,
  18024. uploadImg: Function,
  18025. customUpload: Function,
  18026. maxSize: {
  18027. type: Number,
  18028. default: 6
  18029. }
  18030. },
  18031. data: function data() {
  18032. return {
  18033. fileList: []
  18034. };
  18035. },
  18036. watch: {
  18037. value: function value(val) {
  18038. if (val) {
  18039. this.fileList = [{
  18040. url: val,
  18041. isImage: true
  18042. }];
  18043. } else {
  18044. this.fileList = [];
  18045. }
  18046. }
  18047. },
  18048. methods: {
  18049. afterReadFile: function afterReadFile(file) {
  18050. var _this = this;
  18051. file.status = 'uploading';
  18052. file.message = SkuImgUploader_t('uploading');
  18053. this.uploadImg(file.file, file.content).then(function (img) {
  18054. file.status = 'done';
  18055. _this.$emit('input', img);
  18056. }).catch(function () {
  18057. file.status = 'failed';
  18058. file.message = SkuImgUploader_t('fail');
  18059. });
  18060. },
  18061. onOversize: function onOversize() {
  18062. this.$toast(SkuImgUploader_t('oversize', this.maxSize));
  18063. },
  18064. onDelete: function onDelete() {
  18065. this.$emit('input', '');
  18066. },
  18067. onClickUpload: function onClickUpload() {
  18068. var _this2 = this;
  18069. if (this.customUpload) {
  18070. this.customUpload().then(function (url) {
  18071. _this2.fileList.push({
  18072. url: url
  18073. });
  18074. _this2.$emit('input', url);
  18075. });
  18076. }
  18077. }
  18078. },
  18079. render: function render() {
  18080. var _this3 = this;
  18081. var h = arguments[0];
  18082. return h(uploader, {
  18083. "attrs": {
  18084. "maxCount": 1,
  18085. "readonly": !!this.customUpload,
  18086. "maxSize": this.maxSize * 1024 * 1024,
  18087. "afterRead": this.afterReadFile
  18088. },
  18089. "on": {
  18090. "oversize": this.onOversize,
  18091. "delete": this.onDelete,
  18092. "click-upload": this.onClickUpload
  18093. },
  18094. "model": {
  18095. value: _this3.fileList,
  18096. callback: function callback($$v) {
  18097. _this3.fileList = $$v;
  18098. }
  18099. }
  18100. });
  18101. }
  18102. }));
  18103. // CONCATENATED MODULE: ./es/sku/utils/time-helper.js
  18104. // 字符串转 Date
  18105. // 只处理 YYYY-MM-DD 或者 YYYY-MM-DD HH:MM 格式
  18106. function stringToDate(timeString) {
  18107. if (!timeString) {
  18108. return null;
  18109. }
  18110. return new Date(timeString.replace(/-/g, '/'));
  18111. } // Date 转字符串
  18112. // type: date or datetime
  18113. function dateToString(date, type) {
  18114. if (type === void 0) {
  18115. type = 'date';
  18116. }
  18117. if (!date) {
  18118. return '';
  18119. }
  18120. var year = date.getFullYear();
  18121. var month = date.getMonth() + 1;
  18122. var day = date.getDate();
  18123. var timeString = year + "-" + Object(string["b" /* padZero */])(month) + "-" + Object(string["b" /* padZero */])(day);
  18124. if (type === 'datetime') {
  18125. var hours = date.getHours();
  18126. var minute = date.getMinutes();
  18127. timeString += " " + Object(string["b" /* padZero */])(hours) + ":" + Object(string["b" /* padZero */])(minute);
  18128. }
  18129. return timeString;
  18130. }
  18131. // CONCATENATED MODULE: ./es/sku/components/SkuDateTimeField.js
  18132. // Utils
  18133. // Components
  18134. var SkuDateTimeField_namespace = Object(create["a" /* createNamespace */])('sku-datetime-field');
  18135. var SkuDateTimeField_createComponent = SkuDateTimeField_namespace[0];
  18136. var SkuDateTimeField_t = SkuDateTimeField_namespace[2];
  18137. /* harmony default export */ var SkuDateTimeField = (SkuDateTimeField_createComponent({
  18138. props: {
  18139. value: String,
  18140. label: String,
  18141. required: Boolean,
  18142. placeholder: String,
  18143. type: {
  18144. type: String,
  18145. default: 'date'
  18146. }
  18147. },
  18148. data: function data() {
  18149. return {
  18150. showDatePicker: false,
  18151. currentDate: this.type === 'time' ? '' : new Date(),
  18152. minDate: new Date(new Date().getFullYear() - 60, 0, 1)
  18153. };
  18154. },
  18155. watch: {
  18156. value: function value(val) {
  18157. switch (this.type) {
  18158. case 'time':
  18159. this.currentDate = val;
  18160. break;
  18161. case 'date':
  18162. case 'datetime':
  18163. this.currentDate = stringToDate(val) || new Date();
  18164. break;
  18165. }
  18166. }
  18167. },
  18168. computed: {
  18169. title: function title() {
  18170. return SkuDateTimeField_t("title." + this.type);
  18171. }
  18172. },
  18173. methods: {
  18174. onClick: function onClick() {
  18175. this.showDatePicker = true;
  18176. },
  18177. onConfirm: function onConfirm(val) {
  18178. var data = val;
  18179. if (this.type !== 'time') {
  18180. data = dateToString(val, this.type);
  18181. }
  18182. this.$emit('input', data);
  18183. this.showDatePicker = false;
  18184. },
  18185. onCancel: function onCancel() {
  18186. this.showDatePicker = false;
  18187. },
  18188. formatter: function formatter(type, val) {
  18189. var word = SkuDateTimeField_t("format." + type);
  18190. return "" + val + word;
  18191. }
  18192. },
  18193. render: function render() {
  18194. var _this = this;
  18195. var h = arguments[0];
  18196. return h(es_field, {
  18197. "attrs": {
  18198. "readonly": true,
  18199. "is-link": true,
  18200. "center": true,
  18201. "value": this.value,
  18202. "label": this.label,
  18203. "required": this.required,
  18204. "placeholder": this.placeholder
  18205. },
  18206. "on": {
  18207. "click": this.onClick
  18208. }
  18209. }, [h(popup, {
  18210. "attrs": {
  18211. "round": true,
  18212. "position": "bottom",
  18213. "getContainer": "body"
  18214. },
  18215. "slot": "extra",
  18216. "model": {
  18217. value: _this.showDatePicker,
  18218. callback: function callback($$v) {
  18219. _this.showDatePicker = $$v;
  18220. }
  18221. }
  18222. }, [h(datetime_picker, {
  18223. "attrs": {
  18224. "type": this.type,
  18225. "title": this.title,
  18226. "value": this.currentDate,
  18227. "minDate": this.minDate,
  18228. "formatter": this.formatter
  18229. },
  18230. "on": {
  18231. "cancel": this.onCancel,
  18232. "confirm": this.onConfirm
  18233. }
  18234. })])]);
  18235. }
  18236. }));
  18237. // CONCATENATED MODULE: ./es/sku/components/SkuMessages.js
  18238. // Utils
  18239. // Components
  18240. var SkuMessages_createNamespace = Object(create["a" /* createNamespace */])('sku-messages'),
  18241. SkuMessages_createComponent = SkuMessages_createNamespace[0],
  18242. SkuMessages_bem = SkuMessages_createNamespace[1],
  18243. SkuMessages_t = SkuMessages_createNamespace[2];
  18244. /* harmony default export */ var SkuMessages = (SkuMessages_createComponent({
  18245. props: {
  18246. messageConfig: Object,
  18247. goodsId: [Number, String],
  18248. messages: {
  18249. type: Array,
  18250. default: function _default() {
  18251. return [];
  18252. }
  18253. }
  18254. },
  18255. data: function data() {
  18256. return {
  18257. messageValues: this.resetMessageValues(this.messages)
  18258. };
  18259. },
  18260. watch: {
  18261. messages: function messages(val) {
  18262. this.messageValues = this.resetMessageValues(val);
  18263. }
  18264. },
  18265. methods: {
  18266. resetMessageValues: function resetMessageValues(messages) {
  18267. var messageConfig = this.messageConfig;
  18268. var _messageConfig$initia = messageConfig.initialMessages,
  18269. initialMessages = _messageConfig$initia === void 0 ? {} : _messageConfig$initia;
  18270. return (messages || []).map(function (message) {
  18271. return {
  18272. value: initialMessages[message.name] || ''
  18273. };
  18274. });
  18275. },
  18276. getType: function getType(message) {
  18277. if (+message.multiple === 1) {
  18278. return 'textarea';
  18279. }
  18280. if (message.type === 'id_no') {
  18281. return 'text';
  18282. }
  18283. return message.datetime > 0 ? 'datetime' : message.type;
  18284. },
  18285. getMessages: function getMessages() {
  18286. var messages = {};
  18287. this.messageValues.forEach(function (item, index) {
  18288. messages["message_" + index] = item.value;
  18289. });
  18290. return messages;
  18291. },
  18292. getCartMessages: function getCartMessages() {
  18293. var _this = this;
  18294. var messages = {};
  18295. this.messageValues.forEach(function (item, index) {
  18296. var message = _this.messages[index];
  18297. messages[message.name] = item.value;
  18298. });
  18299. return messages;
  18300. },
  18301. getPlaceholder: function getPlaceholder(message) {
  18302. var type = +message.multiple === 1 ? 'textarea' : message.type;
  18303. var map = this.messageConfig.placeholderMap || {};
  18304. return message.placeholder || map[type] || SkuMessages_t("placeholder." + type);
  18305. },
  18306. validateMessages: function validateMessages() {
  18307. var values = this.messageValues;
  18308. for (var i = 0; i < values.length; i++) {
  18309. var value = values[i].value;
  18310. var message = this.messages[i];
  18311. if (value === '') {
  18312. // 必填字段的校验
  18313. if (String(message.required) === '1') {
  18314. var textType = SkuMessages_t(message.type === 'image' ? 'upload' : 'fill');
  18315. return textType + message.name;
  18316. }
  18317. } else {
  18318. if (message.type === 'tel' && !Object(number["b" /* isNumeric */])(value)) {
  18319. return SkuMessages_t('invalid.tel');
  18320. }
  18321. if (message.type === 'mobile' && !/^\d{6,20}$/.test(value)) {
  18322. return SkuMessages_t('invalid.mobile');
  18323. }
  18324. if (message.type === 'email' && !isEmail(value)) {
  18325. return SkuMessages_t('invalid.email');
  18326. }
  18327. if (message.type === 'id_no' && (value.length < 15 || value.length > 18)) {
  18328. return SkuMessages_t('invalid.id_no');
  18329. }
  18330. }
  18331. }
  18332. },
  18333. /**
  18334. * The phone number copied from IOS mobile phone address book
  18335. * will add spaces and invisible Unicode characters
  18336. * which cannot pass the /^\d+$/ verification
  18337. * so keep numbers and dots
  18338. */
  18339. getFormatter: function getFormatter(message) {
  18340. return function formatter(value) {
  18341. if (message.type === 'mobile' || message.type === 'tel') {
  18342. return value.replace(/[^\d.]/g, '');
  18343. }
  18344. return value;
  18345. };
  18346. },
  18347. getExtraDesc: function getExtraDesc(message) {
  18348. var h = this.$createElement;
  18349. var extraDesc = message.extraDesc;
  18350. if (extraDesc) {
  18351. return h("div", {
  18352. "class": SkuMessages_bem('extra-message')
  18353. }, [extraDesc]);
  18354. }
  18355. },
  18356. genMessage: function genMessage(message, index) {
  18357. var _this2 = this;
  18358. var h = this.$createElement;
  18359. if (message.type === 'image') {
  18360. return h(cell, {
  18361. "key": this.goodsId + "-" + index,
  18362. "attrs": {
  18363. "title": message.name,
  18364. "required": String(message.required) === '1',
  18365. "valueClass": SkuMessages_bem('image-cell-value')
  18366. },
  18367. "class": SkuMessages_bem('image-cell')
  18368. }, [h(SkuImgUploader, {
  18369. "attrs": {
  18370. "maxSize": this.messageConfig.uploadMaxSize,
  18371. "uploadImg": this.messageConfig.uploadImg,
  18372. "customUpload": this.messageConfig.customUpload
  18373. },
  18374. "model": {
  18375. value: _this2.messageValues[index].value,
  18376. callback: function callback($$v) {
  18377. _this2.$set(_this2.messageValues[index], "value", $$v);
  18378. }
  18379. }
  18380. }), h("div", {
  18381. "class": SkuMessages_bem('image-cell-label')
  18382. }, [SkuMessages_t('imageLabel')])]);
  18383. } // 时间和日期使用的vant选择器
  18384. var isDateOrTime = ['date', 'time'].indexOf(message.type) > -1;
  18385. if (isDateOrTime) {
  18386. return h(SkuDateTimeField, {
  18387. "attrs": {
  18388. "label": message.name,
  18389. "required": String(message.required) === '1',
  18390. "placeholder": this.getPlaceholder(message),
  18391. "type": this.getType(message)
  18392. },
  18393. "key": this.goodsId + "-" + index,
  18394. "model": {
  18395. value: _this2.messageValues[index].value,
  18396. callback: function callback($$v) {
  18397. _this2.$set(_this2.messageValues[index], "value", $$v);
  18398. }
  18399. }
  18400. });
  18401. }
  18402. return h("div", {
  18403. "class": SkuMessages_bem('cell-block')
  18404. }, [h(es_field, {
  18405. "attrs": {
  18406. "maxlength": "200",
  18407. "center": !message.multiple,
  18408. "label": message.name,
  18409. "required": String(message.required) === '1',
  18410. "placeholder": this.getPlaceholder(message),
  18411. "type": this.getType(message),
  18412. "formatter": this.getFormatter(message),
  18413. "border": false
  18414. },
  18415. "key": this.goodsId + "-" + index,
  18416. "model": {
  18417. value: _this2.messageValues[index].value,
  18418. callback: function callback($$v) {
  18419. _this2.$set(_this2.messageValues[index], "value", $$v);
  18420. }
  18421. }
  18422. }), this.getExtraDesc(message)]);
  18423. }
  18424. },
  18425. render: function render() {
  18426. var h = arguments[0];
  18427. return h("div", {
  18428. "class": SkuMessages_bem()
  18429. }, [this.messages.map(this.genMessage)]);
  18430. }
  18431. }));
  18432. // CONCATENATED MODULE: ./es/sku/components/SkuActions.js
  18433. // Utils
  18434. // Components
  18435. // Types
  18436. var SkuActions_createNamespace = Object(create["a" /* createNamespace */])('sku-actions'),
  18437. SkuActions_createComponent = SkuActions_createNamespace[0],
  18438. SkuActions_bem = SkuActions_createNamespace[1],
  18439. SkuActions_t = SkuActions_createNamespace[2];
  18440. function SkuActions(h, props, slots, ctx) {
  18441. var createEmitter = function createEmitter(name) {
  18442. return function () {
  18443. props.skuEventBus.$emit(name);
  18444. };
  18445. };
  18446. return h("div", helper_default()([{
  18447. "class": SkuActions_bem()
  18448. }, inherit(ctx)]), [props.showAddCartBtn && h(es_button, {
  18449. "attrs": {
  18450. "size": "large",
  18451. "type": "warning",
  18452. "text": props.addCartText || SkuActions_t('addCart')
  18453. },
  18454. "on": {
  18455. "click": createEmitter('sku:addCart')
  18456. }
  18457. }), h(es_button, {
  18458. "attrs": {
  18459. "size": "large",
  18460. "type": "danger",
  18461. "text": props.buyText || SkuActions_t('buy')
  18462. },
  18463. "on": {
  18464. "click": createEmitter('sku:buy')
  18465. }
  18466. })]);
  18467. }
  18468. SkuActions.props = {
  18469. buyText: String,
  18470. addCartText: String,
  18471. skuEventBus: Object,
  18472. showAddCartBtn: Boolean
  18473. };
  18474. /* harmony default export */ var components_SkuActions = (SkuActions_createComponent(SkuActions));
  18475. // CONCATENATED MODULE: ./es/sku/Sku.js
  18476. var Sku_namespace = Object(create["a" /* createNamespace */])('sku');
  18477. var Sku_createComponent = Sku_namespace[0],
  18478. Sku_bem = Sku_namespace[1],
  18479. Sku_t = Sku_namespace[2];
  18480. var Sku_QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT;
  18481. /* harmony default export */ var Sku = (Sku_createComponent({
  18482. props: {
  18483. sku: Object,
  18484. goods: Object,
  18485. value: Boolean,
  18486. buyText: String,
  18487. goodsId: [Number, String],
  18488. priceTag: String,
  18489. lazyLoad: Boolean,
  18490. hideStock: Boolean,
  18491. properties: Array,
  18492. addCartText: String,
  18493. stepperTitle: String,
  18494. getContainer: [String, Function],
  18495. hideQuotaText: Boolean,
  18496. hideSelectedText: Boolean,
  18497. resetStepperOnHide: Boolean,
  18498. customSkuValidator: Function,
  18499. disableStepperInput: Boolean,
  18500. resetSelectedSkuOnHide: Boolean,
  18501. quota: {
  18502. type: Number,
  18503. default: 0
  18504. },
  18505. quotaUsed: {
  18506. type: Number,
  18507. default: 0
  18508. },
  18509. startSaleNum: {
  18510. type: Number,
  18511. default: 1
  18512. },
  18513. initialSku: {
  18514. type: Object,
  18515. default: function _default() {
  18516. return {};
  18517. }
  18518. },
  18519. stockThreshold: {
  18520. type: Number,
  18521. default: 50
  18522. },
  18523. showSoldoutSku: {
  18524. type: Boolean,
  18525. default: true
  18526. },
  18527. showAddCartBtn: {
  18528. type: Boolean,
  18529. default: true
  18530. },
  18531. disableSoldoutSku: {
  18532. type: Boolean,
  18533. default: true
  18534. },
  18535. customStepperConfig: {
  18536. type: Object,
  18537. default: function _default() {
  18538. return {};
  18539. }
  18540. },
  18541. showHeaderImage: {
  18542. type: Boolean,
  18543. default: true
  18544. },
  18545. previewOnClickImage: {
  18546. type: Boolean,
  18547. default: true
  18548. },
  18549. safeAreaInsetBottom: {
  18550. type: Boolean,
  18551. default: true
  18552. },
  18553. closeOnClickOverlay: {
  18554. type: Boolean,
  18555. default: true
  18556. },
  18557. bodyOffsetTop: {
  18558. type: Number,
  18559. default: 200
  18560. },
  18561. messageConfig: {
  18562. type: Object,
  18563. default: function _default() {
  18564. return {
  18565. initialMessages: {},
  18566. placeholderMap: {},
  18567. uploadImg: function uploadImg() {
  18568. return Promise.resolve();
  18569. },
  18570. uploadMaxSize: 5
  18571. };
  18572. }
  18573. }
  18574. },
  18575. data: function data() {
  18576. return {
  18577. selectedSku: {},
  18578. selectedProp: {},
  18579. selectedNum: 1,
  18580. show: this.value
  18581. };
  18582. },
  18583. watch: {
  18584. show: function show(val) {
  18585. this.$emit('input', val);
  18586. if (!val) {
  18587. this.$emit('sku-close', {
  18588. selectedSkuValues: this.selectedSkuValues,
  18589. selectedNum: this.selectedNum,
  18590. selectedSkuComb: this.selectedSkuComb
  18591. });
  18592. if (this.resetStepperOnHide) {
  18593. this.resetStepper();
  18594. }
  18595. if (this.resetSelectedSkuOnHide) {
  18596. this.resetSelectedSku();
  18597. }
  18598. }
  18599. },
  18600. value: function value(val) {
  18601. this.show = val;
  18602. },
  18603. skuTree: 'resetSelectedSku',
  18604. initialSku: function initialSku() {
  18605. this.resetStepper();
  18606. this.resetSelectedSku();
  18607. }
  18608. },
  18609. computed: {
  18610. skuGroupClass: function skuGroupClass() {
  18611. return ['van-sku-group-container', {
  18612. 'van-sku-group-container--hide-soldout': !this.showSoldoutSku
  18613. }];
  18614. },
  18615. bodyStyle: function bodyStyle() {
  18616. if (this.$isServer) {
  18617. return;
  18618. }
  18619. var maxHeight = window.innerHeight - this.bodyOffsetTop;
  18620. return {
  18621. maxHeight: maxHeight + 'px'
  18622. };
  18623. },
  18624. isSkuCombSelected: function isSkuCombSelected() {
  18625. var _this = this; // SKU 未选完
  18626. if (this.hasSku && !sku_helper_isAllSelected(this.skuTree, this.selectedSku)) {
  18627. return false;
  18628. } // 属性未全选
  18629. return !this.propList.filter(function (i) {
  18630. return i.is_necessary !== false;
  18631. }).some(function (i) {
  18632. return (_this.selectedProp[i.k_id] || []).length === 0;
  18633. });
  18634. },
  18635. isSkuEmpty: function isSkuEmpty() {
  18636. return Object.keys(this.sku).length === 0;
  18637. },
  18638. hasSku: function hasSku() {
  18639. return !this.sku.none_sku;
  18640. },
  18641. hasSkuOrAttr: function hasSkuOrAttr() {
  18642. return this.hasSku || this.propList.length > 0;
  18643. },
  18644. selectedSkuComb: function selectedSkuComb() {
  18645. var skuComb = null;
  18646. if (this.isSkuCombSelected) {
  18647. if (this.hasSku) {
  18648. skuComb = getSkuComb(this.skuList, this.selectedSku);
  18649. } else {
  18650. skuComb = {
  18651. id: this.sku.collection_id,
  18652. price: Math.round(this.sku.price * 100),
  18653. stock_num: this.sku.stock_num
  18654. };
  18655. }
  18656. if (skuComb) {
  18657. skuComb.properties = sku_helper_getSelectedProperties(this.propList, this.selectedProp);
  18658. skuComb.property_price = this.selectedPropValues.reduce(function (acc, cur) {
  18659. return acc + (cur.price || 0);
  18660. }, 0);
  18661. }
  18662. }
  18663. return skuComb;
  18664. },
  18665. selectedSkuValues: function selectedSkuValues() {
  18666. return sku_helper_getSelectedSkuValues(this.skuTree, this.selectedSku);
  18667. },
  18668. selectedPropValues: function selectedPropValues() {
  18669. return sku_helper_getSelectedPropValues(this.propList, this.selectedProp);
  18670. },
  18671. price: function price() {
  18672. if (this.selectedSkuComb) {
  18673. return ((this.selectedSkuComb.price + this.selectedSkuComb.property_price) / 100).toFixed(2);
  18674. } // sku.price是一个格式化好的价格区间
  18675. return this.sku.price;
  18676. },
  18677. originPrice: function originPrice() {
  18678. if (this.selectedSkuComb && this.selectedSkuComb.origin_price) {
  18679. return ((this.selectedSkuComb.origin_price + this.selectedSkuComb.property_price) / 100).toFixed(2);
  18680. }
  18681. return this.sku.origin_price;
  18682. },
  18683. skuTree: function skuTree() {
  18684. return this.sku.tree || [];
  18685. },
  18686. skuList: function skuList() {
  18687. return this.sku.list || [];
  18688. },
  18689. propList: function propList() {
  18690. return this.properties || [];
  18691. },
  18692. imageList: function imageList() {
  18693. var imageList = [this.goods.picture];
  18694. if (this.skuTree.length > 0) {
  18695. this.skuTree.forEach(function (treeItem) {
  18696. if (!treeItem.v) {
  18697. return;
  18698. }
  18699. treeItem.v.forEach(function (vItem) {
  18700. var imgUrl = vItem.previewImgUrl || vItem.imgUrl || vItem.img_url;
  18701. if (imgUrl && imageList.indexOf(imgUrl) === -1) {
  18702. imageList.push(imgUrl);
  18703. }
  18704. });
  18705. });
  18706. }
  18707. return imageList;
  18708. },
  18709. stock: function stock() {
  18710. var stockNum = this.customStepperConfig.stockNum;
  18711. if (stockNum !== undefined) {
  18712. return stockNum;
  18713. }
  18714. if (this.selectedSkuComb) {
  18715. return this.selectedSkuComb.stock_num;
  18716. }
  18717. return this.sku.stock_num;
  18718. },
  18719. stockText: function stockText() {
  18720. var h = this.$createElement;
  18721. var stockFormatter = this.customStepperConfig.stockFormatter;
  18722. if (stockFormatter) {
  18723. return stockFormatter(this.stock);
  18724. }
  18725. return [Sku_t('stock') + " ", h("span", {
  18726. "class": Sku_bem('stock-num', {
  18727. highlight: this.stock < this.stockThreshold
  18728. })
  18729. }, [this.stock]), " " + Sku_t('stockUnit')];
  18730. },
  18731. selectedText: function selectedText() {
  18732. var _this2 = this;
  18733. if (this.selectedSkuComb) {
  18734. var values = this.selectedSkuValues.concat(this.selectedPropValues);
  18735. return Sku_t('selected') + " " + values.map(function (item) {
  18736. return item.name;
  18737. }).join(' ');
  18738. }
  18739. var unselectedSku = this.skuTree.filter(function (item) {
  18740. return _this2.selectedSku[item.k_s] === UNSELECTED_SKU_VALUE_ID;
  18741. }).map(function (item) {
  18742. return item.k;
  18743. });
  18744. var unselectedProp = this.propList.filter(function (item) {
  18745. return (_this2.selectedProp[item.k_id] || []).length < 1;
  18746. }).map(function (item) {
  18747. return item.k;
  18748. });
  18749. return Sku_t('select') + " " + unselectedSku.concat(unselectedProp).join(' ');
  18750. }
  18751. },
  18752. created: function created() {
  18753. var skuEventBus = new external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a();
  18754. this.skuEventBus = skuEventBus;
  18755. skuEventBus.$on('sku:select', this.onSelect);
  18756. skuEventBus.$on('sku:propSelect', this.onPropSelect);
  18757. skuEventBus.$on('sku:numChange', this.onNumChange);
  18758. skuEventBus.$on('sku:previewImage', this.onPreviewImage);
  18759. skuEventBus.$on('sku:overLimit', this.onOverLimit);
  18760. skuEventBus.$on('sku:stepperState', this.onStepperState);
  18761. skuEventBus.$on('sku:addCart', this.onAddCart);
  18762. skuEventBus.$on('sku:buy', this.onBuy);
  18763. this.resetStepper();
  18764. this.resetSelectedSku(); // 组件初始化后的钩子,抛出skuEventBus
  18765. this.$emit('after-sku-create', skuEventBus);
  18766. },
  18767. methods: {
  18768. resetStepper: function resetStepper() {
  18769. var skuStepper = this.$refs.skuStepper;
  18770. var selectedNum = this.initialSku.selectedNum;
  18771. var num = selectedNum != null ? selectedNum : this.startSaleNum; // 用来缓存不合法的情况
  18772. this.stepperError = null;
  18773. if (skuStepper) {
  18774. skuStepper.setCurrentNum(num);
  18775. } else {
  18776. // 当首次加载(skuStepper 为空)时,传入数量如果不合法,可能会存在问题
  18777. this.selectedNum = num;
  18778. }
  18779. },
  18780. // @exposed-api
  18781. resetSelectedSku: function resetSelectedSku() {
  18782. var _this3 = this;
  18783. this.selectedSku = {}; // 重置 selectedSku
  18784. this.skuTree.forEach(function (item) {
  18785. _this3.selectedSku[item.k_s] = UNSELECTED_SKU_VALUE_ID;
  18786. });
  18787. this.skuTree.forEach(function (item) {
  18788. var key = item.k_s; // 规格值只有1个时,优先判断
  18789. var valueId = item.v.length === 1 ? item.v[0].id : _this3.initialSku[key];
  18790. if (valueId && sku_helper_isSkuChoosable(_this3.skuList, _this3.selectedSku, {
  18791. key: key,
  18792. valueId: valueId
  18793. })) {
  18794. _this3.selectedSku[key] = valueId;
  18795. }
  18796. });
  18797. var skuValues = this.selectedSkuValues;
  18798. if (skuValues.length > 0) {
  18799. this.$nextTick(function () {
  18800. _this3.$emit('sku-selected', {
  18801. skuValue: skuValues[skuValues.length - 1],
  18802. selectedSku: _this3.selectedSku,
  18803. selectedSkuComb: _this3.selectedSkuComb
  18804. });
  18805. });
  18806. } // 重置商品属性
  18807. this.selectedProp = {};
  18808. var _this$initialSku$sele = this.initialSku.selectedProp,
  18809. selectedProp = _this$initialSku$sele === void 0 ? {} : _this$initialSku$sele; // 选中外部传入信息
  18810. this.propList.forEach(function (item) {
  18811. if (selectedProp[item.k_id]) {
  18812. _this3.selectedProp[item.k_id] = selectedProp[item.k_id];
  18813. }
  18814. });
  18815. if (Object(utils["d" /* isEmpty */])(this.selectedProp)) {
  18816. this.propList.forEach(function (item) {
  18817. var _item$v; // 没有加价的属性,默认选中第一个
  18818. if ((item == null ? void 0 : (_item$v = item.v) == null ? void 0 : _item$v.length) > 0) {
  18819. var v = item.v,
  18820. k_id = item.k_id;
  18821. var isHasConfigPrice = v.some(function (i) {
  18822. return +i.price !== 0;
  18823. }); // 没有加价属性
  18824. if (!isHasConfigPrice) {
  18825. // 找到第一个不被禁用的属性
  18826. // 历史如果没有 text_status 字段的,就相当于沿用直接原来的逻辑取第一个属性
  18827. var firstEnableProp = v.find(function (prop) {
  18828. return prop.text_status !== 0;
  18829. });
  18830. if (firstEnableProp) {
  18831. _this3.selectedProp[k_id] = [firstEnableProp.id];
  18832. }
  18833. }
  18834. }
  18835. });
  18836. }
  18837. var propValues = this.selectedPropValues;
  18838. if (propValues.length > 0) {
  18839. this.$emit('sku-prop-selected', {
  18840. propValue: propValues[propValues.length - 1],
  18841. selectedProp: this.selectedProp,
  18842. selectedSkuComb: this.selectedSkuComb
  18843. });
  18844. } // 抛出重置事件
  18845. this.$emit('sku-reset', {
  18846. selectedSku: this.selectedSku,
  18847. selectedProp: this.selectedProp,
  18848. selectedSkuComb: this.selectedSkuComb
  18849. });
  18850. this.centerInitialSku();
  18851. },
  18852. getSkuMessages: function getSkuMessages() {
  18853. return this.$refs.skuMessages ? this.$refs.skuMessages.getMessages() : {};
  18854. },
  18855. getSkuCartMessages: function getSkuCartMessages() {
  18856. return this.$refs.skuMessages ? this.$refs.skuMessages.getCartMessages() : {};
  18857. },
  18858. validateSkuMessages: function validateSkuMessages() {
  18859. return this.$refs.skuMessages ? this.$refs.skuMessages.validateMessages() : '';
  18860. },
  18861. validateSku: function validateSku() {
  18862. if (this.selectedNum === 0) {
  18863. return Sku_t('unavailable');
  18864. }
  18865. if (this.isSkuCombSelected) {
  18866. return this.validateSkuMessages();
  18867. } // 自定义sku校验
  18868. if (this.customSkuValidator) {
  18869. var err = this.customSkuValidator(this);
  18870. if (err) return err;
  18871. }
  18872. return Sku_t('selectSku');
  18873. },
  18874. onSelect: function onSelect(skuValue) {
  18875. var _extends2, _extends3; // 点击已选中的sku时则取消选中
  18876. this.selectedSku = this.selectedSku[skuValue.skuKeyStr] === skuValue.id ? _extends({}, this.selectedSku, (_extends2 = {}, _extends2[skuValue.skuKeyStr] = UNSELECTED_SKU_VALUE_ID, _extends2)) : _extends({}, this.selectedSku, (_extends3 = {}, _extends3[skuValue.skuKeyStr] = skuValue.id, _extends3));
  18877. this.$emit('sku-selected', {
  18878. skuValue: skuValue,
  18879. selectedSku: this.selectedSku,
  18880. selectedSkuComb: this.selectedSkuComb
  18881. });
  18882. },
  18883. onPropSelect: function onPropSelect(propValue) {
  18884. var _extends4;
  18885. var arr = this.selectedProp[propValue.skuKeyStr] || [];
  18886. var pos = arr.indexOf(propValue.id);
  18887. if (pos > -1) {
  18888. arr.splice(pos, 1);
  18889. } else if (propValue.multiple) {
  18890. arr.push(propValue.id);
  18891. } else {
  18892. arr.splice(0, 1, propValue.id);
  18893. }
  18894. this.selectedProp = _extends({}, this.selectedProp, (_extends4 = {}, _extends4[propValue.skuKeyStr] = arr, _extends4));
  18895. this.$emit('sku-prop-selected', {
  18896. propValue: propValue,
  18897. selectedProp: this.selectedProp,
  18898. selectedSkuComb: this.selectedSkuComb
  18899. });
  18900. },
  18901. onNumChange: function onNumChange(num) {
  18902. this.selectedNum = num;
  18903. },
  18904. onPreviewImage: function onPreviewImage(selectedValue) {
  18905. var _this4 = this;
  18906. var imageList = this.imageList;
  18907. var index = 0;
  18908. var indexImage = imageList[0];
  18909. if (selectedValue && selectedValue.imgUrl) {
  18910. this.imageList.some(function (image, pos) {
  18911. if (image === selectedValue.imgUrl) {
  18912. index = pos;
  18913. return true;
  18914. }
  18915. return false;
  18916. });
  18917. indexImage = selectedValue.imgUrl;
  18918. }
  18919. var params = _extends({}, selectedValue, {
  18920. index: index,
  18921. imageList: this.imageList,
  18922. indexImage: indexImage
  18923. });
  18924. this.$emit('open-preview', params);
  18925. if (!this.previewOnClickImage) {
  18926. return;
  18927. }
  18928. image_preview({
  18929. images: this.imageList,
  18930. startPosition: index,
  18931. onClose: function onClose() {
  18932. _this4.$emit('close-preview', params);
  18933. }
  18934. });
  18935. },
  18936. onOverLimit: function onOverLimit(data) {
  18937. var action = data.action,
  18938. limitType = data.limitType,
  18939. quota = data.quota,
  18940. quotaUsed = data.quotaUsed;
  18941. var handleOverLimit = this.customStepperConfig.handleOverLimit;
  18942. if (handleOverLimit) {
  18943. handleOverLimit(data);
  18944. return;
  18945. }
  18946. if (action === 'minus') {
  18947. if (this.startSaleNum > 1) {
  18948. es_toast(Sku_t('minusStartTip', this.startSaleNum));
  18949. } else {
  18950. es_toast(Sku_t('minusTip'));
  18951. }
  18952. } else if (action === 'plus') {
  18953. if (limitType === Sku_QUOTA_LIMIT) {
  18954. if (quotaUsed > 0) {
  18955. es_toast(Sku_t('quotaUsedTip', quota, quotaUsed));
  18956. } else {
  18957. es_toast(Sku_t('quotaTip', quota));
  18958. }
  18959. } else {
  18960. es_toast(Sku_t('soldout'));
  18961. }
  18962. }
  18963. },
  18964. onStepperState: function onStepperState(data) {
  18965. this.stepperError = data.valid ? null : _extends({}, data, {
  18966. action: 'plus'
  18967. });
  18968. },
  18969. onAddCart: function onAddCart() {
  18970. this.onBuyOrAddCart('add-cart');
  18971. },
  18972. onBuy: function onBuy() {
  18973. this.onBuyOrAddCart('buy-clicked');
  18974. },
  18975. onBuyOrAddCart: function onBuyOrAddCart(type) {
  18976. // sku 不符合购买条件
  18977. if (this.stepperError) {
  18978. return this.onOverLimit(this.stepperError);
  18979. }
  18980. var error = this.validateSku();
  18981. if (error) {
  18982. es_toast(error);
  18983. } else {
  18984. this.$emit(type, this.getSkuData());
  18985. }
  18986. },
  18987. // @exposed-api
  18988. getSkuData: function getSkuData() {
  18989. return {
  18990. goodsId: this.goodsId,
  18991. messages: this.getSkuMessages(),
  18992. selectedNum: this.selectedNum,
  18993. cartMessages: this.getSkuCartMessages(),
  18994. selectedSkuComb: this.selectedSkuComb
  18995. };
  18996. },
  18997. // 当 popup 完全打开后执行
  18998. onOpened: function onOpened() {
  18999. this.centerInitialSku();
  19000. },
  19001. centerInitialSku: function centerInitialSku() {
  19002. var _this5 = this;
  19003. (this.$refs.skuRows || []).forEach(function (it) {
  19004. var _ref = it.skuRow || {},
  19005. k_s = _ref.k_s;
  19006. it.centerItem(_this5.initialSku[k_s]);
  19007. });
  19008. }
  19009. },
  19010. render: function render() {
  19011. var _this6 = this;
  19012. var h = arguments[0];
  19013. if (this.isSkuEmpty) {
  19014. return;
  19015. }
  19016. var sku = this.sku,
  19017. skuList = this.skuList,
  19018. goods = this.goods,
  19019. price = this.price,
  19020. lazyLoad = this.lazyLoad,
  19021. originPrice = this.originPrice,
  19022. skuEventBus = this.skuEventBus,
  19023. selectedSku = this.selectedSku,
  19024. selectedProp = this.selectedProp,
  19025. selectedNum = this.selectedNum,
  19026. stepperTitle = this.stepperTitle,
  19027. selectedSkuComb = this.selectedSkuComb,
  19028. showHeaderImage = this.showHeaderImage,
  19029. disableSoldoutSku = this.disableSoldoutSku;
  19030. var slotsProps = {
  19031. price: price,
  19032. originPrice: originPrice,
  19033. selectedNum: selectedNum,
  19034. skuEventBus: skuEventBus,
  19035. selectedSku: selectedSku,
  19036. selectedSkuComb: selectedSkuComb
  19037. };
  19038. var slots = function slots(name) {
  19039. return _this6.slots(name, slotsProps);
  19040. };
  19041. var Header = slots('sku-header') || h(components_SkuHeader, {
  19042. "attrs": {
  19043. "sku": sku,
  19044. "goods": goods,
  19045. "skuEventBus": skuEventBus,
  19046. "selectedSku": selectedSku,
  19047. "showHeaderImage": showHeaderImage
  19048. }
  19049. }, [h("template", {
  19050. "slot": "sku-header-image-extra"
  19051. }, [slots('sku-header-image-extra')]), slots('sku-header-price') || h("div", {
  19052. "class": "van-sku__goods-price"
  19053. }, [h("span", {
  19054. "class": "van-sku__price-symbol"
  19055. }, ["\uFFE5"]), h("span", {
  19056. "class": "van-sku__price-num"
  19057. }, [price]), this.priceTag && h("span", {
  19058. "class": "van-sku__price-tag"
  19059. }, [this.priceTag])]), slots('sku-header-origin-price') || originPrice && h(SkuHeaderItem, [Sku_t('originPrice'), " \uFFE5", originPrice]), !this.hideStock && h(SkuHeaderItem, [h("span", {
  19060. "class": "van-sku__stock"
  19061. }, [this.stockText])]), this.hasSkuOrAttr && !this.hideSelectedText && h(SkuHeaderItem, [this.selectedText]), slots('sku-header-extra')]);
  19062. var Group = slots('sku-group') || this.hasSkuOrAttr && h("div", {
  19063. "class": this.skuGroupClass
  19064. }, [this.skuTree.map(function (skuTreeItem) {
  19065. return h(SkuRow, {
  19066. "attrs": {
  19067. "skuRow": skuTreeItem
  19068. },
  19069. "ref": "skuRows",
  19070. "refInFor": true
  19071. }, [skuTreeItem.v.map(function (skuValue) {
  19072. return h(SkuRowItem, {
  19073. "attrs": {
  19074. "skuList": skuList,
  19075. "lazyLoad": lazyLoad,
  19076. "skuValue": skuValue,
  19077. "skuKeyStr": skuTreeItem.k_s,
  19078. "selectedSku": selectedSku,
  19079. "skuEventBus": skuEventBus,
  19080. "disableSoldoutSku": disableSoldoutSku,
  19081. "largeImageMode": skuTreeItem.largeImageMode
  19082. }
  19083. });
  19084. })]);
  19085. }), this.propList.map(function (skuTreeItem) {
  19086. return h(SkuRow, {
  19087. "attrs": {
  19088. "skuRow": skuTreeItem
  19089. }
  19090. }, [skuTreeItem.v.map(function (skuValue) {
  19091. return h(SkuRowPropItem, {
  19092. "attrs": {
  19093. "skuValue": skuValue,
  19094. "skuKeyStr": skuTreeItem.k_id + '',
  19095. "selectedProp": selectedProp,
  19096. "skuEventBus": skuEventBus,
  19097. "multiple": skuTreeItem.is_multiple,
  19098. "disabled": skuValue.text_status === 0
  19099. }
  19100. });
  19101. })]);
  19102. })]);
  19103. var Stepper = slots('sku-stepper') || h(SkuStepper, {
  19104. "ref": "skuStepper",
  19105. "attrs": {
  19106. "stock": this.stock,
  19107. "quota": this.quota,
  19108. "quotaUsed": this.quotaUsed,
  19109. "startSaleNum": this.startSaleNum,
  19110. "skuEventBus": skuEventBus,
  19111. "selectedNum": selectedNum,
  19112. "stepperTitle": stepperTitle,
  19113. "skuStockNum": sku.stock_num,
  19114. "disableStepperInput": this.disableStepperInput,
  19115. "customStepperConfig": this.customStepperConfig,
  19116. "hideQuotaText": this.hideQuotaText
  19117. },
  19118. "on": {
  19119. "change": function change(event) {
  19120. _this6.$emit('stepper-change', event);
  19121. }
  19122. }
  19123. });
  19124. var Messages = slots('sku-messages') || h(SkuMessages, {
  19125. "ref": "skuMessages",
  19126. "attrs": {
  19127. "goodsId": this.goodsId,
  19128. "messageConfig": this.messageConfig,
  19129. "messages": sku.messages
  19130. }
  19131. });
  19132. var Actions = slots('sku-actions') || h(components_SkuActions, {
  19133. "attrs": {
  19134. "buyText": this.buyText,
  19135. "skuEventBus": skuEventBus,
  19136. "addCartText": this.addCartText,
  19137. "showAddCartBtn": this.showAddCartBtn
  19138. }
  19139. });
  19140. return h(popup, {
  19141. "attrs": {
  19142. "round": true,
  19143. "closeable": true,
  19144. "position": "bottom",
  19145. "getContainer": this.getContainer,
  19146. "closeOnClickOverlay": this.closeOnClickOverlay,
  19147. "safeAreaInsetBottom": this.safeAreaInsetBottom
  19148. },
  19149. "class": "van-sku-container",
  19150. "on": {
  19151. "opened": this.onOpened
  19152. },
  19153. "model": {
  19154. value: _this6.show,
  19155. callback: function callback($$v) {
  19156. _this6.show = $$v;
  19157. }
  19158. }
  19159. }, [Header, h("div", {
  19160. "class": "van-sku-body",
  19161. "style": this.bodyStyle
  19162. }, [slots('sku-body-top'), Group, slots('extra-sku-group'), Stepper, slots('before-sku-messages'), Messages, slots('after-sku-messages')]), slots('sku-actions-top'), Actions]);
  19163. }
  19164. }));
  19165. // CONCATENATED MODULE: ./es/sku/index.js
  19166. // Utils
  19167. // Components
  19168. locale["a" /* default */].add(lang);
  19169. Sku.SkuActions = components_SkuActions;
  19170. Sku.SkuHeader = components_SkuHeader;
  19171. Sku.SkuHeaderItem = SkuHeaderItem;
  19172. Sku.SkuMessages = SkuMessages;
  19173. Sku.SkuStepper = SkuStepper;
  19174. Sku.SkuRow = SkuRow;
  19175. Sku.SkuRowItem = SkuRowItem;
  19176. Sku.SkuRowPropItem = SkuRowPropItem;
  19177. Sku.skuHelper = sku_helper;
  19178. Sku.skuConstants = constants;
  19179. /* harmony default export */ var es_sku = (Sku);
  19180. // CONCATENATED MODULE: ./es/slider/index.js
  19181. var slider_createNamespace = Object(create["a" /* createNamespace */])('slider'),
  19182. slider_createComponent = slider_createNamespace[0],
  19183. slider_bem = slider_createNamespace[1];
  19184. var isSameValue = function isSameValue(newValue, oldValue) {
  19185. return JSON.stringify(newValue) === JSON.stringify(oldValue);
  19186. };
  19187. /* harmony default export */ var slider = (slider_createComponent({
  19188. mixins: [TouchMixin, FieldMixin],
  19189. props: {
  19190. disabled: Boolean,
  19191. vertical: Boolean,
  19192. range: Boolean,
  19193. barHeight: [Number, String],
  19194. buttonSize: [Number, String],
  19195. activeColor: String,
  19196. inactiveColor: String,
  19197. min: {
  19198. type: [Number, String],
  19199. default: 0
  19200. },
  19201. max: {
  19202. type: [Number, String],
  19203. default: 100
  19204. },
  19205. step: {
  19206. type: [Number, String],
  19207. default: 1
  19208. },
  19209. value: {
  19210. type: [Number, Array],
  19211. default: 0
  19212. }
  19213. },
  19214. data: function data() {
  19215. return {
  19216. dragStatus: ''
  19217. };
  19218. },
  19219. computed: {
  19220. scope: function scope() {
  19221. return this.max - this.min;
  19222. },
  19223. buttonStyle: function buttonStyle() {
  19224. if (this.buttonSize) {
  19225. var size = Object(unit["a" /* addUnit */])(this.buttonSize);
  19226. return {
  19227. width: size,
  19228. height: size
  19229. };
  19230. }
  19231. }
  19232. },
  19233. created: function created() {
  19234. // format initial value
  19235. this.updateValue(this.value);
  19236. },
  19237. mounted: function mounted() {
  19238. if (this.range) {
  19239. this.bindTouchEvent(this.$refs.wrapper0);
  19240. this.bindTouchEvent(this.$refs.wrapper1);
  19241. } else {
  19242. this.bindTouchEvent(this.$refs.wrapper);
  19243. }
  19244. },
  19245. methods: {
  19246. onTouchStart: function onTouchStart(event) {
  19247. if (this.disabled) {
  19248. return;
  19249. }
  19250. this.touchStart(event);
  19251. this.currentValue = this.value;
  19252. if (this.range) {
  19253. this.startValue = this.value.map(this.format);
  19254. } else {
  19255. this.startValue = this.format(this.value);
  19256. }
  19257. this.dragStatus = 'start';
  19258. },
  19259. onTouchMove: function onTouchMove(event) {
  19260. if (this.disabled) {
  19261. return;
  19262. }
  19263. if (this.dragStatus === 'start') {
  19264. this.$emit('drag-start');
  19265. }
  19266. preventDefault(event, true);
  19267. this.touchMove(event);
  19268. this.dragStatus = 'draging';
  19269. var rect = this.$el.getBoundingClientRect();
  19270. var delta = this.vertical ? this.deltaY : this.deltaX;
  19271. var total = this.vertical ? rect.height : rect.width;
  19272. var diff = delta / total * this.scope;
  19273. if (this.range) {
  19274. this.currentValue[this.index] = this.startValue[this.index] + diff;
  19275. } else {
  19276. this.currentValue = this.startValue + diff;
  19277. }
  19278. this.updateValue(this.currentValue);
  19279. },
  19280. onTouchEnd: function onTouchEnd() {
  19281. if (this.disabled) {
  19282. return;
  19283. }
  19284. if (this.dragStatus === 'draging') {
  19285. this.updateValue(this.currentValue, true);
  19286. this.$emit('drag-end');
  19287. }
  19288. this.dragStatus = '';
  19289. },
  19290. onClick: function onClick(event) {
  19291. event.stopPropagation();
  19292. if (this.disabled) return;
  19293. var rect = this.$el.getBoundingClientRect();
  19294. var delta = this.vertical ? event.clientY - rect.top : event.clientX - rect.left;
  19295. var total = this.vertical ? rect.height : rect.width;
  19296. var value = +this.min + delta / total * this.scope;
  19297. if (this.range) {
  19298. var _this$value = this.value,
  19299. left = _this$value[0],
  19300. right = _this$value[1];
  19301. var middle = (left + right) / 2;
  19302. if (value <= middle) {
  19303. left = value;
  19304. } else {
  19305. right = value;
  19306. }
  19307. value = [left, right];
  19308. }
  19309. this.startValue = this.value;
  19310. this.updateValue(value, true);
  19311. },
  19312. // 处理两个滑块重叠之后的情况
  19313. handleOverlap: function handleOverlap(value) {
  19314. if (value[0] > value[1]) {
  19315. value = deepClone(value);
  19316. return value.reverse();
  19317. }
  19318. return value;
  19319. },
  19320. updateValue: function updateValue(value, end) {
  19321. if (this.range) {
  19322. value = this.handleOverlap(value).map(this.format);
  19323. } else {
  19324. value = this.format(value);
  19325. }
  19326. if (!isSameValue(value, this.value)) {
  19327. this.$emit('input', value);
  19328. }
  19329. if (end && !isSameValue(value, this.startValue)) {
  19330. this.$emit('change', value);
  19331. }
  19332. },
  19333. format: function format(value) {
  19334. var min = +this.min;
  19335. var max = +this.max;
  19336. var step = +this.step;
  19337. value = range(value, min, max);
  19338. var diff = Math.round((value - min) / step) * step;
  19339. return addNumber(min, diff);
  19340. }
  19341. },
  19342. render: function render() {
  19343. var _wrapperStyle,
  19344. _this = this,
  19345. _barStyle;
  19346. var h = arguments[0];
  19347. var vertical = this.vertical;
  19348. var mainAxis = vertical ? 'height' : 'width';
  19349. var crossAxis = vertical ? 'width' : 'height';
  19350. var wrapperStyle = (_wrapperStyle = {
  19351. background: this.inactiveColor
  19352. }, _wrapperStyle[crossAxis] = Object(unit["a" /* addUnit */])(this.barHeight), _wrapperStyle); // 计算选中条的长度百分比
  19353. var calcMainAxis = function calcMainAxis() {
  19354. var value = _this.value,
  19355. min = _this.min,
  19356. range = _this.range,
  19357. scope = _this.scope;
  19358. if (range) {
  19359. return (value[1] - value[0]) * 100 / scope + "%";
  19360. }
  19361. return (value - min) * 100 / scope + "%";
  19362. }; // 计算选中条的开始位置的偏移量
  19363. var calcOffset = function calcOffset() {
  19364. var value = _this.value,
  19365. min = _this.min,
  19366. range = _this.range,
  19367. scope = _this.scope;
  19368. if (range) {
  19369. return (value[0] - min) * 100 / scope + "%";
  19370. }
  19371. return null;
  19372. };
  19373. var barStyle = (_barStyle = {}, _barStyle[mainAxis] = calcMainAxis(), _barStyle.left = this.vertical ? null : calcOffset(), _barStyle.top = this.vertical ? calcOffset() : null, _barStyle.background = this.activeColor, _barStyle);
  19374. if (this.dragStatus) {
  19375. barStyle.transition = 'none';
  19376. }
  19377. var renderButton = function renderButton(i) {
  19378. var map = ['left', 'right'];
  19379. var isNumber = typeof i === 'number';
  19380. var current = isNumber ? _this.value[i] : _this.value;
  19381. var getClassName = function getClassName() {
  19382. if (isNumber) {
  19383. return "button-wrapper-" + map[i];
  19384. }
  19385. return "button-wrapper";
  19386. };
  19387. var getRefName = function getRefName() {
  19388. if (isNumber) {
  19389. return "wrapper" + i;
  19390. }
  19391. return "wrapper";
  19392. };
  19393. var renderButtonContent = function renderButtonContent() {
  19394. if (isNumber) {
  19395. var slot = _this.slots(i === 0 ? 'left-button' : 'right-button', {
  19396. value: current
  19397. });
  19398. if (slot) {
  19399. return slot;
  19400. }
  19401. }
  19402. if (_this.slots('button')) {
  19403. return _this.slots('button');
  19404. }
  19405. return h("div", {
  19406. "class": slider_bem('button'),
  19407. "style": _this.buttonStyle
  19408. });
  19409. };
  19410. return h("div", {
  19411. "ref": getRefName(),
  19412. "attrs": {
  19413. "role": "slider",
  19414. "tabindex": _this.disabled ? -1 : 0,
  19415. "aria-valuemin": _this.min,
  19416. "aria-valuenow": _this.value,
  19417. "aria-valuemax": _this.max,
  19418. "aria-orientation": _this.vertical ? 'vertical' : 'horizontal'
  19419. },
  19420. "class": slider_bem(getClassName()),
  19421. "on": {
  19422. "touchstart": function touchstart() {
  19423. if (isNumber) {
  19424. // 保存当前按钮的索引
  19425. _this.index = i;
  19426. }
  19427. },
  19428. "click": function click(e) {
  19429. return e.stopPropagation();
  19430. }
  19431. }
  19432. }, [renderButtonContent()]);
  19433. };
  19434. return h("div", {
  19435. "style": wrapperStyle,
  19436. "class": slider_bem({
  19437. disabled: this.disabled,
  19438. vertical: vertical
  19439. }),
  19440. "on": {
  19441. "click": this.onClick
  19442. }
  19443. }, [h("div", {
  19444. "class": slider_bem('bar'),
  19445. "style": barStyle
  19446. }, [this.range ? [renderButton(0), renderButton(1)] : renderButton()])]);
  19447. }
  19448. }));
  19449. // CONCATENATED MODULE: ./es/step/index.js
  19450. var step_createNamespace = Object(create["a" /* createNamespace */])('step'),
  19451. step_createComponent = step_createNamespace[0],
  19452. step_bem = step_createNamespace[1];
  19453. /* harmony default export */ var es_step = (step_createComponent({
  19454. mixins: [ChildrenMixin('vanSteps')],
  19455. computed: {
  19456. status: function status() {
  19457. if (this.index < this.parent.active) {
  19458. return 'finish';
  19459. }
  19460. if (this.index === +this.parent.active) {
  19461. return 'process';
  19462. }
  19463. },
  19464. active: function active() {
  19465. return this.status === 'process';
  19466. },
  19467. lineStyle: function lineStyle() {
  19468. var _this$parent = this.parent,
  19469. activeColor = _this$parent.activeColor,
  19470. inactiveColor = _this$parent.inactiveColor,
  19471. center = _this$parent.center,
  19472. direction = _this$parent.direction;
  19473. var style = {
  19474. background: this.status === 'finish' ? activeColor : inactiveColor
  19475. };
  19476. if (center && direction === 'vertical') {
  19477. style.top = '50%';
  19478. }
  19479. return style;
  19480. },
  19481. circleContainerStyle: function circleContainerStyle() {
  19482. if (this.parent.center && this.parent.direction === 'vertical') {
  19483. return {
  19484. top: '50%'
  19485. };
  19486. }
  19487. },
  19488. titleStyle: function titleStyle() {
  19489. if (this.active) {
  19490. return {
  19491. color: this.parent.activeColor
  19492. };
  19493. }
  19494. if (!this.status) {
  19495. return {
  19496. color: this.parent.inactiveColor
  19497. };
  19498. }
  19499. }
  19500. },
  19501. methods: {
  19502. genCircle: function genCircle() {
  19503. var h = this.$createElement;
  19504. var _this$parent2 = this.parent,
  19505. activeIcon = _this$parent2.activeIcon,
  19506. iconPrefix = _this$parent2.iconPrefix,
  19507. activeColor = _this$parent2.activeColor,
  19508. finishIcon = _this$parent2.finishIcon,
  19509. inactiveIcon = _this$parent2.inactiveIcon;
  19510. if (this.active) {
  19511. return this.slots('active-icon') || h(es_icon, {
  19512. "class": step_bem('icon', 'active'),
  19513. "attrs": {
  19514. "name": activeIcon,
  19515. "color": activeColor,
  19516. "classPrefix": iconPrefix
  19517. }
  19518. });
  19519. }
  19520. var finishIconSlot = this.slots('finish-icon');
  19521. if (this.status === 'finish' && (finishIcon || finishIconSlot)) {
  19522. return finishIconSlot || h(es_icon, {
  19523. "class": step_bem('icon', 'finish'),
  19524. "attrs": {
  19525. "name": finishIcon,
  19526. "color": activeColor,
  19527. "classPrefix": iconPrefix
  19528. }
  19529. });
  19530. }
  19531. var inactiveIconSlot = this.slots('inactive-icon');
  19532. if (inactiveIcon || inactiveIconSlot) {
  19533. return inactiveIconSlot || h(es_icon, {
  19534. "class": step_bem('icon'),
  19535. "attrs": {
  19536. "name": inactiveIcon,
  19537. "classPrefix": iconPrefix
  19538. }
  19539. });
  19540. }
  19541. return h("i", {
  19542. "class": step_bem('circle'),
  19543. "style": this.lineStyle
  19544. });
  19545. },
  19546. onClickStep: function onClickStep() {
  19547. this.parent.$emit('click-step', this.index);
  19548. }
  19549. },
  19550. render: function render() {
  19551. var _ref;
  19552. var h = arguments[0];
  19553. var status = this.status,
  19554. active = this.active;
  19555. var direction = this.parent.direction;
  19556. return h("div", {
  19557. "class": [BORDER, step_bem([direction, (_ref = {}, _ref[status] = status, _ref)])]
  19558. }, [h("div", {
  19559. "class": step_bem('title', {
  19560. active: active
  19561. }),
  19562. "style": this.titleStyle,
  19563. "on": {
  19564. "click": this.onClickStep
  19565. }
  19566. }, [this.slots()]), h("div", {
  19567. "class": step_bem('circle-container'),
  19568. "on": {
  19569. "click": this.onClickStep
  19570. },
  19571. "style": this.circleContainerStyle
  19572. }, [this.genCircle()]), h("div", {
  19573. "class": step_bem('line'),
  19574. "style": this.lineStyle
  19575. })]);
  19576. }
  19577. }));
  19578. // CONCATENATED MODULE: ./es/steps/index.js
  19579. var steps_createNamespace = Object(create["a" /* createNamespace */])('steps'),
  19580. steps_createComponent = steps_createNamespace[0],
  19581. steps_bem = steps_createNamespace[1];
  19582. /* harmony default export */ var steps = (steps_createComponent({
  19583. mixins: [ParentMixin('vanSteps')],
  19584. props: {
  19585. center: Boolean,
  19586. iconPrefix: String,
  19587. finishIcon: String,
  19588. activeColor: String,
  19589. inactiveIcon: String,
  19590. inactiveColor: String,
  19591. active: {
  19592. type: [Number, String],
  19593. default: 0
  19594. },
  19595. direction: {
  19596. type: String,
  19597. default: 'horizontal'
  19598. },
  19599. activeIcon: {
  19600. type: String,
  19601. default: 'checked'
  19602. }
  19603. },
  19604. render: function render() {
  19605. var h = arguments[0];
  19606. return h("div", {
  19607. "class": steps_bem([this.direction])
  19608. }, [h("div", {
  19609. "class": steps_bem('items')
  19610. }, [this.slots()])]);
  19611. }
  19612. }));
  19613. // CONCATENATED MODULE: ./es/submit-bar/index.js
  19614. // Utils
  19615. // Components
  19616. // Types
  19617. var submit_bar_createNamespace = Object(create["a" /* createNamespace */])('submit-bar'),
  19618. submit_bar_createComponent = submit_bar_createNamespace[0],
  19619. submit_bar_bem = submit_bar_createNamespace[1],
  19620. submit_bar_t = submit_bar_createNamespace[2];
  19621. function SubmitBar(h, props, slots, ctx) {
  19622. var tip = props.tip,
  19623. price = props.price,
  19624. tipIcon = props.tipIcon;
  19625. function Text() {
  19626. if (typeof price === 'number') {
  19627. var priceArr = (price / 100).toFixed(props.decimalLength).split('.');
  19628. var decimalStr = props.decimalLength ? "." + priceArr[1] : '';
  19629. return h("div", {
  19630. "style": {
  19631. textAlign: props.textAlign ? props.textAlign : ''
  19632. },
  19633. "class": submit_bar_bem('text')
  19634. }, [h("span", [props.label || submit_bar_t('label')]), h("span", {
  19635. "class": submit_bar_bem('price')
  19636. }, [props.currency, h("span", {
  19637. "class": submit_bar_bem('price', 'integer')
  19638. }, [priceArr[0]]), decimalStr]), props.suffixLabel && h("span", {
  19639. "class": submit_bar_bem('suffix-label')
  19640. }, [props.suffixLabel])]);
  19641. }
  19642. }
  19643. function Tip() {
  19644. if (slots.tip || tip) {
  19645. return h("div", {
  19646. "class": submit_bar_bem('tip')
  19647. }, [tipIcon && h(es_icon, {
  19648. "class": submit_bar_bem('tip-icon'),
  19649. "attrs": {
  19650. "name": tipIcon
  19651. }
  19652. }), tip && h("span", {
  19653. "class": submit_bar_bem('tip-text')
  19654. }, [tip]), slots.tip && slots.tip()]);
  19655. }
  19656. }
  19657. return h("div", helper_default()([{
  19658. "class": submit_bar_bem({
  19659. unfit: !props.safeAreaInsetBottom
  19660. })
  19661. }, inherit(ctx)]), [slots.top && slots.top(), Tip(), h("div", {
  19662. "class": submit_bar_bem('bar')
  19663. }, [slots.default && slots.default(), Text(), slots.button ? slots.button() : h(es_button, {
  19664. "attrs": {
  19665. "round": true,
  19666. "type": props.buttonType,
  19667. "text": props.loading ? '' : props.buttonText,
  19668. "color": props.buttonColor,
  19669. "loading": props.loading,
  19670. "disabled": props.disabled
  19671. },
  19672. "class": submit_bar_bem('button', props.buttonType),
  19673. "on": {
  19674. "click": function click() {
  19675. functional_emit(ctx, 'submit');
  19676. }
  19677. }
  19678. })])]);
  19679. }
  19680. SubmitBar.props = {
  19681. tip: String,
  19682. label: String,
  19683. price: Number,
  19684. tipIcon: String,
  19685. loading: Boolean,
  19686. disabled: Boolean,
  19687. textAlign: String,
  19688. buttonText: String,
  19689. buttonColor: String,
  19690. suffixLabel: String,
  19691. safeAreaInsetBottom: {
  19692. type: Boolean,
  19693. default: true
  19694. },
  19695. decimalLength: {
  19696. type: [Number, String],
  19697. default: 2
  19698. },
  19699. currency: {
  19700. type: String,
  19701. default: '¥'
  19702. },
  19703. buttonType: {
  19704. type: String,
  19705. default: 'danger'
  19706. }
  19707. };
  19708. /* harmony default export */ var submit_bar = (submit_bar_createComponent(SubmitBar));
  19709. // CONCATENATED MODULE: ./es/swipe-cell/index.js
  19710. // Utils
  19711. // Mixins
  19712. var swipe_cell_createNamespace = Object(create["a" /* createNamespace */])('swipe-cell'),
  19713. swipe_cell_createComponent = swipe_cell_createNamespace[0],
  19714. swipe_cell_bem = swipe_cell_createNamespace[1];
  19715. var THRESHOLD = 0.15;
  19716. /* harmony default export */ var swipe_cell = (swipe_cell_createComponent({
  19717. mixins: [TouchMixin, click_outside_ClickOutsideMixin({
  19718. event: 'touchstart',
  19719. method: 'onClick'
  19720. })],
  19721. props: {
  19722. // @deprecated
  19723. // should be removed in next major version, use beforeClose instead
  19724. onClose: Function,
  19725. disabled: Boolean,
  19726. leftWidth: [Number, String],
  19727. rightWidth: [Number, String],
  19728. beforeClose: Function,
  19729. stopPropagation: Boolean,
  19730. name: {
  19731. type: [Number, String],
  19732. default: ''
  19733. }
  19734. },
  19735. data: function data() {
  19736. return {
  19737. offset: 0,
  19738. dragging: false
  19739. };
  19740. },
  19741. computed: {
  19742. computedLeftWidth: function computedLeftWidth() {
  19743. return +this.leftWidth || this.getWidthByRef('left');
  19744. },
  19745. computedRightWidth: function computedRightWidth() {
  19746. return +this.rightWidth || this.getWidthByRef('right');
  19747. }
  19748. },
  19749. mounted: function mounted() {
  19750. this.bindTouchEvent(this.$el);
  19751. },
  19752. methods: {
  19753. getWidthByRef: function getWidthByRef(ref) {
  19754. if (this.$refs[ref]) {
  19755. var rect = this.$refs[ref].getBoundingClientRect();
  19756. return rect.width;
  19757. }
  19758. return 0;
  19759. },
  19760. // @exposed-api
  19761. open: function open(position) {
  19762. var offset = position === 'left' ? this.computedLeftWidth : -this.computedRightWidth;
  19763. this.opened = true;
  19764. this.offset = offset;
  19765. this.$emit('open', {
  19766. position: position,
  19767. name: this.name,
  19768. // @deprecated
  19769. // should be removed in next major version
  19770. detail: this.name
  19771. });
  19772. },
  19773. // @exposed-api
  19774. close: function close(position) {
  19775. this.offset = 0;
  19776. if (this.opened) {
  19777. this.opened = false;
  19778. this.$emit('close', {
  19779. position: position,
  19780. name: this.name
  19781. });
  19782. }
  19783. },
  19784. onTouchStart: function onTouchStart(event) {
  19785. if (this.disabled) {
  19786. return;
  19787. }
  19788. this.startOffset = this.offset;
  19789. this.touchStart(event);
  19790. },
  19791. onTouchMove: function onTouchMove(event) {
  19792. if (this.disabled) {
  19793. return;
  19794. }
  19795. this.touchMove(event);
  19796. if (this.direction === 'horizontal') {
  19797. this.dragging = true;
  19798. this.lockClick = true;
  19799. var isPrevent = !this.opened || this.deltaX * this.startOffset < 0;
  19800. if (isPrevent) {
  19801. preventDefault(event, this.stopPropagation);
  19802. }
  19803. this.offset = range(this.deltaX + this.startOffset, -this.computedRightWidth, this.computedLeftWidth);
  19804. }
  19805. },
  19806. onTouchEnd: function onTouchEnd() {
  19807. var _this = this;
  19808. if (this.disabled) {
  19809. return;
  19810. }
  19811. if (this.dragging) {
  19812. this.toggle(this.offset > 0 ? 'left' : 'right');
  19813. this.dragging = false; // compatible with desktop scenario
  19814. setTimeout(function () {
  19815. _this.lockClick = false;
  19816. }, 0);
  19817. }
  19818. },
  19819. toggle: function toggle(direction) {
  19820. var offset = Math.abs(this.offset);
  19821. var threshold = this.opened ? 1 - THRESHOLD : THRESHOLD;
  19822. var computedLeftWidth = this.computedLeftWidth,
  19823. computedRightWidth = this.computedRightWidth;
  19824. if (computedRightWidth && direction === 'right' && offset > computedRightWidth * threshold) {
  19825. this.open('right');
  19826. } else if (computedLeftWidth && direction === 'left' && offset > computedLeftWidth * threshold) {
  19827. this.open('left');
  19828. } else {
  19829. this.close();
  19830. }
  19831. },
  19832. onClick: function onClick(position) {
  19833. if (position === void 0) {
  19834. position = 'outside';
  19835. }
  19836. this.$emit('click', position);
  19837. if (this.opened && !this.lockClick) {
  19838. if (this.beforeClose) {
  19839. this.beforeClose({
  19840. position: position,
  19841. name: this.name,
  19842. instance: this
  19843. });
  19844. } else if (this.onClose) {
  19845. this.onClose(position, this, {
  19846. name: this.name
  19847. });
  19848. } else {
  19849. this.close(position);
  19850. }
  19851. }
  19852. },
  19853. getClickHandler: function getClickHandler(position, stop) {
  19854. var _this2 = this;
  19855. return function (event) {
  19856. if (stop) {
  19857. event.stopPropagation();
  19858. }
  19859. _this2.onClick(position);
  19860. };
  19861. },
  19862. genLeftPart: function genLeftPart() {
  19863. var h = this.$createElement;
  19864. var content = this.slots('left');
  19865. if (content) {
  19866. return h("div", {
  19867. "ref": "left",
  19868. "class": swipe_cell_bem('left'),
  19869. "on": {
  19870. "click": this.getClickHandler('left', true)
  19871. }
  19872. }, [content]);
  19873. }
  19874. },
  19875. genRightPart: function genRightPart() {
  19876. var h = this.$createElement;
  19877. var content = this.slots('right');
  19878. if (content) {
  19879. return h("div", {
  19880. "ref": "right",
  19881. "class": swipe_cell_bem('right'),
  19882. "on": {
  19883. "click": this.getClickHandler('right', true)
  19884. }
  19885. }, [content]);
  19886. }
  19887. }
  19888. },
  19889. render: function render() {
  19890. var h = arguments[0];
  19891. var wrapperStyle = {
  19892. transform: "translate3d(" + this.offset + "px, 0, 0)",
  19893. transitionDuration: this.dragging ? '0s' : '.6s'
  19894. };
  19895. return h("div", {
  19896. "class": swipe_cell_bem(),
  19897. "on": {
  19898. "click": this.getClickHandler('cell')
  19899. }
  19900. }, [h("div", {
  19901. "class": swipe_cell_bem('wrapper'),
  19902. "style": wrapperStyle
  19903. }, [this.genLeftPart(), this.slots(), this.genRightPart()])]);
  19904. }
  19905. }));
  19906. // CONCATENATED MODULE: ./es/switch-cell/index.js
  19907. // Utils
  19908. // Components
  19909. // Types
  19910. var switch_cell_createNamespace = Object(create["a" /* createNamespace */])('switch-cell'),
  19911. switch_cell_createComponent = switch_cell_createNamespace[0],
  19912. switch_cell_bem = switch_cell_createNamespace[1];
  19913. function SwitchCell(h, props, slots, ctx) {
  19914. if (false) {}
  19915. return h(cell, helper_default()([{
  19916. "attrs": {
  19917. "center": true,
  19918. "size": props.cellSize,
  19919. "title": props.title,
  19920. "border": props.border
  19921. },
  19922. "class": switch_cell_bem([props.cellSize])
  19923. }, inherit(ctx)]), [h(es_switch, {
  19924. "props": _extends({}, props),
  19925. "on": _extends({}, ctx.listeners)
  19926. })]);
  19927. }
  19928. SwitchCell.props = _extends({}, switchProps, {
  19929. title: String,
  19930. cellSize: String,
  19931. border: {
  19932. type: Boolean,
  19933. default: true
  19934. },
  19935. size: {
  19936. type: String,
  19937. default: '24px'
  19938. }
  19939. });
  19940. /* harmony default export */ var switch_cell = (switch_cell_createComponent(SwitchCell));
  19941. // CONCATENATED MODULE: ./es/tabbar/index.js
  19942. var tabbar_createNamespace = Object(create["a" /* createNamespace */])('tabbar'),
  19943. tabbar_createComponent = tabbar_createNamespace[0],
  19944. tabbar_bem = tabbar_createNamespace[1];
  19945. /* harmony default export */ var tabbar = (tabbar_createComponent({
  19946. mixins: [ParentMixin('vanTabbar')],
  19947. props: {
  19948. route: Boolean,
  19949. zIndex: [Number, String],
  19950. placeholder: Boolean,
  19951. activeColor: String,
  19952. beforeChange: Function,
  19953. inactiveColor: String,
  19954. value: {
  19955. type: [Number, String],
  19956. default: 0
  19957. },
  19958. border: {
  19959. type: Boolean,
  19960. default: true
  19961. },
  19962. fixed: {
  19963. type: Boolean,
  19964. default: true
  19965. },
  19966. safeAreaInsetBottom: {
  19967. type: Boolean,
  19968. default: null
  19969. }
  19970. },
  19971. data: function data() {
  19972. return {
  19973. height: null
  19974. };
  19975. },
  19976. computed: {
  19977. fit: function fit() {
  19978. if (this.safeAreaInsetBottom !== null) {
  19979. return this.safeAreaInsetBottom;
  19980. } // enable safe-area-inset-bottom by default when fixed
  19981. return this.fixed;
  19982. }
  19983. },
  19984. watch: {
  19985. value: 'setActiveItem',
  19986. children: 'setActiveItem'
  19987. },
  19988. mounted: function mounted() {
  19989. var _this = this;
  19990. if (this.placeholder && this.fixed) {
  19991. var setHeight = function setHeight() {
  19992. _this.height = _this.$refs.tabbar.getBoundingClientRect().height;
  19993. };
  19994. setHeight(); // https://github.com/vant-ui/vant/issues/10131
  19995. setTimeout(setHeight, 100);
  19996. }
  19997. },
  19998. methods: {
  19999. setActiveItem: function setActiveItem() {
  20000. var _this2 = this;
  20001. this.children.forEach(function (item, index) {
  20002. item.nameMatched = item.name === _this2.value || index === _this2.value;
  20003. });
  20004. },
  20005. triggerChange: function triggerChange(active, afterChange) {
  20006. var _this3 = this;
  20007. callInterceptor({
  20008. interceptor: this.beforeChange,
  20009. args: [active],
  20010. done: function done() {
  20011. _this3.$emit('input', active);
  20012. _this3.$emit('change', active);
  20013. afterChange();
  20014. }
  20015. });
  20016. },
  20017. genTabbar: function genTabbar() {
  20018. var _ref;
  20019. var h = this.$createElement;
  20020. return h("div", {
  20021. "ref": "tabbar",
  20022. "style": {
  20023. zIndex: this.zIndex
  20024. },
  20025. "class": [(_ref = {}, _ref[BORDER_TOP_BOTTOM] = this.border, _ref), tabbar_bem({
  20026. unfit: !this.fit,
  20027. fixed: this.fixed
  20028. })]
  20029. }, [this.slots()]);
  20030. }
  20031. },
  20032. render: function render() {
  20033. var h = arguments[0];
  20034. if (this.placeholder && this.fixed) {
  20035. return h("div", {
  20036. "class": tabbar_bem('placeholder'),
  20037. "style": {
  20038. height: this.height + "px"
  20039. }
  20040. }, [this.genTabbar()]);
  20041. }
  20042. return this.genTabbar();
  20043. }
  20044. }));
  20045. // CONCATENATED MODULE: ./es/tabbar-item/index.js
  20046. // Utils
  20047. // Mixins
  20048. // Components
  20049. var tabbar_item_createNamespace = Object(create["a" /* createNamespace */])('tabbar-item'),
  20050. tabbar_item_createComponent = tabbar_item_createNamespace[0],
  20051. tabbar_item_bem = tabbar_item_createNamespace[1];
  20052. /* harmony default export */ var tabbar_item = (tabbar_item_createComponent({
  20053. mixins: [ChildrenMixin('vanTabbar')],
  20054. props: _extends({}, routeProps, {
  20055. dot: Boolean,
  20056. icon: String,
  20057. name: [Number, String],
  20058. // @deprecated
  20059. info: [Number, String],
  20060. badge: [Number, String],
  20061. iconPrefix: String
  20062. }),
  20063. data: function data() {
  20064. return {
  20065. nameMatched: false
  20066. };
  20067. },
  20068. computed: {
  20069. active: function active() {
  20070. var routeMode = this.parent.route;
  20071. if (routeMode && '$route' in this) {
  20072. var to = this.to,
  20073. $route = this.$route;
  20074. var config = Object(utils["f" /* isObject */])(to) ? to : {
  20075. path: to
  20076. };
  20077. return !!$route.matched.find(function (r) {
  20078. // vue-router 3.x $route.matched[0].path is empty in / and its children paths
  20079. var path = r.path === '' ? '/' : r.path;
  20080. var pathMatched = config.path === path;
  20081. var nameMatched = Object(utils["c" /* isDef */])(config.name) && config.name === r.name;
  20082. return pathMatched || nameMatched;
  20083. });
  20084. }
  20085. return this.nameMatched;
  20086. }
  20087. },
  20088. methods: {
  20089. onClick: function onClick(event) {
  20090. var _this = this;
  20091. if (!this.active) {
  20092. this.parent.triggerChange(this.name || this.index, function () {
  20093. route(_this.$router, _this);
  20094. });
  20095. }
  20096. this.$emit('click', event);
  20097. },
  20098. genIcon: function genIcon() {
  20099. var h = this.$createElement;
  20100. var slot = this.slots('icon', {
  20101. active: this.active
  20102. });
  20103. if (slot) {
  20104. return slot;
  20105. }
  20106. if (this.icon) {
  20107. return h(es_icon, {
  20108. "attrs": {
  20109. "name": this.icon,
  20110. "classPrefix": this.iconPrefix
  20111. }
  20112. });
  20113. }
  20114. }
  20115. },
  20116. render: function render() {
  20117. var _this$badge;
  20118. var h = arguments[0];
  20119. var active = this.active;
  20120. var color = this.parent[active ? 'activeColor' : 'inactiveColor'];
  20121. if (false) {}
  20122. return h("div", {
  20123. "class": tabbar_item_bem({
  20124. active: active
  20125. }),
  20126. "style": {
  20127. color: color
  20128. },
  20129. "on": {
  20130. "click": this.onClick
  20131. }
  20132. }, [h("div", {
  20133. "class": tabbar_item_bem('icon')
  20134. }, [this.genIcon(), h(es_info, {
  20135. "attrs": {
  20136. "dot": this.dot,
  20137. "info": (_this$badge = this.badge) != null ? _this$badge : this.info
  20138. }
  20139. })]), h("div", {
  20140. "class": tabbar_item_bem('text')
  20141. }, [this.slots('default', {
  20142. active: active
  20143. })])]);
  20144. }
  20145. }));
  20146. // CONCATENATED MODULE: ./es/tree-select/index.js
  20147. // Utils
  20148. // Components
  20149. // Types
  20150. var tree_select_createNamespace = Object(create["a" /* createNamespace */])('tree-select'),
  20151. tree_select_createComponent = tree_select_createNamespace[0],
  20152. tree_select_bem = tree_select_createNamespace[1];
  20153. function TreeSelect(h, props, slots, ctx) {
  20154. var items = props.items,
  20155. height = props.height,
  20156. activeId = props.activeId,
  20157. selectedIcon = props.selectedIcon,
  20158. mainActiveIndex = props.mainActiveIndex;
  20159. if (false) {}
  20160. var selectedItem = items[+mainActiveIndex] || {};
  20161. var subItems = selectedItem.children || [];
  20162. var isMultiple = Array.isArray(activeId);
  20163. function isActiveItem(id) {
  20164. return isMultiple ? activeId.indexOf(id) !== -1 : activeId === id;
  20165. }
  20166. var Navs = items.map(function (item) {
  20167. var _item$badge;
  20168. return h(sidebar_item, {
  20169. "attrs": {
  20170. "dot": item.dot,
  20171. "info": (_item$badge = item.badge) != null ? _item$badge : item.info,
  20172. "title": item.text,
  20173. "disabled": item.disabled
  20174. },
  20175. "class": [tree_select_bem('nav-item'), item.className]
  20176. });
  20177. });
  20178. function Content() {
  20179. if (slots.content) {
  20180. return slots.content();
  20181. }
  20182. return subItems.map(function (item) {
  20183. return h("div", {
  20184. "key": item.id,
  20185. "class": ['van-ellipsis', tree_select_bem('item', {
  20186. active: isActiveItem(item.id),
  20187. disabled: item.disabled
  20188. })],
  20189. "on": {
  20190. "click": function click() {
  20191. if (!item.disabled) {
  20192. var newActiveId = item.id;
  20193. if (isMultiple) {
  20194. newActiveId = activeId.slice();
  20195. var index = newActiveId.indexOf(item.id);
  20196. if (index !== -1) {
  20197. newActiveId.splice(index, 1);
  20198. } else if (newActiveId.length < props.max) {
  20199. newActiveId.push(item.id);
  20200. }
  20201. }
  20202. functional_emit(ctx, 'update:active-id', newActiveId);
  20203. functional_emit(ctx, 'click-item', item); // compatible with legacy usage, should be removed in next major version
  20204. functional_emit(ctx, 'itemclick', item);
  20205. }
  20206. }
  20207. }
  20208. }, [item.text, isActiveItem(item.id) && h(es_icon, {
  20209. "attrs": {
  20210. "name": selectedIcon
  20211. },
  20212. "class": tree_select_bem('selected')
  20213. })]);
  20214. });
  20215. }
  20216. return h("div", helper_default()([{
  20217. "class": tree_select_bem(),
  20218. "style": {
  20219. height: Object(unit["a" /* addUnit */])(height)
  20220. }
  20221. }, inherit(ctx)]), [h(sidebar, {
  20222. "class": tree_select_bem('nav'),
  20223. "attrs": {
  20224. "activeKey": mainActiveIndex
  20225. },
  20226. "on": {
  20227. "change": function change(index) {
  20228. functional_emit(ctx, 'update:main-active-index', index);
  20229. functional_emit(ctx, 'click-nav', index); // compatible with legacy usage, should be removed in next major version
  20230. functional_emit(ctx, 'navclick', index);
  20231. }
  20232. }
  20233. }, [Navs]), h("div", {
  20234. "class": tree_select_bem('content')
  20235. }, [Content()])]);
  20236. }
  20237. TreeSelect.props = {
  20238. max: {
  20239. type: [Number, String],
  20240. default: Infinity
  20241. },
  20242. items: {
  20243. type: Array,
  20244. default: function _default() {
  20245. return [];
  20246. }
  20247. },
  20248. height: {
  20249. type: [Number, String],
  20250. default: 300
  20251. },
  20252. activeId: {
  20253. type: [Number, String, Array],
  20254. default: 0
  20255. },
  20256. selectedIcon: {
  20257. type: String,
  20258. default: 'success'
  20259. },
  20260. mainActiveIndex: {
  20261. type: [Number, String],
  20262. default: 0
  20263. }
  20264. };
  20265. /* harmony default export */ var tree_select = (tree_select_createComponent(TreeSelect));
  20266. // CONCATENATED MODULE: ./es/index.js
  20267. var version = '2.13.2';
  20268. function install(Vue) {
  20269. var components = [action_sheet, address_edit, address_list, es_area, badge, es_button, calendar, card, cascader, cell, cell_group, es_checkbox, checkbox_group, circle, col, collapse, collapse_item, contact_card, contact_edit, contact_list, count_down, es_coupon, coupon_cell, coupon_list, datetime_picker, dialog, divider, dropdown_item, dropdown_menu, empty, es_field, es_form, goods_action, goods_action_button, goods_action_icon, grid, grid_item, es_icon, es_image, image_preview, index_anchor, index_bar, es_info, es_list, es_loading, locale["a" /* default */], nav_bar, notice_bar, notify, number_keyboard, es_overlay, pagination, panel, password_input, es_picker, popover, popup, es_progress, pull_refresh, es_radio, radio_group, es_rate, row, search, share_sheet, sidebar, sidebar_item, skeleton, es_sku, slider, es_step, stepper, steps, es_sticky, submit_bar, swipe, swipe_cell, swipe_item, es_switch, switch_cell, tab, tabbar, tabbar_item, tabs, es_tag, es_toast, tree_select, uploader];
  20270. components.forEach(function (item) {
  20271. if (item.install) {
  20272. Vue.use(item);
  20273. } else if (item.name) {
  20274. Vue.component(item.name, item);
  20275. }
  20276. });
  20277. }
  20278. if (typeof window !== 'undefined' && window.Vue) {
  20279. install(window.Vue);
  20280. }
  20281. /* harmony default export */ var es = __webpack_exports__["default"] = ({
  20282. install: install,
  20283. version: version
  20284. });
  20285. /***/ })
  20286. /******/ ]);
  20287. });