@hisptz/dhis2-analytics 1.0.5 → 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 -431
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.ts +0 -105
- package/src/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.tsx +0 -17
- package/src/components/Map/components/MapLayer/components/LegendArea/index.tsx +0 -168
- package/src/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.tsx +0 -44
- package/src/components/Map/components/MapLayer/components/PointLayer/hooks/index.ts +0 -8
- package/src/components/Map/components/MapLayer/components/PointLayer/index.tsx +0 -36
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.tsx +0 -48
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.tsx +0 -39
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.tsx +0 -57
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.tsx +0 -43
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.tsx +0 -38
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.tsx +0 -26
- package/src/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.ts +0 -10
- package/src/components/Map/components/MapLayer/components/ThematicLayer/index.tsx +0 -46
- package/src/components/Map/components/MapLayer/index.tsx +0 -32
- package/src/components/Map/components/MapLayer/interfaces/index.ts +0 -139
- package/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx +0 -359
- package/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx +0 -105
- package/src/components/Map/components/MapProvider/index.tsx +0 -93
- package/src/components/Map/components/MapUpdater/index.tsx +0 -8
- package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.tsx +0 -28
- package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.tsx +0 -34
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.tsx +0 -24
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.tsx +0 -50
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.ts +0 -91
- package/src/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.tsx +0 -45
- package/src/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.tsx +0 -47
- package/src/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.tsx +0 -57
- package/src/components/Map/components/ThematicLayerConfiguration/index.tsx +0 -248
- package/src/components/Map/constants/legendSet.ts +0 -19
- package/src/components/Map/hooks/map.ts +0 -47
- package/src/components/Map/index.tsx +0 -65
- package/src/components/Map/interfaces/index.ts +0 -57
- package/src/components/Map/state/index.tsx +0 -31
- package/src/components/Map/utils/colors.ts +0 -95
- package/src/components/Map/utils/helpers.ts +0 -15
- package/src/components/Map/utils/map.ts +0 -150
- package/src/components/SingleValueContainer/SingleValueContainer.stories.tsx +0 -146
- package/src/components/SingleValueContainer/SingleValueContainer.test.tsx +0 -24
- package/src/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.tsx +0 -46
- package/src/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.tsx +0 -12
- package/src/components/SingleValueContainer/index.tsx +0 -30
- package/src/components/SingleValueContainer/types/props.tsx +0 -16
- package/src/dataProviders/map.tsx +0 -24
- package/src/index.test.ts +0 -7
- package/tsconfig.json +0 -45
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import {geoJSON, LatLngTuple} from "leaflet";
|
|
2
|
-
import {useEffect, useMemo} from "react";
|
|
3
|
-
import {useMapOrganisationUnit} from "../components/MapProvider/hooks";
|
|
4
|
-
import {useElementSize, useMediaQuery} from "usehooks-ts";
|
|
5
|
-
import {isEmpty} from "lodash";
|
|
6
|
-
import {useMap} from "react-leaflet";
|
|
7
|
-
|
|
8
|
-
export function useMapBounds() {
|
|
9
|
-
const { orgUnits } = useMapOrganisationUnit();
|
|
10
|
-
const geoJSONObject = useMemo(
|
|
11
|
-
() =>
|
|
12
|
-
geoJSON({
|
|
13
|
-
type: "FeatureCollection",
|
|
14
|
-
features: orgUnits?.map((orgUnit) => orgUnit.geoJSON),
|
|
15
|
-
} as any),
|
|
16
|
-
[orgUnits]
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
const center = useMemo(() => {
|
|
20
|
-
return geoJSONObject.getBounds().getCenter();
|
|
21
|
-
}, [orgUnits]);
|
|
22
|
-
const bounds: any = useMemo(() => {
|
|
23
|
-
return geoJSONObject.getBounds();
|
|
24
|
-
}, [orgUnits]);
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
center,
|
|
28
|
-
bounds,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function useCenterMap({ bounds }: { bounds: LatLngTuple[] }) {
|
|
33
|
-
const map = useMap();
|
|
34
|
-
const [ref, { width, height }] = useElementSize();
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (!isEmpty(bounds)) {
|
|
38
|
-
map.fitBounds(bounds);
|
|
39
|
-
}
|
|
40
|
-
}, [width, height]);
|
|
41
|
-
|
|
42
|
-
return ref;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function usePrintMedia() {
|
|
46
|
-
return useMediaQuery("@media print");
|
|
47
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {Map as LeafletMap} from "leaflet";
|
|
2
|
-
import React, {forwardRef} from "react";
|
|
3
|
-
import MapArea from "./components/MapArea";
|
|
4
|
-
import {CustomBoundaryLayer, CustomPointLayer} from "./components/MapLayer/interfaces";
|
|
5
|
-
import {MapProvider} from "./components/MapProvider";
|
|
6
|
-
import {MapProps} from "./interfaces";
|
|
7
|
-
import "leaflet/dist/leaflet.css";
|
|
8
|
-
|
|
9
|
-
const MapComponent = (
|
|
10
|
-
{
|
|
11
|
-
orgUnitSelection,
|
|
12
|
-
pointLayer,
|
|
13
|
-
boundaryLayer,
|
|
14
|
-
thematicLayers,
|
|
15
|
-
earthEngineLayers,
|
|
16
|
-
periodSelection,
|
|
17
|
-
mapOptions,
|
|
18
|
-
key,
|
|
19
|
-
controls,
|
|
20
|
-
legends
|
|
21
|
-
}: MapProps,
|
|
22
|
-
ref: React.Ref<LeafletMap> | undefined
|
|
23
|
-
) => {
|
|
24
|
-
const sanitizedPointLayers: CustomPointLayer[] = [
|
|
25
|
-
{
|
|
26
|
-
type: "point",
|
|
27
|
-
id: "point",
|
|
28
|
-
enabled: pointLayer?.enabled ?? false,
|
|
29
|
-
...pointLayer,
|
|
30
|
-
},
|
|
31
|
-
];
|
|
32
|
-
const sanitizedBoundaryLayers: CustomBoundaryLayer[] = [
|
|
33
|
-
{
|
|
34
|
-
type: "overlay",
|
|
35
|
-
id: "boundary",
|
|
36
|
-
enabled: boundaryLayer?.enabled ?? false,
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<>
|
|
42
|
-
<MapProvider periodSelection={periodSelection} orgUnitSelection={orgUnitSelection}>
|
|
43
|
-
<MapArea
|
|
44
|
-
layers={{
|
|
45
|
-
thematicLayers,
|
|
46
|
-
earthEngineLayers,
|
|
47
|
-
boundaryLayers: sanitizedBoundaryLayers,
|
|
48
|
-
pointLayers: sanitizedPointLayers,
|
|
49
|
-
}}
|
|
50
|
-
legends={legends}
|
|
51
|
-
controls={controls}
|
|
52
|
-
key={key}
|
|
53
|
-
ref={ref}
|
|
54
|
-
mapOptions={mapOptions}
|
|
55
|
-
/>
|
|
56
|
-
</MapProvider>
|
|
57
|
-
</>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
export const Map: React.FC<MapProps> = forwardRef(MapComponent);
|
|
61
|
-
|
|
62
|
-
export * from "./components/EarthEngineLayerConfiguration";
|
|
63
|
-
export * from "./components/ThematicLayerConfiguration";
|
|
64
|
-
export * from "./interfaces";
|
|
65
|
-
export * from "./constants/colors";
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type {OrgUnitSelection} from "@hisptz/dhis2-utils";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import type {MapContainerProps} from "react-leaflet";
|
|
4
|
-
import {MapControls, MapLegendConfig} from "../components/MapArea/interfaces";
|
|
5
|
-
import {EarthEngineLayerConfig, ThematicLayerConfig} from "../components/MapLayer/interfaces";
|
|
6
|
-
|
|
7
|
-
export interface MapProviderProps {
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
orgUnitSelection: OrgUnitSelection;
|
|
10
|
-
periodSelection?: { periods?: string[]; range?: { start: Date; end: Date } };
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface MapProps {
|
|
14
|
-
key?: string;
|
|
15
|
-
orgUnitSelection: OrgUnitSelection; //Organisation unit selection
|
|
16
|
-
pointLayer?: {
|
|
17
|
-
enabled: boolean;
|
|
18
|
-
label?: string;
|
|
19
|
-
level?: number | string;
|
|
20
|
-
group?: string;
|
|
21
|
-
style?: {
|
|
22
|
-
icon?: string;
|
|
23
|
-
groupSet?: string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
boundaryLayer?: {
|
|
27
|
-
enabled: boolean;
|
|
28
|
-
};
|
|
29
|
-
controls?: MapControls[];
|
|
30
|
-
legends?: MapLegendConfig;
|
|
31
|
-
thematicLayers?: ThematicLayerConfig[];
|
|
32
|
-
earthEngineLayers?: EarthEngineLayerConfig[];
|
|
33
|
-
periodSelection?: { periods?: string[]; range?: { start: Date; end: Date } };
|
|
34
|
-
mapOptions?: MapContainerProps;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface MapOrgUnit {
|
|
38
|
-
id: string;
|
|
39
|
-
path: string;
|
|
40
|
-
name: string;
|
|
41
|
-
bounds: any[];
|
|
42
|
-
geoJSON: any;
|
|
43
|
-
children?: MapOrgUnit[];
|
|
44
|
-
level?: number;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface PointOrgUnit {
|
|
48
|
-
id: string;
|
|
49
|
-
path: string;
|
|
50
|
-
name: string;
|
|
51
|
-
bounds: any[];
|
|
52
|
-
geoJSON: any;
|
|
53
|
-
icon: {
|
|
54
|
-
type: "custom" | "groupIcon";
|
|
55
|
-
icon: string;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type {OrgUnitSelection} from "@hisptz/dhis2-utils";
|
|
2
|
-
import {PeriodInterface} from "@iapps/period-utilities";
|
|
3
|
-
import {createContext} from "react";
|
|
4
|
-
import {CustomMapLayer} from "../components/MapLayer/interfaces";
|
|
5
|
-
import {MapOrgUnit} from "../interfaces";
|
|
6
|
-
|
|
7
|
-
export const MapOrgUnitContext = createContext<{
|
|
8
|
-
orgUnitSelection: OrgUnitSelection;
|
|
9
|
-
orgUnits?: MapOrgUnit[];
|
|
10
|
-
}>({
|
|
11
|
-
orgUnitSelection: { orgUnits: [] },
|
|
12
|
-
orgUnits: [],
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const MapPeriodContext = createContext<
|
|
16
|
-
| {
|
|
17
|
-
periods?: PeriodInterface[];
|
|
18
|
-
range?: { start: Date; end: Date };
|
|
19
|
-
}
|
|
20
|
-
| undefined
|
|
21
|
-
>({
|
|
22
|
-
periods: [],
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export const MapLayersContext = createContext<{
|
|
26
|
-
layers: CustomMapLayer[];
|
|
27
|
-
updateLayer: (id: string, updatedLayer: CustomMapLayer) => void;
|
|
28
|
-
}>({
|
|
29
|
-
layers: [],
|
|
30
|
-
updateLayer: () => {},
|
|
31
|
-
});
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import {hcl} from "d3-color";
|
|
2
|
-
import {isString} from "lodash";
|
|
3
|
-
import {COLOR_PALETTES} from "../constants/colors";
|
|
4
|
-
|
|
5
|
-
const colorbrewer: Record<string, any> = COLOR_PALETTES;
|
|
6
|
-
|
|
7
|
-
// Returns a color brewer scale for a number of classes
|
|
8
|
-
export const getColorPalette = (scale: string, classes: number) => {
|
|
9
|
-
return colorbrewer?.[scale]?.[classes];
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const getColorClasses = (palette: string) => {
|
|
13
|
-
return palette?.split(",")?.length;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// Returns color scale name for a palette
|
|
17
|
-
export const getColorScale = (palette: string) => {
|
|
18
|
-
const classes = palette.split(",").length;
|
|
19
|
-
return colorScales.find((name) => colorbrewer[name][classes]?.join(",") === palette);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const defaultColorScaleName = "YlOrBr";
|
|
23
|
-
export const defaultClasses = 5;
|
|
24
|
-
export const defaultColorScale = getColorPalette(defaultColorScaleName, defaultClasses);
|
|
25
|
-
|
|
26
|
-
// Correct colors not adhering to the css standard (add missing #)
|
|
27
|
-
export const cssColor = (color: any) => {
|
|
28
|
-
if (!isString(color)) {
|
|
29
|
-
return color;
|
|
30
|
-
} else if (color === "##normal") {
|
|
31
|
-
// ##normal is used in old map favorites
|
|
32
|
-
return null; // Will apply default color
|
|
33
|
-
}
|
|
34
|
-
return (/(^[0-9A-F]{6}$)|(^[0-9A-F]{3}$)/i.test(color) ? "#" : "") + color;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// Returns an unique color (first from an array, then random but still unique)
|
|
38
|
-
export const getUniqueColor = (defaultColors: any) => {
|
|
39
|
-
const colors = [...defaultColors];
|
|
40
|
-
|
|
41
|
-
function randomColor(): string {
|
|
42
|
-
const color = "#000000".replace(/0/g, () => (~~(Math.random() * 16)).toString(16));
|
|
43
|
-
|
|
44
|
-
// Recursive until color is unique
|
|
45
|
-
if (colors.includes(color)) {
|
|
46
|
-
return randomColor();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
colors.push(color);
|
|
50
|
-
|
|
51
|
-
return color;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return (index: number) => colors[index] || randomColor();
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// Returns true if a color is dark
|
|
58
|
-
export const isDarkColor = (color: string) => hcl(color).l < 70;
|
|
59
|
-
|
|
60
|
-
// Returns constrasting color
|
|
61
|
-
export const getContrastColor = (color: string) => (isDarkColor(color) ? "#fff" : "#000");
|
|
62
|
-
export type LegendColorScale = typeof colorScales[number];
|
|
63
|
-
export const colorScales = [
|
|
64
|
-
"YlOrBr",
|
|
65
|
-
"Reds",
|
|
66
|
-
"YlGn",
|
|
67
|
-
"Greens",
|
|
68
|
-
"Blues",
|
|
69
|
-
"BuPu",
|
|
70
|
-
"RdPu",
|
|
71
|
-
"PuRd",
|
|
72
|
-
"Greys",
|
|
73
|
-
"YlOrBr_reverse",
|
|
74
|
-
"Reds_reverse",
|
|
75
|
-
"YlGn_reverse",
|
|
76
|
-
"Greens_reverse",
|
|
77
|
-
"Blues_reverse",
|
|
78
|
-
"BuPu_reverse",
|
|
79
|
-
"RdPu_reverse",
|
|
80
|
-
"PuRd_reverse",
|
|
81
|
-
"Greys_reverse",
|
|
82
|
-
"PuOr",
|
|
83
|
-
"BrBG",
|
|
84
|
-
"PRGn",
|
|
85
|
-
"PiYG",
|
|
86
|
-
"RdBu",
|
|
87
|
-
"RdGy",
|
|
88
|
-
"RdYlBu",
|
|
89
|
-
"Spectral",
|
|
90
|
-
"RdYlGn",
|
|
91
|
-
"Paired",
|
|
92
|
-
"Pastel1",
|
|
93
|
-
"Set1",
|
|
94
|
-
"Set3",
|
|
95
|
-
];
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Get the longest text length from an object property in an array
|
|
2
|
-
import L from "leaflet";
|
|
3
|
-
|
|
4
|
-
export const getLongestTextLength = (array: Array<any>, key: string | number) =>
|
|
5
|
-
array.reduce((text, curr) => (curr[key] && String(curr[key]).length > text.length ? String(curr[key]) : text), "").length;
|
|
6
|
-
|
|
7
|
-
export function getIconUrl(icon: string, { baseUrl }: { baseUrl: string }) {
|
|
8
|
-
return `${baseUrl}/images/orgunitgroup/${icon ?? "01.png"}`;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function getIcon(url: string): L.Icon | undefined {
|
|
12
|
-
return new L.Icon({
|
|
13
|
-
iconUrl: url,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import type {Legend, OrganisationUnit, OrgUnitSelection} from "@hisptz/dhis2-utils";
|
|
2
|
-
import {LeafletMouseEvent} from "leaflet";
|
|
3
|
-
import {compact, filter, find, forEach, isEmpty, isString, sortBy} from "lodash";
|
|
4
|
-
import {defaultClasses, defaultColorScaleName, getColorPalette} from "./colors";
|
|
5
|
-
|
|
6
|
-
export function highlightFeature(e: LeafletMouseEvent, style: any) {
|
|
7
|
-
const layer = e.target;
|
|
8
|
-
layer.setStyle(style);
|
|
9
|
-
// layer.bringToFront();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function resetHighlight(e: LeafletMouseEvent, defaultStyle: any) {
|
|
13
|
-
const layer = e.target;
|
|
14
|
-
layer.setStyle(defaultStyle);
|
|
15
|
-
// layer.bringToBack();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function getColorFromLegendSet(legends: Legend[], value?: number): string {
|
|
19
|
-
if (!value) {
|
|
20
|
-
return "";
|
|
21
|
-
}
|
|
22
|
-
const legend: any = find(legends ?? [], (legend: any) => legend?.startValue <= value && legend?.endValue >= value) ?? {};
|
|
23
|
-
return legend.color ? legend.color : "transparent";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function getLegendCount(legend: any, data: any) {
|
|
27
|
-
const { startValue, endValue } = legend;
|
|
28
|
-
return filter(data, (d: any) => d.data >= startValue && d.data <= endValue).length;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function getOrgUnitsSelection(orgUnitSelection: OrgUnitSelection) {
|
|
32
|
-
const orgUnits = [];
|
|
33
|
-
if (orgUnitSelection.userOrgUnit) {
|
|
34
|
-
orgUnits.push("USER_ORGUNIT");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (orgUnitSelection.userSubUnit) {
|
|
38
|
-
orgUnits.push("USER_ORGUNIT_CHILDREN");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (orgUnitSelection.userSubX2Unit) {
|
|
42
|
-
orgUnits.push("USER_ORGUNIT_GRANDCHILDREN");
|
|
43
|
-
}
|
|
44
|
-
if (!isEmpty(orgUnitSelection.levels)) {
|
|
45
|
-
forEach(orgUnitSelection.levels, (level) => orgUnits.push(`LEVEL-${level}`));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return [...orgUnits, ...(orgUnitSelection?.orgUnits?.map((ou: OrganisationUnit) => `${ou.id}`) ?? [])];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function sanitizeOrgUnits(metaData: any) {
|
|
52
|
-
if (metaData) {
|
|
53
|
-
return metaData?.dimensions?.ou?.map((ouId: string) => ({
|
|
54
|
-
id: ouId,
|
|
55
|
-
name: metaData?.items[ouId]?.name,
|
|
56
|
-
path: metaData?.ouHierarchy?.[ouId],
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
return [];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function toGeoJson(organisationUnits: any) {
|
|
63
|
-
return sortBy(organisationUnits, "le").map((ou: any) => {
|
|
64
|
-
try {
|
|
65
|
-
const coord = JSON.parse(ou.co);
|
|
66
|
-
let gpid = "";
|
|
67
|
-
let gppg = "";
|
|
68
|
-
let type = "Point";
|
|
69
|
-
|
|
70
|
-
if (ou.ty === 2) {
|
|
71
|
-
type = "Polygon";
|
|
72
|
-
if (ou.co.substring(0, 4) === "[[[[") {
|
|
73
|
-
type = "MultiPolygon";
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Grand parent
|
|
78
|
-
if (isString(ou.pg) && ou.pg.length) {
|
|
79
|
-
const ids = compact(ou.pg.split("/"));
|
|
80
|
-
|
|
81
|
-
// Grand parent id
|
|
82
|
-
if (ids.length >= 2) {
|
|
83
|
-
gpid = ids[ids.length - 2] as string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Grand parent parent graph
|
|
87
|
-
if (ids.length > 2) {
|
|
88
|
-
gppg = "/" + ids.slice(0, ids.length - 2).join("/");
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
type: "Feature",
|
|
94
|
-
id: ou.id,
|
|
95
|
-
geometry: {
|
|
96
|
-
type,
|
|
97
|
-
coordinates: coord,
|
|
98
|
-
},
|
|
99
|
-
properties: {
|
|
100
|
-
type,
|
|
101
|
-
id: ou.id,
|
|
102
|
-
name: ou.na,
|
|
103
|
-
hasCoordinatesDown: ou.hcd,
|
|
104
|
-
hasCoordinatesUp: ou.hcu,
|
|
105
|
-
level: ou.le,
|
|
106
|
-
grandParentParentGraph: gppg,
|
|
107
|
-
grandParentId: gpid,
|
|
108
|
-
parentGraph: ou.pg,
|
|
109
|
-
parentId: ou.pi,
|
|
110
|
-
parentName: ou.pn,
|
|
111
|
-
dimensions: ou.dimensions,
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
} catch (e) {
|
|
115
|
-
return {};
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export function sanitizeDate(startDate: string): string {
|
|
121
|
-
if (startDate?.split("-")?.[0]?.length < 4) {
|
|
122
|
-
return startDate?.split("-")?.reverse()?.join("-");
|
|
123
|
-
}
|
|
124
|
-
return startDate;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export function generateLegends(maxValue: number, minValue: number, { classesCount, colorClass }: { classesCount: number; colorClass: string }): Array<Legend> {
|
|
128
|
-
const count: number = classesCount ?? defaultClasses;
|
|
129
|
-
const color = colorClass ?? defaultColorScaleName;
|
|
130
|
-
|
|
131
|
-
const colorScale = [...getColorPalette(color, count)].reverse();
|
|
132
|
-
|
|
133
|
-
const maxLegendValue = 5 * Math.ceil(maxValue / 5);
|
|
134
|
-
const range = maxLegendValue / count;
|
|
135
|
-
|
|
136
|
-
const values = [];
|
|
137
|
-
let legendColorsIterator = colorScale.length - 1;
|
|
138
|
-
for (let i = 0; i < maxLegendValue; i += range) {
|
|
139
|
-
const id = colorScale[legendColorsIterator];
|
|
140
|
-
values.push({
|
|
141
|
-
startValue: Math.floor(i),
|
|
142
|
-
endValue: Math.floor(i + range),
|
|
143
|
-
id,
|
|
144
|
-
color: id,
|
|
145
|
-
});
|
|
146
|
-
legendColorsIterator--;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return values.reverse();
|
|
150
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import type {Story} from "@storybook/react";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import {SingleValueContainerProps} from "./types/props";
|
|
4
|
-
import {SingleValueContainer} from ".";
|
|
5
|
-
|
|
6
|
-
const Template: Story<SingleValueContainerProps> = (args) => <SingleValueContainer {...args} />;
|
|
7
|
-
|
|
8
|
-
export const Default = Template.bind({});
|
|
9
|
-
Default.args = {
|
|
10
|
-
title: "PRIORITY INDICATORS",
|
|
11
|
-
singleValueItems: [
|
|
12
|
-
{
|
|
13
|
-
label: "Total Bookings",
|
|
14
|
-
value: 136,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
label: "At least one dose",
|
|
18
|
-
value: 45,
|
|
19
|
-
percentage: 23,
|
|
20
|
-
color: "#0D47A1",
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
label: "Partially vaccinated",
|
|
24
|
-
value: 13,
|
|
25
|
-
percentage: 17,
|
|
26
|
-
color: "#0D47A1",
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
label: "Fully vaccinated",
|
|
30
|
-
value: 126,
|
|
31
|
-
percentage: 83,
|
|
32
|
-
color: "#0D47A1",
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
label: "Number of AEFI",
|
|
36
|
-
value: 26,
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const AnimatedAllValues = Template.bind({});
|
|
42
|
-
AnimatedAllValues.args = {
|
|
43
|
-
title: "PRIORITY INDICATORS",
|
|
44
|
-
animationDuration: 1500,
|
|
45
|
-
animationDelay: 500,
|
|
46
|
-
singleValueItems: [
|
|
47
|
-
{
|
|
48
|
-
label: "Total Bookings",
|
|
49
|
-
value: 136344,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
label: "At least one dose",
|
|
53
|
-
value: 4423,
|
|
54
|
-
percentage: 23,
|
|
55
|
-
color: "#0D47A1",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
label: "Partially vaccinated",
|
|
59
|
-
value: 1394,
|
|
60
|
-
percentage: 17,
|
|
61
|
-
color: "#0D47A1",
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
label: "Fully vaccinated",
|
|
65
|
-
value: 12432,
|
|
66
|
-
percentage: 83,
|
|
67
|
-
color: "#0D47A1",
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
label: "Number of AEFI",
|
|
71
|
-
value: 26423,
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const AnimatedSingleValue = Template.bind({});
|
|
77
|
-
AnimatedSingleValue.args = {
|
|
78
|
-
title: "PRIORITY INDICATORS",
|
|
79
|
-
singleValueItems: [
|
|
80
|
-
{
|
|
81
|
-
label: "Total Bookings",
|
|
82
|
-
value: 13634244,
|
|
83
|
-
animationDuration: 1000,
|
|
84
|
-
animationDelay: 100,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
label: "At least one dose",
|
|
88
|
-
value: 45423,
|
|
89
|
-
percentage: 23,
|
|
90
|
-
color: "#0D47A1",
|
|
91
|
-
animationDuration: 1000,
|
|
92
|
-
animationDelay: 600,
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
label: "Partially vaccinated",
|
|
96
|
-
value: 13434,
|
|
97
|
-
percentage: 17,
|
|
98
|
-
color: "#0D47A1",
|
|
99
|
-
animationDuration: 1000,
|
|
100
|
-
animationDelay: 1100,
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
label: "Fully vaccinated",
|
|
104
|
-
value: 126432,
|
|
105
|
-
percentage: 83,
|
|
106
|
-
color: "#0D47A1",
|
|
107
|
-
animationDuration: 1000,
|
|
108
|
-
animationDelay: 1600,
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
label: "Number of AEFI",
|
|
112
|
-
value: 268423,
|
|
113
|
-
animationDuration: 1000,
|
|
114
|
-
animationDelay: 2000,
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export const SingleValuesWithDecimalPlaces = Template.bind({});
|
|
120
|
-
SingleValuesWithDecimalPlaces.args = {
|
|
121
|
-
title: "ENROLLMENTS",
|
|
122
|
-
animationDuration: 1500,
|
|
123
|
-
animationDelay: 500,
|
|
124
|
-
singleValueItems: [
|
|
125
|
-
{
|
|
126
|
-
label: "Number of Enrolled Clients",
|
|
127
|
-
value: 268423,
|
|
128
|
-
decimalPlaces: 3,
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
label: "Number of Served Clients",
|
|
132
|
-
value: 268423,
|
|
133
|
-
decimalPlaces: 1,
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export default {
|
|
139
|
-
title: "Components/Single Value Container",
|
|
140
|
-
component: SingleValueContainer,
|
|
141
|
-
decorators: [
|
|
142
|
-
(SingleValueStory: any) => {
|
|
143
|
-
return <SingleValueStory />;
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {mount} from "@cypress/react";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import {SingleValueContainer} from ".";
|
|
4
|
-
|
|
5
|
-
describe("Single Value Container Tests", () => {
|
|
6
|
-
it("should render", function () {
|
|
7
|
-
const arg = {
|
|
8
|
-
title: "PRIORITY INDICATORS",
|
|
9
|
-
singleValueItems: [
|
|
10
|
-
{
|
|
11
|
-
label: "Total Bookings",
|
|
12
|
-
value: 136,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
label: "At least one dose",
|
|
16
|
-
value: 45,
|
|
17
|
-
percentage: 23,
|
|
18
|
-
color: "#0D47A1",
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
};
|
|
22
|
-
mount(<SingleValueContainer {...arg} />);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {Tooltip} from "@dhis2/ui";
|
|
2
|
-
import {capitalize} from "lodash";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import {animated, useSpring} from "react-spring";
|
|
5
|
-
import styles from "../../styles/SingleValueContainer.module.css";
|
|
6
|
-
import {SingleValue} from "../../types/props";
|
|
7
|
-
import SingleValuePercentage from "./SingleValuePercentage";
|
|
8
|
-
|
|
9
|
-
interface SingleValueProps extends SingleValue {
|
|
10
|
-
globalAnimationDelay?: number;
|
|
11
|
-
globalAnimationDuration?: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default function SingleValueItem({
|
|
15
|
-
label,
|
|
16
|
-
value,
|
|
17
|
-
color,
|
|
18
|
-
percentage,
|
|
19
|
-
animationDuration,
|
|
20
|
-
animationDelay,
|
|
21
|
-
globalAnimationDelay,
|
|
22
|
-
decimalPlaces,
|
|
23
|
-
globalAnimationDuration,
|
|
24
|
-
}: SingleValueProps): React.ReactElement {
|
|
25
|
-
const numberFormatter = (value: number) => Intl.NumberFormat("en-US", { notation: "compact", maximumFractionDigits: decimalPlaces ?? 1 }).format(value);
|
|
26
|
-
|
|
27
|
-
const sanitizedValue = useSpring({
|
|
28
|
-
val: value,
|
|
29
|
-
from: { val: 0 },
|
|
30
|
-
config: { duration: animationDuration ?? globalAnimationDuration ?? 1000 },
|
|
31
|
-
delay: animationDelay ?? globalAnimationDelay ?? 10,
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const tooltipContent = `${label}: ${value}`;
|
|
35
|
-
return (
|
|
36
|
-
<div className={`${styles["single-value-item"]} text-center`}>
|
|
37
|
-
<div className={styles["font-large"]}>{label}</div>
|
|
38
|
-
<Tooltip content={capitalize(tooltipContent)}>
|
|
39
|
-
<animated.div className={`${styles["font-bold"]} ${styles["font-xx-large"]} ${styles["padding-top"]}`}>
|
|
40
|
-
{sanitizedValue.val.to((value) => numberFormatter(Math.floor(value)))}
|
|
41
|
-
</animated.div>
|
|
42
|
-
</Tooltip>
|
|
43
|
-
{percentage ? <SingleValuePercentage color={color} percentage={percentage} /> : <span></span>}
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
}
|
package/src/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.tsx
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {LinearLoader} from "@dhis2/ui";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import styles from "../../styles/SingleValueContainer.module.css";
|
|
4
|
-
|
|
5
|
-
export default function SingleValuePercentage({ percentage, color }: any): React.ReactElement {
|
|
6
|
-
const width = "100%";
|
|
7
|
-
return (
|
|
8
|
-
<div className="w-100">
|
|
9
|
-
<LinearLoader className={styles["percent-value"]} width={width} amount={percentage} />
|
|
10
|
-
</div>
|
|
11
|
-
);
|
|
12
|
-
}
|