@dhis2/analytics 29.0.1 → 29.0.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.
@@ -24,11 +24,15 @@ const Comment = ({
24
24
  setCommentText(newText);
25
25
  setIsUpdateMode(false);
26
26
  }, []);
27
+ const onUpdateCancel = (0, _react.useCallback)(() => {
28
+ setIsUpdateMode(false);
29
+ }, []);
27
30
  const commentAccess = (0, _hooks.useCommentAccess)(comment, canComment);
28
31
  return isUpdateMode ? /*#__PURE__*/_react.default.createElement(_CommentUpdateForm.CommentUpdateForm, {
29
32
  onComplete: onUpdateComplete,
33
+ onCancel: onUpdateCancel,
30
34
  id: comment.id,
31
- text: comment.text
35
+ text: commentText
32
36
  }) : /*#__PURE__*/_react.default.createElement(_index.Message, {
33
37
  text: commentText,
34
38
  created: comment.created,
@@ -17,6 +17,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
17
17
  const CommentUpdateForm = ({
18
18
  id,
19
19
  text,
20
+ onCancel,
20
21
  onComplete
21
22
  }) => {
22
23
  const currentUser = (0, _hooks.useInterpretationsCurrentUser)();
@@ -49,7 +50,7 @@ const CommentUpdateForm = ({
49
50
  disabled: loading,
50
51
  secondary: true,
51
52
  small: true,
52
- onClick: onComplete
53
+ onClick: onCancel
53
54
  }, _d2I18n.default.t('Cancel')))), /*#__PURE__*/_react.default.createElement(_style.default, {
54
55
  id: "2690082310",
55
56
  dynamic: [_ui.spacers.dp8, _ui.spacers.dp8, _ui.colors.grey100]
@@ -58,6 +59,7 @@ const CommentUpdateForm = ({
58
59
  exports.CommentUpdateForm = CommentUpdateForm;
59
60
  CommentUpdateForm.propTypes = {
60
61
  id: _propTypes.default.string.isRequired,
62
+ onCancel: _propTypes.default.func.isRequired,
61
63
  onComplete: _propTypes.default.func.isRequired,
62
64
  text: _propTypes.default.string
63
65
  };
@@ -40,7 +40,6 @@ const InterpretationModal = ({
40
40
  initialFocus,
41
41
  pluginComponent: VisualizationPlugin
42
42
  }) => {
43
- var _currentUser$settings;
44
43
  const modalContentWidth = (0, _useModalContentWidth.useModalContentWidth)();
45
44
  const modalContentCSS = getModalContentCSS(modalContentWidth);
46
45
  const currentUser = (0, _hooks.useInterpretationsCurrentUser)();
@@ -56,6 +55,15 @@ const InterpretationModal = ({
56
55
  relativePeriodDate: interpretation === null || interpretation === void 0 ? void 0 : interpretation.created
57
56
  };
58
57
  }, [interpretation === null || interpretation === void 0 ? void 0 : interpretation.created]);
58
+ const displayProperty = (0, _react.useMemo)(() => {
59
+ var _ref, _currentUser$settings, _currentUser$settings2, _currentUser$settings3;
60
+ return (// DV and EVER apps
61
+ (_ref = (_currentUser$settings = (_currentUser$settings2 = currentUser.settings) === null || _currentUser$settings2 === void 0 ? void 0 : _currentUser$settings2.displayProperty) !== null && _currentUser$settings !== void 0 ? _currentUser$settings : // LL app
62
+ (_currentUser$settings3 = currentUser.settings) === null || _currentUser$settings3 === void 0 ? void 0 : _currentUser$settings3.keyAnalysisDisplayProperty) !== null && _ref !== void 0 ? _ref :
63
+ // Maps app
64
+ currentUser.keyAnalysisDisplayProperty
65
+ );
66
+ }, [currentUser]);
59
67
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, loadingInProgress && /*#__PURE__*/_react.default.createElement(_ui.Layer, null, /*#__PURE__*/_react.default.createElement(_ui.CenteredContent, null, /*#__PURE__*/_react.default.createElement(_ui.CircularLoader, null))), /*#__PURE__*/_react.default.createElement(_ui.Modal, {
60
68
  fluid: true,
61
69
  onClose: onClose,
@@ -85,7 +93,7 @@ const InterpretationModal = ({
85
93
  filters: filters,
86
94
  visualization: visualization,
87
95
  onResponsesReceived: onResponsesReceived,
88
- displayProperty: (_currentUser$settings = currentUser.settings) === null || _currentUser$settings === void 0 ? void 0 : _currentUser$settings.keyAnalysisDisplayProperty,
96
+ displayProperty: displayProperty,
89
97
  isInModal: true,
90
98
  className: _style.default.dynamic([["2014146191", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]])
91
99
  })), /*#__PURE__*/_react.default.createElement("div", {
@@ -16,11 +16,15 @@ const Comment = ({
16
16
  setCommentText(newText);
17
17
  setIsUpdateMode(false);
18
18
  }, []);
19
+ const onUpdateCancel = useCallback(() => {
20
+ setIsUpdateMode(false);
21
+ }, []);
19
22
  const commentAccess = useCommentAccess(comment, canComment);
20
23
  return isUpdateMode ? /*#__PURE__*/React.createElement(CommentUpdateForm, {
21
24
  onComplete: onUpdateComplete,
25
+ onCancel: onUpdateCancel,
22
26
  id: comment.id,
23
- text: comment.text
27
+ text: commentText
24
28
  }) : /*#__PURE__*/React.createElement(Message, {
25
29
  text: commentText,
26
30
  created: comment.created,
@@ -9,6 +9,7 @@ import { useInterpretationsCurrentUser, useUpdateCommentForActiveInterpretation
9
9
  export const CommentUpdateForm = ({
10
10
  id,
11
11
  text,
12
+ onCancel,
12
13
  onComplete
13
14
  }) => {
14
15
  const currentUser = useInterpretationsCurrentUser();
@@ -41,7 +42,7 @@ export const CommentUpdateForm = ({
41
42
  disabled: loading,
42
43
  secondary: true,
43
44
  small: true,
44
- onClick: onComplete
45
+ onClick: onCancel
45
46
  }, i18n.t('Cancel')))), /*#__PURE__*/React.createElement(_JSXStyle, {
46
47
  id: "2690082310",
47
48
  dynamic: [spacers.dp8, spacers.dp8, colors.grey100]
@@ -49,6 +50,7 @@ export const CommentUpdateForm = ({
49
50
  };
50
51
  CommentUpdateForm.propTypes = {
51
52
  id: PropTypes.string.isRequired,
53
+ onCancel: PropTypes.func.isRequired,
52
54
  onComplete: PropTypes.func.isRequired,
53
55
  text: PropTypes.string
54
56
  };
@@ -32,7 +32,6 @@ const InterpretationModal = ({
32
32
  initialFocus,
33
33
  pluginComponent: VisualizationPlugin
34
34
  }) => {
35
- var _currentUser$settings;
36
35
  const modalContentWidth = useModalContentWidth();
37
36
  const modalContentCSS = getModalContentCSS(modalContentWidth);
38
37
  const currentUser = useInterpretationsCurrentUser();
@@ -48,6 +47,15 @@ const InterpretationModal = ({
48
47
  relativePeriodDate: interpretation === null || interpretation === void 0 ? void 0 : interpretation.created
49
48
  };
50
49
  }, [interpretation === null || interpretation === void 0 ? void 0 : interpretation.created]);
50
+ const displayProperty = useMemo(() => {
51
+ var _ref, _currentUser$settings, _currentUser$settings2, _currentUser$settings3;
52
+ return (// DV and EVER apps
53
+ (_ref = (_currentUser$settings = (_currentUser$settings2 = currentUser.settings) === null || _currentUser$settings2 === void 0 ? void 0 : _currentUser$settings2.displayProperty) !== null && _currentUser$settings !== void 0 ? _currentUser$settings : // LL app
54
+ (_currentUser$settings3 = currentUser.settings) === null || _currentUser$settings3 === void 0 ? void 0 : _currentUser$settings3.keyAnalysisDisplayProperty) !== null && _ref !== void 0 ? _ref :
55
+ // Maps app
56
+ currentUser.keyAnalysisDisplayProperty
57
+ );
58
+ }, [currentUser]);
51
59
  return /*#__PURE__*/React.createElement(React.Fragment, null, loadingInProgress && /*#__PURE__*/React.createElement(Layer, null, /*#__PURE__*/React.createElement(CenteredContent, null, /*#__PURE__*/React.createElement(CircularLoader, null))), /*#__PURE__*/React.createElement(Modal, {
52
60
  fluid: true,
53
61
  onClose: onClose,
@@ -77,7 +85,7 @@ const InterpretationModal = ({
77
85
  filters: filters,
78
86
  visualization: visualization,
79
87
  onResponsesReceived: onResponsesReceived,
80
- displayProperty: (_currentUser$settings = currentUser.settings) === null || _currentUser$settings === void 0 ? void 0 : _currentUser$settings.keyAnalysisDisplayProperty,
88
+ displayProperty: displayProperty,
81
89
  isInModal: true,
82
90
  className: _JSXStyle.dynamic([["2014146191", [colors.grey900, spacers.dp24, spacers.dp4, spacers.dp4]]])
83
91
  })), /*#__PURE__*/React.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "29.0.1",
3
+ "version": "29.0.2",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {