@oslokommune/punkt-elements 13.4.2 → 13.5.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/CHANGELOG.md +18 -0
- package/dist/calendar-32W9p9uc.cjs +115 -0
- package/dist/{calendar-DevQhOup.js → calendar-CJSxvwAq.js} +353 -340
- package/dist/{datepicker-CYOn3tRm.js → datepicker-BJKJBoy_.js} +102 -59
- package/dist/datepicker-CmTrG5GE.cjs +164 -0
- package/dist/index.d.ts +6 -2
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +3 -3
- package/package.json +3 -3
- package/src/components/calendar/calendar.accessibility.test.ts +111 -0
- package/src/components/calendar/calendar.constraints.test.ts +110 -0
- package/src/components/calendar/calendar.core.test.ts +367 -0
- package/src/components/calendar/calendar.interaction.test.ts +139 -0
- package/src/components/calendar/calendar.selection.test.ts +273 -0
- package/src/components/calendar/calendar.ts +74 -42
- package/src/components/card/card.test.ts +19 -5
- package/src/components/datepicker/datepicker.accessibility.test.ts +193 -0
- package/src/components/datepicker/datepicker.core.test.ts +322 -0
- package/src/components/datepicker/datepicker.input.test.ts +268 -0
- package/src/components/datepicker/datepicker.selection.test.ts +286 -0
- package/src/components/datepicker/datepicker.ts +121 -19
- package/src/components/datepicker/datepicker.validation.test.ts +176 -0
- package/dist/calendar-BZe2D4Sr.cjs +0 -108
- package/dist/datepicker-B9rhz_AF.cjs +0 -154
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { e as
|
|
2
|
-
import { P as dt, E as
|
|
1
|
+
import { e as V } from "./class-map-BpTj9gtz.js";
|
|
2
|
+
import { P as dt, E as U, x as S, n as m, a as ft } from "./element-CgEWt74-.js";
|
|
3
3
|
import { r as H } from "./state-Bo2bck5_.js";
|
|
4
4
|
import "./icon-CC1js8eR.js";
|
|
5
|
-
const
|
|
5
|
+
const st = 6048e5, mt = 864e5, J = Symbol.for("constructDateFrom");
|
|
6
6
|
function M(t, e) {
|
|
7
|
-
return typeof t == "function" ? t(e) : t && typeof t == "object" &&
|
|
7
|
+
return typeof t == "function" ? t(e) : t && typeof t == "object" && J in t ? t[J](e) : t instanceof Date ? new t.constructor(e) : new Date(e);
|
|
8
8
|
}
|
|
9
9
|
function D(t, e) {
|
|
10
10
|
return M(e || t, t);
|
|
@@ -14,26 +14,26 @@ function B(t, e, n) {
|
|
|
14
14
|
return isNaN(e) ? M(t, NaN) : (e && r.setDate(r.getDate() + e), r);
|
|
15
15
|
}
|
|
16
16
|
let gt = {};
|
|
17
|
-
function
|
|
17
|
+
function q() {
|
|
18
18
|
return gt;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
var c, o,
|
|
22
|
-
const n =
|
|
20
|
+
function A(t, e) {
|
|
21
|
+
var c, o, l, f;
|
|
22
|
+
const n = q(), r = (e == null ? void 0 : e.weekStartsOn) ?? ((o = (c = e == null ? void 0 : e.locale) == null ? void 0 : c.options) == null ? void 0 : o.weekStartsOn) ?? n.weekStartsOn ?? ((f = (l = n.locale) == null ? void 0 : l.options) == null ? void 0 : f.weekStartsOn) ?? 0, a = D(t, e == null ? void 0 : e.in), s = a.getDay(), i = (s < r ? 7 : 0) + s - r;
|
|
23
23
|
return a.setDate(a.getDate() - i), a.setHours(0, 0, 0, 0), a;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return
|
|
25
|
+
function I(t, e) {
|
|
26
|
+
return A(t, { ...e, weekStartsOn: 1 });
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function it(t, e) {
|
|
29
29
|
const n = D(t, e == null ? void 0 : e.in), r = n.getFullYear(), a = M(n, 0);
|
|
30
30
|
a.setFullYear(r + 1, 0, 4), a.setHours(0, 0, 0, 0);
|
|
31
|
-
const s =
|
|
31
|
+
const s = I(a), i = M(n, 0);
|
|
32
32
|
i.setFullYear(r, 0, 4), i.setHours(0, 0, 0, 0);
|
|
33
|
-
const c =
|
|
33
|
+
const c = I(i);
|
|
34
34
|
return n.getTime() >= s.getTime() ? r + 1 : n.getTime() >= c.getTime() ? r : r - 1;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function K(t) {
|
|
37
37
|
const e = D(t), n = new Date(
|
|
38
38
|
Date.UTC(
|
|
39
39
|
e.getFullYear(),
|
|
@@ -47,7 +47,7 @@ function J(t) {
|
|
|
47
47
|
);
|
|
48
48
|
return n.setUTCFullYear(e.getFullYear()), +t - +n;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function ot(t, ...e) {
|
|
51
51
|
const n = M.bind(
|
|
52
52
|
null,
|
|
53
53
|
e.find((r) => typeof r == "object")
|
|
@@ -59,16 +59,16 @@ function G(t, e) {
|
|
|
59
59
|
return n.setHours(0, 0, 0, 0), n;
|
|
60
60
|
}
|
|
61
61
|
function yt(t, e, n) {
|
|
62
|
-
const [r, a] =
|
|
62
|
+
const [r, a] = ot(
|
|
63
63
|
n == null ? void 0 : n.in,
|
|
64
64
|
t,
|
|
65
65
|
e
|
|
66
|
-
), s = G(r), i = G(a), c = +s -
|
|
66
|
+
), s = G(r), i = G(a), c = +s - K(s), o = +i - K(i);
|
|
67
67
|
return Math.round((c - o) / mt);
|
|
68
68
|
}
|
|
69
69
|
function pt(t, e) {
|
|
70
|
-
const n =
|
|
71
|
-
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0),
|
|
70
|
+
const n = it(t, e), r = M(t, 0);
|
|
71
|
+
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), I(r);
|
|
72
72
|
}
|
|
73
73
|
function wt(t) {
|
|
74
74
|
return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]";
|
|
@@ -76,16 +76,16 @@ function wt(t) {
|
|
|
76
76
|
function bt(t) {
|
|
77
77
|
return !(!wt(t) && typeof t != "number" || isNaN(+D(t)));
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function kt(t, e) {
|
|
80
80
|
const n = D(t, e == null ? void 0 : e.in);
|
|
81
81
|
return n.setHours(23, 59, 59, 999), n;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
const [n, r] =
|
|
83
|
+
function Dt(t, e) {
|
|
84
|
+
const [n, r] = ot(t, e.start, e.end);
|
|
85
85
|
return { start: n, end: r };
|
|
86
86
|
}
|
|
87
87
|
function z(t, e) {
|
|
88
|
-
const { start: n, end: r } =
|
|
88
|
+
const { start: n, end: r } = Dt(e == null ? void 0 : e.in, t);
|
|
89
89
|
let a = +n > +r;
|
|
90
90
|
const s = a ? +n : +r, i = a ? r : n;
|
|
91
91
|
i.setHours(0, 0, 0, 0);
|
|
@@ -95,11 +95,11 @@ function z(t, e) {
|
|
|
95
95
|
o.push(M(n, i)), i.setDate(i.getDate() + c), i.setHours(0, 0, 0, 0);
|
|
96
96
|
return a ? o.reverse() : o;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function St(t, e) {
|
|
99
99
|
const n = D(t, e == null ? void 0 : e.in);
|
|
100
100
|
return n.setFullYear(n.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
|
|
101
101
|
}
|
|
102
|
-
const
|
|
102
|
+
const vt = {
|
|
103
103
|
lessThanXSeconds: {
|
|
104
104
|
one: "less than a second",
|
|
105
105
|
other: "less than {{count}} seconds"
|
|
@@ -163,7 +163,7 @@ const St = {
|
|
|
163
163
|
}
|
|
164
164
|
}, Mt = (t, e, n) => {
|
|
165
165
|
let r;
|
|
166
|
-
const a =
|
|
166
|
+
const a = vt[t];
|
|
167
167
|
return typeof a == "string" ? r = a : e === 1 ? r = a.one : r = a.other.replace("{{count}}", e.toString()), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "in " + r : r + " ago" : r;
|
|
168
168
|
};
|
|
169
169
|
function Q(t) {
|
|
@@ -200,15 +200,15 @@ const Tt = {
|
|
|
200
200
|
formats: Ot,
|
|
201
201
|
defaultWidth: "full"
|
|
202
202
|
})
|
|
203
|
-
},
|
|
203
|
+
}, $t = {
|
|
204
204
|
lastWeek: "'last' eeee 'at' p",
|
|
205
205
|
yesterday: "'yesterday at' p",
|
|
206
206
|
today: "'today at' p",
|
|
207
207
|
tomorrow: "'tomorrow at' p",
|
|
208
208
|
nextWeek: "eeee 'at' p",
|
|
209
209
|
other: "P"
|
|
210
|
-
},
|
|
211
|
-
function
|
|
210
|
+
}, Nt = (t, e, n, r) => $t[t];
|
|
211
|
+
function E(t) {
|
|
212
212
|
return (e, n) => {
|
|
213
213
|
const r = n != null && n.context ? String(n.context) : "standalone";
|
|
214
214
|
let a;
|
|
@@ -227,11 +227,11 @@ const Ct = {
|
|
|
227
227
|
narrow: ["B", "A"],
|
|
228
228
|
abbreviated: ["BC", "AD"],
|
|
229
229
|
wide: ["Before Christ", "Anno Domini"]
|
|
230
|
-
},
|
|
230
|
+
}, _t = {
|
|
231
231
|
narrow: ["1", "2", "3", "4"],
|
|
232
232
|
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
233
233
|
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
|
234
|
-
},
|
|
234
|
+
}, Et = {
|
|
235
235
|
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
236
236
|
abbreviated: [
|
|
237
237
|
"Jan",
|
|
@@ -261,7 +261,7 @@ const Ct = {
|
|
|
261
261
|
"November",
|
|
262
262
|
"December"
|
|
263
263
|
]
|
|
264
|
-
},
|
|
264
|
+
}, Wt = {
|
|
265
265
|
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
266
266
|
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
267
267
|
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
@@ -274,7 +274,7 @@ const Ct = {
|
|
|
274
274
|
"Friday",
|
|
275
275
|
"Saturday"
|
|
276
276
|
]
|
|
277
|
-
},
|
|
277
|
+
}, Yt = {
|
|
278
278
|
narrow: {
|
|
279
279
|
am: "a",
|
|
280
280
|
pm: "p",
|
|
@@ -305,7 +305,7 @@ const Ct = {
|
|
|
305
305
|
evening: "evening",
|
|
306
306
|
night: "night"
|
|
307
307
|
}
|
|
308
|
-
},
|
|
308
|
+
}, Ft = {
|
|
309
309
|
narrow: {
|
|
310
310
|
am: "a",
|
|
311
311
|
pm: "p",
|
|
@@ -336,7 +336,7 @@ const Ct = {
|
|
|
336
336
|
evening: "in the evening",
|
|
337
337
|
night: "at night"
|
|
338
338
|
}
|
|
339
|
-
},
|
|
339
|
+
}, At = (t, e) => {
|
|
340
340
|
const n = Number(t), r = n % 100;
|
|
341
341
|
if (r > 20 || r < 10)
|
|
342
342
|
switch (r % 10) {
|
|
@@ -349,47 +349,47 @@ const Ct = {
|
|
|
349
349
|
}
|
|
350
350
|
return n + "th";
|
|
351
351
|
}, Ht = {
|
|
352
|
-
ordinalNumber:
|
|
353
|
-
era:
|
|
352
|
+
ordinalNumber: At,
|
|
353
|
+
era: E({
|
|
354
354
|
values: Ct,
|
|
355
355
|
defaultWidth: "wide"
|
|
356
356
|
}),
|
|
357
|
-
quarter:
|
|
358
|
-
values:
|
|
357
|
+
quarter: E({
|
|
358
|
+
values: _t,
|
|
359
359
|
defaultWidth: "wide",
|
|
360
360
|
argumentCallback: (t) => t - 1
|
|
361
361
|
}),
|
|
362
|
-
month:
|
|
363
|
-
values:
|
|
362
|
+
month: E({
|
|
363
|
+
values: Et,
|
|
364
364
|
defaultWidth: "wide"
|
|
365
365
|
}),
|
|
366
|
-
day:
|
|
367
|
-
values:
|
|
366
|
+
day: E({
|
|
367
|
+
values: Wt,
|
|
368
368
|
defaultWidth: "wide"
|
|
369
369
|
}),
|
|
370
|
-
dayPeriod:
|
|
371
|
-
values:
|
|
370
|
+
dayPeriod: E({
|
|
371
|
+
values: Yt,
|
|
372
372
|
defaultWidth: "wide",
|
|
373
|
-
formattingValues:
|
|
373
|
+
formattingValues: Ft,
|
|
374
374
|
defaultFormattingWidth: "wide"
|
|
375
375
|
})
|
|
376
376
|
};
|
|
377
|
-
function
|
|
377
|
+
function W(t) {
|
|
378
378
|
return (e, n = {}) => {
|
|
379
379
|
const r = n.width, a = r && t.matchPatterns[r] || t.matchPatterns[t.defaultMatchWidth], s = e.match(a);
|
|
380
380
|
if (!s)
|
|
381
381
|
return null;
|
|
382
|
-
const i = s[0], c = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], o = Array.isArray(c) ? qt(c, (
|
|
382
|
+
const i = s[0], c = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], o = Array.isArray(c) ? qt(c, (g) => g.test(i)) : (
|
|
383
383
|
// [TODO] -- I challenge you to fix the type
|
|
384
|
-
It(c, (
|
|
384
|
+
It(c, (g) => g.test(i))
|
|
385
385
|
);
|
|
386
|
-
let
|
|
387
|
-
|
|
386
|
+
let l;
|
|
387
|
+
l = t.valueCallback ? t.valueCallback(o) : o, l = n.valueCallback ? (
|
|
388
388
|
// [TODO] -- I challenge you to fix the type
|
|
389
|
-
n.valueCallback(
|
|
390
|
-
) :
|
|
391
|
-
const
|
|
392
|
-
return { value:
|
|
389
|
+
n.valueCallback(l)
|
|
390
|
+
) : l;
|
|
391
|
+
const f = e.slice(i.length);
|
|
392
|
+
return { value: l, rest: f };
|
|
393
393
|
};
|
|
394
394
|
}
|
|
395
395
|
function It(t, e) {
|
|
@@ -487,32 +487,32 @@ const Rt = /^(\d+)(th|st|nd|rd)?/i, Ut = /\d+/i, Bt = {
|
|
|
487
487
|
parsePattern: Ut,
|
|
488
488
|
valueCallback: (t) => parseInt(t, 10)
|
|
489
489
|
}),
|
|
490
|
-
era:
|
|
490
|
+
era: W({
|
|
491
491
|
matchPatterns: Bt,
|
|
492
492
|
defaultMatchWidth: "wide",
|
|
493
493
|
parsePatterns: zt,
|
|
494
494
|
defaultParseWidth: "any"
|
|
495
495
|
}),
|
|
496
|
-
quarter:
|
|
496
|
+
quarter: W({
|
|
497
497
|
matchPatterns: Qt,
|
|
498
498
|
defaultMatchWidth: "wide",
|
|
499
499
|
parsePatterns: jt,
|
|
500
500
|
defaultParseWidth: "any",
|
|
501
501
|
valueCallback: (t) => t + 1
|
|
502
502
|
}),
|
|
503
|
-
month:
|
|
503
|
+
month: W({
|
|
504
504
|
matchPatterns: Gt,
|
|
505
505
|
defaultMatchWidth: "wide",
|
|
506
506
|
parsePatterns: Xt,
|
|
507
507
|
defaultParseWidth: "any"
|
|
508
508
|
}),
|
|
509
|
-
day:
|
|
509
|
+
day: W({
|
|
510
510
|
matchPatterns: Vt,
|
|
511
511
|
defaultMatchWidth: "wide",
|
|
512
512
|
parsePatterns: Jt,
|
|
513
513
|
defaultParseWidth: "any"
|
|
514
514
|
}),
|
|
515
|
-
dayPeriod:
|
|
515
|
+
dayPeriod: W({
|
|
516
516
|
matchPatterns: Kt,
|
|
517
517
|
defaultMatchWidth: "any",
|
|
518
518
|
parsePatterns: Zt,
|
|
@@ -522,7 +522,7 @@ const Rt = /^(\d+)(th|st|nd|rd)?/i, Ut = /\d+/i, Bt = {
|
|
|
522
522
|
code: "en-US",
|
|
523
523
|
formatDistance: Mt,
|
|
524
524
|
formatLong: Pt,
|
|
525
|
-
formatRelative:
|
|
525
|
+
formatRelative: Nt,
|
|
526
526
|
localize: Ht,
|
|
527
527
|
match: te,
|
|
528
528
|
options: {
|
|
@@ -532,29 +532,29 @@ const Rt = /^(\d+)(th|st|nd|rd)?/i, Ut = /\d+/i, Bt = {
|
|
|
532
532
|
};
|
|
533
533
|
function ne(t, e) {
|
|
534
534
|
const n = D(t, e == null ? void 0 : e.in);
|
|
535
|
-
return yt(n,
|
|
535
|
+
return yt(n, St(n)) + 1;
|
|
536
536
|
}
|
|
537
537
|
function re(t, e) {
|
|
538
|
-
const n = D(t, e == null ? void 0 : e.in), r = +
|
|
539
|
-
return Math.round(r /
|
|
538
|
+
const n = D(t, e == null ? void 0 : e.in), r = +I(n) - +pt(n);
|
|
539
|
+
return Math.round(r / st) + 1;
|
|
540
540
|
}
|
|
541
|
-
function
|
|
542
|
-
var
|
|
543
|
-
const n = D(t, e == null ? void 0 : e.in), r = n.getFullYear(), a =
|
|
541
|
+
function ct(t, e) {
|
|
542
|
+
var f, g, p, w;
|
|
543
|
+
const n = D(t, e == null ? void 0 : e.in), r = n.getFullYear(), a = q(), s = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((g = (f = e == null ? void 0 : e.locale) == null ? void 0 : f.options) == null ? void 0 : g.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((w = (p = a.locale) == null ? void 0 : p.options) == null ? void 0 : w.firstWeekContainsDate) ?? 1, i = M((e == null ? void 0 : e.in) || t, 0);
|
|
544
544
|
i.setFullYear(r + 1, 0, s), i.setHours(0, 0, 0, 0);
|
|
545
|
-
const c =
|
|
545
|
+
const c = A(i, e), o = M((e == null ? void 0 : e.in) || t, 0);
|
|
546
546
|
o.setFullYear(r, 0, s), o.setHours(0, 0, 0, 0);
|
|
547
|
-
const
|
|
548
|
-
return +n >= +c ? r + 1 : +n >= +
|
|
547
|
+
const l = A(o, e);
|
|
548
|
+
return +n >= +c ? r + 1 : +n >= +l ? r : r - 1;
|
|
549
549
|
}
|
|
550
550
|
function ae(t, e) {
|
|
551
|
-
var c, o,
|
|
552
|
-
const n =
|
|
553
|
-
return s.setFullYear(a, 0, r), s.setHours(0, 0, 0, 0),
|
|
551
|
+
var c, o, l, f;
|
|
552
|
+
const n = q(), r = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((o = (c = e == null ? void 0 : e.locale) == null ? void 0 : c.options) == null ? void 0 : o.firstWeekContainsDate) ?? n.firstWeekContainsDate ?? ((f = (l = n.locale) == null ? void 0 : l.options) == null ? void 0 : f.firstWeekContainsDate) ?? 1, a = ct(t, e), s = M((e == null ? void 0 : e.in) || t, 0);
|
|
553
|
+
return s.setFullYear(a, 0, r), s.setHours(0, 0, 0, 0), A(s, e);
|
|
554
554
|
}
|
|
555
|
-
function
|
|
556
|
-
const n = D(t, e == null ? void 0 : e.in), r = +
|
|
557
|
-
return Math.round(r /
|
|
555
|
+
function lt(t, e) {
|
|
556
|
+
const n = D(t, e == null ? void 0 : e.in), r = +A(n, e) - +ae(n, e);
|
|
557
|
+
return Math.round(r / st) + 1;
|
|
558
558
|
}
|
|
559
559
|
function u(t, e) {
|
|
560
560
|
const n = t < 0 ? "-" : "", r = Math.abs(t).toString().padStart(e, "0");
|
|
@@ -621,7 +621,7 @@ const x = {
|
|
|
621
621
|
afternoon: "afternoon",
|
|
622
622
|
evening: "evening",
|
|
623
623
|
night: "night"
|
|
624
|
-
},
|
|
624
|
+
}, Z = {
|
|
625
625
|
// Era
|
|
626
626
|
G: function(t, e, n) {
|
|
627
627
|
const r = t.getFullYear() > 0 ? 1 : 0;
|
|
@@ -647,7 +647,7 @@ const x = {
|
|
|
647
647
|
},
|
|
648
648
|
// Local week-numbering year
|
|
649
649
|
Y: function(t, e, n, r) {
|
|
650
|
-
const a =
|
|
650
|
+
const a = ct(t, r), s = a > 0 ? a : 1 - a;
|
|
651
651
|
if (e === "YY") {
|
|
652
652
|
const i = s % 100;
|
|
653
653
|
return u(i, 2);
|
|
@@ -656,7 +656,7 @@ const x = {
|
|
|
656
656
|
},
|
|
657
657
|
// ISO week-numbering year
|
|
658
658
|
R: function(t, e) {
|
|
659
|
-
const n =
|
|
659
|
+
const n = it(t);
|
|
660
660
|
return u(n, e.length);
|
|
661
661
|
},
|
|
662
662
|
// Extended year. This is a single number designating the year of this calendar system.
|
|
@@ -779,7 +779,7 @@ const x = {
|
|
|
779
779
|
},
|
|
780
780
|
// Local week of year
|
|
781
781
|
w: function(t, e, n, r) {
|
|
782
|
-
const a =
|
|
782
|
+
const a = lt(t, r);
|
|
783
783
|
return e === "wo" ? n.ordinalNumber(a, { unit: "week" }) : u(a, e.length);
|
|
784
784
|
},
|
|
785
785
|
// ISO week of year
|
|
@@ -1047,14 +1047,14 @@ const x = {
|
|
|
1047
1047
|
return "Z";
|
|
1048
1048
|
switch (e) {
|
|
1049
1049
|
case "X":
|
|
1050
|
-
return
|
|
1050
|
+
return et(r);
|
|
1051
1051
|
case "XXXX":
|
|
1052
1052
|
case "XX":
|
|
1053
|
-
return
|
|
1053
|
+
return $(r);
|
|
1054
1054
|
case "XXXXX":
|
|
1055
1055
|
case "XXX":
|
|
1056
1056
|
default:
|
|
1057
|
-
return
|
|
1057
|
+
return $(r, ":");
|
|
1058
1058
|
}
|
|
1059
1059
|
},
|
|
1060
1060
|
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
@@ -1062,14 +1062,14 @@ const x = {
|
|
|
1062
1062
|
const r = t.getTimezoneOffset();
|
|
1063
1063
|
switch (e) {
|
|
1064
1064
|
case "x":
|
|
1065
|
-
return
|
|
1065
|
+
return et(r);
|
|
1066
1066
|
case "xxxx":
|
|
1067
1067
|
case "xx":
|
|
1068
|
-
return
|
|
1068
|
+
return $(r);
|
|
1069
1069
|
case "xxxxx":
|
|
1070
1070
|
case "xxx":
|
|
1071
1071
|
default:
|
|
1072
|
-
return
|
|
1072
|
+
return $(r, ":");
|
|
1073
1073
|
}
|
|
1074
1074
|
},
|
|
1075
1075
|
// Timezone (GMT)
|
|
@@ -1079,10 +1079,10 @@ const x = {
|
|
|
1079
1079
|
case "O":
|
|
1080
1080
|
case "OO":
|
|
1081
1081
|
case "OOO":
|
|
1082
|
-
return "GMT" +
|
|
1082
|
+
return "GMT" + tt(r, ":");
|
|
1083
1083
|
case "OOOO":
|
|
1084
1084
|
default:
|
|
1085
|
-
return "GMT" +
|
|
1085
|
+
return "GMT" + $(r, ":");
|
|
1086
1086
|
}
|
|
1087
1087
|
},
|
|
1088
1088
|
// Timezone (specific non-location)
|
|
@@ -1092,10 +1092,10 @@ const x = {
|
|
|
1092
1092
|
case "z":
|
|
1093
1093
|
case "zz":
|
|
1094
1094
|
case "zzz":
|
|
1095
|
-
return "GMT" +
|
|
1095
|
+
return "GMT" + tt(r, ":");
|
|
1096
1096
|
case "zzzz":
|
|
1097
1097
|
default:
|
|
1098
|
-
return "GMT" +
|
|
1098
|
+
return "GMT" + $(r, ":");
|
|
1099
1099
|
}
|
|
1100
1100
|
},
|
|
1101
1101
|
// Seconds timestamp
|
|
@@ -1108,18 +1108,18 @@ const x = {
|
|
|
1108
1108
|
return u(+t, e.length);
|
|
1109
1109
|
}
|
|
1110
1110
|
};
|
|
1111
|
-
function
|
|
1111
|
+
function tt(t, e = "") {
|
|
1112
1112
|
const n = t > 0 ? "-" : "+", r = Math.abs(t), a = Math.trunc(r / 60), s = r % 60;
|
|
1113
1113
|
return s === 0 ? n + String(a) : n + String(a) + e + u(s, 2);
|
|
1114
1114
|
}
|
|
1115
|
-
function
|
|
1116
|
-
return t % 60 === 0 ? (t > 0 ? "-" : "+") + u(Math.abs(t) / 60, 2) :
|
|
1115
|
+
function et(t, e) {
|
|
1116
|
+
return t % 60 === 0 ? (t > 0 ? "-" : "+") + u(Math.abs(t) / 60, 2) : $(t, e);
|
|
1117
1117
|
}
|
|
1118
|
-
function
|
|
1118
|
+
function $(t, e = "") {
|
|
1119
1119
|
const n = t > 0 ? "-" : "+", r = Math.abs(t), a = u(Math.trunc(r / 60), 2), s = u(r % 60, 2);
|
|
1120
1120
|
return n + a + e + s;
|
|
1121
1121
|
}
|
|
1122
|
-
const
|
|
1122
|
+
const nt = (t, e) => {
|
|
1123
1123
|
switch (t) {
|
|
1124
1124
|
case "P":
|
|
1125
1125
|
return e.date({ width: "short" });
|
|
@@ -1146,7 +1146,7 @@ const et = (t, e) => {
|
|
|
1146
1146
|
}, se = (t, e) => {
|
|
1147
1147
|
const n = t.match(/(P+)(p+)?/) || [], r = n[1], a = n[2];
|
|
1148
1148
|
if (!a)
|
|
1149
|
-
return
|
|
1149
|
+
return nt(t, e);
|
|
1150
1150
|
let s;
|
|
1151
1151
|
switch (r) {
|
|
1152
1152
|
case "P":
|
|
@@ -1163,12 +1163,12 @@ const et = (t, e) => {
|
|
|
1163
1163
|
s = e.dateTime({ width: "full" });
|
|
1164
1164
|
break;
|
|
1165
1165
|
}
|
|
1166
|
-
return s.replace("{{date}}",
|
|
1166
|
+
return s.replace("{{date}}", nt(r, e)).replace("{{time}}", ut(a, e));
|
|
1167
1167
|
}, ie = {
|
|
1168
1168
|
p: ut,
|
|
1169
1169
|
P: se
|
|
1170
|
-
}, oe = /^D+$/, ce = /^Y+$/,
|
|
1171
|
-
function
|
|
1170
|
+
}, oe = /^D+$/, ce = /^Y+$/, le = ["D", "DD", "YY", "YYYY"];
|
|
1171
|
+
function ue(t) {
|
|
1172
1172
|
return oe.test(t);
|
|
1173
1173
|
}
|
|
1174
1174
|
function he(t) {
|
|
@@ -1176,7 +1176,7 @@ function he(t) {
|
|
|
1176
1176
|
}
|
|
1177
1177
|
function de(t, e, n) {
|
|
1178
1178
|
const r = fe(t, e, n);
|
|
1179
|
-
if (console.warn(r),
|
|
1179
|
+
if (console.warn(r), le.includes(t)) throw new RangeError(r);
|
|
1180
1180
|
}
|
|
1181
1181
|
function fe(t, e, n) {
|
|
1182
1182
|
const r = t[0] === "Y" ? "years" : "days of the month";
|
|
@@ -1184,88 +1184,88 @@ function fe(t, e, n) {
|
|
|
1184
1184
|
}
|
|
1185
1185
|
const me = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, ge = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, ye = /^'([^]*?)'?$/, pe = /''/g, we = /[a-zA-Z]/;
|
|
1186
1186
|
function be(t, e, n) {
|
|
1187
|
-
var
|
|
1188
|
-
const r =
|
|
1187
|
+
var f, g, p, w;
|
|
1188
|
+
const r = q(), a = r.locale ?? ee, s = r.firstWeekContainsDate ?? ((g = (f = r.locale) == null ? void 0 : f.options) == null ? void 0 : g.firstWeekContainsDate) ?? 1, i = r.weekStartsOn ?? ((w = (p = r.locale) == null ? void 0 : p.options) == null ? void 0 : w.weekStartsOn) ?? 0, c = D(t, n == null ? void 0 : n.in);
|
|
1189
1189
|
if (!bt(c))
|
|
1190
1190
|
throw new RangeError("Invalid time value");
|
|
1191
|
-
let o = e.match(ge).map((
|
|
1192
|
-
const
|
|
1193
|
-
if (
|
|
1194
|
-
const
|
|
1195
|
-
return
|
|
1191
|
+
let o = e.match(ge).map((b) => {
|
|
1192
|
+
const k = b[0];
|
|
1193
|
+
if (k === "p" || k === "P") {
|
|
1194
|
+
const R = ie[k];
|
|
1195
|
+
return R(b, a.formatLong);
|
|
1196
1196
|
}
|
|
1197
|
-
return
|
|
1198
|
-
}).join("").match(me).map((
|
|
1199
|
-
if (
|
|
1197
|
+
return b;
|
|
1198
|
+
}).join("").match(me).map((b) => {
|
|
1199
|
+
if (b === "''")
|
|
1200
1200
|
return { isToken: !1, value: "'" };
|
|
1201
|
-
const
|
|
1202
|
-
if (
|
|
1203
|
-
return { isToken: !1, value:
|
|
1204
|
-
if (
|
|
1205
|
-
return { isToken: !0, value:
|
|
1206
|
-
if (
|
|
1201
|
+
const k = b[0];
|
|
1202
|
+
if (k === "'")
|
|
1203
|
+
return { isToken: !1, value: ke(b) };
|
|
1204
|
+
if (Z[k])
|
|
1205
|
+
return { isToken: !0, value: b };
|
|
1206
|
+
if (k.match(we))
|
|
1207
1207
|
throw new RangeError(
|
|
1208
|
-
"Format string contains an unescaped latin alphabet character `" +
|
|
1208
|
+
"Format string contains an unescaped latin alphabet character `" + k + "`"
|
|
1209
1209
|
);
|
|
1210
|
-
return { isToken: !1, value:
|
|
1210
|
+
return { isToken: !1, value: b };
|
|
1211
1211
|
});
|
|
1212
1212
|
a.localize.preprocessor && (o = a.localize.preprocessor(c, o));
|
|
1213
|
-
const
|
|
1213
|
+
const l = {
|
|
1214
1214
|
firstWeekContainsDate: s,
|
|
1215
1215
|
weekStartsOn: i,
|
|
1216
1216
|
locale: a
|
|
1217
1217
|
};
|
|
1218
|
-
return o.map((
|
|
1219
|
-
if (!
|
|
1220
|
-
const
|
|
1221
|
-
(he(
|
|
1222
|
-
const
|
|
1223
|
-
return
|
|
1218
|
+
return o.map((b) => {
|
|
1219
|
+
if (!b.isToken) return b.value;
|
|
1220
|
+
const k = b.value;
|
|
1221
|
+
(he(k) || ue(k)) && de(k, e, String(t));
|
|
1222
|
+
const R = Z[k[0]];
|
|
1223
|
+
return R(c, k, a.localize, l);
|
|
1224
1224
|
}).join("");
|
|
1225
1225
|
}
|
|
1226
|
-
function
|
|
1226
|
+
function ke(t) {
|
|
1227
1227
|
const e = t.match(ye);
|
|
1228
1228
|
return e ? e[1].replace(pe, "'") : t;
|
|
1229
1229
|
}
|
|
1230
|
-
function
|
|
1230
|
+
function De(t, e) {
|
|
1231
1231
|
const n = D(t, e == null ? void 0 : e.in).getDay();
|
|
1232
1232
|
return n === 0 ? 7 : n;
|
|
1233
1233
|
}
|
|
1234
|
-
const j = {},
|
|
1235
|
-
function
|
|
1234
|
+
const j = {}, Y = {};
|
|
1235
|
+
function F(t, e) {
|
|
1236
1236
|
try {
|
|
1237
1237
|
const r = (j[t] || (j[t] = new Intl.DateTimeFormat("en-GB", {
|
|
1238
1238
|
timeZone: t,
|
|
1239
1239
|
hour: "numeric",
|
|
1240
1240
|
timeZoneName: "longOffset"
|
|
1241
1241
|
}).format))(e).split("GMT")[1] || "";
|
|
1242
|
-
return r in
|
|
1242
|
+
return r in Y ? Y[r] : rt(r, r.split(":"));
|
|
1243
1243
|
} catch {
|
|
1244
|
-
if (t in
|
|
1245
|
-
const n = t == null ? void 0 : t.match(
|
|
1246
|
-
return n ?
|
|
1244
|
+
if (t in Y) return Y[t];
|
|
1245
|
+
const n = t == null ? void 0 : t.match(Se);
|
|
1246
|
+
return n ? rt(t, n.slice(1)) : NaN;
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
|
-
const
|
|
1250
|
-
function
|
|
1249
|
+
const Se = /([+-]\d\d):?(\d\d)?/;
|
|
1250
|
+
function rt(t, e) {
|
|
1251
1251
|
const n = +e[0], r = +(e[1] || 0);
|
|
1252
|
-
return
|
|
1252
|
+
return Y[t] = n > 0 ? n * 60 + r : n * 60 - r;
|
|
1253
1253
|
}
|
|
1254
|
-
class
|
|
1254
|
+
class v extends Date {
|
|
1255
1255
|
//#region static
|
|
1256
1256
|
constructor(...e) {
|
|
1257
|
-
super(), e.length > 1 && typeof e[e.length - 1] == "string" && (this.timeZone = e.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(
|
|
1257
|
+
super(), e.length > 1 && typeof e[e.length - 1] == "string" && (this.timeZone = e.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(F(this.timeZone, this)) ? this.setTime(NaN) : e.length ? typeof e[0] == "number" && (e.length === 1 || e.length === 2 && typeof e[1] != "number") ? this.setTime(e[0]) : typeof e[0] == "string" ? this.setTime(+new Date(e[0])) : e[0] instanceof Date ? this.setTime(+e[0]) : (this.setTime(+new Date(...e)), ht(this), X(this)) : this.setTime(Date.now());
|
|
1258
1258
|
}
|
|
1259
1259
|
static tz(e, ...n) {
|
|
1260
|
-
return n.length ? new
|
|
1260
|
+
return n.length ? new v(...n, e) : new v(Date.now(), e);
|
|
1261
1261
|
}
|
|
1262
1262
|
//#endregion
|
|
1263
1263
|
//#region time zone
|
|
1264
1264
|
withTimeZone(e) {
|
|
1265
|
-
return new
|
|
1265
|
+
return new v(+this, e);
|
|
1266
1266
|
}
|
|
1267
1267
|
getTimezoneOffset() {
|
|
1268
|
-
return -
|
|
1268
|
+
return -F(this.timeZone, this);
|
|
1269
1269
|
}
|
|
1270
1270
|
//#endregion
|
|
1271
1271
|
//#region time
|
|
@@ -1275,46 +1275,46 @@ class S extends Date {
|
|
|
1275
1275
|
//#endregion
|
|
1276
1276
|
//#region date-fns integration
|
|
1277
1277
|
[Symbol.for("constructDateFrom")](e) {
|
|
1278
|
-
return new
|
|
1278
|
+
return new v(+new Date(e), this.timeZone);
|
|
1279
1279
|
}
|
|
1280
1280
|
//#endregion
|
|
1281
1281
|
}
|
|
1282
|
-
const
|
|
1282
|
+
const at = /^(get|set)(?!UTC)/;
|
|
1283
1283
|
Object.getOwnPropertyNames(Date.prototype).forEach((t) => {
|
|
1284
|
-
if (!
|
|
1285
|
-
const e = t.replace(
|
|
1286
|
-
|
|
1284
|
+
if (!at.test(t)) return;
|
|
1285
|
+
const e = t.replace(at, "$1UTC");
|
|
1286
|
+
v.prototype[e] && (t.startsWith("get") ? v.prototype[t] = function() {
|
|
1287
1287
|
return this.internal[e]();
|
|
1288
|
-
} : (
|
|
1289
|
-
return Date.prototype[e].apply(this.internal, arguments),
|
|
1290
|
-
},
|
|
1288
|
+
} : (v.prototype[t] = function() {
|
|
1289
|
+
return Date.prototype[e].apply(this.internal, arguments), ve(this), +this;
|
|
1290
|
+
}, v.prototype[e] = function() {
|
|
1291
1291
|
return Date.prototype[e].apply(this, arguments), X(this), +this;
|
|
1292
1292
|
}));
|
|
1293
1293
|
});
|
|
1294
1294
|
function X(t) {
|
|
1295
1295
|
t.internal.setTime(+t), t.internal.setUTCMinutes(t.internal.getUTCMinutes() - t.getTimezoneOffset());
|
|
1296
1296
|
}
|
|
1297
|
-
function
|
|
1298
|
-
Date.prototype.setFullYear.call(t, t.internal.getUTCFullYear(), t.internal.getUTCMonth(), t.internal.getUTCDate()), Date.prototype.setHours.call(t, t.internal.getUTCHours(), t.internal.getUTCMinutes(), t.internal.getUTCSeconds(), t.internal.getUTCMilliseconds()),
|
|
1297
|
+
function ve(t) {
|
|
1298
|
+
Date.prototype.setFullYear.call(t, t.internal.getUTCFullYear(), t.internal.getUTCMonth(), t.internal.getUTCDate()), Date.prototype.setHours.call(t, t.internal.getUTCHours(), t.internal.getUTCMinutes(), t.internal.getUTCSeconds(), t.internal.getUTCMilliseconds()), ht(t);
|
|
1299
1299
|
}
|
|
1300
|
-
function
|
|
1301
|
-
const e =
|
|
1300
|
+
function ht(t) {
|
|
1301
|
+
const e = F(t.timeZone, t), n = /* @__PURE__ */ new Date(+t);
|
|
1302
1302
|
n.setUTCHours(n.getUTCHours() - 1);
|
|
1303
1303
|
const r = -(/* @__PURE__ */ new Date(+t)).getTimezoneOffset(), a = -(/* @__PURE__ */ new Date(+n)).getTimezoneOffset(), s = r - a, i = Date.prototype.getHours.apply(t) !== t.internal.getUTCHours();
|
|
1304
1304
|
s && i && t.internal.setUTCMinutes(t.internal.getUTCMinutes() + s);
|
|
1305
1305
|
const c = r - e;
|
|
1306
1306
|
c && Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + c);
|
|
1307
|
-
const o =
|
|
1308
|
-
if (
|
|
1309
|
-
Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) +
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1307
|
+
const o = F(t.timeZone, t), f = -(/* @__PURE__ */ new Date(+t)).getTimezoneOffset() - o, g = o !== e, p = f - c;
|
|
1308
|
+
if (g && p) {
|
|
1309
|
+
Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + p);
|
|
1310
|
+
const w = F(t.timeZone, t), b = o - w;
|
|
1311
|
+
b && (t.internal.setUTCMinutes(t.internal.getUTCMinutes() + b), Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + b));
|
|
1312
1312
|
}
|
|
1313
1313
|
}
|
|
1314
|
-
class
|
|
1314
|
+
class _ extends v {
|
|
1315
1315
|
//#region static
|
|
1316
1316
|
static tz(e, ...n) {
|
|
1317
|
-
return n.length ? new
|
|
1317
|
+
return n.length ? new _(...n, e) : new _(Date.now(), e);
|
|
1318
1318
|
}
|
|
1319
1319
|
//#endregion
|
|
1320
1320
|
//#region representation
|
|
@@ -1359,11 +1359,11 @@ class E extends S {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
//#endregion
|
|
1361
1361
|
withTimeZone(e) {
|
|
1362
|
-
return new
|
|
1362
|
+
return new _(+this, e);
|
|
1363
1363
|
}
|
|
1364
1364
|
//#region date-fns integration
|
|
1365
1365
|
[Symbol.for("constructDateFrom")](e) {
|
|
1366
|
-
return new
|
|
1366
|
+
return new _(+new Date(e), this.timeZone);
|
|
1367
1367
|
}
|
|
1368
1368
|
//#endregion
|
|
1369
1369
|
}
|
|
@@ -1375,10 +1375,10 @@ function Me(t, e) {
|
|
|
1375
1375
|
}
|
|
1376
1376
|
window.pktTz = window.pktTz === void 0 ? "Europe/Oslo" : window.pktTz;
|
|
1377
1377
|
const Te = (t = window.pktTz) => {
|
|
1378
|
-
const e = new
|
|
1378
|
+
const e = new _((/* @__PURE__ */ new Date()).toISOString(), t);
|
|
1379
1379
|
return e.setHours(0, 0, 0, 0), isNaN(e.getTime()) ? /* @__PURE__ */ new Date() : new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
1380
1380
|
};
|
|
1381
|
-
function
|
|
1381
|
+
function N(t) {
|
|
1382
1382
|
if (!t || t === "") return /* @__PURE__ */ new Date();
|
|
1383
1383
|
if (/^\d{4}-\d{2}-\d{2}$/.test(t)) {
|
|
1384
1384
|
const [e, n, r] = t.split("-").map(Number);
|
|
@@ -1390,21 +1390,21 @@ function $(t) {
|
|
|
1390
1390
|
}
|
|
1391
1391
|
return /^\d{4}$/.test(t) ? new Date(Number(t), 0, 1) : new Date(t);
|
|
1392
1392
|
}
|
|
1393
|
-
const
|
|
1393
|
+
const y = (t) => {
|
|
1394
1394
|
if (!t || isNaN(t.getTime())) return "";
|
|
1395
1395
|
const e = t.getFullYear(), n = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0");
|
|
1396
1396
|
return `${e}-${n}-${r}`;
|
|
1397
|
-
},
|
|
1397
|
+
}, Ae = (t) => {
|
|
1398
1398
|
if (!t)
|
|
1399
1399
|
return null;
|
|
1400
|
-
const e =
|
|
1400
|
+
const e = N(t);
|
|
1401
1401
|
return isNaN(e.getTime()) ? null : e;
|
|
1402
1402
|
}, He = (t, e) => {
|
|
1403
|
-
const n =
|
|
1403
|
+
const n = T(t);
|
|
1404
1404
|
return isNaN(n.getTime()) ? "" : be(n, e);
|
|
1405
|
-
},
|
|
1406
|
-
const n = typeof t == "string" ?
|
|
1407
|
-
return !n || isNaN(n.getTime()) ? /* @__PURE__ */ new Date() : e ? e === "end" ?
|
|
1405
|
+
}, T = (t = "", e) => {
|
|
1406
|
+
const n = typeof t == "string" ? N(t) : t;
|
|
1407
|
+
return !n || isNaN(n.getTime()) ? /* @__PURE__ */ new Date() : e ? e === "end" ? kt(n) : G(n) : n;
|
|
1408
1408
|
}, O = (t, e, n = 1) => {
|
|
1409
1409
|
if (typeof t != "number" || typeof e != "number" || typeof n != "number" || isNaN(t) || isNaN(e) || isNaN(n))
|
|
1410
1410
|
return /* @__PURE__ */ new Date();
|
|
@@ -1413,16 +1413,16 @@ const w = (t) => {
|
|
|
1413
1413
|
}, xe = (t) => !t || isNaN(t.getTime()) ? "" : new Intl.DateTimeFormat("no", { dateStyle: "full", timeZone: window.pktTz }).format(t), Oe = (t) => {
|
|
1414
1414
|
if (Array.isArray(t)) return t;
|
|
1415
1415
|
if (typeof t == "string") return t.split(",");
|
|
1416
|
-
}, Pe = (t) => t ?
|
|
1416
|
+
}, Pe = (t) => t ? N(t) : null, $e = (t) => {
|
|
1417
1417
|
if (typeof t == "string")
|
|
1418
|
-
return t.split(",").map((e) =>
|
|
1418
|
+
return t.split(",").map((e) => N(e));
|
|
1419
1419
|
if (Array.isArray(t))
|
|
1420
|
-
return t.map((e) =>
|
|
1421
|
-
},
|
|
1420
|
+
return t.map((e) => N(e));
|
|
1421
|
+
}, L = {
|
|
1422
1422
|
csvToArray: Oe,
|
|
1423
1423
|
stringToDate: Pe,
|
|
1424
|
-
stringsToDate:
|
|
1425
|
-
},
|
|
1424
|
+
stringsToDate: $e
|
|
1425
|
+
}, Ne = {
|
|
1426
1426
|
earliest: {
|
|
1427
1427
|
default: null
|
|
1428
1428
|
},
|
|
@@ -1445,14 +1445,14 @@ const w = (t) => {
|
|
|
1445
1445
|
default: !1
|
|
1446
1446
|
}
|
|
1447
1447
|
}, P = {
|
|
1448
|
-
props:
|
|
1448
|
+
props: Ne
|
|
1449
1449
|
};
|
|
1450
|
-
var Ce = Object.defineProperty,
|
|
1451
|
-
for (var a = r > 1 ? void 0 : r ?
|
|
1450
|
+
var Ce = Object.defineProperty, _e = Object.getOwnPropertyDescriptor, d = (t, e, n, r) => {
|
|
1451
|
+
for (var a = r > 1 ? void 0 : r ? _e(e, n) : e, s = t.length - 1, i; s >= 0; s--)
|
|
1452
1452
|
(i = t[s]) && (a = (r ? i(e, n, a) : i(a)) || a);
|
|
1453
1453
|
return r && a && Ce(e, n, a), a;
|
|
1454
1454
|
};
|
|
1455
|
-
let
|
|
1455
|
+
let h = class extends dt {
|
|
1456
1456
|
constructor() {
|
|
1457
1457
|
super(...arguments), this.multiple = P.props.multiple.default, this.maxMultiple = P.props.maxMultiple.default, this.range = P.props.range.default, this.weeknumbers = P.props.weeknumbers.default, this.withcontrols = P.props.withcontrols.default, this.selected = [], this.earliest = P.props.earliest.default, this.latest = P.props.latest.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.dayStrings = this.strings.dates.daysShort, this.dayStringsLong = this.strings.dates.days, this.monthStrings = this.strings.dates.months, this.weekString = this.strings.dates.week, this.prevMonthString = this.strings.dates.prevMonth, this.nextMonthString = this.strings.dates.nextMonth, this._selected = [], this.year = 0, this.month = 0, this.week = 0, this.rangeHovered = null, this.inRange = {}, this.focusedDate = null, this.selectableDates = [], this.currentmonthtouched = !1, this.tabIndexSet = 0;
|
|
1458
1458
|
}
|
|
@@ -1475,27 +1475,25 @@ let l = class extends dt {
|
|
|
1475
1475
|
this.addEventListener("keydown", this.handleKeydown);
|
|
1476
1476
|
}
|
|
1477
1477
|
convertSelected() {
|
|
1478
|
-
if (typeof this.selected == "string" && (this.selected = this.selected.split(",")), this.selected.length === 1 && this.selected[0] === "" && (this.selected = []), this._selected = this.selected.map((t) =>
|
|
1478
|
+
if (typeof this.selected == "string" && (this.selected = this.selected.split(",")), this.selected.length === 1 && this.selected[0] === "" && (this.selected = []), this._selected = this.selected.map((t) => N(t)), this.range && this.selected.length === 2) {
|
|
1479
1479
|
const t = z({
|
|
1480
1480
|
start: this._selected[0],
|
|
1481
1481
|
end: this._selected[1]
|
|
1482
1482
|
});
|
|
1483
1483
|
if (this.inRange = {}, Array.isArray(t) && t.length) {
|
|
1484
1484
|
const e = {};
|
|
1485
|
-
for (let n = 0; n < t.length; n++)
|
|
1486
|
-
|
|
1485
|
+
for (let n = 0; n < t.length; n++) {
|
|
1486
|
+
const r = t[n], a = r > this._selected[0] && r < this._selected[1];
|
|
1487
|
+
e[y(r)] = a;
|
|
1488
|
+
}
|
|
1487
1489
|
this.inRange = e;
|
|
1488
1490
|
}
|
|
1489
1491
|
}
|
|
1490
1492
|
this.setCurrentMonth();
|
|
1491
1493
|
}
|
|
1492
1494
|
setCurrentMonth() {
|
|
1493
|
-
if (this.currentmonth === null && !this.currentmonthtouched) {
|
|
1494
|
-
this.
|
|
1495
|
-
return;
|
|
1496
|
-
}
|
|
1497
|
-
if (this.selected.length && this.selected[0] !== "") {
|
|
1498
|
-
const t = $(this.selected[this.selected.length - 1]);
|
|
1495
|
+
if (this.currentmonth === null && !this.currentmonthtouched && (this.currentmonthtouched = !0), this.selected.length && this.selected[0] !== "") {
|
|
1496
|
+
const t = N(this.selected[this.selected.length - 1]);
|
|
1499
1497
|
this.currentmonth = isNaN(t.getTime()) ? /* @__PURE__ */ new Date() : t;
|
|
1500
1498
|
} else this.currentmonth === null && (this.currentmonth = /* @__PURE__ */ new Date());
|
|
1501
1499
|
(!this.currentmonth || isNaN(this.currentmonth.getTime())) && (this.currentmonth = /* @__PURE__ */ new Date()), this.year = this.currentmonth.getFullYear(), this.month = this.currentmonth.getMonth();
|
|
@@ -1517,22 +1515,23 @@ let l = class extends dt {
|
|
|
1517
1515
|
}
|
|
1518
1516
|
}
|
|
1519
1517
|
handleArrowKey(t, e) {
|
|
1520
|
-
var a, s, i;
|
|
1521
|
-
if (((a = t.target) == null ? void 0 : a.nodeName) === "INPUT" || ((s = t.target) == null ? void 0 : s.nodeName) === "SELECT" || ((i = t.target) == null ? void 0 : i.nodeName) === "BUTTON")
|
|
1518
|
+
var a, s, i, c, o;
|
|
1519
|
+
if (((a = t.target) == null ? void 0 : a.nodeName) === "INPUT" || ((s = t.target) == null ? void 0 : s.nodeName) === "SELECT" || ((i = t.target) == null ? void 0 : i.nodeName) === "BUTTON" && !((o = (c = t.target) == null ? void 0 : c.dataset) != null && o.date))
|
|
1520
|
+
return;
|
|
1522
1521
|
t.preventDefault(), this.focusedDate || this.focusOnCurrentDate();
|
|
1523
|
-
const n = this.focusedDate ?
|
|
1522
|
+
const n = this.focusedDate ? T(this.focusedDate) : O(this.year, this.month, 1);
|
|
1524
1523
|
let r = B(n, e);
|
|
1525
1524
|
if (r) {
|
|
1526
|
-
let
|
|
1527
|
-
if (
|
|
1528
|
-
if (
|
|
1525
|
+
let l = this.querySelector(`button[data-date="${y(r)}"]`);
|
|
1526
|
+
if (l instanceof HTMLButtonElement) {
|
|
1527
|
+
if (l.dataset.disabled) {
|
|
1529
1528
|
r = B(r, e);
|
|
1530
|
-
let
|
|
1531
|
-
for (;
|
|
1532
|
-
r = B(r, e),
|
|
1533
|
-
|
|
1529
|
+
let f = this.querySelector(`button[data-date="${y(r)}"]`);
|
|
1530
|
+
for (; f && f instanceof HTMLButtonElement && f.dataset.disabled; )
|
|
1531
|
+
r = B(r, e), f = this.querySelector(`button[data-date="${y(r)}"]`);
|
|
1532
|
+
l = f;
|
|
1534
1533
|
}
|
|
1535
|
-
|
|
1534
|
+
l instanceof HTMLButtonElement && !l.dataset.disabled && (this.focusedDate = y(r), l.focus());
|
|
1536
1535
|
}
|
|
1537
1536
|
}
|
|
1538
1537
|
}
|
|
@@ -1540,9 +1539,9 @@ let l = class extends dt {
|
|
|
1540
1539
|
* Component functionality and render
|
|
1541
1540
|
*/
|
|
1542
1541
|
render() {
|
|
1543
|
-
return
|
|
1542
|
+
return S`
|
|
1544
1543
|
<div
|
|
1545
|
-
class="pkt-calendar ${this.weeknumbers ? "pkt-cal-weeknumbers" :
|
|
1544
|
+
class="pkt-calendar ${this.weeknumbers ? "pkt-cal-weeknumbers" : ""}"
|
|
1546
1545
|
@focusout=${this.closeEvent}
|
|
1547
1546
|
@keydown=${(t) => {
|
|
1548
1547
|
t.key === "Escape" && (t.preventDefault(), this.close());
|
|
@@ -1552,12 +1551,13 @@ let l = class extends dt {
|
|
|
1552
1551
|
<div>
|
|
1553
1552
|
<button
|
|
1554
1553
|
type="button"
|
|
1555
|
-
|
|
1554
|
+
aria-label="${this.prevMonthString}"
|
|
1555
|
+
@click=${() => this.isPrevMonthAllowed() && this.prevMonth()}
|
|
1556
1556
|
@keydown=${(t) => {
|
|
1557
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.
|
|
1557
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.isPrevMonthAllowed() && this.prevMonth());
|
|
1558
1558
|
}}
|
|
1559
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${this.isPrevMonthAllowed() ? "" : "pkt-hide"}"
|
|
1560
|
-
.data-disabled=${this.isPrevMonthAllowed() ?
|
|
1559
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only pkt-calendar__prev-month ${this.isPrevMonthAllowed() ? "" : "pkt-hide"}"
|
|
1560
|
+
.data-disabled=${this.isPrevMonthAllowed() ? U : "disabled"}
|
|
1561
1561
|
?aria-disabled=${!this.isPrevMonthAllowed()}
|
|
1562
1562
|
tabindex=${this.isPrevMonthAllowed() ? "0" : "-1"}
|
|
1563
1563
|
>
|
|
@@ -1569,12 +1569,13 @@ let l = class extends dt {
|
|
|
1569
1569
|
<div>
|
|
1570
1570
|
<button
|
|
1571
1571
|
type="button"
|
|
1572
|
-
|
|
1572
|
+
aria-label="${this.nextMonthString}"
|
|
1573
|
+
@click=${() => this.isNextMonthAllowed() && this.nextMonth()}
|
|
1573
1574
|
@keydown=${(t) => {
|
|
1574
1575
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.isNextMonthAllowed() && this.nextMonth());
|
|
1575
1576
|
}}
|
|
1576
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${this.isNextMonthAllowed() ? "" : "pkt-hide"}"
|
|
1577
|
-
.data-disabled=${this.isNextMonthAllowed() ?
|
|
1577
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only pkt-calendar__next-month ${this.isNextMonthAllowed() ? "" : "pkt-hide"}"
|
|
1578
|
+
.data-disabled=${this.isNextMonthAllowed() ? U : "disabled"}
|
|
1578
1579
|
?aria-disabled=${!this.isNextMonthAllowed()}
|
|
1579
1580
|
tabindex=${this.isNextMonthAllowed() ? "0" : "-1"}
|
|
1580
1581
|
>
|
|
@@ -1584,7 +1585,7 @@ let l = class extends dt {
|
|
|
1584
1585
|
</div>
|
|
1585
1586
|
</nav>
|
|
1586
1587
|
<table
|
|
1587
|
-
class="pkt-cal-days pkt-txt-12-medium"
|
|
1588
|
+
class="pkt-cal-days pkt-txt-12-medium pkt-calendar__body"
|
|
1588
1589
|
role="grid"
|
|
1589
1590
|
?aria-multiselectable=${this.range || this.multiple}
|
|
1590
1591
|
>
|
|
@@ -1600,19 +1601,23 @@ let l = class extends dt {
|
|
|
1600
1601
|
}
|
|
1601
1602
|
renderDayNames() {
|
|
1602
1603
|
const t = [];
|
|
1603
|
-
this.weeknumbers && t.push(
|
|
1604
|
+
this.weeknumbers && t.push(S`<th><div class="pkt-calendar__week-number">${this.weekString}</div></th>`);
|
|
1604
1605
|
for (let e = 0; e < this.dayStrings.length; e++)
|
|
1605
1606
|
t.push(
|
|
1606
|
-
|
|
1607
|
+
S`<th>
|
|
1608
|
+
<div class="pkt-calendar__day-name" aria-label="${this.dayStringsLong[e]}">
|
|
1609
|
+
${this.dayStrings[e]}
|
|
1610
|
+
</div>
|
|
1611
|
+
</th>`
|
|
1607
1612
|
);
|
|
1608
|
-
return
|
|
1613
|
+
return S`<tr class="pkt-cal-week-row">
|
|
1609
1614
|
${t}
|
|
1610
1615
|
</tr>`;
|
|
1611
1616
|
}
|
|
1612
1617
|
renderMonthNav() {
|
|
1613
1618
|
let t = [];
|
|
1614
1619
|
return this.withcontrols ? t.push(
|
|
1615
|
-
|
|
1620
|
+
S`<div class="pkt-cal-month-picker">
|
|
1616
1621
|
<label for="${this.id}-monthnav" class="pkt-hide">${this.strings.dates.month}</label>
|
|
1617
1622
|
<select
|
|
1618
1623
|
aria-label="${this.strings.dates.month}"
|
|
@@ -1623,7 +1628,7 @@ let l = class extends dt {
|
|
|
1623
1628
|
}}
|
|
1624
1629
|
>
|
|
1625
1630
|
${this.monthStrings.map(
|
|
1626
|
-
(e, n) =>
|
|
1631
|
+
(e, n) => S`<option value=${n} ?selected=${this.month === n}>${e}</option>`
|
|
1627
1632
|
)}
|
|
1628
1633
|
</select>
|
|
1629
1634
|
<label for="${this.id}-yearnav" class="pkt-hide">${this.strings.dates.year}</label>
|
|
@@ -1641,71 +1646,83 @@ let l = class extends dt {
|
|
|
1641
1646
|
/>
|
|
1642
1647
|
</div> `
|
|
1643
1648
|
) : t.push(
|
|
1644
|
-
|
|
1649
|
+
S`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
|
|
1645
1650
|
${this.monthStrings[this.month]} ${this.year}
|
|
1646
1651
|
</div>`
|
|
1647
1652
|
), t;
|
|
1648
1653
|
}
|
|
1649
1654
|
renderDayView(t, e, n) {
|
|
1650
|
-
var
|
|
1651
|
-
const r = O(this.year, this.month, t), a =
|
|
1652
|
-
|
|
1653
|
-
const
|
|
1655
|
+
var p;
|
|
1656
|
+
const r = O(this.year, this.month, t), a = y(r), s = a === y(e), i = this.selected.includes(a), c = xe(r), o = this.isExcluded(n, r) || !i && this.multiple && this.maxMultiple > 0 && this.selected.length >= this.maxMultiple, l = this.focusedDate ? this.focusedDate === a && !o ? "0" : "-1" : !o && this.tabIndexSet === 0 || this.tabIndexSet === t ? "0" : "-1";
|
|
1657
|
+
l === "0" && (this.tabIndexSet = t), this.selectableDates.push({ currentDateISO: a, isDisabled: o, tabindex: l });
|
|
1658
|
+
const f = {
|
|
1654
1659
|
"pkt-cal-today": s,
|
|
1655
1660
|
"pkt-cal-selected": i,
|
|
1656
1661
|
"pkt-cal-in-range": this.inRange[a],
|
|
1657
1662
|
"pkt-cal-excluded": this.isExcluded(n, r),
|
|
1658
1663
|
"pkt-cal-in-range-first": this.range && (this.selected.length === 2 || this.rangeHovered !== null) && a === this.selected[0],
|
|
1659
1664
|
"pkt-cal-in-range-last": this.range && this.selected.length === 2 && a === this.selected[1],
|
|
1660
|
-
"pkt-cal-range-hover": this.rangeHovered !== null && a ===
|
|
1665
|
+
"pkt-cal-range-hover": this.rangeHovered !== null && a === y(this.rangeHovered)
|
|
1666
|
+
}, g = {
|
|
1667
|
+
"pkt-calendar__date": !0,
|
|
1668
|
+
"pkt-calendar__date--today": s,
|
|
1669
|
+
"pkt-calendar__date--selected": i,
|
|
1670
|
+
"pkt-calendar__date--disabled": o,
|
|
1671
|
+
"pkt-calendar__date--in-range": this.inRange[a],
|
|
1672
|
+
"pkt-calendar__date--in-range-hover": this.rangeHovered !== null && a === y(this.rangeHovered),
|
|
1673
|
+
"pkt-calendar__date--range-start": this.range && (this.selected.length === 2 || this.rangeHovered !== null) && a === this.selected[0],
|
|
1674
|
+
"pkt-calendar__date--range-end": this.range && this.selected.length === 2 && a === this.selected[1]
|
|
1661
1675
|
};
|
|
1662
|
-
return
|
|
1663
|
-
<
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1676
|
+
return S`<td class=${V(f)}>
|
|
1677
|
+
<button
|
|
1678
|
+
type="button"
|
|
1679
|
+
aria-pressed=${i ? "true" : "false"}
|
|
1680
|
+
?disabled=${o}
|
|
1681
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${V(
|
|
1682
|
+
g
|
|
1683
|
+
)}"
|
|
1667
1684
|
@mouseover=${() => this.range && !this.isExcluded(n, r) && this.handleRangeHover(r)}
|
|
1668
1685
|
@focus=${() => {
|
|
1669
1686
|
this.range && !this.isExcluded(n, r) && this.handleRangeHover(r), this.focusedDate = a;
|
|
1670
1687
|
}}
|
|
1671
1688
|
aria-label="${c}"
|
|
1672
|
-
tabindex=${(
|
|
1673
|
-
data-disabled=${o ? "disabled" :
|
|
1689
|
+
tabindex=${(p = this.selectableDates.find((w) => w.currentDateISO === a)) == null ? void 0 : p.tabindex}
|
|
1690
|
+
data-disabled=${o ? "disabled" : U}
|
|
1674
1691
|
data-date=${a}
|
|
1675
|
-
@keydown=${(
|
|
1676
|
-
(
|
|
1692
|
+
@keydown=${(w) => {
|
|
1693
|
+
(w.key === "Enter" || w.key === " ") && (w.preventDefault(), this.handleDateSelect(r));
|
|
1677
1694
|
}}
|
|
1678
|
-
@click=${(
|
|
1679
|
-
o || (
|
|
1695
|
+
@click=${(w) => {
|
|
1696
|
+
o || (w.preventDefault(), this.handleDateSelect(r));
|
|
1680
1697
|
}}
|
|
1681
1698
|
>
|
|
1682
1699
|
<span class="pkt-btn__text pkt-txt-14-light">${t}</span>
|
|
1683
|
-
</
|
|
1700
|
+
</button>
|
|
1684
1701
|
</td>`;
|
|
1685
1702
|
}
|
|
1686
1703
|
renderCalendarBody() {
|
|
1687
1704
|
const t = Te(), e = O(this.year, this.month, 1), n = O(this.year, this.month + 1, 0), r = (e.getDay() + 6) % 7, a = n.getDate(), s = Math.ceil((a + r) / 7), c = O(this.year, this.month, 0).getDate();
|
|
1688
1705
|
let o = 1;
|
|
1689
|
-
this.week =
|
|
1690
|
-
const
|
|
1691
|
-
for (let
|
|
1692
|
-
const
|
|
1693
|
-
this.weeknumbers &&
|
|
1694
|
-
for (let
|
|
1695
|
-
if (
|
|
1696
|
-
const
|
|
1697
|
-
|
|
1698
|
-
|
|
1706
|
+
this.week = lt(O(this.year, this.month, 1));
|
|
1707
|
+
const l = [];
|
|
1708
|
+
for (let f = 0; f < s; f++) {
|
|
1709
|
+
const g = [];
|
|
1710
|
+
this.weeknumbers && g.push(S`<td class="pkt-cal-week">${this.week}</td>`), this.week++;
|
|
1711
|
+
for (let p = 1; p < 8; p++)
|
|
1712
|
+
if (f === 0 && p < r + 1) {
|
|
1713
|
+
const w = c - (r - p);
|
|
1714
|
+
g.push(
|
|
1715
|
+
S`<td class="pkt-cal-other">
|
|
1699
1716
|
<div
|
|
1700
1717
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
1701
1718
|
data-disabled="disabled"
|
|
1702
1719
|
>
|
|
1703
|
-
<span class="pkt-btn__text pkt-txt-14-light">${
|
|
1720
|
+
<span class="pkt-btn__text pkt-txt-14-light">${w}</span>
|
|
1704
1721
|
</div>
|
|
1705
1722
|
</td>`
|
|
1706
1723
|
);
|
|
1707
|
-
} else o > a ? (
|
|
1708
|
-
|
|
1724
|
+
} else o > a ? (g.push(
|
|
1725
|
+
S`<td class="pkt-cal-other">
|
|
1709
1726
|
<div
|
|
1710
1727
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
1711
1728
|
data-disabled="disabled"
|
|
@@ -1713,21 +1730,21 @@ let l = class extends dt {
|
|
|
1713
1730
|
<span class="pkt-btn__text pkt-txt-14-light">${o - a}</span>
|
|
1714
1731
|
</div>
|
|
1715
1732
|
</td>`
|
|
1716
|
-
), o++) : (
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
${
|
|
1733
|
+
), o++) : (g.push(this.renderDayView(o, t, p)), o++);
|
|
1734
|
+
l.push(
|
|
1735
|
+
S`<tr class="pkt-cal-week-row" role="row">
|
|
1736
|
+
${g}
|
|
1720
1737
|
</tr>`
|
|
1721
1738
|
);
|
|
1722
1739
|
}
|
|
1723
|
-
return
|
|
1740
|
+
return l;
|
|
1724
1741
|
}
|
|
1725
1742
|
isExcluded(t, e) {
|
|
1726
|
-
return this.excludeweekdays.includes(t.toString()) || this.earliest &&
|
|
1743
|
+
return this.excludeweekdays.includes(t.toString()) || this.earliest && T(e, "end") < T(this.earliest, "start") || this.latest && T(e, "start") > T(this.latest, "end") ? !0 : this.excludedates.some((n) => typeof n == "string" ? n === y(e) : n.toDateString() === e.toDateString());
|
|
1727
1744
|
}
|
|
1728
1745
|
isPrevMonthAllowed() {
|
|
1729
1746
|
const t = O(this.year, this.month, 0);
|
|
1730
|
-
return !(this.earliest &&
|
|
1747
|
+
return !(this.earliest && T(this.earliest) > t);
|
|
1731
1748
|
}
|
|
1732
1749
|
prevMonth() {
|
|
1733
1750
|
const t = this.month === 0 ? 11 : this.month - 1, e = this.month === 0 ? this.year - 1 : this.year;
|
|
@@ -1739,21 +1756,14 @@ let l = class extends dt {
|
|
|
1739
1756
|
this.month === 11 ? 0 : this.month + 1,
|
|
1740
1757
|
1
|
|
1741
1758
|
);
|
|
1742
|
-
return !(this.latest &&
|
|
1759
|
+
return !(this.latest && T(this.latest) < t);
|
|
1743
1760
|
}
|
|
1744
1761
|
nextMonth() {
|
|
1745
1762
|
const t = this.month === 11 ? 0 : this.month + 1, e = this.month === 11 ? this.year + 1 : this.year;
|
|
1746
1763
|
this.changeMonth(e, t);
|
|
1747
1764
|
}
|
|
1748
1765
|
changeMonth(t, e) {
|
|
1749
|
-
this.year = typeof t == "string" ? parseInt(t) : t, this.month = typeof e == "string" ? parseInt(e) : e, this.tabIndexSet = 0, this.focusedDate = null, this.selectableDates = [];
|
|
1750
|
-
}
|
|
1751
|
-
isInRange(t) {
|
|
1752
|
-
if (this.range && this.selected.length === 2) {
|
|
1753
|
-
if (t > v(this.selected[0]) && t < v(this.selected[1])) return !0;
|
|
1754
|
-
} else if (this.range && this.selected.length === 1 && this.rangeHovered && t > v(this.selected[0]) && t < this.rangeHovered)
|
|
1755
|
-
return !0;
|
|
1756
|
-
return !1;
|
|
1766
|
+
this.year = typeof t == "string" ? parseInt(t) : t, this.month = typeof e == "string" ? parseInt(e) : e, this.currentmonth = new Date(this.year, this.month, 1), this.tabIndexSet = 0, this.focusedDate = null, this.selectableDates = [];
|
|
1757
1767
|
}
|
|
1758
1768
|
isRangeAllowed(t) {
|
|
1759
1769
|
let e = !0;
|
|
@@ -1766,7 +1776,7 @@ let l = class extends dt {
|
|
|
1766
1776
|
for (let r = 0; r < n.length; r++)
|
|
1767
1777
|
this.excludedates.forEach((a) => {
|
|
1768
1778
|
a > this._selected[0] && a < t && (e = !1);
|
|
1769
|
-
}), this.excludeweekdays.includes(
|
|
1779
|
+
}), this.excludeweekdays.includes(De(n[r]).toString()) && (e = !1);
|
|
1770
1780
|
}
|
|
1771
1781
|
return e;
|
|
1772
1782
|
}
|
|
@@ -1774,22 +1784,22 @@ let l = class extends dt {
|
|
|
1774
1784
|
this.selected = [], this._selected = [], this.inRange = {};
|
|
1775
1785
|
}
|
|
1776
1786
|
addToSelected(t) {
|
|
1777
|
-
this.selected.includes(
|
|
1787
|
+
this.selected.includes(y(t)) || (this.selected = [...this.selected, y(t)], this._selected = [...this._selected, t], this.range && this.selected.length === 2 && (this.convertSelected(), this.close()));
|
|
1778
1788
|
}
|
|
1779
1789
|
removeFromSelected(t) {
|
|
1780
1790
|
if (this.selected.length === 1)
|
|
1781
1791
|
this.emptySelected();
|
|
1782
1792
|
else {
|
|
1783
|
-
const e = this.selected.indexOf(
|
|
1793
|
+
const e = this.selected.indexOf(y(t)), n = [...this.selected], r = [...this._selected];
|
|
1784
1794
|
n.splice(e, 1), r.splice(e, 1), this.selected = n, this._selected = r;
|
|
1785
1795
|
}
|
|
1786
1796
|
}
|
|
1787
1797
|
toggleSelected(t) {
|
|
1788
|
-
const e =
|
|
1798
|
+
const e = y(t);
|
|
1789
1799
|
this.selected.includes(e) ? this.removeFromSelected(t) : this.maxMultiple && this.selected.length >= this.maxMultiple || this.addToSelected(t);
|
|
1790
1800
|
}
|
|
1791
1801
|
handleRangeSelect(t) {
|
|
1792
|
-
const e =
|
|
1802
|
+
const e = y(t);
|
|
1793
1803
|
return this.selected.includes(e) ? this.selected.indexOf(e) === 0 ? this.emptySelected() : this.removeFromSelected(t) : this.selected.length > 1 ? (this.emptySelected(), this.addToSelected(t)) : (this.selected.length === 1 && !this.isRangeAllowed(t) && this.emptySelected(), this.selected.length === 1 && this._selected[0] > t && this.emptySelected(), this.addToSelected(t)), Promise.resolve();
|
|
1794
1804
|
}
|
|
1795
1805
|
handleRangeHover(t) {
|
|
@@ -1800,14 +1810,16 @@ let l = class extends dt {
|
|
|
1800
1810
|
end: t
|
|
1801
1811
|
});
|
|
1802
1812
|
if (Array.isArray(e) && e.length)
|
|
1803
|
-
for (let n = 0; n < e.length; n++)
|
|
1804
|
-
|
|
1813
|
+
for (let n = 0; n < e.length; n++) {
|
|
1814
|
+
const r = e[n], a = r > this._selected[0] && r < t;
|
|
1815
|
+
this.inRange[y(r)] = a;
|
|
1816
|
+
}
|
|
1805
1817
|
} else
|
|
1806
1818
|
this.rangeHovered = null;
|
|
1807
1819
|
}
|
|
1808
1820
|
handleDateSelect(t) {
|
|
1809
1821
|
if (t)
|
|
1810
|
-
return this.range ? this.handleRangeSelect(t) : this.multiple ? this.toggleSelected(t) : (this.selected.includes(
|
|
1822
|
+
return this.range ? this.handleRangeSelect(t) : this.multiple ? this.toggleSelected(t) : (this.selected.includes(y(t)) ? this.emptySelected() : (this.emptySelected(), this.addToSelected(t)), this.close()), this.dispatchEvent(
|
|
1811
1823
|
new CustomEvent("date-selected", {
|
|
1812
1824
|
detail: this.selected,
|
|
1813
1825
|
bubbles: !0,
|
|
@@ -1816,16 +1828,16 @@ let l = class extends dt {
|
|
|
1816
1828
|
), Promise.resolve();
|
|
1817
1829
|
}
|
|
1818
1830
|
focusOnCurrentDate() {
|
|
1819
|
-
const t =
|
|
1820
|
-
if (e instanceof
|
|
1831
|
+
const t = y(T()), e = this.querySelector(`button[data-date="${t}"]`);
|
|
1832
|
+
if (e instanceof HTMLButtonElement)
|
|
1821
1833
|
this.focusedDate = t, e.focus();
|
|
1822
1834
|
else {
|
|
1823
1835
|
const n = this.selectableDates.find((r) => !r.isDisabled);
|
|
1824
1836
|
if (n) {
|
|
1825
1837
|
const r = this.querySelector(
|
|
1826
|
-
`
|
|
1838
|
+
`button[data-date="${n.currentDateISO}"]`
|
|
1827
1839
|
);
|
|
1828
|
-
r instanceof
|
|
1840
|
+
r instanceof HTMLButtonElement && (this.focusedDate = n.currentDateISO, r.focus());
|
|
1829
1841
|
}
|
|
1830
1842
|
}
|
|
1831
1843
|
}
|
|
@@ -1842,96 +1854,97 @@ let l = class extends dt {
|
|
|
1842
1854
|
);
|
|
1843
1855
|
}
|
|
1844
1856
|
};
|
|
1845
|
-
|
|
1857
|
+
d([
|
|
1846
1858
|
m({ type: Boolean })
|
|
1847
|
-
],
|
|
1848
|
-
|
|
1859
|
+
], h.prototype, "multiple", 2);
|
|
1860
|
+
d([
|
|
1849
1861
|
m({ type: Number })
|
|
1850
|
-
],
|
|
1851
|
-
|
|
1862
|
+
], h.prototype, "maxMultiple", 2);
|
|
1863
|
+
d([
|
|
1852
1864
|
m({ type: Boolean })
|
|
1853
|
-
],
|
|
1854
|
-
|
|
1865
|
+
], h.prototype, "range", 2);
|
|
1866
|
+
d([
|
|
1855
1867
|
m({ type: Boolean })
|
|
1856
|
-
],
|
|
1857
|
-
|
|
1868
|
+
], h.prototype, "weeknumbers", 2);
|
|
1869
|
+
d([
|
|
1858
1870
|
m({ type: Boolean })
|
|
1859
|
-
],
|
|
1860
|
-
|
|
1861
|
-
m({ converter:
|
|
1862
|
-
],
|
|
1863
|
-
|
|
1871
|
+
], h.prototype, "withcontrols", 2);
|
|
1872
|
+
d([
|
|
1873
|
+
m({ converter: L.csvToArray })
|
|
1874
|
+
], h.prototype, "selected", 2);
|
|
1875
|
+
d([
|
|
1864
1876
|
m({ type: String })
|
|
1865
|
-
],
|
|
1866
|
-
|
|
1877
|
+
], h.prototype, "earliest", 2);
|
|
1878
|
+
d([
|
|
1867
1879
|
m({ type: String })
|
|
1868
|
-
],
|
|
1869
|
-
|
|
1870
|
-
m({ converter:
|
|
1871
|
-
],
|
|
1872
|
-
|
|
1873
|
-
m({ converter:
|
|
1874
|
-
],
|
|
1875
|
-
|
|
1876
|
-
m({ converter:
|
|
1877
|
-
],
|
|
1878
|
-
|
|
1880
|
+
], h.prototype, "latest", 2);
|
|
1881
|
+
d([
|
|
1882
|
+
m({ converter: L.stringsToDate })
|
|
1883
|
+
], h.prototype, "excludedates", 2);
|
|
1884
|
+
d([
|
|
1885
|
+
m({ converter: L.csvToArray })
|
|
1886
|
+
], h.prototype, "excludeweekdays", 2);
|
|
1887
|
+
d([
|
|
1888
|
+
m({ converter: L.stringToDate })
|
|
1889
|
+
], h.prototype, "currentmonth", 2);
|
|
1890
|
+
d([
|
|
1879
1891
|
m({ type: Array })
|
|
1880
|
-
],
|
|
1881
|
-
|
|
1892
|
+
], h.prototype, "dayStrings", 2);
|
|
1893
|
+
d([
|
|
1882
1894
|
m({ type: Array })
|
|
1883
|
-
],
|
|
1884
|
-
|
|
1895
|
+
], h.prototype, "dayStringsLong", 2);
|
|
1896
|
+
d([
|
|
1885
1897
|
m({ type: Array })
|
|
1886
|
-
],
|
|
1887
|
-
|
|
1898
|
+
], h.prototype, "monthStrings", 2);
|
|
1899
|
+
d([
|
|
1888
1900
|
m({ type: String })
|
|
1889
|
-
],
|
|
1890
|
-
|
|
1901
|
+
], h.prototype, "weekString", 2);
|
|
1902
|
+
d([
|
|
1891
1903
|
m({ type: String })
|
|
1892
|
-
],
|
|
1893
|
-
|
|
1904
|
+
], h.prototype, "prevMonthString", 2);
|
|
1905
|
+
d([
|
|
1894
1906
|
m({ type: String })
|
|
1895
|
-
],
|
|
1896
|
-
|
|
1907
|
+
], h.prototype, "nextMonthString", 2);
|
|
1908
|
+
d([
|
|
1897
1909
|
m({ type: Array })
|
|
1898
|
-
],
|
|
1899
|
-
|
|
1910
|
+
], h.prototype, "_selected", 2);
|
|
1911
|
+
d([
|
|
1900
1912
|
m({ type: Number })
|
|
1901
|
-
],
|
|
1902
|
-
|
|
1913
|
+
], h.prototype, "year", 2);
|
|
1914
|
+
d([
|
|
1903
1915
|
m({ type: Number })
|
|
1904
|
-
],
|
|
1905
|
-
|
|
1916
|
+
], h.prototype, "month", 2);
|
|
1917
|
+
d([
|
|
1906
1918
|
m({ type: Number })
|
|
1907
|
-
],
|
|
1908
|
-
|
|
1919
|
+
], h.prototype, "week", 2);
|
|
1920
|
+
d([
|
|
1909
1921
|
m({ type: Date })
|
|
1910
|
-
],
|
|
1911
|
-
|
|
1922
|
+
], h.prototype, "rangeHovered", 2);
|
|
1923
|
+
d([
|
|
1912
1924
|
H()
|
|
1913
|
-
],
|
|
1914
|
-
|
|
1925
|
+
], h.prototype, "inRange", 2);
|
|
1926
|
+
d([
|
|
1915
1927
|
H()
|
|
1916
|
-
],
|
|
1917
|
-
|
|
1928
|
+
], h.prototype, "focusedDate", 2);
|
|
1929
|
+
d([
|
|
1918
1930
|
H()
|
|
1919
|
-
],
|
|
1920
|
-
|
|
1931
|
+
], h.prototype, "selectableDates", 2);
|
|
1932
|
+
d([
|
|
1921
1933
|
H()
|
|
1922
|
-
],
|
|
1923
|
-
|
|
1934
|
+
], h.prototype, "currentmonthtouched", 2);
|
|
1935
|
+
d([
|
|
1924
1936
|
H()
|
|
1925
|
-
],
|
|
1926
|
-
|
|
1937
|
+
], h.prototype, "tabIndexSet", 2);
|
|
1938
|
+
h = d([
|
|
1927
1939
|
ft("pkt-calendar")
|
|
1928
|
-
],
|
|
1940
|
+
], h);
|
|
1929
1941
|
export {
|
|
1930
|
-
|
|
1931
|
-
|
|
1942
|
+
h as P,
|
|
1943
|
+
y as a,
|
|
1932
1944
|
He as b,
|
|
1933
1945
|
Oe as c,
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1946
|
+
L as d,
|
|
1947
|
+
Ae as f,
|
|
1948
|
+
T as n,
|
|
1949
|
+
N as p
|
|
1937
1950
|
};
|