@mindfiredigital/pivothead
Version:
PivotHead is a powerful and flexible library for creating interactive pivot tables in JavaScript applications. It provides a core engine for data manipulation and, in the future, will be compatible with wrappers for React, Vue, Svelte, and Angular, making
21 lines • 1.26 kB
TypeScript
import { GroupConfig, PivotTableConfig, SortConfig, ProcessedDataResult, DataRecord } from '../types/interfaces';
/**
* Processes raw pivot table data by applying optional sorting and grouping.
*
* Sorting is applied first (when a `sortConfig` is provided), then the sorted
* data is grouped according to `groupConfig`. If no grouping is specified the
* `groups` array in the result will be empty.
*
* @param config - The full pivot table configuration, including the raw `data` array.
* @param sortConfig - Optional single-field sort descriptor. Pass `null` to skip sorting.
* @param groupConfig - Optional grouping specification defining row/column fields and
* the grouper function used to derive a group key from each record.
* @returns A {@link ProcessedDataResult} containing the (possibly sorted) `rawData`
* array and the derived `groups` hierarchy.
*
* @example
* const result = processData(config, { field: 'sales', direction: 'desc', type: 'measure' });
* console.log(result.rawData); // sorted rows
*/
export declare function processData<T extends DataRecord>(config: PivotTableConfig<T>, sortConfig?: SortConfig | null, groupConfig?: GroupConfig | null): ProcessedDataResult<T>;
//# sourceMappingURL=dataProcessor.d.ts.map