@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,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useBoundaryData = useBoundaryData;
|
|
7
|
+
var _hooks = require("../../../../MapProvider/hooks");
|
|
8
|
+
function useBoundaryData() {
|
|
9
|
+
const {
|
|
10
|
+
orgUnits
|
|
11
|
+
} = (0, _hooks.useMapOrganisationUnit)();
|
|
12
|
+
return orgUnits;
|
|
13
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = BoundaryLayer;
|
|
7
|
+
exports.highlightStyle = exports.defaultStyle = void 0;
|
|
8
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
9
|
+
var _ui = require("@dhis2/ui");
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _reactLeaflet = require("react-leaflet");
|
|
12
|
+
var _map = require("../../../../utils/map");
|
|
13
|
+
var _useBoundaryData = require("./hooks/useBoundaryData");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
const defaultStyle = {
|
|
16
|
+
weight: 1,
|
|
17
|
+
color: _ui.colors.grey900,
|
|
18
|
+
fillColor: _ui.colors.grey900,
|
|
19
|
+
fillOpacity: 0.0
|
|
20
|
+
};
|
|
21
|
+
exports.defaultStyle = defaultStyle;
|
|
22
|
+
const highlightStyle = {
|
|
23
|
+
weight: 2,
|
|
24
|
+
color: _ui.colors.grey900,
|
|
25
|
+
dashArray: "",
|
|
26
|
+
fillOpacity: 0.1
|
|
27
|
+
};
|
|
28
|
+
exports.highlightStyle = highlightStyle;
|
|
29
|
+
function BoundaryLayer(props) {
|
|
30
|
+
const {
|
|
31
|
+
enabled
|
|
32
|
+
} = props !== null && props !== void 0 ? props : {};
|
|
33
|
+
const orgUnits = (0, _useBoundaryData.useBoundaryData)();
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_reactLeaflet.LayersControl.Overlay, {
|
|
35
|
+
checked: enabled,
|
|
36
|
+
name: _d2I18n.default.t("Boundaries")
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement(_reactLeaflet.LayerGroup, null, orgUnits === null || orgUnits === void 0 ? void 0 : orgUnits.map(area => {
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_reactLeaflet.GeoJSON, {
|
|
39
|
+
data: area.geoJSON,
|
|
40
|
+
interactive: true,
|
|
41
|
+
eventHandlers: {
|
|
42
|
+
mouseover: e => (0, _map.highlightFeature)(e, highlightStyle),
|
|
43
|
+
mouseout: e => (0, _map.resetHighlight)(e, defaultStyle)
|
|
44
|
+
},
|
|
45
|
+
key: `${area.id}-polygon`,
|
|
46
|
+
pathOptions: defaultStyle
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement(_reactLeaflet.Tooltip, null, area.name), /*#__PURE__*/_react.default.createElement(_reactLeaflet.Popup, {
|
|
48
|
+
minWidth: 80
|
|
49
|
+
}, /*#__PURE__*/_react.default.createElement("h3", null, area.name), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("b", null, "Level: "), area.level)));
|
|
50
|
+
})));
|
|
51
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LegendItem = LegendItem;
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _LegendCardHeader = _interopRequireDefault(require("../../LegendArea/components/LegendCardHeader"));
|
|
10
|
+
var _ui = require("@dhis2/ui");
|
|
11
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
12
|
+
var _lodash = require("lodash");
|
|
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 LegendItem(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
legend
|
|
19
|
+
} = _ref;
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
21
|
+
className: "legend-item"
|
|
22
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
23
|
+
className: "legend-item-color",
|
|
24
|
+
style: {
|
|
25
|
+
backgroundColor: legend.color
|
|
26
|
+
}
|
|
27
|
+
}), legend.name ? /*#__PURE__*/_react.default.createElement("div", {
|
|
28
|
+
className: "legend-item-label"
|
|
29
|
+
}, `${legend.name}`) : /*#__PURE__*/_react.default.createElement("div", {
|
|
30
|
+
className: "legend-item-label"
|
|
31
|
+
}, `${legend.min} - ${legend.max}`));
|
|
32
|
+
}
|
|
33
|
+
function getLegendsFromParams(params) {
|
|
34
|
+
if (!params) return [];
|
|
35
|
+
const {
|
|
36
|
+
palette,
|
|
37
|
+
min,
|
|
38
|
+
max
|
|
39
|
+
} = params;
|
|
40
|
+
console.log(params);
|
|
41
|
+
const sanitizedPalette = Array.isArray(palette) ? palette : palette.split(",");
|
|
42
|
+
const classes = sanitizedPalette.length;
|
|
43
|
+
const difference = max - min;
|
|
44
|
+
const interval = Math.round(difference / classes);
|
|
45
|
+
const legends = [];
|
|
46
|
+
console.log(10 / 9);
|
|
47
|
+
for (let i = 0; i < classes; i++) {
|
|
48
|
+
const min = i * interval;
|
|
49
|
+
const max = min + interval;
|
|
50
|
+
const name = i === classes - 1 ? `> ${min}` : undefined;
|
|
51
|
+
legends.push({
|
|
52
|
+
id: sanitizedPalette[i],
|
|
53
|
+
color: sanitizedPalette[i],
|
|
54
|
+
min,
|
|
55
|
+
max,
|
|
56
|
+
name
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return legends;
|
|
60
|
+
}
|
|
61
|
+
function EarthEngineLegend(_ref2, ref) {
|
|
62
|
+
var _options$legend$items, _options$legend, _options$description, _options$unit, _options$source;
|
|
63
|
+
let {
|
|
64
|
+
layer,
|
|
65
|
+
collapsible,
|
|
66
|
+
onCollapse,
|
|
67
|
+
name
|
|
68
|
+
} = _ref2;
|
|
69
|
+
const {
|
|
70
|
+
options
|
|
71
|
+
} = layer;
|
|
72
|
+
const legends = (_options$legend$items = options === null || options === void 0 ? void 0 : (_options$legend = options.legend) === null || _options$legend === void 0 ? void 0 : _options$legend.items) !== null && _options$legend$items !== void 0 ? _options$legend$items : getLegendsFromParams(options === null || options === void 0 ? void 0 : options.params);
|
|
73
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
74
|
+
style: {
|
|
75
|
+
maxWidth: 200,
|
|
76
|
+
alignItems: "start",
|
|
77
|
+
gap: 8
|
|
78
|
+
},
|
|
79
|
+
className: "legend-card",
|
|
80
|
+
ref: ref
|
|
81
|
+
}, /*#__PURE__*/_react.default.createElement(_LegendCardHeader.default, {
|
|
82
|
+
title: name,
|
|
83
|
+
collapsible: collapsible,
|
|
84
|
+
onCollapse: onCollapse
|
|
85
|
+
}), /*#__PURE__*/_react.default.createElement(_ui.Divider, {
|
|
86
|
+
margin: "0"
|
|
87
|
+
}), /*#__PURE__*/_react.default.createElement("p", {
|
|
88
|
+
style: {
|
|
89
|
+
margin: 0
|
|
90
|
+
}
|
|
91
|
+
}, (_options$description = options === null || options === void 0 ? void 0 : options.description) !== null && _options$description !== void 0 ? _options$description : ""), !(0, _lodash.isEmpty)(legends) && /*#__PURE__*/_react.default.createElement("b", null, (_options$unit = options === null || options === void 0 ? void 0 : options.unit) !== null && _options$unit !== void 0 ? _options$unit : ""), /*#__PURE__*/_react.default.createElement("div", {
|
|
92
|
+
className: "legend-list"
|
|
93
|
+
}, legends === null || legends === void 0 ? void 0 : legends.map(legend => /*#__PURE__*/_react.default.createElement(LegendItem, {
|
|
94
|
+
key: `${legend === null || legend === void 0 ? void 0 : legend.color}-legend-list`,
|
|
95
|
+
legend: legend
|
|
96
|
+
}))), (options === null || options === void 0 ? void 0 : options.source) && /*#__PURE__*/_react.default.createElement("div", {
|
|
97
|
+
className: "row gap-8"
|
|
98
|
+
}, _d2I18n.default.t("Source"), ":", /*#__PURE__*/_react.default.createElement("a", {
|
|
99
|
+
className: "source-url",
|
|
100
|
+
target: "_blank",
|
|
101
|
+
referrerPolicy: "no-referrer",
|
|
102
|
+
href: options === null || options === void 0 ? void 0 : options.sourceUrl
|
|
103
|
+
}, (_options$source = options === null || options === void 0 ? void 0 : options.source) !== null && _options$source !== void 0 ? _options$source : "")));
|
|
104
|
+
}
|
|
105
|
+
var _default = /*#__PURE__*/(0, _react.forwardRef)(EarthEngineLegend);
|
|
106
|
+
exports.default = _default;
|
package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SUPPORTED_EARTH_ENGINE_LAYERS = exports.EARTH_ENGINE_LAYERS = exports.EARTH_ENGINE_LAYER = void 0;
|
|
7
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const EARTH_ENGINE_LAYER = "earthEngine";
|
|
10
|
+
exports.EARTH_ENGINE_LAYER = EARTH_ENGINE_LAYER;
|
|
11
|
+
const EARTH_ENGINE_LAYERS = [{
|
|
12
|
+
layer: EARTH_ENGINE_LAYER,
|
|
13
|
+
id: "population",
|
|
14
|
+
datasetId: "WorldPop/GP/100m/pop",
|
|
15
|
+
type: "ImageCollection",
|
|
16
|
+
name: _d2I18n.default.t("Population"),
|
|
17
|
+
unit: _d2I18n.default.t("people per hectare"),
|
|
18
|
+
description: _d2I18n.default.t("Estimated number of people living in an area."),
|
|
19
|
+
source: "WorldPop / Google Earth Engine",
|
|
20
|
+
sourceUrl: "https://developers.google.com/earth-engine/datasets/catalog/WorldPop_GP_100m_pop",
|
|
21
|
+
img: "images/population.png",
|
|
22
|
+
defaultAggregations: ["sum", "mean"],
|
|
23
|
+
tokenType: "Bearer",
|
|
24
|
+
periodType: "Yearly",
|
|
25
|
+
filters: ["period"],
|
|
26
|
+
mosaic: true,
|
|
27
|
+
params: {
|
|
28
|
+
min: 0,
|
|
29
|
+
max: 10,
|
|
30
|
+
palette: "#fee5d9,#fcbba1,#fc9272,#fb6a4a,#de2d26,#a50f15" // Reds
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
opacity: 0.9
|
|
34
|
+
}, {
|
|
35
|
+
layer: EARTH_ENGINE_LAYER,
|
|
36
|
+
type: "ImageCollection",
|
|
37
|
+
tokenType: "Bearer",
|
|
38
|
+
id: "populationAgeGroups",
|
|
39
|
+
datasetId: "WorldPop/GP/100m/pop_age_sex_cons_unadj",
|
|
40
|
+
name: _d2I18n.default.t("Population age groups"),
|
|
41
|
+
unit: _d2I18n.default.t("people per hectare"),
|
|
42
|
+
description: _d2I18n.default.t("Estimated number of people living in an area, grouped by age and gender."),
|
|
43
|
+
source: "WorldPop / Google Earth Engine",
|
|
44
|
+
sourceUrl: "https://developers.google.com/earth-engine/datasets/catalog/WorldPop_GP_100m_pop_age_sex_cons_unadj",
|
|
45
|
+
img: "images/population.png",
|
|
46
|
+
periodType: "Yearly",
|
|
47
|
+
defaultAggregations: ["sum", "mean"],
|
|
48
|
+
bands: [{
|
|
49
|
+
id: "M_0",
|
|
50
|
+
name: _d2I18n.default.t("Male 0 - 1 years")
|
|
51
|
+
}, {
|
|
52
|
+
id: "M_1",
|
|
53
|
+
name: _d2I18n.default.t("Male 1 - 4 years")
|
|
54
|
+
}, {
|
|
55
|
+
id: "M_5",
|
|
56
|
+
name: _d2I18n.default.t("Male 5 - 9 years")
|
|
57
|
+
}, {
|
|
58
|
+
id: "M_10",
|
|
59
|
+
name: _d2I18n.default.t("Male 10 - 14 years")
|
|
60
|
+
}, {
|
|
61
|
+
id: "M_15",
|
|
62
|
+
name: _d2I18n.default.t("Male 15 - 19 years")
|
|
63
|
+
}, {
|
|
64
|
+
id: "M_20",
|
|
65
|
+
name: _d2I18n.default.t("Male 20 - 24 years")
|
|
66
|
+
}, {
|
|
67
|
+
id: "M_25",
|
|
68
|
+
name: _d2I18n.default.t("Male 25 - 29 years")
|
|
69
|
+
}, {
|
|
70
|
+
id: "M_30",
|
|
71
|
+
name: _d2I18n.default.t("Male 30 - 34 years")
|
|
72
|
+
}, {
|
|
73
|
+
id: "M_35",
|
|
74
|
+
name: _d2I18n.default.t("Male 35 - 39 years")
|
|
75
|
+
}, {
|
|
76
|
+
id: "M_40",
|
|
77
|
+
name: _d2I18n.default.t("Male 40 - 44 years")
|
|
78
|
+
}, {
|
|
79
|
+
id: "M_45",
|
|
80
|
+
name: _d2I18n.default.t("Male 45 - 49 years")
|
|
81
|
+
}, {
|
|
82
|
+
id: "M_50",
|
|
83
|
+
name: _d2I18n.default.t("Male 50 - 54 years")
|
|
84
|
+
}, {
|
|
85
|
+
id: "M_55",
|
|
86
|
+
name: _d2I18n.default.t("Male 55 - 59 years")
|
|
87
|
+
}, {
|
|
88
|
+
id: "M_60",
|
|
89
|
+
name: _d2I18n.default.t("Male 60 - 64 years")
|
|
90
|
+
}, {
|
|
91
|
+
id: "M_65",
|
|
92
|
+
name: _d2I18n.default.t("Male 65 - 69 years")
|
|
93
|
+
}, {
|
|
94
|
+
id: "M_70",
|
|
95
|
+
name: _d2I18n.default.t("Male 70 - 74 years")
|
|
96
|
+
}, {
|
|
97
|
+
id: "M_75",
|
|
98
|
+
name: _d2I18n.default.t("Male 75 - 79 years")
|
|
99
|
+
}, {
|
|
100
|
+
id: "M_80",
|
|
101
|
+
name: _d2I18n.default.t("Male 80 years and above")
|
|
102
|
+
}, {
|
|
103
|
+
id: "F_0",
|
|
104
|
+
name: _d2I18n.default.t("Female 0 - 1 years")
|
|
105
|
+
}, {
|
|
106
|
+
id: "F_1",
|
|
107
|
+
name: _d2I18n.default.t("Female 1 - 4 years")
|
|
108
|
+
}, {
|
|
109
|
+
id: "F_5",
|
|
110
|
+
name: _d2I18n.default.t("Female 5 - 9 years")
|
|
111
|
+
}, {
|
|
112
|
+
id: "F_10",
|
|
113
|
+
name: _d2I18n.default.t("Female 10 - 14 years")
|
|
114
|
+
}, {
|
|
115
|
+
id: "F_15",
|
|
116
|
+
name: _d2I18n.default.t("Female 15 - 19 years")
|
|
117
|
+
}, {
|
|
118
|
+
id: "F_20",
|
|
119
|
+
name: _d2I18n.default.t("Female 20 - 24 years")
|
|
120
|
+
}, {
|
|
121
|
+
id: "F_25",
|
|
122
|
+
name: _d2I18n.default.t("Female 25 - 29 years")
|
|
123
|
+
}, {
|
|
124
|
+
id: "F_30",
|
|
125
|
+
name: _d2I18n.default.t("Female 30 - 34 years")
|
|
126
|
+
}, {
|
|
127
|
+
id: "F_35",
|
|
128
|
+
name: _d2I18n.default.t("Female 35 - 39 years")
|
|
129
|
+
}, {
|
|
130
|
+
id: "F_40",
|
|
131
|
+
name: _d2I18n.default.t("Female 40 - 44 years")
|
|
132
|
+
}, {
|
|
133
|
+
id: "F_45",
|
|
134
|
+
name: _d2I18n.default.t("Female 45 - 49 years")
|
|
135
|
+
}, {
|
|
136
|
+
id: "F_50",
|
|
137
|
+
name: _d2I18n.default.t("Female 50 - 54 years")
|
|
138
|
+
}, {
|
|
139
|
+
id: "F_55",
|
|
140
|
+
name: _d2I18n.default.t("Female 55 - 59 years")
|
|
141
|
+
}, {
|
|
142
|
+
id: "F_60",
|
|
143
|
+
name: _d2I18n.default.t("Female 60 - 64 years")
|
|
144
|
+
}, {
|
|
145
|
+
id: "F_65",
|
|
146
|
+
name: _d2I18n.default.t("Female 65 - 69 years")
|
|
147
|
+
}, {
|
|
148
|
+
id: "F_70",
|
|
149
|
+
name: _d2I18n.default.t("Female 70 - 74 years"),
|
|
150
|
+
multiple: true
|
|
151
|
+
}, {
|
|
152
|
+
id: "F_75",
|
|
153
|
+
name: _d2I18n.default.t("Female 75 - 79 years")
|
|
154
|
+
}, {
|
|
155
|
+
id: "F_80",
|
|
156
|
+
name: _d2I18n.default.t("Female 80 years and above")
|
|
157
|
+
}],
|
|
158
|
+
filters: ["period"],
|
|
159
|
+
mosaic: true,
|
|
160
|
+
params: {
|
|
161
|
+
min: 0,
|
|
162
|
+
max: 10,
|
|
163
|
+
palette: "#fee5d9,#fcbba1,#fc9272,#fb6a4a,#de2d26,#a50f15" // Reds
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
opacity: 0.9,
|
|
167
|
+
tileScale: 4
|
|
168
|
+
}, {
|
|
169
|
+
layer: EARTH_ENGINE_LAYER,
|
|
170
|
+
id: "footprints",
|
|
171
|
+
datasetId: "GOOGLE/Research/open-buildings/v1/polygons",
|
|
172
|
+
type: "FeatureCollection",
|
|
173
|
+
name: _d2I18n.default.t("Building footprints"),
|
|
174
|
+
unit: _d2I18n.default.t("Number of buildings"),
|
|
175
|
+
description: _d2I18n.default.t("The outlines of buildings derived from high-resolution satellite imagery. Only for the continent of Africa."),
|
|
176
|
+
notice: _d2I18n.default.t("Building counts are only available for smaller organisation unit areas."),
|
|
177
|
+
error: _d2I18n.default.t("Select a smaller area or single organization unit to see the count of buildings."),
|
|
178
|
+
source: "NASA / USGS / JPL-Caltech / Google Earth Engine",
|
|
179
|
+
sourceUrl: "https://sites.research.google/open-buildings/",
|
|
180
|
+
img: "images/buildings.png",
|
|
181
|
+
aggregations: ["count"],
|
|
182
|
+
defaultAggregations: ["count"],
|
|
183
|
+
opacity: 0.9,
|
|
184
|
+
tokenType: "Bearer"
|
|
185
|
+
}, {
|
|
186
|
+
layer: EARTH_ENGINE_LAYER,
|
|
187
|
+
id: "elevation",
|
|
188
|
+
type: "Image",
|
|
189
|
+
tokenType: "Bearer",
|
|
190
|
+
datasetId: "USGS/SRTMGL1_003",
|
|
191
|
+
name: _d2I18n.default.t("Elevation"),
|
|
192
|
+
unit: _d2I18n.default.t("meters"),
|
|
193
|
+
description: _d2I18n.default.t("Elevation above sea-level."),
|
|
194
|
+
source: "NASA / USGS / JPL-Caltech / Google Earth Engine",
|
|
195
|
+
sourceUrl: "https://explorer.earthengine.google.com/#detail/USGS%2FSRTMGL1_003",
|
|
196
|
+
img: "images/elevation.png",
|
|
197
|
+
aggregations: ["min", "max", "mean", "median", "stdDev", "variance"],
|
|
198
|
+
defaultAggregations: ["mean", "min", "max"],
|
|
199
|
+
selectedBands: ["elevation"],
|
|
200
|
+
params: {
|
|
201
|
+
min: 0,
|
|
202
|
+
max: 1500,
|
|
203
|
+
palette: "#ffffd4,#fee391,#fec44f,#fe9929,#d95f0e,#993404" // YlOrBr
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
opacity: 0.9
|
|
207
|
+
}, {
|
|
208
|
+
layer: EARTH_ENGINE_LAYER,
|
|
209
|
+
datasetId: "UCSB-CHG/CHIRPS/PENTAD",
|
|
210
|
+
id: "precipitation",
|
|
211
|
+
type: "ImageCollection",
|
|
212
|
+
tokenType: "Bearer",
|
|
213
|
+
name: _d2I18n.default.t("Precipitation"),
|
|
214
|
+
unit: _d2I18n.default.t("millimeter"),
|
|
215
|
+
description: _d2I18n.default.t("Precipitation collected from satellite and weather stations on the ground. The values are in millimeters within 5 days periods. Updated monthly, during the 3rd week of the following month."),
|
|
216
|
+
source: "UCSB / CHG / Google Earth Engine",
|
|
217
|
+
sourceUrl: "https://explorer.earthengine.google.com/#detail/UCSB-CHG%2FCHIRPS%2FPENTAD",
|
|
218
|
+
periodType: "Custom",
|
|
219
|
+
selectedBands: ["precipitation"],
|
|
220
|
+
aggregations: ["min", "max", "mean", "median", "stdDev", "variance"],
|
|
221
|
+
defaultAggregations: ["mean", "min", "max"],
|
|
222
|
+
mask: true,
|
|
223
|
+
img: "images/precipitation.png",
|
|
224
|
+
params: {
|
|
225
|
+
min: 0,
|
|
226
|
+
max: 100,
|
|
227
|
+
palette: "#eff3ff,#c6dbef,#9ecae1,#6baed6,#3182bd,#08519c" // Blues
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
opacity: 0.9
|
|
231
|
+
}, {
|
|
232
|
+
layer: EARTH_ENGINE_LAYER,
|
|
233
|
+
datasetId: "MODIS/006/MOD11A2",
|
|
234
|
+
id: "temperature",
|
|
235
|
+
type: "ImageCollection",
|
|
236
|
+
tokenType: "Bearer",
|
|
237
|
+
name: _d2I18n.default.t("Temperature"),
|
|
238
|
+
unit: _d2I18n.default.t("°C during daytime"),
|
|
239
|
+
description: _d2I18n.default.t("Land surface temperatures collected from satellite. Blank spots will appear in areas with a persistent cloud cover."),
|
|
240
|
+
source: "NASA LP DAAC / Google Earth Engine",
|
|
241
|
+
sourceUrl: "https://explorer.earthengine.google.com/#detail/MODIS%2FMOD11A2",
|
|
242
|
+
img: "images/temperature.png",
|
|
243
|
+
aggregations: ["min", "max", "mean", "median", "stdDev", "variance"],
|
|
244
|
+
defaultAggregations: ["mean", "min", "max"],
|
|
245
|
+
periodType: "Custom",
|
|
246
|
+
selectedBands: ["LST_Day_1km"],
|
|
247
|
+
mask: true,
|
|
248
|
+
methods: {
|
|
249
|
+
toFloat: [],
|
|
250
|
+
multiply: [0.02],
|
|
251
|
+
subtract: [273.15]
|
|
252
|
+
},
|
|
253
|
+
params: {
|
|
254
|
+
min: 0,
|
|
255
|
+
max: 40,
|
|
256
|
+
palette: "#fff5f0,#fee0d2,#fcbba1,#fc9272,#fb6a4a,#ef3b2c,#cb181d,#a50f15,#67000d" // Reds
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
opacity: 0.9
|
|
260
|
+
}, {
|
|
261
|
+
layer: EARTH_ENGINE_LAYER,
|
|
262
|
+
type: "ImageCollection",
|
|
263
|
+
tokenType: "Bearer",
|
|
264
|
+
id: "landCover",
|
|
265
|
+
datasetId: "MODIS/006/MCD12Q1",
|
|
266
|
+
// No longer in use: 'MODIS/051/MCD12Q1',
|
|
267
|
+
name: _d2I18n.default.t("Landcover"),
|
|
268
|
+
description: _d2I18n.default.t("Distinct landcover types collected from satellites."),
|
|
269
|
+
source: "NASA LP DAAC / Google Earth Engine",
|
|
270
|
+
sourceUrl: "https://developers.google.com/earth-engine/datasets/catalog/MODIS_006_MCD12Q1",
|
|
271
|
+
periodType: "Yearly",
|
|
272
|
+
filters: ["period"],
|
|
273
|
+
selectedBands: ["LC_Type1"],
|
|
274
|
+
defaultAggregations: ["percentage", "hectares", "acres"],
|
|
275
|
+
maxAggregations: 1,
|
|
276
|
+
legend: {
|
|
277
|
+
items: [
|
|
278
|
+
// http://www.eomf.ou.edu/static/IGBP.pdf
|
|
279
|
+
{
|
|
280
|
+
id: 1,
|
|
281
|
+
name: _d2I18n.default.t("Evergreen Needleleaf forest"),
|
|
282
|
+
color: "#162103"
|
|
283
|
+
}, {
|
|
284
|
+
id: 2,
|
|
285
|
+
name: _d2I18n.default.t("Evergreen Broadleaf forest"),
|
|
286
|
+
color: "#235123"
|
|
287
|
+
}, {
|
|
288
|
+
id: 3,
|
|
289
|
+
name: _d2I18n.default.t("Deciduous Needleleaf forest"),
|
|
290
|
+
color: "#399b38"
|
|
291
|
+
}, {
|
|
292
|
+
id: 4,
|
|
293
|
+
name: _d2I18n.default.t("Deciduous Broadleaf forest"),
|
|
294
|
+
color: "#38eb38"
|
|
295
|
+
}, {
|
|
296
|
+
id: 5,
|
|
297
|
+
name: _d2I18n.default.t("Mixed forest"),
|
|
298
|
+
color: "#39723b"
|
|
299
|
+
}, {
|
|
300
|
+
id: 6,
|
|
301
|
+
name: _d2I18n.default.t("Closed shrublands"),
|
|
302
|
+
color: "#6a2424"
|
|
303
|
+
}, {
|
|
304
|
+
id: 7,
|
|
305
|
+
name: _d2I18n.default.t("Open shrublands"),
|
|
306
|
+
color: "#c3a55f"
|
|
307
|
+
}, {
|
|
308
|
+
id: 8,
|
|
309
|
+
name: _d2I18n.default.t("Woody savannas"),
|
|
310
|
+
color: "#b76124"
|
|
311
|
+
}, {
|
|
312
|
+
id: 9,
|
|
313
|
+
name: _d2I18n.default.t("Savannas"),
|
|
314
|
+
color: "#d99125"
|
|
315
|
+
}, {
|
|
316
|
+
id: 10,
|
|
317
|
+
name: _d2I18n.default.t("Grasslands"),
|
|
318
|
+
color: "#92af1f"
|
|
319
|
+
}, {
|
|
320
|
+
id: 11,
|
|
321
|
+
name: _d2I18n.default.t("Permanent wetlands"),
|
|
322
|
+
color: "#10104c"
|
|
323
|
+
}, {
|
|
324
|
+
id: 12,
|
|
325
|
+
name: _d2I18n.default.t("Croplands"),
|
|
326
|
+
color: "#cdb400"
|
|
327
|
+
}, {
|
|
328
|
+
id: 13,
|
|
329
|
+
name: _d2I18n.default.t("Urban and built-up"),
|
|
330
|
+
color: "#cc0202"
|
|
331
|
+
}, {
|
|
332
|
+
id: 14,
|
|
333
|
+
name: _d2I18n.default.t("Cropland/Natural vegetation mosaic"),
|
|
334
|
+
color: "#332808"
|
|
335
|
+
}, {
|
|
336
|
+
id: 15,
|
|
337
|
+
name: _d2I18n.default.t("Snow and ice"),
|
|
338
|
+
color: "#d7cdcc"
|
|
339
|
+
}, {
|
|
340
|
+
id: 16,
|
|
341
|
+
name: _d2I18n.default.t("Barren or sparsely vegetated"),
|
|
342
|
+
color: "#f7e174"
|
|
343
|
+
}, {
|
|
344
|
+
id: 17,
|
|
345
|
+
name: _d2I18n.default.t("Water"),
|
|
346
|
+
color: "#aec3d6"
|
|
347
|
+
}]
|
|
348
|
+
},
|
|
349
|
+
mask: false,
|
|
350
|
+
img: "images/landcover.png",
|
|
351
|
+
opacity: 0.9
|
|
352
|
+
}, {
|
|
353
|
+
layer: EARTH_ENGINE_LAYER,
|
|
354
|
+
id: "nightLights",
|
|
355
|
+
type: "ImageCollection",
|
|
356
|
+
tokenType: "Bearer",
|
|
357
|
+
legacy: true,
|
|
358
|
+
// Kept for backward compability
|
|
359
|
+
datasetId: "NOAA/DMSP-OLS/NIGHTTIME_LIGHTS",
|
|
360
|
+
name: _d2I18n.default.t("Nighttime lights"),
|
|
361
|
+
unit: _d2I18n.default.t("light intensity"),
|
|
362
|
+
description: _d2I18n.default.t("Light intensity from cities, towns, and other sites with persistent lighting, including gas flares."),
|
|
363
|
+
source: "NOAA / Google Earth Engine",
|
|
364
|
+
sourceUrl: "https://explorer.earthengine.google.com/#detail/NOAA%2FDMSP-OLS%2FNIGHTTIME_LIGHTS",
|
|
365
|
+
periodType: "Yearly",
|
|
366
|
+
selectedBands: ["stable_lights"],
|
|
367
|
+
mask: true,
|
|
368
|
+
img: "images/nighttime.png",
|
|
369
|
+
params: {
|
|
370
|
+
min: 0,
|
|
371
|
+
max: 63,
|
|
372
|
+
palette: "#ffffd4,#fee391,#fec44f,#fe9929,#ec7014,#cc4c02,#8c2d04" // YlOrBr
|
|
373
|
+
},
|
|
374
|
+
|
|
375
|
+
opacity: 0.9
|
|
376
|
+
}];
|
|
377
|
+
exports.EARTH_ENGINE_LAYERS = EARTH_ENGINE_LAYERS;
|
|
378
|
+
const SUPPORTED_EARTH_ENGINE_LAYERS = ["population", "landCover", "footprints"];
|
|
379
|
+
exports.SUPPORTED_EARTH_ENGINE_LAYERS = SUPPORTED_EARTH_ENGINE_LAYERS;
|
package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useGoogleEngineLayer;
|
|
7
|
+
exports.useGoogleEngineToken = useGoogleEngineToken;
|
|
8
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
9
|
+
var _lodash = require("lodash");
|
|
10
|
+
var _hooks = require("../../../../MapProvider/hooks");
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
const googleEngineKeyQuery = {
|
|
13
|
+
token: {
|
|
14
|
+
resource: "tokens/google"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
function useGoogleEngineToken() {
|
|
18
|
+
const engine = (0, _appRuntime.useDataEngine)();
|
|
19
|
+
const [loading, setLoading] = (0, _react.useState)(false);
|
|
20
|
+
const getToken = async () => {
|
|
21
|
+
setLoading(true);
|
|
22
|
+
const token = await engine.query(googleEngineKeyQuery);
|
|
23
|
+
setLoading(false);
|
|
24
|
+
return token;
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
refresh: getToken,
|
|
28
|
+
loading
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function useGoogleEngineLayer(layerId) {
|
|
32
|
+
const {
|
|
33
|
+
layers
|
|
34
|
+
} = (0, _hooks.useMapLayers)();
|
|
35
|
+
return (0, _lodash.find)(layers, ["id", layerId]);
|
|
36
|
+
}
|