@dhis2/analytics 24.0.8 → 24.0.9

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,10 @@
1
+ ## [24.0.9](https://github.com/dhis2/analytics/compare/v24.0.8...v24.0.9) (2022-09-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * enable onShare callback and allow refresh AboutAOUnit (DHIS2-13667) ([#1332](https://github.com/dhis2/analytics/issues/1332)) ([80c2819](https://github.com/dhis2/analytics/commit/80c2819c62773947d7a3a2c3daa643f563e75880))
7
+
1
8
  ## [24.0.8](https://github.com/dhis2/analytics/compare/v24.0.7...v24.0.8) (2022-09-06)
2
9
 
3
10
 
@@ -70,7 +70,7 @@ const getUnsubscribeMutation = (type, id) => ({
70
70
  type: 'delete'
71
71
  });
72
72
 
73
- const AboutAOUnit = _ref3 => {
73
+ const AboutAOUnit = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
74
74
  var _data$ao$createdBy;
75
75
 
76
76
  let {
@@ -117,6 +117,9 @@ const AboutAOUnit = _ref3 => {
117
117
  });
118
118
  }
119
119
  }, [id, refetch]);
120
+ (0, _react.useImperativeHandle)(ref, () => ({
121
+ refresh: refetch
122
+ }), [refetch]);
120
123
 
121
124
  const getAccessLevelString = access => {
122
125
  const re = new RegExp("(?<accessLevel>".concat(READ_AND_WRITE, "?)"));
@@ -233,8 +236,8 @@ const AboutAOUnit = _ref3 => {
233
236
  }, _d2I18n.default.t('Subscribe')))))), /*#__PURE__*/_react.default.createElement(_style.default, {
234
237
  id: _AboutAOUnitStyle.default.__hash
235
238
  }, _AboutAOUnitStyle.default));
236
- };
237
-
239
+ });
240
+ AboutAOUnit.displayName = 'AboutUnit';
238
241
  AboutAOUnit.propTypes = {
239
242
  id: _propTypes.default.string.isRequired,
240
243
  type: _propTypes.default.string.isRequired
@@ -51,7 +51,7 @@ const FileMenu = _ref => {
51
51
  onSave,
52
52
  onSaveAs,
53
53
  onRename,
54
- // onShare,
54
+ onShare,
55
55
  onDelete,
56
56
  onError,
57
57
  onTranslate
@@ -106,10 +106,10 @@ const FileMenu = _ref => {
106
106
 
107
107
  case 'sharing':
108
108
  return /*#__PURE__*/_react.default.createElement(_ui.SharingDialog, {
109
- open: true,
110
109
  type: fileType,
111
110
  id: fileObject.id,
112
- onClose: onDialogClose
111
+ onClose: onDialogClose,
112
+ onSave: onShare
113
113
  });
114
114
 
115
115
  case 'getlink':
@@ -265,6 +265,7 @@ FileMenu.defaultProps = {
265
265
  onOpen: Function.prototype,
266
266
  onRename: Function.prototype,
267
267
  onSaveAs: Function.prototype,
268
+ onShare: Function.prototype,
268
269
  onTranslate: Function.prototype
269
270
  };
270
271
  FileMenu.propTypes = {
@@ -280,7 +281,7 @@ FileMenu.propTypes = {
280
281
  onRename: _propTypes.default.func,
281
282
  onSave: _propTypes.default.func,
282
283
  onSaveAs: _propTypes.default.func,
283
- // onShare: PropTypes.func,
284
+ onShare: _propTypes.default.func,
284
285
  onTranslate: _propTypes.default.func
285
286
  };
286
287
  var _default = FileMenu;
@@ -5,7 +5,7 @@ import { Button, CircularLoader, IconChevronDown24, IconChevronUp24, IconClock16
5
5
  import cx from 'classnames';
6
6
  import moment from 'moment';
7
7
  import PropTypes from 'prop-types';
8
- import React, { useEffect, useMemo, useState } from 'react';
8
+ import React, { useEffect, useMemo, useState, forwardRef, useImperativeHandle } from 'react';
9
9
  import { formatList } from '../../modules/list.js';
10
10
  import styles from './styles/AboutAOUnit.style.js';
11
11
  import { getTranslatedString, AOTypeMap } from './utils.js';
@@ -46,7 +46,7 @@ const getUnsubscribeMutation = (type, id) => ({
46
46
  type: 'delete'
47
47
  });
48
48
 
49
- const AboutAOUnit = _ref3 => {
49
+ const AboutAOUnit = /*#__PURE__*/forwardRef((_ref3, ref) => {
50
50
  var _data$ao$createdBy;
51
51
 
52
52
  let {
@@ -93,6 +93,9 @@ const AboutAOUnit = _ref3 => {
93
93
  });
94
94
  }
95
95
  }, [id, refetch]);
96
+ useImperativeHandle(ref, () => ({
97
+ refresh: refetch
98
+ }), [refetch]);
96
99
 
97
100
  const getAccessLevelString = access => {
98
101
  const re = new RegExp("(?<accessLevel>".concat(READ_AND_WRITE, "?)"));
@@ -209,8 +212,8 @@ const AboutAOUnit = _ref3 => {
209
212
  }, i18n.t('Subscribe')))))), /*#__PURE__*/React.createElement(_JSXStyle, {
210
213
  id: styles.__hash
211
214
  }, styles));
212
- };
213
-
215
+ });
216
+ AboutAOUnit.displayName = 'AboutUnit';
214
217
  AboutAOUnit.propTypes = {
215
218
  id: PropTypes.string.isRequired,
216
219
  type: PropTypes.string.isRequired
@@ -25,7 +25,7 @@ export const FileMenu = _ref => {
25
25
  onSave,
26
26
  onSaveAs,
27
27
  onRename,
28
- // onShare,
28
+ onShare,
29
29
  onDelete,
30
30
  onError,
31
31
  onTranslate
@@ -80,10 +80,10 @@ export const FileMenu = _ref => {
80
80
 
81
81
  case 'sharing':
82
82
  return /*#__PURE__*/React.createElement(SharingDialog, {
83
- open: true,
84
83
  type: fileType,
85
84
  id: fileObject.id,
86
- onClose: onDialogClose
85
+ onClose: onDialogClose,
86
+ onSave: onShare
87
87
  });
88
88
 
89
89
  case 'getlink':
@@ -237,6 +237,7 @@ FileMenu.defaultProps = {
237
237
  onOpen: Function.prototype,
238
238
  onRename: Function.prototype,
239
239
  onSaveAs: Function.prototype,
240
+ onShare: Function.prototype,
240
241
  onTranslate: Function.prototype
241
242
  };
242
243
  FileMenu.propTypes = {
@@ -252,7 +253,7 @@ FileMenu.propTypes = {
252
253
  onRename: PropTypes.func,
253
254
  onSave: PropTypes.func,
254
255
  onSaveAs: PropTypes.func,
255
- // onShare: PropTypes.func,
256
+ onShare: PropTypes.func,
256
257
  onTranslate: PropTypes.func
257
258
  };
258
259
  export default FileMenu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "24.0.8",
3
+ "version": "24.0.9",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {