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