@evergis/react 2.0.198 → 2.0.200

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,15 +2,15 @@
2
2
  import { Color } from '@evergis/color/es/Color';
3
3
  import { SvgPointSymbol } from '../../../core';
4
4
  import { SvgEditorField, SvgSymbolBg } from '../types';
5
- export declare const useSvgSymbol: (symbol: SvgPointSymbol, skipOffset?: boolean | undefined, isClassifiedValue?: boolean | undefined) => {
5
+ export declare const useSvgSymbol: (symbol: SvgPointSymbol, skipOffset?: boolean | undefined, isClassified?: boolean | undefined) => {
6
6
  svgRef: import("react").MutableRefObject<HTMLElement | null>;
7
7
  initSvg: () => void;
8
8
  getSvgData: () => string;
9
- manipulateSvg: ({ svg, bg, newSymbol, isClassifiedValue, }: {
9
+ manipulateSvg: ({ svg, bg, newSymbol, isClassified, }: {
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
+ isClassified?: boolean | undefined;
14
14
  }) => void;
15
15
  getUpdatedSvgSymbol: (field: keyof SvgEditorField, value: Color | number | string) => any;
16
16
  };
@@ -71,7 +71,7 @@ export declare type SvgSymbolProps = {
71
71
  text?: string;
72
72
  bg?: SvgSymbolBg;
73
73
  skipOffset?: boolean;
74
- isClassifiedValue?: boolean;
74
+ isClassified?: boolean;
75
75
  fontSettings?: PointLabelSymbolDc;
76
76
  onClick?: (svg: string, symbol: SvgPointSymbol) => void;
77
77
  };
@@ -3223,6 +3223,7 @@ const textComparisonOperators = [...BASE_OPERATORS, ...CONTAINS_OPERATORS, ...ST
3223
3223
  SvgSymbolBg["Circle"] = "circle";
3224
3224
  })(exports.SvgSymbolBg || (exports.SvgSymbolBg = {}));
3225
3225
 
3226
+ const DEFAULT_STROKE_OPACITY = 0.28;
3226
3227
  const convertSvgToBase64 = svg => "data:image/svg+xml;base64," + window.btoa(svg);
3227
3228
  const createSvgGradient = (svg, values) => svg.gradient('linear', add => {
3228
3229
  values == null ? void 0 : values.forEach((_ref, index) => {
@@ -3241,7 +3242,7 @@ const manipulateSvgSymbol = _ref2 => {
3241
3242
  symbol,
3242
3243
  svg,
3243
3244
  bg,
3244
- isClassifiedValue
3245
+ isClassified
3245
3246
  } = _ref2;
3246
3247
  if (!symbol) return SVGContainer;
3247
3248
  const symbolData = getParameterValue(svg || symbol.data);
@@ -3292,9 +3293,9 @@ const manipulateSvgSymbol = _ref2 => {
3292
3293
  SVGContainer.find(':not(#symbol-bg)').each(item => item.center(DEFAULT_SYMBOL_WITH_BG_SIZE / 2, DEFAULT_SYMBOL_WITH_BG_SIZE / 2).fill('white'));
3293
3294
  const symbolBg = SVGContainer.find('#symbol-bg')[0];
3294
3295
 
3295
- if (isClassifiedValue) {
3296
+ if (isClassified) {
3296
3297
  symbolBg == null ? void 0 : symbolBg.stroke({
3297
- opacity: 0.28
3298
+ opacity: DEFAULT_STROKE_OPACITY
3298
3299
  });
3299
3300
  } // eslint-disable-next-line max-depth
3300
3301
 
@@ -3302,15 +3303,15 @@ const manipulateSvgSymbol = _ref2 => {
3302
3303
  if (isParameterByAttribute(background == null ? void 0 : background.fillColor)) {
3303
3304
  var _background$fillColor;
3304
3305
 
3305
- const gradient = createSvgGradient(SVGContainer, background == null ? void 0 : (_background$fillColor = background.fillColor) == null ? void 0 : _background$fillColor.values);
3306
- symbolBg == null ? void 0 : symbolBg.fill(gradient);
3306
+ symbolBg == null ? void 0 : symbolBg.fill(createSvgGradient(SVGContainer, background == null ? void 0 : (_background$fillColor = background.fillColor) == null ? void 0 : _background$fillColor.values));
3307
+ }
3307
3308
 
3308
- if (isParameterByAttribute(background == null ? void 0 : background.strokeColor)) {
3309
- symbolBg == null ? void 0 : symbolBg.stroke({
3310
- color: gradient,
3311
- opacity: 0.28
3312
- });
3313
- }
3309
+ if (isParameterByAttribute(background == null ? void 0 : background.strokeColor)) {
3310
+ var _background$strokeCol;
3311
+
3312
+ symbolBg == null ? void 0 : symbolBg.stroke({
3313
+ color: createSvgGradient(SVGContainer, background == null ? void 0 : (_background$strokeCol = background.strokeColor) == null ? void 0 : _background$strokeCol.values)
3314
+ });
3314
3315
  }
3315
3316
  } else {
3316
3317
  SVGContainer.svg(innerSvg);
@@ -3326,6 +3327,20 @@ const manipulateSvgSymbol = _ref2 => {
3326
3327
  color: strokeColor,
3327
3328
  width: strokeWidth
3328
3329
  });
3330
+
3331
+ if (isParameterByAttribute(figure == null ? void 0 : figure.fillColor)) {
3332
+ var _figure$fillColor;
3333
+
3334
+ item == null ? void 0 : item.fill(createSvgGradient(SVGContainer, figure == null ? void 0 : (_figure$fillColor = figure.fillColor) == null ? void 0 : _figure$fillColor.values));
3335
+ }
3336
+
3337
+ if (isParameterByAttribute(figure == null ? void 0 : figure.strokeColor)) {
3338
+ var _figure$strokeColor;
3339
+
3340
+ item == null ? void 0 : item.stroke({
3341
+ color: createSvgGradient(SVGContainer, figure == null ? void 0 : (_figure$strokeColor = figure.strokeColor) == null ? void 0 : _figure$strokeColor.values)
3342
+ });
3343
+ }
3329
3344
  });
3330
3345
  }
3331
3346
  }
@@ -6030,7 +6045,7 @@ const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templ
6030
6045
  const MapLegendExpandButton = /*#__PURE__*/styled__default.div(_templateObject37 || (_templateObject37 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin-top: 0.1rem;\n font-size: 0.625rem;\n color: #1fb3aa;\n"])));
6031
6046
  const ClusterLegendContainer = /*#__PURE__*/styled__default.div(_templateObject38 || (_templateObject38 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: -0.9rem;\n transform: scale(0.5);\n"])));
6032
6047
 
6033
- const useSvgSymbol = (symbol, skipOffset, isClassifiedValue) => {
6048
+ const useSvgSymbol = (symbol, skipOffset, isClassified) => {
6034
6049
  const SVGWrapperRefElement = React.useRef(null);
6035
6050
  const SVGContainer = React.useMemo(() => svg_js.SVG(), []);
6036
6051
  const initSvg = React.useCallback(() => {
@@ -6042,14 +6057,14 @@ const useSvgSymbol = (symbol, skipOffset, isClassifiedValue) => {
6042
6057
  svg,
6043
6058
  bg,
6044
6059
  newSymbol,
6045
- isClassifiedValue
6060
+ isClassified
6046
6061
  } = _ref;
6047
6062
  manipulateSvgSymbol({
6048
6063
  SVGContainer,
6049
6064
  symbol: newSymbol || symbol,
6050
6065
  svg,
6051
6066
  bg,
6052
- isClassifiedValue
6067
+ isClassified
6053
6068
  });
6054
6069
  }, [SVGContainer, symbol]);
6055
6070
  const getUpdatedSvgSymbol = React.useCallback((field, value) => {
@@ -6090,7 +6105,7 @@ const useSvgSymbol = (symbol, skipOffset, isClassifiedValue) => {
6090
6105
  svg: getParameterValue(data),
6091
6106
  newSymbol,
6092
6107
  bg: (_newSymbol$background = newSymbol.background) == null ? void 0 : _newSymbol$background.type,
6093
- isClassifiedValue
6108
+ isClassified
6094
6109
  });
6095
6110
  return _extends({}, newSymbol, {
6096
6111
  data: SVGContainer.svg()
@@ -6147,7 +6162,7 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
6147
6162
  text,
6148
6163
  fontSettings,
6149
6164
  skipOffset,
6150
- isClassifiedValue,
6165
+ isClassified,
6151
6166
  onClick
6152
6167
  } = _ref7;
6153
6168
  const {
@@ -6155,7 +6170,7 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
6155
6170
  initSvg,
6156
6171
  getSvgData,
6157
6172
  manipulateSvg
6158
- } = useSvgSymbol(symbol, skipOffset, isClassifiedValue);
6173
+ } = useSvgSymbol(symbol, skipOffset, isClassified);
6159
6174
  const onSelectSymbol = React.useCallback(() => {
6160
6175
  onClick == null ? void 0 : onClick(getSvgData(), _extends({}, symbol, bg ? {
6161
6176
  background: _extends({}, symbol.background, {
@@ -6176,9 +6191,9 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
6176
6191
  svg,
6177
6192
  bg,
6178
6193
  newSymbol: symbol,
6179
- isClassifiedValue
6194
+ isClassified
6180
6195
  });
6181
- }, [svg, symbol, bg, manipulateSvg, isClassifiedValue]);
6196
+ }, [svg, symbol, bg, manipulateSvg, isClassified]);
6182
6197
  return text ? React__default.createElement(SvgSymbolContainer, null, renderSymbol, React__default.createElement(SvgSymbolLabel, {
6183
6198
  fontSettings: fontSettings
6184
6199
  }, text), !!(fontSettings != null && fontSettings.haloColor) && !!(fontSettings != null && fontSettings.haloWidth) && React__default.createElement(SvgSymbolLabel, {
@@ -6218,7 +6233,7 @@ const ClusterSymbolPreview = _ref => {
6218
6233
  return React__default.createElement(SvgSymbol, {
6219
6234
  svg: DEFAULT_CLUSTER_SVG,
6220
6235
  symbol: svgSymbol,
6221
- isClassifiedValue: isClassifiedValue,
6236
+ isClassified: isClassified,
6222
6237
  text: '99',
6223
6238
  fontSettings: _extends({}, symbol.labelSymbol, {
6224
6239
  fontSize: fontSize || ((_symbol$labelSymbol = symbol.labelSymbol) == null ? void 0 : _symbol$labelSymbol.fontSize)