@evergis/react 2.0.193 → 2.0.194
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 +4 -4
- package/dist/react.cjs.development.js +31 -22
- 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 +31 -22
- package/dist/react.esm.js.map +1 -1
- package/dist/utils/svg.d.ts +3 -3
- package/package.json +2 -2
package/dist/react.esm.js
CHANGED
|
@@ -2593,7 +2593,7 @@ const getTitleFromCondition = _ref2 => {
|
|
|
2593
2593
|
} = _ref2;
|
|
2594
2594
|
const parts = condition == null ? void 0 : condition.split(' == ');
|
|
2595
2595
|
const uniqueValue = (parts == null ? void 0 : (_parts$ = parts[1]) == null ? void 0 : _parts$.slice(1, -1)) || '';
|
|
2596
|
-
return attribute && formatValue ? formatValue(attribute.type, uniqueValue, attribute.stringFormat) :
|
|
2596
|
+
return attribute && formatValue ? formatValue(attribute.type, uniqueValue, attribute.stringFormat) : uniqueValue;
|
|
2597
2597
|
};
|
|
2598
2598
|
function createValueTitleFromCondition(paramValue, attribute, formatValue, index) {
|
|
2599
2599
|
if (!attribute) return '';
|
|
@@ -3225,7 +3225,7 @@ var SvgSymbolBg;
|
|
|
3225
3225
|
})(SvgSymbolBg || (SvgSymbolBg = {}));
|
|
3226
3226
|
|
|
3227
3227
|
const convertSvgToBase64 = svg => "data:image/svg+xml;base64," + window.btoa(svg);
|
|
3228
|
-
const createSvgGradient = (svg, values) => svg.gradient(
|
|
3228
|
+
const createSvgGradient = (svg, values) => svg.gradient('linear', add => {
|
|
3229
3229
|
values == null ? void 0 : values.forEach((_ref, index) => {
|
|
3230
3230
|
let {
|
|
3231
3231
|
value
|
|
@@ -3247,8 +3247,8 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
|
|
|
3247
3247
|
background,
|
|
3248
3248
|
figure
|
|
3249
3249
|
} = symbol;
|
|
3250
|
-
const isUploadedFile = !bg && !symbolData.includes(
|
|
3251
|
-
const innerSvg = symbolData.replace(/<\?xml[^?]*\?>|<svg[^>]*>|<\/svg>/g,
|
|
3250
|
+
const isUploadedFile = !bg && !symbolData.includes('symbol-bg') && !symbolData.includes('symbol-figure');
|
|
3251
|
+
const innerSvg = symbolData.replace(/<\?xml[^?]*\?>|<svg[^>]*>|<\/svg>/g, '');
|
|
3252
3252
|
|
|
3253
3253
|
if (isUploadedFile) {
|
|
3254
3254
|
var _$exec;
|
|
@@ -3262,11 +3262,11 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
|
|
|
3262
3262
|
|
|
3263
3263
|
SVGContainer.size(size);
|
|
3264
3264
|
} else {
|
|
3265
|
-
const hasBg = bg || (innerSvg == null ? void 0 : innerSvg.includes(
|
|
3265
|
+
const hasBg = bg || (innerSvg == null ? void 0 : innerSvg.includes('symbol-bg'));
|
|
3266
3266
|
let defaultSize = hasBg ? DEFAULT_SYMBOL_WITH_BG_SIZE : DEFAULT_SYMBOL_SIZE;
|
|
3267
3267
|
const currentSize = size || defaultSize;
|
|
3268
3268
|
let viewBox = [0, 0, defaultSize, defaultSize];
|
|
3269
|
-
const strokeWidth = getParameterValue(background == null ? void 0 : background.strokeWidth) || (typeof (background == null ? void 0 : background.strokeColor) ===
|
|
3269
|
+
const strokeWidth = getParameterValue(background == null ? void 0 : background.strokeWidth) || (typeof (background == null ? void 0 : background.strokeColor) === 'object' ? 1 : 0);
|
|
3270
3270
|
|
|
3271
3271
|
if (strokeWidth) {
|
|
3272
3272
|
defaultSize += strokeWidth;
|
|
@@ -3274,7 +3274,7 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
|
|
|
3274
3274
|
}
|
|
3275
3275
|
|
|
3276
3276
|
if (hasBg) {
|
|
3277
|
-
SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(
|
|
3277
|
+
SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(' '));
|
|
3278
3278
|
const currentBg = bg || (background == null ? void 0 : background.type);
|
|
3279
3279
|
|
|
3280
3280
|
if (currentBg) {
|
|
@@ -3282,23 +3282,32 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
|
|
|
3282
3282
|
const fillColor = getParameterValue(background == null ? void 0 : background.fillColor);
|
|
3283
3283
|
SVGContainer.svg(currentBg === 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 />");
|
|
3284
3284
|
SVGContainer.svg(innerSvg);
|
|
3285
|
-
SVGContainer.find(
|
|
3286
|
-
SVGContainer.find(
|
|
3285
|
+
SVGContainer.find('#symbol-bg:not(:first-child)').each(item => item.remove());
|
|
3286
|
+
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
|
|
3287
3287
|
|
|
3288
3288
|
if (isParameterByAttribute(background == null ? void 0 : background.fillColor)) {
|
|
3289
3289
|
var _background$fillColor, _SVGContainer$find$;
|
|
3290
3290
|
|
|
3291
3291
|
const gradient = createSvgGradient(SVGContainer, background == null ? void 0 : (_background$fillColor = background.fillColor) == null ? void 0 : _background$fillColor.values);
|
|
3292
|
-
(_SVGContainer$find$ = SVGContainer.find(
|
|
3292
|
+
(_SVGContainer$find$ = SVGContainer.find('#symbol-bg')[0]) == null ? void 0 : _SVGContainer$find$.fill(gradient);
|
|
3293
|
+
|
|
3294
|
+
if (isParameterByAttribute(background == null ? void 0 : background.strokeColor)) {
|
|
3295
|
+
var _SVGContainer$find$2;
|
|
3296
|
+
|
|
3297
|
+
(_SVGContainer$find$2 = SVGContainer.find('#symbol-bg')[0]) == null ? void 0 : _SVGContainer$find$2.stroke({
|
|
3298
|
+
color: gradient,
|
|
3299
|
+
opacity: 0.28
|
|
3300
|
+
});
|
|
3301
|
+
}
|
|
3293
3302
|
}
|
|
3294
3303
|
} else {
|
|
3295
3304
|
SVGContainer.svg(innerSvg);
|
|
3296
3305
|
}
|
|
3297
3306
|
} else {
|
|
3298
3307
|
const fillColor = getParameterValue(figure == null ? void 0 : figure.fillColor);
|
|
3299
|
-
SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(
|
|
3308
|
+
SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(' '));
|
|
3300
3309
|
SVGContainer.svg(innerSvg);
|
|
3301
|
-
SVGContainer.find(
|
|
3310
|
+
SVGContainer.find('#symbol-figure').each(item => {
|
|
3302
3311
|
item.center(DEFAULT_SYMBOL_SIZE / 2, DEFAULT_SYMBOL_SIZE / 2).fill(fillColor || DEFAULT_SYMBOL_FILL_COLOR);
|
|
3303
3312
|
});
|
|
3304
3313
|
}
|
|
@@ -3307,13 +3316,13 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
|
|
|
3307
3316
|
const rootTransform = (_$exec2 = /<svg[^>]*transform="([^"]+)"/g.exec(symbolData)) == null ? void 0 : _$exec2[1];
|
|
3308
3317
|
|
|
3309
3318
|
if (rootTransform) {
|
|
3310
|
-
const transformParts = rootTransform.slice(0, -1).split(
|
|
3319
|
+
const transformParts = rootTransform.slice(0, -1).split('(');
|
|
3311
3320
|
SVGContainer.transform({
|
|
3312
|
-
[transformParts[0]]: transformParts[1].split(
|
|
3321
|
+
[transformParts[0]]: transformParts[1].split(',')
|
|
3313
3322
|
});
|
|
3314
3323
|
}
|
|
3315
3324
|
|
|
3316
|
-
const rotatedAngle = SVGContainer.transform(
|
|
3325
|
+
const rotatedAngle = SVGContainer.transform('rotate');
|
|
3317
3326
|
|
|
3318
3327
|
if (rotatedAngle) {
|
|
3319
3328
|
SVGContainer.rotate(-rotatedAngle, 0, 0);
|
|
@@ -6100,27 +6109,27 @@ const useSvgSymbol = (symbol, skipOffset) => {
|
|
|
6100
6109
|
data,
|
|
6101
6110
|
offset
|
|
6102
6111
|
} = symbol;
|
|
6103
|
-
const newValue = value instanceof Color$1 ? value.toString(
|
|
6112
|
+
const newValue = value instanceof Color$1 ? value.toString('rgba') : value;
|
|
6104
6113
|
|
|
6105
6114
|
const newSymbol = _extends({}, JSON.parse(JSON.stringify(symbol)), {
|
|
6106
6115
|
offset: skipOffset ? DEFAULT_SYMBOL_OFFSET : isSizeClassification(field) ? getOffsetParameterValue(offset) : offset
|
|
6107
6116
|
});
|
|
6108
6117
|
|
|
6109
|
-
if (field.indexOf(
|
|
6118
|
+
if (field.indexOf('.') !== -1) {
|
|
6110
6119
|
var _newSymbol$parts$;
|
|
6111
6120
|
|
|
6112
|
-
const parts = field.split(
|
|
6121
|
+
const parts = field.split('.');
|
|
6113
6122
|
|
|
6114
6123
|
if ((_newSymbol$parts$ = newSymbol[parts[0]]) != null && _newSymbol$parts$[parts[1]]) {
|
|
6115
6124
|
newSymbol[parts[0]][parts[1]] = newValue;
|
|
6116
6125
|
} else {
|
|
6117
6126
|
newSymbol[parts[0]] = _extends({}, newSymbol[parts[0]], {
|
|
6118
6127
|
[parts[1]]: newValue
|
|
6119
|
-
}, parts[0] ===
|
|
6128
|
+
}, parts[0] === 'background' ? {
|
|
6120
6129
|
type: newSymbol.background.type,
|
|
6121
|
-
id:
|
|
6122
|
-
} : parts[0] ===
|
|
6123
|
-
id:
|
|
6130
|
+
id: 'symbol-bg'
|
|
6131
|
+
} : parts[0] === 'figure' ? {
|
|
6132
|
+
id: 'symbol-figure'
|
|
6124
6133
|
} : {});
|
|
6125
6134
|
}
|
|
6126
6135
|
} else {
|