@oslokommune/punkt-elements 12.3.1 → 12.3.2
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/{class-map-DiT0qP3E.js → class-map-CEzmgstO.js} +1 -1
- package/dist/{class-map-CA8wadiN.cjs → class-map-DfznHRRW.cjs} +1 -1
- package/dist/{index-DSplpVWQ.cjs → index-BCVyjeWS.cjs} +1 -1
- package/dist/{index-CPvZ03uX.js → index-BkKs8Yam.js} +52 -53
- package/dist/index-BkqOsymS.cjs +90 -0
- package/dist/{index-BlHnvy7v.js → index-C7OaW8f8.js} +1 -1
- package/dist/{index-BHzxfdBK.js → index-CINnuWkG.js} +113 -97
- package/dist/{index-BJ_4AGO3.cjs → index-CkBUiPHx.cjs} +10 -6
- package/dist/index.d.ts +2 -0
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +4 -4
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +5 -6
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +4 -4
- package/dist/pkt-component-template.cjs +1 -1
- package/dist/pkt-component-template.js +3 -3
- package/dist/pkt-datepicker.cjs +3 -3
- package/dist/pkt-datepicker.js +444 -442
- package/dist/pkt-element.cjs +1 -1
- package/dist/pkt-element.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +2 -2
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +2 -2
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +4 -4
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +4 -4
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +4 -4
- package/dist/pkt-tag.cjs +2 -2
- package/dist/pkt-tag.js +18 -19
- package/dist/{ref-Bk590hog.cjs → ref-BkUqMgQu.cjs} +1 -1
- package/dist/{ref-Co_S0Cgj.js → ref-Cau3ksvI.js} +1 -1
- package/package.json +2 -2
- package/src/components/datepicker/index.ts +13 -11
- package/src/components/element/index.ts +7 -1
- package/dist/index-DkGcZra2.cjs +0 -90
- package/dist/state-BRgFbJX9.js +0 -12
- package/dist/state-D2tUtTi6.cjs +0 -5
package/dist/pkt-datepicker.js
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { R as K, a as z, k as P, D as N, n as y } from "./index-
|
|
2
|
-
import { e as Z, i as
|
|
3
|
-
import { u as
|
|
4
|
-
import { R as C } from "./class-map-
|
|
1
|
+
import { R as K, a as z, k as P, D as N, n as y } from "./index-CINnuWkG.js";
|
|
2
|
+
import { e as Z, i as tt, a as et, t as nt } from "./directive-DA0-wdk7.js";
|
|
3
|
+
import { u as at, c as M, a as S, p as F, d as rt, i as R, K as $ } from "./ref-Cau3ksvI.js";
|
|
4
|
+
import { R as C } from "./class-map-CEzmgstO.js";
|
|
5
5
|
import { a as G } from "./converters-DNCwIFwr.js";
|
|
6
|
-
import { s as
|
|
6
|
+
import { s as it, t as k, c as _, m as st, a as ot, g as ut, b as lt, d as dt } from "./index-BkKs8Yam.js";
|
|
7
7
|
import "./pkt-input-wrapper.js";
|
|
8
|
-
import "./index-
|
|
8
|
+
import "./index-C7OaW8f8.js";
|
|
9
9
|
import "./pkt-tag.js";
|
|
10
|
-
function Y(
|
|
11
|
-
return
|
|
10
|
+
function Y(t) {
|
|
11
|
+
return it(t, { weekStartsOn: 1 });
|
|
12
12
|
}
|
|
13
|
-
function U(
|
|
14
|
-
const
|
|
13
|
+
function U(t) {
|
|
14
|
+
const e = k(t), n = e.getFullYear(), a = _(t, 0);
|
|
15
15
|
a.setFullYear(n + 1, 0, 4), a.setHours(0, 0, 0, 0);
|
|
16
|
-
const r = Y(a), i = _(
|
|
16
|
+
const r = Y(a), i = _(t, 0);
|
|
17
17
|
i.setFullYear(n, 0, 4), i.setHours(0, 0, 0, 0);
|
|
18
18
|
const s = Y(i);
|
|
19
|
-
return
|
|
19
|
+
return e.getTime() >= r.getTime() ? n + 1 : e.getTime() >= s.getTime() ? n : n - 1;
|
|
20
20
|
}
|
|
21
|
-
function A(
|
|
22
|
-
const
|
|
23
|
-
return
|
|
21
|
+
function A(t) {
|
|
22
|
+
const e = k(t);
|
|
23
|
+
return e.setHours(0, 0, 0, 0), e;
|
|
24
24
|
}
|
|
25
|
-
function B(
|
|
26
|
-
const
|
|
25
|
+
function B(t) {
|
|
26
|
+
const e = k(t), n = new Date(
|
|
27
27
|
Date.UTC(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
e.getFullYear(),
|
|
29
|
+
e.getMonth(),
|
|
30
|
+
e.getDate(),
|
|
31
|
+
e.getHours(),
|
|
32
|
+
e.getMinutes(),
|
|
33
|
+
e.getSeconds(),
|
|
34
|
+
e.getMilliseconds()
|
|
35
35
|
)
|
|
36
36
|
);
|
|
37
|
-
return n.setUTCFullYear(
|
|
37
|
+
return n.setUTCFullYear(e.getFullYear()), +t - +n;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
const n = A(
|
|
41
|
-
return Math.round((r - i) /
|
|
39
|
+
function ct(t, e) {
|
|
40
|
+
const n = A(t), a = A(e), r = +n - B(n), i = +a - B(a);
|
|
41
|
+
return Math.round((r - i) / st);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
const
|
|
45
|
-
return n.setFullYear(
|
|
43
|
+
function ht(t) {
|
|
44
|
+
const e = U(t), n = _(t, 0);
|
|
45
|
+
return n.setFullYear(e, 0, 4), n.setHours(0, 0, 0, 0), Y(n);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
47
|
+
function mt(t) {
|
|
48
|
+
return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]";
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
if (!
|
|
50
|
+
function ft(t) {
|
|
51
|
+
if (!mt(t) && typeof t != "number")
|
|
52
52
|
return !1;
|
|
53
|
-
const
|
|
54
|
-
return !isNaN(Number(
|
|
53
|
+
const e = k(t);
|
|
54
|
+
return !isNaN(Number(e));
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
return n.setFullYear(
|
|
56
|
+
function pt(t) {
|
|
57
|
+
const e = k(t), n = _(t, 0);
|
|
58
|
+
return n.setFullYear(e.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const gt = {
|
|
61
61
|
lessThanXSeconds: {
|
|
62
62
|
one: "less than a second",
|
|
63
63
|
other: "less than {{count}} seconds"
|
|
@@ -119,77 +119,77 @@ const ge = {
|
|
|
119
119
|
one: "almost 1 year",
|
|
120
120
|
other: "almost {{count}} years"
|
|
121
121
|
}
|
|
122
|
-
},
|
|
122
|
+
}, yt = (t, e, n) => {
|
|
123
123
|
let a;
|
|
124
|
-
const r =
|
|
125
|
-
return typeof r == "string" ? a = r :
|
|
124
|
+
const r = gt[t];
|
|
125
|
+
return typeof r == "string" ? a = r : e === 1 ? a = r.one : a = r.other.replace("{{count}}", e.toString()), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "in " + a : a + " ago" : a;
|
|
126
126
|
};
|
|
127
|
-
function
|
|
128
|
-
return (
|
|
129
|
-
const n =
|
|
130
|
-
return
|
|
127
|
+
function q(t) {
|
|
128
|
+
return (e = {}) => {
|
|
129
|
+
const n = e.width ? String(e.width) : t.defaultWidth;
|
|
130
|
+
return t.formats[n] || t.formats[t.defaultWidth];
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
|
-
const
|
|
133
|
+
const vt = {
|
|
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
|
+
}, wt = {
|
|
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
|
+
}, bt = {
|
|
144
144
|
full: "{{date}} 'at' {{time}}",
|
|
145
145
|
long: "{{date}} 'at' {{time}}",
|
|
146
146
|
medium: "{{date}}, {{time}}",
|
|
147
147
|
short: "{{date}}, {{time}}"
|
|
148
|
-
},
|
|
149
|
-
date:
|
|
150
|
-
formats:
|
|
148
|
+
}, kt = {
|
|
149
|
+
date: q({
|
|
150
|
+
formats: vt,
|
|
151
151
|
defaultWidth: "full"
|
|
152
152
|
}),
|
|
153
|
-
time:
|
|
154
|
-
formats:
|
|
153
|
+
time: q({
|
|
154
|
+
formats: wt,
|
|
155
155
|
defaultWidth: "full"
|
|
156
156
|
}),
|
|
157
|
-
dateTime:
|
|
158
|
-
formats:
|
|
157
|
+
dateTime: q({
|
|
158
|
+
formats: bt,
|
|
159
159
|
defaultWidth: "full"
|
|
160
160
|
})
|
|
161
|
-
},
|
|
161
|
+
}, xt = {
|
|
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 W(
|
|
170
|
-
return (
|
|
168
|
+
}, Ot = (t, e, n, a) => xt[t];
|
|
169
|
+
function W(t) {
|
|
170
|
+
return (e, 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" && t.formattingValues) {
|
|
174
|
+
const s = t.defaultFormattingWidth || t.defaultWidth, d = n != null && n.width ? String(n.width) : s;
|
|
175
|
+
r = t.formattingValues[d] || t.formattingValues[s];
|
|
176
176
|
} else {
|
|
177
|
-
const s =
|
|
178
|
-
r =
|
|
177
|
+
const s = t.defaultWidth, d = n != null && n.width ? String(n.width) : t.defaultWidth;
|
|
178
|
+
r = t.values[d] || t.values[s];
|
|
179
179
|
}
|
|
180
|
-
const i =
|
|
180
|
+
const i = t.argumentCallback ? t.argumentCallback(e) : e;
|
|
181
181
|
return r[i];
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
const
|
|
184
|
+
const Pt = {
|
|
185
185
|
narrow: ["B", "A"],
|
|
186
186
|
abbreviated: ["BC", "AD"],
|
|
187
187
|
wide: ["Before Christ", "Anno Domini"]
|
|
188
|
-
},
|
|
188
|
+
}, Mt = {
|
|
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
|
+
}, $t = {
|
|
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 Pe = {
|
|
|
219
219
|
"November",
|
|
220
220
|
"December"
|
|
221
221
|
]
|
|
222
|
-
},
|
|
222
|
+
}, Dt = {
|
|
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 Pe = {
|
|
|
232
232
|
"Friday",
|
|
233
233
|
"Saturday"
|
|
234
234
|
]
|
|
235
|
-
},
|
|
235
|
+
}, Tt = {
|
|
236
236
|
narrow: {
|
|
237
237
|
am: "a",
|
|
238
238
|
pm: "p",
|
|
@@ -263,7 +263,7 @@ const Pe = {
|
|
|
263
263
|
evening: "evening",
|
|
264
264
|
night: "night"
|
|
265
265
|
}
|
|
266
|
-
},
|
|
266
|
+
}, St = {
|
|
267
267
|
narrow: {
|
|
268
268
|
am: "a",
|
|
269
269
|
pm: "p",
|
|
@@ -294,8 +294,8 @@ const Pe = {
|
|
|
294
294
|
evening: "in the evening",
|
|
295
295
|
night: "at night"
|
|
296
296
|
}
|
|
297
|
-
},
|
|
298
|
-
const n = Number(
|
|
297
|
+
}, Rt = (t, e) => {
|
|
298
|
+
const n = Number(t), a = n % 100;
|
|
299
299
|
if (a > 20 || a < 10)
|
|
300
300
|
switch (a % 10) {
|
|
301
301
|
case 1:
|
|
@@ -306,89 +306,89 @@ const Pe = {
|
|
|
306
306
|
return n + "rd";
|
|
307
307
|
}
|
|
308
308
|
return n + "th";
|
|
309
|
-
},
|
|
310
|
-
ordinalNumber:
|
|
309
|
+
}, Ct = {
|
|
310
|
+
ordinalNumber: Rt,
|
|
311
311
|
era: W({
|
|
312
|
-
values:
|
|
312
|
+
values: Pt,
|
|
313
313
|
defaultWidth: "wide"
|
|
314
314
|
}),
|
|
315
315
|
quarter: W({
|
|
316
|
-
values:
|
|
316
|
+
values: Mt,
|
|
317
317
|
defaultWidth: "wide",
|
|
318
|
-
argumentCallback: (
|
|
318
|
+
argumentCallback: (t) => t - 1
|
|
319
319
|
}),
|
|
320
320
|
month: W({
|
|
321
|
-
values: $
|
|
321
|
+
values: $t,
|
|
322
322
|
defaultWidth: "wide"
|
|
323
323
|
}),
|
|
324
324
|
day: W({
|
|
325
|
-
values:
|
|
325
|
+
values: Dt,
|
|
326
326
|
defaultWidth: "wide"
|
|
327
327
|
}),
|
|
328
328
|
dayPeriod: W({
|
|
329
|
-
values:
|
|
329
|
+
values: Tt,
|
|
330
330
|
defaultWidth: "wide",
|
|
331
|
-
formattingValues:
|
|
331
|
+
formattingValues: St,
|
|
332
332
|
defaultFormattingWidth: "wide"
|
|
333
333
|
})
|
|
334
334
|
};
|
|
335
|
-
function E(
|
|
336
|
-
return (
|
|
337
|
-
const a = n.width, r = a &&
|
|
335
|
+
function E(t) {
|
|
336
|
+
return (e, n = {}) => {
|
|
337
|
+
const a = n.width, r = a && t.matchPatterns[a] || t.matchPatterns[t.defaultMatchWidth], i = e.match(r);
|
|
338
338
|
if (!i)
|
|
339
339
|
return null;
|
|
340
|
-
const s = i[0], d = a &&
|
|
340
|
+
const s = i[0], d = a && t.parsePatterns[a] || t.parsePatterns[t.defaultParseWidth], g = Array.isArray(d) ? Et(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
|
+
Wt(d, (l) => l.test(s))
|
|
343
343
|
);
|
|
344
344
|
let v;
|
|
345
|
-
v =
|
|
345
|
+
v = t.valueCallback ? t.valueCallback(g) : g, 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 = e.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 Wt(t, e) {
|
|
354
|
+
for (const n in t)
|
|
355
|
+
if (Object.prototype.hasOwnProperty.call(t, n) && e(t[n]))
|
|
356
356
|
return n;
|
|
357
357
|
}
|
|
358
|
-
function
|
|
359
|
-
for (let n = 0; n <
|
|
360
|
-
if (t
|
|
358
|
+
function Et(t, e) {
|
|
359
|
+
for (let n = 0; n < t.length; n++)
|
|
360
|
+
if (e(t[n]))
|
|
361
361
|
return n;
|
|
362
362
|
}
|
|
363
|
-
function
|
|
364
|
-
return (
|
|
365
|
-
const a =
|
|
363
|
+
function _t(t) {
|
|
364
|
+
return (e, n = {}) => {
|
|
365
|
+
const a = e.match(t.matchPattern);
|
|
366
366
|
if (!a) return null;
|
|
367
|
-
const r = a[0], i =
|
|
367
|
+
const r = a[0], i = e.match(t.parsePattern);
|
|
368
368
|
if (!i) return null;
|
|
369
|
-
let s =
|
|
369
|
+
let s = t.valueCallback ? t.valueCallback(i[0]) : i[0];
|
|
370
370
|
s = n.valueCallback ? n.valueCallback(s) : s;
|
|
371
|
-
const d =
|
|
371
|
+
const d = e.slice(r.length);
|
|
372
372
|
return { value: s, rest: d };
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
|
-
const
|
|
375
|
+
const Yt = /^(\d+)(th|st|nd|rd)?/i, Ft = /\d+/i, qt = {
|
|
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
|
+
}, It = {
|
|
380
380
|
any: [/^b/i, /^(a|c)/i]
|
|
381
|
-
},
|
|
381
|
+
}, Nt = {
|
|
382
382
|
narrow: /^[1234]/i,
|
|
383
383
|
abbreviated: /^q[1234]/i,
|
|
384
384
|
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
385
|
-
},
|
|
385
|
+
}, At = {
|
|
386
386
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|
387
|
-
},
|
|
387
|
+
}, Bt = {
|
|
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
|
+
}, Ht = {
|
|
392
392
|
narrow: [
|
|
393
393
|
/^j/i,
|
|
394
394
|
/^f/i,
|
|
@@ -417,18 +417,18 @@ const Ye = /^(\d+)(th|st|nd|rd)?/i, qe = /\d+/i, Fe = {
|
|
|
417
417
|
/^n/i,
|
|
418
418
|
/^d/i
|
|
419
419
|
]
|
|
420
|
-
},
|
|
420
|
+
}, jt = {
|
|
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
|
+
}, Vt = {
|
|
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
|
+
}, Lt = {
|
|
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
|
+
}, Qt = {
|
|
432
432
|
any: {
|
|
433
433
|
am: /^a/i,
|
|
434
434
|
pm: /^p/i,
|
|
@@ -439,86 +439,86 @@ const Ye = /^(\d+)(th|st|nd|rd)?/i, qe = /\d+/i, Fe = {
|
|
|
439
439
|
evening: /evening/i,
|
|
440
440
|
night: /night/i
|
|
441
441
|
}
|
|
442
|
-
},
|
|
443
|
-
ordinalNumber:
|
|
444
|
-
matchPattern:
|
|
445
|
-
parsePattern:
|
|
446
|
-
valueCallback: (
|
|
442
|
+
}, Xt = {
|
|
443
|
+
ordinalNumber: _t({
|
|
444
|
+
matchPattern: Yt,
|
|
445
|
+
parsePattern: Ft,
|
|
446
|
+
valueCallback: (t) => parseInt(t, 10)
|
|
447
447
|
}),
|
|
448
448
|
era: E({
|
|
449
|
-
matchPatterns:
|
|
449
|
+
matchPatterns: qt,
|
|
450
450
|
defaultMatchWidth: "wide",
|
|
451
|
-
parsePatterns:
|
|
451
|
+
parsePatterns: It,
|
|
452
452
|
defaultParseWidth: "any"
|
|
453
453
|
}),
|
|
454
454
|
quarter: E({
|
|
455
|
-
matchPatterns:
|
|
455
|
+
matchPatterns: Nt,
|
|
456
456
|
defaultMatchWidth: "wide",
|
|
457
|
-
parsePatterns:
|
|
457
|
+
parsePatterns: At,
|
|
458
458
|
defaultParseWidth: "any",
|
|
459
|
-
valueCallback: (
|
|
459
|
+
valueCallback: (t) => t + 1
|
|
460
460
|
}),
|
|
461
461
|
month: E({
|
|
462
|
-
matchPatterns:
|
|
462
|
+
matchPatterns: Bt,
|
|
463
463
|
defaultMatchWidth: "wide",
|
|
464
|
-
parsePatterns:
|
|
464
|
+
parsePatterns: Ht,
|
|
465
465
|
defaultParseWidth: "any"
|
|
466
466
|
}),
|
|
467
467
|
day: E({
|
|
468
|
-
matchPatterns:
|
|
468
|
+
matchPatterns: jt,
|
|
469
469
|
defaultMatchWidth: "wide",
|
|
470
|
-
parsePatterns:
|
|
470
|
+
parsePatterns: Vt,
|
|
471
471
|
defaultParseWidth: "any"
|
|
472
472
|
}),
|
|
473
473
|
dayPeriod: E({
|
|
474
|
-
matchPatterns:
|
|
474
|
+
matchPatterns: Lt,
|
|
475
475
|
defaultMatchWidth: "any",
|
|
476
|
-
parsePatterns:
|
|
476
|
+
parsePatterns: Qt,
|
|
477
477
|
defaultParseWidth: "any"
|
|
478
478
|
})
|
|
479
|
-
},
|
|
479
|
+
}, Gt = {
|
|
480
480
|
code: "en-US",
|
|
481
|
-
formatDistance:
|
|
482
|
-
formatLong:
|
|
483
|
-
formatRelative:
|
|
484
|
-
localize:
|
|
485
|
-
match:
|
|
481
|
+
formatDistance: yt,
|
|
482
|
+
formatLong: kt,
|
|
483
|
+
formatRelative: Ot,
|
|
484
|
+
localize: Ct,
|
|
485
|
+
match: Xt,
|
|
486
486
|
options: {
|
|
487
487
|
weekStartsOn: 0,
|
|
488
488
|
firstWeekContainsDate: 1
|
|
489
489
|
}
|
|
490
490
|
};
|
|
491
|
-
function
|
|
492
|
-
const
|
|
493
|
-
return
|
|
491
|
+
function Ut(t) {
|
|
492
|
+
const e = k(t);
|
|
493
|
+
return ct(e, pt(e)) + 1;
|
|
494
494
|
}
|
|
495
|
-
function
|
|
496
|
-
const
|
|
497
|
-
return Math.round(n /
|
|
495
|
+
function Jt(t) {
|
|
496
|
+
const e = k(t), n = +Y(e) - +ht(e);
|
|
497
|
+
return Math.round(n / ot) + 1;
|
|
498
498
|
}
|
|
499
|
-
function o(
|
|
500
|
-
const n =
|
|
499
|
+
function o(t, e) {
|
|
500
|
+
const n = t < 0 ? "-" : "", a = Math.abs(t).toString().padStart(e, "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(t, e) {
|
|
506
|
+
const n = t.getFullYear(), a = n > 0 ? n : 1 - n;
|
|
507
|
+
return o(e === "yy" ? a % 100 : a, e.length);
|
|
508
508
|
},
|
|
509
509
|
// Month
|
|
510
|
-
M(
|
|
511
|
-
const n =
|
|
512
|
-
return
|
|
510
|
+
M(t, e) {
|
|
511
|
+
const n = t.getMonth();
|
|
512
|
+
return e === "M" ? String(n + 1) : o(n + 1, 2);
|
|
513
513
|
},
|
|
514
514
|
// Day of the month
|
|
515
|
-
d(
|
|
516
|
-
return o(
|
|
515
|
+
d(t, e) {
|
|
516
|
+
return o(t.getDate(), e.length);
|
|
517
517
|
},
|
|
518
518
|
// AM or PM
|
|
519
|
-
a(
|
|
520
|
-
const n =
|
|
521
|
-
switch (
|
|
519
|
+
a(t, e) {
|
|
520
|
+
const n = t.getHours() / 12 >= 1 ? "pm" : "am";
|
|
521
|
+
switch (e) {
|
|
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(t, e) {
|
|
536
|
+
return o(t.getHours() % 12 || 12, e.length);
|
|
537
537
|
},
|
|
538
538
|
// Hour [0-23]
|
|
539
|
-
H(
|
|
540
|
-
return o(
|
|
539
|
+
H(t, e) {
|
|
540
|
+
return o(t.getHours(), e.length);
|
|
541
541
|
},
|
|
542
542
|
// Minute
|
|
543
|
-
m(
|
|
544
|
-
return o(
|
|
543
|
+
m(t, e) {
|
|
544
|
+
return o(t.getMinutes(), e.length);
|
|
545
545
|
},
|
|
546
546
|
// Second
|
|
547
|
-
s(
|
|
548
|
-
return o(
|
|
547
|
+
s(t, e) {
|
|
548
|
+
return o(t.getSeconds(), e.length);
|
|
549
549
|
},
|
|
550
550
|
// Fraction of second
|
|
551
|
-
S(
|
|
552
|
-
const n =
|
|
551
|
+
S(t, e) {
|
|
552
|
+
const n = e.length, a = t.getMilliseconds(), r = Math.trunc(
|
|
553
553
|
a * Math.pow(10, n - 3)
|
|
554
554
|
);
|
|
555
|
-
return o(r,
|
|
555
|
+
return o(r, e.length);
|
|
556
556
|
}
|
|
557
557
|
}, T = {
|
|
558
558
|
am: "am",
|
|
@@ -565,9 +565,9 @@ const b = {
|
|
|
565
565
|
night: "night"
|
|
566
566
|
}, H = {
|
|
567
567
|
// Era
|
|
568
|
-
G: function(
|
|
569
|
-
const a =
|
|
570
|
-
switch (
|
|
568
|
+
G: function(t, e, n) {
|
|
569
|
+
const a = t.getFullYear() > 0 ? 1 : 0;
|
|
570
|
+
switch (e) {
|
|
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(t, e, n) {
|
|
584
|
+
if (e === "yo") {
|
|
585
|
+
const a = t.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(t, e);
|
|
589
589
|
},
|
|
590
590
|
// Local week-numbering year
|
|
591
|
-
Y: function(
|
|
592
|
-
const r =
|
|
593
|
-
if (
|
|
591
|
+
Y: function(t, e, n, a) {
|
|
592
|
+
const r = ut(t, a), i = r > 0 ? r : 1 - r;
|
|
593
|
+
if (e === "YY") {
|
|
594
594
|
const s = i % 100;
|
|
595
595
|
return o(s, 2);
|
|
596
596
|
}
|
|
597
|
-
return
|
|
597
|
+
return e === "Yo" ? n.ordinalNumber(i, { unit: "year" }) : o(i, e.length);
|
|
598
598
|
},
|
|
599
599
|
// ISO week-numbering year
|
|
600
|
-
R: function(
|
|
601
|
-
const n = U(
|
|
602
|
-
return o(n,
|
|
600
|
+
R: function(t, e) {
|
|
601
|
+
const n = U(t);
|
|
602
|
+
return o(n, e.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(t, e) {
|
|
614
|
+
const n = t.getFullYear();
|
|
615
|
+
return o(n, e.length);
|
|
616
616
|
},
|
|
617
617
|
// Quarter
|
|
618
|
-
Q: function(
|
|
619
|
-
const a = Math.ceil((
|
|
620
|
-
switch (
|
|
618
|
+
Q: function(t, e, n) {
|
|
619
|
+
const a = Math.ceil((t.getMonth() + 1) / 3);
|
|
620
|
+
switch (e) {
|
|
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(t, e, n) {
|
|
647
|
+
const a = Math.ceil((t.getMonth() + 1) / 3);
|
|
648
|
+
switch (e) {
|
|
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(t, e, n) {
|
|
675
|
+
const a = t.getMonth();
|
|
676
|
+
switch (e) {
|
|
677
677
|
case "M":
|
|
678
678
|
case "MM":
|
|
679
|
-
return b.M(
|
|
679
|
+
return b.M(t, e);
|
|
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(t, e, n) {
|
|
699
|
+
const a = t.getMonth();
|
|
700
|
+
switch (e) {
|
|
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(t, e, n, a) {
|
|
724
|
+
const r = lt(t, a);
|
|
725
|
+
return e === "wo" ? n.ordinalNumber(r, { unit: "week" }) : o(r, e.length);
|
|
726
726
|
},
|
|
727
727
|
// ISO week of year
|
|
728
|
-
I: function(
|
|
729
|
-
const a =
|
|
730
|
-
return
|
|
728
|
+
I: function(t, e, n) {
|
|
729
|
+
const a = Jt(t);
|
|
730
|
+
return e === "Io" ? n.ordinalNumber(a, { unit: "week" }) : o(a, e.length);
|
|
731
731
|
},
|
|
732
732
|
// Day of the month
|
|
733
|
-
d: function(
|
|
734
|
-
return
|
|
733
|
+
d: function(t, e, n) {
|
|
734
|
+
return e === "do" ? n.ordinalNumber(t.getDate(), { unit: "date" }) : b.d(t, e);
|
|
735
735
|
},
|
|
736
736
|
// Day of year
|
|
737
|
-
D: function(
|
|
738
|
-
const a =
|
|
739
|
-
return
|
|
737
|
+
D: function(t, e, n) {
|
|
738
|
+
const a = Ut(t);
|
|
739
|
+
return e === "Do" ? n.ordinalNumber(a, { unit: "dayOfYear" }) : o(a, e.length);
|
|
740
740
|
},
|
|
741
741
|
// Day of week
|
|
742
|
-
E: function(
|
|
743
|
-
const a =
|
|
744
|
-
switch (
|
|
742
|
+
E: function(t, e, n) {
|
|
743
|
+
const a = t.getDay();
|
|
744
|
+
switch (e) {
|
|
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(t, e, n, a) {
|
|
772
|
+
const r = t.getDay(), i = (r - a.weekStartsOn + 8) % 7 || 7;
|
|
773
|
+
switch (e) {
|
|
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(t, e, n, a) {
|
|
805
|
+
const r = t.getDay(), i = (r - a.weekStartsOn + 8) % 7 || 7;
|
|
806
|
+
switch (e) {
|
|
807
807
|
case "c":
|
|
808
808
|
return String(i);
|
|
809
809
|
case "cc":
|
|
810
|
-
return o(i,
|
|
810
|
+
return o(i, e.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(t, e, n) {
|
|
838
|
+
const a = t.getDay(), r = a === 0 ? 7 : a;
|
|
839
|
+
switch (e) {
|
|
840
840
|
case "i":
|
|
841
841
|
return String(r);
|
|
842
842
|
case "ii":
|
|
843
|
-
return o(r,
|
|
843
|
+
return o(r, e.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(t, e, n) {
|
|
871
|
+
const r = t.getHours() / 12 >= 1 ? "pm" : "am";
|
|
872
|
+
switch (e) {
|
|
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(t, e, n) {
|
|
899
|
+
const a = t.getHours();
|
|
900
900
|
let r;
|
|
901
|
-
switch (a === 12 ? r = T.noon : a === 0 ? r = T.midnight : r = a / 12 >= 1 ? "pm" : "am",
|
|
901
|
+
switch (a === 12 ? r = T.noon : a === 0 ? r = T.midnight : r = a / 12 >= 1 ? "pm" : "am", e) {
|
|
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(t, e, n) {
|
|
928
|
+
const a = t.getHours();
|
|
929
929
|
let r;
|
|
930
|
-
switch (a >= 17 ? r = T.evening : a >= 12 ? r = T.afternoon : a >= 4 ? r = T.morning : r = T.night,
|
|
930
|
+
switch (a >= 17 ? r = T.evening : a >= 12 ? r = T.afternoon : a >= 4 ? r = T.morning : r = T.night, e) {
|
|
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(t, e, n) {
|
|
953
|
+
if (e === "ho") {
|
|
954
|
+
let a = t.getHours() % 12;
|
|
955
955
|
return a === 0 && (a = 12), n.ordinalNumber(a, { unit: "hour" });
|
|
956
956
|
}
|
|
957
|
-
return b.h(
|
|
957
|
+
return b.h(t, e);
|
|
958
958
|
},
|
|
959
959
|
// Hour [0-23]
|
|
960
|
-
H: function(
|
|
961
|
-
return
|
|
960
|
+
H: function(t, e, n) {
|
|
961
|
+
return e === "Ho" ? n.ordinalNumber(t.getHours(), { unit: "hour" }) : b.H(t, e);
|
|
962
962
|
},
|
|
963
963
|
// Hour [0-11]
|
|
964
|
-
K: function(
|
|
965
|
-
const a =
|
|
966
|
-
return
|
|
964
|
+
K: function(t, e, n) {
|
|
965
|
+
const a = t.getHours() % 12;
|
|
966
|
+
return e === "Ko" ? n.ordinalNumber(a, { unit: "hour" }) : o(a, e.length);
|
|
967
967
|
},
|
|
968
968
|
// Hour [1-24]
|
|
969
|
-
k: function(
|
|
970
|
-
let a =
|
|
971
|
-
return a === 0 && (a = 24),
|
|
969
|
+
k: function(t, e, n) {
|
|
970
|
+
let a = t.getHours();
|
|
971
|
+
return a === 0 && (a = 24), e === "ko" ? n.ordinalNumber(a, { unit: "hour" }) : o(a, e.length);
|
|
972
972
|
},
|
|
973
973
|
// Minute
|
|
974
|
-
m: function(
|
|
975
|
-
return
|
|
974
|
+
m: function(t, e, n) {
|
|
975
|
+
return e === "mo" ? n.ordinalNumber(t.getMinutes(), { unit: "minute" }) : b.m(t, e);
|
|
976
976
|
},
|
|
977
977
|
// Second
|
|
978
|
-
s: function(
|
|
979
|
-
return
|
|
978
|
+
s: function(t, e, n) {
|
|
979
|
+
return e === "so" ? n.ordinalNumber(t.getSeconds(), { unit: "second" }) : b.s(t, e);
|
|
980
980
|
},
|
|
981
981
|
// Fraction of second
|
|
982
|
-
S: function(
|
|
983
|
-
return b.S(
|
|
982
|
+
S: function(t, e) {
|
|
983
|
+
return b.S(t, e);
|
|
984
984
|
},
|
|
985
985
|
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
986
|
-
X: function(
|
|
987
|
-
const a =
|
|
986
|
+
X: function(t, e, n) {
|
|
987
|
+
const a = t.getTimezoneOffset();
|
|
988
988
|
if (a === 0)
|
|
989
989
|
return "Z";
|
|
990
|
-
switch (
|
|
990
|
+
switch (e) {
|
|
991
991
|
case "X":
|
|
992
992
|
return V(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(t, e, n) {
|
|
1004
|
+
const a = t.getTimezoneOffset();
|
|
1005
|
+
switch (e) {
|
|
1006
1006
|
case "x":
|
|
1007
1007
|
return V(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(t, e, n) {
|
|
1019
|
+
const a = t.getTimezoneOffset();
|
|
1020
|
+
switch (e) {
|
|
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(t, e, n) {
|
|
1032
|
+
const a = t.getTimezoneOffset();
|
|
1033
|
+
switch (e) {
|
|
1034
1034
|
case "z":
|
|
1035
1035
|
case "zz":
|
|
1036
1036
|
case "zzz":
|
|
@@ -1041,112 +1041,112 @@ 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(t, e, n) {
|
|
1045
|
+
const a = Math.trunc(t.getTime() / 1e3);
|
|
1046
|
+
return o(a, e.length);
|
|
1047
1047
|
},
|
|
1048
1048
|
// Milliseconds timestamp
|
|
1049
|
-
T: function(
|
|
1050
|
-
const a =
|
|
1051
|
-
return o(a,
|
|
1049
|
+
T: function(t, e, n) {
|
|
1050
|
+
const a = t.getTime();
|
|
1051
|
+
return o(a, e.length);
|
|
1052
1052
|
}
|
|
1053
1053
|
};
|
|
1054
|
-
function j(
|
|
1055
|
-
const n =
|
|
1056
|
-
return i === 0 ? n + String(r) : n + String(r) +
|
|
1054
|
+
function j(t, e = "") {
|
|
1055
|
+
const n = t > 0 ? "-" : "+", a = Math.abs(t), r = Math.trunc(a / 60), i = a % 60;
|
|
1056
|
+
return i === 0 ? n + String(r) : n + String(r) + e + o(i, 2);
|
|
1057
1057
|
}
|
|
1058
|
-
function V(
|
|
1059
|
-
return
|
|
1058
|
+
function V(t, e) {
|
|
1059
|
+
return t % 60 === 0 ? (t > 0 ? "-" : "+") + o(Math.abs(t) / 60, 2) : D(t, e);
|
|
1060
1060
|
}
|
|
1061
|
-
function D(
|
|
1062
|
-
const n =
|
|
1063
|
-
return n + r +
|
|
1061
|
+
function D(t, e = "") {
|
|
1062
|
+
const n = t > 0 ? "-" : "+", a = Math.abs(t), r = o(Math.trunc(a / 60), 2), i = o(a % 60, 2);
|
|
1063
|
+
return n + r + e + i;
|
|
1064
1064
|
}
|
|
1065
|
-
const L = (
|
|
1066
|
-
switch (
|
|
1065
|
+
const L = (t, e) => {
|
|
1066
|
+
switch (t) {
|
|
1067
1067
|
case "P":
|
|
1068
|
-
return
|
|
1068
|
+
return e.date({ width: "short" });
|
|
1069
1069
|
case "PP":
|
|
1070
|
-
return
|
|
1070
|
+
return e.date({ width: "medium" });
|
|
1071
1071
|
case "PPP":
|
|
1072
|
-
return
|
|
1072
|
+
return e.date({ width: "long" });
|
|
1073
1073
|
case "PPPP":
|
|
1074
1074
|
default:
|
|
1075
|
-
return
|
|
1075
|
+
return e.date({ width: "full" });
|
|
1076
1076
|
}
|
|
1077
|
-
}, J = (
|
|
1078
|
-
switch (
|
|
1077
|
+
}, J = (t, e) => {
|
|
1078
|
+
switch (t) {
|
|
1079
1079
|
case "p":
|
|
1080
|
-
return
|
|
1080
|
+
return e.time({ width: "short" });
|
|
1081
1081
|
case "pp":
|
|
1082
|
-
return
|
|
1082
|
+
return e.time({ width: "medium" });
|
|
1083
1083
|
case "ppp":
|
|
1084
|
-
return
|
|
1084
|
+
return e.time({ width: "long" });
|
|
1085
1085
|
case "pppp":
|
|
1086
1086
|
default:
|
|
1087
|
-
return
|
|
1087
|
+
return e.time({ width: "full" });
|
|
1088
1088
|
}
|
|
1089
|
-
},
|
|
1090
|
-
const n =
|
|
1089
|
+
}, Kt = (t, e) => {
|
|
1090
|
+
const n = t.match(/(P+)(p+)?/) || [], a = n[1], r = n[2];
|
|
1091
1091
|
if (!r)
|
|
1092
|
-
return L(
|
|
1092
|
+
return L(t, e);
|
|
1093
1093
|
let i;
|
|
1094
1094
|
switch (a) {
|
|
1095
1095
|
case "P":
|
|
1096
|
-
i =
|
|
1096
|
+
i = e.dateTime({ width: "short" });
|
|
1097
1097
|
break;
|
|
1098
1098
|
case "PP":
|
|
1099
|
-
i =
|
|
1099
|
+
i = e.dateTime({ width: "medium" });
|
|
1100
1100
|
break;
|
|
1101
1101
|
case "PPP":
|
|
1102
|
-
i =
|
|
1102
|
+
i = e.dateTime({ width: "long" });
|
|
1103
1103
|
break;
|
|
1104
1104
|
case "PPPP":
|
|
1105
1105
|
default:
|
|
1106
|
-
i =
|
|
1106
|
+
i = e.dateTime({ width: "full" });
|
|
1107
1107
|
break;
|
|
1108
1108
|
}
|
|
1109
|
-
return i.replace("{{date}}", L(a,
|
|
1110
|
-
},
|
|
1109
|
+
return i.replace("{{date}}", L(a, e)).replace("{{time}}", J(r, e));
|
|
1110
|
+
}, zt = {
|
|
1111
1111
|
p: J,
|
|
1112
|
-
P:
|
|
1113
|
-
},
|
|
1114
|
-
function
|
|
1115
|
-
return
|
|
1112
|
+
P: Kt
|
|
1113
|
+
}, Zt = /^D+$/, te = /^Y+$/, ee = ["D", "DD", "YY", "YYYY"];
|
|
1114
|
+
function ne(t) {
|
|
1115
|
+
return Zt.test(t);
|
|
1116
1116
|
}
|
|
1117
|
-
function
|
|
1118
|
-
return
|
|
1117
|
+
function ae(t) {
|
|
1118
|
+
return te.test(t);
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1121
|
-
const a =
|
|
1122
|
-
if (console.warn(a),
|
|
1120
|
+
function re(t, e, n) {
|
|
1121
|
+
const a = ie(t, e, n);
|
|
1122
|
+
if (console.warn(a), ee.includes(t)) throw new RangeError(a);
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1125
|
-
const a =
|
|
1126
|
-
return `Use \`${
|
|
1124
|
+
function ie(t, e, n) {
|
|
1125
|
+
const a = t[0] === "Y" ? "years" : "days of the month";
|
|
1126
|
+
return `Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) 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
|
|
1128
|
+
const se = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, oe = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, ue = /^'([^]*?)'?$/, le = /''/g, de = /[a-zA-Z]/;
|
|
1129
|
+
function ce(t, e, n) {
|
|
1130
1130
|
var x, l, f, h;
|
|
1131
|
-
const a =
|
|
1132
|
-
if (!
|
|
1131
|
+
const a = dt(), r = a.locale ?? Gt, i = a.firstWeekContainsDate ?? ((l = (x = a.locale) == null ? void 0 : x.options) == null ? void 0 : l.firstWeekContainsDate) ?? 1, s = a.weekStartsOn ?? ((h = (f = a.locale) == null ? void 0 : f.options) == null ? void 0 : h.weekStartsOn) ?? 0, d = k(t);
|
|
1132
|
+
if (!ft(d))
|
|
1133
1133
|
throw new RangeError("Invalid time value");
|
|
1134
|
-
let g =
|
|
1134
|
+
let g = e.match(oe).map((u) => {
|
|
1135
1135
|
const c = u[0];
|
|
1136
1136
|
if (c === "p" || c === "P") {
|
|
1137
|
-
const O =
|
|
1137
|
+
const O = zt[c];
|
|
1138
1138
|
return O(u, r.formatLong);
|
|
1139
1139
|
}
|
|
1140
1140
|
return u;
|
|
1141
|
-
}).join("").match(
|
|
1141
|
+
}).join("").match(se).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: he(u) };
|
|
1147
1147
|
if (H[c])
|
|
1148
1148
|
return { isToken: !0, value: u };
|
|
1149
|
-
if (c.match(
|
|
1149
|
+
if (c.match(de))
|
|
1150
1150
|
throw new RangeError(
|
|
1151
1151
|
"Format string contains an unescaped latin alphabet character `" + c + "`"
|
|
1152
1152
|
);
|
|
@@ -1161,41 +1161,41 @@ function ct(e, t, n) {
|
|
|
1161
1161
|
return g.map((u) => {
|
|
1162
1162
|
if (!u.isToken) return u.value;
|
|
1163
1163
|
const c = u.value;
|
|
1164
|
-
(
|
|
1164
|
+
(ae(c) || ne(c)) && re(c, e, String(t));
|
|
1165
1165
|
const O = H[c[0]];
|
|
1166
1166
|
return O(d, c, r.localize, v);
|
|
1167
1167
|
}).join("");
|
|
1168
1168
|
}
|
|
1169
|
-
function
|
|
1170
|
-
const
|
|
1171
|
-
return
|
|
1169
|
+
function he(t) {
|
|
1170
|
+
const e = t.match(ue);
|
|
1171
|
+
return e ? e[1].replace(le, "'") : t;
|
|
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 = (t, e, n) => {
|
|
1179
1179
|
const a = /* @__PURE__ */ new Map();
|
|
1180
|
-
for (let r =
|
|
1180
|
+
for (let r = e; r <= n; r++) a.set(t[r], r);
|
|
1181
1181
|
return a;
|
|
1182
|
-
},
|
|
1183
|
-
constructor(
|
|
1184
|
-
if (super(
|
|
1182
|
+
}, me = Z(class extends tt {
|
|
1183
|
+
constructor(t) {
|
|
1184
|
+
if (super(t), t.type !== et.CHILD) throw Error("repeat() can only be used in text expressions");
|
|
1185
1185
|
}
|
|
1186
|
-
dt(
|
|
1186
|
+
dt(t, e, n) {
|
|
1187
1187
|
let a;
|
|
1188
|
-
n === void 0 ? n =
|
|
1188
|
+
n === void 0 ? n = e : e !== void 0 && (a = e);
|
|
1189
1189
|
const r = [], i = [];
|
|
1190
1190
|
let s = 0;
|
|
1191
|
-
for (const d of
|
|
1191
|
+
for (const d of t) 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(t, e, n) {
|
|
1195
|
+
return this.dt(t, e, n).values;
|
|
1196
1196
|
}
|
|
1197
|
-
update(
|
|
1198
|
-
const r =
|
|
1197
|
+
update(t, [e, n, a]) {
|
|
1198
|
+
const r = at(t), { values: i, keys: s } = this.dt(e, n, a);
|
|
1199
1199
|
if (!Array.isArray(r)) return this.ut = s, i;
|
|
1200
1200
|
const d = this.ut ?? (this.ut = []), g = [];
|
|
1201
1201
|
let v, x, l = 0, f = r.length - 1, h = 0, u = i.length - 1;
|
|
@@ -1203,28 +1203,28 @@ const Q = (e, t, n) => {
|
|
|
1203
1203
|
else if (r[f] === null) f--;
|
|
1204
1204
|
else if (d[l] === s[h]) g[h] = M(r[l], i[h]), l++, h++;
|
|
1205
1205
|
else if (d[f] === s[u]) g[u] = M(r[f], i[u]), f--, u--;
|
|
1206
|
-
else if (d[l] === s[u]) g[u] = M(r[l], i[u]), S(
|
|
1207
|
-
else if (d[f] === s[h]) g[h] = M(r[f], i[h]), S(
|
|
1206
|
+
else if (d[l] === s[u]) g[u] = M(r[l], i[u]), S(t, g[u + 1], r[l]), l++, u--;
|
|
1207
|
+
else if (d[f] === s[h]) g[h] = M(r[f], i[h]), S(t, r[l], r[f]), f--, h++;
|
|
1208
1208
|
else if (v === void 0 && (v = Q(s, h, u), x = Q(d, l, f)), v.has(d[l])) if (v.has(d[f])) {
|
|
1209
1209
|
const c = x.get(s[h]), O = c !== void 0 ? r[c] : null;
|
|
1210
1210
|
if (O === null) {
|
|
1211
|
-
const I = S(
|
|
1211
|
+
const I = S(t, r[l]);
|
|
1212
1212
|
M(I, i[h]), g[h] = I;
|
|
1213
|
-
} else g[h] = M(O, i[h]), S(
|
|
1213
|
+
} else g[h] = M(O, i[h]), S(t, r[l], O), r[c] = null;
|
|
1214
1214
|
h++;
|
|
1215
|
-
} else
|
|
1216
|
-
else
|
|
1215
|
+
} else F(r[f]), f--;
|
|
1216
|
+
else F(r[l]), l++;
|
|
1217
1217
|
for (; h <= u; ) {
|
|
1218
|
-
const c = S(
|
|
1218
|
+
const c = S(t, g[u + 1]);
|
|
1219
1219
|
M(c, i[h]), g[h++] = c;
|
|
1220
1220
|
}
|
|
1221
1221
|
for (; l <= f; ) {
|
|
1222
1222
|
const c = r[l++];
|
|
1223
|
-
c !== null &&
|
|
1223
|
+
c !== null && F(c);
|
|
1224
1224
|
}
|
|
1225
|
-
return this.ut = s,
|
|
1225
|
+
return this.ut = s, rt(t, g), K;
|
|
1226
1226
|
}
|
|
1227
|
-
}),
|
|
1227
|
+
}), fe = "pkt-datepicker", pe = !0, ge = {
|
|
1228
1228
|
name: {
|
|
1229
1229
|
type: "string",
|
|
1230
1230
|
name: "Navn",
|
|
@@ -1386,7 +1386,7 @@ const Q = (e, t, n) => {
|
|
|
1386
1386
|
name: "ID",
|
|
1387
1387
|
description: "Unik identifikasjon for datovelgeren"
|
|
1388
1388
|
}
|
|
1389
|
-
},
|
|
1389
|
+
}, ye = {
|
|
1390
1390
|
change: {
|
|
1391
1391
|
description: "Returnerer kommaseparert liste av valgte datoer i ISO-format"
|
|
1392
1392
|
},
|
|
@@ -1397,18 +1397,18 @@ const Q = (e, t, n) => {
|
|
|
1397
1397
|
description: "Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"
|
|
1398
1398
|
}
|
|
1399
1399
|
}, w = {
|
|
1400
|
-
name:
|
|
1400
|
+
name: fe,
|
|
1401
1401
|
"css-class": "pkt-datepicker",
|
|
1402
|
-
isElement:
|
|
1403
|
-
props:
|
|
1404
|
-
events:
|
|
1402
|
+
isElement: pe,
|
|
1403
|
+
props: ge,
|
|
1404
|
+
events: ye
|
|
1405
1405
|
};
|
|
1406
|
-
var
|
|
1407
|
-
for (var r = a > 1 ? void 0 : a ?
|
|
1408
|
-
(s =
|
|
1409
|
-
return a && r &&
|
|
1406
|
+
var ve = Object.defineProperty, we = Object.getOwnPropertyDescriptor, p = (t, e, n, a) => {
|
|
1407
|
+
for (var r = a > 1 ? void 0 : a ? we(e, n) : e, i = t.length - 1, s; i >= 0; i--)
|
|
1408
|
+
(s = t[i]) && (r = (a ? s(e, n, r) : s(r)) || r);
|
|
1409
|
+
return a && r && ve(e, n, r), r;
|
|
1410
1410
|
};
|
|
1411
|
-
const X = (
|
|
1411
|
+
const X = (t) => new Promise((e) => setTimeout(e, t));
|
|
1412
1412
|
let m = class extends z {
|
|
1413
1413
|
constructor() {
|
|
1414
1414
|
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 = this.formatISODate(/* @__PURE__ */ new Date()), this.calendarOpen = !1, this.inputRef = R(), this.inputRefTo = R(), this.btnRef = R(), this.calRef = R(), this.popupRef = R(), this.inputClasses = {
|
|
@@ -1420,40 +1420,40 @@ let m = class extends z {
|
|
|
1420
1420
|
"pkt-btn": !0,
|
|
1421
1421
|
"pkt-btn--icon-only": !0,
|
|
1422
1422
|
"pkt-btn--tertiary": !0
|
|
1423
|
-
}, this.fromISOToDate = (
|
|
1424
|
-
if (!
|
|
1423
|
+
}, this.fromISOToDate = (t) => {
|
|
1424
|
+
if (!t)
|
|
1425
1425
|
return null;
|
|
1426
|
-
const
|
|
1427
|
-
return
|
|
1428
|
-
}, this.fromISOtoLocal = (
|
|
1429
|
-
const
|
|
1430
|
-
return isNaN(
|
|
1431
|
-
}, this.massageDates = (
|
|
1432
|
-
const
|
|
1433
|
-
return this.multiple ?
|
|
1434
|
-
}, this.addToSelected = (
|
|
1435
|
-
const
|
|
1436
|
-
r.setHours(12, 0, 0, 0), r && !isNaN(r.getTime()) && (!n || r >= n) && (!a || r <= a) && this.calRef.value && this.calRef.value.handleDateSelect(r),
|
|
1426
|
+
const e = new Date(t);
|
|
1427
|
+
return e.setHours(12, 0, 0, 0), isNaN(e.getTime()) ? null : e;
|
|
1428
|
+
}, this.fromISOtoLocal = (t) => {
|
|
1429
|
+
const e = new Date(t);
|
|
1430
|
+
return isNaN(e.getTime()) ? "" : ce(e, this.dateformat);
|
|
1431
|
+
}, this.massageDates = (t) => {
|
|
1432
|
+
const e = t.map((n) => n ?? void 0);
|
|
1433
|
+
return this.multiple ? e : this.range ? e.slice(0, 2) : [e[0]];
|
|
1434
|
+
}, this.addToSelected = (t) => {
|
|
1435
|
+
const e = t.target, n = this.min ? new Date(this.min) : null, a = this.max ? new Date(this.max) : null, r = new Date(e.value.split(",")[0]);
|
|
1436
|
+
r.setHours(12, 0, 0, 0), r && !isNaN(r.getTime()) && (!n || r >= n) && (!a || r <= a) && this.calRef.value && this.calRef.value.handleDateSelect(r), e.value = "", this.requestUpdate("value");
|
|
1437
1437
|
};
|
|
1438
1438
|
}
|
|
1439
1439
|
/**
|
|
1440
1440
|
* Housekeeping / lifecycle methods
|
|
1441
1441
|
*/
|
|
1442
1442
|
async connectedCallback() {
|
|
1443
|
-
super.connectedCallback(), document && document.body.addEventListener("click", (
|
|
1444
|
-
var
|
|
1445
|
-
(
|
|
1443
|
+
super.connectedCallback(), document && document.body.addEventListener("click", (t) => {
|
|
1444
|
+
var e, n;
|
|
1445
|
+
(e = this.inputRef) != null && e.value && ((n = this.btnRef) != null && n.value) && !this.inputRef.value.contains(t.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(t.target)) && !this.btnRef.value.contains(t.target) && !t.target.closest(".pkt-calendar-popup") && this.hideCalendar();
|
|
1446
1446
|
}), 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());
|
|
1447
1447
|
}
|
|
1448
1448
|
disconnectedCallback() {
|
|
1449
|
-
super.disconnectedCallback(), document && document.body.removeEventListener("click", (
|
|
1450
|
-
var
|
|
1451
|
-
(
|
|
1449
|
+
super.disconnectedCallback(), document && document.body.removeEventListener("click", (t) => {
|
|
1450
|
+
var e, n;
|
|
1451
|
+
(e = this.inputRef) != null && e.value && ((n = this.btnRef) != null && n.value) && !this.inputRef.value.contains(t.target) && !this.btnRef.value.contains(t.target) && this.hideCalendar();
|
|
1452
1452
|
});
|
|
1453
1453
|
}
|
|
1454
|
-
attributeChangedCallback(
|
|
1454
|
+
attributeChangedCallback(t, e, n) {
|
|
1455
1455
|
var a, r;
|
|
1456
|
-
if (super.attributeChangedCallback(
|
|
1456
|
+
if (super.attributeChangedCallback(t, e, n), t === "value") {
|
|
1457
1457
|
if (this.value === "" || this.value.length === 0)
|
|
1458
1458
|
this._value = [];
|
|
1459
1459
|
else if (this.value.length && this._value.length === 0) {
|
|
@@ -1461,12 +1461,14 @@ let m = class extends z {
|
|
|
1461
1461
|
for (const s of i)
|
|
1462
1462
|
s && !this._value.includes(s) && ((r = (a = this.calRef) == null ? void 0 : a.value) == null || r.handleDateSelect(this.fromISOToDate(s)));
|
|
1463
1463
|
}
|
|
1464
|
-
this.requestUpdate("value");
|
|
1465
1464
|
}
|
|
1466
|
-
|
|
1465
|
+
t === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = (n == null ? void 0 : n.split(",")) ?? []), t === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = (n == null ? void 0 : n.split(",")) ?? []);
|
|
1467
1466
|
}
|
|
1468
|
-
|
|
1469
|
-
|
|
1467
|
+
firstUpdated(t) {
|
|
1468
|
+
super.firstUpdated(t);
|
|
1469
|
+
}
|
|
1470
|
+
updated(t) {
|
|
1471
|
+
if (super.updated(t), t.has("value")) {
|
|
1470
1472
|
if (this.range && this._value.length === 1)
|
|
1471
1473
|
return;
|
|
1472
1474
|
this.onInput(this.value);
|
|
@@ -1475,8 +1477,8 @@ let m = class extends z {
|
|
|
1475
1477
|
/**
|
|
1476
1478
|
* Date value manipulation
|
|
1477
1479
|
*/
|
|
1478
|
-
formatISODate(
|
|
1479
|
-
return
|
|
1480
|
+
formatISODate(t) {
|
|
1481
|
+
return t.toISOString().split("T")[0];
|
|
1480
1482
|
}
|
|
1481
1483
|
renderInput() {
|
|
1482
1484
|
return P`
|
|
@@ -1489,15 +1491,15 @@ let m = class extends z {
|
|
|
1489
1491
|
min=${this.min}
|
|
1490
1492
|
max=${this.max}
|
|
1491
1493
|
@focus=${this.showCalendar}
|
|
1492
|
-
@click=${(
|
|
1493
|
-
|
|
1494
|
+
@click=${(t) => {
|
|
1495
|
+
t.preventDefault();
|
|
1494
1496
|
}}
|
|
1495
1497
|
?disabled=${this.disabled}
|
|
1496
|
-
@blur=${(
|
|
1497
|
-
this.manageValidity(
|
|
1498
|
+
@blur=${(t) => {
|
|
1499
|
+
this.manageValidity(t.target), this.value = t.target.value, this._value = this.massageDates(t.target.value.split(","));
|
|
1498
1500
|
}}
|
|
1499
|
-
@change=${(
|
|
1500
|
-
|
|
1501
|
+
@change=${(t) => {
|
|
1502
|
+
t.stopImmediatePropagation();
|
|
1501
1503
|
}}
|
|
1502
1504
|
${$(this.inputRef)}
|
|
1503
1505
|
/>
|
|
@@ -1515,20 +1517,20 @@ let m = class extends z {
|
|
|
1515
1517
|
min=${this.min}
|
|
1516
1518
|
max=${this.max}
|
|
1517
1519
|
@focus=${this.showCalendar}
|
|
1518
|
-
@click=${(
|
|
1519
|
-
|
|
1520
|
+
@click=${(t) => {
|
|
1521
|
+
t.preventDefault();
|
|
1520
1522
|
}}
|
|
1521
1523
|
?disabled=${this.disabled}
|
|
1522
|
-
@blur=${(
|
|
1523
|
-
var
|
|
1524
|
-
if (
|
|
1525
|
-
this.manageValidity(
|
|
1526
|
-
const a = this.fromISOToDate(
|
|
1527
|
-
a && ((n = (
|
|
1524
|
+
@blur=${(t) => {
|
|
1525
|
+
var e, n;
|
|
1526
|
+
if (t.target.value) {
|
|
1527
|
+
this.manageValidity(t.target);
|
|
1528
|
+
const a = this.fromISOToDate(t.target.value);
|
|
1529
|
+
a && ((n = (e = this.calRef) == null ? void 0 : e.value) == null || n.handleDateSelect(a));
|
|
1528
1530
|
}
|
|
1529
1531
|
}}
|
|
1530
|
-
@change=${(
|
|
1531
|
-
|
|
1532
|
+
@change=${(t) => {
|
|
1533
|
+
t.stopImmediatePropagation();
|
|
1532
1534
|
}}
|
|
1533
1535
|
${$(this.inputRef)}
|
|
1534
1536
|
/>
|
|
@@ -1542,30 +1544,30 @@ let m = class extends z {
|
|
|
1542
1544
|
min=${this.min}
|
|
1543
1545
|
max=${this.max}
|
|
1544
1546
|
@focus=${this.showCalendar}
|
|
1545
|
-
@click=${(
|
|
1546
|
-
|
|
1547
|
+
@click=${(t) => {
|
|
1548
|
+
t.preventDefault();
|
|
1547
1549
|
}}
|
|
1548
1550
|
?disabled=${this.disabled}
|
|
1549
|
-
@blur=${(
|
|
1550
|
-
var
|
|
1551
|
-
if (
|
|
1552
|
-
this.manageValidity(
|
|
1553
|
-
const a =
|
|
1551
|
+
@blur=${(t) => {
|
|
1552
|
+
var e, n;
|
|
1553
|
+
if (t.target.value) {
|
|
1554
|
+
this.manageValidity(t.target);
|
|
1555
|
+
const a = t.target.value;
|
|
1554
1556
|
this.min && this.min > a ? this.internals.setValidity(
|
|
1555
1557
|
{ rangeUnderflow: !0 },
|
|
1556
1558
|
this.strings.forms.messages.rangeUnderflow,
|
|
1557
|
-
|
|
1559
|
+
t.target
|
|
1558
1560
|
) : this.max && this.max < a && this.internals.setValidity(
|
|
1559
1561
|
{ rangeOverflow: !0 },
|
|
1560
1562
|
this.strings.forms.messages.rangeOverflow,
|
|
1561
|
-
|
|
1563
|
+
t.target
|
|
1562
1564
|
);
|
|
1563
|
-
const r = this.fromISOToDate(
|
|
1564
|
-
r && this._value[1] !== this.formatISODate(r) && ((n = (
|
|
1565
|
+
const r = this.fromISOToDate(t.target.value);
|
|
1566
|
+
r && this._value[1] !== this.formatISODate(r) && ((n = (e = this.calRef) == null ? void 0 : e.value) == null || n.handleDateSelect(r));
|
|
1565
1567
|
}
|
|
1566
1568
|
}}
|
|
1567
|
-
@change=${(
|
|
1568
|
-
|
|
1569
|
+
@change=${(t) => {
|
|
1570
|
+
t.stopImmediatePropagation();
|
|
1569
1571
|
}}
|
|
1570
1572
|
${$(this.inputRefTo)}
|
|
1571
1573
|
/>
|
|
@@ -1581,18 +1583,18 @@ let m = class extends z {
|
|
|
1581
1583
|
min=${this.min}
|
|
1582
1584
|
max=${this.max}
|
|
1583
1585
|
@focus=${this.showCalendar}
|
|
1584
|
-
@click=${(
|
|
1585
|
-
|
|
1586
|
+
@click=${(t) => {
|
|
1587
|
+
t.preventDefault();
|
|
1586
1588
|
}}
|
|
1587
|
-
@blur=${(
|
|
1588
|
-
this.addToSelected(
|
|
1589
|
+
@blur=${(t) => {
|
|
1590
|
+
this.addToSelected(t);
|
|
1589
1591
|
}}
|
|
1590
|
-
@keydown=${(
|
|
1591
|
-
(
|
|
1592
|
+
@keydown=${(t) => {
|
|
1593
|
+
(t.key === "," || t.key === "Enter") && (t.preventDefault(), this.addToSelected(t));
|
|
1592
1594
|
}}
|
|
1593
1595
|
?disabled=${this.disabled || this.maxlength && this._value.length >= this.maxlength}
|
|
1594
|
-
@change=${(
|
|
1595
|
-
|
|
1596
|
+
@change=${(t) => {
|
|
1597
|
+
t.stopImmediatePropagation();
|
|
1596
1598
|
}}
|
|
1597
1599
|
${$(this.inputRef)}
|
|
1598
1600
|
/>
|
|
@@ -1601,18 +1603,18 @@ let m = class extends z {
|
|
|
1601
1603
|
renderTags() {
|
|
1602
1604
|
return P`
|
|
1603
1605
|
<div class="pkt-datepicker__tags" aria-live="polite">
|
|
1604
|
-
${this._value[0] ?
|
|
1606
|
+
${this._value[0] ? me(
|
|
1605
1607
|
this._value ?? [],
|
|
1606
|
-
(
|
|
1607
|
-
(
|
|
1608
|
+
(t) => t,
|
|
1609
|
+
(t) => P`
|
|
1608
1610
|
<pkt-tag
|
|
1609
|
-
.id="${this.id +
|
|
1611
|
+
.id="${this.id + t + "-tag"}"
|
|
1610
1612
|
closeTag
|
|
1611
1613
|
@onClose=${() => {
|
|
1612
|
-
var
|
|
1613
|
-
return (
|
|
1614
|
+
var e;
|
|
1615
|
+
return (e = this.calRef.value) == null ? void 0 : e.handleDateSelect(this.fromISOToDate(t));
|
|
1614
1616
|
}}
|
|
1615
|
-
>${this.fromISOtoLocal(
|
|
1617
|
+
>${this.fromISOtoLocal(t)}</pkt-tag
|
|
1616
1618
|
>
|
|
1617
1619
|
`
|
|
1618
1620
|
) : N}
|
|
@@ -1639,8 +1641,8 @@ let m = class extends z {
|
|
|
1639
1641
|
.excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
|
|
1640
1642
|
.excludeweekdays=${this.excludeweekdays}
|
|
1641
1643
|
.currentmonth=${new Date(this.currentmonth)}
|
|
1642
|
-
@date-selected=${(
|
|
1643
|
-
this.value = !this.multiple && !this.range ? Array.isArray(
|
|
1644
|
+
@date-selected=${(t) => {
|
|
1645
|
+
this.value = !this.multiple && !this.range ? Array.isArray(t.detail) ? t.detail[0] : t.detail.split(",")[0] : t.detail, this._value = t.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] : ""));
|
|
1644
1646
|
}}
|
|
1645
1647
|
@close=${this.hideCalendar}
|
|
1646
1648
|
${$(this.calRef)}
|
|
@@ -1690,15 +1692,15 @@ let m = class extends z {
|
|
|
1690
1692
|
* Handlers
|
|
1691
1693
|
*/
|
|
1692
1694
|
handleCalendarPosition() {
|
|
1693
|
-
var
|
|
1695
|
+
var t;
|
|
1694
1696
|
if (this.popupRef.value && this.inputRef.value) {
|
|
1695
|
-
const
|
|
1696
|
-
let i =
|
|
1697
|
+
const e = this.multiple && !!this.maxlength, n = ((t = this.inputRef.value.parentElement) == null ? void 0 : t.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(), a = e ? n.height + 30 : n.height, r = this.popupRef.value.getBoundingClientRect().height;
|
|
1698
|
+
let i = e ? "calc(100% - 30px)" : "100%";
|
|
1697
1699
|
n && n.top + r > window.innerHeight && n.top - r > 0 && (i = `calc(100% - ${a}px - ${r}px)`), this.popupRef.value.style.top = i;
|
|
1698
1700
|
}
|
|
1699
1701
|
}
|
|
1700
|
-
handleFocusOut(
|
|
1701
|
-
this.contains(
|
|
1702
|
+
handleFocusOut(t) {
|
|
1703
|
+
this.contains(t.target) || this.hideCalendar();
|
|
1702
1704
|
}
|
|
1703
1705
|
async showCalendar() {
|
|
1704
1706
|
this.calendarOpen = !0, await X(20), this.handleCalendarPosition();
|
|
@@ -1706,8 +1708,8 @@ let m = class extends z {
|
|
|
1706
1708
|
hideCalendar() {
|
|
1707
1709
|
this.calendarOpen = !1;
|
|
1708
1710
|
}
|
|
1709
|
-
toggleCalendar(
|
|
1710
|
-
|
|
1711
|
+
toggleCalendar(t) {
|
|
1712
|
+
t.preventDefault(), this.calendarOpen ? this.hideCalendar() : this.showCalendar();
|
|
1711
1713
|
}
|
|
1712
1714
|
};
|
|
1713
1715
|
p([
|
|
@@ -1717,19 +1719,19 @@ p([
|
|
|
1717
1719
|
y({ type: Array, reflect: !1 })
|
|
1718
1720
|
], m.prototype, "_value", 2);
|
|
1719
1721
|
p([
|
|
1720
|
-
y({ type: String
|
|
1722
|
+
y({ type: String })
|
|
1721
1723
|
], m.prototype, "label", 2);
|
|
1722
1724
|
p([
|
|
1723
|
-
y({ type: String
|
|
1725
|
+
y({ type: String })
|
|
1724
1726
|
], m.prototype, "helptext", 2);
|
|
1725
1727
|
p([
|
|
1726
|
-
y({ type: String
|
|
1728
|
+
y({ type: String })
|
|
1727
1729
|
], m.prototype, "helptextDropdown", 2);
|
|
1728
1730
|
p([
|
|
1729
|
-
y({ type: String
|
|
1731
|
+
y({ type: String })
|
|
1730
1732
|
], m.prototype, "helptextDropdownButton", 2);
|
|
1731
1733
|
p([
|
|
1732
|
-
y({ type: String
|
|
1734
|
+
y({ type: String })
|
|
1733
1735
|
], m.prototype, "dateformat", 2);
|
|
1734
1736
|
p([
|
|
1735
1737
|
y({ type: Boolean, reflect: !0 })
|
|
@@ -1741,13 +1743,13 @@ p([
|
|
|
1741
1743
|
y({ type: Boolean, reflect: !0 })
|
|
1742
1744
|
], m.prototype, "range", 2);
|
|
1743
1745
|
p([
|
|
1744
|
-
y({ type: Boolean
|
|
1746
|
+
y({ type: Boolean })
|
|
1745
1747
|
], m.prototype, "weeknumbers", 2);
|
|
1746
1748
|
p([
|
|
1747
|
-
y({ type: Boolean
|
|
1749
|
+
y({ type: Boolean })
|
|
1748
1750
|
], m.prototype, "withcontrols", 2);
|
|
1749
1751
|
p([
|
|
1750
|
-
y({ type: Boolean
|
|
1752
|
+
y({ type: Boolean })
|
|
1751
1753
|
], m.prototype, "fullwidth", 2);
|
|
1752
1754
|
p([
|
|
1753
1755
|
y({ converter: G.csvToArray })
|
|
@@ -1756,13 +1758,13 @@ p([
|
|
|
1756
1758
|
y({ converter: G.csvToArray })
|
|
1757
1759
|
], m.prototype, "excludeweekdays", 2);
|
|
1758
1760
|
p([
|
|
1759
|
-
y({ type: String
|
|
1761
|
+
y({ type: String })
|
|
1760
1762
|
], m.prototype, "currentmonth", 2);
|
|
1761
1763
|
p([
|
|
1762
1764
|
y({ type: Boolean, reflect: !0 })
|
|
1763
1765
|
], m.prototype, "calendarOpen", 2);
|
|
1764
1766
|
m = p([
|
|
1765
|
-
|
|
1767
|
+
nt("pkt-datepicker")
|
|
1766
1768
|
], m);
|
|
1767
1769
|
export {
|
|
1768
1770
|
m as PktDatepicker
|