@sheetxl/formulas-extended 0.8.0-beta.15 → 0.8.0-beta.16

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.
Files changed (51) hide show
  1. package/LICENSE.md +8 -7
  2. package/{node/esm/DcxpVQJ0VRPd3zNH.mjs → browser/esm/BJ47kZhvZcY3WJ_x.mjs} +2 -2
  3. package/{node/esm/B81c3QWvxdHun2T7.mjs → browser/esm/BPqpbST0XAzcTd47.mjs} +2 -2
  4. package/browser/esm/{WnWno64b5Kwzt5bq.mjs → BYyJ0pYzV4HBWwtf.mjs} +2 -2
  5. package/{node/esm/BAOKFei-3NUnKf2b.mjs → browser/esm/BnHZ6bpbcca91mUc.mjs} +2 -2
  6. package/{node/esm/BPITz297xS7JQJip.mjs → browser/esm/Bo0a8wLeBNS77kKI.mjs} +2 -2
  7. package/{node/esm/Cz08Pg4FLQyPOKHH.mjs → browser/esm/BvYYJ7tez-T3126d.mjs} +2 -2
  8. package/browser/esm/{DTTckRRsdT5hn6tw.mjs → BwQc507kfQ9ISaRS.mjs} +2 -2
  9. package/browser/esm/{va7h1_p7n3e5jFud.mjs → BzQQHgBArLhC8pMH.mjs} +2 -2
  10. package/browser/esm/{DzHBzc5ygBHUJz7Z.mjs → CNT-L1MTjxpZVXu3.mjs} +2 -2
  11. package/{node/esm/DWsUELCL7M8CJRse.mjs → browser/esm/CQuyzp4ribCibfU5.mjs} +2 -2
  12. package/browser/esm/{5e6JdlNsgYe10haf.mjs → CdXvNLQU3uP4xf8H.mjs} +2 -2
  13. package/browser/esm/{Bj-GG15t0G1x9-FU.mjs → D8lI4sL6G_iAKmXn.mjs} +2 -2
  14. package/browser/esm/{DQUpOqHLBRcR3jRL.mjs → DJ9NMU6rZ1D5ebi_.mjs} +2 -2
  15. package/{node/esm/D4qsZVifvY4HXGV4.mjs → browser/esm/DM96LY50uWuclm1m.mjs} +2 -2
  16. package/{node/esm/DIJcwREawbt_MeZK.mjs → browser/esm/DWbFa7pPvHt76LBY.mjs} +2 -2
  17. package/{node/esm/fuSCbGKaf-8luGWM.mjs → browser/esm/DeG2p0wft0dxcdAm.mjs} +2 -2
  18. package/{node/esm/Bxs5g9POZ28N8txg.mjs → browser/esm/Dpzo6YZEws6PLDBU.mjs} +2 -2
  19. package/browser/esm/{Cg8sxKWlH9hl9cmJ.mjs → Dr61Yvcv07Hahj2a.mjs} +2 -2
  20. package/{node/esm/Dq5qeAevZvlIBl1n.mjs → browser/esm/QXT04Whlz23Oe61A.mjs} +2 -2
  21. package/browser/esm/{vioImwvyYDFqRDUi.mjs → Xp4ZnPZstNpn35OG.mjs} +2 -2
  22. package/browser/esm/{CHCYcEKjePbdBT6S.mjs → _2bUDcLtpT--sYHK.mjs} +2 -2
  23. package/browser/esm/declarations.mjs +3 -3
  24. package/browser/esm/index.mjs +290 -329
  25. package/browser/esm/{C1A2QXvN2v2G6tUy.mjs → yhUQT3uppl3LibCl.mjs} +2 -2
  26. package/{browser/esm/DcxpVQJ0VRPd3zNH.mjs → node/esm/BJ47kZhvZcY3WJ_x.mjs} +2 -2
  27. package/{browser/esm/B81c3QWvxdHun2T7.mjs → node/esm/BPqpbST0XAzcTd47.mjs} +2 -2
  28. package/node/esm/{WnWno64b5Kwzt5bq.mjs → BYyJ0pYzV4HBWwtf.mjs} +2 -2
  29. package/{browser/esm/BAOKFei-3NUnKf2b.mjs → node/esm/BnHZ6bpbcca91mUc.mjs} +2 -2
  30. package/{browser/esm/BPITz297xS7JQJip.mjs → node/esm/Bo0a8wLeBNS77kKI.mjs} +2 -2
  31. package/{browser/esm/Cz08Pg4FLQyPOKHH.mjs → node/esm/BvYYJ7tez-T3126d.mjs} +2 -2
  32. package/node/esm/{va7h1_p7n3e5jFud.mjs → BzQQHgBArLhC8pMH.mjs} +2 -2
  33. package/node/esm/{DzHBzc5ygBHUJz7Z.mjs → CNT-L1MTjxpZVXu3.mjs} +2 -2
  34. package/{browser/esm/DWsUELCL7M8CJRse.mjs → node/esm/CQuyzp4ribCibfU5.mjs} +2 -2
  35. package/node/esm/{5e6JdlNsgYe10haf.mjs → CdXvNLQU3uP4xf8H.mjs} +2 -2
  36. package/node/esm/{Bj-GG15t0G1x9-FU.mjs → D8lI4sL6G_iAKmXn.mjs} +2 -2
  37. package/node/esm/{Dz8qQyUhCxQuVw4P.mjs → DDSz0FRZeWiUv0Qn.mjs} +2 -2
  38. package/node/esm/{DQUpOqHLBRcR3jRL.mjs → DJ9NMU6rZ1D5ebi_.mjs} +2 -2
  39. package/node/esm/{C4MIOejuBpyFfiBE.mjs → DLRWBCUyz6hWY7gA.mjs} +2 -2
  40. package/{browser/esm/D4qsZVifvY4HXGV4.mjs → node/esm/DM96LY50uWuclm1m.mjs} +2 -2
  41. package/{browser/esm/DIJcwREawbt_MeZK.mjs → node/esm/DWbFa7pPvHt76LBY.mjs} +2 -2
  42. package/{browser/esm/fuSCbGKaf-8luGWM.mjs → node/esm/DeG2p0wft0dxcdAm.mjs} +2 -2
  43. package/{browser/esm/Bxs5g9POZ28N8txg.mjs → node/esm/Dpzo6YZEws6PLDBU.mjs} +2 -2
  44. package/node/esm/{Cg8sxKWlH9hl9cmJ.mjs → Dr61Yvcv07Hahj2a.mjs} +2 -2
  45. package/{browser/esm/Dq5qeAevZvlIBl1n.mjs → node/esm/QXT04Whlz23Oe61A.mjs} +2 -2
  46. package/node/esm/{BOyLreRKoE7rK6-B.mjs → XRNK8e2JoP4X70Jk.mjs} +2 -2
  47. package/node/esm/{CHCYcEKjePbdBT6S.mjs → _2bUDcLtpT--sYHK.mjs} +2 -2
  48. package/node/esm/declarations.mjs +3 -3
  49. package/node/esm/index.mjs +594 -635
  50. package/package.json +4 -4
  51. package/types/src/_utils/Pivot.d.ts +35 -37
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@sheetxl/formulas-extended",
3
3
  "description": "Formulas Enterprise - TypeScript formulas compatible with Excel built-ins.",
4
- "version": "0.8.0-beta.15",
5
- "license": "SEE LICENSE IN <LICENSE>",
4
+ "version": "0.8.0-beta.16",
5
+ "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {
@@ -42,7 +42,7 @@
42
42
  "formulas"
43
43
  ],
44
44
  "dependencies": {
45
- "@sheetxl/primitives": "^0.8.0-beta.15",
46
- "@sheetxl/scripting": "^0.8.0-beta.15"
45
+ "@sheetxl/primitives": "^0.8.0-beta.16",
46
+ "@sheetxl/scripting": "^0.8.0-beta.16"
47
47
  }
48
48
  }
@@ -109,61 +109,59 @@ export declare const isLoneBlankCell: (values: IRange) => boolean;
109
109
  * `#VALUE!` for the whole call (f06, f08), as is a shape mismatch (f03, f09, f11).
110
110
  */
111
111
  export declare const isValidFilter: (filter: IRange, recordCount: number) => boolean;
112
+ /** A group of one axis of the pivot. */
113
+ export type Group = IFormulaContext.PivotGroup;
112
114
  /**
113
- * A group at one key level of an axis.
114
- */
115
- export interface AxisNode {
116
- /** The key level, 0 for the outermost field. */
117
- readonly level: number;
118
- /** The group within that level's grouping. */
119
- readonly group: number;
120
- /** The keys down to this level, as spelled by the group's first record. */
121
- readonly keys: readonly Scalar[];
122
- /** The group one level up, `null` at the outermost level. */
123
- readonly parent: AxisNode | null;
124
- readonly children: AxisNode[];
125
- }
126
- /**
127
- * One output line of an axis: a group at the innermost level, a subtotal, or the grand total.
115
+ * One output line of an axis: a group at the innermost level, a subtotal, or the grand total
116
+ * (the axis's root).
128
117
  */
129
118
  export interface AxisLine {
130
119
  readonly kind: 'group' | 'subtotal' | 'total';
131
- /** `null` for the grand total. */
132
- readonly node: AxisNode | null;
120
+ readonly node: Group;
133
121
  }
122
+ /** Each group's children in their sorted order. */
123
+ export type AxisOrder = ReadonlyMap<Group, readonly Group[]>;
124
+ /**
125
+ * `measure` over the records in both a row group and a column group: the pivot's own aggregate
126
+ * when it computes the function ({@link IFormulaContext.Pivot.getAggregate}), the function over
127
+ * the members otherwise, and `""` when no record is in both.
128
+ */
129
+ export declare const aggregateAt: (pivot: IFormulaContext.Pivot, measure: Measure, values: IRange, row: Group | undefined, column: Group | undefined, y: () => IRange) => Scalar;
134
130
  /**
135
- * One axis of groups — `GROUPBY`'s rows, or either side of `PIVOTBY`.
131
+ * The layout of one axis of a pivot — `GROUPBY`'s rows, or either side of `PIVOTBY` — over the
132
+ * pivot's tree of groups ({@link IFormulaContext.createPivot}): sorting, subtotal and total
133
+ * placement, and key cells.
136
134
  *
137
135
  * @remarks
138
- * Each key level has its own grouping, over the key columns down to it, so a subtotal's members are
139
- * one group of that grouping rather than a union of its children's. A level's parent is read
140
- * through its first record (`getFirstRecord`/`getGroup`).
136
+ * The pivot groups every key level, so a subtotal's members are one group rather than a union of
137
+ * its children's, and each level keeps its own group's spelling: `East`, then `east` under a later
138
+ * product, is still `East` in that row (c13).
141
139
  */
142
- export declare class PivotAxis {
140
+ export declare class AxisLayout {
141
+ readonly root: Group;
143
142
  readonly fieldCount: number;
144
- /** Per key level, the grouping over the key columns down to it. */
145
- readonly groupings: IFormulaContext.Grouping[];
146
- /** Per key level, the key columns down to it. */
147
- readonly prefixes: IRange[];
148
- readonly roots: AxisNode[];
149
- constructor(keys: IRange, filter: IRange | undefined);
150
- /** The number of records kept. */
151
- getRecordCount(): number;
152
- /** A node's members of one value column. */
153
- getMembers(values: IRange, node: AxisNode | null): IRange;
143
+ /**
144
+ * @param axis One axis of the pivot.
145
+ * @param fieldCount The key columns the axis is grouped by.
146
+ */
147
+ constructor(axis: IFormulaContext.PivotAxis, fieldCount: number);
154
148
  /**
155
149
  * Orders the groups at every level.
156
150
  *
157
- * @param valueOf A node's aggregate, for a sort by value.
158
- * @param table Field relationship 1: one flat order over the innermost groups (d18).
151
+ * @param valueOf A group's aggregate, for a sort by value.
159
152
  *
160
153
  * @remarks
161
- * Keys sort by the comparison operators' order — numbers, text, `FALSE`, `TRUE`, errors — with
154
+ * Keys sort by the comparison operators' order — numbers, text, `FALSE`, `TRUE`, errors — with
162
155
  * a blank key last in either direction (e01, e02). A sort by value orders each level by its own
163
156
  * aggregate, parents by their subtotal (d05); ties keep key order (e06), and an error aggregate
164
157
  * sorts last.
165
158
  */
166
- sort(spec: SortSpec, valueOf: (node: AxisNode) => Scalar, table: boolean): AxisNode[];
159
+ sortTree(spec: SortSpec, valueOf: (node: Group) => Scalar): AxisOrder;
160
+ /**
161
+ * The innermost groups in one flat order, for field relationship 1 (d18): by every key level in
162
+ * turn, then by value when the sort asks for it.
163
+ */
164
+ sortLeaves(spec: SortSpec, valueOf: (node: Group) => Scalar): Group[];
167
165
  /**
168
166
  * The output lines in order, with subtotals and the grand total placed per `depth`.
169
167
  *
@@ -171,7 +169,7 @@ export declare class PivotAxis {
171
169
  * `|depth|` 1 is the grand total alone; each step deeper adds subtotals for one more level from
172
170
  * the top (c03, c13, c14). A negative depth puts every total before what it totals (c06, c15).
173
171
  */
174
- lines(roots: AxisNode[], depth: number): AxisLine[];
172
+ lines(order: AxisOrder, depth: number): AxisLine[];
175
173
  /**
176
174
  * The key cells of a line: its keys, `""` past its level, and the total's label.
177
175
  *