@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,412 @@
|
|
|
1
|
+
import { InputWidgetAdapter as g, formContext as y, inputContext as $ } from "@golemui/lit";
|
|
2
|
+
import { LitElement as m, html as h, nothing as v } from "lit";
|
|
3
|
+
import { property as i, query as b, state as D, customElement as c } from "lit/decorators.js";
|
|
4
|
+
import { classMap as T } from "lit/directives/class-map.js";
|
|
5
|
+
import "./range-date-time-input-B37TUoM3.js";
|
|
6
|
+
import "./range-date-time-calendar-yksWrR7b.js";
|
|
7
|
+
import { G as f } from "./popup.controller-eUDxE6jD.js";
|
|
8
|
+
import { a as M, b as L, c as A } from "./templates-Dk1jxLwS.js";
|
|
9
|
+
import { consume as C, provide as w } from "@lit/context";
|
|
10
|
+
import "rxjs";
|
|
11
|
+
var x = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, a = (e, r, n, s) => {
|
|
12
|
+
for (var o = s > 1 ? void 0 : s ? _(r, n) : r, l = e.length - 1, d; l >= 0; l--)
|
|
13
|
+
(d = e[l]) && (o = (s ? d(r, n, o) : d(o)) || o);
|
|
14
|
+
return s && o && x(r, n, o), o;
|
|
15
|
+
};
|
|
16
|
+
let t = class extends m {
|
|
17
|
+
constructor() {
|
|
18
|
+
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 = [], this.separator = void 0, this.removePillAriaLabel = void 0, this.startDateTimeAriaLabel = void 0, this.endDateTimeAriaLabel = void 0, this.invalidDateMessage = 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.numberOfMonths = void 0, this.hourFormat = void 0, this.minuteStep = void 0, this.allowCustomTime = !1, this.startTimeLabel = void 0, this.endTimeLabel = void 0, this.minDateTime = void 0, this.maxDateTime = void 0, this.minDateTimeMessage = void 0, this.maxDateTimeMessage = void 0, this.disabledRanges = void 0, this.disabledRangeMessage = void 0, this.noAvailableTimesMessage = void 0, this.dayCountAriaLabel = void 0, this.disabledDayCountAriaLabel = void 0, this._focusDate = void 0, this._popup = new f(this, {
|
|
19
|
+
getInteriorElements: () => [this._dateRef, this._calendarRef],
|
|
20
|
+
focusRestoreSelector: "gui-range-date-time input",
|
|
21
|
+
isDisabled: () => !!this.disabled,
|
|
22
|
+
clickIntent: (e) => e.closest(".gui-calendar__day-button") || e.closest(".gui-time-list__option") || e.closest("gui-time-picker") ? "ignore" : e.closest(".gui-range-date-time-input__field") || e.closest("gui-range-date-time-calendar") ? "open" : "toggle",
|
|
23
|
+
keyToggleMode: "openClose",
|
|
24
|
+
beforeOpen: (e) => {
|
|
25
|
+
this.querySelector(".gui-pills__dropdown") && e.suppressNextFocusOut(), this.closePillsDropdown();
|
|
26
|
+
},
|
|
27
|
+
onOpenChanged: (e) => {
|
|
28
|
+
e || (this._focusDate = void 0);
|
|
29
|
+
}
|
|
30
|
+
}), this.onDropdownToggle = (e) => {
|
|
31
|
+
e.detail?.open && this._popup.open && this._popup.close();
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
createRenderRoot() {
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
connectedCallback() {
|
|
38
|
+
super.connectedCallback(), this.addEventListener("dropdowntoggle", this.onDropdownToggle);
|
|
39
|
+
}
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
super.disconnectedCallback(), this.removeEventListener("dropdowntoggle", this.onDropdownToggle);
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
const e = M("datePicker", { icon: this.icon }), r = this._popup.open ? h`<gui-range-date-time-calendar
|
|
45
|
+
id="calendar-input"
|
|
46
|
+
.uid=${this.uid}
|
|
47
|
+
.hint=${this.hint}
|
|
48
|
+
?touched=${this.touched}
|
|
49
|
+
?required=${this.required}
|
|
50
|
+
?disabled=${this.disabled}
|
|
51
|
+
?readonly=${this.readOnly}
|
|
52
|
+
.value=${this.value}
|
|
53
|
+
.focusDate=${this._focusDate}
|
|
54
|
+
.hidePills=${!0}
|
|
55
|
+
.localeId=${this.localeId}
|
|
56
|
+
.prevMonthIcon=${this.prevMonthIcon}
|
|
57
|
+
.nextMonthIcon=${this.nextMonthIcon}
|
|
58
|
+
.prevMonthAriaLabel=${this.prevMonthAriaLabel}
|
|
59
|
+
.nextMonthAriaLabel=${this.nextMonthAriaLabel}
|
|
60
|
+
.dayFormat=${this.dayFormat}
|
|
61
|
+
.weekdayFormat=${this.weekdayFormat}
|
|
62
|
+
.monthFormat=${this.monthFormat}
|
|
63
|
+
.numberOfMonths=${this.numberOfMonths}
|
|
64
|
+
.hourFormat=${this.hourFormat}
|
|
65
|
+
.minuteStep=${this.minuteStep}
|
|
66
|
+
.allowCustomTime=${this.allowCustomTime}
|
|
67
|
+
.startTimeLabel=${this.startTimeLabel}
|
|
68
|
+
.endTimeLabel=${this.endTimeLabel}
|
|
69
|
+
.minDateTime=${this.minDateTime}
|
|
70
|
+
.maxDateTime=${this.maxDateTime}
|
|
71
|
+
.minDateTimeMessage=${this.minDateTimeMessage}
|
|
72
|
+
.maxDateTimeMessage=${this.maxDateTimeMessage}
|
|
73
|
+
.disabledRanges=${this.disabledRanges}
|
|
74
|
+
.disabledRangeMessage=${this.disabledRangeMessage}
|
|
75
|
+
.noAvailableTimesMessage=${this.noAvailableTimesMessage}
|
|
76
|
+
.dayCountAriaLabel=${this.dayCountAriaLabel}
|
|
77
|
+
.disabledDayCountAriaLabel=${this.disabledDayCountAriaLabel}
|
|
78
|
+
@blur=${this.onCalendarBlur}
|
|
79
|
+
@change=${this.onCalendarChange}
|
|
80
|
+
@inputError=${this.onCalendarInputError}
|
|
81
|
+
></gui-range-date-time-calendar>` : v;
|
|
82
|
+
return h`
|
|
83
|
+
${L(this.uid ?? "", {
|
|
84
|
+
label: this.label,
|
|
85
|
+
hint: this.hint,
|
|
86
|
+
required: this.required
|
|
87
|
+
})}
|
|
88
|
+
|
|
89
|
+
<div
|
|
90
|
+
role="button"
|
|
91
|
+
tabindex="-1"
|
|
92
|
+
class="gui-widget"
|
|
93
|
+
aria-expanded=${this._popup.open}
|
|
94
|
+
@keyup=${this._popup.onAnchorKeyUp}
|
|
95
|
+
@keydown=${this._popup.onAnchorKeyDown}
|
|
96
|
+
@click=${this._popup.onAnchorClick}
|
|
97
|
+
>
|
|
98
|
+
<gui-range-date-time
|
|
99
|
+
id="date-input"
|
|
100
|
+
class=${T(e.widgetClasses)}
|
|
101
|
+
.uid=${this.uid}
|
|
102
|
+
.hint=${this.hint}
|
|
103
|
+
.showErrors=${!1}
|
|
104
|
+
.errors=${this.errors}
|
|
105
|
+
?touched=${this.touched}
|
|
106
|
+
?required=${this.required}
|
|
107
|
+
?disabled=${this.disabled}
|
|
108
|
+
?readonly=${this.readOnly}
|
|
109
|
+
.value=${this.value}
|
|
110
|
+
.icon=${this.icon}
|
|
111
|
+
.localeId=${this.localeId}
|
|
112
|
+
.hourFormat=${this.hourFormat}
|
|
113
|
+
.minuteStep=${this.minuteStep}
|
|
114
|
+
.separator=${this.separator}
|
|
115
|
+
.removePillAriaLabel=${this.removePillAriaLabel}
|
|
116
|
+
.startDateTimeAriaLabel=${this.startDateTimeAriaLabel}
|
|
117
|
+
.endDateTimeAriaLabel=${this.endDateTimeAriaLabel}
|
|
118
|
+
.invalidDateMessage=${this.invalidDateMessage}
|
|
119
|
+
.minDateTime=${this.minDateTime}
|
|
120
|
+
.maxDateTime=${this.maxDateTime}
|
|
121
|
+
.minDateTimeMessage=${this.minDateTimeMessage}
|
|
122
|
+
.maxDateTimeMessage=${this.maxDateTimeMessage}
|
|
123
|
+
.disabledRanges=${this.disabledRanges}
|
|
124
|
+
.disabledRangeMessage=${this.disabledRangeMessage}
|
|
125
|
+
@blur=${this.onDateBlur}
|
|
126
|
+
@focus=${this._popup.show}
|
|
127
|
+
@change=${this.onDateChange}
|
|
128
|
+
@pillClick=${this.onPillClick}
|
|
129
|
+
></gui-range-date-time>
|
|
130
|
+
<span class="gui-range-date-time-picker__arrow"
|
|
131
|
+
><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 256">
|
|
132
|
+
<path
|
|
133
|
+
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"
|
|
134
|
+
></path></svg
|
|
135
|
+
></span>
|
|
136
|
+
|
|
137
|
+
${r}
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
${this.showErrors ? A(this.uid ?? "", { errors: this.errors, touched: this.touched }) : ""}
|
|
141
|
+
`;
|
|
142
|
+
}
|
|
143
|
+
onDateChange(e) {
|
|
144
|
+
e.stopPropagation(), this.commitValue(e.detail.value);
|
|
145
|
+
}
|
|
146
|
+
onDateBlur() {
|
|
147
|
+
this.dispatchEvent(new CustomEvent("blur"));
|
|
148
|
+
}
|
|
149
|
+
onCalendarChange(e) {
|
|
150
|
+
if (!this._popup.open) {
|
|
151
|
+
e.stopPropagation();
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
e.stopPropagation(), this.commitValue(e.detail.value), this._popup.suppressNextFocusOut(), requestAnimationFrame(() => {
|
|
155
|
+
if (!this._popup.open) return;
|
|
156
|
+
this.querySelector(
|
|
157
|
+
'gui-range-date-time-calendar .gui-calendar__day-button[tabindex="0"]'
|
|
158
|
+
)?.focus();
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
onCalendarInputError(e) {
|
|
162
|
+
e.stopPropagation(), this.dispatchEvent(
|
|
163
|
+
new CustomEvent("inputError", {
|
|
164
|
+
detail: e.detail,
|
|
165
|
+
bubbles: !0,
|
|
166
|
+
composed: !0
|
|
167
|
+
})
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
commitValue(e) {
|
|
171
|
+
this.value = e ?? void 0, this.dispatchEvent(
|
|
172
|
+
new CustomEvent("change", {
|
|
173
|
+
detail: { value: e ?? null },
|
|
174
|
+
bubbles: !0,
|
|
175
|
+
composed: !0
|
|
176
|
+
})
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
onCalendarBlur() {
|
|
180
|
+
this._popup.close();
|
|
181
|
+
}
|
|
182
|
+
onPillClick(e) {
|
|
183
|
+
this._focusDate = e.detail.range.start, this._popup.show();
|
|
184
|
+
}
|
|
185
|
+
closePillsDropdown() {
|
|
186
|
+
this.querySelector("gui-pills")?.closeDropdown?.();
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
a([
|
|
190
|
+
i({ type: String })
|
|
191
|
+
], t.prototype, "uid", 2);
|
|
192
|
+
a([
|
|
193
|
+
i({ type: String })
|
|
194
|
+
], t.prototype, "label", 2);
|
|
195
|
+
a([
|
|
196
|
+
i({ type: String })
|
|
197
|
+
], t.prototype, "hint", 2);
|
|
198
|
+
a([
|
|
199
|
+
i({ type: String })
|
|
200
|
+
], t.prototype, "icon", 2);
|
|
201
|
+
a([
|
|
202
|
+
i({ type: Array })
|
|
203
|
+
], t.prototype, "errors", 2);
|
|
204
|
+
a([
|
|
205
|
+
i({ type: Boolean })
|
|
206
|
+
], t.prototype, "showErrors", 2);
|
|
207
|
+
a([
|
|
208
|
+
i({ type: Boolean })
|
|
209
|
+
], t.prototype, "touched", 2);
|
|
210
|
+
a([
|
|
211
|
+
i({ type: Boolean })
|
|
212
|
+
], t.prototype, "required", 2);
|
|
213
|
+
a([
|
|
214
|
+
i({ type: Boolean })
|
|
215
|
+
], t.prototype, "disabled", 2);
|
|
216
|
+
a([
|
|
217
|
+
i({ type: Boolean, attribute: "readonly" })
|
|
218
|
+
], t.prototype, "readOnly", 2);
|
|
219
|
+
a([
|
|
220
|
+
i({ type: String, attribute: "locale-id" })
|
|
221
|
+
], t.prototype, "localeId", 2);
|
|
222
|
+
a([
|
|
223
|
+
i({ type: Array })
|
|
224
|
+
], t.prototype, "value", 2);
|
|
225
|
+
a([
|
|
226
|
+
i({ type: String })
|
|
227
|
+
], t.prototype, "separator", 2);
|
|
228
|
+
a([
|
|
229
|
+
i({ type: String, attribute: "remove-pill-aria-label" })
|
|
230
|
+
], t.prototype, "removePillAriaLabel", 2);
|
|
231
|
+
a([
|
|
232
|
+
i({ type: String, attribute: "start-date-time-aria-label" })
|
|
233
|
+
], t.prototype, "startDateTimeAriaLabel", 2);
|
|
234
|
+
a([
|
|
235
|
+
i({ type: String, attribute: "end-date-time-aria-label" })
|
|
236
|
+
], t.prototype, "endDateTimeAriaLabel", 2);
|
|
237
|
+
a([
|
|
238
|
+
i({ type: String, attribute: "invalid-date-message" })
|
|
239
|
+
], t.prototype, "invalidDateMessage", 2);
|
|
240
|
+
a([
|
|
241
|
+
i({ type: String, attribute: "prev-month-icon" })
|
|
242
|
+
], t.prototype, "prevMonthIcon", 2);
|
|
243
|
+
a([
|
|
244
|
+
i({ type: String, attribute: "next-month-icon" })
|
|
245
|
+
], t.prototype, "nextMonthIcon", 2);
|
|
246
|
+
a([
|
|
247
|
+
i({ type: String, attribute: "prev-month-aria-label" })
|
|
248
|
+
], t.prototype, "prevMonthAriaLabel", 2);
|
|
249
|
+
a([
|
|
250
|
+
i({ type: String, attribute: "next-month-aria-label" })
|
|
251
|
+
], t.prototype, "nextMonthAriaLabel", 2);
|
|
252
|
+
a([
|
|
253
|
+
i({ type: String, attribute: "day-format" })
|
|
254
|
+
], t.prototype, "dayFormat", 2);
|
|
255
|
+
a([
|
|
256
|
+
i({ type: String, attribute: "weekday-format" })
|
|
257
|
+
], t.prototype, "weekdayFormat", 2);
|
|
258
|
+
a([
|
|
259
|
+
i({ type: String, attribute: "month-format" })
|
|
260
|
+
], t.prototype, "monthFormat", 2);
|
|
261
|
+
a([
|
|
262
|
+
i({ type: Number, attribute: "number-of-months" })
|
|
263
|
+
], t.prototype, "numberOfMonths", 2);
|
|
264
|
+
a([
|
|
265
|
+
i({ type: String, attribute: "hour-format" })
|
|
266
|
+
], t.prototype, "hourFormat", 2);
|
|
267
|
+
a([
|
|
268
|
+
i({ type: Number, attribute: "minute-step" })
|
|
269
|
+
], t.prototype, "minuteStep", 2);
|
|
270
|
+
a([
|
|
271
|
+
i({ type: Boolean, attribute: "allow-custom-time" })
|
|
272
|
+
], t.prototype, "allowCustomTime", 2);
|
|
273
|
+
a([
|
|
274
|
+
i({ type: String, attribute: "start-time-label" })
|
|
275
|
+
], t.prototype, "startTimeLabel", 2);
|
|
276
|
+
a([
|
|
277
|
+
i({ type: String, attribute: "end-time-label" })
|
|
278
|
+
], t.prototype, "endTimeLabel", 2);
|
|
279
|
+
a([
|
|
280
|
+
i({ type: String, attribute: "min-date-time" })
|
|
281
|
+
], t.prototype, "minDateTime", 2);
|
|
282
|
+
a([
|
|
283
|
+
i({ type: String, attribute: "max-date-time" })
|
|
284
|
+
], t.prototype, "maxDateTime", 2);
|
|
285
|
+
a([
|
|
286
|
+
i({ type: String, attribute: "min-date-time-message" })
|
|
287
|
+
], t.prototype, "minDateTimeMessage", 2);
|
|
288
|
+
a([
|
|
289
|
+
i({ type: String, attribute: "max-date-time-message" })
|
|
290
|
+
], t.prototype, "maxDateTimeMessage", 2);
|
|
291
|
+
a([
|
|
292
|
+
i({ type: Array, attribute: "disabled-ranges" })
|
|
293
|
+
], t.prototype, "disabledRanges", 2);
|
|
294
|
+
a([
|
|
295
|
+
i({ type: String, attribute: "disabled-range-message" })
|
|
296
|
+
], t.prototype, "disabledRangeMessage", 2);
|
|
297
|
+
a([
|
|
298
|
+
i({ type: String, attribute: "no-available-times-message" })
|
|
299
|
+
], t.prototype, "noAvailableTimesMessage", 2);
|
|
300
|
+
a([
|
|
301
|
+
i({ type: String, attribute: "day-count-aria-label" })
|
|
302
|
+
], t.prototype, "dayCountAriaLabel", 2);
|
|
303
|
+
a([
|
|
304
|
+
i({ type: String, attribute: "disabled-day-count-aria-label" })
|
|
305
|
+
], t.prototype, "disabledDayCountAriaLabel", 2);
|
|
306
|
+
a([
|
|
307
|
+
b("#date-input")
|
|
308
|
+
], t.prototype, "_dateRef", 2);
|
|
309
|
+
a([
|
|
310
|
+
b("#calendar-input")
|
|
311
|
+
], t.prototype, "_calendarRef", 2);
|
|
312
|
+
a([
|
|
313
|
+
D()
|
|
314
|
+
], t.prototype, "_focusDate", 2);
|
|
315
|
+
t = a([
|
|
316
|
+
c("gui-range-date-time-picker")
|
|
317
|
+
], t);
|
|
318
|
+
typeof customElements < "u" && !customElements.get("gui-range-date-time-picker") && customElements.define("gui-range-date-time-picker", t);
|
|
319
|
+
var S = Object.defineProperty, I = Object.getOwnPropertyDescriptor, u = (e, r, n, s) => {
|
|
320
|
+
for (var o = s > 1 ? void 0 : s ? I(r, n) : r, l = e.length - 1, d; l >= 0; l--)
|
|
321
|
+
(d = e[l]) && (o = (s ? d(r, n, o) : d(o)) || o);
|
|
322
|
+
return s && o && S(r, n, o), o;
|
|
323
|
+
};
|
|
324
|
+
let p = class extends m {
|
|
325
|
+
constructor() {
|
|
326
|
+
super(...arguments), this.adapter = new g(), this.subscriptions = [];
|
|
327
|
+
}
|
|
328
|
+
createRenderRoot() {
|
|
329
|
+
return this;
|
|
330
|
+
}
|
|
331
|
+
updated(e) {
|
|
332
|
+
super.updated(e);
|
|
333
|
+
const r = this.adapter.templateData.size;
|
|
334
|
+
r ? this.style.flex = String(r) : this.style.removeProperty("flex");
|
|
335
|
+
}
|
|
336
|
+
connectedCallback() {
|
|
337
|
+
super.connectedCallback(), this.classList.add("gui-range-date-time-picker", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
338
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
render() {
|
|
342
|
+
super.render();
|
|
343
|
+
const e = this.adapter.templateData;
|
|
344
|
+
return h`
|
|
345
|
+
<gui-range-date-time-picker
|
|
346
|
+
.uid=${this.widget.uid}
|
|
347
|
+
.label=${e.label}
|
|
348
|
+
.hint=${e.hint}
|
|
349
|
+
.icon=${e.icon}
|
|
350
|
+
.errors=${e.errors}
|
|
351
|
+
?touched=${e.touched}
|
|
352
|
+
?required=${e.validator?.required}
|
|
353
|
+
?disabled=${e.disabled}
|
|
354
|
+
?readonly=${e.readonly}
|
|
355
|
+
.value=${e.value}
|
|
356
|
+
.separator=${e.separator}
|
|
357
|
+
.removePillAriaLabel=${e.removePillAriaLabel}
|
|
358
|
+
.startDateTimeAriaLabel=${e.startDateTimeAriaLabel}
|
|
359
|
+
.endDateTimeAriaLabel=${e.endDateTimeAriaLabel}
|
|
360
|
+
.invalidDateMessage=${e.invalidDateMessage}
|
|
361
|
+
.prevMonthIcon=${e.prevMonthIcon}
|
|
362
|
+
.nextMonthIcon=${e.nextMonthIcon}
|
|
363
|
+
.prevMonthAriaLabel=${e.prevMonthAriaLabel}
|
|
364
|
+
.nextMonthAriaLabel=${e.nextMonthAriaLabel}
|
|
365
|
+
.dayFormat=${e.dayFormat}
|
|
366
|
+
.weekdayFormat=${e.weekdayFormat}
|
|
367
|
+
.monthFormat=${e.monthFormat}
|
|
368
|
+
.numberOfMonths=${e.numberOfMonths}
|
|
369
|
+
.localeId=${e.lang}
|
|
370
|
+
.hourFormat=${e.hourFormat}
|
|
371
|
+
.minuteStep=${e.minuteStep}
|
|
372
|
+
?allow-custom-time=${e.allowCustomTime}
|
|
373
|
+
.startTimeLabel=${e.startTimeLabel}
|
|
374
|
+
.endTimeLabel=${e.endTimeLabel}
|
|
375
|
+
.minDateTime=${e.minDateTime}
|
|
376
|
+
.maxDateTime=${e.maxDateTime}
|
|
377
|
+
.disabledRanges=${e.disabledRanges}
|
|
378
|
+
.minDateTimeMessage=${e.minDateTimeMessage}
|
|
379
|
+
.maxDateTimeMessage=${e.maxDateTimeMessage}
|
|
380
|
+
.disabledRangeMessage=${e.disabledRangeMessage}
|
|
381
|
+
.noAvailableTimesMessage=${e.noAvailableTimesMessage}
|
|
382
|
+
.dayCountAriaLabel=${e.dayCountAriaLabel}
|
|
383
|
+
.disabledDayCountAriaLabel=${e.disabledDayCountAriaLabel}
|
|
384
|
+
@change=${this.valueChanged}
|
|
385
|
+
@inputError=${this.onInputError}
|
|
386
|
+
@blur=${() => this.adapter.onBlur()}
|
|
387
|
+
></gui-range-date-time-picker>
|
|
388
|
+
`;
|
|
389
|
+
}
|
|
390
|
+
valueChanged(e) {
|
|
391
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(e.detail.value);
|
|
392
|
+
}
|
|
393
|
+
onInputError(e) {
|
|
394
|
+
this.adapter.injectValidationIssues([e.detail.message]), this.adapter.onBlur();
|
|
395
|
+
}
|
|
396
|
+
disconnectedCallback() {
|
|
397
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
u([
|
|
401
|
+
C({ context: y }),
|
|
402
|
+
i({ attribute: !1 })
|
|
403
|
+
], p.prototype, "formContext", 2);
|
|
404
|
+
u([
|
|
405
|
+
w({ context: $ })
|
|
406
|
+
], p.prototype, "adapter", 2);
|
|
407
|
+
p = u([
|
|
408
|
+
c("gui-range-date-time-picker-input")
|
|
409
|
+
], p);
|
|
410
|
+
export {
|
|
411
|
+
p as RangeDateTimePickerElement
|
|
412
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function o() {
|
|
2
|
+
return { anchor: null, hover: null, selecting: !1 };
|
|
3
|
+
}
|
|
4
|
+
function i(r, e) {
|
|
5
|
+
switch (e.type) {
|
|
6
|
+
case "pick": {
|
|
7
|
+
if (!r.anchor)
|
|
8
|
+
return { state: { anchor: e.date, hover: r.hover, selecting: !0 } };
|
|
9
|
+
let n = r.anchor, c = e.date;
|
|
10
|
+
return e.date < n && (n = e.date, c = r.anchor), { state: o(), commit: { start: n, end: c } };
|
|
11
|
+
}
|
|
12
|
+
case "hover":
|
|
13
|
+
return r.selecting ? { state: { ...r, hover: e.date } } : { state: r };
|
|
14
|
+
case "reset":
|
|
15
|
+
return { state: o() };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function h(r) {
|
|
19
|
+
return !r.selecting || !r.hover || !r.anchor ? null : r.hover.getTime() > r.anchor.getTime() ? { start: r.anchor, end: r.hover } : { start: r.hover, end: r.anchor };
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
o as i,
|
|
23
|
+
i as r,
|
|
24
|
+
h as s
|
|
25
|
+
};
|