@hisptz/dhis2-analytics 1.0.4 → 1.0.6

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 (293) hide show
  1. package/build/cjs/components/ChartAnalytics/ChartAnalytics.stories.js +253 -0
  2. package/build/cjs/components/ChartAnalytics/ChartAnalytics.test.js +51 -0
  3. package/build/cjs/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +48 -0
  4. package/build/cjs/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +34 -0
  5. package/build/cjs/components/ChartAnalytics/components/DownloadMenu/index.js +67 -0
  6. package/build/cjs/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
  7. package/{src → build/cjs}/components/ChartAnalytics/data/column-data.json +0 -0
  8. package/{src → build/cjs}/components/ChartAnalytics/data/complex-multi-series-data.json +0 -0
  9. package/{src → build/cjs}/components/ChartAnalytics/data/multi-series-data.json +0 -0
  10. package/{src → build/cjs}/components/ChartAnalytics/data/pie-data.json +0 -0
  11. package/{src → build/cjs}/components/ChartAnalytics/data/stacked-chart-data.json +0 -0
  12. package/build/cjs/components/ChartAnalytics/hooks/useChart.js +38 -0
  13. package/build/cjs/components/ChartAnalytics/index.js +69 -0
  14. package/build/cjs/components/ChartAnalytics/models/column.js +53 -0
  15. package/build/cjs/components/ChartAnalytics/models/index.js +102 -0
  16. package/build/cjs/components/ChartAnalytics/models/line.js +35 -0
  17. package/build/cjs/components/ChartAnalytics/models/multi-series.js +111 -0
  18. package/build/cjs/components/ChartAnalytics/models/pie.js +53 -0
  19. package/build/cjs/components/ChartAnalytics/services/export.js +50 -0
  20. package/{src → build/cjs}/components/ChartAnalytics/styles/custom-highchart.css +0 -0
  21. package/build/cjs/components/ChartAnalytics/types/props.js +1 -0
  22. package/build/cjs/components/ChartAnalytics/utils/chart.js +133 -0
  23. package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.stories.js +45 -0
  24. package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.test.js +13 -0
  25. package/build/cjs/components/CircularProgressDashboard/index.js +49 -0
  26. package/build/cjs/components/CircularProgressDashboard/types/props.js +1 -0
  27. package/build/cjs/components/Map/Map.stories.js +352 -0
  28. package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +32 -0
  29. package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +40 -0
  30. package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/index.js +458 -0
  31. package/build/cjs/components/Map/components/MapArea/index.js +101 -0
  32. package/build/cjs/components/Map/components/MapArea/interfaces/index.js +1 -0
  33. package/build/cjs/components/Map/components/MapControls/components/CustomControl/index.js +32 -0
  34. package/build/cjs/components/Map/components/MapControls/components/DownloadControl/index.js +25 -0
  35. package/build/cjs/components/Map/components/MapControls/components/FullscreenControl/index.js +13 -0
  36. package/build/cjs/components/Map/components/MapControls/index.js +42 -0
  37. package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +13 -0
  38. package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/index.js +51 -0
  39. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +106 -0
  40. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +379 -0
  41. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +36 -0
  42. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +200 -0
  43. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
  44. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +10 -0
  45. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +412 -0
  46. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +124 -0
  47. package/{src → build/cjs}/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +0 -0
  48. package/build/cjs/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +26 -0
  49. package/build/cjs/components/Map/components/MapLayer/components/LegendArea/index.js +181 -0
  50. package/build/cjs/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +86 -0
  51. package/build/cjs/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +14 -0
  52. package/build/cjs/components/Map/components/MapLayer/components/PointLayer/index.js +46 -0
  53. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +57 -0
  54. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js +145 -0
  55. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +43 -0
  56. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +56 -0
  57. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +61 -0
  58. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +43 -0
  59. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +35 -0
  60. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +15 -0
  61. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/index.js +57 -0
  62. package/{src → build/cjs}/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +0 -0
  63. package/build/cjs/components/Map/components/MapLayer/index.js +40 -0
  64. package/build/cjs/components/Map/components/MapLayer/interfaces/index.js +8 -0
  65. package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +389 -0
  66. package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/index.js +116 -0
  67. package/build/cjs/components/Map/components/MapProvider/hooks/index.js +19 -0
  68. package/build/cjs/components/Map/components/MapProvider/index.js +121 -0
  69. package/build/cjs/components/Map/components/MapUpdater/index.js +24 -0
  70. package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +32 -0
  71. package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +40 -0
  72. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +40 -0
  73. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js +428 -0
  74. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +63 -0
  75. package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +0 -0
  76. package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +0 -0
  77. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +72 -0
  78. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +71 -0
  79. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +47 -0
  80. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +79 -0
  81. package/build/cjs/components/Map/components/ThematicLayerConfiguration/index.js +265 -0
  82. package/build/cjs/components/Map/constants/colors.js +428 -0
  83. package/build/cjs/components/Map/constants/legendSet.js +22 -0
  84. package/build/cjs/components/Map/hooks/map.js +52 -0
  85. package/build/cjs/components/Map/index.js +108 -0
  86. package/build/cjs/components/Map/interfaces/index.js +1 -0
  87. package/build/cjs/components/Map/state/index.js +23 -0
  88. package/build/cjs/components/Map/utils/colors.js +78 -0
  89. package/build/cjs/components/Map/utils/helpers.js +25 -0
  90. package/build/cjs/components/Map/utils/map.js +161 -0
  91. package/build/cjs/components/SingleValueContainer/SingleValueContainer.stories.js +127 -0
  92. package/build/cjs/components/SingleValueContainer/SingleValueContainer.test.js +23 -0
  93. package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +54 -0
  94. package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +24 -0
  95. package/build/cjs/components/SingleValueContainer/index.js +43 -0
  96. package/{src → build/cjs}/components/SingleValueContainer/styles/SingleValueContainer.module.css +0 -0
  97. package/build/cjs/components/SingleValueContainer/types/props.js +1 -0
  98. package/{src → build/cjs}/data/map.json +0 -0
  99. package/build/cjs/dataProviders/map.js +31 -0
  100. package/build/cjs/index.js +49 -0
  101. package/build/cjs/index.test.js +7 -0
  102. package/build/cjs/locales/en/translations.json +128 -0
  103. package/build/cjs/locales/index.js +22 -0
  104. package/build/es/components/ChartAnalytics/ChartAnalytics.stories.js +235 -0
  105. package/build/es/components/ChartAnalytics/ChartAnalytics.test.js +46 -0
  106. package/build/es/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +41 -0
  107. package/build/es/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +26 -0
  108. package/build/es/components/ChartAnalytics/components/DownloadMenu/index.js +58 -0
  109. package/build/es/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
  110. package/build/es/components/ChartAnalytics/data/column-data.json +210 -0
  111. package/build/es/components/ChartAnalytics/data/complex-multi-series-data.json +124 -0
  112. package/build/es/components/ChartAnalytics/data/multi-series-data.json +536 -0
  113. package/build/es/components/ChartAnalytics/data/pie-data.json +115 -0
  114. package/build/es/components/ChartAnalytics/data/stacked-chart-data.json +415 -0
  115. package/build/es/components/ChartAnalytics/hooks/useChart.js +32 -0
  116. package/build/es/components/ChartAnalytics/index.js +40 -0
  117. package/build/es/components/ChartAnalytics/models/column.js +45 -0
  118. package/build/es/components/ChartAnalytics/models/index.js +95 -0
  119. package/build/es/components/ChartAnalytics/models/line.js +28 -0
  120. package/build/es/components/ChartAnalytics/models/multi-series.js +104 -0
  121. package/build/es/components/ChartAnalytics/models/pie.js +46 -0
  122. package/build/es/components/ChartAnalytics/services/export.js +36 -0
  123. package/build/es/components/ChartAnalytics/styles/custom-highchart.css +48 -0
  124. package/build/es/components/ChartAnalytics/types/props.js +1 -0
  125. package/build/es/components/ChartAnalytics/utils/chart.js +122 -0
  126. package/{src/components/CircularProgressDashboard/CircularProgressIndicator.stories.tsx → build/es/components/CircularProgressDashboard/CircularProgressIndicator.stories.js} +9 -16
  127. package/build/es/components/CircularProgressDashboard/CircularProgressIndicator.test.js +10 -0
  128. package/build/es/components/CircularProgressDashboard/index.js +41 -0
  129. package/build/es/components/CircularProgressDashboard/types/props.js +1 -0
  130. package/build/es/components/Map/Map.stories.js +334 -0
  131. package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +23 -0
  132. package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +31 -0
  133. package/build/es/components/Map/components/EarthEngineLayerConfiguration/index.js +448 -0
  134. package/build/es/components/Map/components/MapArea/index.js +91 -0
  135. package/build/es/components/Map/components/MapArea/interfaces/index.js +1 -0
  136. package/build/es/components/Map/components/MapControls/components/CustomControl/index.js +25 -0
  137. package/build/es/components/Map/components/MapControls/components/DownloadControl/index.js +18 -0
  138. package/build/es/components/Map/components/MapControls/components/FullscreenControl/index.js +6 -0
  139. package/build/es/components/Map/components/MapControls/index.js +35 -0
  140. package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +7 -0
  141. package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/index.js +41 -0
  142. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +95 -0
  143. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +369 -0
  144. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +29 -0
  145. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +191 -0
  146. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
  147. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +10 -0
  148. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +403 -0
  149. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +111 -0
  150. package/build/es/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +12 -0
  151. package/build/es/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +19 -0
  152. package/build/es/components/Map/components/MapLayer/components/LegendArea/index.js +172 -0
  153. package/build/es/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +76 -0
  154. package/build/es/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +8 -0
  155. package/build/es/components/Map/components/MapLayer/components/PointLayer/index.js +39 -0
  156. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +49 -0
  157. package/{src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.tsx → build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js} +57 -74
  158. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +33 -0
  159. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +47 -0
  160. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +50 -0
  161. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +36 -0
  162. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +28 -0
  163. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +9 -0
  164. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/index.js +50 -0
  165. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +62 -0
  166. package/build/es/components/Map/components/MapLayer/index.js +33 -0
  167. package/build/es/components/Map/components/MapLayer/interfaces/index.js +1 -0
  168. package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +381 -0
  169. package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/index.js +107 -0
  170. package/{src/components/Map/components/MapProvider/hooks/index.ts → build/es/components/Map/components/MapProvider/hooks/index.js} +3 -6
  171. package/build/es/components/Map/components/MapProvider/index.js +112 -0
  172. package/build/es/components/Map/components/MapUpdater/index.js +17 -0
  173. package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +23 -0
  174. package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +31 -0
  175. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +33 -0
  176. package/{src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.ts → build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js} +46 -59
  177. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +53 -0
  178. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +15 -0
  179. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +12 -0
  180. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +56 -0
  181. package/build/es/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +64 -0
  182. package/build/es/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +38 -0
  183. package/build/es/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +70 -0
  184. package/build/es/components/Map/components/ThematicLayerConfiguration/index.js +254 -0
  185. package/{src/components/Map/constants/colors.ts → build/es/components/Map/constants/colors.js} +46 -59
  186. package/build/es/components/Map/constants/legendSet.js +15 -0
  187. package/build/es/components/Map/hooks/map.js +44 -0
  188. package/build/es/components/Map/index.js +51 -0
  189. package/build/es/components/Map/interfaces/index.js +1 -0
  190. package/build/es/components/Map/state/index.js +14 -0
  191. package/build/es/components/Map/utils/colors.js +61 -0
  192. package/build/es/components/Map/utils/helpers.js +14 -0
  193. package/build/es/components/Map/utils/map.js +147 -0
  194. package/build/es/components/SingleValueContainer/SingleValueContainer.stories.js +115 -0
  195. package/build/es/components/SingleValueContainer/SingleValueContainer.test.js +20 -0
  196. package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +47 -0
  197. package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +17 -0
  198. package/build/es/components/SingleValueContainer/index.js +29 -0
  199. package/build/es/components/SingleValueContainer/styles/SingleValueContainer.module.css +39 -0
  200. package/build/es/components/SingleValueContainer/types/props.js +1 -0
  201. package/build/es/data/map.json +5984 -0
  202. package/build/es/dataProviders/map.js +24 -0
  203. package/{src/index.ts → build/es/index.js} +1 -0
  204. package/build/es/index.test.js +6 -0
  205. package/build/es/locales/en/translations.json +128 -0
  206. package/build/es/locales/index.js +13 -0
  207. package/package.json +21 -4
  208. package/d2.config.js +0 -8
  209. package/i18n/en.pot +0 -409
  210. package/src/components/ChartAnalytics/ChartAnalytics.stories.tsx +0 -250
  211. package/src/components/ChartAnalytics/ChartAnalytics.test.tsx +0 -51
  212. package/src/components/ChartAnalytics/components/DownloadMenu/components/Menu.tsx +0 -48
  213. package/src/components/ChartAnalytics/components/DownloadMenu/constants/menu.ts +0 -38
  214. package/src/components/ChartAnalytics/components/DownloadMenu/index.tsx +0 -67
  215. package/src/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.ts +0 -1
  216. package/src/components/ChartAnalytics/hooks/useChart.ts +0 -35
  217. package/src/components/ChartAnalytics/index.tsx +0 -23
  218. package/src/components/ChartAnalytics/models/column.ts +0 -50
  219. package/src/components/ChartAnalytics/models/index.ts +0 -78
  220. package/src/components/ChartAnalytics/models/line.ts +0 -31
  221. package/src/components/ChartAnalytics/models/multi-series.ts +0 -115
  222. package/src/components/ChartAnalytics/models/pie.ts +0 -54
  223. package/src/components/ChartAnalytics/services/export.ts +0 -38
  224. package/src/components/ChartAnalytics/types/props.tsx +0 -48
  225. package/src/components/ChartAnalytics/utils/chart.ts +0 -123
  226. package/src/components/CircularProgressDashboard/CircularProgressIndicator.test.tsx +0 -9
  227. package/src/components/CircularProgressDashboard/index.tsx +0 -35
  228. package/src/components/CircularProgressDashboard/types/props.tsx +0 -17
  229. package/src/components/Map/Map.stories.tsx +0 -339
  230. package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.tsx +0 -28
  231. package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.tsx +0 -34
  232. package/src/components/Map/components/EarthEngineLayerConfiguration/index.tsx +0 -412
  233. package/src/components/Map/components/MapArea/index.tsx +0 -83
  234. package/src/components/Map/components/MapArea/interfaces/index.ts +0 -39
  235. package/src/components/Map/components/MapControls/components/CustomControl/index.tsx +0 -24
  236. package/src/components/Map/components/MapControls/components/DownloadControl/index.tsx +0 -10
  237. package/src/components/Map/components/MapControls/components/FullscreenControl/index.tsx +0 -7
  238. package/src/components/Map/components/MapControls/index.tsx +0 -24
  239. package/src/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.ts +0 -7
  240. package/src/components/Map/components/MapLayer/components/BoundaryLayer/index.tsx +0 -55
  241. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.tsx +0 -76
  242. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.ts +0 -430
  243. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.ts +0 -34
  244. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/index.tsx +0 -185
  245. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.ts +0 -56
  246. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +0 -34233
  247. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.ts +0 -423
  248. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.ts +0 -105
  249. package/src/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.tsx +0 -17
  250. package/src/components/Map/components/MapLayer/components/LegendArea/index.tsx +0 -168
  251. package/src/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.tsx +0 -44
  252. package/src/components/Map/components/MapLayer/components/PointLayer/hooks/index.ts +0 -8
  253. package/src/components/Map/components/MapLayer/components/PointLayer/index.tsx +0 -36
  254. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.tsx +0 -48
  255. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.tsx +0 -39
  256. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.tsx +0 -57
  257. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.tsx +0 -43
  258. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.tsx +0 -38
  259. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.tsx +0 -26
  260. package/src/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.ts +0 -10
  261. package/src/components/Map/components/MapLayer/components/ThematicLayer/index.tsx +0 -46
  262. package/src/components/Map/components/MapLayer/index.tsx +0 -32
  263. package/src/components/Map/components/MapLayer/interfaces/index.ts +0 -139
  264. package/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx +0 -359
  265. package/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx +0 -105
  266. package/src/components/Map/components/MapProvider/index.tsx +0 -93
  267. package/src/components/Map/components/MapUpdater/index.tsx +0 -8
  268. package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.tsx +0 -28
  269. package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.tsx +0 -34
  270. package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.tsx +0 -24
  271. package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.tsx +0 -50
  272. package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.ts +0 -91
  273. package/src/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.tsx +0 -45
  274. package/src/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.tsx +0 -47
  275. package/src/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.tsx +0 -57
  276. package/src/components/Map/components/ThematicLayerConfiguration/index.tsx +0 -248
  277. package/src/components/Map/constants/legendSet.ts +0 -19
  278. package/src/components/Map/hooks/map.ts +0 -47
  279. package/src/components/Map/index.tsx +0 -65
  280. package/src/components/Map/interfaces/index.ts +0 -57
  281. package/src/components/Map/state/index.tsx +0 -31
  282. package/src/components/Map/utils/colors.ts +0 -95
  283. package/src/components/Map/utils/helpers.ts +0 -15
  284. package/src/components/Map/utils/map.ts +0 -150
  285. package/src/components/SingleValueContainer/SingleValueContainer.stories.tsx +0 -146
  286. package/src/components/SingleValueContainer/SingleValueContainer.test.tsx +0 -24
  287. package/src/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.tsx +0 -46
  288. package/src/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.tsx +0 -12
  289. package/src/components/SingleValueContainer/index.tsx +0 -30
  290. package/src/components/SingleValueContainer/types/props.tsx +0 -16
  291. package/src/dataProviders/map.tsx +0 -24
  292. package/src/index.test.ts +0 -7
  293. package/tsconfig.json +0 -45
@@ -0,0 +1,128 @@
1
+ {
2
+ "Download PNG": "Download PNG",
3
+ "Download JPEG": "Download JPEG",
4
+ "Download SVG": "Download SVG",
5
+ "Download PDF": "Download PDF",
6
+ "View as table": "View as table",
7
+ "View full screen": "View full screen",
8
+ "Submit": "Submit",
9
+ "Aggregation": "Aggregation",
10
+ "Aggregations": "Aggregations",
11
+ "Period is required": "Period is required",
12
+ "Available periods are set by the source data": "Available periods are set by the source data",
13
+ "Period": "Period",
14
+ "Min": "Min",
15
+ "Max": "Max",
16
+ "Steps": "Steps",
17
+ "Colors": "Colors",
18
+ "Unit": "Unit",
19
+ "Name is required": "Name is required",
20
+ "Layer name": "Layer name",
21
+ "Type is required": "Type is required",
22
+ "Layer type": "Layer type",
23
+ "Configure Earth Engine Layer": "Configure Earth Engine Layer",
24
+ "Cancel": "Cancel",
25
+ "Save": "Save",
26
+ "Boundaries": "Boundaries",
27
+ "Source": "Source",
28
+ "Population": "Population",
29
+ "people per hectare": "people per hectare",
30
+ "Estimated number of people living in an area.": "Estimated number of people living in an area.",
31
+ "Population age groups": "Population age groups",
32
+ "Estimated number of people living in an area, grouped by age and gender.": "Estimated number of people living in an area, grouped by age and gender.",
33
+ "Male 0 - 1 years": "Male 0 - 1 years",
34
+ "Male 1 - 4 years": "Male 1 - 4 years",
35
+ "Male 5 - 9 years": "Male 5 - 9 years",
36
+ "Male 10 - 14 years": "Male 10 - 14 years",
37
+ "Male 15 - 19 years": "Male 15 - 19 years",
38
+ "Male 20 - 24 years": "Male 20 - 24 years",
39
+ "Male 25 - 29 years": "Male 25 - 29 years",
40
+ "Male 30 - 34 years": "Male 30 - 34 years",
41
+ "Male 35 - 39 years": "Male 35 - 39 years",
42
+ "Male 40 - 44 years": "Male 40 - 44 years",
43
+ "Male 45 - 49 years": "Male 45 - 49 years",
44
+ "Male 50 - 54 years": "Male 50 - 54 years",
45
+ "Male 55 - 59 years": "Male 55 - 59 years",
46
+ "Male 60 - 64 years": "Male 60 - 64 years",
47
+ "Male 65 - 69 years": "Male 65 - 69 years",
48
+ "Male 70 - 74 years": "Male 70 - 74 years",
49
+ "Male 75 - 79 years": "Male 75 - 79 years",
50
+ "Male 80 years and above": "Male 80 years and above",
51
+ "Female 0 - 1 years": "Female 0 - 1 years",
52
+ "Female 1 - 4 years": "Female 1 - 4 years",
53
+ "Female 5 - 9 years": "Female 5 - 9 years",
54
+ "Female 10 - 14 years": "Female 10 - 14 years",
55
+ "Female 15 - 19 years": "Female 15 - 19 years",
56
+ "Female 20 - 24 years": "Female 20 - 24 years",
57
+ "Female 25 - 29 years": "Female 25 - 29 years",
58
+ "Female 30 - 34 years": "Female 30 - 34 years",
59
+ "Female 35 - 39 years": "Female 35 - 39 years",
60
+ "Female 40 - 44 years": "Female 40 - 44 years",
61
+ "Female 45 - 49 years": "Female 45 - 49 years",
62
+ "Female 50 - 54 years": "Female 50 - 54 years",
63
+ "Female 55 - 59 years": "Female 55 - 59 years",
64
+ "Female 60 - 64 years": "Female 60 - 64 years",
65
+ "Female 65 - 69 years": "Female 65 - 69 years",
66
+ "Female 70 - 74 years": "Female 70 - 74 years",
67
+ "Female 75 - 79 years": "Female 75 - 79 years",
68
+ "Female 80 years and above": "Female 80 years and above",
69
+ "Building footprints": "Building footprints",
70
+ "Number of buildings": "Number of buildings",
71
+ "The outlines of buildings derived from high-resolution satellite imagery. Only for the continent of Africa.": "The outlines of buildings derived from high-resolution satellite imagery. Only for the continent of Africa.",
72
+ "Building counts are only available for smaller organisation unit areas.": "Building counts are only available for smaller organisation unit areas.",
73
+ "Select a smaller area or single organization unit to see the count of buildings.": "Select a smaller area or single organization unit to see the count of buildings.",
74
+ "Elevation": "Elevation",
75
+ "meters": "meters",
76
+ "Elevation above sea-level.": "Elevation above sea-level.",
77
+ "Precipitation": "Precipitation",
78
+ "millimeter": "millimeter",
79
+ "Precipitation collected from satellite and weather stations on the ground. The values are in millimeters within 5 days periods. Updated monthly, during the 3rd week of the following month.": "Precipitation collected from satellite and weather stations on the ground. The values are in millimeters within 5 days periods. Updated monthly, during the 3rd week of the following month.",
80
+ "Temperature": "Temperature",
81
+ "°C during daytime": "°C during daytime",
82
+ "Land surface temperatures collected from satellite. Blank spots will appear in areas with a persistent cloud cover.": "Land surface temperatures collected from satellite. Blank spots will appear in areas with a persistent cloud cover.",
83
+ "Landcover": "Landcover",
84
+ "Distinct landcover types collected from satellites.": "Distinct landcover types collected from satellites.",
85
+ "Evergreen Needleleaf forest": "Evergreen Needleleaf forest",
86
+ "Evergreen Broadleaf forest": "Evergreen Broadleaf forest",
87
+ "Deciduous Needleleaf forest": "Deciduous Needleleaf forest",
88
+ "Deciduous Broadleaf forest": "Deciduous Broadleaf forest",
89
+ "Mixed forest": "Mixed forest",
90
+ "Closed shrublands": "Closed shrublands",
91
+ "Open shrublands": "Open shrublands",
92
+ "Woody savannas": "Woody savannas",
93
+ "Savannas": "Savannas",
94
+ "Grasslands": "Grasslands",
95
+ "Permanent wetlands": "Permanent wetlands",
96
+ "Croplands": "Croplands",
97
+ "Urban and built-up": "Urban and built-up",
98
+ "Cropland/Natural vegetation mosaic": "Cropland/Natural vegetation mosaic",
99
+ "Snow and ice": "Snow and ice",
100
+ "Barren or sparsely vegetated": "Barren or sparsely vegetated",
101
+ "Water": "Water",
102
+ "Nighttime lights": "Nighttime lights",
103
+ "light intensity": "light intensity",
104
+ "Light intensity from cities, towns, and other sites with persistent lighting, including gas flares.": "Light intensity from cities, towns, and other sites with persistent lighting, including gas flares.",
105
+ "Could not get aggregate data": "Could not get aggregate data",
106
+ "Points": "Points",
107
+ "Mid": "Mid",
108
+ "Value": "Value",
109
+ "Error": "Error",
110
+ "Classes": "Classes",
111
+ "Select Data Item": "Select Data Item",
112
+ "Update": "Update",
113
+ "Legend set": "Legend set",
114
+ "Please wait...": "Please wait...",
115
+ "Layer type is required": "Layer type is required",
116
+ "Choropleth": "Choropleth",
117
+ "Bubble": "Bubble",
118
+ "A data item is required": "A data item is required",
119
+ "Data Item": "Data Item",
120
+ "Change": "Change",
121
+ "Select": "Select",
122
+ "Legend": "Legend",
123
+ "Custom legend": "Custom legend",
124
+ "Legend set is required": "Legend set is required",
125
+ "Radius": "Radius",
126
+ "Configure Thematic Layer": "Configure Thematic Layer",
127
+ "Loading ...": "Loading ..."
128
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
8
+ var _translations = _interopRequireDefault(require("./en/translations.json"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ //------------------------------------------------------------------------------
11
+ // <auto-generated>
12
+ // This code was generated by d2-i18n-generate.
13
+ //
14
+ // Changes to this file may cause incorrect behavior and will be lost if
15
+ // the code is regenerated.
16
+ // </auto-generated>
17
+ //------------------------------------------------------------------------------
18
+
19
+ const namespace = 'default';
20
+ _d2I18n.default.addResources('en', namespace, _translations.default);
21
+ var _default = _d2I18n.default;
22
+ exports.default = _default;
@@ -0,0 +1,235 @@
1
+ import { CssReset } from "@dhis2/ui";
2
+ import HighCharts from "highcharts";
3
+ import React, { useState } from "react";
4
+ import ChartDownloadMenu from "./components/DownloadMenu";
5
+ import columnData from "./data/column-data.json";
6
+ import complexMultiSeriesData from "./data/complex-multi-series-data.json";
7
+ import multiSeriesData from "./data/multi-series-data.json";
8
+ import pieData from "./data/pie-data.json";
9
+ import stackedChartData from "./data/stacked-chart-data.json";
10
+ import { setupHighchartsModules } from "./services/export";
11
+ import ChartAnalytics from ".";
12
+ const Template = args => /*#__PURE__*/React.createElement(ChartAnalytics, args);
13
+ setupHighchartsModules(HighCharts);
14
+ export const Column = Template.bind({});
15
+ Column.args = {
16
+ analytics: columnData,
17
+ config: {
18
+ layout: {
19
+ series: ["dx"],
20
+ category: ["ou"],
21
+ filter: ["pe"]
22
+ },
23
+ type: "column",
24
+ height: 500,
25
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"]
26
+ }
27
+ };
28
+ export const MultipleColumns = Template.bind({});
29
+ MultipleColumns.args = {
30
+ analytics: multiSeriesData,
31
+ config: {
32
+ layout: {
33
+ series: ["ou"],
34
+ category: ["pe"],
35
+ filter: ["dx"]
36
+ },
37
+ type: "column",
38
+ height: 1000,
39
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"]
40
+ }
41
+ };
42
+ export const StackedColumn = Template.bind({});
43
+ StackedColumn.args = {
44
+ analytics: stackedChartData,
45
+ config: {
46
+ layout: {
47
+ series: ["ou"],
48
+ category: ["pe"],
49
+ filter: ["dx"]
50
+ },
51
+ type: "stacked-column",
52
+ height: 1000,
53
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"]
54
+ }
55
+ };
56
+ export const Line = Template.bind({});
57
+ Line.args = {
58
+ analytics: columnData,
59
+ config: {
60
+ layout: {
61
+ series: ["dx"],
62
+ category: ["ou"],
63
+ filter: ["pe"]
64
+ },
65
+ type: "line",
66
+ height: 1000,
67
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"]
68
+ }
69
+ };
70
+ export const MultipleLines = Template.bind({});
71
+ MultipleLines.args = {
72
+ analytics: multiSeriesData,
73
+ config: {
74
+ layout: {
75
+ series: ["ou"],
76
+ category: ["pe"],
77
+ filter: ["dx"]
78
+ },
79
+ type: "line",
80
+ height: 500,
81
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"]
82
+ }
83
+ };
84
+ export const PieChart = Template.bind({});
85
+ PieChart.args = {
86
+ analytics: pieData,
87
+ config: {
88
+ layout: {
89
+ series: ["dx"],
90
+ category: [],
91
+ filter: ["dx", "pe"]
92
+ },
93
+ type: "pie",
94
+ height: 500,
95
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c4255", "#a6c96a"]
96
+ }
97
+ };
98
+ export const MultiSeries = Template.bind({});
99
+ MultiSeries.args = {
100
+ analytics: multiSeriesData,
101
+ config: {
102
+ layout: {
103
+ series: ["ou"],
104
+ category: ["pe"],
105
+ filter: ["dx"]
106
+ },
107
+ type: "multi-series",
108
+ height: 500,
109
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
110
+ multiSeries: {
111
+ series: [{
112
+ id: "qhqAxPSTUXp",
113
+ as: "column",
114
+ yAxis: 0
115
+ }, {
116
+ id: "Vth0fbpFcsO",
117
+ as: "line",
118
+ cumulative: true,
119
+ yAxis: 1
120
+ }],
121
+ yAxes: [{
122
+ id: "yAxis1",
123
+ title: {
124
+ text: "Koinandugu"
125
+ },
126
+ labels: {
127
+ format: "{value}"
128
+ }
129
+ }, {
130
+ id: "yAxis2",
131
+ title: {
132
+ text: "Kono"
133
+ },
134
+ labels: {
135
+ format: "{value}"
136
+ },
137
+ opposite: true
138
+ }],
139
+ target: {
140
+ id: "",
141
+ styles: {
142
+ color: "blue"
143
+ },
144
+ value: 45,
145
+ label: {
146
+ text: "Target",
147
+ textAlign: "center",
148
+ verticalAlign: "middle"
149
+ }
150
+ }
151
+ }
152
+ }
153
+ };
154
+ export const ComplexMultiSeries = Template.bind({});
155
+ ComplexMultiSeries.args = {
156
+ analytics: complexMultiSeriesData,
157
+ config: {
158
+ layout: {
159
+ series: ["dx"],
160
+ category: ["pe"],
161
+ filter: ["ou"]
162
+ },
163
+ type: "multi-series",
164
+ height: 500,
165
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
166
+ multiSeries: {
167
+ series: [{
168
+ id: "QQkOAJFukyY",
169
+ as: "column",
170
+ yAxis: 0
171
+ }, {
172
+ id: "QQkOAJFukyY",
173
+ as: "line",
174
+ cumulative: true,
175
+ yAxis: 1
176
+ }],
177
+ yAxes: [{
178
+ id: "yAxis1",
179
+ title: {
180
+ text: "Koinandugu"
181
+ },
182
+ labels: {
183
+ format: "{value}"
184
+ }
185
+ }, {
186
+ id: "yAxis2",
187
+ title: {
188
+ text: "Kono"
189
+ },
190
+ labels: {
191
+ format: "{value}"
192
+ },
193
+ opposite: true
194
+ }],
195
+ target: {
196
+ id: "",
197
+ styles: {
198
+ color: "blue"
199
+ },
200
+ value: 45,
201
+ label: {
202
+ text: "Target",
203
+ textAlign: "center",
204
+ verticalAlign: "middle"
205
+ }
206
+ }
207
+ }
208
+ }
209
+ };
210
+ export default {
211
+ title: "Components/Chart Analytics",
212
+ component: ChartAnalytics,
213
+ decorators: [ChartStory => {
214
+ const [chartRef, setChartRef] = useState(null);
215
+ return /*#__PURE__*/React.createElement("div", {
216
+ style: {
217
+ width: 1000,
218
+ height: "100%",
219
+ display: "flex",
220
+ gap: 8,
221
+ flexDirection: "column"
222
+ }
223
+ }, /*#__PURE__*/React.createElement(CssReset, null), /*#__PURE__*/React.createElement("div", {
224
+ style: {
225
+ width: "100%",
226
+ display: "flex",
227
+ justifyContent: "end"
228
+ }
229
+ }, /*#__PURE__*/React.createElement(ChartDownloadMenu, {
230
+ chartRef: chartRef
231
+ })), /*#__PURE__*/React.createElement(ChartStory, {
232
+ ref: setChartRef
233
+ }));
234
+ }]
235
+ };
@@ -0,0 +1,46 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ import { mount } from "@cypress/react";
3
+ import HighCharts from "highcharts";
4
+ import React, { useState } from "react";
5
+ import ChartDownloadMenu from "./components/DownloadMenu";
6
+ import columnData from "./data/column-data.json";
7
+ import { setupHighchartsModules } from "./services/export";
8
+ import ChartAnalytics from ".";
9
+ const props = {
10
+ analytics: columnData,
11
+ config: {
12
+ layout: {
13
+ series: ["dx"],
14
+ category: ["ou"],
15
+ filter: ["pe"]
16
+ },
17
+ type: "column",
18
+ height: 500,
19
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"]
20
+ }
21
+ };
22
+ function TestComponent() {
23
+ return /*#__PURE__*/React.createElement(ChartAnalytics, props);
24
+ }
25
+ function ExportTestComponent() {
26
+ const [chartRef, setChartRef] = useState(null);
27
+ return /*#__PURE__*/React.createElement("div", {
28
+ style: {
29
+ display: "flex",
30
+ flexDirection: "column"
31
+ }
32
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ChartDownloadMenu, {
33
+ chartRef: chartRef
34
+ })), /*#__PURE__*/React.createElement(ChartAnalytics, _extends({}, props, {
35
+ ref: setChartRef
36
+ })));
37
+ }
38
+ describe("Chart Component Tests", () => {
39
+ setupHighchartsModules(HighCharts);
40
+ it("Mounts without errors", () => {
41
+ mount( /*#__PURE__*/React.createElement(TestComponent, null));
42
+ });
43
+ it("Can be exported as PDF", () => {
44
+ mount( /*#__PURE__*/React.createElement(ExportTestComponent, null));
45
+ });
46
+ });
@@ -0,0 +1,41 @@
1
+ import { FlyoutMenu, Menu, MenuDivider, MenuItem, Popover } from "@dhis2/ui";
2
+ import { isEmpty, map } from "lodash";
3
+ import React from "react";
4
+ import { chartMenuSections } from "../constants/menu";
5
+ export function ChartMenu(_ref) {
6
+ let {
7
+ menuRef,
8
+ onClick,
9
+ onClose,
10
+ exclude = []
11
+ } = _ref;
12
+ const onMenuClick = action => () => {
13
+ onClick(action);
14
+ onClose();
15
+ };
16
+ const menuSections = map(chartMenuSections, section => {
17
+ return {
18
+ ...section,
19
+ menuItems: section.menuItems.filter(item => !exclude.includes(item.name))
20
+ };
21
+ }).filter(section => !isEmpty(section.menuItems));
22
+ return /*#__PURE__*/React.createElement(Popover, {
23
+ onClickOutside: onClose,
24
+ onClose: onClose,
25
+ reference: menuRef
26
+ }, /*#__PURE__*/React.createElement(FlyoutMenu, null, /*#__PURE__*/React.createElement(Menu, null, menuSections === null || menuSections === void 0 ? void 0 : menuSections.map((section, index) => {
27
+ var _section$menuItems;
28
+ return /*#__PURE__*/React.createElement(React.Fragment, null, (_section$menuItems = section.menuItems) === null || _section$menuItems === void 0 ? void 0 : _section$menuItems.map(_ref2 => {
29
+ let {
30
+ name,
31
+ label
32
+ } = _ref2;
33
+ return /*#__PURE__*/React.createElement(MenuItem, {
34
+ key: `${name}-menu-item`,
35
+ dataTest: `download-${name}`,
36
+ label: label,
37
+ onClick: onMenuClick(name)
38
+ });
39
+ }), index !== menuSections.length - 1 && /*#__PURE__*/React.createElement(MenuDivider, null));
40
+ }))));
41
+ }
@@ -0,0 +1,26 @@
1
+ import i18n from "@dhis2/d2-i18n";
2
+ export const chartMenuSections = [{
3
+ name: "download",
4
+ menuItems: [{
5
+ name: "png",
6
+ label: i18n.t("Download PNG")
7
+ }, {
8
+ name: "jpeg",
9
+ label: i18n.t("Download JPEG")
10
+ }, {
11
+ name: "svg",
12
+ label: i18n.t("Download SVG")
13
+ }, {
14
+ name: "pdf",
15
+ label: i18n.t("Download PDF")
16
+ }]
17
+ }, {
18
+ name: "view",
19
+ menuItems: [{
20
+ name: "table",
21
+ label: i18n.t("View as table")
22
+ }, {
23
+ name: "full-screen",
24
+ label: i18n.t("View full screen")
25
+ }]
26
+ }];
@@ -0,0 +1,58 @@
1
+ import { IconMore24 } from "@dhis2/ui";
2
+ import React, { useRef, useState } from "react";
3
+ import { onCSVDownload, onFullScreenView, onImageDownload, onPDFDownload, onViewAsTable } from "../../services/export";
4
+ import { ChartMenu } from "./components/Menu";
5
+ function ChartDownloadMenu(_ref) {
6
+ let {
7
+ chartRef,
8
+ exclude,
9
+ icon
10
+ } = _ref;
11
+ const menuButtonRef = useRef(null);
12
+ const [menuRef, setMenuRef] = useState(null);
13
+ const toggleMenu = () => {
14
+ if (menuRef === null) {
15
+ setMenuRef(menuButtonRef.current);
16
+ } else {
17
+ setMenuRef(null);
18
+ }
19
+ };
20
+ const chart = chartRef;
21
+ const onMenuClick = action => {
22
+ if (chart) {
23
+ switch (action) {
24
+ case "png":
25
+ onImageDownload(chart, "png");
26
+ break;
27
+ case "jpeg":
28
+ onImageDownload(chart, "jpeg");
29
+ break;
30
+ case "svg":
31
+ onImageDownload(chart, "svg+xml");
32
+ break;
33
+ case "csv":
34
+ onCSVDownload(chart);
35
+ break;
36
+ case "pdf":
37
+ onPDFDownload(chart);
38
+ break;
39
+ case "table":
40
+ onViewAsTable(chart, true);
41
+ break;
42
+ case "full-screen":
43
+ onFullScreenView(chart);
44
+ break;
45
+ }
46
+ }
47
+ };
48
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
49
+ onClick: toggleMenu,
50
+ ref: menuButtonRef
51
+ }, icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React.createElement(IconMore24, null)), menuRef && /*#__PURE__*/React.createElement(ChartMenu, {
52
+ exclude: exclude,
53
+ onClick: onMenuClick,
54
+ onClose: toggleMenu,
55
+ menuRef: menuRef
56
+ }));
57
+ }
58
+ export default ChartDownloadMenu;