@dhis2/analytics 29.4.0 → 29.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/build/cjs/api/analytics/AnalyticsRequest.js +4 -4
  2. package/build/cjs/components/DataDimension/Calculation/DndContext.js +4 -4
  3. package/build/cjs/components/DataDimension/Info/DataElementOperandInfo.js +1 -1
  4. package/build/cjs/components/DataDimension/ItemOptionsSelector/ItemOptionsSelector.js +1 -1
  5. package/build/cjs/components/DataDimension/ItemSelector/ItemSelector.js +1 -1
  6. package/build/cjs/components/FileMenu/DeleteDialog.js +1 -1
  7. package/build/cjs/components/RichText/Editor/Editor.js +2 -2
  8. package/build/cjs/components/TranslationDialog/TranslationModal/TranslationForm.js +1 -0
  9. package/build/cjs/components/UserMention/useUserSearchResults.js +1 -1
  10. package/build/cjs/locales/en/translations.json +0 -12
  11. package/build/cjs/locales/id/translations.json +6 -6
  12. package/build/cjs/locales/index.js +86 -41
  13. package/build/cjs/locales/km/translations.json +6 -6
  14. package/build/cjs/locales/lo/translations.json +6 -6
  15. package/build/cjs/locales/my/translations.json +6 -6
  16. package/build/cjs/locales/tet/translations.json +6 -6
  17. package/build/cjs/locales/th/translations.json +6 -6
  18. package/build/cjs/locales/vi/translations.json +6 -6
  19. package/build/cjs/locales/zh/translations.json +6 -6
  20. package/build/cjs/locales/zh_CN/translations.json +6 -6
  21. package/build/cjs/modules/legends.js +1 -1
  22. package/build/cjs/modules/pivotTable/applyLegendSet.js +4 -4
  23. package/build/cjs/modules/pivotTable/useScrollPosition.js +2 -2
  24. package/build/cjs/modules/utils.js +1 -0
  25. package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/index.js +3 -3
  26. package/build/cjs/visualizations/config/adapters/dhis_highcharts/index.js +2 -2
  27. package/build/cjs/visualizations/config/adapters/dhis_highcharts/series/index.js +1 -1
  28. package/build/cjs/visualizations/config/adapters/dhis_highcharts/subtitle/index.js +3 -3
  29. package/build/cjs/visualizations/config/adapters/dhis_highcharts/title/index.js +3 -3
  30. package/build/cjs/visualizations/config/generators/highcharts/index.js +2 -2
  31. package/build/cjs/visualizations/store/adapters/dhis_highcharts/yearOnYear.js +1 -1
  32. package/build/es/api/analytics/AnalyticsRequest.js +4 -4
  33. package/build/es/components/DataDimension/Calculation/DndContext.js +4 -4
  34. package/build/es/components/DataDimension/Info/DataElementOperandInfo.js +1 -1
  35. package/build/es/components/DataDimension/ItemOptionsSelector/ItemOptionsSelector.js +1 -1
  36. package/build/es/components/DataDimension/ItemSelector/ItemSelector.js +1 -1
  37. package/build/es/components/FileMenu/DeleteDialog.js +1 -1
  38. package/build/es/components/RichText/Editor/Editor.js +2 -2
  39. package/build/es/components/TranslationDialog/TranslationModal/TranslationForm.js +1 -0
  40. package/build/es/components/UserMention/useUserSearchResults.js +2 -2
  41. package/build/es/locales/en/translations.json +0 -12
  42. package/build/es/locales/id/translations.json +6 -6
  43. package/build/es/locales/index.js +86 -41
  44. package/build/es/locales/km/translations.json +6 -6
  45. package/build/es/locales/lo/translations.json +6 -6
  46. package/build/es/locales/my/translations.json +6 -6
  47. package/build/es/locales/tet/translations.json +6 -6
  48. package/build/es/locales/th/translations.json +6 -6
  49. package/build/es/locales/vi/translations.json +6 -6
  50. package/build/es/locales/zh/translations.json +6 -6
  51. package/build/es/locales/zh_CN/translations.json +6 -6
  52. package/build/es/modules/legends.js +1 -1
  53. package/build/es/modules/pivotTable/applyLegendSet.js +4 -4
  54. package/build/es/modules/pivotTable/useScrollPosition.js +3 -3
  55. package/build/es/modules/utils.js +1 -0
  56. package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/index.js +3 -3
  57. package/build/es/visualizations/config/adapters/dhis_highcharts/index.js +2 -2
  58. package/build/es/visualizations/config/adapters/dhis_highcharts/series/index.js +1 -1
  59. package/build/es/visualizations/config/adapters/dhis_highcharts/subtitle/index.js +3 -3
  60. package/build/es/visualizations/config/adapters/dhis_highcharts/title/index.js +3 -3
  61. package/build/es/visualizations/config/generators/highcharts/index.js +2 -2
  62. package/build/es/visualizations/store/adapters/dhis_highcharts/yearOnYear.js +1 -1
  63. package/package.json +2 -2
@@ -9,7 +9,7 @@
9
9
  "Last updated {{time}}": "最后更新 {{time}}",
10
10
  "Created {{time}} by {{author}}": "由 {{author}} 在 {{time}} 创建",
11
11
  "Created {{time}}": "已创建 {{time}}",
12
- "Viewed {{count}} times": "查看了 {{count}} 条",
12
+ "Viewed {{count}} times_0": "查看了 {{count}} 条",
13
13
  "Notifications": "通知",
14
14
  "You're subscribed and getting updates about new interpretations.": "您已订阅并获取有关新解释的更新。",
15
15
  "Unsubscribe": "退订",
@@ -186,7 +186,7 @@
186
186
  "Error loading interpretations": "",
187
187
  "Could not load interpretations": "",
188
188
  "Reply": "应答",
189
- "{{count}} replies": "{{count}}条回复",
189
+ "{{count}} replies_0": "{{count}}条回复",
190
190
  "View replies": "查看回复",
191
191
  "Unlike": "不喜欢",
192
192
  "Like": "喜欢",
@@ -236,9 +236,9 @@
236
236
  "No line lists found. Try adjusting your search or filter options to find what you're looking for.": "未找到行列表。尝试调整您的搜索或过滤选项以找到您要查找的内容。",
237
237
  "New line list": "新行列表",
238
238
  "Hide": "隐藏",
239
- "{{count}} org units": "{{count}} 个组织单位",
240
- "{{count}} levels": "{{count}} 级",
241
- "{{count}} groups": "{{count}} 组",
239
+ "{{count}} org units_0": "{{count}} 个组织单位",
240
+ "{{count}} levels_0": "{{count}} 级",
241
+ "{{count}} groups_0": "{{count}} 组",
242
242
  "Selected: {{commaSeparatedListOfOrganisationUnits}}": "已选择:{{commaSeparatedListOfOrganisationUnits}}",
243
243
  "Nothing selected": "未选择任何内容",
244
244
  "User organisation unit": "用户所在机构",
@@ -467,6 +467,6 @@
467
467
  "Target": "目标",
468
468
  "Base": "基",
469
469
  "Axis {{axisId}}": "轴{{axisId}}",
470
- "{{count}} items": "{{count}} 个条目",
470
+ "{{count}} items_0": "{{count}} 个条目",
471
471
  "Reset zoom": "重设缩放"
472
472
  }
@@ -9,7 +9,7 @@
9
9
  "Last updated {{time}}": "最近更新的{{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
- "Viewed {{count}} times": "",
12
+ "Viewed {{count}} times_0": "",
13
13
  "Notifications": "通知",
14
14
  "You're subscribed and getting updates about new interpretations.": "",
15
15
  "Unsubscribe": "",
@@ -186,7 +186,7 @@
186
186
  "Error loading interpretations": "",
187
187
  "Could not load interpretations": "",
188
188
  "Reply": "回复",
189
- "{{count}} replies": "",
189
+ "{{count}} replies_0": "",
190
190
  "View replies": "",
191
191
  "Unlike": "不喜欢",
192
192
  "Like": "Like",
@@ -236,9 +236,9 @@
236
236
  "No line lists found. Try adjusting your search or filter options to find what you're looking for.": "",
237
237
  "New line list": "",
238
238
  "Hide": "隐藏",
239
- "{{count}} org units": "",
240
- "{{count}} levels": "",
241
- "{{count}} groups": "",
239
+ "{{count}} org units_0": "",
240
+ "{{count}} levels_0": "",
241
+ "{{count}} groups_0": "",
242
242
  "Selected: {{commaSeparatedListOfOrganisationUnits}}": "已选择:{{commaSeparatedListOfOrganisationUnits}}",
243
243
  "Nothing selected": "未选择任何内容",
244
244
  "User organisation unit": "用户所在机构",
@@ -467,6 +467,6 @@
467
467
  "Target": "目标",
468
468
  "Base": "基",
469
469
  "Axis {{axisId}}": "轴{{axisId}}",
470
- "{{count}} items": "",
470
+ "{{count}} items_0": "",
471
471
  "Reset zoom": ""
472
472
  }
@@ -10,7 +10,7 @@ const LEGEND_DISPLAY_STYLE_FILL = exports.LEGEND_DISPLAY_STYLE_FILL = 'FILL';
10
10
  const LEGEND_DISPLAY_STYLE_TEXT = exports.LEGEND_DISPLAY_STYLE_TEXT = 'TEXT';
11
11
  const getLegendByValueFromLegendSet = (legendSet, value) => {
12
12
  var _legendSet$legends;
13
- return Number.isInteger(parseInt(value)) ? legendSet === null || legendSet === void 0 ? void 0 : (_legendSet$legends = legendSet.legends) === null || _legendSet$legends === void 0 ? void 0 : _legendSet$legends.find(legend => value >= legend.startValue && value < legend.endValue // TODO: Confirm inclusive/exclusive bounds
13
+ return Number.isInteger(parseInt(value)) ? legendSet === null || legendSet === void 0 || (_legendSet$legends = legendSet.legends) === null || _legendSet$legends === void 0 ? void 0 : _legendSet$legends.find(legend => value >= legend.startValue && value < legend.endValue // TODO: Confirm inclusive/exclusive bounds
14
14
  ) : null;
15
15
  };
16
16
  exports.getLegendByValueFromLegendSet = getLegendByValueFromLegendSet;
@@ -8,7 +8,7 @@ var _ui = require("@dhis2/ui");
8
8
  var _legends = require("../legends.js");
9
9
  var _isColorBright = require("./isColorBright.js");
10
10
  const getLegendSet = (engine, dxDimension) => {
11
- var _engine$visualization, _engine$visualization2, _engine$visualization3;
11
+ var _engine$visualization, _engine$visualization2;
12
12
  let legendSetId;
13
13
  switch ((_engine$visualization = engine.visualization.legend) === null || _engine$visualization === void 0 ? void 0 : _engine$visualization.strategy) {
14
14
  case _legends.LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM:
@@ -18,15 +18,15 @@ const getLegendSet = (engine, dxDimension) => {
18
18
  break;
19
19
  case _legends.LEGEND_DISPLAY_STRATEGY_FIXED:
20
20
  default:
21
- legendSetId = (_engine$visualization2 = engine.visualization.legend) === null || _engine$visualization2 === void 0 ? void 0 : (_engine$visualization3 = _engine$visualization2.set) === null || _engine$visualization3 === void 0 ? void 0 : _engine$visualization3.id;
21
+ legendSetId = (_engine$visualization2 = engine.visualization.legend) === null || _engine$visualization2 === void 0 || (_engine$visualization2 = _engine$visualization2.set) === null || _engine$visualization2 === void 0 ? void 0 : _engine$visualization2.id;
22
22
  break;
23
23
  }
24
24
  return engine.legendSets[legendSetId];
25
25
  };
26
26
  const buildStyleObject = (legendColor, engine) => {
27
- var _engine$visualization4;
27
+ var _engine$visualization3;
28
28
  const style = {};
29
- switch ((_engine$visualization4 = engine.visualization.legend) === null || _engine$visualization4 === void 0 ? void 0 : _engine$visualization4.style) {
29
+ switch ((_engine$visualization3 = engine.visualization.legend) === null || _engine$visualization3 === void 0 ? void 0 : _engine$visualization3.style) {
30
30
  case _legends.LEGEND_DISPLAY_STYLE_TEXT:
31
31
  style.color = legendColor;
32
32
  break;
@@ -12,13 +12,13 @@ const useScrollPosition = (containerRef, debounceWait = 10) => {
12
12
  x: 0,
13
13
  y: 0
14
14
  });
15
- const onScroll = (0, _react.useCallback)((0, _debounce.default)(() => {
15
+ const onScroll = (0, _react.useMemo)(() => (0, _debounce.default)(() => {
16
16
  const scroll = {
17
17
  x: containerRef.current.scrollLeft,
18
18
  y: containerRef.current.scrollTop
19
19
  };
20
20
  setScrollPosition(scroll);
21
- }, debounceWait));
21
+ }, debounceWait), [containerRef, debounceWait]);
22
22
  (0, _react.useEffect)(() => {
23
23
  const currentRef = containerRef.current;
24
24
  if (!currentRef) {
@@ -26,6 +26,7 @@ const useDidUpdateEffect = (fn, inputs) => {
26
26
  } else {
27
27
  didMountRef.current = true;
28
28
  }
29
+ // eslint-disable-next-line react-hooks/exhaustive-deps
29
30
  }, inputs);
30
31
  };
31
32
 
@@ -34,11 +34,11 @@ function loadSingleValueSVG() {
34
34
  while (!fitsWithinContainer && dynamicStyles.hasNext()) {
35
35
  styles = dynamicStyles.next();
36
36
  valueElement.attr(styles.value);
37
- subTextElement === null || subTextElement === void 0 ? void 0 : subTextElement.attr(styles.subText);
37
+ subTextElement === null || subTextElement === void 0 || subTextElement.attr(styles.subText);
38
38
  fitsWithinContainer = (0, _checkIfFitsWithinContainer.checkIfFitsWithinContainer)(_getAvailableSpace.getAvailableSpace.call(this, styles.spacing.valueTop), valueElement, subTextElement, icon, subText, styles.spacing);
39
39
  }
40
40
  _positionElements.positionElements.call(this, valueElement, subTextElement, iconElement, styles.spacing);
41
41
  valueElement.attr('visibility', 'visible');
42
- iconElement === null || iconElement === void 0 ? void 0 : iconElement.attr('visibility', 'visible');
43
- subTextElement === null || subTextElement === void 0 ? void 0 : subTextElement.attr('visibility', 'visible');
42
+ iconElement === null || iconElement === void 0 || iconElement.attr('visibility', 'visible');
43
+ subTextElement === null || subTextElement === void 0 || subTextElement.attr('visibility', 'visible');
44
44
  }
@@ -48,7 +48,7 @@ function _default({
48
48
  extraConfig,
49
49
  extraOptions
50
50
  }) {
51
- var _layout$legend, _layout$seriesKey, _layout$seriesKey2, _layout$seriesKey2$la, _config$xAxis;
51
+ var _layout$legend, _layout$seriesKey, _layout$seriesKey2, _config$xAxis;
52
52
  const _layout = getTransformedLayout(layout);
53
53
  const _extraOptions = getTransformedExtraOptions(extraOptions);
54
54
  const stacked = (0, _visTypes.isStacked)(_layout.type);
@@ -91,7 +91,7 @@ function _default({
91
91
  // legend
92
92
  legend: (0, _legend.default)({
93
93
  isHidden: (_layout$seriesKey = _layout.seriesKey) === null || _layout$seriesKey === void 0 ? void 0 : _layout$seriesKey.hidden,
94
- fontStyle: (_layout$seriesKey2 = _layout.seriesKey) === null || _layout$seriesKey2 === void 0 ? void 0 : (_layout$seriesKey2$la = _layout$seriesKey2.label) === null || _layout$seriesKey2$la === void 0 ? void 0 : _layout$seriesKey2$la.fontStyle,
94
+ fontStyle: (_layout$seriesKey2 = _layout.seriesKey) === null || _layout$seriesKey2 === void 0 || (_layout$seriesKey2 = _layout$seriesKey2.label) === null || _layout$seriesKey2 === void 0 ? void 0 : _layout$seriesKey2.fontStyle,
95
95
  visType: _layout.type,
96
96
  dashboard: _extraOptions.dashboard
97
97
  }),
@@ -192,7 +192,7 @@ function _default({
192
192
  displayStrategy
193
193
  });
194
194
  }
195
- (_series = series) === null || _series === void 0 ? void 0 : _series.forEach(seriesObj => {
195
+ (_series = series) === null || _series === void 0 || _series.forEach(seriesObj => {
196
196
  // animation
197
197
  seriesObj.animation = extraOptions.dashboard ? false : {
198
198
  duration: getAnimation(extraOptions.animation, DEFAULT_ANIMATION_DURATION)
@@ -77,9 +77,9 @@ function subtitle(series, layout, metaData, extraOptions) {
77
77
  switch (layout.type) {
78
78
  case _visTypes.VIS_TYPE_SINGLE_VALUE:
79
79
  {
80
- var _defaultFontStyle$FON, _layout$fontStyle, _layout$fontStyle$FON;
81
- const defaultColor = _fontStyle.defaultFontStyle === null || _fontStyle.defaultFontStyle === void 0 ? void 0 : (_defaultFontStyle$FON = _fontStyle.defaultFontStyle[_fontStyle.FONT_STYLE_VISUALIZATION_SUBTITLE]) === null || _defaultFontStyle$FON === void 0 ? void 0 : _defaultFontStyle$FON[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR];
82
- const customColor = layout === null || layout === void 0 ? void 0 : (_layout$fontStyle = layout.fontStyle) === null || _layout$fontStyle === void 0 ? void 0 : (_layout$fontStyle$FON = _layout$fontStyle[_fontStyle.FONT_STYLE_VISUALIZATION_SUBTITLE]) === null || _layout$fontStyle$FON === void 0 ? void 0 : _layout$fontStyle$FON[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR];
80
+ var _defaultFontStyle$FON, _layout$fontStyle;
81
+ const defaultColor = _fontStyle.defaultFontStyle === null || _fontStyle.defaultFontStyle === void 0 || (_defaultFontStyle$FON = _fontStyle.defaultFontStyle[_fontStyle.FONT_STYLE_VISUALIZATION_SUBTITLE]) === null || _defaultFontStyle$FON === void 0 ? void 0 : _defaultFontStyle$FON[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR];
82
+ const customColor = layout === null || layout === void 0 || (_layout$fontStyle = layout.fontStyle) === null || _layout$fontStyle === void 0 || (_layout$fontStyle = _layout$fontStyle[_fontStyle.FONT_STYLE_VISUALIZATION_SUBTITLE]) === null || _layout$fontStyle === void 0 ? void 0 : _layout$fontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR];
83
83
  subtitle.style.color = (0, _singleValue.getSingleValueSubtitleColor)(customColor, defaultColor, series[0], legendOptions, legendSets);
84
84
  if (dashboard) {
85
85
  // Single value subtitle text should be multiline
@@ -83,9 +83,9 @@ function _default(layout, metaData, extraOptions, series) {
83
83
  switch (layout.type) {
84
84
  case _visTypes.VIS_TYPE_SINGLE_VALUE:
85
85
  {
86
- var _defaultFontStyle$FON, _layout$fontStyle, _layout$fontStyle$FON;
87
- const defaultColor = _fontStyle.defaultFontStyle === null || _fontStyle.defaultFontStyle === void 0 ? void 0 : (_defaultFontStyle$FON = _fontStyle.defaultFontStyle[_fontStyle.FONT_STYLE_VISUALIZATION_TITLE]) === null || _defaultFontStyle$FON === void 0 ? void 0 : _defaultFontStyle$FON[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR];
88
- const customColor = layout === null || layout === void 0 ? void 0 : (_layout$fontStyle = layout.fontStyle) === null || _layout$fontStyle === void 0 ? void 0 : (_layout$fontStyle$FON = _layout$fontStyle[_fontStyle.FONT_STYLE_VISUALIZATION_TITLE]) === null || _layout$fontStyle$FON === void 0 ? void 0 : _layout$fontStyle$FON[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR];
86
+ var _defaultFontStyle$FON, _layout$fontStyle;
87
+ const defaultColor = _fontStyle.defaultFontStyle === null || _fontStyle.defaultFontStyle === void 0 || (_defaultFontStyle$FON = _fontStyle.defaultFontStyle[_fontStyle.FONT_STYLE_VISUALIZATION_TITLE]) === null || _defaultFontStyle$FON === void 0 ? void 0 : _defaultFontStyle$FON[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR];
88
+ const customColor = layout === null || layout === void 0 || (_layout$fontStyle = layout.fontStyle) === null || _layout$fontStyle === void 0 || (_layout$fontStyle = _layout$fontStyle[_fontStyle.FONT_STYLE_VISUALIZATION_TITLE]) === null || _layout$fontStyle === void 0 ? void 0 : _layout$fontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR];
89
89
  title.style.color = (0, _singleValue.getSingleValueTitleColor)(customColor, defaultColor, series[0], legendOptions, legendSets);
90
90
  if (dashboard) {
91
91
  // TODO: is this always what we want?
@@ -40,9 +40,9 @@ _highcharts.default.patterns.forEach((pattern, i) => {
40
40
  function drawLegendSymbolWrap() {
41
41
  const pick = _highcharts.default.pick;
42
42
  _highcharts.default.wrap(_highcharts.default.seriesTypes.column.prototype, 'drawLegendSymbol', function (proceed, legend, item) {
43
- var _this$options$legendS, _this$options$legendS2;
43
+ var _this$options$legendS;
44
44
  const legendItem = item.legendItem;
45
- if ((_this$options$legendS = this.options.legendSet) !== null && _this$options$legendS !== void 0 && (_this$options$legendS2 = _this$options$legendS.legends) !== null && _this$options$legendS2 !== void 0 && _this$options$legendS2.length) {
45
+ if ((_this$options$legendS = this.options.legendSet) !== null && _this$options$legendS !== void 0 && (_this$options$legendS = _this$options$legendS.legends) !== null && _this$options$legendS !== void 0 && _this$options$legendS.length) {
46
46
  const ys = legend.baseline - legend.symbolHeight + 1,
47
47
  // y start
48
48
  x = legend.symbolWidth / 2 > 8 ? legend.symbolWidth / 2 : 8,
@@ -7,7 +7,7 @@ exports.default = _default;
7
7
  function _default(acc, series, categories, idValueMap, metaData, extraOptions) {
8
8
  var _extraOptions$xAxisLa;
9
9
  const seriesData = Array.from({
10
- length: (extraOptions === null || extraOptions === void 0 ? void 0 : (_extraOptions$xAxisLa = extraOptions.xAxisLabels) === null || _extraOptions$xAxisLa === void 0 ? void 0 : _extraOptions$xAxisLa.length) || 0
10
+ length: (extraOptions === null || extraOptions === void 0 || (_extraOptions$xAxisLa = extraOptions.xAxisLabels) === null || _extraOptions$xAxisLa === void 0 ? void 0 : _extraOptions$xAxisLa.length) || 0
11
11
  }, () => null);
12
12
  categories[0].forEach(categoryItemId => {
13
13
  const position = extraOptions.periodKeyAxisIndexMap[categoryItemId];
@@ -47,7 +47,7 @@ class AnalyticsRequest extends AnalyticsRequestDimensionsMixin(AnalyticsRequestF
47
47
  const columns = visualization.columns || [];
48
48
  const rows = visualization.rows || [];
49
49
  columns.concat(rows).forEach(d => {
50
- var _d$legendSet, _d$programStage, _d$repetition, _d$repetition$indexes;
50
+ var _d$legendSet, _d$programStage, _d$repetition;
51
51
  let dimension = d.dimension;
52
52
  if ((_d$legendSet = d.legendSet) !== null && _d$legendSet !== void 0 && _d$legendSet.id) {
53
53
  dimension += `-${d.legendSet.id}`;
@@ -56,7 +56,7 @@ class AnalyticsRequest extends AnalyticsRequestDimensionsMixin(AnalyticsRequestF
56
56
  dimension += `:${d.filter}`;
57
57
  }
58
58
  const programStageId = (_d$programStage = d.programStage) === null || _d$programStage === void 0 ? void 0 : _d$programStage.id;
59
- if ((_d$repetition = d.repetition) !== null && _d$repetition !== void 0 && (_d$repetition$indexes = _d$repetition.indexes) !== null && _d$repetition$indexes !== void 0 && _d$repetition$indexes.length) {
59
+ if ((_d$repetition = d.repetition) !== null && _d$repetition !== void 0 && (_d$repetition = _d$repetition.indexes) !== null && _d$repetition !== void 0 && _d$repetition.length) {
60
60
  d.repetition.indexes.forEach(index => {
61
61
  var _d$program;
62
62
  request = request.addDimension(formatDimension({
@@ -87,13 +87,13 @@ class AnalyticsRequest extends AnalyticsRequestDimensionsMixin(AnalyticsRequestF
87
87
  var _f$items;
88
88
  request = request.addDimension(f.dimension, (_f$items = f.items) === null || _f$items === void 0 ? void 0 : _f$items.map(item => item.id));
89
89
  } else {
90
- var _f$programStage, _f$repetition, _f$repetition$indexes;
90
+ var _f$programStage, _f$repetition;
91
91
  let filterString = f.dimension;
92
92
  if (f.filter) {
93
93
  filterString += `:${f.filter}`;
94
94
  }
95
95
  const programStageId = (_f$programStage = f.programStage) === null || _f$programStage === void 0 ? void 0 : _f$programStage.id;
96
- if ((_f$repetition = f.repetition) !== null && _f$repetition !== void 0 && (_f$repetition$indexes = _f$repetition.indexes) !== null && _f$repetition$indexes !== void 0 && _f$repetition$indexes.length) {
96
+ if ((_f$repetition = f.repetition) !== null && _f$repetition !== void 0 && (_f$repetition = _f$repetition.indexes) !== null && _f$repetition !== void 0 && _f$repetition.length) {
97
97
  f.repetition.indexes.forEach(index => {
98
98
  var _f$program;
99
99
  request = request.addFilter(formatDimension({
@@ -119,8 +119,8 @@ const OuterDndContext = ({
119
119
  active,
120
120
  over
121
121
  }) => {
122
- var _over$data, _over$data$current, _over$data$current$so, _over$data$current2, _over$data$current3;
123
- if (!(over !== null && over !== void 0 && over.id) || (over === null || over === void 0 ? void 0 : (_over$data = over.data) === null || _over$data === void 0 ? void 0 : (_over$data$current = _over$data.current) === null || _over$data$current === void 0 ? void 0 : (_over$data$current$so = _over$data$current.sortable) === null || _over$data$current$so === void 0 ? void 0 : _over$data$current$so.containerId) === OPTIONS_PANEL || !active.data.current) {
122
+ var _over$data, _over$data$current, _over$data$current2;
123
+ if (!(over !== null && over !== void 0 && over.id) || (over === null || over === void 0 || (_over$data = over.data) === null || _over$data === void 0 || (_over$data = _over$data.current) === null || _over$data === void 0 || (_over$data = _over$data.sortable) === null || _over$data === void 0 ? void 0 : _over$data.containerId) === OPTIONS_PANEL || !active.data.current) {
124
124
  // dropped over non-droppable or over options panel
125
125
  handleDragCancel();
126
126
  return;
@@ -136,8 +136,8 @@ const OuterDndContext = ({
136
136
  }
137
137
  };
138
138
  const destination = {
139
- containerId: ((_over$data$current2 = over.data.current) === null || _over$data$current2 === void 0 ? void 0 : _over$data$current2.sortable.containerId) || over.id,
140
- index: (_over$data$current3 = over.data.current) === null || _over$data$current3 === void 0 ? void 0 : _over$data$current3.sortable.index
139
+ containerId: ((_over$data$current = over.data.current) === null || _over$data$current === void 0 ? void 0 : _over$data$current.sortable.containerId) || over.id,
140
+ index: (_over$data$current2 = over.data.current) === null || _over$data$current2 === void 0 ? void 0 : _over$data$current2.sortable.index
141
141
  };
142
142
  onDragEnd({
143
143
  item,
@@ -44,7 +44,7 @@ export const DataElementOperandInfo = ({
44
44
  const dataElementOperand = dataElementOperands.dataElementOperands[0]
45
45
 
46
46
  // copy some common fields from dataElement
47
- ;
47
+ ;
48
48
  ['code', 'created', 'createdBy', 'displayDescription', 'lastUpdated'].forEach(key => dataElementOperand[key] = dataElementOperand.dataElement[key]);
49
49
 
50
50
  // inject href as it is not returned from the API
@@ -72,7 +72,7 @@ export const ItemOptionsSelector = ({
72
72
  searchTerm: state.searchTerm
73
73
  });
74
74
  const newOptions = [];
75
- (_result$dimensionItem = result.dimensionItems) === null || _result$dimensionItem === void 0 ? void 0 : _result$dimensionItem.forEach(item => {
75
+ (_result$dimensionItem = result.dimensionItems) === null || _result$dimensionItem === void 0 || _result$dimensionItem.forEach(item => {
76
76
  newOptions.push({
77
77
  label: item.name,
78
78
  value: item.id,
@@ -144,7 +144,7 @@ const ItemSelector = ({
144
144
  searchTerm: state.searchTerm
145
145
  });
146
146
  const newOptions = [];
147
- (_result$dimensionItem = result.dimensionItems) === null || _result$dimensionItem === void 0 ? void 0 : _result$dimensionItem.forEach(item => {
147
+ (_result$dimensionItem = result.dimensionItems) === null || _result$dimensionItem === void 0 || _result$dimensionItem.forEach(item => {
148
148
  if (item.dimensionItemType === REPORTING_RATE) {
149
149
  if (state.filter.subGroup && state.filter.subGroup !== DIMENSION_TYPE_ALL) {
150
150
  const metric = DATA_SETS_CONSTANTS.find(item => item.id === state.filter.subGroup);
@@ -18,7 +18,7 @@ export const DeleteDialog = ({
18
18
  onDelete,
19
19
  onError
20
20
  }) => {
21
- const mutation = useMemo(() => getMutation(type), []);
21
+ const mutation = useMemo(() => getMutation(type), [type]);
22
22
  const [mutate] = useDataMutation(mutation, {
23
23
  variables: {
24
24
  id
@@ -181,13 +181,13 @@ export const Editor = /*#__PURE__*/forwardRef(({
181
181
  useEffect(() => {
182
182
  if (initialFocus) {
183
183
  var _textareaRef$current;
184
- (_textareaRef$current = textareaRef.current) === null || _textareaRef$current === void 0 ? void 0 : _textareaRef$current.focus();
184
+ (_textareaRef$current = textareaRef.current) === null || _textareaRef$current === void 0 || _textareaRef$current.focus();
185
185
  }
186
186
  }, [initialFocus, textareaRef]);
187
187
  useEffect(() => {
188
188
  if (caretPosRef.current) {
189
189
  var _textareaRef$current2;
190
- (_textareaRef$current2 = textareaRef.current) === null || _textareaRef$current2 === void 0 ? void 0 : _textareaRef$current2.setSelectionRange(caretPosRef.current, caretPosRef.current);
190
+ (_textareaRef$current2 = textareaRef.current) === null || _textareaRef$current2 === void 0 || _textareaRef$current2.setSelectionRange(caretPosRef.current, caretPosRef.current);
191
191
  caretPosRef.current = undefined;
192
192
  }
193
193
  }, [value, textareaRef]);
@@ -92,6 +92,7 @@ export const TranslationForm = ({
92
92
  useEffect(() => {
93
93
  const fetchTranslations = () => fetchFieldsTranslations(fieldsToTranslate);
94
94
  fetchTranslations();
95
+ // eslint-disable-next-line react-hooks/exhaustive-deps
95
96
  }, [fieldsToTranslate]);
96
97
  useEffect(() => setNewTranslations(translations), [translations]);
97
98
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalContent, null, /*#__PURE__*/React.createElement(DataTable, {
@@ -1,6 +1,6 @@
1
1
  import { useDataQuery } from '@dhis2/app-runtime';
2
2
  import debounce from 'lodash/debounce';
3
- import { useCallback, useEffect, useState } from 'react';
3
+ import { useEffect, useMemo, useState } from 'react';
4
4
  const usersQuery = {
5
5
  users: {
6
6
  resource: 'users/gist',
@@ -32,7 +32,7 @@ export const useUserSearchResults = ({
32
32
  } = useDataQuery(usersQuery, {
33
33
  lazy: true
34
34
  });
35
- const debouncedRefetch = useCallback(debounce(refetch, 250), [refetch]);
35
+ const debouncedRefetch = useMemo(() => debounce(refetch, 250), [refetch]);
36
36
  useEffect(() => {
37
37
  if (searchText.length) {
38
38
  debouncedRefetch({
@@ -9,8 +9,6 @@
9
9
  "Last updated {{time}}": "Last updated {{time}}",
10
10
  "Created {{time}} by {{author}}": "Created {{time}} by {{author}}",
11
11
  "Created {{time}}": "Created {{time}}",
12
- "Viewed {{count}} times": "Viewed 1 time",
13
- "Viewed {{count}} times_plural": "Viewed {{count}} times",
14
12
  "Notifications": "Notifications",
15
13
  "You're subscribed and getting updates about new interpretations.": "You're subscribed and getting updates about new interpretations.",
16
14
  "Unsubscribe": "Unsubscribe",
@@ -187,8 +185,6 @@
187
185
  "Error loading interpretations": "Error loading interpretations",
188
186
  "Could not load interpretations": "Could not load interpretations",
189
187
  "Reply": "Reply",
190
- "{{count}} replies": "{{count}} reply",
191
- "{{count}} replies_plural": "{{count}} replies",
192
188
  "View replies": "View replies",
193
189
  "Unlike": "Unlike",
194
190
  "Like": "Like",
@@ -238,12 +234,6 @@
238
234
  "No line lists found. Try adjusting your search or filter options to find what you're looking for.": "No line lists found. Try adjusting your search or filter options to find what you're looking for.",
239
235
  "New line list": "New line list",
240
236
  "Hide": "Hide",
241
- "{{count}} org units": "{{count}} org unit",
242
- "{{count}} org units_plural": "{{count}} org units",
243
- "{{count}} levels": "{{count}} level",
244
- "{{count}} levels_plural": "{{count}} levels",
245
- "{{count}} groups": "{{count}} group",
246
- "{{count}} groups_plural": "{{count}} groups",
247
237
  "Selected: {{commaSeparatedListOfOrganisationUnits}}": "Selected: {{commaSeparatedListOfOrganisationUnits}}",
248
238
  "Nothing selected": "Nothing selected",
249
239
  "User organisation unit": "User organisation unit",
@@ -478,7 +468,5 @@
478
468
  "Target": "Target",
479
469
  "Base": "Base",
480
470
  "Axis {{axisId}}": "Axis {{axisId}}",
481
- "{{count}} items": "{{count}} item",
482
- "{{count}} items_plural": "{{count}} items",
483
471
  "Reset zoom": "Reset zoom"
484
472
  }
@@ -9,7 +9,7 @@
9
9
  "Last updated {{time}}": "Terakhir diperbarui {{time}}",
10
10
  "Created {{time}} by {{author}}": "",
11
11
  "Created {{time}}": "",
12
- "Viewed {{count}} times": "",
12
+ "Viewed {{count}} times_0": "",
13
13
  "Notifications": "",
14
14
  "You're subscribed and getting updates about new interpretations.": "",
15
15
  "Unsubscribe": "",
@@ -186,7 +186,7 @@
186
186
  "Error loading interpretations": "",
187
187
  "Could not load interpretations": "",
188
188
  "Reply": "Balas",
189
- "{{count}} replies": "balasan {{count}} ",
189
+ "{{count}} replies_0": "balasan {{count}} ",
190
190
  "View replies": "",
191
191
  "Unlike": "Batalkan Suka",
192
192
  "Like": "Suka",
@@ -236,9 +236,9 @@
236
236
  "No line lists found. Try adjusting your search or filter options to find what you're looking for.": "",
237
237
  "New line list": "",
238
238
  "Hide": "Sembunyikan",
239
- "{{count}} org units": "",
240
- "{{count}} levels": "",
241
- "{{count}} groups": "",
239
+ "{{count}} org units_0": "",
240
+ "{{count}} levels_0": "",
241
+ "{{count}} groups_0": "",
242
242
  "Selected: {{commaSeparatedListOfOrganisationUnits}}": "",
243
243
  "Nothing selected": "",
244
244
  "User organisation unit": "",
@@ -467,6 +467,6 @@
467
467
  "Target": "Target",
468
468
  "Base": "Dasar",
469
469
  "Axis {{axisId}}": "Sumbu {{axisId}}",
470
- "{{count}} items": "",
470
+ "{{count}} items_0": "",
471
471
  "Reset zoom": "Setel ulang zoom"
472
472
  }
@@ -49,45 +49,90 @@ import viTranslations from './vi/translations.json';
49
49
  import zhTranslations from './zh/translations.json';
50
50
  import zh_CNTranslations from './zh_CN/translations.json';
51
51
  const namespace = 'default';
52
- i18n.addResources('ar', namespace, arTranslations);
53
- i18n.addResources('ar_EG', namespace, ar_EGTranslations);
54
- i18n.addResources('ar_IQ', namespace, ar_IQTranslations);
55
- i18n.addResources('bn', namespace, bnTranslations);
56
- i18n.addResources('ckb', namespace, ckbTranslations);
57
- i18n.addResources('cs', namespace, csTranslations);
58
- i18n.addResources('da', namespace, daTranslations);
59
- i18n.addResources('en', namespace, enTranslations);
60
- i18n.addResources('en_US', namespace, en_USTranslations);
61
- i18n.addResources('es', namespace, esTranslations);
62
- i18n.addResources('es_419', namespace, es_419Translations);
63
- i18n.addResources('fr', namespace, frTranslations);
64
- i18n.addResources('hi_IN', namespace, hi_INTranslations);
65
- i18n.addResources('id', namespace, idTranslations);
66
- i18n.addResources('km', namespace, kmTranslations);
67
- i18n.addResources('lo', namespace, loTranslations);
68
- i18n.addResources('my', namespace, myTranslations);
69
- i18n.addResources('nb', namespace, nbTranslations);
70
- i18n.addResources('ne', namespace, neTranslations);
71
- i18n.addResources('nl', namespace, nlTranslations);
72
- i18n.addResources('or', namespace, orTranslations);
73
- i18n.addResources('prs', namespace, prsTranslations);
74
- i18n.addResources('ps', namespace, psTranslations);
75
- i18n.addResources('pt', namespace, ptTranslations);
76
- i18n.addResources('pt_BR', namespace, pt_BRTranslations);
77
- i18n.addResources('ro', namespace, roTranslations);
78
- i18n.addResources('ru', namespace, ruTranslations);
79
- i18n.addResources('si', namespace, siTranslations);
80
- i18n.addResources('sv', namespace, svTranslations);
81
- i18n.addResources('tet', namespace, tetTranslations);
82
- i18n.addResources('tg', namespace, tgTranslations);
83
- i18n.addResources('th', namespace, thTranslations);
84
- i18n.addResources('uk', namespace, ukTranslations);
85
- i18n.addResources('ur', namespace, urTranslations);
86
- i18n.addResources('uz_Cyrl', namespace, uz_CyrlTranslations);
87
- i18n.addResources('uz_Latn', namespace, uz_LatnTranslations);
88
- i18n.addResources('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations);
89
- i18n.addResources('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations);
90
- i18n.addResources('vi', namespace, viTranslations);
91
- i18n.addResources('zh', namespace, zhTranslations);
92
- i18n.addResources('zh_CN', namespace, zh_CNTranslations);
52
+
53
+ // Use 'deep' = true and 'overwrite' = false to add to, but not overwrite,
54
+ // custom translations from the datastore (added by the app adapter)
55
+
56
+ i18n.addResourceBundle('ar', namespace, arTranslations, true, false);
57
+ i18n.addResourceBundle('ar', namespace, arTranslations, true, false);
58
+ i18n.addResourceBundle('ar_EG', namespace, ar_EGTranslations, true, false);
59
+ i18n.addResourceBundle('ar-EG', namespace, ar_EGTranslations, true, false);
60
+ i18n.addResourceBundle('ar_IQ', namespace, ar_IQTranslations, true, false);
61
+ i18n.addResourceBundle('ar-IQ', namespace, ar_IQTranslations, true, false);
62
+ i18n.addResourceBundle('bn', namespace, bnTranslations, true, false);
63
+ i18n.addResourceBundle('bn', namespace, bnTranslations, true, false);
64
+ i18n.addResourceBundle('ckb', namespace, ckbTranslations, true, false);
65
+ i18n.addResourceBundle('ckb', namespace, ckbTranslations, true, false);
66
+ i18n.addResourceBundle('cs', namespace, csTranslations, true, false);
67
+ i18n.addResourceBundle('cs', namespace, csTranslations, true, false);
68
+ i18n.addResourceBundle('da', namespace, daTranslations, true, false);
69
+ i18n.addResourceBundle('da', namespace, daTranslations, true, false);
70
+ i18n.addResourceBundle('en', namespace, enTranslations, true, false);
71
+ i18n.addResourceBundle('en', namespace, enTranslations, true, false);
72
+ i18n.addResourceBundle('en_US', namespace, en_USTranslations, true, false);
73
+ i18n.addResourceBundle('en-US', namespace, en_USTranslations, true, false);
74
+ i18n.addResourceBundle('es', namespace, esTranslations, true, false);
75
+ i18n.addResourceBundle('es', namespace, esTranslations, true, false);
76
+ i18n.addResourceBundle('es_419', namespace, es_419Translations, true, false);
77
+ i18n.addResourceBundle('es-419', namespace, es_419Translations, true, false);
78
+ i18n.addResourceBundle('fr', namespace, frTranslations, true, false);
79
+ i18n.addResourceBundle('fr', namespace, frTranslations, true, false);
80
+ i18n.addResourceBundle('hi_IN', namespace, hi_INTranslations, true, false);
81
+ i18n.addResourceBundle('hi-IN', namespace, hi_INTranslations, true, false);
82
+ i18n.addResourceBundle('id', namespace, idTranslations, true, false);
83
+ i18n.addResourceBundle('id', namespace, idTranslations, true, false);
84
+ i18n.addResourceBundle('km', namespace, kmTranslations, true, false);
85
+ i18n.addResourceBundle('km', namespace, kmTranslations, true, false);
86
+ i18n.addResourceBundle('lo', namespace, loTranslations, true, false);
87
+ i18n.addResourceBundle('lo', namespace, loTranslations, true, false);
88
+ i18n.addResourceBundle('my', namespace, myTranslations, true, false);
89
+ i18n.addResourceBundle('my', namespace, myTranslations, true, false);
90
+ i18n.addResourceBundle('nb', namespace, nbTranslations, true, false);
91
+ i18n.addResourceBundle('nb', namespace, nbTranslations, true, false);
92
+ i18n.addResourceBundle('ne', namespace, neTranslations, true, false);
93
+ i18n.addResourceBundle('ne', namespace, neTranslations, true, false);
94
+ i18n.addResourceBundle('nl', namespace, nlTranslations, true, false);
95
+ i18n.addResourceBundle('nl', namespace, nlTranslations, true, false);
96
+ i18n.addResourceBundle('or', namespace, orTranslations, true, false);
97
+ i18n.addResourceBundle('or', namespace, orTranslations, true, false);
98
+ i18n.addResourceBundle('prs', namespace, prsTranslations, true, false);
99
+ i18n.addResourceBundle('prs', namespace, prsTranslations, true, false);
100
+ i18n.addResourceBundle('ps', namespace, psTranslations, true, false);
101
+ i18n.addResourceBundle('ps', namespace, psTranslations, true, false);
102
+ i18n.addResourceBundle('pt', namespace, ptTranslations, true, false);
103
+ i18n.addResourceBundle('pt', namespace, ptTranslations, true, false);
104
+ i18n.addResourceBundle('pt_BR', namespace, pt_BRTranslations, true, false);
105
+ i18n.addResourceBundle('pt-BR', namespace, pt_BRTranslations, true, false);
106
+ i18n.addResourceBundle('ro', namespace, roTranslations, true, false);
107
+ i18n.addResourceBundle('ro', namespace, roTranslations, true, false);
108
+ i18n.addResourceBundle('ru', namespace, ruTranslations, true, false);
109
+ i18n.addResourceBundle('ru', namespace, ruTranslations, true, false);
110
+ i18n.addResourceBundle('si', namespace, siTranslations, true, false);
111
+ i18n.addResourceBundle('si', namespace, siTranslations, true, false);
112
+ i18n.addResourceBundle('sv', namespace, svTranslations, true, false);
113
+ i18n.addResourceBundle('sv', namespace, svTranslations, true, false);
114
+ i18n.addResourceBundle('tet', namespace, tetTranslations, true, false);
115
+ i18n.addResourceBundle('tet', namespace, tetTranslations, true, false);
116
+ i18n.addResourceBundle('tg', namespace, tgTranslations, true, false);
117
+ i18n.addResourceBundle('tg', namespace, tgTranslations, true, false);
118
+ i18n.addResourceBundle('th', namespace, thTranslations, true, false);
119
+ i18n.addResourceBundle('th', namespace, thTranslations, true, false);
120
+ i18n.addResourceBundle('uk', namespace, ukTranslations, true, false);
121
+ i18n.addResourceBundle('uk', namespace, ukTranslations, true, false);
122
+ i18n.addResourceBundle('ur', namespace, urTranslations, true, false);
123
+ i18n.addResourceBundle('ur', namespace, urTranslations, true, false);
124
+ i18n.addResourceBundle('uz_Cyrl', namespace, uz_CyrlTranslations, true, false);
125
+ i18n.addResourceBundle('uz-Cyrl', namespace, uz_CyrlTranslations, true, false);
126
+ i18n.addResourceBundle('uz_Latn', namespace, uz_LatnTranslations, true, false);
127
+ i18n.addResourceBundle('uz-Latn', namespace, uz_LatnTranslations, true, false);
128
+ i18n.addResourceBundle('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations, true, false);
129
+ i18n.addResourceBundle('uz-Cyrl-UZ', namespace, uz_UZ_CyrlTranslations, true, false);
130
+ i18n.addResourceBundle('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations, true, false);
131
+ i18n.addResourceBundle('uz-Latn-UZ', namespace, uz_UZ_LatnTranslations, true, false);
132
+ i18n.addResourceBundle('vi', namespace, viTranslations, true, false);
133
+ i18n.addResourceBundle('vi', namespace, viTranslations, true, false);
134
+ i18n.addResourceBundle('zh', namespace, zhTranslations, true, false);
135
+ i18n.addResourceBundle('zh', namespace, zhTranslations, true, false);
136
+ i18n.addResourceBundle('zh_CN', namespace, zh_CNTranslations, true, false);
137
+ i18n.addResourceBundle('zh-CN', namespace, zh_CNTranslations, true, false);
93
138
  export default i18n;