UNPKG

@adaptabletools/adaptable

Version:

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

154 lines (153 loc) 4.08 kB
import { BaseState } from './BaseState'; import { BaseSchedule } from './Common/Schedule'; import { ColumnScope } from './Common/ColumnScope'; import { AdaptableColumnBase } from './Common/AdaptableColumn'; import { AdaptableObject } from './Common/AdaptableObject'; import { AdaptableBooleanQuery } from './Common/AdaptableQuery'; import { TypeHint } from './Common/Types'; import { ExportDestinationType } from '../AdaptableOptions/ExportOptions'; /** * Adaptable State Section for Export Module */ export interface ExportState extends BaseState { /** * Selected Report Type - in Export Toolbar & Tool Panel */ CurrentReport?: ReportNameType; /** * Selected Report Format - in Export Toolbar & Tool Panel */ CurrentFormat?: ReportFormatType; /** * User-created Reports; each has Name and Row and Column Scope */ Reports?: Report[]; } /** * A Report which can export data from AdapTable */ export interface Report extends AdaptableObject { /** * Name of Report */ Name: ReportNameType; /** * Columns to display: 'AllColumns', 'VisibleColumns', 'SelectedColumns', 'ScopeColumns' */ ReportColumnScope: ReportColumnScope; /** * Rows to export: 'AllRows', 'VisibleRows', 'SelectedRows', 'ExpressionRows' */ ReportRowScope: ReportRowScope; /** * Columns Scope; only required if `ReportColumnScope` is 'ScopeColumns' */ Scope?: ColumnScope; /** * Query to use; only required if `ReportRowScope` is 'ExpressionRows' */ Query?: AdaptableBooleanQuery; } /** * Defines a Scheduled Report - used in Schedule Module (where State is stored) */ export interface ReportSchedule extends BaseSchedule { /** * Name of Report to run on Schedule */ ReportName: string; /** * Format of Report to run on Schedule */ ReportFormat: ReportFormatType; /** * Destination of Report to run on Schedule */ ExportDestination?: ExportDestinationType; } /** * A Column exported in a Report */ export interface ReportColumn extends AdaptableColumnBase { /** * Field in the row to get cell data from; defaults to `columnId` */ field?: string; } /** * Defines the data in a Report run by AdapTable */ export interface ReportData { /** * Row Data in the Report */ rows: Record<string, any>[]; /** * Columns in the Report */ columns: ReportColumn[]; /** * Group columns IDs in the Report */ groupColumnIds?: string[]; /** * Pivot columns IDs in the Report */ pivotColumnIds?: string[]; } /** * System report names provided by AdapTable */ export type SystemReportName = /** * Report includes all data, exporting all rows and columns, regardless of filtering/sorting etc. */ 'All Data' /** * Report includes current Layout, exporting only currently visible columns and rows with the current sorting/filtering applied. */ | 'Current Layout' /** * Report includes only selected data */ | 'Selected Data'; /** * System report formats provided by AdapTable */ export type SystemReportFormat = /** * Export report in Excel(XLSX) format */ 'Excel' /** * Export report in standard Excel/XLSX format, including all the AdapTable Styles and Formats (ConditionalStyles, ColumnFormats, etc.) */ | 'VisualExcel' /** * Export report in CSV format */ | 'CSV' /** * Export report in JSON format */ | 'JSON'; /** * Columns to be included in a Report */ export type ReportColumnScope = 'AllColumns' | 'VisibleColumns' | 'ScopeColumns' | 'SelectedColumns'; /** * AG Grid Row Data to be included in a Report */ export type ReportRowScope = 'AllRows' | 'VisibleRows' | 'ExpressionRows' | 'SelectedRows'; /** * Array containing all System Report names */ export type SystemReportNames = SystemReportName[]; /** * Type of Report Name */ export type ReportNameType = TypeHint<string, SystemReportName>; /** * Type of Report Format */ export type ReportFormatType = TypeHint<string, SystemReportFormat>;