scb-wc-test 0.1.209 → 0.1.210
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.
|
@@ -102,7 +102,13 @@ import{a as W,n as w,i as j,x as D,t as R}from"../../vendor/vendor.js";import"./
|
|
|
102
102
|
border-radius: 6px;
|
|
103
103
|
}
|
|
104
104
|
.calendar-day--other {
|
|
105
|
-
|
|
105
|
+
color: light-dark(var(--n-40), var(--n-70));
|
|
106
|
+
}
|
|
107
|
+
.calendar-day--other .calendar-day-event-title {
|
|
108
|
+
color: inherit;
|
|
109
|
+
}
|
|
110
|
+
.calendar-day--other .calendar-day-number {
|
|
111
|
+
font-weight: var(--weight-regular);
|
|
106
112
|
}
|
|
107
113
|
.calendar-day-number {
|
|
108
114
|
font-size: var(--md-sys-typescale-label-small-size);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.210",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -378,5 +378,5 @@
|
|
|
378
378
|
},
|
|
379
379
|
"./mvc/*": "./mvc/*"
|
|
380
380
|
},
|
|
381
|
-
"buildHash": "
|
|
381
|
+
"buildHash": "0258D3DB31E344F34846D7BE4EC69608053D34873F571F930DF4B7B94C9541F0"
|
|
382
382
|
}
|
|
@@ -8,15 +8,15 @@ import "@material/web/focus/md-focus-ring.js";
|
|
|
8
8
|
var J = Object.defineProperty, U = Object.getOwnPropertyDescriptor, q = (t) => {
|
|
9
9
|
throw TypeError(t);
|
|
10
10
|
}, _ = (t, e, s, i) => {
|
|
11
|
-
for (var
|
|
12
|
-
(d = t[a]) && (
|
|
13
|
-
return i &&
|
|
11
|
+
for (var l = i > 1 ? void 0 : i ? U(e, s) : e, a = t.length - 1, d; a >= 0; a--)
|
|
12
|
+
(d = t[a]) && (l = (i ? d(e, s, l) : d(l)) || l);
|
|
13
|
+
return i && l && J(e, s, l), l;
|
|
14
14
|
}, B = (t, e, s) => e.has(t) || q("Cannot " + s), I = (t, e, s) => e.has(t) ? q("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), L = (t, e, s) => (B(t, e, "access private method"), s), N, O;
|
|
15
15
|
let f = class extends j {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments), I(this, N), this._lastActiveDay = null, this.lang = "sv", this.disableWeekend = !1, this.publicHolidays = !0, this.displayYear = (/* @__PURE__ */ new Date()).getFullYear(), this.displayMonth = (/* @__PURE__ */ new Date()).getMonth() + 1, this.selectedDate = "", this.spacing = void 0, this.spacingTop = void 0, this.spacingBottom = void 0, this.spacingLeft = void 0, this.spacingRight = void 0, this._mutationObserver = null, this._syncingDisplay = !1, this._onCalendarKeyDown = (t) => {
|
|
18
18
|
var k, v;
|
|
19
|
-
const s = Array.from(((k = this.shadowRoot) == null ? void 0 : k.querySelectorAll(".calendar-day.has-event")) ?? []), i = (v = this.shadowRoot) == null ? void 0 : v.activeElement,
|
|
19
|
+
const s = Array.from(((k = this.shadowRoot) == null ? void 0 : k.querySelectorAll(".calendar-day.has-event")) ?? []), i = (v = this.shadowRoot) == null ? void 0 : v.activeElement, l = i && s.includes(i) ? i : document.activeElement, a = s.indexOf(l);
|
|
20
20
|
if (a === -1) return;
|
|
21
21
|
let d = a;
|
|
22
22
|
const p = this.disableWeekend ? 5 : 7;
|
|
@@ -67,8 +67,8 @@ let f = class extends j {
|
|
|
67
67
|
if ((e = super.updated) == null || e.call(this, t), (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom") || t.has("spacingLeft") || t.has("spacingRight")) && L(this, N, O).call(this), !this._syncingDisplay && (t.has("displayYear") || t.has("displayMonth"))) {
|
|
68
68
|
const s = Number(this.displayYear), i = Number(this.displayMonth);
|
|
69
69
|
if (!Number.isNaN(s) && !Number.isNaN(i) && i >= 1 && i <= 12) {
|
|
70
|
-
const
|
|
71
|
-
(
|
|
70
|
+
const l = this._current.getFullYear(), a = this._current.getMonth() + 1;
|
|
71
|
+
(l !== s || a !== i) && (this._current = new Date(s, i - 1, 1), this.dispatchEvent(
|
|
72
72
|
new CustomEvent("scb-calendar-month-change", {
|
|
73
73
|
bubbles: !0,
|
|
74
74
|
composed: !0,
|
|
@@ -116,8 +116,8 @@ let f = class extends j {
|
|
|
116
116
|
detail: { selectedDate: t.date }
|
|
117
117
|
})
|
|
118
118
|
), this._lastActiveDay = ((e = this.shadowRoot) == null ? void 0 : e.activeElement) || document.activeElement, this.requestUpdate(), this.updateComplete.then(() => {
|
|
119
|
-
var
|
|
120
|
-
const s = (
|
|
119
|
+
var l;
|
|
120
|
+
const s = (l = this.shadowRoot) == null ? void 0 : l.querySelector("scb-dialog");
|
|
121
121
|
s && (document.activeElement && (s.__lastTriggerEl = document.activeElement), requestAnimationFrame(() => {
|
|
122
122
|
requestAnimationFrame(() => {
|
|
123
123
|
s.open = !0;
|
|
@@ -144,7 +144,7 @@ let f = class extends j {
|
|
|
144
144
|
return new Date(this._easterDateCalculated["Ar" + t]);
|
|
145
145
|
let e = t;
|
|
146
146
|
e < 100 && (e = e + 1900), e < 1950 && (e = e + 100);
|
|
147
|
-
const s = e % 19, i = e % 4,
|
|
147
|
+
const s = e % 19, i = e % 4, l = e % 7, a = (19 * s + 24) % 30, d = (2 * i + 4 * l + 6 * a + 5) % 7;
|
|
148
148
|
let p = 22 + a + d, k = 0;
|
|
149
149
|
p == 57 && (p -= 7), p == 56 && a == 28 && d == 6 && s > 10 && (p -= 7), p > 31 ? (p -= 31, k = 4) : k = 3;
|
|
150
150
|
const v = new Date(e, k - 1, p);
|
|
@@ -156,7 +156,7 @@ let f = class extends j {
|
|
|
156
156
|
_swedishHolidayName(t) {
|
|
157
157
|
const e = t.getMonth();
|
|
158
158
|
if (e === 1 || e === 6 || e === 7 || e === 8) return null;
|
|
159
|
-
const s = t.getMonth() + 1, i = t.getDate(),
|
|
159
|
+
const s = t.getMonth() + 1, i = t.getDate(), l = t.getFullYear(), a = this._easterDay(l), d = this.lang === "en", p = [
|
|
160
160
|
// [svenska, engelska, villkor]
|
|
161
161
|
["Nyårsdagen", "New Year's Day", s === 1 && i === 1],
|
|
162
162
|
["Trettondedag jul", "Epiphany", s === 1 && i === 6],
|
|
@@ -164,9 +164,9 @@ let f = class extends j {
|
|
|
164
164
|
["Påskdagen", "Easter Sunday", +t == +a],
|
|
165
165
|
["Annandag påsk", "Easter Monday", +t == +this._addDays(a, 1)],
|
|
166
166
|
["Kristi himmelsfärdsdag", "Ascension Day", +t == +this._addDays(a, 39)],
|
|
167
|
-
["Pingstdagen", "Pentecost", +t == +this._addDays(a, 50) &&
|
|
167
|
+
["Pingstdagen", "Pentecost", +t == +this._addDays(a, 50) && l < 2005],
|
|
168
168
|
["Första maj", "May Day", s === 5 && i === 1],
|
|
169
|
-
["Nationaldagen", "National Day", s === 6 && i === 6 &&
|
|
169
|
+
["Nationaldagen", "National Day", s === 6 && i === 6 && l >= 2005],
|
|
170
170
|
["Midsommarafton", "Midsummer's Eve", s === 6 && i >= 19 && i <= 25 && t.getDay() === 5],
|
|
171
171
|
["Midsommardagen", "Midsummer's Day", s === 6 && i >= 20 && i <= 26 && t.getDay() === 6],
|
|
172
172
|
["Julafton", "Christmas Eve", s === 12 && i === 24],
|
|
@@ -181,7 +181,7 @@ let f = class extends j {
|
|
|
181
181
|
return null;
|
|
182
182
|
}
|
|
183
183
|
render() {
|
|
184
|
-
const t = this._current.getFullYear(), e = this._current.getMonth(), s = this._daysInMonth(t, e), i = this._firstDayOfWeek(t, e),
|
|
184
|
+
const t = this._current.getFullYear(), e = this._current.getMonth(), s = this._daysInMonth(t, e), i = this._firstDayOfWeek(t, e), l = this._today, a = this.lang === "en", d = a ? [
|
|
185
185
|
"January",
|
|
186
186
|
"February",
|
|
187
187
|
"March",
|
|
@@ -212,51 +212,51 @@ let f = class extends j {
|
|
|
212
212
|
this.disableWeekend && (p = p.slice(0, 5));
|
|
213
213
|
const k = Array.from(this.querySelectorAll("scb-calendar-event")), v = /* @__PURE__ */ new Map();
|
|
214
214
|
for (const n of k) {
|
|
215
|
-
const
|
|
216
|
-
if (
|
|
217
|
-
const c = new Date(
|
|
215
|
+
const o = n.getAttribute("start-date") || "", u = n.getAttribute("end-date") || "";
|
|
216
|
+
if (o && u) {
|
|
217
|
+
const c = new Date(o), y = new Date(u);
|
|
218
218
|
for (let m = new Date(c); m <= y; m.setDate(m.getDate() + 1)) {
|
|
219
219
|
const g = m.toISOString().split("T")[0], E = v.get(g) || [];
|
|
220
220
|
E.push({
|
|
221
221
|
title: n.title,
|
|
222
222
|
description: n.description,
|
|
223
|
-
start:
|
|
223
|
+
start: o,
|
|
224
224
|
end: u
|
|
225
225
|
}), v.set(g, E);
|
|
226
226
|
}
|
|
227
|
-
} else if (
|
|
228
|
-
const c =
|
|
229
|
-
y.push({ title: n.title, description: n.description, start:
|
|
227
|
+
} else if (o && n.title) {
|
|
228
|
+
const c = o.split("T")[0], y = v.get(c) || [];
|
|
229
|
+
y.push({ title: n.title, description: n.description, start: o }), v.set(c, y);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
const A = [];
|
|
233
233
|
let x = 1;
|
|
234
234
|
for (let n = 0; n < 6; n++) {
|
|
235
|
-
const
|
|
235
|
+
const o = [], u = this.disableWeekend ? [0, 1, 2, 3, 4] : [0, 1, 2, 3, 4, 5, 6];
|
|
236
236
|
let c = x;
|
|
237
237
|
for (let y = 0; y < u.length; y++) {
|
|
238
238
|
const m = u[y];
|
|
239
239
|
if (n === 0 && m < i) {
|
|
240
240
|
if (!this.disableWeekend || m < 5) {
|
|
241
241
|
const g = e === 0 ? 11 : e - 1, E = e === 0 ? t - 1 : t, F = this._daysInMonth(E, g) - (i - m - 1);
|
|
242
|
-
|
|
242
|
+
o.push(w`
|
|
243
243
|
<div class="calendar-day calendar-day--other">
|
|
244
244
|
<span class="calendar-day-number">${F}</span>
|
|
245
245
|
</div>
|
|
246
246
|
`);
|
|
247
247
|
}
|
|
248
248
|
} else if (c > s)
|
|
249
|
-
|
|
249
|
+
o.push(w`<div></div>`);
|
|
250
250
|
else {
|
|
251
251
|
let g = new Date(t, e, c);
|
|
252
252
|
if (this.disableWeekend)
|
|
253
253
|
for (; g.getDay() === 0 || g.getDay() === 6; )
|
|
254
254
|
c++, g = new Date(t, e, c);
|
|
255
255
|
if (c > s) {
|
|
256
|
-
|
|
256
|
+
o.push(w`<div></div>`);
|
|
257
257
|
continue;
|
|
258
258
|
}
|
|
259
|
-
const E =
|
|
259
|
+
const E = l.getFullYear() === t && l.getMonth() === e && l.getDate() === c, D = `${t}-${String(e + 1).padStart(2, "0")}-${String(c).padStart(2, "0")}`, F = new Date(t, e, c);
|
|
260
260
|
let P = !1, M = null;
|
|
261
261
|
this.publicHolidays && (M = this._swedishHolidayName(F), P = !!M);
|
|
262
262
|
let h = v.get(D) || [];
|
|
@@ -272,7 +272,7 @@ let f = class extends j {
|
|
|
272
272
|
} else r.start && r.start.includes("T") && (b = r.start.split("T")[1].substring(0, 5));
|
|
273
273
|
return { ...r, time: b, prefix: S };
|
|
274
274
|
});
|
|
275
|
-
|
|
275
|
+
o.push(w`
|
|
276
276
|
<div
|
|
277
277
|
class="calendar-day${E ? " today" : ""}${h.length ? " has-event" : ""}${P ? " calendar-day--holiday" : ""}"
|
|
278
278
|
tabindex=${h.length ? "0" : void 0}
|
|
@@ -293,7 +293,7 @@ let f = class extends j {
|
|
|
293
293
|
`), c++;
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
if (x = c, A.push(w`<div class="calendar-grid">${
|
|
296
|
+
if (x = c, A.push(w`<div class="calendar-grid">${o}</div>`), x > s) break;
|
|
297
297
|
}
|
|
298
298
|
return w`
|
|
299
299
|
<div class="calendar-header">
|
|
@@ -310,16 +310,16 @@ let f = class extends j {
|
|
|
310
310
|
${this._popupEvent && Array.isArray(this._popupEvent.events) ? w`
|
|
311
311
|
<scb-dialog variant="floating" open label="${a ? "Events" : "Händelser"} ${this._popupEvent.date}">
|
|
312
312
|
<scb-list>
|
|
313
|
-
${[...this._popupEvent.events].sort((n,
|
|
314
|
-
const u = n.start && n.start.includes("T") ? n.start : n.end && n.end.includes("T") ? n.end : "", c =
|
|
315
|
-
return y && m ? u.localeCompare(c) : y ? -1 : m ? 1 : n.title.localeCompare(
|
|
313
|
+
${[...this._popupEvent.events].sort((n, o) => {
|
|
314
|
+
const u = n.start && n.start.includes("T") ? n.start : n.end && n.end.includes("T") ? n.end : "", c = o.start && o.start.includes("T") ? o.start : o.end && o.end.includes("T") ? o.end : "", y = u && u.includes("T"), m = c && c.includes("T");
|
|
315
|
+
return y && m ? u.localeCompare(c) : y ? -1 : m ? 1 : n.title.localeCompare(o.title);
|
|
316
316
|
}).map((n) => {
|
|
317
317
|
var m;
|
|
318
|
-
const
|
|
318
|
+
const o = ((m = this._popupEvent) == null ? void 0 : m.date) ?? "";
|
|
319
319
|
let u = "", c = "", y = "";
|
|
320
320
|
if (n.start && n.end) {
|
|
321
321
|
const g = n.start.split("T")[0], E = n.end.split("T")[0];
|
|
322
|
-
g === E && n.start.includes("T") && n.end.includes("T") ? u = n.start.split("T")[1].substring(0, 5) + " – " + n.end.split("T")[1].substring(0, 5) :
|
|
322
|
+
g === E && n.start.includes("T") && n.end.includes("T") ? u = n.start.split("T")[1].substring(0, 5) + " – " + n.end.split("T")[1].substring(0, 5) : o === g && n.start.includes("T") && (u = "Start: " + n.start.split("T")[1].substring(0, 5) + (a ? " (Extended event) " : " (Flerdagsevenemang) ")), o === E && n.end.includes("T") && g !== E && (y = (a ? "End: " : "Slut: ") + n.end.split("T")[1].substring(0, 5)), o !== g && (c = a ? "cont. " : "fort. ");
|
|
323
323
|
} else n.start && n.start.includes("T") && (u = n.start.split("T")[1].substring(0, 5));
|
|
324
324
|
return w`
|
|
325
325
|
<scb-list-item label="${c}${n.title}" supporting-text="${n.description ? n.description : ""}" overline="${u || ""}${y || ""}">
|
|
@@ -333,8 +333,8 @@ let f = class extends j {
|
|
|
333
333
|
};
|
|
334
334
|
N = /* @__PURE__ */ new WeakSet();
|
|
335
335
|
O = function() {
|
|
336
|
-
const t = this.mapSpacingToken(this.spacing), e = this.mapSpacingToken(this.spacingTop) ?? t, s = this.mapSpacingToken(this.spacingBottom) ?? t, i = this.mapSpacingToken(this.spacingLeft),
|
|
337
|
-
e ? this.style.setProperty("--scb-calendar-spacing-block-start", e) : this.style.removeProperty("--scb-calendar-spacing-block-start"), s ? this.style.setProperty("--scb-calendar-spacing-block-end", s) : this.style.removeProperty("--scb-calendar-spacing-block-end"), i ? this.style.setProperty("--scb-calendar-spacing-inline-start", i) : this.style.removeProperty("--scb-calendar-spacing-inline-start"),
|
|
336
|
+
const t = this.mapSpacingToken(this.spacing), e = this.mapSpacingToken(this.spacingTop) ?? t, s = this.mapSpacingToken(this.spacingBottom) ?? t, i = this.mapSpacingToken(this.spacingLeft), l = this.mapSpacingToken(this.spacingRight);
|
|
337
|
+
e ? this.style.setProperty("--scb-calendar-spacing-block-start", e) : this.style.removeProperty("--scb-calendar-spacing-block-start"), s ? this.style.setProperty("--scb-calendar-spacing-block-end", s) : this.style.removeProperty("--scb-calendar-spacing-block-end"), i ? this.style.setProperty("--scb-calendar-spacing-inline-start", i) : this.style.removeProperty("--scb-calendar-spacing-inline-start"), l ? this.style.setProperty("--scb-calendar-spacing-inline-end", l) : this.style.removeProperty("--scb-calendar-spacing-inline-end");
|
|
338
338
|
};
|
|
339
339
|
f.styles = W`
|
|
340
340
|
:host {
|
|
@@ -399,7 +399,13 @@ f.styles = W`
|
|
|
399
399
|
border-radius: 6px;
|
|
400
400
|
}
|
|
401
401
|
.calendar-day--other {
|
|
402
|
-
|
|
402
|
+
color: light-dark(var(--n-40), var(--n-70));
|
|
403
|
+
}
|
|
404
|
+
.calendar-day--other .calendar-day-event-title {
|
|
405
|
+
color: inherit;
|
|
406
|
+
}
|
|
407
|
+
.calendar-day--other .calendar-day-number {
|
|
408
|
+
font-weight: var(--weight-regular);
|
|
403
409
|
}
|
|
404
410
|
.calendar-day-number {
|
|
405
411
|
font-size: var(--md-sys-typescale-label-small-size);
|
package/scb-wc-test.bundle.js
CHANGED
|
@@ -4857,7 +4857,13 @@ ${this.value}</textarea
|
|
|
4857
4857
|
border-radius: 6px;
|
|
4858
4858
|
}
|
|
4859
4859
|
.calendar-day--other {
|
|
4860
|
-
|
|
4860
|
+
color: light-dark(var(--n-40), var(--n-70));
|
|
4861
|
+
}
|
|
4862
|
+
.calendar-day--other .calendar-day-event-title {
|
|
4863
|
+
color: inherit;
|
|
4864
|
+
}
|
|
4865
|
+
.calendar-day--other .calendar-day-number {
|
|
4866
|
+
font-weight: var(--weight-regular);
|
|
4861
4867
|
}
|
|
4862
4868
|
.calendar-day-number {
|
|
4863
4869
|
font-size: var(--md-sys-typescale-label-small-size);
|