ia-table 0.1.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.
package/README.md ADDED
@@ -0,0 +1,431 @@
1
+ # ia-table
2
+
3
+ A powerful, feature-rich React data table component for enterprise applications.
4
+
5
+ [![NPM](https://img.shields.io/npm/v/ia-table.svg)](https://www.npmjs.com/package/ia-table)
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install --save ia-table
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```jsx
16
+ import { IATable } from 'ia-table';
17
+ import 'ia-table/dist/style.css'; // Import styles
18
+
19
+ const App = () => {
20
+ const data = [
21
+ { id: 1, name: 'Product A', price: 100 },
22
+ { id: 2, name: 'Product B', price: 200 },
23
+ ];
24
+
25
+ const columns = [
26
+ { field: 'id', headerName: 'ID' },
27
+ { field: 'name', headerName: 'Name' },
28
+ { field: 'price', headerName: 'Price' },
29
+ ];
30
+
31
+ return (
32
+ <IATable
33
+ data={data}
34
+ columns={columns}
35
+ height="400px"
36
+ uniqueIdField="id"
37
+ />
38
+ );
39
+ };
40
+ ```
41
+
42
+ For detailed documentation on publishing this package, see [PUBLISHING.md](./PUBLISHING.md).
43
+
44
+ ## Features
45
+
46
+ ### Core Table Features
47
+
48
+ - **Data Display**:
49
+
50
+ - Renders tabular data with fully customizable columns
51
+ - Supports complex data objects and nested properties
52
+ - Handles large datasets efficiently with virtualization
53
+ - Displays empty state and loading indicators
54
+
55
+ - **Responsive Layout**:
56
+
57
+ - Adapts to container size with proper overflow handling
58
+ - Horizontal scrolling for tables wider than their container
59
+ - Maintains header alignment with body cells during scroll
60
+ - Supports fixed height or auto-expanding layouts
61
+
62
+ - **Dynamic Column Configuration**:
63
+ - Configure width, alignment, sorting, filtering, and resizing per column
64
+ - Support for complex column hierarchies with nested column groups
65
+ - Custom cell renderers for advanced content formatting
66
+ - Header customization with custom renderers
67
+ - Column freezing/pinning for better navigation of wide tables
68
+ - Show/hide columns via the column toggle menu
69
+
70
+ ### Data Management
71
+
72
+ - **Sorting**:
73
+
74
+ - Sort data by any column in ascending or descending order
75
+ - Visual indicators for sort direction
76
+ - Support for custom sort functions
77
+ - Multi-column sorting capability
78
+ - Maintains sort state between renders
79
+
80
+ - **Pagination**:
81
+
82
+ - Built-in pagination with customizable page size
83
+ - Page navigation controls (previous, next, first, last)
84
+ - Dynamic calculation of total pages
85
+ - Efficient page switching without re-rendering the entire table
86
+ - Customizable page size options
87
+
88
+ - **Filtering**:
89
+ - Global search functionality across all columns or specific columns
90
+ - Column-specific filtering with custom filter inputs
91
+ - Advanced filter panel with multiple filter conditions
92
+ - Filter operators include: contains, equals, startsWith, endsWith, etc.
93
+ - Support for numeric filters (greater than, less than)
94
+ - Date filtering capabilities
95
+ - Boolean filters (is/is not)
96
+ - Empty/not empty filters
97
+
98
+ ### Row Features
99
+
100
+ - **Row Selection**:
101
+
102
+ - Single or multi-row selection with checkbox support
103
+ - Select all/deselect all functionality
104
+ - Selection persistence between page changes
105
+ - Selection state callbacks for external state management
106
+ - Visual indication of selected rows
107
+ - Access to selection data through context
108
+
109
+ - **Row Expansion**:
110
+
111
+ - Expandable rows with custom content
112
+ - Expand/collapse indicators with animation
113
+ - Customizable expanded content renderer
114
+ - Independent expansion state for each row
115
+ - Context-aware expansion tracking
116
+
117
+ - **Row Grouping**:
118
+
119
+ - Support for hierarchical data with parent-child relationships
120
+ - Configurable grouping fields
121
+ - Visual indicators for grouped data
122
+ - Expand/collapse functionality for group items
123
+ - Custom renderers for group rows
124
+ - Supports multiple levels of nesting
125
+
126
+ - **Row Virtualization**:
127
+ - Performance optimization for large datasets (>100 rows)
128
+ - Only renders visible rows and a small buffer
129
+ - Seamless scrolling through thousands of rows
130
+ - Dynamic height calculation for varying row heights
131
+ - Memory efficient for very large datasets
132
+ - Maintains scroll position during updates
133
+
134
+ ### UI Components
135
+
136
+ - **Table Header**:
137
+
138
+ - Customizable with sort indicators
139
+ - Support for multi-level column groups
140
+ - Column resizing via drag handles
141
+ - Fixed positioning during scroll
142
+ - Context menu for column operations
143
+ - Support for custom header cell renderers
144
+
145
+ - **Table Body**:
146
+
147
+ - Efficient rendering with virtualization for large datasets
148
+ - Custom cell renderers for complex content
149
+ - Row and cell event handlers (click, hover, etc.)
150
+ - Support for keyboard navigation
151
+ - Proper handling of null/undefined values
152
+ - Type-aware cell formatting
153
+
154
+ - **Table Footer**:
155
+
156
+ - Optional with pagination controls
157
+ - Summary row capabilities
158
+ - Aggregate function support (sum, average, count, etc.)
159
+ - Fixed positioning for easy access
160
+ - Custom footer renderers
161
+
162
+ - **Toolbar**:
163
+
164
+ - Search functionality with debounced input
165
+ - Column visibility toggle
166
+ - Export options (CSV, Excel, etc.)
167
+ - Custom action buttons
168
+ - Responsive design for mobile compatibility
169
+
170
+ - **Column Toggle Menu**:
171
+
172
+ - Show/hide columns dynamically
173
+ - Drag and drop column reordering
174
+ - Reset to default option
175
+ - Search columns functionality
176
+ - Column group management
177
+
178
+ - **Filter Panel**:
179
+ - Complex filtering interface
180
+ - Add/remove filter conditions
181
+ - Combine multiple filters
182
+ - Filter operator selection
183
+ - Type-aware filter inputs
184
+ - Save filter presets
185
+
186
+ ### Visual Customization
187
+
188
+ - **Column Resizing**:
189
+
190
+ - Drag handles to adjust column widths
191
+ - Visual feedback during resize operation
192
+ - Minimum/maximum width constraints
193
+ - Double-click to auto-size based on content
194
+ - Persist column width preferences
195
+
196
+ - **Styling**:
197
+
198
+ - Comprehensive CSS for enterprise appearance
199
+ - Support for theming and custom styles
200
+ - Responsive design principles
201
+ - Accessible color schemes
202
+ - Row alternating colors
203
+ - Hover and selection styles
204
+
205
+ - **Custom Cell Rendering**:
206
+ - Format cell content with custom renderers
207
+ - Support for complex components within cells
208
+ - Cell editor integration
209
+ - Conditional formatting based on cell values
210
+ - Support for images, icons, and rich content
211
+
212
+ ### Performance Optimizations
213
+
214
+ - **Virtualized Rendering**:
215
+
216
+ - Only renders visible rows for large datasets
217
+ - Significantly improves performance for tables with thousands of rows
218
+ - Dynamic buffer size calculation
219
+ - Smooth scrolling experience
220
+ - Efficient DOM reuse
221
+
222
+ - **Memoization**:
223
+
224
+ - Efficient re-rendering using React.useMemo
225
+ - Prevents unnecessary calculations during renders
226
+ - Smart component updates based on changed props
227
+ - Optimized context usage to prevent re-renders
228
+
229
+ - **Optimized Filtering**:
230
+ - Smart filter application for large datasets
231
+ - Debounced search input to prevent excessive filtering
232
+ - Cached filter results when possible
233
+ - Progressive filtering for complex conditions
234
+ - Background processing for non-blocking UX
235
+
236
+ ## Usage
237
+
238
+ ```jsx
239
+ import CustomTable from "./components/CustomTable";
240
+
241
+ // Sample data
242
+ const data = [
243
+ { id: 1, name: "Product A", category: "Electronics", price: 299.99 },
244
+ { id: 2, name: "Product B", category: "Furniture", price: 599.99 },
245
+ // ...more rows
246
+ ];
247
+
248
+ // Column definitions
249
+ const columns = [
250
+ {
251
+ field: "id",
252
+ headerName: "ID",
253
+ width: 80,
254
+ sortable: true,
255
+ },
256
+ {
257
+ field: "name",
258
+ headerName: "Product Name",
259
+ width: 200,
260
+ sortable: true,
261
+ filterable: true,
262
+ },
263
+ {
264
+ field: "category",
265
+ headerName: "Category",
266
+ width: 150,
267
+ sortable: true,
268
+ filterable: true,
269
+ },
270
+ {
271
+ field: "price",
272
+ headerName: "Price",
273
+ width: 120,
274
+ align: "right",
275
+ sortable: true,
276
+ filterable: true,
277
+ cellRenderer: ({ value }) => `$${value.toFixed(2)}`,
278
+ },
279
+ ];
280
+
281
+ // Component implementation
282
+ const MyTable = () => {
283
+ return (
284
+ <CustomTable
285
+ data={data}
286
+ columns={columns}
287
+ height="500px"
288
+ uniqueIdField="id"
289
+ selectable={true}
290
+ pagination={true}
291
+ pageSize={10}
292
+ />
293
+ );
294
+ };
295
+ ```
296
+
297
+ ## Props
298
+
299
+ | Prop | Type | Default | Description |
300
+ | --------------- | -------- | --------------- | -------------------------------------------------- |
301
+ | `data` | Array | `[]` | Array of data objects to display |
302
+ | `columns` | Array | `[]` | Column definitions |
303
+ | `height` | String | `'auto'` | Table height |
304
+ | `uniqueIdField` | String | `'store_code'` | Field to use as unique row identifier |
305
+ | `childKeyField` | String | `'status_obj1'` | Field containing child items for hierarchical data |
306
+ | `showHeader` | Boolean | `true` | Whether to show the table header |
307
+ | `showFooter` | Boolean | `false` | Whether to show the table footer |
308
+ | `showToolbar` | Boolean | `true` | Whether to show the toolbar |
309
+ | `showFilters` | Boolean | `false` | Whether to show the filter panel |
310
+ | `selectable` | Boolean | `false` | Enable row selection |
311
+ | `expandable` | Boolean | `false` | Enable row expansion |
312
+ | `pagination` | Boolean | `false` | Enable pagination |
313
+ | `pageSize` | Number | `10` | Items per page when pagination is enabled |
314
+ | `onRowClick` | Function | - | Row click handler |
315
+ | `onCellClick` | Function | - | Cell click handler |
316
+
317
+ ## Column Definition
318
+
319
+ ```typescript
320
+ interface ColumnDefinition {
321
+ field: string; // The field name in the data object
322
+ headerName: string; // The display name for the column header
323
+ width?: number; // The width of the column in pixels (default: 100)
324
+ sortable?: boolean; // Whether the column is sortable (default: true)
325
+ filterable?: boolean; // Whether the column is filterable (default: true)
326
+ resizable?: boolean; // Whether the column can be resized (default: true)
327
+ cellRenderer?: Function; // Custom cell renderer function
328
+ headerRenderer?: Function; // Custom header renderer function
329
+ align?: "left" | "center" | "right"; // Text alignment (default: 'left')
330
+ pinned?: boolean | "left"; // Whether the column is pinned (true = right, 'left' = left)
331
+ hidden?: boolean; // Whether the column is initially hidden
332
+ children?: ColumnDefinition[]; // Child columns for grouping headers
333
+ }
334
+ ```
335
+
336
+ ## Project Setup
337
+
338
+ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
339
+
340
+ ### Available Scripts
341
+
342
+ In the project directory, you can run:
343
+
344
+ #### `npm start`
345
+
346
+ Runs the app in the development mode.\
347
+ Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
348
+
349
+ #### `npm test`
350
+
351
+ Launches the test runner in the interactive watch mode.
352
+
353
+ #### `npm run build`
354
+
355
+ Builds the app for production to the `build` folder.
356
+
357
+ # Advanced Data Caching System for React Tables
358
+
359
+ A high-performance caching system for handling extremely large datasets (50M+ rows) in React applications with support for both pagination and infinite scrolling patterns.
360
+
361
+ ## Core Components
362
+
363
+ - **InfiniteCache**: Block-based cache management with multiple purge strategies
364
+ - **InfiniteRowModel**: Virtual row model to efficiently handle rows and viewport
365
+ - **InfiniteDataSource**: Data provider with client-side and server-side implementations
366
+ - **InfiniteBlock**: Data block for efficient memory management and cache operations
367
+ - **StreamingDataAdapter**: Enables streaming large datasets in chunks
368
+ - **LargeDataStorage**: Optimized storage for extremely large datasets
369
+ - **LargeDataSourceAdapter**: Adapter for connecting large storage to data sources
370
+ - **Web Workers**: Background processing for heavy operations
371
+ - `worker.js`: Standard worker for data processing
372
+ - `enhanced-worker.js`: WebAssembly-enhanced worker for extreme performance
373
+
374
+ ## Key Features
375
+
376
+ - **Virtual Rendering**: Only renders visible rows with intelligent row recycling
377
+ - **Block-Based Caching**: Stores data in blocks for efficient memory use
378
+ - **Multiple Purge Strategies**:
379
+ - LRU (Least Recently Used)
380
+ - Furthest From Viewport
381
+ - Memory Optimized
382
+ - **Persistence Options**: Save cache state between sessions
383
+ - **Automatic Memory Management**: Monitors and optimizes memory usage
384
+ - **Extreme Dataset Optimizations**:
385
+ - Web Worker offloading
386
+ - IndexedDB integration
387
+ - Binary data format
388
+ - Streaming data loading
389
+ - WebAssembly acceleration
390
+
391
+ ## Performance Characteristics
392
+
393
+ - **Dataset Size**: Efficiently handles 50M+ rows
394
+ - **Memory Usage**: Optimized for low memory footprint
395
+ - **Rendering Performance**: Maintains 60fps scrolling
396
+ - **Initial Load Time**: Fast initial loading with progressive enhancements
397
+ - **Server-Side Operations**: Optimized for REST/GraphQL pagination
398
+
399
+ ## Usage
400
+
401
+ The system can be used via the `useInfiniteCache` hook:
402
+
403
+ ```jsx
404
+ const { visibleData, getRows, setVisibleRange, refreshCache, analytics } =
405
+ useInfiniteCache(data, {
406
+ threshold: 1000,
407
+ blockSize: 100,
408
+ maxBlocksInCache: 10,
409
+ enableEnhancedWorker: true,
410
+ });
411
+ ```
412
+
413
+ Perfect for:
414
+
415
+ - Data grids/tables
416
+ - Virtual lists
417
+ - Infinite scrolling feeds
418
+ - Paginated data displays
419
+
420
+ ## Advanced Configuration
421
+
422
+ - **Block Size**: Configure memory/performance tradeoff
423
+ - **Cache Size**: Adjust total blocks kept in memory
424
+ - **Worker Options**: Enable/disable WebAssembly optimization
425
+ - **Storage Options**: Configure persistence and compression
426
+ - **Streaming Options**: Fine-tune loading behavior
427
+ - **IndexedDB Integration**: Offload memory pressure for extreme datasets
428
+
429
+ ## Industry Compatibility
430
+
431
+ Implements the same caching architecture as AG Grid Enterprise (v27), ensuring familiar patterns and optimal performance for massive datasets.