@evergis/react 2.0.198 → 2.0.201
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/hooks/useSvgSymbol.d.ts +3 -3
- package/dist/components/Legend/types.d.ts +2 -2
- package/dist/react.cjs.development.js +38 -21
- 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 +38 -21
- package/dist/react.esm.js.map +1 -1
- package/dist/utils/svg.d.ts +2 -2
- package/package.json +2 -2
|
@@ -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,
|
|
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,
|
|
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
|
-
|
|
13
|
+
isClassified?: boolean | undefined;
|
|
14
14
|
}) => void;
|
|
15
15
|
getUpdatedSvgSymbol: (field: keyof SvgEditorField, value: Color | number | string) => any;
|
|
16
16
|
};
|
|
@@ -5,7 +5,7 @@ import { H3Symbol } from '@evergis/sgis/es/symbols/H3Symbol';
|
|
|
5
5
|
import { Coordinates } from '@evergis/sgis/es/baseTypes';
|
|
6
6
|
import { ClassificationParameterExtended, LayerAttribute, LegendValueType, ParameterByAttribute, ParameterValueWithSymbol, StyleSymbolType, SvgPointSymbol } from '../../core';
|
|
7
7
|
import { SGisBrushFill, SGisImageFill, SGisPolygonSymbol, SGisPolylineSymbol } from '../../symbols';
|
|
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' | 'figure.strokeColor' | 'figure.strokeWidth' | 'fontColor' | 'haloColor' | 'size' | 'symbol' | 'angle' | 'maskedColor' | 'endingSize' | 'beginningSize' | 'maxObjectCount' | 'gridSize' | 'selectionObjectsLimit' | 'singleObjectSymbol.figure.fillColor' | 'singleObjectSymbol.background.fillColor';
|
|
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' | 'figure.strokeColor' | 'figure.strokeWidth' | 'fontColor' | 'haloColor' | 'size' | 'symbol' | 'angle' | 'maskedColor' | 'endingSize' | 'beginningSize' | 'maxObjectCount' | 'gridSize' | 'selectionObjectsLimit' | 'singleObjectSymbol.figure.fillColor' | 'singleObjectSymbol.figure.strokeColor' | 'singleObjectSymbol.figure.strokeWidth' | 'singleObjectSymbol.background.fillColor' | 'singleObjectSymbol.background.strokeColor' | 'singleObjectSymbol.background.strokeWidth';
|
|
9
9
|
export interface ParameterInfo {
|
|
10
10
|
min: number;
|
|
11
11
|
max: number;
|
|
@@ -71,7 +71,7 @@ export declare type SvgSymbolProps = {
|
|
|
71
71
|
text?: string;
|
|
72
72
|
bg?: SvgSymbolBg;
|
|
73
73
|
skipOffset?: boolean;
|
|
74
|
-
|
|
74
|
+
isClassified?: boolean;
|
|
75
75
|
fontSettings?: PointLabelSymbolDc;
|
|
76
76
|
onClick?: (svg: string, symbol: SvgPointSymbol) => void;
|
|
77
77
|
};
|
|
@@ -3147,7 +3147,7 @@ const DEFAULT_CLUSTER_SVG = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox
|
|
|
3147
3147
|
const SYMBOL_CLASSIFICATION = {
|
|
3148
3148
|
[api.GeometryType.Polygon]: ['fill.color', 'stroke.color', 'stroke.width'],
|
|
3149
3149
|
[api.GeometryType.Polyline]: ['stroke.color', 'stroke.width'],
|
|
3150
|
-
[api.GeometryType.Point]: ['angle', 'size', 'fill.color', 'fillColor', 'background.fillColor', 'background.strokeColor', 'background.strokeWidth', 'figure.fillColor', 'figure.strokeColor', 'figure.strokeWidth', 'singleObjectSymbol.figure.fillColor', 'singleObjectSymbol.background.fillColor']
|
|
3150
|
+
[api.GeometryType.Point]: ['angle', 'size', 'fill.color', 'fillColor', 'background.fillColor', 'background.strokeColor', 'background.strokeWidth', 'figure.fillColor', 'figure.strokeColor', 'figure.strokeWidth', 'singleObjectSymbol.figure.fillColor', 'singleObjectSymbol.figure.strokeColor', 'singleObjectSymbol.figure.strokeWidth', 'singleObjectSymbol.background.fillColor', 'singleObjectSymbol.background.strokeColor', 'singleObjectSymbol.background.strokeWidth']
|
|
3151
3151
|
};
|
|
3152
3152
|
const SYMBOL_LIMITS = {
|
|
3153
3153
|
SIZE_MIN: 1,
|
|
@@ -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
|
-
|
|
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 (
|
|
3296
|
+
if (isClassified) {
|
|
3296
3297
|
symbolBg == null ? void 0 : symbolBg.stroke({
|
|
3297
|
-
opacity:
|
|
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
|
-
|
|
3306
|
-
|
|
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
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
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
|
}
|
|
@@ -4369,6 +4384,8 @@ function deserializeSvgPointSymbolParams(_ref) {
|
|
|
4369
4384
|
})
|
|
4370
4385
|
} : {}, figure ? {
|
|
4371
4386
|
figure: _extends({}, figure, {
|
|
4387
|
+
strokeColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.strokeColor)),
|
|
4388
|
+
strokeWidth: getParameterValue(figure == null ? void 0 : figure.strokeWidth),
|
|
4372
4389
|
fillColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.fillColor))
|
|
4373
4390
|
})
|
|
4374
4391
|
} : {});
|
|
@@ -6030,7 +6047,7 @@ const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templ
|
|
|
6030
6047
|
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
6048
|
const ClusterLegendContainer = /*#__PURE__*/styled__default.div(_templateObject38 || (_templateObject38 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: -0.9rem;\n transform: scale(0.5);\n"])));
|
|
6032
6049
|
|
|
6033
|
-
const useSvgSymbol = (symbol, skipOffset,
|
|
6050
|
+
const useSvgSymbol = (symbol, skipOffset, isClassified) => {
|
|
6034
6051
|
const SVGWrapperRefElement = React.useRef(null);
|
|
6035
6052
|
const SVGContainer = React.useMemo(() => svg_js.SVG(), []);
|
|
6036
6053
|
const initSvg = React.useCallback(() => {
|
|
@@ -6042,14 +6059,14 @@ const useSvgSymbol = (symbol, skipOffset, isClassifiedValue) => {
|
|
|
6042
6059
|
svg,
|
|
6043
6060
|
bg,
|
|
6044
6061
|
newSymbol,
|
|
6045
|
-
|
|
6062
|
+
isClassified
|
|
6046
6063
|
} = _ref;
|
|
6047
6064
|
manipulateSvgSymbol({
|
|
6048
6065
|
SVGContainer,
|
|
6049
6066
|
symbol: newSymbol || symbol,
|
|
6050
6067
|
svg,
|
|
6051
6068
|
bg,
|
|
6052
|
-
|
|
6069
|
+
isClassified
|
|
6053
6070
|
});
|
|
6054
6071
|
}, [SVGContainer, symbol]);
|
|
6055
6072
|
const getUpdatedSvgSymbol = React.useCallback((field, value) => {
|
|
@@ -6090,7 +6107,7 @@ const useSvgSymbol = (symbol, skipOffset, isClassifiedValue) => {
|
|
|
6090
6107
|
svg: getParameterValue(data),
|
|
6091
6108
|
newSymbol,
|
|
6092
6109
|
bg: (_newSymbol$background = newSymbol.background) == null ? void 0 : _newSymbol$background.type,
|
|
6093
|
-
|
|
6110
|
+
isClassified
|
|
6094
6111
|
});
|
|
6095
6112
|
return _extends({}, newSymbol, {
|
|
6096
6113
|
data: SVGContainer.svg()
|
|
@@ -6147,7 +6164,7 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
|
|
|
6147
6164
|
text,
|
|
6148
6165
|
fontSettings,
|
|
6149
6166
|
skipOffset,
|
|
6150
|
-
|
|
6167
|
+
isClassified,
|
|
6151
6168
|
onClick
|
|
6152
6169
|
} = _ref7;
|
|
6153
6170
|
const {
|
|
@@ -6155,7 +6172,7 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
|
|
|
6155
6172
|
initSvg,
|
|
6156
6173
|
getSvgData,
|
|
6157
6174
|
manipulateSvg
|
|
6158
|
-
} = useSvgSymbol(symbol, skipOffset,
|
|
6175
|
+
} = useSvgSymbol(symbol, skipOffset, isClassified);
|
|
6159
6176
|
const onSelectSymbol = React.useCallback(() => {
|
|
6160
6177
|
onClick == null ? void 0 : onClick(getSvgData(), _extends({}, symbol, bg ? {
|
|
6161
6178
|
background: _extends({}, symbol.background, {
|
|
@@ -6176,9 +6193,9 @@ const SvgSymbol = /*#__PURE__*/React.memo(_ref7 => {
|
|
|
6176
6193
|
svg,
|
|
6177
6194
|
bg,
|
|
6178
6195
|
newSymbol: symbol,
|
|
6179
|
-
|
|
6196
|
+
isClassified
|
|
6180
6197
|
});
|
|
6181
|
-
}, [svg, symbol, bg, manipulateSvg,
|
|
6198
|
+
}, [svg, symbol, bg, manipulateSvg, isClassified]);
|
|
6182
6199
|
return text ? React__default.createElement(SvgSymbolContainer, null, renderSymbol, React__default.createElement(SvgSymbolLabel, {
|
|
6183
6200
|
fontSettings: fontSettings
|
|
6184
6201
|
}, text), !!(fontSettings != null && fontSettings.haloColor) && !!(fontSettings != null && fontSettings.haloWidth) && React__default.createElement(SvgSymbolLabel, {
|
|
@@ -6218,7 +6235,7 @@ const ClusterSymbolPreview = _ref => {
|
|
|
6218
6235
|
return React__default.createElement(SvgSymbol, {
|
|
6219
6236
|
svg: DEFAULT_CLUSTER_SVG,
|
|
6220
6237
|
symbol: svgSymbol,
|
|
6221
|
-
|
|
6238
|
+
isClassified: isClassified,
|
|
6222
6239
|
text: '99',
|
|
6223
6240
|
fontSettings: _extends({}, symbol.labelSymbol, {
|
|
6224
6241
|
fontSize: fontSize || ((_symbol$labelSymbol = symbol.labelSymbol) == null ? void 0 : _symbol$labelSymbol.fontSize)
|