@visns-studio/visns-components 1.1.19 → 1.1.20

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.
@@ -621,6 +621,52 @@ const DataGrid = (props) => {
621
621
  }
622
622
  },
623
623
  };
624
+ case "relationArray":
625
+ let relationArrayName = column.id.reduce(
626
+ (acc, id) => acc + `${id}.`,
627
+ ""
628
+ );
629
+ relationArrayName += column.nameFrom;
630
+
631
+ return {
632
+ name: relationArrayName,
633
+ header: column.label,
634
+ defaultFlex: 1,
635
+ minWidth:
636
+ column.width && column.width > 0
637
+ ? column.width
638
+ : undefined,
639
+ link: column.link ? column.link : {},
640
+ render: ({ data }) => {
641
+ let relationValue = column.id.reduce((acc, id) => {
642
+ if (acc === "") {
643
+ return data[id];
644
+ } else {
645
+ return acc[id];
646
+ }
647
+ }, "");
648
+
649
+ if (relationValue) {
650
+ if (Array.isArray(relationValue)) {
651
+ let value = '';
652
+
653
+ relationValue.forEach((rv, rvKey) => {
654
+ if ( rvKey > 0 ) {
655
+ value += ', ';
656
+ }
657
+
658
+ value += rv[column.nameFrom];
659
+ });
660
+
661
+ return <span>{value}</span>;
662
+ } else {
663
+ return null;
664
+ }
665
+ } else {
666
+ return null;
667
+ }
668
+ },
669
+ };
624
670
  case "stage":
625
671
  return {
626
672
  name: column.id,
package/package.json CHANGED
@@ -33,7 +33,7 @@
33
33
  "react-dom": ">=18.2.0"
34
34
  },
35
35
  "name": "@visns-studio/visns-components",
36
- "version": "1.1.19",
36
+ "version": "1.1.20",
37
37
  "description": "Various packages to assist in the development of our Custom Applications.",
38
38
  "main": "index.js",
39
39
  "devDependencies": {},