From 3d7a45926b627d0f2b7a5ea9c28fe87c3be49416 Mon Sep 17 00:00:00 2001 From: wisonic Date: Wed, 4 Sep 2024 18:18:37 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E5=BA=8F=E5=8F=B7=E5=88=97=E6=A0=87=E7=AD=BE=E6=BA=A2?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/charts/table/table-info.ts | 19 +++++++--------- .../js/panel/charts/table/table-normal.ts | 22 +++++++------------ .../components/js/panel/types/impl/s2.ts | 4 ---- 3 files changed, 16 insertions(+), 29 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 4d30fdca5b..a458af895c 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 @@ -147,18 +147,15 @@ export class TableInfo extends S2ChartView { } // 开启序号之后,第一列就是序号列,修改 label 即可 if (s2Options.showSeriesNumber) { - s2Options.colCell = (node, sheet, config) => { - if (node.colIndex === 0) { - let indexLabel = customAttr.tableHeader.indexLabel - if (!indexLabel) { - indexLabel = '' - } - const cell = new TableColCell(node, sheet, config) - const shape = cell.getTextShape() as any - shape.attrs.text = indexLabel - return cell + let indexLabel = customAttr.tableHeader.indexLabel + if (!indexLabel) { + indexLabel = '' + } + s2Options.layoutCoordinate = (_, __, col) => { + if (col.colIndex === 0 && col.rowIndex === 0) { + col.label = indexLabel + col.value = indexLabel } - return new TableColCell(node, sheet, config) } } s2Options.dataCell = viewMeta => { 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 2509fcee7e..2ad3fde3ae 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 @@ -135,21 +135,15 @@ export class TableNormal extends S2ChartView { } // 开启序号之后,第一列就是序号列,修改 label 即可 if (s2Options.showSeriesNumber) { - s2Options.colCell = (node, sheet, config) => { - if (node.colIndex === 0) { - let indexLabel = customAttr.tableHeader.indexLabel - if (!indexLabel) { - indexLabel = '' - } - const cell = new TableColCell(node, sheet, config) - const shape = cell.getTextShape() as any - shape.attrs.text = indexLabel - return cell - } - return new TableColCell(node, sheet, config) + let indexLabel = customAttr.tableHeader.indexLabel + if (!indexLabel) { + indexLabel = '' } - s2Options.dataCell = viewMeta => { - return new TableDataCell(viewMeta, viewMeta?.spreadsheet) + s2Options.layoutCoordinate = (_, __, col) => { + if (col.colIndex === 0 && col.rowIndex === 0) { + col.label = indexLabel + col.value = indexLabel + } } } // tooltip diff --git a/core/core-frontend/src/views/chart/components/js/panel/types/impl/s2.ts b/core/core-frontend/src/views/chart/components/js/panel/types/impl/s2.ts index 00fc52bc77..dc0fa85078 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/types/impl/s2.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/types/impl/s2.ts @@ -83,10 +83,6 @@ export abstract class S2ChartView

extends AntVAbstractCha break case 'rowCell': case 'colCell': - if (meta.field === SERIES_NUMBER_FIELD) { - content = cell.getTextShape()['attrs'].text - break - } content = meta.label field = find(metaConfig, item => item.field === content) if (field) { From 4f91079da0a234fb4604178924b84127e6790e42 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 4 Sep 2024 18:50:05 +0800 Subject: [PATCH 2/6] =?UTF-8?q?style:=20=E6=A0=B7=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/utils/canvasUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/core-frontend/src/utils/canvasUtils.ts b/core/core-frontend/src/utils/canvasUtils.ts index af611bd957..05fafccf06 100644 --- a/core/core-frontend/src/utils/canvasUtils.ts +++ b/core/core-frontend/src/utils/canvasUtils.ts @@ -250,7 +250,7 @@ export function refreshOtherComponent(dvId, busiFlag) { for (let i = 0; i < componentData.value.length; i++) { const component = componentData.value[i] if (refreshIdList.includes(component.id) && canvasDataResultMap[component.id]) { - const { top, left, height, width } = componentData.value[i] + const { top, left, height, width } = componentData.value[i].style canvasDataResultMap[component.id].style.top = top canvasDataResultMap[component.id].style.left = left canvasDataResultMap[component.id].style.height = height From 600d18ac31919cc63ada01d167deb7126eacdc46 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Wed, 4 Sep 2024 18:52:57 +0800 Subject: [PATCH 3/6] =?UTF-8?q?style(=E5=9B=BE=E8=A1=A8-=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?):=20=E8=B0=83=E6=95=B4=E6=B8=90=E5=8F=98=E8=89=B2=E6=B8=85?= =?UTF-8?q?=E6=96=B0=E3=80=81=E7=81=AB=E7=BA=A2=E3=80=81=E7=81=B5=E5=8A=A8?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E6=B8=90=E5=8F=98=E6=96=B9=E5=90=91=E4=B8=BA?= =?UTF-8?q?=E6=B5=85=E8=87=B3=E6=B7=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/views/chart/components/js/util.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/views/chart/components/js/util.ts b/core/core-frontend/src/views/chart/components/js/util.ts index bd58bd3048..8573bb2ae4 100644 --- a/core/core-frontend/src/views/chart/components/js/util.ts +++ b/core/core-frontend/src/views/chart/components/js/util.ts @@ -705,7 +705,10 @@ export const stepsColor = (start, end, steps, gamma) => { export const getMapColorCases = colorCases => { const cloneColorCases = JSON.parse(JSON.stringify(colorCases)) return cloneColorCases.map(colorItem => { - const curColors = colorItem.colors + let curColors = colorItem.colors + if (['fresh', 'red', 'spiritual'].includes(colorItem.value)) { + curColors = colorItem.colors.reverse() + } const len = curColors.length const start = curColors[0] const end = curColors[len - 1] From 88d830f4583421a42e2da7a6010e4771657d7d42 Mon Sep 17 00:00:00 2001 From: wisonic Date: Wed, 4 Sep 2024 19:25:54 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E6=9D=A1=E4=BB=B6=E6=A0=B7=E5=BC=8F=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E9=80=8F=E6=98=8E=E5=BA=A6=E4=B8=BA=200=20=E6=97=B6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E8=A1=A8=E6=A0=BC=E5=BA=95=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/common/common_table.ts | 14 +++++++++-- .../src/views/chart/components/js/util.ts | 24 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 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 0466a698ac..a5478e3e75 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 @@ -1,4 +1,11 @@ -import { copyString, hexColorToRGBA, isAlphaColor, parseJson, resetRgbOpacity } from '../..//util' +import { + copyString, + hexColorToRGBA, + isAlphaColor, + isTransparent, + parseJson, + resetRgbOpacity +} from '../..//util' import { DEFAULT_BASIC_STYLE, DEFAULT_TABLE_CELL, @@ -547,7 +554,10 @@ export function getConditions(chart: Chart) { return null } const fill = mappingColor(value, defaultBgColor, field, 'backgroundColor') - return fill ? { fill } : null + if (isTransparent(fill)) { + return null + } + return { fill } } }) } diff --git a/core/core-frontend/src/views/chart/components/js/util.ts b/core/core-frontend/src/views/chart/components/js/util.ts index 8573bb2ae4..e189e030d8 100644 --- a/core/core-frontend/src/views/chart/components/js/util.ts +++ b/core/core-frontend/src/views/chart/components/js/util.ts @@ -990,6 +990,30 @@ export function isAlphaColor(color: string): boolean { return false } +export function isTransparent(color: string): boolean { + if (!color?.trim()) { + return true + } + if (color.startsWith('#')) { + const tmp = color.substring(1, color.length) + if (tmp.length === 3 || tmp.length === 6) { + return false + } + if (tmp.length === 8) { + return tmp.substring(6, 8) === '00' + } + } + if (color.startsWith('rgb')) { + const tmp = color.split(',') + if (tmp.length !== 4) { + return false + } + const alpha = tmp[3].substring(0, tmp[3].length - 1) + return alpha.trim() === '0' + } + return false +} + export function convertToAlphaColor(color: string, alpha: number): string { if (!color?.trim()) { return 'rgba(255,255,255,1)' From 1133f0863b6e20a7ca8823bcd4d8736be4bc54dc Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Wed, 4 Sep 2024 19:31:42 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8-=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E7=9B=98):=20=E4=BF=AE=E5=A4=8D=E7=99=BE=E5=88=86=E6=AF=94?= =?UTF-8?q?=E5=88=BB=E5=BA=A6=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/components/js/panel/charts/others/gauge.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/gauge.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/gauge.ts index 6f7062d1f1..36cd77b799 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/gauge.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/gauge.ts @@ -266,8 +266,7 @@ export class Gauge extends G2PlotChartView { return '' } if (gaugePercentLabel === false) { - const val = v === '0' ? min : v === '1' ? max : min + (max - min) * v - return valueFormatter(val, labelFormatter) + return v === '0' ? min : v === '1' ? max : min + (max - min) * v } return v === '0' ? v : v * 100 + '%' } From 5fedf71b58e214bb8f27065ec7e413a942c48fdb Mon Sep 17 00:00:00 2001 From: wisonic Date: Wed, 4 Sep 2024 20:32:40 +0800 Subject: [PATCH 6/6] =?UTF-8?q?refactor(=E5=9B=BE=E8=A1=A8):=20=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E8=A1=A8=E5=A4=B4=E6=8E=92=E5=BA=8F=E6=A1=86=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/components/views/components/ChartComponentS2.vue | 4 ++++ 1 file changed, 4 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 ae2406ad67..56ee26e0ca 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 @@ -739,4 +739,8 @@ const tablePageClass = computed(() => { flex-direction: row; justify-content: center; } +.antv-s2-tooltip-container { + max-width: 80px; + min-width: 80px; +}