@ssplib/react-components 0.0.167 → 0.0.169
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.
|
@@ -222,6 +222,7 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
222
222
|
});
|
|
223
223
|
Object.keys(obj).forEach((objKey) => {
|
|
224
224
|
const values = [];
|
|
225
|
+
console.log("===== downloadCSV ==== 1");
|
|
225
226
|
obj[objKey].forEach((x) => {
|
|
226
227
|
let include = true;
|
|
227
228
|
originalKeys.forEach((k) => {
|
|
@@ -233,6 +234,8 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
233
234
|
if (include) {
|
|
234
235
|
const value = keys
|
|
235
236
|
.map((k) => {
|
|
237
|
+
console.log(" DADOS 1 ");
|
|
238
|
+
console.log(x);
|
|
236
239
|
if (k === 'tbRa')
|
|
237
240
|
return x[k]['NO_CIDADE'];
|
|
238
241
|
if (k === 'rlEventoData')
|
|
@@ -242,6 +245,14 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
242
245
|
item = normalize ? item.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : item;
|
|
243
246
|
return removeQuotes ? `${item}` : `"${item}"`;
|
|
244
247
|
}
|
|
248
|
+
else if (typeof x[k] === 'object' &&
|
|
249
|
+
!Array.isArray(x[k]) &&
|
|
250
|
+
x[k] !== null) {
|
|
251
|
+
let strItemAsObject = transformArrayObjectInString(x[k]).slice(1, -1); // k: label (Ex.: jsNaturezaEvento)
|
|
252
|
+
let item = csvUpper && !csvExcludeUpper.includes(k) ? strItemAsObject.toUpperCase() : strItemAsObject;
|
|
253
|
+
item = normalize ? item.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : item;
|
|
254
|
+
return removeQuotes ? `${item}` : `"${item}"`;
|
|
255
|
+
}
|
|
245
256
|
return x[k];
|
|
246
257
|
})
|
|
247
258
|
.join(',');
|
|
@@ -264,6 +275,7 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
264
275
|
const keys = originalKeys.filter((k) => !csvExcludeKeysCSV.includes(k));
|
|
265
276
|
const header = keys.map((k) => (csvCustomKeyNames[k] ? csvCustomKeyNames[k] : k)).join(',') + '\n';
|
|
266
277
|
const values = [];
|
|
278
|
+
console.log("===== downloadCSV ==== 2");
|
|
267
279
|
list.forEach((x) => {
|
|
268
280
|
let include = true;
|
|
269
281
|
originalKeys.forEach((k) => {
|
|
@@ -275,6 +287,8 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
275
287
|
if (include) {
|
|
276
288
|
const value = keys
|
|
277
289
|
.map((k) => {
|
|
290
|
+
console.log(" DADOS 2 ");
|
|
291
|
+
console.log(x);
|
|
278
292
|
if (k === 'tbRa')
|
|
279
293
|
return x[k]['NO_CIDADE'];
|
|
280
294
|
if (k === 'rlEventoData')
|
|
@@ -333,10 +347,13 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
333
347
|
return;
|
|
334
348
|
const keys = Object.keys(list[0]).filter((k) => !csvExcludeKeysAll.includes(k));
|
|
335
349
|
const header = keys.join(',') + '\n';
|
|
350
|
+
console.log("===== downloadCSVAll ==== 3");
|
|
336
351
|
const values = list
|
|
337
352
|
.map((x) => {
|
|
338
353
|
return keys
|
|
339
354
|
.map((k) => {
|
|
355
|
+
console.log(" DADOS 3 ");
|
|
356
|
+
console.log(x);
|
|
340
357
|
if (k === 'tbRa')
|
|
341
358
|
return x[k]['NO_CIDADE'];
|
|
342
359
|
if (k === 'rlEventoData')
|
|
@@ -346,6 +363,14 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
346
363
|
item = normalize ? item.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : item;
|
|
347
364
|
return removeQuotes ? `${item}` : `"${item}"`;
|
|
348
365
|
}
|
|
366
|
+
else if (typeof x[k] === 'object' &&
|
|
367
|
+
!Array.isArray(x[k]) &&
|
|
368
|
+
x[k] !== null) {
|
|
369
|
+
let strItemAsObject = transformArrayObjectInString(x[k]).slice(1, -1); // k: label (Ex.: jsNaturezaEvento)
|
|
370
|
+
let item = csvUpper && !csvExcludeUpper.includes(k) ? strItemAsObject.toUpperCase() : strItemAsObject;
|
|
371
|
+
item = normalize ? item.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : item;
|
|
372
|
+
return removeQuotes ? `${item}` : `"${item}"`;
|
|
373
|
+
}
|
|
349
374
|
return x[k];
|
|
350
375
|
})
|
|
351
376
|
.join(',');
|