@smallwebco/tinypivot-react 1.0.53 → 1.0.54

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,26 @@
1
- import { ColumnStats, NumericRange, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, PivotExportData, ExportOptions, SelectionBounds, PaginationOptions, LicenseInfo } from '@smallwebco/tinypivot-core';
2
- 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';
3
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as _smallwebco_tinypivot_core from '@smallwebco/tinypivot-core';
3
+ import { AIAnalystConfig, AIDataLoadedEvent, AIConversationUpdateEvent, AIQueryExecutedEvent, AIErrorEvent, ColumnStats, NumericRange, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, AIConversation, AITableSchema, AIDataSource, PivotExportData, ExportOptions, SelectionBounds, PaginationOptions, LicenseInfo } from '@smallwebco/tinypivot-core';
4
+ 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';
4
5
  import * as react from 'react';
5
6
  import react__default from 'react';
6
7
  import * as _tanstack_react_table from '@tanstack/react-table';
7
8
  import { SortingState, ColumnFiltersState, VisibilityState } from '@tanstack/react-table';
8
9
 
10
+ interface AIAnalystProps {
11
+ config: AIAnalystConfig;
12
+ theme?: 'light' | 'dark';
13
+ onDataLoaded?: (payload: AIDataLoadedEvent) => void;
14
+ onConversationUpdate?: (payload: AIConversationUpdateEvent) => void;
15
+ onQueryExecuted?: (payload: AIQueryExecutedEvent) => void;
16
+ onError?: (payload: AIErrorEvent) => void;
17
+ onViewResults?: (payload: {
18
+ data: Record<string, unknown>[];
19
+ query: string;
20
+ }) => void;
21
+ }
22
+ declare function AIAnalyst({ config, theme, onDataLoaded, onConversationUpdate, onQueryExecuted, onError, onViewResults, }: AIAnalystProps): react_jsx_runtime.JSX.Element;
23
+
9
24
  interface ColumnFilterProps {
10
25
  columnId: string;
11
26
  columnName: string;
@@ -42,6 +57,8 @@ interface DataGridProps {
42
57
  initialHeight?: number;
43
58
  minHeight?: number;
44
59
  maxHeight?: number;
60
+ /** AI Data Analyst configuration (Pro feature, disabled by default) */
61
+ aiAnalyst?: AIAnalystConfig;
45
62
  onCellClick?: (payload: {
46
63
  row: number;
47
64
  col: number;
@@ -63,8 +80,12 @@ interface DataGridProps {
63
80
  text: string;
64
81
  cellCount: number;
65
82
  }) => void;
83
+ onAIDataLoaded?: (payload: AIDataLoadedEvent) => void;
84
+ onAIConversationUpdate?: (payload: AIConversationUpdateEvent) => void;
85
+ onAIQueryExecuted?: (payload: AIQueryExecutedEvent) => void;
86
+ onAIError?: (payload: AIErrorEvent) => void;
66
87
  }
67
- declare function DataGrid({ data, loading, fontSize: initialFontSize, showPivot, enableExport, enableSearch, enablePagination, pageSize, enableColumnResize, enableClipboard, theme, stripedRows, exportFilename, enableVerticalResize, initialHeight, minHeight, maxHeight, onCellClick, onExport, onCopy, }: DataGridProps): react_jsx_runtime.JSX.Element;
88
+ declare function DataGrid({ data, loading, fontSize: initialFontSize, showPivot, enableExport, enableSearch, enablePagination, pageSize, enableColumnResize, enableClipboard, theme, stripedRows, exportFilename, enableVerticalResize, initialHeight, minHeight, maxHeight, aiAnalyst, onCellClick, onExport, onCopy, onAIDataLoaded, onAIConversationUpdate, onAIQueryExecuted, onAIError, }: DataGridProps): react_jsx_runtime.JSX.Element;
68
89
 
69
90
  interface PivotConfigProps {
70
91
  availableFields: FieldStats[];
@@ -124,6 +145,35 @@ interface PivotSkeletonProps {
124
145
  }
125
146
  declare function PivotSkeleton({ rowFields, columnFields, valueFields, calculatedFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
126
147
 
148
+ interface UseAIAnalystOptions {
149
+ config: AIAnalystConfig;
150
+ onDataLoaded?: (event: AIDataLoadedEvent) => void;
151
+ onConversationUpdate?: (event: AIConversationUpdateEvent) => void;
152
+ onQueryExecuted?: (event: AIQueryExecutedEvent) => void;
153
+ onError?: (event: AIErrorEvent) => void;
154
+ }
155
+ declare function useAIAnalyst(options: UseAIAnalystOptions): {
156
+ conversation: AIConversation;
157
+ messages: _smallwebco_tinypivot_core.AIMessage[];
158
+ hasMessages: boolean;
159
+ schemas: Map<string, AITableSchema>;
160
+ isLoading: boolean;
161
+ isLoadingTables: boolean;
162
+ error: string | null;
163
+ lastLoadedData: Record<string, unknown>[] | null;
164
+ selectedDataSource: string | undefined;
165
+ selectedDataSourceInfo: AIDataSource | undefined;
166
+ /** Available data sources (either from config or auto-discovered) */
167
+ dataSources: AIDataSource[];
168
+ selectDataSource: (dataSourceId: string) => Promise<void>;
169
+ sendMessage: (content: string) => Promise<void>;
170
+ clearConversation: () => void;
171
+ exportConversation: () => AIConversation;
172
+ importConversation: (conv: AIConversation) => void;
173
+ /** Refresh table list from endpoint */
174
+ fetchTables: () => Promise<void>;
175
+ };
176
+
127
177
  interface ExcelGridOptions<T> {
128
178
  data: T[];
129
179
  columns?: string[];
@@ -255,6 +305,7 @@ declare function useLicense(): {
255
305
  canUseAdvancedAggregations: boolean;
256
306
  canUsePercentageMode: boolean;
257
307
  canUseCharts: boolean;
308
+ canUseAIAnalyst: boolean;
258
309
  showWatermark: boolean;
259
310
  requirePro: (feature: string) => boolean;
260
311
  };
@@ -291,4 +342,4 @@ interface UsePivotTableReturn {
291
342
  */
292
343
  declare function usePivotTable(data: Record<string, unknown>[]): UsePivotTableReturn;
293
344
 
294
- export { ColumnFilter, DataGrid, PivotConfig, PivotSkeleton, configureLicenseSecret, copyToClipboard, enableDemoMode, exportPivotToCSV, exportToCSV, formatSelectionForClipboard, setLicenseKey, useColumnResize, useExcelGrid, useGlobalSearch, useLicense, usePagination, usePivotTable, useRowSelection };
345
+ 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,11 +1,26 @@
1
- import { ColumnStats, NumericRange, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, PivotExportData, ExportOptions, SelectionBounds, PaginationOptions, LicenseInfo } from '@smallwebco/tinypivot-core';
2
- 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';
3
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as _smallwebco_tinypivot_core from '@smallwebco/tinypivot-core';
3
+ import { AIAnalystConfig, AIDataLoadedEvent, AIConversationUpdateEvent, AIQueryExecutedEvent, AIErrorEvent, ColumnStats, NumericRange, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, AIConversation, AITableSchema, AIDataSource, PivotExportData, ExportOptions, SelectionBounds, PaginationOptions, LicenseInfo } from '@smallwebco/tinypivot-core';
4
+ 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';
4
5
  import * as react from 'react';
5
6
  import react__default from 'react';
6
7
  import * as _tanstack_react_table from '@tanstack/react-table';
7
8
  import { SortingState, ColumnFiltersState, VisibilityState } from '@tanstack/react-table';
8
9
 
10
+ interface AIAnalystProps {
11
+ config: AIAnalystConfig;
12
+ theme?: 'light' | 'dark';
13
+ onDataLoaded?: (payload: AIDataLoadedEvent) => void;
14
+ onConversationUpdate?: (payload: AIConversationUpdateEvent) => void;
15
+ onQueryExecuted?: (payload: AIQueryExecutedEvent) => void;
16
+ onError?: (payload: AIErrorEvent) => void;
17
+ onViewResults?: (payload: {
18
+ data: Record<string, unknown>[];
19
+ query: string;
20
+ }) => void;
21
+ }
22
+ declare function AIAnalyst({ config, theme, onDataLoaded, onConversationUpdate, onQueryExecuted, onError, onViewResults, }: AIAnalystProps): react_jsx_runtime.JSX.Element;
23
+
9
24
  interface ColumnFilterProps {
10
25
  columnId: string;
11
26
  columnName: string;
@@ -42,6 +57,8 @@ interface DataGridProps {
42
57
  initialHeight?: number;
43
58
  minHeight?: number;
44
59
  maxHeight?: number;
60
+ /** AI Data Analyst configuration (Pro feature, disabled by default) */
61
+ aiAnalyst?: AIAnalystConfig;
45
62
  onCellClick?: (payload: {
46
63
  row: number;
47
64
  col: number;
@@ -63,8 +80,12 @@ interface DataGridProps {
63
80
  text: string;
64
81
  cellCount: number;
65
82
  }) => void;
83
+ onAIDataLoaded?: (payload: AIDataLoadedEvent) => void;
84
+ onAIConversationUpdate?: (payload: AIConversationUpdateEvent) => void;
85
+ onAIQueryExecuted?: (payload: AIQueryExecutedEvent) => void;
86
+ onAIError?: (payload: AIErrorEvent) => void;
66
87
  }
67
- declare function DataGrid({ data, loading, fontSize: initialFontSize, showPivot, enableExport, enableSearch, enablePagination, pageSize, enableColumnResize, enableClipboard, theme, stripedRows, exportFilename, enableVerticalResize, initialHeight, minHeight, maxHeight, onCellClick, onExport, onCopy, }: DataGridProps): react_jsx_runtime.JSX.Element;
88
+ declare function DataGrid({ data, loading, fontSize: initialFontSize, showPivot, enableExport, enableSearch, enablePagination, pageSize, enableColumnResize, enableClipboard, theme, stripedRows, exportFilename, enableVerticalResize, initialHeight, minHeight, maxHeight, aiAnalyst, onCellClick, onExport, onCopy, onAIDataLoaded, onAIConversationUpdate, onAIQueryExecuted, onAIError, }: DataGridProps): react_jsx_runtime.JSX.Element;
68
89
 
69
90
  interface PivotConfigProps {
70
91
  availableFields: FieldStats[];
@@ -124,6 +145,35 @@ interface PivotSkeletonProps {
124
145
  }
125
146
  declare function PivotSkeleton({ rowFields, columnFields, valueFields, calculatedFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
126
147
 
148
+ interface UseAIAnalystOptions {
149
+ config: AIAnalystConfig;
150
+ onDataLoaded?: (event: AIDataLoadedEvent) => void;
151
+ onConversationUpdate?: (event: AIConversationUpdateEvent) => void;
152
+ onQueryExecuted?: (event: AIQueryExecutedEvent) => void;
153
+ onError?: (event: AIErrorEvent) => void;
154
+ }
155
+ declare function useAIAnalyst(options: UseAIAnalystOptions): {
156
+ conversation: AIConversation;
157
+ messages: _smallwebco_tinypivot_core.AIMessage[];
158
+ hasMessages: boolean;
159
+ schemas: Map<string, AITableSchema>;
160
+ isLoading: boolean;
161
+ isLoadingTables: boolean;
162
+ error: string | null;
163
+ lastLoadedData: Record<string, unknown>[] | null;
164
+ selectedDataSource: string | undefined;
165
+ selectedDataSourceInfo: AIDataSource | undefined;
166
+ /** Available data sources (either from config or auto-discovered) */
167
+ dataSources: AIDataSource[];
168
+ selectDataSource: (dataSourceId: string) => Promise<void>;
169
+ sendMessage: (content: string) => Promise<void>;
170
+ clearConversation: () => void;
171
+ exportConversation: () => AIConversation;
172
+ importConversation: (conv: AIConversation) => void;
173
+ /** Refresh table list from endpoint */
174
+ fetchTables: () => Promise<void>;
175
+ };
176
+
127
177
  interface ExcelGridOptions<T> {
128
178
  data: T[];
129
179
  columns?: string[];
@@ -255,6 +305,7 @@ declare function useLicense(): {
255
305
  canUseAdvancedAggregations: boolean;
256
306
  canUsePercentageMode: boolean;
257
307
  canUseCharts: boolean;
308
+ canUseAIAnalyst: boolean;
258
309
  showWatermark: boolean;
259
310
  requirePro: (feature: string) => boolean;
260
311
  };
@@ -291,4 +342,4 @@ interface UsePivotTableReturn {
291
342
  */
292
343
  declare function usePivotTable(data: Record<string, unknown>[]): UsePivotTableReturn;
293
344
 
294
- export { ColumnFilter, DataGrid, PivotConfig, PivotSkeleton, configureLicenseSecret, copyToClipboard, enableDemoMode, exportPivotToCSV, exportToCSV, formatSelectionForClipboard, setLicenseKey, useColumnResize, useExcelGrid, useGlobalSearch, useLicense, usePagination, usePivotTable, useRowSelection };
345
+ export { AIAnalyst, ColumnFilter, DataGrid, PivotConfig, PivotSkeleton, type UseAIAnalystOptions, configureLicenseSecret, copyToClipboard, enableDemoMode, exportPivotToCSV, exportToCSV, formatSelectionForClipboard, setLicenseKey, useAIAnalyst, useColumnResize, useExcelGrid, useGlobalSearch, useLicense, usePagination, usePivotTable, useRowSelection };