@canvas-components/list-table 0.3.7 → 0.3.9
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 +221 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +221 -97
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3173,7 +3173,7 @@ function drawBodyBarcodeContent(params) {
|
|
|
3173
3173
|
opacity: resolveContentOpacity(content),
|
|
3174
3174
|
displayValue: content.showText,
|
|
3175
3175
|
text: content.text,
|
|
3176
|
-
fontSize: resolveContentFontSize(content,
|
|
3176
|
+
fontSize: resolveContentFontSize(content, theme.fontSize),
|
|
3177
3177
|
fontWeight: resolveContentFontWeight(content, ""),
|
|
3178
3178
|
fontFamily: resolveContentFontFamily(content, theme),
|
|
3179
3179
|
textColor: content.style?.color ?? content.color
|
|
@@ -3181,7 +3181,7 @@ function drawBodyBarcodeContent(params) {
|
|
|
3181
3181
|
ctx.restore();
|
|
3182
3182
|
if (content.showText) {
|
|
3183
3183
|
const text = content.text ?? content.value;
|
|
3184
|
-
const fontSize = resolveContentFontSize(content,
|
|
3184
|
+
const fontSize = resolveContentFontSize(content, theme.fontSize);
|
|
3185
3185
|
const font = buildCanvasFont({
|
|
3186
3186
|
fontWeight: resolveContentFontWeight(content, ""),
|
|
3187
3187
|
fontSize,
|
|
@@ -3251,12 +3251,6 @@ var BUTTON_HEIGHT_MAP = {
|
|
|
3251
3251
|
medium: 32,
|
|
3252
3252
|
large: 40
|
|
3253
3253
|
};
|
|
3254
|
-
var BUTTON_FONT_SIZE_MAP = {
|
|
3255
|
-
small: 14,
|
|
3256
|
-
middle: 14,
|
|
3257
|
-
medium: 14,
|
|
3258
|
-
large: 16
|
|
3259
|
-
};
|
|
3260
3254
|
var BUTTON_PADDING_INLINE_MAP = {
|
|
3261
3255
|
small: 7,
|
|
3262
3256
|
middle: 15,
|
|
@@ -3408,10 +3402,9 @@ function measureButtonContentHeight(content) {
|
|
|
3408
3402
|
return BUTTON_HEIGHT_MAP[resolveButtonSize(content.size)];
|
|
3409
3403
|
}
|
|
3410
3404
|
function applyButtonTextStyle(ctx, content, theme) {
|
|
3411
|
-
const size = resolveButtonSize(content.size);
|
|
3412
3405
|
ctx.font = buildCanvasFont({
|
|
3413
3406
|
fontWeight: resolveContentFontWeight(content, "400"),
|
|
3414
|
-
fontSize: resolveContentFontSize(content,
|
|
3407
|
+
fontSize: resolveContentFontSize(content, theme.fontSize),
|
|
3415
3408
|
fontFamily: resolveContentFontFamily(content, theme)
|
|
3416
3409
|
});
|
|
3417
3410
|
ctx.textAlign = "left";
|
|
@@ -4950,7 +4943,7 @@ function measureProgressContentWidth(ctx, content, theme) {
|
|
|
4950
4943
|
}
|
|
4951
4944
|
function measureProgressContentHeight(content, theme) {
|
|
4952
4945
|
const shape = content.shape ?? "line";
|
|
4953
|
-
const textHeight = shouldShowProgressLabel(content) ? resolveContentFontSize(content,
|
|
4946
|
+
const textHeight = shouldShowProgressLabel(content) ? resolveContentFontSize(content, theme.fontSize) : 0;
|
|
4954
4947
|
const sizeMetrics = resolveProgressSizeMetrics(content, shape);
|
|
4955
4948
|
if (shape === "circle") {
|
|
4956
4949
|
return Math.max(sizeMetrics.height, sizeMetrics.width, 20);
|
|
@@ -5052,7 +5045,7 @@ function resolveProgressMetrics(ctx, content, theme) {
|
|
|
5052
5045
|
const sizeMetrics = resolveProgressSizeMetrics(content, shape);
|
|
5053
5046
|
applyProgressTextStyle(ctx, content, theme);
|
|
5054
5047
|
const textWidth = showLabel && progressText ? ctx.measureText(progressText).width : 0;
|
|
5055
|
-
const textHeight = showLabel ? resolveContentFontSize(content,
|
|
5048
|
+
const textHeight = showLabel ? resolveContentFontSize(content, theme.fontSize) : 0;
|
|
5056
5049
|
if (shape === "circle") {
|
|
5057
5050
|
return {
|
|
5058
5051
|
width: Math.max(sizeMetrics.width, 20),
|
|
@@ -5167,7 +5160,7 @@ function resolveProgressTextColor(content) {
|
|
|
5167
5160
|
function applyProgressTextStyle(ctx, content, theme) {
|
|
5168
5161
|
ctx.font = buildCanvasFont({
|
|
5169
5162
|
fontWeight: resolveContentFontWeight(content, "500"),
|
|
5170
|
-
fontSize: resolveContentFontSize(content,
|
|
5163
|
+
fontSize: resolveContentFontSize(content, theme.fontSize),
|
|
5171
5164
|
fontFamily: resolveContentFontFamily(content, theme)
|
|
5172
5165
|
});
|
|
5173
5166
|
ctx.textBaseline = "middle";
|
|
@@ -5687,7 +5680,7 @@ function drawSwitchControl(ctx, rect, content, theme, animationProgress, beforeT
|
|
|
5687
5680
|
const displayText = normalizedProgress >= 0.5 ? content.checkedChildren ?? "" : content.uncheckedChildren ?? "";
|
|
5688
5681
|
if (displayText) {
|
|
5689
5682
|
ctx.fillStyle = textColor;
|
|
5690
|
-
ctx.font =
|
|
5683
|
+
ctx.font = `${theme.fontSize}px ${theme.fontFamily}`;
|
|
5691
5684
|
ctx.textBaseline = "alphabetic";
|
|
5692
5685
|
ctx.textAlign = checked ? "left" : "right";
|
|
5693
5686
|
const metrics = ctx.measureText(displayText);
|
|
@@ -5720,7 +5713,7 @@ function resolveSwitchTextLayout(ctx, rect, content, theme, animationProgress) {
|
|
|
5720
5713
|
const text = normalizedProgress >= 0.5 ? content.checkedChildren ?? "" : content.uncheckedChildren ?? "";
|
|
5721
5714
|
if (!text) return null;
|
|
5722
5715
|
ctx.save();
|
|
5723
|
-
ctx.font =
|
|
5716
|
+
ctx.font = `${theme.fontSize}px ${theme.fontFamily}`;
|
|
5724
5717
|
const metrics = ctx.measureText(text);
|
|
5725
5718
|
const ascent = metrics.actualBoundingBoxAscent ?? 0;
|
|
5726
5719
|
const descent = metrics.actualBoundingBoxDescent ?? 0;
|
|
@@ -5738,7 +5731,7 @@ function measureSwitchContentWidth(ctx, content, theme) {
|
|
|
5738
5731
|
return SWITCH_MIN_WIDTH;
|
|
5739
5732
|
}
|
|
5740
5733
|
ctx.save();
|
|
5741
|
-
ctx.font =
|
|
5734
|
+
ctx.font = `${theme.fontSize}px ${theme.fontFamily}`;
|
|
5742
5735
|
const maxTextWidth = Math.max(
|
|
5743
5736
|
ctx.measureText(checkedText).width,
|
|
5744
5737
|
ctx.measureText(uncheckedText).width
|
|
@@ -5883,7 +5876,7 @@ function drawBodyTagContent(params) {
|
|
|
5883
5876
|
ctx.fillStyle = textColor;
|
|
5884
5877
|
ctx.font = buildCanvasFont({
|
|
5885
5878
|
fontWeight: resolveContentFontWeight(content, "500"),
|
|
5886
|
-
fontSize: resolveContentFontSize(content,
|
|
5879
|
+
fontSize: resolveContentFontSize(content, theme.fontSize),
|
|
5887
5880
|
fontFamily: resolveContentFontFamily(content, theme)
|
|
5888
5881
|
});
|
|
5889
5882
|
ctx.textAlign = "left";
|
|
@@ -5972,7 +5965,7 @@ function measureTagContentWidth(ctx, content, theme) {
|
|
|
5972
5965
|
function applyTagTextStyle(ctx, content, theme) {
|
|
5973
5966
|
ctx.font = buildCanvasFont({
|
|
5974
5967
|
fontWeight: resolveContentFontWeight(content, "500"),
|
|
5975
|
-
fontSize: resolveContentFontSize(content,
|
|
5968
|
+
fontSize: resolveContentFontSize(content, theme.fontSize),
|
|
5976
5969
|
fontFamily: resolveContentFontFamily(content, theme)
|
|
5977
5970
|
});
|
|
5978
5971
|
ctx.textAlign = "left";
|
|
@@ -6690,7 +6683,7 @@ function drawBodyCellContents(params) {
|
|
|
6690
6683
|
return void 0;
|
|
6691
6684
|
}
|
|
6692
6685
|
const paddingInline = column.cellStyle?.paddingInline ?? CONTENT_HORIZONTAL_PADDING;
|
|
6693
|
-
const paddingBlock = column.cellStyle?.paddingBlock ?? CONTENT_VERTICAL_PADDING;
|
|
6686
|
+
const paddingBlock = column.cellStyle?.paddingBlock ?? params.defaultPaddingBlock ?? CONTENT_VERTICAL_PADDING;
|
|
6694
6687
|
const availableWidth = Math.max(rect.width - paddingInline * 2, 0);
|
|
6695
6688
|
const availableHeight = Math.max(rect.height - paddingBlock * 2, 0);
|
|
6696
6689
|
if (availableWidth <= 0 || availableHeight <= 0) {
|
|
@@ -7596,7 +7589,7 @@ function getBodyCellContentsLineHeight(contents, theme) {
|
|
|
7596
7589
|
lineHeight = Math.max(
|
|
7597
7590
|
lineHeight,
|
|
7598
7591
|
Math.max(
|
|
7599
|
-
item.style?.fontSize ?? item.fontSize ??
|
|
7592
|
+
item.style?.fontSize ?? item.fontSize ?? theme.fontSize,
|
|
7600
7593
|
12
|
|
7601
7594
|
) + 10,
|
|
7602
7595
|
item.height ?? 22
|
|
@@ -11656,9 +11649,51 @@ function setValueByDataIndex(record, dataIndex, value) {
|
|
|
11656
11649
|
return true;
|
|
11657
11650
|
}
|
|
11658
11651
|
|
|
11652
|
+
// src/shared/theme/density.ts
|
|
11653
|
+
var ULTRA_COMPACT_ROW_HEIGHT = 26;
|
|
11654
|
+
var ULTRA_COMPACT_PADDING_BLOCK = 2;
|
|
11655
|
+
var DEFAULT_PADDING_BLOCK = 6;
|
|
11656
|
+
function resolveDensitySizes(density) {
|
|
11657
|
+
if (density === "auto") {
|
|
11658
|
+
return {
|
|
11659
|
+
rowHeight: "auto",
|
|
11660
|
+
headerRowHeight: void 0,
|
|
11661
|
+
summaryRowHeight: void 0
|
|
11662
|
+
};
|
|
11663
|
+
}
|
|
11664
|
+
if (density === "comfortable") {
|
|
11665
|
+
return {
|
|
11666
|
+
rowHeight: 56,
|
|
11667
|
+
headerRowHeight: 56,
|
|
11668
|
+
summaryRowHeight: 56
|
|
11669
|
+
};
|
|
11670
|
+
}
|
|
11671
|
+
if (density === "ultra-compact") {
|
|
11672
|
+
return {
|
|
11673
|
+
rowHeight: ULTRA_COMPACT_ROW_HEIGHT,
|
|
11674
|
+
headerRowHeight: ULTRA_COMPACT_ROW_HEIGHT,
|
|
11675
|
+
summaryRowHeight: ULTRA_COMPACT_ROW_HEIGHT
|
|
11676
|
+
};
|
|
11677
|
+
}
|
|
11678
|
+
if (density === "compact") {
|
|
11679
|
+
return {
|
|
11680
|
+
rowHeight: 32,
|
|
11681
|
+
headerRowHeight: 32,
|
|
11682
|
+
summaryRowHeight: 32
|
|
11683
|
+
};
|
|
11684
|
+
}
|
|
11685
|
+
return {
|
|
11686
|
+
rowHeight: 48,
|
|
11687
|
+
headerRowHeight: 48,
|
|
11688
|
+
summaryRowHeight: 48
|
|
11689
|
+
};
|
|
11690
|
+
}
|
|
11691
|
+
function resolveDensityPaddingBlock(rowHeight) {
|
|
11692
|
+
return rowHeight <= ULTRA_COMPACT_ROW_HEIGHT ? ULTRA_COMPACT_PADDING_BLOCK : DEFAULT_PADDING_BLOCK;
|
|
11693
|
+
}
|
|
11694
|
+
|
|
11659
11695
|
// src/features/editing/editing-feature.ts
|
|
11660
11696
|
var DEFAULT_EDITOR_PADDING_INLINE = 12;
|
|
11661
|
-
var DEFAULT_EDITOR_PADDING_BLOCK = 6;
|
|
11662
11697
|
function openCellEditingSession(params) {
|
|
11663
11698
|
const {
|
|
11664
11699
|
rowIndex,
|
|
@@ -11676,7 +11711,8 @@ function openCellEditingSession(params) {
|
|
|
11676
11711
|
onCommit,
|
|
11677
11712
|
onCancel,
|
|
11678
11713
|
onNavigate,
|
|
11679
|
-
initialValue
|
|
11714
|
+
initialValue,
|
|
11715
|
+
defaultPaddingBlock
|
|
11680
11716
|
} = params;
|
|
11681
11717
|
const column = leafColumns.find((item) => item.key === columnKey);
|
|
11682
11718
|
const record = rows[rowIndex];
|
|
@@ -11710,7 +11746,7 @@ function openCellEditingSession(params) {
|
|
|
11710
11746
|
const hostRect = toHostRect ? toHostRect(descriptor.rect) : descriptor.rect;
|
|
11711
11747
|
const zoom = typeof theme.contentZoom === "number" && Number.isFinite(theme.contentZoom) && theme.contentZoom > 0 ? theme.contentZoom : 1;
|
|
11712
11748
|
const paddingInline = (column.cellStyle?.paddingInline ?? DEFAULT_EDITOR_PADDING_INLINE) * zoom;
|
|
11713
|
-
const paddingBlock = (column.cellStyle?.paddingBlock ??
|
|
11749
|
+
const paddingBlock = (column.cellStyle?.paddingBlock ?? defaultPaddingBlock ?? resolveDensityPaddingBlock(descriptor.rect.height)) * zoom;
|
|
11714
11750
|
const editorTheme = {
|
|
11715
11751
|
fontSize: theme.fontSize,
|
|
11716
11752
|
fontFamily: theme.fontFamily,
|
|
@@ -11989,6 +12025,7 @@ var ListTableEditingController = class {
|
|
|
11989
12025
|
this.options.clearBodyTooltip();
|
|
11990
12026
|
const zoom = this.options.getTableZoom() > 0 ? this.options.getTableZoom() : 1;
|
|
11991
12027
|
const theme = this.options.getTheme();
|
|
12028
|
+
const configuredRowHeight = this.options.getOptions().rowHeight;
|
|
11992
12029
|
this.editingSession = openCellEditingSession({
|
|
11993
12030
|
rowIndex,
|
|
11994
12031
|
columnKey,
|
|
@@ -12006,6 +12043,7 @@ var ListTableEditingController = class {
|
|
|
12006
12043
|
textColor: theme.textColor,
|
|
12007
12044
|
contentZoom: zoom
|
|
12008
12045
|
},
|
|
12046
|
+
defaultPaddingBlock: typeof configuredRowHeight === "number" ? resolveDensityPaddingBlock(configuredRowHeight) : void 0,
|
|
12009
12047
|
editorFactory: this.options.getEditorFactory(),
|
|
12010
12048
|
onEditorRequest: this.options.getOptions().ui?.onEditorRequest,
|
|
12011
12049
|
onCommit: (commitOptions) => {
|
|
@@ -13955,6 +13993,9 @@ function resolveContextMenuDensity(rowHeight) {
|
|
|
13955
13993
|
if (rowHeight === 56) {
|
|
13956
13994
|
return "comfortable";
|
|
13957
13995
|
}
|
|
13996
|
+
if (rowHeight === 26) {
|
|
13997
|
+
return "ultra-compact";
|
|
13998
|
+
}
|
|
13958
13999
|
if (rowHeight === 32) {
|
|
13959
14000
|
return "compact";
|
|
13960
14001
|
}
|
|
@@ -17766,36 +17807,6 @@ function resolveToggleHeaderColumnVisibilityAction(params) {
|
|
|
17766
17807
|
return toggleHeaderColumnVisibility(params);
|
|
17767
17808
|
}
|
|
17768
17809
|
|
|
17769
|
-
// src/shared/theme/density.ts
|
|
17770
|
-
function resolveDensitySizes(density) {
|
|
17771
|
-
if (density === "auto") {
|
|
17772
|
-
return {
|
|
17773
|
-
rowHeight: "auto",
|
|
17774
|
-
headerRowHeight: void 0,
|
|
17775
|
-
summaryRowHeight: void 0
|
|
17776
|
-
};
|
|
17777
|
-
}
|
|
17778
|
-
if (density === "comfortable") {
|
|
17779
|
-
return {
|
|
17780
|
-
rowHeight: 56,
|
|
17781
|
-
headerRowHeight: 56,
|
|
17782
|
-
summaryRowHeight: 56
|
|
17783
|
-
};
|
|
17784
|
-
}
|
|
17785
|
-
if (density === "compact") {
|
|
17786
|
-
return {
|
|
17787
|
-
rowHeight: 32,
|
|
17788
|
-
headerRowHeight: 32,
|
|
17789
|
-
summaryRowHeight: 32
|
|
17790
|
-
};
|
|
17791
|
-
}
|
|
17792
|
-
return {
|
|
17793
|
-
rowHeight: 48,
|
|
17794
|
-
headerRowHeight: 48,
|
|
17795
|
-
summaryRowHeight: 48
|
|
17796
|
-
};
|
|
17797
|
-
}
|
|
17798
|
-
|
|
17799
17810
|
// src/shared/filter/filter-panel-data.ts
|
|
17800
17811
|
function resolveFilterPanelDataSource(params) {
|
|
17801
17812
|
if (params.queryRowsOverrideBase) {
|
|
@@ -18452,7 +18463,7 @@ function buildStoredColumnConfig(columns, sortState, filterState, zoom, summaryR
|
|
|
18452
18463
|
filters: filterState,
|
|
18453
18464
|
...typeof zoom === "number" && Number.isFinite(zoom) && zoom > 0 ? { zoom } : null,
|
|
18454
18465
|
...typeof summaryRowHeight === "number" && Number.isFinite(summaryRowHeight) && summaryRowHeight >= 0 ? { summaryRowHeight } : null,
|
|
18455
|
-
...density === 32 || density === 48 || density === 56 || density === "auto" ? { density } : null
|
|
18466
|
+
...density === 26 || density === 32 || density === 48 || density === 56 || density === "auto" ? { density } : null
|
|
18456
18467
|
};
|
|
18457
18468
|
}
|
|
18458
18469
|
|
|
@@ -18543,7 +18554,7 @@ async function loadListTableStoredConfig(params) {
|
|
|
18543
18554
|
filterState: stored.filters ? stored.filters : null,
|
|
18544
18555
|
zoom: typeof stored.zoom === "number" && Number.isFinite(stored.zoom) && stored.zoom > 0 ? stored.zoom : null,
|
|
18545
18556
|
summaryRowHeight: typeof stored.summaryRowHeight === "number" && Number.isFinite(stored.summaryRowHeight) && stored.summaryRowHeight >= 0 ? stored.summaryRowHeight : null,
|
|
18546
|
-
density: stored.density === 32 || stored.density === 48 || stored.density === 56 || stored.density === "auto" ? stored.density : null
|
|
18557
|
+
density: stored.density === 26 || stored.density === 32 || stored.density === 48 || stored.density === 56 || stored.density === "auto" ? stored.density : null
|
|
18547
18558
|
};
|
|
18548
18559
|
}
|
|
18549
18560
|
|
|
@@ -18578,7 +18589,7 @@ var ListTablePersistenceController = class {
|
|
|
18578
18589
|
let currentOptions = this.options.getOptions();
|
|
18579
18590
|
if (stored.density != null) {
|
|
18580
18591
|
const densitySizes = resolveDensitySizes(
|
|
18581
|
-
stored.density === "auto" ? "auto" : stored.density === 32 ? "compact" : stored.density === 56 ? "comfortable" : "middle"
|
|
18592
|
+
stored.density === "auto" ? "auto" : stored.density === 26 ? "ultra-compact" : stored.density === 32 ? "compact" : stored.density === 56 ? "comfortable" : "middle"
|
|
18582
18593
|
);
|
|
18583
18594
|
currentOptions = {
|
|
18584
18595
|
...currentOptions,
|
|
@@ -20487,6 +20498,10 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20487
20498
|
if (leafColumns.length === 0) {
|
|
20488
20499
|
return null;
|
|
20489
20500
|
}
|
|
20501
|
+
const columnMetrics = resolveColumnMetrics({
|
|
20502
|
+
columns: leafColumns,
|
|
20503
|
+
tableWidth: width
|
|
20504
|
+
});
|
|
20490
20505
|
const headerInfo = buildHeaderTree(normalizedColumns, leafColumns);
|
|
20491
20506
|
const sourceQueryRows = {
|
|
20492
20507
|
baseRows: baseRowsOverride ?? getBaseDisplayRows({
|
|
@@ -20528,8 +20543,11 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20528
20543
|
(col) => col.summary != null || col.summaryTitle != null
|
|
20529
20544
|
);
|
|
20530
20545
|
const hasSummary = queryRows.displayRows.length > 0 && options.summaryRowHeight !== 0 && (options.summaryRowHeight != null || hasConfiguredSummary);
|
|
20546
|
+
const hasHorizontalScrollbar = options.scrollbar?.visible !== false && columnMetrics.centerContentWidth - columnMetrics.availableCenterWidth > 1;
|
|
20547
|
+
const horizontalScrollbarReserve = hasSummary && hasHorizontalScrollbar ? scrollbarThickness + Math.max(options.scrollbar?.horizontalBottom ?? 0, 0) : 0;
|
|
20548
|
+
const contentHeight = Math.max(height - horizontalScrollbarReserve, 0);
|
|
20531
20549
|
const initialBodyLayout = resolveBodyLayout({
|
|
20532
|
-
height,
|
|
20550
|
+
height: contentHeight,
|
|
20533
20551
|
headerHeight,
|
|
20534
20552
|
summaryRowHeight,
|
|
20535
20553
|
hasSummary,
|
|
@@ -20659,7 +20677,7 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20659
20677
|
}
|
|
20660
20678
|
},
|
|
20661
20679
|
bodyLayout: resolveBodyLayout({
|
|
20662
|
-
height,
|
|
20680
|
+
height: contentHeight,
|
|
20663
20681
|
headerHeight,
|
|
20664
20682
|
summaryRowHeight,
|
|
20665
20683
|
hasSummary,
|
|
@@ -20681,7 +20699,7 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20681
20699
|
visibleRows: filteredVisibleRows,
|
|
20682
20700
|
frozenState: frozenRows,
|
|
20683
20701
|
getRowKey: (row) => row.kind === "data" ? row.rowKey : null,
|
|
20684
|
-
height,
|
|
20702
|
+
height: contentHeight,
|
|
20685
20703
|
headerHeight,
|
|
20686
20704
|
summaryRowHeight,
|
|
20687
20705
|
hasSummary,
|
|
@@ -20694,7 +20712,7 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20694
20712
|
bodyState.frozenRows.scroll.rowIndexMap = plainRowWindow.rowIndexMap;
|
|
20695
20713
|
bodyState.frozenRows.scroll.rowOffsetMap = plainRowWindow.rowOffsetMap;
|
|
20696
20714
|
bodyState.bodyLayout = resolveBodyLayout({
|
|
20697
|
-
height,
|
|
20715
|
+
height: contentHeight,
|
|
20698
20716
|
headerHeight,
|
|
20699
20717
|
summaryRowHeight,
|
|
20700
20718
|
hasSummary,
|
|
@@ -20718,7 +20736,7 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20718
20736
|
bodyState.frozenRows.scroll.rowIndexMap = plainRowWindow.rowIndexMap;
|
|
20719
20737
|
bodyState.frozenRows.scroll.rowOffsetMap = plainRowWindow.rowOffsetMap;
|
|
20720
20738
|
bodyState.bodyLayout = resolveBodyLayout({
|
|
20721
|
-
height,
|
|
20739
|
+
height: contentHeight,
|
|
20722
20740
|
headerHeight,
|
|
20723
20741
|
summaryRowHeight,
|
|
20724
20742
|
hasSummary,
|
|
@@ -20729,10 +20747,6 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20729
20747
|
scrollRowCount: plainRowWindow.totalRowCount
|
|
20730
20748
|
});
|
|
20731
20749
|
}
|
|
20732
|
-
let columnMetrics = resolveColumnMetrics({
|
|
20733
|
-
columns: leafColumns,
|
|
20734
|
-
tableWidth: width
|
|
20735
|
-
});
|
|
20736
20750
|
let viewportResult = computeViewport({
|
|
20737
20751
|
width,
|
|
20738
20752
|
height,
|
|
@@ -21913,7 +21927,8 @@ function drawSegmentRows(params, segment, columns, startRowIndex, endRowIndex, r
|
|
|
21913
21927
|
params.requestRender,
|
|
21914
21928
|
validationMessage,
|
|
21915
21929
|
intersectRects3(rect, renderClipRect) ?? rect,
|
|
21916
|
-
(params.rangeHighlight ?? EMPTY_RANGE_HIGHLIGHT2).searchMatch
|
|
21930
|
+
(params.rangeHighlight ?? EMPTY_RANGE_HIGHLIGHT2).searchMatch,
|
|
21931
|
+
resolveDensityPaddingBlock(params.rowHeight)
|
|
21917
21932
|
);
|
|
21918
21933
|
if (cell.row.kind === "data") {
|
|
21919
21934
|
applyRowSpanToDescriptors(
|
|
@@ -22012,6 +22027,7 @@ function drawExpandedRowsOverlay(params, startRowIndex, endRowIndex, rowOffsets)
|
|
|
22012
22027
|
progress: expandedRowAnimation.progress,
|
|
22013
22028
|
row,
|
|
22014
22029
|
theme: params.theme,
|
|
22030
|
+
defaultPaddingBlock: resolveDensityPaddingBlock(params.rowHeight),
|
|
22015
22031
|
rowBackgroundColor: params.rowBackgroundColor,
|
|
22016
22032
|
striped: params.striped === true,
|
|
22017
22033
|
descriptors: params.descriptors,
|
|
@@ -22537,7 +22553,7 @@ function getMergedCellWidth(columns, startIndex, colSpan) {
|
|
|
22537
22553
|
}
|
|
22538
22554
|
return width;
|
|
22539
22555
|
}
|
|
22540
|
-
function drawBodyCell(ctx, rect, record, rowIndex, column, theme, rowBackgroundColor, striped, hovered, selected, textSelection, frozen, descriptors, row, expandableConfig, collapseConfig, collapseBoundaryMarkers, getNestedTableHighlight, getControlAnimationProgress, requestRender, validationMessage, visibleRect, searchMatch) {
|
|
22556
|
+
function drawBodyCell(ctx, rect, record, rowIndex, column, theme, rowBackgroundColor, striped, hovered, selected, textSelection, frozen, descriptors, row, expandableConfig, collapseConfig, collapseBoundaryMarkers, getNestedTableHighlight, getControlAnimationProgress, requestRender, validationMessage, visibleRect, searchMatch, defaultPaddingBlock) {
|
|
22541
22557
|
ctx.save();
|
|
22542
22558
|
const paintStyle = resolveBodyCellPaintStyle({
|
|
22543
22559
|
theme,
|
|
@@ -22580,6 +22596,7 @@ function drawBodyCell(ctx, rect, record, rowIndex, column, theme, rowBackgroundC
|
|
|
22580
22596
|
rowIndex,
|
|
22581
22597
|
column,
|
|
22582
22598
|
theme: paintStyle.theme,
|
|
22599
|
+
defaultPaddingBlock,
|
|
22583
22600
|
frozen,
|
|
22584
22601
|
hovered,
|
|
22585
22602
|
descriptors,
|
|
@@ -22931,6 +22948,7 @@ function drawAnimatedExpandedBodyCell(params) {
|
|
|
22931
22948
|
rect,
|
|
22932
22949
|
params.row,
|
|
22933
22950
|
params.theme,
|
|
22951
|
+
params.defaultPaddingBlock,
|
|
22934
22952
|
params.rowBackgroundColor,
|
|
22935
22953
|
params.striped,
|
|
22936
22954
|
params.descriptors,
|
|
@@ -22944,7 +22962,7 @@ function drawAnimatedExpandedBodyCell(params) {
|
|
|
22944
22962
|
ctx.restore();
|
|
22945
22963
|
return tooltip;
|
|
22946
22964
|
}
|
|
22947
|
-
function drawExpandedBodyCell(ctx, rect, row, theme, rowBackgroundColor, striped, descriptors, visibleRect, segment, segments, contentInset, getNestedTableHighlight, textSelection) {
|
|
22965
|
+
function drawExpandedBodyCell(ctx, rect, row, theme, defaultPaddingBlock, rowBackgroundColor, striped, descriptors, visibleRect, segment, segments, contentInset, getNestedTableHighlight, textSelection) {
|
|
22948
22966
|
ctx.save();
|
|
22949
22967
|
ctx.fillStyle = rowBackgroundColor ?? (striped && row.ownerDataRowIndex % 2 === 1 ? theme.stripedBackgroundColor : theme.backgroundColor);
|
|
22950
22968
|
ctx.fillRect(rect.x, rect.y, rect.width, rect.height);
|
|
@@ -22984,6 +23002,7 @@ function drawExpandedBodyCell(ctx, rect, row, theme, rowBackgroundColor, striped
|
|
|
22984
23002
|
rowIndex: row.ownerDataRowIndex,
|
|
22985
23003
|
column: virtualColumn,
|
|
22986
23004
|
theme,
|
|
23005
|
+
defaultPaddingBlock,
|
|
22987
23006
|
frozen: false,
|
|
22988
23007
|
hovered: false,
|
|
22989
23008
|
descriptors,
|
|
@@ -23271,6 +23290,21 @@ function drawFixedLeftBoundary(params) {
|
|
|
23271
23290
|
ctx.stroke();
|
|
23272
23291
|
ctx.restore();
|
|
23273
23292
|
}
|
|
23293
|
+
function drawFixedRightBoundary(params) {
|
|
23294
|
+
const { ctx, rightBoundaryX, fixedWidthRight, height, borderColor } = params;
|
|
23295
|
+
if (fixedWidthRight <= 0 || height <= 0) {
|
|
23296
|
+
return;
|
|
23297
|
+
}
|
|
23298
|
+
const x = Math.round(rightBoundaryX) + 0.5;
|
|
23299
|
+
ctx.save();
|
|
23300
|
+
ctx.strokeStyle = borderColor;
|
|
23301
|
+
ctx.lineWidth = 1;
|
|
23302
|
+
ctx.beginPath();
|
|
23303
|
+
ctx.moveTo(x, 0);
|
|
23304
|
+
ctx.lineTo(x, height);
|
|
23305
|
+
ctx.stroke();
|
|
23306
|
+
ctx.restore();
|
|
23307
|
+
}
|
|
23274
23308
|
function mergeBoundarySkipRanges(skipRanges, height) {
|
|
23275
23309
|
const ranges = skipRanges.map((range) => ({
|
|
23276
23310
|
start: Math.max(Math.min(range.start, height), 0),
|
|
@@ -23517,7 +23551,7 @@ function drawHeaderCell(params, cell, clipRect) {
|
|
|
23517
23551
|
rect,
|
|
23518
23552
|
titleContent,
|
|
23519
23553
|
theme.fontSize,
|
|
23520
|
-
cell.node.style?.paddingBlock ??
|
|
23554
|
+
cell.node.style?.paddingBlock ?? params.defaultPaddingBlock ?? resolveDensityPaddingBlock(cell.height),
|
|
23521
23555
|
cell.node.style?.verticalAlign
|
|
23522
23556
|
);
|
|
23523
23557
|
ctx.textAlign = textLayout.align;
|
|
@@ -24052,6 +24086,15 @@ function findCellByKey(headerRows, columnKey) {
|
|
|
24052
24086
|
return null;
|
|
24053
24087
|
}
|
|
24054
24088
|
|
|
24089
|
+
// src/rendering/pipeline/header-clip.ts
|
|
24090
|
+
function resolveCenterHeaderClipWidth(params) {
|
|
24091
|
+
const centerContentWidth = params.leafColumns.reduce(
|
|
24092
|
+
(total, column) => column.fixed == null ? total + column.width : total,
|
|
24093
|
+
0
|
|
24094
|
+
);
|
|
24095
|
+
return Math.min(params.availableCenterWidth, centerContentWidth);
|
|
24096
|
+
}
|
|
24097
|
+
|
|
24055
24098
|
// src/rendering/pipeline/header-renderer.ts
|
|
24056
24099
|
function drawListTableHeader(params) {
|
|
24057
24100
|
const {
|
|
@@ -24080,10 +24123,14 @@ function drawListTableHeader(params) {
|
|
|
24080
24123
|
draggingReorder,
|
|
24081
24124
|
requestRender
|
|
24082
24125
|
} = params;
|
|
24083
|
-
const
|
|
24126
|
+
const centerClipWidth = resolveCenterHeaderClipWidth({
|
|
24127
|
+
availableCenterWidth,
|
|
24128
|
+
leafColumns
|
|
24129
|
+
});
|
|
24130
|
+
const centerClipRect = centerClipWidth > 0 ? {
|
|
24084
24131
|
x: fixedWidthLeft,
|
|
24085
24132
|
y: 0,
|
|
24086
|
-
width:
|
|
24133
|
+
width: centerClipWidth,
|
|
24087
24134
|
height: headerHeight
|
|
24088
24135
|
} : null;
|
|
24089
24136
|
const collapsedColumnMarkers = resolveCollapsedHeaderColumnMarkers({
|
|
@@ -24096,6 +24143,7 @@ function drawListTableHeader(params) {
|
|
|
24096
24143
|
headerRows,
|
|
24097
24144
|
centerClipRect,
|
|
24098
24145
|
theme,
|
|
24146
|
+
defaultPaddingBlock: typeof options.headerRowHeight === "number" ? resolveDensityPaddingBlock(options.headerRowHeight) : void 0,
|
|
24099
24147
|
descriptors,
|
|
24100
24148
|
hoveredColumnKey: hover.area === "header" || hover.area === "sort-trigger" || hover.area === "filter-trigger" || hover.area === "fixed-trigger" ? hover.columnKey : null,
|
|
24101
24149
|
hoveredActionType: hover.area,
|
|
@@ -24177,6 +24225,7 @@ function drawRowDragInsertionIndicator(params) {
|
|
|
24177
24225
|
}
|
|
24178
24226
|
|
|
24179
24227
|
// src/rendering/pipeline/active-cell-overlay.ts
|
|
24228
|
+
var RIGHT_BORDER_CLIP_BLEED = 1;
|
|
24180
24229
|
function resolveActiveCellOverlayLayout(params) {
|
|
24181
24230
|
const { selection } = params;
|
|
24182
24231
|
const descriptor = selection.rowIndex != null && selection.columnKey != null ? params.descriptors.find(
|
|
@@ -24331,15 +24380,69 @@ function resolveRangeHighlightLayouts(params) {
|
|
|
24331
24380
|
omitRight: range.rect.x + range.rect.width < maxX
|
|
24332
24381
|
};
|
|
24333
24382
|
});
|
|
24383
|
+
const rangeSegments = resolveRangeBorderSegments(
|
|
24384
|
+
selected,
|
|
24385
|
+
params.resolveClipRect
|
|
24386
|
+
);
|
|
24334
24387
|
return {
|
|
24335
24388
|
rects,
|
|
24336
24389
|
segments: roundRangeBorderAtTableBottom(
|
|
24337
|
-
|
|
24390
|
+
removeRangeSegmentsAtSharedLayerBoundaries(rangeSegments, ranges),
|
|
24338
24391
|
params.width,
|
|
24339
24392
|
params.height
|
|
24340
24393
|
)
|
|
24341
24394
|
};
|
|
24342
24395
|
}
|
|
24396
|
+
function removeRangeSegmentsAtSharedLayerBoundaries(segments, ranges) {
|
|
24397
|
+
const tolerance = 1;
|
|
24398
|
+
const sharedBoundaries = [];
|
|
24399
|
+
const visibleRanges = ranges.map((range) => intersectRangeWithClip(range.rect, range.clipRect)).filter((range) => range != null);
|
|
24400
|
+
visibleRanges.forEach((left, leftIndex) => {
|
|
24401
|
+
visibleRanges.slice(leftIndex + 1).forEach((right) => {
|
|
24402
|
+
const leftEdge = left.x + left.width;
|
|
24403
|
+
const rightEdge = right.x;
|
|
24404
|
+
const reverseLeftEdge = right.x + right.width;
|
|
24405
|
+
const reverseRightEdge = left.x;
|
|
24406
|
+
const boundary = Math.abs(leftEdge - rightEdge) <= tolerance ? (leftEdge + rightEdge) / 2 : Math.abs(reverseLeftEdge - reverseRightEdge) <= tolerance ? (reverseLeftEdge + reverseRightEdge) / 2 : null;
|
|
24407
|
+
if (boundary == null) {
|
|
24408
|
+
return;
|
|
24409
|
+
}
|
|
24410
|
+
const top = Math.max(left.y, right.y);
|
|
24411
|
+
const bottom = Math.min(
|
|
24412
|
+
left.y + left.height,
|
|
24413
|
+
right.y + right.height
|
|
24414
|
+
);
|
|
24415
|
+
if (bottom > top) {
|
|
24416
|
+
sharedBoundaries.push({ x: boundary, top, bottom });
|
|
24417
|
+
}
|
|
24418
|
+
});
|
|
24419
|
+
});
|
|
24420
|
+
return segments.filter((segment) => {
|
|
24421
|
+
if (!nearlyEqual(segment.startX, segment.endX)) {
|
|
24422
|
+
return true;
|
|
24423
|
+
}
|
|
24424
|
+
const top = Math.min(segment.startY, segment.endY);
|
|
24425
|
+
const bottom = Math.max(segment.startY, segment.endY);
|
|
24426
|
+
return !sharedBoundaries.some(
|
|
24427
|
+
(boundary) => Math.abs(segment.startX - boundary.x) <= tolerance && bottom > boundary.top && top < boundary.bottom
|
|
24428
|
+
);
|
|
24429
|
+
});
|
|
24430
|
+
}
|
|
24431
|
+
function intersectRangeWithClip(rect, clipRect) {
|
|
24432
|
+
const left = Math.max(rect.x, clipRect.x);
|
|
24433
|
+
const top = Math.max(rect.y, clipRect.y);
|
|
24434
|
+
const right = Math.min(rect.x + rect.width, clipRect.x + clipRect.width);
|
|
24435
|
+
const bottom = Math.min(rect.y + rect.height, clipRect.y + clipRect.height);
|
|
24436
|
+
if (right <= left || bottom <= top) {
|
|
24437
|
+
return null;
|
|
24438
|
+
}
|
|
24439
|
+
return {
|
|
24440
|
+
x: left,
|
|
24441
|
+
y: top,
|
|
24442
|
+
width: right - left,
|
|
24443
|
+
height: bottom - top
|
|
24444
|
+
};
|
|
24445
|
+
}
|
|
24343
24446
|
function roundRangeBorderAtTableBottom(segments, width, height) {
|
|
24344
24447
|
const inset = 0.5;
|
|
24345
24448
|
const left = inset;
|
|
@@ -24533,11 +24636,11 @@ function drawRangeHighlightBorder(ctx, rect, edges = {}) {
|
|
|
24533
24636
|
}
|
|
24534
24637
|
function resolveActiveCellSectionClipRect(descriptor, params) {
|
|
24535
24638
|
const horizontal = descriptor.fixed === "left" ? { x: 0, width: params.fixedWidthLeft } : descriptor.fixed === "right" ? {
|
|
24536
|
-
x: params.
|
|
24537
|
-
width: params.fixedWidthRight
|
|
24639
|
+
x: params.rightStartX,
|
|
24640
|
+
width: params.fixedWidthRight + RIGHT_BORDER_CLIP_BLEED
|
|
24538
24641
|
} : {
|
|
24539
24642
|
x: params.fixedWidthLeft,
|
|
24540
|
-
width: params.
|
|
24643
|
+
width: Math.max(params.rightStartX - params.fixedWidthLeft, 0) + RIGHT_BORDER_CLIP_BLEED
|
|
24541
24644
|
};
|
|
24542
24645
|
if (!descriptor.frozen) {
|
|
24543
24646
|
return {
|
|
@@ -24753,6 +24856,33 @@ function executeListTableRenderPipeline(params) {
|
|
|
24753
24856
|
borderColor: theme.borderColor,
|
|
24754
24857
|
skipRanges: fixedLeftBoundarySkips
|
|
24755
24858
|
});
|
|
24859
|
+
drawFixedRightBoundary({
|
|
24860
|
+
ctx,
|
|
24861
|
+
rightBoundaryX: snapshot.columnMetrics.rightStartX + snapshot.columnMetrics.fixedWidthRight,
|
|
24862
|
+
fixedWidthRight: snapshot.columnMetrics.fixedWidthRight,
|
|
24863
|
+
height,
|
|
24864
|
+
borderColor: theme.borderColor
|
|
24865
|
+
});
|
|
24866
|
+
drawScrollbars(
|
|
24867
|
+
ctx,
|
|
24868
|
+
snapshot.scrollbarLayout,
|
|
24869
|
+
descriptors,
|
|
24870
|
+
theme.borderColor,
|
|
24871
|
+
scrollbarOpacity,
|
|
24872
|
+
isScrollbarInteractive,
|
|
24873
|
+
{
|
|
24874
|
+
x: width,
|
|
24875
|
+
width: options.scrollbar?.visible === false ? 0 : Math.max(
|
|
24876
|
+
options.scrollbar?.thickness ?? DEFAULT_SCROLLBAR_THICKNESS,
|
|
24877
|
+
6
|
|
24878
|
+
),
|
|
24879
|
+
top: 0,
|
|
24880
|
+
height,
|
|
24881
|
+
headerBottom: headerHeight,
|
|
24882
|
+
headerBackgroundColor: theme.headerBackgroundColor,
|
|
24883
|
+
bodyBackgroundColor: theme.backgroundColor
|
|
24884
|
+
}
|
|
24885
|
+
);
|
|
24756
24886
|
drawActiveCellOverlay({
|
|
24757
24887
|
ctx,
|
|
24758
24888
|
layout: resolveActiveCellOverlayLayout({
|
|
@@ -24768,6 +24898,7 @@ function executeListTableRenderPipeline(params) {
|
|
|
24768
24898
|
bottomFrozenHeight,
|
|
24769
24899
|
fixedWidthLeft: snapshot.columnMetrics.fixedWidthLeft,
|
|
24770
24900
|
fixedWidthRight: snapshot.columnMetrics.fixedWidthRight,
|
|
24901
|
+
rightStartX: snapshot.columnMetrics.rightStartX,
|
|
24771
24902
|
availableCenterWidth: snapshot.columnMetrics.availableCenterWidth,
|
|
24772
24903
|
rangeHighlight,
|
|
24773
24904
|
highlightMode: options.highlightMode,
|
|
@@ -24781,26 +24912,6 @@ function executeListTableRenderPipeline(params) {
|
|
|
24781
24912
|
indicatorY: rowDragIndicator.y
|
|
24782
24913
|
});
|
|
24783
24914
|
}
|
|
24784
|
-
drawScrollbars(
|
|
24785
|
-
ctx,
|
|
24786
|
-
snapshot.scrollbarLayout,
|
|
24787
|
-
descriptors,
|
|
24788
|
-
theme.borderColor,
|
|
24789
|
-
scrollbarOpacity,
|
|
24790
|
-
isScrollbarInteractive,
|
|
24791
|
-
{
|
|
24792
|
-
x: width,
|
|
24793
|
-
width: options.scrollbar?.visible === false ? 0 : Math.max(
|
|
24794
|
-
options.scrollbar?.thickness ?? DEFAULT_SCROLLBAR_THICKNESS,
|
|
24795
|
-
6
|
|
24796
|
-
),
|
|
24797
|
-
top: 0,
|
|
24798
|
-
height,
|
|
24799
|
-
headerBottom: headerHeight,
|
|
24800
|
-
headerBackgroundColor: theme.headerBackgroundColor,
|
|
24801
|
-
bodyBackgroundColor: theme.backgroundColor
|
|
24802
|
-
}
|
|
24803
|
-
);
|
|
24804
24915
|
if (headerDraggingIndicator) {
|
|
24805
24916
|
drawDragOverlayFrame({
|
|
24806
24917
|
ctx,
|
|
@@ -27099,6 +27210,11 @@ function collectGroupingColumnItems(columns) {
|
|
|
27099
27210
|
});
|
|
27100
27211
|
}
|
|
27101
27212
|
|
|
27213
|
+
// src/engine/column-config-update-policy.ts
|
|
27214
|
+
function shouldPersistIncomingColumnConfig(previousRevision, nextRevision) {
|
|
27215
|
+
return nextRevision !== void 0 && nextRevision !== previousRevision;
|
|
27216
|
+
}
|
|
27217
|
+
|
|
27102
27218
|
// src/engine/list-table-engine.ts
|
|
27103
27219
|
var ListTableCore = class {
|
|
27104
27220
|
/**
|
|
@@ -27190,6 +27306,10 @@ var ListTableCore = class {
|
|
|
27190
27306
|
updateOptions(options) {
|
|
27191
27307
|
this.animationController.stopCarouselScroll();
|
|
27192
27308
|
const host = this.asAssemblyHost();
|
|
27309
|
+
const shouldPersistColumnConfig = shouldPersistIncomingColumnConfig(
|
|
27310
|
+
this.options.columnConfigRevision,
|
|
27311
|
+
options.columnConfigRevision
|
|
27312
|
+
);
|
|
27193
27313
|
const incomingColumnsAreRuntimeColumns = options.columns === this.options.columns;
|
|
27194
27314
|
const nextInitialColumns = incomingColumnsAreRuntimeColumns ? cloneColumns(host.initialColumns) : cloneColumns(options.columns);
|
|
27195
27315
|
const nextInitialStretchColumns = incomingColumnsAreRuntimeColumns ? host.initialStretchColumns : options.stretchColumns;
|
|
@@ -27233,7 +27353,11 @@ var ListTableCore = class {
|
|
|
27233
27353
|
this.hideFloatingOverlays({ includeLoading: true });
|
|
27234
27354
|
this.refreshRuntimeColumns();
|
|
27235
27355
|
this.renderController.render();
|
|
27236
|
-
|
|
27356
|
+
if (shouldPersistColumnConfig) {
|
|
27357
|
+
this.persistenceController.persistColumnConfig();
|
|
27358
|
+
} else {
|
|
27359
|
+
this.persistenceController.loadStoredConfig({ restoreQueryState: false });
|
|
27360
|
+
}
|
|
27237
27361
|
host.tableId = options.tableId?.trim() ? options.tableId : host.tableId;
|
|
27238
27362
|
host.rowDragController.syncRegistration();
|
|
27239
27363
|
}
|
|
@@ -27282,7 +27406,7 @@ var ListTableCore = class {
|
|
|
27282
27406
|
*/
|
|
27283
27407
|
changeDensity(density) {
|
|
27284
27408
|
this.headerActionController.changeTableDensity(
|
|
27285
|
-
density === "auto" ? "auto" : density === 32 ? "compact" : density === 56 ? "comfortable" : "middle"
|
|
27409
|
+
density === "auto" ? "auto" : density === 26 ? "ultra-compact" : density === 32 ? "compact" : density === 56 ? "comfortable" : "middle"
|
|
27286
27410
|
);
|
|
27287
27411
|
}
|
|
27288
27412
|
/**
|