@canvas-components/list-table 0.3.7 → 0.3.8
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 +209 -88
- 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 +209 -88
- 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,
|
|
@@ -21913,7 +21924,8 @@ function drawSegmentRows(params, segment, columns, startRowIndex, endRowIndex, r
|
|
|
21913
21924
|
params.requestRender,
|
|
21914
21925
|
validationMessage,
|
|
21915
21926
|
intersectRects3(rect, renderClipRect) ?? rect,
|
|
21916
|
-
(params.rangeHighlight ?? EMPTY_RANGE_HIGHLIGHT2).searchMatch
|
|
21927
|
+
(params.rangeHighlight ?? EMPTY_RANGE_HIGHLIGHT2).searchMatch,
|
|
21928
|
+
resolveDensityPaddingBlock(params.rowHeight)
|
|
21917
21929
|
);
|
|
21918
21930
|
if (cell.row.kind === "data") {
|
|
21919
21931
|
applyRowSpanToDescriptors(
|
|
@@ -22012,6 +22024,7 @@ function drawExpandedRowsOverlay(params, startRowIndex, endRowIndex, rowOffsets)
|
|
|
22012
22024
|
progress: expandedRowAnimation.progress,
|
|
22013
22025
|
row,
|
|
22014
22026
|
theme: params.theme,
|
|
22027
|
+
defaultPaddingBlock: resolveDensityPaddingBlock(params.rowHeight),
|
|
22015
22028
|
rowBackgroundColor: params.rowBackgroundColor,
|
|
22016
22029
|
striped: params.striped === true,
|
|
22017
22030
|
descriptors: params.descriptors,
|
|
@@ -22537,7 +22550,7 @@ function getMergedCellWidth(columns, startIndex, colSpan) {
|
|
|
22537
22550
|
}
|
|
22538
22551
|
return width;
|
|
22539
22552
|
}
|
|
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) {
|
|
22553
|
+
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
22554
|
ctx.save();
|
|
22542
22555
|
const paintStyle = resolveBodyCellPaintStyle({
|
|
22543
22556
|
theme,
|
|
@@ -22580,6 +22593,7 @@ function drawBodyCell(ctx, rect, record, rowIndex, column, theme, rowBackgroundC
|
|
|
22580
22593
|
rowIndex,
|
|
22581
22594
|
column,
|
|
22582
22595
|
theme: paintStyle.theme,
|
|
22596
|
+
defaultPaddingBlock,
|
|
22583
22597
|
frozen,
|
|
22584
22598
|
hovered,
|
|
22585
22599
|
descriptors,
|
|
@@ -22931,6 +22945,7 @@ function drawAnimatedExpandedBodyCell(params) {
|
|
|
22931
22945
|
rect,
|
|
22932
22946
|
params.row,
|
|
22933
22947
|
params.theme,
|
|
22948
|
+
params.defaultPaddingBlock,
|
|
22934
22949
|
params.rowBackgroundColor,
|
|
22935
22950
|
params.striped,
|
|
22936
22951
|
params.descriptors,
|
|
@@ -22944,7 +22959,7 @@ function drawAnimatedExpandedBodyCell(params) {
|
|
|
22944
22959
|
ctx.restore();
|
|
22945
22960
|
return tooltip;
|
|
22946
22961
|
}
|
|
22947
|
-
function drawExpandedBodyCell(ctx, rect, row, theme, rowBackgroundColor, striped, descriptors, visibleRect, segment, segments, contentInset, getNestedTableHighlight, textSelection) {
|
|
22962
|
+
function drawExpandedBodyCell(ctx, rect, row, theme, defaultPaddingBlock, rowBackgroundColor, striped, descriptors, visibleRect, segment, segments, contentInset, getNestedTableHighlight, textSelection) {
|
|
22948
22963
|
ctx.save();
|
|
22949
22964
|
ctx.fillStyle = rowBackgroundColor ?? (striped && row.ownerDataRowIndex % 2 === 1 ? theme.stripedBackgroundColor : theme.backgroundColor);
|
|
22950
22965
|
ctx.fillRect(rect.x, rect.y, rect.width, rect.height);
|
|
@@ -22984,6 +22999,7 @@ function drawExpandedBodyCell(ctx, rect, row, theme, rowBackgroundColor, striped
|
|
|
22984
22999
|
rowIndex: row.ownerDataRowIndex,
|
|
22985
23000
|
column: virtualColumn,
|
|
22986
23001
|
theme,
|
|
23002
|
+
defaultPaddingBlock,
|
|
22987
23003
|
frozen: false,
|
|
22988
23004
|
hovered: false,
|
|
22989
23005
|
descriptors,
|
|
@@ -23271,6 +23287,21 @@ function drawFixedLeftBoundary(params) {
|
|
|
23271
23287
|
ctx.stroke();
|
|
23272
23288
|
ctx.restore();
|
|
23273
23289
|
}
|
|
23290
|
+
function drawFixedRightBoundary(params) {
|
|
23291
|
+
const { ctx, rightBoundaryX, fixedWidthRight, height, borderColor } = params;
|
|
23292
|
+
if (fixedWidthRight <= 0 || height <= 0) {
|
|
23293
|
+
return;
|
|
23294
|
+
}
|
|
23295
|
+
const x = Math.round(rightBoundaryX) + 0.5;
|
|
23296
|
+
ctx.save();
|
|
23297
|
+
ctx.strokeStyle = borderColor;
|
|
23298
|
+
ctx.lineWidth = 1;
|
|
23299
|
+
ctx.beginPath();
|
|
23300
|
+
ctx.moveTo(x, 0);
|
|
23301
|
+
ctx.lineTo(x, height);
|
|
23302
|
+
ctx.stroke();
|
|
23303
|
+
ctx.restore();
|
|
23304
|
+
}
|
|
23274
23305
|
function mergeBoundarySkipRanges(skipRanges, height) {
|
|
23275
23306
|
const ranges = skipRanges.map((range) => ({
|
|
23276
23307
|
start: Math.max(Math.min(range.start, height), 0),
|
|
@@ -23517,7 +23548,7 @@ function drawHeaderCell(params, cell, clipRect) {
|
|
|
23517
23548
|
rect,
|
|
23518
23549
|
titleContent,
|
|
23519
23550
|
theme.fontSize,
|
|
23520
|
-
cell.node.style?.paddingBlock ??
|
|
23551
|
+
cell.node.style?.paddingBlock ?? params.defaultPaddingBlock ?? resolveDensityPaddingBlock(cell.height),
|
|
23521
23552
|
cell.node.style?.verticalAlign
|
|
23522
23553
|
);
|
|
23523
23554
|
ctx.textAlign = textLayout.align;
|
|
@@ -24052,6 +24083,15 @@ function findCellByKey(headerRows, columnKey) {
|
|
|
24052
24083
|
return null;
|
|
24053
24084
|
}
|
|
24054
24085
|
|
|
24086
|
+
// src/rendering/pipeline/header-clip.ts
|
|
24087
|
+
function resolveCenterHeaderClipWidth(params) {
|
|
24088
|
+
const centerContentWidth = params.leafColumns.reduce(
|
|
24089
|
+
(total, column) => column.fixed == null ? total + column.width : total,
|
|
24090
|
+
0
|
|
24091
|
+
);
|
|
24092
|
+
return Math.min(params.availableCenterWidth, centerContentWidth);
|
|
24093
|
+
}
|
|
24094
|
+
|
|
24055
24095
|
// src/rendering/pipeline/header-renderer.ts
|
|
24056
24096
|
function drawListTableHeader(params) {
|
|
24057
24097
|
const {
|
|
@@ -24080,10 +24120,14 @@ function drawListTableHeader(params) {
|
|
|
24080
24120
|
draggingReorder,
|
|
24081
24121
|
requestRender
|
|
24082
24122
|
} = params;
|
|
24083
|
-
const
|
|
24123
|
+
const centerClipWidth = resolveCenterHeaderClipWidth({
|
|
24124
|
+
availableCenterWidth,
|
|
24125
|
+
leafColumns
|
|
24126
|
+
});
|
|
24127
|
+
const centerClipRect = centerClipWidth > 0 ? {
|
|
24084
24128
|
x: fixedWidthLeft,
|
|
24085
24129
|
y: 0,
|
|
24086
|
-
width:
|
|
24130
|
+
width: centerClipWidth,
|
|
24087
24131
|
height: headerHeight
|
|
24088
24132
|
} : null;
|
|
24089
24133
|
const collapsedColumnMarkers = resolveCollapsedHeaderColumnMarkers({
|
|
@@ -24096,6 +24140,7 @@ function drawListTableHeader(params) {
|
|
|
24096
24140
|
headerRows,
|
|
24097
24141
|
centerClipRect,
|
|
24098
24142
|
theme,
|
|
24143
|
+
defaultPaddingBlock: typeof options.headerRowHeight === "number" ? resolveDensityPaddingBlock(options.headerRowHeight) : void 0,
|
|
24099
24144
|
descriptors,
|
|
24100
24145
|
hoveredColumnKey: hover.area === "header" || hover.area === "sort-trigger" || hover.area === "filter-trigger" || hover.area === "fixed-trigger" ? hover.columnKey : null,
|
|
24101
24146
|
hoveredActionType: hover.area,
|
|
@@ -24177,6 +24222,7 @@ function drawRowDragInsertionIndicator(params) {
|
|
|
24177
24222
|
}
|
|
24178
24223
|
|
|
24179
24224
|
// src/rendering/pipeline/active-cell-overlay.ts
|
|
24225
|
+
var RIGHT_BORDER_CLIP_BLEED = 1;
|
|
24180
24226
|
function resolveActiveCellOverlayLayout(params) {
|
|
24181
24227
|
const { selection } = params;
|
|
24182
24228
|
const descriptor = selection.rowIndex != null && selection.columnKey != null ? params.descriptors.find(
|
|
@@ -24331,15 +24377,69 @@ function resolveRangeHighlightLayouts(params) {
|
|
|
24331
24377
|
omitRight: range.rect.x + range.rect.width < maxX
|
|
24332
24378
|
};
|
|
24333
24379
|
});
|
|
24380
|
+
const rangeSegments = resolveRangeBorderSegments(
|
|
24381
|
+
selected,
|
|
24382
|
+
params.resolveClipRect
|
|
24383
|
+
);
|
|
24334
24384
|
return {
|
|
24335
24385
|
rects,
|
|
24336
24386
|
segments: roundRangeBorderAtTableBottom(
|
|
24337
|
-
|
|
24387
|
+
removeRangeSegmentsAtSharedLayerBoundaries(rangeSegments, ranges),
|
|
24338
24388
|
params.width,
|
|
24339
24389
|
params.height
|
|
24340
24390
|
)
|
|
24341
24391
|
};
|
|
24342
24392
|
}
|
|
24393
|
+
function removeRangeSegmentsAtSharedLayerBoundaries(segments, ranges) {
|
|
24394
|
+
const tolerance = 1;
|
|
24395
|
+
const sharedBoundaries = [];
|
|
24396
|
+
const visibleRanges = ranges.map((range) => intersectRangeWithClip(range.rect, range.clipRect)).filter((range) => range != null);
|
|
24397
|
+
visibleRanges.forEach((left, leftIndex) => {
|
|
24398
|
+
visibleRanges.slice(leftIndex + 1).forEach((right) => {
|
|
24399
|
+
const leftEdge = left.x + left.width;
|
|
24400
|
+
const rightEdge = right.x;
|
|
24401
|
+
const reverseLeftEdge = right.x + right.width;
|
|
24402
|
+
const reverseRightEdge = left.x;
|
|
24403
|
+
const boundary = Math.abs(leftEdge - rightEdge) <= tolerance ? (leftEdge + rightEdge) / 2 : Math.abs(reverseLeftEdge - reverseRightEdge) <= tolerance ? (reverseLeftEdge + reverseRightEdge) / 2 : null;
|
|
24404
|
+
if (boundary == null) {
|
|
24405
|
+
return;
|
|
24406
|
+
}
|
|
24407
|
+
const top = Math.max(left.y, right.y);
|
|
24408
|
+
const bottom = Math.min(
|
|
24409
|
+
left.y + left.height,
|
|
24410
|
+
right.y + right.height
|
|
24411
|
+
);
|
|
24412
|
+
if (bottom > top) {
|
|
24413
|
+
sharedBoundaries.push({ x: boundary, top, bottom });
|
|
24414
|
+
}
|
|
24415
|
+
});
|
|
24416
|
+
});
|
|
24417
|
+
return segments.filter((segment) => {
|
|
24418
|
+
if (!nearlyEqual(segment.startX, segment.endX)) {
|
|
24419
|
+
return true;
|
|
24420
|
+
}
|
|
24421
|
+
const top = Math.min(segment.startY, segment.endY);
|
|
24422
|
+
const bottom = Math.max(segment.startY, segment.endY);
|
|
24423
|
+
return !sharedBoundaries.some(
|
|
24424
|
+
(boundary) => Math.abs(segment.startX - boundary.x) <= tolerance && bottom > boundary.top && top < boundary.bottom
|
|
24425
|
+
);
|
|
24426
|
+
});
|
|
24427
|
+
}
|
|
24428
|
+
function intersectRangeWithClip(rect, clipRect) {
|
|
24429
|
+
const left = Math.max(rect.x, clipRect.x);
|
|
24430
|
+
const top = Math.max(rect.y, clipRect.y);
|
|
24431
|
+
const right = Math.min(rect.x + rect.width, clipRect.x + clipRect.width);
|
|
24432
|
+
const bottom = Math.min(rect.y + rect.height, clipRect.y + clipRect.height);
|
|
24433
|
+
if (right <= left || bottom <= top) {
|
|
24434
|
+
return null;
|
|
24435
|
+
}
|
|
24436
|
+
return {
|
|
24437
|
+
x: left,
|
|
24438
|
+
y: top,
|
|
24439
|
+
width: right - left,
|
|
24440
|
+
height: bottom - top
|
|
24441
|
+
};
|
|
24442
|
+
}
|
|
24343
24443
|
function roundRangeBorderAtTableBottom(segments, width, height) {
|
|
24344
24444
|
const inset = 0.5;
|
|
24345
24445
|
const left = inset;
|
|
@@ -24533,11 +24633,11 @@ function drawRangeHighlightBorder(ctx, rect, edges = {}) {
|
|
|
24533
24633
|
}
|
|
24534
24634
|
function resolveActiveCellSectionClipRect(descriptor, params) {
|
|
24535
24635
|
const horizontal = descriptor.fixed === "left" ? { x: 0, width: params.fixedWidthLeft } : descriptor.fixed === "right" ? {
|
|
24536
|
-
x: params.
|
|
24537
|
-
width: params.fixedWidthRight
|
|
24636
|
+
x: params.rightStartX,
|
|
24637
|
+
width: params.fixedWidthRight + RIGHT_BORDER_CLIP_BLEED
|
|
24538
24638
|
} : {
|
|
24539
24639
|
x: params.fixedWidthLeft,
|
|
24540
|
-
width: params.
|
|
24640
|
+
width: Math.max(params.rightStartX - params.fixedWidthLeft, 0) + RIGHT_BORDER_CLIP_BLEED
|
|
24541
24641
|
};
|
|
24542
24642
|
if (!descriptor.frozen) {
|
|
24543
24643
|
return {
|
|
@@ -24753,6 +24853,33 @@ function executeListTableRenderPipeline(params) {
|
|
|
24753
24853
|
borderColor: theme.borderColor,
|
|
24754
24854
|
skipRanges: fixedLeftBoundarySkips
|
|
24755
24855
|
});
|
|
24856
|
+
drawFixedRightBoundary({
|
|
24857
|
+
ctx,
|
|
24858
|
+
rightBoundaryX: snapshot.columnMetrics.rightStartX + snapshot.columnMetrics.fixedWidthRight,
|
|
24859
|
+
fixedWidthRight: snapshot.columnMetrics.fixedWidthRight,
|
|
24860
|
+
height,
|
|
24861
|
+
borderColor: theme.borderColor
|
|
24862
|
+
});
|
|
24863
|
+
drawScrollbars(
|
|
24864
|
+
ctx,
|
|
24865
|
+
snapshot.scrollbarLayout,
|
|
24866
|
+
descriptors,
|
|
24867
|
+
theme.borderColor,
|
|
24868
|
+
scrollbarOpacity,
|
|
24869
|
+
isScrollbarInteractive,
|
|
24870
|
+
{
|
|
24871
|
+
x: width,
|
|
24872
|
+
width: options.scrollbar?.visible === false ? 0 : Math.max(
|
|
24873
|
+
options.scrollbar?.thickness ?? DEFAULT_SCROLLBAR_THICKNESS,
|
|
24874
|
+
6
|
|
24875
|
+
),
|
|
24876
|
+
top: 0,
|
|
24877
|
+
height,
|
|
24878
|
+
headerBottom: headerHeight,
|
|
24879
|
+
headerBackgroundColor: theme.headerBackgroundColor,
|
|
24880
|
+
bodyBackgroundColor: theme.backgroundColor
|
|
24881
|
+
}
|
|
24882
|
+
);
|
|
24756
24883
|
drawActiveCellOverlay({
|
|
24757
24884
|
ctx,
|
|
24758
24885
|
layout: resolveActiveCellOverlayLayout({
|
|
@@ -24768,6 +24895,7 @@ function executeListTableRenderPipeline(params) {
|
|
|
24768
24895
|
bottomFrozenHeight,
|
|
24769
24896
|
fixedWidthLeft: snapshot.columnMetrics.fixedWidthLeft,
|
|
24770
24897
|
fixedWidthRight: snapshot.columnMetrics.fixedWidthRight,
|
|
24898
|
+
rightStartX: snapshot.columnMetrics.rightStartX,
|
|
24771
24899
|
availableCenterWidth: snapshot.columnMetrics.availableCenterWidth,
|
|
24772
24900
|
rangeHighlight,
|
|
24773
24901
|
highlightMode: options.highlightMode,
|
|
@@ -24781,26 +24909,6 @@ function executeListTableRenderPipeline(params) {
|
|
|
24781
24909
|
indicatorY: rowDragIndicator.y
|
|
24782
24910
|
});
|
|
24783
24911
|
}
|
|
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
24912
|
if (headerDraggingIndicator) {
|
|
24805
24913
|
drawDragOverlayFrame({
|
|
24806
24914
|
ctx,
|
|
@@ -27099,6 +27207,11 @@ function collectGroupingColumnItems(columns) {
|
|
|
27099
27207
|
});
|
|
27100
27208
|
}
|
|
27101
27209
|
|
|
27210
|
+
// src/engine/column-config-update-policy.ts
|
|
27211
|
+
function shouldPersistIncomingColumnConfig(previousRevision, nextRevision) {
|
|
27212
|
+
return nextRevision !== void 0 && nextRevision !== previousRevision;
|
|
27213
|
+
}
|
|
27214
|
+
|
|
27102
27215
|
// src/engine/list-table-engine.ts
|
|
27103
27216
|
var ListTableCore = class {
|
|
27104
27217
|
/**
|
|
@@ -27190,6 +27303,10 @@ var ListTableCore = class {
|
|
|
27190
27303
|
updateOptions(options) {
|
|
27191
27304
|
this.animationController.stopCarouselScroll();
|
|
27192
27305
|
const host = this.asAssemblyHost();
|
|
27306
|
+
const shouldPersistColumnConfig = shouldPersistIncomingColumnConfig(
|
|
27307
|
+
this.options.columnConfigRevision,
|
|
27308
|
+
options.columnConfigRevision
|
|
27309
|
+
);
|
|
27193
27310
|
const incomingColumnsAreRuntimeColumns = options.columns === this.options.columns;
|
|
27194
27311
|
const nextInitialColumns = incomingColumnsAreRuntimeColumns ? cloneColumns(host.initialColumns) : cloneColumns(options.columns);
|
|
27195
27312
|
const nextInitialStretchColumns = incomingColumnsAreRuntimeColumns ? host.initialStretchColumns : options.stretchColumns;
|
|
@@ -27233,7 +27350,11 @@ var ListTableCore = class {
|
|
|
27233
27350
|
this.hideFloatingOverlays({ includeLoading: true });
|
|
27234
27351
|
this.refreshRuntimeColumns();
|
|
27235
27352
|
this.renderController.render();
|
|
27236
|
-
|
|
27353
|
+
if (shouldPersistColumnConfig) {
|
|
27354
|
+
this.persistenceController.persistColumnConfig();
|
|
27355
|
+
} else {
|
|
27356
|
+
this.persistenceController.loadStoredConfig({ restoreQueryState: false });
|
|
27357
|
+
}
|
|
27237
27358
|
host.tableId = options.tableId?.trim() ? options.tableId : host.tableId;
|
|
27238
27359
|
host.rowDragController.syncRegistration();
|
|
27239
27360
|
}
|
|
@@ -27282,7 +27403,7 @@ var ListTableCore = class {
|
|
|
27282
27403
|
*/
|
|
27283
27404
|
changeDensity(density) {
|
|
27284
27405
|
this.headerActionController.changeTableDensity(
|
|
27285
|
-
density === "auto" ? "auto" : density === 32 ? "compact" : density === 56 ? "comfortable" : "middle"
|
|
27406
|
+
density === "auto" ? "auto" : density === 26 ? "ultra-compact" : density === 32 ? "compact" : density === 56 ? "comfortable" : "middle"
|
|
27286
27407
|
);
|
|
27287
27408
|
}
|
|
27288
27409
|
/**
|