@homebound/beam 2.354.5 → 2.355.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.
|
@@ -53,7 +53,11 @@ export interface GridStyle {
|
|
|
53
53
|
rowIndent?: number;
|
|
54
54
|
cellCss?: Properties;
|
|
55
55
|
firstContentColumn?: Properties;
|
|
56
|
-
}
|
|
56
|
+
}> | ((level: number) => {
|
|
57
|
+
rowIndent?: number;
|
|
58
|
+
cellCss?: Properties;
|
|
59
|
+
firstContentColumn?: Properties;
|
|
60
|
+
});
|
|
57
61
|
/** Allows for customization of the background color used to denote an "active" row */
|
|
58
62
|
activeBgColor?: Palette;
|
|
59
63
|
/** Defines styles for the group row which holds the selected rows that have been filtered out */
|
|
@@ -102,10 +102,8 @@ exports.cardStyle = {
|
|
|
102
102
|
},
|
|
103
103
|
rowHoverColor: "none",
|
|
104
104
|
nonHeaderRowHoverCss: Css_1.Css.bshHover.bcGray700.$,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
2: { rowIndent: 48 },
|
|
108
|
-
},
|
|
105
|
+
// this will allow having N amount of nested childs without having to define each level margin
|
|
106
|
+
levels: (level) => ({ rowIndent: level > 0 ? 24 * level : undefined }),
|
|
109
107
|
};
|
|
110
108
|
function resolveStyles(style) {
|
|
111
109
|
const defKeysRecord = {
|
|
@@ -15,7 +15,7 @@ const utils_2 = require("../../../utils");
|
|
|
15
15
|
const use_debounce_1 = require("use-debounce");
|
|
16
16
|
// We extract Row to its own mini-component primarily so we can React.memo'ize it.
|
|
17
17
|
function RowImpl(props) {
|
|
18
|
-
var _a, _b
|
|
18
|
+
var _a, _b;
|
|
19
19
|
const { as, rs, style, rowStyles, columnSizes, getCount, cellHighlight, omitRowHover, hasExpandableHeader, onDragStart, onDragEnd, onDrop, onDragEnter, onDragOver, ...others } = props;
|
|
20
20
|
const { tableState } = (0, react_1.useContext)(TableState_1.TableStateContext);
|
|
21
21
|
// We're wrapped in observer, so can access these without useComputeds
|
|
@@ -32,7 +32,8 @@ function RowImpl(props) {
|
|
|
32
32
|
const revealOnRowHoverClass = "revealOnRowHover";
|
|
33
33
|
const showRowHoverColor = !utils_1.reservedRowKinds.includes(row.kind) && !omitRowHover && style.rowHoverColor !== "none";
|
|
34
34
|
const rowStyleCellCss = (0, utils_1.maybeApplyFunction)(row, rowStyle === null || rowStyle === void 0 ? void 0 : rowStyle.cellCss);
|
|
35
|
-
const
|
|
35
|
+
const levelStyle = style.levels && (typeof style.levels === "function" ? style.levels(level) : style.levels[level]);
|
|
36
|
+
const levelIndent = levelStyle === null || levelStyle === void 0 ? void 0 : levelStyle.rowIndent;
|
|
36
37
|
const containerCss = {
|
|
37
38
|
...Css_1.Css.add("transition", "padding 0.25s ease-in-out").$,
|
|
38
39
|
...(rs.isDraggedOver === RowState_1.DraggedOver.Above && Css_1.Css.ptPx(25).$),
|
|
@@ -43,7 +44,7 @@ function RowImpl(props) {
|
|
|
43
44
|
// Optionally include the row hover styles, by default they should be turned on.
|
|
44
45
|
...(showRowHoverColor && {
|
|
45
46
|
// Even though backgroundColor is set on the cellCss, the hover target is the row.
|
|
46
|
-
"&:hover > *": Css_1.Css.bgColor((
|
|
47
|
+
"&:hover > *": Css_1.Css.bgColor((_b = style.rowHoverColor) !== null && _b !== void 0 ? _b : Css_1.Palette.Blue100).$,
|
|
47
48
|
}),
|
|
48
49
|
...(!utils_1.reservedRowKinds.includes(row.kind) &&
|
|
49
50
|
style.nonHeaderRowHoverCss && {
|
|
@@ -75,7 +76,7 @@ function RowImpl(props) {
|
|
|
75
76
|
// when the event is not called, we still need to call preventDefault
|
|
76
77
|
const onDragOverDebounced = (0, use_debounce_1.useDebouncedCallback)(dragOverCallback, 100);
|
|
77
78
|
const RowContent = () => ((0, jsx_runtime_1.jsx)(RowTag, { css: rowCss, ...others, "data-gridrow": true, ...getCount(row.id), ref: ref, children: isKeptGroupRow ? ((0, jsx_runtime_1.jsx)(KeptGroupRow_1.KeptGroupRow, { as: as, style: style, columnSizes: columnSizes, row: row, colSpan: columns.length })) : (columns.map((column, columnIndex) => {
|
|
78
|
-
var _a, _b
|
|
79
|
+
var _a, _b;
|
|
79
80
|
// If the expandable column was hidden, then we need to look at the previous column to format the `expandHeader` and 'header' kinds correctly.
|
|
80
81
|
const maybeExpandedColumn = expandColumnHidden ? columns[columnIndex - 1] : column;
|
|
81
82
|
// Figure out if this column should be considered 'expanded' or not. If the column is hidden on expand, then we need to look at the previous column to see if it's expanded.
|
|
@@ -197,13 +198,13 @@ function RowImpl(props) {
|
|
|
197
198
|
currentExpandedColumnCount === 0 &&
|
|
198
199
|
Css_1.Css.boxShadow(`inset -1px -1px 0 ${Css_1.Palette.Gray200}`).$),
|
|
199
200
|
// Or level-specific styling
|
|
200
|
-
...(!isHeader && !isTotals && !isExpandableHeader &&
|
|
201
|
+
...(!isHeader && !isTotals && !isExpandableHeader && (levelStyle === null || levelStyle === void 0 ? void 0 : levelStyle.cellCss)),
|
|
201
202
|
// Level specific styling for the first content column
|
|
202
|
-
...(applyFirstContentColumnStyles &&
|
|
203
|
+
...(applyFirstContentColumnStyles && (levelStyle === null || levelStyle === void 0 ? void 0 : levelStyle.firstContentColumn)),
|
|
203
204
|
// The specific cell's css (if any from GridCellContent)
|
|
204
205
|
...rowStyleCellCss,
|
|
205
206
|
// Apply active row styling for non-nested card styles.
|
|
206
|
-
...(isActive ? Css_1.Css.bgColor((
|
|
207
|
+
...(isActive ? Css_1.Css.bgColor((_b = style.activeBgColor) !== null && _b !== void 0 ? _b : Css_1.Palette.Blue50).$ : {}),
|
|
207
208
|
// Add any cell specific style overrides
|
|
208
209
|
...((0, utils_1.isGridCellContent)(maybeContent) && maybeContent.typeScale ? Css_1.Css[maybeContent.typeScale].$ : {}),
|
|
209
210
|
// And any cell specific css
|