intelicoreact 1.5.11 → 1.5.12

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.
@@ -23,6 +23,7 @@ const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
23
23
  form,
24
24
  formId,
25
25
  setForm,
26
+ getActualForm: getActualFormOuter,
26
27
  onChange,
27
28
  renderField,
28
29
  getAnotherActions,
@@ -35,7 +36,7 @@ const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
35
36
  const [initialForm] = (0, _react.useState)((0, _utils.clone)(form));
36
37
  const safelySetForm = typeof setForm === "function" ? setForm : () => {};
37
38
  const safelyOnChange = typeof onChange === "function" ? onChange : () => {};
38
- const getActualForm = () => form;
39
+ const getActualForm = typeof getActualFormOuter === "function" ? getActualFormOuter : () => form;
39
40
  const {
40
41
  assignChangesToField
41
42
  } = (0, _useFormFieldsChangesManager.default)({
@@ -72,9 +73,13 @@ const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
72
73
  const handleChange = (newValue, fieldKey, propKey, additionalOfOnChange) => {
73
74
  const {
74
75
  updatedForm = null,
75
- isMakeChangesAnyway = false
76
+ isMakeChangesAnyway = false,
77
+ isUseActualForm = false
76
78
  } = (0, _utils.getIsOnlyAnObject)(additionalOfOnChange) ? additionalOfOnChange : {};
77
- const currentForm = (0, _utils.clone)(Array.isArray(updatedForm) ? updatedForm : form);
79
+ const currentForm = (0, _utils.clone)((() => {
80
+ if (isUseActualForm) return getActualForm();
81
+ return Array.isArray(updatedForm) ? updatedForm : form;
82
+ })());
78
83
  const currField = (0, _utils.clone)(currentForm.find(field => field.key === fieldKey));
79
84
 
80
85
  // ? Защита от дублирующих вызовов onChange снизу
@@ -86,7 +91,10 @@ const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
86
91
  if (currField[propKey || "value"] === newValue && !isMakeChangesAnyway) return;
87
92
 
88
93
  // ? Сразу же мутируем
89
- safelyOnChange(newValue, fieldKey, propKey, additionalOfOnChange);
94
+ safelyOnChange(newValue, fieldKey, propKey, {
95
+ ...additionalOfOnChange,
96
+ updatedForm: currentForm
97
+ });
90
98
 
91
99
  // ? Механика dependOn (обработка зависимостей)
92
100
  // ? В текущей реализации отделил от экшена all.
@@ -143,9 +151,7 @@ const FormWithDependOn = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
143
151
  }, [isInitializeByDependOn]);
144
152
 
145
153
  // ***** output *****
146
- return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
147
- ref: ref
148
- }, formId ? {
154
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, formId ? {
149
155
  id: formId
150
156
  } : {}, {
151
157
  className: (0, _classnames.default)(RC, className)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.5.11",
3
+ "version": "1.5.12",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [