@visns-studio/visns-components 1.1.18 → 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.
|
@@ -60,6 +60,7 @@ const DataGrid = (props) => {
|
|
|
60
60
|
form,
|
|
61
61
|
columns,
|
|
62
62
|
settings,
|
|
63
|
+
style,
|
|
63
64
|
tableFilters,
|
|
64
65
|
historySearch,
|
|
65
66
|
historyUrl,
|
|
@@ -105,7 +106,6 @@ const DataGrid = (props) => {
|
|
|
105
106
|
[ajaxSetting, dataReload, dSearch]
|
|
106
107
|
);
|
|
107
108
|
const [gridColumns, setGridColumns] = useState([]);
|
|
108
|
-
const [gridHeight, setGridHeight] = useState(550);
|
|
109
109
|
const limit = ajaxSetting.take || 10;
|
|
110
110
|
const [search, setSearch] = useState("");
|
|
111
111
|
const sortInfo =
|
|
@@ -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,
|
|
@@ -741,15 +787,7 @@ const DataGrid = (props) => {
|
|
|
741
787
|
minHeight: windowHeight * 0.6 > 550 ? windowHeight * 0.6 : 550,
|
|
742
788
|
};
|
|
743
789
|
const headerProps = {
|
|
744
|
-
style: {
|
|
745
|
-
color: import.meta.env.VITE_VISNS_COMPONENT_HEADER_STYLE_COLOR
|
|
746
|
-
? import.meta.env.VITE_VISNS_COMPONENT_HEADER_STYLE_COLOR
|
|
747
|
-
: null,
|
|
748
|
-
background: import.meta.env
|
|
749
|
-
.VITE_VISNS_COMPONENT_HEADER_STYLE_BACKGROUND
|
|
750
|
-
? import.meta.env.VITE_VISNS_COMPONENT_HEADER_STYLE_BACKGROUND
|
|
751
|
-
: null,
|
|
752
|
-
},
|
|
790
|
+
style: style ? style : {},
|
|
753
791
|
};
|
|
754
792
|
|
|
755
793
|
useEffect(() => {
|
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.
|
|
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": {},
|