@xqmsg/ui-core 0.16.3 → 0.16.4
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/ui-core.cjs.development.js +35 -24
- package/dist/ui-core.cjs.development.js.map +1 -1
- package/dist/ui-core.cjs.production.min.js +1 -1
- package/dist/ui-core.cjs.production.min.js.map +1 -1
- package/dist/ui-core.esm.js +35 -24
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/input/StackedMultiSelect/index.tsx +22 -3
package/dist/ui-core.esm.js
CHANGED
|
@@ -900,37 +900,41 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
900
900
|
var scrollRef = useRef(null);
|
|
901
901
|
var inputRef = useRef(null);
|
|
902
902
|
|
|
903
|
-
var _useState = useState(
|
|
904
|
-
|
|
905
|
-
|
|
903
|
+
var _useState = useState(false),
|
|
904
|
+
isInit = _useState[0],
|
|
905
|
+
setIsInit = _useState[1];
|
|
906
906
|
|
|
907
|
-
var _useState2 = useState(
|
|
908
|
-
|
|
909
|
-
|
|
907
|
+
var _useState2 = useState([]),
|
|
908
|
+
localValues = _useState2[0],
|
|
909
|
+
setLocalValues = _useState2[1];
|
|
910
910
|
|
|
911
|
-
var _useState3 = useState(
|
|
912
|
-
|
|
913
|
-
|
|
911
|
+
var _useState3 = useState(options),
|
|
912
|
+
localOptions = _useState3[0],
|
|
913
|
+
setLocalOptions = _useState3[1];
|
|
914
914
|
|
|
915
915
|
var _useState4 = useState(false),
|
|
916
|
-
|
|
917
|
-
|
|
916
|
+
isFocussed = _useState4[0],
|
|
917
|
+
setIsFocussed = _useState4[1];
|
|
918
918
|
|
|
919
|
-
var _useState5 = useState(
|
|
920
|
-
|
|
921
|
-
|
|
919
|
+
var _useState5 = useState(false),
|
|
920
|
+
shouldSideScroll = _useState5[0],
|
|
921
|
+
setShouldSideScroll = _useState5[1];
|
|
922
922
|
|
|
923
|
-
var _useState6 = useState(
|
|
924
|
-
|
|
925
|
-
|
|
923
|
+
var _useState6 = useState(null),
|
|
924
|
+
optionIndex = _useState6[0],
|
|
925
|
+
setOptionIndex = _useState6[1];
|
|
926
926
|
|
|
927
|
-
var _useState7 = useState(''),
|
|
928
|
-
|
|
929
|
-
|
|
927
|
+
var _useState7 = useState('top'),
|
|
928
|
+
position = _useState7[0],
|
|
929
|
+
setPosition = _useState7[1];
|
|
930
930
|
|
|
931
931
|
var _useState8 = useState(''),
|
|
932
|
-
|
|
933
|
-
|
|
932
|
+
searchValue = _useState8[0],
|
|
933
|
+
setSearchValue = _useState8[1];
|
|
934
|
+
|
|
935
|
+
var _useState9 = useState(''),
|
|
936
|
+
debouncedSearchValue = _useState9[0],
|
|
937
|
+
setDebouncedSearchValue = _useState9[1];
|
|
934
938
|
|
|
935
939
|
console.log({
|
|
936
940
|
searchValue: searchValue,
|
|
@@ -951,6 +955,7 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
951
955
|
useEffect(function () {
|
|
952
956
|
if (watchedValue !== undefined && !watchedValue.length) {
|
|
953
957
|
setLocalValues([]);
|
|
958
|
+
setIsInit(true);
|
|
954
959
|
}
|
|
955
960
|
|
|
956
961
|
if (watchedValue !== undefined && watchedValue != null && watchedValue.length) {
|
|
@@ -964,6 +969,7 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
964
969
|
setShouldSideScroll(false);
|
|
965
970
|
}
|
|
966
971
|
|
|
972
|
+
if (isInit) return;
|
|
967
973
|
setLocalValues(watchedValue.split(',').filter(Boolean).map(function (value) {
|
|
968
974
|
return options.find(function (option) {
|
|
969
975
|
return option.value === value;
|
|
@@ -972,11 +978,16 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
972
978
|
|
|
973
979
|
setLocalOptions(function (prevLocalOptions) {
|
|
974
980
|
return prevLocalOptions.filter(function (localOption) {
|
|
975
|
-
return !
|
|
981
|
+
return !watchedValue.split(',').filter(Boolean).map(function (value) {
|
|
982
|
+
return options.find(function (option) {
|
|
983
|
+
return option.value === value;
|
|
984
|
+
});
|
|
985
|
+
}).includes(localOption);
|
|
976
986
|
});
|
|
977
987
|
});
|
|
988
|
+
setIsInit(true);
|
|
978
989
|
}
|
|
979
|
-
}, [localValues, options, shouldSideScroll, watchedValue]);
|
|
990
|
+
}, [isInit, localOptions, localValues, options, shouldSideScroll, watchedValue]);
|
|
980
991
|
|
|
981
992
|
var handleChange = function handleChange(option) {
|
|
982
993
|
setShouldSideScroll(true);
|