@visns-studio/visns-components 6.3.12 → 6.3.13
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
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
92
92
|
},
|
|
93
93
|
"name": "@visns-studio/visns-components",
|
|
94
|
-
"version": "6.3.
|
|
94
|
+
"version": "6.3.13",
|
|
95
95
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
96
96
|
"main": "src/index.js",
|
|
97
97
|
"files": [
|
|
@@ -976,6 +976,19 @@ const DataGrid = forwardRef(
|
|
|
976
976
|
},
|
|
977
977
|
}));
|
|
978
978
|
|
|
979
|
+
// First matching `rowColours` rule for a row, shared by getRowStyle
|
|
980
|
+
// (which paints it) and rowClassName (which marks the row so the
|
|
981
|
+
// zebra banding stands down — see .tintedRow in the module styles).
|
|
982
|
+
const findRowColour = useCallback(
|
|
983
|
+
(data) =>
|
|
984
|
+
ajaxSetting?.rowColours?.length > 0 && data
|
|
985
|
+
? ajaxSetting.rowColours.find(
|
|
986
|
+
(config) => data[config.id] === config.value
|
|
987
|
+
)
|
|
988
|
+
: undefined,
|
|
989
|
+
[ajaxSetting]
|
|
990
|
+
);
|
|
991
|
+
|
|
979
992
|
const getRowStyle = useCallback(
|
|
980
993
|
(rowProps) => {
|
|
981
994
|
const { data } = rowProps;
|
|
@@ -995,19 +1008,14 @@ const DataGrid = forwardRef(
|
|
|
995
1008
|
style.fontWeight = 600;
|
|
996
1009
|
}
|
|
997
1010
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
);
|
|
1002
|
-
|
|
1003
|
-
if (colorConfig) {
|
|
1004
|
-
style.backgroundColor = colorConfig.colour;
|
|
1005
|
-
}
|
|
1011
|
+
const colorConfig = findRowColour(data);
|
|
1012
|
+
if (colorConfig) {
|
|
1013
|
+
style.backgroundColor = colorConfig.colour;
|
|
1006
1014
|
}
|
|
1007
1015
|
|
|
1008
1016
|
return Object.keys(style).length > 0 ? style : null;
|
|
1009
1017
|
},
|
|
1010
|
-
[ajaxSetting]
|
|
1018
|
+
[ajaxSetting, findRowColour]
|
|
1011
1019
|
);
|
|
1012
1020
|
|
|
1013
1021
|
/**
|
|
@@ -1104,10 +1112,14 @@ const DataGrid = forwardRef(
|
|
|
1104
1112
|
'vs-datagrid--row',
|
|
1105
1113
|
treeRowClassName(rowProps?.data),
|
|
1106
1114
|
getRowClassName(rowProps),
|
|
1115
|
+
// A rowColours tint is an inline background on the row
|
|
1116
|
+
// element; the class lets the stylesheet clear the zebra
|
|
1117
|
+
// band that would otherwise paint over it on odd rows.
|
|
1118
|
+
findRowColour(rowProps?.data) ? styles.tintedRow : '',
|
|
1107
1119
|
]
|
|
1108
1120
|
.filter(Boolean)
|
|
1109
1121
|
.join(' '),
|
|
1110
|
-
[getRowClassName, treeRowClassName]
|
|
1122
|
+
[getRowClassName, treeRowClassName, findRowColour]
|
|
1111
1123
|
);
|
|
1112
1124
|
|
|
1113
1125
|
const handleDownload = async (d) => {
|
|
@@ -83,6 +83,17 @@
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
// A `rowColours` tint arrives as an inline background on the ROW element,
|
|
87
|
+
// but the banding above paints the cell-wrap CHILD, which sits on top — so
|
|
88
|
+
// on odd rows the stripe swallowed the tint and only even rows showed their
|
|
89
|
+
// urgency colour. A tinted row (marked by rowClassName in DataGrid.jsx)
|
|
90
|
+
// clears its cell-wrap so the row's own colour reads on every row. Must
|
|
91
|
+
// stay AFTER the banding rule: same specificity, order decides. Hover is
|
|
92
|
+
// unaffected — its background is `!important` on the hover target.
|
|
93
|
+
.tintedRow :global(.InovuaReactDataGrid__row-cell-wrap) {
|
|
94
|
+
background: transparent;
|
|
95
|
+
}
|
|
96
|
+
|
|
86
97
|
.InovuaReactDataGrid__row-hover-target:hover {
|
|
87
98
|
color: var(--primary-color) !important;
|
|
88
99
|
background: var(--hover-color, rgb(230, 240, 250)) !important;
|