@kanunilabs/pivotgrid-core 1.11.2 → 1.11.4
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/index.cjs +12 -14
- package/dist/index.d.cts +418 -426
- package/dist/index.d.ts +418 -426
- package/dist/index.js +12 -14
- package/dist/pivot.worker.cjs +1 -1
- package/dist/pivot.worker.js +1 -1
- package/package.json +2 -7
- package/dist/import.worker.cjs +0 -3
- package/dist/import.worker.js +0 -3
package/dist/index.d.cts
CHANGED
|
@@ -15,6 +15,11 @@ interface PivotDictionary {
|
|
|
15
15
|
footerArea: string;
|
|
16
16
|
allFields: string;
|
|
17
17
|
dropHere: string;
|
|
18
|
+
/** The filter strip's collapse button (Tekax B.38). */
|
|
19
|
+
collapseFilterArea: string;
|
|
20
|
+
expandFilterArea: string;
|
|
21
|
+
/** Shown on the collapsed filter strip: how many of its fields filter; `{0}` is the count. */
|
|
22
|
+
filteredFieldCount: string;
|
|
18
23
|
actions: string;
|
|
19
24
|
saveNewView: string;
|
|
20
25
|
saveAsView: string;
|
|
@@ -29,7 +34,6 @@ interface PivotDictionary {
|
|
|
29
34
|
deleteReport: string;
|
|
30
35
|
deleteReportConfirm: string;
|
|
31
36
|
export: string;
|
|
32
|
-
importFile: string;
|
|
33
37
|
excelExport: string;
|
|
34
38
|
pivotView: string;
|
|
35
39
|
listView: string;
|
|
@@ -57,7 +61,6 @@ interface PivotDictionary {
|
|
|
57
61
|
tabSeparatedValues: string;
|
|
58
62
|
enterpriseBadge: string;
|
|
59
63
|
enterpriseUpgradeHint: string;
|
|
60
|
-
dataImportUnsupported: string;
|
|
61
64
|
columnFilter: string;
|
|
62
65
|
percentOfColumnTotal: string;
|
|
63
66
|
percentOfRowTotal: string;
|
|
@@ -71,16 +74,12 @@ interface PivotDictionary {
|
|
|
71
74
|
deletePermanently: string;
|
|
72
75
|
/** The column cap's notice (`maxColumns`); `{shown}` and `{total}` are numbers. */
|
|
73
76
|
columnsTruncated: string;
|
|
74
|
-
importSuccess: string;
|
|
75
|
-
importWarning: string;
|
|
76
|
-
importError: string;
|
|
77
77
|
initializing: string;
|
|
78
78
|
loading: string;
|
|
79
79
|
emptyData: string;
|
|
80
80
|
noItems: string;
|
|
81
81
|
blanks: string;
|
|
82
82
|
loadingData: string;
|
|
83
|
-
processing: string;
|
|
84
83
|
fieldSettings: string;
|
|
85
84
|
caption: string;
|
|
86
85
|
summaryType: string;
|
|
@@ -157,19 +156,6 @@ interface PivotDictionary {
|
|
|
157
156
|
/** PDF export header (#215). */
|
|
158
157
|
exportGeneratedOn: string;
|
|
159
158
|
showFieldList: string;
|
|
160
|
-
/**
|
|
161
|
-
* License watermark reasons (1.3.0) — the badge shows the product name and
|
|
162
|
-
* one of these. Mapped to reason codes by `licenseLabelsFromDictionary`
|
|
163
|
-
* in @kanunilabs/licensing; the key names are that contract.
|
|
164
|
-
*/
|
|
165
|
-
licenseMissing: string;
|
|
166
|
-
licenseExpired: string;
|
|
167
|
-
licenseReleaseNotCovered: string;
|
|
168
|
-
licenseDomainMismatch: string;
|
|
169
|
-
licenseRevoked: string;
|
|
170
|
-
licenseInvalidFormat: string;
|
|
171
|
-
licenseInvalidSignature: string;
|
|
172
|
-
licenseEngineUnavailable: string;
|
|
173
159
|
editCalculation: string;
|
|
174
160
|
[key: string]: string;
|
|
175
161
|
}
|
|
@@ -1467,7 +1453,26 @@ interface ColumnSlotOptions {
|
|
|
1467
1453
|
subTotals?: boolean;
|
|
1468
1454
|
/** Before or after the children, matching `layout.totalsPosition`. */
|
|
1469
1455
|
totalsPosition?: 'top' | 'bottom';
|
|
1456
|
+
/**
|
|
1457
|
+
* `layout.showTotalsForSingleValues` — false leaves out the subtotal of a
|
|
1458
|
+
* group with exactly one child (it would repeat that child). Default true.
|
|
1459
|
+
*/
|
|
1460
|
+
singleValueTotals?: boolean;
|
|
1470
1461
|
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Does an expanded group with `childCount` children get a subtotal (B.39)?
|
|
1464
|
+
* One child repeats its parent's numbers; `showTotalsForSingleValues: false`
|
|
1465
|
+
* leaves that subtotal out — on screen and in every export, which all ask here.
|
|
1466
|
+
*/
|
|
1467
|
+
declare const subtotalFor: (childCount: number, singleValueTotals: boolean | undefined) => boolean;
|
|
1468
|
+
/**
|
|
1469
|
+
* Is the grand total of an axis shown (B.39)? The layout's flag, and — with
|
|
1470
|
+
* `showGrandTotalsForSingleValues: false` — not when the axis has a single
|
|
1471
|
+
* top-level member, whose own row or column already carries the same numbers.
|
|
1472
|
+
*/
|
|
1473
|
+
declare function grandTotalShown(layout: PivotLayoutState, axis: 'row' | 'column', tree: readonly unknown[]): boolean;
|
|
1474
|
+
/** The column-slot options a layout asks for — one place, so no caller drops a flag. */
|
|
1475
|
+
declare const columnSlotOptions: (layout: PivotLayoutState) => ColumnSlotOptions;
|
|
1471
1476
|
declare function getVisibleLeafCount(node: PivotNode, expandedColPaths: Set<string>, allExpanded?: boolean, opts?: ColumnSlotOptions): number;
|
|
1472
1477
|
declare function getVisibleMaxDepth(nodes: PivotNode[], expandedColPaths: Set<string>, allExpanded?: boolean): number;
|
|
1473
1478
|
/** One painted data column: the node whose hash addresses it, and why. */
|
|
@@ -1553,7 +1558,9 @@ declare function flattenRowTree(nodes: PivotNode[], expandedPaths: Set<string>,
|
|
|
1553
1558
|
* - Subtotal rows appear after each group's children (if showRowTotals is true)
|
|
1554
1559
|
* - Parent cells span multiple rows (rowSpan) to avoid repetition
|
|
1555
1560
|
*/
|
|
1556
|
-
declare function flattenRowTreeTabular(nodes: PivotNode[], expandedPaths: Set<string>, allExpanded: boolean, maxDepth: number, showRowTotals: boolean, totalsPosition: 'top' | 'bottom'
|
|
1561
|
+
declare function flattenRowTreeTabular(nodes: PivotNode[], expandedPaths: Set<string>, allExpanded: boolean, maxDepth: number, showRowTotals: boolean, totalsPosition: 'top' | 'bottom',
|
|
1562
|
+
/** `layout.showTotalsForSingleValues` (B.39): false drops a one-child group's subtotal. */
|
|
1563
|
+
singleValueTotals?: boolean): FlatRow[];
|
|
1557
1564
|
/**
|
|
1558
1565
|
* Flatten the row tree for compact tree rendering.
|
|
1559
1566
|
* In this layout:
|
|
@@ -1561,7 +1568,9 @@ declare function flattenRowTreeTabular(nodes: PivotNode[], expandedPaths: Set<st
|
|
|
1561
1568
|
* - Each node is its own row.
|
|
1562
1569
|
* - Indentation is used to show hierarchy.
|
|
1563
1570
|
*/
|
|
1564
|
-
declare function flattenRowTreeTree(nodes: PivotNode[], expandedPaths: Set<string>, allExpanded: boolean, treeDepth: number, showRowTotals: boolean, totalsPosition: 'top' | 'bottom'
|
|
1571
|
+
declare function flattenRowTreeTree(nodes: PivotNode[], expandedPaths: Set<string>, allExpanded: boolean, treeDepth: number, showRowTotals: boolean, totalsPosition: 'top' | 'bottom',
|
|
1572
|
+
/** `layout.showTotalsForSingleValues` (B.39): false drops a one-child group's subtotal. */
|
|
1573
|
+
singleValueTotals?: boolean): FlatRow[];
|
|
1565
1574
|
|
|
1566
1575
|
interface ValueRange {
|
|
1567
1576
|
min: number;
|
|
@@ -1649,7 +1658,7 @@ interface LargeExportInfo {
|
|
|
1649
1658
|
limit: number;
|
|
1650
1659
|
unit: 'rows' | 'cells';
|
|
1651
1660
|
}
|
|
1652
|
-
declare function exportPivotData<TRow>(format: ExportFormat, data: TRow[],
|
|
1661
|
+
declare function exportPivotData<TRow>(format: ExportFormat, data: TRow[], allFields: PivotField<TRow>[], engineResult: PivotEngineResult, layout: PivotLayoutState, expandedPaths: Set<string>, expandedColPaths: Set<string>, fileName?: string, locale?: string, options?: ExportOptions): Promise<void>;
|
|
1653
1662
|
declare function escapeXmlText(value: string): string;
|
|
1654
1663
|
declare function getCellVal(engineResult: PivotEngineResult, rHash: string, cHash: string, dfId: string, dataFields: PivotField[], cellLookup: Map<number, number>, preferDisplay?: boolean): number | "";
|
|
1655
1664
|
/** Per-cell style resolved from a data field's conditional-formatting rules. */
|
|
@@ -1844,6 +1853,17 @@ interface PivotField<TRow = any, TCellTemplate = PivotCellTemplate, TStyle = any
|
|
|
1844
1853
|
area?: PivotArea;
|
|
1845
1854
|
/** Position index within the area. */
|
|
1846
1855
|
areaIndex?: number;
|
|
1856
|
+
/**
|
|
1857
|
+
* The areas this field may be placed in (Tekax B.34). Leave it out for
|
|
1858
|
+
* "any area". Hiding the field (`'chooser'`) is always allowed. Every way
|
|
1859
|
+
* of moving a field obeys it: a drag (a disallowed area shows "not
|
|
1860
|
+
* allowed" and refuses the drop), the field menu's "Move to" (disallowed
|
|
1861
|
+
* areas are disabled), the field chooser's checkbox (it puts the field in
|
|
1862
|
+
* its defined `area`, else the first allowed one), `changeFieldArea`,
|
|
1863
|
+
* `showFields` and `commitDrag`. `setFields` does not check it: the
|
|
1864
|
+
* application's own layout is trusted.
|
|
1865
|
+
*/
|
|
1866
|
+
allowedAreas?: PivotArea[];
|
|
1847
1867
|
/**
|
|
1848
1868
|
* A data field that is computed but never shown (Tekax B.21): a summary
|
|
1849
1869
|
* formula reads it (`[Amount] / [Qty]` with Amount and Qty as helpers), but
|
|
@@ -1858,7 +1878,14 @@ interface PivotField<TRow = any, TCellTemplate = PivotCellTemplate, TStyle = any
|
|
|
1858
1878
|
*/
|
|
1859
1879
|
group?: string;
|
|
1860
1880
|
groupIndex?: number;
|
|
1861
|
-
/**
|
|
1881
|
+
/**
|
|
1882
|
+
* `false` hides the field from the user entirely (Tekax B.42): no entry in
|
|
1883
|
+
* the field chooser, no chip, no row, column or value, nothing in an export.
|
|
1884
|
+
* It is computed as an unplaced field, so a filter on it still applies. Its
|
|
1885
|
+
* `area` and `areaIndex` stay as they are, so `visible: true` (or omitting
|
|
1886
|
+
* it, the default) puts it back where it was. A plain field property, kept
|
|
1887
|
+
* by `setFields`, `getState` and saved state like any other.
|
|
1888
|
+
*/
|
|
1862
1889
|
visible?: boolean;
|
|
1863
1890
|
/**
|
|
1864
1891
|
* Aggregation type. The built-ins are computed in the Web Worker; `'custom'`
|
|
@@ -1969,6 +1996,19 @@ interface PivotLayoutState {
|
|
|
1969
1996
|
showRowTotals?: boolean;
|
|
1970
1997
|
/** Whether subtotals appear above or below their groups. */
|
|
1971
1998
|
totalsPosition?: 'top' | 'bottom';
|
|
1999
|
+
/**
|
|
2000
|
+
* Subtotals of a group with exactly ONE child (B.39). `false` leaves them
|
|
2001
|
+
* out — the child's own row or column already shows the same numbers — on
|
|
2002
|
+
* screen and in every export, on both axes. Default `true`.
|
|
2003
|
+
*/
|
|
2004
|
+
showTotalsForSingleValues?: boolean;
|
|
2005
|
+
/**
|
|
2006
|
+
* The grand total of an axis whose top level has a single member (B.39).
|
|
2007
|
+
* `false` leaves out the grand total row when there is one top-level row
|
|
2008
|
+
* member, and the grand total column when there is one top-level column
|
|
2009
|
+
* member. Default `true`.
|
|
2010
|
+
*/
|
|
2011
|
+
showGrandTotalsForSingleValues?: boolean;
|
|
1972
2012
|
/**
|
|
1973
2013
|
* Coarse form of `showRowGrandTotals` + `showColumnGrandTotals`. Bridged to
|
|
1974
2014
|
* them at the controller boundary; an explicitly passed granular flag wins.
|
|
@@ -1991,6 +2031,19 @@ interface PivotLayoutState {
|
|
|
1991
2031
|
prefilter?: PivotPrefilter;
|
|
1992
2032
|
showFooter?: boolean;
|
|
1993
2033
|
showFilterArea?: boolean;
|
|
2034
|
+
/**
|
|
2035
|
+
* The tallest the filter strip grows, in rows of chips (Tekax B.38). Past
|
|
2036
|
+
* it the strip scrolls inside itself, and a field dragged to its top or
|
|
2037
|
+
* bottom edge scrolls it. Default: no limit. A view setting: changing it
|
|
2038
|
+
* does not re-run the pivot.
|
|
2039
|
+
*/
|
|
2040
|
+
filterAreaMaxRows?: number;
|
|
2041
|
+
/**
|
|
2042
|
+
* The filter strip shows one row of chips and how many of its fields
|
|
2043
|
+
* filter (B.38); the strip's own button toggles it. Saved with the layout
|
|
2044
|
+
* like every other member. A view setting, as above.
|
|
2045
|
+
*/
|
|
2046
|
+
filterAreaCollapsed?: boolean;
|
|
1994
2047
|
/** Chart integration type when rendering in chart mode. */
|
|
1995
2048
|
chartType?: string;
|
|
1996
2049
|
}
|
|
@@ -2023,7 +2076,6 @@ interface PivotStateStoringConfig {
|
|
|
2023
2076
|
}
|
|
2024
2077
|
interface PivotToolbarConfig {
|
|
2025
2078
|
showSaveReport?: boolean;
|
|
2026
|
-
showImportFile?: boolean;
|
|
2027
2079
|
showExportButton?: boolean;
|
|
2028
2080
|
showCalculatedFields?: boolean;
|
|
2029
2081
|
showFullscreenToggle?: boolean;
|
|
@@ -2065,6 +2117,15 @@ interface CellClickEvent<TRow = any, TNativeEvent = unknown> {
|
|
|
2065
2117
|
colPath: string[];
|
|
2066
2118
|
records?: TRow[];
|
|
2067
2119
|
}
|
|
2120
|
+
/**
|
|
2121
|
+
* A field is about to move (`onFieldMove` and `on('fieldMove')`). Fired on
|
|
2122
|
+
* every path that moves a field: a drag, the field menu, the field chooser
|
|
2123
|
+
* (checkbox, "Select all", a drop), a chip's keys, and the API
|
|
2124
|
+
* (`changeFieldArea`, `showFields`, `removeField`, `moveField`,
|
|
2125
|
+
* `commitDrag`). Not for `setFields` or a loaded layout. Call `cancel()` to
|
|
2126
|
+
* keep the field where it is; an async `onFieldMove` holds the move until it
|
|
2127
|
+
* settles. `showFields` asks once per field and moves the ones not canceled.
|
|
2128
|
+
*/
|
|
2068
2129
|
interface FieldMoveEvent {
|
|
2069
2130
|
fieldId: string;
|
|
2070
2131
|
sourceArea: string;
|
|
@@ -2089,40 +2150,6 @@ interface ExportingEvent {
|
|
|
2089
2150
|
format: string;
|
|
2090
2151
|
cancel: boolean;
|
|
2091
2152
|
}
|
|
2092
|
-
interface PivotImportStatus {
|
|
2093
|
-
isOpen: boolean;
|
|
2094
|
-
status: 'loading' | 'success' | 'error' | 'warning';
|
|
2095
|
-
title: string;
|
|
2096
|
-
messages: string[];
|
|
2097
|
-
/** Overall parse progress 0..100 (present only while streaming a large file). */
|
|
2098
|
-
progress?: number;
|
|
2099
|
-
/** Coarse pipeline stage label (reading | parsing | typing | finalizing). */
|
|
2100
|
-
phase?: string;
|
|
2101
|
-
/** Whether the in-flight import can be cancelled by the user. */
|
|
2102
|
-
cancellable?: boolean;
|
|
2103
|
-
}
|
|
2104
|
-
/** One detected column in the import preview / column-mapping step. */
|
|
2105
|
-
interface PivotImportField {
|
|
2106
|
-
/** Source data key. */
|
|
2107
|
-
dataField: string;
|
|
2108
|
-
/** Display caption (editable in the mapping UI). */
|
|
2109
|
-
caption: string;
|
|
2110
|
-
/** Detected data type (editable in the mapping UI). */
|
|
2111
|
-
dataType: 'string' | 'number' | 'date' | 'boolean';
|
|
2112
|
-
}
|
|
2113
|
-
/**
|
|
2114
|
-
* Parsed-but-not-yet-committed import awaiting user review (preview + column
|
|
2115
|
-
* mapping). Held in observable state; the full row set is kept privately by the
|
|
2116
|
-
* controller and applied on commit.
|
|
2117
|
-
*/
|
|
2118
|
-
interface PivotImportPreviewState {
|
|
2119
|
-
fields: PivotImportField[];
|
|
2120
|
-
/** First-N rows for the preview table. */
|
|
2121
|
-
sample: Record<string, unknown>[];
|
|
2122
|
-
/** Total parsed row count. */
|
|
2123
|
-
rowCount: number;
|
|
2124
|
-
warnings: string[];
|
|
2125
|
-
}
|
|
2126
2153
|
type DropIntent = 'before' | 'after' | 'append' | null;
|
|
2127
2154
|
interface PivotDragIntentState {
|
|
2128
2155
|
activeId: string | null;
|
|
@@ -2155,17 +2182,37 @@ interface PivotControllerState<TRow = any> {
|
|
|
2155
2182
|
*/
|
|
2156
2183
|
columnWidths: Record<string, number>;
|
|
2157
2184
|
engineResult: PivotEngineResult | null;
|
|
2185
|
+
/**
|
|
2186
|
+
* The loader is up: true from the moment a change is scheduled until a short
|
|
2187
|
+
* moment (~120 ms) after its result is shown, so the progress bar can finish.
|
|
2188
|
+
* To know whether `engineResult` is current, read `isComputing`.
|
|
2189
|
+
*/
|
|
2158
2190
|
isBuilding: boolean;
|
|
2191
|
+
/**
|
|
2192
|
+
* A change (data, fields, a filter, an expand) is waiting or being computed,
|
|
2193
|
+
* so `engineResult` is not the result for the current state yet. False once
|
|
2194
|
+
* the new result is in `engineResult`, or the computation failed (B.31).
|
|
2195
|
+
* `exportData` waits for it; `onComputingChange` reports it.
|
|
2196
|
+
*/
|
|
2197
|
+
isComputing?: boolean;
|
|
2198
|
+
/**
|
|
2199
|
+
* Nothing to compute: the pivot has no rows (or no fields) and none are
|
|
2200
|
+
* queued with `applyTransactionAsync`. The renderers show the `emptyData`
|
|
2201
|
+
* text instead of the loader (B.30). Always false with a `serverSource`,
|
|
2202
|
+
* and while the `loading` option is on.
|
|
2203
|
+
*/
|
|
2204
|
+
noData?: boolean;
|
|
2159
2205
|
/** Monotonic engine build progress shown by UI loaders. 0..100, simulated when exact worker progress is unavailable. */
|
|
2160
2206
|
buildProgress?: number;
|
|
2161
2207
|
engineError: Error | null;
|
|
2162
2208
|
selectionStats: PivotSelectionStats | null;
|
|
2163
2209
|
reports: PivotReport[];
|
|
2164
2210
|
activeReportId: string | null;
|
|
2165
|
-
importStatus: PivotImportStatus;
|
|
2166
|
-
/** Pending import awaiting preview/column-mapping review (null when none). */
|
|
2167
|
-
importPreview: PivotImportPreviewState | null;
|
|
2168
2211
|
drag: PivotDragIntentState;
|
|
2212
|
+
/** `undoLayout()` has a step to take back (B.43). */
|
|
2213
|
+
canUndoLayout?: boolean;
|
|
2214
|
+
/** `redoLayout()` has a step to put back (B.43). */
|
|
2215
|
+
canRedoLayout?: boolean;
|
|
2169
2216
|
/**
|
|
2170
2217
|
* The quick search (`setSearchText`): only the row members whose caption
|
|
2171
2218
|
* (as the header draws it — a month by its name) contains it are shown,
|
|
@@ -2176,7 +2223,6 @@ interface PivotControllerState<TRow = any> {
|
|
|
2176
2223
|
}
|
|
2177
2224
|
interface PivotControllerCallbacks<TRow = any> {
|
|
2178
2225
|
onRefresh?: () => void;
|
|
2179
|
-
onImportData?: (data: TRow[]) => void;
|
|
2180
2226
|
onFieldsChange?: (fields: PivotField<TRow>[]) => void;
|
|
2181
2227
|
onLayoutChange?: (layout: PivotLayoutState) => void;
|
|
2182
2228
|
onFieldMove?: (e: FieldMoveEvent) => void | Promise<void>;
|
|
@@ -2185,6 +2231,14 @@ interface PivotControllerCallbacks<TRow = any> {
|
|
|
2185
2231
|
onExporting?: (e: ExportingEvent) => void;
|
|
2186
2232
|
/** Before a styled Excel export gives way to the plain one; `false` cancels (B.23). See `ExportOptions.onLargeExport`. */
|
|
2187
2233
|
onLargeExport?: ExportOptions['onLargeExport'];
|
|
2234
|
+
/**
|
|
2235
|
+
* `isComputing` changed: true when a change starts computing, false when its
|
|
2236
|
+
* result is shown (B.31). `exportData` waits for false before it writes.
|
|
2237
|
+
* The export waits without a time limit, a slow `serverSource.compute`
|
|
2238
|
+
* included. Print and clipboard run after the wait, so a browser may refuse
|
|
2239
|
+
* them once the click that asked for them has expired.
|
|
2240
|
+
*/
|
|
2241
|
+
onComputingChange?: (computing: boolean) => void;
|
|
2188
2242
|
onError?: (error: Error) => void;
|
|
2189
2243
|
onChartStateLoaded?: (chartState: any) => void;
|
|
2190
2244
|
}
|
|
@@ -2205,11 +2259,6 @@ interface PivotControllerOptions<TRow = any> extends PivotControllerCallbacks<TR
|
|
|
2205
2259
|
serverSource?: PivotServerSource;
|
|
2206
2260
|
locale?: string;
|
|
2207
2261
|
workerUrl?: string | URL;
|
|
2208
|
-
/**
|
|
2209
|
-
* When true, file/URL/paste imports first open a preview + column-mapping
|
|
2210
|
-
* step instead of applying immediately. Defaults to false (apply directly).
|
|
2211
|
-
*/
|
|
2212
|
-
previewImport?: boolean;
|
|
2213
2262
|
/**
|
|
2214
2263
|
* Where the grid's layout is persisted between sessions.
|
|
2215
2264
|
*
|
|
@@ -2237,6 +2286,14 @@ interface PivotControllerOptions<TRow = any> extends PivotControllerCallbacks<TR
|
|
|
2237
2286
|
rowKey?: PivotRowKeyResolver<TRow>;
|
|
2238
2287
|
/** How long `applyTransactionAsync` collects transactions before applying them together. Default 50 ms. */
|
|
2239
2288
|
asyncTransactionWait?: number;
|
|
2289
|
+
/**
|
|
2290
|
+
* The application is still fetching the rows (Tekax): while true, `noData`
|
|
2291
|
+
* stays false, so a grid mounted with `data: []` shows its loader instead
|
|
2292
|
+
* of the empty text until the rows arrive. A result already on screen stays
|
|
2293
|
+
* on screen. `exportData` does not wait for it — only for `isComputing`.
|
|
2294
|
+
* Change it with `setLoading`. Default false.
|
|
2295
|
+
*/
|
|
2296
|
+
loading?: boolean;
|
|
2240
2297
|
/**
|
|
2241
2298
|
* Most column members shown (default 1000). A field with a value per row on
|
|
2242
2299
|
* columns makes tens of thousands of them and freezes the page; past the cap
|
|
@@ -2278,7 +2335,10 @@ interface PivotGridRef {
|
|
|
2278
2335
|
* source-compatible — existing callers ignore the return either way.
|
|
2279
2336
|
*/
|
|
2280
2337
|
exportData: (format: ExportFormat | string, options?: ExportOptions) => Promise<void>;
|
|
2281
|
-
|
|
2338
|
+
/** One more level; `{ allLevels: true }` opens every level (B.44). */
|
|
2339
|
+
expandAll: (options?: {
|
|
2340
|
+
allLevels?: boolean;
|
|
2341
|
+
}) => void;
|
|
2282
2342
|
collapseAll: () => void;
|
|
2283
2343
|
getState: () => PivotControllerState;
|
|
2284
2344
|
setFields: (fields: PivotField[]) => void;
|
|
@@ -2411,6 +2471,14 @@ declare function readPivotChartState(input: unknown): PivotChartState | null;
|
|
|
2411
2471
|
declare function diffPivotChartState(previous: PivotChartState, next: PivotChartState): PivotChartChange[];
|
|
2412
2472
|
|
|
2413
2473
|
type PivotStateListener = () => void;
|
|
2474
|
+
/**
|
|
2475
|
+
* What the reader may change about a field besides its place and filters
|
|
2476
|
+
* (B.40): its caption, its group and order in it, and whether it is shown.
|
|
2477
|
+
* Saved only where it differs from the app's definition, so a caption the app
|
|
2478
|
+
* changes later (another language) is not frozen by an old saved state.
|
|
2479
|
+
*/
|
|
2480
|
+
declare const DEFINED_KEYS: readonly ["caption", "group", "groupIndex", "visible"];
|
|
2481
|
+
type DefinedKey = (typeof DEFINED_KEYS)[number];
|
|
2414
2482
|
/**
|
|
2415
2483
|
* Where the store reads and writes.
|
|
2416
2484
|
*
|
|
@@ -2472,6 +2540,17 @@ declare class PivotStateStore<TRow> {
|
|
|
2472
2540
|
*/
|
|
2473
2541
|
pendingLoad: Promise<PersistedPivotState | null> | null;
|
|
2474
2542
|
private readonly initialFields;
|
|
2543
|
+
/** The app's own caption / group / groupIndex / visible per field (B.40). */
|
|
2544
|
+
private readonly definitions;
|
|
2545
|
+
/**
|
|
2546
|
+
* Record the app's definitions of these fields. `replace`: the app says so
|
|
2547
|
+
* now (`initialFields`, the controlled `fields`); otherwise only fields not
|
|
2548
|
+
* seen before are recorded — `setFields` is also how the renderers add a
|
|
2549
|
+
* calculated field, and a reader's rename must not become the definition.
|
|
2550
|
+
*/
|
|
2551
|
+
/** The app's caption / group / groupIndex / visible for `id`, if it defined the field. */
|
|
2552
|
+
definitionOf(id: string): Partial<Record<DefinedKey, unknown>> | undefined;
|
|
2553
|
+
rememberDefinitions(fields: readonly PivotField<TRow>[] | undefined, replace?: boolean): void;
|
|
2475
2554
|
/**
|
|
2476
2555
|
* What lives outside the store but is saved with it — the controller's
|
|
2477
2556
|
* registered parts and the reported scroll. Set by the controller.
|
|
@@ -2495,8 +2574,6 @@ declare class PivotStateStore<TRow> {
|
|
|
2495
2574
|
setExpandedPaths(paths: string[] | Set<string>): void;
|
|
2496
2575
|
setExpandedColPaths(paths: string[] | Set<string>): void;
|
|
2497
2576
|
setSelectionStats(selectionStats: PivotSelectionStats | null): void;
|
|
2498
|
-
setImportStatus(importStatus: PivotImportStatus): void;
|
|
2499
|
-
setImportPreview(importPreview: PivotControllerState<TRow>['importPreview']): void;
|
|
2500
2577
|
private createInitialSnapshot;
|
|
2501
2578
|
/** A stored state as snapshot parts, or null when this build cannot read it. */
|
|
2502
2579
|
private revive;
|
|
@@ -2542,26 +2619,6 @@ interface PivotControllerEvents<TRow> {
|
|
|
2542
2619
|
left: number;
|
|
2543
2620
|
};
|
|
2544
2621
|
}
|
|
2545
|
-
interface PivotImportLabels {
|
|
2546
|
-
initializing: string;
|
|
2547
|
-
processing: string;
|
|
2548
|
-
importError: string;
|
|
2549
|
-
importWarning: string;
|
|
2550
|
-
importSuccess: string;
|
|
2551
|
-
dataImportUnsupported: string;
|
|
2552
|
-
/** Shown when the user cancels an in-flight import. Optional (falls back to a default). */
|
|
2553
|
-
cancelled?: string;
|
|
2554
|
-
/** Cancel-button caption in the import progress dialog. Optional. */
|
|
2555
|
-
cancel?: string;
|
|
2556
|
-
}
|
|
2557
|
-
/**
|
|
2558
|
-
* Framework-agnostic pivot grid controller.
|
|
2559
|
-
*
|
|
2560
|
-
* Orchestrates field management, engine computation (via Web Worker),
|
|
2561
|
-
* state persistence, export, and event emission. Consumed by React/Angular adapters.
|
|
2562
|
-
*
|
|
2563
|
-
* @typeParam TRow - Shape of source data rows.
|
|
2564
|
-
*/
|
|
2565
2622
|
declare class PivotController<TRow> {
|
|
2566
2623
|
private store;
|
|
2567
2624
|
private events;
|
|
@@ -2573,10 +2630,6 @@ declare class PivotController<TRow> {
|
|
|
2573
2630
|
private options;
|
|
2574
2631
|
private reportService;
|
|
2575
2632
|
private engineService;
|
|
2576
|
-
private importManager;
|
|
2577
|
-
private importAbort?;
|
|
2578
|
-
/** Full row set of a parsed import awaiting preview commit (kept out of observable state). */
|
|
2579
|
-
private pendingImportRows;
|
|
2580
2633
|
private disposed;
|
|
2581
2634
|
/** The body's scroll offsets, as the renderer last reported them. */
|
|
2582
2635
|
private lastScroll;
|
|
@@ -2643,7 +2696,17 @@ declare class PivotController<TRow> {
|
|
|
2643
2696
|
registerReportStatePart(key: string, part: ReportStatePart): () => void;
|
|
2644
2697
|
private collectReportParts;
|
|
2645
2698
|
updateOptions(options: Partial<PivotControllerOptions<TRow>>): void;
|
|
2646
|
-
|
|
2699
|
+
/**
|
|
2700
|
+
* Replace the fields. These are the app's DEFINITIONS (B.40): their
|
|
2701
|
+
* `caption`, `group`, `groupIndex`, `visible` and area become what a saved
|
|
2702
|
+
* state is compared with (a caption you translate is not a reader's edit)
|
|
2703
|
+
* and where the field list puts a field back (`getFieldHomeArea`). The
|
|
2704
|
+
* renderers' own calls (a calculated field, the chart's cross-filter) pass
|
|
2705
|
+
* `{ definition: false }`, so a reader's rename is not taken for yours.
|
|
2706
|
+
*/
|
|
2707
|
+
setFields(fields: PivotField<TRow>[], options?: {
|
|
2708
|
+
definition?: boolean;
|
|
2709
|
+
}): void;
|
|
2647
2710
|
/**
|
|
2648
2711
|
* Replace every row — a full rebuild, transactions included. Unlike
|
|
2649
2712
|
* `updateOptions({ data })`, passing the array the grid started from still
|
|
@@ -2676,21 +2739,65 @@ declare class PivotController<TRow> {
|
|
|
2676
2739
|
applyTransactionAsync(transaction: PivotRowTransaction<TRow>, callback?: () => void): void;
|
|
2677
2740
|
/** Apply the queued transactions now, as one. */
|
|
2678
2741
|
flushAsyncTransactions(): void;
|
|
2742
|
+
/**
|
|
2743
|
+
* Say whether the application is still fetching the rows. While loading,
|
|
2744
|
+
* the grid with no result shows its loader rather than the empty text
|
|
2745
|
+
* (`noData` stays false); a result already shown stays. `exportData` does
|
|
2746
|
+
* not wait for it.
|
|
2747
|
+
*/
|
|
2748
|
+
setLoading(loading: boolean): void;
|
|
2749
|
+
/** Whether `setLoading(true)` (or the `loading` option) is in force. */
|
|
2750
|
+
isLoading(): boolean;
|
|
2679
2751
|
/** How many transactions are waiting to be applied. */
|
|
2680
2752
|
getPendingAsyncTransactionCount(): number;
|
|
2681
2753
|
updateField(updatedField: PivotField<TRow>): void;
|
|
2682
2754
|
deleteField(fieldId: string): void;
|
|
2755
|
+
/** Move a field to the end of `area`. Does nothing when the field's `allowedAreas` leave `area` out (B.34). */
|
|
2683
2756
|
changeFieldArea(fieldId: string, area: PivotArea): void;
|
|
2684
2757
|
/**
|
|
2685
|
-
*
|
|
2686
|
-
*
|
|
2687
|
-
* The
|
|
2688
|
-
|
|
2689
|
-
|
|
2758
|
+
* May `fieldId` be put in `area`? False for an unknown field and for an
|
|
2759
|
+
* area its `allowedAreas` leave out; hiding (`'chooser'`) is always allowed.
|
|
2760
|
+
* The renderers ask it to disable a menu item or refuse a drop (B.34).
|
|
2761
|
+
*/
|
|
2762
|
+
canMoveFieldTo(fieldId: string, area: PivotArea): boolean;
|
|
2763
|
+
/**
|
|
2764
|
+
* A repair run inside every change of the fields, before it is stored and
|
|
2765
|
+
* before `onFieldsChange` hears of it (B.40). The Enterprise wrappers pass
|
|
2766
|
+
* `keepFieldGroups`, so a split group is joined within the same change.
|
|
2767
|
+
* Setting one runs it once on the current fields; `null` removes it.
|
|
2768
|
+
*/
|
|
2769
|
+
private fieldRepair;
|
|
2770
|
+
setFieldRepair(repair: ((prev: PivotField<TRow>[], next: PivotField<TRow>[]) => PivotField<TRow>[]) | null): void;
|
|
2771
|
+
/** `next` with the field repair applied (the same array without one). */
|
|
2772
|
+
private repaired;
|
|
2773
|
+
/**
|
|
2774
|
+
* Where the field chooser's checkbox puts `fieldId` (B.34): the area of the
|
|
2775
|
+
* field's definition (the `area` it was given in `initialFields` or
|
|
2776
|
+
* `setFields`), else the first of its `allowedAreas`, else data for a number
|
|
2777
|
+
* and rows for anything else. Null when no area is allowed.
|
|
2778
|
+
*/
|
|
2779
|
+
getFieldHomeArea(fieldId: string): PivotArea | null;
|
|
2780
|
+
/**
|
|
2781
|
+
* Take several fields out of the chooser in ONE commit, each to
|
|
2782
|
+
* `getFieldHomeArea` (B.34). The rule lives here so the vanilla chooser and
|
|
2783
|
+
* the React chooser cannot drift on it. `onFieldMove` is asked once per
|
|
2784
|
+
* field; the ones it cancels stay where they are.
|
|
2690
2785
|
*/
|
|
2691
2786
|
showFields(fieldIds: string[]): void;
|
|
2692
2787
|
removeField(fieldId: string): void;
|
|
2693
2788
|
moveField(fieldId: string, direction: 'start' | 'end' | 'left' | 'right'): void;
|
|
2789
|
+
/** The area each field was DEFINED in (B.34) — not where the user has put it since. */
|
|
2790
|
+
private readonly homeAreas;
|
|
2791
|
+
/** `replace`: the app says so now (its fields, `setFields`); else only unseen fields. A hidden field keeps its home. */
|
|
2792
|
+
private rememberHomeAreas;
|
|
2793
|
+
/**
|
|
2794
|
+
* Commit `build(fields, ids)` after asking `fieldMove` listeners and
|
|
2795
|
+
* `onFieldMove` about each field that moves (B.34: every path asks, not only
|
|
2796
|
+
* a drag). Canceled fields are left out of a second `build`. An async
|
|
2797
|
+
* `onFieldMove` holds the commit until it settles; a rejection commits
|
|
2798
|
+
* nothing and goes to `onError`.
|
|
2799
|
+
*/
|
|
2800
|
+
private moveFields;
|
|
2694
2801
|
sortField(fieldId: string, direction: 'asc' | 'desc' | undefined): void;
|
|
2695
2802
|
sortFieldBySummary(rowFieldId: string, summaryFieldId: string, colPath: string): void;
|
|
2696
2803
|
clearAllSorting(): void;
|
|
@@ -2726,8 +2833,21 @@ declare class PivotController<TRow> {
|
|
|
2726
2833
|
* cuts the tree on screen, so then the uncut one is computed and walked:
|
|
2727
2834
|
* walking the cut one left every member the search hid closed, and every
|
|
2728
2835
|
* column past the cap. Resolves when the new paths are set.
|
|
2729
|
-
|
|
2730
|
-
|
|
2836
|
+
*
|
|
2837
|
+
* `allLevels: true` opens EVERY level in one call (B.44): a fully expanded
|
|
2838
|
+
* result is computed (a `serverSource` is asked for the whole tree) and each
|
|
2839
|
+
* of its groups is opened by its own path, so a branch can still be closed
|
|
2840
|
+
* on its own afterwards. The footer's "Expand all" button asks for this.
|
|
2841
|
+
*
|
|
2842
|
+
* The open paths are sent to the worker on every computation and saved with
|
|
2843
|
+
* the state, so above `EXPAND_ALL_PATH_CAP` (5,000) groups — or when that
|
|
2844
|
+
* computation fails (reported to `onError`) — the grid opens everything
|
|
2845
|
+
* with the `'*'` sentinel instead. Then a single branch cannot be closed:
|
|
2846
|
+
* "Collapse all" closes everything.
|
|
2847
|
+
*/
|
|
2848
|
+
expandAll(options?: {
|
|
2849
|
+
allLevels?: boolean;
|
|
2850
|
+
}): Promise<void>;
|
|
2731
2851
|
collapseAll(): void;
|
|
2732
2852
|
setColumnWidths(widths: Record<string, number>): void;
|
|
2733
2853
|
setSelectionStats(selectionStats: PivotSelectionStats | null): void;
|
|
@@ -2740,39 +2860,15 @@ declare class PivotController<TRow> {
|
|
|
2740
2860
|
left: number;
|
|
2741
2861
|
top: number;
|
|
2742
2862
|
}, previousIntent: DropIntent, isLastItem: boolean, orientation: 'horizontal' | 'vertical'): DropIntent;
|
|
2863
|
+
/**
|
|
2864
|
+
* Drop `fieldId` where the drag state points. `fieldMove` listeners and
|
|
2865
|
+
* `onFieldMove` are asked about the dragged field only — members of its
|
|
2866
|
+
* field group that follow it are not asked separately (B.40). The move is
|
|
2867
|
+
* worked out again on the fields as they are AFTER an asynchronous
|
|
2868
|
+
* `onFieldMove` settles, so a change made meanwhile is kept. A rejected
|
|
2869
|
+
* `onFieldMove` goes to `onError`; the drag state is always reset.
|
|
2870
|
+
*/
|
|
2743
2871
|
commitDrag(fieldId: string, overId: string | null): Promise<void>;
|
|
2744
|
-
/** Import a single uploaded file (worker-streamed for CSV/JSON/XML). */
|
|
2745
|
-
importFile(file: File, labels: PivotImportLabels): Promise<void>;
|
|
2746
|
-
/** Import one or more files at once, appending their rows (union fields). */
|
|
2747
|
-
importFiles(files: FileList | File[], labels: PivotImportLabels): Promise<void>;
|
|
2748
|
-
/** Import data fetched from a URL / backend API endpoint. */
|
|
2749
|
-
importFromUrl(url: string, labels: PivotImportLabels, fetchInit?: RequestInit): Promise<void>;
|
|
2750
|
-
/** Import an already-materialized array of rows (e.g. an API response). */
|
|
2751
|
-
importData(rows: any[], labels: PivotImportLabels): Promise<void>;
|
|
2752
|
-
/** Import delimited text pasted from the clipboard (auto-detects CSV/TSV). */
|
|
2753
|
-
importText(text: string, labels: PivotImportLabels): Promise<void>;
|
|
2754
|
-
/**
|
|
2755
|
-
* Shared import driver: manages the abort/progress lifecycle and status
|
|
2756
|
-
* dialog around any import source (`task` performs the actual parse).
|
|
2757
|
-
*/
|
|
2758
|
-
private runImport;
|
|
2759
|
-
/** Cancel an in-flight import started by {@link importFile}/{@link importFiles}/{@link importFromUrl}. */
|
|
2760
|
-
cancelImport(): void;
|
|
2761
|
-
/** Show a terminal import status message (e.g. clipboard empty / permission denied). */
|
|
2762
|
-
showImportStatus(status: 'success' | 'error' | 'warning', title: string, messages: string[]): void;
|
|
2763
|
-
/** Stash a parsed import and open the preview/column-mapping step. */
|
|
2764
|
-
private openImportPreview;
|
|
2765
|
-
/**
|
|
2766
|
-
* Commit a previewed import using the reviewed column plan (include/exclude,
|
|
2767
|
-
* caption + type overrides). Columns whose type changed are re-coerced.
|
|
2768
|
-
*/
|
|
2769
|
-
commitImport(plan: (PivotImportField & {
|
|
2770
|
-
include?: boolean;
|
|
2771
|
-
})[] | undefined, labels: PivotImportLabels): void;
|
|
2772
|
-
/** Discard a pending previewed import without applying it. */
|
|
2773
|
-
cancelImportPreview(): void;
|
|
2774
|
-
private showImportCancelled;
|
|
2775
|
-
closeImportStatus(): void;
|
|
2776
2872
|
saveReport(name: string, isDefault: boolean): void;
|
|
2777
2873
|
updateCurrentReport(): void;
|
|
2778
2874
|
loadReport(id: string): void;
|
|
@@ -2816,6 +2912,15 @@ declare class PivotController<TRow> {
|
|
|
2816
2912
|
* is asking; the controller can.
|
|
2817
2913
|
*/
|
|
2818
2914
|
private static readonly ENTERPRISE_FORMATS;
|
|
2915
|
+
/**
|
|
2916
|
+
* Write the pivot in `format`. A change still computing (and any queued
|
|
2917
|
+
* `applyTransactionAsync` batch) is waited for first, so the file holds the
|
|
2918
|
+
* result for the current state (B.31).
|
|
2919
|
+
* The export waits without a time limit, a slow `serverSource.compute`
|
|
2920
|
+
* included. Print and clipboard run after the wait, so a browser may refuse
|
|
2921
|
+
* them once the click that asked for them has expired.
|
|
2922
|
+
* Rejects with an `AbortError` when the grid is disposed while it waits.
|
|
2923
|
+
*/
|
|
2819
2924
|
exportData(format: ExportFormat | string, options?: ExportOptions): Promise<void>;
|
|
2820
2925
|
/**
|
|
2821
2926
|
* A result computed on request — every row and column open (`all`) or as
|
|
@@ -2846,7 +2951,8 @@ declare class PivotController<TRow> {
|
|
|
2846
2951
|
* The fields in `area`, in order. For `'data'` this is what the ENGINE
|
|
2847
2952
|
* computes: helper fields (`helper: true`, B.21) come last, after every shown
|
|
2848
2953
|
* one, and their columns are cut from the result once the summary formulas
|
|
2849
|
-
* have read them — what is drawn is {@link shownFields}.
|
|
2954
|
+
* have read them — what is drawn is {@link shownFields}. A field with
|
|
2955
|
+
* `visible: false` is in no area (B.42).
|
|
2850
2956
|
*/
|
|
2851
2957
|
getAreaFields(area: PivotArea): PivotField<TRow>[];
|
|
2852
2958
|
private cellIndexLookups;
|
|
@@ -2854,13 +2960,75 @@ declare class PivotController<TRow> {
|
|
|
2854
2960
|
dispose(): void;
|
|
2855
2961
|
private normalizeOptions;
|
|
2856
2962
|
private setState;
|
|
2963
|
+
/** `noData` follows the async queue too: queued rows are rows on their way. */
|
|
2964
|
+
private syncNoData;
|
|
2965
|
+
/** Exports waiting in `whenComputed`, rejected by `dispose`. */
|
|
2966
|
+
private readonly waiters;
|
|
2967
|
+
/**
|
|
2968
|
+
* Resolves once the result on screen is the result for the current state
|
|
2969
|
+
* (B.31). No time limit: a slow server source is waited for. Rejects with an
|
|
2970
|
+
* `AbortError` when the grid is disposed first; the renderers drop that one.
|
|
2971
|
+
*/
|
|
2972
|
+
private whenComputed;
|
|
2857
2973
|
private emitState;
|
|
2974
|
+
/**
|
|
2975
|
+
* `restore`: what an undo puts back — the open branches and summary sorts
|
|
2976
|
+
* the change being undone had dropped (B.53).
|
|
2977
|
+
*/
|
|
2858
2978
|
private commitFields;
|
|
2979
|
+
/** The last layout steps, oldest first; and the ones undone, newest last. */
|
|
2980
|
+
private layoutPast;
|
|
2981
|
+
private layoutFuture;
|
|
2982
|
+
/** Set while undo/redo commits: its own change is not a new step. */
|
|
2983
|
+
private replayingLayout;
|
|
2984
|
+
/**
|
|
2985
|
+
* Take back the last LAYOUT change (B.43): where fields sit, their order,
|
|
2986
|
+
* whether they are shown, their caption and group. Filters, sorting and
|
|
2987
|
+
* summaries are not part of it and stay as they are. Up to the last 20
|
|
2988
|
+
* steps are kept. Every change of the fields counts — a drag, a menu, the
|
|
2989
|
+
* field list, `setFields`, `changeFieldArea` — except undo and redo
|
|
2990
|
+
* themselves; `applyPersistedState` and loading a report start over.
|
|
2991
|
+
* Adding or deleting a field (a calculated field) is not a layout change and
|
|
2992
|
+
* writes no step (B.58); placing it in an area is one.
|
|
2993
|
+
* Returns false when there was nothing to undo.
|
|
2994
|
+
*/
|
|
2995
|
+
undoLayout(): boolean;
|
|
2996
|
+
/** Put back the last change `undoLayout` took back. False when there is none. */
|
|
2997
|
+
redoLayout(): boolean;
|
|
2998
|
+
canUndoLayout(): boolean;
|
|
2999
|
+
canRedoLayout(): boolean;
|
|
3000
|
+
/** Forget every undo and redo step. */
|
|
3001
|
+
clearLayoutHistory(): void;
|
|
3002
|
+
/**
|
|
3003
|
+
* `restore`: undo (not redo) also puts back what the change had dropped.
|
|
3004
|
+
* The dropped paths travel with the step to the other stack, so a redo
|
|
3005
|
+
* followed by another undo finds them again.
|
|
3006
|
+
*/
|
|
3007
|
+
private replayLayout;
|
|
3008
|
+
/** The open branches and sorts each layout step's change dropped (B.53), by the step. */
|
|
3009
|
+
private droppedBy;
|
|
3010
|
+
private recordLayoutStep;
|
|
3011
|
+
/** The dropped paths and sorts back, except where the reader has since set their own. */
|
|
3012
|
+
private restoredPaths;
|
|
3013
|
+
private layoutHistoryFlags;
|
|
3014
|
+
/**
|
|
3015
|
+
* A step remembers which of caption / group / groupIndex / visible were the
|
|
3016
|
+
* app's definition then; undo gives those back as the definition is NOW, so
|
|
3017
|
+
* a caption the app has translated since stays translated (B.40).
|
|
3018
|
+
*/
|
|
3019
|
+
private layoutStepOf;
|
|
3020
|
+
private replayed;
|
|
3021
|
+
/** Mirror the two flags into the state, so a toolbar can re-render on them. */
|
|
3022
|
+
private syncLayoutHistory;
|
|
2859
3023
|
private setDragState;
|
|
2860
|
-
private setImportStatus;
|
|
2861
3024
|
private loadDefaultReport;
|
|
2862
3025
|
private createReportState;
|
|
2863
3026
|
private applyReportState;
|
|
3027
|
+
/**
|
|
3028
|
+
* The keys to open. `groupsOnly` (a fully expanded tree): only nodes with
|
|
3029
|
+
* children, as a leaf has nothing to open; otherwise every visible node, so
|
|
3030
|
+
* the frontier of a partly open tree opens one more level.
|
|
3031
|
+
*/
|
|
2864
3032
|
private collectNodePaths;
|
|
2865
3033
|
}
|
|
2866
3034
|
|
|
@@ -2900,6 +3068,7 @@ declare class PivotEngineService<TRow> {
|
|
|
2900
3068
|
private computing;
|
|
2901
3069
|
private recomputeAfter;
|
|
2902
3070
|
private phaseVersion;
|
|
3071
|
+
private reconfigureDue;
|
|
2903
3072
|
private hashes;
|
|
2904
3073
|
constructor(config: PivotEngineServiceConfig<TRow>);
|
|
2905
3074
|
refresh(): void;
|
|
@@ -3024,6 +3193,16 @@ declare class PivotFieldService {
|
|
|
3024
3193
|
static updateField<TRow>(fields: PivotField<TRow>[], updatedField: PivotField<TRow>): PivotField<TRow>[];
|
|
3025
3194
|
static applyFilter<TRow>(fields: PivotField<TRow>[], fieldId: string, selectedValues: Set<any>, filterType: 'include' | 'exclude'): PivotField<TRow>[];
|
|
3026
3195
|
static clearFilter<TRow>(fields: PivotField<TRow>[], fieldId: string): PivotField<TRow>[];
|
|
3196
|
+
/** B.34: may `field` sit in `area`? Hiding (`'chooser'`) is always allowed. */
|
|
3197
|
+
static canPlace<TRow>(field: PivotField<TRow>, area: PivotArea | undefined): boolean;
|
|
3198
|
+
/**
|
|
3199
|
+
* Where the field chooser's checkbox (and `showFields`) puts a field (B.34):
|
|
3200
|
+
* the area of its definition, else the first allowed area, else a number
|
|
3201
|
+
* goes to data and anything else to rows. Null when no area is allowed.
|
|
3202
|
+
*/
|
|
3203
|
+
static homeArea<TRow>(field: PivotField<TRow>, defined?: PivotArea): PivotArea | null;
|
|
3204
|
+
/** The `fieldMove` event for `fieldId` going from `prev` to `next`; null when it did not move. */
|
|
3205
|
+
static moveEvent<TRow>(prev: PivotField<TRow>[], next: PivotField<TRow>[], fieldId: string): FieldMoveEvent | null;
|
|
3027
3206
|
static removeField<TRow>(fields: PivotField<TRow>[], fieldId: string): PivotField<TRow>[];
|
|
3028
3207
|
static deleteField<TRow>(fields: PivotField<TRow>[], fieldId: string): PivotField<TRow>[];
|
|
3029
3208
|
static changeFieldArea<TRow>(fields: PivotField<TRow>[], fieldId: string, area: PivotArea): PivotField<TRow>[];
|
|
@@ -3215,6 +3394,11 @@ declare function executeSummaryDisplayModesPhase<TRow>(engineResult: PivotEngine
|
|
|
3215
3394
|
|
|
3216
3395
|
declare function extractGroupValue<TRow>(row: TRow, field: PivotField<TRow>): PivotValue;
|
|
3217
3396
|
|
|
3397
|
+
/** The key of the member path `parts` (`[]` is the root, ""). Assumes no member value starts with or contains `|`. */
|
|
3398
|
+
declare function pathKey(parts: readonly unknown[]): string;
|
|
3399
|
+
/** The member path a `pathKey` names (the root, "", is `[]`). Assumes no member value starts with or contains `|`. */
|
|
3400
|
+
declare function pathParts(key: string): string[];
|
|
3401
|
+
|
|
3218
3402
|
interface DimensionFieldInfo {
|
|
3219
3403
|
dataType?: string;
|
|
3220
3404
|
groupInterval?: DateGranularity | null;
|
|
@@ -3237,13 +3421,82 @@ declare function percentModeExcelNumFmt(field: PivotField<any> | undefined): str
|
|
|
3237
3421
|
|
|
3238
3422
|
/**
|
|
3239
3423
|
* The fields a screen shows: helper data fields (`helper: true`, B.21) are
|
|
3240
|
-
* computed but have no column, chip or chooser entry
|
|
3241
|
-
*
|
|
3424
|
+
* computed but have no column, chip or chooser entry, and a field with
|
|
3425
|
+
* `visible: false` (B.42) is not offered at all. The same array comes back
|
|
3426
|
+
* when there is neither, so a memo keyed on it does not churn.
|
|
3242
3427
|
*/
|
|
3243
3428
|
declare function shownFields<T extends {
|
|
3244
3429
|
helper?: boolean;
|
|
3430
|
+
visible?: boolean;
|
|
3431
|
+
}>(fields: T[]): T[];
|
|
3432
|
+
/**
|
|
3433
|
+
* The fields as the ENGINE and the exports read them (B.42): a field with
|
|
3434
|
+
* `visible: false` takes part as an unplaced field — area `'chooser'`, so it
|
|
3435
|
+
* has no row, column or value, and a filter on it still applies as on any
|
|
3436
|
+
* unplaced field. Its own `area` is kept in the state, so `visible: true`
|
|
3437
|
+
* puts it back where it was. The same array comes back when no field is
|
|
3438
|
+
* hidden, and the mapped one is cached per array, so hashes and memos keyed
|
|
3439
|
+
* on identity stay put.
|
|
3440
|
+
*/
|
|
3441
|
+
declare function computedFields<T extends {
|
|
3442
|
+
visible?: boolean;
|
|
3443
|
+
area?: string;
|
|
3245
3444
|
}>(fields: T[]): T[];
|
|
3246
3445
|
|
|
3446
|
+
/** The strip content's gap between chip rows and its vertical padding (CSS `.kanuni-pivot-area-content`). */
|
|
3447
|
+
declare const FILTER_AREA_ROW_GAP = 4;
|
|
3448
|
+
declare const FILTER_AREA_PADDING = 8;
|
|
3449
|
+
/** The rows the strip may show, or null for no limit. */
|
|
3450
|
+
declare function filterAreaRows(layout: Pick<PivotLayoutState, 'filterAreaMaxRows' | 'filterAreaCollapsed'>): number | null;
|
|
3451
|
+
/** The strip content's max height in px for `rows` rows of `chipHeight` px chips. */
|
|
3452
|
+
declare function filterAreaMaxHeight(rows: number, chipHeight: number): number;
|
|
3453
|
+
/** How many filter-area fields filter something (shown on the collapsed strip). */
|
|
3454
|
+
declare function countFilteredFields(fields: readonly {
|
|
3455
|
+
filterValues?: {
|
|
3456
|
+
size: number;
|
|
3457
|
+
} | null;
|
|
3458
|
+
valueFilter?: unknown;
|
|
3459
|
+
labelFilter?: unknown;
|
|
3460
|
+
}[]): number;
|
|
3461
|
+
|
|
3462
|
+
/** What the helper needs of the controller. */
|
|
3463
|
+
interface FocusKeeperController {
|
|
3464
|
+
subscribe(listener: () => void): () => void;
|
|
3465
|
+
on(eventName: 'engineCompleted', handler: () => void): () => void;
|
|
3466
|
+
}
|
|
3467
|
+
declare function keepFocusAcross(root: HTMLElement | null | undefined, controller: FocusKeeperController, run: () => boolean): boolean;
|
|
3468
|
+
|
|
3469
|
+
interface PopupViewport {
|
|
3470
|
+
left: number;
|
|
3471
|
+
top: number;
|
|
3472
|
+
width: number;
|
|
3473
|
+
height: number;
|
|
3474
|
+
}
|
|
3475
|
+
interface PopupPlacement {
|
|
3476
|
+
left: number;
|
|
3477
|
+
top: number;
|
|
3478
|
+
maxHeight: number;
|
|
3479
|
+
}
|
|
3480
|
+
/** The part of the layout viewport the user sees, in `position: fixed` coordinates. */
|
|
3481
|
+
declare function popupViewport(win?: Window): PopupViewport;
|
|
3482
|
+
/**
|
|
3483
|
+
* `anchor` is where the popup would start (its top-left in LTR). `size` its
|
|
3484
|
+
* natural size (offsetWidth/offsetHeight: a transform does not count). `altX`
|
|
3485
|
+
* is the edge to flip to horizontally (a flyout's trigger's left side); the
|
|
3486
|
+
* popup then ends there. Without a usable viewport (jsdom) the anchor stays.
|
|
3487
|
+
*/
|
|
3488
|
+
declare function placePopup(anchor: {
|
|
3489
|
+
x: number;
|
|
3490
|
+
y: number;
|
|
3491
|
+
}, size: {
|
|
3492
|
+
width: number;
|
|
3493
|
+
height: number;
|
|
3494
|
+
}, options?: {
|
|
3495
|
+
margin?: number;
|
|
3496
|
+
altX?: number;
|
|
3497
|
+
viewport?: PopupViewport;
|
|
3498
|
+
}): PopupPlacement;
|
|
3499
|
+
|
|
3247
3500
|
interface PivotSummaryColumn {
|
|
3248
3501
|
/** The field's id — the key of this column in every row. */
|
|
3249
3502
|
id: string;
|
|
@@ -3257,13 +3510,32 @@ interface PivotSummaryTable {
|
|
|
3257
3510
|
columns: PivotSummaryColumn[];
|
|
3258
3511
|
/** One per deepest combination; values are numbers, a blank summary is `null`. */
|
|
3259
3512
|
rows: Array<Record<string, PivotValue | number | null>>;
|
|
3513
|
+
/**
|
|
3514
|
+
* Only with `{ display: true }`: for each row, the text the grid shows for
|
|
3515
|
+
* every data field — the field's `format`, or the locale's percent for a
|
|
3516
|
+
* percent display mode — keyed by field id, blank for a summary with no
|
|
3517
|
+
* number. Same order as `rows`.
|
|
3518
|
+
*/
|
|
3519
|
+
formatted?: Array<Record<string, string>>;
|
|
3520
|
+
}
|
|
3521
|
+
interface PivotSummaryTableOptions {
|
|
3522
|
+
/**
|
|
3523
|
+
* Give the value the grid SHOWS instead of the raw sum (B.60). With a summary
|
|
3524
|
+
* display mode (percent of grand total, running total, difference, ...) the
|
|
3525
|
+
* grid shows the processed number — 97.6 — while the default stays the raw
|
|
3526
|
+
* aggregate (400). Default false, so existing callers get what they got;
|
|
3527
|
+
* `true` fills `rows` with the shown numbers and adds `formatted`.
|
|
3528
|
+
*/
|
|
3529
|
+
display?: boolean;
|
|
3530
|
+
/** The language of `formatted`'s numbers. Default `'en'`. */
|
|
3531
|
+
locale?: string;
|
|
3260
3532
|
}
|
|
3261
3533
|
/**
|
|
3262
3534
|
* The summary as a flat table: every deepest row combination × the shown data
|
|
3263
3535
|
* fields, with the filters applied and regardless of what is expanded.
|
|
3264
3536
|
* Enterprise; throws on a Community grid.
|
|
3265
3537
|
*/
|
|
3266
|
-
declare function getSummaryTable(controller: PivotController<any
|
|
3538
|
+
declare function getSummaryTable(controller: PivotController<any>, options?: PivotSummaryTableOptions): Promise<PivotSummaryTable>;
|
|
3267
3539
|
|
|
3268
3540
|
interface CellPath {
|
|
3269
3541
|
rowPath: readonly string[];
|
|
@@ -3282,6 +3554,10 @@ declare function getRecordsForCells<TRow>(controller: PivotController<TRow>, cel
|
|
|
3282
3554
|
*/
|
|
3283
3555
|
declare function keepFieldGroups<T extends PivotField<any>>(prev: readonly T[], next: T[]): T[];
|
|
3284
3556
|
|
|
3557
|
+
declare const PIVOT_LICENSE_TEXT: Record<string, Record<string, string>>;
|
|
3558
|
+
/** The license reasons for `locale` over English (what is missing falls back). */
|
|
3559
|
+
declare function pivotLicenseText(locale: string | undefined): Record<string, string>;
|
|
3560
|
+
|
|
3285
3561
|
/** A state's filters: per field id, and the prefilter. Plain JSON. */
|
|
3286
3562
|
interface PersistedPivotFilters {
|
|
3287
3563
|
fields: Record<string, {
|
|
@@ -3320,6 +3596,8 @@ type ChartKeyTextKey = 'chartCanvasHintPick' | 'chartCategoryFocus' | 'chartCate
|
|
|
3320
3596
|
/** The text for `key` in `locale` (`tr-TR` → `tr`, `zh` → `zh-CN`), English when the language is unknown. */
|
|
3321
3597
|
declare function chartKeyText(locale: string | undefined, key: ChartKeyTextKey): string;
|
|
3322
3598
|
|
|
3599
|
+
declare function summaryTypeLabel(type: string, t: (key: any) => string): string;
|
|
3600
|
+
|
|
3323
3601
|
declare class ExportStreamController {
|
|
3324
3602
|
private worker;
|
|
3325
3603
|
private static sharedWorker;
|
|
@@ -3422,292 +3700,6 @@ declare class PivotReportManager {
|
|
|
3422
3700
|
private persist;
|
|
3423
3701
|
}
|
|
3424
3702
|
|
|
3425
|
-
type ImportFormat = 'json' | 'csv' | 'xml' | 'xlsx';
|
|
3426
|
-
interface ImportSnapshot<TRow = any> {
|
|
3427
|
-
version: string;
|
|
3428
|
-
type: 'FULL_SNAPSHOT' | 'LAYOUT_ONLY' | 'DATA_ONLY';
|
|
3429
|
-
timestamp: string;
|
|
3430
|
-
data?: TRow[];
|
|
3431
|
-
fields?: PivotField<TRow>[];
|
|
3432
|
-
layout?: PivotLayoutState;
|
|
3433
|
-
expandedPaths?: string[];
|
|
3434
|
-
preferences?: Record<string, any>;
|
|
3435
|
-
}
|
|
3436
|
-
interface IFileReader {
|
|
3437
|
-
read(file: File): Promise<any[]>;
|
|
3438
|
-
supports(file: File): boolean;
|
|
3439
|
-
}
|
|
3440
|
-
interface ValidationResult {
|
|
3441
|
-
isValid: boolean;
|
|
3442
|
-
errors: string[];
|
|
3443
|
-
warnings: string[];
|
|
3444
|
-
}
|
|
3445
|
-
|
|
3446
|
-
/** Progress update surfaced while a file is parsed in the worker. */
|
|
3447
|
-
interface ImportProgress {
|
|
3448
|
-
/** Coarse pipeline stage: reading | parsing | typing | finalizing. */
|
|
3449
|
-
phase: string;
|
|
3450
|
-
/** Overall completion, 0..100. */
|
|
3451
|
-
percent: number;
|
|
3452
|
-
}
|
|
3453
|
-
/** File kinds the import worker can parse off the main thread. */
|
|
3454
|
-
type ImportWorkerKind = 'csv' | 'json' | 'xml';
|
|
3455
|
-
/** Result posted back by the worker once parsing completes. */
|
|
3456
|
-
type ImportWorkerResult = {
|
|
3457
|
-
mode: 'data';
|
|
3458
|
-
data: any[];
|
|
3459
|
-
fields: PivotField<any>[];
|
|
3460
|
-
} | {
|
|
3461
|
-
mode: 'raw';
|
|
3462
|
-
value: any;
|
|
3463
|
-
};
|
|
3464
|
-
interface ParseFileOptions {
|
|
3465
|
-
onProgress?: (p: ImportProgress) => void;
|
|
3466
|
-
signal?: AbortSignal;
|
|
3467
|
-
}
|
|
3468
|
-
/**
|
|
3469
|
-
* Drives the import Web Worker for a single file: streams progress, resolves
|
|
3470
|
-
* with the parsed payload, and supports cooperative cancellation.
|
|
3471
|
-
*
|
|
3472
|
-
* Mirrors {@link ExportStreamController}, but imports are one-shot so each job
|
|
3473
|
-
* gets a dedicated worker that is terminated on completion, error or cancel —
|
|
3474
|
-
* `terminate()` also gives us instant, reliable cancellation mid-parse (a
|
|
3475
|
-
* synchronous parse loop cannot otherwise be interrupted).
|
|
3476
|
-
*/
|
|
3477
|
-
declare class ImportStreamController {
|
|
3478
|
-
private static jobCounter;
|
|
3479
|
-
/** Whether Web Workers are available in the current environment. */
|
|
3480
|
-
static isSupported(): boolean;
|
|
3481
|
-
/**
|
|
3482
|
-
* Parse `file` in the worker. Resolves with the worker payload, rejects with
|
|
3483
|
-
* an `AbortError` DOMException if `signal` is aborted, or a generic Error on
|
|
3484
|
-
* worker failure.
|
|
3485
|
-
*/
|
|
3486
|
-
parseFile(file: Blob, kind: ImportWorkerKind, opts?: ParseFileOptions): Promise<ImportWorkerResult>;
|
|
3487
|
-
}
|
|
3488
|
-
|
|
3489
|
-
interface ImportManagerOptions {
|
|
3490
|
-
/**
|
|
3491
|
-
* Reject files larger than this many bytes before reading them, to guard
|
|
3492
|
-
* against out-of-memory / browser-crash from oversized uploads. Defaults to
|
|
3493
|
-
* 500 MB; pass 0 to disable the guard.
|
|
3494
|
-
*/
|
|
3495
|
-
maxFileSizeBytes?: number;
|
|
3496
|
-
}
|
|
3497
|
-
interface ImportResult {
|
|
3498
|
-
snapshot: ImportSnapshot;
|
|
3499
|
-
validation: ValidationResult;
|
|
3500
|
-
/** True when the import was cancelled via the abort signal before completing. */
|
|
3501
|
-
cancelled?: boolean;
|
|
3502
|
-
}
|
|
3503
|
-
interface ProcessFileStreamingOptions {
|
|
3504
|
-
onProgress?: (p: ImportProgress) => void;
|
|
3505
|
-
signal?: AbortSignal;
|
|
3506
|
-
}
|
|
3507
|
-
interface ProcessFromUrlOptions extends ProcessFileStreamingOptions {
|
|
3508
|
-
/** Extra fetch() init (headers, method, credentials, …). */
|
|
3509
|
-
fetchInit?: RequestInit;
|
|
3510
|
-
}
|
|
3511
|
-
declare class ImportManager {
|
|
3512
|
-
private readers;
|
|
3513
|
-
private maxFileSizeBytes;
|
|
3514
|
-
private stream;
|
|
3515
|
-
constructor(options?: ImportManagerOptions);
|
|
3516
|
-
/**
|
|
3517
|
-
* Processes an uploaded file synchronously (whole-file read + parse on the
|
|
3518
|
-
* calling thread). Retained for back-compat and non-worker environments;
|
|
3519
|
-
* prefer {@link processFileStreaming} for large files.
|
|
3520
|
-
*/
|
|
3521
|
-
processFile(file: File): Promise<{
|
|
3522
|
-
snapshot: ImportSnapshot;
|
|
3523
|
-
validation: ValidationResult;
|
|
3524
|
-
}>;
|
|
3525
|
-
/**
|
|
3526
|
-
* Processes an uploaded file, offloading CSV/JSON parsing to a Web Worker so
|
|
3527
|
-
* the UI stays responsive on large files, reporting progress and honoring
|
|
3528
|
-
* cancellation. Excel (and environments without workers) transparently fall
|
|
3529
|
-
* back to the synchronous reader path.
|
|
3530
|
-
*/
|
|
3531
|
-
processFileStreaming(file: File, options?: ProcessFileStreamingOptions): Promise<ImportResult>;
|
|
3532
|
-
/**
|
|
3533
|
-
* Import an already-materialized array of row objects (e.g. an API/JSON
|
|
3534
|
-
* response). Fields are auto-discovered; values are used as-is (call
|
|
3535
|
-
* {@link coerceRecords} first if they are stringly-typed).
|
|
3536
|
-
*/
|
|
3537
|
-
processFromData(rows: any[], options?: ProcessFileStreamingOptions): Promise<ImportResult>;
|
|
3538
|
-
/**
|
|
3539
|
-
* Import delimited text (e.g. a clipboard paste from Excel/Sheets, which is
|
|
3540
|
-
* tab-separated). Delimiter is auto-detected; values are typed via the shared
|
|
3541
|
-
* CSV pipeline.
|
|
3542
|
-
*/
|
|
3543
|
-
processFromText(text: string, options?: ProcessFileStreamingOptions): Promise<ImportResult>;
|
|
3544
|
-
/**
|
|
3545
|
-
* Fetch data from a URL (or backend API) and import it. The response is
|
|
3546
|
-
* wrapped as a File so the format is detected from the URL extension /
|
|
3547
|
-
* content-type and parsed through the same worker pipeline.
|
|
3548
|
-
*/
|
|
3549
|
-
processFromUrl(url: string, options?: ProcessFromUrlOptions): Promise<ImportResult>;
|
|
3550
|
-
/**
|
|
3551
|
-
* Import one or more files, appending their rows into a single dataset with a
|
|
3552
|
-
* unioned field set. Progress is aggregated across files; any cancellation
|
|
3553
|
-
* aborts the whole batch.
|
|
3554
|
-
*/
|
|
3555
|
-
processFiles(files: FileList | File[], options?: ProcessFileStreamingOptions): Promise<ImportResult>;
|
|
3556
|
-
private assertSize;
|
|
3557
|
-
/** Which worker parse path applies to this file, or null for Excel/unknown. */
|
|
3558
|
-
private workerKind;
|
|
3559
|
-
private isAbort;
|
|
3560
|
-
private cancelledResult;
|
|
3561
|
-
/** Build a result from reader/worker content (raw data array or a snapshot object). */
|
|
3562
|
-
private buildFromContent;
|
|
3563
|
-
/** Build a DATA_ONLY result from a raw row array, reusing worker-computed fields when supplied. */
|
|
3564
|
-
private buildDataResult;
|
|
3565
|
-
}
|
|
3566
|
-
|
|
3567
|
-
/**
|
|
3568
|
-
* Dedicated delimited-text reader (CSV / TSV / plain text).
|
|
3569
|
-
*
|
|
3570
|
-
* Reads the file as UTF-8 TEXT (not raw bytes), so UTF-8 / Turkish / emoji
|
|
3571
|
-
* content is preserved instead of being mis-decoded as ANSI. Parsing/typing is
|
|
3572
|
-
* delegated to the shared {@link parseCsvToRows} pipeline (delimiter
|
|
3573
|
-
* auto-detect, RFC-4180 quoting, per-column type inference and locale-aware
|
|
3574
|
-
* coercion, leading-zero ids kept as strings) — the same code path the import
|
|
3575
|
-
* worker runs. This is used in preference to the SheetJS path for delimited
|
|
3576
|
-
* files.
|
|
3577
|
-
*/
|
|
3578
|
-
declare class CsvReader implements IFileReader {
|
|
3579
|
-
supports(file: File): boolean;
|
|
3580
|
-
read(file: File): Promise<any[]>;
|
|
3581
|
-
/** Parse delimited text into typed row objects. Exposed for testing. */
|
|
3582
|
-
static parse(text: string): Record<string, unknown>[];
|
|
3583
|
-
}
|
|
3584
|
-
|
|
3585
|
-
/**
|
|
3586
|
-
* Dependency-free XML reader for tabular data exports.
|
|
3587
|
-
*
|
|
3588
|
-
* Works in Node, Web Workers and the browser (no `DOMParser` needed). Handles
|
|
3589
|
-
* the common "rows" shapes:
|
|
3590
|
-
* <data><record><a>1</a><b>x</b></record> … </data> (element fields)
|
|
3591
|
-
* <rows><row id="1" name="x"/> … </rows> (attribute fields)
|
|
3592
|
-
* <root><a>1</a><b>2</b></root> (single flat record)
|
|
3593
|
-
* Attributes and leaf child-elements both become columns; values are typed with
|
|
3594
|
-
* the shared {@link coerceRecords} pipeline (locale numbers, dates, booleans;
|
|
3595
|
-
* leading-zero ids preserved). Prototype-polluting keys are neutralized.
|
|
3596
|
-
*/
|
|
3597
|
-
declare class XmlReader implements IFileReader {
|
|
3598
|
-
supports(file: File): boolean;
|
|
3599
|
-
read(file: File): Promise<any[]>;
|
|
3600
|
-
/** Parse XML text into typed row objects. Exposed for testing. */
|
|
3601
|
-
static parse(text: string): Record<string, unknown>[];
|
|
3602
|
-
}
|
|
3603
|
-
|
|
3604
|
-
declare class DataNormalizer {
|
|
3605
|
-
/**
|
|
3606
|
-
* Generates basic PivotFields from an array of raw data objects.
|
|
3607
|
-
* Scans a sample size of rows to determine data types.
|
|
3608
|
-
*/
|
|
3609
|
-
static extractFieldsFromData(data: any[], sampleSize?: number): PivotField<any>[];
|
|
3610
|
-
/**
|
|
3611
|
-
* Build pivot fields from a reviewed import plan (column mapping): explicit
|
|
3612
|
-
* caption + dataType per column, in the plan's order. Applies the same
|
|
3613
|
-
* area-assignment heuristic as {@link extractFieldsFromData} (first
|
|
3614
|
-
* string/date → row, first number → data).
|
|
3615
|
-
*/
|
|
3616
|
-
static buildFieldsFromPlan(plan: {
|
|
3617
|
-
dataField: string;
|
|
3618
|
-
caption: string;
|
|
3619
|
-
dataType: 'string' | 'number' | 'date' | 'boolean';
|
|
3620
|
-
}[], data?: any[], sampleSize?: number): PivotField<any>[];
|
|
3621
|
-
private static isAutoRowCandidate;
|
|
3622
|
-
private static isAutoDataCandidate;
|
|
3623
|
-
private static isHighCardinalityStringColumn;
|
|
3624
|
-
private static isIdentifierLikeKey;
|
|
3625
|
-
/** Union column keys across a sample of rows, preserving first-seen order. */
|
|
3626
|
-
private static collectKeys;
|
|
3627
|
-
private static inferType;
|
|
3628
|
-
private static formatCaption;
|
|
3629
|
-
}
|
|
3630
|
-
|
|
3631
|
-
type CellType = 'string' | 'number' | 'date' | 'boolean';
|
|
3632
|
-
/** Strip a leading UTF-8/UTF-16 BOM if present. */
|
|
3633
|
-
declare function stripBom(text: string): string;
|
|
3634
|
-
/**
|
|
3635
|
-
* Auto-detect the delimiter of a delimited-text sample by counting candidate
|
|
3636
|
-
* separators outside of quotes on the first few lines. Supports comma,
|
|
3637
|
-
* semicolon, tab and pipe (covers Excel-locale CSV and TSV).
|
|
3638
|
-
*/
|
|
3639
|
-
declare function detectDelimiter(sample: string): string;
|
|
3640
|
-
/**
|
|
3641
|
-
* Parse RFC-4180-style delimited text into a matrix of string cells.
|
|
3642
|
-
* Handles quoted fields, escaped quotes (`""`), embedded newlines and
|
|
3643
|
-
* mixed CRLF/LF line endings. The delimiter is auto-detected when omitted.
|
|
3644
|
-
*
|
|
3645
|
-
* `onProgress` (optional) is invoked periodically with the fraction of the
|
|
3646
|
-
* input consumed (0..1) so long parses run in a worker can report progress.
|
|
3647
|
-
*/
|
|
3648
|
-
declare function parseDelimited(text: string, delimiter?: string, onProgress?: (fraction: number) => void): string[][];
|
|
3649
|
-
/** Lenient boolean parse used for COERCION within a known boolean column. */
|
|
3650
|
-
declare function parseBoolean(raw: unknown): boolean | null;
|
|
3651
|
-
/**
|
|
3652
|
-
* Parse a locale-formatted number: handles thousands/decimal separators in
|
|
3653
|
-
* both `1,234.56` and `1.234,56` conventions, currency symbols, percent,
|
|
3654
|
-
* spaces (incl. non-breaking) and accounting parentheses for negatives.
|
|
3655
|
-
* Returns null when the input is not a number.
|
|
3656
|
-
*/
|
|
3657
|
-
declare function parseLocaleNumber(raw: unknown): number | null;
|
|
3658
|
-
/**
|
|
3659
|
-
* Parse a variety of common date formats to a Date: ISO (date or datetime),
|
|
3660
|
-
* `yyyy/mm/dd`, `yyyy.mm.dd`, and `dd/mm/yyyy`/`mm/dd/yyyy` (disambiguated by
|
|
3661
|
-
* the day value when possible, defaulting to day-first). Plain integers and
|
|
3662
|
-
* separatorless strings are intentionally NOT treated as dates.
|
|
3663
|
-
*/
|
|
3664
|
-
declare function parseFlexibleDate(raw: unknown): Date | null;
|
|
3665
|
-
/** Classify a single raw cell value into a pivot data type (or 'blank'). */
|
|
3666
|
-
declare function classifyValue(val: unknown): CellType | 'blank';
|
|
3667
|
-
/**
|
|
3668
|
-
* Infer a column's type from a set of sampled values by majority vote over
|
|
3669
|
-
* non-blank cells. Ties and empty columns default to 'string'.
|
|
3670
|
-
*/
|
|
3671
|
-
declare function inferColumnType(values: unknown[]): CellType;
|
|
3672
|
-
/**
|
|
3673
|
-
* Coerce a raw value to the target column type. Returns null for blanks and
|
|
3674
|
-
* for values that cannot be represented in the target type (so a stray text
|
|
3675
|
-
* cell in a numeric column becomes empty rather than corrupting aggregation).
|
|
3676
|
-
*/
|
|
3677
|
-
declare function coerceValue(val: unknown, type: CellType): unknown;
|
|
3678
|
-
/** Return a key safe to assign as an own property (renames prototype-polluting keys). */
|
|
3679
|
-
declare function safeKey(key: string): string;
|
|
3680
|
-
/**
|
|
3681
|
-
* Defensively neutralize prototype-polluting own keys in already-parsed rows
|
|
3682
|
-
* (e.g. from SheetJS/JSON, whose keys come from untrusted files). Returns the
|
|
3683
|
-
* same array untouched when nothing dangerous is present (the common case).
|
|
3684
|
-
*/
|
|
3685
|
-
declare function sanitizeRows<T extends Record<string, unknown>>(rows: T[]): Record<string, unknown>[];
|
|
3686
|
-
interface CsvParseProgress {
|
|
3687
|
-
phase: 'parsing' | 'typing';
|
|
3688
|
-
/** Overall completion 0..100. */
|
|
3689
|
-
percent: number;
|
|
3690
|
-
}
|
|
3691
|
-
/** Ensure unique, non-empty header names (duplicates get a numeric suffix); prototype-safe. */
|
|
3692
|
-
declare function dedupeHeaders(headers: string[]): string[];
|
|
3693
|
-
/**
|
|
3694
|
-
* Infer per-column types from a sample of already-parsed string/loose records
|
|
3695
|
-
* and coerce every cell (locale numbers, dates, booleans; leading-zero ids kept
|
|
3696
|
-
* as strings), returning fresh prototype-safe row objects. Shared by any source
|
|
3697
|
-
* that yields untyped records (XML, and future sources). `onProgress` reports
|
|
3698
|
-
* typing completion 0..100.
|
|
3699
|
-
*/
|
|
3700
|
-
declare function coerceRecords(records: Record<string, unknown>[], onProgress?: (p: CsvParseProgress) => void): Record<string, unknown>[];
|
|
3701
|
-
/**
|
|
3702
|
-
* Full delimited-text → typed-row pipeline: BOM strip, delimiter auto-detect,
|
|
3703
|
-
* RFC-4180 parse, header dedupe, per-column type inference from a sample and
|
|
3704
|
-
* per-cell coercion (locale numbers, dates, booleans; leading-zero ids kept as
|
|
3705
|
-
* strings). Optional `onProgress` reports overall completion (parse 0→60%,
|
|
3706
|
-
* typing 60→100%) so a worker can surface a progress bar. This is the single
|
|
3707
|
-
* implementation shared by {@link CsvReader} (sync) and the import worker.
|
|
3708
|
-
*/
|
|
3709
|
-
declare function parseCsvToRows(text: string, onProgress?: (p: CsvParseProgress) => void): Record<string, unknown>[];
|
|
3710
|
-
|
|
3711
3703
|
/** The parts of the pivot a model may read and change. */
|
|
3712
3704
|
type PivotAiFeature = 'fields' | 'filter' | 'sort' | 'totals';
|
|
3713
3705
|
declare const PIVOT_AI_FEATURES: readonly PivotAiFeature[];
|
|
@@ -3912,4 +3904,4 @@ declare function rollupInMemory<TRow>(rows: readonly TRow[], request: PivotServe
|
|
|
3912
3904
|
/** Every value of a field in rows held in memory — the reference `loadFieldValues`. */
|
|
3913
3905
|
declare function fieldValuesInMemory<TRow>(rows: readonly TRow[], field: PivotServerField): unknown[];
|
|
3914
3906
|
|
|
3915
|
-
export { type AdvancedExportRequest, type AdvancedExporter, CHART_LEGEND_POSITIONS, CHART_PALETTE_NAMES, type CalculatedFieldTextKey, type CellClickEvent, type CellPath, type CellPreparedEvent, type
|
|
3907
|
+
export { type AdvancedExportRequest, type AdvancedExporter, CHART_LEGEND_POSITIONS, CHART_PALETTE_NAMES, type CalculatedFieldTextKey, type CellClickEvent, type CellPath, type CellPreparedEvent, type ChartCategoryKeyAction, type ChartFont, type ChartFormat, type ChartGridLines, type ChartImageRequest, type ChartKeyTextKey, type ChartLabelAngle, type ChartLegendPosition, type ChartMark, type ChartPaletteName, type ChartStacking, type ChartStyle, type ChartStyleDefaults, type ColHeaderCell, type ColumnSlot, type ColumnSlotOptions, type ConditionalVisual, type CustomSummaryOptions, DEFAULT_DATA_COLUMN_WIDTH, DEFAULT_ROW_HEADER_WIDTH, type DateFormatContext, DateFormatter, type DateGranularity, type DimensionFieldInfo, type DrillDownTextKey, type DropIntent, type ExportFormat, type ExportOptions, ExportStreamController, type ExportingEvent, FILTER_AREA_PADDING, FILTER_AREA_ROW_GAP, FastTrie, type FieldDistinctEntry, type FieldMoveEvent, type FilterCondition, type FilterGroup, type FilterOperator, type FlatCellMatrix, FlatPivotEngine, type FlatRow, type FloatingFrame, type FrameRect, type FrameSize, type FunnelStage, type HeaderFilterOption, type HeaderFilterState, type HeaderFilterWrite, type HistogramBin, type LargeExportInfo, MAX_C, type MarkTone, PIVOT_AI_FEATURES, PIVOT_LICENSE_TEXT, PIVOT_STATE_VERSION, type PersistedPivotFilters, type PersistedPivotState, type PivotAiApplyResult, type PivotAiCondition, type PivotAiFeature, type PivotAiFieldOptions, type PivotAiFilter, type PivotAiOptions, type PivotAiSort, type PivotAiState, type PivotAiTotals, type PivotAiValue, type PivotArea, type PivotCell, PivotCellAggregator, type PivotCellTemplate, type PivotCellTextAccessor, type PivotCellValueAccessor, type PivotChartChange, type PivotChartChangedEvent, type PivotChartClosedEvent, type PivotChartOpenedEvent, type PivotChartReportPart, type PivotChartState, type PivotChartWindowState, type PivotColumnWidthDefaults, type PivotConditionRule, PivotController, type PivotControllerCallbacks, type PivotControllerEvents, type PivotControllerOptions, type PivotControllerState, type PivotDataSource, type PivotDensity, type PivotDictionary, type PivotDragIntentState, PivotEngineRegistry, type PivotEngineResult, PivotEngineService, type PivotEngineServiceConfig, PivotEventEmitter, type PivotEventHandler, type PivotEventMap, PivotExportService, type PivotField, PivotFieldService, type PivotGridRef, type PivotGroupInterval, type PivotLabelFilter, type PivotLayoutProfile, type PivotLayoutState, type PivotLocale, type PivotNode, type PivotPlugin, type PivotPrefilter, type PivotReport, PivotReportManager, PivotReportService, type PivotReportState, type PivotRowKey, type PivotRowKeyResolver, type PivotRowSparkline, type PivotRowTransaction, type PivotSelectionMode, PivotSelectionModel, type PivotSelectionRange, type PivotSelectionState, type PivotSelectionStats, type PivotServerCell, type PivotServerField, type PivotServerInput, type PivotServerRequest, type PivotServerResponse, type PivotServerSource, type PivotServerSourceOptions, type PivotServerValue, type PivotStateListener, type PivotStateSession, PivotStateStore, type PivotStateStoringConfig, type PivotSummaryColumn, type PivotSummaryDisplayMode, type PivotSummaryTable, type PivotSummaryTableOptions, type PivotSummaryType, type PivotTheme, type PivotToolbarConfig, type PivotTransactionResult, type PivotValue, type PivotValueFilter, type PopupPlacement, type PopupViewport, type PrefilterConditionSpec, type PrefilterGroupSpec, ROW_HEADER_MAX_PINNED_FRACTION, ROW_HEADER_MIN_COL_WIDTH, ROW_HEADER_MIN_DATA_STRIP, type ReportStatePart, type RowHeaderLayout, SHAPE_CHART_TYPES, type ShapeChartInput, type ShapeChartType, type StackedSegment, type TreemapCell, type TrendShape, type ValueRange, type WaterfallStep, type WorkerComputeRequest, type WorkerFilterRequest, type WorkerFilterSpec, type WorkerInitRequest, type WorkerResponse, type WorkerTransactionRequest, type XYPair, type XYPairInput, applyPivotAiState, ar, attachFloatingFrame, bindPivotScrollMemory, buildCellLookup, buildColPathsList, buildColumnHeaders, buildEngineResult, buildPivotAOA, buildRowLabelCells, calculatedFieldText, cellHash, cellHashCol, cellHashRow, centredFrame, chartCategoryKey, chartKeyText, chartPalette, chartWindowFrame, clearFormatCache, collatorFor, columnSlotOptions, compileSafeFormula, computeFieldRanges, computePivotMatrixAsync, computeRowHeaderWidths, computedFields, conditionRuleToExcelStyle, countFilteredFields, cssColorToRgb, de, defaultPivotLayout, destroyEngineWorker, diffPivotChartState, drillDownText, en, es, escapeXmlText, executePostAggregationPhase, executeSummaryDisplayModesPhase, exportPivotData, extractGroupValue, fieldNeedsRange, fieldValuesInMemory, filterAreaMaxHeight, filterAreaRows, filterEmptySummaryTree, filterPivotEngineAsync, filterRecords, filterRecordsAsync, flattenExportRows, flattenRowTree, flattenRowTreeTabular, flattenRowTreeTree, formatCellValue, formatCellValueCached, formatDimensionValue, formatHeaderValue, fr, funnelMarks, funnelStages, getAdvancedExporter, getCellVal, getFieldDistinctValues, getPivotAiSchema, getPivotAiState, getRecordsForCells, getSummaryTable, getVisibleColLeaves, getVisibleColSlots, getVisibleLeafCount, getVisibleMaxDepth, grandTotalShown, headerFilterShown, headerFilterWrite, heatColor, heatTextColor, heatmapMarks, histogramBins, histogramMarks, initPivotEngineAsync, intlFormatToExcelNumFmt, invertRowHeaderWidth, it, ja, keepFieldGroups, keepFocusAcross, ko, logAxisTicks, mergePersistedState, nextChartWindowId, nextLiveText, pairSeriesForXY, parseColor, pathKey, pathParts, percentAxisTicks, percentModeExcelNumFmt, percentModeText, pivotChangeAnnouncement, pivotDensityClass, pivotLicenseText, pivotRowHeight, pivotRowTrend, pivotSchemeTheme, pivotServerSource, placePopup, popupViewport, pt, rangeBarMarks, rangeRatio, readChartFormat, readFrameRect, readPivotChartState, reconfigurePivotEngineAsync, registerAdvancedExporter, resolveChartPalette, resolveChartStyle, resolveColPath, resolveColumnWidthDefaults, resolveConditionalVisual, rollupInMemory, ru, scaleColor, serverRequestFor, setActiveEngineGrid, shownFields, sortPivotTree, splitPersistedState, squarify, stackSeries, subtotalFor, summaryTypeLabel, sunburstMarks, testSafeFormula, tr, treemapMarks, trendColumnPaths, trendShape, waterfallDomain, waterfallMarks, waterfallSteps, windowStartFor, zhCN };
|