@dhis2/analytics 29.3.1 → 29.3.2
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.
|
@@ -82,9 +82,11 @@ const PeriodTransfer = ({
|
|
|
82
82
|
} else {
|
|
83
83
|
const allFixed = (0, _fixedPeriods.getFixedPeriodsOptions)(periodsSettings);
|
|
84
84
|
const allRelative = (0, _relativePeriods.getRelativePeriodsOptions)();
|
|
85
|
+
const v43PeriodTypes = [_index2.WEEKLYFRI, _index2.FYFEB, _index2.FYAUG, _index2.FYSEP];
|
|
86
|
+
const allExcludedPeriodTypes = [...excludedPeriodTypes, ...v43PeriodTypes];
|
|
85
87
|
return {
|
|
86
|
-
filteredFixedOptions: (0, _index2.filterPeriodTypesById)(allFixed,
|
|
87
|
-
filteredRelativeOptions: (0, _index2.filterPeriodTypesById)(allRelative,
|
|
88
|
+
filteredFixedOptions: (0, _index2.filterPeriodTypesById)(allFixed, allExcludedPeriodTypes),
|
|
89
|
+
filteredRelativeOptions: (0, _index2.filterPeriodTypesById)(allRelative, allExcludedPeriodTypes)
|
|
88
90
|
};
|
|
89
91
|
}
|
|
90
92
|
}, [supportsEnabledPeriodTypes, enabledPeriodTypesData, excludedPeriodTypes, periodsSettings]);
|
|
@@ -103,11 +105,11 @@ const PeriodTransfer = ({
|
|
|
103
105
|
// use ".eraYear" rather than ".year" because in Ethiopian calendar, eraYear is what our users expect to see (for other calendars, it doesn't matter)
|
|
104
106
|
// there is still a pending decision in Temporal regarding which era to use by default: https://github.com/js-temporal/temporal-polyfill/blob/9350ee7dd0d29f329fc097debf923a517c32f813/lib/calendar.ts#L1964
|
|
105
107
|
const defaultFixedPeriodYear = now.eraYear || now.year;
|
|
106
|
-
const fixedPeriodConfig = year => ({
|
|
108
|
+
const fixedPeriodConfig = (0, _react.useCallback)(year => ({
|
|
107
109
|
offset: year - defaultFixedPeriodYear,
|
|
108
110
|
filterFuturePeriods: false,
|
|
109
111
|
reversePeriods: false
|
|
110
|
-
});
|
|
112
|
+
}), [defaultFixedPeriodYear]);
|
|
111
113
|
const [userPeriods, setUserPeriods] = (0, _react.useState)(null);
|
|
112
114
|
const [isRelative, setIsRelative] = (0, _react.useState)(true);
|
|
113
115
|
const [relativeFilter, setRelativeFilter] = (0, _react.useState)({
|
|
@@ -152,7 +154,7 @@ const PeriodTransfer = ({
|
|
|
152
154
|
const opt = filteredFixedOptions.find(o => o.id === effectiveFixedFilterType);
|
|
153
155
|
return (opt === null || opt === void 0 ? void 0 : opt.getPeriods(fixedPeriodConfig(Number(fixedFilter.year)))) || [];
|
|
154
156
|
}
|
|
155
|
-
}, [isRelative, effectiveRelativeFilterType, effectiveFixedFilterType, filteredRelativeOptions, filteredFixedOptions, fixedFilter.year]);
|
|
157
|
+
}, [isRelative, effectiveRelativeFilterType, effectiveFixedFilterType, filteredRelativeOptions, filteredFixedOptions, fixedFilter.year, fixedPeriodConfig]);
|
|
156
158
|
const allPeriods = userPeriods !== null && userPeriods !== void 0 ? userPeriods : derivedPeriods;
|
|
157
159
|
const isActive = value => {
|
|
158
160
|
const item = selectedItems.find(item => item.id === value);
|
package/build/cjs/index.js
CHANGED
|
@@ -241,6 +241,7 @@ var _exportNames = {
|
|
|
241
241
|
WEEKLY: true,
|
|
242
242
|
WEEKLYWED: true,
|
|
243
243
|
WEEKLYTHU: true,
|
|
244
|
+
WEEKLYFRI: true,
|
|
244
245
|
WEEKLYSAT: true,
|
|
245
246
|
WEEKLYSUN: true,
|
|
246
247
|
WEEKS_THIS_YEAR: true,
|
|
@@ -252,10 +253,13 @@ var _exportNames = {
|
|
|
252
253
|
SIXMONTHLYAPR: true,
|
|
253
254
|
YEARLY: true,
|
|
254
255
|
FINANCIAL: true,
|
|
255
|
-
|
|
256
|
-
FYOCT: true,
|
|
257
|
-
FYJUL: true,
|
|
256
|
+
FYFEB: true,
|
|
258
257
|
FYAPR: true,
|
|
258
|
+
FYJUL: true,
|
|
259
|
+
FYAUG: true,
|
|
260
|
+
FYSEP: true,
|
|
261
|
+
FYOCT: true,
|
|
262
|
+
FYNOV: true,
|
|
259
263
|
getRelativePeriodsOptionsById: true,
|
|
260
264
|
getRelativePeriodsName: true,
|
|
261
265
|
getRelativePeriodsDetails: true,
|
|
@@ -707,6 +711,18 @@ Object.defineProperty(exports, "FYAPR", {
|
|
|
707
711
|
return _index12.FYAPR;
|
|
708
712
|
}
|
|
709
713
|
});
|
|
714
|
+
Object.defineProperty(exports, "FYAUG", {
|
|
715
|
+
enumerable: true,
|
|
716
|
+
get: function () {
|
|
717
|
+
return _index12.FYAUG;
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
Object.defineProperty(exports, "FYFEB", {
|
|
721
|
+
enumerable: true,
|
|
722
|
+
get: function () {
|
|
723
|
+
return _index12.FYFEB;
|
|
724
|
+
}
|
|
725
|
+
});
|
|
710
726
|
Object.defineProperty(exports, "FYJUL", {
|
|
711
727
|
enumerable: true,
|
|
712
728
|
get: function () {
|
|
@@ -725,6 +741,12 @@ Object.defineProperty(exports, "FYOCT", {
|
|
|
725
741
|
return _index12.FYOCT;
|
|
726
742
|
}
|
|
727
743
|
});
|
|
744
|
+
Object.defineProperty(exports, "FYSEP", {
|
|
745
|
+
enumerable: true,
|
|
746
|
+
get: function () {
|
|
747
|
+
return _index12.FYSEP;
|
|
748
|
+
}
|
|
749
|
+
});
|
|
728
750
|
Object.defineProperty(exports, "FileMenu", {
|
|
729
751
|
enumerable: true,
|
|
730
752
|
get: function () {
|
|
@@ -1313,6 +1335,12 @@ Object.defineProperty(exports, "WEEKLY", {
|
|
|
1313
1335
|
return _index12.WEEKLY;
|
|
1314
1336
|
}
|
|
1315
1337
|
});
|
|
1338
|
+
Object.defineProperty(exports, "WEEKLYFRI", {
|
|
1339
|
+
enumerable: true,
|
|
1340
|
+
get: function () {
|
|
1341
|
+
return _index12.WEEKLYFRI;
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1316
1344
|
Object.defineProperty(exports, "WEEKLYSAT", {
|
|
1317
1345
|
enumerable: true,
|
|
1318
1346
|
get: function () {
|
|
@@ -3,7 +3,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
3
3
|
import { getNowInCalendar } from '@dhis2/multi-calendar-dates';
|
|
4
4
|
import { IconInfo16, NoticeBox, TabBar, Tab, Transfer } from '@dhis2/ui';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import React, { useRef, useState, useMemo } from 'react';
|
|
6
|
+
import React, { useCallback, useRef, useState, useMemo } from 'react';
|
|
7
7
|
import PeriodIcon from '../../assets/DimensionItemIcons/PeriodIcon.js'; //TODO: Reimplement the icon.js
|
|
8
8
|
import i18n from '../../locales/index.js';
|
|
9
9
|
import { TRANSFER_HEIGHT, TRANSFER_OPTIONS_WIDTH, TRANSFER_SELECTED_WIDTH } from '../../modules/dimensionSelectorHelper.js';
|
|
@@ -13,7 +13,7 @@ import FixedPeriodFilter from './FixedPeriodFilter.js';
|
|
|
13
13
|
import RelativePeriodFilter from './RelativePeriodFilter.js';
|
|
14
14
|
import { applyDisplayLabelOverrides, applyFixedPeriodTypeDisplayLabels, filterEnabledFixedPeriodTypes, filterEnabledRelativePeriodTypes } from './utils/enabledPeriodTypes.js';
|
|
15
15
|
import { getFixedPeriodsOptions } from './utils/fixedPeriods.js';
|
|
16
|
-
import { MONTHLY, QUARTERLY, filterPeriodTypesById } from './utils/index.js';
|
|
16
|
+
import { FYFEB, FYAUG, FYSEP, MONTHLY, QUARTERLY, WEEKLYFRI, filterPeriodTypesById } from './utils/index.js';
|
|
17
17
|
import { getRelativePeriodsOptions } from './utils/relativePeriods.js';
|
|
18
18
|
const RightHeader = ({
|
|
19
19
|
infoBoxMessage
|
|
@@ -74,9 +74,11 @@ const PeriodTransfer = ({
|
|
|
74
74
|
} else {
|
|
75
75
|
const allFixed = getFixedPeriodsOptions(periodsSettings);
|
|
76
76
|
const allRelative = getRelativePeriodsOptions();
|
|
77
|
+
const v43PeriodTypes = [WEEKLYFRI, FYFEB, FYAUG, FYSEP];
|
|
78
|
+
const allExcludedPeriodTypes = [...excludedPeriodTypes, ...v43PeriodTypes];
|
|
77
79
|
return {
|
|
78
|
-
filteredFixedOptions: filterPeriodTypesById(allFixed,
|
|
79
|
-
filteredRelativeOptions: filterPeriodTypesById(allRelative,
|
|
80
|
+
filteredFixedOptions: filterPeriodTypesById(allFixed, allExcludedPeriodTypes),
|
|
81
|
+
filteredRelativeOptions: filterPeriodTypesById(allRelative, allExcludedPeriodTypes)
|
|
80
82
|
};
|
|
81
83
|
}
|
|
82
84
|
}, [supportsEnabledPeriodTypes, enabledPeriodTypesData, excludedPeriodTypes, periodsSettings]);
|
|
@@ -95,11 +97,11 @@ const PeriodTransfer = ({
|
|
|
95
97
|
// use ".eraYear" rather than ".year" because in Ethiopian calendar, eraYear is what our users expect to see (for other calendars, it doesn't matter)
|
|
96
98
|
// there is still a pending decision in Temporal regarding which era to use by default: https://github.com/js-temporal/temporal-polyfill/blob/9350ee7dd0d29f329fc097debf923a517c32f813/lib/calendar.ts#L1964
|
|
97
99
|
const defaultFixedPeriodYear = now.eraYear || now.year;
|
|
98
|
-
const fixedPeriodConfig = year => ({
|
|
100
|
+
const fixedPeriodConfig = useCallback(year => ({
|
|
99
101
|
offset: year - defaultFixedPeriodYear,
|
|
100
102
|
filterFuturePeriods: false,
|
|
101
103
|
reversePeriods: false
|
|
102
|
-
});
|
|
104
|
+
}), [defaultFixedPeriodYear]);
|
|
103
105
|
const [userPeriods, setUserPeriods] = useState(null);
|
|
104
106
|
const [isRelative, setIsRelative] = useState(true);
|
|
105
107
|
const [relativeFilter, setRelativeFilter] = useState({
|
|
@@ -144,7 +146,7 @@ const PeriodTransfer = ({
|
|
|
144
146
|
const opt = filteredFixedOptions.find(o => o.id === effectiveFixedFilterType);
|
|
145
147
|
return (opt === null || opt === void 0 ? void 0 : opt.getPeriods(fixedPeriodConfig(Number(fixedFilter.year)))) || [];
|
|
146
148
|
}
|
|
147
|
-
}, [isRelative, effectiveRelativeFilterType, effectiveFixedFilterType, filteredRelativeOptions, filteredFixedOptions, fixedFilter.year]);
|
|
149
|
+
}, [isRelative, effectiveRelativeFilterType, effectiveFixedFilterType, filteredRelativeOptions, filteredFixedOptions, fixedFilter.year, fixedPeriodConfig]);
|
|
148
150
|
const allPeriods = userPeriods !== null && userPeriods !== void 0 ? userPeriods : derivedPeriods;
|
|
149
151
|
const isActive = value => {
|
|
150
152
|
const item = selectedItems.find(item => item.id === value);
|
package/build/es/index.js
CHANGED
|
@@ -145,7 +145,7 @@ export { transformResponse as transformEventAggregateResponse } from './modules/
|
|
|
145
145
|
export { COLOR_SET_DEFAULT, COLOR_SET_BASIC, COLOR_SET_EXTENDED, COLOR_SET_BRIGHT, COLOR_SET_DARK, COLOR_SET_GRAY, COLOR_SET_COLOR_BLIND, COLOR_SET_PATTERNS, colorSets } from './visualizations/util/colors/colorSets.js';
|
|
146
146
|
|
|
147
147
|
// Utils: periods
|
|
148
|
-
export { DAILY, WEEKLY, WEEKLYWED, WEEKLYTHU, WEEKLYSAT, WEEKLYSUN, WEEKS_THIS_YEAR, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SIXMONTHLY, SIXMONTHLYAPR, YEARLY, FINANCIAL,
|
|
148
|
+
export { DAILY, WEEKLY, WEEKLYWED, WEEKLYTHU, WEEKLYFRI, WEEKLYSAT, WEEKLYSUN, WEEKS_THIS_YEAR, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SIXMONTHLY, SIXMONTHLYAPR, YEARLY, FINANCIAL, FYFEB, FYAPR, FYJUL, FYAUG, FYSEP, FYOCT, FYNOV } from './components/PeriodDimension/utils/index.js';
|
|
149
149
|
export { getRelativePeriodsOptionsById, getRelativePeriodsName, getRelativePeriodsDetails } from './components/PeriodDimension/utils/relativePeriods.js';
|
|
150
150
|
export { getFixedPeriodsOptionsById, PERIOD_TYPE_REGEX } from './components/PeriodDimension/utils/fixedPeriods.js';
|
|
151
151
|
export { default as VisualizationOptions } from './components/Options/VisualizationOptions.js';
|