@homebound/beam 2.97.1 → 2.97.2
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.
|
@@ -198,7 +198,22 @@ function SelectFieldBase(props) {
|
|
|
198
198
|
// Only update the fieldset when options change, when options is an array.
|
|
199
199
|
// Otherwise, if the options are passed in as an object, then we assume the caller is updating options via a Promise and not via updating props.
|
|
200
200
|
if (Array.isArray(maybeOptions) && maybeOptions !== fieldState.allOptions) {
|
|
201
|
-
setFieldState((prevState) =>
|
|
201
|
+
setFieldState((prevState) => {
|
|
202
|
+
var _a;
|
|
203
|
+
const selectedOptions = maybeOptions.filter((o) => values === null || values === void 0 ? void 0 : values.includes(getOptionValue(o)));
|
|
204
|
+
return {
|
|
205
|
+
...prevState,
|
|
206
|
+
selectedKeys: (_a = selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.map((o) => (0, Value_1.valueToKey)(getOptionValue(o)))) !== null && _a !== void 0 ? _a : [],
|
|
207
|
+
inputValue: selectedOptions.length === 1
|
|
208
|
+
? getOptionLabel(selectedOptions[0])
|
|
209
|
+
: multiselect && selectedOptions.length === 0
|
|
210
|
+
? nothingSelectedText
|
|
211
|
+
: "",
|
|
212
|
+
selectedOptions: selectedOptions,
|
|
213
|
+
filteredOptions: maybeOptions,
|
|
214
|
+
allOptions: maybeOptions,
|
|
215
|
+
};
|
|
216
|
+
});
|
|
202
217
|
}
|
|
203
218
|
}, [maybeOptions]);
|
|
204
219
|
// For the most part, the returned props contain `aria-*` and `id` attributes for accessibility purposes.
|