@visns-studio/visns-components 5.2.8 → 5.2.9

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.
package/package.json CHANGED
@@ -78,7 +78,7 @@
78
78
  "react-dom": "^17.0.0 || ^18.0.0"
79
79
  },
80
80
  "name": "@visns-studio/visns-components",
81
- "version": "5.2.8",
81
+ "version": "5.2.9",
82
82
  "description": "Various packages to assist in the development of our Custom Applications.",
83
83
  "main": "src/index.js",
84
84
  "files": [
@@ -675,18 +675,37 @@ const DataGrid = forwardRef(
675
675
  if (column.id !== '__checkbox-column') {
676
676
  if (column.link && column.link.hasOwnProperty('url')) {
677
677
  if (column.link.url) {
678
+ // Helper function to safely retrieve nested values
679
+ const getNestedValue = (obj, key) =>
680
+ key
681
+ .split('.')
682
+ .reduce(
683
+ (acc, part) =>
684
+ acc ? acc[part] : undefined,
685
+ obj
686
+ );
687
+
678
688
  const fileRelationArray = column.id.split('.');
679
689
  const linkUrl = column.link.url;
680
690
  const linkKey =
681
691
  rowProps.columns[columnIndex].link.key;
682
- const rowData = rowProps.data[linkKey];
692
+ const rowData = getNestedValue(
693
+ rowProps.data,
694
+ linkKey
695
+ );
683
696
 
684
697
  if (column.link.hasOwnProperty('folder')) {
685
698
  const linkFolder =
686
699
  rowProps.columns[columnIndex].link
687
700
  .folder;
688
701
 
689
- if (rowProps.data[fileRelationArray[0]]) {
702
+ // Adjusted to use the nested value for checking the file relation
703
+ if (
704
+ getNestedValue(
705
+ rowProps.data,
706
+ fileRelationArray[0]
707
+ )
708
+ ) {
690
709
  if (linkFolder !== '') {
691
710
  window.open(
692
711
  `${linkUrl}${rowData}/${linkFolder}`