@kanunilabs/pivotgrid-core 1.9.0 → 1.10.0

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.d.cts CHANGED
@@ -69,6 +69,8 @@ interface PivotDictionary {
69
69
  removeFromArea: string;
70
70
  removeField: string;
71
71
  deletePermanently: string;
72
+ /** The column cap's notice (`maxColumns`); `{shown}` and `{total}` are numbers. */
73
+ columnsTruncated: string;
72
74
  importSuccess: string;
73
75
  importWarning: string;
74
76
  importError: string;
@@ -1205,6 +1207,14 @@ interface PivotEngineResult {
1205
1207
  * removed) by `applyCustomSummaries` before any other post-phase.
1206
1208
  */
1207
1209
  customSummary?: CustomSummaryInputs;
1210
+ /**
1211
+ * Set when `maxColumns` cut the column members: `shown` of `total` leaf
1212
+ * columns are in `colTree`. The matrix and every total still hold all the data.
1213
+ */
1214
+ columnsTruncated?: {
1215
+ shown: number;
1216
+ total: number;
1217
+ };
1208
1218
  }
1209
1219
  interface FieldDistinctEntry {
1210
1220
  rawStr: string;
@@ -2107,6 +2117,13 @@ interface PivotControllerState<TRow = any> {
2107
2117
  /** Pending import awaiting preview/column-mapping review (null when none). */
2108
2118
  importPreview: PivotImportPreviewState | null;
2109
2119
  drag: PivotDragIntentState;
2120
+ /**
2121
+ * The quick search (`setSearchText`): only the row members whose caption
2122
+ * (as the header draws it — a month by its name) contains it are shown,
2123
+ * with the members above them. Not saved with the
2124
+ * layout or in reports; totals still count every row.
2125
+ */
2126
+ searchText?: string;
2110
2127
  }
2111
2128
  interface PivotControllerCallbacks<TRow = any> {
2112
2129
  onRefresh?: () => void;
@@ -2169,6 +2186,14 @@ interface PivotControllerOptions<TRow = any> extends PivotControllerCallbacks<TR
2169
2186
  rowKey?: PivotRowKeyResolver<TRow>;
2170
2187
  /** How long `applyTransactionAsync` collects transactions before applying them together. Default 50 ms. */
2171
2188
  asyncTransactionWait?: number;
2189
+ /**
2190
+ * Most column members shown (default 1000). A field with a value per row on
2191
+ * columns makes tens of thousands of them and freezes the page; past the cap
2192
+ * only the first ones are drawn, totals still count all the data, and the
2193
+ * result says so in `columnsTruncated`. Exports are never cut: they keep
2194
+ * every column. `0` or `Infinity` turns it off.
2195
+ */
2196
+ maxColumns?: number;
2172
2197
  }
2173
2198
  /**
2174
2199
  * Starting widths, in pixels, for every column of a kind — the renderer's
@@ -2530,6 +2555,12 @@ declare class PivotController<TRow> {
2530
2555
  clearAllSorting(): void;
2531
2556
  applyFilter(fieldId: string, selectedValues: Set<any>, filterType: 'include' | 'exclude'): void;
2532
2557
  clearFilter(fieldId: string): void;
2558
+ /**
2559
+ * Quick search: show only the row members whose caption contains `text`
2560
+ * (ignoring case and accents), with the members above them. A view on top
2561
+ * of the reader's filters, not one of them — `''` gives the view back.
2562
+ */
2563
+ setSearchText(text: string): void;
2533
2564
  setLayout(updates: Partial<PivotLayoutState>): void;
2534
2565
  private readonly unsupportedReporter;
2535
2566
  /**
@@ -2547,7 +2578,13 @@ declare class PivotController<TRow> {
2547
2578
  expandColPaths(paths: string[]): void;
2548
2579
  collapseColPaths(paths: string[]): void;
2549
2580
  setExpandedColPaths(paths: string[]): void;
2550
- expandAll(): void;
2581
+ /**
2582
+ * Expand one more level across the whole tree. A search or the column cap
2583
+ * cuts the tree on screen, so then the uncut one is computed and walked:
2584
+ * walking the cut one left every member the search hid closed, and every
2585
+ * column past the cap. Resolves when the new paths are set.
2586
+ */
2587
+ expandAll(): Promise<void>;
2551
2588
  collapseAll(): void;
2552
2589
  setColumnWidths(widths: Record<string, number>): void;
2553
2590
  setSelectionStats(selectionStats: PivotSelectionStats | null): void;
@@ -2700,6 +2737,7 @@ declare class PivotEngineService<TRow> {
2700
2737
  private drainQueued;
2701
2738
  private computing;
2702
2739
  private recomputeAfter;
2740
+ private phaseVersion;
2703
2741
  private hashes;
2704
2742
  constructor(config: PivotEngineServiceConfig<TRow>);
2705
2743
  refresh(): void;
@@ -2741,6 +2779,7 @@ declare class PivotEngineService<TRow> {
2741
2779
  private runReconfigure;
2742
2780
  private scheduleFilter;
2743
2781
  private runFilter;
2782
+ private endPhase;
2744
2783
  private scheduleComputeIfReady;
2745
2784
  private runCompute;
2746
2785
  private serverTimeout;
@@ -2756,17 +2795,26 @@ declare class PivotEngineService<TRow> {
2756
2795
  private postPhases;
2757
2796
  private runServerCompute;
2758
2797
  /**
2759
- * Produce a fully-expanded engine snapshot on demand, WITHOUT mutating the
2760
- * grid's live state. Used by `expandAll` exports: the cached engineResult
2761
- * only contains nodes visible under the current expand/collapse state (the
2762
- * worker prunes collapsed subtrees and their cells), so a naive
2763
- * "expand everything" over that snapshot would silently drop collapsed rows.
2764
- * This requests a fresh worker compute with every path expanded and re-runs
2765
- * the same post-aggregation, sort and display-mode phases as {@link runCompute}
2766
- * so the result is identical in shape to what the grid would render if the
2767
- * user expanded all nodes manually.
2768
- */
2769
- computeFullyExpandedSnapshot(): Promise<PivotEngineResult>;
2798
+ * Produce an engine snapshot for an export on demand, WITHOUT mutating the
2799
+ * grid's live state, and without the column cap (see postPhases).
2800
+ *
2801
+ * `all` (an `expandAll` export): the cached engineResult only contains nodes
2802
+ * visible under the current expand/collapse state (the worker prunes
2803
+ * collapsed subtrees and their cells), so a naive "expand everything" over
2804
+ * that snapshot would silently drop collapsed rows. This requests a fresh
2805
+ * compute with every path expanded and re-runs the same post-aggregation,
2806
+ * sort and display-mode phases as {@link runCompute} so the result is
2807
+ * identical in shape to what the grid would render if the user expanded all
2808
+ * nodes manually. Otherwise: the current expansion, as on screen.
2809
+ */
2810
+ computeSnapshot(all: boolean): Promise<PivotEngineResult>;
2811
+ /**
2812
+ * The tree under the current expansion before the search and the column cap
2813
+ * cut it — what `expandAll` walks. Walking the result on screen expanded only
2814
+ * the matches and the first `maxColumns` columns, so clearing the search
2815
+ * left every other member closed. Members only: no post phases.
2816
+ */
2817
+ computeUncut(): Promise<PivotEngineResult>;
2770
2818
  /**
2771
2819
  * Surface options the sort accepted but could not honour.
2772
2820
  *
package/dist/index.d.ts CHANGED
@@ -69,6 +69,8 @@ interface PivotDictionary {
69
69
  removeFromArea: string;
70
70
  removeField: string;
71
71
  deletePermanently: string;
72
+ /** The column cap's notice (`maxColumns`); `{shown}` and `{total}` are numbers. */
73
+ columnsTruncated: string;
72
74
  importSuccess: string;
73
75
  importWarning: string;
74
76
  importError: string;
@@ -1205,6 +1207,14 @@ interface PivotEngineResult {
1205
1207
  * removed) by `applyCustomSummaries` before any other post-phase.
1206
1208
  */
1207
1209
  customSummary?: CustomSummaryInputs;
1210
+ /**
1211
+ * Set when `maxColumns` cut the column members: `shown` of `total` leaf
1212
+ * columns are in `colTree`. The matrix and every total still hold all the data.
1213
+ */
1214
+ columnsTruncated?: {
1215
+ shown: number;
1216
+ total: number;
1217
+ };
1208
1218
  }
1209
1219
  interface FieldDistinctEntry {
1210
1220
  rawStr: string;
@@ -2107,6 +2117,13 @@ interface PivotControllerState<TRow = any> {
2107
2117
  /** Pending import awaiting preview/column-mapping review (null when none). */
2108
2118
  importPreview: PivotImportPreviewState | null;
2109
2119
  drag: PivotDragIntentState;
2120
+ /**
2121
+ * The quick search (`setSearchText`): only the row members whose caption
2122
+ * (as the header draws it — a month by its name) contains it are shown,
2123
+ * with the members above them. Not saved with the
2124
+ * layout or in reports; totals still count every row.
2125
+ */
2126
+ searchText?: string;
2110
2127
  }
2111
2128
  interface PivotControllerCallbacks<TRow = any> {
2112
2129
  onRefresh?: () => void;
@@ -2169,6 +2186,14 @@ interface PivotControllerOptions<TRow = any> extends PivotControllerCallbacks<TR
2169
2186
  rowKey?: PivotRowKeyResolver<TRow>;
2170
2187
  /** How long `applyTransactionAsync` collects transactions before applying them together. Default 50 ms. */
2171
2188
  asyncTransactionWait?: number;
2189
+ /**
2190
+ * Most column members shown (default 1000). A field with a value per row on
2191
+ * columns makes tens of thousands of them and freezes the page; past the cap
2192
+ * only the first ones are drawn, totals still count all the data, and the
2193
+ * result says so in `columnsTruncated`. Exports are never cut: they keep
2194
+ * every column. `0` or `Infinity` turns it off.
2195
+ */
2196
+ maxColumns?: number;
2172
2197
  }
2173
2198
  /**
2174
2199
  * Starting widths, in pixels, for every column of a kind — the renderer's
@@ -2530,6 +2555,12 @@ declare class PivotController<TRow> {
2530
2555
  clearAllSorting(): void;
2531
2556
  applyFilter(fieldId: string, selectedValues: Set<any>, filterType: 'include' | 'exclude'): void;
2532
2557
  clearFilter(fieldId: string): void;
2558
+ /**
2559
+ * Quick search: show only the row members whose caption contains `text`
2560
+ * (ignoring case and accents), with the members above them. A view on top
2561
+ * of the reader's filters, not one of them — `''` gives the view back.
2562
+ */
2563
+ setSearchText(text: string): void;
2533
2564
  setLayout(updates: Partial<PivotLayoutState>): void;
2534
2565
  private readonly unsupportedReporter;
2535
2566
  /**
@@ -2547,7 +2578,13 @@ declare class PivotController<TRow> {
2547
2578
  expandColPaths(paths: string[]): void;
2548
2579
  collapseColPaths(paths: string[]): void;
2549
2580
  setExpandedColPaths(paths: string[]): void;
2550
- expandAll(): void;
2581
+ /**
2582
+ * Expand one more level across the whole tree. A search or the column cap
2583
+ * cuts the tree on screen, so then the uncut one is computed and walked:
2584
+ * walking the cut one left every member the search hid closed, and every
2585
+ * column past the cap. Resolves when the new paths are set.
2586
+ */
2587
+ expandAll(): Promise<void>;
2551
2588
  collapseAll(): void;
2552
2589
  setColumnWidths(widths: Record<string, number>): void;
2553
2590
  setSelectionStats(selectionStats: PivotSelectionStats | null): void;
@@ -2700,6 +2737,7 @@ declare class PivotEngineService<TRow> {
2700
2737
  private drainQueued;
2701
2738
  private computing;
2702
2739
  private recomputeAfter;
2740
+ private phaseVersion;
2703
2741
  private hashes;
2704
2742
  constructor(config: PivotEngineServiceConfig<TRow>);
2705
2743
  refresh(): void;
@@ -2741,6 +2779,7 @@ declare class PivotEngineService<TRow> {
2741
2779
  private runReconfigure;
2742
2780
  private scheduleFilter;
2743
2781
  private runFilter;
2782
+ private endPhase;
2744
2783
  private scheduleComputeIfReady;
2745
2784
  private runCompute;
2746
2785
  private serverTimeout;
@@ -2756,17 +2795,26 @@ declare class PivotEngineService<TRow> {
2756
2795
  private postPhases;
2757
2796
  private runServerCompute;
2758
2797
  /**
2759
- * Produce a fully-expanded engine snapshot on demand, WITHOUT mutating the
2760
- * grid's live state. Used by `expandAll` exports: the cached engineResult
2761
- * only contains nodes visible under the current expand/collapse state (the
2762
- * worker prunes collapsed subtrees and their cells), so a naive
2763
- * "expand everything" over that snapshot would silently drop collapsed rows.
2764
- * This requests a fresh worker compute with every path expanded and re-runs
2765
- * the same post-aggregation, sort and display-mode phases as {@link runCompute}
2766
- * so the result is identical in shape to what the grid would render if the
2767
- * user expanded all nodes manually.
2768
- */
2769
- computeFullyExpandedSnapshot(): Promise<PivotEngineResult>;
2798
+ * Produce an engine snapshot for an export on demand, WITHOUT mutating the
2799
+ * grid's live state, and without the column cap (see postPhases).
2800
+ *
2801
+ * `all` (an `expandAll` export): the cached engineResult only contains nodes
2802
+ * visible under the current expand/collapse state (the worker prunes
2803
+ * collapsed subtrees and their cells), so a naive "expand everything" over
2804
+ * that snapshot would silently drop collapsed rows. This requests a fresh
2805
+ * compute with every path expanded and re-runs the same post-aggregation,
2806
+ * sort and display-mode phases as {@link runCompute} so the result is
2807
+ * identical in shape to what the grid would render if the user expanded all
2808
+ * nodes manually. Otherwise: the current expansion, as on screen.
2809
+ */
2810
+ computeSnapshot(all: boolean): Promise<PivotEngineResult>;
2811
+ /**
2812
+ * The tree under the current expansion before the search and the column cap
2813
+ * cut it — what `expandAll` walks. Walking the result on screen expanded only
2814
+ * the matches and the first `maxColumns` columns, so clearing the search
2815
+ * left every other member closed. Members only: no post phases.
2816
+ */
2817
+ computeUncut(): Promise<PivotEngineResult>;
2770
2818
  /**
2771
2819
  * Surface options the sort accepted but could not honour.
2772
2820
  *