@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
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { LitElement as c, nothing as d, html as p } from "lit";
|
|
2
|
+
import { property as a, customElement as g } from "lit/decorators.js";
|
|
3
|
+
import { classMap as v } from "lit/directives/class-map.js";
|
|
4
|
+
import { styleMap as y } from "lit-html/directives/style-map.js";
|
|
5
|
+
import { G as b, b as f, c as T } from "./templates-Dmr34nwp.js";
|
|
6
|
+
import { G as _, g as E, u as P, r as h, l as L, s as m, v as S, w as A, x as C, t as D, P as R } from "./part-templates-VORbpgs2.js";
|
|
7
|
+
import { c as $ } from "./range-commit-8-MmYUyo.js";
|
|
8
|
+
import { r as I, f as w, b as k, a as M, s as F } from "./pill-ranges-DpvWwP-3.js";
|
|
9
|
+
import "./pills-BDMO2NiR.js";
|
|
10
|
+
import { f as B, e as O } from "./date-DBuYpvcO.js";
|
|
11
|
+
var G = Object.defineProperty, x = Object.getOwnPropertyDescriptor, i = (t, s, o, r) => {
|
|
12
|
+
for (var l = r > 1 ? void 0 : r ? x(s, o) : s, n = t.length - 1, u; n >= 0; n--)
|
|
13
|
+
(u = t[n]) && (l = (r ? u(s, o, l) : u(l)) || l);
|
|
14
|
+
return r && l && G(s, o, l), l;
|
|
15
|
+
};
|
|
16
|
+
let e = class extends c {
|
|
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.hourAriaLabel = void 0, this.minuteAriaLabel = void 0, this.dayPeriodAriaLabel = void 0, this.hourFormat = void 0, this.minuteStep = 1, this.minTime = void 0, this.maxTime = void 0, this.minTimeMessage = void 0, this.maxTimeMessage = void 0, this.value = [], this.rangeOrderMessage = void 0, this.removePillAriaLabel = void 0, this.startTimeAriaLabel = void 0, this.endTimeAriaLabel = void 0, this.separator = void 0, this.allowCustomTime = void 0, this.disabledRanges = void 0, this.disabledRangeMessage = void 0, this.inputBlockClass = "gui-range-time-input", this.groups = ["start", "end"], this._validationTriggered = !1, this._parts = new _(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
|
+
onInputErrorSurfaced: (t) => this.dispatchEvent(new CustomEvent("inputError", { detail: { message: t }, bubbles: !0 })),
|
|
26
|
+
onSurfacedErrorCleared: (t) => this.dispatchEvent(
|
|
27
|
+
new CustomEvent("change", { detail: { value: t }, bubbles: !0, composed: !0 })
|
|
28
|
+
),
|
|
29
|
+
isReadonly: () => !!this.readOnly || this.allowCustomTime === !1,
|
|
30
|
+
isDisabled: () => !!this.disabled,
|
|
31
|
+
onEmptyPartBlur: () => {
|
|
32
|
+
},
|
|
33
|
+
onEnter: () => {
|
|
34
|
+
this.tryCreatePill(), this.value && this.value.length > 0 && this.onPillClick(this.value[this.value.length - 1]);
|
|
35
|
+
},
|
|
36
|
+
getHourFormat: () => this.timeLocaleData.effectiveHourFormat,
|
|
37
|
+
getDayPeriodLabels: () => this.timeLocaleData.dayPeriodLabels
|
|
38
|
+
}), this.ariaController = new b(this, {
|
|
39
|
+
getTargets: () => this.querySelectorAll(`.${this.inputBlockClass}`),
|
|
40
|
+
getState: () => ({
|
|
41
|
+
uid: this.uid,
|
|
42
|
+
templateData: {
|
|
43
|
+
hint: this.hint,
|
|
44
|
+
errors: this.errors,
|
|
45
|
+
readonly: this.readOnly,
|
|
46
|
+
disabled: this.disabled,
|
|
47
|
+
touched: this.touched,
|
|
48
|
+
required: this.required
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
}), this.onPillRemoveEvent = (t) => {
|
|
52
|
+
if (this.disabled || this.readOnly) return;
|
|
53
|
+
const s = I(this.value, t.detail.key);
|
|
54
|
+
s && (this.value = s.next, this.dispatchEvent(
|
|
55
|
+
new CustomEvent("change", { detail: { value: this.value }, bubbles: !0, composed: !0 })
|
|
56
|
+
), s.next.length === 0 && requestAnimationFrame(() => {
|
|
57
|
+
this.querySelector(".gui-range-time-input__field input")?.focus();
|
|
58
|
+
}));
|
|
59
|
+
}, this.onPillClickEvent = (t) => {
|
|
60
|
+
const s = w(this.getSortedPills(), t.detail.key);
|
|
61
|
+
s && this.onPillClick(s);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
createRenderRoot() {
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
connectedCallback() {
|
|
68
|
+
super.connectedCallback(), this.classList.add("gui-field");
|
|
69
|
+
}
|
|
70
|
+
get timeLocaleData() {
|
|
71
|
+
return E(this.localeId, this.hourFormat, this.minuteStep);
|
|
72
|
+
}
|
|
73
|
+
getPartDescriptor(t) {
|
|
74
|
+
return this.timeLocaleData.descriptors[t];
|
|
75
|
+
}
|
|
76
|
+
willUpdate(t) {
|
|
77
|
+
(!this.hasUpdated || t.has("hourFormat") || t.has("localeId")) && this._parts.seedDayPeriods();
|
|
78
|
+
}
|
|
79
|
+
render() {
|
|
80
|
+
const t = {
|
|
81
|
+
uid: this.uid,
|
|
82
|
+
label: this.label,
|
|
83
|
+
errors: this.errors,
|
|
84
|
+
touched: this.touched,
|
|
85
|
+
required: this.required,
|
|
86
|
+
disabled: this.disabled,
|
|
87
|
+
readonly: this.readOnly,
|
|
88
|
+
value: this.value,
|
|
89
|
+
hint: this.hint
|
|
90
|
+
}, s = {
|
|
91
|
+
blockClass: this.inputBlockClass,
|
|
92
|
+
groups: this.groups,
|
|
93
|
+
formatParts: P(this.localeId, this.timeLocaleData.effectiveHourFormat),
|
|
94
|
+
getDescriptor: (l) => this.getPartDescriptor(l),
|
|
95
|
+
getDisplayValue: this._parts.getPartDisplay,
|
|
96
|
+
getPartAriaLabel: (l, n) => ({
|
|
97
|
+
hour: this.hourAriaLabel,
|
|
98
|
+
minute: this.minuteAriaLabel
|
|
99
|
+
})[n] ?? R[n],
|
|
100
|
+
dayPeriodAriaLabel: this.dayPeriodAriaLabel,
|
|
101
|
+
disabled: this.disabled,
|
|
102
|
+
partsReadonly: !!this.readOnly || this.allowCustomTime === !1
|
|
103
|
+
}, o = k(
|
|
104
|
+
this.getSortedPills(),
|
|
105
|
+
(l) => M(l, (n) => this.formatTimeForDisplay(n))
|
|
106
|
+
), r = {
|
|
107
|
+
"gui-widget-icon": !0,
|
|
108
|
+
[this.icon]: !!this.icon
|
|
109
|
+
};
|
|
110
|
+
return p`
|
|
111
|
+
${this.label ? f(this.uid, t, !1, void 0, !1) : d}
|
|
112
|
+
|
|
113
|
+
<div class="gui-widget">
|
|
114
|
+
<div
|
|
115
|
+
class="gui-widget-input gui-parts-ring gui-range-time-input ${this.icon ? "gui-range-time-input--icon" : ""}"
|
|
116
|
+
role="group"
|
|
117
|
+
aria-label=${this.label ?? "Time range input"}
|
|
118
|
+
>
|
|
119
|
+
${this.icon ? p`<span
|
|
120
|
+
class=${v(r)}
|
|
121
|
+
data-icon=${this.icon}
|
|
122
|
+
aria-hidden="true"
|
|
123
|
+
></span>` : d}
|
|
124
|
+
|
|
125
|
+
<gui-pills
|
|
126
|
+
class="gui-range-time-input__pills"
|
|
127
|
+
style=${y(o.length ? {} : { "min-width": 0 })}
|
|
128
|
+
.uid=${this.uid}
|
|
129
|
+
.toolbarAriaLabel=${"Selected time ranges"}
|
|
130
|
+
.items=${o}
|
|
131
|
+
.removable=${!0}
|
|
132
|
+
.clickable=${!0}
|
|
133
|
+
.bubble=${!0}
|
|
134
|
+
?disabled=${this.disabled}
|
|
135
|
+
?readonly=${this.readOnly}
|
|
136
|
+
.removeAriaLabel=${this.removePillAriaLabel ?? "Remove time"}
|
|
137
|
+
.compactAriaLabel=${`${o.length} time ranges`}
|
|
138
|
+
@pillremove=${this.onPillRemoveEvent}
|
|
139
|
+
@pillclick=${this.onPillClickEvent}
|
|
140
|
+
></gui-pills>
|
|
141
|
+
|
|
142
|
+
<div class="gui-range-time-input__inputs">
|
|
143
|
+
<div
|
|
144
|
+
class="gui-parts gui-range-time-input__field"
|
|
145
|
+
role="group"
|
|
146
|
+
aria-label=${this.startTimeAriaLabel ?? "Start time"}
|
|
147
|
+
>
|
|
148
|
+
${h("start", s, this._parts)}
|
|
149
|
+
</div>
|
|
150
|
+
|
|
151
|
+
<span class="gui-range-time-input__separator">${this.separator ?? "-"}</span>
|
|
152
|
+
|
|
153
|
+
<div
|
|
154
|
+
class="gui-parts gui-range-time-input__field"
|
|
155
|
+
role="group"
|
|
156
|
+
aria-label=${this.endTimeAriaLabel ?? "End time"}
|
|
157
|
+
>
|
|
158
|
+
${h("end", s, this._parts)}
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
${this.showErrors && this.errors?.length ? T(this.uid, t) : d}
|
|
164
|
+
</div>
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
onPillClick(t) {
|
|
168
|
+
this.dispatchEvent(
|
|
169
|
+
new CustomEvent("pillClick", { detail: { range: t }, bubbles: !0, composed: !0 })
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
formatTimeForDisplay(t) {
|
|
173
|
+
return L(t, this.localeId, this.timeLocaleData.effectiveHourFormat);
|
|
174
|
+
}
|
|
175
|
+
getSortedPills() {
|
|
176
|
+
return F(this.value, m);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Parses a group's parts into an ISO time via the shared clamp/bounds
|
|
180
|
+
* pipeline, surfacing a bounds violation as an inputError. Returns null while
|
|
181
|
+
* the group is incomplete or out of bounds.
|
|
182
|
+
*/
|
|
183
|
+
validateTimeParts(t) {
|
|
184
|
+
const { effectiveHourFormat: s, descriptors: o } = this.timeLocaleData, { result: r, writeBacks: l } = S(this._parts.values[t] ?? {}, {
|
|
185
|
+
hourFormat: s,
|
|
186
|
+
descriptors: o
|
|
187
|
+
});
|
|
188
|
+
if (this._parts.applyWriteBacks(t, l), r.kind !== "valid") return { kind: "incomplete" };
|
|
189
|
+
const n = A(r.iso, {
|
|
190
|
+
minTime: this.minTime,
|
|
191
|
+
maxTime: this.maxTime,
|
|
192
|
+
minTimeMessage: this.minTimeMessage,
|
|
193
|
+
maxTimeMessage: this.maxTimeMessage
|
|
194
|
+
});
|
|
195
|
+
return n ? { kind: "invalid", message: n } : { kind: "valid", value: r.iso };
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Fills a group's segmented parts from an ISO time. The range time picker
|
|
199
|
+
* calls this so a list pick lands in the visible input (start/end field)
|
|
200
|
+
* before it attempts to commit — see {@link commitFromParts}.
|
|
201
|
+
*/
|
|
202
|
+
fillGroup(t, s) {
|
|
203
|
+
this._parts.setGroupFromISO(t, s, "time", this.timeLocaleData.effectiveHourFormat), this.requestUpdate();
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Attempts to commit the currently-entered parts as a pill, returning whether
|
|
207
|
+
* one was created. A public entry point onto the same {@link tryCreatePill}
|
|
208
|
+
* pipeline typed entry uses, so the picker's list-driven commits validate
|
|
209
|
+
* (order + bounds + disabled ranges) through one path.
|
|
210
|
+
*/
|
|
211
|
+
commitFromParts() {
|
|
212
|
+
return this.tryCreatePill();
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Re-parses both endpoints (surfacing per-endpoint bounds errors as the user
|
|
216
|
+
* types) and notifies the host picker via `partsChange` so its time lists
|
|
217
|
+
* follow the typed values. Runs on every part change.
|
|
218
|
+
*/
|
|
219
|
+
syncParts() {
|
|
220
|
+
const t = this.validateTimeParts("start"), s = this.validateTimeParts("end"), o = (r) => r.kind === "valid" ? r.value : null;
|
|
221
|
+
return this.dispatchEvent(
|
|
222
|
+
new CustomEvent("partsChange", {
|
|
223
|
+
detail: { start: o(t), end: o(s) },
|
|
224
|
+
bubbles: !0,
|
|
225
|
+
composed: !0
|
|
226
|
+
})
|
|
227
|
+
), { start: t, end: s };
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Parses the range and updates the error state, without ever committing.
|
|
231
|
+
* Shared by the Enter commit and by {@link revalidate}.
|
|
232
|
+
*/
|
|
233
|
+
evaluateRange() {
|
|
234
|
+
const { start: t, end: s } = this.syncParts(), o = $(t, s, this.value, {
|
|
235
|
+
validate: (r) => m(r.end, r.start) <= 0 ? this.rangeOrderMessage ?? B : D(r.start, r.end, this.disabledRanges) ? this.disabledRangeMessage ?? O : null,
|
|
236
|
+
toRange: (r) => ({ start: r.start, end: r.end }),
|
|
237
|
+
merge: C
|
|
238
|
+
});
|
|
239
|
+
return o.kind === "incomplete" && this._parts.clearSurfacedInputError(this.value ?? []), o.kind === "invalid" && this._parts.surfaceInputError(o.message), o;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Once the user has attempted a commit, every later edit re-runs validation
|
|
243
|
+
* so a corrected range clears its error immediately, otherwise the message
|
|
244
|
+
* would linger until the next Enter and the user could not tell the problem
|
|
245
|
+
* was solved.
|
|
246
|
+
*/
|
|
247
|
+
revalidate() {
|
|
248
|
+
this.evaluateRange().kind === "commit" && this._parts.clearSurfacedInputError(this.value ?? []);
|
|
249
|
+
}
|
|
250
|
+
tryCreatePill() {
|
|
251
|
+
this._validationTriggered = !0;
|
|
252
|
+
const t = this.evaluateRange();
|
|
253
|
+
return t.kind !== "commit" ? !1 : (this.value = t.value, this._validationTriggered = !1, this._parts.clearGroup("start"), this._parts.clearGroup("end"), this._parts.seedDayPeriods(), this.dispatchEvent(
|
|
254
|
+
new CustomEvent("change", { detail: { value: this.value }, bubbles: !0, composed: !0 })
|
|
255
|
+
), this._parts.focusFirst("start"), this.requestUpdate(), !0);
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
i([
|
|
259
|
+
a({ type: String })
|
|
260
|
+
], e.prototype, "uid", 2);
|
|
261
|
+
i([
|
|
262
|
+
a({ type: String })
|
|
263
|
+
], e.prototype, "label", 2);
|
|
264
|
+
i([
|
|
265
|
+
a({ type: String, attribute: "locale-id" })
|
|
266
|
+
], e.prototype, "localeId", 2);
|
|
267
|
+
i([
|
|
268
|
+
a({ type: Array })
|
|
269
|
+
], e.prototype, "errors", 2);
|
|
270
|
+
i([
|
|
271
|
+
a({ type: Boolean })
|
|
272
|
+
], e.prototype, "showErrors", 2);
|
|
273
|
+
i([
|
|
274
|
+
a({ type: Boolean })
|
|
275
|
+
], e.prototype, "touched", 2);
|
|
276
|
+
i([
|
|
277
|
+
a({ type: Boolean })
|
|
278
|
+
], e.prototype, "required", 2);
|
|
279
|
+
i([
|
|
280
|
+
a({ type: Boolean })
|
|
281
|
+
], e.prototype, "disabled", 2);
|
|
282
|
+
i([
|
|
283
|
+
a({ type: Boolean, attribute: "readonly" })
|
|
284
|
+
], e.prototype, "readOnly", 2);
|
|
285
|
+
i([
|
|
286
|
+
a({ type: String })
|
|
287
|
+
], e.prototype, "icon", 2);
|
|
288
|
+
i([
|
|
289
|
+
a({ type: String })
|
|
290
|
+
], e.prototype, "hint", 2);
|
|
291
|
+
i([
|
|
292
|
+
a({ type: String })
|
|
293
|
+
], e.prototype, "hourAriaLabel", 2);
|
|
294
|
+
i([
|
|
295
|
+
a({ type: String })
|
|
296
|
+
], e.prototype, "minuteAriaLabel", 2);
|
|
297
|
+
i([
|
|
298
|
+
a({ type: String })
|
|
299
|
+
], e.prototype, "dayPeriodAriaLabel", 2);
|
|
300
|
+
i([
|
|
301
|
+
a({ type: String, attribute: "hour-format" })
|
|
302
|
+
], e.prototype, "hourFormat", 2);
|
|
303
|
+
i([
|
|
304
|
+
a({ type: Number, attribute: "minute-step" })
|
|
305
|
+
], e.prototype, "minuteStep", 2);
|
|
306
|
+
i([
|
|
307
|
+
a({ type: String, attribute: "min-time" })
|
|
308
|
+
], e.prototype, "minTime", 2);
|
|
309
|
+
i([
|
|
310
|
+
a({ type: String, attribute: "max-time" })
|
|
311
|
+
], e.prototype, "maxTime", 2);
|
|
312
|
+
i([
|
|
313
|
+
a({ type: String, attribute: "min-time-message" })
|
|
314
|
+
], e.prototype, "minTimeMessage", 2);
|
|
315
|
+
i([
|
|
316
|
+
a({ type: String, attribute: "max-time-message" })
|
|
317
|
+
], e.prototype, "maxTimeMessage", 2);
|
|
318
|
+
i([
|
|
319
|
+
a({ type: Array })
|
|
320
|
+
], e.prototype, "value", 2);
|
|
321
|
+
i([
|
|
322
|
+
a({ type: String, attribute: "range-order-message" })
|
|
323
|
+
], e.prototype, "rangeOrderMessage", 2);
|
|
324
|
+
i([
|
|
325
|
+
a({ type: String })
|
|
326
|
+
], e.prototype, "removePillAriaLabel", 2);
|
|
327
|
+
i([
|
|
328
|
+
a({ type: String })
|
|
329
|
+
], e.prototype, "startTimeAriaLabel", 2);
|
|
330
|
+
i([
|
|
331
|
+
a({ type: String })
|
|
332
|
+
], e.prototype, "endTimeAriaLabel", 2);
|
|
333
|
+
i([
|
|
334
|
+
a({ type: String })
|
|
335
|
+
], e.prototype, "separator", 2);
|
|
336
|
+
i([
|
|
337
|
+
a({ type: Boolean, attribute: "allow-custom-time" })
|
|
338
|
+
], e.prototype, "allowCustomTime", 2);
|
|
339
|
+
i([
|
|
340
|
+
a({ type: Array, attribute: "disabled-ranges" })
|
|
341
|
+
], e.prototype, "disabledRanges", 2);
|
|
342
|
+
i([
|
|
343
|
+
a({ type: String, attribute: "disabled-range-message" })
|
|
344
|
+
], e.prototype, "disabledRangeMessage", 2);
|
|
345
|
+
e = i([
|
|
346
|
+
g("gui-range-time")
|
|
347
|
+
], e);
|
|
348
|
+
typeof customElements < "u" && !customElements.get("gui-range-time") && customElements.define("gui-range-time", e);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { InputWidgetAdapter as m, formContext as n, inputContext as o } from "@golemui/lit";
|
|
2
|
+
import "./range-time-input-BP9ZL9O8.js";
|
|
3
|
+
import { consume as h, provide as u } from "@lit/context";
|
|
4
|
+
import { LitElement as c, html as b } from "lit";
|
|
5
|
+
import { property as g, customElement as D } from "lit/decorators.js";
|
|
6
|
+
import "rxjs";
|
|
7
|
+
var $ = Object.defineProperty, f = Object.getOwnPropertyDescriptor, d = (e, t, s, r) => {
|
|
8
|
+
for (var a = r > 1 ? void 0 : r ? f(t, s) : t, p = e.length - 1, l; p >= 0; p--)
|
|
9
|
+
(l = e[p]) && (a = (r ? l(t, s, a) : l(a)) || a);
|
|
10
|
+
return r && a && $(t, s, a), a;
|
|
11
|
+
};
|
|
12
|
+
let i = class extends c {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.adapter = new m(), this.subscriptions = [];
|
|
15
|
+
}
|
|
16
|
+
createRenderRoot() {
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
updated(e) {
|
|
20
|
+
super.updated(e);
|
|
21
|
+
const t = this.adapter.templateData.size;
|
|
22
|
+
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
23
|
+
}
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
super.connectedCallback(), this.classList.add("gui-range-time", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
26
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
return super.render(), b`
|
|
31
|
+
<gui-range-time
|
|
32
|
+
.uid=${this.widget.uid}
|
|
33
|
+
.label=${this.adapter.templateData.label}
|
|
34
|
+
.hint=${this.adapter.templateData.hint}
|
|
35
|
+
.icon=${this.adapter.templateData.icon}
|
|
36
|
+
.errors=${this.adapter.templateData.errors}
|
|
37
|
+
?touched=${this.adapter.templateData.touched}
|
|
38
|
+
?required=${this.adapter.templateData.validator?.required}
|
|
39
|
+
?disabled=${this.adapter.templateData.disabled}
|
|
40
|
+
?readonly=${this.adapter.templateData.readonly}
|
|
41
|
+
.value=${this.adapter.templateData.value}
|
|
42
|
+
.localeId=${this.adapter.templateData.lang}
|
|
43
|
+
.hourAriaLabel=${this.adapter.templateData.hourAriaLabel}
|
|
44
|
+
.minuteAriaLabel=${this.adapter.templateData.minuteAriaLabel}
|
|
45
|
+
.dayPeriodAriaLabel=${this.adapter.templateData.dayPeriodAriaLabel}
|
|
46
|
+
.separator=${this.adapter.templateData.separator}
|
|
47
|
+
.removePillAriaLabel=${this.adapter.templateData.removePillAriaLabel}
|
|
48
|
+
.startTimeAriaLabel=${this.adapter.templateData.startTimeAriaLabel}
|
|
49
|
+
.endTimeAriaLabel=${this.adapter.templateData.endTimeAriaLabel}
|
|
50
|
+
.hourFormat=${this.adapter.templateData.hourFormat}
|
|
51
|
+
.minuteStep=${this.adapter.templateData.minuteStep}
|
|
52
|
+
.minTime=${this.adapter.templateData.minTime}
|
|
53
|
+
.maxTime=${this.adapter.templateData.maxTime}
|
|
54
|
+
.minTimeMessage=${this.adapter.templateData.minTimeMessage}
|
|
55
|
+
.maxTimeMessage=${this.adapter.templateData.maxTimeMessage}
|
|
56
|
+
.rangeOrderMessage=${this.adapter.templateData.rangeOrderMessage}
|
|
57
|
+
@change=${this.valueChanged}
|
|
58
|
+
@inputError=${this.onInputError}
|
|
59
|
+
></gui-range-time>
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
valueChanged(e) {
|
|
63
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(e.detail.value);
|
|
64
|
+
}
|
|
65
|
+
onInputError(e) {
|
|
66
|
+
this.adapter.injectValidationIssues([e.detail.message]);
|
|
67
|
+
}
|
|
68
|
+
disconnectedCallback() {
|
|
69
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
d([
|
|
73
|
+
h({ context: n }),
|
|
74
|
+
g({ attribute: !1 })
|
|
75
|
+
], i.prototype, "formContext", 2);
|
|
76
|
+
d([
|
|
77
|
+
u({ context: o })
|
|
78
|
+
], i.prototype, "adapter", 2);
|
|
79
|
+
i = d([
|
|
80
|
+
D("gui-range-time-input")
|
|
81
|
+
], i);
|
|
82
|
+
export {
|
|
83
|
+
i as RangeTimeInputElement
|
|
84
|
+
};
|