@1771technologies/lytenyte-pro
Version:
Blazingly fast headless React data grid with 100s of features.
19 lines (18 loc) • 952 B
TypeScript
/**
* Adds ln__total rows at every dimension level (except the measure/leaf),
* plus ln__grand_total rows at the top level, for every distinct leaf.
*
* Rules:
* - Paths are split by "-->" (whitespace around segments is trimmed).
* - The last segment is treated as the "leaf" (e.g., measure name).
* - For every prefix group, we add a total row by replacing the next segment
* with ln__total and then appending the leaf.
* Example: A-->B-->C-->Leaf
* - A-->B-->ln__total-->Leaf (totals across C within A,B)
* - A-->ln__total-->Leaf (totals across B,C within A)
* - For each distinct leaf, we add ln__grand_total-->Leaf.
* - Output is ordered alphabetically (case-insensitive) within each group,
* with ln__total rows placed after non-total rows at the same grouping level,
* and ln__grand_total rows at the end.
*/
export declare function pivotPathsWithTotals(paths: string[], measures: string[]): string[];