@evergis/react 2.0.150 → 2.0.151

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.
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ export declare const MapLegendDescription: FC<{
3
+ isSize?: boolean;
4
+ }>;
@@ -1,3 +1,4 @@
1
1
  export * from './MapLegend';
2
2
  export * from './MapLegendSymbol';
3
- export { MapLegendContainer, MapLegendHeader, MapLegendValueDescr, MapLegendExpandButton, MapLegendValues, MapLegendItem, SizeMinimizedLegendDown, SizeMinimizedLegendUp, } from './styled';
3
+ export * from './MapLegendDescription';
4
+ export { MapLegendContainer, MapLegendHeader, MapLegendValueDescr, MapLegendExpandButton, MapLegendValues, MapLegendItem, SizeMinimizedLegendDown, SizeMinimizedLegendUp, MapLegendDescriptionContainer, } from './styled';
@@ -1,6 +1,7 @@
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 MapLegendDescriptionContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
4
5
  export declare const MapLegendValueDescr: import("styled-components").StyledComponent<"div", any, {}, never>;
5
6
  export declare const MapLegendItem: import("styled-components").StyledComponent<"div", any, {
6
7
  value?: string | number | undefined;
package/dist/index.d.ts CHANGED
@@ -9,3 +9,4 @@ export * from './utils/math';
9
9
  export * from './utils/metersToPixels';
10
10
  export * from './utils/polygonCircleFromPoint';
11
11
  export * from './utils/isNumeric';
12
+ export * from './utils/isParameterType';
@@ -1947,6 +1947,12 @@ const polygonCircleFromPoint = (center, diameter) => {
1947
1947
 
1948
1948
  const isNumeric = number => !isNaN(parseFloat(number)) && isFinite(number);
1949
1949
 
1950
+ const isParameterType = (parameter, type) => {
1951
+ var _parameter$toLowerCas;
1952
+
1953
+ return (_parameter$toLowerCas = parameter.toLowerCase()) == null ? void 0 : _parameter$toLowerCas.includes(type);
1954
+ };
1955
+
1950
1956
  let CircleLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
1951
1957
  _inherits(CircleLineMiterRender, _LineMiterRender);
1952
1958
 
@@ -5018,12 +5024,13 @@ const Fullscreen = () => {
5018
5024
  }));
5019
5025
  };
5020
5026
 
5021
- var _templateObject$6, _templateObject2$6, _templateObject3$4, _templateObject4$4, _templateObject5$4, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$1, _templateObject10$1, _templateObject11$1, _templateObject12$1, _templateObject13$1, _templateObject14$1, _templateObject15$1, _templateObject16$1, _templateObject17, _templateObject18;
5027
+ var _templateObject$6, _templateObject2$6, _templateObject3$4, _templateObject4$4, _templateObject5$4, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$1, _templateObject10$1, _templateObject11$1, _templateObject12$1, _templateObject13$1, _templateObject14$1, _templateObject15$1, _templateObject16$1, _templateObject17, _templateObject18, _templateObject19;
5022
5028
  const MapLegendControl = /*#__PURE__*/styled__default(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
5023
5029
  const MapLegendContainer = /*#__PURE__*/styled__default.div(_templateObject2$6 || (_templateObject2$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 12.5rem;\n padding-bottom: 1rem;\n box-sizing: border-box;\n\n canvas {\n height: 1.625rem;\n width: 1.625rem;\n }\n"])));
5024
5030
  const MapLegendHeader = /*#__PURE__*/styled__default(LegendSectionHeader)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 15rem;\n margin-bottom: 0.25rem;\n font-weight: 500;\n"])));
5025
- 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: 600;\n line-height: 1rem;\n"])));
5026
- const MapLegendItem = /*#__PURE__*/styled__default.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n height: 1rem;\n background: ", ";\n border: 1px rgba(48, 69, 79, 0.1) solid;\n margin-right: -1px;\n \n ", "\n"])), _ref => {
5031
+ const MapLegendDescriptionContainer = /*#__PURE__*/styled__default.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: 0.5rem;\n font-weight: 400;\n font-size: 0.625rem;\n color: rgba(255, 255, 255, 0.65);\n"])));
5032
+ const MapLegendValueDescr = /*#__PURE__*/styled__default.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n min-height: 1rem;\n margin-bottom: 0.5rem;\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1rem;\n"])));
5033
+ const MapLegendItem = /*#__PURE__*/styled__default.div(_templateObject6$2 || (_templateObject6$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n height: 1rem;\n background: ", ";\n border: 1px rgba(48, 69, 79, 0.1) solid;\n margin-right: -1px;\n \n ", "\n"])), _ref => {
5027
5034
  let {
5028
5035
  value
5029
5036
  } = _ref;
@@ -5034,14 +5041,14 @@ const MapLegendItem = /*#__PURE__*/styled__default.div(_templateObject5$4 || (_t
5034
5041
  } = _ref2;
5035
5042
  return !!value && typeof value === "number" && SizeLegendMixin(value);
5036
5043
  });
5037
- const MapLegendOther = /*#__PURE__*/styled__default(MapLegendItem)(_templateObject6$2 || (_templateObject6$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: none;\n width: 1rem;\n margin-left: 0.25rem;\n border-radius: 0.125rem;\n"])));
5038
- const SizeOverlayLegendMixin = /*#__PURE__*/styled.css(_templateObject7$2 || (_templateObject7$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 2rem;\n height: 2rem;\n margin: 0 auto;\n \n ", ", ", " {\n flex: none;\n position: absolute;\n top: 0;\n left: 50%;\n width: inherit;\n height: inherit;\n margin-left: -1rem;\n \n :after {\n top: 0;\n margin-top: 0;\n }\n }\n"])), MapLegendItem, MapLegendOther);
5039
- const SizeMinimizedLegend = /*#__PURE__*/styled__default.div(_templateObject8$2 || (_templateObject8$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n margin-top: 0.5rem;\n \n ", " {\n margin: 0 auto;\n }\n"])), MapLegendItem);
5040
- const SizeMinimizedLegendSymbol = /*#__PURE__*/styled__default.div(_templateObject9$1 || (_templateObject9$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 4rem;\n margin-right: 0.75rem;\n"])));
5041
- const SizeMinimizedLegendLabel = /*#__PURE__*/styled__default.div(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n"])));
5042
- const SizeMinimizedLegendDown = /*#__PURE__*/styled__default.div(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.28;\n"])));
5043
- const SizeMinimizedLegendUp = /*#__PURE__*/styled__default.div(_templateObject12$1 || (_templateObject12$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.65;\n"])));
5044
- const MapLegendItems = /*#__PURE__*/styled__default.div(_templateObject13$1 || (_templateObject13$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n width: 100%;\n border-radius: 0.125rem;\n\n ", ";\n"])), _ref3 => {
5044
+ 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"])));
5045
+ const SizeOverlayLegendMixin = /*#__PURE__*/styled.css(_templateObject8$2 || (_templateObject8$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 2rem;\n height: 2rem;\n margin: 0 auto;\n \n ", ", ", " {\n flex: none;\n position: absolute;\n top: 0;\n left: 50%;\n width: inherit;\n height: inherit;\n margin-left: -1rem;\n \n :after {\n top: 0;\n margin-top: 0;\n }\n }\n"])), MapLegendItem, MapLegendOther);
5046
+ const SizeMinimizedLegend = /*#__PURE__*/styled__default.div(_templateObject9$1 || (_templateObject9$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n margin-top: 0.5rem;\n \n ", " {\n margin: 0 auto;\n }\n"])), MapLegendItem);
5047
+ const SizeMinimizedLegendSymbol = /*#__PURE__*/styled__default.div(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 4rem;\n margin-right: 0.75rem;\n"])));
5048
+ const SizeMinimizedLegendLabel = /*#__PURE__*/styled__default.div(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n"])));
5049
+ const SizeMinimizedLegendDown = /*#__PURE__*/styled__default.div(_templateObject12$1 || (_templateObject12$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.28;\n"])));
5050
+ const SizeMinimizedLegendUp = /*#__PURE__*/styled__default.div(_templateObject13$1 || (_templateObject13$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.65;\n"])));
5051
+ const MapLegendItems = /*#__PURE__*/styled__default.div(_templateObject14$1 || (_templateObject14$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n width: 100%;\n border-radius: 0.125rem;\n\n ", ";\n"])), _ref3 => {
5045
5052
  let {
5046
5053
  overlay
5047
5054
  } = _ref3;
@@ -5053,13 +5060,20 @@ const SizeLegendMixin = function SizeLegendMixin(value) {
5053
5060
  value = 0;
5054
5061
  }
5055
5062
 
5056
- return styled.css(_templateObject14$1 || (_templateObject14$1 = _taggedTemplateLiteralLoose(["\n position: relative;\n height: 2rem;\n background: none;\n border: none;\n margin-right: 0;\n \n :after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n border: 1px rgba(48, 69, 79, 0.28) solid;\n border-radius: 50%;\n margin: -", "px 0 0 -", "px;\n width: ", "px;\n height: ", "px;\n }\n"])), value / 2, value / 2, value, value);
5063
+ return styled.css(_templateObject15$1 || (_templateObject15$1 = _taggedTemplateLiteralLoose(["\n position: relative;\n height: 2rem;\n background: none;\n border: none;\n margin-right: 0;\n \n :after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n border: 1px rgba(48, 69, 79, 0.28) solid;\n border-radius: 50%;\n margin: -", "px 0 0 -", "px;\n width: ", "px;\n height: ", "px;\n }\n"])), value / 2, value / 2, value, value);
5057
5064
  };
5058
5065
 
5059
- const MapLegendValues = /*#__PURE__*/styled__default.div(_templateObject15$1 || (_templateObject15$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n font-size: 0.75rem;\n color: rgba(48, 69, 79, 0.65);\n"])));
5060
- const MapLegendValuesRange = /*#__PURE__*/styled__default.div(_templateObject16$1 || (_templateObject16$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n"])));
5061
- const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templateObject17 || (_templateObject17 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 0;\n text-align: center;\n overflow: visible;\n"])));
5062
- const MapLegendExpandButton = /*#__PURE__*/styled__default.div(_templateObject18 || (_templateObject18 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin: 0.1rem 0 0.5rem;\n font-size: 0.625rem;\n color: #1FB3AA;\n"])));
5066
+ const MapLegendValues = /*#__PURE__*/styled__default.div(_templateObject16$1 || (_templateObject16$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n font-size: 0.75rem;\n color: rgba(48, 69, 79, 0.65);\n"])));
5067
+ const MapLegendValuesRange = /*#__PURE__*/styled__default.div(_templateObject17 || (_templateObject17 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n"])));
5068
+ const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templateObject18 || (_templateObject18 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 0;\n text-align: center;\n overflow: visible;\n"])));
5069
+ const MapLegendExpandButton = /*#__PURE__*/styled__default.div(_templateObject19 || (_templateObject19 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin: 0.1rem 0 0.5rem;\n font-size: 0.625rem;\n color: #1FB3AA;\n"])));
5070
+
5071
+ const MapLegendDescription = _ref => {
5072
+ let {
5073
+ isSize
5074
+ } = _ref;
5075
+ return React__default.createElement(MapLegendDescriptionContainer, null, isSize ? "Размер знака" : "Цвет символа");
5076
+ };
5063
5077
 
5064
5078
  const getValueFromLegendTitle = (title, minOrMax) => {
5065
5079
  var _title$split;
@@ -5073,7 +5087,7 @@ const getValueFromLegendTitle = (title, minOrMax) => {
5073
5087
  };
5074
5088
 
5075
5089
  const MinimizedLegend = _ref => {
5076
- var _currentValues$, _currentValues;
5090
+ var _currentValues$, _currentValues, _currentValues$2, _currentValues2;
5077
5091
 
5078
5092
  let {
5079
5093
  values,
@@ -5082,13 +5096,15 @@ const MinimizedLegend = _ref => {
5082
5096
  } = _ref;
5083
5097
  const currentValues = [...values];
5084
5098
  const other = currentValues.pop();
5085
- return React__default.createElement(React__default.Fragment, null, !!title && React__default.createElement(MapLegendValueDescr, null, title), isSize ? React__default.createElement(React__default.Fragment, null, React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendItems, {
5099
+ return React__default.createElement(React__default.Fragment, null, !!title && React__default.createElement(MapLegendValueDescr, null, title), React__default.createElement(MapLegendDescription, {
5100
+ isSize: isSize
5101
+ }), isSize ? React__default.createElement(React__default.Fragment, null, React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendItems, {
5086
5102
  overlay: true
5087
5103
  }, currentValues.map(value => React__default.createElement(MapLegendItem, {
5088
5104
  key: value.title,
5089
5105
  title: value.title,
5090
5106
  value: value.parameterValue
5091
- })))), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendDown, null, "50 \u0438 \u043C\u0435\u043D\u0435\u0435"), React__default.createElement(SizeMinimizedLegendUp, null, "\u0431\u043E\u043B\u0435\u0435 100"))), React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendOther, {
5107
+ })))), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendDown, null, (_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title), React__default.createElement(SizeMinimizedLegendUp, null, (_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title))), React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendOther, {
5092
5108
  title: "\u0414\u0440\u0443\u0433\u043E\u0435",
5093
5109
  value: other == null ? void 0 : other.parameterValue
5094
5110
  })), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendUp, null, "\u0414\u0440\u0443\u0433\u043E\u0435")))) : React__default.createElement(MapLegendItems, {
@@ -5100,7 +5116,7 @@ const MinimizedLegend = _ref => {
5100
5116
  })), React__default.createElement(MapLegendOther, {
5101
5117
  title: "\u0414\u0440\u0443\u0433\u043E\u0435",
5102
5118
  value: other == null ? void 0 : other.parameterValue
5103
- })), typeof (other == null ? void 0 : other.parameterValue) === "string" && React__default.createElement(MapLegendValues, null, React__default.createElement(MapLegendValuesRange, null, React__default.createElement("div", null, getValueFromLegendTitle((_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title, "max")), React__default.createElement("div", null, getValueFromLegendTitle((_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title, "min"))), React__default.createElement(MapLegendValuesOther, null, "-")));
5119
+ })), typeof (other == null ? void 0 : other.parameterValue) === "string" && React__default.createElement(MapLegendValues, null, React__default.createElement(MapLegendValuesRange, null, React__default.createElement("div", null, getValueFromLegendTitle((_currentValues$2 = currentValues[0]) == null ? void 0 : _currentValues$2.title, "max")), React__default.createElement("div", null, getValueFromLegendTitle((_currentValues2 = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues2.title, "min"))), React__default.createElement(MapLegendValuesOther, null, "-")));
5104
5120
  };
5105
5121
 
5106
5122
  const MapLegend = _ref => {
@@ -5129,7 +5145,7 @@ const MapLegend = _ref => {
5129
5145
  layer: layer,
5130
5146
  config: config
5131
5147
  }) : React__default.createElement(React__default.Fragment, null, items.map(item => {
5132
- var _symbol$fill, _item$parameter;
5148
+ var _symbol$fill;
5133
5149
 
5134
5150
  return React__default.createElement(React.Fragment, {
5135
5151
  key: item.title
@@ -5137,7 +5153,7 @@ const MapLegend = _ref => {
5137
5153
  values: item.values,
5138
5154
  defaultValue: (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color,
5139
5155
  title: item.title !== (layer == null ? void 0 : layer.alias) ? item.title : "",
5140
- isSize: (_item$parameter = item.parameter) == null ? void 0 : _item$parameter.includes("size")
5156
+ isSize: isParameterType(item.parameter, "size")
5141
5157
  }));
5142
5158
  })), React__default.createElement(MapLegendExpandButton, {
5143
5159
  onClick: toggleExpanded
@@ -5585,6 +5601,8 @@ exports.MapControl = MapControl;
5585
5601
  exports.MapControls = MapControls;
5586
5602
  exports.MapLegend = MapLegend;
5587
5603
  exports.MapLegendContainer = MapLegendContainer;
5604
+ exports.MapLegendDescription = MapLegendDescription;
5605
+ exports.MapLegendDescriptionContainer = MapLegendDescriptionContainer;
5588
5606
  exports.MapLegendExpandButton = MapLegendExpandButton;
5589
5607
  exports.MapLegendHeader = MapLegendHeader;
5590
5608
  exports.MapLegendItem = MapLegendItem;
@@ -5670,6 +5688,7 @@ exports.isMaskedImageSymbol = isMaskedImageSymbol;
5670
5688
  exports.isMiterExist = isMiterExist;
5671
5689
  exports.isNumeric = isNumeric;
5672
5690
  exports.isParameterByAttribute = isParameterByAttribute;
5691
+ exports.isParameterType = isParameterType;
5673
5692
  exports.isParameterValueSimple = isParameterValueSimple;
5674
5693
  exports.isParameterValueSymbol = isParameterValueSymbol;
5675
5694
  exports.isPatternBrush = isPatternBrush;