flatpickr 2.3.4.0 → 2.3.5.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.
- checksums.yaml +4 -4
- data/lib/flatpickr/version.rb +1 -1
- data/vendor/assets/javascripts/flatpickr.js +131 -71
- data/vendor/assets/javascripts/flatpickr/l10n/de.js +1 -0
- data/vendor/assets/javascripts/flatpickr/l10n/lt.js +2 -2
- data/vendor/assets/javascripts/flatpickr/l10n/pt.js +3 -0
- data/vendor/assets/stylesheets/flatpickr.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/rtl/flatpickr.min.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/rtl/themes/airbnb.rtl.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/rtl/themes/base16_flat.rtl.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/rtl/themes/confetti.rtl.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/rtl/themes/dark.rtl.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/rtl/themes/material_blue.rtl.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/rtl/themes/material_green.rtl.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/rtl/themes/material_orange.rtl.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/rtl/themes/material_red.rtl.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/themes/airbnb.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/themes/base16_flat.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/themes/confetti.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/themes/dark.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/themes/material_blue.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/themes/material_green.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/themes/material_orange.css +1 -1
- data/vendor/assets/stylesheets/flatpickr/themes/material_red.css +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcc3bd43088a41be83303f84ca9dce418ee90cbf
|
4
|
+
data.tar.gz: 0c8b9851169670c1043799ccad990a880da085c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bf06c49a517d3ad90533cbf40d15f5975ddcc334087947440764a39175be5471ad9855f48671d15ddc8dfa3cd9f58d50a7d09cdc6178af3b9ff785624b4c95a
|
7
|
+
data.tar.gz: 1ce3fb691861a4fa504011030c2613f08a917471c04543c3e92690081d6195f68af995193a4ac7f5073b45045dafd12b68f0cfddd342c1c07caec04f9e860341
|
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.5, @license MIT */
|
6
6
|
function Flatpickr(element, config) {
|
7
7
|
var self = this;
|
8
8
|
|
@@ -44,8 +44,7 @@ function Flatpickr(element, config) {
|
|
44
44
|
if (!self.isMobile) {
|
45
45
|
Object.defineProperty(self, "dateIsPicked", {
|
46
46
|
set: function set(bool) {
|
47
|
-
|
48
|
-
self.calendarContainer.classList.remove("dateIsPicked");
|
47
|
+
toggleClass(self.calendarContainer, "dateIsPicked", bool);
|
49
48
|
}
|
50
49
|
});
|
51
50
|
}
|
@@ -135,6 +134,11 @@ function Flatpickr(element, config) {
|
|
135
134
|
}
|
136
135
|
}
|
137
136
|
|
137
|
+
function onMonthScroll(e) {
|
138
|
+
e.preventDefault();
|
139
|
+
self.changeMonth(Math.max(-1, Math.min(1, e.wheelDelta || -e.deltaY)));
|
140
|
+
}
|
141
|
+
|
138
142
|
function bind() {
|
139
143
|
if (self.config.wrap) {
|
140
144
|
["open", "close", "toggle", "clear"].forEach(function (el) {
|
@@ -180,6 +184,9 @@ function Flatpickr(element, config) {
|
|
180
184
|
return changeMonth(1);
|
181
185
|
});
|
182
186
|
|
187
|
+
self.currentMonthElement.addEventListener("wheel", function (e) {
|
188
|
+
return debounce(onMonthScroll(e), 50);
|
189
|
+
});
|
183
190
|
self.currentYearElement.addEventListener("wheel", function (e) {
|
184
191
|
return debounce(yearScroll(e), 50);
|
185
192
|
});
|
@@ -234,7 +241,9 @@ function Flatpickr(element, config) {
|
|
234
241
|
self.currentYear = jumpDate.getFullYear();
|
235
242
|
self.currentMonth = jumpDate.getMonth();
|
236
243
|
} catch (e) {
|
244
|
+
/* istanbul ignore next */
|
237
245
|
console.error(e.stack);
|
246
|
+
/* istanbul ignore next */
|
238
247
|
console.warn("Invalid date supplied: " + jumpDate);
|
239
248
|
}
|
240
249
|
|
@@ -298,14 +307,26 @@ function Flatpickr(element, config) {
|
|
298
307
|
|
299
308
|
self.calendarContainer.appendChild(fragment);
|
300
309
|
|
310
|
+
var customAppend = self.config.appendTo && self.config.appendTo.nodeType;
|
311
|
+
|
301
312
|
if (self.config.inline || self.config.static) {
|
302
313
|
self.calendarContainer.classList.add(self.config.inline ? "inline" : "static");
|
303
314
|
positionCalendar();
|
304
315
|
|
305
|
-
if (self.config.
|
306
|
-
self.element.parentNode.insertBefore(self.calendarContainer, (self.altInput || self.input).nextSibling);
|
316
|
+
if (self.config.inline && !customAppend) {
|
317
|
+
return self.element.parentNode.insertBefore(self.calendarContainer, (self.altInput || self.input).nextSibling);
|
318
|
+
}
|
319
|
+
|
320
|
+
if (self.config.static) {
|
321
|
+
var wrapper = createElement("div", "flatpickr-wrapper");
|
322
|
+
self.element.parentNode.insertBefore(wrapper, self.element);
|
323
|
+
wrapper.appendChild(self.element);
|
324
|
+
wrapper.appendChild(self.calendarContainer);
|
325
|
+
return;
|
307
326
|
}
|
308
|
-
}
|
327
|
+
}
|
328
|
+
|
329
|
+
(customAppend ? self.config.appendTo : window.document.body).appendChild(self.calendarContainer);
|
309
330
|
}
|
310
331
|
|
311
332
|
function createDay(className, date, dayNumber) {
|
@@ -398,6 +419,7 @@ function Flatpickr(element, config) {
|
|
398
419
|
self.prevMonthNav.innerHTML = self.config.prevArrow;
|
399
420
|
|
400
421
|
self.currentMonthElement = createElement("span", "cur-month");
|
422
|
+
self.currentMonthElement.title = self.l10n.scrollTitle;
|
401
423
|
|
402
424
|
var yearInput = createNumberInput("cur-year");
|
403
425
|
self.currentYearElement = yearInput.childNodes[0];
|
@@ -599,7 +621,9 @@ function Flatpickr(element, config) {
|
|
599
621
|
}
|
600
622
|
|
601
623
|
function documentClick(e) {
|
602
|
-
var isInput = self.element.contains(e.target) || e.target === self.input || e.target === self.altInput ||
|
624
|
+
var isInput = self.element.contains(e.target) || e.target === self.input || e.target === self.altInput ||
|
625
|
+
// web components
|
626
|
+
e.path && e.path.indexOf && (~e.path.indexOf(self.input) || ~e.path.indexOf(self.altInput));
|
603
627
|
|
604
628
|
if (self.isOpen && !self.config.inline && !isCalendarElem(e.target) && !isInput) {
|
605
629
|
e.preventDefault();
|
@@ -623,7 +647,7 @@ function Flatpickr(element, config) {
|
|
623
647
|
|
624
648
|
function handleYearChange(newYear) {
|
625
649
|
if (self.currentMonth < 0 || self.currentMonth > 11) {
|
626
|
-
self.currentYear += self.currentMonth
|
650
|
+
self.currentYear += self.currentMonth > 11 ? 1 : -1;
|
627
651
|
self.currentMonth = (self.currentMonth + 12) % 12;
|
628
652
|
|
629
653
|
triggerEvent("YearChange");
|
@@ -679,8 +703,6 @@ function Flatpickr(element, config) {
|
|
679
703
|
|
680
704
|
case 27:
|
681
705
|
// escape
|
682
|
-
self.clear();
|
683
|
-
self.redraw();
|
684
706
|
self.close();
|
685
707
|
break;
|
686
708
|
|
@@ -690,11 +712,8 @@ function Flatpickr(element, config) {
|
|
690
712
|
|
691
713
|
case 38:
|
692
714
|
e.preventDefault();
|
693
|
-
|
694
|
-
|
695
|
-
self.currentYear++;
|
696
|
-
self.redraw();
|
697
|
-
}
|
715
|
+
self.currentYear++;
|
716
|
+
self.redraw();
|
698
717
|
|
699
718
|
break;
|
700
719
|
|
@@ -704,10 +723,8 @@ function Flatpickr(element, config) {
|
|
704
723
|
|
705
724
|
case 40:
|
706
725
|
e.preventDefault();
|
707
|
-
|
708
|
-
|
709
|
-
self.redraw();
|
710
|
-
}
|
726
|
+
self.currentYear--;
|
727
|
+
self.redraw();
|
711
728
|
|
712
729
|
break;
|
713
730
|
|
@@ -733,16 +750,20 @@ function Flatpickr(element, config) {
|
|
733
750
|
}
|
734
751
|
}
|
735
752
|
|
736
|
-
|
753
|
+
var _loop = function _loop(timestamp, i) {
|
737
754
|
var outOfRange = timestamp < self.minRangeDate.getTime() || timestamp > self.maxRangeDate.getTime();
|
738
755
|
|
739
756
|
if (outOfRange) {
|
740
757
|
self.days.childNodes[i].classList.add("notAllowed");
|
741
|
-
|
742
|
-
|
743
|
-
|
758
|
+
["inRange", "startRange", "endRange"].forEach(function (c) {
|
759
|
+
self.days.childNodes[i].classList.remove(c);
|
760
|
+
});
|
761
|
+
return "continue";
|
762
|
+
} else if (containsDisabled && !outOfRange) return "continue";
|
744
763
|
|
745
|
-
|
764
|
+
["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) {
|
765
|
+
self.days.childNodes[i].classList.remove(c);
|
766
|
+
});
|
746
767
|
|
747
768
|
var minRangeDate = Math.max(self.minRangeDate.getTime(), rangeStartDate),
|
748
769
|
maxRangeDate = Math.min(self.maxRangeDate.getTime(), rangeEndDate);
|
@@ -750,6 +771,12 @@ function Flatpickr(element, config) {
|
|
750
771
|
e.target.classList.add(hoverDate < self.selectedDates[0] ? "startRange" : "endRange");
|
751
772
|
|
752
773
|
if (initialDate > hoverDate && timestamp === initialDate.getTime()) self.days.childNodes[i].classList.add("endRange");else if (initialDate < hoverDate && timestamp === initialDate.getTime()) self.days.childNodes[i].classList.add("startRange");else if (timestamp > minRangeDate && timestamp < maxRangeDate) self.days.childNodes[i].classList.add("inRange");
|
774
|
+
};
|
775
|
+
|
776
|
+
for (var timestamp = self.days.childNodes[0].dateObj.getTime(), i = 0; i < 42; i++, timestamp += self.utils.duration.DAY) {
|
777
|
+
var _ret = _loop(timestamp, i);
|
778
|
+
|
779
|
+
if (_ret === "continue") continue;
|
753
780
|
}
|
754
781
|
}
|
755
782
|
|
@@ -813,6 +840,9 @@ function Flatpickr(element, config) {
|
|
813
840
|
|
814
841
|
function parseConfig() {
|
815
842
|
var boolOpts = ["utc", "wrap", "weekNumbers", "allowInput", "clickOpens", "time_24hr", "enableTime", "noCalendar", "altInput", "shorthandCurrentMonth", "inline", "static", "enableSeconds", "disableMobile"];
|
843
|
+
|
844
|
+
var hooks = ["onChange", "onClose", "onDayCreate", "onOpen", "onReady", "onValueUpdate"];
|
845
|
+
|
816
846
|
self.config = Object.create(Flatpickr.defaultConfig);
|
817
847
|
|
818
848
|
Object.defineProperty(self.config, "minDate", {
|
@@ -835,6 +865,8 @@ function Flatpickr(element, config) {
|
|
835
865
|
|
836
866
|
for (var i = 0; i < boolOpts.length; i++) {
|
837
867
|
self.config[boolOpts[i]] = self.config[boolOpts[i]] === true || self.config[boolOpts[i]] === "true";
|
868
|
+
}for (var _i = 0; _i < hooks.length; _i++) {
|
869
|
+
self.config[hooks[_i]] = arrayify(self.config[hooks[_i]]);
|
838
870
|
}if (!userConfig.dateFormat && userConfig.enableTime) {
|
839
871
|
self.config.dateFormat = self.config.noCalendar ? "H:i" + (self.config.enableSeconds ? ":S" : "") : Flatpickr.defaultConfig.dateFormat + " H:i" + (self.config.enableSeconds ? ":S" : "");
|
840
872
|
}
|
@@ -842,6 +874,13 @@ function Flatpickr(element, config) {
|
|
842
874
|
if (userConfig.altInput && userConfig.enableTime && !userConfig.altFormat) {
|
843
875
|
self.config.altFormat = self.config.noCalendar ? "h:i" + (self.config.enableSeconds ? ":S K" : " K") : Flatpickr.defaultConfig.altFormat + (" h:i" + (self.config.enableSeconds ? ":S" : "") + " K");
|
844
876
|
}
|
877
|
+
|
878
|
+
for (var _i2 = 0; _i2 < self.config.plugins.length; _i2++) {
|
879
|
+
var pluginConf = self.config.plugins[_i2](self) || {};
|
880
|
+
for (var key in pluginConf) {
|
881
|
+
if (Array.isArray(self.config[key])) self.config[key] = arrayify(pluginConf[key]).concat(self.config[key]);else if (userConfig[key] !== undefined) self.config[key] = pluginConf[key];
|
882
|
+
}
|
883
|
+
}
|
845
884
|
}
|
846
885
|
|
847
886
|
function setupLocale() {
|
@@ -857,37 +896,32 @@ function Flatpickr(element, config) {
|
|
857
896
|
calendarWidth = self.calendarContainer.offsetWidth,
|
858
897
|
input = self.altInput || self.input,
|
859
898
|
inputBounds = input.getBoundingClientRect(),
|
860
|
-
distanceFromBottom = window.innerHeight - inputBounds.bottom + input.offsetHeight
|
899
|
+
distanceFromBottom = window.innerHeight - inputBounds.bottom + input.offsetHeight,
|
900
|
+
bottomCalendar = distanceFromBottom < calendarHeight + 60;
|
861
901
|
|
862
|
-
var top =
|
902
|
+
var top = window.pageYOffset + inputBounds.top + (!bottomCalendar ? input.offsetHeight + 2 : -calendarHeight - 2);
|
863
903
|
|
864
|
-
|
865
|
-
|
866
|
-
self.calendarContainer.classList.remove("arrowTop");
|
867
|
-
self.calendarContainer.classList.add("arrowBottom");
|
868
|
-
} else {
|
869
|
-
top = window.pageYOffset + input.offsetHeight + inputBounds.top + 2;
|
870
|
-
self.calendarContainer.classList.remove("arrowBottom");
|
871
|
-
self.calendarContainer.classList.add("arrowTop");
|
872
|
-
}
|
904
|
+
toggleClass(self.calendarContainer, "arrowTop", !bottomCalendar);
|
905
|
+
toggleClass(self.calendarContainer, "arrowBottom", bottomCalendar);
|
873
906
|
|
874
|
-
if (
|
875
|
-
self.calendarContainer.style.top = top + "px";
|
907
|
+
if (self.config.inline) return;
|
876
908
|
|
877
|
-
|
878
|
-
|
909
|
+
var left = window.pageXOffset + inputBounds.left;
|
910
|
+
var right = window.document.body.offsetWidth - inputBounds.right;
|
911
|
+
var rightMost = left + calendarWidth > window.document.body.offsetWidth;
|
879
912
|
|
880
|
-
|
881
|
-
self.calendarContainer.style.left = left + "px";
|
882
|
-
self.calendarContainer.style.right = "auto";
|
913
|
+
toggleClass(self.calendarContainer, "rightMost", rightMost);
|
883
914
|
|
884
|
-
|
885
|
-
} else {
|
886
|
-
self.calendarContainer.style.left = "auto";
|
887
|
-
self.calendarContainer.style.right = right + "px";
|
915
|
+
if (self.config.static) return;
|
888
916
|
|
889
|
-
|
890
|
-
|
917
|
+
self.calendarContainer.style.top = top + "px";
|
918
|
+
|
919
|
+
if (!rightMost) {
|
920
|
+
self.calendarContainer.style.left = left + "px";
|
921
|
+
self.calendarContainer.style.right = "auto";
|
922
|
+
} else {
|
923
|
+
self.calendarContainer.style.left = "auto";
|
924
|
+
self.calendarContainer.style.right = right + "px";
|
891
925
|
}
|
892
926
|
}
|
893
927
|
|
@@ -939,7 +973,19 @@ function Flatpickr(element, config) {
|
|
939
973
|
return self.dateIsPicked = true;
|
940
974
|
}, 50);
|
941
975
|
|
942
|
-
if (self.config.mode === "range"
|
976
|
+
if (self.config.mode === "range") {
|
977
|
+
if (self.selectedDates.length === 1) {
|
978
|
+
onMouseOver(e);
|
979
|
+
|
980
|
+
if (self.maxRangeDate < self.days.childNodes[41].dateObj) self.nextMonthNav.style.display = "none";
|
981
|
+
|
982
|
+
if (self.minRangeDate > self.days.childNodes[0].dateObj) self.prevMonthNav.style.display = "none";
|
983
|
+
} else {
|
984
|
+
self.nextMonthNav.style.display = "block";
|
985
|
+
self.prevMonthNav.style.display = "block";
|
986
|
+
updateNavigationCurrentMonth();
|
987
|
+
}
|
988
|
+
}
|
943
989
|
|
944
990
|
if (self.config.mode === "single" && !self.config.enableTime) self.close();
|
945
991
|
|
@@ -953,7 +999,7 @@ function Flatpickr(element, config) {
|
|
953
999
|
}
|
954
1000
|
|
955
1001
|
function setSelectedDate(inputDate) {
|
956
|
-
if (Array.isArray(inputDate)) self.selectedDates = inputDate.map(self.parseDate);else if (inputDate) {
|
1002
|
+
if (Array.isArray(inputDate)) self.selectedDates = inputDate.map(self.parseDate);else if (inputDate instanceof Date || !isNaN(inputDate)) self.selectedDates = [self.parseDate(inputDate)];else if (inputDate && inputDate.substring) {
|
957
1003
|
switch (self.config.mode) {
|
958
1004
|
case "single":
|
959
1005
|
self.selectedDates = [self.parseDate(inputDate)];
|
@@ -965,6 +1011,7 @@ function Flatpickr(element, config) {
|
|
965
1011
|
|
966
1012
|
case "range":
|
967
1013
|
self.selectedDates = inputDate.split(self.l10n.rangeSeparator).map(self.parseDate);
|
1014
|
+
|
968
1015
|
break;
|
969
1016
|
|
970
1017
|
default:
|
@@ -1169,6 +1216,7 @@ function Flatpickr(element, config) {
|
|
1169
1216
|
function setupInputs() {
|
1170
1217
|
self.input = self.config.wrap ? self.element.querySelector("[data-input]") : self.element;
|
1171
1218
|
|
1219
|
+
/* istanbul ignore next */
|
1172
1220
|
if (!self.input) return console.warn("Error: invalid input element specified", self.input);
|
1173
1221
|
|
1174
1222
|
self.input._type = self.input.type;
|
@@ -1229,9 +1277,9 @@ function Flatpickr(element, config) {
|
|
1229
1277
|
}
|
1230
1278
|
|
1231
1279
|
function triggerEvent(event, data) {
|
1232
|
-
|
1233
|
-
var hooks = Array.isArray(self.config["on" + event]) ? self.config["on" + event] : [self.config["on" + event]];
|
1280
|
+
var hooks = self.config["on" + event];
|
1234
1281
|
|
1282
|
+
if (hooks) {
|
1235
1283
|
for (var i = 0; i < hooks.length; i++) {
|
1236
1284
|
hooks[i](self.selectedDates, self.input.value, self, data);
|
1237
1285
|
}
|
@@ -1243,11 +1291,14 @@ function Flatpickr(element, config) {
|
|
1243
1291
|
|
1244
1292
|
// many front-end frameworks bind to the input event
|
1245
1293
|
self.input.dispatchEvent(new Event("input", { "bubbles": true }));
|
1246
|
-
} else {
|
1247
|
-
if (window.document.createEvent !== undefined) return self.input.dispatchEvent(self.changeEvent);
|
1248
|
-
|
1249
|
-
self.input.fireEvent("onchange");
|
1250
1294
|
}
|
1295
|
+
|
1296
|
+
/* istanbul ignore next */
|
1297
|
+
else {
|
1298
|
+
if (window.document.createEvent !== undefined) return self.input.dispatchEvent(self.changeEvent);
|
1299
|
+
|
1300
|
+
self.input.fireEvent("onchange");
|
1301
|
+
}
|
1251
1302
|
}
|
1252
1303
|
}
|
1253
1304
|
|
@@ -1327,6 +1378,16 @@ function Flatpickr(element, config) {
|
|
1327
1378
|
return e;
|
1328
1379
|
}
|
1329
1380
|
|
1381
|
+
function arrayify(obj) {
|
1382
|
+
if (Array.isArray(obj)) return obj;
|
1383
|
+
return [obj];
|
1384
|
+
}
|
1385
|
+
|
1386
|
+
function toggleClass(elem, className, bool) {
|
1387
|
+
if (bool) return elem.classList.add(className);
|
1388
|
+
elem.classList.remove(className);
|
1389
|
+
}
|
1390
|
+
|
1330
1391
|
/* istanbul ignore next */
|
1331
1392
|
function debounce(func, wait, immediate) {
|
1332
1393
|
var timeout = void 0;
|
@@ -1373,15 +1434,7 @@ function Flatpickr(element, config) {
|
|
1373
1434
|
|
1374
1435
|
var newValue = Number(curValue);
|
1375
1436
|
|
1376
|
-
|
1377
|
-
case "wheel":
|
1378
|
-
newValue = curValue + step * delta;
|
1379
|
-
break;
|
1380
|
-
|
1381
|
-
case "keydown":
|
1382
|
-
newValue = curValue + step * (e.which === 38 ? 1 : -1);
|
1383
|
-
break;
|
1384
|
-
}
|
1437
|
+
if (e.type === "wheel") newValue = curValue + step * delta;
|
1385
1438
|
|
1386
1439
|
if (e.type !== "input" || e.target.value.length === 2) {
|
1387
1440
|
if (newValue < min) {
|
@@ -1516,21 +1569,23 @@ Flatpickr.defaultConfig = {
|
|
1516
1569
|
// default locale
|
1517
1570
|
locale: "default",
|
1518
1571
|
|
1572
|
+
plugins: [],
|
1573
|
+
|
1519
1574
|
// onChange callback when user selects a date or time
|
1520
|
-
onChange:
|
1575
|
+
onChange: [], // function (dateObj, dateStr) {}
|
1521
1576
|
|
1522
1577
|
// called every time calendar is opened
|
1523
|
-
onOpen:
|
1578
|
+
onOpen: [], // function (dateObj, dateStr) {}
|
1524
1579
|
|
1525
1580
|
// called every time calendar is closed
|
1526
|
-
onClose:
|
1581
|
+
onClose: [], // function (dateObj, dateStr) {}
|
1527
1582
|
|
1528
1583
|
// called after calendar is ready
|
1529
|
-
onReady:
|
1584
|
+
onReady: [], // function (dateObj, dateStr) {}
|
1530
1585
|
|
1531
|
-
onValueUpdate:
|
1586
|
+
onValueUpdate: [],
|
1532
1587
|
|
1533
|
-
onDayCreate:
|
1588
|
+
onDayCreate: []
|
1534
1589
|
};
|
1535
1590
|
|
1536
1591
|
/* istanbul ignore next */
|
@@ -1610,6 +1665,7 @@ Flatpickr.prototype = {
|
|
1610
1665
|
date = new Date(date);
|
1611
1666
|
} else if (date instanceof Date) date = new Date(date.getTime()); // create a copy
|
1612
1667
|
|
1668
|
+
/* istanbul ignore next */
|
1613
1669
|
if (!(date instanceof Date)) {
|
1614
1670
|
console.warn("flatpickr: invalid date " + date_orig);
|
1615
1671
|
console.info(this.element);
|
@@ -1624,6 +1680,7 @@ Flatpickr.prototype = {
|
|
1624
1680
|
}
|
1625
1681
|
};
|
1626
1682
|
|
1683
|
+
/* istanbul ignore next */
|
1627
1684
|
function _flatpickr(nodeList, config) {
|
1628
1685
|
var nodes = Array.prototype.slice.call(nodeList); // static list
|
1629
1686
|
var instances = [];
|
@@ -1639,6 +1696,7 @@ function _flatpickr(nodeList, config) {
|
|
1639
1696
|
return instances.length === 1 ? instances[0] : instances;
|
1640
1697
|
}
|
1641
1698
|
|
1699
|
+
/* istanbul ignore next */
|
1642
1700
|
if (typeof HTMLElement !== "undefined") {
|
1643
1701
|
// browser env
|
1644
1702
|
HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {
|
@@ -1650,10 +1708,12 @@ if (typeof HTMLElement !== "undefined") {
|
|
1650
1708
|
};
|
1651
1709
|
}
|
1652
1710
|
|
1711
|
+
/* istanbul ignore next */
|
1653
1712
|
function flatpickr(selector, config) {
|
1654
1713
|
return _flatpickr(window.document.querySelectorAll(selector), config);
|
1655
1714
|
}
|
1656
1715
|
|
1716
|
+
/* istanbul ignore next */
|
1657
1717
|
if (typeof jQuery !== "undefined") {
|
1658
1718
|
jQuery.fn.flatpickr = function (config) {
|
1659
1719
|
return _flatpickr(this, config);
|