@bigbinary/neeto-rules-frontend 2.5.15-beta-3 → 2.5.15-beta-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/NeetoRulesForm.js
CHANGED
|
@@ -3,7 +3,7 @@ import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructurin
|
|
|
3
3
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
5
|
import { shallow } from 'zustand/shallow';
|
|
6
|
-
import { useRef, useEffect, createElement,
|
|
6
|
+
import { useRef, useEffect, createElement, forwardRef, useState, useMemo, memo, Fragment as Fragment$1 } from 'react';
|
|
7
7
|
import { useFormikContext, useField, FieldArray, ErrorMessage, Formik, Form as Form$1 } from 'formik';
|
|
8
8
|
import { findBy, isNotEmpty, isPresent, renameKeys, nullSafe, noop, toLabelAndValue, removeBy } from '@bigbinary/neeto-cist';
|
|
9
9
|
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
@@ -89,7 +89,7 @@ var useActiveField = function useActiveField(name) {
|
|
|
89
89
|
useEffect(function () {
|
|
90
90
|
if (!shouldAutoFocus || activeField) return;
|
|
91
91
|
setFieldActive();
|
|
92
|
-
}, []);
|
|
92
|
+
}, [name]);
|
|
93
93
|
useEffect(function () {
|
|
94
94
|
var shouldFocus = shouldFocusRef.current;
|
|
95
95
|
shouldFocusRef.current = true;
|
|
@@ -104,10 +104,12 @@ var useActiveField = function useActiveField(name) {
|
|
|
104
104
|
shouldFocusRef.current = !ref.current;
|
|
105
105
|
if (needsRerender) {
|
|
106
106
|
setPanelState(assocPath(["data", "activeField"], null));
|
|
107
|
+
requestAnimationFrame(function () {
|
|
108
|
+
return setPanelState(assocPath(["data", "activeField"], name));
|
|
109
|
+
});
|
|
110
|
+
} else {
|
|
111
|
+
setPanelState(assocPath(["data", "activeField"], name));
|
|
107
112
|
}
|
|
108
|
-
requestAnimationFrame(function () {
|
|
109
|
-
return setPanelState(assocPath(["data", "activeField"], name));
|
|
110
|
-
});
|
|
111
113
|
};
|
|
112
114
|
var resetActiveField = function resetActiveField() {
|
|
113
115
|
return setPanelState(assocPath(["data", "activeField"], null));
|
|
@@ -947,17 +949,17 @@ var EditorAction = function EditorAction(_ref) {
|
|
|
947
949
|
editorRef = _ref$editorRef === void 0 ? null : _ref$editorRef,
|
|
948
950
|
defaults = _ref.defaults,
|
|
949
951
|
otherProps = _objectWithoutProperties(_ref, _excluded$d);
|
|
950
|
-
var
|
|
951
|
-
|
|
952
|
-
editorData =
|
|
953
|
-
setEditorData =
|
|
952
|
+
var _useStateWithDependen = useStateWithDependency(value, [name]),
|
|
953
|
+
_useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
|
|
954
|
+
editorData = _useStateWithDependen2[0],
|
|
955
|
+
setEditorData = _useStateWithDependen2[1];
|
|
954
956
|
var _useFormikContext = useFormikContext(),
|
|
955
957
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
956
958
|
var debouncedValue = useDebounce(editorData, 200);
|
|
957
959
|
useEffect(function () {
|
|
958
960
|
setFieldValue(name, editorData);
|
|
959
961
|
}, [debouncedValue]);
|
|
960
|
-
return /*#__PURE__*/
|
|
962
|
+
return /*#__PURE__*/createElement(FormikEditor, _objectSpread$n({
|
|
961
963
|
addons: addons,
|
|
962
964
|
autoFocus: autoFocus,
|
|
963
965
|
defaults: defaults,
|
|
@@ -967,6 +969,7 @@ var EditorAction = function EditorAction(_ref) {
|
|
|
967
969
|
hideSlashCommands: true,
|
|
968
970
|
className: "w-full",
|
|
969
971
|
"data-cy": "neeto-editor",
|
|
972
|
+
key: name,
|
|
970
973
|
ref: editorRef,
|
|
971
974
|
onChange: setEditorData
|
|
972
975
|
}, otherProps));
|