@agility/plenum-ui 1.2.6 → 1.2.7
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/lib/components/Combobox/Combobox.d.ts +2 -2
- package/lib/index.esm.js +7 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +7 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -7184,7 +7184,7 @@ function classNames() {
|
|
|
7184
7184
|
}
|
|
7185
7185
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
7186
7186
|
var Combobox = function (_a) {
|
|
7187
|
-
var label = _a.label, items = _a.items, displayProperty = _a.displayProperty, keyProperty = _a.keyProperty, onChange = _a.onChange, placeholder = _a.placeholder, message = _a.message, isDisabled = _a.isDisabled, isError = _a.isError, isRequired = _a.isRequired, id = _a.id, nullable = _a.nullable;
|
|
7187
|
+
var label = _a.label, items = _a.items, displayProperty = _a.displayProperty, displayValue = _a.displayValue, keyProperty = _a.keyProperty, onChange = _a.onChange, placeholder = _a.placeholder, message = _a.message, isDisabled = _a.isDisabled, isError = _a.isError, isRequired = _a.isRequired, id = _a.id, nullable = _a.nullable;
|
|
7188
7188
|
var _b = React.useState(""), query = _b[0], setQuery = _b[1];
|
|
7189
7189
|
var _c = React.useState(), selectedItem = _c[0], setSelectedItem = _c[1];
|
|
7190
7190
|
var onChangeValue = function (value) {
|
|
@@ -7195,6 +7195,12 @@ var Combobox = function (_a) {
|
|
|
7195
7195
|
setSelectedItem(value);
|
|
7196
7196
|
}
|
|
7197
7197
|
};
|
|
7198
|
+
React.useEffect(function () {
|
|
7199
|
+
if (displayValue) {
|
|
7200
|
+
var dv = items.find(function (i) { return i[displayProperty] === displayValue; });
|
|
7201
|
+
setSelectedItem(dv);
|
|
7202
|
+
}
|
|
7203
|
+
}, [displayValue]);
|
|
7198
7204
|
React.useEffect(function () {
|
|
7199
7205
|
typeof onChange === "function" && onChange(selectedItem);
|
|
7200
7206
|
}, [selectedItem]);
|