@dhis2/analytics 28.0.3 → 28.0.5

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 (496) hide show
  1. package/build/cjs/__demo__/DataDimension.stories.js +1 -2
  2. package/build/cjs/__demo__/Filter.stories.js +1 -2
  3. package/build/cjs/__demo__/FixedPeriodSelect.stories.js +1 -2
  4. package/build/cjs/__demo__/OpenFileDialog.stories.js +19 -1
  5. package/build/cjs/__demo__/OrgUnitDimension.stories.js +1 -2
  6. package/build/cjs/__demo__/PivotTable.stories.js +166 -224
  7. package/build/cjs/__demo__/ScatterPlotPdfExport.stories.js +1 -2
  8. package/build/cjs/__demo__/SingleValue.stories.js +1 -2
  9. package/build/cjs/__demo__/Toolbar.stories.js +1 -2
  10. package/build/cjs/api/__tests__/dimensions.spec.js +1 -2
  11. package/build/cjs/api/analytics/Analytics.js +8 -9
  12. package/build/cjs/api/analytics/AnalyticsBase.js +58 -77
  13. package/build/cjs/api/analytics/AnalyticsRequest.js +1 -2
  14. package/build/cjs/api/analytics/AnalyticsRequestBase.js +18 -21
  15. package/build/cjs/api/analytics/AnalyticsRequestPropertiesMixin.js +19 -38
  16. package/build/cjs/api/analytics/AnalyticsResponseHeader.js +5 -7
  17. package/build/cjs/api/analytics/__tests__/AnalyticsBase.spec.js +9 -12
  18. package/build/cjs/api/analytics/__tests__/AnalyticsRequest.spec.js +8 -2
  19. package/build/cjs/api/analytics/utils.js +11 -17
  20. package/build/cjs/api/dimensions.js +119 -148
  21. package/build/cjs/api/expression.js +39 -60
  22. package/build/cjs/api/organisationUnits.js +23 -35
  23. package/build/cjs/components/AboutAOUnit/AboutAOUnit.js +12 -20
  24. package/build/cjs/components/CachedDataQueryProvider.js +7 -9
  25. package/build/cjs/components/DashboardPluginWrapper/DashboardPluginWrapper.js +18 -22
  26. package/build/cjs/components/DataDimension/Calculation/CalculationModal.js +44 -61
  27. package/build/cjs/components/DataDimension/Calculation/DataElementOption.js +5 -6
  28. package/build/cjs/components/DataDimension/Calculation/DataElementSelector.js +29 -38
  29. package/build/cjs/components/DataDimension/Calculation/DndContext.js +29 -37
  30. package/build/cjs/components/DataDimension/Calculation/DraggingItem.js +5 -6
  31. package/build/cjs/components/DataDimension/Calculation/DropZone.js +4 -5
  32. package/build/cjs/components/DataDimension/Calculation/FormulaField.js +29 -32
  33. package/build/cjs/components/DataDimension/Calculation/FormulaItem.js +14 -16
  34. package/build/cjs/components/DataDimension/Calculation/MathOperatorSelector.js +23 -29
  35. package/build/cjs/components/DataDimension/Calculation/Operator.js +6 -7
  36. package/build/cjs/components/DataDimension/DataDimension.js +20 -32
  37. package/build/cjs/components/DataDimension/Info/CalculationInfo.js +14 -22
  38. package/build/cjs/components/DataDimension/Info/DataElementInfo.js +23 -36
  39. package/build/cjs/components/DataDimension/Info/DataElementOperandInfo.js +30 -44
  40. package/build/cjs/components/DataDimension/Info/DataSetInfo.js +26 -39
  41. package/build/cjs/components/DataDimension/Info/EventDataItemInfo.js +21 -34
  42. package/build/cjs/components/DataDimension/Info/IndicatorInfo.js +21 -32
  43. package/build/cjs/components/DataDimension/Info/InfoPopover.js +6 -7
  44. package/build/cjs/components/DataDimension/Info/InfoTable.js +39 -52
  45. package/build/cjs/components/DataDimension/Info/OptionInfo.js +13 -20
  46. package/build/cjs/components/DataDimension/Info/ProgramIndicatorInfo.js +46 -58
  47. package/build/cjs/components/DataDimension/ItemOptionsSelector/ItemOptionsSelector.js +22 -32
  48. package/build/cjs/components/DataDimension/ItemSelector/DataTypeSelector.js +6 -7
  49. package/build/cjs/components/DataDimension/ItemSelector/DetailSelector.js +5 -6
  50. package/build/cjs/components/DataDimension/ItemSelector/GroupSelector.js +10 -12
  51. package/build/cjs/components/DataDimension/ItemSelector/ItemSelector.js +86 -104
  52. package/build/cjs/components/DataDimension/ItemSelector/MetricSelector.js +5 -6
  53. package/build/cjs/components/DataDimension/SourceEmptyPlaceholder.js +10 -13
  54. package/build/cjs/components/DataDimension/TransferOption.js +35 -39
  55. package/build/cjs/components/DimensionMenu.js +13 -14
  56. package/build/cjs/components/DimensionsPanel/DimensionsPanel.js +8 -9
  57. package/build/cjs/components/DimensionsPanel/List/DimensionItem.js +12 -13
  58. package/build/cjs/components/DimensionsPanel/List/DimensionList.js +12 -11
  59. package/build/cjs/components/DimensionsPanel/List/OptionsButton.js +8 -11
  60. package/build/cjs/components/DimensionsPanel/List/RecommendedIcon.js +10 -13
  61. package/build/cjs/components/DimensionsPanel/List/__tests__/DimensionItem.spec.js +48 -41
  62. package/build/cjs/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +110 -114
  63. package/build/cjs/components/DimensionsPanel/__tests__/DimensionsPanel.spec.js +36 -33
  64. package/build/cjs/components/DynamicDimension/DynamicDimension.js +9 -13
  65. package/build/cjs/components/DynamicDimension/ItemSelector.js +25 -38
  66. package/build/cjs/components/FileMenu/DeleteDialog.js +11 -16
  67. package/build/cjs/components/FileMenu/FileMenu.js +19 -30
  68. package/build/cjs/components/FileMenu/GetLinkDialog.js +7 -7
  69. package/build/cjs/components/FileMenu/RenameDialog.js +13 -21
  70. package/build/cjs/components/FileMenu/SaveAsDialog.js +13 -21
  71. package/build/cjs/components/FileMenu/__tests__/DeleteDialog.spec.js +24 -27
  72. package/build/cjs/components/FileMenu/__tests__/FileMenu.spec.js +55 -31
  73. package/build/cjs/components/FileMenu/__tests__/GetLinkDialog.spec.js +35 -39
  74. package/build/cjs/components/FileMenu/__tests__/RenameDialog.spec.js +17 -11
  75. package/build/cjs/components/FileMenu/__tests__/SaveAsDialog.spec.js +44 -37
  76. package/build/cjs/components/FileMenu/utils.js +10 -12
  77. package/build/cjs/components/Filter/Filter.js +21 -27
  78. package/build/cjs/components/Filter/__tests__/Filter.spec.js +29 -34
  79. package/build/cjs/components/Interpretations/InterpretationModal/Comment.js +8 -10
  80. package/build/cjs/components/Interpretations/InterpretationModal/CommentAddForm.js +10 -15
  81. package/build/cjs/components/Interpretations/InterpretationModal/CommentDeleteButton.js +10 -15
  82. package/build/cjs/components/Interpretations/InterpretationModal/CommentUpdateForm.js +12 -17
  83. package/build/cjs/components/Interpretations/InterpretationModal/InterpretationModal.js +19 -25
  84. package/build/cjs/components/Interpretations/InterpretationModal/InterpretationThread.js +12 -14
  85. package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationForm.js +12 -17
  86. package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationList.js +10 -11
  87. package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js +23 -33
  88. package/build/cjs/components/Interpretations/common/Interpretation/Interpretation.js +13 -15
  89. package/build/cjs/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js +7 -11
  90. package/build/cjs/components/Interpretations/common/Interpretation/InterpretationSharingLink.js +5 -7
  91. package/build/cjs/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js +15 -23
  92. package/build/cjs/components/Interpretations/common/Interpretation/useLike.js +5 -6
  93. package/build/cjs/components/Interpretations/common/Message/Message.js +6 -7
  94. package/build/cjs/components/Interpretations/common/Message/MessageButtonStrip.js +8 -11
  95. package/build/cjs/components/Interpretations/common/Message/MessageEditorContainer.js +18 -21
  96. package/build/cjs/components/Interpretations/common/Message/MessageIconButton.js +34 -40
  97. package/build/cjs/components/Interpretations/common/Message/MessageInput.js +1 -2
  98. package/build/cjs/components/Interpretations/common/Message/MessageStatsBar.js +8 -11
  99. package/build/cjs/components/LegendKey/LegendKey.js +3 -4
  100. package/build/cjs/components/OfflineTooltip.js +18 -26
  101. package/build/cjs/components/OpenFileDialog/CreatedByFilter.js +28 -26
  102. package/build/cjs/components/OpenFileDialog/CustomSelectOption.js +23 -26
  103. package/build/cjs/components/OpenFileDialog/DateField.js +3 -4
  104. package/build/cjs/components/OpenFileDialog/FileList.js +19 -22
  105. package/build/cjs/components/OpenFileDialog/NameFilter.js +15 -21
  106. package/build/cjs/components/OpenFileDialog/OpenFileDialog.js +50 -79
  107. package/build/cjs/components/OpenFileDialog/PaginationControls.js +22 -28
  108. package/build/cjs/components/OpenFileDialog/VisTypeFilter.js +65 -36
  109. package/build/cjs/components/OpenFileDialog/__tests__/OpenFileDialog.spec.js +51 -0
  110. package/build/cjs/components/Options/VisualizationOptions.js +35 -46
  111. package/build/cjs/components/OrgUnitDimension/OrgUnitDimension.js +38 -60
  112. package/build/cjs/components/OrgUnitDimension/__tests__/OrgUnitDimension.spec.js +78 -44
  113. package/build/cjs/components/PeriodDimension/FixedPeriodFilter.js +17 -25
  114. package/build/cjs/components/PeriodDimension/FixedPeriodSelect.js +15 -21
  115. package/build/cjs/components/PeriodDimension/PeriodDimension.js +9 -12
  116. package/build/cjs/components/PeriodDimension/PeriodTransfer.js +49 -63
  117. package/build/cjs/components/PeriodDimension/RelativePeriodFilter.js +25 -30
  118. package/build/cjs/components/PeriodDimension/__tests__/FixedPeriodSingleSelect.spec.js +14 -21
  119. package/build/cjs/components/PeriodDimension/__tests__/PeriodDimension.spec.js +27 -23
  120. package/build/cjs/components/PeriodDimension/utils/fixedPeriods.js +6 -7
  121. package/build/cjs/components/PeriodDimension/utils/index.js +1 -5
  122. package/build/cjs/components/PivotTable/PivotTable.js +8 -10
  123. package/build/cjs/components/PivotTable/PivotTableBody.js +20 -29
  124. package/build/cjs/components/PivotTable/PivotTableCell.js +8 -12
  125. package/build/cjs/components/PivotTable/PivotTableClippedAxis.js +14 -17
  126. package/build/cjs/components/PivotTable/PivotTableColumnHeaderCell.js +7 -8
  127. package/build/cjs/components/PivotTable/PivotTableColumnHeaders.js +22 -29
  128. package/build/cjs/components/PivotTable/PivotTableContainer.js +5 -6
  129. package/build/cjs/components/PivotTable/PivotTableDimensionLabelCell.js +4 -5
  130. package/build/cjs/components/PivotTable/PivotTableEmptyCell.js +3 -4
  131. package/build/cjs/components/PivotTable/PivotTableEmptyRow.js +4 -5
  132. package/build/cjs/components/PivotTable/PivotTableEngineContext.js +5 -7
  133. package/build/cjs/components/PivotTable/PivotTableHead.js +13 -16
  134. package/build/cjs/components/PivotTable/PivotTableHeaderCell.js +8 -9
  135. package/build/cjs/components/PivotTable/PivotTableRow.js +20 -27
  136. package/build/cjs/components/PivotTable/PivotTableRowHeaderCell.js +5 -6
  137. package/build/cjs/components/PivotTable/PivotTableSortIcon.js +4 -5
  138. package/build/cjs/components/PivotTable/PivotTableTitleRow.js +19 -24
  139. package/build/cjs/components/PivotTable/PivotTableTitleRows.js +4 -5
  140. package/build/cjs/components/PivotTable/PivotTableValueCell.js +6 -8
  141. package/build/cjs/components/RichText/Editor/Editor.js +70 -85
  142. package/build/cjs/components/RichText/Editor/__tests__/Editor.spec.js +6 -7
  143. package/build/cjs/components/RichText/Parser/Parser.js +5 -10
  144. package/build/cjs/components/RichText/Parser/__tests__/MdParser.spec.js +1 -1
  145. package/build/cjs/components/RichText/Parser/__tests__/Parser.spec.js +22 -23
  146. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuBar.js +20 -24
  147. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +8 -13
  148. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuList.js +9 -17
  149. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +11 -16
  150. package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +56 -47
  151. package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +8 -8
  152. package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +30 -23
  153. package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +23 -17
  154. package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/__snapshots__/HoverMenuList.spec.js.snap +63 -0
  155. package/build/cjs/components/Toolbar/InterpretationsAndDetailsToggler.js +17 -21
  156. package/build/cjs/components/Toolbar/Toolbar.js +10 -16
  157. package/build/cjs/components/Toolbar/ToolbarSidebar.js +12 -18
  158. package/build/cjs/components/Toolbar/UpdateButton.js +18 -24
  159. package/build/cjs/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +19 -18
  160. package/build/cjs/components/Toolbar/__tests__/Toolbar.spec.js +8 -8
  161. package/build/cjs/components/Toolbar/__tests__/ToolbarSidebar.spec.js +14 -11
  162. package/build/cjs/components/Toolbar/__tests__/UpdateButton.spec.js +16 -14
  163. package/build/cjs/components/TransferOption.js +14 -15
  164. package/build/cjs/components/TranslationDialog/TranslationModal/LocalesSelect.js +19 -27
  165. package/build/cjs/components/TranslationDialog/TranslationModal/TranslationForm.js +17 -25
  166. package/build/cjs/components/TranslationDialog/TranslationModal/TranslationModal.js +9 -10
  167. package/build/cjs/components/TranslationDialog/TranslationModal/TranslationModalActions.js +18 -27
  168. package/build/cjs/components/TranslationDialog/TranslationModal/__tests__/TranslationModal.spec.js +25 -16
  169. package/build/cjs/components/TranslationDialog/TranslationModal/useTranslationsResults.js +3 -4
  170. package/build/cjs/components/UserMention/UserList.js +6 -7
  171. package/build/cjs/components/UserMention/UserMentionWrapper.js +13 -20
  172. package/build/cjs/components/UserMention/useUserSearchResults.js +12 -16
  173. package/build/cjs/components/VisTypeIcon.js +5 -6
  174. package/build/cjs/index.js +38 -39
  175. package/build/cjs/locales/ar_IQ/translations.json +20 -11
  176. package/build/cjs/locales/cs/translations.json +2 -0
  177. package/build/cjs/locales/en/translations.json +1 -0
  178. package/build/cjs/locales/es/translations.json +2 -0
  179. package/build/cjs/locales/fr/translations.json +2 -0
  180. package/build/cjs/locales/id/translations.json +20 -11
  181. package/build/cjs/locales/index.js +62 -62
  182. package/build/cjs/locales/lo/translations.json +2 -0
  183. package/build/cjs/locales/nb/translations.json +2 -0
  184. package/build/cjs/locales/prs/translations.json +2 -0
  185. package/build/cjs/locales/ps/translations.json +2 -0
  186. package/build/cjs/locales/pt/translations.json +2 -0
  187. package/build/cjs/locales/pt_BR/translations.json +2 -0
  188. package/build/cjs/locales/ru/translations.json +2 -0
  189. package/build/cjs/locales/si/translations.json +20 -11
  190. package/build/cjs/locales/sv/translations.json +20 -11
  191. package/build/cjs/locales/tet/translations.json +20 -11
  192. package/build/cjs/locales/tg/translations.json +2 -0
  193. package/build/cjs/locales/uk/translations.json +2 -0
  194. package/build/cjs/locales/ur/translations.json +2 -0
  195. package/build/cjs/locales/uz_UZ_Cyrl/translations.json +2 -0
  196. package/build/cjs/locales/uz_UZ_Latn/translations.json +4 -2
  197. package/build/cjs/locales/vi/translations.json +2 -0
  198. package/build/cjs/locales/zh/translations.json +2 -0
  199. package/build/cjs/locales/zh_CN/translations.json +17 -15
  200. package/build/cjs/modules/__tests__/expressions.spec.js +4 -5
  201. package/build/cjs/modules/__tests__/isNumeric.spec.js +33 -0
  202. package/build/cjs/modules/dimensionListItem.js +4 -5
  203. package/build/cjs/modules/expressions.js +3 -9
  204. package/build/cjs/modules/getPWAInstallationStatus.js +7 -9
  205. package/build/cjs/modules/layout/dimensionCreate.js +1 -3
  206. package/build/cjs/modules/layout/dimensionIsValid.js +3 -4
  207. package/build/cjs/modules/legends.js +5 -6
  208. package/build/cjs/modules/outliers/index.js +5 -6
  209. package/build/cjs/modules/outliers/iqr.js +4 -6
  210. package/build/cjs/modules/outliers/modZScore.js +6 -14
  211. package/build/cjs/modules/outliers/zScore.js +3 -4
  212. package/build/cjs/modules/pivotTable/AdaptiveClippingController.js +12 -16
  213. package/build/cjs/modules/pivotTable/PivotTableEngine.js +48 -59
  214. package/build/cjs/modules/pivotTable/clipAxis.js +7 -8
  215. package/build/cjs/modules/pivotTable/clipPartitionedAxis.js +9 -10
  216. package/build/cjs/modules/pivotTable/getHeaderForDisplay.js +8 -9
  217. package/build/cjs/modules/pivotTable/measureText.js +7 -9
  218. package/build/cjs/modules/pivotTable/useParentSize.js +1 -2
  219. package/build/cjs/modules/pivotTable/useScrollPosition.js +1 -2
  220. package/build/cjs/modules/pivotTable/useTableClipping.js +6 -7
  221. package/build/cjs/modules/relativeItems/index.js +1 -4
  222. package/build/cjs/modules/renderValue.js +1 -2
  223. package/build/cjs/modules/utils.js +11 -2
  224. package/build/cjs/visualizations/config/adapters/dhis_highcharts/addTrendLines.js +3 -8
  225. package/build/cjs/visualizations/config/adapters/dhis_highcharts/axis.js +7 -10
  226. package/build/cjs/visualizations/config/adapters/dhis_highcharts/customAxes.js +2 -5
  227. package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/index.js +7 -8
  228. package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueBackgroundColor.js +1 -2
  229. package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/index.js +6 -7
  230. package/build/cjs/visualizations/config/adapters/dhis_highcharts/getFormatter.js +2 -3
  231. package/build/cjs/visualizations/config/adapters/dhis_highcharts/getSteps.js +2 -3
  232. package/build/cjs/visualizations/config/adapters/dhis_highcharts/getTrimmedConfig.js +3 -4
  233. package/build/cjs/visualizations/config/adapters/dhis_highcharts/index.js +8 -10
  234. package/build/cjs/visualizations/config/adapters/dhis_highcharts/legend.js +6 -7
  235. package/build/cjs/visualizations/config/adapters/dhis_highcharts/legendSet.js +22 -26
  236. package/build/cjs/visualizations/config/adapters/dhis_highcharts/plotOptions.js +8 -9
  237. package/build/cjs/visualizations/config/adapters/dhis_highcharts/series/index.js +18 -20
  238. package/build/cjs/visualizations/config/adapters/dhis_highcharts/series/pie.js +1 -4
  239. package/build/cjs/visualizations/config/adapters/dhis_highcharts/subtitle/index.js +1 -2
  240. package/build/cjs/visualizations/config/adapters/dhis_highcharts/yAxis/gauge.js +1 -3
  241. package/build/cjs/visualizations/config/index.js +11 -12
  242. package/build/cjs/visualizations/config/validators/dhis/index.js +3 -4
  243. package/build/cjs/visualizations/index.js +1 -4
  244. package/build/cjs/visualizations/store/adapters/dhis_highcharts/index.js +7 -8
  245. package/build/cjs/visualizations/store/index.js +15 -17
  246. package/build/cjs/visualizations/store/validators/dhis/index.js +5 -6
  247. package/build/cjs/visualizations/util/getFilterText.js +3 -6
  248. package/build/cjs/visualizations/util/shouldUseContrastColor.js +1 -2
  249. package/build/es/__demo__/OpenFileDialog.stories.js +17 -0
  250. package/build/es/__demo__/PivotTable.stories.js +165 -222
  251. package/build/es/api/__tests__/dimensions.spec.js +1 -2
  252. package/build/es/api/analytics/Analytics.js +8 -9
  253. package/build/es/api/analytics/AnalyticsBase.js +58 -77
  254. package/build/es/api/analytics/AnalyticsRequest.js +1 -2
  255. package/build/es/api/analytics/AnalyticsRequestBase.js +18 -21
  256. package/build/es/api/analytics/AnalyticsRequestPropertiesMixin.js +19 -38
  257. package/build/es/api/analytics/AnalyticsResponseHeader.js +5 -7
  258. package/build/es/api/analytics/__tests__/AnalyticsBase.spec.js +8 -10
  259. package/build/es/api/analytics/__tests__/AnalyticsRequest.spec.js +8 -2
  260. package/build/es/api/analytics/utils.js +11 -17
  261. package/build/es/api/dimensions.js +119 -148
  262. package/build/es/api/expression.js +39 -60
  263. package/build/es/api/organisationUnits.js +23 -35
  264. package/build/es/components/AboutAOUnit/AboutAOUnit.js +11 -18
  265. package/build/es/components/CachedDataQueryProvider.js +6 -7
  266. package/build/es/components/DashboardPluginWrapper/DashboardPluginWrapper.js +17 -20
  267. package/build/es/components/DataDimension/Calculation/CalculationModal.js +43 -59
  268. package/build/es/components/DataDimension/Calculation/DataElementOption.js +5 -6
  269. package/build/es/components/DataDimension/Calculation/DataElementSelector.js +28 -36
  270. package/build/es/components/DataDimension/Calculation/DndContext.js +28 -35
  271. package/build/es/components/DataDimension/Calculation/DraggingItem.js +5 -6
  272. package/build/es/components/DataDimension/Calculation/DropZone.js +4 -5
  273. package/build/es/components/DataDimension/Calculation/FormulaField.js +29 -32
  274. package/build/es/components/DataDimension/Calculation/FormulaItem.js +13 -14
  275. package/build/es/components/DataDimension/Calculation/MathOperatorSelector.js +23 -29
  276. package/build/es/components/DataDimension/Calculation/Operator.js +6 -7
  277. package/build/es/components/DataDimension/DataDimension.js +19 -30
  278. package/build/es/components/DataDimension/Info/CalculationInfo.js +13 -20
  279. package/build/es/components/DataDimension/Info/DataElementInfo.js +23 -36
  280. package/build/es/components/DataDimension/Info/DataElementOperandInfo.js +29 -42
  281. package/build/es/components/DataDimension/Info/DataSetInfo.js +26 -39
  282. package/build/es/components/DataDimension/Info/EventDataItemInfo.js +21 -34
  283. package/build/es/components/DataDimension/Info/IndicatorInfo.js +20 -30
  284. package/build/es/components/DataDimension/Info/InfoPopover.js +6 -7
  285. package/build/es/components/DataDimension/Info/InfoTable.js +39 -52
  286. package/build/es/components/DataDimension/Info/OptionInfo.js +13 -20
  287. package/build/es/components/DataDimension/Info/ProgramIndicatorInfo.js +45 -56
  288. package/build/es/components/DataDimension/ItemOptionsSelector/ItemOptionsSelector.js +21 -30
  289. package/build/es/components/DataDimension/ItemSelector/DataTypeSelector.js +6 -7
  290. package/build/es/components/DataDimension/ItemSelector/DetailSelector.js +5 -6
  291. package/build/es/components/DataDimension/ItemSelector/GroupSelector.js +9 -10
  292. package/build/es/components/DataDimension/ItemSelector/ItemSelector.js +85 -102
  293. package/build/es/components/DataDimension/ItemSelector/MetricSelector.js +5 -6
  294. package/build/es/components/DataDimension/SourceEmptyPlaceholder.js +10 -13
  295. package/build/es/components/DataDimension/TransferOption.js +35 -39
  296. package/build/es/components/DimensionMenu.js +13 -14
  297. package/build/es/components/DimensionsPanel/DimensionsPanel.js +7 -7
  298. package/build/es/components/DimensionsPanel/List/DimensionItem.js +11 -11
  299. package/build/es/components/DimensionsPanel/List/DimensionList.js +11 -9
  300. package/build/es/components/DimensionsPanel/List/OptionsButton.js +8 -11
  301. package/build/es/components/DimensionsPanel/List/RecommendedIcon.js +10 -13
  302. package/build/es/components/DimensionsPanel/List/__tests__/DimensionItem.spec.js +47 -40
  303. package/build/es/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +110 -114
  304. package/build/es/components/DimensionsPanel/__tests__/DimensionsPanel.spec.js +35 -32
  305. package/build/es/components/DynamicDimension/DynamicDimension.js +9 -13
  306. package/build/es/components/DynamicDimension/ItemSelector.js +24 -36
  307. package/build/es/components/FileMenu/DeleteDialog.js +10 -14
  308. package/build/es/components/FileMenu/FileMenu.js +18 -28
  309. package/build/es/components/FileMenu/GetLinkDialog.js +7 -7
  310. package/build/es/components/FileMenu/RenameDialog.js +12 -19
  311. package/build/es/components/FileMenu/SaveAsDialog.js +12 -19
  312. package/build/es/components/FileMenu/__tests__/DeleteDialog.spec.js +23 -26
  313. package/build/es/components/FileMenu/__tests__/FileMenu.spec.js +56 -32
  314. package/build/es/components/FileMenu/__tests__/GetLinkDialog.spec.js +34 -38
  315. package/build/es/components/FileMenu/__tests__/RenameDialog.spec.js +18 -12
  316. package/build/es/components/FileMenu/__tests__/SaveAsDialog.spec.js +43 -36
  317. package/build/es/components/FileMenu/utils.js +10 -12
  318. package/build/es/components/Filter/Filter.js +21 -27
  319. package/build/es/components/Filter/__tests__/Filter.spec.js +28 -33
  320. package/build/es/components/Interpretations/InterpretationModal/Comment.js +7 -8
  321. package/build/es/components/Interpretations/InterpretationModal/CommentAddForm.js +9 -13
  322. package/build/es/components/Interpretations/InterpretationModal/CommentDeleteButton.js +9 -13
  323. package/build/es/components/Interpretations/InterpretationModal/CommentUpdateForm.js +11 -15
  324. package/build/es/components/Interpretations/InterpretationModal/InterpretationModal.js +18 -23
  325. package/build/es/components/Interpretations/InterpretationModal/InterpretationThread.js +11 -12
  326. package/build/es/components/Interpretations/InterpretationsUnit/InterpretationForm.js +11 -15
  327. package/build/es/components/Interpretations/InterpretationsUnit/InterpretationList.js +10 -11
  328. package/build/es/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js +22 -31
  329. package/build/es/components/Interpretations/common/Interpretation/Interpretation.js +12 -13
  330. package/build/es/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js +7 -11
  331. package/build/es/components/Interpretations/common/Interpretation/InterpretationSharingLink.js +4 -5
  332. package/build/es/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js +14 -21
  333. package/build/es/components/Interpretations/common/Interpretation/useLike.js +5 -6
  334. package/build/es/components/Interpretations/common/Message/Message.js +6 -7
  335. package/build/es/components/Interpretations/common/Message/MessageButtonStrip.js +8 -11
  336. package/build/es/components/Interpretations/common/Message/MessageEditorContainer.js +18 -21
  337. package/build/es/components/Interpretations/common/Message/MessageIconButton.js +34 -40
  338. package/build/es/components/Interpretations/common/Message/MessageStatsBar.js +8 -11
  339. package/build/es/components/LegendKey/LegendKey.js +3 -4
  340. package/build/es/components/OfflineTooltip.js +18 -26
  341. package/build/es/components/OpenFileDialog/CreatedByFilter.js +26 -25
  342. package/build/es/components/OpenFileDialog/CustomSelectOption.js +23 -26
  343. package/build/es/components/OpenFileDialog/DateField.js +3 -4
  344. package/build/es/components/OpenFileDialog/FileList.js +19 -22
  345. package/build/es/components/OpenFileDialog/NameFilter.js +15 -21
  346. package/build/es/components/OpenFileDialog/OpenFileDialog.js +49 -78
  347. package/build/es/components/OpenFileDialog/PaginationControls.js +22 -28
  348. package/build/es/components/OpenFileDialog/VisTypeFilter.js +64 -36
  349. package/build/es/components/OpenFileDialog/__tests__/OpenFileDialog.spec.js +49 -0
  350. package/build/es/components/Options/VisualizationOptions.js +34 -44
  351. package/build/es/components/OrgUnitDimension/OrgUnitDimension.js +37 -58
  352. package/build/es/components/OrgUnitDimension/__tests__/OrgUnitDimension.spec.js +77 -43
  353. package/build/es/components/PeriodDimension/FixedPeriodFilter.js +17 -25
  354. package/build/es/components/PeriodDimension/FixedPeriodSelect.js +14 -19
  355. package/build/es/components/PeriodDimension/PeriodDimension.js +9 -12
  356. package/build/es/components/PeriodDimension/PeriodTransfer.js +48 -61
  357. package/build/es/components/PeriodDimension/RelativePeriodFilter.js +25 -30
  358. package/build/es/components/PeriodDimension/__tests__/FixedPeriodSingleSelect.spec.js +13 -20
  359. package/build/es/components/PeriodDimension/__tests__/PeriodDimension.spec.js +26 -22
  360. package/build/es/components/PeriodDimension/utils/fixedPeriods.js +6 -7
  361. package/build/es/components/PeriodDimension/utils/index.js +1 -5
  362. package/build/es/components/PivotTable/PivotTable.js +7 -8
  363. package/build/es/components/PivotTable/PivotTableBody.js +20 -29
  364. package/build/es/components/PivotTable/PivotTableCell.js +8 -12
  365. package/build/es/components/PivotTable/PivotTableClippedAxis.js +14 -17
  366. package/build/es/components/PivotTable/PivotTableColumnHeaderCell.js +7 -8
  367. package/build/es/components/PivotTable/PivotTableColumnHeaders.js +22 -29
  368. package/build/es/components/PivotTable/PivotTableContainer.js +5 -6
  369. package/build/es/components/PivotTable/PivotTableDimensionLabelCell.js +4 -5
  370. package/build/es/components/PivotTable/PivotTableEmptyCell.js +3 -4
  371. package/build/es/components/PivotTable/PivotTableEmptyRow.js +4 -5
  372. package/build/es/components/PivotTable/PivotTableEngineContext.js +4 -5
  373. package/build/es/components/PivotTable/PivotTableHead.js +13 -16
  374. package/build/es/components/PivotTable/PivotTableHeaderCell.js +8 -9
  375. package/build/es/components/PivotTable/PivotTableRow.js +20 -27
  376. package/build/es/components/PivotTable/PivotTableRowHeaderCell.js +5 -6
  377. package/build/es/components/PivotTable/PivotTableSortIcon.js +4 -5
  378. package/build/es/components/PivotTable/PivotTableTitleRow.js +18 -22
  379. package/build/es/components/PivotTable/PivotTableTitleRows.js +4 -5
  380. package/build/es/components/PivotTable/PivotTableValueCell.js +5 -6
  381. package/build/es/components/RichText/Editor/Editor.js +69 -83
  382. package/build/es/components/RichText/Editor/__tests__/Editor.spec.js +7 -8
  383. package/build/es/components/RichText/Parser/Parser.js +4 -8
  384. package/build/es/components/RichText/Parser/__tests__/MdParser.spec.js +1 -1
  385. package/build/es/components/RichText/Parser/__tests__/Parser.spec.js +21 -22
  386. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuBar.js +20 -23
  387. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +7 -11
  388. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuList.js +8 -15
  389. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +10 -14
  390. package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +57 -48
  391. package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +7 -7
  392. package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +27 -20
  393. package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +21 -15
  394. package/build/es/components/Toolbar/HoverMenuBar/__tests__/__snapshots__/HoverMenuList.spec.js.snap +63 -0
  395. package/build/es/components/Toolbar/InterpretationsAndDetailsToggler.js +17 -21
  396. package/build/es/components/Toolbar/Toolbar.js +10 -16
  397. package/build/es/components/Toolbar/ToolbarSidebar.js +12 -18
  398. package/build/es/components/Toolbar/UpdateButton.js +18 -24
  399. package/build/es/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +18 -17
  400. package/build/es/components/Toolbar/__tests__/Toolbar.spec.js +7 -7
  401. package/build/es/components/Toolbar/__tests__/ToolbarSidebar.spec.js +13 -10
  402. package/build/es/components/Toolbar/__tests__/UpdateButton.spec.js +15 -13
  403. package/build/es/components/TransferOption.js +14 -15
  404. package/build/es/components/TranslationDialog/TranslationModal/LocalesSelect.js +19 -27
  405. package/build/es/components/TranslationDialog/TranslationModal/TranslationForm.js +16 -23
  406. package/build/es/components/TranslationDialog/TranslationModal/TranslationModal.js +8 -8
  407. package/build/es/components/TranslationDialog/TranslationModal/TranslationModalActions.js +18 -27
  408. package/build/es/components/TranslationDialog/TranslationModal/__tests__/TranslationModal.spec.js +24 -15
  409. package/build/es/components/TranslationDialog/TranslationModal/useTranslationsResults.js +3 -4
  410. package/build/es/components/UserMention/UserList.js +6 -7
  411. package/build/es/components/UserMention/UserMentionWrapper.js +12 -18
  412. package/build/es/components/UserMention/useUserSearchResults.js +12 -16
  413. package/build/es/components/VisTypeIcon.js +5 -6
  414. package/build/es/locales/ar_IQ/translations.json +20 -11
  415. package/build/es/locales/cs/translations.json +2 -0
  416. package/build/es/locales/en/translations.json +1 -0
  417. package/build/es/locales/es/translations.json +2 -0
  418. package/build/es/locales/fr/translations.json +2 -0
  419. package/build/es/locales/id/translations.json +20 -11
  420. package/build/es/locales/lo/translations.json +2 -0
  421. package/build/es/locales/nb/translations.json +2 -0
  422. package/build/es/locales/prs/translations.json +2 -0
  423. package/build/es/locales/ps/translations.json +2 -0
  424. package/build/es/locales/pt/translations.json +2 -0
  425. package/build/es/locales/pt_BR/translations.json +2 -0
  426. package/build/es/locales/ru/translations.json +2 -0
  427. package/build/es/locales/si/translations.json +20 -11
  428. package/build/es/locales/sv/translations.json +20 -11
  429. package/build/es/locales/tet/translations.json +20 -11
  430. package/build/es/locales/tg/translations.json +2 -0
  431. package/build/es/locales/uk/translations.json +2 -0
  432. package/build/es/locales/ur/translations.json +2 -0
  433. package/build/es/locales/uz_UZ_Cyrl/translations.json +2 -0
  434. package/build/es/locales/uz_UZ_Latn/translations.json +4 -2
  435. package/build/es/locales/vi/translations.json +2 -0
  436. package/build/es/locales/zh/translations.json +2 -0
  437. package/build/es/locales/zh_CN/translations.json +17 -15
  438. package/build/es/modules/__tests__/expressions.spec.js +4 -5
  439. package/build/es/modules/__tests__/isNumeric.spec.js +31 -0
  440. package/build/es/modules/dimensionListItem.js +4 -5
  441. package/build/es/modules/expressions.js +3 -9
  442. package/build/es/modules/getPWAInstallationStatus.js +7 -9
  443. package/build/es/modules/layout/dimensionCreate.js +1 -3
  444. package/build/es/modules/layout/dimensionIsValid.js +3 -4
  445. package/build/es/modules/legends.js +5 -6
  446. package/build/es/modules/outliers/index.js +2 -3
  447. package/build/es/modules/outliers/iqr.js +4 -6
  448. package/build/es/modules/outliers/modZScore.js +6 -14
  449. package/build/es/modules/outliers/zScore.js +3 -4
  450. package/build/es/modules/pivotTable/AdaptiveClippingController.js +12 -16
  451. package/build/es/modules/pivotTable/PivotTableEngine.js +48 -59
  452. package/build/es/modules/pivotTable/clipAxis.js +7 -8
  453. package/build/es/modules/pivotTable/clipPartitionedAxis.js +9 -10
  454. package/build/es/modules/pivotTable/getHeaderForDisplay.js +8 -9
  455. package/build/es/modules/pivotTable/measureText.js +7 -9
  456. package/build/es/modules/pivotTable/useParentSize.js +1 -2
  457. package/build/es/modules/pivotTable/useScrollPosition.js +1 -2
  458. package/build/es/modules/pivotTable/useTableClipping.js +6 -7
  459. package/build/es/modules/relativeItems/index.js +1 -4
  460. package/build/es/modules/renderValue.js +1 -2
  461. package/build/es/modules/utils.js +9 -1
  462. package/build/es/visualizations/config/adapters/dhis_highcharts/addTrendLines.js +3 -8
  463. package/build/es/visualizations/config/adapters/dhis_highcharts/axis.js +2 -5
  464. package/build/es/visualizations/config/adapters/dhis_highcharts/customAxes.js +2 -5
  465. package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/index.js +7 -8
  466. package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueBackgroundColor.js +1 -2
  467. package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/index.js +6 -7
  468. package/build/es/visualizations/config/adapters/dhis_highcharts/getFormatter.js +1 -1
  469. package/build/es/visualizations/config/adapters/dhis_highcharts/getSteps.js +1 -1
  470. package/build/es/visualizations/config/adapters/dhis_highcharts/getTrimmedConfig.js +3 -4
  471. package/build/es/visualizations/config/adapters/dhis_highcharts/index.js +7 -8
  472. package/build/es/visualizations/config/adapters/dhis_highcharts/legend.js +6 -7
  473. package/build/es/visualizations/config/adapters/dhis_highcharts/legendSet.js +22 -26
  474. package/build/es/visualizations/config/adapters/dhis_highcharts/plotOptions.js +8 -9
  475. package/build/es/visualizations/config/adapters/dhis_highcharts/series/index.js +18 -20
  476. package/build/es/visualizations/config/adapters/dhis_highcharts/series/pie.js +1 -4
  477. package/build/es/visualizations/config/adapters/dhis_highcharts/yAxis/gauge.js +1 -3
  478. package/build/es/visualizations/config/index.js +11 -12
  479. package/build/es/visualizations/config/validators/dhis/index.js +3 -4
  480. package/build/es/visualizations/index.js +1 -4
  481. package/build/es/visualizations/store/adapters/dhis_highcharts/index.js +7 -8
  482. package/build/es/visualizations/store/index.js +15 -17
  483. package/build/es/visualizations/store/validators/dhis/index.js +5 -6
  484. package/build/es/visualizations/util/getFilterText.js +3 -6
  485. package/build/es/visualizations/util/shouldUseContrastColor.js +1 -2
  486. package/package.json +13 -15
  487. package/build/cjs/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +0 -89
  488. package/build/cjs/components/PeriodDimension/__tests__/PeriodSelector.spec.js +0 -29
  489. package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/FixedPeriodSingleSelect.spec.js.snap +0 -93
  490. package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/PeriodDimension.spec.js.snap +0 -17
  491. package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/PeriodSelector.spec.js.snap +0 -89
  492. package/build/es/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +0 -89
  493. package/build/es/components/PeriodDimension/__tests__/PeriodSelector.spec.js +0 -26
  494. package/build/es/components/PeriodDimension/__tests__/__snapshots__/FixedPeriodSingleSelect.spec.js.snap +0 -93
  495. package/build/es/components/PeriodDimension/__tests__/__snapshots__/PeriodDimension.spec.js.snap +0 -17
  496. package/build/es/components/PeriodDimension/__tests__/__snapshots__/PeriodSelector.spec.js.snap +0 -89
@@ -1,42 +1,43 @@
1
- import { shallow } from 'enzyme';
1
+ import { render, screen } from '@testing-library/react';
2
+ import userEvent from '@testing-library/user-event';
2
3
  import React from 'react';
3
4
  import { InterpretationsAndDetailsToggler } from '../index.js';
4
5
  describe('<InterpretationsAndDetailsToggler/>', () => {
5
6
  const noop = () => {};
6
- it('accepts an `onClick` prop', () => {
7
+ test('accepts an `onClick` prop', async () => {
8
+ const user = userEvent.setup();
7
9
  const onClick = jest.fn();
8
- const wrapper = shallow(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
10
+ render(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
9
11
  onClick: onClick
10
12
  }));
11
- wrapper.simulate('click');
13
+ await user.click(screen.getByRole('button'));
12
14
  expect(onClick).toHaveBeenCalledTimes(1);
13
15
  });
14
- it('accepts a `dataTest` prop', () => {
16
+ test('accepts a `dataTest` prop', () => {
15
17
  const dataTest = 'test';
16
- const wrapper = shallow(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
18
+ render(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
17
19
  onClick: noop,
18
20
  dataTest: dataTest
19
21
  }));
20
- expect(wrapper.prop('data-test')).toBe(dataTest);
22
+ expect(screen.getByTestId(dataTest)).toBeInTheDocument();
21
23
  });
22
- it('accepts a `disabled` prop', () => {
23
- const wrapper = shallow(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
24
+ test('accepts a `disabled` prop', () => {
25
+ render(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
24
26
  disabled: true,
25
27
  onClick: noop
26
28
  }));
27
- expect(wrapper.find('button').prop('disabled')).toEqual(true);
29
+ expect(screen.getByRole('button')).toBeDisabled();
28
30
  });
29
- it('accepts an `isShowing` prop', () => {
30
- const wrapper = shallow(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
31
+ test('accepts an `isShowing` prop', () => {
32
+ const showingDataTest = 'dhis2-analytics-interpretationsanddetailstoggler-showing';
33
+ render(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
31
34
  onClick: noop
32
35
  }));
33
- const wrapperWithIsShowing = shallow(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
36
+ expect(screen.queryByTestId(showingDataTest)).not.toBeInTheDocument();
37
+ render(/*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
34
38
  isShowing: true,
35
39
  onClick: noop
36
40
  }));
37
- expect(wrapper.find('SvgChevronRight24')).toHaveLength(0);
38
- expect(wrapper.find('SvgChevronLeft24')).toHaveLength(1);
39
- expect(wrapperWithIsShowing.find('SvgChevronRight24')).toHaveLength(1);
40
- expect(wrapperWithIsShowing.find('SvgChevronLeft24')).toHaveLength(0);
41
+ expect(screen.getByTestId(showingDataTest)).toBeInTheDocument();
41
42
  });
42
43
  });
@@ -1,17 +1,17 @@
1
- import { shallow } from 'enzyme';
1
+ import { render, screen } from '@testing-library/react';
2
2
  import React from 'react';
3
3
  import { Toolbar } from '../index.js';
4
4
  describe('<Toolbar/>', () => {
5
- it('renders children', () => {
5
+ test('renders children', () => {
6
6
  const childNode = 'text node';
7
- const wrapper = shallow(/*#__PURE__*/React.createElement(Toolbar, null, childNode));
8
- expect(wrapper.containsMatchingElement(childNode)).toBe(true);
7
+ render(/*#__PURE__*/React.createElement(Toolbar, null, childNode));
8
+ expect(screen.getByText(childNode)).toBeInTheDocument();
9
9
  });
10
- it('accepts a `dataTest` prop', () => {
10
+ test('accepts a `dataTest` prop', () => {
11
11
  const dataTest = 'test';
12
- const wrapper = shallow(/*#__PURE__*/React.createElement(Toolbar, {
12
+ render(/*#__PURE__*/React.createElement(Toolbar, {
13
13
  dataTest: dataTest
14
14
  }));
15
- expect(wrapper.prop('data-test')).toBe(dataTest);
15
+ expect(screen.getByTestId(dataTest)).toBeInTheDocument();
16
16
  });
17
17
  });
@@ -1,23 +1,26 @@
1
- import { shallow } from 'enzyme';
1
+ import { render, screen } from '@testing-library/react';
2
2
  import React from 'react';
3
3
  import { ToolbarSidebar } from '../index.js';
4
4
  describe('<ToolbarSidebar/>', () => {
5
- it('renders children', () => {
5
+ test('renders children', () => {
6
6
  const childNode = 'text node';
7
- const wrapper = shallow(/*#__PURE__*/React.createElement(ToolbarSidebar, null, childNode));
8
- expect(wrapper.containsMatchingElement(childNode)).toBe(true);
7
+ render(/*#__PURE__*/React.createElement(ToolbarSidebar, null, childNode));
8
+ expect(screen.getByText(childNode)).toBeInTheDocument();
9
9
  });
10
- it('accepts a `dataTest` prop', () => {
10
+ test('accepts a `dataTest` prop', () => {
11
11
  const dataTest = 'test';
12
- const wrapper = shallow(/*#__PURE__*/React.createElement(ToolbarSidebar, {
12
+ render(/*#__PURE__*/React.createElement(ToolbarSidebar, {
13
13
  dataTest: dataTest
14
14
  }));
15
- expect(wrapper.prop('data-test')).toBe(dataTest);
15
+ expect(screen.getByTestId(dataTest)).toBeInTheDocument();
16
16
  });
17
- it('accepts a `isHidden` prop', () => {
18
- const wrapper = shallow(/*#__PURE__*/React.createElement(ToolbarSidebar, {
17
+ test('accepts a `isHidden` prop', () => {
18
+ const {
19
+ container
20
+ } = render(/*#__PURE__*/React.createElement(ToolbarSidebar, {
19
21
  isHidden: true
20
22
  }));
21
- expect(wrapper.find('div').hasClass('isHidden')).toEqual(true);
23
+ const divEl = container.querySelector('div');
24
+ expect(divEl).toHaveClass('isHidden');
22
25
  });
23
26
  });
@@ -1,36 +1,38 @@
1
- import { shallow } from 'enzyme';
1
+ import { render, screen } from '@testing-library/react';
2
+ import userEvent from '@testing-library/user-event';
2
3
  import React from 'react';
3
4
  import { UpdateButton } from '../index.js';
4
5
  describe('<UpdateButton/>', () => {
5
6
  const noop = () => {};
6
- it('accepts an `onClick` prop', () => {
7
+ test('accepts an `onClick` prop', async () => {
8
+ const user = userEvent.setup();
7
9
  const onClick = jest.fn();
8
- const wrapper = shallow(/*#__PURE__*/React.createElement(UpdateButton, {
10
+ render(/*#__PURE__*/React.createElement(UpdateButton, {
9
11
  onClick: onClick
10
12
  }));
11
- wrapper.simulate('click');
13
+ await user.click(screen.getByRole('button'));
12
14
  expect(onClick).toHaveBeenCalledTimes(1);
13
15
  });
14
- it('accepts a `dataTest` prop', () => {
16
+ test('accepts a `dataTest` prop', () => {
15
17
  const dataTest = 'test';
16
- const wrapper = shallow(/*#__PURE__*/React.createElement(UpdateButton, {
18
+ render(/*#__PURE__*/React.createElement(UpdateButton, {
17
19
  onClick: noop,
18
20
  dataTest: dataTest
19
21
  }));
20
- expect(wrapper.prop('data-test')).toBe(dataTest);
22
+ expect(screen.getByTestId(dataTest)).toBeInTheDocument();
21
23
  });
22
- it('accepts a `disabled` prop', () => {
23
- const wrapper = shallow(/*#__PURE__*/React.createElement(UpdateButton, {
24
+ test('accepts a `disabled` prop', () => {
25
+ render(/*#__PURE__*/React.createElement(UpdateButton, {
24
26
  disabled: true,
25
27
  onClick: noop
26
28
  }));
27
- expect(wrapper.find('button').prop('disabled')).toEqual(true);
29
+ expect(screen.getByRole('button')).toBeDisabled();
28
30
  });
29
- it('accepts an `loading` prop', () => {
30
- const wrapper = shallow(/*#__PURE__*/React.createElement(UpdateButton, {
31
+ test('accepts an `loading` prop', () => {
32
+ render(/*#__PURE__*/React.createElement(UpdateButton, {
31
33
  onClick: noop,
32
34
  loading: true
33
35
  }));
34
- expect(wrapper.find('CircularLoader')).toHaveLength(1);
36
+ expect(screen.getByTestId('dhis2-uicore-circularloader')).toBeInTheDocument();
35
37
  });
36
38
  });
@@ -4,21 +4,20 @@ import cx from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
6
  import styles from './styles/TransferOption.style.js';
7
- export const TransferOption = _ref => {
8
- let {
9
- disabled,
10
- label,
11
- highlighted,
12
- selected,
13
- onClick,
14
- onDoubleClick,
15
- value,
16
- icon,
17
- active,
18
- tooltipText,
19
- dataTest,
20
- onEditClick
21
- } = _ref;
7
+ export const TransferOption = ({
8
+ disabled,
9
+ label,
10
+ highlighted,
11
+ selected,
12
+ onClick,
13
+ onDoubleClick,
14
+ value,
15
+ icon,
16
+ active,
17
+ tooltipText,
18
+ dataTest,
19
+ onEditClick
20
+ }) => {
22
21
  const renderContent = () => /*#__PURE__*/React.createElement("div", {
23
22
  "data-test": `${dataTest}-content`,
24
23
  onClick: event => {
@@ -8,33 +8,28 @@ const query = {
8
8
  resource: 'locales/db'
9
9
  }
10
10
  };
11
- export const LocalesSelect = _ref => {
12
- let {
13
- onChange,
14
- selected
15
- } = _ref;
11
+ export const LocalesSelect = ({
12
+ onChange,
13
+ selected
14
+ }) => {
16
15
  const {
17
16
  data,
18
17
  fetching
19
18
  } = useDataQuery(query);
20
19
  return /*#__PURE__*/React.createElement(SingleSelect, {
21
20
  prefix: selected ? i18n.t('Translating to') : i18n.t('Choose a locale'),
22
- onChange: _ref2 => {
23
- let {
24
- selected
25
- } = _ref2;
26
- return onChange(selected);
27
- },
21
+ onChange: ({
22
+ selected
23
+ }) => onChange(selected),
28
24
  loading: fetching,
29
25
  selected: data && selected ? selected : '',
30
26
  dense: true
31
27
  }, data && data.locales
32
28
  // XXX remove duplicates ?! fr_SN - French (Senegal)
33
- .reduce((locales, _ref3) => {
34
- let {
35
- locale,
36
- name
37
- } = _ref3;
29
+ .reduce((locales, {
30
+ locale,
31
+ name
32
+ }) => {
38
33
  if (!locales.find(entry => entry.locale === locale)) {
39
34
  locales.push({
40
35
  locale,
@@ -42,17 +37,14 @@ export const LocalesSelect = _ref => {
42
37
  });
43
38
  }
44
39
  return locales;
45
- }, []).map(_ref4 => {
46
- let {
47
- locale,
48
- name
49
- } = _ref4;
50
- return /*#__PURE__*/React.createElement(SingleSelectOption, {
51
- key: locale,
52
- value: locale,
53
- label: name
54
- });
55
- }));
40
+ }, []).map(({
41
+ locale,
42
+ name
43
+ }) => /*#__PURE__*/React.createElement(SingleSelectOption, {
44
+ key: locale,
45
+ value: locale,
46
+ label: name
47
+ })));
56
48
  };
57
49
  LocalesSelect.propTypes = {
58
50
  onChange: PropTypes.func.isRequired,
@@ -7,15 +7,14 @@ import { LocalesSelect } from './LocalesSelect.js';
7
7
  import { TranslationModalActions } from './TranslationModalActions.js';
8
8
  const SESSION_STORAGE_TRANSLATION_LOCALE_KEY = 'translation-dialog-selected-locale';
9
9
  const camelCaseToUnderscores = field => field.replace(/[a-z][A-Z]/g, match => [match.charAt(0), match.charAt(1)].join('_')).toLowerCase();
10
- export const TranslationForm = _ref => {
11
- let {
12
- fieldsToTranslate,
13
- objectToTranslate,
14
- translations,
15
- resource,
16
- onTranslationSaved,
17
- onClose
18
- } = _ref;
10
+ export const TranslationForm = ({
11
+ fieldsToTranslate,
12
+ objectToTranslate,
13
+ translations,
14
+ resource,
15
+ onTranslationSaved,
16
+ onClose
17
+ }) => {
19
18
  const [newTranslations, setNewTranslations] = useState();
20
19
  const [translationLocale, setTranslationLocale] = useState();
21
20
  const [fieldsTranslations, setFieldsTranslations] = useState({});
@@ -68,14 +67,11 @@ export const TranslationForm = _ref => {
68
67
  const translationsMutationRef = useRef({
69
68
  resource: `${resource}/translations`,
70
69
  type: 'update',
71
- data: _ref2 => {
72
- let {
73
- translations
74
- } = _ref2;
75
- return {
76
- translations
77
- };
78
- }
70
+ data: ({
71
+ translations
72
+ }) => ({
73
+ translations
74
+ })
79
75
  });
80
76
  const [saveTranslations, {
81
77
  loading: saveInProgress
@@ -119,12 +115,9 @@ export const TranslationForm = _ref => {
119
115
  })), translationLocale && /*#__PURE__*/React.createElement(DataTableCell, null, /*#__PURE__*/React.createElement(TextAreaField, {
120
116
  label: fieldsTranslations[field],
121
117
  value: getTranslationForField(field),
122
- onChange: _ref3 => {
123
- let {
124
- value
125
- } = _ref3;
126
- return setTranslationForField(field, value);
127
- },
118
+ onChange: ({
119
+ value
120
+ }) => setTranslationForField(field, value),
128
121
  rows: 3
129
122
  })), !translationLocale && index === 0 && /*#__PURE__*/React.createElement(DataTableCell, {
130
123
  rowSpan: String(fieldsToTranslate.length)
@@ -5,13 +5,12 @@ import React, { useEffect, useState } from 'react';
5
5
  import { TranslationForm } from './TranslationForm.js';
6
6
  import { TranslationModalActions } from './TranslationModalActions.js';
7
7
  import { useTranslationsResults } from './useTranslationsResults.js';
8
- export const TranslationModal = _ref => {
9
- let {
10
- objectToTranslate,
11
- fieldsToTranslate,
12
- onClose,
13
- onTranslationSaved
14
- } = _ref;
8
+ export const TranslationModal = ({
9
+ objectToTranslate,
10
+ fieldsToTranslate,
11
+ onClose,
12
+ onTranslationSaved
13
+ }) => {
15
14
  const [translations, setTranslations] = useState([]);
16
15
  const endpointPath = new URL(objectToTranslate.href).pathname;
17
16
  const endpointPathMatch = endpointPath.match(/api\/(?:\d+\/)?(?<resource>.+)/);
@@ -30,7 +29,8 @@ export const TranslationModal = _ref => {
30
29
  return /*#__PURE__*/React.createElement(Modal, {
31
30
  large: true,
32
31
  position: "middle",
33
- onClose: onClose
32
+ onClose: onClose,
33
+ dataTest: "dhis2-analytics-translation-modal"
34
34
  }, /*#__PURE__*/React.createElement(ModalTitle, null, i18n.t('Translate: {{objectName}}', {
35
35
  objectName: objectToTranslate.name || 'TEXT',
36
36
  // XXX
@@ -4,36 +4,27 @@ import { Button, ButtonStrip, ModalActions } from '@dhis2/ui';
4
4
  import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
6
  import { OfflineTooltip } from '../../OfflineTooltip.js';
7
- const SaveButton = _ref => {
8
- let {
9
- disabled,
10
- loading,
11
- onClick
12
- } = _ref;
13
- return /*#__PURE__*/React.createElement(Button, {
14
- primary: true,
15
- onClick: onClick,
16
- loading: loading,
17
- disabled: disabled
18
- }, i18n.t('Save translations'));
19
- };
20
- SaveButton.defaultProps = {
21
- disabled: false,
22
- loading: false,
23
- onClick: Function.prototype
24
- };
7
+ const SaveButton = ({
8
+ disabled = false,
9
+ loading = false,
10
+ onClick = Function.prototype
11
+ }) => /*#__PURE__*/React.createElement(Button, {
12
+ primary: true,
13
+ onClick: onClick,
14
+ loading: loading,
15
+ disabled: disabled
16
+ }, i18n.t('Save translations'));
25
17
  SaveButton.propTypes = {
26
18
  disabled: PropTypes.bool.isRequired,
27
- loading: PropTypes.bool.isRequired,
28
- onClick: PropTypes.func.isRequired
19
+ onClick: PropTypes.func.isRequired,
20
+ loading: PropTypes.bool
29
21
  };
30
- export const TranslationModalActions = _ref2 => {
31
- let {
32
- onClose,
33
- onSave,
34
- saveInProgress,
35
- saveButtonDisabled
36
- } = _ref2;
22
+ export const TranslationModalActions = ({
23
+ onClose,
24
+ onSave = Function.prototype,
25
+ saveInProgress,
26
+ saveButtonDisabled
27
+ }) => {
37
28
  const {
38
29
  isDisconnected: offline
39
30
  } = useDhis2ConnectionStatus();
@@ -1,5 +1,5 @@
1
- import { ModalTitle, Modal } from '@dhis2/ui';
2
- import { shallow } from 'enzyme';
1
+ import { CustomDataProvider } from '@dhis2/app-runtime';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import React from 'react';
4
4
  import { TranslationModal } from '../TranslationModal.js';
5
5
  const mockUseTranslationResults = jest.fn(() => ({
@@ -9,19 +9,26 @@ const mockUseTranslationResults = jest.fn(() => ({
9
9
  jest.mock('../useTranslationsResults.js', () => ({
10
10
  useTranslationsResults: args => mockUseTranslationResults(args)
11
11
  }));
12
- describe('The Translation Dialog component', () => {
13
- let shallowTranslationModal;
12
+ describe('TranslationDialog component', () => {
14
13
  let props;
15
14
  const onClose = jest.fn();
16
15
  const onTranslationSaved = jest.fn();
17
- const getTranslationModalComponent = props => {
18
- if (!shallowTranslationModal) {
19
- shallowTranslationModal = shallow(/*#__PURE__*/React.createElement(TranslationModal, props));
20
- }
21
- return shallowTranslationModal;
16
+ const renderTranslationModalComponent = props => {
17
+ return render(/*#__PURE__*/React.createElement(CustomDataProvider, {
18
+ data: {
19
+ i18n: {
20
+ name: 'Name',
21
+ description: 'Description'
22
+ },
23
+ 'locales/db': [{
24
+ locale: 'en',
25
+ name: 'English',
26
+ displayName: 'English'
27
+ }]
28
+ }
29
+ }, /*#__PURE__*/React.createElement(TranslationModal, props)));
22
30
  };
23
31
  beforeEach(() => {
24
- shallowTranslationModal = undefined;
25
32
  props = {
26
33
  fieldsToTranslate: ['name', 'description'],
27
34
  objectToTranslate: {
@@ -32,15 +39,17 @@ describe('The Translation Dialog component', () => {
32
39
  onTranslationSaved
33
40
  };
34
41
  });
35
- it('renders a Modal component', () => {
36
- expect(getTranslationModalComponent(props).find(Modal)).toHaveLength(1);
42
+ test('renders a Modal component', () => {
43
+ renderTranslationModalComponent(props);
44
+ expect(screen.getByTestId('dhis2-analytics-translation-modal')).toBeInTheDocument();
37
45
  });
38
- it("renders a ModalTitle containing the object's name", () => {
39
- expect(getTranslationModalComponent(props).find(ModalTitle).childAt(0).text()).toEqual(`Translate: ${props.objectToTranslate.name}`);
46
+ test("renders a ModalTitle containing the object's name", () => {
47
+ renderTranslationModalComponent(props);
48
+ expect(screen.getByText(`Translate: ${props.objectToTranslate.name}`)).toBeInTheDocument();
40
49
  });
41
50
  test.each(['https://dhis2.tld/path/api/visualization/object-id', 'https://dhis2.tld/path/api/42/visualization/object-id'])('uses the correct resource for the translation endpoint', href => {
42
51
  props.objectToTranslate.href = href;
43
- getTranslationModalComponent(props);
52
+ renderTranslationModalComponent(props);
44
53
  expect(mockUseTranslationResults).toHaveBeenCalled();
45
54
  expect(mockUseTranslationResults).toHaveBeenCalledWith({
46
55
  resource: 'visualization/object-id'
@@ -1,10 +1,9 @@
1
1
  import { useAlert, useDataQuery } from '@dhis2/app-runtime';
2
2
  import i18n from '@dhis2/d2-i18n';
3
3
  import { useRef } from 'react';
4
- export const useTranslationsResults = _ref => {
5
- let {
6
- resource
7
- } = _ref;
4
+ export const useTranslationsResults = ({
5
+ resource
6
+ }) => {
8
7
  const translationsQueryRef = useRef({
9
8
  translations: {
10
9
  resource: `${resource}/translations`
@@ -2,13 +2,12 @@ import i18n from '@dhis2/d2-i18n';
2
2
  import { MenuItem } from '@dhis2/ui';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
- export const UserList = _ref => {
6
- let {
7
- users,
8
- selectedUserIndex,
9
- onUserClick,
10
- pager
11
- } = _ref;
5
+ export const UserList = ({
6
+ users,
7
+ selectedUserIndex,
8
+ onUserClick,
9
+ pager
10
+ }) => {
12
11
  return /*#__PURE__*/React.createElement(React.Fragment, null, users.map(u => {
13
12
  var _users$selectedUserIn;
14
13
  return /*#__PURE__*/React.createElement(MenuItem, {
@@ -23,12 +23,11 @@ const getVirtualPopperReference = ref => {
23
23
  })
24
24
  };
25
25
  };
26
- export const UserMentionWrapper = _ref => {
27
- let {
28
- children,
29
- inputReference,
30
- onUserSelect
31
- } = _ref;
26
+ export const UserMentionWrapper = ({
27
+ children,
28
+ inputReference,
29
+ onUserSelect = Function.prototype
30
+ }) => {
32
31
  const [listIsOpen, setListIsOpen] = useState(false);
33
32
  const [captureText, setCaptureText] = useState(false);
34
33
  const [capturedText, setCapturedText] = useState('');
@@ -61,10 +60,9 @@ export const UserMentionWrapper = _ref => {
61
60
  const onUserListClose = () => reset();
62
61
 
63
62
  // event bubbles up from the input/textarea
64
- const onInput = _ref2 => {
65
- let {
66
- target
67
- } = _ref2;
63
+ const onInput = ({
64
+ target
65
+ }) => {
68
66
  const {
69
67
  selectionEnd,
70
68
  value
@@ -83,11 +81,10 @@ export const UserMentionWrapper = _ref => {
83
81
  };
84
82
 
85
83
  // event bubbles up from the wrapped input/textarea
86
- const onKeyDown = _ref3 => {
87
- let {
88
- key,
89
- target
90
- } = _ref3;
84
+ const onKeyDown = ({
85
+ key,
86
+ target
87
+ }) => {
91
88
  const {
92
89
  selectionStart
93
90
  } = target;
@@ -187,9 +184,6 @@ export const UserMentionWrapper = _ref => {
187
184
  id: userMentionWrapperClasses.__hash
188
185
  }, userMentionWrapperClasses), resolvedHeaderStyle.styles);
189
186
  };
190
- UserMentionWrapper.defaultProps = {
191
- onUserSelect: Function.prototype
192
- };
193
187
  UserMentionWrapper.propTypes = {
194
188
  inputReference: PropTypes.object.isRequired,
195
189
  onUserSelect: PropTypes.func.isRequired,
@@ -4,24 +4,20 @@ import { useCallback, useEffect, useState } from 'react';
4
4
  const usersQuery = {
5
5
  users: {
6
6
  resource: 'users/gist',
7
- params: _ref => {
8
- let {
9
- searchText
10
- } = _ref;
11
- return {
12
- fields: 'id,displayName,username',
13
- order: 'firstName,surname',
14
- total: true,
15
- filter: `username:ilike:${searchText},firstName:ilike:${searchText},surname:ilike:${searchText},email:ilike:${searchText}`,
16
- rootJunction: 'OR'
17
- };
18
- }
7
+ params: ({
8
+ searchText
9
+ }) => ({
10
+ fields: 'id,displayName,username',
11
+ order: 'firstName,surname',
12
+ total: true,
13
+ filter: `username:ilike:${searchText},firstName:ilike:${searchText},surname:ilike:${searchText},email:ilike:${searchText}`,
14
+ rootJunction: 'OR'
15
+ })
19
16
  }
20
17
  };
21
- export const useUserSearchResults = _ref2 => {
22
- let {
23
- searchText
24
- } = _ref2;
18
+ export const useUserSearchResults = ({
19
+ searchText
20
+ }) => {
25
21
  const [{
26
22
  users,
27
23
  pager
@@ -2,12 +2,11 @@ import { IconVisualizationArea16, IconVisualizationAreaStacked16, IconVisualizat
2
2
  import PropTypes from 'prop-types';
3
3
  import React from 'react';
4
4
  import { VIS_TYPE_LINE_LIST, VIS_TYPE_PIVOT_TABLE, VIS_TYPE_COLUMN, VIS_TYPE_STACKED_COLUMN, VIS_TYPE_BAR, VIS_TYPE_STACKED_BAR, VIS_TYPE_LINE, VIS_TYPE_AREA, VIS_TYPE_STACKED_AREA, VIS_TYPE_PIE, VIS_TYPE_RADAR, VIS_TYPE_GAUGE, VIS_TYPE_YEAR_OVER_YEAR_LINE, VIS_TYPE_YEAR_OVER_YEAR_COLUMN, VIS_TYPE_SINGLE_VALUE, VIS_TYPE_SCATTER, VIS_TYPE_OUTLIER_TABLE } from '../modules/visTypes.js';
5
- export const VisTypeIcon = _ref => {
6
- let {
7
- type,
8
- useSmall = false,
9
- ...props
10
- } = _ref;
5
+ export const VisTypeIcon = ({
6
+ type,
7
+ useSmall = false,
8
+ ...props
9
+ }) => {
11
10
  let VisIcon;
12
11
  switch (type) {
13
12
  case VIS_TYPE_LINE_LIST: