@zeniai/client-epic-state 4.20.0-beta2ND → 4.20.0-beta5RR
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 +1 -0
- package/lib/entity/task/taskPayload.js +1 -0
- package/lib/entity/task/taskState.d.ts +1 -0
- package/lib/esm/entity/task/taskPayload.js +1 -0
- package/lib/esm/view/companyView/types/cockpitTypes.js +1 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +8 -3
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +59 -126
- package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +1 -0
- package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +1 -0
- package/lib/esm/view/taskManager/taskListView/taskList.js +1 -0
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +8 -2
- 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 +1 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +8 -3
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +59 -126
- package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +1 -0
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +1 -0
- package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +1 -0
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskList.js +1 -0
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +2 -2
- package/lib/view/taskManager/taskListView/taskListSelector.js +8 -2
- 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:
|
|
16
|
+
export declare function getSummationFreeRangeTotalBalance(resultSlice: 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,6 +10,7 @@ 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,
|
|
13
14
|
name: payload.name,
|
|
14
15
|
syncToken: payload.sync_token ?? '',
|
|
15
16
|
priority: {
|
package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js
CHANGED
|
@@ -49,11 +49,16 @@ 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
|
+
});
|
|
52
57
|
reportCurrency =
|
|
53
58
|
profitAndLossClassesViewState.currency ?? defaultCustomerCurrency;
|
|
54
|
-
//
|
|
59
|
+
// Pivot each section from class→account to account→class
|
|
55
60
|
HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
|
|
56
|
-
const sectionReport =
|
|
61
|
+
const sectionReport = sectionReports[sectionId];
|
|
57
62
|
if (sectionReport != null) {
|
|
58
63
|
sections[sectionId] = pivotSectionToHorizontal(sectionReport, classColumns, SECTION_TITLES[sectionId] ?? sectionId, reportCurrency);
|
|
59
64
|
}
|
|
@@ -256,7 +261,7 @@ function sumBalancesInSlice(balances) {
|
|
|
256
261
|
if (balances.length === 0) {
|
|
257
262
|
return 0;
|
|
258
263
|
}
|
|
259
|
-
const summed = getSummationFreeRangeTotalBalance(balances);
|
|
264
|
+
const summed = getSummationFreeRangeTotalBalance([...balances]);
|
|
260
265
|
return summed?.balance.amount ?? 0;
|
|
261
266
|
}
|
|
262
267
|
/**
|
|
@@ -25,31 +25,30 @@ 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
|
|
29
|
-
const childrenRowIndicesByParent = buildHorizontalAccountChildIndicesByParent(parentIndices);
|
|
28
|
+
const childrenRowIndicesByParent = buildHorizontalAccountChildIndicesByParent(section.accounts);
|
|
30
29
|
const childrenRecord = {};
|
|
31
30
|
childrenRowIndicesByParent.forEach((childIndices, parentIndex) => {
|
|
32
31
|
childrenRecord[parentIndex] = childIndices;
|
|
33
32
|
});
|
|
34
33
|
section.treeLayout = {
|
|
35
34
|
rootAccountRowIndices: section.accounts
|
|
36
|
-
.map((_, i) => (
|
|
35
|
+
.map((_, i) => findHorizontalAccountParentIndex(section.accounts, i) === -1 ? i : -1)
|
|
37
36
|
.filter((i) => i >= 0),
|
|
38
37
|
childrenRowIndicesByParent: childrenRecord,
|
|
39
38
|
};
|
|
40
|
-
const siblingsPerRow = buildSiblingIndicesPerRow(section.accounts, parentIndices);
|
|
41
|
-
const hasChildFlags = computeHorizontalHasChildFlags(parentIndices);
|
|
42
39
|
for (let i = 0; i < section.accounts.length; i++) {
|
|
43
40
|
const row = section.accounts[i];
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
const classRowAmounts = report.classColumns.map((col) => {
|
|
42
|
+
const cb = row.classBalances.find((b) => b.classId === col.classId);
|
|
43
|
+
return cb?.balance.amount ?? 0;
|
|
44
|
+
});
|
|
46
45
|
row.accountReportData = {
|
|
47
46
|
accountId: row.accountId,
|
|
48
47
|
accountName: row.accountName,
|
|
49
48
|
accountType: row.accountType,
|
|
50
49
|
depth: row.depth,
|
|
51
50
|
balancesInTimeframe: buildHorizontalClassColumnBalancesSlice(report, classRowAmounts, row.rowTotal.amount),
|
|
52
|
-
horizontalTreeView:
|
|
51
|
+
horizontalTreeView: buildHorizontalTreeView(section.accounts, i),
|
|
53
52
|
};
|
|
54
53
|
}
|
|
55
54
|
}
|
|
@@ -121,143 +120,64 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
|
|
|
121
120
|
},
|
|
122
121
|
};
|
|
123
122
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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;
|
|
123
|
+
function findHorizontalAccountParentIndex(dfsOrderedAccountRows, childRowIndex) {
|
|
124
|
+
const childDepth = dfsOrderedAccountRows[childRowIndex].depth;
|
|
125
|
+
if (childDepth <= 2) {
|
|
126
|
+
return -1;
|
|
127
|
+
}
|
|
128
|
+
for (let earlierRowIndex = childRowIndex - 1; earlierRowIndex >= 0; earlierRowIndex--) {
|
|
129
|
+
const earlierDepth = dfsOrderedAccountRows[earlierRowIndex].depth;
|
|
130
|
+
if (earlierDepth < childDepth) {
|
|
131
|
+
if (earlierDepth === childDepth - 1) {
|
|
132
|
+
return earlierRowIndex;
|
|
154
133
|
}
|
|
134
|
+
return -1;
|
|
155
135
|
}
|
|
156
|
-
stack.push(rowIndex);
|
|
157
136
|
}
|
|
158
|
-
return
|
|
137
|
+
return -1;
|
|
159
138
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
for (let
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
139
|
+
function getHorizontalAccountSiblingIndices(dfsOrderedAccountRows, rowIndex) {
|
|
140
|
+
const parentRowIndex = findHorizontalAccountParentIndex(dfsOrderedAccountRows, rowIndex);
|
|
141
|
+
const rowDepth = dfsOrderedAccountRows[rowIndex].depth;
|
|
142
|
+
const siblings = [];
|
|
143
|
+
for (let i = 0; i < dfsOrderedAccountRows.length; i++) {
|
|
144
|
+
if (dfsOrderedAccountRows[i].depth === rowDepth &&
|
|
145
|
+
findHorizontalAccountParentIndex(dfsOrderedAccountRows, i) ===
|
|
146
|
+
parentRowIndex) {
|
|
147
|
+
siblings.push(i);
|
|
169
148
|
}
|
|
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];
|
|
189
149
|
}
|
|
190
|
-
return
|
|
150
|
+
return siblings;
|
|
191
151
|
}
|
|
192
|
-
function
|
|
193
|
-
|
|
194
|
-
|
|
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;
|
|
152
|
+
function horizontalAccountHasChildRows(dfsOrderedAccountRows, parentRowIndex) {
|
|
153
|
+
return dfsOrderedAccountRows.some((_, rowIndex) => findHorizontalAccountParentIndex(dfsOrderedAccountRows, rowIndex) ===
|
|
154
|
+
parentRowIndex);
|
|
204
155
|
}
|
|
205
|
-
function
|
|
206
|
-
const
|
|
156
|
+
function buildHorizontalSubAccountAncestorMetadata(dfsOrderedAccountRows, currentRowIndex) {
|
|
157
|
+
const ancestorRowIndicesRootToLeaf = [];
|
|
207
158
|
let walkRowIndex = currentRowIndex;
|
|
208
159
|
while (walkRowIndex >= 0) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if (parentRowIndex == null) {
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
walkRowIndex = parentRowIndex;
|
|
160
|
+
ancestorRowIndicesRootToLeaf.unshift(walkRowIndex);
|
|
161
|
+
walkRowIndex = findHorizontalAccountParentIndex(dfsOrderedAccountRows, walkRowIndex);
|
|
215
162
|
}
|
|
216
|
-
return
|
|
217
|
-
const
|
|
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
|
-
}
|
|
163
|
+
return ancestorRowIndicesRootToLeaf.map((rowIndex) => {
|
|
164
|
+
const siblingIndices = getHorizontalAccountSiblingIndices(dfsOrderedAccountRows, rowIndex);
|
|
229
165
|
return {
|
|
230
|
-
depth:
|
|
166
|
+
depth: dfsOrderedAccountRows[rowIndex].depth - 2,
|
|
231
167
|
hasSibling: siblingIndices.length > 1,
|
|
232
|
-
hasChildren:
|
|
168
|
+
hasChildren: horizontalAccountHasChildRows(dfsOrderedAccountRows, rowIndex),
|
|
233
169
|
isLastNode: rowIndex === siblingIndices[siblingIndices.length - 1],
|
|
234
|
-
name:
|
|
170
|
+
name: dfsOrderedAccountRows[rowIndex].accountName,
|
|
235
171
|
};
|
|
236
172
|
});
|
|
237
173
|
}
|
|
238
|
-
function
|
|
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) {
|
|
174
|
+
function buildHorizontalAccountChildIndicesByParent(dfsOrderedAccountRows) {
|
|
255
175
|
const childIndicesByParentRowIndex = new Map();
|
|
256
|
-
for (let rowIndex = 0; rowIndex <
|
|
257
|
-
const parentRowIndex =
|
|
258
|
-
if (parentRowIndex
|
|
176
|
+
for (let rowIndex = 0; rowIndex < dfsOrderedAccountRows.length; rowIndex++) {
|
|
177
|
+
const parentRowIndex = findHorizontalAccountParentIndex(dfsOrderedAccountRows, rowIndex);
|
|
178
|
+
if (parentRowIndex >= 0) {
|
|
259
179
|
let childRowIndices = childIndicesByParentRowIndex.get(parentRowIndex);
|
|
260
|
-
if (childRowIndices
|
|
180
|
+
if (childRowIndices === undefined) {
|
|
261
181
|
childRowIndices = [];
|
|
262
182
|
childIndicesByParentRowIndex.set(parentRowIndex, childRowIndices);
|
|
263
183
|
}
|
|
@@ -266,3 +186,16 @@ function buildHorizontalAccountChildIndicesByParent(parentIndices) {
|
|
|
266
186
|
}
|
|
267
187
|
return childIndicesByParentRowIndex;
|
|
268
188
|
}
|
|
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,6 +25,7 @@ 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,
|
|
28
29
|
};
|
|
29
30
|
const actions = [
|
|
30
31
|
saveTaskUpdatesToLocalStore({ taskDetailLocalData, taskId }),
|
|
@@ -94,5 +94,6 @@ 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 } : {}),
|
|
97
98
|
};
|
|
98
99
|
};
|
|
@@ -17,8 +17,12 @@ 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
|
-
|
|
20
|
+
if (taskListState.uiState.searchText !== initialState.uiState.searchText) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
const hasNoActiveFilters = taskListState.filters.categories == null ||
|
|
24
|
+
taskListState.filters.categories.length === 0;
|
|
25
|
+
return (hasNoActiveFilters || isEqual(taskListState.filters, initialState.filters));
|
|
22
26
|
};
|
|
23
27
|
const sortTasksList = (tagState, tasksList, sortKey, sortOrder) => {
|
|
24
28
|
const tasksInOrder = orderBy(tasksList, (task) => {
|
|
@@ -36,6 +40,8 @@ const sortTasksList = (tagState, tasksList, sortKey, sortOrder) => {
|
|
|
36
40
|
return ALL_PRIORITY_CODE.indexOf(task.priority.code);
|
|
37
41
|
case 'timeSpent':
|
|
38
42
|
return task.timeSpent;
|
|
43
|
+
case 'visibility':
|
|
44
|
+
return task.isPrivate ? 1 : 0;
|
|
39
45
|
case 'name':
|
|
40
46
|
default:
|
|
41
47
|
return task.name.toLowerCase();
|