@ssplib/react-components 0.0.55 → 0.0.56
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/components/form/table/Table.js +17 -14
- package/package.json +1 -1
|
@@ -167,29 +167,32 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
167
167
|
e.preventDefault();
|
|
168
168
|
if (list.length <= 0)
|
|
169
169
|
return;
|
|
170
|
-
const
|
|
170
|
+
const originalKeys = Object.keys(list[0]);
|
|
171
|
+
const keys = originalKeys.filter((k) => !csvExcludeKeys.includes(k));
|
|
171
172
|
const header = keys.map((k) => (csvCustomKeyNames[k] ? csvCustomKeyNames[k] : k)).join(',') + '\n';
|
|
172
173
|
const values = [];
|
|
173
174
|
list.forEach((x) => {
|
|
174
175
|
let include = true;
|
|
175
|
-
|
|
176
|
-
.map((k) => {
|
|
176
|
+
originalKeys.forEach((k) => {
|
|
177
177
|
//verificar se pode incluir
|
|
178
178
|
if (csvExcludeValidate(k, x[k])) {
|
|
179
179
|
include = false;
|
|
180
|
-
return;
|
|
181
180
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
181
|
+
});
|
|
182
|
+
if (include) {
|
|
183
|
+
const value = keys
|
|
184
|
+
.map((k) => {
|
|
185
|
+
if (k === 'tbRa')
|
|
186
|
+
return x[k]['NO_CIDADE'];
|
|
187
|
+
if (k === 'rlEventoData')
|
|
188
|
+
return `${x[k][0]['DT_INICIO']} - ${x[k][0]['HR_INICIO']}`;
|
|
189
|
+
if (typeof x[k] === 'string')
|
|
190
|
+
return `"${x[k]}"`;
|
|
191
|
+
return x[k];
|
|
192
|
+
})
|
|
193
|
+
.join(',');
|
|
192
194
|
values.push(value);
|
|
195
|
+
}
|
|
193
196
|
});
|
|
194
197
|
const csvData = header + values.join('\n');
|
|
195
198
|
// download
|