serverside_pivot 0.0.95 → 0.0.96
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/react/chunks/ContextMenu-DJuS4qTZ.mjs +198 -0
- package/dist/react/chunks/{DetailDrawer-DCKIxSpW.mjs → DetailDrawer-DgKSC5Vu.mjs} +1 -1
- package/dist/react/chunks/{DetailSidePanel-DgUWPBQk.mjs → DetailSidePanel-CC5Dugyl.mjs} +1 -1
- package/dist/react/chunks/{DetailSurfaceContent-BEL6xuaZ.mjs → DetailSurfaceContent-CrQVHlcU.mjs} +52 -53
- package/dist/react/chunks/{ECharts2dRenderer-Dgkp9_1P.mjs → ECharts2dRenderer-46gLrUdf.mjs} +1 -1
- package/dist/react/chunks/{ECharts3dRenderer-70VOp8V0.mjs → ECharts3dRenderer-Dg4ta5Bl.mjs} +1 -1
- package/dist/react/chunks/{EditSidePanel-CygqVXLX.mjs → EditSidePanel-CkShaByb.mjs} +1 -1
- package/dist/react/chunks/{InlineDetailPanel-BUBRWdFW.mjs → InlineDetailPanel-mnwjoD0I.mjs} +1 -1
- package/dist/react/chunks/{PivotCharts-VX5-mEEp.mjs → PivotCharts-MX-Z7DlR.mjs} +1207 -1193
- package/dist/react/chunks/{ReportEditor-B5j-CU9-.mjs → ReportEditor-U0E42xKL.mjs} +506 -480
- package/dist/react/chunks/SidebarPanel-BzRW1Kgq.mjs +3944 -0
- package/dist/react/chunks/{SparklineDetailGraph-Cfe2KcOp.mjs → SparklineDetailGraph-35Tim_8B.mjs} +1 -1
- package/dist/react/chunks/{installCanvasRenderer-C4h5pc1p.mjs → installCanvasRenderer-DRq0xpXO.mjs} +1 -1
- package/dist/react/chunks/react-CL4GbEOd.mjs +33206 -0
- package/dist/react/chunks/{xlsx.mini.min-CzdkdH3N.mjs → xlsx.mini.min-kfIgXMVB.mjs} +1 -1
- package/dist/react/components/DashTanstackPivot.react.d.ts +4 -0
- package/dist/react/components/ShimmerFallback.d.ts +11 -0
- package/dist/react/components/ThemedSelect.d.ts +8 -0
- package/dist/react/contexts/PivotThemeContext.d.ts +1 -0
- package/dist/react/hooks/useColumnDefs.d.ts +1 -1
- package/dist/react/hooks/useRenderHelpers.d.ts +1 -1
- package/dist/react/hooks/useServerSideRowModel.d.ts +1 -1
- package/dist/react/index.mjs +5 -5
- package/dist/react/react.d.ts +1 -1
- package/dist/react/runtime/client/clientPivotTransport.d.ts +1 -0
- package/dist/react/runtime/client/duckdbWasmExecutor.d.ts +3 -0
- package/dist/react/runtime/client/types.d.ts +12 -0
- package/dist/react/runtime/runtimeDomains.d.ts +94 -2
- package/dist/react/runtime/useRuntimeColumnAutoSizing.d.ts +1 -1
- package/dist/react/runtime/useRuntimeViewSnapshot.d.ts +1 -1
- package/dist/react/utils/dataBars.d.ts +1 -0
- package/dist/react/utils/domEvents.d.ts +1 -0
- package/dist/react/utils/helpers.d.ts +5 -0
- package/dist/react/utils/pivotLayoutUtils.d.ts +4 -0
- package/dist/react/utils/sorting.d.ts +1 -1
- package/package.json +1 -1
- package/dist/react/chunks/ContextMenu-1G-o1ms9.mjs +0 -195
- package/dist/react/chunks/SidebarPanel-LXUE6nPd.mjs +0 -3742
- package/dist/react/chunks/react-CDa-ADnG.mjs +0 -31199
|
@@ -126,6 +126,8 @@ export interface DashValueConfig {
|
|
|
126
126
|
headerBg?: string;
|
|
127
127
|
headerColor?: string;
|
|
128
128
|
headerTextColor?: string;
|
|
129
|
+
displayVariant?: string;
|
|
130
|
+
dataBars?: boolean;
|
|
129
131
|
sparkline?: boolean | object;
|
|
130
132
|
}
|
|
131
133
|
/** Chart visual settings stored on a chart-canvas pane. */
|
|
@@ -219,6 +221,8 @@ declare namespace DashTanstackPivot {
|
|
|
219
221
|
headerBg: PropTypes.Requireable<string>;
|
|
220
222
|
headerColor: PropTypes.Requireable<string>;
|
|
221
223
|
headerTextColor: PropTypes.Requireable<string>;
|
|
224
|
+
displayVariant: PropTypes.Requireable<string>;
|
|
225
|
+
dataBars: PropTypes.Requireable<boolean>;
|
|
222
226
|
sparkline: PropTypes.Requireable<NonNullable<boolean | object | null | undefined>>;
|
|
223
227
|
}> | null | undefined)[]>;
|
|
224
228
|
measureAxis: PropTypes.Requireable<PropTypes.InferProps<{
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight Apple-style shimmer skeleton used as Suspense fallback for lazy UI panels.
|
|
3
|
+
* @param {{ variant?: string, height?: any, width?: any, style?: any }} [props]
|
|
4
|
+
* @returns {any}
|
|
5
|
+
*/
|
|
6
|
+
export default function ShimmerFallback({ variant, height, width, style }?: {
|
|
7
|
+
variant?: string;
|
|
8
|
+
height?: any;
|
|
9
|
+
width?: any;
|
|
10
|
+
style?: any;
|
|
11
|
+
}): any;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default ThemedSelect;
|
|
2
|
+
/**
|
|
3
|
+
* Accessible custom themed dropdown replacing native <select> elements.
|
|
4
|
+
* Supports both an `options` array and standard JSX `<option>`/`<optgroup>` children,
|
|
5
|
+
* emitting a synthetic `{ target: { value }, currentTarget: { value } }` event to `onChange`.
|
|
6
|
+
* @type {any}
|
|
7
|
+
*/
|
|
8
|
+
declare const ThemedSelect: any;
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* isColExpanded, toggleCol, pendingRowTransitions: read at render time
|
|
14
14
|
* from current scope; same stable-ref / render-time-read pattern
|
|
15
15
|
@param {any} p0 @returns {any} */
|
|
16
|
-
export function useColumnDefs({ sortOptions, sorting, serverSide, showRowNumbers, layoutMode, viewMode, rowFields, colFields, valConfigs, customDimensions, treeConfig, minMax, colorScaleMode, colExpanded, isRowSelecting, rowDragStart, props, measureAxis, cachedColSchema, responseColumns, filteredData, rowCount, theme, defaultColumnWidths, validationRules, onCellEdit, onEditBlocked, resolveEditorPresentation, rowEditMode, getRowEditSession, onRequestRowStart, onRowDraftChange, onRequestRowSave, onRequestRowCancel, requestEditorOptions, renderRowEditActions, handleContextMenu, handleRowSelect, handleRowRangeSelect, setIsRowSelecting, setRowDragStart, renderedOffset, isColExpanded, toggleCol, pendingRowTransitions, decimalPlaces, defaultValueFormat, numberGroupSeparator, columnDecimalOverrides, columnFormatOverrides, columnGroupSeparatorOverrides, cellFormatRules, pivotMode, reportDef, showReportConfigColumn, onConfigureReportLine, detailMode, isDetailOpenForRow, onToggleDetail, resolveCellDisplayValue, editValueDisplayMode, openSparklineDataModalRef, rowCheckboxSelection, selectedRowKeys, toggleRowCheckbox, themeRef, dataBarsColumnsRef, rowHeaderLabel, measureGroups, valueScale, unitSuffix, }: any): any;
|
|
16
|
+
export function useColumnDefs({ sortOptions, sorting, serverSide, showRowNumbers, layoutMode, viewMode, rowFields, colFields, valConfigs, customDimensions, treeConfig, minMax, colorScaleMode, colExpanded, isRowSelecting, rowDragStart, props, measureAxis, cachedColSchema, responseColumns, filteredData, rowCount, theme, defaultColumnWidths, validationRules, onCellEdit, onEditBlocked, resolveEditorPresentation, rowEditMode, getRowEditSession, onRequestRowStart, onRowDraftChange, onRequestRowSave, onRequestRowCancel, requestEditorOptions, renderRowEditActions, handleContextMenu, handleRowSelect, handleRowRangeSelect, setIsRowSelecting, setRowDragStart, renderedOffset, isColExpanded, toggleCol, pendingRowTransitions, pendingRowTransitionsRef, decimalPlaces, defaultValueFormat, numberGroupSeparator, columnDecimalOverrides, columnFormatOverrides, columnGroupSeparatorOverrides, cellFormatRules, pivotMode, reportDef, showReportConfigColumn, onConfigureReportLine, detailMode, isDetailOpenForRow, onToggleDetail, resolveCellDisplayValue, editValueDisplayMode, openSparklineDataModalRef, rowCheckboxSelection, selectedRowKeys, toggleRowCheckbox, themeRef, dataBarsColumnsRef, rowHeaderLabel, measureGroups, valueScale, unitSuffix, }: any): any;
|
|
17
17
|
export function applyMeasureHeaderGroups(cols?: any, idPrefix?: any): any;
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* hoveredHeaderId, focusedHeaderId, theme — all are read synchronously when
|
|
14
14
|
* renderHeaderCell is called, capturing the value from the current render pass.
|
|
15
15
|
@param {any} p0 @returns {any} */
|
|
16
|
-
export function useRenderHelpers({ serverSide, selectedCells, fillRange, dragStart, theme, getStickyStyle, isDarkTheme, handleCellMouseDown, handleCellMouseEnter, handleContextMenu, handleFillMouseDown, visibleLeafColIndexMap, lastSelected, styles, getConditionalStyle, rowHeight, headerHeight: headerHeightProp, rowFields, tableRef, leftCols, centerCols, rightCols, columnPinning, sorting, handleHeaderContextMenu, autoSizeColumn, autoSizeBounds, hoveredHeaderIdRef, setHoveredHeaderId, focusedHeaderIdRef, setFocusedHeaderId, onDragStart, onHeaderDrop, onHeaderDragOver, onHeaderDragEnd, onHeaderKeyboardMove, onHeaderKeyboardPin, dragOverHeaderId, dragOverSide, handleFilterClick, handleHeaderFilter, activeFilterCol, filterAnchorEl, closeFilterPopover, activeFilterOptions, activeFilterOptionMeta, requestFilterOptions, filters, selectedCols, getHeaderStickyStyle, dataBarsColumns, dataBarMaximums, colorScaleStats, cellFormatRules, resolveEditedCellMarker, resolveCellDisplayValue, editedCellEpoch, headerFormatting, getLocaleText, wrapHeaders, table, selectedRowKeys, toggleRowCheckbox, rowCheckboxMode, }: any): any;
|
|
16
|
+
export function useRenderHelpers({ serverSide, selectedCells, fillRange, dragStart, theme, getStickyStyle, isDarkTheme, handleCellMouseDown, handleCellMouseEnter, handleContextMenu, handleFillMouseDown, visibleLeafColIndexMap, lastSelected, styles, getConditionalStyle, rowHeight, headerHeight: headerHeightProp, rowFields, tableRef, leftCols, centerCols, rightCols, columnPinning, sorting, sortOptions, fontFamily, fontSize, handleHeaderContextMenu, autoSizeColumn, autoSizeBounds, hoveredHeaderIdRef, setHoveredHeaderId, focusedHeaderIdRef, setFocusedHeaderId, onDragStart, onHeaderDrop, onHeaderDragOver, onHeaderDragEnd, onHeaderKeyboardMove, onHeaderKeyboardPin, dragOverHeaderId, dragOverSide, handleFilterClick, handleHeaderFilter, activeFilterCol, filterAnchorEl, closeFilterPopover, activeFilterOptions, activeFilterOptionMeta, requestFilterOptions, filters, selectedCols, getHeaderStickyStyle, dataBarsColumns, dataBarMaximums, dataBarVariant, colorScaleStats, cellFormatRules, resolveEditedCellMarker, resolveCellDisplayValue, editedCellEpoch, headerFormatting, getLocaleText, wrapHeaders, table, selectedRowKeys, toggleRowCheckbox, rowCheckboxMode, }: any): any;
|
|
17
17
|
export function resolveHeaderRowSpan(header?: any): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function useServerSideRowModel({ parentRef, serverSide, rowCount, rowHeight, data, dataOffset, dataVersion, dataStateEpoch, setProps, blockSize, maxBlocksInCache, blockLoadDebounceMs, rowOverscan, prefetchColumns, estimateRowHeight, keyMapper, cacheKey, excludeGrandTotal, immersiveMode, stateEpoch, sessionId, clientInstance, tableName, abortGeneration, structuralInFlight, requestVersionRef: externalRequestVersionRef, colStart, colEnd, responseColStart, responseColEnd, needsColSchema, columnRangeUrgencyToken, onViewportRequest, layoutMode, showSubtotals, layoutRequestFields, }: any): any;
|
|
1
|
+
export function useServerSideRowModel({ parentRef, serverSide, rowCount, rowHeight, data, dataOffset, dataVersion, dataStateEpoch, setProps, blockSize, maxBlocksInCache, blockLoadDebounceMs, rowOverscan, prefetchColumns, estimateRowHeight, keyMapper, cacheKey, excludeGrandTotal, immersiveMode, stateEpoch, sessionId, clientInstance, tableName, abortGeneration, structuralInFlight, stateEpochRef, structuralPendingVersionRef, requestVersionRef: externalRequestVersionRef, colStart, colEnd, responseColStart, responseColEnd, needsColSchema, columnRangeUrgencyToken, onViewportRequest, layoutMode, showSubtotals, layoutRequestFields, }: any): any;
|
package/dist/react/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aq as s, ar as t, as as o, at as i, au as r, av as n, aw as l, ax as u, ay as c, az as m, aA as p, aB as v, aC as d, aD as C, aE as h, aF as E, aG as P, aH as T, aI as x } from "./chunks/react-CL4GbEOd.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ClientPivotTransport,
|
|
4
4
|
t as ClientResponsePostProcessor,
|
|
@@ -7,10 +7,10 @@ export {
|
|
|
7
7
|
r as HttpPivotTransport,
|
|
8
8
|
n as LatestViewportScheduler,
|
|
9
9
|
l as PivotWorkspace,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
u as buildThemeCssVars,
|
|
11
|
+
c as computeFitToWidthLayout,
|
|
12
|
+
m as formatValue,
|
|
13
|
+
p as injectThemeCssVars,
|
|
14
14
|
v as isDisplayNegative,
|
|
15
15
|
d as normalizeClientEngineKind,
|
|
16
16
|
C as normalizeExecutionMode,
|
package/dist/react/react.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export { isDisplayNegative, formatValue, scaleValueForDisplay } from './utils/he
|
|
|
7
7
|
export { computeFitToWidthLayout } from './utils/pivotLayoutUtils';
|
|
8
8
|
export { ClientPivotTransport, DuckDbWasmExecutor, ClientSqlPlanner, ClientResponsePostProcessor, resolveExecutionMode, resolveClientEngineKind, normalizeExecutionMode, normalizeClientEngineKind, type ExecutionMode, type ClientEngineKind, type ClientRuntimeConfig, type ClientEngineTelemetry, type LogicalPivotPlan, } from './runtime/client/index';
|
|
9
9
|
export type { PivotWorkspaceProps } from './components/PivotWorkspace';
|
|
10
|
-
export type { PivotRuntimeProps, PivotThemeName, PivotValueConfig, ValConfig, FilterCondition, FilterConfig, SortConfig, ChartDefinition, } from './runtime/runtimeDomains';
|
|
10
|
+
export type { PivotRuntimeProps, PivotThemeName, PivotThemeOverrides, PivotValueConfig, ValConfig, FilterCondition, FilterConfig, SortConfig, ChartDefinition, } from './runtime/runtimeDomains';
|
|
11
11
|
export type { RuntimeRequestV1, RuntimeResponseV1, RuntimeRequestSchemaV1, RuntimeResponseSchemaV1, } from './runtime/runtimeContract';
|
|
@@ -20,6 +20,7 @@ export declare class ClientPivotTransport implements ClientPivotTransportInterfa
|
|
|
20
20
|
getData(): Array<{
|
|
21
21
|
[key: string]: unknown;
|
|
22
22
|
}>;
|
|
23
|
+
getAvailableFields(): string[];
|
|
23
24
|
updateConfig(config: Partial<ClientRuntimeConfig>): void;
|
|
24
25
|
getTelemetry(): ClientEngineTelemetry;
|
|
25
26
|
private retainExportPayload;
|
|
@@ -18,6 +18,8 @@ export declare class DuckDbWasmExecutor {
|
|
|
18
18
|
private dbInstance;
|
|
19
19
|
private dbConn;
|
|
20
20
|
private registeredTableSignature;
|
|
21
|
+
private preparedCache;
|
|
22
|
+
private cachedAvailableFields;
|
|
21
23
|
private telemetry;
|
|
22
24
|
constructor(initialRows?: Array<{
|
|
23
25
|
[key: string]: unknown;
|
|
@@ -28,6 +30,7 @@ export declare class DuckDbWasmExecutor {
|
|
|
28
30
|
getData(): Array<{
|
|
29
31
|
[key: string]: unknown;
|
|
30
32
|
}>;
|
|
33
|
+
getAvailableFields(): string[];
|
|
31
34
|
updateConfig(config: Partial<ClientRuntimeConfig>): void;
|
|
32
35
|
getTelemetry(): ClientEngineTelemetry;
|
|
33
36
|
private tryInitializeWasm;
|
|
@@ -13,8 +13,10 @@ export interface ClientRuntimeConfig {
|
|
|
13
13
|
duckdbWasmCdnUrl?: string;
|
|
14
14
|
duckdbBundleUrl?: string;
|
|
15
15
|
duckdbWasmInstance?: unknown;
|
|
16
|
+
duckdbLoader?: () => Promise<unknown>;
|
|
16
17
|
legacyClientTable?: boolean;
|
|
17
18
|
tableName?: string;
|
|
19
|
+
showGrandTotal?: boolean;
|
|
18
20
|
xlsxLoader?: () => Promise<unknown>;
|
|
19
21
|
}
|
|
20
22
|
export interface ClientEngineTelemetry {
|
|
@@ -32,6 +34,7 @@ export interface NormalizedValConfig {
|
|
|
32
34
|
agg: string;
|
|
33
35
|
id: string;
|
|
34
36
|
label: string;
|
|
37
|
+
shortLabel?: string;
|
|
35
38
|
weightField?: string;
|
|
36
39
|
windowFn?: string;
|
|
37
40
|
formula?: string;
|
|
@@ -101,6 +104,13 @@ export interface LogicalPivotPlan {
|
|
|
101
104
|
absoluteSort?: boolean;
|
|
102
105
|
};
|
|
103
106
|
};
|
|
107
|
+
columnOptions?: {
|
|
108
|
+
[key: string]: {
|
|
109
|
+
sortType?: string;
|
|
110
|
+
sortKeyField?: string;
|
|
111
|
+
absoluteSort?: boolean;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
104
114
|
};
|
|
105
115
|
expandedAll: boolean;
|
|
106
116
|
expandedPaths: string[][];
|
|
@@ -167,6 +177,7 @@ export interface ClientExecutedDataset {
|
|
|
167
177
|
allRows: Array<{
|
|
168
178
|
[key: string]: unknown;
|
|
169
179
|
}>;
|
|
180
|
+
availableFields?: string[];
|
|
170
181
|
colCombinations: string[];
|
|
171
182
|
engineUsed: 'duckdb-wasm' | 'memory';
|
|
172
183
|
executionMs: number;
|
|
@@ -201,6 +212,7 @@ export interface ClientPivotTransportInterface extends PivotTransport {
|
|
|
201
212
|
setData: (rows: Array<{
|
|
202
213
|
[key: string]: unknown;
|
|
203
214
|
}>) => void;
|
|
215
|
+
getAvailableFields?: () => string[];
|
|
204
216
|
updateConfig: (config: Partial<ClientRuntimeConfig>) => void;
|
|
205
217
|
getTelemetry: () => ClientEngineTelemetry;
|
|
206
218
|
queryDrillThrough: (query: DrillThroughQuery) => Promise<DrillThroughResult>;
|
|
@@ -20,6 +20,8 @@ export interface PivotRuntimeProps {
|
|
|
20
20
|
showRowTotals?: boolean;
|
|
21
21
|
showColTotals?: boolean;
|
|
22
22
|
showSubtotals?: boolean;
|
|
23
|
+
/** Controls Grand Total row visibility in pivot, tree, and report modes. Defaults to `showColTotals` in pivot/report mode or `treeConfig.showGrandTotal` in tree mode. */
|
|
24
|
+
showGrandTotal?: boolean;
|
|
23
25
|
grandTotalPosition?: 'top' | 'bottom';
|
|
24
26
|
runtimeRequest?: PivotObject;
|
|
25
27
|
runtimeResponse?: RuntimeResponseV1 | PivotObject;
|
|
@@ -66,7 +68,7 @@ export interface PivotRuntimeProps {
|
|
|
66
68
|
sortLock?: boolean;
|
|
67
69
|
defaultTheme?: PivotThemeName;
|
|
68
70
|
theme?: PivotThemeName;
|
|
69
|
-
themeOverrides?: PivotObject;
|
|
71
|
+
themeOverrides?: PivotThemeOverrides | PivotObject;
|
|
70
72
|
loadWebFonts?: boolean;
|
|
71
73
|
immersiveExitPosition?: 'top-right' | 'bottom-right' | 'hidden';
|
|
72
74
|
groupAllowUnbalanced?: boolean;
|
|
@@ -75,7 +77,14 @@ export interface PivotRuntimeProps {
|
|
|
75
77
|
rowHeaderLabel?: string | ((rowFields: readonly string[]) => string);
|
|
76
78
|
valueScale?: number;
|
|
77
79
|
unitSuffix?: string;
|
|
78
|
-
|
|
80
|
+
/** Fits all columns into container width. Accepts `true` or `{ enabled?: boolean; minFontSize?: number }`. */
|
|
81
|
+
fitToWidth?: boolean | {
|
|
82
|
+
enabled?: boolean;
|
|
83
|
+
minFontSize?: number;
|
|
84
|
+
};
|
|
85
|
+
/** Minimum font size (px) when `fitToWidth` scales text down. Can also be set via `themeOverrides.minFontSize`. Defaults to `10`. */
|
|
86
|
+
minFontSize?: number;
|
|
87
|
+
fitMinFontSize?: number;
|
|
79
88
|
autoSizeStrategy?: 'fitGridWidth' | 'fitCellContents' | string;
|
|
80
89
|
duckdbBundleUrl?: string;
|
|
81
90
|
sortEvent?: PivotObject;
|
|
@@ -95,6 +104,7 @@ export interface PivotRuntimeRow {
|
|
|
95
104
|
}
|
|
96
105
|
export type PivotThemeName = 'flash' | 'dark' | 'bloomberg_black' | 'bloomberg' | 'light' | 'material' | 'balham' | 'strata' | 'crystal' | 'alabaster' | 'satin' | (string & {});
|
|
97
106
|
export interface ValConfig {
|
|
107
|
+
id?: string;
|
|
98
108
|
field?: string;
|
|
99
109
|
agg?: 'sum' | 'avg' | 'count' | 'min' | 'max' | 'weighted_avg' | 'wavg' | 'weighted_mean' | 'array_agg' | 'formula' | (string & {});
|
|
100
110
|
weightField?: string;
|
|
@@ -104,6 +114,11 @@ export interface ValConfig {
|
|
|
104
114
|
separator?: string;
|
|
105
115
|
formula?: string;
|
|
106
116
|
label?: string;
|
|
117
|
+
/** Compact header label used when the column is narrow (`< 80px` or narrower than full header label). */
|
|
118
|
+
shortLabel?: string;
|
|
119
|
+
headerGroup?: string;
|
|
120
|
+
valueScale?: number;
|
|
121
|
+
unitSuffix?: string;
|
|
107
122
|
formulaRef?: string;
|
|
108
123
|
formulaScope?: 'measures' | 'columns';
|
|
109
124
|
headerStyle?: React.CSSProperties | PivotObject;
|
|
@@ -113,6 +128,81 @@ export interface ValConfig {
|
|
|
113
128
|
sparkline?: boolean | PivotObject;
|
|
114
129
|
[key: string]: unknown;
|
|
115
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Theme token overrides accepted by `themeOverrides`.
|
|
133
|
+
*
|
|
134
|
+
* Surface mapping:
|
|
135
|
+
* - Grid & chrome: `pageBg` / `background` (outer frame), `surfaceBg` (default cells), `headerBg` (top bar & regular column headers), `headerGroupBg` / `headerGroupText` (multi-level group headers, falling back to `headerSubtleBg` / `headerBg`).
|
|
136
|
+
* - Row-header / hierarchy column: `hierarchyBg` drives the `hierarchy` column header and body fallback; derives from overridden `headerSubtleBg` / `headerBg` / `surfaceInset` or `primary` when not explicitly set.
|
|
137
|
+
* - Body rows: `groupBg` / `groupText` / `groupFontWeight` (depth arrays or single values for parent/group rows) and `leafBg` / `leafFontWeight` (leaf rows).
|
|
138
|
+
* - Totals & pinned Grand Total: `totalBg` / `totalText` style subtotals & total columns; `totalBgStrong` / `totalTextStrong` style the pinned/summary Grand Total row (deriving from overridden `totalBg` / `totalText` when not explicitly set).
|
|
139
|
+
* - Headers & fitting: `headerWrap` (wraps on spaces), `headerControls` (`'always' | 'hover' | 'never'`), `showAbsoluteSortBadge`, `fontSize`, `minFontSize`.
|
|
140
|
+
*/
|
|
141
|
+
export interface PivotThemeOverrides {
|
|
142
|
+
/** Outer brand accent & sort/focus border highlight. */
|
|
143
|
+
primary?: string;
|
|
144
|
+
border?: string;
|
|
145
|
+
borderStrong?: string;
|
|
146
|
+
pageBg?: string;
|
|
147
|
+
background?: string;
|
|
148
|
+
surfaceBg?: string;
|
|
149
|
+
surfaceMuted?: string;
|
|
150
|
+
surfaceInset?: string;
|
|
151
|
+
sidebarBg?: string;
|
|
152
|
+
/** Column header & app-bar background; also drives `hierarchyBg` fallback when overridden. */
|
|
153
|
+
headerBg?: string;
|
|
154
|
+
headerSubtleBg?: string;
|
|
155
|
+
headerGroupBg?: string;
|
|
156
|
+
headerGroupText?: string;
|
|
157
|
+
/** Row-header (`hierarchy`) column & header background. Derives from `headerBg`/`headerSubtleBg` when omitted. */
|
|
158
|
+
hierarchyBg?: string;
|
|
159
|
+
/** Depth-indexed or scalar fill for expandable parent rows. */
|
|
160
|
+
groupBg?: string | readonly string[];
|
|
161
|
+
groupText?: string | readonly string[];
|
|
162
|
+
groupFontWeight?: number | readonly number[];
|
|
163
|
+
/** Fill and weight for leaf rows. */
|
|
164
|
+
leafBg?: string;
|
|
165
|
+
leafFontWeight?: number;
|
|
166
|
+
/** Fill and text for subtotal rows & total columns; also drives `totalBgStrong`/`totalTextStrong` when omitted. */
|
|
167
|
+
totalBg?: string;
|
|
168
|
+
totalText?: string;
|
|
169
|
+
/** Fill and text for pinned / summary Grand Total rows & group headers. */
|
|
170
|
+
totalBgStrong?: string;
|
|
171
|
+
totalTextStrong?: string;
|
|
172
|
+
totalBorder?: string;
|
|
173
|
+
totalFontWeight?: number;
|
|
174
|
+
text?: string;
|
|
175
|
+
textSec?: string;
|
|
176
|
+
textSoft?: string;
|
|
177
|
+
hover?: string;
|
|
178
|
+
hoverStrong?: string;
|
|
179
|
+
rowHoverBg?: string;
|
|
180
|
+
select?: string;
|
|
181
|
+
gridLines?: 'both' | 'horizontal' | 'vertical' | 'none';
|
|
182
|
+
rowBorder?: string;
|
|
183
|
+
columnBorder?: string;
|
|
184
|
+
fontFamily?: string;
|
|
185
|
+
numericFontFamily?: string;
|
|
186
|
+
fontSize?: number | string;
|
|
187
|
+
/** Minimum font size (px) when `fitToWidth` scales text down. Defaults to `10`. */
|
|
188
|
+
minFontSize?: number;
|
|
189
|
+
fitMinFontSize?: number;
|
|
190
|
+
headerFontSize?: number | string;
|
|
191
|
+
headerGroupFontSize?: number | string;
|
|
192
|
+
headerLineHeight?: number | string;
|
|
193
|
+
headerWrap?: boolean;
|
|
194
|
+
headerControls?: 'always' | 'hover' | 'never';
|
|
195
|
+
/** Explicitly show or hide the `|x|` absolute-sort badge; defaults to following `headerControls`. */
|
|
196
|
+
showAbsoluteSortBadge?: boolean;
|
|
197
|
+
showSortPriority?: boolean;
|
|
198
|
+
sortIndicator?: 'arrow' | 'none' | string;
|
|
199
|
+
cellPaddingX?: number | string;
|
|
200
|
+
headerPaddingX?: number | string;
|
|
201
|
+
numericPaddingRight?: number | string;
|
|
202
|
+
rowHeight?: number;
|
|
203
|
+
headerHeight?: number;
|
|
204
|
+
[token: string]: unknown;
|
|
205
|
+
}
|
|
116
206
|
export type PivotValueConfig = ValConfig;
|
|
117
207
|
export interface FilterCondition {
|
|
118
208
|
type?: string;
|
|
@@ -387,6 +477,7 @@ export interface WorkspacePresentation {
|
|
|
387
477
|
readonly customDimensions: WorkspaceCollection;
|
|
388
478
|
readonly dataBarsColumns: readonly string[];
|
|
389
479
|
readonly dataBarMaximums: WorkspaceRecord;
|
|
480
|
+
readonly dataBarVariant?: 'fill' | 'underbar';
|
|
390
481
|
readonly decimalPlaces: number;
|
|
391
482
|
readonly defaultValueFormat: string;
|
|
392
483
|
readonly detailConfig: WorkspaceRecord | null;
|
|
@@ -529,6 +620,7 @@ export interface WorkspacePresentation {
|
|
|
529
620
|
readonly setCustomDimensions: RuntimeCommand;
|
|
530
621
|
readonly setDataBarsColumns: RuntimeCommand;
|
|
531
622
|
readonly setDataBarMaximums: RuntimeCommand;
|
|
623
|
+
readonly setDataBarVariant?: RuntimeCommand;
|
|
532
624
|
readonly setDecimalPlaces: RuntimeCommand;
|
|
533
625
|
readonly setDefaultValueFormat: RuntimeCommand;
|
|
534
626
|
readonly setDetailSurface: RuntimeCommand;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Owns measured column sizing and its toolbar command. @param {any} p0 @returns {any} */
|
|
2
|
-
export function useRuntimeColumnAutoSizing({ autoSizeBounds, columnDecimalOverrides, columnFormatOverrides, columnGroupSeparatorOverrides, decimalPlaces, defaultValueFormat, fontFamily, fontSize, getAutoSizeSampleRows, getDisplayHeaderTextStackForColumn, getRenderedCellWidthForColumn, getRenderedHeaderWidthForColumn, matchesSelectedColumnToValueConfig, numberGroupSeparator, queueHeaderFitValidation, table, valConfigs, }: any): any;
|
|
2
|
+
export function useRuntimeColumnAutoSizing({ autoSizeBounds, columnDecimalOverrides, columnFormatOverrides, columnGroupSeparatorOverrides, decimalPlaces, defaultValueFormat, fontFamily, fontSize, getAutoSizeSampleRows, getDisplayHeaderTextStackForColumn, getRenderedCellWidthForColumn, getRenderedHeaderWidthForColumn, matchesSelectedColumnToValueConfig, numberGroupSeparator, queueHeaderFitValidation, table, valConfigs, valueScale, unitSuffix, }: any): any;
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* intentionally explicit: this is the persistence boundary for user-visible
|
|
7
7
|
* workspace state, not another consumer of the mutable legacy environment.
|
|
8
8
|
@param {any} p0 @returns {any} */
|
|
9
|
-
export function useRuntimeViewSnapshot({ activeChartDefinitionId, activeReportId, cellFormatRules, chartCanvasPanes, chartPanelAxisMode, chartPanelBarLayout, chartPanelColumnLimit, chartPanelFloating, chartPanelFloatingRect, chartPanelGraphHeight, chartPanelHierarchyLevel, chartPanelInteractionMode, chartPanelLayers, chartPanelLocked, chartPanelLockedModel, chartPanelLockedRequest, chartPanelOpen, chartPanelOrientation, chartPanelRowLimit, chartPanelServerScope, chartPanelSortMode, chartPanelSource, chartPanelTitle, chartPanelType, chartPanelWidth, colExpanded, colFields, colSearch, colTypeFilter, colorPalette, colorScaleMode, colorScaleColumns, columnDecimalOverrides, columnFormatOverrides, columnGroupSeparatorOverrides, columnOrder, pivotLayoutOrder, pivotPinnedLayoutIds, columnPinning, columnSizing, columnVisibility, customDimensions, dataBarsColumns, dataBarMaximums, decimalPlaces, defaultValueFormat, detailConfig, detailMode, editValueDisplayMode, expanded, fieldPanelSizes, filters, frozenPivotConfig, grandTotalPinOverride, latestViewportRef, layoutMode, managedChartDefinitions, normalizedChartServerWindow, normalizedInitialValConfigs, numberGroupSeparator, parentRef, pivotColumnSorting, reportDef, rowFields, rowPinning, runtimeMeasureAxis, saveViewTrigger, savePersistedState, savedReports, serializedEditComparisonState, setPropsRef, showColTotals, showFloatingFilters, showNotification, showReportConfigColumn, showRowNumbers, showRowTotals, showSubtotals, sidebarOpen, sidebarTab, sidebarWidth, sorting, spacingMode, stickyHeaders, tableCanvasSize, tableName, themeName, themeOverrides, treeConfig, valConfigs, viewMode, zoomLevel, }: any): any;
|
|
9
|
+
export function useRuntimeViewSnapshot({ activeChartDefinitionId, activeReportId, cellFormatRules, chartCanvasPanes, chartPanelAxisMode, chartPanelBarLayout, chartPanelColumnLimit, chartPanelFloating, chartPanelFloatingRect, chartPanelGraphHeight, chartPanelHierarchyLevel, chartPanelInteractionMode, chartPanelLayers, chartPanelLocked, chartPanelLockedModel, chartPanelLockedRequest, chartPanelOpen, chartPanelOrientation, chartPanelRowLimit, chartPanelServerScope, chartPanelSortMode, chartPanelSource, chartPanelTitle, chartPanelType, chartPanelWidth, colExpanded, colFields, colSearch, colTypeFilter, colorPalette, colorScaleMode, colorScaleColumns, columnDecimalOverrides, columnFormatOverrides, columnGroupSeparatorOverrides, columnOrder, pivotLayoutOrder, pivotPinnedLayoutIds, columnPinning, columnSizing, columnVisibility, customDimensions, dataBarsColumns, dataBarMaximums, dataBarVariant, decimalPlaces, defaultValueFormat, detailConfig, detailMode, editValueDisplayMode, expanded, fieldPanelSizes, filters, frozenPivotConfig, grandTotalPinOverride, latestViewportRef, layoutMode, managedChartDefinitions, normalizedChartServerWindow, normalizedInitialValConfigs, numberGroupSeparator, parentRef, pivotColumnSorting, reportDef, rowFields, rowPinning, runtimeMeasureAxis, saveViewTrigger, savePersistedState, savedReports, serializedEditComparisonState, setPropsRef, showColTotals, showFloatingFilters, showNotification, showReportConfigColumn, showRowNumbers, showRowTotals, showSubtotals, sidebarOpen, sidebarTab, sidebarWidth, sorting, spacingMode, stickyHeaders, tableCanvasSize, tableName, themeName, themeOverrides, treeConfig, valConfigs, viewMode, zoomLevel, }: any): any;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export function normalizeDataBarMaximums(value?: any): any;
|
|
2
|
+
export function normalizeDataBarVariant(value?: any): "fill" | "underbar";
|
|
2
3
|
export function updateDataBarMaximums(previous?: any, columns?: any, maximum?: any): any;
|
|
3
4
|
export function resolveDataBarMaximum(maximum?: any, stats?: any): any;
|
|
@@ -2,11 +2,16 @@ export function getKey(prefix?: any, field?: any, agg?: any): any;
|
|
|
2
2
|
export function formatDisplayLabel(value?: any): any;
|
|
3
3
|
export function isWeightedAverageAgg(agg?: any): any;
|
|
4
4
|
export function formatAggLabel(agg?: any, weightField?: any): any;
|
|
5
|
+
export function stripAggLabelSuffix(label?: any): string;
|
|
5
6
|
export const DEFAULT_NUMBER_GROUP_SEPARATOR: "thin_space";
|
|
6
7
|
export const DEFAULT_CURRENCY_SYMBOL: "$";
|
|
7
8
|
export function normalizeNumberGroupSeparator(value?: any): any;
|
|
8
9
|
export function normalizeNegativeZero(value?: any): any;
|
|
9
10
|
export function scaleValueForDisplay(value?: any, valueScale?: any): any;
|
|
11
|
+
export function unwrapNumericDisplayFormat(fmt?: any): {
|
|
12
|
+
isPill: boolean;
|
|
13
|
+
innerFormat: string;
|
|
14
|
+
};
|
|
10
15
|
export function resolveNumericDisplayValue(value?: any, fmt?: any, decimalPlaces?: any, options?: any): any;
|
|
11
16
|
export function isDisplayNegative(value?: any, fmt?: any, decimalPlaces?: any, options?: any): any;
|
|
12
17
|
export function formatValue(value?: any, fmt?: any, decimalPlaces?: any, groupSeparator?: any, formatOptions?: any): any;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export function getStickyHeaderHeight(headerGroupCount?: any, rowHeight?: any, showFloatingFilters?: any): any;
|
|
2
2
|
export function formatLocaleTextTemplate(template?: any, values?: any): any;
|
|
3
|
+
export function createTextWidthMeasurer(font?: any, fallbackCharPx?: any): any;
|
|
4
|
+
export function measureLongestHeaderWord(text?: any, measureFn?: any): any;
|
|
5
|
+
export function measureColumnFitMetric({ columnId, baseSize, rows, getCellRawValue, formatCellText, formatHierarchyLabel, headerLines, shortLabel, headerWrap, headerControlsMode, canSort, sortIndicator, measureBodyText, measureHeaderText, cellPaddingX, headerPaddingX, numericPaddingRight, hierarchyIndentPx, hierarchyExpandPx, cellOverscan, headerOverscan, }?: any): any;
|
|
6
|
+
export function computeCompactFitThemeOverrides(theme?: any, fitScale?: any, fittedFontSize?: any, minFontSize?: any): any;
|
|
3
7
|
export function computeFitToWidthLayout({ columns, containerWidth, baseFontSize, minFontSize, }?: any): any;
|
|
@@ -2,7 +2,7 @@ export function isAbsoluteSortType(value?: any): any;
|
|
|
2
2
|
export function isAbsoluteSortSpecifier(sortSpec?: any): any;
|
|
3
3
|
export function findSortSpecifier(sorting?: any, columnId?: any): any;
|
|
4
4
|
export function mergeSortSpecifierMetadata(sortSpec?: any, previousSortSpec?: any): any;
|
|
5
|
-
export function normalizeSortingState(sorting?: any, previousSorting?: any): any;
|
|
5
|
+
export function normalizeSortingState(sorting?: any, previousSorting?: any, sortOptions?: any): any;
|
|
6
6
|
export function updateSortingForColumn({ sorting, columnId, desc, sortMetadata, append, }: any): any;
|
|
7
7
|
export function resolveColumnSortOptions(sortOptions?: any, columnId?: any): any;
|
|
8
8
|
export function shouldUseAbsoluteSort(sorting?: any, sortOptions?: any, columnId?: any): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "serverside_pivot",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.96",
|
|
4
4
|
"description": "Enterprise-grade analytical pivot table & virtualized data grid for React. Dual-engine: zero-network in-browser analytics (DuckDB-WASM & in-memory) and scalable server-side pushdown. Built with TanStack Table v8, ECharts 6, and 2D virtualization.",
|
|
5
5
|
"main": "./dist/react/index.mjs",
|
|
6
6
|
"types": "./dist/react/react.d.ts",
|
|
@@ -1,195 +0,0 @@
|
|
|
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
|
-
/** @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;
|
|
15
|
-
return /* @__PURE__ */ p.createElement(
|
|
16
|
-
"div",
|
|
17
|
-
{
|
|
18
|
-
key: o,
|
|
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"
|
|
52
|
-
}
|
|
53
|
-
},
|
|
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) => ({
|
|
60
|
-
background: (e == null ? void 0 : e.surfaceBg) || (e == null ? void 0 : e.background) || "#fff",
|
|
61
|
-
border: `1px solid ${(e == null ? void 0 : e.border) || "#ccc"}`,
|
|
62
|
-
boxShadow: (e == null ? void 0 : e.shadowMd) || "0 4px 20px rgba(0,0,0,0.15)",
|
|
63
|
-
padding: "6px 0",
|
|
64
|
-
borderRadius: (e == null ? void 0 : e.radiusSm) || "8px",
|
|
65
|
-
fontSize: "13px",
|
|
66
|
-
minWidth: "190px",
|
|
67
|
-
maxWidth: "300px",
|
|
68
|
-
color: (e == null ? void 0 : e.text) || "#111"
|
|
69
|
-
}), V = ({ x: e, y: t, onClose: b, actions: f, theme: g }) => {
|
|
70
|
-
const [D, u] = T({ x: e, y: t }), [o, a] = T(null), [d, l] = T(null), W = R(null), H = R(null), k = R([]), A = R(null), E = v((n, r = 1) => {
|
|
71
|
-
const s = f.length;
|
|
72
|
-
for (let i = 0; i < s; i++) {
|
|
73
|
-
const y = (n + i * r + s * 2) % s, c = f[y];
|
|
74
|
-
if (c && c !== "separator" && !c.disabled && k.current[y]) {
|
|
75
|
-
k.current[y].focus();
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}, [f]);
|
|
80
|
-
B(() => {
|
|
81
|
-
E(0, 1);
|
|
82
|
-
}, [E]), B(() => () => clearTimeout(A.current), []);
|
|
83
|
-
const K = v(() => {
|
|
84
|
-
clearTimeout(A.current), A.current = setTimeout(() => {
|
|
85
|
-
a(null), l(null);
|
|
86
|
-
}, J);
|
|
87
|
-
}, []), L = v(() => {
|
|
88
|
-
clearTimeout(A.current);
|
|
89
|
-
}, []), C = v((n) => {
|
|
90
|
-
clearTimeout(A.current), A.current = setTimeout(() => {
|
|
91
|
-
a(n);
|
|
92
|
-
const r = k.current[n];
|
|
93
|
-
r && l(r.getBoundingClientRect());
|
|
94
|
-
}, o !== null ? 0 : G);
|
|
95
|
-
}, [o]), Y = v((n, r, s) => {
|
|
96
|
-
s || (r ? C(n) : (L(), a(null), l(null)));
|
|
97
|
-
}, [C, L]), I = v((n, r) => {
|
|
98
|
-
if (n.key === "Escape")
|
|
99
|
-
n.preventDefault(), b();
|
|
100
|
-
else if (n.key === "ArrowDown")
|
|
101
|
-
n.preventDefault(), E(r + 1, 1);
|
|
102
|
-
else if (n.key === "ArrowUp")
|
|
103
|
-
n.preventDefault(), E(r - 1, -1);
|
|
104
|
-
else if (n.key === "Home")
|
|
105
|
-
n.preventDefault(), E(0, 1);
|
|
106
|
-
else if (n.key === "End")
|
|
107
|
-
n.preventDefault(), E(f.length - 1, -1);
|
|
108
|
-
else if (n.key === "ArrowRight" && o === null && Number.isFinite(r) && r >= 0) {
|
|
109
|
-
const s = f[r];
|
|
110
|
-
s && s !== "separator" && Array.isArray(s.children) && (n.preventDefault(), C(r));
|
|
111
|
-
}
|
|
112
|
-
}, [b, E, f, o, C]);
|
|
113
|
-
O(() => {
|
|
114
|
-
const n = () => {
|
|
115
|
-
var F;
|
|
116
|
-
const r = window.innerWidth, s = window.innerHeight, i = (F = W.current) == null ? void 0 : F.getBoundingClientRect(), y = (i == null ? void 0 : i.width) || 200, c = (i == null ? void 0 : i.height) || f.length * 32 + 20, x = 8;
|
|
117
|
-
let M = Math.max(x, Math.min(e, r - y - x)), q = Math.max(x, Math.min(t, s - c - x));
|
|
118
|
-
u({ x: M, y: q });
|
|
119
|
-
};
|
|
120
|
-
return n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0), () => {
|
|
121
|
-
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
122
|
-
};
|
|
123
|
-
}, [e, t, f.length]);
|
|
124
|
-
const [_, $] = T({ left: 0, top: 0 });
|
|
125
|
-
O(() => {
|
|
126
|
-
if (!d || o === null) return;
|
|
127
|
-
const n = H.current;
|
|
128
|
-
if (!n) return;
|
|
129
|
-
const r = window.innerWidth, s = window.innerHeight, i = n.offsetWidth || 200, y = n.offsetHeight || 200, c = 6;
|
|
130
|
-
let x = d.right + 2;
|
|
131
|
-
x + i > r - c && (x = d.left - i - 2);
|
|
132
|
-
let M = d.top - 6;
|
|
133
|
-
M + y > s - c && (M = s - y - c), $({ left: Math.max(c, x), top: Math.max(c, M) });
|
|
134
|
-
}, [d, o]);
|
|
135
|
-
const P = o !== null ? f[o] : null, w = P && Array.isArray(P.children) ? P.children : null, S = R([]), z = v((n, r = 1) => {
|
|
136
|
-
if (!w) return;
|
|
137
|
-
const s = w.length;
|
|
138
|
-
for (let i = 0; i < s; i++) {
|
|
139
|
-
const y = (n + i * r + s * 2) % s, c = w[y];
|
|
140
|
-
if (c && c !== "separator" && !c.disabled && S.current[y]) {
|
|
141
|
-
S.current[y].focus();
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}, [w]);
|
|
146
|
-
B(() => {
|
|
147
|
-
w && (S.current = S.current.slice(0, w.length));
|
|
148
|
-
}, [w]);
|
|
149
|
-
const j = v((n, r) => {
|
|
150
|
-
n.key === "Escape" || n.key === "ArrowLeft" ? (n.preventDefault(), n.stopPropagation(), a(null), l(null), o !== null && k.current[o] && k.current[o].focus()) : n.key === "ArrowDown" ? (n.preventDefault(), z(r + 1, 1)) : n.key === "ArrowUp" && (n.preventDefault(), z(r - 1, -1));
|
|
151
|
-
}, [z, o]);
|
|
152
|
-
return /* @__PURE__ */ p.createElement(p.Fragment, null, /* @__PURE__ */ p.createElement(
|
|
153
|
-
"div",
|
|
154
|
-
{
|
|
155
|
-
ref: W,
|
|
156
|
-
role: "menu",
|
|
157
|
-
style: { position: "fixed", top: D.y, left: D.x, zIndex: 10001, ...U(g) },
|
|
158
|
-
onMouseLeave: K,
|
|
159
|
-
onMouseEnter: L
|
|
160
|
-
},
|
|
161
|
-
/* @__PURE__ */ p.createElement(
|
|
162
|
-
N,
|
|
163
|
-
{
|
|
164
|
-
actions: f,
|
|
165
|
-
theme: g,
|
|
166
|
-
onClose: b,
|
|
167
|
-
itemRefs: k,
|
|
168
|
-
onItemMouseEnter: Y,
|
|
169
|
-
onKeyDown: I
|
|
170
|
-
}
|
|
171
|
-
)
|
|
172
|
-
), w && /* @__PURE__ */ p.createElement(
|
|
173
|
-
"div",
|
|
174
|
-
{
|
|
175
|
-
ref: H,
|
|
176
|
-
role: "menu",
|
|
177
|
-
style: { position: "fixed", top: _.top, left: _.left, zIndex: 10002, ...U(g) },
|
|
178
|
-
onMouseEnter: L,
|
|
179
|
-
onMouseLeave: K
|
|
180
|
-
},
|
|
181
|
-
/* @__PURE__ */ p.createElement(
|
|
182
|
-
N,
|
|
183
|
-
{
|
|
184
|
-
actions: w,
|
|
185
|
-
theme: g,
|
|
186
|
-
onClose: b,
|
|
187
|
-
itemRefs: S,
|
|
188
|
-
onKeyDown: j
|
|
189
|
-
}
|
|
190
|
-
)
|
|
191
|
-
));
|
|
192
|
-
};
|
|
193
|
-
export {
|
|
194
|
-
V as default
|
|
195
|
-
};
|