@redus/georedus-ui 0.8.1 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/main.js +46 -10
- package/dist/viewSpecs/presets/cem_censo_2010_2022/index.d.ts +93 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @orioro/template-react
|
|
2
2
|
|
|
3
|
+
## 0.8.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- update dev metadata api url
|
|
8
|
+
|
|
9
|
+
## 0.8.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @orioro/react-maplibre-util@0.5.2
|
|
15
|
+
|
|
16
|
+
## 0.8.4
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @orioro/react-maplibre-util@0.5.1
|
|
22
|
+
|
|
23
|
+
## 0.8.3
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
- @orioro/react-maplibre-util@0.5.0
|
|
29
|
+
|
|
30
|
+
## 0.8.2
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- apply bounds to censo 2010 and 2022 sources
|
|
35
|
+
|
|
3
36
|
## 0.8.1
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -18,6 +18,7 @@ import { CsvImportDialog } from '@orioro/react-csv';
|
|
|
18
18
|
import Highlighter from 'react-highlight-words';
|
|
19
19
|
import { makeSortableMultiList } from '@orioro/react-sortable';
|
|
20
20
|
import { fmtLayerAbsoluteId, makeSyncedMaps, LayeredMap, HoverTooltip, ControlContainer, InspectControl, MapWindow, TerrainControl, fitGeometry } from '@orioro/react-maplibre-util';
|
|
21
|
+
import '@maplibre/maplibre-gl-inspect/dist/maplibre-gl-inspect.css';
|
|
21
22
|
import { Legend } from '@orioro/react-chart-util';
|
|
22
23
|
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
23
24
|
import { useQueries, useQuery } from '@tanstack/react-query';
|
|
@@ -4332,7 +4333,7 @@ var _a;
|
|
|
4332
4333
|
//
|
|
4333
4334
|
// TODO: set dynamic values
|
|
4334
4335
|
//
|
|
4335
|
-
var HARD_CODED_ALLOW_FETCH_SOURCES = (_a = {}, _a['https://dev-geoapi-metadata.orioro.design'] = ['GET', 'POST'], _a['http://localhost:
|
|
4336
|
+
var HARD_CODED_ALLOW_FETCH_SOURCES = (_a = {}, _a['https://dev-geoapi-metadata.orioro.design'] = ['GET', 'POST'], _a['http://localhost:8001'] = ['GET', 'POST'], _a);
|
|
4336
4337
|
console.warn('TODO: remove HARD_CODED_ALLOW_FETCH_SOURCES');
|
|
4337
4338
|
function isFetchAllowed(resource, options) {
|
|
4338
4339
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -5243,9 +5244,11 @@ var DEFAULT_BUFFER_SIZE = 200;
|
|
|
5243
5244
|
var INSUFFICIENT_DATA_COLOR = 'red';
|
|
5244
5245
|
var BUILDINGS_MIN_ZOOM = 14;
|
|
5245
5246
|
var BUILDINGS_3D_MIN_ZOOM = 16;
|
|
5247
|
+
var UNBOUNDED_BOUNDS = [-180, -90, 180, 90];
|
|
5246
5248
|
|
|
5247
5249
|
//
|
|
5248
|
-
//
|
|
5250
|
+
// TODO: deprecate in favor of applying buffers
|
|
5251
|
+
// inside worker
|
|
5249
5252
|
//
|
|
5250
5253
|
function _applyBuffers(geometry) {
|
|
5251
5254
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
@@ -5387,6 +5390,26 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
|
|
|
5387
5390
|
}]));
|
|
5388
5391
|
return url;
|
|
5389
5392
|
});
|
|
5393
|
+
var _resolveSourceBounds = resolve.fn(function (context) {
|
|
5394
|
+
try {
|
|
5395
|
+
var _context$view$metadat;
|
|
5396
|
+
var coordinates = (_context$view$metadat = context.view.metadata.municipioData) === null || _context$view$metadat === void 0 || (_context$view$metadat = _context$view$metadat.bbox) === null || _context$view$metadat === void 0 ? void 0 : _context$view$metadat.coordinates;
|
|
5397
|
+
if (!coordinates) {
|
|
5398
|
+
return UNBOUNDED_BOUNDS;
|
|
5399
|
+
}
|
|
5400
|
+
var _coordinates$0$ = _slicedToArray(coordinates[0][0], 2),
|
|
5401
|
+
west = _coordinates$0$[0],
|
|
5402
|
+
south = _coordinates$0$[1]; // first point: lower-left (southwest)
|
|
5403
|
+
var _coordinates$0$2 = _slicedToArray(coordinates[0][2], 2),
|
|
5404
|
+
east = _coordinates$0$2[0],
|
|
5405
|
+
north = _coordinates$0$2[1]; // third point: upper-right (northeast)
|
|
5406
|
+
|
|
5407
|
+
return [west, south, east, north]; // [minX, minY, maxX, maxY]
|
|
5408
|
+
} catch (err) {
|
|
5409
|
+
console.warn("error while retrieving bounds", err);
|
|
5410
|
+
return UNBOUNDED_BOUNDS;
|
|
5411
|
+
}
|
|
5412
|
+
});
|
|
5390
5413
|
return {
|
|
5391
5414
|
// debug: true,
|
|
5392
5415
|
id: viewId,
|
|
@@ -5585,18 +5608,29 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
|
|
|
5585
5608
|
agg_column: ['$get', 'view.conf.data.variableId'],
|
|
5586
5609
|
agg_type: ['$if', ['$endsWith', ['$get', 'view.conf.data.variableId'], '_pct'], 'weighted_avg', 'sum']
|
|
5587
5610
|
}
|
|
5588
|
-
}]]
|
|
5611
|
+
}]],
|
|
5612
|
+
municipioData: ['$get', '0', ['$fetch', resolve.fn(function (context) {
|
|
5613
|
+
return "".concat(METADATA_API_ENDPOINT, "/ibge_malha_br_municipio?select=bbox&id=eq.").concat(context.app.municipioId);
|
|
5614
|
+
})]]
|
|
5589
5615
|
}, {
|
|
5590
5616
|
labels: labels,
|
|
5591
5617
|
measureUnits: measureUnits,
|
|
5592
5618
|
variableValues: ['$get', 'variableValues'],
|
|
5619
|
+
municipioData: ['$get', 'municipioData'],
|
|
5593
5620
|
customGeoJSON: ['$get', 'customGeoJSON'],
|
|
5594
5621
|
colorScaleStops: ['$naturalBreaks', ['$get', 'variableValues'], _objectSpread2(_objectSpread2({}, _color_scheme), {}, {
|
|
5595
5622
|
minK: 5
|
|
5596
5623
|
})]
|
|
5597
5624
|
}]]
|
|
5598
5625
|
},
|
|
5599
|
-
sources: _objectSpread2(_objectSpread2({}, globalRes.sources)
|
|
5626
|
+
sources: _objectSpread2(_objectSpread2({}, Object.fromEntries(Object.entries(globalRes.sources).map(function (_ref3) {
|
|
5627
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
5628
|
+
key = _ref4[0],
|
|
5629
|
+
spec = _ref4[1];
|
|
5630
|
+
return [key, _objectSpread2(_objectSpread2({}, spec), {}, {
|
|
5631
|
+
bounds: _resolveSourceBounds
|
|
5632
|
+
})];
|
|
5633
|
+
}))), {}, _defineProperty(_defineProperty({
|
|
5600
5634
|
//
|
|
5601
5635
|
// Points in custom GeoJson
|
|
5602
5636
|
//
|
|
@@ -5627,9 +5661,9 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
|
|
|
5627
5661
|
// The area of customGeoJson
|
|
5628
5662
|
//
|
|
5629
5663
|
customGeoJSON_Areas: ['$if', [['$empty', ['$get', 'view.metadata.customGeoJSON.AREAS']]], null, resolve.fn(function (context) {
|
|
5630
|
-
var _context$view$
|
|
5631
|
-
customGeoJSON = _context$view$
|
|
5632
|
-
variableValues = _context$view$
|
|
5664
|
+
var _context$view$metadat2 = context.view.metadata,
|
|
5665
|
+
customGeoJSON = _context$view$metadat2.customGeoJSON,
|
|
5666
|
+
variableValues = _context$view$metadat2.variableValues;
|
|
5633
5667
|
if (!(customGeoJSON !== null && customGeoJSON !== void 0 && customGeoJSON.AREAS)) {
|
|
5634
5668
|
return null;
|
|
5635
5669
|
}
|
|
@@ -5658,6 +5692,7 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
|
|
|
5658
5692
|
//
|
|
5659
5693
|
maxzoom: BUILDINGS_MIN_ZOOM,
|
|
5660
5694
|
promoteId: 'cd_setor',
|
|
5695
|
+
bounds: _resolveSourceBounds,
|
|
5661
5696
|
tiles: [resolve.fn(function (context) {
|
|
5662
5697
|
var _variableId = get$1(context, 'view.conf.data.variableId');
|
|
5663
5698
|
var _variant = variantsByVariableId[_variableId];
|
|
@@ -5677,6 +5712,7 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
|
|
|
5677
5712
|
attribution: sourceLabel,
|
|
5678
5713
|
minzoom: BUILDINGS_MIN_ZOOM,
|
|
5679
5714
|
maxzoom: BUILDINGS_MIN_ZOOM,
|
|
5715
|
+
bounds: _resolveSourceBounds,
|
|
5680
5716
|
// Zoom levels make no real difference, buildings
|
|
5681
5717
|
// are pretty square
|
|
5682
5718
|
// maxzoom: 20,
|
|
@@ -5860,12 +5896,12 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
|
|
|
5860
5896
|
// availableVariableIds: [variable_id, 'str_nome_fantasia', 'id_cnes'],
|
|
5861
5897
|
fetchData: resolve.fn(function (context) {
|
|
5862
5898
|
return /*#__PURE__*/function () {
|
|
5863
|
-
var
|
|
5899
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref5) {
|
|
5864
5900
|
var data, geometries;
|
|
5865
5901
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
5866
5902
|
while (1) switch (_context2.prev = _context2.next) {
|
|
5867
5903
|
case 0:
|
|
5868
|
-
|
|
5904
|
+
_ref5.variableIds, _ref5.options;
|
|
5869
5905
|
_context2.next = 3;
|
|
5870
5906
|
return resolveExprAsync(['$fetch', ['$template', "".concat(METADATA_API_ENDPOINT) + '/${source_table_id}?select=' + '${variableId},' + 'cd_setor' + '&cd_mun=eq.' + '${municipioId}', {
|
|
5871
5907
|
variableId: ['$get', 'view.conf.data.variableId'],
|
|
@@ -5891,7 +5927,7 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
|
|
|
5891
5927
|
}, _callee2);
|
|
5892
5928
|
}));
|
|
5893
5929
|
return function (_x2) {
|
|
5894
|
-
return
|
|
5930
|
+
return _ref6.apply(this, arguments);
|
|
5895
5931
|
};
|
|
5896
5932
|
}();
|
|
5897
5933
|
})
|
|
@@ -135,6 +135,15 @@ export function cem_censo_2010_2022(viewSpec: any, allViewSpecs: any, context: a
|
|
|
135
135
|
href?: undefined;
|
|
136
136
|
pathname?: undefined;
|
|
137
137
|
})[])[];
|
|
138
|
+
municipioData: (string | (string | {
|
|
139
|
+
[x: string]: any;
|
|
140
|
+
$$resolver: symbol;
|
|
141
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
142
|
+
dependencies: any;
|
|
143
|
+
value: (...args: any[]) => any;
|
|
144
|
+
defaultValue?: any;
|
|
145
|
+
context?: any;
|
|
146
|
+
})[])[];
|
|
138
147
|
labels?: undefined;
|
|
139
148
|
measureUnits?: undefined;
|
|
140
149
|
customGeoJSON?: undefined;
|
|
@@ -143,11 +152,95 @@ export function cem_censo_2010_2022(viewSpec: any, allViewSpecs: any, context: a
|
|
|
143
152
|
labels: any;
|
|
144
153
|
measureUnits: any;
|
|
145
154
|
variableValues: string[];
|
|
155
|
+
municipioData: string[];
|
|
146
156
|
customGeoJSON: string[];
|
|
147
157
|
colorScaleStops: any[];
|
|
148
158
|
})[])[];
|
|
149
159
|
};
|
|
150
160
|
sources: {
|
|
161
|
+
[x: string]: {
|
|
162
|
+
bounds: {
|
|
163
|
+
[x: string]: any;
|
|
164
|
+
$$resolver: symbol;
|
|
165
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
166
|
+
dependencies: any;
|
|
167
|
+
value: (...args: any[]) => any;
|
|
168
|
+
defaultValue?: any;
|
|
169
|
+
context?: any;
|
|
170
|
+
};
|
|
171
|
+
type: string;
|
|
172
|
+
tiles: string[];
|
|
173
|
+
minzoom: number;
|
|
174
|
+
maxzoom: number;
|
|
175
|
+
} | {
|
|
176
|
+
bounds: {
|
|
177
|
+
[x: string]: any;
|
|
178
|
+
$$resolver: symbol;
|
|
179
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
180
|
+
dependencies: any;
|
|
181
|
+
value: (...args: any[]) => any;
|
|
182
|
+
defaultValue?: any;
|
|
183
|
+
context?: any;
|
|
184
|
+
};
|
|
185
|
+
type: string;
|
|
186
|
+
tiles: string[];
|
|
187
|
+
} | (string | {
|
|
188
|
+
[x: string]: any;
|
|
189
|
+
$$resolver: symbol;
|
|
190
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
191
|
+
dependencies: any;
|
|
192
|
+
value: (...args: any[]) => any;
|
|
193
|
+
defaultValue?: any;
|
|
194
|
+
context?: any;
|
|
195
|
+
} | (string | string[])[][] | null)[] | {
|
|
196
|
+
type: string;
|
|
197
|
+
attribution: string;
|
|
198
|
+
minzoom: number;
|
|
199
|
+
maxzoom: number;
|
|
200
|
+
promoteId: string;
|
|
201
|
+
bounds: {
|
|
202
|
+
[x: string]: any;
|
|
203
|
+
$$resolver: symbol;
|
|
204
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
205
|
+
dependencies: any;
|
|
206
|
+
value: (...args: any[]) => any;
|
|
207
|
+
defaultValue?: any;
|
|
208
|
+
context?: any;
|
|
209
|
+
};
|
|
210
|
+
tiles: {
|
|
211
|
+
[x: string]: any;
|
|
212
|
+
$$resolver: symbol;
|
|
213
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
214
|
+
dependencies: any;
|
|
215
|
+
value: (...args: any[]) => any;
|
|
216
|
+
defaultValue?: any;
|
|
217
|
+
context?: any;
|
|
218
|
+
}[];
|
|
219
|
+
} | {
|
|
220
|
+
type: string;
|
|
221
|
+
attribution: string;
|
|
222
|
+
minzoom: number;
|
|
223
|
+
maxzoom: number;
|
|
224
|
+
bounds: {
|
|
225
|
+
[x: string]: any;
|
|
226
|
+
$$resolver: symbol;
|
|
227
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
228
|
+
dependencies: any;
|
|
229
|
+
value: (...args: any[]) => any;
|
|
230
|
+
defaultValue?: any;
|
|
231
|
+
context?: any;
|
|
232
|
+
};
|
|
233
|
+
tiles: {
|
|
234
|
+
[x: string]: any;
|
|
235
|
+
$$resolver: symbol;
|
|
236
|
+
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|
|
237
|
+
dependencies: any;
|
|
238
|
+
value: (...args: any[]) => any;
|
|
239
|
+
defaultValue?: any;
|
|
240
|
+
context?: any;
|
|
241
|
+
}[];
|
|
242
|
+
promoteId?: undefined;
|
|
243
|
+
};
|
|
151
244
|
customGeoJSON_Points: (string | {
|
|
152
245
|
[x: string]: any;
|
|
153
246
|
$$resolver: symbol;
|
|
@@ -175,16 +268,6 @@ export function cem_censo_2010_2022(viewSpec: any, allViewSpecs: any, context: a
|
|
|
175
268
|
defaultValue?: any;
|
|
176
269
|
context?: any;
|
|
177
270
|
} | (string | string[])[][] | null)[];
|
|
178
|
-
planet: {
|
|
179
|
-
type: string;
|
|
180
|
-
tiles: string[];
|
|
181
|
-
};
|
|
182
|
-
global_municipio: {
|
|
183
|
-
type: string;
|
|
184
|
-
tiles: string[];
|
|
185
|
-
minzoom: number;
|
|
186
|
-
maxzoom: number;
|
|
187
|
-
};
|
|
188
271
|
};
|
|
189
272
|
layers: {
|
|
190
273
|
customGeoJSON_Areas_fill: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redus/georedus-ui",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6",
|
|
4
4
|
"packageManager": "yarn@4.0.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@orioro/react-csv": "^0.0.2",
|
|
53
53
|
"@orioro/react-dialogs": "^0.0.2",
|
|
54
54
|
"@orioro/react-dir-nav": "^0.1.0",
|
|
55
|
-
"@orioro/react-maplibre-util": "^0.
|
|
55
|
+
"@orioro/react-maplibre-util": "^0.5.2",
|
|
56
56
|
"@orioro/react-sortable": "^0.0.2",
|
|
57
57
|
"@orioro/react-ui-core": "^0.0.6",
|
|
58
58
|
"@orioro/resolve": "^0.1.2",
|