@lensui/lens-table 0.1.30 → 0.1.32
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 +9 -4
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -778,7 +778,8 @@ function isColumnFilterable(column) {
|
|
|
778
778
|
}
|
|
779
779
|
function getHeaderTitleRequiredWidth(column, titleWidth) {
|
|
780
780
|
const minimumReadableTitleWidth = Math.min(Math.ceil(titleWidth), 28);
|
|
781
|
-
|
|
781
|
+
const horizontalPadding = 24;
|
|
782
|
+
return minimumReadableTitleWidth + horizontalPadding + (column.align === "center" ? 20 : 22);
|
|
782
783
|
}
|
|
783
784
|
function getVisibleHeaderActions(column, width, columnDraggable = false, titleWidth = 26, actionSlotWidth = HEADER_ACTION_SLOT_WIDTH) {
|
|
784
785
|
const capacity = Math.max(0, Math.floor((width - getHeaderTitleRequiredWidth(column, titleWidth)) / actionSlotWidth));
|
|
@@ -1634,6 +1635,7 @@ function TableInner({
|
|
|
1634
1635
|
rows: sourceRows,
|
|
1635
1636
|
rowKey,
|
|
1636
1637
|
width = "100%",
|
|
1638
|
+
stretchColumns = true,
|
|
1637
1639
|
height = "100%",
|
|
1638
1640
|
autoHeight = true,
|
|
1639
1641
|
layout,
|
|
@@ -2121,8 +2123,8 @@ function TableInner({
|
|
|
2121
2123
|
const hasManualColumnWidths = Object.keys(resizedColumnWidths).length > 0;
|
|
2122
2124
|
const metrics = (0, import_react5.useMemo)(() => buildColumnMetrics(columns, {
|
|
2123
2125
|
columnDraggable,
|
|
2124
|
-
viewportWidth: hasManualColumnWidths ? 0 : viewport.width
|
|
2125
|
-
}), [columnDraggable, columns, hasManualColumnWidths, viewport.width]);
|
|
2126
|
+
viewportWidth: !stretchColumns || hasManualColumnWidths ? 0 : viewport.width
|
|
2127
|
+
}), [columnDraggable, columns, hasManualColumnWidths, stretchColumns, viewport.width]);
|
|
2126
2128
|
const contentWidth = metrics.length > 0 ? metrics[metrics.length - 1].right : 0;
|
|
2127
2129
|
const contentHeight = rows.length * rowHeight;
|
|
2128
2130
|
const fixedWidth = (0, import_react5.useMemo)(() => columns.reduce((width2, column, index) => column.fixed === "left" ? width2 + metrics[index].width : width2, 0), [columns, metrics]);
|
|
@@ -4325,7 +4327,10 @@ function TableInner({
|
|
|
4325
4327
|
top: headerTop,
|
|
4326
4328
|
width: width2,
|
|
4327
4329
|
height: rowHeightForLevel,
|
|
4328
|
-
|
|
4330
|
+
// Custom headers lay out their own title row and metadata rows. The
|
|
4331
|
+
// action layer may reserve space in the title row, but must not
|
|
4332
|
+
// shrink the entire custom header (including type/comment rows).
|
|
4333
|
+
paddingRight: cell.leaf && !column.renderHeader ? actionWidth + 10 : 10,
|
|
4329
4334
|
justifyContent: column.align === "right" ? "flex-end" : column.align === "center" ? "center" : "flex-start",
|
|
4330
4335
|
textAlign: column.align === "right" ? "right" : column.align === "center" ? "center" : "left"
|
|
4331
4336
|
},
|
package/dist/index.d.cts
CHANGED
|
@@ -342,6 +342,8 @@ interface TableProps<Row extends object> {
|
|
|
342
342
|
/** Stable row id. Defaults to the row's `id` field when omitted. */
|
|
343
343
|
rowKey?: keyof Row | ((row: Row, index: number) => GridKey);
|
|
344
344
|
width?: number | string;
|
|
345
|
+
/** Stretch columns to fill unused viewport width. Defaults to true. */
|
|
346
|
+
stretchColumns?: boolean;
|
|
345
347
|
/** Grid height. Defaults to 100%; falls back to 480px when the parent has no height. */
|
|
346
348
|
height?: number | string;
|
|
347
349
|
/** Shrink the grid to its real content height when there are fewer rows than the configured max height can display. Defaults to true. */
|
package/dist/index.d.ts
CHANGED
|
@@ -342,6 +342,8 @@ interface TableProps<Row extends object> {
|
|
|
342
342
|
/** Stable row id. Defaults to the row's `id` field when omitted. */
|
|
343
343
|
rowKey?: keyof Row | ((row: Row, index: number) => GridKey);
|
|
344
344
|
width?: number | string;
|
|
345
|
+
/** Stretch columns to fill unused viewport width. Defaults to true. */
|
|
346
|
+
stretchColumns?: boolean;
|
|
345
347
|
/** Grid height. Defaults to 100%; falls back to 480px when the parent has no height. */
|
|
346
348
|
height?: number | string;
|
|
347
349
|
/** Shrink the grid to its real content height when there are fewer rows than the configured max height can display. Defaults to true. */
|
package/dist/index.js
CHANGED
|
@@ -748,7 +748,8 @@ function isColumnFilterable(column) {
|
|
|
748
748
|
}
|
|
749
749
|
function getHeaderTitleRequiredWidth(column, titleWidth) {
|
|
750
750
|
const minimumReadableTitleWidth = Math.min(Math.ceil(titleWidth), 28);
|
|
751
|
-
|
|
751
|
+
const horizontalPadding = 24;
|
|
752
|
+
return minimumReadableTitleWidth + horizontalPadding + (column.align === "center" ? 20 : 22);
|
|
752
753
|
}
|
|
753
754
|
function getVisibleHeaderActions(column, width, columnDraggable = false, titleWidth = 26, actionSlotWidth = HEADER_ACTION_SLOT_WIDTH) {
|
|
754
755
|
const capacity = Math.max(0, Math.floor((width - getHeaderTitleRequiredWidth(column, titleWidth)) / actionSlotWidth));
|
|
@@ -1604,6 +1605,7 @@ function TableInner({
|
|
|
1604
1605
|
rows: sourceRows,
|
|
1605
1606
|
rowKey,
|
|
1606
1607
|
width = "100%",
|
|
1608
|
+
stretchColumns = true,
|
|
1607
1609
|
height = "100%",
|
|
1608
1610
|
autoHeight = true,
|
|
1609
1611
|
layout,
|
|
@@ -2091,8 +2093,8 @@ function TableInner({
|
|
|
2091
2093
|
const hasManualColumnWidths = Object.keys(resizedColumnWidths).length > 0;
|
|
2092
2094
|
const metrics = useMemo(() => buildColumnMetrics(columns, {
|
|
2093
2095
|
columnDraggable,
|
|
2094
|
-
viewportWidth: hasManualColumnWidths ? 0 : viewport.width
|
|
2095
|
-
}), [columnDraggable, columns, hasManualColumnWidths, viewport.width]);
|
|
2096
|
+
viewportWidth: !stretchColumns || hasManualColumnWidths ? 0 : viewport.width
|
|
2097
|
+
}), [columnDraggable, columns, hasManualColumnWidths, stretchColumns, viewport.width]);
|
|
2096
2098
|
const contentWidth = metrics.length > 0 ? metrics[metrics.length - 1].right : 0;
|
|
2097
2099
|
const contentHeight = rows.length * rowHeight;
|
|
2098
2100
|
const fixedWidth = useMemo(() => columns.reduce((width2, column, index) => column.fixed === "left" ? width2 + metrics[index].width : width2, 0), [columns, metrics]);
|
|
@@ -4295,7 +4297,10 @@ function TableInner({
|
|
|
4295
4297
|
top: headerTop,
|
|
4296
4298
|
width: width2,
|
|
4297
4299
|
height: rowHeightForLevel,
|
|
4298
|
-
|
|
4300
|
+
// Custom headers lay out their own title row and metadata rows. The
|
|
4301
|
+
// action layer may reserve space in the title row, but must not
|
|
4302
|
+
// shrink the entire custom header (including type/comment rows).
|
|
4303
|
+
paddingRight: cell.leaf && !column.renderHeader ? actionWidth + 10 : 10,
|
|
4299
4304
|
justifyContent: column.align === "right" ? "flex-end" : column.align === "center" ? "center" : "flex-start",
|
|
4300
4305
|
textAlign: column.align === "right" ? "right" : column.align === "center" ? "center" : "left"
|
|
4301
4306
|
},
|