time-picker.js 80 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, {
  41. /******/ configurable: false,
  42. /******/ enumerable: true,
  43. /******/ get: getter
  44. /******/ });
  45. /******/ }
  46. /******/ };
  47. /******/
  48. /******/ // getDefaultExport function for compatibility with non-harmony modules
  49. /******/ __webpack_require__.n = function(module) {
  50. /******/ var getter = module && module.__esModule ?
  51. /******/ function getDefault() { return module['default']; } :
  52. /******/ function getModuleExports() { return module; };
  53. /******/ __webpack_require__.d(getter, 'a', getter);
  54. /******/ return getter;
  55. /******/ };
  56. /******/
  57. /******/ // Object.prototype.hasOwnProperty.call
  58. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  59. /******/
  60. /******/ // __webpack_public_path__
  61. /******/ __webpack_require__.p = "/dist/";
  62. /******/
  63. /******/ // Load entry module and return exports
  64. /******/ return __webpack_require__(__webpack_require__.s = 197);
  65. /******/ })
  66. /************************************************************************/
  67. /******/ ({
  68. /***/ 0:
  69. /***/ (function(module, exports) {
  70. /* globals __VUE_SSR_CONTEXT__ */
  71. // IMPORTANT: Do NOT use ES2015 features in this file.
  72. // This module is a runtime utility for cleaner component module output and will
  73. // be included in the final webpack user bundle.
  74. module.exports = function normalizeComponent (
  75. rawScriptExports,
  76. compiledTemplate,
  77. functionalTemplate,
  78. injectStyles,
  79. scopeId,
  80. moduleIdentifier /* server only */
  81. ) {
  82. var esModule
  83. var scriptExports = rawScriptExports = rawScriptExports || {}
  84. // ES6 modules interop
  85. var type = typeof rawScriptExports.default
  86. if (type === 'object' || type === 'function') {
  87. esModule = rawScriptExports
  88. scriptExports = rawScriptExports.default
  89. }
  90. // Vue.extend constructor export interop
  91. var options = typeof scriptExports === 'function'
  92. ? scriptExports.options
  93. : scriptExports
  94. // render functions
  95. if (compiledTemplate) {
  96. options.render = compiledTemplate.render
  97. options.staticRenderFns = compiledTemplate.staticRenderFns
  98. options._compiled = true
  99. }
  100. // functional template
  101. if (functionalTemplate) {
  102. options.functional = true
  103. }
  104. // scopedId
  105. if (scopeId) {
  106. options._scopeId = scopeId
  107. }
  108. var hook
  109. if (moduleIdentifier) { // server build
  110. hook = function (context) {
  111. // 2.3 injection
  112. context =
  113. context || // cached call
  114. (this.$vnode && this.$vnode.ssrContext) || // stateful
  115. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  116. // 2.2 with runInNewContext: true
  117. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  118. context = __VUE_SSR_CONTEXT__
  119. }
  120. // inject component styles
  121. if (injectStyles) {
  122. injectStyles.call(this, context)
  123. }
  124. // register component module identifier for async chunk inferrence
  125. if (context && context._registeredComponents) {
  126. context._registeredComponents.add(moduleIdentifier)
  127. }
  128. }
  129. // used by ssr in case component is cached and beforeCreate
  130. // never gets called
  131. options._ssrRegister = hook
  132. } else if (injectStyles) {
  133. hook = injectStyles
  134. }
  135. if (hook) {
  136. var functional = options.functional
  137. var existing = functional
  138. ? options.render
  139. : options.beforeCreate
  140. if (!functional) {
  141. // inject component registration as beforeCreate hook
  142. options.beforeCreate = existing
  143. ? [].concat(existing, hook)
  144. : [hook]
  145. } else {
  146. // for template-only hot-reload because in that case the render fn doesn't
  147. // go through the normalizer
  148. options._injectStyles = hook
  149. // register for functioal component in vue file
  150. options.render = function renderWithStyleInjection (h, context) {
  151. hook.call(context)
  152. return existing(h, context)
  153. }
  154. }
  155. }
  156. return {
  157. esModule: esModule,
  158. exports: scriptExports,
  159. options: options
  160. }
  161. }
  162. /***/ }),
  163. /***/ 1:
  164. /***/ (function(module, exports) {
  165. module.exports = require("element-ui/lib/mixins/emitter");
  166. /***/ }),
  167. /***/ 10:
  168. /***/ (function(module, exports) {
  169. module.exports = require("element-ui/lib/utils/clickoutside");
  170. /***/ }),
  171. /***/ 11:
  172. /***/ (function(module, exports, __webpack_require__) {
  173. "use strict";
  174. exports.__esModule = true;
  175. exports.extractTimeFormat = exports.extractDateFormat = exports.nextYear = exports.prevYear = exports.nextMonth = exports.prevMonth = exports.changeYearMonthAndClampDate = exports.timeWithinRange = exports.limitTimeRange = exports.clearMilliseconds = exports.clearTime = exports.modifyWithTimeString = exports.modifyTime = exports.modifyDate = exports.range = exports.getRangeMinutes = exports.getRangeHours = exports.getWeekNumber = exports.getStartDateOfMonth = exports.nextDate = exports.prevDate = exports.getFirstDayOfMonth = exports.getDayCountOfYear = exports.getDayCountOfMonth = exports.parseDate = exports.formatDate = exports.isDateObject = exports.isDate = exports.toDate = undefined;
  176. var _date = __webpack_require__(29);
  177. var _date2 = _interopRequireDefault(_date);
  178. var _locale = __webpack_require__(12);
  179. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  180. var weeks = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
  181. var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
  182. var getI18nSettings = function getI18nSettings() {
  183. return {
  184. dayNamesShort: weeks.map(function (week) {
  185. return (0, _locale.t)('el.datepicker.weeks.' + week);
  186. }),
  187. dayNames: weeks.map(function (week) {
  188. return (0, _locale.t)('el.datepicker.weeks.' + week);
  189. }),
  190. monthNamesShort: months.map(function (month) {
  191. return (0, _locale.t)('el.datepicker.months.' + month);
  192. }),
  193. monthNames: months.map(function (month, index) {
  194. return (0, _locale.t)('el.datepicker.month' + (index + 1));
  195. }),
  196. amPm: ['am', 'pm']
  197. };
  198. };
  199. var newArray = function newArray(start, end) {
  200. var result = [];
  201. for (var i = start; i <= end; i++) {
  202. result.push(i);
  203. }
  204. return result;
  205. };
  206. var toDate = exports.toDate = function toDate(date) {
  207. return isDate(date) ? new Date(date) : null;
  208. };
  209. var isDate = exports.isDate = function isDate(date) {
  210. if (date === null || date === undefined) return false;
  211. if (isNaN(new Date(date).getTime())) return false;
  212. if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
  213. return true;
  214. };
  215. var isDateObject = exports.isDateObject = function isDateObject(val) {
  216. return val instanceof Date;
  217. };
  218. var formatDate = exports.formatDate = function formatDate(date, format) {
  219. date = toDate(date);
  220. if (!date) return '';
  221. return _date2.default.format(date, format || 'yyyy-MM-dd', getI18nSettings());
  222. };
  223. var parseDate = exports.parseDate = function parseDate(string, format) {
  224. return _date2.default.parse(string, format || 'yyyy-MM-dd', getI18nSettings());
  225. };
  226. var getDayCountOfMonth = exports.getDayCountOfMonth = function getDayCountOfMonth(year, month) {
  227. if (month === 3 || month === 5 || month === 8 || month === 10) {
  228. return 30;
  229. }
  230. if (month === 1) {
  231. if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
  232. return 29;
  233. } else {
  234. return 28;
  235. }
  236. }
  237. return 31;
  238. };
  239. var getDayCountOfYear = exports.getDayCountOfYear = function getDayCountOfYear(year) {
  240. var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
  241. return isLeapYear ? 366 : 365;
  242. };
  243. var getFirstDayOfMonth = exports.getFirstDayOfMonth = function getFirstDayOfMonth(date) {
  244. var temp = new Date(date.getTime());
  245. temp.setDate(1);
  246. return temp.getDay();
  247. };
  248. // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
  249. // {prev, next} Date should work for Daylight Saving Time
  250. // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
  251. var prevDate = exports.prevDate = function prevDate(date) {
  252. var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  253. return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
  254. };
  255. var nextDate = exports.nextDate = function nextDate(date) {
  256. var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  257. return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
  258. };
  259. var getStartDateOfMonth = exports.getStartDateOfMonth = function getStartDateOfMonth(year, month) {
  260. var result = new Date(year, month, 1);
  261. var day = result.getDay();
  262. if (day === 0) {
  263. return prevDate(result, 7);
  264. } else {
  265. return prevDate(result, day);
  266. }
  267. };
  268. var getWeekNumber = exports.getWeekNumber = function getWeekNumber(src) {
  269. if (!isDate(src)) return null;
  270. var date = new Date(src.getTime());
  271. date.setHours(0, 0, 0, 0);
  272. // Thursday in current week decides the year.
  273. date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
  274. // January 4 is always in week 1.
  275. var week1 = new Date(date.getFullYear(), 0, 4);
  276. // Adjust to Thursday in week 1 and count number of weeks from date to week 1.
  277. // Rounding should be fine for Daylight Saving Time. Its shift should never be more than 12 hours.
  278. return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7);
  279. };
  280. var getRangeHours = exports.getRangeHours = function getRangeHours(ranges) {
  281. var hours = [];
  282. var disabledHours = [];
  283. (ranges || []).forEach(function (range) {
  284. var value = range.map(function (date) {
  285. return date.getHours();
  286. });
  287. disabledHours = disabledHours.concat(newArray(value[0], value[1]));
  288. });
  289. if (disabledHours.length) {
  290. for (var i = 0; i < 24; i++) {
  291. hours[i] = disabledHours.indexOf(i) === -1;
  292. }
  293. } else {
  294. for (var _i = 0; _i < 24; _i++) {
  295. hours[_i] = false;
  296. }
  297. }
  298. return hours;
  299. };
  300. function setRangeData(arr, start, end, value) {
  301. for (var i = start; i < end; i++) {
  302. arr[i] = value;
  303. }
  304. }
  305. var getRangeMinutes = exports.getRangeMinutes = function getRangeMinutes(ranges, hour) {
  306. var minutes = new Array(60);
  307. if (ranges.length > 0) {
  308. ranges.forEach(function (range) {
  309. var start = range[0];
  310. var end = range[1];
  311. var startHour = start.getHours();
  312. var startMinute = start.getMinutes();
  313. var endHour = end.getHours();
  314. var endMinute = end.getMinutes();
  315. if (startHour === hour && endHour !== hour) {
  316. setRangeData(minutes, startMinute, 60, true);
  317. } else if (startHour === hour && endHour === hour) {
  318. setRangeData(minutes, startMinute, endMinute + 1, true);
  319. } else if (startHour !== hour && endHour === hour) {
  320. setRangeData(minutes, 0, endMinute + 1, true);
  321. } else if (startHour < hour && endHour > hour) {
  322. setRangeData(minutes, 0, 60, true);
  323. }
  324. });
  325. } else {
  326. setRangeData(minutes, 0, 60, true);
  327. }
  328. return minutes;
  329. };
  330. var range = exports.range = function range(n) {
  331. // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
  332. return Array.apply(null, { length: n }).map(function (_, n) {
  333. return n;
  334. });
  335. };
  336. var modifyDate = exports.modifyDate = function modifyDate(date, y, m, d) {
  337. return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
  338. };
  339. var modifyTime = exports.modifyTime = function modifyTime(date, h, m, s) {
  340. return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
  341. };
  342. var modifyWithTimeString = exports.modifyWithTimeString = function modifyWithTimeString(date, time) {
  343. if (date == null || !time) {
  344. return date;
  345. }
  346. time = parseDate(time, 'HH:mm:ss');
  347. return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
  348. };
  349. var clearTime = exports.clearTime = function clearTime(date) {
  350. return new Date(date.getFullYear(), date.getMonth(), date.getDate());
  351. };
  352. var clearMilliseconds = exports.clearMilliseconds = function clearMilliseconds(date) {
  353. return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
  354. };
  355. var limitTimeRange = exports.limitTimeRange = function limitTimeRange(date, ranges) {
  356. var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
  357. // TODO: refactory a more elegant solution
  358. if (ranges.length === 0) return date;
  359. var normalizeDate = function normalizeDate(date) {
  360. return _date2.default.parse(_date2.default.format(date, format), format);
  361. };
  362. var ndate = normalizeDate(date);
  363. var nranges = ranges.map(function (range) {
  364. return range.map(normalizeDate);
  365. });
  366. if (nranges.some(function (nrange) {
  367. return ndate >= nrange[0] && ndate <= nrange[1];
  368. })) return date;
  369. var minDate = nranges[0][0];
  370. var maxDate = nranges[0][0];
  371. nranges.forEach(function (nrange) {
  372. minDate = new Date(Math.min(nrange[0], minDate));
  373. maxDate = new Date(Math.max(nrange[1], minDate));
  374. });
  375. var ret = ndate < minDate ? minDate : maxDate;
  376. // preserve Year/Month/Date
  377. return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
  378. };
  379. var timeWithinRange = exports.timeWithinRange = function timeWithinRange(date, selectableRange, format) {
  380. var limitedDate = limitTimeRange(date, selectableRange, format);
  381. return limitedDate.getTime() === date.getTime();
  382. };
  383. var changeYearMonthAndClampDate = exports.changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
  384. // clamp date to the number of days in `year`, `month`
  385. // eg: (2010-1-31, 2010, 2) => 2010-2-28
  386. var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
  387. return modifyDate(date, year, month, monthDate);
  388. };
  389. var prevMonth = exports.prevMonth = function prevMonth(date) {
  390. var year = date.getFullYear();
  391. var month = date.getMonth();
  392. return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
  393. };
  394. var nextMonth = exports.nextMonth = function nextMonth(date) {
  395. var year = date.getFullYear();
  396. var month = date.getMonth();
  397. return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
  398. };
  399. var prevYear = exports.prevYear = function prevYear(date) {
  400. var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  401. var year = date.getFullYear();
  402. var month = date.getMonth();
  403. return changeYearMonthAndClampDate(date, year - amount, month);
  404. };
  405. var nextYear = exports.nextYear = function nextYear(date) {
  406. var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  407. var year = date.getFullYear();
  408. var month = date.getMonth();
  409. return changeYearMonthAndClampDate(date, year + amount, month);
  410. };
  411. var extractDateFormat = exports.extractDateFormat = function extractDateFormat(format) {
  412. return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
  413. };
  414. var extractTimeFormat = exports.extractTimeFormat = function extractTimeFormat(format) {
  415. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
  416. };
  417. /***/ }),
  418. /***/ 12:
  419. /***/ (function(module, exports) {
  420. module.exports = require("element-ui/lib/locale");
  421. /***/ }),
  422. /***/ 17:
  423. /***/ (function(module, exports) {
  424. module.exports = require("element-ui/lib/scrollbar");
  425. /***/ }),
  426. /***/ 197:
  427. /***/ (function(module, exports, __webpack_require__) {
  428. "use strict";
  429. exports.__esModule = true;
  430. var _timePicker = __webpack_require__(198);
  431. var _timePicker2 = _interopRequireDefault(_timePicker);
  432. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  433. /* istanbul ignore next */
  434. _timePicker2.default.install = function (Vue) {
  435. Vue.component(_timePicker2.default.name, _timePicker2.default);
  436. };
  437. exports.default = _timePicker2.default;
  438. /***/ }),
  439. /***/ 198:
  440. /***/ (function(module, exports, __webpack_require__) {
  441. "use strict";
  442. exports.__esModule = true;
  443. var _picker = __webpack_require__(27);
  444. var _picker2 = _interopRequireDefault(_picker);
  445. var _time = __webpack_require__(31);
  446. var _time2 = _interopRequireDefault(_time);
  447. var _timeRange = __webpack_require__(199);
  448. var _timeRange2 = _interopRequireDefault(_timeRange);
  449. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  450. exports.default = {
  451. mixins: [_picker2.default],
  452. name: 'ElTimePicker',
  453. props: {
  454. isRange: Boolean,
  455. arrowControl: Boolean
  456. },
  457. data: function data() {
  458. return {
  459. type: ''
  460. };
  461. },
  462. watch: {
  463. isRange: function isRange(_isRange) {
  464. if (this.picker) {
  465. this.unmountPicker();
  466. this.type = _isRange ? 'timerange' : 'time';
  467. this.panel = _isRange ? _timeRange2.default : _time2.default;
  468. this.mountPicker();
  469. } else {
  470. this.type = _isRange ? 'timerange' : 'time';
  471. this.panel = _isRange ? _timeRange2.default : _time2.default;
  472. }
  473. }
  474. },
  475. created: function created() {
  476. this.type = this.isRange ? 'timerange' : 'time';
  477. this.panel = this.isRange ? _timeRange2.default : _time2.default;
  478. }
  479. };
  480. /***/ }),
  481. /***/ 199:
  482. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  483. "use strict";
  484. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  485. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_range_vue__ = __webpack_require__(200);
  486. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_range_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_range_vue__);
  487. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_a222ec54_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_time_range_vue__ = __webpack_require__(201);
  488. var normalizeComponent = __webpack_require__(0)
  489. /* script */
  490. /* template */
  491. /* template functional */
  492. var __vue_template_functional__ = false
  493. /* styles */
  494. var __vue_styles__ = null
  495. /* scopeId */
  496. var __vue_scopeId__ = null
  497. /* moduleIdentifier (server only) */
  498. var __vue_module_identifier__ = null
  499. var Component = normalizeComponent(
  500. __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_range_vue___default.a,
  501. __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_a222ec54_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_time_range_vue__["a" /* default */],
  502. __vue_template_functional__,
  503. __vue_styles__,
  504. __vue_scopeId__,
  505. __vue_module_identifier__
  506. )
  507. /* harmony default export */ __webpack_exports__["default"] = (Component.exports);
  508. /***/ }),
  509. /***/ 200:
  510. /***/ (function(module, exports, __webpack_require__) {
  511. "use strict";
  512. exports.__esModule = true;
  513. var _util = __webpack_require__(11);
  514. var _locale = __webpack_require__(5);
  515. var _locale2 = _interopRequireDefault(_locale);
  516. var _timeSpinner = __webpack_require__(32);
  517. var _timeSpinner2 = _interopRequireDefault(_timeSpinner);
  518. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  519. var MIN_TIME = (0, _util.parseDate)('00:00:00', 'HH:mm:ss'); //
  520. //
  521. //
  522. //
  523. //
  524. //
  525. //
  526. //
  527. //
  528. //
  529. //
  530. //
  531. //
  532. //
  533. //
  534. //
  535. //
  536. //
  537. //
  538. //
  539. //
  540. //
  541. //
  542. //
  543. //
  544. //
  545. //
  546. //
  547. //
  548. //
  549. //
  550. //
  551. //
  552. //
  553. //
  554. //
  555. //
  556. //
  557. //
  558. //
  559. //
  560. //
  561. //
  562. //
  563. //
  564. //
  565. //
  566. //
  567. //
  568. //
  569. //
  570. //
  571. //
  572. //
  573. //
  574. //
  575. //
  576. var MAX_TIME = (0, _util.parseDate)('23:59:59', 'HH:mm:ss');
  577. var minTimeOfDay = function minTimeOfDay(date) {
  578. return (0, _util.modifyDate)(MIN_TIME, date.getFullYear(), date.getMonth(), date.getDate());
  579. };
  580. var maxTimeOfDay = function maxTimeOfDay(date) {
  581. return (0, _util.modifyDate)(MAX_TIME, date.getFullYear(), date.getMonth(), date.getDate());
  582. };
  583. // increase time by amount of milliseconds, but within the range of day
  584. var advanceTime = function advanceTime(date, amount) {
  585. return new Date(Math.min(date.getTime() + amount, maxTimeOfDay(date).getTime()));
  586. };
  587. exports.default = {
  588. mixins: [_locale2.default],
  589. components: { TimeSpinner: _timeSpinner2.default },
  590. computed: {
  591. showSeconds: function showSeconds() {
  592. return (this.format || '').indexOf('ss') !== -1;
  593. },
  594. offset: function offset() {
  595. return this.showSeconds ? 11 : 8;
  596. },
  597. spinner: function spinner() {
  598. return this.selectionRange[0] < this.offset ? this.$refs.minSpinner : this.$refs.maxSpinner;
  599. },
  600. btnDisabled: function btnDisabled() {
  601. return this.minDate.getTime() > this.maxDate.getTime();
  602. },
  603. amPmMode: function amPmMode() {
  604. if ((this.format || '').indexOf('A') !== -1) return 'A';
  605. if ((this.format || '').indexOf('a') !== -1) return 'a';
  606. return '';
  607. }
  608. },
  609. data: function data() {
  610. return {
  611. popperClass: '',
  612. minDate: new Date(),
  613. maxDate: new Date(),
  614. value: [],
  615. oldValue: [new Date(), new Date()],
  616. defaultValue: null,
  617. format: 'HH:mm:ss',
  618. visible: false,
  619. selectionRange: [0, 2],
  620. arrowControl: false
  621. };
  622. },
  623. watch: {
  624. value: function value(_value) {
  625. if (Array.isArray(_value)) {
  626. this.minDate = new Date(_value[0]);
  627. this.maxDate = new Date(_value[1]);
  628. } else {
  629. if (Array.isArray(this.defaultValue)) {
  630. this.minDate = new Date(this.defaultValue[0]);
  631. this.maxDate = new Date(this.defaultValue[1]);
  632. } else if (this.defaultValue) {
  633. this.minDate = new Date(this.defaultValue);
  634. this.maxDate = advanceTime(new Date(this.defaultValue), 60 * 60 * 1000);
  635. } else {
  636. this.minDate = new Date();
  637. this.maxDate = advanceTime(new Date(), 60 * 60 * 1000);
  638. }
  639. }
  640. },
  641. visible: function visible(val) {
  642. var _this = this;
  643. if (val) {
  644. this.oldValue = this.value;
  645. this.$nextTick(function () {
  646. return _this.$refs.minSpinner.emitSelectRange('hours');
  647. });
  648. }
  649. }
  650. },
  651. methods: {
  652. handleClear: function handleClear() {
  653. this.$emit('pick', null);
  654. },
  655. handleCancel: function handleCancel() {
  656. this.$emit('pick', this.oldValue);
  657. },
  658. handleMinChange: function handleMinChange(date) {
  659. this.minDate = (0, _util.clearMilliseconds)(date);
  660. this.handleChange();
  661. },
  662. handleMaxChange: function handleMaxChange(date) {
  663. this.maxDate = (0, _util.clearMilliseconds)(date);
  664. this.handleChange();
  665. },
  666. handleChange: function handleChange() {
  667. if (this.isValidValue([this.minDate, this.maxDate])) {
  668. this.$refs.minSpinner.selectableRange = [[minTimeOfDay(this.minDate), this.maxDate]];
  669. this.$refs.maxSpinner.selectableRange = [[this.minDate, maxTimeOfDay(this.maxDate)]];
  670. this.$emit('pick', [this.minDate, this.maxDate], true);
  671. }
  672. },
  673. setMinSelectionRange: function setMinSelectionRange(start, end) {
  674. this.$emit('select-range', start, end, 'min');
  675. this.selectionRange = [start, end];
  676. },
  677. setMaxSelectionRange: function setMaxSelectionRange(start, end) {
  678. this.$emit('select-range', start, end, 'max');
  679. this.selectionRange = [start + this.offset, end + this.offset];
  680. },
  681. handleConfirm: function handleConfirm() {
  682. var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  683. var minSelectableRange = this.$refs.minSpinner.selectableRange;
  684. var maxSelectableRange = this.$refs.maxSpinner.selectableRange;
  685. this.minDate = (0, _util.limitTimeRange)(this.minDate, minSelectableRange, this.format);
  686. this.maxDate = (0, _util.limitTimeRange)(this.maxDate, maxSelectableRange, this.format);
  687. this.$emit('pick', [this.minDate, this.maxDate], visible);
  688. },
  689. adjustSpinners: function adjustSpinners() {
  690. this.$refs.minSpinner.adjustSpinners();
  691. this.$refs.maxSpinner.adjustSpinners();
  692. },
  693. changeSelectionRange: function changeSelectionRange(step) {
  694. var list = this.showSeconds ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  695. var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
  696. var index = list.indexOf(this.selectionRange[0]);
  697. var next = (index + step + list.length) % list.length;
  698. var half = list.length / 2;
  699. if (next < half) {
  700. this.$refs.minSpinner.emitSelectRange(mapping[next]);
  701. } else {
  702. this.$refs.maxSpinner.emitSelectRange(mapping[next - half]);
  703. }
  704. },
  705. isValidValue: function isValidValue(date) {
  706. return Array.isArray(date) && (0, _util.timeWithinRange)(this.minDate, this.$refs.minSpinner.selectableRange) && (0, _util.timeWithinRange)(this.maxDate, this.$refs.maxSpinner.selectableRange);
  707. },
  708. handleKeydown: function handleKeydown(event) {
  709. var keyCode = event.keyCode;
  710. var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
  711. // Left or Right
  712. if (keyCode === 37 || keyCode === 39) {
  713. var step = mapping[keyCode];
  714. this.changeSelectionRange(step);
  715. event.preventDefault();
  716. return;
  717. }
  718. // Up or Down
  719. if (keyCode === 38 || keyCode === 40) {
  720. var _step = mapping[keyCode];
  721. this.spinner.scrollDown(_step);
  722. event.preventDefault();
  723. return;
  724. }
  725. }
  726. }
  727. };
  728. /***/ }),
  729. /***/ 201:
  730. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  731. "use strict";
  732. var 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-time-range-picker el-picker-panel el-popper",class:_vm.popperClass},[_c('div',{staticClass:"el-time-range-picker__content"},[_c('div',{staticClass:"el-time-range-picker__cell"},[_c('div',{staticClass:"el-time-range-picker__header"},[_vm._v(_vm._s(_vm.t('el.datepicker.startTime')))]),_c('div',{staticClass:"el-time-range-picker__body el-time-panel__content",class:{ 'has-seconds': _vm.showSeconds, 'is-arrow': _vm.arrowControl }},[_c('time-spinner',{ref:"minSpinner",attrs:{"show-seconds":_vm.showSeconds,"am-pm-mode":_vm.amPmMode,"arrow-control":_vm.arrowControl,"date":_vm.minDate},on:{"change":_vm.handleMinChange,"select-range":_vm.setMinSelectionRange}})],1)]),_c('div',{staticClass:"el-time-range-picker__cell"},[_c('div',{staticClass:"el-time-range-picker__header"},[_vm._v(_vm._s(_vm.t('el.datepicker.endTime')))]),_c('div',{staticClass:"el-time-range-picker__body el-time-panel__content",class:{ 'has-seconds': _vm.showSeconds, 'is-arrow': _vm.arrowControl }},[_c('time-spinner',{ref:"maxSpinner",attrs:{"show-seconds":_vm.showSeconds,"am-pm-mode":_vm.amPmMode,"arrow-control":_vm.arrowControl,"date":_vm.maxDate},on:{"change":_vm.handleMaxChange,"select-range":_vm.setMaxSelectionRange}})],1)])]),_c('div',{staticClass:"el-time-panel__footer"},[_c('button',{staticClass:"el-time-panel__btn cancel",attrs:{"type":"button"},on:{"click":function($event){_vm.handleCancel()}}},[_vm._v(_vm._s(_vm.t('el.datepicker.cancel')))]),_c('button',{staticClass:"el-time-panel__btn confirm",attrs:{"type":"button","disabled":_vm.btnDisabled},on:{"click":function($event){_vm.handleConfirm()}}},[_vm._v(_vm._s(_vm.t('el.datepicker.confirm')))])])])])}
  733. var staticRenderFns = []
  734. var esExports = { render: render, staticRenderFns: staticRenderFns }
  735. /* harmony default export */ __webpack_exports__["a"] = (esExports);
  736. /***/ }),
  737. /***/ 24:
  738. /***/ (function(module, exports, __webpack_require__) {
  739. "use strict";
  740. exports.__esModule = true;
  741. var _dom = __webpack_require__(3);
  742. exports.default = {
  743. bind: function bind(el, binding, vnode) {
  744. var interval = null;
  745. var startTime = void 0;
  746. var handler = function handler() {
  747. return vnode.context[binding.expression].apply();
  748. };
  749. var clear = function clear() {
  750. if (new Date() - startTime < 100) {
  751. handler();
  752. }
  753. clearInterval(interval);
  754. interval = null;
  755. };
  756. (0, _dom.on)(el, 'mousedown', function (e) {
  757. if (e.button !== 0) return;
  758. startTime = new Date();
  759. (0, _dom.once)(document, 'mouseup', clear);
  760. clearInterval(interval);
  761. interval = setInterval(handler, 100);
  762. });
  763. }
  764. };
  765. /***/ }),
  766. /***/ 27:
  767. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  768. "use strict";
  769. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  770. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue__ = __webpack_require__(28);
  771. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue__);
  772. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_72d0c3bc_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_picker_vue__ = __webpack_require__(30);
  773. var normalizeComponent = __webpack_require__(0)
  774. /* script */
  775. /* template */
  776. /* template functional */
  777. var __vue_template_functional__ = false
  778. /* styles */
  779. var __vue_styles__ = null
  780. /* scopeId */
  781. var __vue_scopeId__ = null
  782. /* moduleIdentifier (server only) */
  783. var __vue_module_identifier__ = null
  784. var Component = normalizeComponent(
  785. __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue___default.a,
  786. __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_72d0c3bc_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_picker_vue__["a" /* default */],
  787. __vue_template_functional__,
  788. __vue_styles__,
  789. __vue_scopeId__,
  790. __vue_module_identifier__
  791. )
  792. /* harmony default export */ __webpack_exports__["default"] = (Component.exports);
  793. /***/ }),
  794. /***/ 28:
  795. /***/ (function(module, exports, __webpack_require__) {
  796. "use strict";
  797. exports.__esModule = true;
  798. var _vue = __webpack_require__(4);
  799. var _vue2 = _interopRequireDefault(_vue);
  800. var _clickoutside = __webpack_require__(10);
  801. var _clickoutside2 = _interopRequireDefault(_clickoutside);
  802. var _util = __webpack_require__(11);
  803. var _vuePopper = __webpack_require__(7);
  804. var _vuePopper2 = _interopRequireDefault(_vuePopper);
  805. var _emitter = __webpack_require__(1);
  806. var _emitter2 = _interopRequireDefault(_emitter);
  807. var _input = __webpack_require__(6);
  808. var _input2 = _interopRequireDefault(_input);
  809. var _merge = __webpack_require__(9);
  810. var _merge2 = _interopRequireDefault(_merge);
  811. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  812. var NewPopper = {
  813. props: {
  814. appendToBody: _vuePopper2.default.props.appendToBody,
  815. offset: _vuePopper2.default.props.offset,
  816. boundariesPadding: _vuePopper2.default.props.boundariesPadding,
  817. arrowOffset: _vuePopper2.default.props.arrowOffset
  818. },
  819. methods: _vuePopper2.default.methods,
  820. data: function data() {
  821. return (0, _merge2.default)({ visibleArrow: true }, _vuePopper2.default.data);
  822. },
  823. beforeDestroy: _vuePopper2.default.beforeDestroy
  824. }; //
  825. //
  826. //
  827. //
  828. //
  829. //
  830. //
  831. //
  832. //
  833. //
  834. //
  835. //
  836. //
  837. //
  838. //
  839. //
  840. //
  841. //
  842. //
  843. //
  844. //
  845. //
  846. //
  847. //
  848. //
  849. //
  850. //
  851. //
  852. //
  853. //
  854. //
  855. //
  856. //
  857. //
  858. //
  859. //
  860. //
  861. //
  862. //
  863. //
  864. //
  865. //
  866. //
  867. //
  868. //
  869. //
  870. //
  871. //
  872. //
  873. //
  874. //
  875. //
  876. //
  877. //
  878. //
  879. //
  880. //
  881. //
  882. //
  883. //
  884. //
  885. //
  886. //
  887. //
  888. //
  889. //
  890. //
  891. //
  892. //
  893. //
  894. //
  895. //
  896. //
  897. //
  898. //
  899. //
  900. //
  901. //
  902. //
  903. //
  904. //
  905. //
  906. //
  907. //
  908. //
  909. var DEFAULT_FORMATS = {
  910. date: 'yyyy-MM-dd',
  911. month: 'yyyy-MM',
  912. datetime: 'yyyy-MM-dd HH:mm:ss',
  913. time: 'HH:mm:ss',
  914. week: 'yyyywWW',
  915. timerange: 'HH:mm:ss',
  916. daterange: 'yyyy-MM-dd',
  917. datetimerange: 'yyyy-MM-dd HH:mm:ss',
  918. year: 'yyyy'
  919. };
  920. var HAVE_TRIGGER_TYPES = ['date', 'datetime', 'time', 'time-select', 'week', 'month', 'year', 'daterange', 'timerange', 'datetimerange', 'dates'];
  921. var DATE_FORMATTER = function DATE_FORMATTER(value, format) {
  922. if (format === 'timestamp') return value.getTime();
  923. return (0, _util.formatDate)(value, format);
  924. };
  925. var DATE_PARSER = function DATE_PARSER(text, format) {
  926. if (format === 'timestamp') return new Date(Number(text));
  927. return (0, _util.parseDate)(text, format);
  928. };
  929. var RANGE_FORMATTER = function RANGE_FORMATTER(value, format) {
  930. if (Array.isArray(value) && value.length === 2) {
  931. var start = value[0];
  932. var end = value[1];
  933. if (start && end) {
  934. return [DATE_FORMATTER(start, format), DATE_FORMATTER(end, format)];
  935. }
  936. }
  937. return '';
  938. };
  939. var RANGE_PARSER = function RANGE_PARSER(array, format, separator) {
  940. if (!Array.isArray(array)) {
  941. array = array.split(separator);
  942. }
  943. if (array.length === 2) {
  944. var range1 = array[0];
  945. var range2 = array[1];
  946. return [DATE_PARSER(range1, format), DATE_PARSER(range2, format)];
  947. }
  948. return [];
  949. };
  950. var TYPE_VALUE_RESOLVER_MAP = {
  951. default: {
  952. formatter: function formatter(value) {
  953. if (!value) return '';
  954. return '' + value;
  955. },
  956. parser: function parser(text) {
  957. if (text === undefined || text === '') return null;
  958. return text;
  959. }
  960. },
  961. week: {
  962. formatter: function formatter(value, format) {
  963. var week = (0, _util.getWeekNumber)(value);
  964. var month = value.getMonth();
  965. var trueDate = new Date(value);
  966. if (week === 1 && month === 11) {
  967. trueDate.setHours(0, 0, 0, 0);
  968. trueDate.setDate(trueDate.getDate() + 3 - (trueDate.getDay() + 6) % 7);
  969. }
  970. var date = (0, _util.formatDate)(trueDate, format);
  971. date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? '0' + week : week) : date.replace(/W/, week);
  972. return date;
  973. },
  974. parser: function parser(text) {
  975. var array = (text || '').split('w');
  976. if (array.length === 2) {
  977. var year = Number(array[0]);
  978. var month = Number(array[1]);
  979. if (!isNaN(year) && !isNaN(month) && month < 54) {
  980. return text;
  981. }
  982. }
  983. return null;
  984. }
  985. },
  986. date: {
  987. formatter: DATE_FORMATTER,
  988. parser: DATE_PARSER
  989. },
  990. datetime: {
  991. formatter: DATE_FORMATTER,
  992. parser: DATE_PARSER
  993. },
  994. daterange: {
  995. formatter: RANGE_FORMATTER,
  996. parser: RANGE_PARSER
  997. },
  998. datetimerange: {
  999. formatter: RANGE_FORMATTER,
  1000. parser: RANGE_PARSER
  1001. },
  1002. timerange: {
  1003. formatter: RANGE_FORMATTER,
  1004. parser: RANGE_PARSER
  1005. },
  1006. time: {
  1007. formatter: DATE_FORMATTER,
  1008. parser: DATE_PARSER
  1009. },
  1010. month: {
  1011. formatter: DATE_FORMATTER,
  1012. parser: DATE_PARSER
  1013. },
  1014. year: {
  1015. formatter: DATE_FORMATTER,
  1016. parser: DATE_PARSER
  1017. },
  1018. number: {
  1019. formatter: function formatter(value) {
  1020. if (!value) return '';
  1021. return '' + value;
  1022. },
  1023. parser: function parser(text) {
  1024. var result = Number(text);
  1025. if (!isNaN(text)) {
  1026. return result;
  1027. } else {
  1028. return null;
  1029. }
  1030. }
  1031. },
  1032. dates: {
  1033. formatter: function formatter(value, format) {
  1034. return value.map(function (date) {
  1035. return DATE_FORMATTER(date, format);
  1036. });
  1037. },
  1038. parser: function parser(value, format) {
  1039. return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
  1040. return date instanceof Date ? date : DATE_PARSER(date, format);
  1041. });
  1042. }
  1043. }
  1044. };
  1045. var PLACEMENT_MAP = {
  1046. left: 'bottom-start',
  1047. center: 'bottom',
  1048. right: 'bottom-end'
  1049. };
  1050. var parseAsFormatAndType = function parseAsFormatAndType(value, customFormat, type) {
  1051. var rangeSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '-';
  1052. if (!value) return null;
  1053. var parser = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).parser;
  1054. var format = customFormat || DEFAULT_FORMATS[type];
  1055. return parser(value, format, rangeSeparator);
  1056. };
  1057. var formatAsFormatAndType = function formatAsFormatAndType(value, customFormat, type) {
  1058. if (!value) return null;
  1059. var formatter = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).formatter;
  1060. var format = customFormat || DEFAULT_FORMATS[type];
  1061. return formatter(value, format);
  1062. };
  1063. /*
  1064. * Considers:
  1065. * 1. Date object
  1066. * 2. date string
  1067. * 3. array of 1 or 2
  1068. */
  1069. var valueEquals = function valueEquals(a, b) {
  1070. // considers Date object and string
  1071. var dateEquals = function dateEquals(a, b) {
  1072. var aIsDate = a instanceof Date;
  1073. var bIsDate = b instanceof Date;
  1074. if (aIsDate && bIsDate) {
  1075. return a.getTime() === b.getTime();
  1076. }
  1077. if (!aIsDate && !bIsDate) {
  1078. return a === b;
  1079. }
  1080. return false;
  1081. };
  1082. var aIsArray = a instanceof Array;
  1083. var bIsArray = b instanceof Array;
  1084. if (aIsArray && bIsArray) {
  1085. if (a.length !== b.length) {
  1086. return false;
  1087. }
  1088. return a.every(function (item, index) {
  1089. return dateEquals(item, b[index]);
  1090. });
  1091. }
  1092. if (!aIsArray && !bIsArray) {
  1093. return dateEquals(a, b);
  1094. }
  1095. return false;
  1096. };
  1097. var isString = function isString(val) {
  1098. return typeof val === 'string' || val instanceof String;
  1099. };
  1100. var validator = function validator(val) {
  1101. // either: String, Array of String, null / undefined
  1102. return val === null || val === undefined || isString(val) || Array.isArray(val) && val.length === 2 && val.every(isString);
  1103. };
  1104. exports.default = {
  1105. mixins: [_emitter2.default, NewPopper],
  1106. inject: {
  1107. elForm: {
  1108. default: ''
  1109. },
  1110. elFormItem: {
  1111. default: ''
  1112. }
  1113. },
  1114. props: {
  1115. size: String,
  1116. format: String,
  1117. valueFormat: String,
  1118. readonly: Boolean,
  1119. placeholder: String,
  1120. startPlaceholder: String,
  1121. endPlaceholder: String,
  1122. prefixIcon: String,
  1123. clearIcon: {
  1124. type: String,
  1125. default: 'el-icon-circle-close'
  1126. },
  1127. name: {
  1128. default: '',
  1129. validator: validator
  1130. },
  1131. disabled: Boolean,
  1132. clearable: {
  1133. type: Boolean,
  1134. default: true
  1135. },
  1136. id: {
  1137. default: '',
  1138. validator: validator
  1139. },
  1140. popperClass: String,
  1141. editable: {
  1142. type: Boolean,
  1143. default: true
  1144. },
  1145. align: {
  1146. type: String,
  1147. default: 'left'
  1148. },
  1149. value: {},
  1150. defaultValue: {},
  1151. defaultTime: {},
  1152. rangeSeparator: {
  1153. default: '-'
  1154. },
  1155. pickerOptions: {},
  1156. unlinkPanels: Boolean
  1157. },
  1158. components: { ElInput: _input2.default },
  1159. directives: { Clickoutside: _clickoutside2.default },
  1160. data: function data() {
  1161. return {
  1162. pickerVisible: false,
  1163. showClose: false,
  1164. userInput: null,
  1165. valueOnOpen: null, // value when picker opens, used to determine whether to emit change
  1166. unwatchPickerOptions: null
  1167. };
  1168. },
  1169. watch: {
  1170. pickerVisible: function pickerVisible(val) {
  1171. if (this.readonly || this.pickerDisabled) return;
  1172. if (val) {
  1173. this.showPicker();
  1174. this.valueOnOpen = Array.isArray(this.value) ? [].concat(this.value) : this.value;
  1175. } else {
  1176. this.hidePicker();
  1177. this.emitChange(this.value);
  1178. this.userInput = null;
  1179. this.dispatch('ElFormItem', 'el.form.blur');
  1180. this.$emit('blur', this);
  1181. this.blur();
  1182. }
  1183. },
  1184. parsedValue: {
  1185. immediate: true,
  1186. handler: function handler(val) {
  1187. if (this.picker) {
  1188. this.picker.value = val;
  1189. }
  1190. }
  1191. },
  1192. defaultValue: function defaultValue(val) {
  1193. // NOTE: should eventually move to jsx style picker + panel ?
  1194. if (this.picker) {
  1195. this.picker.defaultValue = val;
  1196. }
  1197. },
  1198. value: function value(val, oldVal) {
  1199. if (!valueEquals(val, oldVal) && !this.pickerVisible) {
  1200. this.dispatch('ElFormItem', 'el.form.change', val);
  1201. }
  1202. }
  1203. },
  1204. computed: {
  1205. ranged: function ranged() {
  1206. return this.type.indexOf('range') > -1;
  1207. },
  1208. reference: function reference() {
  1209. var reference = this.$refs.reference;
  1210. return reference.$el || reference;
  1211. },
  1212. refInput: function refInput() {
  1213. if (this.reference) {
  1214. return [].slice.call(this.reference.querySelectorAll('input'));
  1215. }
  1216. return [];
  1217. },
  1218. valueIsEmpty: function valueIsEmpty() {
  1219. var val = this.value;
  1220. if (Array.isArray(val)) {
  1221. for (var i = 0, len = val.length; i < len; i++) {
  1222. if (val[i]) {
  1223. return false;
  1224. }
  1225. }
  1226. } else {
  1227. if (val) {
  1228. return false;
  1229. }
  1230. }
  1231. return true;
  1232. },
  1233. triggerClass: function triggerClass() {
  1234. return this.prefixIcon || (this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date');
  1235. },
  1236. selectionMode: function selectionMode() {
  1237. if (this.type === 'week') {
  1238. return 'week';
  1239. } else if (this.type === 'month') {
  1240. return 'month';
  1241. } else if (this.type === 'year') {
  1242. return 'year';
  1243. } else if (this.type === 'dates') {
  1244. return 'dates';
  1245. }
  1246. return 'day';
  1247. },
  1248. haveTrigger: function haveTrigger() {
  1249. if (typeof this.showTrigger !== 'undefined') {
  1250. return this.showTrigger;
  1251. }
  1252. return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
  1253. },
  1254. displayValue: function displayValue() {
  1255. var formattedValue = formatAsFormatAndType(this.parsedValue, this.format, this.type, this.rangeSeparator);
  1256. if (Array.isArray(this.userInput)) {
  1257. return [this.userInput[0] || formattedValue && formattedValue[0] || '', this.userInput[1] || formattedValue && formattedValue[1] || ''];
  1258. } else if (this.userInput !== null) {
  1259. return this.userInput;
  1260. } else if (formattedValue) {
  1261. return this.type === 'dates' ? formattedValue.join(', ') : formattedValue;
  1262. } else {
  1263. return '';
  1264. }
  1265. },
  1266. parsedValue: function parsedValue() {
  1267. if (!this.value) return this.value; // component value is not set
  1268. if (this.type === 'time-select') return this.value; // time-select does not require parsing, this might change in next major version
  1269. var valueIsDateObject = (0, _util.isDateObject)(this.value) || Array.isArray(this.value) && this.value.every(_util.isDateObject);
  1270. if (valueIsDateObject) {
  1271. return this.value;
  1272. }
  1273. if (this.valueFormat) {
  1274. return parseAsFormatAndType(this.value, this.valueFormat, this.type, this.rangeSeparator) || this.value;
  1275. }
  1276. // NOTE: deal with common but incorrect usage, should remove in next major version
  1277. // user might provide string / timestamp without value-format, coerce them into date (or array of date)
  1278. return Array.isArray(this.value) ? this.value.map(function (val) {
  1279. return new Date(val);
  1280. }) : new Date(this.value);
  1281. },
  1282. _elFormItemSize: function _elFormItemSize() {
  1283. return (this.elFormItem || {}).elFormItemSize;
  1284. },
  1285. pickerSize: function pickerSize() {
  1286. return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
  1287. },
  1288. pickerDisabled: function pickerDisabled() {
  1289. return this.disabled || (this.elForm || {}).disabled;
  1290. },
  1291. firstInputId: function firstInputId() {
  1292. var obj = {};
  1293. var id = void 0;
  1294. if (this.ranged) {
  1295. id = this.id && this.id[0];
  1296. } else {
  1297. id = this.id;
  1298. }
  1299. if (id) obj.id = id;
  1300. return obj;
  1301. },
  1302. secondInputId: function secondInputId() {
  1303. var obj = {};
  1304. var id = void 0;
  1305. if (this.ranged) {
  1306. id = this.id && this.id[1];
  1307. }
  1308. if (id) obj.id = id;
  1309. return obj;
  1310. }
  1311. },
  1312. created: function created() {
  1313. // vue-popper
  1314. this.popperOptions = {
  1315. boundariesPadding: 0,
  1316. gpuAcceleration: false
  1317. };
  1318. this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
  1319. this.$on('fieldReset', this.handleFieldReset);
  1320. },
  1321. methods: {
  1322. focus: function focus() {
  1323. if (!this.ranged) {
  1324. this.$refs.reference.focus();
  1325. } else {
  1326. this.handleFocus();
  1327. }
  1328. },
  1329. blur: function blur() {
  1330. this.refInput.forEach(function (input) {
  1331. return input.blur();
  1332. });
  1333. },
  1334. // {parse, formatTo} Value deals maps component value with internal Date
  1335. parseValue: function parseValue(value) {
  1336. var isParsed = (0, _util.isDateObject)(value) || Array.isArray(value) && value.every(_util.isDateObject);
  1337. if (this.valueFormat && !isParsed) {
  1338. return parseAsFormatAndType(value, this.valueFormat, this.type, this.rangeSeparator) || value;
  1339. } else {
  1340. return value;
  1341. }
  1342. },
  1343. formatToValue: function formatToValue(date) {
  1344. var isFormattable = (0, _util.isDateObject)(date) || Array.isArray(date) && date.every(_util.isDateObject);
  1345. if (this.valueFormat && isFormattable) {
  1346. return formatAsFormatAndType(date, this.valueFormat, this.type, this.rangeSeparator);
  1347. } else {
  1348. return date;
  1349. }
  1350. },
  1351. // {parse, formatTo} String deals with user input
  1352. parseString: function parseString(value) {
  1353. var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
  1354. return parseAsFormatAndType(value, this.format, type);
  1355. },
  1356. formatToString: function formatToString(value) {
  1357. var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
  1358. return formatAsFormatAndType(value, this.format, type);
  1359. },
  1360. handleMouseEnter: function handleMouseEnter() {
  1361. if (this.readonly || this.pickerDisabled) return;
  1362. if (!this.valueIsEmpty && this.clearable) {
  1363. this.showClose = true;
  1364. }
  1365. },
  1366. handleChange: function handleChange() {
  1367. if (this.userInput) {
  1368. var value = this.parseString(this.displayValue);
  1369. if (value) {
  1370. this.picker.value = value;
  1371. if (this.isValidValue(value)) {
  1372. this.emitInput(value);
  1373. this.userInput = null;
  1374. }
  1375. }
  1376. }
  1377. if (this.userInput === '') {
  1378. this.emitInput(null);
  1379. this.emitChange(null);
  1380. this.userInput = null;
  1381. }
  1382. },
  1383. handleStartInput: function handleStartInput(event) {
  1384. if (this.userInput) {
  1385. this.userInput = [event.target.value, this.userInput[1]];
  1386. } else {
  1387. this.userInput = [event.target.value, null];
  1388. }
  1389. },
  1390. handleEndInput: function handleEndInput(event) {
  1391. if (this.userInput) {
  1392. this.userInput = [this.userInput[0], event.target.value];
  1393. } else {
  1394. this.userInput = [null, event.target.value];
  1395. }
  1396. },
  1397. handleStartChange: function handleStartChange(event) {
  1398. var value = this.parseString(this.userInput && this.userInput[0]);
  1399. if (value) {
  1400. this.userInput = [this.formatToString(value), this.displayValue[1]];
  1401. var newValue = [value, this.picker.value && this.picker.value[1]];
  1402. this.picker.value = newValue;
  1403. if (this.isValidValue(newValue)) {
  1404. this.emitInput(newValue);
  1405. this.userInput = null;
  1406. }
  1407. }
  1408. },
  1409. handleEndChange: function handleEndChange(event) {
  1410. var value = this.parseString(this.userInput && this.userInput[1]);
  1411. if (value) {
  1412. this.userInput = [this.displayValue[0], this.formatToString(value)];
  1413. var newValue = [this.picker.value && this.picker.value[0], value];
  1414. this.picker.value = newValue;
  1415. if (this.isValidValue(newValue)) {
  1416. this.emitInput(newValue);
  1417. this.userInput = null;
  1418. }
  1419. }
  1420. },
  1421. handleClickIcon: function handleClickIcon(event) {
  1422. if (this.readonly || this.pickerDisabled) return;
  1423. if (this.showClose) {
  1424. this.valueOnOpen = this.value;
  1425. event.stopPropagation();
  1426. this.emitInput(null);
  1427. this.emitChange(null);
  1428. this.showClose = false;
  1429. if (this.picker && typeof this.picker.handleClear === 'function') {
  1430. this.picker.handleClear();
  1431. }
  1432. } else {
  1433. this.pickerVisible = !this.pickerVisible;
  1434. }
  1435. },
  1436. handleClose: function handleClose() {
  1437. if (!this.pickerVisible) return;
  1438. this.pickerVisible = false;
  1439. if (this.type === 'dates') {
  1440. // restore to former value
  1441. var oldValue = parseAsFormatAndType(this.valueOnOpen, this.valueFormat, this.type, this.rangeSeparator) || this.valueOnOpen;
  1442. this.emitInput(oldValue);
  1443. }
  1444. },
  1445. handleFieldReset: function handleFieldReset(initialValue) {
  1446. this.userInput = initialValue === '' ? null : initialValue;
  1447. },
  1448. handleFocus: function handleFocus() {
  1449. var type = this.type;
  1450. if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
  1451. this.pickerVisible = true;
  1452. }
  1453. this.$emit('focus', this);
  1454. },
  1455. handleKeydown: function handleKeydown(event) {
  1456. var _this = this;
  1457. var keyCode = event.keyCode;
  1458. // ESC
  1459. if (keyCode === 27) {
  1460. this.pickerVisible = false;
  1461. event.stopPropagation();
  1462. return;
  1463. }
  1464. // Tab
  1465. if (keyCode === 9) {
  1466. if (!this.ranged) {
  1467. this.handleChange();
  1468. this.pickerVisible = this.picker.visible = false;
  1469. this.blur();
  1470. event.stopPropagation();
  1471. } else {
  1472. // user may change focus between two input
  1473. setTimeout(function () {
  1474. if (_this.refInput.indexOf(document.activeElement) === -1) {
  1475. _this.pickerVisible = false;
  1476. _this.blur();
  1477. event.stopPropagation();
  1478. }
  1479. }, 0);
  1480. }
  1481. return;
  1482. }
  1483. // Enter
  1484. if (keyCode === 13) {
  1485. if (this.userInput === '' || this.isValidValue(this.parseString(this.displayValue))) {
  1486. this.handleChange();
  1487. this.pickerVisible = this.picker.visible = false;
  1488. this.blur();
  1489. }
  1490. event.stopPropagation();
  1491. return;
  1492. }
  1493. // if user is typing, do not let picker handle key input
  1494. if (this.userInput) {
  1495. event.stopPropagation();
  1496. return;
  1497. }
  1498. // delegate other keys to panel
  1499. if (this.picker && this.picker.handleKeydown) {
  1500. this.picker.handleKeydown(event);
  1501. }
  1502. },
  1503. handleRangeClick: function handleRangeClick() {
  1504. var type = this.type;
  1505. if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
  1506. this.pickerVisible = true;
  1507. }
  1508. this.$emit('focus', this);
  1509. },
  1510. hidePicker: function hidePicker() {
  1511. if (this.picker) {
  1512. this.picker.resetView && this.picker.resetView();
  1513. this.pickerVisible = this.picker.visible = false;
  1514. this.destroyPopper();
  1515. }
  1516. },
  1517. showPicker: function showPicker() {
  1518. var _this2 = this;
  1519. if (this.$isServer) return;
  1520. if (!this.picker) {
  1521. this.mountPicker();
  1522. }
  1523. this.pickerVisible = this.picker.visible = true;
  1524. this.updatePopper();
  1525. this.picker.value = this.parsedValue;
  1526. this.picker.resetView && this.picker.resetView();
  1527. this.$nextTick(function () {
  1528. _this2.picker.adjustSpinners && _this2.picker.adjustSpinners();
  1529. });
  1530. },
  1531. mountPicker: function mountPicker() {
  1532. var _this3 = this;
  1533. this.picker = new _vue2.default(this.panel).$mount();
  1534. this.picker.defaultValue = this.defaultValue;
  1535. this.picker.defaultTime = this.defaultTime;
  1536. this.picker.popperClass = this.popperClass;
  1537. this.popperElm = this.picker.$el;
  1538. this.picker.width = this.reference.getBoundingClientRect().width;
  1539. this.picker.showTime = this.type === 'datetime' || this.type === 'datetimerange';
  1540. this.picker.selectionMode = this.selectionMode;
  1541. this.picker.unlinkPanels = this.unlinkPanels;
  1542. this.picker.arrowControl = this.arrowControl || this.timeArrowControl || false;
  1543. this.$watch('format', function (format) {
  1544. _this3.picker.format = format;
  1545. });
  1546. var updateOptions = function updateOptions() {
  1547. var options = _this3.pickerOptions;
  1548. if (options && options.selectableRange) {
  1549. (function () {
  1550. var ranges = options.selectableRange;
  1551. var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
  1552. var format = DEFAULT_FORMATS.timerange;
  1553. ranges = Array.isArray(ranges) ? ranges : [ranges];
  1554. _this3.picker.selectableRange = ranges.map(function (range) {
  1555. return parser(range, format, _this3.rangeSeparator);
  1556. });
  1557. })();
  1558. }
  1559. for (var option in options) {
  1560. if (options.hasOwnProperty(option) &&
  1561. // 忽略 time-picker 的该配置项
  1562. option !== 'selectableRange') {
  1563. _this3.picker[option] = options[option];
  1564. }
  1565. }
  1566. // main format must prevail over undocumented pickerOptions.format
  1567. if (_this3.format) {
  1568. _this3.picker.format = _this3.format;
  1569. }
  1570. };
  1571. updateOptions();
  1572. this.unwatchPickerOptions = this.$watch('pickerOptions', function () {
  1573. return updateOptions();
  1574. }, { deep: true });
  1575. this.$el.appendChild(this.picker.$el);
  1576. this.picker.resetView && this.picker.resetView();
  1577. this.picker.$on('dodestroy', this.doDestroy);
  1578. this.picker.$on('pick', function () {
  1579. var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  1580. var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1581. _this3.userInput = null;
  1582. _this3.pickerVisible = _this3.picker.visible = visible;
  1583. _this3.emitInput(date);
  1584. _this3.picker.resetView && _this3.picker.resetView();
  1585. });
  1586. this.picker.$on('select-range', function (start, end, pos) {
  1587. if (_this3.refInput.length === 0) return;
  1588. if (!pos || pos === 'min') {
  1589. _this3.refInput[0].setSelectionRange(start, end);
  1590. _this3.refInput[0].focus();
  1591. } else if (pos === 'max') {
  1592. _this3.refInput[1].setSelectionRange(start, end);
  1593. _this3.refInput[1].focus();
  1594. }
  1595. });
  1596. },
  1597. unmountPicker: function unmountPicker() {
  1598. if (this.picker) {
  1599. this.picker.$destroy();
  1600. this.picker.$off();
  1601. if (typeof this.unwatchPickerOptions === 'function') {
  1602. this.unwatchPickerOptions();
  1603. }
  1604. this.picker.$el.parentNode.removeChild(this.picker.$el);
  1605. }
  1606. },
  1607. emitChange: function emitChange(val) {
  1608. // determine user real change only
  1609. if (!valueEquals(val, this.valueOnOpen)) {
  1610. this.$emit('change', val);
  1611. this.dispatch('ElFormItem', 'el.form.change', val);
  1612. this.valueOnOpen = val;
  1613. }
  1614. },
  1615. emitInput: function emitInput(val) {
  1616. var formatted = this.formatToValue(val);
  1617. if (!valueEquals(this.value, formatted)) {
  1618. this.$emit('input', formatted);
  1619. }
  1620. },
  1621. isValidValue: function isValidValue(value) {
  1622. if (!this.picker) {
  1623. this.mountPicker();
  1624. }
  1625. if (this.picker.isValidValue) {
  1626. return value && this.picker.isValidValue(value);
  1627. } else {
  1628. return true;
  1629. }
  1630. }
  1631. }
  1632. };
  1633. /***/ }),
  1634. /***/ 29:
  1635. /***/ (function(module, exports) {
  1636. module.exports = require("element-ui/lib/utils/date");
  1637. /***/ }),
  1638. /***/ 3:
  1639. /***/ (function(module, exports) {
  1640. module.exports = require("element-ui/lib/utils/dom");
  1641. /***/ }),
  1642. /***/ 30:
  1643. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1644. "use strict";
  1645. var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (!_vm.ranged)?_c('el-input',_vm._b({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 || _vm.type === 'dates',"disabled":_vm.pickerDisabled,"size":_vm.pickerSize,"name":_vm.name,"placeholder":_vm.placeholder,"value":_vm.displayValue,"validateEvent":false},on:{"focus":_vm.handleFocus,"input":function (value) { return _vm.userInput = value; },"change":_vm.handleChange},nativeOn:{"keydown":function($event){_vm.handleKeydown($event)},"mouseenter":function($event){_vm.handleMouseEnter($event)},"mouseleave":function($event){_vm.showClose = false}}},'el-input',_vm.firstInputId,false),[_c('i',{staticClass:"el-input__icon",class:_vm.triggerClass,attrs:{"slot":"prefix"},on:{"click":_vm.handleFocus},slot:"prefix"}),(_vm.haveTrigger)?_c('i',{staticClass:"el-input__icon",class:[_vm.showClose ? '' + _vm.clearIcon : ''],attrs:{"slot":"suffix"},on:{"click":_vm.handleClickIcon},slot:"suffix"}):_vm._e()]):_c('div',{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:(_vm.handleClose),expression:"handleClose"}],ref:"reference",staticClass:"el-date-editor el-range-editor el-input__inner",class:[
  1646. 'el-date-editor--' + _vm.type,
  1647. _vm.pickerSize ? ("el-range-editor--" + _vm.pickerSize) : '',
  1648. _vm.pickerDisabled ? 'is-disabled' : '',
  1649. _vm.pickerVisible ? 'is-active' : ''
  1650. ],on:{"click":_vm.handleRangeClick,"mouseenter":_vm.handleMouseEnter,"mouseleave":function($event){_vm.showClose = false},"keydown":_vm.handleKeydown}},[_c('i',{class:['el-input__icon', 'el-range__icon', _vm.triggerClass]}),_c('input',_vm._b({staticClass:"el-range-input",attrs:{"autocomplete":"off","placeholder":_vm.startPlaceholder,"disabled":_vm.pickerDisabled,"readonly":!_vm.editable || _vm.readonly,"name":_vm.name && _vm.name[0]},domProps:{"value":_vm.displayValue && _vm.displayValue[0]},on:{"input":_vm.handleStartInput,"change":_vm.handleStartChange,"focus":_vm.handleFocus}},'input',_vm.firstInputId,false)),_vm._t("range-separator",[_c('span',{staticClass:"el-range-separator"},[_vm._v(_vm._s(_vm.rangeSeparator))])]),_c('input',_vm._b({staticClass:"el-range-input",attrs:{"autocomplete":"off","placeholder":_vm.endPlaceholder,"disabled":_vm.pickerDisabled,"readonly":!_vm.editable || _vm.readonly,"name":_vm.name && _vm.name[1]},domProps:{"value":_vm.displayValue && _vm.displayValue[1]},on:{"input":_vm.handleEndInput,"change":_vm.handleEndChange,"focus":_vm.handleFocus}},'input',_vm.secondInputId,false)),(_vm.haveTrigger)?_c('i',{staticClass:"el-input__icon el-range__close-icon",class:[_vm.showClose ? '' + _vm.clearIcon : ''],on:{"click":_vm.handleClickIcon}}):_vm._e()],2)}
  1651. var staticRenderFns = []
  1652. var esExports = { render: render, staticRenderFns: staticRenderFns }
  1653. /* harmony default export */ __webpack_exports__["a"] = (esExports);
  1654. /***/ }),
  1655. /***/ 31:
  1656. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1657. "use strict";
  1658. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  1659. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_vue__ = __webpack_require__(41);
  1660. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_vue__);
  1661. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_3ea87726_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_time_vue__ = __webpack_require__(44);
  1662. var normalizeComponent = __webpack_require__(0)
  1663. /* script */
  1664. /* template */
  1665. /* template functional */
  1666. var __vue_template_functional__ = false
  1667. /* styles */
  1668. var __vue_styles__ = null
  1669. /* scopeId */
  1670. var __vue_scopeId__ = null
  1671. /* moduleIdentifier (server only) */
  1672. var __vue_module_identifier__ = null
  1673. var Component = normalizeComponent(
  1674. __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_vue___default.a,
  1675. __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_3ea87726_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_time_vue__["a" /* default */],
  1676. __vue_template_functional__,
  1677. __vue_styles__,
  1678. __vue_scopeId__,
  1679. __vue_module_identifier__
  1680. )
  1681. /* harmony default export */ __webpack_exports__["default"] = (Component.exports);
  1682. /***/ }),
  1683. /***/ 32:
  1684. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1685. "use strict";
  1686. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  1687. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_spinner_vue__ = __webpack_require__(42);
  1688. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_spinner_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_spinner_vue__);
  1689. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_3673a788_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_time_spinner_vue__ = __webpack_require__(43);
  1690. var normalizeComponent = __webpack_require__(0)
  1691. /* script */
  1692. /* template */
  1693. /* template functional */
  1694. var __vue_template_functional__ = false
  1695. /* styles */
  1696. var __vue_styles__ = null
  1697. /* scopeId */
  1698. var __vue_scopeId__ = null
  1699. /* moduleIdentifier (server only) */
  1700. var __vue_module_identifier__ = null
  1701. var Component = normalizeComponent(
  1702. __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_spinner_vue___default.a,
  1703. __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_3673a788_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_time_spinner_vue__["a" /* default */],
  1704. __vue_template_functional__,
  1705. __vue_styles__,
  1706. __vue_scopeId__,
  1707. __vue_module_identifier__
  1708. )
  1709. /* harmony default export */ __webpack_exports__["default"] = (Component.exports);
  1710. /***/ }),
  1711. /***/ 4:
  1712. /***/ (function(module, exports) {
  1713. module.exports = require("vue");
  1714. /***/ }),
  1715. /***/ 41:
  1716. /***/ (function(module, exports, __webpack_require__) {
  1717. "use strict";
  1718. exports.__esModule = true;
  1719. var _util = __webpack_require__(11);
  1720. var _locale = __webpack_require__(5);
  1721. var _locale2 = _interopRequireDefault(_locale);
  1722. var _timeSpinner = __webpack_require__(32);
  1723. var _timeSpinner2 = _interopRequireDefault(_timeSpinner);
  1724. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1725. exports.default = {
  1726. mixins: [_locale2.default],
  1727. components: {
  1728. TimeSpinner: _timeSpinner2.default
  1729. },
  1730. props: {
  1731. visible: Boolean,
  1732. timeArrowControl: Boolean
  1733. },
  1734. watch: {
  1735. visible: function visible(val) {
  1736. var _this = this;
  1737. if (val) {
  1738. this.oldValue = this.value;
  1739. this.$nextTick(function () {
  1740. return _this.$refs.spinner.emitSelectRange('hours');
  1741. });
  1742. } else {
  1743. this.needInitAdjust = true;
  1744. }
  1745. },
  1746. value: function value(newVal) {
  1747. var _this2 = this;
  1748. var date = void 0;
  1749. if (newVal instanceof Date) {
  1750. date = (0, _util.limitTimeRange)(newVal, this.selectableRange, this.format);
  1751. } else if (!newVal) {
  1752. date = this.defaultValue ? new Date(this.defaultValue) : new Date();
  1753. }
  1754. this.date = date;
  1755. if (this.visible && this.needInitAdjust) {
  1756. this.$nextTick(function (_) {
  1757. return _this2.adjustSpinners();
  1758. });
  1759. this.needInitAdjust = false;
  1760. }
  1761. },
  1762. selectableRange: function selectableRange(val) {
  1763. this.$refs.spinner.selectableRange = val;
  1764. },
  1765. defaultValue: function defaultValue(val) {
  1766. if (!(0, _util.isDate)(this.value)) {
  1767. this.date = val ? new Date(val) : new Date();
  1768. }
  1769. }
  1770. },
  1771. data: function data() {
  1772. return {
  1773. popperClass: '',
  1774. format: 'HH:mm:ss',
  1775. value: '',
  1776. defaultValue: null,
  1777. date: new Date(),
  1778. oldValue: new Date(),
  1779. selectableRange: [],
  1780. selectionRange: [0, 2],
  1781. disabled: false,
  1782. arrowControl: false,
  1783. needInitAdjust: true
  1784. };
  1785. },
  1786. computed: {
  1787. showSeconds: function showSeconds() {
  1788. return (this.format || '').indexOf('ss') !== -1;
  1789. },
  1790. useArrow: function useArrow() {
  1791. return this.arrowControl || this.timeArrowControl || false;
  1792. },
  1793. amPmMode: function amPmMode() {
  1794. if ((this.format || '').indexOf('A') !== -1) return 'A';
  1795. if ((this.format || '').indexOf('a') !== -1) return 'a';
  1796. return '';
  1797. }
  1798. },
  1799. methods: {
  1800. handleCancel: function handleCancel() {
  1801. this.$emit('pick', this.oldValue, false);
  1802. },
  1803. handleChange: function handleChange(date) {
  1804. // this.visible avoids edge cases, when use scrolls during panel closing animation
  1805. if (this.visible) {
  1806. this.date = (0, _util.clearMilliseconds)(date);
  1807. // if date is out of range, do not emit
  1808. if (this.isValidValue(this.date)) {
  1809. this.$emit('pick', this.date, true);
  1810. }
  1811. }
  1812. },
  1813. setSelectionRange: function setSelectionRange(start, end) {
  1814. this.$emit('select-range', start, end);
  1815. this.selectionRange = [start, end];
  1816. },
  1817. handleConfirm: function handleConfirm() {
  1818. var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  1819. var first = arguments[1];
  1820. if (first) return;
  1821. var date = (0, _util.clearMilliseconds)((0, _util.limitTimeRange)(this.date, this.selectableRange, this.format));
  1822. this.$emit('pick', date, visible, first);
  1823. },
  1824. handleKeydown: function handleKeydown(event) {
  1825. var keyCode = event.keyCode;
  1826. var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
  1827. // Left or Right
  1828. if (keyCode === 37 || keyCode === 39) {
  1829. var step = mapping[keyCode];
  1830. this.changeSelectionRange(step);
  1831. event.preventDefault();
  1832. return;
  1833. }
  1834. // Up or Down
  1835. if (keyCode === 38 || keyCode === 40) {
  1836. var _step = mapping[keyCode];
  1837. this.$refs.spinner.scrollDown(_step);
  1838. event.preventDefault();
  1839. return;
  1840. }
  1841. },
  1842. isValidValue: function isValidValue(date) {
  1843. return (0, _util.timeWithinRange)(date, this.selectableRange, this.format);
  1844. },
  1845. adjustSpinners: function adjustSpinners() {
  1846. return this.$refs.spinner.adjustSpinners();
  1847. },
  1848. changeSelectionRange: function changeSelectionRange(step) {
  1849. var list = [0, 3].concat(this.showSeconds ? [6] : []);
  1850. var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
  1851. var index = list.indexOf(this.selectionRange[0]);
  1852. var next = (index + step + list.length) % list.length;
  1853. this.$refs.spinner.emitSelectRange(mapping[next]);
  1854. }
  1855. },
  1856. mounted: function mounted() {
  1857. var _this3 = this;
  1858. this.$nextTick(function () {
  1859. return _this3.handleConfirm(true, true);
  1860. });
  1861. this.$emit('mounted');
  1862. }
  1863. }; //
  1864. //
  1865. //
  1866. //
  1867. //
  1868. //
  1869. //
  1870. //
  1871. //
  1872. //
  1873. //
  1874. //
  1875. //
  1876. //
  1877. //
  1878. //
  1879. //
  1880. //
  1881. //
  1882. //
  1883. //
  1884. //
  1885. //
  1886. //
  1887. //
  1888. //
  1889. //
  1890. //
  1891. //
  1892. //
  1893. //
  1894. //
  1895. /***/ }),
  1896. /***/ 42:
  1897. /***/ (function(module, exports, __webpack_require__) {
  1898. "use strict";
  1899. exports.__esModule = true;
  1900. var _util = __webpack_require__(11);
  1901. var _scrollbar = __webpack_require__(17);
  1902. var _scrollbar2 = _interopRequireDefault(_scrollbar);
  1903. var _repeatClick = __webpack_require__(24);
  1904. var _repeatClick2 = _interopRequireDefault(_repeatClick);
  1905. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1906. exports.default = {
  1907. components: { ElScrollbar: _scrollbar2.default },
  1908. directives: {
  1909. repeatClick: _repeatClick2.default
  1910. },
  1911. props: {
  1912. date: {},
  1913. defaultValue: {}, // reserved for future use
  1914. showSeconds: {
  1915. type: Boolean,
  1916. default: true
  1917. },
  1918. arrowControl: Boolean,
  1919. amPmMode: {
  1920. type: String,
  1921. default: '' // 'a': am/pm; 'A': AM/PM
  1922. }
  1923. },
  1924. computed: {
  1925. hours: function hours() {
  1926. return this.date.getHours();
  1927. },
  1928. minutes: function minutes() {
  1929. return this.date.getMinutes();
  1930. },
  1931. seconds: function seconds() {
  1932. return this.date.getSeconds();
  1933. },
  1934. hoursList: function hoursList() {
  1935. return (0, _util.getRangeHours)(this.selectableRange);
  1936. },
  1937. minutesList: function minutesList() {
  1938. return (0, _util.getRangeMinutes)(this.selectableRange, this.hours);
  1939. },
  1940. arrowHourList: function arrowHourList() {
  1941. var hours = this.hours;
  1942. return [hours > 0 ? hours - 1 : undefined, hours, hours < 23 ? hours + 1 : undefined];
  1943. },
  1944. arrowMinuteList: function arrowMinuteList() {
  1945. var minutes = this.minutes;
  1946. return [minutes > 0 ? minutes - 1 : undefined, minutes, minutes < 59 ? minutes + 1 : undefined];
  1947. },
  1948. arrowSecondList: function arrowSecondList() {
  1949. var seconds = this.seconds;
  1950. return [seconds > 0 ? seconds - 1 : undefined, seconds, seconds < 59 ? seconds + 1 : undefined];
  1951. }
  1952. },
  1953. data: function data() {
  1954. return {
  1955. selectableRange: [],
  1956. currentScrollbar: null
  1957. };
  1958. },
  1959. mounted: function mounted() {
  1960. var _this = this;
  1961. this.$nextTick(function () {
  1962. !_this.arrowControl && _this.bindScrollEvent();
  1963. });
  1964. },
  1965. methods: {
  1966. increase: function increase() {
  1967. this.scrollDown(1);
  1968. },
  1969. decrease: function decrease() {
  1970. this.scrollDown(-1);
  1971. },
  1972. modifyDateField: function modifyDateField(type, value) {
  1973. switch (type) {
  1974. case 'hours':
  1975. this.$emit('change', (0, _util.modifyTime)(this.date, value, this.minutes, this.seconds));break;
  1976. case 'minutes':
  1977. this.$emit('change', (0, _util.modifyTime)(this.date, this.hours, value, this.seconds));break;
  1978. case 'seconds':
  1979. this.$emit('change', (0, _util.modifyTime)(this.date, this.hours, this.minutes, value));break;
  1980. }
  1981. },
  1982. handleClick: function handleClick(type, _ref) {
  1983. var value = _ref.value,
  1984. disabled = _ref.disabled;
  1985. if (!disabled) {
  1986. this.modifyDateField(type, value);
  1987. this.emitSelectRange(type);
  1988. this.adjustSpinner(type, value);
  1989. }
  1990. },
  1991. emitSelectRange: function emitSelectRange(type) {
  1992. if (type === 'hours') {
  1993. this.$emit('select-range', 0, 2);
  1994. } else if (type === 'minutes') {
  1995. this.$emit('select-range', 3, 5);
  1996. } else if (type === 'seconds') {
  1997. this.$emit('select-range', 6, 8);
  1998. }
  1999. this.currentScrollbar = type;
  2000. },
  2001. bindScrollEvent: function bindScrollEvent() {
  2002. var _this2 = this;
  2003. var bindFuntion = function bindFuntion(type) {
  2004. _this2.$refs[type].wrap.onscroll = function (e) {
  2005. // TODO: scroll is emitted when set scrollTop programatically
  2006. // should find better solutions in the future!
  2007. _this2.handleScroll(type, e);
  2008. };
  2009. };
  2010. bindFuntion('hours');
  2011. bindFuntion('minutes');
  2012. bindFuntion('seconds');
  2013. },
  2014. handleScroll: function handleScroll(type) {
  2015. var value = Math.min(Math.floor((this.$refs[type].wrap.scrollTop - (this.scrollBarHeight(type) * 0.5 - 10) / this.typeItemHeight(type) + 3) / this.typeItemHeight(type)), type === 'hours' ? 23 : 59);
  2016. this.modifyDateField(type, value);
  2017. },
  2018. // NOTE: used by datetime / date-range panel
  2019. // renamed from adjustScrollTop
  2020. // should try to refactory it
  2021. adjustSpinners: function adjustSpinners() {
  2022. this.adjustSpinner('hours', this.hours);
  2023. this.adjustSpinner('minutes', this.minutes);
  2024. this.adjustSpinner('seconds', this.seconds);
  2025. },
  2026. adjustCurrentSpinner: function adjustCurrentSpinner(type) {
  2027. this.adjustSpinner(type, this[type]);
  2028. },
  2029. adjustSpinner: function adjustSpinner(type, value) {
  2030. if (this.arrowControl) return;
  2031. var el = this.$refs[type].wrap;
  2032. if (el) {
  2033. el.scrollTop = Math.max(0, value * this.typeItemHeight(type));
  2034. }
  2035. },
  2036. scrollDown: function scrollDown(step) {
  2037. if (!this.currentScrollbar) {
  2038. this.emitSelectRange('hours');
  2039. }
  2040. var label = this.currentScrollbar;
  2041. var hoursList = this.hoursList;
  2042. var now = this[label];
  2043. if (this.currentScrollbar === 'hours') {
  2044. var total = Math.abs(step);
  2045. step = step > 0 ? 1 : -1;
  2046. var length = hoursList.length;
  2047. while (length-- && total) {
  2048. now = (now + step + hoursList.length) % hoursList.length;
  2049. if (hoursList[now]) {
  2050. continue;
  2051. }
  2052. total--;
  2053. }
  2054. if (hoursList[now]) return;
  2055. } else {
  2056. now = (now + step + 60) % 60;
  2057. }
  2058. this.modifyDateField(label, now);
  2059. this.adjustSpinner(label, now);
  2060. },
  2061. amPm: function amPm(hour) {
  2062. var shouldShowAmPm = this.amPmMode.toLowerCase() === 'a';
  2063. if (!shouldShowAmPm) return '';
  2064. var isCapital = this.amPmMode === 'A';
  2065. var content = hour < 12 ? ' am' : ' pm';
  2066. if (isCapital) content = content.toUpperCase();
  2067. return content;
  2068. },
  2069. typeItemHeight: function typeItemHeight(type) {
  2070. return this.$refs[type].$el.querySelector('li').offsetHeight;
  2071. },
  2072. scrollBarHeight: function scrollBarHeight(type) {
  2073. return this.$refs[type].$el.offsetHeight;
  2074. }
  2075. }
  2076. }; //
  2077. //
  2078. //
  2079. //
  2080. //
  2081. //
  2082. //
  2083. //
  2084. //
  2085. //
  2086. //
  2087. //
  2088. //
  2089. //
  2090. //
  2091. //
  2092. //
  2093. //
  2094. //
  2095. //
  2096. //
  2097. //
  2098. //
  2099. //
  2100. //
  2101. //
  2102. //
  2103. //
  2104. //
  2105. //
  2106. //
  2107. //
  2108. //
  2109. //
  2110. //
  2111. //
  2112. //
  2113. //
  2114. //
  2115. //
  2116. //
  2117. //
  2118. //
  2119. //
  2120. //
  2121. //
  2122. //
  2123. //
  2124. //
  2125. //
  2126. //
  2127. //
  2128. //
  2129. //
  2130. //
  2131. //
  2132. //
  2133. //
  2134. //
  2135. //
  2136. //
  2137. //
  2138. //
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. //
  2156. //
  2157. //
  2158. //
  2159. //
  2160. //
  2161. //
  2162. //
  2163. //
  2164. //
  2165. //
  2166. //
  2167. //
  2168. //
  2169. //
  2170. //
  2171. //
  2172. //
  2173. //
  2174. //
  2175. //
  2176. /***/ }),
  2177. /***/ 43:
  2178. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2179. "use strict";
  2180. var 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 }},[(!_vm.arrowControl)?[_c('el-scrollbar',{ref:"hours",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')},"mousemove":function($event){_vm.adjustCurrentSpinner('hours')}}},_vm._l((_vm.hoursList),function(disabled,hour){return _c('li',{staticClass:"el-time-spinner__item",class:{ 'active': hour === _vm.hours, 'disabled': disabled },on:{"click":function($event){_vm.handleClick('hours', { value: hour, disabled: disabled })}}},[_vm._v(_vm._s(('0' + (_vm.amPmMode ? (hour % 12 || 12) : hour )).slice(-2))+_vm._s(_vm.amPm(hour)))])})),_c('el-scrollbar',{ref:"minutes",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')},"mousemove":function($event){_vm.adjustCurrentSpinner('minutes')}}},_vm._l((_vm.minutesList),function(enabled,key){return _c('li',{staticClass:"el-time-spinner__item",class:{ 'active': key === _vm.minutes, disabled: !enabled },on:{"click":function($event){_vm.handleClick('minutes', { value: key, disabled: false })}}},[_vm._v(_vm._s(('0' + key).slice(-2)))])})),_c('el-scrollbar',{directives:[{name:"show",rawName:"v-show",value:(_vm.showSeconds),expression:"showSeconds"}],ref:"seconds",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')},"mousemove":function($event){_vm.adjustCurrentSpinner('seconds')}}},_vm._l((60),function(second,key){return _c('li',{key:key,staticClass:"el-time-spinner__item",class:{ 'active': key === _vm.seconds },on:{"click":function($event){_vm.handleClick('seconds', { value: key, disabled: false })}}},[_vm._v(_vm._s(('0' + key).slice(-2)))])}))]:_vm._e(),(_vm.arrowControl)?[_c('div',{staticClass:"el-time-spinner__wrapper is-arrow",on:{"mouseenter":function($event){_vm.emitSelectRange('hours')}}},[_c('i',{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:(_vm.decrease),expression:"decrease"}],staticClass:"el-time-spinner__arrow el-icon-arrow-up"}),_c('i',{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:(_vm.increase),expression:"increase"}],staticClass:"el-time-spinner__arrow el-icon-arrow-down"}),_c('ul',{ref:"hours",staticClass:"el-time-spinner__list"},_vm._l((_vm.arrowHourList),function(hour,key){return _c('li',{key:key,staticClass:"el-time-spinner__item",class:{ 'active': hour === _vm.hours, 'disabled': _vm.hoursList[hour] }},[_vm._v(_vm._s(hour === undefined ? '' : ('0' + (_vm.amPmMode ? (hour % 12 || 12) : hour )).slice(-2) + _vm.amPm(hour)))])}))]),_c('div',{staticClass:"el-time-spinner__wrapper is-arrow",on:{"mouseenter":function($event){_vm.emitSelectRange('minutes')}}},[_c('i',{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:(_vm.decrease),expression:"decrease"}],staticClass:"el-time-spinner__arrow el-icon-arrow-up"}),_c('i',{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:(_vm.increase),expression:"increase"}],staticClass:"el-time-spinner__arrow el-icon-arrow-down"}),_c('ul',{ref:"minutes",staticClass:"el-time-spinner__list"},_vm._l((_vm.arrowMinuteList),function(minute,key){return _c('li',{key:key,staticClass:"el-time-spinner__item",class:{ 'active': minute === _vm.minutes }},[_vm._v("\n "+_vm._s(minute === undefined ? '' : ('0' + minute).slice(-2))+"\n ")])}))]),(_vm.showSeconds)?_c('div',{staticClass:"el-time-spinner__wrapper is-arrow",on:{"mouseenter":function($event){_vm.emitSelectRange('seconds')}}},[_c('i',{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:(_vm.decrease),expression:"decrease"}],staticClass:"el-time-spinner__arrow el-icon-arrow-up"}),_c('i',{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:(_vm.increase),expression:"increase"}],staticClass:"el-time-spinner__arrow el-icon-arrow-down"}),_c('ul',{ref:"seconds",staticClass:"el-time-spinner__list"},_vm._l((_vm.arrowSecondList),function(second,key){return _c('li',{key:key,staticClass:"el-time-spinner__item",class:{ 'active': second === _vm.seconds }},[_vm._v("\n "+_vm._s(second === undefined ? '' : ('0' + second).slice(-2))+"\n ")])}))]):_vm._e()]:_vm._e()],2)}
  2181. var staticRenderFns = []
  2182. var esExports = { render: render, staticRenderFns: staticRenderFns }
  2183. /* harmony default export */ __webpack_exports__["a"] = (esExports);
  2184. /***/ }),
  2185. /***/ 44:
  2186. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2187. "use strict";
  2188. var 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-time-panel el-popper",class:_vm.popperClass},[_c('div',{staticClass:"el-time-panel__content",class:{ 'has-seconds': _vm.showSeconds }},[_c('time-spinner',{ref:"spinner",attrs:{"arrow-control":_vm.useArrow,"show-seconds":_vm.showSeconds,"am-pm-mode":_vm.amPmMode,"date":_vm.date},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",class:{confirm: !_vm.disabled},attrs:{"type":"button"},on:{"click":function($event){_vm.handleConfirm()}}},[_vm._v(_vm._s(_vm.t('el.datepicker.confirm')))])])])])}
  2189. var staticRenderFns = []
  2190. var esExports = { render: render, staticRenderFns: staticRenderFns }
  2191. /* harmony default export */ __webpack_exports__["a"] = (esExports);
  2192. /***/ }),
  2193. /***/ 5:
  2194. /***/ (function(module, exports) {
  2195. module.exports = require("element-ui/lib/mixins/locale");
  2196. /***/ }),
  2197. /***/ 6:
  2198. /***/ (function(module, exports) {
  2199. module.exports = require("element-ui/lib/input");
  2200. /***/ }),
  2201. /***/ 7:
  2202. /***/ (function(module, exports) {
  2203. module.exports = require("element-ui/lib/utils/vue-popper");
  2204. /***/ }),
  2205. /***/ 9:
  2206. /***/ (function(module, exports) {
  2207. module.exports = require("element-ui/lib/utils/merge");
  2208. /***/ })
  2209. /******/ });