@canvas-components/list-table 0.3.6 → 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 +210 -89
- 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 +210 -89
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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,
|
|
@@ -21915,7 +21926,8 @@ function drawSegmentRows(params, segment, columns, startRowIndex, endRowIndex, r
|
|
|
21915
21926
|
params.requestRender,
|
|
21916
21927
|
validationMessage,
|
|
21917
21928
|
intersectRects3(rect, renderClipRect) ?? rect,
|
|
21918
|
-
(params.rangeHighlight ?? EMPTY_RANGE_HIGHLIGHT2).searchMatch
|
|
21929
|
+
(params.rangeHighlight ?? EMPTY_RANGE_HIGHLIGHT2).searchMatch,
|
|
21930
|
+
resolveDensityPaddingBlock(params.rowHeight)
|
|
21919
21931
|
);
|
|
21920
21932
|
if (cell.row.kind === "data") {
|
|
21921
21933
|
applyRowSpanToDescriptors(
|
|
@@ -22014,6 +22026,7 @@ function drawExpandedRowsOverlay(params, startRowIndex, endRowIndex, rowOffsets)
|
|
|
22014
22026
|
progress: expandedRowAnimation.progress,
|
|
22015
22027
|
row,
|
|
22016
22028
|
theme: params.theme,
|
|
22029
|
+
defaultPaddingBlock: resolveDensityPaddingBlock(params.rowHeight),
|
|
22017
22030
|
rowBackgroundColor: params.rowBackgroundColor,
|
|
22018
22031
|
striped: params.striped === true,
|
|
22019
22032
|
descriptors: params.descriptors,
|
|
@@ -22539,7 +22552,7 @@ function getMergedCellWidth(columns, startIndex, colSpan) {
|
|
|
22539
22552
|
}
|
|
22540
22553
|
return width;
|
|
22541
22554
|
}
|
|
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) {
|
|
22555
|
+
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
22556
|
ctx.save();
|
|
22544
22557
|
const paintStyle = resolveBodyCellPaintStyle({
|
|
22545
22558
|
theme,
|
|
@@ -22582,6 +22595,7 @@ function drawBodyCell(ctx, rect, record, rowIndex, column, theme, rowBackgroundC
|
|
|
22582
22595
|
rowIndex,
|
|
22583
22596
|
column,
|
|
22584
22597
|
theme: paintStyle.theme,
|
|
22598
|
+
defaultPaddingBlock,
|
|
22585
22599
|
frozen,
|
|
22586
22600
|
hovered,
|
|
22587
22601
|
descriptors,
|
|
@@ -22933,6 +22947,7 @@ function drawAnimatedExpandedBodyCell(params) {
|
|
|
22933
22947
|
rect,
|
|
22934
22948
|
params.row,
|
|
22935
22949
|
params.theme,
|
|
22950
|
+
params.defaultPaddingBlock,
|
|
22936
22951
|
params.rowBackgroundColor,
|
|
22937
22952
|
params.striped,
|
|
22938
22953
|
params.descriptors,
|
|
@@ -22946,7 +22961,7 @@ function drawAnimatedExpandedBodyCell(params) {
|
|
|
22946
22961
|
ctx.restore();
|
|
22947
22962
|
return tooltip;
|
|
22948
22963
|
}
|
|
22949
|
-
function drawExpandedBodyCell(ctx, rect, row, theme, rowBackgroundColor, striped, descriptors, visibleRect, segment, segments, contentInset, getNestedTableHighlight, textSelection) {
|
|
22964
|
+
function drawExpandedBodyCell(ctx, rect, row, theme, defaultPaddingBlock, rowBackgroundColor, striped, descriptors, visibleRect, segment, segments, contentInset, getNestedTableHighlight, textSelection) {
|
|
22950
22965
|
ctx.save();
|
|
22951
22966
|
ctx.fillStyle = rowBackgroundColor ?? (striped && row.ownerDataRowIndex % 2 === 1 ? theme.stripedBackgroundColor : theme.backgroundColor);
|
|
22952
22967
|
ctx.fillRect(rect.x, rect.y, rect.width, rect.height);
|
|
@@ -22986,6 +23001,7 @@ function drawExpandedBodyCell(ctx, rect, row, theme, rowBackgroundColor, striped
|
|
|
22986
23001
|
rowIndex: row.ownerDataRowIndex,
|
|
22987
23002
|
column: virtualColumn,
|
|
22988
23003
|
theme,
|
|
23004
|
+
defaultPaddingBlock,
|
|
22989
23005
|
frozen: false,
|
|
22990
23006
|
hovered: false,
|
|
22991
23007
|
descriptors,
|
|
@@ -23273,6 +23289,21 @@ function drawFixedLeftBoundary(params) {
|
|
|
23273
23289
|
ctx.stroke();
|
|
23274
23290
|
ctx.restore();
|
|
23275
23291
|
}
|
|
23292
|
+
function drawFixedRightBoundary(params) {
|
|
23293
|
+
const { ctx, rightBoundaryX, fixedWidthRight, height, borderColor } = params;
|
|
23294
|
+
if (fixedWidthRight <= 0 || height <= 0) {
|
|
23295
|
+
return;
|
|
23296
|
+
}
|
|
23297
|
+
const x = Math.round(rightBoundaryX) + 0.5;
|
|
23298
|
+
ctx.save();
|
|
23299
|
+
ctx.strokeStyle = borderColor;
|
|
23300
|
+
ctx.lineWidth = 1;
|
|
23301
|
+
ctx.beginPath();
|
|
23302
|
+
ctx.moveTo(x, 0);
|
|
23303
|
+
ctx.lineTo(x, height);
|
|
23304
|
+
ctx.stroke();
|
|
23305
|
+
ctx.restore();
|
|
23306
|
+
}
|
|
23276
23307
|
function mergeBoundarySkipRanges(skipRanges, height) {
|
|
23277
23308
|
const ranges = skipRanges.map((range) => ({
|
|
23278
23309
|
start: Math.max(Math.min(range.start, height), 0),
|
|
@@ -23519,7 +23550,7 @@ function drawHeaderCell(params, cell, clipRect) {
|
|
|
23519
23550
|
rect,
|
|
23520
23551
|
titleContent,
|
|
23521
23552
|
theme.fontSize,
|
|
23522
|
-
cell.node.style?.paddingBlock ??
|
|
23553
|
+
cell.node.style?.paddingBlock ?? params.defaultPaddingBlock ?? resolveDensityPaddingBlock(cell.height),
|
|
23523
23554
|
cell.node.style?.verticalAlign
|
|
23524
23555
|
);
|
|
23525
23556
|
ctx.textAlign = textLayout.align;
|
|
@@ -24054,6 +24085,15 @@ function findCellByKey(headerRows, columnKey) {
|
|
|
24054
24085
|
return null;
|
|
24055
24086
|
}
|
|
24056
24087
|
|
|
24088
|
+
// src/rendering/pipeline/header-clip.ts
|
|
24089
|
+
function resolveCenterHeaderClipWidth(params) {
|
|
24090
|
+
const centerContentWidth = params.leafColumns.reduce(
|
|
24091
|
+
(total, column) => column.fixed == null ? total + column.width : total,
|
|
24092
|
+
0
|
|
24093
|
+
);
|
|
24094
|
+
return Math.min(params.availableCenterWidth, centerContentWidth);
|
|
24095
|
+
}
|
|
24096
|
+
|
|
24057
24097
|
// src/rendering/pipeline/header-renderer.ts
|
|
24058
24098
|
function drawListTableHeader(params) {
|
|
24059
24099
|
const {
|
|
@@ -24082,10 +24122,14 @@ function drawListTableHeader(params) {
|
|
|
24082
24122
|
draggingReorder,
|
|
24083
24123
|
requestRender
|
|
24084
24124
|
} = params;
|
|
24085
|
-
const
|
|
24125
|
+
const centerClipWidth = resolveCenterHeaderClipWidth({
|
|
24126
|
+
availableCenterWidth,
|
|
24127
|
+
leafColumns
|
|
24128
|
+
});
|
|
24129
|
+
const centerClipRect = centerClipWidth > 0 ? {
|
|
24086
24130
|
x: fixedWidthLeft,
|
|
24087
24131
|
y: 0,
|
|
24088
|
-
width:
|
|
24132
|
+
width: centerClipWidth,
|
|
24089
24133
|
height: headerHeight
|
|
24090
24134
|
} : null;
|
|
24091
24135
|
const collapsedColumnMarkers = resolveCollapsedHeaderColumnMarkers({
|
|
@@ -24098,6 +24142,7 @@ function drawListTableHeader(params) {
|
|
|
24098
24142
|
headerRows,
|
|
24099
24143
|
centerClipRect,
|
|
24100
24144
|
theme,
|
|
24145
|
+
defaultPaddingBlock: typeof options.headerRowHeight === "number" ? resolveDensityPaddingBlock(options.headerRowHeight) : void 0,
|
|
24101
24146
|
descriptors,
|
|
24102
24147
|
hoveredColumnKey: hover.area === "header" || hover.area === "sort-trigger" || hover.area === "filter-trigger" || hover.area === "fixed-trigger" ? hover.columnKey : null,
|
|
24103
24148
|
hoveredActionType: hover.area,
|
|
@@ -24179,6 +24224,7 @@ function drawRowDragInsertionIndicator(params) {
|
|
|
24179
24224
|
}
|
|
24180
24225
|
|
|
24181
24226
|
// src/rendering/pipeline/active-cell-overlay.ts
|
|
24227
|
+
var RIGHT_BORDER_CLIP_BLEED = 1;
|
|
24182
24228
|
function resolveActiveCellOverlayLayout(params) {
|
|
24183
24229
|
const { selection } = params;
|
|
24184
24230
|
const descriptor = selection.rowIndex != null && selection.columnKey != null ? params.descriptors.find(
|
|
@@ -24333,15 +24379,69 @@ function resolveRangeHighlightLayouts(params) {
|
|
|
24333
24379
|
omitRight: range.rect.x + range.rect.width < maxX
|
|
24334
24380
|
};
|
|
24335
24381
|
});
|
|
24382
|
+
const rangeSegments = resolveRangeBorderSegments(
|
|
24383
|
+
selected,
|
|
24384
|
+
params.resolveClipRect
|
|
24385
|
+
);
|
|
24336
24386
|
return {
|
|
24337
24387
|
rects,
|
|
24338
24388
|
segments: roundRangeBorderAtTableBottom(
|
|
24339
|
-
|
|
24389
|
+
removeRangeSegmentsAtSharedLayerBoundaries(rangeSegments, ranges),
|
|
24340
24390
|
params.width,
|
|
24341
24391
|
params.height
|
|
24342
24392
|
)
|
|
24343
24393
|
};
|
|
24344
24394
|
}
|
|
24395
|
+
function removeRangeSegmentsAtSharedLayerBoundaries(segments, ranges) {
|
|
24396
|
+
const tolerance = 1;
|
|
24397
|
+
const sharedBoundaries = [];
|
|
24398
|
+
const visibleRanges = ranges.map((range) => intersectRangeWithClip(range.rect, range.clipRect)).filter((range) => range != null);
|
|
24399
|
+
visibleRanges.forEach((left, leftIndex) => {
|
|
24400
|
+
visibleRanges.slice(leftIndex + 1).forEach((right) => {
|
|
24401
|
+
const leftEdge = left.x + left.width;
|
|
24402
|
+
const rightEdge = right.x;
|
|
24403
|
+
const reverseLeftEdge = right.x + right.width;
|
|
24404
|
+
const reverseRightEdge = left.x;
|
|
24405
|
+
const boundary = Math.abs(leftEdge - rightEdge) <= tolerance ? (leftEdge + rightEdge) / 2 : Math.abs(reverseLeftEdge - reverseRightEdge) <= tolerance ? (reverseLeftEdge + reverseRightEdge) / 2 : null;
|
|
24406
|
+
if (boundary == null) {
|
|
24407
|
+
return;
|
|
24408
|
+
}
|
|
24409
|
+
const top = Math.max(left.y, right.y);
|
|
24410
|
+
const bottom = Math.min(
|
|
24411
|
+
left.y + left.height,
|
|
24412
|
+
right.y + right.height
|
|
24413
|
+
);
|
|
24414
|
+
if (bottom > top) {
|
|
24415
|
+
sharedBoundaries.push({ x: boundary, top, bottom });
|
|
24416
|
+
}
|
|
24417
|
+
});
|
|
24418
|
+
});
|
|
24419
|
+
return segments.filter((segment) => {
|
|
24420
|
+
if (!nearlyEqual(segment.startX, segment.endX)) {
|
|
24421
|
+
return true;
|
|
24422
|
+
}
|
|
24423
|
+
const top = Math.min(segment.startY, segment.endY);
|
|
24424
|
+
const bottom = Math.max(segment.startY, segment.endY);
|
|
24425
|
+
return !sharedBoundaries.some(
|
|
24426
|
+
(boundary) => Math.abs(segment.startX - boundary.x) <= tolerance && bottom > boundary.top && top < boundary.bottom
|
|
24427
|
+
);
|
|
24428
|
+
});
|
|
24429
|
+
}
|
|
24430
|
+
function intersectRangeWithClip(rect, clipRect) {
|
|
24431
|
+
const left = Math.max(rect.x, clipRect.x);
|
|
24432
|
+
const top = Math.max(rect.y, clipRect.y);
|
|
24433
|
+
const right = Math.min(rect.x + rect.width, clipRect.x + clipRect.width);
|
|
24434
|
+
const bottom = Math.min(rect.y + rect.height, clipRect.y + clipRect.height);
|
|
24435
|
+
if (right <= left || bottom <= top) {
|
|
24436
|
+
return null;
|
|
24437
|
+
}
|
|
24438
|
+
return {
|
|
24439
|
+
x: left,
|
|
24440
|
+
y: top,
|
|
24441
|
+
width: right - left,
|
|
24442
|
+
height: bottom - top
|
|
24443
|
+
};
|
|
24444
|
+
}
|
|
24345
24445
|
function roundRangeBorderAtTableBottom(segments, width, height) {
|
|
24346
24446
|
const inset = 0.5;
|
|
24347
24447
|
const left = inset;
|
|
@@ -24535,11 +24635,11 @@ function drawRangeHighlightBorder(ctx, rect, edges = {}) {
|
|
|
24535
24635
|
}
|
|
24536
24636
|
function resolveActiveCellSectionClipRect(descriptor, params) {
|
|
24537
24637
|
const horizontal = descriptor.fixed === "left" ? { x: 0, width: params.fixedWidthLeft } : descriptor.fixed === "right" ? {
|
|
24538
|
-
x: params.
|
|
24539
|
-
width: params.fixedWidthRight
|
|
24638
|
+
x: params.rightStartX,
|
|
24639
|
+
width: params.fixedWidthRight + RIGHT_BORDER_CLIP_BLEED
|
|
24540
24640
|
} : {
|
|
24541
24641
|
x: params.fixedWidthLeft,
|
|
24542
|
-
width: params.
|
|
24642
|
+
width: Math.max(params.rightStartX - params.fixedWidthLeft, 0) + RIGHT_BORDER_CLIP_BLEED
|
|
24543
24643
|
};
|
|
24544
24644
|
if (!descriptor.frozen) {
|
|
24545
24645
|
return {
|
|
@@ -24755,6 +24855,33 @@ function executeListTableRenderPipeline(params) {
|
|
|
24755
24855
|
borderColor: theme.borderColor,
|
|
24756
24856
|
skipRanges: fixedLeftBoundarySkips
|
|
24757
24857
|
});
|
|
24858
|
+
drawFixedRightBoundary({
|
|
24859
|
+
ctx,
|
|
24860
|
+
rightBoundaryX: snapshot.columnMetrics.rightStartX + snapshot.columnMetrics.fixedWidthRight,
|
|
24861
|
+
fixedWidthRight: snapshot.columnMetrics.fixedWidthRight,
|
|
24862
|
+
height,
|
|
24863
|
+
borderColor: theme.borderColor
|
|
24864
|
+
});
|
|
24865
|
+
drawScrollbars(
|
|
24866
|
+
ctx,
|
|
24867
|
+
snapshot.scrollbarLayout,
|
|
24868
|
+
descriptors,
|
|
24869
|
+
theme.borderColor,
|
|
24870
|
+
scrollbarOpacity,
|
|
24871
|
+
isScrollbarInteractive,
|
|
24872
|
+
{
|
|
24873
|
+
x: width,
|
|
24874
|
+
width: options.scrollbar?.visible === false ? 0 : Math.max(
|
|
24875
|
+
options.scrollbar?.thickness ?? DEFAULT_SCROLLBAR_THICKNESS,
|
|
24876
|
+
6
|
|
24877
|
+
),
|
|
24878
|
+
top: 0,
|
|
24879
|
+
height,
|
|
24880
|
+
headerBottom: headerHeight,
|
|
24881
|
+
headerBackgroundColor: theme.headerBackgroundColor,
|
|
24882
|
+
bodyBackgroundColor: theme.backgroundColor
|
|
24883
|
+
}
|
|
24884
|
+
);
|
|
24758
24885
|
drawActiveCellOverlay({
|
|
24759
24886
|
ctx,
|
|
24760
24887
|
layout: resolveActiveCellOverlayLayout({
|
|
@@ -24770,6 +24897,7 @@ function executeListTableRenderPipeline(params) {
|
|
|
24770
24897
|
bottomFrozenHeight,
|
|
24771
24898
|
fixedWidthLeft: snapshot.columnMetrics.fixedWidthLeft,
|
|
24772
24899
|
fixedWidthRight: snapshot.columnMetrics.fixedWidthRight,
|
|
24900
|
+
rightStartX: snapshot.columnMetrics.rightStartX,
|
|
24773
24901
|
availableCenterWidth: snapshot.columnMetrics.availableCenterWidth,
|
|
24774
24902
|
rangeHighlight,
|
|
24775
24903
|
highlightMode: options.highlightMode,
|
|
@@ -24783,26 +24911,6 @@ function executeListTableRenderPipeline(params) {
|
|
|
24783
24911
|
indicatorY: rowDragIndicator.y
|
|
24784
24912
|
});
|
|
24785
24913
|
}
|
|
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
24914
|
if (headerDraggingIndicator) {
|
|
24807
24915
|
drawDragOverlayFrame({
|
|
24808
24916
|
ctx,
|
|
@@ -25378,7 +25486,7 @@ function resolvePaginationSignature(params) {
|
|
|
25378
25486
|
return [
|
|
25379
25487
|
paginationConfig ? "enabled" : "disabled",
|
|
25380
25488
|
paginationConfig?.mode ?? "",
|
|
25381
|
-
params.total,
|
|
25489
|
+
paginationConfig?.total ?? params.total,
|
|
25382
25490
|
params.currentPage,
|
|
25383
25491
|
params.pageSize,
|
|
25384
25492
|
params.scrollPageSize,
|
|
@@ -27101,6 +27209,11 @@ function collectGroupingColumnItems(columns) {
|
|
|
27101
27209
|
});
|
|
27102
27210
|
}
|
|
27103
27211
|
|
|
27212
|
+
// src/engine/column-config-update-policy.ts
|
|
27213
|
+
function shouldPersistIncomingColumnConfig(previousRevision, nextRevision) {
|
|
27214
|
+
return nextRevision !== void 0 && nextRevision !== previousRevision;
|
|
27215
|
+
}
|
|
27216
|
+
|
|
27104
27217
|
// src/engine/list-table-engine.ts
|
|
27105
27218
|
var ListTableCore = class {
|
|
27106
27219
|
/**
|
|
@@ -27192,6 +27305,10 @@ var ListTableCore = class {
|
|
|
27192
27305
|
updateOptions(options) {
|
|
27193
27306
|
this.animationController.stopCarouselScroll();
|
|
27194
27307
|
const host = this.asAssemblyHost();
|
|
27308
|
+
const shouldPersistColumnConfig = shouldPersistIncomingColumnConfig(
|
|
27309
|
+
this.options.columnConfigRevision,
|
|
27310
|
+
options.columnConfigRevision
|
|
27311
|
+
);
|
|
27195
27312
|
const incomingColumnsAreRuntimeColumns = options.columns === this.options.columns;
|
|
27196
27313
|
const nextInitialColumns = incomingColumnsAreRuntimeColumns ? cloneColumns(host.initialColumns) : cloneColumns(options.columns);
|
|
27197
27314
|
const nextInitialStretchColumns = incomingColumnsAreRuntimeColumns ? host.initialStretchColumns : options.stretchColumns;
|
|
@@ -27235,7 +27352,11 @@ var ListTableCore = class {
|
|
|
27235
27352
|
this.hideFloatingOverlays({ includeLoading: true });
|
|
27236
27353
|
this.refreshRuntimeColumns();
|
|
27237
27354
|
this.renderController.render();
|
|
27238
|
-
|
|
27355
|
+
if (shouldPersistColumnConfig) {
|
|
27356
|
+
this.persistenceController.persistColumnConfig();
|
|
27357
|
+
} else {
|
|
27358
|
+
this.persistenceController.loadStoredConfig({ restoreQueryState: false });
|
|
27359
|
+
}
|
|
27239
27360
|
host.tableId = options.tableId?.trim() ? options.tableId : host.tableId;
|
|
27240
27361
|
host.rowDragController.syncRegistration();
|
|
27241
27362
|
}
|
|
@@ -27284,7 +27405,7 @@ var ListTableCore = class {
|
|
|
27284
27405
|
*/
|
|
27285
27406
|
changeDensity(density) {
|
|
27286
27407
|
this.headerActionController.changeTableDensity(
|
|
27287
|
-
density === "auto" ? "auto" : density === 32 ? "compact" : density === 56 ? "comfortable" : "middle"
|
|
27408
|
+
density === "auto" ? "auto" : density === 26 ? "ultra-compact" : density === 32 ? "compact" : density === 56 ? "comfortable" : "middle"
|
|
27288
27409
|
);
|
|
27289
27410
|
}
|
|
27290
27411
|
/**
|