@ssplib/react-components 0.0.166 → 0.0.168
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.
|
@@ -242,6 +242,14 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
242
242
|
item = normalize ? item.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : item;
|
|
243
243
|
return removeQuotes ? `${item}` : `"${item}"`;
|
|
244
244
|
}
|
|
245
|
+
else if (typeof x[k] === 'object' &&
|
|
246
|
+
!Array.isArray(x[k]) &&
|
|
247
|
+
x[k] !== null) {
|
|
248
|
+
let strItemAsObject = transformArrayObjectInString(x[k]).slice(1, -1); // k: label (Ex.: jsNaturezaEvento)
|
|
249
|
+
let item = csvUpper && !csvExcludeUpper.includes(k) ? strItemAsObject.toUpperCase() : strItemAsObject;
|
|
250
|
+
item = normalize ? item.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : item;
|
|
251
|
+
return removeQuotes ? `${item}` : `"${item}"`;
|
|
252
|
+
}
|
|
245
253
|
return x[k];
|
|
246
254
|
})
|
|
247
255
|
.join(',');
|
|
@@ -284,6 +292,14 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
284
292
|
item = normalize ? item.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : item;
|
|
285
293
|
return removeQuotes ? `${item}` : `"${item}"`;
|
|
286
294
|
}
|
|
295
|
+
else if (typeof x[k] === 'object' &&
|
|
296
|
+
!Array.isArray(x[k]) &&
|
|
297
|
+
x[k] !== null) {
|
|
298
|
+
let strItemAsObject = transformArrayObjectInString(x[k]).slice(1, -1); // k: label (Ex.: jsNaturezaEvento)
|
|
299
|
+
let item = csvUpper && !csvExcludeUpper.includes(k) ? strItemAsObject.toUpperCase() : strItemAsObject;
|
|
300
|
+
item = normalize ? item.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : item;
|
|
301
|
+
return removeQuotes ? `${item}` : `"${item}"`;
|
|
302
|
+
}
|
|
287
303
|
return x[k];
|
|
288
304
|
})
|
|
289
305
|
.join(',');
|
|
@@ -298,6 +314,27 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
298
314
|
link.click();
|
|
299
315
|
}
|
|
300
316
|
}, [list]);
|
|
317
|
+
function transformArrayObjectInString(o) {
|
|
318
|
+
let arrString = [];
|
|
319
|
+
if (typeof o === 'object' &&
|
|
320
|
+
!Array.isArray(o) &&
|
|
321
|
+
o !== null) {
|
|
322
|
+
for (let [key, value] of Object.entries(o)) {
|
|
323
|
+
if (typeof value === 'object' &&
|
|
324
|
+
!Array.isArray(value) &&
|
|
325
|
+
value !== null) {
|
|
326
|
+
arrString.push(key + ": " + transformArrayObjectInString(value));
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
if (value) { // Is true
|
|
330
|
+
arrString.push(key);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return "[" + arrString.join(' - ') + "]";
|
|
336
|
+
}
|
|
337
|
+
;
|
|
301
338
|
const downloadCSVAll = (0, react_1.useCallback)((e) => {
|
|
302
339
|
e.preventDefault();
|
|
303
340
|
if (list.length <= 0)
|
|
@@ -317,6 +354,14 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
317
354
|
item = normalize ? item.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : item;
|
|
318
355
|
return removeQuotes ? `${item}` : `"${item}"`;
|
|
319
356
|
}
|
|
357
|
+
else if (typeof x[k] === 'object' &&
|
|
358
|
+
!Array.isArray(x[k]) &&
|
|
359
|
+
x[k] !== null) {
|
|
360
|
+
let strItemAsObject = transformArrayObjectInString(x[k]).slice(1, -1); // k: label (Ex.: jsNaturezaEvento)
|
|
361
|
+
let item = csvUpper && !csvExcludeUpper.includes(k) ? strItemAsObject.toUpperCase() : strItemAsObject;
|
|
362
|
+
item = normalize ? item.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : item;
|
|
363
|
+
return removeQuotes ? `${item}` : `"${item}"`;
|
|
364
|
+
}
|
|
320
365
|
return x[k];
|
|
321
366
|
})
|
|
322
367
|
.join(',');
|