@homebound/beam 2.195.0 → 2.196.0
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.
|
@@ -137,6 +137,7 @@ function GridTable(props) {
|
|
|
137
137
|
getCount,
|
|
138
138
|
api,
|
|
139
139
|
cellHighlight: "cellHighlight" in maybeStyle && maybeStyle.cellHighlight === true,
|
|
140
|
+
omitRowHover: "rowHover" in maybeStyle && maybeStyle.rowHover === false,
|
|
140
141
|
...sortProps,
|
|
141
142
|
}), `${row.kind}-${row.id}`));
|
|
142
143
|
}
|
|
@@ -157,7 +158,6 @@ function GridTable(props) {
|
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
function visitRows(rows, level, visible) {
|
|
160
|
-
const length = rows.length;
|
|
161
161
|
rows.forEach((row, i) => {
|
|
162
162
|
if (row[0].kind === "header") {
|
|
163
163
|
headerRows.push([row[0], makeRowComponent(row[0], level)]);
|
|
@@ -61,6 +61,7 @@ export interface GridStyleDef {
|
|
|
61
61
|
cellHighlight?: boolean;
|
|
62
62
|
allWhite?: boolean;
|
|
63
63
|
bordered?: boolean;
|
|
64
|
+
rowHover?: boolean;
|
|
64
65
|
}
|
|
65
66
|
export declare const getTableStyles: (props?: GridStyleDef) => GridStyle;
|
|
66
67
|
/** Defines row-specific styling for each given row `kind` in `R` */
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
function memoizedTableStyles() {
|
|
8
8
|
const cache = {};
|
|
9
9
|
return (props = {}) => {
|
|
10
|
-
const { inlineEditing = false, grouped = false, rowHeight = "flexible", cellHighlight = false, allWhite = false, bordered = false, } = props;
|
|
10
|
+
const { inlineEditing = false, grouped = false, rowHeight = "flexible", cellHighlight = false, allWhite = false, bordered = false, rowHover = true, } = props;
|
|
11
11
|
const key = (0, utils_1.safeKeys)(props)
|
|
12
12
|
.sort()
|
|
13
13
|
.map((k) => `${k}_${props[k]}`)
|
|
@@ -50,6 +50,7 @@ function memoizedTableStyles() {
|
|
|
50
50
|
}),
|
|
51
51
|
presentationSettings: { borderless: true, typeScale: "xs", wrap: rowHeight === "flexible" },
|
|
52
52
|
levels: grouped ? groupedLevels : defaultLevels,
|
|
53
|
+
rowHoverColor: Css_1.Palette.LightBlue100,
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
56
|
return cache[key];
|
|
@@ -114,6 +115,7 @@ function resolveStyles(style) {
|
|
|
114
115
|
"cellHighlight",
|
|
115
116
|
"allWhite",
|
|
116
117
|
"bordered",
|
|
118
|
+
"rowHover",
|
|
117
119
|
];
|
|
118
120
|
const keys = (0, utils_1.safeKeys)(style);
|
|
119
121
|
if (keys.length === 0 || keys.some((k) => defKeys.includes(k))) {
|
|
@@ -33,7 +33,7 @@ const shallowEqual_1 = require("../../../utils/shallowEqual");
|
|
|
33
33
|
// We extract Row to its own mini-component primarily so we can React.memo'ize it.
|
|
34
34
|
function RowImpl(props) {
|
|
35
35
|
var _a;
|
|
36
|
-
const { as, columns, row, style, rowStyles, stickyHeader, stickyOffset, sortOn, sortState, setSortKey, columnSizes, level, getCount, api, cellHighlight, ...others } = props;
|
|
36
|
+
const { as, columns, row, style, rowStyles, stickyHeader, stickyOffset, sortOn, sortState, setSortKey, columnSizes, level, getCount, api, cellHighlight, omitRowHover, ...others } = props;
|
|
37
37
|
const { rowState } = (0, react_1.useContext)(RowState_1.RowStateContext);
|
|
38
38
|
const rowId = `${row.kind}_${row.id}`;
|
|
39
39
|
const isActive = (0, hooks_1.useComputed)(() => rowState.activeRowId === rowId, [rowId, rowState]);
|
|
@@ -45,12 +45,15 @@ function RowImpl(props) {
|
|
|
45
45
|
const revealOnRowHoverClass = "revealOnRowHover";
|
|
46
46
|
const rowStyleCellCss = (0, utils_1.maybeApplyFunction)(row, rowStyle === null || rowStyle === void 0 ? void 0 : rowStyle.cellCss);
|
|
47
47
|
const rowCss = {
|
|
48
|
-
//
|
|
49
|
-
...(
|
|
50
|
-
...(((rowStyle === null || rowStyle === void 0 ? void 0 : rowStyle.rowLink) || (rowStyle === null || rowStyle === void 0 ? void 0 : rowStyle.onClick)) && {
|
|
48
|
+
// Optionally include the row hover styles, by default they should be turned on.
|
|
49
|
+
...(!omitRowHover && {
|
|
51
50
|
// Even though backgroundColor is set on the cellCss, the hover target is the row.
|
|
52
|
-
"&:hover > *": Css_1.Css.
|
|
51
|
+
"&:hover > *": Css_1.Css.bgColor((_a = style.rowHoverColor) !== null && _a !== void 0 ? _a : Css_1.Palette.LightBlue100).$,
|
|
53
52
|
}),
|
|
53
|
+
// For virtual tables use `display: flex` to keep all cells on the same row. For each cell in the row use `flexNone` to ensure they stay their defined widths
|
|
54
|
+
...(as === "table" ? {} : Css_1.Css.relative.df.fg1.fs1.addIn("&>*", Css_1.Css.flexNone.$).$),
|
|
55
|
+
// Apply `cursorPointer` to the row if it has a link or `onClick` value.
|
|
56
|
+
...(((rowStyle === null || rowStyle === void 0 ? void 0 : rowStyle.rowLink) || (rowStyle === null || rowStyle === void 0 ? void 0 : rowStyle.onClick)) && { "&:hover": Css_1.Css.cursorPointer.$ }),
|
|
54
57
|
...(0, utils_1.maybeApplyFunction)(row, rowStyle === null || rowStyle === void 0 ? void 0 : rowStyle.rowCss),
|
|
55
58
|
// Maybe add the sticky header styles
|
|
56
59
|
...((isHeader || isTotals) && stickyHeader ? Css_1.Css.sticky.topPx(stickyOffset).z2.$ : undefined),
|