import { ReactNode } from 'react'; import { TableTokenType } from '../dataTable.tokens'; import { ColumnDefinition, PivotAggregationType } from '../types'; import { PivotModalStyleTokens } from './pivotModalStyleTokens'; export type PivotValueConfig> = { field: keyof T; aggregation: PivotAggregationType; }; export type PivotTableConfig> = { rows: Array; columns: Array; values: PivotValueConfig[]; }; export type PivotTableModalProps> = { isOpen: boolean; onClose: () => void; data: T[]; columns: ColumnDefinition[]; title?: string; description?: string; showExport?: boolean; initialConfig?: Partial>; previewColumns?: PivotPreviewColumn[]; previewRows?: PivotPreviewRow[]; onConfigChange?: (config: PivotTableConfig) => void; onExport?: (config: PivotTableConfig) => void; trigger?: ReactNode; /** * Callback when trigger is clicked. Use this to open the modal. */ onTriggerClick?: () => void; /** * Configure which aggregation operations are available in the Values section. * If not provided, all operations will be shown. * @example ['sum', 'count', 'average'] // Show only sum, count, and average */ availableAggregations?: PivotAggregationType[]; }; export type PivotPreviewColumn = { key: string; label: string; }; export type PivotPreviewRow = Record & { __pivotId: string; __pivotRowType?: 'data' | 'subtotal' | 'grand_total'; }; export type PivotPreviewPanelProps = { pivot: PivotModalStyleTokens; tableToken: TableTokenType; showExport: boolean; previewRows?: PivotPreviewRow[]; previewColumns?: PivotPreviewColumn[]; previewTableColumns: ColumnDefinition>[]; onExport: () => void; hasValues: boolean; }; export type PivotFieldConfig = { field: string; showTotal: boolean; aggregation?: PivotAggregationType; header?: string; };