@homebound/beam 4.46.1 → 4.47.1
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/dist/index.cjs +307 -127
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -19
- package/dist/index.d.ts +55 -19
- package/dist/index.js +1296 -1125
- package/dist/index.js.map +1 -1
- package/dist/truss.css +10 -10
- package/dist/utils/rtlUtils.cjs +10 -6
- package/dist/utils/rtlUtils.cjs.map +1 -1
- package/dist/utils/rtlUtils.js +10 -6
- package/dist/utils/rtlUtils.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -245,6 +245,7 @@ __export(index_exports, {
|
|
|
245
245
|
actionColumn: () => actionColumn,
|
|
246
246
|
applyRowFn: () => applyRowFn,
|
|
247
247
|
assignDefaultColumnIds: () => assignDefaultColumnIds,
|
|
248
|
+
beamCollapseColumnId: () => beamCollapseColumnId,
|
|
248
249
|
beamEnvironmentBannerLayoutHeightVar: () => beamEnvironmentBannerLayoutHeightVar,
|
|
249
250
|
beamFloatingRightOffsetVar: () => beamFloatingRightOffsetVar,
|
|
250
251
|
beamLayoutContentPaddingXVar: () => beamLayoutContentPaddingXVar,
|
|
@@ -255,6 +256,7 @@ __export(index_exports, {
|
|
|
255
256
|
beamPageHeaderLayoutHeightVar: () => beamPageHeaderLayoutHeightVar,
|
|
256
257
|
beamRightPaneContentMinVar: () => beamRightPaneContentMinVar,
|
|
257
258
|
beamRightPaneWidthVar: () => beamRightPaneWidthVar,
|
|
259
|
+
beamSelectColumnId: () => beamSelectColumnId,
|
|
258
260
|
beamSideNavLayoutWidthVar: () => beamSideNavLayoutWidthVar,
|
|
259
261
|
beamTableActionsHeightVar: () => beamTableActionsHeightVar,
|
|
260
262
|
beamWorkflowLayoutFooterHeightVar: () => beamWorkflowLayoutFooterHeightVar,
|
|
@@ -299,7 +301,9 @@ __export(index_exports, {
|
|
|
299
301
|
chipHoverOnlyStyles: () => chipHoverOnlyStyles,
|
|
300
302
|
chipHoverStyles: () => chipHoverStyles,
|
|
301
303
|
collapseColumn: () => collapseColumn,
|
|
304
|
+
collapseTogglePx: () => collapseTogglePx,
|
|
302
305
|
column: () => column,
|
|
306
|
+
columnWidthKeyVersion: () => columnWidthKeyVersion,
|
|
303
307
|
condensedStyle: () => condensedStyle,
|
|
304
308
|
contrastDataTheme: () => contrastDataTheme,
|
|
305
309
|
createRowLookup: () => createRowLookup,
|
|
@@ -327,6 +331,7 @@ __export(index_exports, {
|
|
|
327
331
|
fieldCell: () => fieldCell,
|
|
328
332
|
fieldColumn: () => fieldColumn,
|
|
329
333
|
filterTestIdPrefix: () => filterTestIdPrefix,
|
|
334
|
+
firstContentControlPx: () => firstContentControlPx,
|
|
330
335
|
formatDate: () => formatDate,
|
|
331
336
|
formatDateRange: () => formatDateRange,
|
|
332
337
|
formatPlainDate: () => formatPlainDate,
|
|
@@ -357,6 +362,7 @@ __export(index_exports, {
|
|
|
357
362
|
isListBoxSection: () => isListBoxSection,
|
|
358
363
|
isPersistentItem: () => isPersistentItem,
|
|
359
364
|
isPersistentKey: () => isPersistentKey,
|
|
365
|
+
isRowControlColumn: () => isRowControlColumn,
|
|
360
366
|
isValidDate: () => isValidDate,
|
|
361
367
|
joinDocumentTitleSegments: () => joinDocumentTitleSegments,
|
|
362
368
|
layoutGutterLeftColumnId: () => layoutGutterLeftColumnId,
|
|
@@ -395,6 +401,7 @@ __export(index_exports, {
|
|
|
395
401
|
rightPaneOpenActions: () => rightPaneOpenActions,
|
|
396
402
|
rightPaneOpenStore: () => rightPaneOpenStore,
|
|
397
403
|
rowClickRenderFn: () => rowClickRenderFn,
|
|
404
|
+
rowControlColumns: () => rowControlColumns,
|
|
398
405
|
rowLinkRenderFn: () => rowLinkRenderFn,
|
|
399
406
|
selectColumn: () => selectColumn,
|
|
400
407
|
setDefaultStyle: () => setDefaultStyle,
|
|
@@ -403,6 +410,7 @@ __export(index_exports, {
|
|
|
403
410
|
setRunningInJest: () => setRunningInJest,
|
|
404
411
|
shouldShowEnvironmentBanner: () => shouldShowEnvironmentBanner,
|
|
405
412
|
shouldSkipScrollTo: () => shouldSkipScrollTo,
|
|
413
|
+
showsCollapseToggle: () => showsCollapseToggle,
|
|
406
414
|
simpleDataRows: () => simpleDataRows,
|
|
407
415
|
simpleGroupHeader: () => simpleGroupHeader,
|
|
408
416
|
simpleHeader: () => simpleHeader,
|
|
@@ -417,6 +425,7 @@ __export(index_exports, {
|
|
|
417
425
|
switchHoverStyles: () => switchHoverStyles,
|
|
418
426
|
switchSelectedHoverStyles: () => switchSelectedHoverStyles,
|
|
419
427
|
toContent: () => toContent,
|
|
428
|
+
toLayoutColumns: () => toLayoutColumns,
|
|
420
429
|
toLimitAndOffset: () => toLimitAndOffset,
|
|
421
430
|
toPageNumberSize: () => toPageNumberSize,
|
|
422
431
|
toggleFilter: () => toggleFilter,
|
|
@@ -6973,38 +6982,14 @@ function memoizedTableStyles() {
|
|
|
6973
6982
|
}]
|
|
6974
6983
|
}
|
|
6975
6984
|
},
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
fontSize: "fz_14px",
|
|
6980
|
-
lineHeight: "lh_20px"
|
|
6981
|
-
},
|
|
6982
|
-
...allWhite && {
|
|
6983
|
-
fontWeight: "fw6",
|
|
6984
|
-
fontSize: "fz_14px",
|
|
6985
|
-
lineHeight: "lh_20px",
|
|
6985
|
+
// Hierarchy type and indent are applied per row. All-white group rows keep a primary label color.
|
|
6986
|
+
...allWhite ? {
|
|
6987
|
+
firstContentColumn: {
|
|
6986
6988
|
color: ["color_var", {
|
|
6987
6989
|
"--color": "var(--b-on-surface)"
|
|
6988
6990
|
}]
|
|
6989
6991
|
}
|
|
6990
|
-
}
|
|
6991
|
-
},
|
|
6992
|
-
2: {
|
|
6993
|
-
firstContentColumn: {
|
|
6994
|
-
fontWeight: "fw4",
|
|
6995
|
-
fontSize: "fz_12px",
|
|
6996
|
-
lineHeight: "lh_16px",
|
|
6997
|
-
paddingLeft: "pl3"
|
|
6998
|
-
}
|
|
6999
|
-
},
|
|
7000
|
-
// Add 12 more pixels of padding for each level of nesting
|
|
7001
|
-
3: {
|
|
7002
|
-
firstContentColumn: {
|
|
7003
|
-
fontWeight: "fw4",
|
|
7004
|
-
fontSize: "fz_12px",
|
|
7005
|
-
lineHeight: "lh_16px",
|
|
7006
|
-
paddingLeft: "pl_36px"
|
|
7007
|
-
}
|
|
6992
|
+
} : {}
|
|
7008
6993
|
}
|
|
7009
6994
|
};
|
|
7010
6995
|
const defaultLevels = {
|
|
@@ -7192,11 +7177,12 @@ function memoizedTableStyles() {
|
|
|
7192
7177
|
"--borderColor": "var(--b-surface-separator)"
|
|
7193
7178
|
}]
|
|
7194
7179
|
} : void 0,
|
|
7180
|
+
// One corner each. A single column is both the first and last cell, and the shorthand would replace the other side.
|
|
7195
7181
|
firstRowFirstCellCss: roundedHeader ? {
|
|
7196
|
-
|
|
7182
|
+
borderTopLeftRadius: "btlr_8px"
|
|
7197
7183
|
} : void 0,
|
|
7198
7184
|
firstRowLastCellCss: roundedHeader ? {
|
|
7199
|
-
|
|
7185
|
+
borderTopRightRadius: "btrr_8px"
|
|
7200
7186
|
} : void 0,
|
|
7201
7187
|
// Keep `betweenRowsCss` on all body rows, but on the final body row
|
|
7202
7188
|
// remove the inset shadow and, when bordered, replace it with a true bottom border.
|
|
@@ -7212,10 +7198,10 @@ function memoizedTableStyles() {
|
|
|
7212
7198
|
},
|
|
7213
7199
|
// Only apply bottom corner radii to the final body-row cells when using `bordered`.
|
|
7214
7200
|
lastRowFirstCellCss: bordered ? {
|
|
7215
|
-
|
|
7201
|
+
borderBottomLeftRadius: "bblr_8px"
|
|
7216
7202
|
} : void 0,
|
|
7217
7203
|
lastRowLastCellCss: bordered ? {
|
|
7218
|
-
|
|
7204
|
+
borderBottomRightRadius: "bbrr_8px"
|
|
7219
7205
|
} : void 0,
|
|
7220
7206
|
presentationSettings: {
|
|
7221
7207
|
borderless: true,
|
|
@@ -7269,6 +7255,42 @@ var tableRowPrintBreakCss = {
|
|
|
7269
7255
|
pageBreakAfter: "pgba_auto",
|
|
7270
7256
|
pageBreakInside: "pgbi_avoid"
|
|
7271
7257
|
};
|
|
7258
|
+
var hierarchyIndentPx = 28;
|
|
7259
|
+
var tableCellPaddingXPx = 12;
|
|
7260
|
+
function hierarchyIndentPaddingPx(level) {
|
|
7261
|
+
if (level <= 0) return void 0;
|
|
7262
|
+
return tableCellPaddingXPx + hierarchyIndentPx * level;
|
|
7263
|
+
}
|
|
7264
|
+
function hierarchyFirstContentCss(opts) {
|
|
7265
|
+
const {
|
|
7266
|
+
level,
|
|
7267
|
+
skipIndent,
|
|
7268
|
+
maxLevel
|
|
7269
|
+
} = opts;
|
|
7270
|
+
const paddingLeft = skipIndent ? void 0 : hierarchyIndentPaddingPx(level);
|
|
7271
|
+
const type = hierarchyLevelType(level, maxLevel);
|
|
7272
|
+
if (!type && paddingLeft === void 0) return void 0;
|
|
7273
|
+
return {
|
|
7274
|
+
...type ?? {},
|
|
7275
|
+
...paddingLeft !== void 0 ? {
|
|
7276
|
+
paddingLeft: ["pl_var", {
|
|
7277
|
+
"--paddingLeft": `${paddingLeft}px`
|
|
7278
|
+
}]
|
|
7279
|
+
} : {}
|
|
7280
|
+
};
|
|
7281
|
+
}
|
|
7282
|
+
function hierarchyLevelType(level, maxLevel) {
|
|
7283
|
+
if (level >= maxLevel) return void 0;
|
|
7284
|
+
return level === 0 ? {
|
|
7285
|
+
fontWeight: "fw6",
|
|
7286
|
+
fontSize: "fz_14px",
|
|
7287
|
+
lineHeight: "lh_20px"
|
|
7288
|
+
} : {
|
|
7289
|
+
fontWeight: "fw6",
|
|
7290
|
+
fontSize: "fz_12px",
|
|
7291
|
+
lineHeight: "lh_16px"
|
|
7292
|
+
};
|
|
7293
|
+
}
|
|
7272
7294
|
var loadingTableCss = {
|
|
7273
7295
|
opacity: "o50",
|
|
7274
7296
|
pointerEvents: "pen"
|
|
@@ -7770,10 +7792,7 @@ var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
|
7770
7792
|
var __maybeInc4 = (inc) => {
|
|
7771
7793
|
return typeof inc === "string" ? inc : `calc(var(--t-spacing) * ${inc})`;
|
|
7772
7794
|
};
|
|
7773
|
-
function toContent(maybeContent, isHeader, canSortColumn, isClientSideSorting, style, as, alignment, column2, isExpandableHeader, isGroupHeader, isExpandable, minStickyLeftOffset
|
|
7774
|
-
if (isKeptSelectedRow && column2.id === "beamCollapseColumn") {
|
|
7775
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, {});
|
|
7776
|
-
}
|
|
7795
|
+
function toContent(maybeContent, isHeader, canSortColumn, isClientSideSorting, style, as, alignment, column2, isExpandableHeader, isGroupHeader, isExpandable, minStickyLeftOffset) {
|
|
7777
7796
|
let content2 = isGridCellContent(maybeContent) ? maybeContent.content : maybeContent;
|
|
7778
7797
|
if (typeof content2 === "function") {
|
|
7779
7798
|
content2 = content2();
|
|
@@ -8800,6 +8819,8 @@ var RowStates = class {
|
|
|
8800
8819
|
keptGroupRow;
|
|
8801
8820
|
/** The first level of rows, i.e. not the header (or kept group), but the totals + top-level children. */
|
|
8802
8821
|
topRows = [];
|
|
8822
|
+
/** Deepest data-row level from the latest `setRows`. `0` when every body row is top-level. */
|
|
8823
|
+
maxNestingLevel = 0;
|
|
8803
8824
|
constructor(table) {
|
|
8804
8825
|
this.table = table;
|
|
8805
8826
|
this.header = this.createHeaderRow();
|
|
@@ -8827,7 +8848,8 @@ var RowStates = class {
|
|
|
8827
8848
|
const map = this.map;
|
|
8828
8849
|
const seenIds = /* @__PURE__ */ new Set();
|
|
8829
8850
|
const maybeKept = new Set(this.map.values());
|
|
8830
|
-
|
|
8851
|
+
let maxNestingLevel = 0;
|
|
8852
|
+
function addRowAndChildren(parent, row, level) {
|
|
8831
8853
|
const key = row.id;
|
|
8832
8854
|
if (seenIds.has(key)) {
|
|
8833
8855
|
throw new Error(`Duplicate row id ${key}`);
|
|
@@ -8844,12 +8866,15 @@ var RowStates = class {
|
|
|
8844
8866
|
state.removed = false;
|
|
8845
8867
|
maybeKept.delete(state);
|
|
8846
8868
|
}
|
|
8847
|
-
|
|
8869
|
+
const reserved = reservedRowKinds.includes(row.kind);
|
|
8870
|
+
if (!reserved && level > maxNestingLevel) maxNestingLevel = level;
|
|
8871
|
+
state.children = row.children?.map((child) => addRowAndChildren(state, child, reserved ? level : level + 1));
|
|
8848
8872
|
return state;
|
|
8849
8873
|
}
|
|
8850
8874
|
const headerRow = rows.find((r) => r.kind === HEADER);
|
|
8851
8875
|
this.header.row = headerRow || missingHeader;
|
|
8852
|
-
this.topRows = rows.filter((row) => row !== headerRow).map((row) => addRowAndChildren(this.header, row));
|
|
8876
|
+
this.topRows = rows.filter((row) => row !== headerRow).map((row) => addRowAndChildren(this.header, row, 0));
|
|
8877
|
+
this.maxNestingLevel = maxNestingLevel;
|
|
8853
8878
|
this.header.children = [this.keptGroupRow, ...this.topRows];
|
|
8854
8879
|
for (const state of maybeKept) state.markRemoved();
|
|
8855
8880
|
if (this.topRows.some((rs) => !reservedRowKinds.includes(rs.row.kind))) {
|
|
@@ -9051,6 +9076,8 @@ var TableState = class {
|
|
|
9051
9076
|
persistCollapse;
|
|
9052
9077
|
// The current list of rows, basically a useRef.current. Only shallow reactive.
|
|
9053
9078
|
rows = [];
|
|
9079
|
+
/** Deepest data-row level, set with the rows. `0` when the table has a single level. Every row's type is chosen from this. */
|
|
9080
|
+
maxNestingLevel = 0;
|
|
9054
9081
|
// The current list of columns, basically a useRef.current. Only ref reactive.
|
|
9055
9082
|
columns = [];
|
|
9056
9083
|
api;
|
|
@@ -9148,6 +9175,7 @@ var TableState = class {
|
|
|
9148
9175
|
setRows(rows) {
|
|
9149
9176
|
this.rowStates.setRows(rows);
|
|
9150
9177
|
this.rows = rows;
|
|
9178
|
+
this.maxNestingLevel = this.rowStates.maxNestingLevel;
|
|
9151
9179
|
}
|
|
9152
9180
|
setColumns(columns, visibleColumnsStorageKey) {
|
|
9153
9181
|
if (columns !== this.columns) {
|
|
@@ -9164,10 +9192,22 @@ var TableState = class {
|
|
|
9164
9192
|
get visibleRows() {
|
|
9165
9193
|
return this.rowStates.visibleRows;
|
|
9166
9194
|
}
|
|
9167
|
-
/**
|
|
9195
|
+
/** Visible columns, including any expanded children. */
|
|
9168
9196
|
get visibleColumns() {
|
|
9169
9197
|
return this.columnStates.allVisibleColumns("web").map((cs) => cs.column);
|
|
9170
9198
|
}
|
|
9199
|
+
/** Visible columns that take a layout slot. Select and collapse are left out. */
|
|
9200
|
+
get layoutColumns() {
|
|
9201
|
+
return toLayoutColumns(this.visibleColumns);
|
|
9202
|
+
}
|
|
9203
|
+
/** Select and collapse, when those columns are visible. Drawn in the first content cell. */
|
|
9204
|
+
get controlColumns() {
|
|
9205
|
+
return rowControlColumns(this.visibleColumns);
|
|
9206
|
+
}
|
|
9207
|
+
/** Extra width the first content column needs for the in-cell checkbox and chevron. */
|
|
9208
|
+
get controlWidthPx() {
|
|
9209
|
+
return firstContentControlPx(this.controlColumns);
|
|
9210
|
+
}
|
|
9171
9211
|
/** Returns visible columns, i.e. those that are visible + any expanded children. */
|
|
9172
9212
|
get visibleCsvColumns() {
|
|
9173
9213
|
return this.columnStates.allVisibleColumns("csv").map((cs) => cs.column);
|
|
@@ -9286,23 +9326,23 @@ function deriveSortState(currentSortState, clickedKey, initialSortState) {
|
|
|
9286
9326
|
|
|
9287
9327
|
// src/components/Table/components/CollapseToggle.tsx
|
|
9288
9328
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
9329
|
+
function showsCollapseToggle(row, isKeptSelectedRow = false) {
|
|
9330
|
+
if (isKeptSelectedRow) return false;
|
|
9331
|
+
if (row.kind === HEADER || row.kind === KEPT_GROUP) return true;
|
|
9332
|
+
return !!row.children?.length;
|
|
9333
|
+
}
|
|
9289
9334
|
function CollapseToggle(props) {
|
|
9290
9335
|
const { row, compact } = props;
|
|
9291
9336
|
const { tableState } = (0, import_react19.useContext)(TableStateContext);
|
|
9292
9337
|
const isCollapsed = useComputed(() => tableState.isCollapsed(row.id), [tableState]);
|
|
9293
9338
|
const iconKey = isCollapsed ? "chevronRight" : "chevronDown";
|
|
9294
9339
|
const headerIconKey = isCollapsed ? "chevronsRight" : "chevronsDown";
|
|
9295
|
-
|
|
9296
|
-
const isKeptGroup = row.kind === KEPT_GROUP;
|
|
9297
|
-
const hasChildren = row.children ? row.children.length > 0 : false;
|
|
9298
|
-
if (!isHeader && !isKeptGroup && !hasChildren) {
|
|
9299
|
-
return null;
|
|
9300
|
-
}
|
|
9340
|
+
if (!showsCollapseToggle(row)) return null;
|
|
9301
9341
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
9302
9342
|
IconButton,
|
|
9303
9343
|
{
|
|
9304
9344
|
onClick: () => tableState.toggleCollapsed(row.id),
|
|
9305
|
-
icon:
|
|
9345
|
+
icon: row.kind === HEADER ? headerIconKey : iconKey,
|
|
9306
9346
|
compact
|
|
9307
9347
|
}
|
|
9308
9348
|
);
|
|
@@ -9675,14 +9715,14 @@ function actionColumn(columnDef) {
|
|
|
9675
9715
|
wrapAction: false
|
|
9676
9716
|
};
|
|
9677
9717
|
}
|
|
9718
|
+
var beamSelectColumnId = "beamSelectColumn";
|
|
9719
|
+
var beamCollapseColumnId = "beamCollapseColumn";
|
|
9678
9720
|
function selectColumn(columnDef) {
|
|
9679
9721
|
const base = {
|
|
9680
9722
|
...nonKindDefaults(),
|
|
9681
|
-
id:
|
|
9723
|
+
id: beamSelectColumnId,
|
|
9682
9724
|
clientSideSort: false,
|
|
9683
9725
|
align: "center",
|
|
9684
|
-
// Defining `w: 40px` to accommodate for the `16px` wide checkbox and `12px` of padding on either side.
|
|
9685
|
-
w: "40px",
|
|
9686
9726
|
wrapAction: false,
|
|
9687
9727
|
isAction: true,
|
|
9688
9728
|
// Select Column should not display the select toggle for group, expandable, or totals header rows.
|
|
@@ -9703,11 +9743,9 @@ function selectColumn(columnDef) {
|
|
|
9703
9743
|
function collapseColumn(columnDef) {
|
|
9704
9744
|
const base = {
|
|
9705
9745
|
...nonKindDefaults(),
|
|
9706
|
-
id:
|
|
9746
|
+
id: beamCollapseColumnId,
|
|
9707
9747
|
clientSideSort: false,
|
|
9708
9748
|
align: "center",
|
|
9709
|
-
// Defining `w: 38px` based on the designs
|
|
9710
|
-
w: "38px",
|
|
9711
9749
|
wrapAction: false,
|
|
9712
9750
|
isAction: true,
|
|
9713
9751
|
// Collapse Column should not display the collapse toggle for group, expandable, or totals header rows.
|
|
@@ -9718,10 +9756,9 @@ function collapseColumn(columnDef) {
|
|
|
9718
9756
|
};
|
|
9719
9757
|
return newMethodMissingProxy(base, (key) => {
|
|
9720
9758
|
return (data, {
|
|
9721
|
-
row
|
|
9722
|
-
level
|
|
9759
|
+
row
|
|
9723
9760
|
}) => ({
|
|
9724
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CollapseToggle, { row
|
|
9761
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CollapseToggle, { row })
|
|
9725
9762
|
});
|
|
9726
9763
|
});
|
|
9727
9764
|
}
|
|
@@ -9755,6 +9792,37 @@ var layoutGutterRightColumnId = "beamLayoutGutterRight";
|
|
|
9755
9792
|
function isContentColumn(column2) {
|
|
9756
9793
|
return !column2.isAction && !column2.isLayoutGutter;
|
|
9757
9794
|
}
|
|
9795
|
+
function isRowControlColumn(column2) {
|
|
9796
|
+
return column2.id === beamSelectColumnId || column2.id === beamCollapseColumnId;
|
|
9797
|
+
}
|
|
9798
|
+
function rowControlColumns(columns) {
|
|
9799
|
+
const collapse = columns.find((column2) => column2.id === beamCollapseColumnId);
|
|
9800
|
+
const select = columns.find((column2) => column2.id === beamSelectColumnId);
|
|
9801
|
+
return [collapse, select].filter((column2) => !!column2);
|
|
9802
|
+
}
|
|
9803
|
+
var collapseTogglePx = 28;
|
|
9804
|
+
var collapseControlPx = collapseTogglePx + 8;
|
|
9805
|
+
var selectControlPx = 24;
|
|
9806
|
+
function firstContentControlPx(columns) {
|
|
9807
|
+
return columns.reduce((width2, column2) => {
|
|
9808
|
+
if (column2.id === beamCollapseColumnId) return width2 + collapseControlPx;
|
|
9809
|
+
if (column2.id === beamSelectColumnId) return width2 + selectControlPx;
|
|
9810
|
+
return width2;
|
|
9811
|
+
}, 0);
|
|
9812
|
+
}
|
|
9813
|
+
function toLayoutColumns(columns) {
|
|
9814
|
+
const controlSticky = columns.find((column2) => isRowControlColumn(column2) && column2.sticky)?.sticky;
|
|
9815
|
+
const layout = columns.filter((column2) => !isRowControlColumn(column2));
|
|
9816
|
+
if (!controlSticky) return layout;
|
|
9817
|
+
const index = layout.findIndex((column2) => isContentColumn(column2));
|
|
9818
|
+
if (index < 0 || layout[index].sticky) return layout;
|
|
9819
|
+
const next = layout.slice();
|
|
9820
|
+
next[index] = {
|
|
9821
|
+
...layout[index],
|
|
9822
|
+
sticky: controlSticky
|
|
9823
|
+
};
|
|
9824
|
+
return next;
|
|
9825
|
+
}
|
|
9758
9826
|
function layoutGutterColumn(side, sticky, gutterPx) {
|
|
9759
9827
|
const id = side === "left" ? layoutGutterLeftColumnId : layoutGutterRightColumnId;
|
|
9760
9828
|
const base = {
|
|
@@ -9839,51 +9907,58 @@ function resolveTableContentWidth(tableWidth, columnSizes, minWidthPx = 0) {
|
|
|
9839
9907
|
if (sum === null) return void 0;
|
|
9840
9908
|
return Math.max(minWidthPx, sum);
|
|
9841
9909
|
}
|
|
9842
|
-
function calcColumnSizes(columns, tableWidth, tableMinWidthPx = 0, expandedColumnIds, resizedWidths) {
|
|
9910
|
+
function calcColumnSizes(columns, tableWidth, tableMinWidthPx = 0, expandedColumnIds, resizedWidths, controlPx = 0) {
|
|
9911
|
+
const firstContentIndex = columns.findIndex((column2) => isContentColumn(column2));
|
|
9912
|
+
const firstContentId = firstContentIndex >= 0 ? columns[firstContentIndex].id : void 0;
|
|
9913
|
+
const controlBonus = firstContentId !== void 0 && resizedWidths?.[firstContentId] === void 0 ? controlPx : 0;
|
|
9843
9914
|
const {
|
|
9844
9915
|
claimedPercentages,
|
|
9845
9916
|
claimedPixels,
|
|
9846
9917
|
totalFr
|
|
9847
|
-
} = columns.reduce(
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9918
|
+
} = columns.reduce(
|
|
9919
|
+
(acc, {
|
|
9920
|
+
id,
|
|
9921
|
+
w: _w,
|
|
9922
|
+
expandedWidth
|
|
9923
|
+
}) => {
|
|
9924
|
+
const resizedWidth = resizedWidths?.[id];
|
|
9925
|
+
const w = resizedWidth !== void 0 ? `${resizedWidth}px` : expandedColumnIds.includes(id) && expandedWidth !== void 0 ? expandedWidth : _w;
|
|
9926
|
+
if (typeof w === "undefined") {
|
|
9927
|
+
return {
|
|
9928
|
+
...acc,
|
|
9929
|
+
totalFr: acc.totalFr + 1
|
|
9930
|
+
};
|
|
9931
|
+
} else if (typeof w === "number") {
|
|
9932
|
+
return {
|
|
9933
|
+
...acc,
|
|
9934
|
+
totalFr: acc.totalFr + w
|
|
9935
|
+
};
|
|
9936
|
+
} else if (w.endsWith("fr")) {
|
|
9937
|
+
return {
|
|
9938
|
+
...acc,
|
|
9939
|
+
totalFr: acc.totalFr + Number(w.replace("fr", ""))
|
|
9940
|
+
};
|
|
9941
|
+
} else if (w.endsWith("px")) {
|
|
9942
|
+
return {
|
|
9943
|
+
...acc,
|
|
9944
|
+
claimedPixels: acc.claimedPixels + Number(w.replace("px", ""))
|
|
9945
|
+
};
|
|
9946
|
+
} else if (w.endsWith("%")) {
|
|
9947
|
+
return {
|
|
9948
|
+
...acc,
|
|
9949
|
+
claimedPercentages: acc.claimedPercentages + Number(w.replace("%", ""))
|
|
9950
|
+
};
|
|
9951
|
+
} else {
|
|
9952
|
+
throw new Error("Beam Table column width definition only supports px, percentage, or fr units");
|
|
9953
|
+
}
|
|
9954
|
+
},
|
|
9955
|
+
// Count the control width in the claimed pixels so fr columns shrink, then add it onto the first content column once sizes are resolved.
|
|
9956
|
+
{
|
|
9957
|
+
claimedPercentages: 0,
|
|
9958
|
+
claimedPixels: controlBonus,
|
|
9959
|
+
totalFr: 0
|
|
9881
9960
|
}
|
|
9882
|
-
|
|
9883
|
-
claimedPercentages: 0,
|
|
9884
|
-
claimedPixels: 0,
|
|
9885
|
-
totalFr: 0
|
|
9886
|
-
});
|
|
9961
|
+
);
|
|
9887
9962
|
let adjustedClaimedPixels = claimedPixels;
|
|
9888
9963
|
let adjustedTotalFr = totalFr;
|
|
9889
9964
|
if (tableWidth) {
|
|
@@ -9935,25 +10010,34 @@ function calcColumnSizes(columns, tableWidth, tableMinWidthPx = 0, expandedColum
|
|
|
9935
10010
|
return fr(w, mw);
|
|
9936
10011
|
}
|
|
9937
10012
|
});
|
|
10013
|
+
if (controlBonus > 0 && firstContentIndex >= 0) {
|
|
10014
|
+
sizes2[firstContentIndex] = withControlWidth(sizes2[firstContentIndex], controlBonus);
|
|
10015
|
+
}
|
|
9938
10016
|
return sizes2;
|
|
9939
10017
|
}
|
|
9940
|
-
function
|
|
10018
|
+
function withControlWidth(size, controlPx) {
|
|
10019
|
+
if (size.endsWith("px")) {
|
|
10020
|
+
return `${parseFloat(size) + controlPx}px`;
|
|
10021
|
+
}
|
|
10022
|
+
return `calc(${size} + ${controlPx}px)`;
|
|
10023
|
+
}
|
|
10024
|
+
function calcColumnLayout(columns, probeWidth, tableMinWidthPx = 0, expandedColumnIds, resizedWidths, columnsMayExceedMeasure, controlPx = 0) {
|
|
9941
10025
|
if (probeWidth === void 0) {
|
|
9942
10026
|
return {
|
|
9943
|
-
columnSizes: calcColumnSizes(columns, void 0, tableMinWidthPx, expandedColumnIds, resizedWidths),
|
|
10027
|
+
columnSizes: calcColumnSizes(columns, void 0, tableMinWidthPx, expandedColumnIds, resizedWidths, controlPx),
|
|
9944
10028
|
contentWidth: void 0
|
|
9945
10029
|
};
|
|
9946
10030
|
}
|
|
9947
10031
|
if (!columnsMayExceedMeasure) {
|
|
9948
10032
|
return {
|
|
9949
|
-
columnSizes: calcColumnSizes(columns, probeWidth, tableMinWidthPx, expandedColumnIds, resizedWidths),
|
|
10033
|
+
columnSizes: calcColumnSizes(columns, probeWidth, tableMinWidthPx, expandedColumnIds, resizedWidths, controlPx),
|
|
9950
10034
|
contentWidth: probeWidth
|
|
9951
10035
|
};
|
|
9952
10036
|
}
|
|
9953
|
-
let columnSizes = calcColumnSizes(columns, probeWidth, tableMinWidthPx, expandedColumnIds, resizedWidths);
|
|
10037
|
+
let columnSizes = calcColumnSizes(columns, probeWidth, tableMinWidthPx, expandedColumnIds, resizedWidths, controlPx);
|
|
9954
10038
|
const contentWidth = resolveTableContentWidth(probeWidth, columnSizes, tableMinWidthPx) ?? probeWidth;
|
|
9955
10039
|
if (contentWidth > probeWidth + 1) {
|
|
9956
|
-
columnSizes = calcColumnSizes(columns, contentWidth, tableMinWidthPx, expandedColumnIds, resizedWidths);
|
|
10040
|
+
columnSizes = calcColumnSizes(columns, contentWidth, tableMinWidthPx, expandedColumnIds, resizedWidths, controlPx);
|
|
9957
10041
|
}
|
|
9958
10042
|
return {
|
|
9959
10043
|
columnSizes,
|
|
@@ -10451,15 +10535,25 @@ function useColumnResizing(storageKey) {
|
|
|
10451
10535
|
|
|
10452
10536
|
// src/components/Table/hooks/useSetupColumnSizes.ts
|
|
10453
10537
|
var import_use_debounce2 = require("use-debounce");
|
|
10454
|
-
|
|
10538
|
+
var columnWidthKeyVersion = 2;
|
|
10539
|
+
function useSetupColumnSizes(style, columns, resizeRef, expandedColumnIds, visibleColumnsStorageKey, disableColumnResizing, columnsMayExceedMeasure, controlPx = 0) {
|
|
10540
|
+
const widthStorageKey = visibleColumnsStorageKey && controlPx > 0 ? `${visibleColumnsStorageKey}__v${columnWidthKeyVersion}` : visibleColumnsStorageKey;
|
|
10455
10541
|
const { resizedWidths, setResizedWidth, setResizedWidths, resetColumnWidths } = useColumnResizing(
|
|
10456
|
-
disableColumnResizing ? void 0 :
|
|
10542
|
+
disableColumnResizing ? void 0 : widthStorageKey
|
|
10457
10543
|
);
|
|
10458
10544
|
const calculateImmediately = (0, import_react28.useRef)(true);
|
|
10459
10545
|
const [tableWidth, setTableWidth] = (0, import_react28.useState)();
|
|
10460
10546
|
const [contentWidth, setContentWidth] = (0, import_react28.useState)();
|
|
10461
10547
|
const [columnSizes, setColumnSizes] = (0, import_react28.useState)(
|
|
10462
|
-
() => calcColumnLayout(
|
|
10548
|
+
() => calcColumnLayout(
|
|
10549
|
+
columns,
|
|
10550
|
+
void 0,
|
|
10551
|
+
style.minWidthPx,
|
|
10552
|
+
expandedColumnIds,
|
|
10553
|
+
resizedWidths,
|
|
10554
|
+
columnsMayExceedMeasure,
|
|
10555
|
+
controlPx
|
|
10556
|
+
).columnSizes
|
|
10463
10557
|
);
|
|
10464
10558
|
const prevTableWidthRef = (0, import_react28.useRef)(tableWidth);
|
|
10465
10559
|
const applyColumnLayout = (0, import_react28.useCallback)(
|
|
@@ -10470,13 +10564,14 @@ function useSetupColumnSizes(style, columns, resizeRef, expandedColumnIds, visib
|
|
|
10470
10564
|
style.minWidthPx,
|
|
10471
10565
|
expandedColumnIds,
|
|
10472
10566
|
resizedWidths,
|
|
10473
|
-
columnsMayExceedMeasure
|
|
10567
|
+
columnsMayExceedMeasure,
|
|
10568
|
+
controlPx
|
|
10474
10569
|
);
|
|
10475
10570
|
setTableWidth(probeWidth);
|
|
10476
10571
|
setContentWidth(layout.contentWidth);
|
|
10477
10572
|
setColumnSizes(layout.columnSizes);
|
|
10478
10573
|
},
|
|
10479
|
-
[columns, style.minWidthPx, expandedColumnIds, resizedWidths, columnsMayExceedMeasure]
|
|
10574
|
+
[columns, style.minWidthPx, expandedColumnIds, resizedWidths, columnsMayExceedMeasure, controlPx]
|
|
10480
10575
|
);
|
|
10481
10576
|
(0, import_react28.useEffect)(() => {
|
|
10482
10577
|
if (!prevTableWidthRef.current) {
|
|
@@ -10601,14 +10696,41 @@ var defaultRenderFn = (as, colSpan) => (key, css2, content2, row, rowStyle, clas
|
|
|
10601
10696
|
colSpan
|
|
10602
10697
|
}, children: content2 }, key);
|
|
10603
10698
|
};
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
|
|
10699
|
+
function withRowControls(content2, controls, alignment, rowLink) {
|
|
10700
|
+
if (controls.length === 0) return content2;
|
|
10701
|
+
const justify = alignment === "center" ? "center" : alignment === "right" ? "flex-end" : "flex-start";
|
|
10702
|
+
const body = rowLink ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_router_dom2.Link, { to: rowLink, ...(0, import_runtime21.mergeProps)(navLink, void 0, {
|
|
10703
|
+
textDecoration: "tdn",
|
|
10704
|
+
color: "c_unset",
|
|
10705
|
+
display: "df",
|
|
10706
|
+
alignItems: "aifs",
|
|
10707
|
+
minWidth: "mw0",
|
|
10708
|
+
flexShrink: "fs1"
|
|
10709
|
+
}), children: content2 }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "df aifs mw0 fs1", children: content2 });
|
|
10710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { ...(0, import_runtime21.trussProps)({
|
|
10711
|
+
display: "df",
|
|
10712
|
+
alignItems: "aifs",
|
|
10713
|
+
gap: "g_1",
|
|
10714
|
+
width: "w100",
|
|
10715
|
+
minWidth: "mw0",
|
|
10716
|
+
justifyContent: ["jc_var", {
|
|
10717
|
+
"--justifyContent": (0, import_runtime21.maybeCssVar)(justify)
|
|
10718
|
+
}]
|
|
10719
|
+
}), children: [
|
|
10720
|
+
controls,
|
|
10721
|
+
body
|
|
10722
|
+
] });
|
|
10723
|
+
}
|
|
10724
|
+
function headerRenderFn(column2, as, colSpan) {
|
|
10725
|
+
return (key, css2, content2, row, rowStyle, classNames, onClick, tooltip) => {
|
|
10726
|
+
const Cell = as === "table" ? "th" : "div";
|
|
10727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Cell, { ...(0, import_runtime21.mergeProps)(classNames, void 0, {
|
|
10728
|
+
...css2
|
|
10729
|
+
}), ...as === "table" && {
|
|
10730
|
+
colSpan
|
|
10731
|
+
}, children: content2 }, key);
|
|
10732
|
+
};
|
|
10733
|
+
}
|
|
10612
10734
|
var rowLinkRenderFn = (as, colSpan) => (key, css2, content2, row, rowStyle, classNames, onClick, tooltip) => {
|
|
10613
10735
|
const to = rowStyle.rowLink(row);
|
|
10614
10736
|
if (as === "table") {
|
|
@@ -10990,9 +11112,10 @@ function RowImpl(props) {
|
|
|
10990
11112
|
tableState
|
|
10991
11113
|
} = (0, import_react33.useContext)(TableStateContext);
|
|
10992
11114
|
const {
|
|
10993
|
-
api
|
|
10994
|
-
visibleColumns: columns
|
|
11115
|
+
api
|
|
10995
11116
|
} = tableState;
|
|
11117
|
+
const columns = tableState.layoutColumns;
|
|
11118
|
+
const controlColumns = tableState.controlColumns;
|
|
10996
11119
|
const columnStripeColor = style.columnStripeColor;
|
|
10997
11120
|
const {
|
|
10998
11121
|
row,
|
|
@@ -11019,6 +11142,7 @@ function RowImpl(props) {
|
|
|
11019
11142
|
const rowStyleCellCss = maybeApplyFunction2(row, rowStyle?.cellCss);
|
|
11020
11143
|
const levelStyle = style.levels && (typeof style.levels === "function" ? style.levels(level) : style.levels[level]);
|
|
11021
11144
|
const levelIndent = levelStyle?.rowIndent;
|
|
11145
|
+
const hasCollapseColumn = controlColumns.some((column2) => column2.id === beamCollapseColumnId);
|
|
11022
11146
|
const containerCss = {
|
|
11023
11147
|
...{
|
|
11024
11148
|
transition: "tsn_padding_0_25s_ease_in_out"
|
|
@@ -11087,8 +11211,8 @@ function RowImpl(props) {
|
|
|
11087
11211
|
wrapAction = true
|
|
11088
11212
|
} = column2;
|
|
11089
11213
|
const isFirstContentColumn = isContentColumn(column2) && !foundFirstContentColumn;
|
|
11214
|
+
foundFirstContentColumn ||= isFirstContentColumn;
|
|
11090
11215
|
const applyFirstContentColumnStyles = !isHeader && isFirstContentColumn;
|
|
11091
|
-
foundFirstContentColumn ||= applyFirstContentColumnStyles;
|
|
11092
11216
|
if (hasExpandableHeader && (isHeader || isTotals)) {
|
|
11093
11217
|
if (currentExpandedColumnCount === 0 && isExpanded) {
|
|
11094
11218
|
currentExpandedColumnCount = numExpandedColumns;
|
|
@@ -11116,7 +11240,34 @@ function RowImpl(props) {
|
|
|
11116
11240
|
const alignment = isGroupHeader ? "left" : getAlignment(column2, maybeContent);
|
|
11117
11241
|
const justificationCss = getJustification(column2, maybeContent, as, alignment);
|
|
11118
11242
|
const isExpandable = isFunction(column2.expandColumns) || column2.expandColumns && column2.expandColumns.length > 0 || column2.expandedWidth !== void 0;
|
|
11119
|
-
const content2 = toContent(maybeContent, isHeader, canSortColumn, sortOn === "client", style, as, alignment, column2, isExpandableHeader, isGroupHeader, isExpandable, minStickyLeftOffset
|
|
11243
|
+
const content2 = toContent(maybeContent, isHeader, canSortColumn, sortOn === "client", style, as, alignment, column2, isExpandableHeader, isGroupHeader, isExpandable, minStickyLeftOffset);
|
|
11244
|
+
const controlNodes = isFirstContentColumn && controlColumns.length > 0 ? controlColumns.flatMap((controlColumn) => {
|
|
11245
|
+
const maybeControl = applyRowFn(controlColumn, row, rowApi, level, isExpanded, dragData);
|
|
11246
|
+
if (isEmptyContent(maybeControl)) return [];
|
|
11247
|
+
if (controlColumn.id === beamCollapseColumnId && !showsCollapseToggle(row, isKeptRow)) {
|
|
11248
|
+
return [/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { "aria-hidden": true, ...(0, import_runtime24.trussProps)({
|
|
11249
|
+
flexShrink: "fs0",
|
|
11250
|
+
display: "df",
|
|
11251
|
+
alignItems: "aic",
|
|
11252
|
+
height: "h_1lh",
|
|
11253
|
+
minHeight: "mh0",
|
|
11254
|
+
width: ["w_var", {
|
|
11255
|
+
"--width": `${collapseTogglePx}px`
|
|
11256
|
+
}]
|
|
11257
|
+
}) }, controlColumn.id)];
|
|
11258
|
+
}
|
|
11259
|
+
return [/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
11260
|
+
"span",
|
|
11261
|
+
{
|
|
11262
|
+
className: "fs0 df aic h_1lh mh0",
|
|
11263
|
+
onClick: (event) => event.stopPropagation(),
|
|
11264
|
+
children: toContent(maybeControl, isHeader, false, false, style, as, "left", controlColumn, isExpandableHeader, isGroupHeader, false, minStickyLeftOffset)
|
|
11265
|
+
},
|
|
11266
|
+
controlColumn.id
|
|
11267
|
+
)];
|
|
11268
|
+
}) : [];
|
|
11269
|
+
const contentRowLink = controlNodes.length > 0 && wrapAction && rowStyle?.rowLink ? rowStyle.rowLink(row) : void 0;
|
|
11270
|
+
const renderedContent = withRowControls(content2, controlNodes, alignment, contentRowLink);
|
|
11120
11271
|
ensureClientSideSortValueIsSortable(sortOn, isHeader || isTotals || isExpandableHeader || isGroupHeader, column2, columnIndex, maybeContent);
|
|
11121
11272
|
const maybeSticky = (isGridCellContent(maybeContent) && maybeContent.sticky || column2.sticky) ?? void 0;
|
|
11122
11273
|
const maybeStickyColumnStyles = maybeSticky && columnSizes ? {
|
|
@@ -11213,6 +11364,13 @@ function RowImpl(props) {
|
|
|
11213
11364
|
...isBodyRow && levelStyle?.cellCss,
|
|
11214
11365
|
// Level specific styling for the first content column
|
|
11215
11366
|
...applyFirstContentColumnStyles && levelStyle?.firstContentColumn,
|
|
11367
|
+
// pl3 above is only for tables without a chevron. Hierarchy padding replaces it when we have a collapse column.
|
|
11368
|
+
// Cards indent the whole row, so don't also pad the cell.
|
|
11369
|
+
...isBodyRow && applyFirstContentColumnStyles && hierarchyFirstContentCss({
|
|
11370
|
+
level,
|
|
11371
|
+
skipIndent: levelIndent !== void 0 || !hasCollapseColumn,
|
|
11372
|
+
maxLevel: tableState.maxNestingLevel
|
|
11373
|
+
}),
|
|
11216
11374
|
// Apply any declarative column border styling after header/body defaults.
|
|
11217
11375
|
...getColumnBorderCss(column2.border, style),
|
|
11218
11376
|
// The specific cell's css (if any from GridCellContent)
|
|
@@ -11265,8 +11423,8 @@ function RowImpl(props) {
|
|
|
11265
11423
|
};
|
|
11266
11424
|
const cellOnClick = applyCellHighlight ? () => api.setActiveCellId(cellId) : void 0;
|
|
11267
11425
|
const tooltip = isGridCellContent(maybeContent) ? maybeContent.tooltip : void 0;
|
|
11268
|
-
const renderFn = (rowStyle?.renderCell || rowStyle?.rowLink) && wrapAction ? rowLinkRenderFn(as, currentColspan) : isHeader || isTotals || isExpandableHeader || isGroupHeader ? headerRenderFn(column2, as, currentColspan) : rowStyle?.onClick && wrapAction ? rowClickRenderFn(as, api, currentColspan) : defaultRenderFn(as, currentColspan);
|
|
11269
|
-
const cellElement = renderFn(columnIndex, cellCss,
|
|
11426
|
+
const renderFn = contentRowLink ? isHeader || isTotals || isExpandableHeader || isGroupHeader ? headerRenderFn(column2, as, currentColspan) : defaultRenderFn(as, currentColspan) : (rowStyle?.renderCell || rowStyle?.rowLink) && wrapAction ? rowLinkRenderFn(as, currentColspan) : isHeader || isTotals || isExpandableHeader || isGroupHeader ? headerRenderFn(column2, as, currentColspan) : rowStyle?.onClick && wrapAction ? rowClickRenderFn(as, api, currentColspan) : defaultRenderFn(as, currentColspan);
|
|
11427
|
+
const cellElement = renderFn(columnIndex, cellCss, renderedContent, row, rowStyle, void 0, cellOnClick, tooltip);
|
|
11270
11428
|
if (!disableColumnResizing && isHeader && columnIndex < columns.length - 1 && currentColspan === 1 && isContentColumn(column2)) {
|
|
11271
11429
|
const currentSizeStr = columnSizes[columnIndex];
|
|
11272
11430
|
const minWidthPx = column2.mw ? parseInt(column2.mw.replace("px", ""), 10) : 100;
|
|
@@ -11311,6 +11469,16 @@ function consecutiveGroupSpan(columns, columnIndex) {
|
|
|
11311
11469
|
while (columns[columnIndex + span]?.groupId === groupId) span += 1;
|
|
11312
11470
|
return span;
|
|
11313
11471
|
}
|
|
11472
|
+
function isEmptyContent(maybeContent) {
|
|
11473
|
+
if (maybeContent == null || maybeContent === false || maybeContent === "") return true;
|
|
11474
|
+
if (maybeContent === emptyCell) return true;
|
|
11475
|
+
if (isGridCellContent(maybeContent)) {
|
|
11476
|
+
const content2 = maybeContent.content;
|
|
11477
|
+
if (content2 == null || content2 === false || content2 === "") return true;
|
|
11478
|
+
if (content2 === emptyCell.content) return true;
|
|
11479
|
+
}
|
|
11480
|
+
return false;
|
|
11481
|
+
}
|
|
11314
11482
|
|
|
11315
11483
|
// src/components/Table/components/RowGroup.tsx
|
|
11316
11484
|
var import_react34 = require("react");
|
|
@@ -14650,7 +14818,9 @@ function GridTable(props) {
|
|
|
14650
14818
|
const columns = useComputed(() => {
|
|
14651
14819
|
return tableState.visibleColumns;
|
|
14652
14820
|
}, [tableState]);
|
|
14653
|
-
const
|
|
14821
|
+
const layoutColumns = useComputed(() => tableState.layoutColumns, [tableState]);
|
|
14822
|
+
const controlWidthPx = useComputed(() => tableState.controlWidthPx, [tableState]);
|
|
14823
|
+
const stripedColumnIds = (0, import_react51.useMemo)(() => style.columnStripeColor ? getStripedColumnIds(layoutColumns) : void 0, [layoutColumns, style.columnStripeColor]);
|
|
14654
14824
|
tableState.initSortState(props.sorting, columns);
|
|
14655
14825
|
const {
|
|
14656
14826
|
getCount
|
|
@@ -14664,14 +14834,14 @@ function GridTable(props) {
|
|
|
14664
14834
|
setResizedWidth,
|
|
14665
14835
|
setResizedWidths,
|
|
14666
14836
|
resetColumnWidths
|
|
14667
|
-
} = useSetupColumnSizes(style,
|
|
14837
|
+
} = useSetupColumnSizes(style, layoutColumns, resizeTarget ?? resizeRef, expandedColumnIds, visibleColumnsStorageKey, disableColumnResizing, columnsMayExceedMeasure, controlWidthPx);
|
|
14668
14838
|
(0, import_react51.useEffect)(() => {
|
|
14669
14839
|
api.resetColumnWidthsFn = !disableColumnResizing ? resetColumnWidths : void 0;
|
|
14670
14840
|
}, [api, resetColumnWidths, disableColumnResizing]);
|
|
14671
14841
|
const {
|
|
14672
14842
|
handleColumnResize,
|
|
14673
14843
|
calculatePreviewWidth
|
|
14674
|
-
} = useColumnResizeHandlers(
|
|
14844
|
+
} = useColumnResizeHandlers(layoutColumns, columnSizes, tableWidth, setResizedWidth, setResizedWidths);
|
|
14675
14845
|
function recursiveSetDraggedOver(rows2, draggedOver) {
|
|
14676
14846
|
rows2.forEach((r) => {
|
|
14677
14847
|
tableState.maybeSetRowDraggedOver(r.id, draggedOver);
|
|
@@ -14786,7 +14956,7 @@ function GridTable(props) {
|
|
|
14786
14956
|
const makeCompanionRow = (rs, resolved, isFirstBodyRow, isLastBodyRow) => {
|
|
14787
14957
|
const levelStyle = style.levels && (typeof style.levels === "function" ? style.levels(rs.level) : style.levels[rs.level]);
|
|
14788
14958
|
const rowStyle = rowStyles?.[rs.row.kind];
|
|
14789
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(CompanionRow, { as, style, columnSizes, rowId: rs.row.id, colSpan:
|
|
14959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(CompanionRow, { as, style, columnSizes, rowId: rs.row.id, colSpan: layoutColumns.length, isFirstBodyRow, isLastBodyRow, position: resolved.position, companion: resolved.content, levelIndent: levelStyle?.rowIndent, rowCss: maybeApplyFunction(rs.row, rowStyle?.rowCss), cellCss: maybeApplyFunction(rs.row, rowStyle?.cellCss) }, `${rs.key}-companion`);
|
|
14790
14960
|
};
|
|
14791
14961
|
const makeRowGroup = (rs, isFirstBodyRow, isLastBodyRow, inHead) => {
|
|
14792
14962
|
const resolved = rs.companion;
|
|
@@ -14832,7 +15002,7 @@ function GridTable(props) {
|
|
|
14832
15002
|
visibleDataRows2 = visibleDataRows2.slice(0, filterMaxRows);
|
|
14833
15003
|
}
|
|
14834
15004
|
return [tableHeadRows2, visibleDataRows2, keptSelectedRows2, pinnedRows2, tooManyClientSideRows2];
|
|
14835
|
-
}, [as, api, style, rowStyles, maybeStyle, columnSizes, columns.length, stripedColumnIds, getCount, filterMaxRows, cardHeight, cardImageFit]);
|
|
15005
|
+
}, [as, api, style, rowStyles, maybeStyle, columnSizes, layoutColumns, columns.length, stripedColumnIds, getCount, filterMaxRows, cardHeight, cardImageFit]);
|
|
14836
15006
|
if (props.rowLookup) props.rowLookup.current = api.lookup;
|
|
14837
15007
|
const noData = visibleDataRows.length === 0 && pinnedRows.length === 0;
|
|
14838
15008
|
const firstRowMessage = noData && !emptyState && fallbackMessage || tooManyClientSideRows && "Hiding some rows, use filter..." || infoMessage;
|
|
@@ -14875,7 +15045,7 @@ function GridTable(props) {
|
|
|
14875
15045
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableStateContext.Provider, { value: rowStateContext, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(PresentationProvider, { fieldProps, wrap: style?.presentationSettings?.wrap, children: [
|
|
14876
15046
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { ref: resizeRef, ...(0, import_runtime43.trussProps)(getTableRefWidthStyles(as === "virtual", columnMeasureWidth)), ...tid.probe }),
|
|
14877
15047
|
loading && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { ...(0, import_runtime43.trussProps)(loadingOverlayCss), ...tid.loadingOverlay, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Loader, { ...tid.loadingSpinner, size: "md" }) }),
|
|
14878
|
-
as === "card" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(CardView, { cardRows: visibleDataRows, id, virtuosoRangeRef, infiniteScroll, persistScrollPosition, loading }) : _as === "virtual" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(VirtualGridTableView, { style: tableStyle, id, columns, visibleDataRows, keptSelectedRows, pinnedRows, firstRowMessage, stickyHeader, xss, virtuosoRef, virtuosoRangeRef, tableHeadRows, stickyOffset, infiniteScroll, persistScrollPosition, loading }) : renders[_as](tableStyle, id,
|
|
15048
|
+
as === "card" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(CardView, { cardRows: visibleDataRows, id, virtuosoRangeRef, infiniteScroll, persistScrollPosition, loading }) : _as === "virtual" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(VirtualGridTableView, { style: tableStyle, id, columns: layoutColumns, visibleDataRows, keptSelectedRows, pinnedRows, firstRowMessage, stickyHeader, xss, virtuosoRef, virtuosoRangeRef, tableHeadRows, stickyOffset, infiniteScroll, persistScrollPosition, loading }) : renders[_as](tableStyle, id, layoutColumns, visibleDataRows, keptSelectedRows, pinnedRows, firstRowMessage, stickyHeader, xss, virtuosoRef, virtuosoRangeRef, tableHeadRows, stickyOffset, loading, infiniteScroll, tableContainerRef, persistScrollPosition)
|
|
14879
15049
|
] }) });
|
|
14880
15050
|
}
|
|
14881
15051
|
var loadingOverlayCss = {
|
|
@@ -18856,7 +19026,8 @@ var widths = {
|
|
|
18856
19026
|
md: 480,
|
|
18857
19027
|
lg: 640,
|
|
18858
19028
|
xl: 800,
|
|
18859
|
-
xxl: 900
|
|
19029
|
+
xxl: 900,
|
|
19030
|
+
"3xl": 1180
|
|
18860
19031
|
};
|
|
18861
19032
|
var defaultMinHeight = 204;
|
|
18862
19033
|
function getSize(size) {
|
|
@@ -34392,6 +34563,7 @@ var togglePressStyles = {
|
|
|
34392
34563
|
actionColumn,
|
|
34393
34564
|
applyRowFn,
|
|
34394
34565
|
assignDefaultColumnIds,
|
|
34566
|
+
beamCollapseColumnId,
|
|
34395
34567
|
beamEnvironmentBannerLayoutHeightVar,
|
|
34396
34568
|
beamFloatingRightOffsetVar,
|
|
34397
34569
|
beamLayoutContentPaddingXVar,
|
|
@@ -34402,6 +34574,7 @@ var togglePressStyles = {
|
|
|
34402
34574
|
beamPageHeaderLayoutHeightVar,
|
|
34403
34575
|
beamRightPaneContentMinVar,
|
|
34404
34576
|
beamRightPaneWidthVar,
|
|
34577
|
+
beamSelectColumnId,
|
|
34405
34578
|
beamSideNavLayoutWidthVar,
|
|
34406
34579
|
beamTableActionsHeightVar,
|
|
34407
34580
|
beamWorkflowLayoutFooterHeightVar,
|
|
@@ -34446,7 +34619,9 @@ var togglePressStyles = {
|
|
|
34446
34619
|
chipHoverOnlyStyles,
|
|
34447
34620
|
chipHoverStyles,
|
|
34448
34621
|
collapseColumn,
|
|
34622
|
+
collapseTogglePx,
|
|
34449
34623
|
column,
|
|
34624
|
+
columnWidthKeyVersion,
|
|
34450
34625
|
condensedStyle,
|
|
34451
34626
|
contrastDataTheme,
|
|
34452
34627
|
createRowLookup,
|
|
@@ -34474,6 +34649,7 @@ var togglePressStyles = {
|
|
|
34474
34649
|
fieldCell,
|
|
34475
34650
|
fieldColumn,
|
|
34476
34651
|
filterTestIdPrefix,
|
|
34652
|
+
firstContentControlPx,
|
|
34477
34653
|
formatDate,
|
|
34478
34654
|
formatDateRange,
|
|
34479
34655
|
formatPlainDate,
|
|
@@ -34504,6 +34680,7 @@ var togglePressStyles = {
|
|
|
34504
34680
|
isListBoxSection,
|
|
34505
34681
|
isPersistentItem,
|
|
34506
34682
|
isPersistentKey,
|
|
34683
|
+
isRowControlColumn,
|
|
34507
34684
|
isValidDate,
|
|
34508
34685
|
joinDocumentTitleSegments,
|
|
34509
34686
|
layoutGutterLeftColumnId,
|
|
@@ -34542,6 +34719,7 @@ var togglePressStyles = {
|
|
|
34542
34719
|
rightPaneOpenActions,
|
|
34543
34720
|
rightPaneOpenStore,
|
|
34544
34721
|
rowClickRenderFn,
|
|
34722
|
+
rowControlColumns,
|
|
34545
34723
|
rowLinkRenderFn,
|
|
34546
34724
|
selectColumn,
|
|
34547
34725
|
setDefaultStyle,
|
|
@@ -34550,6 +34728,7 @@ var togglePressStyles = {
|
|
|
34550
34728
|
setRunningInJest,
|
|
34551
34729
|
shouldShowEnvironmentBanner,
|
|
34552
34730
|
shouldSkipScrollTo,
|
|
34731
|
+
showsCollapseToggle,
|
|
34553
34732
|
simpleDataRows,
|
|
34554
34733
|
simpleGroupHeader,
|
|
34555
34734
|
simpleHeader,
|
|
@@ -34564,6 +34743,7 @@ var togglePressStyles = {
|
|
|
34564
34743
|
switchHoverStyles,
|
|
34565
34744
|
switchSelectedHoverStyles,
|
|
34566
34745
|
toContent,
|
|
34746
|
+
toLayoutColumns,
|
|
34567
34747
|
toLimitAndOffset,
|
|
34568
34748
|
toPageNumberSize,
|
|
34569
34749
|
toggleFilter,
|