mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 08:17:05 +00:00
add csv tests
This commit is contained in:
+4
-1
@@ -139,7 +139,10 @@ export interface ColumnDescription<T extends object = any, E = any> {
|
||||
/**
|
||||
* CSV Column options only used with the toolkit provider
|
||||
*/
|
||||
csvType?: String | Number;
|
||||
/**
|
||||
* export csv cell type can be Number or String
|
||||
*/
|
||||
csvType?: object;
|
||||
csvFormatter?: ColumnFormatter<T, E>;
|
||||
/**
|
||||
* csvText defaults to column.text
|
||||
|
||||
@@ -107,6 +107,40 @@ render(
|
||||
* Toolkit CSV export test
|
||||
*/
|
||||
|
||||
const csvColumns: Array<ColumnDescription<Product>> = [
|
||||
{ dataField: 'id', align: 'center', sort: true, text: 'Product ID' },
|
||||
{ dataField: 'name', align: 'center', sort: true, text: 'Product Name' },
|
||||
{
|
||||
isDummyField: true,
|
||||
dataField: '',
|
||||
sort: true,
|
||||
text: 'Product Name',
|
||||
},
|
||||
{
|
||||
dataField: 'price',
|
||||
sort: true,
|
||||
formatter: priceFormatter,
|
||||
text: 'Product Price',
|
||||
headerFormatter: priceHeaderFormatter,
|
||||
csvExport: false,
|
||||
},
|
||||
/**
|
||||
* test optional dataField for dummyFields
|
||||
*/
|
||||
{
|
||||
isDummyField: true,
|
||||
dataField: '',
|
||||
sort: true,
|
||||
formatter: priceFormatter,
|
||||
text: 'Product Price',
|
||||
headerFormatter: priceHeaderFormatter,
|
||||
csvType: Number,
|
||||
csvFormatter: value => value,
|
||||
csvText: 'Price',
|
||||
csvExport: true,
|
||||
},
|
||||
];
|
||||
|
||||
render(
|
||||
<ToolkitProvider
|
||||
data={products}
|
||||
|
||||
Reference in New Issue
Block a user