@evergis/react 2.0.192 → 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 +49 -26
- 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 +49 -26
- package/dist/react.esm.js.map +1 -1
- package/dist/utils/legend.d.ts +5 -1
- package/dist/utils/svg.d.ts +3 -3
- package/package.json +2 -2
package/dist/react.esm.js
CHANGED
|
@@ -2583,11 +2583,17 @@ const checkLayerHasLegend = layerInfo => {
|
|
|
2583
2583
|
return (paramValue == null ? void 0 : paramValue.type) === 'byAttribute';
|
|
2584
2584
|
})) || false;
|
|
2585
2585
|
};
|
|
2586
|
-
const getTitleFromCondition =
|
|
2586
|
+
const getTitleFromCondition = _ref2 => {
|
|
2587
2587
|
var _parts$;
|
|
2588
2588
|
|
|
2589
|
+
let {
|
|
2590
|
+
condition,
|
|
2591
|
+
attribute,
|
|
2592
|
+
formatValue
|
|
2593
|
+
} = _ref2;
|
|
2589
2594
|
const parts = condition == null ? void 0 : condition.split(' == ');
|
|
2590
|
-
|
|
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) : uniqueValue;
|
|
2591
2597
|
};
|
|
2592
2598
|
function createValueTitleFromCondition(paramValue, attribute, formatValue, index) {
|
|
2593
2599
|
if (!attribute) return '';
|
|
@@ -2906,7 +2912,9 @@ const getMinimizedLegendValues = (attribute, classified, formatValue, index, oth
|
|
|
2906
2912
|
}
|
|
2907
2913
|
|
|
2908
2914
|
result.uniqueValue = formatValue ? formatValue(attribute.type, paramValue.value, attribute.stringFormat) : paramValue.value.toString();
|
|
2909
|
-
result.title = getTitleFromCondition(
|
|
2915
|
+
result.title = getTitleFromCondition({
|
|
2916
|
+
condition: paramValue.condition
|
|
2917
|
+
});
|
|
2910
2918
|
result.hiddenCondition = createHiddenCondition(attribute.name, attribute.type, getClassificationValue(paramValue.value, result.title, new ClassificationCondition(paramValue.condition)));
|
|
2911
2919
|
return result;
|
|
2912
2920
|
});
|
|
@@ -2927,7 +2935,9 @@ const getMaximizedLegendValues = (attribute, param, params, classified, symbol,
|
|
|
2927
2935
|
const result = {
|
|
2928
2936
|
symbol: createLegendSymbol(paramValue.value, param, params, symbol)
|
|
2929
2937
|
};
|
|
2930
|
-
result.title = isRangeCondition(paramValue.condition) ? createValueTitleFromCondition(paramValue, attribute, formatValue, sectionIndex) : getTitleFromCondition(
|
|
2938
|
+
result.title = isRangeCondition(paramValue.condition) ? createValueTitleFromCondition(paramValue, attribute, formatValue, sectionIndex) : getTitleFromCondition({
|
|
2939
|
+
condition: paramValue.condition
|
|
2940
|
+
});
|
|
2931
2941
|
result.hiddenCondition = createHiddenCondition(attribute.name, attribute.type, getClassificationValue(paramValue.value, result.title, new ClassificationCondition(classified.values[index].condition)));
|
|
2932
2942
|
return result;
|
|
2933
2943
|
});
|
|
@@ -3215,7 +3225,7 @@ var SvgSymbolBg;
|
|
|
3215
3225
|
})(SvgSymbolBg || (SvgSymbolBg = {}));
|
|
3216
3226
|
|
|
3217
3227
|
const convertSvgToBase64 = svg => "data:image/svg+xml;base64," + window.btoa(svg);
|
|
3218
|
-
const createSvgGradient = (svg, values) => svg.gradient(
|
|
3228
|
+
const createSvgGradient = (svg, values) => svg.gradient('linear', add => {
|
|
3219
3229
|
values == null ? void 0 : values.forEach((_ref, index) => {
|
|
3220
3230
|
let {
|
|
3221
3231
|
value
|
|
@@ -3237,8 +3247,8 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
|
|
|
3237
3247
|
background,
|
|
3238
3248
|
figure
|
|
3239
3249
|
} = symbol;
|
|
3240
|
-
const isUploadedFile = !bg && !symbolData.includes(
|
|
3241
|
-
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, '');
|
|
3242
3252
|
|
|
3243
3253
|
if (isUploadedFile) {
|
|
3244
3254
|
var _$exec;
|
|
@@ -3252,11 +3262,11 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
|
|
|
3252
3262
|
|
|
3253
3263
|
SVGContainer.size(size);
|
|
3254
3264
|
} else {
|
|
3255
|
-
const hasBg = bg || (innerSvg == null ? void 0 : innerSvg.includes(
|
|
3265
|
+
const hasBg = bg || (innerSvg == null ? void 0 : innerSvg.includes('symbol-bg'));
|
|
3256
3266
|
let defaultSize = hasBg ? DEFAULT_SYMBOL_WITH_BG_SIZE : DEFAULT_SYMBOL_SIZE;
|
|
3257
3267
|
const currentSize = size || defaultSize;
|
|
3258
3268
|
let viewBox = [0, 0, defaultSize, defaultSize];
|
|
3259
|
-
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);
|
|
3260
3270
|
|
|
3261
3271
|
if (strokeWidth) {
|
|
3262
3272
|
defaultSize += strokeWidth;
|
|
@@ -3264,7 +3274,7 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
|
|
|
3264
3274
|
}
|
|
3265
3275
|
|
|
3266
3276
|
if (hasBg) {
|
|
3267
|
-
SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(
|
|
3277
|
+
SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(' '));
|
|
3268
3278
|
const currentBg = bg || (background == null ? void 0 : background.type);
|
|
3269
3279
|
|
|
3270
3280
|
if (currentBg) {
|
|
@@ -3272,23 +3282,32 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
|
|
|
3272
3282
|
const fillColor = getParameterValue(background == null ? void 0 : background.fillColor);
|
|
3273
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 />");
|
|
3274
3284
|
SVGContainer.svg(innerSvg);
|
|
3275
|
-
SVGContainer.find(
|
|
3276
|
-
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
|
|
3277
3287
|
|
|
3278
3288
|
if (isParameterByAttribute(background == null ? void 0 : background.fillColor)) {
|
|
3279
3289
|
var _background$fillColor, _SVGContainer$find$;
|
|
3280
3290
|
|
|
3281
3291
|
const gradient = createSvgGradient(SVGContainer, background == null ? void 0 : (_background$fillColor = background.fillColor) == null ? void 0 : _background$fillColor.values);
|
|
3282
|
-
(_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
|
+
}
|
|
3283
3302
|
}
|
|
3284
3303
|
} else {
|
|
3285
3304
|
SVGContainer.svg(innerSvg);
|
|
3286
3305
|
}
|
|
3287
3306
|
} else {
|
|
3288
3307
|
const fillColor = getParameterValue(figure == null ? void 0 : figure.fillColor);
|
|
3289
|
-
SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(
|
|
3308
|
+
SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(' '));
|
|
3290
3309
|
SVGContainer.svg(innerSvg);
|
|
3291
|
-
SVGContainer.find(
|
|
3310
|
+
SVGContainer.find('#symbol-figure').each(item => {
|
|
3292
3311
|
item.center(DEFAULT_SYMBOL_SIZE / 2, DEFAULT_SYMBOL_SIZE / 2).fill(fillColor || DEFAULT_SYMBOL_FILL_COLOR);
|
|
3293
3312
|
});
|
|
3294
3313
|
}
|
|
@@ -3297,13 +3316,13 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
|
|
|
3297
3316
|
const rootTransform = (_$exec2 = /<svg[^>]*transform="([^"]+)"/g.exec(symbolData)) == null ? void 0 : _$exec2[1];
|
|
3298
3317
|
|
|
3299
3318
|
if (rootTransform) {
|
|
3300
|
-
const transformParts = rootTransform.slice(0, -1).split(
|
|
3319
|
+
const transformParts = rootTransform.slice(0, -1).split('(');
|
|
3301
3320
|
SVGContainer.transform({
|
|
3302
|
-
[transformParts[0]]: transformParts[1].split(
|
|
3321
|
+
[transformParts[0]]: transformParts[1].split(',')
|
|
3303
3322
|
});
|
|
3304
3323
|
}
|
|
3305
3324
|
|
|
3306
|
-
const rotatedAngle = SVGContainer.transform(
|
|
3325
|
+
const rotatedAngle = SVGContainer.transform('rotate');
|
|
3307
3326
|
|
|
3308
3327
|
if (rotatedAngle) {
|
|
3309
3328
|
SVGContainer.rotate(-rotatedAngle, 0, 0);
|
|
@@ -6090,27 +6109,27 @@ const useSvgSymbol = (symbol, skipOffset) => {
|
|
|
6090
6109
|
data,
|
|
6091
6110
|
offset
|
|
6092
6111
|
} = symbol;
|
|
6093
|
-
const newValue = value instanceof Color$1 ? value.toString(
|
|
6112
|
+
const newValue = value instanceof Color$1 ? value.toString('rgba') : value;
|
|
6094
6113
|
|
|
6095
6114
|
const newSymbol = _extends({}, JSON.parse(JSON.stringify(symbol)), {
|
|
6096
6115
|
offset: skipOffset ? DEFAULT_SYMBOL_OFFSET : isSizeClassification(field) ? getOffsetParameterValue(offset) : offset
|
|
6097
6116
|
});
|
|
6098
6117
|
|
|
6099
|
-
if (field.indexOf(
|
|
6118
|
+
if (field.indexOf('.') !== -1) {
|
|
6100
6119
|
var _newSymbol$parts$;
|
|
6101
6120
|
|
|
6102
|
-
const parts = field.split(
|
|
6121
|
+
const parts = field.split('.');
|
|
6103
6122
|
|
|
6104
6123
|
if ((_newSymbol$parts$ = newSymbol[parts[0]]) != null && _newSymbol$parts$[parts[1]]) {
|
|
6105
6124
|
newSymbol[parts[0]][parts[1]] = newValue;
|
|
6106
6125
|
} else {
|
|
6107
6126
|
newSymbol[parts[0]] = _extends({}, newSymbol[parts[0]], {
|
|
6108
6127
|
[parts[1]]: newValue
|
|
6109
|
-
}, parts[0] ===
|
|
6128
|
+
}, parts[0] === 'background' ? {
|
|
6110
6129
|
type: newSymbol.background.type,
|
|
6111
|
-
id:
|
|
6112
|
-
} : parts[0] ===
|
|
6113
|
-
id:
|
|
6130
|
+
id: 'symbol-bg'
|
|
6131
|
+
} : parts[0] === 'figure' ? {
|
|
6132
|
+
id: 'symbol-figure'
|
|
6114
6133
|
} : {});
|
|
6115
6134
|
}
|
|
6116
6135
|
} else {
|
|
@@ -6491,7 +6510,11 @@ const LegendChildren = _ref => {
|
|
|
6491
6510
|
if (!attribute) return null;
|
|
6492
6511
|
const hiddenCondition = createHiddenCondition(attribute.name, attribute.type, getClassificationValue(paramValue.symbol, paramValue.title, new ClassificationCondition(paramValue.condition)));
|
|
6493
6512
|
const legendText = getLegendText({
|
|
6494
|
-
title: isRangeCondition(paramValue.condition) ? createValueTitleFromCondition(paramValue, attribute, formatValue, index) : getTitleFromCondition(
|
|
6513
|
+
title: isRangeCondition(paramValue.condition) ? createValueTitleFromCondition(paramValue, attribute, formatValue, index) : getTitleFromCondition({
|
|
6514
|
+
condition: paramValue.condition,
|
|
6515
|
+
attribute,
|
|
6516
|
+
formatValue
|
|
6517
|
+
}),
|
|
6495
6518
|
index,
|
|
6496
6519
|
isDate: ((_getConditionAttribut = getConditionAttribute(attributes, paramValue.condition)) == null ? void 0 : _getConditionAttribut.type) === 'DateTime'
|
|
6497
6520
|
});
|