@ackplus/react-tanstack-data-table
Version:
A powerful React data table component built with MUI and TanStack Table
140 lines • 3.55 kB
TypeScript
/**
* Export Configuration Types
* Consolidated export-related interfaces from export-utils.ts
*/
import { TableState } from './table.types';
/**
* Server export column configuration
*/
export interface ServerExportColumn<T = any> {
id: string;
header: string;
accessor: keyof T | string;
formatter?: (value: any, row: T) => string;
}
/**
* Export options configuration
*/
export interface ExportOptions {
filename?: string;
format: 'csv' | 'excel';
includeHeaders?: boolean;
onlyVisibleColumns?: boolean;
onlyFilteredData?: boolean;
chunkSize?: number;
onProgress?: (progress: ExportProgress) => void;
onComplete?: (result: ExportResult) => void;
onError?: (error: ExportError) => void;
signal?: AbortSignal;
}
/**
* Export progress information
*/
export interface ExportProgress {
processedRows: number;
totalRows: number;
percentage: number;
currentChunk: number;
totalChunks: number;
estimatedTimeRemaining?: number;
}
/**
* Export result information
*/
export interface ExportResult {
success: boolean;
filename: string;
totalRows: number;
totalColumns: number;
processingTime: number;
fileSize?: number;
}
/**
* Export error information
*/
export interface ExportError {
message: string;
code: 'CANCELLED' | 'MEMORY_ERROR' | 'PROCESSING_ERROR' | 'UNKNOWN';
details?: any;
}
/**
* Export configuration for DataTable
*/
export interface ExportConfig {
enabled: boolean;
formats: ('csv' | 'excel')[];
filename?: string;
includeHeaders?: boolean;
onlyVisibleColumns?: boolean;
onlyFilteredData?: boolean;
chunkSize?: number;
enableProgressTracking?: boolean;
maxMemoryThreshold?: number;
}
/**
* Export state for tracking ongoing exports
*/
export interface ExportState {
isExporting: boolean;
progress?: ExportProgress;
controller?: AbortController;
startTime?: number;
}
/**
* Chunked data processing configuration
*/
export interface ChunkProcessingConfig {
chunkSize: number;
delayBetweenChunks: number;
useWebWorker: boolean;
}
/**
* Styling options for pinned columns (actual implementation)
*/
export interface PinnedColumnStyleOptions {
width?: number | string;
minWidth?: number;
maxWidth?: number;
isPinned?: 'left' | 'right' | false;
pinnedPosition?: number;
pinnedRightPosition?: number;
zIndex?: number;
disableStickyHeader?: boolean;
isLastLeftPinnedColumn?: boolean;
isFirstRightPinnedColumn?: boolean;
wrapText?: boolean;
}
/**
* Simplified Export Types for DataTable
*/
export interface SimpleExportOptions {
filename?: string;
format: 'csv' | 'excel';
includeHeaders?: boolean;
onlyVisibleColumns?: boolean;
onlySelectedRows?: boolean;
}
/**
* Selection data for server exports
*/
export interface SelectionExportData {
selectAllMatching?: boolean;
excludedIds?: string[];
selectedIds?: string[];
hasSelection?: boolean;
}
export interface ServerExportOptions extends SimpleExportOptions {
fetchData: (filters?: Partial<TableState>, selection?: SelectionExportData) => Promise<{
data: any[];
total: number;
}>;
currentFilters?: any;
pageSize?: number;
selection?: SelectionExportData;
}
export interface ExportCallbacks {
onProgress?: (progress: ExportProgress) => void;
onComplete?: (result: ExportResult) => void;
onError?: (error: ExportError) => void;
}
//# sourceMappingURL=export.types.d.ts.map