@websy/websy-designs 1.2.12 → 1.2.14
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.
|
@@ -206,10 +206,11 @@ class WebsyDatePicker {
|
|
|
206
206
|
this.validDates = []
|
|
207
207
|
this.validYears = []
|
|
208
208
|
this.validHours = []
|
|
209
|
-
this.customRangeSelected = true
|
|
209
|
+
this.customRangeSelected = true
|
|
210
210
|
this.shiftPressed = false
|
|
211
211
|
const DEFAULTS = {
|
|
212
212
|
defaultRange: 0,
|
|
213
|
+
dateFormat: '%_m/%_d/%Y',
|
|
213
214
|
allowClear: true,
|
|
214
215
|
hideRanges: false,
|
|
215
216
|
minAllowedDate: this.floorDate(new Date(new Date((new Date().setFullYear(new Date().getFullYear() - 1))).setDate(1))),
|
|
@@ -408,10 +409,10 @@ class WebsyDatePicker {
|
|
|
408
409
|
this.updateRange()
|
|
409
410
|
}
|
|
410
411
|
else {
|
|
411
|
-
this.selectedRangeDates = [...this.priorSelectedDates]
|
|
412
|
+
this.selectedRangeDates = [...(this.priorSelectedDates || [])]
|
|
412
413
|
this.selectedRange = this.priorSelectedRange
|
|
413
414
|
this.customRangeSelected = this.priorCustomRangeSelected
|
|
414
|
-
this.currentselection = [...this.priorselection]
|
|
415
|
+
this.currentselection = [...(this.priorselection || [])]
|
|
415
416
|
this.highlightRange()
|
|
416
417
|
}
|
|
417
418
|
}
|
|
@@ -450,7 +451,10 @@ class WebsyDatePicker {
|
|
|
450
451
|
this.close()
|
|
451
452
|
}
|
|
452
453
|
else if (event.target.classList.contains('clear-selection')) {
|
|
453
|
-
this.selectRange(0)
|
|
454
|
+
this.selectRange(0, false)
|
|
455
|
+
if (this.options.onClear) {
|
|
456
|
+
this.options.onClear()
|
|
457
|
+
}
|
|
454
458
|
this.updateRange(0)
|
|
455
459
|
}
|
|
456
460
|
}
|
|
@@ -935,7 +939,7 @@ class WebsyDatePicker {
|
|
|
935
939
|
this.selectedRange = -1
|
|
936
940
|
this.highlightRange()
|
|
937
941
|
}
|
|
938
|
-
selectRange (index) {
|
|
942
|
+
selectRange (index, confirm = true) {
|
|
939
943
|
if (this.options.ranges[this.options.mode][index]) {
|
|
940
944
|
this.selectedRangeDates = [...this.options.ranges[this.options.mode][index].range]
|
|
941
945
|
this.currentselection = [...this.options.ranges[this.options.mode][index].range]
|
|
@@ -950,7 +954,7 @@ class WebsyDatePicker {
|
|
|
950
954
|
}
|
|
951
955
|
}
|
|
952
956
|
this.highlightRange()
|
|
953
|
-
this.close(
|
|
957
|
+
this.close(confirm)
|
|
954
958
|
}
|
|
955
959
|
}
|
|
956
960
|
selectCustomRange (range) {
|
|
@@ -283,6 +283,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
283
283
|
this.shiftPressed = false;
|
|
284
284
|
var DEFAULTS = {
|
|
285
285
|
defaultRange: 0,
|
|
286
|
+
dateFormat: '%_m/%_d/%Y',
|
|
286
287
|
allowClear: true,
|
|
287
288
|
hideRanges: false,
|
|
288
289
|
minAllowedDate: this.floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setDate(1))),
|
|
@@ -452,10 +453,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
452
453
|
|
|
453
454
|
this.updateRange();
|
|
454
455
|
} else {
|
|
455
|
-
this.selectedRangeDates = _toConsumableArray(this.priorSelectedDates);
|
|
456
|
+
this.selectedRangeDates = _toConsumableArray(this.priorSelectedDates || []);
|
|
456
457
|
this.selectedRange = this.priorSelectedRange;
|
|
457
458
|
this.customRangeSelected = this.priorCustomRangeSelected;
|
|
458
|
-
this.currentselection = _toConsumableArray(this.priorselection);
|
|
459
|
+
this.currentselection = _toConsumableArray(this.priorselection || []);
|
|
459
460
|
this.highlightRange();
|
|
460
461
|
}
|
|
461
462
|
}
|
|
@@ -493,7 +494,12 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
493
494
|
} else if (event.target.classList.contains('websy-dp-cancel')) {
|
|
494
495
|
this.close();
|
|
495
496
|
} else if (event.target.classList.contains('clear-selection')) {
|
|
496
|
-
this.selectRange(0);
|
|
497
|
+
this.selectRange(0, false);
|
|
498
|
+
|
|
499
|
+
if (this.options.onClear) {
|
|
500
|
+
this.options.onClear();
|
|
501
|
+
}
|
|
502
|
+
|
|
497
503
|
this.updateRange(0);
|
|
498
504
|
}
|
|
499
505
|
}
|
|
@@ -1035,6 +1041,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1035
1041
|
}, {
|
|
1036
1042
|
key: "selectRange",
|
|
1037
1043
|
value: function selectRange(index) {
|
|
1044
|
+
var confirm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1045
|
+
|
|
1038
1046
|
if (this.options.ranges[this.options.mode][index]) {
|
|
1039
1047
|
this.selectedRangeDates = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
|
|
1040
1048
|
this.currentselection = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
|
|
@@ -1050,7 +1058,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1050
1058
|
}
|
|
1051
1059
|
|
|
1052
1060
|
this.highlightRange();
|
|
1053
|
-
this.close(
|
|
1061
|
+
this.close(confirm);
|
|
1054
1062
|
}
|
|
1055
1063
|
}
|
|
1056
1064
|
}, {
|