@kanunilabs/pivotgrid-react 1.3.0 → 1.4.1

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
@@ -1,8 +1,8 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default, { Component, ErrorInfo } from 'react';
3
3
  import * as _kanunilabs_pivotgrid_core from '@kanunilabs/pivotgrid-core';
4
- import { PivotField as PivotField$1, PivotCellTemplate as PivotCellTemplate$1, CellClickEvent as CellClickEvent$1, CellPreparedEvent as CellPreparedEvent$1, PivotGridRef as PivotGridRef$1, PivotConditionRule as PivotConditionRule$1, PivotCell, PivotEngineResult, PivotLayoutState, PivotTheme, PivotStateStoringConfig, PivotToolbarConfig, PivotEngineRegistry, PivotLocale, PivotDictionary, PivotColumnWidthDefaults, FieldMoveEvent, ExportingEvent, ExportFormat, PivotReport, PivotArea, PivotNode, PivotControllerOptions, PivotController, PivotControllerState } from '@kanunilabs/pivotgrid-core';
5
- export { CustomSummaryOptions, DropIntent, ExportingEvent, FieldMoveEvent, FilterCondition, FilterGroup, FilterOperator, PivotArea, PivotCell, PivotCellTextAccessor, PivotCellValueAccessor, PivotColumnWidthDefaults, PivotControllerCallbacks, PivotControllerOptions, PivotControllerState, PivotDataSource, PivotDictionary, PivotDragIntentState, PivotGroupInterval, PivotImportStatus, PivotLayoutProfile, PivotLayoutState, PivotLocale, PivotNode, PivotPrefilter, PivotSelectionMode, PivotSelectionRange, PivotSelectionState, PivotSelectionStats, PivotStateStoringConfig, PivotSummaryDisplayMode, PivotSummaryType, PivotTheme, PivotToolbarConfig, defaultPivotLayout } from '@kanunilabs/pivotgrid-core';
4
+ import { PivotField as PivotField$1, PivotCellTemplate as PivotCellTemplate$1, CellClickEvent as CellClickEvent$1, CellPreparedEvent as CellPreparedEvent$1, PivotGridRef as PivotGridRef$1, PivotRowTransaction, PivotTransactionResult, PivotController, PivotConditionRule as PivotConditionRule$1, PivotCell, PivotEngineResult, PivotControllerOptions, PivotLayoutState, PivotTheme, PivotStateStoringConfig, PivotToolbarConfig, PivotEngineRegistry, PivotLocale, PivotDictionary, PivotColumnWidthDefaults, FieldMoveEvent, ExportingEvent, ExportFormat, PivotReport, PivotArea, PivotNode, PivotControllerState } from '@kanunilabs/pivotgrid-core';
5
+ export { CustomSummaryOptions, DropIntent, ExportingEvent, FieldMoveEvent, FilterCondition, FilterGroup, FilterOperator, PivotArea, PivotCell, PivotCellTextAccessor, PivotCellValueAccessor, PivotColumnWidthDefaults, PivotControllerCallbacks, PivotControllerOptions, PivotControllerState, PivotDataSource, PivotDictionary, PivotDragIntentState, PivotGroupInterval, PivotImportStatus, PivotLayoutProfile, PivotLayoutState, PivotLocale, PivotNode, PivotPrefilter, PivotRowKey, PivotRowKeyResolver, PivotRowTransaction, PivotSelectionMode, PivotSelectionRange, PivotSelectionState, PivotSelectionStats, PivotStateStoringConfig, PivotSummaryDisplayMode, PivotSummaryType, PivotTheme, PivotToolbarConfig, PivotTransactionResult, defaultPivotLayout } from '@kanunilabs/pivotgrid-core';
6
6
  import * as _dnd_kit_core from '@dnd-kit/core';
7
7
  import { DragMoveEvent, DragEndEvent } from '@dnd-kit/core';
8
8
 
@@ -16,6 +16,20 @@ interface PivotGridRef extends PivotGridRef$1 {
16
16
  * one column and keep the rest.
17
17
  */
18
18
  setColumnWidths: (widths: Record<string, number>) => void;
19
+ /**
20
+ * Add, update and remove rows without rebuilding the pivot (live updates).
21
+ * Rows are matched by the `rowKey` prop (by object identity without it); an
22
+ * update for an unknown key is ignored, a remove wins over an update of the
23
+ * same row, adds go to the end. Returns what was applied; the recomputed
24
+ * pivot follows asynchronously.
25
+ */
26
+ applyTransaction: (transaction: PivotRowTransaction<any>) => PivotTransactionResult;
27
+ /**
28
+ * The controller behind the grid — for the calls that take one, such as the
29
+ * Enterprise AI layout functions (`getPivotAiSchema(ref.current.getController())`).
30
+ * The vanilla grid hands out the same object as `api.controller`.
31
+ */
32
+ getController: () => PivotController<any>;
19
33
  }
20
34
  type PivotCellTemplate = (props: Parameters<PivotCellTemplate$1>[0]) => React$1.ReactNode;
21
35
  type PivotConditionRule = PivotConditionRule$1<React$1.CSSProperties>;
@@ -27,6 +41,12 @@ interface PivotChartIntegrationOptions {
27
41
  inverted?: boolean;
28
42
  hideTotals?: boolean;
29
43
  maxPoints?: number;
44
+ /**
45
+ * Most series (column paths × measures) handed to the chart; the rest are
46
+ * dropped and `isSeriesSampled` says so. The built-in transformer's default
47
+ * is 20 — one chart element per visible column leaf is otherwise unbounded.
48
+ */
49
+ maxSeries?: number;
30
50
  dataFieldsDisplayMode?: 'singleAxis' | 'splitAxes';
31
51
  processCell?: (cell: PivotCell) => boolean;
32
52
  transformer?: (engineResult: PivotEngineResult, fields: PivotField[], expandedPaths: Set<string>, locale: string, options: any) => ChartSyncResult;
@@ -36,10 +56,32 @@ interface ChartSeriesDef {
36
56
  name: string;
37
57
  color: string;
38
58
  yAxisId?: string;
59
+ /**
60
+ * The data field this series measures — so a chart can print its values
61
+ * with that field's own `format`. Set by the built-in transformer.
62
+ */
63
+ fieldId?: string;
64
+ /**
65
+ * The column path this series belongs to ('' for a pivot without column
66
+ * fields) and its label. Series of the same group are the same column cut
67
+ * of different measures — what an X-Y chart pairs as x, y and size.
68
+ */
69
+ seriesKey?: string;
70
+ seriesLabel?: string;
39
71
  }
40
72
  interface ChartSyncResult {
41
73
  chartData: any[];
42
74
  chartSeries: ChartSeriesDef[];
75
+ /**
76
+ * The built-in transformer's sampling report, passed through: `maxPoints`
77
+ * dropped categories (`isSampled`, of `totalArgs`), `maxSeries` dropped
78
+ * series (`isSeriesSampled`, of `totalSeries`). Tell the reader they are
79
+ * looking at part of the pivot.
80
+ */
81
+ isSampled?: boolean;
82
+ totalArgs?: number;
83
+ isSeriesSampled?: boolean;
84
+ totalSeries?: number;
43
85
  }
44
86
  declare function usePivotChartSync(engineResult: PivotEngineResult | null, fields: PivotField[], expandedPaths: Set<string>, options?: PivotChartIntegrationOptions): ChartSyncResult;
45
87
 
@@ -58,8 +100,18 @@ interface BasePivotGridProps<TRow> {
58
100
  * point this at it, e.g. `/kanunilabs/pivot.worker.js`.
59
101
  */
60
102
  workerUrl?: string | URL;
61
- /** The raw tabular data array. */
103
+ /**
104
+ * The raw tabular data array. A NEW array replaces every row; passing the
105
+ * same array again (any re-render) does not, so rows changed through
106
+ * `ref.applyTransaction` stay changed.
107
+ */
62
108
  data: TRow[];
109
+ /**
110
+ * What identifies a row for `ref.applyTransaction`: a field name, or a
111
+ * function returning a string or number. Without it rows are matched by
112
+ * object identity.
113
+ */
114
+ rowKey?: PivotControllerOptions<TRow>['rowKey'];
63
115
  /** Initial field configuration (Uncontrolled mode). */
64
116
  initialFields?: PivotField<TRow>[];
65
117
  /** Controlled field configuration. If provided, component acts as controlled. */
@@ -82,6 +134,8 @@ interface BasePivotGridProps<TRow> {
82
134
  };
83
135
  /** Configuration for the toolbar visibility and features. */
84
136
  toolbar?: PivotToolbarConfig;
137
+ /** Server-side pivot (Enterprise): the server aggregates; `data` is not read. */
138
+ serverSource?: PivotControllerOptions<TRow>['serverSource'];
85
139
  /** The plugin registry containing custom functions and formatters. */
86
140
  registry?: PivotEngineRegistry;
87
141
  /** Locale for the grid (tr, en, ar). Defaults to tr. */
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default, { Component, ErrorInfo } from 'react';
3
3
  import * as _kanunilabs_pivotgrid_core from '@kanunilabs/pivotgrid-core';
4
- import { PivotField as PivotField$1, PivotCellTemplate as PivotCellTemplate$1, CellClickEvent as CellClickEvent$1, CellPreparedEvent as CellPreparedEvent$1, PivotGridRef as PivotGridRef$1, PivotConditionRule as PivotConditionRule$1, PivotCell, PivotEngineResult, PivotLayoutState, PivotTheme, PivotStateStoringConfig, PivotToolbarConfig, PivotEngineRegistry, PivotLocale, PivotDictionary, PivotColumnWidthDefaults, FieldMoveEvent, ExportingEvent, ExportFormat, PivotReport, PivotArea, PivotNode, PivotControllerOptions, PivotController, PivotControllerState } from '@kanunilabs/pivotgrid-core';
5
- export { CustomSummaryOptions, DropIntent, ExportingEvent, FieldMoveEvent, FilterCondition, FilterGroup, FilterOperator, PivotArea, PivotCell, PivotCellTextAccessor, PivotCellValueAccessor, PivotColumnWidthDefaults, PivotControllerCallbacks, PivotControllerOptions, PivotControllerState, PivotDataSource, PivotDictionary, PivotDragIntentState, PivotGroupInterval, PivotImportStatus, PivotLayoutProfile, PivotLayoutState, PivotLocale, PivotNode, PivotPrefilter, PivotSelectionMode, PivotSelectionRange, PivotSelectionState, PivotSelectionStats, PivotStateStoringConfig, PivotSummaryDisplayMode, PivotSummaryType, PivotTheme, PivotToolbarConfig, defaultPivotLayout } from '@kanunilabs/pivotgrid-core';
4
+ import { PivotField as PivotField$1, PivotCellTemplate as PivotCellTemplate$1, CellClickEvent as CellClickEvent$1, CellPreparedEvent as CellPreparedEvent$1, PivotGridRef as PivotGridRef$1, PivotRowTransaction, PivotTransactionResult, PivotController, PivotConditionRule as PivotConditionRule$1, PivotCell, PivotEngineResult, PivotControllerOptions, PivotLayoutState, PivotTheme, PivotStateStoringConfig, PivotToolbarConfig, PivotEngineRegistry, PivotLocale, PivotDictionary, PivotColumnWidthDefaults, FieldMoveEvent, ExportingEvent, ExportFormat, PivotReport, PivotArea, PivotNode, PivotControllerState } from '@kanunilabs/pivotgrid-core';
5
+ export { CustomSummaryOptions, DropIntent, ExportingEvent, FieldMoveEvent, FilterCondition, FilterGroup, FilterOperator, PivotArea, PivotCell, PivotCellTextAccessor, PivotCellValueAccessor, PivotColumnWidthDefaults, PivotControllerCallbacks, PivotControllerOptions, PivotControllerState, PivotDataSource, PivotDictionary, PivotDragIntentState, PivotGroupInterval, PivotImportStatus, PivotLayoutProfile, PivotLayoutState, PivotLocale, PivotNode, PivotPrefilter, PivotRowKey, PivotRowKeyResolver, PivotRowTransaction, PivotSelectionMode, PivotSelectionRange, PivotSelectionState, PivotSelectionStats, PivotStateStoringConfig, PivotSummaryDisplayMode, PivotSummaryType, PivotTheme, PivotToolbarConfig, PivotTransactionResult, defaultPivotLayout } from '@kanunilabs/pivotgrid-core';
6
6
  import * as _dnd_kit_core from '@dnd-kit/core';
7
7
  import { DragMoveEvent, DragEndEvent } from '@dnd-kit/core';
8
8
 
@@ -16,6 +16,20 @@ interface PivotGridRef extends PivotGridRef$1 {
16
16
  * one column and keep the rest.
17
17
  */
18
18
  setColumnWidths: (widths: Record<string, number>) => void;
19
+ /**
20
+ * Add, update and remove rows without rebuilding the pivot (live updates).
21
+ * Rows are matched by the `rowKey` prop (by object identity without it); an
22
+ * update for an unknown key is ignored, a remove wins over an update of the
23
+ * same row, adds go to the end. Returns what was applied; the recomputed
24
+ * pivot follows asynchronously.
25
+ */
26
+ applyTransaction: (transaction: PivotRowTransaction<any>) => PivotTransactionResult;
27
+ /**
28
+ * The controller behind the grid — for the calls that take one, such as the
29
+ * Enterprise AI layout functions (`getPivotAiSchema(ref.current.getController())`).
30
+ * The vanilla grid hands out the same object as `api.controller`.
31
+ */
32
+ getController: () => PivotController<any>;
19
33
  }
20
34
  type PivotCellTemplate = (props: Parameters<PivotCellTemplate$1>[0]) => React$1.ReactNode;
21
35
  type PivotConditionRule = PivotConditionRule$1<React$1.CSSProperties>;
@@ -27,6 +41,12 @@ interface PivotChartIntegrationOptions {
27
41
  inverted?: boolean;
28
42
  hideTotals?: boolean;
29
43
  maxPoints?: number;
44
+ /**
45
+ * Most series (column paths × measures) handed to the chart; the rest are
46
+ * dropped and `isSeriesSampled` says so. The built-in transformer's default
47
+ * is 20 — one chart element per visible column leaf is otherwise unbounded.
48
+ */
49
+ maxSeries?: number;
30
50
  dataFieldsDisplayMode?: 'singleAxis' | 'splitAxes';
31
51
  processCell?: (cell: PivotCell) => boolean;
32
52
  transformer?: (engineResult: PivotEngineResult, fields: PivotField[], expandedPaths: Set<string>, locale: string, options: any) => ChartSyncResult;
@@ -36,10 +56,32 @@ interface ChartSeriesDef {
36
56
  name: string;
37
57
  color: string;
38
58
  yAxisId?: string;
59
+ /**
60
+ * The data field this series measures — so a chart can print its values
61
+ * with that field's own `format`. Set by the built-in transformer.
62
+ */
63
+ fieldId?: string;
64
+ /**
65
+ * The column path this series belongs to ('' for a pivot without column
66
+ * fields) and its label. Series of the same group are the same column cut
67
+ * of different measures — what an X-Y chart pairs as x, y and size.
68
+ */
69
+ seriesKey?: string;
70
+ seriesLabel?: string;
39
71
  }
40
72
  interface ChartSyncResult {
41
73
  chartData: any[];
42
74
  chartSeries: ChartSeriesDef[];
75
+ /**
76
+ * The built-in transformer's sampling report, passed through: `maxPoints`
77
+ * dropped categories (`isSampled`, of `totalArgs`), `maxSeries` dropped
78
+ * series (`isSeriesSampled`, of `totalSeries`). Tell the reader they are
79
+ * looking at part of the pivot.
80
+ */
81
+ isSampled?: boolean;
82
+ totalArgs?: number;
83
+ isSeriesSampled?: boolean;
84
+ totalSeries?: number;
43
85
  }
44
86
  declare function usePivotChartSync(engineResult: PivotEngineResult | null, fields: PivotField[], expandedPaths: Set<string>, options?: PivotChartIntegrationOptions): ChartSyncResult;
45
87
 
@@ -58,8 +100,18 @@ interface BasePivotGridProps<TRow> {
58
100
  * point this at it, e.g. `/kanunilabs/pivot.worker.js`.
59
101
  */
60
102
  workerUrl?: string | URL;
61
- /** The raw tabular data array. */
103
+ /**
104
+ * The raw tabular data array. A NEW array replaces every row; passing the
105
+ * same array again (any re-render) does not, so rows changed through
106
+ * `ref.applyTransaction` stay changed.
107
+ */
62
108
  data: TRow[];
109
+ /**
110
+ * What identifies a row for `ref.applyTransaction`: a field name, or a
111
+ * function returning a string or number. Without it rows are matched by
112
+ * object identity.
113
+ */
114
+ rowKey?: PivotControllerOptions<TRow>['rowKey'];
63
115
  /** Initial field configuration (Uncontrolled mode). */
64
116
  initialFields?: PivotField<TRow>[];
65
117
  /** Controlled field configuration. If provided, component acts as controlled. */
@@ -82,6 +134,8 @@ interface BasePivotGridProps<TRow> {
82
134
  };
83
135
  /** Configuration for the toolbar visibility and features. */
84
136
  toolbar?: PivotToolbarConfig;
137
+ /** Server-side pivot (Enterprise): the server aggregates; `data` is not read. */
138
+ serverSource?: PivotControllerOptions<TRow>['serverSource'];
85
139
  /** The plugin registry containing custom functions and formatters. */
86
140
  registry?: PivotEngineRegistry;
87
141
  /** Locale for the grid (tr, en, ar). Defaults to tr. */