@smallwebco/tinypivot-react 1.0.81 → 1.1.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,6 +1,6 @@
1
1
  import * as _smallwebco_tinypivot_core from '@smallwebco/tinypivot-core';
2
- import { AIAnalystConfig, ResolvedTheme, AIDataLoadedEvent, AIConversationUpdateEvent, AIQueryExecutedEvent, AIErrorEvent, ColumnStats, NumericRange, DateRange, NumberFormat, DateFormat, Theme, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, AIConversation, AITableSchema, AIDataSource, PivotExportData, ExportOptions, SelectionBounds, PaginationOptions, LicenseInfo } from '@smallwebco/tinypivot-core';
3
- export { AIAnalystConfig, AIColumnSchema, AIConversation, AIConversationUpdateEvent, AIDataLoadedEvent, AIDataSource, AIErrorEvent, AIMessage, AIMessageMetadata, AIQueryExecutedEvent, AITableSchema, 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';
2
+ import { AIAnalystConfig, ResolvedTheme, AIDataLoadedEvent, AIConversationUpdateEvent, AIQueryExecutedEvent, AIErrorEvent, ColumnStats, NumericRange, DateRange, NumberFormat, DateFormat, Theme, DrillThroughResult, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, AIConversation, AITableSchema, AIDataSource, PivotExportData, ExportOptions, SelectionBounds, PaginationOptions, LicenseInfo } from '@smallwebco/tinypivot-core';
3
+ export { AIAnalystConfig, AIColumnSchema, AIConversation, AIConversationUpdateEvent, AIDataLoadedEvent, AIDataSource, AIErrorEvent, AIMessage, AIMessageMetadata, AIQueryExecutedEvent, AITableSchema, AggregationFunction, CellClickEvent, ColumnStats, CopyEvent, DataGridProps, DrillThroughDescriptor, DrillThroughResult, ExportEvent, ExportOptions, FieldRoleOverrides, FieldStats, FilterEvent, GridOptions, LicenseInfo, LicenseType, PaginationOptions, PivotCell, PivotConfig as PivotConfigType, PivotField, PivotGroupStart, PivotResult, PivotRowMeta, 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';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -83,6 +83,10 @@ interface DataGridProps {
83
83
  fieldRoleOverrides?: Record<string, _smallwebco_tinypivot_core.FieldRole>;
84
84
  /** AI Data Analyst configuration (Pro feature, disabled by default) */
85
85
  aiAnalyst?: AIAnalystConfig;
86
+ /** Enable row group collapse/expand (default true) */
87
+ enableDrillDown?: boolean;
88
+ /** Enable drill-through on double-click (Pro feature, default true) */
89
+ enableDrillThrough?: boolean;
86
90
  onCellClick?: (payload: {
87
91
  row: number;
88
92
  col: number;
@@ -108,8 +112,10 @@ interface DataGridProps {
108
112
  onAIConversationUpdate?: (payload: AIConversationUpdateEvent) => void;
109
113
  onAIQueryExecuted?: (payload: AIQueryExecutedEvent) => void;
110
114
  onAIError?: (payload: AIErrorEvent) => void;
115
+ onCollapseChange?: (collapsedPaths: string[]) => void;
116
+ onDrillThrough?: (result: DrillThroughResult) => void;
111
117
  }
112
- declare function DataGrid({ data, loading, fontSize: initialFontSize, showPivot, enableExport, enableSearch, enablePagination, pageSize, enableColumnResize, enableClipboard, theme, stripedRows, exportFilename, enableVerticalResize, initialHeight, minHeight, maxHeight, numberFormat, dateFormat, fieldRoleOverrides, aiAnalyst, onCellClick, onExport, onCopy, onAIDataLoaded, onAIConversationUpdate, onAIQueryExecuted, onAIError, }: DataGridProps): react_jsx_runtime.JSX.Element;
118
+ declare function DataGrid({ data, loading, fontSize: initialFontSize, showPivot, enableExport, enableSearch, enablePagination, pageSize, enableColumnResize, enableClipboard, theme, stripedRows, exportFilename, enableVerticalResize, initialHeight, minHeight, maxHeight, numberFormat, dateFormat, fieldRoleOverrides, aiAnalyst, enableDrillDown, enableDrillThrough, onCellClick, onExport, onCopy, onAIDataLoaded, onAIConversationUpdate, onAIQueryExecuted, onAIError, onCollapseChange, onDrillThrough, }: DataGridProps): react_jsx_runtime.JSX.Element;
113
119
 
114
120
  interface PivotConfigProps {
115
121
  availableFields: FieldStats[];
@@ -158,6 +164,8 @@ interface PivotSkeletonProps {
158
164
  activeFilters?: ActiveFilter[] | null;
159
165
  totalRowCount?: number;
160
166
  filteredRowCount?: number;
167
+ enableDrillDown?: boolean;
168
+ enableDrillThrough?: boolean;
161
169
  onAddRowField: (field: string) => void;
162
170
  onRemoveRowField: (field: string) => void;
163
171
  onAddColumnField: (field: string) => void;
@@ -167,9 +175,15 @@ interface PivotSkeletonProps {
167
175
  onUpdateAggregation: (field: string, oldAgg: AggregationFunction, newAgg: AggregationFunction) => void;
168
176
  onReorderRowFields: (fields: string[]) => void;
169
177
  onReorderColumnFields: (fields: string[]) => void;
178
+ onToggleCollapse?: (key: string, altKey: boolean) => void;
179
+ onDrillThroughCell?: (payload: {
180
+ rowPath: string[];
181
+ columnPath: string[];
182
+ valueFieldIndex: number;
183
+ }) => void;
170
184
  theme?: string;
171
185
  }
172
- declare function PivotSkeleton({ rowFields, columnFields, valueFields, calculatedFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, theme, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
186
+ declare function PivotSkeleton({ rowFields, columnFields, valueFields, calculatedFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, enableDrillDown, enableDrillThrough, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, onToggleCollapse, onDrillThroughCell, theme, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
173
187
 
174
188
  interface UseAIAnalystOptions {
175
189
  config: AIAnalystConfig;
@@ -355,6 +369,7 @@ interface UsePivotTableReturn {
355
369
  showRowTotals: boolean;
356
370
  showColumnTotals: boolean;
357
371
  calculatedFields: CalculatedField[];
372
+ collapsedPaths: Set<string>;
358
373
  availableFields: FieldStats[];
359
374
  unassignedFields: FieldStats[];
360
375
  isConfigured: boolean;
@@ -374,10 +389,11 @@ interface UsePivotTableReturn {
374
389
  setColumnFields: (fields: string[]) => void;
375
390
  addCalculatedField: (field: CalculatedField) => void;
376
391
  removeCalculatedField: (id: string) => void;
392
+ toggleCollapsedPath: (key: string, altKey: boolean, rowFields: string[], currentPivotResult: PivotResult | null) => Set<string>;
377
393
  }
378
394
  /**
379
395
  * Main pivot table hook
380
396
  */
381
- declare function usePivotTable(data: Record<string, unknown>[]): UsePivotTableReturn;
397
+ declare function usePivotTable(data: Record<string, unknown>[], enableDrillDown?: boolean): UsePivotTableReturn;
382
398
 
383
399
  export { AIAnalyst, ColumnFilter, DataGrid, PivotConfig, PivotSkeleton, type UseAIAnalystOptions, configureLicenseSecret, copyToClipboard, enableDemoMode, exportPivotToCSV, exportToCSV, formatSelectionForClipboard, setLicenseKey, useAIAnalyst, useColumnResize, useExcelGrid, useGlobalSearch, useLicense, usePagination, usePivotTable, useRowSelection };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _smallwebco_tinypivot_core from '@smallwebco/tinypivot-core';
2
- import { AIAnalystConfig, ResolvedTheme, AIDataLoadedEvent, AIConversationUpdateEvent, AIQueryExecutedEvent, AIErrorEvent, ColumnStats, NumericRange, DateRange, NumberFormat, DateFormat, Theme, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, AIConversation, AITableSchema, AIDataSource, PivotExportData, ExportOptions, SelectionBounds, PaginationOptions, LicenseInfo } from '@smallwebco/tinypivot-core';
3
- export { AIAnalystConfig, AIColumnSchema, AIConversation, AIConversationUpdateEvent, AIDataLoadedEvent, AIDataSource, AIErrorEvent, AIMessage, AIMessageMetadata, AIQueryExecutedEvent, AITableSchema, 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';
2
+ import { AIAnalystConfig, ResolvedTheme, AIDataLoadedEvent, AIConversationUpdateEvent, AIQueryExecutedEvent, AIErrorEvent, ColumnStats, NumericRange, DateRange, NumberFormat, DateFormat, Theme, DrillThroughResult, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, AIConversation, AITableSchema, AIDataSource, PivotExportData, ExportOptions, SelectionBounds, PaginationOptions, LicenseInfo } from '@smallwebco/tinypivot-core';
3
+ export { AIAnalystConfig, AIColumnSchema, AIConversation, AIConversationUpdateEvent, AIDataLoadedEvent, AIDataSource, AIErrorEvent, AIMessage, AIMessageMetadata, AIQueryExecutedEvent, AITableSchema, AggregationFunction, CellClickEvent, ColumnStats, CopyEvent, DataGridProps, DrillThroughDescriptor, DrillThroughResult, ExportEvent, ExportOptions, FieldRoleOverrides, FieldStats, FilterEvent, GridOptions, LicenseInfo, LicenseType, PaginationOptions, PivotCell, PivotConfig as PivotConfigType, PivotField, PivotGroupStart, PivotResult, PivotRowMeta, 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';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -83,6 +83,10 @@ interface DataGridProps {
83
83
  fieldRoleOverrides?: Record<string, _smallwebco_tinypivot_core.FieldRole>;
84
84
  /** AI Data Analyst configuration (Pro feature, disabled by default) */
85
85
  aiAnalyst?: AIAnalystConfig;
86
+ /** Enable row group collapse/expand (default true) */
87
+ enableDrillDown?: boolean;
88
+ /** Enable drill-through on double-click (Pro feature, default true) */
89
+ enableDrillThrough?: boolean;
86
90
  onCellClick?: (payload: {
87
91
  row: number;
88
92
  col: number;
@@ -108,8 +112,10 @@ interface DataGridProps {
108
112
  onAIConversationUpdate?: (payload: AIConversationUpdateEvent) => void;
109
113
  onAIQueryExecuted?: (payload: AIQueryExecutedEvent) => void;
110
114
  onAIError?: (payload: AIErrorEvent) => void;
115
+ onCollapseChange?: (collapsedPaths: string[]) => void;
116
+ onDrillThrough?: (result: DrillThroughResult) => void;
111
117
  }
112
- declare function DataGrid({ data, loading, fontSize: initialFontSize, showPivot, enableExport, enableSearch, enablePagination, pageSize, enableColumnResize, enableClipboard, theme, stripedRows, exportFilename, enableVerticalResize, initialHeight, minHeight, maxHeight, numberFormat, dateFormat, fieldRoleOverrides, aiAnalyst, onCellClick, onExport, onCopy, onAIDataLoaded, onAIConversationUpdate, onAIQueryExecuted, onAIError, }: DataGridProps): react_jsx_runtime.JSX.Element;
118
+ declare function DataGrid({ data, loading, fontSize: initialFontSize, showPivot, enableExport, enableSearch, enablePagination, pageSize, enableColumnResize, enableClipboard, theme, stripedRows, exportFilename, enableVerticalResize, initialHeight, minHeight, maxHeight, numberFormat, dateFormat, fieldRoleOverrides, aiAnalyst, enableDrillDown, enableDrillThrough, onCellClick, onExport, onCopy, onAIDataLoaded, onAIConversationUpdate, onAIQueryExecuted, onAIError, onCollapseChange, onDrillThrough, }: DataGridProps): react_jsx_runtime.JSX.Element;
113
119
 
114
120
  interface PivotConfigProps {
115
121
  availableFields: FieldStats[];
@@ -158,6 +164,8 @@ interface PivotSkeletonProps {
158
164
  activeFilters?: ActiveFilter[] | null;
159
165
  totalRowCount?: number;
160
166
  filteredRowCount?: number;
167
+ enableDrillDown?: boolean;
168
+ enableDrillThrough?: boolean;
161
169
  onAddRowField: (field: string) => void;
162
170
  onRemoveRowField: (field: string) => void;
163
171
  onAddColumnField: (field: string) => void;
@@ -167,9 +175,15 @@ interface PivotSkeletonProps {
167
175
  onUpdateAggregation: (field: string, oldAgg: AggregationFunction, newAgg: AggregationFunction) => void;
168
176
  onReorderRowFields: (fields: string[]) => void;
169
177
  onReorderColumnFields: (fields: string[]) => void;
178
+ onToggleCollapse?: (key: string, altKey: boolean) => void;
179
+ onDrillThroughCell?: (payload: {
180
+ rowPath: string[];
181
+ columnPath: string[];
182
+ valueFieldIndex: number;
183
+ }) => void;
170
184
  theme?: string;
171
185
  }
172
- declare function PivotSkeleton({ rowFields, columnFields, valueFields, calculatedFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, theme, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
186
+ declare function PivotSkeleton({ rowFields, columnFields, valueFields, calculatedFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, enableDrillDown, enableDrillThrough, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, onToggleCollapse, onDrillThroughCell, theme, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
173
187
 
174
188
  interface UseAIAnalystOptions {
175
189
  config: AIAnalystConfig;
@@ -355,6 +369,7 @@ interface UsePivotTableReturn {
355
369
  showRowTotals: boolean;
356
370
  showColumnTotals: boolean;
357
371
  calculatedFields: CalculatedField[];
372
+ collapsedPaths: Set<string>;
358
373
  availableFields: FieldStats[];
359
374
  unassignedFields: FieldStats[];
360
375
  isConfigured: boolean;
@@ -374,10 +389,11 @@ interface UsePivotTableReturn {
374
389
  setColumnFields: (fields: string[]) => void;
375
390
  addCalculatedField: (field: CalculatedField) => void;
376
391
  removeCalculatedField: (id: string) => void;
392
+ toggleCollapsedPath: (key: string, altKey: boolean, rowFields: string[], currentPivotResult: PivotResult | null) => Set<string>;
377
393
  }
378
394
  /**
379
395
  * Main pivot table hook
380
396
  */
381
- declare function usePivotTable(data: Record<string, unknown>[]): UsePivotTableReturn;
397
+ declare function usePivotTable(data: Record<string, unknown>[], enableDrillDown?: boolean): UsePivotTableReturn;
382
398
 
383
399
  export { AIAnalyst, ColumnFilter, DataGrid, PivotConfig, PivotSkeleton, type UseAIAnalystOptions, configureLicenseSecret, copyToClipboard, enableDemoMode, exportPivotToCSV, exportToCSV, formatSelectionForClipboard, setLicenseKey, useAIAnalyst, useColumnResize, useExcelGrid, useGlobalSearch, useLicense, usePagination, usePivotTable, useRowSelection };