@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.
@@ -3,6 +3,7 @@ import { LegendItem, LegendValueType } from '../../core';
3
3
  declare type LegendSectionProps = {
4
4
  item: LegendItem;
5
5
  children: (value: LegendValueType) => React.ReactNode;
6
+ hideTitle?: boolean;
6
7
  renderLegendTitle?: (item: React.ReactNode | LegendItem) => React.ReactNode;
7
8
  };
8
9
  export declare const LegendSection: React.FC<LegendSectionProps>;
@@ -1,9 +1,10 @@
1
- import { CirclePointSymbolDc, CompositeSymbolDc, ImagePointSymbolDc, MaskedImagePointSymbolDc, PolygonSymbolDc, PolylineSymbolDc, RasterSymbolDc, SimplePolylineSymbolDc, SquarePointSymbolDc, StyleDc } from '@evergis/api';
1
+ import { CirclePointSymbolDc, CompositeSymbolDc, H3GridSymbolDc, ImagePointSymbolDc, MaskedImagePointSymbolDc, PolygonSymbolDc, PolylineSymbolDc, RasterSymbolDc, SimplePolylineSymbolDc, SquarePointSymbolDc, StyleDc, SvgPointSymbolDc } from '@evergis/api';
2
2
  import { LabelType } from './label';
3
3
  import { CalculatedAble } from './parameterValue';
4
4
  import { ClientSymbol } from './utils';
5
5
  import { FillBrushType, StrokeBrushType } from './brush';
6
6
  export declare type PointSymbol = ClientSymbol<'circlePointSymbol', CirclePointSymbolDc>;
7
+ export declare type SvgPointSymbol = ClientSymbol<'svgPointSymbol', SvgPointSymbolDc>;
7
8
  export declare type SquareSymbol = ClientSymbol<'squarePointSymbol', SquarePointSymbolDc> & {
8
9
  angle?: CalculatedAble<number>;
9
10
  };
@@ -17,11 +18,12 @@ export declare type SimplePolylineSymbol = ClientSymbol<'simplePolylineSymbol',
17
18
  export declare type PolylineSymbol = ClientSymbol<'polylineSymbol', PolylineSymbolDc>;
18
19
  export declare type RasterSymbol = ClientSymbol<'rasterSymbol', RasterSymbolDc>;
19
20
  export declare type CompositeSymbolType = ClientSymbol<'compositeSymbol', CompositeSymbolDc>;
21
+ export declare type H3GridSymbol = ClientSymbol<'h3grid', H3GridSymbolDc>;
20
22
  export declare type SimpleShapeSymbol = PointSymbol | SquareSymbol;
21
23
  export declare type ImageSymbol = MaskedImageSymbol | StaticImageSymbol;
22
24
  export declare type PointSymbolType = SimpleShapeSymbol | ImageSymbol;
23
25
  export declare type PolylineSymbols = PolylineSymbol | SimplePolylineSymbol;
24
- export declare type StyleSymbolType = PointSymbolType | PolygonSymbol | PolylineSymbols | LabelType | RasterSymbol | CompositeSymbolType;
26
+ export declare type StyleSymbolType = PointSymbolType | PolygonSymbol | PolylineSymbols | LabelType | RasterSymbol | CompositeSymbolType | H3GridSymbolDc;
25
27
  export declare type StyleSymbolTypes = StyleSymbolType['type'];
26
28
  export declare type UnknownSymbol = StyleDc['symbol'] | StyleSymbolType;
27
29
  export declare type LayerSymbol = PointSymbol | PolylineSymbols | PolygonSymbol;
@@ -60,4 +62,4 @@ export declare const isTwoDimensionalSymbol: (symbol: UnknownSymbol) => symbol i
60
62
  export declare const isSizableSymbol: (symbol: UnknownSymbol) => symbol is SimpleShapeSymbol;
61
63
  export declare const isStrokeStyledSymbol: (symbol: UnknownSymbol) => symbol is StrokeStyledSymbols;
62
64
  export declare const isScalablePolylineSymbol: (symbol: PolylineSymbol | SimplePolylineSymbol) => boolean | undefined;
63
- export declare const isSimpleSymbol: (symbol: UnknownSymbol) => symbol is ClientSymbol<"circlePointSymbol", CirclePointSymbolDc, never> | ClientSymbol<"maskedImagePointSymbol", MaskedImagePointSymbolDc, never> | ClientSymbol<"imagePointSymbol", ImagePointSymbolDc, never> | ClientSymbol<"simplePolylineSymbol", SimplePolylineSymbolDc, never> | ClientSymbol<"polylineSymbol", PolylineSymbolDc, never> | ClientSymbol<"rasterSymbol", RasterSymbolDc, never> | SquareSymbol | PolygonSymbol<FillBrushType, StrokeBrushType>;
65
+ export declare const isSimpleSymbol: (symbol: UnknownSymbol) => symbol is ClientSymbol<"circlePointSymbol", CirclePointSymbolDc, never> | ClientSymbol<"maskedImagePointSymbol", MaskedImagePointSymbolDc, never> | ClientSymbol<"imagePointSymbol", ImagePointSymbolDc, never> | ClientSymbol<"simplePolylineSymbol", SimplePolylineSymbolDc, never> | ClientSymbol<"polylineSymbol", PolylineSymbolDc, never> | ClientSymbol<"rasterSymbol", RasterSymbolDc, never> | H3GridSymbolDc | SquareSymbol | PolygonSymbol<FillBrushType, StrokeBrushType>;
@@ -3,4 +3,4 @@ export declare type LegendSymbolPart = {
3
3
  parameter: ClassificationParameterExtended;
4
4
  parameterValue: ParameterValueWithSymbol;
5
5
  };
6
- export declare const useLegendValueSymbol: ({ parameter, parameterValue, }: LegendSymbolPart) => import("@evergis/sgis/es/symbols/point/Point").PointSymbol | import("@evergis/sgis/es/symbols/point/StaticImageSymbol").StaticImageSymbol | import("@evergis/sgis/es/symbols/point/Square").SquareSymbol | import("@evergis/sgis/es/symbols/point/MaskedImage").MaskedImage | import("@evergis/sgis/es/symbols/polygon/Simple").PolygonSymbol | import("@evergis/sgis/es/symbols/polygon/BrushFill").BrushFill | import("@evergis/sgis/es/symbols/polygon/ImageFill").ImageFill | import("@evergis/sgis/es/symbols/PolylineSymbol").PolylineSymbol | import("@evergis/sgis/es/symbols/H3Symbol").H3Symbol | null;
6
+ export declare const useLegendValueSymbol: ({ parameter, parameterValue, }: LegendSymbolPart) => import("@evergis/sgis/es/symbols/point/Point").PointSymbol | import("@evergis/sgis/es/symbols/point/StaticImageSymbol").StaticImageSymbol | import("@evergis/sgis/es/symbols/point/Square").SquareSymbol | import("@evergis/sgis/es/symbols/point/MaskedImage").MaskedImage | import("@evergis/sgis/es/symbols/polygon/Simple").PolygonSymbol | import("@evergis/sgis/es/symbols/polygon/BrushFill").BrushFill | import("@evergis/sgis/es/symbols/polygon/ImageFill").ImageFill | import("@evergis/sgis/es/symbols/PolylineSymbol").PolylineSymbol | import("../../core").ClientSymbol<"h3grid", import("@evergis/api").H3GridSymbolDc, never> | null;
@@ -8,5 +8,5 @@ export interface UseSymbolParams {
8
8
  size?: number;
9
9
  maxWidth?: number;
10
10
  }
11
- export declare const DEFAULT_SYMBOL_SIZE = 16;
11
+ export declare const DEFAULT_SYMBOL_SIZE = 26;
12
12
  export declare function useSymbol({ symbol, size, render, maxWidth, }: UseSymbolParams, canvasRef: MutableRefObject<Canvas | null>): void;
@@ -2802,7 +2802,7 @@ const h3gridFeature = /*#__PURE__*/new H3Feature.H3Feature([[50, -15], [80, -33]
2802
2802
  const lineLegendFeature = /*#__PURE__*/new Polyline.Polyline([[0, -50], [100, -50]], {
2803
2803
  crs: Crs.plain
2804
2804
  });
2805
- const polygonLegendFeature = /*#__PURE__*/new Polygon.Polygon([[0, 0], [100, 0], [100, -100], [0, -100]], {
2805
+ const polygonLegendFeature = /*#__PURE__*/new Polygon.Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
2806
2806
  crs: Crs.plain
2807
2807
  });
2808
2808
  const polygonMapLegendFeature = /*#__PURE__*/new Polygon.Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
@@ -2812,6 +2812,7 @@ const MAP_LEGEND_FEATURES = {
2812
2812
  polygon: polygonMapLegendFeature
2813
2813
  };
2814
2814
  const LEGEND_FEATURES = {
2815
+ point: pointFeature,
2815
2816
  polyline: lineLegendFeature,
2816
2817
  polygon: polygonLegendFeature,
2817
2818
  h3grid: h3gridFeature
@@ -2873,6 +2874,12 @@ function renderSymbolToCanvas(renders, canvas) {
2873
2874
 
2874
2875
  function deserializeSymbol(symbol) {
2875
2876
  switch (symbol.type) {
2877
+ case "h3grid":
2878
+ return deserializeH3Symbol(symbol);
2879
+
2880
+ case "svgPointSymbol":
2881
+ return deserializeSvgPointSymbol(symbol);
2882
+
2876
2883
  case 'circlePointSymbol':
2877
2884
  return deserializePointSymbol(symbol);
2878
2885
 
@@ -2897,11 +2904,57 @@ function deserializeSymbol(symbol) {
2897
2904
  }
2898
2905
  }
2899
2906
 
2907
+ function deserializeH3Symbol(symbol) {
2908
+ var _symbol$stroke, _symbol$stroke2, _symbol$fill;
2909
+
2910
+ return new H3Symbol.H3Symbol(_extends({}, symbol, {
2911
+ cellSize: getParameterValue(symbol.cellSize),
2912
+ strokeWidth: getParameterValue(symbol == null ? void 0 : (_symbol$stroke = symbol.stroke) == null ? void 0 : _symbol$stroke.width),
2913
+ strokeColor: getParameterValue(symbol == null ? void 0 : (_symbol$stroke2 = symbol.stroke) == null ? void 0 : _symbol$stroke2.color),
2914
+ fillColor: getParameterValue(symbol == null ? void 0 : (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color)
2915
+ }));
2916
+ }
2917
+
2900
2918
  function deserializePointSymbol(symbol) {
2901
2919
  // @ts-ignore
2902
2920
  return new Point.PointSymbol(deserializePointSymbolParams(symbol));
2903
2921
  }
2904
2922
 
2923
+ const getOffsetParameterValue = offset => [getParameterValue(offset == null ? void 0 : offset[0]), getParameterValue(offset == null ? void 0 : offset[1])];
2924
+
2925
+ function deserializeSvgPointSymbolParams(_ref) {
2926
+ let {
2927
+ type,
2928
+ data,
2929
+ size,
2930
+ offset,
2931
+ angle,
2932
+ background,
2933
+ figure
2934
+ } = _ref;
2935
+ return _extends({
2936
+ type: getParameterValue(type),
2937
+ data: getParameterValue(data),
2938
+ size: getParameterValue(size),
2939
+ offset: getOffsetParameterValue(offset),
2940
+ angle: getParameterValue(angle)
2941
+ }, background ? {
2942
+ background: _extends({}, background, {
2943
+ fillColor: deserializeColor(getParameterValue(background == null ? void 0 : background.fillColor)),
2944
+ strokeColor: deserializeColor(getParameterValue(background == null ? void 0 : background.strokeColor)),
2945
+ strokeWidth: getParameterValue(background == null ? void 0 : background.strokeWidth)
2946
+ })
2947
+ } : {}, figure ? {
2948
+ figure: _extends({}, figure, {
2949
+ fillColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.fillColor))
2950
+ })
2951
+ } : {});
2952
+ }
2953
+
2954
+ function deserializeSvgPointSymbol(symbol) {
2955
+ return new Point.PointSymbol(deserializeSvgPointSymbolParams(symbol));
2956
+ }
2957
+
2905
2958
  function deserializeSquareSymbol(symbol) {
2906
2959
  return new Square.SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
2907
2960
  // @ts-ignore
@@ -2959,14 +3012,14 @@ function deserializePolylineSymbol(symbol) {
2959
3012
  return new SGisPolylineSymbol(symbol);
2960
3013
  }
2961
3014
 
2962
- function deserializePointSymbolParams(_ref) {
3015
+ function deserializePointSymbolParams(_ref2) {
2963
3016
  let {
2964
3017
  size,
2965
3018
  offset,
2966
3019
  strokeColor,
2967
3020
  strokeWidth,
2968
3021
  fillColor
2969
- } = _ref;
3022
+ } = _ref2;
2970
3023
  return {
2971
3024
  size: getParameterValue(size),
2972
3025
  offset: deserializeAnchor(offset),
@@ -3425,7 +3478,7 @@ const useLegendValueSymbol = _ref => {
3425
3478
  });
3426
3479
  };
3427
3480
 
3428
- const DEFAULT_SYMBOL_SIZE = 16;
3481
+ const DEFAULT_SYMBOL_SIZE = 26;
3429
3482
  function useSymbol(_ref, canvasRef) {
3430
3483
  let {
3431
3484
  symbol,
@@ -4671,19 +4724,20 @@ const EvergisSelect = _ref => {
4671
4724
  };
4672
4725
 
4673
4726
  var _templateObject$2, _templateObject2$1, _templateObject3$1, _templateObject4$1, _templateObject5$1;
4674
- const LegendContainer = /*#__PURE__*/styled__default.div(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background-color: #fff;\n\n canvas {\n border-radius: 0.125rem;\n }\n"])));
4727
+ const LegendContainer = /*#__PURE__*/styled__default.div(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background-color: white;\n"])));
4675
4728
  const LegendSectionContainer = /*#__PURE__*/styled__default.div(_templateObject2$1 || (_templateObject2$1 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
4676
4729
  const LegendSymbolTitle = /*#__PURE__*/styled__default.p(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n"])));
4677
- const LegendValueContainer = /*#__PURE__*/styled__default.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);
4730
+ const LegendValueContainer = /*#__PURE__*/styled__default.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);
4678
4731
  const LegendSectionHeader = /*#__PURE__*/styled__default.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n font-weight: 500;\n"])));
4679
4732
 
4680
4733
  const LegendSection = _ref => {
4681
4734
  let {
4682
4735
  item,
4683
4736
  renderLegendTitle,
4737
+ hideTitle,
4684
4738
  children
4685
4739
  } = _ref;
4686
- return React__default.createElement(LegendSectionContainer, null, React__default.createElement(LegendSectionHeader, null, renderLegendTitle ? renderLegendTitle(item) : item.title), item.values.map(children));
4740
+ return React__default.createElement(LegendSectionContainer, null, !hideTitle && React__default.createElement(LegendSectionHeader, null, renderLegendTitle ? renderLegendTitle(item) : item.title), item.values.map(children));
4687
4741
  };
4688
4742
 
4689
4743
  var _templateObject$3, _templateObject2$2, _templateObject3$2;
@@ -4737,7 +4791,7 @@ const LegendValue = _ref => {
4737
4791
  })), React__default.createElement(LegendSymbolTitle, null, value.title));
4738
4792
  };
4739
4793
 
4740
- const MAX_SIZE$1 = 16;
4794
+ const MAX_SIZE$1 = 26;
4741
4795
 
4742
4796
  const getNumberParam = (parameterValue, param) => {
4743
4797
  return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
@@ -4799,6 +4853,7 @@ const Legend = _ref => {
4799
4853
  }), renderCustomLegend && layer ? renderCustomLegend(layer) : children ? legend && children(legend) : legend && legend.items.map(legendItem => React__default.createElement(LegendSection, {
4800
4854
  key: legendItem.attribute + "-" + legendItem.parameter,
4801
4855
  item: legendItem,
4856
+ hideTitle: (layer == null ? void 0 : layer.alias) === legendItem.title,
4802
4857
  renderLegendTitle: config && config.renderLegendTitle
4803
4858
  }, legendValue => React__default.createElement(LegendValue, {
4804
4859
  key: legendValue.title,
@@ -4940,10 +4995,10 @@ const Fullscreen = () => {
4940
4995
 
4941
4996
  var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$1, _templateObject10$1, _templateObject11$1;
4942
4997
  const MapLegendControl = /*#__PURE__*/styled__default(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
4943
- const MapLegendContainer = /*#__PURE__*/styled__default.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"])));
4944
- const MapLegendHeader = /*#__PURE__*/styled__default(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0.25rem 0;\n font-weight: 500;\n"])));
4998
+ const MapLegendContainer = /*#__PURE__*/styled__default.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"])));
4999
+ const MapLegendHeader = /*#__PURE__*/styled__default(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 15rem;\n margin-bottom: 0.25rem;\n font-weight: 500;\n"])));
4945
5000
  const MapLegendValueDescr = /*#__PURE__*/styled__default.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: 0.25rem;\n font-size: 0.75rem;\n font-weight: 500;\n"])));
4946
- const MapLegendItems = /*#__PURE__*/styled__default.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n border-radius: 0.125rem;\n overflow: hidden;\n"])));
5001
+ const MapLegendItems = /*#__PURE__*/styled__default.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n border-radius: 0.125rem;\n"])));
4947
5002
  const MapLegendItem = /*#__PURE__*/styled__default.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 => {
4948
5003
  let {
4949
5004
  value
@@ -4957,8 +5012,14 @@ const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templ
4957
5012
  const MapLegendExpandButton = /*#__PURE__*/styled__default.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"])));
4958
5013
 
4959
5014
  const getValueFromLegendTitle = (title, minOrMax) => {
4960
- const result = title == null ? void 0 : title.split(" - ");
4961
- return minOrMax === "min" ? result == null ? void 0 : result[0] : result == null ? void 0 : result[1];
5015
+ var _title$split;
5016
+
5017
+ if (title.includes(" - ")) {
5018
+ const result = title == null ? void 0 : title.split(" - ");
5019
+ return minOrMax === "min" ? result == null ? void 0 : result[0] : result == null ? void 0 : result[1];
5020
+ }
5021
+
5022
+ return (title == null ? void 0 : (_title$split = title.split(" ")) == null ? void 0 : _title$split[1]) || "";
4962
5023
  };
4963
5024
 
4964
5025
  const MapLegend = _ref => {
@@ -4986,7 +5047,7 @@ const MapLegend = _ref => {
4986
5047
  className: className
4987
5048
  }, React__default.createElement(MapLegendHeader, null, layer == null ? void 0 : layer.alias), React__default.createElement(MapLegendContainer, null, isExpanded ? React__default.createElement(Legend, {
4988
5049
  layer: layer
4989
- }) : React__default.createElement(React__default.Fragment, null, React__default.createElement(MapLegendValueDescr, null, item.title), React__default.createElement(MapLegendItems, null, item.values.map(value => React__default.createElement(MapLegendItem, {
5050
+ }) : React__default.createElement(React__default.Fragment, null, item.title !== (layer == null ? void 0 : layer.alias) && React__default.createElement(MapLegendValueDescr, null, item.title), React__default.createElement(MapLegendItems, null, item.values.map(value => React__default.createElement(MapLegendItem, {
4990
5051
  key: value.title,
4991
5052
  title: value.title,
4992
5053
  value: value.parameterValue