@zeniai/client-epic-state 5.2.37 → 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.
@@ -21,6 +21,7 @@ exports.initialFinanceStatementState = {
21
21
  displayOrder: 'ascending_date',
22
22
  reportFormat: 'more_detailed',
23
23
  lastFetchRequestTime: undefined,
24
+ isPeriodSelectionExplicit: false,
24
25
  };
25
26
  const financeStatement = (0, toolkit_1.createSlice)({
26
27
  name: 'financeStatement',
@@ -37,14 +38,26 @@ const financeStatement = (0, toolkit_1.createSlice)({
37
38
  },
38
39
  },
39
40
  updateFinanceStatementTimeframe(draft, action) {
41
+ // A month anchor is meaningless once the timeframe becomes quarter/year, so
42
+ // a real timeframe change has to drop it. Callers also re-dispatch the
43
+ // *current* timeframe as a side effect of unrelated UI (report format, view
44
+ // switches); dropping the anchor there silently resets the user's period to
45
+ // the latest one, so leave the selection alone when nothing changed.
46
+ if (draft.timeframe === action.payload) {
47
+ return;
48
+ }
40
49
  draft.timeframe = action.payload;
41
50
  draft.selectedCOABalancesRange = {
42
51
  numberOfPeriods: draft.selectedCOABalancesRange.numberOfPeriods,
43
52
  orderBy: draft.selectedCOABalancesRange.orderBy,
44
53
  };
54
+ draft.isPeriodSelectionExplicit = false;
45
55
  },
46
56
  updateCOABalancesRange(draft, action) {
47
57
  draft.selectedCOABalancesRange = Object.assign({}, action.payload);
58
+ // A range without an anchor is a programmatic reset to the default, not a
59
+ // user pick (e.g. leaving the horizontal by-class layout).
60
+ draft.isPeriodSelectionExplicit = action.payload.thisPeriod != null;
48
61
  },
49
62
  updateFinanceStatementThisPeriod(draft, action) {
50
63
  const { firstMonthOfFY, coaBalances, maxNumOfPeriodsToHighlight } = action.payload;
@@ -59,6 +72,7 @@ const financeStatement = (0, toolkit_1.createSlice)({
59
72
  };
60
73
  const newThisPeriod = (0, thisPeriodHelpers_1.getMatchingThisPeriod)(action.payload.firstMonthOfFY, timeframe, action.payload.thisPeriod, safeCoaBalances);
61
74
  if (newThisPeriod != null) {
75
+ draft.isPeriodSelectionExplicit = true;
62
76
  const selectionRanges = (0, getSelectedAndHighlightedRanges_1.getSelectedAndHighlightedRangesForThisPeriod)({
63
77
  firstMonthOfFY,
64
78
  thisPeriod: newThisPeriod,
@@ -99,6 +113,14 @@ const financeStatement = (0, toolkit_1.createSlice)({
99
113
  draft.isAdditionalBalancesShown =
100
114
  additionalBalances.length != 0 ? true : false;
101
115
  const { timeframe, selectedCOABalancesRange } = draft;
116
+ // The reports page fires this on load, on window resize and on every
117
+ // fetch-state transition (so also on report switch and on remount after a
118
+ // drill-down), carrying a viewport-derived period count. Re-deriving the
119
+ // range from that count silently discards a range the user chose, so only
120
+ // the column metadata above is applied once the selection is theirs.
121
+ if (draft.isPeriodSelectionExplicit) {
122
+ return;
123
+ }
102
124
  if (safeCoaBalances.length > 0) {
103
125
  const thisPeriod = (0, thisPeriodHelpers_1.extractThisPeriod)(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, safeCoaBalances);
104
126
  if (thisPeriod != null) {
@@ -2,6 +2,13 @@ import { ReportUIState } from '../../commonStateTypes/viewAndReport/reportUIStat
2
2
  import { ReportID } from '../../commonStateTypes/viewAndReport/viewAndReport';
3
3
  import { ZeniDate } from '../../zeniDayJS';
4
4
  export interface FinanceStatementState extends ReportUIState {
5
+ /**
6
+ * True once the user has picked a period range themselves (date-range picker or
7
+ * a period column click), as opposed to the viewport-derived default the page
8
+ * applies on load. While true, automatic column refits must not resize the
9
+ * selection.
10
+ */
11
+ isPeriodSelectionExplicit: boolean;
5
12
  selectedReportId: ReportID;
6
13
  lastFetchRequestTime?: ZeniDate;
7
14
  }
@@ -440,7 +440,7 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
440
440
  }
441
441
  }
442
442
  else {
443
- if (Boolean(transaction.billPayInfo.paymentDate) === true) {
443
+ if (Boolean((0, billListFilterHelpers_1.getActualPaymentDate)(transaction.billPayInfo)) === true) {
444
444
  transactionsWithSortKeyValue.push(transaction);
445
445
  }
446
446
  else {
@@ -525,7 +525,7 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
525
525
  case 'dueDate':
526
526
  return currentTab === 'draft'
527
527
  ? transaction.dueDate
528
- : transaction.billPayInfo.paymentDate;
528
+ : (0, billListFilterHelpers_1.getActualPaymentDate)(transaction.billPayInfo);
529
529
  case 'status':
530
530
  return getStatusPerTab(transaction);
531
531
  case 'amount':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.37",
3
+ "version": "5.2.39-betaRD0",
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",