From a1477aeb48ffff952330962d65c7ac5eb40a7c70 Mon Sep 17 00:00:00 2001 From: lijinke666 Date: Wed, 28 Feb 2024 15:25:23 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E4=BF=AE=E5=A4=8D=E5=8D=95=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/s2-core/src/utils/cell/cell.ts | 10 ++++++++-- .../custom-icon/demo/custom-header-action-icon.ts | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/s2-core/src/utils/cell/cell.ts b/packages/s2-core/src/utils/cell/cell.ts index 35a9e66568..bdb8f7af7e 100644 --- a/packages/s2-core/src/utils/cell/cell.ts +++ b/packages/s2-core/src/utils/cell/cell.ts @@ -1,4 +1,5 @@ import type { LineStyleProps } from '@antv/g'; +import { isEmpty } from 'lodash'; import type { SimpleBBox } from '../../engine'; import { CellClipBox, @@ -199,6 +200,11 @@ export const getBorderPositionAndStyle = ( borderDash, } = style; + // 如果是空数组 G 底层绘制会报错 + const lineDash: LineStyleProps['lineDash'] = isEmpty(borderDash) + ? '' + : borderDash; + const borderStyle: Partial = [ CellBorderPosition.TOP, CellBorderPosition.BOTTOM, @@ -207,13 +213,13 @@ export const getBorderPositionAndStyle = ( lineWidth: horizontalBorderWidth, stroke: horizontalBorderColor, strokeOpacity: horizontalBorderColorOpacity, - lineDash: borderDash, + lineDash, } : { lineWidth: verticalBorderWidth, stroke: verticalBorderColor, strokeOpacity: verticalBorderColorOpacity, - lineDash: borderDash, + lineDash, }; let x1 = 0; diff --git a/s2-site/examples/custom/custom-icon/demo/custom-header-action-icon.ts b/s2-site/examples/custom/custom-icon/demo/custom-header-action-icon.ts index a899245a63..3ed10dcfbd 100644 --- a/s2-site/examples/custom/custom-icon/demo/custom-header-action-icon.ts +++ b/s2-site/examples/custom/custom-icon/demo/custom-header-action-icon.ts @@ -79,13 +79,13 @@ fetch( displayCondition: (meta) => meta.rowIndex > 2, onHover: (options) => { const { meta, event } = options; - const div = document.createElement('div'); + const content = document.createElement('div'); - div.innerHTML = '我是 RowTooltip 自定义内容'; + content.innerHTML = '我是 RowTooltip 自定义内容'; meta.spreadsheet.tooltip.show({ position: { x: event.clientX, y: event.clientY }, - content: div, + content, }); }, },