@zeniai/client-epic-state 5.2.38 → 5.2.39-betaRD0
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/view/financeStatement/financeStatementReducer.js +22 -0
- package/lib/tsconfig.mocks.tsbuildinfo +1 -0
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
- package/lib/view/financeStatement/financeStatementReducer.js +22 -0
- package/lib/view/financeStatement/financeStatementState.d.ts +7 -0
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ export const initialFinanceStatementState = {
|
|
|
17
17
|
displayOrder: 'ascending_date',
|
|
18
18
|
reportFormat: 'more_detailed',
|
|
19
19
|
lastFetchRequestTime: undefined,
|
|
20
|
+
isPeriodSelectionExplicit: false,
|
|
20
21
|
};
|
|
21
22
|
const financeStatement = createSlice({
|
|
22
23
|
name: 'financeStatement',
|
|
@@ -33,14 +34,26 @@ const financeStatement = createSlice({
|
|
|
33
34
|
},
|
|
34
35
|
},
|
|
35
36
|
updateFinanceStatementTimeframe(draft, action) {
|
|
37
|
+
// A month anchor is meaningless once the timeframe becomes quarter/year, so
|
|
38
|
+
// a real timeframe change has to drop it. Callers also re-dispatch the
|
|
39
|
+
// *current* timeframe as a side effect of unrelated UI (report format, view
|
|
40
|
+
// switches); dropping the anchor there silently resets the user's period to
|
|
41
|
+
// the latest one, so leave the selection alone when nothing changed.
|
|
42
|
+
if (draft.timeframe === action.payload) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
36
45
|
draft.timeframe = action.payload;
|
|
37
46
|
draft.selectedCOABalancesRange = {
|
|
38
47
|
numberOfPeriods: draft.selectedCOABalancesRange.numberOfPeriods,
|
|
39
48
|
orderBy: draft.selectedCOABalancesRange.orderBy,
|
|
40
49
|
};
|
|
50
|
+
draft.isPeriodSelectionExplicit = false;
|
|
41
51
|
},
|
|
42
52
|
updateCOABalancesRange(draft, action) {
|
|
43
53
|
draft.selectedCOABalancesRange = Object.assign({}, action.payload);
|
|
54
|
+
// A range without an anchor is a programmatic reset to the default, not a
|
|
55
|
+
// user pick (e.g. leaving the horizontal by-class layout).
|
|
56
|
+
draft.isPeriodSelectionExplicit = action.payload.thisPeriod != null;
|
|
44
57
|
},
|
|
45
58
|
updateFinanceStatementThisPeriod(draft, action) {
|
|
46
59
|
const { firstMonthOfFY, coaBalances, maxNumOfPeriodsToHighlight } = action.payload;
|
|
@@ -55,6 +68,7 @@ const financeStatement = createSlice({
|
|
|
55
68
|
};
|
|
56
69
|
const newThisPeriod = getMatchingThisPeriod(action.payload.firstMonthOfFY, timeframe, action.payload.thisPeriod, safeCoaBalances);
|
|
57
70
|
if (newThisPeriod != null) {
|
|
71
|
+
draft.isPeriodSelectionExplicit = true;
|
|
58
72
|
const selectionRanges = getSelectedAndHighlightedRangesForThisPeriod({
|
|
59
73
|
firstMonthOfFY,
|
|
60
74
|
thisPeriod: newThisPeriod,
|
|
@@ -95,6 +109,14 @@ const financeStatement = createSlice({
|
|
|
95
109
|
draft.isAdditionalBalancesShown =
|
|
96
110
|
additionalBalances.length != 0 ? true : false;
|
|
97
111
|
const { timeframe, selectedCOABalancesRange } = draft;
|
|
112
|
+
// The reports page fires this on load, on window resize and on every
|
|
113
|
+
// fetch-state transition (so also on report switch and on remount after a
|
|
114
|
+
// drill-down), carrying a viewport-derived period count. Re-deriving the
|
|
115
|
+
// range from that count silently discards a range the user chose, so only
|
|
116
|
+
// the column metadata above is applied once the selection is theirs.
|
|
117
|
+
if (draft.isPeriodSelectionExplicit) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
98
120
|
if (safeCoaBalances.length > 0) {
|
|
99
121
|
const thisPeriod = extractThisPeriod(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, safeCoaBalances);
|
|
100
122
|
if (thisPeriod != null) {
|