@redus/georedus-ui 0.2.0 → 0.3.1
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/CHANGELOG.md +18 -0
- package/dist/GeoReDUS/GeoReDUS.d.ts +0 -1
- package/dist/GeoReDUS/viewConfReducer.d.ts +4 -4
- package/dist/GeoReDUSWorker/methods/buffer.d.ts +7 -0
- package/dist/GeoReDUSWorker.worker.js +44 -3
- package/dist/main.js +926 -581
- package/dist/viewSpecs/presets/cem_censo_2010_2022/index.d.ts +71 -60
- package/dist/viewSpecs/resolveView/resolveView.d.ts +15 -9
- package/dist/viewSpecs/resolveView/tmp_resolveView.future.d.ts +14 -0
- package/dist/viewSpecs/types.d.ts +51 -22
- package/dist/viewSpecs/useViews/index.d.ts +1 -0
- package/dist/viewSpecs/useViews/queryKeyHashFnWithFileSupport.d.ts +2 -0
- package/dist/viewSpecs/useViews/useViews.d.ts +12 -0
- package/dist/viewSpecs/util/index.d.ts +1 -0
- package/dist/viewSpecs/util/zoomSensitiveLinearSizes.d.ts +10 -0
- package/package.json +2 -2
|
@@ -6,7 +6,7 @@ export function cem_censo_2010_2022(viewSpec: any, allViewSpecs: any, context: a
|
|
|
6
6
|
sourceLabel: string;
|
|
7
7
|
viewType: string;
|
|
8
8
|
keywords: any[];
|
|
9
|
-
|
|
9
|
+
confSchema: {
|
|
10
10
|
data: {
|
|
11
11
|
variableId: {
|
|
12
12
|
label: string;
|
|
@@ -29,11 +29,10 @@ export function cem_censo_2010_2022(viewSpec: any, allViewSpecs: any, context: a
|
|
|
29
29
|
inactive: {
|
|
30
30
|
[x: string]: any;
|
|
31
31
|
$$resolver: symbol;
|
|
32
|
-
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
33
|
-
dependencies: any;
|
|
34
|
-
value: (...args: any[]) => any;
|
|
35
|
-
defaultValue?: any;
|
|
36
32
|
context?: any;
|
|
33
|
+
defaultValue?: import("@orioro/resolve").ResolutionNode | any;
|
|
34
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
35
|
+
value: any;
|
|
37
36
|
};
|
|
38
37
|
clearable: boolean;
|
|
39
38
|
type: string;
|
|
@@ -50,11 +49,10 @@ export function cem_censo_2010_2022(viewSpec: any, allViewSpecs: any, context: a
|
|
|
50
49
|
label: {
|
|
51
50
|
[x: string]: any;
|
|
52
51
|
$$resolver: symbol;
|
|
53
|
-
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
54
|
-
dependencies: any;
|
|
55
|
-
value: (...args: any[]) => any;
|
|
56
|
-
defaultValue?: any;
|
|
57
52
|
context?: any;
|
|
53
|
+
defaultValue?: import("@orioro/resolve").ResolutionNode | any;
|
|
54
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
55
|
+
value: any;
|
|
58
56
|
};
|
|
59
57
|
helperText: string;
|
|
60
58
|
min: number;
|
|
@@ -64,22 +62,20 @@ export function cem_censo_2010_2022(viewSpec: any, allViewSpecs: any, context: a
|
|
|
64
62
|
inactive: {
|
|
65
63
|
[x: string]: any;
|
|
66
64
|
$$resolver: symbol;
|
|
67
|
-
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
68
|
-
dependencies: any;
|
|
69
|
-
value: (...args: any[]) => any;
|
|
70
|
-
defaultValue?: any;
|
|
71
65
|
context?: any;
|
|
66
|
+
defaultValue?: import("@orioro/resolve").ResolutionNode | any;
|
|
67
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
68
|
+
value: any;
|
|
72
69
|
};
|
|
73
70
|
};
|
|
74
71
|
dissolveOverlappingGeometries: {
|
|
75
72
|
inactive: {
|
|
76
73
|
[x: string]: any;
|
|
77
74
|
$$resolver: symbol;
|
|
78
|
-
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
79
|
-
dependencies: any;
|
|
80
|
-
value: (...args: any[]) => any;
|
|
81
|
-
defaultValue?: any;
|
|
82
75
|
context?: any;
|
|
76
|
+
defaultValue?: import("@orioro/resolve").ResolutionNode | any;
|
|
77
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
78
|
+
value: any;
|
|
83
79
|
};
|
|
84
80
|
type: string;
|
|
85
81
|
label: string;
|
|
@@ -99,52 +95,67 @@ export function cem_censo_2010_2022(viewSpec: any, allViewSpecs: any, context: a
|
|
|
99
95
|
};
|
|
100
96
|
};
|
|
101
97
|
};
|
|
102
|
-
metadata:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
98
|
+
metadata: {
|
|
99
|
+
_dependencies: ({ viewConfState }: {
|
|
100
|
+
viewConfState: any;
|
|
101
|
+
}) => string;
|
|
102
|
+
_value: (string | {
|
|
103
|
+
customGeoJSON: (string | (string | string[])[] | {
|
|
104
|
+
[x: string]: any;
|
|
105
|
+
$$resolver: symbol;
|
|
106
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
107
|
+
dependencies: any;
|
|
108
|
+
value: (...args: any[]) => any;
|
|
109
|
+
defaultValue?: any;
|
|
110
|
+
context?: any;
|
|
111
|
+
} | null)[];
|
|
112
|
+
} | (string | {
|
|
113
|
+
variableValues: (string | (string | (string | (string | {
|
|
114
|
+
variableId: string[];
|
|
115
|
+
municipioId: string[];
|
|
116
|
+
source_table_id: any[];
|
|
117
|
+
})[])[])[] | (string | {
|
|
118
|
+
href: any;
|
|
119
|
+
pathname: string;
|
|
120
|
+
method?: undefined;
|
|
121
|
+
headers?: undefined;
|
|
122
|
+
body?: undefined;
|
|
123
|
+
} | {
|
|
124
|
+
method: string;
|
|
125
|
+
headers: {
|
|
126
|
+
'Content-Type': string;
|
|
127
|
+
};
|
|
128
|
+
body: {
|
|
129
|
+
geometries: (string | string[])[];
|
|
130
|
+
view: string;
|
|
131
|
+
agg_column: string[];
|
|
132
|
+
agg_type: (string | (string | string[])[])[];
|
|
133
|
+
};
|
|
134
|
+
href?: undefined;
|
|
135
|
+
pathname?: undefined;
|
|
136
|
+
})[])[];
|
|
137
|
+
labels?: undefined;
|
|
138
|
+
measureUnits?: undefined;
|
|
139
|
+
customGeoJSON?: undefined;
|
|
140
|
+
customGeoJSON2?: undefined;
|
|
141
|
+
colorScaleStops?: undefined;
|
|
123
142
|
} | {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
143
|
+
labels: any;
|
|
144
|
+
measureUnits: any;
|
|
145
|
+
variableValues: string[];
|
|
146
|
+
customGeoJSON: string[];
|
|
147
|
+
customGeoJSON2: {
|
|
148
|
+
[x: string]: any;
|
|
149
|
+
$$resolver: symbol;
|
|
150
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
151
|
+
dependencies: any;
|
|
152
|
+
value: (...args: any[]) => any;
|
|
153
|
+
defaultValue?: any;
|
|
154
|
+
context?: any;
|
|
127
155
|
};
|
|
128
|
-
|
|
129
|
-
geometries: (string | string[])[];
|
|
130
|
-
view: string;
|
|
131
|
-
agg_column: string[];
|
|
132
|
-
agg_type: (string | (string | string[])[])[];
|
|
133
|
-
};
|
|
134
|
-
href?: undefined;
|
|
135
|
-
pathname?: undefined;
|
|
156
|
+
colorScaleStops: any[];
|
|
136
157
|
})[])[];
|
|
137
|
-
|
|
138
|
-
measureUnits?: undefined;
|
|
139
|
-
customGeoJSON?: undefined;
|
|
140
|
-
colorScaleStops?: undefined;
|
|
141
|
-
} | {
|
|
142
|
-
labels: any;
|
|
143
|
-
measureUnits: any;
|
|
144
|
-
variableValues: string[];
|
|
145
|
-
customGeoJSON: string[];
|
|
146
|
-
colorScaleStops: any[];
|
|
147
|
-
})[])[];
|
|
158
|
+
};
|
|
148
159
|
sources: {
|
|
149
160
|
customGeoJSON_Points: (string | {
|
|
150
161
|
[x: string]: any;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare
|
|
1
|
+
import { ResolvedView, ResolvedViewConf, ViewSpec, ViewResolutionContextBase } from '../types';
|
|
2
|
+
export declare const STAGE_VALUE_KEY = "_value";
|
|
3
|
+
export declare const STAGE_SPECIAL_KEYS: string[];
|
|
4
|
+
export declare function resolveConfSchema(viewSpec: ViewSpec, partialView: Partial<ResolvedView>, viewResolutionContextBase: ViewResolutionContextBase): Partial<ResolvedView>;
|
|
5
|
+
export declare const resolveMetadata: (viewSpec: ViewSpec, partialViewAtStage: Pick<ResolvedView, "conf">, viewResolutionContextBase: ViewResolutionContextBase) => Promise<import("../types").ViewMetadata>;
|
|
6
|
+
export declare const resolveSources: (viewSpec: ViewSpec, partialViewAtStage: Pick<ResolvedView, "conf" | "metadata">, viewResolutionContextBase: ViewResolutionContextBase) => Promise<Record<string, any>>;
|
|
7
|
+
export declare const resolveLayers: (viewSpec: ViewSpec, partialViewAtStage: Pick<ResolvedView, "conf" | "sources" | "metadata">, viewResolutionContextBase: ViewResolutionContextBase) => Promise<Record<string, import("@orioro/react-maplibre-util").MapViewLayer>>;
|
|
8
|
+
export declare const resolveControls: (viewSpec: ViewSpec, partialViewAtStage: Pick<ResolvedView, "conf" | "sources" | "layers" | "metadata">, viewResolutionContextBase: ViewResolutionContextBase) => Promise<import("../types").ViewControls>;
|
|
9
|
+
export declare const resolveDownload: (viewSpec: ViewSpec, partialViewAtStage: Pick<ResolvedView, "conf" | "sources" | "layers" | "metadata">, viewResolutionContextBase: ViewResolutionContextBase) => Promise<import("../types").ViewDownload>;
|
|
10
|
+
export declare function resolveView(viewSpec: ViewSpec, viewConf: ResolvedViewConf, viewResolutionContextBase: ViewResolutionContextBase): Promise<{
|
|
3
11
|
id: string;
|
|
4
12
|
keywords: string | string[] | undefined;
|
|
5
|
-
metadata:
|
|
6
|
-
sources:
|
|
7
|
-
layers:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
legends: any;
|
|
11
|
-
download: unknown;
|
|
13
|
+
metadata: import("../types").ViewMetadata;
|
|
14
|
+
sources: Record<string, any>;
|
|
15
|
+
layers: Record<string, import("@orioro/react-maplibre-util").MapViewLayer>;
|
|
16
|
+
controls: import("../types").ViewControls;
|
|
17
|
+
download: import("../types").ViewDownload;
|
|
12
18
|
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ResolvedView, ResolvedViewConf, ViewSpec, ViewResolutionContextBase } from '../types';
|
|
2
|
+
export declare const resolveViewMetadata: (viewSpec: ViewSpec, partialViewAtStage: Pick<ResolvedView, "conf">, viewResolutionContextBase: ViewResolutionContextBase) => Promise<import("../types").ViewMetadata>;
|
|
3
|
+
export declare const resolveViewSources: (viewSpec: ViewSpec, partialViewAtStage: Pick<ResolvedView, "conf" | "metadata">, viewResolutionContextBase: ViewResolutionContextBase) => Promise<Record<string, any>>;
|
|
4
|
+
export declare function resolveView(viewSpec: ViewSpec, viewConf: ResolvedViewConf, viewResolutionContextBase: ViewResolutionContextBase): Promise<{
|
|
5
|
+
id: string;
|
|
6
|
+
keywords: string | string[] | undefined;
|
|
7
|
+
metadata: import("../types").ViewMetadata;
|
|
8
|
+
sources: Record<string, any>;
|
|
9
|
+
layers: {
|
|
10
|
+
[k: string]: any;
|
|
11
|
+
};
|
|
12
|
+
legends: any;
|
|
13
|
+
download: unknown;
|
|
14
|
+
}>;
|
|
@@ -1,38 +1,67 @@
|
|
|
1
1
|
import { MapView, MapViewLayer, MapViewSource } from '@orioro/react-maplibre-util';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ViewConf, ViewConfState } from '../GeoReDUS/viewConfReducer';
|
|
4
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
5
|
export type ExpressionOf<ResultT> = ResultT | [string, ...any[]];
|
|
3
|
-
export type ViewMetadata =
|
|
4
|
-
|
|
5
|
-
data?: Record<string, Record<string, any>>;
|
|
6
|
-
style?: Record<string, Record<string, any>>;
|
|
6
|
+
export type ViewMetadata = {
|
|
7
|
+
[key: string]: any;
|
|
7
8
|
};
|
|
9
|
+
export type ViewResolutionContextBase = {
|
|
10
|
+
viewSpecs: ViewSpec[];
|
|
11
|
+
viewConfState: ViewConfState;
|
|
12
|
+
app: AppContext;
|
|
13
|
+
};
|
|
14
|
+
type StageSpec<Spec extends {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}, PartialViewAtState extends Partial<ResolvedView | null>> = Spec & {
|
|
17
|
+
_loading?: MapView & {
|
|
18
|
+
message?: React.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
_dependencies?: (resolutionCtx: ViewResolutionContextBase & {
|
|
21
|
+
view: PartialViewAtState;
|
|
22
|
+
}) => any;
|
|
23
|
+
_value?: Spec;
|
|
24
|
+
_query?: Pick<UseQueryOptions, 'gcTime'>;
|
|
25
|
+
};
|
|
26
|
+
export type ViewMetadataSpec = StageSpec<ViewMetadata, Pick<ResolvedView, 'conf'>>;
|
|
27
|
+
export type ViewSources = {
|
|
28
|
+
[key: string]: MapViewSource;
|
|
29
|
+
};
|
|
30
|
+
export type ViewSourcesSpec = StageSpec<ViewSources, Pick<ResolvedView, 'conf' | 'metadata'>>;
|
|
31
|
+
export type ViewLayers = {
|
|
32
|
+
[key: string]: MapViewLayer;
|
|
33
|
+
};
|
|
34
|
+
export type ViewLayersSpec = StageSpec<ViewLayers, Pick<ResolvedView, 'conf' | 'metadata' | 'sources'>>;
|
|
35
|
+
export type ViewControls = {
|
|
36
|
+
legends?: MapView['legends'];
|
|
37
|
+
};
|
|
38
|
+
export type ViewControlsSpec = StageSpec<ViewControls, Pick<ResolvedView, 'conf' | 'metadata' | 'sources' | 'layers'>>;
|
|
39
|
+
export type ViewDownload = (conf: {
|
|
40
|
+
dialogs: Record<string, any>;
|
|
41
|
+
}) => Promise<any>;
|
|
42
|
+
export type ViewDownloadSpec = StageSpec<ViewDownload, Pick<ResolvedView, 'conf' | 'metadata' | 'sources' | 'layers'>>;
|
|
43
|
+
export type ViewStageKey = 'metadata' | 'sources' | 'layers' | 'controls' | 'download';
|
|
8
44
|
export type ViewSpec = {
|
|
9
45
|
id: string;
|
|
10
46
|
debug?: boolean;
|
|
11
47
|
keywords?: string | string[];
|
|
12
|
-
metadata:
|
|
13
|
-
sources:
|
|
14
|
-
layers:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
export type ResolvedViewConf = {
|
|
48
|
+
metadata: ViewMetadataSpec;
|
|
49
|
+
sources: ViewSourcesSpec;
|
|
50
|
+
layers: ViewLayersSpec;
|
|
51
|
+
controls: ViewControlsSpec;
|
|
52
|
+
download?: ViewDownloadSpec;
|
|
53
|
+
};
|
|
54
|
+
export type ResolvedViewConf = ViewConf & {
|
|
21
55
|
data?: Record<string, any>;
|
|
22
56
|
style?: Record<string, any>;
|
|
23
57
|
};
|
|
24
|
-
type ResolvedLegend = Record<string, any>;
|
|
25
58
|
export type ResolvedView = MapView & {
|
|
26
|
-
metadata: ViewMetadata;
|
|
27
|
-
legends: ResolvedLegend[];
|
|
28
59
|
conf: ResolvedViewConf;
|
|
60
|
+
metadata: ViewMetadata;
|
|
61
|
+
controls: ViewControls;
|
|
62
|
+
download: ViewDownload;
|
|
29
63
|
};
|
|
30
|
-
export type
|
|
31
|
-
focus: {
|
|
32
|
-
type: 'municipio';
|
|
33
|
-
ids: string[];
|
|
34
|
-
} | null;
|
|
35
|
-
};
|
|
64
|
+
export type AppContext = Record<string, any>;
|
|
36
65
|
export type PresetFn<InputT extends Record<string, any> = Record<string, any>> = (input: InputT) => ViewSpec;
|
|
37
66
|
export type ResolveViewSpecsContext = {
|
|
38
67
|
METADATA_API_ENDPOINT: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useViews';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import { ResolvedView, ViewResolutionContextBase, ViewSpec } from '../types';
|
|
3
|
+
export declare function useViews(viewResolutionContextBase: ViewResolutionContextBase): {
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
metadataQueries: UseQueryResult<unknown, Error>[];
|
|
6
|
+
sourcesQueries: UseQueryResult<unknown, Error>[];
|
|
7
|
+
layersQueries: UseQueryResult<unknown, Error>[];
|
|
8
|
+
controlsQueries: UseQueryResult<unknown, Error>[];
|
|
9
|
+
downloadQueries: UseQueryResult<unknown, Error>[];
|
|
10
|
+
resolvedViews: Partial<ResolvedView>[];
|
|
11
|
+
resolvedViewSpecs: ViewSpec[];
|
|
12
|
+
};
|
|
@@ -45,5 +45,6 @@ export * from "./colorSchemes";
|
|
|
45
45
|
export * from "./filter";
|
|
46
46
|
export * from "./setupVariants";
|
|
47
47
|
export * from "./downloadResolver";
|
|
48
|
+
export * from "./zoomSensitiveLinearSizes";
|
|
48
49
|
export const BASE_MAP_LAYERS_Z_INDEX_BASE: 100;
|
|
49
50
|
export const ABOVE_BASE_MAP_LAYERS_Z_INDEX_BASE: 1000;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type ZoomSensitiveLinearSizesProps = {
|
|
2
|
+
variable: any;
|
|
3
|
+
minValue?: any;
|
|
4
|
+
maxValue?: any;
|
|
5
|
+
minSize: number;
|
|
6
|
+
maxSize: number;
|
|
7
|
+
zoomBreakpoint?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function zoomSensitiveLinearSizes({ variable, minValue, maxValue, minSize, maxSize, zoomBreakpoint, }: ZoomSensitiveLinearSizesProps): (string | number | any[])[];
|
|
10
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redus/georedus-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"packageManager": "yarn@4.0.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@orioro/react-csv": "^0.0.2",
|
|
44
44
|
"@orioro/react-dialogs": "^0.0.2",
|
|
45
45
|
"@orioro/react-dir-nav": "^0.1.0",
|
|
46
|
-
"@orioro/react-maplibre-util": "^0.
|
|
46
|
+
"@orioro/react-maplibre-util": "^0.3.1",
|
|
47
47
|
"@orioro/react-sortable": "^0.0.2",
|
|
48
48
|
"@orioro/react-ui-core": "^0.0.6",
|
|
49
49
|
"@orioro/resolve": "^0.1.2",
|