@vitrosoftware/common-ui-ts 1.1.151 → 1.1.152
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.js
CHANGED
|
@@ -63150,7 +63150,7 @@ var Viewer = function Viewer(props) {
|
|
|
63150
63150
|
};
|
|
63151
63151
|
|
|
63152
63152
|
var name = "@vitrosoftware/common-ui-ts";
|
|
63153
|
-
var version$1 = "1.1.
|
|
63153
|
+
var version$1 = "1.1.152";
|
|
63154
63154
|
var description = "vitro software common ui ts";
|
|
63155
63155
|
var author = "";
|
|
63156
63156
|
var license = "MIT";
|
|
@@ -64707,9 +64707,13 @@ var LookupPicker = React.forwardRef(function (props, ref) {
|
|
|
64707
64707
|
var selectedValue = valueList.find(function (x) {
|
|
64708
64708
|
return x.id === id;
|
|
64709
64709
|
});
|
|
64710
|
-
|
|
64711
|
-
|
|
64712
|
-
|
|
64710
|
+
var newValueList = props.isMultiSelect ? [].concat(selectedValueList, [selectedValue]) : [selectedValue];
|
|
64711
|
+
var isValueChanged = checkIsValueChanged(selectedValueList, newValueList);
|
|
64712
|
+
if (isValueChanged) {
|
|
64713
|
+
setSelectedValueList(newValueList);
|
|
64714
|
+
setInputValue(CTRL.EMPTY);
|
|
64715
|
+
props.onChange && props.onChange(props.isMultiSelect ? [].concat(selectedValueList, [selectedValue]) : selectedValue, props.name);
|
|
64716
|
+
}
|
|
64713
64717
|
if (props.isMultiSelect) {
|
|
64714
64718
|
inputRef && inputRef.current && inputRef.current.focus();
|
|
64715
64719
|
} else {
|
|
@@ -64717,6 +64721,29 @@ var LookupPicker = React.forwardRef(function (props, ref) {
|
|
|
64717
64721
|
setState(CTRL.EMPTY);
|
|
64718
64722
|
}
|
|
64719
64723
|
};
|
|
64724
|
+
var checkIsValueChanged = function checkIsValueChanged(oldValueList, newValueList) {
|
|
64725
|
+
if (!((oldValueList === null || oldValueList === void 0 ? void 0 : oldValueList.length) > 0) && !((newValueList === null || newValueList === void 0 ? void 0 : newValueList.length) > 0)) {
|
|
64726
|
+
return false;
|
|
64727
|
+
} else if ((oldValueList === null || oldValueList === void 0 ? void 0 : oldValueList.length) == (newValueList === null || newValueList === void 0 ? void 0 : newValueList.length)) {
|
|
64728
|
+
var _loop = function _loop() {
|
|
64729
|
+
var item = _step.value;
|
|
64730
|
+
if (!oldValueList.find(function (oldItem) {
|
|
64731
|
+
return oldItem.id == item.id;
|
|
64732
|
+
})) {
|
|
64733
|
+
return {
|
|
64734
|
+
v: true
|
|
64735
|
+
};
|
|
64736
|
+
}
|
|
64737
|
+
};
|
|
64738
|
+
for (var _iterator = _createForOfIteratorHelperLoose(newValueList), _step; !(_step = _iterator()).done;) {
|
|
64739
|
+
var _ret = _loop();
|
|
64740
|
+
if (typeof _ret === "object") return _ret.v;
|
|
64741
|
+
}
|
|
64742
|
+
return false;
|
|
64743
|
+
} else {
|
|
64744
|
+
return true;
|
|
64745
|
+
}
|
|
64746
|
+
};
|
|
64720
64747
|
var onOptionValueDelete = function onOptionValueDelete(id) {
|
|
64721
64748
|
if (!props.isDisabled) {
|
|
64722
64749
|
var _inputRef$current2;
|