@hisptz/dhis2-analytics 2.0.0-alpha.1 → 2.0.0
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/dist/components/ChartAnalytics/ChartAnalytics.stories.js +43 -20
- package/dist/components/ChartAnalytics/DHIS2Chart.js +43 -17
- package/dist/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +16 -14
- package/dist/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +14 -8
- package/dist/components/ChartAnalytics/components/DownloadMenu/index.js +21 -19
- package/dist/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
- package/dist/components/ChartAnalytics/hooks/useChart.js +12 -10
- package/dist/components/ChartAnalytics/index.js +12 -1
- package/dist/components/ChartAnalytics/models/bar.js +6 -3
- package/dist/components/ChartAnalytics/models/column.js +9 -6
- package/dist/components/ChartAnalytics/models/index.js +3 -1
- package/dist/components/ChartAnalytics/models/line.js +8 -6
- package/dist/components/ChartAnalytics/models/multi-series.js +14 -12
- package/dist/components/ChartAnalytics/models/pie.js +7 -5
- package/dist/components/ChartAnalytics/services/export.js +20 -7
- package/dist/components/ChartAnalytics/types/props.js +1 -0
- package/dist/components/ChartAnalytics/utils/chart.js +31 -24
- package/dist/components/CircularProgressDashboard/CircularProgressIndicator.js +23 -14
- package/dist/components/CircularProgressDashboard/CircularProgressIndicator.stories.js +10 -3
- package/dist/components/CircularProgressDashboard/index.js +19 -2
- package/dist/components/CircularProgressDashboard/types/props.js +1 -0
- package/dist/components/DHIS2PivotTable/DHIS2PivotTable.js +15 -13
- package/dist/components/DHIS2PivotTable/DHIS2PivotTable.stories.js +14 -5
- package/dist/components/DHIS2PivotTable/components/Table/index.js +6 -4
- package/dist/components/DHIS2PivotTable/components/TableBody/index.js +31 -25
- package/dist/components/DHIS2PivotTable/components/TableHeaders/index.js +30 -24
- package/dist/components/DHIS2PivotTable/index.js +19 -2
- package/dist/components/DHIS2PivotTable/interfaces/index.js +1 -0
- package/dist/components/DHIS2PivotTable/services/engine.js +12 -10
- package/dist/components/DHIS2PivotTable/state/engine.js +9 -6
- package/dist/components/Map/DHIS2Map.js +20 -13
- package/dist/components/Map/DHIS2Map.stories.js +17 -3
- package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.js +21 -15
- package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +15 -10
- package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.js +18 -16
- package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +12 -7
- package/dist/components/Map/components/EarthEngineLayerConfiguration/components/AggregationSelector.js +30 -24
- package/dist/components/Map/components/EarthEngineLayerConfiguration/components/ColorConfig.js +49 -42
- package/dist/components/Map/components/EarthEngineLayerConfiguration/components/Name.js +22 -16
- package/dist/components/Map/components/EarthEngineLayerConfiguration/components/PeriodSelector.js +32 -26
- package/dist/components/Map/components/EarthEngineLayerConfiguration/components/StylesConfig.js +16 -10
- package/dist/components/Map/components/EarthEngineLayerConfiguration/components/TypeField.js +27 -21
- package/dist/components/Map/components/EarthEngineLayerConfiguration/hooks/data.js +18 -15
- package/dist/components/Map/components/EarthEngineLayerConfiguration/index.js +19 -2
- package/dist/components/Map/components/MapArea/index.js +41 -32
- package/dist/components/Map/components/MapArea/interfaces/index.js +1 -0
- package/dist/components/Map/components/MapControls/components/CustomControl/index.js +5 -3
- package/dist/components/Map/components/MapControls/components/DownloadControl/index.js +14 -8
- package/dist/components/Map/components/MapControls/components/FullscreenControl/index.js +9 -7
- package/dist/components/Map/components/MapControls/index.js +17 -10
- package/dist/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +5 -3
- package/dist/components/Map/components/MapLayer/components/BoundaryLayer/index.js +31 -21
- package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +31 -21
- package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +88 -80
- package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +14 -9
- package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +69 -62
- package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
- package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +3 -1
- package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +41 -19
- package/dist/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +9 -1
- package/dist/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +8 -6
- package/dist/components/Map/components/MapLayer/components/LegendArea/index.js +57 -46
- package/dist/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +31 -25
- package/dist/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +7 -5
- package/dist/components/Map/components/MapLayer/components/PointLayer/index.js +28 -21
- package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +12 -10
- package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js +32 -21
- package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +20 -13
- package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +23 -17
- package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +27 -18
- package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +19 -13
- package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +21 -15
- package/dist/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +8 -6
- package/dist/components/Map/components/MapLayer/components/ThematicLayer/index.js +24 -16
- package/dist/components/Map/components/MapLayer/index.js +18 -10
- package/dist/components/Map/components/MapLayer/interfaces/index.js +3 -1
- package/dist/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +63 -59
- package/dist/components/Map/components/MapProvider/components/MapLayerProvider/index.js +36 -30
- package/dist/components/Map/components/MapProvider/hooks/index.js +10 -6
- package/dist/components/Map/components/MapProvider/index.js +31 -25
- package/dist/components/Map/components/MapUpdater/index.js +7 -5
- package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.js +21 -15
- package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +10 -5
- package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.js +60 -53
- package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +12 -7
- package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +15 -9
- package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js +4 -1
- package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +30 -22
- package/dist/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +18 -7
- package/dist/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +30 -23
- package/dist/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +22 -16
- package/dist/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +22 -16
- package/dist/components/Map/components/ThematicLayerConfiguration/components/RadiusField.js +22 -16
- package/dist/components/Map/components/ThematicLayerConfiguration/components/TypeField.js +24 -18
- package/dist/components/Map/components/ThematicLayerConfiguration/index.js +26 -3
- package/dist/components/Map/components/ThematicLayerConfiguration/types/index.js +1 -0
- package/dist/components/Map/constants/colors.js +4 -1
- package/dist/components/Map/constants/legendSet.js +3 -1
- package/dist/components/Map/hooks/map.js +21 -17
- package/dist/components/Map/index.js +40 -5
- package/dist/components/Map/interfaces/index.js +1 -0
- package/dist/components/Map/state/index.js +9 -5
- package/dist/components/Map/utils/colors.js +19 -7
- package/dist/components/Map/utils/helpers.js +11 -3
- package/dist/components/Map/utils/map.js +23 -13
- package/dist/components/SingleValueContainer/SingleValueContainer.stories.js +11 -3
- package/dist/components/SingleValueContainer/SingleValueVisualizer.js +35 -17
- package/dist/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +21 -14
- package/dist/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +13 -7
- package/dist/components/SingleValueContainer/index.js +26 -3
- package/dist/components/SingleValueContainer/types/props.js +1 -0
- package/dist/components/Visualization/components/AnalyticsDataProvider/index.js +23 -20
- package/dist/components/Visualization/components/DimensionsProvider/index.js +18 -13
- package/dist/components/Visualization/components/LayoutProvider/index.js +11 -7
- package/dist/components/Visualization/components/VisualizationDimensionSelector/index.js +36 -30
- package/dist/components/Visualization/components/VisualizationProvider/index.js +9 -7
- package/dist/components/Visualization/components/VisualizationSelector/index.js +57 -46
- package/dist/components/Visualization/components/VisualizationTypeProvider/index.js +18 -11
- package/dist/components/Visualization/components/VisualizationTypeSelector/index.js +27 -21
- package/dist/components/Visualization/index.js +33 -27
- package/dist/esm/components/ChartAnalytics/ChartAnalytics.stories.js +254 -0
- package/dist/esm/components/ChartAnalytics/ChartAnalytics.stories.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/DHIS2Chart.js +36 -0
- package/dist/esm/components/ChartAnalytics/DHIS2Chart.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +52 -0
- package/dist/esm/components/ChartAnalytics/components/DownloadMenu/components/Menu.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +42 -0
- package/dist/esm/components/ChartAnalytics/components/DownloadMenu/constants/menu.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/components/DownloadMenu/index.js +65 -0
- package/dist/esm/components/ChartAnalytics/components/DownloadMenu/index.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +3 -0
- package/dist/esm/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/hooks/useChart.js +43 -0
- package/dist/esm/components/ChartAnalytics/hooks/useChart.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/index.js +3 -0
- package/dist/esm/components/ChartAnalytics/index.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/models/bar.js +21 -0
- package/dist/esm/components/ChartAnalytics/models/bar.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/models/column.js +48 -0
- package/dist/esm/components/ChartAnalytics/models/column.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/models/index.js +114 -0
- package/dist/esm/components/ChartAnalytics/models/index.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/models/line.js +31 -0
- package/dist/esm/components/ChartAnalytics/models/line.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/models/multi-series.js +112 -0
- package/dist/esm/components/ChartAnalytics/models/multi-series.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/models/pie.js +53 -0
- package/dist/esm/components/ChartAnalytics/models/pie.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/services/export.js +35 -0
- package/dist/esm/components/ChartAnalytics/services/export.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/styles/custom-highchart.css +40 -0
- package/dist/esm/components/ChartAnalytics/styles/custom-highchart.css.map +1 -0
- package/dist/esm/components/ChartAnalytics/types/props.js +3 -0
- package/dist/esm/components/ChartAnalytics/types/props.js.map +1 -0
- package/dist/esm/components/ChartAnalytics/utils/chart.js +130 -0
- package/dist/esm/components/ChartAnalytics/utils/chart.js.map +1 -0
- package/dist/esm/components/CircularProgressDashboard/CircularProgressIndicator.js +66 -0
- package/dist/esm/components/CircularProgressDashboard/CircularProgressIndicator.js.map +1 -0
- package/dist/esm/components/CircularProgressDashboard/CircularProgressIndicator.stories.js +42 -0
- package/dist/esm/components/CircularProgressDashboard/CircularProgressIndicator.stories.js.map +1 -0
- package/dist/esm/components/CircularProgressDashboard/index.js +4 -0
- package/dist/esm/components/CircularProgressDashboard/index.js.map +1 -0
- package/dist/esm/components/CircularProgressDashboard/types/props.js +3 -0
- package/dist/esm/components/CircularProgressDashboard/types/props.js.map +1 -0
- package/dist/esm/components/DHIS2PivotTable/DHIS2PivotTable.js +26 -0
- package/dist/esm/components/DHIS2PivotTable/DHIS2PivotTable.js.map +1 -0
- package/dist/esm/components/DHIS2PivotTable/DHIS2PivotTable.stories.js +30 -0
- package/dist/esm/components/DHIS2PivotTable/DHIS2PivotTable.stories.js.map +1 -0
- package/dist/esm/components/DHIS2PivotTable/components/Table/index.js +10 -0
- package/dist/esm/components/DHIS2PivotTable/components/Table/index.js.map +1 -0
- package/dist/esm/components/DHIS2PivotTable/components/TableBody/TableBody.module.css +11 -0
- package/dist/esm/components/DHIS2PivotTable/components/TableBody/TableBody.module.css.map +1 -0
- package/dist/esm/components/DHIS2PivotTable/components/TableBody/index.js +106 -0
- package/dist/esm/components/DHIS2PivotTable/components/TableBody/index.js.map +1 -0
- package/dist/esm/components/DHIS2PivotTable/components/TableHeaders/TableHeaders.module.css +10 -0
- package/dist/esm/components/DHIS2PivotTable/components/TableHeaders/TableHeaders.module.css.map +1 -0
- package/dist/esm/components/DHIS2PivotTable/components/TableHeaders/index.js +94 -0
- package/dist/esm/components/DHIS2PivotTable/components/TableHeaders/index.js.map +1 -0
- package/dist/esm/components/DHIS2PivotTable/index.js +4 -0
- package/dist/esm/components/DHIS2PivotTable/index.js.map +1 -0
- package/dist/esm/components/DHIS2PivotTable/interfaces/index.js +3 -0
- package/dist/esm/components/DHIS2PivotTable/interfaces/index.js.map +1 -0
- package/dist/esm/components/DHIS2PivotTable/services/engine.js +87 -0
- package/dist/esm/components/DHIS2PivotTable/services/engine.js.map +1 -0
- package/dist/esm/components/DHIS2PivotTable/state/engine.js +17 -0
- package/dist/esm/components/DHIS2PivotTable/state/engine.js.map +1 -0
- package/dist/esm/components/Map/DHIS2Map.js +65 -0
- package/dist/esm/components/Map/DHIS2Map.js.map +1 -0
- package/dist/esm/components/Map/DHIS2Map.stories.js +366 -0
- package/dist/esm/components/Map/DHIS2Map.stories.js.map +1 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.js +41 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.js.map +1 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +34 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js.map +1 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.js +26 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.js.map +1 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +21 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js.map +1 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/AggregationSelector.js +67 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/AggregationSelector.js.map +1 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/ColorConfig.js +134 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/ColorConfig.js.map +1 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/Name.js +44 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/Name.js.map +1 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/PeriodSelector.js +67 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/PeriodSelector.js.map +1 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/StylesConfig.js +24 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/StylesConfig.js.map +1 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/TypeField.js +67 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/TypeField.js.map +1 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/hooks/data.js +45 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/hooks/data.js.map +1 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/index.js +4 -0
- package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapArea/index.js +100 -0
- package/dist/esm/components/Map/components/MapArea/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapArea/interfaces/index.js +3 -0
- package/dist/esm/components/Map/components/MapArea/interfaces/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapControls/components/CustomControl/index.js +16 -0
- package/dist/esm/components/Map/components/MapControls/components/CustomControl/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapControls/components/DownloadControl/index.js +15 -0
- package/dist/esm/components/Map/components/MapControls/components/DownloadControl/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapControls/components/FullscreenControl/index.js +13 -0
- package/dist/esm/components/Map/components/MapControls/components/FullscreenControl/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapControls/index.js +35 -0
- package/dist/esm/components/Map/components/MapControls/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +10 -0
- package/dist/esm/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/BoundaryLayer/index.js +52 -0
- package/dist/esm/components/Map/components/MapLayer/components/BoundaryLayer/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +100 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +457 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +32 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +197 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +3 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +31466 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +365 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +93 -0
- package/dist/esm/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +10 -0
- package/dist/esm/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +17 -0
- package/dist/esm/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/LegendArea/index.js +179 -0
- package/dist/esm/components/Map/components/MapLayer/components/LegendArea/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +92 -0
- package/dist/esm/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +11 -0
- package/dist/esm/components/Map/components/MapLayer/components/PointLayer/hooks/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/PointLayer/index.js +48 -0
- package/dist/esm/components/Map/components/MapLayer/components/PointLayer/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +64 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js +130 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +41 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +50 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +56 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +40 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +40 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +12 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/index.js +55 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +56 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/index.js +32 -0
- package/dist/esm/components/Map/components/MapLayer/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/interfaces/index.js +10 -0
- package/dist/esm/components/Map/components/MapLayer/interfaces/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +405 -0
- package/dist/esm/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapProvider/components/MapLayerProvider/index.js +115 -0
- package/dist/esm/components/Map/components/MapProvider/components/MapLayerProvider/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapProvider/hooks/index.js +16 -0
- package/dist/esm/components/Map/components/MapProvider/hooks/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapProvider/index.js +95 -0
- package/dist/esm/components/Map/components/MapProvider/index.js.map +1 -0
- package/dist/esm/components/Map/components/MapUpdater/index.js +11 -0
- package/dist/esm/components/Map/components/MapUpdater/index.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.js +41 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +24 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.js +174 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +21 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +36 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js +436 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +71 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +15 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +12 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +82 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +57 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +44 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +60 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/RadiusField.js +54 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/RadiusField.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/TypeField.js +63 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/components/TypeField.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/index.js +5 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/index.js.map +1 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/types/index.js +3 -0
- package/dist/esm/components/Map/components/ThematicLayerConfiguration/types/index.js.map +1 -0
- package/dist/esm/components/Map/constants/colors.js +436 -0
- package/dist/esm/components/Map/constants/colors.js.map +1 -0
- package/dist/esm/components/Map/constants/legendSet.js +23 -0
- package/dist/esm/components/Map/constants/legendSet.js.map +1 -0
- package/dist/esm/components/Map/hooks/map.js +44 -0
- package/dist/esm/components/Map/hooks/map.js.map +1 -0
- package/dist/esm/components/Map/index.js +7 -0
- package/dist/esm/components/Map/index.js.map +1 -0
- package/dist/esm/components/Map/interfaces/index.js +3 -0
- package/dist/esm/components/Map/interfaces/index.js.map +1 -0
- package/dist/esm/components/Map/state/index.js +18 -0
- package/dist/esm/components/Map/state/index.js.map +1 -0
- package/dist/esm/components/Map/utils/colors.js +85 -0
- package/dist/esm/components/Map/utils/colors.js.map +1 -0
- package/dist/esm/components/Map/utils/helpers.js +18 -0
- package/dist/esm/components/Map/utils/helpers.js.map +1 -0
- package/dist/esm/components/Map/utils/map.js +138 -0
- package/dist/esm/components/Map/utils/map.js.map +1 -0
- package/dist/esm/components/SingleValueContainer/SingleValueContainer.stories.js +145 -0
- package/dist/esm/components/SingleValueContainer/SingleValueContainer.stories.js.map +1 -0
- package/dist/esm/components/SingleValueContainer/SingleValueVisualizer.js +44 -0
- package/dist/esm/components/SingleValueContainer/SingleValueVisualizer.js.map +1 -0
- package/dist/esm/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +49 -0
- package/dist/esm/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js.map +1 -0
- package/dist/esm/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +22 -0
- package/dist/esm/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js.map +1 -0
- package/dist/esm/components/SingleValueContainer/index.js +5 -0
- package/dist/esm/components/SingleValueContainer/index.js.map +1 -0
- package/dist/esm/components/SingleValueContainer/styles/SingleValueContainer.module.css +32 -0
- package/dist/esm/components/SingleValueContainer/styles/SingleValueContainer.module.css.map +1 -0
- package/dist/esm/components/SingleValueContainer/types/props.js +3 -0
- package/dist/esm/components/SingleValueContainer/types/props.js.map +1 -0
- package/dist/esm/components/Visualization/components/AnalyticsDataProvider/index.js +94 -0
- package/dist/esm/components/Visualization/components/AnalyticsDataProvider/index.js.map +1 -0
- package/dist/esm/components/Visualization/components/DimensionsProvider/index.js +35 -0
- package/dist/esm/components/Visualization/components/DimensionsProvider/index.js.map +1 -0
- package/dist/esm/components/Visualization/components/LayoutProvider/index.js +18 -0
- package/dist/esm/components/Visualization/components/LayoutProvider/index.js.map +1 -0
- package/dist/esm/components/Visualization/components/VisualizationDimensionSelector/index.js +85 -0
- package/dist/esm/components/Visualization/components/VisualizationDimensionSelector/index.js.map +1 -0
- package/dist/esm/components/Visualization/components/VisualizationProvider/index.js +19 -0
- package/dist/esm/components/Visualization/components/VisualizationProvider/index.js.map +1 -0
- package/dist/esm/components/Visualization/components/VisualizationSelector/index.js +167 -0
- package/dist/esm/components/Visualization/components/VisualizationSelector/index.js.map +1 -0
- package/dist/esm/components/Visualization/components/VisualizationTypeProvider/index.js +27 -0
- package/dist/esm/components/Visualization/components/VisualizationTypeProvider/index.js.map +1 -0
- package/dist/esm/components/Visualization/components/VisualizationTypeSelector/index.js +55 -0
- package/dist/esm/components/Visualization/components/VisualizationTypeSelector/index.js.map +1 -0
- package/dist/esm/components/Visualization/index.js +113 -0
- package/dist/esm/components/Visualization/index.js.map +1 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.js +47 -6
- package/package.json +5 -6
package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/ColorConfig.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Controller } from 'react-hook-form';
|
|
3
|
+
import { InputField, SingleSelectField, SingleSelectOption, Field } from '@dhis2/ui';
|
|
4
|
+
import i18n from '@dhis2/d2-i18n';
|
|
5
|
+
import { getColorClasses, getColorScale, defaultClasses, defaultColorScaleName, getColorPalette } from '../../../utils/colors.js';
|
|
6
|
+
import ColorScaleSelect from '../../ThematicLayerConfiguration/components/ColorScaleSelect/index.js';
|
|
7
|
+
|
|
8
|
+
function ColorConfig() {
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", { className: "column gap-16", children: [
|
|
10
|
+
/* @__PURE__ */ jsxs("div", { className: "row gap-8", children: [
|
|
11
|
+
/* @__PURE__ */ jsx(
|
|
12
|
+
Controller,
|
|
13
|
+
{
|
|
14
|
+
render: ({ field, fieldState }) => /* @__PURE__ */ jsx(
|
|
15
|
+
InputField,
|
|
16
|
+
{
|
|
17
|
+
...field,
|
|
18
|
+
error: Boolean(fieldState.error),
|
|
19
|
+
validationText: fieldState.error?.message,
|
|
20
|
+
value: field.value?.toString(),
|
|
21
|
+
onChange: ({ value }) => {
|
|
22
|
+
if (!value)
|
|
23
|
+
return;
|
|
24
|
+
field.onChange(parseInt(value));
|
|
25
|
+
},
|
|
26
|
+
label: i18n.t("Min"),
|
|
27
|
+
type: "number"
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
name: "params.min"
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
Controller,
|
|
35
|
+
{
|
|
36
|
+
render: ({ field, fieldState }) => /* @__PURE__ */ jsx(
|
|
37
|
+
InputField,
|
|
38
|
+
{
|
|
39
|
+
...field,
|
|
40
|
+
error: Boolean(fieldState.error),
|
|
41
|
+
validationText: fieldState.error?.message,
|
|
42
|
+
value: field.value?.toString(),
|
|
43
|
+
onChange: ({ value }) => {
|
|
44
|
+
if (!value)
|
|
45
|
+
return;
|
|
46
|
+
field.onChange(parseInt(value));
|
|
47
|
+
},
|
|
48
|
+
label: i18n.t("Max"),
|
|
49
|
+
type: "number"
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
name: "params.max"
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
Controller,
|
|
57
|
+
{
|
|
58
|
+
name: "params.palette",
|
|
59
|
+
render: ({ field, fieldState }) => {
|
|
60
|
+
const palette = field.value;
|
|
61
|
+
const scale = getColorClasses(palette);
|
|
62
|
+
const colorClass = getColorScale(palette ?? "");
|
|
63
|
+
const onChange = ({
|
|
64
|
+
selected
|
|
65
|
+
}) => {
|
|
66
|
+
const palette2 = getColorPalette(
|
|
67
|
+
colorClass,
|
|
68
|
+
parseInt(selected)
|
|
69
|
+
)?.join(",");
|
|
70
|
+
field.onChange(palette2);
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
SingleSelectField,
|
|
74
|
+
{
|
|
75
|
+
validationText: fieldState.error?.message,
|
|
76
|
+
error: Boolean(fieldState.error),
|
|
77
|
+
selected: scale?.toString() ?? defaultClasses.toString(),
|
|
78
|
+
label: i18n.t("Steps"),
|
|
79
|
+
onChange,
|
|
80
|
+
children: [3, 4, 5, 6, 7, 8, 9].map((value) => /* @__PURE__ */ jsx(
|
|
81
|
+
SingleSelectOption,
|
|
82
|
+
{
|
|
83
|
+
label: `${value}`,
|
|
84
|
+
value: value?.toString()
|
|
85
|
+
},
|
|
86
|
+
`${value}-classes-option`
|
|
87
|
+
))
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
95
|
+
Controller,
|
|
96
|
+
{
|
|
97
|
+
name: "params.palette",
|
|
98
|
+
render: ({ field, fieldState }) => {
|
|
99
|
+
const palette = field.value;
|
|
100
|
+
const scale = getColorClasses(palette);
|
|
101
|
+
const colorClass = getColorScale(palette ?? "");
|
|
102
|
+
const onChange = (colorClass2) => {
|
|
103
|
+
const palette2 = getColorPalette(
|
|
104
|
+
colorClass2,
|
|
105
|
+
scale
|
|
106
|
+
)?.join(",");
|
|
107
|
+
field.onChange(palette2);
|
|
108
|
+
};
|
|
109
|
+
return /* @__PURE__ */ jsx(
|
|
110
|
+
Field,
|
|
111
|
+
{
|
|
112
|
+
error: Boolean(fieldState.error),
|
|
113
|
+
validationText: fieldState.error?.message,
|
|
114
|
+
label: i18n.t("Colors"),
|
|
115
|
+
children: /* @__PURE__ */ jsx(
|
|
116
|
+
ColorScaleSelect,
|
|
117
|
+
{
|
|
118
|
+
count: scale ?? defaultClasses,
|
|
119
|
+
colorClass: colorClass ?? defaultColorScaleName,
|
|
120
|
+
width: 300,
|
|
121
|
+
onChange
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
) })
|
|
129
|
+
] });
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export { ColorConfig };
|
|
133
|
+
//# sourceMappingURL=out.js.map
|
|
134
|
+
//# sourceMappingURL=ColorConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/Map/components/EarthEngineLayerConfiguration/components/ColorConfig.tsx"],"names":["palette","colorClass"],"mappings":"AAqBG,SAGG,KAHH;AArBH,SAAS,kBAAkB;AAC3B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,UAAU;AACjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,sBAAsB;AAGtB,SAAS,cAAc;AAC7B,SACC,qBAAC,SAAI,WAAU,iBACd;AAAA,yBAAC,SAAI,WAAU,aACd;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,QAAQ,CAAC,EAAE,OAAO,WAAW,MAC5B;AAAA,YAAC;AAAA;AAAA,cACC,GAAG;AAAA,cACJ,OAAO,QAAQ,WAAW,KAAK;AAAA,cAC/B,gBAAgB,WAAW,OAAO;AAAA,cAClC,OAAO,MAAM,OAAO,SAAS;AAAA,cAC7B,UAAU,CAAC,EAAE,MAAM,MAA0B;AAC5C,oBAAI,CAAC;AAAO;AACZ,sBAAM,SAAS,SAAS,KAAK,CAAC;AAAA,cAC/B;AAAA,cACA,OAAO,KAAK,EAAE,KAAK;AAAA,cACnB,MAAK;AAAA;AAAA,UACN;AAAA,UAED,MAAM;AAAA;AAAA,MACP;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,QAAQ,CAAC,EAAE,OAAO,WAAW,MAC5B;AAAA,YAAC;AAAA;AAAA,cACC,GAAG;AAAA,cACJ,OAAO,QAAQ,WAAW,KAAK;AAAA,cAC/B,gBAAgB,WAAW,OAAO;AAAA,cAClC,OAAO,MAAM,OAAO,SAAS;AAAA,cAC7B,UAAU,CAAC,EAAE,MAAM,MAA0B;AAC5C,oBAAI,CAAC;AAAO;AACZ,sBAAM,SAAS,SAAS,KAAK,CAAC;AAAA,cAC/B;AAAA,cACA,OAAO,KAAK,EAAE,KAAK;AAAA,cACnB,MAAK;AAAA;AAAA,UACN;AAAA,UAED,MAAM;AAAA;AAAA,MACP;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,MAAK;AAAA,UACL,QAAQ,CAAC,EAAE,OAAO,WAAW,MAAM;AAClC,kBAAM,UAAU,MAAM;AACtB,kBAAM,QAAQ,gBAAgB,OAAO;AACrC,kBAAM,aAAa,cAAc,WAAW,EAAE;AAE9C,kBAAM,WAAW,CAAC;AAAA,cACjB;AAAA,YACD,MAEM;AACL,oBAAMA,WAAU;AAAA,gBACf;AAAA,gBACA,SAAS,QAAQ;AAAA,cAClB,GAAG,KAAK,GAAG;AACX,oBAAM,SAASA,QAAO;AAAA,YACvB;AAEA,mBACC;AAAA,cAAC;AAAA;AAAA,gBACA,gBAAgB,WAAW,OAAO;AAAA,gBAClC,OAAO,QAAQ,WAAW,KAAK;AAAA,gBAC/B,UACC,OAAO,SAAS,KAChB,eAAe,SAAS;AAAA,gBAEzB,OAAO,KAAK,EAAE,OAAO;AAAA,gBACrB;AAAA,gBAEC,WAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,EAAE,IAAI,CAAC,UAC3B;AAAA,kBAAC;AAAA;AAAA,oBAEA,OAAO,GAAG,KAAK;AAAA,oBACf,OAAO,OAAO,SAAS;AAAA;AAAA,kBAFlB,GAAG,KAAK;AAAA,gBAGd,CACA;AAAA;AAAA,YACF;AAAA,UAEF;AAAA;AAAA,MACD;AAAA,OACD;AAAA,IACA,oBAAC,SACA;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,QAAQ,CAAC,EAAE,OAAO,WAAW,MAAM;AAClC,gBAAM,UAAU,MAAM;AACtB,gBAAM,QAAQ,gBAAgB,OAAO;AACrC,gBAAM,aAAa,cAAc,WAAW,EAAE;AAE9C,gBAAM,WAAW,CAACC,gBAAuB;AACxC,kBAAMD,WAAU;AAAA,cACfC;AAAA,cACA;AAAA,YACD,GAAG,KAAK,GAAG;AACX,kBAAM,SAASD,QAAO;AAAA,UACvB;AAEA,iBACC;AAAA,YAAC;AAAA;AAAA,cACA,OAAO,QAAQ,WAAW,KAAK;AAAA,cAC/B,gBAAgB,WAAW,OAAO;AAAA,cAClC,OAAO,KAAK,EAAE,QAAQ;AAAA,cAEtB;AAAA,gBAAC;AAAA;AAAA,kBACA,OAAO,SAAS;AAAA,kBAChB,YACC,cAAc;AAAA,kBAEf,OAAO;AAAA,kBACP;AAAA;AAAA,cACD;AAAA;AAAA,UACD;AAAA,QAEF;AAAA;AAAA,IACD,GACD;AAAA,KACD;AAEF","sourcesContent":["import { Controller } from \"react-hook-form\";\nimport {\n\tField,\n\tInputField,\n\tSingleSelectField,\n\tSingleSelectOption,\n} from \"@dhis2/ui\";\nimport i18n from \"@dhis2/d2-i18n\";\nimport {\n\tdefaultClasses,\n\tdefaultColorScaleName,\n\tgetColorClasses,\n\tgetColorPalette,\n\tgetColorScale,\n} from \"../../../utils/colors.js\";\nimport ColorScaleSelect from \"../../ThematicLayerConfiguration/components/ColorScaleSelect/index.js\";\nimport React from \"react\";\n\nexport function ColorConfig() {\n\treturn (\n\t\t<div className=\"column gap-16\">\n\t\t\t<div className=\"row gap-8\">\n\t\t\t\t<Controller\n\t\t\t\t\trender={({ field, fieldState }) => (\n\t\t\t\t\t\t<InputField\n\t\t\t\t\t\t\t{...field}\n\t\t\t\t\t\t\terror={Boolean(fieldState.error)}\n\t\t\t\t\t\t\tvalidationText={fieldState.error?.message}\n\t\t\t\t\t\t\tvalue={field.value?.toString()}\n\t\t\t\t\t\t\tonChange={({ value }: { value?: string }) => {\n\t\t\t\t\t\t\t\tif (!value) return;\n\t\t\t\t\t\t\t\tfield.onChange(parseInt(value));\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tlabel={i18n.t(\"Min\")}\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\tname={\"params.min\"}\n\t\t\t\t/>\n\t\t\t\t<Controller\n\t\t\t\t\trender={({ field, fieldState }) => (\n\t\t\t\t\t\t<InputField\n\t\t\t\t\t\t\t{...field}\n\t\t\t\t\t\t\terror={Boolean(fieldState.error)}\n\t\t\t\t\t\t\tvalidationText={fieldState.error?.message}\n\t\t\t\t\t\t\tvalue={field.value?.toString()}\n\t\t\t\t\t\t\tonChange={({ value }: { value?: string }) => {\n\t\t\t\t\t\t\t\tif (!value) return;\n\t\t\t\t\t\t\t\tfield.onChange(parseInt(value));\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tlabel={i18n.t(\"Max\")}\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\tname={\"params.max\"}\n\t\t\t\t/>\n\t\t\t\t<Controller\n\t\t\t\t\tname=\"params.palette\"\n\t\t\t\t\trender={({ field, fieldState }) => {\n\t\t\t\t\t\tconst palette = field.value;\n\t\t\t\t\t\tconst scale = getColorClasses(palette);\n\t\t\t\t\t\tconst colorClass = getColorScale(palette ?? \"\");\n\n\t\t\t\t\t\tconst onChange = ({\n\t\t\t\t\t\t\tselected,\n\t\t\t\t\t\t}: {\n\t\t\t\t\t\t\tselected: string;\n\t\t\t\t\t\t}) => {\n\t\t\t\t\t\t\tconst palette = getColorPalette(\n\t\t\t\t\t\t\t\tcolorClass as string,\n\t\t\t\t\t\t\t\tparseInt(selected),\n\t\t\t\t\t\t\t)?.join(\",\");\n\t\t\t\t\t\t\tfield.onChange(palette);\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<SingleSelectField\n\t\t\t\t\t\t\t\tvalidationText={fieldState.error?.message}\n\t\t\t\t\t\t\t\terror={Boolean(fieldState.error)}\n\t\t\t\t\t\t\t\tselected={\n\t\t\t\t\t\t\t\t\tscale?.toString() ??\n\t\t\t\t\t\t\t\t\tdefaultClasses.toString()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlabel={i18n.t(\"Steps\")}\n\t\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{[3, 4, 5, 6, 7, 8, 9].map((value) => (\n\t\t\t\t\t\t\t\t\t<SingleSelectOption\n\t\t\t\t\t\t\t\t\t\tkey={`${value}-classes-option`}\n\t\t\t\t\t\t\t\t\t\tlabel={`${value}`}\n\t\t\t\t\t\t\t\t\t\tvalue={value?.toString()}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</SingleSelectField>\n\t\t\t\t\t\t);\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<Controller\n\t\t\t\t\tname=\"params.palette\"\n\t\t\t\t\trender={({ field, fieldState }) => {\n\t\t\t\t\t\tconst palette = field.value;\n\t\t\t\t\t\tconst scale = getColorClasses(palette);\n\t\t\t\t\t\tconst colorClass = getColorScale(palette ?? \"\");\n\n\t\t\t\t\t\tconst onChange = (colorClass: string) => {\n\t\t\t\t\t\t\tconst palette = getColorPalette(\n\t\t\t\t\t\t\t\tcolorClass,\n\t\t\t\t\t\t\t\tscale,\n\t\t\t\t\t\t\t)?.join(\",\");\n\t\t\t\t\t\t\tfield.onChange(palette);\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Field\n\t\t\t\t\t\t\t\terror={Boolean(fieldState.error)}\n\t\t\t\t\t\t\t\tvalidationText={fieldState.error?.message}\n\t\t\t\t\t\t\t\tlabel={i18n.t(\"Colors\")}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ColorScaleSelect\n\t\t\t\t\t\t\t\t\tcount={scale ?? defaultClasses}\n\t\t\t\t\t\t\t\t\tcolorClass={\n\t\t\t\t\t\t\t\t\t\tcolorClass ?? defaultColorScaleName\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\twidth={300}\n\t\t\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Field>\n\t\t\t\t\t\t);\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useFormContext, Controller } from 'react-hook-form';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import i18n from '@dhis2/d2-i18n';
|
|
5
|
+
import { InputField } from '@dhis2/ui';
|
|
6
|
+
import { useType } from '../hooks/data.js';
|
|
7
|
+
|
|
8
|
+
function Name() {
|
|
9
|
+
const config = useType();
|
|
10
|
+
const { setValue } = useFormContext();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setValue("name", config?.name);
|
|
13
|
+
setValue("id", config?.id);
|
|
14
|
+
}, [config]);
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
Controller,
|
|
17
|
+
{
|
|
18
|
+
name: "name",
|
|
19
|
+
rules: {
|
|
20
|
+
required: i18n.t("Name is required")
|
|
21
|
+
},
|
|
22
|
+
render: ({ field, fieldState }) => /* @__PURE__ */ jsx(
|
|
23
|
+
InputField,
|
|
24
|
+
{
|
|
25
|
+
label: i18n.t("Layer name"),
|
|
26
|
+
type: "text",
|
|
27
|
+
required: true,
|
|
28
|
+
error: Boolean(fieldState.error),
|
|
29
|
+
validationText: fieldState.error?.message,
|
|
30
|
+
onChange: ({ value }) => {
|
|
31
|
+
if (!value)
|
|
32
|
+
return;
|
|
33
|
+
field.onChange(value);
|
|
34
|
+
},
|
|
35
|
+
value: field.value
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { Name };
|
|
43
|
+
//# sourceMappingURL=out.js.map
|
|
44
|
+
//# sourceMappingURL=Name.js.map
|
package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/Name.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/Map/components/EarthEngineLayerConfiguration/components/Name.tsx"],"names":[],"mappings":"AAqBI;AArBJ,SAAS,YAAY,sBAAsB;AAC3C,SAAgB,iBAAiB;AACjC,OAAO,UAAU;AACjB,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AAEjB,SAAS,OAAO;AACtB,QAAM,SAAS,QAAQ;AACvB,QAAM,EAAE,SAAS,IAAI,eAAe;AACpC,YAAU,MAAM;AACf,aAAS,QAAQ,QAAQ,IAAI;AAC7B,aAAS,MAAM,QAAQ,EAAE;AAAA,EAC1B,GAAG,CAAC,MAAM,CAAC;AAEX,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAK;AAAA,MACL,OAAO;AAAA,QACN,UAAU,KAAK,EAAE,kBAAkB;AAAA,MACpC;AAAA,MACA,QAAQ,CAAC,EAAE,OAAO,WAAW,MAC5B;AAAA,QAAC;AAAA;AAAA,UACA,OAAO,KAAK,EAAE,YAAY;AAAA,UAC1B,MAAK;AAAA,UACL,UAAQ;AAAA,UACR,OAAO,QAAQ,WAAW,KAAK;AAAA,UAC/B,gBAAgB,WAAW,OAAO;AAAA,UAClC,UAAU,CAAC,EAAE,MAAM,MAA0B;AAC5C,gBAAI,CAAC;AAAO;AACZ,kBAAM,SAAS,KAAK;AAAA,UACrB;AAAA,UACA,OAAO,MAAM;AAAA;AAAA,MACd;AAAA;AAAA,EAEF;AAEF","sourcesContent":["import { Controller, useFormContext } from \"react-hook-form\";\nimport React, { useEffect } from \"react\";\nimport i18n from \"@dhis2/d2-i18n\";\nimport { InputField } from \"@dhis2/ui\";\nimport { useType } from \"../hooks/data.js\";\n\nexport function Name() {\n\tconst config = useType();\n\tconst { setValue } = useFormContext();\n\tuseEffect(() => {\n\t\tsetValue(\"name\", config?.name);\n\t\tsetValue(\"id\", config?.id);\n\t}, [config]);\n\n\treturn (\n\t\t<Controller\n\t\t\tname=\"name\"\n\t\t\trules={{\n\t\t\t\trequired: i18n.t(\"Name is required\"),\n\t\t\t}}\n\t\t\trender={({ field, fieldState }) => (\n\t\t\t\t<InputField\n\t\t\t\t\tlabel={i18n.t(\"Layer name\")}\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\trequired\n\t\t\t\t\terror={Boolean(fieldState.error)}\n\t\t\t\t\tvalidationText={fieldState.error?.message}\n\t\t\t\t\tonChange={({ value }: { value?: string }) => {\n\t\t\t\t\t\tif (!value) return;\n\t\t\t\t\t\tfield.onChange(value);\n\t\t\t\t\t}}\n\t\t\t\t\tvalue={field.value}\n\t\t\t\t/>\n\t\t\t)}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useFormContext, Controller } from 'react-hook-form';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { isEmpty, head } from 'lodash';
|
|
5
|
+
import { Center, SingleSelectField, SingleSelectOption, CircularLoader } from '@dhis2/ui';
|
|
6
|
+
import i18n from '@dhis2/d2-i18n';
|
|
7
|
+
import { useType, useDatasetInfo } from '../hooks/data.js';
|
|
8
|
+
|
|
9
|
+
function PeriodSelector() {
|
|
10
|
+
const config = useType();
|
|
11
|
+
const { setValue, getValues } = useFormContext();
|
|
12
|
+
const filters = config?.filters ?? [];
|
|
13
|
+
const hasPeriodFilter = filters.includes("period");
|
|
14
|
+
const { loading, error, periods } = useDatasetInfo(hasPeriodFilter, config);
|
|
15
|
+
const initialPeriod = getValues("filters.period");
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (!isEmpty(periods) && !initialPeriod) {
|
|
18
|
+
setValue("filters.period", head(periods));
|
|
19
|
+
}
|
|
20
|
+
}, [periods]);
|
|
21
|
+
if (!hasPeriodFilter) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
if (error) {
|
|
25
|
+
return /* @__PURE__ */ jsx("div", { style: { minWidth: "100%", minHeight: 100 }, children: /* @__PURE__ */ jsx(Center, { children: /* @__PURE__ */ jsx("p", { children: error?.message ?? error?.toString() }) }) });
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
Controller,
|
|
29
|
+
{
|
|
30
|
+
name: "filters.period",
|
|
31
|
+
rules: {
|
|
32
|
+
required: i18n.t("Period is required")
|
|
33
|
+
},
|
|
34
|
+
render: ({ field, fieldState }) => /* @__PURE__ */ jsxs("div", { style: { gap: 4 }, className: "row align-items-center", children: [
|
|
35
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1 }, children: /* @__PURE__ */ jsx(
|
|
36
|
+
SingleSelectField,
|
|
37
|
+
{
|
|
38
|
+
helpText: i18n.t(
|
|
39
|
+
"Available periods are set by the source data"
|
|
40
|
+
),
|
|
41
|
+
loading,
|
|
42
|
+
filterable: true,
|
|
43
|
+
label: i18n.t("Period"),
|
|
44
|
+
required: true,
|
|
45
|
+
error: Boolean(fieldState.error),
|
|
46
|
+
validationText: fieldState.error?.message,
|
|
47
|
+
onChange: ({ selected }) => field.onChange(parseInt(selected)),
|
|
48
|
+
selected: periods?.includes(field.value) ? field.value?.toString() : void 0,
|
|
49
|
+
children: periods?.map((period) => /* @__PURE__ */ jsx(
|
|
50
|
+
SingleSelectOption,
|
|
51
|
+
{
|
|
52
|
+
value: period.toString(),
|
|
53
|
+
label: period.toString()
|
|
54
|
+
},
|
|
55
|
+
`${period}-option`
|
|
56
|
+
))
|
|
57
|
+
}
|
|
58
|
+
) }),
|
|
59
|
+
loading && /* @__PURE__ */ jsx(CircularLoader, { extrasmall: true })
|
|
60
|
+
] })
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { PeriodSelector };
|
|
66
|
+
//# sourceMappingURL=out.js.map
|
|
67
|
+
//# sourceMappingURL=PeriodSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/Map/components/EarthEngineLayerConfiguration/components/PeriodSelector.tsx"],"names":[],"mappings":"AAkCK,cAaD,YAbC;AAlCL,SAAS,YAAY,sBAAsB;AAC3C,SAAgB,iBAAiB;AACjC,SAAS,MAAM,eAAe;AAC9B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,UAAU;AACjB,SAAS,gBAAgB,eAAe;AAEjC,SAAS,iBAAiB;AAChC,QAAM,SAAS,QAAQ;AACvB,QAAM,EAAE,UAAU,UAAU,IAAI,eAAe;AAC/C,QAAM,UAAU,QAAQ,WAAW,CAAC;AACpC,QAAM,kBAAkB,QAAQ,SAAS,QAAQ;AACjD,QAAM,EAAE,SAAS,OAAO,QAAQ,IAAI,eAAe,iBAAiB,MAAM;AAC1E,QAAM,gBAAgB,UAAU,gBAAgB;AAEhD,YAAU,MAAM;AACf,QAAI,CAAC,QAAQ,OAAO,KAAK,CAAC,eAAe;AACxC,eAAS,kBAAkB,KAAK,OAAO,CAAC;AAAA,IACzC;AAAA,EACD,GAAG,CAAC,OAAO,CAAC;AAEZ,MAAI,CAAC,iBAAiB;AACrB,WAAO;AAAA,EACR;AAEA,MAAI,OAAO;AACV,WACC,oBAAC,SAAI,OAAO,EAAE,UAAU,QAAQ,WAAW,IAAI,GAC9C,8BAAC,UACA,8BAAC,OAAG,iBAAO,WAAW,OAAO,SAAS,GAAE,GACzC,GACD;AAAA,EAEF;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAK;AAAA,MACL,OAAO;AAAA,QACN,UAAU,KAAK,EAAE,oBAAoB;AAAA,MACtC;AAAA,MACA,QAAQ,CAAC,EAAE,OAAO,WAAW,MAC5B,qBAAC,SAAI,OAAO,EAAE,KAAK,EAAE,GAAG,WAAU,0BACjC;AAAA,4BAAC,SAAI,OAAO,EAAE,MAAM,EAAE,GACrB;AAAA,UAAC;AAAA;AAAA,YACA,UAAU,KAAK;AAAA,cACd;AAAA,YACD;AAAA,YACA;AAAA,YACA,YAAU;AAAA,YACV,OAAO,KAAK,EAAE,QAAQ;AAAA,YACtB,UAAQ;AAAA,YACR,OAAO,QAAQ,WAAW,KAAK;AAAA,YAC/B,gBAAgB,WAAW,OAAO;AAAA,YAClC,UAAU,CAAC,EAAE,SAAS,MACrB,MAAM,SAAS,SAAS,QAAQ,CAAC;AAAA,YAElC,UACC,SAAS,SAAS,MAAM,KAAK,IAC1B,MAAM,OAAO,SAAS,IACtB;AAAA,YAGH,mBAAS,IAAI,CAAC,WACd;AAAA,cAAC;AAAA;AAAA,gBAEA,OAAO,OAAO,SAAS;AAAA,gBACvB,OAAO,OAAO,SAAS;AAAA;AAAA,cAFlB,GAAG,MAAM;AAAA,YAGf,CACA;AAAA;AAAA,QACF,GACD;AAAA,QACC,WAAW,oBAAC,kBAAe,YAAU,MAAC;AAAA,SACxC;AAAA;AAAA,EAEF;AAEF","sourcesContent":["import { Controller, useFormContext } from \"react-hook-form\";\nimport React, { useEffect } from \"react\";\nimport { head, isEmpty } from \"lodash\";\nimport {\n\tCenter,\n\tCircularLoader,\n\tSingleSelectField,\n\tSingleSelectOption,\n} from \"@dhis2/ui\";\nimport i18n from \"@dhis2/d2-i18n\";\nimport { useDatasetInfo, useType } from \"../hooks/data.js\";\n\nexport function PeriodSelector() {\n\tconst config = useType();\n\tconst { setValue, getValues } = useFormContext();\n\tconst filters = config?.filters ?? [];\n\tconst hasPeriodFilter = filters.includes(\"period\");\n\tconst { loading, error, periods } = useDatasetInfo(hasPeriodFilter, config);\n\tconst initialPeriod = getValues(\"filters.period\");\n\n\tuseEffect(() => {\n\t\tif (!isEmpty(periods) && !initialPeriod) {\n\t\t\tsetValue(\"filters.period\", head(periods));\n\t\t}\n\t}, [periods]);\n\n\tif (!hasPeriodFilter) {\n\t\treturn null;\n\t}\n\n\tif (error) {\n\t\treturn (\n\t\t\t<div style={{ minWidth: \"100%\", minHeight: 100 }}>\n\t\t\t\t<Center>\n\t\t\t\t\t<p>{error?.message ?? error?.toString()}</p>\n\t\t\t\t</Center>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Controller\n\t\t\tname=\"filters.period\"\n\t\t\trules={{\n\t\t\t\trequired: i18n.t(\"Period is required\"),\n\t\t\t}}\n\t\t\trender={({ field, fieldState }) => (\n\t\t\t\t<div style={{ gap: 4 }} className=\"row align-items-center\">\n\t\t\t\t\t<div style={{ flex: 1 }}>\n\t\t\t\t\t\t<SingleSelectField\n\t\t\t\t\t\t\thelpText={i18n.t(\n\t\t\t\t\t\t\t\t\"Available periods are set by the source data\",\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tloading={loading}\n\t\t\t\t\t\t\tfilterable\n\t\t\t\t\t\t\tlabel={i18n.t(\"Period\")}\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\terror={Boolean(fieldState.error)}\n\t\t\t\t\t\t\tvalidationText={fieldState.error?.message}\n\t\t\t\t\t\t\tonChange={({ selected }: { selected: string }) =>\n\t\t\t\t\t\t\t\tfield.onChange(parseInt(selected))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tselected={\n\t\t\t\t\t\t\t\tperiods?.includes(field.value)\n\t\t\t\t\t\t\t\t\t? field.value?.toString()\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{periods?.map((period: number) => (\n\t\t\t\t\t\t\t\t<SingleSelectOption\n\t\t\t\t\t\t\t\t\tkey={`${period}-option`}\n\t\t\t\t\t\t\t\t\tvalue={period.toString()}\n\t\t\t\t\t\t\t\t\tlabel={period.toString()}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</SingleSelectField>\n\t\t\t\t\t</div>\n\t\t\t\t\t{loading && <CircularLoader extrasmall />}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t/>\n\t);\n}\n"]}
|
package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/StylesConfig.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import i18n from '@dhis2/d2-i18n';
|
|
3
|
+
import { ColorConfig } from './ColorConfig.js';
|
|
4
|
+
import { useType } from '../hooks/data.js';
|
|
5
|
+
|
|
6
|
+
function StylesConfig() {
|
|
7
|
+
const config = useType();
|
|
8
|
+
const hasParams = Boolean(config?.params);
|
|
9
|
+
if (!hasParams) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return /* @__PURE__ */ jsx("div", { style: { minWidth: 200, minHeight: 100 }, className: "row gap-16", children: /* @__PURE__ */ jsxs("div", { className: "column", children: [
|
|
13
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
14
|
+
i18n.t("Unit"),
|
|
15
|
+
": ",
|
|
16
|
+
config?.unit
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ jsx(ColorConfig, {})
|
|
19
|
+
] }) });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { StylesConfig };
|
|
23
|
+
//# sourceMappingURL=out.js.map
|
|
24
|
+
//# sourceMappingURL=StylesConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/Map/components/EarthEngineLayerConfiguration/components/StylesConfig.tsx"],"names":[],"mappings":"AAgBI,SAGA,KAHA;AAhBJ,OAAO,UAAU;AACjB,SAAS,mBAAmB;AAE5B,SAAS,eAAe;AAEjB,SAAS,eAAe;AAC9B,QAAM,SAAS,QAAQ;AACvB,QAAM,YAAY,QAAQ,QAAQ,MAAM;AAExC,MAAI,CAAC,WAAW;AACf,WAAO;AAAA,EACR;AAEA,SACC,oBAAC,SAAI,OAAO,EAAE,UAAU,KAAK,WAAW,IAAI,GAAG,WAAU,cACxD,+BAAC,SAAI,WAAU,UACd;AAAA,yBAAC,OACC;AAAA,WAAK,EAAE,MAAM;AAAA,MAAE;AAAA,MAAG,QAAQ;AAAA,OAC5B;AAAA,IACA,oBAAC,eAAY;AAAA,KACd,GACD;AAEF","sourcesContent":["import i18n from \"@dhis2/d2-i18n\";\nimport { ColorConfig } from \"./ColorConfig.js\";\nimport React from \"react\";\nimport { useType } from \"../hooks/data.js\";\n\nexport function StylesConfig() {\n\tconst config = useType();\n\tconst hasParams = Boolean(config?.params);\n\n\tif (!hasParams) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div style={{ minWidth: 200, minHeight: 100 }} className=\"row gap-16\">\n\t\t\t<div className=\"column\">\n\t\t\t\t<p>\n\t\t\t\t\t{i18n.t(\"Unit\")}: {config?.unit}\n\t\t\t\t</p>\n\t\t\t\t<ColorConfig />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/TypeField.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { filter, find } from 'lodash';
|
|
3
|
+
import { EARTH_ENGINE_LAYERS, SUPPORTED_EARTH_ENGINE_LAYERS } from '../../MapLayer/components/GoogleEngineLayer/constants/index.js';
|
|
4
|
+
import { useFormContext, Controller } from 'react-hook-form';
|
|
5
|
+
import i18n from '@dhis2/d2-i18n';
|
|
6
|
+
import { SingleSelectField, SingleSelectOption } from '@dhis2/ui';
|
|
7
|
+
|
|
8
|
+
function TypeField({ excluded }) {
|
|
9
|
+
const supportedLayers = filter(
|
|
10
|
+
EARTH_ENGINE_LAYERS,
|
|
11
|
+
({ id }) => SUPPORTED_EARTH_ENGINE_LAYERS.includes(id) && !(excluded?.includes(id) ?? false)
|
|
12
|
+
);
|
|
13
|
+
const { setValue } = useFormContext();
|
|
14
|
+
const setConfigDefaults = (selected) => {
|
|
15
|
+
const config = find(supportedLayers, ["id", selected]);
|
|
16
|
+
if (!config)
|
|
17
|
+
return;
|
|
18
|
+
if (config?.defaultAggregations) {
|
|
19
|
+
setValue("aggregations", config?.defaultAggregations);
|
|
20
|
+
} else {
|
|
21
|
+
setValue("aggregations", void 0);
|
|
22
|
+
}
|
|
23
|
+
if (config?.params) {
|
|
24
|
+
const { max, min, palette } = config.params;
|
|
25
|
+
setValue("params.max", max);
|
|
26
|
+
setValue("params.min", min);
|
|
27
|
+
setValue("params.palette", palette);
|
|
28
|
+
} else {
|
|
29
|
+
setValue("params", void 0);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
Controller,
|
|
34
|
+
{
|
|
35
|
+
name: "type",
|
|
36
|
+
rules: {
|
|
37
|
+
required: i18n.t("Type is required")
|
|
38
|
+
},
|
|
39
|
+
render: ({ field, fieldState }) => /* @__PURE__ */ jsx(
|
|
40
|
+
SingleSelectField,
|
|
41
|
+
{
|
|
42
|
+
label: i18n.t("Layer type"),
|
|
43
|
+
required: true,
|
|
44
|
+
error: Boolean(fieldState.error),
|
|
45
|
+
validationText: fieldState.error?.message,
|
|
46
|
+
onChange: ({ selected }) => {
|
|
47
|
+
setConfigDefaults(selected);
|
|
48
|
+
field.onChange(selected);
|
|
49
|
+
},
|
|
50
|
+
selected: Boolean(find(supportedLayers, "id", field.value)) ? field.value : void 0,
|
|
51
|
+
children: supportedLayers?.map((layer) => /* @__PURE__ */ jsx(
|
|
52
|
+
SingleSelectOption,
|
|
53
|
+
{
|
|
54
|
+
value: layer.id,
|
|
55
|
+
label: layer.name
|
|
56
|
+
},
|
|
57
|
+
`${layer.id}-option`
|
|
58
|
+
))
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { TypeField };
|
|
66
|
+
//# sourceMappingURL=out.js.map
|
|
67
|
+
//# sourceMappingURL=TypeField.js.map
|
package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/components/TypeField.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/Map/components/EarthEngineLayerConfiguration/components/TypeField.tsx"],"names":[],"mappings":"AA6DM;AA7DN,SAAS,QAAQ,YAAY;AAC7B;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,SAAS,YAAY,sBAAsB;AAC3C,OAAO,UAAU;AACjB,SAAS,mBAAmB,0BAA0B;AAG/C,SAAS,UAAU,EAAE,SAAS,GAA4B;AAChE,QAAM,kBAAkB;AAAA,IACvB;AAAA,IACA,CAAC,EAAE,GAAG,MACL,8BAA8B,SAAS,EAAE,KACzC,EAAE,UAAU,SAAS,EAAE,KAAK;AAAA,EAC9B;AACA,QAAM,EAAE,SAAS,IAAI,eAAe;AACpC,QAAM,oBAAoB,CAAC,aAAqB;AAC/C,UAAM,SAAS,KAAK,iBAAiB,CAAC,MAAM,QAAQ,CAAC;AACrD,QAAI,CAAC;AAAQ;AAEb,QAAI,QAAQ,qBAAqB;AAChC,eAAS,gBAAgB,QAAQ,mBAAmB;AAAA,IACrD,OAAO;AACN,eAAS,gBAAgB,MAAS;AAAA,IACnC;AAEA,QAAI,QAAQ,QAAQ;AACnB,YAAM,EAAE,KAAK,KAAK,QAAQ,IAAI,OAAO;AACrC,eAAS,cAAc,GAAG;AAC1B,eAAS,cAAc,GAAG;AAC1B,eAAS,kBAAkB,OAAO;AAAA,IACnC,OAAO;AACN,eAAS,UAAU,MAAS;AAAA,IAC7B;AAAA,EACD;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAK;AAAA,MACL,OAAO;AAAA,QACN,UAAU,KAAK,EAAE,kBAAkB;AAAA,MACpC;AAAA,MACA,QAAQ,CAAC,EAAE,OAAO,WAAW,MAC5B;AAAA,QAAC;AAAA;AAAA,UACA,OAAO,KAAK,EAAE,YAAY;AAAA,UAC1B,UAAQ;AAAA,UACR,OAAO,QAAQ,WAAW,KAAK;AAAA,UAC/B,gBAAgB,WAAW,OAAO;AAAA,UAClC,UAAU,CAAC,EAAE,SAAS,MAA4B;AACjD,8BAAkB,QAAQ;AAC1B,kBAAM,SAAS,QAAQ;AAAA,UACxB;AAAA,UACA,UACC,QAAQ,KAAK,iBAAiB,MAAM,MAAM,KAAK,CAAC,IAC7C,MAAM,QACN;AAAA,UAGH,2BAAiB,IAAI,CAAC,UACtB;AAAA,YAAC;AAAA;AAAA,cAEA,OAAO,MAAM;AAAA,cACb,OAAO,MAAM;AAAA;AAAA,YAFR,GAAG,MAAM,EAAE;AAAA,UAGjB,CACA;AAAA;AAAA,MACF;AAAA;AAAA,EAEF;AAEF","sourcesContent":["import { filter, find } from \"lodash\";\nimport {\n\tEARTH_ENGINE_LAYERS,\n\tSUPPORTED_EARTH_ENGINE_LAYERS,\n} from \"../../MapLayer/components/GoogleEngineLayer/constants/index.js\";\nimport { Controller, useFormContext } from \"react-hook-form\";\nimport i18n from \"@dhis2/d2-i18n\";\nimport { SingleSelectField, SingleSelectOption } from \"@dhis2/ui\";\nimport React from \"react\";\n\nexport function TypeField({ excluded }: { excluded?: string[] }) {\n\tconst supportedLayers = filter(\n\t\tEARTH_ENGINE_LAYERS,\n\t\t({ id }) =>\n\t\t\tSUPPORTED_EARTH_ENGINE_LAYERS.includes(id) &&\n\t\t\t!(excluded?.includes(id) ?? false),\n\t);\n\tconst { setValue } = useFormContext();\n\tconst setConfigDefaults = (selected: string) => {\n\t\tconst config = find(supportedLayers, [\"id\", selected]);\n\t\tif (!config) return;\n\n\t\tif (config?.defaultAggregations) {\n\t\t\tsetValue(\"aggregations\", config?.defaultAggregations);\n\t\t} else {\n\t\t\tsetValue(\"aggregations\", undefined);\n\t\t}\n\n\t\tif (config?.params) {\n\t\t\tconst { max, min, palette } = config.params;\n\t\t\tsetValue(\"params.max\", max);\n\t\t\tsetValue(\"params.min\", min);\n\t\t\tsetValue(\"params.palette\", palette);\n\t\t} else {\n\t\t\tsetValue(\"params\", undefined);\n\t\t}\n\t};\n\n\treturn (\n\t\t<Controller\n\t\t\tname=\"type\"\n\t\t\trules={{\n\t\t\t\trequired: i18n.t(\"Type is required\"),\n\t\t\t}}\n\t\t\trender={({ field, fieldState }) => (\n\t\t\t\t<SingleSelectField\n\t\t\t\t\tlabel={i18n.t(\"Layer type\")}\n\t\t\t\t\trequired\n\t\t\t\t\terror={Boolean(fieldState.error)}\n\t\t\t\t\tvalidationText={fieldState.error?.message}\n\t\t\t\t\tonChange={({ selected }: { selected: string }) => {\n\t\t\t\t\t\tsetConfigDefaults(selected);\n\t\t\t\t\t\tfield.onChange(selected);\n\t\t\t\t\t}}\n\t\t\t\t\tselected={\n\t\t\t\t\t\tBoolean(find(supportedLayers, \"id\", field.value))\n\t\t\t\t\t\t\t? field.value\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{supportedLayers?.map((layer) => (\n\t\t\t\t\t\t<SingleSelectOption\n\t\t\t\t\t\t\tkey={`${layer.id}-option`}\n\t\t\t\t\t\t\tvalue={layer.id}\n\t\t\t\t\t\t\tlabel={layer.name}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</SingleSelectField>\n\t\t\t)}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useGoogleEngineToken } from '../../MapLayer/components/GoogleEngineLayer/hooks/index.js';
|
|
2
|
+
import { EarthEngine } from '../../MapLayer/components/GoogleEngineLayer/services/engine.js';
|
|
3
|
+
import { useQuery } from 'react-query';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { useWatch } from 'react-hook-form';
|
|
6
|
+
import { find } from 'lodash';
|
|
7
|
+
import { EARTH_ENGINE_LAYERS } from '../../MapLayer/components/GoogleEngineLayer/constants/index.js';
|
|
8
|
+
|
|
9
|
+
function useDatasetInfo(shouldRun, config) {
|
|
10
|
+
const { refresh } = useGoogleEngineToken();
|
|
11
|
+
async function getInfo() {
|
|
12
|
+
if (config) {
|
|
13
|
+
const tokenData = await refresh();
|
|
14
|
+
await EarthEngine.setToken(tokenData.token, refresh);
|
|
15
|
+
const engine = new EarthEngine({
|
|
16
|
+
options: config
|
|
17
|
+
});
|
|
18
|
+
return engine.getPeriod();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const { data, error, isLoading } = useQuery([config], getInfo);
|
|
22
|
+
const periods = useMemo(() => {
|
|
23
|
+
const features = data?.features;
|
|
24
|
+
return features?.map((feature) => {
|
|
25
|
+
return new Date(
|
|
26
|
+
feature?.properties["system:time_start"]
|
|
27
|
+
)?.getFullYear();
|
|
28
|
+
});
|
|
29
|
+
}, [data]);
|
|
30
|
+
return {
|
|
31
|
+
loading: isLoading,
|
|
32
|
+
error,
|
|
33
|
+
periods
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function useType() {
|
|
37
|
+
const type = useWatch({
|
|
38
|
+
name: "type"
|
|
39
|
+
});
|
|
40
|
+
return find(EARTH_ENGINE_LAYERS, ["id", type]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { useDatasetInfo, useType };
|
|
44
|
+
//# sourceMappingURL=out.js.map
|
|
45
|
+
//# sourceMappingURL=data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/Map/components/EarthEngineLayerConfiguration/hooks/data.ts"],"names":[],"mappings":"AACA,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,2BAA2B;AAE7B,SAAS,eACf,WACA,QACC;AACD,QAAM,EAAE,QAAQ,IAAI,qBAAqB;AAEzC,iBAAe,UAAU;AACxB,QAAI,QAAQ;AACX,YAAM,YAAY,MAAM,QAAQ;AAChC,YAAM,YAAY,SAAS,UAAU,OAAO,OAAO;AACnD,YAAM,SAAS,IAAI,YAAY;AAAA,QAC9B,SAAS;AAAA,MACV,CAAC;AACD,aAAO,OAAO,UAAU;AAAA,IACzB;AAAA,EACD;AAEA,QAAM,EAAE,MAAM,OAAO,UAAU,IAAI,SAAS,CAAC,MAAM,GAAG,OAAO;AAE7D,QAAM,UAAU,QAAQ,MAAM;AAC7B,UAAM,WAAY,MAAc;AAChC,WAAO,UAAU,IAAI,CAAC,YAAiB;AACtC,aAAO,IAAI;AAAA,QACV,SAAS,WAAW,mBAAmB;AAAA,MACxC,GAAG,YAAY;AAAA,IAChB,CAAC;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AAET,SAAO;AAAA,IACN,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,UAAU;AACzB,QAAM,OAAO,SAAS;AAAA,IACrB,MAAM;AAAA,EACP,CAAC;AACD,SAAO,KAAK,qBAAqB,CAAC,MAAM,IAAI,CAAC;AAC9C","sourcesContent":["import { EarthEngineOptions } from \"../../MapLayer/components/GoogleEngineLayer/interfaces/index.js\";\nimport { useGoogleEngineToken } from \"../../MapLayer/components/GoogleEngineLayer/hooks/index.js\";\nimport { EarthEngine } from \"../../MapLayer/components/GoogleEngineLayer/services/engine.js\";\nimport { useQuery } from \"react-query\";\nimport { useMemo } from \"react\";\nimport { useWatch } from \"react-hook-form\";\nimport { find } from \"lodash\";\nimport { EARTH_ENGINE_LAYERS } from \"../../MapLayer/components/GoogleEngineLayer/constants/index.js\";\n\nexport function useDatasetInfo(\n\tshouldRun: boolean,\n\tconfig?: EarthEngineOptions,\n) {\n\tconst { refresh } = useGoogleEngineToken();\n\n\tasync function getInfo() {\n\t\tif (config) {\n\t\t\tconst tokenData = await refresh();\n\t\t\tawait EarthEngine.setToken(tokenData.token, refresh);\n\t\t\tconst engine = new EarthEngine({\n\t\t\t\toptions: config,\n\t\t\t});\n\t\t\treturn engine.getPeriod();\n\t\t}\n\t}\n\n\tconst { data, error, isLoading } = useQuery([config], getInfo);\n\n\tconst periods = useMemo(() => {\n\t\tconst features = (data as any)?.features;\n\t\treturn features?.map((feature: any) => {\n\t\t\treturn new Date(\n\t\t\t\tfeature?.properties[\"system:time_start\"],\n\t\t\t)?.getFullYear();\n\t\t});\n\t}, [data]);\n\n\treturn {\n\t\tloading: isLoading,\n\t\terror: error as any,\n\t\tperiods,\n\t};\n}\n\nexport function useType() {\n\tconst type = useWatch({\n\t\tname: \"type\",\n\t});\n\treturn find(EARTH_ENGINE_LAYERS, [\"id\", type]);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Map/components/EarthEngineLayerConfiguration/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,cAAc","sourcesContent":["export * from \"./EarthEngineLayerConfigModal.js\";\nexport * from \"./EarthEngineLayerConfiguration.js\";\n"]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { uid } from '@hisptz/dhis2-utils';
|
|
3
|
+
import { isEmpty } from 'lodash';
|
|
4
|
+
import { forwardRef, useRef } from 'react';
|
|
5
|
+
import { MapContainer, TileLayer, LayersControl } from 'react-leaflet';
|
|
6
|
+
import { useMapBounds } from '../../hooks/map.js';
|
|
7
|
+
import MapControl from '../MapControls/index.js';
|
|
8
|
+
import MapLayer from '../MapLayer/index.js';
|
|
9
|
+
import LegendArea from '../MapLayer/components/LegendArea/index.js';
|
|
10
|
+
import { MapLayersProvider } from '../MapProvider/components/MapLayerProvider/index.js';
|
|
11
|
+
import { useMapLayers } from '../MapProvider/hooks/index.js';
|
|
12
|
+
import MapUpdater from '../MapUpdater/index.js';
|
|
13
|
+
|
|
14
|
+
function MapLayerArea({
|
|
15
|
+
id,
|
|
16
|
+
base,
|
|
17
|
+
controls,
|
|
18
|
+
legends
|
|
19
|
+
}) {
|
|
20
|
+
const { layers } = useMapLayers();
|
|
21
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
|
+
/* @__PURE__ */ jsx(
|
|
23
|
+
TileLayer,
|
|
24
|
+
{
|
|
25
|
+
id,
|
|
26
|
+
attribution: base?.attribution ?? '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> | © <a href="https://carto.com/attribution">CARTO</a>',
|
|
27
|
+
url: base?.url ?? "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
controls?.map((control) => /* @__PURE__ */ jsx(
|
|
31
|
+
MapControl,
|
|
32
|
+
{
|
|
33
|
+
mapId: id,
|
|
34
|
+
...control
|
|
35
|
+
},
|
|
36
|
+
`${control.type}-control`
|
|
37
|
+
)),
|
|
38
|
+
!isEmpty(layers) && /* @__PURE__ */ jsx(LayersControl, { hideSingleBase: true, position: "topleft", children: layers.map(
|
|
39
|
+
(layer, index) => /* @__PURE__ */ jsx(
|
|
40
|
+
MapLayer,
|
|
41
|
+
{
|
|
42
|
+
layer,
|
|
43
|
+
index
|
|
44
|
+
},
|
|
45
|
+
layer.id
|
|
46
|
+
)
|
|
47
|
+
) }),
|
|
48
|
+
!isEmpty(layers) && /* @__PURE__ */ jsx(
|
|
49
|
+
LegendArea,
|
|
50
|
+
{
|
|
51
|
+
legends,
|
|
52
|
+
layers,
|
|
53
|
+
position: "topright"
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] });
|
|
57
|
+
}
|
|
58
|
+
const MapArea = ({ base, controls, mapOptions, key, legends, layers }, ref) => {
|
|
59
|
+
const { center, bounds } = useMapBounds();
|
|
60
|
+
const { current: id } = useRef(uid());
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
id: `${id}-"map-container`,
|
|
65
|
+
style: { height: "100%", width: "100%" },
|
|
66
|
+
children: /* @__PURE__ */ jsxs(
|
|
67
|
+
MapContainer,
|
|
68
|
+
{
|
|
69
|
+
attributionControl: true,
|
|
70
|
+
ref,
|
|
71
|
+
id,
|
|
72
|
+
center,
|
|
73
|
+
bounceAtZoomLimits: true,
|
|
74
|
+
bounds,
|
|
75
|
+
style: { height: "100%", width: "100%", minHeight: 500 },
|
|
76
|
+
trackResize: true,
|
|
77
|
+
...mapOptions,
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ jsx(MapUpdater, { bounds }),
|
|
80
|
+
/* @__PURE__ */ jsx(MapLayersProvider, { layers, children: /* @__PURE__ */ jsx(
|
|
81
|
+
MapLayerArea,
|
|
82
|
+
{
|
|
83
|
+
base,
|
|
84
|
+
id,
|
|
85
|
+
controls,
|
|
86
|
+
legends
|
|
87
|
+
}
|
|
88
|
+
) })
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
key
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
var MapArea_default = forwardRef(MapArea);
|
|
97
|
+
|
|
98
|
+
export { MapArea_default as default };
|
|
99
|
+
//# sourceMappingURL=out.js.map
|
|
100
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Map/components/MapArea/index.tsx"],"names":[],"mappings":"AAoCE,mBACC,KADD;AApCF,SAAS,WAAW;AAEpB,SAAS,eAAe;AACxB,SAAgB,YAAY,cAAc;AAC1C,SAAS,eAAe,cAAc,iBAAiB;AACvD,SAAS,oBAAoB;AAC7B,OAAO,gBAAgB;AACvB,OAAO,cAAc;AACrB,OAAO,gBAAgB;AAEvB,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAM7B,OAAO,gBAAgB;AAEvB,SAAS,aAAa;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAQG;AACF,QAAM,EAAE,OAAO,IAAI,aAAa;AAEhC,SACC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,aACC,MAAM,eACN;AAAA,QAED,KACC,MAAM,OACN;AAAA;AAAA,IAEF;AAAA,IACC,UAAU,IAAI,CAAC,YACf;AAAA,MAAC;AAAA;AAAA,QACA,OAAO;AAAA,QAEN,GAAG;AAAA;AAAA,MADC,GAAG,QAAQ,IAAI;AAAA,IAErB,CACA;AAAA,IACA,CAAC,QAAQ,MAAM,KACf,oBAAC,iBAAc,gBAAc,MAAC,UAAU,WACrC,iBAAiC;AAAA,MAClC,CAAC,OAA4B,UAC5B;AAAA,QAAC;AAAA;AAAA,UAEA;AAAA,UACA;AAAA;AAAA,QAFK,MAAM;AAAA,MAGZ;AAAA,IAEF,GACD;AAAA,IAEA,CAAC,QAAQ,MAAM,KACf;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU;AAAA;AAAA,IACX;AAAA,KAEF;AAEF;AAEA,MAAM,UAAU,CACf,EAAE,MAAM,UAAU,YAAY,KAAK,SAAS,OAAO,GACnD,QACI;AACJ,QAAM,EAAE,QAAQ,OAAO,IAAI,aAAa;AACxC,QAAM,EAAE,SAAS,GAAG,IAAI,OAAe,IAAI,CAAC;AAE5C,SACC;AAAA,IAAC;AAAA;AAAA,MACA,IAAI,GAAG,EAAE;AAAA,MACT,OAAO,EAAE,QAAQ,QAAQ,OAAO,OAAO;AAAA,MAEvC;AAAA,QAAC;AAAA;AAAA,UACA,oBAAkB;AAAA,UAClB;AAAA,UACA;AAAA,UACA;AAAA,UACA,oBAAkB;AAAA,UAClB;AAAA,UACA,OAAO,EAAE,QAAQ,QAAQ,OAAO,QAAQ,WAAW,IAAI;AAAA,UAEvD,aAAW;AAAA,UACV,GAAG;AAAA,UAEJ;AAAA,gCAAC,cAAW,QAAgB;AAAA,YAC5B,oBAAC,qBAAkB,QAClB;AAAA,cAAC;AAAA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA;AAAA,YACD,GACD;AAAA;AAAA;AAAA,QAZK;AAAA,MAaN;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,kBAAQ,WAAW,OAAO","sourcesContent":["import { uid } from \"@hisptz/dhis2-utils\";\nimport { Map as LeafletMap } from \"leaflet\";\nimport { isEmpty } from \"lodash\";\nimport React, { forwardRef, useRef } from \"react\";\nimport { LayersControl, MapContainer, TileLayer } from \"react-leaflet\";\nimport { useMapBounds } from \"../../hooks/map.js\";\nimport MapControl from \"../MapControls/index.js\";\nimport MapLayer from \"../MapLayer/index.js\";\nimport LegendArea from \"../MapLayer/components/LegendArea/index.js\";\nimport { CustomThematicLayer } from \"../MapLayer/interfaces/index.js\";\nimport { MapLayersProvider } from \"../MapProvider/components/MapLayerProvider/index.js\";\nimport { useMapLayers } from \"../MapProvider/hooks/index.js\";\nimport {\n\tMapAreaProps,\n\tMapControls,\n\tMapLegendConfig,\n} from \"./interfaces/index.js\";\nimport MapUpdater from \"../MapUpdater/index.js\";\n\nfunction MapLayerArea({\n\tid,\n\tbase,\n\tcontrols,\n\tlegends,\n}: {\n\tid: string;\n\tbase?: {\n\t\turl: string;\n\t\tattribution: string;\n\t};\n\tcontrols?: MapControls[];\n\tlegends?: MapLegendConfig;\n}) {\n\tconst { layers } = useMapLayers();\n\n\treturn (\n\t\t<>\n\t\t\t<TileLayer\n\t\t\t\tid={id}\n\t\t\t\tattribution={\n\t\t\t\t\tbase?.attribution ??\n\t\t\t\t\t'© <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> | © <a href=\"https://carto.com/attribution\">CARTO</a>'\n\t\t\t\t}\n\t\t\t\turl={\n\t\t\t\t\tbase?.url ??\n\t\t\t\t\t\"https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png\"\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{controls?.map((control) => (\n\t\t\t\t<MapControl\n\t\t\t\t\tmapId={id}\n\t\t\t\t\tkey={`${control.type}-control`}\n\t\t\t\t\t{...control}\n\t\t\t\t/>\n\t\t\t))}\n\t\t\t{!isEmpty(layers) && (\n\t\t\t\t<LayersControl hideSingleBase position={\"topleft\"}>\n\t\t\t\t\t{(layers as CustomThematicLayer[]).map(\n\t\t\t\t\t\t(layer: CustomThematicLayer, index) => (\n\t\t\t\t\t\t\t<MapLayer\n\t\t\t\t\t\t\t\tkey={layer.id}\n\t\t\t\t\t\t\t\tlayer={layer}\n\t\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t)}\n\t\t\t\t</LayersControl>\n\t\t\t)}\n\t\t\t{!isEmpty(layers) && (\n\t\t\t\t<LegendArea\n\t\t\t\t\tlegends={legends}\n\t\t\t\t\tlayers={layers as CustomThematicLayer[]}\n\t\t\t\t\tposition={\"topright\"}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t);\n}\n\nconst MapArea = (\n\t{ base, controls, mapOptions, key, legends, layers }: MapAreaProps,\n\tref: React.Ref<LeafletMap> | undefined,\n) => {\n\tconst { center, bounds } = useMapBounds();\n\tconst { current: id } = useRef<string>(uid());\n\n\treturn (\n\t\t<div\n\t\t\tid={`${id}-\"map-container`}\n\t\t\tstyle={{ height: \"100%\", width: \"100%\" }}\n\t\t>\n\t\t\t<MapContainer\n\t\t\t\tattributionControl\n\t\t\t\tref={ref}\n\t\t\t\tid={id}\n\t\t\t\tcenter={center}\n\t\t\t\tbounceAtZoomLimits\n\t\t\t\tbounds={bounds}\n\t\t\t\tstyle={{ height: \"100%\", width: \"100%\", minHeight: 500 }}\n\t\t\t\tkey={key}\n\t\t\t\ttrackResize\n\t\t\t\t{...mapOptions}\n\t\t\t>\n\t\t\t\t<MapUpdater bounds={bounds} />\n\t\t\t\t<MapLayersProvider layers={layers}>\n\t\t\t\t\t<MapLayerArea\n\t\t\t\t\t\tbase={base}\n\t\t\t\t\t\tid={id}\n\t\t\t\t\t\tcontrols={controls}\n\t\t\t\t\t\tlegends={legends}\n\t\t\t\t\t/>\n\t\t\t\t</MapLayersProvider>\n\t\t\t</MapContainer>\n\t\t</div>\n\t);\n};\n\nexport default forwardRef(MapArea);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
const POSITION_CLASSES = {
|
|
4
|
+
bottomleft: "leaflet-bottom leaflet-left",
|
|
5
|
+
bottomright: "leaflet-bottom leaflet-right",
|
|
6
|
+
topleft: "leaflet-top leaflet-left",
|
|
7
|
+
topright: "leaflet-top leaflet-right"
|
|
8
|
+
};
|
|
9
|
+
function CustomControl({ children, position, ...options }) {
|
|
10
|
+
const positionClass = position && POSITION_CLASSES[position] || POSITION_CLASSES.topright;
|
|
11
|
+
return /* @__PURE__ */ jsx("div", { ...options, className: `${positionClass}`, children: /* @__PURE__ */ jsx("div", { style: { overflow: "hidden", border: "none" }, className: "leaflet-control leaflet-bar", children }) });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { CustomControl };
|
|
15
|
+
//# sourceMappingURL=out.js.map
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/components/Map/components/MapControls/components/CustomControl/index.tsx"],"names":[],"mappings":"AAkBM;AAfN,MAAM,mBAAmB;AAAA,EACxB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,SAAS;AAAA,EACT,UAAU;AACX;AAMO,SAAS,cAAc,EAAE,UAAU,UAAU,GAAG,QAAQ,GAAyB;AACtF,QAAM,gBAAiB,YAAY,iBAAiB,QAAQ,KAAM,iBAAiB;AACnF,SACE,oBAAC,SAAK,GAAG,SAAS,WAAW,GAAG,aAAa,IAC3C,8BAAC,SAAI,OAAO,EAAE,UAAU,UAAU,QAAQ,OAAO,GAAG,WAAU,+BAC3D,UACH,GACF;AAEJ","sourcesContent":["import { ControlOptions } from \"leaflet\";\nimport React from \"react\";\n\nconst POSITION_CLASSES = {\n\tbottomleft: \"leaflet-bottom leaflet-left\",\n\tbottomright: \"leaflet-bottom leaflet-right\",\n\ttopleft: \"leaflet-top leaflet-left\",\n\ttopright: \"leaflet-top leaflet-right\",\n};\n\ninterface CustomControlOptions extends ControlOptions {\n children: React.ReactNode;\n}\n\nexport function CustomControl({ children, position, ...options }: CustomControlOptions) {\n const positionClass = (position && POSITION_CLASSES[position]) || POSITION_CLASSES.topright;\n return (\n <div {...options} className={`${positionClass}`}>\n <div style={{ overflow: \"hidden\", border: \"none\" }} className=\"leaflet-control leaflet-bar\">\n {children}\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createControlComponent } from '@react-leaflet/core';
|
|
3
|
+
import L from 'leaflet';
|
|
4
|
+
import 'leaflet-easyprint';
|
|
5
|
+
|
|
6
|
+
const DownloadControlComponent = createControlComponent((props) => {
|
|
7
|
+
return L.easyPrint(props);
|
|
8
|
+
});
|
|
9
|
+
function DownloadControl({ options, position, mapId }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(DownloadControlComponent, { ...{ ...options, position } });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { DownloadControl as default };
|
|
14
|
+
//# sourceMappingURL=out.js.map
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
package/dist/esm/components/Map/components/MapControls/components/DownloadControl/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/components/Map/components/MapControls/components/DownloadControl/index.tsx"],"names":[],"mappings":"AASS;AATT,SAAS,8BAA8B;AACvC,OAAO,OAA4B;AACnC,OAAO;AAGP,MAAM,2BAA2B,uBAAuB,CAAC,UAAU;AAClE,SAAQ,EAAU,UAAU,KAAK;AAClC,CAAC;AACc,SAAR,gBAAiC,EAAE,SAAS,UAAU,MAAM,GAA+D;AAChI,SAAO,oBAAC,4BAA0B,GAAG,EAAE,GAAG,SAAS,SAAS,GAAG;AACjE","sourcesContent":["import { createControlComponent } from \"@react-leaflet/core\";\nimport L, { ControlPosition } from \"leaflet\";\nimport \"leaflet-easyprint\";\nimport React from \"react\";\n\nconst DownloadControlComponent = createControlComponent((props) => {\n\treturn (L as any).easyPrint(props);\n});\nexport default function DownloadControl({ options, position, mapId }: { options: any; position: ControlPosition; mapId: string }) {\n return <DownloadControlComponent {...{ ...options, position }} />;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createControlComponent } from '@react-leaflet/core';
|
|
2
|
+
import { control } from 'leaflet';
|
|
3
|
+
import 'leaflet.fullscreen';
|
|
4
|
+
import 'leaflet.fullscreen/Control.FullScreen.css';
|
|
5
|
+
|
|
6
|
+
const FullscreenControl = createControlComponent(
|
|
7
|
+
(props) => control.fullscreen(props)
|
|
8
|
+
);
|
|
9
|
+
var FullscreenControl_default = FullscreenControl;
|
|
10
|
+
|
|
11
|
+
export { FullscreenControl_default as default };
|
|
12
|
+
//# sourceMappingURL=out.js.map
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
package/dist/esm/components/Map/components/MapControls/components/FullscreenControl/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/components/Map/components/MapControls/components/FullscreenControl/index.tsx"],"names":[],"mappings":"AAAA,SAAS,8BAA8B;AACvC,SAAS,eAAe;AACxB,OAAO;AACP,OAAO;AAEP,MAAM,oBAAoB;AAAA,EAAuB,CAAC,UAChD,QAAgB,WAAW,KAAK;AAClC;AACA,IAAO,4BAAQ","sourcesContent":["import { createControlComponent } from \"@react-leaflet/core\";\nimport { control } from \"leaflet\";\nimport \"leaflet.fullscreen\";\nimport \"leaflet.fullscreen/Control.FullScreen.css\";\n\nconst FullscreenControl = createControlComponent((props) =>\n\t(control as any).fullscreen(props),\n);\nexport default FullscreenControl;\n"]}
|