-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a248e6c
commit d4c40b4
Showing
5 changed files
with
62 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 10 additions & 6 deletions
16
packages/grid/_modules_/grid/models/api/gridCsvExportApi.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
import { GridExportCsvOptions } from '../gridExport'; | ||
|
||
/** | ||
* The csv export API interface that is available in the grid [[apiRef]]. | ||
* The CSV export API interface that is available in the grid [[apiRef]]. | ||
*/ | ||
export interface GridCsvExportApi { | ||
/** | ||
* Returns the grid data formatted as CSV. | ||
* @returns {string} The data as CSV. | ||
* Returns the grid data as a CSV string. | ||
* This method is used internally by `exportDataAsCsv`. | ||
* @params GridExportCsvOptions The options to apply on the export. | ||
* @returns string | ||
*/ | ||
getDataAsCsv: () => string; | ||
getDataAsCsv: (options?: GridExportCsvOptions) => string; | ||
/** | ||
* Exports the grid data as CSV and sends it to the user. | ||
* Downloads and exports a CSV of the grid's data. | ||
* @params GridExportCsvOptions The options to apply on the export. | ||
* @returns void | ||
*/ | ||
exportDataAsCsv: (options?: GridExportCsvOptions, fileName?: string) => void; | ||
exportDataAsCsv: (options?: GridExportCsvOptions) => void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,12 @@ | ||
export interface GridExportCsvOptions { | ||
utf8WithBom?: boolean; | ||
} | ||
export interface GridExportFormatCsv { | ||
format: 'csv'; | ||
options?: GridExportCsvOptions; | ||
} | ||
|
||
/** | ||
* Available export formats. To be extended in future. | ||
* The options to apply on the CSV export. | ||
*/ | ||
export type GridExportFormatExtension = 'csv'; | ||
export type GridExportFormat = GridExportFormatCsv; | ||
export interface GridExportConfiguration { | ||
export interface GridExportCsvOptions { | ||
fileName?: string; | ||
csv?: GridExportCsvOptions; | ||
utf8WithBom?: boolean; | ||
} | ||
|
||
/** | ||
* Export option interface | ||
* Available export formats. | ||
*/ | ||
export type GridExportOption = GridExportFormat & { | ||
label: React.ReactNode; | ||
}; | ||
export type GridExportFormat = 'csv'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters