aport-tools 4.4.48 → 4.4.51
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/dist/index.esm.js +9 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! aport-tools v4.4.
|
1
|
+
/*! aport-tools v4.4.51 | ISC */
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
var React = require('react');
|
@@ -826,15 +826,19 @@ var InputList = function InputList(_a) {
|
|
826
826
|
setSelectedOptions = _l[1];
|
827
827
|
// Update form value when firstValue changes
|
828
828
|
React.useEffect(function () {
|
829
|
+
if (!firstValue || firstValue.length === 0) return;
|
830
|
+
var matchedSelections = options.filter(function (opt) {
|
831
|
+
return firstValue.includes(opt.value);
|
832
|
+
});
|
829
833
|
if (multi) {
|
830
|
-
setSelectedOptions(
|
831
|
-
setFormValue(name,
|
834
|
+
setSelectedOptions(matchedSelections);
|
835
|
+
setFormValue(name, matchedSelections, matchedSelections);
|
832
836
|
} else {
|
833
|
-
var singleValue =
|
837
|
+
var singleValue = matchedSelections[0] || null;
|
834
838
|
setSelectedOptions(singleValue);
|
835
839
|
setFormValue(name, singleValue, singleValue);
|
836
840
|
}
|
837
|
-
}, [firstValue, multi
|
841
|
+
}, [firstValue, multi]);
|
838
842
|
// Handle option selection
|
839
843
|
var handleSelectOption = function handleSelectOption(option) {
|
840
844
|
var updatedSelections;
|