ia-table 0.9.2 → 0.10.1

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,185 @@
1
+ import { CSSProperties } from "react";
2
+ import { SmartGridAPI, SmartGridRowData } from "./api.type";
3
+ import {
4
+ SmartGridNewSortModel,
5
+ SmartGridSortModel,
6
+ SmartGridUpdateData,
7
+ } from "./common.type";
8
+
9
+ export interface SmartGridValueFormatterParams {
10
+ value: unknown;
11
+ data: SmartGridRowData;
12
+ colDef: SmartGridColumnDefinition;
13
+ }
14
+ export interface SmartGridValueGetterParams {
15
+ data: SmartGridRowData;
16
+ node: {
17
+ data: SmartGridRowData;
18
+ };
19
+ colDef: SmartGridColumnDefinition;
20
+ column: SmartGridColumnDefinition;
21
+ api: SmartGridAPI;
22
+ columnApi?: unknown;
23
+ getValue: (field: string) => unknown;
24
+ }
25
+
26
+ export type SmartGridCellRenderer = {
27
+ value: unknown;
28
+ data: SmartGridRowData;
29
+ rowIndex: number;
30
+ colIndex: number;
31
+ column: SmartGridColumnDefinition;
32
+ colDef: SmartGridColumnDefinition;
33
+ node: {
34
+ data: SmartGridRowData;
35
+ rowIndex: number;
36
+ id: string | number;
37
+ parent: SmartGridUpdateData & {
38
+ id: string | number;
39
+ level: number;
40
+ setExpanded: () => void;
41
+ };
42
+ setDataValue: (colId: string, newValue: unknown) => void;
43
+ childrenMapped: Record<string, string>;
44
+ allLeafChildren: Record<string, string>;
45
+ group: boolean;
46
+ level: number;
47
+ childIndex: number;
48
+ isSelected: () => boolean;
49
+ isExpandable: () => boolean;
50
+ isExpanded: () => boolean;
51
+ };
52
+ api: SmartGridAPI;
53
+ eGridCell: React.HTMLAttributes<HTMLDivElement>;
54
+ wholeData: SmartGridRowData[];
55
+ actions: Record<string, unknown>;
56
+ setDataValue: (colId: string, newValue: unknown) => void;
57
+ };
58
+ export type SmartGridCellRendererParams = Record<string, unknown>;
59
+
60
+ export type SmartGridHeaderStyleParams = {
61
+ column: SmartGridColumnDefinition;
62
+ displayName: string;
63
+ enableSorting: boolean;
64
+ sortState: SmartGridNewSortModel;
65
+ onSort: (field: string, direction: string) => void;
66
+ isSearchable: boolean;
67
+ showSortIcon: boolean;
68
+ toggleSearchModal: (e: React.MouseEvent<HTMLElement>) => void;
69
+ hasFilters: boolean;
70
+ isExpandable: boolean;
71
+ onToggle: (field: string, isExpandable: boolean) => void;
72
+ api: SmartGridAPI;
73
+ availableWidth: number;
74
+ wrapHeaderText: boolean;
75
+ menuButtonRef: React.RefObject<HTMLElement>;
76
+ menuToggle: (e: React.MouseEvent<HTMLElement>) => void;
77
+ toggleAdvancedSeach: (value: boolean) => void;
78
+ };
79
+ export interface SmartGridColumnDefinition {
80
+ field: string;
81
+ headerName?: string;
82
+ column_name?: string;
83
+ label?: string;
84
+ width?: number;
85
+ minWidth?: number;
86
+ maxWidth?: number;
87
+ hide?: boolean;
88
+ hidden?: boolean;
89
+ pinned?: "left" | "right" | boolean | null;
90
+ is_frozen?: boolean;
91
+ children?: SmartGridColumnDefinition[];
92
+ parent_id?: string | number;
93
+ type?: string;
94
+ cellDataType?: string;
95
+ valueFormatter?: (params: SmartGridValueFormatterParams) => string;
96
+ valueGetter?: (params: SmartGridValueGetterParams) => unknown;
97
+ leftTotalWidth?: number;
98
+ originalWidth?: number;
99
+ isAutoWidth?: boolean;
100
+ filterable?: boolean;
101
+ isSortable?: boolean;
102
+ is_sortable?: boolean;
103
+ resizable?: boolean;
104
+ align?: "left" | "center" | "right";
105
+ cellRenderer?: string | ((params: SmartGridCellRenderer) => JSX.Element);
106
+ cellRendererParams?: SmartGridCellRendererParams;
107
+ cellClassName?: string;
108
+ cellStyle?: {
109
+ textAlign?: "left" | "center" | "right";
110
+ [key: string]: unknown;
111
+ };
112
+ autoHeight?: boolean;
113
+ wrapHeaderText?: boolean;
114
+ editable?: boolean;
115
+ is_editable?: boolean;
116
+ is_disabled?: boolean;
117
+ is_searchable?: boolean;
118
+ isSearchable?: boolean;
119
+ advanceSearchEnabled?: boolean;
120
+ sortable?: boolean;
121
+ rowGroup?: boolean;
122
+ enableRowGroup?: boolean;
123
+ rowGroupIndex?: number;
124
+ aggFunc?: string;
125
+ columnGroupShow?: "open" | "closed";
126
+ originalIndex?: number;
127
+ parentColumns?: string[];
128
+ hasChildren?: boolean;
129
+ hasAnyFrozenChildren?: boolean;
130
+ hasAnyRightPinnedChildren?: boolean;
131
+ isChildWithoutParent?: boolean;
132
+ colorClass?: string;
133
+ isLeaf?: boolean;
134
+ isStandalone?: boolean;
135
+ isWithEmptyHeaderName?: boolean;
136
+ isParentWithChildEmptyHeaderName?: boolean;
137
+ path?: string[];
138
+ parentField?: string | null;
139
+ originalFields?: string[];
140
+ colId?: string;
141
+ colSpan?: number;
142
+ rowSpan?: number;
143
+ comparator?: (
144
+ valueA: unknown,
145
+ valueB: unknown,
146
+ nodeA: unknown,
147
+ nodeB: unknown,
148
+ sortModel: SmartGridSortModel
149
+ ) => number;
150
+ headerTooltip?: string;
151
+ filter?: string | boolean;
152
+ filterParams?: {
153
+ filterOptions?: string[];
154
+ textCustomComparator?: (
155
+ filter: string,
156
+ value: unknown,
157
+ filterText: string
158
+ ) => boolean;
159
+ numberCustomComparator?: (filter: number, value: unknown) => boolean;
160
+ dateCustomComparator?: (
161
+ filterLocalDateAtMidnight: Date,
162
+ cellValue: string
163
+ ) => number;
164
+ comparator?: (filterValue: unknown, cellValue: unknown) => boolean;
165
+ [key: string]: unknown;
166
+ };
167
+ order_of_display?: number;
168
+ is_hidden?: boolean;
169
+ formatter?: string | null;
170
+ accessor?: string;
171
+ id?: string;
172
+ required?: boolean;
173
+ sub_headers?: SmartGridColumnDefinition[];
174
+ extra?: {
175
+ width?: number;
176
+ is_grouping_key?: boolean;
177
+ is_disabled?: boolean;
178
+ isDisabled?: boolean;
179
+ columnGroupShow?: "open" | "closed";
180
+ [key: string]: unknown;
181
+ };
182
+ headerComponent: React.FC<SmartGridHeaderStyleParams>;
183
+ headerStyle?: (params: SmartGridHeaderStyleParams) => CSSProperties;
184
+ [key: string]: unknown;
185
+ }
@@ -0,0 +1,62 @@
1
+ import { SmartGridRowData } from "./api.type";
2
+
3
+ export type SmartGridSortDirection = "asc" | "desc" | "none";
4
+
5
+ export type SmartGridUpdateData = {
6
+ data: SmartGridRowData;
7
+ setData: (data: SmartGridRowData) => void;
8
+ setDataValue: (field: string, value: unknown, callback?: () => void) => void;
9
+ };
10
+
11
+ export interface SmartGridRowNode extends SmartGridUpdateData {
12
+ id: string | number;
13
+ childIndex?: number;
14
+ selected: boolean;
15
+ rowIndex?: number;
16
+ absoluteRowIndex?: number;
17
+ originalData?: SmartGridRowData;
18
+ rowHeight?: number;
19
+ setSelected: (selected: boolean, clearSelection?: boolean) => void;
20
+ isGroup?: () => boolean;
21
+ }
22
+
23
+ export interface SmartGridOldSortModel {
24
+ colId: string;
25
+ sort: SmartGridSortDirection;
26
+ }
27
+
28
+ export interface SmartGridNewSortModel {
29
+ column: string;
30
+ order: string;
31
+ }
32
+
33
+ export type SmartGridSortModel =
34
+ | SmartGridOldSortModel
35
+ | SmartGridNewSortModel
36
+ | null;
37
+
38
+ export type SmartGridStringFilter = {
39
+ column: string;
40
+ pattern: string;
41
+ search_type: string;
42
+ operator?: string;
43
+ };
44
+
45
+ export type SmartGridRangeFilter = {
46
+ column: string;
47
+ min_val: number;
48
+ max_val: number;
49
+ search_type: string;
50
+ operator?: string;
51
+ };
52
+
53
+ export interface SmartGridFilterModel {
54
+ pattern: string;
55
+ search_type: string;
56
+ column?: string;
57
+ field?: string;
58
+ min_val?: number;
59
+ max_val?: number;
60
+ type?: string;
61
+ operator?: string;
62
+ }
@@ -0,0 +1,7 @@
1
+ // Export all types from all type files using wildcard exports
2
+ export * from "./api.type";
3
+ export * from "./cache.type";
4
+ export * from "./columns.type";
5
+ export * from "./common.type";
6
+ export * from "./reducer.type";
7
+ export * from "./table.type";
@@ -0,0 +1,3 @@
1
+ export interface SmartGridStateContext {
2
+ [key: string]: any;
3
+ }
@@ -0,0 +1,5 @@
1
+ declare module "*.svg" {
2
+ import React from "react";
3
+ const SVGComponent: React.FC<React.SVGProps<SVGSVGElement>>;
4
+ export default SVGComponent;
5
+ }
@@ -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
+ };