@homebound/beam 2.247.0 → 2.248.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.
|
@@ -72,11 +72,27 @@ function RowImpl(props) {
|
|
|
72
72
|
let currentExpandedColumnCount = 0;
|
|
73
73
|
let firstContentColumnStylesApplied = false;
|
|
74
74
|
let minStickyLeftOffset = 0;
|
|
75
|
+
let expandColumnHidden = false;
|
|
75
76
|
return ((0, jsx_runtime_1.jsx)(RowTag, { css: rowCss, ...others, "data-gridrow": true, ...getCount(row.id), children: columns.map((column, columnIndex) => {
|
|
76
|
-
var _a, _b, _c, _d, _e
|
|
77
|
+
var _a, _b, _c, _d, _e;
|
|
78
|
+
// If the expandable column was hidden, then we need to look at the previous column to format the `expandHeader` and 'header' kinds correctly.
|
|
79
|
+
const maybeExpandedColumn = expandColumnHidden ? columns[columnIndex - 1] : column;
|
|
80
|
+
// 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.
|
|
81
|
+
const isExpanded = tableState.expandedColumnIds.includes(maybeExpandedColumn.id);
|
|
82
|
+
// If the column is hidden on expand, we don't want to render it. We'll flag that it was hidden, so on the next column we can render this column's "expandHeader" property.
|
|
83
|
+
if (column.hideOnExpand && isExpanded) {
|
|
84
|
+
expandColumnHidden = true;
|
|
85
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
86
|
+
}
|
|
77
87
|
// Need to keep track of the expanded columns so we can add borders as expected for the header rows
|
|
78
|
-
const
|
|
79
|
-
|
|
88
|
+
const numExpandedColumns = isExpanded
|
|
89
|
+
? ((_a = tableState.getExpandedColumns(maybeExpandedColumn)) === null || _a === void 0 ? void 0 : _a.length)
|
|
90
|
+
? // Subtract 1 if the column is hidden on expand, since we're not rendering it.
|
|
91
|
+
tableState.getExpandedColumns(maybeExpandedColumn).length - (maybeExpandedColumn.hideOnExpand ? 1 : 0)
|
|
92
|
+
: 0
|
|
93
|
+
: 0;
|
|
94
|
+
// If we're rendering the Expandable Header row, then we might need to render the previous column's `expandHeader` property in the case where the column is hidden on expand.
|
|
95
|
+
column = isExpandableHeader ? maybeExpandedColumn : column;
|
|
80
96
|
const { wrapAction = true, isAction = false } = column;
|
|
81
97
|
const applyFirstContentColumnStyles = !isHeader && !isAction && !firstContentColumnStylesApplied;
|
|
82
98
|
firstContentColumnStylesApplied || (firstContentColumnStylesApplied = applyFirstContentColumnStyles);
|
|
@@ -99,6 +115,8 @@ function RowImpl(props) {
|
|
|
99
115
|
currentExpandedColumnCount -= 1;
|
|
100
116
|
}
|
|
101
117
|
}
|
|
118
|
+
// Reset the expandColumnHidden flag once done with logic based upon it.
|
|
119
|
+
expandColumnHidden = false;
|
|
102
120
|
// Decrement colspan count and skip if greater than 1.
|
|
103
121
|
if (currentColspan > 1) {
|
|
104
122
|
currentColspan -= 1;
|
|
@@ -122,7 +140,7 @@ function RowImpl(props) {
|
|
|
122
140
|
column.expandedWidth !== undefined;
|
|
123
141
|
const content = (0, utils_1.toContent)(maybeContent, isHeader, canSortColumn, sortOn === "client", style, as, alignment, column, isExpandableHeader, isExpandable, minStickyLeftOffset);
|
|
124
142
|
(0, sortRows_1.ensureClientSideSortValueIsSortable)(sortOn, isHeader || isTotals || isExpandableHeader, column, columnIndex, maybeContent);
|
|
125
|
-
const maybeSticky = (
|
|
143
|
+
const maybeSticky = (_b = (((0, utils_1.isGridCellContent)(maybeContent) && maybeContent.sticky) || column.sticky)) !== null && _b !== void 0 ? _b : undefined;
|
|
126
144
|
const maybeStickyColumnStyles = maybeSticky && columnSizes
|
|
127
145
|
? {
|
|
128
146
|
...Css_1.Css.sticky.z(utils_1.zIndices.stickyColumns).bgWhite.$,
|
|
@@ -177,13 +195,13 @@ function RowImpl(props) {
|
|
|
177
195
|
currentExpandedColumnCount === 0 &&
|
|
178
196
|
Css_1.Css.boxShadow(`inset -1px -1px 0 ${Css_1.Palette.Gray200}`).$),
|
|
179
197
|
// Or level-specific styling
|
|
180
|
-
...(!isHeader && !isTotals && !isExpandableHeader && !!style.levels && ((
|
|
198
|
+
...(!isHeader && !isTotals && !isExpandableHeader && !!style.levels && ((_c = style.levels[level]) === null || _c === void 0 ? void 0 : _c.cellCss)),
|
|
181
199
|
// Level specific styling for the first content column
|
|
182
|
-
...(applyFirstContentColumnStyles && !!style.levels && ((
|
|
200
|
+
...(applyFirstContentColumnStyles && !!style.levels && ((_d = style.levels[level]) === null || _d === void 0 ? void 0 : _d.firstContentColumn)),
|
|
183
201
|
// The specific cell's css (if any from GridCellContent)
|
|
184
202
|
...rowStyleCellCss,
|
|
185
203
|
// Apply active row styling for non-nested card styles.
|
|
186
|
-
...(isActive ? Css_1.Css.bgColor((
|
|
204
|
+
...(isActive ? Css_1.Css.bgColor((_e = style.activeBgColor) !== null && _e !== void 0 ? _e : Css_1.Palette.LightBlue50).$ : {}),
|
|
187
205
|
// Add any cell specific style overrides
|
|
188
206
|
...((0, utils_1.isGridCellContent)(maybeContent) && maybeContent.typeScale ? Css_1.Css[maybeContent.typeScale].$ : {}),
|
|
189
207
|
// And any cell specific css
|
|
@@ -82,6 +82,8 @@ export type GridColumn<R extends Kinded> = {
|
|
|
82
82
|
expandColumns?: GridColumn<R>[] | (() => Promise<GridColumn<R>[]>);
|
|
83
83
|
/** Determines whether the group should initially be expanded on load of the table */
|
|
84
84
|
initExpanded?: boolean;
|
|
85
|
+
/** Determines whether this column should be hidden when expanded (only the 'expandColumns' would show) */
|
|
86
|
+
hideOnExpand?: boolean;
|
|
85
87
|
};
|
|
86
88
|
export type GridColumnWithId<R extends Kinded> = GridColumn<R> & {
|
|
87
89
|
id: string;
|