@kanunilabs/pivotgrid-react 1.2.1 → 1.3.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
@@ -1,11 +1,22 @@
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, PivotConditionRule as PivotConditionRule$1, PivotCell, PivotEngineResult, PivotLayoutState, PivotTheme, PivotStateStoringConfig, PivotToolbarConfig, PivotEngineRegistry, PivotLocale, PivotDictionary, FieldMoveEvent, ExportingEvent, PivotGridRef, ExportFormat, PivotReport, PivotArea, PivotNode, PivotControllerOptions, PivotController, PivotControllerState } from '@kanunilabs/pivotgrid-core';
5
- export { CustomSummaryOptions, DropIntent, ExportingEvent, FieldMoveEvent, FilterCondition, FilterGroup, FilterOperator, PivotArea, PivotCell, PivotCellTextAccessor, PivotCellValueAccessor, PivotControllerCallbacks, PivotControllerOptions, PivotControllerState, PivotDataSource, PivotDictionary, PivotDragIntentState, PivotGridRef, 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, 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';
6
6
  import * as _dnd_kit_core from '@dnd-kit/core';
7
7
  import { DragMoveEvent, DragEndEvent } from '@dnd-kit/core';
8
8
 
9
+ /** The imperative handle a `ref` on the grid receives. */
10
+ interface PivotGridRef extends PivotGridRef$1 {
11
+ /**
12
+ * Replaces the stored column widths — the same map a resize drag writes,
13
+ * persisted with the layout. Keys are `row-<i>` and `leaf-<i>`; see
14
+ * `PivotControllerState.columnWidths`. Columns left out go back to
15
+ * `defaultColumnWidths`, so merge with `getState().columnWidths` to change
16
+ * one column and keep the rest.
17
+ */
18
+ setColumnWidths: (widths: Record<string, number>) => void;
19
+ }
9
20
  type PivotCellTemplate = (props: Parameters<PivotCellTemplate$1>[0]) => React$1.ReactNode;
10
21
  type PivotConditionRule = PivotConditionRule$1<React$1.CSSProperties>;
11
22
  type PivotField<TRow = any> = PivotField$1<TRow, PivotCellTemplate, React$1.CSSProperties>;
@@ -81,6 +92,13 @@ interface BasePivotGridProps<TRow> {
81
92
  dictionary?: Partial<PivotDictionary>;
82
93
  /** Apply zebra striping to the data rows. */
83
94
  striped?: boolean;
95
+ /**
96
+ * Starting widths in pixels: `{ rowHeader, data }` for every row-header
97
+ * column and every data column. Defaults 150 and 95. A width the user drags
98
+ * (or `ref.setColumnWidths` writes) still wins; see
99
+ * `PivotControllerState.columnWidths` for its keys.
100
+ */
101
+ defaultColumnWidths?: PivotColumnWidthDefaults;
84
102
  /**
85
103
  * Fired when any cell is clicked (data cells, row headers, grand totals).
86
104
  * Replaces the deprecated onDrillDown handler.
@@ -184,6 +202,8 @@ interface PivotGridBodyProps {
184
202
  onMoveField?: (id: string, direction: 'start' | 'end' | 'left' | 'right') => void;
185
203
  onGlobalContextMenu?: (x: number, y: number) => void;
186
204
  columnWidths?: Record<string, number>;
205
+ /** What a column with no `columnWidths` entry is painted at. Defaults 150 / 95. */
206
+ defaultColumnWidths?: PivotColumnWidthDefaults;
187
207
  onColumnWidthsChange?: (widths: Record<string, number>) => void;
188
208
  onSelectionStatsChange?: (stats: {
189
209
  count: number;
@@ -200,7 +220,7 @@ interface PivotGridBodyProps {
200
220
  disabled?: boolean;
201
221
  renderNodeContextMenu?: (props: any) => React.ReactNode;
202
222
  }
203
- declare function PivotGridBody({ engineResult, isBuilding, buildProgress, rowFields, colFields: _colFields, dataFields, layout, expandedPaths, allExpanded, onToggleExpand, onExpandPaths, onCollapsePaths, expandedColPaths, allColExpanded, onToggleColExpand, onExpandColPaths, onCollapseColPaths, onCellClick, onContextMenu, onFilterClick, onRemoveField, onSort, onMoveField, onGlobalContextMenu, columnWidths, onColumnWidthsChange, onSelectionStatsChange, registry, keyboardNavigation, onCellPrepared, renderNodeContextMenu }: PivotGridBodyProps): React$1.JSX.Element;
223
+ declare function PivotGridBody({ engineResult, isBuilding, buildProgress, rowFields, colFields: _colFields, dataFields, layout, expandedPaths, allExpanded, onToggleExpand, onExpandPaths, onCollapsePaths, expandedColPaths, allColExpanded, onToggleColExpand, onExpandColPaths, onCollapseColPaths, onCellClick, onContextMenu, onFilterClick, onRemoveField, onSort, onMoveField, onGlobalContextMenu, columnWidths, defaultColumnWidths, onColumnWidthsChange, onSelectionStatsChange, registry, keyboardNavigation, onCellPrepared, renderNodeContextMenu }: PivotGridBodyProps): React$1.JSX.Element;
204
224
 
205
225
  interface PivotFooterProps {
206
226
  onToggleFieldChooser: () => void;
@@ -503,4 +523,4 @@ interface PivotThemeProviderProps {
503
523
  }
504
524
  declare function PivotThemeProvider({ theme, className, style, children }: PivotThemeProviderProps): React__default.JSX.Element;
505
525
 
506
- export { BasePivotGrid, type BasePivotGridProps, type CellClickEvent, type CellPreparedEvent, type ChartSeriesDef, type ChartSyncResult, type NodeContextMenuState, PivotAreaStrips, type PivotCellTemplate, type PivotChartIntegrationOptions, type PivotConditionRule, PivotConfigProvider, PivotContextMenu, PivotErrorBoundary, type PivotField, PivotFieldList, PivotFieldSettingsDialog, PivotFooter, PivotGridBody, PivotHeaderFilterPopup, PivotImportStatusModal, PivotNodeContextMenu, type PivotNodeContextMenuProps, PivotPortal, PivotPortalContext, PivotReportMenu, PivotReportSaveModal, PivotThemeProvider, usePivotChartSync, usePivotConfig, usePivotContextMenu, usePivotController, usePivotControllerStore, usePivotDnD, usePivotFullscreen };
526
+ export { BasePivotGrid, type BasePivotGridProps, type CellClickEvent, type CellPreparedEvent, type ChartSeriesDef, type ChartSyncResult, type NodeContextMenuState, PivotAreaStrips, type PivotCellTemplate, type PivotChartIntegrationOptions, type PivotConditionRule, PivotConfigProvider, PivotContextMenu, PivotErrorBoundary, type PivotField, PivotFieldList, PivotFieldSettingsDialog, PivotFooter, PivotGridBody, type PivotGridRef, PivotHeaderFilterPopup, PivotImportStatusModal, PivotNodeContextMenu, type PivotNodeContextMenuProps, PivotPortal, PivotPortalContext, PivotReportMenu, PivotReportSaveModal, PivotThemeProvider, usePivotChartSync, usePivotConfig, usePivotContextMenu, usePivotController, usePivotControllerStore, usePivotDnD, usePivotFullscreen };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,22 @@
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, PivotConditionRule as PivotConditionRule$1, PivotCell, PivotEngineResult, PivotLayoutState, PivotTheme, PivotStateStoringConfig, PivotToolbarConfig, PivotEngineRegistry, PivotLocale, PivotDictionary, FieldMoveEvent, ExportingEvent, PivotGridRef, ExportFormat, PivotReport, PivotArea, PivotNode, PivotControllerOptions, PivotController, PivotControllerState } from '@kanunilabs/pivotgrid-core';
5
- export { CustomSummaryOptions, DropIntent, ExportingEvent, FieldMoveEvent, FilterCondition, FilterGroup, FilterOperator, PivotArea, PivotCell, PivotCellTextAccessor, PivotCellValueAccessor, PivotControllerCallbacks, PivotControllerOptions, PivotControllerState, PivotDataSource, PivotDictionary, PivotDragIntentState, PivotGridRef, 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, 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';
6
6
  import * as _dnd_kit_core from '@dnd-kit/core';
7
7
  import { DragMoveEvent, DragEndEvent } from '@dnd-kit/core';
8
8
 
9
+ /** The imperative handle a `ref` on the grid receives. */
10
+ interface PivotGridRef extends PivotGridRef$1 {
11
+ /**
12
+ * Replaces the stored column widths — the same map a resize drag writes,
13
+ * persisted with the layout. Keys are `row-<i>` and `leaf-<i>`; see
14
+ * `PivotControllerState.columnWidths`. Columns left out go back to
15
+ * `defaultColumnWidths`, so merge with `getState().columnWidths` to change
16
+ * one column and keep the rest.
17
+ */
18
+ setColumnWidths: (widths: Record<string, number>) => void;
19
+ }
9
20
  type PivotCellTemplate = (props: Parameters<PivotCellTemplate$1>[0]) => React$1.ReactNode;
10
21
  type PivotConditionRule = PivotConditionRule$1<React$1.CSSProperties>;
11
22
  type PivotField<TRow = any> = PivotField$1<TRow, PivotCellTemplate, React$1.CSSProperties>;
@@ -81,6 +92,13 @@ interface BasePivotGridProps<TRow> {
81
92
  dictionary?: Partial<PivotDictionary>;
82
93
  /** Apply zebra striping to the data rows. */
83
94
  striped?: boolean;
95
+ /**
96
+ * Starting widths in pixels: `{ rowHeader, data }` for every row-header
97
+ * column and every data column. Defaults 150 and 95. A width the user drags
98
+ * (or `ref.setColumnWidths` writes) still wins; see
99
+ * `PivotControllerState.columnWidths` for its keys.
100
+ */
101
+ defaultColumnWidths?: PivotColumnWidthDefaults;
84
102
  /**
85
103
  * Fired when any cell is clicked (data cells, row headers, grand totals).
86
104
  * Replaces the deprecated onDrillDown handler.
@@ -184,6 +202,8 @@ interface PivotGridBodyProps {
184
202
  onMoveField?: (id: string, direction: 'start' | 'end' | 'left' | 'right') => void;
185
203
  onGlobalContextMenu?: (x: number, y: number) => void;
186
204
  columnWidths?: Record<string, number>;
205
+ /** What a column with no `columnWidths` entry is painted at. Defaults 150 / 95. */
206
+ defaultColumnWidths?: PivotColumnWidthDefaults;
187
207
  onColumnWidthsChange?: (widths: Record<string, number>) => void;
188
208
  onSelectionStatsChange?: (stats: {
189
209
  count: number;
@@ -200,7 +220,7 @@ interface PivotGridBodyProps {
200
220
  disabled?: boolean;
201
221
  renderNodeContextMenu?: (props: any) => React.ReactNode;
202
222
  }
203
- declare function PivotGridBody({ engineResult, isBuilding, buildProgress, rowFields, colFields: _colFields, dataFields, layout, expandedPaths, allExpanded, onToggleExpand, onExpandPaths, onCollapsePaths, expandedColPaths, allColExpanded, onToggleColExpand, onExpandColPaths, onCollapseColPaths, onCellClick, onContextMenu, onFilterClick, onRemoveField, onSort, onMoveField, onGlobalContextMenu, columnWidths, onColumnWidthsChange, onSelectionStatsChange, registry, keyboardNavigation, onCellPrepared, renderNodeContextMenu }: PivotGridBodyProps): React$1.JSX.Element;
223
+ declare function PivotGridBody({ engineResult, isBuilding, buildProgress, rowFields, colFields: _colFields, dataFields, layout, expandedPaths, allExpanded, onToggleExpand, onExpandPaths, onCollapsePaths, expandedColPaths, allColExpanded, onToggleColExpand, onExpandColPaths, onCollapseColPaths, onCellClick, onContextMenu, onFilterClick, onRemoveField, onSort, onMoveField, onGlobalContextMenu, columnWidths, defaultColumnWidths, onColumnWidthsChange, onSelectionStatsChange, registry, keyboardNavigation, onCellPrepared, renderNodeContextMenu }: PivotGridBodyProps): React$1.JSX.Element;
204
224
 
205
225
  interface PivotFooterProps {
206
226
  onToggleFieldChooser: () => void;
@@ -503,4 +523,4 @@ interface PivotThemeProviderProps {
503
523
  }
504
524
  declare function PivotThemeProvider({ theme, className, style, children }: PivotThemeProviderProps): React__default.JSX.Element;
505
525
 
506
- export { BasePivotGrid, type BasePivotGridProps, type CellClickEvent, type CellPreparedEvent, type ChartSeriesDef, type ChartSyncResult, type NodeContextMenuState, PivotAreaStrips, type PivotCellTemplate, type PivotChartIntegrationOptions, type PivotConditionRule, PivotConfigProvider, PivotContextMenu, PivotErrorBoundary, type PivotField, PivotFieldList, PivotFieldSettingsDialog, PivotFooter, PivotGridBody, PivotHeaderFilterPopup, PivotImportStatusModal, PivotNodeContextMenu, type PivotNodeContextMenuProps, PivotPortal, PivotPortalContext, PivotReportMenu, PivotReportSaveModal, PivotThemeProvider, usePivotChartSync, usePivotConfig, usePivotContextMenu, usePivotController, usePivotControllerStore, usePivotDnD, usePivotFullscreen };
526
+ export { BasePivotGrid, type BasePivotGridProps, type CellClickEvent, type CellPreparedEvent, type ChartSeriesDef, type ChartSyncResult, type NodeContextMenuState, PivotAreaStrips, type PivotCellTemplate, type PivotChartIntegrationOptions, type PivotConditionRule, PivotConfigProvider, PivotContextMenu, PivotErrorBoundary, type PivotField, PivotFieldList, PivotFieldSettingsDialog, PivotFooter, PivotGridBody, type PivotGridRef, PivotHeaderFilterPopup, PivotImportStatusModal, PivotNodeContextMenu, type PivotNodeContextMenuProps, PivotPortal, PivotPortalContext, PivotReportMenu, PivotReportSaveModal, PivotThemeProvider, usePivotChartSync, usePivotConfig, usePivotContextMenu, usePivotController, usePivotControllerStore, usePivotDnD, usePivotFullscreen };