@ssplib/react-components 0.0.78 → 0.0.80
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.
|
@@ -35,7 +35,6 @@ function getChildrenNames(children) {
|
|
|
35
35
|
children.forEach((x) => {
|
|
36
36
|
if (!x.props)
|
|
37
37
|
return;
|
|
38
|
-
console.log('PROPS:', x.props);
|
|
39
38
|
if (x.props.children) {
|
|
40
39
|
const childrenArr = getChildrenNames(Array.isArray(x.props.children) ? x.props.children : [x.props.children]);
|
|
41
40
|
arr = arr.concat(childrenArr);
|
|
@@ -34,6 +34,11 @@ function SSPOtherCheckBox({ name, required = false, xs = 12, sm, md }) {
|
|
|
34
34
|
var _a;
|
|
35
35
|
const context = (0, react_1.useContext)(form_1.FormContext);
|
|
36
36
|
const checkName = `switch-${name}`;
|
|
37
|
+
(0, react_1.useEffect)(() => {
|
|
38
|
+
const checkValue = context.formWatch(checkName);
|
|
39
|
+
if (!checkValue)
|
|
40
|
+
context.formSetValue(name, undefined);
|
|
41
|
+
}, [context]);
|
|
37
42
|
return (react_1.default.createElement(material_1.Grid, Object.assign({ item: true }, { xs, sm, md }),
|
|
38
43
|
react_1.default.createElement(material_1.Stack, { direction: 'row' },
|
|
39
44
|
react_1.default.createElement(material_1.Box, null,
|
|
@@ -64,34 +64,6 @@ const getKeys = (values, id) => {
|
|
|
64
64
|
keys = [...keys, ...Object.keys(values.files).map((x) => `files.${x}`)];
|
|
65
65
|
return keys;
|
|
66
66
|
};
|
|
67
|
-
const _getKeys = (value) => {
|
|
68
|
-
const keys = Object.keys(value);
|
|
69
|
-
if (!value || keys.length <= 0)
|
|
70
|
-
return { objs: [], literals: [] };
|
|
71
|
-
console.log('ATUAL KEYS:', keys);
|
|
72
|
-
let literalValues = [];
|
|
73
|
-
let objectValues = [];
|
|
74
|
-
let result = keys;
|
|
75
|
-
keys.forEach((x) => {
|
|
76
|
-
console.log(x, ':', typeof value[x]);
|
|
77
|
-
if (typeof value[x] === 'object') {
|
|
78
|
-
objectValues.push(x);
|
|
79
|
-
const obj = _getKeys(value[x]);
|
|
80
|
-
objectValues = objectValues.concat(obj.objs);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
literalValues.push(x);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
console.log({
|
|
87
|
-
objs: objectValues,
|
|
88
|
-
literals: literalValues,
|
|
89
|
-
});
|
|
90
|
-
return {
|
|
91
|
-
objs: objectValues,
|
|
92
|
-
literals: literalValues,
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
67
|
function Stepper(_a) {
|
|
96
68
|
var { debugLog = false } = _a, props = __rest(_a, ["debugLog"]);
|
|
97
69
|
const length = Array.isArray(props.children) ? props.children.length : 1;
|
|
@@ -107,8 +79,6 @@ function Stepper(_a) {
|
|
|
107
79
|
const handleNext = () => __awaiter(this, void 0, void 0, function* () {
|
|
108
80
|
if (debugLog)
|
|
109
81
|
console.log(context.formGetValues());
|
|
110
|
-
console.log('TRIGGER:', getKeys(context.formGetValues(), activeStep));
|
|
111
|
-
// _getKeys(context.formGetValues()[activeStep])
|
|
112
82
|
const result = yield context.formTrigger(getKeys(context.formGetValues(), activeStep));
|
|
113
83
|
if (!result) {
|
|
114
84
|
setCanPass(true);
|