@dhis2/analytics 24.5.0-alpha.1 → 24.6.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 +6 -4
- package/build/cjs/components/PeriodDimension/PeriodTransfer.js +4 -17
- package/build/cjs/components/PeriodDimension/__tests__/PeriodSelector.spec.js +0 -5
- package/build/cjs/components/PeriodDimension/utils/fixedPeriods.js +478 -205
- package/build/cjs/locales/en/translations.json +14 -0
- package/build/cjs/visualizations/config/generators/dhis/singleValue.js +76 -23
- package/build/cjs/visualizations/config/index.js +2 -1
- package/build/es/components/PeriodDimension/PeriodTransfer.js +4 -15
- package/build/es/components/PeriodDimension/__tests__/PeriodSelector.spec.js +0 -5
- package/build/es/components/PeriodDimension/utils/fixedPeriods.js +477 -203
- package/build/es/locales/en/translations.json +14 -0
- package/build/es/visualizations/config/generators/dhis/singleValue.js +79 -26
- package/build/es/visualizations/config/index.js +2 -1
- package/package.json +1 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
# [24.
|
|
1
|
+
# [24.6.0](https://github.com/dhis2/analytics/compare/v24.5.0...v24.6.0) (2023-02-13)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
###
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* single value background color change based upon legend (DHIS2-13702) ([#1402](https://github.com/dhis2/analytics/issues/1402)) ([ad437c6](https://github.com/dhis2/analytics/commit/ad437c6a1fcbcb71cee7b6945c6bc83ed2bc3bb3))
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
# [24.5.0](https://github.com/dhis2/analytics/compare/v24.4.2...v24.5.0) (2023-02-06)
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
### Features
|
|
10
12
|
|
|
11
|
-
* use multi-calendar-dates library to generate fixed periods ([acc3801](https://github.com/dhis2/analytics/commit/acc380156092f888cfa55f70b4bade1c6516d034))
|
|
13
|
+
* [reverted] use multi-calendar-dates library to generate fixed periods ([acc3801](https://github.com/dhis2/analytics/commit/acc380156092f888cfa55f70b4bade1c6516d034)). This work was added to "next" release channel, but was reverted afterwards because of the restrictions "next" channel puts on what can be released from master afterwards. It will be added to "alpha" channel instead until it's ready for the main channel.
|
|
12
14
|
|
|
13
15
|
## [24.4.2](https://github.com/dhis2/analytics/compare/v24.4.1...v24.4.2) (2023-01-25)
|
|
14
16
|
|
|
@@ -7,10 +7,6 @@ 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
|
-
|
|
14
10
|
var _ui = require("@dhis2/ui");
|
|
15
11
|
|
|
16
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -53,18 +49,9 @@ const PeriodTransfer = _ref => {
|
|
|
53
49
|
rightFooter,
|
|
54
50
|
excludedPeriodTypes
|
|
55
51
|
} = _ref;
|
|
56
|
-
const {
|
|
57
|
-
systemInfo
|
|
58
|
-
} = (0, _appRuntime.useConfig)();
|
|
59
|
-
const {
|
|
60
|
-
calendar = 'gregory'
|
|
61
|
-
} = systemInfo;
|
|
62
52
|
const defaultRelativePeriodType = excludedPeriodTypes.includes(_index2.MONTHLY) ? (0, _relativePeriods.getRelativePeriodsOptionsById)(_index2.QUARTERLY) : (0, _relativePeriods.getRelativePeriodsOptionsById)(_index2.MONTHLY);
|
|
63
|
-
const defaultFixedPeriodType = excludedPeriodTypes.includes(_index2.MONTHLY) ? (0, _fixedPeriods.getFixedPeriodsOptionsById)(_index2.QUARTERLY
|
|
64
|
-
const
|
|
65
|
-
// 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
|
|
66
|
-
|
|
67
|
-
const defaultFixedPeriodYear = now.eraYear || now.year;
|
|
53
|
+
const defaultFixedPeriodType = excludedPeriodTypes.includes(_index2.MONTHLY) ? (0, _fixedPeriods.getFixedPeriodsOptionsById)(_index2.QUARTERLY) : (0, _fixedPeriods.getFixedPeriodsOptionsById)(_index2.MONTHLY);
|
|
54
|
+
const defaultFixedPeriodYear = new Date().getFullYear();
|
|
68
55
|
|
|
69
56
|
const fixedPeriodConfig = year => ({
|
|
70
57
|
offset: year - defaultFixedPeriodYear,
|
|
@@ -86,7 +73,7 @@ const PeriodTransfer = _ref => {
|
|
|
86
73
|
const onIsRelativeClick = state => {
|
|
87
74
|
if (state !== isRelative) {
|
|
88
75
|
setIsRelative(state);
|
|
89
|
-
setAllPeriods(state ? (0, _relativePeriods.getRelativePeriodsOptionsById)(relativeFilter.periodType).getPeriods() : (0, _fixedPeriods.getFixedPeriodsOptionsById)(fixedFilter.periodType
|
|
76
|
+
setAllPeriods(state ? (0, _relativePeriods.getRelativePeriodsOptionsById)(relativeFilter.periodType).getPeriods() : (0, _fixedPeriods.getFixedPeriodsOptionsById)(fixedFilter.periodType).getPeriods(fixedPeriodConfig(Number(fixedFilter.year))));
|
|
90
77
|
}
|
|
91
78
|
};
|
|
92
79
|
|
|
@@ -139,7 +126,7 @@ const PeriodTransfer = _ref => {
|
|
|
139
126
|
|
|
140
127
|
const onSelectFixedPeriods = filter => {
|
|
141
128
|
setFixedFilter(filter);
|
|
142
|
-
setAllPeriods((0, _fixedPeriods.getFixedPeriodsOptionsById)(filter.periodType
|
|
129
|
+
setAllPeriods((0, _fixedPeriods.getFixedPeriodsOptionsById)(filter.periodType).getPeriods(fixedPeriodConfig(Number(filter.year))));
|
|
143
130
|
};
|
|
144
131
|
|
|
145
132
|
const renderEmptySelection = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("p", {
|
|
@@ -8,11 +8,6 @@ var _PeriodTransfer = _interopRequireDefault(require("../PeriodTransfer.js"));
|
|
|
8
8
|
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
|
|
11
|
-
jest.mock('@dhis2/app-runtime', () => ({
|
|
12
|
-
useConfig: () => ({
|
|
13
|
-
systemInfo: {}
|
|
14
|
-
})
|
|
15
|
-
}));
|
|
16
11
|
describe('The Period Selector component', () => {
|
|
17
12
|
let props;
|
|
18
13
|
let shallowPeriodTransfer;
|