@evergis/react 2.0.194 → 2.0.195

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.
@@ -2,6 +2,7 @@ import { FC } from 'react';
2
2
  import { ClusterSymbolDc } from '@evergis/api';
3
3
  export declare const ClusterSymbolPreview: FC<{
4
4
  symbol: ClusterSymbolDc;
5
+ index?: number;
5
6
  size?: number;
6
7
  fontSize?: string;
7
8
  }>;
@@ -2,4 +2,5 @@ import { FC } from 'react';
2
2
  import { StyleSymbolType } from '../../../core';
3
3
  export declare const LegendSymbolRenderer: FC<{
4
4
  symbol: StyleSymbolType;
5
+ index?: number;
5
6
  }>;
@@ -1,6 +1,8 @@
1
+ export * from './ClusterSymbolPreview';
2
+ export * from './LegendChildren';
3
+ export * from './LegendParameterDescription';
1
4
  export * from './LegendSection';
2
5
  export * from './LegendSymbolRenderer';
3
- export * from './LegendParameterDescription';
4
6
  export * from './MaximizedLegend';
5
7
  export * from './MinimizedLegend';
6
8
  export * from './SvgSymbol';
@@ -1,15 +1,16 @@
1
1
  /// <reference types="react" />
2
2
  import { Color } from '@evergis/color/es/Color';
3
- import { SvgEditorField, SvgSymbolBg } from '../types';
4
3
  import { SvgPointSymbol } from '../../../core';
5
- export declare const useSvgSymbol: (symbol: SvgPointSymbol, skipOffset?: boolean | undefined) => {
4
+ import { SvgEditorField, SvgSymbolBg } from '../types';
5
+ export declare const useSvgSymbol: (symbol: SvgPointSymbol, skipOffset?: boolean | undefined, isClassifiedValue?: boolean | undefined) => {
6
6
  svgRef: import("react").MutableRefObject<HTMLElement | null>;
7
7
  initSvg: () => void;
8
8
  getSvgData: () => string;
9
- manipulateSvg: ({ svg, bg, newSymbol, }: {
9
+ manipulateSvg: ({ svg, bg, newSymbol, isClassifiedValue, }: {
10
10
  svg: string;
11
11
  bg?: SvgSymbolBg | undefined;
12
12
  newSymbol?: import("../../../core").ClientSymbol<"svgPointSymbol", import("@evergis/api").SvgPointSymbolDc, never> | undefined;
13
+ isClassifiedValue?: boolean | undefined;
13
14
  }) => void;
14
15
  getUpdatedSvgSymbol: (field: keyof SvgEditorField, value: Color | number | string) => any;
15
16
  };
@@ -69,6 +69,7 @@ export declare type SvgSymbolProps = {
69
69
  text?: string;
70
70
  bg?: SvgSymbolBg;
71
71
  skipOffset?: boolean;
72
+ isClassifiedValue?: boolean;
72
73
  fontSettings?: PointLabelSymbolDc;
73
74
  onClick?: (svg: string, symbol: SvgPointSymbol) => void;
74
75
  };
@@ -3231,9 +3231,16 @@ const createSvgGradient = (svg, values) => svg.gradient('linear', add => {
3231
3231
  });
3232
3232
  }).from(0, 0).to(1, 1); // eslint-disable-next-line max-lines-per-function
3233
3233
 
3234
- const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
3234
+ const manipulateSvgSymbol = _ref2 => {
3235
3235
  var _$exec2;
3236
3236
 
3237
+ let {
3238
+ SVGContainer,
3239
+ symbol,
3240
+ svg,
3241
+ bg,
3242
+ isClassifiedValue
3243
+ } = _ref2;
3237
3244
  if (!symbol) return SVGContainer;
3238
3245
  const symbolData = getParameterValue(svg || symbol.data);
3239
3246
  if (!symbolData) return SVGContainer;
@@ -3280,18 +3287,24 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
3280
3287
  SVGContainer.svg(currentBg === exports.SvgSymbolBg.Circle ? "<circle\n id=\"symbol-bg\"\n cx=\"" + DEFAULT_SYMBOL_WITH_BG_SIZE / 2 + "\"\n cy=\"" + DEFAULT_SYMBOL_WITH_BG_SIZE / 2 + "\"\n r=\"" + DEFAULT_SYMBOL_WITH_BG_SIZE / 2 + "\"\n fill=\"" + (fillColor || DEFAULT_SYMBOL_FILL_COLOR) + "\"\n stroke=\"" + (strokeColor || DEFAULT_SYMBOL_STROKE_COLOR) + "\"\n stroke-width=\"" + strokeWidth + "\"\n />" : "<rect\n id=\"symbol-bg\"\n width=\"" + DEFAULT_SYMBOL_WITH_BG_SIZE + "\"\n height=\"" + DEFAULT_SYMBOL_WITH_BG_SIZE + "\"\n rx=\"4\"\n fill=\"" + (fillColor || DEFAULT_SYMBOL_FILL_COLOR) + "\"\n stroke=\"" + (strokeColor || DEFAULT_SYMBOL_STROKE_COLOR) + "\"\n stroke-width=\"" + strokeWidth + "\"\n />");
3281
3288
  SVGContainer.svg(innerSvg);
3282
3289
  SVGContainer.find('#symbol-bg:not(:first-child)').each(item => item.remove());
3283
- SVGContainer.find(':not(#symbol-bg)').each(item => item.center(DEFAULT_SYMBOL_WITH_BG_SIZE / 2, DEFAULT_SYMBOL_WITH_BG_SIZE / 2).fill('white')); // eslint-disable-next-line max-depth
3290
+ SVGContainer.find(':not(#symbol-bg)').each(item => item.center(DEFAULT_SYMBOL_WITH_BG_SIZE / 2, DEFAULT_SYMBOL_WITH_BG_SIZE / 2).fill('white'));
3291
+ const symbolBg = SVGContainer.find('#symbol-bg')[0];
3292
+
3293
+ if (isClassifiedValue) {
3294
+ symbolBg == null ? void 0 : symbolBg.stroke({
3295
+ opacity: 0.28
3296
+ });
3297
+ } // eslint-disable-next-line max-depth
3298
+
3284
3299
 
3285
3300
  if (isParameterByAttribute(background == null ? void 0 : background.fillColor)) {
3286
- var _background$fillColor, _SVGContainer$find$;
3301
+ var _background$fillColor;
3287
3302
 
3288
3303
  const gradient = createSvgGradient(SVGContainer, background == null ? void 0 : (_background$fillColor = background.fillColor) == null ? void 0 : _background$fillColor.values);
3289
- (_SVGContainer$find$ = SVGContainer.find('#symbol-bg')[0]) == null ? void 0 : _SVGContainer$find$.fill(gradient);
3304
+ symbolBg == null ? void 0 : symbolBg.fill(gradient);
3290
3305
 
3291
3306
  if (isParameterByAttribute(background == null ? void 0 : background.strokeColor)) {
3292
- var _SVGContainer$find$2;
3293
-
3294
- (_SVGContainer$find$2 = SVGContainer.find('#symbol-bg')[0]) == null ? void 0 : _SVGContainer$find$2.stroke({
3307
+ symbolBg == null ? void 0 : symbolBg.stroke({
3295
3308
  color: gradient,
3296
3309
  opacity: 0.28
3297
3310
  });
@@ -6002,89 +6015,7 @@ const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templ
6002
6015
  const MapLegendExpandButton = /*#__PURE__*/styled__default.div(_templateObject36 || (_templateObject36 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin-top: 0.1rem;\n font-size: 0.625rem;\n color: #1fb3aa;\n"])));
6003
6016
  const ClusterLegendContainer = /*#__PURE__*/styled__default.div(_templateObject37 || (_templateObject37 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: -0.9rem;\n transform: scale(0.5);\n"])));
6004
6017
 
6005
- const getValueFromLegendTitle = (title, minOrMax) => {
6006
- if (title.includes(" - ")) {
6007
- const result = title == null ? void 0 : title.split(" - ");
6008
- return minOrMax === "min" ? result == null ? void 0 : result[0] : result == null ? void 0 : result[1];
6009
- }
6010
-
6011
- if (title.includes(",")) {
6012
- const result = title == null ? void 0 : title.split(",");
6013
- return result.join(", ");
6014
- }
6015
-
6016
- return title.split(" ").find(isNumeric) || title || "";
6017
- };
6018
-
6019
- const MinimizedLegend = _ref => {
6020
- var _currentValues$, _currentValues, _currentValues$2, _currentValues2;
6021
-
6022
- let {
6023
- innerRef,
6024
- isShown,
6025
- values,
6026
- title,
6027
- parameter,
6028
- hiddenLegends
6029
- } = _ref;
6030
- const currentValues = [...values];
6031
- const other = currentValues.pop();
6032
- const isSize = isParameterType("size", parameter);
6033
- const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
6034
- const titleMax = getValueFromLegendTitle((_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title, "max");
6035
- const titleMin = getValueFromLegendTitle((_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title, "min");
6036
- const checkIsHidden = React.useCallback(hiddenCondition => hiddenCondition ? hiddenLegends == null ? void 0 : hiddenLegends.some(condition => hiddenCondition.includes(condition)) : false, [hiddenLegends]);
6037
- return React__default.createElement(MinimizedLegendContainer, {
6038
- ref: innerRef,
6039
- isShown: isShown
6040
- }, !!title && React__default.createElement(MapLegendValueDescr, null, title), isSize ? React__default.createElement(React__default.Fragment, null, React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendItems, {
6041
- parameter: parameter,
6042
- isSize: true
6043
- }, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
6044
- key: "" + value.title + index,
6045
- title: value.title,
6046
- value: value.parameterValue,
6047
- parameter: parameter,
6048
- isHidden: checkIsHidden(value.hiddenCondition)
6049
- })))), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendDown, null, (_currentValues$2 = currentValues[0]) == null ? void 0 : _currentValues$2.title), React__default.createElement(SizeMinimizedLegendUp, null, (_currentValues2 = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues2.title))), React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendItems, {
6050
- parameter: parameter,
6051
- isSize: true
6052
- }, React__default.createElement(MapLegendOther, {
6053
- title: "\u0414\u0440\u0443\u0433\u043E\u0435",
6054
- value: other == null ? void 0 : other.parameterValue,
6055
- parameter: parameter,
6056
- isHidden: checkIsHidden(other == null ? void 0 : other.hiddenCondition)
6057
- }))), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendUp, null, "\u0414\u0440\u0443\u0433\u043E\u0435")))) : isStrokeWidth ? React__default.createElement(MapLegendItems, {
6058
- parameter: parameter,
6059
- isStrokeWidth: true
6060
- }, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
6061
- key: "" + value.title + index,
6062
- title: value.title,
6063
- value: value.parameterValue,
6064
- parameter: parameter,
6065
- isHidden: checkIsHidden(value.hiddenCondition)
6066
- }, (!index || index === currentValues.length - 1) && value.title)), React__default.createElement(MapLegendOther, {
6067
- title: "\u0414\u0440\u0443\u0433\u043E\u0435",
6068
- value: other == null ? void 0 : other.parameterValue,
6069
- parameter: parameter,
6070
- isHidden: checkIsHidden(other == null ? void 0 : other.hiddenCondition)
6071
- }, "\u0414\u0440\u0443\u0433\u043E\u0435")) : React__default.createElement(MapLegendItems, {
6072
- parameter: parameter
6073
- }, React__default.createElement(MapLegendItemsContainer, null, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
6074
- key: "" + value.title + index,
6075
- title: value.title,
6076
- value: value.parameterValue,
6077
- parameter: parameter,
6078
- isHidden: checkIsHidden(value.hiddenCondition)
6079
- }))), React__default.createElement(MapLegendOther, {
6080
- title: "\u0414\u0440\u0443\u0433\u043E\u0435",
6081
- value: other == null ? void 0 : other.parameterValue,
6082
- parameter: parameter,
6083
- isHidden: checkIsHidden(other == null ? void 0 : other.hiddenCondition)
6084
- })), typeof (other == null ? void 0 : other.parameterValue) === "string" && (titleMax || titleMin) && React__default.createElement(MapLegendValues, null, React__default.createElement(MapLegendValuesRange, null, React__default.createElement("div", null, titleMax), React__default.createElement("div", null, titleMin)), React__default.createElement(MapLegendValuesOther, null, "-")));
6085
- };
6086
-
6087
- const useSvgSymbol = (symbol, skipOffset) => {
6018
+ const useSvgSymbol = (symbol, skipOffset, isClassifiedValue) => {
6088
6019
  const SVGWrapperRefElement = React.useRef(null);
6089
6020
  const SVGContainer = React.useMemo(() => svg_js.SVG(), []);
6090
6021
  const initSvg = React.useCallback(() => {
@@ -6095,9 +6026,16 @@ const useSvgSymbol = (symbol, skipOffset) => {
6095
6026
  let {
6096
6027
  svg,
6097
6028
  bg,
6098
- newSymbol
6029
+ newSymbol,
6030
+ isClassifiedValue
6099
6031
  } = _ref;
6100
- manipulateSvgSymbol(SVGContainer, newSymbol || symbol, svg, bg);
6032
+ manipulateSvgSymbol({
6033
+ SVGContainer,
6034
+ symbol: newSymbol || symbol,
6035
+ svg,
6036
+ bg,
6037
+ isClassifiedValue
6038
+ });
6101
6039
  }, [SVGContainer, symbol]);
6102
6040
  const getUpdatedSvgSymbol = React.useCallback((field, value) => {
6103
6041
  var _newSymbol$background;
@@ -6136,7 +6074,8 @@ const useSvgSymbol = (symbol, skipOffset) => {
6136
6074
  manipulateSvg({
6137
6075
  svg: getParameterValue(data),
6138
6076
  newSymbol,
6139
- bg: (_newSymbol$background = newSymbol.background) == null ? void 0 : _newSymbol$background.type
6077
+ bg: (_newSymbol$background = newSymbol.background) == null ? void 0 : _newSymbol$background.type,
6078
+ isClassifiedValue
6140
6079
  });
6141
6080
  return _extends({}, newSymbol, {
6142
6081
  data: SVGContainer.svg()
@@ -6190,9 +6129,10 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
6190
6129
  bg,
6191
6130
  symbol,
6192
6131
  title,
6193
- skipOffset,
6194
6132
  text,
6195
6133
  fontSettings,
6134
+ skipOffset,
6135
+ isClassifiedValue,
6196
6136
  onClick
6197
6137
  } = _ref7;
6198
6138
  const {
@@ -6200,7 +6140,7 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
6200
6140
  initSvg,
6201
6141
  getSvgData,
6202
6142
  manipulateSvg
6203
- } = useSvgSymbol(symbol, skipOffset);
6143
+ } = useSvgSymbol(symbol, skipOffset, isClassifiedValue);
6204
6144
  const onSelectSymbol = React.useCallback(() => {
6205
6145
  onClick == null ? void 0 : onClick(getSvgData(), _extends({}, symbol, bg ? {
6206
6146
  background: _extends({}, symbol.background, {
@@ -6220,9 +6160,10 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
6220
6160
  manipulateSvg({
6221
6161
  svg,
6222
6162
  bg,
6223
- newSymbol: symbol
6163
+ newSymbol: symbol,
6164
+ isClassifiedValue
6224
6165
  });
6225
- }, [svg, symbol, bg, manipulateSvg]);
6166
+ }, [svg, symbol, bg, manipulateSvg, isClassifiedValue]);
6226
6167
  return text ? React__default.createElement(SvgSymbolContainer, null, renderSymbol, React__default.createElement(SvgSymbolLabel, {
6227
6168
  fontSettings: fontSettings
6228
6169
  }, text), !!(fontSettings != null && fontSettings.haloColor) && !!(fontSettings != null && fontSettings.haloWidth) && React__default.createElement(SvgSymbolLabel, {
@@ -6233,41 +6174,19 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
6233
6174
  }, text)) : renderSymbol;
6234
6175
  });
6235
6176
 
6236
- const SymbolByType = _ref => {
6237
- let {
6238
- type,
6239
- symbol,
6240
- size,
6241
- svg,
6242
- skipOffset
6243
- } = _ref;
6244
- const defaultSymbol = React.useMemo(() => React__default.createElement(Symbol, {
6245
- symbol: symbol,
6246
- size: size
6247
- }), [symbol, size]);
6248
-
6249
- switch (type) {
6250
- case "svgPointSymbol":
6251
- return svg ? React__default.createElement(SvgSymbol, {
6252
- svg: svg,
6253
- size: size,
6254
- skipOffset: skipOffset,
6255
- symbol: serializeSvgPointSymbol(symbol)
6256
- }) : defaultSymbol;
6257
-
6258
- default:
6259
- return defaultSymbol;
6260
- }
6261
- };
6262
-
6263
6177
  const ClusterSymbolPreview = _ref => {
6264
- var _symbol$labelSymbol;
6178
+ var _symbol$fillColor$val, _symbol$labelSymbol;
6265
6179
 
6266
6180
  let {
6267
6181
  symbol,
6182
+ index,
6268
6183
  size = 56,
6269
6184
  fontSize = '1.25rem'
6270
6185
  } = _ref;
6186
+ const isClassified = isParameterByAttribute(symbol.fillColor);
6187
+ const isClassifiedValue = isClassified && index !== undefined;
6188
+ const fillColor = isClassifiedValue ? ((_symbol$fillColor$val = symbol.fillColor.values[index]) == null ? void 0 : _symbol$fillColor$val.value) || symbol.fillColor.defaultValue : symbol.fillColor;
6189
+ const strokeColor = isClassified ? fillColor : symbol.strokeColor;
6271
6190
  const svgSymbol = {
6272
6191
  type: 'svgPointSymbol',
6273
6192
  size,
@@ -6275,8 +6194,8 @@ const ClusterSymbolPreview = _ref => {
6275
6194
  angle: 0,
6276
6195
  background: {
6277
6196
  id: 'symbol-bg',
6278
- fillColor: getParameterValue(symbol.fillColor),
6279
- strokeColor: symbol.strokeColor,
6197
+ fillColor,
6198
+ strokeColor,
6280
6199
  strokeWidth: 6,
6281
6200
  type: 'circle'
6282
6201
  }
@@ -6284,6 +6203,7 @@ const ClusterSymbolPreview = _ref => {
6284
6203
  return React__default.createElement(SvgSymbol, {
6285
6204
  svg: DEFAULT_CLUSTER_SVG,
6286
6205
  symbol: svgSymbol,
6206
+ isClassifiedValue: isClassifiedValue,
6287
6207
  text: '99',
6288
6208
  fontSettings: _extends({}, symbol.labelSymbol, {
6289
6209
  fontSize: fontSize || ((_symbol$labelSymbol = symbol.labelSymbol) == null ? void 0 : _symbol$labelSymbol.fontSize)
@@ -6291,14 +6211,43 @@ const ClusterSymbolPreview = _ref => {
6291
6211
  });
6292
6212
  };
6293
6213
 
6214
+ const SymbolByType = _ref => {
6215
+ let {
6216
+ type,
6217
+ symbol,
6218
+ size,
6219
+ svg,
6220
+ skipOffset
6221
+ } = _ref;
6222
+ const defaultSymbol = React.useMemo(() => React__default.createElement(Symbol, {
6223
+ symbol: symbol,
6224
+ size: size
6225
+ }), [symbol, size]);
6226
+
6227
+ switch (type) {
6228
+ case "svgPointSymbol":
6229
+ return svg ? React__default.createElement(SvgSymbol, {
6230
+ svg: svg,
6231
+ size: size,
6232
+ skipOffset: skipOffset,
6233
+ symbol: serializeSvgPointSymbol(symbol)
6234
+ }) : defaultSymbol;
6235
+
6236
+ default:
6237
+ return defaultSymbol;
6238
+ }
6239
+ };
6240
+
6294
6241
  const LegendSymbolRenderer = /*#__PURE__*/React.memo(_ref => {
6295
6242
  let {
6296
- symbol
6243
+ symbol,
6244
+ index
6297
6245
  } = _ref;
6298
6246
 
6299
6247
  if (isClusterSymbol(symbol)) {
6300
6248
  return React__default.createElement(ClusterLegendContainer, null, React__default.createElement(ClusterSymbolPreview, {
6301
- symbol: symbol
6249
+ symbol: symbol,
6250
+ index: index
6302
6251
  }));
6303
6252
  }
6304
6253
 
@@ -6311,6 +6260,31 @@ const LegendSymbolRenderer = /*#__PURE__*/React.memo(_ref => {
6311
6260
  });
6312
6261
  });
6313
6262
 
6263
+ const getConditionAttribute = (attributes, condition) => {
6264
+ if (!condition) return null;
6265
+ const attributeName = getAttributeNameFromCondition(condition);
6266
+ let attribute = attributes.find(_ref => {
6267
+ let {
6268
+ name
6269
+ } = _ref;
6270
+ return name === attributeName;
6271
+ });
6272
+
6273
+ if (!attribute) {
6274
+ if (attributeName === 'count') {
6275
+ attribute = {
6276
+ name: 'count',
6277
+ alias: 'Количество',
6278
+ type: api.AttributeType.Int32
6279
+ };
6280
+ } else {
6281
+ return null;
6282
+ }
6283
+ }
6284
+
6285
+ return attribute;
6286
+ };
6287
+
6314
6288
  const isHiddenLegend = (hiddenCondition, hiddenLegends) => !!(hiddenLegends != null && hiddenLegends.includes(hiddenCondition));
6315
6289
 
6316
6290
  const renderColumn = (column, index) => {
@@ -6351,6 +6325,134 @@ const getLegendText = _ref => {
6351
6325
  return React__default.createElement(React__default.Fragment, null, columns.map(renderColumn));
6352
6326
  };
6353
6327
 
6328
+ const LegendChildren = _ref => {
6329
+ var _layerInfo$style, _layerInfo$style$chil;
6330
+
6331
+ let {
6332
+ layerInfo,
6333
+ hiddenLegends,
6334
+ toggleHiddenLegend,
6335
+ formatValue
6336
+ } = _ref;
6337
+ if (!((_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length)) return null;
6338
+ const attributes = getLayerAttributes(layerInfo.layerDefinition);
6339
+ return React__default.createElement(MapLegendContainer, null, layerInfo.style.children.map((paramValue, index) => {
6340
+ var _getConditionAttribut;
6341
+
6342
+ const attribute = getConditionAttribute(attributes, paramValue.condition);
6343
+ if (!attribute) return null;
6344
+ const hiddenCondition = createHiddenCondition(attribute.name, attribute.type, getClassificationValue(paramValue.symbol, paramValue.title, new ClassificationCondition(paramValue.condition)));
6345
+ const legendText = getLegendText({
6346
+ title: isRangeCondition(paramValue.condition) ? createValueTitleFromCondition(paramValue, attribute, formatValue, index) : getTitleFromCondition({
6347
+ condition: paramValue.condition,
6348
+ attribute,
6349
+ formatValue
6350
+ }),
6351
+ index,
6352
+ isDate: ((_getConditionAttribut = getConditionAttribute(attributes, paramValue.condition)) == null ? void 0 : _getConditionAttribut.type) === 'DateTime'
6353
+ });
6354
+ return React__default.createElement(ClassifiedItem, {
6355
+ key: index,
6356
+ isHidden: isHiddenLegend(hiddenCondition, hiddenLegends == null ? void 0 : hiddenLegends[layerInfo.name]),
6357
+ onClick: () => toggleHiddenLegend == null ? void 0 : toggleHiddenLegend(layerInfo.name, hiddenCondition)
6358
+ }, React__default.createElement(SymbolContainer, null, React__default.createElement(LegendSymbolRenderer, {
6359
+ symbol: paramValue.symbol
6360
+ })), legendText);
6361
+ }));
6362
+ };
6363
+
6364
+ const LegendParameterDescription = _ref => {
6365
+ let {
6366
+ parameter
6367
+ } = _ref;
6368
+ const isSize = isParameterType("size", parameter);
6369
+ const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
6370
+ const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
6371
+ return React__default.createElement(MapLegendDescriptionContainer, null, isStrokeWidth || isStrokeColor ? isStrokeWidth ? "Толщина обводки" : "Цвет обводки" : isSize ? "Размер знака" : "Цвет символа");
6372
+ };
6373
+
6374
+ const getValueFromLegendTitle = (title, minOrMax) => {
6375
+ if (title.includes(" - ")) {
6376
+ const result = title == null ? void 0 : title.split(" - ");
6377
+ return minOrMax === "min" ? result == null ? void 0 : result[0] : result == null ? void 0 : result[1];
6378
+ }
6379
+
6380
+ if (title.includes(",")) {
6381
+ const result = title == null ? void 0 : title.split(",");
6382
+ return result.join(", ");
6383
+ }
6384
+
6385
+ return title.split(" ").find(isNumeric) || title || "";
6386
+ };
6387
+
6388
+ const MinimizedLegend = _ref => {
6389
+ var _currentValues$, _currentValues, _currentValues$2, _currentValues2;
6390
+
6391
+ let {
6392
+ innerRef,
6393
+ isShown,
6394
+ values,
6395
+ title,
6396
+ parameter,
6397
+ hiddenLegends
6398
+ } = _ref;
6399
+ const currentValues = [...values];
6400
+ const other = currentValues.pop();
6401
+ const isSize = isParameterType("size", parameter);
6402
+ const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
6403
+ const titleMax = getValueFromLegendTitle((_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title, "max");
6404
+ const titleMin = getValueFromLegendTitle((_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title, "min");
6405
+ const checkIsHidden = React.useCallback(hiddenCondition => hiddenCondition ? hiddenLegends == null ? void 0 : hiddenLegends.some(condition => hiddenCondition.includes(condition)) : false, [hiddenLegends]);
6406
+ return React__default.createElement(MinimizedLegendContainer, {
6407
+ ref: innerRef,
6408
+ isShown: isShown
6409
+ }, !!title && React__default.createElement(MapLegendValueDescr, null, title), isSize ? React__default.createElement(React__default.Fragment, null, React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendItems, {
6410
+ parameter: parameter,
6411
+ isSize: true
6412
+ }, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
6413
+ key: "" + value.title + index,
6414
+ title: value.title,
6415
+ value: value.parameterValue,
6416
+ parameter: parameter,
6417
+ isHidden: checkIsHidden(value.hiddenCondition)
6418
+ })))), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendDown, null, (_currentValues$2 = currentValues[0]) == null ? void 0 : _currentValues$2.title), React__default.createElement(SizeMinimizedLegendUp, null, (_currentValues2 = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues2.title))), React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendItems, {
6419
+ parameter: parameter,
6420
+ isSize: true
6421
+ }, React__default.createElement(MapLegendOther, {
6422
+ title: "\u0414\u0440\u0443\u0433\u043E\u0435",
6423
+ value: other == null ? void 0 : other.parameterValue,
6424
+ parameter: parameter,
6425
+ isHidden: checkIsHidden(other == null ? void 0 : other.hiddenCondition)
6426
+ }))), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendUp, null, "\u0414\u0440\u0443\u0433\u043E\u0435")))) : isStrokeWidth ? React__default.createElement(MapLegendItems, {
6427
+ parameter: parameter,
6428
+ isStrokeWidth: true
6429
+ }, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
6430
+ key: "" + value.title + index,
6431
+ title: value.title,
6432
+ value: value.parameterValue,
6433
+ parameter: parameter,
6434
+ isHidden: checkIsHidden(value.hiddenCondition)
6435
+ }, (!index || index === currentValues.length - 1) && value.title)), React__default.createElement(MapLegendOther, {
6436
+ title: "\u0414\u0440\u0443\u0433\u043E\u0435",
6437
+ value: other == null ? void 0 : other.parameterValue,
6438
+ parameter: parameter,
6439
+ isHidden: checkIsHidden(other == null ? void 0 : other.hiddenCondition)
6440
+ }, "\u0414\u0440\u0443\u0433\u043E\u0435")) : React__default.createElement(MapLegendItems, {
6441
+ parameter: parameter
6442
+ }, React__default.createElement(MapLegendItemsContainer, null, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
6443
+ key: "" + value.title + index,
6444
+ title: value.title,
6445
+ value: value.parameterValue,
6446
+ parameter: parameter,
6447
+ isHidden: checkIsHidden(value.hiddenCondition)
6448
+ }))), React__default.createElement(MapLegendOther, {
6449
+ title: "\u0414\u0440\u0443\u0433\u043E\u0435",
6450
+ value: other == null ? void 0 : other.parameterValue,
6451
+ parameter: parameter,
6452
+ isHidden: checkIsHidden(other == null ? void 0 : other.hiddenCondition)
6453
+ })), typeof (other == null ? void 0 : other.parameterValue) === "string" && (titleMax || titleMin) && React__default.createElement(MapLegendValues, null, React__default.createElement(MapLegendValuesRange, null, React__default.createElement("div", null, titleMax), React__default.createElement("div", null, titleMin)), React__default.createElement(MapLegendValuesOther, null, "-")));
6454
+ };
6455
+
6354
6456
  const MaximizedLegend = _ref => {
6355
6457
  let {
6356
6458
  innerRef,
@@ -6396,29 +6498,20 @@ const MaximizedLegend = _ref => {
6396
6498
  value: (parameterValue == null ? void 0 : (_parameterValue$value = parameterValue.values[(parameterValue == null ? void 0 : parameterValue.values.length) - index - 1]) == null ? void 0 : _parameterValue$value.value) || (parameterValue == null ? void 0 : parameterValue.defaultValue),
6397
6499
  parameter: parameter
6398
6500
  })) : React__default.createElement(SymbolContainer, null, React__default.createElement(LegendSymbolRenderer, {
6399
- symbol: isClusterFillColor$1 ? symbol : getExtractedSymbol(symbol, true)
6501
+ index: index,
6502
+ symbol: isClusterFillColor$1 ? sectionSymbol : getExtractedSymbol(symbol, true)
6400
6503
  })), getLegendText({
6401
6504
  title,
6402
6505
  index,
6403
6506
  isDate
6404
6507
  }));
6405
- }, [parameter, sectionIndex, hiddenLegends, isSize, isStrokeWidth, isStrokeColor, parameterValue, isDate, toggleHiddenLegend, layerName]);
6508
+ }, [parameter, sectionIndex, hiddenLegends, isSize, isStrokeWidth, isStrokeColor, parameterValue, sectionSymbol, isDate, toggleHiddenLegend, layerName]);
6406
6509
  return React__default.createElement(MaximizedLegendContainer, {
6407
6510
  ref: innerRef,
6408
6511
  isShown: isShown
6409
6512
  }, values.map(renderLegend));
6410
6513
  };
6411
6514
 
6412
- const LegendParameterDescription = _ref => {
6413
- let {
6414
- parameter
6415
- } = _ref;
6416
- const isSize = isParameterType("size", parameter);
6417
- const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
6418
- const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
6419
- return React__default.createElement(MapLegendDescriptionContainer, null, isStrokeWidth || isStrokeColor ? isStrokeWidth ? "Толщина обводки" : "Цвет обводки" : isSize ? "Размер знака" : "Цвет символа");
6420
- };
6421
-
6422
6515
  const LegendSection = _ref => {
6423
6516
  let {
6424
6517
  layerName,
@@ -6464,67 +6557,6 @@ const LegendSection = _ref => {
6464
6557
  }, isExpanded ? 'Свернуть' : 'Развернуть'));
6465
6558
  };
6466
6559
 
6467
- const getConditionAttribute = (attributes, condition) => {
6468
- if (!condition) return null;
6469
- const attributeName = getAttributeNameFromCondition(condition);
6470
- let attribute = attributes.find(_ref => {
6471
- let {
6472
- name
6473
- } = _ref;
6474
- return name === attributeName;
6475
- });
6476
-
6477
- if (!attribute) {
6478
- if (attributeName === 'count') {
6479
- attribute = {
6480
- name: 'count',
6481
- alias: 'Количество',
6482
- type: api.AttributeType.Int32
6483
- };
6484
- } else {
6485
- return null;
6486
- }
6487
- }
6488
-
6489
- return attribute;
6490
- };
6491
-
6492
- const LegendChildren = _ref => {
6493
- var _layerInfo$style, _layerInfo$style$chil;
6494
-
6495
- let {
6496
- layerInfo,
6497
- hiddenLegends,
6498
- toggleHiddenLegend,
6499
- formatValue
6500
- } = _ref;
6501
- if (!((_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length)) return null;
6502
- const attributes = getLayerAttributes(layerInfo.layerDefinition);
6503
- return React__default.createElement(MapLegendContainer, null, layerInfo.style.children.map((paramValue, index) => {
6504
- var _getConditionAttribut;
6505
-
6506
- const attribute = getConditionAttribute(attributes, paramValue.condition);
6507
- if (!attribute) return null;
6508
- const hiddenCondition = createHiddenCondition(attribute.name, attribute.type, getClassificationValue(paramValue.symbol, paramValue.title, new ClassificationCondition(paramValue.condition)));
6509
- const legendText = getLegendText({
6510
- title: isRangeCondition(paramValue.condition) ? createValueTitleFromCondition(paramValue, attribute, formatValue, index) : getTitleFromCondition({
6511
- condition: paramValue.condition,
6512
- attribute,
6513
- formatValue
6514
- }),
6515
- index,
6516
- isDate: ((_getConditionAttribut = getConditionAttribute(attributes, paramValue.condition)) == null ? void 0 : _getConditionAttribut.type) === 'DateTime'
6517
- });
6518
- return React__default.createElement(ClassifiedItem, {
6519
- key: index,
6520
- isHidden: isHiddenLegend(hiddenCondition, hiddenLegends == null ? void 0 : hiddenLegends[layerInfo.name]),
6521
- onClick: () => toggleHiddenLegend == null ? void 0 : toggleHiddenLegend(layerInfo.name, hiddenCondition)
6522
- }, React__default.createElement(SymbolContainer, null, React__default.createElement(LegendSymbolRenderer, {
6523
- symbol: paramValue.symbol
6524
- })), legendText);
6525
- }));
6526
- };
6527
-
6528
6560
  const _excluded$3 = ["layerInfo", "formatValue", "hiddenLegends", "toggleHiddenLegend"];
6529
6561
  const Legend = /*#__PURE__*/React.memo(_ref => {
6530
6562
  var _layerInfo$style, _layerInfo$style$chil;
@@ -6987,6 +7019,7 @@ exports.ClassifiedItem = ClassifiedItem;
6987
7019
  exports.ClusterLayer = ClusterLayer;
6988
7020
  exports.ClusterLegendContainer = ClusterLegendContainer;
6989
7021
  exports.ClusterSymbol = ClusterSymbol;
7022
+ exports.ClusterSymbolPreview = ClusterSymbolPreview;
6990
7023
  exports.CompoundIcon = CompoundIcon;
6991
7024
  exports.DEFAULT_CLUSTER_SVG = DEFAULT_CLUSTER_SVG;
6992
7025
  exports.DEFAULT_CRS = DEFAULT_CRS;
@@ -7037,6 +7070,7 @@ exports.ItemSeparator = ItemSeparator;
7037
7070
  exports.ItemText = ItemText;
7038
7071
  exports.LabelSymbol = LabelSymbol;
7039
7072
  exports.Legend = Legend;
7073
+ exports.LegendChildren = LegendChildren;
7040
7074
  exports.LegendParameterDescription = LegendParameterDescription;
7041
7075
  exports.LegendProvider = LegendProvider;
7042
7076
  exports.LegendSection = LegendSection;