From 4413602e67341074a9e472c00aff11176ed0c9f4 Mon Sep 17 00:00:00 2001 From: wisonic Date: Mon, 4 Nov 2024 16:26:57 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E6=98=8E=E7=BB=86=E4=B8=8D=E5=90=88=E5=B9=B6=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/visualization/UserViewEnlarge.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/components/visualization/UserViewEnlarge.vue b/core/core-frontend/src/components/visualization/UserViewEnlarge.vue index 510fe79183..e25f2884f0 100644 --- a/core/core-frontend/src/components/visualization/UserViewEnlarge.vue +++ b/core/core-frontend/src/components/visualization/UserViewEnlarge.vue @@ -183,7 +183,8 @@ const DETAIL_CHART_ATTR: DeepPartial = { tableCell: { tableItemBgColor: '#FFFFFF', tableFontColor: '#7C7E81', - enableTableCrossBG: false + enableTableCrossBG: false, + mergeCells: false }, tooltip: { show: false From af3c22280baa2a6e8de38dd3e7929111af2ee190 Mon Sep 17 00:00:00 2001 From: wisonic Date: Mon, 4 Nov 2024 16:28:07 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E5=AD=98?= =?UTF-8?q?=E9=87=8F=E6=98=8E=E7=BB=86=E8=A1=A8=E4=B8=8D=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/views/components/ChartComponentS2.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue b/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue index bc01240514..f063ff8c4d 100644 --- a/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue +++ b/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue @@ -29,6 +29,7 @@ import { deepCopy } from '@/utils/utils' import { useEmitt } from '@/hooks/web/useEmitt' import { trackBarStyleCheck } from '@/utils/canvasUtils' import { type SpreadSheet } from '@antv/s2' +import { parseJson } from '../../js/util' const dvMainStore = dvMainStoreWithOut() const { @@ -165,10 +166,19 @@ const renderChartFromDialog = (viewInfo: Chart, chartDataInfo) => { chartData.value = chartDataInfo renderChart(viewInfo, false) } +// 处理存量图表的默认值 +const handleDefaultVal = (chart: Chart) => { + const customAttr = parseJson(chart.customAttr) + // 明细表默认合并单元格,存量的不合并 + if (customAttr.tableCell.mergeCells === undefined) { + customAttr.tableCell.mergeCells = false + } +} const renderChart = (viewInfo: Chart, resetPageInfo: boolean) => { if (!viewInfo) { return } + handleDefaultVal(viewInfo) // view 为引用对象 需要存库 view.data 直接赋值会导致保存不必要的数据 actualChart = deepCopy({ ...defaultsDeep(viewInfo, cloneDeep(BASE_VIEW_CONFIG)), From d298b6ec289b8d89adc0f58ff75132a0cc7b8725 Mon Sep 17 00:00:00 2001 From: wisonic Date: Mon, 4 Nov 2024 16:29:01 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E5=A4=9A?= =?UTF-8?q?=E9=80=89=E5=A4=8D=E5=88=B6=E5=BF=BD=E7=95=A5=20null=20?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/components/js/panel/common/common_table.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9d7beb60d6..66e32524da 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 @@ -1035,7 +1035,7 @@ export function copyContent(s2Instance: SpreadSheet, event, fieldMeta) { if (metaObj) { fieldVal = metaObj.formatter(value) } - if (fieldVal === undefined) { + if (fieldVal === undefined || fieldVal === null) { fieldVal = '' } if (index !== arr.length - 1) { From 75db3e3245cadf59eb42085e123d9f0aa1865cda Mon Sep 17 00:00:00 2001 From: wisonic Date: Mon, 4 Nov 2024 16:30:27 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E8=A1=A8=E5=90=88=E5=B9=B6=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=92=8C=E6=99=AE=E9=80=9A=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/charts/table/table-info.ts | 63 ++++++++++++++++++- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts index 16fe08d371..682f46f46b 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts @@ -3,17 +3,18 @@ import { S2DataConfig, S2Event, S2Options, + S2Theme, TableColCell, TableDataCell, TableSheet, ViewMeta } from '@antv/s2' import { formatterItem, valueFormatter } from '../../../formatter' -import { parseJson } from '../../../util' +import { hexColorToRGBA, isAlphaColor, parseJson } from '../../../util' import { S2ChartView, S2DrawOptions } from '../../types/impl/s2' import { TABLE_EDITOR_PROPERTY, TABLE_EDITOR_PROPERTY_INNER } from './common' import { useI18n } from '@/hooks/web/useI18n' -import { isNumber } from 'lodash-es' +import { isNumber, merge } from 'lodash-es' import { copyContent, getRowIndex, @@ -330,6 +331,64 @@ export class TableInfo extends S2ChartView { return newChart } + protected configTheme(chart: Chart): S2Theme { + const theme = super.configTheme(chart) + const { basicStyle, tableCell } = parseJson(chart.customAttr) + if (tableCell.mergeCells) { + const tableFontColor = hexColorToRGBA(tableCell.tableFontColor, basicStyle.alpha) + let tableItemBgColor = tableCell.tableItemBgColor + if (!isAlphaColor(tableItemBgColor)) { + tableItemBgColor = hexColorToRGBA(tableItemBgColor, basicStyle.alpha) + } + const { tableBorderColor } = basicStyle + const { tableItemAlign, tableItemFontSize } = tableCell + const fontStyle = tableCell.isItalic ? 'italic' : 'normal' + const fontWeight = tableCell.isBolder === false ? 'normal' : 'bold' + const mergeCellTheme: S2Theme = { + mergedCell: { + cell: { + backgroundColor: tableItemBgColor, + crossBackgroundColor: tableItemBgColor, + horizontalBorderColor: tableBorderColor, + verticalBorderColor: tableBorderColor, + horizontalBorderWidth: tableCell.showHorizonBorder ? 1 : 0, + verticalBorderWidth: tableCell.showVerticalBorder ? 1 : 0 + }, + bolderText: { + fill: tableFontColor, + textAlign: tableItemAlign, + fontSize: tableItemFontSize, + fontStyle, + fontWeight + }, + text: { + fill: tableFontColor, + textAlign: tableItemAlign, + fontSize: tableItemFontSize, + fontStyle, + fontWeight + }, + measureText: { + fill: tableFontColor, + textAlign: tableItemAlign, + fontSize: tableItemFontSize, + fontStyle, + fontWeight + }, + seriesText: { + fill: tableFontColor, + textAlign: tableItemAlign, + fontSize: tableItemFontSize, + fontStyle, + fontWeight + } + } + } + merge(theme, mergeCellTheme) + } + return theme + } + constructor() { super('table-info', []) }