@dhis2/analytics 24.1.0 → 24.2.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [24.2.0](https://github.com/dhis2/analytics/compare/v24.1.1...v24.2.0) (2022-09-29)
2
+
3
+
4
+ ### Features
5
+
6
+ * export TranslationDialog component ([#1342](https://github.com/dhis2/analytics/issues/1342)) ([4cf833f](https://github.com/dhis2/analytics/commit/4cf833f49284ad9ddfcd966ee79760aacb5a3d3e))
7
+
8
+ ## [24.1.1](https://github.com/dhis2/analytics/compare/v24.1.0...v24.1.1) (2022-09-15)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **translations:** sync translations from transifex (master) ([0425bed](https://github.com/dhis2/analytics/commit/0425bedd5bc9022341eb36e5fd347f10c7f5fe7f))
14
+
1
15
  # [24.1.0](https://github.com/dhis2/analytics/compare/v24.0.9...v24.1.0) (2022-09-12)
2
16
 
3
17
 
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OfflineTooltip = void 0;
7
+
8
+ var _appRuntime = require("@dhis2/app-runtime");
9
+
10
+ var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
11
+
12
+ var _ui = require("@dhis2/ui");
13
+
14
+ var _classnames = _interopRequireDefault(require("classnames"));
15
+
16
+ var _propTypes = _interopRequireDefault(require("prop-types"));
17
+
18
+ var _react = _interopRequireDefault(require("react"));
19
+
20
+ var _OfflineTooltipModule = _interopRequireDefault(require("./styles/OfflineTooltip.module.css"));
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ const OfflineTooltip = _ref => {
25
+ let {
26
+ disabledWhenOffline,
27
+ disabled,
28
+ content,
29
+ children
30
+ } = _ref;
31
+ const {
32
+ offline
33
+ } = (0, _appRuntime.useOnlineStatus)();
34
+ const notAllowed = disabled || disabledWhenOffline && offline;
35
+ return /*#__PURE__*/_react.default.createElement(_ui.Tooltip, {
36
+ content: content || _d2I18n.default.t('Not available offline'),
37
+ openDelay: 200,
38
+ closeDelay: 100
39
+ }, _ref2 => {
40
+ let {
41
+ onMouseOver,
42
+ onMouseOut,
43
+ ref
44
+ } = _ref2;
45
+ return /*#__PURE__*/_react.default.createElement("span", {
46
+ className: (0, _classnames.default)(_OfflineTooltipModule.default.span, notAllowed && _OfflineTooltipModule.default.notAllowed),
47
+ onMouseOver: () => notAllowed && onMouseOver(),
48
+ onMouseOut: () => notAllowed && onMouseOut(),
49
+ ref: ref
50
+ }, children);
51
+ });
52
+ };
53
+
54
+ exports.OfflineTooltip = OfflineTooltip;
55
+ OfflineTooltip.propTypes = {
56
+ children: _propTypes.default.node,
57
+ content: _propTypes.default.string,
58
+ disabled: _propTypes.default.bool,
59
+ disabledWhenOffline: _propTypes.default.bool
60
+ };
61
+ OfflineTooltip.defaultProps = {
62
+ disabled: false,
63
+ disabledWhenOffline: true
64
+ };
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.TranslationModalActions = void 0;
7
7
 
8
+ var _appRuntime = require("@dhis2/app-runtime");
9
+
8
10
  var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
9
11
 
10
12
  var _ui = require("@dhis2/ui");
@@ -13,24 +15,57 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
13
15
 
14
16
  var _react = _interopRequireDefault(require("react"));
15
17
 
18
+ var _OfflineTooltip = require("../../OfflineTooltip.js");
19
+
16
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
21
 
18
- const TranslationModalActions = _ref => {
22
+ const SaveButton = _ref => {
23
+ let {
24
+ disabled,
25
+ loading,
26
+ onClick
27
+ } = _ref;
28
+ return /*#__PURE__*/_react.default.createElement(_ui.Button, {
29
+ primary: true,
30
+ onClick: onClick,
31
+ loading: loading,
32
+ disabled: disabled
33
+ }, _d2I18n.default.t('Save translations'));
34
+ };
35
+
36
+ SaveButton.defaultProps = {
37
+ disabled: false,
38
+ loading: false,
39
+ onClick: Function.prototype
40
+ };
41
+ SaveButton.propTypes = {
42
+ disabled: _propTypes.default.bool.isRequired,
43
+ loading: _propTypes.default.bool.isRequired,
44
+ onClick: _propTypes.default.func.isRequired
45
+ };
46
+
47
+ const TranslationModalActions = _ref2 => {
19
48
  let {
20
49
  onClose,
21
50
  onSave,
22
51
  saveInProgress,
23
52
  saveButtonDisabled
24
- } = _ref;
53
+ } = _ref2;
54
+ const {
55
+ offline
56
+ } = (0, _appRuntime.useOnlineStatus)();
25
57
  return /*#__PURE__*/_react.default.createElement(_ui.ModalActions, null, /*#__PURE__*/_react.default.createElement(_ui.ButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
26
58
  secondary: true,
27
59
  onClick: onClose
28
- }, _d2I18n.default.t('Cancel')), /*#__PURE__*/_react.default.createElement(_ui.Button, {
29
- primary: true,
60
+ }, _d2I18n.default.t('Cancel')), offline ? /*#__PURE__*/_react.default.createElement(_OfflineTooltip.OfflineTooltip, {
61
+ content: _d2I18n.default.t('Cannot save while offline')
62
+ }, /*#__PURE__*/_react.default.createElement(SaveButton, {
63
+ disabled: true
64
+ })) : /*#__PURE__*/_react.default.createElement(SaveButton, {
30
65
  onClick: onSave,
31
66
  loading: saveInProgress,
32
67
  disabled: saveButtonDisabled
33
- }, _d2I18n.default.t('Save translations'))));
68
+ })));
34
69
  };
35
70
 
36
71
  exports.TranslationModalActions = TranslationModalActions;
@@ -0,0 +1,11 @@
1
+ .span {
2
+ display: inline-flex;
3
+ pointer-events: all;
4
+ }
5
+ .span > :global(button:disabled) {
6
+ pointer-events: none;
7
+ }
8
+
9
+ .notAllowed {
10
+ cursor: not-allowed;
11
+ }
@@ -48,13 +48,13 @@ Object.defineProperty(exports, "Analytics", {
48
48
  Object.defineProperty(exports, "BIMONTHLY", {
49
49
  enumerable: true,
50
50
  get: function () {
51
- return _index7.BIMONTHLY;
51
+ return _index8.BIMONTHLY;
52
52
  }
53
53
  });
54
54
  Object.defineProperty(exports, "BIWEEKLY", {
55
55
  enumerable: true,
56
56
  get: function () {
57
- return _index7.BIWEEKLY;
57
+ return _index8.BIWEEKLY;
58
58
  }
59
59
  });
60
60
  Object.defineProperty(exports, "COLOR_SET_BASIC", {
@@ -114,7 +114,7 @@ Object.defineProperty(exports, "CachedDataQueryProvider", {
114
114
  Object.defineProperty(exports, "DAILY", {
115
115
  enumerable: true,
116
116
  get: function () {
117
- return _index7.DAILY;
117
+ return _index8.DAILY;
118
118
  }
119
119
  });
120
120
  Object.defineProperty(exports, "DEFAULT_AXIS_IDS", {
@@ -312,7 +312,7 @@ Object.defineProperty(exports, "DynamicDimension", {
312
312
  Object.defineProperty(exports, "FINANCIAL", {
313
313
  enumerable: true,
314
314
  get: function () {
315
- return _index7.FINANCIAL;
315
+ return _index8.FINANCIAL;
316
316
  }
317
317
  });
318
318
  Object.defineProperty(exports, "FONT_STYLE_AXIS_LABELS", {
@@ -402,25 +402,25 @@ Object.defineProperty(exports, "FONT_STYLE_VISUALIZATION_TITLE", {
402
402
  Object.defineProperty(exports, "FYAPR", {
403
403
  enumerable: true,
404
404
  get: function () {
405
- return _index7.FYAPR;
405
+ return _index8.FYAPR;
406
406
  }
407
407
  });
408
408
  Object.defineProperty(exports, "FYJUL", {
409
409
  enumerable: true,
410
410
  get: function () {
411
- return _index7.FYJUL;
411
+ return _index8.FYJUL;
412
412
  }
413
413
  });
414
414
  Object.defineProperty(exports, "FYNOV", {
415
415
  enumerable: true,
416
416
  get: function () {
417
- return _index7.FYNOV;
417
+ return _index8.FYNOV;
418
418
  }
419
419
  });
420
420
  Object.defineProperty(exports, "FYOCT", {
421
421
  enumerable: true,
422
422
  get: function () {
423
- return _index7.FYOCT;
423
+ return _index8.FYOCT;
424
424
  }
425
425
  });
426
426
  Object.defineProperty(exports, "FileMenu", {
@@ -546,7 +546,13 @@ Object.defineProperty(exports, "LegendKey", {
546
546
  Object.defineProperty(exports, "MONTHLY", {
547
547
  enumerable: true,
548
548
  get: function () {
549
- return _index7.MONTHLY;
549
+ return _index8.MONTHLY;
550
+ }
551
+ });
552
+ Object.defineProperty(exports, "OfflineTooltip", {
553
+ enumerable: true,
554
+ get: function () {
555
+ return _OfflineTooltip.OfflineTooltip;
550
556
  }
551
557
  });
552
558
  Object.defineProperty(exports, "OrgUnitDimension", {
@@ -570,19 +576,19 @@ Object.defineProperty(exports, "PivotTable", {
570
576
  Object.defineProperty(exports, "QUARTERLY", {
571
577
  enumerable: true,
572
578
  get: function () {
573
- return _index7.QUARTERLY;
579
+ return _index8.QUARTERLY;
574
580
  }
575
581
  });
576
582
  Object.defineProperty(exports, "SIXMONTHLY", {
577
583
  enumerable: true,
578
584
  get: function () {
579
- return _index7.SIXMONTHLY;
585
+ return _index8.SIXMONTHLY;
580
586
  }
581
587
  });
582
588
  Object.defineProperty(exports, "SIXMONTHLYAPR", {
583
589
  enumerable: true,
584
590
  get: function () {
585
- return _index7.SIXMONTHLYAPR;
591
+ return _index8.SIXMONTHLYAPR;
586
592
  }
587
593
  });
588
594
  Object.defineProperty(exports, "TEXT_ALIGN_CENTER", {
@@ -603,22 +609,28 @@ Object.defineProperty(exports, "TEXT_ALIGN_RIGHT", {
603
609
  return _fontStyle.TEXT_ALIGN_RIGHT;
604
610
  }
605
611
  });
612
+ Object.defineProperty(exports, "TranslationDialog", {
613
+ enumerable: true,
614
+ get: function () {
615
+ return _index2.TranslationDialog;
616
+ }
617
+ });
606
618
  Object.defineProperty(exports, "USER_ORG_UNIT", {
607
619
  enumerable: true,
608
620
  get: function () {
609
- return _index2.USER_ORG_UNIT;
621
+ return _index3.USER_ORG_UNIT;
610
622
  }
611
623
  });
612
624
  Object.defineProperty(exports, "USER_ORG_UNIT_CHILDREN", {
613
625
  enumerable: true,
614
626
  get: function () {
615
- return _index2.USER_ORG_UNIT_CHILDREN;
627
+ return _index3.USER_ORG_UNIT_CHILDREN;
616
628
  }
617
629
  });
618
630
  Object.defineProperty(exports, "USER_ORG_UNIT_GRANDCHILDREN", {
619
631
  enumerable: true,
620
632
  get: function () {
621
- return _index2.USER_ORG_UNIT_GRANDCHILDREN;
633
+ return _index3.USER_ORG_UNIT_GRANDCHILDREN;
622
634
  }
623
635
  });
624
636
  Object.defineProperty(exports, "VALUE_TYPE_BOOLEAN", {
@@ -870,43 +882,43 @@ Object.defineProperty(exports, "VisualizationOptions", {
870
882
  Object.defineProperty(exports, "WEEKLY", {
871
883
  enumerable: true,
872
884
  get: function () {
873
- return _index7.WEEKLY;
885
+ return _index8.WEEKLY;
874
886
  }
875
887
  });
876
888
  Object.defineProperty(exports, "WEEKLYSAT", {
877
889
  enumerable: true,
878
890
  get: function () {
879
- return _index7.WEEKLYSAT;
891
+ return _index8.WEEKLYSAT;
880
892
  }
881
893
  });
882
894
  Object.defineProperty(exports, "WEEKLYSUN", {
883
895
  enumerable: true,
884
896
  get: function () {
885
- return _index7.WEEKLYSUN;
897
+ return _index8.WEEKLYSUN;
886
898
  }
887
899
  });
888
900
  Object.defineProperty(exports, "WEEKLYTHU", {
889
901
  enumerable: true,
890
902
  get: function () {
891
- return _index7.WEEKLYTHU;
903
+ return _index8.WEEKLYTHU;
892
904
  }
893
905
  });
894
906
  Object.defineProperty(exports, "WEEKLYWED", {
895
907
  enumerable: true,
896
908
  get: function () {
897
- return _index7.WEEKLYWED;
909
+ return _index8.WEEKLYWED;
898
910
  }
899
911
  });
900
912
  Object.defineProperty(exports, "WEEKS_THIS_YEAR", {
901
913
  enumerable: true,
902
914
  get: function () {
903
- return _index7.WEEKS_THIS_YEAR;
915
+ return _index8.WEEKS_THIS_YEAR;
904
916
  }
905
917
  });
906
918
  Object.defineProperty(exports, "YEARLY", {
907
919
  enumerable: true,
908
920
  get: function () {
909
- return _index7.YEARLY;
921
+ return _index8.YEARLY;
910
922
  }
911
923
  });
912
924
  Object.defineProperty(exports, "apiFetchDimensions", {
@@ -996,7 +1008,7 @@ Object.defineProperty(exports, "axisIsEmpty", {
996
1008
  Object.defineProperty(exports, "canDimensionBeAddedToAxis", {
997
1009
  enumerable: true,
998
1010
  get: function () {
999
- return _index5.canDimensionBeAddedToAxis;
1011
+ return _index6.canDimensionBeAddedToAxis;
1000
1012
  }
1001
1013
  });
1002
1014
  Object.defineProperty(exports, "colorSets", {
@@ -1008,13 +1020,13 @@ Object.defineProperty(exports, "colorSets", {
1008
1020
  Object.defineProperty(exports, "convertOuLevelsToUids", {
1009
1021
  enumerable: true,
1010
1022
  get: function () {
1011
- return _index3.convertOuLevelsToUids;
1023
+ return _index4.convertOuLevelsToUids;
1012
1024
  }
1013
1025
  });
1014
1026
  Object.defineProperty(exports, "createVisualization", {
1015
1027
  enumerable: true,
1016
1028
  get: function () {
1017
- return _index6.createVisualization;
1029
+ return _index7.createVisualization;
1018
1030
  }
1019
1031
  });
1020
1032
  Object.defineProperty(exports, "defaultFontStyle", {
@@ -1098,31 +1110,31 @@ Object.defineProperty(exports, "getAdaptedUiLayoutByType", {
1098
1110
  Object.defineProperty(exports, "getAllLockedDimensionIds", {
1099
1111
  enumerable: true,
1100
1112
  get: function () {
1101
- return _index5.getAllLockedDimensionIds;
1113
+ return _index6.getAllLockedDimensionIds;
1102
1114
  }
1103
1115
  });
1104
1116
  Object.defineProperty(exports, "getAvailableAxes", {
1105
1117
  enumerable: true,
1106
1118
  get: function () {
1107
- return _index5.getAvailableAxes;
1119
+ return _index6.getAvailableAxes;
1108
1120
  }
1109
1121
  });
1110
1122
  Object.defineProperty(exports, "getAxisMaxNumberOfDimensions", {
1111
1123
  enumerable: true,
1112
1124
  get: function () {
1113
- return _index5.getAxisMaxNumberOfDimensions;
1125
+ return _index6.getAxisMaxNumberOfDimensions;
1114
1126
  }
1115
1127
  });
1116
1128
  Object.defineProperty(exports, "getAxisMaxNumberOfItems", {
1117
1129
  enumerable: true,
1118
1130
  get: function () {
1119
- return _index5.getAxisMaxNumberOfItems;
1131
+ return _index6.getAxisMaxNumberOfItems;
1120
1132
  }
1121
1133
  });
1122
1134
  Object.defineProperty(exports, "getAxisMinNumberOfDimensions", {
1123
1135
  enumerable: true,
1124
1136
  get: function () {
1125
- return _index5.getAxisMinNumberOfDimensions;
1137
+ return _index6.getAxisMinNumberOfDimensions;
1126
1138
  }
1127
1139
  });
1128
1140
  Object.defineProperty(exports, "getAxisName", {
@@ -1140,7 +1152,7 @@ Object.defineProperty(exports, "getAxisNameByLayoutType", {
1140
1152
  Object.defineProperty(exports, "getAxisPerLockedDimension", {
1141
1153
  enumerable: true,
1142
1154
  get: function () {
1143
- return _index5.getAxisPerLockedDimension;
1155
+ return _index6.getAxisPerLockedDimension;
1144
1156
  }
1145
1157
  });
1146
1158
  Object.defineProperty(exports, "getColorByValueFromLegendSet", {
@@ -1158,7 +1170,7 @@ Object.defineProperty(exports, "getDimensionById", {
1158
1170
  Object.defineProperty(exports, "getDisallowedDimensions", {
1159
1171
  enumerable: true,
1160
1172
  get: function () {
1161
- return _index5.getDisallowedDimensions;
1173
+ return _index6.getDisallowedDimensions;
1162
1174
  }
1163
1175
  });
1164
1176
  Object.defineProperty(exports, "getDisplayNameByVisType", {
@@ -1224,13 +1236,13 @@ Object.defineProperty(exports, "getTextAlignOptions", {
1224
1236
  Object.defineProperty(exports, "getTransferableDimension", {
1225
1237
  enumerable: true,
1226
1238
  get: function () {
1227
- return _index5.getTransferableDimension;
1239
+ return _index6.getTransferableDimension;
1228
1240
  }
1229
1241
  });
1230
1242
  Object.defineProperty(exports, "hasAxisTooManyItems", {
1231
1243
  enumerable: true,
1232
1244
  get: function () {
1233
- return _index5.hasAxisTooManyItems;
1245
+ return _index6.hasAxisTooManyItems;
1234
1246
  }
1235
1247
  });
1236
1248
  Object.defineProperty(exports, "hasCustomAxes", {
@@ -1242,13 +1254,13 @@ Object.defineProperty(exports, "hasCustomAxes", {
1242
1254
  Object.defineProperty(exports, "hasRelativeItems", {
1243
1255
  enumerable: true,
1244
1256
  get: function () {
1245
- return _index4.hasRelativeItems;
1257
+ return _index5.hasRelativeItems;
1246
1258
  }
1247
1259
  });
1248
1260
  Object.defineProperty(exports, "isAxisFull", {
1249
1261
  enumerable: true,
1250
1262
  get: function () {
1251
- return _index5.isAxisFull;
1263
+ return _index6.isAxisFull;
1252
1264
  }
1253
1265
  });
1254
1266
  Object.defineProperty(exports, "isColumnBasedType", {
@@ -1260,7 +1272,7 @@ Object.defineProperty(exports, "isColumnBasedType", {
1260
1272
  Object.defineProperty(exports, "isDimensionLocked", {
1261
1273
  enumerable: true,
1262
1274
  get: function () {
1263
- return _index5.isDimensionLocked;
1275
+ return _index6.isDimensionLocked;
1264
1276
  }
1265
1277
  });
1266
1278
  Object.defineProperty(exports, "isDualAxisType", {
@@ -1410,7 +1422,7 @@ Object.defineProperty(exports, "layoutReplaceDimension", {
1410
1422
  Object.defineProperty(exports, "ouIdHelper", {
1411
1423
  enumerable: true,
1412
1424
  get: function () {
1413
- return _index2.ouIdHelper;
1425
+ return _index3.ouIdHelper;
1414
1426
  }
1415
1427
  });
1416
1428
  Object.defineProperty(exports, "useCachedDataQuery", {
@@ -1466,6 +1478,10 @@ var _InterpretationsUnit = require("./components/Interpretations/Interpretations
1466
1478
 
1467
1479
  var _InterpretationModal = require("./components/Interpretations/InterpretationModal/InterpretationModal.js");
1468
1480
 
1481
+ var _index2 = require("./components/TranslationDialog/index.js");
1482
+
1483
+ var _OfflineTooltip = require("./components/OfflineTooltip.js");
1484
+
1469
1485
  var _CachedDataQueryProvider = require("./components/CachedDataQueryProvider.js");
1470
1486
 
1471
1487
  var _Analytics = _interopRequireDefault(require("./api/analytics/Analytics.js"));
@@ -1478,13 +1494,13 @@ var _axis = require("./modules/axis.js");
1478
1494
 
1479
1495
  var _predefinedDimensions = require("./modules/predefinedDimensions.js");
1480
1496
 
1481
- var _index2 = require("./modules/ouIdHelper/index.js");
1497
+ var _index3 = require("./modules/ouIdHelper/index.js");
1482
1498
 
1483
- var _index3 = require("./modules/ouLevelUtils/index.js");
1499
+ var _index4 = require("./modules/ouLevelUtils/index.js");
1484
1500
 
1485
1501
  var _getAdaptedUiLayoutByType = require("./modules/getAdaptedUiLayoutByType.js");
1486
1502
 
1487
- var _index4 = require("./modules/relativeItems/index.js");
1503
+ var _index5 = require("./modules/relativeItems/index.js");
1488
1504
 
1489
1505
  var _layout = require("./modules/layout/layout.js");
1490
1506
 
@@ -1564,9 +1580,9 @@ var _visTypes = require("./modules/visTypes.js");
1564
1580
 
1565
1581
  var _layoutTypes = require("./modules/layoutTypes.js");
1566
1582
 
1567
- var _index5 = require("./modules/layoutUiRules/index.js");
1583
+ var _index6 = require("./modules/layoutUiRules/index.js");
1568
1584
 
1569
- var _index6 = require("./visualizations/index.js");
1585
+ var _index7 = require("./visualizations/index.js");
1570
1586
 
1571
1587
  var _fontStyle = require("./modules/fontStyle.js");
1572
1588
 
@@ -1576,7 +1592,7 @@ var _renderValue = require("./modules/renderValue.js");
1576
1592
 
1577
1593
  var _colorSets = require("./visualizations/util/colors/colorSets.js");
1578
1594
 
1579
- var _index7 = require("./components/PeriodDimension/utils/index.js");
1595
+ var _index8 = require("./components/PeriodDimension/utils/index.js");
1580
1596
 
1581
1597
  var _relativePeriods = require("./components/PeriodDimension/utils/relativePeriods.js");
1582
1598
 
@@ -119,6 +119,7 @@
119
119
  "Search for a user": "Search for a user",
120
120
  "Searching for \"{{- searchText}}\"": "Searching for \"{{- searchText}}\"",
121
121
  "No results found": "No results found",
122
+ "Not available offline": "Not available offline",
122
123
  "Created by": "Created by",
123
124
  "Anyone": "Anyone",
124
125
  "Only you": "Only you",
@@ -269,6 +270,7 @@
269
270
  "Choose a locale to translate from the menu above": "Choose a locale to translate from the menu above",
270
271
  "Translate: {{objectName}}": "Translate: {{objectName}}",
271
272
  "Save translations": "Save translations",
273
+ "Cannot save while offline": "Cannot save while offline",
272
274
  "Could not load translations": "Could not load translations",
273
275
  "Retry": "Retry",
274
276
  "Series": "Series",
@@ -80,6 +80,7 @@
80
80
  "Name": "名称",
81
81
  "Description": "描述",
82
82
  "Rename": "改名",
83
+ "{{objectName}} (copy)": "{{objectName}}(副本)",
83
84
  "Save {{fileType}} as": "将{{fileType}}另存为",
84
85
  "event report": "事件报表",
85
86
  "line list": "行列表",
@@ -0,0 +1,49 @@
1
+ import { useOnlineStatus } from '@dhis2/app-runtime';
2
+ import i18n from '@dhis2/d2-i18n';
3
+ import { Tooltip } from '@dhis2/ui';
4
+ import cx from 'classnames';
5
+ import PropTypes from 'prop-types';
6
+ import React from 'react';
7
+ import classes from './styles/OfflineTooltip.module.css';
8
+
9
+ const OfflineTooltip = _ref => {
10
+ let {
11
+ disabledWhenOffline,
12
+ disabled,
13
+ content,
14
+ children
15
+ } = _ref;
16
+ const {
17
+ offline
18
+ } = useOnlineStatus();
19
+ const notAllowed = disabled || disabledWhenOffline && offline;
20
+ return /*#__PURE__*/React.createElement(Tooltip, {
21
+ content: content || i18n.t('Not available offline'),
22
+ openDelay: 200,
23
+ closeDelay: 100
24
+ }, _ref2 => {
25
+ let {
26
+ onMouseOver,
27
+ onMouseOut,
28
+ ref
29
+ } = _ref2;
30
+ return /*#__PURE__*/React.createElement("span", {
31
+ className: cx(classes.span, notAllowed && classes.notAllowed),
32
+ onMouseOver: () => notAllowed && onMouseOver(),
33
+ onMouseOut: () => notAllowed && onMouseOut(),
34
+ ref: ref
35
+ }, children);
36
+ });
37
+ };
38
+
39
+ OfflineTooltip.propTypes = {
40
+ children: PropTypes.node,
41
+ content: PropTypes.string,
42
+ disabled: PropTypes.bool,
43
+ disabledWhenOffline: PropTypes.bool
44
+ };
45
+ OfflineTooltip.defaultProps = {
46
+ disabled: false,
47
+ disabledWhenOffline: true
48
+ };
49
+ export { OfflineTooltip };
@@ -1,23 +1,56 @@
1
+ import { useOnlineStatus } from '@dhis2/app-runtime';
1
2
  import i18n from '@dhis2/d2-i18n';
2
3
  import { Button, ButtonStrip, ModalActions } from '@dhis2/ui';
3
4
  import PropTypes from 'prop-types';
4
5
  import React from 'react';
5
- export const TranslationModalActions = _ref => {
6
+ import { OfflineTooltip } from '../../OfflineTooltip.js';
7
+
8
+ const SaveButton = _ref => {
9
+ let {
10
+ disabled,
11
+ loading,
12
+ onClick
13
+ } = _ref;
14
+ return /*#__PURE__*/React.createElement(Button, {
15
+ primary: true,
16
+ onClick: onClick,
17
+ loading: loading,
18
+ disabled: disabled
19
+ }, i18n.t('Save translations'));
20
+ };
21
+
22
+ SaveButton.defaultProps = {
23
+ disabled: false,
24
+ loading: false,
25
+ onClick: Function.prototype
26
+ };
27
+ SaveButton.propTypes = {
28
+ disabled: PropTypes.bool.isRequired,
29
+ loading: PropTypes.bool.isRequired,
30
+ onClick: PropTypes.func.isRequired
31
+ };
32
+ export const TranslationModalActions = _ref2 => {
6
33
  let {
7
34
  onClose,
8
35
  onSave,
9
36
  saveInProgress,
10
37
  saveButtonDisabled
11
- } = _ref;
38
+ } = _ref2;
39
+ const {
40
+ offline
41
+ } = useOnlineStatus();
12
42
  return /*#__PURE__*/React.createElement(ModalActions, null, /*#__PURE__*/React.createElement(ButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
13
43
  secondary: true,
14
44
  onClick: onClose
15
- }, i18n.t('Cancel')), /*#__PURE__*/React.createElement(Button, {
16
- primary: true,
45
+ }, i18n.t('Cancel')), offline ? /*#__PURE__*/React.createElement(OfflineTooltip, {
46
+ content: i18n.t('Cannot save while offline')
47
+ }, /*#__PURE__*/React.createElement(SaveButton, {
48
+ disabled: true
49
+ })) : /*#__PURE__*/React.createElement(SaveButton, {
17
50
  onClick: onSave,
18
51
  loading: saveInProgress,
19
52
  disabled: saveButtonDisabled
20
- }, i18n.t('Save translations'))));
53
+ })));
21
54
  };
22
55
  TranslationModalActions.propTypes = {
23
56
  onClose: PropTypes.func.isRequired,
@@ -0,0 +1,11 @@
1
+ .span {
2
+ display: inline-flex;
3
+ pointer-events: all;
4
+ }
5
+ .span > :global(button:disabled) {
6
+ pointer-events: none;
7
+ }
8
+
9
+ .notAllowed {
10
+ cursor: not-allowed;
11
+ }
package/build/es/index.js CHANGED
@@ -16,6 +16,8 @@ export { default as LegendKey } from './components/LegendKey/LegendKey.js';
16
16
  export { default as AboutAOUnit } from './components/AboutAOUnit/AboutAOUnit.js';
17
17
  export { InterpretationsUnit } from './components/Interpretations/InterpretationsUnit/InterpretationsUnit.js';
18
18
  export { InterpretationModal } from './components/Interpretations/InterpretationModal/InterpretationModal.js';
19
+ export { TranslationDialog } from './components/TranslationDialog/index.js';
20
+ export { OfflineTooltip } from './components/OfflineTooltip.js';
19
21
  export { CachedDataQueryProvider, useCachedDataQuery } from './components/CachedDataQueryProvider.js'; // Api
20
22
 
21
23
  export { default as Analytics } from './api/analytics/Analytics.js';
@@ -119,6 +119,7 @@
119
119
  "Search for a user": "Search for a user",
120
120
  "Searching for \"{{- searchText}}\"": "Searching for \"{{- searchText}}\"",
121
121
  "No results found": "No results found",
122
+ "Not available offline": "Not available offline",
122
123
  "Created by": "Created by",
123
124
  "Anyone": "Anyone",
124
125
  "Only you": "Only you",
@@ -269,6 +270,7 @@
269
270
  "Choose a locale to translate from the menu above": "Choose a locale to translate from the menu above",
270
271
  "Translate: {{objectName}}": "Translate: {{objectName}}",
271
272
  "Save translations": "Save translations",
273
+ "Cannot save while offline": "Cannot save while offline",
272
274
  "Could not load translations": "Could not load translations",
273
275
  "Retry": "Retry",
274
276
  "Series": "Series",
@@ -80,6 +80,7 @@
80
80
  "Name": "名称",
81
81
  "Description": "描述",
82
82
  "Rename": "改名",
83
+ "{{objectName}} (copy)": "{{objectName}}(副本)",
83
84
  "Save {{fileType}} as": "将{{fileType}}另存为",
84
85
  "event report": "事件报表",
85
86
  "line list": "行列表",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "24.1.0",
3
+ "version": "24.2.0",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {