@visns-studio/visns-components 6.3.12 → 6.3.14

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.12",
94
+ "version": "6.3.14",
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
- if (ajaxSetting?.rowColours?.length > 0) {
999
- const colorConfig = ajaxSetting.rowColours.find(
1000
- (config) => data[config.id] === config.value
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,19 @@
83
83
  }
84
84
  }
85
85
 
86
+ // A `rowColours` tint arrives as an inline background on the ROW element.
87
+ // The grid's base.css gives the cell-wrap `background: inherit`, which is
88
+ // how the tint normally reaches the eye — but the banding above replaces
89
+ // that with the alternate colour, so on odd rows the stripe swallowed the
90
+ // tint. A tinted row (marked by rowClassName in DataGrid.jsx) restores
91
+ // `inherit` — NOT `transparent`, which would break the inheritance chain
92
+ // the tint travels through. Must stay AFTER the banding rule: same
93
+ // specificity, order decides. Hover is unaffected — its background is
94
+ // `!important` on the hover target.
95
+ .tintedRow :global(.InovuaReactDataGrid__row-cell-wrap) {
96
+ background: inherit;
97
+ }
98
+
86
99
  .InovuaReactDataGrid__row-hover-target:hover {
87
100
  color: var(--primary-color) !important;
88
101
  background: var(--hover-color, rgb(230, 240, 250)) !important;