1 | module.exports =
|
2 | (function(modules) {
|
3 |
|
4 | var installedModules = {};
|
5 |
|
6 |
|
7 | function __webpack_require__(moduleId) {
|
8 |
|
9 |
|
10 | if(installedModules[moduleId]) {
|
11 | return installedModules[moduleId].exports;
|
12 | }
|
13 |
|
14 | var module = installedModules[moduleId] = {
|
15 | i: moduleId,
|
16 | l: false,
|
17 | exports: {}
|
18 | };
|
19 |
|
20 |
|
21 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
22 |
|
23 |
|
24 | module.l = true;
|
25 |
|
26 |
|
27 | return module.exports;
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 | __webpack_require__.m = modules;
|
33 |
|
34 |
|
35 | __webpack_require__.c = installedModules;
|
36 |
|
37 |
|
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 |
|
58 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
59 |
|
60 |
|
61 | __webpack_require__.p = "/dist/";
|
62 |
|
63 |
|
64 | return __webpack_require__(__webpack_require__.s = 192);
|
65 | })
|
66 |
|
67 | ({
|
68 |
|
69 | 0:
|
70 | (function(module, exports) {
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 | module.exports = function normalizeComponent (
|
79 | rawScriptExports,
|
80 | compiledTemplate,
|
81 | functionalTemplate,
|
82 | injectStyles,
|
83 | scopeId,
|
84 | moduleIdentifier /* server only */
|
85 | ) {
|
86 | var esModule
|
87 | var scriptExports = rawScriptExports = rawScriptExports || {}
|
88 |
|
89 |
|
90 | var type = typeof rawScriptExports.default
|
91 | if (type === 'object' || type === 'function') {
|
92 | esModule = rawScriptExports
|
93 | scriptExports = rawScriptExports.default
|
94 | }
|
95 |
|
96 |
|
97 | var options = typeof scriptExports === 'function'
|
98 | ? scriptExports.options
|
99 | : scriptExports
|
100 |
|
101 |
|
102 | if (compiledTemplate) {
|
103 | options.render = compiledTemplate.render
|
104 | options.staticRenderFns = compiledTemplate.staticRenderFns
|
105 | options._compiled = true
|
106 | }
|
107 |
|
108 |
|
109 | if (functionalTemplate) {
|
110 | options.functional = true
|
111 | }
|
112 |
|
113 |
|
114 | if (scopeId) {
|
115 | options._scopeId = scopeId
|
116 | }
|
117 |
|
118 | var hook
|
119 | if (moduleIdentifier) {
|
120 | hook = function (context) {
|
121 |
|
122 | context =
|
123 | context ||
|
124 | (this.$vnode && this.$vnode.ssrContext) ||
|
125 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext)
|
126 |
|
127 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
128 | context = __VUE_SSR_CONTEXT__
|
129 | }
|
130 |
|
131 | if (injectStyles) {
|
132 | injectStyles.call(this, context)
|
133 | }
|
134 |
|
135 | if (context && context._registeredComponents) {
|
136 | context._registeredComponents.add(moduleIdentifier)
|
137 | }
|
138 | }
|
139 |
|
140 |
|
141 | options._ssrRegister = hook
|
142 | } else if (injectStyles) {
|
143 | hook = injectStyles
|
144 | }
|
145 |
|
146 | if (hook) {
|
147 | var functional = options.functional
|
148 | var existing = functional
|
149 | ? options.render
|
150 | : options.beforeCreate
|
151 |
|
152 | if (!functional) {
|
153 |
|
154 | options.beforeCreate = existing
|
155 | ? [].concat(existing, hook)
|
156 | : [hook]
|
157 | } else {
|
158 |
|
159 |
|
160 | options._injectStyles = hook
|
161 |
|
162 | options.render = function renderWithStyleInjection (h, context) {
|
163 | hook.call(context)
|
164 | return existing(h, context)
|
165 | }
|
166 | }
|
167 | }
|
168 |
|
169 | return {
|
170 | esModule: esModule,
|
171 | exports: scriptExports,
|
172 | options: options
|
173 | }
|
174 | }
|
175 |
|
176 |
|
177 | }),
|
178 |
|
179 | 1:
|
180 | (function(module, exports) {
|
181 |
|
182 | module.exports = require("element-ui/lib/mixins/emitter");
|
183 |
|
184 | }),
|
185 |
|
186 | 10:
|
187 | (function(module, exports) {
|
188 |
|
189 | module.exports = require("element-ui/lib/utils/clickoutside");
|
190 |
|
191 | }),
|
192 |
|
193 | 11:
|
194 | (function(module, exports, __webpack_require__) {
|
195 |
|
196 | "use strict";
|
197 |
|
198 |
|
199 | exports.__esModule = true;
|
200 | 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.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;
|
201 |
|
202 | var _date = __webpack_require__(29);
|
203 |
|
204 | var _date2 = _interopRequireDefault(_date);
|
205 |
|
206 | var _locale = __webpack_require__(12);
|
207 |
|
208 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
209 |
|
210 | var weeks = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
|
211 | var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
|
212 | var getI18nSettings = function getI18nSettings() {
|
213 | return {
|
214 | dayNamesShort: weeks.map(function (week) {
|
215 | return (0, _locale.t)('el.datepicker.weeks.' + week);
|
216 | }),
|
217 | dayNames: weeks.map(function (week) {
|
218 | return (0, _locale.t)('el.datepicker.weeks.' + week);
|
219 | }),
|
220 | monthNamesShort: months.map(function (month) {
|
221 | return (0, _locale.t)('el.datepicker.months.' + month);
|
222 | }),
|
223 | monthNames: months.map(function (month, index) {
|
224 | return (0, _locale.t)('el.datepicker.month' + (index + 1));
|
225 | }),
|
226 | amPm: ['am', 'pm']
|
227 | };
|
228 | };
|
229 |
|
230 | var newArray = function newArray(start, end) {
|
231 | var result = [];
|
232 | for (var i = start; i <= end; i++) {
|
233 | result.push(i);
|
234 | }
|
235 | return result;
|
236 | };
|
237 |
|
238 | var toDate = exports.toDate = function toDate(date) {
|
239 | return isDate(date) ? new Date(date) : null;
|
240 | };
|
241 |
|
242 | var isDate = exports.isDate = function isDate(date) {
|
243 | if (date === null || date === undefined) return false;
|
244 | if (isNaN(new Date(date).getTime())) return false;
|
245 | if (Array.isArray(date)) return false;
|
246 | return true;
|
247 | };
|
248 |
|
249 | var isDateObject = exports.isDateObject = function isDateObject(val) {
|
250 | return val instanceof Date;
|
251 | };
|
252 |
|
253 | var formatDate = exports.formatDate = function formatDate(date, format) {
|
254 | date = toDate(date);
|
255 | if (!date) return '';
|
256 | return _date2.default.format(date, format || 'yyyy-MM-dd', getI18nSettings());
|
257 | };
|
258 |
|
259 | var parseDate = exports.parseDate = function parseDate(string, format) {
|
260 | return _date2.default.parse(string, format || 'yyyy-MM-dd', getI18nSettings());
|
261 | };
|
262 |
|
263 | var getDayCountOfMonth = exports.getDayCountOfMonth = function getDayCountOfMonth(year, month) {
|
264 | if (month === 3 || month === 5 || month === 8 || month === 10) {
|
265 | return 30;
|
266 | }
|
267 |
|
268 | if (month === 1) {
|
269 | if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
|
270 | return 29;
|
271 | } else {
|
272 | return 28;
|
273 | }
|
274 | }
|
275 |
|
276 | return 31;
|
277 | };
|
278 |
|
279 | var getDayCountOfYear = exports.getDayCountOfYear = function getDayCountOfYear(year) {
|
280 | var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
|
281 | return isLeapYear ? 366 : 365;
|
282 | };
|
283 |
|
284 | var getFirstDayOfMonth = exports.getFirstDayOfMonth = function getFirstDayOfMonth(date) {
|
285 | var temp = new Date(date.getTime());
|
286 | temp.setDate(1);
|
287 | return temp.getDay();
|
288 | };
|
289 |
|
290 |
|
291 |
|
292 |
|
293 | var prevDate = exports.prevDate = function prevDate(date) {
|
294 | var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
295 |
|
296 | return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
|
297 | };
|
298 |
|
299 | var nextDate = exports.nextDate = function nextDate(date) {
|
300 | var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
301 |
|
302 | return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
|
303 | };
|
304 |
|
305 | var getStartDateOfMonth = exports.getStartDateOfMonth = function getStartDateOfMonth(year, month) {
|
306 | var result = new Date(year, month, 1);
|
307 | var day = result.getDay();
|
308 |
|
309 | if (day === 0) {
|
310 | return prevDate(result, 7);
|
311 | } else {
|
312 | return prevDate(result, day);
|
313 | }
|
314 | };
|
315 |
|
316 | var getWeekNumber = exports.getWeekNumber = function getWeekNumber(src) {
|
317 | if (!isDate(src)) return null;
|
318 | var date = new Date(src.getTime());
|
319 | date.setHours(0, 0, 0, 0);
|
320 |
|
321 | date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
|
322 |
|
323 | var week1 = new Date(date.getFullYear(), 0, 4);
|
324 |
|
325 |
|
326 | return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7);
|
327 | };
|
328 |
|
329 | var getRangeHours = exports.getRangeHours = function getRangeHours(ranges) {
|
330 | var hours = [];
|
331 | var disabledHours = [];
|
332 |
|
333 | (ranges || []).forEach(function (range) {
|
334 | var value = range.map(function (date) {
|
335 | return date.getHours();
|
336 | });
|
337 |
|
338 | disabledHours = disabledHours.concat(newArray(value[0], value[1]));
|
339 | });
|
340 |
|
341 | if (disabledHours.length) {
|
342 | for (var i = 0; i < 24; i++) {
|
343 | hours[i] = disabledHours.indexOf(i) === -1;
|
344 | }
|
345 | } else {
|
346 | for (var _i = 0; _i < 24; _i++) {
|
347 | hours[_i] = false;
|
348 | }
|
349 | }
|
350 |
|
351 | return hours;
|
352 | };
|
353 |
|
354 | var range = exports.range = function range(n) {
|
355 |
|
356 | return Array.apply(null, { length: n }).map(function (_, n) {
|
357 | return n;
|
358 | });
|
359 | };
|
360 |
|
361 | var modifyDate = exports.modifyDate = function modifyDate(date, y, m, d) {
|
362 | return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
363 | };
|
364 |
|
365 | var modifyTime = exports.modifyTime = function modifyTime(date, h, m, s) {
|
366 | return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
|
367 | };
|
368 |
|
369 | var modifyWithTimeString = exports.modifyWithTimeString = function modifyWithTimeString(date, time) {
|
370 | if (date == null || !time) {
|
371 | return date;
|
372 | }
|
373 | time = parseDate(time, 'HH:mm:ss');
|
374 | return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
|
375 | };
|
376 |
|
377 | var clearTime = exports.clearTime = function clearTime(date) {
|
378 | return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
379 | };
|
380 |
|
381 | var clearMilliseconds = exports.clearMilliseconds = function clearMilliseconds(date) {
|
382 | return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
|
383 | };
|
384 |
|
385 | var limitTimeRange = exports.limitTimeRange = function limitTimeRange(date, ranges) {
|
386 | var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
|
387 |
|
388 |
|
389 | if (ranges.length === 0) return date;
|
390 | var normalizeDate = function normalizeDate(date) {
|
391 | return _date2.default.parse(_date2.default.format(date, format), format);
|
392 | };
|
393 | var ndate = normalizeDate(date);
|
394 | var nranges = ranges.map(function (range) {
|
395 | return range.map(normalizeDate);
|
396 | });
|
397 | if (nranges.some(function (nrange) {
|
398 | return ndate >= nrange[0] && ndate <= nrange[1];
|
399 | })) return date;
|
400 |
|
401 | var minDate = nranges[0][0];
|
402 | var maxDate = nranges[0][0];
|
403 |
|
404 | nranges.forEach(function (nrange) {
|
405 | minDate = new Date(Math.min(nrange[0], minDate));
|
406 | maxDate = new Date(Math.max(nrange[1], minDate));
|
407 | });
|
408 |
|
409 | var ret = ndate < minDate ? minDate : maxDate;
|
410 |
|
411 | return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
|
412 | };
|
413 |
|
414 | var timeWithinRange = exports.timeWithinRange = function timeWithinRange(date, selectableRange, format) {
|
415 | var limitedDate = limitTimeRange(date, selectableRange, format);
|
416 | return limitedDate.getTime() === date.getTime();
|
417 | };
|
418 |
|
419 | var changeYearMonthAndClampDate = exports.changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
|
420 |
|
421 |
|
422 | var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
|
423 | return modifyDate(date, year, month, monthDate);
|
424 | };
|
425 |
|
426 | var prevMonth = exports.prevMonth = function prevMonth(date) {
|
427 | var year = date.getFullYear();
|
428 | var month = date.getMonth();
|
429 | return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
|
430 | };
|
431 |
|
432 | var nextMonth = exports.nextMonth = function nextMonth(date) {
|
433 | var year = date.getFullYear();
|
434 | var month = date.getMonth();
|
435 | return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
|
436 | };
|
437 |
|
438 | var prevYear = exports.prevYear = function prevYear(date) {
|
439 | var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
440 |
|
441 | var year = date.getFullYear();
|
442 | var month = date.getMonth();
|
443 | return changeYearMonthAndClampDate(date, year - amount, month);
|
444 | };
|
445 |
|
446 | var nextYear = exports.nextYear = function nextYear(date) {
|
447 | var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
448 |
|
449 | var year = date.getFullYear();
|
450 | var month = date.getMonth();
|
451 | return changeYearMonthAndClampDate(date, year + amount, month);
|
452 | };
|
453 |
|
454 | var extractDateFormat = exports.extractDateFormat = function extractDateFormat(format) {
|
455 | return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
|
456 | };
|
457 |
|
458 | var extractTimeFormat = exports.extractTimeFormat = function extractTimeFormat(format) {
|
459 | return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
|
460 | };
|
461 |
|
462 | }),
|
463 |
|
464 | 12:
|
465 | (function(module, exports) {
|
466 |
|
467 | module.exports = require("element-ui/lib/locale");
|
468 |
|
469 | }),
|
470 |
|
471 | 17:
|
472 | (function(module, exports) {
|
473 |
|
474 | module.exports = require("element-ui/lib/scrollbar");
|
475 |
|
476 | }),
|
477 |
|
478 | 192:
|
479 | (function(module, exports, __webpack_require__) {
|
480 |
|
481 | "use strict";
|
482 |
|
483 |
|
484 | exports.__esModule = true;
|
485 |
|
486 | var _timeSelect = __webpack_require__(193);
|
487 |
|
488 | var _timeSelect2 = _interopRequireDefault(_timeSelect);
|
489 |
|
490 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
491 |
|
492 |
|
493 | _timeSelect2.default.install = function (Vue) {
|
494 | Vue.component(_timeSelect2.default.name, _timeSelect2.default);
|
495 | };
|
496 |
|
497 | exports.default = _timeSelect2.default;
|
498 |
|
499 | }),
|
500 |
|
501 | 193:
|
502 | (function(module, exports, __webpack_require__) {
|
503 |
|
504 | "use strict";
|
505 |
|
506 |
|
507 | exports.__esModule = true;
|
508 |
|
509 | var _picker = __webpack_require__(27);
|
510 |
|
511 | var _picker2 = _interopRequireDefault(_picker);
|
512 |
|
513 | var _timeSelect = __webpack_require__(194);
|
514 |
|
515 | var _timeSelect2 = _interopRequireDefault(_timeSelect);
|
516 |
|
517 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
518 |
|
519 | exports.default = {
|
520 | mixins: [_picker2.default],
|
521 |
|
522 | name: 'ElTimeSelect',
|
523 |
|
524 | componentName: 'ElTimeSelect',
|
525 |
|
526 | props: {
|
527 | type: {
|
528 | type: String,
|
529 | default: 'time-select'
|
530 | }
|
531 | },
|
532 |
|
533 | beforeCreate: function beforeCreate() {
|
534 | this.panel = _timeSelect2.default;
|
535 | }
|
536 | };
|
537 |
|
538 | }),
|
539 |
|
540 | 194:
|
541 | (function(module, __webpack_exports__, __webpack_require__) {
|
542 |
|
543 | "use strict";
|
544 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
545 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_select_vue__ = __webpack_require__(195);
|
546 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_select_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_select_vue__);
|
547 | var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_3aff1533_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_time_select_vue__ = __webpack_require__(196);
|
548 | var normalizeComponent = __webpack_require__(0)
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 | var __vue_template_functional__ = false
|
555 |
|
556 | var __vue_styles__ = null
|
557 |
|
558 | var __vue_scopeId__ = null
|
559 |
|
560 | var __vue_module_identifier__ = null
|
561 | var Component = normalizeComponent(
|
562 | __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_select_vue___default.a,
|
563 | __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_3aff1533_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_time_select_vue__["a" ],
|
564 | __vue_template_functional__,
|
565 | __vue_styles__,
|
566 | __vue_scopeId__,
|
567 | __vue_module_identifier__
|
568 | )
|
569 |
|
570 | __webpack_exports__["default"] = (Component.exports);
|
571 |
|
572 |
|
573 | }),
|
574 |
|
575 | 195:
|
576 | (function(module, exports, __webpack_require__) {
|
577 |
|
578 | "use strict";
|
579 |
|
580 |
|
581 | exports.__esModule = true;
|
582 |
|
583 | var _scrollbar = __webpack_require__(17);
|
584 |
|
585 | var _scrollbar2 = _interopRequireDefault(_scrollbar);
|
586 |
|
587 | var _scrollIntoView = __webpack_require__(26);
|
588 |
|
589 | var _scrollIntoView2 = _interopRequireDefault(_scrollIntoView);
|
590 |
|
591 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 |
|
613 | var parseTime = function parseTime(time) {
|
614 | var values = (time || '').split(':');
|
615 | if (values.length >= 2) {
|
616 | var hours = parseInt(values[0], 10);
|
617 | var minutes = parseInt(values[1], 10);
|
618 |
|
619 | return {
|
620 | hours: hours,
|
621 | minutes: minutes
|
622 | };
|
623 | }
|
624 |
|
625 | return null;
|
626 | };
|
627 |
|
628 | var compareTime = function compareTime(time1, time2) {
|
629 | var value1 = parseTime(time1);
|
630 | var value2 = parseTime(time2);
|
631 |
|
632 | var minutes1 = value1.minutes + value1.hours * 60;
|
633 | var minutes2 = value2.minutes + value2.hours * 60;
|
634 |
|
635 | if (minutes1 === minutes2) {
|
636 | return 0;
|
637 | }
|
638 |
|
639 | return minutes1 > minutes2 ? 1 : -1;
|
640 | };
|
641 |
|
642 | var formatTime = function formatTime(time) {
|
643 | return (time.hours < 10 ? '0' + time.hours : time.hours) + ':' + (time.minutes < 10 ? '0' + time.minutes : time.minutes);
|
644 | };
|
645 |
|
646 | var nextTime = function nextTime(time, step) {
|
647 | var timeValue = parseTime(time);
|
648 | var stepValue = parseTime(step);
|
649 |
|
650 | var next = {
|
651 | hours: timeValue.hours,
|
652 | minutes: timeValue.minutes
|
653 | };
|
654 |
|
655 | next.minutes += stepValue.minutes;
|
656 | next.hours += stepValue.hours;
|
657 |
|
658 | next.hours += Math.floor(next.minutes / 60);
|
659 | next.minutes = next.minutes % 60;
|
660 |
|
661 | return formatTime(next);
|
662 | };
|
663 |
|
664 | exports.default = {
|
665 | components: { ElScrollbar: _scrollbar2.default },
|
666 |
|
667 | watch: {
|
668 | value: function value(val) {
|
669 | var _this = this;
|
670 |
|
671 | if (!val) return;
|
672 | this.$nextTick(function () {
|
673 | return _this.scrollToOption();
|
674 | });
|
675 | }
|
676 | },
|
677 |
|
678 | methods: {
|
679 | handleClick: function handleClick(item) {
|
680 | if (!item.disabled) {
|
681 | this.$emit('pick', item.value);
|
682 | }
|
683 | },
|
684 | handleClear: function handleClear() {
|
685 | this.$emit('pick', null);
|
686 | },
|
687 | scrollToOption: function scrollToOption() {
|
688 | var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.selected';
|
689 |
|
690 | var menu = this.$refs.popper.querySelector('.el-picker-panel__content');
|
691 | (0, _scrollIntoView2.default)(menu, menu.querySelector(selector));
|
692 | },
|
693 | handleMenuEnter: function handleMenuEnter() {
|
694 | var _this2 = this;
|
695 |
|
696 | var selected = this.items.map(function (item) {
|
697 | return item.value;
|
698 | }).indexOf(this.value) !== -1;
|
699 | var hasDefault = this.items.map(function (item) {
|
700 | return item.value;
|
701 | }).indexOf(this.defaultValue) !== -1;
|
702 | var option = selected && '.selected' || hasDefault && '.default' || '.time-select-item:not(.disabled)';
|
703 | this.$nextTick(function () {
|
704 | return _this2.scrollToOption(option);
|
705 | });
|
706 | },
|
707 | scrollDown: function scrollDown(step) {
|
708 | var items = this.items;
|
709 | var length = items.length;
|
710 | var total = items.length;
|
711 | var index = items.map(function (item) {
|
712 | return item.value;
|
713 | }).indexOf(this.value);
|
714 | while (total--) {
|
715 | index = (index + step + length) % length;
|
716 | if (!items[index].disabled) {
|
717 | this.$emit('pick', items[index].value, true);
|
718 | return;
|
719 | }
|
720 | }
|
721 | },
|
722 | isValidValue: function isValidValue(date) {
|
723 | return this.items.filter(function (item) {
|
724 | return !item.disabled;
|
725 | }).map(function (item) {
|
726 | return item.value;
|
727 | }).indexOf(date) !== -1;
|
728 | },
|
729 | handleKeydown: function handleKeydown(event) {
|
730 | var keyCode = event.keyCode;
|
731 | if (keyCode === 38 || keyCode === 40) {
|
732 | var mapping = { 40: 1, 38: -1 };
|
733 | var offset = mapping[keyCode.toString()];
|
734 | this.scrollDown(offset);
|
735 | event.stopPropagation();
|
736 | return;
|
737 | }
|
738 | }
|
739 | },
|
740 |
|
741 | data: function data() {
|
742 | return {
|
743 | popperClass: '',
|
744 | start: '09:00',
|
745 | end: '18:00',
|
746 | step: '00:30',
|
747 | value: '',
|
748 | defaultValue: '',
|
749 | visible: false,
|
750 | minTime: '',
|
751 | maxTime: '',
|
752 | width: 0
|
753 | };
|
754 | },
|
755 |
|
756 |
|
757 | computed: {
|
758 | items: function items() {
|
759 | var start = this.start;
|
760 | var end = this.end;
|
761 | var step = this.step;
|
762 |
|
763 | var result = [];
|
764 |
|
765 | if (start && end && step) {
|
766 | var current = start;
|
767 | while (compareTime(current, end) <= 0) {
|
768 | result.push({
|
769 | value: current,
|
770 | disabled: compareTime(current, this.minTime || '-1:-1') <= 0 || compareTime(current, this.maxTime || '100:100') >= 0
|
771 | });
|
772 | current = nextTime(current, step);
|
773 | }
|
774 | }
|
775 |
|
776 | return result;
|
777 | }
|
778 | }
|
779 | };
|
780 |
|
781 | }),
|
782 |
|
783 | 196:
|
784 | (function(module, __webpack_exports__, __webpack_require__) {
|
785 |
|
786 | "use strict";
|
787 | 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:{"before-enter":_vm.handleMenuEnter,"after-leave":function($event){_vm.$emit('dodestroy')}}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.visible),expression:"visible"}],ref:"popper",staticClass:"el-picker-panel time-select el-popper",class:_vm.popperClass,style:({ width: _vm.width + 'px' })},[_c('el-scrollbar',{attrs:{"noresize":"","wrap-class":"el-picker-panel__content"}},_vm._l((_vm.items),function(item){return _c('div',{staticClass:"time-select-item",class:{ selected: _vm.value === item.value, disabled: item.disabled, default: item.value === _vm.defaultValue },attrs:{"disabled":item.disabled},on:{"click":function($event){_vm.handleClick(item)}}},[_vm._v(_vm._s(item.value))])}))],1)])}
|
788 | var staticRenderFns = []
|
789 | var esExports = { render: render, staticRenderFns: staticRenderFns }
|
790 | __webpack_exports__["a"] = (esExports);
|
791 |
|
792 | }),
|
793 |
|
794 | 26:
|
795 | (function(module, exports) {
|
796 |
|
797 | module.exports = require("element-ui/lib/utils/scroll-into-view");
|
798 |
|
799 | }),
|
800 |
|
801 | 27:
|
802 | (function(module, __webpack_exports__, __webpack_require__) {
|
803 |
|
804 | "use strict";
|
805 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
806 | var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue__ = __webpack_require__(28);
|
807 | 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__);
|
808 | 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);
|
809 | var normalizeComponent = __webpack_require__(0)
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 | var __vue_template_functional__ = false
|
816 |
|
817 | var __vue_styles__ = null
|
818 |
|
819 | var __vue_scopeId__ = null
|
820 |
|
821 | var __vue_module_identifier__ = null
|
822 | var Component = normalizeComponent(
|
823 | __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue___default.a,
|
824 | __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" ],
|
825 | __vue_template_functional__,
|
826 | __vue_styles__,
|
827 | __vue_scopeId__,
|
828 | __vue_module_identifier__
|
829 | )
|
830 |
|
831 | __webpack_exports__["default"] = (Component.exports);
|
832 |
|
833 |
|
834 | }),
|
835 |
|
836 | 28:
|
837 | (function(module, exports, __webpack_require__) {
|
838 |
|
839 | "use strict";
|
840 |
|
841 |
|
842 | exports.__esModule = true;
|
843 |
|
844 | var _vue = __webpack_require__(4);
|
845 |
|
846 | var _vue2 = _interopRequireDefault(_vue);
|
847 |
|
848 | var _clickoutside = __webpack_require__(10);
|
849 |
|
850 | var _clickoutside2 = _interopRequireDefault(_clickoutside);
|
851 |
|
852 | var _util = __webpack_require__(11);
|
853 |
|
854 | var _vuePopper = __webpack_require__(7);
|
855 |
|
856 | var _vuePopper2 = _interopRequireDefault(_vuePopper);
|
857 |
|
858 | var _emitter = __webpack_require__(1);
|
859 |
|
860 | var _emitter2 = _interopRequireDefault(_emitter);
|
861 |
|
862 | var _input = __webpack_require__(6);
|
863 |
|
864 | var _input2 = _interopRequireDefault(_input);
|
865 |
|
866 | var _merge = __webpack_require__(9);
|
867 |
|
868 | var _merge2 = _interopRequireDefault(_merge);
|
869 |
|
870 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
871 |
|
872 | var NewPopper = {
|
873 | props: {
|
874 | appendToBody: _vuePopper2.default.props.appendToBody,
|
875 | offset: _vuePopper2.default.props.offset,
|
876 | boundariesPadding: _vuePopper2.default.props.boundariesPadding,
|
877 | arrowOffset: _vuePopper2.default.props.arrowOffset
|
878 | },
|
879 | methods: _vuePopper2.default.methods,
|
880 | data: function data() {
|
881 | return (0, _merge2.default)({ visibleArrow: true }, _vuePopper2.default.data);
|
882 | },
|
883 |
|
884 | beforeDestroy: _vuePopper2.default.beforeDestroy
|
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 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 | var DEFAULT_FORMATS = {
|
970 | date: 'yyyy-MM-dd',
|
971 | month: 'yyyy-MM',
|
972 | datetime: 'yyyy-MM-dd HH:mm:ss',
|
973 | time: 'HH:mm:ss',
|
974 | week: 'yyyywWW',
|
975 | timerange: 'HH:mm:ss',
|
976 | daterange: 'yyyy-MM-dd',
|
977 | datetimerange: 'yyyy-MM-dd HH:mm:ss',
|
978 | year: 'yyyy'
|
979 | };
|
980 | var HAVE_TRIGGER_TYPES = ['date', 'datetime', 'time', 'time-select', 'week', 'month', 'year', 'daterange', 'timerange', 'datetimerange', 'dates'];
|
981 | var DATE_FORMATTER = function DATE_FORMATTER(value, format) {
|
982 | if (format === 'timestamp') return value.getTime();
|
983 | return (0, _util.formatDate)(value, format);
|
984 | };
|
985 | var DATE_PARSER = function DATE_PARSER(text, format) {
|
986 | if (format === 'timestamp') return new Date(Number(text));
|
987 | return (0, _util.parseDate)(text, format);
|
988 | };
|
989 | var RANGE_FORMATTER = function RANGE_FORMATTER(value, format) {
|
990 | if (Array.isArray(value) && value.length === 2) {
|
991 | var start = value[0];
|
992 | var end = value[1];
|
993 |
|
994 | if (start && end) {
|
995 | return [DATE_FORMATTER(start, format), DATE_FORMATTER(end, format)];
|
996 | }
|
997 | }
|
998 | return '';
|
999 | };
|
1000 | var RANGE_PARSER = function RANGE_PARSER(array, format, separator) {
|
1001 | if (!Array.isArray(array)) {
|
1002 | array = array.split(separator);
|
1003 | }
|
1004 | if (array.length === 2) {
|
1005 | var range1 = array[0];
|
1006 | var range2 = array[1];
|
1007 |
|
1008 | return [DATE_PARSER(range1, format), DATE_PARSER(range2, format)];
|
1009 | }
|
1010 | return [];
|
1011 | };
|
1012 | var TYPE_VALUE_RESOLVER_MAP = {
|
1013 | default: {
|
1014 | formatter: function formatter(value) {
|
1015 | if (!value) return '';
|
1016 | return '' + value;
|
1017 | },
|
1018 | parser: function parser(text) {
|
1019 | if (text === undefined || text === '') return null;
|
1020 | return text;
|
1021 | }
|
1022 | },
|
1023 | week: {
|
1024 | formatter: function formatter(value, format) {
|
1025 | var week = (0, _util.getWeekNumber)(value);
|
1026 | var month = value.getMonth();
|
1027 | var trueDate = new Date(value);
|
1028 | if (week === 1 && month === 11) {
|
1029 | trueDate.setHours(0, 0, 0, 0);
|
1030 | trueDate.setDate(trueDate.getDate() + 3 - (trueDate.getDay() + 6) % 7);
|
1031 | }
|
1032 | var date = (0, _util.formatDate)(trueDate, format);
|
1033 |
|
1034 | date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? '0' + week : week) : date.replace(/W/, week);
|
1035 | return date;
|
1036 | },
|
1037 | parser: function parser(text) {
|
1038 | var array = (text || '').split('w');
|
1039 | if (array.length === 2) {
|
1040 | var year = Number(array[0]);
|
1041 | var month = Number(array[1]);
|
1042 |
|
1043 | if (!isNaN(year) && !isNaN(month) && month < 54) {
|
1044 | return text;
|
1045 | }
|
1046 | }
|
1047 | return null;
|
1048 | }
|
1049 | },
|
1050 | date: {
|
1051 | formatter: DATE_FORMATTER,
|
1052 | parser: DATE_PARSER
|
1053 | },
|
1054 | datetime: {
|
1055 | formatter: DATE_FORMATTER,
|
1056 | parser: DATE_PARSER
|
1057 | },
|
1058 | daterange: {
|
1059 | formatter: RANGE_FORMATTER,
|
1060 | parser: RANGE_PARSER
|
1061 | },
|
1062 | datetimerange: {
|
1063 | formatter: RANGE_FORMATTER,
|
1064 | parser: RANGE_PARSER
|
1065 | },
|
1066 | timerange: {
|
1067 | formatter: RANGE_FORMATTER,
|
1068 | parser: RANGE_PARSER
|
1069 | },
|
1070 | time: {
|
1071 | formatter: DATE_FORMATTER,
|
1072 | parser: DATE_PARSER
|
1073 | },
|
1074 | month: {
|
1075 | formatter: DATE_FORMATTER,
|
1076 | parser: DATE_PARSER
|
1077 | },
|
1078 | year: {
|
1079 | formatter: DATE_FORMATTER,
|
1080 | parser: DATE_PARSER
|
1081 | },
|
1082 | number: {
|
1083 | formatter: function formatter(value) {
|
1084 | if (!value) return '';
|
1085 | return '' + value;
|
1086 | },
|
1087 | parser: function parser(text) {
|
1088 | var result = Number(text);
|
1089 |
|
1090 | if (!isNaN(text)) {
|
1091 | return result;
|
1092 | } else {
|
1093 | return null;
|
1094 | }
|
1095 | }
|
1096 | },
|
1097 | dates: {
|
1098 | formatter: function formatter(value, format) {
|
1099 | return value.map(function (date) {
|
1100 | return DATE_FORMATTER(date, format);
|
1101 | });
|
1102 | },
|
1103 | parser: function parser(value, format) {
|
1104 | return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
|
1105 | return date instanceof Date ? date : DATE_PARSER(date, format);
|
1106 | });
|
1107 | }
|
1108 | }
|
1109 | };
|
1110 | var PLACEMENT_MAP = {
|
1111 | left: 'bottom-start',
|
1112 | center: 'bottom',
|
1113 | right: 'bottom-end'
|
1114 | };
|
1115 |
|
1116 | var parseAsFormatAndType = function parseAsFormatAndType(value, customFormat, type) {
|
1117 | var rangeSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '-';
|
1118 |
|
1119 | if (!value) return null;
|
1120 | var parser = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).parser;
|
1121 | var format = customFormat || DEFAULT_FORMATS[type];
|
1122 | return parser(value, format, rangeSeparator);
|
1123 | };
|
1124 |
|
1125 | var formatAsFormatAndType = function formatAsFormatAndType(value, customFormat, type) {
|
1126 | if (!value) return null;
|
1127 | var formatter = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).formatter;
|
1128 | var format = customFormat || DEFAULT_FORMATS[type];
|
1129 | return formatter(value, format);
|
1130 | };
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 | var valueEquals = function valueEquals(a, b) {
|
1139 |
|
1140 | var dateEquals = function dateEquals(a, b) {
|
1141 | var aIsDate = a instanceof Date;
|
1142 | var bIsDate = b instanceof Date;
|
1143 | if (aIsDate && bIsDate) {
|
1144 | return a.getTime() === b.getTime();
|
1145 | }
|
1146 | if (!aIsDate && !bIsDate) {
|
1147 | return a === b;
|
1148 | }
|
1149 | return false;
|
1150 | };
|
1151 |
|
1152 | var aIsArray = a instanceof Array;
|
1153 | var bIsArray = b instanceof Array;
|
1154 | if (aIsArray && bIsArray) {
|
1155 | if (a.length !== b.length) {
|
1156 | return false;
|
1157 | }
|
1158 | return a.every(function (item, index) {
|
1159 | return dateEquals(item, b[index]);
|
1160 | });
|
1161 | }
|
1162 | if (!aIsArray && !bIsArray) {
|
1163 | return dateEquals(a, b);
|
1164 | }
|
1165 | return false;
|
1166 | };
|
1167 |
|
1168 | var isString = function isString(val) {
|
1169 | return typeof val === 'string' || val instanceof String;
|
1170 | };
|
1171 |
|
1172 | var validator = function validator(val) {
|
1173 |
|
1174 | return val === null || val === undefined || isString(val) || Array.isArray(val) && val.length === 2 && val.every(isString);
|
1175 | };
|
1176 |
|
1177 | exports.default = {
|
1178 | mixins: [_emitter2.default, NewPopper],
|
1179 |
|
1180 | inject: {
|
1181 | elForm: {
|
1182 | default: ''
|
1183 | },
|
1184 | elFormItem: {
|
1185 | default: ''
|
1186 | }
|
1187 | },
|
1188 |
|
1189 | props: {
|
1190 | size: String,
|
1191 | format: String,
|
1192 | valueFormat: String,
|
1193 | readonly: Boolean,
|
1194 | placeholder: String,
|
1195 | startPlaceholder: String,
|
1196 | endPlaceholder: String,
|
1197 | prefixIcon: String,
|
1198 | clearIcon: {
|
1199 | type: String,
|
1200 | default: 'el-icon-circle-close'
|
1201 | },
|
1202 | name: {
|
1203 | default: '',
|
1204 | validator: validator
|
1205 | },
|
1206 | disabled: Boolean,
|
1207 | clearable: {
|
1208 | type: Boolean,
|
1209 | default: true
|
1210 | },
|
1211 | id: {
|
1212 | default: '',
|
1213 | validator: validator
|
1214 | },
|
1215 | popperClass: String,
|
1216 | editable: {
|
1217 | type: Boolean,
|
1218 | default: true
|
1219 | },
|
1220 | align: {
|
1221 | type: String,
|
1222 | default: 'left'
|
1223 | },
|
1224 | value: {},
|
1225 | defaultValue: {},
|
1226 | defaultTime: {},
|
1227 | rangeSeparator: {
|
1228 | default: '-'
|
1229 | },
|
1230 | pickerOptions: {},
|
1231 | unlinkPanels: Boolean
|
1232 | },
|
1233 |
|
1234 | components: { ElInput: _input2.default },
|
1235 |
|
1236 | directives: { Clickoutside: _clickoutside2.default },
|
1237 |
|
1238 | data: function data() {
|
1239 | return {
|
1240 | pickerVisible: false,
|
1241 | showClose: false,
|
1242 | userInput: null,
|
1243 | valueOnOpen: null,
|
1244 | unwatchPickerOptions: null
|
1245 | };
|
1246 | },
|
1247 |
|
1248 |
|
1249 | watch: {
|
1250 | pickerVisible: function pickerVisible(val) {
|
1251 | if (this.readonly || this.pickerDisabled) return;
|
1252 | if (val) {
|
1253 | this.showPicker();
|
1254 | this.valueOnOpen = Array.isArray(this.value) ? [].concat(this.value) : this.value;
|
1255 | } else {
|
1256 | this.hidePicker();
|
1257 | this.emitChange(this.value);
|
1258 | this.userInput = null;
|
1259 | this.dispatch('ElFormItem', 'el.form.blur');
|
1260 | this.$emit('blur', this);
|
1261 | this.blur();
|
1262 | }
|
1263 | },
|
1264 |
|
1265 | parsedValue: {
|
1266 | immediate: true,
|
1267 | handler: function handler(val) {
|
1268 | if (this.picker) {
|
1269 | this.picker.value = val;
|
1270 | }
|
1271 | }
|
1272 | },
|
1273 | defaultValue: function defaultValue(val) {
|
1274 |
|
1275 | if (this.picker) {
|
1276 | this.picker.defaultValue = val;
|
1277 | }
|
1278 | },
|
1279 | value: function value(val, oldVal) {
|
1280 | if (!valueEquals(val, oldVal) && !this.pickerVisible) {
|
1281 | this.dispatch('ElFormItem', 'el.form.change', val);
|
1282 | }
|
1283 | }
|
1284 | },
|
1285 |
|
1286 | computed: {
|
1287 | ranged: function ranged() {
|
1288 | return this.type.indexOf('range') > -1;
|
1289 | },
|
1290 | reference: function reference() {
|
1291 | var reference = this.$refs.reference;
|
1292 | return reference.$el || reference;
|
1293 | },
|
1294 | refInput: function refInput() {
|
1295 | if (this.reference) {
|
1296 | return [].slice.call(this.reference.querySelectorAll('input'));
|
1297 | }
|
1298 | return [];
|
1299 | },
|
1300 | valueIsEmpty: function valueIsEmpty() {
|
1301 | var val = this.value;
|
1302 | if (Array.isArray(val)) {
|
1303 | for (var i = 0, len = val.length; i < len; i++) {
|
1304 | if (val[i]) {
|
1305 | return false;
|
1306 | }
|
1307 | }
|
1308 | } else {
|
1309 | if (val) {
|
1310 | return false;
|
1311 | }
|
1312 | }
|
1313 | return true;
|
1314 | },
|
1315 | triggerClass: function triggerClass() {
|
1316 | return this.prefixIcon || (this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date');
|
1317 | },
|
1318 | selectionMode: function selectionMode() {
|
1319 | if (this.type === 'week') {
|
1320 | return 'week';
|
1321 | } else if (this.type === 'month') {
|
1322 | return 'month';
|
1323 | } else if (this.type === 'year') {
|
1324 | return 'year';
|
1325 | } else if (this.type === 'dates') {
|
1326 | return 'dates';
|
1327 | }
|
1328 |
|
1329 | return 'day';
|
1330 | },
|
1331 | haveTrigger: function haveTrigger() {
|
1332 | if (typeof this.showTrigger !== 'undefined') {
|
1333 | return this.showTrigger;
|
1334 | }
|
1335 | return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
|
1336 | },
|
1337 | displayValue: function displayValue() {
|
1338 | var formattedValue = formatAsFormatAndType(this.parsedValue, this.format, this.type, this.rangeSeparator);
|
1339 | if (Array.isArray(this.userInput)) {
|
1340 | return [this.userInput[0] || formattedValue && formattedValue[0] || '', this.userInput[1] || formattedValue && formattedValue[1] || ''];
|
1341 | } else if (this.userInput !== null) {
|
1342 | return this.userInput;
|
1343 | } else if (formattedValue) {
|
1344 | return this.type === 'dates' ? formattedValue.join(', ') : formattedValue;
|
1345 | } else {
|
1346 | return '';
|
1347 | }
|
1348 | },
|
1349 | parsedValue: function parsedValue() {
|
1350 | if (!this.value) return this.value;
|
1351 | if (this.type === 'time-select') return this.value;
|
1352 |
|
1353 | var valueIsDateObject = (0, _util.isDateObject)(this.value) || Array.isArray(this.value) && this.value.every(_util.isDateObject);
|
1354 | if (valueIsDateObject) {
|
1355 | return this.value;
|
1356 | }
|
1357 |
|
1358 | if (this.valueFormat) {
|
1359 | return parseAsFormatAndType(this.value, this.valueFormat, this.type, this.rangeSeparator) || this.value;
|
1360 | }
|
1361 |
|
1362 |
|
1363 |
|
1364 | return Array.isArray(this.value) ? this.value.map(function (val) {
|
1365 | return new Date(val);
|
1366 | }) : new Date(this.value);
|
1367 | },
|
1368 | _elFormItemSize: function _elFormItemSize() {
|
1369 | return (this.elFormItem || {}).elFormItemSize;
|
1370 | },
|
1371 | pickerSize: function pickerSize() {
|
1372 | return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
1373 | },
|
1374 | pickerDisabled: function pickerDisabled() {
|
1375 | return this.disabled || (this.elForm || {}).disabled;
|
1376 | },
|
1377 | firstInputId: function firstInputId() {
|
1378 | var obj = {};
|
1379 | var id = void 0;
|
1380 | if (this.ranged) {
|
1381 | id = this.id && this.id[0];
|
1382 | } else {
|
1383 | id = this.id;
|
1384 | }
|
1385 | if (id) obj.id = id;
|
1386 | return obj;
|
1387 | },
|
1388 | secondInputId: function secondInputId() {
|
1389 | var obj = {};
|
1390 | var id = void 0;
|
1391 | if (this.ranged) {
|
1392 | id = this.id && this.id[1];
|
1393 | }
|
1394 | if (id) obj.id = id;
|
1395 | return obj;
|
1396 | }
|
1397 | },
|
1398 |
|
1399 | created: function created() {
|
1400 |
|
1401 | this.popperOptions = {
|
1402 | boundariesPadding: 0,
|
1403 | gpuAcceleration: false
|
1404 | };
|
1405 | this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
|
1406 |
|
1407 | this.$on('fieldReset', this.handleFieldReset);
|
1408 | },
|
1409 |
|
1410 |
|
1411 | methods: {
|
1412 | focus: function focus() {
|
1413 | if (!this.ranged) {
|
1414 | this.$refs.reference.focus();
|
1415 | } else {
|
1416 | this.handleFocus();
|
1417 | }
|
1418 | },
|
1419 | blur: function blur() {
|
1420 | this.refInput.forEach(function (input) {
|
1421 | return input.blur();
|
1422 | });
|
1423 | },
|
1424 |
|
1425 |
|
1426 |
|
1427 | parseValue: function parseValue(value) {
|
1428 | var isParsed = (0, _util.isDateObject)(value) || Array.isArray(value) && value.every(_util.isDateObject);
|
1429 | if (this.valueFormat && !isParsed) {
|
1430 | return parseAsFormatAndType(value, this.valueFormat, this.type, this.rangeSeparator) || value;
|
1431 | } else {
|
1432 | return value;
|
1433 | }
|
1434 | },
|
1435 | formatToValue: function formatToValue(date) {
|
1436 | var isFormattable = (0, _util.isDateObject)(date) || Array.isArray(date) && date.every(_util.isDateObject);
|
1437 | if (this.valueFormat && isFormattable) {
|
1438 | return formatAsFormatAndType(date, this.valueFormat, this.type, this.rangeSeparator);
|
1439 | } else {
|
1440 | return date;
|
1441 | }
|
1442 | },
|
1443 |
|
1444 |
|
1445 |
|
1446 | parseString: function parseString(value) {
|
1447 | var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
|
1448 | return parseAsFormatAndType(value, this.format, type);
|
1449 | },
|
1450 | formatToString: function formatToString(value) {
|
1451 | var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
|
1452 | return formatAsFormatAndType(value, this.format, type);
|
1453 | },
|
1454 | handleMouseEnter: function handleMouseEnter() {
|
1455 | if (this.readonly || this.pickerDisabled) return;
|
1456 | if (!this.valueIsEmpty && this.clearable) {
|
1457 | this.showClose = true;
|
1458 | }
|
1459 | },
|
1460 | handleChange: function handleChange() {
|
1461 | if (this.userInput) {
|
1462 | var value = this.parseString(this.displayValue);
|
1463 | if (value) {
|
1464 | this.picker.value = value;
|
1465 | if (this.isValidValue(value)) {
|
1466 | this.emitInput(value);
|
1467 | this.userInput = null;
|
1468 | }
|
1469 | }
|
1470 | }
|
1471 | if (this.userInput === '') {
|
1472 | this.emitInput(null);
|
1473 | this.emitChange(null);
|
1474 | this.userInput = null;
|
1475 | }
|
1476 | },
|
1477 | handleStartInput: function handleStartInput(event) {
|
1478 | if (this.userInput) {
|
1479 | this.userInput = [event.target.value, this.userInput[1]];
|
1480 | } else {
|
1481 | this.userInput = [event.target.value, null];
|
1482 | }
|
1483 | },
|
1484 | handleEndInput: function handleEndInput(event) {
|
1485 | if (this.userInput) {
|
1486 | this.userInput = [this.userInput[0], event.target.value];
|
1487 | } else {
|
1488 | this.userInput = [null, event.target.value];
|
1489 | }
|
1490 | },
|
1491 | handleStartChange: function handleStartChange(event) {
|
1492 | var value = this.parseString(this.userInput && this.userInput[0]);
|
1493 | if (value) {
|
1494 | this.userInput = [this.formatToString(value), this.displayValue[1]];
|
1495 | var newValue = [value, this.picker.value && this.picker.value[1]];
|
1496 | this.picker.value = newValue;
|
1497 | if (this.isValidValue(newValue)) {
|
1498 | this.emitInput(newValue);
|
1499 | this.userInput = null;
|
1500 | }
|
1501 | }
|
1502 | },
|
1503 | handleEndChange: function handleEndChange(event) {
|
1504 | var value = this.parseString(this.userInput && this.userInput[1]);
|
1505 | if (value) {
|
1506 | this.userInput = [this.displayValue[0], this.formatToString(value)];
|
1507 | var newValue = [this.picker.value && this.picker.value[0], value];
|
1508 | this.picker.value = newValue;
|
1509 | if (this.isValidValue(newValue)) {
|
1510 | this.emitInput(newValue);
|
1511 | this.userInput = null;
|
1512 | }
|
1513 | }
|
1514 | },
|
1515 | handleClickIcon: function handleClickIcon(event) {
|
1516 | if (this.readonly || this.pickerDisabled) return;
|
1517 | if (this.showClose) {
|
1518 | this.valueOnOpen = this.value;
|
1519 | event.stopPropagation();
|
1520 | this.emitInput(null);
|
1521 | this.emitChange(null);
|
1522 | this.showClose = false;
|
1523 | if (this.picker && typeof this.picker.handleClear === 'function') {
|
1524 | this.picker.handleClear();
|
1525 | }
|
1526 | } else {
|
1527 | this.pickerVisible = !this.pickerVisible;
|
1528 | }
|
1529 | },
|
1530 | handleClose: function handleClose() {
|
1531 | if (!this.pickerVisible) return;
|
1532 | this.pickerVisible = false;
|
1533 |
|
1534 | if (this.type === 'dates') {
|
1535 |
|
1536 | var oldValue = parseAsFormatAndType(this.valueOnOpen, this.valueFormat, this.type, this.rangeSeparator) || this.valueOnOpen;
|
1537 | this.emitInput(oldValue);
|
1538 | }
|
1539 | },
|
1540 | handleFieldReset: function handleFieldReset(initialValue) {
|
1541 | this.userInput = initialValue === '' ? null : initialValue;
|
1542 | },
|
1543 | handleFocus: function handleFocus() {
|
1544 | var type = this.type;
|
1545 |
|
1546 | if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
|
1547 | this.pickerVisible = true;
|
1548 | }
|
1549 | this.$emit('focus', this);
|
1550 | },
|
1551 | handleKeydown: function handleKeydown(event) {
|
1552 | var _this = this;
|
1553 |
|
1554 | var keyCode = event.keyCode;
|
1555 |
|
1556 |
|
1557 | if (keyCode === 27) {
|
1558 | this.pickerVisible = false;
|
1559 | event.stopPropagation();
|
1560 | return;
|
1561 | }
|
1562 |
|
1563 |
|
1564 | if (keyCode === 9) {
|
1565 | if (!this.ranged) {
|
1566 | this.handleChange();
|
1567 | this.pickerVisible = this.picker.visible = false;
|
1568 | this.blur();
|
1569 | event.stopPropagation();
|
1570 | } else {
|
1571 |
|
1572 | setTimeout(function () {
|
1573 | if (_this.refInput.indexOf(document.activeElement) === -1) {
|
1574 | _this.pickerVisible = false;
|
1575 | _this.blur();
|
1576 | event.stopPropagation();
|
1577 | }
|
1578 | }, 0);
|
1579 | }
|
1580 | return;
|
1581 | }
|
1582 |
|
1583 |
|
1584 | if (keyCode === 13) {
|
1585 | if (this.userInput === '' || this.isValidValue(this.parseString(this.displayValue))) {
|
1586 | this.handleChange();
|
1587 | this.pickerVisible = this.picker.visible = false;
|
1588 | this.blur();
|
1589 | }
|
1590 | event.stopPropagation();
|
1591 | return;
|
1592 | }
|
1593 |
|
1594 |
|
1595 | if (this.userInput) {
|
1596 | event.stopPropagation();
|
1597 | return;
|
1598 | }
|
1599 |
|
1600 |
|
1601 | if (this.picker && this.picker.handleKeydown) {
|
1602 | this.picker.handleKeydown(event);
|
1603 | }
|
1604 | },
|
1605 | handleRangeClick: function handleRangeClick() {
|
1606 | var type = this.type;
|
1607 |
|
1608 | if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
|
1609 | this.pickerVisible = true;
|
1610 | }
|
1611 | this.$emit('focus', this);
|
1612 | },
|
1613 | hidePicker: function hidePicker() {
|
1614 | if (this.picker) {
|
1615 | this.picker.resetView && this.picker.resetView();
|
1616 | this.pickerVisible = this.picker.visible = false;
|
1617 | this.destroyPopper();
|
1618 | }
|
1619 | },
|
1620 | showPicker: function showPicker() {
|
1621 | var _this2 = this;
|
1622 |
|
1623 | if (this.$isServer) return;
|
1624 | if (!this.picker) {
|
1625 | this.mountPicker();
|
1626 | }
|
1627 | this.pickerVisible = this.picker.visible = true;
|
1628 |
|
1629 | this.updatePopper();
|
1630 |
|
1631 | this.picker.value = this.parsedValue;
|
1632 | this.picker.resetView && this.picker.resetView();
|
1633 |
|
1634 | this.$nextTick(function () {
|
1635 | _this2.picker.adjustSpinners && _this2.picker.adjustSpinners();
|
1636 | });
|
1637 | },
|
1638 | mountPicker: function mountPicker() {
|
1639 | var _this3 = this;
|
1640 |
|
1641 | this.picker = new _vue2.default(this.panel).$mount();
|
1642 | this.picker.defaultValue = this.defaultValue;
|
1643 | this.picker.defaultTime = this.defaultTime;
|
1644 | this.picker.popperClass = this.popperClass;
|
1645 | this.popperElm = this.picker.$el;
|
1646 | this.picker.width = this.reference.getBoundingClientRect().width;
|
1647 | this.picker.showTime = this.type === 'datetime' || this.type === 'datetimerange';
|
1648 | this.picker.selectionMode = this.selectionMode;
|
1649 | this.picker.unlinkPanels = this.unlinkPanels;
|
1650 | this.picker.arrowControl = this.arrowControl || this.timeArrowControl || false;
|
1651 | this.$watch('format', function (format) {
|
1652 | _this3.picker.format = format;
|
1653 | });
|
1654 |
|
1655 | var updateOptions = function updateOptions() {
|
1656 | var options = _this3.pickerOptions;
|
1657 |
|
1658 | if (options && options.selectableRange) {
|
1659 | (function () {
|
1660 | var ranges = options.selectableRange;
|
1661 | var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
|
1662 | var format = DEFAULT_FORMATS.timerange;
|
1663 |
|
1664 | ranges = Array.isArray(ranges) ? ranges : [ranges];
|
1665 | _this3.picker.selectableRange = ranges.map(function (range) {
|
1666 | return parser(range, format, _this3.rangeSeparator);
|
1667 | });
|
1668 | })();
|
1669 | }
|
1670 |
|
1671 | for (var option in options) {
|
1672 | if (options.hasOwnProperty(option) &&
|
1673 |
|
1674 | option !== 'selectableRange') {
|
1675 | _this3.picker[option] = options[option];
|
1676 | }
|
1677 | }
|
1678 |
|
1679 |
|
1680 | if (_this3.format) {
|
1681 | _this3.picker.format = _this3.format;
|
1682 | }
|
1683 | };
|
1684 | updateOptions();
|
1685 | this.unwatchPickerOptions = this.$watch('pickerOptions', function () {
|
1686 | return updateOptions();
|
1687 | }, { deep: true });
|
1688 |
|
1689 | this.$el.appendChild(this.picker.$el);
|
1690 | this.picker.resetView && this.picker.resetView();
|
1691 |
|
1692 | this.picker.$on('dodestroy', this.doDestroy);
|
1693 | this.picker.$on('pick', function () {
|
1694 | var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
1695 | var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
1696 |
|
1697 | _this3.userInput = null;
|
1698 | _this3.pickerVisible = _this3.picker.visible = visible;
|
1699 | _this3.emitInput(date);
|
1700 | _this3.picker.resetView && _this3.picker.resetView();
|
1701 | });
|
1702 |
|
1703 | this.picker.$on('select-range', function (start, end, pos) {
|
1704 | if (_this3.refInput.length === 0) return;
|
1705 | if (!pos || pos === 'min') {
|
1706 | _this3.refInput[0].setSelectionRange(start, end);
|
1707 | _this3.refInput[0].focus();
|
1708 | } else if (pos === 'max') {
|
1709 | _this3.refInput[1].setSelectionRange(start, end);
|
1710 | _this3.refInput[1].focus();
|
1711 | }
|
1712 | });
|
1713 | },
|
1714 | unmountPicker: function unmountPicker() {
|
1715 | if (this.picker) {
|
1716 | this.picker.$destroy();
|
1717 | this.picker.$off();
|
1718 | if (typeof this.unwatchPickerOptions === 'function') {
|
1719 | this.unwatchPickerOptions();
|
1720 | }
|
1721 | this.picker.$el.parentNode.removeChild(this.picker.$el);
|
1722 | }
|
1723 | },
|
1724 | emitChange: function emitChange(val) {
|
1725 |
|
1726 | if (!valueEquals(val, this.valueOnOpen)) {
|
1727 | this.$emit('change', val);
|
1728 | this.dispatch('ElFormItem', 'el.form.change', val);
|
1729 | this.valueOnOpen = val;
|
1730 | }
|
1731 | },
|
1732 | emitInput: function emitInput(val) {
|
1733 | var formatted = this.formatToValue(val);
|
1734 | if (!valueEquals(this.value, formatted)) {
|
1735 | this.$emit('input', formatted);
|
1736 | }
|
1737 | },
|
1738 | isValidValue: function isValidValue(value) {
|
1739 | if (!this.picker) {
|
1740 | this.mountPicker();
|
1741 | }
|
1742 | if (this.picker.isValidValue) {
|
1743 | return value && this.picker.isValidValue(value);
|
1744 | } else {
|
1745 | return true;
|
1746 | }
|
1747 | }
|
1748 | }
|
1749 | };
|
1750 |
|
1751 | }),
|
1752 |
|
1753 | 29:
|
1754 | (function(module, exports) {
|
1755 |
|
1756 | module.exports = require("element-ui/lib/utils/date");
|
1757 |
|
1758 | }),
|
1759 |
|
1760 | 30:
|
1761 | (function(module, __webpack_exports__, __webpack_require__) {
|
1762 |
|
1763 | "use strict";
|
1764 | 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:[
|
1765 | 'el-date-editor--' + _vm.type,
|
1766 | _vm.pickerSize ? ("el-range-editor--" + _vm.pickerSize) : '',
|
1767 | _vm.pickerDisabled ? 'is-disabled' : '',
|
1768 | _vm.pickerVisible ? 'is-active' : ''
|
1769 | ],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)),_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()])}
|
1770 | var staticRenderFns = []
|
1771 | var esExports = { render: render, staticRenderFns: staticRenderFns }
|
1772 | __webpack_exports__["a"] = (esExports);
|
1773 |
|
1774 | }),
|
1775 |
|
1776 | 4:
|
1777 | (function(module, exports) {
|
1778 |
|
1779 | module.exports = require("vue");
|
1780 |
|
1781 | }),
|
1782 |
|
1783 | 6:
|
1784 | (function(module, exports) {
|
1785 |
|
1786 | module.exports = require("element-ui/lib/input");
|
1787 |
|
1788 | }),
|
1789 |
|
1790 | 7:
|
1791 | (function(module, exports) {
|
1792 |
|
1793 | module.exports = require("element-ui/lib/utils/vue-popper");
|
1794 |
|
1795 | }),
|
1796 |
|
1797 | 9:
|
1798 | (function(module, exports) {
|
1799 |
|
1800 | module.exports = require("element-ui/lib/utils/merge");
|
1801 |
|
1802 | })
|
1803 |
|
1804 | }); |
\ | No newline at end of file |