flatpickr 4.5.2.0 → 4.5.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -14
- data/lib/flatpickr/version.rb +1 -1
- data/vendor/assets/javascripts/flatpickr.js +2065 -2106
- data/vendor/assets/javascripts/flatpickr/l10n/ar.js +12 -35
- data/vendor/assets/javascripts/flatpickr/l10n/at.js +17 -53
- data/vendor/assets/javascripts/flatpickr/l10n/be.js +22 -58
- data/vendor/assets/javascripts/flatpickr/l10n/bg.js +12 -48
- data/vendor/assets/javascripts/flatpickr/l10n/bn.js +12 -48
- data/vendor/assets/javascripts/flatpickr/l10n/cat.js +34 -66
- data/vendor/assets/javascripts/flatpickr/l10n/cs.js +22 -58
- data/vendor/assets/javascripts/flatpickr/l10n/cy.js +23 -75
- data/vendor/assets/javascripts/flatpickr/l10n/da.js +18 -54
- data/vendor/assets/javascripts/flatpickr/l10n/de.js +17 -53
- data/vendor/assets/javascripts/flatpickr/l10n/default.js +35 -66
- data/vendor/assets/javascripts/flatpickr/l10n/eo.js +20 -56
- data/vendor/assets/javascripts/flatpickr/l10n/es.js +17 -53
- data/vendor/assets/javascripts/flatpickr/l10n/et.js +20 -56
- data/vendor/assets/javascripts/flatpickr/l10n/fa.js +16 -52
- data/vendor/assets/javascripts/flatpickr/l10n/fi.js +16 -52
- data/vendor/assets/javascripts/flatpickr/l10n/fr.js +21 -58
- data/vendor/assets/javascripts/flatpickr/l10n/gr.js +21 -57
- data/vendor/assets/javascripts/flatpickr/l10n/he.js +12 -40
- data/vendor/assets/javascripts/flatpickr/l10n/hi.js +12 -48
- data/vendor/assets/javascripts/flatpickr/l10n/hr.js +13 -49
- data/vendor/assets/javascripts/flatpickr/l10n/hu.js +19 -55
- data/vendor/assets/javascripts/flatpickr/l10n/id.js +16 -44
- data/vendor/assets/javascripts/flatpickr/l10n/index.js +963 -2805
- data/vendor/assets/javascripts/flatpickr/l10n/it.js +20 -54
- data/vendor/assets/javascripts/flatpickr/l10n/ja.js +12 -48
- data/vendor/assets/javascripts/flatpickr/l10n/km.js +21 -57
- data/vendor/assets/javascripts/flatpickr/l10n/ko.js +15 -51
- data/vendor/assets/javascripts/flatpickr/l10n/kz.js +22 -58
- data/vendor/assets/javascripts/flatpickr/l10n/lt.js +19 -55
- data/vendor/assets/javascripts/flatpickr/l10n/lv.js +14 -50
- data/vendor/assets/javascripts/flatpickr/l10n/mk.js +15 -51
- data/vendor/assets/javascripts/flatpickr/l10n/mn.js +14 -42
- data/vendor/assets/javascripts/flatpickr/l10n/ms.js +16 -52
- data/vendor/assets/javascripts/flatpickr/l10n/my.js +16 -52
- data/vendor/assets/javascripts/flatpickr/l10n/nl.js +21 -58
- data/vendor/assets/javascripts/flatpickr/l10n/no.js +20 -56
- data/vendor/assets/javascripts/flatpickr/l10n/pa.js +12 -48
- data/vendor/assets/javascripts/flatpickr/l10n/pl.js +20 -56
- data/vendor/assets/javascripts/flatpickr/l10n/pt.js +13 -49
- data/vendor/assets/javascripts/flatpickr/l10n/ro.js +16 -52
- data/vendor/assets/javascripts/flatpickr/l10n/ru.js +22 -58
- data/vendor/assets/javascripts/flatpickr/l10n/si.js +12 -48
- data/vendor/assets/javascripts/flatpickr/l10n/sk.js +17 -53
- data/vendor/assets/javascripts/flatpickr/l10n/sl.js +17 -53
- data/vendor/assets/javascripts/flatpickr/l10n/sq.js +12 -48
- data/vendor/assets/javascripts/flatpickr/l10n/sr.js +15 -51
- data/vendor/assets/javascripts/flatpickr/l10n/sv.js +17 -53
- data/vendor/assets/javascripts/flatpickr/l10n/th.js +19 -55
- data/vendor/assets/javascripts/flatpickr/l10n/tr.js +21 -57
- data/vendor/assets/javascripts/flatpickr/l10n/uk.js +13 -49
- data/vendor/assets/javascripts/flatpickr/l10n/vn.js +13 -49
- data/vendor/assets/javascripts/flatpickr/l10n/zh.js +16 -52
- data/vendor/assets/javascripts/flatpickr/plugins/confirmDate/confirmDate.js +32 -35
- data/vendor/assets/javascripts/flatpickr/plugins/labelPlugin/labelPlugin.js +18 -17
- data/vendor/assets/javascripts/flatpickr/plugins/minMaxTimePlugin.js +262 -251
- data/vendor/assets/javascripts/flatpickr/plugins/monthSelect/monthSelect.js +46 -63
- data/vendor/assets/javascripts/flatpickr/plugins/rangePlugin.js +134 -125
- data/vendor/assets/javascripts/flatpickr/plugins/scrollPlugin.js +44 -31
- data/vendor/assets/javascripts/flatpickr/plugins/weekSelect/weekSelect.js +63 -66
- metadata +3 -4
@@ -6,70 +6,53 @@
|
|
6
6
|
}(this, (function () { 'use strict';
|
7
7
|
|
8
8
|
function monthSelectPlugin() {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
return {
|
55
|
-
onChange: highlightMonth,
|
56
|
-
onMonthChange: highlightMonth,
|
57
|
-
onClose: clearHover,
|
58
|
-
onParseConfig: function onParseConfig() {
|
59
|
-
fp.config.mode = "single";
|
60
|
-
fp.config.enableTime = false;
|
61
|
-
},
|
62
|
-
onReady: [
|
63
|
-
function () {
|
64
|
-
days = fp.days.childNodes;
|
65
|
-
},
|
66
|
-
function () {
|
67
|
-
return fp.days.addEventListener("mouseover", onDayHover);
|
68
|
-
},
|
69
|
-
highlightMonth,
|
70
|
-
],
|
71
|
-
};
|
9
|
+
return function (fp) {
|
10
|
+
var days;
|
11
|
+
|
12
|
+
function onDayHover(event) {
|
13
|
+
if (!event.target || !event.target.classList.contains("flatpickr-day")) return;
|
14
|
+
var dayIndex = Array.prototype.indexOf.call(days, event.target);
|
15
|
+
fp.monthStartDay = new Date(days[dayIndex].dateObj.getFullYear(), days[dayIndex].dateObj.getMonth(), 1, 0, 0, 0, 0).getTime();
|
16
|
+
fp.monthEndDay = new Date(days[dayIndex].dateObj.getFullYear(), days[dayIndex].dateObj.getMonth() + 1, 0, 0, 0, 0, 0).getTime();
|
17
|
+
|
18
|
+
for (var i = days.length; i--;) {
|
19
|
+
var date = days[i].dateObj.getTime();
|
20
|
+
if (date > fp.monthEndDay || date < fp.monthStartDay) days[i].classList.remove("inRange");else days[i].classList.add("inRange");
|
21
|
+
if (date != fp.monthEndDay) days[i].classList.remove("endRange");else days[i].classList.add("endRange");
|
22
|
+
if (date != fp.monthStartDay) days[i].classList.remove("startRange");else days[i].classList.add("startRange");
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
function highlightMonth() {
|
27
|
+
for (var i = days.length; i--;) {
|
28
|
+
var date = days[i].dateObj.getTime();
|
29
|
+
if (date >= fp.monthStartDay && date <= fp.monthEndDay) days[i].classList.add("month", "selected");
|
30
|
+
if (date != fp.monthEndDay) days[i].classList.remove("endRange");else days[i].classList.add("endRange");
|
31
|
+
if (date != fp.monthStartDay) days[i].classList.remove("startRange");else days[i].classList.add("startRange");
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
function clearHover() {
|
36
|
+
for (var i = days.length; i--;) {
|
37
|
+
days[i].classList.remove("inRange");
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
return {
|
42
|
+
onChange: highlightMonth,
|
43
|
+
onMonthChange: highlightMonth,
|
44
|
+
onClose: clearHover,
|
45
|
+
onParseConfig: function onParseConfig() {
|
46
|
+
fp.config.mode = "single";
|
47
|
+
fp.config.enableTime = false;
|
48
|
+
},
|
49
|
+
onReady: [function () {
|
50
|
+
days = fp.days.childNodes;
|
51
|
+
}, function () {
|
52
|
+
return fp.days.addEventListener("mouseover", onDayHover);
|
53
|
+
}, highlightMonth]
|
72
54
|
};
|
55
|
+
};
|
73
56
|
}
|
74
57
|
|
75
58
|
return monthSelectPlugin;
|
@@ -5,132 +5,141 @@
|
|
5
5
|
(global.rangePlugin = factory());
|
6
6
|
}(this, (function () { 'use strict';
|
7
7
|
|
8
|
-
function rangePlugin(config
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
8
|
+
function rangePlugin(config) {
|
9
|
+
if (config === void 0) {
|
10
|
+
config = {};
|
11
|
+
}
|
12
|
+
|
13
|
+
return function (fp) {
|
14
|
+
var dateFormat = "",
|
15
|
+
secondInput,
|
16
|
+
_secondInputFocused,
|
17
|
+
_prevDates;
|
18
|
+
|
19
|
+
var createSecondInput = function createSecondInput() {
|
20
|
+
if (config.input) {
|
21
|
+
secondInput = config.input instanceof Element ? config.input : window.document.querySelector(config.input);
|
22
|
+
} else {
|
23
|
+
secondInput = fp._input.cloneNode();
|
24
|
+
secondInput.removeAttribute("id");
|
25
|
+
secondInput._flatpickr = undefined;
|
26
|
+
}
|
27
|
+
|
28
|
+
if (secondInput.value) {
|
29
|
+
var parsedDate = fp.parseDate(secondInput.value);
|
30
|
+
if (parsedDate) fp.selectedDates.push(parsedDate);
|
31
|
+
}
|
32
|
+
|
33
|
+
secondInput.setAttribute("data-fp-omit", "");
|
34
|
+
|
35
|
+
fp._bind(secondInput, ["focus", "click"], function () {
|
36
|
+
if (fp.selectedDates[1]) {
|
37
|
+
fp.latestSelectedDateObj = fp.selectedDates[1];
|
38
|
+
|
39
|
+
fp._setHoursFromDate(fp.selectedDates[1]);
|
40
|
+
|
41
|
+
fp.jumpToDate(fp.selectedDates[1]);
|
42
|
+
}
|
43
|
+
_secondInputFocused = true;
|
44
|
+
fp.isOpen = false;
|
45
|
+
fp.open(undefined, secondInput);
|
46
|
+
});
|
47
|
+
|
48
|
+
fp._bind(fp._input, ["focus", "click"], function (e) {
|
49
|
+
e.preventDefault();
|
50
|
+
fp.isOpen = false;
|
51
|
+
fp.open();
|
52
|
+
});
|
53
|
+
|
54
|
+
if (fp.config.allowInput) fp._bind(secondInput, "keydown", function (e) {
|
55
|
+
if (e.key === "Enter") {
|
56
|
+
fp.setDate([fp.selectedDates[0], secondInput.value], true, dateFormat);
|
57
|
+
secondInput.click();
|
58
|
+
}
|
59
|
+
});
|
60
|
+
if (!config.input) fp._input.parentNode && fp._input.parentNode.insertBefore(secondInput, fp._input.nextSibling);
|
61
|
+
};
|
62
|
+
|
63
|
+
var plugin = {
|
64
|
+
onParseConfig: function onParseConfig() {
|
65
|
+
fp.config.mode = "range";
|
66
|
+
dateFormat = fp.config.altInput ? fp.config.altFormat : fp.config.dateFormat;
|
67
|
+
},
|
68
|
+
onReady: function onReady() {
|
69
|
+
createSecondInput();
|
70
|
+
fp.config.ignoredFocusElements.push(secondInput);
|
71
|
+
|
72
|
+
if (fp.config.allowInput) {
|
73
|
+
fp._input.removeAttribute("readonly");
|
74
|
+
|
75
|
+
secondInput.removeAttribute("readonly");
|
76
|
+
} else {
|
77
|
+
secondInput.setAttribute("readonly", "readonly");
|
78
|
+
}
|
79
|
+
|
80
|
+
fp._bind(fp._input, "focus", function () {
|
81
|
+
fp.latestSelectedDateObj = fp.selectedDates[0];
|
82
|
+
|
83
|
+
fp._setHoursFromDate(fp.selectedDates[0]);
|
84
|
+
_secondInputFocused = false;
|
85
|
+
fp.jumpToDate(fp.selectedDates[0]);
|
86
|
+
});
|
87
|
+
|
88
|
+
if (fp.config.allowInput) fp._bind(fp._input, "keydown", function (e) {
|
89
|
+
if (e.key === "Enter") fp.setDate([fp._input.value, fp.selectedDates[1]], true, dateFormat);
|
90
|
+
});
|
91
|
+
fp.setDate(fp.selectedDates, false);
|
92
|
+
plugin.onValueUpdate(fp.selectedDates);
|
93
|
+
},
|
94
|
+
onPreCalendarPosition: function onPreCalendarPosition() {
|
95
|
+
if (_secondInputFocused) {
|
96
|
+
fp._positionElement = secondInput;
|
97
|
+
setTimeout(function () {
|
98
|
+
fp._positionElement = fp._input;
|
99
|
+
}, 0);
|
100
|
+
}
|
101
|
+
},
|
102
|
+
onChange: function onChange() {
|
103
|
+
if (!fp.selectedDates.length) {
|
104
|
+
setTimeout(function () {
|
105
|
+
if (fp.selectedDates.length) return;
|
106
|
+
secondInput.value = "";
|
107
|
+
_prevDates = [];
|
108
|
+
}, 10);
|
109
|
+
}
|
110
|
+
|
111
|
+
if (_secondInputFocused) {
|
112
|
+
setTimeout(function () {
|
113
|
+
secondInput.focus();
|
114
|
+
}, 0);
|
115
|
+
}
|
116
|
+
},
|
117
|
+
onDestroy: function onDestroy() {
|
118
|
+
if (!config.input) secondInput.parentNode && secondInput.parentNode.removeChild(secondInput);
|
119
|
+
},
|
120
|
+
onValueUpdate: function onValueUpdate(selDates) {
|
121
|
+
if (!secondInput) return;
|
122
|
+
_prevDates = !_prevDates || selDates.length >= _prevDates.length ? selDates.concat() : _prevDates;
|
123
|
+
|
124
|
+
if (_prevDates.length > selDates.length) {
|
125
|
+
var newSelectedDate = selDates[0];
|
126
|
+
var newDates = _secondInputFocused ? [_prevDates[0], newSelectedDate] : [newSelectedDate, _prevDates[1]];
|
127
|
+
fp.setDate(newDates, false);
|
128
|
+
_prevDates = newDates.concat();
|
129
|
+
}
|
130
|
+
|
131
|
+
var _fp$selectedDates$map = fp.selectedDates.map(function (d) {
|
132
|
+
return fp.formatDate(d, dateFormat);
|
133
|
+
});
|
134
|
+
|
135
|
+
var _fp$selectedDates$map2 = _fp$selectedDates$map[0];
|
136
|
+
fp._input.value = _fp$selectedDates$map2 === void 0 ? "" : _fp$selectedDates$map2;
|
137
|
+
var _fp$selectedDates$map3 = _fp$selectedDates$map[1];
|
138
|
+
secondInput.value = _fp$selectedDates$map3 === void 0 ? "" : _fp$selectedDates$map3;
|
139
|
+
}
|
133
140
|
};
|
141
|
+
return plugin;
|
142
|
+
};
|
134
143
|
}
|
135
144
|
|
136
145
|
return rangePlugin;
|
@@ -6,43 +6,56 @@
|
|
6
6
|
}(this, (function () { 'use strict';
|
7
7
|
|
8
8
|
function delta(e) {
|
9
|
-
|
9
|
+
return Math.max(-1, Math.min(1, e.wheelDelta || -e.deltaY));
|
10
10
|
}
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
|
12
|
+
var scroll = function scroll(e) {
|
13
|
+
e.preventDefault();
|
14
|
+
var ev = new CustomEvent("increment", {
|
15
|
+
bubbles: true
|
16
|
+
});
|
17
|
+
ev.delta = delta(e);
|
18
|
+
e.target.dispatchEvent(ev);
|
18
19
|
};
|
20
|
+
|
19
21
|
function scrollMonth(fp) {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
return function (e) {
|
23
|
+
e.preventDefault();
|
24
|
+
var mDelta = delta(e);
|
25
|
+
fp.changeMonth(mDelta);
|
26
|
+
};
|
25
27
|
}
|
28
|
+
|
26
29
|
function scrollPlugin() {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
30
|
+
return function (fp) {
|
31
|
+
var monthScroller = scrollMonth(fp);
|
32
|
+
return {
|
33
|
+
onReady: function onReady() {
|
34
|
+
if (fp.timeContainer) {
|
35
|
+
fp.timeContainer.addEventListener("wheel", scroll);
|
36
|
+
}
|
37
|
+
|
38
|
+
fp.yearElements.forEach(function (yearElem) {
|
39
|
+
return yearElem.addEventListener("wheel", scroll);
|
40
|
+
});
|
41
|
+
fp.monthElements.forEach(function (monthElem) {
|
42
|
+
return monthElem.addEventListener("wheel", monthScroller);
|
43
|
+
});
|
44
|
+
},
|
45
|
+
onDestroy: function onDestroy() {
|
46
|
+
if (fp.timeContainer) {
|
47
|
+
fp.timeContainer.removeEventListener("wheel", scroll);
|
48
|
+
}
|
49
|
+
|
50
|
+
fp.yearElements.forEach(function (yearElem) {
|
51
|
+
return yearElem.removeEventListener("wheel", scroll);
|
52
|
+
});
|
53
|
+
fp.monthElements.forEach(function (monthElem) {
|
54
|
+
return monthElem.removeEventListener("wheel", monthScroller);
|
55
|
+
});
|
56
|
+
}
|
45
57
|
};
|
58
|
+
};
|
46
59
|
}
|
47
60
|
|
48
61
|
return scrollPlugin;
|