@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,184 @@
|
|
|
1
|
+
import { LitElement as u, nothing as p, html as h } from "lit";
|
|
2
|
+
import { property as s, customElement as c } from "lit/decorators.js";
|
|
3
|
+
import { classMap as g } from "lit/directives/class-map.js";
|
|
4
|
+
import { G as m, b as y, c as v } from "./templates-Dk1jxLwS.js";
|
|
5
|
+
import { n as b, G as D, r as f, q as E } from "./part-templates-Db871PS3.js";
|
|
6
|
+
import { g as C, d as w } from "./date-Bj9mI3GU.js";
|
|
7
|
+
var M = Object.defineProperty, P = Object.getOwnPropertyDescriptor, e = (i, a, o, r) => {
|
|
8
|
+
for (var l = r > 1 ? void 0 : r ? P(a, o) : a, n = i.length - 1, d; n >= 0; n--)
|
|
9
|
+
(d = i[n]) && (l = (r ? d(a, o, l) : d(l)) || l);
|
|
10
|
+
return r && l && M(a, o, l), l;
|
|
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.value = void 0, this.invalidDateMessage = void 0, this.minDate = void 0, this.maxDate = void 0, this.minDateMessage = void 0, this.maxDateMessage = void 0, this.inputBlockClass = "gui-date-input", this.groups = ["default"], this.partDescriptors = b(), this._parts = new D(this, {
|
|
15
|
+
blockClass: this.inputBlockClass,
|
|
16
|
+
groups: this.groups,
|
|
17
|
+
getDescriptor: (i) => this.getPartDescriptor(i),
|
|
18
|
+
commitGroup: (i) => this.validateAndEmit(i),
|
|
19
|
+
isReadonly: () => !!this.readOnly,
|
|
20
|
+
isDisabled: () => !!this.disabled,
|
|
21
|
+
onEmptyPartBlur: () => this.dispatchEvent(new CustomEvent("change", { detail: { value: null }, bubbles: !0 }))
|
|
22
|
+
}), this.ariaController = new m(this, {
|
|
23
|
+
getTargets: () => this.querySelectorAll(`.${this.inputBlockClass}`),
|
|
24
|
+
getState: () => ({
|
|
25
|
+
uid: this.uid,
|
|
26
|
+
templateData: {
|
|
27
|
+
hint: this.hint,
|
|
28
|
+
errors: this.errors,
|
|
29
|
+
readonly: this.readOnly,
|
|
30
|
+
disabled: this.disabled,
|
|
31
|
+
touched: this.touched
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
createRenderRoot() {
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
super.connectedCallback(), this.classList.add("gui-field");
|
|
41
|
+
}
|
|
42
|
+
getPartDescriptor(i) {
|
|
43
|
+
return this.partDescriptors[i];
|
|
44
|
+
}
|
|
45
|
+
willUpdate(i) {
|
|
46
|
+
i.has("value") && this._parts.setGroupFromISO("default", this.value ?? "", "date");
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
const i = {
|
|
50
|
+
uid: this.uid,
|
|
51
|
+
label: this.label,
|
|
52
|
+
errors: this.errors,
|
|
53
|
+
touched: this.touched,
|
|
54
|
+
required: this.required,
|
|
55
|
+
disabled: this.disabled,
|
|
56
|
+
readonly: this.readOnly,
|
|
57
|
+
value: this.value,
|
|
58
|
+
icon: this.icon,
|
|
59
|
+
hint: this.hint
|
|
60
|
+
}, a = {
|
|
61
|
+
blockClass: this.inputBlockClass,
|
|
62
|
+
groups: this.groups,
|
|
63
|
+
formatParts: C(this.localeId),
|
|
64
|
+
getDescriptor: (r) => this.getPartDescriptor(r),
|
|
65
|
+
getDisplayValue: this._parts.getPartDisplay,
|
|
66
|
+
required: this.required,
|
|
67
|
+
disabled: this.disabled,
|
|
68
|
+
partsReadonly: !!this.readOnly
|
|
69
|
+
}, o = {
|
|
70
|
+
"gui-widget-icon": !0,
|
|
71
|
+
[this.icon]: !0
|
|
72
|
+
};
|
|
73
|
+
return h`
|
|
74
|
+
${this.label ? y(this.uid, i) : p}
|
|
75
|
+
|
|
76
|
+
<div class="gui-widget">
|
|
77
|
+
<div
|
|
78
|
+
class="gui-widget-input gui-parts gui-parts-ring gui-date-input ${this.icon ? "gui-calendar--icon" : ""}"
|
|
79
|
+
role="group"
|
|
80
|
+
>
|
|
81
|
+
${f("default", a, this._parts)}
|
|
82
|
+
</div>
|
|
83
|
+
${this.icon ? h`<span class=${g(o)} data-icon=${this.icon}></span>` : p}
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
${this.showErrors && this.errors?.length ? v(this.uid, i) : p}
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
validateAndEmit(i) {
|
|
90
|
+
const { result: a, writeBacks: o } = E(this._parts.values[i] ?? {}, {
|
|
91
|
+
descriptors: this.partDescriptors,
|
|
92
|
+
invalidDateMessage: this.invalidDateMessage
|
|
93
|
+
});
|
|
94
|
+
if (this._parts.applyWriteBacks(i, o), a.kind === "invalid")
|
|
95
|
+
this.dispatchEvent(
|
|
96
|
+
new CustomEvent("inputError", {
|
|
97
|
+
detail: { message: a.message },
|
|
98
|
+
bubbles: !0
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
else if (a.kind === "valid") {
|
|
102
|
+
const r = w(a.iso, this.minDate, this.maxDate, void 0, {
|
|
103
|
+
minDateMessage: this.minDateMessage,
|
|
104
|
+
maxDateMessage: this.maxDateMessage
|
|
105
|
+
});
|
|
106
|
+
if (r) {
|
|
107
|
+
this.dispatchEvent(
|
|
108
|
+
new CustomEvent("change", {
|
|
109
|
+
detail: { value: a.iso },
|
|
110
|
+
bubbles: !0
|
|
111
|
+
})
|
|
112
|
+
), this.dispatchEvent(
|
|
113
|
+
new CustomEvent("inputError", {
|
|
114
|
+
detail: { message: r },
|
|
115
|
+
bubbles: !0
|
|
116
|
+
})
|
|
117
|
+
), this.requestUpdate();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
this.value = a.iso, this.dispatchEvent(
|
|
121
|
+
new CustomEvent("change", {
|
|
122
|
+
detail: { value: this.value },
|
|
123
|
+
bubbles: !0
|
|
124
|
+
})
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
this.requestUpdate();
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
e([
|
|
131
|
+
s({ type: String })
|
|
132
|
+
], t.prototype, "uid", 2);
|
|
133
|
+
e([
|
|
134
|
+
s({ type: String })
|
|
135
|
+
], t.prototype, "label", 2);
|
|
136
|
+
e([
|
|
137
|
+
s({ type: String, attribute: "locale-id" })
|
|
138
|
+
], t.prototype, "localeId", 2);
|
|
139
|
+
e([
|
|
140
|
+
s({ type: Array })
|
|
141
|
+
], t.prototype, "errors", 2);
|
|
142
|
+
e([
|
|
143
|
+
s({ type: Boolean })
|
|
144
|
+
], t.prototype, "showErrors", 2);
|
|
145
|
+
e([
|
|
146
|
+
s({ type: Boolean })
|
|
147
|
+
], t.prototype, "touched", 2);
|
|
148
|
+
e([
|
|
149
|
+
s({ type: Boolean })
|
|
150
|
+
], t.prototype, "required", 2);
|
|
151
|
+
e([
|
|
152
|
+
s({ type: Boolean })
|
|
153
|
+
], t.prototype, "disabled", 2);
|
|
154
|
+
e([
|
|
155
|
+
s({ type: Boolean, attribute: "readonly" })
|
|
156
|
+
], t.prototype, "readOnly", 2);
|
|
157
|
+
e([
|
|
158
|
+
s({ type: String })
|
|
159
|
+
], t.prototype, "icon", 2);
|
|
160
|
+
e([
|
|
161
|
+
s({ type: String })
|
|
162
|
+
], t.prototype, "hint", 2);
|
|
163
|
+
e([
|
|
164
|
+
s({ type: String })
|
|
165
|
+
], t.prototype, "value", 2);
|
|
166
|
+
e([
|
|
167
|
+
s({ type: String, attribute: "invalid-date-message" })
|
|
168
|
+
], t.prototype, "invalidDateMessage", 2);
|
|
169
|
+
e([
|
|
170
|
+
s({ type: String, attribute: "min-date" })
|
|
171
|
+
], t.prototype, "minDate", 2);
|
|
172
|
+
e([
|
|
173
|
+
s({ type: String, attribute: "max-date" })
|
|
174
|
+
], t.prototype, "maxDate", 2);
|
|
175
|
+
e([
|
|
176
|
+
s({ type: String, attribute: "min-date-message" })
|
|
177
|
+
], t.prototype, "minDateMessage", 2);
|
|
178
|
+
e([
|
|
179
|
+
s({ type: String, attribute: "max-date-message" })
|
|
180
|
+
], t.prototype, "maxDateMessage", 2);
|
|
181
|
+
t = e([
|
|
182
|
+
c("gui-date")
|
|
183
|
+
], t);
|
|
184
|
+
typeof customElements < "u" && !customElements.get("gui-date") && customElements.define("gui-date", t);
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { InputWidgetAdapter as b, formContext as y, inputContext as v } from "@golemui/lit";
|
|
2
|
+
import { LitElement as c, html as l, nothing as $ } from "lit";
|
|
3
|
+
import { property as i, query as m, customElement as g } from "lit/decorators.js";
|
|
4
|
+
import { classMap as M } from "lit/directives/class-map.js";
|
|
5
|
+
import "./date-input-cJDkNnVw.js";
|
|
6
|
+
import "./calendar-BuJgwvZx.js";
|
|
7
|
+
import { G as f } from "./popup.controller-eUDxE6jD.js";
|
|
8
|
+
import { d as D } from "./date-Bj9mI3GU.js";
|
|
9
|
+
import { a as x, b as w, c as _ } from "./templates-Dk1jxLwS.js";
|
|
10
|
+
import { consume as I, provide as C } from "@lit/context";
|
|
11
|
+
import "rxjs";
|
|
12
|
+
var E = Object.defineProperty, R = Object.getOwnPropertyDescriptor, a = (t, r, n, s) => {
|
|
13
|
+
for (var o = s > 1 ? void 0 : s ? R(r, n) : r, d = t.length - 1, p; d >= 0; d--)
|
|
14
|
+
(p = t[d]) && (o = (s ? p(r, n, o) : p(o)) || o);
|
|
15
|
+
return s && o && E(r, n, o), o;
|
|
16
|
+
};
|
|
17
|
+
let e = class extends c {
|
|
18
|
+
constructor() {
|
|
19
|
+
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.invalidDateMessage = void 0, this.minDateMessage = void 0, this.maxDateMessage = void 0, this.disabledDateRangeMessage = void 0, this._popup = new f(this, {
|
|
20
|
+
getInteriorElements: () => [this._dateRef, this._calendarRef],
|
|
21
|
+
focusRestoreSelector: "gui-date input",
|
|
22
|
+
isDisabled: () => !!this.disabled,
|
|
23
|
+
clickIntent: (t) => t.closest(".gui-calendar__day-button") ? "ignore" : t.closest(".gui-date-input__part") || t.closest("gui-calendar") ? "open" : "toggle",
|
|
24
|
+
keyToggleMode: "toggle"
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
createRenderRoot() {
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
const t = x("datePicker", { icon: this.icon }), r = this._popup.open ? l`<gui-calendar
|
|
32
|
+
id="calendar-input"
|
|
33
|
+
.uid=${this.uid}
|
|
34
|
+
.hint=${this.hint}
|
|
35
|
+
?touched=${this.touched}
|
|
36
|
+
?required=${this.required}
|
|
37
|
+
?disabled=${this.disabled}
|
|
38
|
+
?readonly=${this.readOnly}
|
|
39
|
+
.value=${this.value}
|
|
40
|
+
.prevMonthIcon=${this.prevMonthIcon}
|
|
41
|
+
.nextMonthIcon=${this.nextMonthIcon}
|
|
42
|
+
.prevMonthAriaLabel=${this.prevMonthAriaLabel}
|
|
43
|
+
.nextMonthAriaLabel=${this.nextMonthAriaLabel}
|
|
44
|
+
.dayFormat=${this.dayFormat}
|
|
45
|
+
.weekdayFormat=${this.weekdayFormat}
|
|
46
|
+
.monthFormat=${this.monthFormat}
|
|
47
|
+
.minDate=${this.minDate}
|
|
48
|
+
.maxDate=${this.maxDate}
|
|
49
|
+
.disabledRanges=${this.disabledRanges}
|
|
50
|
+
.numberOfMonths=${this.numberOfMonths}
|
|
51
|
+
.localeId=${this.localeId}
|
|
52
|
+
@blur=${this.onCalendarBlur}
|
|
53
|
+
@change=${this.onCalendarChange}
|
|
54
|
+
></gui-calendar>` : $;
|
|
55
|
+
return l`
|
|
56
|
+
${w(this.uid ?? "", {
|
|
57
|
+
label: this.label,
|
|
58
|
+
hint: this.hint,
|
|
59
|
+
required: this.required
|
|
60
|
+
})}
|
|
61
|
+
|
|
62
|
+
<div
|
|
63
|
+
role="button"
|
|
64
|
+
tabindex="-1"
|
|
65
|
+
class="gui-widget"
|
|
66
|
+
aria-expanded=${this._popup.open}
|
|
67
|
+
@keyup=${this._popup.onAnchorKeyUp}
|
|
68
|
+
@keydown=${this._popup.onAnchorKeyDown}
|
|
69
|
+
@click=${this._popup.onAnchorClick}
|
|
70
|
+
>
|
|
71
|
+
<gui-date
|
|
72
|
+
id="date-input"
|
|
73
|
+
class=${M(t.widgetClasses)}
|
|
74
|
+
.uid=${this.uid}
|
|
75
|
+
.hint=${this.hint}
|
|
76
|
+
.showErrors=${!1}
|
|
77
|
+
.errors=${this.errors}
|
|
78
|
+
?touched=${this.touched}
|
|
79
|
+
?required=${this.required}
|
|
80
|
+
?disabled=${this.disabled}
|
|
81
|
+
?readonly=${this.readOnly}
|
|
82
|
+
.value=${this.value}
|
|
83
|
+
.icon=${this.icon}
|
|
84
|
+
.localeId=${this.localeId}
|
|
85
|
+
.invalidDateMessage=${this.invalidDateMessage}
|
|
86
|
+
@blur=${this.onDateBlur}
|
|
87
|
+
@focus=${this._popup.show}
|
|
88
|
+
@change=${this.onDateChange}
|
|
89
|
+
></gui-date>
|
|
90
|
+
<span class="gui-date-picker__arrow"
|
|
91
|
+
><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 256">
|
|
92
|
+
<path
|
|
93
|
+
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"
|
|
94
|
+
></path></svg
|
|
95
|
+
></span>
|
|
96
|
+
|
|
97
|
+
${r}
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
${this.showErrors ? _(this.uid ?? "", { errors: this.errors, touched: this.touched }) : ""}
|
|
101
|
+
`;
|
|
102
|
+
}
|
|
103
|
+
onDateChange(t) {
|
|
104
|
+
t.stopPropagation(), this.commitValue(t.detail.value);
|
|
105
|
+
}
|
|
106
|
+
onDateBlur() {
|
|
107
|
+
this.dispatchEvent(new CustomEvent("blur"));
|
|
108
|
+
}
|
|
109
|
+
onCalendarChange(t) {
|
|
110
|
+
t.stopPropagation(), this.commitValue(t.detail.value), this._popup.close();
|
|
111
|
+
}
|
|
112
|
+
commitValue(t) {
|
|
113
|
+
this.value = t ?? void 0;
|
|
114
|
+
const r = this.validateBounds(this.value);
|
|
115
|
+
this.dispatchEvent(
|
|
116
|
+
new CustomEvent("change", {
|
|
117
|
+
detail: { value: t ?? null },
|
|
118
|
+
bubbles: !0,
|
|
119
|
+
composed: !0
|
|
120
|
+
})
|
|
121
|
+
), r && this.dispatchEvent(
|
|
122
|
+
new CustomEvent("inputError", {
|
|
123
|
+
detail: { message: r },
|
|
124
|
+
bubbles: !0,
|
|
125
|
+
composed: !0
|
|
126
|
+
})
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
validateBounds(t) {
|
|
130
|
+
return t ? D(t, this.minDate, this.maxDate, this.disabledRanges, {
|
|
131
|
+
minDateMessage: this.minDateMessage,
|
|
132
|
+
maxDateMessage: this.maxDateMessage,
|
|
133
|
+
disabledDateRangeMessage: this.disabledDateRangeMessage
|
|
134
|
+
}) : null;
|
|
135
|
+
}
|
|
136
|
+
onCalendarBlur() {
|
|
137
|
+
this._popup.close();
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
a([
|
|
141
|
+
i({ type: String })
|
|
142
|
+
], e.prototype, "uid", 2);
|
|
143
|
+
a([
|
|
144
|
+
i({ type: String })
|
|
145
|
+
], e.prototype, "label", 2);
|
|
146
|
+
a([
|
|
147
|
+
i({ type: String })
|
|
148
|
+
], e.prototype, "hint", 2);
|
|
149
|
+
a([
|
|
150
|
+
i({ type: String })
|
|
151
|
+
], e.prototype, "icon", 2);
|
|
152
|
+
a([
|
|
153
|
+
i({ type: Array })
|
|
154
|
+
], e.prototype, "errors", 2);
|
|
155
|
+
a([
|
|
156
|
+
i({ type: Boolean })
|
|
157
|
+
], e.prototype, "showErrors", 2);
|
|
158
|
+
a([
|
|
159
|
+
i({ type: Boolean })
|
|
160
|
+
], e.prototype, "touched", 2);
|
|
161
|
+
a([
|
|
162
|
+
i({ type: Boolean })
|
|
163
|
+
], e.prototype, "required", 2);
|
|
164
|
+
a([
|
|
165
|
+
i({ type: Boolean })
|
|
166
|
+
], e.prototype, "disabled", 2);
|
|
167
|
+
a([
|
|
168
|
+
i({ type: Boolean, attribute: "readonly" })
|
|
169
|
+
], e.prototype, "readOnly", 2);
|
|
170
|
+
a([
|
|
171
|
+
i({ type: String, attribute: "locale-id" })
|
|
172
|
+
], e.prototype, "localeId", 2);
|
|
173
|
+
a([
|
|
174
|
+
i({ type: String })
|
|
175
|
+
], e.prototype, "value", 2);
|
|
176
|
+
a([
|
|
177
|
+
i({ type: String, attribute: "prev-month-icon" })
|
|
178
|
+
], e.prototype, "prevMonthIcon", 2);
|
|
179
|
+
a([
|
|
180
|
+
i({ type: String, attribute: "next-month-icon" })
|
|
181
|
+
], e.prototype, "nextMonthIcon", 2);
|
|
182
|
+
a([
|
|
183
|
+
i({ type: String, attribute: "prev-month-aria-label" })
|
|
184
|
+
], e.prototype, "prevMonthAriaLabel", 2);
|
|
185
|
+
a([
|
|
186
|
+
i({ type: String, attribute: "next-month-aria-label" })
|
|
187
|
+
], e.prototype, "nextMonthAriaLabel", 2);
|
|
188
|
+
a([
|
|
189
|
+
i({ type: String, attribute: "day-format" })
|
|
190
|
+
], e.prototype, "dayFormat", 2);
|
|
191
|
+
a([
|
|
192
|
+
i({ type: String, attribute: "weekday-format" })
|
|
193
|
+
], e.prototype, "weekdayFormat", 2);
|
|
194
|
+
a([
|
|
195
|
+
i({ type: String, attribute: "month-format" })
|
|
196
|
+
], e.prototype, "monthFormat", 2);
|
|
197
|
+
a([
|
|
198
|
+
i({ type: String, attribute: "min-date" })
|
|
199
|
+
], e.prototype, "minDate", 2);
|
|
200
|
+
a([
|
|
201
|
+
i({ type: String, attribute: "max-date" })
|
|
202
|
+
], e.prototype, "maxDate", 2);
|
|
203
|
+
a([
|
|
204
|
+
i({ type: Array, attribute: "disabled-ranges" })
|
|
205
|
+
], e.prototype, "disabledRanges", 2);
|
|
206
|
+
a([
|
|
207
|
+
i({ type: Number, attribute: "number-of-months" })
|
|
208
|
+
], e.prototype, "numberOfMonths", 2);
|
|
209
|
+
a([
|
|
210
|
+
i({ type: String, attribute: "invalid-date-message" })
|
|
211
|
+
], e.prototype, "invalidDateMessage", 2);
|
|
212
|
+
a([
|
|
213
|
+
i({ type: String, attribute: "min-date-message" })
|
|
214
|
+
], e.prototype, "minDateMessage", 2);
|
|
215
|
+
a([
|
|
216
|
+
i({ type: String, attribute: "max-date-message" })
|
|
217
|
+
], e.prototype, "maxDateMessage", 2);
|
|
218
|
+
a([
|
|
219
|
+
i({ type: String, attribute: "disabled-date-range-message" })
|
|
220
|
+
], e.prototype, "disabledDateRangeMessage", 2);
|
|
221
|
+
a([
|
|
222
|
+
m("#date-input")
|
|
223
|
+
], e.prototype, "_dateRef", 2);
|
|
224
|
+
a([
|
|
225
|
+
m("#calendar-input")
|
|
226
|
+
], e.prototype, "_calendarRef", 2);
|
|
227
|
+
e = a([
|
|
228
|
+
g("gui-date-picker")
|
|
229
|
+
], e);
|
|
230
|
+
typeof customElements < "u" && !customElements.get("gui-date-picker") && customElements.define("gui-date-picker", e);
|
|
231
|
+
var S = Object.defineProperty, k = Object.getOwnPropertyDescriptor, u = (t, r, n, s) => {
|
|
232
|
+
for (var o = s > 1 ? void 0 : s ? k(r, n) : r, d = t.length - 1, p; d >= 0; d--)
|
|
233
|
+
(p = t[d]) && (o = (s ? p(r, n, o) : p(o)) || o);
|
|
234
|
+
return s && o && S(r, n, o), o;
|
|
235
|
+
};
|
|
236
|
+
let h = class extends c {
|
|
237
|
+
constructor() {
|
|
238
|
+
super(...arguments), this.adapter = new b(), this.subscriptions = [];
|
|
239
|
+
}
|
|
240
|
+
createRenderRoot() {
|
|
241
|
+
return this;
|
|
242
|
+
}
|
|
243
|
+
updated(t) {
|
|
244
|
+
super.updated(t);
|
|
245
|
+
const r = this.adapter.templateData.size;
|
|
246
|
+
r ? this.style.flex = String(r) : this.style.removeProperty("flex");
|
|
247
|
+
}
|
|
248
|
+
connectedCallback() {
|
|
249
|
+
super.connectedCallback(), this.classList.add("gui-date-picker", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
250
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
render() {
|
|
254
|
+
super.render();
|
|
255
|
+
const t = this.adapter.templateData;
|
|
256
|
+
return l`
|
|
257
|
+
<gui-date-picker
|
|
258
|
+
.uid=${this.widget.uid}
|
|
259
|
+
.label=${t.label}
|
|
260
|
+
.hint=${t.hint}
|
|
261
|
+
.errors=${t.errors}
|
|
262
|
+
?touched=${t.touched}
|
|
263
|
+
?required=${t.validator?.required}
|
|
264
|
+
?disabled=${t.disabled}
|
|
265
|
+
?readonly=${t.readonly}
|
|
266
|
+
.value=${t.value}
|
|
267
|
+
.icon=${t.icon}
|
|
268
|
+
.localeId=${t.lang}
|
|
269
|
+
.prevMonthIcon=${t.prevMonthIcon}
|
|
270
|
+
.nextMonthIcon=${t.nextMonthIcon}
|
|
271
|
+
.prevMonthAriaLabel=${t.prevMonthAriaLabel}
|
|
272
|
+
.nextMonthAriaLabel=${t.nextMonthAriaLabel}
|
|
273
|
+
.dayFormat=${t.dayFormat}
|
|
274
|
+
.weekdayFormat=${t.weekdayFormat}
|
|
275
|
+
.monthFormat=${t.monthFormat}
|
|
276
|
+
.minDate=${t.minDate}
|
|
277
|
+
.maxDate=${t.maxDate}
|
|
278
|
+
.disabledRanges=${t.disabledRanges}
|
|
279
|
+
.numberOfMonths=${t.numberOfMonths}
|
|
280
|
+
.invalidDateMessage=${t.invalidDateMessage}
|
|
281
|
+
.minDateMessage=${t.minDateMessage}
|
|
282
|
+
.maxDateMessage=${t.maxDateMessage}
|
|
283
|
+
.disabledDateRangeMessage=${t.disabledDateRangeMessage}
|
|
284
|
+
@inputError=${this.onInputError}
|
|
285
|
+
@blur=${() => this.adapter.onBlur()}
|
|
286
|
+
@change=${this.valueChanged}
|
|
287
|
+
></gui-date-picker>
|
|
288
|
+
`;
|
|
289
|
+
}
|
|
290
|
+
valueChanged(t) {
|
|
291
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(t.detail.value);
|
|
292
|
+
}
|
|
293
|
+
onInputError(t) {
|
|
294
|
+
this.adapter.injectValidationIssues([t.detail.message]);
|
|
295
|
+
}
|
|
296
|
+
disconnectedCallback() {
|
|
297
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
u([
|
|
301
|
+
I({ context: y }),
|
|
302
|
+
i({ attribute: !1 })
|
|
303
|
+
], h.prototype, "formContext", 2);
|
|
304
|
+
u([
|
|
305
|
+
C({ context: v })
|
|
306
|
+
], h.prototype, "adapter", 2);
|
|
307
|
+
h = u([
|
|
308
|
+
g("gui-date-picker-input")
|
|
309
|
+
], h);
|
|
310
|
+
export {
|
|
311
|
+
h as DatePickerElement
|
|
312
|
+
};
|