@ackplus/react-tanstack-data-table 1.1.19 → 1.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/hooks/use-data-table-engine.d.ts.map +1 -1
- package/dist/lib/hooks/use-data-table-engine.js +54 -15
- package/dist/lib/types/data-table.types.d.ts +2 -1
- package/dist/lib/types/data-table.types.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/index.ts +0 -75
- package/src/lib/components/data-table-view.tsx +0 -386
- package/src/lib/components/droupdown/menu-dropdown.tsx +0 -103
- package/src/lib/components/filters/filter-value-input.tsx +0 -225
- package/src/lib/components/filters/index.ts +0 -126
- package/src/lib/components/headers/draggable-header.tsx +0 -326
- package/src/lib/components/headers/index.ts +0 -6
- package/src/lib/components/headers/table-header.tsx +0 -175
- package/src/lib/components/index.ts +0 -21
- package/src/lib/components/pagination/data-table-pagination.tsx +0 -111
- package/src/lib/components/pagination/index.ts +0 -5
- package/src/lib/components/rows/data-table-row.tsx +0 -218
- package/src/lib/components/rows/empty-data-row.tsx +0 -69
- package/src/lib/components/rows/index.ts +0 -7
- package/src/lib/components/rows/loading-rows.tsx +0 -164
- package/src/lib/components/toolbar/bulk-actions-toolbar.tsx +0 -125
- package/src/lib/components/toolbar/column-filter-control.tsx +0 -432
- package/src/lib/components/toolbar/column-pinning-control.tsx +0 -275
- package/src/lib/components/toolbar/column-reset-control.tsx +0 -74
- package/src/lib/components/toolbar/column-visibility-control.tsx +0 -105
- package/src/lib/components/toolbar/data-table-toolbar.tsx +0 -257
- package/src/lib/components/toolbar/index.ts +0 -17
- package/src/lib/components/toolbar/table-export-control.tsx +0 -233
- package/src/lib/components/toolbar/table-refresh-control.tsx +0 -62
- package/src/lib/components/toolbar/table-search-control.tsx +0 -155
- package/src/lib/components/toolbar/table-size-control.tsx +0 -102
- package/src/lib/contexts/data-table-context.tsx +0 -126
- package/src/lib/data-table.tsx +0 -29
- package/src/lib/features/README.md +0 -161
- package/src/lib/features/column-filter.feature.ts +0 -493
- package/src/lib/features/index.ts +0 -23
- package/src/lib/features/selection.feature.ts +0 -322
- package/src/lib/hooks/index.ts +0 -2
- package/src/lib/hooks/use-data-table-engine.ts +0 -1516
- package/src/lib/icons/add-icon.tsx +0 -23
- package/src/lib/icons/csv-icon.tsx +0 -15
- package/src/lib/icons/delete-icon.tsx +0 -30
- package/src/lib/icons/excel-icon.tsx +0 -15
- package/src/lib/icons/index.ts +0 -7
- package/src/lib/icons/unpin-icon.tsx +0 -18
- package/src/lib/icons/view-comfortable-icon.tsx +0 -45
- package/src/lib/icons/view-compact-icon.tsx +0 -55
- package/src/lib/types/column.types.ts +0 -63
- package/src/lib/types/data-table-api.ts +0 -191
- package/src/lib/types/data-table.types.ts +0 -192
- package/src/lib/types/export.types.ts +0 -223
- package/src/lib/types/index.ts +0 -24
- package/src/lib/types/slots.types.ts +0 -342
- package/src/lib/types/table.types.ts +0 -88
- package/src/lib/utils/column-helpers.ts +0 -72
- package/src/lib/utils/debounced-fetch.utils.ts +0 -131
- package/src/lib/utils/export-utils.ts +0 -712
- package/src/lib/utils/index.ts +0 -27
- package/src/lib/utils/logger.ts +0 -203
- package/src/lib/utils/slot-helpers.tsx +0 -194
- package/src/lib/utils/special-columns.utils.ts +0 -101
- package/src/lib/utils/styling-helpers.ts +0 -126
- package/src/lib/utils/table-helpers.ts +0 -106
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Export Configuration Types
|
|
3
|
-
* Consolidated export-related interfaces from export-utils.ts
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { TableState } from './table.types';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export type ExportFormat = 'csv' | 'excel';
|
|
10
|
-
export type ExportConcurrencyMode = 'ignoreIfRunning' | 'cancelAndRestart' | 'queue';
|
|
11
|
-
export type ExportPhase =
|
|
12
|
-
| 'starting'
|
|
13
|
-
| 'fetching'
|
|
14
|
-
| 'processing'
|
|
15
|
-
| 'downloading'
|
|
16
|
-
| 'completed'
|
|
17
|
-
| 'cancelled'
|
|
18
|
-
| 'error';
|
|
19
|
-
|
|
20
|
-
export type ExportValueFormat = 'auto' | 'string' | 'number' | 'boolean' | 'json' | 'date';
|
|
21
|
-
|
|
22
|
-
export interface ExportStateChange {
|
|
23
|
-
phase: ExportPhase;
|
|
24
|
-
mode: 'client' | 'server';
|
|
25
|
-
format: ExportFormat;
|
|
26
|
-
filename: string;
|
|
27
|
-
processedRows?: number;
|
|
28
|
-
totalRows?: number;
|
|
29
|
-
percentage?: number;
|
|
30
|
-
message?: string;
|
|
31
|
-
code?: string;
|
|
32
|
-
startedAt?: number;
|
|
33
|
-
endedAt?: number;
|
|
34
|
-
queueLength?: number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface ExportProgressPayload {
|
|
38
|
-
processedRows?: number;
|
|
39
|
-
totalRows?: number;
|
|
40
|
-
percentage?: number;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface ServerExportDataResult<T = any> {
|
|
44
|
-
data: T[];
|
|
45
|
-
total: number;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface ServerExportBlobResult {
|
|
49
|
-
blob: Blob;
|
|
50
|
-
filename?: string;
|
|
51
|
-
mimeType?: string;
|
|
52
|
-
total?: number;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface ServerExportFileUrlResult {
|
|
56
|
-
fileUrl: string;
|
|
57
|
-
filename?: string;
|
|
58
|
-
mimeType?: string;
|
|
59
|
-
total?: number;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export type ServerExportResult<T = any> =
|
|
63
|
-
| ServerExportDataResult<T>
|
|
64
|
-
| ServerExportBlobResult
|
|
65
|
-
| ServerExportFileUrlResult;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Server export column configuration
|
|
69
|
-
*/
|
|
70
|
-
export interface ServerExportColumn<T = any> {
|
|
71
|
-
id: string;
|
|
72
|
-
header: string;
|
|
73
|
-
accessor: keyof T | string;
|
|
74
|
-
formatter?: (value: any, row: T) => string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Export options configuration
|
|
79
|
-
*/
|
|
80
|
-
export interface ExportOptions {
|
|
81
|
-
filename?: string;
|
|
82
|
-
format: ExportFormat;
|
|
83
|
-
includeHeaders?: boolean;
|
|
84
|
-
onlyVisibleColumns?: boolean;
|
|
85
|
-
onlyFilteredData?: boolean;
|
|
86
|
-
// New options for large datasets
|
|
87
|
-
chunkSize?: number;
|
|
88
|
-
onProgress?: (progress: ExportProgress) => void;
|
|
89
|
-
onComplete?: (result: ExportResult) => void;
|
|
90
|
-
onError?: (error: ExportError) => void;
|
|
91
|
-
signal?: AbortSignal; // For cancellation
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Export progress information
|
|
96
|
-
*/
|
|
97
|
-
export interface ExportProgress {
|
|
98
|
-
processedRows?: number;
|
|
99
|
-
totalRows?: number;
|
|
100
|
-
percentage?: number;
|
|
101
|
-
currentChunk?: number;
|
|
102
|
-
totalChunks?: number;
|
|
103
|
-
estimatedTimeRemaining?: number;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Export result information
|
|
108
|
-
*/
|
|
109
|
-
export interface ExportResult {
|
|
110
|
-
success: boolean;
|
|
111
|
-
filename: string;
|
|
112
|
-
totalRows: number;
|
|
113
|
-
totalColumns: number;
|
|
114
|
-
processingTime: number;
|
|
115
|
-
fileSize?: number;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Export error information
|
|
120
|
-
*/
|
|
121
|
-
export interface ExportError {
|
|
122
|
-
message: string;
|
|
123
|
-
code: 'CANCELLED' | 'MEMORY_ERROR' | 'PROCESSING_ERROR' | 'UNKNOWN' | 'EXPORT_IN_PROGRESS';
|
|
124
|
-
details?: any;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Export configuration for DataTable
|
|
129
|
-
*/
|
|
130
|
-
export interface ExportConfig {
|
|
131
|
-
enabled: boolean;
|
|
132
|
-
formats: ExportFormat[];
|
|
133
|
-
filename?: string;
|
|
134
|
-
includeHeaders?: boolean;
|
|
135
|
-
onlyVisibleColumns?: boolean;
|
|
136
|
-
onlyFilteredData?: boolean;
|
|
137
|
-
// New configuration for large datasets
|
|
138
|
-
chunkSize?: number;
|
|
139
|
-
strictTotalCheck?: boolean;
|
|
140
|
-
sanitizeCSV?: boolean;
|
|
141
|
-
concurrency?: ExportConcurrencyMode;
|
|
142
|
-
enableProgressTracking?: boolean;
|
|
143
|
-
maxMemoryThreshold?: number; // MB
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Export state for tracking ongoing exports
|
|
148
|
-
*/
|
|
149
|
-
export interface ExportState {
|
|
150
|
-
isExporting: boolean;
|
|
151
|
-
progress?: ExportProgress;
|
|
152
|
-
controller?: AbortController;
|
|
153
|
-
startTime?: number;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Chunked data processing configuration
|
|
158
|
-
*/
|
|
159
|
-
export interface ChunkProcessingConfig {
|
|
160
|
-
chunkSize: number;
|
|
161
|
-
delayBetweenChunks: number; // ms
|
|
162
|
-
useWebWorker: boolean;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Styling options for pinned columns (actual implementation)
|
|
167
|
-
*/
|
|
168
|
-
export interface PinnedColumnStyleOptions {
|
|
169
|
-
width?: number | string;
|
|
170
|
-
minWidth?: number;
|
|
171
|
-
maxWidth?: number;
|
|
172
|
-
isPinned?: 'left' | 'right' | false;
|
|
173
|
-
pinnedPosition?: number;
|
|
174
|
-
pinnedRightPosition?: number;
|
|
175
|
-
zIndex?: number;
|
|
176
|
-
disableStickyHeader?: boolean;
|
|
177
|
-
isLastLeftPinnedColumn?: boolean;
|
|
178
|
-
isFirstRightPinnedColumn?: boolean;
|
|
179
|
-
wrapText?: boolean; // If true, text will wrap; if false, text will truncate with ellipsis (default: false)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Simplified Export Types for DataTable
|
|
184
|
-
*/
|
|
185
|
-
|
|
186
|
-
export interface SimpleExportOptions {
|
|
187
|
-
filename?: string;
|
|
188
|
-
format: ExportFormat;
|
|
189
|
-
includeHeaders?: boolean;
|
|
190
|
-
onlyVisibleColumns?: boolean;
|
|
191
|
-
onlySelectedRows?: boolean;
|
|
192
|
-
chunkSize?: number;
|
|
193
|
-
strictTotalCheck?: boolean;
|
|
194
|
-
sanitizeCSV?: boolean;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Selection data for server exports
|
|
199
|
-
*/
|
|
200
|
-
export interface SelectionExportData {
|
|
201
|
-
selectAllMatching?: boolean;
|
|
202
|
-
excludedIds?: string[];
|
|
203
|
-
selectedIds?: string[];
|
|
204
|
-
hasSelection?: boolean;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export interface ServerExportOptions extends SimpleExportOptions {
|
|
208
|
-
fetchData: (
|
|
209
|
-
filters?: Partial<TableState>,
|
|
210
|
-
selection?: SelectionExportData,
|
|
211
|
-
signal?: AbortSignal
|
|
212
|
-
) => Promise<ServerExportResult<any>>;
|
|
213
|
-
currentFilters?: any; // Current table filters/state
|
|
214
|
-
pageSize?: number;
|
|
215
|
-
selection?: SelectionExportData;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export interface ExportCallbacks {
|
|
219
|
-
onProgress?: (progress: ExportProgress) => void;
|
|
220
|
-
onComplete?: (result: ExportResult) => void;
|
|
221
|
-
onError?: (error: ExportError) => void;
|
|
222
|
-
onStateChange?: (state: ExportStateChange) => void;
|
|
223
|
-
}
|
package/src/lib/types/index.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Consolidated Types Index
|
|
3
|
-
* All DataTable types in one organized location
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Column-related types
|
|
7
|
-
export * from './column.types';
|
|
8
|
-
|
|
9
|
-
// Table state and configuration types
|
|
10
|
-
export * from './table.types';
|
|
11
|
-
|
|
12
|
-
// Export functionality types
|
|
13
|
-
export * from './export.types';
|
|
14
|
-
|
|
15
|
-
// API types (already exists)
|
|
16
|
-
export * from './data-table-api';
|
|
17
|
-
|
|
18
|
-
// Slots and slotProps types
|
|
19
|
-
export * from './slots.types';
|
|
20
|
-
|
|
21
|
-
// DataTable types
|
|
22
|
-
export * from './data-table.types';
|
|
23
|
-
// Re-export commonly used types for convenience
|
|
24
|
-
export type { DataTableApi } from './data-table-api';
|
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enhanced Slots and SlotProps Type System for DataTable
|
|
3
|
-
*
|
|
4
|
-
* This file defines all available slots and their corresponding prop types,
|
|
5
|
-
* following the MUI DataGrid pattern for maximum flexibility and extensibility.
|
|
6
|
-
*
|
|
7
|
-
* Key improvements:
|
|
8
|
-
* - Full component props inheritance without limitations
|
|
9
|
-
* - Better type safety with generic support
|
|
10
|
-
* - Flexible prop merging and overriding
|
|
11
|
-
* - Support for custom styling and behavior
|
|
12
|
-
*/
|
|
13
|
-
import { TableProps, TableContainerProps, BoxProps, ToolbarProps, TableRowProps, TableCellProps, TableHeadProps, TableBodyProps } from '@mui/material';
|
|
14
|
-
import { Table, Row, Column } from '@tanstack/react-table';
|
|
15
|
-
import { ComponentType, ReactNode, HTMLAttributes, ComponentProps } from 'react';
|
|
16
|
-
|
|
17
|
-
import { DataTableColumn, TableFilters, ExportProgress, ExportResult, ExportError, ServerExportColumn, ExportStateChange } from './index';
|
|
18
|
-
import { DataTableSize } from '../utils/table-helpers';
|
|
19
|
-
import { DataTablePaginationProps } from "../components/pagination";
|
|
20
|
-
import { DataTableToolbarProps } from '../components/toolbar/data-table-toolbar';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Enhanced slot component type that supports full component customization
|
|
24
|
-
*/
|
|
25
|
-
export type SlotComponent<TProps = any> = ComponentType<TProps>;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Base slot props interface that includes common props for all slots
|
|
29
|
-
*/
|
|
30
|
-
export interface BaseSlotProps<T = any> {
|
|
31
|
-
table: Table<T>;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Enhanced slot props that merge base props with component-specific props
|
|
36
|
-
*/
|
|
37
|
-
export type EnhancedSlotProps<TBase, TComponent> = TBase & TComponent & {
|
|
38
|
-
// Allow any additional props for maximum flexibility
|
|
39
|
-
[key: string]: any;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Available slots for customization with enhanced typing
|
|
44
|
-
*/
|
|
45
|
-
export interface DataTableSlots<T = any> {
|
|
46
|
-
// Container and wrapper slots
|
|
47
|
-
root?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, BoxProps & { children: ReactNode }>>;
|
|
48
|
-
tableContainer?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, TableContainerProps & {
|
|
49
|
-
children: ReactNode;
|
|
50
|
-
enableStickyHeader?: boolean;
|
|
51
|
-
maxHeight?: string | number;
|
|
52
|
-
enableVirtualization?: boolean;
|
|
53
|
-
}>>;
|
|
54
|
-
table?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, TableProps & {
|
|
55
|
-
children: ReactNode;
|
|
56
|
-
tableSize?: DataTableSize;
|
|
57
|
-
enableStickyHeader?: boolean;
|
|
58
|
-
fitToScreen?: boolean;
|
|
59
|
-
tableStyle?: React.CSSProperties;
|
|
60
|
-
}>>;
|
|
61
|
-
|
|
62
|
-
// Header slots
|
|
63
|
-
toolbar?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, ToolbarProps & DataTableToolbarProps & {
|
|
64
|
-
title?: string;
|
|
65
|
-
subtitle?: string;
|
|
66
|
-
enableGlobalFilter?: boolean;
|
|
67
|
-
enableColumnVisibility?: boolean;
|
|
68
|
-
enableColumnFilter?: boolean;
|
|
69
|
-
enableExport?: boolean;
|
|
70
|
-
enableReset?: boolean;
|
|
71
|
-
enableTableSizeControl?: boolean;
|
|
72
|
-
enableColumnPinning?: boolean;
|
|
73
|
-
enableRefresh?: boolean;
|
|
74
|
-
extraFilter?: ReactNode;
|
|
75
|
-
serverExport?: {
|
|
76
|
-
fetchData: (page: number, pageSize: number, filters: TableFilters) => Promise<{ data: T[]; total: number }>;
|
|
77
|
-
columns: ServerExportColumn<T>[];
|
|
78
|
-
pageSize?: number;
|
|
79
|
-
};
|
|
80
|
-
currentFilters?: TableFilters;
|
|
81
|
-
onExportStart?: (format: 'csv' | 'excel', summary: { mode: 'client' | 'server'; totalRows: number; estimatedMemoryMB?: number }) => void;
|
|
82
|
-
onExportProgress?: (progress: ExportProgress) => void;
|
|
83
|
-
onExportComplete?: (result: ExportResult) => void;
|
|
84
|
-
onExportError?: (error: ExportError) => void;
|
|
85
|
-
onExportCancel?: () => void;
|
|
86
|
-
onExportStateChange?: (state: ExportStateChange) => void;
|
|
87
|
-
}>>;
|
|
88
|
-
|
|
89
|
-
header?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, TableHeadProps & {
|
|
90
|
-
enableSorting?: boolean;
|
|
91
|
-
draggable?: boolean;
|
|
92
|
-
enableColumnResizing?: boolean;
|
|
93
|
-
enableStickyHeader?: boolean;
|
|
94
|
-
fitToScreen?: boolean;
|
|
95
|
-
onColumnReorder?: (draggedColumnId: string, targetColumnId: string) => void;
|
|
96
|
-
}>>;
|
|
97
|
-
|
|
98
|
-
headerRow?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, TableRowProps & {
|
|
99
|
-
headerGroups: any[];
|
|
100
|
-
}>>;
|
|
101
|
-
|
|
102
|
-
headerCell?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, TableCellProps & {
|
|
103
|
-
header: any;
|
|
104
|
-
column: Column<T>;
|
|
105
|
-
enableSorting?: boolean;
|
|
106
|
-
draggable?: boolean;
|
|
107
|
-
enableColumnResizing?: boolean;
|
|
108
|
-
onColumnReorder?: (draggedColumnId: string, targetColumnId: string) => void;
|
|
109
|
-
isPinned?: boolean | 'left' | 'right';
|
|
110
|
-
pinnedPosition?: number;
|
|
111
|
-
pinnedRightPosition?: number;
|
|
112
|
-
}>>;
|
|
113
|
-
|
|
114
|
-
// Icon slots with full component props
|
|
115
|
-
sortIconAsc?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
116
|
-
sortIconDesc?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
117
|
-
|
|
118
|
-
// Body slots
|
|
119
|
-
body?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, TableBodyProps & {
|
|
120
|
-
children: ReactNode;
|
|
121
|
-
rows: Row<T>[];
|
|
122
|
-
loading?: boolean;
|
|
123
|
-
emptyMessage?: string;
|
|
124
|
-
enableVirtualization?: boolean;
|
|
125
|
-
enablePagination?: boolean;
|
|
126
|
-
}>>;
|
|
127
|
-
|
|
128
|
-
row?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, TableRowProps & {
|
|
129
|
-
row: Row<T>;
|
|
130
|
-
index: number;
|
|
131
|
-
enableHover?: boolean;
|
|
132
|
-
enableStripes?: boolean;
|
|
133
|
-
isOdd?: boolean;
|
|
134
|
-
renderSubComponent?: (row: Row<T>) => ReactNode;
|
|
135
|
-
disableStickyHeader?: boolean;
|
|
136
|
-
}>>;
|
|
137
|
-
|
|
138
|
-
cell?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, TableCellProps & {
|
|
139
|
-
row: Row<T>;
|
|
140
|
-
cell: any;
|
|
141
|
-
column: Column<T>;
|
|
142
|
-
value: any;
|
|
143
|
-
isPinned?: boolean | 'left' | 'right';
|
|
144
|
-
pinnedPosition?: number;
|
|
145
|
-
pinnedRightPosition?: number;
|
|
146
|
-
alignment?: 'left' | 'center' | 'right';
|
|
147
|
-
}>>;
|
|
148
|
-
|
|
149
|
-
// Special row slots
|
|
150
|
-
loadingRow?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, TableRowProps & {
|
|
151
|
-
rowCount: number;
|
|
152
|
-
colSpan: number;
|
|
153
|
-
}>>;
|
|
154
|
-
|
|
155
|
-
emptyRow?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, TableRowProps & {
|
|
156
|
-
colSpan: number;
|
|
157
|
-
message: string;
|
|
158
|
-
}>>;
|
|
159
|
-
|
|
160
|
-
expandedRow?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, TableRowProps & {
|
|
161
|
-
row: Row<T>;
|
|
162
|
-
colSpan: number;
|
|
163
|
-
children: ReactNode;
|
|
164
|
-
}>>;
|
|
165
|
-
|
|
166
|
-
// Footer slots
|
|
167
|
-
footer?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, BoxProps & {
|
|
168
|
-
children: ReactNode;
|
|
169
|
-
enableStickyFooter?: boolean;
|
|
170
|
-
}>>;
|
|
171
|
-
|
|
172
|
-
pagination?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, DataTablePaginationProps>>;
|
|
173
|
-
|
|
174
|
-
// Toolbar component slots with full component inheritance
|
|
175
|
-
searchInput?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, ComponentProps<'input'> & {
|
|
176
|
-
value: string;
|
|
177
|
-
onChange: (value: string) => void;
|
|
178
|
-
placeholder?: string;
|
|
179
|
-
autoFocus?: boolean;
|
|
180
|
-
}>>;
|
|
181
|
-
|
|
182
|
-
columnVisibilityControl?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, HTMLAttributes<HTMLDivElement>>>;
|
|
183
|
-
columnCustomFilterControl?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, HTMLAttributes<HTMLDivElement>>>;
|
|
184
|
-
columnPinningControl?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, HTMLAttributes<HTMLDivElement>>>;
|
|
185
|
-
resetButton?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, ComponentProps<'button'>>>;
|
|
186
|
-
tableSizeControl?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, HTMLAttributes<HTMLDivElement>>>;
|
|
187
|
-
|
|
188
|
-
// Bulk action slots
|
|
189
|
-
bulkActionsToolbar?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, ToolbarProps & {
|
|
190
|
-
selectionState: any;
|
|
191
|
-
selectedRowCount: number;
|
|
192
|
-
bulkActions?: (selectionState: any) => ReactNode;
|
|
193
|
-
onBulkAction?: (action: string, selectionState: T[]) => void;
|
|
194
|
-
enableSelectAll?: boolean;
|
|
195
|
-
onSelectAll?: () => void;
|
|
196
|
-
onDeselectAll?: () => void;
|
|
197
|
-
}>>;
|
|
198
|
-
|
|
199
|
-
exportButton?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, ComponentProps<'button'> & {
|
|
200
|
-
filename?: string;
|
|
201
|
-
dataMode?: 'client' | 'server';
|
|
202
|
-
serverExport?: {
|
|
203
|
-
fetchData: (page: number, pageSize: number, filters: TableFilters) => Promise<{ data: T[]; total: number }>;
|
|
204
|
-
columns: ServerExportColumn<T>[];
|
|
205
|
-
pageSize?: number;
|
|
206
|
-
};
|
|
207
|
-
currentFilters?: TableFilters;
|
|
208
|
-
onExportStart?: (format: 'csv' | 'excel', summary: { mode: 'client' | 'server'; totalRows: number; estimatedMemoryMB?: number }) => void;
|
|
209
|
-
onExportProgress?: (progress: ExportProgress) => void;
|
|
210
|
-
onExportComplete?: (result: ExportResult) => void;
|
|
211
|
-
onExportError?: (error: ExportError) => void;
|
|
212
|
-
onExportCancel?: () => void;
|
|
213
|
-
onExportStateChange?: (state: ExportStateChange) => void;
|
|
214
|
-
}>>;
|
|
215
|
-
|
|
216
|
-
refreshButton?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, ComponentProps<'button'> & {
|
|
217
|
-
loading?: boolean;
|
|
218
|
-
showSpinnerWhileLoading?: boolean;
|
|
219
|
-
onRefresh?: () => void;
|
|
220
|
-
}>>;
|
|
221
|
-
|
|
222
|
-
// Icon slots with full SVG component props
|
|
223
|
-
searchIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
224
|
-
refreshIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
225
|
-
clearIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
226
|
-
exportIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
227
|
-
columnIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
228
|
-
resetIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
229
|
-
moreIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
230
|
-
filterIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
231
|
-
pinIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
232
|
-
unpinIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
233
|
-
leftIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
234
|
-
rightIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
235
|
-
csvIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
236
|
-
excelIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
237
|
-
selectAllIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
238
|
-
deselectIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
239
|
-
tableSizeIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
240
|
-
tableSizeSmallIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
241
|
-
tableSizeMediumIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
242
|
-
|
|
243
|
-
// Selection slots
|
|
244
|
-
checkboxSelection?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, ComponentProps<'input'> & {
|
|
245
|
-
row?: Row<T>;
|
|
246
|
-
checked: boolean;
|
|
247
|
-
indeterminate?: boolean;
|
|
248
|
-
onChange: (checked: boolean) => void;
|
|
249
|
-
disabled?: boolean;
|
|
250
|
-
}>>;
|
|
251
|
-
|
|
252
|
-
// Expansion slots
|
|
253
|
-
expandIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
254
|
-
collapseIcon?: SlotComponent<ComponentProps<'svg'> & { [key: string]: any }>;
|
|
255
|
-
|
|
256
|
-
// Loading and empty state slots
|
|
257
|
-
loadingSkeleton?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, HTMLAttributes<HTMLDivElement> & {
|
|
258
|
-
rows: number;
|
|
259
|
-
columns: number;
|
|
260
|
-
}>>;
|
|
261
|
-
|
|
262
|
-
noDataOverlay?: SlotComponent<EnhancedSlotProps<BaseSlotProps<T>, HTMLAttributes<HTMLDivElement> & {
|
|
263
|
-
message: string;
|
|
264
|
-
}>>;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
// Special column slots
|
|
269
|
-
selectionColumn?: DataTableColumn<T>;
|
|
270
|
-
expandColumn?: DataTableColumn<T>;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Enhanced slot props type that allows full customization
|
|
275
|
-
*/
|
|
276
|
-
export type DataTableSlotProps<T = any> = {
|
|
277
|
-
[K in keyof DataTableSlots<T>]?: Record<string, any>;
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Columns panel props for slot customization
|
|
282
|
-
*/
|
|
283
|
-
export interface ColumnsPanelSlotProps<T = any> {
|
|
284
|
-
getTogglableColumns?: (columns: DataTableColumn<T>[]) => DataTableColumn<T>[];
|
|
285
|
-
getPinnableColumns?: (columns: DataTableColumn<T>[]) => DataTableColumn<T>[];
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Utility type to make all slot props optional for easier usage
|
|
290
|
-
*/
|
|
291
|
-
export type PartialSlotProps<T = any> = {
|
|
292
|
-
[K in keyof DataTableSlotProps<T>]?: Partial<DataTableSlotProps<T>[K]>;
|
|
293
|
-
} & {
|
|
294
|
-
// Special props for columns panel
|
|
295
|
-
columnsPanel?: ColumnsPanelSlotProps<T>;
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Utility type for slot component props with proper generic support
|
|
300
|
-
*/
|
|
301
|
-
export type SlotComponentProps<
|
|
302
|
-
TSlot extends keyof DataTableSlots<T>,
|
|
303
|
-
T = any
|
|
304
|
-
> = DataTableSlots<T>[TSlot] extends SlotComponent<infer TProps> ? TProps : never;
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Helper type to extract component props from a slot
|
|
308
|
-
*/
|
|
309
|
-
export type ExtractSlotProps<TSlot> = TSlot extends SlotComponent<infer TProps> ? TProps : never;
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Default slot components - can be overridden by users
|
|
313
|
-
*/
|
|
314
|
-
// export interface DefaultSlots<T = any> extends DataTableSlots<T> {
|
|
315
|
-
// // All slots should have default implementations
|
|
316
|
-
// }
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Enhanced slot configuration with better prop merging
|
|
320
|
-
*/
|
|
321
|
-
export interface SlotConfiguration<T = any> {
|
|
322
|
-
slots?: Partial<DataTableSlots<T>>;
|
|
323
|
-
slotProps?: PartialSlotProps<T>;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Slot override configuration for advanced customization
|
|
328
|
-
*/
|
|
329
|
-
export interface SlotOverrideConfig<T = any> {
|
|
330
|
-
// Override specific slot behavior
|
|
331
|
-
overrideSlot?: <K extends keyof DataTableSlots<T>>(
|
|
332
|
-
slotName: K,
|
|
333
|
-
component: DataTableSlots<T>[K],
|
|
334
|
-
props?: Partial<SlotComponentProps<K, T>>
|
|
335
|
-
) => void;
|
|
336
|
-
|
|
337
|
-
// Merge props with existing slot props
|
|
338
|
-
mergeSlotProps?: <K extends keyof DataTableSlots<T>>(
|
|
339
|
-
slotName: K,
|
|
340
|
-
props: Partial<SlotComponentProps<K, T>>
|
|
341
|
-
) => Partial<SlotComponentProps<K, T>>;
|
|
342
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { SortingState } from '@tanstack/react-table';
|
|
2
|
-
|
|
3
|
-
import { ColumnFilterRule, SelectionState } from '../features';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Table State and Configuration Types
|
|
8
|
-
* Consolidated table-related interfaces from data-table.types.ts
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Table filters configuration
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
export type TableSize = 'small' | 'medium';
|
|
16
|
-
|
|
17
|
-
// Extended table state interface with custom column filter support
|
|
18
|
-
|
|
19
|
-
export interface TableState {
|
|
20
|
-
columnFilter: ColumnFilterState;
|
|
21
|
-
selectionState?: SelectionState; // Selection state for CustomSelectionFeature
|
|
22
|
-
globalFilter?: string;
|
|
23
|
-
sorting?: SortingState;
|
|
24
|
-
pagination?: {
|
|
25
|
-
pageIndex: number;
|
|
26
|
-
pageSize: number;
|
|
27
|
-
};
|
|
28
|
-
columnOrder?: string[];
|
|
29
|
-
columnPinning?: {
|
|
30
|
-
left?: string[];
|
|
31
|
-
right?: string[];
|
|
32
|
-
};
|
|
33
|
-
columnVisibility?: Record<string, boolean>;
|
|
34
|
-
columnSizing?: Record<string, number>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface TableFilters {
|
|
38
|
-
globalFilter: string;
|
|
39
|
-
columnFilter: ColumnFilterState;
|
|
40
|
-
sorting: SortingState;
|
|
41
|
-
pagination: {
|
|
42
|
-
pageIndex: number;
|
|
43
|
-
pageSize: number;
|
|
44
|
-
};
|
|
45
|
-
columnOrder: string[];
|
|
46
|
-
columnPinning: {
|
|
47
|
-
left?: string[];
|
|
48
|
-
right?: string[];
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface TableFiltersForFetch extends Partial<TableFilters> {
|
|
53
|
-
search?: string;
|
|
54
|
-
page?: number;
|
|
55
|
-
pageSize?: number;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface ColumnFilterState {
|
|
59
|
-
filters: ColumnFilterRule[];
|
|
60
|
-
logic: 'AND' | 'OR';
|
|
61
|
-
// Add pending state for draft filters before applying
|
|
62
|
-
pendingFilters: ColumnFilterRule[];
|
|
63
|
-
pendingLogic: 'AND' | 'OR';
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Table performance metrics
|
|
68
|
-
*/
|
|
69
|
-
export interface TablePerformanceMetrics {
|
|
70
|
-
renderTime: number;
|
|
71
|
-
dataProcessingTime: number;
|
|
72
|
-
totalRows: number;
|
|
73
|
-
visibleRows: number;
|
|
74
|
-
memoryUsage?: number;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Table metrics for debugging and optimization
|
|
79
|
-
*/
|
|
80
|
-
export interface TableMetrics {
|
|
81
|
-
totalRows: number;
|
|
82
|
-
visibleRows: number;
|
|
83
|
-
totalColumns?: number;
|
|
84
|
-
visibleColumns?: number;
|
|
85
|
-
pinnedColumns?: number;
|
|
86
|
-
renderTime: number;
|
|
87
|
-
lastUpdated?: Date;
|
|
88
|
-
}
|