@maif/react-forms 1.0.23 → 1.0.24
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/react-form.js +1 -1
- package/lib/form.js +31 -18
- package/package.json +1 -1
package/lib/form.js
CHANGED
|
@@ -356,7 +356,7 @@ var Form = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
|
356
356
|
}, formFlow.map(function (entry, idx) {
|
|
357
357
|
var step = schema[entry];
|
|
358
358
|
|
|
359
|
-
if (!step) {
|
|
359
|
+
if (!step && typeof entry === 'string') {
|
|
360
360
|
console.error("no step found for the entry \"".concat(entry, "\" in the given schema. Your form might not work properly. Please fix it"));
|
|
361
361
|
return null;
|
|
362
362
|
}
|
|
@@ -475,20 +475,6 @@ var Step = function Step(_ref4) {
|
|
|
475
475
|
defaultValue = _ref4.defaultValue,
|
|
476
476
|
index = _ref4.index;
|
|
477
477
|
var classes = (0, _styleContext.useCustomStyle)();
|
|
478
|
-
var registeredInput = register(entry);
|
|
479
|
-
|
|
480
|
-
var inputProps = _objectSpread(_objectSpread({}, registeredInput), {}, {
|
|
481
|
-
onChange: function onChange(e) {
|
|
482
|
-
registeredInput.onChange(e);
|
|
483
|
-
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
484
|
-
return onChange({
|
|
485
|
-
rawValues: getValues(),
|
|
486
|
-
value: e.target.value,
|
|
487
|
-
setValue: _setValue
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
});
|
|
492
478
|
|
|
493
479
|
if (entry && _typeof(entry) === 'object') {
|
|
494
480
|
var errored = entry.flow.some(function (step) {
|
|
@@ -501,6 +487,12 @@ var Step = function Step(_ref4) {
|
|
|
501
487
|
var err = _typeof(en) === 'object' ? undefined : en.split('.').reduce(function (object, key) {
|
|
502
488
|
return object && object[key];
|
|
503
489
|
}, errors);
|
|
490
|
+
|
|
491
|
+
if (!stp && typeof en === 'string') {
|
|
492
|
+
console.error("no step found for the entry \"".concat(en, "\" in the given schema. Your form might not work properly. Please fix it"));
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
|
|
504
496
|
var visibleStep = (0, _Option.option)(stp).map(function (s) {
|
|
505
497
|
return s.visible;
|
|
506
498
|
}).map(function (visible) {
|
|
@@ -549,6 +541,21 @@ var Step = function Step(_ref4) {
|
|
|
549
541
|
}));
|
|
550
542
|
}
|
|
551
543
|
|
|
544
|
+
var registeredInput = register(entry);
|
|
545
|
+
|
|
546
|
+
var inputProps = _objectSpread(_objectSpread({}, registeredInput), {}, {
|
|
547
|
+
onChange: function onChange(e) {
|
|
548
|
+
registeredInput.onChange(e);
|
|
549
|
+
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
550
|
+
return onChange({
|
|
551
|
+
rawValues: getValues(),
|
|
552
|
+
value: e.target.value,
|
|
553
|
+
setValue: _setValue
|
|
554
|
+
});
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
|
|
552
559
|
var disabled = function disabled() {
|
|
553
560
|
if (typeof step.disabled === 'function') {
|
|
554
561
|
return step.disabled({
|
|
@@ -1231,7 +1238,7 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1231
1238
|
});
|
|
1232
1239
|
}
|
|
1233
1240
|
}, [prevSchema, schemaAndFlow.schema]);
|
|
1234
|
-
var
|
|
1241
|
+
var computedSandF = schemaAndFlow.flow.reduce(function (acc, entry) {
|
|
1235
1242
|
var step = schemaAndFlow.schema[entry];
|
|
1236
1243
|
var visibleStep = (0, _Option.option)(step).map(function (s) {
|
|
1237
1244
|
return s.visible;
|
|
@@ -1257,7 +1264,7 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1257
1264
|
entry: entry
|
|
1258
1265
|
}]);
|
|
1259
1266
|
}, []);
|
|
1260
|
-
var bordered =
|
|
1267
|
+
var bordered = computedSandF.filter(function (x) {
|
|
1261
1268
|
return x.visibleStep;
|
|
1262
1269
|
}).length <= 1 && step.label === null;
|
|
1263
1270
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -1286,10 +1293,16 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1286
1293
|
onClick: function onClick() {
|
|
1287
1294
|
return setCollapsed(!collapsed);
|
|
1288
1295
|
}
|
|
1289
|
-
}),
|
|
1296
|
+
}), computedSandF.map(function (_ref17, idx) {
|
|
1290
1297
|
var step = _ref17.step,
|
|
1291
1298
|
visibleStep = _ref17.visibleStep,
|
|
1292
1299
|
entry = _ref17.entry;
|
|
1300
|
+
|
|
1301
|
+
if (!step && typeof entry === 'string') {
|
|
1302
|
+
console.error("no step found for the entry \"".concat(entry, "\" in the given schema. Your form might not work properly. Please fix it"));
|
|
1303
|
+
return null;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1293
1306
|
var realError = error && error[entry];
|
|
1294
1307
|
var oneVisibleSetup = Object.values(schemaAndFlow.schema).some(function (v) {
|
|
1295
1308
|
return !!v.visibleOnCollapse;
|