@ssplib/react-components 0.0.160 → 0.0.161
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.
|
@@ -42,8 +42,10 @@ const form_1 = require("../../../context/form");
|
|
|
42
42
|
const material_1 = require("@mui/material");
|
|
43
43
|
const lodash_get_1 = __importDefault(require("lodash.get"));
|
|
44
44
|
function getChildrenNames(children) {
|
|
45
|
+
console.log('ENTROU NO getChildrenNames');
|
|
45
46
|
let arr = [];
|
|
46
47
|
children.forEach((x) => {
|
|
48
|
+
console.log('ENTROU NO forEach DO getChildrenNames - VALOR DE x: ', x);
|
|
47
49
|
if (!x.props)
|
|
48
50
|
return;
|
|
49
51
|
if (x.props.children) {
|
|
@@ -61,16 +63,18 @@ function getChildrenNames(children) {
|
|
|
61
63
|
function RequiredCheckBoxGroup(_a) {
|
|
62
64
|
var _b;
|
|
63
65
|
var { customText = 'Selecione pelo menos 1 opção' } = _a, props = __rest(_a, ["customText"]);
|
|
66
|
+
console.log('ENTROU NO RequiredCheckBoxGroup - VALOR DE props: ', props);
|
|
64
67
|
const context = (0, react_1.useContext)(form_1.FormContext);
|
|
65
68
|
return (react_1.default.createElement(material_1.Grid, { container: true, sx: { border: (0, lodash_get_1.default)(context.errors, props.name) ? '2px solid #a51c30' : '', padding: 1, borderRadius: 2 } },
|
|
66
|
-
react_1.default.createElement("input", Object.assign({ type: 'text' }, context.formRegister(props.name, {
|
|
67
|
-
validate: (v,
|
|
69
|
+
react_1.default.createElement("input", Object.assign({ key: 1, type: 'text' }, context.formRegister(props.name, {
|
|
70
|
+
validate: (v, i) => {
|
|
68
71
|
const names = getChildrenNames(Array.isArray(props.children) ? props.children : [props.children]);
|
|
69
72
|
let canContinue = false;
|
|
70
|
-
names.forEach((x) => {
|
|
73
|
+
names.forEach((x, i) => {
|
|
71
74
|
const nameValue = context.formGetValues(x);
|
|
72
75
|
if (nameValue)
|
|
73
76
|
canContinue = true;
|
|
77
|
+
console.log(`ENTROU NO forEach DO return - VALOR DE names: ${names} - VALOR ATUAL: ${x} - INDEX: ${i}`);
|
|
74
78
|
});
|
|
75
79
|
if (!canContinue)
|
|
76
80
|
return customText;
|