12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941 |
- module.exports =
- /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId])
- /******/ return installedModules[moduleId].exports;
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ exports: {},
- /******/ id: moduleId,
- /******/ loaded: false
- /******/ };
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/ // Flag the module as loaded
- /******/ module.loaded = true;
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "/dist/";
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(0);
- /******/ })
- /************************************************************************/
- /******/ ([
- /* 0 */
- /***/ function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(100);
- /***/ },
- /* 1 */,
- /* 2 */,
- /* 3 */
- /***/ function(module, exports) {
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- scopeId,
- cssModules
- ) {
- var esModule
- var scriptExports = rawScriptExports = rawScriptExports || {}
- // ES6 modules interop
- var type = typeof rawScriptExports.default
- if (type === 'object' || type === 'function') {
- esModule = rawScriptExports
- scriptExports = rawScriptExports.default
- }
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
- // render functions
- if (compiledTemplate) {
- options.render = compiledTemplate.render
- options.staticRenderFns = compiledTemplate.staticRenderFns
- }
- // scopedId
- if (scopeId) {
- options._scopeId = scopeId
- }
- // inject cssModules
- if (cssModules) {
- var computed = options.computed || (options.computed = {})
- Object.keys(cssModules).forEach(function (key) {
- var module = cssModules[key]
- computed[key] = function () { return module }
- })
- }
- return {
- esModule: esModule,
- exports: scriptExports,
- options: options
- }
- }
- /***/ },
- /* 4 */,
- /* 5 */,
- /* 6 */,
- /* 7 */,
- /* 8 */,
- /* 9 */
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/input");
- /***/ },
- /* 10 */
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/utils/clickoutside");
- /***/ },
- /* 11 */,
- /* 12 */,
- /* 13 */
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/utils/vue-popper");
- /***/ },
- /* 14 */
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/mixins/emitter");
- /***/ },
- /* 15 */
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/scrollbar");
- /***/ },
- /* 16 */,
- /* 17 */,
- /* 18 */,
- /* 19 */,
- /* 20 */,
- /* 21 */,
- /* 22 */,
- /* 23 */,
- /* 24 */,
- /* 25 */,
- /* 26 */,
- /* 27 */,
- /* 28 */,
- /* 29 */,
- /* 30 */,
- /* 31 */,
- /* 32 */,
- /* 33 */,
- /* 34 */,
- /* 35 */,
- /* 36 */,
- /* 37 */,
- /* 38 */,
- /* 39 */,
- /* 40 */,
- /* 41 */,
- /* 42 */,
- /* 43 */,
- /* 44 */,
- /* 45 */,
- /* 46 */,
- /* 47 */,
- /* 48 */,
- /* 49 */,
- /* 50 */,
- /* 51 */,
- /* 52 */,
- /* 53 */,
- /* 54 */,
- /* 55 */,
- /* 56 */
- /***/ function(module, exports) {
- module.exports = require("vue");
- /***/ },
- /* 57 */,
- /* 58 */,
- /* 59 */,
- /* 60 */
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/mixins/locale");
- /***/ },
- /* 61 */,
- /* 62 */,
- /* 63 */,
- /* 64 */,
- /* 65 */,
- /* 66 */,
- /* 67 */,
- /* 68 */,
- /* 69 */,
- /* 70 */,
- /* 71 */,
- /* 72 */,
- /* 73 */,
- /* 74 */,
- /* 75 */,
- /* 76 */,
- /* 77 */,
- /* 78 */,
- /* 79 */,
- /* 80 */,
- /* 81 */,
- /* 82 */,
- /* 83 */,
- /* 84 */,
- /* 85 */,
- /* 86 */,
- /* 87 */,
- /* 88 */,
- /* 89 */,
- /* 90 */,
- /* 91 */,
- /* 92 */,
- /* 93 */,
- /* 94 */,
- /* 95 */,
- /* 96 */,
- /* 97 */,
- /* 98 */,
- /* 99 */,
- /* 100 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _datePicker = __webpack_require__(101);
- var _datePicker2 = _interopRequireDefault(_datePicker);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- /* istanbul ignore next */
- _datePicker2.default.install = function install(Vue) {
- Vue.component(_datePicker2.default.name, _datePicker2.default);
- };
- exports.default = _datePicker2.default;
- /***/ },
- /* 101 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _picker = __webpack_require__(102);
- var _picker2 = _interopRequireDefault(_picker);
- var _date = __webpack_require__(107);
- var _date2 = _interopRequireDefault(_date);
- var _dateRange = __webpack_require__(126);
- var _dateRange2 = _interopRequireDefault(_dateRange);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var getPanel = function getPanel(type) {
- if (type === 'daterange' || type === 'datetimerange') {
- return _dateRange2.default;
- }
- return _date2.default;
- };
- exports.default = {
- mixins: [_picker2.default],
- name: 'ElDatePicker',
- props: {
- type: {
- type: String,
- default: 'date'
- }
- },
- created: function created() {
- this.panel = getPanel(this.type);
- }
- };
- /***/ },
- /* 102 */
- /***/ function(module, exports, __webpack_require__) {
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(103),
- /* template */
- __webpack_require__(106),
- /* scopeId */
- null,
- /* cssModules */
- null
- )
- module.exports = Component.exports
- /***/ },
- /* 103 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _vue = __webpack_require__(56);
- var _vue2 = _interopRequireDefault(_vue);
- var _clickoutside = __webpack_require__(10);
- var _clickoutside2 = _interopRequireDefault(_clickoutside);
- var _util = __webpack_require__(104);
- var _vuePopper = __webpack_require__(13);
- var _vuePopper2 = _interopRequireDefault(_vuePopper);
- var _emitter = __webpack_require__(14);
- var _emitter2 = _interopRequireDefault(_emitter);
- var _input = __webpack_require__(9);
- var _input2 = _interopRequireDefault(_input);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- var NewPopper = {
- props: {
- appendToBody: _vuePopper2.default.props.appendToBody,
- offset: _vuePopper2.default.props.offset,
- boundariesPadding: _vuePopper2.default.props.boundariesPadding
- },
- methods: _vuePopper2.default.methods,
- data: _vuePopper2.default.data,
- beforeDestroy: _vuePopper2.default.beforeDestroy
- };
- var DEFAULT_FORMATS = {
- date: 'yyyy-MM-dd',
- month: 'yyyy-MM',
- datetime: 'yyyy-MM-dd HH:mm:ss',
- time: 'HH:mm:ss',
- week: 'yyyywWW',
- timerange: 'HH:mm:ss',
- daterange: 'yyyy-MM-dd',
- datetimerange: 'yyyy-MM-dd HH:mm:ss',
- year: 'yyyy'
- };
- var HAVE_TRIGGER_TYPES = ['date', 'datetime', 'time', 'time-select', 'week', 'month', 'year', 'daterange', 'timerange', 'datetimerange'];
- var DATE_FORMATTER = function DATE_FORMATTER(value, format) {
- return (0, _util.formatDate)(value, format);
- };
- var DATE_PARSER = function DATE_PARSER(text, format) {
- return (0, _util.parseDate)(text, format);
- };
- var RANGE_FORMATTER = function RANGE_FORMATTER(value, format, separator) {
- if (Array.isArray(value) && value.length === 2) {
- var start = value[0];
- var end = value[1];
- if (start && end) {
- return (0, _util.formatDate)(start, format) + separator + (0, _util.formatDate)(end, format);
- }
- }
- return '';
- };
- var RANGE_PARSER = function RANGE_PARSER(text, format, separator) {
- var array = text.split(separator);
- if (array.length === 2) {
- var range1 = array[0];
- var range2 = array[1];
- return [(0, _util.parseDate)(range1, format), (0, _util.parseDate)(range2, format)];
- }
- return [];
- };
- var TYPE_VALUE_RESOLVER_MAP = {
- default: {
- formatter: function formatter(value) {
- if (!value) return '';
- return '' + value;
- },
- parser: function parser(text) {
- if (text === undefined || text === '') return null;
- return text;
- }
- },
- week: {
- formatter: function formatter(value, format) {
- var date = (0, _util.formatDate)(value, format);
- var week = (0, _util.getWeekNumber)(value);
- date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? '0' + week : week) : date.replace(/W/, week);
- return date;
- },
- parser: function parser(text) {
- var array = (text || '').split('w');
- if (array.length === 2) {
- var year = Number(array[0]);
- var month = Number(array[1]);
- if (!isNaN(year) && !isNaN(month) && month < 54) {
- return text;
- }
- }
- return null;
- }
- },
- date: {
- formatter: DATE_FORMATTER,
- parser: DATE_PARSER
- },
- datetime: {
- formatter: DATE_FORMATTER,
- parser: DATE_PARSER
- },
- daterange: {
- formatter: RANGE_FORMATTER,
- parser: RANGE_PARSER
- },
- datetimerange: {
- formatter: RANGE_FORMATTER,
- parser: RANGE_PARSER
- },
- timerange: {
- formatter: RANGE_FORMATTER,
- parser: RANGE_PARSER
- },
- time: {
- formatter: DATE_FORMATTER,
- parser: DATE_PARSER
- },
- month: {
- formatter: DATE_FORMATTER,
- parser: DATE_PARSER
- },
- year: {
- formatter: DATE_FORMATTER,
- parser: DATE_PARSER
- },
- number: {
- formatter: function formatter(value) {
- if (!value) return '';
- return '' + value;
- },
- parser: function parser(text) {
- var result = Number(text);
- if (!isNaN(text)) {
- return result;
- } else {
- return null;
- }
- }
- }
- };
- var PLACEMENT_MAP = {
- left: 'bottom-start',
- center: 'bottom-center',
- right: 'bottom-end'
- };
- exports.default = {
- mixins: [_emitter2.default, NewPopper],
- props: {
- size: String,
- format: String,
- readonly: Boolean,
- placeholder: String,
- disabled: Boolean,
- clearable: {
- type: Boolean,
- default: true
- },
- popperClass: String,
- editable: {
- type: Boolean,
- default: true
- },
- align: {
- type: String,
- default: 'left'
- },
- value: {},
- rangeSeparator: {
- default: ' - '
- },
- pickerOptions: {}
- },
- components: { ElInput: _input2.default },
- directives: { Clickoutside: _clickoutside2.default },
- data: function data() {
- return {
- pickerVisible: false,
- showClose: false,
- currentValue: ''
- };
- },
- watch: {
- pickerVisible: function pickerVisible(val) {
- if (!val) this.dispatch('ElFormItem', 'el.form.blur');
- if (this.readonly || this.disabled) return;
- val ? this.showPicker() : this.hidePicker();
- },
- currentValue: function currentValue(val) {
- if (val) return;
- if (this.picker && typeof this.picker.handleClear === 'function') {
- this.picker.handleClear();
- } else {
- this.$emit('input');
- }
- },
- value: {
- immediate: true,
- handler: function handler(val) {
- this.currentValue = (0, _util.isDate)(val) ? new Date(val) : val;
- }
- },
- displayValue: function displayValue(val) {
- this.$emit('change', val);
- this.dispatch('ElFormItem', 'el.form.change');
- }
- },
- computed: {
- reference: function reference() {
- return this.$refs.reference.$el;
- },
- refInput: function refInput() {
- if (this.reference) return this.reference.querySelector('input');
- return {};
- },
- valueIsEmpty: function valueIsEmpty() {
- var val = this.currentValue;
- if (Array.isArray(val)) {
- for (var i = 0, len = val.length; i < len; i++) {
- if (val[i]) {
- return false;
- }
- }
- } else {
- if (val) {
- return false;
- }
- }
- return true;
- },
- triggerClass: function triggerClass() {
- return this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date';
- },
- selectionMode: function selectionMode() {
- if (this.type === 'week') {
- return 'week';
- } else if (this.type === 'month') {
- return 'month';
- } else if (this.type === 'year') {
- return 'year';
- }
- return 'day';
- },
- haveTrigger: function haveTrigger() {
- if (typeof this.showTrigger !== 'undefined') {
- return this.showTrigger;
- }
- return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
- },
- displayValue: {
- get: function get() {
- var value = this.currentValue;
- if (!value) return;
- var formatter = (TYPE_VALUE_RESOLVER_MAP[this.type] || TYPE_VALUE_RESOLVER_MAP['default']).formatter;
- var format = DEFAULT_FORMATS[this.type];
- return formatter(value, this.format || format, this.rangeSeparator);
- },
- set: function set(value) {
- if (value) {
- var type = this.type;
- var parser = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).parser;
- var parsedValue = parser(value, this.format || DEFAULT_FORMATS[type], this.rangeSeparator);
- if (parsedValue && this.picker) {
- this.picker.value = parsedValue;
- }
- } else {
- this.picker.value = value;
- }
- this.$forceUpdate();
- }
- }
- },
- created: function created() {
- // vue-popper
- this.popperOptions = {
- boundariesPadding: 0,
- gpuAcceleration: false
- };
- this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
- },
- methods: {
- handleMouseEnterIcon: function handleMouseEnterIcon() {
- if (this.readonly || this.disabled) return;
- if (!this.valueIsEmpty && this.clearable) {
- this.showClose = true;
- }
- },
- handleClickIcon: function handleClickIcon() {
- if (this.readonly || this.disabled) return;
- if (this.showClose) {
- this.currentValue = '';
- this.showClose = false;
- } else {
- this.pickerVisible = !this.pickerVisible;
- }
- },
- dateChanged: function dateChanged(dateA, dateB) {
- if (Array.isArray(dateA)) {
- var len = dateA.length;
- if (!dateB) return true;
- while (len--) {
- if (!(0, _util.equalDate)(dateA[len], dateB[len])) return true;
- }
- } else {
- if (!(0, _util.equalDate)(dateA, dateB)) return true;
- }
- return false;
- },
- handleClose: function handleClose() {
- this.pickerVisible = false;
- },
- handleFocus: function handleFocus() {
- var type = this.type;
- if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
- this.pickerVisible = true;
- }
- this.$emit('focus', this);
- },
- handleBlur: function handleBlur() {
- this.$emit('blur', this);
- },
- handleKeydown: function handleKeydown(event) {
- var keyCode = event.keyCode;
- // tab
- if (keyCode === 9) {
- this.pickerVisible = false;
- }
- },
- hidePicker: function hidePicker() {
- if (this.picker) {
- this.picker.resetView && this.picker.resetView();
- this.pickerVisible = this.picker.visible = false;
- this.destroyPopper();
- }
- },
- showPicker: function showPicker() {
- var _this = this;
- if (this.$isServer) return;
- if (!this.picker) {
- (function () {
- _this.panel.defaultValue = _this.currentValue;
- _this.picker = new _vue2.default(_this.panel).$mount();
- _this.picker.popperClass = _this.popperClass;
- _this.popperElm = _this.picker.$el;
- _this.picker.width = _this.reference.getBoundingClientRect().width;
- _this.picker.showTime = _this.type === 'datetime' || _this.type === 'datetimerange';
- _this.picker.selectionMode = _this.selectionMode;
- if (_this.format) {
- _this.picker.format = _this.format;
- }
- var updateOptions = function updateOptions() {
- var options = _this.pickerOptions;
- if (options && options.selectableRange) {
- (function () {
- var ranges = options.selectableRange;
- var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
- var format = DEFAULT_FORMATS.timerange;
- ranges = Array.isArray(ranges) ? ranges : [ranges];
- _this.picker.selectableRange = ranges.map(function (range) {
- return parser(range, format, _this.rangeSeparator);
- });
- })();
- }
- for (var option in options) {
- if (options.hasOwnProperty(option) &&
- // 忽略 time-picker 的该配置项
- option !== 'selectableRange') {
- _this.picker[option] = options[option];
- }
- }
- };
- updateOptions();
- _this.$watch('pickerOptions', function () {
- return updateOptions();
- }, { deep: true });
- _this.$el.appendChild(_this.picker.$el);
- _this.pickerVisible = _this.picker.visible = true;
- _this.picker.resetView && _this.picker.resetView();
- _this.picker.$on('dodestroy', _this.doDestroy);
- _this.picker.$on('pick', function (date) {
- var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _this.$emit('input', date);
- _this.pickerVisible = _this.picker.visible = visible;
- _this.picker.resetView && _this.picker.resetView();
- });
- _this.picker.$on('select-range', function (start, end) {
- _this.refInput.setSelectionRange(start, end);
- _this.refInput.focus();
- });
- })();
- } else {
- this.pickerVisible = this.picker.visible = true;
- }
- this.updatePopper();
- if (this.currentValue instanceof Date) {
- this.picker.date = new Date(this.currentValue.getTime());
- } else {
- this.picker.value = this.currentValue;
- }
- this.picker.resetView && this.picker.resetView();
- this.$nextTick(function () {
- _this.picker.ajustScrollTop && _this.picker.ajustScrollTop();
- });
- }
- }
- };
- /***/ },
- /* 104 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- exports.limitRange = exports.getRangeHours = exports.nextMonth = exports.prevMonth = exports.getWeekNumber = exports.getStartDateOfMonth = exports.DAY_DURATION = exports.getFirstDayOfMonth = exports.getDayCountOfMonth = exports.parseDate = exports.formatDate = exports.isDate = exports.toDate = exports.equalDate = undefined;
- var _date = __webpack_require__(105);
- var _date2 = _interopRequireDefault(_date);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var newArray = function newArray(start, end) {
- var result = [];
- for (var i = start; i <= end; i++) {
- result.push(i);
- }
- return result;
- };
- var equalDate = exports.equalDate = function equalDate(dateA, dateB) {
- return dateA === dateB || new Date(dateA).getTime() === new Date(dateB).getTime();
- };
- var toDate = exports.toDate = function toDate(date) {
- return isDate(date) ? new Date(date) : null;
- };
- var isDate = exports.isDate = function isDate(date) {
- if (date === null || date === undefined) return false;
- if (isNaN(new Date(date).getTime())) return false;
- return true;
- };
- var formatDate = exports.formatDate = function formatDate(date, format) {
- date = toDate(date);
- if (!date) return '';
- return _date2.default.format(date, format || 'yyyy-MM-dd');
- };
- var parseDate = exports.parseDate = function parseDate(string, format) {
- return _date2.default.parse(string, format || 'yyyy-MM-dd');
- };
- var getDayCountOfMonth = exports.getDayCountOfMonth = function getDayCountOfMonth(year, month) {
- if (month === 3 || month === 5 || month === 8 || month === 10) {
- return 30;
- }
- if (month === 1) {
- if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
- return 29;
- } else {
- return 28;
- }
- }
- return 31;
- };
- var getFirstDayOfMonth = exports.getFirstDayOfMonth = function getFirstDayOfMonth(date) {
- var temp = new Date(date.getTime());
- temp.setDate(1);
- return temp.getDay();
- };
- var DAY_DURATION = exports.DAY_DURATION = 86400000;
- var getStartDateOfMonth = exports.getStartDateOfMonth = function getStartDateOfMonth(year, month) {
- var result = new Date(year, month, 1);
- var day = result.getDay();
- if (day === 0) {
- result.setTime(result.getTime() - DAY_DURATION * 7);
- } else {
- result.setTime(result.getTime() - DAY_DURATION * day);
- }
- return result;
- };
- var getWeekNumber = exports.getWeekNumber = function getWeekNumber(src) {
- var date = new Date(src.getTime());
- date.setHours(0, 0, 0, 0);
- // Thursday in current week decides the year.
- date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
- // January 4 is always in week 1.
- var week1 = new Date(date.getFullYear(), 0, 4);
- // Adjust to Thursday in week 1 and count number of weeks from date to week 1.
- return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7);
- };
- var prevMonth = exports.prevMonth = function prevMonth(src) {
- var year = src.getFullYear();
- var month = src.getMonth();
- var date = src.getDate();
- var newYear = month === 0 ? year - 1 : year;
- var newMonth = month === 0 ? 11 : month - 1;
- var newMonthDayCount = getDayCountOfMonth(newYear, newMonth);
- if (newMonthDayCount < date) {
- src.setDate(newMonthDayCount);
- }
- src.setMonth(newMonth);
- src.setFullYear(newYear);
- return new Date(src.getTime());
- };
- var nextMonth = exports.nextMonth = function nextMonth(src) {
- var year = src.getFullYear();
- var month = src.getMonth();
- var date = src.getDate();
- var newYear = month === 11 ? year + 1 : year;
- var newMonth = month === 11 ? 0 : month + 1;
- var newMonthDayCount = getDayCountOfMonth(newYear, newMonth);
- if (newMonthDayCount < date) {
- src.setDate(newMonthDayCount);
- }
- src.setMonth(newMonth);
- src.setFullYear(newYear);
- return new Date(src.getTime());
- };
- var getRangeHours = exports.getRangeHours = function getRangeHours(ranges) {
- var hours = [];
- var disabledHours = [];
- (ranges || []).forEach(function (range) {
- var value = range.map(function (date) {
- return date.getHours();
- });
- disabledHours = disabledHours.concat(newArray(value[0], value[1]));
- });
- if (disabledHours.length) {
- for (var i = 0; i < 24; i++) {
- hours[i] = disabledHours.indexOf(i) === -1;
- }
- } else {
- for (var _i = 0; _i < 24; _i++) {
- hours[_i] = false;
- }
- }
- return hours;
- };
- var limitRange = exports.limitRange = function limitRange(date, ranges) {
- var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'yyyy-MM-dd HH:mm:ss';
- if (!ranges || !ranges.length) return date;
- var len = ranges.length;
- date = _date2.default.parse(_date2.default.format(date, format), format);
- for (var i = 0; i < len; i++) {
- var range = ranges[i];
- if (date >= range[0] && date <= range[1]) {
- return date;
- }
- }
- var maxDate = ranges[0][0];
- var minDate = ranges[0][0];
- ranges.forEach(function (range) {
- minDate = new Date(Math.min(range[0], minDate));
- maxDate = new Date(Math.max(range[1], maxDate));
- });
- return date < minDate ? minDate : maxDate;
- };
- /***/ },
- /* 105 */
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/utils/date");
- /***/ },
- /* 106 */
- /***/ function(module, exports) {
- module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('el-input', {
- directives: [{
- name: "clickoutside",
- rawName: "v-clickoutside",
- value: (_vm.handleClose),
- expression: "handleClose"
- }],
- ref: "reference",
- staticClass: "el-date-editor",
- class: 'el-date-editor--' + _vm.type,
- attrs: {
- "readonly": !_vm.editable || _vm.readonly,
- "disabled": _vm.disabled,
- "size": _vm.size,
- "placeholder": _vm.placeholder,
- "value": _vm.displayValue,
- "validateEvent": false
- },
- on: {
- "focus": _vm.handleFocus,
- "blur": _vm.handleBlur
- },
- nativeOn: {
- "keydown": function($event) {
- _vm.handleKeydown($event)
- },
- "change": function($event) {
- _vm.displayValue = $event.target.value
- }
- }
- }, [(_vm.haveTrigger) ? _c('i', {
- staticClass: "el-input__icon",
- class: [_vm.showClose ? 'el-icon-close' : _vm.triggerClass],
- on: {
- "click": _vm.handleClickIcon,
- "mouseenter": _vm.handleMouseEnterIcon,
- "mouseleave": function($event) {
- _vm.showClose = false
- }
- },
- slot: "icon"
- }) : _vm._e()])
- },staticRenderFns: []}
- /***/ },
- /* 107 */
- /***/ function(module, exports, __webpack_require__) {
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(108),
- /* template */
- __webpack_require__(125),
- /* scopeId */
- null,
- /* cssModules */
- null
- )
- module.exports = Component.exports
- /***/ },
- /* 108 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _util = __webpack_require__(104);
- var _locale = __webpack_require__(60);
- var _locale2 = _interopRequireDefault(_locale);
- var _input = __webpack_require__(9);
- var _input2 = _interopRequireDefault(_input);
- var _time = __webpack_require__(109);
- var _time2 = _interopRequireDefault(_time);
- var _yearTable = __webpack_require__(115);
- var _yearTable2 = _interopRequireDefault(_yearTable);
- var _monthTable = __webpack_require__(119);
- var _monthTable2 = _interopRequireDefault(_monthTable);
- var _dateTable = __webpack_require__(122);
- var _dateTable2 = _interopRequireDefault(_dateTable);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = {
- mixins: [_locale2.default],
- watch: {
- showTime: function showTime(val) {
- var _this = this;
- /* istanbul ignore if */
- if (!val) return;
- this.$nextTick(function (_) {
- var inputElm = _this.$refs.input.$el;
- if (inputElm) {
- _this.pickerWidth = inputElm.getBoundingClientRect().width + 10;
- }
- });
- },
- value: function value(newVal) {
- if (!newVal) return;
- newVal = new Date(newVal);
- if (!isNaN(newVal)) {
- if (typeof this.disabledDate === 'function' && this.disabledDate(new Date(newVal))) {
- return;
- }
- this.date = newVal;
- this.year = newVal.getFullYear();
- this.month = newVal.getMonth();
- this.$emit('pick', newVal, true);
- }
- },
- timePickerVisible: function timePickerVisible(val) {
- var _this2 = this;
- if (val) this.$nextTick(function () {
- return _this2.$refs.timepicker.ajustScrollTop();
- });
- },
- selectionMode: function selectionMode(newVal) {
- if (newVal === 'month') {
- /* istanbul ignore next */
- if (this.currentView !== 'year' || this.currentView !== 'month') {
- this.currentView = 'month';
- }
- } else if (newVal === 'week') {
- this.week = (0, _util.getWeekNumber)(this.date);
- }
- },
- date: function date(newVal) {
- this.year = newVal.getFullYear();
- this.month = newVal.getMonth();
- }
- },
- methods: {
- handleClear: function handleClear() {
- this.date = new Date();
- this.$emit('pick');
- },
- resetDate: function resetDate() {
- this.date = new Date(this.date);
- },
- showMonthPicker: function showMonthPicker() {
- this.currentView = 'month';
- },
- showYearPicker: function showYearPicker() {
- this.currentView = 'year';
- },
- // XXX: 没用到
- // handleLabelClick() {
- // if (this.currentView === 'date') {
- // this.showMonthPicker();
- // } else if (this.currentView === 'month') {
- // this.showYearPicker();
- // }
- // },
- prevMonth: function prevMonth() {
- this.month--;
- if (this.month < 0) {
- this.month = 11;
- this.year--;
- }
- },
- nextMonth: function nextMonth() {
- this.month++;
- if (this.month > 11) {
- this.month = 0;
- this.year++;
- }
- },
- nextYear: function nextYear() {
- if (this.currentView === 'year') {
- this.$refs.yearTable.nextTenYear();
- } else {
- this.year++;
- this.date.setFullYear(this.year);
- this.resetDate();
- }
- },
- prevYear: function prevYear() {
- if (this.currentView === 'year') {
- this.$refs.yearTable.prevTenYear();
- } else {
- this.year--;
- this.date.setFullYear(this.year);
- this.resetDate();
- }
- },
- handleShortcutClick: function handleShortcutClick(shortcut) {
- if (shortcut.onClick) {
- shortcut.onClick(this);
- }
- },
- handleTimePick: function handleTimePick(picker, visible, first) {
- if (picker) {
- var oldDate = new Date(this.date.getTime());
- var hour = picker.getHours();
- var minute = picker.getMinutes();
- var second = picker.getSeconds();
- oldDate.setHours(hour);
- oldDate.setMinutes(minute);
- oldDate.setSeconds(second);
- this.date = new Date(oldDate.getTime());
- }
- if (!first) {
- this.timePickerVisible = visible;
- }
- },
- handleMonthPick: function handleMonthPick(month) {
- this.month = month;
- var selectionMode = this.selectionMode;
- if (selectionMode !== 'month') {
- this.date.setMonth(month);
- this.currentView = 'date';
- this.resetDate();
- } else {
- this.date.setMonth(month);
- this.year && this.date.setFullYear(this.year);
- this.resetDate();
- var value = new Date(this.date.getFullYear(), month, 1);
- this.$emit('pick', value);
- }
- },
- handleDatePick: function handleDatePick(value) {
- if (this.selectionMode === 'day') {
- if (!this.showTime) {
- this.$emit('pick', new Date(value.getTime()));
- }
- this.date.setFullYear(value.getFullYear());
- this.date.setMonth(value.getMonth(), value.getDate());
- } else if (this.selectionMode === 'week') {
- this.week = value.week;
- this.$emit('pick', value.date);
- }
- this.resetDate();
- },
- handleYearPick: function handleYearPick(year) {
- var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
- this.year = year;
- if (!close) return;
- this.date.setFullYear(year);
- if (this.selectionMode === 'year') {
- this.$emit('pick', new Date(year));
- } else {
- this.currentView = 'month';
- }
- this.resetDate();
- },
- changeToNow: function changeToNow() {
- this.date.setTime(+new Date());
- this.$emit('pick', new Date(this.date.getTime()));
- this.resetDate();
- },
- confirm: function confirm() {
- this.$emit('pick', this.date);
- },
- resetView: function resetView() {
- if (this.selectionMode === 'month') {
- this.currentView = 'month';
- } else if (this.selectionMode === 'year') {
- this.currentView = 'year';
- } else {
- this.currentView = 'date';
- }
- if (this.selectionMode !== 'week') {
- this.year = this.date.getFullYear();
- this.month = this.date.getMonth();
- }
- }
- },
- components: {
- TimePicker: _time2.default, YearTable: _yearTable2.default, MonthTable: _monthTable2.default, DateTable: _dateTable2.default, ElInput: _input2.default
- },
- mounted: function mounted() {
- if (this.date && !this.year) {
- this.year = this.date.getFullYear();
- this.month = this.date.getMonth();
- }
- },
- data: function data() {
- return {
- popperClass: '',
- pickerWidth: 0,
- date: new Date(),
- value: '',
- showTime: false,
- selectionMode: 'day',
- shortcuts: '',
- visible: false,
- currentView: 'date',
- disabledDate: '',
- firstDayOfWeek: 7,
- year: null,
- month: null,
- week: null,
- showWeekNumber: false,
- timePickerVisible: false,
- width: 0
- };
- },
- computed: {
- footerVisible: function footerVisible() {
- return this.showTime;
- },
- visibleTime: {
- get: function get() {
- return (0, _util.formatDate)(this.date, 'HH:mm:ss');
- },
- set: function set(val) {
- if (val) {
- var date = (0, _util.parseDate)(val, 'HH:mm:ss');
- if (date) {
- date.setFullYear(this.date.getFullYear());
- date.setMonth(this.date.getMonth());
- date.setDate(this.date.getDate());
- this.date = date;
- this.$refs.timepicker.value = date;
- this.timePickerVisible = false;
- }
- }
- }
- },
- visibleDate: {
- get: function get() {
- return (0, _util.formatDate)(this.date);
- },
- set: function set(val) {
- var date = (0, _util.parseDate)(val, 'yyyy-MM-dd');
- if (date) {
- date.setHours(this.date.getHours());
- date.setMinutes(this.date.getMinutes());
- date.setSeconds(this.date.getSeconds());
- this.date = date;
- this.resetView();
- }
- }
- },
- yearLabel: function yearLabel() {
- var year = this.year;
- if (!year) return '';
- var yearTranslation = this.t('el.datepicker.year');
- if (this.currentView === 'year') {
- var startYear = Math.floor(year / 10) * 10;
- if (yearTranslation) {
- return startYear + ' ' + yearTranslation + ' - ' + (startYear + 9) + ' ' + yearTranslation;
- }
- return startYear + ' - ' + (startYear + 9);
- }
- return this.year + ' ' + yearTranslation;
- }
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- /***/ },
- /* 109 */
- /***/ function(module, exports, __webpack_require__) {
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(110),
- /* template */
- __webpack_require__(114),
- /* scopeId */
- null,
- /* cssModules */
- null
- )
- module.exports = Component.exports
- /***/ },
- /* 110 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _util = __webpack_require__(104);
- var _locale = __webpack_require__(60);
- var _locale2 = _interopRequireDefault(_locale);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- exports.default = {
- mixins: [_locale2.default],
- components: {
- TimeSpinner: __webpack_require__(111)
- },
- props: {
- pickerWidth: {},
- date: {
- default: function _default() {
- return new Date();
- }
- },
- visible: Boolean
- },
- watch: {
- visible: function visible(val) {
- this.currentVisible = val;
- },
- pickerWidth: function pickerWidth(val) {
- this.width = val;
- },
- value: function value(newVal) {
- var _this = this;
- var date = void 0;
- if (newVal instanceof Date) {
- date = (0, _util.limitRange)(newVal, this.selectableRange);
- } else if (!newVal) {
- date = new Date();
- }
- this.handleChange({
- hours: date.getHours(),
- minutes: date.getMinutes(),
- seconds: date.getSeconds()
- });
- this.$nextTick(function (_) {
- return _this.ajustScrollTop();
- });
- },
- selectableRange: function selectableRange(val) {
- this.$refs.spinner.selectableRange = val;
- }
- },
- data: function data() {
- return {
- popperClass: '',
- format: 'HH:mm:ss',
- value: '',
- hours: 0,
- minutes: 0,
- seconds: 0,
- selectableRange: [],
- currentDate: this.$options.defaultValue || this.date || new Date(),
- currentVisible: this.visible || false,
- width: this.pickerWidth || 0
- };
- },
- computed: {
- showSeconds: function showSeconds() {
- return (this.format || '').indexOf('ss') !== -1;
- }
- },
- methods: {
- handleClear: function handleClear() {
- this.$emit('pick');
- },
- handleCancel: function handleCancel() {
- this.$emit('pick');
- },
- handleChange: function handleChange(date) {
- if (date.hours !== undefined) {
- this.currentDate.setHours(date.hours);
- this.hours = this.currentDate.getHours();
- }
- if (date.minutes !== undefined) {
- this.currentDate.setMinutes(date.minutes);
- this.minutes = this.currentDate.getMinutes();
- }
- if (date.seconds !== undefined) {
- this.currentDate.setSeconds(date.seconds);
- this.seconds = this.currentDate.getSeconds();
- }
- this.handleConfirm(true);
- },
- setSelectionRange: function setSelectionRange(start, end) {
- this.$emit('select-range', start, end);
- },
- handleConfirm: function handleConfirm() {
- var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var first = arguments[1];
- if (first) return;
- var date = new Date((0, _util.limitRange)(this.currentDate, this.selectableRange, 'HH:mm:ss'));
- this.$emit('pick', date, visible, first);
- },
- ajustScrollTop: function ajustScrollTop() {
- return this.$refs.spinner.ajustScrollTop();
- }
- },
- created: function created() {
- this.hours = this.currentDate.getHours();
- this.minutes = this.currentDate.getMinutes();
- this.seconds = this.currentDate.getSeconds();
- },
- mounted: function mounted() {
- var _this2 = this;
- this.$nextTick(function () {
- return _this2.handleConfirm(true, true);
- });
- }
- };
- /***/ },
- /* 111 */
- /***/ function(module, exports, __webpack_require__) {
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(112),
- /* template */
- __webpack_require__(113),
- /* scopeId */
- null,
- /* cssModules */
- null
- )
- module.exports = Component.exports
- /***/ },
- /* 112 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _util = __webpack_require__(104);
- var _scrollbar = __webpack_require__(15);
- var _scrollbar2 = _interopRequireDefault(_scrollbar);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- exports.default = {
- components: { ElScrollbar: _scrollbar2.default },
- props: {
- hours: {
- type: Number,
- default: 0
- },
- minutes: {
- type: Number,
- default: 0
- },
- seconds: {
- type: Number,
- default: 0
- },
- showSeconds: {
- type: Boolean,
- default: true
- }
- },
- watch: {
- hoursPrivate: function hoursPrivate(newVal, oldVal) {
- if (!(newVal >= 0 && newVal <= 23)) {
- this.hoursPrivate = oldVal;
- }
- this.ajustElTop('hour', newVal);
- this.$emit('change', { hours: newVal });
- },
- minutesPrivate: function minutesPrivate(newVal, oldVal) {
- if (!(newVal >= 0 && newVal <= 59)) {
- this.minutesPrivate = oldVal;
- }
- this.ajustElTop('minute', newVal);
- this.$emit('change', { minutes: newVal });
- },
- secondsPrivate: function secondsPrivate(newVal, oldVal) {
- if (!(newVal >= 0 && newVal <= 59)) {
- this.secondsPrivate = oldVal;
- }
- this.ajustElTop('second', newVal);
- this.$emit('change', { seconds: newVal });
- }
- },
- computed: {
- hoursList: function hoursList() {
- return (0, _util.getRangeHours)(this.selectableRange);
- },
- hourEl: function hourEl() {
- return this.$refs.hour.wrap;
- },
- minuteEl: function minuteEl() {
- return this.$refs.minute.wrap;
- },
- secondEl: function secondEl() {
- return this.$refs.second.wrap;
- }
- },
- data: function data() {
- return {
- hoursPrivate: 0,
- minutesPrivate: 0,
- secondsPrivate: 0,
- selectableRange: []
- };
- },
- mounted: function mounted() {
- var _this = this;
- this.$nextTick(function () {
- _this.bindScrollEvent();
- });
- },
- methods: {
- handleClick: function handleClick(type, value, disabled) {
- if (value.disabled) {
- return;
- }
- this[type + 'Private'] = value.value >= 0 ? value.value : value;
- this.emitSelectRange(type);
- },
- emitSelectRange: function emitSelectRange(type) {
- if (type === 'hours') {
- this.$emit('select-range', 0, 2);
- } else if (type === 'minutes') {
- this.$emit('select-range', 3, 5);
- } else if (type === 'seconds') {
- this.$emit('select-range', 6, 8);
- }
- },
- bindScrollEvent: function bindScrollEvent() {
- var _this2 = this;
- var bindFuntion = function bindFuntion(type) {
- _this2[type + 'El'].onscroll = function (e) {
- return _this2.handleScroll(type, e);
- };
- };
- bindFuntion('hour');
- bindFuntion('minute');
- bindFuntion('second');
- },
- handleScroll: function handleScroll(type) {
- var ajust = {};
- ajust[type + 's'] = Math.min(Math.floor((this[type + 'El'].scrollTop - 80) / 32 + 3), 59);
- this.$emit('change', ajust);
- },
- ajustScrollTop: function ajustScrollTop() {
- this.ajustElTop('hour', this.hours);
- this.ajustElTop('minute', this.minutes);
- this.ajustElTop('second', this.seconds);
- },
- ajustElTop: function ajustElTop(type, value) {
- this[type + 'El'].scrollTop = Math.max(0, (value - 2.5) * 32 + 80);
- }
- }
- };
- /***/ },
- /* 113 */
- /***/ function(module, exports) {
- module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('div', {
- staticClass: "el-time-spinner",
- class: {
- 'has-seconds': _vm.showSeconds
- }
- }, [_c('el-scrollbar', {
- ref: "hour",
- staticClass: "el-time-spinner__wrapper",
- attrs: {
- "wrap-style": "max-height: inherit;",
- "view-class": "el-time-spinner__list",
- "noresize": "",
- "tag": "ul"
- },
- nativeOn: {
- "mouseenter": function($event) {
- _vm.emitSelectRange('hours')
- }
- }
- }, _vm._l((_vm.hoursList), function(disabled, hour) {
- return _c('li', {
- staticClass: "el-time-spinner__item",
- class: {
- 'active': hour === _vm.hours, 'disabled': disabled
- },
- attrs: {
- "track-by": "hour"
- },
- domProps: {
- "textContent": _vm._s(hour)
- },
- on: {
- "click": function($event) {
- _vm.handleClick('hours', {
- value: hour,
- disabled: disabled
- }, true)
- }
- }
- })
- })), _c('el-scrollbar', {
- ref: "minute",
- staticClass: "el-time-spinner__wrapper",
- attrs: {
- "wrap-style": "max-height: inherit;",
- "view-class": "el-time-spinner__list",
- "noresize": "",
- "tag": "ul"
- },
- nativeOn: {
- "mouseenter": function($event) {
- _vm.emitSelectRange('minutes')
- }
- }
- }, _vm._l((60), function(minute, key) {
- return _c('li', {
- staticClass: "el-time-spinner__item",
- class: {
- 'active': key === _vm.minutes
- },
- domProps: {
- "textContent": _vm._s(key)
- },
- on: {
- "click": function($event) {
- _vm.handleClick('minutes', key, true)
- }
- }
- })
- })), _c('el-scrollbar', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.showSeconds),
- expression: "showSeconds"
- }],
- ref: "second",
- staticClass: "el-time-spinner__wrapper",
- attrs: {
- "wrap-style": "max-height: inherit;",
- "view-class": "el-time-spinner__list",
- "noresize": "",
- "tag": "ul"
- },
- nativeOn: {
- "mouseenter": function($event) {
- _vm.emitSelectRange('seconds')
- }
- }
- }, _vm._l((60), function(second, key) {
- return _c('li', {
- staticClass: "el-time-spinner__item",
- class: {
- 'active': key === _vm.seconds
- },
- domProps: {
- "textContent": _vm._s(key)
- },
- on: {
- "click": function($event) {
- _vm.handleClick('seconds', key, true)
- }
- }
- })
- }))], 1)
- },staticRenderFns: []}
- /***/ },
- /* 114 */
- /***/ function(module, exports) {
- module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('transition', {
- attrs: {
- "name": "el-zoom-in-top"
- },
- on: {
- "after-leave": function($event) {
- _vm.$emit('dodestroy')
- }
- }
- }, [_c('div', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.currentVisible),
- expression: "currentVisible"
- }],
- staticClass: "el-time-panel",
- class: _vm.popperClass,
- style: ({
- width: _vm.width + 'px'
- })
- }, [_c('div', {
- staticClass: "el-time-panel__content",
- class: {
- 'has-seconds': _vm.showSeconds
- }
- }, [_c('time-spinner', {
- ref: "spinner",
- attrs: {
- "show-seconds": _vm.showSeconds,
- "hours": _vm.hours,
- "minutes": _vm.minutes,
- "seconds": _vm.seconds
- },
- on: {
- "change": _vm.handleChange,
- "select-range": _vm.setSelectionRange
- }
- })], 1), _c('div', {
- staticClass: "el-time-panel__footer"
- }, [_c('button', {
- staticClass: "el-time-panel__btn cancel",
- attrs: {
- "type": "button"
- },
- on: {
- "click": _vm.handleCancel
- }
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.cancel')))]), _c('button', {
- staticClass: "el-time-panel__btn confirm",
- attrs: {
- "type": "button"
- },
- on: {
- "click": function($event) {
- _vm.handleConfirm()
- }
- }
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.confirm')))])])])])
- },staticRenderFns: []}
- /***/ },
- /* 115 */
- /***/ function(module, exports, __webpack_require__) {
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(116),
- /* template */
- __webpack_require__(118),
- /* scopeId */
- null,
- /* cssModules */
- null
- )
- module.exports = Component.exports
- /***/ },
- /* 116 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _dom = __webpack_require__(117);
- exports.default = {
- props: {
- disabledDate: {},
- date: {},
- year: {}
- },
- computed: {
- startYear: function startYear() {
- return Math.floor(this.year / 10) * 10;
- }
- },
- methods: {
- getCellStyle: function getCellStyle(year) {
- var style = {};
- var date = new Date(this.date);
- date.setFullYear(year);
- style.disabled = typeof this.disabledDate === 'function' && this.disabledDate(date);
- style.current = Number(this.year) === year;
- return style;
- },
- nextTenYear: function nextTenYear() {
- this.$emit('pick', Number(this.year) + 10, false);
- },
- prevTenYear: function prevTenYear() {
- this.$emit('pick', Number(this.year) - 10, false);
- },
- handleYearTableClick: function handleYearTableClick(event) {
- var target = event.target;
- if (target.tagName === 'A') {
- if ((0, _dom.hasClass)(target.parentNode, 'disabled')) return;
- var year = target.textContent || target.innerText;
- this.$emit('pick', year);
- }
- }
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- /***/ },
- /* 117 */
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/utils/dom");
- /***/ },
- /* 118 */
- /***/ function(module, exports) {
- module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('table', {
- staticClass: "el-year-table",
- on: {
- "click": _vm.handleYearTableClick
- }
- }, [_c('tbody', [_c('tr', [_c('td', {
- staticClass: "available",
- class: _vm.getCellStyle(_vm.startYear + 0)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.startYear))])]), _c('td', {
- staticClass: "available",
- class: _vm.getCellStyle(_vm.startYear + 1)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.startYear + 1))])]), _c('td', {
- staticClass: "available",
- class: _vm.getCellStyle(_vm.startYear + 2)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.startYear + 2))])]), _c('td', {
- staticClass: "available",
- class: _vm.getCellStyle(_vm.startYear + 3)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.startYear + 3))])])]), _c('tr', [_c('td', {
- staticClass: "available",
- class: _vm.getCellStyle(_vm.startYear + 4)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.startYear + 4))])]), _c('td', {
- staticClass: "available",
- class: _vm.getCellStyle(_vm.startYear + 5)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.startYear + 5))])]), _c('td', {
- staticClass: "available",
- class: _vm.getCellStyle(_vm.startYear + 6)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.startYear + 6))])]), _c('td', {
- staticClass: "available",
- class: _vm.getCellStyle(_vm.startYear + 7)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.startYear + 7))])])]), _c('tr', [_c('td', {
- staticClass: "available",
- class: _vm.getCellStyle(_vm.startYear + 8)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.startYear + 8))])]), _c('td', {
- staticClass: "available",
- class: _vm.getCellStyle(_vm.startYear + 9)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.startYear + 9))])]), _c('td'), _c('td')])])])
- },staticRenderFns: []}
- /***/ },
- /* 119 */
- /***/ function(module, exports, __webpack_require__) {
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(120),
- /* template */
- __webpack_require__(121),
- /* scopeId */
- null,
- /* cssModules */
- null
- )
- module.exports = Component.exports
- /***/ },
- /* 120 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _locale = __webpack_require__(60);
- var _locale2 = _interopRequireDefault(_locale);
- var _dom = __webpack_require__(117);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- exports.default = {
- props: {
- disabledDate: {},
- date: {},
- month: {
- type: Number
- }
- },
- mixins: [_locale2.default],
- methods: {
- getCellStyle: function getCellStyle(month) {
- var style = {};
- var date = new Date(this.date);
- date.setMonth(month);
- style.disabled = typeof this.disabledDate === 'function' && this.disabledDate(date);
- style.current = this.month === month;
- return style;
- },
- handleMonthTableClick: function handleMonthTableClick(event) {
- var target = event.target;
- if (target.tagName !== 'A') return;
- if ((0, _dom.hasClass)(target.parentNode, 'disabled')) return;
- var column = target.parentNode.cellIndex;
- var row = target.parentNode.parentNode.rowIndex;
- var month = row * 4 + column;
- this.$emit('pick', month);
- }
- }
- };
- /***/ },
- /* 121 */
- /***/ function(module, exports) {
- module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('table', {
- staticClass: "el-month-table",
- on: {
- "click": _vm.handleMonthTableClick
- }
- }, [_c('tbody', [_c('tr', [_c('td', {
- class: _vm.getCellStyle(0)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.months.jan')))])]), _c('td', {
- class: _vm.getCellStyle(1)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.months.feb')))])]), _c('td', {
- class: _vm.getCellStyle(2)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.months.mar')))])]), _c('td', {
- class: _vm.getCellStyle(3)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.months.apr')))])])]), _c('tr', [_c('td', {
- class: _vm.getCellStyle(4)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.months.may')))])]), _c('td', {
- class: _vm.getCellStyle(5)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.months.jun')))])]), _c('td', {
- class: _vm.getCellStyle(6)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.months.jul')))])]), _c('td', {
- class: _vm.getCellStyle(7)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.months.aug')))])])]), _c('tr', [_c('td', {
- class: _vm.getCellStyle(8)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.months.sep')))])]), _c('td', {
- class: _vm.getCellStyle(9)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.months.oct')))])]), _c('td', {
- class: _vm.getCellStyle(10)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.months.nov')))])]), _c('td', {
- class: _vm.getCellStyle(11)
- }, [_c('a', {
- staticClass: "cell"
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.months.dec')))])])])])])
- },staticRenderFns: []}
- /***/ },
- /* 122 */
- /***/ function(module, exports, __webpack_require__) {
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(123),
- /* template */
- __webpack_require__(124),
- /* scopeId */
- null,
- /* cssModules */
- null
- )
- module.exports = Component.exports
- /***/ },
- /* 123 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _util = __webpack_require__(104);
- var _dom = __webpack_require__(117);
- var _locale = __webpack_require__(60);
- var _locale2 = _interopRequireDefault(_locale);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _WEEKS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- var clearHours = function clearHours(time) {
- var cloneDate = new Date(time);
- cloneDate.setHours(0, 0, 0, 0);
- return cloneDate.getTime();
- };
- exports.default = {
- mixins: [_locale2.default],
- props: {
- firstDayOfWeek: {
- default: 7,
- type: Number,
- validator: function validator(val) {
- return val >= 1 && val <= 7;
- }
- },
- date: {},
- year: {},
- month: {},
- week: {},
- selectionMode: {
- default: 'day'
- },
- showWeekNumber: {
- type: Boolean,
- default: false
- },
- disabledDate: {},
- minDate: {},
- maxDate: {},
- rangeState: {
- default: function _default() {
- return {
- endDate: null,
- selecting: false,
- row: null,
- column: null
- };
- }
- }
- },
- computed: {
- offsetDay: function offsetDay() {
- var week = this.firstDayOfWeek;
- // 周日为界限,左右偏移的天数,3217654 例如周一就是 -1,目的是调整前两行日期的位置
- return week > 3 ? 7 - week : -week;
- },
- WEEKS: function WEEKS() {
- var week = this.firstDayOfWeek;
- return _WEEKS.concat(_WEEKS).slice(week, week + 7);
- },
- monthDate: function monthDate() {
- return this.date.getDate();
- },
- startDate: function startDate() {
- return (0, _util.getStartDateOfMonth)(this.year, this.month);
- },
- rows: function rows() {
- var date = new Date(this.year, this.month, 1);
- var day = (0, _util.getFirstDayOfMonth)(date); // day of first day
- var dateCountOfMonth = (0, _util.getDayCountOfMonth)(date.getFullYear(), date.getMonth());
- var dateCountOfLastMonth = (0, _util.getDayCountOfMonth)(date.getFullYear(), date.getMonth() === 0 ? 11 : date.getMonth() - 1);
- day = day === 0 ? 7 : day;
- var offset = this.offsetDay;
- var rows = this.tableRows;
- var count = 1;
- var firstDayPosition = void 0;
- var startDate = this.startDate;
- var disabledDate = this.disabledDate;
- var now = clearHours(new Date());
- for (var i = 0; i < 6; i++) {
- var row = rows[i];
- if (this.showWeekNumber) {
- if (!row[0]) {
- row[0] = { type: 'week', text: (0, _util.getWeekNumber)(new Date(startDate.getTime() + _util.DAY_DURATION * (i * 7 + 1))) };
- }
- }
- for (var j = 0; j < 7; j++) {
- var cell = row[this.showWeekNumber ? j + 1 : j];
- if (!cell) {
- cell = { row: i, column: j, type: 'normal', inRange: false, start: false, end: false };
- }
- cell.type = 'normal';
- var index = i * 7 + j;
- var time = startDate.getTime() + _util.DAY_DURATION * (index - offset);
- cell.inRange = time >= clearHours(this.minDate) && time <= clearHours(this.maxDate);
- cell.start = this.minDate && time === clearHours(this.minDate);
- cell.end = this.maxDate && time === clearHours(this.maxDate);
- var isToday = time === now;
- if (isToday) {
- cell.type = 'today';
- }
- if (i >= 0 && i <= 1) {
- if (j + i * 7 >= day + offset) {
- cell.text = count++;
- if (count === 2) {
- firstDayPosition = i * 7 + j;
- }
- } else {
- cell.text = dateCountOfLastMonth - (day + offset - j % 7) + 1 + i * 7;
- cell.type = 'prev-month';
- }
- } else {
- if (count <= dateCountOfMonth) {
- cell.text = count++;
- if (count === 2) {
- firstDayPosition = i * 7 + j;
- }
- } else {
- cell.text = count++ - dateCountOfMonth;
- cell.type = 'next-month';
- }
- }
- cell.disabled = typeof disabledDate === 'function' && disabledDate(new Date(time));
- this.$set(row, this.showWeekNumber ? j + 1 : j, cell);
- }
- if (this.selectionMode === 'week') {
- var start = this.showWeekNumber ? 1 : 0;
- var end = this.showWeekNumber ? 7 : 6;
- var isWeekActive = this.isWeekActive(row[start + 1]);
- row[start].inRange = isWeekActive;
- row[start].start = isWeekActive;
- row[end].inRange = isWeekActive;
- row[end].end = isWeekActive;
- }
- }
- rows.firstDayPosition = firstDayPosition;
- return rows;
- }
- },
- watch: {
- 'rangeState.endDate': function rangeStateEndDate(newVal) {
- this.markRange(newVal);
- },
- minDate: function minDate(newVal, oldVal) {
- if (newVal && !oldVal) {
- this.rangeState.selecting = true;
- this.markRange(newVal);
- } else if (!newVal) {
- this.rangeState.selecting = false;
- this.markRange(newVal);
- } else {
- this.markRange();
- }
- },
- maxDate: function maxDate(newVal, oldVal) {
- if (newVal && !oldVal) {
- this.rangeState.selecting = false;
- this.markRange(newVal);
- this.$emit('pick', {
- minDate: this.minDate,
- maxDate: this.maxDate
- });
- }
- }
- },
- data: function data() {
- return {
- tableRows: [[], [], [], [], [], []]
- };
- },
- methods: {
- getCellClasses: function getCellClasses(cell) {
- var selectionMode = this.selectionMode;
- var monthDate = this.monthDate;
- var classes = [];
- if ((cell.type === 'normal' || cell.type === 'today') && !cell.disabled) {
- classes.push('available');
- if (cell.type === 'today') {
- classes.push('today');
- }
- } else {
- classes.push(cell.type);
- }
- if (selectionMode === 'day' && (cell.type === 'normal' || cell.type === 'today') && Number(this.year) === this.date.getFullYear() && this.month === this.date.getMonth() && monthDate === Number(cell.text)) {
- classes.push('current');
- }
- if (cell.inRange && (cell.type === 'normal' || cell.type === 'today' || this.selectionMode === 'week')) {
- classes.push('in-range');
- if (cell.start) {
- classes.push('start-date');
- }
- if (cell.end) {
- classes.push('end-date');
- }
- }
- if (cell.disabled) {
- classes.push('disabled');
- }
- return classes.join(' ');
- },
- getDateOfCell: function getDateOfCell(row, column) {
- var startDate = this.startDate;
- return new Date(startDate.getTime() + (row * 7 + (column - (this.showWeekNumber ? 1 : 0)) - this.offsetDay) * _util.DAY_DURATION);
- },
- getCellByDate: function getCellByDate(date) {
- var startDate = this.startDate;
- var rows = this.rows;
- var index = (date - startDate) / _util.DAY_DURATION;
- var row = rows[Math.floor(index / 7)];
- if (this.showWeekNumber) {
- return row[index % 7 + 1];
- } else {
- return row[index % 7];
- }
- },
- isWeekActive: function isWeekActive(cell) {
- if (this.selectionMode !== 'week') return false;
- var newDate = new Date(this.year, this.month, 1);
- var year = newDate.getFullYear();
- var month = newDate.getMonth();
- if (cell.type === 'prev-month') {
- newDate.setMonth(month === 0 ? 11 : month - 1);
- newDate.setFullYear(month === 0 ? year - 1 : year);
- }
- if (cell.type === 'next-month') {
- newDate.setMonth(month === 11 ? 0 : month + 1);
- newDate.setFullYear(month === 11 ? year + 1 : year);
- }
- newDate.setDate(parseInt(cell.text, 10));
- return (0, _util.getWeekNumber)(newDate) === this.week;
- },
- markRange: function markRange(maxDate) {
- var startDate = this.startDate;
- if (!maxDate) {
- maxDate = this.maxDate;
- }
- var rows = this.rows;
- var minDate = this.minDate;
- for (var i = 0, k = rows.length; i < k; i++) {
- var row = rows[i];
- for (var j = 0, l = row.length; j < l; j++) {
- if (this.showWeekNumber && j === 0) continue;
- var cell = row[j];
- var index = i * 7 + j + (this.showWeekNumber ? -1 : 0);
- var time = startDate.getTime() + _util.DAY_DURATION * (index - this.offsetDay);
- cell.inRange = minDate && time >= clearHours(minDate) && time <= clearHours(maxDate);
- cell.start = minDate && time === clearHours(minDate.getTime());
- cell.end = maxDate && time === clearHours(maxDate.getTime());
- }
- }
- },
- handleMouseMove: function handleMouseMove(event) {
- if (!this.rangeState.selecting) return;
- this.$emit('changerange', {
- minDate: this.minDate,
- maxDate: this.maxDate,
- rangeState: this.rangeState
- });
- var target = event.target;
- if (target.tagName !== 'TD') return;
- var column = target.cellIndex;
- var row = target.parentNode.rowIndex - 1;
- var _rangeState = this.rangeState,
- oldRow = _rangeState.row,
- oldColumn = _rangeState.column;
- if (oldRow !== row || oldColumn !== column) {
- this.rangeState.row = row;
- this.rangeState.column = column;
- this.rangeState.endDate = this.getDateOfCell(row, column);
- }
- },
- handleClick: function handleClick(event) {
- var target = event.target;
- if (target.tagName !== 'TD') return;
- if ((0, _dom.hasClass)(target, 'disabled') || (0, _dom.hasClass)(target, 'week')) return;
- var selectionMode = this.selectionMode;
- if (selectionMode === 'week') {
- target = target.parentNode.cells[1];
- }
- var year = Number(this.year);
- var month = Number(this.month);
- var cellIndex = target.cellIndex;
- var rowIndex = target.parentNode.rowIndex;
- var cell = this.rows[rowIndex - 1][cellIndex];
- var text = cell.text;
- var className = target.className;
- var newDate = new Date(year, month, 1);
- if (className.indexOf('prev') !== -1) {
- if (month === 0) {
- year = year - 1;
- month = 11;
- } else {
- month = month - 1;
- }
- newDate.setFullYear(year);
- newDate.setMonth(month);
- } else if (className.indexOf('next') !== -1) {
- if (month === 11) {
- year = year + 1;
- month = 0;
- } else {
- month = month + 1;
- }
- newDate.setFullYear(year);
- newDate.setMonth(month);
- }
- newDate.setDate(parseInt(text, 10));
- if (this.selectionMode === 'range') {
- if (this.minDate && this.maxDate) {
- var minDate = new Date(newDate.getTime());
- var maxDate = null;
- this.$emit('pick', { minDate: minDate, maxDate: maxDate }, false);
- this.rangeState.selecting = true;
- this.markRange(this.minDate);
- } else if (this.minDate && !this.maxDate) {
- if (newDate >= this.minDate) {
- var _maxDate = new Date(newDate.getTime());
- this.rangeState.selecting = false;
- this.$emit('pick', {
- minDate: this.minDate,
- maxDate: _maxDate
- });
- } else {
- var _minDate = new Date(newDate.getTime());
- this.$emit('pick', { minDate: _minDate, maxDate: this.maxDate }, false);
- }
- } else if (!this.minDate) {
- var _minDate2 = new Date(newDate.getTime());
- this.$emit('pick', { minDate: _minDate2, maxDate: this.maxDate }, false);
- this.rangeState.selecting = true;
- this.markRange(this.minDate);
- }
- } else if (selectionMode === 'day') {
- this.$emit('pick', newDate);
- } else if (selectionMode === 'week') {
- var weekNumber = (0, _util.getWeekNumber)(newDate);
- var value = newDate.getFullYear() + 'w' + weekNumber;
- this.$emit('pick', {
- year: newDate.getFullYear(),
- week: weekNumber,
- value: value,
- date: newDate
- });
- }
- }
- }
- };
- /***/ },
- /* 124 */
- /***/ function(module, exports) {
- module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('table', {
- staticClass: "el-date-table",
- class: {
- 'is-week-mode': _vm.selectionMode === 'week'
- },
- attrs: {
- "cellspacing": "0",
- "cellpadding": "0"
- },
- on: {
- "click": _vm.handleClick,
- "mousemove": _vm.handleMouseMove
- }
- }, [_c('tbody', [_c('tr', [(_vm.showWeekNumber) ? _c('th', [_vm._v(_vm._s(_vm.t('el.datepicker.week')))]) : _vm._e(), _vm._l((_vm.WEEKS), function(week) {
- return _c('th', [_vm._v(_vm._s(_vm.t('el.datepicker.weeks.' + week)))])
- })], 2), _vm._l((_vm.rows), function(row) {
- return _c('tr', {
- staticClass: "el-date-table__row",
- class: {
- current: _vm.isWeekActive(row[1])
- }
- }, _vm._l((row), function(cell) {
- return _c('td', {
- class: _vm.getCellClasses(cell),
- domProps: {
- "textContent": _vm._s(cell.type === 'today' ? _vm.t('el.datepicker.today') : cell.text)
- }
- })
- }))
- })], 2)])
- },staticRenderFns: []}
- /***/ },
- /* 125 */
- /***/ function(module, exports) {
- module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('transition', {
- attrs: {
- "name": "el-zoom-in-top"
- },
- on: {
- "after-leave": function($event) {
- _vm.$emit('dodestroy')
- }
- }
- }, [_c('div', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.visible),
- expression: "visible"
- }],
- staticClass: "el-picker-panel el-date-picker",
- class: [{
- 'has-sidebar': _vm.$slots.sidebar || _vm.shortcuts,
- 'has-time': _vm.showTime
- }, _vm.popperClass],
- style: ({
- width: _vm.width + 'px'
- })
- }, [_c('div', {
- staticClass: "el-picker-panel__body-wrapper"
- }, [_vm._t("sidebar"), (_vm.shortcuts) ? _c('div', {
- staticClass: "el-picker-panel__sidebar"
- }, _vm._l((_vm.shortcuts), function(shortcut) {
- return _c('button', {
- staticClass: "el-picker-panel__shortcut",
- attrs: {
- "type": "button"
- },
- on: {
- "click": function($event) {
- _vm.handleShortcutClick(shortcut)
- }
- }
- }, [_vm._v(_vm._s(shortcut.text))])
- })) : _vm._e(), _c('div', {
- staticClass: "el-picker-panel__body"
- }, [(_vm.showTime) ? _c('div', {
- staticClass: "el-date-picker__time-header"
- }, [_c('span', {
- staticClass: "el-date-picker__editor-wrap"
- }, [_c('el-input', {
- attrs: {
- "placeholder": _vm.t('el.datepicker.selectDate'),
- "value": _vm.visibleDate,
- "size": "small"
- },
- nativeOn: {
- "change": function($event) {
- _vm.visibleDate = $event.target.value
- }
- }
- })], 1), _c('span', {
- staticClass: "el-date-picker__editor-wrap"
- }, [_c('el-input', {
- ref: "input",
- attrs: {
- "placeholder": _vm.t('el.datepicker.selectTime'),
- "value": _vm.visibleTime,
- "size": "small"
- },
- on: {
- "focus": function($event) {
- _vm.timePickerVisible = !_vm.timePickerVisible
- }
- },
- nativeOn: {
- "change": function($event) {
- _vm.visibleTime = $event.target.value
- }
- }
- }), _c('time-picker', {
- ref: "timepicker",
- attrs: {
- "date": _vm.date,
- "picker-width": _vm.pickerWidth,
- "visible": _vm.timePickerVisible
- },
- on: {
- "pick": _vm.handleTimePick
- }
- })], 1)]) : _vm._e(), _c('div', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.currentView !== 'time'),
- expression: "currentView !== 'time'"
- }],
- staticClass: "el-date-picker__header"
- }, [_c('button', {
- staticClass: "el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-d-arrow-left",
- attrs: {
- "type": "button"
- },
- on: {
- "click": _vm.prevYear
- }
- }), _c('button', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.currentView === 'date'),
- expression: "currentView === 'date'"
- }],
- staticClass: "el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-arrow-left",
- attrs: {
- "type": "button"
- },
- on: {
- "click": _vm.prevMonth
- }
- }), _c('span', {
- staticClass: "el-date-picker__header-label",
- on: {
- "click": _vm.showYearPicker
- }
- }, [_vm._v(_vm._s(_vm.yearLabel))]), _c('span', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.currentView === 'date'),
- expression: "currentView === 'date'"
- }],
- staticClass: "el-date-picker__header-label",
- class: {
- active: _vm.currentView === 'month'
- },
- on: {
- "click": _vm.showMonthPicker
- }
- }, [_vm._v(_vm._s(_vm.t(("el.datepicker.month" + (_vm.month + 1)))))]), _c('button', {
- staticClass: "el-picker-panel__icon-btn el-date-picker__next-btn el-icon-d-arrow-right",
- attrs: {
- "type": "button"
- },
- on: {
- "click": _vm.nextYear
- }
- }), _c('button', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.currentView === 'date'),
- expression: "currentView === 'date'"
- }],
- staticClass: "el-picker-panel__icon-btn el-date-picker__next-btn el-icon-arrow-right",
- attrs: {
- "type": "button"
- },
- on: {
- "click": _vm.nextMonth
- }
- })]), _c('div', {
- staticClass: "el-picker-panel__content"
- }, [_c('date-table', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.currentView === 'date'),
- expression: "currentView === 'date'"
- }],
- attrs: {
- "year": _vm.year,
- "month": _vm.month,
- "date": _vm.date,
- "week": _vm.week,
- "selection-mode": _vm.selectionMode,
- "first-day-of-week": _vm.firstDayOfWeek,
- "disabled-date": _vm.disabledDate
- },
- on: {
- "pick": _vm.handleDatePick
- }
- }), _c('year-table', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.currentView === 'year'),
- expression: "currentView === 'year'"
- }],
- ref: "yearTable",
- attrs: {
- "year": _vm.year,
- "date": _vm.date,
- "disabled-date": _vm.disabledDate
- },
- on: {
- "pick": _vm.handleYearPick
- }
- }), _c('month-table', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.currentView === 'month'),
- expression: "currentView === 'month'"
- }],
- attrs: {
- "month": _vm.month,
- "date": _vm.date,
- "disabled-date": _vm.disabledDate
- },
- on: {
- "pick": _vm.handleMonthPick
- }
- })], 1)])], 2), _c('div', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.footerVisible && _vm.currentView === 'date'),
- expression: "footerVisible && currentView === 'date'"
- }],
- staticClass: "el-picker-panel__footer"
- }, [_c('a', {
- staticClass: "el-picker-panel__link-btn",
- attrs: {
- "href": "JavaScript:"
- },
- on: {
- "click": _vm.changeToNow
- }
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.now')))]), _c('button', {
- staticClass: "el-picker-panel__btn",
- attrs: {
- "type": "button"
- },
- on: {
- "click": _vm.confirm
- }
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.confirm')))])])])])
- },staticRenderFns: []}
- /***/ },
- /* 126 */
- /***/ function(module, exports, __webpack_require__) {
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(127),
- /* template */
- __webpack_require__(128),
- /* scopeId */
- null,
- /* cssModules */
- null
- )
- module.exports = Component.exports
- /***/ },
- /* 127 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _util = __webpack_require__(104);
- var _locale = __webpack_require__(60);
- var _locale2 = _interopRequireDefault(_locale);
- var _time = __webpack_require__(109);
- var _time2 = _interopRequireDefault(_time);
- var _dateTable = __webpack_require__(122);
- var _dateTable2 = _interopRequireDefault(_dateTable);
- var _input = __webpack_require__(9);
- var _input2 = _interopRequireDefault(_input);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = {
- mixins: [_locale2.default],
- computed: {
- btnDisabled: function btnDisabled() {
- return !(this.minDate && this.maxDate && !this.selecting);
- },
- leftLabel: function leftLabel() {
- return this.date.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t('el.datepicker.month' + (this.date.getMonth() + 1));
- },
- rightLabel: function rightLabel() {
- return this.rightDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t('el.datepicker.month' + (this.rightDate.getMonth() + 1));
- },
- leftYear: function leftYear() {
- return this.date.getFullYear();
- },
- leftMonth: function leftMonth() {
- return this.date.getMonth();
- },
- rightYear: function rightYear() {
- return this.rightDate.getFullYear();
- },
- rightMonth: function rightMonth() {
- return this.rightDate.getMonth();
- },
- minVisibleDate: function minVisibleDate() {
- return this.minDate ? (0, _util.formatDate)(this.minDate) : '';
- },
- maxVisibleDate: function maxVisibleDate() {
- return this.maxDate || this.minDate ? (0, _util.formatDate)(this.maxDate || this.minDate) : '';
- },
- minVisibleTime: function minVisibleTime() {
- return this.minDate ? (0, _util.formatDate)(this.minDate, 'HH:mm:ss') : '';
- },
- maxVisibleTime: function maxVisibleTime() {
- return this.maxDate || this.minDate ? (0, _util.formatDate)(this.maxDate || this.minDate, 'HH:mm:ss') : '';
- },
- rightDate: function rightDate() {
- var newDate = new Date(this.date);
- var month = newDate.getMonth();
- newDate.setDate(1);
- if (month === 11) {
- newDate.setFullYear(newDate.getFullYear() + 1);
- newDate.setMonth(0);
- } else {
- newDate.setMonth(month + 1);
- }
- return newDate;
- }
- },
- data: function data() {
- return {
- popperClass: '',
- minPickerWidth: 0,
- maxPickerWidth: 0,
- date: new Date(),
- minDate: '',
- maxDate: '',
- rangeState: {
- endDate: null,
- selecting: false,
- row: null,
- column: null
- },
- showTime: false,
- shortcuts: '',
- value: '',
- visible: '',
- disabledDate: '',
- firstDayOfWeek: 7,
- minTimePickerVisible: false,
- maxTimePickerVisible: false,
- width: 0
- };
- },
- watch: {
- showTime: function showTime(val) {
- var _this = this;
- if (!val) return;
- this.$nextTick(function (_) {
- var minInputElm = _this.$refs.minInput.$el;
- var maxInputElm = _this.$refs.maxInput.$el;
- if (minInputElm) {
- _this.minPickerWidth = minInputElm.getBoundingClientRect().width + 10;
- }
- if (maxInputElm) {
- _this.maxPickerWidth = maxInputElm.getBoundingClientRect().width + 10;
- }
- });
- },
- minDate: function minDate() {
- var _this2 = this;
- this.$nextTick(function () {
- if (_this2.maxDate && _this2.maxDate < _this2.minDate) {
- var format = 'HH:mm:ss';
- _this2.$refs.maxTimePicker.selectableRange = [[(0, _util.parseDate)((0, _util.formatDate)(_this2.minDate, format), format), (0, _util.parseDate)('23:59:59', format)]];
- }
- });
- },
- minTimePickerVisible: function minTimePickerVisible(val) {
- var _this3 = this;
- if (val) this.$nextTick(function () {
- return _this3.$refs.minTimePicker.ajustScrollTop();
- });
- },
- maxTimePickerVisible: function maxTimePickerVisible(val) {
- var _this4 = this;
- if (val) this.$nextTick(function () {
- return _this4.$refs.maxTimePicker.ajustScrollTop();
- });
- },
- value: function value(newVal) {
- if (!newVal) {
- this.minDate = null;
- this.maxDate = null;
- } else if (Array.isArray(newVal)) {
- this.minDate = newVal[0] ? (0, _util.toDate)(newVal[0]) : null;
- this.maxDate = newVal[1] ? (0, _util.toDate)(newVal[1]) : null;
- if (this.minDate) this.date = new Date(this.minDate);
- this.handleConfirm(true);
- }
- }
- },
- methods: {
- handleClear: function handleClear() {
- this.minDate = null;
- this.maxDate = null;
- this.handleConfirm(false);
- },
- handleDateInput: function handleDateInput(event, type) {
- var value = event.target.value;
- var parsedValue = (0, _util.parseDate)(value, 'yyyy-MM-dd');
- if (parsedValue) {
- if (typeof this.disabledDate === 'function' && this.disabledDate(new Date(parsedValue))) {
- return;
- }
- var target = new Date(type === 'min' ? this.minDate : this.maxDate);
- if (target) {
- target.setFullYear(parsedValue.getFullYear());
- target.setMonth(parsedValue.getMonth(), parsedValue.getDate());
- }
- }
- },
- handleChangeRange: function handleChangeRange(val) {
- this.minDate = val.minDate;
- this.maxDate = val.maxDate;
- this.rangeState = val.rangeState;
- },
- handleDateChange: function handleDateChange(event, type) {
- var value = event.target.value;
- var parsedValue = (0, _util.parseDate)(value, 'yyyy-MM-dd');
- if (parsedValue) {
- var target = new Date(type === 'min' ? this.minDate : this.maxDate);
- if (target) {
- target.setFullYear(parsedValue.getFullYear());
- target.setMonth(parsedValue.getMonth(), parsedValue.getDate());
- }
- if (type === 'min') {
- if (target < this.maxDate) {
- this.minDate = new Date(target.getTime());
- }
- } else {
- if (target > this.minDate) {
- this.maxDate = new Date(target.getTime());
- if (this.minDate && this.minDate > this.maxDate) {
- this.minDate = null;
- }
- }
- }
- }
- },
- handleTimeChange: function handleTimeChange(event, type) {
- var value = event.target.value;
- var parsedValue = (0, _util.parseDate)(value, 'HH:mm:ss');
- if (parsedValue) {
- var target = new Date(type === 'min' ? this.minDate : this.maxDate);
- if (target) {
- target.setHours(parsedValue.getHours());
- target.setMinutes(parsedValue.getMinutes());
- target.setSeconds(parsedValue.getSeconds());
- }
- if (type === 'min') {
- if (target < this.maxDate) {
- this.minDate = new Date(target.getTime());
- }
- } else {
- if (target > this.minDate) {
- this.maxDate = new Date(target.getTime());
- }
- }
- this.$refs[type + 'TimePicker'].value = target;
- this[type + 'TimePickerVisible'] = false;
- }
- },
- handleRangePick: function handleRangePick(val) {
- var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
- if (this.maxDate === val.maxDate && this.minDate === val.minDate) {
- return;
- }
- this.onPick && this.onPick(val);
- this.maxDate = val.maxDate;
- this.minDate = val.minDate;
- if (!close || this.showTime) return;
- this.handleConfirm();
- },
- changeToToday: function changeToToday() {
- this.date = new Date();
- },
- handleShortcutClick: function handleShortcutClick(shortcut) {
- if (shortcut.onClick) {
- shortcut.onClick(this);
- }
- },
- resetView: function resetView() {
- this.minTimePickerVisible = false;
- this.maxTimePickerVisible = false;
- },
- setTime: function setTime(date, value) {
- var oldDate = new Date(date.getTime());
- var hour = value.getHours();
- var minute = value.getMinutes();
- var second = value.getSeconds();
- oldDate.setHours(hour);
- oldDate.setMinutes(minute);
- oldDate.setSeconds(second);
- return new Date(oldDate.getTime());
- },
- handleMinTimePick: function handleMinTimePick(value, visible, first) {
- this.minDate = this.minDate || new Date();
- if (value) {
- this.minDate = this.setTime(this.minDate, value);
- }
- if (!first) {
- this.minTimePickerVisible = visible;
- }
- },
- handleMaxTimePick: function handleMaxTimePick(value, visible, first) {
- if (!this.maxDate) {
- var now = new Date();
- if (now >= this.minDate) {
- this.maxDate = new Date();
- }
- }
- if (this.maxDate && value) {
- this.maxDate = this.setTime(this.maxDate, value);
- }
- if (!first) {
- this.maxTimePickerVisible = visible;
- }
- },
- prevMonth: function prevMonth() {
- this.date = (0, _util.prevMonth)(this.date);
- },
- nextMonth: function nextMonth() {
- this.date = (0, _util.nextMonth)(this.date);
- },
- nextYear: function nextYear() {
- var date = this.date;
- date.setFullYear(date.getFullYear() + 1);
- this.resetDate();
- },
- prevYear: function prevYear() {
- var date = this.date;
- date.setFullYear(date.getFullYear() - 1);
- this.resetDate();
- },
- handleConfirm: function handleConfirm() {
- var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- this.$emit('pick', [this.minDate, this.maxDate], visible);
- },
- resetDate: function resetDate() {
- this.date = new Date(this.date);
- }
- },
- components: { TimePicker: _time2.default, DateTable: _dateTable2.default, ElInput: _input2.default }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- /***/ },
- /* 128 */
- /***/ function(module, exports) {
- module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('transition', {
- attrs: {
- "name": "el-zoom-in-top"
- },
- on: {
- "after-leave": function($event) {
- _vm.$emit('dodestroy')
- }
- }
- }, [_c('div', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.visible),
- expression: "visible"
- }],
- staticClass: "el-picker-panel el-date-range-picker",
- class: [{
- 'has-sidebar': _vm.$slots.sidebar || _vm.shortcuts,
- 'has-time': _vm.showTime
- }, _vm.popperClass],
- style: ({
- width: _vm.width + 'px'
- })
- }, [_c('div', {
- staticClass: "el-picker-panel__body-wrapper"
- }, [_vm._t("sidebar"), (_vm.shortcuts) ? _c('div', {
- staticClass: "el-picker-panel__sidebar"
- }, _vm._l((_vm.shortcuts), function(shortcut) {
- return _c('button', {
- staticClass: "el-picker-panel__shortcut",
- attrs: {
- "type": "button"
- },
- on: {
- "click": function($event) {
- _vm.handleShortcutClick(shortcut)
- }
- }
- }, [_vm._v(_vm._s(shortcut.text))])
- })) : _vm._e(), _c('div', {
- staticClass: "el-picker-panel__body"
- }, [(_vm.showTime) ? _c('div', {
- staticClass: "el-date-range-picker__time-header"
- }, [_c('span', {
- staticClass: "el-date-range-picker__editors-wrap"
- }, [_c('span', {
- staticClass: "el-date-range-picker__time-picker-wrap"
- }, [_c('el-input', {
- ref: "minInput",
- staticClass: "el-date-range-picker__editor",
- attrs: {
- "size": "small",
- "placeholder": _vm.t('el.datepicker.startDate'),
- "value": _vm.minVisibleDate
- },
- nativeOn: {
- "input": function($event) {
- _vm.handleDateInput($event, 'min')
- },
- "change": function($event) {
- _vm.handleDateChange($event, 'min')
- }
- }
- })], 1), _c('span', {
- staticClass: "el-date-range-picker__time-picker-wrap"
- }, [_c('el-input', {
- staticClass: "el-date-range-picker__editor",
- attrs: {
- "size": "small",
- "placeholder": _vm.t('el.datepicker.startTime'),
- "value": _vm.minVisibleTime
- },
- on: {
- "focus": function($event) {
- _vm.minTimePickerVisible = !_vm.minTimePickerVisible
- }
- },
- nativeOn: {
- "change": function($event) {
- _vm.handleTimeChange($event, 'min')
- }
- }
- }), _c('time-picker', {
- ref: "minTimePicker",
- attrs: {
- "picker-width": _vm.minPickerWidth,
- "date": _vm.minDate,
- "visible": _vm.minTimePickerVisible
- },
- on: {
- "pick": _vm.handleMinTimePick
- }
- })], 1)]), _c('span', {
- staticClass: "el-icon-arrow-right"
- }), _c('span', {
- staticClass: "el-date-range-picker__editors-wrap is-right"
- }, [_c('span', {
- staticClass: "el-date-range-picker__time-picker-wrap"
- }, [_c('el-input', {
- staticClass: "el-date-range-picker__editor",
- attrs: {
- "size": "small",
- "placeholder": _vm.t('el.datepicker.endDate'),
- "value": _vm.maxVisibleDate,
- "readonly": !_vm.minDate
- },
- nativeOn: {
- "input": function($event) {
- _vm.handleDateInput($event, 'max')
- },
- "change": function($event) {
- _vm.handleDateChange($event, 'max')
- }
- }
- })], 1), _c('span', {
- staticClass: "el-date-range-picker__time-picker-wrap"
- }, [_c('el-input', {
- ref: "maxInput",
- staticClass: "el-date-range-picker__editor",
- attrs: {
- "size": "small",
- "placeholder": _vm.t('el.datepicker.endTime'),
- "value": _vm.maxVisibleTime,
- "readonly": !_vm.minDate
- },
- on: {
- "focus": function($event) {
- _vm.minDate && (_vm.maxTimePickerVisible = !_vm.maxTimePickerVisible)
- }
- },
- nativeOn: {
- "change": function($event) {
- _vm.handleTimeChange($event, 'max')
- }
- }
- }), _c('time-picker', {
- ref: "maxTimePicker",
- attrs: {
- "picker-width": _vm.maxPickerWidth,
- "date": _vm.maxDate,
- "visible": _vm.maxTimePickerVisible
- },
- on: {
- "pick": _vm.handleMaxTimePick
- }
- })], 1)])]) : _vm._e(), _c('div', {
- staticClass: "el-picker-panel__content el-date-range-picker__content is-left"
- }, [_c('div', {
- staticClass: "el-date-range-picker__header"
- }, [_c('button', {
- staticClass: "el-picker-panel__icon-btn el-icon-d-arrow-left",
- attrs: {
- "type": "button"
- },
- on: {
- "click": _vm.prevYear
- }
- }), _c('button', {
- staticClass: "el-picker-panel__icon-btn el-icon-arrow-left",
- attrs: {
- "type": "button"
- },
- on: {
- "click": _vm.prevMonth
- }
- }), _c('div', [_vm._v(_vm._s(_vm.leftLabel))])]), _c('date-table', {
- attrs: {
- "selection-mode": "range",
- "date": _vm.date,
- "year": _vm.leftYear,
- "month": _vm.leftMonth,
- "min-date": _vm.minDate,
- "max-date": _vm.maxDate,
- "range-state": _vm.rangeState,
- "disabled-date": _vm.disabledDate,
- "first-day-of-week": _vm.firstDayOfWeek
- },
- on: {
- "changerange": _vm.handleChangeRange,
- "pick": _vm.handleRangePick
- }
- })], 1), _c('div', {
- staticClass: "el-picker-panel__content el-date-range-picker__content is-right"
- }, [_c('div', {
- staticClass: "el-date-range-picker__header"
- }, [_c('button', {
- staticClass: "el-picker-panel__icon-btn el-icon-d-arrow-right",
- attrs: {
- "type": "button"
- },
- on: {
- "click": _vm.nextYear
- }
- }), _c('button', {
- staticClass: "el-picker-panel__icon-btn el-icon-arrow-right",
- attrs: {
- "type": "button"
- },
- on: {
- "click": _vm.nextMonth
- }
- }), _c('div', [_vm._v(_vm._s(_vm.rightLabel))])]), _c('date-table', {
- attrs: {
- "selection-mode": "range",
- "date": _vm.rightDate,
- "year": _vm.rightYear,
- "month": _vm.rightMonth,
- "min-date": _vm.minDate,
- "max-date": _vm.maxDate,
- "range-state": _vm.rangeState,
- "disabled-date": _vm.disabledDate,
- "first-day-of-week": _vm.firstDayOfWeek
- },
- on: {
- "changerange": _vm.handleChangeRange,
- "pick": _vm.handleRangePick
- }
- })], 1)])], 2), (_vm.showTime) ? _c('div', {
- staticClass: "el-picker-panel__footer"
- }, [_c('a', {
- staticClass: "el-picker-panel__link-btn",
- on: {
- "click": _vm.handleClear
- }
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.clear')))]), _c('button', {
- staticClass: "el-picker-panel__btn",
- attrs: {
- "type": "button",
- "disabled": _vm.btnDisabled
- },
- on: {
- "click": function($event) {
- _vm.handleConfirm()
- }
- }
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.confirm')))])]) : _vm._e()])])
- },staticRenderFns: []}
- /***/ }
- /******/ ]);
|