@golemui/gui-lit 0.0.2
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 +529 -0
- package/README.md +7 -0
- package/accordion.element-D1RfC2ew.js +92 -0
- package/alert.element-B4rpyqGV.js +55 -0
- package/button.element-BnUBVNSH.js +58 -0
- package/calendar.element-D7mAbpAa.js +70 -0
- package/checkbox.element--Kc7sWBx.js +65 -0
- package/currency.element-D9dyGRBH.js +71 -0
- package/date-picker.element-Dcs5OpxN.js +136 -0
- package/date.element-na_Uywms.js +74 -0
- package/default-list-item-renderer-DNVEjKSX.js +23 -0
- package/dropdown.element-Cfj40aJz.js +225 -0
- package/flex.element-BSMOum-h.js +65 -0
- package/index.d.ts +2 -0
- package/index.js +2254 -0
- package/index.umd.cjs +535 -0
- package/lib/components/accordion.element.d.ts +21 -0
- package/lib/components/alert.element.d.ts +16 -0
- package/lib/components/button.element.d.ts +15 -0
- package/lib/components/calendar.element.d.ts +16 -0
- package/lib/components/checkbox.element.d.ts +17 -0
- package/lib/components/currency.element.d.ts +17 -0
- package/lib/components/date-picker.element.d.ts +26 -0
- package/lib/components/date.element.d.ts +18 -0
- package/lib/components/default-list-item-renderer.d.ts +2 -0
- package/lib/components/dropdown.element.d.ts +38 -0
- package/lib/components/flex.element.d.ts +16 -0
- package/lib/components/form.element.d.ts +21 -0
- package/lib/components/list.element.d.ts +25 -0
- package/lib/components/number.element.d.ts +17 -0
- package/lib/components/password.element.d.ts +17 -0
- package/lib/components/radiogroup.element.d.ts +17 -0
- package/lib/components/range-calendar.element.d.ts +16 -0
- package/lib/components/renderer.element.d.ts +15 -0
- package/lib/components/repeater.element.d.ts +18 -0
- package/lib/components/select.element.d.ts +18 -0
- package/lib/components/tabs.element.d.ts +27 -0
- package/lib/components/textarea.element.d.ts +17 -0
- package/lib/components/textinput.element.d.ts +17 -0
- package/lib/components/toggle.element.d.ts +17 -0
- package/lib/widget.loaders.d.ts +4 -0
- package/list.element--aj6sNNU.js +138 -0
- package/number.element-Bl5YReaL.js +69 -0
- package/package.json +34 -0
- package/password.element-CKmcH8Gn.js +70 -0
- package/radiogroup.element-Cn1lyyVE.js +67 -0
- package/range-calendar.element-C2YUElqM.js +70 -0
- package/renderer.element-B7AjPqr2.js +43 -0
- package/repeater.element-BfwzCooC.js +83 -0
- package/select.element-LWiqYxzA.js +73 -0
- package/tabs.element-DYg1wAz9.js +158 -0
- package/textarea.element-BXc-rLZE.js +70 -0
- package/textinput.element-x9LYeW8B.js +66 -0
- package/toggle.element-BP4YKWyR.js +65 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as p from "@golemui/lit";
|
|
2
|
+
import { consume as c, provide as u } from "@lit/context";
|
|
3
|
+
import { LitElement as l, html as h } from "lit";
|
|
4
|
+
import { property as b, customElement as m } from "lit/decorators.js";
|
|
5
|
+
var f = Object.defineProperty, g = Object.getOwnPropertyDescriptor, d = (s, t, a, i) => {
|
|
6
|
+
for (var e = i > 1 ? void 0 : i ? g(t, a) : t, o = s.length - 1, n; o >= 0; o--)
|
|
7
|
+
(n = s[o]) && (e = (i ? n(t, a, e) : n(e)) || e);
|
|
8
|
+
return i && e && f(t, a, e), e;
|
|
9
|
+
};
|
|
10
|
+
let r = class extends l {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.adapter = new p.ActionWidgetAdapter(), this.subscriptions = [];
|
|
13
|
+
}
|
|
14
|
+
createRenderRoot() {
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
super.connectedCallback(), this.classList.add("gui-button"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
19
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
updated(s) {
|
|
23
|
+
super.updated(s);
|
|
24
|
+
const t = this.adapter.templateData.size;
|
|
25
|
+
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return h`
|
|
29
|
+
<div class="gui-widget">
|
|
30
|
+
<button
|
|
31
|
+
type="button"
|
|
32
|
+
id=${this.widget.uid}
|
|
33
|
+
data-cy=${`${this.widget.uid}_button`}
|
|
34
|
+
@click=${() => this.adapter.click()}
|
|
35
|
+
?disabled=${this.adapter.templateData.disabled === !0}
|
|
36
|
+
>
|
|
37
|
+
${this.adapter.templateData.label}
|
|
38
|
+
</button>
|
|
39
|
+
</div>
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
disconnectedCallback() {
|
|
43
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((s) => s.unsubscribe());
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
d([
|
|
47
|
+
c({ context: p.formContext }),
|
|
48
|
+
b({ attribute: !1 })
|
|
49
|
+
], r.prototype, "formContext", 2);
|
|
50
|
+
d([
|
|
51
|
+
u({ context: p.actionContext })
|
|
52
|
+
], r.prototype, "adapter", 2);
|
|
53
|
+
r = d([
|
|
54
|
+
m("gui-button-action")
|
|
55
|
+
], r);
|
|
56
|
+
export {
|
|
57
|
+
r as ButtonElement
|
|
58
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as d from "@golemui/lit";
|
|
2
|
+
import { consume as l, provide as h } from "@lit/context";
|
|
3
|
+
import { LitElement as m, html as c } from "lit";
|
|
4
|
+
import { property as u, customElement as D } from "lit/decorators.js";
|
|
5
|
+
var b = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, o = (a, e, i, r) => {
|
|
6
|
+
for (var t = r > 1 ? void 0 : r ? $(e, i) : e, p = a.length - 1, n; p >= 0; p--)
|
|
7
|
+
(n = a[p]) && (t = (r ? n(e, i, t) : n(t)) || t);
|
|
8
|
+
return r && t && b(e, i, t), t;
|
|
9
|
+
};
|
|
10
|
+
let s = class extends m {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.adapter = new d.InputWidgetAdapter(), this.subscriptions = [];
|
|
13
|
+
}
|
|
14
|
+
createRenderRoot() {
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
super.connectedCallback(), this.classList.add("gui-calendar"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
19
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
return super.render(), c`
|
|
24
|
+
<gui-calendar
|
|
25
|
+
.uid=${this.widget.uid}
|
|
26
|
+
.label=${this.adapter.templateData.label}
|
|
27
|
+
.hint=${this.adapter.templateData.hint}
|
|
28
|
+
.errors=${this.adapter.templateData.errors}
|
|
29
|
+
?touched=${this.adapter.templateData.touched}
|
|
30
|
+
?required=${this.adapter.templateData.validator?.required}
|
|
31
|
+
?disabled=${this.adapter.templateData.disabled}
|
|
32
|
+
?readonly=${this.adapter.templateData.readonly}
|
|
33
|
+
.value=${this.adapter.templateData.value}
|
|
34
|
+
.prevMonthIcon=${this.adapter.templateData.prevMonthIcon}
|
|
35
|
+
.nextMonthIcon=${this.adapter.templateData.nextMonthIcon}
|
|
36
|
+
.prevMonthAriaLabel=${this.adapter.templateData.prevMonthAriaLabel}
|
|
37
|
+
.nextMonthAriaLabel=${this.adapter.templateData.nextMonthAriaLabel}
|
|
38
|
+
.dayFormat=${this.adapter.templateData.dayFormat}
|
|
39
|
+
.weekdayFormat=${this.adapter.templateData.weekdayFormat}
|
|
40
|
+
.monthFormat=${this.adapter.templateData.monthFormat}
|
|
41
|
+
.minDate=${this.adapter.templateData.minDate}
|
|
42
|
+
.maxDate=${this.adapter.templateData.maxDate}
|
|
43
|
+
.disabledRanges=${this.adapter.templateData.disabledRanges}
|
|
44
|
+
.numberOfMonths=${this.adapter.templateData.numberOfMonths}
|
|
45
|
+
.localeId=${this.adapter.templateData.lang}
|
|
46
|
+
@change=${this.valueChanged}
|
|
47
|
+
></gui-calendar>
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
valueChanged(a) {
|
|
51
|
+
const e = a?.target;
|
|
52
|
+
this.adapter.valueChanged(e.value);
|
|
53
|
+
}
|
|
54
|
+
disconnectedCallback() {
|
|
55
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((a) => a.unsubscribe());
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
o([
|
|
59
|
+
l({ context: d.formContext }),
|
|
60
|
+
u({ attribute: !1 })
|
|
61
|
+
], s.prototype, "formContext", 2);
|
|
62
|
+
o([
|
|
63
|
+
h({ context: d.inputContext })
|
|
64
|
+
], s.prototype, "adapter", 2);
|
|
65
|
+
s = o([
|
|
66
|
+
D("gui-calendar-input")
|
|
67
|
+
], s);
|
|
68
|
+
export {
|
|
69
|
+
s as CalendarElement
|
|
70
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as d from "@golemui/lit";
|
|
2
|
+
import { consume as n, provide as h } from "@lit/context";
|
|
3
|
+
import { LitElement as c, html as u } from "lit";
|
|
4
|
+
import { property as m, customElement as b } from "lit/decorators.js";
|
|
5
|
+
var x = Object.defineProperty, f = Object.getOwnPropertyDescriptor, l = (e, t, i, r) => {
|
|
6
|
+
for (var a = r > 1 ? void 0 : r ? f(t, i) : t, o = e.length - 1, p; o >= 0; o--)
|
|
7
|
+
(p = e[o]) && (a = (r ? p(t, i, a) : p(a)) || a);
|
|
8
|
+
return r && a && x(t, i, a), a;
|
|
9
|
+
};
|
|
10
|
+
let s = class extends c {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.adapter = new d.InputWidgetAdapter(), this.subscriptions = [];
|
|
13
|
+
}
|
|
14
|
+
createRenderRoot() {
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
super.connectedCallback(), this.classList.add("gui-checkbox"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
19
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
updated(e) {
|
|
23
|
+
super.updated(e);
|
|
24
|
+
const t = this.adapter.templateData.size;
|
|
25
|
+
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return super.render(), u`
|
|
29
|
+
<gui-checkbox
|
|
30
|
+
.uid=${this.widget.uid}
|
|
31
|
+
.label=${this.adapter.templateData.label}
|
|
32
|
+
.errors=${this.adapter.templateData.errors}
|
|
33
|
+
?touched=${this.adapter.templateData.touched}
|
|
34
|
+
?required=${this.adapter.templateData.validator?.required}
|
|
35
|
+
?disabled=${this.adapter.templateData.disabled}
|
|
36
|
+
?readonly=${this.adapter.templateData.readonly}
|
|
37
|
+
.value=${this.adapter.templateData.value}
|
|
38
|
+
.hint=${this.adapter.templateData.hint}
|
|
39
|
+
.checkboxPosition=${this.adapter.templateData.checkboxPosition}
|
|
40
|
+
@change=${this.valueChanged}
|
|
41
|
+
@blur=${() => this.adapter.onBlur()}
|
|
42
|
+
></gui-checkbox>
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
valueChanged(e) {
|
|
46
|
+
const t = e.detail.value;
|
|
47
|
+
this.adapter.valueChanged(t);
|
|
48
|
+
}
|
|
49
|
+
disconnectedCallback() {
|
|
50
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
l([
|
|
54
|
+
n({ context: d.formContext }),
|
|
55
|
+
m({ attribute: !1 })
|
|
56
|
+
], s.prototype, "formContext", 2);
|
|
57
|
+
l([
|
|
58
|
+
h({ context: d.inputContext })
|
|
59
|
+
], s.prototype, "adapter", 2);
|
|
60
|
+
s = l([
|
|
61
|
+
b("gui-checkbox-input")
|
|
62
|
+
], s);
|
|
63
|
+
export {
|
|
64
|
+
s as CheckboxElement
|
|
65
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as n from "@golemui/lit";
|
|
2
|
+
import { consume as o, provide as u } from "@lit/context";
|
|
3
|
+
import { LitElement as c, html as h } from "lit";
|
|
4
|
+
import { property as m, customElement as D } from "lit/decorators.js";
|
|
5
|
+
var b = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, d = (e, t, s, r) => {
|
|
6
|
+
for (var a = r > 1 ? void 0 : r ? $(t, s) : t, p = e.length - 1, l; p >= 0; p--)
|
|
7
|
+
(l = e[p]) && (a = (r ? l(t, s, a) : l(a)) || a);
|
|
8
|
+
return r && a && b(t, s, a), a;
|
|
9
|
+
};
|
|
10
|
+
let i = class extends c {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.adapter = new n.InputWidgetAdapter(), this.subscriptions = [];
|
|
13
|
+
}
|
|
14
|
+
createRenderRoot() {
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
super.connectedCallback(), this.classList.add("gui-currency"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
19
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
updated(e) {
|
|
23
|
+
super.updated(e);
|
|
24
|
+
const t = this.adapter.templateData.size;
|
|
25
|
+
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return super.render(), h`
|
|
29
|
+
<gui-currency
|
|
30
|
+
.uid=${this.widget.uid}
|
|
31
|
+
.label=${this.adapter.templateData.label}
|
|
32
|
+
.hint=${this.adapter.templateData.hint}
|
|
33
|
+
.errors=${this.adapter.templateData.errors}
|
|
34
|
+
?touched=${this.adapter.templateData.touched}
|
|
35
|
+
?required=${this.adapter.templateData.validator?.required}
|
|
36
|
+
?disabled=${this.adapter.templateData.disabled}
|
|
37
|
+
?readonly=${this.adapter.templateData.readonly}
|
|
38
|
+
.value=${this.adapter.templateData.value}
|
|
39
|
+
.currency=${this.adapter.templateData.currency}
|
|
40
|
+
.step=${this.adapter.templateData.step}
|
|
41
|
+
.maximumFractionDigits=${this.adapter.templateData.maximumFractionDigits}
|
|
42
|
+
.minimumFractionDigits=${this.adapter.templateData.minimumFractionDigits}
|
|
43
|
+
.icon=${this.adapter.templateData.icon}
|
|
44
|
+
.placeholder=${this.adapter.templateData.placeholder}
|
|
45
|
+
.localeId=${this.adapter.templateData.lang}
|
|
46
|
+
@input=${this.valueChanged}
|
|
47
|
+
@blur=${() => this.adapter.onBlur()}
|
|
48
|
+
></gui-currency>
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
valueChanged(e) {
|
|
52
|
+
const t = e.detail.value;
|
|
53
|
+
this.adapter.valueChanged(t);
|
|
54
|
+
}
|
|
55
|
+
disconnectedCallback() {
|
|
56
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
d([
|
|
60
|
+
o({ context: n.formContext }),
|
|
61
|
+
m({ attribute: !1 })
|
|
62
|
+
], i.prototype, "formContext", 2);
|
|
63
|
+
d([
|
|
64
|
+
u({ context: n.inputContext })
|
|
65
|
+
], i.prototype, "adapter", 2);
|
|
66
|
+
i = d([
|
|
67
|
+
D("gui-currency-input")
|
|
68
|
+
], i);
|
|
69
|
+
export {
|
|
70
|
+
i as CurrencyElement
|
|
71
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import * as l from "@golemui/lit";
|
|
2
|
+
import { addIcon as c, addLabel as u, addErrors as m } from "@golemui/gui-components";
|
|
3
|
+
import { consume as $, provide as C } from "@lit/context";
|
|
4
|
+
import { LitElement as D, html as o, nothing as v } from "lit";
|
|
5
|
+
import { property as g, query as h, state as b, customElement as f } from "lit/decorators.js";
|
|
6
|
+
import { classMap as y } from "lit/directives/class-map.js";
|
|
7
|
+
var I = Object.defineProperty, k = Object.getOwnPropertyDescriptor, s = (t, e, n, i) => {
|
|
8
|
+
for (var a = i > 1 ? void 0 : i ? k(e, n) : e, d = t.length - 1, p; d >= 0; d--)
|
|
9
|
+
(p = t[d]) && (a = (i ? p(e, n, a) : p(a)) || a);
|
|
10
|
+
return i && a && I(e, n, a), a;
|
|
11
|
+
};
|
|
12
|
+
let r = class extends D {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.adapter = new l.InputWidgetAdapter(), this.isCalendarOpen = !1, this.subscriptions = [], this.onDocumentClick = (t) => {
|
|
15
|
+
if (!this.isCalendarOpen) return;
|
|
16
|
+
const e = t.composedPath(), n = this.dateInput && e.includes(this.dateInput), i = this.calendarInput && e.includes(this.calendarInput);
|
|
17
|
+
!n && !i && this.closeCalendar();
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
createRenderRoot() {
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
super.connectedCallback(), document.addEventListener("click", this.onDocumentClick), this.classList.add("gui-date-picker"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
25
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
updated(t) {
|
|
29
|
+
super.updated(t);
|
|
30
|
+
const e = this.adapter.templateData.size;
|
|
31
|
+
e ? this.style.flex = String(e) : this.style.removeProperty("flex");
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
super.render();
|
|
35
|
+
const t = c("datePicker", this.adapter.templateData), e = this.isCalendarOpen ? o`<gui-calendar
|
|
36
|
+
id="calendar-input"
|
|
37
|
+
.uid=${this.widget.uid}
|
|
38
|
+
.hint=${this.adapter.templateData.hint}
|
|
39
|
+
?touched=${this.adapter.templateData.touched}
|
|
40
|
+
?required=${this.adapter.templateData.validator?.required}
|
|
41
|
+
?disabled=${this.adapter.templateData.disabled}
|
|
42
|
+
?readonly=${this.adapter.templateData.readonly}
|
|
43
|
+
.value=${this.adapter.templateData.value}
|
|
44
|
+
.prevMonthIcon=${this.adapter.templateData.prevMonthIcon}
|
|
45
|
+
.nextMonthIcon=${this.adapter.templateData.nextMonthIcon}
|
|
46
|
+
.prevMonthAriaLabel=${this.adapter.templateData.prevMonthAriaLabel}
|
|
47
|
+
.nextMonthAriaLabel=${this.adapter.templateData.nextMonthAriaLabel}
|
|
48
|
+
.dayFormat=${this.adapter.templateData.dayFormat}
|
|
49
|
+
.weekdayFormat=${this.adapter.templateData.weekdayFormat}
|
|
50
|
+
.monthFormat=${this.adapter.templateData.monthFormat}
|
|
51
|
+
.localeId=${this.adapter.templateData.lang}
|
|
52
|
+
@blur=${this.onBlurCalendar}
|
|
53
|
+
@change=${this.valueChanged}
|
|
54
|
+
></gui-calendar>` : v;
|
|
55
|
+
return o`
|
|
56
|
+
${u(this.widget.uid, this.adapter.templateData)}
|
|
57
|
+
|
|
58
|
+
<div
|
|
59
|
+
role="button"
|
|
60
|
+
tabindex="0"
|
|
61
|
+
class="gui-widget"
|
|
62
|
+
aria-expanded=${this.isCalendarOpen}
|
|
63
|
+
@keyup=${() => this.onKeyUp(event)}
|
|
64
|
+
@click=${() => this.openCalendar()}
|
|
65
|
+
>
|
|
66
|
+
<gui-date
|
|
67
|
+
id="date-input"
|
|
68
|
+
class=${y(t.widgetClasses)}
|
|
69
|
+
.uid=${this.widget.uid}
|
|
70
|
+
.hint=${this.adapter.templateData.hint}
|
|
71
|
+
.showErrors=${!1}
|
|
72
|
+
.errors=${this.adapter.templateData.errors}
|
|
73
|
+
?touched=${this.adapter.templateData.touched}
|
|
74
|
+
?required=${this.adapter.templateData.validator?.required}
|
|
75
|
+
?disabled=${this.adapter.templateData.disabled}
|
|
76
|
+
?readonly=${this.adapter.templateData.readonly}
|
|
77
|
+
.value=${this.adapter.templateData.value}
|
|
78
|
+
.icon=${this.adapter.templateData.icon}
|
|
79
|
+
.localeId=${this.adapter.templateData.lang}
|
|
80
|
+
@inputError=${this.onInputError}
|
|
81
|
+
@blur=${() => this.adapter.onBlur()}
|
|
82
|
+
@focus=${this.openCalendar}
|
|
83
|
+
@change=${this.valueChanged}
|
|
84
|
+
></gui-date>
|
|
85
|
+
|
|
86
|
+
${e}
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
${m(this.widget.uid, this.adapter.templateData)}
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
valueChanged(t) {
|
|
93
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(t.detail.value);
|
|
94
|
+
}
|
|
95
|
+
onBlurCalendar() {
|
|
96
|
+
this.adapter.onBlur(), this.closeCalendar();
|
|
97
|
+
}
|
|
98
|
+
onInputError(t) {
|
|
99
|
+
this.adapter.injectValidationIssues([t.detail.message]);
|
|
100
|
+
}
|
|
101
|
+
onKeyUp(t) {
|
|
102
|
+
const e = t;
|
|
103
|
+
(e?.key === "Enter" || e?.key === " ") && this.openCalendar();
|
|
104
|
+
}
|
|
105
|
+
openCalendar() {
|
|
106
|
+
this.isCalendarOpen = !0, this.requestUpdate();
|
|
107
|
+
}
|
|
108
|
+
closeCalendar() {
|
|
109
|
+
this.isCalendarOpen = !1, this.requestUpdate();
|
|
110
|
+
}
|
|
111
|
+
disconnectedCallback() {
|
|
112
|
+
super.disconnectedCallback(), document.removeEventListener("click", this.onDocumentClick), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
s([
|
|
116
|
+
$({ context: l.formContext }),
|
|
117
|
+
g({ attribute: !1 })
|
|
118
|
+
], r.prototype, "formContext", 2);
|
|
119
|
+
s([
|
|
120
|
+
C({ context: l.inputContext })
|
|
121
|
+
], r.prototype, "adapter", 2);
|
|
122
|
+
s([
|
|
123
|
+
h("#date-input")
|
|
124
|
+
], r.prototype, "dateInput", 2);
|
|
125
|
+
s([
|
|
126
|
+
h("#calendar-input")
|
|
127
|
+
], r.prototype, "calendarInput", 2);
|
|
128
|
+
s([
|
|
129
|
+
b()
|
|
130
|
+
], r.prototype, "isCalendarOpen", 2);
|
|
131
|
+
r = s([
|
|
132
|
+
f("gui-date-picker-input")
|
|
133
|
+
], r);
|
|
134
|
+
export {
|
|
135
|
+
r as DatePickerElement
|
|
136
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as o from "@golemui/lit";
|
|
2
|
+
import { addIcon as n } from "@golemui/gui-components";
|
|
3
|
+
import { consume as u, provide as h } from "@lit/context";
|
|
4
|
+
import { LitElement as c, html as m } from "lit";
|
|
5
|
+
import { property as b, customElement as f } from "lit/decorators.js";
|
|
6
|
+
import { classMap as g } from "lit/directives/class-map.js";
|
|
7
|
+
var D = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, l = (t, e, i, r) => {
|
|
8
|
+
for (var a = r > 1 ? void 0 : r ? $(e, i) : e, p = t.length - 1, d; p >= 0; p--)
|
|
9
|
+
(d = t[p]) && (a = (r ? d(e, i, a) : d(a)) || a);
|
|
10
|
+
return r && a && D(e, i, a), a;
|
|
11
|
+
};
|
|
12
|
+
let s = class extends c {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.adapter = new o.InputWidgetAdapter(), this.subscriptions = [];
|
|
15
|
+
}
|
|
16
|
+
createRenderRoot() {
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
connectedCallback() {
|
|
20
|
+
super.connectedCallback(), this.classList.add("gui-date"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
21
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
updated(t) {
|
|
25
|
+
super.updated(t);
|
|
26
|
+
const e = this.adapter.templateData.size;
|
|
27
|
+
e ? this.style.flex = String(e) : this.style.removeProperty("flex");
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
super.render();
|
|
31
|
+
const t = n("date", this.adapter.templateData);
|
|
32
|
+
return m`
|
|
33
|
+
<gui-date
|
|
34
|
+
class=${g(t.widgetClasses)}
|
|
35
|
+
.uid=${this.widget.uid}
|
|
36
|
+
.label=${this.adapter.templateData.label}
|
|
37
|
+
.hint=${this.adapter.templateData.hint}
|
|
38
|
+
.errors=${this.adapter.templateData.errors}
|
|
39
|
+
?touched=${this.adapter.templateData.touched}
|
|
40
|
+
?required=${this.adapter.templateData.validator?.required}
|
|
41
|
+
?disabled=${this.adapter.templateData.disabled}
|
|
42
|
+
?readonly=${this.adapter.templateData.readonly}
|
|
43
|
+
.value=${this.adapter.templateData.value}
|
|
44
|
+
.icon=${this.adapter.templateData.icon}
|
|
45
|
+
.localeId=${this.adapter.templateData.lang}
|
|
46
|
+
@inputError=${this.onInputError}
|
|
47
|
+
@blur=${() => this.adapter.onBlur()}
|
|
48
|
+
@change=${this.valueChanged}
|
|
49
|
+
></gui-date>
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
valueChanged(t) {
|
|
53
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(t.detail.value);
|
|
54
|
+
}
|
|
55
|
+
onInputError(t) {
|
|
56
|
+
this.adapter.injectValidationIssues([t.detail.message]);
|
|
57
|
+
}
|
|
58
|
+
disconnectedCallback() {
|
|
59
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
l([
|
|
63
|
+
u({ context: o.formContext }),
|
|
64
|
+
b({ attribute: !1 })
|
|
65
|
+
], s.prototype, "formContext", 2);
|
|
66
|
+
l([
|
|
67
|
+
h({ context: o.inputContext })
|
|
68
|
+
], s.prototype, "adapter", 2);
|
|
69
|
+
s = l([
|
|
70
|
+
f("gui-date-input")
|
|
71
|
+
], s);
|
|
72
|
+
export {
|
|
73
|
+
s as DateElement
|
|
74
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { html as i } from "lit";
|
|
2
|
+
import { classMap as t } from "lit/directives/class-map.js";
|
|
3
|
+
const a = (e) => {
|
|
4
|
+
const s = {
|
|
5
|
+
"gui-list__item": !0,
|
|
6
|
+
"gui-list__item-selected": !!e.selected,
|
|
7
|
+
"gui-list__item-focused": !!e.focused,
|
|
8
|
+
"gui-list__item-disabled": !!e.disabled
|
|
9
|
+
};
|
|
10
|
+
return i`
|
|
11
|
+
<div
|
|
12
|
+
role="option"
|
|
13
|
+
class=${t(s)}
|
|
14
|
+
aria-selected=${e.selected ? "true" : "false"}
|
|
15
|
+
aria-disabled=${e.disabled ? "true" : "false"}
|
|
16
|
+
>
|
|
17
|
+
${e.template}
|
|
18
|
+
</div>
|
|
19
|
+
`;
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
a as d
|
|
23
|
+
};
|