mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
papaparse 改成异步加载
This commit is contained in:
parent
08b74f7ca8
commit
97efc6bc20
@ -16,6 +16,7 @@ const mapping: {
|
||||
'mobx': __moduleId('mobx'),
|
||||
'mobx-state-tree': __moduleId('mobx-state-tree'),
|
||||
'react-transition-group': __moduleId('react-transition-group'),
|
||||
'papaparse': __moduleId('papaparse'),
|
||||
'echarts': __moduleId('echarts'),
|
||||
'zrender': __moduleId('zrender'),
|
||||
'sortablejs': __moduleId('sortablejs'),
|
||||
|
14
fis-conf.js
14
fis-conf.js
@ -386,6 +386,7 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
'!jquery/**',
|
||||
'!zrender/**',
|
||||
'!echarts/**',
|
||||
'!papaparse/**',
|
||||
'!docsearch.js/**',
|
||||
'!monaco-editor/**.css'
|
||||
],
|
||||
@ -398,6 +399,8 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
|
||||
'tinymce.js': ['src/components/Tinymce.tsx', 'tinymce/**'],
|
||||
|
||||
'papaparse.js': ['papaparse/**'],
|
||||
|
||||
'charts.js': ['zrender/**', 'echarts/**'],
|
||||
|
||||
'rest.js': [
|
||||
@ -409,7 +412,8 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
'!src/components/RichText.tsx',
|
||||
'!jquery/**',
|
||||
'!zrender/**',
|
||||
'!echarts/**'
|
||||
'!echarts/**',
|
||||
'!papaparse/**'
|
||||
]
|
||||
}),
|
||||
postpackager: [
|
||||
@ -569,7 +573,8 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
'!tinymce/**',
|
||||
'!jquery/**',
|
||||
'!zrender/**',
|
||||
'!echarts/**'
|
||||
'!echarts/**',
|
||||
'!papaparse/**'
|
||||
],
|
||||
'pkg/rich-text.js': [
|
||||
'src/components/RichText.js',
|
||||
@ -578,6 +583,7 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
],
|
||||
'pkg/tinymce.js': ['src/components/Tinymce.tsx', 'tinymce/**'],
|
||||
'pkg/charts.js': ['zrender/**', 'echarts/**'],
|
||||
'pkg/papaparse.js': ['papaparse/**'],
|
||||
'pkg/api-mock.js': ['mock/*.ts'],
|
||||
'pkg/app.js': [
|
||||
'/examples/components/App.tsx',
|
||||
@ -588,14 +594,14 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
'**.{js,jsx,ts,tsx}',
|
||||
'!static/mod.js',
|
||||
'!monaco-editor/**',
|
||||
'!echarts/**',
|
||||
'!flv.js/**',
|
||||
'!hls.js/**',
|
||||
'!froala-editor/**',
|
||||
'!jquery/**',
|
||||
'!src/components/RichText.js',
|
||||
'!zrender/**',
|
||||
'!echarts/**'
|
||||
'!echarts/**',
|
||||
'!papaparse/**'
|
||||
],
|
||||
|
||||
'pkg/npm.css': ['node_modules/*/**.css', '!monaco-editor/**'],
|
||||
|
@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
import papaparse from 'papaparse';
|
||||
import {saveAs} from 'file-saver';
|
||||
import PropTypes from 'prop-types';
|
||||
import {Renderer, RendererProps} from '../factory';
|
||||
@ -66,7 +65,8 @@ export interface CRUDBultinToolbar extends Omit<BaseSchema, 'type'> {
|
||||
| 'statistics'
|
||||
| 'switch-per-page'
|
||||
| 'load-more'
|
||||
| 'filter-toggler';
|
||||
| 'filter-toggler'
|
||||
| 'export-csv';
|
||||
}
|
||||
|
||||
export type CRUDToolbarChild = SchemaObject | CRUDBultinToolbar;
|
||||
@ -1684,13 +1684,15 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
<Button
|
||||
classPrefix={ns}
|
||||
onClick={() => {
|
||||
const csvText = papaparse.unparse(store.data.items);
|
||||
if (csvText) {
|
||||
const blob = new Blob([csvText], {
|
||||
type: 'text/plain;charset=utf-8'
|
||||
});
|
||||
saveAs(blob, 'data.csv');
|
||||
}
|
||||
(require as any)(['papaparse'], (papaparse: any) => {
|
||||
const csvText = papaparse.unparse(store.data.items);
|
||||
if (csvText) {
|
||||
const blob = new Blob([csvText], {
|
||||
type: 'text/plain;charset=utf-8'
|
||||
});
|
||||
saveAs(blob, 'data.csv');
|
||||
}
|
||||
});
|
||||
}}
|
||||
size="sm"
|
||||
>
|
||||
|
Loading…
Reference in New Issue
Block a user