UNPKG

@adaptabletools/adaptable

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

151 lines (150 loc) 5.38 kB
import { AdaptableForm } from '../AdaptableState/Common/AdaptableForm'; import { ExportState, Report, ReportFormatType, ReportNameType, SystemReportFormat, SystemReportName } from '../AdaptableState/ExportState'; import { CustomDestination, ExportDestinationType, ExportFormContext, ExportResultData, SystemExportDestination } from '../AdaptableOptions/ExportOptions'; import { AdaptableColumn } from '../types'; /** * Provides run-time access to the Export Module and Report state */ export interface ExportApi { /** * Retrieves Export section from Adaptable State */ getExportState(): ExportState; /** * Retrieves available System Reports (configured in Export Options) */ getAvailableSystemReports(): SystemReportName[]; /** * Retrieves available System Report Formats (configured in Export Options) */ getAvailableSystemFormats(): SystemReportFormat[]; /** * Retrieves available System Export Destinations (configured in Export Options) */ getAvailableSystemDestinations(): SystemExportDestination[]; /** * Retrieves name of currently selected Report */ getCurrentReportName(): string; /** * Retrieves currently selected Report in Adaptable State * @returns report that is currently selected */ getCurrentReport(): Report; /** * Retrieves Report with the given name * @param reportName report to retrieve * @returns report */ getReportByName(reportName: string): Report | undefined; /** * Retrieves Report by Id * @param id report id * @returns report */ getReportById(id: Report['Uuid']): Report; /** * Retrieves all available Reports - System and User-created Reports * @returns reports */ getAllReports(): Report[]; /** * Retrieves all Custom Reports that have been created by the User */ getCustomReports(): Report[]; /** * Retrieves all Report Formats that are available */ getAllFormats(): ReportFormatType[]; /** * Retrieves all Custom Destinations from Export Options * @returns custom destinations */ getCustomDestinations(): CustomDestination[]; /** * Retrieves Destination with the given name * @param destinationName destination to retrieve * @returns export destination */ getDestinationByName(destinationName: ExportDestinationType): SystemExportDestination | CustomDestination | undefined; /** * Retrieves the available export destinations * @returns export destinations */ getAllExportDestinations(): ExportDestinationType[]; /** * Selects the Report in the Adaptable State * * @param reportName name of Report to select */ selectReport(reportName: ReportNameType | null): void; /** * Sets the Report to null */ clearReport(): void; /** * Selects the Report Format for Export * @param format - format to select */ selectFormat(reportFormat: ReportFormatType | null): void; /** * Sets the Report Format to null */ clearFormat(): void; /** * If this AdapTable instance can to export to Excel; if false, the Export to Excel option will not be visible */ canExportToExcel(): boolean; /** * If this AdapTable instance can to export to CSV; if false, the Export to Csv option will not be visible */ canExportToCsv(): boolean; /** * Open Settings Panel with Export section selected */ openExportSettingsPanel(): void; /** * Updates an existing report * @param report report to edit * @returns report */ updateReport(report: Report): Report; /** * Updates existing reports * @param report reports to edit * @returns reports */ updateReports(reports: Report[]): Report[]; /** * If the given destination is a Custom one * @param destination destination to check */ isExportDestinationCustom(destinationName: ExportDestinationType): boolean; /** * Retrieves the Export Destinations that are supported for the given Report Format * @param reportFormat - report format to check */ getSupportedExportDestinations(reportFormat: ReportFormatType): ExportDestinationType[]; /** * Form Data entered by the User in the UI for a Custom Destination * @param destination Custom Destination for which to get Form Def */ getExportDestinationForm(destinationName: ExportDestinationType): AdaptableForm<ExportFormContext> | undefined; /** * Returns whether the given column is exportable */ isColumnExportable(adaptablColumn: AdaptableColumn): boolean; /** * Exports the Report with the given Name and Format to the given Destination * @param reportName - name of the report * @param format - format of the report * @param destination - destination to export to */ exportReport(reportName: ReportNameType, format: ReportFormatType, destination?: ExportDestinationType): Promise<void>; /** * Gets the data for the Report with the given Name in the given Format * @param reportName - name of the report * @param format - format of the report */ getReportData(reportName: ReportNameType, format: ReportFormatType): Promise<ExportResultData>; }