@evergis/react 2.0.135 → 2.0.137

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.esm.js CHANGED
@@ -2800,7 +2800,7 @@ const h3gridFeature = /*#__PURE__*/new H3Feature([[50, -15], [80, -33], [80, -67
2800
2800
  const lineLegendFeature = /*#__PURE__*/new Polyline([[0, -50], [100, -50]], {
2801
2801
  crs: plain
2802
2802
  });
2803
- const polygonLegendFeature = /*#__PURE__*/new Polygon([[0, 0], [100, 0], [100, -100], [0, -100]], {
2803
+ const polygonLegendFeature = /*#__PURE__*/new Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
2804
2804
  crs: plain
2805
2805
  });
2806
2806
  const polygonMapLegendFeature = /*#__PURE__*/new Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
@@ -2810,6 +2810,7 @@ const MAP_LEGEND_FEATURES = {
2810
2810
  polygon: polygonMapLegendFeature
2811
2811
  };
2812
2812
  const LEGEND_FEATURES = {
2813
+ point: pointFeature,
2813
2814
  polyline: lineLegendFeature,
2814
2815
  polygon: polygonLegendFeature,
2815
2816
  h3grid: h3gridFeature
@@ -2871,6 +2872,12 @@ function renderSymbolToCanvas(renders, canvas) {
2871
2872
 
2872
2873
  function deserializeSymbol(symbol) {
2873
2874
  switch (symbol.type) {
2875
+ case "h3grid":
2876
+ return deserializeH3Symbol(symbol);
2877
+
2878
+ case "svgPointSymbol":
2879
+ return deserializeSvgPointSymbol(symbol);
2880
+
2874
2881
  case 'circlePointSymbol':
2875
2882
  return deserializePointSymbol(symbol);
2876
2883
 
@@ -2895,11 +2902,57 @@ function deserializeSymbol(symbol) {
2895
2902
  }
2896
2903
  }
2897
2904
 
2905
+ function deserializeH3Symbol(symbol) {
2906
+ var _symbol$stroke, _symbol$stroke2, _symbol$fill;
2907
+
2908
+ return new H3Symbol(_extends({}, symbol, {
2909
+ cellSize: getParameterValue(symbol.cellSize),
2910
+ strokeWidth: getParameterValue(symbol == null ? void 0 : (_symbol$stroke = symbol.stroke) == null ? void 0 : _symbol$stroke.width),
2911
+ strokeColor: getParameterValue(symbol == null ? void 0 : (_symbol$stroke2 = symbol.stroke) == null ? void 0 : _symbol$stroke2.color),
2912
+ fillColor: getParameterValue(symbol == null ? void 0 : (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color)
2913
+ }));
2914
+ }
2915
+
2898
2916
  function deserializePointSymbol(symbol) {
2899
2917
  // @ts-ignore
2900
2918
  return new PointSymbol(deserializePointSymbolParams(symbol));
2901
2919
  }
2902
2920
 
2921
+ const getOffsetParameterValue = offset => [getParameterValue(offset == null ? void 0 : offset[0]), getParameterValue(offset == null ? void 0 : offset[1])];
2922
+
2923
+ function deserializeSvgPointSymbolParams(_ref) {
2924
+ let {
2925
+ type,
2926
+ data,
2927
+ size,
2928
+ offset,
2929
+ angle,
2930
+ background,
2931
+ figure
2932
+ } = _ref;
2933
+ return _extends({
2934
+ type: getParameterValue(type),
2935
+ data: getParameterValue(data),
2936
+ size: getParameterValue(size),
2937
+ offset: getOffsetParameterValue(offset),
2938
+ angle: getParameterValue(angle)
2939
+ }, background ? {
2940
+ background: _extends({}, background, {
2941
+ fillColor: deserializeColor(getParameterValue(background == null ? void 0 : background.fillColor)),
2942
+ strokeColor: deserializeColor(getParameterValue(background == null ? void 0 : background.strokeColor)),
2943
+ strokeWidth: getParameterValue(background == null ? void 0 : background.strokeWidth)
2944
+ })
2945
+ } : {}, figure ? {
2946
+ figure: _extends({}, figure, {
2947
+ fillColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.fillColor))
2948
+ })
2949
+ } : {});
2950
+ }
2951
+
2952
+ function deserializeSvgPointSymbol(symbol) {
2953
+ return new PointSymbol(deserializeSvgPointSymbolParams(symbol));
2954
+ }
2955
+
2903
2956
  function deserializeSquareSymbol(symbol) {
2904
2957
  return new SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
2905
2958
  // @ts-ignore
@@ -2957,14 +3010,14 @@ function deserializePolylineSymbol(symbol) {
2957
3010
  return new SGisPolylineSymbol(symbol);
2958
3011
  }
2959
3012
 
2960
- function deserializePointSymbolParams(_ref) {
3013
+ function deserializePointSymbolParams(_ref2) {
2961
3014
  let {
2962
3015
  size,
2963
3016
  offset,
2964
3017
  strokeColor,
2965
3018
  strokeWidth,
2966
3019
  fillColor
2967
- } = _ref;
3020
+ } = _ref2;
2968
3021
  return {
2969
3022
  size: getParameterValue(size),
2970
3023
  offset: deserializeAnchor(offset),
@@ -3423,7 +3476,7 @@ const useLegendValueSymbol = _ref => {
3423
3476
  });
3424
3477
  };
3425
3478
 
3426
- const DEFAULT_SYMBOL_SIZE = 16;
3479
+ const DEFAULT_SYMBOL_SIZE = 26;
3427
3480
  function useSymbol(_ref, canvasRef) {
3428
3481
  let {
3429
3482
  symbol,
@@ -4669,19 +4722,20 @@ const EvergisSelect = _ref => {
4669
4722
  };
4670
4723
 
4671
4724
  var _templateObject$2, _templateObject2$1, _templateObject3$1, _templateObject4$1, _templateObject5$1;
4672
- const LegendContainer = /*#__PURE__*/styled.div(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background-color: #fff;\n\n canvas {\n border-radius: 0.125rem;\n }\n"])));
4725
+ const LegendContainer = /*#__PURE__*/styled.div(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background-color: white;\n"])));
4673
4726
  const LegendSectionContainer = /*#__PURE__*/styled.div(_templateObject2$1 || (_templateObject2$1 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
4674
4727
  const LegendSymbolTitle = /*#__PURE__*/styled.p(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n"])));
4675
- const LegendValueContainer = /*#__PURE__*/styled.div(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n font-size: 0.75rem;\n padding: 0.125rem 0;\n\n ", " {\n padding-left: 0.5rem;\n }\n"])), LegendSymbolTitle);
4728
+ const LegendValueContainer = /*#__PURE__*/styled.div(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n font-size: 0.75rem;\n\n ", " {\n padding-left: 0.5rem;\n }\n"])), LegendSymbolTitle);
4676
4729
  const LegendSectionHeader = /*#__PURE__*/styled.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n font-weight: 500;\n"])));
4677
4730
 
4678
4731
  const LegendSection = _ref => {
4679
4732
  let {
4680
4733
  item,
4681
4734
  renderLegendTitle,
4735
+ hideTitle,
4682
4736
  children
4683
4737
  } = _ref;
4684
- return React.createElement(LegendSectionContainer, null, React.createElement(LegendSectionHeader, null, renderLegendTitle ? renderLegendTitle(item) : item.title), item.values.map(children));
4738
+ return React.createElement(LegendSectionContainer, null, !hideTitle && React.createElement(LegendSectionHeader, null, renderLegendTitle ? renderLegendTitle(item) : item.title), item.values.map(children));
4685
4739
  };
4686
4740
 
4687
4741
  var _templateObject$3, _templateObject2$2, _templateObject3$2;
@@ -4735,7 +4789,7 @@ const LegendValue = _ref => {
4735
4789
  })), React.createElement(LegendSymbolTitle, null, value.title));
4736
4790
  };
4737
4791
 
4738
- const MAX_SIZE$1 = 16;
4792
+ const MAX_SIZE$1 = 26;
4739
4793
 
4740
4794
  const getNumberParam = (parameterValue, param) => {
4741
4795
  return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
@@ -4797,6 +4851,7 @@ const Legend = _ref => {
4797
4851
  }), renderCustomLegend && layer ? renderCustomLegend(layer) : children ? legend && children(legend) : legend && legend.items.map(legendItem => React.createElement(LegendSection, {
4798
4852
  key: legendItem.attribute + "-" + legendItem.parameter,
4799
4853
  item: legendItem,
4854
+ hideTitle: (layer == null ? void 0 : layer.alias) === legendItem.title,
4800
4855
  renderLegendTitle: config && config.renderLegendTitle
4801
4856
  }, legendValue => React.createElement(LegendValue, {
4802
4857
  key: legendValue.title,
@@ -4938,10 +4993,10 @@ const Fullscreen = () => {
4938
4993
 
4939
4994
  var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$1, _templateObject10$1, _templateObject11$1;
4940
4995
  const MapLegendControl = /*#__PURE__*/styled(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
4941
- const MapLegendContainer = /*#__PURE__*/styled.div(_templateObject2$5 || (_templateObject2$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 12.5rem;\n box-sizing: border-box;\n\n canvas {\n height: 1rem;\n width: 1rem;\n }\n"])));
4942
- const MapLegendHeader = /*#__PURE__*/styled(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0.25rem 0;\n font-weight: 500;\n"])));
4996
+ const MapLegendContainer = /*#__PURE__*/styled.div(_templateObject2$5 || (_templateObject2$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 12.5rem;\n box-sizing: border-box;\n\n canvas {\n height: 1.625rem;\n width: 1.625rem;\n }\n"])));
4997
+ const MapLegendHeader = /*#__PURE__*/styled(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 15rem;\n margin-bottom: 0.25rem;\n font-weight: 500;\n"])));
4943
4998
  const MapLegendValueDescr = /*#__PURE__*/styled.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: 0.25rem;\n font-size: 0.75rem;\n font-weight: 500;\n"])));
4944
- const MapLegendItems = /*#__PURE__*/styled.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n border-radius: 0.125rem;\n overflow: hidden;\n"])));
4999
+ const MapLegendItems = /*#__PURE__*/styled.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n border-radius: 0.125rem;\n"])));
4945
5000
  const MapLegendItem = /*#__PURE__*/styled.div(_templateObject6$2 || (_templateObject6$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n height: 1rem;\n background-color: ", ";\n border: 1px rgba(48, 69, 79, 0.1) solid;\n"])), _ref => {
4946
5001
  let {
4947
5002
  value
@@ -4955,8 +5010,14 @@ const MapLegendValuesOther = /*#__PURE__*/styled(MapLegendOther)(_templateObject
4955
5010
  const MapLegendExpandButton = /*#__PURE__*/styled.div(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin: 0.1rem 0 0.5rem;\n font-size: 0.625rem;\n color: #1FB3AA;\n"])));
4956
5011
 
4957
5012
  const getValueFromLegendTitle = (title, minOrMax) => {
4958
- const result = title == null ? void 0 : title.split(" - ");
4959
- return minOrMax === "min" ? result == null ? void 0 : result[0] : result == null ? void 0 : result[1];
5013
+ var _title$split;
5014
+
5015
+ if (title.includes(" - ")) {
5016
+ const result = title == null ? void 0 : title.split(" - ");
5017
+ return minOrMax === "min" ? result == null ? void 0 : result[0] : result == null ? void 0 : result[1];
5018
+ }
5019
+
5020
+ return (title == null ? void 0 : (_title$split = title.split(" ")) == null ? void 0 : _title$split[1]) || "";
4960
5021
  };
4961
5022
 
4962
5023
  const MapLegend = _ref => {
@@ -4984,7 +5045,7 @@ const MapLegend = _ref => {
4984
5045
  className: className
4985
5046
  }, React.createElement(MapLegendHeader, null, layer == null ? void 0 : layer.alias), React.createElement(MapLegendContainer, null, isExpanded ? React.createElement(Legend, {
4986
5047
  layer: layer
4987
- }) : React.createElement(React.Fragment, null, React.createElement(MapLegendValueDescr, null, item.title), React.createElement(MapLegendItems, null, item.values.map(value => React.createElement(MapLegendItem, {
5048
+ }) : React.createElement(React.Fragment, null, item.title !== (layer == null ? void 0 : layer.alias) && React.createElement(MapLegendValueDescr, null, item.title), React.createElement(MapLegendItems, null, item.values.map(value => React.createElement(MapLegendItem, {
4988
5049
  key: value.title,
4989
5050
  title: value.title,
4990
5051
  value: value.parameterValue