@evergis/react 2.0.168 → 2.0.170

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
@@ -5627,7 +5627,7 @@ const SymbolButton = /*#__PURE__*/styled.span(_templateObject6$2 || (_templateOb
5627
5627
  });
5628
5628
  const MapLegendControl = /*#__PURE__*/styled(MapControl)(_templateObject7$2 || (_templateObject7$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
5629
5629
  const MapLegendContainer = /*#__PURE__*/styled.div(_templateObject8$2 || (_templateObject8$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 100%;\n padding-bottom: 1rem;\n box-sizing: border-box;\n\n canvas {\n height: 1.625rem;\n width: 1.625rem;\n }\n"])));
5630
- const MapLegendHeader = /*#__PURE__*/styled.div(_templateObject9$1 || (_templateObject9$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 15rem;\n margin-bottom: 0.25rem;\n font-weight: 500;\n"])));
5630
+ const MapLegendHeader = /*#__PURE__*/styled.div(_templateObject9$1 || (_templateObject9$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 15rem;\n margin-bottom: 0.25rem;\n font-size: 0.75rem;\n font-weight: bold;\n"])));
5631
5631
  const MapLegendDescriptionContainer = /*#__PURE__*/styled.div(_templateObject10$1 || (_templateObject10$1 = /*#__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"])));
5632
5632
  const MinimizedLegendContainer = /*#__PURE__*/styled.div(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: calc(100% - 1.5rem);\n padding-right: 1.5rem;\n"])));
5633
5633
  const MapLegendSectionContainer = /*#__PURE__*/styled.div(_templateObject12$1 || (_templateObject12$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 100%;\n \n :not(:last-child) {\n margin-bottom: 1rem;\n }\n"])));
@@ -6078,13 +6078,23 @@ const MaximizedLegend = _ref => {
6078
6078
  return React.createElement(React.Fragment, null, values.map(renderLegend));
6079
6079
  };
6080
6080
 
6081
+ const LegendParameterDescription = _ref => {
6082
+ let {
6083
+ parameter
6084
+ } = _ref;
6085
+ const isSize = isParameterType("size", parameter);
6086
+ const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
6087
+ const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
6088
+ return React.createElement(MapLegendDescriptionContainer, null, isStrokeWidth || isStrokeColor ? isStrokeWidth ? "Толщина обводки" : "Цвет обводки" : isSize ? "Размер знака" : "Цвет символа");
6089
+ };
6090
+
6081
6091
  const LegendSection = _ref => {
6082
6092
  let {
6083
6093
  symbol,
6084
6094
  param,
6085
6095
  params,
6086
6096
  classified,
6087
- attributeName,
6097
+ attributeTitle,
6088
6098
  attributeType,
6089
6099
  index
6090
6100
  } = _ref;
@@ -6092,7 +6102,9 @@ const LegendSection = _ref => {
6092
6102
  t
6093
6103
  } = useTranslation("common");
6094
6104
  const [isExpanded, toggleExpanded] = useToggle$1();
6095
- return React.createElement(MapLegendSectionContainer, null, React.createElement(MapLegendHeader, null, attributeName), isExpanded ? React.createElement(MaximizedLegend, {
6105
+ return React.createElement(MapLegendSectionContainer, null, React.createElement(MapLegendHeader, null, attributeTitle), React.createElement(LegendParameterDescription, {
6106
+ parameter: param
6107
+ }), isExpanded ? React.createElement(MaximizedLegend, {
6096
6108
  key: param,
6097
6109
  symbol: symbol,
6098
6110
  parameter: param,
@@ -6110,31 +6122,28 @@ const LegendSection = _ref => {
6110
6122
  }, t(isExpanded ? "toggleMenu" : "Развернуть")));
6111
6123
  };
6112
6124
 
6113
- const LegendParameterDescription = _ref => {
6114
- let {
6115
- parameter
6116
- } = _ref;
6117
- const isSize = isParameterType("size", parameter);
6118
- const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
6119
- const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
6120
- return React.createElement(MapLegendDescriptionContainer, null, isStrokeWidth || isStrokeColor ? isStrokeWidth ? "Толщина обводки" : "Цвет обводки" : isSize ? "Размер знака" : "Цвет символа");
6121
- };
6122
-
6123
6125
  const Legend = _ref => {
6124
6126
  let {
6125
6127
  layerInfo
6126
6128
  } = _ref;
6127
6129
  const classified = getClassified(layerInfo);
6128
6130
  const params = Object.keys(classified);
6131
+ const attributes = getLayerAttributes(layerInfo.layerDefinition);
6129
6132
  return React.createElement(MapLegendContainer, null, Object.keys(classified).map((param, index) => {
6130
- var _classified$param$val, _layerInfo$style;
6133
+ var _classified$param$val, _attributes$find, _layerInfo$style;
6131
6134
 
6132
6135
  const attributeName = getAttributeNameFromCondition((_classified$param$val = classified[param].values[0]) == null ? void 0 : _classified$param$val.condition);
6136
+ const attributeAlias = (_attributes$find = attributes.find(_ref2 => {
6137
+ let {
6138
+ name
6139
+ } = _ref2;
6140
+ return name === attributeName;
6141
+ })) == null ? void 0 : _attributes$find.alias;
6133
6142
  return React.createElement(LegendSection, {
6134
6143
  key: index,
6135
6144
  symbol: (_layerInfo$style = layerInfo.style) == null ? void 0 : _layerInfo$style.symbol,
6136
6145
  attributeType: getAttributeType(layerInfo, attributeName),
6137
- attributeName: attributeName,
6146
+ attributeTitle: attributeAlias || attributeName,
6138
6147
  classified: classified[param],
6139
6148
  param: param,
6140
6149
  params: params,