@canvas-components/list-table 0.2.4 → 0.2.6
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/README.md +1 -1
- package/dist/index.cjs +231 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -9
- package/dist/index.d.ts +20 -9
- package/dist/index.js +232 -63
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ table.mount();
|
|
|
80
80
|
| `carouselScroll` | `ListTableCarouselScrollOptions` | 自动轮播滚动配置 |
|
|
81
81
|
| `stretchColumns` | `boolean` | 列总宽不足时是否拉伸补齐 |
|
|
82
82
|
| `resizable` | `boolean` | 是否开启列宽拖拽 |
|
|
83
|
-
| `storageKey` | `string` |
|
|
83
|
+
| `storageKey` | `string` | 列配置、查询、缩放和密度持久化键 |
|
|
84
84
|
| `draggable` | `boolean` | 是否开启列拖拽排序 |
|
|
85
85
|
| `tableId` | `string` | 表格唯一标识 |
|
|
86
86
|
| `rowDrag` | `ListTableRowDragOptions` | 行拖拽配置 |
|
package/dist/index.cjs
CHANGED
|
@@ -239,11 +239,18 @@ var CanvasRenderer = class {
|
|
|
239
239
|
height: Math.max(height, 0)
|
|
240
240
|
} : this.resolveCoverSize(width, height);
|
|
241
241
|
this.ctx.fillRect(0, safeTop, cover.width, cover.height);
|
|
242
|
+
const centerX = cover.width / 2;
|
|
243
|
+
const centerY = safeTop + cover.height / 2;
|
|
244
|
+
const showImage = cover.width >= 80 && cover.height >= 72;
|
|
245
|
+
if (showImage) {
|
|
246
|
+
const imageTop = centerY - 36;
|
|
247
|
+
drawSimpleEmptyIllustration(this.ctx, centerX - 32, imageTop);
|
|
248
|
+
}
|
|
242
249
|
this.ctx.fillStyle = this.theme.emptyTextColor;
|
|
243
250
|
this.ctx.font = `${this.theme.fontSize}px ${this.theme.fontFamily}`;
|
|
244
251
|
this.ctx.textAlign = "center";
|
|
245
252
|
this.ctx.textBaseline = "middle";
|
|
246
|
-
this.ctx.fillText(text,
|
|
253
|
+
this.ctx.fillText(text, centerX, showImage ? centerY + 28 : centerY);
|
|
247
254
|
this.ctx.restore();
|
|
248
255
|
}
|
|
249
256
|
/**
|
|
@@ -257,6 +264,49 @@ var CanvasRenderer = class {
|
|
|
257
264
|
};
|
|
258
265
|
}
|
|
259
266
|
};
|
|
267
|
+
function drawSimpleEmptyIllustration(ctx, left, top) {
|
|
268
|
+
ctx.save();
|
|
269
|
+
ctx.translate(left, top + 1);
|
|
270
|
+
ctx.beginPath();
|
|
271
|
+
ctx.ellipse(32, 33, 32, 7, 0, 0, Math.PI * 2);
|
|
272
|
+
ctx.fillStyle = "#f5f5f5";
|
|
273
|
+
ctx.fill();
|
|
274
|
+
ctx.strokeStyle = "#d9d9d9";
|
|
275
|
+
ctx.lineWidth = 1;
|
|
276
|
+
ctx.beginPath();
|
|
277
|
+
ctx.moveTo(55, 12.76);
|
|
278
|
+
ctx.lineTo(44.854, 1.258);
|
|
279
|
+
ctx.bezierCurveTo(44.367, 0.474, 43.656, 0, 42.907, 0);
|
|
280
|
+
ctx.lineTo(21.093, 0);
|
|
281
|
+
ctx.bezierCurveTo(20.344, 0, 19.633, 0.474, 19.146, 1.257);
|
|
282
|
+
ctx.lineTo(9, 12.761);
|
|
283
|
+
ctx.lineTo(9, 22);
|
|
284
|
+
ctx.lineTo(55, 22);
|
|
285
|
+
ctx.lineTo(55, 12.76);
|
|
286
|
+
ctx.closePath();
|
|
287
|
+
ctx.stroke();
|
|
288
|
+
ctx.beginPath();
|
|
289
|
+
ctx.moveTo(41.613, 15.931);
|
|
290
|
+
ctx.bezierCurveTo(41.613, 14.326, 42.607, 13.001, 43.84, 13);
|
|
291
|
+
ctx.lineTo(55, 13);
|
|
292
|
+
ctx.lineTo(55, 31.137);
|
|
293
|
+
ctx.bezierCurveTo(55, 33.26, 53.68, 35, 52.05, 35);
|
|
294
|
+
ctx.lineTo(11.95, 35);
|
|
295
|
+
ctx.bezierCurveTo(10.32, 35, 9, 33.259, 9, 31.137);
|
|
296
|
+
ctx.lineTo(9, 13);
|
|
297
|
+
ctx.lineTo(20.16, 13);
|
|
298
|
+
ctx.bezierCurveTo(21.393, 13, 22.387, 14.323, 22.387, 15.928);
|
|
299
|
+
ctx.lineTo(22.387, 15.95);
|
|
300
|
+
ctx.bezierCurveTo(22.387, 17.555, 23.392, 18.851, 24.624, 18.851);
|
|
301
|
+
ctx.lineTo(39.376, 18.851);
|
|
302
|
+
ctx.bezierCurveTo(40.608, 18.851, 41.613, 17.543, 41.613, 15.938);
|
|
303
|
+
ctx.lineTo(41.613, 15.931);
|
|
304
|
+
ctx.closePath();
|
|
305
|
+
ctx.fillStyle = "#fafafa";
|
|
306
|
+
ctx.fill();
|
|
307
|
+
ctx.stroke();
|
|
308
|
+
ctx.restore();
|
|
309
|
+
}
|
|
260
310
|
|
|
261
311
|
// src/domain/columns/compute-column-widths.ts
|
|
262
312
|
function computeColumnWidths(columns) {
|
|
@@ -930,10 +980,11 @@ function collectLeafColumns(columns) {
|
|
|
930
980
|
}
|
|
931
981
|
|
|
932
982
|
// src/domain/constants.ts
|
|
933
|
-
var DEFAULT_ROW_HEIGHT =
|
|
934
|
-
var DEFAULT_HEADER_ROW_HEIGHT =
|
|
983
|
+
var DEFAULT_ROW_HEIGHT = 32;
|
|
984
|
+
var DEFAULT_HEADER_ROW_HEIGHT = DEFAULT_ROW_HEIGHT;
|
|
935
985
|
var HORIZONTAL_SCROLL_STEP = 120;
|
|
936
|
-
var DEFAULT_SUMMARY_ROW_HEIGHT =
|
|
986
|
+
var DEFAULT_SUMMARY_ROW_HEIGHT = DEFAULT_ROW_HEIGHT;
|
|
987
|
+
var DEFAULT_EMPTY_BODY_HEIGHT = 96;
|
|
937
988
|
var DEFAULT_PAGINATION_PAGE_SIZE = 10;
|
|
938
989
|
var FALLBACK_TABLE_WIDTH = 320;
|
|
939
990
|
var FALLBACK_TABLE_HEIGHT = 240;
|
|
@@ -1507,8 +1558,8 @@ var defaultListTableTheme = {
|
|
|
1507
1558
|
hoverBackgroundColor: "#edf4ff",
|
|
1508
1559
|
selectionBackgroundColor: "#dbeafe",
|
|
1509
1560
|
textSelectionBackgroundColor: "#99c2ff",
|
|
1510
|
-
emptyBackgroundColor: "#
|
|
1511
|
-
emptyTextColor: "#
|
|
1561
|
+
emptyBackgroundColor: "#ffffff",
|
|
1562
|
+
emptyTextColor: "#8c8c8c",
|
|
1512
1563
|
debugStrokeColor: "#ef4444",
|
|
1513
1564
|
debugFillColor: "rgba(239, 68, 68, 0.08)",
|
|
1514
1565
|
fontFamily: '"Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif',
|
|
@@ -5874,6 +5925,9 @@ function drawBodyTextContent(params) {
|
|
|
5874
5925
|
searchMatch,
|
|
5875
5926
|
fragmentKey = `content:${contentIndex}`
|
|
5876
5927
|
} = params;
|
|
5928
|
+
if (params.content.visible === false || params.content.style?.display === "none") {
|
|
5929
|
+
return void 0;
|
|
5930
|
+
}
|
|
5877
5931
|
ctx.save();
|
|
5878
5932
|
ctx.globalAlpha *= resolveContentOpacity(content);
|
|
5879
5933
|
applyTextContentStyle(
|
|
@@ -5985,6 +6039,9 @@ function drawBodyTextContent(params) {
|
|
|
5985
6039
|
return width;
|
|
5986
6040
|
}
|
|
5987
6041
|
function measureTextContentWidth(ctx, content, theme) {
|
|
6042
|
+
if (content.visible === false || content.style?.display === "none") {
|
|
6043
|
+
return 0;
|
|
6044
|
+
}
|
|
5988
6045
|
applyTextContentStyle(ctx, content, theme.textColor, theme);
|
|
5989
6046
|
const intrinsicWidth = Math.max(
|
|
5990
6047
|
ctx.measureText(content.text).width + resolveContentTextIndent(content),
|
|
@@ -6175,6 +6232,11 @@ var CONTENT_HORIZONTAL_PADDING = 12;
|
|
|
6175
6232
|
var CONTENT_GAP = 8;
|
|
6176
6233
|
var CONTENT_VERTICAL_PADDING = 6;
|
|
6177
6234
|
function resolveBodyCellContents(params) {
|
|
6235
|
+
return resolveRawBodyCellContents(params).filter(
|
|
6236
|
+
(content) => content.visible !== false && content.style?.display !== "none"
|
|
6237
|
+
);
|
|
6238
|
+
}
|
|
6239
|
+
function resolveRawBodyCellContents(params) {
|
|
6178
6240
|
const { record, rowIndex, column } = params;
|
|
6179
6241
|
const value = utils.getValueByDataIndex(record, column.dataIndex);
|
|
6180
6242
|
const rendered = column.render?.(value, record, rowIndex, column);
|
|
@@ -6319,7 +6381,9 @@ function normalizeCellContents(contents) {
|
|
|
6319
6381
|
return [normalizeCellContentItem(contents)];
|
|
6320
6382
|
}
|
|
6321
6383
|
function normalizeDrawableCellContents(contents) {
|
|
6322
|
-
return contents.
|
|
6384
|
+
return contents.filter(
|
|
6385
|
+
(content) => content.visible !== false && content.style?.display !== "none"
|
|
6386
|
+
).map(normalizeCellContentItem);
|
|
6323
6387
|
}
|
|
6324
6388
|
function normalizeCellContentItem(content) {
|
|
6325
6389
|
if (content.type !== "money") {
|
|
@@ -6329,6 +6393,7 @@ function normalizeCellContentItem(content) {
|
|
|
6329
6393
|
type: "text",
|
|
6330
6394
|
text: formatMoneyValue(content.value, content),
|
|
6331
6395
|
key: content.key,
|
|
6396
|
+
visible: content.visible,
|
|
6332
6397
|
style: content.style,
|
|
6333
6398
|
cursor: content.cursor,
|
|
6334
6399
|
onClick: content.onClick,
|
|
@@ -7999,15 +8064,11 @@ function resolvePointerHitWithScrollbars(result, x, y, scrollbarLayout) {
|
|
|
7999
8064
|
return result;
|
|
8000
8065
|
}
|
|
8001
8066
|
function resolveScrollbarVisibility(params) {
|
|
8002
|
-
const
|
|
8003
|
-
|
|
8004
|
-
if (scrollbarOption?.visible === true) {
|
|
8067
|
+
const scrollbarOption = params.options.scrollbar;
|
|
8068
|
+
if (scrollbarOption?.visible !== false) {
|
|
8005
8069
|
return true;
|
|
8006
8070
|
}
|
|
8007
|
-
|
|
8008
|
-
return false;
|
|
8009
|
-
}
|
|
8010
|
-
return draggingScrollbar || continuousScrollActive || hover.area === "horizontal-scrollbar" || hover.area === "vertical-scrollbar" || hover.area !== "empty" || now2 < scrollbarActiveUntil;
|
|
8071
|
+
return false;
|
|
8011
8072
|
}
|
|
8012
8073
|
|
|
8013
8074
|
// src/services/pointer-hit-service.ts
|
|
@@ -13623,13 +13684,13 @@ function showHeaderContextMenu(params) {
|
|
|
13623
13684
|
return true;
|
|
13624
13685
|
}
|
|
13625
13686
|
function resolveContextMenuDensity(rowHeight) {
|
|
13626
|
-
if (rowHeight ===
|
|
13687
|
+
if (rowHeight === 56) {
|
|
13627
13688
|
return "comfortable";
|
|
13628
13689
|
}
|
|
13629
13690
|
if (rowHeight === 32) {
|
|
13630
13691
|
return "compact";
|
|
13631
13692
|
}
|
|
13632
|
-
return "middle";
|
|
13693
|
+
return rowHeight === 48 ? "middle" : "compact";
|
|
13633
13694
|
}
|
|
13634
13695
|
|
|
13635
13696
|
// src/features/tooltip/tooltip-feature.ts
|
|
@@ -15199,7 +15260,7 @@ var ListTableEventController = class {
|
|
|
15199
15260
|
headerTree: this.host.headerTree,
|
|
15200
15261
|
headerRowsCache: this.host.headerRowsCache,
|
|
15201
15262
|
pointerX: position.x,
|
|
15202
|
-
headerRowHeight: DEFAULT_HEADER_ROW_HEIGHT,
|
|
15263
|
+
headerRowHeight: this.host.currentRenderSnapshot?.headerRowHeight ?? DEFAULT_HEADER_ROW_HEIGHT,
|
|
15203
15264
|
allowGrouping: this.host.groupBarVisible,
|
|
15204
15265
|
getMovableLeafColumns: (node, hitRect) => getHeaderNodeMovableLeafColumns({
|
|
15205
15266
|
node,
|
|
@@ -15536,7 +15597,7 @@ var ListTableEventController = class {
|
|
|
15536
15597
|
},
|
|
15537
15598
|
summaryVisible: Boolean(this.host.currentRenderSnapshot?.hasSummary),
|
|
15538
15599
|
onToggleSummary: () => {
|
|
15539
|
-
this.host.options.summaryRowHeight = this.host.currentRenderSnapshot?.hasSummary ? 0 : DEFAULT_SUMMARY_ROW_HEIGHT;
|
|
15600
|
+
this.host.options.summaryRowHeight = this.host.currentRenderSnapshot?.hasSummary ? 0 : this.host.currentRenderSnapshot?.rowHeight ?? DEFAULT_SUMMARY_ROW_HEIGHT;
|
|
15540
15601
|
this.host.persistColumnConfig();
|
|
15541
15602
|
this.host.render();
|
|
15542
15603
|
},
|
|
@@ -17401,9 +17462,9 @@ function resolveToggleHeaderColumnVisibilityAction(params) {
|
|
|
17401
17462
|
function resolveDensitySizes(density) {
|
|
17402
17463
|
if (density === "comfortable") {
|
|
17403
17464
|
return {
|
|
17404
|
-
rowHeight:
|
|
17405
|
-
headerRowHeight:
|
|
17406
|
-
summaryRowHeight:
|
|
17465
|
+
rowHeight: 56,
|
|
17466
|
+
headerRowHeight: 56,
|
|
17467
|
+
summaryRowHeight: 56
|
|
17407
17468
|
};
|
|
17408
17469
|
}
|
|
17409
17470
|
if (density === "compact") {
|
|
@@ -17414,9 +17475,9 @@ function resolveDensitySizes(density) {
|
|
|
17414
17475
|
};
|
|
17415
17476
|
}
|
|
17416
17477
|
return {
|
|
17417
|
-
rowHeight:
|
|
17418
|
-
headerRowHeight:
|
|
17419
|
-
summaryRowHeight:
|
|
17478
|
+
rowHeight: 48,
|
|
17479
|
+
headerRowHeight: 48,
|
|
17480
|
+
summaryRowHeight: 48
|
|
17420
17481
|
};
|
|
17421
17482
|
}
|
|
17422
17483
|
|
|
@@ -17567,6 +17628,9 @@ var ListTableHeaderActionController = class {
|
|
|
17567
17628
|
headerRowHeight: nextSize.headerRowHeight,
|
|
17568
17629
|
summaryRowHeight: nextSize.summaryRowHeight
|
|
17569
17630
|
});
|
|
17631
|
+
this.options.resetSummaryValues();
|
|
17632
|
+
options.ui?.onDensityChange?.(nextSize.rowHeight);
|
|
17633
|
+
this.options.persistColumnConfig();
|
|
17570
17634
|
this.options.hideHeaderContextMenu();
|
|
17571
17635
|
this.options.requestRender();
|
|
17572
17636
|
}
|
|
@@ -18036,7 +18100,7 @@ function applyStoredColumnConfig(columns, storedColumns) {
|
|
|
18036
18100
|
};
|
|
18037
18101
|
applyToColumns(columns);
|
|
18038
18102
|
}
|
|
18039
|
-
function buildStoredColumnConfig(columns, sortState, filterState, zoom, summaryRowHeight) {
|
|
18103
|
+
function buildStoredColumnConfig(columns, sortState, filterState, zoom, summaryRowHeight, density) {
|
|
18040
18104
|
const result = {};
|
|
18041
18105
|
const collectColumns = (cols) => {
|
|
18042
18106
|
for (const col of cols) {
|
|
@@ -18071,7 +18135,8 @@ function buildStoredColumnConfig(columns, sortState, filterState, zoom, summaryR
|
|
|
18071
18135
|
},
|
|
18072
18136
|
filters: filterState,
|
|
18073
18137
|
...typeof zoom === "number" && Number.isFinite(zoom) && zoom > 0 ? { zoom } : null,
|
|
18074
|
-
...typeof summaryRowHeight === "number" && Number.isFinite(summaryRowHeight) && summaryRowHeight >= 0 ? { summaryRowHeight } : null
|
|
18138
|
+
...typeof summaryRowHeight === "number" && Number.isFinite(summaryRowHeight) && summaryRowHeight >= 0 ? { summaryRowHeight } : null,
|
|
18139
|
+
...density === 32 || density === 48 || density === 56 ? { density } : null
|
|
18075
18140
|
};
|
|
18076
18141
|
}
|
|
18077
18142
|
|
|
@@ -18083,7 +18148,8 @@ function persistListTableColumnConfig(params) {
|
|
|
18083
18148
|
sortState,
|
|
18084
18149
|
filterState,
|
|
18085
18150
|
zoom,
|
|
18086
|
-
summaryRowHeight
|
|
18151
|
+
summaryRowHeight,
|
|
18152
|
+
density
|
|
18087
18153
|
} = params;
|
|
18088
18154
|
if (!storageKey) {
|
|
18089
18155
|
return;
|
|
@@ -18096,7 +18162,8 @@ function persistListTableColumnConfig(params) {
|
|
|
18096
18162
|
sortState,
|
|
18097
18163
|
filterState,
|
|
18098
18164
|
zoom,
|
|
18099
|
-
summaryRowHeight
|
|
18165
|
+
summaryRowHeight,
|
|
18166
|
+
density
|
|
18100
18167
|
)
|
|
18101
18168
|
);
|
|
18102
18169
|
}
|
|
@@ -18118,7 +18185,8 @@ async function loadListTableStoredConfig(params) {
|
|
|
18118
18185
|
} : null,
|
|
18119
18186
|
filterState: stored.filters ? stored.filters : null,
|
|
18120
18187
|
zoom: typeof stored.zoom === "number" && Number.isFinite(stored.zoom) && stored.zoom > 0 ? stored.zoom : null,
|
|
18121
|
-
summaryRowHeight: typeof stored.summaryRowHeight === "number" && Number.isFinite(stored.summaryRowHeight) && stored.summaryRowHeight >= 0 ? stored.summaryRowHeight : null
|
|
18188
|
+
summaryRowHeight: typeof stored.summaryRowHeight === "number" && Number.isFinite(stored.summaryRowHeight) && stored.summaryRowHeight >= 0 ? stored.summaryRowHeight : null,
|
|
18189
|
+
density: stored.density === 32 || stored.density === 48 || stored.density === 56 ? stored.density : null
|
|
18122
18190
|
};
|
|
18123
18191
|
}
|
|
18124
18192
|
|
|
@@ -18149,13 +18217,26 @@ var ListTablePersistenceController = class {
|
|
|
18149
18217
|
this.options.domHost.setContentZoom(nextZoom);
|
|
18150
18218
|
this.options.canvasHost.setContentZoom(nextZoom);
|
|
18151
18219
|
}
|
|
18220
|
+
let currentOptions = this.options.getOptions();
|
|
18221
|
+
if (stored.density != null) {
|
|
18222
|
+
currentOptions = {
|
|
18223
|
+
...currentOptions,
|
|
18224
|
+
rowHeight: stored.density,
|
|
18225
|
+
headerRowHeight: stored.density,
|
|
18226
|
+
summaryRowHeight: stored.density
|
|
18227
|
+
};
|
|
18228
|
+
}
|
|
18152
18229
|
if (stored.summaryRowHeight != null) {
|
|
18153
|
-
|
|
18154
|
-
|
|
18155
|
-
|
|
18156
|
-
|
|
18157
|
-
|
|
18158
|
-
|
|
18230
|
+
currentOptions = {
|
|
18231
|
+
...currentOptions,
|
|
18232
|
+
summaryRowHeight: stored.summaryRowHeight
|
|
18233
|
+
};
|
|
18234
|
+
}
|
|
18235
|
+
if (currentOptions !== this.options.getOptions()) {
|
|
18236
|
+
this.options.setOptions(currentOptions);
|
|
18237
|
+
if (stored.density != null) {
|
|
18238
|
+
this.options.resetSummaryValues();
|
|
18239
|
+
currentOptions.ui?.onDensityChange?.(stored.density);
|
|
18159
18240
|
}
|
|
18160
18241
|
}
|
|
18161
18242
|
this.options.refreshRuntimeColumns();
|
|
@@ -18169,7 +18250,8 @@ var ListTablePersistenceController = class {
|
|
|
18169
18250
|
sortState: this.options.getSortState(),
|
|
18170
18251
|
filterState: this.options.getFilterState(),
|
|
18171
18252
|
zoom: this.options.getTableZoom(),
|
|
18172
|
-
summaryRowHeight: tableOptions.summaryRowHeight
|
|
18253
|
+
summaryRowHeight: tableOptions.summaryRowHeight,
|
|
18254
|
+
density: tableOptions.rowHeight
|
|
18173
18255
|
});
|
|
18174
18256
|
}
|
|
18175
18257
|
};
|
|
@@ -18529,7 +18611,7 @@ function computeScrollbarLayout(params) {
|
|
|
18529
18611
|
};
|
|
18530
18612
|
}
|
|
18531
18613
|
const verticalTrackHeight = Math.max(
|
|
18532
|
-
params.bodyHeight - verticalTop - verticalBottom
|
|
18614
|
+
params.bodyHeight - verticalTop - verticalBottom,
|
|
18533
18615
|
0
|
|
18534
18616
|
);
|
|
18535
18617
|
const verticalTrackX = params.width - thickness - verticalRight;
|
|
@@ -19983,7 +20065,6 @@ function resolveExpandedRowHeight2(height, record, index) {
|
|
|
19983
20065
|
|
|
19984
20066
|
// src/services/layout-service.ts
|
|
19985
20067
|
var AUTO_ROW_HEIGHT_SAMPLE_COUNT = 200;
|
|
19986
|
-
var LIST_TABLE_GROUPING_BAR_HEIGHT = 44;
|
|
19987
20068
|
function buildListTableRenderSnapshot(params) {
|
|
19988
20069
|
if (params.cache?.snapshot && params.cache.snapshot.groupIndex === params.cache.groupIndex && isSameRenderCacheInputs(params.cache.inputs, params)) {
|
|
19989
20070
|
const snapshotStartedAt2 = resolvePerformanceNow2();
|
|
@@ -20010,8 +20091,8 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20010
20091
|
const {
|
|
20011
20092
|
options,
|
|
20012
20093
|
theme,
|
|
20013
|
-
width,
|
|
20014
|
-
height,
|
|
20094
|
+
width: hostWidth,
|
|
20095
|
+
height: hostHeight,
|
|
20015
20096
|
scroll,
|
|
20016
20097
|
selectedRowKeys,
|
|
20017
20098
|
query,
|
|
@@ -20022,6 +20103,9 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20022
20103
|
baseRowsOverride,
|
|
20023
20104
|
displayRowsOverride
|
|
20024
20105
|
} = params;
|
|
20106
|
+
const scrollbarThickness = options.scrollbar?.visible === false ? 0 : Math.max(options.scrollbar?.thickness ?? 10, 6);
|
|
20107
|
+
let width = hostWidth;
|
|
20108
|
+
let height = hostHeight;
|
|
20025
20109
|
const sourceNormalizedColumns = normalizeColumns(
|
|
20026
20110
|
getResolvedColumns(options, selectedRowKeys)
|
|
20027
20111
|
);
|
|
@@ -20060,15 +20144,15 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20060
20144
|
const expandableState = resolveExpandableState({
|
|
20061
20145
|
expandable: options.expandable
|
|
20062
20146
|
});
|
|
20063
|
-
const rowHeight = options.rowHeight
|
|
20147
|
+
const rowHeight = options.rowHeight === "auto" ? resolveAutoRowHeight({
|
|
20064
20148
|
rows: queryRows.displayRows,
|
|
20065
20149
|
leafColumns,
|
|
20066
20150
|
theme,
|
|
20067
20151
|
cache: params.cache
|
|
20068
20152
|
}) : options.rowHeight ?? DEFAULT_ROW_HEIGHT;
|
|
20069
|
-
const headerRowHeight = options.headerRowHeight ??
|
|
20070
|
-
const summaryRowHeight = options.summaryRowHeight ??
|
|
20071
|
-
const groupingBarHeight = params.groupBarVisible ?
|
|
20153
|
+
const headerRowHeight = options.headerRowHeight ?? rowHeight;
|
|
20154
|
+
const summaryRowHeight = options.summaryRowHeight ?? rowHeight;
|
|
20155
|
+
const groupingBarHeight = params.groupBarVisible ? rowHeight : 0;
|
|
20072
20156
|
const columnHeaderHeight = (headerInfo.maxDepth + 1) * headerRowHeight;
|
|
20073
20157
|
const headerHeight = groupingBarHeight + columnHeaderHeight;
|
|
20074
20158
|
const hasConfiguredSummary = leafColumns.some(
|
|
@@ -20274,11 +20358,11 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20274
20358
|
scrollRowCount: plainRowWindow.totalRowCount
|
|
20275
20359
|
});
|
|
20276
20360
|
}
|
|
20277
|
-
|
|
20361
|
+
let columnMetrics = resolveColumnMetrics({
|
|
20278
20362
|
columns: leafColumns,
|
|
20279
20363
|
tableWidth: width
|
|
20280
20364
|
});
|
|
20281
|
-
|
|
20365
|
+
let viewportResult = computeViewport({
|
|
20282
20366
|
width,
|
|
20283
20367
|
height,
|
|
20284
20368
|
headerHeight,
|
|
@@ -20289,6 +20373,59 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20289
20373
|
fixedWidthRight: columnMetrics.fixedWidthRight,
|
|
20290
20374
|
scroll
|
|
20291
20375
|
});
|
|
20376
|
+
for (let index = 0; index < 2 && scrollbarThickness > 0; index += 1) {
|
|
20377
|
+
const nextWidth = Math.max(
|
|
20378
|
+
hostWidth - (viewportResult.viewport.maxScrollTop > 0 ? scrollbarThickness : 0),
|
|
20379
|
+
0
|
|
20380
|
+
);
|
|
20381
|
+
const nextHeight = Math.max(
|
|
20382
|
+
hostHeight - (viewportResult.viewport.maxScrollLeft > 0 ? scrollbarThickness : 0),
|
|
20383
|
+
0
|
|
20384
|
+
);
|
|
20385
|
+
if (nextWidth === width && nextHeight === height) {
|
|
20386
|
+
break;
|
|
20387
|
+
}
|
|
20388
|
+
width = nextWidth;
|
|
20389
|
+
height = nextHeight;
|
|
20390
|
+
bodyState = resolveCurrentBodyState();
|
|
20391
|
+
if (plainRowWindow) {
|
|
20392
|
+
bodyState.frozenRows.scroll.windowed = true;
|
|
20393
|
+
bodyState.frozenRows.scroll.rowIndexMap = plainRowWindow.rowIndexMap;
|
|
20394
|
+
bodyState.frozenRows.scroll.rowOffsetMap = plainRowWindow.rowOffsetMap;
|
|
20395
|
+
bodyState.bodyLayout = resolveBodyLayout({
|
|
20396
|
+
height,
|
|
20397
|
+
headerHeight,
|
|
20398
|
+
summaryRowHeight,
|
|
20399
|
+
hasSummary,
|
|
20400
|
+
rowHeight,
|
|
20401
|
+
totalBodyHeight: plainRowWindow.totalBodyHeight,
|
|
20402
|
+
topFrozenRowCount: 0,
|
|
20403
|
+
bottomFrozenRowCount: 0,
|
|
20404
|
+
scrollRowCount: plainRowWindow.totalRowCount
|
|
20405
|
+
});
|
|
20406
|
+
}
|
|
20407
|
+
columnMetrics = resolveColumnMetrics({
|
|
20408
|
+
columns: leafColumns,
|
|
20409
|
+
tableWidth: width
|
|
20410
|
+
});
|
|
20411
|
+
viewportResult = computeViewport({
|
|
20412
|
+
width,
|
|
20413
|
+
height,
|
|
20414
|
+
headerHeight,
|
|
20415
|
+
bodyHeight: bodyState.bodyLayout.scrollBodyHeight,
|
|
20416
|
+
totalWidth: columnMetrics.totalWidth,
|
|
20417
|
+
totalBodyHeight: bodyState.bodyLayout.totalBodyHeight,
|
|
20418
|
+
fixedWidthLeft: columnMetrics.fixedWidthLeft,
|
|
20419
|
+
fixedWidthRight: columnMetrics.fixedWidthRight,
|
|
20420
|
+
scroll
|
|
20421
|
+
});
|
|
20422
|
+
}
|
|
20423
|
+
scrollPageSize = resolveScrollPageSize({
|
|
20424
|
+
options,
|
|
20425
|
+
pageSize: query.pagination.pageSize,
|
|
20426
|
+
bodyHeight: bodyState.bodyLayout.scrollBodyHeight,
|
|
20427
|
+
rowHeight
|
|
20428
|
+
});
|
|
20292
20429
|
const nextScroll = viewportResult.scroll;
|
|
20293
20430
|
const columnSegments = resolveColumnSegments({
|
|
20294
20431
|
metrics: columnMetrics,
|
|
@@ -20296,8 +20433,8 @@ function buildListTableRenderSnapshot(params) {
|
|
|
20296
20433
|
swapAnimation
|
|
20297
20434
|
});
|
|
20298
20435
|
const scrollbarLayout = computeScrollbarLayout({
|
|
20299
|
-
width,
|
|
20300
|
-
height,
|
|
20436
|
+
width: hostWidth,
|
|
20437
|
+
height: hostHeight,
|
|
20301
20438
|
bodyTop: bodyState.bodyLayout.scrollBodyTop,
|
|
20302
20439
|
bodyHeight: bodyState.bodyLayout.scrollBodyHeight,
|
|
20303
20440
|
centerVisibleWidth: columnMetrics.availableCenterWidth,
|
|
@@ -20495,8 +20632,8 @@ function resolveUngroupedDataRowCount(visibleRows) {
|
|
|
20495
20632
|
function updateListTableRenderSnapshotScroll(params) {
|
|
20496
20633
|
const { snapshot, width, height, scroll, options } = params;
|
|
20497
20634
|
const viewportResult = computeViewport({
|
|
20498
|
-
width,
|
|
20499
|
-
height,
|
|
20635
|
+
width: snapshot.width,
|
|
20636
|
+
height: snapshot.height,
|
|
20500
20637
|
headerHeight: snapshot.bodyLayout.scrollBodyTop - snapshot.bodyLayout.topFrozenHeight,
|
|
20501
20638
|
bodyHeight: snapshot.bodyLayout.scrollBodyHeight,
|
|
20502
20639
|
totalWidth: snapshot.columnMetrics.totalWidth,
|
|
@@ -20932,7 +21069,7 @@ function resolveListTableRenderHostSize(params) {
|
|
|
20932
21069
|
}
|
|
20933
21070
|
|
|
20934
21071
|
// src/rendering/primitives/draw-scrollbars.ts
|
|
20935
|
-
function drawScrollbars(ctx, layout, descriptors, opacity = 1, interactive = true) {
|
|
21072
|
+
function drawScrollbars(ctx, layout, descriptors, borderColor, opacity = 1, interactive = true) {
|
|
20936
21073
|
const alpha = Number.isFinite(opacity) ? Math.min(Math.max(opacity, 0), 1) : 1;
|
|
20937
21074
|
if (alpha <= 1e-3) {
|
|
20938
21075
|
return;
|
|
@@ -20940,14 +21077,28 @@ function drawScrollbars(ctx, layout, descriptors, opacity = 1, interactive = tru
|
|
|
20940
21077
|
ctx.save();
|
|
20941
21078
|
ctx.globalAlpha = alpha;
|
|
20942
21079
|
if (layout.horizontal) {
|
|
20943
|
-
drawAxisScrollbar(
|
|
21080
|
+
drawAxisScrollbar(
|
|
21081
|
+
ctx,
|
|
21082
|
+
layout.horizontal,
|
|
21083
|
+
"horizontal",
|
|
21084
|
+
descriptors,
|
|
21085
|
+
borderColor,
|
|
21086
|
+
interactive
|
|
21087
|
+
);
|
|
20944
21088
|
}
|
|
20945
21089
|
if (layout.vertical) {
|
|
20946
|
-
drawAxisScrollbar(
|
|
21090
|
+
drawAxisScrollbar(
|
|
21091
|
+
ctx,
|
|
21092
|
+
layout.vertical,
|
|
21093
|
+
"vertical",
|
|
21094
|
+
descriptors,
|
|
21095
|
+
borderColor,
|
|
21096
|
+
interactive
|
|
21097
|
+
);
|
|
20947
21098
|
}
|
|
20948
21099
|
ctx.restore();
|
|
20949
21100
|
}
|
|
20950
|
-
function drawAxisScrollbar(ctx, layout, axis, descriptors, interactive) {
|
|
21101
|
+
function drawAxisScrollbar(ctx, layout, axis, descriptors, borderColor, interactive) {
|
|
20951
21102
|
const kind = axis === "horizontal" ? "horizontal-scrollbar" : "vertical-scrollbar";
|
|
20952
21103
|
if (interactive) {
|
|
20953
21104
|
descriptors.push({
|
|
@@ -20975,16 +21126,19 @@ function drawAxisScrollbar(ctx, layout, axis, descriptors, interactive) {
|
|
|
20975
21126
|
scrollbarRole: "increase-button"
|
|
20976
21127
|
});
|
|
20977
21128
|
}
|
|
20978
|
-
drawTrack(ctx, layout.track);
|
|
21129
|
+
drawTrack(ctx, layout.track, borderColor);
|
|
20979
21130
|
drawButton(ctx, layout.decreaseButton, axis, "decrease");
|
|
20980
21131
|
drawButton(ctx, layout.increaseButton, axis, "increase");
|
|
20981
21132
|
drawThumb(ctx, layout.thumb);
|
|
20982
21133
|
}
|
|
20983
|
-
function drawTrack(ctx, rect) {
|
|
21134
|
+
function drawTrack(ctx, rect, borderColor) {
|
|
20984
21135
|
ctx.save();
|
|
20985
21136
|
ctx.fillStyle = "rgba(148, 163, 184, 0.16)";
|
|
21137
|
+
ctx.strokeStyle = borderColor;
|
|
21138
|
+
ctx.lineWidth = 1;
|
|
20986
21139
|
roundRect(ctx, rect.x, rect.y, rect.width, rect.height, rect.height / 2);
|
|
20987
21140
|
ctx.fill();
|
|
21141
|
+
ctx.stroke();
|
|
20988
21142
|
ctx.restore();
|
|
20989
21143
|
}
|
|
20990
21144
|
function drawThumb(ctx, rect) {
|
|
@@ -23823,7 +23977,7 @@ function executeListTableRenderPipeline(params) {
|
|
|
23823
23977
|
renderer.drawEmpty(
|
|
23824
23978
|
width,
|
|
23825
23979
|
bodyAreaHeight,
|
|
23826
|
-
options.emptyText ?? "\
|
|
23980
|
+
options.emptyText ?? "\u6682\u65E0\u6570\u636E",
|
|
23827
23981
|
headerHeight
|
|
23828
23982
|
);
|
|
23829
23983
|
} else {
|
|
@@ -23990,6 +24144,7 @@ function executeListTableRenderPipeline(params) {
|
|
|
23990
24144
|
ctx,
|
|
23991
24145
|
snapshot.scrollbarLayout,
|
|
23992
24146
|
descriptors,
|
|
24147
|
+
theme.borderColor,
|
|
23993
24148
|
scrollbarOpacity,
|
|
23994
24149
|
isScrollbarInteractive
|
|
23995
24150
|
);
|
|
@@ -24340,7 +24495,7 @@ var ListTableRenderController = class {
|
|
|
24340
24495
|
const layoutWidth = hostSize.width / zoom;
|
|
24341
24496
|
const layoutAvailableHeight = availableHeight / zoom;
|
|
24342
24497
|
const currentSnapshot = this.currentRenderSnapshot;
|
|
24343
|
-
const measureSnapshot = currentSnapshot && currentSnapshot.width === layoutWidth && currentSnapshot.groupingBarHeight === (this.options.getGroupBarVisible?.() ?
|
|
24498
|
+
const measureSnapshot = currentSnapshot && currentSnapshot.width === layoutWidth && currentSnapshot.groupingBarHeight === (this.options.getGroupBarVisible?.() ? currentSnapshot.rowHeight : 0) && currentSnapshot.groupingColumns.map((column) => column.key).join("") === (this.options.getGroupColumnKeys?.() ?? []).join("") ? currentSnapshot : this.buildSnapshot(layoutWidth, layoutAvailableHeight, false);
|
|
24344
24499
|
if (!measureSnapshot) {
|
|
24345
24500
|
this.options.setFittedHeight(null);
|
|
24346
24501
|
return;
|
|
@@ -24353,7 +24508,7 @@ var ListTableRenderController = class {
|
|
|
24353
24508
|
topFrozenHeight: measureSnapshot.bodyLayout.topFrozenHeight,
|
|
24354
24509
|
totalBodyHeight: Math.max(
|
|
24355
24510
|
measureSnapshot.bodyLayout.totalBodyHeight,
|
|
24356
|
-
measureSnapshot.displayRows.length === 0 ? measureSnapshot.rowHeight : 0
|
|
24511
|
+
measureSnapshot.displayRows.length === 0 ? Math.max(measureSnapshot.rowHeight, DEFAULT_EMPTY_BODY_HEIGHT) : 0
|
|
24357
24512
|
),
|
|
24358
24513
|
bottomFrozenHeight: measureSnapshot.bodyLayout.bottomFrozenHeight,
|
|
24359
24514
|
summaryHeight: measureSnapshot.bodyLayout.summaryHeight
|
|
@@ -25655,9 +25810,7 @@ function assembleListTableCoreControllers(core, options) {
|
|
|
25655
25810
|
draggingScrollbar: core.draggingScrollbar != null,
|
|
25656
25811
|
continuousScrollActive: core.eventController.isContinuousScrollActive(),
|
|
25657
25812
|
hover: core.storeFacade.hover,
|
|
25658
|
-
scrollbarActiveUntil: core.animationController.getScrollbarActiveUntil()
|
|
25659
|
-
now: Date.now()
|
|
25660
|
-
});
|
|
25813
|
+
scrollbarActiveUntil: core.animationController.getScrollbarActiveUntil()});
|
|
25661
25814
|
const applyRenderResult = (result) => {
|
|
25662
25815
|
applyListTableRenderPassResult({
|
|
25663
25816
|
didRender: result.didRender,
|
|
@@ -25963,6 +26116,7 @@ function assembleListTableCoreControllers(core, options) {
|
|
|
25963
26116
|
}
|
|
25964
26117
|
},
|
|
25965
26118
|
isEditing: () => core.editingController.getSession() != null,
|
|
26119
|
+
resetSummaryValues: () => core.summaryController.reset(),
|
|
25966
26120
|
requestRender: () => render()
|
|
25967
26121
|
});
|
|
25968
26122
|
core.contentActionController = new ListTableContentActionController({
|
|
@@ -25991,6 +26145,7 @@ function assembleListTableCoreControllers(core, options) {
|
|
|
25991
26145
|
domHost: core.domHost,
|
|
25992
26146
|
canvasHost: core.canvasHost,
|
|
25993
26147
|
refreshRuntimeColumns,
|
|
26148
|
+
resetSummaryValues: () => core.summaryController.reset(),
|
|
25994
26149
|
requestRender: () => render()
|
|
25995
26150
|
});
|
|
25996
26151
|
core.carouselController = new ListTableCarouselController({
|
|
@@ -26453,6 +26608,14 @@ var ListTableCore = class {
|
|
|
26453
26608
|
resetFilter() {
|
|
26454
26609
|
this.headerActionController.resetFilters();
|
|
26455
26610
|
}
|
|
26611
|
+
/**
|
|
26612
|
+
* 设置内置表格密度。
|
|
26613
|
+
*/
|
|
26614
|
+
changeDensity(density) {
|
|
26615
|
+
this.headerActionController.changeTableDensity(
|
|
26616
|
+
density === 32 ? "compact" : density === 56 ? "comfortable" : "middle"
|
|
26617
|
+
);
|
|
26618
|
+
}
|
|
26456
26619
|
/**
|
|
26457
26620
|
* 销毁实例。
|
|
26458
26621
|
*/
|
|
@@ -26575,6 +26738,12 @@ var ListTable = class {
|
|
|
26575
26738
|
resetFilter() {
|
|
26576
26739
|
this.core?.resetFilter();
|
|
26577
26740
|
}
|
|
26741
|
+
/**
|
|
26742
|
+
* 设置并持久化内置表格密度。
|
|
26743
|
+
*/
|
|
26744
|
+
changeDensity(density) {
|
|
26745
|
+
this.core?.changeDensity(density);
|
|
26746
|
+
}
|
|
26578
26747
|
/**
|
|
26579
26748
|
* 销毁实例。
|
|
26580
26749
|
*/
|