@golemui/gui-lit 1.0.3 → 1.1.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 +11 -0
- package/calendar-BuJgwvZx.js +254 -0
- package/{calendar.element-DcnTyvfg.js → calendar.element-M5MPJmap.js} +1 -1
- package/{currency.element-5GSakkxF.js → currency.element-CfFrAtrr.js} +4 -1
- package/{date-CDUlLuYy.js → date-Bj9mI3GU.js} +80 -29
- package/date-input-cJDkNnVw.js +184 -0
- package/date-picker.element-va_-LGZD.js +312 -0
- package/date-time-calendar-BzRfkLKU.js +361 -0
- package/date-time-calendar.element-DC4NK0y1.js +93 -0
- package/date-time-input-BXxsfuyZ.js +214 -0
- package/date-time-picker.element-Dy-8cb-_.js +380 -0
- package/date-time.element-Bv4XdzMi.js +87 -0
- package/{date.element-BZO0UQez.js → date.element-Consgsbb.js} +32 -27
- package/day-status-0-hJHrI7.js +530 -0
- package/{dropdown.element-CyJbVAA5.js → dropdown.element-WsD61Qel.js} +46 -36
- package/focus-leave.controller-2gV0pQd5.js +73 -0
- package/index.js +1199 -971
- package/index.umd.cjs +1582 -530
- 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-D1oKnH89.js → list-CrLIL4by.js} +76 -61
- package/{list.element-Co3V3Cn5.js → list.element-DV82YxnJ.js} +22 -22
- package/package.json +6 -6
- package/part-templates-Db871PS3.js +677 -0
- package/pill-ranges-DCqDmpkk.js +48 -0
- package/{pills-B66qz_KX.js → pills-Be1UrLgq.js} +4 -1
- package/popup.controller-eUDxE6jD.js +71 -0
- package/range-calendar-CKPYeSGt.js +452 -0
- package/{range-calendar.element-_1bHW_c1.js → range-calendar.element-D6KYq18B.js} +24 -20
- package/range-commit-8-MmYUyo.js +14 -0
- package/range-date-input-D--AqBMv.js +292 -0
- package/{range-date-input.element-BqzAF0O3.js → range-date-input.element-D4nIXJbw.js} +8 -7
- package/range-date-picker.element-dhxPAAE6.js +386 -0
- package/range-date-time-calendar-yksWrR7b.js +720 -0
- package/range-date-time-calendar.element-C00aDefZ.js +95 -0
- package/range-date-time-input-B37TUoM3.js +322 -0
- package/range-date-time-input.element-DUnbv4ed.js +81 -0
- package/range-date-time-picker.element-Cbps6s_G.js +412 -0
- package/range-selection-CU3hxLJE.js +25 -0
- package/range-time-input-3lhqR1Ku.js +329 -0
- package/range-time-input.element-dU2iBdmJ.js +81 -0
- package/range-time-picker.element-v6nQsIPw.js +429 -0
- package/{select.element-jcDF1h-g.js → select.element-C0V-Bv3L.js} +94 -90
- package/{tags.element-CX3vQL8L.js → tags.element-DvwEpxpK.js} +1 -1
- package/time-input-BOhlBGJZ.js +181 -0
- package/time-list-Czo48bZm.js +217 -0
- package/time-picker-bFJ63ky8.js +261 -0
- package/time-picker.element-CYZVXgRS.js +85 -0
- package/time.element-fK3oLi49.js +82 -0
- 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/range-calendar-CBINu84w.js +0 -255
- package/range-date-input-BYXzqnr1.js +0 -395
- package/range-date-picker.element-BCBefgvY.js +0 -182
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { LitElement as c, nothing as d, html as p } from "lit";
|
|
2
|
+
import { property as s, 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-Dk1jxLwS.js";
|
|
6
|
+
import { G as E, g as _, u as P, r as m, l as S, s as h, v as C, w as D, x as L, t as R } from "./part-templates-Db871PS3.js";
|
|
7
|
+
import { c as w } from "./range-commit-8-MmYUyo.js";
|
|
8
|
+
import { r as A, f as I, b as $, a as k, s as M } from "./pill-ranges-DCqDmpkk.js";
|
|
9
|
+
import "./pills-Be1UrLgq.js";
|
|
10
|
+
import { e as F, b as O } from "./date-Bj9mI3GU.js";
|
|
11
|
+
var B = Object.defineProperty, G = Object.getOwnPropertyDescriptor, i = (t, a, o, r) => {
|
|
12
|
+
for (var l = r > 1 ? void 0 : r ? G(a, o) : a, n = t.length - 1, u; n >= 0; n--)
|
|
13
|
+
(u = t[n]) && (l = (r ? u(a, o, l) : u(l)) || l);
|
|
14
|
+
return r && l && B(a, 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.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 E(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
|
+
}
|
|
49
|
+
})
|
|
50
|
+
}), this.onPillRemoveEvent = (t) => {
|
|
51
|
+
if (this.disabled || this.readOnly) return;
|
|
52
|
+
const a = A(this.value, t.detail.key);
|
|
53
|
+
a && (this.value = a.next, this.dispatchEvent(
|
|
54
|
+
new CustomEvent("change", { detail: { value: this.value }, bubbles: !0, composed: !0 })
|
|
55
|
+
), a.next.length === 0 && requestAnimationFrame(() => {
|
|
56
|
+
this.querySelector(".gui-range-time-input__field input")?.focus();
|
|
57
|
+
}));
|
|
58
|
+
}, this.onPillClickEvent = (t) => {
|
|
59
|
+
const a = I(this.getSortedPills(), t.detail.key);
|
|
60
|
+
a && this.onPillClick(a);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
createRenderRoot() {
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
connectedCallback() {
|
|
67
|
+
super.connectedCallback(), this.classList.add("gui-field");
|
|
68
|
+
}
|
|
69
|
+
get timeLocaleData() {
|
|
70
|
+
return _(this.localeId, this.hourFormat, this.minuteStep);
|
|
71
|
+
}
|
|
72
|
+
getPartDescriptor(t) {
|
|
73
|
+
return this.timeLocaleData.descriptors[t];
|
|
74
|
+
}
|
|
75
|
+
willUpdate(t) {
|
|
76
|
+
(!this.hasUpdated || t.has("hourFormat") || t.has("localeId")) && this._parts.seedDayPeriods();
|
|
77
|
+
}
|
|
78
|
+
render() {
|
|
79
|
+
const t = {
|
|
80
|
+
uid: this.uid,
|
|
81
|
+
label: this.label,
|
|
82
|
+
errors: this.errors,
|
|
83
|
+
touched: this.touched,
|
|
84
|
+
required: this.required,
|
|
85
|
+
disabled: this.disabled,
|
|
86
|
+
readonly: this.readOnly,
|
|
87
|
+
value: this.value,
|
|
88
|
+
hint: this.hint
|
|
89
|
+
}, a = {
|
|
90
|
+
blockClass: this.inputBlockClass,
|
|
91
|
+
groups: this.groups,
|
|
92
|
+
formatParts: P(this.localeId, this.timeLocaleData.effectiveHourFormat),
|
|
93
|
+
getDescriptor: (l) => this.getPartDescriptor(l),
|
|
94
|
+
getDisplayValue: this._parts.getPartDisplay,
|
|
95
|
+
required: this.required,
|
|
96
|
+
disabled: this.disabled,
|
|
97
|
+
partsReadonly: !!this.readOnly || this.allowCustomTime === !1
|
|
98
|
+
}, o = $(
|
|
99
|
+
this.getSortedPills(),
|
|
100
|
+
(l) => k(l, (n) => this.formatTimeForDisplay(n)),
|
|
101
|
+
this.removePillAriaLabel ?? "Remove time"
|
|
102
|
+
), r = {
|
|
103
|
+
"gui-widget-icon": !0,
|
|
104
|
+
[this.icon]: !!this.icon
|
|
105
|
+
};
|
|
106
|
+
return p`
|
|
107
|
+
${this.label ? f(this.uid, t, !1, void 0, !1) : d}
|
|
108
|
+
|
|
109
|
+
<div class="gui-widget">
|
|
110
|
+
<div
|
|
111
|
+
class="gui-widget-input gui-parts-ring gui-range-time-input ${this.icon ? "gui-range-time-input--icon" : ""}"
|
|
112
|
+
role="group"
|
|
113
|
+
aria-label=${this.label ?? "Time range input"}
|
|
114
|
+
>
|
|
115
|
+
${this.icon ? p`<span class=${v(r)} data-icon=${this.icon}></span>` : d}
|
|
116
|
+
|
|
117
|
+
<gui-pills
|
|
118
|
+
class="gui-range-time-input__pills"
|
|
119
|
+
style=${y(o.length ? {} : { "min-width": 0 })}
|
|
120
|
+
.items=${o}
|
|
121
|
+
.removable=${!0}
|
|
122
|
+
.clickable=${!0}
|
|
123
|
+
.bubble=${!0}
|
|
124
|
+
?disabled=${this.disabled}
|
|
125
|
+
?readonly=${this.readOnly}
|
|
126
|
+
.removeAriaLabel=${this.removePillAriaLabel ?? "Remove time"}
|
|
127
|
+
.compactAriaLabel=${`${o.length} time ranges`}
|
|
128
|
+
@pillremove=${this.onPillRemoveEvent}
|
|
129
|
+
@pillclick=${this.onPillClickEvent}
|
|
130
|
+
></gui-pills>
|
|
131
|
+
|
|
132
|
+
<div class="gui-range-time-input__inputs">
|
|
133
|
+
<div
|
|
134
|
+
class="gui-parts gui-range-time-input__field"
|
|
135
|
+
role="group"
|
|
136
|
+
aria-label=${this.startTimeAriaLabel ?? "Start time"}
|
|
137
|
+
>
|
|
138
|
+
${m("start", a, this._parts)}
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
<span class="gui-range-time-input__separator">${this.separator ?? "-"}</span>
|
|
142
|
+
|
|
143
|
+
<div
|
|
144
|
+
class="gui-parts gui-range-time-input__field"
|
|
145
|
+
role="group"
|
|
146
|
+
aria-label=${this.endTimeAriaLabel ?? "End time"}
|
|
147
|
+
>
|
|
148
|
+
${m("end", a, this._parts)}
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
${this.showErrors && this.errors?.length ? T(this.uid, t) : d}
|
|
154
|
+
</div>
|
|
155
|
+
`;
|
|
156
|
+
}
|
|
157
|
+
onPillClick(t) {
|
|
158
|
+
this.dispatchEvent(
|
|
159
|
+
new CustomEvent("pillClick", { detail: { range: t }, bubbles: !0, composed: !0 })
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
formatTimeForDisplay(t) {
|
|
163
|
+
return S(t, this.localeId, this.timeLocaleData.effectiveHourFormat);
|
|
164
|
+
}
|
|
165
|
+
getSortedPills() {
|
|
166
|
+
return M(this.value, h);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Parses a group's parts into an ISO time via the shared clamp/bounds
|
|
170
|
+
* pipeline, surfacing a bounds violation as an inputError. Returns null while
|
|
171
|
+
* the group is incomplete or out of bounds.
|
|
172
|
+
*/
|
|
173
|
+
validateTimeParts(t) {
|
|
174
|
+
const { effectiveHourFormat: a, descriptors: o } = this.timeLocaleData, { result: r, writeBacks: l } = C(this._parts.values[t] ?? {}, {
|
|
175
|
+
hourFormat: a,
|
|
176
|
+
descriptors: o
|
|
177
|
+
});
|
|
178
|
+
if (this._parts.applyWriteBacks(t, l), r.kind !== "valid") return { kind: "incomplete" };
|
|
179
|
+
const n = D(r.iso, {
|
|
180
|
+
minTime: this.minTime,
|
|
181
|
+
maxTime: this.maxTime,
|
|
182
|
+
minTimeMessage: this.minTimeMessage,
|
|
183
|
+
maxTimeMessage: this.maxTimeMessage
|
|
184
|
+
});
|
|
185
|
+
return n ? { kind: "invalid", message: n } : { kind: "valid", value: r.iso };
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Fills a group's segmented parts from an ISO time. The range time picker
|
|
189
|
+
* calls this so a list pick lands in the visible input (start/end field)
|
|
190
|
+
* before it attempts to commit — see {@link commitFromParts}.
|
|
191
|
+
*/
|
|
192
|
+
fillGroup(t, a) {
|
|
193
|
+
this._parts.setGroupFromISO(t, a, "time", this.timeLocaleData.effectiveHourFormat), this.requestUpdate();
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Attempts to commit the currently-entered parts as a pill, returning whether
|
|
197
|
+
* one was created. A public entry point onto the same {@link tryCreatePill}
|
|
198
|
+
* pipeline typed entry uses, so the picker's list-driven commits validate
|
|
199
|
+
* (order + bounds + disabled ranges) through one path.
|
|
200
|
+
*/
|
|
201
|
+
commitFromParts() {
|
|
202
|
+
return this.tryCreatePill();
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Re-parses both endpoints (surfacing per-endpoint bounds errors as the user
|
|
206
|
+
* types) and notifies the host picker via `partsChange` so its time lists
|
|
207
|
+
* follow the typed values. Runs on every part change.
|
|
208
|
+
*/
|
|
209
|
+
syncParts() {
|
|
210
|
+
const t = this.validateTimeParts("start"), a = this.validateTimeParts("end"), o = (r) => r.kind === "valid" ? r.value : null;
|
|
211
|
+
return this.dispatchEvent(
|
|
212
|
+
new CustomEvent("partsChange", {
|
|
213
|
+
detail: { start: o(t), end: o(a) },
|
|
214
|
+
bubbles: !0,
|
|
215
|
+
composed: !0
|
|
216
|
+
})
|
|
217
|
+
), { start: t, end: a };
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Parses the range and updates the error state, without ever committing.
|
|
221
|
+
* Shared by the Enter commit and by {@link revalidate}.
|
|
222
|
+
*/
|
|
223
|
+
evaluateRange() {
|
|
224
|
+
const { start: t, end: a } = this.syncParts(), o = w(t, a, this.value, {
|
|
225
|
+
validate: (r) => h(r.end, r.start) <= 0 ? this.rangeOrderMessage ?? F : R(r.start, r.end, this.disabledRanges) ? this.disabledRangeMessage ?? O : null,
|
|
226
|
+
toRange: (r) => ({ start: r.start, end: r.end }),
|
|
227
|
+
merge: L
|
|
228
|
+
});
|
|
229
|
+
return o.kind === "incomplete" && this._parts.clearSurfacedInputError(this.value ?? []), o.kind === "invalid" && this._parts.surfaceInputError(o.message), o;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Once the user has attempted a commit, every later edit re-runs validation
|
|
233
|
+
* so a corrected range clears its error immediately, otherwise the message
|
|
234
|
+
* would linger until the next Enter and the user could not tell the problem
|
|
235
|
+
* was solved.
|
|
236
|
+
*/
|
|
237
|
+
revalidate() {
|
|
238
|
+
this.evaluateRange().kind === "commit" && this._parts.clearSurfacedInputError(this.value ?? []);
|
|
239
|
+
}
|
|
240
|
+
tryCreatePill() {
|
|
241
|
+
this._validationTriggered = !0;
|
|
242
|
+
const t = this.evaluateRange();
|
|
243
|
+
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(
|
|
244
|
+
new CustomEvent("change", { detail: { value: this.value }, bubbles: !0, composed: !0 })
|
|
245
|
+
), this._parts.focusFirst("start"), this.requestUpdate(), !0);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
i([
|
|
249
|
+
s({ type: String })
|
|
250
|
+
], e.prototype, "uid", 2);
|
|
251
|
+
i([
|
|
252
|
+
s({ type: String })
|
|
253
|
+
], e.prototype, "label", 2);
|
|
254
|
+
i([
|
|
255
|
+
s({ type: String, attribute: "locale-id" })
|
|
256
|
+
], e.prototype, "localeId", 2);
|
|
257
|
+
i([
|
|
258
|
+
s({ type: Array })
|
|
259
|
+
], e.prototype, "errors", 2);
|
|
260
|
+
i([
|
|
261
|
+
s({ type: Boolean })
|
|
262
|
+
], e.prototype, "showErrors", 2);
|
|
263
|
+
i([
|
|
264
|
+
s({ type: Boolean })
|
|
265
|
+
], e.prototype, "touched", 2);
|
|
266
|
+
i([
|
|
267
|
+
s({ type: Boolean })
|
|
268
|
+
], e.prototype, "required", 2);
|
|
269
|
+
i([
|
|
270
|
+
s({ type: Boolean })
|
|
271
|
+
], e.prototype, "disabled", 2);
|
|
272
|
+
i([
|
|
273
|
+
s({ type: Boolean, attribute: "readonly" })
|
|
274
|
+
], e.prototype, "readOnly", 2);
|
|
275
|
+
i([
|
|
276
|
+
s({ type: String })
|
|
277
|
+
], e.prototype, "icon", 2);
|
|
278
|
+
i([
|
|
279
|
+
s({ type: String })
|
|
280
|
+
], e.prototype, "hint", 2);
|
|
281
|
+
i([
|
|
282
|
+
s({ type: String, attribute: "hour-format" })
|
|
283
|
+
], e.prototype, "hourFormat", 2);
|
|
284
|
+
i([
|
|
285
|
+
s({ type: Number, attribute: "minute-step" })
|
|
286
|
+
], e.prototype, "minuteStep", 2);
|
|
287
|
+
i([
|
|
288
|
+
s({ type: String, attribute: "min-time" })
|
|
289
|
+
], e.prototype, "minTime", 2);
|
|
290
|
+
i([
|
|
291
|
+
s({ type: String, attribute: "max-time" })
|
|
292
|
+
], e.prototype, "maxTime", 2);
|
|
293
|
+
i([
|
|
294
|
+
s({ type: String, attribute: "min-time-message" })
|
|
295
|
+
], e.prototype, "minTimeMessage", 2);
|
|
296
|
+
i([
|
|
297
|
+
s({ type: String, attribute: "max-time-message" })
|
|
298
|
+
], e.prototype, "maxTimeMessage", 2);
|
|
299
|
+
i([
|
|
300
|
+
s({ type: Array })
|
|
301
|
+
], e.prototype, "value", 2);
|
|
302
|
+
i([
|
|
303
|
+
s({ type: String, attribute: "range-order-message" })
|
|
304
|
+
], e.prototype, "rangeOrderMessage", 2);
|
|
305
|
+
i([
|
|
306
|
+
s({ type: String })
|
|
307
|
+
], e.prototype, "removePillAriaLabel", 2);
|
|
308
|
+
i([
|
|
309
|
+
s({ type: String })
|
|
310
|
+
], e.prototype, "startTimeAriaLabel", 2);
|
|
311
|
+
i([
|
|
312
|
+
s({ type: String })
|
|
313
|
+
], e.prototype, "endTimeAriaLabel", 2);
|
|
314
|
+
i([
|
|
315
|
+
s({ type: String })
|
|
316
|
+
], e.prototype, "separator", 2);
|
|
317
|
+
i([
|
|
318
|
+
s({ type: Boolean, attribute: "allow-custom-time" })
|
|
319
|
+
], e.prototype, "allowCustomTime", 2);
|
|
320
|
+
i([
|
|
321
|
+
s({ type: Array, attribute: "disabled-ranges" })
|
|
322
|
+
], e.prototype, "disabledRanges", 2);
|
|
323
|
+
i([
|
|
324
|
+
s({ type: String, attribute: "disabled-range-message" })
|
|
325
|
+
], e.prototype, "disabledRangeMessage", 2);
|
|
326
|
+
e = i([
|
|
327
|
+
g("gui-range-time")
|
|
328
|
+
], e);
|
|
329
|
+
typeof customElements < "u" && !customElements.get("gui-range-time") && customElements.define("gui-range-time", e);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { InputWidgetAdapter as n, formContext as m, inputContext as o } from "@golemui/lit";
|
|
2
|
+
import "./range-time-input-3lhqR1Ku.js";
|
|
3
|
+
import { consume as h, provide as u } from "@lit/context";
|
|
4
|
+
import { LitElement as c, html as g } from "lit";
|
|
5
|
+
import { property as D, customElement as $ } from "lit/decorators.js";
|
|
6
|
+
import "rxjs";
|
|
7
|
+
var b = 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 && b(t, s, a), a;
|
|
11
|
+
};
|
|
12
|
+
let i = class extends c {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.adapter = new n(), 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(), g`
|
|
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
|
+
.separator=${this.adapter.templateData.separator}
|
|
44
|
+
.removePillAriaLabel=${this.adapter.templateData.removePillAriaLabel}
|
|
45
|
+
.startTimeAriaLabel=${this.adapter.templateData.startTimeAriaLabel}
|
|
46
|
+
.endTimeAriaLabel=${this.adapter.templateData.endTimeAriaLabel}
|
|
47
|
+
.hourFormat=${this.adapter.templateData.hourFormat}
|
|
48
|
+
.minuteStep=${this.adapter.templateData.minuteStep}
|
|
49
|
+
.minTime=${this.adapter.templateData.minTime}
|
|
50
|
+
.maxTime=${this.adapter.templateData.maxTime}
|
|
51
|
+
.minTimeMessage=${this.adapter.templateData.minTimeMessage}
|
|
52
|
+
.maxTimeMessage=${this.adapter.templateData.maxTimeMessage}
|
|
53
|
+
.rangeOrderMessage=${this.adapter.templateData.rangeOrderMessage}
|
|
54
|
+
@change=${this.valueChanged}
|
|
55
|
+
@inputError=${this.onInputError}
|
|
56
|
+
></gui-range-time>
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
59
|
+
valueChanged(e) {
|
|
60
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(e.detail.value);
|
|
61
|
+
}
|
|
62
|
+
onInputError(e) {
|
|
63
|
+
this.adapter.injectValidationIssues([e.detail.message]);
|
|
64
|
+
}
|
|
65
|
+
disconnectedCallback() {
|
|
66
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
d([
|
|
70
|
+
h({ context: m }),
|
|
71
|
+
D({ attribute: !1 })
|
|
72
|
+
], i.prototype, "formContext", 2);
|
|
73
|
+
d([
|
|
74
|
+
u({ context: o })
|
|
75
|
+
], i.prototype, "adapter", 2);
|
|
76
|
+
i = d([
|
|
77
|
+
$("gui-range-time-input")
|
|
78
|
+
], i);
|
|
79
|
+
export {
|
|
80
|
+
i as RangeTimeInputElement
|
|
81
|
+
};
|