@golemui/gui-lit 2.0.0-rc.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.
- package/CHANGELOG.md +10 -0
- package/default-list-item-renderer-sJeXkSKR.js +15 -0
- package/{default-multi-list-item-renderer-Cv-guvEX.js → default-multi-list-item-renderer-CG3Fuye0.js} +7 -12
- package/{dropdown.element-Djee1u1L.js → dropdown.element-C55MHVq-.js} +95 -115
- package/index.js +4 -4
- package/index.umd.cjs +106 -130
- package/lib/components/dropdown.element.d.ts +2 -5
- package/lib/components/list.element.d.ts +2 -7
- package/lib/components/multi-dropdown.element.d.ts +2 -5
- package/lib/components/multi-list.element.d.ts +2 -7
- package/list.element-CIrv32zU.js +125 -0
- package/{multi-dropdown.element-B1vV4rF-.js → multi-dropdown.element-nOsP8HUx.js} +95 -117
- package/multi-list.element-CZfmTbCf.js +139 -0
- package/package.json +6 -6
- package/default-list-item-renderer-CuPJ9jUD.js +0 -24
- package/list.element-DfLD2X8s.js +0 -147
- package/multi-list.element-CNVHVkj0.js +0 -161
|
@@ -9,10 +9,9 @@ export declare class DropdownElement extends LitElement implements WithWidget {
|
|
|
9
9
|
adapter: InputWidgetAdapter<string, DropdownProps<never>>;
|
|
10
10
|
debouncer: Subject<string>;
|
|
11
11
|
subscriptions: Subscription[];
|
|
12
|
-
private
|
|
12
|
+
private _visibleItems;
|
|
13
13
|
private _filteredItems;
|
|
14
14
|
private _listItems;
|
|
15
|
-
private _focusedIndex;
|
|
16
15
|
private _isFiltering;
|
|
17
16
|
private _isListVisible;
|
|
18
17
|
private _selectedItem;
|
|
@@ -24,10 +23,8 @@ export declare class DropdownElement extends LitElement implements WithWidget {
|
|
|
24
23
|
createRenderRoot(): this;
|
|
25
24
|
connectedCallback(): void;
|
|
26
25
|
disconnectedCallback(): void;
|
|
27
|
-
private
|
|
26
|
+
private _onVisibleItemsChange;
|
|
28
27
|
private _onUpdateItems;
|
|
29
|
-
private _onFocusChange;
|
|
30
|
-
private _onClickItem;
|
|
31
28
|
private _onValueChange;
|
|
32
29
|
private _onKeyDown;
|
|
33
30
|
private _onInput;
|
|
@@ -8,17 +8,12 @@ export declare class ListElement extends LitElement implements WithWidget {
|
|
|
8
8
|
formContext: LitFormContext<any>;
|
|
9
9
|
adapter: InputWidgetAdapter<string, ListProps<any>>;
|
|
10
10
|
subscriptions: Subscription[];
|
|
11
|
-
private
|
|
12
|
-
private _listItems;
|
|
13
|
-
private _focusedIndex;
|
|
11
|
+
private _visibleItems;
|
|
14
12
|
private _guiListRef;
|
|
15
13
|
createRenderRoot(): this;
|
|
16
14
|
connectedCallback(): void;
|
|
17
15
|
disconnectedCallback(): void;
|
|
18
16
|
render(): import('lit-html').TemplateResult<1>;
|
|
19
|
-
private
|
|
20
|
-
private _onUpdateItems;
|
|
21
|
-
private _onFocusChange;
|
|
22
|
-
private _onClickItem;
|
|
17
|
+
private _onVisibleItemsChange;
|
|
23
18
|
private _valueChanged;
|
|
24
19
|
}
|
|
@@ -9,10 +9,9 @@ export declare class MultiDropdownElement extends LitElement implements WithWidg
|
|
|
9
9
|
adapter: InputWidgetAdapter<OptionValue[], MultiDropdownProps<any>>;
|
|
10
10
|
debouncer: Subject<string>;
|
|
11
11
|
subscriptions: Subscription[];
|
|
12
|
-
private
|
|
12
|
+
private _visibleItems;
|
|
13
13
|
private _filteredItems;
|
|
14
14
|
private _listItems;
|
|
15
|
-
private _focusedIndex;
|
|
16
15
|
private _isFiltering;
|
|
17
16
|
private _isListVisible;
|
|
18
17
|
private _triggerRef;
|
|
@@ -27,10 +26,8 @@ export declare class MultiDropdownElement extends LitElement implements WithWidg
|
|
|
27
26
|
private _pillItems;
|
|
28
27
|
private _toggleValue;
|
|
29
28
|
private _openPanel;
|
|
30
|
-
private
|
|
29
|
+
private _onVisibleItemsChange;
|
|
31
30
|
private _onUpdateItems;
|
|
32
|
-
private _onFocusChange;
|
|
33
|
-
private _onClickItem;
|
|
34
31
|
private _onValueChange;
|
|
35
32
|
private _onPillRemove;
|
|
36
33
|
private _onPillsDropdownToggle;
|
|
@@ -8,9 +8,7 @@ export declare class MultiListElement extends LitElement implements WithWidget {
|
|
|
8
8
|
formContext: LitFormContext<any>;
|
|
9
9
|
adapter: InputWidgetAdapter<OptionValue[], MultiListProps<any>>;
|
|
10
10
|
subscriptions: Subscription[];
|
|
11
|
-
private
|
|
12
|
-
private _listItems;
|
|
13
|
-
private _focusedIndex;
|
|
11
|
+
private _visibleItems;
|
|
14
12
|
private _guiListRef;
|
|
15
13
|
createRenderRoot(): this;
|
|
16
14
|
connectedCallback(): void;
|
|
@@ -18,9 +16,6 @@ export declare class MultiListElement extends LitElement implements WithWidget {
|
|
|
18
16
|
render(): import('lit-html').TemplateResult<1>;
|
|
19
17
|
private _currentValues;
|
|
20
18
|
private _toggleValue;
|
|
21
|
-
private
|
|
22
|
-
private _onUpdateItems;
|
|
23
|
-
private _onFocusChange;
|
|
24
|
-
private _onClickItem;
|
|
19
|
+
private _onVisibleItemsChange;
|
|
25
20
|
private _valueChanged;
|
|
26
21
|
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { InputWidgetAdapter as h, formContext as c, inputContext as b } from "@golemui/lit";
|
|
2
|
+
import { consume as m, provide as g } from "@lit/context";
|
|
3
|
+
import { LitElement as $, nothing as o, html as n } from "lit";
|
|
4
|
+
import { property as f, state as v, query as _ } from "lit/decorators.js";
|
|
5
|
+
import { unsubscribeAll as y, cspStyleMap as C, safeDefine as x } from "@golemui/lit/internals";
|
|
6
|
+
import "rxjs";
|
|
7
|
+
import { d as w } from "./default-list-item-renderer-sJeXkSKR.js";
|
|
8
|
+
import "@golemui/gui-components/label";
|
|
9
|
+
import "@golemui/gui-components/list";
|
|
10
|
+
import "@golemui/gui-components/errors";
|
|
11
|
+
import { live as I } from "lit/directives/live.js";
|
|
12
|
+
var R = Object.defineProperty, a = (d, e, s, u) => {
|
|
13
|
+
for (var t = void 0, i = d.length - 1, l; i >= 0; i--)
|
|
14
|
+
(l = d[i]) && (t = l(e, s, t) || t);
|
|
15
|
+
return t && R(e, s, t), t;
|
|
16
|
+
};
|
|
17
|
+
class r extends $ {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments), this.adapter = new h(), this.subscriptions = [], this._visibleItems = [];
|
|
20
|
+
}
|
|
21
|
+
createRenderRoot() {
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
super.connectedCallback(), this.classList.add("gui-list", "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
|
+
disconnectedCallback() {
|
|
30
|
+
super.disconnectedCallback(), this.adapter.destroy(), y(this.subscriptions);
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
const e = this.adapter.templateData, s = e.touched && e.errors && e.errors.length > 0, u = this.adapter.getItemRenderer(
|
|
34
|
+
e.itemRenderer,
|
|
35
|
+
w
|
|
36
|
+
);
|
|
37
|
+
return n`
|
|
38
|
+
<gui-label
|
|
39
|
+
.targetElement=${this._guiListRef}
|
|
40
|
+
.uid=${this.widget.uid}
|
|
41
|
+
.label=${e.label}
|
|
42
|
+
.hint=${e.hint}
|
|
43
|
+
.errors=${e.errors}
|
|
44
|
+
.touched=${e.touched}
|
|
45
|
+
.required=${e.validator?.required}
|
|
46
|
+
.disabled=${e.disabled}
|
|
47
|
+
.readOnly=${e.readonly}
|
|
48
|
+
.native=${!1}
|
|
49
|
+
></gui-label>
|
|
50
|
+
|
|
51
|
+
<div class="gui-widget">
|
|
52
|
+
<gui-list
|
|
53
|
+
.uid=${this.widget.uid}
|
|
54
|
+
.value=${I(e.value ?? "")}
|
|
55
|
+
.valueField=${e.valueField}
|
|
56
|
+
.items=${e.items}
|
|
57
|
+
.itemHeight=${e.itemHeight}
|
|
58
|
+
.height=${e.height}
|
|
59
|
+
?required=${e.validator?.required}
|
|
60
|
+
.touched=${e.touched}
|
|
61
|
+
?disabled=${e.disabled}
|
|
62
|
+
?readonly=${e.readonly}
|
|
63
|
+
aria-labelledby=${e.label ? `${this.widget.uid}_label` : o}
|
|
64
|
+
aria-describedby=${e.hint ? `${this.widget.uid}_hint` : o}
|
|
65
|
+
@gui-visible-items-change=${this._onVisibleItemsChange}
|
|
66
|
+
@gui-blur=${() => this.adapter.onBlur()}
|
|
67
|
+
@gui-input=${this._valueChanged}
|
|
68
|
+
>
|
|
69
|
+
${this._visibleItems.map((t) => {
|
|
70
|
+
const i = e.labelField ?? "label", p = t.template !== null && typeof t.template == "object" && i && !e.itemRenderer ? t.template[i] : t.template;
|
|
71
|
+
return n`
|
|
72
|
+
<div
|
|
73
|
+
role="option"
|
|
74
|
+
tabindex="-1"
|
|
75
|
+
class="gui-list__item-wrapper"
|
|
76
|
+
id=${t.id}
|
|
77
|
+
style=${C({ height: `${e.itemHeight || 40}px` })}
|
|
78
|
+
aria-selected=${t.selected ? "true" : "false"}
|
|
79
|
+
aria-disabled=${t.disabled ? "true" : "false"}
|
|
80
|
+
>
|
|
81
|
+
${u({
|
|
82
|
+
template: p,
|
|
83
|
+
value: t.value,
|
|
84
|
+
index: t.index,
|
|
85
|
+
selected: t.selected,
|
|
86
|
+
disabled: t.disabled,
|
|
87
|
+
focused: t.focused
|
|
88
|
+
})}
|
|
89
|
+
</div>
|
|
90
|
+
`;
|
|
91
|
+
})}
|
|
92
|
+
</gui-list>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
${s ? n`<gui-errors
|
|
96
|
+
.uid=${this.widget.uid}
|
|
97
|
+
.errors=${e.errors}
|
|
98
|
+
.touched=${e.touched}
|
|
99
|
+
></gui-errors>` : o}
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
_onVisibleItemsChange(e) {
|
|
103
|
+
this._visibleItems = e.detail;
|
|
104
|
+
}
|
|
105
|
+
_valueChanged(e) {
|
|
106
|
+
this.adapter.templateData.readonly || this.adapter.valueChanged(e.detail.value);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
a([
|
|
110
|
+
m({ context: c }),
|
|
111
|
+
f({ attribute: !1 })
|
|
112
|
+
], r.prototype, "formContext");
|
|
113
|
+
a([
|
|
114
|
+
g({ context: b })
|
|
115
|
+
], r.prototype, "adapter");
|
|
116
|
+
a([
|
|
117
|
+
v()
|
|
118
|
+
], r.prototype, "_visibleItems");
|
|
119
|
+
a([
|
|
120
|
+
_("gui-list")
|
|
121
|
+
], r.prototype, "_guiListRef");
|
|
122
|
+
x("gui-list-input", r);
|
|
123
|
+
export {
|
|
124
|
+
r as ListElement
|
|
125
|
+
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { InputWidgetAdapter as
|
|
2
|
-
import { updateListItems as
|
|
3
|
-
import { consume as
|
|
4
|
-
import { LitElement as
|
|
5
|
-
import { property as
|
|
6
|
-
import { unsubscribeAll as
|
|
7
|
-
import { Subject as
|
|
8
|
-
import { d as
|
|
1
|
+
import { InputWidgetAdapter as _, formContext as f, inputContext as b } from "@golemui/lit";
|
|
2
|
+
import { updateListItems as $, selectedPills as w, searchItems as I } from "@golemui/gui-components/internals";
|
|
3
|
+
import { consume as v, provide as y } from "@lit/context";
|
|
4
|
+
import { LitElement as D, nothing as g, html as u } from "lit";
|
|
5
|
+
import { property as L, state as n, query as p } from "lit/decorators.js";
|
|
6
|
+
import { unsubscribeAll as R, cspStyleMap as V, safeDefine as F } from "@golemui/lit/internals";
|
|
7
|
+
import { Subject as k, debounceTime as x } from "rxjs";
|
|
8
|
+
import { d as C } from "./default-multi-list-item-renderer-CG3Fuye0.js";
|
|
9
9
|
import "@golemui/gui-components/label";
|
|
10
10
|
import "@golemui/gui-components/multi-list";
|
|
11
11
|
import "@golemui/gui-components/multi-select-trigger";
|
|
12
12
|
import "@golemui/gui-components/errors";
|
|
13
|
-
import { live as
|
|
14
|
-
var
|
|
15
|
-
for (var
|
|
16
|
-
(
|
|
17
|
-
return
|
|
13
|
+
import { live as P } from "lit/directives/live.js";
|
|
14
|
+
var T = Object.defineProperty, o = (h, e, t, i) => {
|
|
15
|
+
for (var s = void 0, a = h.length - 1, d; a >= 0; a--)
|
|
16
|
+
(d = h[a]) && (s = d(e, t, s) || s);
|
|
17
|
+
return s && T(e, t, s), s;
|
|
18
18
|
};
|
|
19
|
-
class
|
|
19
|
+
class l extends D {
|
|
20
20
|
constructor() {
|
|
21
|
-
super(...arguments), this.adapter = new
|
|
21
|
+
super(...arguments), this.adapter = new _(), this.debouncer = new k(), this.subscriptions = [], this._visibleItems = [], this._filteredItems = [], this._listItems = [], this._isFiltering = !1, this._isListVisible = !1, this._ignoreNextFocus = !1, this.onDocumentClick = (e) => {
|
|
22
22
|
if (!this._isListVisible) return;
|
|
23
|
-
const t = e.composedPath(),
|
|
24
|
-
!
|
|
23
|
+
const t = e.composedPath(), i = this._triggerRef && t.includes(this._triggerRef), s = this._panelRef && t.includes(this._panelRef);
|
|
24
|
+
!i && !s && (this._isListVisible = !1);
|
|
25
25
|
}, this._onToggleMouseDown = (e) => {
|
|
26
26
|
e.preventDefault();
|
|
27
27
|
}, this._onToggleClick = async (e) => {
|
|
@@ -39,58 +39,49 @@ class a extends x {
|
|
|
39
39
|
const e = this.adapter.templateData;
|
|
40
40
|
e.items && this._listItems?.length === 0 && this._filteredItems?.length === 0 && (this._filteredItems = e.items, this._listItems = e.items), this.requestUpdate();
|
|
41
41
|
}),
|
|
42
|
-
this.debouncer.pipe(
|
|
42
|
+
this.debouncer.pipe(x(this.adapter.templateData.inputDebounce ?? 500)).subscribe((e) => {
|
|
43
43
|
this._filterItems(e);
|
|
44
44
|
})
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
disconnectedCallback() {
|
|
48
|
-
super.disconnectedCallback(), document.removeEventListener("click", this.onDocumentClick), this.adapter.destroy(),
|
|
48
|
+
super.disconnectedCallback(), document.removeEventListener("click", this.onDocumentClick), this.adapter.destroy(), R(this.subscriptions);
|
|
49
49
|
}
|
|
50
50
|
_currentValues() {
|
|
51
51
|
const e = this.adapter.templateData.value;
|
|
52
52
|
return Array.isArray(e) ? e : [];
|
|
53
53
|
}
|
|
54
54
|
_pillItems(e) {
|
|
55
|
-
const t = this.adapter.templateData,
|
|
55
|
+
const t = this.adapter.templateData, i = $(
|
|
56
56
|
t.items ?? [],
|
|
57
57
|
t
|
|
58
58
|
);
|
|
59
|
-
return e.
|
|
60
|
-
const o = i.find((u) => u.value === l) ?? this._listItems.find((u) => u.value === l), h = o != null && o.template !== null && typeof o.template == "object", s = o == null ? String(l) : String(h ? o.template[r] : o.template);
|
|
61
|
-
return { key: String(l), label: s };
|
|
62
|
-
});
|
|
59
|
+
return w(e, i, t.labelField, this._listItems);
|
|
63
60
|
}
|
|
64
61
|
_toggleValue(e) {
|
|
65
62
|
const t = this.adapter.templateData;
|
|
66
63
|
if (t.disabled || t.readonly) return;
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
this.adapter.valueChanged(
|
|
64
|
+
const i = this._currentValues();
|
|
65
|
+
if (i.includes(e)) {
|
|
66
|
+
this.adapter.valueChanged(i.filter((s) => s !== e));
|
|
70
67
|
return;
|
|
71
68
|
}
|
|
72
|
-
this.adapter.valueChanged([...
|
|
69
|
+
this.adapter.valueChanged([...i, e]);
|
|
73
70
|
}
|
|
74
71
|
async _openPanel() {
|
|
75
72
|
this._triggerRef?.closePillsDropdown(), this._isListVisible = !0, await this.updateComplete, this._listRef?.scrollToSelectedIndex();
|
|
76
73
|
}
|
|
77
|
-
|
|
78
|
-
this.
|
|
74
|
+
_onVisibleItemsChange(e) {
|
|
75
|
+
this._visibleItems = e.detail;
|
|
79
76
|
}
|
|
80
77
|
_onUpdateItems(e) {
|
|
81
78
|
this._listItems = e.detail || [];
|
|
82
79
|
}
|
|
83
|
-
_onFocusChange(e) {
|
|
84
|
-
this._focusedIndex = e.detail.index;
|
|
85
|
-
}
|
|
86
|
-
_onClickItem(e, t) {
|
|
87
|
-
this.adapter.templateData.readonly || e.disabled || (this._toggleValue(e.value), this._focusedIndex = t, this._listRef && this._listRef.focusItemAtIndex(t));
|
|
88
|
-
}
|
|
89
80
|
_onValueChange(e) {
|
|
90
81
|
this.adapter.templateData.readonly || this._toggleValue(e.detail.value);
|
|
91
82
|
}
|
|
92
83
|
_onPillRemove(e) {
|
|
93
|
-
const t = this._currentValues().find((
|
|
84
|
+
const t = this._currentValues().find((i) => String(i) === e.detail.key);
|
|
94
85
|
t !== void 0 && this._toggleValue(t);
|
|
95
86
|
}
|
|
96
87
|
_onPillsDropdownToggle(e) {
|
|
@@ -104,20 +95,12 @@ class a extends x {
|
|
|
104
95
|
this.debouncer.next(t);
|
|
105
96
|
}
|
|
106
97
|
_filterItems(e) {
|
|
107
|
-
const t = this.adapter.templateData,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (s === null || typeof s != "object")
|
|
114
|
-
return s != null && s.toString().toLowerCase().includes(e.toLowerCase());
|
|
115
|
-
const d = Object.keys(s), p = (g, _) => g || s[_].toString().toLowerCase().includes(e.toLowerCase());
|
|
116
|
-
return l ? d.filter((g) => i.includes(g)).reduce(p, !1) : d.reduce(p, !1);
|
|
117
|
-
});
|
|
118
|
-
this._filteredItems = [...h];
|
|
119
|
-
} else
|
|
120
|
-
this._isFiltering = !1, this._filteredItems = [...t.items];
|
|
98
|
+
const t = this.adapter.templateData, i = !!this.widget.on?.filter;
|
|
99
|
+
this.adapter.filterChanged(e), e && !i ? (this._isFiltering = !0, this._isListVisible = !0, this._filteredItems = I(
|
|
100
|
+
t.items || [],
|
|
101
|
+
e,
|
|
102
|
+
t
|
|
103
|
+
)) : (this._isFiltering = !1, this._filteredItems = [...t.items]);
|
|
121
104
|
}
|
|
122
105
|
_onWidgetKeyDown(e) {
|
|
123
106
|
e.key !== "Escape" || !this._isListVisible || (e.preventDefault(), e.stopPropagation(), this._isListVisible = !1, this._isFiltering = !1, this._ignoreNextFocus = !0, this._triggerRef?.focusInput(), setTimeout(() => {
|
|
@@ -126,8 +109,8 @@ class a extends x {
|
|
|
126
109
|
}
|
|
127
110
|
async _onFocusIn(e) {
|
|
128
111
|
if (this._ignoreNextFocus) return;
|
|
129
|
-
const t = this._triggerRef?.input,
|
|
130
|
-
e.target !== t && !
|
|
112
|
+
const t = this._triggerRef?.input, i = this._listRef && e.target === this._listRef;
|
|
113
|
+
e.target !== t && !i || await this._openPanel();
|
|
131
114
|
}
|
|
132
115
|
_onPanelMouseDown(e) {
|
|
133
116
|
const t = e.target;
|
|
@@ -138,11 +121,11 @@ class a extends x {
|
|
|
138
121
|
t && this.contains(t) || (this.adapter.onBlur(), this._isListVisible = !1, this._isFiltering = !1);
|
|
139
122
|
}
|
|
140
123
|
render() {
|
|
141
|
-
const e = this.adapter.templateData, t = e.touched && e.errors && e.errors.length > 0,
|
|
124
|
+
const e = this.adapter.templateData, t = e.touched && e.errors && e.errors.length > 0, i = this._currentValues(), s = this._pillItems(i), a = this.adapter.getItemRenderer(
|
|
142
125
|
e.itemRenderer,
|
|
143
|
-
|
|
144
|
-
),
|
|
145
|
-
return
|
|
126
|
+
C
|
|
127
|
+
), d = !!this.widget.on?.filter;
|
|
128
|
+
return u`
|
|
146
129
|
<gui-label
|
|
147
130
|
.targetElement=${[this._listRef, this._triggerRef?.input]}
|
|
148
131
|
.uid=${this.widget.uid}
|
|
@@ -157,7 +140,7 @@ class a extends x {
|
|
|
157
140
|
<div class="gui-widget" @keydown=${this._onWidgetKeyDown} @focusout=${this._onFocusOut}>
|
|
158
141
|
<gui-multi-select-trigger
|
|
159
142
|
.uid=${this.widget.uid}
|
|
160
|
-
.pills=${
|
|
143
|
+
.pills=${s}
|
|
161
144
|
.errors=${e.errors}
|
|
162
145
|
.touched=${!!e.touched}
|
|
163
146
|
?required=${e.validator?.required}
|
|
@@ -172,7 +155,7 @@ class a extends x {
|
|
|
172
155
|
.panelId=${`${this.widget.uid}-list`}
|
|
173
156
|
.removeAriaLabel=${e.removeAriaLabel}
|
|
174
157
|
.removeIcon=${e.removeIcon}
|
|
175
|
-
.compactAriaLabel=${`${
|
|
158
|
+
.compactAriaLabel=${`${s.length} selected`}
|
|
176
159
|
@keydown=${this._onKeyDown}
|
|
177
160
|
@input=${this._onInput}
|
|
178
161
|
@focusin=${this._onFocusIn}
|
|
@@ -201,9 +184,9 @@ class a extends x {
|
|
|
201
184
|
<gui-multi-list
|
|
202
185
|
id=${`${this.widget.uid}-list`}
|
|
203
186
|
.uid=${this.widget.uid}
|
|
204
|
-
.values=${
|
|
187
|
+
.values=${P(i)}
|
|
205
188
|
.valueField=${e.valueField}
|
|
206
|
-
.items=${this._isFiltering && !
|
|
189
|
+
.items=${this._isFiltering && !d ? this._filteredItems : e.items}
|
|
207
190
|
.itemHeight=${e.itemHeight}
|
|
208
191
|
.height=${e.height}
|
|
209
192
|
?required=${e.validator?.required}
|
|
@@ -211,88 +194,83 @@ class a extends x {
|
|
|
211
194
|
?disabled=${e.disabled}
|
|
212
195
|
?readonly=${e.readonly}
|
|
213
196
|
?hidden=${!this._isListVisible}
|
|
214
|
-
@gui-
|
|
197
|
+
@gui-visible-items-change=${this._onVisibleItemsChange}
|
|
215
198
|
@gui-update-items=${this._onUpdateItems}
|
|
216
|
-
@gui-focus-change=${this._onFocusChange}
|
|
217
199
|
@gui-item-toggle=${this._onValueChange}
|
|
218
200
|
>
|
|
219
|
-
${
|
|
220
|
-
const
|
|
221
|
-
return
|
|
201
|
+
${this._visibleItems.map((r) => {
|
|
202
|
+
const c = e.labelField ?? "label", m = r.template !== null && typeof r.template == "object" && c && !e.itemRenderer ? r.template[c] : r.template;
|
|
203
|
+
return u`
|
|
222
204
|
<div
|
|
223
205
|
role="option"
|
|
224
206
|
tabindex="-1"
|
|
225
207
|
class="gui-list__item-wrapper"
|
|
226
|
-
id
|
|
208
|
+
id=${r.id}
|
|
227
209
|
style=${V({ height: `${e.itemHeight || 40}px` })}
|
|
228
|
-
aria-selected=${
|
|
229
|
-
aria-disabled=${
|
|
230
|
-
@click=${() => this._onClickItem(s, d)}
|
|
210
|
+
aria-selected=${r.selected ? "true" : "false"}
|
|
211
|
+
aria-disabled=${r.disabled ? "true" : "false"}
|
|
231
212
|
>
|
|
232
|
-
${
|
|
233
|
-
template:
|
|
234
|
-
value:
|
|
235
|
-
index:
|
|
236
|
-
selected:
|
|
237
|
-
disabled:
|
|
238
|
-
focused:
|
|
213
|
+
${a({
|
|
214
|
+
template: m,
|
|
215
|
+
value: r.value,
|
|
216
|
+
index: r.index,
|
|
217
|
+
selected: r.selected,
|
|
218
|
+
disabled: r.disabled,
|
|
219
|
+
focused: r.focused
|
|
239
220
|
})}
|
|
240
221
|
</div>
|
|
241
222
|
`;
|
|
242
223
|
})}
|
|
243
224
|
</gui-multi-list>
|
|
244
|
-
${t ?
|
|
225
|
+
${t ? u`<gui-errors
|
|
245
226
|
panel
|
|
246
227
|
.uid=${this.widget.uid}
|
|
247
228
|
.errors=${e.errors}
|
|
248
229
|
.touched=${e.touched}
|
|
249
|
-
></gui-errors>` :
|
|
230
|
+
></gui-errors>` : g}
|
|
250
231
|
</div>
|
|
251
232
|
</div>
|
|
252
233
|
|
|
253
|
-
${t ?
|
|
234
|
+
${t ? u`<gui-errors
|
|
254
235
|
.uid=${this.widget.uid}
|
|
255
236
|
.errors=${e.errors}
|
|
256
237
|
.touched=${e.touched}
|
|
257
|
-
></gui-errors>` :
|
|
238
|
+
></gui-errors>` : g}
|
|
258
239
|
`;
|
|
259
240
|
}
|
|
260
241
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
],
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
],
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
],
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
],
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
],
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
],
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
],
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
],
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
],
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
],
|
|
292
|
-
|
|
293
|
-
b(".gui-picker__panel")
|
|
294
|
-
], a.prototype, "_panelRef");
|
|
295
|
-
P("gui-multi-dropdown-input", a);
|
|
242
|
+
o([
|
|
243
|
+
v({ context: f }),
|
|
244
|
+
L({ attribute: !1 })
|
|
245
|
+
], l.prototype, "formContext");
|
|
246
|
+
o([
|
|
247
|
+
y({ context: b })
|
|
248
|
+
], l.prototype, "adapter");
|
|
249
|
+
o([
|
|
250
|
+
n()
|
|
251
|
+
], l.prototype, "_visibleItems");
|
|
252
|
+
o([
|
|
253
|
+
n()
|
|
254
|
+
], l.prototype, "_filteredItems");
|
|
255
|
+
o([
|
|
256
|
+
n()
|
|
257
|
+
], l.prototype, "_listItems");
|
|
258
|
+
o([
|
|
259
|
+
n()
|
|
260
|
+
], l.prototype, "_isFiltering");
|
|
261
|
+
o([
|
|
262
|
+
n()
|
|
263
|
+
], l.prototype, "_isListVisible");
|
|
264
|
+
o([
|
|
265
|
+
p("gui-multi-select-trigger")
|
|
266
|
+
], l.prototype, "_triggerRef");
|
|
267
|
+
o([
|
|
268
|
+
p("gui-multi-list")
|
|
269
|
+
], l.prototype, "_listRef");
|
|
270
|
+
o([
|
|
271
|
+
p(".gui-picker__panel")
|
|
272
|
+
], l.prototype, "_panelRef");
|
|
273
|
+
F("gui-multi-dropdown-input", l);
|
|
296
274
|
export {
|
|
297
|
-
|
|
275
|
+
l as MultiDropdownElement
|
|
298
276
|
};
|