datex-ui 1.1.8 → 1.1.10
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 +52 -8
- package/assets/images/screenshots/basic-range-datex-ui.png +0 -0
- package/assets/images/screenshots/bootstrap-theme-datex.png +0 -0
- package/assets/images/screenshots/dark-mode-datex.png +0 -0
- package/assets/images/screenshots/date-time-datex.png +0 -0
- package/assets/images/screenshots/default-theme-datex.png +0 -0
- package/assets/images/screenshots/full-datetime-12h.png +0 -0
- package/assets/images/screenshots/light-mode-datex.png +0 -0
- package/assets/images/screenshots/material-theme-datex.png +0 -0
- package/assets/images/screenshots/range-datex.png +0 -0
- package/assets/images/screenshots/restrict-datex.png +0 -0
- package/assets/images/screenshots/single-datex.png +0 -0
- package/dist/datex.d.ts +5 -0
- package/dist/index.esm.js +447 -206
- package/dist/services/calendar-service.d.ts +1 -0
- package/dist/services/keyboard-service.d.ts +0 -2
- package/dist/services/theme-manager.d.ts +55 -0
- package/dist/services/theme-service.d.ts +9 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,71 +1,77 @@
|
|
|
1
|
-
function
|
|
2
|
-
const e =
|
|
3
|
-
return t.replace(/YYYY/g, String(e)).replace(/MM/g, a).replace(/DD/g, i).replace(/HH/g, s).replace(/mm/g,
|
|
1
|
+
function C(l, t) {
|
|
2
|
+
const e = l.getFullYear(), a = String(l.getMonth() + 1).padStart(2, "0"), i = String(l.getDate()).padStart(2, "0"), s = String(l.getHours()).padStart(2, "0"), r = String(l.getMinutes()).padStart(2, "0"), n = String(l.getSeconds()).padStart(2, "0");
|
|
3
|
+
return t.replace(/YYYY/g, String(e)).replace(/MM/g, a).replace(/DD/g, i).replace(/HH/g, s).replace(/mm/g, r).replace(/ss/g, n);
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
const e = new Date(
|
|
5
|
+
function f(l, t) {
|
|
6
|
+
const e = new Date(l);
|
|
7
7
|
return e.setMonth(e.getMonth() + t), e;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
const t = new Date(
|
|
9
|
+
function w(l) {
|
|
10
|
+
const t = new Date(l);
|
|
11
11
|
return t.setHours(0, 0, 0, 0), t;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const t = new Date(
|
|
13
|
+
function S(l) {
|
|
14
|
+
const t = new Date(l);
|
|
15
15
|
return t.setHours(23, 59, 59, 999), t;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
17
|
+
function k(l, t) {
|
|
18
|
+
return l.getTime() > t.getTime();
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
20
|
+
function g(l, t) {
|
|
21
|
+
return l.getTime() < t.getTime();
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
if (!
|
|
23
|
+
function u(l, t, e = "day") {
|
|
24
|
+
if (!l || !t) return !1;
|
|
25
25
|
switch (e) {
|
|
26
26
|
case "day":
|
|
27
|
-
return
|
|
27
|
+
return l.getFullYear() === t.getFullYear() && l.getMonth() === t.getMonth() && l.getDate() === t.getDate();
|
|
28
28
|
case "month":
|
|
29
|
-
return
|
|
29
|
+
return l.getFullYear() === t.getFullYear() && l.getMonth() === t.getMonth();
|
|
30
30
|
case "year":
|
|
31
|
-
return
|
|
31
|
+
return l.getFullYear() === t.getFullYear();
|
|
32
32
|
default:
|
|
33
33
|
return !1;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
36
|
+
function y(l) {
|
|
37
|
+
return l instanceof Date && !isNaN(l.getTime());
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
if (t === "YYYY-MM-DD")
|
|
41
|
-
|
|
39
|
+
function b(l, t) {
|
|
40
|
+
if (t === "YYYY-MM-DD") {
|
|
41
|
+
const e = l.split("-");
|
|
42
|
+
if (e.length === 3) {
|
|
43
|
+
const a = parseInt(e[0], 10), i = parseInt(e[1], 10) - 1, s = parseInt(e[2], 10);
|
|
44
|
+
return new Date(a, i, s);
|
|
45
|
+
}
|
|
46
|
+
return new Date(l);
|
|
47
|
+
}
|
|
42
48
|
if (t === "DD/MM/YYYY") {
|
|
43
|
-
const e =
|
|
49
|
+
const e = l.split("/");
|
|
44
50
|
if (e.length === 3) {
|
|
45
51
|
const a = parseInt(e[0], 10), i = parseInt(e[1], 10) - 1, s = parseInt(e[2], 10);
|
|
46
52
|
return new Date(s, i, a);
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
if (t === "DD/MM/YYYY HH:mm") {
|
|
50
|
-
const [e, a] =
|
|
56
|
+
const [e, a] = l.split(" "), i = e.split("/"), s = a ? a.split(":") : ["0", "0"];
|
|
51
57
|
if (i.length === 3) {
|
|
52
|
-
const
|
|
53
|
-
return new Date(
|
|
58
|
+
const r = parseInt(i[0], 10), n = parseInt(i[1], 10) - 1, o = parseInt(i[2], 10), c = parseInt(s[0], 10) || 0, d = parseInt(s[1], 10) || 0;
|
|
59
|
+
return new Date(o, n, r, c, d);
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
|
-
return new Date(
|
|
62
|
+
return new Date(l);
|
|
57
63
|
}
|
|
58
|
-
function
|
|
59
|
-
return new Date(
|
|
64
|
+
function x(l) {
|
|
65
|
+
return new Date(l.getFullYear(), l.getMonth(), 1);
|
|
60
66
|
}
|
|
61
|
-
function
|
|
62
|
-
return new Date(
|
|
67
|
+
function L(l) {
|
|
68
|
+
return new Date(l.getFullYear(), l.getMonth() + 1, 0);
|
|
63
69
|
}
|
|
64
|
-
function
|
|
65
|
-
const a = (
|
|
66
|
-
return i.setDate(
|
|
70
|
+
function $(l, t = 1) {
|
|
71
|
+
const a = (l.getDay() - t + 7) % 7, i = new Date(l);
|
|
72
|
+
return i.setDate(l.getDate() - a), i;
|
|
67
73
|
}
|
|
68
|
-
const
|
|
74
|
+
const E = {
|
|
69
75
|
primaryColor: "#357ebd",
|
|
70
76
|
secondaryColor: "#ccc",
|
|
71
77
|
backgroundColor: "#ffffff",
|
|
@@ -81,7 +87,7 @@ const C = {
|
|
|
81
87
|
borderRadius: "4px",
|
|
82
88
|
fontSize: "15px",
|
|
83
89
|
fontFamily: "arial"
|
|
84
|
-
},
|
|
90
|
+
}, B = {
|
|
85
91
|
primaryColor: "#0d6efd",
|
|
86
92
|
secondaryColor: "#6c757d",
|
|
87
93
|
backgroundColor: "#ffffff",
|
|
@@ -97,7 +103,7 @@ const C = {
|
|
|
97
103
|
borderRadius: "6px",
|
|
98
104
|
fontSize: "14px",
|
|
99
105
|
fontFamily: 'system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'
|
|
100
|
-
},
|
|
106
|
+
}, R = {
|
|
101
107
|
primaryColor: "#1976d2",
|
|
102
108
|
secondaryColor: "#757575",
|
|
103
109
|
backgroundColor: "#ffffff",
|
|
@@ -114,18 +120,59 @@ const C = {
|
|
|
114
120
|
fontSize: "14px",
|
|
115
121
|
fontFamily: 'Roboto, "Helvetica Neue", Arial, sans-serif'
|
|
116
122
|
};
|
|
117
|
-
class
|
|
118
|
-
constructor(t, e =
|
|
119
|
-
this.
|
|
123
|
+
class T {
|
|
124
|
+
constructor(t, e = E) {
|
|
125
|
+
this.mode = "light", this.handleMediaChange = () => {
|
|
126
|
+
this.mode === "auto" && this.applyTheme();
|
|
127
|
+
}, this.container = t, this.theme = { ...E, ...e }, this.setupMediaQueryListener();
|
|
120
128
|
}
|
|
121
129
|
applyTheme() {
|
|
122
130
|
this.removeExistingStyles(), this.createAndApplyStyles(), this.forceReflow();
|
|
123
131
|
}
|
|
124
132
|
setTheme(t) {
|
|
125
|
-
this.theme = { ...
|
|
133
|
+
this.theme = { ...E, ...t }, this.applyTheme();
|
|
134
|
+
}
|
|
135
|
+
setMode(t) {
|
|
136
|
+
this.mode = t, this.applyTheme();
|
|
137
|
+
}
|
|
138
|
+
getMode() {
|
|
139
|
+
return this.mode;
|
|
140
|
+
}
|
|
141
|
+
getCurrentMode() {
|
|
142
|
+
var t;
|
|
143
|
+
return this.mode === "auto" ? (t = this.mediaQuery) != null && t.matches ? "dark" : "light" : this.mode === "dark" ? "dark" : "light";
|
|
126
144
|
}
|
|
127
145
|
cleanup() {
|
|
128
|
-
this.removeExistingStyles();
|
|
146
|
+
this.removeExistingStyles(), this.mediaQuery && this.mediaQuery.removeEventListener("change", this.handleMediaChange);
|
|
147
|
+
}
|
|
148
|
+
setupMediaQueryListener() {
|
|
149
|
+
this.mediaQuery = window.matchMedia("(prefers-color-scheme: dark)"), this.mediaQuery.addEventListener("change", this.handleMediaChange);
|
|
150
|
+
}
|
|
151
|
+
getThemeForMode() {
|
|
152
|
+
return this.getCurrentMode() === "dark" ? {
|
|
153
|
+
...this.theme,
|
|
154
|
+
backgroundColor: "#1f2937",
|
|
155
|
+
// Fondo oscuro
|
|
156
|
+
borderColor: "#4b5563",
|
|
157
|
+
// Bordes grises oscuros
|
|
158
|
+
textColor: "#f9fafb",
|
|
159
|
+
// Texto blanco/claro
|
|
160
|
+
hoverColor: "#4b5563",
|
|
161
|
+
// Hover gris más claro para mejor contraste
|
|
162
|
+
// Mantener colores originales del tema para selected, range, etc.
|
|
163
|
+
selectedColor: this.theme.selectedColor,
|
|
164
|
+
// Mantener color original
|
|
165
|
+
rangeColor: this.theme.rangeColor,
|
|
166
|
+
// Mantener color original
|
|
167
|
+
todayColor: this.theme.todayColor,
|
|
168
|
+
// Mantener color original
|
|
169
|
+
disabledColor: "#6b7280",
|
|
170
|
+
// Gris para deshabilitado
|
|
171
|
+
applyButtonColor: this.theme.applyButtonColor,
|
|
172
|
+
// Mantener color original
|
|
173
|
+
cancelButtonColor: this.theme.cancelButtonColor
|
|
174
|
+
// Mantener color original
|
|
175
|
+
} : this.theme;
|
|
129
176
|
}
|
|
130
177
|
removeExistingStyles() {
|
|
131
178
|
if (this.styleId) {
|
|
@@ -145,8 +192,8 @@ class w {
|
|
|
145
192
|
this.container.offsetHeight;
|
|
146
193
|
}
|
|
147
194
|
generateThemeCSS() {
|
|
148
|
-
const t = this.
|
|
149
|
-
return `
|
|
195
|
+
const t = this.getThemeForMode(), e = this.getCurrentMode();
|
|
196
|
+
return this.container.classList.remove("datex-light", "datex-dark"), this.container.classList.add(`datex-${e}`), `
|
|
150
197
|
.datex-picker {
|
|
151
198
|
background-color: ${t.backgroundColor} !important;
|
|
152
199
|
border: 1px solid ${t.borderColor} !important;
|
|
@@ -159,6 +206,26 @@ class w {
|
|
|
159
206
|
z-index: 3001 !important;
|
|
160
207
|
}
|
|
161
208
|
|
|
209
|
+
.datex-picker.single {
|
|
210
|
+
width: 230px !important;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.datex-picker.single .drp-calendar.right {
|
|
214
|
+
display: none !important;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.datex-picker.single .drp-calendar.left {
|
|
218
|
+
float: none !important;
|
|
219
|
+
clear: none !important;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.datex-picker.single .drp-calendar.left .calendar-table {
|
|
223
|
+
border-right: 1px solid ${t.borderColor} !important;
|
|
224
|
+
border-top-right-radius: ${t.borderRadius} !important;
|
|
225
|
+
border-bottom-right-radius: ${t.borderRadius} !important;
|
|
226
|
+
padding-right: 8px !important;
|
|
227
|
+
}
|
|
228
|
+
|
|
162
229
|
.datex-picker select,
|
|
163
230
|
.datex-picker select * {
|
|
164
231
|
user-select: auto !important;
|
|
@@ -218,7 +285,7 @@ class w {
|
|
|
218
285
|
.datex-picker .calendar-table .next span,
|
|
219
286
|
.datex-picker .calendar-table .prev span {
|
|
220
287
|
color: #fff !important;
|
|
221
|
-
border: solid black !important;
|
|
288
|
+
border: solid ${e === "dark" ? t.textColor : "black"} !important;
|
|
222
289
|
border-width: 0 2px 2px 0 !important;
|
|
223
290
|
border-radius: 0 !important;
|
|
224
291
|
display: inline-block !important;
|
|
@@ -245,13 +312,18 @@ class w {
|
|
|
245
312
|
|
|
246
313
|
.datex-picker .calendar-table .next:hover,
|
|
247
314
|
.datex-picker .calendar-table .prev:hover {
|
|
248
|
-
background-color: #f0f0f0 !important;
|
|
315
|
+
background-color: ${e === "dark" ? t.hoverColor : "#f0f0f0"} !important;
|
|
249
316
|
}
|
|
250
317
|
|
|
251
318
|
.datex-picker td.available:hover,
|
|
252
319
|
.datex-picker th.available:hover {
|
|
253
|
-
background-color: #eee !important;
|
|
320
|
+
background-color: ${e === "dark" ? "#4b5563" : "#eee"} !important;
|
|
254
321
|
border-color: transparent !important;
|
|
322
|
+
color: ${e === "dark" ? "#ffffff" : "#000000"} !important;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.datex-picker td.available,
|
|
326
|
+
.datex-picker th.available {
|
|
255
327
|
color: ${t.textColor} !important;
|
|
256
328
|
}
|
|
257
329
|
|
|
@@ -273,7 +345,7 @@ class w {
|
|
|
273
345
|
.datex-picker td.in-range {
|
|
274
346
|
background-color: ${t.rangeColor} !important;
|
|
275
347
|
border-color: transparent !important;
|
|
276
|
-
color: #
|
|
348
|
+
color: #000000 !important;
|
|
277
349
|
border-radius: 0 !important;
|
|
278
350
|
}
|
|
279
351
|
|
|
@@ -364,7 +436,7 @@ class w {
|
|
|
364
436
|
.datex-picker .drp-buttons {
|
|
365
437
|
clear: both !important;
|
|
366
438
|
text-align: right !important;
|
|
367
|
-
padding:
|
|
439
|
+
padding: 8px !important;
|
|
368
440
|
border-top: 1px solid ${t.borderColor} !important;
|
|
369
441
|
display: none !important;
|
|
370
442
|
line-height: 10px !important;
|
|
@@ -474,13 +546,12 @@ class w {
|
|
|
474
546
|
|
|
475
547
|
.datex-picker .calendar-time {
|
|
476
548
|
text-align: center !important;
|
|
477
|
-
margin:
|
|
478
|
-
line-height:
|
|
549
|
+
margin: 0 auto !important;
|
|
550
|
+
line-height: 24px !important;
|
|
479
551
|
position: relative !important;
|
|
480
552
|
display: block !important;
|
|
481
553
|
background: ${t.backgroundColor} !important;
|
|
482
|
-
padding: 8px !important;
|
|
483
|
-
border-top: 1px solid ${t.borderColor} !important;
|
|
554
|
+
padding: 4px 8px !important;
|
|
484
555
|
}
|
|
485
556
|
|
|
486
557
|
.datex-picker .calendar-time select.disabled {
|
|
@@ -559,7 +630,7 @@ class w {
|
|
|
559
630
|
`;
|
|
560
631
|
}
|
|
561
632
|
}
|
|
562
|
-
class
|
|
633
|
+
class A {
|
|
563
634
|
constructor() {
|
|
564
635
|
this.boundHandlers = /* @__PURE__ */ new Map();
|
|
565
636
|
}
|
|
@@ -594,7 +665,7 @@ class S {
|
|
|
594
665
|
t.dispatchEvent(i);
|
|
595
666
|
}
|
|
596
667
|
}
|
|
597
|
-
class
|
|
668
|
+
class F {
|
|
598
669
|
constructor(t, e, a) {
|
|
599
670
|
this.element = t, this.container = e, this.options = a;
|
|
600
671
|
}
|
|
@@ -611,11 +682,11 @@ class E {
|
|
|
611
682
|
const e = this.container.offsetWidth, a = this.container.offsetHeight, { top: i, drops: s } = this.calculateVerticalPosition(
|
|
612
683
|
t,
|
|
613
684
|
a
|
|
614
|
-
),
|
|
685
|
+
), r = this.calculateHorizontalPosition(
|
|
615
686
|
t,
|
|
616
687
|
e
|
|
617
688
|
);
|
|
618
|
-
this.applyDropUpClass(s), this.applyFinalPosition(i,
|
|
689
|
+
this.applyDropUpClass(s), this.applyFinalPosition(i, r);
|
|
619
690
|
}
|
|
620
691
|
resetContainerPosition() {
|
|
621
692
|
this.container.style.top = "0", this.container.style.left = "0", this.container.style.right = "auto", this.container.style.position = "fixed";
|
|
@@ -657,36 +728,106 @@ class E {
|
|
|
657
728
|
this.container.style.top = `${t}px`, this.container.style.left = `${e}px`, this.container.style.right = "auto", this.container.style.zIndex = "99999";
|
|
658
729
|
}
|
|
659
730
|
}
|
|
660
|
-
class
|
|
731
|
+
class H {
|
|
661
732
|
constructor(t, e) {
|
|
662
733
|
this.options = t, this.locale = e;
|
|
663
734
|
}
|
|
664
735
|
buildCalendarMatrix(t) {
|
|
665
|
-
const e =
|
|
736
|
+
const e = x(t), a = $(e, this.locale.firstDay), i = [];
|
|
666
737
|
let s = [];
|
|
667
|
-
const
|
|
668
|
-
for (let
|
|
669
|
-
|
|
670
|
-
const
|
|
671
|
-
|
|
738
|
+
const r = new Date(a);
|
|
739
|
+
for (let n = 0; n < 42; n++) {
|
|
740
|
+
n > 0 && n % 7 === 0 && (i.push(s), s = []);
|
|
741
|
+
const o = new Date(r);
|
|
742
|
+
o.setDate(r.getDate() + n), s.push(o);
|
|
672
743
|
}
|
|
673
744
|
return s.length > 0 && i.push(s), i;
|
|
674
745
|
}
|
|
675
|
-
renderCalendarHTML(t, e, a, i, s,
|
|
676
|
-
const
|
|
677
|
-
let
|
|
678
|
-
return
|
|
746
|
+
renderCalendarHTML(t, e, a, i, s, r) {
|
|
747
|
+
const n = t.month, o = n.getFullYear(), c = n.getMonth();
|
|
748
|
+
let d = '<table class="table-condensed">';
|
|
749
|
+
return d += this.renderHeader(e, c, o, s, r), d += this.renderDayHeaders(), d += this.renderCalendarBody(
|
|
679
750
|
t.calendar,
|
|
680
|
-
|
|
751
|
+
n,
|
|
681
752
|
a,
|
|
682
753
|
i
|
|
683
|
-
),
|
|
754
|
+
), d += "</table>", this.options.timePicker && (d += this.renderTimeControls(
|
|
755
|
+
e === "left" ? a : i || a
|
|
756
|
+
)), d;
|
|
757
|
+
}
|
|
758
|
+
renderTimeControls(t) {
|
|
759
|
+
let e = '<div class="calendar-time">';
|
|
760
|
+
e += '<select class="hourselect">';
|
|
761
|
+
const a = this.options.timePicker24Hour, i = a ? 23 : 12, s = a ? 0 : 1;
|
|
762
|
+
for (let n = s; n <= i; n++) {
|
|
763
|
+
const o = a ? n : n === 0 ? 12 : n, c = String(o).padStart(2, "0"), d = a ? t.getHours() : t.getHours() % 12 || 12;
|
|
764
|
+
let m = !1;
|
|
765
|
+
if (this.options.minDate || this.options.maxDate) {
|
|
766
|
+
const D = new Date(t), M = a ? o : t.getHours() >= 12 ? o === 12 ? 12 : o + 12 : o === 12 ? 0 : o;
|
|
767
|
+
if (D.setHours(M), this.options.minDate) {
|
|
768
|
+
const v = new Date(D);
|
|
769
|
+
v.setMinutes(59), v < this.options.minDate && (m = !0);
|
|
770
|
+
}
|
|
771
|
+
if (this.options.maxDate) {
|
|
772
|
+
const v = new Date(D);
|
|
773
|
+
v.setMinutes(0), v > this.options.maxDate && (m = !0);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
e += `<option value="${o}"${o === d && !m ? ' selected="selected"' : ""}${m ? ' disabled="disabled" class="disabled"' : ""}>${c}</option>`;
|
|
777
|
+
}
|
|
778
|
+
e += "</select>", e += " : ", e += '<select class="minuteselect">';
|
|
779
|
+
const r = this.options.timePickerIncrement || 1;
|
|
780
|
+
for (let n = 0; n < 60; n += r) {
|
|
781
|
+
const o = String(n).padStart(2, "0");
|
|
782
|
+
let c = !1;
|
|
783
|
+
if (this.options.minDate || this.options.maxDate) {
|
|
784
|
+
const p = new Date(t);
|
|
785
|
+
if (p.setMinutes(n), this.options.minDate) {
|
|
786
|
+
const h = new Date(p);
|
|
787
|
+
h.setSeconds(59), h < this.options.minDate && (c = !0);
|
|
788
|
+
}
|
|
789
|
+
if (this.options.maxDate) {
|
|
790
|
+
const h = new Date(p);
|
|
791
|
+
h.setSeconds(0), h > this.options.maxDate && (c = !0);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
const d = n === t.getMinutes() && !c ? ' selected="selected"' : "";
|
|
795
|
+
e += `<option value="${n}"${d}${c ? ' disabled="disabled" class="disabled"' : ""}>${o}</option>`;
|
|
796
|
+
}
|
|
797
|
+
if (e += "</select>", this.options.timePickerSeconds) {
|
|
798
|
+
e += " : ", e += '<select class="secondselect">';
|
|
799
|
+
for (let n = 0; n < 60; n++) {
|
|
800
|
+
const o = String(n).padStart(2, "0");
|
|
801
|
+
let c = !1;
|
|
802
|
+
if (this.options.minDate || this.options.maxDate) {
|
|
803
|
+
const p = new Date(t);
|
|
804
|
+
p.setSeconds(n), this.options.minDate && p < this.options.minDate && (c = !0), this.options.maxDate && p > this.options.maxDate && (c = !0);
|
|
805
|
+
}
|
|
806
|
+
const d = n === t.getSeconds() && !c ? ' selected="selected"' : "";
|
|
807
|
+
e += `<option value="${n}"${d}${c ? ' disabled="disabled" class="disabled"' : ""}>${o}</option>`;
|
|
808
|
+
}
|
|
809
|
+
e += "</select>";
|
|
810
|
+
}
|
|
811
|
+
if (!a) {
|
|
812
|
+
e += " ", e += '<select class="ampmselect">';
|
|
813
|
+
const n = t.getHours() < 12;
|
|
814
|
+
let o = !1, c = !1;
|
|
815
|
+
if (this.options.minDate || this.options.maxDate) {
|
|
816
|
+
const p = new Date(t);
|
|
817
|
+
p.setHours(6, 0, 0);
|
|
818
|
+
const h = new Date(t);
|
|
819
|
+
h.setHours(18, 0, 0), this.options.minDate && p < this.options.minDate && (o = !0), this.options.maxDate && h > this.options.maxDate && (c = !0);
|
|
820
|
+
}
|
|
821
|
+
const d = o ? ' disabled="disabled" class="disabled"' : "", m = c ? ' disabled="disabled" class="disabled"' : "";
|
|
822
|
+
e += `<option value="AM"${n ? ' selected="selected"' : ""}${d}>AM</option>`, e += `<option value="PM"${n ? "" : ' selected="selected"'}${m}>PM</option>`, e += "</select>";
|
|
823
|
+
}
|
|
824
|
+
return e += "</div>", e;
|
|
684
825
|
}
|
|
685
826
|
renderHeader(t, e, a, i, s) {
|
|
686
|
-
let
|
|
687
|
-
i && (!this.options.linkedCalendars || t === "left") ?
|
|
688
|
-
let
|
|
689
|
-
return this.options.showDropdowns && (
|
|
827
|
+
let r = "<thead><tr>";
|
|
828
|
+
i && (!this.options.linkedCalendars || t === "left") ? r += '<th class="prev available"><span></span></th>' : r += "<th></th>";
|
|
829
|
+
let n = this.locale.monthNames[e] + " " + a;
|
|
830
|
+
return this.options.showDropdowns && (n = this.renderDropdowns(e, a)), r += `<th colspan="5" class="month">${n}</th>`, s && (!this.options.linkedCalendars || t === "right" || this.options.singleDatePicker) ? r += '<th class="next available"><span></span></th>' : r += "<th></th>", r += "</tr>", r;
|
|
690
831
|
}
|
|
691
832
|
renderDayHeaders() {
|
|
692
833
|
let t = "<tr>";
|
|
@@ -696,19 +837,19 @@ class L {
|
|
|
696
837
|
}
|
|
697
838
|
renderCalendarBody(t, e, a, i) {
|
|
698
839
|
let s = "<tbody>";
|
|
699
|
-
for (const
|
|
840
|
+
for (const r of t) {
|
|
700
841
|
s += "<tr>";
|
|
701
|
-
for (const
|
|
702
|
-
const
|
|
703
|
-
|
|
842
|
+
for (const n of r) {
|
|
843
|
+
const o = this.getDayClasses(
|
|
844
|
+
n,
|
|
704
845
|
e,
|
|
705
846
|
a,
|
|
706
847
|
i
|
|
707
|
-
), c =
|
|
708
|
-
s += `<td class="${
|
|
709
|
-
|
|
848
|
+
), c = o.includes("disabled"), d = o.join(" ") + (c ? "" : " available");
|
|
849
|
+
s += `<td class="${d}" data-date="${C(
|
|
850
|
+
n,
|
|
710
851
|
"YYYY-MM-DD"
|
|
711
|
-
)}">${
|
|
852
|
+
)}">${n.getDate()}</td>`;
|
|
712
853
|
}
|
|
713
854
|
s += "</tr>";
|
|
714
855
|
}
|
|
@@ -720,21 +861,21 @@ class L {
|
|
|
720
861
|
e,
|
|
721
862
|
a,
|
|
722
863
|
i
|
|
723
|
-
),
|
|
724
|
-
return s + " " +
|
|
864
|
+
), r = this.renderYearDropdown(e, a, i);
|
|
865
|
+
return s + " " + r;
|
|
725
866
|
}
|
|
726
867
|
calculateYearRange(t) {
|
|
727
868
|
let e = this.options.minYear, a = this.options.maxYear;
|
|
728
869
|
return this.options.minDate && (e = Math.max(e, this.options.minDate.getFullYear())), this.options.maxDate && (a = Math.min(a, this.options.maxDate.getFullYear())), { minYear: e, maxYear: a };
|
|
729
870
|
}
|
|
730
871
|
renderMonthDropdown(t, e, a, i) {
|
|
731
|
-
const s = e === a,
|
|
732
|
-
let
|
|
733
|
-
for (let
|
|
872
|
+
const s = e === a, r = e === i;
|
|
873
|
+
let n = '<select class="monthselect">';
|
|
874
|
+
for (let o = 0; o < 12; o++) {
|
|
734
875
|
let c = !1;
|
|
735
|
-
s && this.options.minDate &&
|
|
876
|
+
s && this.options.minDate && o < this.options.minDate.getMonth() && (c = !0), r && this.options.maxDate && o > this.options.maxDate.getMonth() && (c = !0), n += `<option value="${o}"${o === t ? ' selected="selected"' : ""}${c ? ' disabled="disabled"' : ""}>${this.locale.monthNames[o]}</option>`;
|
|
736
877
|
}
|
|
737
|
-
return
|
|
878
|
+
return n += "</select>", n;
|
|
738
879
|
}
|
|
739
880
|
renderYearDropdown(t, e, a) {
|
|
740
881
|
let i = '<select class="yearselect">';
|
|
@@ -744,16 +885,16 @@ class L {
|
|
|
744
885
|
}
|
|
745
886
|
getDayClasses(t, e, a, i) {
|
|
746
887
|
const s = [];
|
|
747
|
-
return
|
|
888
|
+
return u(t, /* @__PURE__ */ new Date(), "day") && s.push("today"), (t.getDay() === 0 || t.getDay() === 6) && s.push("weekend"), t.getMonth() !== e.getMonth() && s.push("off", "ends"), this.options.minDate && g(t, w(this.options.minDate)) && s.push("off", "disabled"), this.options.maxDate && k(t, S(this.options.maxDate)) && s.push("off", "disabled"), u(t, a, "day") && s.push("active", "start-date"), i && u(t, i, "day") && s.push("active", "end-date"), i && k(t, a) && g(t, i) && s.push("in-range"), s;
|
|
748
889
|
}
|
|
749
890
|
canNavigatePrevious(t) {
|
|
750
|
-
return !this.options.minDate ||
|
|
891
|
+
return !this.options.minDate || k(x(t), this.options.minDate);
|
|
751
892
|
}
|
|
752
893
|
canNavigateNext(t) {
|
|
753
|
-
return !this.options.maxDate ||
|
|
894
|
+
return !this.options.maxDate || g(L(t), this.options.maxDate);
|
|
754
895
|
}
|
|
755
896
|
}
|
|
756
|
-
class
|
|
897
|
+
class I {
|
|
757
898
|
constructor(t = {}) {
|
|
758
899
|
this.validation = t;
|
|
759
900
|
}
|
|
@@ -846,7 +987,7 @@ class M {
|
|
|
846
987
|
return ((e = this.validation.holidays) == null ? void 0 : e.some((a) => this.isSameDate(a, t))) || !1;
|
|
847
988
|
}
|
|
848
989
|
}
|
|
849
|
-
class
|
|
990
|
+
class P {
|
|
850
991
|
constructor(t, e = {}) {
|
|
851
992
|
this.currentFocusedDate = null, this.isActive = !1, this.container = t, this.options = {
|
|
852
993
|
enabled: !0,
|
|
@@ -862,10 +1003,12 @@ class $ {
|
|
|
862
1003
|
}, this.options.enabled && this.setupKeyboardEvents();
|
|
863
1004
|
}
|
|
864
1005
|
setHandlers(t) {
|
|
865
|
-
this.onDateSelect = t.onDateSelect, this.onClose = t.onClose, this.onApply = t.onApply, this.
|
|
1006
|
+
this.onDateSelect = t.onDateSelect, this.onClose = t.onClose, this.onApply = t.onApply, this.onToday = t.onToday, this.onClear = t.onClear;
|
|
866
1007
|
}
|
|
867
1008
|
activate(t) {
|
|
868
|
-
this.isActive = !0, this.currentFocusedDate = t
|
|
1009
|
+
this.isActive = !0, this.currentFocusedDate = t ? new Date(t.getTime()) : /* @__PURE__ */ new Date(), setTimeout(() => {
|
|
1010
|
+
this.isActive && this.updateFocusedDate();
|
|
1011
|
+
}, 100), this.container.focus({ preventScroll: !0 });
|
|
869
1012
|
}
|
|
870
1013
|
deactivate() {
|
|
871
1014
|
this.isActive = !1, this.currentFocusedDate = null, this.removeFocusStyles();
|
|
@@ -874,7 +1017,7 @@ class $ {
|
|
|
874
1017
|
this.container.setAttribute("tabindex", "0"), this.container.addEventListener("keydown", this.handleKeyDown.bind(this)), this.container.addEventListener("focus", this.handleFocus.bind(this)), this.container.addEventListener("blur", this.handleBlur.bind(this));
|
|
875
1018
|
}
|
|
876
1019
|
handleKeyDown(t) {
|
|
877
|
-
var n, o,
|
|
1020
|
+
var r, n, o, c;
|
|
878
1021
|
if (!this.isActive || !this.currentFocusedDate) return;
|
|
879
1022
|
const { key: e, ctrlKey: a, shiftKey: i, altKey: s } = t;
|
|
880
1023
|
switch (e) {
|
|
@@ -906,7 +1049,16 @@ class $ {
|
|
|
906
1049
|
switch (e) {
|
|
907
1050
|
case "Enter":
|
|
908
1051
|
case " ":
|
|
909
|
-
t.preventDefault(), this.currentFocusedDate && this.onDateSelect
|
|
1052
|
+
if (t.preventDefault(), this.currentFocusedDate && this.onDateSelect) {
|
|
1053
|
+
const d = new Date(this.currentFocusedDate.getTime());
|
|
1054
|
+
console.log("=== KEYBOARD DEBUG ==="), console.log("Original focused date:", this.currentFocusedDate), console.log(
|
|
1055
|
+
"Original focused day:",
|
|
1056
|
+
this.currentFocusedDate.getDate()
|
|
1057
|
+
), console.log("Copy to select:", d), console.log("Copy day:", d.getDate()), console.log(
|
|
1058
|
+
"Are they equal?",
|
|
1059
|
+
this.currentFocusedDate.getTime() === d.getTime()
|
|
1060
|
+
), console.log("======================"), this.onDateSelect(d);
|
|
1061
|
+
}
|
|
910
1062
|
break;
|
|
911
1063
|
case "Escape":
|
|
912
1064
|
t.preventDefault(), this.onClose && this.onClose();
|
|
@@ -914,10 +1066,10 @@ class $ {
|
|
|
914
1066
|
}
|
|
915
1067
|
if (!a && !s)
|
|
916
1068
|
switch (e.toLowerCase()) {
|
|
917
|
-
case ((
|
|
1069
|
+
case ((n = (r = this.options.shortcuts) == null ? void 0 : r.today) == null ? void 0 : n.toLowerCase()):
|
|
918
1070
|
t.preventDefault(), this.onToday && this.onToday();
|
|
919
1071
|
break;
|
|
920
|
-
case ((c = (
|
|
1072
|
+
case ((c = (o = this.options.shortcuts) == null ? void 0 : o.clear) == null ? void 0 : c.toLowerCase()):
|
|
921
1073
|
t.preventDefault(), this.onClear && this.onClear();
|
|
922
1074
|
break;
|
|
923
1075
|
}
|
|
@@ -929,7 +1081,9 @@ class $ {
|
|
|
929
1081
|
}
|
|
930
1082
|
}
|
|
931
1083
|
handleFocus() {
|
|
932
|
-
this.isActive || this.
|
|
1084
|
+
this.isActive || (this.isActive = !0, this.currentFocusedDate = this.currentFocusedDate || /* @__PURE__ */ new Date(), setTimeout(() => {
|
|
1085
|
+
this.isActive && this.updateFocusedDate();
|
|
1086
|
+
}, 150));
|
|
933
1087
|
}
|
|
934
1088
|
handleBlur() {
|
|
935
1089
|
setTimeout(() => {
|
|
@@ -938,31 +1092,47 @@ class $ {
|
|
|
938
1092
|
}
|
|
939
1093
|
navigateDate(t) {
|
|
940
1094
|
if (!this.currentFocusedDate) return;
|
|
941
|
-
const e = new Date(this.currentFocusedDate);
|
|
1095
|
+
const e = new Date(this.currentFocusedDate.getTime());
|
|
942
1096
|
e.setDate(e.getDate() + t), this.currentFocusedDate = e, this.updateFocusedDate();
|
|
943
1097
|
}
|
|
944
1098
|
navigateMonth(t) {
|
|
945
1099
|
if (!this.currentFocusedDate) return;
|
|
946
|
-
const e = new Date(this.currentFocusedDate);
|
|
1100
|
+
const e = new Date(this.currentFocusedDate.getTime());
|
|
947
1101
|
e.setMonth(e.getMonth() + t), this.currentFocusedDate = e, this.updateFocusedDate();
|
|
948
1102
|
}
|
|
949
1103
|
navigateToStartOfWeek() {
|
|
950
1104
|
if (!this.currentFocusedDate) return;
|
|
951
|
-
const t = new Date(this.currentFocusedDate), e = t.getDay();
|
|
1105
|
+
const t = new Date(this.currentFocusedDate.getTime()), e = t.getDay();
|
|
952
1106
|
t.setDate(t.getDate() - e), this.currentFocusedDate = t, this.updateFocusedDate();
|
|
953
1107
|
}
|
|
954
1108
|
navigateToEndOfWeek() {
|
|
955
1109
|
if (!this.currentFocusedDate) return;
|
|
956
|
-
const t = new Date(this.currentFocusedDate), e = t.getDay();
|
|
1110
|
+
const t = new Date(this.currentFocusedDate.getTime()), e = t.getDay();
|
|
957
1111
|
t.setDate(t.getDate() + (6 - e)), this.currentFocusedDate = t, this.updateFocusedDate();
|
|
958
1112
|
}
|
|
959
1113
|
updateFocusedDate() {
|
|
960
1114
|
if (!this.currentFocusedDate) return;
|
|
961
1115
|
this.removeFocusStyles();
|
|
962
|
-
const t = this.formatDateForSelector(this.currentFocusedDate)
|
|
1116
|
+
const t = this.formatDateForSelector(this.currentFocusedDate);
|
|
1117
|
+
console.log("Keyboard: Looking for cell with data-date:", t), console.log(
|
|
1118
|
+
"Keyboard: Current focused date:",
|
|
1119
|
+
this.currentFocusedDate.toDateString()
|
|
1120
|
+
);
|
|
1121
|
+
const e = this.container.querySelector(
|
|
963
1122
|
`[data-date="${t}"]`
|
|
964
1123
|
);
|
|
965
|
-
|
|
1124
|
+
if (e) {
|
|
1125
|
+
if (console.log("Keyboard: Found cell, text content:", e.textContent), e.classList.add("keyboard-focused"), e.setAttribute("aria-selected", "true"), this.isActive && this.container.offsetParent !== null) {
|
|
1126
|
+
const a = this.container.getBoundingClientRect(), i = e.getBoundingClientRect();
|
|
1127
|
+
(i.top < a.top || i.bottom > a.bottom || i.left < a.left || i.right > a.right) && e.scrollIntoView({
|
|
1128
|
+
block: "nearest",
|
|
1129
|
+
inline: "nearest",
|
|
1130
|
+
behavior: "smooth"
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
} else
|
|
1134
|
+
console.log("Keyboard: Cell not found for date:", t);
|
|
1135
|
+
this.addFocusStyles();
|
|
966
1136
|
}
|
|
967
1137
|
removeFocusStyles() {
|
|
968
1138
|
this.container.querySelectorAll(".keyboard-focused").forEach((e) => {
|
|
@@ -978,6 +1148,7 @@ class $ {
|
|
|
978
1148
|
outline-offset: -2px !important;
|
|
979
1149
|
z-index: 10 !important;
|
|
980
1150
|
position: relative !important;
|
|
1151
|
+
box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2) !important;
|
|
981
1152
|
}
|
|
982
1153
|
|
|
983
1154
|
.datex-picker .calendar-table td.keyboard-focused > * {
|
|
@@ -985,18 +1156,32 @@ class $ {
|
|
|
985
1156
|
color: white !important;
|
|
986
1157
|
font-weight: 600 !important;
|
|
987
1158
|
}
|
|
1159
|
+
|
|
1160
|
+
/* Prevent layout shifts */
|
|
1161
|
+
.datex-picker {
|
|
1162
|
+
contain: layout style !important;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
.datex-picker .calendar-table {
|
|
1166
|
+
contain: layout !important;
|
|
1167
|
+
}
|
|
988
1168
|
`, document.head.appendChild(t);
|
|
989
1169
|
}
|
|
990
1170
|
formatDateForSelector(t) {
|
|
991
|
-
const e = t.getFullYear(), a = String(t.getMonth() + 1).padStart(2, "0"), i = String(t.getDate()).padStart(2, "0")
|
|
992
|
-
return
|
|
1171
|
+
const e = t.getFullYear(), a = String(t.getMonth() + 1).padStart(2, "0"), i = String(t.getDate()).padStart(2, "0"), s = `${e}-${a}-${i}`;
|
|
1172
|
+
return console.log(
|
|
1173
|
+
"Keyboard: Formatting date for selector:",
|
|
1174
|
+
t.toDateString(),
|
|
1175
|
+
"-> formatted:",
|
|
1176
|
+
s
|
|
1177
|
+
), s;
|
|
993
1178
|
}
|
|
994
1179
|
// Public methods
|
|
995
1180
|
getCurrentFocusedDate() {
|
|
996
|
-
return this.currentFocusedDate;
|
|
1181
|
+
return this.currentFocusedDate ? new Date(this.currentFocusedDate.getTime()) : null;
|
|
997
1182
|
}
|
|
998
1183
|
setFocusedDate(t) {
|
|
999
|
-
this.currentFocusedDate = t, this.updateFocusedDate();
|
|
1184
|
+
this.currentFocusedDate = new Date(t.getTime()), this.updateFocusedDate();
|
|
1000
1185
|
}
|
|
1001
1186
|
cleanup() {
|
|
1002
1187
|
this.container.removeEventListener(
|
|
@@ -1007,7 +1192,7 @@ class $ {
|
|
|
1007
1192
|
t && t.remove();
|
|
1008
1193
|
}
|
|
1009
1194
|
}
|
|
1010
|
-
const
|
|
1195
|
+
const Y = {
|
|
1011
1196
|
format: "DD/MM/YYYY",
|
|
1012
1197
|
separator: " - ",
|
|
1013
1198
|
applyLabel: "Aplicar",
|
|
@@ -1029,7 +1214,7 @@ const F = {
|
|
|
1029
1214
|
"Diciembre"
|
|
1030
1215
|
],
|
|
1031
1216
|
firstDay: 1
|
|
1032
|
-
},
|
|
1217
|
+
}, V = {
|
|
1033
1218
|
format: "DD/MM/YYYY HH:mm",
|
|
1034
1219
|
separator: " - ",
|
|
1035
1220
|
applyLabel: "Aplicar",
|
|
@@ -1052,10 +1237,10 @@ const F = {
|
|
|
1052
1237
|
],
|
|
1053
1238
|
firstDay: 1
|
|
1054
1239
|
};
|
|
1055
|
-
class
|
|
1240
|
+
class O {
|
|
1056
1241
|
constructor(t, e = {}, a) {
|
|
1057
1242
|
this.element = this.resolveElement(t), this.options = this.mergeWithDefaults(e), this.locale = this.options.locale, this.callback = a || (() => {
|
|
1058
|
-
}), this.eventService = new
|
|
1243
|
+
}), this.eventService = new A(), this.initializeState(), this.initializeServices(), this.createContainer(), this.setupEventListeners(), this.updateElement(), this.calculateChosenLabel();
|
|
1059
1244
|
}
|
|
1060
1245
|
resolveElement(t) {
|
|
1061
1246
|
if (typeof t == "string") {
|
|
@@ -1089,11 +1274,11 @@ class P {
|
|
|
1089
1274
|
ranges: t.ranges || {},
|
|
1090
1275
|
opens: t.opens || "center",
|
|
1091
1276
|
drops: t.drops || "auto",
|
|
1092
|
-
locale: t.locale ||
|
|
1277
|
+
locale: t.locale || Y,
|
|
1093
1278
|
buttonClasses: t.buttonClasses || "btn btn-sm",
|
|
1094
1279
|
applyButtonClasses: t.applyButtonClasses || "btn-success",
|
|
1095
1280
|
cancelButtonClasses: t.cancelButtonClasses || "btn-danger",
|
|
1096
|
-
theme: t.theme ||
|
|
1281
|
+
theme: t.theme || E,
|
|
1097
1282
|
validation: t.validation || {},
|
|
1098
1283
|
events: t.events || {}
|
|
1099
1284
|
};
|
|
@@ -1102,19 +1287,19 @@ class P {
|
|
|
1102
1287
|
initializeState() {
|
|
1103
1288
|
const t = /* @__PURE__ */ new Date();
|
|
1104
1289
|
this.state = {
|
|
1105
|
-
startDate: this.options.timePicker ? this.options.startDate :
|
|
1106
|
-
endDate: this.options.timePicker ? this.options.endDate :
|
|
1107
|
-
oldStartDate: this.options.timePicker ? this.options.startDate :
|
|
1108
|
-
oldEndDate: this.options.timePicker ? this.options.endDate :
|
|
1290
|
+
startDate: this.options.timePicker ? this.options.startDate : w(this.options.startDate),
|
|
1291
|
+
endDate: this.options.timePicker ? this.options.endDate : S(this.options.endDate),
|
|
1292
|
+
oldStartDate: this.options.timePicker ? this.options.startDate : w(this.options.startDate),
|
|
1293
|
+
oldEndDate: this.options.timePicker ? this.options.endDate : S(this.options.endDate),
|
|
1109
1294
|
isShowing: !1,
|
|
1110
1295
|
leftCalendar: { month: t, calendar: [] },
|
|
1111
|
-
rightCalendar: { month:
|
|
1296
|
+
rightCalendar: { month: f(t, 1), calendar: [] },
|
|
1112
1297
|
chosenLabel: null,
|
|
1113
1298
|
hoverDate: null
|
|
1114
1299
|
};
|
|
1115
1300
|
}
|
|
1116
1301
|
initializeServices() {
|
|
1117
|
-
this.calendarService = new
|
|
1302
|
+
this.calendarService = new H(this.options, this.locale);
|
|
1118
1303
|
}
|
|
1119
1304
|
createContainer() {
|
|
1120
1305
|
const t = this.buildContainerTemplate(), e = document.createElement("div");
|
|
@@ -1145,11 +1330,11 @@ class P {
|
|
|
1145
1330
|
`;
|
|
1146
1331
|
}
|
|
1147
1332
|
initializeContainerServices() {
|
|
1148
|
-
this.themeService = new
|
|
1333
|
+
this.themeService = new T(this.container, this.options.theme), this.positionService = new F(
|
|
1149
1334
|
this.element,
|
|
1150
1335
|
this.container,
|
|
1151
1336
|
this.options
|
|
1152
|
-
), this.validationService = new
|
|
1337
|
+
), this.validationService = new I(this.options.validation), this.keyboardService = new P(this.container, {
|
|
1153
1338
|
enabled: !0
|
|
1154
1339
|
}), this.keyboardService.setHandlers({
|
|
1155
1340
|
onDateSelect: (t) => {
|
|
@@ -1177,7 +1362,9 @@ class P {
|
|
|
1177
1362
|
}
|
|
1178
1363
|
// Public API methods
|
|
1179
1364
|
show() {
|
|
1180
|
-
this.state.isShowing || (this.storeOldValues(), this.themeService.applyTheme(), this.setupDocumentListeners(), this.updateView(), this.displayContainer(), this.positionContainer(),
|
|
1365
|
+
this.state.isShowing || (this.storeOldValues(), this.themeService.applyTheme(), this.setupDocumentListeners(), this.updateView(), this.displayContainer(), this.positionContainer(), setTimeout(() => {
|
|
1366
|
+
this.state.isShowing && this.keyboardService.activate(this.state.startDate);
|
|
1367
|
+
}, 200), this.dispatchShowEvent());
|
|
1181
1368
|
}
|
|
1182
1369
|
hide() {
|
|
1183
1370
|
this.state.isShowing && (this.revertIfIncomplete(), this.triggerCallbackIfChanged(), this.updateElement(), this.removeDocumentListeners(), this.keyboardService.deactivate(), this.hideContainer(), this.dispatchHideEvent());
|
|
@@ -1186,10 +1373,10 @@ class P {
|
|
|
1186
1373
|
this.state.isShowing ? this.hide() : this.show();
|
|
1187
1374
|
}
|
|
1188
1375
|
setStartDate(t) {
|
|
1189
|
-
this.state.startDate = this.options.timePicker ? new Date(t) :
|
|
1376
|
+
this.state.startDate = this.options.timePicker ? new Date(t) : w(t), this.options.timePickerIncrement && this.options.timePicker && this.roundToIncrement(this.state.startDate), this.updateView();
|
|
1190
1377
|
}
|
|
1191
1378
|
setEndDate(t) {
|
|
1192
|
-
this.state.endDate = this.options.timePicker ? new Date(t) :
|
|
1379
|
+
this.state.endDate = this.options.timePicker ? new Date(t) : S(t), this.options.timePickerIncrement && this.options.timePicker && this.roundToIncrement(this.state.endDate), this.updateView();
|
|
1193
1380
|
}
|
|
1194
1381
|
getStartDate() {
|
|
1195
1382
|
return new Date(this.state.startDate);
|
|
@@ -1200,6 +1387,15 @@ class P {
|
|
|
1200
1387
|
setTheme(t) {
|
|
1201
1388
|
this.themeService.setTheme(t);
|
|
1202
1389
|
}
|
|
1390
|
+
setThemeMode(t) {
|
|
1391
|
+
this.themeService.setMode(t);
|
|
1392
|
+
}
|
|
1393
|
+
getThemeMode() {
|
|
1394
|
+
return this.themeService.getMode();
|
|
1395
|
+
}
|
|
1396
|
+
getCurrentThemeMode() {
|
|
1397
|
+
return this.themeService.getCurrentMode();
|
|
1398
|
+
}
|
|
1203
1399
|
// Validation methods
|
|
1204
1400
|
updateValidation(t) {
|
|
1205
1401
|
this.validationService.updateValidation(t);
|
|
@@ -1252,11 +1448,11 @@ class P {
|
|
|
1252
1448
|
this.state.endDate || (this.state.startDate = new Date(this.state.oldStartDate), this.state.endDate = this.state.oldEndDate ? new Date(this.state.oldEndDate) : null);
|
|
1253
1449
|
}
|
|
1254
1450
|
triggerCallbackIfChanged() {
|
|
1255
|
-
const t = !
|
|
1451
|
+
const t = !u(
|
|
1256
1452
|
this.state.startDate,
|
|
1257
1453
|
this.state.oldStartDate,
|
|
1258
1454
|
"day"
|
|
1259
|
-
), e = this.state.endDate && this.state.oldEndDate && !
|
|
1455
|
+
), e = this.state.endDate && this.state.oldEndDate && !u(this.state.endDate, this.state.oldEndDate, "day");
|
|
1260
1456
|
(t || e) && this.callback(
|
|
1261
1457
|
new Date(this.state.startDate),
|
|
1262
1458
|
this.state.endDate ? new Date(this.state.endDate) : new Date(this.state.startDate),
|
|
@@ -1279,12 +1475,13 @@ class P {
|
|
|
1279
1475
|
this.removeDocumentListeners(), this.themeService.cleanup(), this.eventService.cleanup(), this.keyboardService.cleanup(), (t = this.container) != null && t.parentNode && this.container.parentNode.removeChild(this.container);
|
|
1280
1476
|
}
|
|
1281
1477
|
handleKeyboardDateSelect(t) {
|
|
1478
|
+
console.log("DateX: Received date from keyboard:", t.toDateString()), console.log("DateX: Received date day:", t.getDate());
|
|
1282
1479
|
const e = this.validationService.validateDate(t);
|
|
1283
1480
|
if (!e.isValid) {
|
|
1284
1481
|
this.showValidationError(e.error, e.errorCode);
|
|
1285
1482
|
return;
|
|
1286
1483
|
}
|
|
1287
|
-
this.state.hoverDate = null, this.state.endDate ||
|
|
1484
|
+
this.state.hoverDate = null, this.state.endDate || g(t, this.state.startDate) ? (this.state.endDate = null, this.setStartDate(t)) : (this.setEndDate(t), this.options.autoApply && (this.calculateChosenLabel(), this.handleApplyClick())), this.options.singleDatePicker && (this.setEndDate(this.state.startDate), this.options.autoApply && this.handleApplyClick()), this.updateDateClasses();
|
|
1288
1485
|
}
|
|
1289
1486
|
clearSelection() {
|
|
1290
1487
|
const t = /* @__PURE__ */ new Date();
|
|
@@ -1353,7 +1550,10 @@ class P {
|
|
|
1353
1550
|
this.state.hoverDate && (this.state.hoverDate = null, this.updateDateClasses());
|
|
1354
1551
|
}
|
|
1355
1552
|
handleContainerChange(t) {
|
|
1356
|
-
|
|
1553
|
+
const e = t.target;
|
|
1554
|
+
e.matches("select.monthselect, select.yearselect") ? this.handleMonthYearChange(t) : e.matches(
|
|
1555
|
+
"select.hourselect, select.minuteselect, select.secondselect, select.ampmselect"
|
|
1556
|
+
) && this.handleTimeChange(t);
|
|
1357
1557
|
}
|
|
1358
1558
|
handleOutsideClick(t) {
|
|
1359
1559
|
const e = t.target;
|
|
@@ -1375,11 +1575,11 @@ class P {
|
|
|
1375
1575
|
const t = this.element;
|
|
1376
1576
|
if (!((s = t.value) != null && s.length)) return;
|
|
1377
1577
|
const e = t.value.split(this.locale.separator), { startDate: a, endDate: i } = this.parseDateParts(e);
|
|
1378
|
-
a &&
|
|
1578
|
+
a && y(a) && i && y(i) && (this.setStartDate(a), this.setEndDate(i), this.updateView());
|
|
1379
1579
|
}
|
|
1380
1580
|
parseDateParts(t) {
|
|
1381
1581
|
let e = null, a = null;
|
|
1382
|
-
return t.length === 2 ? (e =
|
|
1582
|
+
return t.length === 2 ? (e = b(t[0].trim(), this.locale.format), a = b(t[1].trim(), this.locale.format)) : (this.options.singleDatePicker || t.length === 1) && (e = b(t[0].trim(), this.locale.format), a = e), { startDate: e, endDate: a };
|
|
1383
1583
|
}
|
|
1384
1584
|
handleKeydown(t) {
|
|
1385
1585
|
t.key === "Tab" || t.key === "Enter" ? this.hide() : t.key === "Escape" && (t.preventDefault(), t.stopPropagation(), this.hide());
|
|
@@ -1393,8 +1593,8 @@ class P {
|
|
|
1393
1593
|
else {
|
|
1394
1594
|
const i = this.options.ranges[a];
|
|
1395
1595
|
if (i) {
|
|
1396
|
-
const [s,
|
|
1397
|
-
this.state.startDate = new Date(s), this.state.endDate = new Date(
|
|
1596
|
+
const [s, r] = i;
|
|
1597
|
+
this.state.startDate = new Date(s), this.state.endDate = new Date(r), this.showCalendars(), this.updateView(), this.options.autoApply && this.handleApplyClick();
|
|
1398
1598
|
}
|
|
1399
1599
|
}
|
|
1400
1600
|
}
|
|
@@ -1406,63 +1606,63 @@ class P {
|
|
|
1406
1606
|
}
|
|
1407
1607
|
handlePrevClick(t) {
|
|
1408
1608
|
const a = t.target.closest(".drp-calendar");
|
|
1409
|
-
a && (a.classList.contains("left") ? (this.state.leftCalendar.month =
|
|
1609
|
+
a && (a.classList.contains("left") ? (this.state.leftCalendar.month = f(
|
|
1410
1610
|
this.state.leftCalendar.month,
|
|
1411
1611
|
-1
|
|
1412
|
-
), this.options.linkedCalendars && (this.state.rightCalendar.month =
|
|
1612
|
+
), this.options.linkedCalendars && (this.state.rightCalendar.month = f(
|
|
1413
1613
|
this.state.rightCalendar.month,
|
|
1414
1614
|
-1
|
|
1415
|
-
))) : this.state.rightCalendar.month =
|
|
1615
|
+
))) : this.state.rightCalendar.month = f(
|
|
1416
1616
|
this.state.rightCalendar.month,
|
|
1417
1617
|
-1
|
|
1418
1618
|
), this.updateCalendars());
|
|
1419
1619
|
}
|
|
1420
1620
|
handleNextClick(t) {
|
|
1421
1621
|
const a = t.target.closest(".drp-calendar");
|
|
1422
|
-
a && (a.classList.contains("left") ? this.state.leftCalendar.month =
|
|
1622
|
+
a && (a.classList.contains("left") ? this.state.leftCalendar.month = f(
|
|
1423
1623
|
this.state.leftCalendar.month,
|
|
1424
1624
|
1
|
|
1425
|
-
) : (this.state.rightCalendar.month =
|
|
1625
|
+
) : (this.state.rightCalendar.month = f(
|
|
1426
1626
|
this.state.rightCalendar.month,
|
|
1427
1627
|
1
|
|
1428
|
-
), this.options.linkedCalendars && (this.state.leftCalendar.month =
|
|
1628
|
+
), this.options.linkedCalendars && (this.state.leftCalendar.month = f(
|
|
1429
1629
|
this.state.leftCalendar.month,
|
|
1430
1630
|
1
|
|
1431
1631
|
))), this.updateCalendars());
|
|
1432
1632
|
}
|
|
1433
1633
|
handleDateClick(t) {
|
|
1434
|
-
var
|
|
1634
|
+
var r, n;
|
|
1435
1635
|
const e = t.target;
|
|
1436
1636
|
if (!e.classList.contains("available")) return;
|
|
1437
1637
|
const a = e.dataset.date;
|
|
1438
1638
|
if (!a) return;
|
|
1439
|
-
const i =
|
|
1440
|
-
if (!
|
|
1639
|
+
const i = b(a, "YYYY-MM-DD");
|
|
1640
|
+
if (!y(i)) return;
|
|
1441
1641
|
const s = this.validationService.validateDate(i);
|
|
1442
1642
|
if (!s.isValid) {
|
|
1443
1643
|
this.showValidationError(s.error, s.errorCode);
|
|
1444
1644
|
return;
|
|
1445
1645
|
}
|
|
1446
|
-
if (!((
|
|
1447
|
-
if (this.applyTimeToDate(i, e), this.state.hoverDate = null, this.state.endDate ||
|
|
1646
|
+
if (!((r = this.options.events) != null && r.beforeDateSelect && !this.options.events.beforeDateSelect(i))) {
|
|
1647
|
+
if (this.applyTimeToDate(i, e), this.state.hoverDate = null, this.state.endDate || g(i, this.state.startDate))
|
|
1448
1648
|
this.state.endDate = null, this.setStartDate(i);
|
|
1449
1649
|
else {
|
|
1450
1650
|
if (this.setEndDate(i), this.state.startDate && this.state.endDate) {
|
|
1451
|
-
const
|
|
1651
|
+
const o = this.validationService.validateDateRange(
|
|
1452
1652
|
this.state.startDate,
|
|
1453
1653
|
this.state.endDate
|
|
1454
1654
|
);
|
|
1455
|
-
if (!
|
|
1655
|
+
if (!o.isValid) {
|
|
1456
1656
|
this.showValidationError(
|
|
1457
|
-
|
|
1458
|
-
|
|
1657
|
+
o.error,
|
|
1658
|
+
o.errorCode
|
|
1459
1659
|
), this.state.endDate = null, this.updateDateClasses();
|
|
1460
1660
|
return;
|
|
1461
1661
|
}
|
|
1462
1662
|
}
|
|
1463
1663
|
this.options.autoApply && (this.calculateChosenLabel(), this.handleApplyClick());
|
|
1464
1664
|
}
|
|
1465
|
-
this.options.singleDatePicker && (this.setEndDate(this.state.startDate), this.options.autoApply && this.handleApplyClick()), (
|
|
1665
|
+
this.options.singleDatePicker && (this.setEndDate(this.state.startDate), this.options.autoApply && this.handleApplyClick()), (n = this.options.events) != null && n.onDateSelect && this.options.events.onDateSelect(i), this.updateDateClasses();
|
|
1466
1666
|
}
|
|
1467
1667
|
}
|
|
1468
1668
|
handleDateHover(t) {
|
|
@@ -1470,30 +1670,71 @@ class P {
|
|
|
1470
1670
|
if (!e.classList.contains("available")) return;
|
|
1471
1671
|
const a = e.dataset.date;
|
|
1472
1672
|
if (!a) return;
|
|
1473
|
-
const i =
|
|
1474
|
-
|
|
1673
|
+
const i = b(a, "YYYY-MM-DD");
|
|
1674
|
+
y(i) && !this.state.endDate && !g(i, this.state.startDate) && (this.state.hoverDate = i, this.updateDateClasses());
|
|
1475
1675
|
}
|
|
1476
1676
|
handleMonthYearChange(t) {
|
|
1477
1677
|
const a = t.target.closest(".drp-calendar");
|
|
1478
1678
|
if (!a) return;
|
|
1479
1679
|
const i = a.classList.contains("left"), s = a.querySelector(
|
|
1480
1680
|
".monthselect"
|
|
1481
|
-
),
|
|
1681
|
+
), r = a.querySelector(
|
|
1482
1682
|
".yearselect"
|
|
1483
1683
|
);
|
|
1484
|
-
if (!s || !
|
|
1485
|
-
const
|
|
1486
|
-
i ? (this.state.leftCalendar.month = c, this.options.linkedCalendars && (this.state.rightCalendar.month =
|
|
1684
|
+
if (!s || !r) return;
|
|
1685
|
+
const n = parseInt(s.value, 10), o = parseInt(r.value, 10), c = new Date(o, n, 1);
|
|
1686
|
+
i ? (this.state.leftCalendar.month = c, this.options.linkedCalendars && (this.state.rightCalendar.month = f(c, 1))) : (this.state.rightCalendar.month = c, this.options.linkedCalendars && (this.state.leftCalendar.month = f(c, -1))), this.updateCalendars();
|
|
1687
|
+
}
|
|
1688
|
+
handleTimeChange(t) {
|
|
1689
|
+
const a = t.target.closest(".drp-calendar");
|
|
1690
|
+
if (!a) return;
|
|
1691
|
+
const i = a.classList.contains("left"), s = i ? this.state.startDate : this.state.endDate || this.state.startDate, r = a.querySelector(
|
|
1692
|
+
".hourselect"
|
|
1693
|
+
), n = a.querySelector(
|
|
1694
|
+
".minuteselect"
|
|
1695
|
+
), o = a.querySelector(
|
|
1696
|
+
".secondselect"
|
|
1697
|
+
), c = a.querySelector(
|
|
1698
|
+
".ampmselect"
|
|
1699
|
+
);
|
|
1700
|
+
if (!r || !n) return;
|
|
1701
|
+
let d = parseInt(r.value, 10);
|
|
1702
|
+
const m = parseInt(n.value, 10) || 0, p = o ? parseInt(o.value, 10) : 0;
|
|
1703
|
+
if (!this.options.timePicker24Hour && c) {
|
|
1704
|
+
const D = c.value;
|
|
1705
|
+
D === "PM" && d < 12 && (d += 12), D === "AM" && d === 12 && (d = 0);
|
|
1706
|
+
}
|
|
1707
|
+
const h = new Date(s);
|
|
1708
|
+
if (h.setHours(d), h.setMinutes(m), h.setSeconds(p), this.options.timePickerIncrement && this.roundToIncrement(h), !(this.options.minDate && h < this.options.minDate) && !(this.options.maxDate && h > this.options.maxDate)) {
|
|
1709
|
+
if (this.validationService) {
|
|
1710
|
+
const D = this.validationService.validateDate(h);
|
|
1711
|
+
if (!D.isValid) {
|
|
1712
|
+
this.showValidationError(D.error, D.errorCode);
|
|
1713
|
+
return;
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
i ? (this.state.startDate = h, this.options.singleDatePicker ? this.state.endDate = h : this.state.endDate && this.state.endDate.toDateString() === h.toDateString() && this.state.endDate < h && (this.state.endDate = new Date(h))) : this.state.endDate && (this.state.endDate = h), this.updateSelectedDisplay(), this.updateCalendars(), this.updateFormInputs();
|
|
1717
|
+
}
|
|
1487
1718
|
}
|
|
1488
1719
|
// View update methods
|
|
1489
1720
|
updateView() {
|
|
1490
|
-
this.updateMonthsInView(), this.updateCalendars(), this.updateFormInputs(), this.updateSelectedDisplay(), this.calculateChosenLabel();
|
|
1721
|
+
this.updateMonthsInView(), this.updateCalendars(), this.updateFormInputs(), this.updateSelectedDisplay(), this.calculateChosenLabel(), this.options.timePicker && this.updateTimePickerControls();
|
|
1722
|
+
}
|
|
1723
|
+
updateTimePickerControls() {
|
|
1724
|
+
const t = this.container.querySelectorAll(
|
|
1725
|
+
".right .calendar-time select"
|
|
1726
|
+
);
|
|
1727
|
+
this.state.endDate ? t.forEach((e) => {
|
|
1728
|
+
e.disabled = !1, e.classList.remove("disabled");
|
|
1729
|
+
}) : t.forEach((e) => {
|
|
1730
|
+
e.disabled = !0, e.classList.add("disabled");
|
|
1731
|
+
});
|
|
1491
1732
|
}
|
|
1492
1733
|
updateMonthsInView() {
|
|
1493
|
-
this.state.endDate ? (this.state.leftCalendar.month =
|
|
1734
|
+
this.state.endDate ? (this.state.leftCalendar.month = x(this.state.startDate), !this.options.linkedCalendars && (this.state.endDate.getMonth() !== this.state.startDate.getMonth() || this.state.endDate.getFullYear() !== this.state.startDate.getFullYear()) ? this.state.rightCalendar.month = x(this.state.endDate) : this.state.rightCalendar.month = f(
|
|
1494
1735
|
this.state.leftCalendar.month,
|
|
1495
1736
|
1
|
|
1496
|
-
)) : (this.state.leftCalendar.month =
|
|
1737
|
+
)) : (this.state.leftCalendar.month = x(this.state.startDate), this.state.rightCalendar.month = f(
|
|
1497
1738
|
this.state.leftCalendar.month,
|
|
1498
1739
|
1
|
|
1499
1740
|
));
|
|
@@ -1508,7 +1749,7 @@ class P {
|
|
|
1508
1749
|
e.calendar = this.calendarService.buildCalendarMatrix(
|
|
1509
1750
|
e.month
|
|
1510
1751
|
);
|
|
1511
|
-
const i = this.calendarService.canNavigatePrevious(e.month), s = this.calendarService.canNavigateNext(e.month),
|
|
1752
|
+
const i = this.calendarService.canNavigatePrevious(e.month), s = this.calendarService.canNavigateNext(e.month), r = this.calendarService.renderCalendarHTML(
|
|
1512
1753
|
e,
|
|
1513
1754
|
t,
|
|
1514
1755
|
this.state.startDate,
|
|
@@ -1516,24 +1757,24 @@ class P {
|
|
|
1516
1757
|
i,
|
|
1517
1758
|
s
|
|
1518
1759
|
);
|
|
1519
|
-
a.innerHTML =
|
|
1760
|
+
a.innerHTML = r;
|
|
1520
1761
|
}
|
|
1521
1762
|
updateFormInputs() {
|
|
1522
1763
|
const t = this.container.querySelector(
|
|
1523
1764
|
".applyBtn"
|
|
1524
|
-
), e = this.options.singleDatePicker || this.state.endDate && (
|
|
1765
|
+
), e = this.options.singleDatePicker || this.state.endDate && (g(this.state.startDate, this.state.endDate) || u(this.state.startDate, this.state.endDate, "day"));
|
|
1525
1766
|
t.disabled = !e;
|
|
1526
1767
|
}
|
|
1527
1768
|
updateSelectedDisplay() {
|
|
1528
1769
|
const t = this.container.querySelector(".drp-selected");
|
|
1529
|
-
let e =
|
|
1530
|
-
!this.options.singleDatePicker && this.state.endDate && (e += this.locale.separator +
|
|
1770
|
+
let e = C(this.state.startDate, this.locale.format);
|
|
1771
|
+
!this.options.singleDatePicker && this.state.endDate && (e += this.locale.separator + C(this.state.endDate, this.locale.format)), t.textContent = e;
|
|
1531
1772
|
}
|
|
1532
1773
|
updateElement() {
|
|
1533
1774
|
if (this.element.tagName === "INPUT" && this.options.autoUpdateInput) {
|
|
1534
1775
|
const t = this.element;
|
|
1535
|
-
let e =
|
|
1536
|
-
!this.options.singleDatePicker && this.state.endDate && (e += this.locale.separator +
|
|
1776
|
+
let e = C(this.state.startDate, this.locale.format);
|
|
1777
|
+
!this.options.singleDatePicker && this.state.endDate && (e += this.locale.separator + C(this.state.endDate, this.locale.format)), e !== t.value && (t.value = e, this.eventService.dispatchEvent(this.element, "change"));
|
|
1537
1778
|
}
|
|
1538
1779
|
}
|
|
1539
1780
|
renderRanges() {
|
|
@@ -1560,13 +1801,13 @@ class P {
|
|
|
1560
1801
|
this.container.querySelectorAll("td[data-date]").forEach((e) => {
|
|
1561
1802
|
const a = e.dataset.date;
|
|
1562
1803
|
if (!a) return;
|
|
1563
|
-
const i =
|
|
1564
|
-
if (!
|
|
1804
|
+
const i = b(a, "YYYY-MM-DD");
|
|
1805
|
+
if (!y(i)) return;
|
|
1565
1806
|
e.classList.remove("in-range", "end-date", "start-date", "active");
|
|
1566
|
-
const s = this.state.startDate,
|
|
1567
|
-
if (s &&
|
|
1568
|
-
const
|
|
1569
|
-
|
|
1807
|
+
const s = this.state.startDate, r = this.state.endDate, n = this.state.hoverDate;
|
|
1808
|
+
if (s && u(i, s, "day") && e.classList.add("active", "start-date"), r && u(i, r, "day") && e.classList.add("active", "end-date"), s && r && k(i, s) && g(i, r) && e.classList.add("in-range"), s && n && !r) {
|
|
1809
|
+
const o = g(n, s) ? n : s, c = g(n, s) ? s : n;
|
|
1810
|
+
u(i, n, "day") ? e.classList.add("end-date") : k(i, o) && g(i, c) && e.classList.add("in-range");
|
|
1570
1811
|
}
|
|
1571
1812
|
});
|
|
1572
1813
|
}
|
|
@@ -1578,24 +1819,24 @@ class P {
|
|
|
1578
1819
|
".hourselect"
|
|
1579
1820
|
), s = a.querySelector(
|
|
1580
1821
|
".minuteselect"
|
|
1581
|
-
),
|
|
1822
|
+
), r = a.querySelector(
|
|
1582
1823
|
".secondselect"
|
|
1583
|
-
),
|
|
1824
|
+
), n = a.querySelector(
|
|
1584
1825
|
".ampmselect"
|
|
1585
1826
|
);
|
|
1586
1827
|
if (i) {
|
|
1587
|
-
let
|
|
1588
|
-
if (!this.options.timePicker24Hour &&
|
|
1589
|
-
const c =
|
|
1590
|
-
c === "PM" &&
|
|
1828
|
+
let o = parseInt(i.value, 10);
|
|
1829
|
+
if (!this.options.timePicker24Hour && n) {
|
|
1830
|
+
const c = n.value;
|
|
1831
|
+
c === "PM" && o < 12 && (o += 12), c === "AM" && o === 12 && (o = 0);
|
|
1591
1832
|
}
|
|
1592
|
-
t.setHours(
|
|
1833
|
+
t.setHours(o);
|
|
1593
1834
|
}
|
|
1594
1835
|
if (s) {
|
|
1595
|
-
const
|
|
1596
|
-
t.setMinutes(
|
|
1836
|
+
const o = parseInt(s.value, 10) || 0;
|
|
1837
|
+
t.setMinutes(o);
|
|
1597
1838
|
}
|
|
1598
|
-
this.options.timePickerSeconds &&
|
|
1839
|
+
this.options.timePickerSeconds && r && t.setSeconds(parseInt(r.value, 10));
|
|
1599
1840
|
}
|
|
1600
1841
|
createRangeService() {
|
|
1601
1842
|
return {
|
|
@@ -1607,13 +1848,13 @@ class P {
|
|
|
1607
1848
|
},
|
|
1608
1849
|
calculateChosenLabel: (t, e) => {
|
|
1609
1850
|
let a = null;
|
|
1610
|
-
for (const [i, [s,
|
|
1851
|
+
for (const [i, [s, r]] of Object.entries(
|
|
1611
1852
|
this.options.ranges
|
|
1612
1853
|
)) {
|
|
1613
|
-
const
|
|
1614
|
-
let
|
|
1615
|
-
if (e ?
|
|
1616
|
-
const c = Math.abs(
|
|
1854
|
+
const n = u(t, s, "day");
|
|
1855
|
+
let o = !1;
|
|
1856
|
+
if (e ? o = u(e, r, "day") : o = u(t, r, "day"), n && o) {
|
|
1857
|
+
const c = Math.abs(r.getTime() - s.getTime()) / 864e5 + 1;
|
|
1617
1858
|
(!a || c > a.days) && (a = { label: i, days: c });
|
|
1618
1859
|
}
|
|
1619
1860
|
}
|
|
@@ -1631,20 +1872,20 @@ class P {
|
|
|
1631
1872
|
}
|
|
1632
1873
|
}
|
|
1633
1874
|
export {
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1875
|
+
B as BOOTSTRAP_THEME,
|
|
1876
|
+
E as DEFAULT_THEME,
|
|
1877
|
+
O as Datex,
|
|
1878
|
+
R as MATERIAL_THEME,
|
|
1879
|
+
Y as SPANISH_LOCALE,
|
|
1880
|
+
V as SPANISH_LOCALE_WITH_TIME,
|
|
1881
|
+
f as addMonths,
|
|
1882
|
+
S as endOfDay,
|
|
1883
|
+
C as formatDate,
|
|
1884
|
+
x as getStartOfMonth,
|
|
1885
|
+
k as isAfterDate,
|
|
1886
|
+
g as isBeforeDate,
|
|
1887
|
+
u as isSameDate,
|
|
1888
|
+
y as isValidDate,
|
|
1889
|
+
b as parseDate,
|
|
1890
|
+
w as startOfDay
|
|
1650
1891
|
};
|