@maif/react-forms 1.0.23 → 1.0.27
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 +4 -0
- package/dist/react-form.js +1 -1
- package/lib/form.js +97 -62
- package/lib/style.d.ts +23 -23
- package/lib/style.js +5 -1
- package/package.json +1 -1
package/lib/form.js
CHANGED
|
@@ -171,16 +171,16 @@ var defaultVal = function defaultVal(t, array, defaultValue) {
|
|
|
171
171
|
|
|
172
172
|
var getDefaultValues = function getDefaultValues(flow, schema) {
|
|
173
173
|
return flow.reduce(function (acc, key) {
|
|
174
|
+
if (_typeof(key) === 'object') {
|
|
175
|
+
return _objectSpread(_objectSpread({}, acc), getDefaultValues(key.flow, schema));
|
|
176
|
+
}
|
|
177
|
+
|
|
174
178
|
var entry = schema[key];
|
|
175
179
|
|
|
176
180
|
if (!entry) {
|
|
177
181
|
return acc;
|
|
178
182
|
}
|
|
179
183
|
|
|
180
|
-
if (_typeof(key) === 'object') {
|
|
181
|
-
return _objectSpread(_objectSpread({}, acc), getDefaultValues(key.flow, schema));
|
|
182
|
-
}
|
|
183
|
-
|
|
184
184
|
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, defaultVal(entry.type, entry.array || entry.isMulti, entry.defaultValue)));
|
|
185
185
|
}, {});
|
|
186
186
|
};
|
|
@@ -238,7 +238,7 @@ var Form = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
|
238
238
|
var isArray = (0, _Option.option)(subSchema).orElse(schema).map(function (s) {
|
|
239
239
|
return s[key];
|
|
240
240
|
}).map(function (entry) {
|
|
241
|
-
return !!entry.array;
|
|
241
|
+
return !!entry.array && !entry.render;
|
|
242
242
|
}).getOrElse(false);
|
|
243
243
|
|
|
244
244
|
if (isArray) {
|
|
@@ -270,7 +270,7 @@ var Form = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
|
270
270
|
var isArray = (0, _Option.option)(subSchema).orElse(schema).map(function (s) {
|
|
271
271
|
return s[key];
|
|
272
272
|
}).map(function (entry) {
|
|
273
|
-
return !!entry.array;
|
|
273
|
+
return !!entry.array && !entry.render;
|
|
274
274
|
}).getOrElse(false);
|
|
275
275
|
|
|
276
276
|
if (isArray) {
|
|
@@ -347,6 +347,18 @@ var Form = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
|
347
347
|
}
|
|
348
348
|
};
|
|
349
349
|
});
|
|
350
|
+
|
|
351
|
+
var functionalProperty = function functionalProperty(entry, prop) {
|
|
352
|
+
if (typeof prop === 'function') {
|
|
353
|
+
return prop({
|
|
354
|
+
rawValues: getValues(),
|
|
355
|
+
value: getValues(entry)
|
|
356
|
+
});
|
|
357
|
+
} else {
|
|
358
|
+
return prop;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
|
|
350
362
|
return /*#__PURE__*/_react["default"].createElement(_reactHookForm.FormProvider, methods, /*#__PURE__*/_react["default"].createElement("form", {
|
|
351
363
|
className: className || "".concat(classes.pr_15, " ").concat(classes.full_width),
|
|
352
364
|
onSubmit: _handleSubmit(function (data) {
|
|
@@ -356,7 +368,7 @@ var Form = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
|
356
368
|
}, formFlow.map(function (entry, idx) {
|
|
357
369
|
var step = schema[entry];
|
|
358
370
|
|
|
359
|
-
if (!step) {
|
|
371
|
+
if (!step && typeof entry === 'string') {
|
|
360
372
|
console.error("no step found for the entry \"".concat(entry, "\" in the given schema. Your form might not work properly. Please fix it"));
|
|
361
373
|
return null;
|
|
362
374
|
}
|
|
@@ -391,7 +403,7 @@ var Form = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
|
391
403
|
key: "".concat(entry, "-").concat(idx),
|
|
392
404
|
entry: entry,
|
|
393
405
|
error: error,
|
|
394
|
-
label: (step === null || step === void 0 ? void 0 : step.label) === null ? null : (step === null || step === void 0 ? void 0 : step.label) || entry,
|
|
406
|
+
label: functionalProperty(entry, (step === null || step === void 0 ? void 0 : step.label) === null ? null : (step === null || step === void 0 ? void 0 : step.label) || entry),
|
|
395
407
|
help: step === null || step === void 0 ? void 0 : step.help,
|
|
396
408
|
render: inputWrapper
|
|
397
409
|
}, /*#__PURE__*/_react["default"].createElement(Step, {
|
|
@@ -408,7 +420,8 @@ var Form = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
|
408
420
|
setValue: setValue,
|
|
409
421
|
watch: watch,
|
|
410
422
|
inputWrapper: inputWrapper,
|
|
411
|
-
httpClient: maybeCustomHttpClient
|
|
423
|
+
httpClient: maybeCustomHttpClient,
|
|
424
|
+
functionalProperty: functionalProperty
|
|
412
425
|
}));
|
|
413
426
|
}), /*#__PURE__*/_react["default"].createElement(Footer, {
|
|
414
427
|
render: footer,
|
|
@@ -473,22 +486,9 @@ var Step = function Step(_ref4) {
|
|
|
473
486
|
inputWrapper = _ref4.inputWrapper,
|
|
474
487
|
httpClient = _ref4.httpClient,
|
|
475
488
|
defaultValue = _ref4.defaultValue,
|
|
476
|
-
index = _ref4.index
|
|
489
|
+
index = _ref4.index,
|
|
490
|
+
functionalProperty = _ref4.functionalProperty;
|
|
477
491
|
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
492
|
|
|
493
493
|
if (entry && _typeof(entry) === 'object') {
|
|
494
494
|
var errored = entry.flow.some(function (step) {
|
|
@@ -501,6 +501,12 @@ var Step = function Step(_ref4) {
|
|
|
501
501
|
var err = _typeof(en) === 'object' ? undefined : en.split('.').reduce(function (object, key) {
|
|
502
502
|
return object && object[key];
|
|
503
503
|
}, errors);
|
|
504
|
+
|
|
505
|
+
if (!stp && typeof en === 'string') {
|
|
506
|
+
console.error("no step found for the entry \"".concat(en, "\" in the given schema. Your form might not work properly. Please fix it"));
|
|
507
|
+
return null;
|
|
508
|
+
}
|
|
509
|
+
|
|
504
510
|
var visibleStep = (0, _Option.option)(stp).map(function (s) {
|
|
505
511
|
return s.visible;
|
|
506
512
|
}).map(function (visible) {
|
|
@@ -527,7 +533,7 @@ var Step = function Step(_ref4) {
|
|
|
527
533
|
key: "collapse-".concat(en, "-").concat(entryIdx),
|
|
528
534
|
entry: en,
|
|
529
535
|
error: err,
|
|
530
|
-
label: (stp === null || stp === void 0 ? void 0 : stp.label) === null ? null : (stp === null || stp === void 0 ? void 0 : stp.label) || en,
|
|
536
|
+
label: functionalProperty(en, (stp === null || stp === void 0 ? void 0 : stp.label) === null ? null : (stp === null || stp === void 0 ? void 0 : stp.label) || en),
|
|
531
537
|
help: stp === null || stp === void 0 ? void 0 : stp.help,
|
|
532
538
|
render: inputWrapper
|
|
533
539
|
}, /*#__PURE__*/_react["default"].createElement(Step, {
|
|
@@ -544,24 +550,27 @@ var Step = function Step(_ref4) {
|
|
|
544
550
|
watch: watch,
|
|
545
551
|
inputWrapper: inputWrapper,
|
|
546
552
|
httpClient: httpClient,
|
|
547
|
-
defaultValue: stp === null || stp === void 0 ? void 0 : stp.defaultValue
|
|
553
|
+
defaultValue: stp === null || stp === void 0 ? void 0 : stp.defaultValue,
|
|
554
|
+
functionalProperty: functionalProperty
|
|
548
555
|
}));
|
|
549
556
|
}));
|
|
550
557
|
}
|
|
551
558
|
|
|
552
|
-
var disabled = function disabled() {
|
|
553
|
-
if (typeof step.disabled === 'function') {
|
|
554
|
-
return step.disabled({
|
|
555
|
-
rawValues: getValues(),
|
|
556
|
-
value: getValues(entry)
|
|
557
|
-
});
|
|
558
|
-
} else {
|
|
559
|
-
return step.disabled;
|
|
560
|
-
}
|
|
561
|
-
};
|
|
562
|
-
|
|
563
559
|
if (step.array) {
|
|
564
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
560
|
+
return /*#__PURE__*/_react["default"].createElement(CustomizableInput, {
|
|
561
|
+
render: step.render,
|
|
562
|
+
field: {
|
|
563
|
+
setValue: function setValue(key, value) {
|
|
564
|
+
return _setValue(key, value);
|
|
565
|
+
},
|
|
566
|
+
rawValues: getValues(),
|
|
567
|
+
value: getValues(entry),
|
|
568
|
+
onChange: function onChange(v) {
|
|
569
|
+
return _setValue(entry, v);
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
error: error
|
|
573
|
+
}, /*#__PURE__*/_react["default"].createElement(ArrayStep, {
|
|
565
574
|
entry: entry,
|
|
566
575
|
step: step,
|
|
567
576
|
trigger: trigger,
|
|
@@ -572,13 +581,14 @@ var Step = function Step(_ref4) {
|
|
|
572
581
|
values: getValues(entry),
|
|
573
582
|
defaultValue: step.defaultValue || defaultVal(step.type),
|
|
574
583
|
getValues: getValues,
|
|
575
|
-
disabled: disabled
|
|
584
|
+
disabled: functionalProperty(entry, step.disabled),
|
|
576
585
|
component: function component(props, idx) {
|
|
577
586
|
var _error$idx;
|
|
578
587
|
|
|
579
588
|
return /*#__PURE__*/_react["default"].createElement(Step, {
|
|
580
589
|
entry: "".concat(entry, "[").concat(idx, "].value"),
|
|
581
590
|
step: _objectSpread(_objectSpread({}, schema[realEntry || entry]), {}, {
|
|
591
|
+
render: step.itemRender,
|
|
582
592
|
onChange: undefined,
|
|
583
593
|
array: false
|
|
584
594
|
}),
|
|
@@ -594,12 +604,28 @@ var Step = function Step(_ref4) {
|
|
|
594
604
|
httpClient: httpClient,
|
|
595
605
|
defaultValue: props.defaultValue,
|
|
596
606
|
value: props.value,
|
|
597
|
-
index: idx
|
|
607
|
+
index: idx,
|
|
608
|
+
functionalProperty: functionalProperty
|
|
598
609
|
});
|
|
599
610
|
}
|
|
600
|
-
});
|
|
611
|
+
}));
|
|
601
612
|
}
|
|
602
613
|
|
|
614
|
+
var registeredInput = register(entry);
|
|
615
|
+
|
|
616
|
+
var inputProps = _objectSpread(_objectSpread({}, registeredInput), {}, {
|
|
617
|
+
onChange: function onChange(e) {
|
|
618
|
+
registeredInput.onChange(e);
|
|
619
|
+
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
620
|
+
return onChange({
|
|
621
|
+
rawValues: getValues(),
|
|
622
|
+
value: e.target.value,
|
|
623
|
+
setValue: _setValue
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
|
|
603
629
|
switch (step.type) {
|
|
604
630
|
case _type.type.string:
|
|
605
631
|
switch (step.format) {
|
|
@@ -621,7 +647,7 @@ var Step = function Step(_ref4) {
|
|
|
621
647
|
type: "text",
|
|
622
648
|
id: entry,
|
|
623
649
|
className: (0, _classnames["default"])(classes.input, _defineProperty({}, classes.input__invalid, error)),
|
|
624
|
-
readOnly: disabled
|
|
650
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null
|
|
625
651
|
}, step.props, {
|
|
626
652
|
defaultValue: defaultValue,
|
|
627
653
|
placeholder: step.placeholder
|
|
@@ -644,7 +670,7 @@ var Step = function Step(_ref4) {
|
|
|
644
670
|
error: error
|
|
645
671
|
}, /*#__PURE__*/_react["default"].createElement(_index.CodeInput, _extends({
|
|
646
672
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
647
|
-
readOnly: disabled
|
|
673
|
+
readOnly: functionalProperty(entry, step.disabled) ? true : false,
|
|
648
674
|
onChange: function onChange(e) {
|
|
649
675
|
field.onChange(e);
|
|
650
676
|
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
@@ -678,7 +704,7 @@ var Step = function Step(_ref4) {
|
|
|
678
704
|
error: error
|
|
679
705
|
}, /*#__PURE__*/_react["default"].createElement(_index.MarkdownInput, _extends({}, step.props, {
|
|
680
706
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
681
|
-
readOnly: disabled
|
|
707
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
682
708
|
onChange: function onChange(e) {
|
|
683
709
|
field.onChange(e);
|
|
684
710
|
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
@@ -713,7 +739,7 @@ var Step = function Step(_ref4) {
|
|
|
713
739
|
error: error
|
|
714
740
|
}, /*#__PURE__*/_react["default"].createElement(_index.SelectInput, _extends({}, step.props, step, {
|
|
715
741
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
716
|
-
disabled: disabled
|
|
742
|
+
disabled: functionalProperty(entry, step.disabled),
|
|
717
743
|
value: field.value,
|
|
718
744
|
possibleValues: step.options,
|
|
719
745
|
defaultValue: defaultValue,
|
|
@@ -752,7 +778,7 @@ var Step = function Step(_ref4) {
|
|
|
752
778
|
type: step.format || 'text',
|
|
753
779
|
id: entry,
|
|
754
780
|
className: (0, _classnames["default"])(classes.input, _defineProperty({}, classes.input__invalid, error)),
|
|
755
|
-
readOnly: disabled
|
|
781
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
756
782
|
defaultValue: defaultValue,
|
|
757
783
|
placeholder: step.placeholder
|
|
758
784
|
}, inputProps)));
|
|
@@ -778,7 +804,7 @@ var Step = function Step(_ref4) {
|
|
|
778
804
|
error: error
|
|
779
805
|
}, /*#__PURE__*/_react["default"].createElement(_index.SelectInput, _extends({}, step.props, step, {
|
|
780
806
|
className: (0, _classnames["default"])(classes.content, _defineProperty({}, classes.input__invalid, error)),
|
|
781
|
-
readOnly: disabled
|
|
807
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
782
808
|
onChange: function onChange(e) {
|
|
783
809
|
field.onChange(e);
|
|
784
810
|
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
@@ -815,7 +841,7 @@ var Step = function Step(_ref4) {
|
|
|
815
841
|
type: step.format || 'number',
|
|
816
842
|
id: entry,
|
|
817
843
|
className: (0, _classnames["default"])(classes.input, _defineProperty({}, classes.input__invalid, error)),
|
|
818
|
-
readOnly: disabled
|
|
844
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
819
845
|
name: entry,
|
|
820
846
|
placeholder: step.placeholder,
|
|
821
847
|
defaultValue: defaultValue
|
|
@@ -839,7 +865,7 @@ var Step = function Step(_ref4) {
|
|
|
839
865
|
error: error
|
|
840
866
|
}, /*#__PURE__*/_react["default"].createElement(_index.BooleanInput, _extends({}, step.props, {
|
|
841
867
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
842
|
-
readOnly: disabled
|
|
868
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
843
869
|
onChange: function onChange(e) {
|
|
844
870
|
field.onChange(e);
|
|
845
871
|
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
@@ -876,7 +902,7 @@ var Step = function Step(_ref4) {
|
|
|
876
902
|
error: error
|
|
877
903
|
}, /*#__PURE__*/_react["default"].createElement(_index.SelectInput, _extends({}, step.props, step, {
|
|
878
904
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
879
|
-
readOnly: disabled
|
|
905
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
880
906
|
onChange: function onChange(e) {
|
|
881
907
|
field.onChange(e);
|
|
882
908
|
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
@@ -923,7 +949,8 @@ var Step = function Step(_ref4) {
|
|
|
923
949
|
maybeCustomHttpClient: httpClient,
|
|
924
950
|
value: getValues(entry) || defaultValue,
|
|
925
951
|
error: error,
|
|
926
|
-
index: index
|
|
952
|
+
index: index,
|
|
953
|
+
functionalProperty: functionalProperty
|
|
927
954
|
}));
|
|
928
955
|
|
|
929
956
|
default:
|
|
@@ -944,7 +971,7 @@ var Step = function Step(_ref4) {
|
|
|
944
971
|
error: error
|
|
945
972
|
}, /*#__PURE__*/_react["default"].createElement(_index.ObjectInput, _extends({}, step.props, step, {
|
|
946
973
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
947
|
-
readOnly: disabled
|
|
974
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
948
975
|
onChange: function onChange(e) {
|
|
949
976
|
field.onChange(e);
|
|
950
977
|
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
@@ -981,7 +1008,7 @@ var Step = function Step(_ref4) {
|
|
|
981
1008
|
}, /*#__PURE__*/_react["default"].createElement(_reactRainbowComponents.DatePicker, _extends({}, step.props, {
|
|
982
1009
|
id: "datePicker-1",
|
|
983
1010
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
984
|
-
readOnly: disabled
|
|
1011
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
985
1012
|
value: field.value,
|
|
986
1013
|
onChange: function onChange(e) {
|
|
987
1014
|
field.onChange(e);
|
|
@@ -1043,7 +1070,7 @@ var Step = function Step(_ref4) {
|
|
|
1043
1070
|
}), /*#__PURE__*/_react["default"].createElement("button", {
|
|
1044
1071
|
type: "button",
|
|
1045
1072
|
className: "".concat(classes.btn, " ").concat(classes.flex, " ").concat(classes.ai_center),
|
|
1046
|
-
disabled: uploading || disabled
|
|
1073
|
+
disabled: uploading || functionalProperty(entry, step.disabled),
|
|
1047
1074
|
onClick: trigger
|
|
1048
1075
|
}, uploading && /*#__PURE__*/_react["default"].createElement(_reactFeather.Loader, null), !uploading && /*#__PURE__*/_react["default"].createElement(_reactFeather.Upload, null), /*#__PURE__*/_react["default"].createElement("span", {
|
|
1049
1076
|
className: "".concat(classes.ml_5)
|
|
@@ -1095,7 +1122,7 @@ var Step = function Step(_ref4) {
|
|
|
1095
1122
|
type: "file",
|
|
1096
1123
|
id: entry,
|
|
1097
1124
|
className: (0, _classnames["default"])(classes.input, _defineProperty({}, classes.input__invalid, error)),
|
|
1098
|
-
readOnly: disabled
|
|
1125
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
1099
1126
|
name: entry,
|
|
1100
1127
|
placeholder: step.placeholder
|
|
1101
1128
|
}, inputProps)));
|
|
@@ -1183,7 +1210,8 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1183
1210
|
index = _ref16.index,
|
|
1184
1211
|
error = _ref16.error,
|
|
1185
1212
|
value = _ref16.value,
|
|
1186
|
-
step = _ref16.step
|
|
1213
|
+
step = _ref16.step,
|
|
1214
|
+
functionalProperty = _ref16.functionalProperty;
|
|
1187
1215
|
|
|
1188
1216
|
var _useFormContext = (0, _reactHookForm.useFormContext)(),
|
|
1189
1217
|
register = _useFormContext.register,
|
|
@@ -1231,7 +1259,7 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1231
1259
|
});
|
|
1232
1260
|
}
|
|
1233
1261
|
}, [prevSchema, schemaAndFlow.schema]);
|
|
1234
|
-
var
|
|
1262
|
+
var computedSandF = schemaAndFlow.flow.reduce(function (acc, entry) {
|
|
1235
1263
|
var step = schemaAndFlow.schema[entry];
|
|
1236
1264
|
var visibleStep = (0, _Option.option)(step).map(function (s) {
|
|
1237
1265
|
return s.visible;
|
|
@@ -1257,9 +1285,9 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1257
1285
|
entry: entry
|
|
1258
1286
|
}]);
|
|
1259
1287
|
}, []);
|
|
1260
|
-
var bordered =
|
|
1288
|
+
var bordered = computedSandF.filter(function (x) {
|
|
1261
1289
|
return x.visibleStep;
|
|
1262
|
-
}).length
|
|
1290
|
+
}).length > 1 && step.label !== null;
|
|
1263
1291
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1264
1292
|
className: (0, _classnames["default"])(_defineProperty({}, classes.nestedform__border, bordered))
|
|
1265
1293
|
}, !!step.collapsable && schemaAndFlow.flow.length > 1 && collapsed && /*#__PURE__*/_react["default"].createElement(_reactFeather.ArrowDown, {
|
|
@@ -1286,10 +1314,16 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1286
1314
|
onClick: function onClick() {
|
|
1287
1315
|
return setCollapsed(!collapsed);
|
|
1288
1316
|
}
|
|
1289
|
-
}),
|
|
1317
|
+
}), computedSandF.map(function (_ref17, idx) {
|
|
1290
1318
|
var step = _ref17.step,
|
|
1291
1319
|
visibleStep = _ref17.visibleStep,
|
|
1292
1320
|
entry = _ref17.entry;
|
|
1321
|
+
|
|
1322
|
+
if (!step && typeof entry === 'string') {
|
|
1323
|
+
console.error("no step found for the entry \"".concat(entry, "\" in the given schema. Your form might not work properly. Please fix it"));
|
|
1324
|
+
return null;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1293
1327
|
var realError = error && error[entry];
|
|
1294
1328
|
var oneVisibleSetup = Object.values(schemaAndFlow.schema).some(function (v) {
|
|
1295
1329
|
return !!v.visibleOnCollapse;
|
|
@@ -1300,7 +1334,7 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1300
1334
|
className: (0, _classnames["default"])(_defineProperty({}, classes.display__none, isCollapsed || !visibleStep)),
|
|
1301
1335
|
entry: "".concat(parent, ".").concat(entry),
|
|
1302
1336
|
error: realError,
|
|
1303
|
-
label: (step === null || step === void 0 ? void 0 : step.label) === null ? null : (step === null || step === void 0 ? void 0 : step.label) || entry,
|
|
1337
|
+
label: functionalProperty(entry, (step === null || step === void 0 ? void 0 : step.label) === null ? null : (step === null || step === void 0 ? void 0 : step.label) || entry),
|
|
1304
1338
|
help: step.help,
|
|
1305
1339
|
render: inputWrapper
|
|
1306
1340
|
}, /*#__PURE__*/_react["default"].createElement(Step, {
|
|
@@ -1318,7 +1352,8 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1318
1352
|
watch: watch,
|
|
1319
1353
|
inputWrapper: inputWrapper,
|
|
1320
1354
|
httpClient: maybeCustomHttpClient,
|
|
1321
|
-
defaultValue: value && value[entry]
|
|
1355
|
+
defaultValue: value && value[entry],
|
|
1356
|
+
functionalProperty: functionalProperty
|
|
1322
1357
|
}));
|
|
1323
1358
|
}));
|
|
1324
1359
|
};
|
package/lib/style.d.ts
CHANGED
|
@@ -12,22 +12,23 @@ export namespace style {
|
|
|
12
12
|
opacity: number;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const btn: {
|
|
16
|
+
borderRadius: number;
|
|
17
|
+
padding: number;
|
|
18
|
+
fontSize: string;
|
|
19
|
+
cursor: string;
|
|
20
|
+
borderWidth: string;
|
|
21
|
+
backgroundColor: string;
|
|
22
|
+
'&:disabled': {
|
|
23
|
+
opacity: number;
|
|
24
|
+
cursor: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
23
27
|
namespace btn_sm {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
export const lineHeight: string;
|
|
29
|
-
const borderRadius_1: string;
|
|
30
|
-
export { borderRadius_1 as borderRadius };
|
|
28
|
+
const fontSize: string;
|
|
29
|
+
const padding: string;
|
|
30
|
+
const lineHeight: string;
|
|
31
|
+
const borderRadius: string;
|
|
31
32
|
}
|
|
32
33
|
const btn_group: {
|
|
33
34
|
"& > button:not(:last-child)": {
|
|
@@ -127,8 +128,8 @@ export namespace style {
|
|
|
127
128
|
const marginBottom: number;
|
|
128
129
|
}
|
|
129
130
|
namespace p_15 {
|
|
130
|
-
const
|
|
131
|
-
export {
|
|
131
|
+
const padding_1: number;
|
|
132
|
+
export { padding_1 as padding };
|
|
132
133
|
}
|
|
133
134
|
namespace pr_15 {
|
|
134
135
|
const paddingRight: number;
|
|
@@ -160,16 +161,15 @@ export namespace style {
|
|
|
160
161
|
const alignItems: string;
|
|
161
162
|
}
|
|
162
163
|
namespace cursor_pointer {
|
|
163
|
-
const
|
|
164
|
-
export { cursor_1 as cursor };
|
|
164
|
+
const cursor: string;
|
|
165
165
|
}
|
|
166
166
|
namespace collapse {
|
|
167
167
|
const display_2: string;
|
|
168
168
|
export { display_2 as display };
|
|
169
169
|
const justifyContent_2: string;
|
|
170
170
|
export { justifyContent_2 as justifyContent };
|
|
171
|
-
const
|
|
172
|
-
export {
|
|
171
|
+
const cursor_1: string;
|
|
172
|
+
export { cursor_1 as cursor };
|
|
173
173
|
}
|
|
174
174
|
namespace collapse_label {
|
|
175
175
|
export const fontWeight: string;
|
|
@@ -202,8 +202,8 @@ export namespace style {
|
|
|
202
202
|
export { width_1 as width };
|
|
203
203
|
const marginTop_4: string;
|
|
204
204
|
export { marginTop_4 as marginTop };
|
|
205
|
-
const
|
|
206
|
-
export {
|
|
205
|
+
const fontSize_1: string;
|
|
206
|
+
export { fontSize_1 as fontSize };
|
|
207
207
|
const color_4: string;
|
|
208
208
|
export { color_4 as color };
|
|
209
209
|
}
|
package/lib/style.js
CHANGED
|
@@ -46,7 +46,11 @@ var style = (_style = {
|
|
|
46
46
|
fontSize: "1rem",
|
|
47
47
|
cursor: "pointer",
|
|
48
48
|
borderWidth: '1px',
|
|
49
|
-
backgroundColor: '#fff'
|
|
49
|
+
backgroundColor: '#fff',
|
|
50
|
+
'&:disabled': {
|
|
51
|
+
opacity: .6,
|
|
52
|
+
cursor: 'not-allowed'
|
|
53
|
+
}
|
|
50
54
|
},
|
|
51
55
|
btn_sm: {
|
|
52
56
|
fontSize: "0.875rem",
|