react-open-source-grid 1.5.0 → 1.5.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/dist/assets/components/AccessibilityDemo.d.ts +8 -0
- package/dist/assets/components/ApiReferencePage.d.ts +2 -0
- package/dist/assets/components/BenchmarkDemo.d.ts +2 -0
- package/dist/assets/components/CellRenderersDemo.d.ts +16 -0
- package/dist/assets/components/CodeBlock.d.ts +10 -0
- package/dist/assets/components/ColumnFiltersDemo.d.ts +5 -0
- package/dist/assets/components/CompleteApiReferencePage.d.ts +2 -0
- package/dist/assets/components/ContextMenuDemo.d.ts +12 -0
- package/dist/assets/components/DataGrid/ARCHITECTURE.md.d.ts +288 -0
- package/dist/assets/components/DataGrid/AdvancedFilterBuilder.d.ts +12 -0
- package/dist/assets/components/DataGrid/CellRenderers.d.ts +64 -0
- package/dist/assets/components/DataGrid/ColumnChooser.d.ts +12 -0
- package/dist/assets/components/DataGrid/ColumnFilters.d.ts +16 -0
- package/dist/assets/components/DataGrid/ContextMenu.d.ts +10 -0
- package/dist/assets/components/DataGrid/DataGrid.d.ts +22 -0
- package/dist/assets/components/DataGrid/DensityToggle.d.ts +23 -0
- package/dist/assets/components/DataGrid/DragHandle.d.ts +7 -0
- package/dist/assets/components/DataGrid/DraggableRow.d.ts +14 -0
- package/dist/assets/components/DataGrid/ExportMenu.d.ts +12 -0
- package/dist/assets/components/DataGrid/FacetedSearch.d.ts +29 -0
- package/dist/assets/components/DataGrid/FilteredSearchBar.d.ts +36 -0
- package/dist/assets/components/DataGrid/FocusTrap.d.ts +12 -0
- package/dist/assets/components/DataGrid/GridApiDemo.d.ts +6 -0
- package/dist/assets/components/DataGrid/GridBody.d.ts +42 -0
- package/dist/assets/components/DataGrid/GridFooter.d.ts +18 -0
- package/dist/assets/components/DataGrid/GridHeader.d.ts +18 -0
- package/dist/assets/components/DataGrid/GridPagination.d.ts +10 -0
- package/dist/assets/components/DataGrid/GroupByPanel.d.ts +9 -0
- package/dist/assets/components/DataGrid/GroupRow.d.ts +31 -0
- package/dist/assets/components/DataGrid/InfiniteScrollDataGrid.d.ts +39 -0
- package/dist/assets/components/DataGrid/LayoutPresetsManager.d.ts +11 -0
- package/dist/assets/components/DataGrid/MarketDataEngine.d.ts +165 -0
- package/dist/assets/components/DataGrid/MarketDataGrid.d.ts +33 -0
- package/dist/assets/components/DataGrid/MarketDataGridUtils.d.ts +13 -0
- package/dist/assets/components/DataGrid/ScreenReaderAnnouncer.d.ts +8 -0
- package/dist/assets/components/DataGrid/ServerSideDataSource.d.ts +136 -0
- package/dist/assets/components/DataGrid/ThemeSelector.d.ts +12 -0
- package/dist/assets/components/DataGrid/Tooltip.d.ts +15 -0
- package/dist/assets/components/DataGrid/TreeRow.d.ts +31 -0
- package/dist/assets/components/DataGrid/VirtualScroller.d.ts +35 -0
- package/dist/assets/components/DataGrid/WebSocketMockFeed.d.ts +121 -0
- package/dist/assets/components/DataGrid/aggregationUtils.d.ts +25 -0
- package/dist/assets/components/DataGrid/contextMenuUtils.d.ts +36 -0
- package/dist/assets/components/DataGrid/demos/TooltipDemo.d.ts +1 -0
- package/dist/assets/components/DataGrid/densityModes.d.ts +42 -0
- package/dist/assets/components/DataGrid/dragRowUtils.d.ts +98 -0
- package/dist/assets/components/DataGrid/exportUtils.d.ts +30 -0
- package/dist/assets/components/DataGrid/filterUtils.d.ts +17 -0
- package/dist/assets/components/DataGrid/gridApi.d.ts +142 -0
- package/dist/assets/components/DataGrid/gridApi.types.d.ts +348 -0
- package/dist/assets/components/DataGrid/gridReducer.d.ts +4 -0
- package/dist/assets/components/DataGrid/groupingUtils.d.ts +17 -0
- package/dist/assets/components/DataGrid/index.d.ts +41 -0
- package/dist/assets/components/DataGrid/layoutPersistence.d.ts +95 -0
- package/dist/assets/components/DataGrid/themes.d.ts +113 -0
- package/dist/assets/components/DataGrid/treeDataUtils.d.ts +97 -0
- package/dist/assets/components/DataGrid/types.d.ts +536 -0
- package/dist/assets/components/DataGrid/useContextMenu.d.ts +31 -0
- package/dist/assets/components/DataGrid/useDensityMode.d.ts +36 -0
- package/dist/assets/components/DataGrid/useFocusTrap.d.ts +14 -0
- package/dist/assets/components/DataGrid/useMarketData.d.ts +57 -0
- package/dist/assets/components/DataGrid/useScreenReaderAnnouncements.d.ts +23 -0
- package/dist/assets/components/DataGrid/useTooltip.d.ts +21 -0
- package/dist/assets/components/DemoGridPage.d.ts +2 -0
- package/dist/assets/components/DensityModeDemo.d.ts +12 -0
- package/dist/assets/components/FacetedSearchDemo.d.ts +8 -0
- package/dist/assets/components/FeatureGallery.d.ts +2 -0
- package/dist/assets/components/FilteredSearchDemo.d.ts +7 -0
- package/dist/assets/components/GridApiDemoPage.d.ts +2 -0
- package/dist/assets/components/HomePage.d.ts +1 -0
- package/dist/assets/components/InfiniteScrollDemo.d.ts +13 -0
- package/dist/assets/components/LayoutPersistenceDemo.d.ts +2 -0
- package/dist/assets/components/LiveMarketDemo.d.ts +18 -0
- package/dist/assets/components/MarketDataExamples.d.ts +42 -0
- package/dist/assets/components/RowDraggingDemo.d.ts +3 -0
- package/dist/assets/components/RowPinningDemo.d.ts +12 -0
- package/dist/assets/components/ThemesDemo.d.ts +17 -0
- package/dist/assets/components/TooltipDemo.d.ts +1 -0
- package/dist/assets/components/TreeDataDemo.d.ts +3 -0
- package/dist/assets/components/VirtualScrollDemo.d.ts +13 -0
- package/dist/assets/{index-BCK5Ko4P.js → index-bQ7aqGuU.js} +2 -2
- package/dist/assets/index.js +1 -1
- package/dist/assets/{layoutPersistence-BHB0W18y.js → layoutPersistence-B2lMGbE7.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +14 -4
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Column, Row, GridAction, EditState, FocusState, GroupedRow, AggregateConfig, VirtualScrollConfig, TreeNode, TreeConfig, DragRowConfig } from './types';
|
|
3
|
+
interface GridBodyProps {
|
|
4
|
+
columns: Column[];
|
|
5
|
+
rows: (Row | GroupedRow | TreeNode)[];
|
|
6
|
+
pinnedRowsTop?: (Row | GroupedRow | TreeNode)[];
|
|
7
|
+
pinnedRowsBottom?: (Row | GroupedRow | TreeNode)[];
|
|
8
|
+
columnOrder: string[];
|
|
9
|
+
displayColumnOrder: string[];
|
|
10
|
+
columnWidths: {
|
|
11
|
+
[field: string]: number;
|
|
12
|
+
};
|
|
13
|
+
selectedRows: Set<string | number>;
|
|
14
|
+
editState: EditState;
|
|
15
|
+
focusState: FocusState | null;
|
|
16
|
+
dispatch: React.Dispatch<GridAction>;
|
|
17
|
+
onRowClick?: (row: Row) => void;
|
|
18
|
+
onCellEdit?: (rowIndex: number, field: string, value: any) => void;
|
|
19
|
+
pinnedLeft: string[];
|
|
20
|
+
pinnedRight: string[];
|
|
21
|
+
showGroupFooters?: boolean;
|
|
22
|
+
groupAggregates?: Map<string, {
|
|
23
|
+
[key: string]: number | null;
|
|
24
|
+
}>;
|
|
25
|
+
aggregateConfigs?: AggregateConfig[];
|
|
26
|
+
virtualScrollConfig?: VirtualScrollConfig;
|
|
27
|
+
treeConfig?: TreeConfig;
|
|
28
|
+
dragRowConfig?: DragRowConfig;
|
|
29
|
+
tableId?: string;
|
|
30
|
+
onRowReorder?: (rows: Row[]) => void;
|
|
31
|
+
onScroll?: (scrollTop: number, scrollLeft: number) => void;
|
|
32
|
+
currentPage?: number;
|
|
33
|
+
pageSize?: number;
|
|
34
|
+
totalRows?: number;
|
|
35
|
+
onContextMenu?: (event: React.MouseEvent, row: Row, column: Column, rowIndex: number, columnIndex: number) => void;
|
|
36
|
+
onCellMouseEnter?: (event: React.MouseEvent, row: Row, column: Column, value: any) => void;
|
|
37
|
+
onCellMouseLeave?: () => void;
|
|
38
|
+
onRowMouseEnter?: (event: React.MouseEvent, row: Row, rowIndex: number) => void;
|
|
39
|
+
onRowMouseLeave?: () => void;
|
|
40
|
+
}
|
|
41
|
+
export declare const GridBody: React.FC<GridBodyProps>;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Column, AggregateConfig } from './types';
|
|
3
|
+
interface GridFooterProps {
|
|
4
|
+
columns: Column[];
|
|
5
|
+
displayColumnOrder: string[];
|
|
6
|
+
columnWidths: {
|
|
7
|
+
[field: string]: number;
|
|
8
|
+
};
|
|
9
|
+
aggregates: {
|
|
10
|
+
[key: string]: number | null;
|
|
11
|
+
};
|
|
12
|
+
aggregateConfigs: AggregateConfig[];
|
|
13
|
+
pinnedLeft: string[];
|
|
14
|
+
pinnedRight: string[];
|
|
15
|
+
label?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const GridFooter: React.FC<GridFooterProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Column, GridAction, SortConfig } from './types';
|
|
3
|
+
interface GridHeaderProps {
|
|
4
|
+
columns: Column[];
|
|
5
|
+
columnOrder: string[];
|
|
6
|
+
displayColumnOrder: string[];
|
|
7
|
+
columnWidths: {
|
|
8
|
+
[field: string]: number;
|
|
9
|
+
};
|
|
10
|
+
sortConfig: SortConfig;
|
|
11
|
+
dispatch: React.Dispatch<GridAction>;
|
|
12
|
+
pinnedLeft: string[];
|
|
13
|
+
pinnedRight: string[];
|
|
14
|
+
showColumnPinning: boolean;
|
|
15
|
+
onContextMenu?: (event: React.MouseEvent, column: Column, columnIndex: number) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const GridHeader: React.FC<GridHeaderProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { GridAction } from './types';
|
|
3
|
+
interface GridPaginationProps {
|
|
4
|
+
currentPage: number;
|
|
5
|
+
pageSize: number;
|
|
6
|
+
totalRows: number;
|
|
7
|
+
dispatch: React.Dispatch<GridAction>;
|
|
8
|
+
}
|
|
9
|
+
export declare const GridPagination: React.FC<GridPaginationProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Column, GridAction } from './types';
|
|
3
|
+
interface GroupByPanelProps {
|
|
4
|
+
columns: Column[];
|
|
5
|
+
groupBy: string[];
|
|
6
|
+
dispatch: React.Dispatch<GridAction>;
|
|
7
|
+
}
|
|
8
|
+
export declare const GroupByPanel: React.FC<GroupByPanelProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { GroupedRow, Column, GridAction, AggregateConfig } from './types';
|
|
3
|
+
interface GroupRowProps {
|
|
4
|
+
group: GroupedRow;
|
|
5
|
+
columns: Column[];
|
|
6
|
+
columnOrder: string[];
|
|
7
|
+
displayColumnOrder: string[];
|
|
8
|
+
columnWidths: {
|
|
9
|
+
[field: string]: number;
|
|
10
|
+
};
|
|
11
|
+
dispatch: React.Dispatch<GridAction>;
|
|
12
|
+
pinnedLeft: string[];
|
|
13
|
+
pinnedRight: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare const GroupRow: React.FC<GroupRowProps>;
|
|
16
|
+
interface GroupFooterRowProps {
|
|
17
|
+
group: GroupedRow;
|
|
18
|
+
columns: Column[];
|
|
19
|
+
displayColumnOrder: string[];
|
|
20
|
+
columnWidths: {
|
|
21
|
+
[field: string]: number;
|
|
22
|
+
};
|
|
23
|
+
aggregates: {
|
|
24
|
+
[key: string]: number | null;
|
|
25
|
+
};
|
|
26
|
+
aggregateConfigs: AggregateConfig[];
|
|
27
|
+
pinnedLeft: string[];
|
|
28
|
+
pinnedRight: string[];
|
|
29
|
+
}
|
|
30
|
+
export declare const GroupFooterRow: React.FC<GroupFooterRowProps>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InfiniteScrollDataGrid Component
|
|
3
|
+
*
|
|
4
|
+
* DataGrid with server-side infinite scrolling support.
|
|
5
|
+
* Handles massive datasets (100M+ rows) with:
|
|
6
|
+
* - Server-side data fetching
|
|
7
|
+
* - Server-side filtering
|
|
8
|
+
* - Server-side sorting
|
|
9
|
+
* - Local block caching
|
|
10
|
+
* - Virtual scrolling
|
|
11
|
+
*/
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import type { Column, Row, VirtualScrollConfig } from './types';
|
|
14
|
+
import type { ServerSideDataSourceConfig } from './ServerSideDataSource';
|
|
15
|
+
import { ServerSideDataSource } from './ServerSideDataSource';
|
|
16
|
+
import type { ThemeName } from './themes';
|
|
17
|
+
export interface InfiniteScrollDataGridProps {
|
|
18
|
+
columns: Column[];
|
|
19
|
+
dataSource: ServerSideDataSource | ServerSideDataSourceConfig;
|
|
20
|
+
pageSize?: number;
|
|
21
|
+
showColumnPinning?: boolean;
|
|
22
|
+
virtualScrollConfig?: VirtualScrollConfig;
|
|
23
|
+
theme?: ThemeName;
|
|
24
|
+
onRowClick?: (row: Row) => void;
|
|
25
|
+
onCellEdit?: (rowIndex: number, field: string, value: unknown) => void;
|
|
26
|
+
onSelectionChange?: (selectedIds: (string | number)[]) => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* InfiniteScrollDataGrid
|
|
30
|
+
*
|
|
31
|
+
* A DataGrid component optimized for infinite scrolling with server-side data source.
|
|
32
|
+
*/
|
|
33
|
+
export declare const InfiniteScrollDataGrid: React.FC<InfiniteScrollDataGridProps>;
|
|
34
|
+
/**
|
|
35
|
+
* ThemedInfiniteScrollDataGrid - Legacy alias for backward compatibility
|
|
36
|
+
* @deprecated Use InfiniteScrollDataGrid directly with theme prop instead
|
|
37
|
+
*/
|
|
38
|
+
export declare const ThemedInfiniteScrollDataGrid: React.FC<InfiniteScrollDataGridProps>;
|
|
39
|
+
export default InfiniteScrollDataGrid;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { LayoutPreset } from './types';
|
|
3
|
+
import { LayoutPersistenceManager } from './layoutPersistence';
|
|
4
|
+
interface LayoutPresetsManagerProps {
|
|
5
|
+
manager: LayoutPersistenceManager;
|
|
6
|
+
currentLayout: LayoutPreset['layout'];
|
|
7
|
+
onLoadPreset: (layout: LayoutPreset['layout']) => void;
|
|
8
|
+
onResetLayout: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const LayoutPresetsManager: React.FC<LayoutPresetsManagerProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MarketDataEngine.ts
|
|
3
|
+
*
|
|
4
|
+
* High-performance market data update engine for handling 1000+ updates/sec
|
|
5
|
+
* with minimal React re-renders and optimal DOM patching.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - RequestAnimationFrame batching for smooth 60fps updates
|
|
9
|
+
* - Diff buffer for tracking changed cells
|
|
10
|
+
* - Direct DOM manipulation to bypass React reconciliation
|
|
11
|
+
* - Cell flash animations (green/red for up/down)
|
|
12
|
+
* - Memory-efficient row cache
|
|
13
|
+
* - CPU usage monitoring and auto-throttling
|
|
14
|
+
*/
|
|
15
|
+
export interface CellUpdate {
|
|
16
|
+
rowId: string | number;
|
|
17
|
+
field: string;
|
|
18
|
+
oldValue: any;
|
|
19
|
+
newValue: any;
|
|
20
|
+
timestamp: number;
|
|
21
|
+
}
|
|
22
|
+
export interface FlashAnimation {
|
|
23
|
+
cellKey: string;
|
|
24
|
+
direction: 'up' | 'down';
|
|
25
|
+
startTime: number;
|
|
26
|
+
duration: number;
|
|
27
|
+
}
|
|
28
|
+
export interface MarketDataRow {
|
|
29
|
+
id: string | number;
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}
|
|
32
|
+
export interface MarketDataEngineConfig {
|
|
33
|
+
flashDuration?: number;
|
|
34
|
+
batchInterval?: number;
|
|
35
|
+
enableFlash?: boolean;
|
|
36
|
+
maxUpdatesPerFrame?: number;
|
|
37
|
+
cpuThreshold?: number;
|
|
38
|
+
enableLiveSorting?: boolean;
|
|
39
|
+
enableRankingMovement?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface RowUpdate {
|
|
42
|
+
rowId: string | number;
|
|
43
|
+
updates: {
|
|
44
|
+
[field: string]: any;
|
|
45
|
+
};
|
|
46
|
+
timestamp: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* MarketDataEngine
|
|
50
|
+
*
|
|
51
|
+
* Manages high-frequency data updates with minimal performance impact.
|
|
52
|
+
* Uses RAF batching and direct DOM manipulation to achieve sub-millisecond latencies.
|
|
53
|
+
*/
|
|
54
|
+
export declare class MarketDataEngine {
|
|
55
|
+
private config;
|
|
56
|
+
private rowCache;
|
|
57
|
+
private updateBuffer;
|
|
58
|
+
private flashAnimations;
|
|
59
|
+
private rafId;
|
|
60
|
+
private lastUpdateTime;
|
|
61
|
+
private isPaused;
|
|
62
|
+
private isThrottled;
|
|
63
|
+
private updateCallbacks;
|
|
64
|
+
private cellUpdateCallbacks;
|
|
65
|
+
private frameCount;
|
|
66
|
+
private lastFrameTime;
|
|
67
|
+
private avgFrameTime;
|
|
68
|
+
constructor(config?: MarketDataEngineConfig);
|
|
69
|
+
/**
|
|
70
|
+
* Initialize the engine with row data
|
|
71
|
+
*/
|
|
72
|
+
initialize(rows: MarketDataRow[]): void;
|
|
73
|
+
/**
|
|
74
|
+
* Process incoming market data updates
|
|
75
|
+
* This method is optimized for high-frequency calls
|
|
76
|
+
*/
|
|
77
|
+
processUpdate(update: RowUpdate): void;
|
|
78
|
+
/**
|
|
79
|
+
* Process updates in batches using RAF
|
|
80
|
+
*/
|
|
81
|
+
private processFrame;
|
|
82
|
+
/**
|
|
83
|
+
* Apply DOM updates directly without React re-renders
|
|
84
|
+
*/
|
|
85
|
+
private applyDOMUpdates;
|
|
86
|
+
/**
|
|
87
|
+
* Get DOM element for a specific cell
|
|
88
|
+
*/
|
|
89
|
+
private getCellElement;
|
|
90
|
+
/**
|
|
91
|
+
* Update cell content in DOM
|
|
92
|
+
*/
|
|
93
|
+
private updateCellContent;
|
|
94
|
+
/**
|
|
95
|
+
* Apply flash animation to cell
|
|
96
|
+
*/
|
|
97
|
+
private applyFlashAnimation;
|
|
98
|
+
/**
|
|
99
|
+
* Clean up expired flash animations
|
|
100
|
+
*/
|
|
101
|
+
private cleanupFlashAnimations;
|
|
102
|
+
/**
|
|
103
|
+
* Format cell value for display
|
|
104
|
+
*/
|
|
105
|
+
private formatCellValue;
|
|
106
|
+
/**
|
|
107
|
+
* Check if field values are numeric for flash animation
|
|
108
|
+
*/
|
|
109
|
+
private isNumericField;
|
|
110
|
+
/**
|
|
111
|
+
* Subscribe to row data updates
|
|
112
|
+
*/
|
|
113
|
+
onUpdate(callback: (rows: MarketDataRow[]) => void): () => void;
|
|
114
|
+
/**
|
|
115
|
+
* Subscribe to individual cell updates
|
|
116
|
+
*/
|
|
117
|
+
onCellUpdate(callback: (update: CellUpdate) => void): () => void;
|
|
118
|
+
/**
|
|
119
|
+
* Get current row data from cache
|
|
120
|
+
*/
|
|
121
|
+
getRows(): MarketDataRow[];
|
|
122
|
+
/**
|
|
123
|
+
* Get specific row from cache
|
|
124
|
+
*/
|
|
125
|
+
getRow(rowId: string | number): MarketDataRow | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* Pause live updates (data ingestion continues)
|
|
128
|
+
*/
|
|
129
|
+
pause(): void;
|
|
130
|
+
/**
|
|
131
|
+
* Resume live updates
|
|
132
|
+
*/
|
|
133
|
+
resume(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Check if updates are paused
|
|
136
|
+
*/
|
|
137
|
+
isPausedState(): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Check if engine is throttled due to CPU load
|
|
140
|
+
*/
|
|
141
|
+
isThrottledState(): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Get performance metrics
|
|
144
|
+
*/
|
|
145
|
+
getMetrics(): {
|
|
146
|
+
avgFrameTime: number;
|
|
147
|
+
fps: number;
|
|
148
|
+
pendingUpdates: number;
|
|
149
|
+
activeFlashes: number;
|
|
150
|
+
rowCount: number;
|
|
151
|
+
isThrottled: boolean;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Clear all data and reset engine
|
|
155
|
+
*/
|
|
156
|
+
clear(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Destroy engine and clean up
|
|
159
|
+
*/
|
|
160
|
+
destroy(): void;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Create a market data engine instance
|
|
164
|
+
*/
|
|
165
|
+
export declare function createMarketDataEngine(config?: MarketDataEngineConfig): MarketDataEngine;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MarketDataGrid.tsx
|
|
3
|
+
*
|
|
4
|
+
* High-performance DataGrid wrapper optimized for live market data.
|
|
5
|
+
* Integrates MarketDataEngine with React DataGrid component.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Ultra-low latency updates
|
|
9
|
+
* - Cell flash animations
|
|
10
|
+
* - Density mode for compact display
|
|
11
|
+
* - Market-specific column formatting
|
|
12
|
+
* - Live sorting and ranking
|
|
13
|
+
*/
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import type { Column, Row, MarketDataConfig } from './types';
|
|
16
|
+
import { MarketDataEngine } from './MarketDataEngine';
|
|
17
|
+
import './MarketDataGrid.css';
|
|
18
|
+
export interface MarketDataGridProps {
|
|
19
|
+
columns: Column[];
|
|
20
|
+
rows: Row[];
|
|
21
|
+
engine: MarketDataEngine;
|
|
22
|
+
config?: MarketDataConfig;
|
|
23
|
+
className?: string;
|
|
24
|
+
onCellClick?: (rowId: string | number, field: string, value: any) => void;
|
|
25
|
+
onRowClick?: (row: Row) => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* MarketDataGrid Component
|
|
29
|
+
*
|
|
30
|
+
* Optimized grid for displaying live market data with minimal latency.
|
|
31
|
+
* Uses direct DOM manipulation for cell updates to bypass React reconciliation.
|
|
32
|
+
*/
|
|
33
|
+
export declare const MarketDataGrid: React.FC<MarketDataGridProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MarketDataConfig } from './types';
|
|
2
|
+
import { MarketDataEngine } from './MarketDataEngine';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface WithMarketDataProps {
|
|
5
|
+
marketDataConfig?: MarketDataConfig;
|
|
6
|
+
engine?: MarketDataEngine;
|
|
7
|
+
}
|
|
8
|
+
export declare function withMarketData<P extends object>(Component: React.ComponentType<P>): React.FC<P & WithMarketDataProps>;
|
|
9
|
+
export declare const getColumnClass: (field: string) => string;
|
|
10
|
+
export declare const formatCellValue: (value: unknown) => string;
|
|
11
|
+
export declare const formatPrice: (value: number) => string;
|
|
12
|
+
export declare const formatChange: (value: number, isPercent: boolean) => React.ReactElement;
|
|
13
|
+
export declare const formatVolume: (value: number) => string;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-Side DataSource for Infinite Scrolling
|
|
3
|
+
*
|
|
4
|
+
* Handles:
|
|
5
|
+
* - Fetching data blocks from server
|
|
6
|
+
* - Server-side filtering
|
|
7
|
+
* - Server-side sorting
|
|
8
|
+
* - Local block caching
|
|
9
|
+
* - Infinite scrolling for massive datasets (100M+ rows)
|
|
10
|
+
*/
|
|
11
|
+
import type { Row, SortConfig, FilterConfig } from './types';
|
|
12
|
+
export interface ServerSideRequest {
|
|
13
|
+
startRow: number;
|
|
14
|
+
endRow: number;
|
|
15
|
+
sortModel?: SortConfig[];
|
|
16
|
+
filterModel?: FilterConfig;
|
|
17
|
+
groupKeys?: string[];
|
|
18
|
+
}
|
|
19
|
+
export interface ServerSideResponse {
|
|
20
|
+
rows: Row[];
|
|
21
|
+
totalRows: number;
|
|
22
|
+
lastRow?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ServerSideDataSourceConfig {
|
|
25
|
+
blockSize?: number;
|
|
26
|
+
maxConcurrentRequests?: number;
|
|
27
|
+
cacheBlockCount?: number;
|
|
28
|
+
cacheTimeout?: number;
|
|
29
|
+
getRows: (request: ServerSideRequest) => Promise<ServerSideResponse>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* ServerSideDataSource
|
|
33
|
+
*
|
|
34
|
+
* Manages infinite scrolling with server-side data fetching, filtering, and sorting.
|
|
35
|
+
* Similar to AG Grid's server-side row model.
|
|
36
|
+
*/
|
|
37
|
+
export declare class ServerSideDataSource {
|
|
38
|
+
private blockSize;
|
|
39
|
+
private maxConcurrentRequests;
|
|
40
|
+
private cacheBlockCount;
|
|
41
|
+
private cacheTimeout;
|
|
42
|
+
private getRows;
|
|
43
|
+
private blockCache;
|
|
44
|
+
private blockStatus;
|
|
45
|
+
private activeRequests;
|
|
46
|
+
private requestQueue;
|
|
47
|
+
private totalRows;
|
|
48
|
+
private sortModel;
|
|
49
|
+
private filterModel;
|
|
50
|
+
private observers;
|
|
51
|
+
constructor(config: ServerSideDataSourceConfig);
|
|
52
|
+
/**
|
|
53
|
+
* Subscribe to data changes
|
|
54
|
+
*/
|
|
55
|
+
subscribe(callback: () => void): () => void;
|
|
56
|
+
/**
|
|
57
|
+
* Notify observers of data changes
|
|
58
|
+
*/
|
|
59
|
+
private notifyObservers;
|
|
60
|
+
/**
|
|
61
|
+
* Get block index for a given row index
|
|
62
|
+
*/
|
|
63
|
+
private getBlockIndex;
|
|
64
|
+
/**
|
|
65
|
+
* Get start row for a block
|
|
66
|
+
*/
|
|
67
|
+
private getBlockStartRow;
|
|
68
|
+
/**
|
|
69
|
+
* Get end row for a block
|
|
70
|
+
*/
|
|
71
|
+
private getBlockEndRow;
|
|
72
|
+
/**
|
|
73
|
+
* Check if a block is cached and valid
|
|
74
|
+
*/
|
|
75
|
+
private isBlockCached;
|
|
76
|
+
/**
|
|
77
|
+
* Purge old cache entries to maintain cache size limit
|
|
78
|
+
*/
|
|
79
|
+
private purgeCache;
|
|
80
|
+
/**
|
|
81
|
+
* Fetch a block from the server
|
|
82
|
+
*/
|
|
83
|
+
private fetchBlock;
|
|
84
|
+
/**
|
|
85
|
+
* Queue a block request
|
|
86
|
+
*/
|
|
87
|
+
private queueBlockRequest;
|
|
88
|
+
/**
|
|
89
|
+
* Process queued requests
|
|
90
|
+
*/
|
|
91
|
+
private processQueue;
|
|
92
|
+
/**
|
|
93
|
+
* Ensure blocks are loaded for a given range
|
|
94
|
+
*/
|
|
95
|
+
private ensureBlocksLoaded;
|
|
96
|
+
/**
|
|
97
|
+
* Get rows for a given range
|
|
98
|
+
*/
|
|
99
|
+
getRowsInRange(startRow: number, endRow: number): Row[];
|
|
100
|
+
/**
|
|
101
|
+
* Get a single row by index
|
|
102
|
+
*/
|
|
103
|
+
getRow(rowIndex: number): Row | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Get total row count (may be undefined until first response)
|
|
106
|
+
*/
|
|
107
|
+
getTotalRows(): number | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Check if a block is loading
|
|
110
|
+
*/
|
|
111
|
+
isBlockLoading(blockIndex: number): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Update sort model and refresh data
|
|
114
|
+
*/
|
|
115
|
+
setSortModel(sortModel: SortConfig[]): void;
|
|
116
|
+
/**
|
|
117
|
+
* Update filter model and refresh data
|
|
118
|
+
*/
|
|
119
|
+
setFilterModel(filterModel: FilterConfig): void;
|
|
120
|
+
/**
|
|
121
|
+
* Refresh all data (clears cache and reloads)
|
|
122
|
+
*/
|
|
123
|
+
refresh(): void;
|
|
124
|
+
/**
|
|
125
|
+
* Purge a specific block from cache
|
|
126
|
+
*/
|
|
127
|
+
purgeBlock(blockIndex: number): void;
|
|
128
|
+
/**
|
|
129
|
+
* Destroy the data source (cleanup)
|
|
130
|
+
*/
|
|
131
|
+
destroy(): void;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Create a mock server-side data source for testing
|
|
135
|
+
*/
|
|
136
|
+
export declare function createMockServerDataSource(totalRows?: number, delay?: number): ServerSideDataSource;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ThemeName } from './themes';
|
|
3
|
+
interface ThemeSelectorProps {
|
|
4
|
+
currentTheme: ThemeName;
|
|
5
|
+
onThemeChange: (theme: ThemeName) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* ThemeSelector Component
|
|
9
|
+
* Dropdown to switch between available themes
|
|
10
|
+
*/
|
|
11
|
+
export declare const ThemeSelector: React.FC<ThemeSelectorProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TooltipState } from './types';
|
|
3
|
+
interface TooltipProps {
|
|
4
|
+
state: TooltipState;
|
|
5
|
+
maxWidth?: number;
|
|
6
|
+
offset?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Tooltip Component
|
|
10
|
+
*
|
|
11
|
+
* Renders tooltips using React portals for proper z-index layering.
|
|
12
|
+
* Includes smart placement logic to keep tooltips within viewport bounds.
|
|
13
|
+
*/
|
|
14
|
+
export declare const Tooltip: React.FC<TooltipProps>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TreeNode, Column, GridAction, TreeConfig } from './types';
|
|
3
|
+
interface TreeRowProps {
|
|
4
|
+
node: TreeNode;
|
|
5
|
+
columns: Column[];
|
|
6
|
+
columnOrder: string[];
|
|
7
|
+
displayColumnOrder: string[];
|
|
8
|
+
columnWidths: {
|
|
9
|
+
[field: string]: number;
|
|
10
|
+
};
|
|
11
|
+
selectedRows: Set<string | number>;
|
|
12
|
+
editState: {
|
|
13
|
+
rowId: string | number | null;
|
|
14
|
+
field: string | null;
|
|
15
|
+
value: any;
|
|
16
|
+
};
|
|
17
|
+
focusState: {
|
|
18
|
+
rowIndex: number;
|
|
19
|
+
columnIndex: number;
|
|
20
|
+
} | null;
|
|
21
|
+
rowIndex: number;
|
|
22
|
+
dispatch: React.Dispatch<GridAction>;
|
|
23
|
+
onRowClick?: (row: TreeNode) => void;
|
|
24
|
+
onCellEdit?: (rowIndex: number, field: string, value: any) => void;
|
|
25
|
+
pinnedLeft: string[];
|
|
26
|
+
pinnedRight: string[];
|
|
27
|
+
treeConfig: TreeConfig;
|
|
28
|
+
editInputRef?: React.RefObject<HTMLInputElement | null>;
|
|
29
|
+
}
|
|
30
|
+
export declare const TreeRow: React.FC<TreeRowProps>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface VirtualScrollerProps<T = unknown> {
|
|
3
|
+
items: T[];
|
|
4
|
+
itemHeight?: number | ((index: number, item: T) => number);
|
|
5
|
+
overscanCount?: number;
|
|
6
|
+
containerHeight?: number;
|
|
7
|
+
containerWidth?: number;
|
|
8
|
+
columns?: Array<{
|
|
9
|
+
field: string;
|
|
10
|
+
width: number;
|
|
11
|
+
}>;
|
|
12
|
+
totalColumnWidth?: number;
|
|
13
|
+
columnOverscan?: number;
|
|
14
|
+
renderItem: (item: T, index: number, style: React.CSSProperties) => React.ReactNode;
|
|
15
|
+
renderRow?: (item: T, index: number, visibleColumns: Array<{
|
|
16
|
+
field: string;
|
|
17
|
+
width: number;
|
|
18
|
+
offset: number;
|
|
19
|
+
}>, style: React.CSSProperties) => React.ReactNode;
|
|
20
|
+
onScroll?: (scrollTop: number, scrollLeft: number) => void;
|
|
21
|
+
className?: string;
|
|
22
|
+
innerClassName?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* VirtualScroller Component
|
|
26
|
+
*
|
|
27
|
+
* High-performance virtual scrolling with:
|
|
28
|
+
* - Row virtualization (windowing)
|
|
29
|
+
* - Column virtualization
|
|
30
|
+
* - Dynamic row heights
|
|
31
|
+
* - Cell recycling
|
|
32
|
+
* - Optimized for 50,000+ rows and 200+ columns
|
|
33
|
+
*/
|
|
34
|
+
export declare const VirtualScroller: <T = unknown>({ items, itemHeight, overscanCount, containerHeight, containerWidth, columns, totalColumnWidth, columnOverscan, renderItem, renderRow, onScroll, className, innerClassName, }: VirtualScrollerProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export default VirtualScroller;
|