@evergis/react 2.0.191 → 2.0.193

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,3 @@
1
+ import { FC } from 'react';
2
+ import { LegendChildrenProps } from '../types';
3
+ export declare const LegendChildren: FC<LegendChildrenProps>;
@@ -3,7 +3,7 @@ import { AttributeType, PointLabelSymbolDc, SvgPointSymbolDc, StyleDc, FeatureLa
3
3
  import { MaskedImage } from '@evergis/sgis/es/symbols/point/MaskedImage';
4
4
  import { H3Symbol } from '@evergis/sgis/es/symbols/H3Symbol';
5
5
  import { Coordinates } from '@evergis/sgis/es/baseTypes';
6
- import { ClassificationParameterExtended, LayerAttribute, LegendValueType, ParameterByAttribute, ParameterValue, StyleSymbolType, SvgPointSymbol } from '../../core';
6
+ import { ClassificationParameterExtended, LayerAttribute, LegendValueType, ParameterByAttribute, ParameterValueWithSymbol, StyleSymbolType, SvgPointSymbol } from '../../core';
7
7
  import { SGisBrushFill, SGisImageFill, SGisPolygonSymbol, SGisPolylineSymbol } from '../../symbols';
8
8
  export declare type ClassifyParameter = 'fill.color' | 'fill.hatchColor' | 'fillColor' | 'stroke.width' | 'stroke.color' | 'strokeWidth' | 'strokeColor' | 'textBackground.fill.color' | 'background.fillColor' | 'background.strokeColor' | 'background.strokeWidth' | 'figure.fillColor' | 'fontColor' | 'haloColor' | 'size' | 'symbol' | 'angle' | 'maskedColor' | 'endingSize' | 'beginningSize' | 'maxObjectCount' | 'gridSize' | 'selectionObjectsLimit' | 'singleObjectSymbol.figure.fillColor' | 'singleObjectSymbol.background.fillColor';
9
9
  export interface ParameterInfo {
@@ -30,13 +30,16 @@ export declare type LegendProps = {
30
30
  hiddenLegends?: Record<string, string[]>;
31
31
  toggleHiddenLegend?: (layerName: string, hiddenCondition: string) => void;
32
32
  };
33
+ export declare type LegendChildrenProps = Pick<LegendProps, 'hiddenLegends' | 'toggleHiddenLegend' | 'formatValue'> & {
34
+ layerInfo: FeatureLayerServiceInfoDc;
35
+ };
33
36
  export declare type LegendSectionProps = Pick<LegendProps, 'hiddenLegends' | 'toggleHiddenLegend' | 'formatValue'> & {
34
37
  layerName: string;
35
38
  symbol: StyleDc['symbol'];
36
39
  parameter: ClassificationParameterExtended;
37
40
  parameters: ClassificationParameterExtended[];
38
- classified: ParameterByAttribute<ParameterValue>;
39
- attribute: LayerAttribute;
41
+ classified: ParameterByAttribute<ParameterValueWithSymbol>;
42
+ attribute: LayerAttribute | null;
40
43
  index: number;
41
44
  };
42
45
  export declare type LegendSectionItem = Pick<LegendProps, 'hiddenLegends' | 'toggleHiddenLegend'> & {
@@ -0,0 +1,2 @@
1
+ import { LayerAttribute } from '../../../core';
2
+ export declare const getConditionAttribute: (attributes: LayerAttribute[], condition?: string | undefined) => LayerAttribute | null;
@@ -0,0 +1,5 @@
1
+ export declare const getLegendText: ({ title, index, isDate, }: {
2
+ title?: string | undefined;
3
+ index: number;
4
+ isDate: boolean;
5
+ }) => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const isHiddenLegend: (hiddenCondition: string, hiddenLegends?: string[] | undefined) => boolean;
@@ -1,4 +1,4 @@
1
1
  import { ClassificationExtras, ClassificationParameterExtended, ExtendedClassification } from './types';
2
- import { ParameterByAttributeValue, ParameterValue, Style, StyleSymbolType } from '../style/types';
3
- export declare const toClassification: (values: (ParameterByAttributeValue<ParameterValue> | Style)[], parameter: ClassificationParameterExtended, extras?: ClassificationExtras) => ExtendedClassification;
2
+ import { ParameterByAttributeValue, ParameterValueWithSymbol, Style, StyleSymbolType } from '../style';
3
+ export declare const toClassification: (values: (ParameterByAttributeValue<ParameterValueWithSymbol> | Style)[], parameter: ClassificationParameterExtended, extras?: ClassificationExtras) => ExtendedClassification;
4
4
  export declare const getClassifications: (symbol: StyleSymbolType, pathContext?: ClassificationParameterExtended[]) => ExtendedClassification[];
@@ -1,8 +1,8 @@
1
1
  import { ClassificationParameterExtended, ParameterValueModifier } from './types';
2
- import { CalculatedAble, CalculatedParameter, ClassifyAble, ParameterByAttribute, ParameterValue, StyleSymbolType, UnidentifiedParameterValue } from '../style';
3
- export declare const isParameterByAttribute: (value: UnidentifiedParameterValue) => value is ParameterByAttribute<ParameterValue>;
4
- export declare const isCalculatedParameter: (value: UnidentifiedParameterValue) => value is CalculatedParameter<ParameterValue>;
5
- export declare const getParameterValue: <Value extends ParameterValue>(value: Value | ParameterByAttribute<Value> | CalculatedParameter<Value>) => Value;
2
+ import { CalculatedAble, CalculatedParameter, ClassifyAble, ParameterByAttribute, ParameterValue, ParameterValueWithSymbol, StyleSymbolType, UnidentifiedParameterValue } from '../style';
3
+ export declare const isParameterByAttribute: (value: UnidentifiedParameterValue) => value is ParameterByAttribute<ParameterValueWithSymbol>;
4
+ export declare const isCalculatedParameter: (value: UnidentifiedParameterValue) => value is CalculatedParameter<ParameterValueWithSymbol>;
5
+ export declare const getParameterValue: <Value extends ParameterValueWithSymbol>(value: Value | ParameterByAttribute<Value> | CalculatedParameter<Value>) => Value;
6
6
  export declare const symbolParameterWalker: (valueModifier: ParameterValueModifier) => <S extends StyleSymbolType>(symbol: S, parameter: ClassificationParameterExtended | ClassificationParameterExtended[]) => S;
7
7
  export declare const setDefaultParameterValue: <S extends StyleSymbolType>(symbol: S, parameter: ClassificationParameterExtended | ClassificationParameterExtended[]) => S;
8
8
  export declare const setParameterValue: <S extends StyleSymbolType>(symbol: S, path: ClassificationParameterExtended, value: ClassifyAble<ParameterValue>) => S;
@@ -32,7 +32,7 @@ export declare type RangeClassification = Classification<ClassificationType.Rang
32
32
  export declare type UniqueClassification = Classification<ClassificationType.Unique, UniqueClass>;
33
33
  export interface ClassificationExtras {
34
34
  defaultTitle: string;
35
- defaultValue: ParameterValue;
35
+ defaultValue: ParameterValueWithSymbol;
36
36
  }
37
37
  export declare type ExtendedClassification<Type extends ClassificationType = ClassificationType, Value extends ClassificationClass = ClassificationClass> = Classification<Type, Value> & ClassificationExtras;
38
38
  export declare function isRangeClass(value: ClassificationClass): value is RangeClass;
@@ -19,8 +19,8 @@ export declare type CalculatedParameter<Value> = {
19
19
  export declare type ClassifyAble<Value> = Value | ParameterByAttribute<Value>;
20
20
  export declare type CalculatedAble<Value> = Value | CalculatedParameter<Value>;
21
21
  export declare type ParameterValue = string | number | number[] | Date;
22
- export declare type ParameterByAttributeValues = ParameterByAttributeValue<ParameterValue>[];
23
- export declare type ParameterValueWithSymbol = ParameterValue | StyleSymbolType | Date;
22
+ export declare type ParameterValueWithSymbol = ParameterValue | StyleSymbolType;
23
+ export declare type ParameterByAttributeValues = ParameterByAttributeValue<ParameterValueWithSymbol>[];
24
24
  export declare type ClassifiedParameterValue = ClassifyAble<ParameterValueWithSymbol>;
25
25
  export declare type UnidentifiedParameterValue = ParameterValueWithSymbol | Partial<ClassifyAble<ParameterValueWithSymbol>> | Partial<CalculatedAble<ParameterValue>>;
26
26
  export declare type CalculatedParameterValue = CalculatedAble<ParameterValue>;
@@ -727,6 +727,73 @@ const isParameterValueSymbol = parameterValue => !isParameterValueSimple(paramet
727
727
 
728
728
  const isStyle = value => 'symbol' in value;
729
729
 
730
+ let EvergisStyle = /*#__PURE__*/function () {
731
+ function EvergisStyle(style) {
732
+ _classCallCheck(this, EvergisStyle);
733
+
734
+ this.style = extractStyle(style);
735
+ this.classificationManager = new ClassificationManager(this.style);
736
+ }
737
+
738
+ _createClass(EvergisStyle, [{
739
+ key: "serialize",
740
+ value: function serialize() {
741
+ return packStyle(this.style);
742
+ }
743
+ }, {
744
+ key: "hasRasters",
745
+ value: function hasRasters() {
746
+ return !!(this.style.raster || (this.style.children || []).some(style => style.raster));
747
+ }
748
+ }, {
749
+ key: "symbol",
750
+ get: function get() {
751
+ return this.style.symbol;
752
+ }
753
+ }, {
754
+ key: "raster",
755
+ get: function get() {
756
+ return this.style.raster;
757
+ }
758
+ }, {
759
+ key: "label",
760
+ get: function get() {
761
+ return this.style.label;
762
+ }
763
+ }, {
764
+ key: "children",
765
+ get: function get() {
766
+ return this.style.children;
767
+ }
768
+ }, {
769
+ key: "title",
770
+ get: function get() {
771
+ return this.style.title;
772
+ }
773
+ }, {
774
+ key: "condition",
775
+ get: function get() {
776
+ return this.style.condition;
777
+ }
778
+ }, {
779
+ key: "ignoreLabel",
780
+ get: function get() {
781
+ return this.style.ignoreLabel;
782
+ }
783
+ }, {
784
+ key: "resolution",
785
+ get: function get() {
786
+ const {
787
+ minResolution,
788
+ maxResolution
789
+ } = this.style;
790
+ return minResolution === void 0 || maxResolution === void 0 ? null : [minResolution, maxResolution];
791
+ }
792
+ }]);
793
+
794
+ return EvergisStyle;
795
+ }();
796
+
730
797
  const toClassificationClass = (parameterValue, title, condition) => _extends({
731
798
  parameterValue,
732
799
  title
@@ -902,73 +969,6 @@ function getRangeValues(_ref, isDouble, isDate, index) {
902
969
  };
903
970
  }
904
971
 
905
- let EvergisStyle = /*#__PURE__*/function () {
906
- function EvergisStyle(style) {
907
- _classCallCheck(this, EvergisStyle);
908
-
909
- this.style = extractStyle(style);
910
- this.classificationManager = new ClassificationManager(this.style);
911
- }
912
-
913
- _createClass(EvergisStyle, [{
914
- key: "serialize",
915
- value: function serialize() {
916
- return packStyle(this.style);
917
- }
918
- }, {
919
- key: "hasRasters",
920
- value: function hasRasters() {
921
- return !!(this.style.raster || (this.style.children || []).some(style => style.raster));
922
- }
923
- }, {
924
- key: "symbol",
925
- get: function get() {
926
- return this.style.symbol;
927
- }
928
- }, {
929
- key: "raster",
930
- get: function get() {
931
- return this.style.raster;
932
- }
933
- }, {
934
- key: "label",
935
- get: function get() {
936
- return this.style.label;
937
- }
938
- }, {
939
- key: "children",
940
- get: function get() {
941
- return this.style.children;
942
- }
943
- }, {
944
- key: "title",
945
- get: function get() {
946
- return this.style.title;
947
- }
948
- }, {
949
- key: "condition",
950
- get: function get() {
951
- return this.style.condition;
952
- }
953
- }, {
954
- key: "ignoreLabel",
955
- get: function get() {
956
- return this.style.ignoreLabel;
957
- }
958
- }, {
959
- key: "resolution",
960
- get: function get() {
961
- const {
962
- minResolution,
963
- maxResolution
964
- } = this.style;
965
- return minResolution === void 0 || maxResolution === void 0 ? null : [minResolution, maxResolution];
966
- }
967
- }]);
968
-
969
- return EvergisStyle;
970
- }();
971
-
972
972
  const getHexColor = colorString => colorString ? new color.Color(colorString).toString('hex') : undefined;
973
973
 
974
974
  // TODO reduce
@@ -2529,7 +2529,7 @@ const getValueFromConditionPart = (condition, partIndex) => {
2529
2529
 
2530
2530
  return (_getExprFromCondition2 = getExprFromCondition(condition, partIndex)) == null ? void 0 : _getExprFromCondition2[2];
2531
2531
  };
2532
- const isRangeCondition = condition => condition.includes('(');
2532
+ const isRangeCondition = condition => (condition == null ? void 0 : condition.includes('(')) || false;
2533
2533
  const getSymbolParameterInfo = parameter => {
2534
2534
  return PARAMETER_INFOS[parameter] || DEFAULT_PARAMETER_INFO;
2535
2535
  };
@@ -2582,14 +2582,20 @@ const checkLayerHasLegend = layerInfo => {
2582
2582
  return (paramValue == null ? void 0 : paramValue.type) === 'byAttribute';
2583
2583
  })) || false;
2584
2584
  };
2585
- const getTitleFromCondition = condition => {
2585
+ const getTitleFromCondition = _ref2 => {
2586
2586
  var _parts$;
2587
2587
 
2588
- const parts = condition.split(' == ');
2589
- return (_parts$ = parts[1]) == null ? void 0 : _parts$.slice(1, -1);
2588
+ let {
2589
+ condition,
2590
+ attribute,
2591
+ formatValue
2592
+ } = _ref2;
2593
+ const parts = condition == null ? void 0 : condition.split(' == ');
2594
+ const uniqueValue = (parts == null ? void 0 : (_parts$ = parts[1]) == null ? void 0 : _parts$.slice(1, -1)) || '';
2595
+ return attribute && formatValue ? formatValue(attribute.type, uniqueValue, attribute.stringFormat) : '';
2590
2596
  };
2591
-
2592
- function createValueTitle$1(paramValue, attribute, formatValue, index) {
2597
+ function createValueTitleFromCondition(paramValue, attribute, formatValue, index) {
2598
+ if (!attribute) return '';
2593
2599
  if (paramValue.title) return paramValue.title;
2594
2600
  const value = {
2595
2601
  parameterValue: getParameterValue(paramValue.value),
@@ -2606,7 +2612,6 @@ function createValueTitle$1(paramValue, attribute, formatValue, index) {
2606
2612
  // пункт "Настраиваемые значения параметров символики в системе"
2607
2613
  // Для добавления подготовленных значений размеров символов нужно использовать константу PREPARED_SYMBOL_SIZES
2608
2614
 
2609
-
2610
2615
  const DEFAULT_LEGEND_STYLES = {
2611
2616
  [0
2612
2617
  /* Point */
@@ -2901,12 +2906,14 @@ const getMinimizedLegendValues = (attribute, classified, formatValue, index, oth
2901
2906
  const to = getValueFromConditionPart(paramValue.condition, 2);
2902
2907
  result.from = from ? isNumeric(from) ? +from : formatDate(from) : null;
2903
2908
  result.to = to ? isNumeric(to) ? +to : formatDate(to) : null;
2904
- result.title = createValueTitle$1(paramValue, attribute, formatValue, index);
2909
+ result.title = createValueTitleFromCondition(paramValue, attribute, formatValue, index);
2905
2910
  return result;
2906
2911
  }
2907
2912
 
2908
2913
  result.uniqueValue = formatValue ? formatValue(attribute.type, paramValue.value, attribute.stringFormat) : paramValue.value.toString();
2909
- result.title = getTitleFromCondition(paramValue.condition);
2914
+ result.title = getTitleFromCondition({
2915
+ condition: paramValue.condition
2916
+ });
2910
2917
  result.hiddenCondition = createHiddenCondition(attribute.name, attribute.type, getClassificationValue(paramValue.value, result.title, new ClassificationCondition(paramValue.condition)));
2911
2918
  return result;
2912
2919
  });
@@ -2927,7 +2934,9 @@ const getMaximizedLegendValues = (attribute, param, params, classified, symbol,
2927
2934
  const result = {
2928
2935
  symbol: createLegendSymbol(paramValue.value, param, params, symbol)
2929
2936
  };
2930
- result.title = isRangeCondition(paramValue.condition) ? createValueTitle$1(paramValue, attribute, formatValue, sectionIndex) : getTitleFromCondition(paramValue.condition);
2937
+ result.title = isRangeCondition(paramValue.condition) ? createValueTitleFromCondition(paramValue, attribute, formatValue, sectionIndex) : getTitleFromCondition({
2938
+ condition: paramValue.condition
2939
+ });
2931
2940
  result.hiddenCondition = createHiddenCondition(attribute.name, attribute.type, getClassificationValue(paramValue.value, result.title, new ClassificationCondition(classified.values[index].condition)));
2932
2941
  return result;
2933
2942
  });
@@ -2939,11 +2948,26 @@ const getMaximizedLegendValues = (attribute, param, params, classified, symbol,
2939
2948
  return [...items, other];
2940
2949
  };
2941
2950
  const getClassified = layerInfo => {
2951
+ var _layerInfo$style2, _layerInfo$style2$chi;
2952
+
2953
+ if ((_layerInfo$style2 = layerInfo.style) != null && (_layerInfo$style2$chi = _layerInfo$style2.children) != null && _layerInfo$style2$chi.length) {
2954
+ var _layerInfo$style3;
2955
+
2956
+ return {
2957
+ symbol: {
2958
+ type: 'byAttribute',
2959
+ defaultValue: layerInfo.style.symbol,
2960
+ title: null,
2961
+ values: (_layerInfo$style3 = layerInfo.style) == null ? void 0 : _layerInfo$style3.children
2962
+ }
2963
+ };
2964
+ }
2965
+
2942
2966
  const classifyParams = SYMBOL_CLASSIFICATION[layerInfo.geometryType];
2943
2967
  return classifyParams == null ? void 0 : classifyParams.reduce((result, classified) => {
2944
- var _layerInfo$style2;
2968
+ var _layerInfo$style4;
2945
2969
 
2946
- const param = get((_layerInfo$style2 = layerInfo.style) == null ? void 0 : _layerInfo$style2.symbol, classified);
2970
+ const param = get((_layerInfo$style4 = layerInfo.style) == null ? void 0 : _layerInfo$style4.symbol, classified);
2947
2971
  return (param == null ? void 0 : param.type) === 'byAttribute' ? _extends({}, result, {
2948
2972
  [classified]: param
2949
2973
  }) : result;
@@ -3070,7 +3094,6 @@ function getAttributeType(layer, attributeName) {
3070
3094
  const attribute = attributes[attributeName];
3071
3095
  return attribute ? attribute.type : api.AttributeType.Unknown;
3072
3096
  }
3073
-
3074
3097
  const getClassificationValue = (parameterValue, title, condition) => _extends({
3075
3098
  parameterValue,
3076
3099
  title
@@ -6279,6 +6302,46 @@ const LegendSymbolRenderer = /*#__PURE__*/React.memo(_ref => {
6279
6302
  });
6280
6303
  });
6281
6304
 
6305
+ const isHiddenLegend = (hiddenCondition, hiddenLegends) => !!(hiddenLegends != null && hiddenLegends.includes(hiddenCondition));
6306
+
6307
+ const renderColumn = (column, index) => {
6308
+ const dateTime = column.split(' ');
6309
+ return React__default.createElement(React.Fragment, {
6310
+ key: index
6311
+ }, React__default.createElement(ItemText, {
6312
+ title: column
6313
+ }, dateTime[0], React__default.createElement(MapLegendDescription, null, dateTime[1])), index === 0 && React__default.createElement(ItemSeparator, null));
6314
+ };
6315
+
6316
+ const getLegendText = _ref => {
6317
+ let {
6318
+ title,
6319
+ index,
6320
+ isDate
6321
+ } = _ref;
6322
+
6323
+ if (!title) {
6324
+ return React__default.createElement(ItemText, null, "\u0414\u0440\u0443\u0433\u043E\u0435");
6325
+ }
6326
+
6327
+ const columns = title == null ? void 0 : title.split(' - ');
6328
+ const isSingleColumn = (columns == null ? void 0 : columns.length) === 1;
6329
+
6330
+ if (!isDate || index && isSingleColumn) {
6331
+ return React__default.createElement(ItemText, {
6332
+ title: title
6333
+ }, title);
6334
+ }
6335
+
6336
+ if (!index && isSingleColumn) {
6337
+ return React__default.createElement(React__default.Fragment, null, React__default.createElement(ItemText, {
6338
+ title: "\u221E"
6339
+ }, "\u221E"), React__default.createElement(ItemSeparator, null), renderColumn(title));
6340
+ }
6341
+
6342
+ return React__default.createElement(React__default.Fragment, null, columns.map(renderColumn));
6343
+ };
6344
+
6282
6345
  const MaximizedLegend = _ref => {
6283
6346
  let {
6284
6347
  innerRef,
@@ -6297,37 +6360,6 @@ const MaximizedLegend = _ref => {
6297
6360
  const isStrokeWidth = isParameterType(['strokeWidth', 'stroke.width'], parameter);
6298
6361
  const isStrokeColor = isParameterType(['strokeColor', 'stroke.color'], parameter);
6299
6362
  const parameterValue = React.useMemo(() => get(sectionSymbol, parameter), [sectionSymbol, parameter]);
6300
- const renderColumn = React.useCallback((column, index) => {
6301
- const dateTime = column.split(' ');
6302
- return React__default.createElement(React.Fragment, {
6303
- key: index
6304
- }, React__default.createElement(ItemText, {
6305
- title: column
6306
- }, dateTime[0], React__default.createElement(MapLegendDescription, null, dateTime[1])), index === 0 && React__default.createElement(ItemSeparator, null));
6307
- }, []);
6308
- const renderItemText = React.useCallback((title, index) => {
6309
- if (!title) {
6310
- return React__default.createElement(ItemText, null, "\u0414\u0440\u0443\u0433\u043E\u0435");
6311
- }
6312
-
6313
- const columns = title == null ? void 0 : title.split(' - ');
6314
- const isSingleColumn = (columns == null ? void 0 : columns.length) === 1;
6315
-
6316
- if (!isDate || index && isSingleColumn) {
6317
- return React__default.createElement(ItemText, {
6318
- title: title
6319
- }, title);
6320
- }
6321
-
6322
- if (!index && isSingleColumn) {
6323
- return React__default.createElement(React__default.Fragment, null, React__default.createElement(ItemText, {
6324
- title: "\u221E"
6325
- }, "\u221E"), React__default.createElement(ItemSeparator, null), renderColumn(title));
6326
- }
6327
-
6328
- return React__default.createElement(React__default.Fragment, null, columns.map(renderColumn));
6329
- }, [isDate, renderColumn]);
6330
- const isHidden = React.useCallback(hiddenCondition => !!(hiddenLegends != null && hiddenLegends.includes(hiddenCondition)), [hiddenLegends]);
6331
6363
  const renderLegend = React.useCallback((_ref2, index) => {
6332
6364
  var _parameterValue$value;
6333
6365
 
@@ -6340,7 +6372,7 @@ const MaximizedLegend = _ref => {
6340
6372
  const isClusterFillColor$1 = isClusterFillColor(symbol, parameter);
6341
6373
  return React__default.createElement(ClassifiedItem, {
6342
6374
  key: sectionIndex + title + index,
6343
- isHidden: isHidden(hiddenCondition),
6375
+ isHidden: isHiddenLegend(hiddenCondition, hiddenLegends),
6344
6376
  isClusterFillColor: isClusterFillColor$1,
6345
6377
  onClick: () => toggleHiddenLegend == null ? void 0 : toggleHiddenLegend(layerName, hiddenCondition)
6346
6378
  }, isSize || isStrokeWidth || isStrokeColor ? React__default.createElement(MapLegendItems, {
@@ -6356,8 +6388,12 @@ const MaximizedLegend = _ref => {
6356
6388
  parameter: parameter
6357
6389
  })) : React__default.createElement(SymbolContainer, null, React__default.createElement(LegendSymbolRenderer, {
6358
6390
  symbol: isClusterFillColor$1 ? symbol : getExtractedSymbol(symbol, true)
6359
- })), renderItemText(title, index));
6360
- }, [parameter, sectionIndex, isHidden, isSize, isStrokeWidth, isStrokeColor, parameterValue, renderItemText, toggleHiddenLegend, layerName]);
6391
+ })), getLegendText({
6392
+ title,
6393
+ index,
6394
+ isDate
6395
+ }));
6396
+ }, [parameter, sectionIndex, hiddenLegends, isSize, isStrokeWidth, isStrokeColor, parameterValue, isDate, toggleHiddenLegend, layerName]);
6361
6397
  return React__default.createElement(MaximizedLegendContainer, {
6362
6398
  ref: innerRef,
6363
6399
  isShown: isShown
@@ -6390,6 +6426,7 @@ const LegendSection = _ref => {
6390
6426
  const [isExpanded, toggleExpanded] = useToggle();
6391
6427
  const [maxRef, maxNode] = useNode();
6392
6428
  const [minRef, minNode] = useNode();
6429
+ if (!attribute) return null;
6393
6430
  return React__default.createElement(MapLegendSectionContainer, null, React__default.createElement(MapLegendHeader, null, attribute.alias || attribute.name), React__default.createElement(LegendParameterDescription, {
6394
6431
  parameter: parameter
6395
6432
  }), React__default.createElement(MapLegendSectionItems, {
@@ -6418,49 +6455,107 @@ const LegendSection = _ref => {
6418
6455
  }, isExpanded ? 'Свернуть' : 'Развернуть'));
6419
6456
  };
6420
6457
 
6421
- const _excluded$3 = ["layerInfo"];
6458
+ const getConditionAttribute = (attributes, condition) => {
6459
+ if (!condition) return null;
6460
+ const attributeName = getAttributeNameFromCondition(condition);
6461
+ let attribute = attributes.find(_ref => {
6462
+ let {
6463
+ name
6464
+ } = _ref;
6465
+ return name === attributeName;
6466
+ });
6467
+
6468
+ if (!attribute) {
6469
+ if (attributeName === 'count') {
6470
+ attribute = {
6471
+ name: 'count',
6472
+ alias: 'Количество',
6473
+ type: api.AttributeType.Int32
6474
+ };
6475
+ } else {
6476
+ return null;
6477
+ }
6478
+ }
6479
+
6480
+ return attribute;
6481
+ };
6482
+
6483
+ const LegendChildren = _ref => {
6484
+ var _layerInfo$style, _layerInfo$style$chil;
6485
+
6486
+ let {
6487
+ layerInfo,
6488
+ hiddenLegends,
6489
+ toggleHiddenLegend,
6490
+ formatValue
6491
+ } = _ref;
6492
+ if (!((_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length)) return null;
6493
+ const attributes = getLayerAttributes(layerInfo.layerDefinition);
6494
+ return React__default.createElement(MapLegendContainer, null, layerInfo.style.children.map((paramValue, index) => {
6495
+ var _getConditionAttribut;
6496
+
6497
+ const attribute = getConditionAttribute(attributes, paramValue.condition);
6498
+ if (!attribute) return null;
6499
+ const hiddenCondition = createHiddenCondition(attribute.name, attribute.type, getClassificationValue(paramValue.symbol, paramValue.title, new ClassificationCondition(paramValue.condition)));
6500
+ const legendText = getLegendText({
6501
+ title: isRangeCondition(paramValue.condition) ? createValueTitleFromCondition(paramValue, attribute, formatValue, index) : getTitleFromCondition({
6502
+ condition: paramValue.condition,
6503
+ attribute,
6504
+ formatValue
6505
+ }),
6506
+ index,
6507
+ isDate: ((_getConditionAttribut = getConditionAttribute(attributes, paramValue.condition)) == null ? void 0 : _getConditionAttribut.type) === 'DateTime'
6508
+ });
6509
+ return React__default.createElement(ClassifiedItem, {
6510
+ key: index,
6511
+ isHidden: isHiddenLegend(hiddenCondition, hiddenLegends == null ? void 0 : hiddenLegends[layerInfo.name]),
6512
+ onClick: () => toggleHiddenLegend == null ? void 0 : toggleHiddenLegend(layerInfo.name, hiddenCondition)
6513
+ }, React__default.createElement(SymbolContainer, null, React__default.createElement(LegendSymbolRenderer, {
6514
+ symbol: paramValue.symbol
6515
+ })), legendText);
6516
+ }));
6517
+ };
6518
+
6519
+ const _excluded$3 = ["layerInfo", "formatValue", "hiddenLegends", "toggleHiddenLegend"];
6422
6520
  const Legend = /*#__PURE__*/React.memo(_ref => {
6521
+ var _layerInfo$style, _layerInfo$style$chil;
6522
+
6423
6523
  let {
6424
- layerInfo
6524
+ layerInfo,
6525
+ formatValue,
6526
+ hiddenLegends,
6527
+ toggleHiddenLegend
6425
6528
  } = _ref,
6426
6529
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
6427
6530
 
6531
+ if ((_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length) {
6532
+ return React__default.createElement(LegendChildren, {
6533
+ layerInfo: layerInfo,
6534
+ formatValue: formatValue,
6535
+ hiddenLegends: hiddenLegends,
6536
+ toggleHiddenLegend: toggleHiddenLegend
6537
+ });
6538
+ }
6539
+
6540
+ const attributes = getLayerAttributes(layerInfo.layerDefinition);
6428
6541
  const classified = getClassified(layerInfo);
6429
6542
  if (!classified) return null;
6430
6543
  const parameters = Object.keys(classified);
6431
- const attributes = getLayerAttributes(layerInfo.layerDefinition);
6432
6544
  return React__default.createElement(MapLegendContainer, null, Object.keys(classified).map((param, index) => {
6433
- var _classified$param$val, _layerInfo$style;
6434
-
6435
- const attributeName = getAttributeNameFromCondition((_classified$param$val = classified[param].values[0]) == null ? void 0 : _classified$param$val.condition);
6436
- let attribute = attributes.find(_ref2 => {
6437
- let {
6438
- name
6439
- } = _ref2;
6440
- return name === attributeName;
6441
- });
6442
-
6443
- if (!attribute) {
6444
- if (attributeName === 'count') {
6445
- attribute = {
6446
- name: 'count',
6447
- alias: 'Количество',
6448
- type: api.AttributeType.Int32
6449
- };
6450
- } else {
6451
- return null;
6452
- }
6453
- }
6545
+ var _layerInfo$style2, _classified$param, _classified$param$val;
6454
6546
 
6455
6547
  return React__default.createElement(LegendSection, Object.assign({
6456
6548
  key: index,
6457
6549
  layerName: layerInfo.name,
6458
- symbol: (_layerInfo$style = layerInfo.style) == null ? void 0 : _layerInfo$style.symbol,
6459
- attribute: attribute,
6550
+ symbol: (_layerInfo$style2 = layerInfo.style) == null ? void 0 : _layerInfo$style2.symbol,
6551
+ attribute: getConditionAttribute(attributes, (_classified$param = classified[param]) == null ? void 0 : (_classified$param$val = _classified$param.values[0]) == null ? void 0 : _classified$param$val.condition),
6460
6552
  classified: classified[param],
6461
6553
  parameter: param,
6462
6554
  parameters: parameters,
6463
- index: index
6555
+ index: index,
6556
+ formatValue: formatValue,
6557
+ hiddenLegends: hiddenLegends,
6558
+ toggleHiddenLegend: toggleHiddenLegend
6464
6559
  }, rest));
6465
6560
  }));
6466
6561
  });
@@ -7021,6 +7116,7 @@ exports.createLegendSymbol = createLegendSymbol;
7021
7116
  exports.createOtherHiddenCondition = createOtherHiddenCondition;
7022
7117
  exports.createSvgGradient = createSvgGradient;
7023
7118
  exports.createValueTitle = createValueTitle;
7119
+ exports.createValueTitleFromCondition = createValueTitleFromCondition;
7024
7120
  exports.dateComparisonOperators = dateComparisonOperators;
7025
7121
  exports.defaultOffset = defaultOffset;
7026
7122
  exports.defineStrokeStylePreset = defineStrokeStylePreset;
@@ -7043,6 +7139,7 @@ exports.getAttributeNameFromCondition = getAttributeNameFromCondition;
7043
7139
  exports.getAttributeType = getAttributeType;
7044
7140
  exports.getAttributesConfiguration = getAttributesConfiguration;
7045
7141
  exports.getChildSymbols = getChildSymbols;
7142
+ exports.getClassificationValue = getClassificationValue;
7046
7143
  exports.getClassified = getClassified;
7047
7144
  exports.getCrs = getCrs;
7048
7145
  exports.getDashStylePreset = getDashStylePreset;