@golemui/gui-lit 1.0.3 → 1.1.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/{button.element-3a7rRHbA.js → button.element-CJay43iR.js} +16 -13
- package/calendar-D31xNsxx.js +267 -0
- package/{range-calendar.element-_1bHW_c1.js → calendar.element-BhFrCsns.js} +16 -16
- package/{checkbox.element-CVskoXEc.js → checkbox.element-DAAVB651.js} +49 -49
- package/{currency.element-5GSakkxF.js → currency.element-D8A2ObpM.js} +15 -11
- package/{date-CDUlLuYy.js → date-DBuYpvcO.js} +88 -29
- package/date-input-DLiMreSS.js +204 -0
- package/date-picker.element-DeUQtbLg.js +357 -0
- package/date-time-calendar-DzU-FtVl.js +374 -0
- package/date-time-calendar.element-BLBcVsFu.js +95 -0
- package/date-time-input-DZaz2heD.js +246 -0
- package/date-time-picker.element-BUbLdV6i.js +440 -0
- package/date-time.element-B5onfSBG.js +93 -0
- package/{date.element-BZO0UQez.js → date.element-BsKhLrEc.js} +27 -19
- package/day-status-CsWStVQV.js +554 -0
- package/{dropdown.element-CyJbVAA5.js → dropdown.element-CXpMwJsU.js} +53 -37
- package/{errors-QjKhr6mA.js → errors-Byb2dIhK.js} +3 -2
- package/focus-leave.controller-2gV0pQd5.js +73 -0
- package/index.js +1635 -948
- package/index.umd.cjs +2046 -601
- package/lib/components/date-picker.element.d.ts +0 -11
- package/lib/components/date-time-calendar.element.d.ts +18 -0
- package/lib/components/date-time-picker.element.d.ts +18 -0
- package/lib/components/date-time.element.d.ts +18 -0
- package/lib/components/dropdown.element.d.ts +2 -0
- package/lib/components/range-calendar.element.d.ts +2 -1
- package/lib/components/range-date-picker.element.d.ts +0 -15
- package/lib/components/range-date-time-calendar.element.d.ts +18 -0
- package/lib/components/range-date-time-input.element.d.ts +18 -0
- package/lib/components/range-date-time-picker.element.d.ts +18 -0
- package/lib/components/range-time-input.element.d.ts +18 -0
- package/lib/components/range-time-picker.element.d.ts +18 -0
- package/lib/components/time-picker.element.d.ts +18 -0
- package/lib/components/time.element.d.ts +18 -0
- package/list-D730tmGN.js +297 -0
- package/{list.element-Co3V3Cn5.js → list.element-eo3DIOrp.js} +23 -23
- package/{markdown.element-p-kC47D7.js → markdown.element-FbtwdnAv.js} +310 -218
- package/{number.element-CBr47IiY.js → number.element-BEpOCzXy.js} +76 -61
- package/package.json +6 -6
- package/part-templates-VORbpgs2.js +691 -0
- package/{password.element-n-R9RbkB.js → password.element-CBaB8h5b.js} +19 -17
- package/pill-ranges-DpvWwP-3.js +48 -0
- package/{pills-B66qz_KX.js → pills-BDMO2NiR.js} +84 -59
- package/popup.controller-B33OvX_y.js +86 -0
- package/{radiogroup.element-CeQn623u.js → radiogroup.element-KWzBx8mx.js} +55 -51
- package/range-calendar-DO_woqcF.js +466 -0
- package/{calendar.element-DcnTyvfg.js → range-calendar.element-DHLZhpnj.js} +37 -29
- package/range-commit-8-MmYUyo.js +14 -0
- package/range-date-input-Br7XqQPK.js +311 -0
- package/{range-date-input.element-BqzAF0O3.js → range-date-input.element-BdD4SlB4.js} +12 -8
- package/range-date-picker.element-DWRHiAoC.js +434 -0
- package/range-date-time-calendar-B3EMgN1E.js +734 -0
- package/range-date-time-calendar.element-Coea6RF4.js +97 -0
- package/range-date-time-input-Cu-T_nuC.js +353 -0
- package/range-date-time-input.element-Cti44iuW.js +87 -0
- package/range-date-time-picker.element-CDN2RL1y.js +472 -0
- package/range-selection-CU3hxLJE.js +25 -0
- package/range-time-input-BP9ZL9O8.js +348 -0
- package/range-time-input.element-B7wtHJoQ.js +84 -0
- package/range-time-picker.element-CPIAiQPC.js +470 -0
- package/{repeater.element-CtNgB4F5.js → repeater.element-BM1Keckd.js} +1 -1
- package/{select.element-jcDF1h-g.js → select.element-eepcXTpL.js} +117 -107
- package/{tabs.element-BvAyI71N.js → tabs.element-CvcIA8P3.js} +1 -0
- package/{tags.element-CX3vQL8L.js → tags.element-CPHgotb0.js} +21 -14
- package/templates-Dmr34nwp.js +88 -0
- package/{textarea.element-HThYqdR_.js → textarea.element-CiNEy9uq.js} +8 -7
- package/{textinput.element-CkXNzMUg.js → textinput.element-AL2Nr768.js} +10 -9
- package/time-input-5dkSm8UW.js +201 -0
- package/time-list-DLcq8BAp.js +217 -0
- package/time-picker-g337F8d0.js +299 -0
- package/time-picker.element-DLihegjg.js +89 -0
- package/time.element-BneqgMlQ.js +85 -0
- package/{toggle.element-C1kCw5H8.js → toggle.element-Cz91CRdp.js} +44 -43
- package/abstract-calendar-D0-077XJ.js +0 -545
- package/calendar-BclCC9VJ.js +0 -96
- package/date-input-DCdGWRio.js +0 -268
- package/date-picker.element-k7AJFQ5W.js +0 -168
- package/list-D1oKnH89.js +0 -283
- package/range-calendar-CBINu84w.js +0 -255
- package/range-date-input-BYXzqnr1.js +0 -395
- package/range-date-picker.element-BCBefgvY.js +0 -182
- package/templates-Dk1jxLwS.js +0 -75
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { InputWidgetAdapter as
|
|
2
|
-
import "./calendar-
|
|
1
|
+
import { InputWidgetAdapter as n, formContext as o, inputContext as h } from "@golemui/lit";
|
|
2
|
+
import "./range-calendar-DO_woqcF.js";
|
|
3
3
|
import { consume as m, provide as u } from "@lit/context";
|
|
4
|
-
import { LitElement as c, html as
|
|
5
|
-
import { property as
|
|
4
|
+
import { LitElement as c, html as b } from "lit";
|
|
5
|
+
import { property as D, customElement as $ } from "lit/decorators.js";
|
|
6
6
|
import "rxjs";
|
|
7
|
-
var
|
|
8
|
-
for (var a = r > 1 ? void 0 : r ?
|
|
9
|
-
(
|
|
10
|
-
return r && a &&
|
|
7
|
+
var g = Object.defineProperty, f = Object.getOwnPropertyDescriptor, d = (t, e, s, r) => {
|
|
8
|
+
for (var a = r > 1 ? void 0 : r ? f(e, s) : e, l = t.length - 1, p; l >= 0; l--)
|
|
9
|
+
(p = t[l]) && (a = (r ? p(e, s, a) : p(a)) || a);
|
|
10
|
+
return r && a && g(e, s, a), a;
|
|
11
11
|
};
|
|
12
|
-
let
|
|
12
|
+
let i = class extends c {
|
|
13
13
|
constructor() {
|
|
14
|
-
super(...arguments), this.adapter = new
|
|
14
|
+
super(...arguments), this.adapter = new n(), this.subscriptions = [];
|
|
15
15
|
}
|
|
16
16
|
createRenderRoot() {
|
|
17
17
|
return this;
|
|
18
18
|
}
|
|
19
|
-
updated(
|
|
20
|
-
super.updated(
|
|
21
|
-
const
|
|
22
|
-
|
|
19
|
+
updated(t) {
|
|
20
|
+
super.updated(t);
|
|
21
|
+
const e = this.adapter.templateData.size;
|
|
22
|
+
e ? this.style.flex = String(e) : this.style.removeProperty("flex");
|
|
23
23
|
}
|
|
24
24
|
connectedCallback() {
|
|
25
25
|
super.connectedCallback(), this.classList.add("gui-calendar", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
@@ -27,8 +27,8 @@ let s = class extends c {
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
render() {
|
|
30
|
-
return super.render(),
|
|
31
|
-
<gui-calendar
|
|
30
|
+
return super.render(), b`
|
|
31
|
+
<gui-range-calendar
|
|
32
32
|
.uid=${this.widget.uid}
|
|
33
33
|
.label=${this.adapter.templateData.label}
|
|
34
34
|
.hint=${this.adapter.templateData.hint}
|
|
@@ -42,37 +42,45 @@ let s = class extends c {
|
|
|
42
42
|
.nextMonthIcon=${this.adapter.templateData.nextMonthIcon}
|
|
43
43
|
.prevMonthAriaLabel=${this.adapter.templateData.prevMonthAriaLabel}
|
|
44
44
|
.nextMonthAriaLabel=${this.adapter.templateData.nextMonthAriaLabel}
|
|
45
|
+
.selectYearAriaLabel=${this.adapter.templateData.selectYearAriaLabel}
|
|
46
|
+
.yearGridAriaLabel=${this.adapter.templateData.yearGridAriaLabel}
|
|
45
47
|
.dayFormat=${this.adapter.templateData.dayFormat}
|
|
46
48
|
.weekdayFormat=${this.adapter.templateData.weekdayFormat}
|
|
47
49
|
.monthFormat=${this.adapter.templateData.monthFormat}
|
|
48
50
|
.minDate=${this.adapter.templateData.minDate}
|
|
49
51
|
.maxDate=${this.adapter.templateData.maxDate}
|
|
50
52
|
.disabledRanges=${this.adapter.templateData.disabledRanges}
|
|
53
|
+
.disabledDateRangeMessage=${this.adapter.templateData.disabledDateRangeMessage}
|
|
51
54
|
.numberOfMonths=${this.adapter.templateData.numberOfMonths}
|
|
55
|
+
.hidePills=${!1}
|
|
56
|
+
.removePillAriaLabel=${this.adapter.templateData.removePillAriaLabel}
|
|
52
57
|
.localeId=${this.adapter.templateData.lang}
|
|
53
58
|
@change=${this.valueChanged}
|
|
59
|
+
@inputError=${this.onInputError}
|
|
54
60
|
@blur=${() => this.adapter.onBlur()}
|
|
55
|
-
></gui-calendar>
|
|
61
|
+
></gui-range-calendar>
|
|
56
62
|
`;
|
|
57
63
|
}
|
|
58
|
-
valueChanged(
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
valueChanged(t) {
|
|
65
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(t.detail.value);
|
|
66
|
+
}
|
|
67
|
+
onInputError(t) {
|
|
68
|
+
this.adapter.injectValidationIssues([t.detail.message]), this.adapter.onBlur();
|
|
61
69
|
}
|
|
62
70
|
disconnectedCallback() {
|
|
63
|
-
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((
|
|
71
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
|
|
64
72
|
}
|
|
65
73
|
};
|
|
66
74
|
d([
|
|
67
|
-
m({ context:
|
|
68
|
-
|
|
69
|
-
],
|
|
75
|
+
m({ context: o }),
|
|
76
|
+
D({ attribute: !1 })
|
|
77
|
+
], i.prototype, "formContext", 2);
|
|
70
78
|
d([
|
|
71
79
|
u({ context: h })
|
|
72
|
-
],
|
|
73
|
-
|
|
74
|
-
$("gui-calendar-input")
|
|
75
|
-
],
|
|
80
|
+
], i.prototype, "adapter", 2);
|
|
81
|
+
i = d([
|
|
82
|
+
$("gui-range-calendar-input")
|
|
83
|
+
], i);
|
|
76
84
|
export {
|
|
77
|
-
|
|
85
|
+
i as RangeCalendarElement
|
|
78
86
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function u(e, i, r) {
|
|
2
|
+
return r(i, e) < 0 ? { start: i, end: e } : { start: e, end: i };
|
|
3
|
+
}
|
|
4
|
+
function v(e, i, r, n) {
|
|
5
|
+
if (e.kind === "invalid") return { kind: "invalid", message: e.message };
|
|
6
|
+
if (i.kind === "invalid") return { kind: "invalid", message: i.message };
|
|
7
|
+
if (e.kind !== "valid" || i.kind !== "valid") return { kind: "incomplete" };
|
|
8
|
+
const d = n.order ? n.order(e.value, i.value) : { start: e.value, end: i.value }, a = n.validate?.(d) ?? null;
|
|
9
|
+
return a !== null ? { kind: "invalid", message: a } : { kind: "commit", value: n.merge([...r ?? [], n.toRange(d)]) };
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
v as c,
|
|
13
|
+
u as o
|
|
14
|
+
};
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { LitElement as v, nothing as p, html as u } from "lit";
|
|
2
|
+
import { property as r, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import { classMap as y } from "lit/directives/class-map.js";
|
|
4
|
+
import { G as b, b as f, c as _ } from "./templates-Dmr34nwp.js";
|
|
5
|
+
import { n as D, G as P, r as h, q as S, P as E } from "./part-templates-VORbpgs2.js";
|
|
6
|
+
import { a as A, p as c, m as L, t as g } from "./date-DBuYpvcO.js";
|
|
7
|
+
import { r as C, f as $, b as k, a as I, c as R, s as w } from "./pill-ranges-DpvWwP-3.js";
|
|
8
|
+
import { c as O, o as B } from "./range-commit-8-MmYUyo.js";
|
|
9
|
+
import "./pills-BDMO2NiR.js";
|
|
10
|
+
import { styleMap as G } from "lit-html/directives/style-map.js";
|
|
11
|
+
var q = Object.defineProperty, T = Object.getOwnPropertyDescriptor, a = (t, e, l, n) => {
|
|
12
|
+
for (var s = n > 1 ? void 0 : n ? T(e, l) : e, o = t.length - 1, d; o >= 0; o--)
|
|
13
|
+
(d = t[o]) && (s = (n ? d(e, l, s) : d(s)) || s);
|
|
14
|
+
return n && s && q(e, l, s), s;
|
|
15
|
+
};
|
|
16
|
+
let i = class extends v {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = void 0, this.errors = [], this.showErrors = !0, this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.icon = "", this.hint = void 0, this.dayAriaLabel = void 0, this.monthAriaLabel = void 0, this.yearAriaLabel = void 0, this.value = [], this.invalidDateMessage = void 0, this.removePillAriaLabel = void 0, this.startDateAriaLabel = void 0, this.endDateAriaLabel = void 0, this.separator = void 0, this.inputBlockClass = "gui-range-date-input", this.groups = ["start", "end"], this.partDescriptors = D(), this._validationTriggered = !1, this._parts = new P(this, {
|
|
19
|
+
blockClass: this.inputBlockClass,
|
|
20
|
+
groups: this.groups,
|
|
21
|
+
getDescriptor: (t) => this.getPartDescriptor(t),
|
|
22
|
+
commitGroup: () => {
|
|
23
|
+
this._validationTriggered ? this.revalidate() : this.syncParts();
|
|
24
|
+
},
|
|
25
|
+
isReadonly: () => !!this.readOnly,
|
|
26
|
+
isDisabled: () => !!this.disabled,
|
|
27
|
+
onEmptyPartBlur: () => {
|
|
28
|
+
},
|
|
29
|
+
onEnter: () => {
|
|
30
|
+
if (this.tryCreatePill(), this.value && this.value.length > 0) {
|
|
31
|
+
const t = this.value[this.value.length - 1];
|
|
32
|
+
this.onPillClick(t);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
onInputErrorSurfaced: (t) => this.dispatchEvent(new CustomEvent("inputError", { detail: { message: t }, bubbles: !0 })),
|
|
36
|
+
onSurfacedErrorCleared: (t) => this.dispatchEvent(
|
|
37
|
+
new CustomEvent("change", { detail: { value: t }, bubbles: !0, composed: !0 })
|
|
38
|
+
)
|
|
39
|
+
}), this.ariaController = new b(this, {
|
|
40
|
+
getTargets: () => this.querySelectorAll(`.${this.inputBlockClass}`),
|
|
41
|
+
getState: () => ({
|
|
42
|
+
uid: this.uid,
|
|
43
|
+
templateData: {
|
|
44
|
+
hint: this.hint,
|
|
45
|
+
errors: this.errors,
|
|
46
|
+
readonly: this.readOnly,
|
|
47
|
+
disabled: this.disabled,
|
|
48
|
+
touched: this.touched,
|
|
49
|
+
required: this.required
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
}), this.onPillRemoveEvent = (t) => {
|
|
53
|
+
if (this.disabled || this.readOnly) return;
|
|
54
|
+
const e = C(this.value, t.detail.key);
|
|
55
|
+
e && (this.value = e.next, this.dispatchEvent(
|
|
56
|
+
new CustomEvent("change", {
|
|
57
|
+
detail: { value: this.value },
|
|
58
|
+
bubbles: !0,
|
|
59
|
+
composed: !0
|
|
60
|
+
})
|
|
61
|
+
), e.next.length === 0 && requestAnimationFrame(() => {
|
|
62
|
+
this.querySelector(
|
|
63
|
+
".gui-range-date-input__field input"
|
|
64
|
+
)?.focus();
|
|
65
|
+
}));
|
|
66
|
+
}, this.onPillClickEvent = (t) => {
|
|
67
|
+
const e = $(this.getSortedPills(), t.detail.key);
|
|
68
|
+
e && this.onPillClick(e);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
createRenderRoot() {
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
connectedCallback() {
|
|
75
|
+
super.connectedCallback(), this.classList.add("gui-field");
|
|
76
|
+
}
|
|
77
|
+
getPartDescriptor(t) {
|
|
78
|
+
return this.partDescriptors[t];
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
const t = {
|
|
82
|
+
uid: this.uid,
|
|
83
|
+
label: this.label,
|
|
84
|
+
errors: this.errors,
|
|
85
|
+
touched: this.touched,
|
|
86
|
+
required: this.required,
|
|
87
|
+
disabled: this.disabled,
|
|
88
|
+
readonly: this.readOnly,
|
|
89
|
+
value: this.value,
|
|
90
|
+
hint: this.hint
|
|
91
|
+
}, e = {
|
|
92
|
+
blockClass: this.inputBlockClass,
|
|
93
|
+
groups: this.groups,
|
|
94
|
+
formatParts: A(this.localeId),
|
|
95
|
+
getDescriptor: (s) => this.getPartDescriptor(s),
|
|
96
|
+
getDisplayValue: this._parts.getPartDisplay,
|
|
97
|
+
getPartAriaLabel: (s, o) => ({
|
|
98
|
+
day: this.dayAriaLabel,
|
|
99
|
+
month: this.monthAriaLabel,
|
|
100
|
+
year: this.yearAriaLabel
|
|
101
|
+
})[o] ?? E[o],
|
|
102
|
+
disabled: this.disabled,
|
|
103
|
+
partsReadonly: !!this.readOnly
|
|
104
|
+
}, l = k(
|
|
105
|
+
this.getSortedPills(),
|
|
106
|
+
(s) => I(s, (o) => R(o, this.localeId))
|
|
107
|
+
), n = {
|
|
108
|
+
"gui-widget-icon": !0,
|
|
109
|
+
[this.icon]: !!this.icon
|
|
110
|
+
};
|
|
111
|
+
return u`
|
|
112
|
+
${this.label ? f(this.uid, t, !1, void 0, !1) : p}
|
|
113
|
+
|
|
114
|
+
<div class="gui-widget">
|
|
115
|
+
<div
|
|
116
|
+
class="gui-widget-input gui-parts-ring gui-range-date-input ${this.icon ? "gui-range-date-input--icon" : ""}"
|
|
117
|
+
role="group"
|
|
118
|
+
aria-label=${this.label ?? "Date range input"}
|
|
119
|
+
>
|
|
120
|
+
${this.icon ? u`<span
|
|
121
|
+
class=${y(n)}
|
|
122
|
+
data-icon=${this.icon}
|
|
123
|
+
aria-hidden="true"
|
|
124
|
+
></span>` : p}
|
|
125
|
+
|
|
126
|
+
<gui-pills
|
|
127
|
+
class="gui-range-date-input__pills"
|
|
128
|
+
style=${G(l.length ? {} : { "min-width": 0 })}
|
|
129
|
+
.uid=${this.uid}
|
|
130
|
+
.toolbarAriaLabel=${"Selected date ranges"}
|
|
131
|
+
.items=${l}
|
|
132
|
+
.removable=${!0}
|
|
133
|
+
.clickable=${!0}
|
|
134
|
+
.bubble=${!0}
|
|
135
|
+
?disabled=${this.disabled}
|
|
136
|
+
?readonly=${this.readOnly}
|
|
137
|
+
.removeAriaLabel=${this.removePillAriaLabel ?? "Remove date"}
|
|
138
|
+
.compactAriaLabel=${`${l.length} date ranges`}
|
|
139
|
+
@pillremove=${this.onPillRemoveEvent}
|
|
140
|
+
@pillclick=${this.onPillClickEvent}
|
|
141
|
+
></gui-pills>
|
|
142
|
+
|
|
143
|
+
<div class="gui-range-date-input__inputs">
|
|
144
|
+
<div
|
|
145
|
+
class="gui-parts gui-range-date-input__field"
|
|
146
|
+
role="group"
|
|
147
|
+
aria-label=${this.startDateAriaLabel ?? "Start date"}
|
|
148
|
+
>
|
|
149
|
+
${h("start", e, this._parts)}
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
<span class="gui-range-date-input__separator">${this.separator ?? "-"}</span>
|
|
153
|
+
|
|
154
|
+
<div
|
|
155
|
+
class="gui-parts gui-range-date-input__field"
|
|
156
|
+
role="group"
|
|
157
|
+
aria-label=${this.endDateAriaLabel ?? "End date"}
|
|
158
|
+
>
|
|
159
|
+
${h("end", e, this._parts)}
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
${this.showErrors && this.errors?.length ? _(this.uid, t) : p}
|
|
165
|
+
</div>
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
168
|
+
getSortedPills() {
|
|
169
|
+
return w(
|
|
170
|
+
this.value,
|
|
171
|
+
(t, e) => c(t).getTime() - c(e).getTime()
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
onPillClick(t) {
|
|
175
|
+
this.dispatchEvent(
|
|
176
|
+
new CustomEvent("pillClick", {
|
|
177
|
+
detail: { range: t },
|
|
178
|
+
bubbles: !0,
|
|
179
|
+
composed: !0
|
|
180
|
+
})
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
validateDateParts(t) {
|
|
184
|
+
const { result: e, writeBacks: l } = S(this._parts.values[t] ?? {}, {
|
|
185
|
+
descriptors: this.partDescriptors,
|
|
186
|
+
invalidDateMessage: this.invalidDateMessage
|
|
187
|
+
});
|
|
188
|
+
return this._parts.applyWriteBacks(t, l), e.kind === "invalid" ? { kind: "invalid", message: e.message } : e.kind === "valid" && e.instant ? { kind: "valid", value: e.instant } : { kind: "incomplete" };
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Re-parses both endpoints so per-endpoint problems (impossible date, out of
|
|
192
|
+
* bounds) surface while the user types. Runs on every part change.
|
|
193
|
+
*/
|
|
194
|
+
syncParts() {
|
|
195
|
+
return {
|
|
196
|
+
start: this.validateDateParts("start"),
|
|
197
|
+
end: this.validateDateParts("end")
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Parses the range and updates the error state, without ever committing.
|
|
202
|
+
* Shared by the Enter commit and by {@link revalidate}.
|
|
203
|
+
*/
|
|
204
|
+
evaluateRange() {
|
|
205
|
+
const { start: t, end: e } = this.syncParts(), l = O(t, e, this.value, {
|
|
206
|
+
// Swap if end < start
|
|
207
|
+
order: (n, s) => B(n, s, (o, d) => o.getTime() - d.getTime()),
|
|
208
|
+
toRange: ({ start: n, end: s }) => {
|
|
209
|
+
const o = g(n), d = g(s);
|
|
210
|
+
return o === d ? { start: o } : { start: o, end: d };
|
|
211
|
+
},
|
|
212
|
+
merge: L
|
|
213
|
+
});
|
|
214
|
+
return l.kind === "invalid" && this._parts.surfaceInputError(l.message), l.kind === "incomplete" && this._parts.clearSurfacedInputError(this.value ?? []), l;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Once the user has attempted a commit, every later edit re-runs validation
|
|
218
|
+
* so a corrected range clears its error immediately, otherwise the message
|
|
219
|
+
* would linger until the next Enter and the user could not tell the problem
|
|
220
|
+
* was solved.
|
|
221
|
+
*/
|
|
222
|
+
revalidate() {
|
|
223
|
+
this.evaluateRange().kind === "commit" && this._parts.clearSurfacedInputError(this.value ?? []);
|
|
224
|
+
}
|
|
225
|
+
tryCreatePill() {
|
|
226
|
+
this._validationTriggered = !0;
|
|
227
|
+
const t = this.evaluateRange();
|
|
228
|
+
t.kind === "commit" && (this.value = t.value, this._validationTriggered = !1, this._parts.clearGroup("start"), this._parts.clearGroup("end"), this._parts.resetSurfacedInputError(), this.dispatchEvent(
|
|
229
|
+
new CustomEvent("change", {
|
|
230
|
+
detail: { value: this.value },
|
|
231
|
+
bubbles: !0,
|
|
232
|
+
composed: !0
|
|
233
|
+
})
|
|
234
|
+
), this._parts.focusFirst("start"), this.requestUpdate());
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Echo a range into the input parts without committing it (no pill, no change
|
|
238
|
+
* event). Used by the picker to show a range the calendar rejected.
|
|
239
|
+
*/
|
|
240
|
+
showRange(t, e) {
|
|
241
|
+
this._parts.setGroupFromISO("start", t, "date"), this._parts.setGroupFromISO("end", e, "date");
|
|
242
|
+
}
|
|
243
|
+
/** Clear both groups' parts (e.g. once a valid range is committed). */
|
|
244
|
+
clearRangeInputs() {
|
|
245
|
+
this._parts.clearGroup("start"), this._parts.clearGroup("end");
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
a([
|
|
249
|
+
r({ type: String })
|
|
250
|
+
], i.prototype, "uid", 2);
|
|
251
|
+
a([
|
|
252
|
+
r({ type: String })
|
|
253
|
+
], i.prototype, "label", 2);
|
|
254
|
+
a([
|
|
255
|
+
r({ type: String, attribute: "locale-id" })
|
|
256
|
+
], i.prototype, "localeId", 2);
|
|
257
|
+
a([
|
|
258
|
+
r({ type: Array })
|
|
259
|
+
], i.prototype, "errors", 2);
|
|
260
|
+
a([
|
|
261
|
+
r({ type: Boolean })
|
|
262
|
+
], i.prototype, "showErrors", 2);
|
|
263
|
+
a([
|
|
264
|
+
r({ type: Boolean })
|
|
265
|
+
], i.prototype, "touched", 2);
|
|
266
|
+
a([
|
|
267
|
+
r({ type: Boolean })
|
|
268
|
+
], i.prototype, "required", 2);
|
|
269
|
+
a([
|
|
270
|
+
r({ type: Boolean })
|
|
271
|
+
], i.prototype, "disabled", 2);
|
|
272
|
+
a([
|
|
273
|
+
r({ type: Boolean, attribute: "readonly" })
|
|
274
|
+
], i.prototype, "readOnly", 2);
|
|
275
|
+
a([
|
|
276
|
+
r({ type: String })
|
|
277
|
+
], i.prototype, "icon", 2);
|
|
278
|
+
a([
|
|
279
|
+
r({ type: String })
|
|
280
|
+
], i.prototype, "hint", 2);
|
|
281
|
+
a([
|
|
282
|
+
r({ type: String })
|
|
283
|
+
], i.prototype, "dayAriaLabel", 2);
|
|
284
|
+
a([
|
|
285
|
+
r({ type: String })
|
|
286
|
+
], i.prototype, "monthAriaLabel", 2);
|
|
287
|
+
a([
|
|
288
|
+
r({ type: String })
|
|
289
|
+
], i.prototype, "yearAriaLabel", 2);
|
|
290
|
+
a([
|
|
291
|
+
r({ type: Array })
|
|
292
|
+
], i.prototype, "value", 2);
|
|
293
|
+
a([
|
|
294
|
+
r({ type: String, attribute: "invalid-date-message" })
|
|
295
|
+
], i.prototype, "invalidDateMessage", 2);
|
|
296
|
+
a([
|
|
297
|
+
r({ type: String })
|
|
298
|
+
], i.prototype, "removePillAriaLabel", 2);
|
|
299
|
+
a([
|
|
300
|
+
r({ type: String })
|
|
301
|
+
], i.prototype, "startDateAriaLabel", 2);
|
|
302
|
+
a([
|
|
303
|
+
r({ type: String })
|
|
304
|
+
], i.prototype, "endDateAriaLabel", 2);
|
|
305
|
+
a([
|
|
306
|
+
r({ type: String })
|
|
307
|
+
], i.prototype, "separator", 2);
|
|
308
|
+
i = a([
|
|
309
|
+
m("gui-range-date")
|
|
310
|
+
], i);
|
|
311
|
+
typeof customElements < "u" && !customElements.get("gui-range-date") && customElements.define("gui-range-date", i);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { InputWidgetAdapter as n, formContext as o, inputContext as
|
|
2
|
-
import "./range-date-input-
|
|
3
|
-
import { consume as
|
|
1
|
+
import { InputWidgetAdapter as n, formContext as o, inputContext as h } from "@golemui/lit";
|
|
2
|
+
import "./range-date-input-Br7XqQPK.js";
|
|
3
|
+
import { consume as u, provide as m } from "@lit/context";
|
|
4
4
|
import { LitElement as c, html as b } from "lit";
|
|
5
5
|
import { property as D, customElement as g } from "lit/decorators.js";
|
|
6
6
|
import "rxjs";
|
|
7
|
-
var
|
|
8
|
-
for (var a = r > 1 ? void 0 : r ?
|
|
7
|
+
var $ = Object.defineProperty, v = Object.getOwnPropertyDescriptor, d = (t, e, s, r) => {
|
|
8
|
+
for (var a = r > 1 ? void 0 : r ? v(e, s) : e, p = t.length - 1, l; p >= 0; p--)
|
|
9
9
|
(l = t[p]) && (a = (r ? l(e, s, a) : l(a)) || a);
|
|
10
|
-
return r && a &&
|
|
10
|
+
return r && a && $(e, s, a), a;
|
|
11
11
|
};
|
|
12
12
|
let i = class extends c {
|
|
13
13
|
constructor() {
|
|
@@ -40,6 +40,10 @@ let i = class extends c {
|
|
|
40
40
|
?readonly=${this.adapter.templateData.readonly}
|
|
41
41
|
.value=${this.adapter.templateData.value}
|
|
42
42
|
.localeId=${this.adapter.templateData.lang}
|
|
43
|
+
.dayAriaLabel=${this.adapter.templateData.dayAriaLabel}
|
|
44
|
+
.monthAriaLabel=${this.adapter.templateData.monthAriaLabel}
|
|
45
|
+
.yearAriaLabel=${this.adapter.templateData.yearAriaLabel}
|
|
46
|
+
.invalidDateMessage=${this.adapter.templateData.invalidDateMessage}
|
|
43
47
|
.separator=${this.adapter.templateData.separator}
|
|
44
48
|
.removePillAriaLabel=${this.adapter.templateData.removePillAriaLabel}
|
|
45
49
|
.startDateAriaLabel=${this.adapter.templateData.startDateAriaLabel}
|
|
@@ -60,11 +64,11 @@ let i = class extends c {
|
|
|
60
64
|
}
|
|
61
65
|
};
|
|
62
66
|
d([
|
|
63
|
-
|
|
67
|
+
u({ context: o }),
|
|
64
68
|
D({ attribute: !1 })
|
|
65
69
|
], i.prototype, "formContext", 2);
|
|
66
70
|
d([
|
|
67
|
-
m({ context:
|
|
71
|
+
m({ context: h })
|
|
68
72
|
], i.prototype, "adapter", 2);
|
|
69
73
|
i = d([
|
|
70
74
|
g("gui-range-date-input")
|