@studiocms/ui 0.4.15 → 0.4.16
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.
|
@@ -187,7 +187,8 @@ const defaultLabel = selected
|
|
|
187
187
|
const isSelected = Array.isArray(selected)
|
|
188
188
|
? selected.map((y) => y && y.value).includes(x.value)
|
|
189
189
|
: selected?.value === x.value;
|
|
190
|
-
|
|
190
|
+
|
|
191
|
+
return (
|
|
191
192
|
<option
|
|
192
193
|
value={x.value}
|
|
193
194
|
selected={isSelected}
|
|
@@ -82,12 +82,9 @@ function loadSearchSelects() {
|
|
|
82
82
|
);
|
|
83
83
|
if (option) {
|
|
84
84
|
option.classList.toggle("selected", forceState ?? !isCurrentlySelected);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
);
|
|
89
|
-
if (selectOption) {
|
|
90
|
-
selectOption.selected = forceState ?? !isCurrentlySelected;
|
|
85
|
+
if (container && container.select) {
|
|
86
|
+
container.select.value = option.getAttribute("value");
|
|
87
|
+
}
|
|
91
88
|
}
|
|
92
89
|
const selectedCountEl = container.querySelector(
|
|
93
90
|
".sui-search-select-max-span .sui-search-select-select-count"
|
|
@@ -117,12 +114,12 @@ function loadSearchSelects() {
|
|
|
117
114
|
};
|
|
118
115
|
const reconstructOptions = (filteredOptions, state2, container) => {
|
|
119
116
|
container.dropdown.innerHTML = "";
|
|
120
|
-
let i = 0;
|
|
121
117
|
const selectedValues = state2.selectedOptionsMap[container.dataset.id] || [];
|
|
122
118
|
if (filteredOptions.length === 0) {
|
|
123
119
|
container.dropdown.innerHTML = '<li class="empty-search-results">No results found</li>';
|
|
124
120
|
return;
|
|
125
121
|
}
|
|
122
|
+
let i = 0;
|
|
126
123
|
for (const option of filteredOptions) {
|
|
127
124
|
const element = document.createElement("li");
|
|
128
125
|
element.classList.add("sui-search-select-option");
|
|
@@ -198,7 +198,8 @@ const defaultLabel = selected
|
|
|
198
198
|
const isSelected = Array.isArray(selected)
|
|
199
199
|
? selected.map((y) => y && y.value).includes(x.value)
|
|
200
200
|
: selected?.value === x.value;
|
|
201
|
-
|
|
201
|
+
|
|
202
|
+
return (
|
|
202
203
|
<option
|
|
203
204
|
value={x.value}
|
|
204
205
|
selected={isSelected}
|
|
@@ -188,20 +188,11 @@ function loadSelects() {
|
|
|
188
188
|
} else {
|
|
189
189
|
if (lastActive) {
|
|
190
190
|
lastActive.classList.remove("selected");
|
|
191
|
-
const lastSelectOpt = container?.select?.querySelector(
|
|
192
|
-
`option[value='${lastActive.getAttribute("value")}']`
|
|
193
|
-
);
|
|
194
|
-
if (lastSelectOpt) {
|
|
195
|
-
lastSelectOpt.selected = false;
|
|
196
|
-
}
|
|
197
191
|
}
|
|
198
192
|
if (option) {
|
|
199
193
|
option.classList.add("selected");
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
);
|
|
203
|
-
if (selectOpt) {
|
|
204
|
-
selectOpt.selected = true;
|
|
194
|
+
if (container && container.select) {
|
|
195
|
+
container.select.value = option.getAttribute("value");
|
|
205
196
|
}
|
|
206
197
|
updateLabel(state2, container);
|
|
207
198
|
}
|