@smallwebco/tinypivot-react 1.0.24 → 1.0.25

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,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ColumnStats, FieldStats, PivotValueField, AggregationFunction, PivotResult, LicenseInfo, ExportOptions, PivotExportData, SelectionBounds, PaginationOptions } from '@smallwebco/tinypivot-core';
2
+ import { ColumnStats, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, LicenseInfo, ExportOptions, PivotExportData, SelectionBounds, PaginationOptions } from '@smallwebco/tinypivot-core';
3
3
  export { AggregationFunction, CellClickEvent, ColumnStats, CopyEvent, DataGridProps, ExportEvent, ExportOptions, FieldStats, FilterEvent, GridOptions, LicenseInfo, LicenseType, PaginationOptions, PivotCell, PivotConfig as PivotConfigType, PivotField, PivotResult, PivotTableProps, PivotValueField, RowSelectionChangeEvent, SelectionBounds, SelectionChangeEvent, SortEvent, formatCellValue, getAggregationLabel, getColumnUniqueValues } from '@smallwebco/tinypivot-core';
4
4
  import * as react from 'react';
5
5
  import react__default from 'react';
@@ -69,6 +69,7 @@ interface PivotConfigProps {
69
69
  valueFields: PivotValueField[];
70
70
  showRowTotals: boolean;
71
71
  showColumnTotals: boolean;
72
+ calculatedFields?: CalculatedField[];
72
73
  onShowRowTotalsChange: (value: boolean) => void;
73
74
  onShowColumnTotalsChange: (value: boolean) => void;
74
75
  onClearConfig: () => void;
@@ -82,8 +83,11 @@ interface PivotConfigProps {
82
83
  onRemoveColumnField: (field: string) => void;
83
84
  onAddValueField: (field: string, aggregation: AggregationFunction) => void;
84
85
  onRemoveValueField: (field: string, aggregation: AggregationFunction) => void;
86
+ onAddCalculatedField?: (field: CalculatedField) => void;
87
+ onRemoveCalculatedField?: (id: string) => void;
88
+ onUpdateCalculatedField?: (field: CalculatedField) => void;
85
89
  }
86
- declare function PivotConfig({ availableFields, rowFields, columnFields, valueFields, showRowTotals, onShowRowTotalsChange, onClearConfig, onAutoSuggest, onDragStart, onDragEnd, onUpdateAggregation, onRemoveRowField, onRemoveColumnField, onRemoveValueField, onAddRowField, onAddColumnField, }: PivotConfigProps): react_jsx_runtime.JSX.Element;
90
+ declare function PivotConfig({ availableFields, rowFields, columnFields, valueFields, showRowTotals, calculatedFields, onShowRowTotalsChange, onShowColumnTotalsChange, onClearConfig, onAutoSuggest, onDragStart, onDragEnd, onUpdateAggregation, onRemoveRowField, onRemoveColumnField, onRemoveValueField, onAddRowField, onAddColumnField, onAddCalculatedField, onRemoveCalculatedField, onUpdateCalculatedField, }: PivotConfigProps): react_jsx_runtime.JSX.Element;
87
91
 
88
92
  interface ActiveFilter {
89
93
  column: string;
@@ -155,6 +159,7 @@ interface UsePivotTableReturn {
155
159
  valueFields: PivotValueField[];
156
160
  showRowTotals: boolean;
157
161
  showColumnTotals: boolean;
162
+ calculatedFields: CalculatedField[];
158
163
  availableFields: FieldStats[];
159
164
  unassignedFields: FieldStats[];
160
165
  isConfigured: boolean;
@@ -172,6 +177,8 @@ interface UsePivotTableReturn {
172
177
  autoSuggestConfig: () => void;
173
178
  setRowFields: (fields: string[]) => void;
174
179
  setColumnFields: (fields: string[]) => void;
180
+ addCalculatedField: (field: CalculatedField) => void;
181
+ removeCalculatedField: (id: string) => void;
175
182
  }
176
183
  /**
177
184
  * Main pivot table hook
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ColumnStats, FieldStats, PivotValueField, AggregationFunction, PivotResult, LicenseInfo, ExportOptions, PivotExportData, SelectionBounds, PaginationOptions } from '@smallwebco/tinypivot-core';
2
+ import { ColumnStats, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, LicenseInfo, ExportOptions, PivotExportData, SelectionBounds, PaginationOptions } from '@smallwebco/tinypivot-core';
3
3
  export { AggregationFunction, CellClickEvent, ColumnStats, CopyEvent, DataGridProps, ExportEvent, ExportOptions, FieldStats, FilterEvent, GridOptions, LicenseInfo, LicenseType, PaginationOptions, PivotCell, PivotConfig as PivotConfigType, PivotField, PivotResult, PivotTableProps, PivotValueField, RowSelectionChangeEvent, SelectionBounds, SelectionChangeEvent, SortEvent, formatCellValue, getAggregationLabel, getColumnUniqueValues } from '@smallwebco/tinypivot-core';
4
4
  import * as react from 'react';
5
5
  import react__default from 'react';
@@ -69,6 +69,7 @@ interface PivotConfigProps {
69
69
  valueFields: PivotValueField[];
70
70
  showRowTotals: boolean;
71
71
  showColumnTotals: boolean;
72
+ calculatedFields?: CalculatedField[];
72
73
  onShowRowTotalsChange: (value: boolean) => void;
73
74
  onShowColumnTotalsChange: (value: boolean) => void;
74
75
  onClearConfig: () => void;
@@ -82,8 +83,11 @@ interface PivotConfigProps {
82
83
  onRemoveColumnField: (field: string) => void;
83
84
  onAddValueField: (field: string, aggregation: AggregationFunction) => void;
84
85
  onRemoveValueField: (field: string, aggregation: AggregationFunction) => void;
86
+ onAddCalculatedField?: (field: CalculatedField) => void;
87
+ onRemoveCalculatedField?: (id: string) => void;
88
+ onUpdateCalculatedField?: (field: CalculatedField) => void;
85
89
  }
86
- declare function PivotConfig({ availableFields, rowFields, columnFields, valueFields, showRowTotals, onShowRowTotalsChange, onClearConfig, onAutoSuggest, onDragStart, onDragEnd, onUpdateAggregation, onRemoveRowField, onRemoveColumnField, onRemoveValueField, onAddRowField, onAddColumnField, }: PivotConfigProps): react_jsx_runtime.JSX.Element;
90
+ declare function PivotConfig({ availableFields, rowFields, columnFields, valueFields, showRowTotals, calculatedFields, onShowRowTotalsChange, onShowColumnTotalsChange, onClearConfig, onAutoSuggest, onDragStart, onDragEnd, onUpdateAggregation, onRemoveRowField, onRemoveColumnField, onRemoveValueField, onAddRowField, onAddColumnField, onAddCalculatedField, onRemoveCalculatedField, onUpdateCalculatedField, }: PivotConfigProps): react_jsx_runtime.JSX.Element;
87
91
 
88
92
  interface ActiveFilter {
89
93
  column: string;
@@ -155,6 +159,7 @@ interface UsePivotTableReturn {
155
159
  valueFields: PivotValueField[];
156
160
  showRowTotals: boolean;
157
161
  showColumnTotals: boolean;
162
+ calculatedFields: CalculatedField[];
158
163
  availableFields: FieldStats[];
159
164
  unassignedFields: FieldStats[];
160
165
  isConfigured: boolean;
@@ -172,6 +177,8 @@ interface UsePivotTableReturn {
172
177
  autoSuggestConfig: () => void;
173
178
  setRowFields: (fields: string[]) => void;
174
179
  setColumnFields: (fields: string[]) => void;
180
+ addCalculatedField: (field: CalculatedField) => void;
181
+ removeCalculatedField: (id: string) => void;
175
182
  }
176
183
  /**
177
184
  * Main pivot table hook