@golemui/gui-lit 0.0.2 → 0.12.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/README.md +17 -4
- package/{accordion.element-D1RfC2ew.js → accordion.element-81uTv6Ms.js} +29 -18
- package/{alert.element-B4rpyqGV.js → alert.element-DWrS5ggK.js} +17 -17
- package/button.element-hjhVBamJ.js +56 -0
- package/{calendar.element-D7mAbpAa.js → calendar.element-C1rLK7aY.js} +24 -18
- package/{checkbox.element--Kc7sWBx.js → checkbox.element-bu9_MvED.js} +8 -8
- package/{currency.element-D9dyGRBH.js → currency.element-Bxv2WxAx.js} +20 -19
- package/date-picker.element-GNC8f3Qi.js +157 -0
- package/{date.element-na_Uywms.js → date.element-Dzw-UJzC.js} +10 -10
- package/{dropdown.element-Cfj40aJz.js → dropdown.element-CebROj9s.js} +95 -78
- package/flex.element-BMqqfxjI.js +77 -0
- package/grid.element-CBMoOuLt.js +75 -0
- package/index.js +1104 -1031
- package/index.umd.cjs +319 -112
- package/lib/components/accordion.element.d.ts +1 -1
- package/lib/components/alert.element.d.ts +1 -1
- package/lib/components/button.element.d.ts +3 -2
- package/lib/components/calendar.element.d.ts +1 -0
- package/lib/components/checkbox.element.d.ts +1 -1
- package/lib/components/currency.element.d.ts +1 -1
- package/lib/components/date-picker.element.d.ts +4 -2
- package/lib/components/date.element.d.ts +1 -1
- package/lib/components/dropdown.element.d.ts +1 -1
- package/lib/components/flex.element.d.ts +1 -1
- package/lib/components/form.element.d.ts +6 -16
- package/lib/components/grid.element.d.ts +16 -0
- package/lib/components/list.element.d.ts +1 -1
- package/lib/components/markdown-text.element.d.ts +16 -0
- package/lib/components/markdown.element.d.ts +17 -0
- package/lib/components/number.element.d.ts +1 -1
- package/lib/components/password.element.d.ts +1 -1
- package/lib/components/radiogroup.element.d.ts +1 -1
- package/lib/components/range-calendar.element.d.ts +1 -0
- package/lib/components/range-date-input.element.d.ts +18 -0
- package/lib/components/range-date-picker.element.d.ts +30 -0
- package/lib/components/renderer.element.d.ts +1 -0
- package/lib/components/repeater.element.d.ts +5 -1
- package/lib/components/select.element.d.ts +1 -1
- package/lib/components/tabs.element.d.ts +1 -1
- package/lib/components/textarea.element.d.ts +1 -1
- package/lib/components/textinput.element.d.ts +1 -1
- package/lib/components/toggle.element.d.ts +1 -1
- package/lib/widget.loaders.d.ts +2 -2
- package/{list.element--aj6sNNU.js → list.element-DIIgN_Ww.js} +66 -59
- package/markdown-text.element-DY7b-dU5.js +53 -0
- package/markdown.element-ZD_n4ObO.js +73 -0
- package/{number.element-Bl5YReaL.js → number.element-B0E7W2TK.js} +20 -19
- package/package.json +11 -6
- package/{password.element-CKmcH8Gn.js → password.element-C4_eLdUO.js} +11 -10
- package/{radiogroup.element-Cn1lyyVE.js → radiogroup.element-BD8qBNoO.js} +8 -7
- package/{range-calendar.element-C2YUElqM.js → range-calendar.element-Bli9UfhN.js} +35 -27
- package/range-date-input.element-BwPvGk5F.js +72 -0
- package/range-date-picker.element-DJQOwDPh.js +170 -0
- package/renderer.element-B99qD2mz.js +48 -0
- package/repeater.element-AaifWsOB.js +136 -0
- package/{select.element-LWiqYxzA.js → select.element-BLxtqB0A.js} +9 -8
- package/{tabs.element-DYg1wAz9.js → tabs.element-k8JMNDXi.js} +18 -16
- package/{textarea.element-BXc-rLZE.js → textarea.element-DgDwfzYP.js} +14 -14
- package/{textinput.element-x9LYeW8B.js → textinput.element-DSLFDjfb.js} +17 -16
- package/{toggle.element-BP4YKWyR.js → toggle.element-BLu6F99u.js} +5 -5
- package/CHANGELOG.md +0 -529
- package/button.element-BnUBVNSH.js +0 -58
- package/date-picker.element-Dcs5OpxN.js +0 -136
- package/flex.element-BSMOum-h.js +0 -65
- package/renderer.element-B7AjPqr2.js +0 -43
- package/repeater.element-BfwzCooC.js +0 -83
package/README.md
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
# gui-lit
|
|
1
|
+
# @golemui/gui-lit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[Golem UI](https://golemui.com): the declarative form engine.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install @golemui/gui-lit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
- Website: https://golemui.com
|
|
14
|
+
- Repository: https://github.com/golemui/golemui
|
|
15
|
+
- Source: https://github.com/golemui/golemui/tree/main/libs/gui/lit
|
|
16
|
+
- Issues: https://github.com/golemui/golemui/issues
|
|
17
|
+
|
|
18
|
+
## License
|
|
19
|
+
|
|
20
|
+
MIT
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import * as d from "@golemui/lit";
|
|
2
2
|
import { consume as u, provide as h } from "@lit/context";
|
|
3
|
-
import { LitElement as
|
|
4
|
-
import { property as
|
|
5
|
-
import { repeat as
|
|
3
|
+
import { LitElement as g, html as r, nothing as l } from "lit";
|
|
4
|
+
import { property as m, customElement as v } from "lit/decorators.js";
|
|
5
|
+
import { repeat as f } from "lit-html/directives/repeat.js";
|
|
6
6
|
import { classMap as b } from "lit/directives/class-map.js";
|
|
7
|
-
var
|
|
8
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
9
|
-
(
|
|
10
|
-
return a && s &&
|
|
7
|
+
var w = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, p = (t, e, i, a) => {
|
|
8
|
+
for (var s = a > 1 ? void 0 : a ? _(e, i) : e, n = t.length - 1, c; n >= 0; n--)
|
|
9
|
+
(c = t[n]) && (s = (a ? c(e, i, s) : c(s)) || s);
|
|
10
|
+
return a && s && w(e, i, s), s;
|
|
11
11
|
};
|
|
12
|
-
let o = class extends
|
|
12
|
+
let o = class extends g {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments), this.activeSections = {}, this.adapter = new d.LayoutWidgetAdapter(), this.subscriptions = [];
|
|
15
15
|
}
|
|
16
16
|
createRenderRoot() {
|
|
17
17
|
return this;
|
|
18
18
|
}
|
|
19
|
+
updated(t) {
|
|
20
|
+
super.updated(t);
|
|
21
|
+
const e = this.adapter.templateData.size;
|
|
22
|
+
e ? this.style.flex = String(e) : this.style.removeProperty("flex");
|
|
23
|
+
}
|
|
19
24
|
connectedCallback() {
|
|
20
|
-
super.connectedCallback(), this.classList.add("gui-accordion");
|
|
25
|
+
super.connectedCallback(), this.classList.add("gui-accordion", "gui-field");
|
|
21
26
|
const t = this.widget.props;
|
|
22
27
|
this.adapter.context = this.formContext, this.adapter.init(this.widget), this.activeSections = t.defaultOpen ?? {}, this.subscriptions.push(
|
|
23
28
|
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
@@ -31,15 +36,10 @@ let o = class extends m {
|
|
|
31
36
|
getChild(t) {
|
|
32
37
|
return this.widget.children.find((e) => e.uid === t);
|
|
33
38
|
}
|
|
34
|
-
updated(t) {
|
|
35
|
-
super.updated(t);
|
|
36
|
-
const e = this.adapter.templateData.size;
|
|
37
|
-
e ? this.style.flex = String(e) : this.style.removeProperty("flex");
|
|
38
|
-
}
|
|
39
39
|
render() {
|
|
40
40
|
return this.adapter.templateData ? r`
|
|
41
41
|
<div class="gui-widget" id=${this.widget.uid}>
|
|
42
|
-
${this.adapter.templateData.sections ?
|
|
42
|
+
${this.adapter.templateData.sections ? f(
|
|
43
43
|
this.adapter.templateData.sections,
|
|
44
44
|
(t) => t.uid,
|
|
45
45
|
(t) => {
|
|
@@ -55,6 +55,7 @@ let o = class extends m {
|
|
|
55
55
|
return r`<div class="gui-accordion__section">
|
|
56
56
|
<button
|
|
57
57
|
type="button"
|
|
58
|
+
tabindex="0"
|
|
58
59
|
class=${b({
|
|
59
60
|
active: this.activeSections[t.uid]
|
|
60
61
|
})}
|
|
@@ -63,7 +64,17 @@ let o = class extends m {
|
|
|
63
64
|
aria-expanded=${this.activeSections[t.uid] ? "true" : "false"}
|
|
64
65
|
@click=${() => this.onClickButton(t.uid)}
|
|
65
66
|
>
|
|
66
|
-
${t.label}<span class="gui-
|
|
67
|
+
${t.label}<span class="gui-accordion__arrow"
|
|
68
|
+
><svg
|
|
69
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
70
|
+
width="16"
|
|
71
|
+
height="16"
|
|
72
|
+
viewBox="0 0 256 256"
|
|
73
|
+
>
|
|
74
|
+
<path
|
|
75
|
+
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"
|
|
76
|
+
></path></svg
|
|
77
|
+
></span>
|
|
67
78
|
</button>
|
|
68
79
|
|
|
69
80
|
${e}
|
|
@@ -79,13 +90,13 @@ let o = class extends m {
|
|
|
79
90
|
};
|
|
80
91
|
p([
|
|
81
92
|
u({ context: d.formContext }),
|
|
82
|
-
|
|
93
|
+
m({ attribute: !1 })
|
|
83
94
|
], o.prototype, "formContext", 2);
|
|
84
95
|
p([
|
|
85
96
|
h({ context: d.layoutContext })
|
|
86
97
|
], o.prototype, "adapter", 2);
|
|
87
98
|
o = p([
|
|
88
|
-
|
|
99
|
+
v("gui-accordion-layout")
|
|
89
100
|
], o);
|
|
90
101
|
export {
|
|
91
102
|
o as AccordionElement
|
|
@@ -2,28 +2,28 @@ import { LitElement as n, html as c } from "lit";
|
|
|
2
2
|
import { property as u, customElement as h } from "lit/decorators.js";
|
|
3
3
|
import { consume as m, provide as f } from "@lit/context";
|
|
4
4
|
import * as l from "@golemui/lit";
|
|
5
|
-
var b = Object.defineProperty, g = Object.getOwnPropertyDescriptor, d = (
|
|
6
|
-
for (var e =
|
|
7
|
-
(p =
|
|
8
|
-
return
|
|
5
|
+
var b = Object.defineProperty, g = Object.getOwnPropertyDescriptor, d = (i, t, a, r) => {
|
|
6
|
+
for (var e = r > 1 ? void 0 : r ? g(t, a) : t, o = i.length - 1, p; o >= 0; o--)
|
|
7
|
+
(p = i[o]) && (e = (r ? p(t, a, e) : p(e)) || e);
|
|
8
|
+
return r && e && b(t, a, e), e;
|
|
9
9
|
};
|
|
10
|
-
let
|
|
10
|
+
let s = class extends n {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments), this.adapter = new l.DisplayWidgetAdapter(), this.subscriptions = [];
|
|
13
13
|
}
|
|
14
14
|
createRenderRoot() {
|
|
15
15
|
return this;
|
|
16
16
|
}
|
|
17
|
+
updated(i) {
|
|
18
|
+
super.updated(i);
|
|
19
|
+
const t = this.adapter.templateData.size;
|
|
20
|
+
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
21
|
+
}
|
|
17
22
|
connectedCallback() {
|
|
18
|
-
super.connectedCallback(), this.classList.add("gui-alert"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
23
|
+
super.connectedCallback(), this.classList.add("gui-alert", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
19
24
|
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
20
25
|
);
|
|
21
26
|
}
|
|
22
|
-
updated(r) {
|
|
23
|
-
super.updated(r);
|
|
24
|
-
const t = this.adapter.templateData.size;
|
|
25
|
-
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
26
|
-
}
|
|
27
27
|
render() {
|
|
28
28
|
return c`
|
|
29
29
|
<div class="gui-widget" id=${this.widget.uid}>
|
|
@@ -37,19 +37,19 @@ let i = class extends n {
|
|
|
37
37
|
`;
|
|
38
38
|
}
|
|
39
39
|
disconnectedCallback() {
|
|
40
|
-
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((
|
|
40
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((i) => i.unsubscribe());
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
d([
|
|
44
44
|
m({ context: l.formContext }),
|
|
45
45
|
u({ attribute: !1 })
|
|
46
|
-
],
|
|
46
|
+
], s.prototype, "formContext", 2);
|
|
47
47
|
d([
|
|
48
48
|
f({ context: l.displayWidgetContext })
|
|
49
|
-
],
|
|
50
|
-
|
|
49
|
+
], s.prototype, "adapter", 2);
|
|
50
|
+
s = d([
|
|
51
51
|
h("gui-alert-display")
|
|
52
|
-
],
|
|
52
|
+
], s);
|
|
53
53
|
export {
|
|
54
|
-
|
|
54
|
+
s as AlertElement
|
|
55
55
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as p from "@golemui/lit";
|
|
2
|
+
import { consume as d, provide as l } from "@lit/context";
|
|
3
|
+
import { LitElement as u, html as h } from "lit";
|
|
4
|
+
import { property as m, customElement as b } from "lit/decorators.js";
|
|
5
|
+
var f = Object.defineProperty, g = Object.getOwnPropertyDescriptor, c = (a, t, s, i) => {
|
|
6
|
+
for (var e = i > 1 ? void 0 : i ? g(t, s) : t, o = a.length - 1, n; o >= 0; o--)
|
|
7
|
+
(n = a[o]) && (e = (i ? n(t, s, e) : n(e)) || e);
|
|
8
|
+
return i && e && f(t, s, e), e;
|
|
9
|
+
};
|
|
10
|
+
let r = class extends u {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.adapter = new p.ActionWidgetAdapter(), this.subscriptions = [];
|
|
13
|
+
}
|
|
14
|
+
createRenderRoot() {
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
updated(a) {
|
|
18
|
+
super.updated(a);
|
|
19
|
+
const t = this.adapter.templateData.size;
|
|
20
|
+
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
super.connectedCallback(), this.classList.add("gui-button", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
24
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return h`
|
|
29
|
+
<gui-button
|
|
30
|
+
.uid=${this.widget.uid}
|
|
31
|
+
.label=${this.adapter.templateData.label}
|
|
32
|
+
?disabled=${this.adapter.templateData.disabled === !0}
|
|
33
|
+
.variant=${this.adapter.templateData.variant}
|
|
34
|
+
.icon=${this.adapter.templateData.icon}
|
|
35
|
+
.iconPosition=${this.adapter.templateData.iconPosition}
|
|
36
|
+
@click=${() => this.adapter.click()}
|
|
37
|
+
></gui-button>
|
|
38
|
+
`;
|
|
39
|
+
}
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((a) => a.unsubscribe());
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
c([
|
|
45
|
+
d({ context: p.formContext }),
|
|
46
|
+
m({ attribute: !1 })
|
|
47
|
+
], r.prototype, "formContext", 2);
|
|
48
|
+
c([
|
|
49
|
+
l({ context: p.actionContext })
|
|
50
|
+
], r.prototype, "adapter", 2);
|
|
51
|
+
r = c([
|
|
52
|
+
b("gui-button-interactive")
|
|
53
|
+
], r);
|
|
54
|
+
export {
|
|
55
|
+
r as ButtonElement
|
|
56
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as d from "@golemui/lit";
|
|
2
|
-
import { consume as
|
|
3
|
-
import { LitElement as m, html as
|
|
4
|
-
import { property as
|
|
5
|
-
var b = Object.defineProperty, $ = Object.getOwnPropertyDescriptor,
|
|
6
|
-
for (var
|
|
7
|
-
(n =
|
|
8
|
-
return r &&
|
|
2
|
+
import { consume as o, provide as h } from "@lit/context";
|
|
3
|
+
import { LitElement as m, html as u } from "lit";
|
|
4
|
+
import { property as c, customElement as D } from "lit/decorators.js";
|
|
5
|
+
var b = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, l = (e, t, i, r) => {
|
|
6
|
+
for (var a = r > 1 ? void 0 : r ? $(t, i) : t, p = e.length - 1, n; p >= 0; p--)
|
|
7
|
+
(n = e[p]) && (a = (r ? n(t, i, a) : n(a)) || a);
|
|
8
|
+
return r && a && b(t, i, a), a;
|
|
9
9
|
};
|
|
10
10
|
let s = class extends m {
|
|
11
11
|
constructor() {
|
|
@@ -14,13 +14,18 @@ let s = class extends m {
|
|
|
14
14
|
createRenderRoot() {
|
|
15
15
|
return this;
|
|
16
16
|
}
|
|
17
|
+
updated(e) {
|
|
18
|
+
super.updated(e);
|
|
19
|
+
const t = this.adapter.templateData.size;
|
|
20
|
+
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
21
|
+
}
|
|
17
22
|
connectedCallback() {
|
|
18
|
-
super.connectedCallback(), this.classList.add("gui-calendar"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
23
|
+
super.connectedCallback(), this.classList.add("gui-calendar", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
19
24
|
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
20
25
|
);
|
|
21
26
|
}
|
|
22
27
|
render() {
|
|
23
|
-
return super.render(),
|
|
28
|
+
return super.render(), u`
|
|
24
29
|
<gui-calendar
|
|
25
30
|
.uid=${this.widget.uid}
|
|
26
31
|
.label=${this.adapter.templateData.label}
|
|
@@ -44,25 +49,26 @@ let s = class extends m {
|
|
|
44
49
|
.numberOfMonths=${this.adapter.templateData.numberOfMonths}
|
|
45
50
|
.localeId=${this.adapter.templateData.lang}
|
|
46
51
|
@change=${this.valueChanged}
|
|
52
|
+
@blur=${() => this.adapter.onBlur()}
|
|
47
53
|
></gui-calendar>
|
|
48
54
|
`;
|
|
49
55
|
}
|
|
50
|
-
valueChanged(
|
|
51
|
-
const
|
|
52
|
-
this.adapter.valueChanged(
|
|
56
|
+
valueChanged(e) {
|
|
57
|
+
const t = e?.target;
|
|
58
|
+
this.adapter.valueChanged(t.value);
|
|
53
59
|
}
|
|
54
60
|
disconnectedCallback() {
|
|
55
|
-
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((
|
|
61
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
56
62
|
}
|
|
57
63
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
l([
|
|
65
|
+
o({ context: d.formContext }),
|
|
66
|
+
c({ attribute: !1 })
|
|
61
67
|
], s.prototype, "formContext", 2);
|
|
62
|
-
|
|
68
|
+
l([
|
|
63
69
|
h({ context: d.inputContext })
|
|
64
70
|
], s.prototype, "adapter", 2);
|
|
65
|
-
s =
|
|
71
|
+
s = l([
|
|
66
72
|
D("gui-calendar-input")
|
|
67
73
|
], s);
|
|
68
74
|
export {
|
|
@@ -2,10 +2,10 @@ import * as d from "@golemui/lit";
|
|
|
2
2
|
import { consume as n, provide as h } from "@lit/context";
|
|
3
3
|
import { LitElement as c, html as u } from "lit";
|
|
4
4
|
import { property as m, customElement as b } from "lit/decorators.js";
|
|
5
|
-
var
|
|
6
|
-
for (var a = r > 1 ? void 0 : r ?
|
|
5
|
+
var f = Object.defineProperty, x = Object.getOwnPropertyDescriptor, l = (e, t, i, r) => {
|
|
6
|
+
for (var a = r > 1 ? void 0 : r ? x(t, i) : t, o = e.length - 1, p; o >= 0; o--)
|
|
7
7
|
(p = e[o]) && (a = (r ? p(t, i, a) : p(a)) || a);
|
|
8
|
-
return r && a &&
|
|
8
|
+
return r && a && f(t, i, a), a;
|
|
9
9
|
};
|
|
10
10
|
let s = class extends c {
|
|
11
11
|
constructor() {
|
|
@@ -14,16 +14,16 @@ let s = class extends c {
|
|
|
14
14
|
createRenderRoot() {
|
|
15
15
|
return this;
|
|
16
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
17
|
updated(e) {
|
|
23
18
|
super.updated(e);
|
|
24
19
|
const t = this.adapter.templateData.size;
|
|
25
20
|
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
26
21
|
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
super.connectedCallback(), this.classList.add("gui-checkbox", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
24
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
27
|
render() {
|
|
28
28
|
return super.render(), u`
|
|
29
29
|
<gui-checkbox
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as d from "@golemui/lit";
|
|
2
2
|
import { consume as o, provide as u } from "@lit/context";
|
|
3
|
-
import { LitElement as c, html as
|
|
4
|
-
import { property as
|
|
5
|
-
var
|
|
6
|
-
for (var a = r > 1 ? void 0 : r ?
|
|
3
|
+
import { LitElement as c, html as m } from "lit";
|
|
4
|
+
import { property as h, customElement as D } from "lit/decorators.js";
|
|
5
|
+
var $ = Object.defineProperty, b = Object.getOwnPropertyDescriptor, n = (e, t, s, r) => {
|
|
6
|
+
for (var a = r > 1 ? void 0 : r ? b(t, s) : t, p = e.length - 1, l; p >= 0; p--)
|
|
7
7
|
(l = e[p]) && (a = (r ? l(t, s, a) : l(a)) || a);
|
|
8
|
-
return r && a &&
|
|
8
|
+
return r && a && $(t, s, a), a;
|
|
9
9
|
};
|
|
10
10
|
let i = class extends c {
|
|
11
11
|
constructor() {
|
|
12
|
-
super(...arguments), this.adapter = new
|
|
12
|
+
super(...arguments), this.adapter = new d.InputWidgetAdapter(), this.subscriptions = [];
|
|
13
13
|
}
|
|
14
14
|
createRenderRoot() {
|
|
15
15
|
return this;
|
|
16
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
17
|
updated(e) {
|
|
23
18
|
super.updated(e);
|
|
24
19
|
const t = this.adapter.templateData.size;
|
|
25
20
|
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
26
21
|
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
super.connectedCallback(), this.classList.add("gui-currency", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
24
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
27
|
render() {
|
|
28
|
-
return super.render(),
|
|
28
|
+
return super.render(), m`
|
|
29
29
|
<gui-currency
|
|
30
30
|
.uid=${this.widget.uid}
|
|
31
31
|
.label=${this.adapter.templateData.label}
|
|
@@ -42,6 +42,7 @@ let i = class extends c {
|
|
|
42
42
|
.minimumFractionDigits=${this.adapter.templateData.minimumFractionDigits}
|
|
43
43
|
.icon=${this.adapter.templateData.icon}
|
|
44
44
|
.placeholder=${this.adapter.templateData.placeholder}
|
|
45
|
+
.autocomplete=${this.adapter.templateData.autocomplete}
|
|
45
46
|
.localeId=${this.adapter.templateData.lang}
|
|
46
47
|
@input=${this.valueChanged}
|
|
47
48
|
@blur=${() => this.adapter.onBlur()}
|
|
@@ -56,14 +57,14 @@ let i = class extends c {
|
|
|
56
57
|
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
57
58
|
}
|
|
58
59
|
};
|
|
59
|
-
|
|
60
|
-
o({ context:
|
|
61
|
-
|
|
60
|
+
n([
|
|
61
|
+
o({ context: d.formContext }),
|
|
62
|
+
h({ attribute: !1 })
|
|
62
63
|
], i.prototype, "formContext", 2);
|
|
63
|
-
|
|
64
|
-
u({ context:
|
|
64
|
+
n([
|
|
65
|
+
u({ context: d.inputContext })
|
|
65
66
|
], i.prototype, "adapter", 2);
|
|
66
|
-
i =
|
|
67
|
+
i = n([
|
|
67
68
|
D("gui-currency-input")
|
|
68
69
|
], i);
|
|
69
70
|
export {
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import * as p from "@golemui/lit";
|
|
2
|
+
import { addIcon as u, addLabel as c, addErrors as m } from "@golemui/gui-components";
|
|
3
|
+
import { consume as g, provide as C } from "@lit/context";
|
|
4
|
+
import { LitElement as D, html as o, nothing as $ } from "lit";
|
|
5
|
+
import { property as v, query as h, state as f, customElement as b } from "lit/decorators.js";
|
|
6
|
+
import { classMap as y } from "lit/directives/class-map.js";
|
|
7
|
+
var I = Object.defineProperty, O = Object.getOwnPropertyDescriptor, n = (e, t, a, i) => {
|
|
8
|
+
for (var r = i > 1 ? void 0 : i ? O(t, a) : t, d = e.length - 1, l; d >= 0; d--)
|
|
9
|
+
(l = e[d]) && (r = (i ? l(t, a, r) : l(r)) || r);
|
|
10
|
+
return i && r && I(t, a, r), r;
|
|
11
|
+
};
|
|
12
|
+
let s = class extends D {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.adapter = new p.InputWidgetAdapter(), this.isCalendarOpen = !1, this.subscriptions = [], this.onFocusOut = (e) => {
|
|
15
|
+
if (!this.isCalendarOpen) return;
|
|
16
|
+
const t = e.relatedTarget;
|
|
17
|
+
t && this.contains(t) || this.closeCalendar();
|
|
18
|
+
}, this.onDocumentClick = (e) => {
|
|
19
|
+
if (!this.isCalendarOpen) return;
|
|
20
|
+
const t = e.composedPath(), a = this.dateInput && t.includes(this.dateInput), i = this.calendarInput && t.includes(this.calendarInput);
|
|
21
|
+
!a && !i && this.closeCalendar();
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
createRenderRoot() {
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
updated(e) {
|
|
28
|
+
super.updated(e);
|
|
29
|
+
const t = this.adapter.templateData.size;
|
|
30
|
+
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
31
|
+
}
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
super.connectedCallback(), document.addEventListener("click", this.onDocumentClick), this.addEventListener("focusout", this.onFocusOut), this.classList.add("gui-date-picker", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
34
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
super.render();
|
|
39
|
+
const e = u("datePicker", this.adapter.templateData), t = this.isCalendarOpen ? o`<gui-calendar
|
|
40
|
+
id="calendar-input"
|
|
41
|
+
.uid=${this.widget.uid}
|
|
42
|
+
.hint=${this.adapter.templateData.hint}
|
|
43
|
+
?touched=${this.adapter.templateData.touched}
|
|
44
|
+
?required=${this.adapter.templateData.validator?.required}
|
|
45
|
+
?disabled=${this.adapter.templateData.disabled}
|
|
46
|
+
?readonly=${this.adapter.templateData.readonly}
|
|
47
|
+
.value=${this.adapter.templateData.value}
|
|
48
|
+
.prevMonthIcon=${this.adapter.templateData.prevMonthIcon}
|
|
49
|
+
.nextMonthIcon=${this.adapter.templateData.nextMonthIcon}
|
|
50
|
+
.prevMonthAriaLabel=${this.adapter.templateData.prevMonthAriaLabel}
|
|
51
|
+
.nextMonthAriaLabel=${this.adapter.templateData.nextMonthAriaLabel}
|
|
52
|
+
.dayFormat=${this.adapter.templateData.dayFormat}
|
|
53
|
+
.weekdayFormat=${this.adapter.templateData.weekdayFormat}
|
|
54
|
+
.monthFormat=${this.adapter.templateData.monthFormat}
|
|
55
|
+
.minDate=${this.adapter.templateData.minDate}
|
|
56
|
+
.maxDate=${this.adapter.templateData.maxDate}
|
|
57
|
+
.disabledRanges=${this.adapter.templateData.disabledRanges}
|
|
58
|
+
.numberOfMonths=${this.adapter.templateData.numberOfMonths}
|
|
59
|
+
.localeId=${this.adapter.templateData.lang}
|
|
60
|
+
@blur=${this.onBlurCalendar}
|
|
61
|
+
@change=${this.valueChanged}
|
|
62
|
+
></gui-calendar>` : $;
|
|
63
|
+
return o`
|
|
64
|
+
${c(this.widget.uid, {
|
|
65
|
+
...this.adapter.templateData,
|
|
66
|
+
required: this.adapter.templateData.validator?.required
|
|
67
|
+
})}
|
|
68
|
+
|
|
69
|
+
<div
|
|
70
|
+
role="button"
|
|
71
|
+
tabindex="-1"
|
|
72
|
+
class="gui-widget"
|
|
73
|
+
aria-expanded=${this.isCalendarOpen}
|
|
74
|
+
@keyup=${(a) => this.onKeyUp(a)}
|
|
75
|
+
@click=${(a) => this.toggleCalendar(a)}
|
|
76
|
+
>
|
|
77
|
+
<gui-date
|
|
78
|
+
id="date-input"
|
|
79
|
+
class=${y(e.widgetClasses)}
|
|
80
|
+
.uid=${this.widget.uid}
|
|
81
|
+
.hint=${this.adapter.templateData.hint}
|
|
82
|
+
.showErrors=${!1}
|
|
83
|
+
.errors=${this.adapter.templateData.errors}
|
|
84
|
+
?touched=${this.adapter.templateData.touched}
|
|
85
|
+
?required=${this.adapter.templateData.validator?.required}
|
|
86
|
+
?disabled=${this.adapter.templateData.disabled}
|
|
87
|
+
?readonly=${this.adapter.templateData.readonly}
|
|
88
|
+
.value=${this.adapter.templateData.value}
|
|
89
|
+
.icon=${this.adapter.templateData.icon}
|
|
90
|
+
.localeId=${this.adapter.templateData.lang}
|
|
91
|
+
@inputError=${this.onInputError}
|
|
92
|
+
@blur=${() => this.adapter.onBlur()}
|
|
93
|
+
@focus=${this.openCalendar}
|
|
94
|
+
@change=${this.valueChanged}
|
|
95
|
+
></gui-date>
|
|
96
|
+
<span class="gui-date-picker__arrow"
|
|
97
|
+
><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 256">
|
|
98
|
+
<path
|
|
99
|
+
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"
|
|
100
|
+
></path></svg
|
|
101
|
+
></span>
|
|
102
|
+
|
|
103
|
+
${t}
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
${m(this.widget.uid, this.adapter.templateData)}
|
|
107
|
+
`;
|
|
108
|
+
}
|
|
109
|
+
valueChanged(e) {
|
|
110
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(e.detail.value);
|
|
111
|
+
}
|
|
112
|
+
onBlurCalendar() {
|
|
113
|
+
this.adapter.onBlur(), this.closeCalendar();
|
|
114
|
+
}
|
|
115
|
+
onInputError(e) {
|
|
116
|
+
this.adapter.injectValidationIssues([e.detail.message]);
|
|
117
|
+
}
|
|
118
|
+
onKeyUp(e) {
|
|
119
|
+
const t = e;
|
|
120
|
+
t.target === t.currentTarget && (t?.key === "Enter" || t?.key === " ") && (this.isCalendarOpen = !this.isCalendarOpen, this.requestUpdate());
|
|
121
|
+
}
|
|
122
|
+
toggleCalendar(e) {
|
|
123
|
+
const t = e.target, a = t.closest(".gui-date-input__part"), i = t.closest("gui-calendar");
|
|
124
|
+
a || i ? this.openCalendar() : (this.isCalendarOpen = !this.isCalendarOpen, this.requestUpdate());
|
|
125
|
+
}
|
|
126
|
+
openCalendar() {
|
|
127
|
+
this.isCalendarOpen || (this.isCalendarOpen = !0, this.requestUpdate());
|
|
128
|
+
}
|
|
129
|
+
closeCalendar() {
|
|
130
|
+
this.isCalendarOpen = !1, this.requestUpdate();
|
|
131
|
+
}
|
|
132
|
+
disconnectedCallback() {
|
|
133
|
+
super.disconnectedCallback(), document.removeEventListener("click", this.onDocumentClick), this.removeEventListener("focusout", this.onFocusOut), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
n([
|
|
137
|
+
g({ context: p.formContext }),
|
|
138
|
+
v({ attribute: !1 })
|
|
139
|
+
], s.prototype, "formContext", 2);
|
|
140
|
+
n([
|
|
141
|
+
C({ context: p.inputContext })
|
|
142
|
+
], s.prototype, "adapter", 2);
|
|
143
|
+
n([
|
|
144
|
+
h("#date-input")
|
|
145
|
+
], s.prototype, "dateInput", 2);
|
|
146
|
+
n([
|
|
147
|
+
h("#calendar-input")
|
|
148
|
+
], s.prototype, "calendarInput", 2);
|
|
149
|
+
n([
|
|
150
|
+
f()
|
|
151
|
+
], s.prototype, "isCalendarOpen", 2);
|
|
152
|
+
s = n([
|
|
153
|
+
b("gui-date-picker-input")
|
|
154
|
+
], s);
|
|
155
|
+
export {
|
|
156
|
+
s as DatePickerElement
|
|
157
|
+
};
|
|
@@ -2,11 +2,11 @@ import * as o from "@golemui/lit";
|
|
|
2
2
|
import { addIcon as n } from "@golemui/gui-components";
|
|
3
3
|
import { consume as u, provide as h } from "@lit/context";
|
|
4
4
|
import { LitElement as c, html as m } from "lit";
|
|
5
|
-
import { property as
|
|
5
|
+
import { property as f, customElement as b } from "lit/decorators.js";
|
|
6
6
|
import { classMap as g } from "lit/directives/class-map.js";
|
|
7
7
|
var D = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, l = (t, e, i, r) => {
|
|
8
|
-
for (var a = r > 1 ? void 0 : r ? $(e, i) : e,
|
|
9
|
-
(
|
|
8
|
+
for (var a = r > 1 ? void 0 : r ? $(e, i) : e, d = t.length - 1, p; d >= 0; d--)
|
|
9
|
+
(p = t[d]) && (a = (r ? p(e, i, a) : p(a)) || a);
|
|
10
10
|
return r && a && D(e, i, a), a;
|
|
11
11
|
};
|
|
12
12
|
let s = class extends c {
|
|
@@ -16,16 +16,16 @@ let s = class extends c {
|
|
|
16
16
|
createRenderRoot() {
|
|
17
17
|
return this;
|
|
18
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
19
|
updated(t) {
|
|
25
20
|
super.updated(t);
|
|
26
21
|
const e = this.adapter.templateData.size;
|
|
27
22
|
e ? this.style.flex = String(e) : this.style.removeProperty("flex");
|
|
28
23
|
}
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
super.connectedCallback(), this.classList.add("gui-date", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
26
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
29
|
render() {
|
|
30
30
|
super.render();
|
|
31
31
|
const t = n("date", this.adapter.templateData);
|
|
@@ -61,13 +61,13 @@ let s = class extends c {
|
|
|
61
61
|
};
|
|
62
62
|
l([
|
|
63
63
|
u({ context: o.formContext }),
|
|
64
|
-
|
|
64
|
+
f({ attribute: !1 })
|
|
65
65
|
], s.prototype, "formContext", 2);
|
|
66
66
|
l([
|
|
67
67
|
h({ context: o.inputContext })
|
|
68
68
|
], s.prototype, "adapter", 2);
|
|
69
69
|
s = l([
|
|
70
|
-
|
|
70
|
+
b("gui-date-input")
|
|
71
71
|
], s);
|
|
72
72
|
export {
|
|
73
73
|
s as DateElement
|