@sukritt/pivot 0.1.0

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.
@@ -0,0 +1,101 @@
1
+ import { Aggregator } from '@sukritt/pivot-core';
2
+ import { BuiltInAggregator } from '@sukritt/pivot-core';
3
+ import { computePivot } from '@sukritt/pivot-core';
4
+ import { CSSProperties } from 'react';
5
+ import { CustomAggregator } from '@sukritt/pivot-core';
6
+ import { FilterCondition } from '@sukritt/pivot-core';
7
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
8
+ import { PivotCell } from '@sukritt/pivot-core';
9
+ import { PivotConfig } from '@sukritt/pivot-core';
10
+ import { PivotField } from '@sukritt/pivot-core';
11
+ import { PivotHeaderNode } from '@sukritt/pivot-core';
12
+ import { PivotResult } from '@sukritt/pivot-core';
13
+ import { ValueFieldConfig } from '@sukritt/pivot-core';
14
+
15
+ export { Aggregator }
16
+
17
+ export { BuiltInAggregator }
18
+
19
+ export { computePivot }
20
+
21
+ export { CustomAggregator }
22
+
23
+ export declare function exportPivotToCsv(result: PivotResult, fileName?: string): void;
24
+
25
+ export declare function exportPivotToExcel(result: PivotResult, fileName?: string): void;
26
+
27
+ export declare function FieldConfigPanel<TData extends Record<string, unknown>>({ data, fields, config, onConfigChange, }: FieldConfigPanelProps<TData>): JSX_2.Element;
28
+
29
+ declare interface FieldConfigPanelProps<TData> {
30
+ data: TData[];
31
+ fields: PivotField[];
32
+ config: PivotConfig<TData>;
33
+ onConfigChange: (next: PivotConfig<TData>) => void;
34
+ }
35
+
36
+ export { FilterCondition }
37
+
38
+ export { PivotCell }
39
+
40
+ export { PivotConfig }
41
+
42
+ export { PivotField }
43
+
44
+ export declare function PivotGrid({ result }: PivotGridProps): JSX_2.Element;
45
+
46
+ declare interface PivotGridProps {
47
+ result: PivotResult;
48
+ }
49
+
50
+ export { PivotHeaderNode }
51
+
52
+ export { PivotResult }
53
+
54
+ export declare const PivotTable: <TData extends Record<string, unknown> = Record<string, unknown>>(props: PivotTableProps<TData> & {
55
+ ref?: React.Ref<PivotTableRef>;
56
+ }) => ReturnType<typeof PivotTableInner>;
57
+
58
+ declare function PivotTableInner<TData extends Record<string, unknown>>(props: PivotTableProps<TData>, ref: React.Ref<PivotTableRef>): JSX_2.Element;
59
+
60
+ export declare interface PivotTableProps<TData extends Record<string, unknown> = Record<string, unknown>> {
61
+ data: TData[];
62
+ fields: PivotField[];
63
+ /** Initial config when uncontrolled */
64
+ defaultConfig?: Partial<PivotConfig<TData>>;
65
+ /** Controlled config — when set, component is fully controlled */
66
+ config?: PivotConfig<TData>;
67
+ onConfigChange?: (config: PivotConfig<TData>) => void;
68
+ customAggregators?: Record<string, CustomAggregator<TData>>;
69
+ /** Show the drag-and-drop sidebar */
70
+ enableFieldConfig?: boolean;
71
+ showRowTotals?: boolean;
72
+ showColumnTotals?: boolean;
73
+ showGrandTotal?: boolean;
74
+ height?: number | string;
75
+ className?: string;
76
+ style?: CSSProperties;
77
+ onPivotComputed?: (result: PivotResult<TData>) => void;
78
+ }
79
+
80
+ export declare interface PivotTableRef {
81
+ exportToCsv: (fileName?: string) => void;
82
+ exportToExcel: (fileName?: string) => void;
83
+ getConfig: () => PivotConfig;
84
+ getResult: () => PivotResult | null;
85
+ resetConfig: () => void;
86
+ }
87
+
88
+ /**
89
+ * Flatten a PivotResult into a 2D array suitable for XLSX.utils.aoa_to_sheet.
90
+ *
91
+ * Layout:
92
+ * - Top header rows: column tree (one row per level), each leaf header label
93
+ * - Last header row: value field name(s) per column leaf
94
+ * - Body rows: row tree expanded with row headers + cells
95
+ * - Optional totals rows
96
+ */
97
+ export declare function pivotToAOA(result: PivotResult): unknown[][];
98
+
99
+ export { ValueFieldConfig }
100
+
101
+ export { }