@dhis2/analytics 24.4.2 → 24.5.0
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/CHANGELOG.md +7 -0
- package/build/cjs/components/PeriodDimension/PeriodTransfer.js +16 -4
- package/build/cjs/components/PeriodDimension/utils/fixedPeriods.js +204 -478
- package/build/cjs/locales/en/translations.json +0 -14
- package/build/es/components/PeriodDimension/PeriodTransfer.js +14 -4
- package/build/es/components/PeriodDimension/utils/fixedPeriods.js +202 -477
- package/build/es/locales/en/translations.json +0 -14
- package/package.json +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [24.5.0](https://github.com/dhis2/analytics/compare/v24.4.2...v24.5.0) (2023-02-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* use multi-calendar-dates library to generate fixed periods ([acc3801](https://github.com/dhis2/analytics/commit/acc380156092f888cfa55f70b4bade1c6516d034))
|
|
7
|
+
|
|
1
8
|
## [24.4.2](https://github.com/dhis2/analytics/compare/v24.4.1...v24.4.2) (2023-01-25)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -7,6 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
9
|
|
|
10
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
11
|
+
|
|
12
|
+
var _multiCalendarDates = require("@dhis2/multi-calendar-dates");
|
|
13
|
+
|
|
10
14
|
var _ui = require("@dhis2/ui");
|
|
11
15
|
|
|
12
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -49,9 +53,17 @@ const PeriodTransfer = _ref => {
|
|
|
49
53
|
rightFooter,
|
|
50
54
|
excludedPeriodTypes
|
|
51
55
|
} = _ref;
|
|
56
|
+
const {
|
|
57
|
+
systemInfo = {}
|
|
58
|
+
} = (0, _appRuntime.useConfig)();
|
|
59
|
+
const {
|
|
60
|
+
calendar = 'gregory'
|
|
61
|
+
} = systemInfo;
|
|
52
62
|
const defaultRelativePeriodType = excludedPeriodTypes.includes(_index2.MONTHLY) ? (0, _relativePeriods.getRelativePeriodsOptionsById)(_index2.QUARTERLY) : (0, _relativePeriods.getRelativePeriodsOptionsById)(_index2.MONTHLY);
|
|
53
|
-
const defaultFixedPeriodType = excludedPeriodTypes.includes(_index2.MONTHLY) ? (0, _fixedPeriods.getFixedPeriodsOptionsById)(_index2.QUARTERLY) : (0, _fixedPeriods.getFixedPeriodsOptionsById)(_index2.MONTHLY);
|
|
54
|
-
|
|
63
|
+
const defaultFixedPeriodType = excludedPeriodTypes.includes(_index2.MONTHLY) ? (0, _fixedPeriods.getFixedPeriodsOptionsById)(_index2.QUARTERLY, calendar) : (0, _fixedPeriods.getFixedPeriodsOptionsById)(_index2.MONTHLY, calendar); // use ".eraYear" rather than ".year" because in Ethiopian calendar, eraYear is what our users expect to see (for other calendars, it doesn't matter)
|
|
64
|
+
// 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
|
|
65
|
+
|
|
66
|
+
const defaultFixedPeriodYear = (0, _multiCalendarDates.getNowInCalendar)(calendar).eraYear;
|
|
55
67
|
|
|
56
68
|
const fixedPeriodConfig = year => ({
|
|
57
69
|
offset: year - defaultFixedPeriodYear,
|
|
@@ -73,7 +85,7 @@ const PeriodTransfer = _ref => {
|
|
|
73
85
|
const onIsRelativeClick = state => {
|
|
74
86
|
if (state !== isRelative) {
|
|
75
87
|
setIsRelative(state);
|
|
76
|
-
setAllPeriods(state ? (0, _relativePeriods.getRelativePeriodsOptionsById)(relativeFilter.periodType).getPeriods() : (0, _fixedPeriods.getFixedPeriodsOptionsById)(fixedFilter.periodType).getPeriods(fixedPeriodConfig(Number(fixedFilter.year))));
|
|
88
|
+
setAllPeriods(state ? (0, _relativePeriods.getRelativePeriodsOptionsById)(relativeFilter.periodType).getPeriods() : (0, _fixedPeriods.getFixedPeriodsOptionsById)(fixedFilter.periodType, calendar).getPeriods(fixedPeriodConfig(Number(fixedFilter.year))));
|
|
77
89
|
}
|
|
78
90
|
};
|
|
79
91
|
|
|
@@ -126,7 +138,7 @@ const PeriodTransfer = _ref => {
|
|
|
126
138
|
|
|
127
139
|
const onSelectFixedPeriods = filter => {
|
|
128
140
|
setFixedFilter(filter);
|
|
129
|
-
setAllPeriods((0, _fixedPeriods.getFixedPeriodsOptionsById)(filter.periodType).getPeriods(fixedPeriodConfig(Number(filter.year))));
|
|
141
|
+
setAllPeriods((0, _fixedPeriods.getFixedPeriodsOptionsById)(filter.periodType, calendar).getPeriods(fixedPeriodConfig(Number(filter.year)), calendar));
|
|
130
142
|
};
|
|
131
143
|
|
|
132
144
|
const renderEmptySelection = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("p", {
|