From 50c31e80b8e35926f56539a027c3d7b46ab0c468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=AB=E5=90=9B?= Date: Tue, 20 Dec 2022 17:50:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E6=98=8E=E7=BB=86=E8=A1=A8linkField?= =?UTF-8?q?=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/s2-core/src/utils/interaction/link-field.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/s2-core/src/utils/interaction/link-field.ts b/packages/s2-core/src/utils/interaction/link-field.ts index 293b6ba15d..638da267ce 100644 --- a/packages/s2-core/src/utils/interaction/link-field.ts +++ b/packages/s2-core/src/utils/interaction/link-field.ts @@ -7,5 +7,8 @@ export const checkIsLinkField = ( ): boolean => { return typeof linkFields === 'function' ? linkFields(meta) - : linkFields.some((field) => field === meta.key || field === meta.id); + : linkFields.some( + (field) => + field === meta.key || field === meta.id || field === meta.valueField, + ); }; From b0962563c70bd829f6f6e4012ba8309f94ba504d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=AB=E5=90=9B?= Date: Tue, 20 Dec 2022 18:04:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?test:=20=E8=A1=A5=E5=85=85=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__tests__/spreadsheet/table-sheet-spec.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts b/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts index 17fecef129..d3a2d66ddb 100644 --- a/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts @@ -1,11 +1,14 @@ import { getContainer, getMockData, sleep } from 'tests/util/helpers'; +import { get } from 'lodash'; import { TableSheet, type S2Options, type S2DataConfig, ResizeType, ColCell, + TableDataCell, } from '@/index'; +import type { PanelScrollGroup } from '@/group/panel-scroll-group'; const data = getMockData( '../../../s2-react/__tests__/data/tableau-supermarket.csv', @@ -209,4 +212,27 @@ describe('TableSheet normal spec', () => { expect(lastColumnCell.getMeta().width).toBe(199); }); + + test('should render link shape', () => { + const s2 = new TableSheet(getContainer(), dataCfg, { + ...options, + frozenRowCount: 0, + frozenColCount: 0, + frozenTrailingColCount: 0, + frozenTrailingRowCount: 0, + }); + s2.render(); + + const orderIdDataCell = ( + s2.facet.panelGroup.findAllByName( + 'panelScrollGroup', + )[0] as PanelScrollGroup + ) + .getChildren() + .find((item: TableDataCell) => item.getMeta().valueField === 'order_id'); + + expect(get(orderIdDataCell, 'linkFieldShape')).toBeDefined(); + + s2.destroy(); + }); });