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.
- package/README.md +152 -16
- package/dist/components/IATable/types/api.type.ts +272 -0
- package/dist/components/IATable/types/cache.type.ts +65 -0
- package/dist/components/IATable/types/columns.type.ts +185 -0
- package/dist/components/IATable/types/common.type.ts +62 -0
- package/dist/components/IATable/types/index.type.ts +7 -0
- package/dist/components/IATable/types/reducer.type.ts +3 -0
- package/dist/components/IATable/types/svg.d.ts +5 -0
- package/dist/components/IATable/types/table.type.ts +200 -0
- package/dist/index.d.ts +12 -270
- package/dist/index.js +8874 -9023
- package/package.json +26 -5
package/README.md
CHANGED
|
@@ -10,6 +10,158 @@ A powerful, feature-rich React data table component for enterprise applications.
|
|
|
10
10
|
npm install --save ia-table
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
## Development Setup
|
|
14
|
+
|
|
15
|
+
If you're contributing to this project or have cloned the repository, follow these steps:
|
|
16
|
+
|
|
17
|
+
### 1. Install Dependencies
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 2. ESLint Configuration
|
|
24
|
+
|
|
25
|
+
This project uses **ESLint 9+ with Flat Config** format. The configuration is in `eslint.config.js`.
|
|
26
|
+
|
|
27
|
+
#### Running ESLint
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Check for linting errors
|
|
31
|
+
npm run lint
|
|
32
|
+
|
|
33
|
+
# Auto-fix linting errors
|
|
34
|
+
npm run lint:fix
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### IDE Integration
|
|
38
|
+
|
|
39
|
+
**VS Code:**
|
|
40
|
+
|
|
41
|
+
1. Install the [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
42
|
+
2. Install the [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
43
|
+
3. Create `.vscode/settings.json` in the project root with:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"editor.formatOnSave": true,
|
|
48
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
49
|
+
"editor.codeActionsOnSave": {
|
|
50
|
+
"source.fixAll.eslint": "explicit"
|
|
51
|
+
},
|
|
52
|
+
"[javascript]": {
|
|
53
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
54
|
+
},
|
|
55
|
+
"[javascriptreact]": {
|
|
56
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
57
|
+
},
|
|
58
|
+
"[typescript]": {
|
|
59
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
60
|
+
},
|
|
61
|
+
"[typescriptreact]": {
|
|
62
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
63
|
+
},
|
|
64
|
+
"[json]": {
|
|
65
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
66
|
+
},
|
|
67
|
+
"eslint.validate": [
|
|
68
|
+
"javascript",
|
|
69
|
+
"javascriptreact",
|
|
70
|
+
"typescript",
|
|
71
|
+
"typescriptreact"
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This configuration enables:
|
|
77
|
+
|
|
78
|
+
- Auto-format on save with Prettier
|
|
79
|
+
- Auto-fix ESLint errors on save
|
|
80
|
+
- Consistent formatting across all file types
|
|
81
|
+
|
|
82
|
+
**Other IDEs:**
|
|
83
|
+
|
|
84
|
+
- Most modern IDEs support ESLint flat config format
|
|
85
|
+
- Ensure your IDE's ESLint plugin is updated to the latest version
|
|
86
|
+
|
|
87
|
+
#### What's Configured
|
|
88
|
+
|
|
89
|
+
- **React Hooks Rules**: Enforces React hooks best practices
|
|
90
|
+
- **React Refresh**: Warns about components that can't be hot-reloaded
|
|
91
|
+
- **React Compiler**: Optimizations for React 19+
|
|
92
|
+
- **TypeScript Support**: Full TypeScript linting with `typescript-eslint`
|
|
93
|
+
- **Ignored Paths**: Automatically ignores `dist/`, `build/`, `node_modules/`, config files, and example files
|
|
94
|
+
|
|
95
|
+
#### Customizing Rules
|
|
96
|
+
|
|
97
|
+
To modify linting rules, edit `eslint.config.js`:
|
|
98
|
+
|
|
99
|
+
```javascript
|
|
100
|
+
{
|
|
101
|
+
rules: {
|
|
102
|
+
"your-rule": "error", // or "warn" or "off"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 3. Prettier Configuration
|
|
108
|
+
|
|
109
|
+
This project uses **Prettier** for consistent code formatting across the team.
|
|
110
|
+
|
|
111
|
+
#### Running Prettier
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Format all files
|
|
115
|
+
npm run format
|
|
116
|
+
|
|
117
|
+
# Check if files are formatted (useful for CI)
|
|
118
|
+
npm run format:check
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### IDE Integration
|
|
122
|
+
|
|
123
|
+
The `.vscode/settings.json` configuration shown in the ESLint section above already includes Prettier integration. No additional setup needed if you've already configured VS Code for ESLint.
|
|
124
|
+
|
|
125
|
+
**Other IDEs:**
|
|
126
|
+
|
|
127
|
+
- Most modern IDEs have Prettier plugins available
|
|
128
|
+
- Configuration is automatically detected from `.prettierrc`
|
|
129
|
+
|
|
130
|
+
#### ESLint + Prettier Integration
|
|
131
|
+
|
|
132
|
+
The project is configured so that:
|
|
133
|
+
|
|
134
|
+
- **ESLint** handles code quality rules (bugs, best practices)
|
|
135
|
+
- **Prettier** handles code formatting (spacing, line breaks, quotes)
|
|
136
|
+
- `eslint-config-prettier` disables conflicting ESLint formatting rules
|
|
137
|
+
|
|
138
|
+
### 4. Available Scripts
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Development server
|
|
142
|
+
npm start
|
|
143
|
+
|
|
144
|
+
# Build library for production
|
|
145
|
+
npm run build:lib
|
|
146
|
+
|
|
147
|
+
# Run tests
|
|
148
|
+
npm test
|
|
149
|
+
|
|
150
|
+
# Linting
|
|
151
|
+
npm run lint # Check for linting errors
|
|
152
|
+
npm run lint:fix # Auto-fix linting errors
|
|
153
|
+
|
|
154
|
+
# Formatting
|
|
155
|
+
npm run format # Format all files with Prettier
|
|
156
|
+
npm run format:check # Check if files are formatted
|
|
157
|
+
|
|
158
|
+
# Storybook for component development
|
|
159
|
+
npm run storybook
|
|
160
|
+
|
|
161
|
+
# Build Storybook
|
|
162
|
+
npm run build:storybook
|
|
163
|
+
```
|
|
164
|
+
|
|
13
165
|
## Quick Start
|
|
14
166
|
|
|
15
167
|
```jsx
|
|
@@ -40,14 +192,12 @@ const App = () => {
|
|
|
40
192
|
### Core Table Features
|
|
41
193
|
|
|
42
194
|
- **Data Display**:
|
|
43
|
-
|
|
44
195
|
- Renders tabular data with fully customizable columns
|
|
45
196
|
- Supports complex data objects and nested properties
|
|
46
197
|
- Handles large datasets efficiently with virtualization
|
|
47
198
|
- Displays empty state and loading indicators
|
|
48
199
|
|
|
49
200
|
- **Responsive Layout**:
|
|
50
|
-
|
|
51
201
|
- Adapts to container size with proper overflow handling
|
|
52
202
|
- Horizontal scrolling for tables wider than their container
|
|
53
203
|
- Maintains header alignment with body cells during scroll
|
|
@@ -64,7 +214,6 @@ const App = () => {
|
|
|
64
214
|
### Data Management
|
|
65
215
|
|
|
66
216
|
- **Sorting**:
|
|
67
|
-
|
|
68
217
|
- Sort data by any column in ascending or descending order
|
|
69
218
|
- Visual indicators for sort direction
|
|
70
219
|
- Support for custom sort functions
|
|
@@ -72,7 +221,6 @@ const App = () => {
|
|
|
72
221
|
- Maintains sort state between renders
|
|
73
222
|
|
|
74
223
|
- **Pagination**:
|
|
75
|
-
|
|
76
224
|
- Built-in pagination with customizable page size
|
|
77
225
|
- Page navigation controls (previous, next, first, last)
|
|
78
226
|
- Dynamic calculation of total pages
|
|
@@ -92,7 +240,6 @@ const App = () => {
|
|
|
92
240
|
### Row Features
|
|
93
241
|
|
|
94
242
|
- **Row Selection**:
|
|
95
|
-
|
|
96
243
|
- Single or multi-row selection with checkbox support
|
|
97
244
|
- Select all/deselect all functionality
|
|
98
245
|
- Selection persistence between page changes
|
|
@@ -101,7 +248,6 @@ const App = () => {
|
|
|
101
248
|
- Access to selection data through context
|
|
102
249
|
|
|
103
250
|
- **Row Expansion**:
|
|
104
|
-
|
|
105
251
|
- Expandable rows with custom content
|
|
106
252
|
- Expand/collapse indicators with animation
|
|
107
253
|
- Customizable expanded content renderer
|
|
@@ -109,7 +255,6 @@ const App = () => {
|
|
|
109
255
|
- Context-aware expansion tracking
|
|
110
256
|
|
|
111
257
|
- **Row Grouping**:
|
|
112
|
-
|
|
113
258
|
- Support for hierarchical data with parent-child relationships
|
|
114
259
|
- Configurable grouping fields
|
|
115
260
|
- Visual indicators for grouped data
|
|
@@ -128,7 +273,6 @@ const App = () => {
|
|
|
128
273
|
### UI Components
|
|
129
274
|
|
|
130
275
|
- **Table Header**:
|
|
131
|
-
|
|
132
276
|
- Customizable with sort indicators
|
|
133
277
|
- Support for multi-level column groups
|
|
134
278
|
- Column resizing via drag handles
|
|
@@ -137,7 +281,6 @@ const App = () => {
|
|
|
137
281
|
- Support for custom header cell renderers
|
|
138
282
|
|
|
139
283
|
- **Table Body**:
|
|
140
|
-
|
|
141
284
|
- Efficient rendering with virtualization for large datasets
|
|
142
285
|
- Custom cell renderers for complex content
|
|
143
286
|
- Row and cell event handlers (click, hover, etc.)
|
|
@@ -146,7 +289,6 @@ const App = () => {
|
|
|
146
289
|
- Type-aware cell formatting
|
|
147
290
|
|
|
148
291
|
- **Table Footer**:
|
|
149
|
-
|
|
150
292
|
- Optional with pagination controls
|
|
151
293
|
- Summary row capabilities
|
|
152
294
|
- Aggregate function support (sum, average, count, etc.)
|
|
@@ -154,7 +296,6 @@ const App = () => {
|
|
|
154
296
|
- Custom footer renderers
|
|
155
297
|
|
|
156
298
|
- **Toolbar**:
|
|
157
|
-
|
|
158
299
|
- Search functionality with debounced input
|
|
159
300
|
- Column visibility toggle
|
|
160
301
|
- Export options (CSV, Excel, etc.)
|
|
@@ -162,7 +303,6 @@ const App = () => {
|
|
|
162
303
|
- Responsive design for mobile compatibility
|
|
163
304
|
|
|
164
305
|
- **Column Toggle Menu**:
|
|
165
|
-
|
|
166
306
|
- Show/hide columns dynamically
|
|
167
307
|
- Drag and drop column reordering
|
|
168
308
|
- Reset to default option
|
|
@@ -180,7 +320,6 @@ const App = () => {
|
|
|
180
320
|
### Visual Customization
|
|
181
321
|
|
|
182
322
|
- **Column Resizing**:
|
|
183
|
-
|
|
184
323
|
- Drag handles to adjust column widths
|
|
185
324
|
- Visual feedback during resize operation
|
|
186
325
|
- Minimum/maximum width constraints
|
|
@@ -188,7 +327,6 @@ const App = () => {
|
|
|
188
327
|
- Persist column width preferences
|
|
189
328
|
|
|
190
329
|
- **Styling**:
|
|
191
|
-
|
|
192
330
|
- Comprehensive CSS for enterprise appearance
|
|
193
331
|
- Support for theming and custom styles
|
|
194
332
|
- Responsive design principles
|
|
@@ -206,7 +344,6 @@ const App = () => {
|
|
|
206
344
|
### Performance Optimizations
|
|
207
345
|
|
|
208
346
|
- **Virtualized Rendering**:
|
|
209
|
-
|
|
210
347
|
- Only renders visible rows for large datasets
|
|
211
348
|
- Significantly improves performance for tables with thousands of rows
|
|
212
349
|
- Dynamic buffer size calculation
|
|
@@ -214,7 +351,6 @@ const App = () => {
|
|
|
214
351
|
- Efficient DOM reuse
|
|
215
352
|
|
|
216
353
|
- **Memoization**:
|
|
217
|
-
|
|
218
354
|
- Efficient re-rendering using React.useMemo
|
|
219
355
|
- Prevents unnecessary calculations during renders
|
|
220
356
|
- Smart component updates based on changed props
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
// SmartGrid API Type Definitions
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
SmartGridInfiniteCache,
|
|
5
|
+
SmartGridInfiniteRowModel,
|
|
6
|
+
} from "./cache.type";
|
|
7
|
+
import { SmartGridColumnDefinition } from "./columns.type";
|
|
8
|
+
import {
|
|
9
|
+
SmartGridFilterModel,
|
|
10
|
+
SmartGridRowNode,
|
|
11
|
+
SmartGridSortDirection,
|
|
12
|
+
SmartGridSortModel,
|
|
13
|
+
SmartGridUpdateData,
|
|
14
|
+
} from "./common.type";
|
|
15
|
+
import { SmartGridStateContext } from "./reducer.type";
|
|
16
|
+
|
|
17
|
+
export type SmartGridModelType = "normal" | "serverSide" | "infinite";
|
|
18
|
+
|
|
19
|
+
export type SmartGridPinnedType = "left" | "right" | null;
|
|
20
|
+
|
|
21
|
+
export type SmartGridFloatingType = "top" | "bottom" | null;
|
|
22
|
+
|
|
23
|
+
export interface SmartGridRowData {
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
id?: string | number;
|
|
26
|
+
isChildRow?: boolean;
|
|
27
|
+
isChildGroup?: boolean;
|
|
28
|
+
childIndex?: number;
|
|
29
|
+
groupingLevel?: number;
|
|
30
|
+
level?: number;
|
|
31
|
+
parentRowIndex?: number;
|
|
32
|
+
parentRowData?: SmartGridRowData;
|
|
33
|
+
__parentPath?: string;
|
|
34
|
+
_rowHeight?: number;
|
|
35
|
+
_isPinnedTop?: boolean;
|
|
36
|
+
_isPinnedBottom?: boolean;
|
|
37
|
+
__isAggregationRow?: boolean;
|
|
38
|
+
__parentId?: string | number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface SmartGridColumnState {
|
|
42
|
+
colId: string;
|
|
43
|
+
hide: boolean;
|
|
44
|
+
width: number;
|
|
45
|
+
sort: SmartGridSortDirection | null;
|
|
46
|
+
filter: SmartGridFilterModel | null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface SmartGridPaginationModel {
|
|
50
|
+
currentPage: number;
|
|
51
|
+
pageSize: number;
|
|
52
|
+
totalPages: number;
|
|
53
|
+
totalRecords: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface SmartGridDisplayedRowNode extends SmartGridRowNode {
|
|
57
|
+
rowIndex: number;
|
|
58
|
+
absoluteRowIndex: number;
|
|
59
|
+
originalData: SmartGridRowData;
|
|
60
|
+
rowHeight?: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface SmartGridCacheState {
|
|
64
|
+
blockCount: number;
|
|
65
|
+
cache?: SmartGridInfiniteCache;
|
|
66
|
+
lastRowKnown: boolean;
|
|
67
|
+
rowCount: number;
|
|
68
|
+
status: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface SmartGridTableModel {
|
|
72
|
+
getData: () => SmartGridRowData[];
|
|
73
|
+
modelRef?: {
|
|
74
|
+
current?: SmartGridInfiniteRowModel;
|
|
75
|
+
};
|
|
76
|
+
infiniteCache: SmartGridInfiniteCache | null;
|
|
77
|
+
getColumnDefs: () => SmartGridColumnDefinition[];
|
|
78
|
+
getSortModel: () => SmartGridSortModel[];
|
|
79
|
+
getFilterModel: () => SmartGridFilterModel;
|
|
80
|
+
getType: () => SmartGridModelType;
|
|
81
|
+
getRowsToDisplay: () => number;
|
|
82
|
+
forEachNode: (
|
|
83
|
+
callback: (node: SmartGridRowNode, index: number) => void
|
|
84
|
+
) => void;
|
|
85
|
+
getRowNode: (id: string | number) => SmartGridRowNode | null;
|
|
86
|
+
getSelectedRows: () => SmartGridRowData[];
|
|
87
|
+
getPaginationModel: () => SmartGridPaginationModel;
|
|
88
|
+
getColumnState: () => SmartGridColumnState[];
|
|
89
|
+
rowsToDisplay: SmartGridRowData[];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface SmartGridDisplayedColumn {
|
|
93
|
+
colDef: SmartGridColumnDefinition;
|
|
94
|
+
colId: string;
|
|
95
|
+
getColId: () => string;
|
|
96
|
+
isVisible: () => boolean;
|
|
97
|
+
isPinned: () => SmartGridPinnedType;
|
|
98
|
+
label: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface SmartGridSelectedCell {
|
|
102
|
+
colIndex: number;
|
|
103
|
+
column: SmartGridColumnDefinition;
|
|
104
|
+
data: SmartGridRowData;
|
|
105
|
+
field: string;
|
|
106
|
+
rowId: string | number;
|
|
107
|
+
rowIndex: number;
|
|
108
|
+
value: unknown;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface SmartGridFocusedCell extends SmartGridSelectedCell {
|
|
112
|
+
floating: SmartGridFloatingType;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface SmartGridRefreshOptions {
|
|
116
|
+
purge?: boolean;
|
|
117
|
+
resetPage?: boolean;
|
|
118
|
+
userInitiated?: boolean;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface SmartGridNotification {
|
|
122
|
+
message: string;
|
|
123
|
+
type?: "success" | "error" | "warning" | "info";
|
|
124
|
+
duration?: number;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface SmartGridParamsNode {
|
|
128
|
+
rowIndex: number;
|
|
129
|
+
data: SmartGridRowData;
|
|
130
|
+
api: SmartGridAPI;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface SmartGridDisplayedRowAtIndex {
|
|
134
|
+
data: SmartGridRowData;
|
|
135
|
+
rowIndex: number;
|
|
136
|
+
node: SmartGridParamsNode;
|
|
137
|
+
api: SmartGridAPI;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface SmartGridCachedBlockData {
|
|
141
|
+
[blockId: string]: SmartGridRowData[];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface SmartGridCellValueChangedParams {
|
|
145
|
+
colDef: SmartGridColumnDefinition;
|
|
146
|
+
column: SmartGridColumnDefinition;
|
|
147
|
+
data: SmartGridRowData;
|
|
148
|
+
newValue: unknown;
|
|
149
|
+
node: {
|
|
150
|
+
data: SmartGridRowData;
|
|
151
|
+
id: string | number;
|
|
152
|
+
level: number;
|
|
153
|
+
parent?: SmartGridUpdateData;
|
|
154
|
+
rowIndex: number;
|
|
155
|
+
};
|
|
156
|
+
value: unknown;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface SmartGridCheckConfiguration {
|
|
160
|
+
checkedRows?: string[];
|
|
161
|
+
unCheckedRows?: string[];
|
|
162
|
+
checkAll?: boolean;
|
|
163
|
+
searchColumns?: {
|
|
164
|
+
[key: string]: SmartGridFilterModel[];
|
|
165
|
+
};
|
|
166
|
+
unCheckAll?: boolean;
|
|
167
|
+
}
|
|
168
|
+
export interface SmartGridOptions {
|
|
169
|
+
[key: string]: unknown;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface SmartGridGetRowDataParams {
|
|
173
|
+
data: SmartGridRowData;
|
|
174
|
+
rowIndex: number;
|
|
175
|
+
node: SmartGridParamsNode;
|
|
176
|
+
api: SmartGridAPI;
|
|
177
|
+
}
|
|
178
|
+
export interface SmartGridDisptach {
|
|
179
|
+
type: string;
|
|
180
|
+
payload?: unknown;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface SmartGridAPI {
|
|
184
|
+
getInfiniteRowModel: () => SmartGridInfiniteRowModel | null;
|
|
185
|
+
getInfiniteCache: () => SmartGridInfiniteCache | null;
|
|
186
|
+
getModel: () => SmartGridTableModel;
|
|
187
|
+
onCellValueChanged: (params: SmartGridCellValueChangedParams) => void;
|
|
188
|
+
getPrevAction: () => string;
|
|
189
|
+
setPrevAction: (value: string) => void;
|
|
190
|
+
getCheckConfiguration: () => SmartGridCheckConfiguration[];
|
|
191
|
+
setCheckConfiguration: (config: SmartGridCheckConfiguration[]) => void;
|
|
192
|
+
addToCheckConfiguration: (item: SmartGridCheckConfiguration) => void;
|
|
193
|
+
getIsSelectAllRecords: () => boolean;
|
|
194
|
+
setIsSelectAllRecords: (value: boolean) => void;
|
|
195
|
+
getSelectedRows: () => SmartGridRowData[];
|
|
196
|
+
setSelectedRows: (rowIds: (string | number)[]) => void;
|
|
197
|
+
clearSelection: () => void;
|
|
198
|
+
selectAll: () => void;
|
|
199
|
+
refreshCells: () => void;
|
|
200
|
+
getCache: () => SmartGridInfiniteCache | null;
|
|
201
|
+
getCacheState: () => SmartGridCacheState | null;
|
|
202
|
+
getInfiniteCacheInstance: () => SmartGridInfiniteCache | undefined;
|
|
203
|
+
refreshServerSideStore: (options?: SmartGridRefreshOptions) => void;
|
|
204
|
+
getCachedBlockData: () => SmartGridCachedBlockData;
|
|
205
|
+
logCacheSummary: () => void | null;
|
|
206
|
+
getCachedRowById: (id: string | number) => SmartGridRowData | null;
|
|
207
|
+
getRowNode: (key: string | number) => Partial<SmartGridRowNode>;
|
|
208
|
+
setVisibleRange: (startRow: number, endRow: number) => void;
|
|
209
|
+
refreshCache: (options?: SmartGridRefreshOptions) => boolean;
|
|
210
|
+
deselectAll: () => void;
|
|
211
|
+
getRenderedNodes: () => SmartGridDisplayedRowNode[];
|
|
212
|
+
gridOptionsWrapper: {
|
|
213
|
+
gridOptions: SmartGridOptions;
|
|
214
|
+
};
|
|
215
|
+
getDisplayedRowAtIndex: (
|
|
216
|
+
index: number,
|
|
217
|
+
wholeData?: SmartGridRowData[],
|
|
218
|
+
api?: Partial<SmartGridAPI>
|
|
219
|
+
) => SmartGridDisplayedRowAtIndex | null;
|
|
220
|
+
getTableWidth: () => number;
|
|
221
|
+
sizeColumnsToFit: () => void;
|
|
222
|
+
setRowData: (newData: SmartGridRowData[]) => boolean | void;
|
|
223
|
+
forEachNode: (
|
|
224
|
+
callback: (node: SmartGridRowNode, index: number) => void
|
|
225
|
+
) => void;
|
|
226
|
+
getColumnDefs: () => SmartGridColumnDefinition[];
|
|
227
|
+
getAllColumns: () => SmartGridColumnDefinition[];
|
|
228
|
+
setColumnDefs: (newColumns: SmartGridColumnDefinition) => void;
|
|
229
|
+
addEventListener: (event: string, listener: Function) => void;
|
|
230
|
+
removeEventListener: (event: string, listener: Function) => void;
|
|
231
|
+
getPinnedTopRow: () => SmartGridRowData[] | null;
|
|
232
|
+
setPinnedTopRowData: (rows: SmartGridRowData[]) => void;
|
|
233
|
+
getPinnedBottomRow: () => SmartGridRowData[] | null;
|
|
234
|
+
setPinnedBottomRowData: (rows: SmartGridRowData[]) => void;
|
|
235
|
+
getRowData: (
|
|
236
|
+
params: SmartGridGetRowDataParams,
|
|
237
|
+
columnName: string
|
|
238
|
+
) => string | number | boolean;
|
|
239
|
+
tableId: string;
|
|
240
|
+
getFocusedCell: () => SmartGridFocusedCell | null;
|
|
241
|
+
getSelectedCells: () => SmartGridSelectedCell[];
|
|
242
|
+
getAllDisplayedColumns: () => SmartGridDisplayedColumn[];
|
|
243
|
+
getDisplayedRowCount: () => number;
|
|
244
|
+
setFocusedCell: (
|
|
245
|
+
rowIndex: number,
|
|
246
|
+
colKey: SmartGridColumnDefinition | string | number,
|
|
247
|
+
floating?: SmartGridFloatingType
|
|
248
|
+
) => boolean;
|
|
249
|
+
ensureColumnVisible: (
|
|
250
|
+
colKey: SmartGridColumnDefinition | string | number
|
|
251
|
+
) => boolean;
|
|
252
|
+
getColumnByField: (fieldName: string) => SmartGridColumnDefinition | null;
|
|
253
|
+
getTableInstance: () =>
|
|
254
|
+
| {
|
|
255
|
+
current?: HTMLElement;
|
|
256
|
+
}
|
|
257
|
+
| undefined;
|
|
258
|
+
getFilterModel: () => SmartGridFilterModel;
|
|
259
|
+
setFilterModel: (field: string, rules: SmartGridFilterModel) => void;
|
|
260
|
+
getTableDispatcher: () => (action: SmartGridDisptach) => void;
|
|
261
|
+
getTableStateContext: () => SmartGridStateContext;
|
|
262
|
+
showNotification: (notification: SmartGridNotification) => void;
|
|
263
|
+
hideNotification: () => void;
|
|
264
|
+
applySearch: () => void;
|
|
265
|
+
getCurrentPageData: () => SmartGridRowData[];
|
|
266
|
+
getWholeTableData: () => SmartGridRowData[];
|
|
267
|
+
flashCells: () => void;
|
|
268
|
+
redrawRows: () => void;
|
|
269
|
+
refreshClientSideRowModel: () => void;
|
|
270
|
+
resetRecentSearchChanges: () => void;
|
|
271
|
+
onFilterChanged: () => void;
|
|
272
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { SmartGridRowData } from "./api.type";
|
|
2
|
+
|
|
3
|
+
export type SmartGridCacheAnalytics = {
|
|
4
|
+
blockEvictions: number;
|
|
5
|
+
blockLoadTimestamps: number[];
|
|
6
|
+
blockLoads: number;
|
|
7
|
+
bytesLoaded: number;
|
|
8
|
+
cachePurges: number;
|
|
9
|
+
cacheRefreshes: number;
|
|
10
|
+
hits: number;
|
|
11
|
+
lastBlockLoadTime: number;
|
|
12
|
+
misses: number;
|
|
13
|
+
startTime: number;
|
|
14
|
+
totalBlockLoadTime: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type SmartGridCacheBlockParams = Record<string, unknown>;
|
|
18
|
+
|
|
19
|
+
export type SmartGridCacheBlock = {
|
|
20
|
+
endRow: number;
|
|
21
|
+
id: number;
|
|
22
|
+
infiniteCache: SmartGridInfiniteCache;
|
|
23
|
+
lastAccessed: number;
|
|
24
|
+
loadStartedAt: number;
|
|
25
|
+
params: SmartGridCacheBlockParams;
|
|
26
|
+
parent: SmartGridInfiniteCache | null;
|
|
27
|
+
parentCache: SmartGridInfiniteCache | null;
|
|
28
|
+
rowNodes: {
|
|
29
|
+
data: SmartGridRowData;
|
|
30
|
+
id: number;
|
|
31
|
+
rowIndex: number;
|
|
32
|
+
}[];
|
|
33
|
+
rows: unknown;
|
|
34
|
+
startRow: number;
|
|
35
|
+
state: string;
|
|
36
|
+
version: number;
|
|
37
|
+
_inactiveForPageTransition: boolean;
|
|
38
|
+
_processingInProgress: boolean;
|
|
39
|
+
_targetPage: number;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export interface SmartGridInfiniteCache {
|
|
43
|
+
analytics: SmartGridCacheAnalytics;
|
|
44
|
+
blockCount: number;
|
|
45
|
+
blocks: Record<number, SmartGridCacheBlock>;
|
|
46
|
+
eventListeners: Record<"cacheUpdated", Function[]>;
|
|
47
|
+
lastRequestedPage: number;
|
|
48
|
+
lastRowIndexKnown: boolean;
|
|
49
|
+
params: SmartGridInfiniteCacheParams;
|
|
50
|
+
rowCount: number;
|
|
51
|
+
_currentRequestedPage: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface SmartGridInfiniteRowModel {
|
|
55
|
+
infiniteCache?: SmartGridInfiniteCache;
|
|
56
|
+
setViewportRange?: (startRow: number, endRow: number) => void;
|
|
57
|
+
logCacheSummary?: () => void;
|
|
58
|
+
[key: string]: unknown;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface SmartGridInfiniteCacheParams {
|
|
62
|
+
datasource: {
|
|
63
|
+
getWholeData: () => SmartGridRowData[];
|
|
64
|
+
};
|
|
65
|
+
}
|