@evergis/react 2.0.134 → 2.0.136

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,4 +1,4 @@
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 } from '@evergis/api';
2
2
  import { LabelType } from './label';
3
3
  import { CalculatedAble } from './parameterValue';
4
4
  import { ClientSymbol } from './utils';
@@ -17,11 +17,12 @@ export declare type SimplePolylineSymbol = ClientSymbol<'simplePolylineSymbol',
17
17
  export declare type PolylineSymbol = ClientSymbol<'polylineSymbol', PolylineSymbolDc>;
18
18
  export declare type RasterSymbol = ClientSymbol<'rasterSymbol', RasterSymbolDc>;
19
19
  export declare type CompositeSymbolType = ClientSymbol<'compositeSymbol', CompositeSymbolDc>;
20
+ export declare type H3GridSymbol = ClientSymbol<'h3grid', H3GridSymbolDc>;
20
21
  export declare type SimpleShapeSymbol = PointSymbol | SquareSymbol;
21
22
  export declare type ImageSymbol = MaskedImageSymbol | StaticImageSymbol;
22
23
  export declare type PointSymbolType = SimpleShapeSymbol | ImageSymbol;
23
24
  export declare type PolylineSymbols = PolylineSymbol | SimplePolylineSymbol;
24
- export declare type StyleSymbolType = PointSymbolType | PolygonSymbol | PolylineSymbols | LabelType | RasterSymbol | CompositeSymbolType;
25
+ export declare type StyleSymbolType = PointSymbolType | PolygonSymbol | PolylineSymbols | LabelType | RasterSymbol | CompositeSymbolType | H3GridSymbolDc;
25
26
  export declare type StyleSymbolTypes = StyleSymbolType['type'];
26
27
  export declare type UnknownSymbol = StyleDc['symbol'] | StyleSymbolType;
27
28
  export declare type LayerSymbol = PointSymbol | PolylineSymbols | PolygonSymbol;
@@ -60,4 +61,4 @@ export declare const isTwoDimensionalSymbol: (symbol: UnknownSymbol) => symbol i
60
61
  export declare const isSizableSymbol: (symbol: UnknownSymbol) => symbol is SimpleShapeSymbol;
61
62
  export declare const isStrokeStyledSymbol: (symbol: UnknownSymbol) => symbol is StrokeStyledSymbols;
62
63
  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>;
64
+ 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;
@@ -2793,7 +2793,7 @@ const pointFeature = /*#__PURE__*/new PointFeature.PointFeature([50, -50], {
2793
2793
  const lineFeature = /*#__PURE__*/new Polyline.Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
2794
2794
  crs: Crs.plain
2795
2795
  });
2796
- const polygonFeature = /*#__PURE__*/new Polygon.Polygon([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
2796
+ const polygonFeature = /*#__PURE__*/new Polygon.Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
2797
2797
  crs: Crs.plain
2798
2798
  });
2799
2799
  const h3gridFeature = /*#__PURE__*/new H3Feature.H3Feature([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
@@ -2837,7 +2837,7 @@ function getSymbolRenders(symbol, size, features) {
2837
2837
  const featuresToRender = _extends({}, MOCK_FEATURES, features);
2838
2838
 
2839
2839
  if (isSGisPolygonSymbol(symbol)) {
2840
- return symbol.renderFunctionAsync(featuresToRender.h3grid, resolution, Crs.plain);
2840
+ return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, Crs.plain);
2841
2841
  }
2842
2842
 
2843
2843
  if (isSGisPolylineSymbol(symbol)) {
@@ -2845,7 +2845,7 @@ function getSymbolRenders(symbol, size, features) {
2845
2845
  }
2846
2846
 
2847
2847
  if (isSGisH3Symbol(symbol)) {
2848
- return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, Crs.plain);
2848
+ return symbol.renderFunctionAsync(featuresToRender.h3grid, resolution, Crs.plain);
2849
2849
  }
2850
2850
 
2851
2851
  return symbol.renderFunctionAsync(featuresToRender.point, resolution, Crs.plain);
@@ -2873,6 +2873,9 @@ function renderSymbolToCanvas(renders, canvas) {
2873
2873
 
2874
2874
  function deserializeSymbol(symbol) {
2875
2875
  switch (symbol.type) {
2876
+ case "h3grid":
2877
+ return deserializeH3Symbol(symbol);
2878
+
2876
2879
  case 'circlePointSymbol':
2877
2880
  return deserializePointSymbol(symbol);
2878
2881
 
@@ -2897,6 +2900,17 @@ function deserializeSymbol(symbol) {
2897
2900
  }
2898
2901
  }
2899
2902
 
2903
+ function deserializeH3Symbol(symbol) {
2904
+ var _symbol$stroke, _symbol$stroke2, _symbol$fill;
2905
+
2906
+ return new H3Symbol.H3Symbol(_extends({}, symbol, {
2907
+ cellSize: getParameterValue(symbol.cellSize),
2908
+ strokeWidth: getParameterValue(symbol == null ? void 0 : (_symbol$stroke = symbol.stroke) == null ? void 0 : _symbol$stroke.width),
2909
+ strokeColor: getParameterValue(symbol == null ? void 0 : (_symbol$stroke2 = symbol.stroke) == null ? void 0 : _symbol$stroke2.color),
2910
+ fillColor: getParameterValue(symbol == null ? void 0 : (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color)
2911
+ }));
2912
+ }
2913
+
2900
2914
  function deserializePointSymbol(symbol) {
2901
2915
  // @ts-ignore
2902
2916
  return new Point.PointSymbol(deserializePointSymbolParams(symbol));
@@ -4671,7 +4685,7 @@ const EvergisSelect = _ref => {
4671
4685
  };
4672
4686
 
4673
4687
  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"])));
4688
+ const LegendContainer = /*#__PURE__*/styled__default.div(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background-color: white;\n"])));
4675
4689
  const LegendSectionContainer = /*#__PURE__*/styled__default.div(_templateObject2$1 || (_templateObject2$1 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
4676
4690
  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
4691
  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);
@@ -4681,9 +4695,10 @@ const LegendSection = _ref => {
4681
4695
  let {
4682
4696
  item,
4683
4697
  renderLegendTitle,
4698
+ hideTitle,
4684
4699
  children
4685
4700
  } = _ref;
4686
- return React__default.createElement(LegendSectionContainer, null, React__default.createElement(LegendSectionHeader, null, renderLegendTitle ? renderLegendTitle(item) : item.title), item.values.map(children));
4701
+ return React__default.createElement(LegendSectionContainer, null, !hideTitle && React__default.createElement(LegendSectionHeader, null, renderLegendTitle ? renderLegendTitle(item) : item.title), item.values.map(children));
4687
4702
  };
4688
4703
 
4689
4704
  var _templateObject$3, _templateObject2$2, _templateObject3$2;
@@ -4799,6 +4814,7 @@ const Legend = _ref => {
4799
4814
  }), renderCustomLegend && layer ? renderCustomLegend(layer) : children ? legend && children(legend) : legend && legend.items.map(legendItem => React__default.createElement(LegendSection, {
4800
4815
  key: legendItem.attribute + "-" + legendItem.parameter,
4801
4816
  item: legendItem,
4817
+ hideTitle: (layer == null ? void 0 : layer.alias) === legendItem.title,
4802
4818
  renderLegendTitle: config && config.renderLegendTitle
4803
4819
  }, legendValue => React__default.createElement(LegendValue, {
4804
4820
  key: legendValue.title,
@@ -4940,10 +4956,10 @@ const Fullscreen = () => {
4940
4956
 
4941
4957
  var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$1, _templateObject10$1, _templateObject11$1;
4942
4958
  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: 100%;\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-bottom: 0.25rem;\n font-weight: 500;\n"])));
4959
+ 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"])));
4960
+ 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
4961
  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"])));
4962
+ 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
4963
  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
4964
  let {
4949
4965
  value
@@ -4957,8 +4973,14 @@ const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templ
4957
4973
  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
4974
 
4959
4975
  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];
4976
+ var _title$split;
4977
+
4978
+ if (title.includes(" - ")) {
4979
+ const result = title == null ? void 0 : title.split(" - ");
4980
+ return minOrMax === "min" ? result == null ? void 0 : result[0] : result == null ? void 0 : result[1];
4981
+ }
4982
+
4983
+ return (title == null ? void 0 : (_title$split = title.split(" ")) == null ? void 0 : _title$split[1]) || "";
4962
4984
  };
4963
4985
 
4964
4986
  const MapLegend = _ref => {
@@ -4986,7 +5008,7 @@ const MapLegend = _ref => {
4986
5008
  className: className
4987
5009
  }, React__default.createElement(MapLegendHeader, null, layer == null ? void 0 : layer.alias), React__default.createElement(MapLegendContainer, null, isExpanded ? React__default.createElement(Legend, {
4988
5010
  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, {
5011
+ }) : 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
5012
  key: value.title,
4991
5013
  title: value.title,
4992
5014
  value: value.parameterValue
@@ -5503,7 +5525,6 @@ exports.getDashStylePreset = getDashStylePreset;
5503
5525
  exports.getFeatureSymbol = getFeatureSymbol;
5504
5526
  exports.getLegendSymbolRenders = getLegendSymbolRenders;
5505
5527
  exports.getLineDash = getLineDash;
5506
- exports.getLineMiterRender = getLineMiterRender;
5507
5528
  exports.getMapLegendSymbolRenders = getMapLegendSymbolRenders;
5508
5529
  exports.getMapState = getMapState;
5509
5530
  exports.getParameterValue = getParameterValue;