react-open-source-grid 1.6.4 → 1.6.5

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.
@@ -1 +1 @@
1
- export * from './index-BczRxCQn.js';
1
+ export * from './index-BbaZajrS.js';
@@ -1 +1 @@
1
- import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./index-BczRxCQn.js";export{e as createPreset};
1
+ import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./index-BbaZajrS.js";export{e as createPreset};
package/dist/index.html CHANGED
@@ -70,7 +70,7 @@
70
70
  }
71
71
  })();
72
72
  </script>
73
- <script type="module" crossorigin src="/assets/index-BczRxCQn.js"></script>
73
+ <script type="module" crossorigin src="/assets/index-BbaZajrS.js"></script>
74
74
  <link rel="stylesheet" crossorigin href="/assets/index-DqLWhpvP.css">
75
75
  </head>
76
76
  <body>
@@ -0,0 +1,29 @@
1
+ /**
2
+ * PivotToolbar Component
3
+ *
4
+ * Exportable toolbar for configuring pivot table settings
5
+ * Can be used standalone by npm package consumers
6
+ */
7
+ import React from 'react';
8
+ import type { PivotConfig } from './pivotEngine';
9
+ export interface PivotToolbarProps {
10
+ /** Available columns for pivot/grouping/values */
11
+ columns: Array<{
12
+ field: string;
13
+ headerName: string;
14
+ }>;
15
+ /** Current pivot configuration */
16
+ pivotConfig?: Partial<PivotConfig> | null;
17
+ /** Callback when pivot is enabled/disabled */
18
+ onPivotToggle: (enabled: boolean) => void;
19
+ /** Callback when configuration changes */
20
+ onConfigChange: (config: PivotConfig | null) => void;
21
+ /** Whether pivot mode is currently active */
22
+ isPivotMode?: boolean;
23
+ /** Custom styles */
24
+ style?: React.CSSProperties;
25
+ /** Custom class name */
26
+ className?: string;
27
+ }
28
+ export declare const PivotToolbar: React.FC<PivotToolbarProps>;
29
+ export default PivotToolbar;
@@ -39,3 +39,7 @@ export type { WebSocketConfig, MarketDataSubscription, ConnectionState, UseMarke
39
39
  export { WebSocketMockFeed, createMockFeed, createMockWebSocket } from './WebSocketMockFeed';
40
40
  export type { MockMarketData, MockFeedConfig, MockWebSocket } from './WebSocketMockFeed';
41
41
  export type { MarketDataConfig } from './types';
42
+ export { PivotToolbar } from './PivotToolbar';
43
+ export type { PivotToolbarProps } from './PivotToolbar';
44
+ export { buildPivot, exportPivotToCSV, downloadCSV } from './pivotEngine';
45
+ export type { PivotConfig, PivotResult, PivotColumn, AggregatorType } from './pivotEngine';
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Pivot Table Engine
3
+ *
4
+ * Transforms flat data into pivoted format with dynamic columns based on unique values
5
+ * Supports aggregation functions: sum, count, avg, min, max, custom
6
+ */
7
+ export type AggregatorType = 'sum' | 'count' | 'avg' | 'min' | 'max';
8
+ export interface PivotConfig {
9
+ /** Column whose unique values become new columns */
10
+ pivotColumn: string;
11
+ /** Column to aggregate values from */
12
+ valueColumn: string;
13
+ /** Column to group rows by (becomes first column) */
14
+ rowGroupColumn: string;
15
+ /** Aggregation function to apply */
16
+ aggregator: AggregatorType | ((values: number[]) => number);
17
+ /** Show totals row at bottom */
18
+ showTotals?: boolean;
19
+ /** Show grand total column */
20
+ showGrandTotal?: boolean;
21
+ }
22
+ export interface PivotColumn {
23
+ field: string;
24
+ headerName: string;
25
+ width?: number;
26
+ sortable?: boolean;
27
+ filterable?: boolean;
28
+ isPivotColumn?: boolean;
29
+ isTotalColumn?: boolean;
30
+ }
31
+ export interface PivotResult {
32
+ columns: PivotColumn[];
33
+ rows: Record<string, any>[];
34
+ pivotValues: string[];
35
+ totalsRow?: Record<string, any>;
36
+ }
37
+ /**
38
+ * Build pivot table from flat data
39
+ *
40
+ * Complexity: O(n) where n is number of rows
41
+ * Memory: O(n * m) where m is number of unique pivot values
42
+ *
43
+ * @param data - Source data array
44
+ * @param config - Pivot configuration
45
+ * @returns Pivoted dataset with dynamic columns
46
+ */
47
+ export declare function buildPivot(data: any[], config: PivotConfig): PivotResult;
48
+ /**
49
+ * Export pivoted data to CSV
50
+ */
51
+ export declare function exportPivotToCSV(pivotResult: PivotResult): string;
52
+ /**
53
+ * Download CSV file
54
+ */
55
+ export declare function downloadCSV(csvContent: string, filename?: string): void;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import type { ThemeName } from './themes';
3
3
  import type { DensityMode } from './densityModes';
4
4
  import type { GridApi } from './gridApi.types';
5
+ import type { PivotConfig } from './pivotEngine';
5
6
  export type FilterType = 'text' | 'number' | 'date' | 'set' | 'multi';
6
7
  export interface Column {
7
8
  field: string;
@@ -522,6 +523,7 @@ export interface DataGridProps {
522
523
  marketDataConfig?: MarketDataConfig;
523
524
  contextMenuConfig?: ContextMenuConfig;
524
525
  tooltipConfig?: TooltipConfig;
526
+ pivotConfig?: PivotConfig | null;
525
527
  tableId?: string;
526
528
  theme?: ThemeName;
527
529
  densityMode?: DensityMode;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Pivot Table Demo Page
3
+ *
4
+ * Demonstrates the pivot table functionality with multiple examples
5
+ */
6
+ import React from 'react';
7
+ export declare const PivotDemo: React.FC;
8
+ export default PivotDemo;