forked from ElementUI/lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
time-picker.js
2553 lines (2209 loc) · 80.1 KB
/
time-picker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
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
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
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
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 197);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file.
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
var functional = options.functional
var existing = functional
? options.render
: options.beforeCreate
if (!functional) {
// inject component registration as beforeCreate hook
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
} else {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functioal component in vue file
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return existing(h, context)
}
}
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ }),
/***/ 1:
/***/ (function(module, exports) {
module.exports = require("element-ui/lib/mixins/emitter");
/***/ }),
/***/ 10:
/***/ (function(module, exports) {
module.exports = require("element-ui/lib/utils/clickoutside");
/***/ }),
/***/ 11:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.extractTimeFormat = exports.extractDateFormat = exports.nextYear = exports.prevYear = exports.nextMonth = exports.prevMonth = exports.changeYearMonthAndClampDate = exports.timeWithinRange = exports.limitTimeRange = exports.clearMilliseconds = exports.clearTime = exports.modifyWithTimeString = exports.modifyTime = exports.modifyDate = exports.range = exports.getRangeMinutes = exports.getRangeHours = exports.getWeekNumber = exports.getStartDateOfMonth = exports.nextDate = exports.prevDate = exports.getFirstDayOfMonth = exports.getDayCountOfYear = exports.getDayCountOfMonth = exports.parseDate = exports.formatDate = exports.isDateObject = exports.isDate = exports.toDate = undefined;
var _date = __webpack_require__(29);
var _date2 = _interopRequireDefault(_date);
var _locale = __webpack_require__(12);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var weeks = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
var getI18nSettings = function getI18nSettings() {
return {
dayNamesShort: weeks.map(function (week) {
return (0, _locale.t)('el.datepicker.weeks.' + week);
}),
dayNames: weeks.map(function (week) {
return (0, _locale.t)('el.datepicker.weeks.' + week);
}),
monthNamesShort: months.map(function (month) {
return (0, _locale.t)('el.datepicker.months.' + month);
}),
monthNames: months.map(function (month, index) {
return (0, _locale.t)('el.datepicker.month' + (index + 1));
}),
amPm: ['am', 'pm']
};
};
var newArray = function newArray(start, end) {
var result = [];
for (var i = start; i <= end; i++) {
result.push(i);
}
return result;
};
var toDate = exports.toDate = function toDate(date) {
return isDate(date) ? new Date(date) : null;
};
var isDate = exports.isDate = function isDate(date) {
if (date === null || date === undefined) return false;
if (isNaN(new Date(date).getTime())) return false;
if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
return true;
};
var isDateObject = exports.isDateObject = function isDateObject(val) {
return val instanceof Date;
};
var formatDate = exports.formatDate = function formatDate(date, format) {
date = toDate(date);
if (!date) return '';
return _date2.default.format(date, format || 'yyyy-MM-dd', getI18nSettings());
};
var parseDate = exports.parseDate = function parseDate(string, format) {
return _date2.default.parse(string, format || 'yyyy-MM-dd', getI18nSettings());
};
var getDayCountOfMonth = exports.getDayCountOfMonth = function getDayCountOfMonth(year, month) {
if (month === 3 || month === 5 || month === 8 || month === 10) {
return 30;
}
if (month === 1) {
if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
return 29;
} else {
return 28;
}
}
return 31;
};
var getDayCountOfYear = exports.getDayCountOfYear = function getDayCountOfYear(year) {
var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
return isLeapYear ? 366 : 365;
};
var getFirstDayOfMonth = exports.getFirstDayOfMonth = function getFirstDayOfMonth(date) {
var temp = new Date(date.getTime());
temp.setDate(1);
return temp.getDay();
};
// see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
// {prev, next} Date should work for Daylight Saving Time
// Adding 24 * 60 * 60 * 1000 does not work in the above scenario
var prevDate = exports.prevDate = function prevDate(date) {
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
};
var nextDate = exports.nextDate = function nextDate(date) {
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
};
var getStartDateOfMonth = exports.getStartDateOfMonth = function getStartDateOfMonth(year, month) {
var result = new Date(year, month, 1);
var day = result.getDay();
if (day === 0) {
return prevDate(result, 7);
} else {
return prevDate(result, day);
}
};
var getWeekNumber = exports.getWeekNumber = function getWeekNumber(src) {
if (!isDate(src)) return null;
var date = new Date(src.getTime());
date.setHours(0, 0, 0, 0);
// Thursday in current week decides the year.
date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
// January 4 is always in week 1.
var week1 = new Date(date.getFullYear(), 0, 4);
// Adjust to Thursday in week 1 and count number of weeks from date to week 1.
// Rounding should be fine for Daylight Saving Time. Its shift should never be more than 12 hours.
return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7);
};
var getRangeHours = exports.getRangeHours = function getRangeHours(ranges) {
var hours = [];
var disabledHours = [];
(ranges || []).forEach(function (range) {
var value = range.map(function (date) {
return date.getHours();
});
disabledHours = disabledHours.concat(newArray(value[0], value[1]));
});
if (disabledHours.length) {
for (var i = 0; i < 24; i++) {
hours[i] = disabledHours.indexOf(i) === -1;
}
} else {
for (var _i = 0; _i < 24; _i++) {
hours[_i] = false;
}
}
return hours;
};
function setRangeData(arr, start, end, value) {
for (var i = start; i < end; i++) {
arr[i] = value;
}
}
var getRangeMinutes = exports.getRangeMinutes = function getRangeMinutes(ranges, hour) {
var minutes = new Array(60);
if (ranges.length > 0) {
ranges.forEach(function (range) {
var start = range[0];
var end = range[1];
var startHour = start.getHours();
var startMinute = start.getMinutes();
var endHour = end.getHours();
var endMinute = end.getMinutes();
if (startHour === hour && endHour !== hour) {
setRangeData(minutes, startMinute, 60, true);
} else if (startHour === hour && endHour === hour) {
setRangeData(minutes, startMinute, endMinute + 1, true);
} else if (startHour !== hour && endHour === hour) {
setRangeData(minutes, 0, endMinute + 1, true);
} else if (startHour < hour && endHour > hour) {
setRangeData(minutes, 0, 60, true);
}
});
} else {
setRangeData(minutes, 0, 60, true);
}
return minutes;
};
var range = exports.range = function range(n) {
// see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
return Array.apply(null, { length: n }).map(function (_, n) {
return n;
});
};
var modifyDate = exports.modifyDate = function modifyDate(date, y, m, d) {
return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
};
var modifyTime = exports.modifyTime = function modifyTime(date, h, m, s) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
};
var modifyWithTimeString = exports.modifyWithTimeString = function modifyWithTimeString(date, time) {
if (date == null || !time) {
return date;
}
time = parseDate(time, 'HH:mm:ss');
return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
};
var clearTime = exports.clearTime = function clearTime(date) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
};
var clearMilliseconds = exports.clearMilliseconds = function clearMilliseconds(date) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
};
var limitTimeRange = exports.limitTimeRange = function limitTimeRange(date, ranges) {
var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
// TODO: refactory a more elegant solution
if (ranges.length === 0) return date;
var normalizeDate = function normalizeDate(date) {
return _date2.default.parse(_date2.default.format(date, format), format);
};
var ndate = normalizeDate(date);
var nranges = ranges.map(function (range) {
return range.map(normalizeDate);
});
if (nranges.some(function (nrange) {
return ndate >= nrange[0] && ndate <= nrange[1];
})) return date;
var minDate = nranges[0][0];
var maxDate = nranges[0][0];
nranges.forEach(function (nrange) {
minDate = new Date(Math.min(nrange[0], minDate));
maxDate = new Date(Math.max(nrange[1], minDate));
});
var ret = ndate < minDate ? minDate : maxDate;
// preserve Year/Month/Date
return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
};
var timeWithinRange = exports.timeWithinRange = function timeWithinRange(date, selectableRange, format) {
var limitedDate = limitTimeRange(date, selectableRange, format);
return limitedDate.getTime() === date.getTime();
};
var changeYearMonthAndClampDate = exports.changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
// clamp date to the number of days in `year`, `month`
// eg: (2010-1-31, 2010, 2) => 2010-2-28
var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
return modifyDate(date, year, month, monthDate);
};
var prevMonth = exports.prevMonth = function prevMonth(date) {
var year = date.getFullYear();
var month = date.getMonth();
return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
};
var nextMonth = exports.nextMonth = function nextMonth(date) {
var year = date.getFullYear();
var month = date.getMonth();
return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
};
var prevYear = exports.prevYear = function prevYear(date) {
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var year = date.getFullYear();
var month = date.getMonth();
return changeYearMonthAndClampDate(date, year - amount, month);
};
var nextYear = exports.nextYear = function nextYear(date) {
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var year = date.getFullYear();
var month = date.getMonth();
return changeYearMonthAndClampDate(date, year + amount, month);
};
var extractDateFormat = exports.extractDateFormat = function extractDateFormat(format) {
return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
};
var extractTimeFormat = exports.extractTimeFormat = function extractTimeFormat(format) {
return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
};
/***/ }),
/***/ 12:
/***/ (function(module, exports) {
module.exports = require("element-ui/lib/locale");
/***/ }),
/***/ 17:
/***/ (function(module, exports) {
module.exports = require("element-ui/lib/scrollbar");
/***/ }),
/***/ 197:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _timePicker = __webpack_require__(198);
var _timePicker2 = _interopRequireDefault(_timePicker);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_timePicker2.default.install = function (Vue) {
Vue.component(_timePicker2.default.name, _timePicker2.default);
};
exports.default = _timePicker2.default;
/***/ }),
/***/ 198:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _picker = __webpack_require__(27);
var _picker2 = _interopRequireDefault(_picker);
var _time = __webpack_require__(31);
var _time2 = _interopRequireDefault(_time);
var _timeRange = __webpack_require__(199);
var _timeRange2 = _interopRequireDefault(_timeRange);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
mixins: [_picker2.default],
name: 'ElTimePicker',
props: {
isRange: Boolean,
arrowControl: Boolean
},
data: function data() {
return {
type: ''
};
},
watch: {
isRange: function isRange(_isRange) {
if (this.picker) {
this.unmountPicker();
this.type = _isRange ? 'timerange' : 'time';
this.panel = _isRange ? _timeRange2.default : _time2.default;
this.mountPicker();
} else {
this.type = _isRange ? 'timerange' : 'time';
this.panel = _isRange ? _timeRange2.default : _time2.default;
}
}
},
created: function created() {
this.type = this.isRange ? 'timerange' : 'time';
this.panel = this.isRange ? _timeRange2.default : _time2.default;
}
};
/***/ }),
/***/ 199:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_range_vue__ = __webpack_require__(200);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_range_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_range_vue__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_331fa926_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_time_range_vue__ = __webpack_require__(201);
var normalizeComponent = __webpack_require__(0)
/* script */
/* template */
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = null
/* scopeId */
var __vue_scopeId__ = null
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_range_vue___default.a,
__WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_331fa926_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_time_range_vue__["a" /* default */],
__vue_template_functional__,
__vue_styles__,
__vue_scopeId__,
__vue_module_identifier__
)
/* harmony default export */ __webpack_exports__["default"] = (Component.exports);
/***/ }),
/***/ 200:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _util = __webpack_require__(11);
var _locale = __webpack_require__(5);
var _locale2 = _interopRequireDefault(_locale);
var _timeSpinner = __webpack_require__(32);
var _timeSpinner2 = _interopRequireDefault(_timeSpinner);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var MIN_TIME = (0, _util.parseDate)('00:00:00', 'HH:mm:ss'); //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var MAX_TIME = (0, _util.parseDate)('23:59:59', 'HH:mm:ss');
var minTimeOfDay = function minTimeOfDay(date) {
return (0, _util.modifyDate)(MIN_TIME, date.getFullYear(), date.getMonth(), date.getDate());
};
var maxTimeOfDay = function maxTimeOfDay(date) {
return (0, _util.modifyDate)(MAX_TIME, date.getFullYear(), date.getMonth(), date.getDate());
};
// increase time by amount of milliseconds, but within the range of day
var advanceTime = function advanceTime(date, amount) {
return new Date(Math.min(date.getTime() + amount, maxTimeOfDay(date).getTime()));
};
exports.default = {
mixins: [_locale2.default],
components: { TimeSpinner: _timeSpinner2.default },
computed: {
showSeconds: function showSeconds() {
return (this.format || '').indexOf('ss') !== -1;
},
offset: function offset() {
return this.showSeconds ? 11 : 8;
},
spinner: function spinner() {
return this.selectionRange[0] < this.offset ? this.$refs.minSpinner : this.$refs.maxSpinner;
},
btnDisabled: function btnDisabled() {
return this.minDate.getTime() > this.maxDate.getTime();
},
amPmMode: function amPmMode() {
if ((this.format || '').indexOf('A') !== -1) return 'A';
if ((this.format || '').indexOf('a') !== -1) return 'a';
return '';
}
},
data: function data() {
return {
popperClass: '',
minDate: new Date(),
maxDate: new Date(),
value: [],
oldValue: [new Date(), new Date()],
defaultValue: null,
format: 'HH:mm:ss',
visible: false,
selectionRange: [0, 2],
arrowControl: false
};
},
watch: {
value: function value(_value) {
if (Array.isArray(_value)) {
this.minDate = new Date(_value[0]);
this.maxDate = new Date(_value[1]);
} else {
if (Array.isArray(this.defaultValue)) {
this.minDate = new Date(this.defaultValue[0]);
this.maxDate = new Date(this.defaultValue[1]);
} else if (this.defaultValue) {
this.minDate = new Date(this.defaultValue);
this.maxDate = advanceTime(new Date(this.defaultValue), 60 * 60 * 1000);
} else {
this.minDate = new Date();
this.maxDate = advanceTime(new Date(), 60 * 60 * 1000);
}
}
},
visible: function visible(val) {
var _this = this;
if (val) {
this.oldValue = this.value;
this.$nextTick(function () {
return _this.$refs.minSpinner.emitSelectRange('hours');
});
}
}
},
methods: {
handleClear: function handleClear() {
this.$emit('pick', null);
},
handleCancel: function handleCancel() {
this.$emit('pick', this.oldValue);
},
handleMinChange: function handleMinChange(date) {
this.minDate = (0, _util.clearMilliseconds)(date);
this.handleChange();
},
handleMaxChange: function handleMaxChange(date) {
this.maxDate = (0, _util.clearMilliseconds)(date);
this.handleChange();
},
handleChange: function handleChange() {
if (this.isValidValue([this.minDate, this.maxDate])) {
this.$refs.minSpinner.selectableRange = [[minTimeOfDay(this.minDate), this.maxDate]];
this.$refs.maxSpinner.selectableRange = [[this.minDate, maxTimeOfDay(this.maxDate)]];
this.$emit('pick', [this.minDate, this.maxDate], true);
}
},
setMinSelectionRange: function setMinSelectionRange(start, end) {
this.$emit('select-range', start, end, 'min');
this.selectionRange = [start, end];
},
setMaxSelectionRange: function setMaxSelectionRange(start, end) {
this.$emit('select-range', start, end, 'max');
this.selectionRange = [start + this.offset, end + this.offset];
},
handleConfirm: function handleConfirm() {
var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var minSelectableRange = this.$refs.minSpinner.selectableRange;
var maxSelectableRange = this.$refs.maxSpinner.selectableRange;
this.minDate = (0, _util.limitTimeRange)(this.minDate, minSelectableRange, this.format);
this.maxDate = (0, _util.limitTimeRange)(this.maxDate, maxSelectableRange, this.format);
this.$emit('pick', [this.minDate, this.maxDate], visible);
},
adjustSpinners: function adjustSpinners() {
this.$refs.minSpinner.adjustSpinners();
this.$refs.maxSpinner.adjustSpinners();
},
changeSelectionRange: function changeSelectionRange(step) {
var list = this.showSeconds ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
var index = list.indexOf(this.selectionRange[0]);
var next = (index + step + list.length) % list.length;
var half = list.length / 2;
if (next < half) {
this.$refs.minSpinner.emitSelectRange(mapping[next]);
} else {
this.$refs.maxSpinner.emitSelectRange(mapping[next - half]);
}
},
isValidValue: function isValidValue(date) {
return Array.isArray(date) && (0, _util.timeWithinRange)(this.minDate, this.$refs.minSpinner.selectableRange) && (0, _util.timeWithinRange)(this.maxDate, this.$refs.maxSpinner.selectableRange);
},
handleKeydown: function handleKeydown(event) {
var keyCode = event.keyCode;
var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
// Left or Right
if (keyCode === 37 || keyCode === 39) {
var step = mapping[keyCode];
this.changeSelectionRange(step);
event.preventDefault();
return;
}
// Up or Down
if (keyCode === 38 || keyCode === 40) {
var _step = mapping[keyCode];
this.spinner.scrollDown(_step);
event.preventDefault();
return;
}
}
}
};
/***/ }),
/***/ 201:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('transition',{attrs:{"name":"el-zoom-in-top"},on:{"after-leave":function($event){_vm.$emit('dodestroy')}}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.visible),expression:"visible"}],staticClass:"el-time-range-picker el-picker-panel el-popper",class:_vm.popperClass},[_c('div',{staticClass:"el-time-range-picker__content"},[_c('div',{staticClass:"el-time-range-picker__cell"},[_c('div',{staticClass:"el-time-range-picker__header"},[_vm._v(_vm._s(_vm.t('el.datepicker.startTime')))]),_c('div',{staticClass:"el-time-range-picker__body el-time-panel__content",class:{ 'has-seconds': _vm.showSeconds, 'is-arrow': _vm.arrowControl }},[_c('time-spinner',{ref:"minSpinner",attrs:{"show-seconds":_vm.showSeconds,"am-pm-mode":_vm.amPmMode,"arrow-control":_vm.arrowControl,"date":_vm.minDate},on:{"change":_vm.handleMinChange,"select-range":_vm.setMinSelectionRange}})],1)]),_c('div',{staticClass:"el-time-range-picker__cell"},[_c('div',{staticClass:"el-time-range-picker__header"},[_vm._v(_vm._s(_vm.t('el.datepicker.endTime')))]),_c('div',{staticClass:"el-time-range-picker__body el-time-panel__content",class:{ 'has-seconds': _vm.showSeconds, 'is-arrow': _vm.arrowControl }},[_c('time-spinner',{ref:"maxSpinner",attrs:{"show-seconds":_vm.showSeconds,"am-pm-mode":_vm.amPmMode,"arrow-control":_vm.arrowControl,"date":_vm.maxDate},on:{"change":_vm.handleMaxChange,"select-range":_vm.setMaxSelectionRange}})],1)])]),_c('div',{staticClass:"el-time-panel__footer"},[_c('button',{staticClass:"el-time-panel__btn cancel",attrs:{"type":"button"},on:{"click":function($event){_vm.handleCancel()}}},[_vm._v(_vm._s(_vm.t('el.datepicker.cancel')))]),_c('button',{staticClass:"el-time-panel__btn confirm",attrs:{"type":"button","disabled":_vm.btnDisabled},on:{"click":function($event){_vm.handleConfirm()}}},[_vm._v(_vm._s(_vm.t('el.datepicker.confirm')))])])])])}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ __webpack_exports__["a"] = (esExports);
/***/ }),
/***/ 24:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _dom = __webpack_require__(3);
exports.default = {
bind: function bind(el, binding, vnode) {
var interval = null;
var startTime = void 0;
var handler = function handler() {
return vnode.context[binding.expression].apply();
};
var clear = function clear() {
if (new Date() - startTime < 100) {
handler();
}
clearInterval(interval);
interval = null;
};
(0, _dom.on)(el, 'mousedown', function (e) {
if (e.button !== 0) return;
startTime = new Date();
(0, _dom.once)(document, 'mouseup', clear);
clearInterval(interval);
interval = setInterval(handler, 100);
});
}
};
/***/ }),
/***/ 27:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue__ = __webpack_require__(28);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_66b1c70c_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_picker_vue__ = __webpack_require__(30);
var normalizeComponent = __webpack_require__(0)
/* script */
/* template */
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = null
/* scopeId */
var __vue_scopeId__ = null
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue___default.a,
__WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_66b1c70c_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_picker_vue__["a" /* default */],
__vue_template_functional__,
__vue_styles__,
__vue_scopeId__,
__vue_module_identifier__
)
/* harmony default export */ __webpack_exports__["default"] = (Component.exports);
/***/ }),
/***/ 28:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _vue = __webpack_require__(4);
var _vue2 = _interopRequireDefault(_vue);
var _clickoutside = __webpack_require__(10);
var _clickoutside2 = _interopRequireDefault(_clickoutside);
var _util = __webpack_require__(11);
var _vuePopper = __webpack_require__(7);
var _vuePopper2 = _interopRequireDefault(_vuePopper);
var _emitter = __webpack_require__(1);
var _emitter2 = _interopRequireDefault(_emitter);
var _input = __webpack_require__(6);
var _input2 = _interopRequireDefault(_input);
var _merge = __webpack_require__(9);
var _merge2 = _interopRequireDefault(_merge);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var NewPopper = {
props: {
appendToBody: _vuePopper2.default.props.appendToBody,