@zeniai/client-epic-state 5.0.25-beta0ND → 5.0.25
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/lib/esm/index.js +1 -2
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +0 -42
- package/lib/index.d.ts +1 -2
- package/lib/index.js +26 -28
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.d.ts +1 -15
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +0 -43
- package/package.json +1 -1
|
@@ -1,20 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HorizontalAccountRow, ProfitAndLossByClassHorizontalReport } from './profitAndLossClassesByClassHorizontalSelectorTypes';
|
|
1
|
+
import { ProfitAndLossByClassHorizontalReport } from './profitAndLossClassesByClassHorizontalSelectorTypes';
|
|
3
2
|
/**
|
|
4
3
|
* Populates `sectionHeaderBalancesSlice`, and per-account `accountReportData`, so the
|
|
5
4
|
* web layer only maps selector output to tree nodes.
|
|
6
5
|
*/
|
|
7
6
|
export declare function enrichProfitAndLossByClassHorizontalReport(report: ProfitAndLossByClassHorizontalReport): void;
|
|
8
|
-
/**
|
|
9
|
-
* Sum balances across descendant accounts (recursive).
|
|
10
|
-
*
|
|
11
|
-
* Parent rows in the horizontal pivot only carry their own direct postings
|
|
12
|
-
* (zero for "container" accounts), so callers rendering "Total {parent}" rows
|
|
13
|
-
* must aggregate from descendants to get the real per-class totals.
|
|
14
|
-
*
|
|
15
|
-
* Returns one `COABalance` per class column + total (same shape as the
|
|
16
|
-
* enriched `balancesInTimeframe.balances`), with `amount` summed and `type`
|
|
17
|
-
* set to `default_with_null_balance` for zeros. Returns `[]` when no
|
|
18
|
-
* descendants have enriched data.
|
|
19
|
-
*/
|
|
20
|
-
export declare function aggregateHorizontalDescendantBalances(accounts: readonly HorizontalAccountRow[], childIndices: readonly number[], childrenByParent: Readonly<Record<number, readonly number[]>>): COABalance[];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.enrichProfitAndLossByClassHorizontalReport = enrichProfitAndLossByClassHorizontalReport;
|
|
4
|
-
exports.aggregateHorizontalDescendantBalances = aggregateHorizontalDescendantBalances;
|
|
5
4
|
const currencyHelper_1 = require("../../commonStateTypes/currencyHelper");
|
|
6
5
|
const horizontalSectionEmptyBalancesSlice_1 = require("./horizontalSectionEmptyBalancesSlice");
|
|
7
6
|
const profitAndLossClassesByClassHorizontalSelectorTypes_1 = require("./profitAndLossClassesByClassHorizontalSelectorTypes");
|
|
@@ -119,48 +118,6 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
|
|
|
119
118
|
},
|
|
120
119
|
};
|
|
121
120
|
}
|
|
122
|
-
/**
|
|
123
|
-
* Sum balances across descendant accounts (recursive).
|
|
124
|
-
*
|
|
125
|
-
* Parent rows in the horizontal pivot only carry their own direct postings
|
|
126
|
-
* (zero for "container" accounts), so callers rendering "Total {parent}" rows
|
|
127
|
-
* must aggregate from descendants to get the real per-class totals.
|
|
128
|
-
*
|
|
129
|
-
* Returns one `COABalance` per class column + total (same shape as the
|
|
130
|
-
* enriched `balancesInTimeframe.balances`), with `amount` summed and `type`
|
|
131
|
-
* set to `default_with_null_balance` for zeros. Returns `[]` when no
|
|
132
|
-
* descendants have enriched data.
|
|
133
|
-
*/
|
|
134
|
-
function aggregateHorizontalDescendantBalances(accounts, childIndices, childrenByParent) {
|
|
135
|
-
let template;
|
|
136
|
-
const sums = new Map();
|
|
137
|
-
const walk = (idx) => {
|
|
138
|
-
const childRow = accounts[idx];
|
|
139
|
-
const childBalances = childRow?.accountReportData?.balancesInTimeframe.balances;
|
|
140
|
-
if (childBalances != null) {
|
|
141
|
-
if (template == null) {
|
|
142
|
-
template = childBalances;
|
|
143
|
-
}
|
|
144
|
-
childBalances.forEach((b, i) => {
|
|
145
|
-
sums.set(i, (sums.get(i) ?? 0) + (b.balance.amount ?? 0));
|
|
146
|
-
});
|
|
147
|
-
const grandChildren = childrenByParent[idx] ?? [];
|
|
148
|
-
grandChildren.forEach(walk);
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
childIndices.forEach(walk);
|
|
152
|
-
if (template == null) {
|
|
153
|
-
return [];
|
|
154
|
-
}
|
|
155
|
-
return template.map((tpl, i) => {
|
|
156
|
-
const amount = sums.get(i) ?? 0;
|
|
157
|
-
return {
|
|
158
|
-
...tpl,
|
|
159
|
-
balance: { ...tpl.balance, amount },
|
|
160
|
-
type: amount === 0 ? 'default_with_null_balance' : 'default',
|
|
161
|
-
};
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
121
|
/**
|
|
165
122
|
* Parent index per DFS row — O(n). Matches the scan in the former
|
|
166
123
|
* `findHorizontalAccountParentIndex` (depth <= 2 rows have no parent).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.25
|
|
3
|
+
"version": "5.0.25",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|