@maif/react-forms 1.0.24 → 1.0.28
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 +84 -60
- package/lib/resolvers/utils.js +14 -10
- package/lib/style.d.ts +27 -23
- package/lib/style.js +7 -1
- package/lib/styleContext.d.ts +1 -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) {
|
|
@@ -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,7 +486,8 @@ 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
492
|
|
|
479
493
|
if (entry && _typeof(entry) === 'object') {
|
|
@@ -519,7 +533,7 @@ var Step = function Step(_ref4) {
|
|
|
519
533
|
key: "collapse-".concat(en, "-").concat(entryIdx),
|
|
520
534
|
entry: en,
|
|
521
535
|
error: err,
|
|
522
|
-
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),
|
|
523
537
|
help: stp === null || stp === void 0 ? void 0 : stp.help,
|
|
524
538
|
render: inputWrapper
|
|
525
539
|
}, /*#__PURE__*/_react["default"].createElement(Step, {
|
|
@@ -536,39 +550,27 @@ var Step = function Step(_ref4) {
|
|
|
536
550
|
watch: watch,
|
|
537
551
|
inputWrapper: inputWrapper,
|
|
538
552
|
httpClient: httpClient,
|
|
539
|
-
defaultValue: stp === null || stp === void 0 ? void 0 : stp.defaultValue
|
|
553
|
+
defaultValue: stp === null || stp === void 0 ? void 0 : stp.defaultValue,
|
|
554
|
+
functionalProperty: functionalProperty
|
|
540
555
|
}));
|
|
541
556
|
}));
|
|
542
557
|
}
|
|
543
558
|
|
|
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
|
-
|
|
559
|
-
var disabled = function disabled() {
|
|
560
|
-
if (typeof step.disabled === 'function') {
|
|
561
|
-
return step.disabled({
|
|
562
|
-
rawValues: getValues(),
|
|
563
|
-
value: getValues(entry)
|
|
564
|
-
});
|
|
565
|
-
} else {
|
|
566
|
-
return step.disabled;
|
|
567
|
-
}
|
|
568
|
-
};
|
|
569
|
-
|
|
570
559
|
if (step.array) {
|
|
571
|
-
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, {
|
|
572
574
|
entry: entry,
|
|
573
575
|
step: step,
|
|
574
576
|
trigger: trigger,
|
|
@@ -579,13 +581,14 @@ var Step = function Step(_ref4) {
|
|
|
579
581
|
values: getValues(entry),
|
|
580
582
|
defaultValue: step.defaultValue || defaultVal(step.type),
|
|
581
583
|
getValues: getValues,
|
|
582
|
-
disabled: disabled
|
|
584
|
+
disabled: functionalProperty(entry, step.disabled),
|
|
583
585
|
component: function component(props, idx) {
|
|
584
586
|
var _error$idx;
|
|
585
587
|
|
|
586
588
|
return /*#__PURE__*/_react["default"].createElement(Step, {
|
|
587
589
|
entry: "".concat(entry, "[").concat(idx, "].value"),
|
|
588
590
|
step: _objectSpread(_objectSpread({}, schema[realEntry || entry]), {}, {
|
|
591
|
+
render: step.itemRender,
|
|
589
592
|
onChange: undefined,
|
|
590
593
|
array: false
|
|
591
594
|
}),
|
|
@@ -601,12 +604,28 @@ var Step = function Step(_ref4) {
|
|
|
601
604
|
httpClient: httpClient,
|
|
602
605
|
defaultValue: props.defaultValue,
|
|
603
606
|
value: props.value,
|
|
604
|
-
index: idx
|
|
607
|
+
index: idx,
|
|
608
|
+
functionalProperty: functionalProperty
|
|
605
609
|
});
|
|
606
610
|
}
|
|
607
|
-
});
|
|
611
|
+
}));
|
|
608
612
|
}
|
|
609
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
|
+
|
|
610
629
|
switch (step.type) {
|
|
611
630
|
case _type.type.string:
|
|
612
631
|
switch (step.format) {
|
|
@@ -628,7 +647,7 @@ var Step = function Step(_ref4) {
|
|
|
628
647
|
type: "text",
|
|
629
648
|
id: entry,
|
|
630
649
|
className: (0, _classnames["default"])(classes.input, _defineProperty({}, classes.input__invalid, error)),
|
|
631
|
-
readOnly: disabled
|
|
650
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null
|
|
632
651
|
}, step.props, {
|
|
633
652
|
defaultValue: defaultValue,
|
|
634
653
|
placeholder: step.placeholder
|
|
@@ -651,7 +670,7 @@ var Step = function Step(_ref4) {
|
|
|
651
670
|
error: error
|
|
652
671
|
}, /*#__PURE__*/_react["default"].createElement(_index.CodeInput, _extends({
|
|
653
672
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
654
|
-
readOnly: disabled
|
|
673
|
+
readOnly: functionalProperty(entry, step.disabled) ? true : false,
|
|
655
674
|
onChange: function onChange(e) {
|
|
656
675
|
field.onChange(e);
|
|
657
676
|
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
@@ -685,7 +704,7 @@ var Step = function Step(_ref4) {
|
|
|
685
704
|
error: error
|
|
686
705
|
}, /*#__PURE__*/_react["default"].createElement(_index.MarkdownInput, _extends({}, step.props, {
|
|
687
706
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
688
|
-
readOnly: disabled
|
|
707
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
689
708
|
onChange: function onChange(e) {
|
|
690
709
|
field.onChange(e);
|
|
691
710
|
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
@@ -720,7 +739,7 @@ var Step = function Step(_ref4) {
|
|
|
720
739
|
error: error
|
|
721
740
|
}, /*#__PURE__*/_react["default"].createElement(_index.SelectInput, _extends({}, step.props, step, {
|
|
722
741
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
723
|
-
disabled: disabled
|
|
742
|
+
disabled: functionalProperty(entry, step.disabled),
|
|
724
743
|
value: field.value,
|
|
725
744
|
possibleValues: step.options,
|
|
726
745
|
defaultValue: defaultValue,
|
|
@@ -759,7 +778,7 @@ var Step = function Step(_ref4) {
|
|
|
759
778
|
type: step.format || 'text',
|
|
760
779
|
id: entry,
|
|
761
780
|
className: (0, _classnames["default"])(classes.input, _defineProperty({}, classes.input__invalid, error)),
|
|
762
|
-
readOnly: disabled
|
|
781
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
763
782
|
defaultValue: defaultValue,
|
|
764
783
|
placeholder: step.placeholder
|
|
765
784
|
}, inputProps)));
|
|
@@ -785,7 +804,7 @@ var Step = function Step(_ref4) {
|
|
|
785
804
|
error: error
|
|
786
805
|
}, /*#__PURE__*/_react["default"].createElement(_index.SelectInput, _extends({}, step.props, step, {
|
|
787
806
|
className: (0, _classnames["default"])(classes.content, _defineProperty({}, classes.input__invalid, error)),
|
|
788
|
-
readOnly: disabled
|
|
807
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
789
808
|
onChange: function onChange(e) {
|
|
790
809
|
field.onChange(e);
|
|
791
810
|
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
@@ -822,7 +841,7 @@ var Step = function Step(_ref4) {
|
|
|
822
841
|
type: step.format || 'number',
|
|
823
842
|
id: entry,
|
|
824
843
|
className: (0, _classnames["default"])(classes.input, _defineProperty({}, classes.input__invalid, error)),
|
|
825
|
-
readOnly: disabled
|
|
844
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
826
845
|
name: entry,
|
|
827
846
|
placeholder: step.placeholder,
|
|
828
847
|
defaultValue: defaultValue
|
|
@@ -846,7 +865,7 @@ var Step = function Step(_ref4) {
|
|
|
846
865
|
error: error
|
|
847
866
|
}, /*#__PURE__*/_react["default"].createElement(_index.BooleanInput, _extends({}, step.props, {
|
|
848
867
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
849
|
-
readOnly: disabled
|
|
868
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
850
869
|
onChange: function onChange(e) {
|
|
851
870
|
field.onChange(e);
|
|
852
871
|
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
@@ -883,7 +902,7 @@ var Step = function Step(_ref4) {
|
|
|
883
902
|
error: error
|
|
884
903
|
}, /*#__PURE__*/_react["default"].createElement(_index.SelectInput, _extends({}, step.props, step, {
|
|
885
904
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
886
|
-
readOnly: disabled
|
|
905
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
887
906
|
onChange: function onChange(e) {
|
|
888
907
|
field.onChange(e);
|
|
889
908
|
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
@@ -930,7 +949,8 @@ var Step = function Step(_ref4) {
|
|
|
930
949
|
maybeCustomHttpClient: httpClient,
|
|
931
950
|
value: getValues(entry) || defaultValue,
|
|
932
951
|
error: error,
|
|
933
|
-
index: index
|
|
952
|
+
index: index,
|
|
953
|
+
functionalProperty: functionalProperty
|
|
934
954
|
}));
|
|
935
955
|
|
|
936
956
|
default:
|
|
@@ -951,7 +971,7 @@ var Step = function Step(_ref4) {
|
|
|
951
971
|
error: error
|
|
952
972
|
}, /*#__PURE__*/_react["default"].createElement(_index.ObjectInput, _extends({}, step.props, step, {
|
|
953
973
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
954
|
-
readOnly: disabled
|
|
974
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
955
975
|
onChange: function onChange(e) {
|
|
956
976
|
field.onChange(e);
|
|
957
977
|
(0, _Option.option)(step.onChange).map(function (onChange) {
|
|
@@ -988,7 +1008,7 @@ var Step = function Step(_ref4) {
|
|
|
988
1008
|
}, /*#__PURE__*/_react["default"].createElement(_reactRainbowComponents.DatePicker, _extends({}, step.props, {
|
|
989
1009
|
id: "datePicker-1",
|
|
990
1010
|
className: (0, _classnames["default"])(_defineProperty({}, classes.input__invalid, error)),
|
|
991
|
-
readOnly: disabled
|
|
1011
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
992
1012
|
value: field.value,
|
|
993
1013
|
onChange: function onChange(e) {
|
|
994
1014
|
field.onChange(e);
|
|
@@ -1050,7 +1070,7 @@ var Step = function Step(_ref4) {
|
|
|
1050
1070
|
}), /*#__PURE__*/_react["default"].createElement("button", {
|
|
1051
1071
|
type: "button",
|
|
1052
1072
|
className: "".concat(classes.btn, " ").concat(classes.flex, " ").concat(classes.ai_center),
|
|
1053
|
-
disabled: uploading || disabled
|
|
1073
|
+
disabled: uploading || functionalProperty(entry, step.disabled),
|
|
1054
1074
|
onClick: trigger
|
|
1055
1075
|
}, uploading && /*#__PURE__*/_react["default"].createElement(_reactFeather.Loader, null), !uploading && /*#__PURE__*/_react["default"].createElement(_reactFeather.Upload, null), /*#__PURE__*/_react["default"].createElement("span", {
|
|
1056
1076
|
className: "".concat(classes.ml_5)
|
|
@@ -1102,7 +1122,7 @@ var Step = function Step(_ref4) {
|
|
|
1102
1122
|
type: "file",
|
|
1103
1123
|
id: entry,
|
|
1104
1124
|
className: (0, _classnames["default"])(classes.input, _defineProperty({}, classes.input__invalid, error)),
|
|
1105
|
-
readOnly: disabled
|
|
1125
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
1106
1126
|
name: entry,
|
|
1107
1127
|
placeholder: step.placeholder
|
|
1108
1128
|
}, inputProps)));
|
|
@@ -1182,6 +1202,8 @@ var ArrayStep = function ArrayStep(_ref15) {
|
|
|
1182
1202
|
};
|
|
1183
1203
|
|
|
1184
1204
|
var NestedForm = function NestedForm(_ref16) {
|
|
1205
|
+
var _classNames15;
|
|
1206
|
+
|
|
1185
1207
|
var schema = _ref16.schema,
|
|
1186
1208
|
flow = _ref16.flow,
|
|
1187
1209
|
parent = _ref16.parent,
|
|
@@ -1190,7 +1212,8 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1190
1212
|
index = _ref16.index,
|
|
1191
1213
|
error = _ref16.error,
|
|
1192
1214
|
value = _ref16.value,
|
|
1193
|
-
step = _ref16.step
|
|
1215
|
+
step = _ref16.step,
|
|
1216
|
+
functionalProperty = _ref16.functionalProperty;
|
|
1194
1217
|
|
|
1195
1218
|
var _useFormContext = (0, _reactHookForm.useFormContext)(),
|
|
1196
1219
|
register = _useFormContext.register,
|
|
@@ -1266,9 +1289,9 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1266
1289
|
}, []);
|
|
1267
1290
|
var bordered = computedSandF.filter(function (x) {
|
|
1268
1291
|
return x.visibleStep;
|
|
1269
|
-
}).length
|
|
1292
|
+
}).length > 1 && step.label !== null;
|
|
1270
1293
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1271
|
-
className: (0, _classnames["default"])(
|
|
1294
|
+
className: (0, _classnames["default"])((_classNames15 = {}, _defineProperty(_classNames15, classes.nestedform__border, bordered), _defineProperty(_classNames15, classes.border__error, !!error), _classNames15))
|
|
1272
1295
|
}, !!step.collapsable && schemaAndFlow.flow.length > 1 && collapsed && /*#__PURE__*/_react["default"].createElement(_reactFeather.ArrowDown, {
|
|
1273
1296
|
size: 30,
|
|
1274
1297
|
className: classes.cursor_pointer,
|
|
@@ -1313,7 +1336,7 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1313
1336
|
className: (0, _classnames["default"])(_defineProperty({}, classes.display__none, isCollapsed || !visibleStep)),
|
|
1314
1337
|
entry: "".concat(parent, ".").concat(entry),
|
|
1315
1338
|
error: realError,
|
|
1316
|
-
label: (step === null || step === void 0 ? void 0 : step.label) === null ? null : (step === null || step === void 0 ? void 0 : step.label) || entry,
|
|
1339
|
+
label: functionalProperty(entry, (step === null || step === void 0 ? void 0 : step.label) === null ? null : (step === null || step === void 0 ? void 0 : step.label) || entry),
|
|
1317
1340
|
help: step.help,
|
|
1318
1341
|
render: inputWrapper
|
|
1319
1342
|
}, /*#__PURE__*/_react["default"].createElement(Step, {
|
|
@@ -1331,7 +1354,8 @@ var NestedForm = function NestedForm(_ref16) {
|
|
|
1331
1354
|
watch: watch,
|
|
1332
1355
|
inputWrapper: inputWrapper,
|
|
1333
1356
|
httpClient: maybeCustomHttpClient,
|
|
1334
|
-
defaultValue: value && value[entry]
|
|
1357
|
+
defaultValue: value && value[entry],
|
|
1358
|
+
functionalProperty: functionalProperty
|
|
1335
1359
|
}));
|
|
1336
1360
|
}));
|
|
1337
1361
|
};
|
package/lib/resolvers/utils.js
CHANGED
|
@@ -42,10 +42,6 @@ var resolvers = (_resolvers = {}, _defineProperty(_resolvers, _type.type.string,
|
|
|
42
42
|
}), _resolvers);
|
|
43
43
|
|
|
44
44
|
var buildSubResolver = function buildSubResolver(props, key, dependencies, rawData) {
|
|
45
|
-
var type = props.type,
|
|
46
|
-
_props$constraints = props.constraints,
|
|
47
|
-
constraints = _props$constraints === void 0 ? [] : _props$constraints;
|
|
48
|
-
|
|
49
45
|
if (props.array || props.isMulti) {
|
|
50
46
|
var subResolver;
|
|
51
47
|
var arrayResolver = yup.array();
|
|
@@ -64,13 +60,13 @@ var buildSubResolver = function buildSubResolver(props, key, dependencies, rawDa
|
|
|
64
60
|
return constraints.reduce(function (resolver, constraint) {
|
|
65
61
|
return jsonOrFunctionConstraint(constraint, resolver, key, dependencies);
|
|
66
62
|
}, arrayResolver);
|
|
67
|
-
} else if (props.type === type.object && props.schema) {
|
|
63
|
+
} else if (props.type === _type.type.object && props.schema) {
|
|
68
64
|
var _subResolver = getShapeAndDependencies(props.flow || Object.keys(props.schema), props.schema, dependencies, rawData);
|
|
69
65
|
|
|
70
|
-
return constraints.reduce(function (resolver, constraint) {
|
|
66
|
+
return props.constraints.reduce(function (resolver, constraint) {
|
|
71
67
|
return jsonOrFunctionConstraint(constraint, resolver, key, dependencies);
|
|
72
68
|
}, yup.object().shape(_subResolver.shape, dependencies));
|
|
73
|
-
} else if (props.type === type.object && props.conditionalSchema) {
|
|
69
|
+
} else if (props.type === _type.type.object && props.conditionalSchema) {
|
|
74
70
|
var _option$map$getOrElse = (0, _Option.option)(props.conditionalSchema).map(function (condiSchema) {
|
|
75
71
|
var ref = (0, _Option.option)(condiSchema.ref).map(function (ref) {
|
|
76
72
|
return rawData[ref];
|
|
@@ -94,13 +90,13 @@ var buildSubResolver = function buildSubResolver(props, key, dependencies, rawDa
|
|
|
94
90
|
|
|
95
91
|
var _subResolver2 = getShapeAndDependencies(flow || Object.keys(schema), schema, dependencies, rawData);
|
|
96
92
|
|
|
97
|
-
return constraints.reduce(function (resolver, constraint) {
|
|
93
|
+
return props.constraints.reduce(function (resolver, constraint) {
|
|
98
94
|
return jsonOrFunctionConstraint(constraint, resolver, key, dependencies);
|
|
99
95
|
}, yup.object().shape(_subResolver2.shape, dependencies));
|
|
100
96
|
} else {
|
|
101
|
-
return constraints.reduce(function (resolver, constraint) {
|
|
97
|
+
return props.constraints.reduce(function (resolver, constraint) {
|
|
102
98
|
return jsonOrFunctionConstraint(constraint, resolver, key, dependencies);
|
|
103
|
-
}, resolvers[type]());
|
|
99
|
+
}, resolvers[props.type]());
|
|
104
100
|
}
|
|
105
101
|
};
|
|
106
102
|
|
|
@@ -122,6 +118,14 @@ var getShapeAndDependencies = function getShapeAndDependencies(flow, schema) {
|
|
|
122
118
|
return _objectSpread(_objectSpread({}, resolvers), getShapeAndDependencies(key.flow, schema, dependencies, rawData).shape);
|
|
123
119
|
}
|
|
124
120
|
|
|
121
|
+
console.group('get resolver');
|
|
122
|
+
console.debug({
|
|
123
|
+
schemaBykey: schema[key],
|
|
124
|
+
key: key,
|
|
125
|
+
dependencies: dependencies,
|
|
126
|
+
rawData: rawData
|
|
127
|
+
});
|
|
128
|
+
console.groupEnd();
|
|
125
129
|
var resolver = buildSubResolver(schema[key], key, dependencies, rawData);
|
|
126
130
|
return _objectSpread(_objectSpread({}, resolvers), {}, _defineProperty({}, key, resolver));
|
|
127
131
|
}, {});
|
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
|
}
|
|
@@ -223,4 +223,8 @@ export namespace style {
|
|
|
223
223
|
export { marginBottom_1 as marginBottom };
|
|
224
224
|
export const position: string;
|
|
225
225
|
}
|
|
226
|
+
namespace border__error {
|
|
227
|
+
const borderColor_1: string;
|
|
228
|
+
export { borderColor_1 as borderColor };
|
|
229
|
+
}
|
|
226
230
|
}
|
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",
|
|
@@ -168,5 +172,7 @@ var style = (_style = {
|
|
|
168
172
|
paddingLeft: '1rem',
|
|
169
173
|
marginBottom: '.5rem',
|
|
170
174
|
position: 'relative'
|
|
175
|
+
}), _defineProperty(_style, "border__error", {
|
|
176
|
+
borderColor: "#dc3545"
|
|
171
177
|
}), _style);
|
|
172
178
|
exports.style = style;
|
package/lib/styleContext.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function useCustomStyle(overrideStyle?: {}): import("jss").Classes<"code" | "flex" | "input" | "btn" | "btn_sm" | "btn_group" | "btn_red" | "btn_green" | "btn_blue" | "btn_grey" | "txt_red" | "ml_5" | "ml_10" | "mr_5" | "mr_10" | "mt_5" | "mt_10" | "mt_20" | "mb_5" | "p_15" | "pr_15" | "full_width" | "d_none" | "flexColumn" | "justifyContentBetween" | "jc_end" | "ac_center" | "ai_center" | "cursor_pointer" | "collapse" | "collapse_label" | "collapse_error" | "datepicker" | "input__boolean__on" | "input__boolean__off" | "input__invalid" | "invalid_feedback" | "display__none" | "collapse__inline" | "nestedform__border">;
|
|
1
|
+
export function useCustomStyle(overrideStyle?: {}): import("jss").Classes<"code" | "flex" | "input" | "btn" | "btn_sm" | "btn_group" | "btn_red" | "btn_green" | "btn_blue" | "btn_grey" | "txt_red" | "ml_5" | "ml_10" | "mr_5" | "mr_10" | "mt_5" | "mt_10" | "mt_20" | "mb_5" | "p_15" | "pr_15" | "full_width" | "d_none" | "flexColumn" | "justifyContentBetween" | "jc_end" | "ac_center" | "ai_center" | "cursor_pointer" | "collapse" | "collapse_label" | "collapse_error" | "datepicker" | "input__boolean__on" | "input__boolean__off" | "input__invalid" | "invalid_feedback" | "display__none" | "collapse__inline" | "nestedform__border" | "border__error">;
|