@dhis2/analytics 24.9.0-alpha.1 → 24.9.1

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [24.9.1](https://github.com/dhis2/analytics/compare/v24.9.0...v24.9.1) (2023-03-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * spacing in Rename and SaveAs dialogs ([#1447](https://github.com/dhis2/analytics/issues/1447)) ([35e1872](https://github.com/dhis2/analytics/commit/35e18724ff88a09d13deedb54e897ad2506c4f08))
7
+
8
+ # [24.9.0](https://github.com/dhis2/analytics/compare/v24.8.0...v24.9.0) (2023-02-24)
9
+
10
+
11
+ ### Features
12
+
13
+ * merge multi-calendar support from alpha to master ([#1434](https://github.com/dhis2/analytics/issues/1434)) ([3cdac8f](https://github.com/dhis2/analytics/commit/3cdac8fdefc7a15a3fef0940183ca92f03b0f57c))
14
+
1
15
  # [24.9.0-alpha.1](https://github.com/dhis2/analytics/compare/v24.8.0...v24.9.0-alpha.1) (2023-02-23)
2
16
 
3
17
 
@@ -3,10 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.fileMenuStyles = void 0;
6
+ exports.modalStyles = exports.fileMenuStyles = void 0;
7
7
 
8
8
  var _ui = require("@dhis2/ui");
9
9
 
10
10
  const fileMenuStyles = [".menu-toggle.jsx-2670121391{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;font-size:14px;font-weight:400;text-transform:none;padding:6px ".concat(_ui.spacers.dp12, ";border-radius:3px;color:").concat(_ui.colors.grey900, ";box-sizing:border-box;line-height:1.75;background:none;border:none;-webkit-transition:background-color 250ms cubic-bezier(0.4,0,0.2,1) 0ms;transition:background-color 250ms cubic-bezier(0.4,0,0.2,1) 0ms;cursor:pointer;}"), ".menu-toggle.jsx-2670121391:hover.jsx-2670121391:enabled{background-color:".concat(_ui.colors.grey200, ";}"), ".menu-toggle.jsx-2670121391:disabled{color:".concat(_ui.colors.grey400, ";cursor:not-allowed;}"), ".menu-toggle.jsx-2670121391:active{background-color:".concat(_ui.colors.grey300, ";}"), ".menuButton.jsx-2670121391:focus{outline:2px solid ".concat(_ui.colors.blue600, ";}"), ".menuButton.jsx-2670121391:focus.jsx-2670121391:not(:focus-visible){outline:none;}"];
11
11
  exports.fileMenuStyles = fileMenuStyles;
12
- fileMenuStyles.__hash = "2670121391";
12
+ fileMenuStyles.__hash = "2670121391";
13
+ const modalStyles = [".modal-content.jsx-3091623050{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:".concat(_ui.spacers.dp12, ";}")];
14
+ exports.modalStyles = modalStyles;
15
+ modalStyles.__hash = "3091623050";
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.RenameDialog = void 0;
7
7
 
8
+ var _style = _interopRequireDefault(require("styled-jsx/style"));
9
+
8
10
  var _appRuntime = require("@dhis2/app-runtime");
9
11
 
10
12
  var _ui = require("@dhis2/ui");
@@ -15,6 +17,8 @@ var _react = _interopRequireWildcard(require("react"));
15
17
 
16
18
  var _index = _interopRequireDefault(require("../../locales/index.js"));
17
19
 
20
+ var _FileMenuStyles = require("./FileMenu.styles.js");
21
+
18
22
  var _utils = require("./utils.js");
19
23
 
20
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -55,7 +59,7 @@ const RenameDialog = _ref3 => {
55
59
  } = _ref3;
56
60
  const [name, setName] = (0, _react.useState)(object.name);
57
61
  const [description, setDescription] = (0, _react.useState)(object.description);
58
- const mutation = (0, _react.useMemo)(() => getMutation(type), []);
62
+ const mutation = (0, _react.useMemo)(() => getMutation(type), [type]);
59
63
  const [mutate, {
60
64
  loading
61
65
  }] = (0, _appRuntime.useDataMutation)(mutation, {
@@ -82,9 +86,13 @@ const RenameDialog = _ref3 => {
82
86
 
83
87
  return /*#__PURE__*/_react.default.createElement(_ui.Modal, {
84
88
  onClose: onClose
85
- }, /*#__PURE__*/_react.default.createElement(_ui.ModalTitle, null, _index.default.t('Rename {{fileType}}', {
89
+ }, /*#__PURE__*/_react.default.createElement(_style.default, {
90
+ id: _FileMenuStyles.modalStyles.__hash
91
+ }, _FileMenuStyles.modalStyles), /*#__PURE__*/_react.default.createElement(_ui.ModalTitle, null, _index.default.t('Rename {{fileType}}', {
86
92
  fileType: (0, _utils.labelForFileType)(type)
87
- })), /*#__PURE__*/_react.default.createElement(_ui.ModalContent, null, /*#__PURE__*/_react.default.createElement(_ui.InputField, {
93
+ })), /*#__PURE__*/_react.default.createElement(_ui.ModalContent, null, /*#__PURE__*/_react.default.createElement("div", {
94
+ className: "jsx-".concat(_FileMenuStyles.modalStyles.__hash) + " " + "modal-content"
95
+ }, /*#__PURE__*/_react.default.createElement(_ui.InputField, {
88
96
  label: _index.default.t('Name'),
89
97
  disabled: loading,
90
98
  required: true,
@@ -106,7 +114,7 @@ const RenameDialog = _ref3 => {
106
114
  } = _ref5;
107
115
  return setDescription(value);
108
116
  }
109
- })), /*#__PURE__*/_react.default.createElement(_ui.ModalActions, null, /*#__PURE__*/_react.default.createElement(_ui.ButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
117
+ }))), /*#__PURE__*/_react.default.createElement(_ui.ModalActions, null, /*#__PURE__*/_react.default.createElement(_ui.ButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
110
118
  onClick: onClose,
111
119
  disabled: loading,
112
120
  secondary: true
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SaveAsDialog = void 0;
7
7
 
8
+ var _style = _interopRequireDefault(require("styled-jsx/style"));
9
+
8
10
  var _ui = require("@dhis2/ui");
9
11
 
10
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -13,6 +15,8 @@ var _react = _interopRequireWildcard(require("react"));
13
15
 
14
16
  var _index = _interopRequireDefault(require("../../locales/index.js"));
15
17
 
18
+ var _FileMenuStyles = require("./FileMenu.styles.js");
19
+
16
20
  var _utils = require("./utils.js");
17
21
 
18
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -46,9 +50,13 @@ const SaveAsDialog = _ref => {
46
50
  return /*#__PURE__*/_react.default.createElement(_ui.Modal, {
47
51
  onClose: onClose,
48
52
  dataTest: "file-menu-saveas-modal"
49
- }, /*#__PURE__*/_react.default.createElement(_ui.ModalTitle, null, _index.default.t('Save {{fileType}} as', {
53
+ }, /*#__PURE__*/_react.default.createElement(_style.default, {
54
+ id: _FileMenuStyles.modalStyles.__hash
55
+ }, _FileMenuStyles.modalStyles), /*#__PURE__*/_react.default.createElement(_ui.ModalTitle, null, _index.default.t('Save {{fileType}} as', {
50
56
  fileType: (0, _utils.labelForFileType)(type)
51
- })), /*#__PURE__*/_react.default.createElement(_ui.ModalContent, null, /*#__PURE__*/_react.default.createElement(_ui.InputField, {
57
+ })), /*#__PURE__*/_react.default.createElement(_ui.ModalContent, null, /*#__PURE__*/_react.default.createElement("div", {
58
+ className: "jsx-".concat(_FileMenuStyles.modalStyles.__hash) + " " + "modal-content"
59
+ }, /*#__PURE__*/_react.default.createElement(_ui.InputField, {
52
60
  label: _index.default.t('Name'),
53
61
  value: name,
54
62
  onChange: _ref2 => {
@@ -69,7 +77,7 @@ const SaveAsDialog = _ref => {
69
77
  return setDescription(value);
70
78
  },
71
79
  dataTest: "file-menu-saveas-modal-description"
72
- })), /*#__PURE__*/_react.default.createElement(_ui.ModalActions, null, /*#__PURE__*/_react.default.createElement(_ui.ButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
80
+ }))), /*#__PURE__*/_react.default.createElement(_ui.ModalActions, null, /*#__PURE__*/_react.default.createElement(_ui.ButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
73
81
  onClick: onClose,
74
82
  secondary: true,
75
83
  dataTest: "file-menu-saveas-modal-cancel"
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _appRuntime = require("@dhis2/app-runtime");
9
+
8
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
11
 
10
12
  var _react = _interopRequireDefault(require("react"));
@@ -15,6 +17,15 @@ var _PeriodTransfer = _interopRequireDefault(require("./PeriodTransfer.js"));
15
17
 
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
 
20
+ const userSettingsQuery = {
21
+ userSettings: {
22
+ resource: 'userSettings',
23
+ params: {
24
+ key: ['keyUiLocale']
25
+ }
26
+ }
27
+ };
28
+
18
29
  const PeriodDimension = _ref => {
19
30
  let {
20
31
  onSelect,
@@ -22,6 +33,24 @@ const PeriodDimension = _ref => {
22
33
  rightFooter,
23
34
  excludedPeriodTypes
24
35
  } = _ref;
36
+ const {
37
+ systemInfo
38
+ } = (0, _appRuntime.useConfig)();
39
+ const result = (0, _appRuntime.useDataQuery)(userSettingsQuery);
40
+ const {
41
+ calendar = 'gregory'
42
+ } = systemInfo;
43
+ const {
44
+ data: {
45
+ userSettings: {
46
+ keyUiLocale: locale
47
+ } = {}
48
+ } = {}
49
+ } = result;
50
+ const periodsSettings = {
51
+ calendar,
52
+ locale
53
+ };
25
54
 
26
55
  const selectPeriods = periods => {
27
56
  onSelect({
@@ -35,7 +64,8 @@ const PeriodDimension = _ref => {
35
64
  initialSelectedPeriods: selectedPeriods,
36
65
  rightFooter: rightFooter,
37
66
  dataTest: 'period-dimension',
38
- excludedPeriodTypes: excludedPeriodTypes
67
+ excludedPeriodTypes: excludedPeriodTypes,
68
+ periodsSettings: periodsSettings
39
69
  });
40
70
  };
41
71
 
@@ -7,8 +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
10
  var _multiCalendarDates = require("@dhis2/multi-calendar-dates");
13
11
 
14
12
  var _ui = require("@dhis2/ui");
@@ -45,44 +43,18 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
45
43
 
46
44
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
47
45
 
48
- const userSettingsQuery = {
49
- userSettings: {
50
- resource: 'userSettings',
51
- params: {
52
- key: ['keyUiLocale']
53
- }
54
- }
55
- };
56
-
57
46
  const PeriodTransfer = _ref => {
58
47
  let {
59
48
  onSelect,
60
49
  dataTest,
61
50
  initialSelectedPeriods,
62
51
  rightFooter,
63
- excludedPeriodTypes
52
+ excludedPeriodTypes,
53
+ periodsSettings
64
54
  } = _ref;
65
- const {
66
- systemInfo
67
- } = (0, _appRuntime.useConfig)();
68
- const result = (0, _appRuntime.useDataQuery)(userSettingsQuery);
69
- const {
70
- calendar = 'gregory'
71
- } = systemInfo;
72
- const {
73
- data: {
74
- userSettings: {
75
- keyUiLocale: locale
76
- } = {}
77
- } = {}
78
- } = result;
79
- const periodsSettings = {
80
- calendar,
81
- locale
82
- };
83
55
  const defaultRelativePeriodType = excludedPeriodTypes.includes(_index2.MONTHLY) ? (0, _relativePeriods.getRelativePeriodsOptionsById)(_index2.QUARTERLY) : (0, _relativePeriods.getRelativePeriodsOptionsById)(_index2.MONTHLY);
84
56
  const defaultFixedPeriodType = excludedPeriodTypes.includes(_index2.MONTHLY) ? (0, _fixedPeriods.getFixedPeriodsOptionsById)(_index2.QUARTERLY, periodsSettings) : (0, _fixedPeriods.getFixedPeriodsOptionsById)(_index2.MONTHLY, periodsSettings);
85
- const now = (0, _multiCalendarDates.getNowInCalendar)(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)
57
+ const now = (0, _multiCalendarDates.getNowInCalendar)(periodsSettings.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)
86
58
  // 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
87
59
 
88
60
  const defaultFixedPeriodYear = now.eraYear || now.year;
@@ -210,7 +182,11 @@ const PeriodTransfer = _ref => {
210
182
 
211
183
  PeriodTransfer.defaultProps = {
212
184
  initialSelectedPeriods: [],
213
- excludedPeriodTypes: []
185
+ excludedPeriodTypes: [],
186
+ periodsSettings: {
187
+ calendar: 'gregory',
188
+ locale: 'en'
189
+ }
214
190
  };
215
191
  PeriodTransfer.propTypes = {
216
192
  onSelect: _propTypes.default.func.isRequired,
@@ -220,6 +196,10 @@ PeriodTransfer.propTypes = {
220
196
  id: _propTypes.default.string,
221
197
  name: _propTypes.default.string
222
198
  })),
199
+ periodsSettings: _propTypes.default.shape({
200
+ calendar: _propTypes.default.string,
201
+ locale: _propTypes.default.string
202
+ }),
223
203
  rightFooter: _propTypes.default.node
224
204
  };
225
205
  var _default = PeriodTransfer;
@@ -8,6 +8,19 @@ var _PeriodDimension = _interopRequireDefault(require("../PeriodDimension.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
+ useDataQuery: () => ({
16
+ data: {
17
+ userSettings: {
18
+ keyUiLocale: 'en'
19
+ }
20
+ }
21
+ })
22
+ }));
23
+ afterEach(jest.clearAllMocks);
11
24
  describe('The Period Dimension component', () => {
12
25
  let props;
13
26
  let shallowPeriodDimension;
@@ -8,19 +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
- useDataQuery: () => ({
16
- data: {
17
- userSettings: {
18
- keyUiLocale: 'en'
19
- }
20
- }
21
- })
22
- }));
23
- afterEach(jest.clearAllMocks);
24
11
  describe('The Period Selector component', () => {
25
12
  let props;
26
13
  let shallowPeriodTransfer;
@@ -6,6 +6,12 @@ exports[`The Period Dimension component matches the snapshot 1`] = `
6
6
  excludedPeriodTypes={Array []}
7
7
  initialSelectedPeriods={Array []}
8
8
  onSelect={[Function]}
9
+ periodsSettings={
10
+ Object {
11
+ "calendar": "gregory",
12
+ "locale": "en",
13
+ }
14
+ }
9
15
  rightFooter={<React.Fragment />}
10
16
  />
11
17
  `;
@@ -1,3 +1,5 @@
1
1
  import { colors, spacers } from '@dhis2/ui';
2
2
  export const fileMenuStyles = [".menu-toggle.jsx-2670121391{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;font-size:14px;font-weight:400;text-transform:none;padding:6px ".concat(spacers.dp12, ";border-radius:3px;color:").concat(colors.grey900, ";box-sizing:border-box;line-height:1.75;background:none;border:none;-webkit-transition:background-color 250ms cubic-bezier(0.4,0,0.2,1) 0ms;transition:background-color 250ms cubic-bezier(0.4,0,0.2,1) 0ms;cursor:pointer;}"), ".menu-toggle.jsx-2670121391:hover.jsx-2670121391:enabled{background-color:".concat(colors.grey200, ";}"), ".menu-toggle.jsx-2670121391:disabled{color:".concat(colors.grey400, ";cursor:not-allowed;}"), ".menu-toggle.jsx-2670121391:active{background-color:".concat(colors.grey300, ";}"), ".menuButton.jsx-2670121391:focus{outline:2px solid ".concat(colors.blue600, ";}"), ".menuButton.jsx-2670121391:focus.jsx-2670121391:not(:focus-visible){outline:none;}"];
3
- fileMenuStyles.__hash = "2670121391";
3
+ fileMenuStyles.__hash = "2670121391";
4
+ export const modalStyles = [".modal-content.jsx-3091623050{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:".concat(spacers.dp12, ";}")];
5
+ modalStyles.__hash = "3091623050";
@@ -1,8 +1,10 @@
1
+ import _JSXStyle from "styled-jsx/style";
1
2
  import { useDataMutation } from '@dhis2/app-runtime';
2
3
  import { Modal, ModalTitle, ModalContent, ModalActions, ButtonStrip, Button, InputField, TextAreaField } from '@dhis2/ui';
3
4
  import PropTypes from 'prop-types';
4
5
  import React, { useMemo, useState } from 'react';
5
6
  import i18n from '../../locales/index.js';
7
+ import { modalStyles } from './FileMenu.styles.js';
6
8
  import { supportedFileTypes, endpointFromFileType, labelForFileType } from './utils.js';
7
9
 
8
10
  const getMutation = type => ({
@@ -37,7 +39,7 @@ export const RenameDialog = _ref3 => {
37
39
  } = _ref3;
38
40
  const [name, setName] = useState(object.name);
39
41
  const [description, setDescription] = useState(object.description);
40
- const mutation = useMemo(() => getMutation(type), []);
42
+ const mutation = useMemo(() => getMutation(type), [type]);
41
43
  const [mutate, {
42
44
  loading
43
45
  }] = useDataMutation(mutation, {
@@ -64,9 +66,13 @@ export const RenameDialog = _ref3 => {
64
66
 
65
67
  return /*#__PURE__*/React.createElement(Modal, {
66
68
  onClose: onClose
67
- }, /*#__PURE__*/React.createElement(ModalTitle, null, i18n.t('Rename {{fileType}}', {
69
+ }, /*#__PURE__*/React.createElement(_JSXStyle, {
70
+ id: modalStyles.__hash
71
+ }, modalStyles), /*#__PURE__*/React.createElement(ModalTitle, null, i18n.t('Rename {{fileType}}', {
68
72
  fileType: labelForFileType(type)
69
- })), /*#__PURE__*/React.createElement(ModalContent, null, /*#__PURE__*/React.createElement(InputField, {
73
+ })), /*#__PURE__*/React.createElement(ModalContent, null, /*#__PURE__*/React.createElement("div", {
74
+ className: "jsx-".concat(modalStyles.__hash) + " " + "modal-content"
75
+ }, /*#__PURE__*/React.createElement(InputField, {
70
76
  label: i18n.t('Name'),
71
77
  disabled: loading,
72
78
  required: true,
@@ -88,7 +94,7 @@ export const RenameDialog = _ref3 => {
88
94
  } = _ref5;
89
95
  return setDescription(value);
90
96
  }
91
- })), /*#__PURE__*/React.createElement(ModalActions, null, /*#__PURE__*/React.createElement(ButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
97
+ }))), /*#__PURE__*/React.createElement(ModalActions, null, /*#__PURE__*/React.createElement(ButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
92
98
  onClick: onClose,
93
99
  disabled: loading,
94
100
  secondary: true
@@ -1,7 +1,9 @@
1
+ import _JSXStyle from "styled-jsx/style";
1
2
  import { Modal, ModalTitle, ModalContent, ModalActions, ButtonStrip, Button, InputField, TextAreaField } from '@dhis2/ui';
2
3
  import PropTypes from 'prop-types';
3
4
  import React, { useState } from 'react';
4
5
  import i18n from '../../locales/index.js';
6
+ import { modalStyles } from './FileMenu.styles.js';
5
7
  import { supportedFileTypes, labelForFileType } from './utils.js';
6
8
  const NAME_MAXLENGTH = 230;
7
9
  export const SaveAsDialog = _ref => {
@@ -27,9 +29,13 @@ export const SaveAsDialog = _ref => {
27
29
  return /*#__PURE__*/React.createElement(Modal, {
28
30
  onClose: onClose,
29
31
  dataTest: "file-menu-saveas-modal"
30
- }, /*#__PURE__*/React.createElement(ModalTitle, null, i18n.t('Save {{fileType}} as', {
32
+ }, /*#__PURE__*/React.createElement(_JSXStyle, {
33
+ id: modalStyles.__hash
34
+ }, modalStyles), /*#__PURE__*/React.createElement(ModalTitle, null, i18n.t('Save {{fileType}} as', {
31
35
  fileType: labelForFileType(type)
32
- })), /*#__PURE__*/React.createElement(ModalContent, null, /*#__PURE__*/React.createElement(InputField, {
36
+ })), /*#__PURE__*/React.createElement(ModalContent, null, /*#__PURE__*/React.createElement("div", {
37
+ className: "jsx-".concat(modalStyles.__hash) + " " + "modal-content"
38
+ }, /*#__PURE__*/React.createElement(InputField, {
33
39
  label: i18n.t('Name'),
34
40
  value: name,
35
41
  onChange: _ref2 => {
@@ -50,7 +56,7 @@ export const SaveAsDialog = _ref => {
50
56
  return setDescription(value);
51
57
  },
52
58
  dataTest: "file-menu-saveas-modal-description"
53
- })), /*#__PURE__*/React.createElement(ModalActions, null, /*#__PURE__*/React.createElement(ButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
59
+ }))), /*#__PURE__*/React.createElement(ModalActions, null, /*#__PURE__*/React.createElement(ButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
54
60
  onClick: onClose,
55
61
  secondary: true,
56
62
  dataTest: "file-menu-saveas-modal-cancel"
@@ -1,7 +1,16 @@
1
+ import { useConfig, useDataQuery } from '@dhis2/app-runtime';
1
2
  import PropTypes from 'prop-types';
2
3
  import React from 'react';
3
4
  import { DIMENSION_ID_PERIOD } from '../../modules/predefinedDimensions.js';
4
5
  import PeriodTransfer from './PeriodTransfer.js';
6
+ const userSettingsQuery = {
7
+ userSettings: {
8
+ resource: 'userSettings',
9
+ params: {
10
+ key: ['keyUiLocale']
11
+ }
12
+ }
13
+ };
5
14
 
6
15
  const PeriodDimension = _ref => {
7
16
  let {
@@ -10,6 +19,24 @@ const PeriodDimension = _ref => {
10
19
  rightFooter,
11
20
  excludedPeriodTypes
12
21
  } = _ref;
22
+ const {
23
+ systemInfo
24
+ } = useConfig();
25
+ const result = useDataQuery(userSettingsQuery);
26
+ const {
27
+ calendar = 'gregory'
28
+ } = systemInfo;
29
+ const {
30
+ data: {
31
+ userSettings: {
32
+ keyUiLocale: locale
33
+ } = {}
34
+ } = {}
35
+ } = result;
36
+ const periodsSettings = {
37
+ calendar,
38
+ locale
39
+ };
13
40
 
14
41
  const selectPeriods = periods => {
15
42
  onSelect({
@@ -23,7 +50,8 @@ const PeriodDimension = _ref => {
23
50
  initialSelectedPeriods: selectedPeriods,
24
51
  rightFooter: rightFooter,
25
52
  dataTest: 'period-dimension',
26
- excludedPeriodTypes: excludedPeriodTypes
53
+ excludedPeriodTypes: excludedPeriodTypes,
54
+ periodsSettings: periodsSettings
27
55
  });
28
56
  };
29
57
 
@@ -2,7 +2,6 @@ import _JSXStyle from "styled-jsx/style";
2
2
 
3
3
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
- import { useConfig, useDataQuery } from '@dhis2/app-runtime';
6
5
  import { getNowInCalendar } from '@dhis2/multi-calendar-dates';
7
6
  import { TabBar, Tab, Transfer } from '@dhis2/ui';
8
7
  import PropTypes from 'prop-types';
@@ -18,14 +17,6 @@ import RelativePeriodFilter from './RelativePeriodFilter.js';
18
17
  import { getFixedPeriodsOptionsById } from './utils/fixedPeriods.js';
19
18
  import { MONTHLY, QUARTERLY } from './utils/index.js';
20
19
  import { getRelativePeriodsOptionsById } from './utils/relativePeriods.js';
21
- const userSettingsQuery = {
22
- userSettings: {
23
- resource: 'userSettings',
24
- params: {
25
- key: ['keyUiLocale']
26
- }
27
- }
28
- };
29
20
 
30
21
  const PeriodTransfer = _ref => {
31
22
  let {
@@ -33,29 +24,12 @@ const PeriodTransfer = _ref => {
33
24
  dataTest,
34
25
  initialSelectedPeriods,
35
26
  rightFooter,
36
- excludedPeriodTypes
27
+ excludedPeriodTypes,
28
+ periodsSettings
37
29
  } = _ref;
38
- const {
39
- systemInfo
40
- } = useConfig();
41
- const result = useDataQuery(userSettingsQuery);
42
- const {
43
- calendar = 'gregory'
44
- } = systemInfo;
45
- const {
46
- data: {
47
- userSettings: {
48
- keyUiLocale: locale
49
- } = {}
50
- } = {}
51
- } = result;
52
- const periodsSettings = {
53
- calendar,
54
- locale
55
- };
56
30
  const defaultRelativePeriodType = excludedPeriodTypes.includes(MONTHLY) ? getRelativePeriodsOptionsById(QUARTERLY) : getRelativePeriodsOptionsById(MONTHLY);
57
31
  const defaultFixedPeriodType = excludedPeriodTypes.includes(MONTHLY) ? getFixedPeriodsOptionsById(QUARTERLY, periodsSettings) : getFixedPeriodsOptionsById(MONTHLY, periodsSettings);
58
- const now = getNowInCalendar(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)
32
+ const now = getNowInCalendar(periodsSettings.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)
59
33
  // 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
60
34
 
61
35
  const defaultFixedPeriodYear = now.eraYear || now.year;
@@ -183,7 +157,11 @@ const PeriodTransfer = _ref => {
183
157
 
184
158
  PeriodTransfer.defaultProps = {
185
159
  initialSelectedPeriods: [],
186
- excludedPeriodTypes: []
160
+ excludedPeriodTypes: [],
161
+ periodsSettings: {
162
+ calendar: 'gregory',
163
+ locale: 'en'
164
+ }
187
165
  };
188
166
  PeriodTransfer.propTypes = {
189
167
  onSelect: PropTypes.func.isRequired,
@@ -193,6 +171,10 @@ PeriodTransfer.propTypes = {
193
171
  id: PropTypes.string,
194
172
  name: PropTypes.string
195
173
  })),
174
+ periodsSettings: PropTypes.shape({
175
+ calendar: PropTypes.string,
176
+ locale: PropTypes.string
177
+ }),
196
178
  rightFooter: PropTypes.node
197
179
  };
198
180
  export default PeriodTransfer;
@@ -1,6 +1,19 @@
1
1
  import { shallow } from 'enzyme';
2
2
  import React from 'react';
3
3
  import PeriodDimension from '../PeriodDimension.js';
4
+ jest.mock('@dhis2/app-runtime', () => ({
5
+ useConfig: () => ({
6
+ systemInfo: {}
7
+ }),
8
+ useDataQuery: () => ({
9
+ data: {
10
+ userSettings: {
11
+ keyUiLocale: 'en'
12
+ }
13
+ }
14
+ })
15
+ }));
16
+ afterEach(jest.clearAllMocks);
4
17
  describe('The Period Dimension component', () => {
5
18
  let props;
6
19
  let shallowPeriodDimension;
@@ -1,19 +1,6 @@
1
1
  import { shallow } from 'enzyme';
2
2
  import React from 'react';
3
3
  import PeriodTransfer from '../PeriodTransfer.js';
4
- jest.mock('@dhis2/app-runtime', () => ({
5
- useConfig: () => ({
6
- systemInfo: {}
7
- }),
8
- useDataQuery: () => ({
9
- data: {
10
- userSettings: {
11
- keyUiLocale: 'en'
12
- }
13
- }
14
- })
15
- }));
16
- afterEach(jest.clearAllMocks);
17
4
  describe('The Period Selector component', () => {
18
5
  let props;
19
6
  let shallowPeriodTransfer;
@@ -6,6 +6,12 @@ exports[`The Period Dimension component matches the snapshot 1`] = `
6
6
  excludedPeriodTypes={Array []}
7
7
  initialSelectedPeriods={Array []}
8
8
  onSelect={[Function]}
9
+ periodsSettings={
10
+ Object {
11
+ "calendar": "gregory",
12
+ "locale": "en",
13
+ }
14
+ }
9
15
  rightFooter={<React.Fragment />}
10
16
  />
11
17
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "24.9.0-alpha.1",
3
+ "version": "24.9.1",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {