import { BaseGridPlugin } from '../../core/plugin/base-plugin';
import { ColumnConfig, ToolPanelDefinition } from '../../core/types';
import { PivotDataRow } from './pivot-engine';
import { PivotConfig, PivotResult, PivotValueField } from './types';
/**
 * Pivot Table Plugin for tbw-grid
 *
 * Transforms flat data into a pivot table view with grouped rows, grouped columns,
 * and aggregated values. Includes an interactive tool panel for configuring
 * row groups, column groups, and value aggregations at runtime.
 *
 * ## Installation
 *
 * ```ts
 * import { PivotPlugin } from '@toolbox-web/grid/plugins/pivot';
 * ```
 *
 * ## Configuration Options
 *
 * | Option | Type | Default | Description |
 * |--------|------|---------|-------------|
 * | `active` | `boolean` | `true` | Whether pivot is active on load |
 * | `rowGroupFields` | `string[]` | `[]` | Fields for row grouping |
 * | `columnGroupFields` | `string[]` | `[]` | Fields for column grouping |
 * | `valueFields` | `ValueField[]` | `[]` | Aggregation value fields |
 * | `showTotals` | `boolean` | `true` | Show row subtotals |
 * | `showGrandTotal` | `boolean` | `true` | Show grand total row |
 * | `showToolPanel` | `boolean` | `true` | Show interactive pivot panel |
 * | `defaultExpanded` | `boolean` | `true` | Groups expanded by default |
 * | `indentWidth` | `number` | `20` | Indent per depth level (px) |
 * | `animation` | `false \| 'slide' \| 'fade'` | `'slide'` | Expand/collapse animation |
 *
 * ## Aggregation Functions
 *
 * `sum`, `avg`, `count`, `min`, `max`, `first`, `last`
 *
 * ## Programmatic API
 *
 * | Method | Signature | Description |
 * |--------|-----------|-------------|
 * | `expandGroup` | `(path: string[]) => void` | Expand a specific group |
 * | `collapseGroup` | `(path: string[]) => void` | Collapse a specific group |
 * | `expandAll` | `() => void` | Expand all groups |
 * | `collapseAll` | `() => void` | Collapse all groups |
 *
 * ## CSS Custom Properties
 *
 * | Property | Default | Description |
 * |----------|---------|-------------|
 * | `--tbw-pivot-group-bg` | `var(--tbw-color-row-alt)` | Group row background |
 * | `--tbw-pivot-grand-total-bg` | `var(--tbw-color-header-bg)` | Grand total row |
 *
 * @example Basic Pivot Table
 * ```ts
 * import '@toolbox-web/grid';
 * import { PivotPlugin } from '@toolbox-web/grid/plugins/pivot';
 *
 * grid.gridConfig = {
 *   columns: [...],
 *   plugins: [
 *     new PivotPlugin({
 *       rowGroupFields: ['region', 'product'],
 *       columnGroupFields: ['quarter'],
 *       valueFields: [{ field: 'sales', aggFunc: 'sum', header: 'Total' }],
 *     }),
 *   ],
 * };
 * ```
 *
 * @example Programmatic-Only (No Tool Panel)
 * ```ts
 * new PivotPlugin({
 *   showToolPanel: false,
 *   rowGroupFields: ['category'],
 *   valueFields: [{ field: 'amount', aggFunc: 'sum' }],
 * })
 * ```
 *
 * @see {@link PivotConfig} for all configuration options
 * @see {@link PivotValueField} for value field structure
 *
 * @internal Extends BaseGridPlugin
 */
export declare class PivotPlugin extends BaseGridPlugin<PivotConfig> {
    /** @internal */
    readonly name = "pivot";
    /** @internal */
    readonly styles: string;
    /** Tool panel ID for shell integration */
    static readonly PANEL_ID = "pivot";
    /** @internal */
    protected get defaultConfig(): Partial<PivotConfig>;
    private isActive;
    private hasInitialized;
    private pivotResult;
    private fieldHeaderMap;
    private expandedKeys;
    private defaultExpanded;
    /** Tracks whether user has manually interacted with expand/collapse */
    private userHasToggledExpand;
    private originalColumns;
    private panelContainer;
    private grandTotalFooter;
    private previousVisibleKeys;
    private keysToAnimate;
    /**
     * Check if the plugin has valid pivot configuration (at least value fields).
     */
    private hasValidPivotConfig;
    /**
     * Get expand/collapse animation style from plugin config.
     * Uses base class isAnimationEnabled to respect grid-level settings.
     */
    private get animationStyle();
    /** @internal */
    detach(): void;
    /** @internal */
    getToolPanel(): ToolPanelDefinition | undefined;
    /** @internal */
    processRows(rows: readonly unknown[]): PivotDataRow[];
    /** @internal */
    processColumns(columns: readonly ColumnConfig[]): ColumnConfig[];
    /** @internal */
    renderRow(row: Record<string, unknown>, rowEl: HTMLElement, rowIndex: number): boolean;
    /**
     * Remove pivot-specific classes, attributes, and inline styles from a row element.
     * Called when pivot mode is disabled to clean up reused DOM elements.
     * Clears innerHTML so the grid's default renderer can rebuild the row.
     */
    private cleanupPivotStyling;
    /** @internal */
    onKeyDown(event: KeyboardEvent): boolean | void;
    /** @internal */
    afterRender(): void;
    /**
     * Render the grand total row as a sticky footer pinned to the bottom.
     */
    private renderGrandTotalFooter;
    /**
     * Remove the grand total footer element.
     */
    private cleanupGrandTotalFooter;
    toggle(key: string): void;
    expand(key: string): void;
    collapse(key: string): void;
    expandAll(): void;
    collapseAll(): void;
    /**
     * Add all group keys from the current pivot result to expandedKeys.
     */
    private expandAllKeys;
    isExpanded(key: string): boolean;
    enablePivot(): void;
    disablePivot(): void;
    isPivotActive(): boolean;
    getPivotResult(): PivotResult | null;
    setRowGroupFields(fields: string[]): void;
    setColumnGroupFields(fields: string[]): void;
    setValueFields(fields: PivotValueField[]): void;
    refresh(): void;
    /**
     * Show the pivot tool panel.
     * Opens the tool panel and ensures this section is expanded.
     */
    showPanel(): void;
    /**
     * Hide the tool panel.
     */
    hidePanel(): void;
    /**
     * Toggle the pivot tool panel section.
     */
    togglePanel(): void;
    /**
     * Check if the pivot panel section is currently expanded.
     */
    isPanelVisible(): boolean;
    private get gridColumns();
    /**
     * Refresh pivot and update tool panel if active.
     */
    private refreshIfActive;
    private buildFieldHeaderMap;
    private getAvailableFields;
    private captureOriginalColumns;
    private renderPanel;
    private refreshPanel;
    private addFieldToZone;
    private removeFieldFromZone;
    private removeFromOtherZones;
    private addValueField;
    private removeValueField;
    private updateValueAggFunc;
}
//# sourceMappingURL=PivotPlugin.d.ts.map