@keenmate/web-daterangepicker 1.0.0-rc08 → 1.1.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.
- package/README.md +31 -30
- package/dist/style.css +1 -1
- package/dist/web-daterangepicker.js +3783 -0
- package/dist/web-daterangepicker.umd.js +26 -0
- package/package.json +11 -10
- package/src/scss/_badges.scss +7 -5
- package/src/scss/_base.scss +85 -29
- package/src/scss/_calendar-grid.scss +7 -5
- package/src/scss/_header-navigation.scss +40 -17
- package/src/scss/_modifiers.scss +142 -244
- package/src/scss/_summary-actions.scss +13 -1
- package/src/scss/_tooltips.scss +3 -3
- package/src/scss/_variables.scss +13 -9
- package/dist/date-range-picker.js +0 -3222
- package/dist/date-range-picker.umd.js +0 -28
|
@@ -1,3222 +0,0 @@
|
|
|
1
|
-
var At = Object.defineProperty;
|
|
2
|
-
var Rt = (e, t, n) => t in e ? At(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var D = (e, t, n) => Rt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
function $t(e) {
|
|
5
|
-
if (e !== "auto")
|
|
6
|
-
return e;
|
|
7
|
-
try {
|
|
8
|
-
const a = new Intl.Locale(navigator.language);
|
|
9
|
-
if ("weekInfo" in a && a.weekInfo && "firstDay" in a.weekInfo) {
|
|
10
|
-
const r = a.weekInfo.firstDay;
|
|
11
|
-
return r === 7 ? 0 : r;
|
|
12
|
-
}
|
|
13
|
-
} catch {
|
|
14
|
-
}
|
|
15
|
-
const t = navigator.language.toLowerCase();
|
|
16
|
-
return [
|
|
17
|
-
"en-us",
|
|
18
|
-
"en-ca",
|
|
19
|
-
// US, Canada
|
|
20
|
-
"ja",
|
|
21
|
-
"ja-jp",
|
|
22
|
-
// Japan
|
|
23
|
-
"he",
|
|
24
|
-
"he-il",
|
|
25
|
-
// Israel
|
|
26
|
-
"ar-sa",
|
|
27
|
-
"ar-ae",
|
|
28
|
-
// Saudi Arabia, UAE
|
|
29
|
-
"ko",
|
|
30
|
-
"ko-kr"
|
|
31
|
-
// South Korea
|
|
32
|
-
].some((a) => t.startsWith(a)) ? 0 : 1;
|
|
33
|
-
}
|
|
34
|
-
function de(e) {
|
|
35
|
-
if (!e) return null;
|
|
36
|
-
let t;
|
|
37
|
-
return typeof e == "string" ? t = /* @__PURE__ */ new Date(e + "T00:00:00") : t = new Date(e), t.setHours(0, 0, 0, 0), isNaN(t.getTime()) ? null : t;
|
|
38
|
-
}
|
|
39
|
-
function ve(e) {
|
|
40
|
-
const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), a = String(e.getDate()).padStart(2, "0");
|
|
41
|
-
return `${t}-${n}-${a}`;
|
|
42
|
-
}
|
|
43
|
-
function Pt(e, t, n, a, r, o) {
|
|
44
|
-
const s = ve(e), i = e.getDay();
|
|
45
|
-
return !!(t && e < t || n && e > n || r && r.includes(i) || a.has(s) || o && o(e));
|
|
46
|
-
}
|
|
47
|
-
function kt(e, t) {
|
|
48
|
-
for (let n = 0; n < 12; n++) {
|
|
49
|
-
const a = new Date(t, n + 1, 0).getDate();
|
|
50
|
-
for (let r = 1; r <= a; r++) {
|
|
51
|
-
const o = new Date(t, n, r);
|
|
52
|
-
if (!e.isDateDisabledInternal(o))
|
|
53
|
-
return !0;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return !1;
|
|
57
|
-
}
|
|
58
|
-
function Tt(e, t, n) {
|
|
59
|
-
const a = new Date(e), r = new Date(t);
|
|
60
|
-
a.setHours(0, 0, 0, 0), r.setHours(0, 0, 0, 0);
|
|
61
|
-
const o = new Date(a);
|
|
62
|
-
for (; o <= r; ) {
|
|
63
|
-
if (n(o))
|
|
64
|
-
return !0;
|
|
65
|
-
o.setDate(o.getDate() + 1);
|
|
66
|
-
}
|
|
67
|
-
return !1;
|
|
68
|
-
}
|
|
69
|
-
function zt(e, t, n) {
|
|
70
|
-
const a = [], r = new Date(e), o = new Date(t);
|
|
71
|
-
r.setHours(0, 0, 0, 0), o.setHours(0, 0, 0, 0);
|
|
72
|
-
const s = new Date(r);
|
|
73
|
-
for (; s <= o; )
|
|
74
|
-
n(s) || a.push(new Date(s)), s.setDate(s.getDate() + 1);
|
|
75
|
-
return a;
|
|
76
|
-
}
|
|
77
|
-
function Ft(e, t, n) {
|
|
78
|
-
const a = [], r = new Date(e), o = new Date(t);
|
|
79
|
-
r.setHours(0, 0, 0, 0), o.setHours(0, 0, 0, 0);
|
|
80
|
-
const s = new Date(r);
|
|
81
|
-
for (; s <= o; )
|
|
82
|
-
n(s) && a.push(new Date(s)), s.setDate(s.getDate() + 1);
|
|
83
|
-
return a;
|
|
84
|
-
}
|
|
85
|
-
function Nt(e, t, n) {
|
|
86
|
-
const a = new Date(e), r = new Date(t);
|
|
87
|
-
a.setHours(0, 0, 0, 0), r.setHours(0, 0, 0, 0);
|
|
88
|
-
let o = new Date(a);
|
|
89
|
-
const s = new Date(a);
|
|
90
|
-
for (s.setDate(s.getDate() + 1); s <= r; ) {
|
|
91
|
-
if (n(s))
|
|
92
|
-
return o;
|
|
93
|
-
o = new Date(s), s.setDate(s.getDate() + 1);
|
|
94
|
-
}
|
|
95
|
-
return r;
|
|
96
|
-
}
|
|
97
|
-
function Ot(e, t, n) {
|
|
98
|
-
const a = [], r = new Date(e), o = new Date(t);
|
|
99
|
-
r.setHours(0, 0, 0, 0), o.setHours(0, 0, 0, 0);
|
|
100
|
-
let s = null;
|
|
101
|
-
const i = new Date(r);
|
|
102
|
-
for (; i <= o; ) {
|
|
103
|
-
if (!n(i))
|
|
104
|
-
s || (s = new Date(i));
|
|
105
|
-
else if (s) {
|
|
106
|
-
const d = new Date(i);
|
|
107
|
-
d.setDate(d.getDate() - 1), a.push({ start: s, end: d }), s = null;
|
|
108
|
-
}
|
|
109
|
-
i.setDate(i.getDate() + 1);
|
|
110
|
-
}
|
|
111
|
-
return s && a.push({ start: s, end: new Date(o) }), a;
|
|
112
|
-
}
|
|
113
|
-
function Ht(e) {
|
|
114
|
-
return Je(e, /* @__PURE__ */ new Date());
|
|
115
|
-
}
|
|
116
|
-
function Je(e, t) {
|
|
117
|
-
return !e || !t ? !1 : e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
|
|
118
|
-
}
|
|
119
|
-
function Yt(e, t, n) {
|
|
120
|
-
return !t || !n ? !1 : e > t && e < n;
|
|
121
|
-
}
|
|
122
|
-
var Qe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
123
|
-
function Ze(e) {
|
|
124
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
125
|
-
}
|
|
126
|
-
var et = { exports: {} };
|
|
127
|
-
(function(e) {
|
|
128
|
-
(function(t, n) {
|
|
129
|
-
e.exports ? e.exports = n() : t.log = n();
|
|
130
|
-
})(Qe, function() {
|
|
131
|
-
var t = function() {
|
|
132
|
-
}, n = "undefined", a = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), r = [
|
|
133
|
-
"trace",
|
|
134
|
-
"debug",
|
|
135
|
-
"info",
|
|
136
|
-
"warn",
|
|
137
|
-
"error"
|
|
138
|
-
], o = {}, s = null;
|
|
139
|
-
function i(f, y) {
|
|
140
|
-
var m = f[y];
|
|
141
|
-
if (typeof m.bind == "function")
|
|
142
|
-
return m.bind(f);
|
|
143
|
-
try {
|
|
144
|
-
return Function.prototype.bind.call(m, f);
|
|
145
|
-
} catch {
|
|
146
|
-
return function() {
|
|
147
|
-
return Function.prototype.apply.apply(m, [f, arguments]);
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function d() {
|
|
152
|
-
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
|
|
153
|
-
}
|
|
154
|
-
function l(f) {
|
|
155
|
-
return f === "debug" && (f = "log"), typeof console === n ? !1 : f === "trace" && a ? d : console[f] !== void 0 ? i(console, f) : console.log !== void 0 ? i(console, "log") : t;
|
|
156
|
-
}
|
|
157
|
-
function c() {
|
|
158
|
-
for (var f = this.getLevel(), y = 0; y < r.length; y++) {
|
|
159
|
-
var m = r[y];
|
|
160
|
-
this[m] = y < f ? t : this.methodFactory(m, f, this.name);
|
|
161
|
-
}
|
|
162
|
-
if (this.log = this.debug, typeof console === n && f < this.levels.SILENT)
|
|
163
|
-
return "No console available for logging";
|
|
164
|
-
}
|
|
165
|
-
function u(f) {
|
|
166
|
-
return function() {
|
|
167
|
-
typeof console !== n && (c.call(this), this[f].apply(this, arguments));
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
function p(f, y, m) {
|
|
171
|
-
return l(f) || u.apply(this, arguments);
|
|
172
|
-
}
|
|
173
|
-
function g(f, y) {
|
|
174
|
-
var m = this, x, M, I, b = "loglevel";
|
|
175
|
-
typeof f == "string" ? b += ":" + f : typeof f == "symbol" && (b = void 0);
|
|
176
|
-
function v(S) {
|
|
177
|
-
var E = (r[S] || "silent").toUpperCase();
|
|
178
|
-
if (!(typeof window === n || !b)) {
|
|
179
|
-
try {
|
|
180
|
-
window.localStorage[b] = E;
|
|
181
|
-
return;
|
|
182
|
-
} catch {
|
|
183
|
-
}
|
|
184
|
-
try {
|
|
185
|
-
window.document.cookie = encodeURIComponent(b) + "=" + E + ";";
|
|
186
|
-
} catch {
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
function L() {
|
|
191
|
-
var S;
|
|
192
|
-
if (!(typeof window === n || !b)) {
|
|
193
|
-
try {
|
|
194
|
-
S = window.localStorage[b];
|
|
195
|
-
} catch {
|
|
196
|
-
}
|
|
197
|
-
if (typeof S === n)
|
|
198
|
-
try {
|
|
199
|
-
var E = window.document.cookie, P = encodeURIComponent(b), R = E.indexOf(P + "=");
|
|
200
|
-
R !== -1 && (S = /^([^;]+)/.exec(
|
|
201
|
-
E.slice(R + P.length + 1)
|
|
202
|
-
)[1]);
|
|
203
|
-
} catch {
|
|
204
|
-
}
|
|
205
|
-
return m.levels[S] === void 0 && (S = void 0), S;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
function A() {
|
|
209
|
-
if (!(typeof window === n || !b)) {
|
|
210
|
-
try {
|
|
211
|
-
window.localStorage.removeItem(b);
|
|
212
|
-
} catch {
|
|
213
|
-
}
|
|
214
|
-
try {
|
|
215
|
-
window.document.cookie = encodeURIComponent(b) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
216
|
-
} catch {
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
function w(S) {
|
|
221
|
-
var E = S;
|
|
222
|
-
if (typeof E == "string" && m.levels[E.toUpperCase()] !== void 0 && (E = m.levels[E.toUpperCase()]), typeof E == "number" && E >= 0 && E <= m.levels.SILENT)
|
|
223
|
-
return E;
|
|
224
|
-
throw new TypeError("log.setLevel() called with invalid level: " + S);
|
|
225
|
-
}
|
|
226
|
-
m.name = f, m.levels = {
|
|
227
|
-
TRACE: 0,
|
|
228
|
-
DEBUG: 1,
|
|
229
|
-
INFO: 2,
|
|
230
|
-
WARN: 3,
|
|
231
|
-
ERROR: 4,
|
|
232
|
-
SILENT: 5
|
|
233
|
-
}, m.methodFactory = y || p, m.getLevel = function() {
|
|
234
|
-
return I ?? M ?? x;
|
|
235
|
-
}, m.setLevel = function(S, E) {
|
|
236
|
-
return I = w(S), E !== !1 && v(I), c.call(m);
|
|
237
|
-
}, m.setDefaultLevel = function(S) {
|
|
238
|
-
M = w(S), L() || m.setLevel(S, !1);
|
|
239
|
-
}, m.resetLevel = function() {
|
|
240
|
-
I = null, A(), c.call(m);
|
|
241
|
-
}, m.enableAll = function(S) {
|
|
242
|
-
m.setLevel(m.levels.TRACE, S);
|
|
243
|
-
}, m.disableAll = function(S) {
|
|
244
|
-
m.setLevel(m.levels.SILENT, S);
|
|
245
|
-
}, m.rebuild = function() {
|
|
246
|
-
if (s !== m && (x = w(s.getLevel())), c.call(m), s === m)
|
|
247
|
-
for (var S in o)
|
|
248
|
-
o[S].rebuild();
|
|
249
|
-
}, x = w(
|
|
250
|
-
s ? s.getLevel() : "WARN"
|
|
251
|
-
);
|
|
252
|
-
var _ = L();
|
|
253
|
-
_ != null && (I = w(_)), c.call(m);
|
|
254
|
-
}
|
|
255
|
-
s = new g(), s.getLogger = function(y) {
|
|
256
|
-
if (typeof y != "symbol" && typeof y != "string" || y === "")
|
|
257
|
-
throw new TypeError("You must supply a name when creating a logger.");
|
|
258
|
-
var m = o[y];
|
|
259
|
-
return m || (m = o[y] = new g(
|
|
260
|
-
y,
|
|
261
|
-
s.methodFactory
|
|
262
|
-
)), m;
|
|
263
|
-
};
|
|
264
|
-
var h = typeof window !== n ? window.log : void 0;
|
|
265
|
-
return s.noConflict = function() {
|
|
266
|
-
return typeof window !== n && window.log === s && (window.log = h), s;
|
|
267
|
-
}, s.getLoggers = function() {
|
|
268
|
-
return o;
|
|
269
|
-
}, s.default = s, s;
|
|
270
|
-
});
|
|
271
|
-
})(et);
|
|
272
|
-
var Vt = et.exports;
|
|
273
|
-
const k = /* @__PURE__ */ Ze(Vt);
|
|
274
|
-
var tt = { exports: {} };
|
|
275
|
-
(function(e) {
|
|
276
|
-
(function(t, n) {
|
|
277
|
-
e.exports ? e.exports = n() : t.prefix = n(t);
|
|
278
|
-
})(Qe, function(t) {
|
|
279
|
-
var n = function(c) {
|
|
280
|
-
for (var u = 1, p = arguments.length, g; u < p; u++)
|
|
281
|
-
for (g in arguments[u])
|
|
282
|
-
Object.prototype.hasOwnProperty.call(arguments[u], g) && (c[g] = arguments[u][g]);
|
|
283
|
-
return c;
|
|
284
|
-
}, a = {
|
|
285
|
-
template: "[%t] %l:",
|
|
286
|
-
levelFormatter: function(c) {
|
|
287
|
-
return c.toUpperCase();
|
|
288
|
-
},
|
|
289
|
-
nameFormatter: function(c) {
|
|
290
|
-
return c || "root";
|
|
291
|
-
},
|
|
292
|
-
timestampFormatter: function(c) {
|
|
293
|
-
return c.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1");
|
|
294
|
-
},
|
|
295
|
-
format: void 0
|
|
296
|
-
}, r, o = {}, s = function(c) {
|
|
297
|
-
if (!c || !c.getLogger)
|
|
298
|
-
throw new TypeError("Argument is not a root logger");
|
|
299
|
-
r = c;
|
|
300
|
-
}, i = function(c, u) {
|
|
301
|
-
if (!c || !c.setLevel)
|
|
302
|
-
throw new TypeError("Argument is not a logger");
|
|
303
|
-
var p = c.methodFactory, g = c.name || "", h = o[g] || o[""] || a;
|
|
304
|
-
function f(y, m, x) {
|
|
305
|
-
var M = p(y, m, x), I = o[x] || o[""], b = I.template.indexOf("%t") !== -1, v = I.template.indexOf("%l") !== -1, L = I.template.indexOf("%n") !== -1;
|
|
306
|
-
return function() {
|
|
307
|
-
for (var A = "", w = arguments.length, _ = Array(w), S = 0; S < w; S++)
|
|
308
|
-
_[S] = arguments[S];
|
|
309
|
-
if (g || !o[x]) {
|
|
310
|
-
var E = I.timestampFormatter(/* @__PURE__ */ new Date()), P = I.levelFormatter(y), R = I.nameFormatter(x);
|
|
311
|
-
I.format ? A += I.format(P, R, E) : (A += I.template, b && (A = A.replace(/%t/, E)), v && (A = A.replace(/%l/, P)), L && (A = A.replace(/%n/, R))), _.length && typeof _[0] == "string" ? _[0] = A + " " + _[0] : _.unshift(A);
|
|
312
|
-
}
|
|
313
|
-
M.apply(void 0, _);
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
return o[g] || (c.methodFactory = f), u = u || {}, u.template && (u.format = void 0), o[g] = n({}, h, u), c.setLevel(c.getLevel()), r || c.warn(
|
|
317
|
-
"It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"
|
|
318
|
-
), c;
|
|
319
|
-
}, d = {
|
|
320
|
-
reg: s,
|
|
321
|
-
apply: i
|
|
322
|
-
}, l;
|
|
323
|
-
return t && (l = t.prefix, d.noConflict = function() {
|
|
324
|
-
return t.prefix === d && (t.prefix = l), d;
|
|
325
|
-
}), d;
|
|
326
|
-
});
|
|
327
|
-
})(tt);
|
|
328
|
-
var qt = tt.exports;
|
|
329
|
-
const K = /* @__PURE__ */ Ze(qt);
|
|
330
|
-
K.reg(k);
|
|
331
|
-
K.apply(k, {
|
|
332
|
-
format(e, t, n) {
|
|
333
|
-
return `[${n}] [${e}] ${t ? `[${t}]` : ""}`;
|
|
334
|
-
},
|
|
335
|
-
timestampFormatter(e) {
|
|
336
|
-
return e.toTimeString().split(" ")[0] + "." + e.getMilliseconds().toString().padStart(3, "0");
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
const $ = k.getLogger("INIT"), U = k.getLogger("VALIDATION"), F = k.getLogger("DRAG"), te = k.getLogger("SELECTION"), q = k.getLogger("RENDERING"), B = k.getLogger("UI"), C = k.getLogger("NAVIGATION"), Z = k.getLogger("INTERACTION");
|
|
340
|
-
K.apply($);
|
|
341
|
-
K.apply(U);
|
|
342
|
-
K.apply(F);
|
|
343
|
-
K.apply(te);
|
|
344
|
-
K.apply(q);
|
|
345
|
-
K.apply(B);
|
|
346
|
-
K.apply(C);
|
|
347
|
-
K.apply(Z);
|
|
348
|
-
const X = "silent";
|
|
349
|
-
k.setLevel(X);
|
|
350
|
-
$.setLevel(X);
|
|
351
|
-
U.setLevel(X);
|
|
352
|
-
F.setLevel(X);
|
|
353
|
-
te.setLevel(X);
|
|
354
|
-
q.setLevel(X);
|
|
355
|
-
B.setLevel(X);
|
|
356
|
-
C.setLevel(X);
|
|
357
|
-
Z.setLevel(X);
|
|
358
|
-
const Bt = (e) => {
|
|
359
|
-
const t = e ? "debug" : "silent";
|
|
360
|
-
k.setLevel(t), $.setLevel(t), U.setLevel(t), F.setLevel(t), te.setLevel(t), q.setLevel(t), B.setLevel(t), C.setLevel(t), Z.setLevel(t);
|
|
361
|
-
};
|
|
362
|
-
function Re(e, t, n) {
|
|
363
|
-
for (let a = 1; a <= 31; a++) {
|
|
364
|
-
const r = new Date(t, n, a);
|
|
365
|
-
if (r.getMonth() === n && !e.isDateDisabledInternal(r))
|
|
366
|
-
return !0;
|
|
367
|
-
}
|
|
368
|
-
return !1;
|
|
369
|
-
}
|
|
370
|
-
function Wt(e, t) {
|
|
371
|
-
e.showingRollingSelector[t] = !e.showingRollingSelector[t], e.renderCalendar();
|
|
372
|
-
}
|
|
373
|
-
function jt(e, t, n) {
|
|
374
|
-
const a = e.monthDates[n].getFullYear();
|
|
375
|
-
e.monthDates[n].setFullYear(t), C.debug(`selectYear() Col${n} - changed from ${a} to ${t}`), ue(e, n), e.showingRollingSelector[n] = !1, e.renderCalendar();
|
|
376
|
-
}
|
|
377
|
-
function Kt(e, t, n) {
|
|
378
|
-
const a = e.monthDates[n].getMonth();
|
|
379
|
-
e.monthDates[n].setMonth(t), C.debug(`selectMonth() Col${n} - changed from ${a + 1} to ${t + 1}`), ue(e, n), e.showingRollingSelector[n] = !1, e.renderCalendar();
|
|
380
|
-
}
|
|
381
|
-
function ue(e, t) {
|
|
382
|
-
const n = e.monthDates[t];
|
|
383
|
-
if (t < e.monthDates.length - 1) {
|
|
384
|
-
const a = e.monthDates[t + 1];
|
|
385
|
-
if (be(n, a)) {
|
|
386
|
-
C.debug(`checkAndResolveCollisions() Col${t} - collision with Col${t + 1}, shifting forward`);
|
|
387
|
-
const r = new Date(n.getFullYear(), n.getMonth() + 1, 1);
|
|
388
|
-
e.monthDates[t + 1] = r, ue(e, t + 1);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
if (t > 0) {
|
|
392
|
-
const a = e.monthDates[t - 1];
|
|
393
|
-
if (be(a, n)) {
|
|
394
|
-
C.debug(`checkAndResolveCollisions() Col${t} - collision with Col${t - 1}, shifting backward`);
|
|
395
|
-
const r = new Date(n.getFullYear(), n.getMonth() - 1, 1);
|
|
396
|
-
e.monthDates[t - 1] = r, ue(e, t - 1);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
function be(e, t) {
|
|
401
|
-
const n = e.getFullYear(), a = e.getMonth(), r = t.getFullYear(), o = t.getMonth();
|
|
402
|
-
return n > r || n === r && a >= o;
|
|
403
|
-
}
|
|
404
|
-
function ce(e, t) {
|
|
405
|
-
const n = isNaN(t) ? e.activeMonthIndex : t;
|
|
406
|
-
e.showingRollingSelector[n] && (e.showingRollingSelector[n] = !1);
|
|
407
|
-
const a = e.monthDates[n], r = new Date(a.getFullYear(), a.getMonth() - 1, 1);
|
|
408
|
-
if (e.monthDates[n] = r, C.debug(`prevMonth() Col${n} - changed from ${a.getFullYear()}-${a.getMonth() + 1} to ${r.getFullYear()}-${r.getMonth() + 1}`), n > 0) {
|
|
409
|
-
const o = e.monthDates[n - 1];
|
|
410
|
-
be(o, r) && (C.debug(`prevMonth() Col${n} - collision detected with Col${n - 1}, shifting previous columns back`), ce(e, n - 1));
|
|
411
|
-
}
|
|
412
|
-
e.renderCalendar();
|
|
413
|
-
}
|
|
414
|
-
function pe(e, t) {
|
|
415
|
-
const n = isNaN(t) ? e.activeMonthIndex : t;
|
|
416
|
-
e.showingRollingSelector[n] && (e.showingRollingSelector[n] = !1);
|
|
417
|
-
const a = e.monthDates[n], r = new Date(a.getFullYear(), a.getMonth() + 1, 1);
|
|
418
|
-
if (e.monthDates[n] = r, C.debug(`nextMonth() Col${n} - changed from ${a.getFullYear()}-${a.getMonth() + 1} to ${r.getFullYear()}-${r.getMonth() + 1}`), n < e.monthDates.length - 1) {
|
|
419
|
-
const o = e.monthDates[n + 1];
|
|
420
|
-
be(r, o) && (C.debug(`nextMonth() Col${n} - collision detected with Col${n + 1}, shifting next columns forward`), pe(e, n + 1));
|
|
421
|
-
}
|
|
422
|
-
e.renderCalendar();
|
|
423
|
-
}
|
|
424
|
-
function le(e, t, n, a, r) {
|
|
425
|
-
let o = t, s = 0;
|
|
426
|
-
const i = 60;
|
|
427
|
-
for (; s < i; ) {
|
|
428
|
-
if (o >= 0 && o < a.length) {
|
|
429
|
-
const l = a[o].dataset.date;
|
|
430
|
-
if (l) {
|
|
431
|
-
const [c, u, p] = l.split("-").map(Number), g = new Date(c, u - 1, p);
|
|
432
|
-
if (!e.isDateDisabledInternal(g))
|
|
433
|
-
return { index: o, monthChanged: !1 };
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
if (o += n, s++, o < 0 || o >= a.length)
|
|
437
|
-
return { index: null, monthChanged: !0, direction: n > 0 ? "next" : "prev" };
|
|
438
|
-
}
|
|
439
|
-
return { index: null, monthChanged: !1 };
|
|
440
|
-
}
|
|
441
|
-
function Ut(e, t) {
|
|
442
|
-
var s, i, d, l;
|
|
443
|
-
C.debug(`moveFocus(${t}) Col${e.activeMonthIndex} - focusedDayIndex:`, e.focusedDayIndex);
|
|
444
|
-
const n = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${e.activeMonthIndex}"]`);
|
|
445
|
-
if (!n) {
|
|
446
|
-
C.debug(`moveFocus() Col${e.activeMonthIndex} - ERROR: daysContainer not found!`);
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
const a = n.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
450
|
-
if (C.debug(`moveFocus() Col${e.activeMonthIndex} - found ${a.length} days in column`), a.length === 0) return;
|
|
451
|
-
if (e.focusedDayIndex === null) {
|
|
452
|
-
const c = Array.from(a).findIndex((u) => u.classList.contains("drp-date-picker__day--today"));
|
|
453
|
-
e.focusedDayIndex = c !== -1 ? c : 0, C.debug(`moveFocus() Col${e.activeMonthIndex} - initialized focusedDayIndex to ${e.focusedDayIndex} (today or first day), will move by offset ${t}`);
|
|
454
|
-
}
|
|
455
|
-
(s = a[e.focusedDayIndex]) == null || s.classList.remove("drp-date-picker__day--focused");
|
|
456
|
-
const r = e.focusedDayIndex + t;
|
|
457
|
-
if (r < 0) {
|
|
458
|
-
const c = e.activeMonthIndex;
|
|
459
|
-
if (t === -1)
|
|
460
|
-
C.debug(`moveFocus() Col${c} - edge navigation LEFT: going to last enabled day of prev month`), ce(e, e.activeMonthIndex), setTimeout(() => {
|
|
461
|
-
var h, f;
|
|
462
|
-
const u = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
|
|
463
|
-
if (!u) return;
|
|
464
|
-
const p = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), g = le(e, p.length - 1, -1, p);
|
|
465
|
-
g.index !== null && (e.focusedDayIndex = g.index, (h = p[e.focusedDayIndex]) == null || h.classList.add("drp-date-picker__day--focused"), (f = p[e.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
|
|
466
|
-
}, 0);
|
|
467
|
-
else {
|
|
468
|
-
const p = a[e.focusedDayIndex].dataset.date;
|
|
469
|
-
if (p) {
|
|
470
|
-
const [g, h, f] = p.split("-").map(Number), m = new Date(g, h - 1, f).getDay();
|
|
471
|
-
C.debug(`moveFocus() Col${c} - edge navigation UP: current day ${f} is weekday ${m}, going to prev month`), ce(e, e.activeMonthIndex), setTimeout(() => {
|
|
472
|
-
var v, L;
|
|
473
|
-
const x = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
|
|
474
|
-
if (!x) return;
|
|
475
|
-
const M = x.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), b = M[M.length - 1].dataset.date;
|
|
476
|
-
if (b) {
|
|
477
|
-
const [A, w, _] = b.split("-").map(Number), E = new Date(A, w - 1, _).getDay(), P = (E - m + 7) % 7;
|
|
478
|
-
e.focusedDayIndex = M.length - 1 - P, C.debug(`moveFocus() Col${c} - last day weekday ${E}, target ${m}, focusing on day ${e.focusedDayIndex + 1}`), (v = M[e.focusedDayIndex]) == null || v.classList.add("drp-date-picker__day--focused"), (L = M[e.focusedDayIndex]) == null || L.scrollIntoView({ block: "nearest" });
|
|
479
|
-
}
|
|
480
|
-
}, 0);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
return;
|
|
484
|
-
} else if (r >= a.length) {
|
|
485
|
-
const c = e.activeMonthIndex;
|
|
486
|
-
if (t === 1)
|
|
487
|
-
C.debug(`moveFocus() Col${c} - edge navigation RIGHT: going to first enabled day of next month`), pe(e, e.activeMonthIndex), setTimeout(() => {
|
|
488
|
-
var h, f;
|
|
489
|
-
const u = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
|
|
490
|
-
if (!u) return;
|
|
491
|
-
const p = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), g = le(e, 0, 1, p);
|
|
492
|
-
g.index !== null && (e.focusedDayIndex = g.index, (h = p[e.focusedDayIndex]) == null || h.classList.add("drp-date-picker__day--focused"), (f = p[e.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
|
|
493
|
-
}, 0);
|
|
494
|
-
else {
|
|
495
|
-
const p = a[e.focusedDayIndex].dataset.date;
|
|
496
|
-
if (p) {
|
|
497
|
-
const [g, h, f] = p.split("-").map(Number), m = new Date(g, h - 1, f).getDay();
|
|
498
|
-
C.debug(`moveFocus() Col${c} - edge navigation DOWN: current day ${f} is weekday ${m}, going to next month`), pe(e, e.activeMonthIndex), setTimeout(() => {
|
|
499
|
-
var v, L;
|
|
500
|
-
const x = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
|
|
501
|
-
if (!x) return;
|
|
502
|
-
const M = x.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), b = M[0].dataset.date;
|
|
503
|
-
if (b) {
|
|
504
|
-
const [A, w, _] = b.split("-").map(Number), E = new Date(A, w - 1, _).getDay(), P = (m - E + 7) % 7;
|
|
505
|
-
e.focusedDayIndex = P, C.debug(`moveFocus() Col${c} - first day weekday ${E}, target ${m}, focusing on day ${e.focusedDayIndex + 1}`), (v = M[e.focusedDayIndex]) == null || v.classList.add("drp-date-picker__day--focused"), (L = M[e.focusedDayIndex]) == null || L.scrollIntoView({ block: "nearest" });
|
|
506
|
-
}
|
|
507
|
-
}, 0);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
return;
|
|
511
|
-
}
|
|
512
|
-
const o = le(e, r, t, a, e.activeMonthIndex);
|
|
513
|
-
if (o.monthChanged) {
|
|
514
|
-
const c = e.activeMonthIndex;
|
|
515
|
-
o.direction === "next" ? pe(e, e.activeMonthIndex) : ce(e, e.activeMonthIndex), setTimeout(() => {
|
|
516
|
-
var h, f;
|
|
517
|
-
const u = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
|
|
518
|
-
if (!u) return;
|
|
519
|
-
const p = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), g = le(
|
|
520
|
-
e,
|
|
521
|
-
o.direction === "next" ? 0 : p.length - 1,
|
|
522
|
-
t,
|
|
523
|
-
p
|
|
524
|
-
);
|
|
525
|
-
g.index !== null && (e.focusedDayIndex = g.index, (h = p[e.focusedDayIndex]) == null || h.classList.add("drp-date-picker__day--focused"), (f = p[e.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
|
|
526
|
-
}, 0);
|
|
527
|
-
return;
|
|
528
|
-
}
|
|
529
|
-
o.index !== null ? (e.focusedDayIndex = o.index, (i = a[e.focusedDayIndex]) == null || i.classList.add("drp-date-picker__day--focused"), (d = a[e.focusedDayIndex]) == null || d.scrollIntoView({ block: "nearest" })) : (C.debug("moveFocus() - no enabled day found in search range"), (l = a[e.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"));
|
|
530
|
-
}
|
|
531
|
-
function Xt(e, t, n) {
|
|
532
|
-
if (!e) {
|
|
533
|
-
if (n != null && n.normalizedMinDate || n != null && n.normalizedMaxDate) {
|
|
534
|
-
const a = n.normalizedMinDate ? n.normalizedMinDate.getFullYear() : t - 1, r = n.normalizedMaxDate ? n.normalizedMaxDate.getFullYear() : t + 1;
|
|
535
|
-
return { min: a, max: r };
|
|
536
|
-
}
|
|
537
|
-
return { min: t - 1, max: t + 1 };
|
|
538
|
-
}
|
|
539
|
-
if (e.includes("-")) {
|
|
540
|
-
const [a, r] = e.split("-");
|
|
541
|
-
return { min: parseInt(a, 10), max: parseInt(r, 10) };
|
|
542
|
-
} else {
|
|
543
|
-
const a = parseInt(e, 10);
|
|
544
|
-
return { min: a, max: a };
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
function Gt(e) {
|
|
548
|
-
if (!e)
|
|
549
|
-
return { min: 1, max: 12 };
|
|
550
|
-
const [t, n] = e.split("-");
|
|
551
|
-
return { min: parseInt(t, 10), max: parseInt(n, 10) };
|
|
552
|
-
}
|
|
553
|
-
function Jt(e) {
|
|
554
|
-
q.debug("[DatePicker 18] renderCalendar called, showingRollingSelector:", e.showingRollingSelector, `activeCol: ${e.activeMonthIndex}`), q.debug("[DatePicker 18] monthDates array:", e.monthDates.map((t, n) => `Col${n}: ${t.getFullYear()}-${t.getMonth() + 1}`).join(", "));
|
|
555
|
-
for (let t = 0; t < e.options.visibleMonthsCount; t++)
|
|
556
|
-
e.showingRollingSelector[t] ? rt(e, t) : nt(e, t);
|
|
557
|
-
if (requestAnimationFrame(() => {
|
|
558
|
-
if (!e.calendarContentHeight && !e.showingRollingSelector[0]) {
|
|
559
|
-
const t = e.calendar.querySelector('.drp-date-picker__month[data-month-index="0"]');
|
|
560
|
-
if (t) {
|
|
561
|
-
const n = t.querySelector(".drp-date-picker__weekdays"), a = t.querySelector(".drp-date-picker__days");
|
|
562
|
-
if (n && a) {
|
|
563
|
-
const r = n.offsetHeight, o = a.offsetHeight, s = a.offsetWidth, i = getComputedStyle(n), d = parseInt(i.marginBottom) || 0;
|
|
564
|
-
e.calendarContentHeight = r + d + o, e.calendarContentWidth = Math.ceil(s), q.debug("[DatePicker] Captured calendar content dimensions:", {
|
|
565
|
-
weekdaysHeight: r,
|
|
566
|
-
weekdaysMargin: d,
|
|
567
|
-
daysHeight: o,
|
|
568
|
-
daysWidth: s,
|
|
569
|
-
totalHeight: e.calendarContentHeight,
|
|
570
|
-
totalWidth: e.calendarContentWidth
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
if (e.calendarContentHeight)
|
|
576
|
-
for (let t = 0; t < e.options.visibleMonthsCount; t++) {
|
|
577
|
-
const n = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${t}"]`);
|
|
578
|
-
if (!n) continue;
|
|
579
|
-
const a = n.querySelector(".drp-date-picker__rolling-selector");
|
|
580
|
-
if (a) {
|
|
581
|
-
const r = a.classList.contains("drp-date-picker__rolling-selector--visible");
|
|
582
|
-
if (a.style.height = `${e.calendarContentHeight}px`, e.calendarContentWidth && (a.style.width = `${e.calendarContentWidth}px`), r) {
|
|
583
|
-
const o = a.offsetHeight, s = a.offsetWidth;
|
|
584
|
-
q.debug(`[DatePicker] Applied dimensions to rolling selector ${t}:`, {
|
|
585
|
-
targetHeight: e.calendarContentHeight,
|
|
586
|
-
actualHeight: o,
|
|
587
|
-
heightDifference: o - e.calendarContentHeight,
|
|
588
|
-
targetWidth: e.calendarContentWidth,
|
|
589
|
-
actualWidth: s,
|
|
590
|
-
widthDifference: s - (e.calendarContentWidth || 0)
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}), e.focusedDayIndex !== null) {
|
|
596
|
-
const t = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${e.activeMonthIndex}"]`);
|
|
597
|
-
if (t) {
|
|
598
|
-
const n = t.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
599
|
-
n[e.focusedDayIndex] && n[e.focusedDayIndex].classList.add("drp-date-picker__day--focused");
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
e.options.selectionMode === "range" && !e.isDragging && e.initDragListeners();
|
|
603
|
-
}
|
|
604
|
-
function nt(e, t) {
|
|
605
|
-
q.debug(`[DatePicker Col${t} 19] renderNormalView called for month`, t);
|
|
606
|
-
const n = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${t}"]`);
|
|
607
|
-
if (!n) return;
|
|
608
|
-
const a = n.querySelector(".drp-date-picker__rolling-selector");
|
|
609
|
-
a == null || a.classList.remove("drp-date-picker__rolling-selector--visible");
|
|
610
|
-
const r = e.monthDates[t], o = n.querySelector(".drp-date-picker__month-year");
|
|
611
|
-
o && (o.textContent = `${e.monthNames[r.getMonth()]} ${r.getFullYear()}`);
|
|
612
|
-
const s = r.getFullYear(), i = r.getMonth(), d = i === 0 ? 11 : i - 1, l = i === 0 ? s - 1 : s, c = n.querySelector(".drp-date-picker__nav--prev");
|
|
613
|
-
c && (Re(e, l, d) ? (c.removeAttribute("disabled"), c.classList.remove("drp-date-picker__nav--disabled")) : (c.setAttribute("disabled", "true"), c.classList.add("drp-date-picker__nav--disabled")));
|
|
614
|
-
const u = i === 11 ? 0 : i + 1, p = i === 11 ? s + 1 : s, g = n.querySelector(".drp-date-picker__nav--next");
|
|
615
|
-
g && (Re(e, p, u) ? (g.removeAttribute("disabled"), g.classList.remove("drp-date-picker__nav--disabled")) : (g.setAttribute("disabled", "true"), g.classList.add("drp-date-picker__nav--disabled")));
|
|
616
|
-
const h = n.querySelector(".drp-date-picker__weekdays"), f = [
|
|
617
|
-
...e.weekdayNames.slice(e.weekStartDay),
|
|
618
|
-
...e.weekdayNames.slice(0, e.weekStartDay)
|
|
619
|
-
];
|
|
620
|
-
h && (h.innerHTML = f.map((y) => `<div class="drp-date-picker__weekday">${y}</div>`).join("")), at(e, t, r);
|
|
621
|
-
}
|
|
622
|
-
function at(e, t, n) {
|
|
623
|
-
q.debug(`[DatePicker Col${t} 20] renderDays called for month`, t);
|
|
624
|
-
const a = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${t}"]`);
|
|
625
|
-
if (!a) return;
|
|
626
|
-
const r = a.querySelector(".drp-date-picker__days"), o = n.getFullYear(), s = n.getMonth();
|
|
627
|
-
q.debug(`[DatePicker Col${t} 21] Rendering days for:`, o, s + 1);
|
|
628
|
-
const d = (new Date(o, s, 1).getDay() - e.weekStartDay + 7) % 7, l = new Date(o, s + 1, 0).getDate(), c = new Date(o, s, 0).getDate(), u = new Date(o, s - 1, 1), p = u.getFullYear(), g = u.getMonth(), h = new Date(o, s + 1, 1), f = h.getFullYear(), y = h.getMonth(), m = [];
|
|
629
|
-
for (let v = d - 1; v >= 0; v--) {
|
|
630
|
-
const L = c - v, A = new Date(p, g, L);
|
|
631
|
-
m.push({
|
|
632
|
-
date: A,
|
|
633
|
-
year: p,
|
|
634
|
-
month: g,
|
|
635
|
-
day: L,
|
|
636
|
-
isOtherMonth: !0
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
for (let v = 1; v <= l; v++) {
|
|
640
|
-
const L = new Date(o, s, v);
|
|
641
|
-
m.push({
|
|
642
|
-
date: L,
|
|
643
|
-
year: o,
|
|
644
|
-
month: s,
|
|
645
|
-
day: v,
|
|
646
|
-
isOtherMonth: !1
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
const M = Math.ceil((d + l) / 7) * 7 - (d + l);
|
|
650
|
-
for (let v = 1; v <= M; v++) {
|
|
651
|
-
const L = new Date(f, y, v);
|
|
652
|
-
m.push({
|
|
653
|
-
date: L,
|
|
654
|
-
year: f,
|
|
655
|
-
month: y,
|
|
656
|
-
day: v,
|
|
657
|
-
isOtherMonth: !0
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
const I = [];
|
|
661
|
-
for (let v = 0; v < m.length; v += 7)
|
|
662
|
-
I.push(m.slice(v, v + 7));
|
|
663
|
-
let b = "";
|
|
664
|
-
for (const v of I) {
|
|
665
|
-
const L = v.map((w) => {
|
|
666
|
-
const _ = e.getDateInfoInternal(w.date);
|
|
667
|
-
return {
|
|
668
|
-
label: (_ == null ? void 0 : _.label) || "",
|
|
669
|
-
tooltip: (_ == null ? void 0 : _.tooltip) || "",
|
|
670
|
-
class: (_ == null ? void 0 : _.class) || ""
|
|
671
|
-
};
|
|
672
|
-
});
|
|
673
|
-
if (L.some((w) => w.label)) {
|
|
674
|
-
b += '<div class="drp-date-picker__badge-row">';
|
|
675
|
-
for (const w of L)
|
|
676
|
-
if (w.label) {
|
|
677
|
-
const _ = w.tooltip ? ` data-tooltip="${w.tooltip.replace(/"/g, """)}"` : "", S = w.class ? ` ${w.class}` : "";
|
|
678
|
-
b += `<div class="drp-date-picker__badge-cell${S}"${_}>${w.label}</div>`;
|
|
679
|
-
} else
|
|
680
|
-
b += '<div class="drp-date-picker__badge-cell"></div>';
|
|
681
|
-
b += "</div>";
|
|
682
|
-
}
|
|
683
|
-
b += '<div class="drp-date-picker__date-row">';
|
|
684
|
-
for (const w of v) {
|
|
685
|
-
const _ = ["drp-date-picker__day"];
|
|
686
|
-
w.isOtherMonth && _.push("drp-date-picker__day--other-month");
|
|
687
|
-
const S = e.isDateDisabledInternal(w.date);
|
|
688
|
-
S && _.push("drp-date-picker__day--disabled");
|
|
689
|
-
const E = e.getDateInfoInternal(w.date);
|
|
690
|
-
E && E.class && _.push(E.class), e.isToday(w.date) && _.push("drp-date-picker__day--today"), e.options.selectionMode === "single" && e.isSameDay(w.date, e.selectedDate) && _.push("drp-date-picker__day--selected");
|
|
691
|
-
const R = e.options.selectionMode === "range" && e.isSameDay(w.date, e.selectedStartDate), N = e.options.selectionMode === "range" && e.isSameDay(w.date, e.selectedEndDate), O = e.options.selectionMode === "range" && e.isInRange(w.date);
|
|
692
|
-
e.options.selectionMode === "range" && (R && _.push("drp-date-picker__day--range-start"), N && _.push("drp-date-picker__day--range-end"), O && (!S || e.options.highlightDisabledInRange) && _.push("drp-date-picker__day--in-range"));
|
|
693
|
-
const T = `${w.year}-${String(w.month + 1).padStart(2, "0")}-${String(w.day).padStart(2, "0")}`;
|
|
694
|
-
b += `<div class="${_.join(" ")}" data-date="${T}" data-day-number="${w.day}">`, b += `<slot name="day-${T}">${w.day}</slot>`, b += "</div>";
|
|
695
|
-
}
|
|
696
|
-
b += "</div>";
|
|
697
|
-
}
|
|
698
|
-
r && (r.innerHTML = b, Qt(e, t, r));
|
|
699
|
-
}
|
|
700
|
-
function Qt(e, t, n) {
|
|
701
|
-
if (!e.options.renderDay && !e.options.renderDayContent)
|
|
702
|
-
return;
|
|
703
|
-
n.querySelectorAll(".drp-date-picker__day").forEach((r) => {
|
|
704
|
-
const o = r, s = o.getAttribute("data-date"), i = parseInt(o.getAttribute("data-day-number") || "0", 10);
|
|
705
|
-
if (!s) return;
|
|
706
|
-
const [d, l, c] = s.split("-"), u = new Date(parseInt(d), parseInt(l) - 1, parseInt(c)), p = o.querySelector(`slot[name="day-${s}"]`);
|
|
707
|
-
if (p && p.assignedNodes().length > 0)
|
|
708
|
-
return;
|
|
709
|
-
const h = e.isDateDisabledInternal(u), f = e.isToday(u), y = u.getDay() === 0 || u.getDay() === 6, m = e.options.selectionMode === "single" && e.isSameDay(u, e.selectedDate), x = e.options.selectionMode === "range" && e.isSameDay(u, e.selectedStartDate), M = e.options.selectionMode === "range" && e.isSameDay(u, e.selectedEndDate), I = e.options.selectionMode === "range" && e.isInRange(u), b = {
|
|
710
|
-
date: u,
|
|
711
|
-
dateString: s,
|
|
712
|
-
dayNumber: i,
|
|
713
|
-
isDisabled: h,
|
|
714
|
-
isSelected: m || x || M,
|
|
715
|
-
isStartDate: x,
|
|
716
|
-
isEndDate: M,
|
|
717
|
-
isInRange: I,
|
|
718
|
-
isToday: f,
|
|
719
|
-
isWeekend: y,
|
|
720
|
-
monthIndex: t,
|
|
721
|
-
element: o,
|
|
722
|
-
picker: e
|
|
723
|
-
};
|
|
724
|
-
if (e.options.renderDay)
|
|
725
|
-
try {
|
|
726
|
-
const v = e.options.renderDay(b);
|
|
727
|
-
v != null && (typeof v == "string" ? p && (p.innerHTML = v) : v instanceof HTMLElement && p && (p.innerHTML = "", p.appendChild(v)));
|
|
728
|
-
} catch (v) {
|
|
729
|
-
console.error("[DatePicker] Error in renderDay callback:", v);
|
|
730
|
-
}
|
|
731
|
-
else if (e.options.renderDayContent)
|
|
732
|
-
try {
|
|
733
|
-
const v = e.options.renderDayContent(b);
|
|
734
|
-
v != null && (typeof v == "string" ? p && (p.innerHTML += v) : v instanceof HTMLElement && p && p.appendChild(v));
|
|
735
|
-
} catch (v) {
|
|
736
|
-
console.error("[DatePicker] Error in renderDayContent callback:", v);
|
|
737
|
-
}
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
function rt(e, t) {
|
|
741
|
-
const n = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${t}"]`);
|
|
742
|
-
if (!n) return;
|
|
743
|
-
const a = n.querySelector(".drp-date-picker__rolling-selector");
|
|
744
|
-
a == null || a.classList.add("drp-date-picker__rolling-selector--visible");
|
|
745
|
-
const r = e.monthDates[t], o = r.getFullYear(), s = r.getMonth(), i = Xt(e.options.rollingYearRange, o, e), d = Gt(e.options.rollingMonthRange), l = a == null ? void 0 : a.querySelector('[data-list="years"]');
|
|
746
|
-
let c = "";
|
|
747
|
-
for (let p = i.min; p <= i.max; p++) {
|
|
748
|
-
const g = p === o ? "drp-date-picker__rolling-item--selected" : "", f = kt(e, p) ? "" : "drp-date-picker__rolling-item--disabled";
|
|
749
|
-
c += `<div class="drp-date-picker__rolling-item ${g} ${f}" data-year="${p}" data-month-index="${t}">${p}</div>`;
|
|
750
|
-
}
|
|
751
|
-
l && (l.innerHTML = c);
|
|
752
|
-
const u = a == null ? void 0 : a.querySelector('[data-list="months"]');
|
|
753
|
-
if (u) {
|
|
754
|
-
let p = "";
|
|
755
|
-
for (let g = d.min - 1; g <= d.max - 1; g++) {
|
|
756
|
-
const h = e.monthNames[g], f = g === s ? "drp-date-picker__rolling-item--selected" : "", m = Re(e, o, g) ? "" : "drp-date-picker__rolling-item--disabled";
|
|
757
|
-
p += `<div class="drp-date-picker__rolling-item ${f} ${m}" data-month="${g}" data-month-index="${t}">${h}</div>`;
|
|
758
|
-
}
|
|
759
|
-
u.innerHTML = p;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
function Zt(e) {
|
|
763
|
-
if (e.options.selectionMode !== "range") return;
|
|
764
|
-
const t = e.calendar.querySelector(".drp-date-picker__summary");
|
|
765
|
-
if (t)
|
|
766
|
-
if (e.selectedStartDate && e.selectedEndDate) {
|
|
767
|
-
let n, a, r, o, s;
|
|
768
|
-
if (e.options.disabledDatesHandling === "individual" || e.options.disabledDatesHandling === "split")
|
|
769
|
-
a = e.getEnabledDatesInRange(
|
|
770
|
-
e.selectedStartDate,
|
|
771
|
-
e.selectedEndDate
|
|
772
|
-
), n = a.length, o = a, e.options.disabledDatesHandling === "split" && (s = e.splitRangeByDisabled(
|
|
773
|
-
e.selectedStartDate,
|
|
774
|
-
e.selectedEndDate
|
|
775
|
-
));
|
|
776
|
-
else if (e.options.disabledDatesHandling === "allow") {
|
|
777
|
-
a = e.getEnabledDatesInRange(
|
|
778
|
-
e.selectedStartDate,
|
|
779
|
-
e.selectedEndDate
|
|
780
|
-
), r = e.getDisabledDatesInRange(
|
|
781
|
-
e.selectedStartDate,
|
|
782
|
-
e.selectedEndDate
|
|
783
|
-
);
|
|
784
|
-
const d = 1e3 * 60 * 60 * 24, l = e.selectedEndDate.getTime() - e.selectedStartDate.getTime();
|
|
785
|
-
n = Math.floor(l / d) + 1;
|
|
786
|
-
} else {
|
|
787
|
-
const l = e.selectedEndDate.getTime() - e.selectedStartDate.getTime();
|
|
788
|
-
n = Math.floor(l / 864e5) + 1;
|
|
789
|
-
}
|
|
790
|
-
const i = n > 0 ? n - 1 : 0;
|
|
791
|
-
if (t.className = "drp-date-picker__summary drp-date-picker__summary--visible", e.options.formatSummaryCallback) {
|
|
792
|
-
const d = {
|
|
793
|
-
days: n,
|
|
794
|
-
nights: i,
|
|
795
|
-
startDate: e.selectedStartDate,
|
|
796
|
-
endDate: e.selectedEndDate,
|
|
797
|
-
selectionMode: e.options.selectionMode,
|
|
798
|
-
disabledDatesHandling: e.options.disabledDatesHandling,
|
|
799
|
-
localeStrings: e.localeStrings,
|
|
800
|
-
isPreview: !1
|
|
801
|
-
};
|
|
802
|
-
a && (d.enabledDates = a), r && (d.disabledDates = r), o && (d.dates = o), s && (d.dateRanges = s), t.innerHTML = e.options.formatSummaryCallback(d);
|
|
803
|
-
} else
|
|
804
|
-
t.innerHTML = `
|
|
805
|
-
<span class="drp-date-picker__summary-count">${n} ${n === 1 ? e.localeStrings.day : e.localeStrings.days}</span>
|
|
806
|
-
<span>, </span>
|
|
807
|
-
<span class="drp-date-picker__summary-count">${i} ${i === 1 ? e.localeStrings.night : e.localeStrings.nights}</span>
|
|
808
|
-
`;
|
|
809
|
-
} else
|
|
810
|
-
t.className = "drp-date-picker__summary drp-date-picker__summary--hidden", t.innerHTML = "";
|
|
811
|
-
}
|
|
812
|
-
function st(e) {
|
|
813
|
-
if (e.options.selectionMode !== "range") return;
|
|
814
|
-
const t = e.calendar.querySelector(".drp-date-picker__summary");
|
|
815
|
-
if (t && e.dragPreviewStart && e.dragPreviewEnd) {
|
|
816
|
-
let n, a, r, o, s;
|
|
817
|
-
if (e.options.disabledDatesHandling === "individual" || e.options.disabledDatesHandling === "split")
|
|
818
|
-
a = e.getEnabledDatesInRange(
|
|
819
|
-
e.dragPreviewStart,
|
|
820
|
-
e.dragPreviewEnd
|
|
821
|
-
), n = a.length, o = a, e.options.disabledDatesHandling === "split" && (s = e.splitRangeByDisabled(
|
|
822
|
-
e.dragPreviewStart,
|
|
823
|
-
e.dragPreviewEnd
|
|
824
|
-
));
|
|
825
|
-
else if (e.options.disabledDatesHandling === "allow") {
|
|
826
|
-
a = e.getEnabledDatesInRange(
|
|
827
|
-
e.dragPreviewStart,
|
|
828
|
-
e.dragPreviewEnd
|
|
829
|
-
), r = e.getDisabledDatesInRange(
|
|
830
|
-
e.dragPreviewStart,
|
|
831
|
-
e.dragPreviewEnd
|
|
832
|
-
);
|
|
833
|
-
const d = 1e3 * 60 * 60 * 24, l = e.dragPreviewEnd.getTime() - e.dragPreviewStart.getTime();
|
|
834
|
-
n = Math.floor(l / d) + 1;
|
|
835
|
-
} else {
|
|
836
|
-
const l = e.dragPreviewEnd.getTime() - e.dragPreviewStart.getTime();
|
|
837
|
-
n = Math.floor(l / 864e5) + 1;
|
|
838
|
-
}
|
|
839
|
-
const i = n > 0 ? n - 1 : 0;
|
|
840
|
-
if (t.className = "drp-date-picker__summary drp-date-picker__summary--visible", e.options.formatSummaryCallback) {
|
|
841
|
-
const d = {
|
|
842
|
-
days: n,
|
|
843
|
-
nights: i,
|
|
844
|
-
startDate: e.dragPreviewStart,
|
|
845
|
-
endDate: e.dragPreviewEnd,
|
|
846
|
-
selectionMode: e.options.selectionMode,
|
|
847
|
-
disabledDatesHandling: e.options.disabledDatesHandling,
|
|
848
|
-
localeStrings: e.localeStrings,
|
|
849
|
-
isPreview: !0
|
|
850
|
-
};
|
|
851
|
-
a && (d.enabledDates = a), r && (d.disabledDates = r), o && (d.dates = o), s && (d.dateRanges = s), t.innerHTML = e.options.formatSummaryCallback(d);
|
|
852
|
-
} else
|
|
853
|
-
t.innerHTML = `
|
|
854
|
-
<span style="opacity: 0.7;">${e.localeStrings.preview}: </span>
|
|
855
|
-
<span class="drp-date-picker__summary-count">${n} ${n === 1 ? e.localeStrings.day : e.localeStrings.days}</span>
|
|
856
|
-
<span>, </span>
|
|
857
|
-
<span class="drp-date-picker__summary-count">${i} ${i === 1 ? e.localeStrings.night : e.localeStrings.nights}</span>
|
|
858
|
-
`;
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
function en(e) {
|
|
862
|
-
if (e.calendar.querySelectorAll(".drp-date-picker__day--drag-preview, .drp-date-picker__day--drag-invalid").forEach((r) => {
|
|
863
|
-
r.classList.remove("drp-date-picker__day--drag-preview", "drp-date-picker__day--drag-invalid");
|
|
864
|
-
}), !e.dragPreviewStart || !e.dragPreviewEnd) return;
|
|
865
|
-
const n = e.options.disabledDatesHandling === "block" && e.hasDisabledDatesInRange(e.dragPreviewStart, e.dragPreviewEnd);
|
|
866
|
-
e.calendar.querySelectorAll(".drp-date-picker__day").forEach((r) => {
|
|
867
|
-
const o = r.dataset.date;
|
|
868
|
-
if (!o) return;
|
|
869
|
-
const [s, i, d] = o.split("-").map(Number), l = new Date(s, i - 1, d);
|
|
870
|
-
l >= e.dragPreviewStart && l <= e.dragPreviewEnd && (r.classList.add("drp-date-picker__day--drag-preview"), n && r.classList.add("drp-date-picker__day--drag-invalid"));
|
|
871
|
-
}), st(e);
|
|
872
|
-
}
|
|
873
|
-
const ge = Math.min, ae = Math.max, _e = Math.round, W = (e) => ({
|
|
874
|
-
x: e,
|
|
875
|
-
y: e
|
|
876
|
-
}), tn = {
|
|
877
|
-
left: "right",
|
|
878
|
-
right: "left",
|
|
879
|
-
bottom: "top",
|
|
880
|
-
top: "bottom"
|
|
881
|
-
}, nn = {
|
|
882
|
-
start: "end",
|
|
883
|
-
end: "start"
|
|
884
|
-
};
|
|
885
|
-
function $e(e, t, n) {
|
|
886
|
-
return ae(e, ge(t, n));
|
|
887
|
-
}
|
|
888
|
-
function he(e, t) {
|
|
889
|
-
return typeof e == "function" ? e(t) : e;
|
|
890
|
-
}
|
|
891
|
-
function ne(e) {
|
|
892
|
-
return e.split("-")[0];
|
|
893
|
-
}
|
|
894
|
-
function me(e) {
|
|
895
|
-
return e.split("-")[1];
|
|
896
|
-
}
|
|
897
|
-
function ot(e) {
|
|
898
|
-
return e === "x" ? "y" : "x";
|
|
899
|
-
}
|
|
900
|
-
function Ne(e) {
|
|
901
|
-
return e === "y" ? "height" : "width";
|
|
902
|
-
}
|
|
903
|
-
const an = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
904
|
-
function Q(e) {
|
|
905
|
-
return an.has(ne(e)) ? "y" : "x";
|
|
906
|
-
}
|
|
907
|
-
function Oe(e) {
|
|
908
|
-
return ot(Q(e));
|
|
909
|
-
}
|
|
910
|
-
function rn(e, t, n) {
|
|
911
|
-
n === void 0 && (n = !1);
|
|
912
|
-
const a = me(e), r = Oe(e), o = Ne(r);
|
|
913
|
-
let s = r === "x" ? a === (n ? "end" : "start") ? "right" : "left" : a === "start" ? "bottom" : "top";
|
|
914
|
-
return t.reference[o] > t.floating[o] && (s = we(s)), [s, we(s)];
|
|
915
|
-
}
|
|
916
|
-
function sn(e) {
|
|
917
|
-
const t = we(e);
|
|
918
|
-
return [Pe(e), t, Pe(t)];
|
|
919
|
-
}
|
|
920
|
-
function Pe(e) {
|
|
921
|
-
return e.replace(/start|end/g, (t) => nn[t]);
|
|
922
|
-
}
|
|
923
|
-
const qe = ["left", "right"], Be = ["right", "left"], on = ["top", "bottom"], dn = ["bottom", "top"];
|
|
924
|
-
function ln(e, t, n) {
|
|
925
|
-
switch (e) {
|
|
926
|
-
case "top":
|
|
927
|
-
case "bottom":
|
|
928
|
-
return n ? t ? Be : qe : t ? qe : Be;
|
|
929
|
-
case "left":
|
|
930
|
-
case "right":
|
|
931
|
-
return t ? on : dn;
|
|
932
|
-
default:
|
|
933
|
-
return [];
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
function cn(e, t, n, a) {
|
|
937
|
-
const r = me(e);
|
|
938
|
-
let o = ln(ne(e), n === "start", a);
|
|
939
|
-
return r && (o = o.map((s) => s + "-" + r), t && (o = o.concat(o.map(Pe)))), o;
|
|
940
|
-
}
|
|
941
|
-
function we(e) {
|
|
942
|
-
return e.replace(/left|right|bottom|top/g, (t) => tn[t]);
|
|
943
|
-
}
|
|
944
|
-
function pn(e) {
|
|
945
|
-
return {
|
|
946
|
-
top: 0,
|
|
947
|
-
right: 0,
|
|
948
|
-
bottom: 0,
|
|
949
|
-
left: 0,
|
|
950
|
-
...e
|
|
951
|
-
};
|
|
952
|
-
}
|
|
953
|
-
function it(e) {
|
|
954
|
-
return typeof e != "number" ? pn(e) : {
|
|
955
|
-
top: e,
|
|
956
|
-
right: e,
|
|
957
|
-
bottom: e,
|
|
958
|
-
left: e
|
|
959
|
-
};
|
|
960
|
-
}
|
|
961
|
-
function xe(e) {
|
|
962
|
-
const {
|
|
963
|
-
x: t,
|
|
964
|
-
y: n,
|
|
965
|
-
width: a,
|
|
966
|
-
height: r
|
|
967
|
-
} = e;
|
|
968
|
-
return {
|
|
969
|
-
width: a,
|
|
970
|
-
height: r,
|
|
971
|
-
top: n,
|
|
972
|
-
left: t,
|
|
973
|
-
right: t + a,
|
|
974
|
-
bottom: n + r,
|
|
975
|
-
x: t,
|
|
976
|
-
y: n
|
|
977
|
-
};
|
|
978
|
-
}
|
|
979
|
-
function We(e, t, n) {
|
|
980
|
-
let {
|
|
981
|
-
reference: a,
|
|
982
|
-
floating: r
|
|
983
|
-
} = e;
|
|
984
|
-
const o = Q(t), s = Oe(t), i = Ne(s), d = ne(t), l = o === "y", c = a.x + a.width / 2 - r.width / 2, u = a.y + a.height / 2 - r.height / 2, p = a[i] / 2 - r[i] / 2;
|
|
985
|
-
let g;
|
|
986
|
-
switch (d) {
|
|
987
|
-
case "top":
|
|
988
|
-
g = {
|
|
989
|
-
x: c,
|
|
990
|
-
y: a.y - r.height
|
|
991
|
-
};
|
|
992
|
-
break;
|
|
993
|
-
case "bottom":
|
|
994
|
-
g = {
|
|
995
|
-
x: c,
|
|
996
|
-
y: a.y + a.height
|
|
997
|
-
};
|
|
998
|
-
break;
|
|
999
|
-
case "right":
|
|
1000
|
-
g = {
|
|
1001
|
-
x: a.x + a.width,
|
|
1002
|
-
y: u
|
|
1003
|
-
};
|
|
1004
|
-
break;
|
|
1005
|
-
case "left":
|
|
1006
|
-
g = {
|
|
1007
|
-
x: a.x - r.width,
|
|
1008
|
-
y: u
|
|
1009
|
-
};
|
|
1010
|
-
break;
|
|
1011
|
-
default:
|
|
1012
|
-
g = {
|
|
1013
|
-
x: a.x,
|
|
1014
|
-
y: a.y
|
|
1015
|
-
};
|
|
1016
|
-
}
|
|
1017
|
-
switch (me(t)) {
|
|
1018
|
-
case "start":
|
|
1019
|
-
g[s] -= p * (n && l ? -1 : 1);
|
|
1020
|
-
break;
|
|
1021
|
-
case "end":
|
|
1022
|
-
g[s] += p * (n && l ? -1 : 1);
|
|
1023
|
-
break;
|
|
1024
|
-
}
|
|
1025
|
-
return g;
|
|
1026
|
-
}
|
|
1027
|
-
const un = async (e, t, n) => {
|
|
1028
|
-
const {
|
|
1029
|
-
placement: a = "bottom",
|
|
1030
|
-
strategy: r = "absolute",
|
|
1031
|
-
middleware: o = [],
|
|
1032
|
-
platform: s
|
|
1033
|
-
} = n, i = o.filter(Boolean), d = await (s.isRTL == null ? void 0 : s.isRTL(t));
|
|
1034
|
-
let l = await s.getElementRects({
|
|
1035
|
-
reference: e,
|
|
1036
|
-
floating: t,
|
|
1037
|
-
strategy: r
|
|
1038
|
-
}), {
|
|
1039
|
-
x: c,
|
|
1040
|
-
y: u
|
|
1041
|
-
} = We(l, a, d), p = a, g = {}, h = 0;
|
|
1042
|
-
for (let f = 0; f < i.length; f++) {
|
|
1043
|
-
const {
|
|
1044
|
-
name: y,
|
|
1045
|
-
fn: m
|
|
1046
|
-
} = i[f], {
|
|
1047
|
-
x,
|
|
1048
|
-
y: M,
|
|
1049
|
-
data: I,
|
|
1050
|
-
reset: b
|
|
1051
|
-
} = await m({
|
|
1052
|
-
x: c,
|
|
1053
|
-
y: u,
|
|
1054
|
-
initialPlacement: a,
|
|
1055
|
-
placement: p,
|
|
1056
|
-
strategy: r,
|
|
1057
|
-
middlewareData: g,
|
|
1058
|
-
rects: l,
|
|
1059
|
-
platform: s,
|
|
1060
|
-
elements: {
|
|
1061
|
-
reference: e,
|
|
1062
|
-
floating: t
|
|
1063
|
-
}
|
|
1064
|
-
});
|
|
1065
|
-
c = x ?? c, u = M ?? u, g = {
|
|
1066
|
-
...g,
|
|
1067
|
-
[y]: {
|
|
1068
|
-
...g[y],
|
|
1069
|
-
...I
|
|
1070
|
-
}
|
|
1071
|
-
}, b && h <= 50 && (h++, typeof b == "object" && (b.placement && (p = b.placement), b.rects && (l = b.rects === !0 ? await s.getElementRects({
|
|
1072
|
-
reference: e,
|
|
1073
|
-
floating: t,
|
|
1074
|
-
strategy: r
|
|
1075
|
-
}) : b.rects), {
|
|
1076
|
-
x: c,
|
|
1077
|
-
y: u
|
|
1078
|
-
} = We(l, p, d)), f = -1);
|
|
1079
|
-
}
|
|
1080
|
-
return {
|
|
1081
|
-
x: c,
|
|
1082
|
-
y: u,
|
|
1083
|
-
placement: p,
|
|
1084
|
-
strategy: r,
|
|
1085
|
-
middlewareData: g
|
|
1086
|
-
};
|
|
1087
|
-
};
|
|
1088
|
-
async function dt(e, t) {
|
|
1089
|
-
var n;
|
|
1090
|
-
t === void 0 && (t = {});
|
|
1091
|
-
const {
|
|
1092
|
-
x: a,
|
|
1093
|
-
y: r,
|
|
1094
|
-
platform: o,
|
|
1095
|
-
rects: s,
|
|
1096
|
-
elements: i,
|
|
1097
|
-
strategy: d
|
|
1098
|
-
} = e, {
|
|
1099
|
-
boundary: l = "clippingAncestors",
|
|
1100
|
-
rootBoundary: c = "viewport",
|
|
1101
|
-
elementContext: u = "floating",
|
|
1102
|
-
altBoundary: p = !1,
|
|
1103
|
-
padding: g = 0
|
|
1104
|
-
} = he(t, e), h = it(g), y = i[p ? u === "floating" ? "reference" : "floating" : u], m = xe(await o.getClippingRect({
|
|
1105
|
-
element: (n = await (o.isElement == null ? void 0 : o.isElement(y))) == null || n ? y : y.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(i.floating)),
|
|
1106
|
-
boundary: l,
|
|
1107
|
-
rootBoundary: c,
|
|
1108
|
-
strategy: d
|
|
1109
|
-
})), x = u === "floating" ? {
|
|
1110
|
-
x: a,
|
|
1111
|
-
y: r,
|
|
1112
|
-
width: s.floating.width,
|
|
1113
|
-
height: s.floating.height
|
|
1114
|
-
} : s.reference, M = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(i.floating)), I = await (o.isElement == null ? void 0 : o.isElement(M)) ? await (o.getScale == null ? void 0 : o.getScale(M)) || {
|
|
1115
|
-
x: 1,
|
|
1116
|
-
y: 1
|
|
1117
|
-
} : {
|
|
1118
|
-
x: 1,
|
|
1119
|
-
y: 1
|
|
1120
|
-
}, b = xe(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
1121
|
-
elements: i,
|
|
1122
|
-
rect: x,
|
|
1123
|
-
offsetParent: M,
|
|
1124
|
-
strategy: d
|
|
1125
|
-
}) : x);
|
|
1126
|
-
return {
|
|
1127
|
-
top: (m.top - b.top + h.top) / I.y,
|
|
1128
|
-
bottom: (b.bottom - m.bottom + h.bottom) / I.y,
|
|
1129
|
-
left: (m.left - b.left + h.left) / I.x,
|
|
1130
|
-
right: (b.right - m.right + h.right) / I.x
|
|
1131
|
-
};
|
|
1132
|
-
}
|
|
1133
|
-
const gn = (e) => ({
|
|
1134
|
-
name: "arrow",
|
|
1135
|
-
options: e,
|
|
1136
|
-
async fn(t) {
|
|
1137
|
-
const {
|
|
1138
|
-
x: n,
|
|
1139
|
-
y: a,
|
|
1140
|
-
placement: r,
|
|
1141
|
-
rects: o,
|
|
1142
|
-
platform: s,
|
|
1143
|
-
elements: i,
|
|
1144
|
-
middlewareData: d
|
|
1145
|
-
} = t, {
|
|
1146
|
-
element: l,
|
|
1147
|
-
padding: c = 0
|
|
1148
|
-
} = he(e, t) || {};
|
|
1149
|
-
if (l == null)
|
|
1150
|
-
return {};
|
|
1151
|
-
const u = it(c), p = {
|
|
1152
|
-
x: n,
|
|
1153
|
-
y: a
|
|
1154
|
-
}, g = Oe(r), h = Ne(g), f = await s.getDimensions(l), y = g === "y", m = y ? "top" : "left", x = y ? "bottom" : "right", M = y ? "clientHeight" : "clientWidth", I = o.reference[h] + o.reference[g] - p[g] - o.floating[h], b = p[g] - o.reference[g], v = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l));
|
|
1155
|
-
let L = v ? v[M] : 0;
|
|
1156
|
-
(!L || !await (s.isElement == null ? void 0 : s.isElement(v))) && (L = i.floating[M] || o.floating[h]);
|
|
1157
|
-
const A = I / 2 - b / 2, w = L / 2 - f[h] / 2 - 1, _ = ge(u[m], w), S = ge(u[x], w), E = _, P = L - f[h] - S, R = L / 2 - f[h] / 2 + A, N = $e(E, R, P), O = !d.arrow && me(r) != null && R !== N && o.reference[h] / 2 - (R < E ? _ : S) - f[h] / 2 < 0, T = O ? R < E ? R - E : R - P : 0;
|
|
1158
|
-
return {
|
|
1159
|
-
[g]: p[g] + T,
|
|
1160
|
-
data: {
|
|
1161
|
-
[g]: N,
|
|
1162
|
-
centerOffset: R - N - T,
|
|
1163
|
-
...O && {
|
|
1164
|
-
alignmentOffset: T
|
|
1165
|
-
}
|
|
1166
|
-
},
|
|
1167
|
-
reset: O
|
|
1168
|
-
};
|
|
1169
|
-
}
|
|
1170
|
-
}), fn = function(e) {
|
|
1171
|
-
return e === void 0 && (e = {}), {
|
|
1172
|
-
name: "flip",
|
|
1173
|
-
options: e,
|
|
1174
|
-
async fn(t) {
|
|
1175
|
-
var n, a;
|
|
1176
|
-
const {
|
|
1177
|
-
placement: r,
|
|
1178
|
-
middlewareData: o,
|
|
1179
|
-
rects: s,
|
|
1180
|
-
initialPlacement: i,
|
|
1181
|
-
platform: d,
|
|
1182
|
-
elements: l
|
|
1183
|
-
} = t, {
|
|
1184
|
-
mainAxis: c = !0,
|
|
1185
|
-
crossAxis: u = !0,
|
|
1186
|
-
fallbackPlacements: p,
|
|
1187
|
-
fallbackStrategy: g = "bestFit",
|
|
1188
|
-
fallbackAxisSideDirection: h = "none",
|
|
1189
|
-
flipAlignment: f = !0,
|
|
1190
|
-
...y
|
|
1191
|
-
} = he(e, t);
|
|
1192
|
-
if ((n = o.arrow) != null && n.alignmentOffset)
|
|
1193
|
-
return {};
|
|
1194
|
-
const m = ne(r), x = Q(i), M = ne(i) === i, I = await (d.isRTL == null ? void 0 : d.isRTL(l.floating)), b = p || (M || !f ? [we(i)] : sn(i)), v = h !== "none";
|
|
1195
|
-
!p && v && b.push(...cn(i, f, h, I));
|
|
1196
|
-
const L = [i, ...b], A = await dt(t, y), w = [];
|
|
1197
|
-
let _ = ((a = o.flip) == null ? void 0 : a.overflows) || [];
|
|
1198
|
-
if (c && w.push(A[m]), u) {
|
|
1199
|
-
const R = rn(r, s, I);
|
|
1200
|
-
w.push(A[R[0]], A[R[1]]);
|
|
1201
|
-
}
|
|
1202
|
-
if (_ = [..._, {
|
|
1203
|
-
placement: r,
|
|
1204
|
-
overflows: w
|
|
1205
|
-
}], !w.every((R) => R <= 0)) {
|
|
1206
|
-
var S, E;
|
|
1207
|
-
const R = (((S = o.flip) == null ? void 0 : S.index) || 0) + 1, N = L[R];
|
|
1208
|
-
if (N && (!(u === "alignment" ? x !== Q(N) : !1) || // We leave the current main axis only if every placement on that axis
|
|
1209
|
-
// overflows the main axis.
|
|
1210
|
-
_.every((H) => Q(H.placement) === x ? H.overflows[0] > 0 : !0)))
|
|
1211
|
-
return {
|
|
1212
|
-
data: {
|
|
1213
|
-
index: R,
|
|
1214
|
-
overflows: _
|
|
1215
|
-
},
|
|
1216
|
-
reset: {
|
|
1217
|
-
placement: N
|
|
1218
|
-
}
|
|
1219
|
-
};
|
|
1220
|
-
let O = (E = _.filter((T) => T.overflows[0] <= 0).sort((T, H) => T.overflows[1] - H.overflows[1])[0]) == null ? void 0 : E.placement;
|
|
1221
|
-
if (!O)
|
|
1222
|
-
switch (g) {
|
|
1223
|
-
case "bestFit": {
|
|
1224
|
-
var P;
|
|
1225
|
-
const T = (P = _.filter((H) => {
|
|
1226
|
-
if (v) {
|
|
1227
|
-
const J = Q(H.placement);
|
|
1228
|
-
return J === x || // Create a bias to the `y` side axis due to horizontal
|
|
1229
|
-
// reading directions favoring greater width.
|
|
1230
|
-
J === "y";
|
|
1231
|
-
}
|
|
1232
|
-
return !0;
|
|
1233
|
-
}).map((H) => [H.placement, H.overflows.filter((J) => J > 0).reduce((J, Lt) => J + Lt, 0)]).sort((H, J) => H[1] - J[1])[0]) == null ? void 0 : P[0];
|
|
1234
|
-
T && (O = T);
|
|
1235
|
-
break;
|
|
1236
|
-
}
|
|
1237
|
-
case "initialPlacement":
|
|
1238
|
-
O = i;
|
|
1239
|
-
break;
|
|
1240
|
-
}
|
|
1241
|
-
if (r !== O)
|
|
1242
|
-
return {
|
|
1243
|
-
reset: {
|
|
1244
|
-
placement: O
|
|
1245
|
-
}
|
|
1246
|
-
};
|
|
1247
|
-
}
|
|
1248
|
-
return {};
|
|
1249
|
-
}
|
|
1250
|
-
};
|
|
1251
|
-
}, hn = /* @__PURE__ */ new Set(["left", "top"]);
|
|
1252
|
-
async function mn(e, t) {
|
|
1253
|
-
const {
|
|
1254
|
-
placement: n,
|
|
1255
|
-
platform: a,
|
|
1256
|
-
elements: r
|
|
1257
|
-
} = e, o = await (a.isRTL == null ? void 0 : a.isRTL(r.floating)), s = ne(n), i = me(n), d = Q(n) === "y", l = hn.has(s) ? -1 : 1, c = o && d ? -1 : 1, u = he(t, e);
|
|
1258
|
-
let {
|
|
1259
|
-
mainAxis: p,
|
|
1260
|
-
crossAxis: g,
|
|
1261
|
-
alignmentAxis: h
|
|
1262
|
-
} = typeof u == "number" ? {
|
|
1263
|
-
mainAxis: u,
|
|
1264
|
-
crossAxis: 0,
|
|
1265
|
-
alignmentAxis: null
|
|
1266
|
-
} : {
|
|
1267
|
-
mainAxis: u.mainAxis || 0,
|
|
1268
|
-
crossAxis: u.crossAxis || 0,
|
|
1269
|
-
alignmentAxis: u.alignmentAxis
|
|
1270
|
-
};
|
|
1271
|
-
return i && typeof h == "number" && (g = i === "end" ? h * -1 : h), d ? {
|
|
1272
|
-
x: g * c,
|
|
1273
|
-
y: p * l
|
|
1274
|
-
} : {
|
|
1275
|
-
x: p * l,
|
|
1276
|
-
y: g * c
|
|
1277
|
-
};
|
|
1278
|
-
}
|
|
1279
|
-
const yn = function(e) {
|
|
1280
|
-
return e === void 0 && (e = 0), {
|
|
1281
|
-
name: "offset",
|
|
1282
|
-
options: e,
|
|
1283
|
-
async fn(t) {
|
|
1284
|
-
var n, a;
|
|
1285
|
-
const {
|
|
1286
|
-
x: r,
|
|
1287
|
-
y: o,
|
|
1288
|
-
placement: s,
|
|
1289
|
-
middlewareData: i
|
|
1290
|
-
} = t, d = await mn(t, e);
|
|
1291
|
-
return s === ((n = i.offset) == null ? void 0 : n.placement) && (a = i.arrow) != null && a.alignmentOffset ? {} : {
|
|
1292
|
-
x: r + d.x,
|
|
1293
|
-
y: o + d.y,
|
|
1294
|
-
data: {
|
|
1295
|
-
...d,
|
|
1296
|
-
placement: s
|
|
1297
|
-
}
|
|
1298
|
-
};
|
|
1299
|
-
}
|
|
1300
|
-
};
|
|
1301
|
-
}, vn = function(e) {
|
|
1302
|
-
return e === void 0 && (e = {}), {
|
|
1303
|
-
name: "shift",
|
|
1304
|
-
options: e,
|
|
1305
|
-
async fn(t) {
|
|
1306
|
-
const {
|
|
1307
|
-
x: n,
|
|
1308
|
-
y: a,
|
|
1309
|
-
placement: r
|
|
1310
|
-
} = t, {
|
|
1311
|
-
mainAxis: o = !0,
|
|
1312
|
-
crossAxis: s = !1,
|
|
1313
|
-
limiter: i = {
|
|
1314
|
-
fn: (y) => {
|
|
1315
|
-
let {
|
|
1316
|
-
x: m,
|
|
1317
|
-
y: x
|
|
1318
|
-
} = y;
|
|
1319
|
-
return {
|
|
1320
|
-
x: m,
|
|
1321
|
-
y: x
|
|
1322
|
-
};
|
|
1323
|
-
}
|
|
1324
|
-
},
|
|
1325
|
-
...d
|
|
1326
|
-
} = he(e, t), l = {
|
|
1327
|
-
x: n,
|
|
1328
|
-
y: a
|
|
1329
|
-
}, c = await dt(t, d), u = Q(ne(r)), p = ot(u);
|
|
1330
|
-
let g = l[p], h = l[u];
|
|
1331
|
-
if (o) {
|
|
1332
|
-
const y = p === "y" ? "top" : "left", m = p === "y" ? "bottom" : "right", x = g + c[y], M = g - c[m];
|
|
1333
|
-
g = $e(x, g, M);
|
|
1334
|
-
}
|
|
1335
|
-
if (s) {
|
|
1336
|
-
const y = u === "y" ? "top" : "left", m = u === "y" ? "bottom" : "right", x = h + c[y], M = h - c[m];
|
|
1337
|
-
h = $e(x, h, M);
|
|
1338
|
-
}
|
|
1339
|
-
const f = i.fn({
|
|
1340
|
-
...t,
|
|
1341
|
-
[p]: g,
|
|
1342
|
-
[u]: h
|
|
1343
|
-
});
|
|
1344
|
-
return {
|
|
1345
|
-
...f,
|
|
1346
|
-
data: {
|
|
1347
|
-
x: f.x - n,
|
|
1348
|
-
y: f.y - a,
|
|
1349
|
-
enabled: {
|
|
1350
|
-
[p]: o,
|
|
1351
|
-
[u]: s
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
};
|
|
1355
|
-
}
|
|
1356
|
-
};
|
|
1357
|
-
};
|
|
1358
|
-
function Me() {
|
|
1359
|
-
return typeof window < "u";
|
|
1360
|
-
}
|
|
1361
|
-
function ie(e) {
|
|
1362
|
-
return lt(e) ? (e.nodeName || "").toLowerCase() : "#document";
|
|
1363
|
-
}
|
|
1364
|
-
function z(e) {
|
|
1365
|
-
var t;
|
|
1366
|
-
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
1367
|
-
}
|
|
1368
|
-
function G(e) {
|
|
1369
|
-
var t;
|
|
1370
|
-
return (t = (lt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
|
|
1371
|
-
}
|
|
1372
|
-
function lt(e) {
|
|
1373
|
-
return Me() ? e instanceof Node || e instanceof z(e).Node : !1;
|
|
1374
|
-
}
|
|
1375
|
-
function Y(e) {
|
|
1376
|
-
return Me() ? e instanceof Element || e instanceof z(e).Element : !1;
|
|
1377
|
-
}
|
|
1378
|
-
function j(e) {
|
|
1379
|
-
return Me() ? e instanceof HTMLElement || e instanceof z(e).HTMLElement : !1;
|
|
1380
|
-
}
|
|
1381
|
-
function je(e) {
|
|
1382
|
-
return !Me() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof z(e).ShadowRoot;
|
|
1383
|
-
}
|
|
1384
|
-
const Dn = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
1385
|
-
function ye(e) {
|
|
1386
|
-
const {
|
|
1387
|
-
overflow: t,
|
|
1388
|
-
overflowX: n,
|
|
1389
|
-
overflowY: a,
|
|
1390
|
-
display: r
|
|
1391
|
-
} = V(e);
|
|
1392
|
-
return /auto|scroll|overlay|hidden|clip/.test(t + a + n) && !Dn.has(r);
|
|
1393
|
-
}
|
|
1394
|
-
const bn = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
1395
|
-
function _n(e) {
|
|
1396
|
-
return bn.has(ie(e));
|
|
1397
|
-
}
|
|
1398
|
-
const wn = [":popover-open", ":modal"];
|
|
1399
|
-
function Ie(e) {
|
|
1400
|
-
return wn.some((t) => {
|
|
1401
|
-
try {
|
|
1402
|
-
return e.matches(t);
|
|
1403
|
-
} catch {
|
|
1404
|
-
return !1;
|
|
1405
|
-
}
|
|
1406
|
-
});
|
|
1407
|
-
}
|
|
1408
|
-
const xn = ["transform", "translate", "scale", "rotate", "perspective"], Sn = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Mn = ["paint", "layout", "strict", "content"];
|
|
1409
|
-
function He(e) {
|
|
1410
|
-
const t = Ye(), n = Y(e) ? V(e) : e;
|
|
1411
|
-
return xn.some((a) => n[a] ? n[a] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || Sn.some((a) => (n.willChange || "").includes(a)) || Mn.some((a) => (n.contain || "").includes(a));
|
|
1412
|
-
}
|
|
1413
|
-
function In(e) {
|
|
1414
|
-
let t = ee(e);
|
|
1415
|
-
for (; j(t) && !se(t); ) {
|
|
1416
|
-
if (He(t))
|
|
1417
|
-
return t;
|
|
1418
|
-
if (Ie(t))
|
|
1419
|
-
return null;
|
|
1420
|
-
t = ee(t);
|
|
1421
|
-
}
|
|
1422
|
-
return null;
|
|
1423
|
-
}
|
|
1424
|
-
function Ye() {
|
|
1425
|
-
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
1426
|
-
}
|
|
1427
|
-
const En = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
1428
|
-
function se(e) {
|
|
1429
|
-
return En.has(ie(e));
|
|
1430
|
-
}
|
|
1431
|
-
function V(e) {
|
|
1432
|
-
return z(e).getComputedStyle(e);
|
|
1433
|
-
}
|
|
1434
|
-
function Ee(e) {
|
|
1435
|
-
return Y(e) ? {
|
|
1436
|
-
scrollLeft: e.scrollLeft,
|
|
1437
|
-
scrollTop: e.scrollTop
|
|
1438
|
-
} : {
|
|
1439
|
-
scrollLeft: e.scrollX,
|
|
1440
|
-
scrollTop: e.scrollY
|
|
1441
|
-
};
|
|
1442
|
-
}
|
|
1443
|
-
function ee(e) {
|
|
1444
|
-
if (ie(e) === "html")
|
|
1445
|
-
return e;
|
|
1446
|
-
const t = (
|
|
1447
|
-
// Step into the shadow DOM of the parent of a slotted node.
|
|
1448
|
-
e.assignedSlot || // DOM Element detected.
|
|
1449
|
-
e.parentNode || // ShadowRoot detected.
|
|
1450
|
-
je(e) && e.host || // Fallback.
|
|
1451
|
-
G(e)
|
|
1452
|
-
);
|
|
1453
|
-
return je(t) ? t.host : t;
|
|
1454
|
-
}
|
|
1455
|
-
function ct(e) {
|
|
1456
|
-
const t = ee(e);
|
|
1457
|
-
return se(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : j(t) && ye(t) ? t : ct(t);
|
|
1458
|
-
}
|
|
1459
|
-
function pt(e, t, n) {
|
|
1460
|
-
var a;
|
|
1461
|
-
t === void 0 && (t = []);
|
|
1462
|
-
const r = ct(e), o = r === ((a = e.ownerDocument) == null ? void 0 : a.body), s = z(r);
|
|
1463
|
-
return o ? (ke(s), t.concat(s, s.visualViewport || [], ye(r) ? r : [], [])) : t.concat(r, pt(r, []));
|
|
1464
|
-
}
|
|
1465
|
-
function ke(e) {
|
|
1466
|
-
return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
|
|
1467
|
-
}
|
|
1468
|
-
function ut(e) {
|
|
1469
|
-
const t = V(e);
|
|
1470
|
-
let n = parseFloat(t.width) || 0, a = parseFloat(t.height) || 0;
|
|
1471
|
-
const r = j(e), o = r ? e.offsetWidth : n, s = r ? e.offsetHeight : a, i = _e(n) !== o || _e(a) !== s;
|
|
1472
|
-
return i && (n = o, a = s), {
|
|
1473
|
-
width: n,
|
|
1474
|
-
height: a,
|
|
1475
|
-
$: i
|
|
1476
|
-
};
|
|
1477
|
-
}
|
|
1478
|
-
function gt(e) {
|
|
1479
|
-
return Y(e) ? e : e.contextElement;
|
|
1480
|
-
}
|
|
1481
|
-
function re(e) {
|
|
1482
|
-
const t = gt(e);
|
|
1483
|
-
if (!j(t))
|
|
1484
|
-
return W(1);
|
|
1485
|
-
const n = t.getBoundingClientRect(), {
|
|
1486
|
-
width: a,
|
|
1487
|
-
height: r,
|
|
1488
|
-
$: o
|
|
1489
|
-
} = ut(t);
|
|
1490
|
-
let s = (o ? _e(n.width) : n.width) / a, i = (o ? _e(n.height) : n.height) / r;
|
|
1491
|
-
return (!s || !Number.isFinite(s)) && (s = 1), (!i || !Number.isFinite(i)) && (i = 1), {
|
|
1492
|
-
x: s,
|
|
1493
|
-
y: i
|
|
1494
|
-
};
|
|
1495
|
-
}
|
|
1496
|
-
const Cn = /* @__PURE__ */ W(0);
|
|
1497
|
-
function ft(e) {
|
|
1498
|
-
const t = z(e);
|
|
1499
|
-
return !Ye() || !t.visualViewport ? Cn : {
|
|
1500
|
-
x: t.visualViewport.offsetLeft,
|
|
1501
|
-
y: t.visualViewport.offsetTop
|
|
1502
|
-
};
|
|
1503
|
-
}
|
|
1504
|
-
function Ln(e, t, n) {
|
|
1505
|
-
return t === void 0 && (t = !1), !n || t && n !== z(e) ? !1 : t;
|
|
1506
|
-
}
|
|
1507
|
-
function fe(e, t, n, a) {
|
|
1508
|
-
t === void 0 && (t = !1), n === void 0 && (n = !1);
|
|
1509
|
-
const r = e.getBoundingClientRect(), o = gt(e);
|
|
1510
|
-
let s = W(1);
|
|
1511
|
-
t && (a ? Y(a) && (s = re(a)) : s = re(e));
|
|
1512
|
-
const i = Ln(o, n, a) ? ft(o) : W(0);
|
|
1513
|
-
let d = (r.left + i.x) / s.x, l = (r.top + i.y) / s.y, c = r.width / s.x, u = r.height / s.y;
|
|
1514
|
-
if (o) {
|
|
1515
|
-
const p = z(o), g = a && Y(a) ? z(a) : a;
|
|
1516
|
-
let h = p, f = ke(h);
|
|
1517
|
-
for (; f && a && g !== h; ) {
|
|
1518
|
-
const y = re(f), m = f.getBoundingClientRect(), x = V(f), M = m.left + (f.clientLeft + parseFloat(x.paddingLeft)) * y.x, I = m.top + (f.clientTop + parseFloat(x.paddingTop)) * y.y;
|
|
1519
|
-
d *= y.x, l *= y.y, c *= y.x, u *= y.y, d += M, l += I, h = z(f), f = ke(h);
|
|
1520
|
-
}
|
|
1521
|
-
}
|
|
1522
|
-
return xe({
|
|
1523
|
-
width: c,
|
|
1524
|
-
height: u,
|
|
1525
|
-
x: d,
|
|
1526
|
-
y: l
|
|
1527
|
-
});
|
|
1528
|
-
}
|
|
1529
|
-
function Ce(e, t) {
|
|
1530
|
-
const n = Ee(e).scrollLeft;
|
|
1531
|
-
return t ? t.left + n : fe(G(e)).left + n;
|
|
1532
|
-
}
|
|
1533
|
-
function ht(e, t) {
|
|
1534
|
-
const n = e.getBoundingClientRect(), a = n.left + t.scrollLeft - Ce(e, n), r = n.top + t.scrollTop;
|
|
1535
|
-
return {
|
|
1536
|
-
x: a,
|
|
1537
|
-
y: r
|
|
1538
|
-
};
|
|
1539
|
-
}
|
|
1540
|
-
function An(e) {
|
|
1541
|
-
let {
|
|
1542
|
-
elements: t,
|
|
1543
|
-
rect: n,
|
|
1544
|
-
offsetParent: a,
|
|
1545
|
-
strategy: r
|
|
1546
|
-
} = e;
|
|
1547
|
-
const o = r === "fixed", s = G(a), i = t ? Ie(t.floating) : !1;
|
|
1548
|
-
if (a === s || i && o)
|
|
1549
|
-
return n;
|
|
1550
|
-
let d = {
|
|
1551
|
-
scrollLeft: 0,
|
|
1552
|
-
scrollTop: 0
|
|
1553
|
-
}, l = W(1);
|
|
1554
|
-
const c = W(0), u = j(a);
|
|
1555
|
-
if ((u || !u && !o) && ((ie(a) !== "body" || ye(s)) && (d = Ee(a)), j(a))) {
|
|
1556
|
-
const g = fe(a);
|
|
1557
|
-
l = re(a), c.x = g.x + a.clientLeft, c.y = g.y + a.clientTop;
|
|
1558
|
-
}
|
|
1559
|
-
const p = s && !u && !o ? ht(s, d) : W(0);
|
|
1560
|
-
return {
|
|
1561
|
-
width: n.width * l.x,
|
|
1562
|
-
height: n.height * l.y,
|
|
1563
|
-
x: n.x * l.x - d.scrollLeft * l.x + c.x + p.x,
|
|
1564
|
-
y: n.y * l.y - d.scrollTop * l.y + c.y + p.y
|
|
1565
|
-
};
|
|
1566
|
-
}
|
|
1567
|
-
function Rn(e) {
|
|
1568
|
-
return Array.from(e.getClientRects());
|
|
1569
|
-
}
|
|
1570
|
-
function $n(e) {
|
|
1571
|
-
const t = G(e), n = Ee(e), a = e.ownerDocument.body, r = ae(t.scrollWidth, t.clientWidth, a.scrollWidth, a.clientWidth), o = ae(t.scrollHeight, t.clientHeight, a.scrollHeight, a.clientHeight);
|
|
1572
|
-
let s = -n.scrollLeft + Ce(e);
|
|
1573
|
-
const i = -n.scrollTop;
|
|
1574
|
-
return V(a).direction === "rtl" && (s += ae(t.clientWidth, a.clientWidth) - r), {
|
|
1575
|
-
width: r,
|
|
1576
|
-
height: o,
|
|
1577
|
-
x: s,
|
|
1578
|
-
y: i
|
|
1579
|
-
};
|
|
1580
|
-
}
|
|
1581
|
-
const Ke = 25;
|
|
1582
|
-
function Pn(e, t) {
|
|
1583
|
-
const n = z(e), a = G(e), r = n.visualViewport;
|
|
1584
|
-
let o = a.clientWidth, s = a.clientHeight, i = 0, d = 0;
|
|
1585
|
-
if (r) {
|
|
1586
|
-
o = r.width, s = r.height;
|
|
1587
|
-
const c = Ye();
|
|
1588
|
-
(!c || c && t === "fixed") && (i = r.offsetLeft, d = r.offsetTop);
|
|
1589
|
-
}
|
|
1590
|
-
const l = Ce(a);
|
|
1591
|
-
if (l <= 0) {
|
|
1592
|
-
const c = a.ownerDocument, u = c.body, p = getComputedStyle(u), g = c.compatMode === "CSS1Compat" && parseFloat(p.marginLeft) + parseFloat(p.marginRight) || 0, h = Math.abs(a.clientWidth - u.clientWidth - g);
|
|
1593
|
-
h <= Ke && (o -= h);
|
|
1594
|
-
} else l <= Ke && (o += l);
|
|
1595
|
-
return {
|
|
1596
|
-
width: o,
|
|
1597
|
-
height: s,
|
|
1598
|
-
x: i,
|
|
1599
|
-
y: d
|
|
1600
|
-
};
|
|
1601
|
-
}
|
|
1602
|
-
const kn = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
1603
|
-
function Tn(e, t) {
|
|
1604
|
-
const n = fe(e, !0, t === "fixed"), a = n.top + e.clientTop, r = n.left + e.clientLeft, o = j(e) ? re(e) : W(1), s = e.clientWidth * o.x, i = e.clientHeight * o.y, d = r * o.x, l = a * o.y;
|
|
1605
|
-
return {
|
|
1606
|
-
width: s,
|
|
1607
|
-
height: i,
|
|
1608
|
-
x: d,
|
|
1609
|
-
y: l
|
|
1610
|
-
};
|
|
1611
|
-
}
|
|
1612
|
-
function Ue(e, t, n) {
|
|
1613
|
-
let a;
|
|
1614
|
-
if (t === "viewport")
|
|
1615
|
-
a = Pn(e, n);
|
|
1616
|
-
else if (t === "document")
|
|
1617
|
-
a = $n(G(e));
|
|
1618
|
-
else if (Y(t))
|
|
1619
|
-
a = Tn(t, n);
|
|
1620
|
-
else {
|
|
1621
|
-
const r = ft(e);
|
|
1622
|
-
a = {
|
|
1623
|
-
x: t.x - r.x,
|
|
1624
|
-
y: t.y - r.y,
|
|
1625
|
-
width: t.width,
|
|
1626
|
-
height: t.height
|
|
1627
|
-
};
|
|
1628
|
-
}
|
|
1629
|
-
return xe(a);
|
|
1630
|
-
}
|
|
1631
|
-
function mt(e, t) {
|
|
1632
|
-
const n = ee(e);
|
|
1633
|
-
return n === t || !Y(n) || se(n) ? !1 : V(n).position === "fixed" || mt(n, t);
|
|
1634
|
-
}
|
|
1635
|
-
function zn(e, t) {
|
|
1636
|
-
const n = t.get(e);
|
|
1637
|
-
if (n)
|
|
1638
|
-
return n;
|
|
1639
|
-
let a = pt(e, []).filter((i) => Y(i) && ie(i) !== "body"), r = null;
|
|
1640
|
-
const o = V(e).position === "fixed";
|
|
1641
|
-
let s = o ? ee(e) : e;
|
|
1642
|
-
for (; Y(s) && !se(s); ) {
|
|
1643
|
-
const i = V(s), d = He(s);
|
|
1644
|
-
!d && i.position === "fixed" && (r = null), (o ? !d && !r : !d && i.position === "static" && !!r && kn.has(r.position) || ye(s) && !d && mt(e, s)) ? a = a.filter((c) => c !== s) : r = i, s = ee(s);
|
|
1645
|
-
}
|
|
1646
|
-
return t.set(e, a), a;
|
|
1647
|
-
}
|
|
1648
|
-
function Fn(e) {
|
|
1649
|
-
let {
|
|
1650
|
-
element: t,
|
|
1651
|
-
boundary: n,
|
|
1652
|
-
rootBoundary: a,
|
|
1653
|
-
strategy: r
|
|
1654
|
-
} = e;
|
|
1655
|
-
const s = [...n === "clippingAncestors" ? Ie(t) ? [] : zn(t, this._c) : [].concat(n), a], i = s[0], d = s.reduce((l, c) => {
|
|
1656
|
-
const u = Ue(t, c, r);
|
|
1657
|
-
return l.top = ae(u.top, l.top), l.right = ge(u.right, l.right), l.bottom = ge(u.bottom, l.bottom), l.left = ae(u.left, l.left), l;
|
|
1658
|
-
}, Ue(t, i, r));
|
|
1659
|
-
return {
|
|
1660
|
-
width: d.right - d.left,
|
|
1661
|
-
height: d.bottom - d.top,
|
|
1662
|
-
x: d.left,
|
|
1663
|
-
y: d.top
|
|
1664
|
-
};
|
|
1665
|
-
}
|
|
1666
|
-
function Nn(e) {
|
|
1667
|
-
const {
|
|
1668
|
-
width: t,
|
|
1669
|
-
height: n
|
|
1670
|
-
} = ut(e);
|
|
1671
|
-
return {
|
|
1672
|
-
width: t,
|
|
1673
|
-
height: n
|
|
1674
|
-
};
|
|
1675
|
-
}
|
|
1676
|
-
function On(e, t, n) {
|
|
1677
|
-
const a = j(t), r = G(t), o = n === "fixed", s = fe(e, !0, o, t);
|
|
1678
|
-
let i = {
|
|
1679
|
-
scrollLeft: 0,
|
|
1680
|
-
scrollTop: 0
|
|
1681
|
-
};
|
|
1682
|
-
const d = W(0);
|
|
1683
|
-
function l() {
|
|
1684
|
-
d.x = Ce(r);
|
|
1685
|
-
}
|
|
1686
|
-
if (a || !a && !o)
|
|
1687
|
-
if ((ie(t) !== "body" || ye(r)) && (i = Ee(t)), a) {
|
|
1688
|
-
const g = fe(t, !0, o, t);
|
|
1689
|
-
d.x = g.x + t.clientLeft, d.y = g.y + t.clientTop;
|
|
1690
|
-
} else r && l();
|
|
1691
|
-
o && !a && r && l();
|
|
1692
|
-
const c = r && !a && !o ? ht(r, i) : W(0), u = s.left + i.scrollLeft - d.x - c.x, p = s.top + i.scrollTop - d.y - c.y;
|
|
1693
|
-
return {
|
|
1694
|
-
x: u,
|
|
1695
|
-
y: p,
|
|
1696
|
-
width: s.width,
|
|
1697
|
-
height: s.height
|
|
1698
|
-
};
|
|
1699
|
-
}
|
|
1700
|
-
function Ae(e) {
|
|
1701
|
-
return V(e).position === "static";
|
|
1702
|
-
}
|
|
1703
|
-
function Xe(e, t) {
|
|
1704
|
-
if (!j(e) || V(e).position === "fixed")
|
|
1705
|
-
return null;
|
|
1706
|
-
if (t)
|
|
1707
|
-
return t(e);
|
|
1708
|
-
let n = e.offsetParent;
|
|
1709
|
-
return G(e) === n && (n = n.ownerDocument.body), n;
|
|
1710
|
-
}
|
|
1711
|
-
function yt(e, t) {
|
|
1712
|
-
const n = z(e);
|
|
1713
|
-
if (Ie(e))
|
|
1714
|
-
return n;
|
|
1715
|
-
if (!j(e)) {
|
|
1716
|
-
let r = ee(e);
|
|
1717
|
-
for (; r && !se(r); ) {
|
|
1718
|
-
if (Y(r) && !Ae(r))
|
|
1719
|
-
return r;
|
|
1720
|
-
r = ee(r);
|
|
1721
|
-
}
|
|
1722
|
-
return n;
|
|
1723
|
-
}
|
|
1724
|
-
let a = Xe(e, t);
|
|
1725
|
-
for (; a && _n(a) && Ae(a); )
|
|
1726
|
-
a = Xe(a, t);
|
|
1727
|
-
return a && se(a) && Ae(a) && !He(a) ? n : a || In(e) || n;
|
|
1728
|
-
}
|
|
1729
|
-
const Hn = async function(e) {
|
|
1730
|
-
const t = this.getOffsetParent || yt, n = this.getDimensions, a = await n(e.floating);
|
|
1731
|
-
return {
|
|
1732
|
-
reference: On(e.reference, await t(e.floating), e.strategy),
|
|
1733
|
-
floating: {
|
|
1734
|
-
x: 0,
|
|
1735
|
-
y: 0,
|
|
1736
|
-
width: a.width,
|
|
1737
|
-
height: a.height
|
|
1738
|
-
}
|
|
1739
|
-
};
|
|
1740
|
-
};
|
|
1741
|
-
function Yn(e) {
|
|
1742
|
-
return V(e).direction === "rtl";
|
|
1743
|
-
}
|
|
1744
|
-
const Vn = {
|
|
1745
|
-
convertOffsetParentRelativeRectToViewportRelativeRect: An,
|
|
1746
|
-
getDocumentElement: G,
|
|
1747
|
-
getClippingRect: Fn,
|
|
1748
|
-
getOffsetParent: yt,
|
|
1749
|
-
getElementRects: Hn,
|
|
1750
|
-
getClientRects: Rn,
|
|
1751
|
-
getDimensions: Nn,
|
|
1752
|
-
getScale: re,
|
|
1753
|
-
isElement: Y,
|
|
1754
|
-
isRTL: Yn
|
|
1755
|
-
}, Te = yn, ze = vn, vt = fn, qn = gn, Dt = (e, t, n) => {
|
|
1756
|
-
const a = /* @__PURE__ */ new Map(), r = {
|
|
1757
|
-
platform: Vn,
|
|
1758
|
-
...n
|
|
1759
|
-
}, o = {
|
|
1760
|
-
...r.platform,
|
|
1761
|
-
_c: a
|
|
1762
|
-
};
|
|
1763
|
-
return un(e, t, {
|
|
1764
|
-
...r,
|
|
1765
|
-
platform: o
|
|
1766
|
-
});
|
|
1767
|
-
};
|
|
1768
|
-
function bt(e) {
|
|
1769
|
-
e.options.positioningMode !== "inline" && (B.debug("show() - adding visible class"), e.isFirstRender && (e.renderCalendar(), e.isFirstRender = !1), e.calendar.classList.add("drp-date-picker--visible"), e.isCalendarActive = !0, B.debug("show() - calendar classes:", e.calendar.className), wt(e), setTimeout(() => {
|
|
1770
|
-
const t = window.getComputedStyle(e.calendar);
|
|
1771
|
-
B.debug("show() - computed styles - display:", t.display, "position:", t.position, "left:", t.left, "top:", t.top, "z-index:", t.zIndex);
|
|
1772
|
-
}, 100));
|
|
1773
|
-
}
|
|
1774
|
-
function _t(e) {
|
|
1775
|
-
if (e.options.positioningMode !== "inline" && e.calendar.classList.contains("drp-date-picker--visible")) {
|
|
1776
|
-
e.calendar.classList.remove("drp-date-picker--visible"), e.isCalendarActive = !1;
|
|
1777
|
-
for (let t = 0; t < e.showingRollingSelector.length; t++)
|
|
1778
|
-
e.showingRollingSelector[t] = !1;
|
|
1779
|
-
e.isFirstRender || e.renderCalendar(), e.lockedPlacement = void 0;
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
function Bn(e) {
|
|
1783
|
-
e.calendar.classList.contains("drp-date-picker--visible") ? _t(e) : bt(e);
|
|
1784
|
-
}
|
|
1785
|
-
async function wt(e) {
|
|
1786
|
-
if (B.debug("position() - locked placement:", e.lockedPlacement), !e.input) return;
|
|
1787
|
-
const t = e.lockedPlacement ? [Te(8), ze({ padding: 8 })] : [Te(8), vt(), ze({ padding: 8 })], n = await Dt(e.input, e.calendar, {
|
|
1788
|
-
placement: e.lockedPlacement || e.options.calendarPlacement,
|
|
1789
|
-
middleware: t
|
|
1790
|
-
});
|
|
1791
|
-
B.debug("position() - FloatingUI computed - x:", n.x, "y:", n.y, "placement:", n.placement), e.lockedPlacement || (e.lockedPlacement = n.placement, B.debug("position() - locked placement to:", e.lockedPlacement)), e.calendar.style.left = `${n.x}px`, e.calendar.style.top = `${n.y}px`, B.debug("position() - applied styles to calendar");
|
|
1792
|
-
}
|
|
1793
|
-
async function Wn(e, t, n) {
|
|
1794
|
-
if (!e.tooltip || !e.tooltipArrow) return;
|
|
1795
|
-
e.currentTooltipTarget = t, e.tooltip.textContent = n, e.tooltip.appendChild(e.tooltipArrow), e.tooltip.classList.add("drp-date-picker__tooltip--visible");
|
|
1796
|
-
const { x: a, y: r, placement: o, middlewareData: s } = await Dt(t, e.tooltip, {
|
|
1797
|
-
placement: "top",
|
|
1798
|
-
middleware: [
|
|
1799
|
-
Te(6),
|
|
1800
|
-
vt(),
|
|
1801
|
-
ze({ padding: 5 }),
|
|
1802
|
-
qn({ element: e.tooltipArrow })
|
|
1803
|
-
]
|
|
1804
|
-
});
|
|
1805
|
-
if (Object.assign(e.tooltip.style, {
|
|
1806
|
-
left: `${a}px`,
|
|
1807
|
-
top: `${r}px`
|
|
1808
|
-
}), s.arrow) {
|
|
1809
|
-
const { x: i, y: d } = s.arrow, l = {
|
|
1810
|
-
top: "bottom",
|
|
1811
|
-
right: "left",
|
|
1812
|
-
bottom: "top",
|
|
1813
|
-
left: "right"
|
|
1814
|
-
}[o.split("-")[0]];
|
|
1815
|
-
Object.assign(e.tooltipArrow.style, {
|
|
1816
|
-
left: i != null ? `${i}px` : "",
|
|
1817
|
-
top: d != null ? `${d}px` : "",
|
|
1818
|
-
right: "",
|
|
1819
|
-
bottom: "",
|
|
1820
|
-
[l]: "-4px"
|
|
1821
|
-
});
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
function jn(e) {
|
|
1825
|
-
e.tooltip && (e.tooltip.classList.remove("drp-date-picker__tooltip--visible"), e.currentTooltipTarget = void 0);
|
|
1826
|
-
}
|
|
1827
|
-
function Kn(e) {
|
|
1828
|
-
if (e.loadingOverlay) return;
|
|
1829
|
-
const t = document.createElement("div");
|
|
1830
|
-
t.className = "drp-date-picker__loading-overlay", t.innerHTML = `
|
|
1831
|
-
<div class="drp-date-picker__loading-spinner"></div>
|
|
1832
|
-
`, e.calendar.appendChild(t), e.loadingOverlay = t;
|
|
1833
|
-
}
|
|
1834
|
-
function Ge(e) {
|
|
1835
|
-
e.loadingOverlay && (e.loadingOverlay.remove(), e.loadingOverlay = void 0);
|
|
1836
|
-
}
|
|
1837
|
-
async function xt(e, t, n) {
|
|
1838
|
-
if (U.debug(" validateRangeAsync called - mode:", e.options.disabledDatesHandling, "start:", t, "end:", n), e.options.disabledDatesHandling === "prevent") {
|
|
1839
|
-
if (U.debug(" Checking PREVENT mode"), e.hasDisabledDatesInRange(t, n))
|
|
1840
|
-
return U.debug(" PREVENT mode - range contains disabled dates"), { isValid: !1, message: "Range contains disabled dates" };
|
|
1841
|
-
} else if (e.options.disabledDatesHandling === "block" && (U.debug(" Checking BLOCK mode"), e.hasDisabledDatesInRange(t, n))) {
|
|
1842
|
-
U.debug(" BLOCK mode - range contains disabled dates, adjusting");
|
|
1843
|
-
const a = e.findLastEnabledBeforeGap(t, n);
|
|
1844
|
-
return U.debug(" BLOCK mode - adjusted end:", a), { isValid: !0, adjustedStart: t, adjustedEnd: a };
|
|
1845
|
-
}
|
|
1846
|
-
if (e.options.validateRangeCallback)
|
|
1847
|
-
try {
|
|
1848
|
-
e.isValidating = !0, Kn(e);
|
|
1849
|
-
const a = await e.options.validateRangeCallback(t, n);
|
|
1850
|
-
switch (Ge(e), e.isValidating = !1, a.action) {
|
|
1851
|
-
case "accept":
|
|
1852
|
-
return { isValid: !0 };
|
|
1853
|
-
case "adjust":
|
|
1854
|
-
return a.adjustedStartDate && a.adjustedEndDate ? {
|
|
1855
|
-
isValid: !0,
|
|
1856
|
-
adjustedStart: a.adjustedStartDate,
|
|
1857
|
-
adjustedEnd: a.adjustedEndDate,
|
|
1858
|
-
message: a.message
|
|
1859
|
-
} : { isValid: !1, message: a.message || "Invalid adjustment" };
|
|
1860
|
-
case "restore":
|
|
1861
|
-
return { isValid: !1, message: a.message };
|
|
1862
|
-
case "clear":
|
|
1863
|
-
return e.clearSelection(), { isValid: !1, message: a.message };
|
|
1864
|
-
default:
|
|
1865
|
-
return { isValid: !1, message: "Unknown validation action" };
|
|
1866
|
-
}
|
|
1867
|
-
} catch (a) {
|
|
1868
|
-
return Ge(e), e.isValidating = !1, k.error("validateRangeAsync() - async validation error:", a), { isValid: !1, message: "Validation error occurred" };
|
|
1869
|
-
}
|
|
1870
|
-
return { isValid: !0 };
|
|
1871
|
-
}
|
|
1872
|
-
async function Un(e, t) {
|
|
1873
|
-
if (t.classList.contains("drp-date-picker__day--disabled")) return;
|
|
1874
|
-
if (!t.dataset || !t.dataset.date) {
|
|
1875
|
-
k.warn("selectDay() - called with invalid element:", t);
|
|
1876
|
-
return;
|
|
1877
|
-
}
|
|
1878
|
-
const [n, a, r] = t.dataset.date.split("-").map(Number), o = new Date(n, a - 1, r);
|
|
1879
|
-
t.classList.contains("drp-date-picker__day--other-month");
|
|
1880
|
-
const s = t.closest(".drp-date-picker__days");
|
|
1881
|
-
if (s && s instanceof HTMLElement) {
|
|
1882
|
-
e.activeMonthIndex = parseInt(s.dataset.monthIndex || "0") || 0, te.debug(`Col${e.activeMonthIndex} selectDay - activeMonthIndex:`, e.activeMonthIndex);
|
|
1883
|
-
const i = s.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
1884
|
-
e.focusedDayIndex = Array.from(i).indexOf(t), te.debug(`Col${e.activeMonthIndex} selectDay - set focusedDayIndex to:`, e.focusedDayIndex);
|
|
1885
|
-
}
|
|
1886
|
-
if (e.options.selectionMode === "single")
|
|
1887
|
-
e.selectedDate = o, e.input && (e.input.value = e.formatDate(o)), e.options.onSelect && e.options.onSelect(o), e.options.positioningMode === "floating" && e.hide();
|
|
1888
|
-
else if (!e.selectedStartDate || e.selectedEndDate)
|
|
1889
|
-
e.selectedStartDate = o, e.selectedEndDate = null, e.input && (e.input.value = `${e.formatDate(e.selectedStartDate)} - ...`);
|
|
1890
|
-
else {
|
|
1891
|
-
let i = e.selectedStartDate, d = o;
|
|
1892
|
-
o < e.selectedStartDate && (d = e.selectedStartDate, i = o), te.debug(" selectDay - calling validateRangeAsync with:", i, d);
|
|
1893
|
-
const l = await xt(e, i, d);
|
|
1894
|
-
if (te.debug(" selectDay - validation result:", l), !l.isValid) {
|
|
1895
|
-
l.message && k.warn("selectDay() - range validation failed:", l.message), e.renderCalendar(), e.updateSummary();
|
|
1896
|
-
return;
|
|
1897
|
-
}
|
|
1898
|
-
e.selectedStartDate = l.adjustedStart || i, e.selectedEndDate = l.adjustedEnd || d, e.input && (e.input.value = `${e.formatDate(e.selectedStartDate)} - ${e.formatDate(e.selectedEndDate)}`), e.options.onSelect && e.options.onSelect({ start: e.selectedStartDate, end: e.selectedEndDate });
|
|
1899
|
-
}
|
|
1900
|
-
if (e.renderCalendar(), e.updateSummary(), e.options.selectionMode === "range" && e.selectedEndDate) {
|
|
1901
|
-
const i = e.selectedEndDate;
|
|
1902
|
-
for (let d = 0; d < e.monthDates.length; d++) {
|
|
1903
|
-
const l = e.monthDates[d];
|
|
1904
|
-
if (i.getFullYear() === l.getFullYear() && i.getMonth() === l.getMonth()) {
|
|
1905
|
-
e.activeMonthIndex = d;
|
|
1906
|
-
const c = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${d}"]`);
|
|
1907
|
-
if (c) {
|
|
1908
|
-
const u = c.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), p = Array.from(u).findIndex((g) => {
|
|
1909
|
-
const h = g.dataset.date;
|
|
1910
|
-
if (!h) return !1;
|
|
1911
|
-
const [f, y, m] = h.split("-").map(Number), x = new Date(f, y - 1, m);
|
|
1912
|
-
return e.isSameDay(x, i);
|
|
1913
|
-
});
|
|
1914
|
-
p !== -1 && (e.focusedDayIndex = p, u.forEach((g) => g.classList.remove("drp-date-picker__day--focused")), u[p] && u[p].classList.add("drp-date-picker__day--focused"));
|
|
1915
|
-
}
|
|
1916
|
-
break;
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
}
|
|
1921
|
-
function Xn(e) {
|
|
1922
|
-
e.monthDates[e.activeMonthIndex] = /* @__PURE__ */ new Date(), e.selectedDate = /* @__PURE__ */ new Date(), e.input && (e.input.value = e.formatDate(e.selectedDate)), e.options.onSelect && e.options.onSelect(e.selectedDate), e.renderCalendar(), e.options.selectionMode === "single" && e.hide();
|
|
1923
|
-
}
|
|
1924
|
-
function Gn(e) {
|
|
1925
|
-
e.selectedDate = null, e.selectedStartDate = null, e.selectedEndDate = null, e.input && (e.input.value = ""), e.renderCalendar(), e.updateSummary();
|
|
1926
|
-
}
|
|
1927
|
-
function Jn(e) {
|
|
1928
|
-
e.selectedStartDate && e.selectedEndDate && e.hide();
|
|
1929
|
-
}
|
|
1930
|
-
function Qn(e) {
|
|
1931
|
-
e.options.selectionMode === "range" && e.calendar.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--disabled):not(.drp-date-picker__day--other-month)").forEach((n) => {
|
|
1932
|
-
n.addEventListener("mousedown", (a) => {
|
|
1933
|
-
const r = a, o = n, s = r.clientX, i = r.clientY, d = 5;
|
|
1934
|
-
let l = !1, c = !1;
|
|
1935
|
-
const u = o.classList.contains("drp-date-picker__day--range-start"), p = o.classList.contains("drp-date-picker__day--range-end");
|
|
1936
|
-
let g;
|
|
1937
|
-
u && e.selectedStartDate && e.selectedEndDate ? g = "start" : p && e.selectedStartDate && e.selectedEndDate ? g = "end" : g = "start";
|
|
1938
|
-
const h = (y) => {
|
|
1939
|
-
const m = Math.abs(y.clientX - s), x = Math.abs(y.clientY - i);
|
|
1940
|
-
!l && (m > d || x > d) && (l = !0), l && !c && (c = !0, St(e, r, g, o), document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", f));
|
|
1941
|
-
}, f = () => {
|
|
1942
|
-
document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", f);
|
|
1943
|
-
};
|
|
1944
|
-
document.addEventListener("mousemove", h), document.addEventListener("mouseup", f);
|
|
1945
|
-
});
|
|
1946
|
-
});
|
|
1947
|
-
}
|
|
1948
|
-
function St(e, t, n, a) {
|
|
1949
|
-
t.preventDefault(), t.stopPropagation(), e.isDragging = !0, e.draggingType = n;
|
|
1950
|
-
const r = a, o = r.dataset.date;
|
|
1951
|
-
let s = null;
|
|
1952
|
-
if (o) {
|
|
1953
|
-
const [i, d, l] = o.split("-").map(Number);
|
|
1954
|
-
s = new Date(i, d - 1, l);
|
|
1955
|
-
}
|
|
1956
|
-
!e.selectedStartDate && !e.selectedEndDate ? s && (e.originalStartDate = s, e.originalEndDate = null, e.draggingType = "end") : s && e.selectedStartDate && !e.selectedEndDate ? s.getTime() === e.selectedStartDate.getTime() ? (e.originalStartDate = new Date(e.selectedStartDate), e.originalEndDate = null) : (e.selectedStartDate = null, e.selectedEndDate = null, e.focusedDayIndex = null, e.calendar.querySelectorAll(".drp-date-picker__day--range-start, .drp-date-picker__day--range-end, .drp-date-picker__day--selected, .drp-date-picker__day--focused").forEach((d) => {
|
|
1957
|
-
d.classList.remove("drp-date-picker__day--range-start", "drp-date-picker__day--range-end", "drp-date-picker__day--selected", "drp-date-picker__day--focused");
|
|
1958
|
-
}), e.originalStartDate = s, e.originalEndDate = null, e.draggingType = "end") : (e.selectedStartDate && (e.originalStartDate = new Date(e.selectedStartDate)), e.selectedEndDate && (e.originalEndDate = new Date(e.selectedEndDate))), r.classList.add("drp-date-picker__day--dragging"), F.debug(`Started dragging ${n} date`), e.onDragMoveBound = (i) => Mt(e, i), e.onDragEndBound = async (i) => await It(e), document.addEventListener("mousemove", e.onDragMoveBound), document.addEventListener("mouseup", e.onDragEndBound), document.body.style.cursor = "grabbing";
|
|
1959
|
-
}
|
|
1960
|
-
function Mt(e, t) {
|
|
1961
|
-
if (!e.isDragging) return;
|
|
1962
|
-
let n = null;
|
|
1963
|
-
e.containerElement instanceof ShadowRoot && "elementsFromPoint" in e.containerElement ? n = e.containerElement.elementsFromPoint(t.clientX, t.clientY)[0] || null : n = document.elementFromPoint(t.clientX, t.clientY);
|
|
1964
|
-
const a = n == null ? void 0 : n.closest(".drp-date-picker__nav--prev"), r = n == null ? void 0 : n.closest(".drp-date-picker__nav--next");
|
|
1965
|
-
if (a || r) {
|
|
1966
|
-
if (!e.navInterval) {
|
|
1967
|
-
const p = (a || r).closest(".drp-date-picker__month");
|
|
1968
|
-
if (p && p instanceof HTMLElement) {
|
|
1969
|
-
const g = parseInt(p.dataset.monthIndex || "0"), h = !!a;
|
|
1970
|
-
h ? e.prevMonth(g) : e.nextMonth(g), e.navInterval = window.setInterval(() => {
|
|
1971
|
-
h ? e.prevMonth(g) : e.nextMonth(g);
|
|
1972
|
-
}, 1e3);
|
|
1973
|
-
}
|
|
1974
|
-
}
|
|
1975
|
-
return;
|
|
1976
|
-
} else
|
|
1977
|
-
e.navInterval && (clearInterval(e.navInterval), e.navInterval = null);
|
|
1978
|
-
const o = n;
|
|
1979
|
-
if (!o || !o.classList.contains("drp-date-picker__day")) return;
|
|
1980
|
-
const s = o.dataset.date;
|
|
1981
|
-
if (!s) return;
|
|
1982
|
-
const [i, d, l] = s.split("-").map(Number);
|
|
1983
|
-
let c = new Date(i, d - 1, l);
|
|
1984
|
-
if (o.classList.contains("drp-date-picker__day--disabled")) {
|
|
1985
|
-
const u = e.draggingType === "start" ? e.originalEndDate && c > e.originalEndDate ? "backward" : "forward" : e.originalStartDate && c < e.originalStartDate ? "forward" : "backward";
|
|
1986
|
-
c = Se(e, c, u);
|
|
1987
|
-
}
|
|
1988
|
-
if (e.draggingType === "start" && e.originalEndDate ? (e.dragPreviewStart = c, e.dragPreviewEnd = e.originalEndDate, e.dragPreviewStart > e.dragPreviewEnd && ([e.dragPreviewStart, e.dragPreviewEnd] = [e.dragPreviewEnd, e.dragPreviewStart], e.draggingType = "end")) : e.originalStartDate && (e.dragPreviewStart = e.originalStartDate, e.dragPreviewEnd = c, e.dragPreviewEnd < e.dragPreviewStart && ([e.dragPreviewStart, e.dragPreviewEnd] = [e.dragPreviewEnd, e.dragPreviewStart], e.draggingType = "start")), e.dragPreviewStart && e.dragPreviewEnd) {
|
|
1989
|
-
const u = e.options.disabledDatesHandling;
|
|
1990
|
-
if (F.debug("onDragMove - mode:", u, "start:", e.dragPreviewStart, "end:", e.dragPreviewEnd), u === "prevent" && e.hasDisabledDatesInRange(e.dragPreviewStart, e.dragPreviewEnd)) {
|
|
1991
|
-
F.debug("PREVENT mode - range contains disabled dates, blocking preview update");
|
|
1992
|
-
return;
|
|
1993
|
-
} else if (u === "block" && e.hasDisabledDatesInRange(e.dragPreviewStart, e.dragPreviewEnd)) {
|
|
1994
|
-
if (F.debug("BLOCK mode - range contains disabled dates, adjusting preview"), e.draggingType === "start" && e.originalEndDate) {
|
|
1995
|
-
const p = e.findLastEnabledBeforeGap(e.dragPreviewStart, e.originalEndDate);
|
|
1996
|
-
F.debug("BLOCK mode - adjusted end (dragging start):", p), e.dragPreviewEnd = p;
|
|
1997
|
-
} else if (e.originalStartDate) {
|
|
1998
|
-
const p = e.findLastEnabledBeforeGap(e.originalStartDate, e.dragPreviewEnd);
|
|
1999
|
-
F.debug("BLOCK mode - adjusted end (dragging end):", p), e.dragPreviewEnd = p;
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
}
|
|
2003
|
-
e.updateDragPreview();
|
|
2004
|
-
}
|
|
2005
|
-
async function It(e, t) {
|
|
2006
|
-
if (e.isDragging) {
|
|
2007
|
-
if (F.debug("Ended dragging, finalizing selection"), e.dragPreviewStart && e.dragPreviewEnd) {
|
|
2008
|
-
let n = Se(e, e.dragPreviewStart, "forward"), a = Se(e, e.dragPreviewEnd, "backward");
|
|
2009
|
-
n > a && ([n, a] = [a, n]), F.debug("onDragEnd - calling validateRangeAsync with:", n, a);
|
|
2010
|
-
const r = await xt(e, n, a);
|
|
2011
|
-
F.debug("onDragEnd - validation result:", r), r.isValid ? (e.selectedStartDate = r.adjustedStart || n, e.selectedEndDate = r.adjustedEnd || a, e.input && (e.input.value = `${e.formatDate(e.selectedStartDate)} - ${e.formatDate(e.selectedEndDate)}`), e.options.onSelect && e.options.onSelect({ start: e.selectedStartDate, end: e.selectedEndDate })) : r.message && k.warn("onDragEnd() - drag validation failed:", r.message);
|
|
2012
|
-
}
|
|
2013
|
-
if (e.isDragging = !1, e.draggingType = null, e.dragPreviewStart = null, e.dragPreviewEnd = null, e.calendar.querySelectorAll(".drp-date-picker__day--dragging").forEach((n) => {
|
|
2014
|
-
n.classList.remove("drp-date-picker__day--dragging");
|
|
2015
|
-
}), e.onDragMoveBound && document.removeEventListener("mousemove", e.onDragMoveBound), e.onDragEndBound && document.removeEventListener("mouseup", e.onDragEndBound), e.navInterval && (clearInterval(e.navInterval), e.navInterval = null), document.body.style.cursor = "", e.renderCalendar(), e.updateSummary(), e.selectedEndDate) {
|
|
2016
|
-
const n = e.selectedEndDate;
|
|
2017
|
-
for (let a = 0; a < e.monthDates.length; a++) {
|
|
2018
|
-
const r = e.monthDates[a];
|
|
2019
|
-
if (n.getFullYear() === r.getFullYear() && n.getMonth() === r.getMonth()) {
|
|
2020
|
-
e.activeMonthIndex = a;
|
|
2021
|
-
const o = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${a}"]`);
|
|
2022
|
-
if (o) {
|
|
2023
|
-
const s = o.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), i = Array.from(s).findIndex((d) => {
|
|
2024
|
-
const l = d.dataset.date;
|
|
2025
|
-
if (!l) return !1;
|
|
2026
|
-
const [c, u, p] = l.split("-").map(Number), g = new Date(c, u - 1, p);
|
|
2027
|
-
return e.isSameDay(g, n);
|
|
2028
|
-
});
|
|
2029
|
-
i !== -1 && (e.focusedDayIndex = i, s.forEach((d) => d.classList.remove("drp-date-picker__day--focused")), s[i] && s[i].classList.add("drp-date-picker__day--focused"));
|
|
2030
|
-
}
|
|
2031
|
-
break;
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
|
-
}
|
|
2035
|
-
}
|
|
2036
|
-
}
|
|
2037
|
-
function Se(e, t, n = "forward") {
|
|
2038
|
-
let r = new Date(t);
|
|
2039
|
-
if (r.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(r))
|
|
2040
|
-
return r;
|
|
2041
|
-
const o = n === "forward" ? 1 : -1;
|
|
2042
|
-
for (let i = 1; i <= 60; i++) {
|
|
2043
|
-
const d = new Date(t);
|
|
2044
|
-
if (d.setDate(d.getDate() + i * o), d.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(d))
|
|
2045
|
-
return d;
|
|
2046
|
-
}
|
|
2047
|
-
const s = -o;
|
|
2048
|
-
for (let i = 1; i <= 60; i++) {
|
|
2049
|
-
const d = new Date(t);
|
|
2050
|
-
if (d.setDate(d.getDate() + i * s), d.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(d))
|
|
2051
|
-
return d;
|
|
2052
|
-
}
|
|
2053
|
-
return t;
|
|
2054
|
-
}
|
|
2055
|
-
function Zn(e, t) {
|
|
2056
|
-
const n = t.target, a = n.value, r = n.selectionStart || 0, o = e._previousInputValue || "", s = a.length < o.length, { separator: i } = e.formatInfo;
|
|
2057
|
-
if (e.options.selectionMode === "range") {
|
|
2058
|
-
const d = a.replace(new RegExp(`[^0-9${i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}to ]`, "gi"), ""), l = Et(e, d);
|
|
2059
|
-
if (l !== a) {
|
|
2060
|
-
n.value = l;
|
|
2061
|
-
let c = r;
|
|
2062
|
-
if (s)
|
|
2063
|
-
c = r;
|
|
2064
|
-
else if (l.length > a.length)
|
|
2065
|
-
if (l.includes(" to ") && !a.includes(" to ")) {
|
|
2066
|
-
const u = l.indexOf(" to ");
|
|
2067
|
-
r >= u && r <= u + 4 ? c = u + 4 : c = r + (l.length - a.length);
|
|
2068
|
-
} else
|
|
2069
|
-
c = r + (l.length - a.length);
|
|
2070
|
-
n.setSelectionRange(c, c);
|
|
2071
|
-
}
|
|
2072
|
-
} else {
|
|
2073
|
-
const d = a.replace(new RegExp(`[^0-9${i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}]`, "g"), ""), l = oe(e, d);
|
|
2074
|
-
if (l !== a) {
|
|
2075
|
-
n.value = l;
|
|
2076
|
-
let c = r;
|
|
2077
|
-
if (s)
|
|
2078
|
-
c = r;
|
|
2079
|
-
else if (l.length > a.length && l[r] === i)
|
|
2080
|
-
c = r + 1;
|
|
2081
|
-
else if (l.length > a.length) {
|
|
2082
|
-
const u = (a.substring(0, r).match(new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length, g = (l.substring(0, r).match(new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length - u;
|
|
2083
|
-
c = r + g;
|
|
2084
|
-
}
|
|
2085
|
-
n.setSelectionRange(c, c);
|
|
2086
|
-
}
|
|
2087
|
-
}
|
|
2088
|
-
e._previousInputValue = n.value, Ve(e);
|
|
2089
|
-
}
|
|
2090
|
-
function oe(e, t) {
|
|
2091
|
-
var c, u, p;
|
|
2092
|
-
const { separator: n, parts: a, maxLength: r } = e.formatInfo, o = t.replace(new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), ""), s = a.year ? a.year.length : 4, i = [
|
|
2093
|
-
{ type: "year", pos: ((c = a.year) == null ? void 0 : c.index) ?? 0, length: s },
|
|
2094
|
-
{ type: "month", pos: ((u = a.month) == null ? void 0 : u.index) ?? 1, length: 2 },
|
|
2095
|
-
{ type: "day", pos: ((p = a.day) == null ? void 0 : p.index) ?? 2, length: 2 }
|
|
2096
|
-
].sort((g, h) => g.pos - h.pos);
|
|
2097
|
-
let d = "", l = 0;
|
|
2098
|
-
for (let g = 0; g < i.length; g++) {
|
|
2099
|
-
const h = i[g], f = o.substring(l, l + h.length);
|
|
2100
|
-
if (!f) break;
|
|
2101
|
-
d += f, l += f.length, g < i.length - 1 && f.length === h.length && (d += n);
|
|
2102
|
-
}
|
|
2103
|
-
return d.substring(0, r);
|
|
2104
|
-
}
|
|
2105
|
-
function Et(e, t) {
|
|
2106
|
-
const { separator: n, maxLength: a } = e.formatInfo, r = " to ";
|
|
2107
|
-
let o = "", s = "";
|
|
2108
|
-
if (t.includes(r)) {
|
|
2109
|
-
const d = t.split(r);
|
|
2110
|
-
o = d[0], s = d.slice(1).join(r);
|
|
2111
|
-
} else
|
|
2112
|
-
o = t;
|
|
2113
|
-
const i = oe(e, o);
|
|
2114
|
-
if (i.length === a)
|
|
2115
|
-
if (t.includes(r)) {
|
|
2116
|
-
const d = oe(e, s);
|
|
2117
|
-
return i + r + d;
|
|
2118
|
-
} else
|
|
2119
|
-
return i + r;
|
|
2120
|
-
else
|
|
2121
|
-
return i;
|
|
2122
|
-
}
|
|
2123
|
-
function ea(e, t) {
|
|
2124
|
-
const { key: n, ctrlKey: a, metaKey: r } = t, { separator: o } = e.formatInfo;
|
|
2125
|
-
if (e.calendar.classList.contains("drp-date-picker--visible") && ["ArrowUp", "ArrowDown", "Home", "End", "PageUp", "PageDown"].includes(n)) {
|
|
2126
|
-
t.preventDefault();
|
|
2127
|
-
return;
|
|
2128
|
-
}
|
|
2129
|
-
if (!([
|
|
2130
|
-
"Backspace",
|
|
2131
|
-
"Delete",
|
|
2132
|
-
"Tab",
|
|
2133
|
-
"Escape",
|
|
2134
|
-
"Enter",
|
|
2135
|
-
"ArrowLeft",
|
|
2136
|
-
"ArrowRight",
|
|
2137
|
-
"ArrowUp",
|
|
2138
|
-
"ArrowDown",
|
|
2139
|
-
"Home",
|
|
2140
|
-
"End"
|
|
2141
|
-
].includes(n) || a || r)) {
|
|
2142
|
-
if (n === o) {
|
|
2143
|
-
const i = t.target, d = i.selectionStart || 0, l = i.value;
|
|
2144
|
-
let c = 0;
|
|
2145
|
-
for (let p = d - 1; p >= 0; p--)
|
|
2146
|
-
if (l[p] === o || l[p] === " ") {
|
|
2147
|
-
c = p + 1;
|
|
2148
|
-
break;
|
|
2149
|
-
}
|
|
2150
|
-
const u = l.substring(c, d);
|
|
2151
|
-
if (/^\d$/.test(u)) {
|
|
2152
|
-
t.preventDefault();
|
|
2153
|
-
const p = l.substring(0, c) + "0" + u + o + l.substring(d);
|
|
2154
|
-
i.value = p;
|
|
2155
|
-
const g = c + 2 + o.length;
|
|
2156
|
-
i.setSelectionRange(g, g), e._previousInputValue = p, i.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
2157
|
-
return;
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
e.options.selectionMode === "range" ? !/^\d$/.test(n) && n !== o && n !== " " && n.toLowerCase() !== "t" && n.toLowerCase() !== "o" && t.preventDefault() : !/^\d$/.test(n) && n !== o && t.preventDefault();
|
|
2161
|
-
}
|
|
2162
|
-
}
|
|
2163
|
-
function ta(e, t) {
|
|
2164
|
-
var p;
|
|
2165
|
-
t.preventDefault();
|
|
2166
|
-
const n = ((p = t.clipboardData) == null ? void 0 : p.getData("text")) || "", { separator: a } = e.formatInfo, r = n.replace(new RegExp(`[^0-9${a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}]`, "g"), ""), o = oe(e, r), s = t.target, i = s.selectionStart || 0, d = s.selectionEnd || 0, l = s.value, c = l.substring(0, i) + o + l.substring(d);
|
|
2167
|
-
s.value = oe(e, c);
|
|
2168
|
-
const u = i + o.length;
|
|
2169
|
-
s.setSelectionRange(u, u), s.dispatchEvent(new Event("input", { bubbles: !0 })), Ve(e);
|
|
2170
|
-
}
|
|
2171
|
-
function Ve(e) {
|
|
2172
|
-
if (!e.input) return;
|
|
2173
|
-
const t = e.input.value;
|
|
2174
|
-
if (Z.debug("updateCalendarFromInput - value:", t), !t) return;
|
|
2175
|
-
const { separator: n, parts: a, maxLength: r } = e.formatInfo;
|
|
2176
|
-
if (Z.debug("Format info:", { separator: n, parts: a, maxLength: r }), e.options.selectionMode === "range" && t.includes(" to ")) {
|
|
2177
|
-
const s = t.split(" to "), i = s[0], d = s[1];
|
|
2178
|
-
Z.debug("Range parts - start:", i, "end:", d), De(e, i, "start"), d && De(e, d, "end");
|
|
2179
|
-
return;
|
|
2180
|
-
}
|
|
2181
|
-
const o = e.options.selectionMode === "range" ? "start" : "single";
|
|
2182
|
-
De(e, t, o);
|
|
2183
|
-
}
|
|
2184
|
-
function De(e, t, n = "single") {
|
|
2185
|
-
const { separator: a, parts: r, maxLength: o } = e.formatInfo, s = t.split(a);
|
|
2186
|
-
let i = null, d = null, l = null;
|
|
2187
|
-
if (s.forEach((c, u) => {
|
|
2188
|
-
if (c) {
|
|
2189
|
-
if (r.year && r.year.index === u) {
|
|
2190
|
-
const p = parseInt(c, 10);
|
|
2191
|
-
r.year.length === 4 && c.length === 4 ? i = p : r.year.length === 2 && c.length === 2 && (i = p < 100 ? p + 2e3 : p);
|
|
2192
|
-
} else if (r.month && r.month.index === u) {
|
|
2193
|
-
const p = parseInt(c, 10);
|
|
2194
|
-
c.length === 2 && p >= 1 && p <= 12 && (d = p);
|
|
2195
|
-
} else if (r.day && r.day.index === u) {
|
|
2196
|
-
const p = parseInt(c, 10);
|
|
2197
|
-
c.length === 2 && p >= 1 && p <= 31 && (l = p);
|
|
2198
|
-
}
|
|
2199
|
-
}
|
|
2200
|
-
}), Z.debug(`parseAndUpdateSingleDate(${n}) - year:`, i, "month:", d, "day:", l), i !== null || d !== null) {
|
|
2201
|
-
const c = i || (/* @__PURE__ */ new Date()).getFullYear(), u = d !== null ? d - 1 : (/* @__PURE__ */ new Date()).getMonth();
|
|
2202
|
-
if (e.options.selectionMode === "single") {
|
|
2203
|
-
e.monthDates = [];
|
|
2204
|
-
for (let p = 0; p < e.options.visibleMonthsCount; p++) {
|
|
2205
|
-
const g = new Date(c, u + p, 1);
|
|
2206
|
-
e.monthDates.push(g);
|
|
2207
|
-
}
|
|
2208
|
-
} else if (e.options.selectionMode === "range" && (n === "start" || !e.selectedStartDate)) {
|
|
2209
|
-
if (e.displayMonths = [
|
|
2210
|
-
{ month: u, year: c }
|
|
2211
|
-
], e.options.visibleMonthsCount > 1) {
|
|
2212
|
-
const p = new Date(c, u + 1, 1);
|
|
2213
|
-
e.displayMonths.push({
|
|
2214
|
-
month: p.getMonth(),
|
|
2215
|
-
year: p.getFullYear()
|
|
2216
|
-
});
|
|
2217
|
-
}
|
|
2218
|
-
e.monthDates = [];
|
|
2219
|
-
for (let p = 0; p < e.options.visibleMonthsCount; p++) {
|
|
2220
|
-
const g = e.displayMonths[p], h = new Date(g.year, g.month, 1);
|
|
2221
|
-
e.monthDates.push(h);
|
|
2222
|
-
}
|
|
2223
|
-
}
|
|
2224
|
-
e.renderCalendar();
|
|
2225
|
-
}
|
|
2226
|
-
if (i !== null && d !== null && l !== null) {
|
|
2227
|
-
const c = new Date(i, d - 1, l);
|
|
2228
|
-
c.getMonth() === d - 1 && (n === "single" ? e.selectedDate = c : n === "start" ? e.selectedStartDate = c : n === "end" && (e.selectedEndDate = c), e.renderCalendar(), e.options.selectionMode === "range" && e.updateSummary(), Z.debug(`Set ${n} date:`, c));
|
|
2229
|
-
}
|
|
2230
|
-
}
|
|
2231
|
-
const Fe = {
|
|
2232
|
-
en: {
|
|
2233
|
-
today: "Today",
|
|
2234
|
-
clear: "Clear",
|
|
2235
|
-
apply: "Apply",
|
|
2236
|
-
preview: "Preview",
|
|
2237
|
-
day: "day",
|
|
2238
|
-
days: "days",
|
|
2239
|
-
night: "night",
|
|
2240
|
-
nights: "nights"
|
|
2241
|
-
},
|
|
2242
|
-
de: {
|
|
2243
|
-
today: "Heute",
|
|
2244
|
-
clear: "Löschen",
|
|
2245
|
-
apply: "Anwenden",
|
|
2246
|
-
preview: "Vorschau",
|
|
2247
|
-
day: "Tag",
|
|
2248
|
-
days: "Tage",
|
|
2249
|
-
night: "Nacht",
|
|
2250
|
-
nights: "Nächte"
|
|
2251
|
-
},
|
|
2252
|
-
fr: {
|
|
2253
|
-
today: "Aujourd'hui",
|
|
2254
|
-
clear: "Effacer",
|
|
2255
|
-
apply: "Appliquer",
|
|
2256
|
-
preview: "Aperçu",
|
|
2257
|
-
day: "jour",
|
|
2258
|
-
days: "jours",
|
|
2259
|
-
night: "nuit",
|
|
2260
|
-
nights: "nuits"
|
|
2261
|
-
},
|
|
2262
|
-
es: {
|
|
2263
|
-
today: "Hoy",
|
|
2264
|
-
clear: "Limpiar",
|
|
2265
|
-
apply: "Aplicar",
|
|
2266
|
-
preview: "Vista previa",
|
|
2267
|
-
day: "día",
|
|
2268
|
-
days: "días",
|
|
2269
|
-
night: "noche",
|
|
2270
|
-
nights: "noches"
|
|
2271
|
-
}
|
|
2272
|
-
};
|
|
2273
|
-
function Le(e) {
|
|
2274
|
-
if (e !== "auto")
|
|
2275
|
-
return e;
|
|
2276
|
-
if (typeof navigator < "u" && navigator.language) {
|
|
2277
|
-
const t = navigator.language.split("-")[0].toLowerCase();
|
|
2278
|
-
return Fe[t] ? t : "en";
|
|
2279
|
-
}
|
|
2280
|
-
return "en";
|
|
2281
|
-
}
|
|
2282
|
-
function na(e, t) {
|
|
2283
|
-
const n = Le(e), a = Fe[n] || Fe.en;
|
|
2284
|
-
return t ? { ...a, ...t } : a;
|
|
2285
|
-
}
|
|
2286
|
-
function aa(e) {
|
|
2287
|
-
const t = Le(e);
|
|
2288
|
-
try {
|
|
2289
|
-
const n = new Intl.DateTimeFormat(t, { weekday: "short" }), a = [];
|
|
2290
|
-
for (let r = 0; r < 7; r++) {
|
|
2291
|
-
const o = new Date(2017, 0, r + 1);
|
|
2292
|
-
a.push(n.format(o));
|
|
2293
|
-
}
|
|
2294
|
-
return a;
|
|
2295
|
-
} catch (n) {
|
|
2296
|
-
return k.warn("getWeekdayNames() - Intl.DateTimeFormat failed, using English weekdays", n), ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
2297
|
-
}
|
|
2298
|
-
}
|
|
2299
|
-
function ra(e) {
|
|
2300
|
-
const t = Le(e);
|
|
2301
|
-
try {
|
|
2302
|
-
const n = new Intl.DateTimeFormat(t, { month: "long" }), a = [];
|
|
2303
|
-
for (let r = 0; r < 12; r++) {
|
|
2304
|
-
const o = new Date(2017, r, 1);
|
|
2305
|
-
a.push(n.format(o));
|
|
2306
|
-
}
|
|
2307
|
-
return a;
|
|
2308
|
-
} catch (n) {
|
|
2309
|
-
return k.warn("getMonthNames() - Intl.DateTimeFormat failed, using English months", n), [
|
|
2310
|
-
"January",
|
|
2311
|
-
"February",
|
|
2312
|
-
"March",
|
|
2313
|
-
"April",
|
|
2314
|
-
"May",
|
|
2315
|
-
"June",
|
|
2316
|
-
"July",
|
|
2317
|
-
"August",
|
|
2318
|
-
"September",
|
|
2319
|
-
"October",
|
|
2320
|
-
"November",
|
|
2321
|
-
"December"
|
|
2322
|
-
];
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
class sa {
|
|
2326
|
-
constructor(t, n = {}) {
|
|
2327
|
-
D(this, "input");
|
|
2328
|
-
D(this, "options");
|
|
2329
|
-
D(this, "formatInfo");
|
|
2330
|
-
D(this, "_previousInputValue");
|
|
2331
|
-
D(this, "currentDate");
|
|
2332
|
-
D(this, "monthDates");
|
|
2333
|
-
D(this, "displayMonths");
|
|
2334
|
-
D(this, "selectedDate");
|
|
2335
|
-
D(this, "selectedStartDate");
|
|
2336
|
-
D(this, "selectedEndDate");
|
|
2337
|
-
D(this, "focusedDayIndex");
|
|
2338
|
-
D(this, "activeMonthIndex");
|
|
2339
|
-
D(this, "showingRollingSelector");
|
|
2340
|
-
D(this, "draggingType");
|
|
2341
|
-
D(this, "isDragging");
|
|
2342
|
-
D(this, "dragStartDate");
|
|
2343
|
-
D(this, "originalStartDate");
|
|
2344
|
-
D(this, "originalEndDate");
|
|
2345
|
-
D(this, "dragPreviewStart");
|
|
2346
|
-
D(this, "dragPreviewEnd");
|
|
2347
|
-
D(this, "autoScrollInterval");
|
|
2348
|
-
D(this, "navInterval");
|
|
2349
|
-
D(this, "calendar");
|
|
2350
|
-
D(this, "containerElement");
|
|
2351
|
-
D(this, "onDragMoveBound");
|
|
2352
|
-
D(this, "onDragEndBound");
|
|
2353
|
-
D(this, "clickOutsideHandler");
|
|
2354
|
-
D(this, "isFirstRender", !0);
|
|
2355
|
-
D(this, "lockedPlacement");
|
|
2356
|
-
// Store the initial placement to prevent jumping
|
|
2357
|
-
D(this, "calendarContentHeight");
|
|
2358
|
-
// Store calendar height for rolling selector
|
|
2359
|
-
D(this, "calendarContentWidth");
|
|
2360
|
-
// Store calendar width for rolling selector
|
|
2361
|
-
D(this, "isCalendarActive", !1);
|
|
2362
|
-
// Track if this calendar is actively focused (for inline mode)
|
|
2363
|
-
// Async validation state
|
|
2364
|
-
D(this, "isValidating", !1);
|
|
2365
|
-
D(this, "loadingOverlay");
|
|
2366
|
-
// Floating UI tooltips
|
|
2367
|
-
D(this, "tooltip");
|
|
2368
|
-
D(this, "tooltipArrow");
|
|
2369
|
-
D(this, "currentTooltipTarget");
|
|
2370
|
-
// Week start and date restrictions
|
|
2371
|
-
D(this, "weekStartDay", 0);
|
|
2372
|
-
// 0 = Sunday, 1 = Monday, etc.
|
|
2373
|
-
D(this, "normalizedMinDate", null);
|
|
2374
|
-
D(this, "normalizedMaxDate", null);
|
|
2375
|
-
D(this, "normalizedDisabledDates", /* @__PURE__ */ new Set());
|
|
2376
|
-
// Store as 'YYYY-MM-DD' strings
|
|
2377
|
-
D(this, "normalizedSpecialDates", /* @__PURE__ */ new Map());
|
|
2378
|
-
// Store as 'YYYY-MM-DD' -> DecoratedDate
|
|
2379
|
-
// Internationalization
|
|
2380
|
-
D(this, "locale", "en");
|
|
2381
|
-
D(this, "localeStrings");
|
|
2382
|
-
D(this, "weekdayNames", []);
|
|
2383
|
-
D(this, "monthNames", []);
|
|
2384
|
-
this.input = t, this.containerElement = n.container || document.body, this.options = {
|
|
2385
|
-
selectionMode: n.selectionMode || "single",
|
|
2386
|
-
calendarPlacement: n.calendarPlacement || (n.monthLayout === "grid" ? "bottom" : "bottom-start"),
|
|
2387
|
-
visibleMonthsCount: n.visibleMonthsCount || (n.selectionMode === "range" ? 2 : 1),
|
|
2388
|
-
dateFormatMask: n.dateFormatMask || "YYYY-MM-DD",
|
|
2389
|
-
calendarOpenTrigger: n.calendarOpenTrigger || "auto",
|
|
2390
|
-
onSelect: n.onSelect || void 0,
|
|
2391
|
-
container: this.containerElement,
|
|
2392
|
-
positioningMode: n.positioningMode || "floating",
|
|
2393
|
-
monthLayout: n.monthLayout || "horizontal",
|
|
2394
|
-
gridRows: n.gridRows,
|
|
2395
|
-
gridColumns: n.gridColumns,
|
|
2396
|
-
weekStartDay: n.weekStartDay !== void 0 ? n.weekStartDay : "auto",
|
|
2397
|
-
minDate: n.minDate,
|
|
2398
|
-
maxDate: n.maxDate,
|
|
2399
|
-
initialDate: n.initialDate,
|
|
2400
|
-
disabledDates: n.disabledDates,
|
|
2401
|
-
disabledWeekdays: n.disabledWeekdays,
|
|
2402
|
-
specialDates: n.specialDates,
|
|
2403
|
-
isDateDisabled: n.isDateDisabled,
|
|
2404
|
-
getDateMetadata: n.getDateMetadata,
|
|
2405
|
-
disabledDatesHandling: n.disabledDatesHandling || "allow",
|
|
2406
|
-
highlightDisabledInRange: n.highlightDisabledInRange !== void 0 ? n.highlightDisabledInRange : !0,
|
|
2407
|
-
locale: n.locale || "auto",
|
|
2408
|
-
displayFormatMask: n.displayFormatMask,
|
|
2409
|
-
customStrings: n.customStrings,
|
|
2410
|
-
formatSummaryCallback: n.formatSummaryCallback,
|
|
2411
|
-
validateRangeCallback: n.validateRangeCallback,
|
|
2412
|
-
showDebugInfo: n.showDebugInfo || !1,
|
|
2413
|
-
rollingYearRange: n.rollingYearRange,
|
|
2414
|
-
rollingMonthRange: n.rollingMonthRange,
|
|
2415
|
-
renderDay: n.renderDay,
|
|
2416
|
-
renderDayContent: n.renderDayContent
|
|
2417
|
-
}, Bt(this.options.showDebugInfo), this.weekStartDay = $t(this.options.weekStartDay), $.debug("Week starts on day:", this.weekStartDay), $.debug("disabledDatesHandling:", this.options.disabledDatesHandling), this.locale = Le(this.options.locale), this.localeStrings = na(this.locale, this.options.customStrings), this.weekdayNames = aa(this.locale), this.monthNames = ra(this.locale), $.debug("Locale:", this.locale, "Weekdays:", this.weekdayNames, "Months:", this.monthNames), this.initializeDateRestrictions(), this.formatInfo = this.parseFormat(this.options.dateFormatMask), $.debug("Format info:", this.formatInfo), this._previousInputValue = "", this.currentDate = /* @__PURE__ */ new Date();
|
|
2418
|
-
let a;
|
|
2419
|
-
if (this.options.initialDate)
|
|
2420
|
-
a = de(this.options.initialDate) || /* @__PURE__ */ new Date(), $.debug(`Using initialDate: ${a.toISOString()}`);
|
|
2421
|
-
else if (this.options.rollingYearRange || this.options.rollingMonthRange) {
|
|
2422
|
-
const r = this.options.rollingYearRange ? this.parseYearRange(this.options.rollingYearRange) : null, o = this.options.rollingMonthRange ? this.parseMonthRange(this.options.rollingMonthRange) : null, s = r ? r.min : (/* @__PURE__ */ new Date()).getFullYear(), i = o ? o.min - 1 : 0;
|
|
2423
|
-
a = new Date(s, i, 1), $.debug(`Using first allowed year/month as initial: ${a.toISOString()}`);
|
|
2424
|
-
} else this.normalizedMinDate && this.normalizedMinDate > /* @__PURE__ */ new Date() ? (a = new Date(this.normalizedMinDate), $.debug(`Using minDate as initial: ${a.toISOString()}`)) : this.normalizedMaxDate && this.normalizedMaxDate < /* @__PURE__ */ new Date() ? (a = new Date(this.normalizedMaxDate), $.debug(`Using maxDate as initial: ${a.toISOString()}`)) : (a = /* @__PURE__ */ new Date(), $.debug(`Using current date as initial: ${a.toISOString()}`));
|
|
2425
|
-
this.monthDates = [];
|
|
2426
|
-
for (let r = 0; r < this.options.visibleMonthsCount; r++) {
|
|
2427
|
-
const o = new Date(a.getFullYear(), a.getMonth() + r, 1);
|
|
2428
|
-
this.monthDates.push(o), $.debug(`monthDates[${r}] = ${o.getFullYear()}-${o.getMonth() + 1}`);
|
|
2429
|
-
}
|
|
2430
|
-
if (this.options.selectionMode === "range") {
|
|
2431
|
-
this.displayMonths = [];
|
|
2432
|
-
for (let r = 0; r < this.options.visibleMonthsCount; r++) {
|
|
2433
|
-
const o = new Date(a.getFullYear(), a.getMonth() + r, 1);
|
|
2434
|
-
this.displayMonths.push({
|
|
2435
|
-
month: o.getMonth(),
|
|
2436
|
-
year: o.getFullYear()
|
|
2437
|
-
});
|
|
2438
|
-
}
|
|
2439
|
-
}
|
|
2440
|
-
this.selectedDate = null, this.selectedStartDate = null, this.selectedEndDate = null, this.focusedDayIndex = null, this.activeMonthIndex = 0, this.showingRollingSelector = [];
|
|
2441
|
-
for (let r = 0; r < this.options.visibleMonthsCount; r++)
|
|
2442
|
-
this.showingRollingSelector.push(!1);
|
|
2443
|
-
this.draggingType = null, this.isDragging = !1, this.dragStartDate = null, this.originalStartDate = null, this.originalEndDate = null, this.dragPreviewStart = null, this.dragPreviewEnd = null, this.autoScrollInterval = null, this.init();
|
|
2444
|
-
}
|
|
2445
|
-
init() {
|
|
2446
|
-
$.debug("Init called"), this.createCalendar(), this.input && (this.attachInputListeners(), this.input.value && ($.debug("Parsing pre-filled value:", this.input.value), this.updateCalendarFromInput())), this.options.positioningMode === "inline" && (this.renderCalendar(), this.calendar.classList.add("drp-date-picker--visible", "drp-date-picker--inline"), this.isCalendarActive = !0, this.isFirstRender = !1), $.debug("Init complete");
|
|
2447
|
-
}
|
|
2448
|
-
/**
|
|
2449
|
-
* Initialize and normalize date restrictions
|
|
2450
|
-
*/
|
|
2451
|
-
initializeDateRestrictions() {
|
|
2452
|
-
this.options.minDate && (this.normalizedMinDate = de(this.options.minDate)), this.options.maxDate && (this.normalizedMaxDate = de(this.options.maxDate)), this.options.disabledDates && this.options.disabledDates.length > 0 && this.options.disabledDates.forEach((t) => {
|
|
2453
|
-
const n = de(t);
|
|
2454
|
-
if (n) {
|
|
2455
|
-
const a = ve(n);
|
|
2456
|
-
this.normalizedDisabledDates.add(a);
|
|
2457
|
-
}
|
|
2458
|
-
}), this.options.specialDates && this.options.specialDates.length > 0 && this.options.specialDates.forEach((t) => {
|
|
2459
|
-
const n = de(t.date);
|
|
2460
|
-
if (n) {
|
|
2461
|
-
const a = ve(n);
|
|
2462
|
-
this.normalizedSpecialDates.set(a, t);
|
|
2463
|
-
}
|
|
2464
|
-
});
|
|
2465
|
-
}
|
|
2466
|
-
/**
|
|
2467
|
-
* Parse year range string to min/max values
|
|
2468
|
-
*/
|
|
2469
|
-
parseYearRange(t) {
|
|
2470
|
-
if (t.includes("-")) {
|
|
2471
|
-
const [n, a] = t.split("-");
|
|
2472
|
-
return { min: parseInt(n, 10), max: parseInt(a, 10) };
|
|
2473
|
-
} else {
|
|
2474
|
-
const n = parseInt(t, 10);
|
|
2475
|
-
return { min: n, max: n };
|
|
2476
|
-
}
|
|
2477
|
-
}
|
|
2478
|
-
/**
|
|
2479
|
-
* Parse month range string to min/max values
|
|
2480
|
-
*/
|
|
2481
|
-
parseMonthRange(t) {
|
|
2482
|
-
const [n, a] = t.split("-");
|
|
2483
|
-
return { min: parseInt(n, 10), max: parseInt(a, 10) };
|
|
2484
|
-
}
|
|
2485
|
-
/**
|
|
2486
|
-
* Check if a date should be disabled
|
|
2487
|
-
*/
|
|
2488
|
-
isDateDisabledInternal(t) {
|
|
2489
|
-
if (this.options.rollingYearRange) {
|
|
2490
|
-
const n = this.parseYearRange(this.options.rollingYearRange), a = t.getFullYear();
|
|
2491
|
-
if (a < n.min || a > n.max)
|
|
2492
|
-
return !0;
|
|
2493
|
-
}
|
|
2494
|
-
if (this.options.rollingMonthRange) {
|
|
2495
|
-
const n = this.parseMonthRange(this.options.rollingMonthRange), a = t.getMonth() + 1;
|
|
2496
|
-
if (a < n.min || a > n.max)
|
|
2497
|
-
return !0;
|
|
2498
|
-
}
|
|
2499
|
-
return Pt(
|
|
2500
|
-
t,
|
|
2501
|
-
this.normalizedMinDate,
|
|
2502
|
-
this.normalizedMaxDate,
|
|
2503
|
-
this.normalizedDisabledDates,
|
|
2504
|
-
this.options.disabledWeekdays,
|
|
2505
|
-
this.options.isDateDisabled
|
|
2506
|
-
);
|
|
2507
|
-
}
|
|
2508
|
-
/**
|
|
2509
|
-
* Get additional info for a date (special styling, labels, etc.)
|
|
2510
|
-
*/
|
|
2511
|
-
getDateInfoInternal(t) {
|
|
2512
|
-
const n = ve(t);
|
|
2513
|
-
if (this.normalizedSpecialDates.has(n)) {
|
|
2514
|
-
const a = this.normalizedSpecialDates.get(n);
|
|
2515
|
-
return {
|
|
2516
|
-
disabled: this.isDateDisabledInternal(t),
|
|
2517
|
-
class: a.class,
|
|
2518
|
-
label: a.label,
|
|
2519
|
-
tooltip: a.tooltip
|
|
2520
|
-
};
|
|
2521
|
-
}
|
|
2522
|
-
if (this.options.getDateMetadata) {
|
|
2523
|
-
const a = this.options.getDateMetadata(t);
|
|
2524
|
-
if (a)
|
|
2525
|
-
return {
|
|
2526
|
-
...a,
|
|
2527
|
-
disabled: a.disabled !== void 0 ? a.disabled : this.isDateDisabledInternal(t)
|
|
2528
|
-
};
|
|
2529
|
-
}
|
|
2530
|
-
return null;
|
|
2531
|
-
}
|
|
2532
|
-
/**
|
|
2533
|
-
* Check if there are any disabled dates in a range
|
|
2534
|
-
*/
|
|
2535
|
-
hasDisabledDatesInRange(t, n) {
|
|
2536
|
-
return Tt(t, n, (a) => this.isDateDisabledInternal(a));
|
|
2537
|
-
}
|
|
2538
|
-
/**
|
|
2539
|
-
* Get all enabled dates in a range
|
|
2540
|
-
*/
|
|
2541
|
-
getEnabledDatesInRange(t, n) {
|
|
2542
|
-
return zt(t, n, (a) => this.isDateDisabledInternal(a));
|
|
2543
|
-
}
|
|
2544
|
-
/**
|
|
2545
|
-
* Get all disabled dates in a range
|
|
2546
|
-
*/
|
|
2547
|
-
getDisabledDatesInRange(t, n) {
|
|
2548
|
-
return Ft(t, n, (a) => this.isDateDisabledInternal(a));
|
|
2549
|
-
}
|
|
2550
|
-
/**
|
|
2551
|
-
* For 'block' mode: Find the last enabled date before hitting a disabled date
|
|
2552
|
-
*/
|
|
2553
|
-
findLastEnabledBeforeGap(t, n) {
|
|
2554
|
-
return Nt(t, n, (a) => this.isDateDisabledInternal(a));
|
|
2555
|
-
}
|
|
2556
|
-
/**
|
|
2557
|
-
* For 'split' mode: Split a range into multiple ranges separated by disabled dates
|
|
2558
|
-
*/
|
|
2559
|
-
splitRangeByDisabled(t, n) {
|
|
2560
|
-
return Ot(t, n, (a) => this.isDateDisabledInternal(a));
|
|
2561
|
-
}
|
|
2562
|
-
isToday(t) {
|
|
2563
|
-
return Ht(t);
|
|
2564
|
-
}
|
|
2565
|
-
isSameDay(t, n) {
|
|
2566
|
-
return Je(t, n);
|
|
2567
|
-
}
|
|
2568
|
-
isInRange(t) {
|
|
2569
|
-
return Yt(t, this.selectedStartDate, this.selectedEndDate);
|
|
2570
|
-
}
|
|
2571
|
-
createCalendar() {
|
|
2572
|
-
$.debug("Creating calendar"), this.calendar = document.createElement("div"), this.calendar.className = "drp-date-picker";
|
|
2573
|
-
const t = document.createElement("div");
|
|
2574
|
-
this.options.monthLayout === "grid" ? (t.className = "drp-date-picker__months drp-date-picker__months--grid", this.options.gridRows && t.style.setProperty("--drp-grid-rows", String(this.options.gridRows)), this.options.gridColumns && t.style.setProperty("--drp-grid-columns", String(this.options.gridColumns))) : t.className = "drp-date-picker__months drp-date-picker__months--horizontal";
|
|
2575
|
-
for (let a = 0; a < this.options.visibleMonthsCount; a++) {
|
|
2576
|
-
const r = document.createElement("div");
|
|
2577
|
-
r.className = "drp-date-picker__month", r.dataset.monthIndex = String(a), r.innerHTML = `
|
|
2578
|
-
<div class="drp-date-picker__header">
|
|
2579
|
-
<button class="drp-date-picker__nav drp-date-picker__nav--prev" data-action="prev" data-month-index="${a}"></button>
|
|
2580
|
-
<div class="drp-date-picker__month-year" data-action="toggle-rolling" data-month-index="${a}"></div>
|
|
2581
|
-
<button class="drp-date-picker__nav drp-date-picker__nav--next" data-action="next" data-month-index="${a}"></button>
|
|
2582
|
-
</div>
|
|
2583
|
-
<div class="drp-date-picker__rolling-selector" data-month-index="${a}">
|
|
2584
|
-
<div class="drp-date-picker__rolling-list" data-list="years" data-month-index="${a}"></div>
|
|
2585
|
-
<div class="drp-date-picker__rolling-list" data-list="months" data-month-index="${a}"></div>
|
|
2586
|
-
</div>
|
|
2587
|
-
<div class="drp-date-picker__weekdays"></div>
|
|
2588
|
-
<div class="drp-date-picker__days" data-month-index="${a}"></div>
|
|
2589
|
-
`, t.appendChild(r);
|
|
2590
|
-
}
|
|
2591
|
-
if (this.calendar.appendChild(t), this.options.selectionMode === "range") {
|
|
2592
|
-
const a = document.createElement("div");
|
|
2593
|
-
a.className = "drp-date-picker__summary drp-date-picker__summary--hidden", this.calendar.appendChild(a);
|
|
2594
|
-
}
|
|
2595
|
-
const n = document.createElement("div");
|
|
2596
|
-
n.className = "drp-date-picker__actions", n.innerHTML = `
|
|
2597
|
-
<button class="drp-date-picker__button drp-date-picker__button--today" data-action="today">${this.localeStrings.today}</button>
|
|
2598
|
-
<button class="drp-date-picker__button drp-date-picker__button--clear" data-action="clear">${this.localeStrings.clear}</button>
|
|
2599
|
-
${this.options.selectionMode === "range" ? `<button class="drp-date-picker__button drp-date-picker__button--apply" data-action="apply">${this.localeStrings.apply}</button>` : ""}
|
|
2600
|
-
`, this.calendar.appendChild(n), this.containerElement.appendChild(this.calendar), $.debug("Calendar appended to container:", this.calendar), this.tooltip = document.createElement("div"), this.tooltip.className = "drp-date-picker__tooltip", this.tooltipArrow = document.createElement("div"), this.tooltipArrow.className = "drp-date-picker__tooltip-arrow", this.tooltip.appendChild(this.tooltipArrow), this.containerElement.appendChild(this.tooltip), this.attachCalendarListeners(), this.showingRollingSelector = new Array(this.options.visibleMonthsCount).fill(!1);
|
|
2601
|
-
}
|
|
2602
|
-
attachInputListeners() {
|
|
2603
|
-
if (!this.input) return;
|
|
2604
|
-
$.debug("Attaching input listeners");
|
|
2605
|
-
const t = this.options.calendarOpenTrigger || "focus";
|
|
2606
|
-
t === "focus" ? this.input.addEventListener("focus", () => {
|
|
2607
|
-
$.debug("Input focused - opening calendar"), this.show();
|
|
2608
|
-
}) : t === "typing" && this.input.addEventListener("input", (n) => {
|
|
2609
|
-
!this.isVisible && this.input && this.input.value.length > 0 && ($.debug("User started typing - opening calendar"), this.show());
|
|
2610
|
-
}), this.input.addEventListener("input", (n) => this.handleInputMask(n)), this.input.addEventListener("keydown", (n) => this.handleKeydown(n)), this.input.addEventListener("paste", (n) => this.handlePaste(n));
|
|
2611
|
-
}
|
|
2612
|
-
attachCalendarListeners() {
|
|
2613
|
-
this.calendar.addEventListener("click", async (t) => {
|
|
2614
|
-
const n = t.target;
|
|
2615
|
-
t.stopPropagation();
|
|
2616
|
-
const a = n.dataset.action, r = n.dataset.monthIndex, o = r ? parseInt(r) : 0;
|
|
2617
|
-
if (a === "prev") this.prevMonth(o);
|
|
2618
|
-
else if (a === "next") this.nextMonth(o);
|
|
2619
|
-
else if (a === "toggle-rolling") this.toggleRollingSelector(o);
|
|
2620
|
-
else if (a === "today") this.selectToday();
|
|
2621
|
-
else if (a === "clear") this.clearSelection();
|
|
2622
|
-
else if (a === "apply") this.apply();
|
|
2623
|
-
else if (n.closest(".drp-date-picker__day:not(.drp-date-picker__day--disabled)"))
|
|
2624
|
-
await this.selectDay(n.closest(".drp-date-picker__day"));
|
|
2625
|
-
else if (n.closest("[data-year]")) {
|
|
2626
|
-
const s = n.closest("[data-year]");
|
|
2627
|
-
if (s.classList.contains("drp-date-picker__rolling-item--disabled"))
|
|
2628
|
-
return;
|
|
2629
|
-
const i = s.dataset.year, d = s.dataset.monthIndex;
|
|
2630
|
-
i && d && this.selectYear(parseInt(i), parseInt(d));
|
|
2631
|
-
} else if (n.closest("[data-month]")) {
|
|
2632
|
-
const s = n.closest("[data-month]");
|
|
2633
|
-
if (s.classList.contains("drp-date-picker__rolling-item--disabled"))
|
|
2634
|
-
return;
|
|
2635
|
-
const i = s.dataset.month, d = s.dataset.monthIndex;
|
|
2636
|
-
i && d && this.selectMonth(parseInt(i), parseInt(d));
|
|
2637
|
-
}
|
|
2638
|
-
}), this.calendar.addEventListener("mouseenter", (t) => {
|
|
2639
|
-
const n = t.target, a = n.closest(".drp-date-picker__day"), r = n.closest(".drp-date-picker__badge-cell"), o = a || r;
|
|
2640
|
-
if (o && o instanceof HTMLElement) {
|
|
2641
|
-
const s = o.dataset.tooltip;
|
|
2642
|
-
s && this.showTooltip(o, s);
|
|
2643
|
-
}
|
|
2644
|
-
}, !0), this.calendar.addEventListener("mouseleave", (t) => {
|
|
2645
|
-
const n = t.target, a = n.closest(".drp-date-picker__day"), r = n.closest(".drp-date-picker__badge-cell"), o = a || r;
|
|
2646
|
-
o && this.currentTooltipTarget === o && this.hideTooltip();
|
|
2647
|
-
}, !0), this.calendar.addEventListener("mousedown", (t) => {
|
|
2648
|
-
this.isCalendarActive = !0, t.stopPropagation();
|
|
2649
|
-
}), this.calendar.addEventListener("focusin", () => {
|
|
2650
|
-
this.isCalendarActive = !0;
|
|
2651
|
-
}), document.addEventListener("mousedown", (t) => {
|
|
2652
|
-
this.calendar.contains(t.target) || (this.isCalendarActive = !1);
|
|
2653
|
-
}, !0), document.addEventListener("keydown", (t) => {
|
|
2654
|
-
var n, a, r, o;
|
|
2655
|
-
if (this.calendar.classList.contains("drp-date-picker--visible") && this.isCalendarActive) {
|
|
2656
|
-
if ($.debug("Keydown", t.key, "Ctrl:", t.ctrlKey, "Meta:", t.metaKey, "Shift:", t.shiftKey, "Alt:", t.altKey), t.key === "Escape")
|
|
2657
|
-
this.hide(), t.preventDefault();
|
|
2658
|
-
else if (t.key === "ArrowUp")
|
|
2659
|
-
this.moveFocus(-7), t.preventDefault();
|
|
2660
|
-
else if (t.key === "ArrowDown")
|
|
2661
|
-
this.moveFocus(7), t.preventDefault();
|
|
2662
|
-
else if (t.key === "ArrowLeft") {
|
|
2663
|
-
if (t.ctrlKey || t.metaKey) {
|
|
2664
|
-
C.debug("Ctrl+Left: Navigate to previous month");
|
|
2665
|
-
const s = this.focusedDayIndex;
|
|
2666
|
-
this.prevMonth(this.activeMonthIndex), setTimeout(() => {
|
|
2667
|
-
var l, c;
|
|
2668
|
-
const i = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), d = i == null ? void 0 : i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
2669
|
-
d && (this.focusedDayIndex = Math.min(s !== null ? s : 0, d.length - 1), (l = d[this.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"), (c = d[this.focusedDayIndex]) == null || c.scrollIntoView({ block: "nearest" }));
|
|
2670
|
-
}, 0);
|
|
2671
|
-
} else
|
|
2672
|
-
this.moveFocus(-1);
|
|
2673
|
-
t.preventDefault();
|
|
2674
|
-
} else if (t.key === "ArrowRight") {
|
|
2675
|
-
if (t.ctrlKey || t.metaKey) {
|
|
2676
|
-
C.debug("Ctrl+Right: Navigate to next month");
|
|
2677
|
-
const s = this.focusedDayIndex;
|
|
2678
|
-
this.nextMonth(this.activeMonthIndex), setTimeout(() => {
|
|
2679
|
-
var l, c;
|
|
2680
|
-
const i = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), d = i == null ? void 0 : i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
2681
|
-
d && (this.focusedDayIndex = Math.min(s !== null ? s : 0, d.length - 1), (l = d[this.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"), (c = d[this.focusedDayIndex]) == null || c.scrollIntoView({ block: "nearest" }));
|
|
2682
|
-
}, 0);
|
|
2683
|
-
} else
|
|
2684
|
-
this.moveFocus(1);
|
|
2685
|
-
t.preventDefault();
|
|
2686
|
-
} else if (t.key === "Enter") {
|
|
2687
|
-
if (this.focusedDayIndex !== null) {
|
|
2688
|
-
const s = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), i = s == null ? void 0 : s.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), d = i == null ? void 0 : i[this.focusedDayIndex];
|
|
2689
|
-
d && d.click();
|
|
2690
|
-
} else
|
|
2691
|
-
this.hide();
|
|
2692
|
-
t.preventDefault();
|
|
2693
|
-
} else if (t.key === "Tab") {
|
|
2694
|
-
if (this.options.visibleMonthsCount > 1) {
|
|
2695
|
-
const s = t.shiftKey ? -1 : 1, i = this.activeMonthIndex + s;
|
|
2696
|
-
if (i >= 0 && i < this.monthDates.length) {
|
|
2697
|
-
C.debug(`Tab: switching from Col${this.activeMonthIndex} to Col${i}`);
|
|
2698
|
-
const d = this.focusedDayIndex ?? 0;
|
|
2699
|
-
this.activeMonthIndex = i;
|
|
2700
|
-
const l = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`);
|
|
2701
|
-
if (l) {
|
|
2702
|
-
const c = l.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
2703
|
-
this.focusedDayIndex = Math.min(d, c.length - 1), C.debug(`Col${this.activeMonthIndex} Tab: set focusedDayIndex to ${this.focusedDayIndex}`);
|
|
2704
|
-
}
|
|
2705
|
-
this.renderCalendar();
|
|
2706
|
-
}
|
|
2707
|
-
t.preventDefault();
|
|
2708
|
-
}
|
|
2709
|
-
} else if (t.key === "t" || t.key === "T")
|
|
2710
|
-
this.monthDates[this.activeMonthIndex] = /* @__PURE__ */ new Date(), this.renderCalendar(), setTimeout(() => {
|
|
2711
|
-
const s = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), i = s == null ? void 0 : s.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
2712
|
-
if (i) {
|
|
2713
|
-
const d = Array.from(i).findIndex((l) => l.classList.contains("drp-date-picker__day--today"));
|
|
2714
|
-
d !== -1 && (this.focusedDayIndex = d, i[d].classList.add("drp-date-picker__day--focused"), i[d].scrollIntoView({ block: "nearest" }));
|
|
2715
|
-
}
|
|
2716
|
-
}, 0), t.preventDefault();
|
|
2717
|
-
else if (t.key === "PageUp") {
|
|
2718
|
-
const s = this.focusedDayIndex;
|
|
2719
|
-
this.prevMonth(this.activeMonthIndex), setTimeout(() => {
|
|
2720
|
-
var l, c;
|
|
2721
|
-
const i = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), d = i == null ? void 0 : i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
2722
|
-
d && (this.focusedDayIndex = Math.min(s !== null ? s : 0, d.length - 1), (l = d[this.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"), (c = d[this.focusedDayIndex]) == null || c.scrollIntoView({ block: "nearest" }));
|
|
2723
|
-
}, 0), t.preventDefault();
|
|
2724
|
-
} else if (t.key === "PageDown") {
|
|
2725
|
-
const s = this.focusedDayIndex;
|
|
2726
|
-
this.nextMonth(this.activeMonthIndex), setTimeout(() => {
|
|
2727
|
-
var l, c;
|
|
2728
|
-
const i = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), d = i == null ? void 0 : i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
2729
|
-
d && (this.focusedDayIndex = Math.min(s !== null ? s : 0, d.length - 1), (l = d[this.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"), (c = d[this.focusedDayIndex]) == null || c.scrollIntoView({ block: "nearest" }));
|
|
2730
|
-
}, 0), t.preventDefault();
|
|
2731
|
-
} else if (t.key === "Home") {
|
|
2732
|
-
C.debug("Home key pressed, Ctrl:", t.ctrlKey, "Meta:", t.metaKey);
|
|
2733
|
-
const s = this.monthDates[this.activeMonthIndex].getFullYear(), i = this.monthDates[this.activeMonthIndex].getMonth();
|
|
2734
|
-
if (t.ctrlKey || t.metaKey) {
|
|
2735
|
-
C.debug("Ctrl+Home: Navigate to year start");
|
|
2736
|
-
const d = i === 0, l = this.focusedDayIndex === 0;
|
|
2737
|
-
d && l ? (C.debug("Already at Jan 1, going to previous year"), this.monthDates[this.activeMonthIndex] = new Date(s - 1, 0, 1)) : (C.debug("Going to Jan 1 of current year"), this.monthDates[this.activeMonthIndex] = new Date(s, 0, 1)), this.renderCalendar(), setTimeout(() => {
|
|
2738
|
-
var p, g;
|
|
2739
|
-
const c = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), u = c == null ? void 0 : c.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
2740
|
-
u && (this.focusedDayIndex = 0, (p = u[0]) == null || p.classList.add("drp-date-picker__day--focused"), (g = u[0]) == null || g.scrollIntoView({ block: "nearest" }));
|
|
2741
|
-
}, 0);
|
|
2742
|
-
} else if (C.debug("Home: Navigate to first day (cycles to previous month if already there)"), this.focusedDayIndex === 0)
|
|
2743
|
-
C.debug("Already on first day, going to previous month"), this.prevMonth(this.activeMonthIndex), setTimeout(() => {
|
|
2744
|
-
var u, p;
|
|
2745
|
-
const l = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), c = l == null ? void 0 : l.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
2746
|
-
c && (this.focusedDayIndex = 0, this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((g) => g.classList.remove("drp-date-picker__day--focused")), (u = c[0]) == null || u.classList.add("drp-date-picker__day--focused"), (p = c[0]) == null || p.scrollIntoView({ block: "nearest" }));
|
|
2747
|
-
}, 0);
|
|
2748
|
-
else {
|
|
2749
|
-
this.focusedDayIndex = 0;
|
|
2750
|
-
const l = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), c = l == null ? void 0 : l.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
2751
|
-
c && (this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((u) => u.classList.remove("drp-date-picker__day--focused")), (n = c[0]) == null || n.classList.add("drp-date-picker__day--focused"), (a = c[0]) == null || a.scrollIntoView({ block: "nearest" }));
|
|
2752
|
-
}
|
|
2753
|
-
t.preventDefault();
|
|
2754
|
-
} else if (t.key === "End") {
|
|
2755
|
-
C.debug("End key pressed, Ctrl:", t.ctrlKey, "Meta:", t.metaKey);
|
|
2756
|
-
const s = this.monthDates[this.activeMonthIndex].getFullYear(), i = this.monthDates[this.activeMonthIndex].getMonth();
|
|
2757
|
-
if (t.ctrlKey || t.metaKey) {
|
|
2758
|
-
C.debug("Ctrl+End: Navigate to year end");
|
|
2759
|
-
const d = i === 11, l = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), c = l == null ? void 0 : l.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), u = c && this.focusedDayIndex === c.length - 1;
|
|
2760
|
-
d && u ? this.monthDates[this.activeMonthIndex] = new Date(s + 1, 11, 31) : this.monthDates[this.activeMonthIndex] = new Date(s, 11, 31), this.renderCalendar(), setTimeout(() => {
|
|
2761
|
-
var h, f;
|
|
2762
|
-
const p = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), g = p == null ? void 0 : p.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
2763
|
-
g && (this.focusedDayIndex = g.length - 1, (h = g[this.focusedDayIndex]) == null || h.classList.add("drp-date-picker__day--focused"), (f = g[this.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
|
|
2764
|
-
}, 0);
|
|
2765
|
-
} else {
|
|
2766
|
-
C.debug("End: Navigate to last day (cycles to next month if already there)");
|
|
2767
|
-
const d = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), l = d == null ? void 0 : d.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
2768
|
-
if (!l) return;
|
|
2769
|
-
this.focusedDayIndex === l.length - 1 ? (C.debug("Already on last day, going to next month"), this.nextMonth(this.activeMonthIndex), setTimeout(() => {
|
|
2770
|
-
var g, h;
|
|
2771
|
-
const u = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), p = u == null ? void 0 : u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
|
|
2772
|
-
p && (this.focusedDayIndex = p.length - 1, this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((f) => f.classList.remove("drp-date-picker__day--focused")), (g = p[this.focusedDayIndex]) == null || g.classList.add("drp-date-picker__day--focused"), (h = p[this.focusedDayIndex]) == null || h.scrollIntoView({ block: "nearest" }));
|
|
2773
|
-
}, 0)) : (this.focusedDayIndex = l.length - 1, this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((u) => u.classList.remove("drp-date-picker__day--focused")), (r = l[this.focusedDayIndex]) == null || r.classList.add("drp-date-picker__day--focused"), (o = l[this.focusedDayIndex]) == null || o.scrollIntoView({ block: "nearest" }));
|
|
2774
|
-
}
|
|
2775
|
-
t.preventDefault();
|
|
2776
|
-
}
|
|
2777
|
-
}
|
|
2778
|
-
}), this.options.positioningMode === "floating" && (this.clickOutsideHandler = (t) => {
|
|
2779
|
-
var i;
|
|
2780
|
-
const n = t.composedPath(), a = n[0], r = n.includes(this.calendar), o = this.input && n.includes(this.input), s = (i = a.closest) == null ? void 0 : i.call(a, "[data-calendar-button]");
|
|
2781
|
-
!r && !o && !s && this.hide();
|
|
2782
|
-
}, document.addEventListener("click", this.clickOutsideHandler));
|
|
2783
|
-
}
|
|
2784
|
-
// Helper methods
|
|
2785
|
-
parseFormat(t) {
|
|
2786
|
-
const n = {};
|
|
2787
|
-
let a = "";
|
|
2788
|
-
return t.includes("-") ? a = "-" : t.includes("/") ? a = "/" : t.includes(".") && (a = "."), t.split(a).forEach((o, s) => {
|
|
2789
|
-
o === "YYYY" || o === "YY" ? n.year = { index: s, length: o.length } : o === "MM" || o === "M" ? n.month = { index: s, length: 2 } : (o === "DD" || o === "D") && (n.day = { index: s, length: 2 });
|
|
2790
|
-
}), {
|
|
2791
|
-
format: t,
|
|
2792
|
-
separator: a,
|
|
2793
|
-
parts: n,
|
|
2794
|
-
maxLength: t.length
|
|
2795
|
-
};
|
|
2796
|
-
}
|
|
2797
|
-
formatDate(t) {
|
|
2798
|
-
if (!t) return "";
|
|
2799
|
-
const n = t.getFullYear(), a = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0"), { format: o, separator: s, parts: i } = this.formatInfo, d = [];
|
|
2800
|
-
for (let l = 0; l < 3; l++)
|
|
2801
|
-
i.year && i.year.index === l ? d.push(i.year.length === 2 ? String(n).slice(-2) : n) : i.month && i.month.index === l ? d.push(a) : i.day && i.day.index === l && d.push(r);
|
|
2802
|
-
return d.join(s);
|
|
2803
|
-
}
|
|
2804
|
-
destroy() {
|
|
2805
|
-
this.clickOutsideHandler && document.removeEventListener("click", this.clickOutsideHandler), this.calendar.remove(), this.tooltip && this.tooltip.remove();
|
|
2806
|
-
}
|
|
2807
|
-
// UI methods - wrappers for pure functions
|
|
2808
|
-
show() {
|
|
2809
|
-
return bt(this);
|
|
2810
|
-
}
|
|
2811
|
-
hide() {
|
|
2812
|
-
return _t(this);
|
|
2813
|
-
}
|
|
2814
|
-
toggle() {
|
|
2815
|
-
return Bn(this);
|
|
2816
|
-
}
|
|
2817
|
-
position() {
|
|
2818
|
-
return wt(this);
|
|
2819
|
-
}
|
|
2820
|
-
showTooltip(t, n) {
|
|
2821
|
-
return Wn(this, t, n);
|
|
2822
|
-
}
|
|
2823
|
-
hideTooltip() {
|
|
2824
|
-
return jn(this);
|
|
2825
|
-
}
|
|
2826
|
-
// Rendering methods - wrappers for pure functions
|
|
2827
|
-
renderCalendar() {
|
|
2828
|
-
return Jt(this);
|
|
2829
|
-
}
|
|
2830
|
-
renderNormalView(t) {
|
|
2831
|
-
return nt(this, t);
|
|
2832
|
-
}
|
|
2833
|
-
renderDays(t, n) {
|
|
2834
|
-
return at(this, t, n);
|
|
2835
|
-
}
|
|
2836
|
-
renderRollingSelector(t) {
|
|
2837
|
-
return rt(this, t);
|
|
2838
|
-
}
|
|
2839
|
-
updateSummary() {
|
|
2840
|
-
return Zt(this);
|
|
2841
|
-
}
|
|
2842
|
-
updateSummaryWithPreview() {
|
|
2843
|
-
return st(this);
|
|
2844
|
-
}
|
|
2845
|
-
updateDragPreview() {
|
|
2846
|
-
return en(this);
|
|
2847
|
-
}
|
|
2848
|
-
// Navigation methods - wrappers for pure functions
|
|
2849
|
-
toggleRollingSelector(t) {
|
|
2850
|
-
return Wt(this, t);
|
|
2851
|
-
}
|
|
2852
|
-
selectYear(t, n) {
|
|
2853
|
-
return jt(this, t, n);
|
|
2854
|
-
}
|
|
2855
|
-
selectMonth(t, n) {
|
|
2856
|
-
return Kt(this, t, n);
|
|
2857
|
-
}
|
|
2858
|
-
checkAndResolveCollisions(t) {
|
|
2859
|
-
return ue(this, t);
|
|
2860
|
-
}
|
|
2861
|
-
prevMonth(t) {
|
|
2862
|
-
return ce(this, t);
|
|
2863
|
-
}
|
|
2864
|
-
nextMonth(t) {
|
|
2865
|
-
return pe(this, t);
|
|
2866
|
-
}
|
|
2867
|
-
findNextEnabledDayIndex(t, n, a, r) {
|
|
2868
|
-
return le(this, t, n, a);
|
|
2869
|
-
}
|
|
2870
|
-
moveFocus(t) {
|
|
2871
|
-
return Ut(this, t);
|
|
2872
|
-
}
|
|
2873
|
-
// Selection methods - wrappers for pure functions
|
|
2874
|
-
async selectDay(t) {
|
|
2875
|
-
return await Un(this, t);
|
|
2876
|
-
}
|
|
2877
|
-
selectToday() {
|
|
2878
|
-
return Xn(this);
|
|
2879
|
-
}
|
|
2880
|
-
clearSelection() {
|
|
2881
|
-
return Gn(this);
|
|
2882
|
-
}
|
|
2883
|
-
apply() {
|
|
2884
|
-
return Jn(this);
|
|
2885
|
-
}
|
|
2886
|
-
// Interaction methods - wrappers for pure functions
|
|
2887
|
-
initDragListeners() {
|
|
2888
|
-
return Qn(this);
|
|
2889
|
-
}
|
|
2890
|
-
startDrag(t, n) {
|
|
2891
|
-
return St(this, t, n);
|
|
2892
|
-
}
|
|
2893
|
-
onDragMove(t) {
|
|
2894
|
-
return Mt(this, t);
|
|
2895
|
-
}
|
|
2896
|
-
async onDragEnd(t) {
|
|
2897
|
-
return await It(this);
|
|
2898
|
-
}
|
|
2899
|
-
findNearestEnabledDate(t, n = "forward") {
|
|
2900
|
-
return Se(this, t, n);
|
|
2901
|
-
}
|
|
2902
|
-
handleInputMask(t) {
|
|
2903
|
-
return Zn(this, t);
|
|
2904
|
-
}
|
|
2905
|
-
applyMask(t) {
|
|
2906
|
-
return oe(this, t);
|
|
2907
|
-
}
|
|
2908
|
-
applyRangeMask(t) {
|
|
2909
|
-
return Et(this, t);
|
|
2910
|
-
}
|
|
2911
|
-
handleKeydown(t) {
|
|
2912
|
-
return ea(this, t);
|
|
2913
|
-
}
|
|
2914
|
-
handlePaste(t) {
|
|
2915
|
-
return ta(this, t);
|
|
2916
|
-
}
|
|
2917
|
-
updateCalendarFromInput() {
|
|
2918
|
-
return Ve(this);
|
|
2919
|
-
}
|
|
2920
|
-
parseAndUpdateSingleDate(t, n = "single") {
|
|
2921
|
-
return De(this, t, n);
|
|
2922
|
-
}
|
|
2923
|
-
}
|
|
2924
|
-
const oa = '@charset "UTF-8";:host{--drp-card-bg: #ffffff;--drp-border-color: #e5e7eb;--drp-primary-bg: #f3f4f6;--drp-primary-bg-hover: #e5e7eb;--drp-accent-color: #3b82f6;--drp-accent-color-hover: #2563eb;--drp-text-primary: #111827;--drp-text-secondary: #6b7280;--drp-accent-text-color: #ffffff;--drp-button-text-color: #ffffff;--drp-spacing-xs: .25rem;--drp-spacing-sm: .5rem;--drp-spacing-md: 1rem;--drp-spacing-lg: 1.5rem;--drp-spacing-xl: 2rem;--drp-font-size-2xs: .625rem;--drp-font-size-xs: .75rem;--drp-font-size-sm: .875rem;--drp-font-size-base: 1rem;--drp-font-size-lg: 1.125rem;--drp-font-size-xl: 1.25rem;--drp-font-size-2xl: 1.5rem;--drp-font-weight-medium: 500;--drp-font-weight-semibold: 600;--drp-border-width-base: 1px;--drp-border-radius: .375rem;--drp-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1);--drp-transition-fast: .15s;--drp-easing-snappy: cubic-bezier(.4, 0, .2, 1);--drp-input-padding-h: .75rem;--drp-grid-columns: 3;--drp-grid-rows: 2}.drp-date-picker-input{position:relative;cursor:pointer}.drp-date-picker-input:after{content:"📅";position:absolute;right:var(--drp-input-padding-h);top:50%;transform:translateY(-50%);pointer-events:none;opacity:.6}.drp-date-picker{position:absolute;z-index:9500;background:var(--drp-card-bg);border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);box-shadow:var(--drp-shadow-xl);padding:var(--drp-spacing-md);min-width:280px;max-width:calc(100vw - 2rem);box-sizing:border-box;-webkit-user-select:none;user-select:none}.drp-date-picker:not(.drp-date-picker--visible){display:none}.drp-date-picker--inline{position:relative!important;display:block!important;z-index:auto;min-width:0;max-width:100%;width:fit-content;box-sizing:border-box}.drp-date-picker__months{display:flex;gap:var(--drp-spacing-lg)}.drp-date-picker--inline .drp-date-picker__months{flex-wrap:wrap}.drp-date-picker__months--grid{display:grid;grid-template-columns:repeat(var(--drp-grid-columns, 3),minmax(0,1fr));grid-template-rows:repeat(var(--drp-grid-rows, 2),auto);gap:var(--drp-spacing-lg);width:100%}@media (max-width: 1200px){.drp-date-picker__months--grid{grid-template-columns:repeat(min(var(--drp-grid-columns, 3),3),minmax(0,1fr))}}@media (max-width: 768px){.drp-date-picker__months--grid{grid-template-columns:repeat(min(var(--drp-grid-columns, 3),2),minmax(0,1fr))}}@media (max-width: 480px){.drp-date-picker__months--grid{grid-template-columns:minmax(0,1fr)}}.drp-date-picker__month{flex:1;min-width:280px}.drp-date-picker--inline .drp-date-picker__month{min-width:250px}.drp-date-picker__months--grid .drp-date-picker__month{min-width:0;width:100%}.drp-date-picker__header{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--drp-spacing-md);gap:var(--drp-spacing-sm)}.drp-date-picker__month-year{flex:1;text-align:center;font-weight:var(--drp-font-weight-semibold);font-size:var(--drp-font-size-base);color:var(--drp-text-primary);padding:var(--drp-spacing-sm) var(--drp-spacing-md);border-radius:var(--drp-border-radius);cursor:pointer;transition:background-color var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__month-year:hover{background-color:var(--drp-primary-bg)}.drp-date-picker__month-year:active{background-color:var(--drp-primary-bg-hover)}.drp-date-picker__nav{width:2rem;height:2rem;display:flex;align-items:center;justify-content:center;border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);background:transparent;cursor:pointer;transition:all var(--drp-transition-fast) var(--drp-easing-snappy);font-size:var(--drp-font-size-lg);color:var(--drp-text-primary)}.drp-date-picker__nav:hover{background-color:var(--drp-primary-bg);border-color:var(--drp-accent-color)}.drp-date-picker__nav:active{background-color:var(--drp-primary-bg-hover)}.drp-date-picker__nav--disabled,.drp-date-picker__nav[disabled]{opacity:.6;cursor:not-allowed;pointer-events:none}.drp-date-picker__nav--disabled:hover,.drp-date-picker__nav[disabled]:hover{background-color:transparent;border-color:var(--drp-border-color)}.drp-date-picker__nav--prev:before{content:"‹"}.drp-date-picker__nav--next:before{content:"›"}.drp-date-picker__rolling-selector{display:none}.drp-date-picker__rolling-selector.drp-date-picker__rolling-selector--visible{display:flex}.drp-date-picker__rolling-selector.drp-date-picker__rolling-selector--visible~.drp-date-picker__weekdays,.drp-date-picker__rolling-selector.drp-date-picker__rolling-selector--visible~.drp-date-picker__days{display:none}.drp-date-picker__rolling-selector{gap:var(--drp-spacing-xs);margin-bottom:var(--drp-spacing-md)}.drp-date-picker__rolling-list{flex:1;height:100%;overflow-y:auto;border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);scroll-behavior:smooth}.drp-date-picker__rolling-list::-webkit-scrollbar{width:6px}.drp-date-picker__rolling-list::-webkit-scrollbar-track{background:var(--drp-primary-bg)}.drp-date-picker__rolling-list::-webkit-scrollbar-thumb{background:var(--drp-border-color);border-radius:3px}.drp-date-picker__rolling-list::-webkit-scrollbar-thumb:hover{background:var(--drp-accent-color)}.drp-date-picker__rolling-item{padding:var(--drp-spacing-sm) var(--drp-spacing-md);text-align:center;cursor:pointer;font-size:var(--drp-font-size-sm);transition:background-color var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__rolling-item:hover{background-color:var(--drp-primary-bg)}.drp-date-picker__rolling-item--selected{background-color:var(--drp-accent-color);color:var(--drp-accent-text-color);font-weight:var(--drp-font-weight-semibold)}.drp-date-picker__rolling-item--selected:hover{background-color:var(--drp-accent-color-hover)}.drp-date-picker__weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--drp-spacing-xs);margin-bottom:var(--drp-spacing-sm)}.drp-date-picker__weekday{text-align:center;font-size:var(--drp-font-size-xs);font-weight:var(--drp-font-weight-semibold);color:var(--drp-text-secondary);padding:var(--drp-spacing-xs);text-transform:uppercase}.drp-date-picker__days{display:flex;flex-direction:column;gap:var(--drp-spacing-xs);margin-bottom:var(--drp-spacing-md)}.drp-date-picker__date-row{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--drp-spacing-xs)}.drp-date-picker__day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:var(--drp-font-size-sm);color:var(--drp-text-primary);border-radius:var(--drp-border-radius);cursor:pointer;transition:all var(--drp-transition-fast) var(--drp-easing-snappy);border:2px solid transparent;position:relative}.drp-date-picker__day:hover:not(.drp-date-picker__day--disabled):not(.drp-date-picker__day--other-month){background-color:var(--drp-primary-bg);border-color:var(--drp-accent-color)}.drp-date-picker__day--today{border-color:var(--drp-accent-color);font-weight:var(--drp-font-weight-semibold)}.drp-date-picker__day--selected{background-color:var(--drp-accent-color);color:var(--drp-accent-text-color);font-weight:var(--drp-font-weight-semibold)}.drp-date-picker__day--selected:hover{background-color:var(--drp-accent-color-hover)}.drp-date-picker__day--focused{outline:2px solid var(--drp-accent-color);outline-offset:2px}.drp-date-picker__day--disabled{color:var(--drp-text-secondary);opacity:.6;cursor:not-allowed;position:relative}.drp-date-picker__day--disabled:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background-image:repeating-linear-gradient(45deg,rgba(0,0,0,.1) 0px,rgba(0,0,0,.1) 1px,transparent 1px,transparent 6px);border-radius:var(--drp-border-radius);pointer-events:none}.drp-date-picker__day--disabled:hover{background-color:transparent;border-color:transparent}.drp-date-picker__day--other-month{color:var(--drp-text-secondary);opacity:.5}.drp-date-picker__day--other-month.drp-date-picker__day--range-start,.drp-date-picker__day--other-month.drp-date-picker__day--range-end,.drp-date-picker__day--other-month.drp-date-picker__day--in-range,.drp-date-picker__day--other-month.drp-date-picker__day--drag-preview{opacity:1}.drp-date-picker__day--range-start,.drp-date-picker__day--range-end{background-color:var(--drp-accent-color);color:var(--drp-accent-text-color);font-weight:var(--drp-font-weight-semibold);cursor:grab;-webkit-user-select:none;user-select:none}.drp-date-picker__day--range-start:active,.drp-date-picker__day--range-end:active{cursor:grabbing}.drp-date-picker__day--in-range{background-color:color-mix(in srgb,var(--drp-accent-color) 15%,transparent)}.drp-date-picker__day--in-range:hover{background-color:color-mix(in srgb,var(--drp-accent-color) 25%,transparent)}.drp-date-picker__day--dragging{cursor:grabbing!important;opacity:.7;transform:scale(1.1);transition:transform var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__day--drag-preview{background-color:color-mix(in srgb,var(--drp-accent-color) 30%,transparent);border:2px dashed var(--drp-accent-color)}.drp-date-picker__day--drag-preview.drp-date-picker__day--range-start,.drp-date-picker__day--drag-preview.drp-date-picker__day--range-end{background-color:color-mix(in srgb,var(--drp-accent-color) 60%,transparent);color:var(--drp-accent-text-color)}.drp-date-picker__day--drag-invalid{background-color:color-mix(in srgb,#ef4444 20%,transparent)!important;border-color:#ef4444!important;border-style:dashed!important}.drp-date-picker__day.holiday{background-color:color-mix(in srgb,#ef4444 10%,transparent)}.drp-date-picker__day.holiday:hover:not(.drp-date-picker__day--disabled){background-color:color-mix(in srgb,#ef4444 20%,transparent)}.drp-date-picker__day.event{background-color:color-mix(in srgb,#10b981 10%,transparent)}.drp-date-picker__day.event:hover:not(.drp-date-picker__day--disabled){background-color:color-mix(in srgb,#10b981 20%,transparent)}.drp-date-picker__rolling-item--disabled{color:var(--drp-text-secondary);opacity:.4;cursor:not-allowed;pointer-events:none;text-decoration:line-through}.drp-date-picker__rolling-item--disabled:hover{background-color:transparent}.drp-date-picker__badge-row{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--drp-spacing-xs);margin-bottom:var(--drp-spacing-xs);max-height:1rem;min-height:1rem}.drp-date-picker__badge-cell{display:flex;align-items:center;justify-content:center;font-size:var(--drp-font-size-2xs);padding:1px 2px;border-radius:2px;transition:all var(--drp-transition-fast) var(--drp-easing-snappy);cursor:pointer;height:100%;max-height:1rem}.drp-date-picker__badge-cell:empty{visibility:hidden}.drp-date-picker__badge-cell:hover:not(:empty){transform:scale(1.05)}.drp-date-picker__badge-cell.badge-number{background-color:#10b981;color:#fff;font-size:.7rem;font-weight:600}.drp-date-picker__badge-cell.badge-count{background-color:#ef4444;color:#fff;font-size:.7rem;font-weight:700}.drp-date-picker__badge-cell.badge-text{background-color:#6b7280;color:#fff;font-size:.65rem;font-weight:700;text-transform:uppercase}.drp-date-picker__summary{text-align:center;padding:var(--drp-spacing-md);border-top:var(--drp-border-width-base) solid var(--drp-border-color);font-size:var(--drp-font-size-sm);color:var(--drp-text-secondary)}.drp-date-picker__summary--visible{display:block}.drp-date-picker__summary--hidden{display:none}.drp-date-picker__summary-count{font-weight:var(--drp-font-weight-semibold);color:var(--drp-accent-color);font-size:var(--drp-font-size-base)}.drp-date-picker__actions{display:flex;gap:var(--drp-spacing-sm);justify-content:space-between;padding-top:var(--drp-spacing-sm);border-top:var(--drp-border-width-base) solid var(--drp-border-color)}.drp-date-picker__button{flex:1;padding:var(--drp-spacing-sm) var(--drp-spacing-md);border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);background:transparent;cursor:pointer;font-size:var(--drp-font-size-sm);font-weight:var(--drp-font-weight-medium);transition:all var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__button:hover{background-color:var(--drp-primary-bg);border-color:var(--drp-accent-color)}.drp-date-picker__button--today{color:var(--drp-accent-color)}.drp-date-picker__button--clear{color:var(--drp-text-secondary)}.drp-date-picker__button--apply{background-color:var(--drp-accent-color);color:var(--drp-button-text-color);border-color:var(--drp-accent-color)}.drp-date-picker__button--apply:hover{background-color:var(--drp-accent-color-hover)}.drp-date-picker__button--cancel{color:var(--drp-text-secondary)}.drp-date-picker__tooltip{position:absolute;z-index:9999;background-color:var(--drp-text-primary);color:#fff;padding:var(--drp-spacing-xs) var(--drp-spacing-sm);border-radius:var(--drp-border-radius);font-size:var(--drp-font-size-xs);line-height:1.4;max-width:200px;word-wrap:break-word;pointer-events:none;opacity:0;transition:opacity var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__tooltip--visible{opacity:1}.drp-date-picker__tooltip-arrow{position:absolute;background-color:var(--drp-text-primary);width:8px;height:8px;transform:rotate(45deg)}.drp-date-picker__loading-overlay{position:absolute;top:0;left:0;right:0;bottom:0;background-color:#fffc;display:flex;align-items:center;justify-content:center;z-index:9500;border-radius:.375rem}.drp-date-picker__loading-spinner{width:40px;height:40px;border:4px solid #e5e7eb;border-top-color:#3b82f6;border-radius:50%;animation:drp-spin .8s linear infinite}@keyframes drp-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.drp-font-xs{--drp-font-size-2xs: .4375rem;--drp-font-size-xs: .525rem;--drp-font-size-sm: .6125rem;--drp-font-size-base: .7rem;--drp-font-size-lg: .7875rem;--drp-font-size-xl: .875rem;--drp-font-size-2xl: 1.05rem}.drp-font-sm{--drp-font-size-2xs: .53125rem;--drp-font-size-xs: .6375rem;--drp-font-size-sm: .74375rem;--drp-font-size-base: .85rem;--drp-font-size-lg: .95625rem;--drp-font-size-xl: 1.0625rem;--drp-font-size-2xl: 1.275rem}.drp-font-lg{--drp-font-size-2xs: .75rem;--drp-font-size-xs: .9rem;--drp-font-size-sm: 1.05rem;--drp-font-size-base: 1.2rem;--drp-font-size-lg: 1.35rem;--drp-font-size-xl: 1.5rem;--drp-font-size-2xl: 1.8rem}.drp-font-xl{--drp-font-size-2xs: .875rem;--drp-font-size-xs: 1.05rem;--drp-font-size-sm: 1.225rem;--drp-font-size-base: 1.4rem;--drp-font-size-lg: 1.575rem;--drp-font-size-xl: 1.75rem;--drp-font-size-2xl: 2.1rem}.drp-spacing-xs{--drp-spacing-xs: .175rem;--drp-spacing-sm: .35rem;--drp-spacing-md: .7rem;--drp-spacing-lg: 1.05rem;--drp-spacing-xl: 1.4rem}.drp-spacing-xs .drp-date-picker__month{min-width:196px}.drp-spacing-sm{--drp-spacing-xs: .2125rem;--drp-spacing-sm: .425rem;--drp-spacing-md: .85rem;--drp-spacing-lg: 1.275rem;--drp-spacing-xl: 1.7rem}.drp-spacing-sm .drp-date-picker__month{min-width:238px}.drp-spacing-lg{--drp-spacing-xs: .3rem;--drp-spacing-sm: .6rem;--drp-spacing-md: 1.2rem;--drp-spacing-lg: 1.8rem;--drp-spacing-xl: 2.4rem}.drp-spacing-lg .drp-date-picker__month{min-width:336px}.drp-spacing-xl{--drp-spacing-xs: .35rem;--drp-spacing-sm: .7rem;--drp-spacing-md: 1.4rem;--drp-spacing-lg: 2.1rem;--drp-spacing-xl: 2.8rem}.drp-spacing-xl .drp-date-picker__month{min-width:392px}@media (max-width: 1200px){.drp-responsive.drp-font-xl{--drp-font-size-2xs: .75rem;--drp-font-size-xs: .9rem;--drp-font-size-sm: 1.05rem;--drp-font-size-base: 1.2rem;--drp-font-size-lg: 1.35rem;--drp-font-size-xl: 1.5rem;--drp-font-size-2xl: 1.8rem}}@media (max-width: 768px){.drp-responsive.drp-font-xl{--drp-font-size-2xs: .625rem;--drp-font-size-xs: .75rem;--drp-font-size-sm: .875rem;--drp-font-size-base: 1rem;--drp-font-size-lg: 1.125rem;--drp-font-size-xl: 1.25rem;--drp-font-size-2xl: 1.5rem}}@media (max-width: 1200px){.drp-responsive.drp-font-lg{--drp-font-size-2xs: .625rem;--drp-font-size-xs: .75rem;--drp-font-size-sm: .875rem;--drp-font-size-base: 1rem;--drp-font-size-lg: 1.125rem;--drp-font-size-xl: 1.25rem;--drp-font-size-2xl: 1.5rem}}@media (max-width: 768px){.drp-responsive.drp-font-lg{--drp-font-size-2xs: .53125rem;--drp-font-size-xs: .6375rem;--drp-font-size-sm: .74375rem;--drp-font-size-base: .85rem;--drp-font-size-lg: .95625rem;--drp-font-size-xl: 1.0625rem;--drp-font-size-2xl: 1.275rem}}@media (max-width: 768px){.drp-responsive.drp-font-md{--drp-font-size-2xs: .53125rem;--drp-font-size-xs: .6375rem;--drp-font-size-sm: .74375rem;--drp-font-size-base: .85rem;--drp-font-size-lg: .95625rem;--drp-font-size-xl: 1.0625rem;--drp-font-size-2xl: 1.275rem}}@media (max-width: 768px){.drp-responsive.drp-font-sm{--drp-font-size-2xs: .4375rem;--drp-font-size-xs: .525rem;--drp-font-size-sm: .6125rem;--drp-font-size-base: .7rem;--drp-font-size-lg: .7875rem;--drp-font-size-xl: .875rem;--drp-font-size-2xl: 1.05rem}}@media (max-width: 1200px){.drp-responsive.drp-spacing-xl{--drp-spacing-xs: .3rem;--drp-spacing-sm: .6rem;--drp-spacing-md: 1.2rem;--drp-spacing-lg: 1.8rem;--drp-spacing-xl: 2.4rem}.drp-responsive.drp-spacing-xl .drp-date-picker__month{min-width:336px}}@media (max-width: 768px){.drp-responsive.drp-spacing-xl{--drp-spacing-xs: .25rem;--drp-spacing-sm: .5rem;--drp-spacing-md: 1rem;--drp-spacing-lg: 1.5rem;--drp-spacing-xl: 2rem}.drp-responsive.drp-spacing-xl .drp-date-picker__month{min-width:280px}}@media (max-width: 1200px){.drp-responsive.drp-spacing-lg{--drp-spacing-xs: .25rem;--drp-spacing-sm: .5rem;--drp-spacing-md: 1rem;--drp-spacing-lg: 1.5rem;--drp-spacing-xl: 2rem}.drp-responsive.drp-spacing-lg .drp-date-picker__month{min-width:280px}}@media (max-width: 768px){.drp-responsive.drp-spacing-lg{--drp-spacing-xs: .2125rem;--drp-spacing-sm: .425rem;--drp-spacing-md: .85rem;--drp-spacing-lg: 1.275rem;--drp-spacing-xl: 1.7rem}.drp-responsive.drp-spacing-lg .drp-date-picker__month{min-width:238px}}@media (max-width: 768px){.drp-responsive.drp-spacing-md{--drp-spacing-xs: .2125rem;--drp-spacing-sm: .425rem;--drp-spacing-md: .85rem;--drp-spacing-lg: 1.275rem;--drp-spacing-xl: 1.7rem}.drp-responsive.drp-spacing-md .drp-date-picker__month{min-width:238px}}@media (max-width: 768px){.drp-responsive.drp-spacing-sm{--drp-spacing-xs: .175rem;--drp-spacing-sm: .35rem;--drp-spacing-md: .7rem;--drp-spacing-lg: 1.05rem;--drp-spacing-xl: 1.4rem}.drp-responsive.drp-spacing-sm .drp-date-picker__month{min-width:196px}}.drp-date-picker--xs{padding:var(--drp-spacing-sm);min-width:240px}.drp-date-picker--xs .drp-date-picker__month-year{font-size:var(--drp-font-size-xs);padding:var(--drp-spacing-xs) var(--drp-spacing-sm)}.drp-date-picker--xs .drp-date-picker__nav{width:1.5rem;height:1.5rem;font-size:var(--drp-font-size-sm)}.drp-date-picker--xs .drp-date-picker__weekday{font-size:var(--drp-font-size-2xs)}.drp-date-picker--xs .drp-date-picker__day{font-size:var(--drp-font-size-xs)}.drp-date-picker--sm{padding:var(--drp-spacing-sm);min-width:260px}.drp-date-picker--sm .drp-date-picker__month-year{font-size:var(--drp-font-size-sm);padding:var(--drp-spacing-xs) var(--drp-spacing-sm)}.drp-date-picker--sm .drp-date-picker__nav{width:1.75rem;height:1.75rem;font-size:var(--drp-font-size-base)}.drp-date-picker--sm .drp-date-picker__day{font-size:var(--drp-font-size-xs)}.drp-date-picker--lg{padding:var(--drp-spacing-lg);min-width:320px}.drp-date-picker--lg .drp-date-picker__month-year{font-size:var(--drp-font-size-lg);padding:var(--drp-spacing-md) var(--drp-spacing-lg)}.drp-date-picker--lg .drp-date-picker__nav{width:2.5rem;height:2.5rem;font-size:var(--drp-font-size-xl)}.drp-date-picker--lg .drp-date-picker__day{font-size:var(--drp-font-size-base)}.drp-date-picker--xl{padding:var(--drp-spacing-xl);min-width:360px}.drp-date-picker--xl .drp-date-picker__month-year{font-size:var(--drp-font-size-xl);padding:var(--drp-spacing-lg) var(--drp-spacing-xl)}.drp-date-picker--xl .drp-date-picker__nav{width:3rem;height:3rem;font-size:var(--drp-font-size-2xl)}.drp-date-picker--xl .drp-date-picker__day{font-size:var(--drp-font-size-lg)}.drp-date-picker--inline{position:static;display:block;box-shadow:none}';
|
|
2925
|
-
class Ct extends HTMLElement {
|
|
2926
|
-
constructor() {
|
|
2927
|
-
super();
|
|
2928
|
-
D(this, "picker");
|
|
2929
|
-
D(this, "inputElement");
|
|
2930
|
-
D(this, "shadow");
|
|
2931
|
-
// Properties for complex data (not attributes)
|
|
2932
|
-
D(this, "_specialDates");
|
|
2933
|
-
D(this, "_disabledDates");
|
|
2934
|
-
D(this, "_isDateDisabled");
|
|
2935
|
-
D(this, "_getDateMetadata");
|
|
2936
|
-
D(this, "_renderDay");
|
|
2937
|
-
D(this, "_renderDayContent");
|
|
2938
|
-
this.shadow = this.attachShadow({ mode: "open" });
|
|
2939
|
-
}
|
|
2940
|
-
static get observedAttributes() {
|
|
2941
|
-
return [
|
|
2942
|
-
"selection-mode",
|
|
2943
|
-
"date-format-mask",
|
|
2944
|
-
"visible-months-count",
|
|
2945
|
-
"calendar-open-trigger",
|
|
2946
|
-
"value",
|
|
2947
|
-
"disabled",
|
|
2948
|
-
"placeholder",
|
|
2949
|
-
"week-start-day",
|
|
2950
|
-
"min-date",
|
|
2951
|
-
"max-date",
|
|
2952
|
-
"disabled-weekdays",
|
|
2953
|
-
"disabled-dates-handling",
|
|
2954
|
-
"highlight-disabled-in-range",
|
|
2955
|
-
"positioning-mode",
|
|
2956
|
-
"month-layout",
|
|
2957
|
-
"grid-rows",
|
|
2958
|
-
"grid-columns",
|
|
2959
|
-
"calendar-placement",
|
|
2960
|
-
"locale",
|
|
2961
|
-
"display-format-mask",
|
|
2962
|
-
"show-debug-info",
|
|
2963
|
-
"initial-date",
|
|
2964
|
-
"rolling-year-range",
|
|
2965
|
-
"rolling-month-range"
|
|
2966
|
-
];
|
|
2967
|
-
}
|
|
2968
|
-
connectedCallback() {
|
|
2969
|
-
this.render(), this.initializePicker();
|
|
2970
|
-
}
|
|
2971
|
-
disconnectedCallback() {
|
|
2972
|
-
this.picker && this.picker.destroy();
|
|
2973
|
-
}
|
|
2974
|
-
attributeChangedCallback(n, a, r) {
|
|
2975
|
-
a !== r && (this.picker && n !== "value" && n !== "placeholder" && (this.picker.destroy(), this.initializePicker()), n === "value" && this.inputElement && r !== null && (this.inputElement.value = r), n === "placeholder" && this.inputElement && r !== null && (this.inputElement.placeholder = r), n === "disabled" && this.inputElement && (r !== null ? this.inputElement.disabled = !0 : this.inputElement.disabled = !1));
|
|
2976
|
-
}
|
|
2977
|
-
render() {
|
|
2978
|
-
const n = document.createElement("style");
|
|
2979
|
-
if (n.textContent = oa, this.shadow.appendChild(n), (this.getAttribute("positioning-mode") || "floating") === "floating") {
|
|
2980
|
-
this.inputElement = document.createElement("input"), this.inputElement.type = "text", this.inputElement.classList.add("drp-input", "drp-date-picker-input");
|
|
2981
|
-
const r = this.getAttribute("placeholder");
|
|
2982
|
-
r && (this.inputElement.placeholder = r);
|
|
2983
|
-
const o = this.getAttribute("value");
|
|
2984
|
-
o && (this.inputElement.value = o), this.hasAttribute("disabled") && (this.inputElement.disabled = !0), this.shadow.appendChild(this.inputElement);
|
|
2985
|
-
}
|
|
2986
|
-
}
|
|
2987
|
-
initializePicker() {
|
|
2988
|
-
const n = this.getAttribute("positioning-mode") || "floating";
|
|
2989
|
-
if (n === "floating" && !this.inputElement) return;
|
|
2990
|
-
let a;
|
|
2991
|
-
const r = this.getAttribute("disabled-weekdays");
|
|
2992
|
-
r && (a = r.split(",").map((l) => parseInt(l.trim())).filter((l) => !isNaN(l) && l >= 0 && l <= 6));
|
|
2993
|
-
let o;
|
|
2994
|
-
const s = this.getAttribute("week-start-day");
|
|
2995
|
-
if (s)
|
|
2996
|
-
if (s === "auto")
|
|
2997
|
-
o = "auto";
|
|
2998
|
-
else {
|
|
2999
|
-
const l = parseInt(s);
|
|
3000
|
-
!isNaN(l) && l >= 0 && l <= 6 && (o = l);
|
|
3001
|
-
}
|
|
3002
|
-
const i = {
|
|
3003
|
-
selectionMode: this.getAttribute("selection-mode") || "single",
|
|
3004
|
-
dateFormatMask: this.getAttribute("date-format-mask") || "YYYY-MM-DD",
|
|
3005
|
-
visibleMonthsCount: parseInt(this.getAttribute("visible-months-count") || "0") || void 0,
|
|
3006
|
-
calendarOpenTrigger: this.getAttribute("calendar-open-trigger") || "focus",
|
|
3007
|
-
onSelect: (l) => this.handleDateSelect(l),
|
|
3008
|
-
container: this.shadow,
|
|
3009
|
-
// Append calendar to shadow root
|
|
3010
|
-
positioningMode: n,
|
|
3011
|
-
// Layout options
|
|
3012
|
-
monthLayout: this.getAttribute("month-layout") || void 0,
|
|
3013
|
-
gridRows: parseInt(this.getAttribute("grid-rows") || "0") || void 0,
|
|
3014
|
-
gridColumns: parseInt(this.getAttribute("grid-columns") || "0") || void 0,
|
|
3015
|
-
// Positioning
|
|
3016
|
-
calendarPlacement: this.getAttribute("calendar-placement") || void 0,
|
|
3017
|
-
// New options
|
|
3018
|
-
weekStartDay: o,
|
|
3019
|
-
minDate: this.getAttribute("min-date") || void 0,
|
|
3020
|
-
maxDate: this.getAttribute("max-date") || void 0,
|
|
3021
|
-
initialDate: this.getAttribute("initial-date") || void 0,
|
|
3022
|
-
disabledWeekdays: a,
|
|
3023
|
-
disabledDates: this._disabledDates,
|
|
3024
|
-
specialDates: this._specialDates,
|
|
3025
|
-
isDateDisabled: this._isDateDisabled,
|
|
3026
|
-
getDateMetadata: this._getDateMetadata,
|
|
3027
|
-
disabledDatesHandling: this.getAttribute("disabled-dates-handling") || void 0,
|
|
3028
|
-
highlightDisabledInRange: this.hasAttribute("highlight-disabled-in-range") ? this.getAttribute("highlight-disabled-in-range") === "true" : void 0,
|
|
3029
|
-
locale: this.getAttribute("locale") || "auto",
|
|
3030
|
-
displayFormatMask: this.getAttribute("display-format-mask") || void 0,
|
|
3031
|
-
showDebugInfo: this.hasAttribute("show-debug-info"),
|
|
3032
|
-
// Rolling selector configuration
|
|
3033
|
-
rollingYearRange: this.getAttribute("rolling-year-range") || void 0,
|
|
3034
|
-
rollingMonthRange: this.getAttribute("rolling-month-range") || void 0,
|
|
3035
|
-
// Custom rendering
|
|
3036
|
-
renderDay: this._renderDay,
|
|
3037
|
-
renderDayContent: this._renderDayContent
|
|
3038
|
-
}, d = n === "inline" ? null : this.inputElement;
|
|
3039
|
-
this.picker = new sa(d, i);
|
|
3040
|
-
}
|
|
3041
|
-
handleDateSelect(n) {
|
|
3042
|
-
var o;
|
|
3043
|
-
const a = {
|
|
3044
|
-
date: n instanceof Date ? n : void 0,
|
|
3045
|
-
dateRange: n instanceof Date ? void 0 : n,
|
|
3046
|
-
formattedValue: ((o = this.inputElement) == null ? void 0 : o.value) || ""
|
|
3047
|
-
};
|
|
3048
|
-
if (!this.picker) {
|
|
3049
|
-
this.dispatchEvent(new CustomEvent("date-select", { detail: a, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("change", { detail: a, bubbles: !0, composed: !0 }));
|
|
3050
|
-
return;
|
|
3051
|
-
}
|
|
3052
|
-
const r = this.picker.options.disabledDatesHandling;
|
|
3053
|
-
if (!(n instanceof Date) && n.start && n.end) {
|
|
3054
|
-
const s = n.start, i = n.end;
|
|
3055
|
-
switch (r) {
|
|
3056
|
-
case "allow":
|
|
3057
|
-
a.enabledDates = this.picker.getEnabledDatesInRange(s, i), a.disabledDates = this.picker.getDisabledDatesInRange(s, i), a.getEnabledDateCount = () => a.enabledDates.length, a.getTotalDays = () => Math.floor((i.getTime() - s.getTime()) / 864e5) + 1;
|
|
3058
|
-
break;
|
|
3059
|
-
case "split":
|
|
3060
|
-
a.dateRanges = this.picker.splitRangeByDisabled(s, i), a.dates = this.picker.getEnabledDatesInRange(s, i), a.dateRanges.length > 0 && (a.formattedValue = a.dateRanges.map((d) => `${this.picker.formatDate(d.start)} - ${this.picker.formatDate(d.end)}`).join(", "));
|
|
3061
|
-
break;
|
|
3062
|
-
case "individual":
|
|
3063
|
-
a.dates = this.picker.getEnabledDatesInRange(s, i), a.dateRange = null, a.dates.length > 0 && (a.formattedValue = a.dates.map((d) => this.picker.formatDate(d)).join(", "));
|
|
3064
|
-
break;
|
|
3065
|
-
case "block":
|
|
3066
|
-
a.dates = this.picker.getEnabledDatesInRange(s, i);
|
|
3067
|
-
break;
|
|
3068
|
-
}
|
|
3069
|
-
}
|
|
3070
|
-
this.dispatchEvent(new CustomEvent("date-select", {
|
|
3071
|
-
detail: a,
|
|
3072
|
-
bubbles: !0,
|
|
3073
|
-
composed: !0
|
|
3074
|
-
})), this.dispatchEvent(new CustomEvent("change", {
|
|
3075
|
-
detail: a,
|
|
3076
|
-
bubbles: !0,
|
|
3077
|
-
composed: !0
|
|
3078
|
-
}));
|
|
3079
|
-
}
|
|
3080
|
-
// Public API methods
|
|
3081
|
-
show() {
|
|
3082
|
-
var n;
|
|
3083
|
-
(n = this.picker) == null || n.show();
|
|
3084
|
-
}
|
|
3085
|
-
hide() {
|
|
3086
|
-
var n;
|
|
3087
|
-
(n = this.picker) == null || n.hide();
|
|
3088
|
-
}
|
|
3089
|
-
toggle() {
|
|
3090
|
-
var n;
|
|
3091
|
-
(n = this.picker) == null || n.toggle();
|
|
3092
|
-
}
|
|
3093
|
-
clearSelection() {
|
|
3094
|
-
var n;
|
|
3095
|
-
(n = this.picker) == null || n.clearSelection();
|
|
3096
|
-
}
|
|
3097
|
-
getInputValue() {
|
|
3098
|
-
var n;
|
|
3099
|
-
return ((n = this.inputElement) == null ? void 0 : n.value) || "";
|
|
3100
|
-
}
|
|
3101
|
-
setInputValue(n) {
|
|
3102
|
-
this.inputElement && (this.inputElement.value = n), this.setAttribute("value", n);
|
|
3103
|
-
}
|
|
3104
|
-
// Property accessors
|
|
3105
|
-
get selectionMode() {
|
|
3106
|
-
return this.getAttribute("selection-mode") || "single";
|
|
3107
|
-
}
|
|
3108
|
-
set selectionMode(n) {
|
|
3109
|
-
this.setAttribute("selection-mode", n);
|
|
3110
|
-
}
|
|
3111
|
-
get dateFormatMask() {
|
|
3112
|
-
return this.getAttribute("date-format-mask") || "YYYY-MM-DD";
|
|
3113
|
-
}
|
|
3114
|
-
set dateFormatMask(n) {
|
|
3115
|
-
this.setAttribute("date-format-mask", n);
|
|
3116
|
-
}
|
|
3117
|
-
get value() {
|
|
3118
|
-
return this.getInputValue();
|
|
3119
|
-
}
|
|
3120
|
-
set value(n) {
|
|
3121
|
-
this.setInputValue(n);
|
|
3122
|
-
}
|
|
3123
|
-
get disabled() {
|
|
3124
|
-
return this.hasAttribute("disabled");
|
|
3125
|
-
}
|
|
3126
|
-
set disabled(n) {
|
|
3127
|
-
n ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
3128
|
-
}
|
|
3129
|
-
// Week start day property
|
|
3130
|
-
get weekStartDay() {
|
|
3131
|
-
const n = this.getAttribute("week-start-day");
|
|
3132
|
-
if (n === "auto") return "auto";
|
|
3133
|
-
const a = parseInt(n || "");
|
|
3134
|
-
return !isNaN(a) && a >= 0 && a <= 6 ? a : "auto";
|
|
3135
|
-
}
|
|
3136
|
-
set weekStartDay(n) {
|
|
3137
|
-
this.setAttribute("week-start-day", n.toString());
|
|
3138
|
-
}
|
|
3139
|
-
// Min/Max date properties
|
|
3140
|
-
get minDate() {
|
|
3141
|
-
return this.getAttribute("min-date") || void 0;
|
|
3142
|
-
}
|
|
3143
|
-
set minDate(n) {
|
|
3144
|
-
n ? this.setAttribute("min-date", n) : this.removeAttribute("min-date");
|
|
3145
|
-
}
|
|
3146
|
-
get maxDate() {
|
|
3147
|
-
return this.getAttribute("max-date") || void 0;
|
|
3148
|
-
}
|
|
3149
|
-
set maxDate(n) {
|
|
3150
|
-
n ? this.setAttribute("max-date", n) : this.removeAttribute("max-date");
|
|
3151
|
-
}
|
|
3152
|
-
// Disabled weekdays property
|
|
3153
|
-
get disabledWeekdays() {
|
|
3154
|
-
const n = this.getAttribute("disabled-weekdays");
|
|
3155
|
-
if (n)
|
|
3156
|
-
return n.split(",").map((a) => parseInt(a.trim())).filter((a) => !isNaN(a) && a >= 0 && a <= 6);
|
|
3157
|
-
}
|
|
3158
|
-
set disabledWeekdays(n) {
|
|
3159
|
-
n && n.length > 0 ? this.setAttribute("disabled-weekdays", n.join(",")) : this.removeAttribute("disabled-weekdays");
|
|
3160
|
-
}
|
|
3161
|
-
// Complex data properties (not attributes)
|
|
3162
|
-
get specialDates() {
|
|
3163
|
-
return this._specialDates;
|
|
3164
|
-
}
|
|
3165
|
-
set specialDates(n) {
|
|
3166
|
-
this._specialDates = n, this.picker && (this.picker.destroy(), this.initializePicker());
|
|
3167
|
-
}
|
|
3168
|
-
get disabledDates() {
|
|
3169
|
-
return this._disabledDates;
|
|
3170
|
-
}
|
|
3171
|
-
set disabledDates(n) {
|
|
3172
|
-
this._disabledDates = n, this.picker && (this.picker.destroy(), this.initializePicker());
|
|
3173
|
-
}
|
|
3174
|
-
get isDateDisabled() {
|
|
3175
|
-
return this._isDateDisabled;
|
|
3176
|
-
}
|
|
3177
|
-
set isDateDisabled(n) {
|
|
3178
|
-
this._isDateDisabled = n, this.picker && (this.picker.destroy(), this.initializePicker());
|
|
3179
|
-
}
|
|
3180
|
-
get getDateMetadata() {
|
|
3181
|
-
return this._getDateMetadata;
|
|
3182
|
-
}
|
|
3183
|
-
set getDateMetadata(n) {
|
|
3184
|
-
this._getDateMetadata = n, this.picker && (this.picker.destroy(), this.initializePicker());
|
|
3185
|
-
}
|
|
3186
|
-
// Custom rendering properties
|
|
3187
|
-
get renderDay() {
|
|
3188
|
-
return this._renderDay;
|
|
3189
|
-
}
|
|
3190
|
-
set renderDay(n) {
|
|
3191
|
-
this._renderDay = n, this.picker && (this.picker.options.renderDay = n, this.picker.render());
|
|
3192
|
-
}
|
|
3193
|
-
get renderDayContent() {
|
|
3194
|
-
return this._renderDayContent;
|
|
3195
|
-
}
|
|
3196
|
-
set renderDayContent(n) {
|
|
3197
|
-
this._renderDayContent = n, this.picker && (this.picker.options.renderDayContent = n, this.picker.render());
|
|
3198
|
-
}
|
|
3199
|
-
}
|
|
3200
|
-
customElements.get("date-range-picker") || customElements.define("date-range-picker", Ct);
|
|
3201
|
-
function ia() {
|
|
3202
|
-
return Array.from(document.querySelectorAll("date-range-picker"));
|
|
3203
|
-
}
|
|
3204
|
-
typeof window < "u" && (window.keenmate = window.keenmate || {}, window.keenmate.daterangepicker = {
|
|
3205
|
-
version: () => "1.0.0-rc08",
|
|
3206
|
-
config: {
|
|
3207
|
-
name: "@keenmate/web-daterangepicker",
|
|
3208
|
-
version: "1.0.0-rc08",
|
|
3209
|
-
author: "Keenmate",
|
|
3210
|
-
license: "MIT",
|
|
3211
|
-
repository: "git+https://github.com/keenmate/web-daterangepicker.git",
|
|
3212
|
-
homepage: "https://github.com/keenmate/web-daterangepicker#readme"
|
|
3213
|
-
},
|
|
3214
|
-
register: () => {
|
|
3215
|
-
typeof customElements < "u" && !customElements.get("date-range-picker") && customElements.define("date-range-picker", Ct);
|
|
3216
|
-
},
|
|
3217
|
-
getInstances: () => ia()
|
|
3218
|
-
}, window.keenmate.daterangepicker.register());
|
|
3219
|
-
export {
|
|
3220
|
-
Ct as DateRangePickerElement,
|
|
3221
|
-
sa as PureDatePicker
|
|
3222
|
-
};
|