@pdg/react-form 1.0.120 → 1.0.121
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 +17 -2
- package/dist/index.js +17 -2
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3976,6 +3976,17 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
3976
3976
|
return {};
|
|
3977
3977
|
}
|
|
3978
3978
|
}, [items]);
|
|
3979
|
+
var itemsInfos = useMemo(function () {
|
|
3980
|
+
if (items) {
|
|
3981
|
+
return items.reduce(function (res, info) {
|
|
3982
|
+
res[info.value.toString()] = info;
|
|
3983
|
+
return res;
|
|
3984
|
+
}, {});
|
|
3985
|
+
}
|
|
3986
|
+
else {
|
|
3987
|
+
return {};
|
|
3988
|
+
}
|
|
3989
|
+
}, [items]);
|
|
3979
3990
|
var style = useMemo(function () {
|
|
3980
3991
|
var style = __assign({ minWidth: 120 }, initStyle);
|
|
3981
3992
|
if (hidden) {
|
|
@@ -4097,7 +4108,11 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4097
4108
|
if (notEmpty(finalValue)) {
|
|
4098
4109
|
if (items) {
|
|
4099
4110
|
if (Array.isArray(finalValue)) {
|
|
4100
|
-
|
|
4111
|
+
finalValue.forEach(function (v) {
|
|
4112
|
+
if (itemsInfos[v]) {
|
|
4113
|
+
newComponentValue && newComponentValue.push(itemsInfos[v]);
|
|
4114
|
+
}
|
|
4115
|
+
});
|
|
4101
4116
|
}
|
|
4102
4117
|
else {
|
|
4103
4118
|
newComponentValue = (items.find(function (info) { return info.value === value; }) ||
|
|
@@ -4124,7 +4139,7 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4124
4139
|
oldComponentValueRef.current = newComponentValue;
|
|
4125
4140
|
return newComponentValue;
|
|
4126
4141
|
}
|
|
4127
|
-
}, [value, multiple, items, valueItem]);
|
|
4142
|
+
}, [value, multiple, items, valueItem, itemsInfos]);
|
|
4128
4143
|
useEffect(function () {
|
|
4129
4144
|
if (async && onAsyncLoadValueItem) {
|
|
4130
4145
|
if (value != null) {
|
package/dist/index.js
CHANGED
|
@@ -3976,6 +3976,17 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
3976
3976
|
return {};
|
|
3977
3977
|
}
|
|
3978
3978
|
}, [items]);
|
|
3979
|
+
var itemsInfos = React.useMemo(function () {
|
|
3980
|
+
if (items) {
|
|
3981
|
+
return items.reduce(function (res, info) {
|
|
3982
|
+
res[info.value.toString()] = info;
|
|
3983
|
+
return res;
|
|
3984
|
+
}, {});
|
|
3985
|
+
}
|
|
3986
|
+
else {
|
|
3987
|
+
return {};
|
|
3988
|
+
}
|
|
3989
|
+
}, [items]);
|
|
3979
3990
|
var style = React.useMemo(function () {
|
|
3980
3991
|
var style = __assign({ minWidth: 120 }, initStyle);
|
|
3981
3992
|
if (hidden) {
|
|
@@ -4097,7 +4108,11 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4097
4108
|
if (util.notEmpty(finalValue)) {
|
|
4098
4109
|
if (items) {
|
|
4099
4110
|
if (Array.isArray(finalValue)) {
|
|
4100
|
-
|
|
4111
|
+
finalValue.forEach(function (v) {
|
|
4112
|
+
if (itemsInfos[v]) {
|
|
4113
|
+
newComponentValue && newComponentValue.push(itemsInfos[v]);
|
|
4114
|
+
}
|
|
4115
|
+
});
|
|
4101
4116
|
}
|
|
4102
4117
|
else {
|
|
4103
4118
|
newComponentValue = (items.find(function (info) { return info.value === value; }) ||
|
|
@@ -4124,7 +4139,7 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4124
4139
|
oldComponentValueRef.current = newComponentValue;
|
|
4125
4140
|
return newComponentValue;
|
|
4126
4141
|
}
|
|
4127
|
-
}, [value, multiple, items, valueItem]);
|
|
4142
|
+
}, [value, multiple, items, valueItem, itemsInfos]);
|
|
4128
4143
|
React.useEffect(function () {
|
|
4129
4144
|
if (async && onAsyncLoadValueItem) {
|
|
4130
4145
|
if (value != null) {
|