inviton-powerduck 0.0.123 → 0.0.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -317,10 +317,10 @@ import './daterangepicker.css';
|
|
|
317
317
|
leftOffset: null,
|
|
318
318
|
showShortcuts: false,
|
|
319
319
|
shortcuts: {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
320
|
+
// 'prev-days': [1,3,5,7],
|
|
321
|
+
// 'next-days': [3,5,7],
|
|
322
|
+
// 'prev' : ['week','month','year'],
|
|
323
|
+
// 'next' : ['week','month','year']
|
|
324
324
|
},
|
|
325
325
|
customShortcuts: [],
|
|
326
326
|
calendarPlacement: 'body',
|
|
@@ -337,15 +337,20 @@ import './daterangepicker.css';
|
|
|
337
337
|
selectBackward: false,
|
|
338
338
|
applyBtnClass: '',
|
|
339
339
|
singleMonth: 'auto',
|
|
340
|
-
hoveringTooltip
|
|
340
|
+
hoveringTooltip(
|
|
341
341
|
days,
|
|
342
342
|
startTime,
|
|
343
343
|
hoveringTime,
|
|
344
|
-
)
|
|
344
|
+
) {
|
|
345
|
+
return days > 1 ? `${days} ${translate('days')}` : '';
|
|
346
|
+
},
|
|
345
347
|
showTopbar: true,
|
|
346
348
|
swapTime: false,
|
|
347
349
|
showWeekNumbers: false,
|
|
348
|
-
getWeekNumber
|
|
350
|
+
getWeekNumber(date) // date will be the first day of a week
|
|
351
|
+
{
|
|
352
|
+
return DateUtils.getWeekNumber(date);
|
|
353
|
+
},
|
|
349
354
|
customOpenAnimation: null,
|
|
350
355
|
customCloseAnimation: null,
|
|
351
356
|
customArrowPrevSymbol: null,
|
|
@@ -429,11 +434,11 @@ import './daterangepicker.css';
|
|
|
429
434
|
);
|
|
430
435
|
return this;
|
|
431
436
|
},
|
|
432
|
-
setDateRange
|
|
437
|
+
setDateRange(
|
|
433
438
|
d1,
|
|
434
439
|
d2,
|
|
435
440
|
silent,
|
|
436
|
-
)
|
|
441
|
+
) {
|
|
437
442
|
if (typeof d1 == 'string' && typeof d2 == 'string') {
|
|
438
443
|
d1 = DateUtils.getDateWrapperFromFormat(d1, opt.format);
|
|
439
444
|
d2 = DateUtils.getDateWrapperFromFormat(d2, opt.format);
|
|
@@ -452,7 +457,7 @@ import './daterangepicker.css';
|
|
|
452
457
|
redraw: redrawDatePicker,
|
|
453
458
|
getDatePicker,
|
|
454
459
|
resetMonthsView,
|
|
455
|
-
destroy
|
|
460
|
+
destroy() {
|
|
456
461
|
$(self).unbind('.datepicker');
|
|
457
462
|
$(self).data('dateRangePicker', '');
|
|
458
463
|
$(self).data('date-picker-opened', null);
|
|
@@ -466,16 +471,22 @@ import './daterangepicker.css';
|
|
|
466
471
|
|
|
467
472
|
return this;
|
|
468
473
|
|
|
469
|
-
|
|
474
|
+
function isModalDisplayMode() {
|
|
475
|
+
return (box != null && box.hasClass('date-range-picker-modalmode')) || $(window).width() <= 992;
|
|
476
|
+
}
|
|
470
477
|
|
|
471
|
-
|
|
478
|
+
function IsOwnDatePickerClicked(evt, selfObj) {
|
|
479
|
+
return (selfObj.contains(evt.target) || evt.target == selfObj || (selfObj.childNodes != undefined && $.inArray(evt.target, selfObj.childNodes) >= 0));
|
|
480
|
+
}
|
|
472
481
|
|
|
473
|
-
|
|
482
|
+
function ensurePickerOpen() {
|
|
474
483
|
const isOpen = box.is(':visible');
|
|
475
484
|
if (!isOpen) { open(opt.duration); }
|
|
476
|
-
}
|
|
485
|
+
}
|
|
477
486
|
|
|
478
|
-
|
|
487
|
+
function isPlacedInBody() {
|
|
488
|
+
return (opt.calendarPlacement == 'body' || opt.calendarPlacement == null);
|
|
489
|
+
}
|
|
479
490
|
|
|
480
491
|
function init_datepicker(this: any) {
|
|
481
492
|
const self = this;
|
|
@@ -556,7 +567,7 @@ import './daterangepicker.css';
|
|
|
556
567
|
if (!opt.stickyMonths) { gotoNextMonth(this); } else { gotoNextMonth_stickily(this); }
|
|
557
568
|
});
|
|
558
569
|
|
|
559
|
-
|
|
570
|
+
function gotoNextMonth(self) {
|
|
560
571
|
const isMonth2 = $(self).parents('table').hasClass('month2');
|
|
561
572
|
let month = isMonth2 ? opt.month2 : opt.month1;
|
|
562
573
|
month = nextMonth(month);
|
|
@@ -575,9 +586,9 @@ import './daterangepicker.css';
|
|
|
575
586
|
}
|
|
576
587
|
|
|
577
588
|
showGap();
|
|
578
|
-
}
|
|
589
|
+
}
|
|
579
590
|
|
|
580
|
-
|
|
591
|
+
function gotoNextMonth_stickily(self) {
|
|
581
592
|
const nextMonth1 = nextMonth(opt.month1);
|
|
582
593
|
const nextMonth2 = nextMonth(opt.month2);
|
|
583
594
|
if (isMonthOutOfBounds(nextMonth2)) { return; }
|
|
@@ -587,13 +598,13 @@ import './daterangepicker.css';
|
|
|
587
598
|
showMonth(nextMonth1, 'month1');
|
|
588
599
|
showMonth(nextMonth2, 'month2');
|
|
589
600
|
showSelectedDays();
|
|
590
|
-
}
|
|
601
|
+
}
|
|
591
602
|
|
|
592
603
|
box.find('.prev').click(function (this: any) {
|
|
593
604
|
if (!opt.stickyMonths) { gotoPrevMonth(this); } else { gotoPrevMonth_stickily(this); }
|
|
594
605
|
});
|
|
595
606
|
|
|
596
|
-
|
|
607
|
+
function gotoPrevMonth(self) {
|
|
597
608
|
const isMonth2 = $(self).parents('table').hasClass('month2');
|
|
598
609
|
let month = isMonth2 ? opt.month2 : opt.month1;
|
|
599
610
|
month = prevMonth(month);
|
|
@@ -612,9 +623,9 @@ import './daterangepicker.css';
|
|
|
612
623
|
}
|
|
613
624
|
|
|
614
625
|
showGap();
|
|
615
|
-
}
|
|
626
|
+
}
|
|
616
627
|
|
|
617
|
-
|
|
628
|
+
function gotoPrevMonth_stickily(self) {
|
|
618
629
|
const prevMonth1 = prevMonth(opt.month1);
|
|
619
630
|
const prevMonth2 = prevMonth(opt.month2);
|
|
620
631
|
if (isMonthOutOfBounds(prevMonth1)) { return; }
|
|
@@ -624,7 +635,7 @@ import './daterangepicker.css';
|
|
|
624
635
|
showMonth(prevMonth2, 'month2');
|
|
625
636
|
showMonth(prevMonth1, 'month1');
|
|
626
637
|
showSelectedDays();
|
|
627
|
-
}
|
|
638
|
+
}
|
|
628
639
|
|
|
629
640
|
box.attr('unselectable', 'on')
|
|
630
641
|
.css('user-select', 'none')
|
|
@@ -749,7 +760,7 @@ import './daterangepicker.css';
|
|
|
749
760
|
});
|
|
750
761
|
}
|
|
751
762
|
|
|
752
|
-
|
|
763
|
+
function calcPosition() {
|
|
753
764
|
if (isPlacedInBody()) {
|
|
754
765
|
const offset = $(self).offset();
|
|
755
766
|
if (opt.leftOffset != null) {
|
|
@@ -813,22 +824,22 @@ import './daterangepicker.css';
|
|
|
813
824
|
box.find('.time1').insertBefore(box.find('.time2'));
|
|
814
825
|
}
|
|
815
826
|
}
|
|
816
|
-
}
|
|
827
|
+
}
|
|
817
828
|
|
|
818
|
-
|
|
829
|
+
function setModalDisplayMode() {
|
|
819
830
|
if (!box.hasClass('date-range-picker-modalmode')) {
|
|
820
831
|
box.addClass('date-range-picker-modalmode');
|
|
821
832
|
}
|
|
822
|
-
}
|
|
833
|
+
}
|
|
823
834
|
|
|
824
|
-
|
|
835
|
+
function removeModalDisplayMode() {
|
|
825
836
|
if (box.hasClass('date-range-picker-modalmode')) {
|
|
826
837
|
box.removeClass('date-range-picker-modalmode');
|
|
827
838
|
updateCalendarWidth();
|
|
828
839
|
}
|
|
829
|
-
}
|
|
840
|
+
}
|
|
830
841
|
|
|
831
|
-
|
|
842
|
+
function setDisplayMode() {
|
|
832
843
|
let displayMode = 'below-input';
|
|
833
844
|
if (opt.displayMode != null) {
|
|
834
845
|
displayMode = opt.displayMode() || 'below-input';
|
|
@@ -841,12 +852,14 @@ import './daterangepicker.css';
|
|
|
841
852
|
}
|
|
842
853
|
|
|
843
854
|
box.attr('data-displaymode', displayMode);
|
|
844
|
-
}
|
|
855
|
+
}
|
|
845
856
|
|
|
846
857
|
// Return the date picker wrapper element
|
|
847
|
-
|
|
858
|
+
function getDatePicker() {
|
|
859
|
+
return box;
|
|
860
|
+
}
|
|
848
861
|
|
|
849
|
-
|
|
862
|
+
function open(animationTime) {
|
|
850
863
|
setDisplayMode();
|
|
851
864
|
calcPosition();
|
|
852
865
|
redrawDatePicker();
|
|
@@ -871,9 +884,9 @@ import './daterangepicker.css';
|
|
|
871
884
|
});
|
|
872
885
|
showGap();
|
|
873
886
|
updateCalendarWidth();
|
|
874
|
-
}
|
|
887
|
+
}
|
|
875
888
|
|
|
876
|
-
|
|
889
|
+
function checkAndSetDefaultValue() {
|
|
877
890
|
const __default_string = opt.getValue.call(selfDom);
|
|
878
891
|
const defaults = __default_string ? __default_string.split(opt.separator) : '';
|
|
879
892
|
|
|
@@ -897,17 +910,17 @@ import './daterangepicker.css';
|
|
|
897
910
|
|
|
898
911
|
initiated = true;
|
|
899
912
|
}
|
|
900
|
-
}
|
|
913
|
+
}
|
|
901
914
|
|
|
902
|
-
|
|
915
|
+
function getValidValue(date: string, format: string) {
|
|
903
916
|
try {
|
|
904
917
|
return DateUtils.getDateWrapperFromFormat(date, format);
|
|
905
918
|
} catch (error) {
|
|
906
919
|
return DateWrapper.getCurrent();
|
|
907
920
|
}
|
|
908
|
-
}
|
|
921
|
+
}
|
|
909
922
|
|
|
910
|
-
|
|
923
|
+
function calculateCalendarWidth() {
|
|
911
924
|
const w1 = box.find('.month1').width();
|
|
912
925
|
const w2 = opt.singleMonth == true ? 0 : box.find('.gap').outerWidth(true);
|
|
913
926
|
const w3 = opt.singleMonth == true ? 0 : box.find('.month2').width();
|
|
@@ -919,18 +932,18 @@ import './daterangepicker.css';
|
|
|
919
932
|
}
|
|
920
933
|
|
|
921
934
|
return retVal;
|
|
922
|
-
}
|
|
935
|
+
}
|
|
923
936
|
|
|
924
|
-
|
|
937
|
+
function updateCalendarWidth() {
|
|
925
938
|
if (isModalDisplayMode()) {
|
|
926
939
|
box.find('.month-wrapper').css('width', '');
|
|
927
940
|
return;
|
|
928
941
|
}
|
|
929
942
|
|
|
930
943
|
box.find('.month-wrapper').width(calculateCalendarWidth());
|
|
931
|
-
}
|
|
944
|
+
}
|
|
932
945
|
|
|
933
|
-
|
|
946
|
+
function renderTime(name: 'time1' | 'time2', date: DateWrapper) {
|
|
934
947
|
box.find(`.${name} input[type=range].hour-range`).val(date.getHours());
|
|
935
948
|
box.find(`.${name} input[type=range].minute-range`).val(date.getMinutes());
|
|
936
949
|
setTime(
|
|
@@ -938,10 +951,10 @@ import './daterangepicker.css';
|
|
|
938
951
|
getHourString(date),
|
|
939
952
|
getMinuteString(date),
|
|
940
953
|
);
|
|
941
|
-
}
|
|
954
|
+
}
|
|
942
955
|
|
|
943
|
-
|
|
944
|
-
if ((date as any)
|
|
956
|
+
function changeTime(name: 'start' | 'end', date: DateWrapper) {
|
|
957
|
+
if ((date as any)?._dte == null) {
|
|
945
958
|
date = new DateWrapper(date);
|
|
946
959
|
}
|
|
947
960
|
|
|
@@ -951,19 +964,19 @@ import './daterangepicker.css';
|
|
|
951
964
|
date.getDate(),
|
|
952
965
|
Number((opt[`${name}Time`] as DateWrapper).getHours()),
|
|
953
966
|
Number((opt[`${name}Time`] as DateWrapper).getMinutes()),
|
|
954
|
-
)
|
|
955
|
-
}
|
|
967
|
+
);
|
|
968
|
+
}
|
|
956
969
|
|
|
957
|
-
|
|
970
|
+
function swapTime() {
|
|
958
971
|
renderTime('time1', opt.start);
|
|
959
972
|
renderTime('time2', opt.end);
|
|
960
|
-
}
|
|
973
|
+
}
|
|
961
974
|
|
|
962
|
-
|
|
975
|
+
function setTime(
|
|
963
976
|
name: 'time1' | 'time2',
|
|
964
977
|
hour: string,
|
|
965
978
|
minute: string,
|
|
966
|
-
)
|
|
979
|
+
) {
|
|
967
980
|
hour && (box.find(`.${name} .hour-val`).text(hour));
|
|
968
981
|
minute && (box.find(`.${name} .minute-val`).text(minute));
|
|
969
982
|
switch (name) {
|
|
@@ -983,7 +996,7 @@ import './daterangepicker.css';
|
|
|
983
996
|
break;
|
|
984
997
|
}
|
|
985
998
|
|
|
986
|
-
|
|
999
|
+
function setRange(name: 'start' | 'startTime' | 'end' | 'endTime', timePoint: DateWrapper) {
|
|
987
1000
|
opt[name] = new DateWrapper(
|
|
988
1001
|
timePoint.getFullYear(),
|
|
989
1002
|
timePoint.getMonth(),
|
|
@@ -991,13 +1004,13 @@ import './daterangepicker.css';
|
|
|
991
1004
|
Number(hour || getHourString(timePoint)),
|
|
992
1005
|
Number(minute || getMinuteString(timePoint)),
|
|
993
1006
|
);
|
|
994
|
-
}
|
|
1007
|
+
}
|
|
995
1008
|
checkSelectionValid();
|
|
996
1009
|
showSelectedInfo();
|
|
997
1010
|
showSelectedDays();
|
|
998
|
-
}
|
|
1011
|
+
}
|
|
999
1012
|
|
|
1000
|
-
|
|
1013
|
+
function clearSelection() {
|
|
1001
1014
|
opt.start = false;
|
|
1002
1015
|
opt.end = false;
|
|
1003
1016
|
box.find('.day.checked').removeClass('checked');
|
|
@@ -1007,9 +1020,9 @@ import './daterangepicker.css';
|
|
|
1007
1020
|
checkSelectionValid();
|
|
1008
1021
|
showSelectedInfo();
|
|
1009
1022
|
showSelectedDays();
|
|
1010
|
-
}
|
|
1023
|
+
}
|
|
1011
1024
|
|
|
1012
|
-
|
|
1025
|
+
function handleStart(time: number): number {
|
|
1013
1026
|
let r = time;
|
|
1014
1027
|
const date = new DateWrapper(time);
|
|
1015
1028
|
|
|
@@ -1049,9 +1062,9 @@ import './daterangepicker.css';
|
|
|
1049
1062
|
}
|
|
1050
1063
|
|
|
1051
1064
|
return r;
|
|
1052
|
-
}
|
|
1065
|
+
}
|
|
1053
1066
|
|
|
1054
|
-
|
|
1067
|
+
function handleEnd(time: number): number {
|
|
1055
1068
|
let r = time;
|
|
1056
1069
|
const date = new DateWrapper(time);
|
|
1057
1070
|
|
|
@@ -1092,9 +1105,9 @@ import './daterangepicker.css';
|
|
|
1092
1105
|
}
|
|
1093
1106
|
|
|
1094
1107
|
return r;
|
|
1095
|
-
}
|
|
1108
|
+
}
|
|
1096
1109
|
|
|
1097
|
-
|
|
1110
|
+
function dayClicked(day) {
|
|
1098
1111
|
if (day.hasClass('invalid')) { return; }
|
|
1099
1112
|
|
|
1100
1113
|
const time = Number(day.attr('time'));
|
|
@@ -1260,9 +1273,9 @@ import './daterangepicker.css';
|
|
|
1260
1273
|
showSelectedInfo();
|
|
1261
1274
|
showSelectedDays();
|
|
1262
1275
|
autoclose();
|
|
1263
|
-
}
|
|
1276
|
+
}
|
|
1264
1277
|
|
|
1265
|
-
|
|
1278
|
+
function weekNumberClicked(weekNumberDom) {
|
|
1266
1279
|
// Implement into native once needed
|
|
1267
1280
|
|
|
1268
1281
|
// var thisTime = parseInt(weekNumberDom.attr('data-start-time'), 10);
|
|
@@ -1286,9 +1299,9 @@ import './daterangepicker.css';
|
|
|
1286
1299
|
showSelectedInfo();
|
|
1287
1300
|
showSelectedDays();
|
|
1288
1301
|
autoclose();
|
|
1289
|
-
}
|
|
1302
|
+
}
|
|
1290
1303
|
|
|
1291
|
-
|
|
1304
|
+
function isValidTime(time) {
|
|
1292
1305
|
time = parseInt(time, 10);
|
|
1293
1306
|
if (opt.startDate && compare_day(time, opt.startDate) < 0) { return false; }
|
|
1294
1307
|
|
|
@@ -1327,7 +1340,7 @@ import './daterangepicker.css';
|
|
|
1327
1340
|
}
|
|
1328
1341
|
|
|
1329
1342
|
return true;
|
|
1330
|
-
}
|
|
1343
|
+
}
|
|
1331
1344
|
|
|
1332
1345
|
function updateSelectableRange() {
|
|
1333
1346
|
box.find('.day.invalid.tmp').removeClass('tmp invalid').addClass('valid');
|
|
@@ -1434,12 +1447,12 @@ import './daterangepicker.css';
|
|
|
1434
1447
|
}
|
|
1435
1448
|
}
|
|
1436
1449
|
|
|
1437
|
-
|
|
1450
|
+
function clearHovering() {
|
|
1438
1451
|
box.find('.day.hovering').removeClass('hovering');
|
|
1439
1452
|
box.find('.date-range-length-tip').hide();
|
|
1440
|
-
}
|
|
1453
|
+
}
|
|
1441
1454
|
|
|
1442
|
-
|
|
1455
|
+
function autoclose() {
|
|
1443
1456
|
if (opt.singleDate === true) {
|
|
1444
1457
|
if (initiated && opt.start) {
|
|
1445
1458
|
if (opt.autoClose) { closeDatePicker(); }
|
|
@@ -1449,9 +1462,9 @@ import './daterangepicker.css';
|
|
|
1449
1462
|
if (opt.autoClose) { closeDatePicker(); }
|
|
1450
1463
|
}
|
|
1451
1464
|
}
|
|
1452
|
-
}
|
|
1465
|
+
}
|
|
1453
1466
|
|
|
1454
|
-
|
|
1467
|
+
function checkSelectionValid() {
|
|
1455
1468
|
const days = Math.ceil((opt.end - opt.start) / 86400000) + 1;
|
|
1456
1469
|
if (opt.singleDate) { // Validate if only start is there
|
|
1457
1470
|
if (opt.start && !opt.end) { box.find('.drp_top-bar').removeClass('error').addClass('normal'); } else { box.find('.drp_top-bar').removeClass('error').removeClass('normal'); }
|
|
@@ -1485,9 +1498,9 @@ import './daterangepicker.css';
|
|
|
1485
1498
|
box.find('.day').removeClass('checked');
|
|
1486
1499
|
}
|
|
1487
1500
|
}
|
|
1488
|
-
}
|
|
1501
|
+
}
|
|
1489
1502
|
|
|
1490
|
-
|
|
1503
|
+
function showSelectedInfo(forceValid?, silent?) {
|
|
1491
1504
|
box.find('.start-day').html('...');
|
|
1492
1505
|
box.find('.end-day').html('...');
|
|
1493
1506
|
box.find('.selected-days').hide();
|
|
@@ -1538,15 +1551,17 @@ import './daterangepicker.css';
|
|
|
1538
1551
|
} else {
|
|
1539
1552
|
box.find('.apply-btn').addClass('disabled');
|
|
1540
1553
|
}
|
|
1541
|
-
}
|
|
1554
|
+
}
|
|
1542
1555
|
|
|
1543
|
-
|
|
1556
|
+
function countDays(start, end) {
|
|
1557
|
+
return Math.abs(daysFrom1970(start) - daysFrom1970(end)) + 1;
|
|
1558
|
+
}
|
|
1544
1559
|
|
|
1545
|
-
|
|
1560
|
+
function setDateRange(
|
|
1546
1561
|
date1?,
|
|
1547
1562
|
date2?,
|
|
1548
1563
|
silent?,
|
|
1549
|
-
)
|
|
1564
|
+
) {
|
|
1550
1565
|
if (date1.getTime() > date2.getTime()) {
|
|
1551
1566
|
let tmp = date2;
|
|
1552
1567
|
date2 = date1;
|
|
@@ -1603,9 +1618,9 @@ import './daterangepicker.css';
|
|
|
1603
1618
|
checkSelectionValid();
|
|
1604
1619
|
showSelectedInfo(false, silent);
|
|
1605
1620
|
autoclose();
|
|
1606
|
-
}
|
|
1621
|
+
}
|
|
1607
1622
|
|
|
1608
|
-
|
|
1623
|
+
function setSingleDate(date1) {
|
|
1609
1624
|
let valid = true;
|
|
1610
1625
|
if (opt.startDate && compare_day(date1, opt.startDate) < 0) { valid = false; }
|
|
1611
1626
|
|
|
@@ -1631,7 +1646,7 @@ import './daterangepicker.css';
|
|
|
1631
1646
|
showGap();
|
|
1632
1647
|
showSelectedInfo();
|
|
1633
1648
|
autoclose();
|
|
1634
|
-
}
|
|
1649
|
+
}
|
|
1635
1650
|
|
|
1636
1651
|
function showSelectedDays() {
|
|
1637
1652
|
if (!opt.start && !opt.end) { return; }
|
|
@@ -1677,7 +1692,7 @@ import './daterangepicker.css';
|
|
|
1677
1692
|
});
|
|
1678
1693
|
}
|
|
1679
1694
|
|
|
1680
|
-
|
|
1695
|
+
function showMonth(date: DateWrapper, month: 'month1' | 'month2') {
|
|
1681
1696
|
date = date.clone();
|
|
1682
1697
|
const monthName = nameMonth(date.getMonth());
|
|
1683
1698
|
box.find(`.${month} .month-name`).html(`${monthName} ${date.getFullYear()}`);
|
|
@@ -1685,7 +1700,7 @@ import './daterangepicker.css';
|
|
|
1685
1700
|
opt[month] = date;
|
|
1686
1701
|
updateSelectableRange();
|
|
1687
1702
|
bindDayEvents();
|
|
1688
|
-
}
|
|
1703
|
+
}
|
|
1689
1704
|
|
|
1690
1705
|
function bindDayEvents(): void {
|
|
1691
1706
|
box.find('.day').unbind('click').click(function (this: any) {
|
|
@@ -1708,16 +1723,20 @@ import './daterangepicker.css';
|
|
|
1708
1723
|
});
|
|
1709
1724
|
}
|
|
1710
1725
|
|
|
1711
|
-
|
|
1726
|
+
function showTime(date: DateWrapper, name: 'time1' | 'time2') {
|
|
1712
1727
|
box.find(`.${name}`).append(getTimeHTML());
|
|
1713
1728
|
renderTime(name, date);
|
|
1714
|
-
}
|
|
1729
|
+
}
|
|
1715
1730
|
|
|
1716
|
-
|
|
1731
|
+
function nameMonth(m) {
|
|
1732
|
+
return translate('month-name')[m];
|
|
1733
|
+
}
|
|
1717
1734
|
|
|
1718
|
-
|
|
1735
|
+
function getDateString(d) {
|
|
1736
|
+
return DateUtils.formatDate(d, opt.format);
|
|
1737
|
+
}
|
|
1719
1738
|
|
|
1720
|
-
|
|
1739
|
+
function showGap() {
|
|
1721
1740
|
showSelectedDays();
|
|
1722
1741
|
const m1 = parseInt(DateUtils.formatDate(opt.month1, 'yyyyMM'));
|
|
1723
1742
|
const m2 = parseInt(DateUtils.formatDate(opt.month2, 'yyyyMM'));
|
|
@@ -1732,12 +1751,12 @@ import './daterangepicker.css';
|
|
|
1732
1751
|
const h1 = box.find('table.month1').height();
|
|
1733
1752
|
const h2 = box.find('table.month2').height();
|
|
1734
1753
|
box.find('.gap').height(Math.max(h1, h2) + 10);
|
|
1735
|
-
}
|
|
1754
|
+
}
|
|
1736
1755
|
|
|
1737
|
-
|
|
1756
|
+
function closeDatePicker(): void {
|
|
1738
1757
|
if (opt.alwaysOpen) { return; }
|
|
1739
1758
|
|
|
1740
|
-
const afterAnim = ()
|
|
1759
|
+
const afterAnim = function () {
|
|
1741
1760
|
$(self).data('date-picker-opened', false);
|
|
1742
1761
|
$(self).trigger('datepicker-closed', {
|
|
1743
1762
|
relatedTarget: box,
|
|
@@ -1752,54 +1771,56 @@ import './daterangepicker.css';
|
|
|
1752
1771
|
$(self).trigger('datepicker-close', {
|
|
1753
1772
|
relatedTarget: box,
|
|
1754
1773
|
});
|
|
1755
|
-
}
|
|
1774
|
+
}
|
|
1756
1775
|
|
|
1757
|
-
|
|
1776
|
+
function redrawDatePicker(): void {
|
|
1758
1777
|
showMonth(opt.month1, 'month1');
|
|
1759
1778
|
showMonth(opt.month2, 'month2');
|
|
1760
|
-
}
|
|
1779
|
+
}
|
|
1761
1780
|
|
|
1762
|
-
|
|
1781
|
+
function compare_month(m1: DateWrapper, m2: DateWrapper): number {
|
|
1763
1782
|
const p = parseInt(DateUtils.formatDate(m1, 'yyyyMM')) - parseInt(DateUtils.formatDate(m2, 'yyyyMM'));
|
|
1764
1783
|
if (p > 0) { return 1; }
|
|
1765
1784
|
|
|
1766
1785
|
if (p === 0) { return 0; }
|
|
1767
1786
|
|
|
1768
1787
|
return -1;
|
|
1769
|
-
}
|
|
1788
|
+
}
|
|
1770
1789
|
|
|
1771
|
-
|
|
1790
|
+
function compare_day(m1: DateWrapper, m2: DateWrapper): number {
|
|
1772
1791
|
const p = parseInt(DateUtils.formatDate(m1, 'yyyyMMdd')) - parseInt(DateUtils.formatDate(m2, 'yyyyMMdd'));
|
|
1773
1792
|
if (p > 0) { return 1; }
|
|
1774
1793
|
|
|
1775
1794
|
if (p === 0) { return 0; }
|
|
1776
1795
|
|
|
1777
1796
|
return -1;
|
|
1778
|
-
}
|
|
1797
|
+
}
|
|
1779
1798
|
|
|
1780
|
-
|
|
1799
|
+
function nextMonth(month: DateWrapper): DateWrapper {
|
|
1781
1800
|
const retVal = month.clone();
|
|
1782
1801
|
retVal.setMonth(retVal.getMonth() + 1);
|
|
1783
1802
|
return retVal;
|
|
1784
|
-
}
|
|
1803
|
+
}
|
|
1785
1804
|
|
|
1786
|
-
|
|
1805
|
+
function prevMonth(month: DateWrapper): DateWrapper {
|
|
1787
1806
|
const retVal = month.clone();
|
|
1788
1807
|
retVal.setMonth(retVal.getMonth() - 1);
|
|
1789
1808
|
return retVal;
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
function getTimeHTML() {
|
|
1812
|
+
return `<div class="time-current-container">`
|
|
1813
|
+
+ `<span>${translate('Time')}: <span class="hour-val">00</span>:<span class="minute-val">00</span></span>`
|
|
1814
|
+
+ `</div>`
|
|
1815
|
+
+ `<div class="hour">`
|
|
1816
|
+
+ `<label>${translate('Hour')}: <input type="range" class="hour-range" name="hour" min="0" max="23"></label>`
|
|
1817
|
+
+ `</div>`
|
|
1818
|
+
+ `<div class="minute">`
|
|
1819
|
+
+ `<label>${translate('Minute')}: <input type="range" class="minute-range" name="minute" min="0" max="59"></label>`
|
|
1820
|
+
+ `</div>`;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
function createDom() {
|
|
1803
1824
|
let html = '<div class="date-range-picker-root"><div class="drpc-modal-close-button">x</div><div class="date-range-picker-wrapper';
|
|
1804
1825
|
if (opt.extraClass) { html += ` ${opt.extraClass} `; }
|
|
1805
1826
|
|
|
@@ -1849,14 +1870,12 @@ import './daterangepicker.css';
|
|
|
1849
1870
|
+ ` <thead>`
|
|
1850
1871
|
+ ` <tr class="caption">`
|
|
1851
1872
|
+ ` <th style="width:27px;">`
|
|
1852
|
-
+ ` <span class="prev">${
|
|
1853
|
-
arrowPrev
|
|
1873
|
+
+ ` <span class="prev">${arrowPrev
|
|
1854
1874
|
} </span>`
|
|
1855
1875
|
+ ` </th>`
|
|
1856
1876
|
+ ` <th colspan="${_colspan}" class="month-name">`
|
|
1857
1877
|
+ ` </th>`
|
|
1858
|
-
+ ` <th style="width:27px;">${
|
|
1859
|
-
opt.singleDate || !opt.stickyMonths ? `<span class="next">${arrowNext}</span>` : ''
|
|
1878
|
+
+ ` <th style="width:27px;">${opt.singleDate || !opt.stickyMonths ? `<span class="next">${arrowNext}</span>` : ''
|
|
1860
1879
|
} </th>`
|
|
1861
1880
|
+ ` </tr>`
|
|
1862
1881
|
+ ` <tr class="week-name">${getWeekHead()
|
|
@@ -1868,8 +1887,7 @@ import './daterangepicker.css';
|
|
|
1868
1887
|
+ `<table class="month2" cellspacing="0" border="0" cellpadding="0">`
|
|
1869
1888
|
+ ` <thead>`
|
|
1870
1889
|
+ ` <tr class="caption">`
|
|
1871
|
-
+ ` <th style="width:27px;">${
|
|
1872
|
-
!opt.stickyMonths ? `<span class="prev">${arrowPrev}</span>` : ''
|
|
1890
|
+
+ ` <th style="width:27px;">${!opt.stickyMonths ? `<span class="prev">${arrowPrev}</span>` : ''
|
|
1873
1891
|
} </th>`
|
|
1874
1892
|
+ ` <th colspan="${_colspan}" class="month-name">`
|
|
1875
1893
|
+ ` </th>`
|
|
@@ -1965,9 +1983,9 @@ import './daterangepicker.css';
|
|
|
1965
1983
|
html += '</div></div></div>';
|
|
1966
1984
|
|
|
1967
1985
|
return $(html);
|
|
1968
|
-
}
|
|
1986
|
+
}
|
|
1969
1987
|
|
|
1970
|
-
|
|
1988
|
+
function getApplyBtnClass(): string {
|
|
1971
1989
|
let klass = '';
|
|
1972
1990
|
if (opt.autoClose === true) {
|
|
1973
1991
|
klass += ' hide';
|
|
@@ -1978,9 +1996,9 @@ import './daterangepicker.css';
|
|
|
1978
1996
|
}
|
|
1979
1997
|
|
|
1980
1998
|
return klass;
|
|
1981
|
-
}
|
|
1999
|
+
}
|
|
1982
2000
|
|
|
1983
|
-
|
|
2001
|
+
function getWeekHead(): string {
|
|
1984
2002
|
const prepend = opt.showWeekNumbers ? `<th>${translate('week-number')}</th>` : '';
|
|
1985
2003
|
if (opt.startOfWeek == 'monday') {
|
|
1986
2004
|
return `${prepend}<th>${translate('week-1')}</th>`
|
|
@@ -1999,9 +2017,9 @@ import './daterangepicker.css';
|
|
|
1999
2017
|
+ `<th>${translate('week-5')}</th>`
|
|
2000
2018
|
+ `<th>${translate('week-6')}</th>`;
|
|
2001
2019
|
}
|
|
2002
|
-
}
|
|
2020
|
+
}
|
|
2003
2021
|
|
|
2004
|
-
|
|
2022
|
+
function isMonthOutOfBounds(month: DateWrapper): boolean {
|
|
2005
2023
|
const date = month.clone();
|
|
2006
2024
|
const monthStart = new DateWrapper(
|
|
2007
2025
|
date.getFullYear(),
|
|
@@ -2023,9 +2041,9 @@ import './daterangepicker.css';
|
|
|
2023
2041
|
}
|
|
2024
2042
|
|
|
2025
2043
|
return false;
|
|
2026
|
-
}
|
|
2044
|
+
}
|
|
2027
2045
|
|
|
2028
|
-
|
|
2046
|
+
function getGapHTML() {
|
|
2029
2047
|
const html = ['<div class="gap-top-mask"></div><div class="gap-bottom-mask"></div><div class="gap-lines">'];
|
|
2030
2048
|
for (let i = 0; i < 20; i++) {
|
|
2031
2049
|
html.push('<div class="gap-line">'
|
|
@@ -2036,13 +2054,13 @@ import './daterangepicker.css';
|
|
|
2036
2054
|
}
|
|
2037
2055
|
html.push('</div>');
|
|
2038
2056
|
return html.join('');
|
|
2039
|
-
}
|
|
2057
|
+
}
|
|
2040
2058
|
|
|
2041
|
-
|
|
2059
|
+
function attributesCallbacks(
|
|
2042
2060
|
initialObject,
|
|
2043
2061
|
callbacksArray,
|
|
2044
2062
|
today,
|
|
2045
|
-
)
|
|
2063
|
+
) {
|
|
2046
2064
|
const resultObject = $.extend(
|
|
2047
2065
|
true,
|
|
2048
2066
|
{},
|
|
@@ -2069,19 +2087,21 @@ import './daterangepicker.css';
|
|
|
2069
2087
|
}
|
|
2070
2088
|
|
|
2071
2089
|
return attrString;
|
|
2072
|
-
}
|
|
2090
|
+
}
|
|
2073
2091
|
|
|
2074
|
-
|
|
2092
|
+
function daysFrom1970(t) {
|
|
2093
|
+
return Math.floor(toLocalTimestamp(t) / 86400000);
|
|
2094
|
+
}
|
|
2075
2095
|
|
|
2076
|
-
|
|
2096
|
+
function toLocalTimestamp(t) {
|
|
2077
2097
|
if (typeof t == 'object' && t.getTime) { t = t.getTime(); }
|
|
2078
2098
|
|
|
2079
2099
|
if (typeof t == 'string' && !t.match(/\d{13}/)) { t = DateUtils.getDateWrapperFromFormat(t, opt.format).getTime(); }
|
|
2080
2100
|
|
|
2081
2101
|
return t;
|
|
2082
|
-
}
|
|
2102
|
+
}
|
|
2083
2103
|
|
|
2084
|
-
|
|
2104
|
+
function createMonthHTML(d) {
|
|
2085
2105
|
const days = [];
|
|
2086
2106
|
d.setDate(1);
|
|
2087
2107
|
const lastMonth = new DateWrapper(d.getTime() - 86400000);
|
|
@@ -2168,9 +2188,9 @@ import './daterangepicker.css';
|
|
|
2168
2188
|
html.push('</tr>');
|
|
2169
2189
|
}
|
|
2170
2190
|
return html.join('');
|
|
2171
|
-
}
|
|
2191
|
+
}
|
|
2172
2192
|
|
|
2173
|
-
|
|
2193
|
+
function getInnerDayHtml(attributes: any, today: any) {
|
|
2174
2194
|
if (opt.getCellHtml != null) {
|
|
2175
2195
|
return opt.getCellHtml({
|
|
2176
2196
|
attributesHtml: null,
|
|
@@ -2184,17 +2204,17 @@ import './daterangepicker.css';
|
|
|
2184
2204
|
opt.dayDivAttrs,
|
|
2185
2205
|
today,
|
|
2186
2206
|
)}>${showDayHTML(today.time, today.day)}</div>`;
|
|
2187
|
-
}
|
|
2207
|
+
}
|
|
2188
2208
|
|
|
2189
|
-
|
|
2209
|
+
function showDayHTML(time, date) {
|
|
2190
2210
|
if (opt.showDateFilter && typeof opt.showDateFilter == 'function') {
|
|
2191
2211
|
return opt.showDateFilter(time, date);
|
|
2192
2212
|
}
|
|
2193
2213
|
|
|
2194
2214
|
return date;
|
|
2195
|
-
}
|
|
2215
|
+
}
|
|
2196
2216
|
|
|
2197
|
-
|
|
2217
|
+
function getLanguages(): any {
|
|
2198
2218
|
if (opt.language == 'auto') {
|
|
2199
2219
|
let language = navigator.language ? navigator.language : (navigator as any).browserLanguage;
|
|
2200
2220
|
if (!language) {
|
|
@@ -2212,21 +2232,21 @@ import './daterangepicker.css';
|
|
|
2212
2232
|
} else {
|
|
2213
2233
|
return $.dateRangePickerLanguages.default;
|
|
2214
2234
|
}
|
|
2215
|
-
}
|
|
2235
|
+
}
|
|
2216
2236
|
|
|
2217
2237
|
/**
|
|
2218
2238
|
* Translate language string, try both the provided translation key, as the lower case version
|
|
2219
2239
|
*/
|
|
2220
|
-
|
|
2240
|
+
function translate(translationKey: string): string {
|
|
2221
2241
|
const translationKeyLowerCase = translationKey.toLowerCase();
|
|
2222
2242
|
let result = (translationKey in languages) ? languages[translationKey] : (translationKeyLowerCase in languages) ? languages[translationKeyLowerCase] : null;
|
|
2223
2243
|
const defaultLanguage = $.dateRangePickerLanguages.default;
|
|
2224
2244
|
if (result == null) { result = (translationKey in defaultLanguage) ? defaultLanguage[translationKey] : (translationKeyLowerCase in defaultLanguage) ? defaultLanguage[translationKeyLowerCase] : ''; }
|
|
2225
2245
|
|
|
2226
2246
|
return result;
|
|
2227
|
-
}
|
|
2247
|
+
}
|
|
2228
2248
|
|
|
2229
|
-
|
|
2249
|
+
function getDefaultTime(): DateWrapper {
|
|
2230
2250
|
let defaultTime = opt.defaultTime ? opt.defaultTime : DateWrapper.getCurrent();
|
|
2231
2251
|
|
|
2232
2252
|
if (opt.lookBehind) {
|
|
@@ -2246,9 +2266,9 @@ import './daterangepicker.css';
|
|
|
2246
2266
|
}
|
|
2247
2267
|
|
|
2248
2268
|
return defaultTime;
|
|
2249
|
-
}
|
|
2269
|
+
}
|
|
2250
2270
|
|
|
2251
|
-
|
|
2271
|
+
function resetMonthsView(time: DateWrapper) {
|
|
2252
2272
|
if (!time) {
|
|
2253
2273
|
time = getDefaultTime();
|
|
2254
2274
|
}
|
|
@@ -2267,6 +2287,6 @@ import './daterangepicker.css';
|
|
|
2267
2287
|
|
|
2268
2288
|
showSelectedDays();
|
|
2269
2289
|
showGap();
|
|
2270
|
-
}
|
|
2290
|
+
}
|
|
2271
2291
|
};
|
|
2272
|
-
})($);
|
|
2292
|
+
})($);
|