From 82de4ee36c7e9dd624786b9fa3ec0a96e95a63a2 Mon Sep 17 00:00:00 2001 From: wisonic Date: Fri, 27 Sep 2024 19:25:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E6=B1=87=E6=80=BB?= =?UTF-8?q?=E8=A1=A8=E6=80=BB=E8=AE=A1=E8=A1=8C=E5=92=8C=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=A1=8C=E4=B9=8B=E9=97=B4=E4=B8=8D=E7=95=99=E7=99=BD=20#12243?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/charts/table/table-normal.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-normal.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-normal.ts index 5171b8aae8..a5fbcf4053 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-normal.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-normal.ts @@ -209,6 +209,19 @@ export class TableNormal extends S2ChartView { } // 开始渲染 const newChart = new TableSheet(containerDom, s2DataConfig, s2Options) + // 总计紧贴在单元格后面 + if (customAttr.basicStyle.showSummary) { + newChart.on(S2Event.LAYOUT_BEFORE_RENDER, () => { + const totalHeight = + customAttr.tableHeader.tableTitleHeight * 2 + + customAttr.tableCell.tableItemHeight * (newData.length - 1) + if (totalHeight < newChart.options.height) { + // 6 是阴影高度 + newChart.options.height = + totalHeight < newChart.options.height - 6 ? totalHeight + 6 : totalHeight + } + }) + } // 自适应铺满 if (customAttr.basicStyle.tableColumnMode === 'adapt') { newChart.on(S2Event.LAYOUT_RESIZE_COL_WIDTH, () => {