@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 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
- newComponentValue = items.filter(function (info) { return Array.isArray(finalValue) && finalValue.includes(info.value); });
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
- newComponentValue = items.filter(function (info) { return Array.isArray(finalValue) && finalValue.includes(info.value); });
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) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pdg/react-form",
3
3
  "title": "React Form",
4
- "version": "1.0.120",
4
+ "version": "1.0.121",
5
5
  "description": "React Form",
6
6
  "type": "module",
7
7
  "types": "dist/index.d.ts",