@evergis/react 2.0.191 → 2.0.192
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/components/Legend/components/LegendChildren.d.ts +3 -0
- package/dist/components/Legend/types.d.ts +6 -3
- package/dist/components/Legend/utils/getConditionAttribute.d.ts +2 -0
- package/dist/components/Legend/utils/getLegendText.d.ts +5 -0
- package/dist/components/Legend/utils/isHiddenLegend.d.ts +1 -0
- package/dist/core/classification/getClassifications.d.ts +2 -2
- package/dist/core/classification/parameterValue.d.ts +4 -4
- package/dist/core/classification/types.d.ts +1 -1
- package/dist/core/style/types/parameterValue.d.ts +2 -2
- package/dist/react.cjs.development.js +222 -139
- package/dist/react.cjs.development.js.map +1 -1
- package/dist/react.cjs.production.min.js +1 -1
- package/dist/react.cjs.production.min.js.map +1 -1
- package/dist/react.esm.js +221 -140
- package/dist/react.esm.js.map +1 -1
- package/dist/utils/legend.d.ts +8 -6
- package/package.json +2 -2
|
@@ -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,
|
|
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<
|
|
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 @@
|
|
|
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,
|
|
3
|
-
export declare const toClassification: (values: (ParameterByAttributeValue<
|
|
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<
|
|
4
|
-
export declare const isCalculatedParameter: (value: UnidentifiedParameterValue) => value is CalculatedParameter<
|
|
5
|
-
export declare const getParameterValue: <Value extends
|
|
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:
|
|
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
|
|
23
|
-
export declare type
|
|
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
|
};
|
|
@@ -2585,11 +2585,11 @@ const checkLayerHasLegend = layerInfo => {
|
|
|
2585
2585
|
const getTitleFromCondition = condition => {
|
|
2586
2586
|
var _parts$;
|
|
2587
2587
|
|
|
2588
|
-
const parts = condition.split(' == ');
|
|
2589
|
-
return (_parts$ = parts[1]) == null ? void 0 : _parts$.slice(1, -1);
|
|
2588
|
+
const parts = condition == null ? void 0 : condition.split(' == ');
|
|
2589
|
+
return (parts == null ? void 0 : (_parts$ = parts[1]) == null ? void 0 : _parts$.slice(1, -1)) || '';
|
|
2590
2590
|
};
|
|
2591
|
-
|
|
2592
|
-
|
|
2591
|
+
function createValueTitleFromCondition(paramValue, attribute, formatValue, index) {
|
|
2592
|
+
if (!attribute) return '';
|
|
2593
2593
|
if (paramValue.title) return paramValue.title;
|
|
2594
2594
|
const value = {
|
|
2595
2595
|
parameterValue: getParameterValue(paramValue.value),
|
|
@@ -2606,7 +2606,6 @@ function createValueTitle$1(paramValue, attribute, formatValue, index) {
|
|
|
2606
2606
|
// пункт "Настраиваемые значения параметров символики в системе"
|
|
2607
2607
|
// Для добавления подготовленных значений размеров символов нужно использовать константу PREPARED_SYMBOL_SIZES
|
|
2608
2608
|
|
|
2609
|
-
|
|
2610
2609
|
const DEFAULT_LEGEND_STYLES = {
|
|
2611
2610
|
[0
|
|
2612
2611
|
/* Point */
|
|
@@ -2901,7 +2900,7 @@ const getMinimizedLegendValues = (attribute, classified, formatValue, index, oth
|
|
|
2901
2900
|
const to = getValueFromConditionPart(paramValue.condition, 2);
|
|
2902
2901
|
result.from = from ? isNumeric(from) ? +from : formatDate(from) : null;
|
|
2903
2902
|
result.to = to ? isNumeric(to) ? +to : formatDate(to) : null;
|
|
2904
|
-
result.title =
|
|
2903
|
+
result.title = createValueTitleFromCondition(paramValue, attribute, formatValue, index);
|
|
2905
2904
|
return result;
|
|
2906
2905
|
}
|
|
2907
2906
|
|
|
@@ -2927,7 +2926,7 @@ const getMaximizedLegendValues = (attribute, param, params, classified, symbol,
|
|
|
2927
2926
|
const result = {
|
|
2928
2927
|
symbol: createLegendSymbol(paramValue.value, param, params, symbol)
|
|
2929
2928
|
};
|
|
2930
|
-
result.title = isRangeCondition(paramValue.condition) ?
|
|
2929
|
+
result.title = isRangeCondition(paramValue.condition) ? createValueTitleFromCondition(paramValue, attribute, formatValue, sectionIndex) : getTitleFromCondition(paramValue.condition);
|
|
2931
2930
|
result.hiddenCondition = createHiddenCondition(attribute.name, attribute.type, getClassificationValue(paramValue.value, result.title, new ClassificationCondition(classified.values[index].condition)));
|
|
2932
2931
|
return result;
|
|
2933
2932
|
});
|
|
@@ -2939,11 +2938,26 @@ const getMaximizedLegendValues = (attribute, param, params, classified, symbol,
|
|
|
2939
2938
|
return [...items, other];
|
|
2940
2939
|
};
|
|
2941
2940
|
const getClassified = layerInfo => {
|
|
2941
|
+
var _layerInfo$style2, _layerInfo$style2$chi;
|
|
2942
|
+
|
|
2943
|
+
if ((_layerInfo$style2 = layerInfo.style) != null && (_layerInfo$style2$chi = _layerInfo$style2.children) != null && _layerInfo$style2$chi.length) {
|
|
2944
|
+
var _layerInfo$style3;
|
|
2945
|
+
|
|
2946
|
+
return {
|
|
2947
|
+
symbol: {
|
|
2948
|
+
type: 'byAttribute',
|
|
2949
|
+
defaultValue: layerInfo.style.symbol,
|
|
2950
|
+
title: null,
|
|
2951
|
+
values: (_layerInfo$style3 = layerInfo.style) == null ? void 0 : _layerInfo$style3.children
|
|
2952
|
+
}
|
|
2953
|
+
};
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2942
2956
|
const classifyParams = SYMBOL_CLASSIFICATION[layerInfo.geometryType];
|
|
2943
2957
|
return classifyParams == null ? void 0 : classifyParams.reduce((result, classified) => {
|
|
2944
|
-
var _layerInfo$
|
|
2958
|
+
var _layerInfo$style4;
|
|
2945
2959
|
|
|
2946
|
-
const param = get((_layerInfo$
|
|
2960
|
+
const param = get((_layerInfo$style4 = layerInfo.style) == null ? void 0 : _layerInfo$style4.symbol, classified);
|
|
2947
2961
|
return (param == null ? void 0 : param.type) === 'byAttribute' ? _extends({}, result, {
|
|
2948
2962
|
[classified]: param
|
|
2949
2963
|
}) : result;
|
|
@@ -3070,7 +3084,6 @@ function getAttributeType(layer, attributeName) {
|
|
|
3070
3084
|
const attribute = attributes[attributeName];
|
|
3071
3085
|
return attribute ? attribute.type : api.AttributeType.Unknown;
|
|
3072
3086
|
}
|
|
3073
|
-
|
|
3074
3087
|
const getClassificationValue = (parameterValue, title, condition) => _extends({
|
|
3075
3088
|
parameterValue,
|
|
3076
3089
|
title
|
|
@@ -6279,6 +6292,46 @@ const LegendSymbolRenderer = /*#__PURE__*/React.memo(_ref => {
|
|
|
6279
6292
|
});
|
|
6280
6293
|
});
|
|
6281
6294
|
|
|
6295
|
+
const isHiddenLegend = (hiddenCondition, hiddenLegends) => !!(hiddenLegends != null && hiddenLegends.includes(hiddenCondition));
|
|
6296
|
+
|
|
6297
|
+
const renderColumn = (column, index) => {
|
|
6298
|
+
const dateTime = column.split(' ');
|
|
6299
|
+
return React__default.createElement(React.Fragment, {
|
|
6300
|
+
key: index
|
|
6301
|
+
}, React__default.createElement(ItemText, {
|
|
6302
|
+
title: column
|
|
6303
|
+
}, dateTime[0], React__default.createElement(MapLegendDescription, null, dateTime[1])), index === 0 && React__default.createElement(ItemSeparator, null));
|
|
6304
|
+
};
|
|
6305
|
+
|
|
6306
|
+
const getLegendText = _ref => {
|
|
6307
|
+
let {
|
|
6308
|
+
title,
|
|
6309
|
+
index,
|
|
6310
|
+
isDate
|
|
6311
|
+
} = _ref;
|
|
6312
|
+
|
|
6313
|
+
if (!title) {
|
|
6314
|
+
return React__default.createElement(ItemText, null, "\u0414\u0440\u0443\u0433\u043E\u0435");
|
|
6315
|
+
}
|
|
6316
|
+
|
|
6317
|
+
const columns = title == null ? void 0 : title.split(' - ');
|
|
6318
|
+
const isSingleColumn = (columns == null ? void 0 : columns.length) === 1;
|
|
6319
|
+
|
|
6320
|
+
if (!isDate || index && isSingleColumn) {
|
|
6321
|
+
return React__default.createElement(ItemText, {
|
|
6322
|
+
title: title
|
|
6323
|
+
}, title);
|
|
6324
|
+
}
|
|
6325
|
+
|
|
6326
|
+
if (!index && isSingleColumn) {
|
|
6327
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement(ItemText, {
|
|
6328
|
+
title: "\u221E"
|
|
6329
|
+
}, "\u221E"), React__default.createElement(ItemSeparator, null), renderColumn(title));
|
|
6330
|
+
}
|
|
6331
|
+
|
|
6332
|
+
return React__default.createElement(React__default.Fragment, null, columns.map(renderColumn));
|
|
6333
|
+
};
|
|
6334
|
+
|
|
6282
6335
|
const MaximizedLegend = _ref => {
|
|
6283
6336
|
let {
|
|
6284
6337
|
innerRef,
|
|
@@ -6297,37 +6350,6 @@ const MaximizedLegend = _ref => {
|
|
|
6297
6350
|
const isStrokeWidth = isParameterType(['strokeWidth', 'stroke.width'], parameter);
|
|
6298
6351
|
const isStrokeColor = isParameterType(['strokeColor', 'stroke.color'], parameter);
|
|
6299
6352
|
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
6353
|
const renderLegend = React.useCallback((_ref2, index) => {
|
|
6332
6354
|
var _parameterValue$value;
|
|
6333
6355
|
|
|
@@ -6340,7 +6362,7 @@ const MaximizedLegend = _ref => {
|
|
|
6340
6362
|
const isClusterFillColor$1 = isClusterFillColor(symbol, parameter);
|
|
6341
6363
|
return React__default.createElement(ClassifiedItem, {
|
|
6342
6364
|
key: sectionIndex + title + index,
|
|
6343
|
-
isHidden:
|
|
6365
|
+
isHidden: isHiddenLegend(hiddenCondition, hiddenLegends),
|
|
6344
6366
|
isClusterFillColor: isClusterFillColor$1,
|
|
6345
6367
|
onClick: () => toggleHiddenLegend == null ? void 0 : toggleHiddenLegend(layerName, hiddenCondition)
|
|
6346
6368
|
}, isSize || isStrokeWidth || isStrokeColor ? React__default.createElement(MapLegendItems, {
|
|
@@ -6356,8 +6378,12 @@ const MaximizedLegend = _ref => {
|
|
|
6356
6378
|
parameter: parameter
|
|
6357
6379
|
})) : React__default.createElement(SymbolContainer, null, React__default.createElement(LegendSymbolRenderer, {
|
|
6358
6380
|
symbol: isClusterFillColor$1 ? symbol : getExtractedSymbol(symbol, true)
|
|
6359
|
-
})),
|
|
6360
|
-
|
|
6381
|
+
})), getLegendText({
|
|
6382
|
+
title,
|
|
6383
|
+
index,
|
|
6384
|
+
isDate
|
|
6385
|
+
}));
|
|
6386
|
+
}, [parameter, sectionIndex, hiddenLegends, isSize, isStrokeWidth, isStrokeColor, parameterValue, isDate, toggleHiddenLegend, layerName]);
|
|
6361
6387
|
return React__default.createElement(MaximizedLegendContainer, {
|
|
6362
6388
|
ref: innerRef,
|
|
6363
6389
|
isShown: isShown
|
|
@@ -6390,6 +6416,7 @@ const LegendSection = _ref => {
|
|
|
6390
6416
|
const [isExpanded, toggleExpanded] = useToggle();
|
|
6391
6417
|
const [maxRef, maxNode] = useNode();
|
|
6392
6418
|
const [minRef, minNode] = useNode();
|
|
6419
|
+
if (!attribute) return null;
|
|
6393
6420
|
return React__default.createElement(MapLegendSectionContainer, null, React__default.createElement(MapLegendHeader, null, attribute.alias || attribute.name), React__default.createElement(LegendParameterDescription, {
|
|
6394
6421
|
parameter: parameter
|
|
6395
6422
|
}), React__default.createElement(MapLegendSectionItems, {
|
|
@@ -6418,49 +6445,103 @@ const LegendSection = _ref => {
|
|
|
6418
6445
|
}, isExpanded ? 'Свернуть' : 'Развернуть'));
|
|
6419
6446
|
};
|
|
6420
6447
|
|
|
6421
|
-
const
|
|
6448
|
+
const getConditionAttribute = (attributes, condition) => {
|
|
6449
|
+
if (!condition) return null;
|
|
6450
|
+
const attributeName = getAttributeNameFromCondition(condition);
|
|
6451
|
+
let attribute = attributes.find(_ref => {
|
|
6452
|
+
let {
|
|
6453
|
+
name
|
|
6454
|
+
} = _ref;
|
|
6455
|
+
return name === attributeName;
|
|
6456
|
+
});
|
|
6457
|
+
|
|
6458
|
+
if (!attribute) {
|
|
6459
|
+
if (attributeName === 'count') {
|
|
6460
|
+
attribute = {
|
|
6461
|
+
name: 'count',
|
|
6462
|
+
alias: 'Количество',
|
|
6463
|
+
type: api.AttributeType.Int32
|
|
6464
|
+
};
|
|
6465
|
+
} else {
|
|
6466
|
+
return null;
|
|
6467
|
+
}
|
|
6468
|
+
}
|
|
6469
|
+
|
|
6470
|
+
return attribute;
|
|
6471
|
+
};
|
|
6472
|
+
|
|
6473
|
+
const LegendChildren = _ref => {
|
|
6474
|
+
var _layerInfo$style, _layerInfo$style$chil;
|
|
6475
|
+
|
|
6476
|
+
let {
|
|
6477
|
+
layerInfo,
|
|
6478
|
+
hiddenLegends,
|
|
6479
|
+
toggleHiddenLegend,
|
|
6480
|
+
formatValue
|
|
6481
|
+
} = _ref;
|
|
6482
|
+
if (!((_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length)) return null;
|
|
6483
|
+
const attributes = getLayerAttributes(layerInfo.layerDefinition);
|
|
6484
|
+
return React__default.createElement(MapLegendContainer, null, layerInfo.style.children.map((paramValue, index) => {
|
|
6485
|
+
var _getConditionAttribut;
|
|
6486
|
+
|
|
6487
|
+
const attribute = getConditionAttribute(attributes, paramValue.condition);
|
|
6488
|
+
if (!attribute) return null;
|
|
6489
|
+
const hiddenCondition = createHiddenCondition(attribute.name, attribute.type, getClassificationValue(paramValue.symbol, paramValue.title, new ClassificationCondition(paramValue.condition)));
|
|
6490
|
+
const legendText = getLegendText({
|
|
6491
|
+
title: isRangeCondition(paramValue.condition) ? createValueTitleFromCondition(paramValue, attribute, formatValue, index) : getTitleFromCondition(paramValue.condition),
|
|
6492
|
+
index,
|
|
6493
|
+
isDate: ((_getConditionAttribut = getConditionAttribute(attributes, paramValue.condition)) == null ? void 0 : _getConditionAttribut.type) === 'DateTime'
|
|
6494
|
+
});
|
|
6495
|
+
return React__default.createElement(ClassifiedItem, {
|
|
6496
|
+
key: index,
|
|
6497
|
+
isHidden: isHiddenLegend(hiddenCondition, hiddenLegends == null ? void 0 : hiddenLegends[layerInfo.name]),
|
|
6498
|
+
onClick: () => toggleHiddenLegend == null ? void 0 : toggleHiddenLegend(layerInfo.name, hiddenCondition)
|
|
6499
|
+
}, React__default.createElement(SymbolContainer, null, React__default.createElement(LegendSymbolRenderer, {
|
|
6500
|
+
symbol: paramValue.symbol
|
|
6501
|
+
})), legendText);
|
|
6502
|
+
}));
|
|
6503
|
+
};
|
|
6504
|
+
|
|
6505
|
+
const _excluded$3 = ["layerInfo", "formatValue", "hiddenLegends", "toggleHiddenLegend"];
|
|
6422
6506
|
const Legend = /*#__PURE__*/React.memo(_ref => {
|
|
6507
|
+
var _layerInfo$style, _layerInfo$style$chil;
|
|
6508
|
+
|
|
6423
6509
|
let {
|
|
6424
|
-
layerInfo
|
|
6510
|
+
layerInfo,
|
|
6511
|
+
formatValue,
|
|
6512
|
+
hiddenLegends,
|
|
6513
|
+
toggleHiddenLegend
|
|
6425
6514
|
} = _ref,
|
|
6426
6515
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
6427
6516
|
|
|
6517
|
+
if ((_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length) {
|
|
6518
|
+
return React__default.createElement(LegendChildren, {
|
|
6519
|
+
layerInfo: layerInfo,
|
|
6520
|
+
formatValue: formatValue,
|
|
6521
|
+
hiddenLegends: hiddenLegends,
|
|
6522
|
+
toggleHiddenLegend: toggleHiddenLegend
|
|
6523
|
+
});
|
|
6524
|
+
}
|
|
6525
|
+
|
|
6526
|
+
const attributes = getLayerAttributes(layerInfo.layerDefinition);
|
|
6428
6527
|
const classified = getClassified(layerInfo);
|
|
6429
6528
|
if (!classified) return null;
|
|
6430
6529
|
const parameters = Object.keys(classified);
|
|
6431
|
-
const attributes = getLayerAttributes(layerInfo.layerDefinition);
|
|
6432
6530
|
return React__default.createElement(MapLegendContainer, null, Object.keys(classified).map((param, index) => {
|
|
6433
|
-
var _classified$param
|
|
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
|
-
}
|
|
6531
|
+
var _layerInfo$style2, _classified$param, _classified$param$val;
|
|
6454
6532
|
|
|
6455
6533
|
return React__default.createElement(LegendSection, Object.assign({
|
|
6456
6534
|
key: index,
|
|
6457
6535
|
layerName: layerInfo.name,
|
|
6458
|
-
symbol: (_layerInfo$
|
|
6459
|
-
attribute:
|
|
6536
|
+
symbol: (_layerInfo$style2 = layerInfo.style) == null ? void 0 : _layerInfo$style2.symbol,
|
|
6537
|
+
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
6538
|
classified: classified[param],
|
|
6461
6539
|
parameter: param,
|
|
6462
6540
|
parameters: parameters,
|
|
6463
|
-
index: index
|
|
6541
|
+
index: index,
|
|
6542
|
+
formatValue: formatValue,
|
|
6543
|
+
hiddenLegends: hiddenLegends,
|
|
6544
|
+
toggleHiddenLegend: toggleHiddenLegend
|
|
6464
6545
|
}, rest));
|
|
6465
6546
|
}));
|
|
6466
6547
|
});
|
|
@@ -7021,6 +7102,7 @@ exports.createLegendSymbol = createLegendSymbol;
|
|
|
7021
7102
|
exports.createOtherHiddenCondition = createOtherHiddenCondition;
|
|
7022
7103
|
exports.createSvgGradient = createSvgGradient;
|
|
7023
7104
|
exports.createValueTitle = createValueTitle;
|
|
7105
|
+
exports.createValueTitleFromCondition = createValueTitleFromCondition;
|
|
7024
7106
|
exports.dateComparisonOperators = dateComparisonOperators;
|
|
7025
7107
|
exports.defaultOffset = defaultOffset;
|
|
7026
7108
|
exports.defineStrokeStylePreset = defineStrokeStylePreset;
|
|
@@ -7043,6 +7125,7 @@ exports.getAttributeNameFromCondition = getAttributeNameFromCondition;
|
|
|
7043
7125
|
exports.getAttributeType = getAttributeType;
|
|
7044
7126
|
exports.getAttributesConfiguration = getAttributesConfiguration;
|
|
7045
7127
|
exports.getChildSymbols = getChildSymbols;
|
|
7128
|
+
exports.getClassificationValue = getClassificationValue;
|
|
7046
7129
|
exports.getClassified = getClassified;
|
|
7047
7130
|
exports.getCrs = getCrs;
|
|
7048
7131
|
exports.getDashStylePreset = getDashStylePreset;
|