@hisptz/dhis2-analytics 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/components/ChartAnalytics/ChartAnalytics.stories.js +253 -0
- package/build/cjs/components/ChartAnalytics/ChartAnalytics.test.js +51 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +48 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +34 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/index.js +67 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/column-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/complex-multi-series-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/multi-series-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/pie-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/stacked-chart-data.json +0 -0
- package/build/cjs/components/ChartAnalytics/hooks/useChart.js +38 -0
- package/build/cjs/components/ChartAnalytics/index.js +69 -0
- package/build/cjs/components/ChartAnalytics/models/column.js +53 -0
- package/build/cjs/components/ChartAnalytics/models/index.js +102 -0
- package/build/cjs/components/ChartAnalytics/models/line.js +35 -0
- package/build/cjs/components/ChartAnalytics/models/multi-series.js +111 -0
- package/build/cjs/components/ChartAnalytics/models/pie.js +53 -0
- package/build/cjs/components/ChartAnalytics/services/export.js +50 -0
- package/{src → build/cjs}/components/ChartAnalytics/styles/custom-highchart.css +0 -0
- package/build/cjs/components/ChartAnalytics/types/props.js +1 -0
- package/build/cjs/components/ChartAnalytics/utils/chart.js +133 -0
- package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.stories.js +45 -0
- package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.test.js +13 -0
- package/build/cjs/components/CircularProgressDashboard/index.js +49 -0
- package/build/cjs/components/CircularProgressDashboard/types/props.js +1 -0
- package/build/cjs/components/Map/Map.stories.js +352 -0
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +32 -0
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +40 -0
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/index.js +458 -0
- package/build/cjs/components/Map/components/MapArea/index.js +101 -0
- package/build/cjs/components/Map/components/MapArea/interfaces/index.js +1 -0
- package/build/cjs/components/Map/components/MapControls/components/CustomControl/index.js +32 -0
- package/build/cjs/components/Map/components/MapControls/components/DownloadControl/index.js +25 -0
- package/build/cjs/components/Map/components/MapControls/components/FullscreenControl/index.js +13 -0
- package/build/cjs/components/Map/components/MapControls/index.js +42 -0
- package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +13 -0
- package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/index.js +51 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +106 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +379 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +36 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +200 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +14 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +412 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +124 -0
- package/{src → build/cjs}/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +0 -0
- package/build/cjs/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +26 -0
- package/build/cjs/components/Map/components/MapLayer/components/LegendArea/index.js +181 -0
- package/build/cjs/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +86 -0
- package/build/cjs/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +14 -0
- package/build/cjs/components/Map/components/MapLayer/components/PointLayer/index.js +46 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +57 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js +145 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +43 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +56 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +61 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +43 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +35 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +15 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/index.js +57 -0
- package/{src → build/cjs}/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +0 -0
- package/build/cjs/components/Map/components/MapLayer/index.js +40 -0
- package/build/cjs/components/Map/components/MapLayer/interfaces/index.js +8 -0
- package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +389 -0
- package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/index.js +116 -0
- package/build/cjs/components/Map/components/MapProvider/hooks/index.js +19 -0
- package/build/cjs/components/Map/components/MapProvider/index.js +121 -0
- package/build/cjs/components/Map/components/MapUpdater/index.js +24 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +32 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +40 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +40 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js +428 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +63 -0
- package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +0 -0
- package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +0 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +72 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +71 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +47 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +79 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/index.js +265 -0
- package/build/cjs/components/Map/constants/colors.js +428 -0
- package/build/cjs/components/Map/constants/legendSet.js +22 -0
- package/build/cjs/components/Map/hooks/map.js +52 -0
- package/build/cjs/components/Map/index.js +108 -0
- package/build/cjs/components/Map/interfaces/index.js +1 -0
- package/build/cjs/components/Map/state/index.js +23 -0
- package/build/cjs/components/Map/utils/colors.js +78 -0
- package/build/cjs/components/Map/utils/helpers.js +25 -0
- package/build/cjs/components/Map/utils/map.js +161 -0
- package/build/cjs/components/SingleValueContainer/SingleValueContainer.stories.js +127 -0
- package/build/cjs/components/SingleValueContainer/SingleValueContainer.test.js +23 -0
- package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +54 -0
- package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +24 -0
- package/build/cjs/components/SingleValueContainer/index.js +43 -0
- package/{src → build/cjs}/components/SingleValueContainer/styles/SingleValueContainer.module.css +0 -0
- package/build/cjs/components/SingleValueContainer/types/props.js +1 -0
- package/{src → build/cjs}/data/map.json +0 -0
- package/build/cjs/dataProviders/map.js +31 -0
- package/build/cjs/index.js +49 -0
- package/build/cjs/locales/en/translations.json +128 -0
- package/build/cjs/locales/index.js +22 -0
- package/build/es/components/ChartAnalytics/ChartAnalytics.stories.js +235 -0
- package/build/es/components/ChartAnalytics/ChartAnalytics.test.js +46 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +41 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +26 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/index.js +58 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
- package/build/es/components/ChartAnalytics/data/column-data.json +210 -0
- package/build/es/components/ChartAnalytics/data/complex-multi-series-data.json +124 -0
- package/build/es/components/ChartAnalytics/data/multi-series-data.json +536 -0
- package/build/es/components/ChartAnalytics/data/pie-data.json +115 -0
- package/build/es/components/ChartAnalytics/data/stacked-chart-data.json +415 -0
- package/build/es/components/ChartAnalytics/hooks/useChart.js +32 -0
- package/build/es/components/ChartAnalytics/index.js +40 -0
- package/build/es/components/ChartAnalytics/models/column.js +45 -0
- package/build/es/components/ChartAnalytics/models/index.js +95 -0
- package/build/es/components/ChartAnalytics/models/line.js +28 -0
- package/build/es/components/ChartAnalytics/models/multi-series.js +104 -0
- package/build/es/components/ChartAnalytics/models/pie.js +46 -0
- package/build/es/components/ChartAnalytics/services/export.js +36 -0
- package/build/es/components/ChartAnalytics/styles/custom-highchart.css +48 -0
- package/build/es/components/ChartAnalytics/types/props.js +1 -0
- package/build/es/components/ChartAnalytics/utils/chart.js +122 -0
- package/{src/components/CircularProgressDashboard/CircularProgressIndicator.stories.tsx → build/es/components/CircularProgressDashboard/CircularProgressIndicator.stories.js} +9 -16
- package/build/es/components/CircularProgressDashboard/CircularProgressIndicator.test.js +10 -0
- package/build/es/components/CircularProgressDashboard/index.js +41 -0
- package/build/es/components/CircularProgressDashboard/types/props.js +1 -0
- package/build/es/components/Map/Map.stories.js +334 -0
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +23 -0
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +31 -0
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/index.js +448 -0
- package/build/es/components/Map/components/MapArea/index.js +91 -0
- package/build/es/components/Map/components/MapArea/interfaces/index.js +1 -0
- package/build/es/components/Map/components/MapControls/components/CustomControl/index.js +25 -0
- package/build/es/components/Map/components/MapControls/components/DownloadControl/index.js +18 -0
- package/build/es/components/Map/components/MapControls/components/FullscreenControl/index.js +6 -0
- package/build/es/components/Map/components/MapControls/index.js +35 -0
- package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +7 -0
- package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/index.js +41 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +95 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +369 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +29 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +191 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +14 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +403 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +111 -0
- package/build/es/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +12 -0
- package/build/es/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +19 -0
- package/build/es/components/Map/components/MapLayer/components/LegendArea/index.js +172 -0
- package/build/es/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +76 -0
- package/build/es/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +8 -0
- package/build/es/components/Map/components/MapLayer/components/PointLayer/index.js +39 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +49 -0
- package/{src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.tsx → build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js} +57 -74
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +33 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +47 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +50 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +36 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +28 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +9 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/index.js +50 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +62 -0
- package/build/es/components/Map/components/MapLayer/index.js +33 -0
- package/build/es/components/Map/components/MapLayer/interfaces/index.js +1 -0
- package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +381 -0
- package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/index.js +107 -0
- package/{src/components/Map/components/MapProvider/hooks/index.ts → build/es/components/Map/components/MapProvider/hooks/index.js} +3 -6
- package/build/es/components/Map/components/MapProvider/index.js +112 -0
- package/build/es/components/Map/components/MapUpdater/index.js +17 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +23 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +31 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +33 -0
- package/{src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.ts → build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js} +46 -59
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +53 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +15 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +12 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +56 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +64 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +38 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +70 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/index.js +254 -0
- package/{src/components/Map/constants/colors.ts → build/es/components/Map/constants/colors.js} +46 -59
- package/build/es/components/Map/constants/legendSet.js +15 -0
- package/build/es/components/Map/hooks/map.js +44 -0
- package/build/es/components/Map/index.js +51 -0
- package/build/es/components/Map/interfaces/index.js +1 -0
- package/build/es/components/Map/state/index.js +14 -0
- package/build/es/components/Map/utils/colors.js +61 -0
- package/build/es/components/Map/utils/helpers.js +14 -0
- package/build/es/components/Map/utils/map.js +147 -0
- package/build/es/components/SingleValueContainer/SingleValueContainer.stories.js +115 -0
- package/build/es/components/SingleValueContainer/SingleValueContainer.test.js +20 -0
- package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +47 -0
- package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +17 -0
- package/build/es/components/SingleValueContainer/index.js +29 -0
- package/build/es/components/SingleValueContainer/styles/SingleValueContainer.module.css +39 -0
- package/build/es/components/SingleValueContainer/types/props.js +1 -0
- package/build/es/data/map.json +5984 -0
- package/build/es/dataProviders/map.js +24 -0
- package/build/es/index.js +5 -0
- package/build/es/locales/en/translations.json +128 -0
- package/build/es/locales/index.js +13 -0
- package/build/types/components/ChartAnalytics/components/DownloadMenu/components/Menu.d.ts +8 -0
- package/build/types/components/ChartAnalytics/components/DownloadMenu/constants/menu.d.ts +7 -0
- package/build/types/components/ChartAnalytics/components/DownloadMenu/index.d.ts +9 -0
- package/{src/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.ts → build/types/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.d.ts} +0 -0
- package/build/types/components/ChartAnalytics/hooks/useChart.d.ts +11 -0
- package/build/types/components/ChartAnalytics/index.d.ts +9 -0
- package/build/types/components/ChartAnalytics/models/column.d.ts +12 -0
- package/build/types/components/ChartAnalytics/models/index.d.ts +17 -0
- package/build/types/components/ChartAnalytics/models/line.d.ts +8 -0
- package/build/types/components/ChartAnalytics/models/multi-series.d.ts +9 -0
- package/build/types/components/ChartAnalytics/models/pie.d.ts +8 -0
- package/build/types/components/ChartAnalytics/services/export.d.ts +8 -0
- package/build/types/components/ChartAnalytics/types/props.d.ts +43 -0
- package/build/types/components/ChartAnalytics/utils/chart.d.ts +15 -0
- package/build/types/components/CircularProgressDashboard/index.d.ts +3 -0
- package/build/types/components/CircularProgressDashboard/types/props.d.ts +17 -0
- package/build/types/components/Map/components/EarthEngineLayerConfiguration/index.d.ts +17 -0
- package/build/types/components/Map/components/MapArea/index.d.ts +5 -0
- package/build/types/components/Map/components/MapArea/interfaces/index.d.ts +30 -0
- package/build/types/components/Map/components/MapControls/components/CustomControl/index.d.ts +7 -0
- package/build/types/components/Map/components/MapControls/components/DownloadControl/index.d.ts +8 -0
- package/build/types/components/Map/components/MapControls/components/FullscreenControl/index.d.ts +5 -0
- package/build/types/components/Map/components/MapControls/index.d.ts +6 -0
- package/build/types/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.d.ts +1 -0
- package/build/types/components/Map/components/MapLayer/components/BoundaryLayer/index.d.ts +15 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.d.ts +17 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.d.ts +4 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.d.ts +9 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/index.d.ts +4 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.d.ts +58 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.d.ts +1 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.d.ts +55 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.d.ts +20 -0
- package/build/types/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.d.ts +6 -0
- package/build/types/components/Map/components/MapLayer/components/LegendArea/index.d.ts +9 -0
- package/build/types/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.d.ts +3 -0
- package/build/types/components/Map/components/MapLayer/components/PointLayer/hooks/index.d.ts +2 -0
- package/build/types/components/Map/components/MapLayer/components/PointLayer/index.d.ts +2 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.d.ts +13 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.d.ts +10 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.d.ts +16 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.d.ts +12 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.d.ts +21 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.d.ts +12 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.d.ts +5 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.d.ts +2 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/index.d.ts +5 -0
- package/build/types/components/Map/components/MapLayer/index.d.ts +6 -0
- package/build/types/components/Map/components/MapLayer/interfaces/index.d.ts +123 -0
- package/build/types/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.d.ts +9 -0
- package/build/types/components/Map/components/MapProvider/components/MapLayerProvider/index.d.ts +6 -0
- package/build/types/components/Map/components/MapProvider/hooks/index.d.ts +15 -0
- package/build/types/components/Map/components/MapProvider/index.d.ts +3 -0
- package/build/types/components/Map/components/MapUpdater/index.d.ts +5 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.d.ts +8 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.d.ts +419 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.d.ts +9 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.d.ts +11 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.d.ts +2 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.d.ts +8 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.d.ts +9 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/index.d.ts +18 -0
- package/build/types/components/Map/constants/colors.d.ts +419 -0
- package/build/types/components/Map/constants/legendSet.d.ts +7 -0
- package/build/types/components/Map/hooks/map.d.ts +9 -0
- package/build/types/components/Map/index.d.ts +8 -0
- package/build/types/components/Map/interfaces/index.d.ts +65 -0
- package/build/types/components/Map/state/index.d.ts +20 -0
- package/build/types/components/Map/utils/colors.d.ts +12 -0
- package/build/types/components/Map/utils/helpers.d.ts +6 -0
- package/build/types/components/Map/utils/map.d.ts +40 -0
- package/build/types/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.d.ts +8 -0
- package/build/types/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.d.ts +2 -0
- package/build/types/components/SingleValueContainer/index.d.ts +5 -0
- package/build/types/components/SingleValueContainer/types/props.d.ts +15 -0
- package/build/types/dataProviders/map.d.ts +4 -0
- package/{src/index.ts → build/types/index.d.ts} +0 -0
- package/package.json +26 -5
- package/d2.config.js +0 -8
- package/i18n/en.pot +0 -409
- package/src/components/ChartAnalytics/ChartAnalytics.stories.tsx +0 -250
- package/src/components/ChartAnalytics/ChartAnalytics.test.tsx +0 -51
- package/src/components/ChartAnalytics/components/DownloadMenu/components/Menu.tsx +0 -48
- package/src/components/ChartAnalytics/components/DownloadMenu/constants/menu.ts +0 -38
- package/src/components/ChartAnalytics/components/DownloadMenu/index.tsx +0 -67
- package/src/components/ChartAnalytics/hooks/useChart.ts +0 -35
- package/src/components/ChartAnalytics/index.tsx +0 -23
- package/src/components/ChartAnalytics/models/column.ts +0 -50
- package/src/components/ChartAnalytics/models/index.ts +0 -78
- package/src/components/ChartAnalytics/models/line.ts +0 -31
- package/src/components/ChartAnalytics/models/multi-series.ts +0 -115
- package/src/components/ChartAnalytics/models/pie.ts +0 -54
- package/src/components/ChartAnalytics/services/export.ts +0 -38
- package/src/components/ChartAnalytics/types/props.tsx +0 -48
- package/src/components/ChartAnalytics/utils/chart.ts +0 -123
- package/src/components/CircularProgressDashboard/CircularProgressIndicator.test.tsx +0 -9
- package/src/components/CircularProgressDashboard/index.tsx +0 -35
- package/src/components/CircularProgressDashboard/types/props.tsx +0 -17
- package/src/components/Map/Map.stories.tsx +0 -339
- package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.tsx +0 -28
- package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.tsx +0 -34
- package/src/components/Map/components/EarthEngineLayerConfiguration/index.tsx +0 -412
- package/src/components/Map/components/MapArea/index.tsx +0 -83
- package/src/components/Map/components/MapArea/interfaces/index.ts +0 -39
- package/src/components/Map/components/MapControls/components/CustomControl/index.tsx +0 -24
- package/src/components/Map/components/MapControls/components/DownloadControl/index.tsx +0 -10
- package/src/components/Map/components/MapControls/components/FullscreenControl/index.tsx +0 -7
- package/src/components/Map/components/MapControls/index.tsx +0 -24
- package/src/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.ts +0 -7
- package/src/components/Map/components/MapLayer/components/BoundaryLayer/index.tsx +0 -55
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.tsx +0 -76
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.ts +0 -430
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.ts +0 -34
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/index.tsx +0 -185
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.ts +0 -56
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +0 -34233
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.ts +0 -431
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.ts +0 -105
- package/src/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.tsx +0 -17
- package/src/components/Map/components/MapLayer/components/LegendArea/index.tsx +0 -168
- package/src/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.tsx +0 -44
- package/src/components/Map/components/MapLayer/components/PointLayer/hooks/index.ts +0 -8
- package/src/components/Map/components/MapLayer/components/PointLayer/index.tsx +0 -36
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.tsx +0 -48
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.tsx +0 -39
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.tsx +0 -57
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.tsx +0 -43
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.tsx +0 -38
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.tsx +0 -26
- package/src/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.ts +0 -10
- package/src/components/Map/components/MapLayer/components/ThematicLayer/index.tsx +0 -46
- package/src/components/Map/components/MapLayer/index.tsx +0 -32
- package/src/components/Map/components/MapLayer/interfaces/index.ts +0 -139
- package/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx +0 -359
- package/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx +0 -105
- package/src/components/Map/components/MapProvider/index.tsx +0 -93
- package/src/components/Map/components/MapUpdater/index.tsx +0 -8
- package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.tsx +0 -28
- package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.tsx +0 -34
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.tsx +0 -24
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.tsx +0 -50
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.ts +0 -91
- package/src/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.tsx +0 -45
- package/src/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.tsx +0 -47
- package/src/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.tsx +0 -57
- package/src/components/Map/components/ThematicLayerConfiguration/index.tsx +0 -248
- package/src/components/Map/constants/legendSet.ts +0 -19
- package/src/components/Map/hooks/map.ts +0 -47
- package/src/components/Map/index.tsx +0 -65
- package/src/components/Map/interfaces/index.ts +0 -57
- package/src/components/Map/state/index.tsx +0 -31
- package/src/components/Map/utils/colors.ts +0 -95
- package/src/components/Map/utils/helpers.ts +0 -15
- package/src/components/Map/utils/map.ts +0 -150
- package/src/components/SingleValueContainer/SingleValueContainer.stories.tsx +0 -146
- package/src/components/SingleValueContainer/SingleValueContainer.test.tsx +0 -24
- package/src/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.tsx +0 -46
- package/src/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.tsx +0 -12
- package/src/components/SingleValueContainer/index.tsx +0 -30
- package/src/components/SingleValueContainer/types/props.tsx +0 -16
- package/src/dataProviders/map.tsx +0 -24
- package/src/index.test.ts +0 -7
- package/tsconfig.json +0 -45
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import i18n from "@dhis2/d2-i18n";
|
|
2
|
+
import { CenteredContent, CircularLoader } from "@dhis2/ui";
|
|
3
|
+
import { compact, find, head, set } from "lodash";
|
|
4
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
5
|
+
import { useMapEvents } from "react-leaflet";
|
|
6
|
+
import { MapLayersContext } from "../../../../state";
|
|
7
|
+
import { useMapOrganisationUnit, useMapPeriods } from "../../hooks";
|
|
8
|
+
import { useGoogleEngineLayers, usePointLayer, useThematicLayers } from "./hooks";
|
|
9
|
+
export function MapLayersProvider(_ref) {
|
|
10
|
+
let {
|
|
11
|
+
layers,
|
|
12
|
+
children
|
|
13
|
+
} = _ref;
|
|
14
|
+
const period = useMapPeriods();
|
|
15
|
+
const orgUnit = useMapOrganisationUnit();
|
|
16
|
+
const [updatedLayers, setUpdatedLayers] = useState([]);
|
|
17
|
+
const {
|
|
18
|
+
sanitizeLayers: sanitizeThematicLayers,
|
|
19
|
+
error
|
|
20
|
+
} = useThematicLayers();
|
|
21
|
+
const {
|
|
22
|
+
sanitizeLayer: sanitizePointLayer
|
|
23
|
+
} = usePointLayer();
|
|
24
|
+
const {
|
|
25
|
+
sanitizeLayers: sanitizeEarthEngineLayers
|
|
26
|
+
} = useGoogleEngineLayers();
|
|
27
|
+
const [loading, setLoading] = useState(false);
|
|
28
|
+
useMapEvents({
|
|
29
|
+
overlayremove: event => {
|
|
30
|
+
setupLayerListeners("remove", event);
|
|
31
|
+
},
|
|
32
|
+
overlayadd: event => {
|
|
33
|
+
setupLayerListeners("add", event);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const sanitizeLayers = async () => {
|
|
37
|
+
setLoading(true);
|
|
38
|
+
try {
|
|
39
|
+
const {
|
|
40
|
+
boundaryLayers,
|
|
41
|
+
thematicLayers,
|
|
42
|
+
pointLayers,
|
|
43
|
+
earthEngineLayers
|
|
44
|
+
} = layers;
|
|
45
|
+
const sanitizedThematicLayers = await sanitizeThematicLayers([...(thematicLayers !== null && thematicLayers !== void 0 ? thematicLayers : [])]);
|
|
46
|
+
const sanitizedBoundaryLayers = boundaryLayers !== null && boundaryLayers !== void 0 ? boundaryLayers : [];
|
|
47
|
+
const sanitizedPointLayer = head(pointLayers !== null && pointLayers !== void 0 ? pointLayers : []) ? await sanitizePointLayer(head(pointLayers)) : undefined;
|
|
48
|
+
const sanitizedEarthEngineLayers = await sanitizeEarthEngineLayers([...(earthEngineLayers !== null && earthEngineLayers !== void 0 ? earthEngineLayers : [])]);
|
|
49
|
+
setUpdatedLayers(compact([...(sanitizedBoundaryLayers !== null && sanitizedBoundaryLayers !== void 0 ? sanitizedBoundaryLayers : []), ...(sanitizedThematicLayers !== null && sanitizedThematicLayers !== void 0 ? sanitizedThematicLayers : []), sanitizedPointLayer, ...(sanitizedEarthEngineLayers !== null && sanitizedEarthEngineLayers !== void 0 ? sanitizedEarthEngineLayers : [])]));
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.error(`Error sanitizing layers`, e.toString());
|
|
52
|
+
}
|
|
53
|
+
setLoading(false);
|
|
54
|
+
};
|
|
55
|
+
const updateLayer = useCallback((id, updatedLayer) => {
|
|
56
|
+
setUpdatedLayers(prevLayers => {
|
|
57
|
+
const updatedLayers = [...prevLayers];
|
|
58
|
+
const layerIndex = updatedLayers.findIndex(layer => layer.id === updatedLayer.id);
|
|
59
|
+
if (layerIndex < 0) {
|
|
60
|
+
return prevLayers;
|
|
61
|
+
}
|
|
62
|
+
set(updatedLayers, layerIndex, updatedLayer);
|
|
63
|
+
return updatedLayers;
|
|
64
|
+
});
|
|
65
|
+
}, []);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
sanitizeLayers().catch(console.error);
|
|
68
|
+
}, [period, orgUnit]);
|
|
69
|
+
const setupLayerListeners = (type, event) => {
|
|
70
|
+
const name = event.name;
|
|
71
|
+
const layerConfig = find(updatedLayers, layer => {
|
|
72
|
+
var _ref2, _layer$name, _layer$dataItem;
|
|
73
|
+
const nameFromConfig = (_ref2 = (_layer$name = layer === null || layer === void 0 ? void 0 : layer.name) !== null && _layer$name !== void 0 ? _layer$name : layer === null || layer === void 0 ? void 0 : (_layer$dataItem = layer.dataItem) === null || _layer$dataItem === void 0 ? void 0 : _layer$dataItem.displayname) !== null && _ref2 !== void 0 ? _ref2 : layer === null || layer === void 0 ? void 0 : layer.label;
|
|
74
|
+
return nameFromConfig === name;
|
|
75
|
+
});
|
|
76
|
+
if (layerConfig) {
|
|
77
|
+
updateLayer(layerConfig.id, {
|
|
78
|
+
...layerConfig,
|
|
79
|
+
enabled: type === "add"
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
if (loading) {
|
|
84
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
style: {
|
|
86
|
+
height: "100%",
|
|
87
|
+
width: "100%"
|
|
88
|
+
}
|
|
89
|
+
}, /*#__PURE__*/React.createElement(CenteredContent, null, /*#__PURE__*/React.createElement(CircularLoader, {
|
|
90
|
+
small: true
|
|
91
|
+
})));
|
|
92
|
+
}
|
|
93
|
+
if (error) {
|
|
94
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
style: {
|
|
96
|
+
height: "100%",
|
|
97
|
+
width: "100%"
|
|
98
|
+
}
|
|
99
|
+
}, /*#__PURE__*/React.createElement(CenteredContent, null, /*#__PURE__*/React.createElement("h4", null, i18n.t("Error"), ": ", error.message)));
|
|
100
|
+
}
|
|
101
|
+
return /*#__PURE__*/React.createElement(MapLayersContext.Provider, {
|
|
102
|
+
value: {
|
|
103
|
+
layers: updatedLayers,
|
|
104
|
+
updateLayer
|
|
105
|
+
}
|
|
106
|
+
}, children);
|
|
107
|
+
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {useContext} from "react";
|
|
2
|
-
import {MapLayersContext, MapOrgUnitContext, MapPeriodContext} from "../../../state";
|
|
3
|
-
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { MapLayersContext, MapOrgUnitContext, MapPeriodContext } from "../../../state";
|
|
4
3
|
export function useMapOrganisationUnit() {
|
|
5
4
|
return useContext(MapOrgUnitContext);
|
|
6
5
|
}
|
|
7
|
-
|
|
8
6
|
export function useMapPeriods() {
|
|
9
7
|
return useContext(MapPeriodContext);
|
|
10
8
|
}
|
|
11
|
-
|
|
12
9
|
export function useMapLayers() {
|
|
13
10
|
return useContext(MapLayersContext);
|
|
14
|
-
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { useDataQuery } from "@dhis2/app-runtime";
|
|
2
|
+
import i18n from "@dhis2/d2-i18n";
|
|
3
|
+
import { CenteredContent, CircularLoader } from "@dhis2/ui";
|
|
4
|
+
import { compact, isEmpty } from "lodash";
|
|
5
|
+
import React, { useEffect, useState } from "react";
|
|
6
|
+
import { MapOrgUnitContext, MapPeriodContext } from "../../state";
|
|
7
|
+
import { getOrgUnitsSelection, sanitizeOrgUnits, toGeoJson } from "../../utils/map";
|
|
8
|
+
import { PeriodUtility } from "@hisptz/dhis2-utils";
|
|
9
|
+
const boundaryQuery = {
|
|
10
|
+
boundaries: {
|
|
11
|
+
resource: "geoFeatures",
|
|
12
|
+
params: _ref => {
|
|
13
|
+
let {
|
|
14
|
+
orgUnitIds
|
|
15
|
+
} = _ref;
|
|
16
|
+
return {
|
|
17
|
+
ou: `ou:${orgUnitIds === null || orgUnitIds === void 0 ? void 0 : orgUnitIds.join(";")}`
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
analytics: {
|
|
22
|
+
resource: "analytics",
|
|
23
|
+
params: _ref2 => {
|
|
24
|
+
let {
|
|
25
|
+
orgUnitIds
|
|
26
|
+
} = _ref2;
|
|
27
|
+
return {
|
|
28
|
+
dimension: [`ou:${orgUnitIds.join(";")}`, `pe:${new Date().getFullYear()}`],
|
|
29
|
+
skipData: true,
|
|
30
|
+
hierarchyMeta: true
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
export function MapProvider(_ref3) {
|
|
36
|
+
var _periodSelection$peri;
|
|
37
|
+
let {
|
|
38
|
+
children,
|
|
39
|
+
orgUnitSelection,
|
|
40
|
+
periodSelection
|
|
41
|
+
} = _ref3;
|
|
42
|
+
const [orgUnits, setOrgUnits] = useState([]);
|
|
43
|
+
const {
|
|
44
|
+
refetch,
|
|
45
|
+
loading,
|
|
46
|
+
error
|
|
47
|
+
} = useDataQuery(boundaryQuery, {
|
|
48
|
+
lazy: true
|
|
49
|
+
});
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
async function getOrgUnits() {
|
|
52
|
+
var _ref4;
|
|
53
|
+
const rawOrgUnitIds = getOrgUnitsSelection(orgUnitSelection);
|
|
54
|
+
const data = await refetch({
|
|
55
|
+
orgUnitIds: rawOrgUnitIds
|
|
56
|
+
});
|
|
57
|
+
const {
|
|
58
|
+
analytics,
|
|
59
|
+
boundaries
|
|
60
|
+
} = (_ref4 = data) !== null && _ref4 !== void 0 ? _ref4 : {};
|
|
61
|
+
const rawOrgUnits = sanitizeOrgUnits(analytics === null || analytics === void 0 ? void 0 : analytics.metaData);
|
|
62
|
+
const geoJSONObjects = toGeoJson(boundaries.filter(bound => bound.co));
|
|
63
|
+
const orgUnits = compact(rawOrgUnits.map(orgUnit => {
|
|
64
|
+
const geoJSONObject = geoJSONObjects === null || geoJSONObjects === void 0 ? void 0 : geoJSONObjects.find(geoJSON => geoJSON.properties.id === orgUnit.id);
|
|
65
|
+
if (!geoJSONObject) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
...orgUnit,
|
|
70
|
+
geoJSON: geoJSONObject,
|
|
71
|
+
bounds: [],
|
|
72
|
+
level: geoJSONObject.properties.level
|
|
73
|
+
};
|
|
74
|
+
}));
|
|
75
|
+
setOrgUnits(orgUnits);
|
|
76
|
+
}
|
|
77
|
+
getOrgUnits().catch(error => console.log(error));
|
|
78
|
+
}, [orgUnitSelection, refetch]);
|
|
79
|
+
if (loading) {
|
|
80
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
style: {
|
|
82
|
+
height: "100%",
|
|
83
|
+
width: "100%"
|
|
84
|
+
}
|
|
85
|
+
}, /*#__PURE__*/React.createElement(CenteredContent, null, /*#__PURE__*/React.createElement(CircularLoader, {
|
|
86
|
+
small: true
|
|
87
|
+
})));
|
|
88
|
+
}
|
|
89
|
+
if (error) {
|
|
90
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
style: {
|
|
92
|
+
height: "100%",
|
|
93
|
+
width: "100%"
|
|
94
|
+
}
|
|
95
|
+
}, /*#__PURE__*/React.createElement(CenteredContent, null, /*#__PURE__*/React.createElement("h4", null, i18n.t("Error"), ": ", error.message)));
|
|
96
|
+
}
|
|
97
|
+
const periods = compact(periodSelection === null || periodSelection === void 0 ? void 0 : (_periodSelection$peri = periodSelection.periods) === null || _periodSelection$peri === void 0 ? void 0 : _periodSelection$peri.map(pe => PeriodUtility.getPeriodById(pe)));
|
|
98
|
+
if (!isEmpty(orgUnits)) {
|
|
99
|
+
return /*#__PURE__*/React.createElement(MapOrgUnitContext.Provider, {
|
|
100
|
+
value: {
|
|
101
|
+
orgUnitSelection,
|
|
102
|
+
orgUnits
|
|
103
|
+
}
|
|
104
|
+
}, /*#__PURE__*/React.createElement(MapPeriodContext.Provider, {
|
|
105
|
+
value: {
|
|
106
|
+
...periodSelection,
|
|
107
|
+
periods
|
|
108
|
+
}
|
|
109
|
+
}, children));
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useCenterMap } from "../../hooks/map";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export default function MapUpdater(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
bounds
|
|
6
|
+
} = _ref;
|
|
7
|
+
const ref = useCenterMap({
|
|
8
|
+
bounds
|
|
9
|
+
});
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
style: {
|
|
12
|
+
width: "100%",
|
|
13
|
+
height: "100%"
|
|
14
|
+
},
|
|
15
|
+
ref: ref
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ThematicLayerConfigModal } from "./index";
|
|
2
|
+
import React from "react";
|
|
3
|
+
const Template = args => {
|
|
4
|
+
return /*#__PURE__*/React.createElement(ThematicLayerConfigModal, args);
|
|
5
|
+
};
|
|
6
|
+
export const Basic = Template.bind({});
|
|
7
|
+
Basic.args = {
|
|
8
|
+
onChange: console.info,
|
|
9
|
+
onClose: () => {},
|
|
10
|
+
open: true
|
|
11
|
+
};
|
|
12
|
+
export default {
|
|
13
|
+
title: "Components/Map/Thematic Layer Config Modal",
|
|
14
|
+
component: ThematicLayerConfigModal,
|
|
15
|
+
decorators: [MapStory => {
|
|
16
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
style: {
|
|
18
|
+
width: "50%",
|
|
19
|
+
height: "50%"
|
|
20
|
+
}
|
|
21
|
+
}, /*#__PURE__*/React.createElement(MapStory, null));
|
|
22
|
+
}]
|
|
23
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
import { ThematicLayerConfiguration } from "./index";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { useForm } from "react-hook-form";
|
|
5
|
+
import i18n from "@dhis2/d2-i18n";
|
|
6
|
+
import { Button } from "@dhis2/ui";
|
|
7
|
+
const Template = args => {
|
|
8
|
+
const form = useForm();
|
|
9
|
+
return /*#__PURE__*/React.createElement("form", {
|
|
10
|
+
className: "column gap-16",
|
|
11
|
+
onSubmit: form.handleSubmit(console.log)
|
|
12
|
+
}, /*#__PURE__*/React.createElement(ThematicLayerConfiguration, _extends({}, args, {
|
|
13
|
+
form: form
|
|
14
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
15
|
+
type: "submit"
|
|
16
|
+
}, i18n.t("Submit")));
|
|
17
|
+
};
|
|
18
|
+
export const Basic = Template.bind({});
|
|
19
|
+
Basic.args = {};
|
|
20
|
+
export default {
|
|
21
|
+
title: "Components/Map/Thematic Layer Configuration",
|
|
22
|
+
component: ThematicLayerConfiguration,
|
|
23
|
+
decorators: [MapStory => {
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
style: {
|
|
26
|
+
width: "50%",
|
|
27
|
+
height: "50%"
|
|
28
|
+
}
|
|
29
|
+
}, /*#__PURE__*/React.createElement(MapStory, null));
|
|
30
|
+
}]
|
|
31
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styles from "../../styles/ColorScale.module.css";
|
|
3
|
+
import { COLOR_PALETTES } from "../../constants/colors";
|
|
4
|
+
|
|
5
|
+
// Returns one color scale based on a code and number of classes
|
|
6
|
+
const ColorScale = _ref => {
|
|
7
|
+
var _scale;
|
|
8
|
+
let {
|
|
9
|
+
scale,
|
|
10
|
+
bins,
|
|
11
|
+
width,
|
|
12
|
+
onClick
|
|
13
|
+
} = _ref;
|
|
14
|
+
const colors = COLOR_PALETTES === null || COLOR_PALETTES === void 0 ? void 0 : (_scale = COLOR_PALETTES[scale]) === null || _scale === void 0 ? void 0 : _scale[bins];
|
|
15
|
+
const itemWidth = width ? width / bins : 36;
|
|
16
|
+
return /*#__PURE__*/React.createElement("ul", {
|
|
17
|
+
onClick: () => onClick(scale),
|
|
18
|
+
className: styles.colorScale,
|
|
19
|
+
style: {
|
|
20
|
+
...(width && {
|
|
21
|
+
width
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
}, colors.map((color, index) => /*#__PURE__*/React.createElement("li", {
|
|
25
|
+
key: index,
|
|
26
|
+
className: styles.item,
|
|
27
|
+
style: {
|
|
28
|
+
backgroundColor: color,
|
|
29
|
+
width: itemWidth
|
|
30
|
+
}
|
|
31
|
+
})));
|
|
32
|
+
};
|
|
33
|
+
export default ColorScale;
|