date-picker.js 185 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "/dist/";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 55);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ([
  89. /* 0 */
  90. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  91. "use strict";
  92. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  93. /* globals __VUE_SSR_CONTEXT__ */
  94. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  95. // This module is a runtime utility for cleaner component module output and will
  96. // be included in the final webpack user bundle.
  97. function normalizeComponent (
  98. scriptExports,
  99. render,
  100. staticRenderFns,
  101. functionalTemplate,
  102. injectStyles,
  103. scopeId,
  104. moduleIdentifier, /* server only */
  105. shadowMode /* vue-cli only */
  106. ) {
  107. // Vue.extend constructor export interop
  108. var options = typeof scriptExports === 'function'
  109. ? scriptExports.options
  110. : scriptExports
  111. // render functions
  112. if (render) {
  113. options.render = render
  114. options.staticRenderFns = staticRenderFns
  115. options._compiled = true
  116. }
  117. // functional template
  118. if (functionalTemplate) {
  119. options.functional = true
  120. }
  121. // scopedId
  122. if (scopeId) {
  123. options._scopeId = 'data-v-' + scopeId
  124. }
  125. var hook
  126. if (moduleIdentifier) { // server build
  127. hook = function (context) {
  128. // 2.3 injection
  129. context =
  130. context || // cached call
  131. (this.$vnode && this.$vnode.ssrContext) || // stateful
  132. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  133. // 2.2 with runInNewContext: true
  134. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  135. context = __VUE_SSR_CONTEXT__
  136. }
  137. // inject component styles
  138. if (injectStyles) {
  139. injectStyles.call(this, context)
  140. }
  141. // register component module identifier for async chunk inferrence
  142. if (context && context._registeredComponents) {
  143. context._registeredComponents.add(moduleIdentifier)
  144. }
  145. }
  146. // used by ssr in case component is cached and beforeCreate
  147. // never gets called
  148. options._ssrRegister = hook
  149. } else if (injectStyles) {
  150. hook = shadowMode
  151. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  152. : injectStyles
  153. }
  154. if (hook) {
  155. if (options.functional) {
  156. // for template-only hot-reload because in that case the render fn doesn't
  157. // go through the normalizer
  158. options._injectStyles = hook
  159. // register for functioal component in vue file
  160. var originalRender = options.render
  161. options.render = function renderWithStyleInjection (h, context) {
  162. hook.call(context)
  163. return originalRender(h, context)
  164. }
  165. } else {
  166. // inject component registration as beforeCreate hook
  167. var existing = options.beforeCreate
  168. options.beforeCreate = existing
  169. ? [].concat(existing, hook)
  170. : [hook]
  171. }
  172. }
  173. return {
  174. exports: scriptExports,
  175. options: options
  176. }
  177. }
  178. /***/ }),
  179. /* 1 */
  180. /***/ (function(module, exports) {
  181. module.exports = require("element-ui/lib/utils/date-util");
  182. /***/ }),
  183. /* 2 */
  184. /***/ (function(module, exports) {
  185. module.exports = require("element-ui/lib/utils/dom");
  186. /***/ }),
  187. /* 3 */
  188. /***/ (function(module, exports) {
  189. module.exports = require("element-ui/lib/utils/util");
  190. /***/ }),
  191. /* 4 */
  192. /***/ (function(module, exports) {
  193. module.exports = require("element-ui/lib/mixins/emitter");
  194. /***/ }),
  195. /* 5 */
  196. /***/ (function(module, exports) {
  197. module.exports = require("element-ui/lib/utils/vue-popper");
  198. /***/ }),
  199. /* 6 */
  200. /***/ (function(module, exports) {
  201. module.exports = require("element-ui/lib/mixins/locale");
  202. /***/ }),
  203. /* 7 */
  204. /***/ (function(module, exports) {
  205. module.exports = require("vue");
  206. /***/ }),
  207. /* 8 */,
  208. /* 9 */
  209. /***/ (function(module, exports) {
  210. module.exports = require("element-ui/lib/utils/merge");
  211. /***/ }),
  212. /* 10 */
  213. /***/ (function(module, exports) {
  214. module.exports = require("element-ui/lib/input");
  215. /***/ }),
  216. /* 11 */,
  217. /* 12 */
  218. /***/ (function(module, exports) {
  219. module.exports = require("element-ui/lib/utils/clickoutside");
  220. /***/ }),
  221. /* 13 */
  222. /***/ (function(module, exports) {
  223. module.exports = require("element-ui/lib/button");
  224. /***/ }),
  225. /* 14 */
  226. /***/ (function(module, exports) {
  227. module.exports = require("element-ui/lib/scrollbar");
  228. /***/ }),
  229. /* 15 */,
  230. /* 16 */,
  231. /* 17 */,
  232. /* 18 */,
  233. /* 19 */,
  234. /* 20 */,
  235. /* 21 */,
  236. /* 22 */,
  237. /* 23 */,
  238. /* 24 */,
  239. /* 25 */,
  240. /* 26 */,
  241. /* 27 */
  242. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  243. "use strict";
  244. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/time.vue?vue&type=template&id=3d939089&
  245. var render = function() {
  246. var _vm = this
  247. var _h = _vm.$createElement
  248. var _c = _vm._self._c || _h
  249. return _c(
  250. "transition",
  251. {
  252. attrs: { name: "el-zoom-in-top" },
  253. on: {
  254. "after-leave": function($event) {
  255. _vm.$emit("dodestroy")
  256. }
  257. }
  258. },
  259. [
  260. _c(
  261. "div",
  262. {
  263. directives: [
  264. {
  265. name: "show",
  266. rawName: "v-show",
  267. value: _vm.visible,
  268. expression: "visible"
  269. }
  270. ],
  271. staticClass: "el-time-panel el-popper",
  272. class: _vm.popperClass
  273. },
  274. [
  275. _c(
  276. "div",
  277. {
  278. staticClass: "el-time-panel__content",
  279. class: { "has-seconds": _vm.showSeconds }
  280. },
  281. [
  282. _c("time-spinner", {
  283. ref: "spinner",
  284. attrs: {
  285. "arrow-control": _vm.useArrow,
  286. "show-seconds": _vm.showSeconds,
  287. "am-pm-mode": _vm.amPmMode,
  288. date: _vm.date
  289. },
  290. on: {
  291. change: _vm.handleChange,
  292. "select-range": _vm.setSelectionRange
  293. }
  294. })
  295. ],
  296. 1
  297. ),
  298. _c("div", { staticClass: "el-time-panel__footer" }, [
  299. _c(
  300. "button",
  301. {
  302. staticClass: "el-time-panel__btn cancel",
  303. attrs: { type: "button" },
  304. on: { click: _vm.handleCancel }
  305. },
  306. [_vm._v(_vm._s(_vm.t("el.datepicker.cancel")))]
  307. ),
  308. _c(
  309. "button",
  310. {
  311. staticClass: "el-time-panel__btn",
  312. class: { confirm: !_vm.disabled },
  313. attrs: { type: "button" },
  314. on: {
  315. click: function($event) {
  316. _vm.handleConfirm()
  317. }
  318. }
  319. },
  320. [_vm._v(_vm._s(_vm.t("el.datepicker.confirm")))]
  321. )
  322. ])
  323. ]
  324. )
  325. ]
  326. )
  327. }
  328. var staticRenderFns = []
  329. render._withStripped = true
  330. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue?vue&type=template&id=3d939089&
  331. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  332. var date_util_ = __webpack_require__(1);
  333. // EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
  334. var locale_ = __webpack_require__(6);
  335. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  336. // EXTERNAL MODULE: ./packages/date-picker/src/basic/time-spinner.vue + 4 modules
  337. var time_spinner = __webpack_require__(35);
  338. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/time.vue?vue&type=script&lang=js&
  339. //
  340. //
  341. //
  342. //
  343. //
  344. //
  345. //
  346. //
  347. //
  348. //
  349. //
  350. //
  351. //
  352. //
  353. //
  354. //
  355. //
  356. //
  357. //
  358. //
  359. //
  360. //
  361. //
  362. //
  363. //
  364. //
  365. //
  366. //
  367. //
  368. //
  369. //
  370. //
  371. /* harmony default export */ var timevue_type_script_lang_js_ = ({
  372. mixins: [locale_default.a],
  373. components: {
  374. TimeSpinner: time_spinner["a" /* default */]
  375. },
  376. props: {
  377. visible: Boolean,
  378. timeArrowControl: Boolean
  379. },
  380. watch: {
  381. visible: function visible(val) {
  382. var _this = this;
  383. if (val) {
  384. this.oldValue = this.value;
  385. this.$nextTick(function () {
  386. return _this.$refs.spinner.emitSelectRange('hours');
  387. });
  388. } else {
  389. this.needInitAdjust = true;
  390. }
  391. },
  392. value: function value(newVal) {
  393. var _this2 = this;
  394. var date = void 0;
  395. if (newVal instanceof Date) {
  396. date = Object(date_util_["limitTimeRange"])(newVal, this.selectableRange, this.format);
  397. } else if (!newVal) {
  398. date = this.defaultValue ? new Date(this.defaultValue) : new Date();
  399. }
  400. this.date = date;
  401. if (this.visible && this.needInitAdjust) {
  402. this.$nextTick(function (_) {
  403. return _this2.adjustSpinners();
  404. });
  405. this.needInitAdjust = false;
  406. }
  407. },
  408. selectableRange: function selectableRange(val) {
  409. this.$refs.spinner.selectableRange = val;
  410. },
  411. defaultValue: function defaultValue(val) {
  412. if (!Object(date_util_["isDate"])(this.value)) {
  413. this.date = val ? new Date(val) : new Date();
  414. }
  415. }
  416. },
  417. data: function data() {
  418. return {
  419. popperClass: '',
  420. format: 'HH:mm:ss',
  421. value: '',
  422. defaultValue: null,
  423. date: new Date(),
  424. oldValue: new Date(),
  425. selectableRange: [],
  426. selectionRange: [0, 2],
  427. disabled: false,
  428. arrowControl: false,
  429. needInitAdjust: true
  430. };
  431. },
  432. computed: {
  433. showSeconds: function showSeconds() {
  434. return (this.format || '').indexOf('ss') !== -1;
  435. },
  436. useArrow: function useArrow() {
  437. return this.arrowControl || this.timeArrowControl || false;
  438. },
  439. amPmMode: function amPmMode() {
  440. if ((this.format || '').indexOf('A') !== -1) return 'A';
  441. if ((this.format || '').indexOf('a') !== -1) return 'a';
  442. return '';
  443. }
  444. },
  445. methods: {
  446. handleCancel: function handleCancel() {
  447. this.$emit('pick', this.oldValue, false);
  448. },
  449. handleChange: function handleChange(date) {
  450. // this.visible avoids edge cases, when use scrolls during panel closing animation
  451. if (this.visible) {
  452. this.date = Object(date_util_["clearMilliseconds"])(date);
  453. // if date is out of range, do not emit
  454. if (this.isValidValue(this.date)) {
  455. this.$emit('pick', this.date, true);
  456. }
  457. }
  458. },
  459. setSelectionRange: function setSelectionRange(start, end) {
  460. this.$emit('select-range', start, end);
  461. this.selectionRange = [start, end];
  462. },
  463. handleConfirm: function handleConfirm() {
  464. var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  465. var first = arguments[1];
  466. if (first) return;
  467. var date = Object(date_util_["clearMilliseconds"])(Object(date_util_["limitTimeRange"])(this.date, this.selectableRange, this.format));
  468. this.$emit('pick', date, visible, first);
  469. },
  470. handleKeydown: function handleKeydown(event) {
  471. var keyCode = event.keyCode;
  472. var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
  473. // Left or Right
  474. if (keyCode === 37 || keyCode === 39) {
  475. var step = mapping[keyCode];
  476. this.changeSelectionRange(step);
  477. event.preventDefault();
  478. return;
  479. }
  480. // Up or Down
  481. if (keyCode === 38 || keyCode === 40) {
  482. var _step = mapping[keyCode];
  483. this.$refs.spinner.scrollDown(_step);
  484. event.preventDefault();
  485. return;
  486. }
  487. },
  488. isValidValue: function isValidValue(date) {
  489. return Object(date_util_["timeWithinRange"])(date, this.selectableRange, this.format);
  490. },
  491. adjustSpinners: function adjustSpinners() {
  492. return this.$refs.spinner.adjustSpinners();
  493. },
  494. changeSelectionRange: function changeSelectionRange(step) {
  495. var list = [0, 3].concat(this.showSeconds ? [6] : []);
  496. var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
  497. var index = list.indexOf(this.selectionRange[0]);
  498. var next = (index + step + list.length) % list.length;
  499. this.$refs.spinner.emitSelectRange(mapping[next]);
  500. }
  501. },
  502. mounted: function mounted() {
  503. var _this3 = this;
  504. this.$nextTick(function () {
  505. return _this3.handleConfirm(true, true);
  506. });
  507. this.$emit('mounted');
  508. }
  509. });
  510. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue?vue&type=script&lang=js&
  511. /* harmony default export */ var panel_timevue_type_script_lang_js_ = (timevue_type_script_lang_js_);
  512. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  513. var componentNormalizer = __webpack_require__(0);
  514. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue
  515. /* normalize component */
  516. var component = Object(componentNormalizer["a" /* default */])(
  517. panel_timevue_type_script_lang_js_,
  518. render,
  519. staticRenderFns,
  520. false,
  521. null,
  522. null,
  523. null
  524. )
  525. /* hot reload */
  526. if (false) { var api; }
  527. component.options.__file = "packages/date-picker/src/panel/time.vue"
  528. /* harmony default export */ var time = __webpack_exports__["a"] = (component.exports);
  529. /***/ }),
  530. /* 28 */,
  531. /* 29 */,
  532. /* 30 */
  533. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  534. "use strict";
  535. /* harmony import */ var element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
  536. /* harmony import */ var element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__);
  537. /* harmony default export */ __webpack_exports__["a"] = ({
  538. bind: function bind(el, binding, vnode) {
  539. var interval = null;
  540. var startTime = void 0;
  541. var handler = function handler() {
  542. return vnode.context[binding.expression].apply();
  543. };
  544. var clear = function clear() {
  545. if (Date.now() - startTime < 100) {
  546. handler();
  547. }
  548. clearInterval(interval);
  549. interval = null;
  550. };
  551. Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["on"])(el, 'mousedown', function (e) {
  552. if (e.button !== 0) return;
  553. startTime = Date.now();
  554. Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["once"])(document, 'mouseup', clear);
  555. clearInterval(interval);
  556. interval = setInterval(handler, 100);
  557. });
  558. }
  559. });
  560. /***/ }),
  561. /* 31 */,
  562. /* 32 */,
  563. /* 33 */
  564. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  565. "use strict";
  566. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/picker.vue?vue&type=template&id=79ae069f&
  567. var render = function() {
  568. var _vm = this
  569. var _h = _vm.$createElement
  570. var _c = _vm._self._c || _h
  571. return !_vm.ranged
  572. ? _c(
  573. "el-input",
  574. _vm._b(
  575. {
  576. directives: [
  577. {
  578. name: "clickoutside",
  579. rawName: "v-clickoutside",
  580. value: _vm.handleClose,
  581. expression: "handleClose"
  582. }
  583. ],
  584. ref: "reference",
  585. staticClass: "el-date-editor",
  586. class: "el-date-editor--" + _vm.type,
  587. attrs: {
  588. readonly:
  589. !_vm.editable ||
  590. _vm.readonly ||
  591. _vm.type === "dates" ||
  592. _vm.type === "week",
  593. disabled: _vm.pickerDisabled,
  594. size: _vm.pickerSize,
  595. name: _vm.name,
  596. placeholder: _vm.placeholder,
  597. value: _vm.displayValue,
  598. validateEvent: false
  599. },
  600. on: {
  601. focus: _vm.handleFocus,
  602. input: function(value) {
  603. return (_vm.userInput = value)
  604. },
  605. change: _vm.handleChange
  606. },
  607. nativeOn: {
  608. keydown: function($event) {
  609. return _vm.handleKeydown($event)
  610. },
  611. mouseenter: function($event) {
  612. return _vm.handleMouseEnter($event)
  613. },
  614. mouseleave: function($event) {
  615. _vm.showClose = false
  616. }
  617. }
  618. },
  619. "el-input",
  620. _vm.firstInputId,
  621. false
  622. ),
  623. [
  624. _c("i", {
  625. staticClass: "el-input__icon",
  626. class: _vm.triggerClass,
  627. attrs: { slot: "prefix" },
  628. on: { click: _vm.handleFocus },
  629. slot: "prefix"
  630. }),
  631. _vm.haveTrigger
  632. ? _c("i", {
  633. staticClass: "el-input__icon",
  634. class: [_vm.showClose ? "" + _vm.clearIcon : ""],
  635. attrs: { slot: "suffix" },
  636. on: { click: _vm.handleClickIcon },
  637. slot: "suffix"
  638. })
  639. : _vm._e()
  640. ]
  641. )
  642. : _c(
  643. "div",
  644. {
  645. directives: [
  646. {
  647. name: "clickoutside",
  648. rawName: "v-clickoutside",
  649. value: _vm.handleClose,
  650. expression: "handleClose"
  651. }
  652. ],
  653. ref: "reference",
  654. staticClass: "el-date-editor el-range-editor el-input__inner",
  655. class: [
  656. "el-date-editor--" + _vm.type,
  657. _vm.pickerSize ? "el-range-editor--" + _vm.pickerSize : "",
  658. _vm.pickerDisabled ? "is-disabled" : "",
  659. _vm.pickerVisible ? "is-active" : ""
  660. ],
  661. on: {
  662. click: _vm.handleRangeClick,
  663. mouseenter: _vm.handleMouseEnter,
  664. mouseleave: function($event) {
  665. _vm.showClose = false
  666. },
  667. keydown: _vm.handleKeydown
  668. }
  669. },
  670. [
  671. _c("i", {
  672. class: ["el-input__icon", "el-range__icon", _vm.triggerClass]
  673. }),
  674. _c(
  675. "input",
  676. _vm._b(
  677. {
  678. staticClass: "el-range-input",
  679. attrs: {
  680. autocomplete: "off",
  681. placeholder: _vm.startPlaceholder,
  682. disabled: _vm.pickerDisabled,
  683. readonly: !_vm.editable || _vm.readonly,
  684. name: _vm.name && _vm.name[0]
  685. },
  686. domProps: { value: _vm.displayValue && _vm.displayValue[0] },
  687. on: {
  688. input: _vm.handleStartInput,
  689. change: _vm.handleStartChange,
  690. focus: _vm.handleFocus
  691. }
  692. },
  693. "input",
  694. _vm.firstInputId,
  695. false
  696. )
  697. ),
  698. _vm._t("range-separator", [
  699. _c("span", { staticClass: "el-range-separator" }, [
  700. _vm._v(_vm._s(_vm.rangeSeparator))
  701. ])
  702. ]),
  703. _c(
  704. "input",
  705. _vm._b(
  706. {
  707. staticClass: "el-range-input",
  708. attrs: {
  709. autocomplete: "off",
  710. placeholder: _vm.endPlaceholder,
  711. disabled: _vm.pickerDisabled,
  712. readonly: !_vm.editable || _vm.readonly,
  713. name: _vm.name && _vm.name[1]
  714. },
  715. domProps: { value: _vm.displayValue && _vm.displayValue[1] },
  716. on: {
  717. input: _vm.handleEndInput,
  718. change: _vm.handleEndChange,
  719. focus: _vm.handleFocus
  720. }
  721. },
  722. "input",
  723. _vm.secondInputId,
  724. false
  725. )
  726. ),
  727. _vm.haveTrigger
  728. ? _c("i", {
  729. staticClass: "el-input__icon el-range__close-icon",
  730. class: [_vm.showClose ? "" + _vm.clearIcon : ""],
  731. on: { click: _vm.handleClickIcon }
  732. })
  733. : _vm._e()
  734. ],
  735. 2
  736. )
  737. }
  738. var staticRenderFns = []
  739. render._withStripped = true
  740. // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue?vue&type=template&id=79ae069f&
  741. // EXTERNAL MODULE: external "vue"
  742. var external_vue_ = __webpack_require__(7);
  743. var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
  744. // EXTERNAL MODULE: external "element-ui/lib/utils/clickoutside"
  745. var clickoutside_ = __webpack_require__(12);
  746. var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_);
  747. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  748. var date_util_ = __webpack_require__(1);
  749. // EXTERNAL MODULE: external "element-ui/lib/utils/vue-popper"
  750. var vue_popper_ = __webpack_require__(5);
  751. var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
  752. // EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
  753. var emitter_ = __webpack_require__(4);
  754. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  755. // EXTERNAL MODULE: external "element-ui/lib/input"
  756. var input_ = __webpack_require__(10);
  757. var input_default = /*#__PURE__*/__webpack_require__.n(input_);
  758. // EXTERNAL MODULE: external "element-ui/lib/utils/merge"
  759. var merge_ = __webpack_require__(9);
  760. var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
  761. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/picker.vue?vue&type=script&lang=js&
  762. //
  763. //
  764. //
  765. //
  766. //
  767. //
  768. //
  769. //
  770. //
  771. //
  772. //
  773. //
  774. //
  775. //
  776. //
  777. //
  778. //
  779. //
  780. //
  781. //
  782. //
  783. //
  784. //
  785. //
  786. //
  787. //
  788. //
  789. //
  790. //
  791. //
  792. //
  793. //
  794. //
  795. //
  796. //
  797. //
  798. //
  799. //
  800. //
  801. //
  802. //
  803. //
  804. //
  805. //
  806. //
  807. //
  808. //
  809. //
  810. //
  811. //
  812. //
  813. //
  814. //
  815. //
  816. //
  817. //
  818. //
  819. //
  820. //
  821. //
  822. //
  823. //
  824. //
  825. //
  826. //
  827. //
  828. //
  829. //
  830. //
  831. //
  832. //
  833. //
  834. //
  835. //
  836. //
  837. //
  838. //
  839. //
  840. //
  841. //
  842. //
  843. //
  844. //
  845. //
  846. //
  847. var NewPopper = {
  848. props: {
  849. appendToBody: vue_popper_default.a.props.appendToBody,
  850. offset: vue_popper_default.a.props.offset,
  851. boundariesPadding: vue_popper_default.a.props.boundariesPadding,
  852. arrowOffset: vue_popper_default.a.props.arrowOffset
  853. },
  854. methods: vue_popper_default.a.methods,
  855. data: function data() {
  856. return merge_default()({ visibleArrow: true }, vue_popper_default.a.data);
  857. },
  858. beforeDestroy: vue_popper_default.a.beforeDestroy
  859. };
  860. var DEFAULT_FORMATS = {
  861. date: 'yyyy-MM-dd',
  862. month: 'yyyy-MM',
  863. datetime: 'yyyy-MM-dd HH:mm:ss',
  864. time: 'HH:mm:ss',
  865. week: 'yyyywWW',
  866. timerange: 'HH:mm:ss',
  867. daterange: 'yyyy-MM-dd',
  868. monthrange: 'yyyy-MM',
  869. datetimerange: 'yyyy-MM-dd HH:mm:ss',
  870. year: 'yyyy'
  871. };
  872. var HAVE_TRIGGER_TYPES = ['date', 'datetime', 'time', 'time-select', 'week', 'month', 'year', 'daterange', 'monthrange', 'timerange', 'datetimerange', 'dates'];
  873. var pickervue_type_script_lang_js_DATE_FORMATTER = function DATE_FORMATTER(value, format) {
  874. if (format === 'timestamp') return value.getTime();
  875. return Object(date_util_["formatDate"])(value, format);
  876. };
  877. var pickervue_type_script_lang_js_DATE_PARSER = function DATE_PARSER(text, format) {
  878. if (format === 'timestamp') return new Date(Number(text));
  879. return Object(date_util_["parseDate"])(text, format);
  880. };
  881. var RANGE_FORMATTER = function RANGE_FORMATTER(value, format) {
  882. if (Array.isArray(value) && value.length === 2) {
  883. var start = value[0];
  884. var end = value[1];
  885. if (start && end) {
  886. return [pickervue_type_script_lang_js_DATE_FORMATTER(start, format), pickervue_type_script_lang_js_DATE_FORMATTER(end, format)];
  887. }
  888. }
  889. return '';
  890. };
  891. var RANGE_PARSER = function RANGE_PARSER(array, format, separator) {
  892. if (!Array.isArray(array)) {
  893. array = array.split(separator);
  894. }
  895. if (array.length === 2) {
  896. var range1 = array[0];
  897. var range2 = array[1];
  898. return [pickervue_type_script_lang_js_DATE_PARSER(range1, format), pickervue_type_script_lang_js_DATE_PARSER(range2, format)];
  899. }
  900. return [];
  901. };
  902. var TYPE_VALUE_RESOLVER_MAP = {
  903. default: {
  904. formatter: function formatter(value) {
  905. if (!value) return '';
  906. return '' + value;
  907. },
  908. parser: function parser(text) {
  909. if (text === undefined || text === '') return null;
  910. return text;
  911. }
  912. },
  913. week: {
  914. formatter: function formatter(value, format) {
  915. var week = Object(date_util_["getWeekNumber"])(value);
  916. var month = value.getMonth();
  917. var trueDate = new Date(value);
  918. if (week === 1 && month === 11) {
  919. trueDate.setHours(0, 0, 0, 0);
  920. trueDate.setDate(trueDate.getDate() + 3 - (trueDate.getDay() + 6) % 7);
  921. }
  922. var date = Object(date_util_["formatDate"])(trueDate, format);
  923. date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? '0' + week : week) : date.replace(/W/, week);
  924. return date;
  925. },
  926. parser: function parser(text, format) {
  927. // parse as if a normal date
  928. return TYPE_VALUE_RESOLVER_MAP.date.parser(text, format);
  929. }
  930. },
  931. date: {
  932. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  933. parser: pickervue_type_script_lang_js_DATE_PARSER
  934. },
  935. datetime: {
  936. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  937. parser: pickervue_type_script_lang_js_DATE_PARSER
  938. },
  939. daterange: {
  940. formatter: RANGE_FORMATTER,
  941. parser: RANGE_PARSER
  942. },
  943. monthrange: {
  944. formatter: RANGE_FORMATTER,
  945. parser: RANGE_PARSER
  946. },
  947. datetimerange: {
  948. formatter: RANGE_FORMATTER,
  949. parser: RANGE_PARSER
  950. },
  951. timerange: {
  952. formatter: RANGE_FORMATTER,
  953. parser: RANGE_PARSER
  954. },
  955. time: {
  956. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  957. parser: pickervue_type_script_lang_js_DATE_PARSER
  958. },
  959. month: {
  960. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  961. parser: pickervue_type_script_lang_js_DATE_PARSER
  962. },
  963. year: {
  964. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  965. parser: pickervue_type_script_lang_js_DATE_PARSER
  966. },
  967. number: {
  968. formatter: function formatter(value) {
  969. if (!value) return '';
  970. return '' + value;
  971. },
  972. parser: function parser(text) {
  973. var result = Number(text);
  974. if (!isNaN(text)) {
  975. return result;
  976. } else {
  977. return null;
  978. }
  979. }
  980. },
  981. dates: {
  982. formatter: function formatter(value, format) {
  983. return value.map(function (date) {
  984. return pickervue_type_script_lang_js_DATE_FORMATTER(date, format);
  985. });
  986. },
  987. parser: function parser(value, format) {
  988. return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
  989. return date instanceof Date ? date : pickervue_type_script_lang_js_DATE_PARSER(date, format);
  990. });
  991. }
  992. }
  993. };
  994. var PLACEMENT_MAP = {
  995. left: 'bottom-start',
  996. center: 'bottom',
  997. right: 'bottom-end'
  998. };
  999. var parseAsFormatAndType = function parseAsFormatAndType(value, customFormat, type) {
  1000. var rangeSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '-';
  1001. if (!value) return null;
  1002. var parser = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).parser;
  1003. var format = customFormat || DEFAULT_FORMATS[type];
  1004. return parser(value, format, rangeSeparator);
  1005. };
  1006. var formatAsFormatAndType = function formatAsFormatAndType(value, customFormat, type) {
  1007. if (!value) return null;
  1008. var formatter = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).formatter;
  1009. var format = customFormat || DEFAULT_FORMATS[type];
  1010. return formatter(value, format);
  1011. };
  1012. /*
  1013. * Considers:
  1014. * 1. Date object
  1015. * 2. date string
  1016. * 3. array of 1 or 2
  1017. */
  1018. var valueEquals = function valueEquals(a, b) {
  1019. // considers Date object and string
  1020. var dateEquals = function dateEquals(a, b) {
  1021. var aIsDate = a instanceof Date;
  1022. var bIsDate = b instanceof Date;
  1023. if (aIsDate && bIsDate) {
  1024. return a.getTime() === b.getTime();
  1025. }
  1026. if (!aIsDate && !bIsDate) {
  1027. return a === b;
  1028. }
  1029. return false;
  1030. };
  1031. var aIsArray = a instanceof Array;
  1032. var bIsArray = b instanceof Array;
  1033. if (aIsArray && bIsArray) {
  1034. if (a.length !== b.length) {
  1035. return false;
  1036. }
  1037. return a.every(function (item, index) {
  1038. return dateEquals(item, b[index]);
  1039. });
  1040. }
  1041. if (!aIsArray && !bIsArray) {
  1042. return dateEquals(a, b);
  1043. }
  1044. return false;
  1045. };
  1046. var isString = function isString(val) {
  1047. return typeof val === 'string' || val instanceof String;
  1048. };
  1049. var validator = function validator(val) {
  1050. // either: String, Array of String, null / undefined
  1051. return val === null || val === undefined || isString(val) || Array.isArray(val) && val.length === 2 && val.every(isString);
  1052. };
  1053. /* harmony default export */ var pickervue_type_script_lang_js_ = ({
  1054. mixins: [emitter_default.a, NewPopper],
  1055. inject: {
  1056. elForm: {
  1057. default: ''
  1058. },
  1059. elFormItem: {
  1060. default: ''
  1061. }
  1062. },
  1063. props: {
  1064. size: String,
  1065. format: String,
  1066. valueFormat: String,
  1067. readonly: Boolean,
  1068. placeholder: String,
  1069. startPlaceholder: String,
  1070. endPlaceholder: String,
  1071. prefixIcon: String,
  1072. clearIcon: {
  1073. type: String,
  1074. default: 'el-icon-circle-close'
  1075. },
  1076. name: {
  1077. default: '',
  1078. validator: validator
  1079. },
  1080. disabled: Boolean,
  1081. clearable: {
  1082. type: Boolean,
  1083. default: true
  1084. },
  1085. id: {
  1086. default: '',
  1087. validator: validator
  1088. },
  1089. popperClass: String,
  1090. editable: {
  1091. type: Boolean,
  1092. default: true
  1093. },
  1094. align: {
  1095. type: String,
  1096. default: 'left'
  1097. },
  1098. value: {},
  1099. defaultValue: {},
  1100. defaultTime: {},
  1101. rangeSeparator: {
  1102. default: '-'
  1103. },
  1104. pickerOptions: {},
  1105. unlinkPanels: Boolean,
  1106. validateEvent: {
  1107. type: Boolean,
  1108. default: true
  1109. }
  1110. },
  1111. components: { ElInput: input_default.a },
  1112. directives: { Clickoutside: clickoutside_default.a },
  1113. data: function data() {
  1114. return {
  1115. pickerVisible: false,
  1116. showClose: false,
  1117. userInput: null,
  1118. valueOnOpen: null, // value when picker opens, used to determine whether to emit change
  1119. unwatchPickerOptions: null
  1120. };
  1121. },
  1122. watch: {
  1123. pickerVisible: function pickerVisible(val) {
  1124. if (this.readonly || this.pickerDisabled) return;
  1125. if (val) {
  1126. this.showPicker();
  1127. this.valueOnOpen = Array.isArray(this.value) ? [].concat(this.value) : this.value;
  1128. } else {
  1129. this.hidePicker();
  1130. this.emitChange(this.value);
  1131. this.userInput = null;
  1132. if (this.validateEvent) {
  1133. this.dispatch('ElFormItem', 'el.form.blur');
  1134. }
  1135. this.$emit('blur', this);
  1136. this.blur();
  1137. }
  1138. },
  1139. parsedValue: {
  1140. immediate: true,
  1141. handler: function handler(val) {
  1142. if (this.picker) {
  1143. this.picker.value = val;
  1144. }
  1145. }
  1146. },
  1147. defaultValue: function defaultValue(val) {
  1148. // NOTE: should eventually move to jsx style picker + panel ?
  1149. if (this.picker) {
  1150. this.picker.defaultValue = val;
  1151. }
  1152. },
  1153. value: function value(val, oldVal) {
  1154. if (!valueEquals(val, oldVal) && !this.pickerVisible && this.validateEvent) {
  1155. this.dispatch('ElFormItem', 'el.form.change', val);
  1156. }
  1157. }
  1158. },
  1159. computed: {
  1160. ranged: function ranged() {
  1161. return this.type.indexOf('range') > -1;
  1162. },
  1163. reference: function reference() {
  1164. var reference = this.$refs.reference;
  1165. return reference.$el || reference;
  1166. },
  1167. refInput: function refInput() {
  1168. if (this.reference) {
  1169. return [].slice.call(this.reference.querySelectorAll('input'));
  1170. }
  1171. return [];
  1172. },
  1173. valueIsEmpty: function valueIsEmpty() {
  1174. var val = this.value;
  1175. if (Array.isArray(val)) {
  1176. for (var i = 0, len = val.length; i < len; i++) {
  1177. if (val[i]) {
  1178. return false;
  1179. }
  1180. }
  1181. } else {
  1182. if (val) {
  1183. return false;
  1184. }
  1185. }
  1186. return true;
  1187. },
  1188. triggerClass: function triggerClass() {
  1189. return this.prefixIcon || (this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date');
  1190. },
  1191. selectionMode: function selectionMode() {
  1192. if (this.type === 'week') {
  1193. return 'week';
  1194. } else if (this.type === 'month') {
  1195. return 'month';
  1196. } else if (this.type === 'year') {
  1197. return 'year';
  1198. } else if (this.type === 'dates') {
  1199. return 'dates';
  1200. }
  1201. return 'day';
  1202. },
  1203. haveTrigger: function haveTrigger() {
  1204. if (typeof this.showTrigger !== 'undefined') {
  1205. return this.showTrigger;
  1206. }
  1207. return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
  1208. },
  1209. displayValue: function displayValue() {
  1210. var formattedValue = formatAsFormatAndType(this.parsedValue, this.format, this.type, this.rangeSeparator);
  1211. if (Array.isArray(this.userInput)) {
  1212. return [this.userInput[0] || formattedValue && formattedValue[0] || '', this.userInput[1] || formattedValue && formattedValue[1] || ''];
  1213. } else if (this.userInput !== null) {
  1214. return this.userInput;
  1215. } else if (formattedValue) {
  1216. return this.type === 'dates' ? formattedValue.join(', ') : formattedValue;
  1217. } else {
  1218. return '';
  1219. }
  1220. },
  1221. parsedValue: function parsedValue() {
  1222. if (!this.value) return this.value; // component value is not set
  1223. if (this.type === 'time-select') return this.value; // time-select does not require parsing, this might change in next major version
  1224. var valueIsDateObject = Object(date_util_["isDateObject"])(this.value) || Array.isArray(this.value) && this.value.every(date_util_["isDateObject"]);
  1225. if (valueIsDateObject) {
  1226. return this.value;
  1227. }
  1228. if (this.valueFormat) {
  1229. return parseAsFormatAndType(this.value, this.valueFormat, this.type, this.rangeSeparator) || this.value;
  1230. }
  1231. // NOTE: deal with common but incorrect usage, should remove in next major version
  1232. // user might provide string / timestamp without value-format, coerce them into date (or array of date)
  1233. return Array.isArray(this.value) ? this.value.map(function (val) {
  1234. return new Date(val);
  1235. }) : new Date(this.value);
  1236. },
  1237. _elFormItemSize: function _elFormItemSize() {
  1238. return (this.elFormItem || {}).elFormItemSize;
  1239. },
  1240. pickerSize: function pickerSize() {
  1241. return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
  1242. },
  1243. pickerDisabled: function pickerDisabled() {
  1244. return this.disabled || (this.elForm || {}).disabled;
  1245. },
  1246. firstInputId: function firstInputId() {
  1247. var obj = {};
  1248. var id = void 0;
  1249. if (this.ranged) {
  1250. id = this.id && this.id[0];
  1251. } else {
  1252. id = this.id;
  1253. }
  1254. if (id) obj.id = id;
  1255. return obj;
  1256. },
  1257. secondInputId: function secondInputId() {
  1258. var obj = {};
  1259. var id = void 0;
  1260. if (this.ranged) {
  1261. id = this.id && this.id[1];
  1262. }
  1263. if (id) obj.id = id;
  1264. return obj;
  1265. }
  1266. },
  1267. created: function created() {
  1268. // vue-popper
  1269. this.popperOptions = {
  1270. boundariesPadding: 0,
  1271. gpuAcceleration: false
  1272. };
  1273. this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
  1274. this.$on('fieldReset', this.handleFieldReset);
  1275. },
  1276. methods: {
  1277. focus: function focus() {
  1278. if (!this.ranged) {
  1279. this.$refs.reference.focus();
  1280. } else {
  1281. this.handleFocus();
  1282. }
  1283. },
  1284. blur: function blur() {
  1285. this.refInput.forEach(function (input) {
  1286. return input.blur();
  1287. });
  1288. },
  1289. // {parse, formatTo} Value deals maps component value with internal Date
  1290. parseValue: function parseValue(value) {
  1291. var isParsed = Object(date_util_["isDateObject"])(value) || Array.isArray(value) && value.every(date_util_["isDateObject"]);
  1292. if (this.valueFormat && !isParsed) {
  1293. return parseAsFormatAndType(value, this.valueFormat, this.type, this.rangeSeparator) || value;
  1294. } else {
  1295. return value;
  1296. }
  1297. },
  1298. formatToValue: function formatToValue(date) {
  1299. var isFormattable = Object(date_util_["isDateObject"])(date) || Array.isArray(date) && date.every(date_util_["isDateObject"]);
  1300. if (this.valueFormat && isFormattable) {
  1301. return formatAsFormatAndType(date, this.valueFormat, this.type, this.rangeSeparator);
  1302. } else {
  1303. return date;
  1304. }
  1305. },
  1306. // {parse, formatTo} String deals with user input
  1307. parseString: function parseString(value) {
  1308. var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
  1309. return parseAsFormatAndType(value, this.format, type);
  1310. },
  1311. formatToString: function formatToString(value) {
  1312. var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
  1313. return formatAsFormatAndType(value, this.format, type);
  1314. },
  1315. handleMouseEnter: function handleMouseEnter() {
  1316. if (this.readonly || this.pickerDisabled) return;
  1317. if (!this.valueIsEmpty && this.clearable) {
  1318. this.showClose = true;
  1319. }
  1320. },
  1321. handleChange: function handleChange() {
  1322. if (this.userInput) {
  1323. var value = this.parseString(this.displayValue);
  1324. if (value) {
  1325. this.picker.value = value;
  1326. if (this.isValidValue(value)) {
  1327. this.emitInput(value);
  1328. this.userInput = null;
  1329. }
  1330. }
  1331. }
  1332. if (this.userInput === '') {
  1333. this.emitInput(null);
  1334. this.emitChange(null);
  1335. this.userInput = null;
  1336. }
  1337. },
  1338. handleStartInput: function handleStartInput(event) {
  1339. if (this.userInput) {
  1340. this.userInput = [event.target.value, this.userInput[1]];
  1341. } else {
  1342. this.userInput = [event.target.value, null];
  1343. }
  1344. },
  1345. handleEndInput: function handleEndInput(event) {
  1346. if (this.userInput) {
  1347. this.userInput = [this.userInput[0], event.target.value];
  1348. } else {
  1349. this.userInput = [null, event.target.value];
  1350. }
  1351. },
  1352. handleStartChange: function handleStartChange(event) {
  1353. var value = this.parseString(this.userInput && this.userInput[0]);
  1354. if (value) {
  1355. this.userInput = [this.formatToString(value), this.displayValue[1]];
  1356. var newValue = [value, this.picker.value && this.picker.value[1]];
  1357. this.picker.value = newValue;
  1358. if (this.isValidValue(newValue)) {
  1359. this.emitInput(newValue);
  1360. this.userInput = null;
  1361. }
  1362. }
  1363. },
  1364. handleEndChange: function handleEndChange(event) {
  1365. var value = this.parseString(this.userInput && this.userInput[1]);
  1366. if (value) {
  1367. this.userInput = [this.displayValue[0], this.formatToString(value)];
  1368. var newValue = [this.picker.value && this.picker.value[0], value];
  1369. this.picker.value = newValue;
  1370. if (this.isValidValue(newValue)) {
  1371. this.emitInput(newValue);
  1372. this.userInput = null;
  1373. }
  1374. }
  1375. },
  1376. handleClickIcon: function handleClickIcon(event) {
  1377. if (this.readonly || this.pickerDisabled) return;
  1378. if (this.showClose) {
  1379. this.valueOnOpen = this.value;
  1380. event.stopPropagation();
  1381. this.emitInput(null);
  1382. this.emitChange(null);
  1383. this.showClose = false;
  1384. if (this.picker && typeof this.picker.handleClear === 'function') {
  1385. this.picker.handleClear();
  1386. }
  1387. } else {
  1388. this.pickerVisible = !this.pickerVisible;
  1389. }
  1390. },
  1391. handleClose: function handleClose() {
  1392. if (!this.pickerVisible) return;
  1393. this.pickerVisible = false;
  1394. if (this.type === 'dates') {
  1395. // restore to former value
  1396. var oldValue = parseAsFormatAndType(this.valueOnOpen, this.valueFormat, this.type, this.rangeSeparator) || this.valueOnOpen;
  1397. this.emitInput(oldValue);
  1398. }
  1399. },
  1400. handleFieldReset: function handleFieldReset(initialValue) {
  1401. this.userInput = initialValue === '' ? null : initialValue;
  1402. },
  1403. handleFocus: function handleFocus() {
  1404. var type = this.type;
  1405. if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
  1406. this.pickerVisible = true;
  1407. }
  1408. this.$emit('focus', this);
  1409. },
  1410. handleKeydown: function handleKeydown(event) {
  1411. var _this = this;
  1412. var keyCode = event.keyCode;
  1413. // ESC
  1414. if (keyCode === 27) {
  1415. this.pickerVisible = false;
  1416. event.stopPropagation();
  1417. return;
  1418. }
  1419. // Tab
  1420. if (keyCode === 9) {
  1421. if (!this.ranged) {
  1422. this.handleChange();
  1423. this.pickerVisible = this.picker.visible = false;
  1424. this.blur();
  1425. event.stopPropagation();
  1426. } else {
  1427. // user may change focus between two input
  1428. setTimeout(function () {
  1429. if (_this.refInput.indexOf(document.activeElement) === -1) {
  1430. _this.pickerVisible = false;
  1431. _this.blur();
  1432. event.stopPropagation();
  1433. }
  1434. }, 0);
  1435. }
  1436. return;
  1437. }
  1438. // Enter
  1439. if (keyCode === 13) {
  1440. if (this.userInput === '' || this.isValidValue(this.parseString(this.displayValue))) {
  1441. this.handleChange();
  1442. this.pickerVisible = this.picker.visible = false;
  1443. this.blur();
  1444. }
  1445. event.stopPropagation();
  1446. return;
  1447. }
  1448. // if user is typing, do not let picker handle key input
  1449. if (this.userInput) {
  1450. event.stopPropagation();
  1451. return;
  1452. }
  1453. // delegate other keys to panel
  1454. if (this.picker && this.picker.handleKeydown) {
  1455. this.picker.handleKeydown(event);
  1456. }
  1457. },
  1458. handleRangeClick: function handleRangeClick() {
  1459. var type = this.type;
  1460. if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
  1461. this.pickerVisible = true;
  1462. }
  1463. this.$emit('focus', this);
  1464. },
  1465. hidePicker: function hidePicker() {
  1466. if (this.picker) {
  1467. this.picker.resetView && this.picker.resetView();
  1468. this.pickerVisible = this.picker.visible = false;
  1469. this.destroyPopper();
  1470. }
  1471. },
  1472. showPicker: function showPicker() {
  1473. var _this2 = this;
  1474. if (this.$isServer) return;
  1475. if (!this.picker) {
  1476. this.mountPicker();
  1477. }
  1478. this.pickerVisible = this.picker.visible = true;
  1479. this.updatePopper();
  1480. this.picker.value = this.parsedValue;
  1481. this.picker.resetView && this.picker.resetView();
  1482. this.$nextTick(function () {
  1483. _this2.picker.adjustSpinners && _this2.picker.adjustSpinners();
  1484. });
  1485. },
  1486. mountPicker: function mountPicker() {
  1487. var _this3 = this;
  1488. this.picker = new external_vue_default.a(this.panel).$mount();
  1489. this.picker.defaultValue = this.defaultValue;
  1490. this.picker.defaultTime = this.defaultTime;
  1491. this.picker.popperClass = this.popperClass;
  1492. this.popperElm = this.picker.$el;
  1493. this.picker.width = this.reference.getBoundingClientRect().width;
  1494. this.picker.showTime = this.type === 'datetime' || this.type === 'datetimerange';
  1495. this.picker.selectionMode = this.selectionMode;
  1496. this.picker.unlinkPanels = this.unlinkPanels;
  1497. this.picker.arrowControl = this.arrowControl || this.timeArrowControl || false;
  1498. this.$watch('format', function (format) {
  1499. _this3.picker.format = format;
  1500. });
  1501. var updateOptions = function updateOptions() {
  1502. var options = _this3.pickerOptions;
  1503. if (options && options.selectableRange) {
  1504. var ranges = options.selectableRange;
  1505. var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
  1506. var format = DEFAULT_FORMATS.timerange;
  1507. ranges = Array.isArray(ranges) ? ranges : [ranges];
  1508. _this3.picker.selectableRange = ranges.map(function (range) {
  1509. return parser(range, format, _this3.rangeSeparator);
  1510. });
  1511. }
  1512. for (var option in options) {
  1513. if (options.hasOwnProperty(option) &&
  1514. // 忽略 time-picker 的该配置项
  1515. option !== 'selectableRange') {
  1516. _this3.picker[option] = options[option];
  1517. }
  1518. }
  1519. // main format must prevail over undocumented pickerOptions.format
  1520. if (_this3.format) {
  1521. _this3.picker.format = _this3.format;
  1522. }
  1523. };
  1524. updateOptions();
  1525. this.unwatchPickerOptions = this.$watch('pickerOptions', function () {
  1526. return updateOptions();
  1527. }, { deep: true });
  1528. this.$el.appendChild(this.picker.$el);
  1529. this.picker.resetView && this.picker.resetView();
  1530. this.picker.$on('dodestroy', this.doDestroy);
  1531. this.picker.$on('pick', function () {
  1532. var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  1533. var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1534. _this3.userInput = null;
  1535. _this3.pickerVisible = _this3.picker.visible = visible;
  1536. _this3.emitInput(date);
  1537. _this3.picker.resetView && _this3.picker.resetView();
  1538. });
  1539. this.picker.$on('select-range', function (start, end, pos) {
  1540. if (_this3.refInput.length === 0) return;
  1541. if (!pos || pos === 'min') {
  1542. _this3.refInput[0].setSelectionRange(start, end);
  1543. _this3.refInput[0].focus();
  1544. } else if (pos === 'max') {
  1545. _this3.refInput[1].setSelectionRange(start, end);
  1546. _this3.refInput[1].focus();
  1547. }
  1548. });
  1549. },
  1550. unmountPicker: function unmountPicker() {
  1551. if (this.picker) {
  1552. this.picker.$destroy();
  1553. this.picker.$off();
  1554. if (typeof this.unwatchPickerOptions === 'function') {
  1555. this.unwatchPickerOptions();
  1556. }
  1557. this.picker.$el.parentNode.removeChild(this.picker.$el);
  1558. }
  1559. },
  1560. emitChange: function emitChange(val) {
  1561. // determine user real change only
  1562. if (!valueEquals(val, this.valueOnOpen)) {
  1563. this.$emit('change', val);
  1564. this.valueOnOpen = val;
  1565. if (this.validateEvent) {
  1566. this.dispatch('ElFormItem', 'el.form.change', val);
  1567. }
  1568. }
  1569. },
  1570. emitInput: function emitInput(val) {
  1571. var formatted = this.formatToValue(val);
  1572. if (!valueEquals(this.value, formatted)) {
  1573. this.$emit('input', formatted);
  1574. }
  1575. },
  1576. isValidValue: function isValidValue(value) {
  1577. if (!this.picker) {
  1578. this.mountPicker();
  1579. }
  1580. if (this.picker.isValidValue) {
  1581. return value && this.picker.isValidValue(value);
  1582. } else {
  1583. return true;
  1584. }
  1585. }
  1586. }
  1587. });
  1588. // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue?vue&type=script&lang=js&
  1589. /* harmony default export */ var src_pickervue_type_script_lang_js_ = (pickervue_type_script_lang_js_);
  1590. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  1591. var componentNormalizer = __webpack_require__(0);
  1592. // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue
  1593. /* normalize component */
  1594. var component = Object(componentNormalizer["a" /* default */])(
  1595. src_pickervue_type_script_lang_js_,
  1596. render,
  1597. staticRenderFns,
  1598. false,
  1599. null,
  1600. null,
  1601. null
  1602. )
  1603. /* hot reload */
  1604. if (false) { var api; }
  1605. component.options.__file = "packages/date-picker/src/picker.vue"
  1606. /* harmony default export */ var picker = __webpack_exports__["a"] = (component.exports);
  1607. /***/ }),
  1608. /* 34 */,
  1609. /* 35 */
  1610. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1611. "use strict";
  1612. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/time-spinner.vue?vue&type=template&id=1facadeb&
  1613. var render = function() {
  1614. var _vm = this
  1615. var _h = _vm.$createElement
  1616. var _c = _vm._self._c || _h
  1617. return _c(
  1618. "div",
  1619. {
  1620. staticClass: "el-time-spinner",
  1621. class: { "has-seconds": _vm.showSeconds }
  1622. },
  1623. [
  1624. !_vm.arrowControl
  1625. ? [
  1626. _c(
  1627. "el-scrollbar",
  1628. {
  1629. ref: "hours",
  1630. staticClass: "el-time-spinner__wrapper",
  1631. attrs: {
  1632. "wrap-style": "max-height: inherit;",
  1633. "view-class": "el-time-spinner__list",
  1634. noresize: "",
  1635. tag: "ul"
  1636. },
  1637. nativeOn: {
  1638. mouseenter: function($event) {
  1639. _vm.emitSelectRange("hours")
  1640. },
  1641. mousemove: function($event) {
  1642. _vm.adjustCurrentSpinner("hours")
  1643. }
  1644. }
  1645. },
  1646. _vm._l(_vm.hoursList, function(disabled, hour) {
  1647. return _c(
  1648. "li",
  1649. {
  1650. key: hour,
  1651. staticClass: "el-time-spinner__item",
  1652. class: { active: hour === _vm.hours, disabled: disabled },
  1653. on: {
  1654. click: function($event) {
  1655. _vm.handleClick("hours", {
  1656. value: hour,
  1657. disabled: disabled
  1658. })
  1659. }
  1660. }
  1661. },
  1662. [
  1663. _vm._v(
  1664. _vm._s(
  1665. ("0" + (_vm.amPmMode ? hour % 12 || 12 : hour)).slice(
  1666. -2
  1667. )
  1668. ) + _vm._s(_vm.amPm(hour))
  1669. )
  1670. ]
  1671. )
  1672. }),
  1673. 0
  1674. ),
  1675. _c(
  1676. "el-scrollbar",
  1677. {
  1678. ref: "minutes",
  1679. staticClass: "el-time-spinner__wrapper",
  1680. attrs: {
  1681. "wrap-style": "max-height: inherit;",
  1682. "view-class": "el-time-spinner__list",
  1683. noresize: "",
  1684. tag: "ul"
  1685. },
  1686. nativeOn: {
  1687. mouseenter: function($event) {
  1688. _vm.emitSelectRange("minutes")
  1689. },
  1690. mousemove: function($event) {
  1691. _vm.adjustCurrentSpinner("minutes")
  1692. }
  1693. }
  1694. },
  1695. _vm._l(_vm.minutesList, function(enabled, key) {
  1696. return _c(
  1697. "li",
  1698. {
  1699. key: key,
  1700. staticClass: "el-time-spinner__item",
  1701. class: { active: key === _vm.minutes, disabled: !enabled },
  1702. on: {
  1703. click: function($event) {
  1704. _vm.handleClick("minutes", {
  1705. value: key,
  1706. disabled: false
  1707. })
  1708. }
  1709. }
  1710. },
  1711. [_vm._v(_vm._s(("0" + key).slice(-2)))]
  1712. )
  1713. }),
  1714. 0
  1715. ),
  1716. _c(
  1717. "el-scrollbar",
  1718. {
  1719. directives: [
  1720. {
  1721. name: "show",
  1722. rawName: "v-show",
  1723. value: _vm.showSeconds,
  1724. expression: "showSeconds"
  1725. }
  1726. ],
  1727. ref: "seconds",
  1728. staticClass: "el-time-spinner__wrapper",
  1729. attrs: {
  1730. "wrap-style": "max-height: inherit;",
  1731. "view-class": "el-time-spinner__list",
  1732. noresize: "",
  1733. tag: "ul"
  1734. },
  1735. nativeOn: {
  1736. mouseenter: function($event) {
  1737. _vm.emitSelectRange("seconds")
  1738. },
  1739. mousemove: function($event) {
  1740. _vm.adjustCurrentSpinner("seconds")
  1741. }
  1742. }
  1743. },
  1744. _vm._l(60, function(second, key) {
  1745. return _c(
  1746. "li",
  1747. {
  1748. key: key,
  1749. staticClass: "el-time-spinner__item",
  1750. class: { active: key === _vm.seconds },
  1751. on: {
  1752. click: function($event) {
  1753. _vm.handleClick("seconds", {
  1754. value: key,
  1755. disabled: false
  1756. })
  1757. }
  1758. }
  1759. },
  1760. [_vm._v(_vm._s(("0" + key).slice(-2)))]
  1761. )
  1762. }),
  1763. 0
  1764. )
  1765. ]
  1766. : _vm._e(),
  1767. _vm.arrowControl
  1768. ? [
  1769. _c(
  1770. "div",
  1771. {
  1772. staticClass: "el-time-spinner__wrapper is-arrow",
  1773. on: {
  1774. mouseenter: function($event) {
  1775. _vm.emitSelectRange("hours")
  1776. }
  1777. }
  1778. },
  1779. [
  1780. _c("i", {
  1781. directives: [
  1782. {
  1783. name: "repeat-click",
  1784. rawName: "v-repeat-click",
  1785. value: _vm.decrease,
  1786. expression: "decrease"
  1787. }
  1788. ],
  1789. staticClass: "el-time-spinner__arrow el-icon-arrow-up"
  1790. }),
  1791. _c("i", {
  1792. directives: [
  1793. {
  1794. name: "repeat-click",
  1795. rawName: "v-repeat-click",
  1796. value: _vm.increase,
  1797. expression: "increase"
  1798. }
  1799. ],
  1800. staticClass: "el-time-spinner__arrow el-icon-arrow-down"
  1801. }),
  1802. _c(
  1803. "ul",
  1804. { ref: "hours", staticClass: "el-time-spinner__list" },
  1805. _vm._l(_vm.arrowHourList, function(hour, key) {
  1806. return _c(
  1807. "li",
  1808. {
  1809. key: key,
  1810. staticClass: "el-time-spinner__item",
  1811. class: {
  1812. active: hour === _vm.hours,
  1813. disabled: _vm.hoursList[hour]
  1814. }
  1815. },
  1816. [
  1817. _vm._v(
  1818. _vm._s(
  1819. hour === undefined
  1820. ? ""
  1821. : (
  1822. "0" + (_vm.amPmMode ? hour % 12 || 12 : hour)
  1823. ).slice(-2) + _vm.amPm(hour)
  1824. )
  1825. )
  1826. ]
  1827. )
  1828. }),
  1829. 0
  1830. )
  1831. ]
  1832. ),
  1833. _c(
  1834. "div",
  1835. {
  1836. staticClass: "el-time-spinner__wrapper is-arrow",
  1837. on: {
  1838. mouseenter: function($event) {
  1839. _vm.emitSelectRange("minutes")
  1840. }
  1841. }
  1842. },
  1843. [
  1844. _c("i", {
  1845. directives: [
  1846. {
  1847. name: "repeat-click",
  1848. rawName: "v-repeat-click",
  1849. value: _vm.decrease,
  1850. expression: "decrease"
  1851. }
  1852. ],
  1853. staticClass: "el-time-spinner__arrow el-icon-arrow-up"
  1854. }),
  1855. _c("i", {
  1856. directives: [
  1857. {
  1858. name: "repeat-click",
  1859. rawName: "v-repeat-click",
  1860. value: _vm.increase,
  1861. expression: "increase"
  1862. }
  1863. ],
  1864. staticClass: "el-time-spinner__arrow el-icon-arrow-down"
  1865. }),
  1866. _c(
  1867. "ul",
  1868. { ref: "minutes", staticClass: "el-time-spinner__list" },
  1869. _vm._l(_vm.arrowMinuteList, function(minute, key) {
  1870. return _c(
  1871. "li",
  1872. {
  1873. key: key,
  1874. staticClass: "el-time-spinner__item",
  1875. class: { active: minute === _vm.minutes }
  1876. },
  1877. [
  1878. _vm._v(
  1879. "\n " +
  1880. _vm._s(
  1881. minute === undefined
  1882. ? ""
  1883. : ("0" + minute).slice(-2)
  1884. ) +
  1885. "\n "
  1886. )
  1887. ]
  1888. )
  1889. }),
  1890. 0
  1891. )
  1892. ]
  1893. ),
  1894. _vm.showSeconds
  1895. ? _c(
  1896. "div",
  1897. {
  1898. staticClass: "el-time-spinner__wrapper is-arrow",
  1899. on: {
  1900. mouseenter: function($event) {
  1901. _vm.emitSelectRange("seconds")
  1902. }
  1903. }
  1904. },
  1905. [
  1906. _c("i", {
  1907. directives: [
  1908. {
  1909. name: "repeat-click",
  1910. rawName: "v-repeat-click",
  1911. value: _vm.decrease,
  1912. expression: "decrease"
  1913. }
  1914. ],
  1915. staticClass: "el-time-spinner__arrow el-icon-arrow-up"
  1916. }),
  1917. _c("i", {
  1918. directives: [
  1919. {
  1920. name: "repeat-click",
  1921. rawName: "v-repeat-click",
  1922. value: _vm.increase,
  1923. expression: "increase"
  1924. }
  1925. ],
  1926. staticClass: "el-time-spinner__arrow el-icon-arrow-down"
  1927. }),
  1928. _c(
  1929. "ul",
  1930. { ref: "seconds", staticClass: "el-time-spinner__list" },
  1931. _vm._l(_vm.arrowSecondList, function(second, key) {
  1932. return _c(
  1933. "li",
  1934. {
  1935. key: key,
  1936. staticClass: "el-time-spinner__item",
  1937. class: { active: second === _vm.seconds }
  1938. },
  1939. [
  1940. _vm._v(
  1941. "\n " +
  1942. _vm._s(
  1943. second === undefined
  1944. ? ""
  1945. : ("0" + second).slice(-2)
  1946. ) +
  1947. "\n "
  1948. )
  1949. ]
  1950. )
  1951. }),
  1952. 0
  1953. )
  1954. ]
  1955. )
  1956. : _vm._e()
  1957. ]
  1958. : _vm._e()
  1959. ],
  1960. 2
  1961. )
  1962. }
  1963. var staticRenderFns = []
  1964. render._withStripped = true
  1965. // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue?vue&type=template&id=1facadeb&
  1966. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  1967. var date_util_ = __webpack_require__(1);
  1968. // EXTERNAL MODULE: external "element-ui/lib/scrollbar"
  1969. var scrollbar_ = __webpack_require__(14);
  1970. var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_);
  1971. // EXTERNAL MODULE: ./src/directives/repeat-click.js
  1972. var repeat_click = __webpack_require__(30);
  1973. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/time-spinner.vue?vue&type=script&lang=js&
  1974. //
  1975. //
  1976. //
  1977. //
  1978. //
  1979. //
  1980. //
  1981. //
  1982. //
  1983. //
  1984. //
  1985. //
  1986. //
  1987. //
  1988. //
  1989. //
  1990. //
  1991. //
  1992. //
  1993. //
  1994. //
  1995. //
  1996. //
  1997. //
  1998. //
  1999. //
  2000. //
  2001. //
  2002. //
  2003. //
  2004. //
  2005. //
  2006. //
  2007. //
  2008. //
  2009. //
  2010. //
  2011. //
  2012. //
  2013. //
  2014. //
  2015. //
  2016. //
  2017. //
  2018. //
  2019. //
  2020. //
  2021. //
  2022. //
  2023. //
  2024. //
  2025. //
  2026. //
  2027. //
  2028. //
  2029. //
  2030. //
  2031. //
  2032. //
  2033. //
  2034. //
  2035. //
  2036. //
  2037. //
  2038. //
  2039. //
  2040. //
  2041. //
  2042. //
  2043. //
  2044. //
  2045. //
  2046. //
  2047. //
  2048. //
  2049. //
  2050. //
  2051. //
  2052. //
  2053. //
  2054. //
  2055. //
  2056. //
  2057. //
  2058. //
  2059. //
  2060. //
  2061. //
  2062. //
  2063. //
  2064. //
  2065. //
  2066. //
  2067. //
  2068. //
  2069. //
  2070. //
  2071. //
  2072. //
  2073. //
  2074. //
  2075. //
  2076. /* harmony default export */ var time_spinnervue_type_script_lang_js_ = ({
  2077. components: { ElScrollbar: scrollbar_default.a },
  2078. directives: {
  2079. repeatClick: repeat_click["a" /* default */]
  2080. },
  2081. props: {
  2082. date: {},
  2083. defaultValue: {}, // reserved for future use
  2084. showSeconds: {
  2085. type: Boolean,
  2086. default: true
  2087. },
  2088. arrowControl: Boolean,
  2089. amPmMode: {
  2090. type: String,
  2091. default: '' // 'a': am/pm; 'A': AM/PM
  2092. }
  2093. },
  2094. computed: {
  2095. hours: function hours() {
  2096. return this.date.getHours();
  2097. },
  2098. minutes: function minutes() {
  2099. return this.date.getMinutes();
  2100. },
  2101. seconds: function seconds() {
  2102. return this.date.getSeconds();
  2103. },
  2104. hoursList: function hoursList() {
  2105. return Object(date_util_["getRangeHours"])(this.selectableRange);
  2106. },
  2107. minutesList: function minutesList() {
  2108. return Object(date_util_["getRangeMinutes"])(this.selectableRange, this.hours);
  2109. },
  2110. arrowHourList: function arrowHourList() {
  2111. var hours = this.hours;
  2112. return [hours > 0 ? hours - 1 : undefined, hours, hours < 23 ? hours + 1 : undefined];
  2113. },
  2114. arrowMinuteList: function arrowMinuteList() {
  2115. var minutes = this.minutes;
  2116. return [minutes > 0 ? minutes - 1 : undefined, minutes, minutes < 59 ? minutes + 1 : undefined];
  2117. },
  2118. arrowSecondList: function arrowSecondList() {
  2119. var seconds = this.seconds;
  2120. return [seconds > 0 ? seconds - 1 : undefined, seconds, seconds < 59 ? seconds + 1 : undefined];
  2121. }
  2122. },
  2123. data: function data() {
  2124. return {
  2125. selectableRange: [],
  2126. currentScrollbar: null
  2127. };
  2128. },
  2129. mounted: function mounted() {
  2130. var _this = this;
  2131. this.$nextTick(function () {
  2132. !_this.arrowControl && _this.bindScrollEvent();
  2133. });
  2134. },
  2135. methods: {
  2136. increase: function increase() {
  2137. this.scrollDown(1);
  2138. },
  2139. decrease: function decrease() {
  2140. this.scrollDown(-1);
  2141. },
  2142. modifyDateField: function modifyDateField(type, value) {
  2143. switch (type) {
  2144. case 'hours':
  2145. this.$emit('change', Object(date_util_["modifyTime"])(this.date, value, this.minutes, this.seconds));break;
  2146. case 'minutes':
  2147. this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, value, this.seconds));break;
  2148. case 'seconds':
  2149. this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, this.minutes, value));break;
  2150. }
  2151. },
  2152. handleClick: function handleClick(type, _ref) {
  2153. var value = _ref.value,
  2154. disabled = _ref.disabled;
  2155. if (!disabled) {
  2156. this.modifyDateField(type, value);
  2157. this.emitSelectRange(type);
  2158. this.adjustSpinner(type, value);
  2159. }
  2160. },
  2161. emitSelectRange: function emitSelectRange(type) {
  2162. if (type === 'hours') {
  2163. this.$emit('select-range', 0, 2);
  2164. } else if (type === 'minutes') {
  2165. this.$emit('select-range', 3, 5);
  2166. } else if (type === 'seconds') {
  2167. this.$emit('select-range', 6, 8);
  2168. }
  2169. this.currentScrollbar = type;
  2170. },
  2171. bindScrollEvent: function bindScrollEvent() {
  2172. var _this2 = this;
  2173. var bindFuntion = function bindFuntion(type) {
  2174. _this2.$refs[type].wrap.onscroll = function (e) {
  2175. // TODO: scroll is emitted when set scrollTop programatically
  2176. // should find better solutions in the future!
  2177. _this2.handleScroll(type, e);
  2178. };
  2179. };
  2180. bindFuntion('hours');
  2181. bindFuntion('minutes');
  2182. bindFuntion('seconds');
  2183. },
  2184. handleScroll: function handleScroll(type) {
  2185. var value = Math.min(Math.round((this.$refs[type].wrap.scrollTop - (this.scrollBarHeight(type) * 0.5 - 10) / this.typeItemHeight(type) + 3) / this.typeItemHeight(type)), type === 'hours' ? 23 : 59);
  2186. this.modifyDateField(type, value);
  2187. },
  2188. // NOTE: used by datetime / date-range panel
  2189. // renamed from adjustScrollTop
  2190. // should try to refactory it
  2191. adjustSpinners: function adjustSpinners() {
  2192. this.adjustSpinner('hours', this.hours);
  2193. this.adjustSpinner('minutes', this.minutes);
  2194. this.adjustSpinner('seconds', this.seconds);
  2195. },
  2196. adjustCurrentSpinner: function adjustCurrentSpinner(type) {
  2197. this.adjustSpinner(type, this[type]);
  2198. },
  2199. adjustSpinner: function adjustSpinner(type, value) {
  2200. if (this.arrowControl) return;
  2201. var el = this.$refs[type].wrap;
  2202. if (el) {
  2203. el.scrollTop = Math.max(0, value * this.typeItemHeight(type));
  2204. }
  2205. },
  2206. scrollDown: function scrollDown(step) {
  2207. var _this3 = this;
  2208. if (!this.currentScrollbar) {
  2209. this.emitSelectRange('hours');
  2210. }
  2211. var label = this.currentScrollbar;
  2212. var hoursList = this.hoursList;
  2213. var now = this[label];
  2214. if (this.currentScrollbar === 'hours') {
  2215. var total = Math.abs(step);
  2216. step = step > 0 ? 1 : -1;
  2217. var length = hoursList.length;
  2218. while (length-- && total) {
  2219. now = (now + step + hoursList.length) % hoursList.length;
  2220. if (hoursList[now]) {
  2221. continue;
  2222. }
  2223. total--;
  2224. }
  2225. if (hoursList[now]) return;
  2226. } else {
  2227. now = (now + step + 60) % 60;
  2228. }
  2229. this.modifyDateField(label, now);
  2230. this.adjustSpinner(label, now);
  2231. this.$nextTick(function () {
  2232. return _this3.emitSelectRange(_this3.currentScrollbar);
  2233. });
  2234. },
  2235. amPm: function amPm(hour) {
  2236. var shouldShowAmPm = this.amPmMode.toLowerCase() === 'a';
  2237. if (!shouldShowAmPm) return '';
  2238. var isCapital = this.amPmMode === 'A';
  2239. var content = hour < 12 ? ' am' : ' pm';
  2240. if (isCapital) content = content.toUpperCase();
  2241. return content;
  2242. },
  2243. typeItemHeight: function typeItemHeight(type) {
  2244. return this.$refs[type].$el.querySelector('li').offsetHeight;
  2245. },
  2246. scrollBarHeight: function scrollBarHeight(type) {
  2247. return this.$refs[type].$el.offsetHeight;
  2248. }
  2249. }
  2250. });
  2251. // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue?vue&type=script&lang=js&
  2252. /* harmony default export */ var basic_time_spinnervue_type_script_lang_js_ = (time_spinnervue_type_script_lang_js_);
  2253. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  2254. var componentNormalizer = __webpack_require__(0);
  2255. // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue
  2256. /* normalize component */
  2257. var component = Object(componentNormalizer["a" /* default */])(
  2258. basic_time_spinnervue_type_script_lang_js_,
  2259. render,
  2260. staticRenderFns,
  2261. false,
  2262. null,
  2263. null,
  2264. null
  2265. )
  2266. /* hot reload */
  2267. if (false) { var api; }
  2268. component.options.__file = "packages/date-picker/src/basic/time-spinner.vue"
  2269. /* harmony default export */ var time_spinner = __webpack_exports__["a"] = (component.exports);
  2270. /***/ }),
  2271. /* 36 */,
  2272. /* 37 */,
  2273. /* 38 */,
  2274. /* 39 */,
  2275. /* 40 */,
  2276. /* 41 */,
  2277. /* 42 */,
  2278. /* 43 */,
  2279. /* 44 */,
  2280. /* 45 */,
  2281. /* 46 */,
  2282. /* 47 */,
  2283. /* 48 */,
  2284. /* 49 */,
  2285. /* 50 */,
  2286. /* 51 */,
  2287. /* 52 */,
  2288. /* 53 */,
  2289. /* 54 */,
  2290. /* 55 */
  2291. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2292. "use strict";
  2293. __webpack_require__.r(__webpack_exports__);
  2294. // EXTERNAL MODULE: ./packages/date-picker/src/picker.vue + 4 modules
  2295. var picker = __webpack_require__(33);
  2296. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/date.vue?vue&type=template&id=2440d4ea&
  2297. var render = function() {
  2298. var _vm = this
  2299. var _h = _vm.$createElement
  2300. var _c = _vm._self._c || _h
  2301. return _c(
  2302. "transition",
  2303. {
  2304. attrs: { name: "el-zoom-in-top" },
  2305. on: { "after-enter": _vm.handleEnter, "after-leave": _vm.handleLeave }
  2306. },
  2307. [
  2308. _c(
  2309. "div",
  2310. {
  2311. directives: [
  2312. {
  2313. name: "show",
  2314. rawName: "v-show",
  2315. value: _vm.visible,
  2316. expression: "visible"
  2317. }
  2318. ],
  2319. staticClass: "el-picker-panel el-date-picker el-popper",
  2320. class: [
  2321. {
  2322. "has-sidebar": _vm.$slots.sidebar || _vm.shortcuts,
  2323. "has-time": _vm.showTime
  2324. },
  2325. _vm.popperClass
  2326. ]
  2327. },
  2328. [
  2329. _c(
  2330. "div",
  2331. { staticClass: "el-picker-panel__body-wrapper" },
  2332. [
  2333. _vm._t("sidebar"),
  2334. _vm.shortcuts
  2335. ? _c(
  2336. "div",
  2337. { staticClass: "el-picker-panel__sidebar" },
  2338. _vm._l(_vm.shortcuts, function(shortcut, key) {
  2339. return _c(
  2340. "button",
  2341. {
  2342. key: key,
  2343. staticClass: "el-picker-panel__shortcut",
  2344. attrs: { type: "button" },
  2345. on: {
  2346. click: function($event) {
  2347. _vm.handleShortcutClick(shortcut)
  2348. }
  2349. }
  2350. },
  2351. [_vm._v(_vm._s(shortcut.text))]
  2352. )
  2353. }),
  2354. 0
  2355. )
  2356. : _vm._e(),
  2357. _c("div", { staticClass: "el-picker-panel__body" }, [
  2358. _vm.showTime
  2359. ? _c("div", { staticClass: "el-date-picker__time-header" }, [
  2360. _c(
  2361. "span",
  2362. { staticClass: "el-date-picker__editor-wrap" },
  2363. [
  2364. _c("el-input", {
  2365. attrs: {
  2366. placeholder: _vm.t("el.datepicker.selectDate"),
  2367. value: _vm.visibleDate,
  2368. size: "small"
  2369. },
  2370. on: {
  2371. input: function(val) {
  2372. return (_vm.userInputDate = val)
  2373. },
  2374. change: _vm.handleVisibleDateChange
  2375. }
  2376. })
  2377. ],
  2378. 1
  2379. ),
  2380. _c(
  2381. "span",
  2382. {
  2383. directives: [
  2384. {
  2385. name: "clickoutside",
  2386. rawName: "v-clickoutside",
  2387. value: _vm.handleTimePickClose,
  2388. expression: "handleTimePickClose"
  2389. }
  2390. ],
  2391. staticClass: "el-date-picker__editor-wrap"
  2392. },
  2393. [
  2394. _c("el-input", {
  2395. ref: "input",
  2396. attrs: {
  2397. placeholder: _vm.t("el.datepicker.selectTime"),
  2398. value: _vm.visibleTime,
  2399. size: "small"
  2400. },
  2401. on: {
  2402. focus: function($event) {
  2403. _vm.timePickerVisible = true
  2404. },
  2405. input: function(val) {
  2406. return (_vm.userInputTime = val)
  2407. },
  2408. change: _vm.handleVisibleTimeChange
  2409. }
  2410. }),
  2411. _c("time-picker", {
  2412. ref: "timepicker",
  2413. attrs: {
  2414. "time-arrow-control": _vm.arrowControl,
  2415. visible: _vm.timePickerVisible
  2416. },
  2417. on: {
  2418. pick: _vm.handleTimePick,
  2419. mounted: _vm.proxyTimePickerDataProperties
  2420. }
  2421. })
  2422. ],
  2423. 1
  2424. )
  2425. ])
  2426. : _vm._e(),
  2427. _c(
  2428. "div",
  2429. {
  2430. directives: [
  2431. {
  2432. name: "show",
  2433. rawName: "v-show",
  2434. value: _vm.currentView !== "time",
  2435. expression: "currentView !== 'time'"
  2436. }
  2437. ],
  2438. staticClass: "el-date-picker__header",
  2439. class: {
  2440. "el-date-picker__header--bordered":
  2441. _vm.currentView === "year" ||
  2442. _vm.currentView === "month"
  2443. }
  2444. },
  2445. [
  2446. _c("button", {
  2447. staticClass:
  2448. "el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-d-arrow-left",
  2449. attrs: {
  2450. type: "button",
  2451. "aria-label": _vm.t("el.datepicker.prevYear")
  2452. },
  2453. on: { click: _vm.prevYear }
  2454. }),
  2455. _c("button", {
  2456. directives: [
  2457. {
  2458. name: "show",
  2459. rawName: "v-show",
  2460. value: _vm.currentView === "date",
  2461. expression: "currentView === 'date'"
  2462. }
  2463. ],
  2464. staticClass:
  2465. "el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-arrow-left",
  2466. attrs: {
  2467. type: "button",
  2468. "aria-label": _vm.t("el.datepicker.prevMonth")
  2469. },
  2470. on: { click: _vm.prevMonth }
  2471. }),
  2472. _c(
  2473. "span",
  2474. {
  2475. staticClass: "el-date-picker__header-label",
  2476. attrs: { role: "button" },
  2477. on: { click: _vm.showYearPicker }
  2478. },
  2479. [_vm._v(_vm._s(_vm.yearLabel))]
  2480. ),
  2481. _c(
  2482. "span",
  2483. {
  2484. directives: [
  2485. {
  2486. name: "show",
  2487. rawName: "v-show",
  2488. value: _vm.currentView === "date",
  2489. expression: "currentView === 'date'"
  2490. }
  2491. ],
  2492. staticClass: "el-date-picker__header-label",
  2493. class: { active: _vm.currentView === "month" },
  2494. attrs: { role: "button" },
  2495. on: { click: _vm.showMonthPicker }
  2496. },
  2497. [
  2498. _vm._v(
  2499. _vm._s(_vm.t("el.datepicker.month" + (_vm.month + 1)))
  2500. )
  2501. ]
  2502. ),
  2503. _c("button", {
  2504. staticClass:
  2505. "el-picker-panel__icon-btn el-date-picker__next-btn el-icon-d-arrow-right",
  2506. attrs: {
  2507. type: "button",
  2508. "aria-label": _vm.t("el.datepicker.nextYear")
  2509. },
  2510. on: { click: _vm.nextYear }
  2511. }),
  2512. _c("button", {
  2513. directives: [
  2514. {
  2515. name: "show",
  2516. rawName: "v-show",
  2517. value: _vm.currentView === "date",
  2518. expression: "currentView === 'date'"
  2519. }
  2520. ],
  2521. staticClass:
  2522. "el-picker-panel__icon-btn el-date-picker__next-btn el-icon-arrow-right",
  2523. attrs: {
  2524. type: "button",
  2525. "aria-label": _vm.t("el.datepicker.nextMonth")
  2526. },
  2527. on: { click: _vm.nextMonth }
  2528. })
  2529. ]
  2530. ),
  2531. _c(
  2532. "div",
  2533. { staticClass: "el-picker-panel__content" },
  2534. [
  2535. _c("date-table", {
  2536. directives: [
  2537. {
  2538. name: "show",
  2539. rawName: "v-show",
  2540. value: _vm.currentView === "date",
  2541. expression: "currentView === 'date'"
  2542. }
  2543. ],
  2544. attrs: {
  2545. "selection-mode": _vm.selectionMode,
  2546. "first-day-of-week": _vm.firstDayOfWeek,
  2547. value: _vm.value,
  2548. "default-value": _vm.defaultValue
  2549. ? new Date(_vm.defaultValue)
  2550. : null,
  2551. date: _vm.date,
  2552. "cell-class-name": _vm.cellClassName,
  2553. "disabled-date": _vm.disabledDate
  2554. },
  2555. on: { pick: _vm.handleDatePick }
  2556. }),
  2557. _c("year-table", {
  2558. directives: [
  2559. {
  2560. name: "show",
  2561. rawName: "v-show",
  2562. value: _vm.currentView === "year",
  2563. expression: "currentView === 'year'"
  2564. }
  2565. ],
  2566. attrs: {
  2567. value: _vm.value,
  2568. "default-value": _vm.defaultValue
  2569. ? new Date(_vm.defaultValue)
  2570. : null,
  2571. date: _vm.date,
  2572. "disabled-date": _vm.disabledDate
  2573. },
  2574. on: { pick: _vm.handleYearPick }
  2575. }),
  2576. _c("month-table", {
  2577. directives: [
  2578. {
  2579. name: "show",
  2580. rawName: "v-show",
  2581. value: _vm.currentView === "month",
  2582. expression: "currentView === 'month'"
  2583. }
  2584. ],
  2585. attrs: {
  2586. value: _vm.value,
  2587. "default-value": _vm.defaultValue
  2588. ? new Date(_vm.defaultValue)
  2589. : null,
  2590. date: _vm.date,
  2591. "disabled-date": _vm.disabledDate
  2592. },
  2593. on: { pick: _vm.handleMonthPick }
  2594. })
  2595. ],
  2596. 1
  2597. )
  2598. ])
  2599. ],
  2600. 2
  2601. ),
  2602. _c(
  2603. "div",
  2604. {
  2605. directives: [
  2606. {
  2607. name: "show",
  2608. rawName: "v-show",
  2609. value: _vm.footerVisible && _vm.currentView === "date",
  2610. expression: "footerVisible && currentView === 'date'"
  2611. }
  2612. ],
  2613. staticClass: "el-picker-panel__footer"
  2614. },
  2615. [
  2616. _c(
  2617. "el-button",
  2618. {
  2619. directives: [
  2620. {
  2621. name: "show",
  2622. rawName: "v-show",
  2623. value: _vm.selectionMode !== "dates",
  2624. expression: "selectionMode !== 'dates'"
  2625. }
  2626. ],
  2627. staticClass: "el-picker-panel__link-btn",
  2628. attrs: { size: "mini", type: "text" },
  2629. on: { click: _vm.changeToNow }
  2630. },
  2631. [
  2632. _vm._v(
  2633. "\n " +
  2634. _vm._s(_vm.t("el.datepicker.now")) +
  2635. "\n "
  2636. )
  2637. ]
  2638. ),
  2639. _c(
  2640. "el-button",
  2641. {
  2642. staticClass: "el-picker-panel__link-btn",
  2643. attrs: { plain: "", size: "mini" },
  2644. on: { click: _vm.confirm }
  2645. },
  2646. [
  2647. _vm._v(
  2648. "\n " +
  2649. _vm._s(_vm.t("el.datepicker.confirm")) +
  2650. "\n "
  2651. )
  2652. ]
  2653. )
  2654. ],
  2655. 1
  2656. )
  2657. ]
  2658. )
  2659. ]
  2660. )
  2661. }
  2662. var staticRenderFns = []
  2663. render._withStripped = true
  2664. // CONCATENATED MODULE: ./packages/date-picker/src/panel/date.vue?vue&type=template&id=2440d4ea&
  2665. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  2666. var date_util_ = __webpack_require__(1);
  2667. // EXTERNAL MODULE: external "element-ui/lib/utils/clickoutside"
  2668. var clickoutside_ = __webpack_require__(12);
  2669. var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_);
  2670. // EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
  2671. var locale_ = __webpack_require__(6);
  2672. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  2673. // EXTERNAL MODULE: external "element-ui/lib/input"
  2674. var input_ = __webpack_require__(10);
  2675. var input_default = /*#__PURE__*/__webpack_require__.n(input_);
  2676. // EXTERNAL MODULE: external "element-ui/lib/button"
  2677. var button_ = __webpack_require__(13);
  2678. var button_default = /*#__PURE__*/__webpack_require__.n(button_);
  2679. // EXTERNAL MODULE: ./packages/date-picker/src/panel/time.vue + 4 modules
  2680. var panel_time = __webpack_require__(27);
  2681. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/year-table.vue?vue&type=template&id=c86ab5e0&
  2682. var year_tablevue_type_template_id_c86ab5e0_render = function() {
  2683. var _vm = this
  2684. var _h = _vm.$createElement
  2685. var _c = _vm._self._c || _h
  2686. return _c(
  2687. "table",
  2688. { staticClass: "el-year-table", on: { click: _vm.handleYearTableClick } },
  2689. [
  2690. _c("tbody", [
  2691. _c("tr", [
  2692. _c(
  2693. "td",
  2694. {
  2695. staticClass: "available",
  2696. class: _vm.getCellStyle(_vm.startYear + 0)
  2697. },
  2698. [_c("a", { staticClass: "cell" }, [_vm._v(_vm._s(_vm.startYear))])]
  2699. ),
  2700. _c(
  2701. "td",
  2702. {
  2703. staticClass: "available",
  2704. class: _vm.getCellStyle(_vm.startYear + 1)
  2705. },
  2706. [
  2707. _c("a", { staticClass: "cell" }, [
  2708. _vm._v(_vm._s(_vm.startYear + 1))
  2709. ])
  2710. ]
  2711. ),
  2712. _c(
  2713. "td",
  2714. {
  2715. staticClass: "available",
  2716. class: _vm.getCellStyle(_vm.startYear + 2)
  2717. },
  2718. [
  2719. _c("a", { staticClass: "cell" }, [
  2720. _vm._v(_vm._s(_vm.startYear + 2))
  2721. ])
  2722. ]
  2723. ),
  2724. _c(
  2725. "td",
  2726. {
  2727. staticClass: "available",
  2728. class: _vm.getCellStyle(_vm.startYear + 3)
  2729. },
  2730. [
  2731. _c("a", { staticClass: "cell" }, [
  2732. _vm._v(_vm._s(_vm.startYear + 3))
  2733. ])
  2734. ]
  2735. )
  2736. ]),
  2737. _c("tr", [
  2738. _c(
  2739. "td",
  2740. {
  2741. staticClass: "available",
  2742. class: _vm.getCellStyle(_vm.startYear + 4)
  2743. },
  2744. [
  2745. _c("a", { staticClass: "cell" }, [
  2746. _vm._v(_vm._s(_vm.startYear + 4))
  2747. ])
  2748. ]
  2749. ),
  2750. _c(
  2751. "td",
  2752. {
  2753. staticClass: "available",
  2754. class: _vm.getCellStyle(_vm.startYear + 5)
  2755. },
  2756. [
  2757. _c("a", { staticClass: "cell" }, [
  2758. _vm._v(_vm._s(_vm.startYear + 5))
  2759. ])
  2760. ]
  2761. ),
  2762. _c(
  2763. "td",
  2764. {
  2765. staticClass: "available",
  2766. class: _vm.getCellStyle(_vm.startYear + 6)
  2767. },
  2768. [
  2769. _c("a", { staticClass: "cell" }, [
  2770. _vm._v(_vm._s(_vm.startYear + 6))
  2771. ])
  2772. ]
  2773. ),
  2774. _c(
  2775. "td",
  2776. {
  2777. staticClass: "available",
  2778. class: _vm.getCellStyle(_vm.startYear + 7)
  2779. },
  2780. [
  2781. _c("a", { staticClass: "cell" }, [
  2782. _vm._v(_vm._s(_vm.startYear + 7))
  2783. ])
  2784. ]
  2785. )
  2786. ]),
  2787. _c("tr", [
  2788. _c(
  2789. "td",
  2790. {
  2791. staticClass: "available",
  2792. class: _vm.getCellStyle(_vm.startYear + 8)
  2793. },
  2794. [
  2795. _c("a", { staticClass: "cell" }, [
  2796. _vm._v(_vm._s(_vm.startYear + 8))
  2797. ])
  2798. ]
  2799. ),
  2800. _c(
  2801. "td",
  2802. {
  2803. staticClass: "available",
  2804. class: _vm.getCellStyle(_vm.startYear + 9)
  2805. },
  2806. [
  2807. _c("a", { staticClass: "cell" }, [
  2808. _vm._v(_vm._s(_vm.startYear + 9))
  2809. ])
  2810. ]
  2811. ),
  2812. _c("td"),
  2813. _c("td")
  2814. ])
  2815. ])
  2816. ]
  2817. )
  2818. }
  2819. var year_tablevue_type_template_id_c86ab5e0_staticRenderFns = []
  2820. year_tablevue_type_template_id_c86ab5e0_render._withStripped = true
  2821. // CONCATENATED MODULE: ./packages/date-picker/src/basic/year-table.vue?vue&type=template&id=c86ab5e0&
  2822. // EXTERNAL MODULE: external "element-ui/lib/utils/dom"
  2823. var dom_ = __webpack_require__(2);
  2824. // EXTERNAL MODULE: external "element-ui/lib/utils/util"
  2825. var util_ = __webpack_require__(3);
  2826. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/year-table.vue?vue&type=script&lang=js&
  2827. //
  2828. //
  2829. //
  2830. //
  2831. //
  2832. //
  2833. //
  2834. //
  2835. //
  2836. //
  2837. //
  2838. //
  2839. //
  2840. //
  2841. //
  2842. //
  2843. //
  2844. //
  2845. //
  2846. //
  2847. //
  2848. //
  2849. //
  2850. //
  2851. //
  2852. //
  2853. //
  2854. //
  2855. //
  2856. //
  2857. //
  2858. //
  2859. //
  2860. //
  2861. //
  2862. //
  2863. //
  2864. //
  2865. //
  2866. //
  2867. //
  2868. //
  2869. //
  2870. //
  2871. //
  2872. var year_tablevue_type_script_lang_js_datesInYear = function datesInYear(year) {
  2873. var numOfDays = Object(date_util_["getDayCountOfYear"])(year);
  2874. var firstDay = new Date(year, 0, 1);
  2875. return Object(date_util_["range"])(numOfDays).map(function (n) {
  2876. return Object(date_util_["nextDate"])(firstDay, n);
  2877. });
  2878. };
  2879. /* harmony default export */ var year_tablevue_type_script_lang_js_ = ({
  2880. props: {
  2881. disabledDate: {},
  2882. value: {},
  2883. defaultValue: {
  2884. validator: function validator(val) {
  2885. // null or valid Date Object
  2886. return val === null || val instanceof Date && Object(date_util_["isDate"])(val);
  2887. }
  2888. },
  2889. date: {}
  2890. },
  2891. computed: {
  2892. startYear: function startYear() {
  2893. return Math.floor(this.date.getFullYear() / 10) * 10;
  2894. }
  2895. },
  2896. methods: {
  2897. getCellStyle: function getCellStyle(year) {
  2898. var style = {};
  2899. var today = new Date();
  2900. style.disabled = typeof this.disabledDate === 'function' ? year_tablevue_type_script_lang_js_datesInYear(year).every(this.disabledDate) : false;
  2901. style.current = Object(util_["arrayFindIndex"])(Object(util_["coerceTruthyValueToArray"])(this.value), function (date) {
  2902. return date.getFullYear() === year;
  2903. }) >= 0;
  2904. style.today = today.getFullYear() === year;
  2905. style.default = this.defaultValue && this.defaultValue.getFullYear() === year;
  2906. return style;
  2907. },
  2908. handleYearTableClick: function handleYearTableClick(event) {
  2909. var target = event.target;
  2910. if (target.tagName === 'A') {
  2911. if (Object(dom_["hasClass"])(target.parentNode, 'disabled')) return;
  2912. var year = target.textContent || target.innerText;
  2913. this.$emit('pick', Number(year));
  2914. }
  2915. }
  2916. }
  2917. });
  2918. // CONCATENATED MODULE: ./packages/date-picker/src/basic/year-table.vue?vue&type=script&lang=js&
  2919. /* harmony default export */ var basic_year_tablevue_type_script_lang_js_ = (year_tablevue_type_script_lang_js_);
  2920. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  2921. var componentNormalizer = __webpack_require__(0);
  2922. // CONCATENATED MODULE: ./packages/date-picker/src/basic/year-table.vue
  2923. /* normalize component */
  2924. var component = Object(componentNormalizer["a" /* default */])(
  2925. basic_year_tablevue_type_script_lang_js_,
  2926. year_tablevue_type_template_id_c86ab5e0_render,
  2927. year_tablevue_type_template_id_c86ab5e0_staticRenderFns,
  2928. false,
  2929. null,
  2930. null,
  2931. null
  2932. )
  2933. /* hot reload */
  2934. if (false) { var api; }
  2935. component.options.__file = "packages/date-picker/src/basic/year-table.vue"
  2936. /* harmony default export */ var year_table = (component.exports);
  2937. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/month-table.vue?vue&type=template&id=654d4f42&
  2938. var month_tablevue_type_template_id_654d4f42_render = function() {
  2939. var _vm = this
  2940. var _h = _vm.$createElement
  2941. var _c = _vm._self._c || _h
  2942. return _c(
  2943. "table",
  2944. {
  2945. staticClass: "el-month-table",
  2946. on: { click: _vm.handleMonthTableClick, mousemove: _vm.handleMouseMove }
  2947. },
  2948. [
  2949. _c(
  2950. "tbody",
  2951. _vm._l(_vm.rows, function(row, key) {
  2952. return _c(
  2953. "tr",
  2954. { key: key },
  2955. _vm._l(row, function(cell, key) {
  2956. return _c("td", { key: key, class: _vm.getCellStyle(cell) }, [
  2957. _c("div", [
  2958. _c("a", { staticClass: "cell" }, [
  2959. _vm._v(
  2960. _vm._s(
  2961. _vm.t("el.datepicker.months." + _vm.months[cell.text])
  2962. )
  2963. )
  2964. ])
  2965. ])
  2966. ])
  2967. }),
  2968. 0
  2969. )
  2970. }),
  2971. 0
  2972. )
  2973. ]
  2974. )
  2975. }
  2976. var month_tablevue_type_template_id_654d4f42_staticRenderFns = []
  2977. month_tablevue_type_template_id_654d4f42_render._withStripped = true
  2978. // CONCATENATED MODULE: ./packages/date-picker/src/basic/month-table.vue?vue&type=template&id=654d4f42&
  2979. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/month-table.vue?vue&type=script&lang=js&
  2980. //
  2981. //
  2982. //
  2983. //
  2984. //
  2985. //
  2986. //
  2987. //
  2988. //
  2989. //
  2990. //
  2991. //
  2992. //
  2993. //
  2994. var month_tablevue_type_script_lang_js_datesInMonth = function datesInMonth(year, month) {
  2995. var numOfDays = Object(date_util_["getDayCountOfMonth"])(year, month);
  2996. var firstDay = new Date(year, month, 1);
  2997. return Object(date_util_["range"])(numOfDays).map(function (n) {
  2998. return Object(date_util_["nextDate"])(firstDay, n);
  2999. });
  3000. };
  3001. var clearDate = function clearDate(date) {
  3002. return new Date(date.getFullYear(), date.getMonth());
  3003. };
  3004. var getMonthTimestamp = function getMonthTimestamp(time) {
  3005. if (typeof time === 'number' || typeof time === 'string') {
  3006. return clearDate(new Date(time)).getTime();
  3007. } else if (time instanceof Date) {
  3008. return clearDate(time).getTime();
  3009. } else {
  3010. return NaN;
  3011. }
  3012. };
  3013. /* harmony default export */ var month_tablevue_type_script_lang_js_ = ({
  3014. props: {
  3015. disabledDate: {},
  3016. value: {},
  3017. selectionMode: {
  3018. default: 'month'
  3019. },
  3020. minDate: {},
  3021. maxDate: {},
  3022. defaultValue: {
  3023. validator: function validator(val) {
  3024. // null or valid Date Object
  3025. return val === null || Object(date_util_["isDate"])(val) || Array.isArray(val) && val.every(date_util_["isDate"]);
  3026. }
  3027. },
  3028. date: {},
  3029. rangeState: {
  3030. default: function _default() {
  3031. return {
  3032. endDate: null,
  3033. selecting: false
  3034. };
  3035. }
  3036. }
  3037. },
  3038. mixins: [locale_default.a],
  3039. watch: {
  3040. 'rangeState.endDate': function rangeStateEndDate(newVal) {
  3041. this.markRange(this.minDate, newVal);
  3042. },
  3043. minDate: function minDate(newVal, oldVal) {
  3044. if (getMonthTimestamp(newVal) !== getMonthTimestamp(oldVal)) {
  3045. this.markRange(this.minDate, this.maxDate);
  3046. }
  3047. },
  3048. maxDate: function maxDate(newVal, oldVal) {
  3049. if (getMonthTimestamp(newVal) !== getMonthTimestamp(oldVal)) {
  3050. this.markRange(this.minDate, this.maxDate);
  3051. }
  3052. }
  3053. },
  3054. data: function data() {
  3055. return {
  3056. months: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'],
  3057. tableRows: [[], [], []],
  3058. lastRow: null,
  3059. lastColumn: null
  3060. };
  3061. },
  3062. methods: {
  3063. cellMatchesDate: function cellMatchesDate(cell, date) {
  3064. var value = new Date(date);
  3065. return this.date.getFullYear() === value.getFullYear() && Number(cell.text) === value.getMonth();
  3066. },
  3067. getCellStyle: function getCellStyle(cell) {
  3068. var _this = this;
  3069. var style = {};
  3070. var year = this.date.getFullYear();
  3071. var today = new Date();
  3072. var month = cell.text;
  3073. var defaultValue = this.defaultValue ? Array.isArray(this.defaultValue) ? this.defaultValue : [this.defaultValue] : [];
  3074. style.disabled = typeof this.disabledDate === 'function' ? month_tablevue_type_script_lang_js_datesInMonth(year, month).every(this.disabledDate) : false;
  3075. style.current = Object(util_["arrayFindIndex"])(Object(util_["coerceTruthyValueToArray"])(this.value), function (date) {
  3076. return date.getFullYear() === year && date.getMonth() === month;
  3077. }) >= 0;
  3078. style.today = today.getFullYear() === year && today.getMonth() === month;
  3079. style.default = defaultValue.some(function (date) {
  3080. return _this.cellMatchesDate(cell, date);
  3081. });
  3082. if (cell.inRange) {
  3083. style['in-range'] = true;
  3084. if (cell.start) {
  3085. style['start-date'] = true;
  3086. }
  3087. if (cell.end) {
  3088. style['end-date'] = true;
  3089. }
  3090. }
  3091. return style;
  3092. },
  3093. getMonthOfCell: function getMonthOfCell(month) {
  3094. var year = this.date.getFullYear();
  3095. return new Date(year, month, 1);
  3096. },
  3097. markRange: function markRange(minDate, maxDate) {
  3098. minDate = getMonthTimestamp(minDate);
  3099. maxDate = getMonthTimestamp(maxDate) || minDate;
  3100. var _ref = [Math.min(minDate, maxDate), Math.max(minDate, maxDate)];
  3101. minDate = _ref[0];
  3102. maxDate = _ref[1];
  3103. var rows = this.rows;
  3104. for (var i = 0, k = rows.length; i < k; i++) {
  3105. var row = rows[i];
  3106. for (var j = 0, l = row.length; j < l; j++) {
  3107. var cell = row[j];
  3108. var index = i * 4 + j;
  3109. var time = new Date(this.date.getFullYear(), index).getTime();
  3110. cell.inRange = minDate && time >= minDate && time <= maxDate;
  3111. cell.start = minDate && time === minDate;
  3112. cell.end = maxDate && time === maxDate;
  3113. }
  3114. }
  3115. },
  3116. handleMouseMove: function handleMouseMove(event) {
  3117. if (!this.rangeState.selecting) return;
  3118. var target = event.target;
  3119. if (target.tagName === 'A') {
  3120. target = target.parentNode.parentNode;
  3121. }
  3122. if (target.tagName === 'DIV') {
  3123. target = target.parentNode;
  3124. }
  3125. if (target.tagName !== 'TD') return;
  3126. var row = target.parentNode.rowIndex;
  3127. var column = target.cellIndex;
  3128. // can not select disabled date
  3129. if (this.rows[row][column].disabled) return;
  3130. // only update rangeState when mouse moves to a new cell
  3131. // this avoids frequent Date object creation and improves performance
  3132. if (row !== this.lastRow || column !== this.lastColumn) {
  3133. this.lastRow = row;
  3134. this.lastColumn = column;
  3135. this.$emit('changerange', {
  3136. minDate: this.minDate,
  3137. maxDate: this.maxDate,
  3138. rangeState: {
  3139. selecting: true,
  3140. endDate: this.getMonthOfCell(row * 4 + column)
  3141. }
  3142. });
  3143. }
  3144. },
  3145. handleMonthTableClick: function handleMonthTableClick(event) {
  3146. var target = event.target;
  3147. if (target.tagName === 'A') {
  3148. target = target.parentNode.parentNode;
  3149. }
  3150. if (target.tagName === 'DIV') {
  3151. target = target.parentNode;
  3152. }
  3153. if (target.tagName !== 'TD') return;
  3154. if (Object(dom_["hasClass"])(target, 'disabled')) return;
  3155. var column = target.cellIndex;
  3156. var row = target.parentNode.rowIndex;
  3157. var month = row * 4 + column;
  3158. var newDate = this.getMonthOfCell(month);
  3159. if (this.selectionMode === 'range') {
  3160. if (!this.rangeState.selecting) {
  3161. this.$emit('pick', { minDate: newDate, maxDate: null });
  3162. this.rangeState.selecting = true;
  3163. } else {
  3164. if (newDate >= this.minDate) {
  3165. this.$emit('pick', { minDate: this.minDate, maxDate: newDate });
  3166. } else {
  3167. this.$emit('pick', { minDate: newDate, maxDate: this.minDate });
  3168. }
  3169. this.rangeState.selecting = false;
  3170. }
  3171. } else {
  3172. this.$emit('pick', month);
  3173. }
  3174. }
  3175. },
  3176. computed: {
  3177. rows: function rows() {
  3178. var _this2 = this;
  3179. // TODO: refactory rows / getCellClasses
  3180. var rows = this.tableRows;
  3181. var disabledDate = this.disabledDate;
  3182. var selectedDate = [];
  3183. var now = getMonthTimestamp(new Date());
  3184. for (var i = 0; i < 3; i++) {
  3185. var row = rows[i];
  3186. var _loop = function _loop(j) {
  3187. var cell = row[j];
  3188. if (!cell) {
  3189. cell = { row: i, column: j, type: 'normal', inRange: false, start: false, end: false };
  3190. }
  3191. cell.type = 'normal';
  3192. var index = i * 4 + j;
  3193. var time = new Date(_this2.date.getFullYear(), index).getTime();
  3194. cell.inRange = time >= getMonthTimestamp(_this2.minDate) && time <= getMonthTimestamp(_this2.maxDate);
  3195. cell.start = _this2.minDate && time === getMonthTimestamp(_this2.minDate);
  3196. cell.end = _this2.maxDate && time === getMonthTimestamp(_this2.maxDate);
  3197. var isToday = time === now;
  3198. if (isToday) {
  3199. cell.type = 'today';
  3200. }
  3201. cell.text = index;
  3202. var cellDate = new Date(time);
  3203. cell.disabled = typeof disabledDate === 'function' && disabledDate(cellDate);
  3204. cell.selected = Object(util_["arrayFind"])(selectedDate, function (date) {
  3205. return date.getTime() === cellDate.getTime();
  3206. });
  3207. _this2.$set(row, j, cell);
  3208. };
  3209. for (var j = 0; j < 4; j++) {
  3210. _loop(j);
  3211. }
  3212. }
  3213. return rows;
  3214. }
  3215. }
  3216. });
  3217. // CONCATENATED MODULE: ./packages/date-picker/src/basic/month-table.vue?vue&type=script&lang=js&
  3218. /* harmony default export */ var basic_month_tablevue_type_script_lang_js_ = (month_tablevue_type_script_lang_js_);
  3219. // CONCATENATED MODULE: ./packages/date-picker/src/basic/month-table.vue
  3220. /* normalize component */
  3221. var month_table_component = Object(componentNormalizer["a" /* default */])(
  3222. basic_month_tablevue_type_script_lang_js_,
  3223. month_tablevue_type_template_id_654d4f42_render,
  3224. month_tablevue_type_template_id_654d4f42_staticRenderFns,
  3225. false,
  3226. null,
  3227. null,
  3228. null
  3229. )
  3230. /* hot reload */
  3231. if (false) { var month_table_api; }
  3232. month_table_component.options.__file = "packages/date-picker/src/basic/month-table.vue"
  3233. /* harmony default export */ var month_table = (month_table_component.exports);
  3234. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/date-table.vue?vue&type=template&id=5d1f3341&
  3235. var date_tablevue_type_template_id_5d1f3341_render = function() {
  3236. var _vm = this
  3237. var _h = _vm.$createElement
  3238. var _c = _vm._self._c || _h
  3239. return _c(
  3240. "table",
  3241. {
  3242. staticClass: "el-date-table",
  3243. class: { "is-week-mode": _vm.selectionMode === "week" },
  3244. attrs: { cellspacing: "0", cellpadding: "0" },
  3245. on: { click: _vm.handleClick, mousemove: _vm.handleMouseMove }
  3246. },
  3247. [
  3248. _c(
  3249. "tbody",
  3250. [
  3251. _c(
  3252. "tr",
  3253. [
  3254. _vm.showWeekNumber
  3255. ? _c("th", [_vm._v(_vm._s(_vm.t("el.datepicker.week")))])
  3256. : _vm._e(),
  3257. _vm._l(_vm.WEEKS, function(week, key) {
  3258. return _c("th", { key: key }, [
  3259. _vm._v(_vm._s(_vm.t("el.datepicker.weeks." + week)))
  3260. ])
  3261. })
  3262. ],
  3263. 2
  3264. ),
  3265. _vm._l(_vm.rows, function(row, key) {
  3266. return _c(
  3267. "tr",
  3268. {
  3269. key: key,
  3270. staticClass: "el-date-table__row",
  3271. class: { current: _vm.isWeekActive(row[1]) }
  3272. },
  3273. _vm._l(row, function(cell, key) {
  3274. return _c("td", { key: key, class: _vm.getCellClasses(cell) }, [
  3275. _c("div", [
  3276. _c("span", [
  3277. _vm._v("\n " + _vm._s(cell.text) + "\n ")
  3278. ])
  3279. ])
  3280. ])
  3281. }),
  3282. 0
  3283. )
  3284. })
  3285. ],
  3286. 2
  3287. )
  3288. ]
  3289. )
  3290. }
  3291. var date_tablevue_type_template_id_5d1f3341_staticRenderFns = []
  3292. date_tablevue_type_template_id_5d1f3341_render._withStripped = true
  3293. // CONCATENATED MODULE: ./packages/date-picker/src/basic/date-table.vue?vue&type=template&id=5d1f3341&
  3294. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/date-table.vue?vue&type=script&lang=js&
  3295. //
  3296. //
  3297. //
  3298. //
  3299. //
  3300. //
  3301. //
  3302. //
  3303. //
  3304. //
  3305. //
  3306. //
  3307. //
  3308. //
  3309. //
  3310. //
  3311. //
  3312. //
  3313. //
  3314. //
  3315. //
  3316. //
  3317. //
  3318. //
  3319. //
  3320. //
  3321. //
  3322. //
  3323. //
  3324. //
  3325. //
  3326. //
  3327. //
  3328. var _WEEKS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
  3329. var date_tablevue_type_script_lang_js_getDateTimestamp = function getDateTimestamp(time) {
  3330. if (typeof time === 'number' || typeof time === 'string') {
  3331. return Object(date_util_["clearTime"])(new Date(time)).getTime();
  3332. } else if (time instanceof Date) {
  3333. return Object(date_util_["clearTime"])(time).getTime();
  3334. } else {
  3335. return NaN;
  3336. }
  3337. };
  3338. // remove the first element that satisfies `pred` from arr
  3339. // return a new array if modification occurs
  3340. // return the original array otherwise
  3341. var date_tablevue_type_script_lang_js_removeFromArray = function removeFromArray(arr, pred) {
  3342. var idx = typeof pred === 'function' ? Object(util_["arrayFindIndex"])(arr, pred) : arr.indexOf(pred);
  3343. return idx >= 0 ? [].concat(arr.slice(0, idx), arr.slice(idx + 1)) : arr;
  3344. };
  3345. /* harmony default export */ var date_tablevue_type_script_lang_js_ = ({
  3346. mixins: [locale_default.a],
  3347. props: {
  3348. firstDayOfWeek: {
  3349. default: 7,
  3350. type: Number,
  3351. validator: function validator(val) {
  3352. return val >= 1 && val <= 7;
  3353. }
  3354. },
  3355. value: {},
  3356. defaultValue: {
  3357. validator: function validator(val) {
  3358. // either: null, valid Date object, Array of valid Date objects
  3359. return val === null || Object(date_util_["isDate"])(val) || Array.isArray(val) && val.every(date_util_["isDate"]);
  3360. }
  3361. },
  3362. date: {},
  3363. selectionMode: {
  3364. default: 'day'
  3365. },
  3366. showWeekNumber: {
  3367. type: Boolean,
  3368. default: false
  3369. },
  3370. disabledDate: {},
  3371. cellClassName: {},
  3372. minDate: {},
  3373. maxDate: {},
  3374. rangeState: {
  3375. default: function _default() {
  3376. return {
  3377. endDate: null,
  3378. selecting: false
  3379. };
  3380. }
  3381. }
  3382. },
  3383. computed: {
  3384. offsetDay: function offsetDay() {
  3385. var week = this.firstDayOfWeek;
  3386. // 周日为界限,左右偏移的天数,3217654 例如周一就是 -1,目的是调整前两行日期的位置
  3387. return week > 3 ? 7 - week : -week;
  3388. },
  3389. WEEKS: function WEEKS() {
  3390. var week = this.firstDayOfWeek;
  3391. return _WEEKS.concat(_WEEKS).slice(week, week + 7);
  3392. },
  3393. year: function year() {
  3394. return this.date.getFullYear();
  3395. },
  3396. month: function month() {
  3397. return this.date.getMonth();
  3398. },
  3399. startDate: function startDate() {
  3400. return Object(date_util_["getStartDateOfMonth"])(this.year, this.month);
  3401. },
  3402. rows: function rows() {
  3403. var _this = this;
  3404. // TODO: refactory rows / getCellClasses
  3405. var date = new Date(this.year, this.month, 1);
  3406. var day = Object(date_util_["getFirstDayOfMonth"])(date); // day of first day
  3407. var dateCountOfMonth = Object(date_util_["getDayCountOfMonth"])(date.getFullYear(), date.getMonth());
  3408. var dateCountOfLastMonth = Object(date_util_["getDayCountOfMonth"])(date.getFullYear(), date.getMonth() === 0 ? 11 : date.getMonth() - 1);
  3409. day = day === 0 ? 7 : day;
  3410. var offset = this.offsetDay;
  3411. var rows = this.tableRows;
  3412. var count = 1;
  3413. var startDate = this.startDate;
  3414. var disabledDate = this.disabledDate;
  3415. var cellClassName = this.cellClassName;
  3416. var selectedDate = this.selectionMode === 'dates' ? Object(util_["coerceTruthyValueToArray"])(this.value) : [];
  3417. var now = date_tablevue_type_script_lang_js_getDateTimestamp(new Date());
  3418. for (var i = 0; i < 6; i++) {
  3419. var row = rows[i];
  3420. if (this.showWeekNumber) {
  3421. if (!row[0]) {
  3422. row[0] = { type: 'week', text: Object(date_util_["getWeekNumber"])(Object(date_util_["nextDate"])(startDate, i * 7 + 1)) };
  3423. }
  3424. }
  3425. var _loop = function _loop(j) {
  3426. var cell = row[_this.showWeekNumber ? j + 1 : j];
  3427. if (!cell) {
  3428. cell = { row: i, column: j, type: 'normal', inRange: false, start: false, end: false };
  3429. }
  3430. cell.type = 'normal';
  3431. var index = i * 7 + j;
  3432. var time = Object(date_util_["nextDate"])(startDate, index - offset).getTime();
  3433. cell.inRange = time >= date_tablevue_type_script_lang_js_getDateTimestamp(_this.minDate) && time <= date_tablevue_type_script_lang_js_getDateTimestamp(_this.maxDate);
  3434. cell.start = _this.minDate && time === date_tablevue_type_script_lang_js_getDateTimestamp(_this.minDate);
  3435. cell.end = _this.maxDate && time === date_tablevue_type_script_lang_js_getDateTimestamp(_this.maxDate);
  3436. var isToday = time === now;
  3437. if (isToday) {
  3438. cell.type = 'today';
  3439. }
  3440. if (i >= 0 && i <= 1) {
  3441. var numberOfDaysFromPreviousMonth = day + offset < 0 ? 7 + day + offset : day + offset;
  3442. if (j + i * 7 >= numberOfDaysFromPreviousMonth) {
  3443. cell.text = count++;
  3444. } else {
  3445. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - j % 7) + 1 + i * 7;
  3446. cell.type = 'prev-month';
  3447. }
  3448. } else {
  3449. if (count <= dateCountOfMonth) {
  3450. cell.text = count++;
  3451. } else {
  3452. cell.text = count++ - dateCountOfMonth;
  3453. cell.type = 'next-month';
  3454. }
  3455. }
  3456. var cellDate = new Date(time);
  3457. cell.disabled = typeof disabledDate === 'function' && disabledDate(cellDate);
  3458. cell.selected = Object(util_["arrayFind"])(selectedDate, function (date) {
  3459. return date.getTime() === cellDate.getTime();
  3460. });
  3461. cell.customClass = typeof cellClassName === 'function' && cellClassName(cellDate);
  3462. _this.$set(row, _this.showWeekNumber ? j + 1 : j, cell);
  3463. };
  3464. for (var j = 0; j < 7; j++) {
  3465. _loop(j);
  3466. }
  3467. if (this.selectionMode === 'week') {
  3468. var start = this.showWeekNumber ? 1 : 0;
  3469. var end = this.showWeekNumber ? 7 : 6;
  3470. var isWeekActive = this.isWeekActive(row[start + 1]);
  3471. row[start].inRange = isWeekActive;
  3472. row[start].start = isWeekActive;
  3473. row[end].inRange = isWeekActive;
  3474. row[end].end = isWeekActive;
  3475. }
  3476. }
  3477. return rows;
  3478. }
  3479. },
  3480. watch: {
  3481. 'rangeState.endDate': function rangeStateEndDate(newVal) {
  3482. this.markRange(this.minDate, newVal);
  3483. },
  3484. minDate: function minDate(newVal, oldVal) {
  3485. if (date_tablevue_type_script_lang_js_getDateTimestamp(newVal) !== date_tablevue_type_script_lang_js_getDateTimestamp(oldVal)) {
  3486. this.markRange(this.minDate, this.maxDate);
  3487. }
  3488. },
  3489. maxDate: function maxDate(newVal, oldVal) {
  3490. if (date_tablevue_type_script_lang_js_getDateTimestamp(newVal) !== date_tablevue_type_script_lang_js_getDateTimestamp(oldVal)) {
  3491. this.markRange(this.minDate, this.maxDate);
  3492. }
  3493. }
  3494. },
  3495. data: function data() {
  3496. return {
  3497. tableRows: [[], [], [], [], [], []],
  3498. lastRow: null,
  3499. lastColumn: null
  3500. };
  3501. },
  3502. methods: {
  3503. cellMatchesDate: function cellMatchesDate(cell, date) {
  3504. var value = new Date(date);
  3505. return this.year === value.getFullYear() && this.month === value.getMonth() && Number(cell.text) === value.getDate();
  3506. },
  3507. getCellClasses: function getCellClasses(cell) {
  3508. var _this2 = this;
  3509. var selectionMode = this.selectionMode;
  3510. var defaultValue = this.defaultValue ? Array.isArray(this.defaultValue) ? this.defaultValue : [this.defaultValue] : [];
  3511. var classes = [];
  3512. if ((cell.type === 'normal' || cell.type === 'today') && !cell.disabled) {
  3513. classes.push('available');
  3514. if (cell.type === 'today') {
  3515. classes.push('today');
  3516. }
  3517. } else {
  3518. classes.push(cell.type);
  3519. }
  3520. if (cell.type === 'normal' && defaultValue.some(function (date) {
  3521. return _this2.cellMatchesDate(cell, date);
  3522. })) {
  3523. classes.push('default');
  3524. }
  3525. if (selectionMode === 'day' && (cell.type === 'normal' || cell.type === 'today') && this.cellMatchesDate(cell, this.value)) {
  3526. classes.push('current');
  3527. }
  3528. if (cell.inRange && (cell.type === 'normal' || cell.type === 'today' || this.selectionMode === 'week')) {
  3529. classes.push('in-range');
  3530. if (cell.start) {
  3531. classes.push('start-date');
  3532. }
  3533. if (cell.end) {
  3534. classes.push('end-date');
  3535. }
  3536. }
  3537. if (cell.disabled) {
  3538. classes.push('disabled');
  3539. }
  3540. if (cell.selected) {
  3541. classes.push('selected');
  3542. }
  3543. if (cell.customClass) {
  3544. classes.push(cell.customClass);
  3545. }
  3546. return classes.join(' ');
  3547. },
  3548. getDateOfCell: function getDateOfCell(row, column) {
  3549. var offsetFromStart = row * 7 + (column - (this.showWeekNumber ? 1 : 0)) - this.offsetDay;
  3550. return Object(date_util_["nextDate"])(this.startDate, offsetFromStart);
  3551. },
  3552. isWeekActive: function isWeekActive(cell) {
  3553. if (this.selectionMode !== 'week') return false;
  3554. var newDate = new Date(this.year, this.month, 1);
  3555. var year = newDate.getFullYear();
  3556. var month = newDate.getMonth();
  3557. if (cell.type === 'prev-month') {
  3558. newDate.setMonth(month === 0 ? 11 : month - 1);
  3559. newDate.setFullYear(month === 0 ? year - 1 : year);
  3560. }
  3561. if (cell.type === 'next-month') {
  3562. newDate.setMonth(month === 11 ? 0 : month + 1);
  3563. newDate.setFullYear(month === 11 ? year + 1 : year);
  3564. }
  3565. newDate.setDate(parseInt(cell.text, 10));
  3566. if (Object(date_util_["isDate"])(this.value)) {
  3567. var dayOffset = (this.value.getDay() - this.firstDayOfWeek + 7) % 7 - 1;
  3568. var weekDate = Object(date_util_["prevDate"])(this.value, dayOffset);
  3569. return weekDate.getTime() === newDate.getTime();
  3570. }
  3571. return false;
  3572. },
  3573. markRange: function markRange(minDate, maxDate) {
  3574. minDate = date_tablevue_type_script_lang_js_getDateTimestamp(minDate);
  3575. maxDate = date_tablevue_type_script_lang_js_getDateTimestamp(maxDate) || minDate;
  3576. var _ref = [Math.min(minDate, maxDate), Math.max(minDate, maxDate)];
  3577. minDate = _ref[0];
  3578. maxDate = _ref[1];
  3579. var startDate = this.startDate;
  3580. var rows = this.rows;
  3581. for (var i = 0, k = rows.length; i < k; i++) {
  3582. var row = rows[i];
  3583. for (var j = 0, l = row.length; j < l; j++) {
  3584. if (this.showWeekNumber && j === 0) continue;
  3585. var _cell = row[j];
  3586. var index = i * 7 + j + (this.showWeekNumber ? -1 : 0);
  3587. var time = Object(date_util_["nextDate"])(startDate, index - this.offsetDay).getTime();
  3588. _cell.inRange = minDate && time >= minDate && time <= maxDate;
  3589. _cell.start = minDate && time === minDate;
  3590. _cell.end = maxDate && time === maxDate;
  3591. }
  3592. }
  3593. },
  3594. handleMouseMove: function handleMouseMove(event) {
  3595. if (!this.rangeState.selecting) return;
  3596. var target = event.target;
  3597. if (target.tagName === 'SPAN') {
  3598. target = target.parentNode.parentNode;
  3599. }
  3600. if (target.tagName === 'DIV') {
  3601. target = target.parentNode;
  3602. }
  3603. if (target.tagName !== 'TD') return;
  3604. var row = target.parentNode.rowIndex - 1;
  3605. var column = target.cellIndex;
  3606. // can not select disabled date
  3607. if (this.rows[row][column].disabled) return;
  3608. // only update rangeState when mouse moves to a new cell
  3609. // this avoids frequent Date object creation and improves performance
  3610. if (row !== this.lastRow || column !== this.lastColumn) {
  3611. this.lastRow = row;
  3612. this.lastColumn = column;
  3613. this.$emit('changerange', {
  3614. minDate: this.minDate,
  3615. maxDate: this.maxDate,
  3616. rangeState: {
  3617. selecting: true,
  3618. endDate: this.getDateOfCell(row, column)
  3619. }
  3620. });
  3621. }
  3622. },
  3623. handleClick: function handleClick(event) {
  3624. var target = event.target;
  3625. if (target.tagName === 'SPAN') {
  3626. target = target.parentNode.parentNode;
  3627. }
  3628. if (target.tagName === 'DIV') {
  3629. target = target.parentNode;
  3630. }
  3631. if (target.tagName !== 'TD') return;
  3632. var row = target.parentNode.rowIndex - 1;
  3633. var column = this.selectionMode === 'week' ? 1 : target.cellIndex;
  3634. var cell = this.rows[row][column];
  3635. if (cell.disabled || cell.type === 'week') return;
  3636. var newDate = this.getDateOfCell(row, column);
  3637. if (this.selectionMode === 'range') {
  3638. if (!this.rangeState.selecting) {
  3639. this.$emit('pick', { minDate: newDate, maxDate: null });
  3640. this.rangeState.selecting = true;
  3641. } else {
  3642. if (newDate >= this.minDate) {
  3643. this.$emit('pick', { minDate: this.minDate, maxDate: newDate });
  3644. } else {
  3645. this.$emit('pick', { minDate: newDate, maxDate: this.minDate });
  3646. }
  3647. this.rangeState.selecting = false;
  3648. }
  3649. } else if (this.selectionMode === 'day') {
  3650. this.$emit('pick', newDate);
  3651. } else if (this.selectionMode === 'week') {
  3652. var weekNumber = Object(date_util_["getWeekNumber"])(newDate);
  3653. var value = newDate.getFullYear() + 'w' + weekNumber;
  3654. this.$emit('pick', {
  3655. year: newDate.getFullYear(),
  3656. week: weekNumber,
  3657. value: value,
  3658. date: newDate
  3659. });
  3660. } else if (this.selectionMode === 'dates') {
  3661. var _value = this.value || [];
  3662. var newValue = cell.selected ? date_tablevue_type_script_lang_js_removeFromArray(_value, function (date) {
  3663. return date.getTime() === newDate.getTime();
  3664. }) : [].concat(_value, [newDate]);
  3665. this.$emit('pick', newValue);
  3666. }
  3667. }
  3668. }
  3669. });
  3670. // CONCATENATED MODULE: ./packages/date-picker/src/basic/date-table.vue?vue&type=script&lang=js&
  3671. /* harmony default export */ var basic_date_tablevue_type_script_lang_js_ = (date_tablevue_type_script_lang_js_);
  3672. // CONCATENATED MODULE: ./packages/date-picker/src/basic/date-table.vue
  3673. /* normalize component */
  3674. var date_table_component = Object(componentNormalizer["a" /* default */])(
  3675. basic_date_tablevue_type_script_lang_js_,
  3676. date_tablevue_type_template_id_5d1f3341_render,
  3677. date_tablevue_type_template_id_5d1f3341_staticRenderFns,
  3678. false,
  3679. null,
  3680. null,
  3681. null
  3682. )
  3683. /* hot reload */
  3684. if (false) { var date_table_api; }
  3685. date_table_component.options.__file = "packages/date-picker/src/basic/date-table.vue"
  3686. /* harmony default export */ var date_table = (date_table_component.exports);
  3687. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/date.vue?vue&type=script&lang=js&
  3688. //
  3689. //
  3690. //
  3691. //
  3692. //
  3693. //
  3694. //
  3695. //
  3696. //
  3697. //
  3698. //
  3699. //
  3700. //
  3701. //
  3702. //
  3703. //
  3704. //
  3705. //
  3706. //
  3707. //
  3708. //
  3709. //
  3710. //
  3711. //
  3712. //
  3713. //
  3714. //
  3715. //
  3716. //
  3717. //
  3718. //
  3719. //
  3720. //
  3721. //
  3722. //
  3723. //
  3724. //
  3725. //
  3726. //
  3727. //
  3728. //
  3729. //
  3730. //
  3731. //
  3732. //
  3733. //
  3734. //
  3735. //
  3736. //
  3737. //
  3738. //
  3739. //
  3740. //
  3741. //
  3742. //
  3743. //
  3744. //
  3745. //
  3746. //
  3747. //
  3748. //
  3749. //
  3750. //
  3751. //
  3752. //
  3753. //
  3754. //
  3755. //
  3756. //
  3757. //
  3758. //
  3759. //
  3760. //
  3761. //
  3762. //
  3763. //
  3764. //
  3765. //
  3766. //
  3767. //
  3768. //
  3769. //
  3770. //
  3771. //
  3772. //
  3773. //
  3774. //
  3775. //
  3776. //
  3777. //
  3778. //
  3779. //
  3780. //
  3781. //
  3782. //
  3783. //
  3784. //
  3785. //
  3786. //
  3787. //
  3788. //
  3789. //
  3790. //
  3791. //
  3792. //
  3793. //
  3794. //
  3795. //
  3796. //
  3797. //
  3798. //
  3799. //
  3800. //
  3801. //
  3802. //
  3803. //
  3804. //
  3805. //
  3806. //
  3807. //
  3808. //
  3809. //
  3810. //
  3811. //
  3812. //
  3813. //
  3814. //
  3815. //
  3816. //
  3817. //
  3818. //
  3819. //
  3820. //
  3821. //
  3822. //
  3823. //
  3824. //
  3825. //
  3826. //
  3827. //
  3828. //
  3829. //
  3830. //
  3831. //
  3832. /* harmony default export */ var datevue_type_script_lang_js_ = ({
  3833. mixins: [locale_default.a],
  3834. directives: { Clickoutside: clickoutside_default.a },
  3835. watch: {
  3836. showTime: function showTime(val) {
  3837. var _this = this;
  3838. /* istanbul ignore if */
  3839. if (!val) return;
  3840. this.$nextTick(function (_) {
  3841. var inputElm = _this.$refs.input.$el;
  3842. if (inputElm) {
  3843. _this.pickerWidth = inputElm.getBoundingClientRect().width + 10;
  3844. }
  3845. });
  3846. },
  3847. value: function value(val) {
  3848. if (this.selectionMode === 'dates' && this.value) return;
  3849. if (Object(date_util_["isDate"])(val)) {
  3850. this.date = new Date(val);
  3851. } else {
  3852. this.date = this.getDefaultValue();
  3853. }
  3854. },
  3855. defaultValue: function defaultValue(val) {
  3856. if (!Object(date_util_["isDate"])(this.value)) {
  3857. this.date = val ? new Date(val) : new Date();
  3858. }
  3859. },
  3860. timePickerVisible: function timePickerVisible(val) {
  3861. var _this2 = this;
  3862. if (val) this.$nextTick(function () {
  3863. return _this2.$refs.timepicker.adjustSpinners();
  3864. });
  3865. },
  3866. selectionMode: function selectionMode(newVal) {
  3867. if (newVal === 'month') {
  3868. /* istanbul ignore next */
  3869. if (this.currentView !== 'year' || this.currentView !== 'month') {
  3870. this.currentView = 'month';
  3871. }
  3872. } else if (newVal === 'dates') {
  3873. this.currentView = 'date';
  3874. }
  3875. }
  3876. },
  3877. methods: {
  3878. proxyTimePickerDataProperties: function proxyTimePickerDataProperties() {
  3879. var _this3 = this;
  3880. var format = function format(timeFormat) {
  3881. _this3.$refs.timepicker.format = timeFormat;
  3882. };
  3883. var value = function value(_value) {
  3884. _this3.$refs.timepicker.value = _value;
  3885. };
  3886. var date = function date(_date) {
  3887. _this3.$refs.timepicker.date = _date;
  3888. };
  3889. var selectableRange = function selectableRange(_selectableRange) {
  3890. _this3.$refs.timepicker.selectableRange = _selectableRange;
  3891. };
  3892. this.$watch('value', value);
  3893. this.$watch('date', date);
  3894. this.$watch('selectableRange', selectableRange);
  3895. format(this.timeFormat);
  3896. value(this.value);
  3897. date(this.date);
  3898. selectableRange(this.selectableRange);
  3899. },
  3900. handleClear: function handleClear() {
  3901. this.date = this.getDefaultValue();
  3902. this.$emit('pick', null);
  3903. },
  3904. emit: function emit(value) {
  3905. var _this4 = this;
  3906. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3907. args[_key - 1] = arguments[_key];
  3908. }
  3909. if (!value) {
  3910. this.$emit.apply(this, ['pick', value].concat(args));
  3911. } else if (Array.isArray(value)) {
  3912. var dates = value.map(function (date) {
  3913. return _this4.showTime ? Object(date_util_["clearMilliseconds"])(date) : Object(date_util_["clearTime"])(date);
  3914. });
  3915. this.$emit.apply(this, ['pick', dates].concat(args));
  3916. } else {
  3917. this.$emit.apply(this, ['pick', this.showTime ? Object(date_util_["clearMilliseconds"])(value) : Object(date_util_["clearTime"])(value)].concat(args));
  3918. }
  3919. this.userInputDate = null;
  3920. this.userInputTime = null;
  3921. },
  3922. // resetDate() {
  3923. // this.date = new Date(this.date);
  3924. // },
  3925. showMonthPicker: function showMonthPicker() {
  3926. this.currentView = 'month';
  3927. },
  3928. showYearPicker: function showYearPicker() {
  3929. this.currentView = 'year';
  3930. },
  3931. // XXX: 没用到
  3932. // handleLabelClick() {
  3933. // if (this.currentView === 'date') {
  3934. // this.showMonthPicker();
  3935. // } else if (this.currentView === 'month') {
  3936. // this.showYearPicker();
  3937. // }
  3938. // },
  3939. prevMonth: function prevMonth() {
  3940. this.date = Object(date_util_["prevMonth"])(this.date);
  3941. },
  3942. nextMonth: function nextMonth() {
  3943. this.date = Object(date_util_["nextMonth"])(this.date);
  3944. },
  3945. prevYear: function prevYear() {
  3946. if (this.currentView === 'year') {
  3947. this.date = Object(date_util_["prevYear"])(this.date, 10);
  3948. } else {
  3949. this.date = Object(date_util_["prevYear"])(this.date);
  3950. }
  3951. },
  3952. nextYear: function nextYear() {
  3953. if (this.currentView === 'year') {
  3954. this.date = Object(date_util_["nextYear"])(this.date, 10);
  3955. } else {
  3956. this.date = Object(date_util_["nextYear"])(this.date);
  3957. }
  3958. },
  3959. handleShortcutClick: function handleShortcutClick(shortcut) {
  3960. if (shortcut.onClick) {
  3961. shortcut.onClick(this);
  3962. }
  3963. },
  3964. handleTimePick: function handleTimePick(value, visible, first) {
  3965. if (Object(date_util_["isDate"])(value)) {
  3966. var newDate = this.value ? Object(date_util_["modifyTime"])(this.value, value.getHours(), value.getMinutes(), value.getSeconds()) : Object(date_util_["modifyWithTimeString"])(this.getDefaultValue(), this.defaultTime);
  3967. this.date = newDate;
  3968. this.emit(this.date, true);
  3969. } else {
  3970. this.emit(value, true);
  3971. }
  3972. if (!first) {
  3973. this.timePickerVisible = visible;
  3974. }
  3975. },
  3976. handleTimePickClose: function handleTimePickClose() {
  3977. this.timePickerVisible = false;
  3978. },
  3979. handleMonthPick: function handleMonthPick(month) {
  3980. if (this.selectionMode === 'month') {
  3981. this.date = Object(date_util_["modifyDate"])(this.date, this.year, month, 1);
  3982. this.emit(this.date);
  3983. } else {
  3984. this.date = Object(date_util_["changeYearMonthAndClampDate"])(this.date, this.year, month);
  3985. // TODO: should emit intermediate value ??
  3986. // this.emit(this.date);
  3987. this.currentView = 'date';
  3988. }
  3989. },
  3990. handleDatePick: function handleDatePick(value) {
  3991. if (this.selectionMode === 'day') {
  3992. var newDate = this.value ? Object(date_util_["modifyDate"])(this.value, value.getFullYear(), value.getMonth(), value.getDate()) : Object(date_util_["modifyWithTimeString"])(value, this.defaultTime);
  3993. // change default time while out of selectableRange
  3994. if (!this.checkDateWithinRange(newDate)) {
  3995. newDate = Object(date_util_["modifyDate"])(this.selectableRange[0][0], value.getFullYear(), value.getMonth(), value.getDate());
  3996. }
  3997. this.date = newDate;
  3998. this.emit(this.date, this.showTime);
  3999. } else if (this.selectionMode === 'week') {
  4000. this.emit(value.date);
  4001. } else if (this.selectionMode === 'dates') {
  4002. this.emit(value, true); // set false to keep panel open
  4003. }
  4004. },
  4005. handleYearPick: function handleYearPick(year) {
  4006. if (this.selectionMode === 'year') {
  4007. this.date = Object(date_util_["modifyDate"])(this.date, year, 0, 1);
  4008. this.emit(this.date);
  4009. } else {
  4010. this.date = Object(date_util_["changeYearMonthAndClampDate"])(this.date, year, this.month);
  4011. // TODO: should emit intermediate value ??
  4012. // this.emit(this.date, true);
  4013. this.currentView = 'month';
  4014. }
  4015. },
  4016. changeToNow: function changeToNow() {
  4017. // NOTE: not a permanent solution
  4018. // consider disable "now" button in the future
  4019. if ((!this.disabledDate || !this.disabledDate(new Date())) && this.checkDateWithinRange(new Date())) {
  4020. this.date = new Date();
  4021. this.emit(this.date);
  4022. }
  4023. },
  4024. confirm: function confirm() {
  4025. if (this.selectionMode === 'dates') {
  4026. this.emit(this.value);
  4027. } else {
  4028. // value were emitted in handle{Date,Time}Pick, nothing to update here
  4029. // deal with the scenario where: user opens the picker, then confirm without doing anything
  4030. var value = this.value ? this.value : Object(date_util_["modifyWithTimeString"])(this.getDefaultValue(), this.defaultTime);
  4031. this.date = new Date(value); // refresh date
  4032. this.emit(value);
  4033. }
  4034. },
  4035. resetView: function resetView() {
  4036. if (this.selectionMode === 'month') {
  4037. this.currentView = 'month';
  4038. } else if (this.selectionMode === 'year') {
  4039. this.currentView = 'year';
  4040. } else {
  4041. this.currentView = 'date';
  4042. }
  4043. },
  4044. handleEnter: function handleEnter() {
  4045. document.body.addEventListener('keydown', this.handleKeydown);
  4046. },
  4047. handleLeave: function handleLeave() {
  4048. this.$emit('dodestroy');
  4049. document.body.removeEventListener('keydown', this.handleKeydown);
  4050. },
  4051. handleKeydown: function handleKeydown(event) {
  4052. var keyCode = event.keyCode;
  4053. var list = [38, 40, 37, 39];
  4054. if (this.visible && !this.timePickerVisible) {
  4055. if (list.indexOf(keyCode) !== -1) {
  4056. this.handleKeyControl(keyCode);
  4057. event.stopPropagation();
  4058. event.preventDefault();
  4059. }
  4060. if (keyCode === 13 && this.userInputDate === null && this.userInputTime === null) {
  4061. // Enter
  4062. this.emit(this.date, false);
  4063. }
  4064. }
  4065. },
  4066. handleKeyControl: function handleKeyControl(keyCode) {
  4067. var mapping = {
  4068. 'year': {
  4069. 38: -4, 40: 4, 37: -1, 39: 1, offset: function offset(date, step) {
  4070. return date.setFullYear(date.getFullYear() + step);
  4071. }
  4072. },
  4073. 'month': {
  4074. 38: -4, 40: 4, 37: -1, 39: 1, offset: function offset(date, step) {
  4075. return date.setMonth(date.getMonth() + step);
  4076. }
  4077. },
  4078. 'week': {
  4079. 38: -1, 40: 1, 37: -1, 39: 1, offset: function offset(date, step) {
  4080. return date.setDate(date.getDate() + step * 7);
  4081. }
  4082. },
  4083. 'day': {
  4084. 38: -7, 40: 7, 37: -1, 39: 1, offset: function offset(date, step) {
  4085. return date.setDate(date.getDate() + step);
  4086. }
  4087. }
  4088. };
  4089. var mode = this.selectionMode;
  4090. var year = 3.1536e10;
  4091. var now = this.date.getTime();
  4092. var newDate = new Date(this.date.getTime());
  4093. while (Math.abs(now - newDate.getTime()) <= year) {
  4094. var map = mapping[mode];
  4095. map.offset(newDate, map[keyCode]);
  4096. if (typeof this.disabledDate === 'function' && this.disabledDate(newDate)) {
  4097. continue;
  4098. }
  4099. this.date = newDate;
  4100. this.$emit('pick', newDate, true);
  4101. break;
  4102. }
  4103. },
  4104. handleVisibleTimeChange: function handleVisibleTimeChange(value) {
  4105. var time = Object(date_util_["parseDate"])(value, this.timeFormat);
  4106. if (time && this.checkDateWithinRange(time)) {
  4107. this.date = Object(date_util_["modifyDate"])(time, this.year, this.month, this.monthDate);
  4108. this.userInputTime = null;
  4109. this.$refs.timepicker.value = this.date;
  4110. this.timePickerVisible = false;
  4111. this.emit(this.date, true);
  4112. }
  4113. },
  4114. handleVisibleDateChange: function handleVisibleDateChange(value) {
  4115. var date = Object(date_util_["parseDate"])(value, this.dateFormat);
  4116. if (date) {
  4117. if (typeof this.disabledDate === 'function' && this.disabledDate(date)) {
  4118. return;
  4119. }
  4120. this.date = Object(date_util_["modifyTime"])(date, this.date.getHours(), this.date.getMinutes(), this.date.getSeconds());
  4121. this.userInputDate = null;
  4122. this.resetView();
  4123. this.emit(this.date, true);
  4124. }
  4125. },
  4126. isValidValue: function isValidValue(value) {
  4127. return value && !isNaN(value) && (typeof this.disabledDate === 'function' ? !this.disabledDate(value) : true) && this.checkDateWithinRange(value);
  4128. },
  4129. getDefaultValue: function getDefaultValue() {
  4130. // if default-value is set, return it
  4131. // otherwise, return now (the moment this method gets called)
  4132. return this.defaultValue ? new Date(this.defaultValue) : new Date();
  4133. },
  4134. checkDateWithinRange: function checkDateWithinRange(date) {
  4135. return this.selectableRange.length > 0 ? Object(date_util_["timeWithinRange"])(date, this.selectableRange, this.format || 'HH:mm:ss') : true;
  4136. }
  4137. },
  4138. components: {
  4139. TimePicker: panel_time["a" /* default */], YearTable: year_table, MonthTable: month_table, DateTable: date_table, ElInput: input_default.a, ElButton: button_default.a
  4140. },
  4141. data: function data() {
  4142. return {
  4143. popperClass: '',
  4144. date: new Date(),
  4145. value: '',
  4146. defaultValue: null, // use getDefaultValue() for time computation
  4147. defaultTime: null,
  4148. showTime: false,
  4149. selectionMode: 'day',
  4150. shortcuts: '',
  4151. visible: false,
  4152. currentView: 'date',
  4153. disabledDate: '',
  4154. cellClassName: '',
  4155. selectableRange: [],
  4156. firstDayOfWeek: 7,
  4157. showWeekNumber: false,
  4158. timePickerVisible: false,
  4159. format: '',
  4160. arrowControl: false,
  4161. userInputDate: null,
  4162. userInputTime: null
  4163. };
  4164. },
  4165. computed: {
  4166. year: function year() {
  4167. return this.date.getFullYear();
  4168. },
  4169. month: function month() {
  4170. return this.date.getMonth();
  4171. },
  4172. week: function week() {
  4173. return Object(date_util_["getWeekNumber"])(this.date);
  4174. },
  4175. monthDate: function monthDate() {
  4176. return this.date.getDate();
  4177. },
  4178. footerVisible: function footerVisible() {
  4179. return this.showTime || this.selectionMode === 'dates';
  4180. },
  4181. visibleTime: function visibleTime() {
  4182. if (this.userInputTime !== null) {
  4183. return this.userInputTime;
  4184. } else {
  4185. return Object(date_util_["formatDate"])(this.value || this.defaultValue, this.timeFormat);
  4186. }
  4187. },
  4188. visibleDate: function visibleDate() {
  4189. if (this.userInputDate !== null) {
  4190. return this.userInputDate;
  4191. } else {
  4192. return Object(date_util_["formatDate"])(this.value || this.defaultValue, this.dateFormat);
  4193. }
  4194. },
  4195. yearLabel: function yearLabel() {
  4196. var yearTranslation = this.t('el.datepicker.year');
  4197. if (this.currentView === 'year') {
  4198. var startYear = Math.floor(this.year / 10) * 10;
  4199. if (yearTranslation) {
  4200. return startYear + ' ' + yearTranslation + ' - ' + (startYear + 9) + ' ' + yearTranslation;
  4201. }
  4202. return startYear + ' - ' + (startYear + 9);
  4203. }
  4204. return this.year + ' ' + yearTranslation;
  4205. },
  4206. timeFormat: function timeFormat() {
  4207. if (this.format) {
  4208. return Object(date_util_["extractTimeFormat"])(this.format);
  4209. } else {
  4210. return 'HH:mm:ss';
  4211. }
  4212. },
  4213. dateFormat: function dateFormat() {
  4214. if (this.format) {
  4215. return Object(date_util_["extractDateFormat"])(this.format);
  4216. } else {
  4217. return 'yyyy-MM-dd';
  4218. }
  4219. }
  4220. }
  4221. });
  4222. // CONCATENATED MODULE: ./packages/date-picker/src/panel/date.vue?vue&type=script&lang=js&
  4223. /* harmony default export */ var panel_datevue_type_script_lang_js_ = (datevue_type_script_lang_js_);
  4224. // CONCATENATED MODULE: ./packages/date-picker/src/panel/date.vue
  4225. /* normalize component */
  4226. var date_component = Object(componentNormalizer["a" /* default */])(
  4227. panel_datevue_type_script_lang_js_,
  4228. render,
  4229. staticRenderFns,
  4230. false,
  4231. null,
  4232. null,
  4233. null
  4234. )
  4235. /* hot reload */
  4236. if (false) { var date_api; }
  4237. date_component.options.__file = "packages/date-picker/src/panel/date.vue"
  4238. /* harmony default export */ var panel_date = (date_component.exports);
  4239. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/date-range.vue?vue&type=template&id=2652849a&
  4240. var date_rangevue_type_template_id_2652849a_render = function() {
  4241. var _vm = this
  4242. var _h = _vm.$createElement
  4243. var _c = _vm._self._c || _h
  4244. return _c(
  4245. "transition",
  4246. {
  4247. attrs: { name: "el-zoom-in-top" },
  4248. on: {
  4249. "after-leave": function($event) {
  4250. _vm.$emit("dodestroy")
  4251. }
  4252. }
  4253. },
  4254. [
  4255. _c(
  4256. "div",
  4257. {
  4258. directives: [
  4259. {
  4260. name: "show",
  4261. rawName: "v-show",
  4262. value: _vm.visible,
  4263. expression: "visible"
  4264. }
  4265. ],
  4266. staticClass: "el-picker-panel el-date-range-picker el-popper",
  4267. class: [
  4268. {
  4269. "has-sidebar": _vm.$slots.sidebar || _vm.shortcuts,
  4270. "has-time": _vm.showTime
  4271. },
  4272. _vm.popperClass
  4273. ]
  4274. },
  4275. [
  4276. _c(
  4277. "div",
  4278. { staticClass: "el-picker-panel__body-wrapper" },
  4279. [
  4280. _vm._t("sidebar"),
  4281. _vm.shortcuts
  4282. ? _c(
  4283. "div",
  4284. { staticClass: "el-picker-panel__sidebar" },
  4285. _vm._l(_vm.shortcuts, function(shortcut, key) {
  4286. return _c(
  4287. "button",
  4288. {
  4289. key: key,
  4290. staticClass: "el-picker-panel__shortcut",
  4291. attrs: { type: "button" },
  4292. on: {
  4293. click: function($event) {
  4294. _vm.handleShortcutClick(shortcut)
  4295. }
  4296. }
  4297. },
  4298. [_vm._v(_vm._s(shortcut.text))]
  4299. )
  4300. }),
  4301. 0
  4302. )
  4303. : _vm._e(),
  4304. _c("div", { staticClass: "el-picker-panel__body" }, [
  4305. _vm.showTime
  4306. ? _c(
  4307. "div",
  4308. { staticClass: "el-date-range-picker__time-header" },
  4309. [
  4310. _c(
  4311. "span",
  4312. { staticClass: "el-date-range-picker__editors-wrap" },
  4313. [
  4314. _c(
  4315. "span",
  4316. {
  4317. staticClass:
  4318. "el-date-range-picker__time-picker-wrap"
  4319. },
  4320. [
  4321. _c("el-input", {
  4322. ref: "minInput",
  4323. staticClass: "el-date-range-picker__editor",
  4324. attrs: {
  4325. size: "small",
  4326. disabled: _vm.rangeState.selecting,
  4327. placeholder: _vm.t(
  4328. "el.datepicker.startDate"
  4329. ),
  4330. value: _vm.minVisibleDate
  4331. },
  4332. on: {
  4333. input: function(val) {
  4334. return _vm.handleDateInput(val, "min")
  4335. },
  4336. change: function(val) {
  4337. return _vm.handleDateChange(val, "min")
  4338. }
  4339. }
  4340. })
  4341. ],
  4342. 1
  4343. ),
  4344. _c(
  4345. "span",
  4346. {
  4347. directives: [
  4348. {
  4349. name: "clickoutside",
  4350. rawName: "v-clickoutside",
  4351. value: _vm.handleMinTimeClose,
  4352. expression: "handleMinTimeClose"
  4353. }
  4354. ],
  4355. staticClass:
  4356. "el-date-range-picker__time-picker-wrap"
  4357. },
  4358. [
  4359. _c("el-input", {
  4360. staticClass: "el-date-range-picker__editor",
  4361. attrs: {
  4362. size: "small",
  4363. disabled: _vm.rangeState.selecting,
  4364. placeholder: _vm.t(
  4365. "el.datepicker.startTime"
  4366. ),
  4367. value: _vm.minVisibleTime
  4368. },
  4369. on: {
  4370. focus: function($event) {
  4371. _vm.minTimePickerVisible = true
  4372. },
  4373. input: function(val) {
  4374. return _vm.handleTimeInput(val, "min")
  4375. },
  4376. change: function(val) {
  4377. return _vm.handleTimeChange(val, "min")
  4378. }
  4379. }
  4380. }),
  4381. _c("time-picker", {
  4382. ref: "minTimePicker",
  4383. attrs: {
  4384. "time-arrow-control": _vm.arrowControl,
  4385. visible: _vm.minTimePickerVisible
  4386. },
  4387. on: {
  4388. pick: _vm.handleMinTimePick,
  4389. mounted: function($event) {
  4390. _vm.$refs.minTimePicker.format =
  4391. _vm.timeFormat
  4392. }
  4393. }
  4394. })
  4395. ],
  4396. 1
  4397. )
  4398. ]
  4399. ),
  4400. _c("span", { staticClass: "el-icon-arrow-right" }),
  4401. _c(
  4402. "span",
  4403. {
  4404. staticClass:
  4405. "el-date-range-picker__editors-wrap is-right"
  4406. },
  4407. [
  4408. _c(
  4409. "span",
  4410. {
  4411. staticClass:
  4412. "el-date-range-picker__time-picker-wrap"
  4413. },
  4414. [
  4415. _c("el-input", {
  4416. staticClass: "el-date-range-picker__editor",
  4417. attrs: {
  4418. size: "small",
  4419. disabled: _vm.rangeState.selecting,
  4420. placeholder: _vm.t("el.datepicker.endDate"),
  4421. value: _vm.maxVisibleDate,
  4422. readonly: !_vm.minDate
  4423. },
  4424. on: {
  4425. input: function(val) {
  4426. return _vm.handleDateInput(val, "max")
  4427. },
  4428. change: function(val) {
  4429. return _vm.handleDateChange(val, "max")
  4430. }
  4431. }
  4432. })
  4433. ],
  4434. 1
  4435. ),
  4436. _c(
  4437. "span",
  4438. {
  4439. directives: [
  4440. {
  4441. name: "clickoutside",
  4442. rawName: "v-clickoutside",
  4443. value: _vm.handleMaxTimeClose,
  4444. expression: "handleMaxTimeClose"
  4445. }
  4446. ],
  4447. staticClass:
  4448. "el-date-range-picker__time-picker-wrap"
  4449. },
  4450. [
  4451. _c("el-input", {
  4452. staticClass: "el-date-range-picker__editor",
  4453. attrs: {
  4454. size: "small",
  4455. disabled: _vm.rangeState.selecting,
  4456. placeholder: _vm.t("el.datepicker.endTime"),
  4457. value: _vm.maxVisibleTime,
  4458. readonly: !_vm.minDate
  4459. },
  4460. on: {
  4461. focus: function($event) {
  4462. _vm.minDate &&
  4463. (_vm.maxTimePickerVisible = true)
  4464. },
  4465. input: function(val) {
  4466. return _vm.handleTimeInput(val, "max")
  4467. },
  4468. change: function(val) {
  4469. return _vm.handleTimeChange(val, "max")
  4470. }
  4471. }
  4472. }),
  4473. _c("time-picker", {
  4474. ref: "maxTimePicker",
  4475. attrs: {
  4476. "time-arrow-control": _vm.arrowControl,
  4477. visible: _vm.maxTimePickerVisible
  4478. },
  4479. on: {
  4480. pick: _vm.handleMaxTimePick,
  4481. mounted: function($event) {
  4482. _vm.$refs.maxTimePicker.format =
  4483. _vm.timeFormat
  4484. }
  4485. }
  4486. })
  4487. ],
  4488. 1
  4489. )
  4490. ]
  4491. )
  4492. ]
  4493. )
  4494. : _vm._e(),
  4495. _c(
  4496. "div",
  4497. {
  4498. staticClass:
  4499. "el-picker-panel__content el-date-range-picker__content is-left"
  4500. },
  4501. [
  4502. _c("div", { staticClass: "el-date-range-picker__header" }, [
  4503. _c("button", {
  4504. staticClass:
  4505. "el-picker-panel__icon-btn el-icon-d-arrow-left",
  4506. attrs: { type: "button" },
  4507. on: { click: _vm.leftPrevYear }
  4508. }),
  4509. _c("button", {
  4510. staticClass:
  4511. "el-picker-panel__icon-btn el-icon-arrow-left",
  4512. attrs: { type: "button" },
  4513. on: { click: _vm.leftPrevMonth }
  4514. }),
  4515. _vm.unlinkPanels
  4516. ? _c("button", {
  4517. staticClass:
  4518. "el-picker-panel__icon-btn el-icon-d-arrow-right",
  4519. class: { "is-disabled": !_vm.enableYearArrow },
  4520. attrs: {
  4521. type: "button",
  4522. disabled: !_vm.enableYearArrow
  4523. },
  4524. on: { click: _vm.leftNextYear }
  4525. })
  4526. : _vm._e(),
  4527. _vm.unlinkPanels
  4528. ? _c("button", {
  4529. staticClass:
  4530. "el-picker-panel__icon-btn el-icon-arrow-right",
  4531. class: { "is-disabled": !_vm.enableMonthArrow },
  4532. attrs: {
  4533. type: "button",
  4534. disabled: !_vm.enableMonthArrow
  4535. },
  4536. on: { click: _vm.leftNextMonth }
  4537. })
  4538. : _vm._e(),
  4539. _c("div", [_vm._v(_vm._s(_vm.leftLabel))])
  4540. ]),
  4541. _c("date-table", {
  4542. attrs: {
  4543. "selection-mode": "range",
  4544. date: _vm.leftDate,
  4545. "default-value": _vm.defaultValue,
  4546. "min-date": _vm.minDate,
  4547. "max-date": _vm.maxDate,
  4548. "range-state": _vm.rangeState,
  4549. "disabled-date": _vm.disabledDate,
  4550. "cell-class-name": _vm.cellClassName,
  4551. "first-day-of-week": _vm.firstDayOfWeek
  4552. },
  4553. on: {
  4554. changerange: _vm.handleChangeRange,
  4555. pick: _vm.handleRangePick
  4556. }
  4557. })
  4558. ],
  4559. 1
  4560. ),
  4561. _c(
  4562. "div",
  4563. {
  4564. staticClass:
  4565. "el-picker-panel__content el-date-range-picker__content is-right"
  4566. },
  4567. [
  4568. _c("div", { staticClass: "el-date-range-picker__header" }, [
  4569. _vm.unlinkPanels
  4570. ? _c("button", {
  4571. staticClass:
  4572. "el-picker-panel__icon-btn el-icon-d-arrow-left",
  4573. class: { "is-disabled": !_vm.enableYearArrow },
  4574. attrs: {
  4575. type: "button",
  4576. disabled: !_vm.enableYearArrow
  4577. },
  4578. on: { click: _vm.rightPrevYear }
  4579. })
  4580. : _vm._e(),
  4581. _vm.unlinkPanels
  4582. ? _c("button", {
  4583. staticClass:
  4584. "el-picker-panel__icon-btn el-icon-arrow-left",
  4585. class: { "is-disabled": !_vm.enableMonthArrow },
  4586. attrs: {
  4587. type: "button",
  4588. disabled: !_vm.enableMonthArrow
  4589. },
  4590. on: { click: _vm.rightPrevMonth }
  4591. })
  4592. : _vm._e(),
  4593. _c("button", {
  4594. staticClass:
  4595. "el-picker-panel__icon-btn el-icon-d-arrow-right",
  4596. attrs: { type: "button" },
  4597. on: { click: _vm.rightNextYear }
  4598. }),
  4599. _c("button", {
  4600. staticClass:
  4601. "el-picker-panel__icon-btn el-icon-arrow-right",
  4602. attrs: { type: "button" },
  4603. on: { click: _vm.rightNextMonth }
  4604. }),
  4605. _c("div", [_vm._v(_vm._s(_vm.rightLabel))])
  4606. ]),
  4607. _c("date-table", {
  4608. attrs: {
  4609. "selection-mode": "range",
  4610. date: _vm.rightDate,
  4611. "default-value": _vm.defaultValue,
  4612. "min-date": _vm.minDate,
  4613. "max-date": _vm.maxDate,
  4614. "range-state": _vm.rangeState,
  4615. "disabled-date": _vm.disabledDate,
  4616. "cell-class-name": _vm.cellClassName,
  4617. "first-day-of-week": _vm.firstDayOfWeek
  4618. },
  4619. on: {
  4620. changerange: _vm.handleChangeRange,
  4621. pick: _vm.handleRangePick
  4622. }
  4623. })
  4624. ],
  4625. 1
  4626. )
  4627. ])
  4628. ],
  4629. 2
  4630. ),
  4631. _vm.showTime
  4632. ? _c(
  4633. "div",
  4634. { staticClass: "el-picker-panel__footer" },
  4635. [
  4636. _c(
  4637. "el-button",
  4638. {
  4639. staticClass: "el-picker-panel__link-btn",
  4640. attrs: { size: "mini", type: "text" },
  4641. on: { click: _vm.handleClear }
  4642. },
  4643. [
  4644. _vm._v(
  4645. "\n " +
  4646. _vm._s(_vm.t("el.datepicker.clear")) +
  4647. "\n "
  4648. )
  4649. ]
  4650. ),
  4651. _c(
  4652. "el-button",
  4653. {
  4654. staticClass: "el-picker-panel__link-btn",
  4655. attrs: {
  4656. plain: "",
  4657. size: "mini",
  4658. disabled: _vm.btnDisabled
  4659. },
  4660. on: {
  4661. click: function($event) {
  4662. _vm.handleConfirm(false)
  4663. }
  4664. }
  4665. },
  4666. [
  4667. _vm._v(
  4668. "\n " +
  4669. _vm._s(_vm.t("el.datepicker.confirm")) +
  4670. "\n "
  4671. )
  4672. ]
  4673. )
  4674. ],
  4675. 1
  4676. )
  4677. : _vm._e()
  4678. ]
  4679. )
  4680. ]
  4681. )
  4682. }
  4683. var date_rangevue_type_template_id_2652849a_staticRenderFns = []
  4684. date_rangevue_type_template_id_2652849a_render._withStripped = true
  4685. // CONCATENATED MODULE: ./packages/date-picker/src/panel/date-range.vue?vue&type=template&id=2652849a&
  4686. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/date-range.vue?vue&type=script&lang=js&
  4687. //
  4688. //
  4689. //
  4690. //
  4691. //
  4692. //
  4693. //
  4694. //
  4695. //
  4696. //
  4697. //
  4698. //
  4699. //
  4700. //
  4701. //
  4702. //
  4703. //
  4704. //
  4705. //
  4706. //
  4707. //
  4708. //
  4709. //
  4710. //
  4711. //
  4712. //
  4713. //
  4714. //
  4715. //
  4716. //
  4717. //
  4718. //
  4719. //
  4720. //
  4721. //
  4722. //
  4723. //
  4724. //
  4725. //
  4726. //
  4727. //
  4728. //
  4729. //
  4730. //
  4731. //
  4732. //
  4733. //
  4734. //
  4735. //
  4736. //
  4737. //
  4738. //
  4739. //
  4740. //
  4741. //
  4742. //
  4743. //
  4744. //
  4745. //
  4746. //
  4747. //
  4748. //
  4749. //
  4750. //
  4751. //
  4752. //
  4753. //
  4754. //
  4755. //
  4756. //
  4757. //
  4758. //
  4759. //
  4760. //
  4761. //
  4762. //
  4763. //
  4764. //
  4765. //
  4766. //
  4767. //
  4768. //
  4769. //
  4770. //
  4771. //
  4772. //
  4773. //
  4774. //
  4775. //
  4776. //
  4777. //
  4778. //
  4779. //
  4780. //
  4781. //
  4782. //
  4783. //
  4784. //
  4785. //
  4786. //
  4787. //
  4788. //
  4789. //
  4790. //
  4791. //
  4792. //
  4793. //
  4794. //
  4795. //
  4796. //
  4797. //
  4798. //
  4799. //
  4800. //
  4801. //
  4802. //
  4803. //
  4804. //
  4805. //
  4806. //
  4807. //
  4808. //
  4809. //
  4810. //
  4811. //
  4812. //
  4813. //
  4814. //
  4815. //
  4816. //
  4817. //
  4818. //
  4819. //
  4820. //
  4821. //
  4822. //
  4823. //
  4824. //
  4825. //
  4826. //
  4827. //
  4828. //
  4829. //
  4830. //
  4831. //
  4832. //
  4833. //
  4834. //
  4835. //
  4836. //
  4837. //
  4838. //
  4839. //
  4840. //
  4841. //
  4842. //
  4843. //
  4844. //
  4845. //
  4846. //
  4847. //
  4848. //
  4849. //
  4850. //
  4851. //
  4852. //
  4853. //
  4854. //
  4855. //
  4856. //
  4857. //
  4858. //
  4859. //
  4860. //
  4861. //
  4862. //
  4863. //
  4864. //
  4865. //
  4866. //
  4867. //
  4868. //
  4869. //
  4870. //
  4871. //
  4872. //
  4873. //
  4874. //
  4875. //
  4876. var date_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultValue(defaultValue) {
  4877. if (Array.isArray(defaultValue)) {
  4878. return [new Date(defaultValue[0]), new Date(defaultValue[1])];
  4879. } else if (defaultValue) {
  4880. return [new Date(defaultValue), Object(date_util_["nextDate"])(new Date(defaultValue), 1)];
  4881. } else {
  4882. return [new Date(), Object(date_util_["nextDate"])(new Date(), 1)];
  4883. }
  4884. };
  4885. /* harmony default export */ var date_rangevue_type_script_lang_js_ = ({
  4886. mixins: [locale_default.a],
  4887. directives: { Clickoutside: clickoutside_default.a },
  4888. computed: {
  4889. btnDisabled: function btnDisabled() {
  4890. return !(this.minDate && this.maxDate && !this.selecting && this.isValidValue([this.minDate, this.maxDate]));
  4891. },
  4892. leftLabel: function leftLabel() {
  4893. return this.leftDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t('el.datepicker.month' + (this.leftDate.getMonth() + 1));
  4894. },
  4895. rightLabel: function rightLabel() {
  4896. return this.rightDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t('el.datepicker.month' + (this.rightDate.getMonth() + 1));
  4897. },
  4898. leftYear: function leftYear() {
  4899. return this.leftDate.getFullYear();
  4900. },
  4901. leftMonth: function leftMonth() {
  4902. return this.leftDate.getMonth();
  4903. },
  4904. leftMonthDate: function leftMonthDate() {
  4905. return this.leftDate.getDate();
  4906. },
  4907. rightYear: function rightYear() {
  4908. return this.rightDate.getFullYear();
  4909. },
  4910. rightMonth: function rightMonth() {
  4911. return this.rightDate.getMonth();
  4912. },
  4913. rightMonthDate: function rightMonthDate() {
  4914. return this.rightDate.getDate();
  4915. },
  4916. minVisibleDate: function minVisibleDate() {
  4917. if (this.dateUserInput.min !== null) return this.dateUserInput.min;
  4918. if (this.minDate) return Object(date_util_["formatDate"])(this.minDate, this.dateFormat);
  4919. return '';
  4920. },
  4921. maxVisibleDate: function maxVisibleDate() {
  4922. if (this.dateUserInput.max !== null) return this.dateUserInput.max;
  4923. if (this.maxDate || this.minDate) return Object(date_util_["formatDate"])(this.maxDate || this.minDate, this.dateFormat);
  4924. return '';
  4925. },
  4926. minVisibleTime: function minVisibleTime() {
  4927. if (this.timeUserInput.min !== null) return this.timeUserInput.min;
  4928. if (this.minDate) return Object(date_util_["formatDate"])(this.minDate, this.timeFormat);
  4929. return '';
  4930. },
  4931. maxVisibleTime: function maxVisibleTime() {
  4932. if (this.timeUserInput.max !== null) return this.timeUserInput.max;
  4933. if (this.maxDate || this.minDate) return Object(date_util_["formatDate"])(this.maxDate || this.minDate, this.timeFormat);
  4934. return '';
  4935. },
  4936. timeFormat: function timeFormat() {
  4937. if (this.format) {
  4938. return Object(date_util_["extractTimeFormat"])(this.format);
  4939. } else {
  4940. return 'HH:mm:ss';
  4941. }
  4942. },
  4943. dateFormat: function dateFormat() {
  4944. if (this.format) {
  4945. return Object(date_util_["extractDateFormat"])(this.format);
  4946. } else {
  4947. return 'yyyy-MM-dd';
  4948. }
  4949. },
  4950. enableMonthArrow: function enableMonthArrow() {
  4951. var nextMonth = (this.leftMonth + 1) % 12;
  4952. var yearOffset = this.leftMonth + 1 >= 12 ? 1 : 0;
  4953. return this.unlinkPanels && new Date(this.leftYear + yearOffset, nextMonth) < new Date(this.rightYear, this.rightMonth);
  4954. },
  4955. enableYearArrow: function enableYearArrow() {
  4956. return this.unlinkPanels && this.rightYear * 12 + this.rightMonth - (this.leftYear * 12 + this.leftMonth + 1) >= 12;
  4957. }
  4958. },
  4959. data: function data() {
  4960. return {
  4961. popperClass: '',
  4962. value: [],
  4963. defaultValue: null,
  4964. defaultTime: null,
  4965. minDate: '',
  4966. maxDate: '',
  4967. leftDate: new Date(),
  4968. rightDate: Object(date_util_["nextMonth"])(new Date()),
  4969. rangeState: {
  4970. endDate: null,
  4971. selecting: false,
  4972. row: null,
  4973. column: null
  4974. },
  4975. showTime: false,
  4976. shortcuts: '',
  4977. visible: '',
  4978. disabledDate: '',
  4979. cellClassName: '',
  4980. firstDayOfWeek: 7,
  4981. minTimePickerVisible: false,
  4982. maxTimePickerVisible: false,
  4983. format: '',
  4984. arrowControl: false,
  4985. unlinkPanels: false,
  4986. dateUserInput: {
  4987. min: null,
  4988. max: null
  4989. },
  4990. timeUserInput: {
  4991. min: null,
  4992. max: null
  4993. }
  4994. };
  4995. },
  4996. watch: {
  4997. minDate: function minDate(val) {
  4998. var _this = this;
  4999. this.dateUserInput.min = null;
  5000. this.timeUserInput.min = null;
  5001. this.$nextTick(function () {
  5002. if (_this.$refs.maxTimePicker && _this.maxDate && _this.maxDate < _this.minDate) {
  5003. var format = 'HH:mm:ss';
  5004. _this.$refs.maxTimePicker.selectableRange = [[Object(date_util_["parseDate"])(Object(date_util_["formatDate"])(_this.minDate, format), format), Object(date_util_["parseDate"])('23:59:59', format)]];
  5005. }
  5006. });
  5007. if (val && this.$refs.minTimePicker) {
  5008. this.$refs.minTimePicker.date = val;
  5009. this.$refs.minTimePicker.value = val;
  5010. }
  5011. },
  5012. maxDate: function maxDate(val) {
  5013. this.dateUserInput.max = null;
  5014. this.timeUserInput.max = null;
  5015. if (val && this.$refs.maxTimePicker) {
  5016. this.$refs.maxTimePicker.date = val;
  5017. this.$refs.maxTimePicker.value = val;
  5018. }
  5019. },
  5020. minTimePickerVisible: function minTimePickerVisible(val) {
  5021. var _this2 = this;
  5022. if (val) {
  5023. this.$nextTick(function () {
  5024. _this2.$refs.minTimePicker.date = _this2.minDate;
  5025. _this2.$refs.minTimePicker.value = _this2.minDate;
  5026. _this2.$refs.minTimePicker.adjustSpinners();
  5027. });
  5028. }
  5029. },
  5030. maxTimePickerVisible: function maxTimePickerVisible(val) {
  5031. var _this3 = this;
  5032. if (val) {
  5033. this.$nextTick(function () {
  5034. _this3.$refs.maxTimePicker.date = _this3.maxDate;
  5035. _this3.$refs.maxTimePicker.value = _this3.maxDate;
  5036. _this3.$refs.maxTimePicker.adjustSpinners();
  5037. });
  5038. }
  5039. },
  5040. value: function value(newVal) {
  5041. if (!newVal) {
  5042. this.minDate = null;
  5043. this.maxDate = null;
  5044. } else if (Array.isArray(newVal)) {
  5045. this.minDate = Object(date_util_["isDate"])(newVal[0]) ? new Date(newVal[0]) : null;
  5046. this.maxDate = Object(date_util_["isDate"])(newVal[1]) ? new Date(newVal[1]) : null;
  5047. if (this.minDate) {
  5048. this.leftDate = this.minDate;
  5049. if (this.unlinkPanels && this.maxDate) {
  5050. var minDateYear = this.minDate.getFullYear();
  5051. var minDateMonth = this.minDate.getMonth();
  5052. var maxDateYear = this.maxDate.getFullYear();
  5053. var maxDateMonth = this.maxDate.getMonth();
  5054. this.rightDate = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? Object(date_util_["nextMonth"])(this.maxDate) : this.maxDate;
  5055. } else {
  5056. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5057. }
  5058. } else {
  5059. this.leftDate = date_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
  5060. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5061. }
  5062. }
  5063. },
  5064. defaultValue: function defaultValue(val) {
  5065. if (!Array.isArray(this.value)) {
  5066. var _calcDefaultValue = date_rangevue_type_script_lang_js_calcDefaultValue(val),
  5067. left = _calcDefaultValue[0],
  5068. right = _calcDefaultValue[1];
  5069. this.leftDate = left;
  5070. this.rightDate = val && val[1] && this.unlinkPanels ? right : Object(date_util_["nextMonth"])(this.leftDate);
  5071. }
  5072. }
  5073. },
  5074. methods: {
  5075. handleClear: function handleClear() {
  5076. this.minDate = null;
  5077. this.maxDate = null;
  5078. this.leftDate = date_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
  5079. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5080. this.$emit('pick', null);
  5081. },
  5082. handleChangeRange: function handleChangeRange(val) {
  5083. this.minDate = val.minDate;
  5084. this.maxDate = val.maxDate;
  5085. this.rangeState = val.rangeState;
  5086. },
  5087. handleDateInput: function handleDateInput(value, type) {
  5088. this.dateUserInput[type] = value;
  5089. if (value.length !== this.dateFormat.length) return;
  5090. var parsedValue = Object(date_util_["parseDate"])(value, this.dateFormat);
  5091. if (parsedValue) {
  5092. if (typeof this.disabledDate === 'function' && this.disabledDate(new Date(parsedValue))) {
  5093. return;
  5094. }
  5095. if (type === 'min') {
  5096. this.minDate = Object(date_util_["modifyDate"])(this.minDate || new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
  5097. this.leftDate = new Date(parsedValue);
  5098. if (!this.unlinkPanels) {
  5099. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5100. }
  5101. } else {
  5102. this.maxDate = Object(date_util_["modifyDate"])(this.maxDate || new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
  5103. this.rightDate = new Date(parsedValue);
  5104. if (!this.unlinkPanels) {
  5105. this.leftDate = Object(date_util_["prevMonth"])(parsedValue);
  5106. }
  5107. }
  5108. }
  5109. },
  5110. handleDateChange: function handleDateChange(value, type) {
  5111. var parsedValue = Object(date_util_["parseDate"])(value, this.dateFormat);
  5112. if (parsedValue) {
  5113. if (type === 'min') {
  5114. this.minDate = Object(date_util_["modifyDate"])(this.minDate, parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
  5115. if (this.minDate > this.maxDate) {
  5116. this.maxDate = this.minDate;
  5117. }
  5118. } else {
  5119. this.maxDate = Object(date_util_["modifyDate"])(this.maxDate, parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
  5120. if (this.maxDate < this.minDate) {
  5121. this.minDate = this.maxDate;
  5122. }
  5123. }
  5124. }
  5125. },
  5126. handleTimeInput: function handleTimeInput(value, type) {
  5127. var _this4 = this;
  5128. this.timeUserInput[type] = value;
  5129. if (value.length !== this.timeFormat.length) return;
  5130. var parsedValue = Object(date_util_["parseDate"])(value, this.timeFormat);
  5131. if (parsedValue) {
  5132. if (type === 'min') {
  5133. this.minDate = Object(date_util_["modifyTime"])(this.minDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
  5134. this.$nextTick(function (_) {
  5135. return _this4.$refs.minTimePicker.adjustSpinners();
  5136. });
  5137. } else {
  5138. this.maxDate = Object(date_util_["modifyTime"])(this.maxDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
  5139. this.$nextTick(function (_) {
  5140. return _this4.$refs.maxTimePicker.adjustSpinners();
  5141. });
  5142. }
  5143. }
  5144. },
  5145. handleTimeChange: function handleTimeChange(value, type) {
  5146. var parsedValue = Object(date_util_["parseDate"])(value, this.timeFormat);
  5147. if (parsedValue) {
  5148. if (type === 'min') {
  5149. this.minDate = Object(date_util_["modifyTime"])(this.minDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
  5150. if (this.minDate > this.maxDate) {
  5151. this.maxDate = this.minDate;
  5152. }
  5153. this.$refs.minTimePicker.value = this.minDate;
  5154. this.minTimePickerVisible = false;
  5155. } else {
  5156. this.maxDate = Object(date_util_["modifyTime"])(this.maxDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
  5157. if (this.maxDate < this.minDate) {
  5158. this.minDate = this.maxDate;
  5159. }
  5160. this.$refs.maxTimePicker.value = this.minDate;
  5161. this.maxTimePickerVisible = false;
  5162. }
  5163. }
  5164. },
  5165. handleRangePick: function handleRangePick(val) {
  5166. var _this5 = this;
  5167. var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  5168. var defaultTime = this.defaultTime || [];
  5169. var minDate = Object(date_util_["modifyWithTimeString"])(val.minDate, defaultTime[0]);
  5170. var maxDate = Object(date_util_["modifyWithTimeString"])(val.maxDate, defaultTime[1]);
  5171. if (this.maxDate === maxDate && this.minDate === minDate) {
  5172. return;
  5173. }
  5174. this.onPick && this.onPick(val);
  5175. this.maxDate = maxDate;
  5176. this.minDate = minDate;
  5177. // workaround for https://github.com/ElemeFE/element/issues/7539, should remove this block when we don't have to care about Chromium 55 - 57
  5178. setTimeout(function () {
  5179. _this5.maxDate = maxDate;
  5180. _this5.minDate = minDate;
  5181. }, 10);
  5182. if (!close || this.showTime) return;
  5183. this.handleConfirm();
  5184. },
  5185. handleShortcutClick: function handleShortcutClick(shortcut) {
  5186. if (shortcut.onClick) {
  5187. shortcut.onClick(this);
  5188. }
  5189. },
  5190. handleMinTimePick: function handleMinTimePick(value, visible, first) {
  5191. this.minDate = this.minDate || new Date();
  5192. if (value) {
  5193. this.minDate = Object(date_util_["modifyTime"])(this.minDate, value.getHours(), value.getMinutes(), value.getSeconds());
  5194. }
  5195. if (!first) {
  5196. this.minTimePickerVisible = visible;
  5197. }
  5198. if (!this.maxDate || this.maxDate && this.maxDate.getTime() < this.minDate.getTime()) {
  5199. this.maxDate = new Date(this.minDate);
  5200. }
  5201. },
  5202. handleMinTimeClose: function handleMinTimeClose() {
  5203. this.minTimePickerVisible = false;
  5204. },
  5205. handleMaxTimePick: function handleMaxTimePick(value, visible, first) {
  5206. if (this.maxDate && value) {
  5207. this.maxDate = Object(date_util_["modifyTime"])(this.maxDate, value.getHours(), value.getMinutes(), value.getSeconds());
  5208. }
  5209. if (!first) {
  5210. this.maxTimePickerVisible = visible;
  5211. }
  5212. if (this.maxDate && this.minDate && this.minDate.getTime() > this.maxDate.getTime()) {
  5213. this.minDate = new Date(this.maxDate);
  5214. }
  5215. },
  5216. handleMaxTimeClose: function handleMaxTimeClose() {
  5217. this.maxTimePickerVisible = false;
  5218. },
  5219. // leftPrev*, rightNext* need to take care of `unlinkPanels`
  5220. leftPrevYear: function leftPrevYear() {
  5221. this.leftDate = Object(date_util_["prevYear"])(this.leftDate);
  5222. if (!this.unlinkPanels) {
  5223. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5224. }
  5225. },
  5226. leftPrevMonth: function leftPrevMonth() {
  5227. this.leftDate = Object(date_util_["prevMonth"])(this.leftDate);
  5228. if (!this.unlinkPanels) {
  5229. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5230. }
  5231. },
  5232. rightNextYear: function rightNextYear() {
  5233. if (!this.unlinkPanels) {
  5234. this.leftDate = Object(date_util_["nextYear"])(this.leftDate);
  5235. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5236. } else {
  5237. this.rightDate = Object(date_util_["nextYear"])(this.rightDate);
  5238. }
  5239. },
  5240. rightNextMonth: function rightNextMonth() {
  5241. if (!this.unlinkPanels) {
  5242. this.leftDate = Object(date_util_["nextMonth"])(this.leftDate);
  5243. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5244. } else {
  5245. this.rightDate = Object(date_util_["nextMonth"])(this.rightDate);
  5246. }
  5247. },
  5248. // leftNext*, rightPrev* are called when `unlinkPanels` is true
  5249. leftNextYear: function leftNextYear() {
  5250. this.leftDate = Object(date_util_["nextYear"])(this.leftDate);
  5251. },
  5252. leftNextMonth: function leftNextMonth() {
  5253. this.leftDate = Object(date_util_["nextMonth"])(this.leftDate);
  5254. },
  5255. rightPrevYear: function rightPrevYear() {
  5256. this.rightDate = Object(date_util_["prevYear"])(this.rightDate);
  5257. },
  5258. rightPrevMonth: function rightPrevMonth() {
  5259. this.rightDate = Object(date_util_["prevMonth"])(this.rightDate);
  5260. },
  5261. handleConfirm: function handleConfirm() {
  5262. var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5263. if (this.isValidValue([this.minDate, this.maxDate])) {
  5264. this.$emit('pick', [this.minDate, this.maxDate], visible);
  5265. }
  5266. },
  5267. isValidValue: function isValidValue(value) {
  5268. return Array.isArray(value) && value && value[0] && value[1] && Object(date_util_["isDate"])(value[0]) && Object(date_util_["isDate"])(value[1]) && value[0].getTime() <= value[1].getTime() && (typeof this.disabledDate === 'function' ? !this.disabledDate(value[0]) && !this.disabledDate(value[1]) : true);
  5269. },
  5270. resetView: function resetView() {
  5271. // NOTE: this is a hack to reset {min, max}Date on picker open.
  5272. // TODO: correct way of doing so is to refactor {min, max}Date to be dependent on value and internal selection state
  5273. // an alternative would be resetView whenever picker becomes visible, should also investigate date-panel's resetView
  5274. if (this.minDate && this.maxDate == null) this.rangeState.selecting = false;
  5275. this.minDate = this.value && Object(date_util_["isDate"])(this.value[0]) ? new Date(this.value[0]) : null;
  5276. this.maxDate = this.value && Object(date_util_["isDate"])(this.value[0]) ? new Date(this.value[1]) : null;
  5277. }
  5278. },
  5279. components: { TimePicker: panel_time["a" /* default */], DateTable: date_table, ElInput: input_default.a, ElButton: button_default.a }
  5280. });
  5281. // CONCATENATED MODULE: ./packages/date-picker/src/panel/date-range.vue?vue&type=script&lang=js&
  5282. /* harmony default export */ var panel_date_rangevue_type_script_lang_js_ = (date_rangevue_type_script_lang_js_);
  5283. // CONCATENATED MODULE: ./packages/date-picker/src/panel/date-range.vue
  5284. /* normalize component */
  5285. var date_range_component = Object(componentNormalizer["a" /* default */])(
  5286. panel_date_rangevue_type_script_lang_js_,
  5287. date_rangevue_type_template_id_2652849a_render,
  5288. date_rangevue_type_template_id_2652849a_staticRenderFns,
  5289. false,
  5290. null,
  5291. null,
  5292. null
  5293. )
  5294. /* hot reload */
  5295. if (false) { var date_range_api; }
  5296. date_range_component.options.__file = "packages/date-picker/src/panel/date-range.vue"
  5297. /* harmony default export */ var date_range = (date_range_component.exports);
  5298. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/month-range.vue?vue&type=template&id=f2645fb8&
  5299. var month_rangevue_type_template_id_f2645fb8_render = function() {
  5300. var _vm = this
  5301. var _h = _vm.$createElement
  5302. var _c = _vm._self._c || _h
  5303. return _c(
  5304. "transition",
  5305. {
  5306. attrs: { name: "el-zoom-in-top" },
  5307. on: {
  5308. "after-leave": function($event) {
  5309. _vm.$emit("dodestroy")
  5310. }
  5311. }
  5312. },
  5313. [
  5314. _c(
  5315. "div",
  5316. {
  5317. directives: [
  5318. {
  5319. name: "show",
  5320. rawName: "v-show",
  5321. value: _vm.visible,
  5322. expression: "visible"
  5323. }
  5324. ],
  5325. staticClass: "el-picker-panel el-date-range-picker el-popper",
  5326. class: [
  5327. {
  5328. "has-sidebar": _vm.$slots.sidebar || _vm.shortcuts
  5329. },
  5330. _vm.popperClass
  5331. ]
  5332. },
  5333. [
  5334. _c(
  5335. "div",
  5336. { staticClass: "el-picker-panel__body-wrapper" },
  5337. [
  5338. _vm._t("sidebar"),
  5339. _vm.shortcuts
  5340. ? _c(
  5341. "div",
  5342. { staticClass: "el-picker-panel__sidebar" },
  5343. _vm._l(_vm.shortcuts, function(shortcut, key) {
  5344. return _c(
  5345. "button",
  5346. {
  5347. key: key,
  5348. staticClass: "el-picker-panel__shortcut",
  5349. attrs: { type: "button" },
  5350. on: {
  5351. click: function($event) {
  5352. _vm.handleShortcutClick(shortcut)
  5353. }
  5354. }
  5355. },
  5356. [_vm._v(_vm._s(shortcut.text))]
  5357. )
  5358. }),
  5359. 0
  5360. )
  5361. : _vm._e(),
  5362. _c("div", { staticClass: "el-picker-panel__body" }, [
  5363. _c(
  5364. "div",
  5365. {
  5366. staticClass:
  5367. "el-picker-panel__content el-date-range-picker__content is-left"
  5368. },
  5369. [
  5370. _c("div", { staticClass: "el-date-range-picker__header" }, [
  5371. _c("button", {
  5372. staticClass:
  5373. "el-picker-panel__icon-btn el-icon-d-arrow-left",
  5374. attrs: { type: "button" },
  5375. on: { click: _vm.leftPrevYear }
  5376. }),
  5377. _vm.unlinkPanels
  5378. ? _c("button", {
  5379. staticClass:
  5380. "el-picker-panel__icon-btn el-icon-d-arrow-right",
  5381. class: { "is-disabled": !_vm.enableYearArrow },
  5382. attrs: {
  5383. type: "button",
  5384. disabled: !_vm.enableYearArrow
  5385. },
  5386. on: { click: _vm.leftNextYear }
  5387. })
  5388. : _vm._e(),
  5389. _c("div", [_vm._v(_vm._s(_vm.leftLabel))])
  5390. ]),
  5391. _c("month-table", {
  5392. attrs: {
  5393. "selection-mode": "range",
  5394. date: _vm.leftDate,
  5395. "default-value": _vm.defaultValue,
  5396. "min-date": _vm.minDate,
  5397. "max-date": _vm.maxDate,
  5398. "range-state": _vm.rangeState,
  5399. "disabled-date": _vm.disabledDate
  5400. },
  5401. on: {
  5402. changerange: _vm.handleChangeRange,
  5403. pick: _vm.handleRangePick
  5404. }
  5405. })
  5406. ],
  5407. 1
  5408. ),
  5409. _c(
  5410. "div",
  5411. {
  5412. staticClass:
  5413. "el-picker-panel__content el-date-range-picker__content is-right"
  5414. },
  5415. [
  5416. _c("div", { staticClass: "el-date-range-picker__header" }, [
  5417. _vm.unlinkPanels
  5418. ? _c("button", {
  5419. staticClass:
  5420. "el-picker-panel__icon-btn el-icon-d-arrow-left",
  5421. class: { "is-disabled": !_vm.enableYearArrow },
  5422. attrs: {
  5423. type: "button",
  5424. disabled: !_vm.enableYearArrow
  5425. },
  5426. on: { click: _vm.rightPrevYear }
  5427. })
  5428. : _vm._e(),
  5429. _c("button", {
  5430. staticClass:
  5431. "el-picker-panel__icon-btn el-icon-d-arrow-right",
  5432. attrs: { type: "button" },
  5433. on: { click: _vm.rightNextYear }
  5434. }),
  5435. _c("div", [_vm._v(_vm._s(_vm.rightLabel))])
  5436. ]),
  5437. _c("month-table", {
  5438. attrs: {
  5439. "selection-mode": "range",
  5440. date: _vm.rightDate,
  5441. "default-value": _vm.defaultValue,
  5442. "min-date": _vm.minDate,
  5443. "max-date": _vm.maxDate,
  5444. "range-state": _vm.rangeState,
  5445. "disabled-date": _vm.disabledDate
  5446. },
  5447. on: {
  5448. changerange: _vm.handleChangeRange,
  5449. pick: _vm.handleRangePick
  5450. }
  5451. })
  5452. ],
  5453. 1
  5454. )
  5455. ])
  5456. ],
  5457. 2
  5458. )
  5459. ]
  5460. )
  5461. ]
  5462. )
  5463. }
  5464. var month_rangevue_type_template_id_f2645fb8_staticRenderFns = []
  5465. month_rangevue_type_template_id_f2645fb8_render._withStripped = true
  5466. // CONCATENATED MODULE: ./packages/date-picker/src/panel/month-range.vue?vue&type=template&id=f2645fb8&
  5467. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/month-range.vue?vue&type=script&lang=js&
  5468. //
  5469. //
  5470. //
  5471. //
  5472. //
  5473. //
  5474. //
  5475. //
  5476. //
  5477. //
  5478. //
  5479. //
  5480. //
  5481. //
  5482. //
  5483. //
  5484. //
  5485. //
  5486. //
  5487. //
  5488. //
  5489. //
  5490. //
  5491. //
  5492. //
  5493. //
  5494. //
  5495. //
  5496. //
  5497. //
  5498. //
  5499. //
  5500. //
  5501. //
  5502. //
  5503. //
  5504. //
  5505. //
  5506. //
  5507. //
  5508. //
  5509. //
  5510. //
  5511. //
  5512. //
  5513. //
  5514. //
  5515. //
  5516. //
  5517. //
  5518. //
  5519. //
  5520. //
  5521. //
  5522. //
  5523. //
  5524. //
  5525. //
  5526. //
  5527. //
  5528. //
  5529. //
  5530. //
  5531. //
  5532. //
  5533. //
  5534. //
  5535. //
  5536. //
  5537. //
  5538. //
  5539. //
  5540. //
  5541. //
  5542. //
  5543. //
  5544. //
  5545. //
  5546. //
  5547. var month_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultValue(defaultValue) {
  5548. if (Array.isArray(defaultValue)) {
  5549. return [new Date(defaultValue[0]), new Date(defaultValue[1])];
  5550. } else if (defaultValue) {
  5551. return [new Date(defaultValue), Object(date_util_["nextMonth"])(new Date(defaultValue))];
  5552. } else {
  5553. return [new Date(), Object(date_util_["nextMonth"])(new Date())];
  5554. }
  5555. };
  5556. /* harmony default export */ var month_rangevue_type_script_lang_js_ = ({
  5557. mixins: [locale_default.a],
  5558. directives: { Clickoutside: clickoutside_default.a },
  5559. computed: {
  5560. btnDisabled: function btnDisabled() {
  5561. return !(this.minDate && this.maxDate && !this.selecting && this.isValidValue([this.minDate, this.maxDate]));
  5562. },
  5563. leftLabel: function leftLabel() {
  5564. return this.leftDate.getFullYear() + ' ' + this.t('el.datepicker.year');
  5565. },
  5566. rightLabel: function rightLabel() {
  5567. return this.rightDate.getFullYear() + ' ' + this.t('el.datepicker.year');
  5568. },
  5569. leftYear: function leftYear() {
  5570. return this.leftDate.getFullYear();
  5571. },
  5572. rightYear: function rightYear() {
  5573. return this.rightDate.getFullYear() === this.leftDate.getFullYear() ? this.leftDate.getFullYear() + 1 : this.rightDate.getFullYear();
  5574. },
  5575. enableYearArrow: function enableYearArrow() {
  5576. return this.unlinkPanels && this.rightYear > this.leftYear + 1;
  5577. }
  5578. },
  5579. data: function data() {
  5580. return {
  5581. popperClass: '',
  5582. value: [],
  5583. defaultValue: null,
  5584. defaultTime: null,
  5585. minDate: '',
  5586. maxDate: '',
  5587. leftDate: new Date(),
  5588. rightDate: Object(date_util_["nextYear"])(new Date()),
  5589. rangeState: {
  5590. endDate: null,
  5591. selecting: false,
  5592. row: null,
  5593. column: null
  5594. },
  5595. shortcuts: '',
  5596. visible: '',
  5597. disabledDate: '',
  5598. format: '',
  5599. arrowControl: false,
  5600. unlinkPanels: false
  5601. };
  5602. },
  5603. watch: {
  5604. value: function value(newVal) {
  5605. if (!newVal) {
  5606. this.minDate = null;
  5607. this.maxDate = null;
  5608. } else if (Array.isArray(newVal)) {
  5609. this.minDate = Object(date_util_["isDate"])(newVal[0]) ? new Date(newVal[0]) : null;
  5610. this.maxDate = Object(date_util_["isDate"])(newVal[1]) ? new Date(newVal[1]) : null;
  5611. if (this.minDate) {
  5612. this.leftDate = this.minDate;
  5613. if (this.unlinkPanels && this.maxDate) {
  5614. var minDateYear = this.minDate.getFullYear();
  5615. var maxDateYear = this.maxDate.getFullYear();
  5616. this.rightDate = minDateYear === maxDateYear ? Object(date_util_["nextYear"])(this.maxDate) : this.maxDate;
  5617. } else {
  5618. this.rightDate = Object(date_util_["nextYear"])(this.leftDate);
  5619. }
  5620. } else {
  5621. this.leftDate = month_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
  5622. this.rightDate = Object(date_util_["nextYear"])(this.leftDate);
  5623. }
  5624. }
  5625. },
  5626. defaultValue: function defaultValue(val) {
  5627. if (!Array.isArray(this.value)) {
  5628. var _calcDefaultValue = month_rangevue_type_script_lang_js_calcDefaultValue(val),
  5629. left = _calcDefaultValue[0],
  5630. right = _calcDefaultValue[1];
  5631. this.leftDate = left;
  5632. this.rightDate = val && val[1] && left.getFullYear() !== right.getFullYear() && this.unlinkPanels ? right : Object(date_util_["nextYear"])(this.leftDate);
  5633. }
  5634. }
  5635. },
  5636. methods: {
  5637. handleClear: function handleClear() {
  5638. this.minDate = null;
  5639. this.maxDate = null;
  5640. this.leftDate = month_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
  5641. this.rightDate = Object(date_util_["nextYear"])(this.leftDate);
  5642. this.$emit('pick', null);
  5643. },
  5644. handleChangeRange: function handleChangeRange(val) {
  5645. this.minDate = val.minDate;
  5646. this.maxDate = val.maxDate;
  5647. this.rangeState = val.rangeState;
  5648. },
  5649. handleRangePick: function handleRangePick(val) {
  5650. var _this = this;
  5651. var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  5652. var defaultTime = this.defaultTime || [];
  5653. var minDate = Object(date_util_["modifyWithTimeString"])(val.minDate, defaultTime[0]);
  5654. var maxDate = Object(date_util_["modifyWithTimeString"])(val.maxDate, defaultTime[1]);
  5655. if (this.maxDate === maxDate && this.minDate === minDate) {
  5656. return;
  5657. }
  5658. this.onPick && this.onPick(val);
  5659. this.maxDate = maxDate;
  5660. this.minDate = minDate;
  5661. // workaround for https://github.com/ElemeFE/element/issues/7539, should remove this block when we don't have to care about Chromium 55 - 57
  5662. setTimeout(function () {
  5663. _this.maxDate = maxDate;
  5664. _this.minDate = minDate;
  5665. }, 10);
  5666. if (!close) return;
  5667. this.handleConfirm();
  5668. },
  5669. handleShortcutClick: function handleShortcutClick(shortcut) {
  5670. if (shortcut.onClick) {
  5671. shortcut.onClick(this);
  5672. }
  5673. },
  5674. // leftPrev*, rightNext* need to take care of `unlinkPanels`
  5675. leftPrevYear: function leftPrevYear() {
  5676. this.leftDate = Object(date_util_["prevYear"])(this.leftDate);
  5677. if (!this.unlinkPanels) {
  5678. this.rightDate = Object(date_util_["prevYear"])(this.rightDate);
  5679. }
  5680. },
  5681. rightNextYear: function rightNextYear() {
  5682. if (!this.unlinkPanels) {
  5683. this.leftDate = Object(date_util_["nextYear"])(this.leftDate);
  5684. }
  5685. this.rightDate = Object(date_util_["nextYear"])(this.rightDate);
  5686. },
  5687. // leftNext*, rightPrev* are called when `unlinkPanels` is true
  5688. leftNextYear: function leftNextYear() {
  5689. this.leftDate = Object(date_util_["nextYear"])(this.leftDate);
  5690. },
  5691. rightPrevYear: function rightPrevYear() {
  5692. this.rightDate = Object(date_util_["prevYear"])(this.rightDate);
  5693. },
  5694. handleConfirm: function handleConfirm() {
  5695. var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5696. if (this.isValidValue([this.minDate, this.maxDate])) {
  5697. this.$emit('pick', [this.minDate, this.maxDate], visible);
  5698. }
  5699. },
  5700. isValidValue: function isValidValue(value) {
  5701. return Array.isArray(value) && value && value[0] && value[1] && Object(date_util_["isDate"])(value[0]) && Object(date_util_["isDate"])(value[1]) && value[0].getTime() <= value[1].getTime() && (typeof this.disabledDate === 'function' ? !this.disabledDate(value[0]) && !this.disabledDate(value[1]) : true);
  5702. },
  5703. resetView: function resetView() {
  5704. // NOTE: this is a hack to reset {min, max}Date on picker open.
  5705. // TODO: correct way of doing so is to refactor {min, max}Date to be dependent on value and internal selection state
  5706. // an alternative would be resetView whenever picker becomes visible, should also investigate date-panel's resetView
  5707. this.minDate = this.value && Object(date_util_["isDate"])(this.value[0]) ? new Date(this.value[0]) : null;
  5708. this.maxDate = this.value && Object(date_util_["isDate"])(this.value[0]) ? new Date(this.value[1]) : null;
  5709. }
  5710. },
  5711. components: { MonthTable: month_table, ElInput: input_default.a, ElButton: button_default.a }
  5712. });
  5713. // CONCATENATED MODULE: ./packages/date-picker/src/panel/month-range.vue?vue&type=script&lang=js&
  5714. /* harmony default export */ var panel_month_rangevue_type_script_lang_js_ = (month_rangevue_type_script_lang_js_);
  5715. // CONCATENATED MODULE: ./packages/date-picker/src/panel/month-range.vue
  5716. /* normalize component */
  5717. var month_range_component = Object(componentNormalizer["a" /* default */])(
  5718. panel_month_rangevue_type_script_lang_js_,
  5719. month_rangevue_type_template_id_f2645fb8_render,
  5720. month_rangevue_type_template_id_f2645fb8_staticRenderFns,
  5721. false,
  5722. null,
  5723. null,
  5724. null
  5725. )
  5726. /* hot reload */
  5727. if (false) { var month_range_api; }
  5728. month_range_component.options.__file = "packages/date-picker/src/panel/month-range.vue"
  5729. /* harmony default export */ var month_range = (month_range_component.exports);
  5730. // CONCATENATED MODULE: ./packages/date-picker/src/picker/date-picker.js
  5731. var date_picker_getPanel = function getPanel(type) {
  5732. if (type === 'daterange' || type === 'datetimerange') {
  5733. return date_range;
  5734. } else if (type === 'monthrange') {
  5735. return month_range;
  5736. }
  5737. return panel_date;
  5738. };
  5739. /* harmony default export */ var date_picker = ({
  5740. mixins: [picker["a" /* default */]],
  5741. name: 'ElDatePicker',
  5742. props: {
  5743. type: {
  5744. type: String,
  5745. default: 'date'
  5746. },
  5747. timeArrowControl: Boolean
  5748. },
  5749. watch: {
  5750. type: function type(_type) {
  5751. if (this.picker) {
  5752. this.unmountPicker();
  5753. this.panel = date_picker_getPanel(_type);
  5754. this.mountPicker();
  5755. } else {
  5756. this.panel = date_picker_getPanel(_type);
  5757. }
  5758. }
  5759. },
  5760. created: function created() {
  5761. this.panel = date_picker_getPanel(this.type);
  5762. }
  5763. });
  5764. // CONCATENATED MODULE: ./packages/date-picker/index.js
  5765. /* istanbul ignore next */
  5766. date_picker.install = function install(Vue) {
  5767. Vue.component(date_picker.name, date_picker);
  5768. };
  5769. /* harmony default export */ var packages_date_picker = __webpack_exports__["default"] = (date_picker);
  5770. /***/ })
  5771. /******/ ]);