@evergis/react 2.0.167 → 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.
@@ -1,5 +1,7 @@
1
1
  export * from './LegendSection';
2
2
  export * from './LegendSymbolRenderer';
3
+ export * from './LegendParameterDescription';
3
4
  export * from './MaximizedLegend';
5
+ export * from './MinimizedLegend';
4
6
  export * from './SvgSymbol';
5
7
  export * from './SymbolByType';
@@ -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
  };
@@ -5629,7 +5629,7 @@ const MapLegendContainer = /*#__PURE__*/styled__default.div(_templateObject8$2 |
5629
5629
  const MapLegendHeader = /*#__PURE__*/styled__default.div(_templateObject9$1 || (_templateObject9$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 15rem;\n margin-bottom: 0.25rem;\n font-weight: 500;\n"])));
5630
5630
  const MapLegendDescriptionContainer = /*#__PURE__*/styled__default.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"])));
5631
5631
  const MinimizedLegendContainer = /*#__PURE__*/styled__default.div(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: calc(100% - 1.5rem);\n padding-right: 1.5rem;\n"])));
5632
- const MapLegendSectionContainer = /*#__PURE__*/styled__default.div(_templateObject12$1 || (_templateObject12$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n :not(:last-child) {\n margin-bottom: 1rem;\n }\n"])));
5632
+ const MapLegendSectionContainer = /*#__PURE__*/styled__default.div(_templateObject12$1 || (_templateObject12$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 100%;\n \n :not(:last-child) {\n margin-bottom: 1rem;\n }\n"])));
5633
5633
  const MapLegendValueDescr = /*#__PURE__*/styled__default.div(_templateObject13$1 || (_templateObject13$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n min-height: 1rem;\n margin-bottom: 0.25rem;\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1rem;\n"])));
5634
5634
 
5635
5635
  const SizeLegendItemMixin = function SizeLegendItemMixin(value) {
@@ -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,
@@ -6115,14 +6127,22 @@ const Legend = _ref => {
6115
6127
  } = _ref;
6116
6128
  const classified = getClassified(layerInfo);
6117
6129
  const params = Object.keys(classified);
6130
+ const attributes = getLayerAttributes(layerInfo.layerDefinition);
6118
6131
  return React__default.createElement(MapLegendContainer, null, Object.keys(classified).map((param, index) => {
6119
- var _classified$param$val, _layerInfo$style;
6132
+ var _classified$param$val, _attributes$find, _layerInfo$style;
6120
6133
 
6121
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;
6122
6141
  return React__default.createElement(LegendSection, {
6142
+ key: index,
6123
6143
  symbol: (_layerInfo$style = layerInfo.style) == null ? void 0 : _layerInfo$style.symbol,
6124
6144
  attributeType: getAttributeType(layerInfo, attributeName),
6125
- attributeName: attributeName,
6145
+ attributeTitle: attributeAlias || attributeName,
6126
6146
  classified: classified[param],
6127
6147
  param: param,
6128
6148
  params: params,
@@ -6592,6 +6612,7 @@ exports.ItemSeparator = ItemSeparator;
6592
6612
  exports.ItemText = ItemText;
6593
6613
  exports.LabelSymbol = LabelSymbol;
6594
6614
  exports.Legend = Legend;
6615
+ exports.LegendParameterDescription = LegendParameterDescription;
6595
6616
  exports.LegendProvider = LegendProvider;
6596
6617
  exports.LegendSection = LegendSection;
6597
6618
  exports.LegendSymbolRenderer = LegendSymbolRenderer;
@@ -6618,6 +6639,7 @@ exports.MaximizedLegend = MaximizedLegend;
6618
6639
  exports.Measure = Measure;
6619
6640
  exports.MeasureTool = MeasureTool;
6620
6641
  exports.Measurer = Measurer;
6642
+ exports.MinimizedLegend = MinimizedLegend;
6621
6643
  exports.MinimizedLegendContainer = MinimizedLegendContainer;
6622
6644
  exports.NO_CONTENT_VALUE = NO_CONTENT_VALUE;
6623
6645
  exports.Noop = Noop;