@evergis/react 2.0.193 → 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.
@@ -2592,7 +2592,7 @@ const getTitleFromCondition = _ref2 => {
2592
2592
  } = _ref2;
2593
2593
  const parts = condition == null ? void 0 : condition.split(' == ');
2594
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) : '';
2595
+ return attribute && formatValue ? formatValue(attribute.type, uniqueValue, attribute.stringFormat) : uniqueValue;
2596
2596
  };
2597
2597
  function createValueTitleFromCondition(paramValue, attribute, formatValue, index) {
2598
2598
  if (!attribute) return '';
@@ -3222,7 +3222,7 @@ const textComparisonOperators = [...BASE_OPERATORS, ...CONTAINS_OPERATORS, ...ST
3222
3222
  })(exports.SvgSymbolBg || (exports.SvgSymbolBg = {}));
3223
3223
 
3224
3224
  const convertSvgToBase64 = svg => "data:image/svg+xml;base64," + window.btoa(svg);
3225
- const createSvgGradient = (svg, values) => svg.gradient("linear", add => {
3225
+ const createSvgGradient = (svg, values) => svg.gradient('linear', add => {
3226
3226
  values == null ? void 0 : values.forEach((_ref, index) => {
3227
3227
  let {
3228
3228
  value
@@ -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;
@@ -3244,8 +3251,8 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
3244
3251
  background,
3245
3252
  figure
3246
3253
  } = symbol;
3247
- const isUploadedFile = !bg && !symbolData.includes("symbol-bg") && !symbolData.includes("symbol-figure");
3248
- const innerSvg = symbolData.replace(/<\?xml[^?]*\?>|<svg[^>]*>|<\/svg>/g, "");
3254
+ const isUploadedFile = !bg && !symbolData.includes('symbol-bg') && !symbolData.includes('symbol-figure');
3255
+ const innerSvg = symbolData.replace(/<\?xml[^?]*\?>|<svg[^>]*>|<\/svg>/g, '');
3249
3256
 
3250
3257
  if (isUploadedFile) {
3251
3258
  var _$exec;
@@ -3259,11 +3266,11 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
3259
3266
 
3260
3267
  SVGContainer.size(size);
3261
3268
  } else {
3262
- const hasBg = bg || (innerSvg == null ? void 0 : innerSvg.includes("symbol-bg"));
3269
+ const hasBg = bg || (innerSvg == null ? void 0 : innerSvg.includes('symbol-bg'));
3263
3270
  let defaultSize = hasBg ? DEFAULT_SYMBOL_WITH_BG_SIZE : DEFAULT_SYMBOL_SIZE;
3264
3271
  const currentSize = size || defaultSize;
3265
3272
  let viewBox = [0, 0, defaultSize, defaultSize];
3266
- const strokeWidth = getParameterValue(background == null ? void 0 : background.strokeWidth) || (typeof (background == null ? void 0 : background.strokeColor) === "object" ? 1 : 0);
3273
+ const strokeWidth = getParameterValue(background == null ? void 0 : background.strokeWidth) || (typeof (background == null ? void 0 : background.strokeColor) === 'object' ? 1 : 0);
3267
3274
 
3268
3275
  if (strokeWidth) {
3269
3276
  defaultSize += strokeWidth;
@@ -3271,7 +3278,7 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
3271
3278
  }
3272
3279
 
3273
3280
  if (hasBg) {
3274
- SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(" "));
3281
+ SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(' '));
3275
3282
  const currentBg = bg || (background == null ? void 0 : background.type);
3276
3283
 
3277
3284
  if (currentBg) {
@@ -3279,23 +3286,38 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
3279
3286
  const fillColor = getParameterValue(background == null ? void 0 : background.fillColor);
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
- 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
3289
+ SVGContainer.find('#symbol-bg:not(:first-child)').each(item => item.remove());
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);
3305
+
3306
+ if (isParameterByAttribute(background == null ? void 0 : background.strokeColor)) {
3307
+ symbolBg == null ? void 0 : symbolBg.stroke({
3308
+ color: gradient,
3309
+ opacity: 0.28
3310
+ });
3311
+ }
3290
3312
  }
3291
3313
  } else {
3292
3314
  SVGContainer.svg(innerSvg);
3293
3315
  }
3294
3316
  } else {
3295
3317
  const fillColor = getParameterValue(figure == null ? void 0 : figure.fillColor);
3296
- SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(" "));
3318
+ SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(' '));
3297
3319
  SVGContainer.svg(innerSvg);
3298
- SVGContainer.find("#symbol-figure").each(item => {
3320
+ SVGContainer.find('#symbol-figure').each(item => {
3299
3321
  item.center(DEFAULT_SYMBOL_SIZE / 2, DEFAULT_SYMBOL_SIZE / 2).fill(fillColor || DEFAULT_SYMBOL_FILL_COLOR);
3300
3322
  });
3301
3323
  }
@@ -3304,13 +3326,13 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
3304
3326
  const rootTransform = (_$exec2 = /<svg[^>]*transform="([^"]+)"/g.exec(symbolData)) == null ? void 0 : _$exec2[1];
3305
3327
 
3306
3328
  if (rootTransform) {
3307
- const transformParts = rootTransform.slice(0, -1).split("(");
3329
+ const transformParts = rootTransform.slice(0, -1).split('(');
3308
3330
  SVGContainer.transform({
3309
- [transformParts[0]]: transformParts[1].split(",")
3331
+ [transformParts[0]]: transformParts[1].split(',')
3310
3332
  });
3311
3333
  }
3312
3334
 
3313
- const rotatedAngle = SVGContainer.transform("rotate");
3335
+ const rotatedAngle = SVGContainer.transform('rotate');
3314
3336
 
3315
3337
  if (rotatedAngle) {
3316
3338
  SVGContainer.rotate(-rotatedAngle, 0, 0);
@@ -5993,89 +6015,7 @@ const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templ
5993
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"])));
5994
6016
  const ClusterLegendContainer = /*#__PURE__*/styled__default.div(_templateObject37 || (_templateObject37 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: -0.9rem;\n transform: scale(0.5);\n"])));
5995
6017
 
5996
- const getValueFromLegendTitle = (title, minOrMax) => {
5997
- if (title.includes(" - ")) {
5998
- const result = title == null ? void 0 : title.split(" - ");
5999
- return minOrMax === "min" ? result == null ? void 0 : result[0] : result == null ? void 0 : result[1];
6000
- }
6001
-
6002
- if (title.includes(",")) {
6003
- const result = title == null ? void 0 : title.split(",");
6004
- return result.join(", ");
6005
- }
6006
-
6007
- return title.split(" ").find(isNumeric) || title || "";
6008
- };
6009
-
6010
- const MinimizedLegend = _ref => {
6011
- var _currentValues$, _currentValues, _currentValues$2, _currentValues2;
6012
-
6013
- let {
6014
- innerRef,
6015
- isShown,
6016
- values,
6017
- title,
6018
- parameter,
6019
- hiddenLegends
6020
- } = _ref;
6021
- const currentValues = [...values];
6022
- const other = currentValues.pop();
6023
- const isSize = isParameterType("size", parameter);
6024
- const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
6025
- const titleMax = getValueFromLegendTitle((_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title, "max");
6026
- const titleMin = getValueFromLegendTitle((_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title, "min");
6027
- const checkIsHidden = React.useCallback(hiddenCondition => hiddenCondition ? hiddenLegends == null ? void 0 : hiddenLegends.some(condition => hiddenCondition.includes(condition)) : false, [hiddenLegends]);
6028
- return React__default.createElement(MinimizedLegendContainer, {
6029
- ref: innerRef,
6030
- isShown: isShown
6031
- }, !!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, {
6032
- parameter: parameter,
6033
- isSize: true
6034
- }, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
6035
- key: "" + value.title + index,
6036
- title: value.title,
6037
- value: value.parameterValue,
6038
- parameter: parameter,
6039
- isHidden: checkIsHidden(value.hiddenCondition)
6040
- })))), 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, {
6041
- parameter: parameter,
6042
- isSize: true
6043
- }, React__default.createElement(MapLegendOther, {
6044
- title: "\u0414\u0440\u0443\u0433\u043E\u0435",
6045
- value: other == null ? void 0 : other.parameterValue,
6046
- parameter: parameter,
6047
- isHidden: checkIsHidden(other == null ? void 0 : other.hiddenCondition)
6048
- }))), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendUp, null, "\u0414\u0440\u0443\u0433\u043E\u0435")))) : isStrokeWidth ? React__default.createElement(MapLegendItems, {
6049
- parameter: parameter,
6050
- isStrokeWidth: true
6051
- }, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
6052
- key: "" + value.title + index,
6053
- title: value.title,
6054
- value: value.parameterValue,
6055
- parameter: parameter,
6056
- isHidden: checkIsHidden(value.hiddenCondition)
6057
- }, (!index || index === currentValues.length - 1) && value.title)), React__default.createElement(MapLegendOther, {
6058
- title: "\u0414\u0440\u0443\u0433\u043E\u0435",
6059
- value: other == null ? void 0 : other.parameterValue,
6060
- parameter: parameter,
6061
- isHidden: checkIsHidden(other == null ? void 0 : other.hiddenCondition)
6062
- }, "\u0414\u0440\u0443\u0433\u043E\u0435")) : React__default.createElement(MapLegendItems, {
6063
- parameter: parameter
6064
- }, React__default.createElement(MapLegendItemsContainer, null, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
6065
- key: "" + value.title + index,
6066
- title: value.title,
6067
- value: value.parameterValue,
6068
- parameter: parameter,
6069
- isHidden: checkIsHidden(value.hiddenCondition)
6070
- }))), React__default.createElement(MapLegendOther, {
6071
- title: "\u0414\u0440\u0443\u0433\u043E\u0435",
6072
- value: other == null ? void 0 : other.parameterValue,
6073
- parameter: parameter,
6074
- isHidden: checkIsHidden(other == null ? void 0 : other.hiddenCondition)
6075
- })), 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, "-")));
6076
- };
6077
-
6078
- const useSvgSymbol = (symbol, skipOffset) => {
6018
+ const useSvgSymbol = (symbol, skipOffset, isClassifiedValue) => {
6079
6019
  const SVGWrapperRefElement = React.useRef(null);
6080
6020
  const SVGContainer = React.useMemo(() => svg_js.SVG(), []);
6081
6021
  const initSvg = React.useCallback(() => {
@@ -6086,9 +6026,16 @@ const useSvgSymbol = (symbol, skipOffset) => {
6086
6026
  let {
6087
6027
  svg,
6088
6028
  bg,
6089
- newSymbol
6029
+ newSymbol,
6030
+ isClassifiedValue
6090
6031
  } = _ref;
6091
- manipulateSvgSymbol(SVGContainer, newSymbol || symbol, svg, bg);
6032
+ manipulateSvgSymbol({
6033
+ SVGContainer,
6034
+ symbol: newSymbol || symbol,
6035
+ svg,
6036
+ bg,
6037
+ isClassifiedValue
6038
+ });
6092
6039
  }, [SVGContainer, symbol]);
6093
6040
  const getUpdatedSvgSymbol = React.useCallback((field, value) => {
6094
6041
  var _newSymbol$background;
@@ -6097,27 +6044,27 @@ const useSvgSymbol = (symbol, skipOffset) => {
6097
6044
  data,
6098
6045
  offset
6099
6046
  } = symbol;
6100
- const newValue = value instanceof Color.Color ? value.toString("rgba") : value;
6047
+ const newValue = value instanceof Color.Color ? value.toString('rgba') : value;
6101
6048
 
6102
6049
  const newSymbol = _extends({}, JSON.parse(JSON.stringify(symbol)), {
6103
6050
  offset: skipOffset ? DEFAULT_SYMBOL_OFFSET : isSizeClassification(field) ? getOffsetParameterValue(offset) : offset
6104
6051
  });
6105
6052
 
6106
- if (field.indexOf(".") !== -1) {
6053
+ if (field.indexOf('.') !== -1) {
6107
6054
  var _newSymbol$parts$;
6108
6055
 
6109
- const parts = field.split(".");
6056
+ const parts = field.split('.');
6110
6057
 
6111
6058
  if ((_newSymbol$parts$ = newSymbol[parts[0]]) != null && _newSymbol$parts$[parts[1]]) {
6112
6059
  newSymbol[parts[0]][parts[1]] = newValue;
6113
6060
  } else {
6114
6061
  newSymbol[parts[0]] = _extends({}, newSymbol[parts[0]], {
6115
6062
  [parts[1]]: newValue
6116
- }, parts[0] === "background" ? {
6063
+ }, parts[0] === 'background' ? {
6117
6064
  type: newSymbol.background.type,
6118
- id: "symbol-bg"
6119
- } : parts[0] === "figure" ? {
6120
- id: "symbol-figure"
6065
+ id: 'symbol-bg'
6066
+ } : parts[0] === 'figure' ? {
6067
+ id: 'symbol-figure'
6121
6068
  } : {});
6122
6069
  }
6123
6070
  } else {
@@ -6127,7 +6074,8 @@ const useSvgSymbol = (symbol, skipOffset) => {
6127
6074
  manipulateSvg({
6128
6075
  svg: getParameterValue(data),
6129
6076
  newSymbol,
6130
- 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
6131
6079
  });
6132
6080
  return _extends({}, newSymbol, {
6133
6081
  data: SVGContainer.svg()
@@ -6181,9 +6129,10 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
6181
6129
  bg,
6182
6130
  symbol,
6183
6131
  title,
6184
- skipOffset,
6185
6132
  text,
6186
6133
  fontSettings,
6134
+ skipOffset,
6135
+ isClassifiedValue,
6187
6136
  onClick
6188
6137
  } = _ref7;
6189
6138
  const {
@@ -6191,7 +6140,7 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
6191
6140
  initSvg,
6192
6141
  getSvgData,
6193
6142
  manipulateSvg
6194
- } = useSvgSymbol(symbol, skipOffset);
6143
+ } = useSvgSymbol(symbol, skipOffset, isClassifiedValue);
6195
6144
  const onSelectSymbol = React.useCallback(() => {
6196
6145
  onClick == null ? void 0 : onClick(getSvgData(), _extends({}, symbol, bg ? {
6197
6146
  background: _extends({}, symbol.background, {
@@ -6211,9 +6160,10 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
6211
6160
  manipulateSvg({
6212
6161
  svg,
6213
6162
  bg,
6214
- newSymbol: symbol
6163
+ newSymbol: symbol,
6164
+ isClassifiedValue
6215
6165
  });
6216
- }, [svg, symbol, bg, manipulateSvg]);
6166
+ }, [svg, symbol, bg, manipulateSvg, isClassifiedValue]);
6217
6167
  return text ? React__default.createElement(SvgSymbolContainer, null, renderSymbol, React__default.createElement(SvgSymbolLabel, {
6218
6168
  fontSettings: fontSettings
6219
6169
  }, text), !!(fontSettings != null && fontSettings.haloColor) && !!(fontSettings != null && fontSettings.haloWidth) && React__default.createElement(SvgSymbolLabel, {
@@ -6224,41 +6174,19 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
6224
6174
  }, text)) : renderSymbol;
6225
6175
  });
6226
6176
 
6227
- const SymbolByType = _ref => {
6228
- let {
6229
- type,
6230
- symbol,
6231
- size,
6232
- svg,
6233
- skipOffset
6234
- } = _ref;
6235
- const defaultSymbol = React.useMemo(() => React__default.createElement(Symbol, {
6236
- symbol: symbol,
6237
- size: size
6238
- }), [symbol, size]);
6239
-
6240
- switch (type) {
6241
- case "svgPointSymbol":
6242
- return svg ? React__default.createElement(SvgSymbol, {
6243
- svg: svg,
6244
- size: size,
6245
- skipOffset: skipOffset,
6246
- symbol: serializeSvgPointSymbol(symbol)
6247
- }) : defaultSymbol;
6248
-
6249
- default:
6250
- return defaultSymbol;
6251
- }
6252
- };
6253
-
6254
6177
  const ClusterSymbolPreview = _ref => {
6255
- var _symbol$labelSymbol;
6178
+ var _symbol$fillColor$val, _symbol$labelSymbol;
6256
6179
 
6257
6180
  let {
6258
6181
  symbol,
6182
+ index,
6259
6183
  size = 56,
6260
6184
  fontSize = '1.25rem'
6261
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;
6262
6190
  const svgSymbol = {
6263
6191
  type: 'svgPointSymbol',
6264
6192
  size,
@@ -6266,8 +6194,8 @@ const ClusterSymbolPreview = _ref => {
6266
6194
  angle: 0,
6267
6195
  background: {
6268
6196
  id: 'symbol-bg',
6269
- fillColor: getParameterValue(symbol.fillColor),
6270
- strokeColor: symbol.strokeColor,
6197
+ fillColor,
6198
+ strokeColor,
6271
6199
  strokeWidth: 6,
6272
6200
  type: 'circle'
6273
6201
  }
@@ -6275,6 +6203,7 @@ const ClusterSymbolPreview = _ref => {
6275
6203
  return React__default.createElement(SvgSymbol, {
6276
6204
  svg: DEFAULT_CLUSTER_SVG,
6277
6205
  symbol: svgSymbol,
6206
+ isClassifiedValue: isClassifiedValue,
6278
6207
  text: '99',
6279
6208
  fontSettings: _extends({}, symbol.labelSymbol, {
6280
6209
  fontSize: fontSize || ((_symbol$labelSymbol = symbol.labelSymbol) == null ? void 0 : _symbol$labelSymbol.fontSize)
@@ -6282,14 +6211,43 @@ const ClusterSymbolPreview = _ref => {
6282
6211
  });
6283
6212
  };
6284
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
+
6285
6241
  const LegendSymbolRenderer = /*#__PURE__*/React.memo(_ref => {
6286
6242
  let {
6287
- symbol
6243
+ symbol,
6244
+ index
6288
6245
  } = _ref;
6289
6246
 
6290
6247
  if (isClusterSymbol(symbol)) {
6291
6248
  return React__default.createElement(ClusterLegendContainer, null, React__default.createElement(ClusterSymbolPreview, {
6292
- symbol: symbol
6249
+ symbol: symbol,
6250
+ index: index
6293
6251
  }));
6294
6252
  }
6295
6253
 
@@ -6302,6 +6260,31 @@ const LegendSymbolRenderer = /*#__PURE__*/React.memo(_ref => {
6302
6260
  });
6303
6261
  });
6304
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
+
6305
6288
  const isHiddenLegend = (hiddenCondition, hiddenLegends) => !!(hiddenLegends != null && hiddenLegends.includes(hiddenCondition));
6306
6289
 
6307
6290
  const renderColumn = (column, index) => {
@@ -6342,6 +6325,134 @@ const getLegendText = _ref => {
6342
6325
  return React__default.createElement(React__default.Fragment, null, columns.map(renderColumn));
6343
6326
  };
6344
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
+
6345
6456
  const MaximizedLegend = _ref => {
6346
6457
  let {
6347
6458
  innerRef,
@@ -6387,29 +6498,20 @@ const MaximizedLegend = _ref => {
6387
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),
6388
6499
  parameter: parameter
6389
6500
  })) : React__default.createElement(SymbolContainer, null, React__default.createElement(LegendSymbolRenderer, {
6390
- symbol: isClusterFillColor$1 ? symbol : getExtractedSymbol(symbol, true)
6501
+ index: index,
6502
+ symbol: isClusterFillColor$1 ? sectionSymbol : getExtractedSymbol(symbol, true)
6391
6503
  })), getLegendText({
6392
6504
  title,
6393
6505
  index,
6394
6506
  isDate
6395
6507
  }));
6396
- }, [parameter, sectionIndex, hiddenLegends, isSize, isStrokeWidth, isStrokeColor, parameterValue, isDate, toggleHiddenLegend, layerName]);
6508
+ }, [parameter, sectionIndex, hiddenLegends, isSize, isStrokeWidth, isStrokeColor, parameterValue, sectionSymbol, isDate, toggleHiddenLegend, layerName]);
6397
6509
  return React__default.createElement(MaximizedLegendContainer, {
6398
6510
  ref: innerRef,
6399
6511
  isShown: isShown
6400
6512
  }, values.map(renderLegend));
6401
6513
  };
6402
6514
 
6403
- const LegendParameterDescription = _ref => {
6404
- let {
6405
- parameter
6406
- } = _ref;
6407
- const isSize = isParameterType("size", parameter);
6408
- const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
6409
- const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
6410
- return React__default.createElement(MapLegendDescriptionContainer, null, isStrokeWidth || isStrokeColor ? isStrokeWidth ? "Толщина обводки" : "Цвет обводки" : isSize ? "Размер знака" : "Цвет символа");
6411
- };
6412
-
6413
6515
  const LegendSection = _ref => {
6414
6516
  let {
6415
6517
  layerName,
@@ -6455,67 +6557,6 @@ const LegendSection = _ref => {
6455
6557
  }, isExpanded ? 'Свернуть' : 'Развернуть'));
6456
6558
  };
6457
6559
 
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
6560
  const _excluded$3 = ["layerInfo", "formatValue", "hiddenLegends", "toggleHiddenLegend"];
6520
6561
  const Legend = /*#__PURE__*/React.memo(_ref => {
6521
6562
  var _layerInfo$style, _layerInfo$style$chil;
@@ -6978,6 +7019,7 @@ exports.ClassifiedItem = ClassifiedItem;
6978
7019
  exports.ClusterLayer = ClusterLayer;
6979
7020
  exports.ClusterLegendContainer = ClusterLegendContainer;
6980
7021
  exports.ClusterSymbol = ClusterSymbol;
7022
+ exports.ClusterSymbolPreview = ClusterSymbolPreview;
6981
7023
  exports.CompoundIcon = CompoundIcon;
6982
7024
  exports.DEFAULT_CLUSTER_SVG = DEFAULT_CLUSTER_SVG;
6983
7025
  exports.DEFAULT_CRS = DEFAULT_CRS;
@@ -7028,6 +7070,7 @@ exports.ItemSeparator = ItemSeparator;
7028
7070
  exports.ItemText = ItemText;
7029
7071
  exports.LabelSymbol = LabelSymbol;
7030
7072
  exports.Legend = Legend;
7073
+ exports.LegendChildren = LegendChildren;
7031
7074
  exports.LegendParameterDescription = LegendParameterDescription;
7032
7075
  exports.LegendProvider = LegendProvider;
7033
7076
  exports.LegendSection = LegendSection;