Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: 兼容 exceljs 在部分打包配置下引入错误问题 Closes #9598 #10209

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading