flatpickr 3.0.0.0 → 3.0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2bec38961ec6a9561c326df64699acea948b1a90
4
- data.tar.gz: e21341f12ff8ebfe7936f1b2023c16eb206393d9
3
+ metadata.gz: d86d03cd7b9bfdfaf953583d17201a69956c9eab
4
+ data.tar.gz: d8d0c435b5a68da661d1230f46adde633af60be7
5
5
  SHA512:
6
- metadata.gz: 533712a46a842dc051752790439b0b3d96afad034f5206efe4e61ea63478f6170566001b1c12e170bf818d0b8b0ad178828fec8ceeb9231f75e638a27f04d254
7
- data.tar.gz: ee47a2dab0a23aa0bb88d8bed1ce8c67ad4156eb5dadfb47139cfedec27596cc89d0da26deb684b15acd137cd45aadab6264b30a3bd9246540cbf7097f8096fa
6
+ metadata.gz: b1e6c80b0c671a1ccff19aac836617f2b266ff84eb723caf829186883e78d249c723d2cfe52150711f91efa1279ccf24918a93b36b6c63518113da7df3a30a50
7
+ data.tar.gz: f4894411c55c26c576865595e8fc8101be617cc5a9a582d983d6c96098eaaa9b0b844126184da0589c19513eafd19d847c0b6d8f9ef4e9b9de94e8c40861aa3c
@@ -1,3 +1,3 @@
1
1
  module Flatpickr
2
- VERSION = '3.0.0.0'
2
+ VERSION = '3.0.7.0'
3
3
  end
@@ -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 v3.0.5-1, @license MIT */
5
+ /*! flatpickr v3.0.6, @license MIT */
6
6
  function FlatpickrInstance(element, config) {
7
7
  var self = this;
8
8
 
@@ -50,7 +50,7 @@ function FlatpickrInstance(element, config) {
50
50
  if (self.config.enableTime) {
51
51
  setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj || self.config.minDate : null);
52
52
  }
53
- updateValue();
53
+ updateValue(false);
54
54
  }
55
55
 
56
56
  self.showTimeInput = self.selectedDates.length > 0 || self.config.noCalendar;
@@ -673,7 +673,7 @@ function FlatpickrInstance(element, config) {
673
673
 
674
674
  self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;
675
675
 
676
- self.hourElement.value = self.pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getHours() : self.config.defaultHour);
676
+ self.hourElement.value = self.pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getHours() : self.config.defaultHour % (self.time_24hr ? 24 : 12));
677
677
 
678
678
  self.minuteElement.value = self.pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getMinutes() : self.config.defaultMinute);
679
679
 
@@ -700,7 +700,7 @@ function FlatpickrInstance(element, config) {
700
700
  var secondInput = createNumberInput("flatpickr-second");
701
701
  self.secondElement = secondInput.childNodes[0];
702
702
 
703
- self.secondElement.value = self.latestSelectedDateObj ? self.pad(self.latestSelectedDateObj.getSeconds()) : "00";
703
+ self.secondElement.value = self.pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getSeconds() : self.config.defaultSeconds);
704
704
 
705
705
  self.secondElement.step = self.minuteElement.step;
706
706
  self.secondElement.min = self.minuteElement.min;
@@ -712,7 +712,7 @@ function FlatpickrInstance(element, config) {
712
712
 
713
713
  if (!self.config.time_24hr) {
714
714
  // add self.amPM if appropriate
715
- self.amPM = createElement("span", "flatpickr-am-pm", ["AM", "PM"][self.hourElement.value > 11 | 0]);
715
+ self.amPM = createElement("span", "flatpickr-am-pm", ["AM", "PM"][(self.latestSelectedDateObj ? self.hourElement.value : self.config.defaultHour) > 11 | 0]);
716
716
  self.amPM.title = self.l10n.toggleTitle;
717
717
  self.amPM.tabIndex = -1;
718
718
  self.timeContainer.appendChild(self.amPM);
@@ -874,7 +874,9 @@ function FlatpickrInstance(element, config) {
874
874
  }
875
875
 
876
876
  ["_showTimeInput", "latestSelectedDateObj", "_hideNextMonthArrow", "_hidePrevMonthArrow", "__hideNextMonthArrow", "__hidePrevMonthArrow", "isMobile", "isOpen", "selectedDateElem", "minDateHasTime", "maxDateHasTime", "days", "daysContainer", "_input", "_positionElement", "innerContainer", "rContainer", "monthNav", "todayDateElem", "calendarContainer", "weekdayContainer", "prevMonthNav", "nextMonthNav", "currentMonthElement", "currentYearElement", "navigationCurrentMonth", "selectedDateElem", "config"].forEach(function (k) {
877
- return delete self[k];
877
+ try {
878
+ delete self[k];
879
+ } catch (e) {}
878
880
  });
879
881
  }
880
882
 
@@ -973,6 +975,11 @@ function FlatpickrInstance(element, config) {
973
975
  self.close();
974
976
  break;
975
977
 
978
+ case "Backspace":
979
+ case "Delete":
980
+ if (!self.config.allowInput) self.clear();
981
+ break;
982
+
976
983
  case "ArrowLeft":
977
984
  case "ArrowRight":
978
985
  if (!isTimeObj) {
@@ -1000,6 +1007,7 @@ function FlatpickrInstance(element, config) {
1000
1007
  } else if (self.config.enableTime) {
1001
1008
  if (!isTimeObj) self.hourElement.focus();
1002
1009
  updateTime(e);
1010
+ self.debouncedChange();
1003
1011
  }
1004
1012
 
1005
1013
  break;
@@ -1342,7 +1350,7 @@ function FlatpickrInstance(element, config) {
1342
1350
 
1343
1351
  // maintain focus
1344
1352
  if (!shouldChangeMonth) focusOnDay(e.target.$i, 0);else afterDayAnim(function () {
1345
- return self.selectedDateElem.focus();
1353
+ return self.selectedDateElem && self.selectedDateElem.focus();
1346
1354
  });
1347
1355
 
1348
1356
  if (self.config.enableTime) setTimeout(function () {
@@ -1358,7 +1366,8 @@ function FlatpickrInstance(element, config) {
1358
1366
  }
1359
1367
 
1360
1368
  function set(option, value) {
1361
- self.config[option] = value;
1369
+ if (option !== null && (typeof option === "undefined" ? "undefined" : _typeof(option)) === "object") _extends(self.config, option);else self.config[option] = value;
1370
+
1362
1371
  self.redraw();
1363
1372
  jumpToDate();
1364
1373
  }
@@ -1537,7 +1546,7 @@ function FlatpickrInstance(element, config) {
1537
1546
  var inputType = self.config.enableTime ? self.config.noCalendar ? "time" : "datetime-local" : "date";
1538
1547
 
1539
1548
  self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile");
1540
- self.mobileInput.step = "any";
1549
+ self.mobileInput.step = self.input.getAttribute("step") || "any";
1541
1550
  self.mobileInput.tabIndex = 1;
1542
1551
  self.mobileInput.type = inputType;
1543
1552
  self.mobileInput.disabled = self.input.disabled;
@@ -2020,6 +2029,8 @@ FlatpickrInstance.prototype = {
2020
2029
  * @return {Date} the parsed Date object
2021
2030
  */
2022
2031
  parseDate: function parseDate(date, givenFormat, timeless) {
2032
+ var _this2 = this;
2033
+
2023
2034
  if (date !== 0 && !date) return null;
2024
2035
 
2025
2036
  var date_orig = date;
@@ -2037,25 +2048,37 @@ FlatpickrInstance.prototype = {
2037
2048
  timeless = true;
2038
2049
  } else if (/Z$/.test(date) || /GMT$/.test(date)) // datestrings w/ timezone
2039
2050
  date = new Date(date);else if (this.config && this.config.parseDate) date = this.config.parseDate(date, format);else {
2040
- var parsedDate = !this.config || !this.config.noCalendar ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) : new Date(new Date().setHours(0, 0, 0, 0));
2041
-
2042
- var matched = void 0;
2043
-
2044
- for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) {
2045
- var token = format[i];
2046
- var isBackSlash = token === "\\";
2047
- var escaped = format[i - 1] === "\\" || isBackSlash;
2048
-
2049
- if (this.tokenRegex[token] && !escaped) {
2050
- regexStr += this.tokenRegex[token];
2051
- var match = new RegExp(regexStr).exec(date);
2052
- if (match && (matched = true)) {
2053
- parsedDate = this.revFormat[token](parsedDate, match[++matchIndex]) || parsedDate;
2054
- }
2055
- } else if (!isBackSlash) regexStr += "."; // don't really care
2056
- }
2057
-
2058
- date = matched ? parsedDate : null;
2051
+ (function () {
2052
+ var parsedDate = !_this2.config || !_this2.config.noCalendar ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) : new Date(new Date().setHours(0, 0, 0, 0));
2053
+
2054
+ var matched = void 0,
2055
+ ops = [];
2056
+
2057
+ for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) {
2058
+ var token = format[i];
2059
+ var isBackSlash = token === "\\";
2060
+ var escaped = format[i - 1] === "\\" || isBackSlash;
2061
+
2062
+ if (_this2.tokenRegex[token] && !escaped) {
2063
+ regexStr += _this2.tokenRegex[token];
2064
+ var match = new RegExp(regexStr).exec(date);
2065
+ if (match && (matched = true)) {
2066
+ ops[token !== "Y" ? "push" : "unshift"]({
2067
+ fn: _this2.revFormat[token],
2068
+ val: match[++matchIndex]
2069
+ });
2070
+ }
2071
+ } else if (!isBackSlash) regexStr += "."; // don't really care
2072
+
2073
+ ops.forEach(function (_ref) {
2074
+ var fn = _ref.fn,
2075
+ val = _ref.val;
2076
+ return parsedDate = fn(parsedDate, val) || parsedDate;
2077
+ });
2078
+ }
2079
+
2080
+ date = matched ? parsedDate : null;
2081
+ })();
2059
2082
  }
2060
2083
  }
2061
2084
 
@@ -2120,7 +2143,7 @@ flatpickr.defaultConfig = FlatpickrInstance.defaultConfig = {
2120
2143
 
2121
2144
  position: "auto",
2122
2145
 
2123
- animate: window.navigator.userAgent.indexOf("MSIE") === -1,
2146
+ animate: typeof window !== "undefined" && window.navigator.userAgent.indexOf("MSIE") === -1,
2124
2147
 
2125
2148
  // wrap: see https://chmln.github.io/flatpickr/examples/#flatpickr-external-elements
2126
2149
  wrap: false,
@@ -2227,6 +2250,9 @@ flatpickr.defaultConfig = FlatpickrInstance.defaultConfig = {
2227
2250
  // initial value in the minute element
2228
2251
  defaultMinute: 0,
2229
2252
 
2253
+ // initial value in the seconds element
2254
+ defaultSeconds: 0,
2255
+
2230
2256
  // disable native mobile datetime input support
2231
2257
  disableMobile: false,
2232
2258
 
@@ -94,6 +94,4 @@ var l10n = {
94
94
  zh: zh
95
95
  };
96
96
 
97
- if (typeof module !== "undefined") {
98
- module.exports = l10n;
99
- }
97
+ if (typeof module !== "undefined") module.exports = l10n;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flatpickr
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.0
4
+ version: 3.0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zoran