@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.
@@ -636,7 +636,10 @@ class WebsyDatePicker {
636
636
  this.close()
637
637
  }
638
638
  else if (event.target.classList.contains('clear-selection')) {
639
- this.selectRange(0)
639
+ this.selectRange(0, false)
640
+ if (this.options.onClear) {
641
+ this.options.onClear()
642
+ }
640
643
  this.updateRange(0)
641
644
  }
642
645
  }
@@ -1121,7 +1124,7 @@ class WebsyDatePicker {
1121
1124
  this.selectedRange = -1
1122
1125
  this.highlightRange()
1123
1126
  }
1124
- selectRange (index) {
1127
+ selectRange (index, confirm = true) {
1125
1128
  if (this.options.ranges[this.options.mode][index]) {
1126
1129
  this.selectedRangeDates = [...this.options.ranges[this.options.mode][index].range]
1127
1130
  this.currentselection = [...this.options.ranges[this.options.mode][index].range]
@@ -1136,7 +1139,7 @@ class WebsyDatePicker {
1136
1139
  }
1137
1140
  }
1138
1141
  this.highlightRange()
1139
- this.close(true)
1142
+ this.close(confirm)
1140
1143
  }
1141
1144
  }
1142
1145
  selectCustomRange (range) {
@@ -705,7 +705,12 @@ var WebsyDatePicker = /*#__PURE__*/function () {
705
705
  } else if (event.target.classList.contains('websy-dp-cancel')) {
706
706
  this.close();
707
707
  } else if (event.target.classList.contains('clear-selection')) {
708
- this.selectRange(0);
708
+ this.selectRange(0, false);
709
+
710
+ if (this.options.onClear) {
711
+ this.options.onClear();
712
+ }
713
+
709
714
  this.updateRange(0);
710
715
  }
711
716
  }
@@ -1247,6 +1252,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1247
1252
  }, {
1248
1253
  key: "selectRange",
1249
1254
  value: function selectRange(index) {
1255
+ var confirm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1256
+
1250
1257
  if (this.options.ranges[this.options.mode][index]) {
1251
1258
  this.selectedRangeDates = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
1252
1259
  this.currentselection = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
@@ -1262,7 +1269,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1262
1269
  }
1263
1270
 
1264
1271
  this.highlightRange();
1265
- this.close(true);
1272
+ this.close(confirm);
1266
1273
  }
1267
1274
  }
1268
1275
  }, {