@hisptz/dhis2-analytics 1.0.6 → 1.0.8

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.
Files changed (86) hide show
  1. package/build/cjs/components/ChartAnalytics/index.js +14 -5
  2. package/build/cjs/components/Map/components/MapControls/components/DownloadControl/index.js +1 -1
  3. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +6 -2
  4. package/build/es/components/ChartAnalytics/index.js +4 -3
  5. package/build/es/components/Map/components/MapControls/components/DownloadControl/index.js +1 -1
  6. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +5 -1
  7. package/build/types/components/ChartAnalytics/components/DownloadMenu/components/Menu.d.ts +8 -0
  8. package/build/types/components/ChartAnalytics/components/DownloadMenu/constants/menu.d.ts +7 -0
  9. package/build/types/components/ChartAnalytics/components/DownloadMenu/index.d.ts +9 -0
  10. package/build/types/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.d.ts +1 -0
  11. package/build/types/components/ChartAnalytics/hooks/useChart.d.ts +11 -0
  12. package/build/types/components/ChartAnalytics/index.d.ts +7 -0
  13. package/build/types/components/ChartAnalytics/models/column.d.ts +12 -0
  14. package/build/types/components/ChartAnalytics/models/index.d.ts +17 -0
  15. package/build/types/components/ChartAnalytics/models/line.d.ts +8 -0
  16. package/build/types/components/ChartAnalytics/models/multi-series.d.ts +9 -0
  17. package/build/types/components/ChartAnalytics/models/pie.d.ts +8 -0
  18. package/build/types/components/ChartAnalytics/services/export.d.ts +8 -0
  19. package/build/types/components/ChartAnalytics/types/props.d.ts +43 -0
  20. package/build/types/components/ChartAnalytics/utils/chart.d.ts +15 -0
  21. package/build/types/components/CircularProgressDashboard/index.d.ts +3 -0
  22. package/build/types/components/CircularProgressDashboard/types/props.d.ts +17 -0
  23. package/build/types/components/Map/components/EarthEngineLayerConfiguration/index.d.ts +17 -0
  24. package/build/types/components/Map/components/MapArea/index.d.ts +5 -0
  25. package/build/types/components/Map/components/MapArea/interfaces/index.d.ts +30 -0
  26. package/build/types/components/Map/components/MapControls/components/CustomControl/index.d.ts +7 -0
  27. package/build/types/components/Map/components/MapControls/components/DownloadControl/index.d.ts +8 -0
  28. package/build/types/components/Map/components/MapControls/components/FullscreenControl/index.d.ts +5 -0
  29. package/build/types/components/Map/components/MapControls/index.d.ts +6 -0
  30. package/build/types/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.d.ts +1 -0
  31. package/build/types/components/Map/components/MapLayer/components/BoundaryLayer/index.d.ts +15 -0
  32. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.d.ts +17 -0
  33. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.d.ts +4 -0
  34. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.d.ts +9 -0
  35. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/index.d.ts +4 -0
  36. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.d.ts +58 -0
  37. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.d.ts +1 -0
  38. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.d.ts +55 -0
  39. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.d.ts +20 -0
  40. package/build/types/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.d.ts +6 -0
  41. package/build/types/components/Map/components/MapLayer/components/LegendArea/index.d.ts +9 -0
  42. package/build/types/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.d.ts +3 -0
  43. package/build/types/components/Map/components/MapLayer/components/PointLayer/hooks/index.d.ts +2 -0
  44. package/build/types/components/Map/components/MapLayer/components/PointLayer/index.d.ts +2 -0
  45. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.d.ts +13 -0
  46. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.d.ts +10 -0
  47. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.d.ts +16 -0
  48. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.d.ts +12 -0
  49. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.d.ts +21 -0
  50. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.d.ts +12 -0
  51. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.d.ts +5 -0
  52. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.d.ts +2 -0
  53. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/index.d.ts +5 -0
  54. package/build/types/components/Map/components/MapLayer/index.d.ts +6 -0
  55. package/build/types/components/Map/components/MapLayer/interfaces/index.d.ts +123 -0
  56. package/build/types/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.d.ts +9 -0
  57. package/build/types/components/Map/components/MapProvider/components/MapLayerProvider/index.d.ts +6 -0
  58. package/build/types/components/Map/components/MapProvider/hooks/index.d.ts +15 -0
  59. package/build/types/components/Map/components/MapProvider/index.d.ts +3 -0
  60. package/build/types/components/Map/components/MapUpdater/index.d.ts +5 -0
  61. package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.d.ts +8 -0
  62. package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.d.ts +419 -0
  63. package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.d.ts +9 -0
  64. package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.d.ts +11 -0
  65. package/build/types/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.d.ts +2 -0
  66. package/build/types/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.d.ts +8 -0
  67. package/build/types/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.d.ts +9 -0
  68. package/build/types/components/Map/components/ThematicLayerConfiguration/index.d.ts +18 -0
  69. package/build/types/components/Map/constants/colors.d.ts +419 -0
  70. package/build/types/components/Map/constants/legendSet.d.ts +7 -0
  71. package/build/types/components/Map/hooks/map.d.ts +9 -0
  72. package/build/types/components/Map/index.d.ts +8 -0
  73. package/build/types/components/Map/interfaces/index.d.ts +65 -0
  74. package/build/types/components/Map/state/index.d.ts +20 -0
  75. package/build/types/components/Map/utils/colors.d.ts +12 -0
  76. package/build/types/components/Map/utils/helpers.d.ts +6 -0
  77. package/build/types/components/Map/utils/map.d.ts +40 -0
  78. package/build/types/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.d.ts +8 -0
  79. package/build/types/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.d.ts +2 -0
  80. package/build/types/components/SingleValueContainer/index.d.ts +5 -0
  81. package/build/types/components/SingleValueContainer/types/props.d.ts +15 -0
  82. package/build/types/dataProviders/map.d.ts +4 -0
  83. package/build/types/index.d.ts +4 -0
  84. package/package.json +7 -3
  85. package/build/cjs/index.test.js +0 -7
  86. package/build/es/index.test.js +0 -6
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { ChartExportMenuItem } from "../interfaces/menu";
3
+ export declare function ChartMenu({ menuRef, onClick, onClose, exclude, }: {
4
+ menuRef: HTMLDivElement;
5
+ onClick: (action: string) => void;
6
+ onClose: () => void;
7
+ exclude?: ChartExportMenuItem[];
8
+ }): JSX.Element;
@@ -0,0 +1,7 @@
1
+ export declare const chartMenuSections: {
2
+ name: string;
3
+ menuItems: {
4
+ name: string;
5
+ label: any;
6
+ }[];
7
+ }[];
@@ -0,0 +1,9 @@
1
+ import HighchartsReact from "highcharts-react-official";
2
+ import React from "react";
3
+ import { ChartExportMenuItem } from "./interfaces/menu";
4
+ declare function ChartDownloadMenu({ chartRef, exclude, icon, }: {
5
+ chartRef: HighchartsReact.RefObject | null;
6
+ exclude?: ChartExportMenuItem[];
7
+ icon?: React.ReactNode;
8
+ }): JSX.Element;
9
+ export default ChartDownloadMenu;
@@ -0,0 +1 @@
1
+ export type ChartExportMenuItem = "png" | "jpeg" | "svg" | "csv" | "pdf" | "table" | "full-screen";
@@ -0,0 +1,11 @@
1
+ import type { Analytics } from "@hisptz/dhis2-utils";
2
+ import HighCharts from "highcharts";
3
+ import { ChartConfig, ChartType } from "../types/props";
4
+ export declare function useChart({ id, analytics, config }: {
5
+ id: string;
6
+ analytics: Analytics;
7
+ config: ChartConfig;
8
+ }): {
9
+ chart?: HighCharts.Options;
10
+ changeChartType: (type: ChartType) => void;
11
+ };
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import ChartDownloadMenu from "./components/DownloadMenu";
3
+ import { ChartAnalyticsProps } from "./types/props";
4
+ import "./styles/custom-highchart.css";
5
+ export * from "./services/export";
6
+ export { ChartDownloadMenu, ChartAnalyticsProps, };
7
+ export declare const ChartAnalytics: React.FC<ChartAnalyticsProps>;
@@ -0,0 +1,12 @@
1
+ import { PlotOptions, SeriesOptionsType, XAxisOptions } from "highcharts";
2
+ import { DHIS2Chart } from "./index";
3
+ export declare class DHIS2ColumnChart extends DHIS2Chart {
4
+ getCategories(): any[] | undefined;
5
+ getHighchartsType(): string;
6
+ getPlotOptions(): PlotOptions;
7
+ getSeries(): SeriesOptionsType[];
8
+ getXAxis(): XAxisOptions | undefined;
9
+ }
10
+ export declare class DHIS2StackedColumnChart extends DHIS2ColumnChart {
11
+ getPlotOptions(): PlotOptions;
12
+ }
@@ -0,0 +1,17 @@
1
+ import type { Analytics } from "@hisptz/dhis2-utils";
2
+ import HighCharts from "highcharts";
3
+ import { ChartConfig } from "../types/props";
4
+ export declare abstract class DHIS2Chart {
5
+ id: string;
6
+ analytics: Analytics;
7
+ config: ChartConfig;
8
+ constructor(id: string, analytics: Analytics, config: ChartConfig);
9
+ abstract getHighchartsType(): string;
10
+ getChartConfig(): HighCharts.ChartOptions & any;
11
+ getOptions(): HighCharts.Options;
12
+ abstract getSeries(): HighCharts.SeriesOptionsType[];
13
+ abstract getPlotOptions(): HighCharts.PlotOptions;
14
+ abstract getXAxis(): HighCharts.XAxisOptions | undefined;
15
+ getYAxis(): HighCharts.YAxisOptions[];
16
+ getExporting(): HighCharts.ExportingOptions;
17
+ }
@@ -0,0 +1,8 @@
1
+ import { PlotOptions, SeriesOptionsType, XAxisOptions } from "highcharts";
2
+ import { DHIS2Chart } from "./index";
3
+ export declare class DHIS2LineChart extends DHIS2Chart {
4
+ getHighchartsType(): string;
5
+ getPlotOptions(): PlotOptions;
6
+ getSeries(): SeriesOptionsType[];
7
+ getXAxis(): XAxisOptions | undefined;
8
+ }
@@ -0,0 +1,9 @@
1
+ import { PlotOptions, SeriesOptionsType, XAxisOptions, YAxisOptions } from "highcharts";
2
+ import { DHIS2Chart } from "./index";
3
+ export declare class DHIS2MultiSeriesChart extends DHIS2Chart {
4
+ getHighchartsType(): string;
5
+ getPlotOptions(): PlotOptions;
6
+ getSeries(): SeriesOptionsType[];
7
+ getXAxis(): XAxisOptions | undefined;
8
+ getYAxis(): YAxisOptions[];
9
+ }
@@ -0,0 +1,8 @@
1
+ import { PlotOptions, SeriesOptionsType, XAxisOptions } from "highcharts";
2
+ import { DHIS2Chart } from "./index";
3
+ export declare class DHIS2PieChart extends DHIS2Chart {
4
+ getHighchartsType(): string;
5
+ getPlotOptions(): PlotOptions;
6
+ getSeries(): SeriesOptionsType[];
7
+ getXAxis(): XAxisOptions | undefined;
8
+ }
@@ -0,0 +1,8 @@
1
+ import Highcharts from "highcharts";
2
+ import HighchartsReact from "highcharts-react-official";
3
+ export declare function setupHighchartsModules(highcharts: typeof Highcharts): void;
4
+ export declare function onFullScreenView(chartRef: HighchartsReact.RefObject, options?: Highcharts.Options): void;
5
+ export declare function onPDFDownload(chartRef: HighchartsReact.RefObject, options?: Highcharts.Options): void;
6
+ export declare function onCSVDownload(chartRef: HighchartsReact.RefObject, options?: Highcharts.Options): void;
7
+ export declare const onImageDownload: (chartRef: HighchartsReact.RefObject, type: "png" | "svg+xml" | "jpeg", options?: Highcharts.Options) => void;
8
+ export declare const onViewAsTable: (chartRef: HighchartsReact.RefObject, show: boolean) => void;
@@ -0,0 +1,43 @@
1
+ import type { Analytics } from "@hisptz/dhis2-utils";
2
+ import { DashStyleValue, YAxisOptions, YAxisPlotLinesLabelOptions } from "highcharts";
3
+ export type ChartType = "column" | "pie" | "stacked-column" | "line" | "multi-series";
4
+ export interface MultiSeriesConfig {
5
+ series?: Array<{
6
+ id: string;
7
+ as: "column" | "line";
8
+ cumulative?: boolean;
9
+ yAxis?: number;
10
+ }>;
11
+ yAxes?: Array<YAxisOptions>;
12
+ target?: TargetConfig;
13
+ }
14
+ export interface TargetConfig {
15
+ id: string;
16
+ value: number;
17
+ label?: YAxisPlotLinesLabelOptions;
18
+ styles: {
19
+ color?: string;
20
+ width?: number;
21
+ dashStyle?: DashStyleValue;
22
+ zIndex?: number;
23
+ };
24
+ }
25
+ export type ChartConfig = {
26
+ layout: {
27
+ series: Array<string>;
28
+ category: Array<string>;
29
+ filter: Array<string>;
30
+ };
31
+ type?: ChartType;
32
+ height?: number;
33
+ colors?: Array<string>;
34
+ name?: string;
35
+ allowChartTypeChange?: boolean;
36
+ highChartOverrides?: Record<string, any>;
37
+ multiSeries?: MultiSeriesConfig;
38
+ };
39
+ export type ChartAnalyticsProps = {
40
+ analytics: Analytics;
41
+ config: ChartConfig;
42
+ containerProps?: Record<string, any>;
43
+ };
@@ -0,0 +1,15 @@
1
+ import type { Analytics, AnalyticsHeader } from "@hisptz/dhis2-utils";
2
+ import { DHIS2Chart } from "../models";
3
+ import { ChartConfig, ChartType } from "../types/props";
4
+ export declare function getDimensionHeaderIndex(headers: AnalyticsHeader[], name: string): number;
5
+ export declare function getPointSeries(analytics: Analytics, config: ChartConfig, highchartsType: string): any;
6
+ export declare function getColumnSeries(analytics: Analytics, header: AnalyticsHeader, config: ChartConfig, highchartsType: string): any;
7
+ export declare function getAllCategories(analytics: Analytics, config: ChartConfig): string[];
8
+ export declare function updateLayout(config: ChartConfig, { type }: {
9
+ type: ChartType;
10
+ }): {
11
+ series: string[];
12
+ category: string[];
13
+ filter: string[];
14
+ };
15
+ export declare function getChartInstance(id: string, analytics: Analytics, config: ChartConfig): DHIS2Chart;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { CircularDashboardProps } from "./types/props";
3
+ export declare function CircularProgressDashboard({ numerator, size, denominator, value, textStyle, strokeStyle }: CircularDashboardProps): React.ReactElement;
@@ -0,0 +1,17 @@
1
+ export type CircularDashboardProps = {
2
+ strokeStyle?: {
3
+ width?: number | string;
4
+ color?: string;
5
+ [key: string]: any;
6
+ };
7
+ textStyle?: {
8
+ color?: string;
9
+ fontSize?: number | string;
10
+ fontWeight?: number | string;
11
+ [key: string]: any;
12
+ };
13
+ value?: number;
14
+ numerator?: number;
15
+ denominator?: number;
16
+ size: string | number;
17
+ };
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { EarthEngineLayerConfig } from "../MapLayer/interfaces";
3
+ import { UseFormReturn } from "react-hook-form";
4
+ export interface EarthEngineLayerConfigurationProps {
5
+ form: UseFormReturn<EarthEngineLayerConfig>;
6
+ excluded?: string[];
7
+ [key: string]: any;
8
+ }
9
+ export declare function EarthEngineLayerConfiguration({ form, excluded }: EarthEngineLayerConfigurationProps): JSX.Element;
10
+ export interface EarthEngineLayerConfigModalProps {
11
+ open: boolean;
12
+ config?: EarthEngineLayerConfig;
13
+ exclude?: string[];
14
+ onClose: () => void;
15
+ onChange: (config: EarthEngineLayerConfig) => void;
16
+ }
17
+ export declare function EarthEngineLayerConfigModal({ open, exclude, config, onClose, onChange, ...props }: EarthEngineLayerConfigModalProps): JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { Map as LeafletMap } from "leaflet";
2
+ import React from "react";
3
+ import { MapAreaProps } from "./interfaces";
4
+ declare const _default: React.ForwardRefExoticComponent<MapAreaProps & React.RefAttributes<LeafletMap>>;
5
+ export default _default;
@@ -0,0 +1,30 @@
1
+ import { ControlPosition } from "leaflet";
2
+ import type { MapContainerProps } from "react-leaflet";
3
+ import { CustomBoundaryLayer, CustomPointLayer, EarthEngineLayerConfig, ThematicLayerConfig } from "../../MapLayer/interfaces";
4
+ export interface MapControls {
5
+ position: ControlPosition;
6
+ type: "zoom" | "rotate" | "fullscreen" | "compass" | "scale" | "print";
7
+ options?: Record<string, any>;
8
+ }
9
+ export interface MapLegendConfig {
10
+ enabled: boolean;
11
+ position: ControlPosition;
12
+ collapsible: boolean;
13
+ }
14
+ export interface MapLayerConfig {
15
+ thematicLayers?: ThematicLayerConfig[];
16
+ boundaryLayers?: CustomBoundaryLayer[];
17
+ pointLayers?: CustomPointLayer[];
18
+ earthEngineLayers?: EarthEngineLayerConfig[];
19
+ }
20
+ export interface MapAreaProps {
21
+ base?: {
22
+ url: string;
23
+ attribution: string;
24
+ };
25
+ controls?: MapControls[];
26
+ mapOptions?: MapContainerProps;
27
+ legends?: MapLegendConfig;
28
+ layers: MapLayerConfig;
29
+ key?: string;
30
+ }
@@ -0,0 +1,7 @@
1
+ import { ControlOptions } from "leaflet";
2
+ import React from "react";
3
+ interface CustomControlOptions extends ControlOptions {
4
+ children: React.ReactNode;
5
+ }
6
+ export declare function CustomControl({ children, position, ...options }: CustomControlOptions): JSX.Element;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { ControlPosition } from "leaflet";
3
+ import "leaflet-easyprint";
4
+ export default function DownloadControl({ options, position, mapId }: {
5
+ options: any;
6
+ position: ControlPosition;
7
+ mapId: string;
8
+ }): JSX.Element;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import "leaflet.fullscreen";
3
+ import "leaflet.fullscreen/Control.FullScreen.css";
4
+ declare const FullscreenControl: import("react").ForwardRefExoticComponent<import("leaflet").ControlOptions & import("react").RefAttributes<any>>;
5
+ export default FullscreenControl;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { MapControls } from "../MapArea/interfaces";
3
+ export interface MapControlProps extends MapControls {
4
+ mapId: string;
5
+ }
6
+ export default function MapControl({ type, options, position, mapId }: MapControlProps): JSX.Element | null;
@@ -0,0 +1 @@
1
+ export declare function useBoundaryData(): import("../../../../..").MapOrgUnit[] | undefined;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { CustomBoundaryLayer as BoundaryLayerInterface } from "../../interfaces";
3
+ export declare const defaultStyle: {
4
+ weight: number;
5
+ color: any;
6
+ fillColor: any;
7
+ fillOpacity: number;
8
+ };
9
+ export declare const highlightStyle: {
10
+ weight: number;
11
+ color: any;
12
+ dashArray: string;
13
+ fillOpacity: number;
14
+ };
15
+ export default function BoundaryLayer(props: BoundaryLayerInterface): JSX.Element;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { CustomGoogleEngineLayer } from "../../../interfaces";
3
+ export declare function LegendItem({ legend }: {
4
+ legend: {
5
+ min: number;
6
+ max: number;
7
+ color: string;
8
+ name?: string;
9
+ };
10
+ }): JSX.Element;
11
+ declare const _default: React.ForwardRefExoticComponent<{
12
+ layer: CustomGoogleEngineLayer;
13
+ collapsible?: boolean | undefined;
14
+ onCollapse?: (() => void) | undefined;
15
+ name: string;
16
+ } & React.RefAttributes<HTMLDivElement>>;
17
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { EarthEngineOptions } from "../interfaces";
2
+ export declare const EARTH_ENGINE_LAYER = "earthEngine";
3
+ export declare const EARTH_ENGINE_LAYERS: EarthEngineOptions[];
4
+ export declare const SUPPORTED_EARTH_ENGINE_LAYERS: string[];
@@ -0,0 +1,9 @@
1
+ import { CustomGoogleEngineLayer } from "../../../interfaces";
2
+ import { EarthEngineToken } from "../interfaces";
3
+ export declare function useGoogleEngineToken(): {
4
+ refresh: () => Promise<{
5
+ token: EarthEngineToken;
6
+ }>;
7
+ loading: boolean;
8
+ };
9
+ export default function useGoogleEngineLayer(layerId: string): CustomGoogleEngineLayer | undefined;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export default function GoogleEngineLayer({ layerId }: {
3
+ layerId: string;
4
+ }): JSX.Element | null;
@@ -0,0 +1,58 @@
1
+ import { MapOrgUnit } from "../../../../../interfaces";
2
+ export interface EarthEngineToken {
3
+ access_token: string;
4
+ client_id: string;
5
+ expires_in: number;
6
+ }
7
+ export type RefreshToken = () => Promise<{
8
+ token: EarthEngineToken;
9
+ }>;
10
+ export type DatasetType = "Image" | "ImageCollection" | "Feature" | "FeatureCollection";
11
+ export interface EarthEngineOptions {
12
+ layer: "earthEngine";
13
+ type: DatasetType;
14
+ id: string;
15
+ datasetId: string;
16
+ name: string;
17
+ unit?: string;
18
+ description: string;
19
+ source: string;
20
+ sourceUrl: string;
21
+ img: string;
22
+ defaultAggregations?: string[];
23
+ maxAggregations?: number;
24
+ periodType?: string;
25
+ filters?: string[];
26
+ legend?: {
27
+ items: {
28
+ id: number;
29
+ name: string;
30
+ color: string;
31
+ }[];
32
+ };
33
+ legacy?: boolean;
34
+ mosaic?: boolean;
35
+ bands?: {
36
+ id: string;
37
+ name: any;
38
+ multiple?: boolean;
39
+ }[];
40
+ mask?: boolean;
41
+ selectedBands?: string[];
42
+ params?: {
43
+ min: number;
44
+ max: number;
45
+ palette: string;
46
+ };
47
+ opacity: number;
48
+ notice?: string;
49
+ error?: string;
50
+ tokenType: "Bearer";
51
+ aggregations?: string[];
52
+ tileScale?: number;
53
+ methods?: Record<string, any>;
54
+ }
55
+ export interface GoogleEngineComponentProps {
56
+ options: EarthEngineOptions;
57
+ orgUnits: MapOrgUnit[];
58
+ }
@@ -0,0 +1 @@
1
+ export const AbstractOverlay: Function;
@@ -0,0 +1,55 @@
1
+ import { MapOrgUnit } from "../../../../../interfaces";
2
+ import { EarthEngineOptions, EarthEngineToken, RefreshToken } from "../interfaces";
3
+ export declare class EarthEngine {
4
+ token?: EarthEngineToken;
5
+ options: EarthEngineOptions;
6
+ refresh?: RefreshToken;
7
+ orgUnits?: MapOrgUnit[];
8
+ initialized: boolean;
9
+ period?: string | string[];
10
+ instance: any;
11
+ scale?: any;
12
+ image: any;
13
+ aggregationData: any;
14
+ constructor({ options }: {
15
+ options: EarthEngineOptions;
16
+ });
17
+ static setToken(token: EarthEngineToken, refresh: RefreshToken): Promise<void>;
18
+ setOrgUnits(orgUnits: MapOrgUnit[]): EarthEngine;
19
+ setPeriod(period: string): void;
20
+ getValue(geoJSON: any, type: string): Promise<unknown>;
21
+ getPeriod(): Promise<unknown>;
22
+ info(): Promise<unknown>;
23
+ getScale(): Promise<void>;
24
+ getFeatureCollectionAggregation(): Promise<any>;
25
+ getHistogramAggregations(): Promise<{
26
+ orgUnit: MapOrgUnit | undefined;
27
+ data: any;
28
+ }[]>;
29
+ getAggregations(): Promise<void>;
30
+ getAggregation(orgUnit: MapOrgUnit): any;
31
+ url(): Promise<string>;
32
+ protected applyPeriod(imageCollection: any): any;
33
+ protected applyMask(image: any): any;
34
+ protected applyBand(imageCollection: any): any;
35
+ protected getReducerByType(type: string): any;
36
+ protected getGeometryByType(geoJSON: any): any;
37
+ protected getFeatureByType(geoJSON: any): any;
38
+ protected getFeatureCollection(): unknown;
39
+ protected getParamsFromLegend(): {
40
+ min: number;
41
+ max: number;
42
+ palette: string;
43
+ } | undefined;
44
+ protected visualize(image: any): Promise<string>;
45
+ protected getImageCollectionInstance(): any;
46
+ protected getImageFromImageCollection(): any;
47
+ protected getImageInstance(): any;
48
+ protected getImageFromImage(): any;
49
+ protected getFeatureInstance(): any;
50
+ protected getImageFromFeature(): any;
51
+ protected getFeatureCollectionInstance(): any;
52
+ protected getImageFromFeatureCollection(): any;
53
+ protected getInstance(): void;
54
+ protected getImage(): any;
55
+ }
@@ -0,0 +1,20 @@
1
+ import { EarthEngineOptions } from "../interfaces";
2
+ export declare const combineReducers: (ee: any) => (types: string[]) => any;
3
+ export declare const getInfo: (instance: any) => Promise<unknown>;
4
+ export declare const getFeatureCollectionProperties: (data: any) => any;
5
+ export declare const getScale: (image: any) => Promise<any>;
6
+ export declare const getClassifiedImage: (eeImage: any, { legend: legends, params }: EarthEngineOptions) => {
7
+ eeImage: any;
8
+ params: {
9
+ min: number;
10
+ max: number;
11
+ palette: string;
12
+ };
13
+ };
14
+ export declare const hasClasses: (type: string) => boolean;
15
+ export declare const getHistogramStatistics: ({ data, scale, aggregationType, legend }: {
16
+ data: any;
17
+ scale: any;
18
+ aggregationType: string;
19
+ legend: any;
20
+ }) => any;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export default function LegendCardHeader({ title, collapsible, onCollapse }: {
3
+ title: string;
4
+ onCollapse?: () => void;
5
+ collapsible?: boolean;
6
+ }): JSX.Element;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { ControlPosition } from "leaflet";
3
+ import { MapLegendConfig } from "../../../MapArea/interfaces";
4
+ import { CustomGoogleEngineLayer, CustomPointLayer, CustomThematicLayer } from "../../interfaces";
5
+ export default function LegendArea({ layers, legends: legendConfig, }: {
6
+ layers: Array<CustomThematicLayer | CustomPointLayer | CustomGoogleEngineLayer>;
7
+ position: ControlPosition;
8
+ legends?: MapLegendConfig;
9
+ }): JSX.Element;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const _default: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<HTMLDivElement>>;
3
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { CustomPointLayer } from "../../../interfaces";
2
+ export declare function usePointLayer(): CustomPointLayer;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function PointLayer(): JSX.Element;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export interface BubbleProps {
3
+ radius: number;
4
+ maxRadius: number;
5
+ text?: string;
6
+ textAlign?: "left" | "right";
7
+ color?: string;
8
+ stroke?: string;
9
+ pattern?: string;
10
+ gap?: number;
11
+ }
12
+ declare const Bubble: ({ radius, maxRadius, text, textAlign, color, stroke, pattern }: BubbleProps) => JSX.Element;
13
+ export default Bubble;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ export declare const guideLength = 16;
3
+ export declare const textPadding = 4;
4
+ declare const _default: React.MemoExoticComponent<({ radiusLow, radiusHigh, color, classes }: {
5
+ radiusLow: number;
6
+ radiusHigh: number;
7
+ color?: string | undefined;
8
+ classes: any[];
9
+ }) => JSX.Element | null>;
10
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import type { Legend } from "@hisptz/dhis2-utils";
2
+ import React from "react";
3
+ import { ThematicLayerData, ThematicLayerDataItem } from "../../../../../../interfaces";
4
+ declare const _default: React.ForwardRefExoticComponent<{
5
+ radius: {
6
+ min: number;
7
+ max: number;
8
+ };
9
+ dataItem: ThematicLayerDataItem;
10
+ data: ThematicLayerData[];
11
+ name?: string | undefined;
12
+ collapsible?: boolean | undefined;
13
+ onCollapse?: (() => void) | undefined;
14
+ legends: Legend[];
15
+ } & React.RefAttributes<HTMLDivElement>>;
16
+ export default _default;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import type { Legend } from "@hisptz/dhis2-utils";
3
+ import { ThematicLayerData } from "../../../../interfaces";
4
+ export default function Bubble({ data, highestData, legends, radius, }: {
5
+ data: ThematicLayerData;
6
+ highestData: number;
7
+ legends: Legend[];
8
+ radius?: {
9
+ min: number;
10
+ max: number;
11
+ };
12
+ }): JSX.Element;
@@ -0,0 +1,21 @@
1
+ import "../../../styles/legends.css";
2
+ import type { Legend } from "@hisptz/dhis2-utils";
3
+ import React from "react";
4
+ import { ThematicLayerData, ThematicLayerDataItem } from "../../../../../interfaces";
5
+ export declare function LegendItem({ legend, value }: {
6
+ legend: {
7
+ startValue: number;
8
+ endValue: number;
9
+ color: string;
10
+ };
11
+ value: number;
12
+ }): JSX.Element;
13
+ declare const _default: React.ForwardRefExoticComponent<{
14
+ data: ThematicLayerData[];
15
+ dataItem: ThematicLayerDataItem;
16
+ name?: string | undefined;
17
+ collapsible?: boolean | undefined;
18
+ onCollapse?: (() => void) | undefined;
19
+ legends: Legend[];
20
+ } & React.RefAttributes<HTMLDivElement>>;
21
+ export default _default;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import type { Legend } from "@hisptz/dhis2-utils";
3
+ import { MapOrgUnit } from "../../../../../../interfaces";
4
+ import { ThematicLayerDataItem } from "../../../../interfaces";
5
+ export default function Choropleth({ data, legends }: {
6
+ data: {
7
+ orgUnit: MapOrgUnit;
8
+ data?: number;
9
+ dataItem: ThematicLayerDataItem;
10
+ };
11
+ legends: Legend[];
12
+ }): JSX.Element;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { ThematicLayerData } from "../../../../interfaces";
3
+ export default function CustomTooltip({ data: dataObject }: {
4
+ data: ThematicLayerData;
5
+ }): JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { CustomThematicLayer } from "../../../interfaces";
2
+ export default function useThematicLayer(layerId: string): CustomThematicLayer | undefined;