@visns-studio/visns-components 1.1.5 → 1.1.7

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.
@@ -365,9 +365,17 @@ const DataGrid = (props) => {
365
365
  ? column.width
366
366
  : undefined,
367
367
  render: ({ data }) => {
368
- let value = data.audits[0].user.name;
368
+ if (
369
+ data.audits[0] &&
370
+ data.audits[0].user &&
371
+ data.audits[0].user.name
372
+ ) {
373
+ let value = data.audits[0].user.name;
369
374
 
370
- return <span>{value}</span>;
375
+ return <span>{value}</span>;
376
+ } else {
377
+ return null;
378
+ }
371
379
  },
372
380
  };
373
381
  case "currency":
@@ -385,8 +393,11 @@ const DataGrid = (props) => {
385
393
  data = numeral(data[column.id]).format(
386
394
  "$0,0.00"
387
395
  );
396
+
397
+ return <span>{data}</span>;
398
+ } else {
399
+ return null;
388
400
  }
389
- return <span>{data}</span>;
390
401
  },
391
402
  };
392
403
  case "date":
@@ -404,8 +415,11 @@ const DataGrid = (props) => {
404
415
  data = moment(data[column.id]).format(
405
416
  column.format ? column.format : "DD-MM-YYYY"
406
417
  );
418
+
419
+ return <span>{data}</span>;
420
+ } else {
421
+ return null;
407
422
  }
408
- return <span>{data}</span>;
409
423
  },
410
424
  };
411
425
  case "datetime":
@@ -425,8 +439,11 @@ const DataGrid = (props) => {
425
439
  ? column.format
426
440
  : "DD-MM-YYYY hh:mm A"
427
441
  );
442
+
443
+ return <span>{data}</span>;
444
+ } else {
445
+ return null;
428
446
  }
429
- return <span>{data}</span>;
430
447
  },
431
448
  };
432
449
  case "file":
@@ -533,10 +550,17 @@ const DataGrid = (props) => {
533
550
  : undefined,
534
551
  link: column.link ? column.link : {},
535
552
  render: ({ data }) => {
536
- if (data) {
553
+ if (
554
+ data &&
555
+ column.options &&
556
+ column.options[data[column.id]]
557
+ ) {
537
558
  data = column.options[data[column.id]];
559
+
560
+ return <span>{data}</span>;
561
+ } else {
562
+ return null;
538
563
  }
539
- return <span>{data}</span>;
540
564
  },
541
565
  };
542
566
  case "placeholder":
@@ -628,8 +652,11 @@ const DataGrid = (props) => {
628
652
  data = moment(data[column.id]).format(
629
653
  column.format ? column.format : "hh:mm A"
630
654
  );
655
+
656
+ return <span>{data}</span>;
657
+ } else {
658
+ return null;
631
659
  }
632
- return <span>{data}</span>;
633
660
  },
634
661
  };
635
662
  case "url":
@@ -643,13 +670,17 @@ const DataGrid = (props) => {
643
670
  : undefined,
644
671
  link: column.link ? column.link : {},
645
672
  render: ({ data }) => {
646
- return (
647
- <span>
648
- <a href={data} target="_blank">
649
- Link
650
- </a>
651
- </span>
652
- );
673
+ if (data) {
674
+ return (
675
+ <span>
676
+ <a href={data} target="_blank">
677
+ Link
678
+ </a>
679
+ </span>
680
+ );
681
+ } else {
682
+ return null;
683
+ }
653
684
  },
654
685
  };
655
686
  default:
package/package.json CHANGED
@@ -32,7 +32,7 @@
32
32
  "react-dom": ">=18.2.0"
33
33
  },
34
34
  "name": "@visns-studio/visns-components",
35
- "version": "1.1.5",
35
+ "version": "1.1.7",
36
36
  "description": "Various packages to assist in the development of our Custom Applications.",
37
37
  "main": "index.js",
38
38
  "devDependencies": {},