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