@websy/websy-designs 1.2.12 → 1.2.13

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.
@@ -450,7 +450,10 @@ class WebsyDatePicker {
450
450
  this.close()
451
451
  }
452
452
  else if (event.target.classList.contains('clear-selection')) {
453
- this.selectRange(0)
453
+ this.selectRange(0, false)
454
+ if (this.options.onClear) {
455
+ this.options.onClear()
456
+ }
454
457
  this.updateRange(0)
455
458
  }
456
459
  }
@@ -935,7 +938,7 @@ class WebsyDatePicker {
935
938
  this.selectedRange = -1
936
939
  this.highlightRange()
937
940
  }
938
- selectRange (index) {
941
+ selectRange (index, confirm = true) {
939
942
  if (this.options.ranges[this.options.mode][index]) {
940
943
  this.selectedRangeDates = [...this.options.ranges[this.options.mode][index].range]
941
944
  this.currentselection = [...this.options.ranges[this.options.mode][index].range]
@@ -950,7 +953,7 @@ class WebsyDatePicker {
950
953
  }
951
954
  }
952
955
  this.highlightRange()
953
- this.close(true)
956
+ this.close(confirm)
954
957
  }
955
958
  }
956
959
  selectCustomRange (range) {
@@ -493,7 +493,12 @@ var WebsyDatePicker = /*#__PURE__*/function () {
493
493
  } else if (event.target.classList.contains('websy-dp-cancel')) {
494
494
  this.close();
495
495
  } else if (event.target.classList.contains('clear-selection')) {
496
- this.selectRange(0);
496
+ this.selectRange(0, false);
497
+
498
+ if (this.options.onClear) {
499
+ this.options.onClear();
500
+ }
501
+
497
502
  this.updateRange(0);
498
503
  }
499
504
  }
@@ -1035,6 +1040,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1035
1040
  }, {
1036
1041
  key: "selectRange",
1037
1042
  value: function selectRange(index) {
1043
+ var confirm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1044
+
1038
1045
  if (this.options.ranges[this.options.mode][index]) {
1039
1046
  this.selectedRangeDates = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
1040
1047
  this.currentselection = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
@@ -1050,7 +1057,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1050
1057
  }
1051
1058
 
1052
1059
  this.highlightRange();
1053
- this.close(true);
1060
+ this.close(confirm);
1054
1061
  }
1055
1062
  }
1056
1063
  }, {