@ssplib/react-components 0.0.112 → 0.0.114
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.
|
@@ -70,7 +70,7 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
|
|
|
70
70
|
if (!res.ok)
|
|
71
71
|
setFilesError((fl) => [...fl, id]);
|
|
72
72
|
res.json().then((j) => {
|
|
73
|
-
if (j.status.status === 200) {
|
|
73
|
+
if (j.status && j.status.status === 200) {
|
|
74
74
|
const fileIdFromApi = j.data[0];
|
|
75
75
|
const fileId = fileIdFromApi['coSeqArquivo'];
|
|
76
76
|
context.setFilesUid((fId) => [
|
|
@@ -136,15 +136,13 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
|
|
|
136
136
|
react_1.default.createElement(material_1.Box, { sx: { backgroundColor: '#e2eafc', padding: 1, borderRadius: 1, marginTop: 1 } },
|
|
137
137
|
react_1.default.createElement("input", Object.assign({ id: name, type: 'file', multiple: multiple }, context === null || context === void 0 ? void 0 : context.formRegister(name, {
|
|
138
138
|
validate: (v, f) => {
|
|
139
|
-
|
|
140
|
-
if (filesLoaded.length <= 0 && required)
|
|
139
|
+
if ((v.length && filesLoaded.length) <= 0 && required)
|
|
141
140
|
return 'O campo de arquivo é obrigatório';
|
|
142
141
|
},
|
|
143
142
|
}), { onChange: onFile, accept: '.pdf', style: { display: 'none' } })),
|
|
144
143
|
react_1.default.createElement("input", Object.assign({ id: name + 'foto', type: 'file', capture: 'environment', multiple: multiple }, context === null || context === void 0 ? void 0 : context.formRegister(name, {
|
|
145
144
|
validate: (v, f) => {
|
|
146
|
-
|
|
147
|
-
if (filesLoaded.length <= 0 && required)
|
|
145
|
+
if ((v.length && filesLoaded.length) <= 0 && required)
|
|
148
146
|
return 'O campo de arquivo é obrigatório';
|
|
149
147
|
},
|
|
150
148
|
}), { onChange: onFile, accept: '.jpg, .png, .jpeg', style: { display: 'none' } })),
|