@dhis2/analytics 26.11.0 → 26.12.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.
Files changed (43) hide show
  1. package/build/cjs/components/DashboardPluginWrapper/DashboardPluginWrapper.js +92 -0
  2. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +2 -3
  3. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuList.js +4 -4
  4. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +3 -5
  5. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.styles.js +2 -2
  6. package/build/cjs/components/Toolbar/MenuButton.styles.js +2 -2
  7. package/build/cjs/components/Toolbar/Toolbar.js +4 -4
  8. package/build/cjs/components/Toolbar/ToolbarSidebar.js +4 -4
  9. package/build/cjs/components/Toolbar/UpdateButton.js +6 -8
  10. package/build/cjs/index.js +8 -0
  11. package/build/cjs/locales/ar/translations.json +4 -4
  12. package/build/cjs/locales/id/translations.json +1 -1
  13. package/build/cjs/locales/ro/translations.json +1 -1
  14. package/build/cjs/locales/ru/translations.json +4 -4
  15. package/build/cjs/locales/uk/translations.json +3 -3
  16. package/build/cjs/locales/uz_UZ_Cyrl/translations.json +4 -4
  17. package/build/cjs/locales/uz_UZ_Latn/translations.json +3 -3
  18. package/build/cjs/locales/zh/translations.json +15 -15
  19. package/build/cjs/locales/zh_CN/translations.json +1 -1
  20. package/build/cjs/modules/getPWAInstallationStatus.js +77 -0
  21. package/build/cjs/visualizations/config/adapters/dhis_highcharts/index.js +0 -1
  22. package/build/es/components/DashboardPluginWrapper/DashboardPluginWrapper.js +82 -0
  23. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +1 -2
  24. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuList.js +1 -1
  25. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +1 -3
  26. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuListItem.styles.js +1 -1
  27. package/build/es/components/Toolbar/MenuButton.styles.js +1 -1
  28. package/build/es/components/Toolbar/Toolbar.js +1 -1
  29. package/build/es/components/Toolbar/ToolbarSidebar.js +1 -1
  30. package/build/es/components/Toolbar/UpdateButton.js +1 -3
  31. package/build/es/index.js +1 -0
  32. package/build/es/locales/ar/translations.json +4 -4
  33. package/build/es/locales/id/translations.json +1 -1
  34. package/build/es/locales/ro/translations.json +1 -1
  35. package/build/es/locales/ru/translations.json +4 -4
  36. package/build/es/locales/uk/translations.json +3 -3
  37. package/build/es/locales/uz_UZ_Cyrl/translations.json +4 -4
  38. package/build/es/locales/uz_UZ_Latn/translations.json +3 -3
  39. package/build/es/locales/zh/translations.json +15 -15
  40. package/build/es/locales/zh_CN/translations.json +1 -1
  41. package/build/es/modules/getPWAInstallationStatus.js +70 -0
  42. package/build/es/visualizations/config/adapters/dhis_highcharts/index.js +0 -1
  43. package/package.json +3 -3
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DashboardPluginWrapper = void 0;
7
+ var _appRuntime = require("@dhis2/app-runtime");
8
+ var _ui = require("@dhis2/ui");
9
+ var _propTypes = _interopRequireDefault(require("prop-types"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _getPWAInstallationStatus = require("../../modules/getPWAInstallationStatus.js");
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ const LoadingMask = () => {
16
+ return /*#__PURE__*/_react.default.createElement(_ui.Layer, null, /*#__PURE__*/_react.default.createElement(_ui.CenteredContent, null, /*#__PURE__*/_react.default.createElement(_ui.CircularLoader, null)));
17
+ };
18
+ const CacheableSectionWrapper = _ref => {
19
+ let {
20
+ id,
21
+ children,
22
+ isParentCached
23
+ } = _ref;
24
+ const {
25
+ startRecording,
26
+ isCached,
27
+ remove
28
+ } = (0, _appRuntime.useCacheableSection)(id);
29
+ (0, _react.useEffect)(() => {
30
+ if (isParentCached && !isCached) {
31
+ startRecording({
32
+ onError: console.error
33
+ });
34
+ } else if (!isParentCached && isCached) {
35
+ // Synchronize cache state on load or prop update
36
+ // -- a back-up to imperative `removeCachedData`
37
+ remove();
38
+ }
39
+ }, [isCached, isParentCached, remove, startRecording]);
40
+ return /*#__PURE__*/_react.default.createElement(_appRuntime.CacheableSection, {
41
+ id: id,
42
+ loadingMask: /*#__PURE__*/_react.default.createElement(LoadingMask, null)
43
+ }, children);
44
+ };
45
+ CacheableSectionWrapper.propTypes = {
46
+ children: _propTypes.default.node,
47
+ id: _propTypes.default.string,
48
+ isParentCached: _propTypes.default.bool
49
+ };
50
+ const DashboardPluginWrapper = _ref2 => {
51
+ let {
52
+ onInstallationStatusChange,
53
+ children,
54
+ cacheId,
55
+ isParentCached,
56
+ ...props
57
+ } = _ref2;
58
+ const {
59
+ pwaEnabled
60
+ } = (0, _appRuntime.useConfig)();
61
+ (0, _react.useEffect)(() => {
62
+ // Get & send PWA installation status now
63
+ (0, _getPWAInstallationStatus.getPWAInstallationStatus)({
64
+ onStateChange: onInstallationStatusChange
65
+ }).then(onInstallationStatusChange);
66
+ }, [onInstallationStatusChange]);
67
+ return props ? /*#__PURE__*/_react.default.createElement("div", {
68
+ style: {
69
+ display: 'flex',
70
+ height: '100%',
71
+ overflow: 'hidden'
72
+ }
73
+ }, pwaEnabled ? /*#__PURE__*/_react.default.createElement(CacheableSectionWrapper, {
74
+ id: cacheId,
75
+ isParentCached: isParentCached
76
+ }, children(props)) : children(props), /*#__PURE__*/_react.default.createElement(_ui.CssVariables, {
77
+ colors: true,
78
+ spacers: true,
79
+ elevations: true
80
+ })) : null;
81
+ };
82
+ exports.DashboardPluginWrapper = DashboardPluginWrapper;
83
+ DashboardPluginWrapper.defaultProps = {
84
+ isParentCached: false,
85
+ onInstallationStatusChange: Function.prototype
86
+ };
87
+ DashboardPluginWrapper.propTypes = {
88
+ cacheId: _propTypes.default.string,
89
+ children: _propTypes.default.func,
90
+ isParentCached: _propTypes.default.bool,
91
+ onInstallationStatusChange: _propTypes.default.func
92
+ };
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.HoverMenuDropdown = void 0;
7
7
  var _style = _interopRequireDefault(require("styled-jsx/style"));
8
- var _popper = require("@dhis2-ui/popper");
9
- var _portal = require("@dhis2-ui/portal");
8
+ var _ui = require("@dhis2/ui");
10
9
  var _classnames = _interopRequireDefault(require("classnames"));
11
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
11
  var _react = _interopRequireWildcard(require("react"));
@@ -41,7 +40,7 @@ const HoverMenuDropdown = _ref => {
41
40
  }) || "")
42
41
  }, label, /*#__PURE__*/_react.default.createElement(_style.default, {
43
42
  id: _MenuButtonStyles.default.__hash
44
- }, _MenuButtonStyles.default)), isOpen && /*#__PURE__*/_react.default.createElement(_portal.Portal, null, /*#__PURE__*/_react.default.createElement(_popper.Popper, {
43
+ }, _MenuButtonStyles.default)), isOpen && /*#__PURE__*/_react.default.createElement(_ui.Portal, null, /*#__PURE__*/_react.default.createElement(_ui.Popper, {
45
44
  placement: "bottom-start",
46
45
  reference: buttonRef
47
46
  }, children)));
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useHoverMenuListContext = exports.HoverMenuList = void 0;
7
7
  var _style = _interopRequireDefault(require("styled-jsx/style"));
8
- var _uiConstants = require("@dhis2/ui-constants");
8
+ var _ui = require("@dhis2/ui");
9
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _HoverMenuBar = require("./HoverMenuBar.js");
@@ -55,11 +55,11 @@ const HoverMenuList = _ref => {
55
55
  }
56
56
  }, /*#__PURE__*/_react.default.createElement("ul", {
57
57
  "data-test": dataTest,
58
- className: _style.default.dynamic([["3026610659", [_uiConstants.colors.white, _uiConstants.colors.grey200, _uiConstants.elevations.e300, dense ? '128' : '180', maxWidth, maxHeight, _uiConstants.spacers.dp4]]]) + " " + (className || "")
58
+ className: _style.default.dynamic([["3026610659", [_ui.colors.white, _ui.colors.grey200, _ui.elevations.e300, dense ? '128' : '180', maxWidth, maxHeight, _ui.spacers.dp4]]]) + " " + (className || "")
59
59
  }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
60
60
  id: "3026610659",
61
- dynamic: [_uiConstants.colors.white, _uiConstants.colors.grey200, _uiConstants.elevations.e300, dense ? '128' : '180', maxWidth, maxHeight, _uiConstants.spacers.dp4]
62
- }, [`ul.__jsx-style-dynamic-selector{position:relative;margin:0;padding:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:${_uiConstants.colors.white};border:1px solid ${_uiConstants.colors.grey200};border-radius:3px;box-shadow:${_uiConstants.elevations.e300};display:inline-block;min-width:${dense ? '128' : '180'}px;max-width:${maxWidth};max-height:${maxHeight};padding:${_uiConstants.spacers.dp4} 0;overflow:auto;list-style:none;}`])));
61
+ dynamic: [_ui.colors.white, _ui.colors.grey200, _ui.elevations.e300, dense ? '128' : '180', maxWidth, maxHeight, _ui.spacers.dp4]
62
+ }, [`ul.__jsx-style-dynamic-selector{position:relative;margin:0;padding:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:${_ui.colors.white};border:1px solid ${_ui.colors.grey200};border-radius:3px;box-shadow:${_ui.elevations.e300};display:inline-block;min-width:${dense ? '128' : '180'}px;max-width:${maxWidth};max-height:${maxHeight};padding:${_ui.spacers.dp4} 0;overflow:auto;list-style:none;}`])));
63
63
  };
64
64
  exports.HoverMenuList = HoverMenuList;
65
65
  HoverMenuList.defaultProps = {
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.HoverMenuListItem = void 0;
7
7
  var _style = _interopRequireDefault(require("styled-jsx/style"));
8
- var _uiIcons = require("@dhis2/ui-icons");
9
- var _popper = require("@dhis2-ui/popper");
10
- var _portal = require("@dhis2-ui/portal");
8
+ var _ui = require("@dhis2/ui");
11
9
  var _classnames = _interopRequireDefault(require("classnames"));
12
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
11
  var _react = _interopRequireWildcard(require("react"));
@@ -53,9 +51,9 @@ const HoverMenuListItem = _ref => {
53
51
  className: `jsx-${_HoverMenuListItemStyles.default.__hash}` + " " + "label"
54
52
  }, label), !!children && /*#__PURE__*/_react.default.createElement("span", {
55
53
  className: `jsx-${_HoverMenuListItemStyles.default.__hash}` + " " + "chevron"
56
- }, /*#__PURE__*/_react.default.createElement(_uiIcons.IconChevronRight24, null)), /*#__PURE__*/_react.default.createElement(_style.default, {
54
+ }, /*#__PURE__*/_react.default.createElement(_ui.IconChevronRight24, null)), /*#__PURE__*/_react.default.createElement(_style.default, {
57
55
  id: _HoverMenuListItemStyles.default.__hash
58
- }, _HoverMenuListItemStyles.default)), children && isSubMenuOpen && /*#__PURE__*/_react.default.createElement(_portal.Portal, null, /*#__PURE__*/_react.default.createElement(_popper.Popper, {
56
+ }, _HoverMenuListItemStyles.default)), children && isSubMenuOpen && /*#__PURE__*/_react.default.createElement(_ui.Portal, null, /*#__PURE__*/_react.default.createElement(_ui.Popper, {
59
57
  placement: "right-start",
60
58
  reference: ref
61
59
  }, /*#__PURE__*/_react.default.createElement(_HoverMenuList.HoverMenuList, {
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _uiConstants = require("@dhis2/ui-constants");
8
- const _defaultExport = [`li.jsx-3263820070{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0px ${_uiConstants.spacers.dp24};cursor:pointer;list-style:none;background-color:${_uiConstants.colors.white};color:${_uiConstants.colors.grey900};fill:${_uiConstants.colors.grey900};font-size:14px;line-height:16px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}`, `li.jsx-3263820070:hover,li.jsx-3263820070:active,li.active.jsx-3263820070{background-color:${_uiConstants.colors.grey200};}`, `li.dense.jsx-3263820070{padding:0px ${_uiConstants.spacers.dp12};}`, `li.destructive.jsx-3263820070{color:${_uiConstants.colors.red700};fill:${_uiConstants.colors.red600};}`, `li.destructive.jsx-3263820070:hover{background-color:${_uiConstants.colors.red050};}`, `li.destructive.jsx-3263820070:active,li.destructive.active.jsx-3263820070{background-color:${_uiConstants.colors.red100};}`, `li.disabled.jsx-3263820070{cursor:not-allowed;color:${_uiConstants.colors.grey500};fill:${_uiConstants.colors.grey500};}`, `li.disabled.jsx-3263820070:hover{background-color:${_uiConstants.colors.white};}`, `.label.jsx-3263820070{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;padding:${_uiConstants.spacers.dp12} 0;}`, `li.dense.jsx-3263820070 .label.jsx-3263820070{padding:${_uiConstants.spacers.dp8} 0;}`, `.icon.jsx-3263820070{-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;margin-right:${_uiConstants.spacers.dp12};width:24px;height:24px;}`, `.chevron.jsx-3263820070{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;margin-left:${_uiConstants.spacers.dp24};}`, `li.dense.jsx-3263820070 .icon.jsx-3263820070{margin-right:${_uiConstants.spacers.dp8};width:16px;height:16px;}`, "li.jsx-3263820070 .icon.jsx-3263820070>svg{width:24px;height:24px;}", "li.dense.jsx-3263820070 .icon.jsx-3263820070>svg,li.jsx-3263820070 .chevron.jsx-3263820070>svg{width:16px;height:16px;}"];
7
+ var _ui = require("@dhis2/ui");
8
+ const _defaultExport = [`li.jsx-3263820070{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0px ${_ui.spacers.dp24};cursor:pointer;list-style:none;background-color:${_ui.colors.white};color:${_ui.colors.grey900};fill:${_ui.colors.grey900};font-size:14px;line-height:16px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}`, `li.jsx-3263820070:hover,li.jsx-3263820070:active,li.active.jsx-3263820070{background-color:${_ui.colors.grey200};}`, `li.dense.jsx-3263820070{padding:0px ${_ui.spacers.dp12};}`, `li.destructive.jsx-3263820070{color:${_ui.colors.red700};fill:${_ui.colors.red600};}`, `li.destructive.jsx-3263820070:hover{background-color:${_ui.colors.red050};}`, `li.destructive.jsx-3263820070:active,li.destructive.active.jsx-3263820070{background-color:${_ui.colors.red100};}`, `li.disabled.jsx-3263820070{cursor:not-allowed;color:${_ui.colors.grey500};fill:${_ui.colors.grey500};}`, `li.disabled.jsx-3263820070:hover{background-color:${_ui.colors.white};}`, `.label.jsx-3263820070{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;padding:${_ui.spacers.dp12} 0;}`, `li.dense.jsx-3263820070 .label.jsx-3263820070{padding:${_ui.spacers.dp8} 0;}`, `.icon.jsx-3263820070{-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;margin-right:${_ui.spacers.dp12};width:24px;height:24px;}`, `.chevron.jsx-3263820070{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;margin-left:${_ui.spacers.dp24};}`, `li.dense.jsx-3263820070 .icon.jsx-3263820070{margin-right:${_ui.spacers.dp8};width:16px;height:16px;}`, "li.jsx-3263820070 .icon.jsx-3263820070>svg{width:24px;height:24px;}", "li.dense.jsx-3263820070 .icon.jsx-3263820070>svg,li.jsx-3263820070 .chevron.jsx-3263820070>svg{width:16px;height:16px;}"];
9
9
  _defaultExport.__hash = "3263820070";
10
10
  var _default = exports.default = _defaultExport;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _uiConstants = require("@dhis2/ui-constants");
8
- const _defaultExport = [`button.jsx-3546699693{all:unset;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-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;line-height:14px;padding:0 ${_uiConstants.spacers.dp12};color:${_uiConstants.colors.grey900};cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}`, `button.jsx-3546699693:hover.jsx-3546699693:enabled,button.jsx-3546699693:active.jsx-3546699693:enabled,button.isOpen.jsx-3546699693{background-color:${_uiConstants.colors.grey200};}`, `button.jsx-3546699693:focus{outline:3px solid ${_uiConstants.theme.focus};outline-offset:-3px;}`, "button.jsx-3546699693:focus.jsx-3546699693:not(:focus-visible){outline:none;}", `button.jsx-3546699693:disabled{color:${_uiConstants.colors.grey500};cursor:not-allowed;}`];
7
+ var _ui = require("@dhis2/ui");
8
+ const _defaultExport = [`button.jsx-3546699693{all:unset;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-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;line-height:14px;padding:0 ${_ui.spacers.dp12};color:${_ui.colors.grey900};cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}`, `button.jsx-3546699693:hover.jsx-3546699693:enabled,button.jsx-3546699693:active.jsx-3546699693:enabled,button.isOpen.jsx-3546699693{background-color:${_ui.colors.grey200};}`, `button.jsx-3546699693:focus{outline:3px solid ${_ui.theme.focus};outline-offset:-3px;}`, "button.jsx-3546699693:focus.jsx-3546699693:not(:focus-visible){outline:none;}", `button.jsx-3546699693:disabled{color:${_ui.colors.grey500};cursor:not-allowed;}`];
9
9
  _defaultExport.__hash = "3546699693";
10
10
  var _default = exports.default = _defaultExport;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Toolbar = void 0;
7
7
  var _style = _interopRequireDefault(require("styled-jsx/style"));
8
- var _uiConstants = require("@dhis2/ui-constants");
8
+ var _ui = require("@dhis2/ui");
9
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -16,11 +16,11 @@ const Toolbar = _ref => {
16
16
  } = _ref;
17
17
  return /*#__PURE__*/_react.default.createElement("div", {
18
18
  "data-test": dataTest,
19
- className: _style.default.dynamic([["2617706539", [_uiConstants.colors.grey400, _uiConstants.colors.white]]])
19
+ className: _style.default.dynamic([["2617706539", [_ui.colors.grey400, _ui.colors.white]]])
20
20
  }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
21
21
  id: "2617706539",
22
- dynamic: [_uiConstants.colors.grey400, _uiConstants.colors.white]
23
- }, [`div.__jsx-style-dynamic-selector{box-sizing:border-box;min-height:32px;max-height:32px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;border-bottom:1px solid ${_uiConstants.colors.grey400};background-color:${_uiConstants.colors.white};}`]));
22
+ dynamic: [_ui.colors.grey400, _ui.colors.white]
23
+ }, [`div.__jsx-style-dynamic-selector{box-sizing:border-box;min-height:32px;max-height:32px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;border-bottom:1px solid ${_ui.colors.grey400};background-color:${_ui.colors.white};}`]));
24
24
  };
25
25
  exports.Toolbar = Toolbar;
26
26
  Toolbar.defaultProps = {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ToolbarSidebar = void 0;
7
7
  var _style = _interopRequireDefault(require("styled-jsx/style"));
8
- var _uiConstants = require("@dhis2/ui-constants");
8
+ var _ui = require("@dhis2/ui");
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _react = _interopRequireDefault(require("react"));
@@ -18,13 +18,13 @@ const ToolbarSidebar = _ref => {
18
18
  } = _ref;
19
19
  return /*#__PURE__*/_react.default.createElement("div", {
20
20
  "data-test": dataTest,
21
- className: _style.default.dynamic([["1150014343", [_uiConstants.colors.grey400]]]) + " " + ((0, _classnames.default)('container', {
21
+ className: _style.default.dynamic([["1150014343", [_ui.colors.grey400]]]) + " " + ((0, _classnames.default)('container', {
22
22
  isHidden
23
23
  }) || "")
24
24
  }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
25
25
  id: "1150014343",
26
- dynamic: [_uiConstants.colors.grey400]
27
- }, [`div.__jsx-style-dynamic-selector{width:260px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;border-right:1px solid ${_uiConstants.colors.grey400};}`, "div.isHidden.__jsx-style-dynamic-selector{display:none;}"]));
26
+ dynamic: [_ui.colors.grey400]
27
+ }, [`div.__jsx-style-dynamic-selector{width:260px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;border-right:1px solid ${_ui.colors.grey400};}`, "div.isHidden.__jsx-style-dynamic-selector{display:none;}"]));
28
28
  };
29
29
  exports.ToolbarSidebar = ToolbarSidebar;
30
30
  ToolbarSidebar.defaultProps = {
@@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.UpdateButton = void 0;
7
7
  var _style = _interopRequireDefault(require("styled-jsx/style"));
8
8
  var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
9
- var _uiConstants = require("@dhis2/ui-constants");
10
- var _uiIcons = require("@dhis2/ui-icons");
11
- var _loader = require("@dhis2-ui/loader");
9
+ var _ui = require("@dhis2/ui");
12
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
11
  var _react = _interopRequireDefault(require("react"));
14
12
  var _MenuButtonStyles = _interopRequireDefault(require("./MenuButton.styles.js"));
@@ -24,15 +22,15 @@ const UpdateButton = _ref => {
24
22
  onClick: onClick,
25
23
  disabled: disabled,
26
24
  "data-test": dataTest,
27
- className: `jsx-${_MenuButtonStyles.default.__hash}` + " " + _style.default.dynamic([["2364287882", [_uiConstants.colors.blue700, _uiConstants.colors.blue100, _uiConstants.colors.blue200]]])
28
- }, loading ? /*#__PURE__*/_react.default.createElement(_loader.CircularLoader, {
25
+ className: `jsx-${_MenuButtonStyles.default.__hash}` + " " + _style.default.dynamic([["2364287882", [_ui.colors.blue700, _ui.colors.blue100, _ui.colors.blue200]]])
26
+ }, loading ? /*#__PURE__*/_react.default.createElement(_ui.CircularLoader, {
29
27
  extrasmall: true
30
- }) : /*#__PURE__*/_react.default.createElement(_uiIcons.IconSync16, null), _d2I18n.default.t('Update'), /*#__PURE__*/_react.default.createElement(_style.default, {
28
+ }) : /*#__PURE__*/_react.default.createElement(_ui.IconSync16, null), _d2I18n.default.t('Update'), /*#__PURE__*/_react.default.createElement(_style.default, {
31
29
  id: _MenuButtonStyles.default.__hash
32
30
  }, _MenuButtonStyles.default), /*#__PURE__*/_react.default.createElement(_style.default, {
33
31
  id: "2364287882",
34
- dynamic: [_uiConstants.colors.blue700, _uiConstants.colors.blue100, _uiConstants.colors.blue200]
35
- }, [`button.__jsx-style-dynamic-selector{gap:8px;color:${_uiConstants.colors.blue700};font-weight:500;}`, `button.__jsx-style-dynamic-selector:hover.__jsx-style-dynamic-selector:enabled{background:${_uiConstants.colors.blue100};}`, `button.__jsx-style-dynamic-selector:active{background:${_uiConstants.colors.blue200};}`]));
32
+ dynamic: [_ui.colors.blue700, _ui.colors.blue100, _ui.colors.blue200]
33
+ }, [`button.__jsx-style-dynamic-selector{gap:8px;color:${_ui.colors.blue700};font-weight:500;}`, `button.__jsx-style-dynamic-selector:hover.__jsx-style-dynamic-selector:enabled{background:${_ui.colors.blue100};}`, `button.__jsx-style-dynamic-selector:active{background:${_ui.colors.blue200};}`]));
36
34
  };
37
35
  exports.UpdateButton = UpdateButton;
38
36
  UpdateButton.defaultProps = {
@@ -27,6 +27,7 @@ var _exportNames = {
27
27
  OfflineTooltip: true,
28
28
  CachedDataQueryProvider: true,
29
29
  useCachedDataQuery: true,
30
+ DashboardPluginWrapper: true,
30
31
  Analytics: true,
31
32
  apiFetchDimensions: true,
32
33
  apiFetchRecommendedIds: true,
@@ -542,6 +543,12 @@ Object.defineProperty(exports, "DIMENSION_TYPE_PROGRAM_INDICATOR", {
542
543
  return _dataTypes.DIMENSION_TYPE_PROGRAM_INDICATOR;
543
544
  }
544
545
  });
546
+ Object.defineProperty(exports, "DashboardPluginWrapper", {
547
+ enumerable: true,
548
+ get: function () {
549
+ return _DashboardPluginWrapper.DashboardPluginWrapper;
550
+ }
551
+ });
545
552
  Object.defineProperty(exports, "DataDimension", {
546
553
  enumerable: true,
547
554
  get: function () {
@@ -1877,6 +1884,7 @@ Object.keys(_index6).forEach(function (key) {
1877
1884
  }
1878
1885
  });
1879
1886
  });
1887
+ var _DashboardPluginWrapper = require("./components/DashboardPluginWrapper/DashboardPluginWrapper.js");
1880
1888
  var _Analytics = _interopRequireDefault(require("./api/analytics/Analytics.js"));
1881
1889
  var _dimensions = require("./api/dimensions.js");
1882
1890
  var _organisationUnits = require("./api/organisationUnits.js");
@@ -6,7 +6,7 @@
6
6
  "Shared with {{commaSeparatedListOfUsersAndGroups}}": "",
7
7
  "Not shared with any users or groups": "",
8
8
  "No description": "لا يوجد وصف",
9
- "Last updated {{time}}": "",
9
+ "Last updated {{time}}": "آخر تحديث {{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
12
  "Viewed {{count}} times_0": "",
@@ -136,7 +136,7 @@
136
136
  "Nothing found in {{- dimensionTitle}}": "",
137
137
  "Search": "البحث",
138
138
  "Nothing found for {{- searchTerm}}": "",
139
- "Delete {{fileType}}": "",
139
+ "Delete {{fileType}}": "حذف {{fileType}}",
140
140
  "This {{fileType}} and related interpretations will be deleted. Continue?": "",
141
141
  "Delete": "حذف",
142
142
  "File": "ملف",
@@ -151,10 +151,10 @@
151
151
  "Get link…": "",
152
152
  "Open in this app": "فتح في هذا التطبيق",
153
153
  "Close": "إغلاق",
154
- "Rename {{fileType}}": "",
154
+ "Rename {{fileType}}": "إعادة تسمية {{fileType}}",
155
155
  "Rename": "إعادة التسمية",
156
156
  "{{- objectName}} (copy)": "",
157
- "Save {{fileType}} as": "",
157
+ "Save {{fileType}} as": "حفظ {{fileType}} بإسم",
158
158
  "event report": "تقارير عن الأحداث",
159
159
  "line list": "",
160
160
  "map": "خريطة",
@@ -6,7 +6,7 @@
6
6
  "Shared with {{commaSeparatedListOfUsersAndGroups}}": "",
7
7
  "Not shared with any users or groups": "",
8
8
  "No description": "Tidak ada deskripsi",
9
- "Last updated {{time}}": "",
9
+ "Last updated {{time}}": "Terakhir diperbarui {{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
12
  "Viewed {{count}} times": "",
@@ -6,7 +6,7 @@
6
6
  "Shared with {{commaSeparatedListOfUsersAndGroups}}": "",
7
7
  "Not shared with any users or groups": "",
8
8
  "No description": "",
9
- "Last updated {{time}}": "",
9
+ "Last updated {{time}}": "Ultima actualizare {{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
12
  "Viewed {{count}} times_0": "",
@@ -6,7 +6,7 @@
6
6
  "Shared with {{commaSeparatedListOfUsersAndGroups}}": "",
7
7
  "Not shared with any users or groups": "",
8
8
  "No description": "Нет описания",
9
- "Last updated {{time}}": "",
9
+ "Last updated {{time}}": "Последнее обновление: {{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
12
  "Viewed {{count}} times_0": "",
@@ -134,7 +134,7 @@
134
134
  "Nothing found in {{- dimensionTitle}}": "",
135
135
  "Search": "Поиск",
136
136
  "Nothing found for {{- searchTerm}}": "",
137
- "Delete {{fileType}}": "",
137
+ "Delete {{fileType}}": "Удалить {{fileType}}",
138
138
  "This {{fileType}} and related interpretations will be deleted. Continue?": "",
139
139
  "Delete": "Удалить",
140
140
  "File": "Файл",
@@ -149,10 +149,10 @@
149
149
  "Get link…": "",
150
150
  "Open in this app": "Открыть в данном приложении",
151
151
  "Close": "Закрыть",
152
- "Rename {{fileType}}": "",
152
+ "Rename {{fileType}}": "Переименовать {{fileType}}",
153
153
  "Rename": "Переименовать",
154
154
  "{{- objectName}} (copy)": "",
155
- "Save {{fileType}} as": "",
155
+ "Save {{fileType}} as": "Сохранить {{fileType}} как",
156
156
  "event report": "Отчет случаев",
157
157
  "line list": "",
158
158
  "map": "Карта",
@@ -134,7 +134,7 @@
134
134
  "Nothing found in {{- dimensionTitle}}": "",
135
135
  "Search": "Пошук",
136
136
  "Nothing found for {{- searchTerm}}": "",
137
- "Delete {{fileType}}": "",
137
+ "Delete {{fileType}}": "Видалити {{fileType}}",
138
138
  "This {{fileType}} and related interpretations will be deleted. Continue?": "",
139
139
  "Delete": "Видалити",
140
140
  "File": "Файл",
@@ -149,10 +149,10 @@
149
149
  "Get link…": "",
150
150
  "Open in this app": "Відкрити в цьому додатку",
151
151
  "Close": "Закрити",
152
- "Rename {{fileType}}": "",
152
+ "Rename {{fileType}}": "Перейменувати {{fileType}}",
153
153
  "Rename": "Перейменувати",
154
154
  "{{- objectName}} (copy)": "",
155
- "Save {{fileType}} as": "",
155
+ "Save {{fileType}} as": "Зберегти {{fileType}} як",
156
156
  "event report": "звіт про подію",
157
157
  "line list": "",
158
158
  "map": "мапа",
@@ -6,7 +6,7 @@
6
6
  "Shared with {{commaSeparatedListOfUsersAndGroups}}": "",
7
7
  "Not shared with any users or groups": "",
8
8
  "No description": "Тавсиф йўқ",
9
- "Last updated {{time}}": "",
9
+ "Last updated {{time}}": "Охирги марта янгиланган {{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
12
  "Viewed {{count}} times": "",
@@ -131,7 +131,7 @@
131
131
  "Nothing found in {{- dimensionTitle}}": "",
132
132
  "Search": "Излаш",
133
133
  "Nothing found for {{- searchTerm}}": "",
134
- "Delete {{fileType}}": "",
134
+ "Delete {{fileType}}": "Ўчириб ташлаш {{fileType}}",
135
135
  "This {{fileType}} and related interpretations will be deleted. Continue?": "",
136
136
  "Delete": "Ўчириб ташлаш",
137
137
  "File": "Файл",
@@ -146,10 +146,10 @@
146
146
  "Get link…": "",
147
147
  "Open in this app": "Ушбу иловада очинг",
148
148
  "Close": "Ёпиш",
149
- "Rename {{fileType}}": "",
149
+ "Rename {{fileType}}": "Қайта номлаш {{fileType}}",
150
150
  "Rename": "Қайта номлашч",
151
151
  "{{- objectName}} (copy)": "",
152
- "Save {{fileType}} as": "",
152
+ "Save {{fileType}} as": "{{fileType}} ни сифатида сақлаш",
153
153
  "event report": "ҳодиса/тадбир ҳисоботи",
154
154
  "line list": "",
155
155
  "map": "харита",
@@ -131,7 +131,7 @@
131
131
  "Nothing found in {{- dimensionTitle}}": "",
132
132
  "Search": "Izlash",
133
133
  "Nothing found for {{- searchTerm}}": "",
134
- "Delete {{fileType}}": "",
134
+ "Delete {{fileType}}": "Oʼchirib tashlash {{fileType}}",
135
135
  "This {{fileType}} and related interpretations will be deleted. Continue?": "",
136
136
  "Delete": "Oʼchirib tashlash",
137
137
  "File": "Fayl",
@@ -146,10 +146,10 @@
146
146
  "Get link…": "",
147
147
  "Open in this app": "Ushbu ilovada oching",
148
148
  "Close": "Yopmoq",
149
- "Rename {{fileType}}": "",
149
+ "Rename {{fileType}}": "Qayta nomlash {{fileType}}",
150
150
  "Rename": "Қайта номлаш",
151
151
  "{{- objectName}} (copy)": "",
152
- "Save {{fileType}} as": "",
152
+ "Save {{fileType}} as": "{{fileType}} ni sifatida saqlash",
153
153
  "event report": "hodisa/tadbir hisoboti",
154
154
  "line list": "",
155
155
  "map": "xarita",
@@ -50,21 +50,21 @@
50
50
  "Disaggregation": "分解",
51
51
  "No data": "无数据",
52
52
  "Expression description": "表达式描述",
53
- "Error loading value": "",
53
+ "Error loading value": "错误加载值",
54
54
  "None": "没有",
55
- "Data set(s)": "",
56
- "Zero is significant": "",
55
+ "Data set(s)": "数据集",
56
+ "Zero is significant": "零具有重要意义",
57
57
  "True": "真",
58
58
  "False": "假",
59
59
  "Value type": "值类型",
60
60
  "Aggregation type": "汇总类型",
61
61
  "Category combo": "分类组合",
62
62
  "Option set": "值域选项集",
63
- "Group membership": "",
64
- "Legend set(s)": "",
65
- "Category option name": "",
66
- "Category combo name": "",
67
- "Categories name": "",
63
+ "Group membership": "小组成员",
64
+ "Legend set(s)": "图例集",
65
+ "Category option name": "类别选项名称",
66
+ "Category combo name": "类别组合名称",
67
+ "Categories name": "类别名称",
68
68
  "Period type": "周期类型",
69
69
  "Indicators": "指标",
70
70
  "Expiry days": "过期满天数",
@@ -72,20 +72,20 @@
72
72
  "Data element": "数据元",
73
73
  "Tracked entity attribute": "跟踪的实体属性",
74
74
  "Numerator description": "描述",
75
- "Numerator expression": "",
75
+ "Numerator expression": "分母表达式",
76
76
  "Denominator description": "分母描述",
77
- "Denominator expression": "",
77
+ "Denominator expression": "分母表达式",
78
78
  "Annualized": "年度",
79
79
  "Yes": "是",
80
80
  "No": "否",
81
81
  "Indicator type": "指标类型",
82
- "Decimals in output": "",
83
- "There was a problem loading information for this data item.": "",
82
+ "Decimals in output": "输出中的小数",
83
+ "There was a problem loading information for this data item.": "该数据项的信息加载有问题。",
84
84
  "Name": "名称",
85
85
  "Description": "描述",
86
86
  "Code": "代码",
87
87
  "ID": "Id",
88
- "Last updated date": "",
88
+ "Last updated date": "最后更新日期",
89
89
  "Created date": "创建日期",
90
90
  "Created by": "创建人",
91
91
  "Custom": "定制",
@@ -94,7 +94,7 @@
94
94
  "Enrollment": "报名",
95
95
  "Event": "事件",
96
96
  "Analytics period boundaries": "分析期间边界",
97
- "{{ offsetPeriodType }} × {{ offsetPeriods }}": "",
97
+ "{{ offsetPeriodType }} × {{ offsetPeriods }}": "{{ offsetPeriodType }} ×{{ offsetPeriods }}",
98
98
  "Expression": "表达式",
99
99
  "Filter": "过滤器",
100
100
  "Search by data item name": "按数据项名称搜索",
@@ -398,7 +398,7 @@
398
398
  "Assigned Categories": "指定的分类",
399
399
  "Text": "文本",
400
400
  "Long text": "长文本",
401
- "Multi text": "",
401
+ "Multi text": "多种文本",
402
402
  "Letter": "字符",
403
403
  "Phone number": "电话号码",
404
404
  "Email": "邮件",
@@ -6,7 +6,7 @@
6
6
  "Shared with {{commaSeparatedListOfUsersAndGroups}}": "",
7
7
  "Not shared with any users or groups": "",
8
8
  "No description": "没有描述",
9
- "Last updated {{time}}": "",
9
+ "Last updated {{time}}": "最近更新的{{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
12
  "Viewed {{count}} times": "",
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.INSTALLATION_STATES = void 0;
7
+ exports.getPWAInstallationStatus = getPWAInstallationStatus;
8
+ const INSTALLATION_STATES = exports.INSTALLATION_STATES = {
9
+ READY: 'READY',
10
+ INSTALLING: 'INSTALLING'
11
+ };
12
+ function handleInstallingWorker(_ref) {
13
+ let {
14
+ installingWorker,
15
+ onStateChange
16
+ } = _ref;
17
+ installingWorker.onstatechange = () => {
18
+ if (installingWorker.state === 'activated') {
19
+ // ... and update state to 'ready'
20
+ onStateChange(INSTALLATION_STATES.READY);
21
+ }
22
+ };
23
+ }
24
+
25
+ /**
26
+ * Gets the current installation state of the PWA features, which is intended
27
+ * to be reported from this plugin to the parent app to indicate that the
28
+ * static assets are cached and ready to be accessed locally instead of over
29
+ * the network.
30
+ *
31
+ * Returns either READY, INSTALLING, or `null` for not installed/won't install
32
+ */
33
+ async function getPWAInstallationStatus(_ref2) {
34
+ let {
35
+ onStateChange
36
+ } = _ref2;
37
+ if (!navigator.serviceWorker) {
38
+ // Nothing to do here
39
+ return null;
40
+ }
41
+ const registration = await navigator.serviceWorker.getRegistration();
42
+ if (!registration) {
43
+ // This shouldn't happen since this is a PWA app, but return null
44
+ return null;
45
+ }
46
+ if (registration.active) {
47
+ return INSTALLATION_STATES.READY;
48
+ }
49
+ // note that 'registration.waiting' is skipped - it implies there's an active one
50
+ if (registration.installing) {
51
+ handleInstallingWorker({
52
+ installingWorker: registration.installing,
53
+ onStateChange
54
+ });
55
+ return INSTALLATION_STATES.INSTALLING;
56
+ }
57
+
58
+ // It shouldn't normally be possible to get here, but just in case,
59
+ // listen for installations
60
+ registration.onupdatefound = () => {
61
+ // update state for this plugin to 'installing'
62
+ onStateChange(INSTALLATION_STATES.INSTALLING);
63
+
64
+ // also listen for the installing worker to become active
65
+ const installingWorker = registration.installing;
66
+ if (!installingWorker) {
67
+ return;
68
+ }
69
+ handleInstallingWorker({
70
+ installingWorker,
71
+ onStateChange
72
+ });
73
+ };
74
+
75
+ // and in the mean time, return null to show 'not installed'
76
+ return null;
77
+ }
@@ -194,6 +194,5 @@ function _default(_ref) {
194
194
 
195
195
  // force apply extra config
196
196
  Object.assign(config, extraConfig);
197
- console.log((0, _objectClean.default)(config));
198
197
  return (0, _objectClean.default)(config);
199
198
  }
@@ -0,0 +1,82 @@
1
+ import { useCacheableSection, CacheableSection, useConfig } from '@dhis2/app-runtime';
2
+ import { CenteredContent, CircularLoader, CssVariables, Layer } from '@dhis2/ui';
3
+ import PropTypes from 'prop-types';
4
+ import React, { useEffect } from 'react';
5
+ import { getPWAInstallationStatus } from '../../modules/getPWAInstallationStatus.js';
6
+ const LoadingMask = () => {
7
+ return /*#__PURE__*/React.createElement(Layer, null, /*#__PURE__*/React.createElement(CenteredContent, null, /*#__PURE__*/React.createElement(CircularLoader, null)));
8
+ };
9
+ const CacheableSectionWrapper = _ref => {
10
+ let {
11
+ id,
12
+ children,
13
+ isParentCached
14
+ } = _ref;
15
+ const {
16
+ startRecording,
17
+ isCached,
18
+ remove
19
+ } = useCacheableSection(id);
20
+ useEffect(() => {
21
+ if (isParentCached && !isCached) {
22
+ startRecording({
23
+ onError: console.error
24
+ });
25
+ } else if (!isParentCached && isCached) {
26
+ // Synchronize cache state on load or prop update
27
+ // -- a back-up to imperative `removeCachedData`
28
+ remove();
29
+ }
30
+ }, [isCached, isParentCached, remove, startRecording]);
31
+ return /*#__PURE__*/React.createElement(CacheableSection, {
32
+ id: id,
33
+ loadingMask: /*#__PURE__*/React.createElement(LoadingMask, null)
34
+ }, children);
35
+ };
36
+ CacheableSectionWrapper.propTypes = {
37
+ children: PropTypes.node,
38
+ id: PropTypes.string,
39
+ isParentCached: PropTypes.bool
40
+ };
41
+ export const DashboardPluginWrapper = _ref2 => {
42
+ let {
43
+ onInstallationStatusChange,
44
+ children,
45
+ cacheId,
46
+ isParentCached,
47
+ ...props
48
+ } = _ref2;
49
+ const {
50
+ pwaEnabled
51
+ } = useConfig();
52
+ useEffect(() => {
53
+ // Get & send PWA installation status now
54
+ getPWAInstallationStatus({
55
+ onStateChange: onInstallationStatusChange
56
+ }).then(onInstallationStatusChange);
57
+ }, [onInstallationStatusChange]);
58
+ return props ? /*#__PURE__*/React.createElement("div", {
59
+ style: {
60
+ display: 'flex',
61
+ height: '100%',
62
+ overflow: 'hidden'
63
+ }
64
+ }, pwaEnabled ? /*#__PURE__*/React.createElement(CacheableSectionWrapper, {
65
+ id: cacheId,
66
+ isParentCached: isParentCached
67
+ }, children(props)) : children(props), /*#__PURE__*/React.createElement(CssVariables, {
68
+ colors: true,
69
+ spacers: true,
70
+ elevations: true
71
+ })) : null;
72
+ };
73
+ DashboardPluginWrapper.defaultProps = {
74
+ isParentCached: false,
75
+ onInstallationStatusChange: Function.prototype
76
+ };
77
+ DashboardPluginWrapper.propTypes = {
78
+ cacheId: PropTypes.string,
79
+ children: PropTypes.func,
80
+ isParentCached: PropTypes.bool,
81
+ onInstallationStatusChange: PropTypes.func
82
+ };
@@ -1,6 +1,5 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
- import { Popper } from '@dhis2-ui/popper';
3
- import { Portal } from '@dhis2-ui/portal';
2
+ import { Popper, Portal } from '@dhis2/ui';
4
3
  import cx from 'classnames';
5
4
  import PropTypes from 'prop-types';
6
5
  import React, { useRef } from 'react';
@@ -1,5 +1,5 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
- import { colors, elevations, spacers } from '@dhis2/ui-constants';
2
+ import { colors, elevations, spacers } from '@dhis2/ui';
3
3
  import PropTypes from 'prop-types';
4
4
  import React, { createContext, useCallback, useContext, useState } from 'react';
5
5
  import { useHoverMenubarContext } from './HoverMenuBar.js';
@@ -1,7 +1,5 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
- import { IconChevronRight24 } from '@dhis2/ui-icons';
3
- import { Popper } from '@dhis2-ui/popper';
4
- import { Portal } from '@dhis2-ui/portal';
2
+ import { IconChevronRight24, Popper, Portal } from '@dhis2/ui';
5
3
  import cx from 'classnames';
6
4
  import PropTypes from 'prop-types';
7
5
  import React, { useRef } from 'react';
@@ -1,4 +1,4 @@
1
- import { colors, spacers } from '@dhis2/ui-constants';
1
+ import { colors, spacers } from '@dhis2/ui';
2
2
  const _defaultExport = [`li.jsx-3263820070{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0px ${spacers.dp24};cursor:pointer;list-style:none;background-color:${colors.white};color:${colors.grey900};fill:${colors.grey900};font-size:14px;line-height:16px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}`, `li.jsx-3263820070:hover,li.jsx-3263820070:active,li.active.jsx-3263820070{background-color:${colors.grey200};}`, `li.dense.jsx-3263820070{padding:0px ${spacers.dp12};}`, `li.destructive.jsx-3263820070{color:${colors.red700};fill:${colors.red600};}`, `li.destructive.jsx-3263820070:hover{background-color:${colors.red050};}`, `li.destructive.jsx-3263820070:active,li.destructive.active.jsx-3263820070{background-color:${colors.red100};}`, `li.disabled.jsx-3263820070{cursor:not-allowed;color:${colors.grey500};fill:${colors.grey500};}`, `li.disabled.jsx-3263820070:hover{background-color:${colors.white};}`, `.label.jsx-3263820070{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;padding:${spacers.dp12} 0;}`, `li.dense.jsx-3263820070 .label.jsx-3263820070{padding:${spacers.dp8} 0;}`, `.icon.jsx-3263820070{-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;margin-right:${spacers.dp12};width:24px;height:24px;}`, `.chevron.jsx-3263820070{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;margin-left:${spacers.dp24};}`, `li.dense.jsx-3263820070 .icon.jsx-3263820070{margin-right:${spacers.dp8};width:16px;height:16px;}`, "li.jsx-3263820070 .icon.jsx-3263820070>svg{width:24px;height:24px;}", "li.dense.jsx-3263820070 .icon.jsx-3263820070>svg,li.jsx-3263820070 .chevron.jsx-3263820070>svg{width:16px;height:16px;}"];
3
3
  _defaultExport.__hash = "3263820070";
4
4
  export default _defaultExport;
@@ -1,4 +1,4 @@
1
- import { colors, spacers, theme } from '@dhis2/ui-constants';
1
+ import { colors, spacers, theme } from '@dhis2/ui';
2
2
  const _defaultExport = [`button.jsx-3546699693{all:unset;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-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;line-height:14px;padding:0 ${spacers.dp12};color:${colors.grey900};cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}`, `button.jsx-3546699693:hover.jsx-3546699693:enabled,button.jsx-3546699693:active.jsx-3546699693:enabled,button.isOpen.jsx-3546699693{background-color:${colors.grey200};}`, `button.jsx-3546699693:focus{outline:3px solid ${theme.focus};outline-offset:-3px;}`, "button.jsx-3546699693:focus.jsx-3546699693:not(:focus-visible){outline:none;}", `button.jsx-3546699693:disabled{color:${colors.grey500};cursor:not-allowed;}`];
3
3
  _defaultExport.__hash = "3546699693";
4
4
  export default _defaultExport;
@@ -1,5 +1,5 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
- import { colors } from '@dhis2/ui-constants';
2
+ import { colors } from '@dhis2/ui';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
5
  export const Toolbar = _ref => {
@@ -1,5 +1,5 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
- import { colors } from '@dhis2/ui-constants';
2
+ import { colors } from '@dhis2/ui';
3
3
  import cx from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
5
  import React from 'react';
@@ -1,8 +1,6 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
2
  import i18n from '@dhis2/d2-i18n';
3
- import { colors } from '@dhis2/ui-constants';
4
- import { IconSync16 } from '@dhis2/ui-icons';
5
- import { CircularLoader } from '@dhis2-ui/loader';
3
+ import { CircularLoader, IconSync16, colors } from '@dhis2/ui';
6
4
  import PropTypes from 'prop-types';
7
5
  import React from 'react';
8
6
  import menuButtonStyles from './MenuButton.styles.js';
package/build/es/index.js CHANGED
@@ -23,6 +23,7 @@ export { TranslationDialog } from './components/TranslationDialog/index.js';
23
23
  export { OfflineTooltip } from './components/OfflineTooltip.js';
24
24
  export { CachedDataQueryProvider, useCachedDataQuery } from './components/CachedDataQueryProvider.js';
25
25
  export * from './components/RichText/index.js';
26
+ export { DashboardPluginWrapper } from './components/DashboardPluginWrapper/DashboardPluginWrapper.js';
26
27
 
27
28
  // Api
28
29
 
@@ -6,7 +6,7 @@
6
6
  "Shared with {{commaSeparatedListOfUsersAndGroups}}": "",
7
7
  "Not shared with any users or groups": "",
8
8
  "No description": "لا يوجد وصف",
9
- "Last updated {{time}}": "",
9
+ "Last updated {{time}}": "آخر تحديث {{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
12
  "Viewed {{count}} times_0": "",
@@ -136,7 +136,7 @@
136
136
  "Nothing found in {{- dimensionTitle}}": "",
137
137
  "Search": "البحث",
138
138
  "Nothing found for {{- searchTerm}}": "",
139
- "Delete {{fileType}}": "",
139
+ "Delete {{fileType}}": "حذف {{fileType}}",
140
140
  "This {{fileType}} and related interpretations will be deleted. Continue?": "",
141
141
  "Delete": "حذف",
142
142
  "File": "ملف",
@@ -151,10 +151,10 @@
151
151
  "Get link…": "",
152
152
  "Open in this app": "فتح في هذا التطبيق",
153
153
  "Close": "إغلاق",
154
- "Rename {{fileType}}": "",
154
+ "Rename {{fileType}}": "إعادة تسمية {{fileType}}",
155
155
  "Rename": "إعادة التسمية",
156
156
  "{{- objectName}} (copy)": "",
157
- "Save {{fileType}} as": "",
157
+ "Save {{fileType}} as": "حفظ {{fileType}} بإسم",
158
158
  "event report": "تقارير عن الأحداث",
159
159
  "line list": "",
160
160
  "map": "خريطة",
@@ -6,7 +6,7 @@
6
6
  "Shared with {{commaSeparatedListOfUsersAndGroups}}": "",
7
7
  "Not shared with any users or groups": "",
8
8
  "No description": "Tidak ada deskripsi",
9
- "Last updated {{time}}": "",
9
+ "Last updated {{time}}": "Terakhir diperbarui {{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
12
  "Viewed {{count}} times": "",
@@ -6,7 +6,7 @@
6
6
  "Shared with {{commaSeparatedListOfUsersAndGroups}}": "",
7
7
  "Not shared with any users or groups": "",
8
8
  "No description": "",
9
- "Last updated {{time}}": "",
9
+ "Last updated {{time}}": "Ultima actualizare {{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
12
  "Viewed {{count}} times_0": "",
@@ -6,7 +6,7 @@
6
6
  "Shared with {{commaSeparatedListOfUsersAndGroups}}": "",
7
7
  "Not shared with any users or groups": "",
8
8
  "No description": "Нет описания",
9
- "Last updated {{time}}": "",
9
+ "Last updated {{time}}": "Последнее обновление: {{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
12
  "Viewed {{count}} times_0": "",
@@ -134,7 +134,7 @@
134
134
  "Nothing found in {{- dimensionTitle}}": "",
135
135
  "Search": "Поиск",
136
136
  "Nothing found for {{- searchTerm}}": "",
137
- "Delete {{fileType}}": "",
137
+ "Delete {{fileType}}": "Удалить {{fileType}}",
138
138
  "This {{fileType}} and related interpretations will be deleted. Continue?": "",
139
139
  "Delete": "Удалить",
140
140
  "File": "Файл",
@@ -149,10 +149,10 @@
149
149
  "Get link…": "",
150
150
  "Open in this app": "Открыть в данном приложении",
151
151
  "Close": "Закрыть",
152
- "Rename {{fileType}}": "",
152
+ "Rename {{fileType}}": "Переименовать {{fileType}}",
153
153
  "Rename": "Переименовать",
154
154
  "{{- objectName}} (copy)": "",
155
- "Save {{fileType}} as": "",
155
+ "Save {{fileType}} as": "Сохранить {{fileType}} как",
156
156
  "event report": "Отчет случаев",
157
157
  "line list": "",
158
158
  "map": "Карта",
@@ -134,7 +134,7 @@
134
134
  "Nothing found in {{- dimensionTitle}}": "",
135
135
  "Search": "Пошук",
136
136
  "Nothing found for {{- searchTerm}}": "",
137
- "Delete {{fileType}}": "",
137
+ "Delete {{fileType}}": "Видалити {{fileType}}",
138
138
  "This {{fileType}} and related interpretations will be deleted. Continue?": "",
139
139
  "Delete": "Видалити",
140
140
  "File": "Файл",
@@ -149,10 +149,10 @@
149
149
  "Get link…": "",
150
150
  "Open in this app": "Відкрити в цьому додатку",
151
151
  "Close": "Закрити",
152
- "Rename {{fileType}}": "",
152
+ "Rename {{fileType}}": "Перейменувати {{fileType}}",
153
153
  "Rename": "Перейменувати",
154
154
  "{{- objectName}} (copy)": "",
155
- "Save {{fileType}} as": "",
155
+ "Save {{fileType}} as": "Зберегти {{fileType}} як",
156
156
  "event report": "звіт про подію",
157
157
  "line list": "",
158
158
  "map": "мапа",
@@ -6,7 +6,7 @@
6
6
  "Shared with {{commaSeparatedListOfUsersAndGroups}}": "",
7
7
  "Not shared with any users or groups": "",
8
8
  "No description": "Тавсиф йўқ",
9
- "Last updated {{time}}": "",
9
+ "Last updated {{time}}": "Охирги марта янгиланган {{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
12
  "Viewed {{count}} times": "",
@@ -131,7 +131,7 @@
131
131
  "Nothing found in {{- dimensionTitle}}": "",
132
132
  "Search": "Излаш",
133
133
  "Nothing found for {{- searchTerm}}": "",
134
- "Delete {{fileType}}": "",
134
+ "Delete {{fileType}}": "Ўчириб ташлаш {{fileType}}",
135
135
  "This {{fileType}} and related interpretations will be deleted. Continue?": "",
136
136
  "Delete": "Ўчириб ташлаш",
137
137
  "File": "Файл",
@@ -146,10 +146,10 @@
146
146
  "Get link…": "",
147
147
  "Open in this app": "Ушбу иловада очинг",
148
148
  "Close": "Ёпиш",
149
- "Rename {{fileType}}": "",
149
+ "Rename {{fileType}}": "Қайта номлаш {{fileType}}",
150
150
  "Rename": "Қайта номлашч",
151
151
  "{{- objectName}} (copy)": "",
152
- "Save {{fileType}} as": "",
152
+ "Save {{fileType}} as": "{{fileType}} ни сифатида сақлаш",
153
153
  "event report": "ҳодиса/тадбир ҳисоботи",
154
154
  "line list": "",
155
155
  "map": "харита",
@@ -131,7 +131,7 @@
131
131
  "Nothing found in {{- dimensionTitle}}": "",
132
132
  "Search": "Izlash",
133
133
  "Nothing found for {{- searchTerm}}": "",
134
- "Delete {{fileType}}": "",
134
+ "Delete {{fileType}}": "Oʼchirib tashlash {{fileType}}",
135
135
  "This {{fileType}} and related interpretations will be deleted. Continue?": "",
136
136
  "Delete": "Oʼchirib tashlash",
137
137
  "File": "Fayl",
@@ -146,10 +146,10 @@
146
146
  "Get link…": "",
147
147
  "Open in this app": "Ushbu ilovada oching",
148
148
  "Close": "Yopmoq",
149
- "Rename {{fileType}}": "",
149
+ "Rename {{fileType}}": "Qayta nomlash {{fileType}}",
150
150
  "Rename": "Қайта номлаш",
151
151
  "{{- objectName}} (copy)": "",
152
- "Save {{fileType}} as": "",
152
+ "Save {{fileType}} as": "{{fileType}} ni sifatida saqlash",
153
153
  "event report": "hodisa/tadbir hisoboti",
154
154
  "line list": "",
155
155
  "map": "xarita",
@@ -50,21 +50,21 @@
50
50
  "Disaggregation": "分解",
51
51
  "No data": "无数据",
52
52
  "Expression description": "表达式描述",
53
- "Error loading value": "",
53
+ "Error loading value": "错误加载值",
54
54
  "None": "没有",
55
- "Data set(s)": "",
56
- "Zero is significant": "",
55
+ "Data set(s)": "数据集",
56
+ "Zero is significant": "零具有重要意义",
57
57
  "True": "真",
58
58
  "False": "假",
59
59
  "Value type": "值类型",
60
60
  "Aggregation type": "汇总类型",
61
61
  "Category combo": "分类组合",
62
62
  "Option set": "值域选项集",
63
- "Group membership": "",
64
- "Legend set(s)": "",
65
- "Category option name": "",
66
- "Category combo name": "",
67
- "Categories name": "",
63
+ "Group membership": "小组成员",
64
+ "Legend set(s)": "图例集",
65
+ "Category option name": "类别选项名称",
66
+ "Category combo name": "类别组合名称",
67
+ "Categories name": "类别名称",
68
68
  "Period type": "周期类型",
69
69
  "Indicators": "指标",
70
70
  "Expiry days": "过期满天数",
@@ -72,20 +72,20 @@
72
72
  "Data element": "数据元",
73
73
  "Tracked entity attribute": "跟踪的实体属性",
74
74
  "Numerator description": "描述",
75
- "Numerator expression": "",
75
+ "Numerator expression": "分母表达式",
76
76
  "Denominator description": "分母描述",
77
- "Denominator expression": "",
77
+ "Denominator expression": "分母表达式",
78
78
  "Annualized": "年度",
79
79
  "Yes": "是",
80
80
  "No": "否",
81
81
  "Indicator type": "指标类型",
82
- "Decimals in output": "",
83
- "There was a problem loading information for this data item.": "",
82
+ "Decimals in output": "输出中的小数",
83
+ "There was a problem loading information for this data item.": "该数据项的信息加载有问题。",
84
84
  "Name": "名称",
85
85
  "Description": "描述",
86
86
  "Code": "代码",
87
87
  "ID": "Id",
88
- "Last updated date": "",
88
+ "Last updated date": "最后更新日期",
89
89
  "Created date": "创建日期",
90
90
  "Created by": "创建人",
91
91
  "Custom": "定制",
@@ -94,7 +94,7 @@
94
94
  "Enrollment": "报名",
95
95
  "Event": "事件",
96
96
  "Analytics period boundaries": "分析期间边界",
97
- "{{ offsetPeriodType }} × {{ offsetPeriods }}": "",
97
+ "{{ offsetPeriodType }} × {{ offsetPeriods }}": "{{ offsetPeriodType }} ×{{ offsetPeriods }}",
98
98
  "Expression": "表达式",
99
99
  "Filter": "过滤器",
100
100
  "Search by data item name": "按数据项名称搜索",
@@ -398,7 +398,7 @@
398
398
  "Assigned Categories": "指定的分类",
399
399
  "Text": "文本",
400
400
  "Long text": "长文本",
401
- "Multi text": "",
401
+ "Multi text": "多种文本",
402
402
  "Letter": "字符",
403
403
  "Phone number": "电话号码",
404
404
  "Email": "邮件",
@@ -6,7 +6,7 @@
6
6
  "Shared with {{commaSeparatedListOfUsersAndGroups}}": "",
7
7
  "Not shared with any users or groups": "",
8
8
  "No description": "没有描述",
9
- "Last updated {{time}}": "",
9
+ "Last updated {{time}}": "最近更新的{{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
12
  "Viewed {{count}} times": "",
@@ -0,0 +1,70 @@
1
+ export const INSTALLATION_STATES = {
2
+ READY: 'READY',
3
+ INSTALLING: 'INSTALLING'
4
+ };
5
+ function handleInstallingWorker(_ref) {
6
+ let {
7
+ installingWorker,
8
+ onStateChange
9
+ } = _ref;
10
+ installingWorker.onstatechange = () => {
11
+ if (installingWorker.state === 'activated') {
12
+ // ... and update state to 'ready'
13
+ onStateChange(INSTALLATION_STATES.READY);
14
+ }
15
+ };
16
+ }
17
+
18
+ /**
19
+ * Gets the current installation state of the PWA features, which is intended
20
+ * to be reported from this plugin to the parent app to indicate that the
21
+ * static assets are cached and ready to be accessed locally instead of over
22
+ * the network.
23
+ *
24
+ * Returns either READY, INSTALLING, or `null` for not installed/won't install
25
+ */
26
+ export async function getPWAInstallationStatus(_ref2) {
27
+ let {
28
+ onStateChange
29
+ } = _ref2;
30
+ if (!navigator.serviceWorker) {
31
+ // Nothing to do here
32
+ return null;
33
+ }
34
+ const registration = await navigator.serviceWorker.getRegistration();
35
+ if (!registration) {
36
+ // This shouldn't happen since this is a PWA app, but return null
37
+ return null;
38
+ }
39
+ if (registration.active) {
40
+ return INSTALLATION_STATES.READY;
41
+ }
42
+ // note that 'registration.waiting' is skipped - it implies there's an active one
43
+ if (registration.installing) {
44
+ handleInstallingWorker({
45
+ installingWorker: registration.installing,
46
+ onStateChange
47
+ });
48
+ return INSTALLATION_STATES.INSTALLING;
49
+ }
50
+
51
+ // It shouldn't normally be possible to get here, but just in case,
52
+ // listen for installations
53
+ registration.onupdatefound = () => {
54
+ // update state for this plugin to 'installing'
55
+ onStateChange(INSTALLATION_STATES.INSTALLING);
56
+
57
+ // also listen for the installing worker to become active
58
+ const installingWorker = registration.installing;
59
+ if (!installingWorker) {
60
+ return;
61
+ }
62
+ handleInstallingWorker({
63
+ installingWorker,
64
+ onStateChange
65
+ });
66
+ };
67
+
68
+ // and in the mean time, return null to show 'not installed'
69
+ return null;
70
+ }
@@ -185,6 +185,5 @@ export default function (_ref) {
185
185
 
186
186
  // force apply extra config
187
187
  Object.assign(config, extraConfig);
188
- console.log(objectClean(config));
189
188
  return objectClean(config);
190
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "26.11.0",
3
+ "version": "26.12.0",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {
@@ -30,8 +30,8 @@
30
30
  "validate-push": "yarn test"
31
31
  },
32
32
  "devDependencies": {
33
- "@dhis2/app-runtime": "^3.11.3",
34
- "@dhis2/cli-app-scripts": "^11.7.4",
33
+ "@dhis2/app-runtime": "^3.13.2",
34
+ "@dhis2/cli-app-scripts": "^11.8.0",
35
35
  "@dhis2/cli-style": "^10.7.4",
36
36
  "@dhis2/d2-i18n": "^1.1.0",
37
37
  "@dhis2/ui": "^10.1.9",