@kanunilabs/pivotgrid-core 1.11.1 → 1.11.3
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 +515 -424
- package/dist/index.d.ts +515 -424
- 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.ts
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;
|
|
@@ -1630,8 +1639,26 @@ interface ExportOptions {
|
|
|
1630
1639
|
includeHiddenFields?: boolean;
|
|
1631
1640
|
/** Locale for formatting. */
|
|
1632
1641
|
locale?: string;
|
|
1642
|
+
/**
|
|
1643
|
+
* Asked before a styled Excel export gives way to the plain one (B.23): a
|
|
1644
|
+
* list over 100,000 rows or a pivot over 150,000 cells is written as
|
|
1645
|
+
* SpreadsheetML (.xls) without conditional formats, outline levels, the
|
|
1646
|
+
* frozen pane or column widths. Return `false` (or a Promise of it) to write
|
|
1647
|
+
* nothing; anything else goes on. The grid's own `onLargeExport` is used
|
|
1648
|
+
* when the call gives none.
|
|
1649
|
+
*/
|
|
1650
|
+
onLargeExport?: (info: LargeExportInfo) => boolean | void | Promise<boolean | void>;
|
|
1651
|
+
}
|
|
1652
|
+
/** What {@link ExportOptions.onLargeExport} is told. */
|
|
1653
|
+
interface LargeExportInfo {
|
|
1654
|
+
format: 'excel-list' | 'excel-pivot';
|
|
1655
|
+
/** Rows (`excel-list`) or engine cells (`excel-pivot`). */
|
|
1656
|
+
size: number;
|
|
1657
|
+
/** The threshold it is over: 100,000 rows or 150,000 cells. */
|
|
1658
|
+
limit: number;
|
|
1659
|
+
unit: 'rows' | 'cells';
|
|
1633
1660
|
}
|
|
1634
|
-
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>;
|
|
1635
1662
|
declare function escapeXmlText(value: string): string;
|
|
1636
1663
|
declare function getCellVal(engineResult: PivotEngineResult, rHash: string, cHash: string, dfId: string, dataFields: PivotField[], cellLookup: Map<number, number>, preferDisplay?: boolean): number | "";
|
|
1637
1664
|
/** Per-cell style resolved from a data field's conditional-formatting rules. */
|
|
@@ -1789,7 +1816,7 @@ interface PivotTheme {
|
|
|
1789
1816
|
* default, and what an unset value means), `comfortable` 36px. Independent of
|
|
1790
1817
|
* the colours (`theme`).
|
|
1791
1818
|
*/
|
|
1792
|
-
type PivotDensity = 'compact' | 'normal' | 'comfortable';
|
|
1819
|
+
type PivotDensity = 'compact' | 'normal' | 'comfortable' | 'touch';
|
|
1793
1820
|
interface CustomSummaryOptions {
|
|
1794
1821
|
summaryProcess: 'start' | 'calculate' | 'finalize';
|
|
1795
1822
|
value: number | null;
|
|
@@ -1826,7 +1853,39 @@ interface PivotField<TRow = any, TCellTemplate = PivotCellTemplate, TStyle = any
|
|
|
1826
1853
|
area?: PivotArea;
|
|
1827
1854
|
/** Position index within the area. */
|
|
1828
1855
|
areaIndex?: number;
|
|
1829
|
-
/**
|
|
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[];
|
|
1867
|
+
/**
|
|
1868
|
+
* A data field that is computed but never shown (Tekax B.21): a summary
|
|
1869
|
+
* formula reads it (`[Amount] / [Qty]` with Amount and Qty as helpers), but
|
|
1870
|
+
* it has no column on screen or in an export, no chip in the data area and
|
|
1871
|
+
* no entry in the field chooser. Put it in `area: 'data'`.
|
|
1872
|
+
*/
|
|
1873
|
+
helper?: boolean;
|
|
1874
|
+
/**
|
|
1875
|
+
* Fields with the same `group` move as one (Enterprise, Tekax B.26): drag,
|
|
1876
|
+
* menu or API, the group lands side by side in one area. `groupIndex`
|
|
1877
|
+
* orders the members (otherwise their order in the field list).
|
|
1878
|
+
*/
|
|
1879
|
+
group?: string;
|
|
1880
|
+
groupIndex?: number;
|
|
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
|
+
*/
|
|
1830
1889
|
visible?: boolean;
|
|
1831
1890
|
/**
|
|
1832
1891
|
* Aggregation type. The built-ins are computed in the Web Worker; `'custom'`
|
|
@@ -1937,6 +1996,19 @@ interface PivotLayoutState {
|
|
|
1937
1996
|
showRowTotals?: boolean;
|
|
1938
1997
|
/** Whether subtotals appear above or below their groups. */
|
|
1939
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;
|
|
1940
2012
|
/**
|
|
1941
2013
|
* Coarse form of `showRowGrandTotals` + `showColumnGrandTotals`. Bridged to
|
|
1942
2014
|
* them at the controller boundary; an explicitly passed granular flag wins.
|
|
@@ -1959,6 +2031,19 @@ interface PivotLayoutState {
|
|
|
1959
2031
|
prefilter?: PivotPrefilter;
|
|
1960
2032
|
showFooter?: boolean;
|
|
1961
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;
|
|
1962
2047
|
/** Chart integration type when rendering in chart mode. */
|
|
1963
2048
|
chartType?: string;
|
|
1964
2049
|
}
|
|
@@ -1991,7 +2076,6 @@ interface PivotStateStoringConfig {
|
|
|
1991
2076
|
}
|
|
1992
2077
|
interface PivotToolbarConfig {
|
|
1993
2078
|
showSaveReport?: boolean;
|
|
1994
|
-
showImportFile?: boolean;
|
|
1995
2079
|
showExportButton?: boolean;
|
|
1996
2080
|
showCalculatedFields?: boolean;
|
|
1997
2081
|
showFullscreenToggle?: boolean;
|
|
@@ -2033,6 +2117,15 @@ interface CellClickEvent<TRow = any, TNativeEvent = unknown> {
|
|
|
2033
2117
|
colPath: string[];
|
|
2034
2118
|
records?: TRow[];
|
|
2035
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
|
+
*/
|
|
2036
2129
|
interface FieldMoveEvent {
|
|
2037
2130
|
fieldId: string;
|
|
2038
2131
|
sourceArea: string;
|
|
@@ -2057,40 +2150,6 @@ interface ExportingEvent {
|
|
|
2057
2150
|
format: string;
|
|
2058
2151
|
cancel: boolean;
|
|
2059
2152
|
}
|
|
2060
|
-
interface PivotImportStatus {
|
|
2061
|
-
isOpen: boolean;
|
|
2062
|
-
status: 'loading' | 'success' | 'error' | 'warning';
|
|
2063
|
-
title: string;
|
|
2064
|
-
messages: string[];
|
|
2065
|
-
/** Overall parse progress 0..100 (present only while streaming a large file). */
|
|
2066
|
-
progress?: number;
|
|
2067
|
-
/** Coarse pipeline stage label (reading | parsing | typing | finalizing). */
|
|
2068
|
-
phase?: string;
|
|
2069
|
-
/** Whether the in-flight import can be cancelled by the user. */
|
|
2070
|
-
cancellable?: boolean;
|
|
2071
|
-
}
|
|
2072
|
-
/** One detected column in the import preview / column-mapping step. */
|
|
2073
|
-
interface PivotImportField {
|
|
2074
|
-
/** Source data key. */
|
|
2075
|
-
dataField: string;
|
|
2076
|
-
/** Display caption (editable in the mapping UI). */
|
|
2077
|
-
caption: string;
|
|
2078
|
-
/** Detected data type (editable in the mapping UI). */
|
|
2079
|
-
dataType: 'string' | 'number' | 'date' | 'boolean';
|
|
2080
|
-
}
|
|
2081
|
-
/**
|
|
2082
|
-
* Parsed-but-not-yet-committed import awaiting user review (preview + column
|
|
2083
|
-
* mapping). Held in observable state; the full row set is kept privately by the
|
|
2084
|
-
* controller and applied on commit.
|
|
2085
|
-
*/
|
|
2086
|
-
interface PivotImportPreviewState {
|
|
2087
|
-
fields: PivotImportField[];
|
|
2088
|
-
/** First-N rows for the preview table. */
|
|
2089
|
-
sample: Record<string, unknown>[];
|
|
2090
|
-
/** Total parsed row count. */
|
|
2091
|
-
rowCount: number;
|
|
2092
|
-
warnings: string[];
|
|
2093
|
-
}
|
|
2094
2153
|
type DropIntent = 'before' | 'after' | 'append' | null;
|
|
2095
2154
|
interface PivotDragIntentState {
|
|
2096
2155
|
activeId: string | null;
|
|
@@ -2123,17 +2182,37 @@ interface PivotControllerState<TRow = any> {
|
|
|
2123
2182
|
*/
|
|
2124
2183
|
columnWidths: Record<string, number>;
|
|
2125
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
|
+
*/
|
|
2126
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;
|
|
2127
2205
|
/** Monotonic engine build progress shown by UI loaders. 0..100, simulated when exact worker progress is unavailable. */
|
|
2128
2206
|
buildProgress?: number;
|
|
2129
2207
|
engineError: Error | null;
|
|
2130
2208
|
selectionStats: PivotSelectionStats | null;
|
|
2131
2209
|
reports: PivotReport[];
|
|
2132
2210
|
activeReportId: string | null;
|
|
2133
|
-
importStatus: PivotImportStatus;
|
|
2134
|
-
/** Pending import awaiting preview/column-mapping review (null when none). */
|
|
2135
|
-
importPreview: PivotImportPreviewState | null;
|
|
2136
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;
|
|
2137
2216
|
/**
|
|
2138
2217
|
* The quick search (`setSearchText`): only the row members whose caption
|
|
2139
2218
|
* (as the header draws it — a month by its name) contains it are shown,
|
|
@@ -2144,13 +2223,22 @@ interface PivotControllerState<TRow = any> {
|
|
|
2144
2223
|
}
|
|
2145
2224
|
interface PivotControllerCallbacks<TRow = any> {
|
|
2146
2225
|
onRefresh?: () => void;
|
|
2147
|
-
onImportData?: (data: TRow[]) => void;
|
|
2148
2226
|
onFieldsChange?: (fields: PivotField<TRow>[]) => void;
|
|
2149
2227
|
onLayoutChange?: (layout: PivotLayoutState) => void;
|
|
2150
2228
|
onFieldMove?: (e: FieldMoveEvent) => void | Promise<void>;
|
|
2151
2229
|
onBeforePivotCalculate?: () => void;
|
|
2152
2230
|
onAfterPivotCalculate?: (result: PivotEngineResult) => void;
|
|
2153
2231
|
onExporting?: (e: ExportingEvent) => void;
|
|
2232
|
+
/** Before a styled Excel export gives way to the plain one; `false` cancels (B.23). See `ExportOptions.onLargeExport`. */
|
|
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;
|
|
2154
2242
|
onError?: (error: Error) => void;
|
|
2155
2243
|
onChartStateLoaded?: (chartState: any) => void;
|
|
2156
2244
|
}
|
|
@@ -2171,11 +2259,6 @@ interface PivotControllerOptions<TRow = any> extends PivotControllerCallbacks<TR
|
|
|
2171
2259
|
serverSource?: PivotServerSource;
|
|
2172
2260
|
locale?: string;
|
|
2173
2261
|
workerUrl?: string | URL;
|
|
2174
|
-
/**
|
|
2175
|
-
* When true, file/URL/paste imports first open a preview + column-mapping
|
|
2176
|
-
* step instead of applying immediately. Defaults to false (apply directly).
|
|
2177
|
-
*/
|
|
2178
|
-
previewImport?: boolean;
|
|
2179
2262
|
/**
|
|
2180
2263
|
* Where the grid's layout is persisted between sessions.
|
|
2181
2264
|
*
|
|
@@ -2203,6 +2286,14 @@ interface PivotControllerOptions<TRow = any> extends PivotControllerCallbacks<TR
|
|
|
2203
2286
|
rowKey?: PivotRowKeyResolver<TRow>;
|
|
2204
2287
|
/** How long `applyTransactionAsync` collects transactions before applying them together. Default 50 ms. */
|
|
2205
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;
|
|
2206
2297
|
/**
|
|
2207
2298
|
* Most column members shown (default 1000). A field with a value per row on
|
|
2208
2299
|
* columns makes tens of thousands of them and freezes the page; past the cap
|
|
@@ -2244,7 +2335,10 @@ interface PivotGridRef {
|
|
|
2244
2335
|
* source-compatible — existing callers ignore the return either way.
|
|
2245
2336
|
*/
|
|
2246
2337
|
exportData: (format: ExportFormat | string, options?: ExportOptions) => Promise<void>;
|
|
2247
|
-
|
|
2338
|
+
/** One more level; `{ allLevels: true }` opens every level (B.44). */
|
|
2339
|
+
expandAll: (options?: {
|
|
2340
|
+
allLevels?: boolean;
|
|
2341
|
+
}) => void;
|
|
2248
2342
|
collapseAll: () => void;
|
|
2249
2343
|
getState: () => PivotControllerState;
|
|
2250
2344
|
setFields: (fields: PivotField[]) => void;
|
|
@@ -2377,6 +2471,14 @@ declare function readPivotChartState(input: unknown): PivotChartState | null;
|
|
|
2377
2471
|
declare function diffPivotChartState(previous: PivotChartState, next: PivotChartState): PivotChartChange[];
|
|
2378
2472
|
|
|
2379
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];
|
|
2380
2482
|
/**
|
|
2381
2483
|
* Where the store reads and writes.
|
|
2382
2484
|
*
|
|
@@ -2438,6 +2540,17 @@ declare class PivotStateStore<TRow> {
|
|
|
2438
2540
|
*/
|
|
2439
2541
|
pendingLoad: Promise<PersistedPivotState | null> | null;
|
|
2440
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;
|
|
2441
2554
|
/**
|
|
2442
2555
|
* What lives outside the store but is saved with it — the controller's
|
|
2443
2556
|
* registered parts and the reported scroll. Set by the controller.
|
|
@@ -2461,8 +2574,6 @@ declare class PivotStateStore<TRow> {
|
|
|
2461
2574
|
setExpandedPaths(paths: string[] | Set<string>): void;
|
|
2462
2575
|
setExpandedColPaths(paths: string[] | Set<string>): void;
|
|
2463
2576
|
setSelectionStats(selectionStats: PivotSelectionStats | null): void;
|
|
2464
|
-
setImportStatus(importStatus: PivotImportStatus): void;
|
|
2465
|
-
setImportPreview(importPreview: PivotControllerState<TRow>['importPreview']): void;
|
|
2466
2577
|
private createInitialSnapshot;
|
|
2467
2578
|
/** A stored state as snapshot parts, or null when this build cannot read it. */
|
|
2468
2579
|
private revive;
|
|
@@ -2508,26 +2619,6 @@ interface PivotControllerEvents<TRow> {
|
|
|
2508
2619
|
left: number;
|
|
2509
2620
|
};
|
|
2510
2621
|
}
|
|
2511
|
-
interface PivotImportLabels {
|
|
2512
|
-
initializing: string;
|
|
2513
|
-
processing: string;
|
|
2514
|
-
importError: string;
|
|
2515
|
-
importWarning: string;
|
|
2516
|
-
importSuccess: string;
|
|
2517
|
-
dataImportUnsupported: string;
|
|
2518
|
-
/** Shown when the user cancels an in-flight import. Optional (falls back to a default). */
|
|
2519
|
-
cancelled?: string;
|
|
2520
|
-
/** Cancel-button caption in the import progress dialog. Optional. */
|
|
2521
|
-
cancel?: string;
|
|
2522
|
-
}
|
|
2523
|
-
/**
|
|
2524
|
-
* Framework-agnostic pivot grid controller.
|
|
2525
|
-
*
|
|
2526
|
-
* Orchestrates field management, engine computation (via Web Worker),
|
|
2527
|
-
* state persistence, export, and event emission. Consumed by React/Angular adapters.
|
|
2528
|
-
*
|
|
2529
|
-
* @typeParam TRow - Shape of source data rows.
|
|
2530
|
-
*/
|
|
2531
2622
|
declare class PivotController<TRow> {
|
|
2532
2623
|
private store;
|
|
2533
2624
|
private events;
|
|
@@ -2539,10 +2630,6 @@ declare class PivotController<TRow> {
|
|
|
2539
2630
|
private options;
|
|
2540
2631
|
private reportService;
|
|
2541
2632
|
private engineService;
|
|
2542
|
-
private importManager;
|
|
2543
|
-
private importAbort?;
|
|
2544
|
-
/** Full row set of a parsed import awaiting preview commit (kept out of observable state). */
|
|
2545
|
-
private pendingImportRows;
|
|
2546
2633
|
private disposed;
|
|
2547
2634
|
/** The body's scroll offsets, as the renderer last reported them. */
|
|
2548
2635
|
private lastScroll;
|
|
@@ -2609,7 +2696,17 @@ declare class PivotController<TRow> {
|
|
|
2609
2696
|
registerReportStatePart(key: string, part: ReportStatePart): () => void;
|
|
2610
2697
|
private collectReportParts;
|
|
2611
2698
|
updateOptions(options: Partial<PivotControllerOptions<TRow>>): void;
|
|
2612
|
-
|
|
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;
|
|
2613
2710
|
/**
|
|
2614
2711
|
* Replace every row — a full rebuild, transactions included. Unlike
|
|
2615
2712
|
* `updateOptions({ data })`, passing the array the grid started from still
|
|
@@ -2642,26 +2739,72 @@ declare class PivotController<TRow> {
|
|
|
2642
2739
|
applyTransactionAsync(transaction: PivotRowTransaction<TRow>, callback?: () => void): void;
|
|
2643
2740
|
/** Apply the queued transactions now, as one. */
|
|
2644
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;
|
|
2645
2751
|
/** How many transactions are waiting to be applied. */
|
|
2646
2752
|
getPendingAsyncTransactionCount(): number;
|
|
2647
2753
|
updateField(updatedField: PivotField<TRow>): void;
|
|
2648
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). */
|
|
2649
2756
|
changeFieldArea(fieldId: string, area: PivotArea): void;
|
|
2650
2757
|
/**
|
|
2651
|
-
*
|
|
2652
|
-
*
|
|
2653
|
-
* The
|
|
2654
|
-
|
|
2655
|
-
|
|
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.
|
|
2656
2785
|
*/
|
|
2657
2786
|
showFields(fieldIds: string[]): void;
|
|
2658
2787
|
removeField(fieldId: string): void;
|
|
2659
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;
|
|
2660
2801
|
sortField(fieldId: string, direction: 'asc' | 'desc' | undefined): void;
|
|
2661
2802
|
sortFieldBySummary(rowFieldId: string, summaryFieldId: string, colPath: string): void;
|
|
2662
2803
|
clearAllSorting(): void;
|
|
2663
2804
|
applyFilter(fieldId: string, selectedValues: Set<any>, filterType: 'include' | 'exclude'): void;
|
|
2664
2805
|
clearFilter(fieldId: string): void;
|
|
2806
|
+
/** Every field's filter — values, value and label filters — off in one change (B.28). The prefilter stays. */
|
|
2807
|
+
clearAllFilters(): void;
|
|
2665
2808
|
/**
|
|
2666
2809
|
* Quick search: show only the row members whose caption contains `text`
|
|
2667
2810
|
* (ignoring case and accents), with the members above them. A view on top
|
|
@@ -2690,8 +2833,21 @@ declare class PivotController<TRow> {
|
|
|
2690
2833
|
* cuts the tree on screen, so then the uncut one is computed and walked:
|
|
2691
2834
|
* walking the cut one left every member the search hid closed, and every
|
|
2692
2835
|
* column past the cap. Resolves when the new paths are set.
|
|
2693
|
-
|
|
2694
|
-
|
|
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>;
|
|
2695
2851
|
collapseAll(): void;
|
|
2696
2852
|
setColumnWidths(widths: Record<string, number>): void;
|
|
2697
2853
|
setSelectionStats(selectionStats: PivotSelectionStats | null): void;
|
|
@@ -2704,39 +2860,15 @@ declare class PivotController<TRow> {
|
|
|
2704
2860
|
left: number;
|
|
2705
2861
|
top: number;
|
|
2706
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
|
+
*/
|
|
2707
2871
|
commitDrag(fieldId: string, overId: string | null): Promise<void>;
|
|
2708
|
-
/** Import a single uploaded file (worker-streamed for CSV/JSON/XML). */
|
|
2709
|
-
importFile(file: File, labels: PivotImportLabels): Promise<void>;
|
|
2710
|
-
/** Import one or more files at once, appending their rows (union fields). */
|
|
2711
|
-
importFiles(files: FileList | File[], labels: PivotImportLabels): Promise<void>;
|
|
2712
|
-
/** Import data fetched from a URL / backend API endpoint. */
|
|
2713
|
-
importFromUrl(url: string, labels: PivotImportLabels, fetchInit?: RequestInit): Promise<void>;
|
|
2714
|
-
/** Import an already-materialized array of rows (e.g. an API response). */
|
|
2715
|
-
importData(rows: any[], labels: PivotImportLabels): Promise<void>;
|
|
2716
|
-
/** Import delimited text pasted from the clipboard (auto-detects CSV/TSV). */
|
|
2717
|
-
importText(text: string, labels: PivotImportLabels): Promise<void>;
|
|
2718
|
-
/**
|
|
2719
|
-
* Shared import driver: manages the abort/progress lifecycle and status
|
|
2720
|
-
* dialog around any import source (`task` performs the actual parse).
|
|
2721
|
-
*/
|
|
2722
|
-
private runImport;
|
|
2723
|
-
/** Cancel an in-flight import started by {@link importFile}/{@link importFiles}/{@link importFromUrl}. */
|
|
2724
|
-
cancelImport(): void;
|
|
2725
|
-
/** Show a terminal import status message (e.g. clipboard empty / permission denied). */
|
|
2726
|
-
showImportStatus(status: 'success' | 'error' | 'warning', title: string, messages: string[]): void;
|
|
2727
|
-
/** Stash a parsed import and open the preview/column-mapping step. */
|
|
2728
|
-
private openImportPreview;
|
|
2729
|
-
/**
|
|
2730
|
-
* Commit a previewed import using the reviewed column plan (include/exclude,
|
|
2731
|
-
* caption + type overrides). Columns whose type changed are re-coerced.
|
|
2732
|
-
*/
|
|
2733
|
-
commitImport(plan: (PivotImportField & {
|
|
2734
|
-
include?: boolean;
|
|
2735
|
-
})[] | undefined, labels: PivotImportLabels): void;
|
|
2736
|
-
/** Discard a pending previewed import without applying it. */
|
|
2737
|
-
cancelImportPreview(): void;
|
|
2738
|
-
private showImportCancelled;
|
|
2739
|
-
closeImportStatus(): void;
|
|
2740
2872
|
saveReport(name: string, isDefault: boolean): void;
|
|
2741
2873
|
updateCurrentReport(): void;
|
|
2742
2874
|
loadReport(id: string): void;
|
|
@@ -2780,7 +2912,21 @@ declare class PivotController<TRow> {
|
|
|
2780
2912
|
* is asking; the controller can.
|
|
2781
2913
|
*/
|
|
2782
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
|
+
*/
|
|
2783
2924
|
exportData(format: ExportFormat | string, options?: ExportOptions): Promise<void>;
|
|
2925
|
+
/**
|
|
2926
|
+
* A result computed on request — every row and column open (`all`) or as
|
|
2927
|
+
* on screen — with the filters applied; the live grid is not touched.
|
|
2928
|
+
*/
|
|
2929
|
+
computeSnapshot(all?: boolean): Promise<PivotEngineResult>;
|
|
2784
2930
|
getRawData(): TRow[];
|
|
2785
2931
|
getEngineResult(): PivotEngineResult | null;
|
|
2786
2932
|
getCell(rowPath: string[], colPath: string[]): PivotCell | null;
|
|
@@ -2795,20 +2941,92 @@ declare class PivotController<TRow> {
|
|
|
2795
2941
|
* does not change the result, and a cell is usually a sliver of the data.
|
|
2796
2942
|
*/
|
|
2797
2943
|
resolveCellClick(event: CellClickEvent<TRow>): CellClickEvent<TRow>;
|
|
2798
|
-
|
|
2944
|
+
/**
|
|
2945
|
+
* The source rows behind one cell — its row and column path — with the
|
|
2946
|
+
* filters and the prefilter applied: what `cellClick`'s `records` holds.
|
|
2947
|
+
* An empty path is that axis's grand total. No event is fired.
|
|
2948
|
+
*/
|
|
2949
|
+
getCellRecords(rowPath: string[], colPath: string[]): TRow[];
|
|
2950
|
+
/**
|
|
2951
|
+
* The fields in `area`, in order. For `'data'` this is what the ENGINE
|
|
2952
|
+
* computes: helper fields (`helper: true`, B.21) come last, after every shown
|
|
2953
|
+
* one, and their columns are cut from the result once the summary formulas
|
|
2954
|
+
* have read them — what is drawn is {@link shownFields}. A field with
|
|
2955
|
+
* `visible: false` is in no area (B.42).
|
|
2956
|
+
*/
|
|
2799
2957
|
getAreaFields(area: PivotArea): PivotField<TRow>[];
|
|
2800
2958
|
private cellIndexLookups;
|
|
2801
2959
|
private getCellIndexLookup;
|
|
2802
2960
|
dispose(): void;
|
|
2803
2961
|
private normalizeOptions;
|
|
2804
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;
|
|
2805
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
|
+
*/
|
|
2806
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
|
+
* Returns false when there was nothing to undo.
|
|
2992
|
+
*/
|
|
2993
|
+
undoLayout(): boolean;
|
|
2994
|
+
/** Put back the last change `undoLayout` took back. False when there is none. */
|
|
2995
|
+
redoLayout(): boolean;
|
|
2996
|
+
canUndoLayout(): boolean;
|
|
2997
|
+
canRedoLayout(): boolean;
|
|
2998
|
+
/** Forget every undo and redo step. */
|
|
2999
|
+
clearLayoutHistory(): void;
|
|
3000
|
+
/**
|
|
3001
|
+
* `restore`: undo (not redo) also puts back what the change had dropped.
|
|
3002
|
+
* The dropped paths travel with the step to the other stack, so a redo
|
|
3003
|
+
* followed by another undo finds them again.
|
|
3004
|
+
*/
|
|
3005
|
+
private replayLayout;
|
|
3006
|
+
/** The open branches and sorts each layout step's change dropped (B.53), by the step. */
|
|
3007
|
+
private droppedBy;
|
|
3008
|
+
private recordLayoutStep;
|
|
3009
|
+
/** The dropped paths and sorts back, except where the reader has since set their own. */
|
|
3010
|
+
private restoredPaths;
|
|
3011
|
+
private layoutHistoryFlags;
|
|
3012
|
+
/**
|
|
3013
|
+
* A step remembers which of caption / group / groupIndex / visible were the
|
|
3014
|
+
* app's definition then; undo gives those back as the definition is NOW, so
|
|
3015
|
+
* a caption the app has translated since stays translated (B.40).
|
|
3016
|
+
*/
|
|
3017
|
+
private layoutStepOf;
|
|
3018
|
+
private replayed;
|
|
3019
|
+
/** Mirror the two flags into the state, so a toolbar can re-render on them. */
|
|
3020
|
+
private syncLayoutHistory;
|
|
2807
3021
|
private setDragState;
|
|
2808
|
-
private setImportStatus;
|
|
2809
3022
|
private loadDefaultReport;
|
|
2810
3023
|
private createReportState;
|
|
2811
3024
|
private applyReportState;
|
|
3025
|
+
/**
|
|
3026
|
+
* The keys to open. `groupsOnly` (a fully expanded tree): only nodes with
|
|
3027
|
+
* children, as a leaf has nothing to open; otherwise every visible node, so
|
|
3028
|
+
* the frontier of a partly open tree opens one more level.
|
|
3029
|
+
*/
|
|
2812
3030
|
private collectNodePaths;
|
|
2813
3031
|
}
|
|
2814
3032
|
|
|
@@ -2848,6 +3066,7 @@ declare class PivotEngineService<TRow> {
|
|
|
2848
3066
|
private computing;
|
|
2849
3067
|
private recomputeAfter;
|
|
2850
3068
|
private phaseVersion;
|
|
3069
|
+
private reconfigureDue;
|
|
2851
3070
|
private hashes;
|
|
2852
3071
|
constructor(config: PivotEngineServiceConfig<TRow>);
|
|
2853
3072
|
refresh(): void;
|
|
@@ -2972,6 +3191,16 @@ declare class PivotFieldService {
|
|
|
2972
3191
|
static updateField<TRow>(fields: PivotField<TRow>[], updatedField: PivotField<TRow>): PivotField<TRow>[];
|
|
2973
3192
|
static applyFilter<TRow>(fields: PivotField<TRow>[], fieldId: string, selectedValues: Set<any>, filterType: 'include' | 'exclude'): PivotField<TRow>[];
|
|
2974
3193
|
static clearFilter<TRow>(fields: PivotField<TRow>[], fieldId: string): PivotField<TRow>[];
|
|
3194
|
+
/** B.34: may `field` sit in `area`? Hiding (`'chooser'`) is always allowed. */
|
|
3195
|
+
static canPlace<TRow>(field: PivotField<TRow>, area: PivotArea | undefined): boolean;
|
|
3196
|
+
/**
|
|
3197
|
+
* Where the field chooser's checkbox (and `showFields`) puts a field (B.34):
|
|
3198
|
+
* the area of its definition, else the first allowed area, else a number
|
|
3199
|
+
* goes to data and anything else to rows. Null when no area is allowed.
|
|
3200
|
+
*/
|
|
3201
|
+
static homeArea<TRow>(field: PivotField<TRow>, defined?: PivotArea): PivotArea | null;
|
|
3202
|
+
/** The `fieldMove` event for `fieldId` going from `prev` to `next`; null when it did not move. */
|
|
3203
|
+
static moveEvent<TRow>(prev: PivotField<TRow>[], next: PivotField<TRow>[], fieldId: string): FieldMoveEvent | null;
|
|
2975
3204
|
static removeField<TRow>(fields: PivotField<TRow>[], fieldId: string): PivotField<TRow>[];
|
|
2976
3205
|
static deleteField<TRow>(fields: PivotField<TRow>[], fieldId: string): PivotField<TRow>[];
|
|
2977
3206
|
static changeFieldArea<TRow>(fields: PivotField<TRow>[], fieldId: string, area: PivotArea): PivotField<TRow>[];
|
|
@@ -3163,6 +3392,11 @@ declare function executeSummaryDisplayModesPhase<TRow>(engineResult: PivotEngine
|
|
|
3163
3392
|
|
|
3164
3393
|
declare function extractGroupValue<TRow>(row: TRow, field: PivotField<TRow>): PivotValue;
|
|
3165
3394
|
|
|
3395
|
+
/** The key of the member path `parts` (`[]` is the root, ""). Assumes no member value starts with or contains `|`. */
|
|
3396
|
+
declare function pathKey(parts: readonly unknown[]): string;
|
|
3397
|
+
/** The member path a `pathKey` names (the root, "", is `[]`). Assumes no member value starts with or contains `|`. */
|
|
3398
|
+
declare function pathParts(key: string): string[];
|
|
3399
|
+
|
|
3166
3400
|
interface DimensionFieldInfo {
|
|
3167
3401
|
dataType?: string;
|
|
3168
3402
|
groupInterval?: DateGranularity | null;
|
|
@@ -3183,6 +3417,145 @@ declare function percentModeText(value: number, field: PivotField<any> | undefin
|
|
|
3183
3417
|
/** The Excel number format for the same case — the value stays 0-100, so the sign is literal. */
|
|
3184
3418
|
declare function percentModeExcelNumFmt(field: PivotField<any> | undefined): string | undefined;
|
|
3185
3419
|
|
|
3420
|
+
/**
|
|
3421
|
+
* The fields a screen shows: helper data fields (`helper: true`, B.21) are
|
|
3422
|
+
* computed but have no column, chip or chooser entry, and a field with
|
|
3423
|
+
* `visible: false` (B.42) is not offered at all. The same array comes back
|
|
3424
|
+
* when there is neither, so a memo keyed on it does not churn.
|
|
3425
|
+
*/
|
|
3426
|
+
declare function shownFields<T extends {
|
|
3427
|
+
helper?: boolean;
|
|
3428
|
+
visible?: boolean;
|
|
3429
|
+
}>(fields: T[]): T[];
|
|
3430
|
+
/**
|
|
3431
|
+
* The fields as the ENGINE and the exports read them (B.42): a field with
|
|
3432
|
+
* `visible: false` takes part as an unplaced field — area `'chooser'`, so it
|
|
3433
|
+
* has no row, column or value, and a filter on it still applies as on any
|
|
3434
|
+
* unplaced field. Its own `area` is kept in the state, so `visible: true`
|
|
3435
|
+
* puts it back where it was. The same array comes back when no field is
|
|
3436
|
+
* hidden, and the mapped one is cached per array, so hashes and memos keyed
|
|
3437
|
+
* on identity stay put.
|
|
3438
|
+
*/
|
|
3439
|
+
declare function computedFields<T extends {
|
|
3440
|
+
visible?: boolean;
|
|
3441
|
+
area?: string;
|
|
3442
|
+
}>(fields: T[]): T[];
|
|
3443
|
+
|
|
3444
|
+
/** The strip content's gap between chip rows and its vertical padding (CSS `.kanuni-pivot-area-content`). */
|
|
3445
|
+
declare const FILTER_AREA_ROW_GAP = 4;
|
|
3446
|
+
declare const FILTER_AREA_PADDING = 8;
|
|
3447
|
+
/** The rows the strip may show, or null for no limit. */
|
|
3448
|
+
declare function filterAreaRows(layout: Pick<PivotLayoutState, 'filterAreaMaxRows' | 'filterAreaCollapsed'>): number | null;
|
|
3449
|
+
/** The strip content's max height in px for `rows` rows of `chipHeight` px chips. */
|
|
3450
|
+
declare function filterAreaMaxHeight(rows: number, chipHeight: number): number;
|
|
3451
|
+
/** How many filter-area fields filter something (shown on the collapsed strip). */
|
|
3452
|
+
declare function countFilteredFields(fields: readonly {
|
|
3453
|
+
filterValues?: {
|
|
3454
|
+
size: number;
|
|
3455
|
+
} | null;
|
|
3456
|
+
valueFilter?: unknown;
|
|
3457
|
+
labelFilter?: unknown;
|
|
3458
|
+
}[]): number;
|
|
3459
|
+
|
|
3460
|
+
interface PopupViewport {
|
|
3461
|
+
left: number;
|
|
3462
|
+
top: number;
|
|
3463
|
+
width: number;
|
|
3464
|
+
height: number;
|
|
3465
|
+
}
|
|
3466
|
+
interface PopupPlacement {
|
|
3467
|
+
left: number;
|
|
3468
|
+
top: number;
|
|
3469
|
+
maxHeight: number;
|
|
3470
|
+
}
|
|
3471
|
+
/** The part of the layout viewport the user sees, in `position: fixed` coordinates. */
|
|
3472
|
+
declare function popupViewport(win?: Window): PopupViewport;
|
|
3473
|
+
/**
|
|
3474
|
+
* `anchor` is where the popup would start (its top-left in LTR). `size` its
|
|
3475
|
+
* natural size (offsetWidth/offsetHeight: a transform does not count). `altX`
|
|
3476
|
+
* is the edge to flip to horizontally (a flyout's trigger's left side); the
|
|
3477
|
+
* popup then ends there. Without a usable viewport (jsdom) the anchor stays.
|
|
3478
|
+
*/
|
|
3479
|
+
declare function placePopup(anchor: {
|
|
3480
|
+
x: number;
|
|
3481
|
+
y: number;
|
|
3482
|
+
}, size: {
|
|
3483
|
+
width: number;
|
|
3484
|
+
height: number;
|
|
3485
|
+
}, options?: {
|
|
3486
|
+
margin?: number;
|
|
3487
|
+
altX?: number;
|
|
3488
|
+
viewport?: PopupViewport;
|
|
3489
|
+
}): PopupPlacement;
|
|
3490
|
+
|
|
3491
|
+
interface PivotSummaryColumn {
|
|
3492
|
+
/** The field's id — the key of this column in every row. */
|
|
3493
|
+
id: string;
|
|
3494
|
+
caption: string;
|
|
3495
|
+
/** A row-area field (a level of the grouping) or a data field (a value). */
|
|
3496
|
+
kind: 'row' | 'data';
|
|
3497
|
+
field: PivotField;
|
|
3498
|
+
}
|
|
3499
|
+
interface PivotSummaryTable {
|
|
3500
|
+
/** Row fields in their order, then the shown data fields in theirs. */
|
|
3501
|
+
columns: PivotSummaryColumn[];
|
|
3502
|
+
/** One per deepest combination; values are numbers, a blank summary is `null`. */
|
|
3503
|
+
rows: Array<Record<string, PivotValue | number | null>>;
|
|
3504
|
+
}
|
|
3505
|
+
/**
|
|
3506
|
+
* The summary as a flat table: every deepest row combination × the shown data
|
|
3507
|
+
* fields, with the filters applied and regardless of what is expanded.
|
|
3508
|
+
* Enterprise; throws on a Community grid.
|
|
3509
|
+
*/
|
|
3510
|
+
declare function getSummaryTable(controller: PivotController<any>): Promise<PivotSummaryTable>;
|
|
3511
|
+
|
|
3512
|
+
interface CellPath {
|
|
3513
|
+
rowPath: readonly string[];
|
|
3514
|
+
colPath: readonly string[];
|
|
3515
|
+
}
|
|
3516
|
+
/**
|
|
3517
|
+
* The source rows behind these cells, filters applied, each row once and in
|
|
3518
|
+
* source order. Enterprise; throws on a Community grid.
|
|
3519
|
+
*/
|
|
3520
|
+
declare function getRecordsForCells<TRow>(controller: PivotController<TRow>, cells: readonly CellPath[]): TRow[];
|
|
3521
|
+
|
|
3522
|
+
/**
|
|
3523
|
+
* `next` with every split group put back together: all members in the area
|
|
3524
|
+
* of the member that moved (compared with `prev`), side by side at its place,
|
|
3525
|
+
* in group order. The same array when no group is split.
|
|
3526
|
+
*/
|
|
3527
|
+
declare function keepFieldGroups<T extends PivotField<any>>(prev: readonly T[], next: T[]): T[];
|
|
3528
|
+
|
|
3529
|
+
declare const PIVOT_LICENSE_TEXT: Record<string, Record<string, string>>;
|
|
3530
|
+
/** The license reasons for `locale` over English (what is missing falls back). */
|
|
3531
|
+
declare function pivotLicenseText(locale: string | undefined): Record<string, string>;
|
|
3532
|
+
|
|
3533
|
+
/** A state's filters: per field id, and the prefilter. Plain JSON. */
|
|
3534
|
+
interface PersistedPivotFilters {
|
|
3535
|
+
fields: Record<string, {
|
|
3536
|
+
filterValues?: unknown[] | null;
|
|
3537
|
+
filterType?: string;
|
|
3538
|
+
valueFilter?: unknown;
|
|
3539
|
+
labelFilter?: unknown;
|
|
3540
|
+
}>;
|
|
3541
|
+
prefilter?: unknown;
|
|
3542
|
+
}
|
|
3543
|
+
/**
|
|
3544
|
+
* Cut a `getPersistedState()` snapshot in two: `layout` (everything but the
|
|
3545
|
+
* filters — fields and their areas, order, sorting, summaries, widths, open
|
|
3546
|
+
* members, parts) and `filters` (each field's filter and the prefilter).
|
|
3547
|
+
*/
|
|
3548
|
+
declare function splitPersistedState(state: PersistedPivotState): {
|
|
3549
|
+
layout: PersistedPivotState;
|
|
3550
|
+
filters: PersistedPivotFilters;
|
|
3551
|
+
};
|
|
3552
|
+
/**
|
|
3553
|
+
* One state from the two parts, for `applyPersistedState`: the layout with
|
|
3554
|
+
* these filters. A field the layout does not have drops its filter; without
|
|
3555
|
+
* `filters` (or a field missing from it) the field has none.
|
|
3556
|
+
*/
|
|
3557
|
+
declare function mergePersistedState(layout: PersistedPivotState, filters?: PersistedPivotFilters | null): PersistedPivotState;
|
|
3558
|
+
|
|
3186
3559
|
type CalculatedFieldTextKey = 'createFormulasWithoutCode' | 'measureName' | 'numericStandard' | 'numericDecimal' | 'currencyTRY' | 'currencyUSD' | 'measureNamePlaceholder' | 'customFormat' | 'customPrefix' | 'customSuffix' | 'minFraction' | 'maxFraction' | 'calculationLevel' | 'calcRowLevel' | 'calcSummaryLevel' | 'noFieldsFound' | 'deleteCalcField' | 'formulaPlaceholder' | 'saveAndAdd' | 'measureNameEmpty' | 'formulaEmpty' | 'formulaError' | 'calcRowLevelHint' | 'calcSummaryLevelHint' | 'formulaValid' | 'calcFieldsHint' | 'formulaUses';
|
|
3187
3560
|
/** The designer's text for `key` in `locale` (`tr-TR` → `tr`, `zh` → `zh-CN`), or undefined. */
|
|
3188
3561
|
declare function calculatedFieldText(locale: string | undefined, key: string): string | undefined;
|
|
@@ -3195,6 +3568,8 @@ type ChartKeyTextKey = 'chartCanvasHintPick' | 'chartCategoryFocus' | 'chartCate
|
|
|
3195
3568
|
/** The text for `key` in `locale` (`tr-TR` → `tr`, `zh` → `zh-CN`), English when the language is unknown. */
|
|
3196
3569
|
declare function chartKeyText(locale: string | undefined, key: ChartKeyTextKey): string;
|
|
3197
3570
|
|
|
3571
|
+
declare function summaryTypeLabel(type: string, t: (key: any) => string): string;
|
|
3572
|
+
|
|
3198
3573
|
declare class ExportStreamController {
|
|
3199
3574
|
private worker;
|
|
3200
3575
|
private static sharedWorker;
|
|
@@ -3227,6 +3602,8 @@ interface AdvancedExportRequest {
|
|
|
3227
3602
|
locale: string;
|
|
3228
3603
|
signal?: AbortSignal;
|
|
3229
3604
|
onProgress?: (percent: number) => void;
|
|
3605
|
+
/** Asked before the plain-file fallback (B.23); `false` cancels. */
|
|
3606
|
+
onLargeExport?: ExportOptions['onLargeExport'];
|
|
3230
3607
|
}
|
|
3231
3608
|
type AdvancedExporter = (req: AdvancedExportRequest) => Promise<void>;
|
|
3232
3609
|
/** Called by the Enterprise package to enable Excel/PDF export. */
|
|
@@ -3295,292 +3672,6 @@ declare class PivotReportManager {
|
|
|
3295
3672
|
private persist;
|
|
3296
3673
|
}
|
|
3297
3674
|
|
|
3298
|
-
type ImportFormat = 'json' | 'csv' | 'xml' | 'xlsx';
|
|
3299
|
-
interface ImportSnapshot<TRow = any> {
|
|
3300
|
-
version: string;
|
|
3301
|
-
type: 'FULL_SNAPSHOT' | 'LAYOUT_ONLY' | 'DATA_ONLY';
|
|
3302
|
-
timestamp: string;
|
|
3303
|
-
data?: TRow[];
|
|
3304
|
-
fields?: PivotField<TRow>[];
|
|
3305
|
-
layout?: PivotLayoutState;
|
|
3306
|
-
expandedPaths?: string[];
|
|
3307
|
-
preferences?: Record<string, any>;
|
|
3308
|
-
}
|
|
3309
|
-
interface IFileReader {
|
|
3310
|
-
read(file: File): Promise<any[]>;
|
|
3311
|
-
supports(file: File): boolean;
|
|
3312
|
-
}
|
|
3313
|
-
interface ValidationResult {
|
|
3314
|
-
isValid: boolean;
|
|
3315
|
-
errors: string[];
|
|
3316
|
-
warnings: string[];
|
|
3317
|
-
}
|
|
3318
|
-
|
|
3319
|
-
/** Progress update surfaced while a file is parsed in the worker. */
|
|
3320
|
-
interface ImportProgress {
|
|
3321
|
-
/** Coarse pipeline stage: reading | parsing | typing | finalizing. */
|
|
3322
|
-
phase: string;
|
|
3323
|
-
/** Overall completion, 0..100. */
|
|
3324
|
-
percent: number;
|
|
3325
|
-
}
|
|
3326
|
-
/** File kinds the import worker can parse off the main thread. */
|
|
3327
|
-
type ImportWorkerKind = 'csv' | 'json' | 'xml';
|
|
3328
|
-
/** Result posted back by the worker once parsing completes. */
|
|
3329
|
-
type ImportWorkerResult = {
|
|
3330
|
-
mode: 'data';
|
|
3331
|
-
data: any[];
|
|
3332
|
-
fields: PivotField<any>[];
|
|
3333
|
-
} | {
|
|
3334
|
-
mode: 'raw';
|
|
3335
|
-
value: any;
|
|
3336
|
-
};
|
|
3337
|
-
interface ParseFileOptions {
|
|
3338
|
-
onProgress?: (p: ImportProgress) => void;
|
|
3339
|
-
signal?: AbortSignal;
|
|
3340
|
-
}
|
|
3341
|
-
/**
|
|
3342
|
-
* Drives the import Web Worker for a single file: streams progress, resolves
|
|
3343
|
-
* with the parsed payload, and supports cooperative cancellation.
|
|
3344
|
-
*
|
|
3345
|
-
* Mirrors {@link ExportStreamController}, but imports are one-shot so each job
|
|
3346
|
-
* gets a dedicated worker that is terminated on completion, error or cancel —
|
|
3347
|
-
* `terminate()` also gives us instant, reliable cancellation mid-parse (a
|
|
3348
|
-
* synchronous parse loop cannot otherwise be interrupted).
|
|
3349
|
-
*/
|
|
3350
|
-
declare class ImportStreamController {
|
|
3351
|
-
private static jobCounter;
|
|
3352
|
-
/** Whether Web Workers are available in the current environment. */
|
|
3353
|
-
static isSupported(): boolean;
|
|
3354
|
-
/**
|
|
3355
|
-
* Parse `file` in the worker. Resolves with the worker payload, rejects with
|
|
3356
|
-
* an `AbortError` DOMException if `signal` is aborted, or a generic Error on
|
|
3357
|
-
* worker failure.
|
|
3358
|
-
*/
|
|
3359
|
-
parseFile(file: Blob, kind: ImportWorkerKind, opts?: ParseFileOptions): Promise<ImportWorkerResult>;
|
|
3360
|
-
}
|
|
3361
|
-
|
|
3362
|
-
interface ImportManagerOptions {
|
|
3363
|
-
/**
|
|
3364
|
-
* Reject files larger than this many bytes before reading them, to guard
|
|
3365
|
-
* against out-of-memory / browser-crash from oversized uploads. Defaults to
|
|
3366
|
-
* 500 MB; pass 0 to disable the guard.
|
|
3367
|
-
*/
|
|
3368
|
-
maxFileSizeBytes?: number;
|
|
3369
|
-
}
|
|
3370
|
-
interface ImportResult {
|
|
3371
|
-
snapshot: ImportSnapshot;
|
|
3372
|
-
validation: ValidationResult;
|
|
3373
|
-
/** True when the import was cancelled via the abort signal before completing. */
|
|
3374
|
-
cancelled?: boolean;
|
|
3375
|
-
}
|
|
3376
|
-
interface ProcessFileStreamingOptions {
|
|
3377
|
-
onProgress?: (p: ImportProgress) => void;
|
|
3378
|
-
signal?: AbortSignal;
|
|
3379
|
-
}
|
|
3380
|
-
interface ProcessFromUrlOptions extends ProcessFileStreamingOptions {
|
|
3381
|
-
/** Extra fetch() init (headers, method, credentials, …). */
|
|
3382
|
-
fetchInit?: RequestInit;
|
|
3383
|
-
}
|
|
3384
|
-
declare class ImportManager {
|
|
3385
|
-
private readers;
|
|
3386
|
-
private maxFileSizeBytes;
|
|
3387
|
-
private stream;
|
|
3388
|
-
constructor(options?: ImportManagerOptions);
|
|
3389
|
-
/**
|
|
3390
|
-
* Processes an uploaded file synchronously (whole-file read + parse on the
|
|
3391
|
-
* calling thread). Retained for back-compat and non-worker environments;
|
|
3392
|
-
* prefer {@link processFileStreaming} for large files.
|
|
3393
|
-
*/
|
|
3394
|
-
processFile(file: File): Promise<{
|
|
3395
|
-
snapshot: ImportSnapshot;
|
|
3396
|
-
validation: ValidationResult;
|
|
3397
|
-
}>;
|
|
3398
|
-
/**
|
|
3399
|
-
* Processes an uploaded file, offloading CSV/JSON parsing to a Web Worker so
|
|
3400
|
-
* the UI stays responsive on large files, reporting progress and honoring
|
|
3401
|
-
* cancellation. Excel (and environments without workers) transparently fall
|
|
3402
|
-
* back to the synchronous reader path.
|
|
3403
|
-
*/
|
|
3404
|
-
processFileStreaming(file: File, options?: ProcessFileStreamingOptions): Promise<ImportResult>;
|
|
3405
|
-
/**
|
|
3406
|
-
* Import an already-materialized array of row objects (e.g. an API/JSON
|
|
3407
|
-
* response). Fields are auto-discovered; values are used as-is (call
|
|
3408
|
-
* {@link coerceRecords} first if they are stringly-typed).
|
|
3409
|
-
*/
|
|
3410
|
-
processFromData(rows: any[], options?: ProcessFileStreamingOptions): Promise<ImportResult>;
|
|
3411
|
-
/**
|
|
3412
|
-
* Import delimited text (e.g. a clipboard paste from Excel/Sheets, which is
|
|
3413
|
-
* tab-separated). Delimiter is auto-detected; values are typed via the shared
|
|
3414
|
-
* CSV pipeline.
|
|
3415
|
-
*/
|
|
3416
|
-
processFromText(text: string, options?: ProcessFileStreamingOptions): Promise<ImportResult>;
|
|
3417
|
-
/**
|
|
3418
|
-
* Fetch data from a URL (or backend API) and import it. The response is
|
|
3419
|
-
* wrapped as a File so the format is detected from the URL extension /
|
|
3420
|
-
* content-type and parsed through the same worker pipeline.
|
|
3421
|
-
*/
|
|
3422
|
-
processFromUrl(url: string, options?: ProcessFromUrlOptions): Promise<ImportResult>;
|
|
3423
|
-
/**
|
|
3424
|
-
* Import one or more files, appending their rows into a single dataset with a
|
|
3425
|
-
* unioned field set. Progress is aggregated across files; any cancellation
|
|
3426
|
-
* aborts the whole batch.
|
|
3427
|
-
*/
|
|
3428
|
-
processFiles(files: FileList | File[], options?: ProcessFileStreamingOptions): Promise<ImportResult>;
|
|
3429
|
-
private assertSize;
|
|
3430
|
-
/** Which worker parse path applies to this file, or null for Excel/unknown. */
|
|
3431
|
-
private workerKind;
|
|
3432
|
-
private isAbort;
|
|
3433
|
-
private cancelledResult;
|
|
3434
|
-
/** Build a result from reader/worker content (raw data array or a snapshot object). */
|
|
3435
|
-
private buildFromContent;
|
|
3436
|
-
/** Build a DATA_ONLY result from a raw row array, reusing worker-computed fields when supplied. */
|
|
3437
|
-
private buildDataResult;
|
|
3438
|
-
}
|
|
3439
|
-
|
|
3440
|
-
/**
|
|
3441
|
-
* Dedicated delimited-text reader (CSV / TSV / plain text).
|
|
3442
|
-
*
|
|
3443
|
-
* Reads the file as UTF-8 TEXT (not raw bytes), so UTF-8 / Turkish / emoji
|
|
3444
|
-
* content is preserved instead of being mis-decoded as ANSI. Parsing/typing is
|
|
3445
|
-
* delegated to the shared {@link parseCsvToRows} pipeline (delimiter
|
|
3446
|
-
* auto-detect, RFC-4180 quoting, per-column type inference and locale-aware
|
|
3447
|
-
* coercion, leading-zero ids kept as strings) — the same code path the import
|
|
3448
|
-
* worker runs. This is used in preference to the SheetJS path for delimited
|
|
3449
|
-
* files.
|
|
3450
|
-
*/
|
|
3451
|
-
declare class CsvReader implements IFileReader {
|
|
3452
|
-
supports(file: File): boolean;
|
|
3453
|
-
read(file: File): Promise<any[]>;
|
|
3454
|
-
/** Parse delimited text into typed row objects. Exposed for testing. */
|
|
3455
|
-
static parse(text: string): Record<string, unknown>[];
|
|
3456
|
-
}
|
|
3457
|
-
|
|
3458
|
-
/**
|
|
3459
|
-
* Dependency-free XML reader for tabular data exports.
|
|
3460
|
-
*
|
|
3461
|
-
* Works in Node, Web Workers and the browser (no `DOMParser` needed). Handles
|
|
3462
|
-
* the common "rows" shapes:
|
|
3463
|
-
* <data><record><a>1</a><b>x</b></record> … </data> (element fields)
|
|
3464
|
-
* <rows><row id="1" name="x"/> … </rows> (attribute fields)
|
|
3465
|
-
* <root><a>1</a><b>2</b></root> (single flat record)
|
|
3466
|
-
* Attributes and leaf child-elements both become columns; values are typed with
|
|
3467
|
-
* the shared {@link coerceRecords} pipeline (locale numbers, dates, booleans;
|
|
3468
|
-
* leading-zero ids preserved). Prototype-polluting keys are neutralized.
|
|
3469
|
-
*/
|
|
3470
|
-
declare class XmlReader implements IFileReader {
|
|
3471
|
-
supports(file: File): boolean;
|
|
3472
|
-
read(file: File): Promise<any[]>;
|
|
3473
|
-
/** Parse XML text into typed row objects. Exposed for testing. */
|
|
3474
|
-
static parse(text: string): Record<string, unknown>[];
|
|
3475
|
-
}
|
|
3476
|
-
|
|
3477
|
-
declare class DataNormalizer {
|
|
3478
|
-
/**
|
|
3479
|
-
* Generates basic PivotFields from an array of raw data objects.
|
|
3480
|
-
* Scans a sample size of rows to determine data types.
|
|
3481
|
-
*/
|
|
3482
|
-
static extractFieldsFromData(data: any[], sampleSize?: number): PivotField<any>[];
|
|
3483
|
-
/**
|
|
3484
|
-
* Build pivot fields from a reviewed import plan (column mapping): explicit
|
|
3485
|
-
* caption + dataType per column, in the plan's order. Applies the same
|
|
3486
|
-
* area-assignment heuristic as {@link extractFieldsFromData} (first
|
|
3487
|
-
* string/date → row, first number → data).
|
|
3488
|
-
*/
|
|
3489
|
-
static buildFieldsFromPlan(plan: {
|
|
3490
|
-
dataField: string;
|
|
3491
|
-
caption: string;
|
|
3492
|
-
dataType: 'string' | 'number' | 'date' | 'boolean';
|
|
3493
|
-
}[], data?: any[], sampleSize?: number): PivotField<any>[];
|
|
3494
|
-
private static isAutoRowCandidate;
|
|
3495
|
-
private static isAutoDataCandidate;
|
|
3496
|
-
private static isHighCardinalityStringColumn;
|
|
3497
|
-
private static isIdentifierLikeKey;
|
|
3498
|
-
/** Union column keys across a sample of rows, preserving first-seen order. */
|
|
3499
|
-
private static collectKeys;
|
|
3500
|
-
private static inferType;
|
|
3501
|
-
private static formatCaption;
|
|
3502
|
-
}
|
|
3503
|
-
|
|
3504
|
-
type CellType = 'string' | 'number' | 'date' | 'boolean';
|
|
3505
|
-
/** Strip a leading UTF-8/UTF-16 BOM if present. */
|
|
3506
|
-
declare function stripBom(text: string): string;
|
|
3507
|
-
/**
|
|
3508
|
-
* Auto-detect the delimiter of a delimited-text sample by counting candidate
|
|
3509
|
-
* separators outside of quotes on the first few lines. Supports comma,
|
|
3510
|
-
* semicolon, tab and pipe (covers Excel-locale CSV and TSV).
|
|
3511
|
-
*/
|
|
3512
|
-
declare function detectDelimiter(sample: string): string;
|
|
3513
|
-
/**
|
|
3514
|
-
* Parse RFC-4180-style delimited text into a matrix of string cells.
|
|
3515
|
-
* Handles quoted fields, escaped quotes (`""`), embedded newlines and
|
|
3516
|
-
* mixed CRLF/LF line endings. The delimiter is auto-detected when omitted.
|
|
3517
|
-
*
|
|
3518
|
-
* `onProgress` (optional) is invoked periodically with the fraction of the
|
|
3519
|
-
* input consumed (0..1) so long parses run in a worker can report progress.
|
|
3520
|
-
*/
|
|
3521
|
-
declare function parseDelimited(text: string, delimiter?: string, onProgress?: (fraction: number) => void): string[][];
|
|
3522
|
-
/** Lenient boolean parse used for COERCION within a known boolean column. */
|
|
3523
|
-
declare function parseBoolean(raw: unknown): boolean | null;
|
|
3524
|
-
/**
|
|
3525
|
-
* Parse a locale-formatted number: handles thousands/decimal separators in
|
|
3526
|
-
* both `1,234.56` and `1.234,56` conventions, currency symbols, percent,
|
|
3527
|
-
* spaces (incl. non-breaking) and accounting parentheses for negatives.
|
|
3528
|
-
* Returns null when the input is not a number.
|
|
3529
|
-
*/
|
|
3530
|
-
declare function parseLocaleNumber(raw: unknown): number | null;
|
|
3531
|
-
/**
|
|
3532
|
-
* Parse a variety of common date formats to a Date: ISO (date or datetime),
|
|
3533
|
-
* `yyyy/mm/dd`, `yyyy.mm.dd`, and `dd/mm/yyyy`/`mm/dd/yyyy` (disambiguated by
|
|
3534
|
-
* the day value when possible, defaulting to day-first). Plain integers and
|
|
3535
|
-
* separatorless strings are intentionally NOT treated as dates.
|
|
3536
|
-
*/
|
|
3537
|
-
declare function parseFlexibleDate(raw: unknown): Date | null;
|
|
3538
|
-
/** Classify a single raw cell value into a pivot data type (or 'blank'). */
|
|
3539
|
-
declare function classifyValue(val: unknown): CellType | 'blank';
|
|
3540
|
-
/**
|
|
3541
|
-
* Infer a column's type from a set of sampled values by majority vote over
|
|
3542
|
-
* non-blank cells. Ties and empty columns default to 'string'.
|
|
3543
|
-
*/
|
|
3544
|
-
declare function inferColumnType(values: unknown[]): CellType;
|
|
3545
|
-
/**
|
|
3546
|
-
* Coerce a raw value to the target column type. Returns null for blanks and
|
|
3547
|
-
* for values that cannot be represented in the target type (so a stray text
|
|
3548
|
-
* cell in a numeric column becomes empty rather than corrupting aggregation).
|
|
3549
|
-
*/
|
|
3550
|
-
declare function coerceValue(val: unknown, type: CellType): unknown;
|
|
3551
|
-
/** Return a key safe to assign as an own property (renames prototype-polluting keys). */
|
|
3552
|
-
declare function safeKey(key: string): string;
|
|
3553
|
-
/**
|
|
3554
|
-
* Defensively neutralize prototype-polluting own keys in already-parsed rows
|
|
3555
|
-
* (e.g. from SheetJS/JSON, whose keys come from untrusted files). Returns the
|
|
3556
|
-
* same array untouched when nothing dangerous is present (the common case).
|
|
3557
|
-
*/
|
|
3558
|
-
declare function sanitizeRows<T extends Record<string, unknown>>(rows: T[]): Record<string, unknown>[];
|
|
3559
|
-
interface CsvParseProgress {
|
|
3560
|
-
phase: 'parsing' | 'typing';
|
|
3561
|
-
/** Overall completion 0..100. */
|
|
3562
|
-
percent: number;
|
|
3563
|
-
}
|
|
3564
|
-
/** Ensure unique, non-empty header names (duplicates get a numeric suffix); prototype-safe. */
|
|
3565
|
-
declare function dedupeHeaders(headers: string[]): string[];
|
|
3566
|
-
/**
|
|
3567
|
-
* Infer per-column types from a sample of already-parsed string/loose records
|
|
3568
|
-
* and coerce every cell (locale numbers, dates, booleans; leading-zero ids kept
|
|
3569
|
-
* as strings), returning fresh prototype-safe row objects. Shared by any source
|
|
3570
|
-
* that yields untyped records (XML, and future sources). `onProgress` reports
|
|
3571
|
-
* typing completion 0..100.
|
|
3572
|
-
*/
|
|
3573
|
-
declare function coerceRecords(records: Record<string, unknown>[], onProgress?: (p: CsvParseProgress) => void): Record<string, unknown>[];
|
|
3574
|
-
/**
|
|
3575
|
-
* Full delimited-text → typed-row pipeline: BOM strip, delimiter auto-detect,
|
|
3576
|
-
* RFC-4180 parse, header dedupe, per-column type inference from a sample and
|
|
3577
|
-
* per-cell coercion (locale numbers, dates, booleans; leading-zero ids kept as
|
|
3578
|
-
* strings). Optional `onProgress` reports overall completion (parse 0→60%,
|
|
3579
|
-
* typing 60→100%) so a worker can surface a progress bar. This is the single
|
|
3580
|
-
* implementation shared by {@link CsvReader} (sync) and the import worker.
|
|
3581
|
-
*/
|
|
3582
|
-
declare function parseCsvToRows(text: string, onProgress?: (p: CsvParseProgress) => void): Record<string, unknown>[];
|
|
3583
|
-
|
|
3584
3675
|
/** The parts of the pivot a model may read and change. */
|
|
3585
3676
|
type PivotAiFeature = 'fields' | 'filter' | 'sort' | 'totals';
|
|
3586
3677
|
declare const PIVOT_AI_FEATURES: readonly PivotAiFeature[];
|
|
@@ -3785,4 +3876,4 @@ declare function rollupInMemory<TRow>(rows: readonly TRow[], request: PivotServe
|
|
|
3785
3876
|
/** Every value of a field in rows held in memory — the reference `loadFieldValues`. */
|
|
3786
3877
|
declare function fieldValuesInMemory<TRow>(rows: readonly TRow[], field: PivotServerField): unknown[];
|
|
3787
3878
|
|
|
3788
|
-
export { type AdvancedExportRequest, type AdvancedExporter, CHART_LEGEND_POSITIONS, CHART_PALETTE_NAMES, type CalculatedFieldTextKey, type CellClickEvent, type
|
|
3879
|
+
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 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, 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 };
|