From 217ef62912ee830592f37a5e721ee1fd9e90709c Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Mon, 16 Dec 2024 23:04:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E8=A1=A8=E8=87=AA=E5=8A=A8=E6=8D=A2=E8=A1=8C?= =?UTF-8?q?=EF=BC=8C=E5=BD=93=E9=AB=98=E5=BA=A6=E4=B8=8D=E5=A4=9F=E6=94=BE?= =?UTF-8?q?=E4=B8=8B=E4=B8=80=E8=A1=8C=E6=97=B6=E5=86=85=E5=AE=B9=E7=9A=84?= =?UTF-8?q?=E6=9C=80=E5=90=8E=E5=AD=97=E7=AC=A6=E6=98=BE=E7=A4=BA=E4=B8=BA?= =?UTF-8?q?=E7=9C=81=E7=95=A5=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/components/js/panel/common/common_table.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts b/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts index 7173729042..f38e9a87a4 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts @@ -1647,7 +1647,7 @@ const drawTextShape = (cell, isHeader) => { // 宽度能放几个字符,就放几个,放不下就换行 let wrapText = getWrapText(formattedValue ? formattedValue?.toString() : emptyPlaceholder, textStyle, cell.meta.width, cell.spreadsheet) const lines = wrapText.split(lineBreak) - + let extraStyleFontSize = textStyle.fontSize // 不是表头,处理文本高度和换行 if (!isHeader) { const textHeight = getWrapTextHeight(wrapText.replaceAll(lineBreak, ''), textStyle, cell.spreadsheet, maxLines) @@ -1655,8 +1655,8 @@ const drawTextShape = (cell, isHeader) => { const wrapTextArr = lines.slice(0, lineCountInCell) // 根据行数调整换行后的文本内容 - wrapText = lineCountInCell === 1 - ? lines[0].slice(0, -1) + ellipsis + wrapText = lineCountInCell < 1 + ? ellipsis : wrapTextArr.join(lineBreak) || ellipsis const resultWrapArr = wrapText.split(lineBreak) // 控制最大行数 @@ -1668,6 +1668,9 @@ const drawTextShape = (cell, isHeader) => { temp[temp.length - 1] = temp[temp.length-1].slice(0,firstLineStrNumber - 1) + ellipsis wrapText = temp.join(lineBreak) } + if (wrapText === ellipsis) { + extraStyleFontSize = 12 + } } else { const resultWrapArr = wrapText.split(lineBreak) // 控制最大行数 @@ -1687,7 +1690,7 @@ const drawTextShape = (cell, isHeader) => { // 获取文本位置并渲染文本 const position = cell.getTextPosition() // 绘制文本 - cell.textShape = renderText(cell, [cell.textShape], position.x, position.y, wrapText, textStyle) + cell.textShape = renderText(cell, [cell.textShape], position.x, position.y, wrapText, textStyle, {fontSize:extraStyleFontSize}) // 将文本形状添加到形状数组 cell.textShapes.push(cell.textShape)