flatpickr 2.3.3.0 → 2.3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flatpickr/version.rb +1 -1
- data/vendor/assets/javascripts/flatpickr.js +40 -35
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60f6ba198c02be2902aa807731a98bc99244658a
|
4
|
+
data.tar.gz: 177f4531cf1680d578e617e543defbde6e4a6ad0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ca49652713915145f0bb6a93c49ae2fe8c14b1dd8a902217af0b8dd310528b186073f4992f083058e9e21843faf9d3ee13d461bae291fd69ba0ea15e9b3f37d
|
7
|
+
data.tar.gz: 05b424b978d7fc0fa1d4d97a968fd5d01ee6a0a661b773ca9d8ec01f1ad5e7805be7103958fd34d919383056566fbe6e312229bc4c86fe4ae88530015a9f5723
|
data/lib/flatpickr/version.rb
CHANGED
@@ -2,7 +2,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
|
|
2
2
|
|
3
3
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
4
4
|
|
5
|
-
/*! flatpickr v2.3.
|
5
|
+
/*! flatpickr v2.3.4, @license MIT */
|
6
6
|
function Flatpickr(element, config) {
|
7
7
|
var self = this;
|
8
8
|
|
@@ -155,9 +155,9 @@ function Flatpickr(element, config) {
|
|
155
155
|
|
156
156
|
self.debouncedResize = debounce(onResize, 50);
|
157
157
|
self.triggerChange = function () {
|
158
|
-
|
158
|
+
triggerEvent("Change");
|
159
159
|
};
|
160
|
-
self.debouncedChange = debounce(self.triggerChange,
|
160
|
+
self.debouncedChange = debounce(self.triggerChange, 300);
|
161
161
|
|
162
162
|
if (self.config.mode === "range" && self.days) self.days.addEventListener("mouseover", onMouseOver);
|
163
163
|
|
@@ -200,6 +200,7 @@ function Flatpickr(element, config) {
|
|
200
200
|
});
|
201
201
|
self.timeContainer.addEventListener("input", updateTime);
|
202
202
|
self.timeContainer.addEventListener("increment", updateTime);
|
203
|
+
self.timeContainer.addEventListener("increment", self.debouncedChange);
|
203
204
|
|
204
205
|
self.timeContainer.addEventListener("wheel", self.debouncedChange);
|
205
206
|
self.timeContainer.addEventListener("input", self.triggerChange);
|
@@ -658,6 +659,8 @@ function Flatpickr(element, config) {
|
|
658
659
|
|
659
660
|
if (d instanceof Function && d(dateToCheck)) // disabled by function
|
660
661
|
return bool;else if (d instanceof Date && d.getTime() === dateToCheck.getTime())
|
662
|
+
// disabled by date
|
663
|
+
return bool;else if (typeof d === "string" && self.parseDate(d, true).getTime() === dateToCheck.getTime())
|
661
664
|
// disabled by date string
|
662
665
|
return bool;else if ( // disabled by range
|
663
666
|
(typeof d === "undefined" ? "undefined" : _typeof(d)) === "object" && d.from && d.to && dateToCheck >= d.from && dateToCheck <= d.to) return bool;
|
@@ -949,12 +952,39 @@ function Flatpickr(element, config) {
|
|
949
952
|
jumpToDate();
|
950
953
|
}
|
951
954
|
|
955
|
+
function setSelectedDate(inputDate) {
|
956
|
+
if (Array.isArray(inputDate)) self.selectedDates = inputDate.map(self.parseDate);else if (inputDate) {
|
957
|
+
switch (self.config.mode) {
|
958
|
+
case "single":
|
959
|
+
self.selectedDates = [self.parseDate(inputDate)];
|
960
|
+
break;
|
961
|
+
|
962
|
+
case "multiple":
|
963
|
+
self.selectedDates = inputDate.split("; ").map(self.parseDate);
|
964
|
+
break;
|
965
|
+
|
966
|
+
case "range":
|
967
|
+
self.selectedDates = inputDate.split(self.l10n.rangeSeparator).map(self.parseDate);
|
968
|
+
break;
|
969
|
+
|
970
|
+
default:
|
971
|
+
break;
|
972
|
+
}
|
973
|
+
}
|
974
|
+
|
975
|
+
self.selectedDates = self.selectedDates.filter(function (d) {
|
976
|
+
return d instanceof Date && d.getTime() && isEnabled(d, false);
|
977
|
+
});
|
978
|
+
|
979
|
+
self.selectedDates.sort(function (a, b) {
|
980
|
+
return a.getTime() - b.getTime();
|
981
|
+
});
|
982
|
+
}
|
983
|
+
|
952
984
|
function setDate(date, triggerChange) {
|
953
985
|
if (!date) return self.clear();
|
954
986
|
|
955
|
-
|
956
|
-
return d instanceof Date && isEnabled(d);
|
957
|
-
});
|
987
|
+
setSelectedDate(date);
|
958
988
|
|
959
989
|
if (self.selectedDates.length > 0) {
|
960
990
|
self.dateIsPicked = true;
|
@@ -986,39 +1016,13 @@ function Flatpickr(element, config) {
|
|
986
1016
|
|
987
1017
|
self.selectedDates = [];
|
988
1018
|
self.now = new Date();
|
989
|
-
var inputDate = self.config.defaultDate || self.input.value;
|
990
1019
|
|
991
|
-
|
992
|
-
switch (self.config.mode) {
|
993
|
-
case "single":
|
994
|
-
self.selectedDates = [self.parseDate(inputDate)];
|
995
|
-
break;
|
996
|
-
|
997
|
-
case "multiple":
|
998
|
-
self.selectedDates = inputDate.split("; ").map(self.parseDate);
|
999
|
-
break;
|
1000
|
-
|
1001
|
-
case "range":
|
1002
|
-
self.selectedDates = inputDate.split(self.l10n.rangeSeparator).map(self.parseDate);
|
1003
|
-
break;
|
1004
|
-
|
1005
|
-
default:
|
1006
|
-
break;
|
1007
|
-
}
|
1008
|
-
}
|
1020
|
+
setSelectedDate(self.config.defaultDate || self.input.value);
|
1009
1021
|
|
1010
1022
|
if (self.config.disable.length) self.config.disable = parseDateRules(self.config.disable);
|
1011
1023
|
|
1012
1024
|
if (self.config.enable.length) self.config.enable = parseDateRules(self.config.enable);
|
1013
1025
|
|
1014
|
-
self.selectedDates = self.selectedDates.filter(function (d) {
|
1015
|
-
return d instanceof Date && d.getTime() && isEnabled(d, false);
|
1016
|
-
});
|
1017
|
-
|
1018
|
-
self.selectedDates.sort(function (a, b) {
|
1019
|
-
return a.getTime() - b.getTime();
|
1020
|
-
});
|
1021
|
-
|
1022
1026
|
var initialDate = self.selectedDates.length ? self.selectedDates[0] : self.config.minDate && self.config.minDate.getTime() > self.now ? self.config.minDate : self.config.maxDate && self.config.maxDate.getTime() < self.now ? self.config.maxDate : self.now;
|
1023
1027
|
|
1024
1028
|
self.currentYear = initialDate.getFullYear();
|
@@ -1234,12 +1238,12 @@ function Flatpickr(element, config) {
|
|
1234
1238
|
}
|
1235
1239
|
|
1236
1240
|
if (event === "Change") {
|
1237
|
-
|
1241
|
+
if (typeof Event === "function" && Event.constructor) {
|
1238
1242
|
self.input.dispatchEvent(new Event("change", { "bubbles": true }));
|
1239
1243
|
|
1240
1244
|
// many front-end frameworks bind to the input event
|
1241
1245
|
self.input.dispatchEvent(new Event("input", { "bubbles": true }));
|
1242
|
-
}
|
1246
|
+
} else {
|
1243
1247
|
if (window.document.createEvent !== undefined) return self.input.dispatchEvent(self.changeEvent);
|
1244
1248
|
|
1245
1249
|
self.input.fireEvent("onchange");
|
@@ -1634,6 +1638,7 @@ function _flatpickr(nodeList, config) {
|
|
1634
1638
|
|
1635
1639
|
return instances.length === 1 ? instances[0] : instances;
|
1636
1640
|
}
|
1641
|
+
|
1637
1642
|
if (typeof HTMLElement !== "undefined") {
|
1638
1643
|
// browser env
|
1639
1644
|
HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {
|