@maif/react-forms 1.0.44 → 1.0.47
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/lib/esm/index.js +79 -75
- package/lib/index.js +79 -75
- package/package.json +1 -1
package/lib/esm/index.js
CHANGED
|
@@ -1251,7 +1251,7 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1251
1251
|
}, /*#__PURE__*/React.createElement("input", {
|
|
1252
1252
|
disabled: props.disabled,
|
|
1253
1253
|
type: "text",
|
|
1254
|
-
className: classNames(classes.w_50),
|
|
1254
|
+
className: classNames(classes.w_50, classes.input),
|
|
1255
1255
|
placeholder: props.placeholderKey,
|
|
1256
1256
|
value: key,
|
|
1257
1257
|
onChange: function onChange(e) {
|
|
@@ -1260,7 +1260,7 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1260
1260
|
}), /*#__PURE__*/React.createElement("input", {
|
|
1261
1261
|
disabled: props.disabled,
|
|
1262
1262
|
type: "text",
|
|
1263
|
-
className: classNames(classes.w_50),
|
|
1263
|
+
className: classNames(classes.w_50, classes.input),
|
|
1264
1264
|
placeholder: props.placeholderValue,
|
|
1265
1265
|
value: value,
|
|
1266
1266
|
onChange: function onChange(e) {
|
|
@@ -29120,8 +29120,8 @@ var cleanInputArray = function cleanInputArray(obj, defaultValues, flow, subSche
|
|
|
29120
29120
|
return f.map(function (v) {
|
|
29121
29121
|
return v.flow || v;
|
|
29122
29122
|
});
|
|
29123
|
-
}).map(arrayFlatten).getOrElse(Object.keys(subSchema));
|
|
29124
|
-
return Object.entries(subSchema).filter(function (_ref2) {
|
|
29123
|
+
}).map(arrayFlatten).getOrElse(Object.keys(subSchema || {}));
|
|
29124
|
+
return Object.entries(subSchema || {}).filter(function (_ref2) {
|
|
29125
29125
|
var _ref3 = _slicedToArray(_ref2, 1),
|
|
29126
29126
|
key = _ref3[0];
|
|
29127
29127
|
|
|
@@ -29137,14 +29137,16 @@ var cleanInputArray = function cleanInputArray(obj, defaultValues, flow, subSche
|
|
|
29137
29137
|
|
|
29138
29138
|
if (step.array && !step.render) {
|
|
29139
29139
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, (v || []).map(function (value) {
|
|
29140
|
+
var _subSchema$key, _subSchema$key2;
|
|
29141
|
+
|
|
29140
29142
|
return {
|
|
29141
|
-
value: value
|
|
29143
|
+
value: _typeof$1(value) === 'object' && !(value instanceof Date) && !Array.isArray(value) ? cleanInputArray(value, defaultValues, (_subSchema$key = subSchema[key]) === null || _subSchema$key === void 0 ? void 0 : _subSchema$key.flow, ((_subSchema$key2 = subSchema[key]) === null || _subSchema$key2 === void 0 ? void 0 : _subSchema$key2.schema) || {}) : value
|
|
29142
29144
|
};
|
|
29143
29145
|
})));
|
|
29144
29146
|
} else if (_typeof$1(v) === 'object' && !(v instanceof Date) && !Array.isArray(v)) {
|
|
29145
|
-
var _subSchema$
|
|
29147
|
+
var _subSchema$key3, _subSchema$key4;
|
|
29146
29148
|
|
|
29147
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanInputArray(v, defaultValues, (_subSchema$
|
|
29149
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanInputArray(v, defaultValues, (_subSchema$key3 = subSchema[key]) === null || _subSchema$key3 === void 0 ? void 0 : _subSchema$key3.flow, ((_subSchema$key4 = subSchema[key]) === null || _subSchema$key4 === void 0 ? void 0 : _subSchema$key4.schema) || {})));
|
|
29148
29150
|
} else {
|
|
29149
29151
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v === undefined ? Array.isArray(v) ? [] : step.type === type.object ? {} : null : v));
|
|
29150
29152
|
}
|
|
@@ -29166,21 +29168,23 @@ var cleanOutputArray = function cleanOutputArray(obj, subSchema) {
|
|
|
29166
29168
|
}).getOrElse(false);
|
|
29167
29169
|
|
|
29168
29170
|
if (isArray) {
|
|
29169
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v.map(function (
|
|
29170
|
-
var
|
|
29171
|
-
|
|
29171
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v.map(function (step) {
|
|
29172
|
+
var _subSchema$key5;
|
|
29173
|
+
|
|
29174
|
+
if (!!step.value && _typeof$1(step.value) === 'object' && !(step.value instanceof Date && !Array.isArray(step.value))) return cleanOutputArray(step.value, ((_subSchema$key5 = subSchema[key]) === null || _subSchema$key5 === void 0 ? void 0 : _subSchema$key5.schema) || {});
|
|
29175
|
+
return step.value;
|
|
29172
29176
|
})));
|
|
29173
29177
|
}
|
|
29174
29178
|
|
|
29175
29179
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v));
|
|
29176
29180
|
} else if (!!v && _typeof$1(v) === 'object' && !(v instanceof Date && !Array.isArray(v))) {
|
|
29177
|
-
var _subSchema$
|
|
29181
|
+
var _subSchema$key6;
|
|
29178
29182
|
|
|
29179
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanOutputArray(v, ((_subSchema$
|
|
29183
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanOutputArray(v, ((_subSchema$key6 = subSchema[key]) === null || _subSchema$key6 === void 0 ? void 0 : _subSchema$key6.schema) || {})));
|
|
29180
29184
|
} else {
|
|
29181
|
-
var _subSchema$
|
|
29185
|
+
var _subSchema$key7;
|
|
29182
29186
|
|
|
29183
|
-
if (((_subSchema$
|
|
29187
|
+
if (((_subSchema$key7 = subSchema[key]) === null || _subSchema$key7 === void 0 ? void 0 : _subSchema$key7.type) === 'json') {
|
|
29184
29188
|
try {
|
|
29185
29189
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, JSON.parse(v)));
|
|
29186
29190
|
} catch (err) {
|
|
@@ -29205,14 +29209,14 @@ var validate = function validate(flow, schema, value) {
|
|
|
29205
29209
|
});
|
|
29206
29210
|
};
|
|
29207
29211
|
|
|
29208
|
-
var Watcher = function Watcher(
|
|
29209
|
-
var options =
|
|
29210
|
-
control =
|
|
29211
|
-
schema =
|
|
29212
|
-
onSubmit =
|
|
29213
|
-
handleSubmit =
|
|
29214
|
-
|
|
29215
|
-
|
|
29212
|
+
var Watcher = function Watcher(_ref6) {
|
|
29213
|
+
var options = _ref6.options,
|
|
29214
|
+
control = _ref6.control,
|
|
29215
|
+
schema = _ref6.schema,
|
|
29216
|
+
onSubmit = _ref6.onSubmit,
|
|
29217
|
+
handleSubmit = _ref6.handleSubmit;
|
|
29218
|
+
_ref6.getValues;
|
|
29219
|
+
_ref6.watch;
|
|
29216
29220
|
var data = useWatch({
|
|
29217
29221
|
control: control
|
|
29218
29222
|
});
|
|
@@ -29238,20 +29242,20 @@ var Watcher = function Watcher(_ref7) {
|
|
|
29238
29242
|
return null;
|
|
29239
29243
|
};
|
|
29240
29244
|
|
|
29241
|
-
var Form = /*#__PURE__*/React.forwardRef(function (
|
|
29242
|
-
var schema =
|
|
29243
|
-
flow =
|
|
29244
|
-
value =
|
|
29245
|
-
inputWrapper =
|
|
29246
|
-
onSubmit =
|
|
29247
|
-
|
|
29248
|
-
onError =
|
|
29249
|
-
footer =
|
|
29250
|
-
|
|
29251
|
-
style =
|
|
29252
|
-
className =
|
|
29253
|
-
|
|
29254
|
-
options =
|
|
29245
|
+
var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
29246
|
+
var schema = _ref7.schema,
|
|
29247
|
+
flow = _ref7.flow,
|
|
29248
|
+
value = _ref7.value,
|
|
29249
|
+
inputWrapper = _ref7.inputWrapper,
|
|
29250
|
+
onSubmit = _ref7.onSubmit,
|
|
29251
|
+
_ref7$onError = _ref7.onError,
|
|
29252
|
+
onError = _ref7$onError === void 0 ? function () {} : _ref7$onError,
|
|
29253
|
+
footer = _ref7.footer,
|
|
29254
|
+
_ref7$style = _ref7.style,
|
|
29255
|
+
style = _ref7$style === void 0 ? {} : _ref7$style,
|
|
29256
|
+
className = _ref7.className,
|
|
29257
|
+
_ref7$options = _ref7.options,
|
|
29258
|
+
options = _ref7$options === void 0 ? {} : _ref7$options;
|
|
29255
29259
|
var classes = useCustomStyle(style);
|
|
29256
29260
|
var formFlow = flow || Object.keys(schema);
|
|
29257
29261
|
|
|
@@ -29449,18 +29453,18 @@ var Footer = function Footer(props) {
|
|
|
29449
29453
|
}, ((_props$actions8 = props.actions) === null || _props$actions8 === void 0 ? void 0 : (_props$actions8$submi = _props$actions8.submit) === null || _props$actions8$submi === void 0 ? void 0 : _props$actions8$submi.label) || 'Save'));
|
|
29450
29454
|
};
|
|
29451
29455
|
|
|
29452
|
-
var Step = function Step(
|
|
29453
|
-
var entry =
|
|
29454
|
-
realEntry =
|
|
29455
|
-
step =
|
|
29456
|
-
schema =
|
|
29457
|
-
inputWrapper =
|
|
29458
|
-
httpClient =
|
|
29459
|
-
defaultValue =
|
|
29460
|
-
index =
|
|
29461
|
-
functionalProperty =
|
|
29462
|
-
parent =
|
|
29463
|
-
onAfterChange =
|
|
29456
|
+
var Step = function Step(_ref8) {
|
|
29457
|
+
var entry = _ref8.entry,
|
|
29458
|
+
realEntry = _ref8.realEntry,
|
|
29459
|
+
step = _ref8.step,
|
|
29460
|
+
schema = _ref8.schema,
|
|
29461
|
+
inputWrapper = _ref8.inputWrapper,
|
|
29462
|
+
httpClient = _ref8.httpClient,
|
|
29463
|
+
defaultValue = _ref8.defaultValue,
|
|
29464
|
+
index = _ref8.index,
|
|
29465
|
+
functionalProperty = _ref8.functionalProperty,
|
|
29466
|
+
parent = _ref8.parent,
|
|
29467
|
+
onAfterChange = _ref8.onAfterChange;
|
|
29464
29468
|
var classes = useCustomStyle();
|
|
29465
29469
|
|
|
29466
29470
|
var _useFormContext2 = useFormContext(),
|
|
@@ -29554,12 +29558,12 @@ var Step = function Step(_ref9) {
|
|
|
29554
29558
|
var newData = cleanOutputArray(d, schema);
|
|
29555
29559
|
if (!deepEqual(newData, currentData) || newData !== undefined && currentData === undefined) onAfterChangeFunc({
|
|
29556
29560
|
entry: entry,
|
|
29557
|
-
previousValue: currentData,
|
|
29558
29561
|
value: getValues(entry),
|
|
29562
|
+
rawValues: newData,
|
|
29563
|
+
previousValue: currentData,
|
|
29559
29564
|
getValue: function getValue(e) {
|
|
29560
29565
|
return getValues(e);
|
|
29561
29566
|
},
|
|
29562
|
-
rawValues: newData,
|
|
29563
29567
|
setValue: _setValue,
|
|
29564
29568
|
onChange: function onChange(v) {
|
|
29565
29569
|
return _setValue(entry, v);
|
|
@@ -29831,11 +29835,11 @@ var Step = function Step(_ref9) {
|
|
|
29831
29835
|
return /*#__PURE__*/React.createElement(Controller, {
|
|
29832
29836
|
name: entry,
|
|
29833
29837
|
control: control,
|
|
29834
|
-
render: function render(
|
|
29835
|
-
var field =
|
|
29838
|
+
render: function render(_ref9) {
|
|
29839
|
+
var field = _ref9.field;
|
|
29836
29840
|
|
|
29837
|
-
var FileInput = function FileInput(
|
|
29838
|
-
var onChange =
|
|
29841
|
+
var FileInput = function FileInput(_ref10) {
|
|
29842
|
+
var onChange = _ref10.onChange;
|
|
29839
29843
|
|
|
29840
29844
|
var _useState3 = useState(false),
|
|
29841
29845
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
@@ -29920,11 +29924,11 @@ var Step = function Step(_ref9) {
|
|
|
29920
29924
|
}
|
|
29921
29925
|
};
|
|
29922
29926
|
|
|
29923
|
-
var ArrayStep = function ArrayStep(
|
|
29924
|
-
var entry =
|
|
29925
|
-
step =
|
|
29926
|
-
component =
|
|
29927
|
-
disabled =
|
|
29927
|
+
var ArrayStep = function ArrayStep(_ref11) {
|
|
29928
|
+
var entry = _ref11.entry,
|
|
29929
|
+
step = _ref11.step,
|
|
29930
|
+
component = _ref11.component,
|
|
29931
|
+
disabled = _ref11.disabled;
|
|
29928
29932
|
var classes = useCustomStyle();
|
|
29929
29933
|
|
|
29930
29934
|
var _useFormContext3 = useFormContext(),
|
|
@@ -29994,7 +29998,7 @@ var ArrayStep = function ArrayStep(_ref12) {
|
|
|
29994
29998
|
onClick: function onClick() {
|
|
29995
29999
|
var newValue = cleanInputArray({}, getValues(entry), step.flow, step.schema);
|
|
29996
30000
|
append({
|
|
29997
|
-
value: step.addableDefaultValue || (newValue ? newValue : defaultVal())
|
|
30001
|
+
value: step.addableDefaultValue || (step.type === type.object && newValue ? newValue : defaultVal())
|
|
29998
30002
|
}); // trigger(entry);
|
|
29999
30003
|
|
|
30000
30004
|
option(step.onChange).map(function (onChange) {
|
|
@@ -30011,19 +30015,19 @@ var ArrayStep = function ArrayStep(_ref12) {
|
|
|
30011
30015
|
}, error.message)));
|
|
30012
30016
|
};
|
|
30013
30017
|
|
|
30014
|
-
var NestedForm = function NestedForm(
|
|
30018
|
+
var NestedForm = function NestedForm(_ref12) {
|
|
30015
30019
|
var _classNames17;
|
|
30016
30020
|
|
|
30017
|
-
var schema =
|
|
30018
|
-
flow =
|
|
30019
|
-
parent =
|
|
30020
|
-
inputWrapper =
|
|
30021
|
-
maybeCustomHttpClient =
|
|
30022
|
-
errorDisplayed =
|
|
30023
|
-
value =
|
|
30024
|
-
step =
|
|
30025
|
-
functionalProperty =
|
|
30026
|
-
index =
|
|
30021
|
+
var schema = _ref12.schema,
|
|
30022
|
+
flow = _ref12.flow,
|
|
30023
|
+
parent = _ref12.parent,
|
|
30024
|
+
inputWrapper = _ref12.inputWrapper,
|
|
30025
|
+
maybeCustomHttpClient = _ref12.maybeCustomHttpClient,
|
|
30026
|
+
errorDisplayed = _ref12.errorDisplayed,
|
|
30027
|
+
value = _ref12.value,
|
|
30028
|
+
step = _ref12.step,
|
|
30029
|
+
functionalProperty = _ref12.functionalProperty,
|
|
30030
|
+
index = _ref12.index;
|
|
30027
30031
|
|
|
30028
30032
|
var _useFormContext4 = useFormContext(),
|
|
30029
30033
|
getValues = _useFormContext4.getValues,
|
|
@@ -30134,10 +30138,10 @@ var NestedForm = function NestedForm(_ref13) {
|
|
|
30134
30138
|
onClick: function onClick() {
|
|
30135
30139
|
return setCollapsed(!collapsed);
|
|
30136
30140
|
}
|
|
30137
|
-
}), computedSandF.map(function (
|
|
30138
|
-
var step =
|
|
30139
|
-
visibleStep =
|
|
30140
|
-
entry =
|
|
30141
|
+
}), computedSandF.map(function (_ref13, idx) {
|
|
30142
|
+
var step = _ref13.step,
|
|
30143
|
+
visibleStep = _ref13.visibleStep,
|
|
30144
|
+
entry = _ref13.entry;
|
|
30141
30145
|
|
|
30142
30146
|
if (!step && typeof entry === 'string') {
|
|
30143
30147
|
console.error("no step found for the entry \"".concat(entry, "\" in the given schema. Your form might not work properly. Please fix it"));
|
package/lib/index.js
CHANGED
|
@@ -1285,7 +1285,7 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1285
1285
|
}, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
1286
1286
|
disabled: props.disabled,
|
|
1287
1287
|
type: "text",
|
|
1288
|
-
className: classNames__default["default"](classes.w_50),
|
|
1288
|
+
className: classNames__default["default"](classes.w_50, classes.input),
|
|
1289
1289
|
placeholder: props.placeholderKey,
|
|
1290
1290
|
value: key,
|
|
1291
1291
|
onChange: function onChange(e) {
|
|
@@ -1294,7 +1294,7 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1294
1294
|
}), /*#__PURE__*/React__default["default"].createElement("input", {
|
|
1295
1295
|
disabled: props.disabled,
|
|
1296
1296
|
type: "text",
|
|
1297
|
-
className: classNames__default["default"](classes.w_50),
|
|
1297
|
+
className: classNames__default["default"](classes.w_50, classes.input),
|
|
1298
1298
|
placeholder: props.placeholderValue,
|
|
1299
1299
|
value: value,
|
|
1300
1300
|
onChange: function onChange(e) {
|
|
@@ -29154,8 +29154,8 @@ var cleanInputArray = function cleanInputArray(obj, defaultValues, flow, subSche
|
|
|
29154
29154
|
return f.map(function (v) {
|
|
29155
29155
|
return v.flow || v;
|
|
29156
29156
|
});
|
|
29157
|
-
}).map(arrayFlatten).getOrElse(Object.keys(subSchema));
|
|
29158
|
-
return Object.entries(subSchema).filter(function (_ref2) {
|
|
29157
|
+
}).map(arrayFlatten).getOrElse(Object.keys(subSchema || {}));
|
|
29158
|
+
return Object.entries(subSchema || {}).filter(function (_ref2) {
|
|
29159
29159
|
var _ref3 = _slicedToArray(_ref2, 1),
|
|
29160
29160
|
key = _ref3[0];
|
|
29161
29161
|
|
|
@@ -29171,14 +29171,16 @@ var cleanInputArray = function cleanInputArray(obj, defaultValues, flow, subSche
|
|
|
29171
29171
|
|
|
29172
29172
|
if (step.array && !step.render) {
|
|
29173
29173
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, (v || []).map(function (value) {
|
|
29174
|
+
var _subSchema$key, _subSchema$key2;
|
|
29175
|
+
|
|
29174
29176
|
return {
|
|
29175
|
-
value: value
|
|
29177
|
+
value: _typeof$1(value) === 'object' && !(value instanceof Date) && !Array.isArray(value) ? cleanInputArray(value, defaultValues, (_subSchema$key = subSchema[key]) === null || _subSchema$key === void 0 ? void 0 : _subSchema$key.flow, ((_subSchema$key2 = subSchema[key]) === null || _subSchema$key2 === void 0 ? void 0 : _subSchema$key2.schema) || {}) : value
|
|
29176
29178
|
};
|
|
29177
29179
|
})));
|
|
29178
29180
|
} else if (_typeof$1(v) === 'object' && !(v instanceof Date) && !Array.isArray(v)) {
|
|
29179
|
-
var _subSchema$
|
|
29181
|
+
var _subSchema$key3, _subSchema$key4;
|
|
29180
29182
|
|
|
29181
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanInputArray(v, defaultValues, (_subSchema$
|
|
29183
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanInputArray(v, defaultValues, (_subSchema$key3 = subSchema[key]) === null || _subSchema$key3 === void 0 ? void 0 : _subSchema$key3.flow, ((_subSchema$key4 = subSchema[key]) === null || _subSchema$key4 === void 0 ? void 0 : _subSchema$key4.schema) || {})));
|
|
29182
29184
|
} else {
|
|
29183
29185
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v === undefined ? Array.isArray(v) ? [] : step.type === type.object ? {} : null : v));
|
|
29184
29186
|
}
|
|
@@ -29200,21 +29202,23 @@ var cleanOutputArray = function cleanOutputArray(obj, subSchema) {
|
|
|
29200
29202
|
}).getOrElse(false);
|
|
29201
29203
|
|
|
29202
29204
|
if (isArray) {
|
|
29203
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v.map(function (
|
|
29204
|
-
var
|
|
29205
|
-
|
|
29205
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v.map(function (step) {
|
|
29206
|
+
var _subSchema$key5;
|
|
29207
|
+
|
|
29208
|
+
if (!!step.value && _typeof$1(step.value) === 'object' && !(step.value instanceof Date && !Array.isArray(step.value))) return cleanOutputArray(step.value, ((_subSchema$key5 = subSchema[key]) === null || _subSchema$key5 === void 0 ? void 0 : _subSchema$key5.schema) || {});
|
|
29209
|
+
return step.value;
|
|
29206
29210
|
})));
|
|
29207
29211
|
}
|
|
29208
29212
|
|
|
29209
29213
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v));
|
|
29210
29214
|
} else if (!!v && _typeof$1(v) === 'object' && !(v instanceof Date && !Array.isArray(v))) {
|
|
29211
|
-
var _subSchema$
|
|
29215
|
+
var _subSchema$key6;
|
|
29212
29216
|
|
|
29213
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanOutputArray(v, ((_subSchema$
|
|
29217
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanOutputArray(v, ((_subSchema$key6 = subSchema[key]) === null || _subSchema$key6 === void 0 ? void 0 : _subSchema$key6.schema) || {})));
|
|
29214
29218
|
} else {
|
|
29215
|
-
var _subSchema$
|
|
29219
|
+
var _subSchema$key7;
|
|
29216
29220
|
|
|
29217
|
-
if (((_subSchema$
|
|
29221
|
+
if (((_subSchema$key7 = subSchema[key]) === null || _subSchema$key7 === void 0 ? void 0 : _subSchema$key7.type) === 'json') {
|
|
29218
29222
|
try {
|
|
29219
29223
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, JSON.parse(v)));
|
|
29220
29224
|
} catch (err) {
|
|
@@ -29239,14 +29243,14 @@ var validate = function validate(flow, schema, value) {
|
|
|
29239
29243
|
});
|
|
29240
29244
|
};
|
|
29241
29245
|
|
|
29242
|
-
var Watcher = function Watcher(
|
|
29243
|
-
var options =
|
|
29244
|
-
control =
|
|
29245
|
-
schema =
|
|
29246
|
-
onSubmit =
|
|
29247
|
-
handleSubmit =
|
|
29248
|
-
|
|
29249
|
-
|
|
29246
|
+
var Watcher = function Watcher(_ref6) {
|
|
29247
|
+
var options = _ref6.options,
|
|
29248
|
+
control = _ref6.control,
|
|
29249
|
+
schema = _ref6.schema,
|
|
29250
|
+
onSubmit = _ref6.onSubmit,
|
|
29251
|
+
handleSubmit = _ref6.handleSubmit;
|
|
29252
|
+
_ref6.getValues;
|
|
29253
|
+
_ref6.watch;
|
|
29250
29254
|
var data = reactHookForm.useWatch({
|
|
29251
29255
|
control: control
|
|
29252
29256
|
});
|
|
@@ -29272,20 +29276,20 @@ var Watcher = function Watcher(_ref7) {
|
|
|
29272
29276
|
return null;
|
|
29273
29277
|
};
|
|
29274
29278
|
|
|
29275
|
-
var Form = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
29276
|
-
var schema =
|
|
29277
|
-
flow =
|
|
29278
|
-
value =
|
|
29279
|
-
inputWrapper =
|
|
29280
|
-
onSubmit =
|
|
29281
|
-
|
|
29282
|
-
onError =
|
|
29283
|
-
footer =
|
|
29284
|
-
|
|
29285
|
-
style =
|
|
29286
|
-
className =
|
|
29287
|
-
|
|
29288
|
-
options =
|
|
29279
|
+
var Form = /*#__PURE__*/React__default["default"].forwardRef(function (_ref7, ref) {
|
|
29280
|
+
var schema = _ref7.schema,
|
|
29281
|
+
flow = _ref7.flow,
|
|
29282
|
+
value = _ref7.value,
|
|
29283
|
+
inputWrapper = _ref7.inputWrapper,
|
|
29284
|
+
onSubmit = _ref7.onSubmit,
|
|
29285
|
+
_ref7$onError = _ref7.onError,
|
|
29286
|
+
onError = _ref7$onError === void 0 ? function () {} : _ref7$onError,
|
|
29287
|
+
footer = _ref7.footer,
|
|
29288
|
+
_ref7$style = _ref7.style,
|
|
29289
|
+
style = _ref7$style === void 0 ? {} : _ref7$style,
|
|
29290
|
+
className = _ref7.className,
|
|
29291
|
+
_ref7$options = _ref7.options,
|
|
29292
|
+
options = _ref7$options === void 0 ? {} : _ref7$options;
|
|
29289
29293
|
var classes = useCustomStyle(style);
|
|
29290
29294
|
var formFlow = flow || Object.keys(schema);
|
|
29291
29295
|
|
|
@@ -29483,18 +29487,18 @@ var Footer = function Footer(props) {
|
|
|
29483
29487
|
}, ((_props$actions8 = props.actions) === null || _props$actions8 === void 0 ? void 0 : (_props$actions8$submi = _props$actions8.submit) === null || _props$actions8$submi === void 0 ? void 0 : _props$actions8$submi.label) || 'Save'));
|
|
29484
29488
|
};
|
|
29485
29489
|
|
|
29486
|
-
var Step = function Step(
|
|
29487
|
-
var entry =
|
|
29488
|
-
realEntry =
|
|
29489
|
-
step =
|
|
29490
|
-
schema =
|
|
29491
|
-
inputWrapper =
|
|
29492
|
-
httpClient =
|
|
29493
|
-
defaultValue =
|
|
29494
|
-
index =
|
|
29495
|
-
functionalProperty =
|
|
29496
|
-
parent =
|
|
29497
|
-
onAfterChange =
|
|
29490
|
+
var Step = function Step(_ref8) {
|
|
29491
|
+
var entry = _ref8.entry,
|
|
29492
|
+
realEntry = _ref8.realEntry,
|
|
29493
|
+
step = _ref8.step,
|
|
29494
|
+
schema = _ref8.schema,
|
|
29495
|
+
inputWrapper = _ref8.inputWrapper,
|
|
29496
|
+
httpClient = _ref8.httpClient,
|
|
29497
|
+
defaultValue = _ref8.defaultValue,
|
|
29498
|
+
index = _ref8.index,
|
|
29499
|
+
functionalProperty = _ref8.functionalProperty,
|
|
29500
|
+
parent = _ref8.parent,
|
|
29501
|
+
onAfterChange = _ref8.onAfterChange;
|
|
29498
29502
|
var classes = useCustomStyle();
|
|
29499
29503
|
|
|
29500
29504
|
var _useFormContext2 = reactHookForm.useFormContext(),
|
|
@@ -29588,12 +29592,12 @@ var Step = function Step(_ref9) {
|
|
|
29588
29592
|
var newData = cleanOutputArray(d, schema);
|
|
29589
29593
|
if (!deepEqual__default["default"](newData, currentData) || newData !== undefined && currentData === undefined) onAfterChangeFunc({
|
|
29590
29594
|
entry: entry,
|
|
29591
|
-
previousValue: currentData,
|
|
29592
29595
|
value: getValues(entry),
|
|
29596
|
+
rawValues: newData,
|
|
29597
|
+
previousValue: currentData,
|
|
29593
29598
|
getValue: function getValue(e) {
|
|
29594
29599
|
return getValues(e);
|
|
29595
29600
|
},
|
|
29596
|
-
rawValues: newData,
|
|
29597
29601
|
setValue: _setValue,
|
|
29598
29602
|
onChange: function onChange(v) {
|
|
29599
29603
|
return _setValue(entry, v);
|
|
@@ -29865,11 +29869,11 @@ var Step = function Step(_ref9) {
|
|
|
29865
29869
|
return /*#__PURE__*/React__default["default"].createElement(reactHookForm.Controller, {
|
|
29866
29870
|
name: entry,
|
|
29867
29871
|
control: control,
|
|
29868
|
-
render: function render(
|
|
29869
|
-
var field =
|
|
29872
|
+
render: function render(_ref9) {
|
|
29873
|
+
var field = _ref9.field;
|
|
29870
29874
|
|
|
29871
|
-
var FileInput = function FileInput(
|
|
29872
|
-
var onChange =
|
|
29875
|
+
var FileInput = function FileInput(_ref10) {
|
|
29876
|
+
var onChange = _ref10.onChange;
|
|
29873
29877
|
|
|
29874
29878
|
var _useState3 = React.useState(false),
|
|
29875
29879
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
@@ -29954,11 +29958,11 @@ var Step = function Step(_ref9) {
|
|
|
29954
29958
|
}
|
|
29955
29959
|
};
|
|
29956
29960
|
|
|
29957
|
-
var ArrayStep = function ArrayStep(
|
|
29958
|
-
var entry =
|
|
29959
|
-
step =
|
|
29960
|
-
component =
|
|
29961
|
-
disabled =
|
|
29961
|
+
var ArrayStep = function ArrayStep(_ref11) {
|
|
29962
|
+
var entry = _ref11.entry,
|
|
29963
|
+
step = _ref11.step,
|
|
29964
|
+
component = _ref11.component,
|
|
29965
|
+
disabled = _ref11.disabled;
|
|
29962
29966
|
var classes = useCustomStyle();
|
|
29963
29967
|
|
|
29964
29968
|
var _useFormContext3 = reactHookForm.useFormContext(),
|
|
@@ -30028,7 +30032,7 @@ var ArrayStep = function ArrayStep(_ref12) {
|
|
|
30028
30032
|
onClick: function onClick() {
|
|
30029
30033
|
var newValue = cleanInputArray({}, getValues(entry), step.flow, step.schema);
|
|
30030
30034
|
append({
|
|
30031
|
-
value: step.addableDefaultValue || (newValue ? newValue : defaultVal())
|
|
30035
|
+
value: step.addableDefaultValue || (step.type === type.object && newValue ? newValue : defaultVal())
|
|
30032
30036
|
}); // trigger(entry);
|
|
30033
30037
|
|
|
30034
30038
|
option(step.onChange).map(function (onChange) {
|
|
@@ -30045,19 +30049,19 @@ var ArrayStep = function ArrayStep(_ref12) {
|
|
|
30045
30049
|
}, error.message)));
|
|
30046
30050
|
};
|
|
30047
30051
|
|
|
30048
|
-
var NestedForm = function NestedForm(
|
|
30052
|
+
var NestedForm = function NestedForm(_ref12) {
|
|
30049
30053
|
var _classNames17;
|
|
30050
30054
|
|
|
30051
|
-
var schema =
|
|
30052
|
-
flow =
|
|
30053
|
-
parent =
|
|
30054
|
-
inputWrapper =
|
|
30055
|
-
maybeCustomHttpClient =
|
|
30056
|
-
errorDisplayed =
|
|
30057
|
-
value =
|
|
30058
|
-
step =
|
|
30059
|
-
functionalProperty =
|
|
30060
|
-
index =
|
|
30055
|
+
var schema = _ref12.schema,
|
|
30056
|
+
flow = _ref12.flow,
|
|
30057
|
+
parent = _ref12.parent,
|
|
30058
|
+
inputWrapper = _ref12.inputWrapper,
|
|
30059
|
+
maybeCustomHttpClient = _ref12.maybeCustomHttpClient,
|
|
30060
|
+
errorDisplayed = _ref12.errorDisplayed,
|
|
30061
|
+
value = _ref12.value,
|
|
30062
|
+
step = _ref12.step,
|
|
30063
|
+
functionalProperty = _ref12.functionalProperty,
|
|
30064
|
+
index = _ref12.index;
|
|
30061
30065
|
|
|
30062
30066
|
var _useFormContext4 = reactHookForm.useFormContext(),
|
|
30063
30067
|
getValues = _useFormContext4.getValues,
|
|
@@ -30168,10 +30172,10 @@ var NestedForm = function NestedForm(_ref13) {
|
|
|
30168
30172
|
onClick: function onClick() {
|
|
30169
30173
|
return setCollapsed(!collapsed);
|
|
30170
30174
|
}
|
|
30171
|
-
}), computedSandF.map(function (
|
|
30172
|
-
var step =
|
|
30173
|
-
visibleStep =
|
|
30174
|
-
entry =
|
|
30175
|
+
}), computedSandF.map(function (_ref13, idx) {
|
|
30176
|
+
var step = _ref13.step,
|
|
30177
|
+
visibleStep = _ref13.visibleStep,
|
|
30178
|
+
entry = _ref13.entry;
|
|
30175
30179
|
|
|
30176
30180
|
if (!step && typeof entry === 'string') {
|
|
30177
30181
|
console.error("no step found for the entry \"".concat(entry, "\" in the given schema. Your form might not work properly. Please fix it"));
|