@golemui/gui-lit 1.6.0 → 2.0.0-rc.1

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.
Files changed (96) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/accordion.element-CE1gDRCy.js +84 -0
  3. package/alert.element-Bqcad7bR.js +43 -0
  4. package/{button.element-CKYv0Glr.js → button.element-CjeUWaly.js} +23 -24
  5. package/{calendar.element-DkHZFBNr.js → calendar.element-DXI9bfFN.js} +17 -22
  6. package/{checkbox.element-MukoziRw.js → checkbox.element-D8hXKLjW.js} +18 -22
  7. package/{currency.element-DNumeSKA.js → currency.element-D8t_MtIs.js} +22 -26
  8. package/{date-picker.element-DpQmremq.js → date-picker.element-X__hfSnj.js} +16 -21
  9. package/{date-time-calendar.element-GAr8VMGa.js → date-time-calendar.element-Dmyd7LQ0.js} +17 -21
  10. package/{date-time-picker.element-Bt0GYSpS.js → date-time-picker.element-QGn5dEbf.js} +23 -27
  11. package/{date-time.element-WfLnY_Cb.js → date-time.element-B0OuRjlf.js} +20 -25
  12. package/{date.element-ChpTi2AQ.js → date.element-Ba8wmaNU.js} +13 -18
  13. package/default-list-item-renderer-sJeXkSKR.js +15 -0
  14. package/{default-multi-list-item-renderer-Cv-guvEX.js → default-multi-list-item-renderer-CG3Fuye0.js} +7 -12
  15. package/{dropdown.element-Ckh9JvEK.js → dropdown.element-C55MHVq-.js} +98 -132
  16. package/{file-upload.element-l_l_ubxJ.js → file-upload.element-B3oBEQ_s.js} +18 -23
  17. package/grid.element-CwDdlQ4b.js +54 -0
  18. package/index.js +42 -42
  19. package/index.umd.cjs +287 -374
  20. package/lib/components/accordion.element.d.ts +2 -2
  21. package/lib/components/alert.element.d.ts +0 -1
  22. package/lib/components/calendar.element.d.ts +0 -1
  23. package/lib/components/checkbox.element.d.ts +0 -1
  24. package/lib/components/currency.element.d.ts +0 -1
  25. package/lib/components/date-picker.element.d.ts +0 -1
  26. package/lib/components/date-time-calendar.element.d.ts +0 -1
  27. package/lib/components/date-time-picker.element.d.ts +0 -1
  28. package/lib/components/date-time.element.d.ts +0 -1
  29. package/lib/components/date.element.d.ts +0 -1
  30. package/lib/components/dropdown.element.d.ts +2 -6
  31. package/lib/components/file-upload.element.d.ts +0 -1
  32. package/lib/components/grid.element.d.ts +3 -3
  33. package/lib/components/list.element.d.ts +2 -8
  34. package/lib/components/markdown-text.element.d.ts +0 -1
  35. package/lib/components/markdown.element.d.ts +0 -1
  36. package/lib/components/multi-dropdown.element.d.ts +2 -6
  37. package/lib/components/multi-file-upload.element.d.ts +0 -1
  38. package/lib/components/multi-list.element.d.ts +2 -8
  39. package/lib/components/number.element.d.ts +0 -1
  40. package/lib/components/password.element.d.ts +0 -1
  41. package/lib/components/radiogroup.element.d.ts +0 -1
  42. package/lib/components/range-calendar.element.d.ts +0 -1
  43. package/lib/components/range-date-input.element.d.ts +0 -1
  44. package/lib/components/range-date-picker.element.d.ts +0 -1
  45. package/lib/components/range-date-time-calendar.element.d.ts +0 -1
  46. package/lib/components/range-date-time-input.element.d.ts +0 -1
  47. package/lib/components/range-date-time-picker.element.d.ts +0 -1
  48. package/lib/components/range-time-input.element.d.ts +0 -1
  49. package/lib/components/range-time-picker.element.d.ts +0 -1
  50. package/lib/components/renderer.element.d.ts +0 -1
  51. package/lib/components/repeater.element.d.ts +0 -1
  52. package/lib/components/select.element.d.ts +0 -1
  53. package/lib/components/tabs.element.d.ts +4 -15
  54. package/lib/components/tags.element.d.ts +0 -1
  55. package/lib/components/textarea.element.d.ts +0 -1
  56. package/lib/components/textinput.element.d.ts +0 -1
  57. package/lib/components/time-picker.element.d.ts +0 -1
  58. package/lib/components/time.element.d.ts +0 -1
  59. package/lib/components/toggle.element.d.ts +0 -1
  60. package/list.element-CIrv32zU.js +125 -0
  61. package/{markdown-text.element-DflCQwAo.js → markdown-text.element-Jos6zKYy.js} +17 -22
  62. package/{markdown.element-DUHHoi2Y.js → markdown.element-7tvZ028P.js} +11 -15
  63. package/{multi-dropdown.element-mX06nBBb.js → multi-dropdown.element-nOsP8HUx.js} +99 -135
  64. package/{multi-file-upload.element-DzAZAfc1.js → multi-file-upload.element-4h6JQgRF.js} +16 -21
  65. package/multi-list.element-CZfmTbCf.js +139 -0
  66. package/{number.element-mQSFQsYC.js → number.element-WRHwQGZz.js} +19 -23
  67. package/package.json +6 -6
  68. package/{password.element-xw5gugEg.js → password.element-DnV_PqKI.js} +17 -21
  69. package/{radiogroup.element-TqfrxVyI.js → radiogroup.element-Cqn_48Ao.js} +20 -24
  70. package/{range-calendar.element-BJr97SVA.js → range-calendar.element-V_56ZeT9.js} +13 -18
  71. package/{range-date-input.element-DDRYvP9h.js → range-date-input.element-D3ZG8OW-.js} +15 -20
  72. package/{range-date-picker.element-rdEr0_wu.js → range-date-picker.element-CaNHjueS.js} +21 -26
  73. package/{range-date-time-calendar.element-UlL1BBRJ.js → range-date-time-calendar.element-DyiiUB5Q.js} +19 -24
  74. package/{range-date-time-input.element-Cq4IdW7N.js → range-date-time-input.element-CVCPS7FC.js} +20 -25
  75. package/{range-date-time-picker.element-CnJcIN9C.js → range-date-time-picker.element-6nBQ_NZs.js} +16 -21
  76. package/{range-time-input.element-Cq0TrGe9.js → range-time-input.element-GXw45kMr.js} +12 -17
  77. package/{range-time-picker.element-BzlIuZ6m.js → range-time-picker.element-CG4PJg3u.js} +24 -29
  78. package/{renderer.element-BVwerbtL.js → renderer.element-FWOUTePl.js} +16 -21
  79. package/{repeater.element-DQNI4b7I.js → repeater.element-V508AKTJ.js} +8 -13
  80. package/{select.element-RBtbAvLx.js → select.element-BPrqKmDM.js} +17 -20
  81. package/tabs.element-CeZOk5Bj.js +88 -0
  82. package/{tags.element-CGvxhMmX.js → tags.element-CVCUsKZ0.js} +12 -17
  83. package/{textarea.element-E2ntRBtE.js → textarea.element-DrWG3xvs.js} +23 -27
  84. package/{textinput.element-0q5F5ol3.js → textinput.element-CCgsbYTB.js} +25 -29
  85. package/{time-picker.element-BiLaLr_c.js → time-picker.element-Q_OWcBVy.js} +21 -26
  86. package/{time.element-92goKRwJ.js → time.element-B0L2sriD.js} +20 -25
  87. package/{toggle.element-zDUc9Vja.js → toggle.element-BTjo7IVK.js} +18 -22
  88. package/accordion.element-BEenQrCh.js +0 -102
  89. package/alert.element-Dzv49O-1.js +0 -55
  90. package/default-list-item-renderer-CuPJ9jUD.js +0 -24
  91. package/flex.element-BW0_kx8z.js +0 -79
  92. package/grid.element-C019lV76.js +0 -78
  93. package/lib/components/flex.element.d.ts +0 -16
  94. package/list.element-UIKmXzeH.js +0 -148
  95. package/multi-list.element-Bs-UN2Cy.js +0 -162
  96. package/tabs.element-BiVaQlvt.js +0 -171
@@ -1,102 +0,0 @@
1
- import { LayoutWidgetAdapter as u, formContext as f, layoutContext as m } from "@golemui/lit";
2
- import { repeaterIndexSuffix as g, accordionSectionId as c, accordionButtonId as p } from "@golemui/gui-shared/internals";
3
- import { consume as v, provide as w } from "@lit/context";
4
- import { LitElement as x, html as s, nothing as l } from "lit";
5
- import { property as b } from "lit/decorators.js";
6
- import { unsubscribeAll as S, safeDefine as $ } from "@golemui/lit/internals";
7
- import "rxjs";
8
- import { repeat as y } from "lit-html/directives/repeat.js";
9
- import { classMap as C } from "lit/directives/class-map.js";
10
- var D = Object.defineProperty, h = (r, t, e, a) => {
11
- for (var i = void 0, d = r.length - 1, n; d >= 0; d--)
12
- (n = r[d]) && (i = n(t, e, i) || i);
13
- return i && D(t, e, i), i;
14
- };
15
- class o extends x {
16
- constructor() {
17
- super(...arguments), this.activeSections = {}, this.adapter = new u(), this.subscriptions = [], this.rowIndexSuffix = "";
18
- }
19
- createRenderRoot() {
20
- return this;
21
- }
22
- updated(t) {
23
- super.updated(t);
24
- const e = this.adapter.templateData.size;
25
- e ? this.style.flex = String(e) : this.style.removeProperty("flex");
26
- }
27
- connectedCallback() {
28
- super.connectedCallback(), this.classList.add("gui-accordion", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.activeSections = { ...this.adapter.templateData.defaultOpen ?? {} }, this.rowIndexSuffix = g(this.widget.uid), this.subscriptions.push(
29
- this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
30
- );
31
- }
32
- onClickButton(t) {
33
- this.adapter.templateData.singleOpen && Object.keys(this.activeSections).filter((e) => e !== t).forEach((e) => {
34
- this.activeSections[e] = !1;
35
- }), this.activeSections[t] = !this.activeSections[t], this.adapter.change({ ...this.activeSections }), this.requestUpdate();
36
- }
37
- getChild(t) {
38
- return (this.adapter.templateData.children ?? []).find((a) => a.uid === `${t}${this.rowIndexSuffix}`);
39
- }
40
- render() {
41
- return this.adapter.templateData ? s`
42
- <div class="gui-widget" id=${this.widget.uid}>
43
- ${this.adapter.templateData.sections ? y(
44
- this.adapter.templateData.sections,
45
- (t) => t.uid,
46
- (t) => {
47
- const e = this.getChild(t.uid), a = e !== void 0 && (this.activeSections[t.uid] || this.adapter.templateData.renderMode !== "activeOnly") ? s`<section
48
- class="gui-widget"
49
- role="region"
50
- id=${c(this.widget.uid, t.uid)}
51
- ?hidden=${!this.activeSections[t.uid] && this.adapter.templateData.renderMode !== "activeOnly"}
52
- aria-labelledby=${p(this.widget.uid, t.uid)}
53
- >
54
- <gui-widget .widget=${e}></gui-widget>
55
- </section>` : l;
56
- return s`<div class="gui-accordion__section">
57
- <button
58
- type="button"
59
- tabindex="0"
60
- class=${C({
61
- active: this.activeSections[t.uid]
62
- })}
63
- id=${p(this.widget.uid, t.uid)}
64
- aria-controls=${c(this.widget.uid, t.uid)}
65
- aria-expanded=${this.activeSections[t.uid] ? "true" : "false"}
66
- @click=${() => this.onClickButton(t.uid)}
67
- >
68
- ${t.label}<span class="gui-accordion__arrow"
69
- ><svg
70
- xmlns="http://www.w3.org/2000/svg"
71
- width="16"
72
- height="16"
73
- viewBox="0 0 256 256"
74
- >
75
- <path
76
- 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"
77
- ></path></svg
78
- ></span>
79
- </button>
80
-
81
- ${a}
82
- </div>`;
83
- }
84
- ) : l}
85
- </div>
86
- ` : s``;
87
- }
88
- disconnectedCallback() {
89
- super.disconnectedCallback(), this.adapter.destroy(), S(this.subscriptions);
90
- }
91
- }
92
- h([
93
- v({ context: f }),
94
- b({ attribute: !1 })
95
- ], o.prototype, "formContext");
96
- h([
97
- w({ context: m })
98
- ], o.prototype, "adapter");
99
- $("gui-accordion-layout", o);
100
- export {
101
- o as AccordionElement
102
- };
@@ -1,55 +0,0 @@
1
- import { LitElement as p, html as l } from "lit";
2
- import { property as n } from "lit/decorators.js";
3
- import { unsubscribeAll as c, safeDefine as u } from "@golemui/lit/internals";
4
- import { consume as m, provide as f } from "@lit/context";
5
- import { DisplayWidgetAdapter as h, formContext as g, displayWidgetContext as b } from "@golemui/lit";
6
- import "rxjs";
7
- var v = Object.defineProperty, d = (r, i, e, x) => {
8
- for (var t = void 0, a = r.length - 1, o; a >= 0; a--)
9
- (o = r[a]) && (t = o(i, e, t) || t);
10
- return t && v(i, e, t), t;
11
- };
12
- class s extends p {
13
- constructor() {
14
- super(...arguments), this.adapter = new h(), this.subscriptions = [];
15
- }
16
- createRenderRoot() {
17
- return this;
18
- }
19
- updated(i) {
20
- super.updated(i);
21
- const e = this.adapter.templateData.size;
22
- e ? this.style.flex = String(e) : this.style.removeProperty("flex");
23
- }
24
- connectedCallback() {
25
- super.connectedCallback(), this.classList.add("gui-alert", "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
- render() {
30
- return l`
31
- <div class="gui-widget" id=${this.widget.uid}>
32
- <div
33
- role="alert"
34
- class="gui-alert-notification gui-alert-notification--${this.adapter.templateData.level || "default"}"
35
- >
36
- ${this.adapter.templateData.text}
37
- </div>
38
- </div>
39
- `;
40
- }
41
- disconnectedCallback() {
42
- super.disconnectedCallback(), this.adapter.destroy(), c(this.subscriptions);
43
- }
44
- }
45
- d([
46
- m({ context: g }),
47
- n({ attribute: !1 })
48
- ], s.prototype, "formContext");
49
- d([
50
- f({ context: b })
51
- ], s.prototype, "adapter");
52
- u("gui-alert-display", s);
53
- export {
54
- s as AlertElement
55
- };
@@ -1,24 +0,0 @@
1
- import { html as i } from "lit";
2
- import { classMap as t } from "lit/directives/class-map.js";
3
- import "@golemui/core";
4
- const r = (e) => {
5
- const s = {
6
- "gui-list__item": !0,
7
- "gui-list__item-selected": !!e.selected,
8
- "gui-list__item-focused": !!e.focused,
9
- "gui-list__item-disabled": !!e.disabled
10
- };
11
- return i`
12
- <div
13
- role="option"
14
- class=${t(s)}
15
- aria-selected=${e.selected ? "true" : "false"}
16
- aria-disabled=${e.disabled ? "true" : "false"}
17
- >
18
- ${e.template}
19
- </div>
20
- `;
21
- };
22
- export {
23
- r as d
24
- };
@@ -1,79 +0,0 @@
1
- import { LayoutWidgetAdapter as n, formContext as o, layoutContext as u } from "@golemui/lit";
2
- import { consume as g, provide as c } from "@lit/context";
3
- import { LitElement as m, html as l } from "lit";
4
- import { property as f } from "lit/decorators.js";
5
- import { cspStyleMap as h, unsubscribeAll as _, safeDefine as x } from "@golemui/lit/internals";
6
- import "rxjs";
7
- import { repeat as w } from "lit-html/directives/repeat.js";
8
- import { classMap as y } from "lit/directives/class-map.js";
9
- var D = Object.defineProperty, d = (i, e, t, b) => {
10
- for (var a = void 0, r = i.length - 1, p; r >= 0; r--)
11
- (p = i[r]) && (a = p(e, t, a) || a);
12
- return a && D(e, t, a), a;
13
- };
14
- class s extends m {
15
- constructor() {
16
- super(...arguments), this.adapter = new n(), this.subscriptions = [];
17
- }
18
- createRenderRoot() {
19
- return this;
20
- }
21
- updated(e) {
22
- super.updated(e);
23
- const t = this.adapter.templateData.size;
24
- t ? this.style.flex = String(t) : this.style.removeProperty("flex");
25
- }
26
- connectedCallback() {
27
- super.connectedCallback(), this.classList.add("gui-flex", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
28
- this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
29
- );
30
- }
31
- render() {
32
- const e = {
33
- "gui-flex__widget": !0,
34
- "gui-flex__widget--row": this.adapter.templateData.direction === "row",
35
- "gui-flex__widget--row-reverse": this.adapter.templateData.direction === "row-reverse",
36
- "gui-flex__widget--column": !this.adapter.templateData.direction || this.adapter.templateData.direction === "column",
37
- "gui-flex__widget--column-reverse": this.adapter.templateData.direction === "column-reverse",
38
- "gui-flex__widget--justify-center": this.adapter.templateData.justify === "center",
39
- "gui-flex__widget--justify-start": this.adapter.templateData.justify === "start",
40
- "gui-flex__widget--justify-end": this.adapter.templateData.justify === "end",
41
- "gui-flex__widget--justify-stretch": !this.adapter.templateData.justify || this.adapter.templateData.justify === "stretch",
42
- "gui-flex__widget--align-start": !this.adapter.templateData.align || this.adapter.templateData.align === "start",
43
- "gui-flex__widget--align-end": this.adapter.templateData.align === "end",
44
- "gui-flex__widget--align-center": this.adapter.templateData.align === "center",
45
- "gui-flex__widget--align-space-between": this.adapter.templateData.align === "space-between",
46
- "gui-flex__widget--align-space-around": this.adapter.templateData.align === "space-around",
47
- "gui-flex__widget--align-space-evenly": this.adapter.templateData.align === "space-evenly"
48
- };
49
- return l`
50
- <div
51
- class=${y(e)}
52
- id=${this.widget?.uid}
53
- style=${h(
54
- this.adapter.templateData.gap ? { gap: `${this.adapter.templateData.gap}px` } : {}
55
- )}
56
- >
57
- ${w(
58
- this.adapter.templateData.children || [],
59
- (t) => t?.uid,
60
- (t) => l`<gui-widget .widget=${t}></gui-widget>`
61
- )}
62
- </div>
63
- `;
64
- }
65
- disconnectedCallback() {
66
- super.disconnectedCallback(), this.adapter.destroy(), _(this.subscriptions);
67
- }
68
- }
69
- d([
70
- g({ context: o }),
71
- f({ attribute: !1 })
72
- ], s.prototype, "formContext");
73
- d([
74
- c({ context: u })
75
- ], s.prototype, "adapter");
76
- x("gui-flex-layout", s);
77
- export {
78
- s as FlexElement
79
- };
@@ -1,78 +0,0 @@
1
- import { LayoutWidgetAdapter as o, formContext as u, layoutContext as c } from "@golemui/lit";
2
- import { consume as m, provide as h } from "@lit/context";
3
- import { LitElement as _, html as n } from "lit";
4
- import { property as f } from "lit/decorators.js";
5
- import { cspStyleMap as l, unsubscribeAll as w, safeDefine as y } from "@golemui/lit/internals";
6
- import "rxjs";
7
- import { repeat as D } from "lit-html/directives/repeat.js";
8
- import { classMap as b } from "lit/directives/class-map.js";
9
- var v = Object.defineProperty, g = (s, a, t, p) => {
10
- for (var e = void 0, i = s.length - 1, r; i >= 0; i--)
11
- (r = s[i]) && (e = r(a, t, e) || e);
12
- return e && v(a, t, e), e;
13
- };
14
- class d extends _ {
15
- constructor() {
16
- super(...arguments), this.adapter = new o(), this.subscriptions = [];
17
- }
18
- createRenderRoot() {
19
- return this;
20
- }
21
- updated(a) {
22
- super.updated(a);
23
- const t = this.adapter.templateData.size;
24
- t ? this.style.flex = String(t) : this.style.removeProperty("flex");
25
- }
26
- connectedCallback() {
27
- super.connectedCallback(), this.classList.add("gui-grid", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
28
- this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
29
- );
30
- }
31
- render() {
32
- const a = this.adapter.templateData.direction === "column", t = !a, p = this.adapter.templateData.autoFit ?? !0, e = {
33
- "gui-grid__widget": !0,
34
- "gui-grid__widget--row": t,
35
- "gui-grid__widget--row--auto-fit": t && p,
36
- "gui-grid__widget--column": a,
37
- "gui-grid__widget--align-center": this.adapter.templateData.align === "center",
38
- "gui-grid__widget--align-start": this.adapter.templateData.align === "start",
39
- "gui-grid__widget--align-end": this.adapter.templateData.align === "end",
40
- "gui-grid__widget--align-space-between": this.adapter.templateData.align === "space-between",
41
- "gui-grid__widget--align-space-around": this.adapter.templateData.align === "space-around",
42
- "gui-grid__widget--align-space-evenly": this.adapter.templateData.align === "space-evenly",
43
- "gui-grid__widget--align-stretch": !this.adapter.templateData.align || this.adapter.templateData.align === "stretch",
44
- "gui-grid__widget--justify-center": this.adapter.templateData.justify === "center",
45
- "gui-grid__widget--justify-start": this.adapter.templateData.justify === "start",
46
- "gui-grid__widget--justify-end": this.adapter.templateData.justify === "end",
47
- "gui-grid__widget--justify-stretch": this.adapter.templateData.justify === "stretch"
48
- }, i = {};
49
- return this.adapter.templateData.columnGap !== void 0 && (i["column-gap"] = `${this.adapter.templateData.columnGap}px`), this.adapter.templateData.rowGap !== void 0 && (i["row-gap"] = `${this.adapter.templateData.rowGap}px`), n`
50
- <div class=${b(e)} id=${this.widget?.uid} style=${l(i)}>
51
- ${D(
52
- this.adapter.templateData.children || [],
53
- (r) => r?.uid,
54
- (r) => n`<div
55
- class="gui-grid__cell"
56
- style=${l({ "grid-column": `span ${r.size || 1}` })}
57
- >
58
- <gui-widget .widget=${r}></gui-widget>
59
- </div>`
60
- )}
61
- </div>
62
- `;
63
- }
64
- disconnectedCallback() {
65
- super.disconnectedCallback(), this.adapter.destroy(), w(this.subscriptions);
66
- }
67
- }
68
- g([
69
- m({ context: u }),
70
- f({ attribute: !1 })
71
- ], d.prototype, "formContext");
72
- g([
73
- h({ context: c })
74
- ], d.prototype, "adapter");
75
- y("gui-grid-layout", d);
76
- export {
77
- d as GridElement
78
- };
@@ -1,16 +0,0 @@
1
- import { LayoutWidget, WithWidget } from '@golemui/core';
2
- import { LayoutWidgetAdapter, LitFormContext } from '@golemui/lit';
3
- import { FlexProps } from '@golemui/gui-shared/internals';
4
- import { LitElement } from 'lit';
5
- import { Subscription } from 'rxjs';
6
- export declare class FlexElement extends LitElement implements WithWidget {
7
- widget: LayoutWidget;
8
- formContext: LitFormContext<any>;
9
- adapter: LayoutWidgetAdapter<FlexProps>;
10
- subscriptions: Subscription[];
11
- createRenderRoot(): this;
12
- updated(changedProperties: any): void;
13
- connectedCallback(): void;
14
- render(): import('lit-html').TemplateResult<1>;
15
- disconnectedCallback(): void;
16
- }
@@ -1,148 +0,0 @@
1
- import { InputWidgetAdapter as $, formContext as _, inputContext as v } from "@golemui/lit";
2
- import { consume as I, provide as x } from "@lit/context";
3
- import { LitElement as y, nothing as o, html as u } from "lit";
4
- import { property as C, state as h, query as R } from "lit/decorators.js";
5
- import { unsubscribeAll as w, cspStyleMap as D, safeDefine as L } from "@golemui/lit/internals";
6
- import "rxjs";
7
- import { d as k } from "./default-list-item-renderer-CuPJ9jUD.js";
8
- import "@golemui/gui-components/label";
9
- import "@golemui/gui-components/list";
10
- import "@golemui/gui-components/errors";
11
- var F = Object.defineProperty, r = (n, e, i, p) => {
12
- for (var s = void 0, t = n.length - 1, d; t >= 0; t--)
13
- (d = n[t]) && (s = d(e, i, s) || s);
14
- return s && F(e, i, s), s;
15
- };
16
- class a extends y {
17
- constructor() {
18
- super(...arguments), this.adapter = new $(), this.subscriptions = [], this._range = { start: 0, end: 10 }, this._listItems = [], this._focusedIndex = -1;
19
- }
20
- createRenderRoot() {
21
- return this;
22
- }
23
- updated(e) {
24
- super.updated(e);
25
- const i = this.adapter.templateData.size;
26
- i ? this.style.flex = String(i) : this.style.removeProperty("flex");
27
- }
28
- connectedCallback() {
29
- super.connectedCallback(), this.classList.add("gui-list", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
30
- this.adapter.templateDataChanged$.subscribe(() => {
31
- const e = this.adapter.templateData;
32
- e.items && this._listItems.length === 0 && (this._listItems = e.items), this.requestUpdate();
33
- })
34
- );
35
- }
36
- disconnectedCallback() {
37
- super.disconnectedCallback(), this.adapter.destroy(), w(this.subscriptions);
38
- }
39
- render() {
40
- const e = this.adapter.templateData, i = e.touched && e.errors && e.errors.length > 0, p = this._listItems.slice(this._range.start, this._range.end), s = this.adapter.getItemRenderer(
41
- e.itemRenderer,
42
- k
43
- );
44
- return u`
45
- <gui-label
46
- .targetElement=${this._guiListRef}
47
- .uid=${this.widget.uid}
48
- .label=${e.label}
49
- .hint=${e.hint}
50
- .errors=${e.errors}
51
- .touched=${e.touched}
52
- .required=${e.validator?.required}
53
- .native=${!1}
54
- ></gui-label>
55
-
56
- <div class="gui-widget">
57
- <gui-list
58
- .uid=${this.widget.uid}
59
- .value=${e.value ?? ""}
60
- .valueField=${e.valueField}
61
- .items=${e.items}
62
- .itemHeight=${e.itemHeight}
63
- .height=${e.height}
64
- ?required=${e.validator?.required}
65
- ?touched=${e.touched}
66
- ?disabled=${e.disabled}
67
- ?readonly=${e.readonly}
68
- aria-labelledby=${e.label ? `${this.widget.uid}_label` : o}
69
- aria-describedby=${e.hint ? `${this.widget.uid}_hint` : o}
70
- @gui-range-change=${this._onRangeChange}
71
- @gui-update-items=${this._onUpdateItems}
72
- @gui-focus-change=${this._onFocusChange}
73
- @blur=${() => this.adapter.onBlur()}
74
- @change=${this._valueChanged}
75
- >
76
- ${p.map((t, d) => {
77
- const l = this._range.start + d, c = e.value === t.value, f = this._focusedIndex === l, g = !!e.disabled || !!t.disabled, m = e.labelField ?? "label", b = t.template !== null && typeof t.template == "object" && m && !e.itemRenderer ? t.template[m] : t.template;
78
- return u`
79
- <div
80
- role="option"
81
- tabindex="-1"
82
- class="gui-list__item-wrapper"
83
- id="${this.widget.uid}-item-${l}"
84
- style=${D({ height: `${e.itemHeight || 40}px` })}
85
- aria-selected=${c ? "true" : "false"}
86
- aria-disabled=${g ? "true" : "false"}
87
- @click=${() => this._onClickItem(t, l)}
88
- >
89
- ${s({
90
- template: b,
91
- value: t.value,
92
- index: l,
93
- selected: c,
94
- disabled: g,
95
- focused: f
96
- })}
97
- </div>
98
- `;
99
- })}
100
- </gui-list>
101
- </div>
102
-
103
- ${i ? u`<gui-errors
104
- .uid=${this.widget.uid}
105
- .errors=${e.errors}
106
- .touched=${e.touched}
107
- ></gui-errors>` : o}
108
- `;
109
- }
110
- _onRangeChange(e) {
111
- this._range = { start: e.detail.startIndex, end: e.detail.endIndex };
112
- }
113
- _onUpdateItems(e) {
114
- this._listItems = e.detail || [];
115
- }
116
- _onFocusChange(e) {
117
- this._focusedIndex = e.detail.index;
118
- }
119
- _onClickItem(e, i) {
120
- this.adapter.templateData.disabled || e.disabled || (this.adapter.valueChanged(e.value), this._focusedIndex = i, this._guiListRef && typeof this._guiListRef.focusItemAtIndex == "function" && this._guiListRef.focusItemAtIndex(i));
121
- }
122
- _valueChanged(e) {
123
- this.adapter.templateData.readonly || this.adapter.valueChanged(e.detail.value);
124
- }
125
- }
126
- r([
127
- I({ context: _ }),
128
- C({ attribute: !1 })
129
- ], a.prototype, "formContext");
130
- r([
131
- x({ context: v })
132
- ], a.prototype, "adapter");
133
- r([
134
- h()
135
- ], a.prototype, "_range");
136
- r([
137
- h()
138
- ], a.prototype, "_listItems");
139
- r([
140
- h()
141
- ], a.prototype, "_focusedIndex");
142
- r([
143
- R("gui-list")
144
- ], a.prototype, "_guiListRef");
145
- L("gui-list-input", a);
146
- export {
147
- a as ListElement
148
- };
@@ -1,162 +0,0 @@
1
- import { InputWidgetAdapter as $, formContext as v, inputContext as I } from "@golemui/lit";
2
- import { consume as x, provide as y } from "@lit/context";
3
- import { LitElement as C, nothing as u, html as h } from "lit";
4
- import { property as R, state as p, query as w } from "lit/decorators.js";
5
- import { unsubscribeAll as D, cspStyleMap as L, safeDefine as k } from "@golemui/lit/internals";
6
- import "rxjs";
7
- import { d as F } from "./default-multi-list-item-renderer-Cv-guvEX.js";
8
- import "@golemui/gui-components/label";
9
- import "@golemui/gui-components/multi-list";
10
- import "@golemui/gui-components/errors";
11
- var q = Object.defineProperty, d = (o, e, t, r) => {
12
- for (var i = void 0, l = o.length - 1, s; l >= 0; l--)
13
- (s = o[l]) && (i = s(e, t, i) || i);
14
- return i && q(e, t, i), i;
15
- };
16
- class a extends C {
17
- constructor() {
18
- super(...arguments), this.adapter = new $(), this.subscriptions = [], this._range = { start: 0, end: 10 }, this._listItems = [], this._focusedIndex = -1;
19
- }
20
- createRenderRoot() {
21
- return this;
22
- }
23
- updated(e) {
24
- super.updated(e);
25
- const t = this.adapter.templateData.size;
26
- t ? this.style.flex = String(t) : this.style.removeProperty("flex");
27
- }
28
- connectedCallback() {
29
- super.connectedCallback(), this.classList.add("gui-multi-list-widget", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
30
- this.adapter.templateDataChanged$.subscribe(() => {
31
- const e = this.adapter.templateData;
32
- e.items && this._listItems.length === 0 && (this._listItems = e.items), this.requestUpdate();
33
- })
34
- );
35
- }
36
- disconnectedCallback() {
37
- super.disconnectedCallback(), this.adapter.destroy(), D(this.subscriptions);
38
- }
39
- render() {
40
- const e = this.adapter.templateData, t = e.touched && e.errors && e.errors.length > 0, r = this._listItems.slice(this._range.start, this._range.end), i = this._currentValues(), l = this.adapter.getItemRenderer(
41
- e.itemRenderer,
42
- F
43
- );
44
- return h`
45
- <gui-label
46
- .targetElement=${this._guiListRef}
47
- .uid=${this.widget.uid}
48
- .label=${e.label}
49
- .hint=${e.hint}
50
- .errors=${e.errors}
51
- .touched=${e.touched}
52
- .required=${e.validator?.required}
53
- .native=${!1}
54
- ></gui-label>
55
-
56
- <div class="gui-widget">
57
- <gui-multi-list
58
- .uid=${this.widget.uid}
59
- .values=${i}
60
- .valueField=${e.valueField}
61
- .items=${e.items}
62
- .itemHeight=${e.itemHeight}
63
- .height=${e.height}
64
- ?required=${e.validator?.required}
65
- ?touched=${e.touched}
66
- ?disabled=${e.disabled}
67
- ?readonly=${e.readonly}
68
- aria-labelledby=${e.label ? `${this.widget.uid}_label` : u}
69
- aria-describedby=${e.hint ? `${this.widget.uid}_hint` : u}
70
- @gui-range-change=${this._onRangeChange}
71
- @gui-update-items=${this._onUpdateItems}
72
- @gui-focus-change=${this._onFocusChange}
73
- @blur=${() => this.adapter.onBlur()}
74
- @change=${this._valueChanged}
75
- >
76
- ${r.map((s, f) => {
77
- const n = this._range.start + f, c = i.includes(s.value), _ = this._focusedIndex === n, g = !!e.disabled || !!s.disabled, m = e.labelField ?? "label", b = s.template !== null && typeof s.template == "object" && m && !e.itemRenderer ? s.template[m] : s.template;
78
- return h`
79
- <div
80
- role="option"
81
- tabindex="-1"
82
- class="gui-list__item-wrapper"
83
- id="${this.widget.uid}-item-${n}"
84
- style=${L({ height: `${e.itemHeight || 40}px` })}
85
- aria-selected=${c ? "true" : "false"}
86
- aria-disabled=${g ? "true" : "false"}
87
- @click=${() => this._onClickItem(s, n)}
88
- >
89
- ${l({
90
- template: b,
91
- value: s.value,
92
- index: n,
93
- selected: c,
94
- disabled: g,
95
- focused: _
96
- })}
97
- </div>
98
- `;
99
- })}
100
- </gui-multi-list>
101
- </div>
102
-
103
- ${t ? h`<gui-errors
104
- .uid=${this.widget.uid}
105
- .errors=${e.errors}
106
- .touched=${e.touched}
107
- ></gui-errors>` : u}
108
- `;
109
- }
110
- _currentValues() {
111
- const e = this.adapter.templateData.value;
112
- return Array.isArray(e) ? e : [];
113
- }
114
- _toggleValue(e) {
115
- const t = this.adapter.templateData;
116
- if (t.disabled || t.readonly) return;
117
- const r = this._currentValues();
118
- if (r.includes(e)) {
119
- this.adapter.valueChanged(r.filter((i) => i !== e));
120
- return;
121
- }
122
- this.adapter.valueChanged([...r, e]);
123
- }
124
- _onRangeChange(e) {
125
- this._range = { start: e.detail.startIndex, end: e.detail.endIndex };
126
- }
127
- _onUpdateItems(e) {
128
- this._listItems = e.detail || [];
129
- }
130
- _onFocusChange(e) {
131
- this._focusedIndex = e.detail.index;
132
- }
133
- _onClickItem(e, t) {
134
- this.adapter.templateData.disabled || e.disabled || (this._toggleValue(e.value), this._focusedIndex = t, this._guiListRef && typeof this._guiListRef.focusItemAtIndex == "function" && this._guiListRef.focusItemAtIndex(t));
135
- }
136
- _valueChanged(e) {
137
- this.adapter.templateData.readonly || this._toggleValue(e.detail.value);
138
- }
139
- }
140
- d([
141
- x({ context: v }),
142
- R({ attribute: !1 })
143
- ], a.prototype, "formContext");
144
- d([
145
- y({ context: I })
146
- ], a.prototype, "adapter");
147
- d([
148
- p()
149
- ], a.prototype, "_range");
150
- d([
151
- p()
152
- ], a.prototype, "_listItems");
153
- d([
154
- p()
155
- ], a.prototype, "_focusedIndex");
156
- d([
157
- w("gui-multi-list")
158
- ], a.prototype, "_guiListRef");
159
- k("gui-multi-list-input", a);
160
- export {
161
- a as MultiListElement
162
- };