react-open-source-grid 1.5.3 → 1.5.7

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.
Files changed (89) hide show
  1. package/dist/lib/App.d.ts +3 -0
  2. package/dist/lib/chunk-FG3FLQAE.js +296 -0
  3. package/dist/lib/components/AccessibilityDemo.d.ts +8 -0
  4. package/dist/lib/components/ApiReferencePage.d.ts +2 -0
  5. package/dist/lib/components/BenchmarkDemo.d.ts +2 -0
  6. package/dist/lib/components/CellRenderersDemo.d.ts +16 -0
  7. package/dist/lib/components/CodeBlock.d.ts +10 -0
  8. package/dist/lib/components/ColumnFiltersDemo.d.ts +5 -0
  9. package/dist/lib/components/CompleteApiReferencePage.d.ts +2 -0
  10. package/dist/lib/components/ContextMenuDemo.d.ts +12 -0
  11. package/dist/lib/components/DataGrid/ARCHITECTURE.md.d.ts +288 -0
  12. package/dist/lib/components/DataGrid/AdvancedFilterBuilder.d.ts +12 -0
  13. package/dist/lib/components/DataGrid/CellRenderers.d.ts +64 -0
  14. package/dist/lib/components/DataGrid/ColumnChooser.d.ts +12 -0
  15. package/dist/lib/components/DataGrid/ColumnFilters.d.ts +16 -0
  16. package/dist/lib/components/DataGrid/ContextMenu.d.ts +10 -0
  17. package/dist/lib/components/DataGrid/DataGrid.d.ts +22 -0
  18. package/dist/lib/components/DataGrid/DensityToggle.d.ts +23 -0
  19. package/dist/lib/components/DataGrid/DragHandle.d.ts +7 -0
  20. package/dist/lib/components/DataGrid/DraggableRow.d.ts +14 -0
  21. package/dist/lib/components/DataGrid/ExportMenu.d.ts +12 -0
  22. package/dist/lib/components/DataGrid/FacetedSearch.d.ts +29 -0
  23. package/dist/lib/components/DataGrid/FilteredSearchBar.d.ts +36 -0
  24. package/dist/lib/components/DataGrid/FocusTrap.d.ts +12 -0
  25. package/dist/lib/components/DataGrid/GridApiDemo.d.ts +6 -0
  26. package/dist/lib/components/DataGrid/GridBody.d.ts +42 -0
  27. package/dist/lib/components/DataGrid/GridFooter.d.ts +18 -0
  28. package/dist/lib/components/DataGrid/GridHeader.d.ts +18 -0
  29. package/dist/lib/components/DataGrid/GridPagination.d.ts +10 -0
  30. package/dist/lib/components/DataGrid/GroupByPanel.d.ts +9 -0
  31. package/dist/lib/components/DataGrid/GroupRow.d.ts +31 -0
  32. package/dist/lib/components/DataGrid/InfiniteScrollDataGrid.d.ts +39 -0
  33. package/dist/lib/components/DataGrid/LayoutPresetsManager.d.ts +11 -0
  34. package/dist/lib/components/DataGrid/MarketDataEngine.d.ts +165 -0
  35. package/dist/lib/components/DataGrid/MarketDataGrid.d.ts +33 -0
  36. package/dist/lib/components/DataGrid/MarketDataGridUtils.d.ts +13 -0
  37. package/dist/lib/components/DataGrid/ScreenReaderAnnouncer.d.ts +8 -0
  38. package/dist/lib/components/DataGrid/ServerSideDataSource.d.ts +136 -0
  39. package/dist/lib/components/DataGrid/ThemeSelector.d.ts +12 -0
  40. package/dist/lib/components/DataGrid/Tooltip.d.ts +15 -0
  41. package/dist/lib/components/DataGrid/TreeRow.d.ts +31 -0
  42. package/dist/lib/components/DataGrid/VirtualScroller.d.ts +35 -0
  43. package/dist/lib/components/DataGrid/WebSocketMockFeed.d.ts +121 -0
  44. package/dist/lib/components/DataGrid/aggregationUtils.d.ts +25 -0
  45. package/dist/lib/components/DataGrid/contextMenuUtils.d.ts +36 -0
  46. package/dist/lib/components/DataGrid/demos/TooltipDemo.d.ts +1 -0
  47. package/dist/lib/components/DataGrid/densityModes.d.ts +42 -0
  48. package/dist/lib/components/DataGrid/dragRowUtils.d.ts +98 -0
  49. package/dist/lib/components/DataGrid/exportUtils.d.ts +30 -0
  50. package/dist/lib/components/DataGrid/filterUtils.d.ts +17 -0
  51. package/dist/lib/components/DataGrid/gridApi.d.ts +142 -0
  52. package/dist/lib/components/DataGrid/gridApi.types.d.ts +348 -0
  53. package/dist/lib/components/DataGrid/gridReducer.d.ts +4 -0
  54. package/dist/lib/components/DataGrid/groupingUtils.d.ts +17 -0
  55. package/dist/lib/components/DataGrid/index.d.ts +41 -0
  56. package/dist/lib/components/DataGrid/layoutPersistence.d.ts +95 -0
  57. package/dist/lib/components/DataGrid/themes.d.ts +113 -0
  58. package/dist/lib/components/DataGrid/treeDataUtils.d.ts +97 -0
  59. package/dist/lib/components/DataGrid/types.d.ts +536 -0
  60. package/dist/lib/components/DataGrid/useContextMenu.d.ts +31 -0
  61. package/dist/lib/components/DataGrid/useDensityMode.d.ts +36 -0
  62. package/dist/lib/components/DataGrid/useFocusTrap.d.ts +14 -0
  63. package/dist/lib/components/DataGrid/useMarketData.d.ts +57 -0
  64. package/dist/lib/components/DataGrid/useScreenReaderAnnouncements.d.ts +23 -0
  65. package/dist/lib/components/DataGrid/useTooltip.d.ts +21 -0
  66. package/dist/lib/components/DemoGridPage.d.ts +3 -0
  67. package/dist/lib/components/DensityModeDemo.d.ts +12 -0
  68. package/dist/lib/components/FacetedSearchDemo.d.ts +8 -0
  69. package/dist/lib/components/FeatureGallery.d.ts +2 -0
  70. package/dist/lib/components/FilteredSearchDemo.d.ts +7 -0
  71. package/dist/lib/components/GridApiDemoPage.d.ts +2 -0
  72. package/dist/lib/components/HomePage.d.ts +1 -0
  73. package/dist/lib/components/InfiniteScrollDemo.d.ts +13 -0
  74. package/dist/lib/components/LayoutPersistenceDemo.d.ts +2 -0
  75. package/dist/lib/components/LiveMarketDemo.d.ts +18 -0
  76. package/dist/lib/components/MarketDataExamples.d.ts +42 -0
  77. package/dist/lib/components/RowDraggingDemo.d.ts +3 -0
  78. package/dist/lib/components/RowPinningDemo.d.ts +12 -0
  79. package/dist/lib/components/ThemesDemo.d.ts +17 -0
  80. package/dist/lib/components/TooltipDemo.d.ts +1 -0
  81. package/dist/lib/components/TreeDataDemo.d.ts +3 -0
  82. package/dist/lib/components/VirtualScrollDemo.d.ts +13 -0
  83. package/dist/lib/index.cjs +12233 -0
  84. package/dist/lib/index.css +591 -0
  85. package/dist/lib/index.d.ts +2 -0
  86. package/dist/lib/index.js +11827 -0
  87. package/dist/lib/layoutPersistence-2MPTAEYI.js +20 -0
  88. package/dist/lib/main.d.ts +1 -0
  89. package/package.json +7 -3
@@ -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,8 @@
1
+ import React from 'react';
2
+ /**
3
+ * Helper component to render the live region for screen readers
4
+ */
5
+ export declare const ScreenReaderAnnouncer: React.FC<{
6
+ message: string;
7
+ priority?: 'polite' | 'assertive';
8
+ }>;
@@ -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;
@@ -0,0 +1,121 @@
1
+ /**
2
+ * WebSocketMockFeed.ts
3
+ *
4
+ * Mock WebSocket server that simulates live market data feed.
5
+ * Generates realistic tick updates for testing market data mode.
6
+ *
7
+ * Features:
8
+ * - Simulates 1000+ ticks/sec
9
+ * - Random price movements
10
+ * - Bid/Ask spreads
11
+ * - Volume tracking
12
+ * - Burst updates
13
+ * - Configurable update frequency
14
+ */
15
+ export interface MockMarketData {
16
+ symbol: string;
17
+ price: number;
18
+ bid: number;
19
+ ask: number;
20
+ size: number;
21
+ volume: number;
22
+ change: number;
23
+ changePercent: number;
24
+ high: number;
25
+ low: number;
26
+ open: number;
27
+ lastUpdate: number;
28
+ }
29
+ export interface MockFeedConfig {
30
+ symbols?: string[];
31
+ updateFrequency?: number;
32
+ priceVolatility?: number;
33
+ burstProbability?: number;
34
+ burstSize?: number;
35
+ port?: number;
36
+ }
37
+ /**
38
+ * Mock WebSocket Feed
39
+ * Simulates a WebSocket server for market data
40
+ */
41
+ export declare class WebSocketMockFeed {
42
+ private config;
43
+ private marketData;
44
+ private updateIntervals;
45
+ private clients;
46
+ private isRunning;
47
+ constructor(config?: MockFeedConfig);
48
+ /**
49
+ * Generate default symbol list
50
+ */
51
+ private generateDefaultSymbols;
52
+ /**
53
+ * Initialize market data with random values
54
+ */
55
+ private initializeMarketData;
56
+ /**
57
+ * Generate random price
58
+ */
59
+ private randomPrice;
60
+ /**
61
+ * Update market data for a symbol
62
+ */
63
+ private updateSymbol;
64
+ /**
65
+ * Trigger burst of rapid updates
66
+ */
67
+ private triggerBurst;
68
+ /**
69
+ * Broadcast update to all connected clients
70
+ */
71
+ private broadcastUpdate;
72
+ /**
73
+ * Start generating updates
74
+ */
75
+ start(): void;
76
+ /**
77
+ * Stop generating updates
78
+ */
79
+ stop(): void;
80
+ /**
81
+ * Register a mock WebSocket client
82
+ */
83
+ connect(client: MockWebSocket): void;
84
+ /**
85
+ * Unregister a mock WebSocket client
86
+ */
87
+ disconnect(client: MockWebSocket): void;
88
+ /**
89
+ * Get current market data snapshot
90
+ */
91
+ getSnapshot(): MockMarketData[];
92
+ /**
93
+ * Get data for specific symbol
94
+ */
95
+ getSymbolData(symbol: string): MockMarketData | undefined;
96
+ }
97
+ /**
98
+ * Mock WebSocket client interface
99
+ */
100
+ export interface MockWebSocket {
101
+ readyState: number;
102
+ send: (data: string) => void;
103
+ onmessage: ((event: {
104
+ data: string;
105
+ }) => void) | null;
106
+ onopen: (() => void) | null;
107
+ onclose: (() => void) | null;
108
+ onerror: ((error: any) => void) | null;
109
+ close: () => void;
110
+ }
111
+ /**
112
+ * Create a mock WebSocket that connects to the feed
113
+ */
114
+ export declare function createMockWebSocket(feed: WebSocketMockFeed): MockWebSocket;
115
+ /**
116
+ * Create and start a mock market data feed
117
+ */
118
+ export declare function createMockFeed(config?: MockFeedConfig): {
119
+ feed: WebSocketMockFeed;
120
+ createConnection: () => MockWebSocket;
121
+ };
@@ -0,0 +1,25 @@
1
+ import type { Row, AggregateFunction, AggregateConfig, GroupedRow } from './types';
2
+ /**
3
+ * Compute a single aggregate value for a set of rows
4
+ */
5
+ export declare const computeAggregate: (rows: Row[], field: string, func: AggregateFunction) => number | null;
6
+ /**
7
+ * Compute all configured aggregates for a set of rows
8
+ */
9
+ export declare const computeAggregations: (rows: Row[], aggregateConfigs: AggregateConfig[]) => {
10
+ [key: string]: number | null;
11
+ };
12
+ /**
13
+ * Compute group-level aggregations for each group in grouped rows
14
+ */
15
+ export declare const computeGroupAggregations: (groupedRows: (Row | GroupedRow)[], aggregateConfigs: AggregateConfig[]) => Map<string, {
16
+ [key: string]: number | null;
17
+ }>;
18
+ /**
19
+ * Format aggregate value for display
20
+ */
21
+ export declare const formatAggregateValue: (value: number | null, func: AggregateFunction) => string;
22
+ /**
23
+ * Get display label for an aggregate function
24
+ */
25
+ export declare const getAggregateLabel: (func: AggregateFunction) => string;
@@ -0,0 +1,36 @@
1
+ import type { Row, Column, FilterValue } from './types';
2
+ /**
3
+ * Context Menu Utility Functions
4
+ *
5
+ * Helper functions for context menu actions like copy, export, etc.
6
+ */
7
+ /**
8
+ * Copy selected cells to clipboard
9
+ */
10
+ export declare const copyToClipboard: (selectedRows: Set<string | number>, columns: Column[], rows: Row[], includeHeaders?: boolean) => Promise<void>;
11
+ /**
12
+ * Copy a specific cell range to clipboard
13
+ */
14
+ export declare const copyCellRange: (startRow: number, endRow: number, startCol: number, endCol: number, columns: Column[], rows: Row[], includeHeaders?: boolean) => Promise<void>;
15
+ /**
16
+ * Export selected rows to CSV
17
+ */
18
+ export declare const exportSelectedToCSV: (selectedRows: Set<string | number>, columns: Column[], rows: Row[], filename?: string) => void;
19
+ /**
20
+ * Calculate optimal column width based on content
21
+ */
22
+ export declare const calculateOptimalWidth: (column: Column, rows: Row[], minWidth?: number, maxWidth?: number, padding?: number) => number;
23
+ /**
24
+ * Auto-size all columns
25
+ */
26
+ export declare const autoSizeAllColumns: (columns: Column[], rows: Row[]) => {
27
+ [field: string]: number;
28
+ };
29
+ /**
30
+ * Create a "filter by value" filter configuration
31
+ */
32
+ export declare const createFilterByValue: (value: unknown) => FilterValue;
33
+ /**
34
+ * Get unique values for a column (for filter suggestions)
35
+ */
36
+ export declare const getUniqueColumnValues: (column: Column, rows: Row[], maxValues?: number) => unknown[];
@@ -0,0 +1 @@
1
+ export declare const TooltipDemo: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * DataGrid Density Mode System
3
+ * Provides Ultra Compact, Compact, Normal, and Comfortable display modes with CSS variables
4
+ */
5
+ export type DensityMode = 'ultraCompact' | 'compact' | 'normal' | 'comfortable';
6
+ export interface DensityConfig {
7
+ mode: DensityMode;
8
+ rowHeight: string;
9
+ cellPadding: string;
10
+ headerPadding: string;
11
+ fontSize: string;
12
+ fontSizeSmall: string;
13
+ }
14
+ /**
15
+ * Density mode configurations
16
+ * Defines row height, padding, and font sizes for each density mode
17
+ */
18
+ export declare const densityConfigs: Record<DensityMode, DensityConfig>;
19
+ /**
20
+ * Get density configuration by mode
21
+ */
22
+ export declare function getDensityConfig(mode?: DensityMode): DensityConfig;
23
+ /**
24
+ * Generate CSS variables from density configuration
25
+ */
26
+ export declare function generateDensityCSS(mode: DensityMode): Record<string, string>;
27
+ /**
28
+ * Get all density mode names
29
+ */
30
+ export declare function getDensityModes(): DensityMode[];
31
+ /**
32
+ * Get display label for density mode
33
+ */
34
+ export declare function getDensityLabel(mode: DensityMode): string;
35
+ /**
36
+ * Persist density mode to localStorage
37
+ */
38
+ export declare function saveDensityMode(mode: DensityMode, key?: string): void;
39
+ /**
40
+ * Load density mode from localStorage
41
+ */
42
+ export declare function loadDensityMode(key?: string): DensityMode | null;
@@ -0,0 +1,98 @@
1
+ import type { Row, TreeNode, GroupedRow } from './types';
2
+ /**
3
+ * Row Dragging / Reorder Utilities
4
+ *
5
+ * Utilities for implementing drag-and-drop row reordering functionality.
6
+ */
7
+ export interface DragRowConfig {
8
+ enabled: boolean;
9
+ showDragHandle?: boolean;
10
+ allowCrossGroup?: boolean;
11
+ allowExternalDrop?: boolean;
12
+ onRowDrop?: (sourceIndex: number, targetIndex: number, row: Row) => void;
13
+ onRowMove?: (sourceIndex: number, targetIndex: number) => void;
14
+ onExternalDrop?: (data: any, targetIndex: number) => void;
15
+ dragHandlePosition?: 'left' | 'right';
16
+ }
17
+ export interface DragState {
18
+ isDragging: boolean;
19
+ draggedRowId: string | number | null;
20
+ draggedRowIndex: number | null;
21
+ dropTargetIndex: number | null;
22
+ dropPosition: 'before' | 'after' | null;
23
+ }
24
+ export declare const initialDragState: DragState;
25
+ /**
26
+ * Reorder rows array based on drag-and-drop indices
27
+ */
28
+ export declare const reorderRows: <T extends Row>(rows: T[], sourceIndex: number, targetIndex: number) => T[];
29
+ /**
30
+ * Get the drop position (before/after) based on mouse position within the row
31
+ */
32
+ export declare const getDropPosition: (event: React.DragEvent, rowElement: HTMLElement) => "before" | "after";
33
+ /**
34
+ * Calculate the target index based on drop position
35
+ */
36
+ export declare const calculateTargetIndex: (dropTargetIndex: number, dropPosition: "before" | "after" | null, sourceIndex: number) => number;
37
+ /**
38
+ * Check if a row can be dropped at the target location
39
+ */
40
+ export declare const canDropRow: (sourceIndex: number, targetIndex: number, _sourceRow: Row | TreeNode | GroupedRow, _targetRow: Row | TreeNode | GroupedRow, config: DragRowConfig) => boolean;
41
+ /**
42
+ * Create drag data transfer object
43
+ */
44
+ export declare const createDragData: (row: Row, rowIndex: number, tableId?: string) => string;
45
+ /**
46
+ * Parse drag data transfer object
47
+ */
48
+ export declare const parseDragData: (dataTransfer: string) => {
49
+ row: Row;
50
+ rowIndex: number;
51
+ tableId?: string;
52
+ timestamp: number;
53
+ } | null;
54
+ /**
55
+ * Check if drag data is from the same table
56
+ */
57
+ export declare const isSameTable: (dragData: ReturnType<typeof parseDragData>, currentTableId?: string) => boolean;
58
+ /**
59
+ * Get visual drop indicator styles
60
+ */
61
+ export declare const getDropIndicatorStyle: (isOver: boolean, position: "before" | "after" | null) => React.CSSProperties;
62
+ /**
63
+ * Handle drag start event
64
+ */
65
+ export declare const handleDragStart: (event: React.DragEvent, row: Row, rowIndex: number, tableId?: string) => void;
66
+ /**
67
+ * Handle drag end event
68
+ */
69
+ export declare const handleDragEnd: (event: React.DragEvent) => void;
70
+ /**
71
+ * Handle drag over event (required for drop to work)
72
+ */
73
+ export declare const handleDragOver: (event: React.DragEvent) => void;
74
+ /**
75
+ * Validate drop operation
76
+ */
77
+ export declare const validateDrop: (event: React.DragEvent, config: DragRowConfig, tableId?: string) => boolean;
78
+ /**
79
+ * Get draggable row props
80
+ */
81
+ export declare const getDraggableRowProps: (row: Row, rowIndex: number, isDragging: boolean, config: DragRowConfig, tableId?: string) => {
82
+ draggable: boolean;
83
+ onDragStart: (e: React.DragEvent) => void;
84
+ onDragEnd: (event: React.DragEvent) => void;
85
+ style: {
86
+ cursor: string;
87
+ opacity: number;
88
+ transition: string;
89
+ };
90
+ };
91
+ /**
92
+ * Get drop target props
93
+ */
94
+ export declare const getDropTargetProps: (rowIndex: number, onDragOver: (e: React.DragEvent, index: number) => void, onDragLeave: () => void, onDrop: (e: React.DragEvent, index: number) => void) => {
95
+ onDragOver: (e: React.DragEvent) => void;
96
+ onDragLeave: () => void;
97
+ onDrop: (e: React.DragEvent) => void;
98
+ };
@@ -0,0 +1,30 @@
1
+ import type { Column, Row } from './types';
2
+ export type ExportFormat = 'csv' | 'xlsx';
3
+ export type ExportScope = 'all' | 'filtered' | 'selected' | 'page';
4
+ export type ExcelStyling = 'basic' | 'professional';
5
+ export interface ExportOptions {
6
+ format: ExportFormat;
7
+ scope: ExportScope;
8
+ includeHeader?: boolean;
9
+ styling?: ExcelStyling;
10
+ filename?: string;
11
+ }
12
+ /**
13
+ * Converts a dataset to CSV format and triggers download
14
+ */
15
+ export declare const exportToCSV: (data: Row[], columns: Column[], filename?: string) => void;
16
+ /**
17
+ * Converts a dataset to XLSX format with optional styling and triggers download
18
+ */
19
+ export declare const exportToXLSX: (data: Row[], columns: Column[], options?: {
20
+ filename?: string;
21
+ styling?: ExcelStyling;
22
+ }) => Promise<void>;
23
+ /**
24
+ * Generates a filename with timestamp
25
+ */
26
+ export declare const generateFilename: (format: ExportFormat, scope: ExportScope) => string;
27
+ /**
28
+ * Handles the complete export process
29
+ */
30
+ export declare const handleExport: (data: Row[], columns: Column[], options: ExportOptions) => Promise<void>;
@@ -0,0 +1,17 @@
1
+ import type { Row, FilterConfig } from './types';
2
+ /**
3
+ * Apply all filters to rows
4
+ */
5
+ export declare const applyFilters: (rows: Row[], filterConfig: FilterConfig) => Row[];
6
+ /**
7
+ * Check if any filters are active
8
+ */
9
+ export declare const hasActiveFilters: (filterConfig: FilterConfig) => boolean;
10
+ /**
11
+ * Get count of active filters
12
+ */
13
+ export declare const getActiveFilterCount: (filterConfig: FilterConfig) => number;
14
+ /**
15
+ * Clear all filters
16
+ */
17
+ export declare const clearAllFilters: () => FilterConfig;