@oslokommune/punkt-elements 12.6.7 → 12.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/pkt-datepicker.cjs +4 -4
- package/dist/pkt-datepicker.js +521 -512
- package/package.json +2 -2
- package/src/components/datepicker/index.ts +6 -2
package/dist/pkt-datepicker.js
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { T as K, a as z, x as M, E as
|
|
2
|
-
import { e as Z, i as
|
|
3
|
-
import { p as
|
|
1
|
+
import { T as K, a as z, x as M, E as B, n as g } from "./index-CF6_-ZoF.js";
|
|
2
|
+
import { e as Z, i as ee, a as te, t as ne } from "./directive-Cxhakbpr.js";
|
|
3
|
+
import { p as ae, v as O, r as S, M as Y, m as re, e as C, n as P } from "./ref-rfvuMlT1.js";
|
|
4
4
|
import { e as R } from "./class-map-luGhSuLj.js";
|
|
5
5
|
import { a as G } from "./converters-DNCwIFwr.js";
|
|
6
|
-
import { s as
|
|
6
|
+
import { s as ie, t as k, c as _, m as se, a as oe, g as ue, b as le, d as de } from "./index-BkXggpNp.js";
|
|
7
7
|
import "./pkt-input-wrapper.js";
|
|
8
8
|
import "./index-B-KXmo65.js";
|
|
9
9
|
import "./pkt-tag.js";
|
|
10
|
-
function I(
|
|
11
|
-
return
|
|
10
|
+
function I(e) {
|
|
11
|
+
return ie(e, { weekStartsOn: 1 });
|
|
12
12
|
}
|
|
13
|
-
function U(
|
|
14
|
-
const
|
|
13
|
+
function U(e) {
|
|
14
|
+
const t = k(e), n = t.getFullYear(), a = _(e, 0);
|
|
15
15
|
a.setFullYear(n + 1, 0, 4), a.setHours(0, 0, 0, 0);
|
|
16
|
-
const r = I(a), i = _(
|
|
16
|
+
const r = I(a), i = _(e, 0);
|
|
17
17
|
i.setFullYear(n, 0, 4), i.setHours(0, 0, 0, 0);
|
|
18
18
|
const s = I(i);
|
|
19
|
-
return
|
|
19
|
+
return t.getTime() >= r.getTime() ? n + 1 : t.getTime() >= s.getTime() ? n : n - 1;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
return
|
|
21
|
+
function N(e) {
|
|
22
|
+
const t = k(e);
|
|
23
|
+
return t.setHours(0, 0, 0, 0), t;
|
|
24
24
|
}
|
|
25
|
-
function V(
|
|
26
|
-
const
|
|
25
|
+
function V(e) {
|
|
26
|
+
const t = k(e), n = new Date(
|
|
27
27
|
Date.UTC(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
t.getFullYear(),
|
|
29
|
+
t.getMonth(),
|
|
30
|
+
t.getDate(),
|
|
31
|
+
t.getHours(),
|
|
32
|
+
t.getMinutes(),
|
|
33
|
+
t.getSeconds(),
|
|
34
|
+
t.getMilliseconds()
|
|
35
35
|
)
|
|
36
36
|
);
|
|
37
|
-
return n.setUTCFullYear(
|
|
37
|
+
return n.setUTCFullYear(t.getFullYear()), +e - +n;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
const n =
|
|
41
|
-
return Math.round((r - i) /
|
|
39
|
+
function ce(e, t) {
|
|
40
|
+
const n = N(e), a = N(t), r = +n - V(n), i = +a - V(a);
|
|
41
|
+
return Math.round((r - i) / se);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
const
|
|
45
|
-
return n.setFullYear(
|
|
43
|
+
function he(e) {
|
|
44
|
+
const t = U(e), n = _(e, 0);
|
|
45
|
+
return n.setFullYear(t, 0, 4), n.setHours(0, 0, 0, 0), I(n);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
47
|
+
function fe(e) {
|
|
48
|
+
return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
if (!
|
|
50
|
+
function me(e) {
|
|
51
|
+
if (!fe(e) && typeof e != "number")
|
|
52
52
|
return !1;
|
|
53
|
-
const
|
|
54
|
-
return !isNaN(Number(
|
|
53
|
+
const t = k(e);
|
|
54
|
+
return !isNaN(Number(t));
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
return n.setFullYear(
|
|
56
|
+
function pe(e) {
|
|
57
|
+
const t = k(e), n = _(e, 0);
|
|
58
|
+
return n.setFullYear(t.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const ge = {
|
|
61
61
|
lessThanXSeconds: {
|
|
62
62
|
one: "less than a second",
|
|
63
63
|
other: "less than {{count}} seconds"
|
|
@@ -119,77 +119,77 @@ const gt = {
|
|
|
119
119
|
one: "almost 1 year",
|
|
120
120
|
other: "almost {{count}} years"
|
|
121
121
|
}
|
|
122
|
-
},
|
|
122
|
+
}, ye = (e, t, n) => {
|
|
123
123
|
let a;
|
|
124
|
-
const r =
|
|
125
|
-
return typeof r == "string" ? a = r :
|
|
124
|
+
const r = ge[e];
|
|
125
|
+
return typeof r == "string" ? a = r : t === 1 ? a = r.one : a = r.other.replace("{{count}}", t.toString()), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "in " + a : a + " ago" : a;
|
|
126
126
|
};
|
|
127
|
-
function F(
|
|
128
|
-
return (
|
|
129
|
-
const n =
|
|
130
|
-
return
|
|
127
|
+
function F(e) {
|
|
128
|
+
return (t = {}) => {
|
|
129
|
+
const n = t.width ? String(t.width) : e.defaultWidth;
|
|
130
|
+
return e.formats[n] || e.formats[e.defaultWidth];
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
|
-
const
|
|
133
|
+
const ve = {
|
|
134
134
|
full: "EEEE, MMMM do, y",
|
|
135
135
|
long: "MMMM do, y",
|
|
136
136
|
medium: "MMM d, y",
|
|
137
137
|
short: "MM/dd/yyyy"
|
|
138
|
-
},
|
|
138
|
+
}, we = {
|
|
139
139
|
full: "h:mm:ss a zzzz",
|
|
140
140
|
long: "h:mm:ss a z",
|
|
141
141
|
medium: "h:mm:ss a",
|
|
142
142
|
short: "h:mm a"
|
|
143
|
-
},
|
|
143
|
+
}, be = {
|
|
144
144
|
full: "{{date}} 'at' {{time}}",
|
|
145
145
|
long: "{{date}} 'at' {{time}}",
|
|
146
146
|
medium: "{{date}}, {{time}}",
|
|
147
147
|
short: "{{date}}, {{time}}"
|
|
148
|
-
},
|
|
148
|
+
}, ke = {
|
|
149
149
|
date: F({
|
|
150
|
-
formats:
|
|
150
|
+
formats: ve,
|
|
151
151
|
defaultWidth: "full"
|
|
152
152
|
}),
|
|
153
153
|
time: F({
|
|
154
|
-
formats:
|
|
154
|
+
formats: we,
|
|
155
155
|
defaultWidth: "full"
|
|
156
156
|
}),
|
|
157
157
|
dateTime: F({
|
|
158
|
-
formats:
|
|
158
|
+
formats: be,
|
|
159
159
|
defaultWidth: "full"
|
|
160
160
|
})
|
|
161
|
-
},
|
|
161
|
+
}, xe = {
|
|
162
162
|
lastWeek: "'last' eeee 'at' p",
|
|
163
163
|
yesterday: "'yesterday at' p",
|
|
164
164
|
today: "'today at' p",
|
|
165
165
|
tomorrow: "'tomorrow at' p",
|
|
166
166
|
nextWeek: "eeee 'at' p",
|
|
167
167
|
other: "P"
|
|
168
|
-
}, $
|
|
169
|
-
function
|
|
170
|
-
return (
|
|
168
|
+
}, $e = (e, t, n, a) => xe[e];
|
|
169
|
+
function W(e) {
|
|
170
|
+
return (t, n) => {
|
|
171
171
|
const a = n != null && n.context ? String(n.context) : "standalone";
|
|
172
172
|
let r;
|
|
173
|
-
if (a === "formatting" &&
|
|
174
|
-
const s =
|
|
175
|
-
r =
|
|
173
|
+
if (a === "formatting" && e.formattingValues) {
|
|
174
|
+
const s = e.defaultFormattingWidth || e.defaultWidth, d = n != null && n.width ? String(n.width) : s;
|
|
175
|
+
r = e.formattingValues[d] || e.formattingValues[s];
|
|
176
176
|
} else {
|
|
177
|
-
const s =
|
|
178
|
-
r =
|
|
177
|
+
const s = e.defaultWidth, d = n != null && n.width ? String(n.width) : e.defaultWidth;
|
|
178
|
+
r = e.values[d] || e.values[s];
|
|
179
179
|
}
|
|
180
|
-
const i =
|
|
180
|
+
const i = e.argumentCallback ? e.argumentCallback(t) : t;
|
|
181
181
|
return r[i];
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
const
|
|
184
|
+
const Me = {
|
|
185
185
|
narrow: ["B", "A"],
|
|
186
186
|
abbreviated: ["BC", "AD"],
|
|
187
187
|
wide: ["Before Christ", "Anno Domini"]
|
|
188
|
-
},
|
|
188
|
+
}, Oe = {
|
|
189
189
|
narrow: ["1", "2", "3", "4"],
|
|
190
190
|
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
191
191
|
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
|
192
|
-
},
|
|
192
|
+
}, Pe = {
|
|
193
193
|
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
194
194
|
abbreviated: [
|
|
195
195
|
"Jan",
|
|
@@ -219,7 +219,7 @@ const Mt = {
|
|
|
219
219
|
"November",
|
|
220
220
|
"December"
|
|
221
221
|
]
|
|
222
|
-
},
|
|
222
|
+
}, Te = {
|
|
223
223
|
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
224
224
|
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
225
225
|
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
@@ -232,7 +232,7 @@ const Mt = {
|
|
|
232
232
|
"Friday",
|
|
233
233
|
"Saturday"
|
|
234
234
|
]
|
|
235
|
-
},
|
|
235
|
+
}, De = {
|
|
236
236
|
narrow: {
|
|
237
237
|
am: "a",
|
|
238
238
|
pm: "p",
|
|
@@ -263,7 +263,7 @@ const Mt = {
|
|
|
263
263
|
evening: "evening",
|
|
264
264
|
night: "night"
|
|
265
265
|
}
|
|
266
|
-
},
|
|
266
|
+
}, Se = {
|
|
267
267
|
narrow: {
|
|
268
268
|
am: "a",
|
|
269
269
|
pm: "p",
|
|
@@ -294,8 +294,8 @@ const Mt = {
|
|
|
294
294
|
evening: "in the evening",
|
|
295
295
|
night: "at night"
|
|
296
296
|
}
|
|
297
|
-
},
|
|
298
|
-
const n = Number(
|
|
297
|
+
}, Ce = (e, t) => {
|
|
298
|
+
const n = Number(e), a = n % 100;
|
|
299
299
|
if (a > 20 || a < 10)
|
|
300
300
|
switch (a % 10) {
|
|
301
301
|
case 1:
|
|
@@ -306,89 +306,89 @@ const Mt = {
|
|
|
306
306
|
return n + "rd";
|
|
307
307
|
}
|
|
308
308
|
return n + "th";
|
|
309
|
-
},
|
|
310
|
-
ordinalNumber:
|
|
311
|
-
era:
|
|
312
|
-
values:
|
|
309
|
+
}, Re = {
|
|
310
|
+
ordinalNumber: Ce,
|
|
311
|
+
era: W({
|
|
312
|
+
values: Me,
|
|
313
313
|
defaultWidth: "wide"
|
|
314
314
|
}),
|
|
315
|
-
quarter:
|
|
316
|
-
values:
|
|
315
|
+
quarter: W({
|
|
316
|
+
values: Oe,
|
|
317
317
|
defaultWidth: "wide",
|
|
318
|
-
argumentCallback: (
|
|
318
|
+
argumentCallback: (e) => e - 1
|
|
319
319
|
}),
|
|
320
|
-
month:
|
|
321
|
-
values:
|
|
320
|
+
month: W({
|
|
321
|
+
values: Pe,
|
|
322
322
|
defaultWidth: "wide"
|
|
323
323
|
}),
|
|
324
|
-
day:
|
|
325
|
-
values:
|
|
324
|
+
day: W({
|
|
325
|
+
values: Te,
|
|
326
326
|
defaultWidth: "wide"
|
|
327
327
|
}),
|
|
328
|
-
dayPeriod:
|
|
329
|
-
values:
|
|
328
|
+
dayPeriod: W({
|
|
329
|
+
values: De,
|
|
330
330
|
defaultWidth: "wide",
|
|
331
|
-
formattingValues:
|
|
331
|
+
formattingValues: Se,
|
|
332
332
|
defaultFormattingWidth: "wide"
|
|
333
333
|
})
|
|
334
334
|
};
|
|
335
|
-
function
|
|
336
|
-
return (
|
|
337
|
-
const a = n.width, r = a &&
|
|
335
|
+
function E(e) {
|
|
336
|
+
return (t, n = {}) => {
|
|
337
|
+
const a = n.width, r = a && e.matchPatterns[a] || e.matchPatterns[e.defaultMatchWidth], i = t.match(r);
|
|
338
338
|
if (!i)
|
|
339
339
|
return null;
|
|
340
|
-
const s = i[0], d = a &&
|
|
340
|
+
const s = i[0], d = a && e.parsePatterns[a] || e.parsePatterns[e.defaultParseWidth], y = Array.isArray(d) ? Ee(d, (l) => l.test(s)) : (
|
|
341
341
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
|
|
342
|
-
|
|
342
|
+
We(d, (l) => l.test(s))
|
|
343
343
|
);
|
|
344
344
|
let v;
|
|
345
|
-
v =
|
|
345
|
+
v = e.valueCallback ? e.valueCallback(y) : y, v = n.valueCallback ? (
|
|
346
346
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
|
|
347
347
|
n.valueCallback(v)
|
|
348
348
|
) : v;
|
|
349
|
-
const x =
|
|
349
|
+
const x = t.slice(s.length);
|
|
350
350
|
return { value: v, rest: x };
|
|
351
351
|
};
|
|
352
352
|
}
|
|
353
|
-
function
|
|
354
|
-
for (const n in
|
|
355
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
353
|
+
function We(e, t) {
|
|
354
|
+
for (const n in e)
|
|
355
|
+
if (Object.prototype.hasOwnProperty.call(e, n) && t(e[n]))
|
|
356
356
|
return n;
|
|
357
357
|
}
|
|
358
|
-
function
|
|
359
|
-
for (let n = 0; n <
|
|
360
|
-
if (e
|
|
358
|
+
function Ee(e, t) {
|
|
359
|
+
for (let n = 0; n < e.length; n++)
|
|
360
|
+
if (t(e[n]))
|
|
361
361
|
return n;
|
|
362
362
|
}
|
|
363
|
-
function
|
|
364
|
-
return (
|
|
365
|
-
const a =
|
|
363
|
+
function _e(e) {
|
|
364
|
+
return (t, n = {}) => {
|
|
365
|
+
const a = t.match(e.matchPattern);
|
|
366
366
|
if (!a) return null;
|
|
367
|
-
const r = a[0], i =
|
|
367
|
+
const r = a[0], i = t.match(e.parsePattern);
|
|
368
368
|
if (!i) return null;
|
|
369
|
-
let s =
|
|
369
|
+
let s = e.valueCallback ? e.valueCallback(i[0]) : i[0];
|
|
370
370
|
s = n.valueCallback ? n.valueCallback(s) : s;
|
|
371
|
-
const d =
|
|
371
|
+
const d = t.slice(r.length);
|
|
372
372
|
return { value: s, rest: d };
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
|
-
const
|
|
375
|
+
const Ie = /^(\d+)(th|st|nd|rd)?/i, Ye = /\d+/i, Fe = {
|
|
376
376
|
narrow: /^(b|a)/i,
|
|
377
377
|
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
378
378
|
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
379
|
-
},
|
|
379
|
+
}, qe = {
|
|
380
380
|
any: [/^b/i, /^(a|c)/i]
|
|
381
|
-
},
|
|
381
|
+
}, Be = {
|
|
382
382
|
narrow: /^[1234]/i,
|
|
383
383
|
abbreviated: /^q[1234]/i,
|
|
384
384
|
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
385
|
-
},
|
|
385
|
+
}, Ne = {
|
|
386
386
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|
387
|
-
},
|
|
387
|
+
}, Ve = {
|
|
388
388
|
narrow: /^[jfmasond]/i,
|
|
389
389
|
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
390
390
|
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
391
|
-
},
|
|
391
|
+
}, je = {
|
|
392
392
|
narrow: [
|
|
393
393
|
/^j/i,
|
|
394
394
|
/^f/i,
|
|
@@ -417,18 +417,18 @@ const It = /^(\d+)(th|st|nd|rd)?/i, Yt = /\d+/i, Ft = {
|
|
|
417
417
|
/^n/i,
|
|
418
418
|
/^d/i
|
|
419
419
|
]
|
|
420
|
-
},
|
|
420
|
+
}, He = {
|
|
421
421
|
narrow: /^[smtwf]/i,
|
|
422
422
|
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
423
423
|
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
424
424
|
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
425
|
-
},
|
|
425
|
+
}, Ae = {
|
|
426
426
|
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
427
427
|
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
428
|
-
},
|
|
428
|
+
}, Le = {
|
|
429
429
|
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
430
430
|
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
431
|
-
},
|
|
431
|
+
}, Qe = {
|
|
432
432
|
any: {
|
|
433
433
|
am: /^a/i,
|
|
434
434
|
pm: /^p/i,
|
|
@@ -439,86 +439,86 @@ const It = /^(\d+)(th|st|nd|rd)?/i, Yt = /\d+/i, Ft = {
|
|
|
439
439
|
evening: /evening/i,
|
|
440
440
|
night: /night/i
|
|
441
441
|
}
|
|
442
|
-
},
|
|
443
|
-
ordinalNumber:
|
|
444
|
-
matchPattern:
|
|
445
|
-
parsePattern:
|
|
446
|
-
valueCallback: (
|
|
442
|
+
}, Xe = {
|
|
443
|
+
ordinalNumber: _e({
|
|
444
|
+
matchPattern: Ie,
|
|
445
|
+
parsePattern: Ye,
|
|
446
|
+
valueCallback: (e) => parseInt(e, 10)
|
|
447
447
|
}),
|
|
448
|
-
era:
|
|
449
|
-
matchPatterns:
|
|
448
|
+
era: E({
|
|
449
|
+
matchPatterns: Fe,
|
|
450
450
|
defaultMatchWidth: "wide",
|
|
451
|
-
parsePatterns:
|
|
451
|
+
parsePatterns: qe,
|
|
452
452
|
defaultParseWidth: "any"
|
|
453
453
|
}),
|
|
454
|
-
quarter:
|
|
455
|
-
matchPatterns:
|
|
454
|
+
quarter: E({
|
|
455
|
+
matchPatterns: Be,
|
|
456
456
|
defaultMatchWidth: "wide",
|
|
457
|
-
parsePatterns:
|
|
457
|
+
parsePatterns: Ne,
|
|
458
458
|
defaultParseWidth: "any",
|
|
459
|
-
valueCallback: (
|
|
459
|
+
valueCallback: (e) => e + 1
|
|
460
460
|
}),
|
|
461
|
-
month:
|
|
462
|
-
matchPatterns:
|
|
461
|
+
month: E({
|
|
462
|
+
matchPatterns: Ve,
|
|
463
463
|
defaultMatchWidth: "wide",
|
|
464
|
-
parsePatterns:
|
|
464
|
+
parsePatterns: je,
|
|
465
465
|
defaultParseWidth: "any"
|
|
466
466
|
}),
|
|
467
|
-
day:
|
|
468
|
-
matchPatterns:
|
|
467
|
+
day: E({
|
|
468
|
+
matchPatterns: He,
|
|
469
469
|
defaultMatchWidth: "wide",
|
|
470
|
-
parsePatterns:
|
|
470
|
+
parsePatterns: Ae,
|
|
471
471
|
defaultParseWidth: "any"
|
|
472
472
|
}),
|
|
473
|
-
dayPeriod:
|
|
474
|
-
matchPatterns:
|
|
473
|
+
dayPeriod: E({
|
|
474
|
+
matchPatterns: Le,
|
|
475
475
|
defaultMatchWidth: "any",
|
|
476
|
-
parsePatterns:
|
|
476
|
+
parsePatterns: Qe,
|
|
477
477
|
defaultParseWidth: "any"
|
|
478
478
|
})
|
|
479
|
-
},
|
|
479
|
+
}, Ge = {
|
|
480
480
|
code: "en-US",
|
|
481
|
-
formatDistance:
|
|
482
|
-
formatLong:
|
|
483
|
-
formatRelative: $
|
|
484
|
-
localize:
|
|
485
|
-
match:
|
|
481
|
+
formatDistance: ye,
|
|
482
|
+
formatLong: ke,
|
|
483
|
+
formatRelative: $e,
|
|
484
|
+
localize: Re,
|
|
485
|
+
match: Xe,
|
|
486
486
|
options: {
|
|
487
487
|
weekStartsOn: 0,
|
|
488
488
|
firstWeekContainsDate: 1
|
|
489
489
|
}
|
|
490
490
|
};
|
|
491
|
-
function
|
|
492
|
-
const
|
|
493
|
-
return
|
|
491
|
+
function Ue(e) {
|
|
492
|
+
const t = k(e);
|
|
493
|
+
return ce(t, pe(t)) + 1;
|
|
494
494
|
}
|
|
495
|
-
function
|
|
496
|
-
const
|
|
497
|
-
return Math.round(n /
|
|
495
|
+
function Je(e) {
|
|
496
|
+
const t = k(e), n = +I(t) - +he(t);
|
|
497
|
+
return Math.round(n / oe) + 1;
|
|
498
498
|
}
|
|
499
|
-
function o(
|
|
500
|
-
const n =
|
|
499
|
+
function o(e, t) {
|
|
500
|
+
const n = e < 0 ? "-" : "", a = Math.abs(e).toString().padStart(t, "0");
|
|
501
501
|
return n + a;
|
|
502
502
|
}
|
|
503
503
|
const b = {
|
|
504
504
|
// Year
|
|
505
|
-
y(
|
|
506
|
-
const n =
|
|
507
|
-
return o(
|
|
505
|
+
y(e, t) {
|
|
506
|
+
const n = e.getFullYear(), a = n > 0 ? n : 1 - n;
|
|
507
|
+
return o(t === "yy" ? a % 100 : a, t.length);
|
|
508
508
|
},
|
|
509
509
|
// Month
|
|
510
|
-
M(
|
|
511
|
-
const n =
|
|
512
|
-
return
|
|
510
|
+
M(e, t) {
|
|
511
|
+
const n = e.getMonth();
|
|
512
|
+
return t === "M" ? String(n + 1) : o(n + 1, 2);
|
|
513
513
|
},
|
|
514
514
|
// Day of the month
|
|
515
|
-
d(
|
|
516
|
-
return o(
|
|
515
|
+
d(e, t) {
|
|
516
|
+
return o(e.getDate(), t.length);
|
|
517
517
|
},
|
|
518
518
|
// AM or PM
|
|
519
|
-
a(
|
|
520
|
-
const n =
|
|
521
|
-
switch (
|
|
519
|
+
a(e, t) {
|
|
520
|
+
const n = e.getHours() / 12 >= 1 ? "pm" : "am";
|
|
521
|
+
switch (t) {
|
|
522
522
|
case "a":
|
|
523
523
|
case "aa":
|
|
524
524
|
return n.toUpperCase();
|
|
@@ -532,27 +532,27 @@ const b = {
|
|
|
532
532
|
}
|
|
533
533
|
},
|
|
534
534
|
// Hour [1-12]
|
|
535
|
-
h(
|
|
536
|
-
return o(
|
|
535
|
+
h(e, t) {
|
|
536
|
+
return o(e.getHours() % 12 || 12, t.length);
|
|
537
537
|
},
|
|
538
538
|
// Hour [0-23]
|
|
539
|
-
H(
|
|
540
|
-
return o(
|
|
539
|
+
H(e, t) {
|
|
540
|
+
return o(e.getHours(), t.length);
|
|
541
541
|
},
|
|
542
542
|
// Minute
|
|
543
|
-
m(
|
|
544
|
-
return o(
|
|
543
|
+
m(e, t) {
|
|
544
|
+
return o(e.getMinutes(), t.length);
|
|
545
545
|
},
|
|
546
546
|
// Second
|
|
547
|
-
s(
|
|
548
|
-
return o(
|
|
547
|
+
s(e, t) {
|
|
548
|
+
return o(e.getSeconds(), t.length);
|
|
549
549
|
},
|
|
550
550
|
// Fraction of second
|
|
551
|
-
S(
|
|
552
|
-
const n =
|
|
551
|
+
S(e, t) {
|
|
552
|
+
const n = t.length, a = e.getMilliseconds(), r = Math.trunc(
|
|
553
553
|
a * Math.pow(10, n - 3)
|
|
554
554
|
);
|
|
555
|
-
return o(r,
|
|
555
|
+
return o(r, t.length);
|
|
556
556
|
}
|
|
557
557
|
}, D = {
|
|
558
558
|
am: "am",
|
|
@@ -565,9 +565,9 @@ const b = {
|
|
|
565
565
|
night: "night"
|
|
566
566
|
}, j = {
|
|
567
567
|
// Era
|
|
568
|
-
G: function(
|
|
569
|
-
const a =
|
|
570
|
-
switch (
|
|
568
|
+
G: function(e, t, n) {
|
|
569
|
+
const a = e.getFullYear() > 0 ? 1 : 0;
|
|
570
|
+
switch (t) {
|
|
571
571
|
case "G":
|
|
572
572
|
case "GG":
|
|
573
573
|
case "GGG":
|
|
@@ -580,26 +580,26 @@ const b = {
|
|
|
580
580
|
}
|
|
581
581
|
},
|
|
582
582
|
// Year
|
|
583
|
-
y: function(
|
|
584
|
-
if (
|
|
585
|
-
const a =
|
|
583
|
+
y: function(e, t, n) {
|
|
584
|
+
if (t === "yo") {
|
|
585
|
+
const a = e.getFullYear(), r = a > 0 ? a : 1 - a;
|
|
586
586
|
return n.ordinalNumber(r, { unit: "year" });
|
|
587
587
|
}
|
|
588
|
-
return b.y(
|
|
588
|
+
return b.y(e, t);
|
|
589
589
|
},
|
|
590
590
|
// Local week-numbering year
|
|
591
|
-
Y: function(
|
|
592
|
-
const r =
|
|
593
|
-
if (
|
|
591
|
+
Y: function(e, t, n, a) {
|
|
592
|
+
const r = ue(e, a), i = r > 0 ? r : 1 - r;
|
|
593
|
+
if (t === "YY") {
|
|
594
594
|
const s = i % 100;
|
|
595
595
|
return o(s, 2);
|
|
596
596
|
}
|
|
597
|
-
return
|
|
597
|
+
return t === "Yo" ? n.ordinalNumber(i, { unit: "year" }) : o(i, t.length);
|
|
598
598
|
},
|
|
599
599
|
// ISO week-numbering year
|
|
600
|
-
R: function(
|
|
601
|
-
const n = U(
|
|
602
|
-
return o(n,
|
|
600
|
+
R: function(e, t) {
|
|
601
|
+
const n = U(e);
|
|
602
|
+
return o(n, t.length);
|
|
603
603
|
},
|
|
604
604
|
// Extended year. This is a single number designating the year of this calendar system.
|
|
605
605
|
// The main difference between `y` and `u` localizers are B.C. years:
|
|
@@ -610,14 +610,14 @@ const b = {
|
|
|
610
610
|
// | BC 2 | 2 | -1 |
|
|
611
611
|
// Also `yy` always returns the last two digits of a year,
|
|
612
612
|
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
613
|
-
u: function(
|
|
614
|
-
const n =
|
|
615
|
-
return o(n,
|
|
613
|
+
u: function(e, t) {
|
|
614
|
+
const n = e.getFullYear();
|
|
615
|
+
return o(n, t.length);
|
|
616
616
|
},
|
|
617
617
|
// Quarter
|
|
618
|
-
Q: function(
|
|
619
|
-
const a = Math.ceil((
|
|
620
|
-
switch (
|
|
618
|
+
Q: function(e, t, n) {
|
|
619
|
+
const a = Math.ceil((e.getMonth() + 1) / 3);
|
|
620
|
+
switch (t) {
|
|
621
621
|
case "Q":
|
|
622
622
|
return String(a);
|
|
623
623
|
case "QQ":
|
|
@@ -643,9 +643,9 @@ const b = {
|
|
|
643
643
|
}
|
|
644
644
|
},
|
|
645
645
|
// Stand-alone quarter
|
|
646
|
-
q: function(
|
|
647
|
-
const a = Math.ceil((
|
|
648
|
-
switch (
|
|
646
|
+
q: function(e, t, n) {
|
|
647
|
+
const a = Math.ceil((e.getMonth() + 1) / 3);
|
|
648
|
+
switch (t) {
|
|
649
649
|
case "q":
|
|
650
650
|
return String(a);
|
|
651
651
|
case "qq":
|
|
@@ -671,12 +671,12 @@ const b = {
|
|
|
671
671
|
}
|
|
672
672
|
},
|
|
673
673
|
// Month
|
|
674
|
-
M: function(
|
|
675
|
-
const a =
|
|
676
|
-
switch (
|
|
674
|
+
M: function(e, t, n) {
|
|
675
|
+
const a = e.getMonth();
|
|
676
|
+
switch (t) {
|
|
677
677
|
case "M":
|
|
678
678
|
case "MM":
|
|
679
|
-
return b.M(
|
|
679
|
+
return b.M(e, t);
|
|
680
680
|
case "Mo":
|
|
681
681
|
return n.ordinalNumber(a + 1, { unit: "month" });
|
|
682
682
|
case "MMM":
|
|
@@ -695,9 +695,9 @@ const b = {
|
|
|
695
695
|
}
|
|
696
696
|
},
|
|
697
697
|
// Stand-alone month
|
|
698
|
-
L: function(
|
|
699
|
-
const a =
|
|
700
|
-
switch (
|
|
698
|
+
L: function(e, t, n) {
|
|
699
|
+
const a = e.getMonth();
|
|
700
|
+
switch (t) {
|
|
701
701
|
case "L":
|
|
702
702
|
return String(a + 1);
|
|
703
703
|
case "LL":
|
|
@@ -720,28 +720,28 @@ const b = {
|
|
|
720
720
|
}
|
|
721
721
|
},
|
|
722
722
|
// Local week of year
|
|
723
|
-
w: function(
|
|
724
|
-
const r =
|
|
725
|
-
return
|
|
723
|
+
w: function(e, t, n, a) {
|
|
724
|
+
const r = le(e, a);
|
|
725
|
+
return t === "wo" ? n.ordinalNumber(r, { unit: "week" }) : o(r, t.length);
|
|
726
726
|
},
|
|
727
727
|
// ISO week of year
|
|
728
|
-
I: function(
|
|
729
|
-
const a =
|
|
730
|
-
return
|
|
728
|
+
I: function(e, t, n) {
|
|
729
|
+
const a = Je(e);
|
|
730
|
+
return t === "Io" ? n.ordinalNumber(a, { unit: "week" }) : o(a, t.length);
|
|
731
731
|
},
|
|
732
732
|
// Day of the month
|
|
733
|
-
d: function(
|
|
734
|
-
return
|
|
733
|
+
d: function(e, t, n) {
|
|
734
|
+
return t === "do" ? n.ordinalNumber(e.getDate(), { unit: "date" }) : b.d(e, t);
|
|
735
735
|
},
|
|
736
736
|
// Day of year
|
|
737
|
-
D: function(
|
|
738
|
-
const a =
|
|
739
|
-
return
|
|
737
|
+
D: function(e, t, n) {
|
|
738
|
+
const a = Ue(e);
|
|
739
|
+
return t === "Do" ? n.ordinalNumber(a, { unit: "dayOfYear" }) : o(a, t.length);
|
|
740
740
|
},
|
|
741
741
|
// Day of week
|
|
742
|
-
E: function(
|
|
743
|
-
const a =
|
|
744
|
-
switch (
|
|
742
|
+
E: function(e, t, n) {
|
|
743
|
+
const a = e.getDay();
|
|
744
|
+
switch (t) {
|
|
745
745
|
case "E":
|
|
746
746
|
case "EE":
|
|
747
747
|
case "EEE":
|
|
@@ -768,9 +768,9 @@ const b = {
|
|
|
768
768
|
}
|
|
769
769
|
},
|
|
770
770
|
// Local day of week
|
|
771
|
-
e: function(
|
|
772
|
-
const r =
|
|
773
|
-
switch (
|
|
771
|
+
e: function(e, t, n, a) {
|
|
772
|
+
const r = e.getDay(), i = (r - a.weekStartsOn + 8) % 7 || 7;
|
|
773
|
+
switch (t) {
|
|
774
774
|
case "e":
|
|
775
775
|
return String(i);
|
|
776
776
|
case "ee":
|
|
@@ -801,13 +801,13 @@ const b = {
|
|
|
801
801
|
}
|
|
802
802
|
},
|
|
803
803
|
// Stand-alone local day of week
|
|
804
|
-
c: function(
|
|
805
|
-
const r =
|
|
806
|
-
switch (
|
|
804
|
+
c: function(e, t, n, a) {
|
|
805
|
+
const r = e.getDay(), i = (r - a.weekStartsOn + 8) % 7 || 7;
|
|
806
|
+
switch (t) {
|
|
807
807
|
case "c":
|
|
808
808
|
return String(i);
|
|
809
809
|
case "cc":
|
|
810
|
-
return o(i,
|
|
810
|
+
return o(i, t.length);
|
|
811
811
|
case "co":
|
|
812
812
|
return n.ordinalNumber(i, { unit: "day" });
|
|
813
813
|
case "ccc":
|
|
@@ -834,13 +834,13 @@ const b = {
|
|
|
834
834
|
}
|
|
835
835
|
},
|
|
836
836
|
// ISO day of week
|
|
837
|
-
i: function(
|
|
838
|
-
const a =
|
|
839
|
-
switch (
|
|
837
|
+
i: function(e, t, n) {
|
|
838
|
+
const a = e.getDay(), r = a === 0 ? 7 : a;
|
|
839
|
+
switch (t) {
|
|
840
840
|
case "i":
|
|
841
841
|
return String(r);
|
|
842
842
|
case "ii":
|
|
843
|
-
return o(r,
|
|
843
|
+
return o(r, t.length);
|
|
844
844
|
case "io":
|
|
845
845
|
return n.ordinalNumber(r, { unit: "day" });
|
|
846
846
|
case "iii":
|
|
@@ -867,9 +867,9 @@ const b = {
|
|
|
867
867
|
}
|
|
868
868
|
},
|
|
869
869
|
// AM or PM
|
|
870
|
-
a: function(
|
|
871
|
-
const r =
|
|
872
|
-
switch (
|
|
870
|
+
a: function(e, t, n) {
|
|
871
|
+
const r = e.getHours() / 12 >= 1 ? "pm" : "am";
|
|
872
|
+
switch (t) {
|
|
873
873
|
case "a":
|
|
874
874
|
case "aa":
|
|
875
875
|
return n.dayPeriod(r, {
|
|
@@ -895,10 +895,10 @@ const b = {
|
|
|
895
895
|
}
|
|
896
896
|
},
|
|
897
897
|
// AM, PM, midnight, noon
|
|
898
|
-
b: function(
|
|
899
|
-
const a =
|
|
898
|
+
b: function(e, t, n) {
|
|
899
|
+
const a = e.getHours();
|
|
900
900
|
let r;
|
|
901
|
-
switch (a === 12 ? r = D.noon : a === 0 ? r = D.midnight : r = a / 12 >= 1 ? "pm" : "am",
|
|
901
|
+
switch (a === 12 ? r = D.noon : a === 0 ? r = D.midnight : r = a / 12 >= 1 ? "pm" : "am", t) {
|
|
902
902
|
case "b":
|
|
903
903
|
case "bb":
|
|
904
904
|
return n.dayPeriod(r, {
|
|
@@ -924,10 +924,10 @@ const b = {
|
|
|
924
924
|
}
|
|
925
925
|
},
|
|
926
926
|
// in the morning, in the afternoon, in the evening, at night
|
|
927
|
-
B: function(
|
|
928
|
-
const a =
|
|
927
|
+
B: function(e, t, n) {
|
|
928
|
+
const a = e.getHours();
|
|
929
929
|
let r;
|
|
930
|
-
switch (a >= 17 ? r = D.evening : a >= 12 ? r = D.afternoon : a >= 4 ? r = D.morning : r = D.night,
|
|
930
|
+
switch (a >= 17 ? r = D.evening : a >= 12 ? r = D.afternoon : a >= 4 ? r = D.morning : r = D.night, t) {
|
|
931
931
|
case "B":
|
|
932
932
|
case "BB":
|
|
933
933
|
case "BBB":
|
|
@@ -949,45 +949,45 @@ const b = {
|
|
|
949
949
|
}
|
|
950
950
|
},
|
|
951
951
|
// Hour [1-12]
|
|
952
|
-
h: function(
|
|
953
|
-
if (
|
|
954
|
-
let a =
|
|
952
|
+
h: function(e, t, n) {
|
|
953
|
+
if (t === "ho") {
|
|
954
|
+
let a = e.getHours() % 12;
|
|
955
955
|
return a === 0 && (a = 12), n.ordinalNumber(a, { unit: "hour" });
|
|
956
956
|
}
|
|
957
|
-
return b.h(
|
|
957
|
+
return b.h(e, t);
|
|
958
958
|
},
|
|
959
959
|
// Hour [0-23]
|
|
960
|
-
H: function(
|
|
961
|
-
return
|
|
960
|
+
H: function(e, t, n) {
|
|
961
|
+
return t === "Ho" ? n.ordinalNumber(e.getHours(), { unit: "hour" }) : b.H(e, t);
|
|
962
962
|
},
|
|
963
963
|
// Hour [0-11]
|
|
964
|
-
K: function(
|
|
965
|
-
const a =
|
|
966
|
-
return
|
|
964
|
+
K: function(e, t, n) {
|
|
965
|
+
const a = e.getHours() % 12;
|
|
966
|
+
return t === "Ko" ? n.ordinalNumber(a, { unit: "hour" }) : o(a, t.length);
|
|
967
967
|
},
|
|
968
968
|
// Hour [1-24]
|
|
969
|
-
k: function(
|
|
970
|
-
let a =
|
|
971
|
-
return a === 0 && (a = 24),
|
|
969
|
+
k: function(e, t, n) {
|
|
970
|
+
let a = e.getHours();
|
|
971
|
+
return a === 0 && (a = 24), t === "ko" ? n.ordinalNumber(a, { unit: "hour" }) : o(a, t.length);
|
|
972
972
|
},
|
|
973
973
|
// Minute
|
|
974
|
-
m: function(
|
|
975
|
-
return
|
|
974
|
+
m: function(e, t, n) {
|
|
975
|
+
return t === "mo" ? n.ordinalNumber(e.getMinutes(), { unit: "minute" }) : b.m(e, t);
|
|
976
976
|
},
|
|
977
977
|
// Second
|
|
978
|
-
s: function(
|
|
979
|
-
return
|
|
978
|
+
s: function(e, t, n) {
|
|
979
|
+
return t === "so" ? n.ordinalNumber(e.getSeconds(), { unit: "second" }) : b.s(e, t);
|
|
980
980
|
},
|
|
981
981
|
// Fraction of second
|
|
982
|
-
S: function(
|
|
983
|
-
return b.S(
|
|
982
|
+
S: function(e, t) {
|
|
983
|
+
return b.S(e, t);
|
|
984
984
|
},
|
|
985
985
|
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
986
|
-
X: function(
|
|
987
|
-
const a =
|
|
986
|
+
X: function(e, t, n) {
|
|
987
|
+
const a = e.getTimezoneOffset();
|
|
988
988
|
if (a === 0)
|
|
989
989
|
return "Z";
|
|
990
|
-
switch (
|
|
990
|
+
switch (t) {
|
|
991
991
|
case "X":
|
|
992
992
|
return A(a);
|
|
993
993
|
case "XXXX":
|
|
@@ -1000,9 +1000,9 @@ const b = {
|
|
|
1000
1000
|
}
|
|
1001
1001
|
},
|
|
1002
1002
|
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
1003
|
-
x: function(
|
|
1004
|
-
const a =
|
|
1005
|
-
switch (
|
|
1003
|
+
x: function(e, t, n) {
|
|
1004
|
+
const a = e.getTimezoneOffset();
|
|
1005
|
+
switch (t) {
|
|
1006
1006
|
case "x":
|
|
1007
1007
|
return A(a);
|
|
1008
1008
|
case "xxxx":
|
|
@@ -1015,9 +1015,9 @@ const b = {
|
|
|
1015
1015
|
}
|
|
1016
1016
|
},
|
|
1017
1017
|
// Timezone (GMT)
|
|
1018
|
-
O: function(
|
|
1019
|
-
const a =
|
|
1020
|
-
switch (
|
|
1018
|
+
O: function(e, t, n) {
|
|
1019
|
+
const a = e.getTimezoneOffset();
|
|
1020
|
+
switch (t) {
|
|
1021
1021
|
case "O":
|
|
1022
1022
|
case "OO":
|
|
1023
1023
|
case "OOO":
|
|
@@ -1028,9 +1028,9 @@ const b = {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
},
|
|
1030
1030
|
// Timezone (specific non-location)
|
|
1031
|
-
z: function(
|
|
1032
|
-
const a =
|
|
1033
|
-
switch (
|
|
1031
|
+
z: function(e, t, n) {
|
|
1032
|
+
const a = e.getTimezoneOffset();
|
|
1033
|
+
switch (t) {
|
|
1034
1034
|
case "z":
|
|
1035
1035
|
case "zz":
|
|
1036
1036
|
case "zzz":
|
|
@@ -1041,190 +1041,190 @@ const b = {
|
|
|
1041
1041
|
}
|
|
1042
1042
|
},
|
|
1043
1043
|
// Seconds timestamp
|
|
1044
|
-
t: function(
|
|
1045
|
-
const a = Math.trunc(
|
|
1046
|
-
return o(a,
|
|
1044
|
+
t: function(e, t, n) {
|
|
1045
|
+
const a = Math.trunc(e.getTime() / 1e3);
|
|
1046
|
+
return o(a, t.length);
|
|
1047
1047
|
},
|
|
1048
1048
|
// Milliseconds timestamp
|
|
1049
|
-
T: function(
|
|
1050
|
-
const a =
|
|
1051
|
-
return o(a,
|
|
1049
|
+
T: function(e, t, n) {
|
|
1050
|
+
const a = e.getTime();
|
|
1051
|
+
return o(a, t.length);
|
|
1052
1052
|
}
|
|
1053
1053
|
};
|
|
1054
|
-
function H(
|
|
1055
|
-
const n =
|
|
1056
|
-
return i === 0 ? n + String(r) : n + String(r) +
|
|
1054
|
+
function H(e, t = "") {
|
|
1055
|
+
const n = e > 0 ? "-" : "+", a = Math.abs(e), r = Math.trunc(a / 60), i = a % 60;
|
|
1056
|
+
return i === 0 ? n + String(r) : n + String(r) + t + o(i, 2);
|
|
1057
1057
|
}
|
|
1058
|
-
function A(
|
|
1059
|
-
return
|
|
1058
|
+
function A(e, t) {
|
|
1059
|
+
return e % 60 === 0 ? (e > 0 ? "-" : "+") + o(Math.abs(e) / 60, 2) : T(e, t);
|
|
1060
1060
|
}
|
|
1061
|
-
function T(
|
|
1062
|
-
const n =
|
|
1063
|
-
return n + r +
|
|
1061
|
+
function T(e, t = "") {
|
|
1062
|
+
const n = e > 0 ? "-" : "+", a = Math.abs(e), r = o(Math.trunc(a / 60), 2), i = o(a % 60, 2);
|
|
1063
|
+
return n + r + t + i;
|
|
1064
1064
|
}
|
|
1065
|
-
const L = (
|
|
1066
|
-
switch (
|
|
1065
|
+
const L = (e, t) => {
|
|
1066
|
+
switch (e) {
|
|
1067
1067
|
case "P":
|
|
1068
|
-
return
|
|
1068
|
+
return t.date({ width: "short" });
|
|
1069
1069
|
case "PP":
|
|
1070
|
-
return
|
|
1070
|
+
return t.date({ width: "medium" });
|
|
1071
1071
|
case "PPP":
|
|
1072
|
-
return
|
|
1072
|
+
return t.date({ width: "long" });
|
|
1073
1073
|
case "PPPP":
|
|
1074
1074
|
default:
|
|
1075
|
-
return
|
|
1075
|
+
return t.date({ width: "full" });
|
|
1076
1076
|
}
|
|
1077
|
-
}, J = (
|
|
1078
|
-
switch (
|
|
1077
|
+
}, J = (e, t) => {
|
|
1078
|
+
switch (e) {
|
|
1079
1079
|
case "p":
|
|
1080
|
-
return
|
|
1080
|
+
return t.time({ width: "short" });
|
|
1081
1081
|
case "pp":
|
|
1082
|
-
return
|
|
1082
|
+
return t.time({ width: "medium" });
|
|
1083
1083
|
case "ppp":
|
|
1084
|
-
return
|
|
1084
|
+
return t.time({ width: "long" });
|
|
1085
1085
|
case "pppp":
|
|
1086
1086
|
default:
|
|
1087
|
-
return
|
|
1087
|
+
return t.time({ width: "full" });
|
|
1088
1088
|
}
|
|
1089
|
-
},
|
|
1090
|
-
const n =
|
|
1089
|
+
}, Ke = (e, t) => {
|
|
1090
|
+
const n = e.match(/(P+)(p+)?/) || [], a = n[1], r = n[2];
|
|
1091
1091
|
if (!r)
|
|
1092
|
-
return L(
|
|
1092
|
+
return L(e, t);
|
|
1093
1093
|
let i;
|
|
1094
1094
|
switch (a) {
|
|
1095
1095
|
case "P":
|
|
1096
|
-
i =
|
|
1096
|
+
i = t.dateTime({ width: "short" });
|
|
1097
1097
|
break;
|
|
1098
1098
|
case "PP":
|
|
1099
|
-
i =
|
|
1099
|
+
i = t.dateTime({ width: "medium" });
|
|
1100
1100
|
break;
|
|
1101
1101
|
case "PPP":
|
|
1102
|
-
i =
|
|
1102
|
+
i = t.dateTime({ width: "long" });
|
|
1103
1103
|
break;
|
|
1104
1104
|
case "PPPP":
|
|
1105
1105
|
default:
|
|
1106
|
-
i =
|
|
1106
|
+
i = t.dateTime({ width: "full" });
|
|
1107
1107
|
break;
|
|
1108
1108
|
}
|
|
1109
|
-
return i.replace("{{date}}", L(a,
|
|
1110
|
-
},
|
|
1109
|
+
return i.replace("{{date}}", L(a, t)).replace("{{time}}", J(r, t));
|
|
1110
|
+
}, ze = {
|
|
1111
1111
|
p: J,
|
|
1112
|
-
P:
|
|
1113
|
-
},
|
|
1114
|
-
function
|
|
1115
|
-
return
|
|
1112
|
+
P: Ke
|
|
1113
|
+
}, Ze = /^D+$/, et = /^Y+$/, tt = ["D", "DD", "YY", "YYYY"];
|
|
1114
|
+
function nt(e) {
|
|
1115
|
+
return Ze.test(e);
|
|
1116
1116
|
}
|
|
1117
|
-
function
|
|
1118
|
-
return
|
|
1117
|
+
function at(e) {
|
|
1118
|
+
return et.test(e);
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1121
|
-
const a =
|
|
1122
|
-
if (console.warn(a),
|
|
1120
|
+
function rt(e, t, n) {
|
|
1121
|
+
const a = it(e, t, n);
|
|
1122
|
+
if (console.warn(a), tt.includes(e)) throw new RangeError(a);
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1125
|
-
const a =
|
|
1126
|
-
return `Use \`${
|
|
1124
|
+
function it(e, t, n) {
|
|
1125
|
+
const a = e[0] === "Y" ? "years" : "days of the month";
|
|
1126
|
+
return `Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
1127
1127
|
}
|
|
1128
|
-
const
|
|
1129
|
-
function
|
|
1130
|
-
var x, l,
|
|
1131
|
-
const a =
|
|
1132
|
-
if (!
|
|
1128
|
+
const st = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, ot = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, ut = /^'([^]*?)'?$/, lt = /''/g, dt = /[a-zA-Z]/;
|
|
1129
|
+
function ct(e, t, n) {
|
|
1130
|
+
var x, l, p, h;
|
|
1131
|
+
const a = de(), r = a.locale ?? Ge, i = a.firstWeekContainsDate ?? ((l = (x = a.locale) == null ? void 0 : x.options) == null ? void 0 : l.firstWeekContainsDate) ?? 1, s = a.weekStartsOn ?? ((h = (p = a.locale) == null ? void 0 : p.options) == null ? void 0 : h.weekStartsOn) ?? 0, d = k(e);
|
|
1132
|
+
if (!me(d))
|
|
1133
1133
|
throw new RangeError("Invalid time value");
|
|
1134
|
-
let
|
|
1134
|
+
let y = t.match(ot).map((u) => {
|
|
1135
1135
|
const c = u[0];
|
|
1136
1136
|
if (c === "p" || c === "P") {
|
|
1137
|
-
const $ =
|
|
1137
|
+
const $ = ze[c];
|
|
1138
1138
|
return $(u, r.formatLong);
|
|
1139
1139
|
}
|
|
1140
1140
|
return u;
|
|
1141
|
-
}).join("").match(
|
|
1141
|
+
}).join("").match(st).map((u) => {
|
|
1142
1142
|
if (u === "''")
|
|
1143
1143
|
return { isToken: !1, value: "'" };
|
|
1144
1144
|
const c = u[0];
|
|
1145
1145
|
if (c === "'")
|
|
1146
|
-
return { isToken: !1, value:
|
|
1146
|
+
return { isToken: !1, value: ht(u) };
|
|
1147
1147
|
if (j[c])
|
|
1148
1148
|
return { isToken: !0, value: u };
|
|
1149
|
-
if (c.match(
|
|
1149
|
+
if (c.match(dt))
|
|
1150
1150
|
throw new RangeError(
|
|
1151
1151
|
"Format string contains an unescaped latin alphabet character `" + c + "`"
|
|
1152
1152
|
);
|
|
1153
1153
|
return { isToken: !1, value: u };
|
|
1154
1154
|
});
|
|
1155
|
-
r.localize.preprocessor && (
|
|
1155
|
+
r.localize.preprocessor && (y = r.localize.preprocessor(d, y));
|
|
1156
1156
|
const v = {
|
|
1157
1157
|
firstWeekContainsDate: i,
|
|
1158
1158
|
weekStartsOn: s,
|
|
1159
1159
|
locale: r
|
|
1160
1160
|
};
|
|
1161
|
-
return
|
|
1161
|
+
return y.map((u) => {
|
|
1162
1162
|
if (!u.isToken) return u.value;
|
|
1163
1163
|
const c = u.value;
|
|
1164
|
-
(
|
|
1164
|
+
(at(c) || nt(c)) && rt(c, t, String(e));
|
|
1165
1165
|
const $ = j[c[0]];
|
|
1166
1166
|
return $(d, c, r.localize, v);
|
|
1167
1167
|
}).join("");
|
|
1168
1168
|
}
|
|
1169
|
-
function
|
|
1170
|
-
const
|
|
1171
|
-
return
|
|
1169
|
+
function ht(e) {
|
|
1170
|
+
const t = e.match(ut);
|
|
1171
|
+
return t ? t[1].replace(lt, "'") : e;
|
|
1172
1172
|
}
|
|
1173
1173
|
/**
|
|
1174
1174
|
* @license
|
|
1175
1175
|
* Copyright 2017 Google LLC
|
|
1176
1176
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1177
1177
|
*/
|
|
1178
|
-
const Q = (
|
|
1178
|
+
const Q = (e, t, n) => {
|
|
1179
1179
|
const a = /* @__PURE__ */ new Map();
|
|
1180
|
-
for (let r =
|
|
1180
|
+
for (let r = t; r <= n; r++) a.set(e[r], r);
|
|
1181
1181
|
return a;
|
|
1182
|
-
},
|
|
1183
|
-
constructor(
|
|
1184
|
-
if (super(
|
|
1182
|
+
}, ft = Z(class extends ee {
|
|
1183
|
+
constructor(e) {
|
|
1184
|
+
if (super(e), e.type !== te.CHILD) throw Error("repeat() can only be used in text expressions");
|
|
1185
1185
|
}
|
|
1186
|
-
dt(
|
|
1186
|
+
dt(e, t, n) {
|
|
1187
1187
|
let a;
|
|
1188
|
-
n === void 0 ? n =
|
|
1188
|
+
n === void 0 ? n = t : t !== void 0 && (a = t);
|
|
1189
1189
|
const r = [], i = [];
|
|
1190
1190
|
let s = 0;
|
|
1191
|
-
for (const d of
|
|
1191
|
+
for (const d of e) r[s] = a ? a(d, s) : s, i[s] = n(d, s), s++;
|
|
1192
1192
|
return { values: i, keys: r };
|
|
1193
1193
|
}
|
|
1194
|
-
render(
|
|
1195
|
-
return this.dt(
|
|
1194
|
+
render(e, t, n) {
|
|
1195
|
+
return this.dt(e, t, n).values;
|
|
1196
1196
|
}
|
|
1197
|
-
update(
|
|
1198
|
-
const r =
|
|
1197
|
+
update(e, [t, n, a]) {
|
|
1198
|
+
const r = ae(e), { values: i, keys: s } = this.dt(t, n, a);
|
|
1199
1199
|
if (!Array.isArray(r)) return this.ut = s, i;
|
|
1200
|
-
const d = this.ut ?? (this.ut = []),
|
|
1201
|
-
let v, x, l = 0,
|
|
1202
|
-
for (; l <=
|
|
1203
|
-
else if (r[
|
|
1204
|
-
else if (d[l] === s[h])
|
|
1205
|
-
else if (d[
|
|
1206
|
-
else if (d[l] === s[u])
|
|
1207
|
-
else if (d[
|
|
1208
|
-
else if (v === void 0 && (v = Q(s, h, u), x = Q(d, l,
|
|
1200
|
+
const d = this.ut ?? (this.ut = []), y = [];
|
|
1201
|
+
let v, x, l = 0, p = r.length - 1, h = 0, u = i.length - 1;
|
|
1202
|
+
for (; l <= p && h <= u; ) if (r[l] === null) l++;
|
|
1203
|
+
else if (r[p] === null) p--;
|
|
1204
|
+
else if (d[l] === s[h]) y[h] = O(r[l], i[h]), l++, h++;
|
|
1205
|
+
else if (d[p] === s[u]) y[u] = O(r[p], i[u]), p--, u--;
|
|
1206
|
+
else if (d[l] === s[u]) y[u] = O(r[l], i[u]), S(e, y[u + 1], r[l]), l++, u--;
|
|
1207
|
+
else if (d[p] === s[h]) y[h] = O(r[p], i[h]), S(e, r[l], r[p]), p--, h++;
|
|
1208
|
+
else if (v === void 0 && (v = Q(s, h, u), x = Q(d, l, p)), v.has(d[l])) if (v.has(d[p])) {
|
|
1209
1209
|
const c = x.get(s[h]), $ = c !== void 0 ? r[c] : null;
|
|
1210
1210
|
if ($ === null) {
|
|
1211
|
-
const q = S(
|
|
1212
|
-
O(q, i[h]),
|
|
1213
|
-
} else
|
|
1211
|
+
const q = S(e, r[l]);
|
|
1212
|
+
O(q, i[h]), y[h] = q;
|
|
1213
|
+
} else y[h] = O($, i[h]), S(e, r[l], $), r[c] = null;
|
|
1214
1214
|
h++;
|
|
1215
|
-
} else Y(r[
|
|
1215
|
+
} else Y(r[p]), p--;
|
|
1216
1216
|
else Y(r[l]), l++;
|
|
1217
1217
|
for (; h <= u; ) {
|
|
1218
|
-
const c = S(
|
|
1219
|
-
O(c, i[h]),
|
|
1218
|
+
const c = S(e, y[u + 1]);
|
|
1219
|
+
O(c, i[h]), y[h++] = c;
|
|
1220
1220
|
}
|
|
1221
|
-
for (; l <=
|
|
1221
|
+
for (; l <= p; ) {
|
|
1222
1222
|
const c = r[l++];
|
|
1223
1223
|
c !== null && Y(c);
|
|
1224
1224
|
}
|
|
1225
|
-
return this.ut = s,
|
|
1225
|
+
return this.ut = s, re(e, y), K;
|
|
1226
1226
|
}
|
|
1227
|
-
}),
|
|
1227
|
+
}), mt = "pkt-datepicker", pt = !0, gt = {
|
|
1228
1228
|
name: {
|
|
1229
1229
|
type: "string",
|
|
1230
1230
|
name: "Navn",
|
|
@@ -1381,12 +1381,18 @@ const Q = (t, e, n) => {
|
|
|
1381
1381
|
default: "Valgfritt",
|
|
1382
1382
|
description: "Tekst som vises i valgfritt-merkingen"
|
|
1383
1383
|
},
|
|
1384
|
+
useWrapper: {
|
|
1385
|
+
type: "boolean",
|
|
1386
|
+
name: "Bruk wrapper",
|
|
1387
|
+
description: "Indikerer at feltet skal ha synlig label og hjelpetekst",
|
|
1388
|
+
default: !0
|
|
1389
|
+
},
|
|
1384
1390
|
id: {
|
|
1385
1391
|
type: "string",
|
|
1386
1392
|
name: "ID",
|
|
1387
1393
|
description: "Unik identifikasjon for datovelgeren"
|
|
1388
1394
|
}
|
|
1389
|
-
},
|
|
1395
|
+
}, yt = {
|
|
1390
1396
|
change: {
|
|
1391
1397
|
type: "Event",
|
|
1392
1398
|
description: "Returnerer valgt dato som streng i ISO-format"
|
|
@@ -1400,21 +1406,21 @@ const Q = (t, e, n) => {
|
|
|
1400
1406
|
description: "Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"
|
|
1401
1407
|
}
|
|
1402
1408
|
}, w = {
|
|
1403
|
-
name:
|
|
1409
|
+
name: mt,
|
|
1404
1410
|
"css-class": "pkt-datepicker",
|
|
1405
|
-
isElement:
|
|
1406
|
-
props:
|
|
1407
|
-
events:
|
|
1411
|
+
isElement: pt,
|
|
1412
|
+
props: gt,
|
|
1413
|
+
events: yt
|
|
1408
1414
|
};
|
|
1409
|
-
var
|
|
1410
|
-
for (var r = a > 1 ? void 0 : a ?
|
|
1411
|
-
(s =
|
|
1412
|
-
return a && r &&
|
|
1415
|
+
var vt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, m = (e, t, n, a) => {
|
|
1416
|
+
for (var r = a > 1 ? void 0 : a ? wt(t, n) : t, i = e.length - 1, s; i >= 0; i--)
|
|
1417
|
+
(s = e[i]) && (r = (a ? s(t, n, r) : s(r)) || r);
|
|
1418
|
+
return a && r && vt(t, n, r), r;
|
|
1413
1419
|
};
|
|
1414
|
-
const X = (
|
|
1420
|
+
const X = (e) => new Promise((t) => setTimeout(t, e));
|
|
1415
1421
|
let f = class extends z {
|
|
1416
1422
|
constructor() {
|
|
1417
|
-
super(...arguments), this.value = "", this._value = this.value ? Array.isArray(this.value) ? this.value : this.value.split(",") : [], this.label = "Datovelger", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = w.props.helptextDropdownButton.default, this.dateformat = w.props.dateformat.default, this.multiple = w.props.multiple.default, this.maxlength = w.props.maxlength.default, this.range = w.props.range.default, this.weeknumbers = w.props.weeknumbers.default, this.withcontrols = w.props.withcontrols.default, this.fullwidth = !1, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.calendarOpen = !1, this.inputRef = C(), this.inputRefTo = C(), this.btnRef = C(), this.calRef = C(), this.popupRef = C(), this.inputClasses = {
|
|
1423
|
+
super(...arguments), this.value = "", this._value = this.value ? Array.isArray(this.value) ? this.value : this.value.split(",") : [], this.label = "Datovelger", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = w.props.helptextDropdownButton.default, this.dateformat = w.props.dateformat.default, this.multiple = w.props.multiple.default, this.maxlength = w.props.maxlength.default, this.range = w.props.range.default, this.weeknumbers = w.props.weeknumbers.default, this.withcontrols = w.props.withcontrols.default, this.fullwidth = !1, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.useWrapper = !0, this.calendarOpen = !1, this.inputRef = C(), this.inputRefTo = C(), this.btnRef = C(), this.calRef = C(), this.popupRef = C(), this.inputClasses = {
|
|
1418
1424
|
"pkt-input": !0,
|
|
1419
1425
|
"pkt-datepicker__input": !0,
|
|
1420
1426
|
"pkt-input--fullwidth": this.fullwidth
|
|
@@ -1423,54 +1429,54 @@ let f = class extends z {
|
|
|
1423
1429
|
"pkt-btn": !0,
|
|
1424
1430
|
"pkt-btn--icon-only": !0,
|
|
1425
1431
|
"pkt-btn--tertiary": !0
|
|
1426
|
-
}, this.fromISOToDate = (
|
|
1427
|
-
if (!
|
|
1432
|
+
}, this.fromISOToDate = (e) => {
|
|
1433
|
+
if (!e)
|
|
1428
1434
|
return null;
|
|
1429
|
-
const
|
|
1430
|
-
return
|
|
1431
|
-
}, this.fromISOtoLocal = (
|
|
1432
|
-
const
|
|
1433
|
-
return isNaN(
|
|
1434
|
-
}, this.massageDates = (
|
|
1435
|
-
const
|
|
1436
|
-
return this.multiple ?
|
|
1437
|
-
}, this.addToSelected = (
|
|
1438
|
-
const
|
|
1439
|
-
r.setHours(12, 0, 0, 0), r && !isNaN(r.getTime()) && (!n || r >= n) && (!a || r <= a) && this.calRef.value && this.calRef.value.handleDateSelect(r),
|
|
1435
|
+
const t = new Date(e);
|
|
1436
|
+
return t.setHours(12, 0, 0, 0), isNaN(t.getTime()) ? null : t;
|
|
1437
|
+
}, this.fromISOtoLocal = (e) => {
|
|
1438
|
+
const t = new Date(e);
|
|
1439
|
+
return isNaN(t.getTime()) ? "" : ct(t, this.dateformat);
|
|
1440
|
+
}, this.massageDates = (e) => {
|
|
1441
|
+
const t = e.map((n) => n ?? void 0);
|
|
1442
|
+
return this.multiple ? t : this.range ? t.slice(0, 2) : [t[0]];
|
|
1443
|
+
}, this.addToSelected = (e) => {
|
|
1444
|
+
const t = e.target, n = this.min ? new Date(this.min) : null, a = this.max ? new Date(this.max) : null, r = new Date(t.value.split(",")[0]);
|
|
1445
|
+
r.setHours(12, 0, 0, 0), r && !isNaN(r.getTime()) && (!n || r >= n) && (!a || r <= a) && this.calRef.value && this.calRef.value.handleDateSelect(r), t.value = "";
|
|
1440
1446
|
};
|
|
1441
1447
|
}
|
|
1442
1448
|
/**
|
|
1443
1449
|
* Housekeeping / lifecycle methods
|
|
1444
1450
|
*/
|
|
1445
1451
|
async connectedCallback() {
|
|
1446
|
-
super.connectedCallback(), this.isMobileSafari = /iP(ad|od|hone)/i.test(window.navigator.userAgent) && !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/), this.inputType = this.isMobileSafari ? "text" : "date", document && document.body.addEventListener("click", (
|
|
1447
|
-
var
|
|
1448
|
-
(
|
|
1452
|
+
super.connectedCallback(), this.isMobileSafari = /iP(ad|od|hone)/i.test(window.navigator.userAgent) && !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/), this.inputType = this.isMobileSafari ? "text" : "date", document && document.body.addEventListener("click", (e) => {
|
|
1453
|
+
var t, n;
|
|
1454
|
+
(t = this.inputRef) != null && t.value && ((n = this.btnRef) != null && n.value) && !this.inputRef.value.contains(e.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(e.target)) && !this.btnRef.value.contains(e.target) && !e.target.closest(".pkt-calendar-popup") && this.calendarOpen && (this.onBlur(), this.hideCalendar());
|
|
1449
1455
|
}), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), this.min = this.min || w.props.min.default, this.max = this.max || w.props.max.default, typeof this.excludedates == "string" && (this.excludedates = this.excludedates.split(",")), typeof this.excludeweekdays == "string" && (this.excludeweekdays = this.excludeweekdays.split(",")), (this.multiple || this.range) && this.name && !this.name.endsWith("[]") && (this.name = this.name + "[]"), this.calendarOpen && (await X(20), this.handleCalendarPosition());
|
|
1450
1456
|
}
|
|
1451
1457
|
disconnectedCallback() {
|
|
1452
|
-
super.disconnectedCallback(), document && document.body.removeEventListener("click", (
|
|
1453
|
-
var
|
|
1454
|
-
(
|
|
1458
|
+
super.disconnectedCallback(), document && document.body.removeEventListener("click", (e) => {
|
|
1459
|
+
var t, n;
|
|
1460
|
+
(t = this.inputRef) != null && t.value && ((n = this.btnRef) != null && n.value) && !this.inputRef.value.contains(e.target) && !this.btnRef.value.contains(e.target) && this.hideCalendar();
|
|
1455
1461
|
});
|
|
1456
1462
|
}
|
|
1457
|
-
attributeChangedCallback(
|
|
1458
|
-
|
|
1463
|
+
attributeChangedCallback(e, t, n) {
|
|
1464
|
+
e === "value" && this.valueChanged(this.value, t), e === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = (n == null ? void 0 : n.split(",")) ?? []), e === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = (n == null ? void 0 : n.split(",")) ?? []), super.attributeChangedCallback(e, t, n);
|
|
1459
1465
|
}
|
|
1460
|
-
firstUpdated(
|
|
1461
|
-
super.firstUpdated(
|
|
1466
|
+
firstUpdated(e) {
|
|
1467
|
+
super.firstUpdated(e);
|
|
1462
1468
|
}
|
|
1463
|
-
updated(
|
|
1464
|
-
if (super.updated(
|
|
1469
|
+
updated(e) {
|
|
1470
|
+
if (super.updated(e), e.has("value")) {
|
|
1465
1471
|
if (this.range && this._value.length === 1) return;
|
|
1466
|
-
this.valueChanged(this.value,
|
|
1472
|
+
this.valueChanged(this.value, e.get("value"));
|
|
1467
1473
|
}
|
|
1468
1474
|
}
|
|
1469
1475
|
/**
|
|
1470
1476
|
* Date value manipulation
|
|
1471
1477
|
*/
|
|
1472
|
-
formatISODate(
|
|
1473
|
-
return
|
|
1478
|
+
formatISODate(e) {
|
|
1479
|
+
return e.toISOString().split("T")[0];
|
|
1474
1480
|
}
|
|
1475
1481
|
renderInput() {
|
|
1476
1482
|
return M`
|
|
@@ -1481,26 +1487,26 @@ let f = class extends z {
|
|
|
1481
1487
|
.value=${this._value[0] ?? ""}
|
|
1482
1488
|
min=${this.min}
|
|
1483
1489
|
max=${this.max}
|
|
1484
|
-
@click=${(
|
|
1485
|
-
|
|
1490
|
+
@click=${(e) => {
|
|
1491
|
+
e.preventDefault(), this.showCalendar();
|
|
1486
1492
|
}}
|
|
1487
1493
|
?disabled=${this.disabled}
|
|
1488
|
-
@keydown=${(
|
|
1489
|
-
var
|
|
1490
|
-
(
|
|
1494
|
+
@keydown=${(e) => {
|
|
1495
|
+
var t;
|
|
1496
|
+
(e.key === "," || e.key === "Enter") && ((t = this.inputRef.value) == null || t.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
|
|
1491
1497
|
}}
|
|
1492
|
-
@input=${(
|
|
1493
|
-
this.onInput(),
|
|
1498
|
+
@input=${(e) => {
|
|
1499
|
+
this.onInput(), e.stopImmediatePropagation();
|
|
1494
1500
|
}}
|
|
1495
1501
|
@focus=${() => {
|
|
1496
1502
|
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
1497
1503
|
}}
|
|
1498
|
-
@blur=${(
|
|
1499
|
-
var
|
|
1500
|
-
(
|
|
1504
|
+
@blur=${(e) => {
|
|
1505
|
+
var t;
|
|
1506
|
+
(t = this.calRef.value) != null && t.contains(e.relatedTarget) || this.onBlur(), this.manageValidity(e.target), this.value = e.target.value;
|
|
1501
1507
|
}}
|
|
1502
|
-
@change=${(
|
|
1503
|
-
|
|
1508
|
+
@change=${(e) => {
|
|
1509
|
+
e.stopImmediatePropagation();
|
|
1504
1510
|
}}
|
|
1505
1511
|
${P(this.inputRef)}
|
|
1506
1512
|
/>
|
|
@@ -1516,30 +1522,30 @@ let f = class extends z {
|
|
|
1516
1522
|
.value=${this._value[0] ?? ""}
|
|
1517
1523
|
min=${this.min}
|
|
1518
1524
|
max=${this.max}
|
|
1519
|
-
@click=${(
|
|
1520
|
-
|
|
1525
|
+
@click=${(e) => {
|
|
1526
|
+
e.preventDefault(), this.showCalendar();
|
|
1521
1527
|
}}
|
|
1522
1528
|
?disabled=${this.disabled}
|
|
1523
|
-
@keydown=${(
|
|
1524
|
-
var
|
|
1525
|
-
(
|
|
1529
|
+
@keydown=${(e) => {
|
|
1530
|
+
var t;
|
|
1531
|
+
(e.key === "," || e.key === "Enter") && ((t = this.inputRef.value) == null || t.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
|
|
1526
1532
|
}}
|
|
1527
|
-
@input=${(
|
|
1528
|
-
this.onInput(),
|
|
1533
|
+
@input=${(e) => {
|
|
1534
|
+
this.onInput(), e.stopImmediatePropagation();
|
|
1529
1535
|
}}
|
|
1530
1536
|
@focus=${() => {
|
|
1531
1537
|
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
1532
1538
|
}}
|
|
1533
|
-
@blur=${(
|
|
1534
|
-
var
|
|
1535
|
-
if (
|
|
1536
|
-
this.manageValidity(
|
|
1537
|
-
const a = this.fromISOToDate(
|
|
1538
|
-
a && this._value[0] !==
|
|
1539
|
+
@blur=${(e) => {
|
|
1540
|
+
var t, n;
|
|
1541
|
+
if (e.target.value) {
|
|
1542
|
+
this.manageValidity(e.target);
|
|
1543
|
+
const a = this.fromISOToDate(e.target.value);
|
|
1544
|
+
a && this._value[0] !== e.target.value && this._value[1] && (this.clearInputValue(), (n = (t = this.calRef) == null ? void 0 : t.value) == null || n.handleDateSelect(a));
|
|
1539
1545
|
} else this._value[0] && this.clearInputValue();
|
|
1540
1546
|
}}
|
|
1541
|
-
@change=${(
|
|
1542
|
-
|
|
1547
|
+
@change=${(e) => {
|
|
1548
|
+
e.stopImmediatePropagation();
|
|
1543
1549
|
}}
|
|
1544
1550
|
${P(this.inputRef)}
|
|
1545
1551
|
/>
|
|
@@ -1552,40 +1558,40 @@ let f = class extends z {
|
|
|
1552
1558
|
.value=${this._value[1] ?? ""}
|
|
1553
1559
|
min=${this.min}
|
|
1554
1560
|
max=${this.max}
|
|
1555
|
-
@click=${(
|
|
1556
|
-
|
|
1561
|
+
@click=${(e) => {
|
|
1562
|
+
e.preventDefault(), this.showCalendar();
|
|
1557
1563
|
}}
|
|
1558
1564
|
?disabled=${this.disabled}
|
|
1559
|
-
@keydown=${(
|
|
1560
|
-
var
|
|
1561
|
-
(
|
|
1565
|
+
@keydown=${(e) => {
|
|
1566
|
+
var t;
|
|
1567
|
+
(e.key === "," || e.key === "Enter") && ((t = this.inputRefTo.value) == null || t.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
|
|
1562
1568
|
}}
|
|
1563
|
-
@input=${(
|
|
1564
|
-
this.onInput(),
|
|
1569
|
+
@input=${(e) => {
|
|
1570
|
+
this.onInput(), e.stopImmediatePropagation();
|
|
1565
1571
|
}}
|
|
1566
1572
|
@focus=${() => {
|
|
1567
1573
|
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
1568
1574
|
}}
|
|
1569
|
-
@blur=${(
|
|
1570
|
-
var
|
|
1571
|
-
if ((
|
|
1572
|
-
this.manageValidity(
|
|
1573
|
-
const r =
|
|
1575
|
+
@blur=${(e) => {
|
|
1576
|
+
var t, n, a;
|
|
1577
|
+
if ((t = this.calRef.value) != null && t.contains(e.relatedTarget) || this.onBlur(), e.target.value) {
|
|
1578
|
+
this.manageValidity(e.target);
|
|
1579
|
+
const r = e.target.value;
|
|
1574
1580
|
this.min && this.min > r ? this.internals.setValidity(
|
|
1575
1581
|
{ rangeUnderflow: !0 },
|
|
1576
1582
|
this.strings.forms.messages.rangeUnderflow,
|
|
1577
|
-
|
|
1583
|
+
e.target
|
|
1578
1584
|
) : this.max && this.max < r && this.internals.setValidity(
|
|
1579
1585
|
{ rangeOverflow: !0 },
|
|
1580
1586
|
this.strings.forms.messages.rangeOverflow,
|
|
1581
|
-
|
|
1587
|
+
e.target
|
|
1582
1588
|
);
|
|
1583
|
-
const i = this.fromISOToDate(
|
|
1589
|
+
const i = this.fromISOToDate(e.target.value);
|
|
1584
1590
|
i && this._value[1] !== this.formatISODate(i) && ((a = (n = this.calRef) == null ? void 0 : n.value) == null || a.handleDateSelect(i));
|
|
1585
1591
|
}
|
|
1586
1592
|
}}
|
|
1587
|
-
@change=${(
|
|
1588
|
-
|
|
1593
|
+
@change=${(e) => {
|
|
1594
|
+
e.stopImmediatePropagation();
|
|
1589
1595
|
}}
|
|
1590
1596
|
${P(this.inputRefTo)}
|
|
1591
1597
|
/>
|
|
@@ -1599,25 +1605,25 @@ let f = class extends z {
|
|
|
1599
1605
|
id="${this.id}-input"
|
|
1600
1606
|
min=${this.min}
|
|
1601
1607
|
max=${this.max}
|
|
1602
|
-
@click=${(
|
|
1603
|
-
|
|
1608
|
+
@click=${(e) => {
|
|
1609
|
+
e.preventDefault(), this.showCalendar();
|
|
1604
1610
|
}}
|
|
1605
|
-
@blur=${(
|
|
1606
|
-
var
|
|
1607
|
-
(
|
|
1611
|
+
@blur=${(e) => {
|
|
1612
|
+
var t;
|
|
1613
|
+
(t = this.calRef.value) != null && t.contains(e.relatedTarget) || this.onBlur(), this.addToSelected(e);
|
|
1608
1614
|
}}
|
|
1609
|
-
@input=${(
|
|
1610
|
-
this.onInput(),
|
|
1615
|
+
@input=${(e) => {
|
|
1616
|
+
this.onInput(), e.stopImmediatePropagation();
|
|
1611
1617
|
}}
|
|
1612
1618
|
@focus=${() => {
|
|
1613
1619
|
this.onFocus(), this.isMobileSafari && this.showCalendar();
|
|
1614
1620
|
}}
|
|
1615
|
-
@keydown=${(
|
|
1616
|
-
(
|
|
1621
|
+
@keydown=${(e) => {
|
|
1622
|
+
(e.key === "," || e.key === "Enter") && (e.preventDefault(), this.addToSelected(e)), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
|
|
1617
1623
|
}}
|
|
1618
1624
|
?disabled=${this.disabled || this.maxlength && this._value.length >= this.maxlength}
|
|
1619
|
-
@change=${(
|
|
1620
|
-
|
|
1625
|
+
@change=${(e) => {
|
|
1626
|
+
e.stopImmediatePropagation();
|
|
1621
1627
|
}}
|
|
1622
1628
|
${P(this.inputRef)}
|
|
1623
1629
|
/>
|
|
@@ -1626,30 +1632,30 @@ let f = class extends z {
|
|
|
1626
1632
|
renderTags() {
|
|
1627
1633
|
return M`
|
|
1628
1634
|
<div class="pkt-datepicker__tags" aria-live="polite">
|
|
1629
|
-
${this._value[0] ?
|
|
1635
|
+
${this._value[0] ? ft(
|
|
1630
1636
|
this._value ?? [],
|
|
1631
|
-
(
|
|
1632
|
-
(
|
|
1637
|
+
(e) => e,
|
|
1638
|
+
(e) => M`
|
|
1633
1639
|
<pkt-tag
|
|
1634
|
-
.id="${this.id +
|
|
1640
|
+
.id="${this.id + e + "-tag"}"
|
|
1635
1641
|
closeTag
|
|
1636
|
-
ariaLabel="${this.strings.calendar.deleteDate} ${this.fromISOtoLocal(
|
|
1642
|
+
ariaLabel="${this.strings.calendar.deleteDate} ${this.fromISOtoLocal(e)}"
|
|
1637
1643
|
@close=${() => {
|
|
1638
|
-
var
|
|
1639
|
-
return (
|
|
1644
|
+
var t;
|
|
1645
|
+
return (t = this.calRef.value) == null ? void 0 : t.handleDateSelect(this.fromISOToDate(e));
|
|
1640
1646
|
}}
|
|
1641
|
-
>${this.fromISOtoLocal(
|
|
1647
|
+
>${this.fromISOtoLocal(e)}</pkt-tag
|
|
1642
1648
|
>
|
|
1643
1649
|
`
|
|
1644
|
-
) :
|
|
1650
|
+
) : B}
|
|
1645
1651
|
</div>
|
|
1646
1652
|
`;
|
|
1647
1653
|
}
|
|
1648
1654
|
renderCalendar() {
|
|
1649
1655
|
return M`<div
|
|
1650
1656
|
class="pkt-calendar-popup pkt-${this.calendarOpen ? "show" : "hide"}"
|
|
1651
|
-
@focusout=${(
|
|
1652
|
-
this.calendarOpen && this.handleFocusOut(
|
|
1657
|
+
@focusout=${(e) => {
|
|
1658
|
+
this.calendarOpen && this.handleFocusOut(e);
|
|
1653
1659
|
}}
|
|
1654
1660
|
id="${this.id}-popup"
|
|
1655
1661
|
${P(this.popupRef)}
|
|
@@ -1667,8 +1673,8 @@ let f = class extends z {
|
|
|
1667
1673
|
.excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
|
|
1668
1674
|
.excludeweekdays=${this.excludeweekdays}
|
|
1669
1675
|
.currentmonth=${this.currentmonth ? new Date(this.currentmonth) : null}
|
|
1670
|
-
@date-selected=${(
|
|
1671
|
-
this.value = !this.multiple && !this.range ?
|
|
1676
|
+
@date-selected=${(e) => {
|
|
1677
|
+
this.value = !this.multiple && !this.range ? e.detail[0] : e.detail, this._value = e.detail, this.inputRef.value && (this.range && this.inputRefTo.value ? (this.inputRef.value.value = this._value[0] ?? "", this.inputRefTo.value.value = this._value[1] ?? "") : this.multiple || (this.inputRef.value.value = this._value.length ? this._value[0] : ""));
|
|
1672
1678
|
}}
|
|
1673
1679
|
@close=${() => {
|
|
1674
1680
|
this.onBlur(), this.hideCalendar();
|
|
@@ -1690,7 +1696,7 @@ let f = class extends z {
|
|
|
1690
1696
|
?required=${this.required}
|
|
1691
1697
|
?optionalTag=${this.optionalTag}
|
|
1692
1698
|
?requiredTag=${this.requiredTag}
|
|
1693
|
-
?
|
|
1699
|
+
?useWrapper=${this.useWrapper}
|
|
1694
1700
|
.optionalText=${this.optionalText}
|
|
1695
1701
|
.requiredText=${this.requiredText}
|
|
1696
1702
|
.errorMessage=${this.errorMessage}
|
|
@@ -1699,7 +1705,7 @@ let f = class extends z {
|
|
|
1699
1705
|
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
1700
1706
|
class="pkt-datepicker"
|
|
1701
1707
|
>
|
|
1702
|
-
${this.multiple ? this.renderTags() :
|
|
1708
|
+
${this.multiple ? this.renderTags() : B}
|
|
1703
1709
|
<div class="pkt-datepicker__inputs ${this.range ? "pkt-input__range-inputs" : ""}">
|
|
1704
1710
|
<div class="pkt-input__container">
|
|
1705
1711
|
${this.range ? this.renderRangeInput() : this.multiple ? this.renderMultipleInput() : this.renderInput()}
|
|
@@ -1723,80 +1729,83 @@ let f = class extends z {
|
|
|
1723
1729
|
* Handlers
|
|
1724
1730
|
*/
|
|
1725
1731
|
handleCalendarPosition() {
|
|
1726
|
-
var
|
|
1732
|
+
var e;
|
|
1727
1733
|
if (this.popupRef.value && this.inputRef.value) {
|
|
1728
|
-
const
|
|
1729
|
-
let i =
|
|
1734
|
+
const t = this.multiple && !!this.maxlength, n = ((e = this.inputRef.value.parentElement) == null ? void 0 : e.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(), a = t ? n.height + 30 : n.height, r = this.popupRef.value.getBoundingClientRect().height;
|
|
1735
|
+
let i = t ? "calc(100% - 30px)" : "100%";
|
|
1730
1736
|
n && n.top + r > window.innerHeight && n.top - r > 0 && (i = `calc(100% - ${a}px - ${r}px)`), this.popupRef.value.style.top = i;
|
|
1731
1737
|
}
|
|
1732
1738
|
}
|
|
1733
|
-
handleFocusOut(
|
|
1734
|
-
this.contains(
|
|
1739
|
+
handleFocusOut(e) {
|
|
1740
|
+
this.contains(e.target) || (this.onBlur(), this.hideCalendar());
|
|
1735
1741
|
}
|
|
1736
1742
|
async showCalendar() {
|
|
1737
|
-
var
|
|
1738
|
-
this.calendarOpen = !0, await X(20), this.handleCalendarPosition(), this.isMobileSafari && ((
|
|
1743
|
+
var e;
|
|
1744
|
+
this.calendarOpen = !0, await X(20), this.handleCalendarPosition(), this.isMobileSafari && ((e = this.calRef.value) == null || e.focusOnCurrentDate());
|
|
1739
1745
|
}
|
|
1740
1746
|
hideCalendar() {
|
|
1741
1747
|
this.calendarOpen = !1;
|
|
1742
1748
|
}
|
|
1743
|
-
async toggleCalendar(
|
|
1744
|
-
|
|
1749
|
+
async toggleCalendar(e) {
|
|
1750
|
+
e.preventDefault(), this.calendarOpen ? this.hideCalendar() : this.showCalendar();
|
|
1745
1751
|
}
|
|
1746
1752
|
};
|
|
1747
|
-
|
|
1748
|
-
|
|
1753
|
+
m([
|
|
1754
|
+
g({ type: String, reflect: !0 })
|
|
1749
1755
|
], f.prototype, "value", 2);
|
|
1750
|
-
|
|
1751
|
-
|
|
1756
|
+
m([
|
|
1757
|
+
g({ type: Array, reflect: !1 })
|
|
1752
1758
|
], f.prototype, "_value", 2);
|
|
1753
|
-
|
|
1754
|
-
|
|
1759
|
+
m([
|
|
1760
|
+
g({ type: String })
|
|
1755
1761
|
], f.prototype, "label", 2);
|
|
1756
|
-
|
|
1757
|
-
|
|
1762
|
+
m([
|
|
1763
|
+
g({ type: String })
|
|
1758
1764
|
], f.prototype, "helptext", 2);
|
|
1759
|
-
|
|
1760
|
-
|
|
1765
|
+
m([
|
|
1766
|
+
g({ type: String })
|
|
1761
1767
|
], f.prototype, "helptextDropdown", 2);
|
|
1762
|
-
|
|
1763
|
-
|
|
1768
|
+
m([
|
|
1769
|
+
g({ type: String })
|
|
1764
1770
|
], f.prototype, "helptextDropdownButton", 2);
|
|
1765
|
-
|
|
1766
|
-
|
|
1771
|
+
m([
|
|
1772
|
+
g({ type: String })
|
|
1767
1773
|
], f.prototype, "dateformat", 2);
|
|
1768
|
-
|
|
1769
|
-
|
|
1774
|
+
m([
|
|
1775
|
+
g({ type: Boolean, reflect: !0 })
|
|
1770
1776
|
], f.prototype, "multiple", 2);
|
|
1771
|
-
|
|
1772
|
-
|
|
1777
|
+
m([
|
|
1778
|
+
g({ type: Number })
|
|
1773
1779
|
], f.prototype, "maxlength", 2);
|
|
1774
|
-
|
|
1775
|
-
|
|
1780
|
+
m([
|
|
1781
|
+
g({ type: Boolean, reflect: !0 })
|
|
1776
1782
|
], f.prototype, "range", 2);
|
|
1777
|
-
|
|
1778
|
-
|
|
1783
|
+
m([
|
|
1784
|
+
g({ type: Boolean })
|
|
1779
1785
|
], f.prototype, "weeknumbers", 2);
|
|
1780
|
-
|
|
1781
|
-
|
|
1786
|
+
m([
|
|
1787
|
+
g({ type: Boolean })
|
|
1782
1788
|
], f.prototype, "withcontrols", 2);
|
|
1783
|
-
|
|
1784
|
-
|
|
1789
|
+
m([
|
|
1790
|
+
g({ type: Boolean })
|
|
1785
1791
|
], f.prototype, "fullwidth", 2);
|
|
1786
|
-
|
|
1787
|
-
|
|
1792
|
+
m([
|
|
1793
|
+
g({ converter: G.csvToArray })
|
|
1788
1794
|
], f.prototype, "excludedates", 2);
|
|
1789
|
-
|
|
1790
|
-
|
|
1795
|
+
m([
|
|
1796
|
+
g({ converter: G.csvToArray })
|
|
1791
1797
|
], f.prototype, "excludeweekdays", 2);
|
|
1792
|
-
|
|
1793
|
-
|
|
1798
|
+
m([
|
|
1799
|
+
g({ type: String })
|
|
1794
1800
|
], f.prototype, "currentmonth", 2);
|
|
1795
|
-
|
|
1796
|
-
|
|
1801
|
+
m([
|
|
1802
|
+
g({ type: Boolean })
|
|
1803
|
+
], f.prototype, "useWrapper", 2);
|
|
1804
|
+
m([
|
|
1805
|
+
g({ type: Boolean, reflect: !0 })
|
|
1797
1806
|
], f.prototype, "calendarOpen", 2);
|
|
1798
|
-
f =
|
|
1799
|
-
|
|
1807
|
+
f = m([
|
|
1808
|
+
ne("pkt-datepicker")
|
|
1800
1809
|
], f);
|
|
1801
1810
|
export {
|
|
1802
1811
|
f as PktDatepicker
|