@ssplib/react-components 0.0.166 → 0.0.167

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.
@@ -284,6 +284,14 @@ function Table({ columns, fetchFunc, emptyMsg = {
284
284
  item = normalize ? item.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : item;
285
285
  return removeQuotes ? `${item}` : `"${item}"`;
286
286
  }
287
+ else if (typeof x[k] === 'object' &&
288
+ !Array.isArray(x[k]) &&
289
+ x[k] !== null) {
290
+ let strItemAsObject = transformArrayObjectInString(x[k]).slice(1, -1); // k: label (Ex.: jsNaturezaEvento)
291
+ let item = csvUpper && !csvExcludeUpper.includes(k) ? strItemAsObject.toUpperCase() : strItemAsObject;
292
+ item = normalize ? item.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : item;
293
+ return removeQuotes ? `${item}` : `"${item}"`;
294
+ }
287
295
  return x[k];
288
296
  })
289
297
  .join(',');
@@ -298,6 +306,27 @@ function Table({ columns, fetchFunc, emptyMsg = {
298
306
  link.click();
299
307
  }
300
308
  }, [list]);
309
+ function transformArrayObjectInString(o) {
310
+ let arrString = [];
311
+ if (typeof o === 'object' &&
312
+ !Array.isArray(o) &&
313
+ o !== null) {
314
+ for (let [key, value] of Object.entries(o)) {
315
+ if (typeof value === 'object' &&
316
+ !Array.isArray(value) &&
317
+ value !== null) {
318
+ arrString.push(key + ": " + transformArrayObjectInString(value));
319
+ }
320
+ else {
321
+ if (value) { // Is true
322
+ arrString.push(key);
323
+ }
324
+ }
325
+ }
326
+ }
327
+ return "[" + arrString.join(' - ') + "]";
328
+ }
329
+ ;
301
330
  const downloadCSVAll = (0, react_1.useCallback)((e) => {
302
331
  e.preventDefault();
303
332
  if (list.length <= 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssplib/react-components",
3
- "version": "0.0.166",
3
+ "version": "0.0.167",
4
4
  "description": "SSP React Components",
5
5
  "main": "index.js",
6
6
  "author": "Pedro Henrique <sr.hudrick@gmail.com>",