@maif/react-forms 1.0.15 → 1.0.16
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/README.md +3 -3
- package/dist/react-form.js +1 -1
- package/lib/form.js +9 -7
- package/lib/inputs/CodeInput.js +6 -2
- package/package.json +1 -1
package/lib/form.js
CHANGED
|
@@ -69,7 +69,7 @@ var usePrevious = function usePrevious(value) {
|
|
|
69
69
|
var ref = (0, _react.useRef)(); // Store current value in ref
|
|
70
70
|
|
|
71
71
|
(0, _react.useEffect)(function () {
|
|
72
|
-
ref.current = value;
|
|
72
|
+
ref.current = JSON.parse(JSON.stringify(value));
|
|
73
73
|
}, [value]); // Only re-run if value changes
|
|
74
74
|
// Return previous value (happens before update in useEffect above)
|
|
75
75
|
|
|
@@ -102,7 +102,7 @@ var BasicWrapper = function BasicWrapper(_ref) {
|
|
|
102
102
|
|
|
103
103
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
104
104
|
className: "form-group mt-3"
|
|
105
|
-
}, /*#__PURE__*/_react["default"].createElement("label", {
|
|
105
|
+
}, label && /*#__PURE__*/_react["default"].createElement("label", {
|
|
106
106
|
className: "form-label d-flex align-content-center",
|
|
107
107
|
htmlFor: entry
|
|
108
108
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
@@ -314,7 +314,9 @@ var Form = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
|
314
314
|
}, [data]);
|
|
315
315
|
|
|
316
316
|
if (options.watch) {
|
|
317
|
+
console.group('react-form watch');
|
|
317
318
|
console.log(watch());
|
|
319
|
+
console.groupEnd();
|
|
318
320
|
}
|
|
319
321
|
|
|
320
322
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
@@ -365,7 +367,7 @@ var Form = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
|
365
367
|
key: "".concat(entry, "-").concat(idx),
|
|
366
368
|
entry: entry,
|
|
367
369
|
error: error,
|
|
368
|
-
label: (step === null || step === void 0 ? void 0 : step.label) || entry,
|
|
370
|
+
label: (step === null || step === void 0 ? void 0 : step.label) === null ? null : (step === null || step === void 0 ? void 0 : step.label) || entry,
|
|
369
371
|
help: step === null || step === void 0 ? void 0 : step.help,
|
|
370
372
|
render: inputWrapper
|
|
371
373
|
}, /*#__PURE__*/_react["default"].createElement(Step, {
|
|
@@ -480,7 +482,7 @@ var Step = function Step(_ref4) {
|
|
|
480
482
|
key: "collapse-".concat(en, "-").concat(entryIdx),
|
|
481
483
|
entry: en,
|
|
482
484
|
error: err,
|
|
483
|
-
label: (stp === null || stp === void 0 ? void 0 : stp.label) || en,
|
|
485
|
+
label: (stp === null || stp === void 0 ? void 0 : stp.label) === null ? null : (stp === null || stp === void 0 ? void 0 : stp.label) || en,
|
|
484
486
|
help: stp === null || stp === void 0 ? void 0 : stp.help,
|
|
485
487
|
render: inputWrapper
|
|
486
488
|
}, /*#__PURE__*/_react["default"].createElement(Step, {
|
|
@@ -582,13 +584,13 @@ var Step = function Step(_ref4) {
|
|
|
582
584
|
rawValues: getValues()
|
|
583
585
|
}, field),
|
|
584
586
|
error: error
|
|
585
|
-
}, /*#__PURE__*/_react["default"].createElement(_index.CodeInput, _extends({
|
|
587
|
+
}, /*#__PURE__*/_react["default"].createElement(_index.CodeInput, _extends({
|
|
586
588
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
587
589
|
readOnly: step.disabled ? 'readOnly' : null,
|
|
588
590
|
onChange: field.onChange,
|
|
589
591
|
value: field.value,
|
|
590
592
|
defaultValue: defaultValue
|
|
591
|
-
}, step)));
|
|
593
|
+
}, step.props)));
|
|
592
594
|
}
|
|
593
595
|
});
|
|
594
596
|
|
|
@@ -1087,7 +1089,7 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1087
1089
|
key: "".concat(entry, ".").concat(idx),
|
|
1088
1090
|
entry: "".concat(parent, ".").concat(entry),
|
|
1089
1091
|
error: realError,
|
|
1090
|
-
label: step.label || entry,
|
|
1092
|
+
label: (step === null || step === void 0 ? void 0 : step.label) === null ? null : (step === null || step === void 0 ? void 0 : step.label) || entry,
|
|
1091
1093
|
help: step.help,
|
|
1092
1094
|
render: inputWrapper
|
|
1093
1095
|
}, /*#__PURE__*/_react["default"].createElement(Step, {
|
package/lib/inputs/CodeInput.js
CHANGED
|
@@ -33,6 +33,8 @@ var _excluded = ["onChange", "value", "className", "readOnly", "theme", "mode"];
|
|
|
33
33
|
|
|
34
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
35
35
|
|
|
36
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
37
|
+
|
|
36
38
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
37
39
|
|
|
38
40
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -49,7 +51,7 @@ var CodeInput = function CodeInput(_ref) {
|
|
|
49
51
|
mode = _ref$mode === void 0 ? 'javascript' : _ref$mode,
|
|
50
52
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
51
53
|
|
|
52
|
-
return /*#__PURE__*/_react["default"].createElement(_reactAce["default"], {
|
|
54
|
+
return /*#__PURE__*/_react["default"].createElement(_reactAce["default"], _extends({
|
|
53
55
|
commands: _extBeautify["default"].commands,
|
|
54
56
|
className: className,
|
|
55
57
|
readOnly: readOnly,
|
|
@@ -79,7 +81,9 @@ var CodeInput = function CodeInput(_ref) {
|
|
|
79
81
|
highlightActiveLine: true,
|
|
80
82
|
enableBasicAutocompletion: true,
|
|
81
83
|
enableLiveAutocompletion: true
|
|
82
|
-
}
|
|
84
|
+
}, props, {
|
|
85
|
+
ref: props.setRef
|
|
86
|
+
}));
|
|
83
87
|
};
|
|
84
88
|
|
|
85
89
|
exports.CodeInput = CodeInput;
|