@evergis/react 2.0.133 → 2.0.135

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.
@@ -1,8 +1,3 @@
1
1
  import React from 'react';
2
- import { LegendProps } from '../Legend';
3
- declare type MapLegendProps = LegendProps & {
4
- fromToTitle?: [string, string];
5
- className?: string;
6
- };
2
+ import { MapLegendProps } from "./types";
7
3
  export declare const MapLegend: React.FC<MapLegendProps>;
8
- export {};
@@ -1,3 +1,3 @@
1
1
  export * from './MapLegend';
2
2
  export * from './MapLegendSymbol';
3
- export { MapLegendContainer, MapLegendHeader, MapLegendSection, } from './styled';
3
+ export { MapLegendContainer, MapLegendHeader, } from './styled';
@@ -1,5 +1,17 @@
1
1
  export declare const MapLegendControl: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const MapLegendContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const MapLegendHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- export declare const MapLegendSection: import("styled-components").StyledComponent<"div", any, {}, never>;
5
4
  export declare const MapLegendValueDescr: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ export declare const MapLegendItems: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ export declare const MapLegendItem: import("styled-components").StyledComponent<"div", any, {
7
+ value?: string | undefined;
8
+ }, never>;
9
+ export declare const MapLegendOther: import("styled-components").StyledComponent<"div", any, {
10
+ value?: string | undefined;
11
+ }, never>;
12
+ export declare const MapLegendValues: import("styled-components").StyledComponent<"div", any, {}, never>;
13
+ export declare const MapLegendValuesRange: import("styled-components").StyledComponent<"div", any, {}, never>;
14
+ export declare const MapLegendValuesOther: import("styled-components").StyledComponent<"div", any, {
15
+ value?: string | undefined;
16
+ }, never>;
17
+ export declare const MapLegendExpandButton: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,5 @@
1
+ import { LegendProps } from "../Legend";
2
+ export declare type MapLegendProps = LegendProps & {
3
+ fromToTitle?: [string, string];
4
+ className?: string;
5
+ };
@@ -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]], {
@@ -4673,9 +4673,9 @@ const EvergisSelect = _ref => {
4673
4673
  var _templateObject$2, _templateObject2$1, _templateObject3$1, _templateObject4$1, _templateObject5$1;
4674
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"])));
4675
4675
  const LegendSectionContainer = /*#__PURE__*/styled__default.div(_templateObject2$1 || (_templateObject2$1 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
4676
- const LegendSymbolTitle = /*#__PURE__*/styled__default.p(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin: 0;\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.625rem;\n padding: 0.125rem 0;\n\n ", " {\n padding-left: 0.5rem;\n }\n"])), LegendSymbolTitle);
4678
- const LegendSectionHeader = /*#__PURE__*/styled__default.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])));
4676
+ 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);
4678
+ const LegendSectionHeader = /*#__PURE__*/styled__default.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n font-weight: 500;\n"])));
4679
4679
 
4680
4680
  const LegendSection = _ref => {
4681
4681
  let {
@@ -4938,39 +4938,39 @@ const Fullscreen = () => {
4938
4938
  }));
4939
4939
  };
4940
4940
 
4941
- var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4;
4941
+ var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$1, _templateObject10$1, _templateObject11$1;
4942
4942
  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: 16.5rem;\n height: 3.875rem;\n align-items: center;\n padding: 0.5rem;\n box-sizing: border-box;\n\n canvas {\n height: 1rem;\n width: 0.835rem;\n }\n"])));
4944
- const MapLegendHeader = /*#__PURE__*/styled__default(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
4945
- const MapLegendSection = /*#__PURE__*/styled__default.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
4946
- const MapLegendValueDescr = /*#__PURE__*/styled__default.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0.5rem;\n font-size: 0.625rem;\n opacity: 0.65;\n"])));
4947
-
4948
- const MAX_SIZE$2 = 100;
4949
- const MapLegendSymbol = _ref => {
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"])));
4945
+ 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"])));
4947
+ 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 => {
4950
4948
  let {
4951
- value,
4952
- parameter
4949
+ value
4953
4950
  } = _ref;
4954
- return React__default.createElement(LegendSymbol, {
4955
- key: value.title,
4956
- parameter: parameter,
4957
- parameterValue: value.parameterValue
4958
- }, symbol => React__default.createElement(Symbol, {
4959
- render: getMapLegendSymbolRenders,
4960
- symbol: symbol,
4961
- size: MAX_SIZE$2
4962
- }));
4951
+ return value;
4952
+ });
4953
+ const MapLegendOther = /*#__PURE__*/styled__default(MapLegendItem)(_templateObject7$2 || (_templateObject7$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: none;\n width: 1rem;\n margin-left: 0.25rem;\n border-radius: 0.125rem;\n overflow: hidden;\n"])));
4954
+ const MapLegendValues = /*#__PURE__*/styled__default.div(_templateObject8$2 || (_templateObject8$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n font-size: 0.75rem;\n color: rgba(48, 69, 79, 0.65);\n"])));
4955
+ const MapLegendValuesRange = /*#__PURE__*/styled__default.div(_templateObject9$1 || (_templateObject9$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n"])));
4956
+ const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 0;\n text-align: center;\n overflow: visible;\n"])));
4957
+ 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
+
4959
+ 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];
4963
4962
  };
4964
4963
 
4965
- const DEFAULT_FROM_TO = ['Выше', 'Ниже'];
4966
4964
  const MapLegend = _ref => {
4965
+ var _symbol$fill, _item$values$, _item$values;
4966
+
4967
4967
  let {
4968
4968
  layer,
4969
4969
  config,
4970
- fromToTitle = DEFAULT_FROM_TO,
4971
4970
  className
4972
4971
  } = _ref;
4973
4972
  const legend = useMapLegend(layer, config);
4973
+ const [isExpanded, toggleExpanded] = ui.useToggle();
4974
4974
 
4975
4975
  if (!legend) {
4976
4976
  return null;
@@ -4984,11 +4984,35 @@ const MapLegend = _ref => {
4984
4984
  symbol: symbol
4985
4985
  }, React__default.createElement(MapLegendControl, {
4986
4986
  className: className
4987
- }, React__default.createElement(MapLegendContainer, null, React__default.createElement(MapLegendHeader, null, item.title), React__default.createElement(MapLegendSection, null, React__default.createElement(MapLegendValueDescr, null, fromToTitle[0]), item.values.map(value => React__default.createElement(MapLegendSymbol, {
4987
+ }, React__default.createElement(MapLegendHeader, null, layer == null ? void 0 : layer.alias), React__default.createElement(MapLegendContainer, null, isExpanded ? React__default.createElement(Legend, {
4988
+ 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, {
4988
4990
  key: value.title,
4989
- value: value,
4990
- parameter: item.parameter
4991
- })), React__default.createElement(MapLegendValueDescr, null, fromToTitle[1])))));
4991
+ title: value.title,
4992
+ value: value.parameterValue
4993
+ })), React__default.createElement(MapLegendOther, {
4994
+ title: "\u0414\u0440\u0443\u0433\u043E\u0435",
4995
+ value: (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color
4996
+ })), React__default.createElement(MapLegendValues, null, React__default.createElement(MapLegendValuesRange, null, React__default.createElement("div", null, getValueFromLegendTitle((_item$values$ = item.values[0]) == null ? void 0 : _item$values$.title, "max")), React__default.createElement("div", null, getValueFromLegendTitle((_item$values = item.values[item.values.length - 1]) == null ? void 0 : _item$values.title, "min"))), React__default.createElement(MapLegendValuesOther, null, "-"))), React__default.createElement(MapLegendExpandButton, {
4997
+ onClick: toggleExpanded
4998
+ }, isExpanded ? "Свернуть" : "Развернуть"))));
4999
+ };
5000
+
5001
+ const MAX_SIZE$2 = 100;
5002
+ const MapLegendSymbol = _ref => {
5003
+ let {
5004
+ value,
5005
+ parameter
5006
+ } = _ref;
5007
+ return React__default.createElement(LegendSymbol, {
5008
+ key: value.title,
5009
+ parameter: parameter,
5010
+ parameterValue: value.parameterValue
5011
+ }, symbol => React__default.createElement(Symbol, {
5012
+ render: getMapLegendSymbolRenders,
5013
+ symbol: symbol,
5014
+ size: MAX_SIZE$2
5015
+ }));
4992
5016
  };
4993
5017
 
4994
5018
  let MeasureTool = /*#__PURE__*/function (_React$Component) {
@@ -5256,7 +5280,7 @@ const ZoomLevel = () => {
5256
5280
  }, level || 0);
5257
5281
  };
5258
5282
 
5259
- var _templateObject$8, _templateObject2$7, _templateObject3$7, _templateObject4$5, _templateObject5$5, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$1, _templateObject10$1, _templateObject11$1;
5283
+ var _templateObject$8, _templateObject2$7, _templateObject3$7, _templateObject4$5, _templateObject5$5, _templateObject6$3, _templateObject7$3, _templateObject8$3, _templateObject9$2, _templateObject10$2, _templateObject11$2;
5260
5284
 
5261
5285
  const cornerBottom = cornerSize => styled.css(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n &:before {\n left: 50%;\n transform: translate(-50%, 100%);\n bottom: 0;\n border-left: ", " solid transparent;\n border-right: ", " solid transparent;\n border-top: ", " solid rgba(28, 33, 48, 0.8);\n }\n"])), cornerSize, cornerSize, cornerSize);
5262
5286
 
@@ -5268,21 +5292,21 @@ const cornerTop = cornerSize => styled.css(_templateObject4$5 || (_templateObjec
5268
5292
 
5269
5293
  const top = (distance, cornerSize) => styled.css(_templateObject5$5 || (_templateObject5$5 = _taggedTemplateLiteralLoose(["\n transform: translate(-50%, 0);\n left: -50%;\n bottom: ", ";\n ", "\n"])), distance, cornerSize && cornerBottom(cornerSize));
5270
5294
 
5271
- const right = (distance, cornerSize) => styled.css(_templateObject6$2 || (_templateObject6$2 = _taggedTemplateLiteralLoose(["\n transform: translate(0, -50%);\n top: -50%;\n left: ", ";\n ", "\n"])), distance, cornerSize && cornerLeft(cornerSize));
5295
+ const right = (distance, cornerSize) => styled.css(_templateObject6$3 || (_templateObject6$3 = _taggedTemplateLiteralLoose(["\n transform: translate(0, -50%);\n top: -50%;\n left: ", ";\n ", "\n"])), distance, cornerSize && cornerLeft(cornerSize));
5272
5296
 
5273
- const left = (distance, cornerSize) => styled.css(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteralLoose(["\n transform: translate(0, -50%);\n top: -50%;\n right: ", ";\n ", "\n"])), distance, cornerSize && cornerRight(cornerSize));
5297
+ const left = (distance, cornerSize) => styled.css(_templateObject7$3 || (_templateObject7$3 = _taggedTemplateLiteralLoose(["\n transform: translate(0, -50%);\n top: -50%;\n right: ", ";\n ", "\n"])), distance, cornerSize && cornerRight(cornerSize));
5274
5298
 
5275
- const bottom = (distance, cornerSize) => styled.css(_templateObject8$2 || (_templateObject8$2 = _taggedTemplateLiteralLoose(["\n transform: translate(-50%, 0);\n left: -50%;\n top: ", ";\n ", "\n"])), distance, cornerSize && cornerTop(cornerSize));
5299
+ const bottom = (distance, cornerSize) => styled.css(_templateObject8$3 || (_templateObject8$3 = _taggedTemplateLiteralLoose(["\n transform: translate(-50%, 0);\n left: -50%;\n top: ", ";\n ", "\n"])), distance, cornerSize && cornerTop(cornerSize));
5276
5300
 
5277
5301
  const placementMixin$1 = function placementMixin(placement, distance, cornerSize) {
5278
5302
  if (placement === void 0) {
5279
5303
  placement = 'top';
5280
5304
  }
5281
5305
 
5282
- return styled.css(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteralLoose(["\n ", "\n ", "\n ", "\n ", "\n"])), placement === 'top' && top(distance, cornerSize), placement === 'right' && right(distance, cornerSize), placement === 'left' && left(distance, cornerSize), placement === 'bottom' && bottom(distance, cornerSize));
5306
+ return styled.css(_templateObject9$2 || (_templateObject9$2 = _taggedTemplateLiteralLoose(["\n ", "\n ", "\n ", "\n ", "\n"])), placement === 'top' && top(distance, cornerSize), placement === 'right' && right(distance, cornerSize), placement === 'left' && left(distance, cornerSize), placement === 'bottom' && bottom(distance, cornerSize));
5283
5307
  };
5284
- const corner = /*#__PURE__*/styled.css(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n &:before {\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n }\n"])));
5285
- const TooltipComponent = /*#__PURE__*/styled__default.div(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n z-index: 999;\n display: flex;\n font-size: 0.625rem;\n color: #fff;\n background-color: rgba(28, 33, 48, 0.8);\n padding: 0.4em 0.6em;\n border-radius: 2px;\n user-select: none;\n box-sizing: border-box;\n white-space: pre;\n ", "\n ", "\n"])), _ref => {
5308
+ const corner = /*#__PURE__*/styled.css(_templateObject10$2 || (_templateObject10$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n &:before {\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n }\n"])));
5309
+ const TooltipComponent = /*#__PURE__*/styled__default.div(_templateObject11$2 || (_templateObject11$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n z-index: 999;\n display: flex;\n font-size: 0.625rem;\n color: #fff;\n background-color: rgba(28, 33, 48, 0.8);\n padding: 0.4em 0.6em;\n border-radius: 2px;\n user-select: none;\n box-sizing: border-box;\n white-space: pre;\n ", "\n ", "\n"])), _ref => {
5286
5310
  let {
5287
5311
  placement,
5288
5312
  distance = '0.5rem',
@@ -5419,7 +5443,6 @@ exports.MapControls = MapControls;
5419
5443
  exports.MapLegend = MapLegend;
5420
5444
  exports.MapLegendContainer = MapLegendContainer;
5421
5445
  exports.MapLegendHeader = MapLegendHeader;
5422
- exports.MapLegendSection = MapLegendSection;
5423
5446
  exports.MapLegendSymbol = MapLegendSymbol;
5424
5447
  exports.MapProvider = MapProvider;
5425
5448
  exports.Measure = Measure;
@@ -5480,7 +5503,6 @@ exports.getDashStylePreset = getDashStylePreset;
5480
5503
  exports.getFeatureSymbol = getFeatureSymbol;
5481
5504
  exports.getLegendSymbolRenders = getLegendSymbolRenders;
5482
5505
  exports.getLineDash = getLineDash;
5483
- exports.getLineMiterRender = getLineMiterRender;
5484
5506
  exports.getMapLegendSymbolRenders = getMapLegendSymbolRenders;
5485
5507
  exports.getMapState = getMapState;
5486
5508
  exports.getParameterValue = getParameterValue;