@phillips/seldon 1.7.0 → 1.7.2
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/dist/_virtual/_commonjsHelpers.js +3 -5
- package/dist/components/Button/Button.d.ts +13 -19
- package/dist/components/Button/Button.js +10 -15
- package/dist/components/Header/Header.js +3 -21
- package/dist/components/HeroBanner/HeroBanner.d.ts +6 -6
- package/dist/components/HeroBanner/HeroBanner.js +1 -9
- package/dist/components/Input/Input.js +48 -51
- package/dist/components/Select/Select.js +45 -48
- package/dist/index.d.ts +0 -1
- package/dist/index.js +12 -14
- package/dist/scss/_reset.scss +20 -5
- package/dist/scss/_typography.scss +20 -11
- package/dist/scss/_utils.scss +2 -2
- package/dist/scss/_vars.scss +1 -4
- package/dist/scss/components/Button/_button.scss +35 -5
- package/dist/scss/components/DatePicker/_datePicker.scss +3 -4
- package/dist/scss/components/Header/_header.scss +1 -1
- package/dist/scss/components/HeroBanner/_heroBanner.scss +81 -81
- package/dist/scss/components/Input/_input.scss +2 -2
- package/dist/scss/components/Toggle/_toggle.scss +19 -13
- package/dist/scss/pages/_page.scss +1 -1
- package/dist/scss/styles.scss +1 -1
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.js +7 -23
- package/package.json +7 -4
- package/dist/_virtual/index2.js +0 -4
- package/dist/components/DatePicker/DatePicker.d.ts +0 -90
- package/dist/components/DatePicker/DatePicker.js +0 -92
- package/dist/node_modules/flatpickr/dist/esm/index.js +0 -947
- package/dist/node_modules/flatpickr/dist/esm/l10n/default.js +0 -75
- package/dist/node_modules/flatpickr/dist/esm/types/options.js +0 -80
- package/dist/node_modules/flatpickr/dist/esm/utils/dates.js +0 -90
- package/dist/node_modules/flatpickr/dist/esm/utils/dom.js +0 -45
- package/dist/node_modules/flatpickr/dist/esm/utils/formatting.js +0 -170
- package/dist/node_modules/flatpickr/dist/esm/utils/index.js +0 -23
- package/dist/node_modules/flatpickr/dist/esm/utils/polyfills.js +0 -15
- package/dist/node_modules/flatpickr/dist/l10n/index.js +0 -3471
|
@@ -1,947 +0,0 @@
|
|
|
1
|
-
import { defaults as ue, HOOKS as me } from "./types/options.js";
|
|
2
|
-
import { english as ve } from "./l10n/default.js";
|
|
3
|
-
import { pad as N, int as _, arrayify as ge, debounce as Ne } from "./utils/index.js";
|
|
4
|
-
import { createElement as p, toggleClass as M, getEventTarget as w, clearNode as ee, createNumberInput as ne, findParent as yn } from "./utils/dom.js";
|
|
5
|
-
import { createDateParser as De, createDateFormatter as Ye, compareDates as E, getDefaultHours as pe, duration as wn, isBetween as En, calculateSecondsSinceMidnight as he, parseSeconds as xn } from "./utils/dates.js";
|
|
6
|
-
import { monthToStr as Ae, tokenRegex as R } from "./utils/formatting.js";
|
|
7
|
-
import "./utils/polyfills.js";
|
|
8
|
-
var b = globalThis && globalThis.__assign || function() {
|
|
9
|
-
return b = Object.assign || function(u) {
|
|
10
|
-
for (var v, e = 1, k = arguments.length; e < k; e++) {
|
|
11
|
-
v = arguments[e];
|
|
12
|
-
for (var x in v)
|
|
13
|
-
Object.prototype.hasOwnProperty.call(v, x) && (u[x] = v[x]);
|
|
14
|
-
}
|
|
15
|
-
return u;
|
|
16
|
-
}, b.apply(this, arguments);
|
|
17
|
-
}, Pe = globalThis && globalThis.__spreadArrays || function() {
|
|
18
|
-
for (var u = 0, v = 0, e = arguments.length; v < e; v++)
|
|
19
|
-
u += arguments[v].length;
|
|
20
|
-
for (var k = Array(u), x = 0, v = 0; v < e; v++)
|
|
21
|
-
for (var C = arguments[v], I = 0, W = C.length; I < W; I++, x++)
|
|
22
|
-
k[x] = C[I];
|
|
23
|
-
return k;
|
|
24
|
-
}, kn = 300;
|
|
25
|
-
function In(u, v) {
|
|
26
|
-
var e = {
|
|
27
|
-
config: b(b({}, ue), D.defaultConfig),
|
|
28
|
-
l10n: ve
|
|
29
|
-
};
|
|
30
|
-
e.parseDate = De({ config: e.config, l10n: e.l10n }), e._handlers = [], e.pluginElements = [], e.loadedPlugins = [], e._bind = m, e._setHoursFromDate = K, e._positionCalendar = X, e.changeMonth = re, e.changeYear = U, e.clear = Ue, e.close = $e, e.onMouseOver = Q, e._createElement = p, e.createDay = V, e.destroy = Qe, e.isEnabled = O, e.jumpToDate = q, e.updateValue = S, e.open = Ze, e.redraw = Ie, e.set = an, e.setDate = rn, e.toggle = cn;
|
|
31
|
-
function k() {
|
|
32
|
-
e.utils = {
|
|
33
|
-
getDaysInMonth: function(n, t) {
|
|
34
|
-
return n === void 0 && (n = e.currentMonth), t === void 0 && (t = e.currentYear), n === 1 && (t % 4 === 0 && t % 100 !== 0 || t % 400 === 0) ? 29 : e.l10n.daysInMonth[n];
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function x() {
|
|
39
|
-
e.element = e.input = u, e.isOpen = !1, en(), ke(), ln(), on(), k(), e.isMobile || We(), He(), (e.selectedDates.length || e.config.noCalendar) && (e.config.enableTime && K(e.config.noCalendar ? e.latestSelectedDateObj : void 0), S(!1)), W();
|
|
40
|
-
var n = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
41
|
-
!e.isMobile && n && X(), h("onReady");
|
|
42
|
-
}
|
|
43
|
-
function C() {
|
|
44
|
-
var n;
|
|
45
|
-
return ((n = e.calendarContainer) === null || n === void 0 ? void 0 : n.getRootNode()).activeElement || document.activeElement;
|
|
46
|
-
}
|
|
47
|
-
function I(n) {
|
|
48
|
-
return n.bind(e);
|
|
49
|
-
}
|
|
50
|
-
function W() {
|
|
51
|
-
var n = e.config;
|
|
52
|
-
n.weekNumbers === !1 && n.showMonths === 1 || n.noCalendar !== !0 && window.requestAnimationFrame(function() {
|
|
53
|
-
if (e.calendarContainer !== void 0 && (e.calendarContainer.style.visibility = "hidden", e.calendarContainer.style.display = "block"), e.daysContainer !== void 0) {
|
|
54
|
-
var t = (e.days.offsetWidth + 1) * n.showMonths;
|
|
55
|
-
e.daysContainer.style.width = t + "px", e.calendarContainer.style.width = t + (e.weekWrapper !== void 0 ? e.weekWrapper.offsetWidth : 0) + "px", e.calendarContainer.style.removeProperty("visibility"), e.calendarContainer.style.removeProperty("display");
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
function A(n) {
|
|
60
|
-
if (e.selectedDates.length === 0) {
|
|
61
|
-
var t = e.config.minDate === void 0 || E(/* @__PURE__ */ new Date(), e.config.minDate) >= 0 ? /* @__PURE__ */ new Date() : new Date(e.config.minDate.getTime()), a = pe(e.config);
|
|
62
|
-
t.setHours(a.hours, a.minutes, a.seconds, t.getMilliseconds()), e.selectedDates = [t], e.latestSelectedDateObj = t;
|
|
63
|
-
}
|
|
64
|
-
n !== void 0 && n.type !== "blur" && un(n);
|
|
65
|
-
var i = e._input.value;
|
|
66
|
-
B(), S(), e._input.value !== i && e._debouncedChange();
|
|
67
|
-
}
|
|
68
|
-
function Fe(n, t) {
|
|
69
|
-
return n % 12 + 12 * _(t === e.l10n.amPM[1]);
|
|
70
|
-
}
|
|
71
|
-
function Le(n) {
|
|
72
|
-
switch (n % 24) {
|
|
73
|
-
case 0:
|
|
74
|
-
case 12:
|
|
75
|
-
return 12;
|
|
76
|
-
default:
|
|
77
|
-
return n % 12;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function B() {
|
|
81
|
-
if (!(e.hourElement === void 0 || e.minuteElement === void 0)) {
|
|
82
|
-
var n = (parseInt(e.hourElement.value.slice(-2), 10) || 0) % 24, t = (parseInt(e.minuteElement.value, 10) || 0) % 60, a = e.secondElement !== void 0 ? (parseInt(e.secondElement.value, 10) || 0) % 60 : 0;
|
|
83
|
-
e.amPM !== void 0 && (n = Fe(n, e.amPM.textContent));
|
|
84
|
-
var i = e.config.minTime !== void 0 || e.config.minDate && e.minDateHasTime && e.latestSelectedDateObj && E(e.latestSelectedDateObj, e.config.minDate, !0) === 0, r = e.config.maxTime !== void 0 || e.config.maxDate && e.maxDateHasTime && e.latestSelectedDateObj && E(e.latestSelectedDateObj, e.config.maxDate, !0) === 0;
|
|
85
|
-
if (e.config.maxTime !== void 0 && e.config.minTime !== void 0 && e.config.minTime > e.config.maxTime) {
|
|
86
|
-
var o = he(e.config.minTime.getHours(), e.config.minTime.getMinutes(), e.config.minTime.getSeconds()), s = he(e.config.maxTime.getHours(), e.config.maxTime.getMinutes(), e.config.maxTime.getSeconds()), f = he(n, t, a);
|
|
87
|
-
if (f > s && f < o) {
|
|
88
|
-
var d = xn(o);
|
|
89
|
-
n = d[0], t = d[1], a = d[2];
|
|
90
|
-
}
|
|
91
|
-
} else {
|
|
92
|
-
if (r) {
|
|
93
|
-
var l = e.config.maxTime !== void 0 ? e.config.maxTime : e.config.maxDate;
|
|
94
|
-
n = Math.min(n, l.getHours()), n === l.getHours() && (t = Math.min(t, l.getMinutes())), t === l.getMinutes() && (a = Math.min(a, l.getSeconds()));
|
|
95
|
-
}
|
|
96
|
-
if (i) {
|
|
97
|
-
var c = e.config.minTime !== void 0 ? e.config.minTime : e.config.minDate;
|
|
98
|
-
n = Math.max(n, c.getHours()), n === c.getHours() && t < c.getMinutes() && (t = c.getMinutes()), t === c.getMinutes() && (a = Math.max(a, c.getSeconds()));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
te(n, t, a);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
function K(n) {
|
|
105
|
-
var t = n || e.latestSelectedDateObj;
|
|
106
|
-
t && t instanceof Date && te(t.getHours(), t.getMinutes(), t.getSeconds());
|
|
107
|
-
}
|
|
108
|
-
function te(n, t, a) {
|
|
109
|
-
e.latestSelectedDateObj !== void 0 && e.latestSelectedDateObj.setHours(n % 24, t, a || 0, 0), !(!e.hourElement || !e.minuteElement || e.isMobile) && (e.hourElement.value = N(e.config.time_24hr ? n : (12 + n) % 12 + 12 * _(n % 12 === 0)), e.minuteElement.value = N(t), e.amPM !== void 0 && (e.amPM.textContent = e.l10n.amPM[_(n >= 12)]), e.secondElement !== void 0 && (e.secondElement.value = N(a)));
|
|
110
|
-
}
|
|
111
|
-
function je(n) {
|
|
112
|
-
var t = w(n), a = parseInt(t.value) + (n.delta || 0);
|
|
113
|
-
(a / 1e3 > 1 || n.key === "Enter" && !/[^\d]/.test(a.toString())) && U(a);
|
|
114
|
-
}
|
|
115
|
-
function m(n, t, a, i) {
|
|
116
|
-
if (t instanceof Array)
|
|
117
|
-
return t.forEach(function(r) {
|
|
118
|
-
return m(n, r, a, i);
|
|
119
|
-
});
|
|
120
|
-
if (n instanceof Array)
|
|
121
|
-
return n.forEach(function(r) {
|
|
122
|
-
return m(r, t, a, i);
|
|
123
|
-
});
|
|
124
|
-
n.addEventListener(t, a, i), e._handlers.push({
|
|
125
|
-
remove: function() {
|
|
126
|
-
return n.removeEventListener(t, a, i);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
function be() {
|
|
131
|
-
h("onChange");
|
|
132
|
-
}
|
|
133
|
-
function He() {
|
|
134
|
-
if (e.config.wrap && ["open", "close", "toggle", "clear"].forEach(function(a) {
|
|
135
|
-
Array.prototype.forEach.call(e.element.querySelectorAll("[data-" + a + "]"), function(i) {
|
|
136
|
-
return m(i, "click", e[a]);
|
|
137
|
-
});
|
|
138
|
-
}), e.isMobile) {
|
|
139
|
-
fn();
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
var n = Ne(Ge, 50);
|
|
143
|
-
if (e._debouncedChange = Ne(be, kn), e.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent) && m(e.daysContainer, "mouseover", function(a) {
|
|
144
|
-
e.config.mode === "range" && Q(w(a));
|
|
145
|
-
}), m(e._input, "keydown", we), e.calendarContainer !== void 0 && m(e.calendarContainer, "keydown", we), !e.config.inline && !e.config.static && m(window, "resize", n), window.ontouchstart !== void 0 ? m(window.document, "touchstart", oe) : m(window.document, "mousedown", oe), m(window.document, "focus", oe, { capture: !0 }), e.config.clickOpens === !0 && (m(e._input, "focus", e.open), m(e._input, "click", e.open)), e.daysContainer !== void 0 && (m(e.monthNav, "click", dn), m(e.monthNav, ["keyup", "increment"], je), m(e.daysContainer, "click", Te)), e.timeContainer !== void 0 && e.minuteElement !== void 0 && e.hourElement !== void 0) {
|
|
146
|
-
var t = function(a) {
|
|
147
|
-
return w(a).select();
|
|
148
|
-
};
|
|
149
|
-
m(e.timeContainer, ["increment"], A), m(e.timeContainer, "blur", A, { capture: !0 }), m(e.timeContainer, "click", Re), m([e.hourElement, e.minuteElement], ["focus", "click"], t), e.secondElement !== void 0 && m(e.secondElement, "focus", function() {
|
|
150
|
-
return e.secondElement && e.secondElement.select();
|
|
151
|
-
}), e.amPM !== void 0 && m(e.amPM, "click", function(a) {
|
|
152
|
-
A(a);
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
e.config.allowInput && m(e._input, "blur", Xe);
|
|
156
|
-
}
|
|
157
|
-
function q(n, t) {
|
|
158
|
-
var a = n !== void 0 ? e.parseDate(n) : e.latestSelectedDateObj || (e.config.minDate && e.config.minDate > e.now ? e.config.minDate : e.config.maxDate && e.config.maxDate < e.now ? e.config.maxDate : e.now), i = e.currentYear, r = e.currentMonth;
|
|
159
|
-
try {
|
|
160
|
-
a !== void 0 && (e.currentYear = a.getFullYear(), e.currentMonth = a.getMonth());
|
|
161
|
-
} catch (o) {
|
|
162
|
-
o.message = "Invalid date supplied: " + a, e.config.errorHandler(o);
|
|
163
|
-
}
|
|
164
|
-
t && e.currentYear !== i && (h("onYearChange"), P()), t && (e.currentYear !== i || e.currentMonth !== r) && h("onMonthChange"), e.redraw();
|
|
165
|
-
}
|
|
166
|
-
function Re(n) {
|
|
167
|
-
var t = w(n);
|
|
168
|
-
~t.className.indexOf("arrow") && ae(n, t.classList.contains("arrowUp") ? 1 : -1);
|
|
169
|
-
}
|
|
170
|
-
function ae(n, t, a) {
|
|
171
|
-
var i = n && w(n), r = a || i && i.parentNode && i.parentNode.firstChild, o = fe("increment");
|
|
172
|
-
o.delta = t, r && r.dispatchEvent(o);
|
|
173
|
-
}
|
|
174
|
-
function We() {
|
|
175
|
-
var n = window.document.createDocumentFragment();
|
|
176
|
-
if (e.calendarContainer = p("div", "flatpickr-calendar"), e.calendarContainer.tabIndex = -1, !e.config.noCalendar) {
|
|
177
|
-
if (n.appendChild(Ve()), e.innerContainer = p("div", "flatpickr-innerContainer"), e.config.weekNumbers) {
|
|
178
|
-
var t = Je(), a = t.weekWrapper, i = t.weekNumbers;
|
|
179
|
-
e.innerContainer.appendChild(a), e.weekNumbers = i, e.weekWrapper = a;
|
|
180
|
-
}
|
|
181
|
-
e.rContainer = p("div", "flatpickr-rContainer"), e.rContainer.appendChild(Ce()), e.daysContainer || (e.daysContainer = p("div", "flatpickr-days"), e.daysContainer.tabIndex = -1), J(), e.rContainer.appendChild(e.daysContainer), e.innerContainer.appendChild(e.rContainer), n.appendChild(e.innerContainer);
|
|
182
|
-
}
|
|
183
|
-
e.config.enableTime && n.appendChild(ze()), M(e.calendarContainer, "rangeMode", e.config.mode === "range"), M(e.calendarContainer, "animate", e.config.animate === !0), M(e.calendarContainer, "multiMonth", e.config.showMonths > 1), e.calendarContainer.appendChild(n);
|
|
184
|
-
var r = e.config.appendTo !== void 0 && e.config.appendTo.nodeType !== void 0;
|
|
185
|
-
if ((e.config.inline || e.config.static) && (e.calendarContainer.classList.add(e.config.inline ? "inline" : "static"), e.config.inline && (!r && e.element.parentNode ? e.element.parentNode.insertBefore(e.calendarContainer, e._input.nextSibling) : e.config.appendTo !== void 0 && e.config.appendTo.appendChild(e.calendarContainer)), e.config.static)) {
|
|
186
|
-
var o = p("div", "flatpickr-wrapper");
|
|
187
|
-
e.element.parentNode && e.element.parentNode.insertBefore(o, e.element), o.appendChild(e.element), e.altInput && o.appendChild(e.altInput), o.appendChild(e.calendarContainer);
|
|
188
|
-
}
|
|
189
|
-
!e.config.static && !e.config.inline && (e.config.appendTo !== void 0 ? e.config.appendTo : window.document.body).appendChild(e.calendarContainer);
|
|
190
|
-
}
|
|
191
|
-
function V(n, t, a, i) {
|
|
192
|
-
var r = O(t, !0), o = p("span", n, t.getDate().toString());
|
|
193
|
-
return o.dateObj = t, o.$i = i, o.setAttribute("aria-label", e.formatDate(t, e.config.ariaDateFormat)), n.indexOf("hidden") === -1 && E(t, e.now) === 0 && (e.todayDateElem = o, o.classList.add("today"), o.setAttribute("aria-current", "date")), r ? (o.tabIndex = -1, ce(t) && (o.classList.add("selected"), e.selectedDateElem = o, e.config.mode === "range" && (M(o, "startRange", e.selectedDates[0] && E(t, e.selectedDates[0], !0) === 0), M(o, "endRange", e.selectedDates[1] && E(t, e.selectedDates[1], !0) === 0), n === "nextMonthDay" && o.classList.add("inRange")))) : o.classList.add("flatpickr-disabled"), e.config.mode === "range" && sn(t) && !ce(t) && o.classList.add("inRange"), e.weekNumbers && e.config.showMonths === 1 && n !== "prevMonthDay" && i % 7 === 6 && e.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + e.config.getWeek(t) + "</span>"), h("onDayCreate", o), o;
|
|
194
|
-
}
|
|
195
|
-
function ie(n) {
|
|
196
|
-
n.focus(), e.config.mode === "range" && Q(n);
|
|
197
|
-
}
|
|
198
|
-
function z(n) {
|
|
199
|
-
for (var t = n > 0 ? 0 : e.config.showMonths - 1, a = n > 0 ? e.config.showMonths : -1, i = t; i != a; i += n)
|
|
200
|
-
for (var r = e.daysContainer.children[i], o = n > 0 ? 0 : r.children.length - 1, s = n > 0 ? r.children.length : -1, f = o; f != s; f += n) {
|
|
201
|
-
var d = r.children[f];
|
|
202
|
-
if (d.className.indexOf("hidden") === -1 && O(d.dateObj))
|
|
203
|
-
return d;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
function Be(n, t) {
|
|
207
|
-
for (var a = n.className.indexOf("Month") === -1 ? n.dateObj.getMonth() : e.currentMonth, i = t > 0 ? e.config.showMonths : -1, r = t > 0 ? 1 : -1, o = a - e.currentMonth; o != i; o += r)
|
|
208
|
-
for (var s = e.daysContainer.children[o], f = a - e.currentMonth === o ? n.$i + t : t < 0 ? s.children.length - 1 : 0, d = s.children.length, l = f; l >= 0 && l < d && l != (t > 0 ? d : -1); l += r) {
|
|
209
|
-
var c = s.children[l];
|
|
210
|
-
if (c.className.indexOf("hidden") === -1 && O(c.dateObj) && Math.abs(n.$i - l) >= Math.abs(t))
|
|
211
|
-
return ie(c);
|
|
212
|
-
}
|
|
213
|
-
e.changeMonth(r), L(z(r), 0);
|
|
214
|
-
}
|
|
215
|
-
function L(n, t) {
|
|
216
|
-
var a = C(), i = $(a || document.body), r = n !== void 0 ? n : i ? a : e.selectedDateElem !== void 0 && $(e.selectedDateElem) ? e.selectedDateElem : e.todayDateElem !== void 0 && $(e.todayDateElem) ? e.todayDateElem : z(t > 0 ? 1 : -1);
|
|
217
|
-
r === void 0 ? e._input.focus() : i ? Be(r, t) : ie(r);
|
|
218
|
-
}
|
|
219
|
-
function Ke(n, t) {
|
|
220
|
-
for (var a = (new Date(n, t, 1).getDay() - e.l10n.firstDayOfWeek + 7) % 7, i = e.utils.getDaysInMonth((t - 1 + 12) % 12, n), r = e.utils.getDaysInMonth(t, n), o = window.document.createDocumentFragment(), s = e.config.showMonths > 1, f = s ? "prevMonthDay hidden" : "prevMonthDay", d = s ? "nextMonthDay hidden" : "nextMonthDay", l = i + 1 - a, c = 0; l <= i; l++, c++)
|
|
221
|
-
o.appendChild(V("flatpickr-day " + f, new Date(n, t - 1, l), l, c));
|
|
222
|
-
for (l = 1; l <= r; l++, c++)
|
|
223
|
-
o.appendChild(V("flatpickr-day", new Date(n, t, l), l, c));
|
|
224
|
-
for (var g = r + 1; g <= 42 - a && (e.config.showMonths === 1 || c % 7 !== 0); g++, c++)
|
|
225
|
-
o.appendChild(V("flatpickr-day " + d, new Date(n, t + 1, g % r), g, c));
|
|
226
|
-
var T = p("div", "dayContainer");
|
|
227
|
-
return T.appendChild(o), T;
|
|
228
|
-
}
|
|
229
|
-
function J() {
|
|
230
|
-
if (e.daysContainer !== void 0) {
|
|
231
|
-
ee(e.daysContainer), e.weekNumbers && ee(e.weekNumbers);
|
|
232
|
-
for (var n = document.createDocumentFragment(), t = 0; t < e.config.showMonths; t++) {
|
|
233
|
-
var a = new Date(e.currentYear, e.currentMonth, 1);
|
|
234
|
-
a.setMonth(e.currentMonth + t), n.appendChild(Ke(a.getFullYear(), a.getMonth()));
|
|
235
|
-
}
|
|
236
|
-
e.daysContainer.appendChild(n), e.days = e.daysContainer.firstChild, e.config.mode === "range" && e.selectedDates.length === 1 && Q();
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
function P() {
|
|
240
|
-
if (!(e.config.showMonths > 1 || e.config.monthSelectorType !== "dropdown")) {
|
|
241
|
-
var n = function(i) {
|
|
242
|
-
return e.config.minDate !== void 0 && e.currentYear === e.config.minDate.getFullYear() && i < e.config.minDate.getMonth() ? !1 : !(e.config.maxDate !== void 0 && e.currentYear === e.config.maxDate.getFullYear() && i > e.config.maxDate.getMonth());
|
|
243
|
-
};
|
|
244
|
-
e.monthsDropdownContainer.tabIndex = -1, e.monthsDropdownContainer.innerHTML = "";
|
|
245
|
-
for (var t = 0; t < 12; t++)
|
|
246
|
-
if (n(t)) {
|
|
247
|
-
var a = p("option", "flatpickr-monthDropdown-month");
|
|
248
|
-
a.value = new Date(e.currentYear, t).getMonth().toString(), a.textContent = Ae(t, e.config.shorthandCurrentMonth, e.l10n), a.tabIndex = -1, e.currentMonth === t && (a.selected = !0), e.monthsDropdownContainer.appendChild(a);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
function qe() {
|
|
253
|
-
var n = p("div", "flatpickr-month"), t = window.document.createDocumentFragment(), a;
|
|
254
|
-
e.config.showMonths > 1 || e.config.monthSelectorType === "static" ? a = p("span", "cur-month") : (e.monthsDropdownContainer = p("select", "flatpickr-monthDropdown-months"), e.monthsDropdownContainer.setAttribute("aria-label", e.l10n.monthAriaLabel), m(e.monthsDropdownContainer, "change", function(s) {
|
|
255
|
-
var f = w(s), d = parseInt(f.value, 10);
|
|
256
|
-
e.changeMonth(d - e.currentMonth), h("onMonthChange");
|
|
257
|
-
}), P(), a = e.monthsDropdownContainer);
|
|
258
|
-
var i = ne("cur-year", { tabindex: "-1" }), r = i.getElementsByTagName("input")[0];
|
|
259
|
-
r.setAttribute("aria-label", e.l10n.yearAriaLabel), e.config.minDate && r.setAttribute("min", e.config.minDate.getFullYear().toString()), e.config.maxDate && (r.setAttribute("max", e.config.maxDate.getFullYear().toString()), r.disabled = !!e.config.minDate && e.config.minDate.getFullYear() === e.config.maxDate.getFullYear());
|
|
260
|
-
var o = p("div", "flatpickr-current-month");
|
|
261
|
-
return o.appendChild(a), o.appendChild(i), t.appendChild(o), n.appendChild(t), {
|
|
262
|
-
container: n,
|
|
263
|
-
yearElement: r,
|
|
264
|
-
monthElement: a
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
function Me() {
|
|
268
|
-
ee(e.monthNav), e.monthNav.appendChild(e.prevMonthNav), e.config.showMonths && (e.yearElements = [], e.monthElements = []);
|
|
269
|
-
for (var n = e.config.showMonths; n--; ) {
|
|
270
|
-
var t = qe();
|
|
271
|
-
e.yearElements.push(t.yearElement), e.monthElements.push(t.monthElement), e.monthNav.appendChild(t.container);
|
|
272
|
-
}
|
|
273
|
-
e.monthNav.appendChild(e.nextMonthNav);
|
|
274
|
-
}
|
|
275
|
-
function Ve() {
|
|
276
|
-
return e.monthNav = p("div", "flatpickr-months"), e.yearElements = [], e.monthElements = [], e.prevMonthNav = p("span", "flatpickr-prev-month"), e.prevMonthNav.innerHTML = e.config.prevArrow, e.nextMonthNav = p("span", "flatpickr-next-month"), e.nextMonthNav.innerHTML = e.config.nextArrow, Me(), Object.defineProperty(e, "_hidePrevMonthArrow", {
|
|
277
|
-
get: function() {
|
|
278
|
-
return e.__hidePrevMonthArrow;
|
|
279
|
-
},
|
|
280
|
-
set: function(n) {
|
|
281
|
-
e.__hidePrevMonthArrow !== n && (M(e.prevMonthNav, "flatpickr-disabled", n), e.__hidePrevMonthArrow = n);
|
|
282
|
-
}
|
|
283
|
-
}), Object.defineProperty(e, "_hideNextMonthArrow", {
|
|
284
|
-
get: function() {
|
|
285
|
-
return e.__hideNextMonthArrow;
|
|
286
|
-
},
|
|
287
|
-
set: function(n) {
|
|
288
|
-
e.__hideNextMonthArrow !== n && (M(e.nextMonthNav, "flatpickr-disabled", n), e.__hideNextMonthArrow = n);
|
|
289
|
-
}
|
|
290
|
-
}), e.currentYearElement = e.yearElements[0], Z(), e.monthNav;
|
|
291
|
-
}
|
|
292
|
-
function ze() {
|
|
293
|
-
e.calendarContainer.classList.add("hasTime"), e.config.noCalendar && e.calendarContainer.classList.add("noCalendar");
|
|
294
|
-
var n = pe(e.config);
|
|
295
|
-
e.timeContainer = p("div", "flatpickr-time"), e.timeContainer.tabIndex = -1;
|
|
296
|
-
var t = p("span", "flatpickr-time-separator", ":"), a = ne("flatpickr-hour", {
|
|
297
|
-
"aria-label": e.l10n.hourAriaLabel
|
|
298
|
-
});
|
|
299
|
-
e.hourElement = a.getElementsByTagName("input")[0];
|
|
300
|
-
var i = ne("flatpickr-minute", {
|
|
301
|
-
"aria-label": e.l10n.minuteAriaLabel
|
|
302
|
-
});
|
|
303
|
-
if (e.minuteElement = i.getElementsByTagName("input")[0], e.hourElement.tabIndex = e.minuteElement.tabIndex = -1, e.hourElement.value = N(e.latestSelectedDateObj ? e.latestSelectedDateObj.getHours() : e.config.time_24hr ? n.hours : Le(n.hours)), e.minuteElement.value = N(e.latestSelectedDateObj ? e.latestSelectedDateObj.getMinutes() : n.minutes), e.hourElement.setAttribute("step", e.config.hourIncrement.toString()), e.minuteElement.setAttribute("step", e.config.minuteIncrement.toString()), e.hourElement.setAttribute("min", e.config.time_24hr ? "0" : "1"), e.hourElement.setAttribute("max", e.config.time_24hr ? "23" : "12"), e.hourElement.setAttribute("maxlength", "2"), e.minuteElement.setAttribute("min", "0"), e.minuteElement.setAttribute("max", "59"), e.minuteElement.setAttribute("maxlength", "2"), e.timeContainer.appendChild(a), e.timeContainer.appendChild(t), e.timeContainer.appendChild(i), e.config.time_24hr && e.timeContainer.classList.add("time24hr"), e.config.enableSeconds) {
|
|
304
|
-
e.timeContainer.classList.add("hasSeconds");
|
|
305
|
-
var r = ne("flatpickr-second");
|
|
306
|
-
e.secondElement = r.getElementsByTagName("input")[0], e.secondElement.value = N(e.latestSelectedDateObj ? e.latestSelectedDateObj.getSeconds() : n.seconds), e.secondElement.setAttribute("step", e.minuteElement.getAttribute("step")), e.secondElement.setAttribute("min", "0"), e.secondElement.setAttribute("max", "59"), e.secondElement.setAttribute("maxlength", "2"), e.timeContainer.appendChild(p("span", "flatpickr-time-separator", ":")), e.timeContainer.appendChild(r);
|
|
307
|
-
}
|
|
308
|
-
return e.config.time_24hr || (e.amPM = p("span", "flatpickr-am-pm", e.l10n.amPM[_((e.latestSelectedDateObj ? e.hourElement.value : e.config.defaultHour) > 11)]), e.amPM.title = e.l10n.toggleTitle, e.amPM.tabIndex = -1, e.timeContainer.appendChild(e.amPM)), e.timeContainer;
|
|
309
|
-
}
|
|
310
|
-
function Ce() {
|
|
311
|
-
e.weekdayContainer ? ee(e.weekdayContainer) : e.weekdayContainer = p("div", "flatpickr-weekdays");
|
|
312
|
-
for (var n = e.config.showMonths; n--; ) {
|
|
313
|
-
var t = p("div", "flatpickr-weekdaycontainer");
|
|
314
|
-
e.weekdayContainer.appendChild(t);
|
|
315
|
-
}
|
|
316
|
-
return ye(), e.weekdayContainer;
|
|
317
|
-
}
|
|
318
|
-
function ye() {
|
|
319
|
-
if (e.weekdayContainer) {
|
|
320
|
-
var n = e.l10n.firstDayOfWeek, t = Pe(e.l10n.weekdays.shorthand);
|
|
321
|
-
n > 0 && n < t.length && (t = Pe(t.splice(n, t.length), t.splice(0, n)));
|
|
322
|
-
for (var a = e.config.showMonths; a--; )
|
|
323
|
-
e.weekdayContainer.children[a].innerHTML = `
|
|
324
|
-
<span class='flatpickr-weekday'>
|
|
325
|
-
` + t.join("</span><span class='flatpickr-weekday'>") + `
|
|
326
|
-
</span>
|
|
327
|
-
`;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
function Je() {
|
|
331
|
-
e.calendarContainer.classList.add("hasWeeks");
|
|
332
|
-
var n = p("div", "flatpickr-weekwrapper");
|
|
333
|
-
n.appendChild(p("span", "flatpickr-weekday", e.l10n.weekAbbreviation));
|
|
334
|
-
var t = p("div", "flatpickr-weeks");
|
|
335
|
-
return n.appendChild(t), {
|
|
336
|
-
weekWrapper: n,
|
|
337
|
-
weekNumbers: t
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
function re(n, t) {
|
|
341
|
-
t === void 0 && (t = !0);
|
|
342
|
-
var a = t ? n : n - e.currentMonth;
|
|
343
|
-
a < 0 && e._hidePrevMonthArrow === !0 || a > 0 && e._hideNextMonthArrow === !0 || (e.currentMonth += a, (e.currentMonth < 0 || e.currentMonth > 11) && (e.currentYear += e.currentMonth > 11 ? 1 : -1, e.currentMonth = (e.currentMonth + 12) % 12, h("onYearChange"), P()), J(), h("onMonthChange"), Z());
|
|
344
|
-
}
|
|
345
|
-
function Ue(n, t) {
|
|
346
|
-
if (n === void 0 && (n = !0), t === void 0 && (t = !0), e.input.value = "", e.altInput !== void 0 && (e.altInput.value = ""), e.mobileInput !== void 0 && (e.mobileInput.value = ""), e.selectedDates = [], e.latestSelectedDateObj = void 0, t === !0 && (e.currentYear = e._initialDate.getFullYear(), e.currentMonth = e._initialDate.getMonth()), e.config.enableTime === !0) {
|
|
347
|
-
var a = pe(e.config), i = a.hours, r = a.minutes, o = a.seconds;
|
|
348
|
-
te(i, r, o);
|
|
349
|
-
}
|
|
350
|
-
e.redraw(), n && h("onChange");
|
|
351
|
-
}
|
|
352
|
-
function $e() {
|
|
353
|
-
e.isOpen = !1, e.isMobile || (e.calendarContainer !== void 0 && e.calendarContainer.classList.remove("open"), e._input !== void 0 && e._input.classList.remove("active")), h("onClose");
|
|
354
|
-
}
|
|
355
|
-
function Qe() {
|
|
356
|
-
e.config !== void 0 && h("onDestroy");
|
|
357
|
-
for (var n = e._handlers.length; n--; )
|
|
358
|
-
e._handlers[n].remove();
|
|
359
|
-
if (e._handlers = [], e.mobileInput)
|
|
360
|
-
e.mobileInput.parentNode && e.mobileInput.parentNode.removeChild(e.mobileInput), e.mobileInput = void 0;
|
|
361
|
-
else if (e.calendarContainer && e.calendarContainer.parentNode)
|
|
362
|
-
if (e.config.static && e.calendarContainer.parentNode) {
|
|
363
|
-
var t = e.calendarContainer.parentNode;
|
|
364
|
-
if (t.lastChild && t.removeChild(t.lastChild), t.parentNode) {
|
|
365
|
-
for (; t.firstChild; )
|
|
366
|
-
t.parentNode.insertBefore(t.firstChild, t);
|
|
367
|
-
t.parentNode.removeChild(t);
|
|
368
|
-
}
|
|
369
|
-
} else
|
|
370
|
-
e.calendarContainer.parentNode.removeChild(e.calendarContainer);
|
|
371
|
-
e.altInput && (e.input.type = "text", e.altInput.parentNode && e.altInput.parentNode.removeChild(e.altInput), delete e.altInput), e.input && (e.input.type = e.input._type, e.input.classList.remove("flatpickr-input"), e.input.removeAttribute("readonly")), [
|
|
372
|
-
"_showTimeInput",
|
|
373
|
-
"latestSelectedDateObj",
|
|
374
|
-
"_hideNextMonthArrow",
|
|
375
|
-
"_hidePrevMonthArrow",
|
|
376
|
-
"__hideNextMonthArrow",
|
|
377
|
-
"__hidePrevMonthArrow",
|
|
378
|
-
"isMobile",
|
|
379
|
-
"isOpen",
|
|
380
|
-
"selectedDateElem",
|
|
381
|
-
"minDateHasTime",
|
|
382
|
-
"maxDateHasTime",
|
|
383
|
-
"days",
|
|
384
|
-
"daysContainer",
|
|
385
|
-
"_input",
|
|
386
|
-
"_positionElement",
|
|
387
|
-
"innerContainer",
|
|
388
|
-
"rContainer",
|
|
389
|
-
"monthNav",
|
|
390
|
-
"todayDateElem",
|
|
391
|
-
"calendarContainer",
|
|
392
|
-
"weekdayContainer",
|
|
393
|
-
"prevMonthNav",
|
|
394
|
-
"nextMonthNav",
|
|
395
|
-
"monthsDropdownContainer",
|
|
396
|
-
"currentMonthElement",
|
|
397
|
-
"currentYearElement",
|
|
398
|
-
"navigationCurrentMonth",
|
|
399
|
-
"selectedDateElem",
|
|
400
|
-
"config"
|
|
401
|
-
].forEach(function(a) {
|
|
402
|
-
try {
|
|
403
|
-
delete e[a];
|
|
404
|
-
} catch {
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
function j(n) {
|
|
409
|
-
return e.calendarContainer.contains(n);
|
|
410
|
-
}
|
|
411
|
-
function oe(n) {
|
|
412
|
-
if (e.isOpen && !e.config.inline) {
|
|
413
|
-
var t = w(n), a = j(t), i = t === e.input || t === e.altInput || e.element.contains(t) || n.path && n.path.indexOf && (~n.path.indexOf(e.input) || ~n.path.indexOf(e.altInput)), r = !i && !a && !j(n.relatedTarget), o = !e.config.ignoredFocusElements.some(function(s) {
|
|
414
|
-
return s.contains(t);
|
|
415
|
-
});
|
|
416
|
-
r && o && (e.config.allowInput && e.setDate(e._input.value, !1, e.config.altInput ? e.config.altFormat : e.config.dateFormat), e.timeContainer !== void 0 && e.minuteElement !== void 0 && e.hourElement !== void 0 && e.input.value !== "" && e.input.value !== void 0 && A(), e.close(), e.config && e.config.mode === "range" && e.selectedDates.length === 1 && e.clear(!1));
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
function U(n) {
|
|
420
|
-
if (!(!n || e.config.minDate && n < e.config.minDate.getFullYear() || e.config.maxDate && n > e.config.maxDate.getFullYear())) {
|
|
421
|
-
var t = n, a = e.currentYear !== t;
|
|
422
|
-
e.currentYear = t || e.currentYear, e.config.maxDate && e.currentYear === e.config.maxDate.getFullYear() ? e.currentMonth = Math.min(e.config.maxDate.getMonth(), e.currentMonth) : e.config.minDate && e.currentYear === e.config.minDate.getFullYear() && (e.currentMonth = Math.max(e.config.minDate.getMonth(), e.currentMonth)), a && (e.redraw(), h("onYearChange"), P());
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
function O(n, t) {
|
|
426
|
-
var a;
|
|
427
|
-
t === void 0 && (t = !0);
|
|
428
|
-
var i = e.parseDate(n, void 0, t);
|
|
429
|
-
if (e.config.minDate && i && E(i, e.config.minDate, t !== void 0 ? t : !e.minDateHasTime) < 0 || e.config.maxDate && i && E(i, e.config.maxDate, t !== void 0 ? t : !e.maxDateHasTime) > 0)
|
|
430
|
-
return !1;
|
|
431
|
-
if (!e.config.enable && e.config.disable.length === 0)
|
|
432
|
-
return !0;
|
|
433
|
-
if (i === void 0)
|
|
434
|
-
return !1;
|
|
435
|
-
for (var r = !!e.config.enable, o = (a = e.config.enable) !== null && a !== void 0 ? a : e.config.disable, s = 0, f = void 0; s < o.length; s++) {
|
|
436
|
-
if (f = o[s], typeof f == "function" && f(i))
|
|
437
|
-
return r;
|
|
438
|
-
if (f instanceof Date && i !== void 0 && f.getTime() === i.getTime())
|
|
439
|
-
return r;
|
|
440
|
-
if (typeof f == "string") {
|
|
441
|
-
var d = e.parseDate(f, void 0, !0);
|
|
442
|
-
return d && d.getTime() === i.getTime() ? r : !r;
|
|
443
|
-
} else if (typeof f == "object" && i !== void 0 && f.from && f.to && i.getTime() >= f.from.getTime() && i.getTime() <= f.to.getTime())
|
|
444
|
-
return r;
|
|
445
|
-
}
|
|
446
|
-
return !r;
|
|
447
|
-
}
|
|
448
|
-
function $(n) {
|
|
449
|
-
return e.daysContainer !== void 0 ? n.className.indexOf("hidden") === -1 && n.className.indexOf("flatpickr-disabled") === -1 && e.daysContainer.contains(n) : !1;
|
|
450
|
-
}
|
|
451
|
-
function Xe(n) {
|
|
452
|
-
var t = n.target === e._input, a = e._input.value.trimEnd() !== se();
|
|
453
|
-
t && a && !(n.relatedTarget && j(n.relatedTarget)) && e.setDate(e._input.value, !0, n.target === e.altInput ? e.config.altFormat : e.config.dateFormat);
|
|
454
|
-
}
|
|
455
|
-
function we(n) {
|
|
456
|
-
var t = w(n), a = e.config.wrap ? u.contains(t) : t === e._input, i = e.config.allowInput, r = e.isOpen && (!i || !a), o = e.config.inline && a && !i;
|
|
457
|
-
if (n.keyCode === 13 && a) {
|
|
458
|
-
if (i)
|
|
459
|
-
return e.setDate(e._input.value, !0, t === e.altInput ? e.config.altFormat : e.config.dateFormat), e.close(), t.blur();
|
|
460
|
-
e.open();
|
|
461
|
-
} else if (j(t) || r || o) {
|
|
462
|
-
var s = !!e.timeContainer && e.timeContainer.contains(t);
|
|
463
|
-
switch (n.keyCode) {
|
|
464
|
-
case 13:
|
|
465
|
-
s ? (n.preventDefault(), A(), le()) : Te(n);
|
|
466
|
-
break;
|
|
467
|
-
case 27:
|
|
468
|
-
n.preventDefault(), le();
|
|
469
|
-
break;
|
|
470
|
-
case 8:
|
|
471
|
-
case 46:
|
|
472
|
-
a && !e.config.allowInput && (n.preventDefault(), e.clear());
|
|
473
|
-
break;
|
|
474
|
-
case 37:
|
|
475
|
-
case 39:
|
|
476
|
-
if (!s && !a) {
|
|
477
|
-
n.preventDefault();
|
|
478
|
-
var f = C();
|
|
479
|
-
if (e.daysContainer !== void 0 && (i === !1 || f && $(f))) {
|
|
480
|
-
var d = n.keyCode === 39 ? 1 : -1;
|
|
481
|
-
n.ctrlKey ? (n.stopPropagation(), re(d), L(z(1), 0)) : L(void 0, d);
|
|
482
|
-
}
|
|
483
|
-
} else
|
|
484
|
-
e.hourElement && e.hourElement.focus();
|
|
485
|
-
break;
|
|
486
|
-
case 38:
|
|
487
|
-
case 40:
|
|
488
|
-
n.preventDefault();
|
|
489
|
-
var l = n.keyCode === 40 ? 1 : -1;
|
|
490
|
-
e.daysContainer && t.$i !== void 0 || t === e.input || t === e.altInput ? n.ctrlKey ? (n.stopPropagation(), U(e.currentYear - l), L(z(1), 0)) : s || L(void 0, l * 7) : t === e.currentYearElement ? U(e.currentYear - l) : e.config.enableTime && (!s && e.hourElement && e.hourElement.focus(), A(n), e._debouncedChange());
|
|
491
|
-
break;
|
|
492
|
-
case 9:
|
|
493
|
-
if (s) {
|
|
494
|
-
var c = [
|
|
495
|
-
e.hourElement,
|
|
496
|
-
e.minuteElement,
|
|
497
|
-
e.secondElement,
|
|
498
|
-
e.amPM
|
|
499
|
-
].concat(e.pluginElements).filter(function(y) {
|
|
500
|
-
return y;
|
|
501
|
-
}), g = c.indexOf(t);
|
|
502
|
-
if (g !== -1) {
|
|
503
|
-
var T = c[g + (n.shiftKey ? -1 : 1)];
|
|
504
|
-
n.preventDefault(), (T || e._input).focus();
|
|
505
|
-
}
|
|
506
|
-
} else
|
|
507
|
-
!e.config.noCalendar && e.daysContainer && e.daysContainer.contains(t) && n.shiftKey && (n.preventDefault(), e._input.focus());
|
|
508
|
-
break;
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
if (e.amPM !== void 0 && t === e.amPM)
|
|
512
|
-
switch (n.key) {
|
|
513
|
-
case e.l10n.amPM[0].charAt(0):
|
|
514
|
-
case e.l10n.amPM[0].charAt(0).toLowerCase():
|
|
515
|
-
e.amPM.textContent = e.l10n.amPM[0], B(), S();
|
|
516
|
-
break;
|
|
517
|
-
case e.l10n.amPM[1].charAt(0):
|
|
518
|
-
case e.l10n.amPM[1].charAt(0).toLowerCase():
|
|
519
|
-
e.amPM.textContent = e.l10n.amPM[1], B(), S();
|
|
520
|
-
break;
|
|
521
|
-
}
|
|
522
|
-
(a || j(t)) && h("onKeyDown", n);
|
|
523
|
-
}
|
|
524
|
-
function Q(n, t) {
|
|
525
|
-
if (t === void 0 && (t = "flatpickr-day"), !(e.selectedDates.length !== 1 || n && (!n.classList.contains(t) || n.classList.contains("flatpickr-disabled")))) {
|
|
526
|
-
for (var a = n ? n.dateObj.getTime() : e.days.firstElementChild.dateObj.getTime(), i = e.parseDate(e.selectedDates[0], void 0, !0).getTime(), r = Math.min(a, e.selectedDates[0].getTime()), o = Math.max(a, e.selectedDates[0].getTime()), s = !1, f = 0, d = 0, l = r; l < o; l += wn.DAY)
|
|
527
|
-
O(new Date(l), !0) || (s = s || l > r && l < o, l < i && (!f || l > f) ? f = l : l > i && (!d || l < d) && (d = l));
|
|
528
|
-
var c = Array.from(e.rContainer.querySelectorAll("*:nth-child(-n+" + e.config.showMonths + ") > ." + t));
|
|
529
|
-
c.forEach(function(g) {
|
|
530
|
-
var T = g.dateObj, y = T.getTime(), H = f > 0 && y < f || d > 0 && y > d;
|
|
531
|
-
if (H) {
|
|
532
|
-
g.classList.add("notAllowed"), ["inRange", "startRange", "endRange"].forEach(function(Y) {
|
|
533
|
-
g.classList.remove(Y);
|
|
534
|
-
});
|
|
535
|
-
return;
|
|
536
|
-
} else if (s && !H)
|
|
537
|
-
return;
|
|
538
|
-
["startRange", "inRange", "endRange", "notAllowed"].forEach(function(Y) {
|
|
539
|
-
g.classList.remove(Y);
|
|
540
|
-
}), n !== void 0 && (n.classList.add(a <= e.selectedDates[0].getTime() ? "startRange" : "endRange"), i < a && y === i ? g.classList.add("startRange") : i > a && y === i && g.classList.add("endRange"), y >= f && (d === 0 || y <= d) && En(y, i, a) && g.classList.add("inRange"));
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
function Ge() {
|
|
545
|
-
e.isOpen && !e.config.static && !e.config.inline && X();
|
|
546
|
-
}
|
|
547
|
-
function Ze(n, t) {
|
|
548
|
-
if (t === void 0 && (t = e._positionElement), e.isMobile === !0) {
|
|
549
|
-
if (n) {
|
|
550
|
-
n.preventDefault();
|
|
551
|
-
var a = w(n);
|
|
552
|
-
a && a.blur();
|
|
553
|
-
}
|
|
554
|
-
e.mobileInput !== void 0 && (e.mobileInput.focus(), e.mobileInput.click()), h("onOpen");
|
|
555
|
-
return;
|
|
556
|
-
} else if (e._input.disabled || e.config.inline)
|
|
557
|
-
return;
|
|
558
|
-
var i = e.isOpen;
|
|
559
|
-
e.isOpen = !0, i || (e.calendarContainer.classList.add("open"), e._input.classList.add("active"), h("onOpen"), X(t)), e.config.enableTime === !0 && e.config.noCalendar === !0 && e.config.allowInput === !1 && (n === void 0 || !e.timeContainer.contains(n.relatedTarget)) && setTimeout(function() {
|
|
560
|
-
return e.hourElement.select();
|
|
561
|
-
}, 50);
|
|
562
|
-
}
|
|
563
|
-
function Ee(n) {
|
|
564
|
-
return function(t) {
|
|
565
|
-
var a = e.config["_" + n + "Date"] = e.parseDate(t, e.config.dateFormat), i = e.config["_" + (n === "min" ? "max" : "min") + "Date"];
|
|
566
|
-
a !== void 0 && (e[n === "min" ? "minDateHasTime" : "maxDateHasTime"] = a.getHours() > 0 || a.getMinutes() > 0 || a.getSeconds() > 0), e.selectedDates && (e.selectedDates = e.selectedDates.filter(function(r) {
|
|
567
|
-
return O(r);
|
|
568
|
-
}), !e.selectedDates.length && n === "min" && K(a), S()), e.daysContainer && (Ie(), a !== void 0 ? e.currentYearElement[n] = a.getFullYear().toString() : e.currentYearElement.removeAttribute(n), e.currentYearElement.disabled = !!i && a !== void 0 && i.getFullYear() === a.getFullYear());
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
function en() {
|
|
572
|
-
var n = [
|
|
573
|
-
"wrap",
|
|
574
|
-
"weekNumbers",
|
|
575
|
-
"allowInput",
|
|
576
|
-
"allowInvalidPreload",
|
|
577
|
-
"clickOpens",
|
|
578
|
-
"time_24hr",
|
|
579
|
-
"enableTime",
|
|
580
|
-
"noCalendar",
|
|
581
|
-
"altInput",
|
|
582
|
-
"shorthandCurrentMonth",
|
|
583
|
-
"inline",
|
|
584
|
-
"static",
|
|
585
|
-
"enableSeconds",
|
|
586
|
-
"disableMobile"
|
|
587
|
-
], t = b(b({}, JSON.parse(JSON.stringify(u.dataset || {}))), v), a = {};
|
|
588
|
-
e.config.parseDate = t.parseDate, e.config.formatDate = t.formatDate, Object.defineProperty(e.config, "enable", {
|
|
589
|
-
get: function() {
|
|
590
|
-
return e.config._enable;
|
|
591
|
-
},
|
|
592
|
-
set: function(c) {
|
|
593
|
-
e.config._enable = Se(c);
|
|
594
|
-
}
|
|
595
|
-
}), Object.defineProperty(e.config, "disable", {
|
|
596
|
-
get: function() {
|
|
597
|
-
return e.config._disable;
|
|
598
|
-
},
|
|
599
|
-
set: function(c) {
|
|
600
|
-
e.config._disable = Se(c);
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
var i = t.mode === "time";
|
|
604
|
-
if (!t.dateFormat && (t.enableTime || i)) {
|
|
605
|
-
var r = D.defaultConfig.dateFormat || ue.dateFormat;
|
|
606
|
-
a.dateFormat = t.noCalendar || i ? "H:i" + (t.enableSeconds ? ":S" : "") : r + " H:i" + (t.enableSeconds ? ":S" : "");
|
|
607
|
-
}
|
|
608
|
-
if (t.altInput && (t.enableTime || i) && !t.altFormat) {
|
|
609
|
-
var o = D.defaultConfig.altFormat || ue.altFormat;
|
|
610
|
-
a.altFormat = t.noCalendar || i ? "h:i" + (t.enableSeconds ? ":S K" : " K") : o + (" h:i" + (t.enableSeconds ? ":S" : "") + " K");
|
|
611
|
-
}
|
|
612
|
-
Object.defineProperty(e.config, "minDate", {
|
|
613
|
-
get: function() {
|
|
614
|
-
return e.config._minDate;
|
|
615
|
-
},
|
|
616
|
-
set: Ee("min")
|
|
617
|
-
}), Object.defineProperty(e.config, "maxDate", {
|
|
618
|
-
get: function() {
|
|
619
|
-
return e.config._maxDate;
|
|
620
|
-
},
|
|
621
|
-
set: Ee("max")
|
|
622
|
-
});
|
|
623
|
-
var s = function(c) {
|
|
624
|
-
return function(g) {
|
|
625
|
-
e.config[c === "min" ? "_minTime" : "_maxTime"] = e.parseDate(g, "H:i:S");
|
|
626
|
-
};
|
|
627
|
-
};
|
|
628
|
-
Object.defineProperty(e.config, "minTime", {
|
|
629
|
-
get: function() {
|
|
630
|
-
return e.config._minTime;
|
|
631
|
-
},
|
|
632
|
-
set: s("min")
|
|
633
|
-
}), Object.defineProperty(e.config, "maxTime", {
|
|
634
|
-
get: function() {
|
|
635
|
-
return e.config._maxTime;
|
|
636
|
-
},
|
|
637
|
-
set: s("max")
|
|
638
|
-
}), t.mode === "time" && (e.config.noCalendar = !0, e.config.enableTime = !0), Object.assign(e.config, a, t);
|
|
639
|
-
for (var f = 0; f < n.length; f++)
|
|
640
|
-
e.config[n[f]] = e.config[n[f]] === !0 || e.config[n[f]] === "true";
|
|
641
|
-
me.filter(function(c) {
|
|
642
|
-
return e.config[c] !== void 0;
|
|
643
|
-
}).forEach(function(c) {
|
|
644
|
-
e.config[c] = ge(e.config[c] || []).map(I);
|
|
645
|
-
}), e.isMobile = !e.config.disableMobile && !e.config.inline && e.config.mode === "single" && !e.config.disable.length && !e.config.enable && !e.config.weekNumbers && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
646
|
-
for (var f = 0; f < e.config.plugins.length; f++) {
|
|
647
|
-
var d = e.config.plugins[f](e) || {};
|
|
648
|
-
for (var l in d)
|
|
649
|
-
me.indexOf(l) > -1 ? e.config[l] = ge(d[l]).map(I).concat(e.config[l]) : typeof t[l] > "u" && (e.config[l] = d[l]);
|
|
650
|
-
}
|
|
651
|
-
t.altInputClass || (e.config.altInputClass = xe().className + " " + e.config.altInputClass), h("onParseConfig");
|
|
652
|
-
}
|
|
653
|
-
function xe() {
|
|
654
|
-
return e.config.wrap ? u.querySelector("[data-input]") : u;
|
|
655
|
-
}
|
|
656
|
-
function ke() {
|
|
657
|
-
typeof e.config.locale != "object" && typeof D.l10ns[e.config.locale] > "u" && e.config.errorHandler(new Error("flatpickr: invalid locale " + e.config.locale)), e.l10n = b(b({}, D.l10ns.default), typeof e.config.locale == "object" ? e.config.locale : e.config.locale !== "default" ? D.l10ns[e.config.locale] : void 0), R.D = "(" + e.l10n.weekdays.shorthand.join("|") + ")", R.l = "(" + e.l10n.weekdays.longhand.join("|") + ")", R.M = "(" + e.l10n.months.shorthand.join("|") + ")", R.F = "(" + e.l10n.months.longhand.join("|") + ")", R.K = "(" + e.l10n.amPM[0] + "|" + e.l10n.amPM[1] + "|" + e.l10n.amPM[0].toLowerCase() + "|" + e.l10n.amPM[1].toLowerCase() + ")";
|
|
658
|
-
var n = b(b({}, v), JSON.parse(JSON.stringify(u.dataset || {})));
|
|
659
|
-
n.time_24hr === void 0 && D.defaultConfig.time_24hr === void 0 && (e.config.time_24hr = e.l10n.time_24hr), e.formatDate = Ye(e), e.parseDate = De({ config: e.config, l10n: e.l10n });
|
|
660
|
-
}
|
|
661
|
-
function X(n) {
|
|
662
|
-
if (typeof e.config.position == "function")
|
|
663
|
-
return void e.config.position(e, n);
|
|
664
|
-
if (e.calendarContainer !== void 0) {
|
|
665
|
-
h("onPreCalendarPosition");
|
|
666
|
-
var t = n || e._positionElement, a = Array.prototype.reduce.call(e.calendarContainer.children, function(Mn, Cn) {
|
|
667
|
-
return Mn + Cn.offsetHeight;
|
|
668
|
-
}, 0), i = e.calendarContainer.offsetWidth, r = e.config.position.split(" "), o = r[0], s = r.length > 1 ? r[1] : null, f = t.getBoundingClientRect(), d = window.innerHeight - f.bottom, l = o === "above" || o !== "below" && d < a && f.top > a, c = window.pageYOffset + f.top + (l ? -a - 2 : t.offsetHeight + 2);
|
|
669
|
-
if (M(e.calendarContainer, "arrowTop", !l), M(e.calendarContainer, "arrowBottom", l), !e.config.inline) {
|
|
670
|
-
var g = window.pageXOffset + f.left, T = !1, y = !1;
|
|
671
|
-
s === "center" ? (g -= (i - f.width) / 2, T = !0) : s === "right" && (g -= i - f.width, y = !0), M(e.calendarContainer, "arrowLeft", !T && !y), M(e.calendarContainer, "arrowCenter", T), M(e.calendarContainer, "arrowRight", y);
|
|
672
|
-
var H = window.document.body.offsetWidth - (window.pageXOffset + f.right), Y = g + i > window.document.body.offsetWidth, mn = H + i > window.document.body.offsetWidth;
|
|
673
|
-
if (M(e.calendarContainer, "rightMost", Y), !e.config.static)
|
|
674
|
-
if (e.calendarContainer.style.top = c + "px", !Y)
|
|
675
|
-
e.calendarContainer.style.left = g + "px", e.calendarContainer.style.right = "auto";
|
|
676
|
-
else if (!mn)
|
|
677
|
-
e.calendarContainer.style.left = "auto", e.calendarContainer.style.right = H + "px";
|
|
678
|
-
else {
|
|
679
|
-
var de = nn();
|
|
680
|
-
if (de === void 0)
|
|
681
|
-
return;
|
|
682
|
-
var gn = window.document.body.offsetWidth, pn = Math.max(0, gn / 2 - i / 2), hn = ".flatpickr-calendar.centerMost:before", vn = ".flatpickr-calendar.centerMost:after", Dn = de.cssRules.length, bn = "{left:" + f.left + "px;right:auto;}";
|
|
683
|
-
M(e.calendarContainer, "rightMost", !1), M(e.calendarContainer, "centerMost", !0), de.insertRule(hn + "," + vn + bn, Dn), e.calendarContainer.style.left = pn + "px", e.calendarContainer.style.right = "auto";
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
function nn() {
|
|
689
|
-
for (var n = null, t = 0; t < document.styleSheets.length; t++) {
|
|
690
|
-
var a = document.styleSheets[t];
|
|
691
|
-
if (a.cssRules) {
|
|
692
|
-
try {
|
|
693
|
-
a.cssRules;
|
|
694
|
-
} catch {
|
|
695
|
-
continue;
|
|
696
|
-
}
|
|
697
|
-
n = a;
|
|
698
|
-
break;
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
return n ?? tn();
|
|
702
|
-
}
|
|
703
|
-
function tn() {
|
|
704
|
-
var n = document.createElement("style");
|
|
705
|
-
return document.head.appendChild(n), n.sheet;
|
|
706
|
-
}
|
|
707
|
-
function Ie() {
|
|
708
|
-
e.config.noCalendar || e.isMobile || (P(), Z(), J());
|
|
709
|
-
}
|
|
710
|
-
function le() {
|
|
711
|
-
e._input.focus(), window.navigator.userAgent.indexOf("MSIE") !== -1 || navigator.msMaxTouchPoints !== void 0 ? setTimeout(e.close, 0) : e.close();
|
|
712
|
-
}
|
|
713
|
-
function Te(n) {
|
|
714
|
-
n.preventDefault(), n.stopPropagation();
|
|
715
|
-
var t = function(c) {
|
|
716
|
-
return c.classList && c.classList.contains("flatpickr-day") && !c.classList.contains("flatpickr-disabled") && !c.classList.contains("notAllowed");
|
|
717
|
-
}, a = yn(w(n), t);
|
|
718
|
-
if (a !== void 0) {
|
|
719
|
-
var i = a, r = e.latestSelectedDateObj = new Date(i.dateObj.getTime()), o = (r.getMonth() < e.currentMonth || r.getMonth() > e.currentMonth + e.config.showMonths - 1) && e.config.mode !== "range";
|
|
720
|
-
if (e.selectedDateElem = i, e.config.mode === "single")
|
|
721
|
-
e.selectedDates = [r];
|
|
722
|
-
else if (e.config.mode === "multiple") {
|
|
723
|
-
var s = ce(r);
|
|
724
|
-
s ? e.selectedDates.splice(parseInt(s), 1) : e.selectedDates.push(r);
|
|
725
|
-
} else
|
|
726
|
-
e.config.mode === "range" && (e.selectedDates.length === 2 && e.clear(!1, !1), e.latestSelectedDateObj = r, e.selectedDates.push(r), E(r, e.selectedDates[0], !0) !== 0 && e.selectedDates.sort(function(c, g) {
|
|
727
|
-
return c.getTime() - g.getTime();
|
|
728
|
-
}));
|
|
729
|
-
if (B(), o) {
|
|
730
|
-
var f = e.currentYear !== r.getFullYear();
|
|
731
|
-
e.currentYear = r.getFullYear(), e.currentMonth = r.getMonth(), f && (h("onYearChange"), P()), h("onMonthChange");
|
|
732
|
-
}
|
|
733
|
-
if (Z(), J(), S(), !o && e.config.mode !== "range" && e.config.showMonths === 1 ? ie(i) : e.selectedDateElem !== void 0 && e.hourElement === void 0 && e.selectedDateElem && e.selectedDateElem.focus(), e.hourElement !== void 0 && e.hourElement !== void 0 && e.hourElement.focus(), e.config.closeOnSelect) {
|
|
734
|
-
var d = e.config.mode === "single" && !e.config.enableTime, l = e.config.mode === "range" && e.selectedDates.length === 2 && !e.config.enableTime;
|
|
735
|
-
(d || l) && le();
|
|
736
|
-
}
|
|
737
|
-
be();
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
var G = {
|
|
741
|
-
locale: [ke, ye],
|
|
742
|
-
showMonths: [Me, W, Ce],
|
|
743
|
-
minDate: [q],
|
|
744
|
-
maxDate: [q],
|
|
745
|
-
positionElement: [Oe],
|
|
746
|
-
clickOpens: [
|
|
747
|
-
function() {
|
|
748
|
-
e.config.clickOpens === !0 ? (m(e._input, "focus", e.open), m(e._input, "click", e.open)) : (e._input.removeEventListener("focus", e.open), e._input.removeEventListener("click", e.open));
|
|
749
|
-
}
|
|
750
|
-
]
|
|
751
|
-
};
|
|
752
|
-
function an(n, t) {
|
|
753
|
-
if (n !== null && typeof n == "object") {
|
|
754
|
-
Object.assign(e.config, n);
|
|
755
|
-
for (var a in n)
|
|
756
|
-
G[a] !== void 0 && G[a].forEach(function(i) {
|
|
757
|
-
return i();
|
|
758
|
-
});
|
|
759
|
-
} else
|
|
760
|
-
e.config[n] = t, G[n] !== void 0 ? G[n].forEach(function(i) {
|
|
761
|
-
return i();
|
|
762
|
-
}) : me.indexOf(n) > -1 && (e.config[n] = ge(t));
|
|
763
|
-
e.redraw(), S(!0);
|
|
764
|
-
}
|
|
765
|
-
function _e(n, t) {
|
|
766
|
-
var a = [];
|
|
767
|
-
if (n instanceof Array)
|
|
768
|
-
a = n.map(function(i) {
|
|
769
|
-
return e.parseDate(i, t);
|
|
770
|
-
});
|
|
771
|
-
else if (n instanceof Date || typeof n == "number")
|
|
772
|
-
a = [e.parseDate(n, t)];
|
|
773
|
-
else if (typeof n == "string")
|
|
774
|
-
switch (e.config.mode) {
|
|
775
|
-
case "single":
|
|
776
|
-
case "time":
|
|
777
|
-
a = [e.parseDate(n, t)];
|
|
778
|
-
break;
|
|
779
|
-
case "multiple":
|
|
780
|
-
a = n.split(e.config.conjunction).map(function(i) {
|
|
781
|
-
return e.parseDate(i, t);
|
|
782
|
-
});
|
|
783
|
-
break;
|
|
784
|
-
case "range":
|
|
785
|
-
a = n.split(e.l10n.rangeSeparator).map(function(i) {
|
|
786
|
-
return e.parseDate(i, t);
|
|
787
|
-
});
|
|
788
|
-
break;
|
|
789
|
-
}
|
|
790
|
-
else
|
|
791
|
-
e.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(n)));
|
|
792
|
-
e.selectedDates = e.config.allowInvalidPreload ? a : a.filter(function(i) {
|
|
793
|
-
return i instanceof Date && O(i, !1);
|
|
794
|
-
}), e.config.mode === "range" && e.selectedDates.sort(function(i, r) {
|
|
795
|
-
return i.getTime() - r.getTime();
|
|
796
|
-
});
|
|
797
|
-
}
|
|
798
|
-
function rn(n, t, a) {
|
|
799
|
-
if (t === void 0 && (t = !1), a === void 0 && (a = e.config.dateFormat), n !== 0 && !n || n instanceof Array && n.length === 0)
|
|
800
|
-
return e.clear(t);
|
|
801
|
-
_e(n, a), e.latestSelectedDateObj = e.selectedDates[e.selectedDates.length - 1], e.redraw(), q(void 0, t), K(), e.selectedDates.length === 0 && e.clear(!1), S(t), t && h("onChange");
|
|
802
|
-
}
|
|
803
|
-
function Se(n) {
|
|
804
|
-
return n.slice().map(function(t) {
|
|
805
|
-
return typeof t == "string" || typeof t == "number" || t instanceof Date ? e.parseDate(t, void 0, !0) : t && typeof t == "object" && t.from && t.to ? {
|
|
806
|
-
from: e.parseDate(t.from, void 0),
|
|
807
|
-
to: e.parseDate(t.to, void 0)
|
|
808
|
-
} : t;
|
|
809
|
-
}).filter(function(t) {
|
|
810
|
-
return t;
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
function on() {
|
|
814
|
-
e.selectedDates = [], e.now = e.parseDate(e.config.now) || /* @__PURE__ */ new Date();
|
|
815
|
-
var n = e.config.defaultDate || ((e.input.nodeName === "INPUT" || e.input.nodeName === "TEXTAREA") && e.input.placeholder && e.input.value === e.input.placeholder ? null : e.input.value);
|
|
816
|
-
n && _e(n, e.config.dateFormat), e._initialDate = e.selectedDates.length > 0 ? e.selectedDates[0] : e.config.minDate && e.config.minDate.getTime() > e.now.getTime() ? e.config.minDate : e.config.maxDate && e.config.maxDate.getTime() < e.now.getTime() ? e.config.maxDate : e.now, e.currentYear = e._initialDate.getFullYear(), e.currentMonth = e._initialDate.getMonth(), e.selectedDates.length > 0 && (e.latestSelectedDateObj = e.selectedDates[0]), e.config.minTime !== void 0 && (e.config.minTime = e.parseDate(e.config.minTime, "H:i")), e.config.maxTime !== void 0 && (e.config.maxTime = e.parseDate(e.config.maxTime, "H:i")), e.minDateHasTime = !!e.config.minDate && (e.config.minDate.getHours() > 0 || e.config.minDate.getMinutes() > 0 || e.config.minDate.getSeconds() > 0), e.maxDateHasTime = !!e.config.maxDate && (e.config.maxDate.getHours() > 0 || e.config.maxDate.getMinutes() > 0 || e.config.maxDate.getSeconds() > 0);
|
|
817
|
-
}
|
|
818
|
-
function ln() {
|
|
819
|
-
if (e.input = xe(), !e.input) {
|
|
820
|
-
e.config.errorHandler(new Error("Invalid input element specified"));
|
|
821
|
-
return;
|
|
822
|
-
}
|
|
823
|
-
e.input._type = e.input.type, e.input.type = "text", e.input.classList.add("flatpickr-input"), e._input = e.input, e.config.altInput && (e.altInput = p(e.input.nodeName, e.config.altInputClass), e._input = e.altInput, e.altInput.placeholder = e.input.placeholder, e.altInput.disabled = e.input.disabled, e.altInput.required = e.input.required, e.altInput.tabIndex = e.input.tabIndex, e.altInput.type = "text", e.input.setAttribute("type", "hidden"), !e.config.static && e.input.parentNode && e.input.parentNode.insertBefore(e.altInput, e.input.nextSibling)), e.config.allowInput || e._input.setAttribute("readonly", "readonly"), Oe();
|
|
824
|
-
}
|
|
825
|
-
function Oe() {
|
|
826
|
-
e._positionElement = e.config.positionElement || e._input;
|
|
827
|
-
}
|
|
828
|
-
function fn() {
|
|
829
|
-
var n = e.config.enableTime ? e.config.noCalendar ? "time" : "datetime-local" : "date";
|
|
830
|
-
e.mobileInput = p("input", e.input.className + " flatpickr-mobile"), e.mobileInput.tabIndex = 1, e.mobileInput.type = n, e.mobileInput.disabled = e.input.disabled, e.mobileInput.required = e.input.required, e.mobileInput.placeholder = e.input.placeholder, e.mobileFormatStr = n === "datetime-local" ? "Y-m-d\\TH:i:S" : n === "date" ? "Y-m-d" : "H:i:S", e.selectedDates.length > 0 && (e.mobileInput.defaultValue = e.mobileInput.value = e.formatDate(e.selectedDates[0], e.mobileFormatStr)), e.config.minDate && (e.mobileInput.min = e.formatDate(e.config.minDate, "Y-m-d")), e.config.maxDate && (e.mobileInput.max = e.formatDate(e.config.maxDate, "Y-m-d")), e.input.getAttribute("step") && (e.mobileInput.step = String(e.input.getAttribute("step"))), e.input.type = "hidden", e.altInput !== void 0 && (e.altInput.type = "hidden");
|
|
831
|
-
try {
|
|
832
|
-
e.input.parentNode && e.input.parentNode.insertBefore(e.mobileInput, e.input.nextSibling);
|
|
833
|
-
} catch {
|
|
834
|
-
}
|
|
835
|
-
m(e.mobileInput, "change", function(t) {
|
|
836
|
-
e.setDate(w(t).value, !1, e.mobileFormatStr), h("onChange"), h("onClose");
|
|
837
|
-
});
|
|
838
|
-
}
|
|
839
|
-
function cn(n) {
|
|
840
|
-
if (e.isOpen === !0)
|
|
841
|
-
return e.close();
|
|
842
|
-
e.open(n);
|
|
843
|
-
}
|
|
844
|
-
function h(n, t) {
|
|
845
|
-
if (e.config !== void 0) {
|
|
846
|
-
var a = e.config[n];
|
|
847
|
-
if (a !== void 0 && a.length > 0)
|
|
848
|
-
for (var i = 0; a[i] && i < a.length; i++)
|
|
849
|
-
a[i](e.selectedDates, e.input.value, e, t);
|
|
850
|
-
n === "onChange" && (e.input.dispatchEvent(fe("change")), e.input.dispatchEvent(fe("input")));
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
function fe(n) {
|
|
854
|
-
var t = document.createEvent("Event");
|
|
855
|
-
return t.initEvent(n, !0, !0), t;
|
|
856
|
-
}
|
|
857
|
-
function ce(n) {
|
|
858
|
-
for (var t = 0; t < e.selectedDates.length; t++) {
|
|
859
|
-
var a = e.selectedDates[t];
|
|
860
|
-
if (a instanceof Date && E(a, n) === 0)
|
|
861
|
-
return "" + t;
|
|
862
|
-
}
|
|
863
|
-
return !1;
|
|
864
|
-
}
|
|
865
|
-
function sn(n) {
|
|
866
|
-
return e.config.mode !== "range" || e.selectedDates.length < 2 ? !1 : E(n, e.selectedDates[0]) >= 0 && E(n, e.selectedDates[1]) <= 0;
|
|
867
|
-
}
|
|
868
|
-
function Z() {
|
|
869
|
-
e.config.noCalendar || e.isMobile || !e.monthNav || (e.yearElements.forEach(function(n, t) {
|
|
870
|
-
var a = new Date(e.currentYear, e.currentMonth, 1);
|
|
871
|
-
a.setMonth(e.currentMonth + t), e.config.showMonths > 1 || e.config.monthSelectorType === "static" ? e.monthElements[t].textContent = Ae(a.getMonth(), e.config.shorthandCurrentMonth, e.l10n) + " " : e.monthsDropdownContainer.value = a.getMonth().toString(), n.value = a.getFullYear().toString();
|
|
872
|
-
}), e._hidePrevMonthArrow = e.config.minDate !== void 0 && (e.currentYear === e.config.minDate.getFullYear() ? e.currentMonth <= e.config.minDate.getMonth() : e.currentYear < e.config.minDate.getFullYear()), e._hideNextMonthArrow = e.config.maxDate !== void 0 && (e.currentYear === e.config.maxDate.getFullYear() ? e.currentMonth + 1 > e.config.maxDate.getMonth() : e.currentYear > e.config.maxDate.getFullYear()));
|
|
873
|
-
}
|
|
874
|
-
function se(n) {
|
|
875
|
-
var t = n || (e.config.altInput ? e.config.altFormat : e.config.dateFormat);
|
|
876
|
-
return e.selectedDates.map(function(a) {
|
|
877
|
-
return e.formatDate(a, t);
|
|
878
|
-
}).filter(function(a, i, r) {
|
|
879
|
-
return e.config.mode !== "range" || e.config.enableTime || r.indexOf(a) === i;
|
|
880
|
-
}).join(e.config.mode !== "range" ? e.config.conjunction : e.l10n.rangeSeparator);
|
|
881
|
-
}
|
|
882
|
-
function S(n) {
|
|
883
|
-
n === void 0 && (n = !0), e.mobileInput !== void 0 && e.mobileFormatStr && (e.mobileInput.value = e.latestSelectedDateObj !== void 0 ? e.formatDate(e.latestSelectedDateObj, e.mobileFormatStr) : ""), e.input.value = se(e.config.dateFormat), e.altInput !== void 0 && (e.altInput.value = se(e.config.altFormat)), n !== !1 && h("onValueUpdate");
|
|
884
|
-
}
|
|
885
|
-
function dn(n) {
|
|
886
|
-
var t = w(n), a = e.prevMonthNav.contains(t), i = e.nextMonthNav.contains(t);
|
|
887
|
-
a || i ? re(a ? -1 : 1) : e.yearElements.indexOf(t) >= 0 ? t.select() : t.classList.contains("arrowUp") ? e.changeYear(e.currentYear + 1) : t.classList.contains("arrowDown") && e.changeYear(e.currentYear - 1);
|
|
888
|
-
}
|
|
889
|
-
function un(n) {
|
|
890
|
-
n.preventDefault();
|
|
891
|
-
var t = n.type === "keydown", a = w(n), i = a;
|
|
892
|
-
e.amPM !== void 0 && a === e.amPM && (e.amPM.textContent = e.l10n.amPM[_(e.amPM.textContent === e.l10n.amPM[0])]);
|
|
893
|
-
var r = parseFloat(i.getAttribute("min")), o = parseFloat(i.getAttribute("max")), s = parseFloat(i.getAttribute("step")), f = parseInt(i.value, 10), d = n.delta || (t ? n.which === 38 ? 1 : -1 : 0), l = f + s * d;
|
|
894
|
-
if (typeof i.value < "u" && i.value.length === 2) {
|
|
895
|
-
var c = i === e.hourElement, g = i === e.minuteElement;
|
|
896
|
-
l < r ? (l = o + l + _(!c) + (_(c) && _(!e.amPM)), g && ae(void 0, -1, e.hourElement)) : l > o && (l = i === e.hourElement ? l - o - _(!e.amPM) : r, g && ae(void 0, 1, e.hourElement)), e.amPM && c && (s === 1 ? l + f === 23 : Math.abs(l - f) > s) && (e.amPM.textContent = e.l10n.amPM[_(e.amPM.textContent === e.l10n.amPM[0])]), i.value = N(l);
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
return x(), e;
|
|
900
|
-
}
|
|
901
|
-
function F(u, v) {
|
|
902
|
-
for (var e = Array.prototype.slice.call(u).filter(function(I) {
|
|
903
|
-
return I instanceof HTMLElement;
|
|
904
|
-
}), k = [], x = 0; x < e.length; x++) {
|
|
905
|
-
var C = e[x];
|
|
906
|
-
try {
|
|
907
|
-
if (C.getAttribute("data-fp-omit") !== null)
|
|
908
|
-
continue;
|
|
909
|
-
C._flatpickr !== void 0 && (C._flatpickr.destroy(), C._flatpickr = void 0), C._flatpickr = In(C, v || {}), k.push(C._flatpickr);
|
|
910
|
-
} catch (I) {
|
|
911
|
-
console.error(I);
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
return k.length === 1 ? k[0] : k;
|
|
915
|
-
}
|
|
916
|
-
typeof HTMLElement < "u" && typeof HTMLCollection < "u" && typeof NodeList < "u" && (HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function(u) {
|
|
917
|
-
return F(this, u);
|
|
918
|
-
}, HTMLElement.prototype.flatpickr = function(u) {
|
|
919
|
-
return F([this], u);
|
|
920
|
-
});
|
|
921
|
-
var D = function(u, v) {
|
|
922
|
-
return typeof u == "string" ? F(window.document.querySelectorAll(u), v) : u instanceof Node ? F([u], v) : F(u, v);
|
|
923
|
-
};
|
|
924
|
-
D.defaultConfig = {};
|
|
925
|
-
D.l10ns = {
|
|
926
|
-
en: b({}, ve),
|
|
927
|
-
default: b({}, ve)
|
|
928
|
-
};
|
|
929
|
-
D.localize = function(u) {
|
|
930
|
-
D.l10ns.default = b(b({}, D.l10ns.default), u);
|
|
931
|
-
};
|
|
932
|
-
D.setDefaults = function(u) {
|
|
933
|
-
D.defaultConfig = b(b({}, D.defaultConfig), u);
|
|
934
|
-
};
|
|
935
|
-
D.parseDate = De({});
|
|
936
|
-
D.formatDate = Ye({});
|
|
937
|
-
D.compareDates = E;
|
|
938
|
-
typeof jQuery < "u" && typeof jQuery.fn < "u" && (jQuery.fn.flatpickr = function(u) {
|
|
939
|
-
return F(this, u);
|
|
940
|
-
});
|
|
941
|
-
Date.prototype.fp_incr = function(u) {
|
|
942
|
-
return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof u == "string" ? parseInt(u, 10) : u));
|
|
943
|
-
};
|
|
944
|
-
typeof window < "u" && (window.flatpickr = D);
|
|
945
|
-
export {
|
|
946
|
-
D as default
|
|
947
|
-
};
|