@evergis/react 2.0.168 → 2.0.169

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.
@@ -24,7 +24,7 @@ export declare type LegendSectionProps = {
24
24
  param: ClassificationParameterExtended;
25
25
  params: ClassificationParameterExtended[];
26
26
  classified: ParameterByAttribute<ParameterValue>;
27
- attributeName: string;
27
+ attributeTitle: string;
28
28
  attributeType: AttributeType;
29
29
  index: number;
30
30
  };
@@ -6077,13 +6077,23 @@ const MaximizedLegend = _ref => {
6077
6077
  return React__default.createElement(React__default.Fragment, null, values.map(renderLegend));
6078
6078
  };
6079
6079
 
6080
+ const LegendParameterDescription = _ref => {
6081
+ let {
6082
+ parameter
6083
+ } = _ref;
6084
+ const isSize = isParameterType("size", parameter);
6085
+ const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
6086
+ const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
6087
+ return React__default.createElement(MapLegendDescriptionContainer, null, isStrokeWidth || isStrokeColor ? isStrokeWidth ? "Толщина обводки" : "Цвет обводки" : isSize ? "Размер знака" : "Цвет символа");
6088
+ };
6089
+
6080
6090
  const LegendSection = _ref => {
6081
6091
  let {
6082
6092
  symbol,
6083
6093
  param,
6084
6094
  params,
6085
6095
  classified,
6086
- attributeName,
6096
+ attributeTitle,
6087
6097
  attributeType,
6088
6098
  index
6089
6099
  } = _ref;
@@ -6091,7 +6101,9 @@ const LegendSection = _ref => {
6091
6101
  t
6092
6102
  } = reactI18next.useTranslation("common");
6093
6103
  const [isExpanded, toggleExpanded] = ui.useToggle();
6094
- return React__default.createElement(MapLegendSectionContainer, null, React__default.createElement(MapLegendHeader, null, attributeName), isExpanded ? React__default.createElement(MaximizedLegend, {
6104
+ return React__default.createElement(MapLegendSectionContainer, null, React__default.createElement(MapLegendHeader, null, attributeTitle), React__default.createElement(LegendParameterDescription, {
6105
+ parameter: param
6106
+ }), isExpanded ? React__default.createElement(MaximizedLegend, {
6095
6107
  key: param,
6096
6108
  symbol: symbol,
6097
6109
  parameter: param,
@@ -6109,31 +6121,28 @@ const LegendSection = _ref => {
6109
6121
  }, t(isExpanded ? "toggleMenu" : "Развернуть")));
6110
6122
  };
6111
6123
 
6112
- const LegendParameterDescription = _ref => {
6113
- let {
6114
- parameter
6115
- } = _ref;
6116
- const isSize = isParameterType("size", parameter);
6117
- const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
6118
- const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
6119
- return React__default.createElement(MapLegendDescriptionContainer, null, isStrokeWidth || isStrokeColor ? isStrokeWidth ? "Толщина обводки" : "Цвет обводки" : isSize ? "Размер знака" : "Цвет символа");
6120
- };
6121
-
6122
6124
  const Legend = _ref => {
6123
6125
  let {
6124
6126
  layerInfo
6125
6127
  } = _ref;
6126
6128
  const classified = getClassified(layerInfo);
6127
6129
  const params = Object.keys(classified);
6130
+ const attributes = getLayerAttributes(layerInfo.layerDefinition);
6128
6131
  return React__default.createElement(MapLegendContainer, null, Object.keys(classified).map((param, index) => {
6129
- var _classified$param$val, _layerInfo$style;
6132
+ var _classified$param$val, _attributes$find, _layerInfo$style;
6130
6133
 
6131
6134
  const attributeName = getAttributeNameFromCondition((_classified$param$val = classified[param].values[0]) == null ? void 0 : _classified$param$val.condition);
6135
+ const attributeAlias = (_attributes$find = attributes.find(_ref2 => {
6136
+ let {
6137
+ name
6138
+ } = _ref2;
6139
+ return name === attributeName;
6140
+ })) == null ? void 0 : _attributes$find.alias;
6132
6141
  return React__default.createElement(LegendSection, {
6133
6142
  key: index,
6134
6143
  symbol: (_layerInfo$style = layerInfo.style) == null ? void 0 : _layerInfo$style.symbol,
6135
6144
  attributeType: getAttributeType(layerInfo, attributeName),
6136
- attributeName: attributeName,
6145
+ attributeTitle: attributeAlias || attributeName,
6137
6146
  classified: classified[param],
6138
6147
  param: param,
6139
6148
  params: params,