From 2ab65724a2eac6fce8bc95316949ec723decab05 Mon Sep 17 00:00:00 2001 From: wuduoyi Date: Fri, 10 May 2024 17:53:05 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=85=BC=E5=AE=B9=20exceljs=20?= =?UTF-8?q?=E5=9C=A8=E9=83=A8=E5=88=86=E6=89=93=E5=8C=85=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=8B=E5=BC=95=E5=85=A5=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20Closes=20#9598?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis/src/renderers/Form/InputExcel.tsx | 3 ++- packages/amis/src/renderers/Table/index.tsx | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/amis/src/renderers/Form/InputExcel.tsx b/packages/amis/src/renderers/Form/InputExcel.tsx index ac481f788..e119bb2b2 100644 --- a/packages/amis/src/renderers/Form/InputExcel.tsx +++ b/packages/amis/src/renderers/Form/InputExcel.tsx @@ -160,7 +160,8 @@ export default class ExcelControl extends React.PureComponent< processExcelFile(excelData: ArrayBuffer | string, fileName: string) { const {allSheets, onChange, parseImage, autoFill} = this.props; - import('exceljs').then(async (ExcelJS: any) => { + import('exceljs').then(async (E: any) => { + const ExcelJS = E.default || E; this.ExcelJS = ExcelJS; const workbook = new ExcelJS.Workbook(); await workbook.xlsx.load(excelData); diff --git a/packages/amis/src/renderers/Table/index.tsx b/packages/amis/src/renderers/Table/index.tsx index ec649c12f..8a749e363 100644 --- a/packages/amis/src/renderers/Table/index.tsx +++ b/packages/amis/src/renderers/Table/index.tsx @@ -2446,7 +2446,8 @@ export default class Table extends React.Component { loading: store.exportExcelLoading, onAction: () => { store.update({exportExcelLoading: true}); - import('exceljs').then(async (ExcelJS: any) => { + import('exceljs').then(async (E: any) => { + const ExcelJS = E.default || E; try { await exportExcel(ExcelJS, this.props, toolbar); } catch (error) { @@ -2480,7 +2481,8 @@ export default class Table extends React.Component { }, { onAction: () => { - import('exceljs').then(async (ExcelJS: any) => { + import('exceljs').then(async (E: any) => { + const ExcelJS = E.default || E; try { await exportExcel(ExcelJS, this.props, toolbar, true); } catch (error) {