@golemui/gui-lit 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/{abstract-calendar-BoqKPRmS.js → abstract-calendar-D0-077XJ.js} +18 -18
- package/{calendar-DTYKVYc3.js → calendar-BclCC9VJ.js} +26 -26
- package/{calendar.element-MubSE1bx.js → calendar.element-DcnTyvfg.js} +1 -1
- package/{currency.element-BHXWcOEu.js → currency.element-5GSakkxF.js} +16 -13
- package/{date-DTYg8sog.js → date-CDUlLuYy.js} +50 -45
- package/{date-input-BeQvyfln.js → date-input-DCdGWRio.js} +8 -8
- package/{date-picker.element-DabW_-0-.js → date-picker.element-k7AJFQ5W.js} +8 -6
- package/{date.element-BtVJSIRk.js → date.element-BZO0UQez.js} +1 -1
- package/{dropdown.element-DqzC6aXR.js → dropdown.element-CyJbVAA5.js} +23 -24
- package/index.js +67 -67
- package/index.umd.cjs +148 -145
- package/{number.element-BhEyoOtc.js → number.element-CBr47IiY.js} +18 -16
- package/numeric-jmOOKz30.js +12 -0
- package/package.json +6 -6
- package/{range-calendar-9skwbwlB.js → range-calendar-CBINu84w.js} +54 -54
- package/{range-calendar.element-QTE6vGNP.js → range-calendar.element-_1bHW_c1.js} +1 -1
- package/{range-date-input-Uy8134vi.js → range-date-input-BYXzqnr1.js} +26 -26
- package/{range-date-input.element-Dj29D_OQ.js → range-date-input.element-BqzAF0O3.js} +1 -1
- package/{range-date-picker.element-CuKIBkIO.js → range-date-picker.element-BCBefgvY.js} +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { property as o, state as
|
|
3
|
-
import { G as
|
|
1
|
+
import { LitElement as S, nothing as _, html as d } from "lit";
|
|
2
|
+
import { property as o, state as x } from "lit/decorators.js";
|
|
3
|
+
import { G as A, b as $, c as I } from "./templates-Dk1jxLwS.js";
|
|
4
4
|
import { repeat as D } from "lit-html/directives/repeat.js";
|
|
5
|
-
import { d as
|
|
6
|
-
var
|
|
5
|
+
import { d as k, e as B, p as w, t as v, w as Y } from "./date-CDUlLuYy.js";
|
|
6
|
+
var O = Object.defineProperty, s = (m, t, r, a) => {
|
|
7
7
|
for (var e = void 0, n = m.length - 1, l; n >= 0; n--)
|
|
8
8
|
(l = m[n]) && (e = l(t, r, e) || e);
|
|
9
|
-
return e &&
|
|
9
|
+
return e && O(t, r, e), e;
|
|
10
10
|
};
|
|
11
|
-
class i extends
|
|
11
|
+
class i extends S {
|
|
12
12
|
constructor() {
|
|
13
|
-
super(...arguments), this.uid = void 0, this.label = void 0, this.hint = void 0, this.localeId = void 0, this.errors = [], this.touched = void 0, this.required = !1, this.disabled = !1, this.readOnly = !1, this.prevMonthIcon = "", this.nextMonthIcon = "", this.prevMonthAriaLabel = "", this.nextMonthAriaLabel = "", this.dayFormat = "numeric", this.weekdayFormat = "narrow", this.monthFormat = "long", this.minDate = void 0, this.maxDate = void 0, this.disabledRanges = void 0, this.numberOfMonths = 1, this._currentDate = /* @__PURE__ */ new Date(), this._yearSelectorOpen = !1, this.ariaController = new
|
|
13
|
+
super(...arguments), this.uid = void 0, this.label = void 0, this.hint = void 0, this.localeId = void 0, this.errors = [], this.touched = void 0, this.required = !1, this.disabled = !1, this.readOnly = !1, this.prevMonthIcon = "", this.nextMonthIcon = "", this.prevMonthAriaLabel = "", this.nextMonthAriaLabel = "", this.dayFormat = "numeric", this.weekdayFormat = "narrow", this.monthFormat = "long", this.minDate = void 0, this.maxDate = void 0, this.disabledRanges = void 0, this.numberOfMonths = 1, this._currentDate = /* @__PURE__ */ new Date(), this._yearSelectorOpen = !1, this.ariaController = new A(this, {
|
|
14
14
|
getTargets: () => this.querySelectorAll(".gui-calendar-input"),
|
|
15
15
|
getState: () => ({
|
|
16
16
|
uid: this.uid,
|
|
@@ -37,7 +37,7 @@ class i extends M {
|
|
|
37
37
|
required: this.required
|
|
38
38
|
}, r = Array.from({ length: this.numberOfMonths ?? 1 }, (a, e) => e);
|
|
39
39
|
return d`
|
|
40
|
-
${this.label ?
|
|
40
|
+
${this.label ? $(this.uid, t, !1, "calendar") : _}
|
|
41
41
|
|
|
42
42
|
<div class="gui-widget" @focusout=${this.onFocusOut}>
|
|
43
43
|
<div
|
|
@@ -102,14 +102,14 @@ class i extends M {
|
|
|
102
102
|
</div>
|
|
103
103
|
</div>
|
|
104
104
|
|
|
105
|
-
${this.errors?.length ?
|
|
105
|
+
${this.errors?.length ? I(this.uid, t) : _}
|
|
106
106
|
`;
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* Render a month panel
|
|
110
110
|
*/
|
|
111
111
|
renderMonthPanel(t) {
|
|
112
|
-
const r = this.getDaysInMonth(t), a = this.chunkDays(r), e =
|
|
112
|
+
const r = this.getDaysInMonth(t), a = this.chunkDays(r), e = k(this.localeId), n = new Date(this._currentDate);
|
|
113
113
|
return n.setDate(1), n.setMonth(n.getMonth() + t), d`
|
|
114
114
|
<div class="gui-calendar__panel">
|
|
115
115
|
${this.renderHeader(n)}
|
|
@@ -141,7 +141,7 @@ class i extends M {
|
|
|
141
141
|
`;
|
|
142
142
|
}
|
|
143
143
|
renderHeader(t) {
|
|
144
|
-
const r =
|
|
144
|
+
const r = B(this.localeId, t, this.monthFormat);
|
|
145
145
|
return d`
|
|
146
146
|
<header class="gui-calendar__header">
|
|
147
147
|
<h2>
|
|
@@ -279,10 +279,10 @@ class i extends M {
|
|
|
279
279
|
c >= 0 && c < a.length && a[c].focus();
|
|
280
280
|
}
|
|
281
281
|
get _effectiveMinYear() {
|
|
282
|
-
return this.minDate ?
|
|
282
|
+
return this.minDate ? w(this.minDate).getFullYear() : 1900;
|
|
283
283
|
}
|
|
284
284
|
get _effectiveMaxYear() {
|
|
285
|
-
return this.maxDate ?
|
|
285
|
+
return this.maxDate ? w(this.maxDate).getFullYear() : 2099;
|
|
286
286
|
}
|
|
287
287
|
get _yearList() {
|
|
288
288
|
const t = [];
|
|
@@ -350,7 +350,7 @@ class i extends M {
|
|
|
350
350
|
if (this.isButtonDisabled(h[g])) {
|
|
351
351
|
const y = this.findNextFocusableIndex(g, c, h);
|
|
352
352
|
if (y < 0 || y >= h.length) {
|
|
353
|
-
const f = h.findIndex((
|
|
353
|
+
const f = h.findIndex((M) => !this.isButtonDisabled(M));
|
|
354
354
|
f > -1 && h[f].focus();
|
|
355
355
|
} else
|
|
356
356
|
h[y]?.focus();
|
|
@@ -401,7 +401,7 @@ class i extends M {
|
|
|
401
401
|
this._currentDate = new Date(t.getFullYear(), t.getMonth() + 1, 1);
|
|
402
402
|
}
|
|
403
403
|
generateDateGrid(t = 0) {
|
|
404
|
-
const r = this._currentDate.getFullYear(), a = this._currentDate.getMonth() + t, e = new Date(r, a, 1), n = e.getDay(), l =
|
|
404
|
+
const r = this._currentDate.getFullYear(), a = this._currentDate.getMonth() + t, e = new Date(r, a, 1), n = e.getDay(), l = Y(this.localeId)[0], c = (n - l + 7) % 7, u = new Date(e);
|
|
405
405
|
u.setDate(e.getDate() - c);
|
|
406
406
|
const b = [];
|
|
407
407
|
for (let h = 0; h < 42; h++) {
|
|
@@ -535,10 +535,10 @@ s([
|
|
|
535
535
|
o({ type: Number })
|
|
536
536
|
], i.prototype, "numberOfMonths");
|
|
537
537
|
s([
|
|
538
|
-
|
|
538
|
+
x()
|
|
539
539
|
], i.prototype, "_currentDate");
|
|
540
540
|
s([
|
|
541
|
-
|
|
541
|
+
x()
|
|
542
542
|
], i.prototype, "_yearSelectorOpen");
|
|
543
543
|
export {
|
|
544
544
|
i as A
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { html as
|
|
2
|
-
import { property as
|
|
3
|
-
import { classMap as
|
|
4
|
-
import {
|
|
5
|
-
import { A as
|
|
6
|
-
var
|
|
7
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
1
|
+
import { html as p } from "lit";
|
|
2
|
+
import { property as f, customElement as g } from "lit/decorators.js";
|
|
3
|
+
import { classMap as v } from "lit/directives/class-map.js";
|
|
4
|
+
import { p as c, i as d, t as b, b as M, a as C, g as _ } from "./date-CDUlLuYy.js";
|
|
5
|
+
import { A as y } from "./abstract-calendar-D0-077XJ.js";
|
|
6
|
+
var w = Object.defineProperty, O = Object.getOwnPropertyDescriptor, D = (e, t, n, r) => {
|
|
7
|
+
for (var i = r > 1 ? void 0 : r ? O(t, n) : t, s = e.length - 1, a; s >= 0; s--)
|
|
8
8
|
(a = e[s]) && (i = (r ? a(t, n, i) : a(i)) || i);
|
|
9
|
-
return r && i &&
|
|
9
|
+
return r && i && w(t, n, i), i;
|
|
10
10
|
};
|
|
11
|
-
let l = class extends
|
|
11
|
+
let l = class extends y {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments), this.value = void 0;
|
|
14
14
|
}
|
|
@@ -20,8 +20,8 @@ let l = class extends C {
|
|
|
20
20
|
}
|
|
21
21
|
willUpdate(e) {
|
|
22
22
|
if (e.has("value") && this.value) {
|
|
23
|
-
const t =
|
|
24
|
-
!isNaN(t.getTime()) && !
|
|
23
|
+
const t = c(this.value);
|
|
24
|
+
!isNaN(t.getTime()) && !d(t, this._currentDate, this.numberOfMonths ?? 1) && (this._currentDate = t);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
renderDay(e) {
|
|
@@ -32,14 +32,14 @@ let l = class extends C {
|
|
|
32
32
|
disabled: e.isDisabled,
|
|
33
33
|
"other-month": !e.isCurrentMonth
|
|
34
34
|
};
|
|
35
|
-
return
|
|
35
|
+
return p`
|
|
36
36
|
<button
|
|
37
37
|
type="button"
|
|
38
38
|
role="gridcell"
|
|
39
|
-
class=${
|
|
39
|
+
class=${v(t)}
|
|
40
40
|
tabindex=${e.isFocusable ? 0 : -1}
|
|
41
41
|
?disabled=${!e.isCurrentMonth || e.isDisabled}
|
|
42
|
-
data-date=${e.date
|
|
42
|
+
data-date=${b(e.date)}
|
|
43
43
|
@click=${() => this.selectDate(e)}
|
|
44
44
|
@keydown=${(n) => this.handleKeydown(n, e)}
|
|
45
45
|
aria-selected=${e.isSelected}
|
|
@@ -53,22 +53,22 @@ let l = class extends C {
|
|
|
53
53
|
t.setDate(1), t.setMonth(t.getMonth() + e);
|
|
54
54
|
const n = this.generateDateGrid(e), r = t.getMonth();
|
|
55
55
|
let i = n.map((s) => {
|
|
56
|
-
const a = s.getMonth() === r, o = this.isDisabled(s),
|
|
56
|
+
const a = s.getMonth() === r, o = this.isDisabled(s), u = !!this.value && M(s, c(this.value)), h = C(s), m = (u || h) && a;
|
|
57
57
|
return {
|
|
58
58
|
date: s,
|
|
59
|
-
dayLabel:
|
|
59
|
+
dayLabel: _(this.localeId, s),
|
|
60
60
|
isCurrentMonth: a,
|
|
61
|
-
isToday:
|
|
61
|
+
isToday: h,
|
|
62
62
|
isDisabled: o,
|
|
63
|
-
isSelected:
|
|
64
|
-
isFocusable:
|
|
63
|
+
isSelected: u,
|
|
64
|
+
isFocusable: m
|
|
65
65
|
};
|
|
66
66
|
});
|
|
67
67
|
for (let s = 0; s < 2; s++)
|
|
68
68
|
i.slice(-7).every((o) => !o.isCurrentMonth) && (i = i.slice(0, -7));
|
|
69
69
|
if (e === 0 && !i.some((s) => s.isFocusable)) {
|
|
70
|
-
const s = this.value ?
|
|
71
|
-
if (!
|
|
70
|
+
const s = this.value ? c(this.value) : /* @__PURE__ */ new Date();
|
|
71
|
+
if (!d(s, this._currentDate, this.numberOfMonths ?? 1)) {
|
|
72
72
|
const a = i.find((o) => o.isCurrentMonth && !o.isDisabled);
|
|
73
73
|
a && (a.isFocusable = !0);
|
|
74
74
|
}
|
|
@@ -77,7 +77,7 @@ let l = class extends C {
|
|
|
77
77
|
}
|
|
78
78
|
selectDate(e) {
|
|
79
79
|
if (!e.isCurrentMonth || e.isDisabled || this.disabled || this.readOnly) return;
|
|
80
|
-
const t =
|
|
80
|
+
const t = b(e.date);
|
|
81
81
|
this.value = t, this.dispatchEvent(
|
|
82
82
|
new CustomEvent("change", {
|
|
83
83
|
detail: { value: t },
|
|
@@ -87,10 +87,10 @@ let l = class extends C {
|
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
D([
|
|
91
|
+
f({ type: String })
|
|
92
92
|
], l.prototype, "value", 2);
|
|
93
|
-
l =
|
|
94
|
-
|
|
93
|
+
l = D([
|
|
94
|
+
g("gui-calendar")
|
|
95
95
|
], l);
|
|
96
96
|
typeof customElements < "u" && !customElements.get("gui-calendar") && customElements.define("gui-calendar", l);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InputWidgetAdapter as o, formContext as l, inputContext as h } from "@golemui/lit";
|
|
2
|
-
import "./calendar-
|
|
2
|
+
import "./calendar-BclCC9VJ.js";
|
|
3
3
|
import { consume as m, provide as u } from "@lit/context";
|
|
4
4
|
import { LitElement as c, html as D } from "lit";
|
|
5
5
|
import { property as b, customElement as $ } from "lit/decorators.js";
|
|
@@ -2,13 +2,14 @@ import { InputWidgetAdapter as g, formContext as b, inputContext as v } from "@g
|
|
|
2
2
|
import { LitElement as m, nothing as p, html as d } from "lit";
|
|
3
3
|
import { property as a, state as f, query as $, customElement as y } from "lit/decorators.js";
|
|
4
4
|
import { classMap as D } from "lit/directives/class-map.js";
|
|
5
|
-
import { G as C, a as x, b as F, c as
|
|
6
|
-
import {
|
|
5
|
+
import { G as C, a as x, b as F, c as w } from "./templates-Dk1jxLwS.js";
|
|
6
|
+
import { b as S, a as _ } from "./numeric-jmOOKz30.js";
|
|
7
|
+
import { consume as E, provide as I } from "@lit/context";
|
|
7
8
|
import "rxjs";
|
|
8
|
-
var
|
|
9
|
-
for (var s =
|
|
10
|
-
(u = t[
|
|
11
|
-
return
|
|
9
|
+
var O = Object.defineProperty, N = Object.getOwnPropertyDescriptor, r = (t, e, o, n) => {
|
|
10
|
+
for (var s = n > 1 ? void 0 : n ? N(e, o) : e, l = t.length - 1, u; l >= 0; l--)
|
|
11
|
+
(u = t[l]) && (s = (n ? u(e, o, s) : u(s)) || s);
|
|
12
|
+
return n && s && O(e, o, s), s;
|
|
12
13
|
};
|
|
13
14
|
let i = class extends m {
|
|
14
15
|
constructor() {
|
|
@@ -77,6 +78,8 @@ let i = class extends m {
|
|
|
77
78
|
placeholder=${this.placeholder || p}
|
|
78
79
|
autocomplete=${this.autocomplete || p}
|
|
79
80
|
@input=${this.handleInput}
|
|
81
|
+
@beforeinput=${S}
|
|
82
|
+
@keydown=${_}
|
|
80
83
|
@focus=${this.handleFocus}
|
|
81
84
|
@blur=${this.handleBlur}
|
|
82
85
|
/>
|
|
@@ -88,7 +91,7 @@ let i = class extends m {
|
|
|
88
91
|
${e.html}
|
|
89
92
|
</div>
|
|
90
93
|
|
|
91
|
-
${
|
|
94
|
+
${w(this.uid, t)}
|
|
92
95
|
`;
|
|
93
96
|
}
|
|
94
97
|
handleInput(t) {
|
|
@@ -199,10 +202,10 @@ i = r([
|
|
|
199
202
|
y("gui-currency")
|
|
200
203
|
], i);
|
|
201
204
|
typeof customElements < "u" && !customElements.get("gui-currency") && customElements.define("gui-currency", i);
|
|
202
|
-
var
|
|
203
|
-
for (var s =
|
|
204
|
-
(u = t[
|
|
205
|
-
return
|
|
205
|
+
var q = Object.defineProperty, P = Object.getOwnPropertyDescriptor, h = (t, e, o, n) => {
|
|
206
|
+
for (var s = n > 1 ? void 0 : n ? P(e, o) : e, l = t.length - 1, u; l >= 0; l--)
|
|
207
|
+
(u = t[l]) && (s = (n ? u(e, o, s) : u(s)) || s);
|
|
208
|
+
return n && s && q(e, o, s), s;
|
|
206
209
|
};
|
|
207
210
|
let c = class extends m {
|
|
208
211
|
constructor() {
|
|
@@ -255,11 +258,11 @@ let c = class extends m {
|
|
|
255
258
|
}
|
|
256
259
|
};
|
|
257
260
|
h([
|
|
258
|
-
|
|
261
|
+
E({ context: b }),
|
|
259
262
|
a({ attribute: !1 })
|
|
260
263
|
], c.prototype, "formContext", 2);
|
|
261
264
|
h([
|
|
262
|
-
|
|
265
|
+
I({ context: v })
|
|
263
266
|
], c.prototype, "adapter", 2);
|
|
264
267
|
c = h([
|
|
265
268
|
y("gui-currency-input")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const r = {
|
|
2
2
|
aa: { firstDay: 7, weekend: [6, 7], minimalDays: 1 },
|
|
3
3
|
"aa-DJ": { firstDay: 6, weekend: [6, 7], minimalDays: 1 },
|
|
4
4
|
"aa-ER": { firstDay: 1, weekend: [6, 7], minimalDays: 1 },
|
|
@@ -711,75 +711,80 @@ const t = {
|
|
|
711
711
|
zu: { firstDay: 7, weekend: [6, 7], minimalDays: 1 }
|
|
712
712
|
};
|
|
713
713
|
function y(e) {
|
|
714
|
-
const
|
|
715
|
-
return `${
|
|
714
|
+
const a = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), i = String(e.getDate()).padStart(2, "0");
|
|
715
|
+
return `${a}-${n}-${i}`;
|
|
716
716
|
}
|
|
717
|
-
function
|
|
718
|
-
|
|
717
|
+
function t(e) {
|
|
718
|
+
const a = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
719
|
+
return a ? new Date(Number(a[1]), Number(a[2]) - 1, Number(a[3])) : new Date(e);
|
|
719
720
|
}
|
|
720
|
-
function
|
|
721
|
-
return e
|
|
721
|
+
function w(e) {
|
|
722
|
+
return f(e, /* @__PURE__ */ new Date());
|
|
722
723
|
}
|
|
723
|
-
function f(e) {
|
|
724
|
-
|
|
725
|
-
return [...i.slice(n), ...i.slice(0, n)];
|
|
724
|
+
function f(e, a) {
|
|
725
|
+
return e.getDate() === a.getDate() && e.getMonth() === a.getMonth() && e.getFullYear() === a.getFullYear();
|
|
726
726
|
}
|
|
727
727
|
function l(e) {
|
|
728
|
-
const
|
|
729
|
-
return
|
|
728
|
+
const a = [0, 1, 2, 3, 4, 5, 6], n = e % 7;
|
|
729
|
+
return [...a.slice(n), ...a.slice(0, n)];
|
|
730
730
|
}
|
|
731
|
-
function
|
|
732
|
-
const
|
|
733
|
-
return l(
|
|
731
|
+
function d(e) {
|
|
732
|
+
const a = r[e ?? "en"] || { firstDay: 0 };
|
|
733
|
+
return l(a.firstDay);
|
|
734
|
+
}
|
|
735
|
+
function o(e) {
|
|
736
|
+
const a = new Intl.DateTimeFormat(e, { weekday: "narrow" }), n = new Date(2025, 10, 30);
|
|
737
|
+
return d(e).map((i) => {
|
|
734
738
|
const s = new Date(n);
|
|
735
|
-
return s.setDate(n.getDate() +
|
|
739
|
+
return s.setDate(n.getDate() + i), a.format(s);
|
|
736
740
|
});
|
|
737
741
|
}
|
|
738
|
-
function
|
|
739
|
-
for (let
|
|
740
|
-
const s = new Date(
|
|
742
|
+
function u(e, a, n) {
|
|
743
|
+
for (let i = 0; i < n; i++) {
|
|
744
|
+
const s = new Date(a.getFullYear(), a.getMonth() + i, 1);
|
|
741
745
|
if (e.getMonth() === s.getMonth() && e.getFullYear() === s.getFullYear())
|
|
742
746
|
return !0;
|
|
743
747
|
}
|
|
744
748
|
return !1;
|
|
745
749
|
}
|
|
746
|
-
function g(e,
|
|
747
|
-
return new Intl.DateTimeFormat(e, { month: n, year: "numeric" }).formatToParts(
|
|
750
|
+
function g(e, a, n = "long") {
|
|
751
|
+
return new Intl.DateTimeFormat(e, { month: n, year: "numeric" }).formatToParts(a).filter((s) => s.type === "month" || s.type === "year");
|
|
748
752
|
}
|
|
749
|
-
function
|
|
750
|
-
const n = e || "en-US", m = new Intl.DateTimeFormat(n, { day: "numeric" }).formatToParts(
|
|
751
|
-
return m ? m.value :
|
|
753
|
+
function c(e, a) {
|
|
754
|
+
const n = e || "en-US", m = new Intl.DateTimeFormat(n, { day: "numeric" }).formatToParts(a).find((D) => D.type === "day");
|
|
755
|
+
return m ? m.value : a.getDate().toString();
|
|
752
756
|
}
|
|
753
|
-
function
|
|
754
|
-
const n = y(e),
|
|
755
|
-
return n ===
|
|
757
|
+
function k(e, a) {
|
|
758
|
+
const n = y(e), i = y(a);
|
|
759
|
+
return n === i ? { start: n } : { start: n, end: i };
|
|
756
760
|
}
|
|
757
|
-
function
|
|
758
|
-
return e.length ? e.map((
|
|
759
|
-
start:
|
|
760
|
-
end:
|
|
761
|
-
})).sort((
|
|
762
|
-
(
|
|
763
|
-
const m =
|
|
761
|
+
function b(e) {
|
|
762
|
+
return e.length ? e.map((i) => ({
|
|
763
|
+
start: t(i.start).getTime(),
|
|
764
|
+
end: t(i.end ?? i.start).getTime()
|
|
765
|
+
})).sort((i, s) => i.start - s.start).reduce(
|
|
766
|
+
(i, s) => {
|
|
767
|
+
const m = i[i.length - 1];
|
|
764
768
|
if (m) {
|
|
765
769
|
const D = new Date(m.end);
|
|
766
770
|
if (D.setDate(D.getDate() + 1), s.start <= D.getTime())
|
|
767
|
-
return m.end = Math.max(m.end, s.end),
|
|
771
|
+
return m.end = Math.max(m.end, s.end), i;
|
|
768
772
|
}
|
|
769
|
-
return [...
|
|
773
|
+
return [...i, s];
|
|
770
774
|
},
|
|
771
775
|
[]
|
|
772
|
-
).map((
|
|
776
|
+
).map((i) => k(new Date(i.start), new Date(i.end))) : [];
|
|
773
777
|
}
|
|
774
778
|
export {
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
+
w as a,
|
|
780
|
+
f as b,
|
|
781
|
+
k as c,
|
|
782
|
+
o as d,
|
|
779
783
|
g as e,
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
784
|
+
c as g,
|
|
785
|
+
u as i,
|
|
786
|
+
b as m,
|
|
787
|
+
t as p,
|
|
783
788
|
y as t,
|
|
784
|
-
|
|
789
|
+
d as w
|
|
785
790
|
};
|
|
@@ -3,12 +3,12 @@ import { repeat as g } from "lit-html/directives/repeat.js";
|
|
|
3
3
|
import { property as l, state as p, customElement as m } from "lit/decorators.js";
|
|
4
4
|
import { classMap as _ } from "lit/directives/class-map.js";
|
|
5
5
|
import { live as f } from "lit/directives/live.js";
|
|
6
|
-
import { G as v, b as
|
|
7
|
-
import { t as w } from "./date-
|
|
8
|
-
var
|
|
9
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
6
|
+
import { G as v, b as S, c as A } from "./templates-Dk1jxLwS.js";
|
|
7
|
+
import { p as b, t as w } from "./date-CDUlLuYy.js";
|
|
8
|
+
var I = Object.defineProperty, D = Object.getOwnPropertyDescriptor, h = (t, e, a, i) => {
|
|
9
|
+
for (var r = i > 1 ? void 0 : i ? D(e, a) : e, n = t.length - 1, s; n >= 0; n--)
|
|
10
10
|
(s = t[n]) && (r = (i ? s(e, a, r) : s(r)) || r);
|
|
11
|
-
return i && r &&
|
|
11
|
+
return i && r && I(e, a, r), r;
|
|
12
12
|
};
|
|
13
13
|
let o = class extends y {
|
|
14
14
|
constructor() {
|
|
@@ -56,7 +56,7 @@ let o = class extends y {
|
|
|
56
56
|
[this.icon]: !0
|
|
57
57
|
};
|
|
58
58
|
return d`
|
|
59
|
-
${this.label ?
|
|
59
|
+
${this.label ? S(this.uid, t) : u}
|
|
60
60
|
|
|
61
61
|
<div class="gui-widget">
|
|
62
62
|
<div
|
|
@@ -86,7 +86,7 @@ let o = class extends y {
|
|
|
86
86
|
${this.icon ? d`<span class=${_(a)} data-icon=${this.icon}></span>` : u}
|
|
87
87
|
</div>
|
|
88
88
|
|
|
89
|
-
${this.showErrors && this.errors?.length ?
|
|
89
|
+
${this.showErrors && this.errors?.length ? A(this.uid, t) : u}
|
|
90
90
|
`;
|
|
91
91
|
}
|
|
92
92
|
renderInput(t, e, a, i, r) {
|
|
@@ -120,7 +120,7 @@ let o = class extends y {
|
|
|
120
120
|
this._day = "", this._month = "", this._year = "";
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
const e =
|
|
123
|
+
const e = b(t);
|
|
124
124
|
isNaN(e.getTime()) || (this._day = e.getDate().toString().padStart(2, "0"), this._month = (e.getMonth() + 1).toString().padStart(2, "0"), this._year = e.getFullYear().toString());
|
|
125
125
|
}
|
|
126
126
|
handleKeyDown(t) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { InputWidgetAdapter as h, formContext as u, inputContext as c } from "@golemui/lit";
|
|
2
2
|
import { a as m, b as g, c as C } from "./templates-Dk1jxLwS.js";
|
|
3
|
-
import "./date-input-
|
|
4
|
-
import "./calendar-
|
|
3
|
+
import "./date-input-DCdGWRio.js";
|
|
4
|
+
import "./calendar-BclCC9VJ.js";
|
|
5
5
|
import { consume as D, provide as $ } from "@lit/context";
|
|
6
|
-
import { LitElement as
|
|
6
|
+
import { LitElement as f, html as p, nothing as v } from "lit";
|
|
7
7
|
import { property as b, query as o, state as y, customElement as I } from "lit/decorators.js";
|
|
8
8
|
import "rxjs";
|
|
9
9
|
import { classMap as O } from "lit/directives/class-map.js";
|
|
@@ -12,7 +12,7 @@ var w = Object.defineProperty, x = Object.getOwnPropertyDescriptor, n = (e, t, a
|
|
|
12
12
|
(l = e[d]) && (r = (i ? l(t, a, r) : l(r)) || r);
|
|
13
13
|
return i && r && w(t, a, r), r;
|
|
14
14
|
};
|
|
15
|
-
let s = class extends
|
|
15
|
+
let s = class extends f {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments), this.adapter = new h(), this.isCalendarOpen = !1, this.subscriptions = [], this.onFocusOut = (e) => {
|
|
18
18
|
if (!this.isCalendarOpen) return;
|
|
@@ -62,7 +62,7 @@ let s = class extends v {
|
|
|
62
62
|
.localeId=${this.adapter.templateData.lang}
|
|
63
63
|
@blur=${this.onBlurCalendar}
|
|
64
64
|
@change=${this.onCalendarChange}
|
|
65
|
-
></gui-calendar>` :
|
|
65
|
+
></gui-calendar>` : v;
|
|
66
66
|
return p`
|
|
67
67
|
${g(this.widget.uid, {
|
|
68
68
|
...this.adapter.templateData,
|
|
@@ -129,7 +129,9 @@ let s = class extends v {
|
|
|
129
129
|
t.target === t.currentTarget && (t?.key === "Enter" || t?.key === " ") && (this.isCalendarOpen = !this.isCalendarOpen, this.requestUpdate());
|
|
130
130
|
}
|
|
131
131
|
toggleCalendar(e) {
|
|
132
|
-
const t = e.target
|
|
132
|
+
const t = e.target;
|
|
133
|
+
if (t.closest(".gui-calendar__day-button")) return;
|
|
134
|
+
const a = t.closest(".gui-date-input__part"), i = t.closest("gui-calendar");
|
|
133
135
|
a || i ? this.openCalendar() : (this.isCalendarOpen = !this.isCalendarOpen, this.requestUpdate());
|
|
134
136
|
}
|
|
135
137
|
openCalendar() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InputWidgetAdapter as l, formContext as n, inputContext as u } from "@golemui/lit";
|
|
2
2
|
import { a as h } from "./templates-Dk1jxLwS.js";
|
|
3
|
-
import "./date-input-
|
|
3
|
+
import "./date-input-DCdGWRio.js";
|
|
4
4
|
import { consume as c, provide as m } from "@lit/context";
|
|
5
5
|
import { LitElement as f, html as b } from "lit";
|
|
6
6
|
import { property as g, customElement as D } from "lit/decorators.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { InputWidgetAdapter as v, formContext as w, inputContext as y } from "@golemui/lit";
|
|
2
2
|
import { consume as F, provide as C } from "@lit/context";
|
|
3
|
-
import { LitElement as x, nothing as m, html as
|
|
3
|
+
import { LitElement as x, nothing as m, html as g } from "lit";
|
|
4
4
|
import { property as D, state as c, query as I, customElement as L } from "lit/decorators.js";
|
|
5
5
|
import { Subject as R, debounceTime as V } from "rxjs";
|
|
6
6
|
import { d as k } from "./list-D1oKnH89.js";
|
|
7
7
|
import "./errors-QjKhr6mA.js";
|
|
8
|
-
var
|
|
9
|
-
for (var
|
|
10
|
-
(
|
|
11
|
-
return s &&
|
|
8
|
+
var j = Object.defineProperty, O = Object.getOwnPropertyDescriptor, l = (e, t, i, s) => {
|
|
9
|
+
for (var r = s > 1 ? void 0 : s ? O(t, i) : t, o = e.length - 1, h; o >= 0; o--)
|
|
10
|
+
(h = e[o]) && (r = (s ? h(t, i, r) : h(r)) || r);
|
|
11
|
+
return s && r && j(t, i, r), r;
|
|
12
12
|
};
|
|
13
13
|
let a = class extends x {
|
|
14
14
|
constructor() {
|
|
@@ -83,15 +83,14 @@ let a = class extends x {
|
|
|
83
83
|
if (this.adapter.filterChanged(e), e && !i) {
|
|
84
84
|
this._isFiltering = !0, this._isListVisible = !0;
|
|
85
85
|
const s = t.searchFields ?? [t.labelField, t.valueField].filter(
|
|
86
|
-
(
|
|
87
|
-
),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return n ? r.filter((p) => s.includes(p)).reduce(u, !1) : r.reduce(u, !1);
|
|
86
|
+
(n) => !!n
|
|
87
|
+
), r = s.length > 0, h = (t.items || []).filter((n) => {
|
|
88
|
+
if (n === null || typeof n != "object")
|
|
89
|
+
return n != null && n.toString().toLowerCase().includes(e.toLowerCase());
|
|
90
|
+
const _ = Object.keys(n), u = (p, f) => p || n[f].toString().toLowerCase().includes(e.toLowerCase());
|
|
91
|
+
return r ? _.filter((p) => s.includes(p)).reduce(u, !1) : _.reduce(u, !1);
|
|
93
92
|
});
|
|
94
|
-
this._filteredItems = [...
|
|
93
|
+
this._filteredItems = [...h];
|
|
95
94
|
} else
|
|
96
95
|
this._isFiltering = !1, this._filteredItems = [...t.items];
|
|
97
96
|
}
|
|
@@ -109,8 +108,8 @@ let a = class extends x {
|
|
|
109
108
|
const e = this.adapter.templateData, t = e.touched && e.errors && e.errors.length > 0, i = this._listItems.slice(this._range.start, this._range.end), s = this.adapter.getItemRenderer(
|
|
110
109
|
e.itemRenderer,
|
|
111
110
|
k
|
|
112
|
-
),
|
|
113
|
-
return
|
|
111
|
+
), o = this._selectedItem?.template !== null && typeof this._selectedItem?.template == "object" ? e.labelField ?? "label" : null, h = o ? this._selectedItem?.template[o] : this._selectedItem?.template, n = !!this.widget.on?.filter;
|
|
112
|
+
return g`
|
|
114
113
|
<gui-label
|
|
115
114
|
.targetElement=${[this._listRef, this._inputRef]}
|
|
116
115
|
.uid=${this.widget.uid}
|
|
@@ -128,7 +127,7 @@ let a = class extends x {
|
|
|
128
127
|
id=${this.widget.uid}
|
|
129
128
|
data-cy=${`${this.widget.uid}_textinput`}
|
|
130
129
|
class="gui-widget-input"
|
|
131
|
-
.value=${
|
|
130
|
+
.value=${h ?? e.value ?? ""}
|
|
132
131
|
?required=${e.validator?.required}
|
|
133
132
|
?disabled=${e.disabled}
|
|
134
133
|
?readonly=${e.readonly}
|
|
@@ -153,7 +152,7 @@ let a = class extends x {
|
|
|
153
152
|
.uid=${this.widget.uid}
|
|
154
153
|
.value=${e.value ?? ""}
|
|
155
154
|
.valueField=${e.valueField}
|
|
156
|
-
.items=${this._isFiltering && !
|
|
155
|
+
.items=${this._isFiltering && !n ? this._filteredItems : e.items}
|
|
157
156
|
.itemHeight=${e.itemHeight}
|
|
158
157
|
.height=${e.height}
|
|
159
158
|
?required=${e.validator?.required}
|
|
@@ -168,9 +167,9 @@ let a = class extends x {
|
|
|
168
167
|
@blur=${this._onBlur}
|
|
169
168
|
@change=${this._onValueChange}
|
|
170
169
|
>
|
|
171
|
-
${i.map((
|
|
172
|
-
const u = this._range.start +
|
|
173
|
-
return
|
|
170
|
+
${i.map((d, _) => {
|
|
171
|
+
const u = this._range.start + _, p = e.value === d.value, f = this._focusedIndex === u, b = e.labelField ?? "label", $ = d.template !== null && typeof d.template == "object" && b && !e.itemRenderer ? d.template[b] : d.template;
|
|
172
|
+
return g`
|
|
174
173
|
<div
|
|
175
174
|
role="option"
|
|
176
175
|
tabindex="-1"
|
|
@@ -178,15 +177,15 @@ let a = class extends x {
|
|
|
178
177
|
id="${this.widget.uid}-item-${u}"
|
|
179
178
|
style="height: ${e.itemHeight || 40}px"
|
|
180
179
|
aria-selected=${p ? "true" : "false"}
|
|
181
|
-
@click=${() => this._onClickItem(
|
|
180
|
+
@click=${() => this._onClickItem(d, u)}
|
|
182
181
|
>
|
|
183
182
|
${s({
|
|
184
183
|
template: $,
|
|
185
|
-
value:
|
|
184
|
+
value: d.value,
|
|
186
185
|
index: u,
|
|
187
186
|
selected: p,
|
|
188
187
|
disabled: !!e.disabled,
|
|
189
|
-
focused:
|
|
188
|
+
focused: f
|
|
190
189
|
})}
|
|
191
190
|
</div>
|
|
192
191
|
`;
|
|
@@ -194,7 +193,7 @@ let a = class extends x {
|
|
|
194
193
|
</gui-list>
|
|
195
194
|
</div>
|
|
196
195
|
|
|
197
|
-
${t ?
|
|
196
|
+
${t ? g`<gui-errors
|
|
198
197
|
.uid=${this.widget.uid}
|
|
199
198
|
.errors=${e.errors}
|
|
200
199
|
.touched=${e.touched}
|