@hisptz/dhis2-analytics 2.0.0-alpha.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (726) hide show
  1. package/dist/components/ChartAnalytics/DHIS2Chart.js +11 -11
  2. package/dist/components/ChartAnalytics/DHIS2Chart.js.map +1 -1
  3. package/dist/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +2 -2
  4. package/dist/components/ChartAnalytics/components/DownloadMenu/components/Menu.js.map +1 -1
  5. package/dist/components/ChartAnalytics/components/DownloadMenu/index.js +10 -10
  6. package/dist/components/ChartAnalytics/components/DownloadMenu/index.js.map +1 -1
  7. package/dist/components/ChartAnalytics/hooks/useChart.js +7 -7
  8. package/dist/components/ChartAnalytics/hooks/useChart.js.map +1 -1
  9. package/dist/components/ChartAnalytics/index.js +3 -3
  10. package/dist/components/ChartAnalytics/index.js.map +1 -1
  11. package/dist/components/ChartAnalytics/models/bar.js +2 -2
  12. package/dist/components/ChartAnalytics/models/bar.js.map +1 -1
  13. package/dist/components/ChartAnalytics/models/column.js +5 -5
  14. package/dist/components/ChartAnalytics/models/column.js.map +1 -1
  15. package/dist/components/ChartAnalytics/models/index.js +0 -3
  16. package/dist/components/ChartAnalytics/models/index.js.map +1 -1
  17. package/dist/components/ChartAnalytics/models/line.js +5 -5
  18. package/dist/components/ChartAnalytics/models/line.js.map +1 -1
  19. package/dist/components/ChartAnalytics/models/multi-series.js +22 -9
  20. package/dist/components/ChartAnalytics/models/multi-series.js.map +1 -1
  21. package/dist/components/ChartAnalytics/models/pie.js +5 -3
  22. package/dist/components/ChartAnalytics/models/pie.js.map +1 -1
  23. package/dist/components/ChartAnalytics/services/export.js +3 -3
  24. package/dist/components/ChartAnalytics/services/export.js.map +1 -1
  25. package/dist/components/ChartAnalytics/styles/custom-highchart.css +40 -0
  26. package/dist/components/ChartAnalytics/styles/custom-highchart.css.map +1 -0
  27. package/dist/components/ChartAnalytics/utils/chart.js +12 -12
  28. package/dist/components/ChartAnalytics/utils/chart.js.map +1 -1
  29. package/dist/components/CircularProgressDashboard/CircularProgressIndicator.js +3 -3
  30. package/dist/components/CircularProgressDashboard/CircularProgressIndicator.js.map +1 -1
  31. package/dist/components/CircularProgressDashboard/index.js +6 -6
  32. package/dist/components/CircularProgressDashboard/index.js.map +1 -1
  33. package/dist/components/DHIS2PivotTable/DHIS2PivotTable.js +10 -10
  34. package/dist/components/DHIS2PivotTable/DHIS2PivotTable.js.map +1 -1
  35. package/dist/components/DHIS2PivotTable/components/TableBody/index.js +8 -8
  36. package/dist/components/DHIS2PivotTable/components/TableBody/index.js.map +1 -1
  37. package/dist/components/DHIS2PivotTable/components/TableHeaders/index.js +5 -5
  38. package/dist/components/DHIS2PivotTable/components/TableHeaders/index.js.map +1 -1
  39. package/dist/components/DHIS2PivotTable/index.js +6 -6
  40. package/dist/components/DHIS2PivotTable/index.js.map +1 -1
  41. package/dist/components/DHIS2PivotTable/services/engine.js +0 -6
  42. package/dist/components/DHIS2PivotTable/services/engine.js.map +1 -1
  43. package/dist/components/DHIS2PivotTable/state/engine.js.map +1 -1
  44. package/dist/components/Map/DHIS2Map.js +3 -3
  45. package/dist/components/Map/DHIS2Map.js.map +1 -1
  46. package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.js +2 -2
  47. package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.js.map +1 -1
  48. package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.js +10 -10
  49. package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.js.map +1 -1
  50. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/AggregationSelector.js +2 -2
  51. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/AggregationSelector.js.map +1 -1
  52. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/ColorConfig.js +11 -11
  53. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/ColorConfig.js.map +1 -1
  54. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/Name.js +2 -2
  55. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/Name.js.map +1 -1
  56. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/PeriodSelector.js +3 -3
  57. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/PeriodSelector.js.map +1 -1
  58. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/StylesConfig.js +4 -4
  59. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/StylesConfig.js.map +1 -1
  60. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/TypeField.js +3 -3
  61. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/TypeField.js.map +1 -1
  62. package/dist/components/Map/components/EarthEngineLayerConfiguration/hooks/data.js +8 -8
  63. package/dist/components/Map/components/EarthEngineLayerConfiguration/hooks/data.js.map +1 -1
  64. package/dist/components/Map/components/EarthEngineLayerConfiguration/index.js +6 -6
  65. package/dist/components/Map/components/EarthEngineLayerConfiguration/index.js.map +1 -1
  66. package/dist/components/Map/components/MapArea/index.js +42 -27
  67. package/dist/components/Map/components/MapArea/index.js.map +1 -1
  68. package/dist/components/Map/components/MapControls/index.js +16 -4
  69. package/dist/components/Map/components/MapControls/index.js.map +1 -1
  70. package/dist/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +2 -2
  71. package/dist/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js.map +1 -1
  72. package/dist/components/Map/components/MapLayer/components/BoundaryLayer/index.js +5 -5
  73. package/dist/components/Map/components/MapLayer/components/BoundaryLayer/index.js.map +1 -1
  74. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +49 -14
  75. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js.map +1 -1
  76. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +26 -8
  77. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js.map +1 -1
  78. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +2 -2
  79. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js.map +1 -1
  80. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +8 -8
  81. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js.map +1 -1
  82. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +31468 -0
  83. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js.map +1 -0
  84. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +56 -34
  85. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js.map +1 -1
  86. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +33 -22
  87. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js.map +1 -1
  88. package/dist/components/Map/components/MapLayer/components/LegendArea/index.js +10 -10
  89. package/dist/components/Map/components/MapLayer/components/LegendArea/index.js.map +1 -1
  90. package/dist/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +22 -8
  91. package/dist/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js.map +1 -1
  92. package/dist/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +2 -2
  93. package/dist/components/Map/components/MapLayer/components/PointLayer/hooks/index.js.map +1 -1
  94. package/dist/components/Map/components/MapLayer/components/PointLayer/index.js +5 -5
  95. package/dist/components/Map/components/MapLayer/components/PointLayer/index.js.map +1 -1
  96. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +34 -6
  97. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js.map +1 -1
  98. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js +28 -9
  99. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js.map +1 -1
  100. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +2 -2
  101. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js.map +1 -1
  102. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +5 -5
  103. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js.map +1 -1
  104. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +18 -4
  105. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js.map +1 -1
  106. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +9 -6
  107. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js.map +1 -1
  108. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +2 -2
  109. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js.map +1 -1
  110. package/dist/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +2 -2
  111. package/dist/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js.map +1 -1
  112. package/dist/components/Map/components/MapLayer/components/ThematicLayer/index.js +3 -3
  113. package/dist/components/Map/components/MapLayer/components/ThematicLayer/index.js.map +1 -1
  114. package/dist/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +56 -0
  115. package/dist/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css.map +1 -0
  116. package/dist/components/Map/components/MapLayer/index.js +5 -5
  117. package/dist/components/Map/components/MapLayer/index.js.map +1 -1
  118. package/dist/components/Map/components/MapLayer/interfaces/index.js +6 -1
  119. package/dist/components/Map/components/MapLayer/interfaces/index.js.map +1 -1
  120. package/dist/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +24 -24
  121. package/dist/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js.map +1 -1
  122. package/dist/components/Map/components/MapProvider/components/MapLayerProvider/index.js +9 -9
  123. package/dist/components/Map/components/MapProvider/components/MapLayerProvider/index.js.map +1 -1
  124. package/dist/components/Map/components/MapProvider/hooks/index.js +4 -4
  125. package/dist/components/Map/components/MapProvider/hooks/index.js.map +1 -1
  126. package/dist/components/Map/components/MapProvider/index.js +7 -7
  127. package/dist/components/Map/components/MapProvider/index.js.map +1 -1
  128. package/dist/components/Map/components/MapUpdater/index.js +2 -2
  129. package/dist/components/Map/components/MapUpdater/index.js.map +1 -1
  130. package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.js +2 -2
  131. package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.js.map +1 -1
  132. package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.js +12 -12
  133. package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.js.map +1 -1
  134. package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +16 -4
  135. package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js.map +1 -1
  136. package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +6 -6
  137. package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js.map +1 -1
  138. package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +13 -5
  139. package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js.map +1 -1
  140. package/dist/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +5 -5
  141. package/dist/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js.map +1 -1
  142. package/dist/components/Map/components/ThematicLayerConfiguration/index.js +9 -9
  143. package/dist/components/Map/components/ThematicLayerConfiguration/index.js.map +1 -1
  144. package/dist/components/Map/hooks/map.js +2 -2
  145. package/dist/components/Map/hooks/map.js.map +1 -1
  146. package/dist/components/Map/index.js +15 -15
  147. package/dist/components/Map/index.js.map +1 -1
  148. package/dist/components/Map/state/index.js.map +1 -1
  149. package/dist/components/Map/utils/colors.js +13 -5
  150. package/dist/components/Map/utils/colors.js.map +1 -1
  151. package/dist/components/Map/utils/map.js +18 -7
  152. package/dist/components/Map/utils/map.js.map +1 -1
  153. package/dist/components/SingleValueContainer/SingleValueVisualizer.js +4 -4
  154. package/dist/components/SingleValueContainer/SingleValueVisualizer.js.map +1 -1
  155. package/dist/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +1 -1
  156. package/dist/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js.map +1 -1
  157. package/dist/components/SingleValueContainer/index.js +13 -6
  158. package/dist/components/SingleValueContainer/index.js.map +1 -1
  159. package/dist/components/Visualization/components/AnalyticsDataProvider/index.js +39 -12
  160. package/dist/components/Visualization/components/AnalyticsDataProvider/index.js.map +1 -1
  161. package/dist/components/Visualization/components/LayoutProvider/index.js +5 -4
  162. package/dist/components/Visualization/components/LayoutProvider/index.js.map +1 -1
  163. package/dist/components/Visualization/components/VisualizationDimensionSelector/index.js +6 -6
  164. package/dist/components/Visualization/components/VisualizationDimensionSelector/index.js.map +1 -1
  165. package/dist/components/Visualization/components/VisualizationProvider/index.js +12 -6
  166. package/dist/components/Visualization/components/VisualizationProvider/index.js.map +1 -1
  167. package/dist/components/Visualization/components/VisualizationSelector/index.js +17 -17
  168. package/dist/components/Visualization/components/VisualizationSelector/index.js.map +1 -1
  169. package/dist/components/Visualization/components/VisualizationTypeProvider/index.js +5 -1
  170. package/dist/components/Visualization/components/VisualizationTypeProvider/index.js.map +1 -1
  171. package/dist/components/Visualization/components/VisualizationTypeSelector/index.js +25 -9
  172. package/dist/components/Visualization/components/VisualizationTypeSelector/index.js.map +1 -1
  173. package/dist/components/Visualization/index.js +8 -8
  174. package/dist/components/Visualization/index.js.map +1 -1
  175. package/dist/{components/ChartAnalytics/ChartAnalytics.stories.mjs → esm/components/ChartAnalytics/ChartAnalytics.stories.js} +1 -1
  176. package/dist/esm/components/ChartAnalytics/ChartAnalytics.stories.js.map +1 -0
  177. package/dist/{components/ChartAnalytics/DHIS2Chart.mjs → esm/components/ChartAnalytics/DHIS2Chart.js} +5 -5
  178. package/dist/esm/components/ChartAnalytics/DHIS2Chart.js.map +1 -0
  179. package/dist/{components/ChartAnalytics/components/DownloadMenu/components/Menu.mjs → esm/components/ChartAnalytics/components/DownloadMenu/components/Menu.js} +2 -2
  180. package/dist/esm/components/ChartAnalytics/components/DownloadMenu/components/Menu.js.map +1 -0
  181. package/dist/{components/ChartAnalytics/components/DownloadMenu/constants/menu.mjs → esm/components/ChartAnalytics/components/DownloadMenu/constants/menu.js} +1 -1
  182. package/dist/esm/components/ChartAnalytics/components/DownloadMenu/constants/menu.js.map +1 -0
  183. package/dist/{components/ChartAnalytics/components/DownloadMenu/index.mjs → esm/components/ChartAnalytics/components/DownloadMenu/index.js} +3 -3
  184. package/dist/esm/components/ChartAnalytics/components/DownloadMenu/index.js.map +1 -0
  185. package/dist/{components/ChartAnalytics/components/DownloadMenu/interfaces/menu.mjs → esm/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js} +1 -1
  186. package/dist/{components/ChartAnalytics/hooks/useChart.mjs → esm/components/ChartAnalytics/hooks/useChart.js} +2 -2
  187. package/dist/esm/components/ChartAnalytics/hooks/useChart.js.map +1 -0
  188. package/dist/esm/components/ChartAnalytics/index.js +3 -0
  189. package/dist/esm/components/ChartAnalytics/index.js.map +1 -0
  190. package/dist/{components/ChartAnalytics/models/bar.mjs → esm/components/ChartAnalytics/models/bar.js} +2 -2
  191. package/dist/esm/components/ChartAnalytics/models/bar.js.map +1 -0
  192. package/dist/{components/ChartAnalytics/models/column.mjs → esm/components/ChartAnalytics/models/column.js} +3 -3
  193. package/dist/esm/components/ChartAnalytics/models/column.js.map +1 -0
  194. package/dist/{components/ChartAnalytics/models/index.mjs → esm/components/ChartAnalytics/models/index.js} +1 -4
  195. package/dist/esm/components/ChartAnalytics/models/index.js.map +1 -0
  196. package/dist/{components/ChartAnalytics/models/line.mjs → esm/components/ChartAnalytics/models/line.js} +3 -3
  197. package/dist/esm/components/ChartAnalytics/models/line.js.map +1 -0
  198. package/dist/{components/ChartAnalytics/models/multi-series.mjs → esm/components/ChartAnalytics/models/multi-series.js} +21 -8
  199. package/dist/esm/components/ChartAnalytics/models/multi-series.js.map +1 -0
  200. package/dist/{components/ChartAnalytics/models/pie.mjs → esm/components/ChartAnalytics/models/pie.js} +5 -3
  201. package/dist/esm/components/ChartAnalytics/models/pie.js.map +1 -0
  202. package/dist/{components/ChartAnalytics/services/export.mjs → esm/components/ChartAnalytics/services/export.js} +4 -4
  203. package/dist/esm/components/ChartAnalytics/services/export.js.map +1 -0
  204. package/dist/esm/components/ChartAnalytics/styles/custom-highchart.css +40 -0
  205. package/dist/esm/components/ChartAnalytics/styles/custom-highchart.css.map +1 -0
  206. package/dist/esm/components/ChartAnalytics/types/props.js +3 -0
  207. package/dist/{components/ChartAnalytics/utils/chart.mjs → esm/components/ChartAnalytics/utils/chart.js} +6 -6
  208. package/dist/esm/components/ChartAnalytics/utils/chart.js.map +1 -0
  209. package/dist/{components/CircularProgressDashboard/CircularProgressIndicator.mjs → esm/components/CircularProgressDashboard/CircularProgressIndicator.js} +2 -2
  210. package/dist/esm/components/CircularProgressDashboard/CircularProgressIndicator.js.map +1 -0
  211. package/dist/{components/CircularProgressDashboard/CircularProgressIndicator.stories.mjs → esm/components/CircularProgressDashboard/CircularProgressIndicator.stories.js} +1 -1
  212. package/dist/esm/components/CircularProgressDashboard/CircularProgressIndicator.stories.js.map +1 -0
  213. package/dist/esm/components/CircularProgressDashboard/index.js +4 -0
  214. package/dist/esm/components/CircularProgressDashboard/index.js.map +1 -0
  215. package/dist/esm/components/CircularProgressDashboard/types/props.js +3 -0
  216. package/dist/{components/DHIS2PivotTable/DHIS2PivotTable.mjs → esm/components/DHIS2PivotTable/DHIS2PivotTable.js} +6 -6
  217. package/dist/esm/components/DHIS2PivotTable/DHIS2PivotTable.js.map +1 -0
  218. package/dist/{components/DHIS2PivotTable/DHIS2PivotTable.stories.mjs → esm/components/DHIS2PivotTable/DHIS2PivotTable.stories.js} +1 -1
  219. package/dist/esm/components/DHIS2PivotTable/DHIS2PivotTable.stories.js.map +1 -0
  220. package/dist/{components/DHIS2PivotTable/components/Table/index.mjs → esm/components/DHIS2PivotTable/components/Table/index.js} +1 -1
  221. package/dist/esm/components/DHIS2PivotTable/components/Table/index.js.map +1 -0
  222. package/dist/esm/components/DHIS2PivotTable/components/TableBody/TableBody.module.css +11 -0
  223. package/dist/esm/components/DHIS2PivotTable/components/TableBody/TableBody.module.css.map +1 -0
  224. package/dist/{components/DHIS2PivotTable/components/TableBody/index.mjs → esm/components/DHIS2PivotTable/components/TableBody/index.js} +2 -2
  225. package/dist/esm/components/DHIS2PivotTable/components/TableBody/index.js.map +1 -0
  226. package/dist/esm/components/DHIS2PivotTable/components/TableHeaders/TableHeaders.module.css +10 -0
  227. package/dist/esm/components/DHIS2PivotTable/components/TableHeaders/TableHeaders.module.css.map +1 -0
  228. package/dist/{components/DHIS2PivotTable/components/TableHeaders/index.mjs → esm/components/DHIS2PivotTable/components/TableHeaders/index.js} +2 -2
  229. package/dist/esm/components/DHIS2PivotTable/components/TableHeaders/index.js.map +1 -0
  230. package/dist/esm/components/DHIS2PivotTable/index.js +4 -0
  231. package/dist/esm/components/DHIS2PivotTable/index.js.map +1 -0
  232. package/dist/esm/components/DHIS2PivotTable/interfaces/index.js +3 -0
  233. package/dist/{components/DHIS2PivotTable/services/engine.mjs → esm/components/DHIS2PivotTable/services/engine.js} +1 -7
  234. package/dist/esm/components/DHIS2PivotTable/services/engine.js.map +1 -0
  235. package/dist/{components/DHIS2PivotTable/state/engine.mjs → esm/components/DHIS2PivotTable/state/engine.js} +1 -1
  236. package/dist/esm/components/DHIS2PivotTable/state/engine.js.map +1 -0
  237. package/dist/{components/Map/DHIS2Map.mjs → esm/components/Map/DHIS2Map.js} +3 -3
  238. package/dist/esm/components/Map/DHIS2Map.js.map +1 -0
  239. package/dist/{components/Map/DHIS2Map.stories.mjs → esm/components/Map/DHIS2Map.stories.js} +1 -1
  240. package/dist/esm/components/Map/DHIS2Map.stories.js.map +1 -0
  241. package/dist/{components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.mjs → esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.js} +2 -2
  242. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.js.map +1 -0
  243. package/dist/{components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.mjs → esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js} +1 -1
  244. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js.map +1 -0
  245. package/dist/{components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.mjs → esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.js} +6 -6
  246. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.js.map +1 -0
  247. package/dist/{components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.mjs → esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js} +1 -1
  248. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js.map +1 -0
  249. package/dist/{components/Map/components/EarthEngineLayerConfiguration/components/AggregationSelector.mjs → esm/components/Map/components/EarthEngineLayerConfiguration/components/AggregationSelector.js} +2 -2
  250. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/AggregationSelector.js.map +1 -0
  251. package/dist/{components/Map/components/EarthEngineLayerConfiguration/components/ColorConfig.mjs → esm/components/Map/components/EarthEngineLayerConfiguration/components/ColorConfig.js} +3 -3
  252. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/ColorConfig.js.map +1 -0
  253. package/dist/{components/Map/components/EarthEngineLayerConfiguration/components/Name.mjs → esm/components/Map/components/EarthEngineLayerConfiguration/components/Name.js} +2 -2
  254. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/Name.js.map +1 -0
  255. package/dist/{components/Map/components/EarthEngineLayerConfiguration/components/PeriodSelector.mjs → esm/components/Map/components/EarthEngineLayerConfiguration/components/PeriodSelector.js} +2 -2
  256. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/PeriodSelector.js.map +1 -0
  257. package/dist/{components/Map/components/EarthEngineLayerConfiguration/components/StylesConfig.mjs → esm/components/Map/components/EarthEngineLayerConfiguration/components/StylesConfig.js} +3 -3
  258. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/StylesConfig.js.map +1 -0
  259. package/dist/{components/Map/components/EarthEngineLayerConfiguration/components/TypeField.mjs → esm/components/Map/components/EarthEngineLayerConfiguration/components/TypeField.js} +2 -2
  260. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/TypeField.js.map +1 -0
  261. package/dist/{components/Map/components/EarthEngineLayerConfiguration/hooks/data.mjs → esm/components/Map/components/EarthEngineLayerConfiguration/hooks/data.js} +4 -4
  262. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/hooks/data.js.map +1 -0
  263. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/index.js +4 -0
  264. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/index.js.map +1 -0
  265. package/dist/{components/Map/components/MapArea/index.mjs → esm/components/Map/components/MapArea/index.js} +41 -26
  266. package/dist/esm/components/Map/components/MapArea/index.js.map +1 -0
  267. package/dist/esm/components/Map/components/MapArea/interfaces/index.js +3 -0
  268. package/dist/{components/Map/components/MapControls/components/CustomControl/index.mjs → esm/components/Map/components/MapControls/components/CustomControl/index.js} +1 -1
  269. package/dist/esm/components/Map/components/MapControls/components/CustomControl/index.js.map +1 -0
  270. package/dist/{components/Map/components/MapControls/components/DownloadControl/index.mjs → esm/components/Map/components/MapControls/components/DownloadControl/index.js} +1 -1
  271. package/dist/esm/components/Map/components/MapControls/components/DownloadControl/index.js.map +1 -0
  272. package/dist/{components/Map/components/MapControls/components/FullscreenControl/index.mjs → esm/components/Map/components/MapControls/components/FullscreenControl/index.js} +1 -1
  273. package/dist/esm/components/Map/components/MapControls/components/FullscreenControl/index.js.map +1 -0
  274. package/dist/{components/Map/components/MapControls/index.mjs → esm/components/Map/components/MapControls/index.js} +17 -5
  275. package/dist/esm/components/Map/components/MapControls/index.js.map +1 -0
  276. package/dist/{components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.mjs → esm/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js} +2 -2
  277. package/dist/esm/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js.map +1 -0
  278. package/dist/{components/Map/components/MapLayer/components/BoundaryLayer/index.mjs → esm/components/Map/components/MapLayer/components/BoundaryLayer/index.js} +3 -3
  279. package/dist/esm/components/Map/components/MapLayer/components/BoundaryLayer/index.js.map +1 -0
  280. package/dist/{components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.mjs → esm/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js} +50 -15
  281. package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js.map +1 -0
  282. package/dist/{components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.mjs → esm/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js} +27 -9
  283. package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js.map +1 -0
  284. package/dist/{components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.mjs → esm/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js} +2 -2
  285. package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js.map +1 -0
  286. package/dist/{components/Map/components/MapLayer/components/GoogleEngineLayer/index.mjs → esm/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js} +5 -5
  287. package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js.map +1 -0
  288. package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +3 -0
  289. package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +31466 -0
  290. package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js.map +1 -0
  291. package/dist/{components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.mjs → esm/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js} +29 -23
  292. package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js.map +1 -0
  293. package/dist/{components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.mjs → esm/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js} +34 -23
  294. package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js.map +1 -0
  295. package/dist/esm/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +10 -0
  296. package/dist/esm/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css.map +1 -0
  297. package/dist/{components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.mjs → esm/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js} +1 -1
  298. package/dist/esm/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js.map +1 -0
  299. package/dist/{components/Map/components/MapLayer/components/LegendArea/index.mjs → esm/components/Map/components/MapLayer/components/LegendArea/index.js} +8 -8
  300. package/dist/esm/components/Map/components/MapLayer/components/LegendArea/index.js.map +1 -0
  301. package/dist/{components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.mjs → esm/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js} +20 -6
  302. package/dist/esm/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js.map +1 -0
  303. package/dist/{components/Map/components/MapLayer/components/PointLayer/hooks/index.mjs → esm/components/Map/components/MapLayer/components/PointLayer/hooks/index.js} +2 -2
  304. package/dist/esm/components/Map/components/MapLayer/components/PointLayer/hooks/index.js.map +1 -0
  305. package/dist/{components/Map/components/MapLayer/components/PointLayer/index.mjs → esm/components/Map/components/MapLayer/components/PointLayer/index.js} +3 -3
  306. package/dist/esm/components/Map/components/MapLayer/components/PointLayer/index.js.map +1 -0
  307. package/dist/{components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.mjs → esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js} +33 -5
  308. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js.map +1 -0
  309. package/dist/{components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.mjs → esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js} +27 -8
  310. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js.map +1 -0
  311. package/dist/{components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.mjs → esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js} +3 -3
  312. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js.map +1 -0
  313. package/dist/{components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.mjs → esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js} +3 -3
  314. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js.map +1 -0
  315. package/dist/{components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.mjs → esm/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js} +19 -5
  316. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js.map +1 -0
  317. package/dist/{components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.mjs → esm/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js} +7 -4
  318. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js.map +1 -0
  319. package/dist/{components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.mjs → esm/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js} +2 -2
  320. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js.map +1 -0
  321. package/dist/{components/Map/components/MapLayer/components/ThematicLayer/hooks/config.mjs → esm/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js} +2 -2
  322. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js.map +1 -0
  323. package/dist/{components/Map/components/MapLayer/components/ThematicLayer/index.mjs → esm/components/Map/components/MapLayer/components/ThematicLayer/index.js} +4 -4
  324. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/index.js.map +1 -0
  325. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +56 -0
  326. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css.map +1 -0
  327. package/dist/{components/Map/components/MapLayer/index.mjs → esm/components/Map/components/MapLayer/index.js} +5 -5
  328. package/dist/esm/components/Map/components/MapLayer/index.js.map +1 -0
  329. package/dist/esm/components/Map/components/MapLayer/interfaces/index.js +10 -0
  330. package/dist/esm/components/Map/components/MapLayer/interfaces/index.js.map +1 -0
  331. package/dist/{components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.mjs → esm/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js} +8 -8
  332. package/dist/esm/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js.map +1 -0
  333. package/dist/{components/Map/components/MapProvider/components/MapLayerProvider/index.mjs → esm/components/Map/components/MapProvider/components/MapLayerProvider/index.js} +4 -4
  334. package/dist/esm/components/Map/components/MapProvider/components/MapLayerProvider/index.js.map +1 -0
  335. package/dist/{components/Map/components/MapProvider/hooks/index.mjs → esm/components/Map/components/MapProvider/hooks/index.js} +2 -2
  336. package/dist/esm/components/Map/components/MapProvider/hooks/index.js.map +1 -0
  337. package/dist/{components/Map/components/MapProvider/index.mjs → esm/components/Map/components/MapProvider/index.js} +3 -3
  338. package/dist/esm/components/Map/components/MapProvider/index.js.map +1 -0
  339. package/dist/{components/Map/components/MapUpdater/index.mjs → esm/components/Map/components/MapUpdater/index.js} +2 -2
  340. package/dist/esm/components/Map/components/MapUpdater/index.js.map +1 -0
  341. package/dist/{components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.mjs → esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.js} +2 -2
  342. package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.js.map +1 -0
  343. package/dist/{components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.mjs → esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js} +1 -1
  344. package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js.map +1 -0
  345. package/dist/{components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.mjs → esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.js} +7 -7
  346. package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.js.map +1 -0
  347. package/dist/{components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.mjs → esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js} +1 -1
  348. package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js.map +1 -0
  349. package/dist/{components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.mjs → esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js} +16 -4
  350. package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js.map +1 -0
  351. package/dist/{components/Map/constants/colors.mjs → esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js} +1 -1
  352. package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js.map +1 -0
  353. package/dist/{components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.mjs → esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js} +3 -3
  354. package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js.map +1 -0
  355. package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +15 -0
  356. package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css.map +1 -0
  357. package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +12 -0
  358. package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css.map +1 -0
  359. package/dist/{components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.mjs → esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js} +13 -5
  360. package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js.map +1 -0
  361. package/dist/{components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.mjs → esm/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js} +3 -3
  362. package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js.map +1 -0
  363. package/dist/{components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.mjs → esm/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js} +1 -1
  364. package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js.map +1 -0
  365. package/dist/{components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.mjs → esm/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js} +1 -1
  366. package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js.map +1 -0
  367. package/dist/{components/Map/components/ThematicLayerConfiguration/components/RadiusField.mjs → esm/components/Map/components/ThematicLayerConfiguration/components/RadiusField.js} +1 -1
  368. package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/RadiusField.js.map +1 -0
  369. package/dist/{components/Map/components/ThematicLayerConfiguration/components/TypeField.mjs → esm/components/Map/components/ThematicLayerConfiguration/components/TypeField.js} +1 -1
  370. package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/TypeField.js.map +1 -0
  371. package/dist/esm/components/Map/components/ThematicLayerConfiguration/index.js +5 -0
  372. package/dist/esm/components/Map/components/ThematicLayerConfiguration/index.js.map +1 -0
  373. package/dist/esm/components/Map/components/ThematicLayerConfiguration/types/index.js +3 -0
  374. package/dist/{components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.mjs → esm/components/Map/constants/colors.js} +1 -1
  375. package/dist/esm/components/Map/constants/colors.js.map +1 -0
  376. package/dist/{components/Map/constants/legendSet.mjs → esm/components/Map/constants/legendSet.js} +1 -1
  377. package/dist/esm/components/Map/constants/legendSet.js.map +1 -0
  378. package/dist/{components/Map/hooks/map.mjs → esm/components/Map/hooks/map.js} +2 -2
  379. package/dist/esm/components/Map/hooks/map.js.map +1 -0
  380. package/dist/esm/components/Map/index.js +7 -0
  381. package/dist/esm/components/Map/index.js.map +1 -0
  382. package/dist/esm/components/Map/interfaces/index.js +3 -0
  383. package/dist/{components/Map/state/index.mjs → esm/components/Map/state/index.js} +1 -1
  384. package/dist/esm/components/Map/state/index.js.map +1 -0
  385. package/dist/{components/Map/utils/colors.mjs → esm/components/Map/utils/colors.js} +13 -5
  386. package/dist/esm/components/Map/utils/colors.js.map +1 -0
  387. package/dist/{components/Map/utils/helpers.mjs → esm/components/Map/utils/helpers.js} +1 -1
  388. package/dist/esm/components/Map/utils/helpers.js.map +1 -0
  389. package/dist/{components/Map/utils/map.mjs → esm/components/Map/utils/map.js} +16 -5
  390. package/dist/esm/components/Map/utils/map.js.map +1 -0
  391. package/dist/{components/SingleValueContainer/SingleValueContainer.stories.mjs → esm/components/SingleValueContainer/SingleValueContainer.stories.js} +1 -1
  392. package/dist/esm/components/SingleValueContainer/SingleValueContainer.stories.js.map +1 -0
  393. package/dist/{components/SingleValueContainer/SingleValueVisualizer.mjs → esm/components/SingleValueContainer/SingleValueVisualizer.js} +4 -4
  394. package/dist/esm/components/SingleValueContainer/SingleValueVisualizer.js.map +1 -0
  395. package/dist/{components/SingleValueContainer/components/SingleValueItem/SingleValueItem.mjs → esm/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js} +2 -2
  396. package/dist/esm/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js.map +1 -0
  397. package/dist/{components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.mjs → esm/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js} +1 -1
  398. package/dist/esm/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js.map +1 -0
  399. package/dist/esm/components/SingleValueContainer/index.js +5 -0
  400. package/dist/esm/components/SingleValueContainer/index.js.map +1 -0
  401. package/dist/esm/components/SingleValueContainer/styles/SingleValueContainer.module.css +32 -0
  402. package/dist/esm/components/SingleValueContainer/styles/SingleValueContainer.module.css.map +1 -0
  403. package/dist/esm/components/SingleValueContainer/types/props.js +3 -0
  404. package/dist/{components/Visualization/components/AnalyticsDataProvider/index.mjs → esm/components/Visualization/components/AnalyticsDataProvider/index.js} +38 -11
  405. package/dist/esm/components/Visualization/components/AnalyticsDataProvider/index.js.map +1 -0
  406. package/dist/{components/Visualization/components/DimensionsProvider/index.mjs → esm/components/Visualization/components/DimensionsProvider/index.js} +1 -1
  407. package/dist/esm/components/Visualization/components/DimensionsProvider/index.js.map +1 -0
  408. package/dist/{components/Visualization/components/LayoutProvider/index.mjs → esm/components/Visualization/components/LayoutProvider/index.js} +6 -5
  409. package/dist/esm/components/Visualization/components/LayoutProvider/index.js.map +1 -0
  410. package/dist/{components/Visualization/components/VisualizationDimensionSelector/index.mjs → esm/components/Visualization/components/VisualizationDimensionSelector/index.js} +4 -4
  411. package/dist/esm/components/Visualization/components/VisualizationDimensionSelector/index.js.map +1 -0
  412. package/dist/{components/Visualization/components/VisualizationProvider/index.mjs → esm/components/Visualization/components/VisualizationProvider/index.js} +12 -6
  413. package/dist/esm/components/Visualization/components/VisualizationProvider/index.js.map +1 -0
  414. package/dist/{components/Visualization/components/VisualizationSelector/index.mjs → esm/components/Visualization/components/VisualizationSelector/index.js} +8 -8
  415. package/dist/esm/components/Visualization/components/VisualizationSelector/index.js.map +1 -0
  416. package/dist/{components/Visualization/components/VisualizationTypeProvider/index.mjs → esm/components/Visualization/components/VisualizationTypeProvider/index.js} +6 -2
  417. package/dist/esm/components/Visualization/components/VisualizationTypeProvider/index.js.map +1 -0
  418. package/dist/{components/Visualization/components/VisualizationTypeSelector/index.mjs → esm/components/Visualization/components/VisualizationTypeSelector/index.js} +24 -8
  419. package/dist/esm/components/Visualization/components/VisualizationTypeSelector/index.js.map +1 -0
  420. package/dist/{components/Visualization/index.mjs → esm/components/Visualization/index.js} +5 -5
  421. package/dist/esm/components/Visualization/index.js.map +1 -0
  422. package/dist/esm/index.js +8 -0
  423. package/dist/esm/index.js.map +1 -0
  424. package/dist/index.js +18 -18
  425. package/dist/index.js.map +1 -1
  426. package/dist/types/components/ChartAnalytics/DHIS2Chart.d.ts +4 -4
  427. package/dist/types/components/ChartAnalytics/DHIS2Chart.d.ts.map +1 -1
  428. package/dist/types/components/ChartAnalytics/components/DownloadMenu/components/Menu.d.ts +2 -2
  429. package/dist/types/components/ChartAnalytics/components/DownloadMenu/components/Menu.d.ts.map +1 -1
  430. package/dist/types/components/ChartAnalytics/components/DownloadMenu/index.d.ts +2 -2
  431. package/dist/types/components/ChartAnalytics/components/DownloadMenu/index.d.ts.map +1 -1
  432. package/dist/types/components/ChartAnalytics/hooks/useChart.d.ts +1 -1
  433. package/dist/types/components/ChartAnalytics/hooks/useChart.d.ts.map +1 -1
  434. package/dist/types/components/ChartAnalytics/index.d.ts +1 -1
  435. package/dist/types/components/ChartAnalytics/index.d.ts.map +1 -1
  436. package/dist/types/components/ChartAnalytics/models/bar.d.ts +1 -1
  437. package/dist/types/components/ChartAnalytics/models/bar.d.ts.map +1 -1
  438. package/dist/types/components/ChartAnalytics/models/column.d.ts +1 -1
  439. package/dist/types/components/ChartAnalytics/models/column.d.ts.map +1 -1
  440. package/dist/types/components/ChartAnalytics/models/index.d.ts +1 -1
  441. package/dist/types/components/ChartAnalytics/models/index.d.ts.map +1 -1
  442. package/dist/types/components/ChartAnalytics/models/line.d.ts +1 -1
  443. package/dist/types/components/ChartAnalytics/models/line.d.ts.map +1 -1
  444. package/dist/types/components/ChartAnalytics/models/multi-series.d.ts +1 -1
  445. package/dist/types/components/ChartAnalytics/models/multi-series.d.ts.map +1 -1
  446. package/dist/types/components/ChartAnalytics/models/pie.d.ts +1 -1
  447. package/dist/types/components/ChartAnalytics/models/pie.d.ts.map +1 -1
  448. package/dist/types/components/ChartAnalytics/services/export.d.ts.map +1 -1
  449. package/dist/types/components/ChartAnalytics/utils/chart.d.ts +2 -2
  450. package/dist/types/components/ChartAnalytics/utils/chart.d.ts.map +1 -1
  451. package/dist/types/components/CircularProgressDashboard/CircularProgressIndicator.d.ts +2 -2
  452. package/dist/types/components/CircularProgressDashboard/CircularProgressIndicator.d.ts.map +1 -1
  453. package/dist/types/components/CircularProgressDashboard/index.d.ts +2 -2
  454. package/dist/types/components/CircularProgressDashboard/index.d.ts.map +1 -1
  455. package/dist/types/components/DHIS2PivotTable/DHIS2PivotTable.d.ts +2 -2
  456. package/dist/types/components/DHIS2PivotTable/DHIS2PivotTable.d.ts.map +1 -1
  457. package/dist/types/components/DHIS2PivotTable/components/TableHeaders/index.d.ts +1 -1
  458. package/dist/types/components/DHIS2PivotTable/components/TableHeaders/index.d.ts.map +1 -1
  459. package/dist/types/components/DHIS2PivotTable/index.d.ts +2 -2
  460. package/dist/types/components/DHIS2PivotTable/index.d.ts.map +1 -1
  461. package/dist/types/components/DHIS2PivotTable/services/engine.d.ts +1 -1
  462. package/dist/types/components/DHIS2PivotTable/services/engine.d.ts.map +1 -1
  463. package/dist/types/components/DHIS2PivotTable/state/engine.d.ts +2 -2
  464. package/dist/types/components/DHIS2PivotTable/state/engine.d.ts.map +1 -1
  465. package/dist/types/components/Map/DHIS2Map.d.ts +1 -1
  466. package/dist/types/components/Map/DHIS2Map.d.ts.map +1 -1
  467. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.d.ts +2 -2
  468. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.d.ts.map +1 -1
  469. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/components/AggregationSelector.d.ts +1 -1
  470. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/components/AggregationSelector.d.ts.map +1 -1
  471. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/components/ColorConfig.d.ts +1 -1
  472. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/components/ColorConfig.d.ts.map +1 -1
  473. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/components/Name.d.ts +1 -1
  474. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/components/Name.d.ts.map +1 -1
  475. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/components/PeriodSelector.d.ts +1 -1
  476. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/components/PeriodSelector.d.ts.map +1 -1
  477. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/components/StylesConfig.d.ts +1 -1
  478. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/components/StylesConfig.d.ts.map +1 -1
  479. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/components/TypeField.d.ts +1 -1
  480. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/components/TypeField.d.ts.map +1 -1
  481. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/hooks/data.d.ts +1 -1
  482. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/hooks/data.d.ts.map +1 -1
  483. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/index.d.ts +2 -2
  484. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/index.d.ts.map +1 -1
  485. package/dist/types/components/Map/components/MapArea/index.d.ts +1 -1
  486. package/dist/types/components/Map/components/MapArea/index.d.ts.map +1 -1
  487. package/dist/types/components/Map/components/MapControls/index.d.ts +2 -2
  488. package/dist/types/components/Map/components/MapControls/index.d.ts.map +1 -1
  489. package/dist/types/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.d.ts +1 -1
  490. package/dist/types/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.d.ts.map +1 -1
  491. package/dist/types/components/Map/components/MapLayer/components/BoundaryLayer/index.d.ts +2 -2
  492. package/dist/types/components/Map/components/MapLayer/components/BoundaryLayer/index.d.ts.map +1 -1
  493. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.d.ts +2 -2
  494. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.d.ts.map +1 -1
  495. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.d.ts +1 -1
  496. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.d.ts.map +1 -1
  497. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.d.ts +2 -2
  498. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.d.ts.map +1 -1
  499. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/index.d.ts +1 -1
  500. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/index.d.ts.map +1 -1
  501. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.d.ts +1 -1
  502. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.d.ts.map +1 -1
  503. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.d.ts +2 -2
  504. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.d.ts.map +1 -1
  505. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.d.ts +2 -2
  506. package/dist/types/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.d.ts.map +1 -1
  507. package/dist/types/components/Map/components/MapLayer/components/LegendArea/index.d.ts +3 -3
  508. package/dist/types/components/Map/components/MapLayer/components/LegendArea/index.d.ts.map +1 -1
  509. package/dist/types/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.d.ts.map +1 -1
  510. package/dist/types/components/Map/components/MapLayer/components/PointLayer/hooks/index.d.ts +1 -1
  511. package/dist/types/components/Map/components/MapLayer/components/PointLayer/hooks/index.d.ts.map +1 -1
  512. package/dist/types/components/Map/components/MapLayer/components/PointLayer/index.d.ts +1 -1
  513. package/dist/types/components/Map/components/MapLayer/components/PointLayer/index.d.ts.map +1 -1
  514. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.d.ts +1 -1
  515. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.d.ts.map +1 -1
  516. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.d.ts +2 -2
  517. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.d.ts.map +1 -1
  518. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.d.ts +1 -1
  519. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.d.ts.map +1 -1
  520. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.d.ts +2 -2
  521. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.d.ts.map +1 -1
  522. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.d.ts +1 -1
  523. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.d.ts.map +1 -1
  524. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.d.ts +4 -4
  525. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.d.ts.map +1 -1
  526. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.d.ts +2 -2
  527. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.d.ts.map +1 -1
  528. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.d.ts +1 -1
  529. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.d.ts.map +1 -1
  530. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/index.d.ts +1 -1
  531. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/index.d.ts.map +1 -1
  532. package/dist/types/components/Map/components/MapLayer/index.d.ts +2 -2
  533. package/dist/types/components/Map/components/MapLayer/index.d.ts.map +1 -1
  534. package/dist/types/components/Map/components/MapLayer/interfaces/index.d.ts +4 -4
  535. package/dist/types/components/Map/components/MapLayer/interfaces/index.d.ts.map +1 -1
  536. package/dist/types/components/Map/components/MapProvider/components/MapLayerProvider/index.d.ts +2 -2
  537. package/dist/types/components/Map/components/MapProvider/components/MapLayerProvider/index.d.ts.map +1 -1
  538. package/dist/types/components/Map/components/MapProvider/hooks/index.d.ts +3 -3
  539. package/dist/types/components/Map/components/MapProvider/index.d.ts +2 -2
  540. package/dist/types/components/Map/components/MapProvider/index.d.ts.map +1 -1
  541. package/dist/types/components/Map/components/MapUpdater/index.d.ts +1 -1
  542. package/dist/types/components/Map/components/MapUpdater/index.d.ts.map +1 -1
  543. package/dist/types/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.d.ts +2 -2
  544. package/dist/types/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.d.ts.map +1 -1
  545. package/dist/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.d.ts +1 -1
  546. package/dist/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.d.ts.map +1 -1
  547. package/dist/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.d.ts +1 -1
  548. package/dist/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.d.ts.map +1 -1
  549. package/dist/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.d.ts +1 -1
  550. package/dist/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.d.ts.map +1 -1
  551. package/dist/types/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.d.ts +1 -1
  552. package/dist/types/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.d.ts.map +1 -1
  553. package/dist/types/components/Map/components/ThematicLayerConfiguration/index.d.ts +3 -3
  554. package/dist/types/components/Map/components/ThematicLayerConfiguration/index.d.ts.map +1 -1
  555. package/dist/types/components/Map/hooks/map.d.ts.map +1 -1
  556. package/dist/types/components/Map/index.d.ts +5 -5
  557. package/dist/types/components/Map/index.d.ts.map +1 -1
  558. package/dist/types/components/Map/interfaces/index.d.ts +2 -2
  559. package/dist/types/components/Map/interfaces/index.d.ts.map +1 -1
  560. package/dist/types/components/Map/state/index.d.ts +2 -2
  561. package/dist/types/components/Map/state/index.d.ts.map +1 -1
  562. package/dist/types/components/Map/utils/colors.d.ts +1 -1
  563. package/dist/types/components/Map/utils/colors.d.ts.map +1 -1
  564. package/dist/types/components/Map/utils/map.d.ts.map +1 -1
  565. package/dist/types/components/SingleValueContainer/SingleValueVisualizer.d.ts +3 -3
  566. package/dist/types/components/SingleValueContainer/SingleValueVisualizer.d.ts.map +1 -1
  567. package/dist/types/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.d.ts +1 -1
  568. package/dist/types/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.d.ts.map +1 -1
  569. package/dist/types/components/SingleValueContainer/index.d.ts +3 -2
  570. package/dist/types/components/SingleValueContainer/index.d.ts.map +1 -1
  571. package/dist/types/components/Visualization/components/AnalyticsDataProvider/index.d.ts +1 -1
  572. package/dist/types/components/Visualization/components/AnalyticsDataProvider/index.d.ts.map +1 -1
  573. package/dist/types/components/Visualization/components/LayoutProvider/index.d.ts +2 -2
  574. package/dist/types/components/Visualization/components/LayoutProvider/index.d.ts.map +1 -1
  575. package/dist/types/components/Visualization/components/VisualizationDimensionSelector/index.d.ts +1 -1
  576. package/dist/types/components/Visualization/components/VisualizationDimensionSelector/index.d.ts.map +1 -1
  577. package/dist/types/components/Visualization/components/VisualizationProvider/index.d.ts +4 -4
  578. package/dist/types/components/Visualization/components/VisualizationProvider/index.d.ts.map +1 -1
  579. package/dist/types/components/Visualization/components/VisualizationSelector/index.d.ts +10 -10
  580. package/dist/types/components/Visualization/components/VisualizationSelector/index.d.ts.map +1 -1
  581. package/dist/types/components/Visualization/components/VisualizationTypeProvider/index.d.ts +2 -2
  582. package/dist/types/components/Visualization/components/VisualizationTypeProvider/index.d.ts.map +1 -1
  583. package/dist/types/components/Visualization/components/VisualizationTypeSelector/index.d.ts +1 -1
  584. package/dist/types/components/Visualization/components/VisualizationTypeSelector/index.d.ts.map +1 -1
  585. package/dist/types/components/Visualization/index.d.ts +6 -6
  586. package/dist/types/components/Visualization/index.d.ts.map +1 -1
  587. package/dist/types/index.d.ts +6 -6
  588. package/dist/types/index.d.ts.map +1 -1
  589. package/package.json +5 -5
  590. package/dist/components/ChartAnalytics/ChartAnalytics.stories.mjs.map +0 -1
  591. package/dist/components/ChartAnalytics/DHIS2Chart.mjs.map +0 -1
  592. package/dist/components/ChartAnalytics/components/DownloadMenu/components/Menu.mjs.map +0 -1
  593. package/dist/components/ChartAnalytics/components/DownloadMenu/constants/menu.mjs.map +0 -1
  594. package/dist/components/ChartAnalytics/components/DownloadMenu/index.mjs.map +0 -1
  595. package/dist/components/ChartAnalytics/hooks/useChart.mjs.map +0 -1
  596. package/dist/components/ChartAnalytics/index.mjs +0 -3
  597. package/dist/components/ChartAnalytics/index.mjs.map +0 -1
  598. package/dist/components/ChartAnalytics/models/bar.mjs.map +0 -1
  599. package/dist/components/ChartAnalytics/models/column.mjs.map +0 -1
  600. package/dist/components/ChartAnalytics/models/index.mjs.map +0 -1
  601. package/dist/components/ChartAnalytics/models/line.mjs.map +0 -1
  602. package/dist/components/ChartAnalytics/models/multi-series.mjs.map +0 -1
  603. package/dist/components/ChartAnalytics/models/pie.mjs.map +0 -1
  604. package/dist/components/ChartAnalytics/services/export.mjs.map +0 -1
  605. package/dist/components/ChartAnalytics/types/props.mjs +0 -3
  606. package/dist/components/ChartAnalytics/utils/chart.mjs.map +0 -1
  607. package/dist/components/CircularProgressDashboard/CircularProgressIndicator.mjs.map +0 -1
  608. package/dist/components/CircularProgressDashboard/CircularProgressIndicator.stories.mjs.map +0 -1
  609. package/dist/components/CircularProgressDashboard/index.mjs +0 -4
  610. package/dist/components/CircularProgressDashboard/index.mjs.map +0 -1
  611. package/dist/components/CircularProgressDashboard/types/props.mjs +0 -3
  612. package/dist/components/DHIS2PivotTable/DHIS2PivotTable.mjs.map +0 -1
  613. package/dist/components/DHIS2PivotTable/DHIS2PivotTable.stories.mjs.map +0 -1
  614. package/dist/components/DHIS2PivotTable/components/Table/index.mjs.map +0 -1
  615. package/dist/components/DHIS2PivotTable/components/TableBody/index.mjs.map +0 -1
  616. package/dist/components/DHIS2PivotTable/components/TableHeaders/index.mjs.map +0 -1
  617. package/dist/components/DHIS2PivotTable/index.mjs +0 -4
  618. package/dist/components/DHIS2PivotTable/index.mjs.map +0 -1
  619. package/dist/components/DHIS2PivotTable/interfaces/index.mjs +0 -3
  620. package/dist/components/DHIS2PivotTable/services/engine.mjs.map +0 -1
  621. package/dist/components/DHIS2PivotTable/state/engine.mjs.map +0 -1
  622. package/dist/components/Map/DHIS2Map.mjs.map +0 -1
  623. package/dist/components/Map/DHIS2Map.stories.mjs.map +0 -1
  624. package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.mjs.map +0 -1
  625. package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.mjs.map +0 -1
  626. package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.mjs.map +0 -1
  627. package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.mjs.map +0 -1
  628. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/AggregationSelector.mjs.map +0 -1
  629. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/ColorConfig.mjs.map +0 -1
  630. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/Name.mjs.map +0 -1
  631. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/PeriodSelector.mjs.map +0 -1
  632. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/StylesConfig.mjs.map +0 -1
  633. package/dist/components/Map/components/EarthEngineLayerConfiguration/components/TypeField.mjs.map +0 -1
  634. package/dist/components/Map/components/EarthEngineLayerConfiguration/hooks/data.mjs.map +0 -1
  635. package/dist/components/Map/components/EarthEngineLayerConfiguration/index.mjs +0 -4
  636. package/dist/components/Map/components/EarthEngineLayerConfiguration/index.mjs.map +0 -1
  637. package/dist/components/Map/components/MapArea/index.mjs.map +0 -1
  638. package/dist/components/Map/components/MapArea/interfaces/index.mjs +0 -3
  639. package/dist/components/Map/components/MapControls/components/CustomControl/index.mjs.map +0 -1
  640. package/dist/components/Map/components/MapControls/components/DownloadControl/index.mjs.map +0 -1
  641. package/dist/components/Map/components/MapControls/components/FullscreenControl/index.mjs.map +0 -1
  642. package/dist/components/Map/components/MapControls/index.mjs.map +0 -1
  643. package/dist/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.mjs.map +0 -1
  644. package/dist/components/Map/components/MapLayer/components/BoundaryLayer/index.mjs.map +0 -1
  645. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.mjs.map +0 -1
  646. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.mjs.map +0 -1
  647. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.mjs.map +0 -1
  648. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/index.mjs.map +0 -1
  649. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.mjs +0 -3
  650. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.mjs.map +0 -1
  651. package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.mjs.map +0 -1
  652. package/dist/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.mjs.map +0 -1
  653. package/dist/components/Map/components/MapLayer/components/LegendArea/index.mjs.map +0 -1
  654. package/dist/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.mjs.map +0 -1
  655. package/dist/components/Map/components/MapLayer/components/PointLayer/hooks/index.mjs.map +0 -1
  656. package/dist/components/Map/components/MapLayer/components/PointLayer/index.mjs.map +0 -1
  657. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.mjs.map +0 -1
  658. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.mjs.map +0 -1
  659. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.mjs.map +0 -1
  660. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.mjs.map +0 -1
  661. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.mjs.map +0 -1
  662. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.mjs.map +0 -1
  663. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.mjs.map +0 -1
  664. package/dist/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.mjs.map +0 -1
  665. package/dist/components/Map/components/MapLayer/components/ThematicLayer/index.mjs.map +0 -1
  666. package/dist/components/Map/components/MapLayer/index.mjs.map +0 -1
  667. package/dist/components/Map/components/MapLayer/interfaces/index.mjs +0 -5
  668. package/dist/components/Map/components/MapLayer/interfaces/index.mjs.map +0 -1
  669. package/dist/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.mjs.map +0 -1
  670. package/dist/components/Map/components/MapProvider/components/MapLayerProvider/index.mjs.map +0 -1
  671. package/dist/components/Map/components/MapProvider/hooks/index.mjs.map +0 -1
  672. package/dist/components/Map/components/MapProvider/index.mjs.map +0 -1
  673. package/dist/components/Map/components/MapUpdater/index.mjs.map +0 -1
  674. package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.mjs.map +0 -1
  675. package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.mjs.map +0 -1
  676. package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.mjs.map +0 -1
  677. package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.mjs.map +0 -1
  678. package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.mjs.map +0 -1
  679. package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.mjs.map +0 -1
  680. package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.mjs.map +0 -1
  681. package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.mjs.map +0 -1
  682. package/dist/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.mjs.map +0 -1
  683. package/dist/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.mjs.map +0 -1
  684. package/dist/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.mjs.map +0 -1
  685. package/dist/components/Map/components/ThematicLayerConfiguration/components/RadiusField.mjs.map +0 -1
  686. package/dist/components/Map/components/ThematicLayerConfiguration/components/TypeField.mjs.map +0 -1
  687. package/dist/components/Map/components/ThematicLayerConfiguration/index.mjs +0 -5
  688. package/dist/components/Map/components/ThematicLayerConfiguration/index.mjs.map +0 -1
  689. package/dist/components/Map/components/ThematicLayerConfiguration/types/index.mjs +0 -3
  690. package/dist/components/Map/constants/colors.mjs.map +0 -1
  691. package/dist/components/Map/constants/legendSet.mjs.map +0 -1
  692. package/dist/components/Map/hooks/map.mjs.map +0 -1
  693. package/dist/components/Map/index.mjs +0 -7
  694. package/dist/components/Map/index.mjs.map +0 -1
  695. package/dist/components/Map/interfaces/index.mjs +0 -3
  696. package/dist/components/Map/state/index.mjs.map +0 -1
  697. package/dist/components/Map/utils/colors.mjs.map +0 -1
  698. package/dist/components/Map/utils/helpers.mjs.map +0 -1
  699. package/dist/components/Map/utils/map.mjs.map +0 -1
  700. package/dist/components/SingleValueContainer/SingleValueContainer.stories.mjs.map +0 -1
  701. package/dist/components/SingleValueContainer/SingleValueVisualizer.mjs.map +0 -1
  702. package/dist/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.mjs.map +0 -1
  703. package/dist/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.mjs.map +0 -1
  704. package/dist/components/SingleValueContainer/index.mjs +0 -4
  705. package/dist/components/SingleValueContainer/index.mjs.map +0 -1
  706. package/dist/components/SingleValueContainer/types/props.mjs +0 -3
  707. package/dist/components/Visualization/components/AnalyticsDataProvider/index.mjs.map +0 -1
  708. package/dist/components/Visualization/components/DimensionsProvider/index.mjs.map +0 -1
  709. package/dist/components/Visualization/components/LayoutProvider/index.mjs.map +0 -1
  710. package/dist/components/Visualization/components/VisualizationDimensionSelector/index.mjs.map +0 -1
  711. package/dist/components/Visualization/components/VisualizationProvider/index.mjs.map +0 -1
  712. package/dist/components/Visualization/components/VisualizationSelector/index.mjs.map +0 -1
  713. package/dist/components/Visualization/components/VisualizationTypeProvider/index.mjs.map +0 -1
  714. package/dist/components/Visualization/components/VisualizationTypeSelector/index.mjs.map +0 -1
  715. package/dist/components/Visualization/index.mjs.map +0 -1
  716. package/dist/index.mjs +0 -8
  717. package/dist/index.mjs.map +0 -1
  718. /package/dist/{components/ChartAnalytics/components/DownloadMenu/interfaces/menu.mjs.map → esm/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js.map} +0 -0
  719. /package/dist/{components/ChartAnalytics/types/props.mjs.map → esm/components/ChartAnalytics/types/props.js.map} +0 -0
  720. /package/dist/{components/CircularProgressDashboard/types/props.mjs.map → esm/components/CircularProgressDashboard/types/props.js.map} +0 -0
  721. /package/dist/{components/DHIS2PivotTable/interfaces/index.mjs.map → esm/components/DHIS2PivotTable/interfaces/index.js.map} +0 -0
  722. /package/dist/{components/Map/components/MapArea/interfaces/index.mjs.map → esm/components/Map/components/MapArea/interfaces/index.js.map} +0 -0
  723. /package/dist/{components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.mjs.map → esm/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js.map} +0 -0
  724. /package/dist/{components/Map/components/ThematicLayerConfiguration/types/index.mjs.map → esm/components/Map/components/ThematicLayerConfiguration/types/index.js.map} +0 -0
  725. /package/dist/{components/Map/interfaces/index.mjs.map → esm/components/Map/interfaces/index.js.map} +0 -0
  726. /package/dist/{components/SingleValueContainer/types/props.mjs.map → esm/components/SingleValueContainer/types/props.js.map} +0 -0
@@ -1,29 +1,36 @@
1
1
  'use strict';
2
2
 
3
- var utils = require('../utils');
3
+ var index_js = require('../utils/index.js');
4
4
  var lodash = require('lodash');
5
- var EE = require('./api');
5
+ var EE = require('./api.js');
6
6
 
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
8
24
 
9
- var EE__default = /*#__PURE__*/_interopDefault(EE);
25
+ var EE__namespace = /*#__PURE__*/_interopNamespace(EE);
10
26
 
11
- const ee = EE__default.default;
27
+ const ee = EE__namespace;
12
28
  window.ee = ee;
13
29
  const FEATURE_STYLE = { color: "FFA500", strokeWidth: 2 };
14
30
  const DEFAULT_TILE_SCALE = 1;
15
31
  class EarthEngine {
16
- token;
17
- options;
18
- refresh;
19
- orgUnits;
20
- initialized = false;
21
- period;
22
- instance;
23
- scale;
24
- image;
25
- aggregationData;
26
32
  constructor({ options }) {
33
+ this.initialized = false;
27
34
  this.options = options;
28
35
  this.initialized = true;
29
36
  this.getInstance();
@@ -90,7 +97,7 @@ class EarthEngine {
90
97
  }
91
98
  const imageCollection = this.instance.distinct("system:time_start").sort("system:time_start", false);
92
99
  const featureCollection = ee.FeatureCollection(imageCollection).select(["system:time_start", "system:time_end"], null, false);
93
- return utils.getInfo(featureCollection);
100
+ return index_js.getInfo(featureCollection);
94
101
  }
95
102
  async info() {
96
103
  return new Promise((resolve) => {
@@ -102,10 +109,10 @@ class EarthEngine {
102
109
  const { type } = this.options;
103
110
  switch (type) {
104
111
  case "ImageCollection":
105
- this.scale = await utils.getScale(this.instance.first());
112
+ this.scale = await index_js.getScale(this.instance.first());
106
113
  break;
107
114
  default:
108
- this.scale = await utils.getScale(this.getImage());
115
+ this.scale = await index_js.getScale(this.getImage());
109
116
  }
110
117
  } catch (e) {
111
118
  }
@@ -119,7 +126,7 @@ class EarthEngine {
119
126
  const count = dataset.filterBounds(feature.geometry()).size();
120
127
  return feature.set("count", count);
121
128
  }).select(["count"], null, false);
122
- return utils.getInfo(aggFeatures).then(utils.getFeatureCollectionProperties);
129
+ return index_js.getInfo(aggFeatures).then(index_js.getFeatureCollectionProperties);
123
130
  }
124
131
  async getHistogramAggregations() {
125
132
  try {
@@ -129,10 +136,10 @@ class EarthEngine {
129
136
  const legend = this.options.legend?.items;
130
137
  const scale = this.scale;
131
138
  const tileScale = this.options.tileScale ?? DEFAULT_TILE_SCALE;
132
- const scaleValue = await utils.getInfo(scale);
139
+ const scaleValue = await index_js.getInfo(scale);
133
140
  const image = this.getImage();
134
141
  const features = Object.values(
135
- await utils.getInfo(
142
+ await index_js.getInfo(
136
143
  image.reduceRegions({
137
144
  collection,
138
145
  reducer,
@@ -140,7 +147,7 @@ class EarthEngine {
140
147
  tileScale
141
148
  }).select(["histogram"], null, false)
142
149
  ).then(
143
- (data) => utils.getHistogramStatistics({
150
+ (data) => index_js.getHistogramStatistics({
144
151
  data,
145
152
  scale: scaleValue,
146
153
  aggregationType: aggregation,
@@ -170,11 +177,11 @@ class EarthEngine {
170
177
  const aggregations = this.options.aggregations;
171
178
  if (!aggregations)
172
179
  return;
173
- if (utils.hasClasses(lodash.head(aggregations) ?? "")) {
180
+ if (index_js.hasClasses(lodash.head(aggregations) ?? "")) {
174
181
  this.aggregationData = await this.getHistogramAggregations();
175
182
  return;
176
183
  }
177
- const reducer = utils.combineReducers(ee)(aggregations);
184
+ const reducer = index_js.combineReducers(ee)(aggregations);
178
185
  const collection = this.getFeatureCollection();
179
186
  const image = this.getImage();
180
187
  const scale = this.scale;
@@ -185,21 +192,28 @@ class EarthEngine {
185
192
  scale,
186
193
  tileScale
187
194
  }).select(aggregations, null, false);
188
- const features = Object.values(utils.getFeatureCollectionProperties(await utils.getInfo(aggregatedFeatures)));
195
+ const features = Object.values(
196
+ index_js.getFeatureCollectionProperties(await index_js.getInfo(aggregatedFeatures))
197
+ );
189
198
  if (!lodash.isEmpty(features) && features.length === this.orgUnits?.length) {
190
- this.aggregationData = features.map((feature, index) => {
191
- return {
192
- orgUnit: this.orgUnits?.[index],
193
- data: feature
194
- };
195
- });
199
+ this.aggregationData = features.map(
200
+ (feature, index) => {
201
+ return {
202
+ orgUnit: this.orgUnits?.[index],
203
+ data: feature
204
+ };
205
+ }
206
+ );
196
207
  }
197
208
  }
198
209
  getAggregation(orgUnit) {
199
210
  if (lodash.isEmpty(this.aggregationData)) {
200
211
  return;
201
212
  }
202
- return lodash.find(this.aggregationData, (aggregation) => aggregation.orgUnit.id === orgUnit.id);
213
+ return lodash.find(
214
+ this.aggregationData,
215
+ (aggregation) => aggregation.orgUnit.id === orgUnit.id
216
+ );
203
217
  }
204
218
  async url() {
205
219
  if (!this.initialized)
@@ -240,12 +254,20 @@ class EarthEngine {
240
254
  case "Feature":
241
255
  return ee.Feature(geometry);
242
256
  case "FeatureCollection":
243
- return ee.FeatureCollection([...features.map((feature) => ee.Feature(this.getGeometryByType(feature)))]);
257
+ return ee.FeatureCollection([
258
+ ...features.map(
259
+ (feature) => ee.Feature(this.getGeometryByType(feature))
260
+ )
261
+ ]);
244
262
  }
245
263
  }
246
264
  getFeatureCollection() {
247
265
  if (this.orgUnits) {
248
- return ee.FeatureCollection(this.orgUnits.map((orgUnit) => this.getFeatureByType(orgUnit.geoJSON)));
266
+ return ee.FeatureCollection(
267
+ this.orgUnits.map(
268
+ (orgUnit) => this.getFeatureByType(orgUnit.geoJSON)
269
+ )
270
+ );
249
271
  } else {
250
272
  throw "You need to set org units first";
251
273
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.ts"],"names":["token"],"mappings":"AAMA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,MAAM,MAAM,eAAe;AAWpC,OAAO,QAAQ;AAEf,MAAM,KAAK;AAEX,OAAO,KAAK;AAEZ,MAAM,gBAAgB,EAAC,OAAO,UAAU,aAAa,EAAC;AACtD,MAAM,qBAAqB;AAEpB,MAAM,YAAY;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA,YAAY,EAAC,QAAO,GAAoC;AACpD,SAAK,UAAU;AACf,SAAK,cAAc;AACnB,SAAK,YAAY;AAAA,EACrB;AAAA,EAEA,aAAa,SAAS,OAAyB,SAAsC;AACjF,UAAM,YAAY;AAElB,aAAS,aAAa,UAA0B,UAAgC;AAC5E,cAAQ,EAAE,KAAK,CAAC,EAAC,OAAAA,OAAK,MAAmC;AACrD,iBAAS;AAAA,UACL,GAAGA;AAAA,UACH,YAAY,aAAa;AAAA,UACzB,OAAO,UAAU;AAAA,QACrB,CAAC;AAAA,MACL,CAAC;AAAA,IACL;AAEA,UAAM,IAAI,QAAQ,CAAC,SAAS,WAAW;AACnC,UAAI,GAAG,KAAK,aAAa,GAAG;AACxB,WAAG,WAAW,MAAM,MAAM,SAAS,MAAM;AAAA,MAC7C;AACA,UAAI,OAAO;AACP,cAAM,EAAC,cAAc,WAAW,WAAU,IAAI;AAC9C,WAAG,KAAK;AAAA,UACJ;AAAA,UACA,aAAa;AAAA,UACb;AAAA,UACA;AAAA,UACA;AAAA,UACA,MAAM;AACF,eAAG,WAAW,MAAM,MAAM,SAAS,MAAM;AAAA,UAC7C;AAAA,UACA;AAAA,QACJ;AACA,WAAG,KAAK,sBAAsB,YAAY;AAAA,MAC9C;AACA,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jC;AAAA,MACJ,KAAK;AACD,gBAAQ,KAAK,8BAA8B;AAC3C;AAAA,MACJ,KAAK;AACD,gBAAQ,KAAK,kBAAkB;AAC/B;AAAA,MACJ,KAAK;AACD,gBAAQ,KAAK,4BAA4B;AACzC;AAAA,MACJ;AACI,gBAAQ,KAAK,kBAAkB;AAAA,IACvC;AACA,YAAQ,KAAK,UAAU,KAAK;AAC5B,YAAQ,KAAK,UAAU,KAAK;AAC5B,SAAK,QAAQ;AACb,WAAO;AAAA,EACX;AACJ","sourcesContent":["import { MapOrgUnit } from \"../../../../../interfaces\";\nimport {\n\tEarthEngineOptions,\n\tEarthEngineToken,\n\tRefreshToken,\n} from \"../interfaces\";\nimport {\n\tcombineReducers,\n\tgetFeatureCollectionProperties,\n\tgetHistogramStatistics,\n\tgetInfo,\n\tgetScale,\n\thasClasses,\n} from \"../utils\";\nimport { find, head, isEmpty } from \"lodash\";\n\n// async function importEEModule(): Promise<any> {\n// // @ts-ignore\n// if (import.meta.env.STORYBOOK_BUILD === \"true\") {\n// return await import(\"@google/earthengine\");\n// }\n// return await import(\"./api\");\n// }\n// const EE = await importEEModule();\n//@ts-ignore\nimport EE from \"./api\";\n// @ts-ignore\nconst ee = EE as any;\n// @ts-ignore\nwindow.ee = ee;\n\nconst FEATURE_STYLE = {color: \"FFA500\", strokeWidth: 2};\nconst DEFAULT_TILE_SCALE = 1;\n\nexport class EarthEngine {\n token?: EarthEngineToken;\n options: EarthEngineOptions;\n refresh?: RefreshToken;\n orgUnits?: MapOrgUnit[];\n initialized = false;\n period?: string | string[];\n instance: any;\n scale?: any;\n image: any;\n aggregationData: any;\n\n constructor({options}: { options: EarthEngineOptions }) {\n this.options = options;\n this.initialized = true;\n this.getInstance();\n }\n\n static async setToken(token: EarthEngineToken, refresh: RefreshToken): Promise<void> {\n const tokenType = \"Bearer\";\n\n function refreshToken(authArgs: { scope: any }, callback: (props: any) => void) {\n refresh().then(({token}: { token: EarthEngineToken }) => {\n callback({\n ...token,\n token_type: tokenType ?? \"Bearer\",\n state: authArgs?.scope,\n });\n });\n }\n\n await new Promise((resolve, reject) => {\n if (ee.data.getAuthToken()) {\n ee.initialize(null, null, resolve, reject);\n }\n if (token) {\n const {access_token, client_id, expires_in} = token;\n ee.data.setAuthToken(\n client_id,\n tokenType ?? \"Bearer\",\n access_token,\n expires_in,\n null,\n () => {\n ee.initialize(null, null, resolve, reject);\n },\n false\n );\n ee.data.setAuthTokenRefresher(refreshToken);\n }\n resolve(\"Token not found\");\n });\n }\n\n setOrgUnits(orgUnits: MapOrgUnit[]): EarthEngine {\n this.orgUnits = orgUnits;\n return this;\n }\n\n setPeriod(period: string) {\n this.period = period;\n }\n\n async getValue(geoJSON: any, type: string) {\n return new Promise((resolve, reject) => {\n const point = this.getGeometryByType(geoJSON);\n const reducer = this.getReducerByType(type);\n const image = this.getImage();\n\n const reducedImage = image.reduceRegion(reducer, point, 1);\n\n reducedImage.evaluate((data: unknown, error: any) => {\n if (error) {\n reject(error);\n } else {\n resolve(data);\n }\n });\n });\n }\n\n async getPeriod() {\n const {type} = this.options;\n if (type !== \"ImageCollection\") {\n return;\n }\n\n const imageCollection = this.instance.distinct(\"system:time_start\").sort(\"system:time_start\", false);\n const featureCollection = ee.FeatureCollection(imageCollection).select([\"system:time_start\", \"system:time_end\"], null, false);\n\n return getInfo(featureCollection);\n }\n\n async info() {\n return new Promise((resolve) => {\n this.instance.getInfo(resolve);\n });\n }\n\n async getScale() {\n try {\n const {type} = this.options;\n switch (type) {\n case \"ImageCollection\":\n this.scale = await getScale(this.instance.first());\n break;\n default:\n this.scale = await getScale(this.getImage());\n }\n } catch (e) {\n }\n }\n\n async getFeatureCollectionAggregation() {\n const {datasetId} = this.options;\n const dataset = ee.FeatureCollection(datasetId);\n const collection = this.getFeatureCollection() as any;\n const aggFeatures = collection\n ?.map((feature: any) => {\n feature = ee.Feature(feature);\n const count = dataset.filterBounds(feature.geometry()).size();\n\n return feature.set(\"count\", count);\n })\n .select([\"count\"], null, false);\n\n return getInfo(aggFeatures).then(getFeatureCollectionProperties);\n }\n\n async getHistogramAggregations() {\n try {\n const aggregation = head(this.options.aggregations) ?? \"\";\n const reducer = ee.Reducer.frequencyHistogram();\n const collection = this.getFeatureCollection();\n const legend = this.options.legend?.items;\n const scale = this.scale;\n const tileScale = this.options.tileScale ?? DEFAULT_TILE_SCALE;\n const scaleValue = await getInfo(scale);\n\n const image = this.getImage();\n const features = Object.values(\n await getInfo(\n image\n .reduceRegions({\n collection,\n reducer,\n scale,\n tileScale,\n })\n .select([\"histogram\"], null, false)\n ).then((data) =>\n getHistogramStatistics({\n data,\n scale: scaleValue,\n aggregationType: aggregation,\n legend,\n })\n )\n );\n\n return features.map((feature: any, index: number) => {\n return {\n orgUnit: this.orgUnits?.[index],\n data: feature,\n };\n });\n } catch (e: any) {\n throw Error(\"Could not get histogram\", {\n cause: e,\n });\n }\n }\n\n async getAggregations() {\n await this.getScale();\n const {type} = this.options;\n if (type === \"FeatureCollection\") {\n this.aggregationData = await this.getFeatureCollectionAggregation();\n return;\n }\n const aggregations = this.options.aggregations;\n if (!aggregations) return;\n\n if (hasClasses(head(aggregations) ?? \"\")) {\n this.aggregationData = await this.getHistogramAggregations();\n return;\n }\n\n const reducer = combineReducers(ee)(aggregations);\n const collection = this.getFeatureCollection();\n const image = this.getImage();\n const scale = this.scale;\n const tileScale = this.options.tileScale ?? DEFAULT_TILE_SCALE;\n const aggregatedFeatures = image\n .reduceRegions({\n collection,\n reducer,\n scale,\n tileScale,\n })\n .select(aggregations, null, false);\n\n const features = Object.values(getFeatureCollectionProperties(await getInfo(aggregatedFeatures))) as any[];\n if (!isEmpty(features) && features.length === this.orgUnits?.length) {\n //Mapping features to orgUnits using index.\n this.aggregationData = features.map((feature: any, index: number) => {\n return {\n orgUnit: this.orgUnits?.[index],\n data: feature,\n };\n });\n }\n }\n\n getAggregation(orgUnit: MapOrgUnit) {\n if (isEmpty(this.aggregationData)) {\n return;\n }\n return find(this.aggregationData, (aggregation) => aggregation.orgUnit.id === orgUnit.id);\n }\n\n async url(): Promise<string> {\n if (!this.initialized) throw \"You need to call init() first\";\n return this.visualize(this.getImage());\n }\n\n protected applyPeriod(imageCollection: any) {\n const period = this.period;\n if (period) {\n return imageCollection.filterDate(period);\n }\n }\n\n protected applyMask(image: any) {\n if (this.options.mask) {\n return image.updateMask(image.gt(0));\n } else {\n return image;\n }\n }\n\n protected applyBand(imageCollection: any) {\n if (this.options.selectedBands) {\n return imageCollection.select(this.options.selectedBands);\n } else {\n return imageCollection;\n }\n }\n\n protected getReducerByType(type: string) {\n return ee.Reducer[type].call();\n }\n\n protected getGeometryByType(geoJSON: any) {\n return ee.Geometry(geoJSON?.geometry);\n }\n\n protected getFeatureByType(geoJSON: any) {\n const featureType = geoJSON.type;\n const features = geoJSON.features ?? [];\n const geometry = this.getGeometryByType(geoJSON);\n switch (featureType) {\n case \"Feature\":\n return ee.Feature(geometry);\n case \"FeatureCollection\":\n return ee.FeatureCollection([...features.map((feature: any) => ee.Feature(this.getGeometryByType(feature)))]);\n }\n }\n\n protected getFeatureCollection(): unknown {\n if (this.orgUnits) {\n return ee.FeatureCollection(this.orgUnits.map((orgUnit: MapOrgUnit) => this.getFeatureByType(orgUnit.geoJSON)));\n } else {\n throw \"You need to set org units first\";\n }\n }\n\n protected getParamsFromLegend() {\n if (!this.options.legend) return;\n const legend = this.options.legend.items;\n const keys = legend.map((l) => l.id);\n const min = Math.min(...keys);\n const max = Math.max(...keys);\n const palette = legend.map((l) => l.color).join(\",\");\n return {min, max, palette};\n }\n\n protected async visualize(image: any): Promise<string> {\n const {min, max, palette} = this.getParamsFromLegend() ??\n this.options.params ?? {\n min: null,\n max: null,\n palette: null,\n };\n return (\n (await new Promise((resolve, reject) => {\n image.getMap({min, max, palette}, resolve);\n })) as any\n )?.urlFormat;\n }\n\n protected getImageCollectionInstance() {\n const {datasetId} = this.options;\n let imageCollection = ee.ImageCollection(datasetId);\n if (this.period) {\n imageCollection = this.applyPeriod(imageCollection);\n }\n imageCollection = this.applyBand(imageCollection);\n return imageCollection;\n }\n\n protected getImageFromImageCollection() {\n const {mosaic} = this.options;\n const imageCollection = this.instance;\n return mosaic\n ? imageCollection.mosaic().clipToCollection(this.getFeatureCollection())\n : ee.Image(imageCollection.first()).clipToCollection(this.getFeatureCollection());\n }\n\n protected getImageInstance() {\n const {datasetId} = this.options;\n return ee.Image(datasetId).clipToCollection(this.getFeatureCollection());\n }\n\n protected getImageFromImage() {\n return this.instance;\n }\n\n protected getFeatureInstance() {\n const {datasetId} = this.options;\n const feature = ee.Feature(datasetId);\n this.instance = feature;\n return feature;\n }\n\n protected getImageFromFeature() {\n return this.instance;\n }\n\n protected getFeatureCollectionInstance() {\n const {datasetId} = this.options;\n let featureCollection = ee.FeatureCollection(datasetId);\n if (this.period) {\n featureCollection = this.applyPeriod(featureCollection);\n }\n return featureCollection;\n }\n\n protected getImageFromFeatureCollection() {\n let featureCollection = this.instance;\n return featureCollection.draw(FEATURE_STYLE).clipToCollection(this.getFeatureCollection());\n }\n\n protected getInstance() {\n const {type} = this.options;\n switch (type) {\n case \"Feature\":\n this.instance = this.getFeatureInstance();\n break;\n case \"FeatureCollection\":\n this.instance = this.getFeatureCollectionInstance();\n break;\n case \"Image\":\n this.instance = this.getImageInstance();\n break;\n case \"ImageCollection\":\n this.instance = this.getImageCollectionInstance();\n break;\n default:\n this.instance = this.getImageFromImage();\n }\n }\n\n protected getImage(): any {\n if (this.image) {\n return this.image;\n }\n const {type} = this.options;\n let image;\n switch (type) {\n case \"Feature\":\n image = this.getImageFromFeature();\n break;\n case \"FeatureCollection\":\n image = this.getImageFromFeatureCollection();\n break;\n case \"Image\":\n image = this.getImageFromImage();\n break;\n case \"ImageCollection\":\n image = this.getImageFromImageCollection();\n break;\n default:\n image = this.getImageFromImage();\n }\n image = this.applyMask(image);\n image = this.applyBand(image);\n this.image = image;\n return image;\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/Google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Q,KAAK,kBAAkB;AAC/B;AAAA,MACD,KAAK;AACJ,gBAAQ,KAAK,4BAA4B;AACzC;AAAA,MACD;AACC,gBAAQ,KAAK,kBAAkB;AAAA,IACjC;AACA,YAAQ,KAAK,UAAU,KAAK;AAC5B,YAAQ,KAAK,UAAU,KAAK;AAC5B,SAAK,QAAQ;AACb,WAAO;AAAA,EACR;AACD","sourcesContent":["import { MapOrgUnit } from \"../../../../../interfaces/index.js\";\nimport {\n\tEarthEngineOptions,\n\tEarthEngineToken,\n\tRefreshToken,\n} from \"../interfaces/index.js\";\nimport {\n\tcombineReducers,\n\tgetFeatureCollectionProperties,\n\tgetHistogramStatistics,\n\tgetInfo,\n\tgetScale,\n\thasClasses,\n} from \"../utils/index.js\";\nimport { find, head, isEmpty } from \"lodash\";\n\n// async function importEEModule(): Promise<any> {\n// // @ts-ignore\n// if (import.meta.env.STORYBOOK_BUILD === \"true\") {\n// return await import(\"@google/earthengine\");\n// }\n// return await import(\"./api\");\n// }\n// const EE = await importEEModule();\n//@ts-ignore\nimport * as EE from \"./api.js\";\n// @ts-ignore\nconst ee = EE as any;\n// @ts-ignore\nwindow.ee = ee;\n\nconst FEATURE_STYLE = { color: \"FFA500\", strokeWidth: 2 };\nconst DEFAULT_TILE_SCALE = 1;\n\nexport class EarthEngine {\n\ttoken?: EarthEngineToken;\n\toptions: EarthEngineOptions;\n\trefresh?: RefreshToken;\n\torgUnits?: MapOrgUnit[];\n\tinitialized = false;\n\tperiod?: string | string[];\n\tinstance: any;\n\tscale?: any;\n\timage: any;\n\taggregationData: any;\n\n\tconstructor({ options }: { options: EarthEngineOptions }) {\n\t\tthis.options = options;\n\t\tthis.initialized = true;\n\t\tthis.getInstance();\n\t}\n\n\tstatic async setToken(\n\t\ttoken: EarthEngineToken,\n\t\trefresh: RefreshToken,\n\t): Promise<void> {\n\t\tconst tokenType = \"Bearer\";\n\n\t\tfunction refreshToken(\n\t\t\tauthArgs: { scope: any },\n\t\t\tcallback: (props: any) => void,\n\t\t) {\n\t\t\trefresh().then(({ token }: { token: EarthEngineToken }) => {\n\t\t\t\tcallback({\n\t\t\t\t\t...token,\n\t\t\t\t\ttoken_type: tokenType ?? \"Bearer\",\n\t\t\t\t\tstate: authArgs?.scope,\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tawait new Promise((resolve, reject) => {\n\t\t\tif (ee.data.getAuthToken()) {\n\t\t\t\tee.initialize(null, null, resolve, reject);\n\t\t\t}\n\t\t\tif (token) {\n\t\t\t\tconst { access_token, client_id, expires_in } = token;\n\t\t\t\tee.data.setAuthToken(\n\t\t\t\t\tclient_id,\n\t\t\t\t\ttokenType ?? \"Bearer\",\n\t\t\t\t\taccess_token,\n\t\t\t\t\texpires_in,\n\t\t\t\t\tnull,\n\t\t\t\t\t() => {\n\t\t\t\t\t\tee.initialize(null, null, resolve, reject);\n\t\t\t\t\t},\n\t\t\t\t\tfalse,\n\t\t\t\t);\n\t\t\t\tee.data.setAuthTokenRefresher(refreshToken);\n\t\t\t}\n\t\t\tresolve(\"Token not found\");\n\t\t});\n\t}\n\n\tsetOrgUnits(orgUnits: MapOrgUnit[]): EarthEngine {\n\t\tthis.orgUnits = orgUnits;\n\t\treturn this;\n\t}\n\n\tsetPeriod(period: string) {\n\t\tthis.period = period;\n\t}\n\n\tasync getValue(geoJSON: any, type: string) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst point = this.getGeometryByType(geoJSON);\n\t\t\tconst reducer = this.getReducerByType(type);\n\t\t\tconst image = this.getImage();\n\n\t\t\tconst reducedImage = image.reduceRegion(reducer, point, 1);\n\n\t\t\treducedImage.evaluate((data: unknown, error: any) => {\n\t\t\t\tif (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t} else {\n\t\t\t\t\tresolve(data);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\tasync getPeriod() {\n\t\tconst { type } = this.options;\n\t\tif (type !== \"ImageCollection\") {\n\t\t\treturn;\n\t\t}\n\n\t\tconst imageCollection = this.instance\n\t\t\t.distinct(\"system:time_start\")\n\t\t\t.sort(\"system:time_start\", false);\n\t\tconst featureCollection = ee\n\t\t\t.FeatureCollection(imageCollection)\n\t\t\t.select([\"system:time_start\", \"system:time_end\"], null, false);\n\n\t\treturn getInfo(featureCollection);\n\t}\n\n\tasync info() {\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.instance.getInfo(resolve);\n\t\t});\n\t}\n\n\tasync getScale() {\n\t\ttry {\n\t\t\tconst { type } = this.options;\n\t\t\tswitch (type) {\n\t\t\t\tcase \"ImageCollection\":\n\t\t\t\t\tthis.scale = await getScale(this.instance.first());\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthis.scale = await getScale(this.getImage());\n\t\t\t}\n\t\t} catch (e) {}\n\t}\n\n\tasync getFeatureCollectionAggregation() {\n\t\tconst { datasetId } = this.options;\n\t\tconst dataset = ee.FeatureCollection(datasetId);\n\t\tconst collection = this.getFeatureCollection() as any;\n\t\tconst aggFeatures = collection\n\t\t\t?.map((feature: any) => {\n\t\t\t\tfeature = ee.Feature(feature);\n\t\t\t\tconst count = dataset.filterBounds(feature.geometry()).size();\n\n\t\t\t\treturn feature.set(\"count\", count);\n\t\t\t})\n\t\t\t.select([\"count\"], null, false);\n\n\t\treturn getInfo(aggFeatures).then(getFeatureCollectionProperties);\n\t}\n\n\tasync getHistogramAggregations() {\n\t\ttry {\n\t\t\tconst aggregation = head(this.options.aggregations) ?? \"\";\n\t\t\tconst reducer = ee.Reducer.frequencyHistogram();\n\t\t\tconst collection = this.getFeatureCollection();\n\t\t\tconst legend = this.options.legend?.items;\n\t\t\tconst scale = this.scale;\n\t\t\tconst tileScale = this.options.tileScale ?? DEFAULT_TILE_SCALE;\n\t\t\tconst scaleValue = await getInfo(scale);\n\n\t\t\tconst image = this.getImage();\n\t\t\tconst features = Object.values(\n\t\t\t\tawait getInfo(\n\t\t\t\t\timage\n\t\t\t\t\t\t.reduceRegions({\n\t\t\t\t\t\t\tcollection,\n\t\t\t\t\t\t\treducer,\n\t\t\t\t\t\t\tscale,\n\t\t\t\t\t\t\ttileScale,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.select([\"histogram\"], null, false),\n\t\t\t\t).then((data) =>\n\t\t\t\t\tgetHistogramStatistics({\n\t\t\t\t\t\tdata,\n\t\t\t\t\t\tscale: scaleValue,\n\t\t\t\t\t\taggregationType: aggregation,\n\t\t\t\t\t\tlegend,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t);\n\n\t\t\treturn features.map((feature: any, index: number) => {\n\t\t\t\treturn {\n\t\t\t\t\torgUnit: this.orgUnits?.[index],\n\t\t\t\t\tdata: feature,\n\t\t\t\t};\n\t\t\t});\n\t\t} catch (e: any) {\n\t\t\tthrow Error(\"Could not get histogram\", {\n\t\t\t\tcause: e,\n\t\t\t});\n\t\t}\n\t}\n\n\tasync getAggregations() {\n\t\tawait this.getScale();\n\t\tconst { type } = this.options;\n\t\tif (type === \"FeatureCollection\") {\n\t\t\tthis.aggregationData = await this.getFeatureCollectionAggregation();\n\t\t\treturn;\n\t\t}\n\t\tconst aggregations = this.options.aggregations;\n\t\tif (!aggregations) return;\n\n\t\tif (hasClasses(head(aggregations) ?? \"\")) {\n\t\t\tthis.aggregationData = await this.getHistogramAggregations();\n\t\t\treturn;\n\t\t}\n\n\t\tconst reducer = combineReducers(ee)(aggregations);\n\t\tconst collection = this.getFeatureCollection();\n\t\tconst image = this.getImage();\n\t\tconst scale = this.scale;\n\t\tconst tileScale = this.options.tileScale ?? DEFAULT_TILE_SCALE;\n\t\tconst aggregatedFeatures = image\n\t\t\t.reduceRegions({\n\t\t\t\tcollection,\n\t\t\t\treducer,\n\t\t\t\tscale,\n\t\t\t\ttileScale,\n\t\t\t})\n\t\t\t.select(aggregations, null, false);\n\n\t\tconst features = Object.values(\n\t\t\tgetFeatureCollectionProperties(await getInfo(aggregatedFeatures)),\n\t\t) as any[];\n\t\tif (!isEmpty(features) && features.length === this.orgUnits?.length) {\n\t\t\t//Mapping features to orgUnits using index.\n\t\t\tthis.aggregationData = features.map(\n\t\t\t\t(feature: any, index: number) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\torgUnit: this.orgUnits?.[index],\n\t\t\t\t\t\tdata: feature,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t}\n\n\tgetAggregation(orgUnit: MapOrgUnit) {\n\t\tif (isEmpty(this.aggregationData)) {\n\t\t\treturn;\n\t\t}\n\t\treturn find(\n\t\t\tthis.aggregationData,\n\t\t\t(aggregation) => aggregation.orgUnit.id === orgUnit.id,\n\t\t);\n\t}\n\n\tasync url(): Promise<string> {\n\t\tif (!this.initialized) throw \"You need to call init() first\";\n\t\treturn this.visualize(this.getImage());\n\t}\n\n\tprotected applyPeriod(imageCollection: any) {\n\t\tconst period = this.period;\n\t\tif (period) {\n\t\t\treturn imageCollection.filterDate(period);\n\t\t}\n\t}\n\n\tprotected applyMask(image: any) {\n\t\tif (this.options.mask) {\n\t\t\treturn image.updateMask(image.gt(0));\n\t\t} else {\n\t\t\treturn image;\n\t\t}\n\t}\n\n\tprotected applyBand(imageCollection: any) {\n\t\tif (this.options.selectedBands) {\n\t\t\treturn imageCollection.select(this.options.selectedBands);\n\t\t} else {\n\t\t\treturn imageCollection;\n\t\t}\n\t}\n\n\tprotected getReducerByType(type: string) {\n\t\treturn ee.Reducer[type].call();\n\t}\n\n\tprotected getGeometryByType(geoJSON: any) {\n\t\treturn ee.Geometry(geoJSON?.geometry);\n\t}\n\n\tprotected getFeatureByType(geoJSON: any) {\n\t\tconst featureType = geoJSON.type;\n\t\tconst features = geoJSON.features ?? [];\n\t\tconst geometry = this.getGeometryByType(geoJSON);\n\t\tswitch (featureType) {\n\t\t\tcase \"Feature\":\n\t\t\t\treturn ee.Feature(geometry);\n\t\t\tcase \"FeatureCollection\":\n\t\t\t\treturn ee.FeatureCollection([\n\t\t\t\t\t...features.map((feature: any) =>\n\t\t\t\t\t\tee.Feature(this.getGeometryByType(feature)),\n\t\t\t\t\t),\n\t\t\t\t]);\n\t\t}\n\t}\n\n\tprotected getFeatureCollection(): unknown {\n\t\tif (this.orgUnits) {\n\t\t\treturn ee.FeatureCollection(\n\t\t\t\tthis.orgUnits.map((orgUnit: MapOrgUnit) =>\n\t\t\t\t\tthis.getFeatureByType(orgUnit.geoJSON),\n\t\t\t\t),\n\t\t\t);\n\t\t} else {\n\t\t\tthrow \"You need to set org units first\";\n\t\t}\n\t}\n\n\tprotected getParamsFromLegend() {\n\t\tif (!this.options.legend) return;\n\t\tconst legend = this.options.legend.items;\n\t\tconst keys = legend.map((l) => l.id);\n\t\tconst min = Math.min(...keys);\n\t\tconst max = Math.max(...keys);\n\t\tconst palette = legend.map((l) => l.color).join(\",\");\n\t\treturn { min, max, palette };\n\t}\n\n\tprotected async visualize(image: any): Promise<string> {\n\t\tconst { min, max, palette } = this.getParamsFromLegend() ??\n\t\t\tthis.options.params ?? {\n\t\t\t\tmin: null,\n\t\t\t\tmax: null,\n\t\t\t\tpalette: null,\n\t\t\t};\n\t\treturn (\n\t\t\t(await new Promise((resolve, reject) => {\n\t\t\t\timage.getMap({ min, max, palette }, resolve);\n\t\t\t})) as any\n\t\t)?.urlFormat;\n\t}\n\n\tprotected getImageCollectionInstance() {\n\t\tconst { datasetId } = this.options;\n\t\tlet imageCollection = ee.ImageCollection(datasetId);\n\t\tif (this.period) {\n\t\t\timageCollection = this.applyPeriod(imageCollection);\n\t\t}\n\t\timageCollection = this.applyBand(imageCollection);\n\t\treturn imageCollection;\n\t}\n\n\tprotected getImageFromImageCollection() {\n\t\tconst { mosaic } = this.options;\n\t\tconst imageCollection = this.instance;\n\t\treturn mosaic\n\t\t\t? imageCollection\n\t\t\t\t\t.mosaic()\n\t\t\t\t\t.clipToCollection(this.getFeatureCollection())\n\t\t\t: ee\n\t\t\t\t\t.Image(imageCollection.first())\n\t\t\t\t\t.clipToCollection(this.getFeatureCollection());\n\t}\n\n\tprotected getImageInstance() {\n\t\tconst { datasetId } = this.options;\n\t\treturn ee\n\t\t\t.Image(datasetId)\n\t\t\t.clipToCollection(this.getFeatureCollection());\n\t}\n\n\tprotected getImageFromImage() {\n\t\treturn this.instance;\n\t}\n\n\tprotected getFeatureInstance() {\n\t\tconst { datasetId } = this.options;\n\t\tconst feature = ee.Feature(datasetId);\n\t\tthis.instance = feature;\n\t\treturn feature;\n\t}\n\n\tprotected getImageFromFeature() {\n\t\treturn this.instance;\n\t}\n\n\tprotected getFeatureCollectionInstance() {\n\t\tconst { datasetId } = this.options;\n\t\tlet featureCollection = ee.FeatureCollection(datasetId);\n\t\tif (this.period) {\n\t\t\tfeatureCollection = this.applyPeriod(featureCollection);\n\t\t}\n\t\treturn featureCollection;\n\t}\n\n\tprotected getImageFromFeatureCollection() {\n\t\tlet featureCollection = this.instance;\n\t\treturn featureCollection\n\t\t\t.draw(FEATURE_STYLE)\n\t\t\t.clipToCollection(this.getFeatureCollection());\n\t}\n\n\tprotected getInstance() {\n\t\tconst { type } = this.options;\n\t\tswitch (type) {\n\t\t\tcase \"Feature\":\n\t\t\t\tthis.instance = this.getFeatureInstance();\n\t\t\t\tbreak;\n\t\t\tcase \"FeatureCollection\":\n\t\t\t\tthis.instance = this.getFeatureCollectionInstance();\n\t\t\t\tbreak;\n\t\t\tcase \"Image\":\n\t\t\t\tthis.instance = this.getImageInstance();\n\t\t\t\tbreak;\n\t\t\tcase \"ImageCollection\":\n\t\t\t\tthis.instance = this.getImageCollectionInstance();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis.instance = this.getImageFromImage();\n\t\t}\n\t}\n\n\tprotected getImage(): any {\n\t\tif (this.image) {\n\t\t\treturn this.image;\n\t\t}\n\t\tconst { type } = this.options;\n\t\tlet image;\n\t\tswitch (type) {\n\t\t\tcase \"Feature\":\n\t\t\t\timage = this.getImageFromFeature();\n\t\t\t\tbreak;\n\t\t\tcase \"FeatureCollection\":\n\t\t\t\timage = this.getImageFromFeatureCollection();\n\t\t\t\tbreak;\n\t\t\tcase \"Image\":\n\t\t\t\timage = this.getImageFromImage();\n\t\t\t\tbreak;\n\t\t\tcase \"ImageCollection\":\n\t\t\t\timage = this.getImageFromImageCollection();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\timage = this.getImageFromImage();\n\t\t}\n\t\timage = this.applyMask(image);\n\t\timage = this.applyBand(image);\n\t\tthis.image = image;\n\t\treturn image;\n\t}\n}\n"]}
@@ -56,28 +56,39 @@ const squareMetersToHectares = (value) => value / 1e4;
56
56
  const squareMetersToAcres = (value) => value / 4046.8564224;
57
57
  const classAggregation = ["percentage", "hectares", "acres"];
58
58
  const hasClasses = (type) => classAggregation.includes(type);
59
- const getHistogramStatistics = ({ data, scale, aggregationType, legend }) => data.features.reduce((obj, { id, properties }) => {
60
- const { histogram } = properties;
61
- const sum = Object.values(histogram).reduce((a, b) => a + b, 0);
62
- obj[id] = legend.reduce((values, { id: id2 }) => {
63
- const count = histogram[id2] || 0;
64
- const sqMeters = count * (scale * scale);
65
- let value;
66
- switch (aggregationType) {
67
- case "hectares":
68
- value = Math.round(squareMetersToHectares(sqMeters));
69
- break;
70
- case "acres":
71
- value = Math.round(squareMetersToAcres(sqMeters));
72
- break;
73
- default:
74
- value = count / sum * 100;
75
- }
76
- values[id2] = value;
77
- return values;
78
- }, {});
79
- return obj;
80
- }, {});
59
+ const getHistogramStatistics = ({
60
+ data,
61
+ scale,
62
+ aggregationType,
63
+ legend
64
+ }) => data.features.reduce(
65
+ (obj, { id, properties }) => {
66
+ const { histogram } = properties;
67
+ const sum = Object.values(histogram).reduce(
68
+ (a, b) => a + b,
69
+ 0
70
+ );
71
+ obj[id] = legend.reduce((values, { id: id2 }) => {
72
+ const count = histogram[id2] || 0;
73
+ const sqMeters = count * (scale * scale);
74
+ let value;
75
+ switch (aggregationType) {
76
+ case "hectares":
77
+ value = Math.round(squareMetersToHectares(sqMeters));
78
+ break;
79
+ case "acres":
80
+ value = Math.round(squareMetersToAcres(sqMeters));
81
+ break;
82
+ default:
83
+ value = count / sum * 100;
84
+ }
85
+ values[id2] = value;
86
+ return values;
87
+ }, {});
88
+ return obj;
89
+ },
90
+ {}
91
+ );
81
92
 
82
93
  exports.combineReducers = combineReducers;
83
94
  exports.getClassifiedImage = getClassifiedImage;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.ts"],"names":["id"],"mappings":"AAEO,MAAM,kBAAkB,CAAC,OAAY,CAAC,UAC5C,MAAM;AAAA,EACL,CAAC,GAAQ,GAAQ,MAChB,MAAM,IACH,EAAE,CAAC,EAAE,IACL,EAAE,QAAQ;AAAA,IACV,UAAU,GAAG,QAAQ,CAAC,EAAE;AAAA,IACxB,cAAc;AAAA,EACf,CAAC;AAAA,EACJ,GAAG;AACJ;AAEM,MAAM,UAAU,CAAC,aACtB,IAAI;AAAA,EAAQ,CAAC,SAAS,WACpB,SAAS,SAAS,CAAC,MAAW,UAAiB;AAC7C,QAAI,OAAO;AACT,aAAO,KAAK;AAAA,IACd,OAAO;AACL,cAAQ,IAAI;AAAA,IACd;AAAA,EACF,CAAC;AACH;AAEK,MAAM,iCAAiC,CAAC,SAC7C,KAAK,SAAS;AAAA,EACZ,CAAC,KAAU,OAAY;AAAA,IACrB,GAAG;AAAA,IACH,CAAC,EAAE,EAAE,GAAG,EAAE;AAAA,EACZ;AAAA,EACA,CAAC;AACH;AAEK,MAAM,WAAW,OAAO,UAAe;AAC5C,SAAO,MAAM,OAAO,CAAC,EAAE,WAAW,EAAE,aAAa;AACnD;AAEA,MAAM,sBAAsB,CAAC,WAAkB;AAC7C,QAAM,OAAO,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE;AACnC,QAAM,MAAM,KAAK,IAAI,GAAG,IAAI;AAC5B,QAAM,MAAM,KAAK,IAAI,GAAG,IAAI;AAC5B,QAAM,UAAU,OAAO,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK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Q,iBAAiB;AAAA,MACvB,KAAK;AACH,gBAAQ,KAAK,MAAM,uBAAuB,QAAQ,CAAC;AACnD;AAAA,MACF,KAAK;AACH,gBAAQ,KAAK,MAAM,oBAAoB,QAAQ,CAAC;AAChD;AAAA,MACF;AACE,gBAAS,QAAQ,MAAO;AAAA,IAC5B;AAEA,WAAOA,GAAE,IAAI;AAEb,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,SAAO;AACT,GAAG,CAAC,CAAC","sourcesContent":["import { EarthEngineOptions } from \"../interfaces\";\n\nexport const combineReducers = (ee: any) => (types: string[]) =>\n\ttypes.reduce(\n\t\t(r: any, t: any, i: any) =>\n\t\t\ti === 0\n\t\t\t\t? r[t]()\n\t\t\t\t: r.combine({\n\t\t\t\t\t\treducer2: ee.Reducer[t](),\n\t\t\t\t\t\tsharedInputs: true,\n\t\t\t\t\t}),\n\t\tee.Reducer,\n\t);\n\nexport const getInfo = (instance: any) =>\n new Promise((resolve, reject) =>\n instance.evaluate((data: any, error: Error) => {\n if (error) {\n reject(error);\n } else {\n resolve(data);\n }\n })\n );\n\nexport const getFeatureCollectionProperties = (data: any) =>\n data.features.reduce(\n (obj: any, f: any) => ({\n ...obj,\n [f.id]: f.properties,\n }),\n {}\n );\n\nexport const getScale = async (image: any) => {\n return image.select(0).projection().nominalScale();\n};\n\nconst getParamsFromLegend = (legend: any[]) => {\n const keys = legend.map((l) => l.id);\n const min = Math.min(...keys);\n const max = Math.max(...keys);\n const palette = legend.map((l) => l.color).join(\",\");\n\n return { min, max, palette };\n};\n\nexport const getClassifiedImage = (eeImage: any, { legend: legends, params }: EarthEngineOptions) => {\n const legend = legends?.items ?? [];\n if (!params) {\n // Image has classes (e.g. landcover)\n return { eeImage, params: getParamsFromLegend(legend) };\n }\n\n const min = 0;\n const max = legend.length - 1;\n const { palette } = params;\n let zones;\n\n for (let i = min, item; i < max; i++) {\n item = legend[i] as any;\n\n if (!zones) {\n zones = eeImage.gt(item.to);\n } else {\n zones = zones.add(eeImage.gt(item.to));\n }\n }\n\n return { eeImage: zones, params: { min, max, palette } };\n};\n\nconst squareMetersToHectares = (value: number) => value / 10000;\n\nconst squareMetersToAcres = (value: number) => value / 4046.8564224;\n\nconst classAggregation = [\"percentage\", \"hectares\", \"acres\"];\n\nexport const hasClasses = (type: string) => classAggregation.includes(type);\n\nexport const getHistogramStatistics = ({ data, scale, aggregationType, legend }: { data: any; scale: any; aggregationType: string; legend: any }) =>\n data.features.reduce((obj: Record<any, any>, { id, properties }: { id: string; properties: any }) => {\n const { histogram } = properties;\n const sum: number = Object.values(histogram).reduce((a: any, b: any) => a + b, 0) as number;\n obj[id] = legend.reduce((values: any, { id }: { id: string }) => {\n const count = histogram[id] || 0;\n const sqMeters = count * (scale * scale);\n let value;\n switch (aggregationType) {\n case \"hectares\":\n value = Math.round(squareMetersToHectares(sqMeters));\n break;\n case \"acres\":\n value = Math.round(squareMetersToAcres(sqMeters));\n break;\n default:\n value = (count / sum) * 100; // percentage\n }\n\n values[id] = value;\n\n return values;\n }, {});\n return obj;\n }, {});\n"]}
1
+ {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.ts"],"names":["id"],"mappings":"AAEO,MAAM,kBAAkB,CAAC,OAAY,CAAC,UAC5C,MAAM;AAAA,EACL,CAAC,GAAQ,GAAQ,MAChB,MAAM,IACH,EAAE,CAAC,EAAE,IACL,EAAE,QAAQ;AAAA,IACV,UAAU,GAAG,QAAQ,CAAC,EAAE;AAAA,IACxB,cAAc;AAAA,EACf,CAAC;AAAA,EACJ,GAAG;AACJ;AAEM,MAAM,UAAU,CAAC,aACvB,IAAI;AAAA,EAAQ,CAAC,SAAS,WACrB,SAAS,SAAS,CAAC,MAAW,UAAiB;AAC9C,QAAI,OAAO;AACV,aAAO,KAAK;AAAA,IACb,OAAO;AACN,cAAQ,IAAI;AAAA,IACb;AAAA,EACD,CAAC;AACF;AAEM,MAAM,iCAAiC,CAAC,SAC9C,KAAK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EpD,MAAM,aAAa,CAAC,SAAiB,iBAAiB,SAAS,IAAI;AAEnE,MAAM,yBAAyB,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAMC,KAAK,SAAS;AAAA,EACb,CACC,KACA,EAAE,IAAI,WAAW,MACb;AACJ,UAAM,EAAE,UAAU,IAAI;AACtB,UAAM,MAAc,OAAO,OAAO,SAAS,EAAE;AAAA,MAC5C,CAAC,GAAQ,MAAW,IAAI;AAAA,MACxB;AAAA,IACD;AACA,QAAI,EAAE,IAAI,OAAO,OAAO,CAAC,QAAa,EAAE,IAAAA,IAAG,MAAsB;AAChE,YAAM,QAAQ,UAAUA,GAAE,KAAK;AAC/B,YAAM,WAAW,SAAS,QAAQ;AAClC,UAAI;AACJ,cAAQ,iBAAiB;AAAA,QACxB,KAAK;AACJ,kBAAQ,KAAK,MAAM,uBAAuB,QAAQ,CAAC;AACnD;AAAA,QACD,KAAK;AACJ,kBAAQ,KAAK,MAAM,oBAAoB,QAAQ,CAAC;AAChD;AAAA,QACD;AACC,kBAAS,QAAQ,MAAO;AAAA,MAC1B;AAEA,aAAOA,GAAE,IAAI;AAEb,aAAO;AAAA,IACR,GAAG,CAAC,CAAC;AACL,WAAO;AAAA,EACR;AAAA,EACA,CAAC;AACF","sourcesContent":["import { EarthEngineOptions } from \"../interfaces/index.js\";\n\nexport const combineReducers = (ee: any) => (types: string[]) =>\n\ttypes.reduce(\n\t\t(r: any, t: any, i: any) =>\n\t\t\ti === 0\n\t\t\t\t? r[t]()\n\t\t\t\t: r.combine({\n\t\t\t\t\t\treducer2: ee.Reducer[t](),\n\t\t\t\t\t\tsharedInputs: true,\n\t\t\t\t\t}),\n\t\tee.Reducer,\n\t);\n\nexport const getInfo = (instance: any) =>\n\tnew Promise((resolve, reject) =>\n\t\tinstance.evaluate((data: any, error: Error) => {\n\t\t\tif (error) {\n\t\t\t\treject(error);\n\t\t\t} else {\n\t\t\t\tresolve(data);\n\t\t\t}\n\t\t}),\n\t);\n\nexport const getFeatureCollectionProperties = (data: any) =>\n\tdata.features.reduce(\n\t\t(obj: any, f: any) => ({\n\t\t\t...obj,\n\t\t\t[f.id]: f.properties,\n\t\t}),\n\t\t{},\n\t);\n\nexport const getScale = async (image: any) => {\n\treturn image.select(0).projection().nominalScale();\n};\n\nconst getParamsFromLegend = (legend: any[]) => {\n\tconst keys = legend.map((l) => l.id);\n\tconst min = Math.min(...keys);\n\tconst max = Math.max(...keys);\n\tconst palette = legend.map((l) => l.color).join(\",\");\n\n\treturn { min, max, palette };\n};\n\nexport const getClassifiedImage = (\n\teeImage: any,\n\t{ legend: legends, params }: EarthEngineOptions,\n) => {\n\tconst legend = legends?.items ?? [];\n\tif (!params) {\n\t\t// Image has classes (e.g. landcover)\n\t\treturn { eeImage, params: getParamsFromLegend(legend) };\n\t}\n\n\tconst min = 0;\n\tconst max = legend.length - 1;\n\tconst { palette } = params;\n\tlet zones;\n\n\tfor (let i = min, item; i < max; i++) {\n\t\titem = legend[i] as any;\n\n\t\tif (!zones) {\n\t\t\tzones = eeImage.gt(item.to);\n\t\t} else {\n\t\t\tzones = zones.add(eeImage.gt(item.to));\n\t\t}\n\t}\n\n\treturn { eeImage: zones, params: { min, max, palette } };\n};\n\nconst squareMetersToHectares = (value: number) => value / 10000;\n\nconst squareMetersToAcres = (value: number) => value / 4046.8564224;\n\nconst classAggregation = [\"percentage\", \"hectares\", \"acres\"];\n\nexport const hasClasses = (type: string) => classAggregation.includes(type);\n\nexport const getHistogramStatistics = ({\n\tdata,\n\tscale,\n\taggregationType,\n\tlegend,\n}: {\n\tdata: any;\n\tscale: any;\n\taggregationType: string;\n\tlegend: any;\n}) =>\n\tdata.features.reduce(\n\t\t(\n\t\t\tobj: Record<any, any>,\n\t\t\t{ id, properties }: { id: string; properties: any },\n\t\t) => {\n\t\t\tconst { histogram } = properties;\n\t\t\tconst sum: number = Object.values(histogram).reduce(\n\t\t\t\t(a: any, b: any) => a + b,\n\t\t\t\t0,\n\t\t\t) as number;\n\t\t\tobj[id] = legend.reduce((values: any, { id }: { id: string }) => {\n\t\t\t\tconst count = histogram[id] || 0;\n\t\t\t\tconst sqMeters = count * (scale * scale);\n\t\t\t\tlet value;\n\t\t\t\tswitch (aggregationType) {\n\t\t\t\t\tcase \"hectares\":\n\t\t\t\t\t\tvalue = Math.round(squareMetersToHectares(sqMeters));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"acres\":\n\t\t\t\t\t\tvalue = Math.round(squareMetersToAcres(sqMeters));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tvalue = (count / sum) * 100; // percentage\n\t\t\t\t}\n\n\t\t\t\tvalues[id] = value;\n\n\t\t\t\treturn values;\n\t\t\t}, {});\n\t\t\treturn obj;\n\t\t},\n\t\t{},\n\t);\n"]}
@@ -4,14 +4,14 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var ui = require('@dhis2/ui');
5
5
  var lodash = require('lodash');
6
6
  var React = require('react');
7
- var CustomControl = require('../../../MapControls/components/CustomControl');
8
- var interfaces = require('../../interfaces');
9
- var PointLegend = require('../PointLayer/components/PointLegend');
10
- var BubbleLegend = require('../ThematicLayer/components/Bubble/components/BubbleLegend');
11
- var ChoroplethLegend = require('../ThematicLayer/components/Choropleth/components/ChoroplethLegend');
12
- var EarthEngineLegend = require('../GoogleEngineLayer/components/EarthEngineLegend');
7
+ var index_js = require('../../../MapControls/components/CustomControl/index.js');
8
+ var index_js$1 = require('../../interfaces/index.js');
9
+ var PointLegend = require('../PointLayer/components/PointLegend/index.js');
10
+ var BubbleLegend = require('../ThematicLayer/components/Bubble/components/BubbleLegend/index.js');
11
+ var ChoroplethLegend = require('../ThematicLayer/components/Choropleth/components/ChoroplethLegend.js');
12
+ var EarthEngineLegend = require('../GoogleEngineLayer/components/EarthEngineLegend.js');
13
13
  var classes = require('./LegendArea.module.css');
14
- var map = require('../../../../hooks/map');
14
+ var map_js = require('../../../../hooks/map.js');
15
15
 
16
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
17
 
@@ -27,7 +27,7 @@ function getLegendComponent(layer) {
27
27
  if (layer.type === "point") {
28
28
  return /* @__PURE__ */ jsxRuntime.jsx(PointLegend__default.default, { name: layer.label });
29
29
  }
30
- if (interfaces.SUPPORTED_EARTH_ENGINE_LAYERS.includes(layer.type)) {
30
+ if (index_js$1.SUPPORTED_EARTH_ENGINE_LAYERS.includes(layer.type)) {
31
31
  return /* @__PURE__ */ jsxRuntime.jsx(
32
32
  EarthEngineLegend__default.default,
33
33
  {
@@ -154,7 +154,7 @@ function Legend({
154
154
  collapsible
155
155
  }) {
156
156
  const [collapsed, setCollapsed] = React.useState(collapsible);
157
- const inPrintMode = map.usePrintMedia();
157
+ const inPrintMode = map_js.usePrintMedia();
158
158
  const onCollapse = () => {
159
159
  if (collapsible) {
160
160
  setCollapsed((prevState) => !prevState);
@@ -175,7 +175,7 @@ function LegendArea({
175
175
  layers.filter((layer) => layer.enabled).map(getLegendComponent)
176
176
  );
177
177
  const { position, collapsible } = legendConfig ?? {};
178
- return /* @__PURE__ */ jsxRuntime.jsx(CustomControl.CustomControl, { position, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "column gap-16 align-items-end", children: legends?.map((legend, index) => /* @__PURE__ */ jsxRuntime.jsx(
178
+ return /* @__PURE__ */ jsxRuntime.jsx(index_js.CustomControl, { position, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "column gap-16 align-items-end", children: legends?.map((legend, index) => /* @__PURE__ */ jsxRuntime.jsx(
179
179
  Legend,
180
180
  {
181
181
  collapsible: collapsible ?? true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/components/Map/components/MapLayer/components/LegendArea/index.tsx"],"names":[],"mappings":"AA0BS,cAkGP,YAlGO;AA1BT,SAAS,QAAQ,cAAc,QAAQ,cAAc;AAErD,SAAS,SAAS,YAAY;AAC9B,OAAO,SAAS,WAAW,QAAQ,gBAAgB;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A,oBACA,aAAW;AAAA,oBAEV;AAAA;AAAA,gBACF;AAAA;AAAA,YACD;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF;AAEF;AAEA,SAAS,OAAO;AAAA,EACf;AAAA,EACA;AACD,GAGG;AACF,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,WAAW;AACtD,QAAM,cAAc,cAAc;AAClC,QAAM,aAAa,MAAM;AACxB,QAAI,aAAa;AAChB,mBAAa,CAAC,cAAc,CAAC,SAAS;AAAA,IACvC;AAAA,EACD;AAEA,QAAM,OAAO,KAAK,MAAM,SAAS,QAAQ,QAAQ,CAAyB,GACvE,MAAM;AAET,QAAM,iBAAiB,aAAa,CAAC;AAErC,SACC,oBAAC,SAAI,WAAU,SACb,2BACA,oBAAC,uBAAoB,MAAY,YAAwB,IAEzD,MAAM,SAAS;AAAA,IAAI;AAAA,IAAU,CAAC,UAC7B,MAAM,aAAa,OAAO,EAAE,aAAa,WAAW,CAAC;AAAA,EACtD,GAEF;AAEF;AAEe,SAAR,WAA4B;AAAA,EAClC;AAAA,EACA,SAAS;AACV,GAMG;AACF,QAAM,UAAyB;AAAA,IAC9B,OAAO,OAAO,CAAC,UAAU,MAAM,OAAO,EAAE,IAAI,kBAAkB;AAAA,EAC/D;AACA,QAAM,EAAE,UAAU,YAAY,IAAI,gBAAgB,CAAC;AAEnD,SACC,oBAAC,iBAAc,UACd,8BAAC,SAAI,WAAU,iCACb,mBAAS,IAAI,CAAC,QAAa,UAC3B;AAAA,IAAC;AAAA;AAAA,MACA,aAAa,eAAe;AAAA,MAG3B;AAAA;AAAA,IAFI,GAAG,KAAK;AAAA,EAGd,CACA,GACF,GACD;AAEF","sourcesContent":["import { colors, IconLegend24, Popper, Portal } from \"@dhis2/ui\";\nimport { ControlPosition } from \"leaflet\";\nimport { compact, head } from \"lodash\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { MapLegendConfig } from \"../../../MapArea/interfaces\";\nimport { CustomControl } from \"../../../MapControls/components/CustomControl\";\nimport {\n\tCustomBubbleLayer,\n\tCustomGoogleEngineLayer,\n\tCustomPointLayer,\n\tCustomThematicLayer,\n\tSUPPORTED_EARTH_ENGINE_LAYERS,\n} from \"../../interfaces\";\nimport PointLegend from \"../PointLayer/components/PointLegend\";\nimport BubbleLegend from \"../ThematicLayer/components/Bubble/components/BubbleLegend\";\nimport ChoroplethLegend from \"../ThematicLayer/components/Choropleth/components/ChoroplethLegend\";\nimport EarthEngineLegend from \"../GoogleEngineLayer/components/EarthEngineLegend\";\nimport classes from \"./LegendArea.module.css\";\nimport { usePrintMedia } from \"../../../../hooks/map\";\n\nconst TOOLTIP_OFFSET = 4;\n\nfunction getLegendComponent(\n\tlayer: CustomThematicLayer | CustomPointLayer | CustomGoogleEngineLayer,\n) {\n\tif (layer.type === \"point\") {\n\t\treturn <PointLegend name={layer.label} />;\n\t}\n\n\tif (SUPPORTED_EARTH_ENGINE_LAYERS.includes(layer.type)) {\n\t\treturn (\n\t\t\t<EarthEngineLegend\n\t\t\t\tname={layer.name ?? \"\"}\n\t\t\t\tlayer={layer as CustomGoogleEngineLayer}\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst { type, enabled, control, dataItem, name, data, legends } =\n\t\t(layer as CustomThematicLayer) ?? {};\n\n\tif (!enabled || !control) {\n\t\treturn null;\n\t}\n\tswitch (type) {\n\t\tcase \"bubble\":\n\t\t\treturn (\n\t\t\t\t<BubbleLegend\n\t\t\t\t\tradius={\n\t\t\t\t\t\t(layer as CustomBubbleLayer)?.radius ?? {\n\t\t\t\t\t\t\tmin: 0,\n\t\t\t\t\t\t\tmax: 50,\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlegends={legends ?? []}\n\t\t\t\t\tname={name ?? dataItem.displayName}\n\t\t\t\t\tdata={data}\n\t\t\t\t\tdataItem={head(data)?.dataItem ?? dataItem}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"choropleth\":\n\t\t\treturn (\n\t\t\t\t<ChoroplethLegend\n\t\t\t\t\tlegends={legends ?? []}\n\t\t\t\t\tname={name ?? dataItem.displayName}\n\t\t\t\t\tdata={data}\n\t\t\t\t\tdataItem={head(data)?.dataItem ?? dataItem}\n\t\t\t\t/>\n\t\t\t);\n\t}\n}\n\nfunction CollapsedLegendIcon({\n\tonCollapse,\n\tname,\n}: {\n\tname: string;\n\tonCollapse: () => void;\n}) {\n\tconst openDelay = 200;\n\tconst closeDelay = 200;\n\tconst [openTooltip, setOpenTooltip] = useState(false);\n\tconst openTimerRef = useRef<any>(null);\n\tconst closeTimerRef = useRef<any>(null);\n\tconst ref = useRef<HTMLDivElement>(null);\n\n\tconst hideModifier = { name: \"hide\" };\n\tconst offsetModifier = {\n\t\tname: \"offset\",\n\t\toptions: {\n\t\t\toffset: [0, TOOLTIP_OFFSET],\n\t\t},\n\t};\n\n\tconst flipModifier = {\n\t\tname: \"flip\",\n\t\toptions: { altBoundary: true },\n\t};\n\n\tconst onMouseOver = () => {\n\t\tclearTimeout(closeTimerRef.current);\n\n\t\topenTimerRef.current = setTimeout(() => {\n\t\t\tsetOpenTooltip(true);\n\t\t}, openDelay);\n\t};\n\n\tconst onMouseOut = () => {\n\t\tclearTimeout(openTimerRef.current);\n\n\t\tcloseTimerRef.current = setTimeout(() => {\n\t\t\tsetOpenTooltip(false);\n\t\t}, closeDelay);\n\t};\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tclearTimeout(openTimerRef.current);\n\t\t\tclearTimeout(closeTimerRef.current);\n\t\t},\n\t\t[],\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tonMouseOver={onMouseOver}\n\t\t\tonMouseOut={onMouseOut}\n\t\t\tonClick={onCollapse}\n\t\t\tstyle={{ width: 28, height: 28 }}\n\t\t\tclassName=\"legend-card collapsed\"\n\t\t>\n\t\t\t<IconLegend24 />\n\t\t\t{openTooltip && (\n\t\t\t\t<Portal\n\t\t\t\t\t/*\n\t\t\t // @ts-ignore */\n\t\t\t\t\tclassName={classes[\"map-tooltip\"]}\n\t\t\t\t>\n\t\t\t\t\t<Popper\n\t\t\t\t\t\tclassName={classes[\"map-tooltip\"]}\n\t\t\t\t\t\treference={ref}\n\t\t\t\t\t\t/*\n // @ts-ignore */\n\t\t\t\t\t\tmodifiers={[offsetModifier, flipModifier, hideModifier]}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tbackgroundColor: `${colors.grey900}`,\n\t\t\t\t\t\t\t\tborderRadius: 3,\n\t\t\t\t\t\t\t\tcolor: `${colors.white}`,\n\t\t\t\t\t\t\t\tpadding: \"4px 6px\",\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tdata-test={`content`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{name}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Popper>\n\t\t\t\t</Portal>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nfunction Legend({\n\tchildren,\n\tcollapsible,\n}: {\n\tchildren: React.ReactElement;\n\tcollapsible: boolean;\n}) {\n\tconst [collapsed, setCollapsed] = useState(collapsible);\n\tconst inPrintMode = usePrintMedia();\n\tconst onCollapse = () => {\n\t\tif (collapsible) {\n\t\t\tsetCollapsed((prevState) => !prevState);\n\t\t}\n\t};\n\n\tconst name = head(React.Children.toArray(children) as React.ReactElement[])\n\t\t?.props.name;\n\n\tconst shouldCollapse = collapsed && !inPrintMode;\n\n\treturn (\n\t\t<div className=\"w-100\">\n\t\t\t{shouldCollapse ? (\n\t\t\t\t<CollapsedLegendIcon name={name} onCollapse={onCollapse} />\n\t\t\t) : (\n\t\t\t\tReact.Children.map(children, (child) =>\n\t\t\t\t\tReact.cloneElement(child, { collapsible, onCollapse }),\n\t\t\t\t)\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nexport default function LegendArea({\n\tlayers,\n\tlegends: legendConfig,\n}: {\n\tlayers: Array<\n\t\tCustomThematicLayer | CustomPointLayer | CustomGoogleEngineLayer\n\t>;\n\tposition: ControlPosition;\n\tlegends?: MapLegendConfig;\n}) {\n\tconst legends: JSX.Element[] = compact(\n\t\tlayers.filter((layer) => layer.enabled).map(getLegendComponent),\n\t);\n\tconst { position, collapsible } = legendConfig ?? {};\n\n\treturn (\n\t\t<CustomControl position={position}>\n\t\t\t<div className=\"column gap-16 align-items-end\">\n\t\t\t\t{legends?.map((legend: any, index) => (\n\t\t\t\t\t<Legend\n\t\t\t\t\t\tcollapsible={collapsible ?? true}\n\t\t\t\t\t\tkey={`${index}-map-legend`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{legend}\n\t\t\t\t\t</Legend>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t</CustomControl>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../../../../../../../src/components/Map/components/MapLayer/components/LegendArea/index.tsx"],"names":[],"mappings":"AA0BS,cAkGP,YAlGO;AA1BT,SAAS,QAAQ,cAAc,QAAQ,cAAc;AAErD,SAAS,SAAS,YAAY;AAC9B,OAAO,SAAS,WAAW,QAAQ,gBAAgB;AAEnD,SAAS,qBAAqB;AAC9B;AAAA,EAKC;AAAA,OACM;AACP,OAAO,iBAAiB;AACxB,OAAO,kBAAkB;AACzB,OAAO,sBAAsB;AAC7B,OAAO,uBAAuB;AAC9B,OAAO,aAAa;AACpB,SAAS,qBAAqB;AAE9B,MAAM,iBAAiB;AAEvB,SAAS,mBACR,OACC;AACD,MAAI,MAAM,SAAS,SAAS;AAC3B,WAAO,oBAAC,eAAY,MAAM,MAAM,OAAO;AAAA,EACxC;AAEA,MAAI,8BAA8B,SAAS,MAAM,IAAI,GAAG;AACvD,WACC;AAAA,MAAC;AAAA;AAAA,QACA,MAAM,MAAM,QAAQ;AAAA,QACpB;AAAA;AAAA,IACD;AAAA,EAEF;AAEA,QAAM,EAAE,MAAM,SAAS,SAAS,UAAU,MAAM,MAAM,QAAQ,IAC5D,SAAiC,CAAC;AAEpC,MAAI,CAAC,W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C,UAC7B,MAAM,aAAa,OAAO,EAAE,aAAa,WAAW,CAAC;AAAA,EACtD,GAEF;AAEF;AAEe,SAAR,WAA4B;AAAA,EAClC;AAAA,EACA,SAAS;AACV,GAMG;AACF,QAAM,UAAyB;AAAA,IAC9B,OAAO,OAAO,CAAC,UAAU,MAAM,OAAO,EAAE,IAAI,kBAAkB;AAAA,EAC/D;AACA,QAAM,EAAE,UAAU,YAAY,IAAI,gBAAgB,CAAC;AAEnD,SACC,oBAAC,iBAAc,UACd,8BAAC,SAAI,WAAU,iCACb,mBAAS,IAAI,CAAC,QAAa,UAC3B;AAAA,IAAC;AAAA;AAAA,MACA,aAAa,eAAe;AAAA,MAG3B;AAAA;AAAA,IAFI,GAAG,KAAK;AAAA,EAGd,CACA,GACF,GACD;AAEF","sourcesContent":["import { colors, IconLegend24, Popper, Portal } from \"@dhis2/ui\";\nimport { ControlPosition } from \"leaflet\";\nimport { compact, head } from \"lodash\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { MapLegendConfig } from \"../../../MapArea/interfaces/index.js\";\nimport { CustomControl } from \"../../../MapControls/components/CustomControl/index.js\";\nimport {\n\tCustomBubbleLayer,\n\tCustomGoogleEngineLayer,\n\tCustomPointLayer,\n\tCustomThematicLayer,\n\tSUPPORTED_EARTH_ENGINE_LAYERS,\n} from \"../../interfaces/index.js\";\nimport PointLegend from \"../PointLayer/components/PointLegend/index.js\";\nimport BubbleLegend from \"../ThematicLayer/components/Bubble/components/BubbleLegend/index.js\";\nimport ChoroplethLegend from \"../ThematicLayer/components/Choropleth/components/ChoroplethLegend.js\";\nimport EarthEngineLegend from \"../GoogleEngineLayer/components/EarthEngineLegend.js\";\nimport classes from \"./LegendArea.module.css\";\nimport { usePrintMedia } from \"../../../../hooks/map.js\";\n\nconst TOOLTIP_OFFSET = 4;\n\nfunction getLegendComponent(\n\tlayer: CustomThematicLayer | CustomPointLayer | CustomGoogleEngineLayer,\n) {\n\tif (layer.type === \"point\") {\n\t\treturn <PointLegend name={layer.label} />;\n\t}\n\n\tif (SUPPORTED_EARTH_ENGINE_LAYERS.includes(layer.type)) {\n\t\treturn (\n\t\t\t<EarthEngineLegend\n\t\t\t\tname={layer.name ?? \"\"}\n\t\t\t\tlayer={layer as CustomGoogleEngineLayer}\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst { type, enabled, control, dataItem, name, data, legends } =\n\t\t(layer as CustomThematicLayer) ?? {};\n\n\tif (!enabled || !control) {\n\t\treturn null;\n\t}\n\tswitch (type) {\n\t\tcase \"bubble\":\n\t\t\treturn (\n\t\t\t\t<BubbleLegend\n\t\t\t\t\tradius={\n\t\t\t\t\t\t(layer as CustomBubbleLayer)?.radius ?? {\n\t\t\t\t\t\t\tmin: 0,\n\t\t\t\t\t\t\tmax: 50,\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlegends={legends ?? []}\n\t\t\t\t\tname={name ?? dataItem.displayName}\n\t\t\t\t\tdata={data}\n\t\t\t\t\tdataItem={head(data)?.dataItem ?? dataItem}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"choropleth\":\n\t\t\treturn (\n\t\t\t\t<ChoroplethLegend\n\t\t\t\t\tlegends={legends ?? []}\n\t\t\t\t\tname={name ?? dataItem.displayName}\n\t\t\t\t\tdata={data}\n\t\t\t\t\tdataItem={head(data)?.dataItem ?? dataItem}\n\t\t\t\t/>\n\t\t\t);\n\t}\n}\n\nfunction CollapsedLegendIcon({\n\tonCollapse,\n\tname,\n}: {\n\tname: string;\n\tonCollapse: () => void;\n}) {\n\tconst openDelay = 200;\n\tconst closeDelay = 200;\n\tconst [openTooltip, setOpenTooltip] = useState(false);\n\tconst openTimerRef = useRef<any>(null);\n\tconst closeTimerRef = useRef<any>(null);\n\tconst ref = useRef<HTMLDivElement>(null);\n\n\tconst hideModifier = { name: \"hide\" };\n\tconst offsetModifier = {\n\t\tname: \"offset\",\n\t\toptions: {\n\t\t\toffset: [0, TOOLTIP_OFFSET],\n\t\t},\n\t};\n\n\tconst flipModifier = {\n\t\tname: \"flip\",\n\t\toptions: { altBoundary: true },\n\t};\n\n\tconst onMouseOver = () => {\n\t\tclearTimeout(closeTimerRef.current);\n\n\t\topenTimerRef.current = setTimeout(() => {\n\t\t\tsetOpenTooltip(true);\n\t\t}, openDelay);\n\t};\n\n\tconst onMouseOut = () => {\n\t\tclearTimeout(openTimerRef.current);\n\n\t\tcloseTimerRef.current = setTimeout(() => {\n\t\t\tsetOpenTooltip(false);\n\t\t}, closeDelay);\n\t};\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tclearTimeout(openTimerRef.current);\n\t\t\tclearTimeout(closeTimerRef.current);\n\t\t},\n\t\t[],\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tonMouseOver={onMouseOver}\n\t\t\tonMouseOut={onMouseOut}\n\t\t\tonClick={onCollapse}\n\t\t\tstyle={{ width: 28, height: 28 }}\n\t\t\tclassName=\"legend-card collapsed\"\n\t\t>\n\t\t\t<IconLegend24 />\n\t\t\t{openTooltip && (\n\t\t\t\t<Portal\n\t\t\t\t\t/*\n\t\t\t // @ts-ignore */\n\t\t\t\t\tclassName={classes[\"map-tooltip\"]}\n\t\t\t\t>\n\t\t\t\t\t<Popper\n\t\t\t\t\t\tclassName={classes[\"map-tooltip\"]}\n\t\t\t\t\t\treference={ref}\n\t\t\t\t\t\t/*\n // @ts-ignore */\n\t\t\t\t\t\tmodifiers={[offsetModifier, flipModifier, hideModifier]}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tbackgroundColor: `${colors.grey900}`,\n\t\t\t\t\t\t\t\tborderRadius: 3,\n\t\t\t\t\t\t\t\tcolor: `${colors.white}`,\n\t\t\t\t\t\t\t\tpadding: \"4px 6px\",\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tdata-test={`content`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{name}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Popper>\n\t\t\t\t</Portal>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nfunction Legend({\n\tchildren,\n\tcollapsible,\n}: {\n\tchildren: React.ReactElement;\n\tcollapsible: boolean;\n}) {\n\tconst [collapsed, setCollapsed] = useState(collapsible);\n\tconst inPrintMode = usePrintMedia();\n\tconst onCollapse = () => {\n\t\tif (collapsible) {\n\t\t\tsetCollapsed((prevState) => !prevState);\n\t\t}\n\t};\n\n\tconst name = head(React.Children.toArray(children) as React.ReactElement[])\n\t\t?.props.name;\n\n\tconst shouldCollapse = collapsed && !inPrintMode;\n\n\treturn (\n\t\t<div className=\"w-100\">\n\t\t\t{shouldCollapse ? (\n\t\t\t\t<CollapsedLegendIcon name={name} onCollapse={onCollapse} />\n\t\t\t) : (\n\t\t\t\tReact.Children.map(children, (child) =>\n\t\t\t\t\tReact.cloneElement(child, { collapsible, onCollapse }),\n\t\t\t\t)\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nexport default function LegendArea({\n\tlayers,\n\tlegends: legendConfig,\n}: {\n\tlayers: Array<\n\t\tCustomThematicLayer | CustomPointLayer | CustomGoogleEngineLayer\n\t>;\n\tposition: ControlPosition;\n\tlegends?: MapLegendConfig;\n}) {\n\tconst legends: JSX.Element[] = compact(\n\t\tlayers.filter((layer) => layer.enabled).map(getLegendComponent),\n\t);\n\tconst { position, collapsible } = legendConfig ?? {};\n\n\treturn (\n\t\t<CustomControl position={position}>\n\t\t\t<div className=\"column gap-16 align-items-end\">\n\t\t\t\t{legends?.map((legend: any, index) => (\n\t\t\t\t\t<Legend\n\t\t\t\t\t\tcollapsible={collapsible ?? true}\n\t\t\t\t\t\tkey={`${index}-map-legend`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{legend}\n\t\t\t\t\t</Legend>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t</CustomControl>\n\t);\n}\n"]}
@@ -4,9 +4,9 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var appRuntime = require('@dhis2/app-runtime');
5
5
  var ui = require('@dhis2/ui');
6
6
  var react = require('react');
7
- var helpers = require('../../../../../../utils/helpers');
8
- var LegendCardHeader = require('../../../LegendArea/components/LegendCardHeader');
9
- var hooks = require('../../hooks');
7
+ var helpers_js = require('../../../../../../utils/helpers.js');
8
+ var LegendCardHeader = require('../../../LegendArea/components/LegendCardHeader/index.js');
9
+ var index_js = require('../../hooks/index.js');
10
10
 
11
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
 
@@ -35,7 +35,7 @@ function PointLegends({
35
35
  height: 20,
36
36
  width: 20,
37
37
  alt: `${name}-icon`,
38
- src: helpers.getIconUrl(icon, { baseUrl })
38
+ src: helpers_js.getIconUrl(icon, { baseUrl })
39
39
  }
40
40
  ),
41
41
  /* @__PURE__ */ jsxRuntime.jsx("p", { children: label })
@@ -55,7 +55,7 @@ function PointLegends({
55
55
  height: 20,
56
56
  width: 20,
57
57
  alt: `${name2}-icon`,
58
- src: helpers.getIconUrl(symbol ?? "", { baseUrl })
58
+ src: helpers_js.getIconUrl(symbol ?? "", { baseUrl })
59
59
  }
60
60
  ),
61
61
  /* @__PURE__ */ jsxRuntime.jsx("p", { children: name2 })
@@ -69,12 +69,26 @@ function PointLegends({
69
69
  );
70
70
  }
71
71
  function PointLegend({ collapsible, onCollapse }, ref) {
72
- const pointLayer = hooks.usePointLayer();
72
+ const pointLayer = index_js.usePointLayer();
73
73
  const { label, style } = pointLayer ?? {};
74
74
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: "legend-card", children: [
75
- /* @__PURE__ */ jsxRuntime.jsx(LegendCardHeader__default.default, { collapsible, onCollapse, title: label ?? "Points" }),
75
+ /* @__PURE__ */ jsxRuntime.jsx(
76
+ LegendCardHeader__default.default,
77
+ {
78
+ collapsible,
79
+ onCollapse,
80
+ title: label ?? "Points"
81
+ }
82
+ ),
76
83
  /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { margin: "0" }),
77
- /* @__PURE__ */ jsxRuntime.jsx(PointLegends, { label, orgUnitGroups: style?.orgUnitGroups ?? [], icon: style?.icon })
84
+ /* @__PURE__ */ jsxRuntime.jsx(
85
+ PointLegends,
86
+ {
87
+ label,
88
+ orgUnitGroups: style?.orgUnitGroups ?? [],
89
+ icon: style?.icon
90
+ }
91
+ )
78
92
  ] });
79
93
  }
80
94
  var PointLegend_default = react.forwardRef(PointLegend);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../src/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.tsx"],"names":["name"],"mappings":"AAwBI,SAIC,KAJD;AAxBJ,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAgB,kBAAkB;AAClC,SAAS,kBAAkB;AAC3B,OAAO,sBAAsB;AAC7B,SAAS,qBAAqB;AAE9B,SAAS,aAAa;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AACD,GAIG;AACF,QAAM,EAAE,QAAQ,IAAI,UAAU;AAE9B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAO,EAAE,UAAU,KAAK,YAAY,aAAa;AAAA,MACjD,WAAU;AAAA,MAET;AAAA,gBACA;AAAA,UAAC;AAAA;AAAA,YAEA,WAAU;AAAA,YAEV;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACA,QAAQ;AAAA,kBACR,OAAO;AAAA,kBACP,KAAK,GAAG,IAAI;AAAA,kBACZ,KAAK,WAAW,MAAM,EAAE,QAAQ,CAAC;AAAA;AAAA,cAClC;AAAA,cACA,oBAAC,OAAG,iBAAM;AAAA;AAAA;AAAA,UATL,GAAG,IAAI;AAAA,QAUb;AAAA,QAEA,cAAc,IAAI,CAAC,EAAE,MAAAA,OAAM,OAAO,MAAM;AACxC,iBACC;AAAA,YAAC;AAAA;AAAA,cAEA,WAAU;AAAA,cAEV;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACA,QAAQ;AAAA,oBACR,OAAO;AAAA,oBACP,KAAK,GAAGA,KAAI;AAAA,oBACZ,KAAK,WAAW,UAAU,IAAI,EAAE,QAAQ,CAAC;AAAA;AAAA,gBAC1C;AAAA,gBACA,oBAAC,OAAG,UAAAA,OAAK;AAAA;AAAA;AAAA,YATJ,GAAGA,KAAI;AAAA,UAUb;AAAA,QAEF,CAAC;AAAA;AAAA;AAAA,EACF;AAEF;AAEA,SAAS,YAAY,EAAE,aAAa,WAAW,GAAQ,KAAsC;AAC3F,QAAM,aAAa,cAAc;AACjC,QAAM,EAAE,OAAO,MAAM,IAAI,cAAc,CAAC;AAExC,SACE,qBAAC,SAAI,KAAU,WAAU,eACvB;AAAA,wBAAC,oBAAiB,aAA0B,YAAwB,OAAO,SAAS,UAAU;AAAA,IAC9F,oBAAC,WAAQ,QAAQ,KAAK;AAAA,IACtB,oBAAC,gBAAa,OAAc,eAAe,OAAO,iBAAiB,CAAC,GAAG,MAAM,OAAO,MAAM;AAAA,KAC5F;AAEJ;AAEA,IAAO,sBAAQ,WAAW,WAAW","sourcesContent":["import { useConfig } from \"@dhis2/app-runtime\";\nimport { Divider } from \"@dhis2/ui\";\nimport React, { forwardRef } from \"react\";\nimport { getIconUrl } from \"../../../../../../utils/helpers\";\nimport LegendCardHeader from \"../../../LegendArea/components/LegendCardHeader\";\nimport { usePointLayer } from \"../../hooks\";\n\nfunction PointLegends({\n\torgUnitGroups,\n\ticon,\n\tlabel,\n}: {\n\torgUnitGroups: { name: string; symbol: string }[];\n\ticon?: string;\n\tlabel?: string;\n}) {\n\tconst { baseUrl } = useConfig();\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{ minWidth: 100, alignItems: \"flex-start\" }}\n\t\t\tclassName=\"w-100 p-8 legend-list column\"\n\t\t>\n\t\t\t{icon && (\n\t\t\t\t<div\n\t\t\t\t\tkey={`${icon}-legend`}\n\t\t\t\t\tclassName=\"row gap-16 align-items-center\"\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\theight={20}\n\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\talt={`${name}-icon`}\n\t\t\t\t\t\tsrc={getIconUrl(icon, { baseUrl })}\n\t\t\t\t\t/>\n\t\t\t\t\t<p>{label}</p>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{orgUnitGroups.map(({ name, symbol }) => {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={`${name}-legend`}\n\t\t\t\t\t\tclassName=\"row gap-16 align-items-center\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\t\talt={`${name}-icon`}\n\t\t\t\t\t\t\tsrc={getIconUrl(symbol ?? \"\", { baseUrl })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<p>{name}</p>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t})}\n\t\t</div>\n\t);\n}\n\nfunction PointLegend({ collapsible, onCollapse }: any, ref: React.LegacyRef<HTMLDivElement>) {\n const pointLayer = usePointLayer();\n const { label, style } = pointLayer ?? {};\n\n return (\n <div ref={ref} className=\"legend-card\">\n <LegendCardHeader collapsible={collapsible} onCollapse={onCollapse} title={label ?? \"Points\"} />\n <Divider margin={\"0\"} />\n <PointLegends label={label} orgUnitGroups={style?.orgUnitGroups ?? []} icon={style?.icon} />\n </div>\n );\n}\n\nexport default forwardRef(PointLegend);\n"]}
1
+ {"version":3,"sources":["../../../../../../../../../src/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.tsx"],"names":["name"],"mappings":"AAwBI,SAIC,KAJD;AAxBJ,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAgB,kBAAkB;AAClC,SAAS,kBAAkB;AAC3B,OAAO,sBAAsB;AAC7B,SAAS,qBAAqB;AAE9B,SAAS,aAAa;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AACD,GAIG;AACF,QAAM,EAAE,QAAQ,IAAI,UAAU;AAE9B,SACC;AA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;AAEF;AAEA,IAAO,sBAAQ,WAAW,WAAW","sourcesContent":["import { useConfig } from \"@dhis2/app-runtime\";\nimport { Divider } from \"@dhis2/ui\";\nimport React, { forwardRef } from \"react\";\nimport { getIconUrl } from \"../../../../../../utils/helpers.js\";\nimport LegendCardHeader from \"../../../LegendArea/components/LegendCardHeader/index.js\";\nimport { usePointLayer } from \"../../hooks/index.js\";\n\nfunction PointLegends({\n\torgUnitGroups,\n\ticon,\n\tlabel,\n}: {\n\torgUnitGroups: { name: string; symbol: string }[];\n\ticon?: string;\n\tlabel?: string;\n}) {\n\tconst { baseUrl } = useConfig();\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{ minWidth: 100, alignItems: \"flex-start\" }}\n\t\t\tclassName=\"w-100 p-8 legend-list column\"\n\t\t>\n\t\t\t{icon && (\n\t\t\t\t<div\n\t\t\t\t\tkey={`${icon}-legend`}\n\t\t\t\t\tclassName=\"row gap-16 align-items-center\"\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\theight={20}\n\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\talt={`${name}-icon`}\n\t\t\t\t\t\tsrc={getIconUrl(icon, { baseUrl })}\n\t\t\t\t\t/>\n\t\t\t\t\t<p>{label}</p>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{orgUnitGroups.map(({ name, symbol }) => {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={`${name}-legend`}\n\t\t\t\t\t\tclassName=\"row gap-16 align-items-center\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\t\talt={`${name}-icon`}\n\t\t\t\t\t\t\tsrc={getIconUrl(symbol ?? \"\", { baseUrl })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<p>{name}</p>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t})}\n\t\t</div>\n\t);\n}\n\nfunction PointLegend(\n\t{ collapsible, onCollapse }: any,\n\tref: React.LegacyRef<HTMLDivElement>,\n) {\n\tconst pointLayer = usePointLayer();\n\tconst { label, style } = pointLayer ?? {};\n\n\treturn (\n\t\t<div ref={ref} className=\"legend-card\">\n\t\t\t<LegendCardHeader\n\t\t\t\tcollapsible={collapsible}\n\t\t\t\tonCollapse={onCollapse}\n\t\t\t\ttitle={label ?? \"Points\"}\n\t\t\t/>\n\t\t\t<Divider margin={\"0\"} />\n\t\t\t<PointLegends\n\t\t\t\tlabel={label}\n\t\t\t\torgUnitGroups={style?.orgUnitGroups ?? []}\n\t\t\t\ticon={style?.icon}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default forwardRef(PointLegend);\n"]}
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var lodash = require('lodash');
4
- var hooks = require('../../../../MapProvider/hooks');
4
+ var index_js = require('../../../../MapProvider/hooks/index.js');
5
5
 
6
6
  function usePointLayer() {
7
- const { layers } = hooks.useMapLayers();
7
+ const { layers } = index_js.useMapLayers();
8
8
  return lodash.find(layers, ["type", "point"]);
9
9
  }
10
10
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/PointLayer/hooks/index.ts"],"names":[],"mappings":"AAAA,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAGtB,SAAS,gBAAgB;AAC/B,QAAM,EAAE,OAAO,IAAI,aAAa;AAChC,SAAO,KAAK,QAAQ,CAAC,QAAQ,OAAO,CAAC;AACtC","sourcesContent":["import { find } from \"lodash\";\nimport { useMapLayers } from \"../../../../MapProvider/hooks\";\nimport { CustomPointLayer } from \"../../../interfaces\";\n\nexport function usePointLayer() {\n\tconst { layers } = useMapLayers();\n\treturn find(layers, [\"type\", \"point\"]) as CustomPointLayer;\n}\n"]}
1
+ {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/PointLayer/hooks/index.ts"],"names":[],"mappings":"AAAA,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAGtB,SAAS,gBAAgB;AAC/B,QAAM,EAAE,OAAO,IAAI,aAAa;AAChC,SAAO,KAAK,QAAQ,CAAC,QAAQ,OAAO,CAAC;AACtC","sourcesContent":["import { find } from \"lodash\";\nimport { useMapLayers } from \"../../../../MapProvider/hooks/index.js\";\nimport { CustomPointLayer } from \"../../../interfaces/index.js\";\n\nexport function usePointLayer() {\n\tconst { layers } = useMapLayers();\n\treturn find(layers, [\"type\", \"point\"]) as CustomPointLayer;\n}\n"]}
@@ -5,8 +5,8 @@ var appRuntime = require('@dhis2/app-runtime');
5
5
  var i18n = require('@dhis2/d2-i18n');
6
6
  var L = require('leaflet');
7
7
  var reactLeaflet = require('react-leaflet');
8
- var helpers = require('../../../../utils/helpers');
9
- var hooks = require('./hooks');
8
+ var helpers_js = require('../../../../utils/helpers.js');
9
+ var index_js = require('./hooks/index.js');
10
10
 
11
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
 
@@ -14,7 +14,7 @@ var i18n__default = /*#__PURE__*/_interopDefault(i18n);
14
14
  var L__default = /*#__PURE__*/_interopDefault(L);
15
15
 
16
16
  function PointLayer() {
17
- const pointLayer = hooks.usePointLayer();
17
+ const pointLayer = index_js.usePointLayer();
18
18
  const { enabled, label, points: orgUnits, style } = pointLayer ?? {};
19
19
  const { baseUrl } = appRuntime.useConfig();
20
20
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -28,8 +28,8 @@ function PointLayer() {
28
28
  {
29
29
  pointToLayer: (_, coordinates) => {
30
30
  return L__default.default.marker(coordinates, {
31
- icon: helpers.getIcon(
32
- helpers.getIconUrl(
31
+ icon: helpers_js.getIcon(
32
+ helpers_js.getIconUrl(
33
33
  area.icon.icon ?? style?.icon,
34
34
  { baseUrl }
35
35
  )