@zeniai/client-epic-state 5.2.39-betaRD1 → 5.2.39
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.
|
@@ -33,18 +33,9 @@ const financeStatement = createSlice({
|
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
35
|
updateFinanceStatementTimeframe(draft, action) {
|
|
36
|
-
// Unrelated UI re-dispatches the *current* timeframe as a side effect (the
|
|
37
|
-
// reports page hangs its table scroll reset off that callback); dropping the
|
|
38
|
-
// anchor there would silently reset the user's period to the latest one.
|
|
39
|
-
if (draft.timeframe === action.payload) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
36
|
draft.timeframe = action.payload;
|
|
43
|
-
// A month anchor is meaningless once the timeframe becomes quarter/year, so
|
|
44
|
-
// a real change drops it and returns the width to the default — 12 months
|
|
45
|
-
// must not become 12 quarters. Order is the user's, so it survives.
|
|
46
37
|
draft.selectedCOABalancesRange = {
|
|
47
|
-
numberOfPeriods:
|
|
38
|
+
numberOfPeriods: draft.selectedCOABalancesRange.numberOfPeriods,
|
|
48
39
|
orderBy: draft.selectedCOABalancesRange.orderBy,
|
|
49
40
|
};
|
|
50
41
|
},
|
|
@@ -86,7 +77,8 @@ const financeStatement = createSlice({
|
|
|
86
77
|
draft.selectedReportId = action.payload;
|
|
87
78
|
},
|
|
88
79
|
updateFinanceStatementAdditionalBalancesSelection(draft, action) {
|
|
89
|
-
const { additionalBalances: additionalBalancesPayload, maxNumOfPeriodsToHighlight, } = action.payload;
|
|
80
|
+
const { firstMonthOfFY, additionalBalances: additionalBalancesPayload, coaBalances, maxNumOfPeriodsToHighlight, } = action.payload;
|
|
81
|
+
const safeCoaBalances = coaBalances != null ? coaBalances : [];
|
|
90
82
|
const additionalBalances = additionalBalancesPayload ?? [];
|
|
91
83
|
let tempAdditionalBalances = [...additionalBalances];
|
|
92
84
|
if (additionalBalances.includes('this_period_vs_last_period') ||
|
|
@@ -102,12 +94,30 @@ const financeStatement = createSlice({
|
|
|
102
94
|
draft.maxNumOfPeriodsToHighlight = maxNumOfPeriodsToHighlight;
|
|
103
95
|
draft.isAdditionalBalancesShown =
|
|
104
96
|
additionalBalances.length != 0 ? true : false;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
97
|
+
const { timeframe, selectedCOABalancesRange } = draft;
|
|
98
|
+
if (safeCoaBalances.length > 0) {
|
|
99
|
+
const thisPeriod = extractThisPeriod(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, safeCoaBalances);
|
|
100
|
+
if (thisPeriod != null) {
|
|
101
|
+
const selectedCoaBalancesRangeWithThisPeriod = {
|
|
102
|
+
...selectedCOABalancesRange,
|
|
103
|
+
thisPeriod,
|
|
104
|
+
};
|
|
105
|
+
const selectionRanges = getSelectedAndHighlightedRangesForThisPeriod({
|
|
106
|
+
firstMonthOfFY,
|
|
107
|
+
thisPeriod: thisPeriod,
|
|
108
|
+
coaBalances: safeCoaBalances,
|
|
109
|
+
timeframe,
|
|
110
|
+
maxNumOfPeriodsToHighlight: maxNumOfPeriodsToHighlight,
|
|
111
|
+
currentSelection: {
|
|
112
|
+
selectedCOABalancesRange: selectedCoaBalancesRangeWithThisPeriod,
|
|
113
|
+
},
|
|
114
|
+
orderBy: 'ascending_date',
|
|
115
|
+
maxNumOfPeriodsToSelect: maxNumOfPeriodsToHighlight,
|
|
116
|
+
});
|
|
117
|
+
draft.selectedCOABalancesRange =
|
|
118
|
+
selectionRanges.selectedCOABalancesRange;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
111
121
|
},
|
|
112
122
|
updateDownloadState(draft, action) {
|
|
113
123
|
draft.downloadState = action.payload;
|
|
@@ -37,18 +37,9 @@ const financeStatement = (0, toolkit_1.createSlice)({
|
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
updateFinanceStatementTimeframe(draft, action) {
|
|
40
|
-
// Unrelated UI re-dispatches the *current* timeframe as a side effect (the
|
|
41
|
-
// reports page hangs its table scroll reset off that callback); dropping the
|
|
42
|
-
// anchor there would silently reset the user's period to the latest one.
|
|
43
|
-
if (draft.timeframe === action.payload) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
40
|
draft.timeframe = action.payload;
|
|
47
|
-
// A month anchor is meaningless once the timeframe becomes quarter/year, so
|
|
48
|
-
// a real change drops it and returns the width to the default — 12 months
|
|
49
|
-
// must not become 12 quarters. Order is the user's, so it survives.
|
|
50
41
|
draft.selectedCOABalancesRange = {
|
|
51
|
-
numberOfPeriods:
|
|
42
|
+
numberOfPeriods: draft.selectedCOABalancesRange.numberOfPeriods,
|
|
52
43
|
orderBy: draft.selectedCOABalancesRange.orderBy,
|
|
53
44
|
};
|
|
54
45
|
},
|
|
@@ -90,7 +81,8 @@ const financeStatement = (0, toolkit_1.createSlice)({
|
|
|
90
81
|
draft.selectedReportId = action.payload;
|
|
91
82
|
},
|
|
92
83
|
updateFinanceStatementAdditionalBalancesSelection(draft, action) {
|
|
93
|
-
const { additionalBalances: additionalBalancesPayload, maxNumOfPeriodsToHighlight, } = action.payload;
|
|
84
|
+
const { firstMonthOfFY, additionalBalances: additionalBalancesPayload, coaBalances, maxNumOfPeriodsToHighlight, } = action.payload;
|
|
85
|
+
const safeCoaBalances = coaBalances != null ? coaBalances : [];
|
|
94
86
|
const additionalBalances = additionalBalancesPayload ?? [];
|
|
95
87
|
let tempAdditionalBalances = [...additionalBalances];
|
|
96
88
|
if (additionalBalances.includes('this_period_vs_last_period') ||
|
|
@@ -106,12 +98,30 @@ const financeStatement = (0, toolkit_1.createSlice)({
|
|
|
106
98
|
draft.maxNumOfPeriodsToHighlight = maxNumOfPeriodsToHighlight;
|
|
107
99
|
draft.isAdditionalBalancesShown =
|
|
108
100
|
additionalBalances.length != 0 ? true : false;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
101
|
+
const { timeframe, selectedCOABalancesRange } = draft;
|
|
102
|
+
if (safeCoaBalances.length > 0) {
|
|
103
|
+
const thisPeriod = (0, thisPeriodHelpers_1.extractThisPeriod)(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, safeCoaBalances);
|
|
104
|
+
if (thisPeriod != null) {
|
|
105
|
+
const selectedCoaBalancesRangeWithThisPeriod = {
|
|
106
|
+
...selectedCOABalancesRange,
|
|
107
|
+
thisPeriod,
|
|
108
|
+
};
|
|
109
|
+
const selectionRanges = (0, getSelectedAndHighlightedRanges_1.getSelectedAndHighlightedRangesForThisPeriod)({
|
|
110
|
+
firstMonthOfFY,
|
|
111
|
+
thisPeriod: thisPeriod,
|
|
112
|
+
coaBalances: safeCoaBalances,
|
|
113
|
+
timeframe,
|
|
114
|
+
maxNumOfPeriodsToHighlight: maxNumOfPeriodsToHighlight,
|
|
115
|
+
currentSelection: {
|
|
116
|
+
selectedCOABalancesRange: selectedCoaBalancesRangeWithThisPeriod,
|
|
117
|
+
},
|
|
118
|
+
orderBy: 'ascending_date',
|
|
119
|
+
maxNumOfPeriodsToSelect: maxNumOfPeriodsToHighlight,
|
|
120
|
+
});
|
|
121
|
+
draft.selectedCOABalancesRange =
|
|
122
|
+
selectionRanges.selectedCOABalancesRange;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
115
125
|
},
|
|
116
126
|
updateDownloadState(draft, action) {
|
|
117
127
|
draft.downloadState = action.payload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.39
|
|
3
|
+
"version": "5.2.39",
|
|
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",
|