@dhis2/analytics 21.0.0-alpha.4 → 21.0.3

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.
@@ -11,7 +11,7 @@ const orgUnitLevelsQuery = {
11
11
  resource: 'organisationUnitLevels',
12
12
  params: ({
13
13
  displayNameProp = 'displayName'
14
- }) => ({
14
+ } = {}) => ({
15
15
  fields: "id,level,".concat(displayNameProp, "~rename(displayName),name"),
16
16
  paging: false
17
17
  })
@@ -20,7 +20,7 @@ const orgUnitGroupsQuery = {
20
20
  resource: 'organisationUnitGroups',
21
21
  params: ({
22
22
  displayNameProp = 'displayName'
23
- }) => ({
23
+ } = {}) => ({
24
24
  fields: "id,".concat(displayNameProp, "~rename(displayName),name"),
25
25
  paging: false
26
26
  })
@@ -21,6 +21,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
21
21
 
22
22
  var _react = _interopRequireWildcard(require("react"));
23
23
 
24
+ var _list = require("../../modules/list");
25
+
24
26
  var _AboutAOUnit = _interopRequireDefault(require("./styles/AboutAOUnit.style"));
25
27
 
26
28
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -119,11 +121,11 @@ const AboutAOUnit = ({
119
121
  };
120
122
 
121
123
  const getSharingSummary = ao => {
122
- const sharingText = [];
124
+ const sharingTextParts = [];
123
125
  const re = new RegExp("^".concat(READ_AND_WRITE, "?"));
124
126
 
125
127
  if (re.test(ao.publicAccess)) {
126
- sharingText.push(_d2I18n.default.t('all users ({{accessLevel}})', {
128
+ sharingTextParts.push(_d2I18n.default.t('all users ({{accessLevel}})', {
127
129
  accessLevel: getAccessLevelString(ao.publicAccess)
128
130
  }));
129
131
  }
@@ -131,13 +133,13 @@ const AboutAOUnit = ({
131
133
  const userAccesses = ao.userAccesses;
132
134
  const groupAccesses = ao.userGroupAccesses;
133
135
  userAccesses.concat(groupAccesses).forEach(accessRule => {
134
- sharingText.push(_d2I18n.default.t('{{userOrGroup}} ({{accessLevel}})', {
136
+ sharingTextParts.push(_d2I18n.default.t('{{userOrGroup}} ({{accessLevel}})', {
135
137
  userOrGroup: accessRule.displayName,
136
138
  accessLevel: getAccessLevelString(accessRule.access)
137
139
  }));
138
140
  });
139
- return sharingText.length ? _d2I18n.default.t('Shared with {{commaSeparatedListOfUsersAndGroups}}', {
140
- commaSeparatedListOfUsersAndGroups: sharingText.join(', ')
141
+ return sharingTextParts.length ? _d2I18n.default.t('Shared with {{commaSeparatedListOfUsersAndGroups}}', {
142
+ commaSeparatedListOfUsersAndGroups: (0, _list.formatList)(sharingTextParts)
141
143
  }) : _d2I18n.default.t('Not shared with any users or groups');
142
144
  };
143
145
 
@@ -201,7 +203,7 @@ const AboutAOUnit = ({
201
203
  }),
202
204
  secondary: true,
203
205
  small: true,
204
- disabled: unsubscribeIsLoading,
206
+ loading: unsubscribeIsLoading,
205
207
  onClick: unsubscribe
206
208
  }, _d2I18n.default.t('Unsubscribe'))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("p", {
207
209
  className: "jsx-".concat(_AboutAOUnit.default.__hash) + " " + "subscriptionLabel"
@@ -211,7 +213,7 @@ const AboutAOUnit = ({
211
213
  }),
212
214
  secondary: true,
213
215
  small: true,
214
- disabled: subscribeIsLoading,
216
+ loading: subscribeIsLoading,
215
217
  onClick: subscribe
216
218
  }, _d2I18n.default.t('Subscribe')))))), /*#__PURE__*/_react.default.createElement(_style.default, {
217
219
  id: _AboutAOUnit.default.__hash
@@ -7,6 +7,6 @@ exports.fileMenuStyles = void 0;
7
7
 
8
8
  var _ui = require("@dhis2/ui");
9
9
 
10
- const fileMenuStyles = [".menu-toggle.jsx-632952601{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:15px;font-weight:400;text-transform:none;padding:6px 8px;color:".concat(_ui.colors.grey900, ";min-width:64px;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-632952601:hover.jsx-632952601:enabled{background-color:".concat(_ui.colors.grey300, ";opacity:0.8;}"), ".menu-toggle.jsx-632952601:disabled{color:".concat(_ui.colors.grey400, ";}"), ".menu-toggle.jsx-632952601:focus{outline:none;}"];
10
+ const fileMenuStyles = [".menu-toggle.jsx-307301119{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 8px;border-radius:3px;color:".concat(_ui.colors.grey900, ";min-width:64px;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-307301119:hover.jsx-307301119:enabled{background-color:".concat(_ui.colors.grey200, ";}"), ".menu-toggle.jsx-307301119:disabled{color:".concat(_ui.colors.grey400, ";cursor:not-allowed;}"), ".menu-toggle.jsx-307301119:active{background-color:".concat(_ui.colors.grey300, ";}"), ".menuButton.jsx-307301119:focus{outline:2px solid ".concat(_ui.colors.blue600, ";}"), ".menuButton.jsx-307301119:focus.jsx-307301119:not(:focus-visible){outline:none;}"];
11
11
  exports.fileMenuStyles = fileMenuStyles;
12
- fileMenuStyles.__hash = "632952601";
12
+ fileMenuStyles.__hash = "307301119";
@@ -3,7 +3,7 @@ const orgUnitLevelsQuery = {
3
3
  resource: 'organisationUnitLevels',
4
4
  params: ({
5
5
  displayNameProp = 'displayName'
6
- }) => ({
6
+ } = {}) => ({
7
7
  fields: "id,level,".concat(displayNameProp, "~rename(displayName),name"),
8
8
  paging: false
9
9
  })
@@ -12,7 +12,7 @@ const orgUnitGroupsQuery = {
12
12
  resource: 'organisationUnitGroups',
13
13
  params: ({
14
14
  displayNameProp = 'displayName'
15
- }) => ({
15
+ } = {}) => ({
16
16
  fields: "id,".concat(displayNameProp, "~rename(displayName),name"),
17
17
  paging: false
18
18
  })
@@ -6,6 +6,7 @@ import cx from 'classnames';
6
6
  import moment from 'moment';
7
7
  import PropTypes from 'prop-types';
8
8
  import React, { useEffect, useMemo, useState } from 'react';
9
+ import { formatList } from '../../modules/list';
9
10
  import styles from './styles/AboutAOUnit.style';
10
11
  const READ_ONLY = 'r';
11
12
  const READ_AND_WRITE = 'rw';
@@ -97,11 +98,11 @@ const AboutAOUnit = ({
97
98
  };
98
99
 
99
100
  const getSharingSummary = ao => {
100
- const sharingText = [];
101
+ const sharingTextParts = [];
101
102
  const re = new RegExp("^".concat(READ_AND_WRITE, "?"));
102
103
 
103
104
  if (re.test(ao.publicAccess)) {
104
- sharingText.push(i18n.t('all users ({{accessLevel}})', {
105
+ sharingTextParts.push(i18n.t('all users ({{accessLevel}})', {
105
106
  accessLevel: getAccessLevelString(ao.publicAccess)
106
107
  }));
107
108
  }
@@ -109,13 +110,13 @@ const AboutAOUnit = ({
109
110
  const userAccesses = ao.userAccesses;
110
111
  const groupAccesses = ao.userGroupAccesses;
111
112
  userAccesses.concat(groupAccesses).forEach(accessRule => {
112
- sharingText.push(i18n.t('{{userOrGroup}} ({{accessLevel}})', {
113
+ sharingTextParts.push(i18n.t('{{userOrGroup}} ({{accessLevel}})', {
113
114
  userOrGroup: accessRule.displayName,
114
115
  accessLevel: getAccessLevelString(accessRule.access)
115
116
  }));
116
117
  });
117
- return sharingText.length ? i18n.t('Shared with {{commaSeparatedListOfUsersAndGroups}}', {
118
- commaSeparatedListOfUsersAndGroups: sharingText.join(', ')
118
+ return sharingTextParts.length ? i18n.t('Shared with {{commaSeparatedListOfUsersAndGroups}}', {
119
+ commaSeparatedListOfUsersAndGroups: formatList(sharingTextParts)
119
120
  }) : i18n.t('Not shared with any users or groups');
120
121
  };
121
122
 
@@ -179,7 +180,7 @@ const AboutAOUnit = ({
179
180
  }),
180
181
  secondary: true,
181
182
  small: true,
182
- disabled: unsubscribeIsLoading,
183
+ loading: unsubscribeIsLoading,
183
184
  onClick: unsubscribe
184
185
  }, i18n.t('Unsubscribe'))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", {
185
186
  className: "jsx-".concat(styles.__hash) + " " + "subscriptionLabel"
@@ -189,7 +190,7 @@ const AboutAOUnit = ({
189
190
  }),
190
191
  secondary: true,
191
192
  small: true,
192
- disabled: subscribeIsLoading,
193
+ loading: subscribeIsLoading,
193
194
  onClick: subscribe
194
195
  }, i18n.t('Subscribe')))))), /*#__PURE__*/React.createElement(_JSXStyle, {
195
196
  id: styles.__hash
@@ -1,3 +1,3 @@
1
1
  import { colors } from '@dhis2/ui';
2
- export const fileMenuStyles = [".menu-toggle.jsx-632952601{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:15px;font-weight:400;text-transform:none;padding:6px 8px;color:".concat(colors.grey900, ";min-width:64px;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-632952601:hover.jsx-632952601:enabled{background-color:".concat(colors.grey300, ";opacity:0.8;}"), ".menu-toggle.jsx-632952601:disabled{color:".concat(colors.grey400, ";}"), ".menu-toggle.jsx-632952601:focus{outline:none;}"];
3
- fileMenuStyles.__hash = "632952601";
2
+ export const fileMenuStyles = [".menu-toggle.jsx-307301119{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 8px;border-radius:3px;color:".concat(colors.grey900, ";min-width:64px;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-307301119:hover.jsx-307301119:enabled{background-color:".concat(colors.grey200, ";}"), ".menu-toggle.jsx-307301119:disabled{color:".concat(colors.grey400, ";cursor:not-allowed;}"), ".menu-toggle.jsx-307301119:active{background-color:".concat(colors.grey300, ";}"), ".menuButton.jsx-307301119:focus{outline:2px solid ".concat(colors.blue600, ";}"), ".menuButton.jsx-307301119:focus.jsx-307301119:not(:focus-visible){outline:none;}"];
3
+ fileMenuStyles.__hash = "307301119";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "21.0.0-alpha.4",
3
+ "version": "21.0.3",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {
@@ -35,7 +35,7 @@
35
35
  "@dhis2/cli-app-scripts": "^6.2.0",
36
36
  "@dhis2/cli-style": "^9.0.1",
37
37
  "@dhis2/d2-i18n": "^1.1.0",
38
- "@dhis2/ui": "^7.7.2",
38
+ "@dhis2/ui": "^7.7.3",
39
39
  "@sambego/storybook-state": "^2.0.1",
40
40
  "@storybook/addons": "^6.1.14",
41
41
  "@storybook/preset-create-react-app": "^3.1.7",
@@ -51,14 +51,13 @@
51
51
  "peerDependencies": {
52
52
  "@dhis2/app-runtime": "^2",
53
53
  "@dhis2/d2-i18n": "^1.1",
54
- "@dhis2/ui": "^6.5.2",
54
+ "@dhis2/ui": "^7.7.3",
55
55
  "prop-types": "^15",
56
56
  "react": "^16.3",
57
57
  "react-dom": "^16.3",
58
58
  "styled-jsx": "^3.3.2"
59
59
  },
60
60
  "dependencies": {
61
- "@dhis2/d2-ui-org-unit-dialog": "^7.3.0",
62
61
  "@dhis2/d2-ui-translation-dialog": "^7.3.1",
63
62
  "classnames": "^2.3.1",
64
63
  "d2-utilizr": "^0.2.16",