@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,246 @@
|
|
|
1
|
+
import { LitElement as u, nothing as h, html as p } from "lit";
|
|
2
|
+
import { property as i, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import { classMap as g } from "lit/directives/class-map.js";
|
|
4
|
+
import { G as y, b as c, c as b } from "./templates-Dmr34nwp.js";
|
|
5
|
+
import { G as v, g as D, w as f, z as E, a as S, r as A, b as L, P as T } from "./part-templates-VORbpgs2.js";
|
|
6
|
+
import { d as M } from "./date-DBuYpvcO.js";
|
|
7
|
+
var x = Object.defineProperty, P = Object.getOwnPropertyDescriptor, e = (a, o, l, s) => {
|
|
8
|
+
for (var r = s > 1 ? void 0 : s ? P(o, l) : o, n = a.length - 1, d; n >= 0; n--)
|
|
9
|
+
(d = a[n]) && (r = (s ? d(o, l, r) : d(r)) || r);
|
|
10
|
+
return s && r && x(o, l, r), r;
|
|
11
|
+
};
|
|
12
|
+
let t = class extends u {
|
|
13
|
+
constructor() {
|
|
14
|
+
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.hourAriaLabel = void 0, this.minuteAriaLabel = void 0, this.dayPeriodAriaLabel = void 0, this.hourFormat = void 0, this.minuteStep = 1, this.invalidDateMessage = void 0, this.value = void 0, this.minDate = void 0, this.maxDate = void 0, this.minTime = void 0, this.maxTime = void 0, this.minDateMessage = void 0, this.maxDateMessage = void 0, this.minTimeMessage = void 0, this.maxTimeMessage = void 0, this.inputBlockClass = "gui-date-time-input", this.groups = ["default"], this._parts = new v(this, {
|
|
15
|
+
blockClass: this.inputBlockClass,
|
|
16
|
+
groups: this.groups,
|
|
17
|
+
getDescriptor: (a) => this.getPartDescriptor(a),
|
|
18
|
+
commitGroup: (a) => this.validateAndEmit(a),
|
|
19
|
+
isReadonly: () => !!this.readOnly,
|
|
20
|
+
isDisabled: () => !!this.disabled,
|
|
21
|
+
onEmptyPartBlur: () => this.dispatchEvent(new CustomEvent("change", { detail: { value: null }, bubbles: !0 })),
|
|
22
|
+
getHourFormat: () => this.localeData.effectiveHourFormat,
|
|
23
|
+
getDayPeriodLabels: () => this.localeData.dayPeriodLabels
|
|
24
|
+
}), this.ariaController = new y(this, {
|
|
25
|
+
getTargets: () => this.querySelectorAll(`.${this.inputBlockClass}`),
|
|
26
|
+
getState: () => ({
|
|
27
|
+
uid: this.uid,
|
|
28
|
+
templateData: {
|
|
29
|
+
hint: this.hint,
|
|
30
|
+
errors: this.errors,
|
|
31
|
+
readonly: this.readOnly,
|
|
32
|
+
disabled: this.disabled,
|
|
33
|
+
touched: this.touched,
|
|
34
|
+
required: this.required
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
createRenderRoot() {
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
connectedCallback() {
|
|
43
|
+
super.connectedCallback(), this.classList.add("gui-field");
|
|
44
|
+
}
|
|
45
|
+
get localeData() {
|
|
46
|
+
return D(this.localeId, this.hourFormat, this.minuteStep, !0);
|
|
47
|
+
}
|
|
48
|
+
getPartDescriptor(a) {
|
|
49
|
+
return this.localeData.descriptors[a];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Constrains the date and time axes independently: `minDate`/`maxDate` bound
|
|
53
|
+
* the day, `minTime`/`maxTime` bound the time-of-day on every allowed day.
|
|
54
|
+
*/
|
|
55
|
+
boundsError(a, o) {
|
|
56
|
+
return M(a, this.minDate, this.maxDate, void 0, {
|
|
57
|
+
minDateMessage: this.minDateMessage,
|
|
58
|
+
maxDateMessage: this.maxDateMessage
|
|
59
|
+
}) ?? f(E(o), {
|
|
60
|
+
minTime: this.minTime,
|
|
61
|
+
maxTime: this.maxTime,
|
|
62
|
+
minTimeMessage: this.minTimeMessage,
|
|
63
|
+
maxTimeMessage: this.maxTimeMessage
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
willUpdate(a) {
|
|
67
|
+
(!this.hasUpdated || a.has("value") || a.has("hourFormat") || a.has("localeId")) && this._parts.setGroupFromISO(
|
|
68
|
+
"default",
|
|
69
|
+
this.value ?? "",
|
|
70
|
+
"dateTime",
|
|
71
|
+
this.localeData.effectiveHourFormat
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
const a = {
|
|
76
|
+
uid: this.uid,
|
|
77
|
+
label: this.label,
|
|
78
|
+
errors: this.errors,
|
|
79
|
+
touched: this.touched,
|
|
80
|
+
required: this.required,
|
|
81
|
+
disabled: this.disabled,
|
|
82
|
+
readonly: this.readOnly,
|
|
83
|
+
value: this.value,
|
|
84
|
+
icon: this.icon,
|
|
85
|
+
hint: this.hint
|
|
86
|
+
}, o = {
|
|
87
|
+
blockClass: this.inputBlockClass,
|
|
88
|
+
groups: this.groups,
|
|
89
|
+
formatParts: S(this.localeId, this.localeData.effectiveHourFormat),
|
|
90
|
+
getDescriptor: (s) => this.getPartDescriptor(s),
|
|
91
|
+
getDisplayValue: this._parts.getPartDisplay,
|
|
92
|
+
getPartAriaLabel: (s, r) => ({
|
|
93
|
+
day: this.dayAriaLabel,
|
|
94
|
+
month: this.monthAriaLabel,
|
|
95
|
+
year: this.yearAriaLabel,
|
|
96
|
+
hour: this.hourAriaLabel,
|
|
97
|
+
minute: this.minuteAriaLabel
|
|
98
|
+
})[r] ?? T[r],
|
|
99
|
+
dayPeriodAriaLabel: this.dayPeriodAriaLabel,
|
|
100
|
+
disabled: this.disabled,
|
|
101
|
+
partsReadonly: !!this.readOnly
|
|
102
|
+
}, l = {
|
|
103
|
+
"gui-widget-icon": !0,
|
|
104
|
+
[this.icon]: !0
|
|
105
|
+
};
|
|
106
|
+
return p`
|
|
107
|
+
${this.label ? c(this.uid, a, !1, void 0, !1) : h}
|
|
108
|
+
|
|
109
|
+
<div class="gui-widget">
|
|
110
|
+
<div
|
|
111
|
+
id=${this.uid}
|
|
112
|
+
class="gui-widget-input gui-parts gui-parts-ring gui-date-time-input ${this.icon ? "gui-calendar--icon" : ""}"
|
|
113
|
+
role="group"
|
|
114
|
+
aria-labelledby=${`${this.uid}_label`}
|
|
115
|
+
>
|
|
116
|
+
${A("default", o, this._parts)}
|
|
117
|
+
</div>
|
|
118
|
+
${this.icon ? p`<span
|
|
119
|
+
class=${g(l)}
|
|
120
|
+
data-icon=${this.icon}
|
|
121
|
+
aria-hidden="true"
|
|
122
|
+
></span>` : h}
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
${this.showErrors && this.errors?.length ? b(this.uid, a) : h}
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
validateAndEmit(a) {
|
|
129
|
+
const { effectiveHourFormat: o, descriptors: l } = this.localeData, { result: s, writeBacks: r } = L(this._parts.values[a] ?? {}, {
|
|
130
|
+
hourFormat: o,
|
|
131
|
+
descriptors: l,
|
|
132
|
+
invalidDateMessage: this.invalidDateMessage
|
|
133
|
+
});
|
|
134
|
+
if (this._parts.applyWriteBacks(a, r), s.kind === "incomplete") {
|
|
135
|
+
this.requestUpdate();
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (s.kind === "invalid") {
|
|
139
|
+
this.dispatchEvent(
|
|
140
|
+
new CustomEvent("inputError", { detail: { message: s.message }, bubbles: !0 })
|
|
141
|
+
), this.requestUpdate();
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const n = this.boundsError(s.iso, s.instant);
|
|
145
|
+
if (n) {
|
|
146
|
+
this.dispatchEvent(
|
|
147
|
+
new CustomEvent("change", { detail: { value: s.iso }, bubbles: !0 })
|
|
148
|
+
), this.dispatchEvent(
|
|
149
|
+
new CustomEvent("inputError", { detail: { message: n }, bubbles: !0 })
|
|
150
|
+
), this.requestUpdate();
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
this.value = s.iso, this.dispatchEvent(new CustomEvent("change", { detail: { value: this.value }, bubbles: !0 })), this.requestUpdate();
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
e([
|
|
157
|
+
i({ type: String })
|
|
158
|
+
], t.prototype, "uid", 2);
|
|
159
|
+
e([
|
|
160
|
+
i({ type: String })
|
|
161
|
+
], t.prototype, "label", 2);
|
|
162
|
+
e([
|
|
163
|
+
i({ type: String, attribute: "locale-id" })
|
|
164
|
+
], t.prototype, "localeId", 2);
|
|
165
|
+
e([
|
|
166
|
+
i({ type: Array })
|
|
167
|
+
], t.prototype, "errors", 2);
|
|
168
|
+
e([
|
|
169
|
+
i({ type: Boolean })
|
|
170
|
+
], t.prototype, "showErrors", 2);
|
|
171
|
+
e([
|
|
172
|
+
i({ type: Boolean })
|
|
173
|
+
], t.prototype, "touched", 2);
|
|
174
|
+
e([
|
|
175
|
+
i({ type: Boolean })
|
|
176
|
+
], t.prototype, "required", 2);
|
|
177
|
+
e([
|
|
178
|
+
i({ type: Boolean })
|
|
179
|
+
], t.prototype, "disabled", 2);
|
|
180
|
+
e([
|
|
181
|
+
i({ type: Boolean, attribute: "readonly" })
|
|
182
|
+
], t.prototype, "readOnly", 2);
|
|
183
|
+
e([
|
|
184
|
+
i({ type: String })
|
|
185
|
+
], t.prototype, "icon", 2);
|
|
186
|
+
e([
|
|
187
|
+
i({ type: String })
|
|
188
|
+
], t.prototype, "hint", 2);
|
|
189
|
+
e([
|
|
190
|
+
i({ type: String })
|
|
191
|
+
], t.prototype, "dayAriaLabel", 2);
|
|
192
|
+
e([
|
|
193
|
+
i({ type: String })
|
|
194
|
+
], t.prototype, "monthAriaLabel", 2);
|
|
195
|
+
e([
|
|
196
|
+
i({ type: String })
|
|
197
|
+
], t.prototype, "yearAriaLabel", 2);
|
|
198
|
+
e([
|
|
199
|
+
i({ type: String })
|
|
200
|
+
], t.prototype, "hourAriaLabel", 2);
|
|
201
|
+
e([
|
|
202
|
+
i({ type: String })
|
|
203
|
+
], t.prototype, "minuteAriaLabel", 2);
|
|
204
|
+
e([
|
|
205
|
+
i({ type: String })
|
|
206
|
+
], t.prototype, "dayPeriodAriaLabel", 2);
|
|
207
|
+
e([
|
|
208
|
+
i({ type: String, attribute: "hour-format" })
|
|
209
|
+
], t.prototype, "hourFormat", 2);
|
|
210
|
+
e([
|
|
211
|
+
i({ type: Number, attribute: "minute-step" })
|
|
212
|
+
], t.prototype, "minuteStep", 2);
|
|
213
|
+
e([
|
|
214
|
+
i({ type: String, attribute: "invalid-date-message" })
|
|
215
|
+
], t.prototype, "invalidDateMessage", 2);
|
|
216
|
+
e([
|
|
217
|
+
i({ type: String })
|
|
218
|
+
], t.prototype, "value", 2);
|
|
219
|
+
e([
|
|
220
|
+
i({ type: String, attribute: "min-date" })
|
|
221
|
+
], t.prototype, "minDate", 2);
|
|
222
|
+
e([
|
|
223
|
+
i({ type: String, attribute: "max-date" })
|
|
224
|
+
], t.prototype, "maxDate", 2);
|
|
225
|
+
e([
|
|
226
|
+
i({ type: String, attribute: "min-time" })
|
|
227
|
+
], t.prototype, "minTime", 2);
|
|
228
|
+
e([
|
|
229
|
+
i({ type: String, attribute: "max-time" })
|
|
230
|
+
], t.prototype, "maxTime", 2);
|
|
231
|
+
e([
|
|
232
|
+
i({ type: String, attribute: "min-date-message" })
|
|
233
|
+
], t.prototype, "minDateMessage", 2);
|
|
234
|
+
e([
|
|
235
|
+
i({ type: String, attribute: "max-date-message" })
|
|
236
|
+
], t.prototype, "maxDateMessage", 2);
|
|
237
|
+
e([
|
|
238
|
+
i({ type: String, attribute: "min-time-message" })
|
|
239
|
+
], t.prototype, "minTimeMessage", 2);
|
|
240
|
+
e([
|
|
241
|
+
i({ type: String, attribute: "max-time-message" })
|
|
242
|
+
], t.prototype, "maxTimeMessage", 2);
|
|
243
|
+
t = e([
|
|
244
|
+
m("gui-date-time")
|
|
245
|
+
], t);
|
|
246
|
+
typeof customElements < "u" && !customElements.get("gui-date-time") && customElements.define("gui-date-time", t);
|
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { InputWidgetAdapter as b, formContext as c, inputContext as y } from "@golemui/lit";
|
|
2
|
+
import { LitElement as u, html as m, nothing as $ } from "lit";
|
|
3
|
+
import { property as a, customElement as g } from "lit/decorators.js";
|
|
4
|
+
import { classMap as v } from "lit/directives/class-map.js";
|
|
5
|
+
import "./date-time-input-DZaz2heD.js";
|
|
6
|
+
import "./date-time-calendar-DzU-FtVl.js";
|
|
7
|
+
import { G as M } from "./popup.controller-B33OvX_y.js";
|
|
8
|
+
import { t as A, d as L, e as T } from "./date-DBuYpvcO.js";
|
|
9
|
+
import { p as f, y as x, h as D, z as S } from "./part-templates-VORbpgs2.js";
|
|
10
|
+
import { a as w, b as _, c as C } from "./templates-Dmr34nwp.js";
|
|
11
|
+
import { consume as I, provide as R } from "@lit/context";
|
|
12
|
+
import "rxjs";
|
|
13
|
+
var E = Object.defineProperty, F = Object.getOwnPropertyDescriptor, i = (e, r, n, o) => {
|
|
14
|
+
for (var s = o > 1 ? void 0 : o ? F(r, n) : r, l = e.length - 1, d; l >= 0; l--)
|
|
15
|
+
(d = e[l]) && (s = (o ? d(r, n, s) : d(s)) || s);
|
|
16
|
+
return o && s && E(r, n, s), s;
|
|
17
|
+
};
|
|
18
|
+
let t = class extends u {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments), this.uid = void 0, this.label = void 0, this.hint = void 0, this.icon = "", this.toggleAriaLabel = void 0, this.dayAriaLabel = void 0, this.monthAriaLabel = void 0, this.yearAriaLabel = void 0, this.hourAriaLabel = void 0, this.minuteAriaLabel = void 0, this.dayPeriodAriaLabel = void 0, this.errors = [], this.showErrors = !0, this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.localeId = void 0, this.value = void 0, this.prevMonthIcon = "", this.nextMonthIcon = "", this.prevMonthAriaLabel = void 0, this.nextMonthAriaLabel = void 0, this.selectYearAriaLabel = void 0, this.yearGridAriaLabel = void 0, this.dayFormat = void 0, this.weekdayFormat = void 0, this.monthFormat = void 0, this.minDate = void 0, this.maxDate = void 0, this.disabledRanges = void 0, this.numberOfMonths = void 0, this.hourFormat = void 0, this.minuteStep = void 0, this.minTime = void 0, this.maxTime = void 0, this.disabledTimeRanges = void 0, this.allowCustomTime = !1, this.invalidDateMessage = void 0, this.minDateMessage = void 0, this.maxDateMessage = void 0, this.disabledDateRangeMessage = void 0, this.minTimeMessage = void 0, this.maxTimeMessage = void 0, this.disabledTimeRangeMessage = void 0, this.noAvailableTimesMessage = void 0, this._popup = new M(this, {
|
|
21
|
+
focusRestoreSelector: "gui-date-time input",
|
|
22
|
+
focusPopupSelector: '.gui-calendar__day-button[tabindex="0"]',
|
|
23
|
+
isDisabled: () => !!this.disabled,
|
|
24
|
+
clickIntent: (e) => e.closest(".gui-calendar__day-button") || e.closest(".gui-time-list__option") ? "ignore" : e.closest(".gui-date-time-input__part") || e.closest("gui-date-time-calendar") ? "open" : "toggle",
|
|
25
|
+
keyToggleMode: "toggle"
|
|
26
|
+
}), this.onToggleClick = (e) => {
|
|
27
|
+
e.stopPropagation(), this._popup.open ? this._popup.close() : this._popup.openAndFocus();
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
createRenderRoot() {
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
const e = w("datePicker", { icon: this.icon }), r = this._popup.open ? m`<gui-date-time-calendar
|
|
35
|
+
id=${`${this.uid}_popup`}
|
|
36
|
+
role="dialog"
|
|
37
|
+
aria-label=${this.label ?? "Calendar"}
|
|
38
|
+
.uid=${this.uid}
|
|
39
|
+
.hint=${this.hint}
|
|
40
|
+
?touched=${this.touched}
|
|
41
|
+
?required=${this.required}
|
|
42
|
+
?disabled=${this.disabled}
|
|
43
|
+
?readonly=${this.readOnly}
|
|
44
|
+
.value=${this.value}
|
|
45
|
+
.prevMonthIcon=${this.prevMonthIcon}
|
|
46
|
+
.nextMonthIcon=${this.nextMonthIcon}
|
|
47
|
+
.prevMonthAriaLabel=${this.prevMonthAriaLabel}
|
|
48
|
+
.nextMonthAriaLabel=${this.nextMonthAriaLabel}
|
|
49
|
+
.selectYearAriaLabel=${this.selectYearAriaLabel}
|
|
50
|
+
.yearGridAriaLabel=${this.yearGridAriaLabel}
|
|
51
|
+
.dayFormat=${this.dayFormat}
|
|
52
|
+
.weekdayFormat=${this.weekdayFormat}
|
|
53
|
+
.monthFormat=${this.monthFormat}
|
|
54
|
+
.minDate=${this.minDate}
|
|
55
|
+
.maxDate=${this.maxDate}
|
|
56
|
+
.disabledRanges=${this.disabledRanges}
|
|
57
|
+
.numberOfMonths=${this.numberOfMonths}
|
|
58
|
+
.localeId=${this.localeId}
|
|
59
|
+
.hourFormat=${this.hourFormat}
|
|
60
|
+
.minuteStep=${this.minuteStep}
|
|
61
|
+
.minTime=${this.minTime}
|
|
62
|
+
.maxTime=${this.maxTime}
|
|
63
|
+
.disabledTimeRanges=${this.disabledTimeRanges}
|
|
64
|
+
.allowCustomTime=${this.allowCustomTime}
|
|
65
|
+
.minTimeMessage=${this.minTimeMessage}
|
|
66
|
+
.maxTimeMessage=${this.maxTimeMessage}
|
|
67
|
+
.disabledTimeRangeMessage=${this.disabledTimeRangeMessage}
|
|
68
|
+
.noAvailableTimesMessage=${this.noAvailableTimesMessage}
|
|
69
|
+
@blur=${this.onCalendarBlur}
|
|
70
|
+
@change=${this.onCalendarChange}
|
|
71
|
+
></gui-date-time-calendar>` : $;
|
|
72
|
+
return m`
|
|
73
|
+
${_(
|
|
74
|
+
this.uid ?? "",
|
|
75
|
+
{
|
|
76
|
+
label: this.label,
|
|
77
|
+
hint: this.hint,
|
|
78
|
+
required: this.required
|
|
79
|
+
},
|
|
80
|
+
!1,
|
|
81
|
+
void 0,
|
|
82
|
+
!1
|
|
83
|
+
)}
|
|
84
|
+
|
|
85
|
+
<div
|
|
86
|
+
class="gui-widget"
|
|
87
|
+
@keydown=${this._popup.onAnchorKeyDown}
|
|
88
|
+
@click=${this._popup.onAnchorClick}
|
|
89
|
+
>
|
|
90
|
+
<gui-date-time
|
|
91
|
+
id="date-input"
|
|
92
|
+
class=${v(e.widgetClasses)}
|
|
93
|
+
.uid=${this.uid}
|
|
94
|
+
.hint=${this.hint}
|
|
95
|
+
.showErrors=${!1}
|
|
96
|
+
.errors=${this.errors}
|
|
97
|
+
?touched=${this.touched}
|
|
98
|
+
?required=${this.required}
|
|
99
|
+
?disabled=${this.disabled}
|
|
100
|
+
?readonly=${this.readOnly}
|
|
101
|
+
.value=${this.value}
|
|
102
|
+
.icon=${this.icon}
|
|
103
|
+
.localeId=${this.localeId}
|
|
104
|
+
.hourFormat=${this.hourFormat}
|
|
105
|
+
.minuteStep=${this.minuteStep}
|
|
106
|
+
.minTime=${this.minTime}
|
|
107
|
+
.maxTime=${this.maxTime}
|
|
108
|
+
.dayAriaLabel=${this.dayAriaLabel}
|
|
109
|
+
.monthAriaLabel=${this.monthAriaLabel}
|
|
110
|
+
.yearAriaLabel=${this.yearAriaLabel}
|
|
111
|
+
.hourAriaLabel=${this.hourAriaLabel}
|
|
112
|
+
.minuteAriaLabel=${this.minuteAriaLabel}
|
|
113
|
+
.dayPeriodAriaLabel=${this.dayPeriodAriaLabel}
|
|
114
|
+
.invalidDateMessage=${this.invalidDateMessage}
|
|
115
|
+
.minTimeMessage=${this.minTimeMessage}
|
|
116
|
+
.maxTimeMessage=${this.maxTimeMessage}
|
|
117
|
+
@blur=${this.onDateBlur}
|
|
118
|
+
@focus=${this._popup.show}
|
|
119
|
+
@change=${this.onDateChange}
|
|
120
|
+
></gui-date-time>
|
|
121
|
+
<button
|
|
122
|
+
type="button"
|
|
123
|
+
class="gui-date-time-picker__arrow"
|
|
124
|
+
aria-label=${this.toggleAriaLabel ?? "Show calendar"}
|
|
125
|
+
aria-haspopup="dialog"
|
|
126
|
+
aria-expanded=${this._popup.open ? "true" : "false"}
|
|
127
|
+
aria-controls=${`${this.uid}_popup`}
|
|
128
|
+
?disabled=${this.disabled}
|
|
129
|
+
@click=${this.onToggleClick}
|
|
130
|
+
>
|
|
131
|
+
<svg
|
|
132
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
133
|
+
width="16"
|
|
134
|
+
height="16"
|
|
135
|
+
viewBox="0 0 256 256"
|
|
136
|
+
aria-hidden="true"
|
|
137
|
+
>
|
|
138
|
+
<path
|
|
139
|
+
d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"
|
|
140
|
+
></path>
|
|
141
|
+
</svg>
|
|
142
|
+
</button>
|
|
143
|
+
|
|
144
|
+
${r}
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
${this.showErrors ? C(this.uid ?? "", { errors: this.errors, touched: this.touched }) : ""}
|
|
148
|
+
`;
|
|
149
|
+
}
|
|
150
|
+
onDateChange(e) {
|
|
151
|
+
e.stopPropagation(), this.commitValue(e.detail.value);
|
|
152
|
+
}
|
|
153
|
+
onDateBlur() {
|
|
154
|
+
this.dispatchEvent(new CustomEvent("blur"));
|
|
155
|
+
}
|
|
156
|
+
onCalendarChange(e) {
|
|
157
|
+
if (!this._popup.open) {
|
|
158
|
+
e.stopPropagation();
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
e.stopPropagation(), this.commitValue(e.detail.value), e.detail.value && e.detail.commit && this._popup.close();
|
|
162
|
+
}
|
|
163
|
+
commitValue(e) {
|
|
164
|
+
this.value = e ?? void 0;
|
|
165
|
+
const r = this.validateBounds(this.value);
|
|
166
|
+
this.dispatchEvent(
|
|
167
|
+
new CustomEvent("change", {
|
|
168
|
+
detail: { value: e ?? null },
|
|
169
|
+
bubbles: !0,
|
|
170
|
+
composed: !0
|
|
171
|
+
})
|
|
172
|
+
), r && this.dispatchEvent(
|
|
173
|
+
new CustomEvent("inputError", {
|
|
174
|
+
detail: { message: r },
|
|
175
|
+
bubbles: !0,
|
|
176
|
+
composed: !0
|
|
177
|
+
})
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
validateBounds(e) {
|
|
181
|
+
if (!e) return null;
|
|
182
|
+
const r = f(e);
|
|
183
|
+
if (isNaN(r.getTime())) return null;
|
|
184
|
+
const n = A(r), o = L(n, this.minDate, this.maxDate, this.disabledRanges, {
|
|
185
|
+
minDateMessage: this.minDateMessage,
|
|
186
|
+
maxDateMessage: this.maxDateMessage,
|
|
187
|
+
disabledDateRangeMessage: this.disabledDateRangeMessage
|
|
188
|
+
});
|
|
189
|
+
if (o) return o;
|
|
190
|
+
const s = x(this.disabledTimeRanges, n);
|
|
191
|
+
return D(S(r), s) ? this.disabledTimeRangeMessage ?? T : null;
|
|
192
|
+
}
|
|
193
|
+
// The calendar's blur already bubbles up to the host, so only close here.
|
|
194
|
+
onCalendarBlur() {
|
|
195
|
+
this._popup.closeOnFocusLeave();
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
i([
|
|
199
|
+
a({ type: String })
|
|
200
|
+
], t.prototype, "uid", 2);
|
|
201
|
+
i([
|
|
202
|
+
a({ type: String })
|
|
203
|
+
], t.prototype, "label", 2);
|
|
204
|
+
i([
|
|
205
|
+
a({ type: String })
|
|
206
|
+
], t.prototype, "hint", 2);
|
|
207
|
+
i([
|
|
208
|
+
a({ type: String })
|
|
209
|
+
], t.prototype, "icon", 2);
|
|
210
|
+
i([
|
|
211
|
+
a({ type: String, attribute: "toggle-aria-label" })
|
|
212
|
+
], t.prototype, "toggleAriaLabel", 2);
|
|
213
|
+
i([
|
|
214
|
+
a({ type: String })
|
|
215
|
+
], t.prototype, "dayAriaLabel", 2);
|
|
216
|
+
i([
|
|
217
|
+
a({ type: String })
|
|
218
|
+
], t.prototype, "monthAriaLabel", 2);
|
|
219
|
+
i([
|
|
220
|
+
a({ type: String })
|
|
221
|
+
], t.prototype, "yearAriaLabel", 2);
|
|
222
|
+
i([
|
|
223
|
+
a({ type: String })
|
|
224
|
+
], t.prototype, "hourAriaLabel", 2);
|
|
225
|
+
i([
|
|
226
|
+
a({ type: String })
|
|
227
|
+
], t.prototype, "minuteAriaLabel", 2);
|
|
228
|
+
i([
|
|
229
|
+
a({ type: String })
|
|
230
|
+
], t.prototype, "dayPeriodAriaLabel", 2);
|
|
231
|
+
i([
|
|
232
|
+
a({ type: Array })
|
|
233
|
+
], t.prototype, "errors", 2);
|
|
234
|
+
i([
|
|
235
|
+
a({ type: Boolean })
|
|
236
|
+
], t.prototype, "showErrors", 2);
|
|
237
|
+
i([
|
|
238
|
+
a({ type: Boolean })
|
|
239
|
+
], t.prototype, "touched", 2);
|
|
240
|
+
i([
|
|
241
|
+
a({ type: Boolean })
|
|
242
|
+
], t.prototype, "required", 2);
|
|
243
|
+
i([
|
|
244
|
+
a({ type: Boolean })
|
|
245
|
+
], t.prototype, "disabled", 2);
|
|
246
|
+
i([
|
|
247
|
+
a({ type: Boolean, attribute: "readonly" })
|
|
248
|
+
], t.prototype, "readOnly", 2);
|
|
249
|
+
i([
|
|
250
|
+
a({ type: String, attribute: "locale-id" })
|
|
251
|
+
], t.prototype, "localeId", 2);
|
|
252
|
+
i([
|
|
253
|
+
a({ type: String })
|
|
254
|
+
], t.prototype, "value", 2);
|
|
255
|
+
i([
|
|
256
|
+
a({ type: String, attribute: "prev-month-icon" })
|
|
257
|
+
], t.prototype, "prevMonthIcon", 2);
|
|
258
|
+
i([
|
|
259
|
+
a({ type: String, attribute: "next-month-icon" })
|
|
260
|
+
], t.prototype, "nextMonthIcon", 2);
|
|
261
|
+
i([
|
|
262
|
+
a({ type: String, attribute: "prev-month-aria-label" })
|
|
263
|
+
], t.prototype, "prevMonthAriaLabel", 2);
|
|
264
|
+
i([
|
|
265
|
+
a({ type: String, attribute: "next-month-aria-label" })
|
|
266
|
+
], t.prototype, "nextMonthAriaLabel", 2);
|
|
267
|
+
i([
|
|
268
|
+
a({ type: String, attribute: "select-year-aria-label" })
|
|
269
|
+
], t.prototype, "selectYearAriaLabel", 2);
|
|
270
|
+
i([
|
|
271
|
+
a({ type: String, attribute: "year-grid-aria-label" })
|
|
272
|
+
], t.prototype, "yearGridAriaLabel", 2);
|
|
273
|
+
i([
|
|
274
|
+
a({ type: String, attribute: "day-format" })
|
|
275
|
+
], t.prototype, "dayFormat", 2);
|
|
276
|
+
i([
|
|
277
|
+
a({ type: String, attribute: "weekday-format" })
|
|
278
|
+
], t.prototype, "weekdayFormat", 2);
|
|
279
|
+
i([
|
|
280
|
+
a({ type: String, attribute: "month-format" })
|
|
281
|
+
], t.prototype, "monthFormat", 2);
|
|
282
|
+
i([
|
|
283
|
+
a({ type: String, attribute: "min-date" })
|
|
284
|
+
], t.prototype, "minDate", 2);
|
|
285
|
+
i([
|
|
286
|
+
a({ type: String, attribute: "max-date" })
|
|
287
|
+
], t.prototype, "maxDate", 2);
|
|
288
|
+
i([
|
|
289
|
+
a({ type: Array, attribute: "disabled-ranges" })
|
|
290
|
+
], t.prototype, "disabledRanges", 2);
|
|
291
|
+
i([
|
|
292
|
+
a({ type: Number, attribute: "number-of-months" })
|
|
293
|
+
], t.prototype, "numberOfMonths", 2);
|
|
294
|
+
i([
|
|
295
|
+
a({ type: String, attribute: "hour-format" })
|
|
296
|
+
], t.prototype, "hourFormat", 2);
|
|
297
|
+
i([
|
|
298
|
+
a({ type: Number, attribute: "minute-step" })
|
|
299
|
+
], t.prototype, "minuteStep", 2);
|
|
300
|
+
i([
|
|
301
|
+
a({ type: String, attribute: "min-time" })
|
|
302
|
+
], t.prototype, "minTime", 2);
|
|
303
|
+
i([
|
|
304
|
+
a({ type: String, attribute: "max-time" })
|
|
305
|
+
], t.prototype, "maxTime", 2);
|
|
306
|
+
i([
|
|
307
|
+
a({ type: Array, attribute: "disabled-time-ranges" })
|
|
308
|
+
], t.prototype, "disabledTimeRanges", 2);
|
|
309
|
+
i([
|
|
310
|
+
a({ type: Boolean, attribute: "allow-custom-time" })
|
|
311
|
+
], t.prototype, "allowCustomTime", 2);
|
|
312
|
+
i([
|
|
313
|
+
a({ type: String, attribute: "invalid-date-message" })
|
|
314
|
+
], t.prototype, "invalidDateMessage", 2);
|
|
315
|
+
i([
|
|
316
|
+
a({ type: String, attribute: "min-date-message" })
|
|
317
|
+
], t.prototype, "minDateMessage", 2);
|
|
318
|
+
i([
|
|
319
|
+
a({ type: String, attribute: "max-date-message" })
|
|
320
|
+
], t.prototype, "maxDateMessage", 2);
|
|
321
|
+
i([
|
|
322
|
+
a({ type: String, attribute: "disabled-date-range-message" })
|
|
323
|
+
], t.prototype, "disabledDateRangeMessage", 2);
|
|
324
|
+
i([
|
|
325
|
+
a({ type: String, attribute: "min-time-message" })
|
|
326
|
+
], t.prototype, "minTimeMessage", 2);
|
|
327
|
+
i([
|
|
328
|
+
a({ type: String, attribute: "max-time-message" })
|
|
329
|
+
], t.prototype, "maxTimeMessage", 2);
|
|
330
|
+
i([
|
|
331
|
+
a({ type: String, attribute: "disabled-time-range-message" })
|
|
332
|
+
], t.prototype, "disabledTimeRangeMessage", 2);
|
|
333
|
+
i([
|
|
334
|
+
a({ type: String, attribute: "no-available-times-message" })
|
|
335
|
+
], t.prototype, "noAvailableTimesMessage", 2);
|
|
336
|
+
t = i([
|
|
337
|
+
g("gui-date-time-picker")
|
|
338
|
+
], t);
|
|
339
|
+
typeof customElements < "u" && !customElements.get("gui-date-time-picker") && customElements.define("gui-date-time-picker", t);
|
|
340
|
+
var P = Object.defineProperty, O = Object.getOwnPropertyDescriptor, h = (e, r, n, o) => {
|
|
341
|
+
for (var s = o > 1 ? void 0 : o ? O(r, n) : r, l = e.length - 1, d; l >= 0; l--)
|
|
342
|
+
(d = e[l]) && (s = (o ? d(r, n, s) : d(s)) || s);
|
|
343
|
+
return o && s && P(r, n, s), s;
|
|
344
|
+
};
|
|
345
|
+
let p = class extends u {
|
|
346
|
+
constructor() {
|
|
347
|
+
super(...arguments), this.adapter = new b(), this.subscriptions = [];
|
|
348
|
+
}
|
|
349
|
+
createRenderRoot() {
|
|
350
|
+
return this;
|
|
351
|
+
}
|
|
352
|
+
updated(e) {
|
|
353
|
+
super.updated(e);
|
|
354
|
+
const r = this.adapter.templateData.size;
|
|
355
|
+
r ? this.style.flex = String(r) : this.style.removeProperty("flex");
|
|
356
|
+
}
|
|
357
|
+
connectedCallback() {
|
|
358
|
+
super.connectedCallback(), this.classList.add("gui-date-time-picker", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
359
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
render() {
|
|
363
|
+
super.render();
|
|
364
|
+
const e = this.adapter.templateData;
|
|
365
|
+
return m`
|
|
366
|
+
<gui-date-time-picker
|
|
367
|
+
.uid=${this.widget.uid}
|
|
368
|
+
.label=${e.label}
|
|
369
|
+
.hint=${e.hint}
|
|
370
|
+
.errors=${e.errors}
|
|
371
|
+
?touched=${e.touched}
|
|
372
|
+
?required=${e.validator?.required}
|
|
373
|
+
?disabled=${e.disabled}
|
|
374
|
+
?readonly=${e.readonly}
|
|
375
|
+
.value=${e.value}
|
|
376
|
+
.icon=${e.icon}
|
|
377
|
+
.localeId=${e.lang}
|
|
378
|
+
.toggleAriaLabel=${e.toggleAriaLabel}
|
|
379
|
+
.dayAriaLabel=${e.dayAriaLabel}
|
|
380
|
+
.monthAriaLabel=${e.monthAriaLabel}
|
|
381
|
+
.yearAriaLabel=${e.yearAriaLabel}
|
|
382
|
+
.hourAriaLabel=${e.hourAriaLabel}
|
|
383
|
+
.minuteAriaLabel=${e.minuteAriaLabel}
|
|
384
|
+
.dayPeriodAriaLabel=${e.dayPeriodAriaLabel}
|
|
385
|
+
.prevMonthIcon=${e.prevMonthIcon}
|
|
386
|
+
.nextMonthIcon=${e.nextMonthIcon}
|
|
387
|
+
.prevMonthAriaLabel=${e.prevMonthAriaLabel}
|
|
388
|
+
.nextMonthAriaLabel=${e.nextMonthAriaLabel}
|
|
389
|
+
.selectYearAriaLabel=${e.selectYearAriaLabel}
|
|
390
|
+
.yearGridAriaLabel=${e.yearGridAriaLabel}
|
|
391
|
+
.dayFormat=${e.dayFormat}
|
|
392
|
+
.weekdayFormat=${e.weekdayFormat}
|
|
393
|
+
.monthFormat=${e.monthFormat}
|
|
394
|
+
.minDate=${e.minDate}
|
|
395
|
+
.maxDate=${e.maxDate}
|
|
396
|
+
.disabledRanges=${e.disabledRanges}
|
|
397
|
+
.numberOfMonths=${e.numberOfMonths}
|
|
398
|
+
.hourFormat=${e.hourFormat}
|
|
399
|
+
.minuteStep=${e.minuteStep}
|
|
400
|
+
.minTime=${e.minTime}
|
|
401
|
+
.maxTime=${e.maxTime}
|
|
402
|
+
.disabledTimeRanges=${e.disabledTimeRanges}
|
|
403
|
+
?allow-custom-time=${e.allowCustomTime}
|
|
404
|
+
.invalidDateMessage=${e.invalidDateMessage}
|
|
405
|
+
.minDateMessage=${e.minDateMessage}
|
|
406
|
+
.maxDateMessage=${e.maxDateMessage}
|
|
407
|
+
.disabledDateRangeMessage=${e.disabledDateRangeMessage}
|
|
408
|
+
.minTimeMessage=${e.minTimeMessage}
|
|
409
|
+
.maxTimeMessage=${e.maxTimeMessage}
|
|
410
|
+
.disabledTimeRangeMessage=${e.disabledTimeRangeMessage}
|
|
411
|
+
.noAvailableTimesMessage=${e.noAvailableTimesMessage}
|
|
412
|
+
@inputError=${this.onInputError}
|
|
413
|
+
@blur=${() => this.adapter.onBlur()}
|
|
414
|
+
@change=${this.valueChanged}
|
|
415
|
+
></gui-date-time-picker>
|
|
416
|
+
`;
|
|
417
|
+
}
|
|
418
|
+
valueChanged(e) {
|
|
419
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(e.detail.value);
|
|
420
|
+
}
|
|
421
|
+
onInputError(e) {
|
|
422
|
+
this.adapter.injectValidationIssues([e.detail.message]);
|
|
423
|
+
}
|
|
424
|
+
disconnectedCallback() {
|
|
425
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
h([
|
|
429
|
+
I({ context: c }),
|
|
430
|
+
a({ attribute: !1 })
|
|
431
|
+
], p.prototype, "formContext", 2);
|
|
432
|
+
h([
|
|
433
|
+
R({ context: y })
|
|
434
|
+
], p.prototype, "adapter", 2);
|
|
435
|
+
p = h([
|
|
436
|
+
g("gui-date-time-picker-input")
|
|
437
|
+
], p);
|
|
438
|
+
export {
|
|
439
|
+
p as DateTimePickerElement
|
|
440
|
+
};
|