serverside_pivot 0.0.90 → 0.0.95
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 +182 -165
- package/dist/react/chunks/{ContextMenu-Bt5_3bmD.mjs → ContextMenu-1G-o1ms9.mjs} +52 -49
- package/dist/react/chunks/{DetailDrawer-DtsvdhO4.mjs → DetailDrawer-DCKIxSpW.mjs} +1 -1
- package/dist/react/chunks/{DetailSidePanel-v_7iU73g.mjs → DetailSidePanel-DgUWPBQk.mjs} +1 -1
- package/dist/react/chunks/{DetailSurfaceContent-BOXVc58A.mjs → DetailSurfaceContent-BEL6xuaZ.mjs} +46 -37
- package/dist/react/chunks/{ECharts2dRenderer-BGL_NVGU.mjs → ECharts2dRenderer-Dgkp9_1P.mjs} +412 -410
- package/dist/react/chunks/{ECharts3dRenderer-BF2YWlsP.mjs → ECharts3dRenderer-70VOp8V0.mjs} +2211 -3197
- package/dist/react/chunks/{EditSidePanel-CuvtsKTK.mjs → EditSidePanel-CygqVXLX.mjs} +77 -65
- package/dist/react/chunks/{InlineDetailPanel-Bmtlu3lc.mjs → InlineDetailPanel-BUBRWdFW.mjs} +1 -1
- package/dist/react/chunks/{PivotCharts-CA3_0bB8.mjs → PivotCharts-VX5-mEEp.mjs} +2206 -1396
- package/dist/react/chunks/{ReportEditor-DYBr0HDz.mjs → ReportEditor-B5j-CU9-.mjs} +614 -319
- package/dist/react/chunks/{SidebarPanel-B64bhrUW.mjs → SidebarPanel-LXUE6nPd.mjs} +1793 -1390
- package/dist/react/chunks/{SparklineDetailGraph-90WjWkhg.mjs → SparklineDetailGraph-Cfe2KcOp.mjs} +88 -58
- package/dist/react/chunks/installCanvasRenderer-C4h5pc1p.mjs +21174 -0
- package/dist/react/chunks/react-CDa-ADnG.mjs +31199 -0
- package/dist/react/chunks/{xlsx.mini.min-BwwnBtoK.mjs → xlsx.mini.min-CzdkdH3N.mjs} +5 -5
- package/dist/react/components/Charts/ChartRenderers.d.ts +5 -73
- package/dist/react/components/Charts/ChartWorkspace.d.ts +3 -34
- package/dist/react/components/Charts/ECharts2dRenderer.d.ts +2 -5
- package/dist/react/components/Charts/ECharts3dRenderer.d.ts +2 -6
- package/dist/react/components/Charts/PivotCharts.d.ts +2 -9
- package/dist/react/components/Charts/chartEnhancements.d.ts +17 -66
- package/dist/react/components/Charts/chartExportPresentation.d.ts +5 -19
- package/dist/react/components/Charts/chartMath.d.ts +4 -4
- package/dist/react/components/Charts/useChartExportMenu.d.ts +4 -12
- package/dist/react/components/DashTanstackPivot.react.d.ts +43 -0
- package/dist/react/components/Filters/ColumnFilter.d.ts +2 -12
- package/dist/react/components/Filters/DateRangeFilter.d.ts +2 -7
- package/dist/react/components/Filters/FilterPopover.d.ts +2 -13
- package/dist/react/components/Filters/MultiSelectFilter.d.ts +2 -11
- package/dist/react/components/Filters/NumericRangeFilter.d.ts +2 -7
- package/dist/react/components/Notification.d.ts +2 -6
- package/dist/react/components/PivotAppBar.d.ts +2 -2
- package/dist/react/components/PivotErrorBoundary.d.ts +11 -7
- package/dist/react/components/PivotSmallComponents.d.ts +2 -3
- package/dist/react/components/PivotWorkspace.d.ts +1 -1
- package/dist/react/components/PivotWorkspaceCanvas.d.ts +2 -5
- package/dist/react/components/PivotWorkspaceControls.d.ts +4 -8
- package/dist/react/components/PivotWorkspaceShell.d.ts +4 -12
- package/dist/react/components/RuntimeDataError.d.ts +2 -7
- package/dist/react/components/Sidebar/ColumnTreeItem.d.ts +2 -13
- package/dist/react/components/Sidebar/ReportEditor.d.ts +7 -20
- package/dist/react/components/Sidebar/SidebarFilterItem.d.ts +2 -13
- package/dist/react/components/Sidebar/SidebarPanel.d.ts +1 -2
- package/dist/react/components/Sidebar/ToolPanelSection.d.ts +2 -13
- package/dist/react/components/Sidebar/customCategoryUtils.d.ts +31 -62
- package/dist/react/components/Sidebar/formulaUtils.d.ts +16 -18
- package/dist/react/components/SkeletonRow.d.ts +2 -5
- package/dist/react/components/Table/ContextMenu.d.ts +2 -8
- package/dist/react/components/Table/DetailDrawer.d.ts +2 -11
- package/dist/react/components/Table/DetailSidePanel.d.ts +2 -11
- package/dist/react/components/Table/DetailSurfaceContent.d.ts +2 -11
- package/dist/react/components/Table/EditSidePanel.d.ts +2 -20
- package/dist/react/components/Table/EditableCell.d.ts +2 -28
- package/dist/react/components/Table/InlineDetailPanel.d.ts +2 -13
- package/dist/react/components/Table/PivotTableBody.d.ts +3 -3
- package/dist/react/components/Table/SparklineCell.d.ts +2 -17
- package/dist/react/components/Table/SparklineDetailGraph.d.ts +2 -5
- package/dist/react/components/Table/StatusBar.d.ts +2 -7
- package/dist/react/contexts/PivotConfigContext.d.ts +5 -33
- package/dist/react/contexts/PivotThemeContext.d.ts +7 -4
- package/dist/react/contexts/PivotValueDisplayContext.d.ts +5 -9
- package/dist/react/hooks/useChartState.d.ts +2 -71
- package/dist/react/hooks/useColumnDefs.d.ts +3 -68
- package/dist/react/hooks/useColumnVirtualizer.d.ts +1 -30
- package/dist/react/hooks/useDetailDrillThrough.d.ts +2 -36
- package/dist/react/hooks/useFilteredData.d.ts +4 -2
- package/dist/react/hooks/useFormatState.d.ts +2 -39
- package/dist/react/hooks/usePersistence.d.ts +4 -5
- package/dist/react/hooks/usePivotFieldInteractions.d.ts +2 -23
- package/dist/react/hooks/usePivotNormalization.d.ts +127 -451
- package/dist/react/hooks/usePivotRenderCounter.d.ts +2 -1
- package/dist/react/hooks/usePivotTransactions.d.ts +2 -23
- package/dist/react/hooks/useRenderHelpers.d.ts +3 -71
- package/dist/react/hooks/useReportMode.d.ts +2 -28
- package/dist/react/hooks/useRowCache.d.ts +16 -15
- package/dist/react/hooks/useRuntimeDataCommit.d.ts +2 -22
- package/dist/react/hooks/useRuntimeProfiling.d.ts +2 -13
- package/dist/react/hooks/useRuntimeTransport.d.ts +2 -18
- package/dist/react/hooks/useServerSideRowModel.d.ts +1 -50
- package/dist/react/hooks/useServerSideViewportController.d.ts +1 -64
- package/dist/react/hooks/useSidebarUI.d.ts +2 -32
- package/dist/react/hooks/useStickyStyles.d.ts +2 -23
- package/dist/react/index.mjs +20 -6
- package/dist/react/presentation/headerFormatting.d.ts +28 -11
- package/dist/react/presentation/safeCellContent.d.ts +22 -5
- package/dist/react/react.d.ts +4 -0
- package/dist/react/runtime/PivotRuntimeRoot.d.ts +1 -1
- package/dist/react/runtime/client/clientPivotTransport.d.ts +32 -0
- package/dist/react/runtime/client/clientResponsePostProcessor.d.ts +70 -0
- package/dist/react/runtime/client/clientSqlPlanner.d.ts +5 -0
- package/dist/react/runtime/client/duckdbWasmExecutor.d.ts +36 -0
- package/dist/react/runtime/client/index.d.ts +6 -0
- package/dist/react/runtime/client/modeResolver.d.ts +16 -0
- package/dist/react/runtime/client/types.d.ts +207 -0
- package/dist/react/runtime/createRuntimeCellPresentation.d.ts +2 -7
- package/dist/react/runtime/createRuntimeExportCommands.d.ts +2 -71
- package/dist/react/runtime/createRuntimeRowPinCommand.d.ts +2 -9
- package/dist/react/runtime/displayColumnOrder.d.ts +4 -4
- package/dist/react/runtime/httpTransport.d.ts +1 -0
- package/dist/react/runtime/runtime-contract.generated.d.ts +3 -0
- package/dist/react/runtime/runtimeContract.d.ts +3 -0
- package/dist/react/runtime/runtimeDomains.d.ts +18 -0
- package/dist/react/runtime/useChartWorkspacePresentation.d.ts +2 -45
- package/dist/react/runtime/useCoreRuntime.d.ts +4 -1
- package/dist/react/runtime/useCoreRuntimeStage.d.ts +1 -1
- package/dist/react/runtime/useRuntimeCellSelection.d.ts +2 -40
- package/dist/react/runtime/useRuntimeChartCanvasCommands.d.ts +7 -31
- package/dist/react/runtime/useRuntimeChartCanvasResize.d.ts +2 -13
- package/dist/react/runtime/useRuntimeChartCanvasVerticalResize.d.ts +2 -9
- package/dist/react/runtime/useRuntimeChartDefinitionCommands.d.ts +2 -14
- package/dist/react/runtime/useRuntimeChartFloatingInteractions.d.ts +2 -28
- package/dist/react/runtime/useRuntimeChartModels.d.ts +2 -62
- package/dist/react/runtime/useRuntimeChartPanelSizing.d.ts +2 -12
- package/dist/react/runtime/useRuntimeChartRequestDispatch.d.ts +2 -4
- package/dist/react/runtime/useRuntimeClipboardExportPresentation.d.ts +2 -152
- package/dist/react/runtime/useRuntimeClipboardPaste.d.ts +2 -7
- package/dist/react/runtime/useRuntimeColorScalePresentation.d.ts +2 -55
- package/dist/react/runtime/useRuntimeColumnAutoSizing.d.ts +2 -26
- package/dist/react/runtime/useRuntimeColumnCommands.d.ts +2 -22
- package/dist/react/runtime/useRuntimeColumnMeasurement.d.ts +2 -11
- package/dist/react/runtime/useRuntimeDataRetry.d.ts +2 -12
- package/dist/react/runtime/useRuntimeDisplayNavigation.d.ts +2 -11
- package/dist/react/runtime/useRuntimeEditCellIdentity.d.ts +2 -18
- package/dist/react/runtime/useRuntimeEditChangeTracking.d.ts +2 -28
- package/dist/react/runtime/useRuntimeEditComparisonState.d.ts +2 -35
- package/dist/react/runtime/useRuntimeEditDispatch.d.ts +2 -43
- package/dist/react/runtime/useRuntimeEditOwnership.d.ts +2 -28
- package/dist/react/runtime/useRuntimeEditPresentation.d.ts +2 -32
- package/dist/react/runtime/useRuntimeEditStatePersistence.d.ts +2 -24
- package/dist/react/runtime/useRuntimeExportState.d.ts +5 -5
- package/dist/react/runtime/useRuntimeFilterPopover.d.ts +2 -19
- package/dist/react/runtime/useRuntimeLayoutHistory.d.ts +2 -40
- package/dist/react/runtime/useRuntimeOptimisticCellState.d.ts +2 -27
- package/dist/react/runtime/useRuntimeRequestSession.d.ts +2 -76
- package/dist/react/runtime/useRuntimeResponseLifecycle.d.ts +2 -43
- package/dist/react/runtime/useRuntimeResponsePostCommit.d.ts +2 -15
- package/dist/react/runtime/useRuntimeRowEditSessions.d.ts +2 -28
- package/dist/react/runtime/useRuntimeRowEditing.d.ts +2 -18
- package/dist/react/runtime/useRuntimeRowSelection.d.ts +2 -14
- package/dist/react/runtime/useRuntimeSelectionFormatting.d.ts +2 -30
- package/dist/react/runtime/useRuntimeStructuralSync.d.ts +2 -58
- package/dist/react/runtime/useRuntimeViewRestoreScroll.d.ts +2 -5
- package/dist/react/runtime/useRuntimeViewSnapshot.d.ts +2 -196
- package/dist/react/runtime/useRuntimeViewportTableData.d.ts +2 -23
- package/dist/react/runtime/useWorkspaceStatusPresentation.d.ts +2 -109
- package/dist/react/utils/Icons.d.ts +2 -45
- package/dist/react/utils/chartModelBuilders.d.ts +76 -230
- package/dist/react/utils/columnOrder.d.ts +8 -12
- package/dist/react/utils/dataBars.d.ts +3 -7
- package/dist/react/utils/domEvents.d.ts +1 -1
- package/dist/react/utils/editing.d.ts +12 -47
- package/dist/react/utils/exportUtils.d.ts +30 -101
- package/dist/react/utils/fieldPanelLayout.d.ts +12 -61
- package/dist/react/utils/filterOptions.d.ts +4 -4
- package/dist/react/utils/helpers.d.ts +16 -18
- package/dist/react/utils/horizontalViewport.d.ts +1 -12
- package/dist/react/utils/layoutRows.d.ts +3 -3
- package/dist/react/utils/measureAxis.d.ts +6 -22
- package/dist/react/utils/pivotLayoutUtils.d.ts +3 -2
- package/dist/react/utils/pivotProfiler.d.ts +3 -3
- package/dist/react/utils/reportEditorSelection.d.ts +1 -23
- package/dist/react/utils/rowSpanning.d.ts +3 -6
- package/dist/react/utils/savedReports.d.ts +4 -7
- package/dist/react/utils/sorting.d.ts +8 -14
- package/dist/react/utils/sparklineDetail.d.ts +5 -8
- package/dist/react/utils/sparklines.d.ts +10 -78
- package/dist/react/utils/styles.d.ts +19 -308
- package/package.json +114 -89
- package/dist/react/chunks/installCanvasRenderer-C8gE9ttC.mjs +0 -21281
- package/dist/react/chunks/react-52jgz-em.mjs +0 -25301
package/README.md
CHANGED
|
@@ -1,165 +1,182 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
[
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
1
|
+
# ⚡ serverside_pivot
|
|
2
|
+
|
|
3
|
+
### **Turnkey Analytical Pivot Table & Virtualized Data Grid for React**
|
|
4
|
+
#### *Dual-Engine Architecture: Zero-Network In-Browser Analytics (DuckDB-WASM & In-Memory) + Scalable Server-Side Pushdown.*
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/serverside_pivot)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://www.typescriptlang.org/)
|
|
9
|
+
[](https://react.dev/)
|
|
10
|
+
[](https://duckdb.org/docs/api/wasm/overview)
|
|
11
|
+
[](https://echarts.apache.org/)
|
|
12
|
+
|
|
13
|
+
`serverside_pivot` is an enterprise-grade, low-code analytical pivot table and 2D virtualized grid for **React**. Built on **TanStack Table v8**, **DuckDB-WASM**, and **Apache ECharts 6**, it bridges the gap between lightweight client tables and heavy server-side BI tools.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🚀 Why `serverside_pivot`?
|
|
18
|
+
|
|
19
|
+
Unlike traditional grid components that either crash browser memory with large datasets or force you to spend months building custom SQL backends:
|
|
20
|
+
|
|
21
|
+
1. **Dual Execution Engine (Hybrid)**:
|
|
22
|
+
- **Client-Side Mode (`DuckDB-WASM` & In-Memory)**: Run complete multi-dimensional pivots, $\mathcal{O}(D)$ level-based hierarchy expansions, multi-column sorting, Excel formulas, window functions, and ECharts visualizations **100% inside the browser with ZERO server roundtrips and zero latency**.
|
|
23
|
+
- **Server-Side Pushdown Mode**: Connect seamlessly to Python backend services (`serverside-pivot`) backed by **Snowflake, BigQuery, PostgreSQL, ClickHouse, MotherDuck, or DuckDB** to query hundreds of millions of rows with bounded 50-row virtual slices.
|
|
24
|
+
2. **2D Virtualization (Row + Column)**: Smoothly virtualizes both vertical rows (millions of records) and horizontal pivoted columns (1,000+ columns) with a **constant < 80 MB client RAM footprint**.
|
|
25
|
+
3. **Turnkey BI Analytics**: Built-in 23+ chart families (ECharts 2D/3D), inline cell sparklines, heatmaps, Excel-like calculated formulas (`[revenue] - [cost]`), window functions (`percent_of_grand_total`), 11 enterprise themes, and client-side SheetJS XLSX/CSV export.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 📦 Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install serverside_pivot
|
|
33
|
+
# or
|
|
34
|
+
yarn add serverside_pivot
|
|
35
|
+
# or
|
|
36
|
+
pnpm add serverside_pivot
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Peer Dependencies
|
|
40
|
+
```bash
|
|
41
|
+
npm install react react-dom styled-components
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## ⚡ Quickstart
|
|
47
|
+
|
|
48
|
+
### 1. Zero-Backend Client-Side Pivot (DuckDB-WASM / In-Memory)
|
|
49
|
+
|
|
50
|
+
Feed your JSON records or CSV/Parquet data directly into `PivotWorkspace`. The internal `ClientPivotTransport` executes all groupings, multi-column aggregations, and expansions in browser WebAssembly:
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import React from 'react';
|
|
54
|
+
import { PivotWorkspace, ClientPivotTransport } from 'serverside_pivot/react';
|
|
55
|
+
|
|
56
|
+
const salesData = [
|
|
57
|
+
{ region: 'North America', country: 'USA', rep: 'Alice', year: '2024', revenue: 150000, cost: 95000 },
|
|
58
|
+
{ region: 'North America', country: 'USA', rep: 'Bob', year: '2025', revenue: 180000, cost: 110000 },
|
|
59
|
+
{ region: 'North America', country: 'Canada', rep: 'Charlie', year: '2024', revenue: 90000, cost: 60000 },
|
|
60
|
+
{ region: 'Europe', country: 'Germany', rep: 'David', year: '2024', revenue: 130000, cost: 85000 },
|
|
61
|
+
{ region: 'Europe', country: 'France', rep: 'Emma', year: '2025', revenue: 140000, cost: 90000 },
|
|
62
|
+
// ... up to 50,000+ rows
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
// Initialize client transport (runs 100% in-browser)
|
|
66
|
+
const clientTransport = new ClientPivotTransport({
|
|
67
|
+
tableName: 'sales',
|
|
68
|
+
data: salesData,
|
|
69
|
+
clientEngine: 'auto', // 'auto' (>= 1000 rows activates DuckDB-Wasm), 'duckdb-wasm', or 'memory'
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export function App() {
|
|
73
|
+
return (
|
|
74
|
+
<div style={{ height: '800px', width: '100%' }}>
|
|
75
|
+
<PivotWorkspace
|
|
76
|
+
table="sales"
|
|
77
|
+
transport={clientTransport}
|
|
78
|
+
rowFields={['region', 'country', 'rep']}
|
|
79
|
+
colFields={['year']}
|
|
80
|
+
valConfigs={[
|
|
81
|
+
{ field: 'revenue', agg: 'sum', format: 'currency', label: 'Revenue ($)' },
|
|
82
|
+
{ field: 'cost', agg: 'sum', format: 'currency', label: 'Cost ($)' },
|
|
83
|
+
{
|
|
84
|
+
field: 'profit',
|
|
85
|
+
label: 'Gross Profit',
|
|
86
|
+
formula: '[revenue] - [cost]',
|
|
87
|
+
format: 'currency',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
field: 'rev_pct',
|
|
91
|
+
label: '% Total Revenue',
|
|
92
|
+
agg: 'sum',
|
|
93
|
+
windowFn: 'percent_of_grand_total',
|
|
94
|
+
format: 'percent',
|
|
95
|
+
},
|
|
96
|
+
]}
|
|
97
|
+
showRowTotals={true}
|
|
98
|
+
showColTotals={true}
|
|
99
|
+
defaultTheme="flash" // 'dark' | 'light' | 'bloomberg_black' | 'flash' | 'material' | ...
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### 2. Scalable Server-Side Pushdown Mode
|
|
109
|
+
|
|
110
|
+
For datasets with millions or billions of rows, connect to any backend implementing the standard V1 runtime protocol:
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import React from 'react';
|
|
114
|
+
import {
|
|
115
|
+
PivotWorkspace,
|
|
116
|
+
HttpPivotTransport,
|
|
117
|
+
LatestViewportScheduler,
|
|
118
|
+
} from 'serverside_pivot/react';
|
|
119
|
+
|
|
120
|
+
// Wraps HTTP requests with auto-cancellation (latest-viewport-wins)
|
|
121
|
+
const transport = new LatestViewportScheduler(
|
|
122
|
+
new HttpPivotTransport({
|
|
123
|
+
endpoint: '/v1/runtime',
|
|
124
|
+
})
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
export function EnterpriseAnalytics() {
|
|
128
|
+
return (
|
|
129
|
+
<div style={{ height: '100vh', width: '100%' }}>
|
|
130
|
+
<PivotWorkspace
|
|
131
|
+
table="warehouse_orders"
|
|
132
|
+
transport={transport}
|
|
133
|
+
rowFields={['department', 'category', 'product']}
|
|
134
|
+
colFields={['quarter']}
|
|
135
|
+
valConfigs={[
|
|
136
|
+
{ field: 'sales_amount', agg: 'sum', format: 'currency' },
|
|
137
|
+
{ field: 'order_count', agg: 'count' },
|
|
138
|
+
]}
|
|
139
|
+
showRowTotals={true}
|
|
140
|
+
showColTotals={true}
|
|
141
|
+
defaultTheme="dark"
|
|
142
|
+
/>
|
|
143
|
+
</div>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## ✨ Key Enterprise Capabilities
|
|
151
|
+
|
|
152
|
+
| Feature | Description |
|
|
153
|
+
| :--- | :--- |
|
|
154
|
+
| **Dual Execution Engine** | Seamlessly toggle between 100% in-browser WebAssembly execution (`ClientPivotTransport`) and server-side warehouse pushdown (`HttpPivotTransport`). |
|
|
155
|
+
| **2D Virtualization** | Constant < 80 MB browser memory whether scrolling through 10,000 rows or 1,000,000,000+ rows with 1,000+ dynamic pivoted columns. |
|
|
156
|
+
| **$\mathcal{O}(D)$ Level-Based Hierarchy** | Multi-level tree group expansions execute one single batched query per hierarchy depth level ($D$) rather than sequential $N$-query waterfalls. |
|
|
157
|
+
| **Visual Analytics & Charting** | Integrated **ECharts 6** & **ECharts-GL 3D**: 23+ chart types across 11 families (Bar, Line, Area, Pie, Radar, Scatter, Waterfall, 3D Bar/Surface) linked to live pivot state. |
|
|
158
|
+
| **In-Cell Sparklines & Data Bars** | High-performance inline SVG sparklines (Line, Area, Bar) and proportional cell data bars rendered directly inside grid cells with zero DOM bloat. |
|
|
159
|
+
| **Excel AST Formulas & Window Functions** | Excel-like calculated measures using `[Field]` syntax and built-in pivot window functions (`percent_of_row`, `percent_of_col`, `percent_of_grand_total`). |
|
|
160
|
+
| **4 Layout Modes** | Multidimensional Pivot (`pivot`), Parent-Child Tree (`tree`), Flat Record Grid (`table`), and Financial P&L Report Mode (`report`). |
|
|
161
|
+
| **Client SheetJS & Clipboard** | Instant client-side Excel XLSX and CSV streaming export with merged headers and formatting preserved. RFC-compliant HTML/TSV clipboard copy. |
|
|
162
|
+
| **11 Enterprise Themes** | Complete theme system: `light`, `dark`, `flash`, `material`, `balham`, `bloomberg`, `bloomberg_black`, `strata`, `crystal`, `alabaster`, `satin` with full `--sp-*` CSS variables. |
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 🌐 Multi-Framework Ecosystem
|
|
167
|
+
|
|
168
|
+
`serverside_pivot` is part of the `serverside-pivot` ecosystem:
|
|
169
|
+
- **Standalone React**: `serverside_pivot` (this package)
|
|
170
|
+
- **Python Plotly Dash**: `pip install serverside-pivot`
|
|
171
|
+
- **Streamlit**: `pip install "serverside-pivot[streamlit]"`
|
|
172
|
+
- **Backend Pushdown**: Powered by **DuckDB**, **PyArrow**, and **Ibis** (Snowflake, BigQuery, Postgres, ClickHouse, MotherDuck, Databricks, Trino)
|
|
173
|
+
|
|
174
|
+
For comprehensive documentation, live Python/Dash showcases, and interactive examples, visit the **[GitHub Repository](https://github.com/Ramzy22/serverside_pivot)**.
|
|
175
|
+
|
|
176
|
+
> Cell editing and edit transactions are not a supported public capability in this release. Legacy edit-related Dash inputs are accepted as no-ops only for layout compatibility.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## 📄 License
|
|
181
|
+
|
|
182
|
+
Distributed under the **MIT License**.
|
|
@@ -1,59 +1,62 @@
|
|
|
1
1
|
import p, { useState as T, useRef as R, useCallback as v, useEffect as B, useLayoutEffect as O } from "react";
|
|
2
|
-
const G = 80, J = 220, N = ({ actions: e, theme: t, onClose: b, itemRefs: f, onItemMouseEnter: g, onKeyDown: D }) => /* @__PURE__ */ p.createElement(p.Fragment, null, e.map(
|
|
3
|
-
|
|
2
|
+
const G = 80, J = 220, N = ({ actions: e, theme: t, onClose: b, itemRefs: f, onItemMouseEnter: g, onKeyDown: D }) => /* @__PURE__ */ p.createElement(p.Fragment, null, e.map(
|
|
3
|
+
/** @param {any} [action] @param {any} [i] @returns {any} */
|
|
4
|
+
(u, o) => {
|
|
5
|
+
if (u === "separator")
|
|
6
|
+
return /* @__PURE__ */ p.createElement(
|
|
7
|
+
"div",
|
|
8
|
+
{
|
|
9
|
+
key: o,
|
|
10
|
+
role: "presentation",
|
|
11
|
+
style: { height: "1px", background: (t == null ? void 0 : t.border) || "#e0e0e0", margin: "4px 0" }
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
const a = !!u.disabled, d = Array.isArray(u.children) && u.children.length > 0;
|
|
4
15
|
return /* @__PURE__ */ p.createElement(
|
|
5
16
|
"div",
|
|
6
17
|
{
|
|
7
18
|
key: o,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
l
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
ref: (l) => {
|
|
20
|
+
f && (f.current[o] = l);
|
|
21
|
+
},
|
|
22
|
+
role: "menuitem",
|
|
23
|
+
"aria-haspopup": d ? "menu" : void 0,
|
|
24
|
+
"aria-disabled": a || void 0,
|
|
25
|
+
tabIndex: a ? -1 : 0,
|
|
26
|
+
title: u.title || (typeof u.label == "string" ? u.label : void 0),
|
|
27
|
+
onMouseEnter: (l) => {
|
|
28
|
+
l.currentTarget.style.backgroundColor = a ? "" : (t == null ? void 0 : t.hover) || "#f5f5f5", g && g(o, d, a);
|
|
29
|
+
},
|
|
30
|
+
onMouseLeave: (l) => {
|
|
31
|
+
l.currentTarget.style.backgroundColor = "";
|
|
32
|
+
},
|
|
33
|
+
onClick: (l) => {
|
|
34
|
+
if (a || d) {
|
|
35
|
+
l.stopPropagation();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
typeof u.onClick == "function" && u.onClick(), b();
|
|
39
|
+
},
|
|
40
|
+
onKeyDown: (l) => {
|
|
41
|
+
a || (l.key === "Enter" || l.key === " " ? (l.preventDefault(), l.stopPropagation(), !d && typeof u.onClick == "function" && u.onClick(), d ? g && g(o, !0, !1) : b()) : D && D(l, o));
|
|
42
|
+
},
|
|
43
|
+
style: {
|
|
44
|
+
padding: "7px 12px 7px 14px",
|
|
45
|
+
cursor: a ? "not-allowed" : "pointer",
|
|
46
|
+
display: "flex",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
gap: "8px",
|
|
49
|
+
color: a ? (t == null ? void 0 : t.textSec) || "#757575" : (t == null ? void 0 : t.text) || "#111",
|
|
50
|
+
opacity: a ? 0.48 : 1,
|
|
51
|
+
userSelect: "none"
|
|
35
52
|
}
|
|
36
|
-
typeof u.onClick == "function" && u.onClick(), b();
|
|
37
|
-
},
|
|
38
|
-
onKeyDown: (l) => {
|
|
39
|
-
a || (l.key === "Enter" || l.key === " " ? (l.preventDefault(), l.stopPropagation(), !d && typeof u.onClick == "function" && u.onClick(), d ? g && g(o, !0, !1) : b()) : D && D(l, o));
|
|
40
53
|
},
|
|
41
|
-
style: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
color: a ? (t == null ? void 0 : t.textSec) || "#757575" : (t == null ? void 0 : t.text) || "#111",
|
|
48
|
-
opacity: a ? 0.48 : 1,
|
|
49
|
-
userSelect: "none"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
u.icon && /* @__PURE__ */ p.createElement("span", { style: { color: (t == null ? void 0 : t.textSec) || "#757575", display: "flex", flexShrink: 0 } }, u.icon),
|
|
53
|
-
/* @__PURE__ */ p.createElement("span", { style: { flex: 1 } }, u.label),
|
|
54
|
-
d && /* @__PURE__ */ p.createElement("span", { style: { color: (t == null ? void 0 : t.textSec) || "#9ca3af", fontSize: "10px", marginLeft: "4px" } }, "▶")
|
|
55
|
-
);
|
|
56
|
-
})), U = (e) => ({
|
|
54
|
+
u.icon && /* @__PURE__ */ p.createElement("span", { style: { color: (t == null ? void 0 : t.textSec) || "#757575", display: "flex", flexShrink: 0 } }, u.icon),
|
|
55
|
+
/* @__PURE__ */ p.createElement("span", { style: { flex: 1 } }, u.label),
|
|
56
|
+
d && /* @__PURE__ */ p.createElement("span", { style: { color: (t == null ? void 0 : t.textSec) || "#9ca3af", fontSize: "10px", marginLeft: "4px" } }, "▶")
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
)), U = (e) => ({
|
|
57
60
|
background: (e == null ? void 0 : e.surfaceBg) || (e == null ? void 0 : e.background) || "#fff",
|
|
58
61
|
border: `1px solid ${(e == null ? void 0 : e.border) || "#ccc"}`,
|
|
59
62
|
boxShadow: (e == null ? void 0 : e.shadowMd) || "0 4px 20px rgba(0,0,0,0.15)",
|
package/dist/react/chunks/{DetailSurfaceContent-BOXVc58A.mjs → DetailSurfaceContent-BEL6xuaZ.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import t, { useState as m, useEffect as D } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { z as B } from "./react-CDa-ADnG.mjs";
|
|
3
3
|
function M({
|
|
4
4
|
detailState: o,
|
|
5
5
|
onClose: C,
|
|
@@ -103,27 +103,30 @@ function M({
|
|
|
103
103
|
height: "100%",
|
|
104
104
|
color: e.textSec,
|
|
105
105
|
fontSize: "13px"
|
|
106
|
-
} }, "Loading detail...") : /* @__PURE__ */ t.createElement("table", { style: { width: "100%", borderCollapse: "collapse", fontSize: "12px" } }, /* @__PURE__ */ t.createElement("thead", null, /* @__PURE__ */ t.createElement("tr", null, g.map(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
106
|
+
} }, "Loading detail...") : /* @__PURE__ */ t.createElement("table", { style: { width: "100%", borderCollapse: "collapse", fontSize: "12px" } }, /* @__PURE__ */ t.createElement("thead", null, /* @__PURE__ */ t.createElement("tr", null, g.map(
|
|
107
|
+
/** @param {any} [columnId] @returns {any} */
|
|
108
|
+
(r) => /* @__PURE__ */ t.createElement(
|
|
109
|
+
"th",
|
|
110
|
+
{
|
|
111
|
+
key: r,
|
|
112
|
+
onClick: () => z(r),
|
|
113
|
+
style: {
|
|
114
|
+
position: "sticky",
|
|
115
|
+
top: 0,
|
|
116
|
+
zIndex: 1,
|
|
117
|
+
textAlign: "left",
|
|
118
|
+
padding: n ? "8px 10px" : "10px 12px",
|
|
119
|
+
background: e.headerBg,
|
|
120
|
+
color: e.text,
|
|
121
|
+
borderBottom: `1px solid ${e.border}`,
|
|
122
|
+
cursor: i ? "pointer" : "default",
|
|
123
|
+
whiteSpace: "nowrap"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
r,
|
|
127
|
+
w === r ? v === "asc" ? " ▲" : " ▼" : ""
|
|
128
|
+
)
|
|
129
|
+
))), /* @__PURE__ */ t.createElement("tbody", null, p.length === 0 ? /* @__PURE__ */ t.createElement("tr", null, /* @__PURE__ */ t.createElement(
|
|
127
130
|
"td",
|
|
128
131
|
{
|
|
129
132
|
colSpan: Math.max(g.length, 1),
|
|
@@ -135,21 +138,27 @@ function M({
|
|
|
135
138
|
}
|
|
136
139
|
},
|
|
137
140
|
"No detail rows"
|
|
138
|
-
)) : p.map(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
141
|
+
)) : p.map(
|
|
142
|
+
/** @param {any} [row] @param {any} [index] @returns {any} */
|
|
143
|
+
(r, f) => /* @__PURE__ */ t.createElement("tr", { key: `${o.rowKey || u || "detail"}:${f}`, style: {
|
|
144
|
+
background: f % 2 === 0 ? e.surfaceBg || e.background : e.headerSubtleBg
|
|
145
|
+
} }, g.map(
|
|
146
|
+
/** @param {any} [columnId] @returns {any} */
|
|
147
|
+
(d) => /* @__PURE__ */ t.createElement(
|
|
148
|
+
"td",
|
|
149
|
+
{
|
|
150
|
+
key: `${d}:${f}`,
|
|
151
|
+
style: {
|
|
152
|
+
padding: n ? "7px 10px" : "9px 12px",
|
|
153
|
+
borderBottom: `1px solid ${e.border}`,
|
|
154
|
+
color: e.text,
|
|
155
|
+
whiteSpace: "nowrap"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
r[d] !== void 0 && r[d] !== null ? String(r[d]) : ""
|
|
159
|
+
)
|
|
160
|
+
))
|
|
161
|
+
)))), /* @__PURE__ */ t.createElement("div", { style: {
|
|
153
162
|
display: "flex",
|
|
154
163
|
alignItems: "center",
|
|
155
164
|
justifyContent: "space-between",
|