@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,253 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.StackedColumn = exports.PieChart = exports.MultipleLines = exports.MultipleColumns = exports.MultiSeries = exports.Line = exports.ComplexMultiSeries = exports.Column = void 0;
7
+ var _ui = require("@dhis2/ui");
8
+ var _highcharts = _interopRequireDefault(require("highcharts"));
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _DownloadMenu = _interopRequireDefault(require("./components/DownloadMenu"));
11
+ var _columnData = _interopRequireDefault(require("./data/column-data.json"));
12
+ var _complexMultiSeriesData = _interopRequireDefault(require("./data/complex-multi-series-data.json"));
13
+ var _multiSeriesData = _interopRequireDefault(require("./data/multi-series-data.json"));
14
+ var _pieData = _interopRequireDefault(require("./data/pie-data.json"));
15
+ var _stackedChartData = _interopRequireDefault(require("./data/stacked-chart-data.json"));
16
+ var _export = require("./services/export");
17
+ var _ = _interopRequireDefault(require("."));
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+ const Template = args => /*#__PURE__*/_react.default.createElement(_.default, args);
22
+ (0, _export.setupHighchartsModules)(_highcharts.default);
23
+ const Column = Template.bind({});
24
+ exports.Column = Column;
25
+ Column.args = {
26
+ analytics: _columnData.default,
27
+ config: {
28
+ layout: {
29
+ series: ["dx"],
30
+ category: ["ou"],
31
+ filter: ["pe"]
32
+ },
33
+ type: "column",
34
+ height: 500,
35
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"]
36
+ }
37
+ };
38
+ const MultipleColumns = Template.bind({});
39
+ exports.MultipleColumns = MultipleColumns;
40
+ MultipleColumns.args = {
41
+ analytics: _multiSeriesData.default,
42
+ config: {
43
+ layout: {
44
+ series: ["ou"],
45
+ category: ["pe"],
46
+ filter: ["dx"]
47
+ },
48
+ type: "column",
49
+ height: 1000,
50
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"]
51
+ }
52
+ };
53
+ const StackedColumn = Template.bind({});
54
+ exports.StackedColumn = StackedColumn;
55
+ StackedColumn.args = {
56
+ analytics: _stackedChartData.default,
57
+ config: {
58
+ layout: {
59
+ series: ["ou"],
60
+ category: ["pe"],
61
+ filter: ["dx"]
62
+ },
63
+ type: "stacked-column",
64
+ height: 1000,
65
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"]
66
+ }
67
+ };
68
+ const Line = Template.bind({});
69
+ exports.Line = Line;
70
+ Line.args = {
71
+ analytics: _columnData.default,
72
+ config: {
73
+ layout: {
74
+ series: ["dx"],
75
+ category: ["ou"],
76
+ filter: ["pe"]
77
+ },
78
+ type: "line",
79
+ height: 1000,
80
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"]
81
+ }
82
+ };
83
+ const MultipleLines = Template.bind({});
84
+ exports.MultipleLines = MultipleLines;
85
+ MultipleLines.args = {
86
+ analytics: _multiSeriesData.default,
87
+ config: {
88
+ layout: {
89
+ series: ["ou"],
90
+ category: ["pe"],
91
+ filter: ["dx"]
92
+ },
93
+ type: "line",
94
+ height: 500,
95
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"]
96
+ }
97
+ };
98
+ const PieChart = Template.bind({});
99
+ exports.PieChart = PieChart;
100
+ PieChart.args = {
101
+ analytics: _pieData.default,
102
+ config: {
103
+ layout: {
104
+ series: ["dx"],
105
+ category: [],
106
+ filter: ["dx", "pe"]
107
+ },
108
+ type: "pie",
109
+ height: 500,
110
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c4255", "#a6c96a"]
111
+ }
112
+ };
113
+ const MultiSeries = Template.bind({});
114
+ exports.MultiSeries = MultiSeries;
115
+ MultiSeries.args = {
116
+ analytics: _multiSeriesData.default,
117
+ config: {
118
+ layout: {
119
+ series: ["ou"],
120
+ category: ["pe"],
121
+ filter: ["dx"]
122
+ },
123
+ type: "multi-series",
124
+ height: 500,
125
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
126
+ multiSeries: {
127
+ series: [{
128
+ id: "qhqAxPSTUXp",
129
+ as: "column",
130
+ yAxis: 0
131
+ }, {
132
+ id: "Vth0fbpFcsO",
133
+ as: "line",
134
+ cumulative: true,
135
+ yAxis: 1
136
+ }],
137
+ yAxes: [{
138
+ id: "yAxis1",
139
+ title: {
140
+ text: "Koinandugu"
141
+ },
142
+ labels: {
143
+ format: "{value}"
144
+ }
145
+ }, {
146
+ id: "yAxis2",
147
+ title: {
148
+ text: "Kono"
149
+ },
150
+ labels: {
151
+ format: "{value}"
152
+ },
153
+ opposite: true
154
+ }],
155
+ target: {
156
+ id: "",
157
+ styles: {
158
+ color: "blue"
159
+ },
160
+ value: 45,
161
+ label: {
162
+ text: "Target",
163
+ textAlign: "center",
164
+ verticalAlign: "middle"
165
+ }
166
+ }
167
+ }
168
+ }
169
+ };
170
+ const ComplexMultiSeries = Template.bind({});
171
+ exports.ComplexMultiSeries = ComplexMultiSeries;
172
+ ComplexMultiSeries.args = {
173
+ analytics: _complexMultiSeriesData.default,
174
+ config: {
175
+ layout: {
176
+ series: ["dx"],
177
+ category: ["pe"],
178
+ filter: ["ou"]
179
+ },
180
+ type: "multi-series",
181
+ height: 500,
182
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
183
+ multiSeries: {
184
+ series: [{
185
+ id: "QQkOAJFukyY",
186
+ as: "column",
187
+ yAxis: 0
188
+ }, {
189
+ id: "QQkOAJFukyY",
190
+ as: "line",
191
+ cumulative: true,
192
+ yAxis: 1
193
+ }],
194
+ yAxes: [{
195
+ id: "yAxis1",
196
+ title: {
197
+ text: "Koinandugu"
198
+ },
199
+ labels: {
200
+ format: "{value}"
201
+ }
202
+ }, {
203
+ id: "yAxis2",
204
+ title: {
205
+ text: "Kono"
206
+ },
207
+ labels: {
208
+ format: "{value}"
209
+ },
210
+ opposite: true
211
+ }],
212
+ target: {
213
+ id: "",
214
+ styles: {
215
+ color: "blue"
216
+ },
217
+ value: 45,
218
+ label: {
219
+ text: "Target",
220
+ textAlign: "center",
221
+ verticalAlign: "middle"
222
+ }
223
+ }
224
+ }
225
+ }
226
+ };
227
+ var _default = {
228
+ title: "Components/Chart Analytics",
229
+ component: _.default,
230
+ decorators: [ChartStory => {
231
+ const [chartRef, setChartRef] = (0, _react.useState)(null);
232
+ return /*#__PURE__*/_react.default.createElement("div", {
233
+ style: {
234
+ width: 1000,
235
+ height: "100%",
236
+ display: "flex",
237
+ gap: 8,
238
+ flexDirection: "column"
239
+ }
240
+ }, /*#__PURE__*/_react.default.createElement(_ui.CssReset, null), /*#__PURE__*/_react.default.createElement("div", {
241
+ style: {
242
+ width: "100%",
243
+ display: "flex",
244
+ justifyContent: "end"
245
+ }
246
+ }, /*#__PURE__*/_react.default.createElement(_DownloadMenu.default, {
247
+ chartRef: chartRef
248
+ })), /*#__PURE__*/_react.default.createElement(ChartStory, {
249
+ ref: setChartRef
250
+ }));
251
+ }]
252
+ };
253
+ exports.default = _default;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _react = require("@cypress/react");
4
+ var _highcharts = _interopRequireDefault(require("highcharts"));
5
+ var _react2 = _interopRequireWildcard(require("react"));
6
+ var _DownloadMenu = _interopRequireDefault(require("./components/DownloadMenu"));
7
+ var _columnData = _interopRequireDefault(require("./data/column-data.json"));
8
+ var _export = require("./services/export");
9
+ var _ = _interopRequireDefault(require("."));
10
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ 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); }
14
+ const props = {
15
+ analytics: _columnData.default,
16
+ config: {
17
+ layout: {
18
+ series: ["dx"],
19
+ category: ["ou"],
20
+ filter: ["pe"]
21
+ },
22
+ type: "column",
23
+ height: 500,
24
+ colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"]
25
+ }
26
+ };
27
+ function TestComponent() {
28
+ return /*#__PURE__*/_react2.default.createElement(_.default, props);
29
+ }
30
+ function ExportTestComponent() {
31
+ const [chartRef, setChartRef] = (0, _react2.useState)(null);
32
+ return /*#__PURE__*/_react2.default.createElement("div", {
33
+ style: {
34
+ display: "flex",
35
+ flexDirection: "column"
36
+ }
37
+ }, /*#__PURE__*/_react2.default.createElement("div", null, /*#__PURE__*/_react2.default.createElement(_DownloadMenu.default, {
38
+ chartRef: chartRef
39
+ })), /*#__PURE__*/_react2.default.createElement(_.default, _extends({}, props, {
40
+ ref: setChartRef
41
+ })));
42
+ }
43
+ describe("Chart Component Tests", () => {
44
+ (0, _export.setupHighchartsModules)(_highcharts.default);
45
+ it("Mounts without errors", () => {
46
+ (0, _react.mount)( /*#__PURE__*/_react2.default.createElement(TestComponent, null));
47
+ });
48
+ it("Can be exported as PDF", () => {
49
+ (0, _react.mount)( /*#__PURE__*/_react2.default.createElement(ExportTestComponent, null));
50
+ });
51
+ });
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ChartMenu = ChartMenu;
7
+ var _ui = require("@dhis2/ui");
8
+ var _lodash = require("lodash");
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _menu = require("../constants/menu");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function ChartMenu(_ref) {
13
+ let {
14
+ menuRef,
15
+ onClick,
16
+ onClose,
17
+ exclude = []
18
+ } = _ref;
19
+ const onMenuClick = action => () => {
20
+ onClick(action);
21
+ onClose();
22
+ };
23
+ const menuSections = (0, _lodash.map)(_menu.chartMenuSections, section => {
24
+ return {
25
+ ...section,
26
+ menuItems: section.menuItems.filter(item => !exclude.includes(item.name))
27
+ };
28
+ }).filter(section => !(0, _lodash.isEmpty)(section.menuItems));
29
+ return /*#__PURE__*/_react.default.createElement(_ui.Popover, {
30
+ onClickOutside: onClose,
31
+ onClose: onClose,
32
+ reference: menuRef
33
+ }, /*#__PURE__*/_react.default.createElement(_ui.FlyoutMenu, null, /*#__PURE__*/_react.default.createElement(_ui.Menu, null, menuSections === null || menuSections === void 0 ? void 0 : menuSections.map((section, index) => {
34
+ var _section$menuItems;
35
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (_section$menuItems = section.menuItems) === null || _section$menuItems === void 0 ? void 0 : _section$menuItems.map(_ref2 => {
36
+ let {
37
+ name,
38
+ label
39
+ } = _ref2;
40
+ return /*#__PURE__*/_react.default.createElement(_ui.MenuItem, {
41
+ key: `${name}-menu-item`,
42
+ dataTest: `download-${name}`,
43
+ label: label,
44
+ onClick: onMenuClick(name)
45
+ });
46
+ }), index !== menuSections.length - 1 && /*#__PURE__*/_react.default.createElement(_ui.MenuDivider, null));
47
+ }))));
48
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.chartMenuSections = void 0;
7
+ var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const chartMenuSections = [{
10
+ name: "download",
11
+ menuItems: [{
12
+ name: "png",
13
+ label: _d2I18n.default.t("Download PNG")
14
+ }, {
15
+ name: "jpeg",
16
+ label: _d2I18n.default.t("Download JPEG")
17
+ }, {
18
+ name: "svg",
19
+ label: _d2I18n.default.t("Download SVG")
20
+ }, {
21
+ name: "pdf",
22
+ label: _d2I18n.default.t("Download PDF")
23
+ }]
24
+ }, {
25
+ name: "view",
26
+ menuItems: [{
27
+ name: "table",
28
+ label: _d2I18n.default.t("View as table")
29
+ }, {
30
+ name: "full-screen",
31
+ label: _d2I18n.default.t("View full screen")
32
+ }]
33
+ }];
34
+ exports.chartMenuSections = chartMenuSections;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _ui = require("@dhis2/ui");
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _export = require("../../services/export");
10
+ var _Menu = require("./components/Menu");
11
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
+ function ChartDownloadMenu(_ref) {
14
+ let {
15
+ chartRef,
16
+ exclude,
17
+ icon
18
+ } = _ref;
19
+ const menuButtonRef = (0, _react.useRef)(null);
20
+ const [menuRef, setMenuRef] = (0, _react.useState)(null);
21
+ const toggleMenu = () => {
22
+ if (menuRef === null) {
23
+ setMenuRef(menuButtonRef.current);
24
+ } else {
25
+ setMenuRef(null);
26
+ }
27
+ };
28
+ const chart = chartRef;
29
+ const onMenuClick = action => {
30
+ if (chart) {
31
+ switch (action) {
32
+ case "png":
33
+ (0, _export.onImageDownload)(chart, "png");
34
+ break;
35
+ case "jpeg":
36
+ (0, _export.onImageDownload)(chart, "jpeg");
37
+ break;
38
+ case "svg":
39
+ (0, _export.onImageDownload)(chart, "svg+xml");
40
+ break;
41
+ case "csv":
42
+ (0, _export.onCSVDownload)(chart);
43
+ break;
44
+ case "pdf":
45
+ (0, _export.onPDFDownload)(chart);
46
+ break;
47
+ case "table":
48
+ (0, _export.onViewAsTable)(chart, true);
49
+ break;
50
+ case "full-screen":
51
+ (0, _export.onFullScreenView)(chart);
52
+ break;
53
+ }
54
+ }
55
+ };
56
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
57
+ onClick: toggleMenu,
58
+ ref: menuButtonRef
59
+ }, icon !== null && icon !== void 0 ? icon : /*#__PURE__*/_react.default.createElement(_ui.IconMore24, null)), menuRef && /*#__PURE__*/_react.default.createElement(_Menu.ChartMenu, {
60
+ exclude: exclude,
61
+ onClick: onMenuClick,
62
+ onClose: toggleMenu,
63
+ menuRef: menuRef
64
+ }));
65
+ }
66
+ var _default = ChartDownloadMenu;
67
+ exports.default = _default;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useChart = useChart;
7
+ var _react = require("react");
8
+ var _chart = require("../utils/chart");
9
+ function useChart(_ref) {
10
+ let {
11
+ id,
12
+ analytics,
13
+ config
14
+ } = _ref;
15
+ const [chart, setChart] = (0, _react.useState)((0, _chart.getChartInstance)(id, analytics, config).getOptions());
16
+ const changeChartType = (0, _react.useCallback)(type => {
17
+ const updatedLayout = (0, _chart.updateLayout)(config, {
18
+ type
19
+ });
20
+ const updatedConfig = {
21
+ ...config,
22
+ layout: updatedLayout,
23
+ type
24
+ };
25
+ const chartInstance = (0, _chart.getChartInstance)(id, analytics, updatedConfig);
26
+ setChart(chartInstance.getOptions());
27
+ }, [config, id, analytics]);
28
+ (0, _react.useEffect)(() => {
29
+ if (analytics && config) {
30
+ const chartInstance = (0, _chart.getChartInstance)(id, analytics, config);
31
+ setChart(chartInstance.getOptions());
32
+ }
33
+ }, [analytics, config, id]);
34
+ return {
35
+ chart,
36
+ changeChartType
37
+ };
38
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ ChartDownloadMenu: true
8
+ };
9
+ Object.defineProperty(exports, "ChartDownloadMenu", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _DownloadMenu.default;
13
+ }
14
+ });
15
+ exports.default = void 0;
16
+ var _dhis2Utils = require("@hisptz/dhis2-utils");
17
+ var _highcharts = _interopRequireDefault(require("highcharts"));
18
+ var _highchartsReactOfficial = _interopRequireDefault(require("highcharts-react-official"));
19
+ var _react = _interopRequireWildcard(require("react"));
20
+ var _DownloadMenu = _interopRequireDefault(require("./components/DownloadMenu"));
21
+ var _useChart = require("./hooks/useChart");
22
+ require("./styles/custom-highchart.css");
23
+ var _export = require("./services/export");
24
+ Object.keys(_export).forEach(function (key) {
25
+ if (key === "default" || key === "__esModule") return;
26
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
27
+ if (key in exports && exports[key] === _export[key]) return;
28
+ Object.defineProperty(exports, key, {
29
+ enumerable: true,
30
+ get: function () {
31
+ return _export[key];
32
+ }
33
+ });
34
+ });
35
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
36
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38
+ function ChartAnalytics(_ref, ref) {
39
+ let {
40
+ analytics,
41
+ config,
42
+ containerProps
43
+ } = _ref;
44
+ const id = (0, _react.useRef)(`${(0, _dhis2Utils.uid)()}-chart-item`);
45
+ const {
46
+ chart
47
+ } = (0, _useChart.useChart)({
48
+ id: id.current,
49
+ analytics,
50
+ config
51
+ });
52
+ if (!chart) {
53
+ return null;
54
+ }
55
+ return /*#__PURE__*/_react.default.createElement(_highchartsReactOfficial.default, {
56
+ immutable: true,
57
+ ref: ref,
58
+ containerProps: {
59
+ id: id.current,
60
+ ...(containerProps !== null && containerProps !== void 0 ? containerProps : {})
61
+ },
62
+ highcharts: _highcharts.default,
63
+ options: {
64
+ ...chart
65
+ }
66
+ });
67
+ }
68
+ var _default = /*#__PURE__*/(0, _react.forwardRef)(ChartAnalytics);
69
+ exports.default = _default;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DHIS2StackedColumnChart = exports.DHIS2ColumnChart = void 0;
7
+ var _chart = require("../utils/chart");
8
+ var _index = require("./index");
9
+ class DHIS2ColumnChart extends _index.DHIS2Chart {
10
+ getCategories() {
11
+ return undefined;
12
+ }
13
+ getHighchartsType() {
14
+ return "column";
15
+ }
16
+ getPlotOptions() {
17
+ return {
18
+ column: {
19
+ dataLabels: {
20
+ enabled: true
21
+ }
22
+ }
23
+ };
24
+ }
25
+ getSeries() {
26
+ return (0, _chart.getPointSeries)(this.analytics, this.config, "column");
27
+ }
28
+ getXAxis() {
29
+ return {
30
+ type: "category",
31
+ categories: (0, _chart.getAllCategories)(this.analytics, this.config),
32
+ crosshair: true,
33
+ labels: {
34
+ enabled: true
35
+ },
36
+ title: {
37
+ text: ""
38
+ }
39
+ };
40
+ }
41
+ }
42
+ exports.DHIS2ColumnChart = DHIS2ColumnChart;
43
+ class DHIS2StackedColumnChart extends DHIS2ColumnChart {
44
+ getPlotOptions() {
45
+ return {
46
+ column: {
47
+ stacking: "normal",
48
+ ...super.getPlotOptions().column
49
+ }
50
+ };
51
+ }
52
+ }
53
+ exports.DHIS2StackedColumnChart = DHIS2StackedColumnChart;