@maif/react-forms 1.0.51 → 1.0.52
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 +32 -51
- package/lib/index.js +32 -51
- package/package.json +1 -1
package/lib/esm/index.js
CHANGED
|
@@ -28515,7 +28515,6 @@ function CodeInput(_ref) {
|
|
|
28515
28515
|
}, []);
|
|
28516
28516
|
useEffect(function () {
|
|
28517
28517
|
if (editor && (_typeof$1(value) === 'object' ? JSON.stringify(value, null, 2) : value) !== editor.state.doc.toString()) {
|
|
28518
|
-
console.log("set value", value, value === null || value === undefined ? '' : _typeof$1(value) === 'object' ? JSON.stringify(value, null, 2) : value, editor.state.doc.toString());
|
|
28519
28518
|
editor.dispatch({
|
|
28520
28519
|
changes: {
|
|
28521
28520
|
from: 0,
|
|
@@ -28929,6 +28928,15 @@ var CustomizableInput$1 = /*#__PURE__*/React.memo(function (props) {
|
|
|
28929
28928
|
|
|
28930
28929
|
return props.children;
|
|
28931
28930
|
}, function (prev, next) {
|
|
28931
|
+
console.debug({
|
|
28932
|
+
prev: prev,
|
|
28933
|
+
next: next
|
|
28934
|
+
});
|
|
28935
|
+
|
|
28936
|
+
if (next.render) {
|
|
28937
|
+
return false;
|
|
28938
|
+
}
|
|
28939
|
+
|
|
28932
28940
|
return prev.field.value === next.field.value && next.errorDisplayed === prev.errorDisplayed;
|
|
28933
28941
|
});
|
|
28934
28942
|
var ControlledInput = function ControlledInput(_ref) {
|
|
@@ -29281,11 +29289,6 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29281
29289
|
});
|
|
29282
29290
|
};
|
|
29283
29291
|
|
|
29284
|
-
var _useState = useState(false),
|
|
29285
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
29286
|
-
expandedAll = _useState2[0],
|
|
29287
|
-
setExpandedAll = _useState2[1];
|
|
29288
|
-
|
|
29289
29292
|
var defaultValues = getDefaultValues(formFlow, schema, value); //FIXME: get real schema through the switch
|
|
29290
29293
|
|
|
29291
29294
|
var _resolver = function resolver(rawData) {
|
|
@@ -29305,10 +29308,10 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29305
29308
|
mode: 'onChange'
|
|
29306
29309
|
});
|
|
29307
29310
|
|
|
29308
|
-
var
|
|
29309
|
-
|
|
29310
|
-
initialReseted =
|
|
29311
|
-
setReset =
|
|
29311
|
+
var _useState = useState(false),
|
|
29312
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29313
|
+
initialReseted = _useState2[0],
|
|
29314
|
+
setReset = _useState2[1];
|
|
29312
29315
|
|
|
29313
29316
|
useEffect(function () {
|
|
29314
29317
|
_reset(cleanInputArray(value, defaultValues, flow, schema));
|
|
@@ -29374,19 +29377,7 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29374
29377
|
var clean = cleanOutputArray(data, schema);
|
|
29375
29378
|
onSubmit(clean);
|
|
29376
29379
|
}, onError)
|
|
29377
|
-
},
|
|
29378
|
-
className: classNames(classes.flex, classes.mt_20)
|
|
29379
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
29380
|
-
type: "button",
|
|
29381
|
-
className: classNames(classes.btn, classes.btn_sm),
|
|
29382
|
-
style: {
|
|
29383
|
-
marginLeft: 'auto'
|
|
29384
|
-
},
|
|
29385
|
-
onClick: function onClick(e) {
|
|
29386
|
-
if (e) e.stopPropagation();
|
|
29387
|
-
setExpandedAll(!expandedAll);
|
|
29388
|
-
}
|
|
29389
|
-
}, expandedAll ? 'Expand all' : 'Collapse all')), formFlow.map(function (entry, idx) {
|
|
29380
|
+
}, formFlow.map(function (entry, idx) {
|
|
29390
29381
|
var step = schema[entry];
|
|
29391
29382
|
|
|
29392
29383
|
if (!step && typeof entry === 'string') {
|
|
@@ -29434,8 +29425,7 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29434
29425
|
schema: schema,
|
|
29435
29426
|
inputWrapper: inputWrapper,
|
|
29436
29427
|
httpClient: maybeCustomHttpClient,
|
|
29437
|
-
functionalProperty: functionalProperty
|
|
29438
|
-
expandedAll: expandedAll
|
|
29428
|
+
functionalProperty: functionalProperty
|
|
29439
29429
|
}));
|
|
29440
29430
|
}), /*#__PURE__*/React.createElement(Footer, {
|
|
29441
29431
|
render: footer,
|
|
@@ -29493,8 +29483,7 @@ var Step = function Step(_ref8) {
|
|
|
29493
29483
|
index = _ref8.index,
|
|
29494
29484
|
functionalProperty = _ref8.functionalProperty,
|
|
29495
29485
|
parent = _ref8.parent,
|
|
29496
|
-
onAfterChange = _ref8.onAfterChange
|
|
29497
|
-
expandedAll = _ref8.expandedAll;
|
|
29486
|
+
onAfterChange = _ref8.onAfterChange;
|
|
29498
29487
|
var classes = useCustomStyle();
|
|
29499
29488
|
|
|
29500
29489
|
var _useFormContext2 = useFormContext(),
|
|
@@ -29559,7 +29548,6 @@ var Step = function Step(_ref8) {
|
|
|
29559
29548
|
entry: en,
|
|
29560
29549
|
step: stp,
|
|
29561
29550
|
schema: schema,
|
|
29562
|
-
expandedAll: expandedAll,
|
|
29563
29551
|
inputWrapper: inputWrapper,
|
|
29564
29552
|
httpClient: httpClient,
|
|
29565
29553
|
defaultValue: stp === null || stp === void 0 ? void 0 : stp.defaultValue,
|
|
@@ -29637,8 +29625,7 @@ var Step = function Step(_ref8) {
|
|
|
29637
29625
|
defaultValue: (_props$defaultValue = props.defaultValue) === null || _props$defaultValue === void 0 ? void 0 : _props$defaultValue.value,
|
|
29638
29626
|
value: props.value,
|
|
29639
29627
|
index: idx,
|
|
29640
|
-
functionalProperty: functionalProperty
|
|
29641
|
-
expandedAll: expandedAll
|
|
29628
|
+
functionalProperty: functionalProperty
|
|
29642
29629
|
});
|
|
29643
29630
|
}
|
|
29644
29631
|
}));
|
|
@@ -29807,8 +29794,7 @@ var Step = function Step(_ref8) {
|
|
|
29807
29794
|
value: getValues(entry) || defaultValue,
|
|
29808
29795
|
index: index,
|
|
29809
29796
|
functionalProperty: functionalProperty,
|
|
29810
|
-
errorDisplayed: errorDisplayed
|
|
29811
|
-
expandedAll: expandedAll
|
|
29797
|
+
errorDisplayed: errorDisplayed
|
|
29812
29798
|
}));
|
|
29813
29799
|
|
|
29814
29800
|
case format.code:
|
|
@@ -29876,15 +29862,15 @@ var Step = function Step(_ref8) {
|
|
|
29876
29862
|
var FileInput = function FileInput(_ref10) {
|
|
29877
29863
|
var onChange = _ref10.onChange;
|
|
29878
29864
|
|
|
29879
|
-
var
|
|
29880
|
-
|
|
29881
|
-
uploading =
|
|
29882
|
-
setUploading =
|
|
29865
|
+
var _useState3 = useState(false),
|
|
29866
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29867
|
+
uploading = _useState4[0],
|
|
29868
|
+
setUploading = _useState4[1];
|
|
29883
29869
|
|
|
29884
|
-
var
|
|
29885
|
-
|
|
29886
|
-
input =
|
|
29887
|
-
setInput =
|
|
29870
|
+
var _useState5 = useState(undefined),
|
|
29871
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
29872
|
+
input = _useState6[0],
|
|
29873
|
+
setInput = _useState6[1];
|
|
29888
29874
|
|
|
29889
29875
|
var setFiles = function setFiles(e) {
|
|
29890
29876
|
var files = e.target.files;
|
|
@@ -30062,8 +30048,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30062
30048
|
value = _ref12.value,
|
|
30063
30049
|
step = _ref12.step,
|
|
30064
30050
|
functionalProperty = _ref12.functionalProperty,
|
|
30065
|
-
index = _ref12.index
|
|
30066
|
-
expandedAll = _ref12.expandedAll;
|
|
30051
|
+
index = _ref12.index;
|
|
30067
30052
|
|
|
30068
30053
|
var _useFormContext4 = useFormContext(),
|
|
30069
30054
|
getValues = _useFormContext4.getValues,
|
|
@@ -30072,15 +30057,12 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30072
30057
|
_useFormContext4.trigger;
|
|
30073
30058
|
_useFormContext4.formState;
|
|
30074
30059
|
|
|
30075
|
-
var
|
|
30076
|
-
|
|
30077
|
-
collapsed =
|
|
30078
|
-
setCollapsed =
|
|
30060
|
+
var _useState7 = useState(!!step.collapsed),
|
|
30061
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
30062
|
+
collapsed = _useState8[0],
|
|
30063
|
+
setCollapsed = _useState8[1];
|
|
30079
30064
|
|
|
30080
30065
|
var classes = useCustomStyle();
|
|
30081
|
-
useEffect(function () {
|
|
30082
|
-
if (!expandedAll || expandedAll && parent.split('.').length >= 2) setCollapsed(expandedAll);
|
|
30083
|
-
}, [expandedAll]);
|
|
30084
30066
|
var schemaAndFlow = option(step.conditionalSchema).map(function (condiSchema) {
|
|
30085
30067
|
var ref = option(condiSchema.ref).map(function (ref) {
|
|
30086
30068
|
return getValues(ref);
|
|
@@ -30199,8 +30181,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30199
30181
|
inputWrapper: inputWrapper,
|
|
30200
30182
|
httpClient: maybeCustomHttpClient,
|
|
30201
30183
|
defaultValue: value && value[entry],
|
|
30202
|
-
functionalProperty: functionalProperty
|
|
30203
|
-
expandedAll: expandedAll
|
|
30184
|
+
functionalProperty: functionalProperty
|
|
30204
30185
|
}));
|
|
30205
30186
|
}));
|
|
30206
30187
|
};
|
package/lib/index.js
CHANGED
|
@@ -28549,7 +28549,6 @@ function CodeInput(_ref) {
|
|
|
28549
28549
|
}, []);
|
|
28550
28550
|
React.useEffect(function () {
|
|
28551
28551
|
if (editor && (_typeof$1(value) === 'object' ? JSON.stringify(value, null, 2) : value) !== editor.state.doc.toString()) {
|
|
28552
|
-
console.log("set value", value, value === null || value === undefined ? '' : _typeof$1(value) === 'object' ? JSON.stringify(value, null, 2) : value, editor.state.doc.toString());
|
|
28553
28552
|
editor.dispatch({
|
|
28554
28553
|
changes: {
|
|
28555
28554
|
from: 0,
|
|
@@ -28963,6 +28962,15 @@ var CustomizableInput$1 = /*#__PURE__*/React__default["default"].memo(function (
|
|
|
28963
28962
|
|
|
28964
28963
|
return props.children;
|
|
28965
28964
|
}, function (prev, next) {
|
|
28965
|
+
console.debug({
|
|
28966
|
+
prev: prev,
|
|
28967
|
+
next: next
|
|
28968
|
+
});
|
|
28969
|
+
|
|
28970
|
+
if (next.render) {
|
|
28971
|
+
return false;
|
|
28972
|
+
}
|
|
28973
|
+
|
|
28966
28974
|
return prev.field.value === next.field.value && next.errorDisplayed === prev.errorDisplayed;
|
|
28967
28975
|
});
|
|
28968
28976
|
var ControlledInput = function ControlledInput(_ref) {
|
|
@@ -29315,11 +29323,6 @@ var Form = /*#__PURE__*/React__default["default"].forwardRef(function (_ref7, re
|
|
|
29315
29323
|
});
|
|
29316
29324
|
};
|
|
29317
29325
|
|
|
29318
|
-
var _useState = React.useState(false),
|
|
29319
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
29320
|
-
expandedAll = _useState2[0],
|
|
29321
|
-
setExpandedAll = _useState2[1];
|
|
29322
|
-
|
|
29323
29326
|
var defaultValues = getDefaultValues(formFlow, schema, value); //FIXME: get real schema through the switch
|
|
29324
29327
|
|
|
29325
29328
|
var _resolver = function resolver(rawData) {
|
|
@@ -29339,10 +29342,10 @@ var Form = /*#__PURE__*/React__default["default"].forwardRef(function (_ref7, re
|
|
|
29339
29342
|
mode: 'onChange'
|
|
29340
29343
|
});
|
|
29341
29344
|
|
|
29342
|
-
var
|
|
29343
|
-
|
|
29344
|
-
initialReseted =
|
|
29345
|
-
setReset =
|
|
29345
|
+
var _useState = React.useState(false),
|
|
29346
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29347
|
+
initialReseted = _useState2[0],
|
|
29348
|
+
setReset = _useState2[1];
|
|
29346
29349
|
|
|
29347
29350
|
React.useEffect(function () {
|
|
29348
29351
|
_reset(cleanInputArray(value, defaultValues, flow, schema));
|
|
@@ -29408,19 +29411,7 @@ var Form = /*#__PURE__*/React__default["default"].forwardRef(function (_ref7, re
|
|
|
29408
29411
|
var clean = cleanOutputArray(data, schema);
|
|
29409
29412
|
onSubmit(clean);
|
|
29410
29413
|
}, onError)
|
|
29411
|
-
},
|
|
29412
|
-
className: classNames__default["default"](classes.flex, classes.mt_20)
|
|
29413
|
-
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
29414
|
-
type: "button",
|
|
29415
|
-
className: classNames__default["default"](classes.btn, classes.btn_sm),
|
|
29416
|
-
style: {
|
|
29417
|
-
marginLeft: 'auto'
|
|
29418
|
-
},
|
|
29419
|
-
onClick: function onClick(e) {
|
|
29420
|
-
if (e) e.stopPropagation();
|
|
29421
|
-
setExpandedAll(!expandedAll);
|
|
29422
|
-
}
|
|
29423
|
-
}, expandedAll ? 'Expand all' : 'Collapse all')), formFlow.map(function (entry, idx) {
|
|
29414
|
+
}, formFlow.map(function (entry, idx) {
|
|
29424
29415
|
var step = schema[entry];
|
|
29425
29416
|
|
|
29426
29417
|
if (!step && typeof entry === 'string') {
|
|
@@ -29468,8 +29459,7 @@ var Form = /*#__PURE__*/React__default["default"].forwardRef(function (_ref7, re
|
|
|
29468
29459
|
schema: schema,
|
|
29469
29460
|
inputWrapper: inputWrapper,
|
|
29470
29461
|
httpClient: maybeCustomHttpClient,
|
|
29471
|
-
functionalProperty: functionalProperty
|
|
29472
|
-
expandedAll: expandedAll
|
|
29462
|
+
functionalProperty: functionalProperty
|
|
29473
29463
|
}));
|
|
29474
29464
|
}), /*#__PURE__*/React__default["default"].createElement(Footer, {
|
|
29475
29465
|
render: footer,
|
|
@@ -29527,8 +29517,7 @@ var Step = function Step(_ref8) {
|
|
|
29527
29517
|
index = _ref8.index,
|
|
29528
29518
|
functionalProperty = _ref8.functionalProperty,
|
|
29529
29519
|
parent = _ref8.parent,
|
|
29530
|
-
onAfterChange = _ref8.onAfterChange
|
|
29531
|
-
expandedAll = _ref8.expandedAll;
|
|
29520
|
+
onAfterChange = _ref8.onAfterChange;
|
|
29532
29521
|
var classes = useCustomStyle();
|
|
29533
29522
|
|
|
29534
29523
|
var _useFormContext2 = reactHookForm.useFormContext(),
|
|
@@ -29593,7 +29582,6 @@ var Step = function Step(_ref8) {
|
|
|
29593
29582
|
entry: en,
|
|
29594
29583
|
step: stp,
|
|
29595
29584
|
schema: schema,
|
|
29596
|
-
expandedAll: expandedAll,
|
|
29597
29585
|
inputWrapper: inputWrapper,
|
|
29598
29586
|
httpClient: httpClient,
|
|
29599
29587
|
defaultValue: stp === null || stp === void 0 ? void 0 : stp.defaultValue,
|
|
@@ -29671,8 +29659,7 @@ var Step = function Step(_ref8) {
|
|
|
29671
29659
|
defaultValue: (_props$defaultValue = props.defaultValue) === null || _props$defaultValue === void 0 ? void 0 : _props$defaultValue.value,
|
|
29672
29660
|
value: props.value,
|
|
29673
29661
|
index: idx,
|
|
29674
|
-
functionalProperty: functionalProperty
|
|
29675
|
-
expandedAll: expandedAll
|
|
29662
|
+
functionalProperty: functionalProperty
|
|
29676
29663
|
});
|
|
29677
29664
|
}
|
|
29678
29665
|
}));
|
|
@@ -29841,8 +29828,7 @@ var Step = function Step(_ref8) {
|
|
|
29841
29828
|
value: getValues(entry) || defaultValue,
|
|
29842
29829
|
index: index,
|
|
29843
29830
|
functionalProperty: functionalProperty,
|
|
29844
|
-
errorDisplayed: errorDisplayed
|
|
29845
|
-
expandedAll: expandedAll
|
|
29831
|
+
errorDisplayed: errorDisplayed
|
|
29846
29832
|
}));
|
|
29847
29833
|
|
|
29848
29834
|
case format.code:
|
|
@@ -29910,15 +29896,15 @@ var Step = function Step(_ref8) {
|
|
|
29910
29896
|
var FileInput = function FileInput(_ref10) {
|
|
29911
29897
|
var onChange = _ref10.onChange;
|
|
29912
29898
|
|
|
29913
|
-
var
|
|
29914
|
-
|
|
29915
|
-
uploading =
|
|
29916
|
-
setUploading =
|
|
29899
|
+
var _useState3 = React.useState(false),
|
|
29900
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29901
|
+
uploading = _useState4[0],
|
|
29902
|
+
setUploading = _useState4[1];
|
|
29917
29903
|
|
|
29918
|
-
var
|
|
29919
|
-
|
|
29920
|
-
input =
|
|
29921
|
-
setInput =
|
|
29904
|
+
var _useState5 = React.useState(undefined),
|
|
29905
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
29906
|
+
input = _useState6[0],
|
|
29907
|
+
setInput = _useState6[1];
|
|
29922
29908
|
|
|
29923
29909
|
var setFiles = function setFiles(e) {
|
|
29924
29910
|
var files = e.target.files;
|
|
@@ -30096,8 +30082,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30096
30082
|
value = _ref12.value,
|
|
30097
30083
|
step = _ref12.step,
|
|
30098
30084
|
functionalProperty = _ref12.functionalProperty,
|
|
30099
|
-
index = _ref12.index
|
|
30100
|
-
expandedAll = _ref12.expandedAll;
|
|
30085
|
+
index = _ref12.index;
|
|
30101
30086
|
|
|
30102
30087
|
var _useFormContext4 = reactHookForm.useFormContext(),
|
|
30103
30088
|
getValues = _useFormContext4.getValues,
|
|
@@ -30106,15 +30091,12 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30106
30091
|
_useFormContext4.trigger;
|
|
30107
30092
|
_useFormContext4.formState;
|
|
30108
30093
|
|
|
30109
|
-
var
|
|
30110
|
-
|
|
30111
|
-
collapsed =
|
|
30112
|
-
setCollapsed =
|
|
30094
|
+
var _useState7 = React.useState(!!step.collapsed),
|
|
30095
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
30096
|
+
collapsed = _useState8[0],
|
|
30097
|
+
setCollapsed = _useState8[1];
|
|
30113
30098
|
|
|
30114
30099
|
var classes = useCustomStyle();
|
|
30115
|
-
React.useEffect(function () {
|
|
30116
|
-
if (!expandedAll || expandedAll && parent.split('.').length >= 2) setCollapsed(expandedAll);
|
|
30117
|
-
}, [expandedAll]);
|
|
30118
30100
|
var schemaAndFlow = option(step.conditionalSchema).map(function (condiSchema) {
|
|
30119
30101
|
var ref = option(condiSchema.ref).map(function (ref) {
|
|
30120
30102
|
return getValues(ref);
|
|
@@ -30233,8 +30215,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30233
30215
|
inputWrapper: inputWrapper,
|
|
30234
30216
|
httpClient: maybeCustomHttpClient,
|
|
30235
30217
|
defaultValue: value && value[entry],
|
|
30236
|
-
functionalProperty: functionalProperty
|
|
30237
|
-
expandedAll: expandedAll
|
|
30218
|
+
functionalProperty: functionalProperty
|
|
30238
30219
|
}));
|
|
30239
30220
|
}));
|
|
30240
30221
|
};
|