@hisptz/dhis2-analytics 1.0.5 → 1.0.7
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.
- package/build/cjs/components/ChartAnalytics/ChartAnalytics.stories.js +253 -0
- package/build/cjs/components/ChartAnalytics/ChartAnalytics.test.js +51 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +48 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +34 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/index.js +67 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/column-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/complex-multi-series-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/multi-series-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/pie-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/stacked-chart-data.json +0 -0
- package/build/cjs/components/ChartAnalytics/hooks/useChart.js +38 -0
- package/build/cjs/components/ChartAnalytics/index.js +69 -0
- package/build/cjs/components/ChartAnalytics/models/column.js +53 -0
- package/build/cjs/components/ChartAnalytics/models/index.js +102 -0
- package/build/cjs/components/ChartAnalytics/models/line.js +35 -0
- package/build/cjs/components/ChartAnalytics/models/multi-series.js +111 -0
- package/build/cjs/components/ChartAnalytics/models/pie.js +53 -0
- package/build/cjs/components/ChartAnalytics/services/export.js +50 -0
- package/{src → build/cjs}/components/ChartAnalytics/styles/custom-highchart.css +0 -0
- package/build/cjs/components/ChartAnalytics/types/props.js +1 -0
- package/build/cjs/components/ChartAnalytics/utils/chart.js +133 -0
- package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.stories.js +45 -0
- package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.test.js +13 -0
- package/build/cjs/components/CircularProgressDashboard/index.js +49 -0
- package/build/cjs/components/CircularProgressDashboard/types/props.js +1 -0
- package/build/cjs/components/Map/Map.stories.js +352 -0
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +32 -0
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +40 -0
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/index.js +458 -0
- package/build/cjs/components/Map/components/MapArea/index.js +101 -0
- package/build/cjs/components/Map/components/MapArea/interfaces/index.js +1 -0
- package/build/cjs/components/Map/components/MapControls/components/CustomControl/index.js +32 -0
- package/build/cjs/components/Map/components/MapControls/components/DownloadControl/index.js +25 -0
- package/build/cjs/components/Map/components/MapControls/components/FullscreenControl/index.js +13 -0
- package/build/cjs/components/Map/components/MapControls/index.js +42 -0
- package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +13 -0
- package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/index.js +51 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +106 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +379 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +36 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +200 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +14 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +412 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +124 -0
- package/{src → build/cjs}/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +0 -0
- package/build/cjs/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +26 -0
- package/build/cjs/components/Map/components/MapLayer/components/LegendArea/index.js +181 -0
- package/build/cjs/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +86 -0
- package/build/cjs/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +14 -0
- package/build/cjs/components/Map/components/MapLayer/components/PointLayer/index.js +46 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +57 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js +145 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +43 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +56 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +61 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +43 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +35 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +15 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/index.js +57 -0
- package/{src → build/cjs}/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +0 -0
- package/build/cjs/components/Map/components/MapLayer/index.js +40 -0
- package/build/cjs/components/Map/components/MapLayer/interfaces/index.js +8 -0
- package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +389 -0
- package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/index.js +116 -0
- package/build/cjs/components/Map/components/MapProvider/hooks/index.js +19 -0
- package/build/cjs/components/Map/components/MapProvider/index.js +121 -0
- package/build/cjs/components/Map/components/MapUpdater/index.js +24 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +32 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +40 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +40 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js +428 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +63 -0
- package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +0 -0
- package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +0 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +72 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +71 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +47 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +79 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/index.js +265 -0
- package/build/cjs/components/Map/constants/colors.js +428 -0
- package/build/cjs/components/Map/constants/legendSet.js +22 -0
- package/build/cjs/components/Map/hooks/map.js +52 -0
- package/build/cjs/components/Map/index.js +108 -0
- package/build/cjs/components/Map/interfaces/index.js +1 -0
- package/build/cjs/components/Map/state/index.js +23 -0
- package/build/cjs/components/Map/utils/colors.js +78 -0
- package/build/cjs/components/Map/utils/helpers.js +25 -0
- package/build/cjs/components/Map/utils/map.js +161 -0
- package/build/cjs/components/SingleValueContainer/SingleValueContainer.stories.js +127 -0
- package/build/cjs/components/SingleValueContainer/SingleValueContainer.test.js +23 -0
- package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +54 -0
- package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +24 -0
- package/build/cjs/components/SingleValueContainer/index.js +43 -0
- package/{src → build/cjs}/components/SingleValueContainer/styles/SingleValueContainer.module.css +0 -0
- package/build/cjs/components/SingleValueContainer/types/props.js +1 -0
- package/{src → build/cjs}/data/map.json +0 -0
- package/build/cjs/dataProviders/map.js +31 -0
- package/build/cjs/index.js +49 -0
- package/build/cjs/locales/en/translations.json +128 -0
- package/build/cjs/locales/index.js +22 -0
- package/build/es/components/ChartAnalytics/ChartAnalytics.stories.js +235 -0
- package/build/es/components/ChartAnalytics/ChartAnalytics.test.js +46 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +41 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +26 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/index.js +58 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
- package/build/es/components/ChartAnalytics/data/column-data.json +210 -0
- package/build/es/components/ChartAnalytics/data/complex-multi-series-data.json +124 -0
- package/build/es/components/ChartAnalytics/data/multi-series-data.json +536 -0
- package/build/es/components/ChartAnalytics/data/pie-data.json +115 -0
- package/build/es/components/ChartAnalytics/data/stacked-chart-data.json +415 -0
- package/build/es/components/ChartAnalytics/hooks/useChart.js +32 -0
- package/build/es/components/ChartAnalytics/index.js +40 -0
- package/build/es/components/ChartAnalytics/models/column.js +45 -0
- package/build/es/components/ChartAnalytics/models/index.js +95 -0
- package/build/es/components/ChartAnalytics/models/line.js +28 -0
- package/build/es/components/ChartAnalytics/models/multi-series.js +104 -0
- package/build/es/components/ChartAnalytics/models/pie.js +46 -0
- package/build/es/components/ChartAnalytics/services/export.js +36 -0
- package/build/es/components/ChartAnalytics/styles/custom-highchart.css +48 -0
- package/build/es/components/ChartAnalytics/types/props.js +1 -0
- package/build/es/components/ChartAnalytics/utils/chart.js +122 -0
- package/{src/components/CircularProgressDashboard/CircularProgressIndicator.stories.tsx → build/es/components/CircularProgressDashboard/CircularProgressIndicator.stories.js} +9 -16
- package/build/es/components/CircularProgressDashboard/CircularProgressIndicator.test.js +10 -0
- package/build/es/components/CircularProgressDashboard/index.js +41 -0
- package/build/es/components/CircularProgressDashboard/types/props.js +1 -0
- package/build/es/components/Map/Map.stories.js +334 -0
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +23 -0
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +31 -0
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/index.js +448 -0
- package/build/es/components/Map/components/MapArea/index.js +91 -0
- package/build/es/components/Map/components/MapArea/interfaces/index.js +1 -0
- package/build/es/components/Map/components/MapControls/components/CustomControl/index.js +25 -0
- package/build/es/components/Map/components/MapControls/components/DownloadControl/index.js +18 -0
- package/build/es/components/Map/components/MapControls/components/FullscreenControl/index.js +6 -0
- package/build/es/components/Map/components/MapControls/index.js +35 -0
- package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +7 -0
- package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/index.js +41 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +95 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +369 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +29 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +191 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +14 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +403 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +111 -0
- package/build/es/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +12 -0
- package/build/es/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +19 -0
- package/build/es/components/Map/components/MapLayer/components/LegendArea/index.js +172 -0
- package/build/es/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +76 -0
- package/build/es/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +8 -0
- package/build/es/components/Map/components/MapLayer/components/PointLayer/index.js +39 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +49 -0
- package/{src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.tsx → build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js} +57 -74
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +33 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +47 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +50 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +36 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +28 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +9 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/index.js +50 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +62 -0
- package/build/es/components/Map/components/MapLayer/index.js +33 -0
- package/build/es/components/Map/components/MapLayer/interfaces/index.js +1 -0
- package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +381 -0
- package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/index.js +107 -0
- package/{src/components/Map/components/MapProvider/hooks/index.ts → build/es/components/Map/components/MapProvider/hooks/index.js} +3 -6
- package/build/es/components/Map/components/MapProvider/index.js +112 -0
- package/build/es/components/Map/components/MapUpdater/index.js +17 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +23 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +31 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +33 -0
- package/{src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.ts → build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js} +46 -59
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +53 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +15 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +12 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +56 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +64 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +38 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +70 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/index.js +254 -0
- package/{src/components/Map/constants/colors.ts → build/es/components/Map/constants/colors.js} +46 -59
- package/build/es/components/Map/constants/legendSet.js +15 -0
- package/build/es/components/Map/hooks/map.js +44 -0
- package/build/es/components/Map/index.js +51 -0
- package/build/es/components/Map/interfaces/index.js +1 -0
- package/build/es/components/Map/state/index.js +14 -0
- package/build/es/components/Map/utils/colors.js +61 -0
- package/build/es/components/Map/utils/helpers.js +14 -0
- package/build/es/components/Map/utils/map.js +147 -0
- package/build/es/components/SingleValueContainer/SingleValueContainer.stories.js +115 -0
- package/build/es/components/SingleValueContainer/SingleValueContainer.test.js +20 -0
- package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +47 -0
- package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +17 -0
- package/build/es/components/SingleValueContainer/index.js +29 -0
- package/build/es/components/SingleValueContainer/styles/SingleValueContainer.module.css +39 -0
- package/build/es/components/SingleValueContainer/types/props.js +1 -0
- package/build/es/data/map.json +5984 -0
- package/build/es/dataProviders/map.js +24 -0
- package/build/es/index.js +5 -0
- package/build/es/locales/en/translations.json +128 -0
- package/build/es/locales/index.js +13 -0
- package/build/types/components/ChartAnalytics/components/DownloadMenu/components/Menu.d.ts +8 -0
- package/build/types/components/ChartAnalytics/components/DownloadMenu/constants/menu.d.ts +7 -0
- package/build/types/components/ChartAnalytics/components/DownloadMenu/index.d.ts +9 -0
- package/{src/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.ts → build/types/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.d.ts} +0 -0
- package/build/types/components/ChartAnalytics/hooks/useChart.d.ts +11 -0
- package/build/types/components/ChartAnalytics/index.d.ts +9 -0
- package/build/types/components/ChartAnalytics/models/column.d.ts +12 -0
- package/build/types/components/ChartAnalytics/models/index.d.ts +17 -0
- package/build/types/components/ChartAnalytics/models/line.d.ts +8 -0
- package/build/types/components/ChartAnalytics/models/multi-series.d.ts +9 -0
- package/build/types/components/ChartAnalytics/models/pie.d.ts +8 -0
- package/build/types/components/ChartAnalytics/services/export.d.ts +8 -0
- package/build/types/components/ChartAnalytics/types/props.d.ts +43 -0
- package/build/types/components/ChartAnalytics/utils/chart.d.ts +15 -0
- package/build/types/components/CircularProgressDashboard/index.d.ts +3 -0
- package/build/types/components/CircularProgressDashboard/types/props.d.ts +17 -0
- package/build/types/components/Map/components/EarthEngineLayerConfiguration/index.d.ts +17 -0
- package/build/types/components/Map/components/MapArea/index.d.ts +5 -0
- package/build/types/components/Map/components/MapArea/interfaces/index.d.ts +30 -0
- package/build/types/components/Map/components/MapControls/components/CustomControl/index.d.ts +7 -0
- package/build/types/components/Map/components/MapControls/components/DownloadControl/index.d.ts +8 -0
- package/build/types/components/Map/components/MapControls/components/FullscreenControl/index.d.ts +5 -0
- package/build/types/components/Map/components/MapControls/index.d.ts +6 -0
- package/build/types/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.d.ts +1 -0
- package/build/types/components/Map/components/MapLayer/components/BoundaryLayer/index.d.ts +15 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.d.ts +17 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.d.ts +4 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.d.ts +9 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/index.d.ts +4 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.d.ts +58 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.d.ts +1 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.d.ts +55 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.d.ts +20 -0
- package/build/types/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.d.ts +6 -0
- package/build/types/components/Map/components/MapLayer/components/LegendArea/index.d.ts +9 -0
- package/build/types/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.d.ts +3 -0
- package/build/types/components/Map/components/MapLayer/components/PointLayer/hooks/index.d.ts +2 -0
- package/build/types/components/Map/components/MapLayer/components/PointLayer/index.d.ts +2 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.d.ts +13 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.d.ts +10 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.d.ts +16 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.d.ts +12 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.d.ts +21 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.d.ts +12 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.d.ts +5 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.d.ts +2 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/index.d.ts +5 -0
- package/build/types/components/Map/components/MapLayer/index.d.ts +6 -0
- package/build/types/components/Map/components/MapLayer/interfaces/index.d.ts +123 -0
- package/build/types/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.d.ts +9 -0
- package/build/types/components/Map/components/MapProvider/components/MapLayerProvider/index.d.ts +6 -0
- package/build/types/components/Map/components/MapProvider/hooks/index.d.ts +15 -0
- package/build/types/components/Map/components/MapProvider/index.d.ts +3 -0
- package/build/types/components/Map/components/MapUpdater/index.d.ts +5 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.d.ts +8 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.d.ts +419 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.d.ts +9 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.d.ts +11 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.d.ts +2 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.d.ts +8 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.d.ts +9 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/index.d.ts +18 -0
- package/build/types/components/Map/constants/colors.d.ts +419 -0
- package/build/types/components/Map/constants/legendSet.d.ts +7 -0
- package/build/types/components/Map/hooks/map.d.ts +9 -0
- package/build/types/components/Map/index.d.ts +8 -0
- package/build/types/components/Map/interfaces/index.d.ts +65 -0
- package/build/types/components/Map/state/index.d.ts +20 -0
- package/build/types/components/Map/utils/colors.d.ts +12 -0
- package/build/types/components/Map/utils/helpers.d.ts +6 -0
- package/build/types/components/Map/utils/map.d.ts +40 -0
- package/build/types/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.d.ts +8 -0
- package/build/types/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.d.ts +2 -0
- package/build/types/components/SingleValueContainer/index.d.ts +5 -0
- package/build/types/components/SingleValueContainer/types/props.d.ts +15 -0
- package/build/types/dataProviders/map.d.ts +4 -0
- package/{src/index.ts → build/types/index.d.ts} +0 -0
- package/package.json +26 -5
- package/d2.config.js +0 -8
- package/i18n/en.pot +0 -409
- package/src/components/ChartAnalytics/ChartAnalytics.stories.tsx +0 -250
- package/src/components/ChartAnalytics/ChartAnalytics.test.tsx +0 -51
- package/src/components/ChartAnalytics/components/DownloadMenu/components/Menu.tsx +0 -48
- package/src/components/ChartAnalytics/components/DownloadMenu/constants/menu.ts +0 -38
- package/src/components/ChartAnalytics/components/DownloadMenu/index.tsx +0 -67
- package/src/components/ChartAnalytics/hooks/useChart.ts +0 -35
- package/src/components/ChartAnalytics/index.tsx +0 -23
- package/src/components/ChartAnalytics/models/column.ts +0 -50
- package/src/components/ChartAnalytics/models/index.ts +0 -78
- package/src/components/ChartAnalytics/models/line.ts +0 -31
- package/src/components/ChartAnalytics/models/multi-series.ts +0 -115
- package/src/components/ChartAnalytics/models/pie.ts +0 -54
- package/src/components/ChartAnalytics/services/export.ts +0 -38
- package/src/components/ChartAnalytics/types/props.tsx +0 -48
- package/src/components/ChartAnalytics/utils/chart.ts +0 -123
- package/src/components/CircularProgressDashboard/CircularProgressIndicator.test.tsx +0 -9
- package/src/components/CircularProgressDashboard/index.tsx +0 -35
- package/src/components/CircularProgressDashboard/types/props.tsx +0 -17
- package/src/components/Map/Map.stories.tsx +0 -339
- package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.tsx +0 -28
- package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.tsx +0 -34
- package/src/components/Map/components/EarthEngineLayerConfiguration/index.tsx +0 -412
- package/src/components/Map/components/MapArea/index.tsx +0 -83
- package/src/components/Map/components/MapArea/interfaces/index.ts +0 -39
- package/src/components/Map/components/MapControls/components/CustomControl/index.tsx +0 -24
- package/src/components/Map/components/MapControls/components/DownloadControl/index.tsx +0 -10
- package/src/components/Map/components/MapControls/components/FullscreenControl/index.tsx +0 -7
- package/src/components/Map/components/MapControls/index.tsx +0 -24
- package/src/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.ts +0 -7
- package/src/components/Map/components/MapLayer/components/BoundaryLayer/index.tsx +0 -55
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.tsx +0 -76
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.ts +0 -430
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.ts +0 -34
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/index.tsx +0 -185
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.ts +0 -56
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +0 -34233
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.ts +0 -431
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.ts +0 -105
- package/src/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.tsx +0 -17
- package/src/components/Map/components/MapLayer/components/LegendArea/index.tsx +0 -168
- package/src/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.tsx +0 -44
- package/src/components/Map/components/MapLayer/components/PointLayer/hooks/index.ts +0 -8
- package/src/components/Map/components/MapLayer/components/PointLayer/index.tsx +0 -36
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.tsx +0 -48
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.tsx +0 -39
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.tsx +0 -57
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.tsx +0 -43
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.tsx +0 -38
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.tsx +0 -26
- package/src/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.ts +0 -10
- package/src/components/Map/components/MapLayer/components/ThematicLayer/index.tsx +0 -46
- package/src/components/Map/components/MapLayer/index.tsx +0 -32
- package/src/components/Map/components/MapLayer/interfaces/index.ts +0 -139
- package/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx +0 -359
- package/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx +0 -105
- package/src/components/Map/components/MapProvider/index.tsx +0 -93
- package/src/components/Map/components/MapUpdater/index.tsx +0 -8
- package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.tsx +0 -28
- package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.tsx +0 -34
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.tsx +0 -24
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.tsx +0 -50
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.ts +0 -91
- package/src/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.tsx +0 -45
- package/src/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.tsx +0 -47
- package/src/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.tsx +0 -57
- package/src/components/Map/components/ThematicLayerConfiguration/index.tsx +0 -248
- package/src/components/Map/constants/legendSet.ts +0 -19
- package/src/components/Map/hooks/map.ts +0 -47
- package/src/components/Map/index.tsx +0 -65
- package/src/components/Map/interfaces/index.ts +0 -57
- package/src/components/Map/state/index.tsx +0 -31
- package/src/components/Map/utils/colors.ts +0 -95
- package/src/components/Map/utils/helpers.ts +0 -15
- package/src/components/Map/utils/map.ts +0 -150
- package/src/components/SingleValueContainer/SingleValueContainer.stories.tsx +0 -146
- package/src/components/SingleValueContainer/SingleValueContainer.test.tsx +0 -24
- package/src/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.tsx +0 -46
- package/src/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.tsx +0 -12
- package/src/components/SingleValueContainer/index.tsx +0 -30
- package/src/components/SingleValueContainer/types/props.tsx +0 -16
- package/src/dataProviders/map.tsx +0 -24
- package/src/index.test.ts +0 -7
- package/tsconfig.json +0 -45
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import {colors, IconLegend24, Popper, Portal} from "@dhis2/ui";
|
|
2
|
-
import {ControlPosition} from "leaflet";
|
|
3
|
-
import {compact, head} from "lodash";
|
|
4
|
-
import React, {useEffect, useRef, useState} from "react";
|
|
5
|
-
import {MapLegendConfig} from "../../../MapArea/interfaces";
|
|
6
|
-
import {CustomControl} from "../../../MapControls/components/CustomControl";
|
|
7
|
-
import {
|
|
8
|
-
CustomBubbleLayer,
|
|
9
|
-
CustomGoogleEngineLayer,
|
|
10
|
-
CustomPointLayer,
|
|
11
|
-
CustomThematicLayer,
|
|
12
|
-
SUPPORTED_EARTH_ENGINE_LAYERS
|
|
13
|
-
} from "../../interfaces";
|
|
14
|
-
import PointLegend from "../PointLayer/components/PointLegend";
|
|
15
|
-
import BubbleLegend from "../ThematicLayer/components/Bubble/components/BubbleLegend";
|
|
16
|
-
import ChoroplethLegend from "../ThematicLayer/components/Choropleth/components/ChoroplethLegend";
|
|
17
|
-
import EarthEngineLegend from "../GoogleEngineLayer/components/EarthEngineLegend";
|
|
18
|
-
import classes from "./LegendArea.module.css";
|
|
19
|
-
import {usePrintMedia} from "../../../../hooks/map";
|
|
20
|
-
|
|
21
|
-
const TOOLTIP_OFFSET = 4;
|
|
22
|
-
|
|
23
|
-
function getLegendComponent(layer: CustomThematicLayer | CustomPointLayer | CustomGoogleEngineLayer) {
|
|
24
|
-
if (layer.type === "point") {
|
|
25
|
-
return <PointLegend name={layer.label} />;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (SUPPORTED_EARTH_ENGINE_LAYERS.includes(layer.type)) {
|
|
29
|
-
return <EarthEngineLegend name={layer.name ?? ""} layer={layer as CustomGoogleEngineLayer} />;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const { type, enabled, control, dataItem, name, data, legends } = (layer as CustomThematicLayer) ?? {};
|
|
33
|
-
|
|
34
|
-
if (!enabled || !control) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
switch (type) {
|
|
38
|
-
case "bubble":
|
|
39
|
-
return (
|
|
40
|
-
<BubbleLegend
|
|
41
|
-
radius={(layer as CustomBubbleLayer)?.radius ?? { min: 0, max: 50 }}
|
|
42
|
-
legends={legends ?? []}
|
|
43
|
-
name={name ?? dataItem.displayName}
|
|
44
|
-
data={data}
|
|
45
|
-
dataItem={head(data)?.dataItem ?? dataItem}
|
|
46
|
-
/>
|
|
47
|
-
);
|
|
48
|
-
case "choropleth":
|
|
49
|
-
return <ChoroplethLegend legends={legends ?? []} name={name ?? dataItem.displayName} data={data} dataItem={head(data)?.dataItem ?? dataItem} />;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function CollapsedLegendIcon({ onCollapse, name }: { name: string; onCollapse: () => void }) {
|
|
54
|
-
const openDelay = 200;
|
|
55
|
-
const closeDelay = 200;
|
|
56
|
-
const [openTooltip, setOpenTooltip] = useState(false);
|
|
57
|
-
const openTimerRef = useRef<any>(null);
|
|
58
|
-
const closeTimerRef = useRef<any>(null);
|
|
59
|
-
const ref = useRef<HTMLDivElement>(null);
|
|
60
|
-
|
|
61
|
-
const hideModifier = { name: "hide" };
|
|
62
|
-
const offsetModifier = {
|
|
63
|
-
name: "offset",
|
|
64
|
-
options: {
|
|
65
|
-
offset: [0, TOOLTIP_OFFSET],
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const flipModifier = {
|
|
70
|
-
name: "flip",
|
|
71
|
-
options: { altBoundary: true },
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const onMouseOver = () => {
|
|
75
|
-
clearTimeout(closeTimerRef.current);
|
|
76
|
-
|
|
77
|
-
openTimerRef.current = setTimeout(() => {
|
|
78
|
-
setOpenTooltip(true);
|
|
79
|
-
}, openDelay);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const onMouseOut = () => {
|
|
83
|
-
clearTimeout(openTimerRef.current);
|
|
84
|
-
|
|
85
|
-
closeTimerRef.current = setTimeout(() => {
|
|
86
|
-
setOpenTooltip(false);
|
|
87
|
-
}, closeDelay);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
useEffect(
|
|
91
|
-
() => () => {
|
|
92
|
-
clearTimeout(openTimerRef.current);
|
|
93
|
-
clearTimeout(closeTimerRef.current);
|
|
94
|
-
},
|
|
95
|
-
[]
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<div ref={ref} onMouseOver={onMouseOver} onMouseOut={onMouseOut} onClick={onCollapse} style={{ width: 28, height: 28 }} className="legend-card collapsed">
|
|
100
|
-
<IconLegend24 />
|
|
101
|
-
{openTooltip && (
|
|
102
|
-
<Portal className={classes["map-tooltip"]}>
|
|
103
|
-
<Popper className={classes["map-tooltip"]} reference={ref} modifiers={[offsetModifier, flipModifier, hideModifier]}>
|
|
104
|
-
<div
|
|
105
|
-
style={{
|
|
106
|
-
backgroundColor: `${colors.grey900}`,
|
|
107
|
-
borderRadius: 3,
|
|
108
|
-
color: `${colors.white}`,
|
|
109
|
-
padding: "4px 6px",
|
|
110
|
-
}}
|
|
111
|
-
data-test={`content`}>
|
|
112
|
-
{name}
|
|
113
|
-
</div>
|
|
114
|
-
</Popper>
|
|
115
|
-
</Portal>
|
|
116
|
-
)}
|
|
117
|
-
</div>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function Legend({ children, collapsible }: { children: React.ReactElement; collapsible: boolean }) {
|
|
122
|
-
const [collapsed, setCollapsed] = useState(collapsible);
|
|
123
|
-
const inPrintMode = usePrintMedia();
|
|
124
|
-
const onCollapse = () => {
|
|
125
|
-
if (collapsible) {
|
|
126
|
-
setCollapsed((prevState) => !prevState);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const name = head(React.Children.toArray(children) as React.ReactElement[])?.props.name;
|
|
131
|
-
|
|
132
|
-
const shouldCollapse = collapsed && !inPrintMode;
|
|
133
|
-
console.log(inPrintMode);
|
|
134
|
-
|
|
135
|
-
return (
|
|
136
|
-
<div className="w-100">
|
|
137
|
-
{shouldCollapse ? (
|
|
138
|
-
<CollapsedLegendIcon name={name} onCollapse={onCollapse} />
|
|
139
|
-
) : (
|
|
140
|
-
React.Children.map(children, (child) => React.cloneElement(child, { collapsible, onCollapse }))
|
|
141
|
-
)}
|
|
142
|
-
</div>
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export default function LegendArea({
|
|
147
|
-
layers,
|
|
148
|
-
legends: legendConfig,
|
|
149
|
-
}: {
|
|
150
|
-
layers: Array<CustomThematicLayer | CustomPointLayer | CustomGoogleEngineLayer>;
|
|
151
|
-
position: ControlPosition;
|
|
152
|
-
legends?: MapLegendConfig;
|
|
153
|
-
}) {
|
|
154
|
-
const legends: JSX.Element[] = compact(layers.filter((layer) => layer.enabled).map(getLegendComponent));
|
|
155
|
-
const { position, collapsible } = legendConfig ?? {};
|
|
156
|
-
|
|
157
|
-
return (
|
|
158
|
-
<CustomControl position={position}>
|
|
159
|
-
<div className="column gap-16 align-items-end">
|
|
160
|
-
{legends?.map((legend: any, index) => (
|
|
161
|
-
<Legend collapsible={collapsible ?? true} key={`${index}-map-legend`}>
|
|
162
|
-
{legend}
|
|
163
|
-
</Legend>
|
|
164
|
-
))}
|
|
165
|
-
</div>
|
|
166
|
-
</CustomControl>
|
|
167
|
-
);
|
|
168
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import {useConfig} from "@dhis2/app-runtime";
|
|
2
|
-
import {Divider} from "@dhis2/ui";
|
|
3
|
-
import React, {forwardRef} from "react";
|
|
4
|
-
import {getIconUrl} from "../../../../../../utils/helpers";
|
|
5
|
-
import LegendCardHeader from "../../../LegendArea/components/LegendCardHeader";
|
|
6
|
-
import {usePointLayer} from "../../hooks";
|
|
7
|
-
|
|
8
|
-
function PointLegends({ orgUnitGroups, icon, label }: { orgUnitGroups: { name: string; symbol: string }[]; icon?: string; label?: string }) {
|
|
9
|
-
const { baseUrl } = useConfig();
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<div style={{ minWidth: 100, alignItems: "flex-start" }} className="w-100 p-8 legend-list column">
|
|
13
|
-
{icon && (
|
|
14
|
-
<div key={`${icon}-legend`} className="row gap-16 align-items-center">
|
|
15
|
-
<img height={20} width={20} alt={`${name}-icon`} src={getIconUrl(icon, { baseUrl })} />
|
|
16
|
-
<p>{label}</p>
|
|
17
|
-
</div>
|
|
18
|
-
)}
|
|
19
|
-
{orgUnitGroups.map(({ name, symbol }) => {
|
|
20
|
-
return (
|
|
21
|
-
<div key={`${name}-legend`} className="row gap-16 align-items-center">
|
|
22
|
-
<img height={20} width={20} alt={`${name}-icon`} src={getIconUrl(symbol ?? "", { baseUrl })} />
|
|
23
|
-
<p>{name}</p>
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
})}
|
|
27
|
-
</div>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function PointLegend({ collapsible, onCollapse }: any, ref: React.LegacyRef<HTMLDivElement>) {
|
|
32
|
-
const pointLayer = usePointLayer();
|
|
33
|
-
const { label, style } = pointLayer ?? {};
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<div ref={ref} className="legend-card">
|
|
37
|
-
<LegendCardHeader collapsible={collapsible} onCollapse={onCollapse} title={label ?? "Points"} />
|
|
38
|
-
<Divider margin={"0"} />
|
|
39
|
-
<PointLegends label={label} orgUnitGroups={style?.orgUnitGroups ?? []} icon={style?.icon} />
|
|
40
|
-
</div>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default forwardRef(PointLegend);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import {find} from "lodash";
|
|
2
|
-
import {useMapLayers} from "../../../../MapProvider/hooks";
|
|
3
|
-
import {CustomPointLayer} from "../../../interfaces";
|
|
4
|
-
|
|
5
|
-
export function usePointLayer() {
|
|
6
|
-
const { layers } = useMapLayers();
|
|
7
|
-
return find(layers, ["type", "point"]) as CustomPointLayer;
|
|
8
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {useConfig} from "@dhis2/app-runtime";
|
|
2
|
-
import i18n from "@dhis2/d2-i18n";
|
|
3
|
-
import L from "leaflet";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import {GeoJSON, LayerGroup, LayersControl, Popup, Tooltip} from "react-leaflet";
|
|
6
|
-
import {PointOrgUnit} from "../../../../interfaces";
|
|
7
|
-
import {getIcon, getIconUrl} from "../../../../utils/helpers";
|
|
8
|
-
import {usePointLayer} from "./hooks";
|
|
9
|
-
|
|
10
|
-
export function PointLayer() {
|
|
11
|
-
const pointLayer = usePointLayer();
|
|
12
|
-
const { enabled, label, points: orgUnits, style } = pointLayer ?? {};
|
|
13
|
-
const { baseUrl } = useConfig();
|
|
14
|
-
return (
|
|
15
|
-
<LayersControl.Overlay checked={enabled} name={label ?? i18n.t("Points")}>
|
|
16
|
-
<LayerGroup>
|
|
17
|
-
{orgUnits?.map((area: PointOrgUnit) => {
|
|
18
|
-
return (
|
|
19
|
-
<GeoJSON
|
|
20
|
-
pointToLayer={(_, coordinates) => {
|
|
21
|
-
return L.marker(coordinates, { icon: getIcon(getIconUrl(area.icon.icon ?? style?.icon, { baseUrl })) });
|
|
22
|
-
}}
|
|
23
|
-
data={area.geoJSON}
|
|
24
|
-
interactive
|
|
25
|
-
key={`${area.id}-polygon`}>
|
|
26
|
-
<Tooltip>{area.name}</Tooltip>
|
|
27
|
-
<Popup minWidth={80}>
|
|
28
|
-
<h3>{area.name}</h3>
|
|
29
|
-
</Popup>
|
|
30
|
-
</GeoJSON>
|
|
31
|
-
);
|
|
32
|
-
})}
|
|
33
|
-
</LayerGroup>
|
|
34
|
-
</LayersControl.Overlay>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {guideLength, textPadding} from "./Bubbles";
|
|
3
|
-
|
|
4
|
-
export interface BubbleProps {
|
|
5
|
-
radius: number;
|
|
6
|
-
maxRadius: number;
|
|
7
|
-
text?: string;
|
|
8
|
-
textAlign?: "left" | "right";
|
|
9
|
-
color?: string;
|
|
10
|
-
stroke?: string;
|
|
11
|
-
pattern?: string;
|
|
12
|
-
gap?: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const Bubble = ({ radius, maxRadius, text, textAlign, color, stroke, pattern }: BubbleProps) => {
|
|
16
|
-
const leftAlign = textAlign === "left";
|
|
17
|
-
const x = maxRadius;
|
|
18
|
-
const y = maxRadius * 2 - radius;
|
|
19
|
-
const x2 = leftAlign ? x - maxRadius - guideLength : x + maxRadius + guideLength;
|
|
20
|
-
const y2 = maxRadius * 2 - radius * 2;
|
|
21
|
-
const textX = x2 + (leftAlign ? -textPadding : textPadding);
|
|
22
|
-
const textAnchor = leftAlign ? "end" : "start";
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<g>
|
|
26
|
-
<circle
|
|
27
|
-
cx={x}
|
|
28
|
-
cy={y}
|
|
29
|
-
r={radius}
|
|
30
|
-
stroke={stroke || "#000"}
|
|
31
|
-
style={{
|
|
32
|
-
fill: pattern ? `url(#${pattern})` : color || "none",
|
|
33
|
-
strokeWidth: 0.5,
|
|
34
|
-
}}
|
|
35
|
-
/>
|
|
36
|
-
{text && (
|
|
37
|
-
<g>
|
|
38
|
-
<line x1={x} x2={x2} y1={y2} y2={y2} stroke="black" style={{ strokeDasharray: "2, 2", strokeWidth: 0.5 }} />
|
|
39
|
-
<text x={textX} y={y2} textAnchor={textAnchor} alignmentBaseline="middle" style={{ fontSize: 12 }}>
|
|
40
|
-
{text}
|
|
41
|
-
</text>
|
|
42
|
-
</g>
|
|
43
|
-
)}
|
|
44
|
-
</g>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default Bubble;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {Divider} from "@dhis2/ui";
|
|
2
|
-
import type {Legend} from "@hisptz/dhis2-utils";
|
|
3
|
-
import React, {forwardRef} from "react";
|
|
4
|
-
import {ThematicLayerData, ThematicLayerDataItem} from "../../../../../../interfaces";
|
|
5
|
-
import LegendCardHeader from "../../../../../LegendArea/components/LegendCardHeader";
|
|
6
|
-
import Bubbles from "./components/Bubbles";
|
|
7
|
-
|
|
8
|
-
function BubbleLegend(
|
|
9
|
-
{
|
|
10
|
-
radius,
|
|
11
|
-
dataItem,
|
|
12
|
-
data,
|
|
13
|
-
name,
|
|
14
|
-
collapsible,
|
|
15
|
-
onCollapse,
|
|
16
|
-
legends,
|
|
17
|
-
}: {
|
|
18
|
-
radius: { min: number; max: number };
|
|
19
|
-
dataItem: ThematicLayerDataItem;
|
|
20
|
-
data: ThematicLayerData[];
|
|
21
|
-
name?: string;
|
|
22
|
-
collapsible?: boolean;
|
|
23
|
-
onCollapse?: () => void;
|
|
24
|
-
legends: Legend[];
|
|
25
|
-
},
|
|
26
|
-
ref: React.LegacyRef<HTMLDivElement> | undefined
|
|
27
|
-
) {
|
|
28
|
-
return (
|
|
29
|
-
<div className="legend-card" ref={ref}>
|
|
30
|
-
<LegendCardHeader title={dataItem.displayName} onCollapse={onCollapse} collapsible={collapsible} />
|
|
31
|
-
<Divider margin={"0"} />
|
|
32
|
-
<div className="legend-list pt-8">
|
|
33
|
-
<Bubbles classes={legends.reverse()} radiusHigh={radius.max} radiusLow={radius.min} color={"#FF0000"} />
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default forwardRef(BubbleLegend);
|
package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.tsx
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import {colors} from "@dhis2/ui";
|
|
2
|
-
import type {Legend} from "@hisptz/dhis2-utils";
|
|
3
|
-
import {geoJSON} from "leaflet";
|
|
4
|
-
import React, {useMemo} from "react";
|
|
5
|
-
import {CircleMarker} from "react-leaflet";
|
|
6
|
-
import {getColorFromLegendSet, highlightFeature, resetHighlight} from "../../../../../../utils/map";
|
|
7
|
-
import {ThematicLayerData} from "../../../../interfaces";
|
|
8
|
-
import CustomTooltip from "../CustomTooltip";
|
|
9
|
-
|
|
10
|
-
const defaultStyle = {
|
|
11
|
-
weight: 1,
|
|
12
|
-
};
|
|
13
|
-
const highlightStyle = {
|
|
14
|
-
weight: 2,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default function Bubble({
|
|
18
|
-
data,
|
|
19
|
-
highestData,
|
|
20
|
-
legends,
|
|
21
|
-
radius,
|
|
22
|
-
}: {
|
|
23
|
-
data: ThematicLayerData;
|
|
24
|
-
highestData: number;
|
|
25
|
-
legends: Legend[];
|
|
26
|
-
radius?: { min: number; max: number };
|
|
27
|
-
}) {
|
|
28
|
-
const { orgUnit, data: value } = data ?? {};
|
|
29
|
-
|
|
30
|
-
const geoJSONObject = orgUnit.geoJSON;
|
|
31
|
-
const center = geoJSON(geoJSONObject).getBounds().getCenter();
|
|
32
|
-
|
|
33
|
-
const circleRadius = useMemo(() => {
|
|
34
|
-
return ((value ?? 0) * (radius?.max ?? 50)) / highestData;
|
|
35
|
-
}, [radius, data, highestData]);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<>
|
|
39
|
-
<CircleMarker
|
|
40
|
-
interactive
|
|
41
|
-
eventHandlers={{
|
|
42
|
-
mouseover: (e) => highlightFeature(e, highlightStyle),
|
|
43
|
-
mouseout: (e) => resetHighlight(e, defaultStyle),
|
|
44
|
-
}}
|
|
45
|
-
pathOptions={{
|
|
46
|
-
fillColor: getColorFromLegendSet(legends, data.data),
|
|
47
|
-
fillOpacity: 1,
|
|
48
|
-
color: colors.grey900,
|
|
49
|
-
weight: 1,
|
|
50
|
-
}}
|
|
51
|
-
radius={circleRadius}
|
|
52
|
-
center={center}>
|
|
53
|
-
<CustomTooltip data={data} />
|
|
54
|
-
</CircleMarker>
|
|
55
|
-
</>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import "../../../styles/legends.css";
|
|
2
|
-
import {Divider} from "@dhis2/ui";
|
|
3
|
-
import type {Legend} from "@hisptz/dhis2-utils";
|
|
4
|
-
import React, {forwardRef} from "react";
|
|
5
|
-
import {getLegendCount} from "../../../../../../../utils/map";
|
|
6
|
-
import {ThematicLayerData, ThematicLayerDataItem} from "../../../../../interfaces";
|
|
7
|
-
import LegendCardHeader from "../../../../LegendArea/components/LegendCardHeader";
|
|
8
|
-
|
|
9
|
-
export function LegendItem({ legend, value }: { legend: { startValue: number; endValue: number; color: string }; value: number }) {
|
|
10
|
-
return (
|
|
11
|
-
<div className="legend-item">
|
|
12
|
-
<div className="legend-item-color" style={{ backgroundColor: legend.color }} />
|
|
13
|
-
<div className="legend-item-label">{`${legend.startValue} - ${legend.endValue}`}</div>
|
|
14
|
-
<div className="legend-item-value">{`(${value})`}</div>
|
|
15
|
-
</div>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function ChoroplethLegend(
|
|
20
|
-
{
|
|
21
|
-
dataItem,
|
|
22
|
-
data,
|
|
23
|
-
name,
|
|
24
|
-
collapsible,
|
|
25
|
-
onCollapse,
|
|
26
|
-
legends,
|
|
27
|
-
}: { data: ThematicLayerData[]; dataItem: ThematicLayerDataItem; name?: string; collapsible?: boolean; onCollapse?: () => void; legends: Legend[] },
|
|
28
|
-
ref: React.LegacyRef<HTMLDivElement> | undefined
|
|
29
|
-
) {
|
|
30
|
-
return (
|
|
31
|
-
<div className="legend-card" ref={ref}>
|
|
32
|
-
<LegendCardHeader title={dataItem.displayName} collapsible={collapsible} onCollapse={onCollapse} />
|
|
33
|
-
<Divider margin={"0"} />
|
|
34
|
-
<div className="legend-list pt-8">
|
|
35
|
-
{legends?.map((legend: any) => (
|
|
36
|
-
<LegendItem key={`${legend?.color}-legend-list`} legend={legend} value={getLegendCount(legend, data)} />
|
|
37
|
-
))}
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default forwardRef(ChoroplethLegend);
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {colors} from "@dhis2/ui";
|
|
2
|
-
import type {Legend} from "@hisptz/dhis2-utils";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import {GeoJSON} from "react-leaflet";
|
|
5
|
-
import {MapOrgUnit} from "../../../../../../interfaces";
|
|
6
|
-
import {getColorFromLegendSet, highlightFeature, resetHighlight} from "../../../../../../utils/map";
|
|
7
|
-
import {ThematicLayerDataItem} from "../../../../interfaces";
|
|
8
|
-
import CustomTooltip from "../CustomTooltip";
|
|
9
|
-
|
|
10
|
-
const defaultStyle = {
|
|
11
|
-
weight: 1,
|
|
12
|
-
};
|
|
13
|
-
const highlightStyle = {
|
|
14
|
-
weight: 2,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default function Choropleth({ data, legends }: { data: { orgUnit: MapOrgUnit; data?: number; dataItem: ThematicLayerDataItem }; legends: Legend[] }) {
|
|
18
|
-
const { orgUnit } = data;
|
|
19
|
-
return (
|
|
20
|
-
<>
|
|
21
|
-
<GeoJSON
|
|
22
|
-
data={orgUnit.geoJSON}
|
|
23
|
-
eventHandlers={{
|
|
24
|
-
mouseover: (e) => highlightFeature(e, highlightStyle),
|
|
25
|
-
mouseout: (e) => resetHighlight(e, defaultStyle),
|
|
26
|
-
}}
|
|
27
|
-
pathOptions={{
|
|
28
|
-
fillColor: getColorFromLegendSet(legends, data.data),
|
|
29
|
-
fillOpacity: 1,
|
|
30
|
-
color: colors.grey900,
|
|
31
|
-
weight: 1,
|
|
32
|
-
}}
|
|
33
|
-
key={`${data.dataItem.id}-layer`}>
|
|
34
|
-
<CustomTooltip data={data} />
|
|
35
|
-
</GeoJSON>
|
|
36
|
-
</>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import i18n from "@dhis2/d2-i18n";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import {Pane, Popup, Tooltip} from "react-leaflet";
|
|
4
|
-
import {useMapPeriods} from "../../../../../MapProvider/hooks";
|
|
5
|
-
import {ThematicLayerData} from "../../../../interfaces";
|
|
6
|
-
|
|
7
|
-
export default function CustomTooltip({ data: dataObject }: { data: ThematicLayerData }) {
|
|
8
|
-
const { dataItem, orgUnit, data } = dataObject ?? {};
|
|
9
|
-
const { periods } = useMapPeriods() ?? {};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<Pane name={`${dataItem.displayName}-${orgUnit.id}-popup-pane`} pane="popupPane">
|
|
13
|
-
<Tooltip>
|
|
14
|
-
{orgUnit?.name} ({data})
|
|
15
|
-
</Tooltip>
|
|
16
|
-
<Popup minWidth={80}>
|
|
17
|
-
<h3 style={{ margin: 0 }}>{orgUnit?.name}</h3>
|
|
18
|
-
<div>{dataItem?.displayName}</div>
|
|
19
|
-
<div>{periods?.map((period) => period.name).join(",")}</div>
|
|
20
|
-
<div>
|
|
21
|
-
{i18n.t("Value")}: {data}
|
|
22
|
-
</div>
|
|
23
|
-
</Popup>
|
|
24
|
-
</Pane>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {find} from "lodash";
|
|
2
|
-
import {useContext} from "react";
|
|
3
|
-
import {MapLayersContext} from "../../../../../state";
|
|
4
|
-
import {CustomThematicLayer} from "../../../interfaces";
|
|
5
|
-
|
|
6
|
-
export default function useThematicLayer(layerId: string): CustomThematicLayer | undefined {
|
|
7
|
-
const { layers } = useContext(MapLayersContext);
|
|
8
|
-
|
|
9
|
-
return find(layers as CustomThematicLayer[], ["id", layerId]);
|
|
10
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {last} from "lodash";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import {LayerGroup, LayersControl, Pane} from "react-leaflet";
|
|
4
|
-
import {CustomBubbleLayer} from "../../interfaces";
|
|
5
|
-
import Bubble from "./components/Bubble";
|
|
6
|
-
import Choropleth from "./components/Choropleth";
|
|
7
|
-
import useThematicLayer from "./hooks/config";
|
|
8
|
-
|
|
9
|
-
export default function ThematicLayer({ layerId, index }: { layerId: string; index: number }) {
|
|
10
|
-
const layer = useThematicLayer(layerId);
|
|
11
|
-
|
|
12
|
-
if (!layer) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const { type, dataItem, name, data, enabled, legends } = layer ?? {};
|
|
17
|
-
const uniqueName = name ?? dataItem.displayName;
|
|
18
|
-
return (
|
|
19
|
-
<>
|
|
20
|
-
<LayersControl.Overlay checked={enabled} name={uniqueName}>
|
|
21
|
-
<Pane
|
|
22
|
-
style={{
|
|
23
|
-
zIndex: type === "bubble" ? 500 : 500 - (index + 1),
|
|
24
|
-
}}
|
|
25
|
-
name={uniqueName}>
|
|
26
|
-
<LayerGroup>
|
|
27
|
-
{data?.map((datum) =>
|
|
28
|
-
type === "choropleth" ? <Choropleth legends={legends ?? []} data={datum} key={`${datum?.dataItem?.id}-${datum?.orgUnit?.id}-layer`} /> : null
|
|
29
|
-
)}
|
|
30
|
-
{data?.map((datum) =>
|
|
31
|
-
type === "bubble" ? (
|
|
32
|
-
<Bubble
|
|
33
|
-
radius={(layer as CustomBubbleLayer)?.radius}
|
|
34
|
-
legends={legends ?? []}
|
|
35
|
-
highestData={last(data)?.data ?? 1}
|
|
36
|
-
data={datum}
|
|
37
|
-
key={`${datum?.dataItem?.id}-${datum?.orgUnit?.id}-layer`}
|
|
38
|
-
/>
|
|
39
|
-
) : null
|
|
40
|
-
)}
|
|
41
|
-
</LayerGroup>
|
|
42
|
-
</Pane>
|
|
43
|
-
</LayersControl.Overlay>
|
|
44
|
-
</>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import BoundaryLayer from "./components/BoundaryLayer";
|
|
3
|
-
import GoogleEngineLayer from "./components/GoogleEngineLayer";
|
|
4
|
-
import {PointLayer} from "./components/PointLayer";
|
|
5
|
-
import ThematicLayer from "./components/ThematicLayer";
|
|
6
|
-
import {CustomBoundaryLayer, CustomGoogleEngineLayer, CustomPointLayer, CustomThematicLayer} from "./interfaces";
|
|
7
|
-
|
|
8
|
-
export default function MapLayer({
|
|
9
|
-
layer,
|
|
10
|
-
index,
|
|
11
|
-
}: {
|
|
12
|
-
layer: CustomThematicLayer | CustomBoundaryLayer | CustomPointLayer | CustomGoogleEngineLayer;
|
|
13
|
-
index: number;
|
|
14
|
-
}) {
|
|
15
|
-
switch (layer.type) {
|
|
16
|
-
case "overlay":
|
|
17
|
-
case "basemap":
|
|
18
|
-
return <BoundaryLayer {...layer} />;
|
|
19
|
-
case "bubble":
|
|
20
|
-
case "choropleth":
|
|
21
|
-
return <ThematicLayer layerId={layer.id} index={index} />;
|
|
22
|
-
case "point":
|
|
23
|
-
return <PointLayer />;
|
|
24
|
-
case "population":
|
|
25
|
-
case "elevation":
|
|
26
|
-
case "footprints":
|
|
27
|
-
case "landCover":
|
|
28
|
-
return <GoogleEngineLayer layerId={layer.id} />;
|
|
29
|
-
default:
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
}
|