@maif/react-forms 1.0.53 → 1.0.54
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 +33 -20
- package/lib/index.js +33 -20
- package/package.json +2 -3
package/lib/esm/index.js
CHANGED
|
@@ -28863,18 +28863,28 @@ var buildSubResolver = function buildSubResolver(props, key, dependencies, rawDa
|
|
|
28863
28863
|
return s.condition === ref;
|
|
28864
28864
|
}
|
|
28865
28865
|
});
|
|
28866
|
-
return option(filterSwitch).
|
|
28866
|
+
return option(filterSwitch).orElse(condiSchema["switch"].find(function (s) {
|
|
28867
28867
|
return s["default"];
|
|
28868
|
-
}))
|
|
28869
|
-
|
|
28868
|
+
})).getOrElse({
|
|
28869
|
+
schema: {},
|
|
28870
|
+
flow: []
|
|
28871
|
+
});
|
|
28872
|
+
}).getOrElse({
|
|
28873
|
+
schema: {},
|
|
28874
|
+
flow: []
|
|
28875
|
+
}),
|
|
28870
28876
|
schema = _option$map$getOrElse.schema,
|
|
28871
28877
|
flow = _option$map$getOrElse.flow;
|
|
28872
28878
|
|
|
28873
|
-
var
|
|
28879
|
+
var realFlow = flow || Object.keys(schema);
|
|
28874
28880
|
|
|
28875
|
-
|
|
28876
|
-
|
|
28877
|
-
|
|
28881
|
+
if (realFlow.length) {
|
|
28882
|
+
var _subResolver2 = getShapeAndDependencies(flow || Object.keys(schema), schema, dependencies, rawData);
|
|
28883
|
+
|
|
28884
|
+
return constraints.reduce(function (resolver, constraint) {
|
|
28885
|
+
return jsonOrFunctionConstraint(constraint, resolver, key, dependencies);
|
|
28886
|
+
}, yup.object().shape(_subResolver2.shape, dependencies));
|
|
28887
|
+
}
|
|
28878
28888
|
} else {
|
|
28879
28889
|
return constraints.reduce(function (resolver, constraint) {
|
|
28880
28890
|
return jsonOrFunctionConstraint(constraint, resolver, key, dependencies);
|
|
@@ -28928,7 +28938,7 @@ var CustomizableInput$1 = /*#__PURE__*/React.memo(function (props) {
|
|
|
28928
28938
|
|
|
28929
28939
|
return props.children;
|
|
28930
28940
|
}, function (prev, next) {
|
|
28931
|
-
if (next.render) {
|
|
28941
|
+
if (next.render || next.conditionalSchema) {
|
|
28932
28942
|
return false;
|
|
28933
28943
|
}
|
|
28934
28944
|
|
|
@@ -29317,9 +29327,9 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29317
29327
|
initialReseted && trigger();
|
|
29318
29328
|
}, [trigger, initialReseted]);
|
|
29319
29329
|
var _handleSubmit = methods.handleSubmit,
|
|
29320
|
-
_methods$formState = methods.formState
|
|
29321
|
-
|
|
29322
|
-
dirtyFields = _methods$formState.dirtyFields,
|
|
29330
|
+
_methods$formState = methods.formState;
|
|
29331
|
+
_methods$formState.errors;
|
|
29332
|
+
var dirtyFields = _methods$formState.dirtyFields,
|
|
29323
29333
|
_reset = methods.reset,
|
|
29324
29334
|
trigger = methods.trigger,
|
|
29325
29335
|
getValues = methods.getValues,
|
|
@@ -29380,9 +29390,6 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29380
29390
|
return null;
|
|
29381
29391
|
}
|
|
29382
29392
|
|
|
29383
|
-
_typeof$1(entry) === 'object' ? undefined : entry.split('.').reduce(function (object, key) {
|
|
29384
|
-
return object && object[key];
|
|
29385
|
-
}, errors);
|
|
29386
29393
|
var visibleStep = option(step).map(function (s) {
|
|
29387
29394
|
return s.visible;
|
|
29388
29395
|
}).map(function (visible) {
|
|
@@ -30032,7 +30039,7 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30032
30039
|
};
|
|
30033
30040
|
|
|
30034
30041
|
var NestedForm = function NestedForm(_ref12) {
|
|
30035
|
-
var _classNames17;
|
|
30042
|
+
var _step$conditionalSche, _classNames17;
|
|
30036
30043
|
|
|
30037
30044
|
var schema = _ref12.schema,
|
|
30038
30045
|
flow = _ref12.flow,
|
|
@@ -30049,8 +30056,6 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30049
30056
|
getValues = _useFormContext4.getValues,
|
|
30050
30057
|
setValue = _useFormContext4.setValue,
|
|
30051
30058
|
watch = _useFormContext4.watch;
|
|
30052
|
-
_useFormContext4.trigger;
|
|
30053
|
-
_useFormContext4.formState;
|
|
30054
30059
|
|
|
30055
30060
|
var _useState7 = useState(!!step.collapsed),
|
|
30056
30061
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
@@ -30058,6 +30063,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30058
30063
|
setCollapsed = _useState8[1];
|
|
30059
30064
|
|
|
30060
30065
|
var classes = useCustomStyle();
|
|
30066
|
+
useWatch(step === null || step === void 0 ? void 0 : (_step$conditionalSche = step.conditionalSchema) === null || _step$conditionalSche === void 0 ? void 0 : _step$conditionalSche.ref);
|
|
30061
30067
|
var schemaAndFlow = option(step.conditionalSchema).map(function (condiSchema) {
|
|
30062
30068
|
var ref = option(condiSchema.ref).map(function (ref) {
|
|
30063
30069
|
return getValues(ref);
|
|
@@ -30073,9 +30079,16 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30073
30079
|
return s.condition === ref;
|
|
30074
30080
|
}
|
|
30075
30081
|
});
|
|
30076
|
-
|
|
30082
|
+
var schemaAndFlow = option(filterSwitch).orElse(condiSchema["switch"].find(function (s) {
|
|
30077
30083
|
return s["default"];
|
|
30078
|
-
}))
|
|
30084
|
+
})).getOrElse({
|
|
30085
|
+
schema: {},
|
|
30086
|
+
flow: []
|
|
30087
|
+
});
|
|
30088
|
+
return {
|
|
30089
|
+
schema: schemaAndFlow.schema,
|
|
30090
|
+
flow: schemaAndFlow.flow || Object.keys(schemaAndFlow.schema)
|
|
30091
|
+
};
|
|
30079
30092
|
}).getOrElse({
|
|
30080
30093
|
schema: schema,
|
|
30081
30094
|
flow: flow
|
|
@@ -30117,7 +30130,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30117
30130
|
}, []);
|
|
30118
30131
|
var bordered = computedSandF.filter(function (x) {
|
|
30119
30132
|
return x.visibleStep;
|
|
30120
|
-
}).length
|
|
30133
|
+
}).length >= 1 && step.label !== null;
|
|
30121
30134
|
return /*#__PURE__*/React.createElement("div", {
|
|
30122
30135
|
className: classNames((_classNames17 = {}, _defineProperty$1(_classNames17, classes.nestedform__border, bordered), _defineProperty$1(_classNames17, classes.border__error, !!errorDisplayed), _classNames17)),
|
|
30123
30136
|
style: {
|
package/lib/index.js
CHANGED
|
@@ -28897,18 +28897,28 @@ var buildSubResolver = function buildSubResolver(props, key, dependencies, rawDa
|
|
|
28897
28897
|
return s.condition === ref;
|
|
28898
28898
|
}
|
|
28899
28899
|
});
|
|
28900
|
-
return option(filterSwitch).
|
|
28900
|
+
return option(filterSwitch).orElse(condiSchema["switch"].find(function (s) {
|
|
28901
28901
|
return s["default"];
|
|
28902
|
-
}))
|
|
28903
|
-
|
|
28902
|
+
})).getOrElse({
|
|
28903
|
+
schema: {},
|
|
28904
|
+
flow: []
|
|
28905
|
+
});
|
|
28906
|
+
}).getOrElse({
|
|
28907
|
+
schema: {},
|
|
28908
|
+
flow: []
|
|
28909
|
+
}),
|
|
28904
28910
|
schema = _option$map$getOrElse.schema,
|
|
28905
28911
|
flow = _option$map$getOrElse.flow;
|
|
28906
28912
|
|
|
28907
|
-
var
|
|
28913
|
+
var realFlow = flow || Object.keys(schema);
|
|
28908
28914
|
|
|
28909
|
-
|
|
28910
|
-
|
|
28911
|
-
|
|
28915
|
+
if (realFlow.length) {
|
|
28916
|
+
var _subResolver2 = getShapeAndDependencies(flow || Object.keys(schema), schema, dependencies, rawData);
|
|
28917
|
+
|
|
28918
|
+
return constraints.reduce(function (resolver, constraint) {
|
|
28919
|
+
return jsonOrFunctionConstraint(constraint, resolver, key, dependencies);
|
|
28920
|
+
}, yup__namespace.object().shape(_subResolver2.shape, dependencies));
|
|
28921
|
+
}
|
|
28912
28922
|
} else {
|
|
28913
28923
|
return constraints.reduce(function (resolver, constraint) {
|
|
28914
28924
|
return jsonOrFunctionConstraint(constraint, resolver, key, dependencies);
|
|
@@ -28962,7 +28972,7 @@ var CustomizableInput$1 = /*#__PURE__*/React__default["default"].memo(function (
|
|
|
28962
28972
|
|
|
28963
28973
|
return props.children;
|
|
28964
28974
|
}, function (prev, next) {
|
|
28965
|
-
if (next.render) {
|
|
28975
|
+
if (next.render || next.conditionalSchema) {
|
|
28966
28976
|
return false;
|
|
28967
28977
|
}
|
|
28968
28978
|
|
|
@@ -29351,9 +29361,9 @@ var Form = /*#__PURE__*/React__default["default"].forwardRef(function (_ref7, re
|
|
|
29351
29361
|
initialReseted && trigger();
|
|
29352
29362
|
}, [trigger, initialReseted]);
|
|
29353
29363
|
var _handleSubmit = methods.handleSubmit,
|
|
29354
|
-
_methods$formState = methods.formState
|
|
29355
|
-
|
|
29356
|
-
dirtyFields = _methods$formState.dirtyFields,
|
|
29364
|
+
_methods$formState = methods.formState;
|
|
29365
|
+
_methods$formState.errors;
|
|
29366
|
+
var dirtyFields = _methods$formState.dirtyFields,
|
|
29357
29367
|
_reset = methods.reset,
|
|
29358
29368
|
trigger = methods.trigger,
|
|
29359
29369
|
getValues = methods.getValues,
|
|
@@ -29414,9 +29424,6 @@ var Form = /*#__PURE__*/React__default["default"].forwardRef(function (_ref7, re
|
|
|
29414
29424
|
return null;
|
|
29415
29425
|
}
|
|
29416
29426
|
|
|
29417
|
-
_typeof$1(entry) === 'object' ? undefined : entry.split('.').reduce(function (object, key) {
|
|
29418
|
-
return object && object[key];
|
|
29419
|
-
}, errors);
|
|
29420
29427
|
var visibleStep = option(step).map(function (s) {
|
|
29421
29428
|
return s.visible;
|
|
29422
29429
|
}).map(function (visible) {
|
|
@@ -30066,7 +30073,7 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30066
30073
|
};
|
|
30067
30074
|
|
|
30068
30075
|
var NestedForm = function NestedForm(_ref12) {
|
|
30069
|
-
var _classNames17;
|
|
30076
|
+
var _step$conditionalSche, _classNames17;
|
|
30070
30077
|
|
|
30071
30078
|
var schema = _ref12.schema,
|
|
30072
30079
|
flow = _ref12.flow,
|
|
@@ -30083,8 +30090,6 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30083
30090
|
getValues = _useFormContext4.getValues,
|
|
30084
30091
|
setValue = _useFormContext4.setValue,
|
|
30085
30092
|
watch = _useFormContext4.watch;
|
|
30086
|
-
_useFormContext4.trigger;
|
|
30087
|
-
_useFormContext4.formState;
|
|
30088
30093
|
|
|
30089
30094
|
var _useState7 = React.useState(!!step.collapsed),
|
|
30090
30095
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
@@ -30092,6 +30097,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30092
30097
|
setCollapsed = _useState8[1];
|
|
30093
30098
|
|
|
30094
30099
|
var classes = useCustomStyle();
|
|
30100
|
+
reactHookForm.useWatch(step === null || step === void 0 ? void 0 : (_step$conditionalSche = step.conditionalSchema) === null || _step$conditionalSche === void 0 ? void 0 : _step$conditionalSche.ref);
|
|
30095
30101
|
var schemaAndFlow = option(step.conditionalSchema).map(function (condiSchema) {
|
|
30096
30102
|
var ref = option(condiSchema.ref).map(function (ref) {
|
|
30097
30103
|
return getValues(ref);
|
|
@@ -30107,9 +30113,16 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30107
30113
|
return s.condition === ref;
|
|
30108
30114
|
}
|
|
30109
30115
|
});
|
|
30110
|
-
|
|
30116
|
+
var schemaAndFlow = option(filterSwitch).orElse(condiSchema["switch"].find(function (s) {
|
|
30111
30117
|
return s["default"];
|
|
30112
|
-
}))
|
|
30118
|
+
})).getOrElse({
|
|
30119
|
+
schema: {},
|
|
30120
|
+
flow: []
|
|
30121
|
+
});
|
|
30122
|
+
return {
|
|
30123
|
+
schema: schemaAndFlow.schema,
|
|
30124
|
+
flow: schemaAndFlow.flow || Object.keys(schemaAndFlow.schema)
|
|
30125
|
+
};
|
|
30113
30126
|
}).getOrElse({
|
|
30114
30127
|
schema: schema,
|
|
30115
30128
|
flow: flow
|
|
@@ -30151,7 +30164,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30151
30164
|
}, []);
|
|
30152
30165
|
var bordered = computedSandF.filter(function (x) {
|
|
30153
30166
|
return x.visibleStep;
|
|
30154
|
-
}).length
|
|
30167
|
+
}).length >= 1 && step.label !== null;
|
|
30155
30168
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
30156
30169
|
className: classNames__default["default"]((_classNames17 = {}, _defineProperty$1(_classNames17, classes.nestedform__border, bordered), _defineProperty$1(_classNames17, classes.border__error, !!errorDisplayed), _classNames17)),
|
|
30157
30170
|
style: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maif/react-forms",
|
|
3
3
|
"description": "Build react safe forms as fast as possible",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.54",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
7
7
|
"types": "lib/index.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
]
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"react": "^17.0.2"
|
|
59
|
+
"react": "^17.0.2 || 18"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@babel/cli": "^7.17.6",
|
|
@@ -98,7 +98,6 @@
|
|
|
98
98
|
"@codemirror/theme-one-dark": "^0.19.1",
|
|
99
99
|
"@fortawesome/fontawesome-free": "^5.15.3",
|
|
100
100
|
"@hookform/resolvers": "2.4.0",
|
|
101
|
-
"@maif/react-forms": "^1.0.37-rc.1",
|
|
102
101
|
"@popperjs/core": "^2.11.2",
|
|
103
102
|
"@testing-library/jest-dom": "^5.11.4",
|
|
104
103
|
"@testing-library/react": "^11.1.0",
|