Skip to content

Commit

Permalink
Merge pull request #10209 from nwind/chore-import-default
Browse files Browse the repository at this point in the history
chore: 兼容 exceljs 在部分打包配置下引入错误问题 Closes #9598
  • Loading branch information
hsm-lv committed May 13, 2024
2 parents 4ac106e + 2ab6572 commit e6385a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/amis/src/renderers/Form/InputExcel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions packages/amis/src/renderers/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2446,7 +2446,8 @@ export default class Table extends React.Component<TableProps, object> {
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) {
Expand Down Expand Up @@ -2480,7 +2481,8 @@ export default class Table extends React.Component<TableProps, object> {
},
{
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) {
Expand Down

0 comments on commit e6385a8

Please sign in to comment.