@redus/georedus-ui 0.16.0 → 0.19.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @orioro/template-react
2
2
 
3
+ ## 0.19.0
4
+
5
+ ### Minor Changes
6
+
7
+ - add source variables to view and download
8
+
9
+ ## 0.18.0
10
+
11
+ ### Minor Changes
12
+
13
+ - integrate maceio data + source variable features
14
+
15
+ ## 0.17.0
16
+
17
+ ### Minor Changes
18
+
19
+ - expose leftPanel.categoryIcons
20
+
3
21
  ## 0.16.0
4
22
 
5
23
  ### Minor Changes
@@ -1,5 +1,5 @@
1
1
  export const LeftPanel: React.MemoExoticComponent<typeof LeftPanelInner>;
2
- declare function LeftPanelInner({ viewConfState, viewConfDispatch, viewSpecs, resolvedViews, open, onSetOpen, syncedMapsRef, mapContainerRef, header: customHeader, footer: customFooter, }: {
2
+ declare function LeftPanelInner({ viewConfState, viewConfDispatch, viewSpecs, resolvedViews, open, onSetOpen, syncedMapsRef, mapContainerRef, categoryIcons, header: customHeader, footer: customFooter, }: {
3
3
  viewConfState: any;
4
4
  viewConfDispatch: any;
5
5
  viewSpecs: any;
@@ -8,6 +8,7 @@ declare function LeftPanelInner({ viewConfState, viewConfDispatch, viewSpecs, re
8
8
  onSetOpen: any;
9
9
  syncedMapsRef: any;
10
10
  mapContainerRef: any;
11
+ categoryIcons?: undefined;
11
12
  header?: undefined;
12
13
  footer?: undefined;
13
14
  }): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- export function ViewMenu({ viewSpecs, viewConfState, resolvedViews, onSetView, onDeactivateView, style, ...props }: {
1
+ export function ViewMenu({ viewSpecs, viewConfState, resolvedViews, onSetView, onDeactivateView, style, categoryIcons, ...props }: {
2
2
  [x: string]: any;
3
3
  viewSpecs: any;
4
4
  viewConfState: any;
@@ -6,5 +6,13 @@ export function ViewMenu({ viewSpecs, viewConfState, resolvedViews, onSetView, o
6
6
  onSetView: any;
7
7
  onDeactivateView: any;
8
8
  style: any;
9
+ categoryIcons?: {
10
+ 'populacao-e-domicilios': React.JSX.Element;
11
+ educacao: React.JSX.Element;
12
+ 'infraestrutura-e-servicos-urbanos': React.JSX.Element;
13
+ saude: React.JSX.Element;
14
+ 'emergencias-climaticas': React.JSX.Element;
15
+ 'divisoes-territoriais': React.JSX.Element;
16
+ } | undefined;
9
17
  }): React.JSX.Element;
10
18
  import React from 'react';
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { get, isPlainObject, pick, omit, set, uniqBy, groupBy, uniq } from 'lodash';
2
- import { slugify, dataJoin } from '@orioro/util';
2
+ import { slugify, dataJoin, interpolate } from '@orioro/util';
3
3
  import { makeResolve, $$literal, withExpressionResolvers, expressions, ALL_EXPR, fetchExpr, resolve, resolveAsync } from '@orioro/resolve';
4
4
  import { __assign, __spreadArray, __awaiter, __generator, __makeTemplateObject } from 'tslib';
5
5
  import { schemeTableau10, schemeSet3, schemeSet2, schemeSet1, schemePastel2, schemePastel1, schemePaired, schemeObservable10, schemeDark2, schemeAccent, schemeCategory10, schemeSpectral, schemeRdYlGn, schemeRdYlBu, schemeRdGy, schemeRdBu, schemePuOr, schemePiYG, schemePRGn, schemeBrBG, schemeYlOrRd, schemeYlOrBr, schemeYlGn, schemeYlGnBu, schemeRdPu, schemePuRd, schemePuBu, schemePuBuGn, schemeOrRd, schemeGnBu, schemeBuPu, schemeBuGn, schemeReds, schemePurples, schemeOranges, schemeGreys, schemeGreens, schemeBlues, interpolateSpectral } from 'd3-scale-chromatic';
@@ -13,9 +13,9 @@ import maplibregl from 'maplibre-gl';
13
13
  import { get as get$1 } from '@orioro/get';
14
14
  import { buffer } from '@turf/turf';
15
15
  import { scaleQuantile } from 'd3-scale';
16
+ import { fmtLayerAbsoluteId, waves_1, makeSyncedMaps, LayeredMap, svgImageGenerator, SVG_PATTERNS, useMapRegistry, useTilesLoading, HoverTooltip, layeredMapOnClickHandler, DynamicImages, ControlContainer, InspectControl, MapWindow, TerrainControl, fitGeometry } from '@orioro/react-maplibre-util';
16
17
  import { csvParse } from 'd3-dsv';
17
18
  import { strAutoCast } from '@orioro/cast';
18
- import { fmtLayerAbsoluteId, waves_1, makeSyncedMaps, LayeredMap, svgImageGenerator, SVG_PATTERNS, useMapRegistry, useTilesLoading, HoverTooltip, layeredMapOnClickHandler, DynamicImages, ControlContainer, InspectControl, MapWindow, TerrainControl, fitGeometry } from '@orioro/react-maplibre-util';
19
19
  import React$1, { useState, useMemo, useCallback, useContext, createContext, memo, useReducer, useEffect, useRef } from 'react';
20
20
  import styled, { keyframes } from 'styled-components';
21
21
  import { colord } from 'colord';
@@ -3631,12 +3631,12 @@ function influenceAreaLayers(_a) {
3631
3631
  };
3632
3632
  }
3633
3633
 
3634
- var _excluded$5 = ["version"];
3634
+ var _excluded$8 = ["version"];
3635
3635
  function tableVectorSource(context, tableId) {
3636
3636
  var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
3637
3637
  _ref$version = _ref.version,
3638
3638
  version = _ref$version === void 0 ? '1' : _ref$version,
3639
- override = _objectWithoutProperties(_ref, _excluded$5);
3639
+ override = _objectWithoutProperties(_ref, _excluded$8);
3640
3640
  var VECTOR_TILE_SERVER_ENDPOINT = context.VECTOR_TILE_SERVER_ENDPOINT;
3641
3641
  return _objectSpread2({
3642
3642
  type: 'vector',
@@ -4850,7 +4850,7 @@ function setor_censitario(viewSpec, allViewSpecs, context, _ref) {
4850
4850
  };
4851
4851
  }
4852
4852
 
4853
- function download(viewSpec, allViewSpecs, context, _ref) {
4853
+ function download$1(viewSpec, allViewSpecs, context, _ref) {
4854
4854
  var PARSED_SCHEMA = _ref.PARSED_SCHEMA;
4855
4855
  var METADATA_API_ENDPOINT = context.METADATA_API_ENDPOINT;
4856
4856
  return downloadResolver({
@@ -4920,7 +4920,7 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
4920
4920
  PARSED_SCHEMA: PARSED_SCHEMA,
4921
4921
  DATA_UTIL: DATA_UTIL
4922
4922
  });
4923
- var DOWNLOAD = download(viewSpec, allViewSpecs, context, {
4923
+ var DOWNLOAD = download$1(viewSpec, allViewSpecs, context, {
4924
4924
  PARSED_SCHEMA: PARSED_SCHEMA
4925
4925
  });
4926
4926
  return {
@@ -4953,6 +4953,62 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
4953
4953
  };
4954
4954
  }
4955
4955
 
4956
+ function download(context) {
4957
+ var METADATA_API_ENDPOINT = context.METADATA_API_ENDPOINT;
4958
+ return downloadResolver({
4959
+ fileNameBase: ['$template', '${0}_${1}_georedus_censo_${2}', [['$get', 'view.conf.data.variableId'], ['$get', 'municipioId'], '2022']],
4960
+ mainVariableId: ['$get', 'view.conf.data.variableId'],
4961
+ availableVariableIds: [],
4962
+ fetchData: resolve.fn(function (ctx) {
4963
+ return /*#__PURE__*/function () {
4964
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
4965
+ var options, variableId, dataUrl, data, geometriesUrl, geometries;
4966
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
4967
+ while (1) switch (_context.prev = _context.next) {
4968
+ case 0:
4969
+ _ref.variableIds, options = _ref.options;
4970
+ variableId = ctx.view.conf.data.variableId;
4971
+ dataUrl = "".concat(METADATA_API_ENDPOINT, "/cem_censo_2022_pessoas?") + "cd_mun=eq.".concat(ctx.app.municipioId, "&") + "select=id,".concat(variableId, ",").concat(variableId, "_src");
4972
+ _context.next = 5;
4973
+ return fetch(dataUrl).then(function (res) {
4974
+ return res.json();
4975
+ });
4976
+ case 5:
4977
+ data = _context.sent.map(function (entry) {
4978
+ var newEntry = _objectSpread2(_objectSpread2({}, entry), entry["".concat(variableId, "_src")]);
4979
+ delete newEntry["".concat(variableId, "_src")];
4980
+ return newEntry;
4981
+ });
4982
+ if (!(options.format === 'CSV')) {
4983
+ _context.next = 8;
4984
+ break;
4985
+ }
4986
+ return _context.abrupt("return", data);
4987
+ case 8:
4988
+ geometriesUrl = "".concat(METADATA_API_ENDPOINT, "/ibge_malha_br_setor_censitario_2022?") + "cd_mun=eq.".concat(ctx.app.municipioId, "&") + "select=id,geom";
4989
+ _context.next = 11;
4990
+ return fetch(geometriesUrl).then(function (res) {
4991
+ return res.json();
4992
+ });
4993
+ case 11:
4994
+ geometries = _context.sent;
4995
+ return _context.abrupt("return", dataJoin([geometries, data], {
4996
+ key: 'id'
4997
+ }));
4998
+ case 13:
4999
+ case "end":
5000
+ return _context.stop();
5001
+ }
5002
+ }, _callee);
5003
+ }));
5004
+ return function (_x) {
5005
+ return _ref2.apply(this, arguments);
5006
+ };
5007
+ }();
5008
+ })
5009
+ });
5010
+ }
5011
+
4956
5012
  var CHOROPLETH_MODULE_ID = 'choropleth';
4957
5013
  var INSUFFICIENT_DATA_COLOR = 'red';
4958
5014
 
@@ -5446,56 +5502,45 @@ function setor_censitario_layers(opts) {
5446
5502
  legends: setor_censitario_legends(opts),
5447
5503
  tooltip: {
5448
5504
  title: ['$literal', ['$template', 'Setor censitário ${0}', ['$get', 'feature.properties.id']]],
5449
- entries: [[['$get', ['$get', 'view.conf.data.variableId'], ['$get', 'view.metadata.labels']], ['$literal', resolve.fn(function (context) {
5505
+ entries: ['$literal', resolve.fn(function (context) {
5450
5506
  var variableId = get$1(context, 'view.conf.data.variableId');
5507
+ var variableLabel = get$1(context, "view.metadata.labels.".concat(variableId));
5508
+ var mainValueDisplay;
5451
5509
  if (variableId === 'total_pessoas_por_hectare') {
5452
5510
  try {
5453
5511
  var value_src = JSON.parse(context.feature.properties.value_src);
5454
- return value_src['bas.v0001'];
5512
+ mainValueDisplay = value_src['bas.v0001'];
5455
5513
  } catch (err) {
5456
5514
  console.error(err);
5457
- return null;
5515
+ mainValueDisplay = null;
5458
5516
  }
5459
5517
  } else {
5460
- return ['$fmt', ['$get', 'feature.properties.value'], {
5461
- number: NUMBER_FMT
5462
- }];
5518
+ var value = get$1(context, 'feature.properties.value');
5519
+ var isPercentage = variableId.endsWith('_pct');
5520
+ var format = isPercentage ? {
5521
+ style: 'percent'
5522
+ } : {};
5523
+ mainValueDisplay = typeof value === 'number' ? value.toLocaleString('pt-BR', format) : value;
5463
5524
  }
5464
- })
5465
-
5466
- //
5467
- // TODO: refactor
5468
- // THIS IS THE ACTUAL:
5469
- //
5470
- // [
5471
- // '$fmt',
5472
- // ['$get', 'feature.properties.value'],
5473
- // { number: NUMBER_FMT },
5474
- // ],
5475
- ]]].concat(_toConsumableArray([
5476
- // 'v0001',
5477
- // 'v0002',
5478
- // 'v0003',
5479
- // 'v0004',
5480
- // 'v0005',
5481
- // 'v0006',
5482
- // 'v0007',
5483
- ].map(function (v) {
5484
- return [v, ['$literal', ['$get', "feature.properties.".concat(v) // [
5485
- // '$template',
5486
- // 'feature.properties.${0}',
5487
- // // `::string({ "number": ${JSON.stringify(NUMBER_FMT)} })`,
5488
- // ['$get', 'view.conf.data.variableId'],
5489
- // ],
5490
- ]]];
5491
- })), [['Variáveis originais', ['$literal', ['$get', 'feature.properties.value_src'
5492
- // [
5493
- // '$template',
5494
- // 'feature.properties.${0}',
5495
- // // `::string({ "number": ${JSON.stringify(NUMBER_FMT)} })`,
5496
- // ['$get', 'view.conf.data.variableId'],
5497
- // ],
5498
- ]]]])
5525
+ var originalVariablesUnavailableMessage;
5526
+ var originalVariablesDisplay;
5527
+ try {
5528
+ var _value_src = JSON.parse(context.feature.properties.value_src);
5529
+ originalVariablesUnavailableMessage = ' ';
5530
+ originalVariablesDisplay = Object.entries(_value_src).map(function (_ref6) {
5531
+ var _ref7 = _slicedToArray(_ref6, 2),
5532
+ key = _ref7[0],
5533
+ value = _ref7[1];
5534
+ var formattedValue = typeof value === 'number' ? value.toLocaleString('pt-BR') : value;
5535
+ return ["- ".concat(key), formattedValue];
5536
+ });
5537
+ } catch (err) {
5538
+ console.err(err);
5539
+ originalVariablesUnavailableMessage = 'Dados indisponíveis';
5540
+ originalVariablesDisplay = [['Dados indisponíveis']];
5541
+ }
5542
+ return [[variableLabel, mainValueDisplay], ['Variáveis originais', originalVariablesUnavailableMessage]].concat(_toConsumableArray(originalVariablesDisplay));
5543
+ })]
5499
5544
  },
5500
5545
  filter: _filter,
5501
5546
  // maxzoom: 14,
@@ -5838,8 +5883,7 @@ function cem_censo_2022(viewSpec, allViewSpecs, context) {
5838
5883
  if (!PARSED_SCHEMA) {
5839
5884
  return null;
5840
5885
  }
5841
- var DOWNLOAD = download(viewSpec, allViewSpecs, context, {
5842
- PARSED_SCHEMA: PARSED_SCHEMA});
5886
+ var DOWNLOAD = download(context);
5843
5887
  var CHOROPLETH = choropleth({
5844
5888
  GLOBAL_CONTEXT: context,
5845
5889
  PARSED_SCHEMA: PARSED_SCHEMA
@@ -6244,12 +6288,209 @@ function cem_saude_2024(viewSpec, allViewSpecs, context) {
6244
6288
  }));
6245
6289
  }
6246
6290
 
6291
+ var _excluded$7 = ["label", "color", "line", "fill", "tiles", "source_layer", "sources", "layers"];
6292
+ function _parseTiles$2(tiles, context) {
6293
+ tiles = Array.isArray(tiles) ? tiles : typeof tiles === 'string' ? [tiles] : null;
6294
+ if (!tiles) {
6295
+ throw new Error("tiles is required");
6296
+ }
6297
+ return tiles.map(function (tileSrcUrl) {
6298
+ return interpolate(tileSrcUrl, context);
6299
+ });
6300
+ }
6301
+ function vector_polygon(_ref, allViewSpecs, context) {
6302
+ var label = _ref.label,
6303
+ color = _ref.color,
6304
+ _ref$line = _ref.line,
6305
+ line = _ref$line === void 0 ? {} : _ref$line,
6306
+ _ref$fill = _ref.fill,
6307
+ fill = _ref$fill === void 0 ? {} : _ref$fill,
6308
+ tiles = _ref.tiles,
6309
+ source_layer = _ref.source_layer,
6310
+ _ref$sources = _ref.sources,
6311
+ sources = _ref$sources === void 0 ? {} : _ref$sources,
6312
+ _ref$layers = _ref.layers,
6313
+ layers = _ref$layers === void 0 ? {} : _ref$layers,
6314
+ props = _objectWithoutProperties(_ref, _excluded$7);
6315
+ if (!source_layer) {
6316
+ throw new Error('source_layer must be defined');
6317
+ }
6318
+ return _objectSpread2(_objectSpread2({}, props), {}, {
6319
+ label: label,
6320
+ metadata: {},
6321
+ sources: _objectSpread2({
6322
+ main: {
6323
+ promoteId: 'id',
6324
+ type: 'vector',
6325
+ tiles: _parseTiles$2(tiles, context)
6326
+ }
6327
+ }, sources),
6328
+ layers: _objectSpread2(_defineProperty(_defineProperty({}, "main_line", _objectSpread2(_objectSpread2({
6329
+ zIndex: Z_OVERLAY_BASE_1000,
6330
+ source: 'main',
6331
+ 'source-layer': source_layer,
6332
+ type: 'line'
6333
+ }, line), {}, {
6334
+ paint: {
6335
+ 'line-color': color
6336
+ }
6337
+ })), "main_fill", _objectSpread2(_objectSpread2({
6338
+ zIndex: Z_OVERLAY_BASE_1000,
6339
+ source: 'main',
6340
+ 'source-layer': source_layer,
6341
+ type: 'fill'
6342
+ }, fill), {}, {
6343
+ paint: _objectSpread2({
6344
+ 'fill-opacity': 0.5,
6345
+ 'fill-color': color
6346
+ }, fill.paint),
6347
+ legends: [{
6348
+ type: 'CategoricalLegend',
6349
+ items: [{
6350
+ color: color,
6351
+ label: label
6352
+ }]
6353
+ }],
6354
+ tooltip: {
6355
+ title: ['$literal', resolve.fn(function (ctx) {
6356
+ var _ctx$feature;
6357
+ return ctx === null || ctx === void 0 || (_ctx$feature = ctx.feature) === null || _ctx$feature === void 0 || (_ctx$feature = _ctx$feature.properties) === null || _ctx$feature === void 0 ? void 0 : _ctx$feature.name;
6358
+ })],
6359
+ entries: ['$literal', resolve.fn(function (ctx) {
6360
+ var _ctx$feature2;
6361
+ return _typeof((_ctx$feature2 = ctx.feature) === null || _ctx$feature2 === void 0 ? void 0 : _ctx$feature2.properties) === 'object' ? Object.entries(ctx.feature.properties) : [];
6362
+ })]
6363
+ }
6364
+ })), layers)
6365
+ });
6366
+ }
6367
+
6368
+ var _excluded$6 = ["line", "color", "tiles", "source_layer", "sources", "layers"];
6369
+ function _parseTiles$1(tiles, context) {
6370
+ tiles = Array.isArray(tiles) ? tiles : typeof tiles === 'string' ? [tiles] : null;
6371
+ if (!tiles) {
6372
+ throw new Error("tiles is required");
6373
+ }
6374
+ return tiles.map(function (tileSrcUrl) {
6375
+ return interpolate(tileSrcUrl, context);
6376
+ });
6377
+ }
6378
+ function vector_line(_ref, allViewSpecs, context) {
6379
+ var _ref$line = _ref.line,
6380
+ line = _ref$line === void 0 ? {} : _ref$line,
6381
+ color = _ref.color,
6382
+ tiles = _ref.tiles,
6383
+ source_layer = _ref.source_layer,
6384
+ _ref$sources = _ref.sources,
6385
+ sources = _ref$sources === void 0 ? {} : _ref$sources,
6386
+ _ref$layers = _ref.layers,
6387
+ layers = _ref$layers === void 0 ? {} : _ref$layers,
6388
+ props = _objectWithoutProperties(_ref, _excluded$6);
6389
+ if (!source_layer) {
6390
+ throw new Error('source_layer must be defined');
6391
+ }
6392
+ return _objectSpread2(_objectSpread2({}, props), {}, {
6393
+ metadata: {},
6394
+ sources: _objectSpread2({
6395
+ main: {
6396
+ promoteId: 'id',
6397
+ type: 'vector',
6398
+ tiles: _parseTiles$1(tiles, context)
6399
+ }
6400
+ }, sources),
6401
+ layers: _objectSpread2(_defineProperty({}, "main_line", _objectSpread2(_objectSpread2({
6402
+ zIndex: Z_OVERLAY_MIDDLE_2000,
6403
+ source: 'main',
6404
+ 'source-layer': source_layer,
6405
+ type: 'line'
6406
+ }, line), {}, {
6407
+ paint: _objectSpread2({
6408
+ 'line-width': 1,
6409
+ 'line-color': color
6410
+ }, line.paint || {}),
6411
+ tooltip: {
6412
+ title: ['$literal', resolve.fn(function (ctx) {
6413
+ var _ctx$feature;
6414
+ return ctx === null || ctx === void 0 || (_ctx$feature = ctx.feature) === null || _ctx$feature === void 0 || (_ctx$feature = _ctx$feature.properties) === null || _ctx$feature === void 0 ? void 0 : _ctx$feature.name;
6415
+ })],
6416
+ entries: ['$literal', resolve.fn(function (ctx) {
6417
+ var _ctx$feature2;
6418
+ return _typeof((_ctx$feature2 = ctx.feature) === null || _ctx$feature2 === void 0 ? void 0 : _ctx$feature2.properties) === 'object' ? Object.entries(ctx.feature.properties) : [];
6419
+ })]
6420
+ }
6421
+ })), layers)
6422
+ });
6423
+ }
6424
+
6425
+ var _excluded$5 = ["circle", "color", "tiles", "source_layer", "sources", "layers"];
6426
+ function _parseTiles(tiles, context) {
6427
+ tiles = Array.isArray(tiles) ? tiles : typeof tiles === 'string' ? [tiles] : null;
6428
+ if (!tiles) {
6429
+ throw new Error("tiles is required");
6430
+ }
6431
+ return tiles.map(function (tileSrcUrl) {
6432
+ return interpolate(tileSrcUrl, context);
6433
+ });
6434
+ }
6435
+ function vector_circle(_ref, allViewSpecs, context) {
6436
+ var _ref$circle = _ref.circle,
6437
+ circle = _ref$circle === void 0 ? {} : _ref$circle,
6438
+ color = _ref.color,
6439
+ tiles = _ref.tiles,
6440
+ source_layer = _ref.source_layer,
6441
+ _ref$sources = _ref.sources,
6442
+ sources = _ref$sources === void 0 ? {} : _ref$sources,
6443
+ _ref$layers = _ref.layers,
6444
+ layers = _ref$layers === void 0 ? {} : _ref$layers,
6445
+ props = _objectWithoutProperties(_ref, _excluded$5);
6446
+ if (!source_layer) {
6447
+ throw new Error('source_layer must be defined');
6448
+ }
6449
+ return _objectSpread2(_objectSpread2({}, props), {}, {
6450
+ metadata: {},
6451
+ sources: _objectSpread2({
6452
+ main: {
6453
+ promoteId: 'id',
6454
+ type: 'vector',
6455
+ tiles: _parseTiles(tiles, context)
6456
+ }
6457
+ }, sources),
6458
+ layers: _objectSpread2(_defineProperty({}, "main_circle", _objectSpread2(_objectSpread2({
6459
+ zIndex: Z_OVERLAY_TOP_3000,
6460
+ source: 'main',
6461
+ 'source-layer': source_layer,
6462
+ type: 'circle'
6463
+ }, circle), {}, {
6464
+ paint: _objectSpread2({
6465
+ 'circle-radius': 8,
6466
+ 'circle-color': color,
6467
+ 'circle-opacity': 1,
6468
+ 'circle-stroke-color': '#000000',
6469
+ 'circle-stroke-width': 1
6470
+ }, circle.paint || {}),
6471
+ tooltip: {
6472
+ title: ['$literal', resolve.fn(function (ctx) {
6473
+ var _ctx$feature;
6474
+ return ctx === null || ctx === void 0 || (_ctx$feature = ctx.feature) === null || _ctx$feature === void 0 || (_ctx$feature = _ctx$feature.properties) === null || _ctx$feature === void 0 ? void 0 : _ctx$feature.name;
6475
+ })],
6476
+ entries: ['$literal', resolve.fn(function (ctx) {
6477
+ var _ctx$feature2;
6478
+ return _typeof((_ctx$feature2 = ctx.feature) === null || _ctx$feature2 === void 0 ? void 0 : _ctx$feature2.properties) === 'object' ? Object.entries(ctx.feature.properties) : [];
6479
+ })]
6480
+ }
6481
+ })), layers)
6482
+ });
6483
+ }
6484
+
6247
6485
  var PRESETS = /*#__PURE__*/Object.freeze({
6248
6486
  __proto__: null,
6249
6487
  cem_censo_2010_2022: cem_censo_2010_2022,
6250
6488
  cem_censo_2022: cem_censo_2022,
6251
6489
  cem_escolas_2022: cem_escolas_2022,
6252
- cem_saude_2024: cem_saude_2024
6490
+ cem_saude_2024: cem_saude_2024,
6491
+ vector_circle: vector_circle,
6492
+ vector_line: vector_line,
6493
+ vector_polygon: vector_polygon
6253
6494
  });
6254
6495
 
6255
6496
  function parseViewSpec(specInput, otherSpecInputs, context) {
@@ -6322,7 +6563,7 @@ function resolveViewSpecs(viewSpecsInput, context) {
6322
6563
  // - as well as those marked as skip
6323
6564
  //
6324
6565
  viewSpecsInput = viewSpecsInput.filter(function (specInput) {
6325
- return specInput.collection_id && specInput.collection_id.trim() && specInput.indicator_id && specInput.indicator_id.trim() && !specInput.skip;
6566
+ return specInput.collection_id && specInput.collection_id.trim() && specInput.indicator_id && specInput.indicator_id.trim() && !resolveExpr(specInput.skip, context);
6326
6567
  });
6327
6568
  //
6328
6569
  // Group viewSpecsInput by collection_id
@@ -7812,7 +8053,10 @@ var index = /*#__PURE__*/Object.freeze({
7812
8053
  resolveSources: resolveSources,
7813
8054
  resolveView: resolveView,
7814
8055
  resolveViewSpecs: resolveViewSpecs,
7815
- temperatura_superficie: temperatura_superficie
8056
+ temperatura_superficie: temperatura_superficie,
8057
+ vector_circle: vector_circle,
8058
+ vector_line: vector_line,
8059
+ vector_polygon: vector_polygon
7816
8060
  });
7817
8061
 
7818
8062
  var CollapsibleContent_slideDown = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n"], ["\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n"])));
@@ -8202,9 +8446,9 @@ function ViewControl(_ref8) {
8202
8446
  }))));
8203
8447
  }
8204
8448
 
8205
- var _excluded$3 = ["viewSpecs", "viewConfState", "resolvedViews", "onSetView", "onDeactivateView", "style"];
8449
+ var _excluded$3 = ["viewSpecs", "viewConfState", "resolvedViews", "onSetView", "onDeactivateView", "style", "categoryIcons"];
8206
8450
  var _templateObject$3, _templateObject2$1;
8207
- var STATIC_NODE_ICONS = {
8451
+ var CATEGORY_ICONS = {
8208
8452
  'populacao-e-domicilios': /*#__PURE__*/React$1.createElement(Icon, {
8209
8453
  path: mdiAccountGroup
8210
8454
  }),
@@ -8350,6 +8594,8 @@ function ViewMenu(_ref4) {
8350
8594
  onSetView = _ref4.onSetView,
8351
8595
  onDeactivateView = _ref4.onDeactivateView,
8352
8596
  style = _ref4.style,
8597
+ _ref4$categoryIcons = _ref4.categoryIcons,
8598
+ categoryIcons = _ref4$categoryIcons === void 0 ? CATEGORY_ICONS : _ref4$categoryIcons,
8353
8599
  props = _objectWithoutProperties(_ref4, _excluded$3);
8354
8600
  var viewSpecsById = useMemo(function () {
8355
8601
  return Object.fromEntries(viewSpecs.map(function (spec) {
@@ -8385,7 +8631,7 @@ function ViewMenu(_ref4) {
8385
8631
  style: {
8386
8632
  position: 'relative'
8387
8633
  }
8388
- }, STATIC_NODE_ICONS[node.id], activeViewsCount > 0 && /*#__PURE__*/React$1.createElement(ActiveCounter, null, activeViewsCount));
8634
+ }, categoryIcons[node.id] || node.id, activeViewsCount > 0 && /*#__PURE__*/React$1.createElement(ActiveCounter, null, activeViewsCount));
8389
8635
  }
8390
8636
  }, props))));
8391
8637
  }
@@ -8655,6 +8901,8 @@ function LeftPanelInner(_ref) {
8655
8901
  onSetOpen = _ref.onSetOpen,
8656
8902
  syncedMapsRef = _ref.syncedMapsRef,
8657
8903
  mapContainerRef = _ref.mapContainerRef,
8904
+ _ref$categoryIcons = _ref.categoryIcons,
8905
+ categoryIcons = _ref$categoryIcons === void 0 ? undefined : _ref$categoryIcons,
8658
8906
  _ref$header = _ref.header,
8659
8907
  customHeader = _ref$header === void 0 ? undefined : _ref$header,
8660
8908
  _ref$footer = _ref.footer,
@@ -8776,6 +9024,7 @@ function LeftPanelInner(_ref) {
8776
9024
  flexGrow: 1,
8777
9025
  height: '1px'
8778
9026
  },
9027
+ categoryIcons: categoryIcons,
8779
9028
  viewSpecs: viewSpecs,
8780
9029
  viewConfState: viewConfState,
8781
9030
  resolvedViews: resolvedViews,
@@ -11402,6 +11651,7 @@ function GeoReDUSInner(_ref2) {
11402
11651
  case 6:
11403
11652
  _context.t3 = _context.sent;
11404
11653
  _context.t4 = {
11654
+ municipioId: municipioId,
11405
11655
  METADATA_API_ENDPOINT: METADATA_API_ENDPOINT,
11406
11656
  VECTOR_TILE_SERVER_ENDPOINT: VECTOR_TILE_SERVER_ENDPOINT,
11407
11657
  MAP_TILER_API_KEY: process.env.NEXT_PUBLIC_MAP_TILER_API_KEY
@@ -158,7 +158,7 @@ export namespace intramun {
158
158
  }[];
159
159
  tooltip: {
160
160
  title: (string | (string | string[])[])[];
161
- entries: ((string | (string | string[])[])[] | ((string | string[])[] | (string | {
161
+ entries: (string | {
162
162
  [x: string]: any;
163
163
  $$resolver: symbol;
164
164
  $$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
@@ -166,7 +166,7 @@ export namespace intramun {
166
166
  value: (...args: any[]) => any;
167
167
  defaultValue?: any;
168
168
  context?: any;
169
- })[])[])[];
169
+ })[];
170
170
  };
171
171
  filter: {
172
172
  [x: string]: any;
@@ -67,7 +67,7 @@ export function setor_censitario_layers(opts: any): {
67
67
  }[];
68
68
  tooltip: {
69
69
  title: (string | (string | string[])[])[];
70
- entries: ((string | (string | string[])[])[] | ((string | string[])[] | (string | {
70
+ entries: (string | {
71
71
  [x: string]: any;
72
72
  $$resolver: symbol;
73
73
  $$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
@@ -75,7 +75,7 @@ export function setor_censitario_layers(opts: any): {
75
75
  value: (...args: any[]) => any;
76
76
  defaultValue?: any;
77
77
  context?: any;
78
- })[])[])[];
78
+ })[];
79
79
  };
80
80
  filter: {
81
81
  [x: string]: any;
@@ -0,0 +1,9 @@
1
+ export function download(context: any): {
2
+ [x: string]: any;
3
+ $$resolver: symbol;
4
+ $$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
5
+ dependencies: any;
6
+ value: (...args: any[]) => any;
7
+ defaultValue?: any;
8
+ context?: any;
9
+ };
@@ -2,3 +2,6 @@ export * from "./cem_escolas_2022";
2
2
  export * from "./cem_censo/2010_2022";
3
3
  export * from "./cem_censo/2022";
4
4
  export * from "./cem_saude_2024";
5
+ export * from "./vector_polygon";
6
+ export * from "./vector_line";
7
+ export * from "./vector_circle";
@@ -0,0 +1,47 @@
1
+ export function vector_circle({ circle, color, tiles, source_layer, sources, layers, ...props }: {
2
+ [x: string]: any;
3
+ circle?: {} | undefined;
4
+ color: any;
5
+ tiles: any;
6
+ source_layer: any;
7
+ sources?: {} | undefined;
8
+ layers?: {} | undefined;
9
+ }, allViewSpecs: any, context: any): {
10
+ metadata: {};
11
+ sources: {
12
+ main: {
13
+ promoteId: string;
14
+ type: string;
15
+ tiles: any;
16
+ };
17
+ };
18
+ layers: {
19
+ main_circle: {
20
+ paint: any;
21
+ tooltip: {
22
+ title: (string | {
23
+ [x: string]: any;
24
+ $$resolver: symbol;
25
+ $$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
26
+ dependencies: any;
27
+ value: (...args: any[]) => any;
28
+ defaultValue?: any;
29
+ context?: any;
30
+ })[];
31
+ entries: (string | {
32
+ [x: string]: any;
33
+ $$resolver: symbol;
34
+ $$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
35
+ dependencies: any;
36
+ value: (...args: any[]) => any;
37
+ defaultValue?: any;
38
+ context?: any;
39
+ })[];
40
+ };
41
+ zIndex: number;
42
+ source: string;
43
+ 'source-layer': any;
44
+ type: string;
45
+ };
46
+ };
47
+ };
@@ -0,0 +1,47 @@
1
+ export function vector_line({ line, color, tiles, source_layer, sources, layers, ...props }: {
2
+ [x: string]: any;
3
+ line?: {} | undefined;
4
+ color: any;
5
+ tiles: any;
6
+ source_layer: any;
7
+ sources?: {} | undefined;
8
+ layers?: {} | undefined;
9
+ }, allViewSpecs: any, context: any): {
10
+ metadata: {};
11
+ sources: {
12
+ main: {
13
+ promoteId: string;
14
+ type: string;
15
+ tiles: any;
16
+ };
17
+ };
18
+ layers: {
19
+ main_line: {
20
+ paint: any;
21
+ tooltip: {
22
+ title: (string | {
23
+ [x: string]: any;
24
+ $$resolver: symbol;
25
+ $$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
26
+ dependencies: any;
27
+ value: (...args: any[]) => any;
28
+ defaultValue?: any;
29
+ context?: any;
30
+ })[];
31
+ entries: (string | {
32
+ [x: string]: any;
33
+ $$resolver: symbol;
34
+ $$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
35
+ dependencies: any;
36
+ value: (...args: any[]) => any;
37
+ defaultValue?: any;
38
+ context?: any;
39
+ })[];
40
+ };
41
+ zIndex: number;
42
+ source: string;
43
+ 'source-layer': any;
44
+ type: string;
45
+ };
46
+ };
47
+ };
@@ -0,0 +1,66 @@
1
+ export function vector_polygon({ label, color, line, fill, tiles, source_layer, sources, layers, ...props }: {
2
+ [x: string]: any;
3
+ label: any;
4
+ color: any;
5
+ line?: {} | undefined;
6
+ fill?: {} | undefined;
7
+ tiles: any;
8
+ source_layer: any;
9
+ sources?: {} | undefined;
10
+ layers?: {} | undefined;
11
+ }, allViewSpecs: any, context: any): {
12
+ label: any;
13
+ metadata: {};
14
+ sources: {
15
+ main: {
16
+ promoteId: string;
17
+ type: string;
18
+ tiles: any;
19
+ };
20
+ };
21
+ layers: {
22
+ main_line: {
23
+ paint: {
24
+ 'line-color': any;
25
+ };
26
+ zIndex: number;
27
+ source: string;
28
+ 'source-layer': any;
29
+ type: string;
30
+ };
31
+ main_fill: {
32
+ paint: any;
33
+ legends: {
34
+ type: string;
35
+ items: {
36
+ color: any;
37
+ label: any;
38
+ }[];
39
+ }[];
40
+ tooltip: {
41
+ title: (string | {
42
+ [x: string]: any;
43
+ $$resolver: symbol;
44
+ $$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
45
+ dependencies: any;
46
+ value: (...args: any[]) => any;
47
+ defaultValue?: any;
48
+ context?: any;
49
+ })[];
50
+ entries: (string | {
51
+ [x: string]: any;
52
+ $$resolver: symbol;
53
+ $$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
54
+ dependencies: any;
55
+ value: (...args: any[]) => any;
56
+ defaultValue?: any;
57
+ context?: any;
58
+ })[];
59
+ };
60
+ zIndex: number;
61
+ source: string;
62
+ 'source-layer': any;
63
+ type: string;
64
+ };
65
+ };
66
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redus/georedus-ui",
3
- "version": "0.16.0",
3
+ "version": "0.19.0",
4
4
  "packageManager": "yarn@4.0.2",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
@@ -49,7 +49,7 @@
49
49
  "@mapbox/tilebelt": "2.0.0",
50
50
  "@mdi/js": "^7.4.47",
51
51
  "@mdi/react": "^1.6.1",
52
- "@orioro/cast": "^0.0.2",
52
+ "@orioro/cast": "^0.0.11",
53
53
  "@orioro/get": "^0.0.2",
54
54
  "@orioro/react-chart-util": "^0.3.0",
55
55
  "@orioro/react-csv": "^0.0.11",