@ssplib/react-components 0.0.105 → 0.0.107

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.
@@ -115,11 +115,13 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
115
115
  };
116
116
  (0, react_1.useEffect)(() => {
117
117
  const dt = new DataTransfer();
118
- files.forEach((x) => {
118
+ files
119
+ .filter((x) => !filesError.includes(x.id))
120
+ .forEach((x) => {
119
121
  dt.items.add(x.file);
120
122
  });
121
123
  context === null || context === void 0 ? void 0 : context.formSetValue(name, dt.files);
122
- }, [files, context, name]);
124
+ }, [files, context, filesError, name]);
123
125
  (0, react_1.useEffect)(() => {
124
126
  return () => {
125
127
  context.setFilesUid((files) => files.filter((x) => x.CO_TIPO_ARQUIVO !== parseInt(tipoArquivo)));
@@ -130,12 +132,14 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
130
132
  react_1.default.createElement(material_1.Box, { sx: { backgroundColor: '#e2eafc', padding: 1, borderRadius: 1, marginTop: 1 } },
131
133
  react_1.default.createElement("input", Object.assign({ id: name, type: 'file', multiple: multiple }, context === null || context === void 0 ? void 0 : context.formRegister(name, {
132
134
  validate: (v, f) => {
135
+ console.log('dsadsadas 1');
133
136
  if (v.length <= 0 && required)
134
137
  return 'O campo de arquivo é obrigatório';
135
138
  },
136
139
  }), { onChange: onFile, accept: '.pdf', style: { display: 'none' } })),
137
140
  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, {
138
141
  validate: (v, f) => {
142
+ console.log('dsadsadas 2');
139
143
  if (v.length <= 0 && required)
140
144
  return 'O campo de arquivo é obrigatório';
141
145
  },
@@ -155,7 +159,6 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
155
159
  files.length,
156
160
  " arquivo",
157
161
  files.length > 1 && 's'),
158
- (0, lodash_get_1.default)(context === null || context === void 0 ? void 0 : context.errors, name) && (react_1.default.createElement(material_1.Typography, { variant: 'caption', sx: { color: '#e53935' } }, "* O campo de arquivo \u00E9 obrigat\u00F3rio")),
159
162
  files.length > 0 && (react_1.default.createElement(material_1.TableContainer, { component: material_1.Paper },
160
163
  react_1.default.createElement(system_1.Stack, { direction: 'column' }, files.map((x) => (react_1.default.createElement(system_1.Stack, { key: x.name, direction: 'row', justifyContent: 'space-between', padding: 0.5 },
161
164
  react_1.default.createElement(material_1.Box, null,
@@ -163,6 +166,7 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
163
166
  filesLoaded.includes(x.id) ? (react_1.default.createElement(Done_1.default, { sx: { fill: '#06d6a0' } })) : filesError.includes(x.id) ? (react_1.default.createElement(Clear_1.default, { sx: { fill: 'red' } })) : (react_1.default.createElement(material_1.CircularProgress, { size: 22, sx: { color: 'black' } })),
164
167
  react_1.default.createElement(PictureAsPdf_1.default, { color: 'error' }),
165
168
  react_1.default.createElement(material_1.Typography, { fontWeight: 600 }, x.name))),
166
- react_1.default.createElement(material_1.Box, null, (filesLoaded.includes(x.id) || filesError.includes(x.id)) && (react_1.default.createElement(material_1.Button, { variant: 'contained', size: 'small', sx: { textTransform: 'none', backgroundColor: '#d1495b', '&:hover': { backgroundColor: '#c1121f' } }, onClick: (e) => deleteFile(e, x.id), startIcon: react_1.default.createElement(Delete_1.default, null) }, "Remover"))))))))))));
169
+ react_1.default.createElement(material_1.Box, null, (filesLoaded.includes(x.id) || filesError.includes(x.id)) && (react_1.default.createElement(material_1.Button, { variant: 'contained', size: 'small', sx: { textTransform: 'none', backgroundColor: '#d1495b', '&:hover': { backgroundColor: '#c1121f' } }, onClick: (e) => deleteFile(e, x.id), startIcon: react_1.default.createElement(Delete_1.default, null) }, "Remover"))))))))),
170
+ (0, lodash_get_1.default)(context === null || context === void 0 ? void 0 : context.errors, name) && (react_1.default.createElement(material_1.Typography, { variant: 'caption', color: '#e53935', fontWeight: 600, fontSize: 14, paddingTop: 2 }, "* O campo de arquivo \u00E9 obrigat\u00F3rio")))));
167
171
  }
168
172
  exports.default = FileUpload;
@@ -145,6 +145,11 @@ function Table({ columns, fetchFunc, emptyMsg = {
145
145
  exists = true;
146
146
  }
147
147
  return;
148
+ case 'L':
149
+ if ('licenciado'.includes(searchValue.toLowerCase())) {
150
+ exists = true;
151
+ }
152
+ return;
148
153
  case 'PA':
149
154
  if ('pré aprovado'.includes(searchValue.toLowerCase())) {
150
155
  exists = true;
@@ -201,12 +206,10 @@ function Table({ columns, fetchFunc, emptyMsg = {
201
206
  });
202
207
  const csvData = header + values.join('\n');
203
208
  // download
204
- const a = document.createElement('a');
205
- a.href = 'data:text/csv;charset=utf-8,' + csvData;
206
- a.download = `${csv === null || csv === void 0 ? void 0 : csv.fileName}.csv`;
207
- document.body.appendChild(a);
208
- a.click();
209
- document.body.removeChild(a);
209
+ var link = window.document.createElement('a');
210
+ link.setAttribute('href', 'data:text/csv;charset=utf-8,%EF%BB%BF' + encodeURI(csvData));
211
+ link.setAttribute('download', `${csv === null || csv === void 0 ? void 0 : csv.fileName}.csv`);
212
+ link.click();
210
213
  }, [list]);
211
214
  const downloadCSVAll = (0, react_1.useCallback)((e) => {
212
215
  e.preventDefault();
@@ -231,25 +234,25 @@ function Table({ columns, fetchFunc, emptyMsg = {
231
234
  .join('\n');
232
235
  const csvData = header + values;
233
236
  // download
234
- const a = document.createElement('a');
235
- a.href = 'data:text/csv;charset=utf-8,' + csvData;
236
- a.download = `${csv === null || csv === void 0 ? void 0 : csv.fileName}.csv`;
237
- document.body.appendChild(a);
238
- a.click();
239
- document.body.removeChild(a);
237
+ var link = window.document.createElement('a');
238
+ link.setAttribute('href', 'data:text/csv;charset=utf-8,%EF%BB%BF' + encodeURI(csvData));
239
+ link.setAttribute('download', `${csv === null || csv === void 0 ? void 0 : csv.fileName}.csv`);
240
+ link.click();
240
241
  }, [list]);
241
242
  const getStatusMsg = (0, react_1.useCallback)((cod) => {
242
243
  switch (cod) {
243
244
  case 'P':
244
245
  return (react_1.default.createElement(Typography_1.default, { color: '#F59E0B', fontWeight: 600, fontFamily: 'Inter' }, "EM AN\u00C1LISE"));
245
246
  case 'A':
246
- return (react_1.default.createElement(Typography_1.default, { color: '#22C55E', fontWeight: 600, fontFamily: 'Inter' }, "CADASTRADO"));
247
+ return (react_1.default.createElement(Typography_1.default, { color: '#0EA5E9', fontWeight: 600, fontFamily: 'Inter' }, "CADASTRADO"));
247
248
  case 'C':
248
249
  return (react_1.default.createElement(Typography_1.default, { color: '#a1a1a1', fontWeight: 600, fontFamily: 'Inter' }, "CANCELADO"));
249
250
  case 'R':
250
251
  return (react_1.default.createElement(Typography_1.default, { color: '#EF4444', fontWeight: 600, fontFamily: 'Inter' }, "REPROVADO"));
252
+ case 'L':
253
+ return (react_1.default.createElement(Typography_1.default, { color: '#22C55E', fontWeight: 600, fontFamily: 'Inter' }, "LICENCIADO"));
251
254
  case 'PA':
252
- return (react_1.default.createElement(Typography_1.default, { color: '#6989ff', fontWeight: 600, fontFamily: 'Inter' }, "PR\u00C9 APROVADO"));
255
+ return (react_1.default.createElement(Typography_1.default, { color: '#6366F1', fontWeight: 600, fontFamily: 'Inter' }, "PR\u00C9 APROVADO"));
253
256
  }
254
257
  }, []);
255
258
  const onFilterSelect = (0, react_1.useCallback)((key, newValue) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssplib/react-components",
3
- "version": "0.0.105",
3
+ "version": "0.0.107",
4
4
  "description": "SSP React Components",
5
5
  "main": "index.js",
6
6
  "author": "Pedro Henrique <sr.hudrick@gmail.com>",