@hisptz/dhis2-analytics 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +10 -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/index.test.js +7 -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 +10 -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/{src/index.ts → build/es/index.js} +1 -0
- package/build/es/index.test.js +6 -0
- package/build/es/locales/en/translations.json +128 -0
- package/build/es/locales/index.js +13 -0
- package/package.json +21 -4
- 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/components/DownloadMenu/interfaces/menu.ts +0 -1
- 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 -423
- 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
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = LegendArea;
|
|
7
|
+
var _ui = require("@dhis2/ui");
|
|
8
|
+
var _lodash = require("lodash");
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _CustomControl = require("../../../MapControls/components/CustomControl");
|
|
11
|
+
var _interfaces = require("../../interfaces");
|
|
12
|
+
var _PointLegend = _interopRequireDefault(require("../PointLayer/components/PointLegend"));
|
|
13
|
+
var _BubbleLegend = _interopRequireDefault(require("../ThematicLayer/components/Bubble/components/BubbleLegend"));
|
|
14
|
+
var _ChoroplethLegend = _interopRequireDefault(require("../ThematicLayer/components/Choropleth/components/ChoroplethLegend"));
|
|
15
|
+
var _EarthEngineLegend = _interopRequireDefault(require("../GoogleEngineLayer/components/EarthEngineLegend"));
|
|
16
|
+
var _LegendAreaModule = _interopRequireDefault(require("./LegendArea.module.css"));
|
|
17
|
+
var _map = require("../../../../hooks/map");
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
const TOOLTIP_OFFSET = 4;
|
|
22
|
+
function getLegendComponent(layer) {
|
|
23
|
+
var _ref, _radius, _head$dataItem, _head, _head$dataItem2, _head2;
|
|
24
|
+
if (layer.type === "point") {
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_PointLegend.default, {
|
|
26
|
+
name: layer.label
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (_interfaces.SUPPORTED_EARTH_ENGINE_LAYERS.includes(layer.type)) {
|
|
30
|
+
var _layer$name;
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_EarthEngineLegend.default, {
|
|
32
|
+
name: (_layer$name = layer.name) !== null && _layer$name !== void 0 ? _layer$name : "",
|
|
33
|
+
layer: layer
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const {
|
|
37
|
+
type,
|
|
38
|
+
enabled,
|
|
39
|
+
control,
|
|
40
|
+
dataItem,
|
|
41
|
+
name,
|
|
42
|
+
data,
|
|
43
|
+
legends
|
|
44
|
+
} = (_ref = layer) !== null && _ref !== void 0 ? _ref : {};
|
|
45
|
+
if (!enabled || !control) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
switch (type) {
|
|
49
|
+
case "bubble":
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement(_BubbleLegend.default, {
|
|
51
|
+
radius: (_radius = layer === null || layer === void 0 ? void 0 : layer.radius) !== null && _radius !== void 0 ? _radius : {
|
|
52
|
+
min: 0,
|
|
53
|
+
max: 50
|
|
54
|
+
},
|
|
55
|
+
legends: legends !== null && legends !== void 0 ? legends : [],
|
|
56
|
+
name: name !== null && name !== void 0 ? name : dataItem.displayName,
|
|
57
|
+
data: data,
|
|
58
|
+
dataItem: (_head$dataItem = (_head = (0, _lodash.head)(data)) === null || _head === void 0 ? void 0 : _head.dataItem) !== null && _head$dataItem !== void 0 ? _head$dataItem : dataItem
|
|
59
|
+
});
|
|
60
|
+
case "choropleth":
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement(_ChoroplethLegend.default, {
|
|
62
|
+
legends: legends !== null && legends !== void 0 ? legends : [],
|
|
63
|
+
name: name !== null && name !== void 0 ? name : dataItem.displayName,
|
|
64
|
+
data: data,
|
|
65
|
+
dataItem: (_head$dataItem2 = (_head2 = (0, _lodash.head)(data)) === null || _head2 === void 0 ? void 0 : _head2.dataItem) !== null && _head$dataItem2 !== void 0 ? _head$dataItem2 : dataItem
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function CollapsedLegendIcon(_ref2) {
|
|
70
|
+
let {
|
|
71
|
+
onCollapse,
|
|
72
|
+
name
|
|
73
|
+
} = _ref2;
|
|
74
|
+
const openDelay = 200;
|
|
75
|
+
const closeDelay = 200;
|
|
76
|
+
const [openTooltip, setOpenTooltip] = (0, _react.useState)(false);
|
|
77
|
+
const openTimerRef = (0, _react.useRef)(null);
|
|
78
|
+
const closeTimerRef = (0, _react.useRef)(null);
|
|
79
|
+
const ref = (0, _react.useRef)(null);
|
|
80
|
+
const hideModifier = {
|
|
81
|
+
name: "hide"
|
|
82
|
+
};
|
|
83
|
+
const offsetModifier = {
|
|
84
|
+
name: "offset",
|
|
85
|
+
options: {
|
|
86
|
+
offset: [0, TOOLTIP_OFFSET]
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const flipModifier = {
|
|
90
|
+
name: "flip",
|
|
91
|
+
options: {
|
|
92
|
+
altBoundary: true
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const onMouseOver = () => {
|
|
96
|
+
clearTimeout(closeTimerRef.current);
|
|
97
|
+
openTimerRef.current = setTimeout(() => {
|
|
98
|
+
setOpenTooltip(true);
|
|
99
|
+
}, openDelay);
|
|
100
|
+
};
|
|
101
|
+
const onMouseOut = () => {
|
|
102
|
+
clearTimeout(openTimerRef.current);
|
|
103
|
+
closeTimerRef.current = setTimeout(() => {
|
|
104
|
+
setOpenTooltip(false);
|
|
105
|
+
}, closeDelay);
|
|
106
|
+
};
|
|
107
|
+
(0, _react.useEffect)(() => () => {
|
|
108
|
+
clearTimeout(openTimerRef.current);
|
|
109
|
+
clearTimeout(closeTimerRef.current);
|
|
110
|
+
}, []);
|
|
111
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
+
ref: ref,
|
|
113
|
+
onMouseOver: onMouseOver,
|
|
114
|
+
onMouseOut: onMouseOut,
|
|
115
|
+
onClick: onCollapse,
|
|
116
|
+
style: {
|
|
117
|
+
width: 28,
|
|
118
|
+
height: 28
|
|
119
|
+
},
|
|
120
|
+
className: "legend-card collapsed"
|
|
121
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.IconLegend24, null), openTooltip && /*#__PURE__*/_react.default.createElement(_ui.Portal, {
|
|
122
|
+
className: _LegendAreaModule.default["map-tooltip"]
|
|
123
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.Popper, {
|
|
124
|
+
className: _LegendAreaModule.default["map-tooltip"],
|
|
125
|
+
reference: ref,
|
|
126
|
+
modifiers: [offsetModifier, flipModifier, hideModifier]
|
|
127
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
128
|
+
style: {
|
|
129
|
+
backgroundColor: `${_ui.colors.grey900}`,
|
|
130
|
+
borderRadius: 3,
|
|
131
|
+
color: `${_ui.colors.white}`,
|
|
132
|
+
padding: "4px 6px"
|
|
133
|
+
},
|
|
134
|
+
"data-test": `content`
|
|
135
|
+
}, name))));
|
|
136
|
+
}
|
|
137
|
+
function Legend(_ref3) {
|
|
138
|
+
var _head3;
|
|
139
|
+
let {
|
|
140
|
+
children,
|
|
141
|
+
collapsible
|
|
142
|
+
} = _ref3;
|
|
143
|
+
const [collapsed, setCollapsed] = (0, _react.useState)(collapsible);
|
|
144
|
+
const inPrintMode = (0, _map.usePrintMedia)();
|
|
145
|
+
const onCollapse = () => {
|
|
146
|
+
if (collapsible) {
|
|
147
|
+
setCollapsed(prevState => !prevState);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const name = (_head3 = (0, _lodash.head)(_react.default.Children.toArray(children))) === null || _head3 === void 0 ? void 0 : _head3.props.name;
|
|
151
|
+
const shouldCollapse = collapsed && !inPrintMode;
|
|
152
|
+
console.log(inPrintMode);
|
|
153
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
154
|
+
className: "w-100"
|
|
155
|
+
}, shouldCollapse ? /*#__PURE__*/_react.default.createElement(CollapsedLegendIcon, {
|
|
156
|
+
name: name,
|
|
157
|
+
onCollapse: onCollapse
|
|
158
|
+
}) : _react.default.Children.map(children, child => /*#__PURE__*/_react.default.cloneElement(child, {
|
|
159
|
+
collapsible,
|
|
160
|
+
onCollapse
|
|
161
|
+
})));
|
|
162
|
+
}
|
|
163
|
+
function LegendArea(_ref4) {
|
|
164
|
+
let {
|
|
165
|
+
layers,
|
|
166
|
+
legends: legendConfig
|
|
167
|
+
} = _ref4;
|
|
168
|
+
const legends = (0, _lodash.compact)(layers.filter(layer => layer.enabled).map(getLegendComponent));
|
|
169
|
+
const {
|
|
170
|
+
position,
|
|
171
|
+
collapsible
|
|
172
|
+
} = legendConfig !== null && legendConfig !== void 0 ? legendConfig : {};
|
|
173
|
+
return /*#__PURE__*/_react.default.createElement(_CustomControl.CustomControl, {
|
|
174
|
+
position: position
|
|
175
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
176
|
+
className: "column gap-16 align-items-end"
|
|
177
|
+
}, legends === null || legends === void 0 ? void 0 : legends.map((legend, index) => /*#__PURE__*/_react.default.createElement(Legend, {
|
|
178
|
+
collapsible: collapsible !== null && collapsible !== void 0 ? collapsible : true,
|
|
179
|
+
key: `${index}-map-legend`
|
|
180
|
+
}, legend))));
|
|
181
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
8
|
+
var _ui = require("@dhis2/ui");
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _helpers = require("../../../../../../utils/helpers");
|
|
11
|
+
var _LegendCardHeader = _interopRequireDefault(require("../../../LegendArea/components/LegendCardHeader"));
|
|
12
|
+
var _hooks = require("../../hooks");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
function PointLegends(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
orgUnitGroups,
|
|
19
|
+
icon,
|
|
20
|
+
label
|
|
21
|
+
} = _ref;
|
|
22
|
+
const {
|
|
23
|
+
baseUrl
|
|
24
|
+
} = (0, _appRuntime.useConfig)();
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
26
|
+
style: {
|
|
27
|
+
minWidth: 100,
|
|
28
|
+
alignItems: "flex-start"
|
|
29
|
+
},
|
|
30
|
+
className: "w-100 p-8 legend-list column"
|
|
31
|
+
}, icon && /*#__PURE__*/_react.default.createElement("div", {
|
|
32
|
+
key: `${icon}-legend`,
|
|
33
|
+
className: "row gap-16 align-items-center"
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
35
|
+
height: 20,
|
|
36
|
+
width: 20,
|
|
37
|
+
alt: `${name}-icon`,
|
|
38
|
+
src: (0, _helpers.getIconUrl)(icon, {
|
|
39
|
+
baseUrl
|
|
40
|
+
})
|
|
41
|
+
}), /*#__PURE__*/_react.default.createElement("p", null, label)), orgUnitGroups.map(_ref2 => {
|
|
42
|
+
let {
|
|
43
|
+
name,
|
|
44
|
+
symbol
|
|
45
|
+
} = _ref2;
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
47
|
+
key: `${name}-legend`,
|
|
48
|
+
className: "row gap-16 align-items-center"
|
|
49
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
50
|
+
height: 20,
|
|
51
|
+
width: 20,
|
|
52
|
+
alt: `${name}-icon`,
|
|
53
|
+
src: (0, _helpers.getIconUrl)(symbol !== null && symbol !== void 0 ? symbol : "", {
|
|
54
|
+
baseUrl
|
|
55
|
+
})
|
|
56
|
+
}), /*#__PURE__*/_react.default.createElement("p", null, name));
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
function PointLegend(_ref3, ref) {
|
|
60
|
+
var _style$orgUnitGroups;
|
|
61
|
+
let {
|
|
62
|
+
collapsible,
|
|
63
|
+
onCollapse
|
|
64
|
+
} = _ref3;
|
|
65
|
+
const pointLayer = (0, _hooks.usePointLayer)();
|
|
66
|
+
const {
|
|
67
|
+
label,
|
|
68
|
+
style
|
|
69
|
+
} = pointLayer !== null && pointLayer !== void 0 ? pointLayer : {};
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
71
|
+
ref: ref,
|
|
72
|
+
className: "legend-card"
|
|
73
|
+
}, /*#__PURE__*/_react.default.createElement(_LegendCardHeader.default, {
|
|
74
|
+
collapsible: collapsible,
|
|
75
|
+
onCollapse: onCollapse,
|
|
76
|
+
title: label !== null && label !== void 0 ? label : "Points"
|
|
77
|
+
}), /*#__PURE__*/_react.default.createElement(_ui.Divider, {
|
|
78
|
+
margin: "0"
|
|
79
|
+
}), /*#__PURE__*/_react.default.createElement(PointLegends, {
|
|
80
|
+
label: label,
|
|
81
|
+
orgUnitGroups: (_style$orgUnitGroups = style === null || style === void 0 ? void 0 : style.orgUnitGroups) !== null && _style$orgUnitGroups !== void 0 ? _style$orgUnitGroups : [],
|
|
82
|
+
icon: style === null || style === void 0 ? void 0 : style.icon
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
var _default = /*#__PURE__*/(0, _react.forwardRef)(PointLegend);
|
|
86
|
+
exports.default = _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.usePointLayer = usePointLayer;
|
|
7
|
+
var _lodash = require("lodash");
|
|
8
|
+
var _hooks = require("../../../../MapProvider/hooks");
|
|
9
|
+
function usePointLayer() {
|
|
10
|
+
const {
|
|
11
|
+
layers
|
|
12
|
+
} = (0, _hooks.useMapLayers)();
|
|
13
|
+
return (0, _lodash.find)(layers, ["type", "point"]);
|
|
14
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PointLayer = PointLayer;
|
|
7
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
8
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
9
|
+
var _leaflet = _interopRequireDefault(require("leaflet"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _reactLeaflet = require("react-leaflet");
|
|
12
|
+
var _helpers = require("../../../../utils/helpers");
|
|
13
|
+
var _hooks = require("./hooks");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
function PointLayer() {
|
|
16
|
+
const pointLayer = (0, _hooks.usePointLayer)();
|
|
17
|
+
const {
|
|
18
|
+
enabled,
|
|
19
|
+
label,
|
|
20
|
+
points: orgUnits,
|
|
21
|
+
style
|
|
22
|
+
} = pointLayer !== null && pointLayer !== void 0 ? pointLayer : {};
|
|
23
|
+
const {
|
|
24
|
+
baseUrl
|
|
25
|
+
} = (0, _appRuntime.useConfig)();
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_reactLeaflet.LayersControl.Overlay, {
|
|
27
|
+
checked: enabled,
|
|
28
|
+
name: label !== null && label !== void 0 ? label : _d2I18n.default.t("Points")
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement(_reactLeaflet.LayerGroup, null, orgUnits === null || orgUnits === void 0 ? void 0 : orgUnits.map(area => {
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_reactLeaflet.GeoJSON, {
|
|
31
|
+
pointToLayer: (_, coordinates) => {
|
|
32
|
+
var _area$icon$icon;
|
|
33
|
+
return _leaflet.default.marker(coordinates, {
|
|
34
|
+
icon: (0, _helpers.getIcon)((0, _helpers.getIconUrl)((_area$icon$icon = area.icon.icon) !== null && _area$icon$icon !== void 0 ? _area$icon$icon : style === null || style === void 0 ? void 0 : style.icon, {
|
|
35
|
+
baseUrl
|
|
36
|
+
}))
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
data: area.geoJSON,
|
|
40
|
+
interactive: true,
|
|
41
|
+
key: `${area.id}-polygon`
|
|
42
|
+
}, /*#__PURE__*/_react.default.createElement(_reactLeaflet.Tooltip, null, area.name), /*#__PURE__*/_react.default.createElement(_reactLeaflet.Popup, {
|
|
43
|
+
minWidth: 80
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement("h3", null, area.name)));
|
|
45
|
+
})));
|
|
46
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _Bubbles = require("./Bubbles");
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const Bubble = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
radius,
|
|
13
|
+
maxRadius,
|
|
14
|
+
text,
|
|
15
|
+
textAlign,
|
|
16
|
+
color,
|
|
17
|
+
stroke,
|
|
18
|
+
pattern
|
|
19
|
+
} = _ref;
|
|
20
|
+
const leftAlign = textAlign === "left";
|
|
21
|
+
const x = maxRadius;
|
|
22
|
+
const y = maxRadius * 2 - radius;
|
|
23
|
+
const x2 = leftAlign ? x - maxRadius - _Bubbles.guideLength : x + maxRadius + _Bubbles.guideLength;
|
|
24
|
+
const y2 = maxRadius * 2 - radius * 2;
|
|
25
|
+
const textX = x2 + (leftAlign ? -_Bubbles.textPadding : _Bubbles.textPadding);
|
|
26
|
+
const textAnchor = leftAlign ? "end" : "start";
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement("g", null, /*#__PURE__*/_react.default.createElement("circle", {
|
|
28
|
+
cx: x,
|
|
29
|
+
cy: y,
|
|
30
|
+
r: radius,
|
|
31
|
+
stroke: stroke || "#000",
|
|
32
|
+
style: {
|
|
33
|
+
fill: pattern ? `url(#${pattern})` : color || "none",
|
|
34
|
+
strokeWidth: 0.5
|
|
35
|
+
}
|
|
36
|
+
}), text && /*#__PURE__*/_react.default.createElement("g", null, /*#__PURE__*/_react.default.createElement("line", {
|
|
37
|
+
x1: x,
|
|
38
|
+
x2: x2,
|
|
39
|
+
y1: y2,
|
|
40
|
+
y2: y2,
|
|
41
|
+
stroke: "black",
|
|
42
|
+
style: {
|
|
43
|
+
strokeDasharray: "2, 2",
|
|
44
|
+
strokeWidth: 0.5
|
|
45
|
+
}
|
|
46
|
+
}), /*#__PURE__*/_react.default.createElement("text", {
|
|
47
|
+
x: textX,
|
|
48
|
+
y: y2,
|
|
49
|
+
textAnchor: textAnchor,
|
|
50
|
+
alignmentBaseline: "middle",
|
|
51
|
+
style: {
|
|
52
|
+
fontSize: 12
|
|
53
|
+
}
|
|
54
|
+
}, text)));
|
|
55
|
+
};
|
|
56
|
+
var _default = Bubble;
|
|
57
|
+
exports.default = _default;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.textPadding = exports.guideLength = exports.default = void 0;
|
|
7
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
8
|
+
var _d3Scale = require("d3-scale");
|
|
9
|
+
var _lodash = require("lodash");
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _colors = require("../../../../../../../../../utils/colors");
|
|
12
|
+
var _helpers = require("../../../../../../../../../utils/helpers");
|
|
13
|
+
var _Bubble = _interopRequireDefault(require("./Bubble"));
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
18
|
+
const style = {
|
|
19
|
+
paddingTop: 10,
|
|
20
|
+
display: "flex",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
justifyContent: "center"
|
|
23
|
+
};
|
|
24
|
+
const legendWidth = 200;
|
|
25
|
+
const digitWidth = 6.8;
|
|
26
|
+
const guideLength = 16;
|
|
27
|
+
exports.guideLength = guideLength;
|
|
28
|
+
const textPadding = 4;
|
|
29
|
+
exports.textPadding = textPadding;
|
|
30
|
+
const Bubbles = _ref => {
|
|
31
|
+
let {
|
|
32
|
+
radiusLow,
|
|
33
|
+
radiusHigh,
|
|
34
|
+
color,
|
|
35
|
+
classes
|
|
36
|
+
} = _ref;
|
|
37
|
+
const height = radiusHigh * 2 + 4;
|
|
38
|
+
const scale = (0, _d3Scale.scaleSqrt)().range([radiusLow, radiusHigh]);
|
|
39
|
+
const radiusMid = scale(0.5);
|
|
40
|
+
if (isNaN(radiusLow) || isNaN(radiusHigh)) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
let bubbles = [];
|
|
44
|
+
|
|
45
|
+
// If color legend
|
|
46
|
+
if (Array.isArray(classes) && classes.length) {
|
|
47
|
+
const startValue = classes[0].startValue;
|
|
48
|
+
const endValue = classes[classes.length - 1].endValue;
|
|
49
|
+
const itemScale = scale.domain([startValue, endValue]);
|
|
50
|
+
bubbles = [...classes].reverse().map(c => ({
|
|
51
|
+
radius: itemScale(c.endValue),
|
|
52
|
+
maxRadius: radiusHigh,
|
|
53
|
+
color: c.color,
|
|
54
|
+
text: String(c.endValue)
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
// Add the smallest bubble for the lowest value
|
|
58
|
+
bubbles.push({
|
|
59
|
+
radius: itemScale(startValue),
|
|
60
|
+
maxRadius: radiusHigh,
|
|
61
|
+
text: String(startValue)
|
|
62
|
+
});
|
|
63
|
+
} else {
|
|
64
|
+
// If single color
|
|
65
|
+
const stroke = color && (0, _colors.getContrastColor)(color);
|
|
66
|
+
bubbles = [{
|
|
67
|
+
radius: radiusHigh,
|
|
68
|
+
maxRadius: radiusHigh,
|
|
69
|
+
color,
|
|
70
|
+
stroke,
|
|
71
|
+
text: _d2I18n.default.t("Max")
|
|
72
|
+
}, {
|
|
73
|
+
radius: radiusMid,
|
|
74
|
+
maxRadius: radiusHigh,
|
|
75
|
+
color,
|
|
76
|
+
stroke,
|
|
77
|
+
text: _d2I18n.default.t("Mid")
|
|
78
|
+
}, {
|
|
79
|
+
radius: radiusLow,
|
|
80
|
+
maxRadius: radiusHigh,
|
|
81
|
+
color,
|
|
82
|
+
stroke,
|
|
83
|
+
text: _d2I18n.default.t("Min")
|
|
84
|
+
}];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Calculate the pixel length of the longest number
|
|
88
|
+
let textLength = Math.ceil(Math.max((0, _helpers.getLongestTextLength)(classes, "startValue"), (0, _helpers.getLongestTextLength)(classes, "endValue")) * digitWidth);
|
|
89
|
+
|
|
90
|
+
// Calculate the total length if numbers are alternate on each side
|
|
91
|
+
const alternateLength = (radiusHigh + guideLength + textPadding + textLength) * 2;
|
|
92
|
+
let smallestGap = (0, _lodash.reduce)(bubbles, (prev, curr, i) => {
|
|
93
|
+
const gap = prev.radius - curr.radius;
|
|
94
|
+
const smallestGap = prev.gap === undefined || gap < prev.gap ? gap : prev.gap;
|
|
95
|
+
return i === bubbles.length - 1 ? Math.round(smallestGap * 2) : {
|
|
96
|
+
radius: curr.radius,
|
|
97
|
+
gap: smallestGap
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
const alternateFit = alternateLength < legendWidth;
|
|
101
|
+
const alternate = alternateFit && smallestGap > 5 && smallestGap < 12;
|
|
102
|
+
if (!alternateFit) {
|
|
103
|
+
smallestGap = smallestGap / 2;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Too cramped to show number for each bubble
|
|
107
|
+
if (smallestGap < 4) {
|
|
108
|
+
const [maxBubble] = bubbles;
|
|
109
|
+
const minBubble = bubbles[bubbles.length - 1];
|
|
110
|
+
const gap = maxBubble.radius - minBubble.radius;
|
|
111
|
+
const showNumbers = [0]; // Always show the largest number
|
|
112
|
+
|
|
113
|
+
if (gap > 4) {
|
|
114
|
+
showNumbers.push(bubbles.length - 1);
|
|
115
|
+
}
|
|
116
|
+
if (gap > 15) {
|
|
117
|
+
const midRadius = minBubble.radius + gap / 2;
|
|
118
|
+
|
|
119
|
+
// Find the closest bubble above the mid-radius
|
|
120
|
+
const midBubble = bubbles.reduce((prev, curr) => curr.radius >= midRadius && curr.radius - midRadius < prev.radius - midRadius ? curr : prev);
|
|
121
|
+
showNumbers.push(bubbles.indexOf(midBubble));
|
|
122
|
+
}
|
|
123
|
+
bubbles.forEach((b, i) => {
|
|
124
|
+
if (!showNumbers.includes(i)) {
|
|
125
|
+
delete b.text;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
textLength = Math.ceil((0, _helpers.getLongestTextLength)(bubbles, "text") * digitWidth);
|
|
130
|
+
const offset = textLength + guideLength + textPadding;
|
|
131
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
132
|
+
style: style
|
|
133
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
134
|
+
width: legendWidth,
|
|
135
|
+
height: height + 50
|
|
136
|
+
}, /*#__PURE__*/_react.default.createElement("g", {
|
|
137
|
+
transform: `translate(${alternate ? offset : "16"} 24)`
|
|
138
|
+
}, bubbles.map((bubble, i) => /*#__PURE__*/_react.default.createElement(_Bubble.default, _extends({
|
|
139
|
+
key: i
|
|
140
|
+
}, bubble, {
|
|
141
|
+
textAlign: alternate && i % 2 == 0 ? "left" : "right"
|
|
142
|
+
}))))));
|
|
143
|
+
};
|
|
144
|
+
var _default = /*#__PURE__*/(0, _react.memo)(Bubbles);
|
|
145
|
+
exports.default = _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _ui = require("@dhis2/ui");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _LegendCardHeader = _interopRequireDefault(require("../../../../../LegendArea/components/LegendCardHeader"));
|
|
10
|
+
var _Bubbles = _interopRequireDefault(require("./components/Bubbles"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
function BubbleLegend(_ref, ref) {
|
|
15
|
+
let {
|
|
16
|
+
radius,
|
|
17
|
+
dataItem,
|
|
18
|
+
data,
|
|
19
|
+
name,
|
|
20
|
+
collapsible,
|
|
21
|
+
onCollapse,
|
|
22
|
+
legends
|
|
23
|
+
} = _ref;
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
25
|
+
className: "legend-card",
|
|
26
|
+
ref: ref
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement(_LegendCardHeader.default, {
|
|
28
|
+
title: dataItem.displayName,
|
|
29
|
+
onCollapse: onCollapse,
|
|
30
|
+
collapsible: collapsible
|
|
31
|
+
}), /*#__PURE__*/_react.default.createElement(_ui.Divider, {
|
|
32
|
+
margin: "0"
|
|
33
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
34
|
+
className: "legend-list pt-8"
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement(_Bubbles.default, {
|
|
36
|
+
classes: legends.reverse(),
|
|
37
|
+
radiusHigh: radius.max,
|
|
38
|
+
radiusLow: radius.min,
|
|
39
|
+
color: "#FF0000"
|
|
40
|
+
})));
|
|
41
|
+
}
|
|
42
|
+
var _default = /*#__PURE__*/(0, _react.forwardRef)(BubbleLegend);
|
|
43
|
+
exports.default = _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Bubble;
|
|
7
|
+
var _ui = require("@dhis2/ui");
|
|
8
|
+
var _leaflet = require("leaflet");
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactLeaflet = require("react-leaflet");
|
|
11
|
+
var _map = require("../../../../../../utils/map");
|
|
12
|
+
var _CustomTooltip = _interopRequireDefault(require("../CustomTooltip"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
const defaultStyle = {
|
|
17
|
+
weight: 1
|
|
18
|
+
};
|
|
19
|
+
const highlightStyle = {
|
|
20
|
+
weight: 2
|
|
21
|
+
};
|
|
22
|
+
function Bubble(_ref) {
|
|
23
|
+
let {
|
|
24
|
+
data,
|
|
25
|
+
highestData,
|
|
26
|
+
legends,
|
|
27
|
+
radius
|
|
28
|
+
} = _ref;
|
|
29
|
+
const {
|
|
30
|
+
orgUnit,
|
|
31
|
+
data: value
|
|
32
|
+
} = data !== null && data !== void 0 ? data : {};
|
|
33
|
+
const geoJSONObject = orgUnit.geoJSON;
|
|
34
|
+
const center = (0, _leaflet.geoJSON)(geoJSONObject).getBounds().getCenter();
|
|
35
|
+
const circleRadius = (0, _react.useMemo)(() => {
|
|
36
|
+
var _radius$max;
|
|
37
|
+
return (value !== null && value !== void 0 ? value : 0) * ((_radius$max = radius === null || radius === void 0 ? void 0 : radius.max) !== null && _radius$max !== void 0 ? _radius$max : 50) / highestData;
|
|
38
|
+
}, [radius, data, highestData]);
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactLeaflet.CircleMarker, {
|
|
40
|
+
interactive: true,
|
|
41
|
+
eventHandlers: {
|
|
42
|
+
mouseover: e => (0, _map.highlightFeature)(e, highlightStyle),
|
|
43
|
+
mouseout: e => (0, _map.resetHighlight)(e, defaultStyle)
|
|
44
|
+
},
|
|
45
|
+
pathOptions: {
|
|
46
|
+
fillColor: (0, _map.getColorFromLegendSet)(legends, data.data),
|
|
47
|
+
fillOpacity: 1,
|
|
48
|
+
color: _ui.colors.grey900,
|
|
49
|
+
weight: 1
|
|
50
|
+
},
|
|
51
|
+
radius: circleRadius,
|
|
52
|
+
center: center
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(_CustomTooltip.default, {
|
|
54
|
+
data: data
|
|
55
|
+
})));
|
|
56
|
+
}
|