@wernfried/daterangepicker 5.5.2 → 5.6.0
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.
- package/API_Doc.md +1 -1
- package/README.md +1 -1
- package/dist/cjs/daterangepicker.cjs +13 -8
- package/dist/cjs/daterangepicker.cjs.map +1 -1
- package/dist/cjs/daterangepicker.min.cjs +1 -1
- package/dist/cjs/daterangepicker.min.cjs.map +1 -1
- package/dist/esm/daterangepicker.js +13 -8
- package/dist/esm/daterangepicker.js.map +1 -1
- package/dist/esm/daterangepicker.min.js +1 -1
- package/dist/esm/daterangepicker.min.js.map +1 -1
- package/dist/global/daterangepicker.js +13 -8
- package/dist/global/daterangepicker.js.map +1 -1
- package/dist/global/daterangepicker.min.js +1 -1
- package/dist/global/daterangepicker.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -453,10 +453,10 @@ class DateRangePicker {
|
|
|
453
453
|
this.buttonClasses = options.buttonClasses;
|
|
454
454
|
}
|
|
455
455
|
if (typeof options.onOutsideClick === "string") {
|
|
456
|
-
if (["cancel", "apply"].includes(options.onOutsideClick))
|
|
456
|
+
if (["cancel", "apply", "hide"].includes(options.onOutsideClick))
|
|
457
457
|
this.onOutsideClick = options.onOutsideClick;
|
|
458
458
|
else
|
|
459
|
-
console.error(`Option 'onOutsideClick' must be 'cancel' or '
|
|
459
|
+
console.error(`Option 'onOutsideClick' must be 'cancel', 'apply' or 'hide'`);
|
|
460
460
|
}
|
|
461
461
|
if (this.locale.firstDay != 1) {
|
|
462
462
|
let iterator = this.locale.firstDay;
|
|
@@ -1697,14 +1697,10 @@ class DateRangePicker {
|
|
|
1697
1697
|
*/
|
|
1698
1698
|
hide() {
|
|
1699
1699
|
if (!this.isShowing) return;
|
|
1700
|
-
if (!this.#endDate) {
|
|
1700
|
+
if (!this.#endDate && !this.singleDatePicker) {
|
|
1701
1701
|
this.#startDate = this.oldStartDate;
|
|
1702
1702
|
this.#endDate = this.oldEndDate;
|
|
1703
1703
|
}
|
|
1704
|
-
if (typeof this.callback === "function") {
|
|
1705
|
-
if (this.#startDate && !this.#startDate.equals(this.oldStartDate ?? DateTime) || this.#endDate && !this.singleDatePicker && !this.#endDate.equals(this.oldEndDate ?? DateTime))
|
|
1706
|
-
this.callback(this.startDate, this.endDate, this.chosenLabel);
|
|
1707
|
-
}
|
|
1708
1704
|
this.updateElement();
|
|
1709
1705
|
const event = this.triggerEvent(this.#events.onBeforeHide);
|
|
1710
1706
|
if (event.defaultPrevented)
|
|
@@ -1776,8 +1772,12 @@ class DateRangePicker {
|
|
|
1776
1772
|
if (this.onOutsideClick === "cancel") {
|
|
1777
1773
|
this.#startDate = this.oldStartDate;
|
|
1778
1774
|
this.#endDate = this.oldEndDate;
|
|
1775
|
+
this.hide();
|
|
1776
|
+
} else if (this.onOutsideClick === "apply") {
|
|
1777
|
+
this.clickApply();
|
|
1778
|
+
} else {
|
|
1779
|
+
this.hide();
|
|
1779
1780
|
}
|
|
1780
|
-
this.hide();
|
|
1781
1781
|
}
|
|
1782
1782
|
/**
|
|
1783
1783
|
* Move calendar to previous month
|
|
@@ -2140,6 +2140,11 @@ class DateRangePicker {
|
|
|
2140
2140
|
* @private
|
|
2141
2141
|
*/
|
|
2142
2142
|
clickApply() {
|
|
2143
|
+
this.updateElement();
|
|
2144
|
+
if (typeof this.callback === "function") {
|
|
2145
|
+
if (this.#startDate && (this.#endDate || !this.singleDatePicker))
|
|
2146
|
+
this.callback(this.startDate, this.endDate, this.chosenLabel);
|
|
2147
|
+
}
|
|
2143
2148
|
this.hide();
|
|
2144
2149
|
this.triggerEvent(this.#events.onApply);
|
|
2145
2150
|
}
|