chore: crud 的 export excel 支持配置 label 和 icon (#3782)

This commit is contained in:
liaoxuezhi 2022-03-17 11:10:39 +08:00 committed by GitHub
parent 24f5908ec3
commit efaab83f65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2262,17 +2262,23 @@ export default class Table extends React.Component<TableProps, object> {
classnames: cx,
translate: __,
columns,
data
data,
render
} = this.props;
if (!columns) {
return null;
}
return (
<Button
classPrefix={ns}
onClick={() => {
return render(
'exportExcel',
{
label: __('CRUD.exportExcel'),
...(toolbar as any),
type: 'button'
},
{
onAction: () => {
import('exceljs').then(async (ExcelJS: any) => {
let rows = [];
let tmpStore;
@ -2505,11 +2511,8 @@ export default class Table extends React.Component<TableProps, object> {
saveAs(blob, filename + '.xlsx');
}
});
}}
size="sm"
>
{(toolbar as Schema).label || __('CRUD.exportExcel')}
</Button>
}
}
);
}