@zeniai/client-epic-state 4.20.0-beta1RR → 4.20.0-beta2ND
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/entity/task/taskPayload.d.ts +0 -1
- package/lib/entity/task/taskPayload.js +0 -1
- package/lib/entity/task/taskState.d.ts +0 -1
- package/lib/esm/entity/task/taskPayload.js +0 -1
- package/lib/esm/view/companyView/types/cockpitTypes.js +0 -1
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -8
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +126 -59
- package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -1
- package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -1
- package/lib/esm/view/taskManager/taskListView/taskList.js +0 -1
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +2 -6
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
- package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
- package/lib/view/companyView/types/cockpitTypes.js +0 -1
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -8
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +126 -59
- package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -1
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -1
- package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +0 -1
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskList.js +0 -1
- package/lib/view/taskManager/taskListView/taskListSelector.js +2 -6
- 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;
|
|
@@ -10,7 +10,6 @@ export const mapTaskPayloadToTask = (payload) => ({
|
|
|
10
10
|
fileIds: payload.file_ids,
|
|
11
11
|
isArchived: payload.is_archived,
|
|
12
12
|
isDeleted: payload.is_deleted,
|
|
13
|
-
isPrivate: payload.is_private,
|
|
14
13
|
name: payload.name,
|
|
15
14
|
syncToken: payload.sync_token ?? '',
|
|
16
15
|
priority: {
|
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
|
/**
|
|
@@ -25,30 +25,31 @@ function enrichHorizontalSection(report, section) {
|
|
|
25
25
|
return total?.balance.amount ?? 0;
|
|
26
26
|
});
|
|
27
27
|
section.sectionHeaderBalancesSlice = buildHorizontalClassColumnBalancesSlice(report, classAmounts, section.sectionTotal.amount);
|
|
28
|
-
const
|
|
28
|
+
const parentIndices = computeHorizontalAccountParentIndices(section.accounts);
|
|
29
|
+
const childrenRowIndicesByParent = buildHorizontalAccountChildIndicesByParent(parentIndices);
|
|
29
30
|
const childrenRecord = {};
|
|
30
31
|
childrenRowIndicesByParent.forEach((childIndices, parentIndex) => {
|
|
31
32
|
childrenRecord[parentIndex] = childIndices;
|
|
32
33
|
});
|
|
33
34
|
section.treeLayout = {
|
|
34
35
|
rootAccountRowIndices: section.accounts
|
|
35
|
-
.map((_, i) =>
|
|
36
|
+
.map((_, i) => (parentIndices[i] === -1 ? i : -1))
|
|
36
37
|
.filter((i) => i >= 0),
|
|
37
38
|
childrenRowIndicesByParent: childrenRecord,
|
|
38
39
|
};
|
|
40
|
+
const siblingsPerRow = buildSiblingIndicesPerRow(section.accounts, parentIndices);
|
|
41
|
+
const hasChildFlags = computeHorizontalHasChildFlags(parentIndices);
|
|
39
42
|
for (let i = 0; i < section.accounts.length; i++) {
|
|
40
43
|
const row = section.accounts[i];
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return cb?.balance.amount ?? 0;
|
|
44
|
-
});
|
|
44
|
+
// Same column order as `report.classColumns` (see `pivotSectionToHorizontal`).
|
|
45
|
+
const classRowAmounts = row.classBalances.map((b) => b.balance.amount);
|
|
45
46
|
row.accountReportData = {
|
|
46
47
|
accountId: row.accountId,
|
|
47
48
|
accountName: row.accountName,
|
|
48
49
|
accountType: row.accountType,
|
|
49
50
|
depth: row.depth,
|
|
50
51
|
balancesInTimeframe: buildHorizontalClassColumnBalancesSlice(report, classRowAmounts, row.rowTotal.amount),
|
|
51
|
-
horizontalTreeView:
|
|
52
|
+
horizontalTreeView: buildHorizontalTreeViewFromPrecomputed(section.accounts, i, parentIndices, siblingsPerRow, hasChildFlags),
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -120,64 +121,143 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
|
|
|
120
121
|
},
|
|
121
122
|
};
|
|
122
123
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Parent index per DFS row — O(n). Matches the scan in the former
|
|
126
|
+
* `findHorizontalAccountParentIndex` (depth <= 2 rows have no parent).
|
|
127
|
+
*/
|
|
128
|
+
function computeHorizontalAccountParentIndices(rows) {
|
|
129
|
+
const accountRowCount = rows.length;
|
|
130
|
+
const parentIndex = new Array(accountRowCount).fill(-1);
|
|
131
|
+
const stack = [];
|
|
132
|
+
for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
|
|
133
|
+
const accountRow = rows[rowIndex];
|
|
134
|
+
if (accountRow == null) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const d = accountRow.depth;
|
|
138
|
+
while (stack.length > 0) {
|
|
139
|
+
const topRow = rows[stack[stack.length - 1]];
|
|
140
|
+
if (topRow == null) {
|
|
141
|
+
stack.pop();
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (topRow.depth < d) {
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
stack.pop();
|
|
148
|
+
}
|
|
149
|
+
if (d > 2 && stack.length > 0) {
|
|
150
|
+
const peek = stack[stack.length - 1];
|
|
151
|
+
const parentRow = rows[peek];
|
|
152
|
+
if (parentRow != null && parentRow.depth === d - 1) {
|
|
153
|
+
parentIndex[rowIndex] = peek;
|
|
133
154
|
}
|
|
134
|
-
return -1;
|
|
135
155
|
}
|
|
156
|
+
stack.push(rowIndex);
|
|
136
157
|
}
|
|
137
|
-
return
|
|
158
|
+
return parentIndex;
|
|
138
159
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
const
|
|
143
|
-
for (let
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
160
|
+
/** Sibling row indices (same parent + depth), in traversal order — O(n). */
|
|
161
|
+
function buildSiblingIndicesPerRow(rows, parentIndices) {
|
|
162
|
+
const accountRowCount = rows.length;
|
|
163
|
+
const keyToIndices = new Map();
|
|
164
|
+
for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
|
|
165
|
+
const parentRowIndex = parentIndices[rowIndex];
|
|
166
|
+
const accountRow = rows[rowIndex];
|
|
167
|
+
if (parentRowIndex == null || accountRow == null) {
|
|
168
|
+
continue;
|
|
148
169
|
}
|
|
170
|
+
const key = `${parentRowIndex}:${accountRow.depth}`;
|
|
171
|
+
let g = keyToIndices.get(key);
|
|
172
|
+
if (g == null) {
|
|
173
|
+
g = [];
|
|
174
|
+
keyToIndices.set(key, g);
|
|
175
|
+
}
|
|
176
|
+
g.push(rowIndex);
|
|
177
|
+
}
|
|
178
|
+
const siblingsPerRow = new Array(accountRowCount);
|
|
179
|
+
for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
|
|
180
|
+
const parentRowIndex = parentIndices[rowIndex];
|
|
181
|
+
const accountRow = rows[rowIndex];
|
|
182
|
+
if (parentRowIndex == null || accountRow == null) {
|
|
183
|
+
siblingsPerRow[rowIndex] = [rowIndex];
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
const key = `${parentRowIndex}:${accountRow.depth}`;
|
|
187
|
+
const group = keyToIndices.get(key);
|
|
188
|
+
siblingsPerRow[rowIndex] = group != null ? group : [rowIndex];
|
|
149
189
|
}
|
|
150
|
-
return
|
|
190
|
+
return siblingsPerRow;
|
|
151
191
|
}
|
|
152
|
-
function
|
|
153
|
-
|
|
154
|
-
|
|
192
|
+
function computeHorizontalHasChildFlags(parentIndices) {
|
|
193
|
+
const rowCount = parentIndices.length;
|
|
194
|
+
const flags = new Array(rowCount).fill(false);
|
|
195
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
|
196
|
+
const parentRowIndex = parentIndices[rowIndex];
|
|
197
|
+
if (parentRowIndex != null &&
|
|
198
|
+
parentRowIndex >= 0 &&
|
|
199
|
+
parentRowIndex < rowCount) {
|
|
200
|
+
flags[parentRowIndex] = true;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return flags;
|
|
155
204
|
}
|
|
156
|
-
function
|
|
157
|
-
const
|
|
205
|
+
function buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags) {
|
|
206
|
+
const chain = [];
|
|
158
207
|
let walkRowIndex = currentRowIndex;
|
|
159
208
|
while (walkRowIndex >= 0) {
|
|
160
|
-
|
|
161
|
-
|
|
209
|
+
chain.unshift(walkRowIndex);
|
|
210
|
+
const parentRowIndex = parentIndices[walkRowIndex];
|
|
211
|
+
if (parentRowIndex == null) {
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
walkRowIndex = parentRowIndex;
|
|
162
215
|
}
|
|
163
|
-
return
|
|
164
|
-
const
|
|
216
|
+
return chain.map((rowIndex) => {
|
|
217
|
+
const accountRow = dfsOrderedAccountRows[rowIndex];
|
|
218
|
+
const siblingIndices = siblingsPerRow[rowIndex];
|
|
219
|
+
const hasChild = hasChildFlags[rowIndex];
|
|
220
|
+
if (accountRow == null || siblingIndices == null) {
|
|
221
|
+
return {
|
|
222
|
+
depth: 0,
|
|
223
|
+
hasSibling: false,
|
|
224
|
+
hasChildren: hasChild === true,
|
|
225
|
+
isLastNode: true,
|
|
226
|
+
name: '',
|
|
227
|
+
};
|
|
228
|
+
}
|
|
165
229
|
return {
|
|
166
|
-
depth:
|
|
230
|
+
depth: accountRow.depth - 2,
|
|
167
231
|
hasSibling: siblingIndices.length > 1,
|
|
168
|
-
hasChildren:
|
|
232
|
+
hasChildren: hasChild === true,
|
|
169
233
|
isLastNode: rowIndex === siblingIndices[siblingIndices.length - 1],
|
|
170
|
-
name:
|
|
234
|
+
name: accountRow.accountName,
|
|
171
235
|
};
|
|
172
236
|
});
|
|
173
237
|
}
|
|
174
|
-
function
|
|
238
|
+
function buildHorizontalTreeViewFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags) {
|
|
239
|
+
const siblingIndices = siblingsPerRow[currentRowIndex];
|
|
240
|
+
const accountRow = dfsOrderedAccountRows[currentRowIndex];
|
|
241
|
+
const hasChildrenFlag = hasChildFlags[currentRowIndex];
|
|
242
|
+
const treeDepth = accountRow != null ? Math.max(0, accountRow.depth - 2) : 0;
|
|
243
|
+
const hasChildren = hasChildrenFlag === true;
|
|
244
|
+
const sibs = siblingIndices ?? [currentRowIndex];
|
|
245
|
+
return {
|
|
246
|
+
subAccountAncestorMetadata: buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags),
|
|
247
|
+
treeDepth,
|
|
248
|
+
hasChildren,
|
|
249
|
+
hasSiblings: sibs.length > 1,
|
|
250
|
+
isLeaf: !hasChildren,
|
|
251
|
+
isLastNode: currentRowIndex === sibs[sibs.length - 1],
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function buildHorizontalAccountChildIndicesByParent(parentIndices) {
|
|
175
255
|
const childIndicesByParentRowIndex = new Map();
|
|
176
|
-
for (let rowIndex = 0; rowIndex <
|
|
177
|
-
const parentRowIndex =
|
|
178
|
-
if (parentRowIndex >= 0) {
|
|
256
|
+
for (let rowIndex = 0; rowIndex < parentIndices.length; rowIndex++) {
|
|
257
|
+
const parentRowIndex = parentIndices[rowIndex];
|
|
258
|
+
if (parentRowIndex != null && parentRowIndex >= 0) {
|
|
179
259
|
let childRowIndices = childIndicesByParentRowIndex.get(parentRowIndex);
|
|
180
|
-
if (childRowIndices
|
|
260
|
+
if (childRowIndices == null) {
|
|
181
261
|
childRowIndices = [];
|
|
182
262
|
childIndicesByParentRowIndex.set(parentRowIndex, childRowIndices);
|
|
183
263
|
}
|
|
@@ -186,16 +266,3 @@ function buildHorizontalAccountChildIndicesByParent(dfsOrderedAccountRows) {
|
|
|
186
266
|
}
|
|
187
267
|
return childIndicesByParentRowIndex;
|
|
188
268
|
}
|
|
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
|
-
}
|
|
@@ -25,7 +25,6 @@ export const initializeTaskToLocalStoreEpic = (actions$, state$) => actions$.pip
|
|
|
25
25
|
savedRecurringEndDate: task.recurringEndDate,
|
|
26
26
|
recurringStartDate: task.recurringStartDate,
|
|
27
27
|
timeSpent: task.timeSpent,
|
|
28
|
-
isPrivate: task.isPrivate,
|
|
29
28
|
};
|
|
30
29
|
const actions = [
|
|
31
30
|
saveTaskUpdatesToLocalStore({ taskDetailLocalData, taskId }),
|
|
@@ -94,6 +94,5 @@ const prepareTaskPayload = (state, taskId, taskGroupId) => {
|
|
|
94
94
|
sync_token: syncToken,
|
|
95
95
|
task_group_ids: taskGroupId != null ? [taskGroupId] : [],
|
|
96
96
|
time_spent: convertHHMMStrToMinutes(localData.timeSpent),
|
|
97
|
-
...(taskId == null ? { is_private: localData.isPrivate ?? false } : {}),
|
|
98
97
|
};
|
|
99
98
|
};
|
|
@@ -17,12 +17,8 @@ import { allTaskPriority, allTaskStatus, } from '../taskDetailView/taskDetailSel
|
|
|
17
17
|
import { DUE_DATE_GROUP_KEYS, } from './taskList';
|
|
18
18
|
import { initialState } from './taskListReducer';
|
|
19
19
|
const isDefaultFilters = (taskListState) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
const hasNoActiveFilters = taskListState.filters.categories == null ||
|
|
24
|
-
taskListState.filters.categories.length === 0;
|
|
25
|
-
return (hasNoActiveFilters || isEqual(taskListState.filters, initialState.filters));
|
|
20
|
+
return (isEqual(taskListState.filters, initialState.filters) &&
|
|
21
|
+
initialState.uiState.searchText === taskListState.uiState.searchText);
|
|
26
22
|
};
|
|
27
23
|
const sortTasksList = (tagState, tasksList, sortKey, sortOrder) => {
|
|
28
24
|
const tasksInOrder = orderBy(tasksList, (task) => {
|