fix export type for ExportCSVButton (#46829)

This commit is contained in:
Haryana 2020-09-19 05:29:39 +07:00 committed by GitHub
parent dacb312e7e
commit 310bcc4a1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 7 deletions

View File

@ -106,7 +106,7 @@ export interface ExportCSVButtonProps {
}
export namespace CSVExport {
function ToggleList(props: ExportCSVButtonProps): React.ReactElement | null;
function ExportCSVButton(props: ExportCSVButtonProps): React.ReactElement | null;
}
export interface SearchBarProps {

View File

@ -7,7 +7,7 @@ import BootstrapTable, {
} from 'react-bootstrap-table-next';
import paginationFactory from 'react-bootstrap-table2-paginator';
import { render } from 'react-dom';
import ToolkitProvider, { InjectedSearchProps, Search } from 'react-bootstrap-table2-toolkit';
import ToolkitProvider, { InjectedSearchProps, Search, CSVExport } from 'react-bootstrap-table2-toolkit';
interface Product {
id: number;
@ -176,15 +176,38 @@ const { SearchBar, ClearSearchButton } = Search;
render(
<ToolkitProvider
keyField="id"
data={ products }
columns={ productColumns }
data={products}
columns={productColumns}
search
>
{({ baseProps, searchProps }) => (
<>
<SearchBar { ...searchProps } />
<ClearSearchButton { ...searchProps } />
<BootstrapTable { ...baseProps } />
<SearchBar {...searchProps} />
<ClearSearchButton {...searchProps} />
<BootstrapTable {...baseProps} />
</>
)}
</ToolkitProvider>,
document.getElementById('app'),
);
/**
* Toolkit CSVExport with ExportCSVButton
*/
const { ExportCSVButton } = CSVExport;
render(
<ToolkitProvider
keyField="id"
data={products}
columns={productColumns}
search
>
{({ baseProps, csvProps }) => (
<>
<ExportCSVButton {...csvProps}>Export</ExportCSVButton>
<BootstrapTable {...baseProps} />
</>
)}
</ToolkitProvider>,