@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.cjs
CHANGED
|
@@ -3175,7 +3175,7 @@ function drawBodyBarcodeContent(params) {
|
|
|
3175
3175
|
opacity: resolveContentOpacity(content),
|
|
3176
3176
|
displayValue: content.showText,
|
|
3177
3177
|
text: content.text,
|
|
3178
|
-
fontSize: resolveContentFontSize(content,
|
|
3178
|
+
fontSize: resolveContentFontSize(content, theme.fontSize),
|
|
3179
3179
|
fontWeight: resolveContentFontWeight(content, ""),
|
|
3180
3180
|
fontFamily: resolveContentFontFamily(content, theme),
|
|
3181
3181
|
textColor: content.style?.color ?? content.color
|
|
@@ -3183,7 +3183,7 @@ function drawBodyBarcodeContent(params) {
|
|
|
3183
3183
|
ctx.restore();
|
|
3184
3184
|
if (content.showText) {
|
|
3185
3185
|
const text = content.text ?? content.value;
|
|
3186
|
-
const fontSize = resolveContentFontSize(content,
|
|
3186
|
+
const fontSize = resolveContentFontSize(content, theme.fontSize);
|
|
3187
3187
|
const font = buildCanvasFont({
|
|
3188
3188
|
fontWeight: resolveContentFontWeight(content, ""),
|
|
3189
3189
|
fontSize,
|
|
@@ -3253,12 +3253,6 @@ var BUTTON_HEIGHT_MAP = {
|
|
|
3253
3253
|
medium: 32,
|
|
3254
3254
|
large: 40
|
|
3255
3255
|
};
|
|
3256
|
-
var BUTTON_FONT_SIZE_MAP = {
|
|
3257
|
-
small: 14,
|
|
3258
|
-
middle: 14,
|
|
3259
|
-
medium: 14,
|
|
3260
|
-
large: 16
|
|
3261
|
-
};
|
|
3262
3256
|
var BUTTON_PADDING_INLINE_MAP = {
|
|
3263
3257
|
small: 7,
|
|
3264
3258
|
middle: 15,
|
|
@@ -3410,10 +3404,9 @@ function measureButtonContentHeight(content) {
|
|
|
3410
3404
|
return BUTTON_HEIGHT_MAP[resolveButtonSize(content.size)];
|
|
3411
3405
|
}
|
|
3412
3406
|
function applyButtonTextStyle(ctx, content, theme) {
|
|
3413
|
-
const size = resolveButtonSize(content.size);
|
|
3414
3407
|
ctx.font = buildCanvasFont({
|
|
3415
3408
|
fontWeight: resolveContentFontWeight(content, "400"),
|
|
3416
|
-
fontSize: resolveContentFontSize(content,
|
|
3409
|
+
fontSize: resolveContentFontSize(content, theme.fontSize),
|
|
3417
3410
|
fontFamily: resolveContentFontFamily(content, theme)
|
|
3418
3411
|
});
|
|
3419
3412
|
ctx.textAlign = "left";
|
|
@@ -4952,7 +4945,7 @@ function measureProgressContentWidth(ctx, content, theme) {
|
|
|
4952
4945
|
}
|
|
4953
4946
|
function measureProgressContentHeight(content, theme) {
|
|
4954
4947
|
const shape = content.shape ?? "line";
|
|
4955
|
-
const textHeight = shouldShowProgressLabel(content) ? resolveContentFontSize(content,
|
|
4948
|
+
const textHeight = shouldShowProgressLabel(content) ? resolveContentFontSize(content, theme.fontSize) : 0;
|
|
4956
4949
|
const sizeMetrics = resolveProgressSizeMetrics(content, shape);
|
|
4957
4950
|
if (shape === "circle") {
|
|
4958
4951
|
return Math.max(sizeMetrics.height, sizeMetrics.width, 20);
|
|
@@ -5054,7 +5047,7 @@ function resolveProgressMetrics(ctx, content, theme) {
|
|
|
5054
5047
|
const sizeMetrics = resolveProgressSizeMetrics(content, shape);
|
|
5055
5048
|
applyProgressTextStyle(ctx, content, theme);
|
|
5056
5049
|
const textWidth = showLabel && progressText ? ctx.measureText(progressText).width : 0;
|
|
5057
|
-
const textHeight = showLabel ? resolveContentFontSize(content,
|
|
5050
|
+
const textHeight = showLabel ? resolveContentFontSize(content, theme.fontSize) : 0;
|
|
5058
5051
|
if (shape === "circle") {
|
|
5059
5052
|
return {
|
|
5060
5053
|
width: Math.max(sizeMetrics.width, 20),
|
|
@@ -5169,7 +5162,7 @@ function resolveProgressTextColor(content) {
|
|
|
5169
5162
|
function applyProgressTextStyle(ctx, content, theme) {
|
|
5170
5163
|
ctx.font = buildCanvasFont({
|
|
5171
5164
|
fontWeight: resolveContentFontWeight(content, "500"),
|
|
5172
|
-
fontSize: resolveContentFontSize(content,
|
|
5165
|
+
fontSize: resolveContentFontSize(content, theme.fontSize),
|
|
5173
5166
|
fontFamily: resolveContentFontFamily(content, theme)
|
|
5174
5167
|
});
|
|
5175
5168
|
ctx.textBaseline = "middle";
|
|
@@ -5689,7 +5682,7 @@ function drawSwitchControl(ctx, rect, content, theme, animationProgress, beforeT
|
|
|
5689
5682
|
const displayText = normalizedProgress >= 0.5 ? content.checkedChildren ?? "" : content.uncheckedChildren ?? "";
|
|
5690
5683
|
if (displayText) {
|
|
5691
5684
|
ctx.fillStyle = textColor;
|
|
5692
|
-
ctx.font =
|
|
5685
|
+
ctx.font = `${theme.fontSize}px ${theme.fontFamily}`;
|
|
5693
5686
|
ctx.textBaseline = "alphabetic";
|
|
5694
5687
|
ctx.textAlign = checked ? "left" : "right";
|
|
5695
5688
|
const metrics = ctx.measureText(displayText);
|
|
@@ -5722,7 +5715,7 @@ function resolveSwitchTextLayout(ctx, rect, content, theme, animationProgress) {
|
|
|
5722
5715
|
const text = normalizedProgress >= 0.5 ? content.checkedChildren ?? "" : content.uncheckedChildren ?? "";
|
|
5723
5716
|
if (!text) return null;
|
|
5724
5717
|
ctx.save();
|
|
5725
|
-
ctx.font =
|
|
5718
|
+
ctx.font = `${theme.fontSize}px ${theme.fontFamily}`;
|
|
5726
5719
|
const metrics = ctx.measureText(text);
|
|
5727
5720
|
const ascent = metrics.actualBoundingBoxAscent ?? 0;
|
|
5728
5721
|
const descent = metrics.actualBoundingBoxDescent ?? 0;
|
|
@@ -5740,7 +5733,7 @@ function measureSwitchContentWidth(ctx, content, theme) {
|
|
|
5740
5733
|
return SWITCH_MIN_WIDTH;
|
|
5741
5734
|
}
|
|
5742
5735
|
ctx.save();
|
|
5743
|
-
ctx.font =
|
|
5736
|
+
ctx.font = `${theme.fontSize}px ${theme.fontFamily}`;
|
|
5744
5737
|
const maxTextWidth = Math.max(
|
|
5745
5738
|
ctx.measureText(checkedText).width,
|
|
5746
5739
|
ctx.measureText(uncheckedText).width
|
|
@@ -5885,7 +5878,7 @@ function drawBodyTagContent(params) {
|
|
|
5885
5878
|
ctx.fillStyle = textColor;
|
|
5886
5879
|
ctx.font = buildCanvasFont({
|
|
5887
5880
|
fontWeight: resolveContentFontWeight(content, "500"),
|
|
5888
|
-
fontSize: resolveContentFontSize(content,
|
|
5881
|
+
fontSize: resolveContentFontSize(content, theme.fontSize),
|
|
5889
5882
|
fontFamily: resolveContentFontFamily(content, theme)
|
|
5890
5883
|
});
|
|
5891
5884
|
ctx.textAlign = "left";
|
|
@@ -5974,7 +5967,7 @@ function measureTagContentWidth(ctx, content, theme) {
|
|
|
5974
5967
|
function applyTagTextStyle(ctx, content, theme) {
|
|
5975
5968
|
ctx.font = buildCanvasFont({
|
|
5976
5969
|
fontWeight: resolveContentFontWeight(content, "500"),
|
|
5977
|
-
fontSize: resolveContentFontSize(content,
|
|
5970
|
+
fontSize: resolveContentFontSize(content, theme.fontSize),
|
|
5978
5971
|
fontFamily: resolveContentFontFamily(content, theme)
|
|
5979
5972
|
});
|
|
5980
5973
|
ctx.textAlign = "left";
|
|
@@ -6692,7 +6685,7 @@ function drawBodyCellContents(params) {
|
|
|
6692
6685
|
return void 0;
|
|
6693
6686
|
}
|
|
6694
6687
|
const paddingInline = column.cellStyle?.paddingInline ?? CONTENT_HORIZONTAL_PADDING;
|
|
6695
|
-
const paddingBlock = column.cellStyle?.paddingBlock ?? CONTENT_VERTICAL_PADDING;
|
|
6688
|
+
const paddingBlock = column.cellStyle?.paddingBlock ?? params.defaultPaddingBlock ?? CONTENT_VERTICAL_PADDING;
|
|
6696
6689
|
const availableWidth = Math.max(rect.width - paddingInline * 2, 0);
|
|
6697
6690
|
const availableHeight = Math.max(rect.height - paddingBlock * 2, 0);
|
|
6698
6691
|
if (availableWidth <= 0 || availableHeight <= 0) {
|
|
@@ -7598,7 +7591,7 @@ function getBodyCellContentsLineHeight(contents, theme) {
|
|
|
7598
7591
|
lineHeight = Math.max(
|
|
7599
7592
|
lineHeight,
|
|
7600
7593
|
Math.max(
|
|
7601
|
-
item.style?.fontSize ?? item.fontSize ??
|
|
7594
|
+
item.style?.fontSize ?? item.fontSize ?? theme.fontSize,
|
|
7602
7595
|
12
|
|
7603
7596
|
) + 10,
|
|
7604
7597
|
item.height ?? 22
|
|
@@ -11658,9 +11651,51 @@ function setValueByDataIndex(record, dataIndex, value) {
|
|
|
11658
11651
|
return true;
|
|
11659
11652
|
}
|
|
11660
11653
|
|
|
11654
|
+
// src/shared/theme/density.ts
|
|
11655
|
+
var ULTRA_COMPACT_ROW_HEIGHT = 26;
|
|
11656
|
+
var ULTRA_COMPACT_PADDING_BLOCK = 2;
|
|
11657
|
+
var DEFAULT_PADDING_BLOCK = 6;
|
|
11658
|
+
function resolveDensitySizes(density) {
|
|
11659
|
+
if (density === "auto") {
|
|
11660
|
+
return {
|
|
11661
|
+
rowHeight: "auto",
|
|
11662
|
+
headerRowHeight: void 0,
|
|
11663
|
+
summaryRowHeight: void 0
|
|
11664
|
+
};
|
|
11665
|
+
}
|
|
11666
|
+
if (density === "comfortable") {
|
|
11667
|
+
return {
|
|
11668
|
+
rowHeight: 56,
|
|
11669
|
+
headerRowHeight: 56,
|
|
11670
|
+
summaryRowHeight: 56
|
|
11671
|
+
};
|
|
11672
|
+
}
|
|
11673
|
+
if (density === "ultra-compact") {
|
|
11674
|
+
return {
|
|
11675
|
+
rowHeight: ULTRA_COMPACT_ROW_HEIGHT,
|
|
11676
|
+
headerRowHeight: ULTRA_COMPACT_ROW_HEIGHT,
|
|
11677
|
+
summaryRowHeight: ULTRA_COMPACT_ROW_HEIGHT
|
|
11678
|
+
};
|
|
11679
|
+
}
|
|
11680
|
+
if (density === "compact") {
|
|
11681
|
+
return {
|
|
11682
|
+
rowHeight: 32,
|
|
11683
|
+
headerRowHeight: 32,
|
|
11684
|
+
summaryRowHeight: 32
|
|
11685
|
+
};
|
|
11686
|
+
}
|
|
11687
|
+
return {
|
|
11688
|
+
rowHeight: 48,
|
|
11689
|
+
headerRowHeight: 48,
|
|
11690
|
+
summaryRowHeight: 48
|
|
11691
|
+
};
|
|
11692
|
+
}
|
|
11693
|
+
function resolveDensityPaddingBlock(rowHeight) {
|
|
11694
|
+
return rowHeight <= ULTRA_COMPACT_ROW_HEIGHT ? ULTRA_COMPACT_PADDING_BLOCK : DEFAULT_PADDING_BLOCK;
|
|
11695
|
+
}
|
|
11696
|
+
|
|
11661
11697
|
// src/features/editing/editing-feature.ts
|
|
11662
11698
|
var DEFAULT_EDITOR_PADDING_INLINE = 12;
|
|
11663
|
-
var DEFAULT_EDITOR_PADDING_BLOCK = 6;
|
|
11664
11699
|
function openCellEditingSession(params) {
|
|
11665
11700
|
const {
|
|
11666
11701
|
rowIndex,
|
|
@@ -11678,7 +11713,8 @@ function openCellEditingSession(params) {
|
|
|
11678
11713
|
onCommit,
|
|
11679
11714
|
onCancel,
|
|
11680
11715
|
onNavigate,
|
|
11681
|
-
initialValue
|
|
11716
|
+
initialValue,
|
|
11717
|
+
defaultPaddingBlock
|
|
11682
11718
|
} = params;
|
|
11683
11719
|
const column = leafColumns.find((item) => item.key === columnKey);
|
|
11684
11720
|
const record = rows[rowIndex];
|
|
@@ -11712,7 +11748,7 @@ function openCellEditingSession(params) {
|
|
|
11712
11748
|
const hostRect = toHostRect ? toHostRect(descriptor.rect) : descriptor.rect;
|
|
11713
11749
|
const zoom = typeof theme.contentZoom === "number" && Number.isFinite(theme.contentZoom) && theme.contentZoom > 0 ? theme.contentZoom : 1;
|
|
11714
11750
|
const paddingInline = (column.cellStyle?.paddingInline ?? DEFAULT_EDITOR_PADDING_INLINE) * zoom;
|
|
11715
|
-
const paddingBlock = (column.cellStyle?.paddingBlock ??
|
|
11751
|
+
const paddingBlock = (column.cellStyle?.paddingBlock ?? defaultPaddingBlock ?? resolveDensityPaddingBlock(descriptor.rect.height)) * zoom;
|
|
11716
11752
|
const editorTheme = {
|
|
11717
11753
|
fontSize: theme.fontSize,
|
|
11718
11754
|
fontFamily: theme.fontFamily,
|
|
@@ -11991,6 +12027,7 @@ var ListTableEditingController = class {
|
|
|
11991
12027
|
this.options.clearBodyTooltip();
|
|
11992
12028
|
const zoom = this.options.getTableZoom() > 0 ? this.options.getTableZoom() : 1;
|
|
11993
12029
|
const theme = this.options.getTheme();
|
|
12030
|
+
const configuredRowHeight = this.options.getOptions().rowHeight;
|
|
11994
12031
|
this.editingSession = openCellEditingSession({
|
|
11995
12032
|
rowIndex,
|
|
11996
12033
|
columnKey,
|
|
@@ -12008,6 +12045,7 @@ var ListTableEditingController = class {
|
|
|
12008
12045
|
textColor: theme.textColor,
|
|
12009
12046
|
contentZoom: zoom
|
|
12010
12047
|
},
|
|
12048
|
+
defaultPaddingBlock: typeof configuredRowHeight === "number" ? resolveDensityPaddingBlock(configuredRowHeight) : void 0,
|
|
12011
12049
|
editorFactory: this.options.getEditorFactory(),
|
|
12012
12050
|
onEditorRequest: this.options.getOptions().ui?.onEditorRequest,
|
|
12013
12051
|
onCommit: (commitOptions) => {
|
|
@@ -13957,6 +13995,9 @@ function resolveContextMenuDensity(rowHeight) {
|
|
|
13957
13995
|
if (rowHeight === 56) {
|
|
13958
13996
|
return "comfortable";
|
|
13959
13997
|
}
|
|
13998
|
+
if (rowHeight === 26) {
|
|
13999
|
+
return "ultra-compact";
|
|
14000
|
+
}
|
|
13960
14001
|
if (rowHeight === 32) {
|
|
13961
14002
|
return "compact";
|
|
13962
14003
|
}
|
|
@@ -17768,36 +17809,6 @@ function resolveToggleHeaderColumnVisibilityAction(params) {
|
|
|
17768
17809
|
return toggleHeaderColumnVisibility(params);
|
|
17769
17810
|
}
|
|
17770
17811
|
|
|
17771
|
-
// src/shared/theme/density.ts
|
|
17772
|
-
function resolveDensitySizes(density) {
|
|
17773
|
-
if (density === "auto") {
|
|
17774
|
-
return {
|
|
17775
|
-
rowHeight: "auto",
|
|
17776
|
-
headerRowHeight: void 0,
|
|
17777
|
-
summaryRowHeight: void 0
|
|
17778
|
-
};
|
|
17779
|
-
}
|
|
17780
|
-
if (density === "comfortable") {
|
|
17781
|
-
return {
|
|
17782
|
-
rowHeight: 56,
|
|
17783
|
-
headerRowHeight: 56,
|
|
17784
|
-
summaryRowHeight: 56
|
|
17785
|
-
};
|
|
17786
|
-
}
|
|
17787
|
-
if (density === "compact") {
|
|
17788
|
-
return {
|
|
17789
|
-
rowHeight: 32,
|
|
17790
|
-
headerRowHeight: 32,
|
|
17791
|
-
summaryRowHeight: 32
|
|
17792
|
-
};
|
|
17793
|
-
}
|
|
17794
|
-
return {
|
|
17795
|
-
rowHeight: 48,
|
|
17796
|
-
headerRowHeight: 48,
|
|
17797
|
-
summaryRowHeight: 48
|
|
17798
|
-
};
|
|
17799
|
-
}
|
|
17800
|
-
|
|
17801
17812
|
// src/shared/filter/filter-panel-data.ts
|
|
17802
17813
|
function resolveFilterPanelDataSource(params) {
|
|
17803
17814
|
if (params.queryRowsOverrideBase) {
|
|
@@ -18454,7 +18465,7 @@ function buildStoredColumnConfig(columns, sortState, filterState, zoom, summaryR
|
|
|
18454
18465
|
filters: filterState,
|
|
18455
18466
|
...typeof zoom === "number" && Number.isFinite(zoom) && zoom > 0 ? { zoom } : null,
|
|
18456
18467
|
...typeof summaryRowHeight === "number" && Number.isFinite(summaryRowHeight) && summaryRowHeight >= 0 ? { summaryRowHeight } : null,
|
|
18457
|
-
...density === 32 || density === 48 || density === 56 || density === "auto" ? { density } : null
|
|
18468
|
+
...density === 26 || density === 32 || density === 48 || density === 56 || density === "auto" ? { density } : null
|
|
18458
18469
|
};
|
|
18459
18470
|
}
|
|
18460
18471
|
|
|
@@ -18545,7 +18556,7 @@ async function loadListTableStoredConfig(params) {
|
|
|
18545
18556
|
filterState: stored.filters ? stored.filters : null,
|
|
18546
18557
|
zoom: typeof stored.zoom === "number" && Number.isFinite(stored.zoom) && stored.zoom > 0 ? stored.zoom : null,
|
|
18547
18558
|
summaryRowHeight: typeof stored.summaryRowHeight === "number" && Number.isFinite(stored.summaryRowHeight) && stored.summaryRowHeight >= 0 ? stored.summaryRowHeight : null,
|
|
18548
|
-
density: stored.density === 32 || stored.density === 48 || stored.density === 56 || stored.density === "auto" ? stored.density : null
|
|
18559
|
+
density: stored.density === 26 || stored.density === 32 || stored.density === 48 || stored.density === 56 || stored.density === "auto" ? stored.density : null
|
|
18549
18560
|
};
|
|
18550
18561
|
}
|
|
18551
18562
|
|
|
@@ -18580,7 +18591,7 @@ var ListTablePersistenceController = class {
|
|
|
18580
18591
|
let currentOptions = this.options.getOptions();
|
|
18581
18592
|
if (stored.density != null) {
|
|
18582
18593
|
const densitySizes = resolveDensitySizes(
|
|
18583
|
-
stored.density === "auto" ? "auto" : stored.density === 32 ? "compact" : stored.density === 56 ? "comfortable" : "middle"
|
|
18594
|
+
stored.density === "auto" ? "auto" : stored.density === 26 ? "ultra-compact" : stored.density === 32 ? "compact" : stored.density === 56 ? "comfortable" : "middle"
|
|
18584
18595
|
);
|
|
18585
18596
|
currentOptions = {
|
|
18586
18597
|
...currentOptions,
|
|
@@ -20489,6 +20500,10 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20489
20500
|
if (leafColumns.length === 0) {
|
|
20490
20501
|
return null;
|
|
20491
20502
|
}
|
|
20503
|
+
const columnMetrics = resolveColumnMetrics({
|
|
20504
|
+
columns: leafColumns,
|
|
20505
|
+
tableWidth: width
|
|
20506
|
+
});
|
|
20492
20507
|
const headerInfo = buildHeaderTree(normalizedColumns, leafColumns);
|
|
20493
20508
|
const sourceQueryRows = {
|
|
20494
20509
|
baseRows: baseRowsOverride ?? getBaseDisplayRows({
|
|
@@ -20530,8 +20545,11 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20530
20545
|
(col) => col.summary != null || col.summaryTitle != null
|
|
20531
20546
|
);
|
|
20532
20547
|
const hasSummary = queryRows.displayRows.length > 0 && options.summaryRowHeight !== 0 && (options.summaryRowHeight != null || hasConfiguredSummary);
|
|
20548
|
+
const hasHorizontalScrollbar = options.scrollbar?.visible !== false && columnMetrics.centerContentWidth - columnMetrics.availableCenterWidth > 1;
|
|
20549
|
+
const horizontalScrollbarReserve = hasSummary && hasHorizontalScrollbar ? scrollbarThickness + Math.max(options.scrollbar?.horizontalBottom ?? 0, 0) : 0;
|
|
20550
|
+
const contentHeight = Math.max(height - horizontalScrollbarReserve, 0);
|
|
20533
20551
|
const initialBodyLayout = resolveBodyLayout({
|
|
20534
|
-
height,
|
|
20552
|
+
height: contentHeight,
|
|
20535
20553
|
headerHeight,
|
|
20536
20554
|
summaryRowHeight,
|
|
20537
20555
|
hasSummary,
|
|
@@ -20661,7 +20679,7 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20661
20679
|
}
|
|
20662
20680
|
},
|
|
20663
20681
|
bodyLayout: resolveBodyLayout({
|
|
20664
|
-
height,
|
|
20682
|
+
height: contentHeight,
|
|
20665
20683
|
headerHeight,
|
|
20666
20684
|
summaryRowHeight,
|
|
20667
20685
|
hasSummary,
|
|
@@ -20683,7 +20701,7 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20683
20701
|
visibleRows: filteredVisibleRows,
|
|
20684
20702
|
frozenState: frozenRows,
|
|
20685
20703
|
getRowKey: (row) => row.kind === "data" ? row.rowKey : null,
|
|
20686
|
-
height,
|
|
20704
|
+
height: contentHeight,
|
|
20687
20705
|
headerHeight,
|
|
20688
20706
|
summaryRowHeight,
|
|
20689
20707
|
hasSummary,
|
|
@@ -20696,7 +20714,7 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20696
20714
|
bodyState.frozenRows.scroll.rowIndexMap = plainRowWindow.rowIndexMap;
|
|
20697
20715
|
bodyState.frozenRows.scroll.rowOffsetMap = plainRowWindow.rowOffsetMap;
|
|
20698
20716
|
bodyState.bodyLayout = resolveBodyLayout({
|
|
20699
|
-
height,
|
|
20717
|
+
height: contentHeight,
|
|
20700
20718
|
headerHeight,
|
|
20701
20719
|
summaryRowHeight,
|
|
20702
20720
|
hasSummary,
|
|
@@ -20720,7 +20738,7 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20720
20738
|
bodyState.frozenRows.scroll.rowIndexMap = plainRowWindow.rowIndexMap;
|
|
20721
20739
|
bodyState.frozenRows.scroll.rowOffsetMap = plainRowWindow.rowOffsetMap;
|
|
20722
20740
|
bodyState.bodyLayout = resolveBodyLayout({
|
|
20723
|
-
height,
|
|
20741
|
+
height: contentHeight,
|
|
20724
20742
|
headerHeight,
|
|
20725
20743
|
summaryRowHeight,
|
|
20726
20744
|
hasSummary,
|
|
@@ -20731,10 +20749,6 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20731
20749
|
scrollRowCount: plainRowWindow.totalRowCount
|
|
20732
20750
|
});
|
|
20733
20751
|
}
|
|
20734
|
-
let columnMetrics = resolveColumnMetrics({
|
|
20735
|
-
columns: leafColumns,
|
|
20736
|
-
tableWidth: width
|
|
20737
|
-
});
|
|
20738
20752
|
let viewportResult = computeViewport({
|
|
20739
20753
|
width,
|
|
20740
20754
|
height,
|
|
@@ -21915,7 +21929,8 @@ function drawSegmentRows(params, segment, columns, startRowIndex, endRowIndex, r
|
|
|
21915
21929
|
params.requestRender,
|
|
21916
21930
|
validationMessage,
|
|
21917
21931
|
intersectRects3(rect, renderClipRect) ?? rect,
|
|
21918
|
-
(params.rangeHighlight ?? EMPTY_RANGE_HIGHLIGHT2).searchMatch
|
|
21932
|
+
(params.rangeHighlight ?? EMPTY_RANGE_HIGHLIGHT2).searchMatch,
|
|
21933
|
+
resolveDensityPaddingBlock(params.rowHeight)
|
|
21919
21934
|
);
|
|
21920
21935
|
if (cell.row.kind === "data") {
|
|
21921
21936
|
applyRowSpanToDescriptors(
|
|
@@ -22014,6 +22029,7 @@ function drawExpandedRowsOverlay(params, startRowIndex, endRowIndex, rowOffsets)
|
|
|
22014
22029
|
progress: expandedRowAnimation.progress,
|
|
22015
22030
|
row,
|
|
22016
22031
|
theme: params.theme,
|
|
22032
|
+
defaultPaddingBlock: resolveDensityPaddingBlock(params.rowHeight),
|
|
22017
22033
|
rowBackgroundColor: params.rowBackgroundColor,
|
|
22018
22034
|
striped: params.striped === true,
|
|
22019
22035
|
descriptors: params.descriptors,
|
|
@@ -22539,7 +22555,7 @@ function getMergedCellWidth(columns, startIndex, colSpan) {
|
|
|
22539
22555
|
}
|
|
22540
22556
|
return width;
|
|
22541
22557
|
}
|
|
22542
|
-
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) {
|
|
22558
|
+
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) {
|
|
22543
22559
|
ctx.save();
|
|
22544
22560
|
const paintStyle = resolveBodyCellPaintStyle({
|
|
22545
22561
|
theme,
|
|
@@ -22582,6 +22598,7 @@ function drawBodyCell(ctx, rect, record, rowIndex, column, theme, rowBackgroundC
|
|
|
22582
22598
|
rowIndex,
|
|
22583
22599
|
column,
|
|
22584
22600
|
theme: paintStyle.theme,
|
|
22601
|
+
defaultPaddingBlock,
|
|
22585
22602
|
frozen,
|
|
22586
22603
|
hovered,
|
|
22587
22604
|
descriptors,
|
|
@@ -22933,6 +22950,7 @@ function drawAnimatedExpandedBodyCell(params) {
|
|
|
22933
22950
|
rect,
|
|
22934
22951
|
params.row,
|
|
22935
22952
|
params.theme,
|
|
22953
|
+
params.defaultPaddingBlock,
|
|
22936
22954
|
params.rowBackgroundColor,
|
|
22937
22955
|
params.striped,
|
|
22938
22956
|
params.descriptors,
|
|
@@ -22946,7 +22964,7 @@ function drawAnimatedExpandedBodyCell(params) {
|
|
|
22946
22964
|
ctx.restore();
|
|
22947
22965
|
return tooltip;
|
|
22948
22966
|
}
|
|
22949
|
-
function drawExpandedBodyCell(ctx, rect, row, theme, rowBackgroundColor, striped, descriptors, visibleRect, segment, segments, contentInset, getNestedTableHighlight, textSelection) {
|
|
22967
|
+
function drawExpandedBodyCell(ctx, rect, row, theme, defaultPaddingBlock, rowBackgroundColor, striped, descriptors, visibleRect, segment, segments, contentInset, getNestedTableHighlight, textSelection) {
|
|
22950
22968
|
ctx.save();
|
|
22951
22969
|
ctx.fillStyle = rowBackgroundColor ?? (striped && row.ownerDataRowIndex % 2 === 1 ? theme.stripedBackgroundColor : theme.backgroundColor);
|
|
22952
22970
|
ctx.fillRect(rect.x, rect.y, rect.width, rect.height);
|
|
@@ -22986,6 +23004,7 @@ function drawExpandedBodyCell(ctx, rect, row, theme, rowBackgroundColor, striped
|
|
|
22986
23004
|
rowIndex: row.ownerDataRowIndex,
|
|
22987
23005
|
column: virtualColumn,
|
|
22988
23006
|
theme,
|
|
23007
|
+
defaultPaddingBlock,
|
|
22989
23008
|
frozen: false,
|
|
22990
23009
|
hovered: false,
|
|
22991
23010
|
descriptors,
|
|
@@ -23273,6 +23292,21 @@ function drawFixedLeftBoundary(params) {
|
|
|
23273
23292
|
ctx.stroke();
|
|
23274
23293
|
ctx.restore();
|
|
23275
23294
|
}
|
|
23295
|
+
function drawFixedRightBoundary(params) {
|
|
23296
|
+
const { ctx, rightBoundaryX, fixedWidthRight, height, borderColor } = params;
|
|
23297
|
+
if (fixedWidthRight <= 0 || height <= 0) {
|
|
23298
|
+
return;
|
|
23299
|
+
}
|
|
23300
|
+
const x = Math.round(rightBoundaryX) + 0.5;
|
|
23301
|
+
ctx.save();
|
|
23302
|
+
ctx.strokeStyle = borderColor;
|
|
23303
|
+
ctx.lineWidth = 1;
|
|
23304
|
+
ctx.beginPath();
|
|
23305
|
+
ctx.moveTo(x, 0);
|
|
23306
|
+
ctx.lineTo(x, height);
|
|
23307
|
+
ctx.stroke();
|
|
23308
|
+
ctx.restore();
|
|
23309
|
+
}
|
|
23276
23310
|
function mergeBoundarySkipRanges(skipRanges, height) {
|
|
23277
23311
|
const ranges = skipRanges.map((range) => ({
|
|
23278
23312
|
start: Math.max(Math.min(range.start, height), 0),
|
|
@@ -23519,7 +23553,7 @@ function drawHeaderCell(params, cell, clipRect) {
|
|
|
23519
23553
|
rect,
|
|
23520
23554
|
titleContent,
|
|
23521
23555
|
theme.fontSize,
|
|
23522
|
-
cell.node.style?.paddingBlock ??
|
|
23556
|
+
cell.node.style?.paddingBlock ?? params.defaultPaddingBlock ?? resolveDensityPaddingBlock(cell.height),
|
|
23523
23557
|
cell.node.style?.verticalAlign
|
|
23524
23558
|
);
|
|
23525
23559
|
ctx.textAlign = textLayout.align;
|
|
@@ -24054,6 +24088,15 @@ function findCellByKey(headerRows, columnKey) {
|
|
|
24054
24088
|
return null;
|
|
24055
24089
|
}
|
|
24056
24090
|
|
|
24091
|
+
// src/rendering/pipeline/header-clip.ts
|
|
24092
|
+
function resolveCenterHeaderClipWidth(params) {
|
|
24093
|
+
const centerContentWidth = params.leafColumns.reduce(
|
|
24094
|
+
(total, column) => column.fixed == null ? total + column.width : total,
|
|
24095
|
+
0
|
|
24096
|
+
);
|
|
24097
|
+
return Math.min(params.availableCenterWidth, centerContentWidth);
|
|
24098
|
+
}
|
|
24099
|
+
|
|
24057
24100
|
// src/rendering/pipeline/header-renderer.ts
|
|
24058
24101
|
function drawListTableHeader(params) {
|
|
24059
24102
|
const {
|
|
@@ -24082,10 +24125,14 @@ function drawListTableHeader(params) {
|
|
|
24082
24125
|
draggingReorder,
|
|
24083
24126
|
requestRender
|
|
24084
24127
|
} = params;
|
|
24085
|
-
const
|
|
24128
|
+
const centerClipWidth = resolveCenterHeaderClipWidth({
|
|
24129
|
+
availableCenterWidth,
|
|
24130
|
+
leafColumns
|
|
24131
|
+
});
|
|
24132
|
+
const centerClipRect = centerClipWidth > 0 ? {
|
|
24086
24133
|
x: fixedWidthLeft,
|
|
24087
24134
|
y: 0,
|
|
24088
|
-
width:
|
|
24135
|
+
width: centerClipWidth,
|
|
24089
24136
|
height: headerHeight
|
|
24090
24137
|
} : null;
|
|
24091
24138
|
const collapsedColumnMarkers = resolveCollapsedHeaderColumnMarkers({
|
|
@@ -24098,6 +24145,7 @@ function drawListTableHeader(params) {
|
|
|
24098
24145
|
headerRows,
|
|
24099
24146
|
centerClipRect,
|
|
24100
24147
|
theme,
|
|
24148
|
+
defaultPaddingBlock: typeof options.headerRowHeight === "number" ? resolveDensityPaddingBlock(options.headerRowHeight) : void 0,
|
|
24101
24149
|
descriptors,
|
|
24102
24150
|
hoveredColumnKey: hover.area === "header" || hover.area === "sort-trigger" || hover.area === "filter-trigger" || hover.area === "fixed-trigger" ? hover.columnKey : null,
|
|
24103
24151
|
hoveredActionType: hover.area,
|
|
@@ -24179,6 +24227,7 @@ function drawRowDragInsertionIndicator(params) {
|
|
|
24179
24227
|
}
|
|
24180
24228
|
|
|
24181
24229
|
// src/rendering/pipeline/active-cell-overlay.ts
|
|
24230
|
+
var RIGHT_BORDER_CLIP_BLEED = 1;
|
|
24182
24231
|
function resolveActiveCellOverlayLayout(params) {
|
|
24183
24232
|
const { selection } = params;
|
|
24184
24233
|
const descriptor = selection.rowIndex != null && selection.columnKey != null ? params.descriptors.find(
|
|
@@ -24333,15 +24382,69 @@ function resolveRangeHighlightLayouts(params) {
|
|
|
24333
24382
|
omitRight: range.rect.x + range.rect.width < maxX
|
|
24334
24383
|
};
|
|
24335
24384
|
});
|
|
24385
|
+
const rangeSegments = resolveRangeBorderSegments(
|
|
24386
|
+
selected,
|
|
24387
|
+
params.resolveClipRect
|
|
24388
|
+
);
|
|
24336
24389
|
return {
|
|
24337
24390
|
rects,
|
|
24338
24391
|
segments: roundRangeBorderAtTableBottom(
|
|
24339
|
-
|
|
24392
|
+
removeRangeSegmentsAtSharedLayerBoundaries(rangeSegments, ranges),
|
|
24340
24393
|
params.width,
|
|
24341
24394
|
params.height
|
|
24342
24395
|
)
|
|
24343
24396
|
};
|
|
24344
24397
|
}
|
|
24398
|
+
function removeRangeSegmentsAtSharedLayerBoundaries(segments, ranges) {
|
|
24399
|
+
const tolerance = 1;
|
|
24400
|
+
const sharedBoundaries = [];
|
|
24401
|
+
const visibleRanges = ranges.map((range) => intersectRangeWithClip(range.rect, range.clipRect)).filter((range) => range != null);
|
|
24402
|
+
visibleRanges.forEach((left, leftIndex) => {
|
|
24403
|
+
visibleRanges.slice(leftIndex + 1).forEach((right) => {
|
|
24404
|
+
const leftEdge = left.x + left.width;
|
|
24405
|
+
const rightEdge = right.x;
|
|
24406
|
+
const reverseLeftEdge = right.x + right.width;
|
|
24407
|
+
const reverseRightEdge = left.x;
|
|
24408
|
+
const boundary = Math.abs(leftEdge - rightEdge) <= tolerance ? (leftEdge + rightEdge) / 2 : Math.abs(reverseLeftEdge - reverseRightEdge) <= tolerance ? (reverseLeftEdge + reverseRightEdge) / 2 : null;
|
|
24409
|
+
if (boundary == null) {
|
|
24410
|
+
return;
|
|
24411
|
+
}
|
|
24412
|
+
const top = Math.max(left.y, right.y);
|
|
24413
|
+
const bottom = Math.min(
|
|
24414
|
+
left.y + left.height,
|
|
24415
|
+
right.y + right.height
|
|
24416
|
+
);
|
|
24417
|
+
if (bottom > top) {
|
|
24418
|
+
sharedBoundaries.push({ x: boundary, top, bottom });
|
|
24419
|
+
}
|
|
24420
|
+
});
|
|
24421
|
+
});
|
|
24422
|
+
return segments.filter((segment) => {
|
|
24423
|
+
if (!nearlyEqual(segment.startX, segment.endX)) {
|
|
24424
|
+
return true;
|
|
24425
|
+
}
|
|
24426
|
+
const top = Math.min(segment.startY, segment.endY);
|
|
24427
|
+
const bottom = Math.max(segment.startY, segment.endY);
|
|
24428
|
+
return !sharedBoundaries.some(
|
|
24429
|
+
(boundary) => Math.abs(segment.startX - boundary.x) <= tolerance && bottom > boundary.top && top < boundary.bottom
|
|
24430
|
+
);
|
|
24431
|
+
});
|
|
24432
|
+
}
|
|
24433
|
+
function intersectRangeWithClip(rect, clipRect) {
|
|
24434
|
+
const left = Math.max(rect.x, clipRect.x);
|
|
24435
|
+
const top = Math.max(rect.y, clipRect.y);
|
|
24436
|
+
const right = Math.min(rect.x + rect.width, clipRect.x + clipRect.width);
|
|
24437
|
+
const bottom = Math.min(rect.y + rect.height, clipRect.y + clipRect.height);
|
|
24438
|
+
if (right <= left || bottom <= top) {
|
|
24439
|
+
return null;
|
|
24440
|
+
}
|
|
24441
|
+
return {
|
|
24442
|
+
x: left,
|
|
24443
|
+
y: top,
|
|
24444
|
+
width: right - left,
|
|
24445
|
+
height: bottom - top
|
|
24446
|
+
};
|
|
24447
|
+
}
|
|
24345
24448
|
function roundRangeBorderAtTableBottom(segments, width, height) {
|
|
24346
24449
|
const inset = 0.5;
|
|
24347
24450
|
const left = inset;
|
|
@@ -24535,11 +24638,11 @@ function drawRangeHighlightBorder(ctx, rect, edges = {}) {
|
|
|
24535
24638
|
}
|
|
24536
24639
|
function resolveActiveCellSectionClipRect(descriptor, params) {
|
|
24537
24640
|
const horizontal = descriptor.fixed === "left" ? { x: 0, width: params.fixedWidthLeft } : descriptor.fixed === "right" ? {
|
|
24538
|
-
x: params.
|
|
24539
|
-
width: params.fixedWidthRight
|
|
24641
|
+
x: params.rightStartX,
|
|
24642
|
+
width: params.fixedWidthRight + RIGHT_BORDER_CLIP_BLEED
|
|
24540
24643
|
} : {
|
|
24541
24644
|
x: params.fixedWidthLeft,
|
|
24542
|
-
width: params.
|
|
24645
|
+
width: Math.max(params.rightStartX - params.fixedWidthLeft, 0) + RIGHT_BORDER_CLIP_BLEED
|
|
24543
24646
|
};
|
|
24544
24647
|
if (!descriptor.frozen) {
|
|
24545
24648
|
return {
|
|
@@ -24755,6 +24858,33 @@ function executeListTableRenderPipeline(params) {
|
|
|
24755
24858
|
borderColor: theme.borderColor,
|
|
24756
24859
|
skipRanges: fixedLeftBoundarySkips
|
|
24757
24860
|
});
|
|
24861
|
+
drawFixedRightBoundary({
|
|
24862
|
+
ctx,
|
|
24863
|
+
rightBoundaryX: snapshot.columnMetrics.rightStartX + snapshot.columnMetrics.fixedWidthRight,
|
|
24864
|
+
fixedWidthRight: snapshot.columnMetrics.fixedWidthRight,
|
|
24865
|
+
height,
|
|
24866
|
+
borderColor: theme.borderColor
|
|
24867
|
+
});
|
|
24868
|
+
drawScrollbars(
|
|
24869
|
+
ctx,
|
|
24870
|
+
snapshot.scrollbarLayout,
|
|
24871
|
+
descriptors,
|
|
24872
|
+
theme.borderColor,
|
|
24873
|
+
scrollbarOpacity,
|
|
24874
|
+
isScrollbarInteractive,
|
|
24875
|
+
{
|
|
24876
|
+
x: width,
|
|
24877
|
+
width: options.scrollbar?.visible === false ? 0 : Math.max(
|
|
24878
|
+
options.scrollbar?.thickness ?? DEFAULT_SCROLLBAR_THICKNESS,
|
|
24879
|
+
6
|
|
24880
|
+
),
|
|
24881
|
+
top: 0,
|
|
24882
|
+
height,
|
|
24883
|
+
headerBottom: headerHeight,
|
|
24884
|
+
headerBackgroundColor: theme.headerBackgroundColor,
|
|
24885
|
+
bodyBackgroundColor: theme.backgroundColor
|
|
24886
|
+
}
|
|
24887
|
+
);
|
|
24758
24888
|
drawActiveCellOverlay({
|
|
24759
24889
|
ctx,
|
|
24760
24890
|
layout: resolveActiveCellOverlayLayout({
|
|
@@ -24770,6 +24900,7 @@ function executeListTableRenderPipeline(params) {
|
|
|
24770
24900
|
bottomFrozenHeight,
|
|
24771
24901
|
fixedWidthLeft: snapshot.columnMetrics.fixedWidthLeft,
|
|
24772
24902
|
fixedWidthRight: snapshot.columnMetrics.fixedWidthRight,
|
|
24903
|
+
rightStartX: snapshot.columnMetrics.rightStartX,
|
|
24773
24904
|
availableCenterWidth: snapshot.columnMetrics.availableCenterWidth,
|
|
24774
24905
|
rangeHighlight,
|
|
24775
24906
|
highlightMode: options.highlightMode,
|
|
@@ -24783,26 +24914,6 @@ function executeListTableRenderPipeline(params) {
|
|
|
24783
24914
|
indicatorY: rowDragIndicator.y
|
|
24784
24915
|
});
|
|
24785
24916
|
}
|
|
24786
|
-
drawScrollbars(
|
|
24787
|
-
ctx,
|
|
24788
|
-
snapshot.scrollbarLayout,
|
|
24789
|
-
descriptors,
|
|
24790
|
-
theme.borderColor,
|
|
24791
|
-
scrollbarOpacity,
|
|
24792
|
-
isScrollbarInteractive,
|
|
24793
|
-
{
|
|
24794
|
-
x: width,
|
|
24795
|
-
width: options.scrollbar?.visible === false ? 0 : Math.max(
|
|
24796
|
-
options.scrollbar?.thickness ?? DEFAULT_SCROLLBAR_THICKNESS,
|
|
24797
|
-
6
|
|
24798
|
-
),
|
|
24799
|
-
top: 0,
|
|
24800
|
-
height,
|
|
24801
|
-
headerBottom: headerHeight,
|
|
24802
|
-
headerBackgroundColor: theme.headerBackgroundColor,
|
|
24803
|
-
bodyBackgroundColor: theme.backgroundColor
|
|
24804
|
-
}
|
|
24805
|
-
);
|
|
24806
24917
|
if (headerDraggingIndicator) {
|
|
24807
24918
|
drawDragOverlayFrame({
|
|
24808
24919
|
ctx,
|
|
@@ -27101,6 +27212,11 @@ function collectGroupingColumnItems(columns) {
|
|
|
27101
27212
|
});
|
|
27102
27213
|
}
|
|
27103
27214
|
|
|
27215
|
+
// src/engine/column-config-update-policy.ts
|
|
27216
|
+
function shouldPersistIncomingColumnConfig(previousRevision, nextRevision) {
|
|
27217
|
+
return nextRevision !== void 0 && nextRevision !== previousRevision;
|
|
27218
|
+
}
|
|
27219
|
+
|
|
27104
27220
|
// src/engine/list-table-engine.ts
|
|
27105
27221
|
var ListTableCore = class {
|
|
27106
27222
|
/**
|
|
@@ -27192,6 +27308,10 @@ var ListTableCore = class {
|
|
|
27192
27308
|
updateOptions(options) {
|
|
27193
27309
|
this.animationController.stopCarouselScroll();
|
|
27194
27310
|
const host = this.asAssemblyHost();
|
|
27311
|
+
const shouldPersistColumnConfig = shouldPersistIncomingColumnConfig(
|
|
27312
|
+
this.options.columnConfigRevision,
|
|
27313
|
+
options.columnConfigRevision
|
|
27314
|
+
);
|
|
27195
27315
|
const incomingColumnsAreRuntimeColumns = options.columns === this.options.columns;
|
|
27196
27316
|
const nextInitialColumns = incomingColumnsAreRuntimeColumns ? cloneColumns(host.initialColumns) : cloneColumns(options.columns);
|
|
27197
27317
|
const nextInitialStretchColumns = incomingColumnsAreRuntimeColumns ? host.initialStretchColumns : options.stretchColumns;
|
|
@@ -27235,7 +27355,11 @@ var ListTableCore = class {
|
|
|
27235
27355
|
this.hideFloatingOverlays({ includeLoading: true });
|
|
27236
27356
|
this.refreshRuntimeColumns();
|
|
27237
27357
|
this.renderController.render();
|
|
27238
|
-
|
|
27358
|
+
if (shouldPersistColumnConfig) {
|
|
27359
|
+
this.persistenceController.persistColumnConfig();
|
|
27360
|
+
} else {
|
|
27361
|
+
this.persistenceController.loadStoredConfig({ restoreQueryState: false });
|
|
27362
|
+
}
|
|
27239
27363
|
host.tableId = options.tableId?.trim() ? options.tableId : host.tableId;
|
|
27240
27364
|
host.rowDragController.syncRegistration();
|
|
27241
27365
|
}
|
|
@@ -27284,7 +27408,7 @@ var ListTableCore = class {
|
|
|
27284
27408
|
*/
|
|
27285
27409
|
changeDensity(density) {
|
|
27286
27410
|
this.headerActionController.changeTableDensity(
|
|
27287
|
-
density === "auto" ? "auto" : density === 32 ? "compact" : density === 56 ? "comfortable" : "middle"
|
|
27411
|
+
density === "auto" ? "auto" : density === 26 ? "ultra-compact" : density === 32 ? "compact" : density === 56 ? "comfortable" : "middle"
|
|
27288
27412
|
);
|
|
27289
27413
|
}
|
|
27290
27414
|
/**
|