@affino/datagrid-pivot 0.1.1
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.
- package/LICENSE +21 -0
- package/README.md +36 -0
- package/dist/contracts.d.ts +32 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +1 -0
- package/dist/coreTypes.d.ts +163 -0
- package/dist/coreTypes.d.ts.map +1 -0
- package/dist/coreTypes.js +1 -0
- package/dist/drilldownContracts.d.ts +18 -0
- package/dist/drilldownContracts.d.ts.map +1 -0
- package/dist/drilldownContracts.js +1 -0
- package/dist/drilldownRuntime.d.ts +17 -0
- package/dist/drilldownRuntime.d.ts.map +1 -0
- package/dist/drilldownRuntime.js +103 -0
- package/dist/fieldRuntime.d.ts +8 -0
- package/dist/fieldRuntime.d.ts.map +1 -0
- package/dist/fieldRuntime.js +52 -0
- package/dist/helpers.d.ts +5 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +161 -0
- package/dist/incrementalHelpers.d.ts +23 -0
- package/dist/incrementalHelpers.d.ts.map +1 -0
- package/dist/incrementalHelpers.js +107 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/layoutContracts.d.ts +28 -0
- package/dist/layoutContracts.d.ts.map +1 -0
- package/dist/layoutContracts.js +1 -0
- package/dist/layoutRuntime.d.ts +9 -0
- package/dist/layoutRuntime.d.ts.map +1 -0
- package/dist/layoutRuntime.js +160 -0
- package/dist/runtimeContracts.d.ts +30 -0
- package/dist/runtimeContracts.d.ts.map +1 -0
- package/dist/runtimeContracts.js +1 -0
- package/dist/runtimeHelpers.d.ts +34 -0
- package/dist/runtimeHelpers.d.ts.map +1 -0
- package/dist/runtimeHelpers.js +105 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 affino
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# `@affino/datagrid-pivot`
|
|
2
|
+
|
|
3
|
+
Community pivot API boundary for Affino DataGrid.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
This package freezes the pivot-specific public boundary before first release.
|
|
8
|
+
|
|
9
|
+
Current state:
|
|
10
|
+
|
|
11
|
+
- community-safe pivot types and pure helper APIs live here
|
|
12
|
+
- low-level row-model orchestration and pivot runtime integration still live in `@affino/datagrid-core`
|
|
13
|
+
|
|
14
|
+
## Community surface
|
|
15
|
+
|
|
16
|
+
The package intentionally exposes the base pivot surface:
|
|
17
|
+
|
|
18
|
+
- pivot model/type contracts
|
|
19
|
+
- pivot drilldown contracts
|
|
20
|
+
- pivot layout snapshot contracts
|
|
21
|
+
- pivot spec normalization / cloning / equality helpers
|
|
22
|
+
|
|
23
|
+
## Planned enterprise surface
|
|
24
|
+
|
|
25
|
+
These are reserved as future enterprise candidates and are intentionally not split into public package entrypoints yet:
|
|
26
|
+
|
|
27
|
+
- premium high-cardinality pivot runtime tiers
|
|
28
|
+
- advanced incremental pivot patch strategies
|
|
29
|
+
- pivot profiler / diagnostics tooling
|
|
30
|
+
- premium pivot UX shells and runtime controls
|
|
31
|
+
- server-backed pivot acceleration and scaling layers
|
|
32
|
+
|
|
33
|
+
## Boundary rule
|
|
34
|
+
|
|
35
|
+
Use `@affino/datagrid-pivot` for pivot contracts and pure helper APIs.
|
|
36
|
+
Keep row-model orchestration and runtime integration inside `@affino/datagrid-core` until the next extraction phase.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type DataGridPivotColumnSubtotalPosition = "after" | "before";
|
|
2
|
+
export type DataGridPivotColumnGrandTotalPosition = "last" | "first";
|
|
3
|
+
export type DataGridAggOp = "sum" | "avg" | "min" | "max" | "count" | "countNonNull" | "first" | "last" | "custom";
|
|
4
|
+
export interface DataGridPivotValueSpec {
|
|
5
|
+
field: string;
|
|
6
|
+
agg: DataGridAggOp;
|
|
7
|
+
}
|
|
8
|
+
export interface DataGridPivotSpec {
|
|
9
|
+
rows: string[];
|
|
10
|
+
columns: string[];
|
|
11
|
+
values: DataGridPivotValueSpec[];
|
|
12
|
+
rowSubtotals?: boolean;
|
|
13
|
+
columnSubtotals?: boolean;
|
|
14
|
+
columnGrandTotal?: boolean;
|
|
15
|
+
columnSubtotalPosition?: DataGridPivotColumnSubtotalPosition;
|
|
16
|
+
columnGrandTotalPosition?: DataGridPivotColumnGrandTotalPosition;
|
|
17
|
+
grandTotal?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface DataGridPivotColumnPathSegment {
|
|
20
|
+
field: string;
|
|
21
|
+
value: string;
|
|
22
|
+
}
|
|
23
|
+
export interface DataGridPivotColumn {
|
|
24
|
+
id: string;
|
|
25
|
+
valueField: string;
|
|
26
|
+
agg: DataGridAggOp;
|
|
27
|
+
columnPath: readonly DataGridPivotColumnPathSegment[];
|
|
28
|
+
label: string;
|
|
29
|
+
subtotal?: boolean;
|
|
30
|
+
grandTotal?: boolean;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mCAAmC,GAAG,OAAO,GAAG,QAAQ,CAAA;AACpE,MAAM,MAAM,qCAAqC,GAAG,MAAM,GAAG,OAAO,CAAA;AAEpE,MAAM,MAAM,aAAa,GACrB,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,OAAO,GACP,cAAc,GACd,OAAO,GACP,MAAM,GACN,QAAQ,CAAA;AAEZ,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,aAAa,CAAA;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,EAAE,sBAAsB,EAAE,CAAA;IAChC,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,sBAAsB,CAAC,EAAE,mCAAmC,CAAA;IAC5D,wBAAwB,CAAC,EAAE,qCAAqC,CAAA;IAChE,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,aAAa,CAAA;IAClB,UAAU,EAAE,SAAS,8BAA8B,EAAE,CAAA;IACrD,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type { DataGridAggOp } from "./contracts.js";
|
|
2
|
+
export type DataGridRowId = string | number;
|
|
3
|
+
export type DataGridSortDirection = "asc" | "desc";
|
|
4
|
+
export interface DataGridSortState {
|
|
5
|
+
key: string;
|
|
6
|
+
field?: string;
|
|
7
|
+
dependencyFields?: readonly string[];
|
|
8
|
+
direction: DataGridSortDirection;
|
|
9
|
+
}
|
|
10
|
+
export interface DataGridFilterClause {
|
|
11
|
+
operator: string;
|
|
12
|
+
value: unknown;
|
|
13
|
+
value2?: unknown;
|
|
14
|
+
join?: "and" | "or";
|
|
15
|
+
}
|
|
16
|
+
export interface DataGridAdvancedFilter {
|
|
17
|
+
type: "text" | "number" | "date" | "set";
|
|
18
|
+
clauses: DataGridFilterClause[];
|
|
19
|
+
}
|
|
20
|
+
export type DataGridAdvancedFilterConditionType = "text" | "number" | "date" | "set" | "boolean";
|
|
21
|
+
export interface DataGridAdvancedFilterCondition {
|
|
22
|
+
kind: "condition";
|
|
23
|
+
key: string;
|
|
24
|
+
field?: string;
|
|
25
|
+
type?: DataGridAdvancedFilterConditionType;
|
|
26
|
+
operator: string;
|
|
27
|
+
value?: unknown;
|
|
28
|
+
value2?: unknown;
|
|
29
|
+
}
|
|
30
|
+
export interface DataGridAdvancedFilterGroup {
|
|
31
|
+
kind: "group";
|
|
32
|
+
operator: "and" | "or";
|
|
33
|
+
children: DataGridAdvancedFilterExpression[];
|
|
34
|
+
}
|
|
35
|
+
export interface DataGridAdvancedFilterNot {
|
|
36
|
+
kind: "not";
|
|
37
|
+
child: DataGridAdvancedFilterExpression;
|
|
38
|
+
}
|
|
39
|
+
export type DataGridAdvancedFilterExpression = DataGridAdvancedFilterCondition | DataGridAdvancedFilterGroup | DataGridAdvancedFilterNot;
|
|
40
|
+
export interface DataGridColumnValueSetFilter {
|
|
41
|
+
kind: "valueSet";
|
|
42
|
+
tokens: string[];
|
|
43
|
+
}
|
|
44
|
+
export type DataGridColumnPredicateOperator = "contains" | "startsWith" | "endsWith" | "equals" | "notEquals" | "gt" | "gte" | "lt" | "lte" | "between" | "isEmpty" | "notEmpty" | "isNull" | "notNull";
|
|
45
|
+
export interface DataGridColumnPredicateFilter {
|
|
46
|
+
kind: "predicate";
|
|
47
|
+
operator: DataGridColumnPredicateOperator;
|
|
48
|
+
value?: unknown;
|
|
49
|
+
value2?: unknown;
|
|
50
|
+
caseSensitive?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export type DataGridColumnFilter = DataGridColumnValueSetFilter | DataGridColumnPredicateFilter;
|
|
53
|
+
export type DataGridColumnFilterSnapshotEntry = DataGridColumnFilter;
|
|
54
|
+
export interface DataGridFilterSnapshot {
|
|
55
|
+
columnFilters: Record<string, DataGridColumnFilterSnapshotEntry>;
|
|
56
|
+
advancedFilters: Record<string, DataGridAdvancedFilter>;
|
|
57
|
+
advancedExpression?: DataGridAdvancedFilterExpression | null;
|
|
58
|
+
}
|
|
59
|
+
export interface DataGridSortAndFilterModelInput {
|
|
60
|
+
sortModel: readonly DataGridSortState[];
|
|
61
|
+
filterModel: DataGridFilterSnapshot | null;
|
|
62
|
+
}
|
|
63
|
+
export interface DataGridGroupBySpec {
|
|
64
|
+
fields: string[];
|
|
65
|
+
expandedByDefault?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface DataGridGroupExpansionSnapshot {
|
|
68
|
+
expandedByDefault: boolean;
|
|
69
|
+
toggledGroupKeys: readonly string[];
|
|
70
|
+
}
|
|
71
|
+
export type DataGridColumnPin = "left" | "right" | "none";
|
|
72
|
+
type DataGridAggregationStateHandler<TState, TArgs extends readonly unknown[] = readonly [], TResult = void> = {
|
|
73
|
+
bivarianceHack(state: TState, ...args: TArgs): TResult;
|
|
74
|
+
}["bivarianceHack"];
|
|
75
|
+
export interface DataGridAggregationColumnSpec<T = unknown, TState = unknown> {
|
|
76
|
+
key: string;
|
|
77
|
+
field?: string;
|
|
78
|
+
op: DataGridAggOp;
|
|
79
|
+
createState?: () => TState;
|
|
80
|
+
add?: DataGridAggregationStateHandler<TState, [value: unknown, row: DataGridRowNode<T>]>;
|
|
81
|
+
merge?: DataGridAggregationStateHandler<TState, [childState: TState]>;
|
|
82
|
+
remove?: DataGridAggregationStateHandler<TState, [value: unknown, row: DataGridRowNode<T>]>;
|
|
83
|
+
finalize?: DataGridAggregationStateHandler<TState, [], unknown>;
|
|
84
|
+
coerce?: (value: unknown) => number | string | null;
|
|
85
|
+
}
|
|
86
|
+
export type DataGridAggregationColumnSpecAnyState<T = unknown> = DataGridAggregationColumnSpec<T, unknown>;
|
|
87
|
+
export interface DataGridAggregationModel<T = unknown> {
|
|
88
|
+
columns: readonly DataGridAggregationColumnSpecAnyState<T>[];
|
|
89
|
+
basis?: "filtered" | "source";
|
|
90
|
+
}
|
|
91
|
+
export type DataGridAggregationFieldReader<T = unknown> = (rowNode: DataGridRowNode<T>, key: string, field: string) => unknown;
|
|
92
|
+
export type DataGridIncrementalAggregationLeafContribution = Record<string, unknown>;
|
|
93
|
+
export type DataGridRowKind = "leaf" | "group";
|
|
94
|
+
export type DataGridRowPinState = "none" | "top" | "bottom";
|
|
95
|
+
export interface DataGridRowGroupMeta {
|
|
96
|
+
groupKey: string;
|
|
97
|
+
groupField: string;
|
|
98
|
+
groupValue: string;
|
|
99
|
+
level: number;
|
|
100
|
+
childrenCount: number;
|
|
101
|
+
aggregates?: Record<string, unknown>;
|
|
102
|
+
}
|
|
103
|
+
export interface DataGridRowNodeState {
|
|
104
|
+
selected: boolean;
|
|
105
|
+
group: boolean;
|
|
106
|
+
pinned: DataGridRowPinState;
|
|
107
|
+
expanded: boolean;
|
|
108
|
+
}
|
|
109
|
+
export interface DataGridRowNode<T = unknown> {
|
|
110
|
+
kind: DataGridRowKind;
|
|
111
|
+
data: T;
|
|
112
|
+
row: T;
|
|
113
|
+
rowKey: DataGridRowId;
|
|
114
|
+
rowId: DataGridRowId;
|
|
115
|
+
sourceIndex: number;
|
|
116
|
+
originalIndex: number;
|
|
117
|
+
displayIndex: number;
|
|
118
|
+
state: DataGridRowNodeState;
|
|
119
|
+
groupMeta?: DataGridRowGroupMeta;
|
|
120
|
+
}
|
|
121
|
+
export interface DataGridPivotLayoutColumnModelColumnSnapshot {
|
|
122
|
+
key: string;
|
|
123
|
+
visible: boolean;
|
|
124
|
+
width: number | null;
|
|
125
|
+
pin: DataGridColumnPin;
|
|
126
|
+
}
|
|
127
|
+
export interface DataGridPivotLayoutColumnModelSnapshot {
|
|
128
|
+
columns: readonly DataGridPivotLayoutColumnModelColumnSnapshot[];
|
|
129
|
+
order: readonly string[];
|
|
130
|
+
}
|
|
131
|
+
export interface DataGridPivotLayoutColumnModel {
|
|
132
|
+
getSnapshot(): DataGridPivotLayoutColumnModelSnapshot;
|
|
133
|
+
batch?<TResult>(fn: () => TResult): TResult;
|
|
134
|
+
setColumnOrder(order: readonly string[]): void;
|
|
135
|
+
setColumnVisibility(key: string, visible: boolean): void;
|
|
136
|
+
setColumnWidth(key: string, width: number | null): void;
|
|
137
|
+
setColumnPin(key: string, pin: DataGridColumnPin): void;
|
|
138
|
+
}
|
|
139
|
+
export interface DataGridPivotLayoutRowModelSnapshot {
|
|
140
|
+
rowCount: number;
|
|
141
|
+
sortModel: readonly DataGridSortState[];
|
|
142
|
+
filterModel: DataGridFilterSnapshot | null;
|
|
143
|
+
groupBy: DataGridGroupBySpec | null;
|
|
144
|
+
groupExpansion: DataGridGroupExpansionSnapshot | null;
|
|
145
|
+
pivotColumns?: readonly import("./contracts.js").DataGridPivotColumn[];
|
|
146
|
+
}
|
|
147
|
+
export interface DataGridPivotLayoutRowModel<TRow = unknown> {
|
|
148
|
+
getSnapshot(): DataGridPivotLayoutRowModelSnapshot;
|
|
149
|
+
getPivotModel(): import("./contracts.js").DataGridPivotSpec | null;
|
|
150
|
+
getAggregationModel(): DataGridAggregationModel<TRow> | null;
|
|
151
|
+
getRowsInRange(range: {
|
|
152
|
+
start: number;
|
|
153
|
+
end: number;
|
|
154
|
+
}): readonly DataGridRowNode<TRow>[];
|
|
155
|
+
setFilterModel(filterModel: DataGridFilterSnapshot | null): void;
|
|
156
|
+
setSortModel(sortModel: readonly DataGridSortState[]): void;
|
|
157
|
+
setGroupBy(groupBy: DataGridGroupBySpec | null): void;
|
|
158
|
+
setPivotModel(pivotModel: import("./contracts.js").DataGridPivotSpec | null): void;
|
|
159
|
+
setAggregationModel(aggregationModel: DataGridAggregationModel<TRow> | null): void;
|
|
160
|
+
setGroupExpansion(groupExpansion: DataGridGroupExpansionSnapshot | null): void;
|
|
161
|
+
}
|
|
162
|
+
export {};
|
|
163
|
+
//# sourceMappingURL=coreTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coreTypes.d.ts","sourceRoot":"","sources":["../src/coreTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,CAAA;AAE3C,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,MAAM,CAAA;AAElD,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC,SAAS,EAAE,qBAAqB,CAAA;CACjC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,CAAC,EAAE,OAAO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gBAAgB,EAAE,iBAAiB,GAAG,IAAI,GAAG,IAAI,CAAA;IAClF,mBAAmB,CAAC,gBAAgB,EAAE,wBAAwB,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;IAClF,iBAAiB,CAAC,cAAc,EAAE,8BAA8B,GAAG,IAAI,GAAG,IAAI,CAAA;CAC/E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DataGridAggOp } from "./contracts.js";
|
|
2
|
+
import type { DataGridRowId, DataGridRowNode } from "./coreTypes.js";
|
|
3
|
+
export interface DataGridPivotCellDrilldownInput {
|
|
4
|
+
rowId: DataGridRowId;
|
|
5
|
+
columnId: string;
|
|
6
|
+
limit?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface DataGridPivotCellDrilldown<T = unknown> {
|
|
9
|
+
rowId: DataGridRowId;
|
|
10
|
+
columnId: string;
|
|
11
|
+
valueField: string;
|
|
12
|
+
agg: DataGridAggOp;
|
|
13
|
+
cellValue: unknown;
|
|
14
|
+
matchCount: number;
|
|
15
|
+
truncated: boolean;
|
|
16
|
+
rows: readonly DataGridRowNode<T>[];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=drilldownContracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drilldownContracts.d.ts","sourceRoot":"","sources":["../src/drilldownContracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAChB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,aAAa,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,0BAA0B,CAAC,CAAC,GAAG,OAAO;IACrD,KAAK,EAAE,aAAa,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,aAAa,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,IAAI,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAA;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DataGridPivotCellDrilldown, DataGridPivotCellDrilldownInput } from "./drilldownContracts.js";
|
|
2
|
+
import type { DataGridPivotColumn, DataGridPivotSpec } from "./contracts.js";
|
|
3
|
+
import type { DataGridRowId, DataGridRowNode } from "./coreTypes.js";
|
|
4
|
+
export interface ResolvePivotCellDrilldownInput<T> {
|
|
5
|
+
input: DataGridPivotCellDrilldownInput;
|
|
6
|
+
pivotModel: DataGridPivotSpec | null;
|
|
7
|
+
pivotColumns: readonly DataGridPivotColumn[];
|
|
8
|
+
aggregatedRowsProjection: readonly DataGridRowNode<T>[];
|
|
9
|
+
pivotedRowsProjection: readonly DataGridRowNode<T>[];
|
|
10
|
+
groupedRowsProjection: readonly DataGridRowNode<T>[];
|
|
11
|
+
sourceRows: readonly DataGridRowNode<T>[];
|
|
12
|
+
isDataGridRowId: (value: unknown) => value is DataGridRowId;
|
|
13
|
+
normalizePivotAxisValue: (value: unknown) => string;
|
|
14
|
+
readRowField: (row: DataGridRowNode<T>, key: string) => unknown;
|
|
15
|
+
}
|
|
16
|
+
export declare function resolvePivotCellDrilldown<T>(context: ResolvePivotCellDrilldownInput<T>): DataGridPivotCellDrilldown<T> | null;
|
|
17
|
+
//# sourceMappingURL=drilldownRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drilldownRuntime.d.ts","sourceRoot":"","sources":["../src/drilldownRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,+BAA+B,EAChC,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAChB,MAAM,gBAAgB,CAAA;AA6CvB,MAAM,WAAW,8BAA8B,CAAC,CAAC;IAC/C,KAAK,EAAE,+BAA+B,CAAA;IACtC,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACpC,YAAY,EAAE,SAAS,mBAAmB,EAAE,CAAA;IAC5C,wBAAwB,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAA;IACvD,qBAAqB,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAA;IACpD,qBAAqB,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAA;IACpD,UAAU,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAA;IACzC,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,aAAa,CAAA;IAC3D,uBAAuB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAA;IACnD,YAAY,EAAE,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAA;CAChE;AAED,wBAAgB,yBAAyB,CAAC,CAAC,EACzC,OAAO,EAAE,8BAA8B,CAAC,CAAC,CAAC,GACzC,0BAA0B,CAAC,CAAC,CAAC,GAAG,IAAI,CAwFtC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
function resolvePivotDrilldownRowConstraints(row, rowFields, normalizePivotAxisValue, readRowField) {
|
|
2
|
+
var _a, _b;
|
|
3
|
+
if (String(row.rowId) === "pivot:grand-total") {
|
|
4
|
+
return [];
|
|
5
|
+
}
|
|
6
|
+
const constraints = [];
|
|
7
|
+
if (row.kind === "group") {
|
|
8
|
+
const depth = Math.max(1, Math.min(rowFields.length, Math.trunc(((_b = (_a = row.groupMeta) === null || _a === void 0 ? void 0 : _a.level) !== null && _b !== void 0 ? _b : 0) + 1)));
|
|
9
|
+
for (let index = 0; index < depth; index += 1) {
|
|
10
|
+
const field = rowFields[index];
|
|
11
|
+
if (!field) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
constraints.push({
|
|
15
|
+
field,
|
|
16
|
+
value: normalizePivotAxisValue(readRowField(row, field)),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return constraints;
|
|
20
|
+
}
|
|
21
|
+
for (const field of rowFields) {
|
|
22
|
+
const normalizedValue = normalizePivotAxisValue(readRowField(row, field));
|
|
23
|
+
if (normalizedValue === "Subtotal" || normalizedValue === "Grand Total") {
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
constraints.push({
|
|
27
|
+
field,
|
|
28
|
+
value: normalizedValue,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return constraints;
|
|
32
|
+
}
|
|
33
|
+
export function resolvePivotCellDrilldown(context) {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
const { input, pivotModel, pivotColumns, aggregatedRowsProjection, pivotedRowsProjection, groupedRowsProjection, sourceRows, isDataGridRowId, normalizePivotAxisValue, readRowField, } = context;
|
|
36
|
+
if (!pivotModel || !Array.isArray(pivotColumns) || pivotColumns.length === 0) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
if (!isDataGridRowId(input === null || input === void 0 ? void 0 : input.rowId)) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const columnId = typeof input.columnId === "string" ? input.columnId.trim() : "";
|
|
43
|
+
if (columnId.length === 0) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const pivotColumn = pivotColumns.find(column => column.id === columnId);
|
|
47
|
+
if (!pivotColumn) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const pivotRow = (_b = (_a = aggregatedRowsProjection.find(row => row.rowId === input.rowId)) !== null && _a !== void 0 ? _a : pivotedRowsProjection.find(row => row.rowId === input.rowId)) !== null && _b !== void 0 ? _b : groupedRowsProjection.find(row => row.rowId === input.rowId);
|
|
51
|
+
if (!pivotRow) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const normalizedLimit = Number.isFinite(input.limit)
|
|
55
|
+
? Math.max(1, Math.min(5000, Math.trunc(input.limit)))
|
|
56
|
+
: 200;
|
|
57
|
+
const rowConstraints = resolvePivotDrilldownRowConstraints(pivotRow, pivotModel.rows, normalizePivotAxisValue, readRowField);
|
|
58
|
+
const columnConstraints = pivotColumn.columnPath.map((segment) => ({
|
|
59
|
+
field: segment.field,
|
|
60
|
+
value: segment.value,
|
|
61
|
+
}));
|
|
62
|
+
const matches = [];
|
|
63
|
+
let matchCount = 0;
|
|
64
|
+
for (const sourceRow of sourceRows) {
|
|
65
|
+
if (sourceRow.kind !== "leaf") {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
let rowMatches = true;
|
|
69
|
+
for (const constraint of rowConstraints) {
|
|
70
|
+
if (normalizePivotAxisValue(readRowField(sourceRow, constraint.field)) !== constraint.value) {
|
|
71
|
+
rowMatches = false;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (!rowMatches) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
let columnMatches = true;
|
|
79
|
+
for (const constraint of columnConstraints) {
|
|
80
|
+
if (normalizePivotAxisValue(readRowField(sourceRow, constraint.field)) !== constraint.value) {
|
|
81
|
+
columnMatches = false;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (!columnMatches) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
matchCount += 1;
|
|
89
|
+
if (matches.length < normalizedLimit) {
|
|
90
|
+
matches.push(sourceRow);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
rowId: input.rowId,
|
|
95
|
+
columnId,
|
|
96
|
+
valueField: pivotColumn.valueField,
|
|
97
|
+
agg: pivotColumn.agg,
|
|
98
|
+
cellValue: readRowField(pivotRow, columnId),
|
|
99
|
+
matchCount,
|
|
100
|
+
truncated: matchCount > matches.length,
|
|
101
|
+
rows: matches,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DataGridAggregationFieldReader, DataGridRowNode } from "./coreTypes.js";
|
|
2
|
+
export interface DataGridPivotFieldResolver<T> {
|
|
3
|
+
field: string;
|
|
4
|
+
read: (rowNode: DataGridRowNode<T>) => unknown;
|
|
5
|
+
}
|
|
6
|
+
export declare function readPivotValueByPathSegments(value: unknown, segments: readonly string[]): unknown;
|
|
7
|
+
export declare function createPivotFieldResolver<T>(field: string, readRowField?: DataGridAggregationFieldReader<T>): DataGridPivotFieldResolver<T> | null;
|
|
8
|
+
//# sourceMappingURL=fieldRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldRuntime.d.ts","sourceRoot":"","sources":["../src/fieldRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8BAA8B,EAC9B,eAAe,EAChB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,WAAW,0BAA0B,CAAC,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,OAAO,CAAA;CAC/C;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,OAAO,CAoBT;AAED,wBAAgB,wBAAwB,CAAC,CAAC,EACxC,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,8BAA8B,CAAC,CAAC,CAAC,GAC/C,0BAA0B,CAAC,CAAC,CAAC,GAAG,IAAI,CA8BtC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export function readPivotValueByPathSegments(value, segments) {
|
|
2
|
+
if (segments.length === 0 || typeof value !== "object" || value === null) {
|
|
3
|
+
return undefined;
|
|
4
|
+
}
|
|
5
|
+
let current = value;
|
|
6
|
+
for (const segment of segments) {
|
|
7
|
+
if (Array.isArray(current)) {
|
|
8
|
+
const index = Number(segment);
|
|
9
|
+
if (!Number.isInteger(index) || index < 0 || index >= current.length) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
current = current[index];
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
if (typeof current !== "object" || current === null || !(segment in current)) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
current = current[segment];
|
|
19
|
+
}
|
|
20
|
+
return current;
|
|
21
|
+
}
|
|
22
|
+
export function createPivotFieldResolver(field, readRowField) {
|
|
23
|
+
const normalizedField = field.trim();
|
|
24
|
+
if (normalizedField.length === 0) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (typeof readRowField === "function") {
|
|
28
|
+
return {
|
|
29
|
+
field: normalizedField,
|
|
30
|
+
read: (rowNode) => readRowField(rowNode, normalizedField, normalizedField),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const segments = normalizedField.includes(".")
|
|
34
|
+
? normalizedField.split(".").filter(Boolean)
|
|
35
|
+
: [];
|
|
36
|
+
return {
|
|
37
|
+
field: normalizedField,
|
|
38
|
+
read: (rowNode) => {
|
|
39
|
+
const source = rowNode.data;
|
|
40
|
+
const directValue = typeof source === "object" && source !== null
|
|
41
|
+
? source[normalizedField]
|
|
42
|
+
: undefined;
|
|
43
|
+
if (typeof directValue !== "undefined") {
|
|
44
|
+
return directValue;
|
|
45
|
+
}
|
|
46
|
+
if (segments.length === 0) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
return readPivotValueByPathSegments(source, segments);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DataGridPivotSpec } from "./contracts.js";
|
|
2
|
+
export declare function normalizePivotSpec(pivotSpec: DataGridPivotSpec | null | undefined): DataGridPivotSpec | null;
|
|
3
|
+
export declare function clonePivotSpec(pivotSpec: DataGridPivotSpec | null | undefined): DataGridPivotSpec | null;
|
|
4
|
+
export declare function isSamePivotSpec(left: DataGridPivotSpec | null | undefined, right: DataGridPivotSpec | null | undefined): boolean;
|
|
5
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,gBAAgB,CAAA;AAkCvB,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAC9C,iBAAiB,GAAG,IAAI,CAyD1B;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAC9C,iBAAiB,GAAG,IAAI,CAoB1B;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,EAC1C,KAAK,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAyDT"}
|