@golemui/gui-lit 1.0.2 → 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 +15 -0
- package/calendar-BuJgwvZx.js +254 -0
- package/{calendar.element-MubSE1bx.js → calendar.element-M5MPJmap.js} +1 -1
- package/{currency.element-BHXWcOEu.js → currency.element-CfFrAtrr.js} +20 -14
- package/{date-DTYg8sog.js → date-Bj9mI3GU.js} +106 -50
- 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-BtVJSIRk.js → date.element-Consgsbb.js} +32 -27
- package/day-status-0-hJHrI7.js +530 -0
- package/{dropdown.element-DqzC6aXR.js → dropdown.element-WsD61Qel.js} +57 -48
- package/focus-leave.controller-2gV0pQd5.js +73 -0
- package/index.js +1209 -981
- package/index.umd.cjs +1574 -519
- 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/{number.element-BhEyoOtc.js → number.element-CBr47IiY.js} +18 -16
- package/numeric-jmOOKz30.js +12 -0
- 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-QTE6vGNP.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-Dj29D_OQ.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-BoqKPRmS.js +0 -545
- package/calendar-DTYKVYc3.js +0 -96
- package/date-input-BeQvyfln.js +0 -268
- package/date-picker.element-DabW_-0-.js +0 -166
- package/range-calendar-9skwbwlB.js +0 -255
- package/range-date-input-Uy8134vi.js +0 -395
- package/range-date-picker.element-CuKIBkIO.js +0 -182
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { InputWidgetAdapter as b, formContext as y, inputContext as $ } from "@golemui/lit";
|
|
2
|
+
import { LitElement as u, html as l, nothing as v } from "lit";
|
|
3
|
+
import { property as a, query as g, customElement as c } from "lit/decorators.js";
|
|
4
|
+
import { classMap as M } from "lit/directives/class-map.js";
|
|
5
|
+
import "./date-time-input-BXxsfuyZ.js";
|
|
6
|
+
import "./date-time-calendar-BzRfkLKU.js";
|
|
7
|
+
import { G as T } from "./popup.controller-eUDxE6jD.js";
|
|
8
|
+
import { t as f, d as x, b as D } from "./date-Bj9mI3GU.js";
|
|
9
|
+
import { p as S, y as w, h as R, z as _ } from "./part-templates-Db871PS3.js";
|
|
10
|
+
import { a as I, b as C, c as A } from "./templates-Dk1jxLwS.js";
|
|
11
|
+
import { consume as E, provide as F } from "@lit/context";
|
|
12
|
+
import "rxjs";
|
|
13
|
+
var O = Object.defineProperty, k = Object.getOwnPropertyDescriptor, i = (e, s, n, r) => {
|
|
14
|
+
for (var o = r > 1 ? void 0 : r ? k(s, n) : s, d = e.length - 1, m; d >= 0; d--)
|
|
15
|
+
(m = e[d]) && (o = (r ? m(s, n, o) : m(o)) || o);
|
|
16
|
+
return r && o && O(s, n, o), o;
|
|
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.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.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 T(this, {
|
|
21
|
+
getInteriorElements: () => [this._dateRef, this._calendarRef],
|
|
22
|
+
focusRestoreSelector: "gui-date-time input",
|
|
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
|
+
});
|
|
27
|
+
}
|
|
28
|
+
createRenderRoot() {
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
const e = I("datePicker", { icon: this.icon }), s = this._popup.open ? l`<gui-date-time-calendar
|
|
33
|
+
id="calendar-input"
|
|
34
|
+
.uid=${this.uid}
|
|
35
|
+
.hint=${this.hint}
|
|
36
|
+
?touched=${this.touched}
|
|
37
|
+
?required=${this.required}
|
|
38
|
+
?disabled=${this.disabled}
|
|
39
|
+
?readonly=${this.readOnly}
|
|
40
|
+
.value=${this.value}
|
|
41
|
+
.prevMonthIcon=${this.prevMonthIcon}
|
|
42
|
+
.nextMonthIcon=${this.nextMonthIcon}
|
|
43
|
+
.prevMonthAriaLabel=${this.prevMonthAriaLabel}
|
|
44
|
+
.nextMonthAriaLabel=${this.nextMonthAriaLabel}
|
|
45
|
+
.dayFormat=${this.dayFormat}
|
|
46
|
+
.weekdayFormat=${this.weekdayFormat}
|
|
47
|
+
.monthFormat=${this.monthFormat}
|
|
48
|
+
.minDate=${this.minDate}
|
|
49
|
+
.maxDate=${this.maxDate}
|
|
50
|
+
.disabledRanges=${this.disabledRanges}
|
|
51
|
+
.numberOfMonths=${this.numberOfMonths}
|
|
52
|
+
.localeId=${this.localeId}
|
|
53
|
+
.hourFormat=${this.hourFormat}
|
|
54
|
+
.minuteStep=${this.minuteStep}
|
|
55
|
+
.minTime=${this.minTime}
|
|
56
|
+
.maxTime=${this.maxTime}
|
|
57
|
+
.disabledTimeRanges=${this.disabledTimeRanges}
|
|
58
|
+
.allowCustomTime=${this.allowCustomTime}
|
|
59
|
+
.minTimeMessage=${this.minTimeMessage}
|
|
60
|
+
.maxTimeMessage=${this.maxTimeMessage}
|
|
61
|
+
.disabledTimeRangeMessage=${this.disabledTimeRangeMessage}
|
|
62
|
+
.noAvailableTimesMessage=${this.noAvailableTimesMessage}
|
|
63
|
+
@blur=${this.onCalendarBlur}
|
|
64
|
+
@change=${this.onCalendarChange}
|
|
65
|
+
></gui-date-time-calendar>` : v;
|
|
66
|
+
return l`
|
|
67
|
+
${C(this.uid ?? "", {
|
|
68
|
+
label: this.label,
|
|
69
|
+
hint: this.hint,
|
|
70
|
+
required: this.required
|
|
71
|
+
})}
|
|
72
|
+
|
|
73
|
+
<div
|
|
74
|
+
role="button"
|
|
75
|
+
tabindex="-1"
|
|
76
|
+
class="gui-widget"
|
|
77
|
+
aria-expanded=${this._popup.open}
|
|
78
|
+
@keyup=${this._popup.onAnchorKeyUp}
|
|
79
|
+
@keydown=${this._popup.onAnchorKeyDown}
|
|
80
|
+
@click=${this._popup.onAnchorClick}
|
|
81
|
+
>
|
|
82
|
+
<gui-date-time
|
|
83
|
+
id="date-input"
|
|
84
|
+
class=${M(e.widgetClasses)}
|
|
85
|
+
.uid=${this.uid}
|
|
86
|
+
.hint=${this.hint}
|
|
87
|
+
.showErrors=${!1}
|
|
88
|
+
.errors=${this.errors}
|
|
89
|
+
?touched=${this.touched}
|
|
90
|
+
?required=${this.required}
|
|
91
|
+
?disabled=${this.disabled}
|
|
92
|
+
?readonly=${this.readOnly}
|
|
93
|
+
.value=${this.value}
|
|
94
|
+
.icon=${this.icon}
|
|
95
|
+
.localeId=${this.localeId}
|
|
96
|
+
.hourFormat=${this.hourFormat}
|
|
97
|
+
.minuteStep=${this.minuteStep}
|
|
98
|
+
.minTime=${this.minTime}
|
|
99
|
+
.maxTime=${this.maxTime}
|
|
100
|
+
.invalidDateMessage=${this.invalidDateMessage}
|
|
101
|
+
.minTimeMessage=${this.minTimeMessage}
|
|
102
|
+
.maxTimeMessage=${this.maxTimeMessage}
|
|
103
|
+
@blur=${this.onDateBlur}
|
|
104
|
+
@focus=${this._popup.show}
|
|
105
|
+
@change=${this.onDateChange}
|
|
106
|
+
></gui-date-time>
|
|
107
|
+
<span class="gui-date-time-picker__arrow"
|
|
108
|
+
><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 256">
|
|
109
|
+
<path
|
|
110
|
+
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"
|
|
111
|
+
></path></svg
|
|
112
|
+
></span>
|
|
113
|
+
|
|
114
|
+
${s}
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
${this.showErrors ? A(this.uid ?? "", { errors: this.errors, touched: this.touched }) : ""}
|
|
118
|
+
`;
|
|
119
|
+
}
|
|
120
|
+
onDateChange(e) {
|
|
121
|
+
e.stopPropagation(), this.commitValue(e.detail.value);
|
|
122
|
+
}
|
|
123
|
+
onDateBlur() {
|
|
124
|
+
this.dispatchEvent(new CustomEvent("blur"));
|
|
125
|
+
}
|
|
126
|
+
onCalendarChange(e) {
|
|
127
|
+
if (!this._popup.open) {
|
|
128
|
+
e.stopPropagation();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
e.stopPropagation(), this.commitValue(e.detail.value), e.detail.value && e.detail.commit && this._popup.close();
|
|
132
|
+
}
|
|
133
|
+
commitValue(e) {
|
|
134
|
+
this.value = e ?? void 0;
|
|
135
|
+
const s = this.validateBounds(this.value);
|
|
136
|
+
this.dispatchEvent(
|
|
137
|
+
new CustomEvent("change", {
|
|
138
|
+
detail: { value: e ?? null },
|
|
139
|
+
bubbles: !0,
|
|
140
|
+
composed: !0
|
|
141
|
+
})
|
|
142
|
+
), s && this.dispatchEvent(
|
|
143
|
+
new CustomEvent("inputError", {
|
|
144
|
+
detail: { message: s },
|
|
145
|
+
bubbles: !0,
|
|
146
|
+
composed: !0
|
|
147
|
+
})
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
validateBounds(e) {
|
|
151
|
+
if (!e) return null;
|
|
152
|
+
const s = S(e);
|
|
153
|
+
if (isNaN(s.getTime())) return null;
|
|
154
|
+
const n = f(s), r = x(n, this.minDate, this.maxDate, this.disabledRanges, {
|
|
155
|
+
minDateMessage: this.minDateMessage,
|
|
156
|
+
maxDateMessage: this.maxDateMessage,
|
|
157
|
+
disabledDateRangeMessage: this.disabledDateRangeMessage
|
|
158
|
+
});
|
|
159
|
+
if (r) return r;
|
|
160
|
+
const o = w(this.disabledTimeRanges, n);
|
|
161
|
+
return R(_(s), o) ? this.disabledTimeRangeMessage ?? D : null;
|
|
162
|
+
}
|
|
163
|
+
// The calendar's blur already bubbles up to the host, so only close here.
|
|
164
|
+
onCalendarBlur() {
|
|
165
|
+
this._popup.close();
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
i([
|
|
169
|
+
a({ type: String })
|
|
170
|
+
], t.prototype, "uid", 2);
|
|
171
|
+
i([
|
|
172
|
+
a({ type: String })
|
|
173
|
+
], t.prototype, "label", 2);
|
|
174
|
+
i([
|
|
175
|
+
a({ type: String })
|
|
176
|
+
], t.prototype, "hint", 2);
|
|
177
|
+
i([
|
|
178
|
+
a({ type: String })
|
|
179
|
+
], t.prototype, "icon", 2);
|
|
180
|
+
i([
|
|
181
|
+
a({ type: Array })
|
|
182
|
+
], t.prototype, "errors", 2);
|
|
183
|
+
i([
|
|
184
|
+
a({ type: Boolean })
|
|
185
|
+
], t.prototype, "showErrors", 2);
|
|
186
|
+
i([
|
|
187
|
+
a({ type: Boolean })
|
|
188
|
+
], t.prototype, "touched", 2);
|
|
189
|
+
i([
|
|
190
|
+
a({ type: Boolean })
|
|
191
|
+
], t.prototype, "required", 2);
|
|
192
|
+
i([
|
|
193
|
+
a({ type: Boolean })
|
|
194
|
+
], t.prototype, "disabled", 2);
|
|
195
|
+
i([
|
|
196
|
+
a({ type: Boolean, attribute: "readonly" })
|
|
197
|
+
], t.prototype, "readOnly", 2);
|
|
198
|
+
i([
|
|
199
|
+
a({ type: String, attribute: "locale-id" })
|
|
200
|
+
], t.prototype, "localeId", 2);
|
|
201
|
+
i([
|
|
202
|
+
a({ type: String })
|
|
203
|
+
], t.prototype, "value", 2);
|
|
204
|
+
i([
|
|
205
|
+
a({ type: String, attribute: "prev-month-icon" })
|
|
206
|
+
], t.prototype, "prevMonthIcon", 2);
|
|
207
|
+
i([
|
|
208
|
+
a({ type: String, attribute: "next-month-icon" })
|
|
209
|
+
], t.prototype, "nextMonthIcon", 2);
|
|
210
|
+
i([
|
|
211
|
+
a({ type: String, attribute: "prev-month-aria-label" })
|
|
212
|
+
], t.prototype, "prevMonthAriaLabel", 2);
|
|
213
|
+
i([
|
|
214
|
+
a({ type: String, attribute: "next-month-aria-label" })
|
|
215
|
+
], t.prototype, "nextMonthAriaLabel", 2);
|
|
216
|
+
i([
|
|
217
|
+
a({ type: String, attribute: "day-format" })
|
|
218
|
+
], t.prototype, "dayFormat", 2);
|
|
219
|
+
i([
|
|
220
|
+
a({ type: String, attribute: "weekday-format" })
|
|
221
|
+
], t.prototype, "weekdayFormat", 2);
|
|
222
|
+
i([
|
|
223
|
+
a({ type: String, attribute: "month-format" })
|
|
224
|
+
], t.prototype, "monthFormat", 2);
|
|
225
|
+
i([
|
|
226
|
+
a({ type: String, attribute: "min-date" })
|
|
227
|
+
], t.prototype, "minDate", 2);
|
|
228
|
+
i([
|
|
229
|
+
a({ type: String, attribute: "max-date" })
|
|
230
|
+
], t.prototype, "maxDate", 2);
|
|
231
|
+
i([
|
|
232
|
+
a({ type: Array, attribute: "disabled-ranges" })
|
|
233
|
+
], t.prototype, "disabledRanges", 2);
|
|
234
|
+
i([
|
|
235
|
+
a({ type: Number, attribute: "number-of-months" })
|
|
236
|
+
], t.prototype, "numberOfMonths", 2);
|
|
237
|
+
i([
|
|
238
|
+
a({ type: String, attribute: "hour-format" })
|
|
239
|
+
], t.prototype, "hourFormat", 2);
|
|
240
|
+
i([
|
|
241
|
+
a({ type: Number, attribute: "minute-step" })
|
|
242
|
+
], t.prototype, "minuteStep", 2);
|
|
243
|
+
i([
|
|
244
|
+
a({ type: String, attribute: "min-time" })
|
|
245
|
+
], t.prototype, "minTime", 2);
|
|
246
|
+
i([
|
|
247
|
+
a({ type: String, attribute: "max-time" })
|
|
248
|
+
], t.prototype, "maxTime", 2);
|
|
249
|
+
i([
|
|
250
|
+
a({ type: Array, attribute: "disabled-time-ranges" })
|
|
251
|
+
], t.prototype, "disabledTimeRanges", 2);
|
|
252
|
+
i([
|
|
253
|
+
a({ type: Boolean, attribute: "allow-custom-time" })
|
|
254
|
+
], t.prototype, "allowCustomTime", 2);
|
|
255
|
+
i([
|
|
256
|
+
a({ type: String, attribute: "invalid-date-message" })
|
|
257
|
+
], t.prototype, "invalidDateMessage", 2);
|
|
258
|
+
i([
|
|
259
|
+
a({ type: String, attribute: "min-date-message" })
|
|
260
|
+
], t.prototype, "minDateMessage", 2);
|
|
261
|
+
i([
|
|
262
|
+
a({ type: String, attribute: "max-date-message" })
|
|
263
|
+
], t.prototype, "maxDateMessage", 2);
|
|
264
|
+
i([
|
|
265
|
+
a({ type: String, attribute: "disabled-date-range-message" })
|
|
266
|
+
], t.prototype, "disabledDateRangeMessage", 2);
|
|
267
|
+
i([
|
|
268
|
+
a({ type: String, attribute: "min-time-message" })
|
|
269
|
+
], t.prototype, "minTimeMessage", 2);
|
|
270
|
+
i([
|
|
271
|
+
a({ type: String, attribute: "max-time-message" })
|
|
272
|
+
], t.prototype, "maxTimeMessage", 2);
|
|
273
|
+
i([
|
|
274
|
+
a({ type: String, attribute: "disabled-time-range-message" })
|
|
275
|
+
], t.prototype, "disabledTimeRangeMessage", 2);
|
|
276
|
+
i([
|
|
277
|
+
a({ type: String, attribute: "no-available-times-message" })
|
|
278
|
+
], t.prototype, "noAvailableTimesMessage", 2);
|
|
279
|
+
i([
|
|
280
|
+
g("#date-input")
|
|
281
|
+
], t.prototype, "_dateRef", 2);
|
|
282
|
+
i([
|
|
283
|
+
g("#calendar-input")
|
|
284
|
+
], t.prototype, "_calendarRef", 2);
|
|
285
|
+
t = i([
|
|
286
|
+
c("gui-date-time-picker")
|
|
287
|
+
], t);
|
|
288
|
+
typeof customElements < "u" && !customElements.get("gui-date-time-picker") && customElements.define("gui-date-time-picker", t);
|
|
289
|
+
var L = Object.defineProperty, P = Object.getOwnPropertyDescriptor, h = (e, s, n, r) => {
|
|
290
|
+
for (var o = r > 1 ? void 0 : r ? P(s, n) : s, d = e.length - 1, m; d >= 0; d--)
|
|
291
|
+
(m = e[d]) && (o = (r ? m(s, n, o) : m(o)) || o);
|
|
292
|
+
return r && o && L(s, n, o), o;
|
|
293
|
+
};
|
|
294
|
+
let p = class extends u {
|
|
295
|
+
constructor() {
|
|
296
|
+
super(...arguments), this.adapter = new b(), this.subscriptions = [];
|
|
297
|
+
}
|
|
298
|
+
createRenderRoot() {
|
|
299
|
+
return this;
|
|
300
|
+
}
|
|
301
|
+
updated(e) {
|
|
302
|
+
super.updated(e);
|
|
303
|
+
const s = this.adapter.templateData.size;
|
|
304
|
+
s ? this.style.flex = String(s) : this.style.removeProperty("flex");
|
|
305
|
+
}
|
|
306
|
+
connectedCallback() {
|
|
307
|
+
super.connectedCallback(), this.classList.add("gui-date-time-picker", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
308
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
render() {
|
|
312
|
+
super.render();
|
|
313
|
+
const e = this.adapter.templateData;
|
|
314
|
+
return l`
|
|
315
|
+
<gui-date-time-picker
|
|
316
|
+
.uid=${this.widget.uid}
|
|
317
|
+
.label=${e.label}
|
|
318
|
+
.hint=${e.hint}
|
|
319
|
+
.errors=${e.errors}
|
|
320
|
+
?touched=${e.touched}
|
|
321
|
+
?required=${e.validator?.required}
|
|
322
|
+
?disabled=${e.disabled}
|
|
323
|
+
?readonly=${e.readonly}
|
|
324
|
+
.value=${e.value}
|
|
325
|
+
.icon=${e.icon}
|
|
326
|
+
.localeId=${e.lang}
|
|
327
|
+
.prevMonthIcon=${e.prevMonthIcon}
|
|
328
|
+
.nextMonthIcon=${e.nextMonthIcon}
|
|
329
|
+
.prevMonthAriaLabel=${e.prevMonthAriaLabel}
|
|
330
|
+
.nextMonthAriaLabel=${e.nextMonthAriaLabel}
|
|
331
|
+
.dayFormat=${e.dayFormat}
|
|
332
|
+
.weekdayFormat=${e.weekdayFormat}
|
|
333
|
+
.monthFormat=${e.monthFormat}
|
|
334
|
+
.minDate=${e.minDate}
|
|
335
|
+
.maxDate=${e.maxDate}
|
|
336
|
+
.disabledRanges=${e.disabledRanges}
|
|
337
|
+
.numberOfMonths=${e.numberOfMonths}
|
|
338
|
+
.hourFormat=${e.hourFormat}
|
|
339
|
+
.minuteStep=${e.minuteStep}
|
|
340
|
+
.minTime=${e.minTime}
|
|
341
|
+
.maxTime=${e.maxTime}
|
|
342
|
+
.disabledTimeRanges=${e.disabledTimeRanges}
|
|
343
|
+
?allow-custom-time=${e.allowCustomTime}
|
|
344
|
+
.invalidDateMessage=${e.invalidDateMessage}
|
|
345
|
+
.minDateMessage=${e.minDateMessage}
|
|
346
|
+
.maxDateMessage=${e.maxDateMessage}
|
|
347
|
+
.disabledDateRangeMessage=${e.disabledDateRangeMessage}
|
|
348
|
+
.minTimeMessage=${e.minTimeMessage}
|
|
349
|
+
.maxTimeMessage=${e.maxTimeMessage}
|
|
350
|
+
.disabledTimeRangeMessage=${e.disabledTimeRangeMessage}
|
|
351
|
+
.noAvailableTimesMessage=${e.noAvailableTimesMessage}
|
|
352
|
+
@inputError=${this.onInputError}
|
|
353
|
+
@blur=${() => this.adapter.onBlur()}
|
|
354
|
+
@change=${this.valueChanged}
|
|
355
|
+
></gui-date-time-picker>
|
|
356
|
+
`;
|
|
357
|
+
}
|
|
358
|
+
valueChanged(e) {
|
|
359
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(e.detail.value);
|
|
360
|
+
}
|
|
361
|
+
onInputError(e) {
|
|
362
|
+
this.adapter.injectValidationIssues([e.detail.message]);
|
|
363
|
+
}
|
|
364
|
+
disconnectedCallback() {
|
|
365
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
h([
|
|
369
|
+
E({ context: y }),
|
|
370
|
+
a({ attribute: !1 })
|
|
371
|
+
], p.prototype, "formContext", 2);
|
|
372
|
+
h([
|
|
373
|
+
F({ context: $ })
|
|
374
|
+
], p.prototype, "adapter", 2);
|
|
375
|
+
p = h([
|
|
376
|
+
c("gui-date-time-picker-input")
|
|
377
|
+
], p);
|
|
378
|
+
export {
|
|
379
|
+
p as DateTimePickerElement
|
|
380
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { InputWidgetAdapter as l, formContext as n, inputContext as o } from "@golemui/lit";
|
|
2
|
+
import { a as h } from "./templates-Dk1jxLwS.js";
|
|
3
|
+
import "./date-time-input-BXxsfuyZ.js";
|
|
4
|
+
import { consume as u, provide as c } from "@lit/context";
|
|
5
|
+
import { LitElement as D, html as g } from "lit";
|
|
6
|
+
import { property as $, customElement as f } from "lit/decorators.js";
|
|
7
|
+
import "rxjs";
|
|
8
|
+
import { classMap as b } from "lit/directives/class-map.js";
|
|
9
|
+
var x = Object.defineProperty, v = Object.getOwnPropertyDescriptor, m = (t, e, r, i) => {
|
|
10
|
+
for (var a = i > 1 ? void 0 : i ? v(e, r) : e, p = t.length - 1, d; p >= 0; p--)
|
|
11
|
+
(d = t[p]) && (a = (i ? d(e, r, a) : d(a)) || a);
|
|
12
|
+
return i && a && x(e, r, a), a;
|
|
13
|
+
};
|
|
14
|
+
let s = class extends D {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments), this.adapter = new l(), this.subscriptions = [];
|
|
17
|
+
}
|
|
18
|
+
createRenderRoot() {
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
updated(t) {
|
|
22
|
+
super.updated(t);
|
|
23
|
+
const e = this.adapter.templateData.size;
|
|
24
|
+
e ? this.style.flex = String(e) : this.style.removeProperty("flex");
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
super.connectedCallback(), this.classList.add("gui-date-time", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
28
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
super.render();
|
|
33
|
+
const t = h("date-time", this.adapter.templateData);
|
|
34
|
+
return g`
|
|
35
|
+
<gui-date-time
|
|
36
|
+
class=${b(t.widgetClasses)}
|
|
37
|
+
.uid=${this.widget.uid}
|
|
38
|
+
.label=${this.adapter.templateData.label}
|
|
39
|
+
.hint=${this.adapter.templateData.hint}
|
|
40
|
+
.errors=${this.adapter.templateData.errors}
|
|
41
|
+
?touched=${this.adapter.templateData.touched}
|
|
42
|
+
?required=${this.adapter.templateData.validator?.required}
|
|
43
|
+
?disabled=${this.adapter.templateData.disabled}
|
|
44
|
+
?readonly=${this.adapter.templateData.readonly}
|
|
45
|
+
.value=${this.adapter.templateData.value}
|
|
46
|
+
.icon=${this.adapter.templateData.icon}
|
|
47
|
+
.localeId=${this.adapter.templateData.lang}
|
|
48
|
+
.invalidDateMessage=${this.adapter.templateData.invalidDateMessage}
|
|
49
|
+
.minDate=${this.adapter.templateData.minDate}
|
|
50
|
+
.maxDate=${this.adapter.templateData.maxDate}
|
|
51
|
+
.minTime=${this.adapter.templateData.minTime}
|
|
52
|
+
.maxTime=${this.adapter.templateData.maxTime}
|
|
53
|
+
.minDateMessage=${this.adapter.templateData.minDateMessage}
|
|
54
|
+
.maxDateMessage=${this.adapter.templateData.maxDateMessage}
|
|
55
|
+
.minTimeMessage=${this.adapter.templateData.minTimeMessage}
|
|
56
|
+
.maxTimeMessage=${this.adapter.templateData.maxTimeMessage}
|
|
57
|
+
.hourFormat=${this.adapter.templateData.hourFormat}
|
|
58
|
+
.minuteStep=${this.adapter.templateData.minuteStep}
|
|
59
|
+
@inputError=${this.onInputError}
|
|
60
|
+
@blur=${() => this.adapter.onBlur()}
|
|
61
|
+
@change=${this.valueChanged}
|
|
62
|
+
></gui-date-time>
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
valueChanged(t) {
|
|
66
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(t.detail.value);
|
|
67
|
+
}
|
|
68
|
+
onInputError(t) {
|
|
69
|
+
this.adapter.injectValidationIssues([t.detail.message]);
|
|
70
|
+
}
|
|
71
|
+
disconnectedCallback() {
|
|
72
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
m([
|
|
76
|
+
u({ context: n }),
|
|
77
|
+
$({ attribute: !1 })
|
|
78
|
+
], s.prototype, "formContext", 2);
|
|
79
|
+
m([
|
|
80
|
+
c({ context: o })
|
|
81
|
+
], s.prototype, "adapter", 2);
|
|
82
|
+
s = m([
|
|
83
|
+
f("gui-date-time-input")
|
|
84
|
+
], s);
|
|
85
|
+
export {
|
|
86
|
+
s as DateTimeElement
|
|
87
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { InputWidgetAdapter as
|
|
2
|
-
import { a as
|
|
3
|
-
import "./date-input-
|
|
4
|
-
import { consume as
|
|
5
|
-
import { LitElement as
|
|
6
|
-
import { property as
|
|
1
|
+
import { InputWidgetAdapter as n, formContext as o, inputContext as h } from "@golemui/lit";
|
|
2
|
+
import { a as m } from "./templates-Dk1jxLwS.js";
|
|
3
|
+
import "./date-input-cJDkNnVw.js";
|
|
4
|
+
import { consume as u, provide as c } from "@lit/context";
|
|
5
|
+
import { LitElement as D, html as g } from "lit";
|
|
6
|
+
import { property as $, customElement as f } from "lit/decorators.js";
|
|
7
7
|
import "rxjs";
|
|
8
|
-
import { classMap as
|
|
9
|
-
var v = Object.defineProperty,
|
|
10
|
-
for (var a =
|
|
11
|
-
(d = t[p]) && (a = (
|
|
12
|
-
return
|
|
8
|
+
import { classMap as b } from "lit/directives/class-map.js";
|
|
9
|
+
var v = Object.defineProperty, x = Object.getOwnPropertyDescriptor, l = (t, e, i, s) => {
|
|
10
|
+
for (var a = s > 1 ? void 0 : s ? x(e, i) : e, p = t.length - 1, d; p >= 0; p--)
|
|
11
|
+
(d = t[p]) && (a = (s ? d(e, i, a) : d(a)) || a);
|
|
12
|
+
return s && a && v(e, i, a), a;
|
|
13
13
|
};
|
|
14
|
-
let
|
|
14
|
+
let r = class extends D {
|
|
15
15
|
constructor() {
|
|
16
|
-
super(...arguments), this.adapter = new
|
|
16
|
+
super(...arguments), this.adapter = new n(), this.subscriptions = [];
|
|
17
17
|
}
|
|
18
18
|
createRenderRoot() {
|
|
19
19
|
return this;
|
|
@@ -30,10 +30,10 @@ let s = class extends f {
|
|
|
30
30
|
}
|
|
31
31
|
render() {
|
|
32
32
|
super.render();
|
|
33
|
-
const t =
|
|
34
|
-
return
|
|
33
|
+
const t = m("date", this.adapter.templateData);
|
|
34
|
+
return g`
|
|
35
35
|
<gui-date
|
|
36
|
-
class=${
|
|
36
|
+
class=${b(t.widgetClasses)}
|
|
37
37
|
.uid=${this.widget.uid}
|
|
38
38
|
.label=${this.adapter.templateData.label}
|
|
39
39
|
.hint=${this.adapter.templateData.hint}
|
|
@@ -45,6 +45,11 @@ let s = class extends f {
|
|
|
45
45
|
.value=${this.adapter.templateData.value}
|
|
46
46
|
.icon=${this.adapter.templateData.icon}
|
|
47
47
|
.localeId=${this.adapter.templateData.lang}
|
|
48
|
+
.invalidDateMessage=${this.adapter.templateData.invalidDateMessage}
|
|
49
|
+
.minDate=${this.adapter.templateData.minDate}
|
|
50
|
+
.maxDate=${this.adapter.templateData.maxDate}
|
|
51
|
+
.minDateMessage=${this.adapter.templateData.minDateMessage}
|
|
52
|
+
.maxDateMessage=${this.adapter.templateData.maxDateMessage}
|
|
48
53
|
@inputError=${this.onInputError}
|
|
49
54
|
@blur=${() => this.adapter.onBlur()}
|
|
50
55
|
@change=${this.valueChanged}
|
|
@@ -61,16 +66,16 @@ let s = class extends f {
|
|
|
61
66
|
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
|
|
62
67
|
}
|
|
63
68
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
],
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
],
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
],
|
|
69
|
+
l([
|
|
70
|
+
u({ context: o }),
|
|
71
|
+
$({ attribute: !1 })
|
|
72
|
+
], r.prototype, "formContext", 2);
|
|
73
|
+
l([
|
|
74
|
+
c({ context: h })
|
|
75
|
+
], r.prototype, "adapter", 2);
|
|
76
|
+
r = l([
|
|
77
|
+
f("gui-date-input")
|
|
78
|
+
], r);
|
|
74
79
|
export {
|
|
75
|
-
|
|
80
|
+
r as DateElement
|
|
76
81
|
};
|