@golemui/gui-lit 0.12.1 → 0.13.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 +8 -0
- package/abstract-calendar-YDgwwbqe.js +528 -0
- package/{accordion.element-81uTv6Ms.js → accordion.element-ChLmV6QT.js} +24 -22
- package/{alert.element-DWrS5ggK.js → alert.element-9QFlqjj9.js} +23 -21
- package/button.element-ATNRRDN3.js +121 -0
- package/calendar-P9DzVryu.js +96 -0
- package/{calendar.element-C1rLK7aY.js → calendar.element-O2of7VBr.js} +25 -22
- package/checkbox.element-DMmer4Jw.js +199 -0
- package/currency.element-C7SZkoPP.js +266 -0
- package/date-CG1562vW.js +786 -0
- package/date-input-VJG8lMVN.js +266 -0
- package/{date-picker.element-GNC8f3Qi.js → date-picker.element-Bcyhc0fb.js} +29 -25
- package/{date.element-Dzw-UJzC.js → date.element-DfXmcgZi.js} +25 -22
- package/{dropdown.element-CebROj9s.js → dropdown.element-DCUI5Y7I.js} +24 -22
- package/errors-QjKhr6mA.js +109 -0
- package/{flex.element-BMqqfxjI.js → flex.element-B0sG0YT1.js} +24 -22
- package/{grid.element-CBMoOuLt.js → grid.element-Bf5aEjkj.js} +24 -22
- package/index.js +2708 -1174
- package/index.umd.cjs +982 -108
- package/lib/components/accordion.element.d.ts +7 -7
- package/lib/components/alert.element.d.ts +6 -6
- package/lib/components/button.element.d.ts +6 -6
- package/lib/components/calendar.element.d.ts +6 -6
- package/lib/components/checkbox.element.d.ts +6 -6
- package/lib/components/currency.element.d.ts +6 -6
- package/lib/components/date-picker.element.d.ts +6 -6
- package/lib/components/date.element.d.ts +6 -6
- package/lib/components/dropdown.element.d.ts +6 -6
- package/lib/components/flex.element.d.ts +6 -6
- package/lib/components/grid.element.d.ts +6 -6
- package/lib/components/list.element.d.ts +6 -6
- package/lib/components/markdown-text.element.d.ts +6 -6
- package/lib/components/markdown.element.d.ts +6 -6
- package/lib/components/number.element.d.ts +6 -6
- package/lib/components/password.element.d.ts +6 -6
- package/lib/components/radiogroup.element.d.ts +6 -6
- package/lib/components/range-calendar.element.d.ts +6 -6
- package/lib/components/range-date-input.element.d.ts +6 -6
- package/lib/components/range-date-picker.element.d.ts +6 -6
- package/lib/components/renderer.element.d.ts +6 -6
- package/lib/components/repeater.element.d.ts +6 -6
- package/lib/components/select.element.d.ts +6 -6
- package/lib/components/tabs.element.d.ts +6 -6
- package/lib/components/textarea.element.d.ts +6 -6
- package/lib/components/textinput.element.d.ts +6 -6
- package/lib/components/toggle.element.d.ts +6 -6
- package/lib/widget.loaders.d.ts +2 -2
- package/list-CtFsv7GB.js +284 -0
- package/{list.element-DIIgN_Ww.js → list.element-G8RNRZXU.js} +30 -27
- package/markdown-text-X-BRJT6K.js +30 -0
- package/{markdown-text.element-DY7b-dU5.js → markdown-text.element-C_1OqrGa.js} +23 -20
- package/markdown.element-CT1JOOM3.js +596 -0
- package/number.element-HaXEg_7U.js +282 -0
- package/one-of-DifUsEYY.js +48 -0
- package/package.json +6 -6
- package/password.element-B4-0SCe4.js +238 -0
- package/radiogroup.element-DzHLgRh1.js +232 -0
- package/range-calendar-qpakwAba.js +326 -0
- package/{range-calendar.element-Bli9UfhN.js → range-calendar.element-C-4qqRGK.js} +20 -17
- package/range-date-input-CrNpOVHt.js +507 -0
- package/{range-date-input.element-BwPvGk5F.js → range-date-input.element-Iq5Y7uLQ.js} +20 -17
- package/{range-date-picker.element-DJQOwDPh.js → range-date-picker.element-4bg4Uraq.js} +29 -25
- package/{renderer.element-B99qD2mz.js → renderer.element-DMsheQGi.js} +19 -17
- package/{repeater.element-AaifWsOB.js → repeater.element-Ry8HyMfW.js} +41 -27
- package/select.element-DuGZjlZY.js +257 -0
- package/tabs-DzSCq_98.js +13 -0
- package/{tabs.element-k8JMNDXi.js → tabs.element-VLrtF1j5.js} +31 -29
- package/templates-Dk1jxLwS.js +75 -0
- package/textarea.element-C8yx2u0o.js +237 -0
- package/textinput.element-DKuplF1A.js +204 -0
- package/toggle.element-NXRrhALB.js +201 -0
- package/button.element-hjhVBamJ.js +0 -56
- package/checkbox.element-bu9_MvED.js +0 -65
- package/currency.element-Bxv2WxAx.js +0 -72
- package/default-list-item-renderer-DNVEjKSX.js +0 -23
- package/markdown.element-ZD_n4ObO.js +0 -73
- package/number.element-B0E7W2TK.js +0 -70
- package/password.element-C4_eLdUO.js +0 -71
- package/radiogroup.element-BD8qBNoO.js +0 -68
- package/select.element-BLxtqB0A.js +0 -74
- package/textarea.element-DgDwfzYP.js +0 -70
- package/textinput.element-DSLFDjfb.js +0 -67
- package/toggle.element-BLu6F99u.js +0 -65
package/list-CtFsv7GB.js
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { html as c, LitElement as p, nothing as h } from "lit";
|
|
2
|
+
import { classMap as m } from "lit/directives/class-map.js";
|
|
3
|
+
import "@golemui/core";
|
|
4
|
+
import { property as a, state as d, query as f, customElement as v } from "lit/decorators.js";
|
|
5
|
+
import "@golemui/gui-shared";
|
|
6
|
+
const T = (e) => {
|
|
7
|
+
const t = {
|
|
8
|
+
"gui-list__item": !0,
|
|
9
|
+
"gui-list__item-selected": !!e.selected,
|
|
10
|
+
"gui-list__item-focused": !!e.focused,
|
|
11
|
+
"gui-list__item-disabled": !!e.disabled
|
|
12
|
+
};
|
|
13
|
+
return c`
|
|
14
|
+
<div
|
|
15
|
+
role="option"
|
|
16
|
+
class=${m(t)}
|
|
17
|
+
aria-selected=${e.selected ? "true" : "false"}
|
|
18
|
+
aria-disabled=${e.disabled ? "true" : "false"}
|
|
19
|
+
>
|
|
20
|
+
${e.template}
|
|
21
|
+
</div>
|
|
22
|
+
`;
|
|
23
|
+
}, g = (e) => e !== null && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "template") && Object.prototype.hasOwnProperty.call(e, "value");
|
|
24
|
+
function b(e) {
|
|
25
|
+
const t = typeof e;
|
|
26
|
+
return t === "string" || t === "number";
|
|
27
|
+
}
|
|
28
|
+
const y = (e, { valueField: t }) => {
|
|
29
|
+
if (e === null || typeof e != "object")
|
|
30
|
+
return !1;
|
|
31
|
+
const i = e, o = t ?? "value";
|
|
32
|
+
return !!Object.prototype.hasOwnProperty.call(i, o);
|
|
33
|
+
};
|
|
34
|
+
function w(e, { valueField: t }) {
|
|
35
|
+
if (e === null || typeof e != "object")
|
|
36
|
+
throw new Error("Provided value is not an object");
|
|
37
|
+
const i = e, o = t ?? "value", s = Object.prototype.hasOwnProperty.call(i, o) ? o : void 0;
|
|
38
|
+
if (!s)
|
|
39
|
+
throw new Error("No valueField exists on the object");
|
|
40
|
+
return (n) => {
|
|
41
|
+
if (n === null || typeof n != "object")
|
|
42
|
+
throw new Error("Item is not an object");
|
|
43
|
+
return {
|
|
44
|
+
template: n,
|
|
45
|
+
value: s ? n[s] : ""
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const I = (e, t) => {
|
|
50
|
+
if (Array.isArray(e) && e.length > 0 && !g(e[0])) {
|
|
51
|
+
if (b(e[0]))
|
|
52
|
+
return e.map((i) => ({
|
|
53
|
+
template: i,
|
|
54
|
+
value: i
|
|
55
|
+
}));
|
|
56
|
+
if (y(e[0], t)) {
|
|
57
|
+
const i = w(e[0], t);
|
|
58
|
+
return e.map(i);
|
|
59
|
+
} else
|
|
60
|
+
throw new Error("Invalid list item shape");
|
|
61
|
+
}
|
|
62
|
+
return e;
|
|
63
|
+
};
|
|
64
|
+
var _ = Object.defineProperty, x = Object.getOwnPropertyDescriptor, r = (e, t, i, o) => {
|
|
65
|
+
for (var s = o > 1 ? void 0 : o ? x(t, i) : t, n = e.length - 1, u; n >= 0; n--)
|
|
66
|
+
(u = e[n]) && (s = (o ? u(t, i, s) : u(s)) || s);
|
|
67
|
+
return o && s && _(t, i, s), s;
|
|
68
|
+
};
|
|
69
|
+
let l = class extends p {
|
|
70
|
+
constructor() {
|
|
71
|
+
super(...arguments), this.uid = void 0, this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.valueField = void 0, this.label = void 0, this.hint = void 0, this.items = [], this.itemHeight = void 0, this.height = void 0, this._items = [], this._scrollTop = 0, this._viewportHeight = 0, this._focusedIndex = -1, this.buffer = 5;
|
|
72
|
+
}
|
|
73
|
+
willUpdate(e) {
|
|
74
|
+
super.willUpdate(e), e.has("items") && this.updateItems(), (e.has("items") || e.has("_scrollTop") || e.has("height")) && this.emitRangeChange();
|
|
75
|
+
}
|
|
76
|
+
firstUpdated() {
|
|
77
|
+
this.measureViewport(), new ResizeObserver(() => this.measureViewport()).observe(this.viewportElement);
|
|
78
|
+
}
|
|
79
|
+
render() {
|
|
80
|
+
const e = this.height ?? 300, t = this.itemHeight ?? 40, i = (this.items?.length ?? 0) * t, { offsetY: o } = this.calculateRange(), s = this._focusedIndex >= 0 ? `${this.uid}-item-${this._focusedIndex}` : void 0;
|
|
81
|
+
return c`
|
|
82
|
+
<div
|
|
83
|
+
role="listbox"
|
|
84
|
+
id=${this.uid}
|
|
85
|
+
tabindex=${this.disabled ? -1 : 0}
|
|
86
|
+
class="gui-list__scroll-viewport"
|
|
87
|
+
style="max-height: ${e}px; overflow-y: auto; position: relative; display: block;"
|
|
88
|
+
@scroll="${this.onScroll}"
|
|
89
|
+
@keydown="${this.onKeyDown}"
|
|
90
|
+
@focus="${this.onFocus}"
|
|
91
|
+
@focusout="${this.onFocusOut}"
|
|
92
|
+
aria-required=${this.required ? "true" : h}
|
|
93
|
+
aria-disabled=${this.disabled || this.readOnly ? "true" : h}
|
|
94
|
+
aria-activedescendant="${s ?? h}"
|
|
95
|
+
aria-label=${this.label ?? h}
|
|
96
|
+
aria-description=${this.hint ?? h}
|
|
97
|
+
>
|
|
98
|
+
<div
|
|
99
|
+
class="gui-list__spacer"
|
|
100
|
+
style="height: ${i}px; width: 1px; opacity: 0; pointer-events: none;"
|
|
101
|
+
></div>
|
|
102
|
+
|
|
103
|
+
<div
|
|
104
|
+
class="gui-list__content"
|
|
105
|
+
style="transform: translateY(${o}px); position: absolute; top: 0; left: 0; width: 100%;"
|
|
106
|
+
>
|
|
107
|
+
<slot></slot>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
`;
|
|
111
|
+
}
|
|
112
|
+
focus(e) {
|
|
113
|
+
this.viewportElement ? this.viewportElement.focus(e) : super.focus(e);
|
|
114
|
+
}
|
|
115
|
+
focusItemAtIndex(e) {
|
|
116
|
+
this._focusedIndex = e;
|
|
117
|
+
}
|
|
118
|
+
scrollToSelectedIndex() {
|
|
119
|
+
const e = this.items.findIndex((t) => (this.valueField ? t[this.valueField] : t) === this.value);
|
|
120
|
+
this.scrollToIndex(e);
|
|
121
|
+
}
|
|
122
|
+
onKeyDown(e) {
|
|
123
|
+
if (this.disabled || this.readOnly) return;
|
|
124
|
+
const t = this.itemHeight ?? 40, i = Math.ceil(this._viewportHeight / t), o = this.items.length - 1;
|
|
125
|
+
let s = !1;
|
|
126
|
+
switch (e.key) {
|
|
127
|
+
case "ArrowDown":
|
|
128
|
+
this.setFocusedIndex(Math.min(this._focusedIndex + 1, o)), s = !0;
|
|
129
|
+
break;
|
|
130
|
+
case "ArrowUp":
|
|
131
|
+
this.setFocusedIndex(Math.max(this._focusedIndex - 1, 0)), s = !0;
|
|
132
|
+
break;
|
|
133
|
+
case "PageDown":
|
|
134
|
+
this.setFocusedIndex(Math.min(this._focusedIndex + i, o)), s = !0;
|
|
135
|
+
break;
|
|
136
|
+
case "PageUp":
|
|
137
|
+
this.setFocusedIndex(Math.max(this._focusedIndex - i, 0)), s = !0;
|
|
138
|
+
break;
|
|
139
|
+
case "Home":
|
|
140
|
+
this.setFocusedIndex(0), s = !0;
|
|
141
|
+
break;
|
|
142
|
+
case "End":
|
|
143
|
+
this.setFocusedIndex(o), s = !0;
|
|
144
|
+
break;
|
|
145
|
+
case "Enter":
|
|
146
|
+
case " ": {
|
|
147
|
+
const n = this.items[this._focusedIndex], u = n != null;
|
|
148
|
+
this._focusedIndex >= 0 && u && this.selectItem(this.items[this._focusedIndex]), s = !0;
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
s && e.preventDefault();
|
|
153
|
+
}
|
|
154
|
+
onFocus() {
|
|
155
|
+
if (!this.value || !this.items.length) return;
|
|
156
|
+
const e = this.items.findIndex((t) => (this.valueField ? t[this.valueField] : t) === this.value);
|
|
157
|
+
this._focusedIndex = e, this.scrollToIndex(e), this.dispatchEvent(
|
|
158
|
+
new CustomEvent("gui-focus-change", {
|
|
159
|
+
detail: { index: e },
|
|
160
|
+
bubbles: !0,
|
|
161
|
+
composed: !0
|
|
162
|
+
})
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
onFocusOut(e) {
|
|
166
|
+
e.relatedTarget && this.contains(e.relatedTarget) || (this._focusedIndex = -1, this.dispatchEvent(
|
|
167
|
+
new CustomEvent("gui-focus-change", {
|
|
168
|
+
detail: { index: -1 },
|
|
169
|
+
bubbles: !0,
|
|
170
|
+
composed: !0
|
|
171
|
+
})
|
|
172
|
+
), this.dispatchEvent(new CustomEvent("blur", { bubbles: !0, composed: !0 })));
|
|
173
|
+
}
|
|
174
|
+
scrollToIndex(e) {
|
|
175
|
+
const t = this.itemHeight ?? 40, i = this.height ?? 300, o = e * t, s = o + t, n = this.viewportElement.scrollTop, u = n + i;
|
|
176
|
+
o < n ? this.viewportElement.scrollTop = o : s > u && (this.viewportElement.scrollTop = s - i);
|
|
177
|
+
}
|
|
178
|
+
selectItem(e) {
|
|
179
|
+
this.dispatchEvent(
|
|
180
|
+
new CustomEvent("change", {
|
|
181
|
+
detail: { value: this.valueField ? e[this.valueField] : e },
|
|
182
|
+
bubbles: !0,
|
|
183
|
+
composed: !0
|
|
184
|
+
})
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
setFocusedIndex(e) {
|
|
188
|
+
e < 0 || e >= this.items.length || (this._focusedIndex = e, this.scrollToIndex(e), this.dispatchEvent(
|
|
189
|
+
new CustomEvent("gui-focus-change", {
|
|
190
|
+
detail: { index: e },
|
|
191
|
+
bubbles: !0,
|
|
192
|
+
composed: !0
|
|
193
|
+
})
|
|
194
|
+
));
|
|
195
|
+
}
|
|
196
|
+
updateItems() {
|
|
197
|
+
this._items = I(this.items, { valueField: this.valueField }), this.dispatchEvent(
|
|
198
|
+
new CustomEvent("gui-update-items", {
|
|
199
|
+
detail: this._items,
|
|
200
|
+
bubbles: !0,
|
|
201
|
+
composed: !0
|
|
202
|
+
})
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
emitRangeChange() {
|
|
206
|
+
const { startIndex: e, endIndex: t } = this.calculateRange();
|
|
207
|
+
this.dispatchEvent(
|
|
208
|
+
new CustomEvent("gui-range-change", {
|
|
209
|
+
detail: { startIndex: e, endIndex: t },
|
|
210
|
+
bubbles: !0,
|
|
211
|
+
composed: !0
|
|
212
|
+
})
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
measureViewport() {
|
|
216
|
+
this.viewportElement && (this._viewportHeight = this.viewportElement.offsetHeight, this.emitRangeChange());
|
|
217
|
+
}
|
|
218
|
+
onScroll(e) {
|
|
219
|
+
const t = e.target;
|
|
220
|
+
this._scrollTop = t.scrollTop;
|
|
221
|
+
}
|
|
222
|
+
calculateRange() {
|
|
223
|
+
const e = this.itemHeight ?? 40, t = this.items?.length ?? 0, i = Math.ceil(this._viewportHeight / e), o = Math.floor(this._scrollTop / e), s = Math.max(0, o - this.buffer), n = Math.min(t, o + i + this.buffer), u = s * e;
|
|
224
|
+
return { startIndex: s, endIndex: n, offsetY: u };
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
r([
|
|
228
|
+
a({ type: String })
|
|
229
|
+
], l.prototype, "uid", 2);
|
|
230
|
+
r([
|
|
231
|
+
a({ type: Boolean })
|
|
232
|
+
], l.prototype, "touched", 2);
|
|
233
|
+
r([
|
|
234
|
+
a({ type: Boolean })
|
|
235
|
+
], l.prototype, "required", 2);
|
|
236
|
+
r([
|
|
237
|
+
a({ type: Boolean })
|
|
238
|
+
], l.prototype, "disabled", 2);
|
|
239
|
+
r([
|
|
240
|
+
a({ type: Boolean, attribute: "readonly" })
|
|
241
|
+
], l.prototype, "readOnly", 2);
|
|
242
|
+
r([
|
|
243
|
+
a({ type: String })
|
|
244
|
+
], l.prototype, "value", 2);
|
|
245
|
+
r([
|
|
246
|
+
a({ type: String })
|
|
247
|
+
], l.prototype, "valueField", 2);
|
|
248
|
+
r([
|
|
249
|
+
a({ type: String })
|
|
250
|
+
], l.prototype, "label", 2);
|
|
251
|
+
r([
|
|
252
|
+
a({ type: String })
|
|
253
|
+
], l.prototype, "hint", 2);
|
|
254
|
+
r([
|
|
255
|
+
a({ type: Array })
|
|
256
|
+
], l.prototype, "items", 2);
|
|
257
|
+
r([
|
|
258
|
+
a({ type: Number })
|
|
259
|
+
], l.prototype, "itemHeight", 2);
|
|
260
|
+
r([
|
|
261
|
+
a({ type: Number })
|
|
262
|
+
], l.prototype, "height", 2);
|
|
263
|
+
r([
|
|
264
|
+
d()
|
|
265
|
+
], l.prototype, "_items", 2);
|
|
266
|
+
r([
|
|
267
|
+
d()
|
|
268
|
+
], l.prototype, "_scrollTop", 2);
|
|
269
|
+
r([
|
|
270
|
+
d()
|
|
271
|
+
], l.prototype, "_viewportHeight", 2);
|
|
272
|
+
r([
|
|
273
|
+
d()
|
|
274
|
+
], l.prototype, "_focusedIndex", 2);
|
|
275
|
+
r([
|
|
276
|
+
f(".gui-list__scroll-viewport")
|
|
277
|
+
], l.prototype, "viewportElement", 2);
|
|
278
|
+
l = r([
|
|
279
|
+
v("gui-list")
|
|
280
|
+
], l);
|
|
281
|
+
typeof customElements < "u" && !customElements.get("gui-list") && customElements.define("gui-list", l);
|
|
282
|
+
export {
|
|
283
|
+
T as d
|
|
284
|
+
};
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { InputWidgetAdapter as f, formContext as _, inputContext as b } from "@golemui/lit";
|
|
2
|
+
import "@golemui/gui-shared";
|
|
3
|
+
import { consume as $, provide as v } from "@lit/context";
|
|
4
|
+
import { LitElement as I, nothing as n, html as u } from "lit";
|
|
5
|
+
import { property as x, state as h, query as y, customElement as C } from "lit/decorators.js";
|
|
6
|
+
import "rxjs";
|
|
7
|
+
import { d as R } from "./list-CtFsv7GB.js";
|
|
8
|
+
import "./errors-QjKhr6mA.js";
|
|
9
|
+
var w = Object.defineProperty, D = Object.getOwnPropertyDescriptor, r = (e, i, l, d) => {
|
|
10
|
+
for (var t = d > 1 ? void 0 : d ? D(i, l) : i, o = e.length - 1, s; o >= 0; o--)
|
|
11
|
+
(s = e[o]) && (t = (d ? s(i, l, t) : s(t)) || t);
|
|
12
|
+
return d && t && w(i, l, t), t;
|
|
10
13
|
};
|
|
11
|
-
let a = class extends
|
|
14
|
+
let a = class extends I {
|
|
12
15
|
constructor() {
|
|
13
|
-
super(...arguments), this.adapter = new
|
|
16
|
+
super(...arguments), this.adapter = new f(), this.subscriptions = [], this._range = { start: 0, end: 10 }, this._listItems = [], this._focusedIndex = -1;
|
|
14
17
|
}
|
|
15
18
|
createRenderRoot() {
|
|
16
19
|
return this;
|
|
@@ -34,7 +37,7 @@ let a = class extends $ {
|
|
|
34
37
|
render() {
|
|
35
38
|
const e = this.adapter.templateData, i = e.touched && e.errors && e.errors.length > 0, l = this._listItems.slice(this._range.start, this._range.end), d = this.adapter.getItemRenderer(
|
|
36
39
|
e.itemRenderer,
|
|
37
|
-
|
|
40
|
+
R
|
|
38
41
|
);
|
|
39
42
|
return u`
|
|
40
43
|
<gui-label
|
|
@@ -60,16 +63,16 @@ let a = class extends $ {
|
|
|
60
63
|
?touched=${e.touched}
|
|
61
64
|
?disabled=${e.disabled}
|
|
62
65
|
?readonly=${e.readonly}
|
|
63
|
-
aria-labelledby=${e.label ? `${this.widget.uid}_label` :
|
|
64
|
-
aria-describedby=${e.hint ? `${this.widget.uid}_hint` :
|
|
66
|
+
aria-labelledby=${e.label ? `${this.widget.uid}_label` : n}
|
|
67
|
+
aria-describedby=${e.hint ? `${this.widget.uid}_hint` : n}
|
|
65
68
|
@gui-range-change=${this._onRangeChange}
|
|
66
69
|
@gui-update-items=${this._onUpdateItems}
|
|
67
70
|
@gui-focus-change=${this._onFocusChange}
|
|
68
71
|
@blur=${() => this.adapter.onBlur()}
|
|
69
72
|
@change=${this._valueChanged}
|
|
70
73
|
>
|
|
71
|
-
${l.map((t,
|
|
72
|
-
const s = this._range.start +
|
|
74
|
+
${l.map((t, o) => {
|
|
75
|
+
const s = this._range.start + o, p = e.value === t.value, g = this._focusedIndex === s, c = e.labelField ?? "label", m = t.template !== null && typeof t.template == "object" && c && !e.itemRenderer ? t.template[c] : t.template;
|
|
73
76
|
return u`
|
|
74
77
|
<div
|
|
75
78
|
role="option"
|
|
@@ -82,12 +85,12 @@ let a = class extends $ {
|
|
|
82
85
|
@click=${() => this._onClickItem(t, s)}
|
|
83
86
|
>
|
|
84
87
|
${d({
|
|
85
|
-
template:
|
|
88
|
+
template: m,
|
|
86
89
|
value: t.value,
|
|
87
90
|
index: s,
|
|
88
91
|
selected: p,
|
|
89
92
|
disabled: !!e.disabled,
|
|
90
|
-
focused:
|
|
93
|
+
focused: g
|
|
91
94
|
})}
|
|
92
95
|
</div>
|
|
93
96
|
`;
|
|
@@ -99,7 +102,7 @@ let a = class extends $ {
|
|
|
99
102
|
.uid=${this.widget.uid}
|
|
100
103
|
.errors=${e.errors}
|
|
101
104
|
.touched=${e.touched}
|
|
102
|
-
></gui-errors>` :
|
|
105
|
+
></gui-errors>` : n}
|
|
103
106
|
`;
|
|
104
107
|
}
|
|
105
108
|
_onRangeChange(e) {
|
|
@@ -119,26 +122,26 @@ let a = class extends $ {
|
|
|
119
122
|
}
|
|
120
123
|
};
|
|
121
124
|
r([
|
|
122
|
-
|
|
123
|
-
|
|
125
|
+
$({ context: _ }),
|
|
126
|
+
x({ attribute: !1 })
|
|
124
127
|
], a.prototype, "formContext", 2);
|
|
125
128
|
r([
|
|
126
|
-
|
|
129
|
+
v({ context: b })
|
|
127
130
|
], a.prototype, "adapter", 2);
|
|
128
131
|
r([
|
|
129
|
-
|
|
132
|
+
h()
|
|
130
133
|
], a.prototype, "_range", 2);
|
|
131
134
|
r([
|
|
132
|
-
|
|
135
|
+
h()
|
|
133
136
|
], a.prototype, "_listItems", 2);
|
|
134
137
|
r([
|
|
135
|
-
|
|
138
|
+
h()
|
|
136
139
|
], a.prototype, "_focusedIndex", 2);
|
|
137
140
|
r([
|
|
138
|
-
|
|
141
|
+
y("gui-list")
|
|
139
142
|
], a.prototype, "_guiListRef", 2);
|
|
140
143
|
a = r([
|
|
141
|
-
|
|
144
|
+
C("gui-list-input")
|
|
142
145
|
], a);
|
|
143
146
|
export {
|
|
144
147
|
a as ListElement
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LitElement as u, html as c } from "lit";
|
|
2
|
+
import { property as d, customElement as f } from "lit/decorators.js";
|
|
3
|
+
import { unsafeHTML as a } from "lit/directives/unsafe-html.js";
|
|
4
|
+
import "@golemui/gui-shared";
|
|
5
|
+
var l = Object.defineProperty, v = Object.getOwnPropertyDescriptor, i = (p, r, o, n) => {
|
|
6
|
+
for (var e = n > 1 ? void 0 : n ? v(r, o) : r, s = p.length - 1, m; s >= 0; s--)
|
|
7
|
+
(m = p[s]) && (e = (n ? m(r, o, e) : m(e)) || e);
|
|
8
|
+
return n && e && l(r, o, e), e;
|
|
9
|
+
};
|
|
10
|
+
let t = class extends u {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.md = void 0, this.dependencies = void 0;
|
|
13
|
+
}
|
|
14
|
+
createRenderRoot() {
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return c`${a(this.dependencies?.markdown?.parse(this.md ?? ""))}`;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
i([
|
|
22
|
+
d({ type: String })
|
|
23
|
+
], t.prototype, "md", 2);
|
|
24
|
+
i([
|
|
25
|
+
d({ type: Object })
|
|
26
|
+
], t.prototype, "dependencies", 2);
|
|
27
|
+
t = i([
|
|
28
|
+
f("gui-markdown-text")
|
|
29
|
+
], t);
|
|
30
|
+
typeof customElements < "u" && !customElements.get("gui-markdown-text") && customElements.define("gui-markdown-text", t);
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { property as
|
|
3
|
-
import { consume as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { LitElement as n, html as c } from "lit";
|
|
2
|
+
import { property as l, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import { consume as u, provide as h } from "@lit/context";
|
|
4
|
+
import { DisplayWidgetAdapter as f, formContext as x, displayWidgetContext as b } from "@golemui/lit";
|
|
5
|
+
import "@golemui/gui-shared";
|
|
6
|
+
import "./markdown-text-X-BRJT6K.js";
|
|
7
|
+
import "rxjs";
|
|
8
|
+
var g = Object.defineProperty, w = Object.getOwnPropertyDescriptor, d = (r, t, a, s) => {
|
|
9
|
+
for (var e = s > 1 ? void 0 : s ? w(t, a) : t, o = r.length - 1, p; o >= 0; o--)
|
|
10
|
+
(p = r[o]) && (e = (s ? p(t, a, e) : p(e)) || e);
|
|
11
|
+
return s && e && g(t, a, e), e;
|
|
9
12
|
};
|
|
10
|
-
let i = class extends
|
|
13
|
+
let i = class extends n {
|
|
11
14
|
constructor() {
|
|
12
|
-
super(...arguments), this.adapter = new
|
|
15
|
+
super(...arguments), this.adapter = new f(), this.subscriptions = [];
|
|
13
16
|
}
|
|
14
17
|
createRenderRoot() {
|
|
15
18
|
return this;
|
|
16
19
|
}
|
|
17
|
-
updated(
|
|
18
|
-
super.updated(
|
|
20
|
+
updated(r) {
|
|
21
|
+
super.updated(r);
|
|
19
22
|
const t = this.adapter.templateData.size;
|
|
20
23
|
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
21
24
|
}
|
|
@@ -25,7 +28,7 @@ let i = class extends c {
|
|
|
25
28
|
);
|
|
26
29
|
}
|
|
27
30
|
render() {
|
|
28
|
-
return
|
|
31
|
+
return c`
|
|
29
32
|
<div class="gui-widget" id=${this.widget.uid}>
|
|
30
33
|
<gui-markdown-text
|
|
31
34
|
.md=${this.adapter.templateData.md}
|
|
@@ -35,17 +38,17 @@ let i = class extends c {
|
|
|
35
38
|
`;
|
|
36
39
|
}
|
|
37
40
|
disconnectedCallback() {
|
|
38
|
-
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((
|
|
41
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((r) => r.unsubscribe());
|
|
39
42
|
}
|
|
40
43
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
d([
|
|
45
|
+
u({ context: x }),
|
|
46
|
+
l({ attribute: !1 })
|
|
44
47
|
], i.prototype, "formContext", 2);
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
d([
|
|
49
|
+
h({ context: b })
|
|
47
50
|
], i.prototype, "adapter", 2);
|
|
48
|
-
i =
|
|
51
|
+
i = d([
|
|
49
52
|
m("gui-markdown-text-display")
|
|
50
53
|
], i);
|
|
51
54
|
export {
|