ia-table 0.9.2 → 0.10.0

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.
@@ -0,0 +1,200 @@
1
+ import { CSSProperties, ReactNode, Ref } from "react";
2
+ import {
3
+ SmartGridColumnDefinition,
4
+ SmartGridHeaderStyleParams,
5
+ } from "./columns.type";
6
+ import {
7
+ SmartGridAPI,
8
+ SmartGridCellValueChangedParams,
9
+ SmartGridGetRowDataParams,
10
+ SmartGridRowData,
11
+ } from "./api.type";
12
+ import { SmartGridSortModel } from "./common.type";
13
+
14
+ export interface SmartGridTableRef {
15
+ api: SmartGridAPI;
16
+ }
17
+
18
+ export interface SmartGridRowDragStartParams {
19
+ api: SmartGridAPI;
20
+ type: "rowDragStart";
21
+ rowIndex: number;
22
+ rowData: SmartGridRowData;
23
+ }
24
+
25
+ export interface SmartGridRowDragEndParams {
26
+ api: SmartGridAPI;
27
+ type: "rowDragEnd";
28
+ fromIndex: number;
29
+ toIndex: number;
30
+ rowData: SmartGridRowData;
31
+ }
32
+
33
+ export type SmartGridOnReadyParams = {
34
+ api: SmartGridAPI;
35
+ columnApi: SmartGridAPI;
36
+ type: "gridReady";
37
+ };
38
+
39
+ export type SmartGridRowGrouOpenParams = {
40
+ rowId: string;
41
+ rowIndex: number;
42
+ api: SmartGridAPI;
43
+ isExpanded: boolean;
44
+ };
45
+
46
+ export type SmartGridOnSelectionChangedParams = {
47
+ api: SmartGridAPI;
48
+ type: string;
49
+ source: string;
50
+ };
51
+
52
+ export type SmartGridRowStyleParams = {
53
+ api: SmartGridAPI;
54
+ data: SmartGridRowData;
55
+ pinned: boolean;
56
+ node: {
57
+ rowIndex: number;
58
+ data: SmartGridRowData;
59
+ api: SmartGridAPI;
60
+ pinned: boolean;
61
+ };
62
+ };
63
+
64
+ export type SmartGridDefaultColDef = {
65
+ minWidth: number;
66
+ headerComponentParams?: {
67
+ innerHeaderComponent:
68
+ | ((params: SmartGridHeaderStyleParams) => ReactNode)
69
+ | null;
70
+ };
71
+ headerComponent?: ((params: SmartGridHeaderStyleParams) => ReactNode) | null;
72
+ };
73
+
74
+ export type SmartGridTableProps = {
75
+ ref?: Ref<SmartGridTableRef>;
76
+ data?: SmartGridRowData[];
77
+ columns: SmartGridColumnDefinition[];
78
+ height?: number | string;
79
+ uniqueIdField: string;
80
+ childKeyField?: string;
81
+ defaultColDef?: SmartGridDefaultColDef;
82
+ pinnedTopRowData?: SmartGridRowData[];
83
+ pinnedBottomRowData?: SmartGridRowData[];
84
+ getRowStyle?: (params: SmartGridRowStyleParams) => CSSProperties;
85
+ tableHeader?: string | ReactNode;
86
+ topRightOptions?: string | ReactNode;
87
+ bottomLeftOptions?: string | ReactNode;
88
+ bottomCenterOptions?: string | ReactNode;
89
+ bottomRightOptions?: string | ReactNode;
90
+ topLeftOptions?: string | ReactNode;
91
+ headerHeight?: number | string;
92
+ onSelectionChanged?: (event: SmartGridOnSelectionChangedParams) => void;
93
+ onRowDragStart?: (event: SmartGridRowDragStartParams) => void;
94
+ onRowDragEnd?: (event: SmartGridRowDragEndParams) => void;
95
+ onCellValueChanged?: (params: SmartGridCellValueChangedParams) => void;
96
+ onGridReady?: (params: SmartGridOnReadyParams) => void;
97
+ onRowGroupOpened?: (params: SmartGridRowGrouOpenParams) => void;
98
+ fetchData?: (
99
+ manualbody: any,
100
+ page: any,
101
+ context: any,
102
+ pageNo: any,
103
+ other: any
104
+ ) => Promise<any>;
105
+ apiUrl?: string;
106
+ autoFetch?: boolean;
107
+ cacheConfig?: {
108
+ threshold?: number;
109
+ maxBlocksInCache?: number;
110
+ cacheOverflowSize?: number;
111
+ rowHeight?: number;
112
+ purgeStrategy?: string;
113
+ enablePersistence?: boolean;
114
+ persistenceStorageKey?: string;
115
+ persistenceOptions?: any;
116
+ force?: boolean;
117
+ };
118
+ onScroll?: (event: any) => void;
119
+ showSaveTableConfig?: boolean;
120
+ loadTableInstance?: (api: SmartGridAPI) => void;
121
+ adjustTableHeightServerSide?: boolean;
122
+ largeDatasetOptions?: {
123
+ enableIndexedDBCache?: boolean;
124
+ enableStreamingLoad?: boolean;
125
+ enableEnhancedWorker?: boolean;
126
+ binaryFormat?: boolean;
127
+ extremelyLargeDatasetThreshold?: number;
128
+ };
129
+ gridOptions?: any;
130
+ tableId?: string;
131
+ alignedGrids?: any[];
132
+ masterDetail?: boolean;
133
+ detailCellRenderer?: any;
134
+ detailRowHeight?: number;
135
+ infiniteScroll?: boolean;
136
+ customTabFunction?: any;
137
+ getRowData?: (params: SmartGridGetRowDataParams, columnName: string) => any;
138
+ rowDragManaged?: boolean;
139
+ hidePaginationPageSizeSelector?: boolean;
140
+ purgeClosedRowNodes?: boolean;
141
+ detailRendererTable?: boolean;
142
+ smartGridMenuOptions?: {
143
+ withColumMenu?: boolean;
144
+ autoWithColumMenu?: boolean;
145
+ freezeColumnMenu?: boolean;
146
+ sortColumnMenu?: boolean;
147
+ collapseColumnAll?: boolean;
148
+ expandColumnAll?: boolean;
149
+ wrapText?: boolean;
150
+ [key: string]: any;
151
+ };
152
+ paginateOriginalRowsOnly?: boolean;
153
+ isSaveViewEnabled?: boolean;
154
+ isSavingViewLoading?: boolean;
155
+ maxSavedViews?: number;
156
+ deleteViewPromptText?: string;
157
+ savedViewsOptions?: any[];
158
+ handleSetDefaultView?: (view: any) => void;
159
+ handleSavedViewClick?: (view: any) => void;
160
+ handleEditSaveView?: (view: any) => void;
161
+ handleSaveAndApply?: (view: any) => void;
162
+ handleDeleteViewClick?: (view: any) => void;
163
+ rowHeight?: string;
164
+ additionalButtons?: string | ReactNode;
165
+ aboveTableComponent?: string | ReactNode;
166
+ shouldRenderTable?: boolean;
167
+ nestedTable?: boolean;
168
+ nestedTableComponent?: Function | ReactNode;
169
+ enableNestedTableCloseButton?: boolean;
170
+ downloadAsExcel?: boolean;
171
+ downloadAsCSV?: boolean;
172
+ copyToClipboard?: boolean;
173
+ onCloseNestedTable?: () => void;
174
+ downloadExcelHandler?: () => void;
175
+ downloadCSVHandler?: () => void;
176
+ copyToClipboardHandler?: () => void;
177
+ ShowFullText?: boolean;
178
+ hideNotification?: boolean;
179
+ isSingleSelect?: boolean;
180
+ defaultPageSize?: number;
181
+ paginationPageSize?: number[];
182
+ enableRowSpan?: boolean;
183
+ rowSpanColumn?: string | string[];
184
+ showHeader?: boolean;
185
+ showFooter?: boolean;
186
+ showToolbar?: boolean;
187
+ selectable?: boolean;
188
+ defaultSort?: SmartGridSortModel;
189
+ actions?: Record<string, any>;
190
+ pagination?: boolean;
191
+ showTableSettingActionTab?: boolean;
192
+ showTableSettingFormatTab?: boolean;
193
+ showFilters?: boolean;
194
+ expandable?: boolean;
195
+ onCellClicked?: () => void;
196
+ onCellClick?: () => void;
197
+ onRowClicked?: () => void;
198
+ onRowClick?: () => void;
199
+ [key: string]: any;
200
+ };
package/dist/index.d.ts CHANGED
@@ -1,273 +1,15 @@
1
- declare module "ia-table" {
2
- import { ComponentType, ReactNode, CSSProperties } from "react";
1
+ import { ComponentType } from "react";
2
+ import { SmartGridTableProps } from "./components/IATable/types/table.type";
3
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 - can be a string reference or a function */
24
- cellRenderer?:
25
- | string
26
- | ((params: {
27
- value: any;
28
- data: T;
29
- rowIndex: number;
30
- column: Column<T>;
31
- }) => ReactNode);
32
- /** Custom header renderer */
33
- headerRenderer?: (params: {
34
- column: Column<T>;
35
- sortDirection?: "asc" | "desc" | null;
36
- onSort?: (field: string, direction: "asc" | "desc") => void;
37
- }) => ReactNode;
38
- /** Custom CSS class for the column */
39
- className?: string;
40
- /** Custom CSS styles for the column */
41
- style?: CSSProperties;
42
- /** Whether the column is resizable */
43
- resizable?: boolean;
44
- /** Whether the column is pinned */
45
- pinned?: "left" | "right";
46
- /** Allow any additional properties to be added to the column definition */
47
- [key: string]: any;
48
- }
4
+ // Export all types from the types folder
5
+ export * from "./components/IATable/types/index.type";
49
6
 
50
- export interface TableProps<T = any> {
51
- /** Array of column definitions */
52
- columns: Array<Column<T>>;
53
- /** Array of row data objects */
54
- data?: T[];
55
- /** Height of the table (e.g., '100%', 500) */
56
- height?: number | string;
57
- /** uniqueIdField */
58
- uniqueIdField?: string;
59
- /** childKeyField */
60
- childKeyField?: string;
61
- /** Default column definition for all columns */
62
- defaultColDef?: {
63
- minWidth: number;
64
- [key: string]: any;
65
- };
66
- /** Array of row data to pin at the top */
67
- pinnedTopRowData?: T[];
68
- /** Array of row data to pin at the bottom */
69
- pinnedBottomRowData?: T[];
70
- /** Custom header content to display at the top-left corner */
71
- tableHeader?: string | ReactNode;
72
- /** Custom options to display at the top-right corner */
73
- topRightOptions?: string | ReactNode;
74
- /** Custom options to display at the bottom-left corner */
75
- bottomLeftOptions?: string | ReactNode;
76
- /** Custom options to display at the bottom-center */
77
- bottomCenterOptions?: string | ReactNode;
78
- /** Custom options to display at the bottom-right corner */
79
- bottomRightOptions?: string | ReactNode;
80
- /** Custom options to display at the top-left corner */
81
- topLeftOptions?: string | ReactNode;
82
- aboveTableComponent?: string | ReactNode;
83
- shouldRenderTable?: boolean;
84
- /** Height of each row in pixels or 'default' */
85
- rowHeight?: number | string;
86
- /** Height of the header row in pixels */
87
- headerHeight?: number;
88
- /** Custom CSS class for the table */
89
- className?: string;
90
- /** Custom CSS styles for the table */
91
- style?: CSSProperties;
92
- /** Whether to show column headers */
93
- showHeader?: boolean;
94
- /** Whether to show a loading overlay */
95
- loading?: boolean;
96
- /** Custom loading component or text */
97
- loadingOverlayComponent?: ReactNode | string;
98
- /** Custom no rows overlay component or text */
99
- noRowsOverlayComponent?: ReactNode | string;
100
- /** Whether to enable pagination */
101
- pagination?: boolean;
102
- /** Callback when a row is clicked */
103
- onRowClick?: (
104
- rowData: T,
105
- rowIndex: number,
106
- event: React.MouseEvent
107
- ) => void;
108
- /** Callback when a row is double-clicked */
109
- onRowDoubleClick?: (
110
- rowData: T,
111
- rowIndex: number,
112
- event: React.MouseEvent
113
- ) => void;
114
- /** Callback when sort changes */
115
- onSortChanged?: (
116
- sortModel: {
117
- field: string;
118
- sort: "asc" | "desc" | null;
119
- }[]
120
- ) => void;
121
- /** Callback when filter changes */
122
- onFilterChanged?: (filterModel: {
123
- [field: string]: {
124
- filterType: string;
125
- type: string;
126
- filter: any;
127
- };
128
- }) => void;
129
- /** Callback when rows are selected */
130
- onSelectionChanged?: (selectedRows: T[]) => void;
131
- /** Callback when cell value changes */
132
- onCellValueChanged?: (params: {
133
- field: string;
134
- newValue: any;
135
- oldValue: any;
136
- data: T;
137
- }) => void;
138
- /** Callback when grid is ready */
139
- onGridReady?: (params: { api: any; columnApi: any }) => void;
140
- /** Callback when row group is opened */
141
- onRowGroupOpened?: (params: { node: any }) => void;
142
- /** Function to fetch data from server */
143
- fetchData?: (
144
- manualbody: any,
145
- page: any,
146
- context: any,
147
- page: any,
148
- other: any
149
- ) => Promise<any>;
150
- /** API URL for server-side operations */
151
- apiUrl?: string;
152
- /** Whether to automatically fetch data on mount */
153
- autoFetch?: boolean;
154
- /** Cache configuration for large datasets */
155
- cacheConfig?: {
156
- threshold?: number;
157
- maxBlocksInCache?: number;
158
- cacheOverflowSize?: number;
159
- rowHeight?: number;
160
- purgeStrategy?: string;
161
- enablePersistence?: boolean;
162
- persistenceStorageKey?: string;
163
- persistenceOptions?: any;
164
- force?: boolean;
165
- };
166
- /** Callback for scroll events */
167
- onScroll?: (event: any) => void;
168
- /** Whether to show save table config option */
169
- showSaveTableConfig?: boolean;
170
- /** Function to receive the API instance */
171
- loadTableInstance?: (api: any) => void;
172
- /** Whether to adjust table height in server-side mode */
173
- adjustTableHeightServerSide?: boolean;
174
- /** Advanced options for extremely large datasets */
175
- largeDatasetOptions?: {
176
- enableIndexedDBCache?: boolean;
177
- enableStreamingLoad?: boolean;
178
- enableEnhancedWorker?: boolean;
179
- binaryFormat?: boolean;
180
- extremelyLargeDatasetThreshold?: number;
181
- };
182
- /** Additional grid options */
183
- gridOptions?: any;
184
- /** Unique identifier for this grid instance */
185
- tableId?: string;
186
- /** Array of grid IDs or refs to align with */
187
- alignedGrids?: any[];
188
- /** Enable master-detail functionality */
189
- masterDetail?: boolean;
190
- /** Custom renderer for detail content */
191
- detailCellRenderer?: any;
192
- /** Height of detail rows */
193
- detailRowHeight?: number;
194
- /** Whether to enable infinite scrolling */
195
- infiniteScroll?: boolean;
196
- /** Custom tab navigation function */
197
- customTabFunction?: any;
198
- /** Function to get row data */
199
- getRowData?: (params: any, columnName: string) => any;
200
- /** Whether to enable row drag management */
201
- rowDragManaged?: boolean;
202
- /** Whether to hide pagination page size selector */
203
- hidePaginationPageSizeSelector?: boolean;
204
- /** Whether to purge closed row nodes */
205
- purgeClosedRowNodes?: boolean;
206
- /** Whether this is a detail renderer table */
207
- detailRendererTable?: boolean;
208
- /** Options for smart grid menu */
209
- smartGridMenuOptions?: {
210
- withColumMenu?: boolean;
211
- autoWithColumMenu?: boolean;
212
- freezeColumnMenu?: boolean;
213
- sortColumnMenu?: boolean;
214
- collapseColumnAll?: boolean;
215
- expandColumnAll?: boolean;
216
- wrapText?: boolean;
217
- [key: string]: any;
218
- };
219
- /** Whether to paginate original rows only */
220
- paginateOriginalRowsOnly?: boolean;
221
- /** Whether save view is enabled */
222
- isSaveViewEnabled?: boolean;
223
- /** Whether saving view is loading */
224
- isSavingViewLoading?: boolean;
225
- /** Maximum number of saved views */
226
- maxSavedViews?: number;
227
- /** Text for delete view prompt */
228
- deleteViewPromptText?: string;
229
- /** Options for saved views */
230
- savedViewsOptions?: any[];
231
- /** Function to handle setting default view */
232
- handleSetDefaultView?: (view: any) => void;
233
- /** Function to handle saved view click */
234
- handleSavedViewClick?: (view: any) => void;
235
- /** Function to handle edit save view */
236
- handleEditSaveView?: (view: any) => void;
237
- /** Function to handle save and apply */
238
- handleSaveAndApply?: (view: any) => void;
239
- /** Function to handle delete view click */
240
- handleDeleteViewClick?: (view: any) => void;
241
- /** Additional buttons to display */
242
- additionalButtons?: any;
243
- /** Whether to enable row selection */
244
- rowSelection?: "single" | "multiple" | false;
245
- /** Key field for row selection (default: 'id') */
246
- rowKeyField?: string;
247
- /** Custom row class name */
248
- getRowClassName?: (params: { rowData: T; rowIndex: number }) => string;
249
- /** Custom row style */
250
- getRowStyle?: (params: { rowData: T; rowIndex: number }) => CSSProperties;
251
- /** Default page size for pagination */
252
- defaultPageSize?: number;
253
- /** Page size options for pagination */
254
- paginationPageSize?: number[];
255
- /** Default sort configuration */
256
- defaultSort?: { field: string; direction: "asc" | "desc" };
257
- /** Whether to enable row spanning */
258
- enableRowSpan?: boolean;
259
- /** Column to use for row spanning */
260
- rowSpanColumn?: string;
261
- /** Actions for the table */
262
- actions?: Record<string, any>;
263
- /** Whether to show toolbar */
264
- showToolbar?: boolean;
265
- /** Whether rows are selectable */
266
- selectable?: boolean;
267
- /** Allow any additional properties */
268
- [key: string]: any;
269
- }
270
-
271
- const IATable: ComponentType<TableProps>;
272
- export default IATable;
7
+ // SVG module declarations for library consumers
8
+ declare module "*.svg" {
9
+ import React from "react";
10
+ const SVGComponent: React.FC<React.SVGProps<SVGSVGElement>>;
11
+ export default SVGComponent;
273
12
  }
13
+
14
+ declare const IATable: ComponentType<SmartGridTableProps>;
15
+ export default IATable;