@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,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* General table utilities for DataTable components
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// Import types from centralized location
|
|
6
|
-
import type { TableMetrics } from '../types';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export type DataTableSize = 'small' | 'medium';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Calculate skeleton rows count based on viewport and row height
|
|
13
|
-
*/
|
|
14
|
-
export function calculateSkeletonRows(
|
|
15
|
-
containerHeight: number,
|
|
16
|
-
rowHeight: number,
|
|
17
|
-
maxRows = 10,
|
|
18
|
-
): number {
|
|
19
|
-
const estimatedRows = Math.ceil(containerHeight / rowHeight);
|
|
20
|
-
return Math.min(estimatedRows, maxRows);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Generate unique row ID for virtualization
|
|
25
|
-
*/
|
|
26
|
-
export function generateRowId<T>(row: T, index: number, idKey?: keyof T): string {
|
|
27
|
-
if (idKey && row[idKey]) {
|
|
28
|
-
return String(row[idKey]);
|
|
29
|
-
}
|
|
30
|
-
return `row-${index}`;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Calculate total width of pinned columns
|
|
35
|
-
*/
|
|
36
|
-
export function calculatePinnedColumnsWidth(
|
|
37
|
-
columns: any[],
|
|
38
|
-
side: 'left' | 'right',
|
|
39
|
-
): number {
|
|
40
|
-
return columns
|
|
41
|
-
.filter(col => col.getIsPinned() === side)
|
|
42
|
-
.reduce((total, col) => total + (col.getSize() || 0), 0);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Check if table should use fixed layout
|
|
47
|
-
*/
|
|
48
|
-
export function shouldUseFixedLayout(
|
|
49
|
-
fitToScreen: boolean,
|
|
50
|
-
enableColumnResizing: boolean,
|
|
51
|
-
totalColumns: number,
|
|
52
|
-
): boolean {
|
|
53
|
-
return fitToScreen || (enableColumnResizing && totalColumns > 5);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Format cell value based on column type
|
|
58
|
-
*/
|
|
59
|
-
export function formatCellValue(value: any, type: string): string {
|
|
60
|
-
if (value === null || value === undefined) {
|
|
61
|
-
return '-';
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
switch (type) {
|
|
65
|
-
case 'date':
|
|
66
|
-
return value instanceof Date ? value.toLocaleDateString() : String(value);
|
|
67
|
-
case 'number':
|
|
68
|
-
return typeof value === 'number' ? value.toLocaleString() : String(value);
|
|
69
|
-
case 'boolean':
|
|
70
|
-
return value ? 'Yes' : 'No';
|
|
71
|
-
default:
|
|
72
|
-
return String(value);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Debounce function for search and filters
|
|
78
|
-
*/
|
|
79
|
-
export function debounce<T extends (...args: any[]) => any>(
|
|
80
|
-
func: T,
|
|
81
|
-
wait: number,
|
|
82
|
-
): (...args: Parameters<T>) => void {
|
|
83
|
-
let timeout: NodeJS.Timeout;
|
|
84
|
-
return (...args: Parameters<T>) => {
|
|
85
|
-
clearTimeout(timeout);
|
|
86
|
-
timeout = setTimeout(() => func(...args), wait);
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Get table performance metrics
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
export function calculateTableMetrics(
|
|
95
|
-
totalRows: number,
|
|
96
|
-
visibleRows: number,
|
|
97
|
-
columns: any[],
|
|
98
|
-
renderStartTime: number,
|
|
99
|
-
): TableMetrics {
|
|
100
|
-
return {
|
|
101
|
-
totalRows,
|
|
102
|
-
visibleRows,
|
|
103
|
-
pinnedColumns: columns.filter(col => col.getIsPinned()).length,
|
|
104
|
-
renderTime: performance.now() - renderStartTime,
|
|
105
|
-
};
|
|
106
|
-
}
|