ia-table 0.4.3 → 0.4.5
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/index.d.ts +112 -0
- package/dist/index.js +6545 -6797
- package/dist/index.js.map +1 -1
- package/package.json +10 -8
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
declare module "ia-table" {
|
|
2
|
+
import { ComponentType, ReactNode, CSSProperties } from "react";
|
|
3
|
+
|
|
4
|
+
export interface Column<T = any> {
|
|
5
|
+
/** The field name in the row data object */
|
|
6
|
+
field: string;
|
|
7
|
+
/** The column header display name */
|
|
8
|
+
headerName?: string;
|
|
9
|
+
/** Width of the column */
|
|
10
|
+
width?: number | string;
|
|
11
|
+
/** Minimum width of the column */
|
|
12
|
+
minWidth?: number | string;
|
|
13
|
+
/** Maximum width of the column */
|
|
14
|
+
maxWidth?: number | string;
|
|
15
|
+
/** Whether the column is sortable */
|
|
16
|
+
sortable?: boolean;
|
|
17
|
+
/** Whether the column is searchable */
|
|
18
|
+
isSearchable?: boolean;
|
|
19
|
+
/** Whether the column is sortable (alternative to sortable) */
|
|
20
|
+
isSortable?: boolean;
|
|
21
|
+
/** Whether to show filter for this column */
|
|
22
|
+
filter?: boolean | string;
|
|
23
|
+
/** Custom cell renderer */
|
|
24
|
+
cellRenderer?: (params: {
|
|
25
|
+
value: any;
|
|
26
|
+
data: T;
|
|
27
|
+
rowIndex: number;
|
|
28
|
+
column: Column<T>;
|
|
29
|
+
}) => ReactNode;
|
|
30
|
+
/** Custom header renderer */
|
|
31
|
+
headerRenderer?: (params: {
|
|
32
|
+
column: Column<T>;
|
|
33
|
+
sortDirection?: "asc" | "desc" | null;
|
|
34
|
+
onSort?: (field: string, direction: "asc" | "desc") => void;
|
|
35
|
+
}) => ReactNode;
|
|
36
|
+
/** Custom CSS class for the column */
|
|
37
|
+
className?: string;
|
|
38
|
+
/** Custom CSS styles for the column */
|
|
39
|
+
style?: CSSProperties;
|
|
40
|
+
/** Whether the column is resizable */
|
|
41
|
+
resizable?: boolean;
|
|
42
|
+
/** Whether the column is pinned */
|
|
43
|
+
pinned?: "left" | "right";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface TableProps<T = any> {
|
|
47
|
+
/** Array of column definitions */
|
|
48
|
+
columns: Array<Column<T>>;
|
|
49
|
+
/** Array of row data objects */
|
|
50
|
+
data?: T[];
|
|
51
|
+
/** Height of the table (e.g., '100%', 500) */
|
|
52
|
+
height?: number | string;
|
|
53
|
+
/** Width of the table (e.g., '100%', 800) */
|
|
54
|
+
width?: number | string;
|
|
55
|
+
/** Height of each row in pixels */
|
|
56
|
+
rowHeight?: number;
|
|
57
|
+
/** Height of the header row in pixels */
|
|
58
|
+
headerHeight?: number;
|
|
59
|
+
/** Custom CSS class for the table */
|
|
60
|
+
className?: string;
|
|
61
|
+
/** Custom CSS styles for the table */
|
|
62
|
+
style?: CSSProperties;
|
|
63
|
+
/** Whether to show column headers */
|
|
64
|
+
showHeader?: boolean;
|
|
65
|
+
/** Whether to show a loading overlay */
|
|
66
|
+
loading?: boolean;
|
|
67
|
+
/** Custom loading component or text */
|
|
68
|
+
loadingOverlayComponent?: ReactNode | string;
|
|
69
|
+
/** Custom no rows overlay component or text */
|
|
70
|
+
noRowsOverlayComponent?: ReactNode | string;
|
|
71
|
+
/** Callback when a row is clicked */
|
|
72
|
+
onRowClick?: (
|
|
73
|
+
rowData: T,
|
|
74
|
+
rowIndex: number,
|
|
75
|
+
event: React.MouseEvent
|
|
76
|
+
) => void;
|
|
77
|
+
/** Callback when a row is double-clicked */
|
|
78
|
+
onRowDoubleClick?: (
|
|
79
|
+
rowData: T,
|
|
80
|
+
rowIndex: number,
|
|
81
|
+
event: React.MouseEvent
|
|
82
|
+
) => void;
|
|
83
|
+
/** Callback when sort changes */
|
|
84
|
+
onSortChanged?: (
|
|
85
|
+
sortModel: {
|
|
86
|
+
field: string;
|
|
87
|
+
sort: "asc" | "desc" | null;
|
|
88
|
+
}[]
|
|
89
|
+
) => void;
|
|
90
|
+
/** Callback when filter changes */
|
|
91
|
+
onFilterChanged?: (filterModel: {
|
|
92
|
+
[field: string]: {
|
|
93
|
+
filterType: string;
|
|
94
|
+
type: string;
|
|
95
|
+
filter: any;
|
|
96
|
+
};
|
|
97
|
+
}) => void;
|
|
98
|
+
/** Callback when rows are selected */
|
|
99
|
+
onSelectionChanged?: (selectedRows: T[]) => void;
|
|
100
|
+
/** Whether to enable row selection */
|
|
101
|
+
rowSelection?: "single" | "multiple" | false;
|
|
102
|
+
/** Key field for row selection (default: 'id') */
|
|
103
|
+
rowKeyField?: string;
|
|
104
|
+
/** Custom row class name */
|
|
105
|
+
getRowClassName?: (params: { rowData: T; rowIndex: number }) => string;
|
|
106
|
+
/** Custom row style */
|
|
107
|
+
getRowStyle?: (params: { rowData: T; rowIndex: number }) => CSSProperties;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const IATable: ComponentType<TableProps>;
|
|
111
|
+
export default IATable;
|
|
112
|
+
}
|