@zeniai/client-epic-state 4.20.0 → 4.20.1-beta11ND
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/commonStateTypes/coaBalance/additionalBalances/getSummationBalance.d.ts +1 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +17 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -8
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +132 -73
- package/lib/index.d.ts +2 -1
- package/lib/index.js +27 -25
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.d.ts +9 -0
- package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +20 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -8
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +132 -73
- package/package.json +1 -1
|
@@ -13,6 +13,6 @@ export declare function getSummationBalance(summationType: 'year_to_date_total'
|
|
|
13
13
|
allClosingMonthlyBalanceOrderedAsc: COABalance[];
|
|
14
14
|
allOpeningMonthlyBalanceOrderedAsc: COABalance[];
|
|
15
15
|
} | undefined): COABalance | undefined;
|
|
16
|
-
export declare function getSummationFreeRangeTotalBalance(resultSlice: COABalance[]): COABalance | undefined;
|
|
16
|
+
export declare function getSummationFreeRangeTotalBalance(resultSlice: readonly COABalance[]): COABalance | undefined;
|
|
17
17
|
export declare function getFreeRangeCashAndEquivalentsOpeningBalance(resultSlice: COABalance[], resultBalancesOrder: COABalancesOrder): COABalance | undefined;
|
|
18
18
|
export declare function getFreeRangeCashAndEquivalentsClosingBalance(resultSlice: COABalance[], resultBalancesOrder: COABalancesOrder): COABalance | undefined;
|
package/lib/esm/index.js
CHANGED
|
@@ -217,6 +217,7 @@ import { changeZeniPersonRoles, deletePerson, fetchAllPeopleRequiredViews, fetch
|
|
|
217
217
|
import { getPeople, getPeopleLocalData } from './view/people/peopleSelector';
|
|
218
218
|
import { fetchProfitAndLoss, fetchProfitAndLossForTimeframe, resetProfitAndLossNodeCollapseState, updateProfitAndLossUIState, } from './view/profitAndLoss/profitAndLossReducer';
|
|
219
219
|
import { getPandLReportFetchState, getProfitAndLossReport, } from './view/profitAndLoss/profitAndLossSelector';
|
|
220
|
+
import { getEmptyHorizontalSectionBalancesSlice } from './view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice';
|
|
220
221
|
import { getProfitAndLossClassesHorizontalView } from './view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector';
|
|
221
222
|
import { HORIZONTAL_CLASS_TOTAL_BALANCE_ID, isHorizontalAccountReportData, } from './view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes';
|
|
222
223
|
import { fetchProfitAndLossClassesView, resetProfitAndLossClassesNodeCollapseState, updateClassViewLayout, updateAccountViewMode as updateProfitAndLossAccountViewMode, updateClassesToFilterOut as updateProfitAndLossClassesToFilterOut, updateProfitAndLossClassesViewUIState, } from './view/profitAndLossClassesView/profitAndLossClassesViewReducer';
|
|
@@ -453,7 +454,7 @@ export { fetchDashboard, getDashboard, updateTreasuryVideoClosed, };
|
|
|
453
454
|
export { updateDashboardLayout };
|
|
454
455
|
export { getPandLWithForecast, } from './view/profitAndLoss/pAndLWithForecast/pAndLWithForecastSelector';
|
|
455
456
|
export { fetchProfitAndLoss, resetProfitAndLossNodeCollapseState, updateProfitAndLossUIState, getProfitAndLossReport, getPandLReportFetchState, fetchProfitAndLossForTimeframe, };
|
|
456
|
-
export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, updateClassViewLayout, getProfitAndLossClassesView, getProfitAndLossClassesHorizontalView, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, HORIZONTAL_CLASS_TOTAL_BALANCE_ID, isHorizontalAccountReportData, };
|
|
457
|
+
export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, updateClassViewLayout, getProfitAndLossClassesView, getEmptyHorizontalSectionBalancesSlice, getProfitAndLossClassesHorizontalView, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, HORIZONTAL_CLASS_TOTAL_BALANCE_ID, isHorizontalAccountReportData, };
|
|
457
458
|
export { getAccountingProviderAttachment };
|
|
458
459
|
export { fetchUserListByType, getUserList };
|
|
459
460
|
export { fetchAllPeopleRequiredViews, fetchPeoplePage, fetchPeople, deletePerson, resendInvite, changeZeniPersonRoles, invitePeople, inviteZeniPeople, updatePeopleUIState, peopleSaveUpdates, resetUpdateErrorMessage, peopleSaveDataInLocalStore, peopleClearDataInLocalStore, getPeople, getPeopleLocalData, initializeEditPerson, };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Empty `COABalancesSlice` for horizontal P&L-by-class section / calculated headers when
|
|
3
|
+
* enrichment has not produced balances yet, or for UI mapping fallbacks.
|
|
4
|
+
* Structure matches {@link enrichProfitAndLossByClassHorizontalReport} output.
|
|
5
|
+
*/
|
|
6
|
+
export function getEmptyHorizontalSectionBalancesSlice(firstMonthOfFY, timeframe = 'month') {
|
|
7
|
+
return {
|
|
8
|
+
balances: [],
|
|
9
|
+
additionalBalances: [],
|
|
10
|
+
filter: {
|
|
11
|
+
firstMonthOfFY,
|
|
12
|
+
timeframe,
|
|
13
|
+
balancesRange: { numberOfPeriods: 0, orderBy: 'ascending_date' },
|
|
14
|
+
additionalBalances: [],
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js
CHANGED
|
@@ -49,16 +49,11 @@ export const getProfitAndLossClassesHorizontalView = (filter, accountState, clas
|
|
|
49
49
|
const calculatedSections = {};
|
|
50
50
|
let reportCurrency = defaultCustomerCurrency;
|
|
51
51
|
if (fetchState.fetchState === 'Completed' && selectedPeriod != null) {
|
|
52
|
-
// Get section reports using existing selector infrastructure
|
|
53
|
-
const sectionReports = {};
|
|
54
|
-
HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
|
|
55
|
-
sectionReports[sectionId] = getSectionClassesViewReport(accountState, classState, sectionsState, { reportId, sectionId }, filter);
|
|
56
|
-
});
|
|
57
52
|
reportCurrency =
|
|
58
53
|
profitAndLossClassesViewState.currency ?? defaultCustomerCurrency;
|
|
59
|
-
//
|
|
54
|
+
// Fetch each section and pivot class→account to account→class in one pass
|
|
60
55
|
HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
|
|
61
|
-
const sectionReport =
|
|
56
|
+
const sectionReport = getSectionClassesViewReport(accountState, classState, sectionsState, { reportId, sectionId }, filter);
|
|
62
57
|
if (sectionReport != null) {
|
|
63
58
|
sections[sectionId] = pivotSectionToHorizontal(sectionReport, classColumns, SECTION_TITLES[sectionId] ?? sectionId, reportCurrency);
|
|
64
59
|
}
|
|
@@ -261,7 +256,7 @@ function sumBalancesInSlice(balances) {
|
|
|
261
256
|
if (balances.length === 0) {
|
|
262
257
|
return 0;
|
|
263
258
|
}
|
|
264
|
-
const summed = getSummationFreeRangeTotalBalance(
|
|
259
|
+
const summed = getSummationFreeRangeTotalBalance(balances);
|
|
265
260
|
return summed?.balance.amount ?? 0;
|
|
266
261
|
}
|
|
267
262
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defaultCustomerCurrency } from '../../commonStateTypes/currencyHelper';
|
|
2
|
+
import { getEmptyHorizontalSectionBalancesSlice } from './horizontalSectionEmptyBalancesSlice';
|
|
2
3
|
import { HORIZONTAL_CLASS_TOTAL_BALANCE_ID, } from './profitAndLossClassesByClassHorizontalSelectorTypes';
|
|
3
4
|
/**
|
|
4
5
|
* Populates `sectionHeaderBalancesSlice`, and per-account `accountReportData`, so the
|
|
@@ -25,30 +26,31 @@ function enrichHorizontalSection(report, section) {
|
|
|
25
26
|
return total?.balance.amount ?? 0;
|
|
26
27
|
});
|
|
27
28
|
section.sectionHeaderBalancesSlice = buildHorizontalClassColumnBalancesSlice(report, classAmounts, section.sectionTotal.amount);
|
|
28
|
-
const
|
|
29
|
+
const parentIndices = computeHorizontalAccountParentIndices(section.accounts);
|
|
30
|
+
const childrenRowIndicesByParent = buildHorizontalAccountChildIndicesByParent(parentIndices);
|
|
29
31
|
const childrenRecord = {};
|
|
30
32
|
childrenRowIndicesByParent.forEach((childIndices, parentIndex) => {
|
|
31
33
|
childrenRecord[parentIndex] = childIndices;
|
|
32
34
|
});
|
|
33
35
|
section.treeLayout = {
|
|
34
36
|
rootAccountRowIndices: section.accounts
|
|
35
|
-
.map((_, i) =>
|
|
37
|
+
.map((_, i) => (parentIndices[i] === -1 ? i : -1))
|
|
36
38
|
.filter((i) => i >= 0),
|
|
37
39
|
childrenRowIndicesByParent: childrenRecord,
|
|
38
40
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
const siblingsPerRow = buildSiblingIndicesPerRow(section.accounts, parentIndices);
|
|
42
|
+
const hasChildFlags = computeHorizontalHasChildFlags(parentIndices);
|
|
43
|
+
for (let accountIndex = 0; accountIndex < section.accounts.length; accountIndex++) {
|
|
44
|
+
const row = section.accounts[accountIndex];
|
|
45
|
+
// Same column order as `report.classColumns` (see `pivotSectionToHorizontal`).
|
|
46
|
+
const classRowAmounts = row.classBalances.map((classBalance) => classBalance.balance.amount);
|
|
45
47
|
row.accountReportData = {
|
|
46
48
|
accountId: row.accountId,
|
|
47
49
|
accountName: row.accountName,
|
|
48
50
|
accountType: row.accountType,
|
|
49
51
|
depth: row.depth,
|
|
50
52
|
balancesInTimeframe: buildHorizontalClassColumnBalancesSlice(report, classRowAmounts, row.rowTotal.amount),
|
|
51
|
-
horizontalTreeView:
|
|
53
|
+
horizontalTreeView: buildHorizontalTreeViewFromPrecomputed(section.accounts, accountIndex, parentIndices, siblingsPerRow, hasChildFlags),
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
56
|
}
|
|
@@ -66,23 +68,14 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
|
|
|
66
68
|
const currencyCode = firstHeader?.balance.currencyCode ?? fallback.currencyCode;
|
|
67
69
|
const currencySymbol = firstHeader?.balance.currencySymbol ?? fallback.currencySymbol;
|
|
68
70
|
const timeframe = firstHeader?.balanceTimeFrame ?? 'month';
|
|
69
|
-
const emptySlice =
|
|
70
|
-
balances: [],
|
|
71
|
-
additionalBalances: [],
|
|
72
|
-
filter: {
|
|
73
|
-
firstMonthOfFY: report.firstMonthOfFY,
|
|
74
|
-
timeframe,
|
|
75
|
-
balancesRange: { numberOfPeriods: 0, orderBy: 'ascending_date' },
|
|
76
|
-
additionalBalances: [],
|
|
77
|
-
},
|
|
78
|
-
};
|
|
71
|
+
const emptySlice = getEmptyHorizontalSectionBalancesSlice(report.firstMonthOfFY, timeframe);
|
|
79
72
|
if (report.selectedPeriod == null) {
|
|
80
73
|
return emptySlice;
|
|
81
74
|
}
|
|
82
75
|
const { startDate, endDate } = report.selectedPeriod;
|
|
83
|
-
const balances = report.classColumns.map((col,
|
|
76
|
+
const balances = report.classColumns.map((col, columnIndex) => ({
|
|
84
77
|
balance: {
|
|
85
|
-
amount: classAmounts[
|
|
78
|
+
amount: classAmounts[columnIndex] ?? 0,
|
|
86
79
|
currencyCode,
|
|
87
80
|
currencySymbol,
|
|
88
81
|
},
|
|
@@ -120,64 +113,143 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
|
|
|
120
113
|
},
|
|
121
114
|
};
|
|
122
115
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
116
|
+
/**
|
|
117
|
+
* Parent index per DFS row — O(n). Matches the scan in the former
|
|
118
|
+
* `findHorizontalAccountParentIndex` (depth <= 2 rows have no parent).
|
|
119
|
+
*/
|
|
120
|
+
function computeHorizontalAccountParentIndices(rows) {
|
|
121
|
+
const accountRowCount = rows.length;
|
|
122
|
+
const parentIndex = new Array(accountRowCount).fill(-1);
|
|
123
|
+
const stack = [];
|
|
124
|
+
for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
|
|
125
|
+
const accountRow = rows[rowIndex];
|
|
126
|
+
if (accountRow == null) {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const depth = accountRow.depth;
|
|
130
|
+
while (stack.length > 0) {
|
|
131
|
+
const topRow = rows[stack[stack.length - 1]];
|
|
132
|
+
if (topRow == null) {
|
|
133
|
+
stack.pop();
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (topRow.depth < depth) {
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
stack.pop();
|
|
140
|
+
}
|
|
141
|
+
if (depth > 2 && stack.length > 0) {
|
|
142
|
+
const peek = stack[stack.length - 1];
|
|
143
|
+
const parentRow = rows[peek];
|
|
144
|
+
if (parentRow != null && parentRow.depth === depth - 1) {
|
|
145
|
+
parentIndex[rowIndex] = peek;
|
|
133
146
|
}
|
|
134
|
-
return -1;
|
|
135
147
|
}
|
|
148
|
+
stack.push(rowIndex);
|
|
136
149
|
}
|
|
137
|
-
return
|
|
150
|
+
return parentIndex;
|
|
138
151
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
const
|
|
143
|
-
for (let
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
152
|
+
/** Sibling row indices (same parent + depth), in traversal order — O(n). */
|
|
153
|
+
function buildSiblingIndicesPerRow(rows, parentIndices) {
|
|
154
|
+
const accountRowCount = rows.length;
|
|
155
|
+
const keyToIndices = new Map();
|
|
156
|
+
for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
|
|
157
|
+
const parentRowIndex = parentIndices[rowIndex];
|
|
158
|
+
const accountRow = rows[rowIndex];
|
|
159
|
+
if (parentRowIndex == null || accountRow == null) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
const key = `${parentRowIndex}:${accountRow.depth}`;
|
|
163
|
+
let siblingGroup = keyToIndices.get(key);
|
|
164
|
+
if (siblingGroup == null) {
|
|
165
|
+
siblingGroup = [];
|
|
166
|
+
keyToIndices.set(key, siblingGroup);
|
|
167
|
+
}
|
|
168
|
+
siblingGroup.push(rowIndex);
|
|
169
|
+
}
|
|
170
|
+
const siblingsPerRow = new Array(accountRowCount);
|
|
171
|
+
for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
|
|
172
|
+
const parentRowIndex = parentIndices[rowIndex];
|
|
173
|
+
const accountRow = rows[rowIndex];
|
|
174
|
+
if (parentRowIndex == null || accountRow == null) {
|
|
175
|
+
siblingsPerRow[rowIndex] = [rowIndex];
|
|
176
|
+
continue;
|
|
148
177
|
}
|
|
178
|
+
const key = `${parentRowIndex}:${accountRow.depth}`;
|
|
179
|
+
const group = keyToIndices.get(key);
|
|
180
|
+
siblingsPerRow[rowIndex] = group != null ? group : [rowIndex];
|
|
149
181
|
}
|
|
150
|
-
return
|
|
182
|
+
return siblingsPerRow;
|
|
151
183
|
}
|
|
152
|
-
function
|
|
153
|
-
|
|
154
|
-
|
|
184
|
+
function computeHorizontalHasChildFlags(parentIndices) {
|
|
185
|
+
const rowCount = parentIndices.length;
|
|
186
|
+
const flags = new Array(rowCount).fill(false);
|
|
187
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
|
188
|
+
const parentRowIndex = parentIndices[rowIndex];
|
|
189
|
+
if (parentRowIndex != null &&
|
|
190
|
+
parentRowIndex >= 0 &&
|
|
191
|
+
parentRowIndex < rowCount) {
|
|
192
|
+
flags[parentRowIndex] = true;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return flags;
|
|
155
196
|
}
|
|
156
|
-
function
|
|
157
|
-
const
|
|
197
|
+
function buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags) {
|
|
198
|
+
const chain = [];
|
|
158
199
|
let walkRowIndex = currentRowIndex;
|
|
159
200
|
while (walkRowIndex >= 0) {
|
|
160
|
-
|
|
161
|
-
|
|
201
|
+
chain.unshift(walkRowIndex);
|
|
202
|
+
const parentRowIndex = parentIndices[walkRowIndex];
|
|
203
|
+
if (parentRowIndex == null) {
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
walkRowIndex = parentRowIndex;
|
|
162
207
|
}
|
|
163
|
-
return
|
|
164
|
-
const
|
|
208
|
+
return chain.map((rowIndex) => {
|
|
209
|
+
const accountRow = dfsOrderedAccountRows[rowIndex];
|
|
210
|
+
const siblingIndices = siblingsPerRow[rowIndex];
|
|
211
|
+
const hasChild = hasChildFlags[rowIndex];
|
|
212
|
+
if (accountRow == null || siblingIndices == null) {
|
|
213
|
+
return {
|
|
214
|
+
depth: 0,
|
|
215
|
+
hasSibling: false,
|
|
216
|
+
hasChildren: hasChild === true,
|
|
217
|
+
isLastNode: true,
|
|
218
|
+
name: '',
|
|
219
|
+
};
|
|
220
|
+
}
|
|
165
221
|
return {
|
|
166
|
-
depth:
|
|
222
|
+
depth: accountRow.depth - 2,
|
|
167
223
|
hasSibling: siblingIndices.length > 1,
|
|
168
|
-
hasChildren:
|
|
224
|
+
hasChildren: hasChild === true,
|
|
169
225
|
isLastNode: rowIndex === siblingIndices[siblingIndices.length - 1],
|
|
170
|
-
name:
|
|
226
|
+
name: accountRow.accountName,
|
|
171
227
|
};
|
|
172
228
|
});
|
|
173
229
|
}
|
|
174
|
-
function
|
|
230
|
+
function buildHorizontalTreeViewFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags) {
|
|
231
|
+
const siblingIndices = siblingsPerRow[currentRowIndex];
|
|
232
|
+
const accountRow = dfsOrderedAccountRows[currentRowIndex];
|
|
233
|
+
const hasChildrenFlag = hasChildFlags[currentRowIndex];
|
|
234
|
+
const treeDepth = accountRow != null ? Math.max(0, accountRow.depth - 2) : 0;
|
|
235
|
+
const hasChildren = hasChildrenFlag === true;
|
|
236
|
+
const siblings = siblingIndices ?? [currentRowIndex];
|
|
237
|
+
return {
|
|
238
|
+
subAccountAncestorMetadata: buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags),
|
|
239
|
+
treeDepth,
|
|
240
|
+
hasChildren,
|
|
241
|
+
hasSiblings: siblings.length > 1,
|
|
242
|
+
isLeaf: !hasChildren,
|
|
243
|
+
isLastNode: currentRowIndex === siblings[siblings.length - 1],
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function buildHorizontalAccountChildIndicesByParent(parentIndices) {
|
|
175
247
|
const childIndicesByParentRowIndex = new Map();
|
|
176
|
-
for (let rowIndex = 0; rowIndex <
|
|
177
|
-
const parentRowIndex =
|
|
178
|
-
if (parentRowIndex >= 0) {
|
|
248
|
+
for (let rowIndex = 0; rowIndex < parentIndices.length; rowIndex++) {
|
|
249
|
+
const parentRowIndex = parentIndices[rowIndex];
|
|
250
|
+
if (parentRowIndex != null && parentRowIndex >= 0) {
|
|
179
251
|
let childRowIndices = childIndicesByParentRowIndex.get(parentRowIndex);
|
|
180
|
-
if (childRowIndices
|
|
252
|
+
if (childRowIndices == null) {
|
|
181
253
|
childRowIndices = [];
|
|
182
254
|
childIndicesByParentRowIndex.set(parentRowIndex, childRowIndices);
|
|
183
255
|
}
|
|
@@ -186,16 +258,3 @@ function buildHorizontalAccountChildIndicesByParent(dfsOrderedAccountRows) {
|
|
|
186
258
|
}
|
|
187
259
|
return childIndicesByParentRowIndex;
|
|
188
260
|
}
|
|
189
|
-
function buildHorizontalTreeView(dfsOrderedAccountRows, currentRowIndex) {
|
|
190
|
-
const treeDepth = Math.max(0, dfsOrderedAccountRows[currentRowIndex].depth - 2);
|
|
191
|
-
const siblingIndices = getHorizontalAccountSiblingIndices(dfsOrderedAccountRows, currentRowIndex);
|
|
192
|
-
const hasChildren = horizontalAccountHasChildRows(dfsOrderedAccountRows, currentRowIndex);
|
|
193
|
-
return {
|
|
194
|
-
subAccountAncestorMetadata: buildHorizontalSubAccountAncestorMetadata(dfsOrderedAccountRows, currentRowIndex),
|
|
195
|
-
treeDepth,
|
|
196
|
-
hasChildren,
|
|
197
|
-
hasSiblings: siblingIndices.length > 1,
|
|
198
|
-
isLeaf: !hasChildren,
|
|
199
|
-
isLastNode: currentRowIndex === siblingIndices[siblingIndices.length - 1],
|
|
200
|
-
};
|
|
201
|
-
}
|
package/lib/index.d.ts
CHANGED
|
@@ -347,6 +347,7 @@ import { PeopleViewSortKey } from './view/people/peopleTypes';
|
|
|
347
347
|
import { fetchProfitAndLoss, fetchProfitAndLossForTimeframe, resetProfitAndLossNodeCollapseState, updateProfitAndLossUIState } from './view/profitAndLoss/profitAndLossReducer';
|
|
348
348
|
import { ProfitAndLossReport, getPandLReportFetchState, getProfitAndLossReport } from './view/profitAndLoss/profitAndLossSelector';
|
|
349
349
|
import { ProfitAndLossState, ProfitAndLossUIState } from './view/profitAndLoss/profitAndLossState';
|
|
350
|
+
import { getEmptyHorizontalSectionBalancesSlice } from './view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice';
|
|
350
351
|
import { getProfitAndLossClassesHorizontalView } from './view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector';
|
|
351
352
|
import { ClassColumnDefinition, HORIZONTAL_CLASS_TOTAL_BALANCE_ID, HorizontalAccountReportData, HorizontalAccountRow, HorizontalCalculatedSection, HorizontalClassBalance, HorizontalSectionReport, HorizontalSectionTreeLayout, ProfitAndLossByClassHorizontalReport, isHorizontalAccountReportData } from './view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes';
|
|
352
353
|
import { fetchProfitAndLossClassesView, resetProfitAndLossClassesNodeCollapseState, updateClassViewLayout, updateAccountViewMode as updateProfitAndLossAccountViewMode, updateClassesToFilterOut as updateProfitAndLossClassesToFilterOut, updateProfitAndLossClassesViewUIState } from './view/profitAndLossClassesView/profitAndLossClassesViewReducer';
|
|
@@ -667,7 +668,7 @@ export { fetchDashboard, getDashboard, DashboardReport, updateTreasuryVideoClose
|
|
|
667
668
|
export { updateDashboardLayout };
|
|
668
669
|
export { PandLWithForecastView, getPandLWithForecast, } from './view/profitAndLoss/pAndLWithForecast/pAndLWithForecastSelector';
|
|
669
670
|
export { fetchProfitAndLoss, resetProfitAndLossNodeCollapseState, updateProfitAndLossUIState, ProfitAndLossState, ProfitAndLossUIState, getProfitAndLossReport, ProfitAndLossReport, getPandLReportFetchState, fetchProfitAndLossForTimeframe, };
|
|
670
|
-
export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, updateClassViewLayout, ProfitAndLossClassesViewUIState, ProfitAndLossClassesViewReport, getProfitAndLossClassesView, getProfitAndLossClassesHorizontalView, PandLReportViewSectionID, PandLReportViewCalculatedSectionID, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, ClassViewLayout, ProfitAndLossByClassHorizontalReport, ClassColumnDefinition, HORIZONTAL_CLASS_TOTAL_BALANCE_ID, HorizontalAccountReportData, HorizontalAccountRow, HorizontalClassBalance, HorizontalSectionReport, HorizontalSectionTreeLayout, HorizontalCalculatedSection, isHorizontalAccountReportData, };
|
|
671
|
+
export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, updateClassViewLayout, ProfitAndLossClassesViewUIState, ProfitAndLossClassesViewReport, getProfitAndLossClassesView, getEmptyHorizontalSectionBalancesSlice, getProfitAndLossClassesHorizontalView, PandLReportViewSectionID, PandLReportViewCalculatedSectionID, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, ClassViewLayout, ProfitAndLossByClassHorizontalReport, ClassColumnDefinition, HORIZONTAL_CLASS_TOTAL_BALANCE_ID, HorizontalAccountReportData, HorizontalAccountRow, HorizontalClassBalance, HorizontalSectionReport, HorizontalSectionTreeLayout, HorizontalCalculatedSection, isHorizontalAccountReportData, };
|
|
671
672
|
export { AccountingProviderAttachmentSelector, getAccountingProviderAttachment };
|
|
672
673
|
export { fetchUserListByType, getUserList, UserListSelectorView };
|
|
673
674
|
export { fetchAllPeopleRequiredViews, fetchPeoplePage, fetchPeople, deletePerson, resendInvite, changeZeniPersonRoles, invitePeople, inviteZeniPeople, updatePeopleUIState, peopleSaveUpdates, resetUpdateErrorMessage, peopleSaveDataInLocalStore, peopleClearDataInLocalStore, PeopleSelectorView, PeopleLocalDataView, Person, getPeople, getPeopleLocalData, PeopleState, PersonUpdateType, PeoplePageMode, ZeniPersonUserRoleType, PeopleUIState, PeopleLocalData, initializeEditPerson, };
|