From b1044b690172e851cfcd060a6dd657a9ac702909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=98=A4=E5=98=A4=E5=98=A4?= Date: Thu, 22 Apr 2021 11:33:50 +0800 Subject: [PATCH] fix: [export] solve the type error (#49) * fix: :bug: solve the issue of copy failure of detail table without column. this close #32, close #31 * fix: :poop: [export]replace the success message with the error message * fix: :poop: [export] solve the type error --- packages/s2-core/src/utils/export/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/s2-core/src/utils/export/index.ts b/packages/s2-core/src/utils/export/index.ts index f57ef965ec..4403498e2c 100644 --- a/packages/s2-core/src/utils/export/index.ts +++ b/packages/s2-core/src/utils/export/index.ts @@ -1,5 +1,5 @@ import { BaseSpreadSheet } from '../../sheet-type'; -import { head, last, isEmpty, get, clone } from 'lodash'; +import { head, last, isEmpty, get, clone, trim } from 'lodash'; import { ViewMeta } from '../..'; import { ID_SEPARATOR } from '../../common/constant'; import { getCsvString } from './export-worker'; @@ -212,7 +212,7 @@ export const copyData = ( const caredRowLeafNodes = rowLeafNodes.filter((row) => row.height !== 0); for (const rowNode of caredRowLeafNodes) { // Removing the space at the beginning of the line of the label. - rowNode.label = rowNode.label ? rowNode.label.replace(/^\s*/g, '') : ''; + rowNode.label = trim(rowNode?.label); const id = rowNode.id.replace(/^root\[&\]*/, ''); const tempLine = id.split(ID_SEPARATOR); const lastLabel = sheetInstance.dataSet.getFieldName(last(tempLine));