@splunk/react-visualizations 23.5.0 → 24.1.0
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/.loki/reference/chrome_docker_SingleValueRadial_100_height_and_width.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Background_color_flamenco.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Background_color_is_white.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Number_Precision_2.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Radial_Background_Color_pink.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Radial_Stroke_Color_valencia.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Thousand_Separators_disabled.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Thousand_Separators_enabled_default.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Trend_Display_Mode_absolute_default.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Trend_Display_Mode_percent.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Trend_Indicator_Position_below.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Trend_Indicator_Position_outside.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Trend_Indicator_Position_pushed_below_value_does_not_feet_inside_of_radial.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Trend_Indicator_Position_standard_default.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Trend_Indicator_disabled.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Trend_Indicator_enabled_default.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Under_label_specified.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Unit_specified_Unit_Position_after_default.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_Unit_specified_Unit_Position_before.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_basic.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_basic_dark_theme.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_basic_default_theme.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_basic_scp_theme.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_fixed_height_300_width_300.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_fixed_height_35_width_35.png +0 -0
- package/.loki/reference/chrome_docker_SingleValueRadial_no_props.png +0 -0
- package/GeoJsonChoropleth.js +107 -92
- package/GeoJsonChoropleth.js.map +1 -1
- package/SvgChoropleth.js +11 -9
- package/SvgChoropleth.js.map +1 -1
- package/package.json +12 -15
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/.loki/reference/chrome_docker_SingleValueRadial_Thousand_Separators_enabled_default.png
CHANGED
|
Binary file
|
package/.loki/reference/chrome_docker_SingleValueRadial_Trend_Display_Mode_absolute_default.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/.loki/reference/chrome_docker_SingleValueRadial_Trend_Indicator_Position_outside.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/.loki/reference/chrome_docker_SingleValueRadial_Unit_specified_Unit_Position_before.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/GeoJsonChoropleth.js
CHANGED
|
@@ -181,8 +181,6 @@ exports.isSpaceCompatible = exports.calculatedTargetBounds = exports.visibleSour
|
|
|
181
181
|
|
|
182
182
|
var lodash_1 = __webpack_require__(20);
|
|
183
183
|
|
|
184
|
-
var lodash_2 = __webpack_require__(20);
|
|
185
|
-
|
|
186
184
|
exports.screenSpace = {
|
|
187
185
|
x: {
|
|
188
186
|
unit: 'pixel'
|
|
@@ -247,7 +245,7 @@ exports.visibleSourceBounds = visibleSourceBounds;
|
|
|
247
245
|
* @returns {Bounds}
|
|
248
246
|
*/
|
|
249
247
|
|
|
250
|
-
var calculatedTargetBounds = function
|
|
248
|
+
var calculatedTargetBounds = function calculateTargetBounds(transformation, sourceBounds) {
|
|
251
249
|
var minSourceCoordinates = lodash_1.mapValues(sourceBounds, function (interval) {
|
|
252
250
|
return interval.min;
|
|
253
251
|
});
|
|
@@ -269,7 +267,7 @@ var calculatedTargetBounds = function visibleSourceBounds(transformation, source
|
|
|
269
267
|
exports.calculatedTargetBounds = calculatedTargetBounds;
|
|
270
268
|
|
|
271
269
|
function isSpaceCompatible(s1, s2) {
|
|
272
|
-
return
|
|
270
|
+
return lodash_1.isEqual(s1, s2);
|
|
273
271
|
}
|
|
274
272
|
|
|
275
273
|
exports.isSpaceCompatible = isSpaceCompatible;
|
|
@@ -300,6 +298,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
300
298
|
value: true
|
|
301
299
|
});
|
|
302
300
|
exports.DATA_ATTRIBUTE = void 0;
|
|
301
|
+
/* eslint-disable no-param-reassign */
|
|
303
302
|
|
|
304
303
|
var React = __webpack_require__(2);
|
|
305
304
|
|
|
@@ -365,7 +364,7 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
|
|
|
365
364
|
return;
|
|
366
365
|
}
|
|
367
366
|
|
|
368
|
-
var wholeFeature = feature.id ? feature : feature.parentNode; //remove the highlighted country IF we are entering a different country
|
|
367
|
+
var wholeFeature = feature.id ? feature : feature.parentNode; // remove the highlighted country IF we are entering a different country
|
|
369
368
|
|
|
370
369
|
if (_this.highlightedCountry && wholeFeature.id !== _this.highlightedCountry.id) {
|
|
371
370
|
_this.unHighlightCountry();
|
|
@@ -390,13 +389,13 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
|
|
|
390
389
|
} // 'wholeFeature' means the SVG <g> (group) of multipolygon features
|
|
391
390
|
|
|
392
391
|
|
|
393
|
-
var wholeFeature = feature.id ? feature : feature.parentNode; //handling feature leaving should always only deal with the highlighted feature
|
|
392
|
+
var wholeFeature = feature.id ? feature : feature.parentNode; // handling feature leaving should always only deal with the highlighted feature
|
|
394
393
|
|
|
395
394
|
if (wholeFeature !== _this.highlightedCountry) {
|
|
396
395
|
return;
|
|
397
396
|
}
|
|
398
397
|
|
|
399
|
-
_this.unHighlightCountry(); //wholeFeature.style.stroke = this.lastFeatureStroke;
|
|
398
|
+
_this.unHighlightCountry(); // wholeFeature.style.stroke = this.lastFeatureStroke;
|
|
400
399
|
|
|
401
400
|
|
|
402
401
|
if (_this.props.onFeatureHover) {
|
|
@@ -445,6 +444,7 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
|
|
|
445
444
|
value: function componentDidUpdate(prevProps) {
|
|
446
445
|
if (this.props !== prevProps) {
|
|
447
446
|
if (prevProps.featureCollection !== this.props.featureCollection) {
|
|
447
|
+
// eslint-disable-next-line react/no-did-update-set-state
|
|
448
448
|
this.setState({
|
|
449
449
|
svgNode: this.props.featureCollection.getSvgNode(this.registerSvg)
|
|
450
450
|
});
|
|
@@ -452,6 +452,12 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
|
|
|
452
452
|
this.updateSvg(this.props);
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
+
} // allows a provided alias like 'US-CA' to get mapped to 'California' which is the element id for the SVG shape
|
|
456
|
+
|
|
457
|
+
}, {
|
|
458
|
+
key: "getFeatureId",
|
|
459
|
+
value: function getFeatureId(alias) {
|
|
460
|
+
return this.props.featureCollection.resolveAlias(alias);
|
|
455
461
|
}
|
|
456
462
|
/**
|
|
457
463
|
* this method renders a copy of the polygon on top of all the others, with a highlighted boundary.
|
|
@@ -524,12 +530,6 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
|
|
|
524
530
|
node.removeAttribute(exports.DATA_ATTRIBUTE);
|
|
525
531
|
}
|
|
526
532
|
});
|
|
527
|
-
} //allows a provided alias like 'US-CA' to get mapped to 'California' which is the element id for the SVG shape
|
|
528
|
-
|
|
529
|
-
}, {
|
|
530
|
-
key: "getFeatureId",
|
|
531
|
-
value: function getFeatureId(alias) {
|
|
532
|
-
return this.props.featureCollection.resolveAlias(alias);
|
|
533
533
|
}
|
|
534
534
|
}, {
|
|
535
535
|
key: "render",
|
|
@@ -652,7 +652,7 @@ var TransformationChain = /*#__PURE__*/function () {
|
|
|
652
652
|
value: function transformBack(physicalCoords) {
|
|
653
653
|
var currentCoords = physicalCoords;
|
|
654
654
|
|
|
655
|
-
for (var idx = this.transformations.length - 1; idx >= 0; idx
|
|
655
|
+
for (var idx = this.transformations.length - 1; idx >= 0; idx -= 1) {
|
|
656
656
|
currentCoords = this.transformations[idx].transformBack(currentCoords);
|
|
657
657
|
}
|
|
658
658
|
|
|
@@ -748,8 +748,8 @@ var BoundsUtils = /*#__PURE__*/function () {
|
|
|
748
748
|
return {};
|
|
749
749
|
}
|
|
750
750
|
|
|
751
|
-
var xInterval = logicalBounds
|
|
752
|
-
var yInterval = logicalBounds
|
|
751
|
+
var xInterval = logicalBounds.x;
|
|
752
|
+
var yInterval = logicalBounds.y; // use GeoJsonFeatureGrpup f's Bounds to create a CSS inline style to position the inset using a div
|
|
753
753
|
|
|
754
754
|
return {
|
|
755
755
|
position: 'absolute',
|
|
@@ -808,6 +808,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
808
808
|
value: true
|
|
809
809
|
});
|
|
810
810
|
exports.createFeatureCollections = exports.valueText = exports.estimateTextWidth = exports.round2 = exports.LABEL_FONT_SIZE = void 0;
|
|
811
|
+
/* eslint-disable max-classes-per-file */
|
|
811
812
|
|
|
812
813
|
var React = __webpack_require__(2);
|
|
813
814
|
|
|
@@ -1054,24 +1055,12 @@ var GeoJsonChoropleth = /*#__PURE__*/function (_React$Component) {
|
|
|
1054
1055
|
geoJson = _this$props.geoJson;
|
|
1055
1056
|
|
|
1056
1057
|
if (prevProps.geoJson !== geoJson || prevProps.sourceBounds !== sourceBounds || prevProps.logicalBounds !== logicalBounds || prevProps.projection !== projection) {
|
|
1058
|
+
// eslint-disable-next-line react/no-did-update-set-state
|
|
1057
1059
|
this.setState({
|
|
1058
1060
|
featureCollections: createFeatureCollections(this.props)
|
|
1059
1061
|
});
|
|
1060
1062
|
}
|
|
1061
1063
|
}
|
|
1062
|
-
}, {
|
|
1063
|
-
key: "getLocalCoords",
|
|
1064
|
-
value: function getLocalCoords(clientX, clientY) {
|
|
1065
|
-
var rect = this.containerRef.current.getBoundingClientRect();
|
|
1066
|
-
var physX = rect.left;
|
|
1067
|
-
var physY = rect.top;
|
|
1068
|
-
var scaleX = this.containerRef.current.offsetWidth / rect.width;
|
|
1069
|
-
var scaleY = this.containerRef.current.offsetHeight / rect.height;
|
|
1070
|
-
return {
|
|
1071
|
-
x: (clientX - physX) * scaleX,
|
|
1072
|
-
y: (clientY - physY) * scaleY
|
|
1073
|
-
};
|
|
1074
|
-
}
|
|
1075
1064
|
}, {
|
|
1076
1065
|
key: "handleMouseMove",
|
|
1077
1066
|
value: function handleMouseMove(ev) {
|
|
@@ -1108,6 +1097,19 @@ var GeoJsonChoropleth = /*#__PURE__*/function (_React$Component) {
|
|
|
1108
1097
|
externalHandler(featureId);
|
|
1109
1098
|
}
|
|
1110
1099
|
}
|
|
1100
|
+
}, {
|
|
1101
|
+
key: "getLocalCoords",
|
|
1102
|
+
value: function getLocalCoords(clientX, clientY) {
|
|
1103
|
+
var rect = this.containerRef.current.getBoundingClientRect();
|
|
1104
|
+
var physX = rect.left;
|
|
1105
|
+
var physY = rect.top;
|
|
1106
|
+
var scaleX = this.containerRef.current.offsetWidth / rect.width;
|
|
1107
|
+
var scaleY = this.containerRef.current.offsetHeight / rect.height;
|
|
1108
|
+
return {
|
|
1109
|
+
x: (clientX - physX) * scaleX,
|
|
1110
|
+
y: (clientY - physY) * scaleY
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1111
1113
|
}, {
|
|
1112
1114
|
key: "render",
|
|
1113
1115
|
value: function render() {
|
|
@@ -1190,21 +1192,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1190
1192
|
});
|
|
1191
1193
|
exports.renderGeoJsonFeature = exports.polygon = exports.ring = exports.pickLogicalBnds = exports.DEFAULT_LOGICAL_BOUNDS = exports.featureGroupMatcher = exports.MATCH_ALL_FEATUREGROUP_MATCHER = void 0;
|
|
1192
1194
|
|
|
1193
|
-
var
|
|
1195
|
+
var lodash_1 = __webpack_require__(20);
|
|
1194
1196
|
|
|
1195
|
-
var
|
|
1197
|
+
var bbox_clip_1 = __webpack_require__(47);
|
|
1196
1198
|
|
|
1197
|
-
var
|
|
1199
|
+
var MercatorTransformation_1 = __webpack_require__(48);
|
|
1198
1200
|
|
|
1199
|
-
var
|
|
1201
|
+
var GeometryStreamSVGRenderer_1 = __webpack_require__(49);
|
|
1200
1202
|
|
|
1201
|
-
var
|
|
1203
|
+
var ICoordinateTransformation_1 = __webpack_require__(27);
|
|
1202
1204
|
|
|
1203
|
-
var
|
|
1205
|
+
var LinearTransformation_1 = __webpack_require__(54);
|
|
1204
1206
|
|
|
1205
|
-
var
|
|
1207
|
+
var TransformationChain_1 = __webpack_require__(32);
|
|
1206
1208
|
|
|
1207
|
-
var
|
|
1209
|
+
var BoundsUtils_1 = __webpack_require__(33); // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1208
1210
|
|
|
1209
1211
|
|
|
1210
1212
|
var MATCH_ALL_FEATUREGROUP_MATCHER = function MATCH_ALL_FEATUREGROUP_MATCHER(feature) {
|
|
@@ -1261,10 +1263,10 @@ function pickLogicalBnds(globalLogicalBnds, g) {
|
|
|
1261
1263
|
exports.pickLogicalBnds = pickLogicalBnds;
|
|
1262
1264
|
|
|
1263
1265
|
function ring(coords, renderer, bounds, props) {
|
|
1264
|
-
//polygon coords is array of number array
|
|
1266
|
+
// polygon coords is array of number array
|
|
1265
1267
|
renderer.beginNode('polygon', props);
|
|
1266
1268
|
|
|
1267
|
-
for (var i = 0; i < coords.length; i
|
|
1269
|
+
for (var i = 0; i < coords.length; i += 1) {
|
|
1268
1270
|
var _coords$i = _slicedToArray(coords[i], 2),
|
|
1269
1271
|
long = _coords$i[0],
|
|
1270
1272
|
lat = _coords$i[1];
|
|
@@ -1279,12 +1281,12 @@ function ring(coords, renderer, bounds, props) {
|
|
|
1279
1281
|
renderer.cancelNode();
|
|
1280
1282
|
console.warn("out-of-bounds polygon dropped: ".concat(JSON.stringify(props)));
|
|
1281
1283
|
return; // bail ... we don't need to endNode() since we cancelled it
|
|
1282
|
-
} else {
|
|
1283
|
-
renderer.addPoint({
|
|
1284
|
-
long: long,
|
|
1285
|
-
lat: lat
|
|
1286
|
-
});
|
|
1287
1284
|
}
|
|
1285
|
+
|
|
1286
|
+
renderer.addPoint({
|
|
1287
|
+
long: long,
|
|
1288
|
+
lat: lat
|
|
1289
|
+
});
|
|
1288
1290
|
}
|
|
1289
1291
|
|
|
1290
1292
|
renderer.endNode();
|
|
@@ -1293,8 +1295,8 @@ function ring(coords, renderer, bounds, props) {
|
|
|
1293
1295
|
exports.ring = ring;
|
|
1294
1296
|
|
|
1295
1297
|
function polygon(coords, renderer, bounds) {
|
|
1296
|
-
//polygon coords is array of number array
|
|
1297
|
-
for (var poly = 0; poly < coords.length; poly
|
|
1298
|
+
// polygon coords is array of number array
|
|
1299
|
+
for (var poly = 0; poly < coords.length; poly += 1) {
|
|
1298
1300
|
ring(coords[poly], renderer, bounds);
|
|
1299
1301
|
}
|
|
1300
1302
|
}
|
|
@@ -1303,16 +1305,16 @@ exports.polygon = polygon;
|
|
|
1303
1305
|
|
|
1304
1306
|
function renderGeoJsonFeature(feature, renderer, bounds) {
|
|
1305
1307
|
var bbox = bounds ? BoundsUtils_1.default.toTurfBBox(bounds) : undefined;
|
|
1306
|
-
var type = feature
|
|
1308
|
+
var type = feature.geometry.type;
|
|
1307
1309
|
|
|
1308
1310
|
if (lodash_1.get(feature, ['properties', 'name']) === 'Antarctica') {
|
|
1309
|
-
//skip shapes that cannot be mercator projected
|
|
1310
|
-
//no-op
|
|
1311
|
+
// skip shapes that cannot be mercator projected
|
|
1312
|
+
// no-op
|
|
1311
1313
|
return;
|
|
1312
1314
|
} // demo hack...
|
|
1313
1315
|
|
|
1314
1316
|
|
|
1315
|
-
var props = feature
|
|
1317
|
+
var props = feature.properties;
|
|
1316
1318
|
|
|
1317
1319
|
if (props.iso_3166_2) {
|
|
1318
1320
|
props.id = props.iso_3166_2;
|
|
@@ -1325,7 +1327,8 @@ function renderGeoJsonFeature(feature, renderer, bounds) {
|
|
|
1325
1327
|
switch (type) {
|
|
1326
1328
|
case 'MultiPolygon':
|
|
1327
1329
|
{
|
|
1328
|
-
renderer.beginNode('g', props); //svg has groups ('g') but no polygon
|
|
1330
|
+
renderer.beginNode('g', props); // svg has groups ('g') but no polygon
|
|
1331
|
+
// eslint-disable-next-line no-param-reassign
|
|
1329
1332
|
|
|
1330
1333
|
feature = bbox ? bbox_clip_1.default(feature, bbox) : feature;
|
|
1331
1334
|
var multis = lodash_1.get(feature, ['geometry', 'coordinates']);
|
|
@@ -1338,6 +1341,7 @@ function renderGeoJsonFeature(feature, renderer, bounds) {
|
|
|
1338
1341
|
|
|
1339
1342
|
case 'Polygon':
|
|
1340
1343
|
{
|
|
1344
|
+
// eslint-disable-next-line no-param-reassign
|
|
1341
1345
|
feature = bbox ? bbox_clip_1.default(feature, bbox) : feature;
|
|
1342
1346
|
var rings = lodash_1.get(feature, ['geometry', 'coordinates']);
|
|
1343
1347
|
rings.forEach(function (r) {
|
|
@@ -1348,7 +1352,7 @@ function renderGeoJsonFeature(feature, renderer, bounds) {
|
|
|
1348
1352
|
|
|
1349
1353
|
default:
|
|
1350
1354
|
{
|
|
1351
|
-
throw new Error(
|
|
1355
|
+
throw new Error("Unsupported geojson type: ".concat(type));
|
|
1352
1356
|
}
|
|
1353
1357
|
}
|
|
1354
1358
|
}
|
|
@@ -1356,10 +1360,10 @@ function renderGeoJsonFeature(feature, renderer, bounds) {
|
|
|
1356
1360
|
exports.renderGeoJsonFeature = renderGeoJsonFeature;
|
|
1357
1361
|
|
|
1358
1362
|
function computeBounds(geoJson, matcher) {
|
|
1359
|
-
//replace the renderer with one that is configured only to compute logicalBounds (for performance)
|
|
1363
|
+
// replace the renderer with one that is configured only to compute logicalBounds (for performance)
|
|
1360
1364
|
var boundsComputer = new GeometryStreamSVGRenderer_1.GeometryStreamSVGRenderer();
|
|
1361
1365
|
boundsComputer.computeBoundsOnly = true;
|
|
1362
|
-
geoJson
|
|
1366
|
+
geoJson.features.forEach(function (feature) {
|
|
1363
1367
|
if (matcher(feature)) {
|
|
1364
1368
|
renderGeoJsonFeature(feature, boundsComputer);
|
|
1365
1369
|
}
|
|
@@ -1379,7 +1383,7 @@ function pickSrcBnds(geoJson, g, globalSrcBnds, featureMatcher) {
|
|
|
1379
1383
|
} // ...'auto' compute the source bounds from the data.
|
|
1380
1384
|
|
|
1381
1385
|
|
|
1382
|
-
var b = computeBounds(geoJson, featureMatcher); //automatically compute sourceBounds if not provided
|
|
1386
|
+
var b = computeBounds(geoJson, featureMatcher); // automatically compute sourceBounds if not provided
|
|
1383
1387
|
|
|
1384
1388
|
if (!b) {
|
|
1385
1389
|
throw new Error("Could not determine bounds for geoFeatureGroup name='".concat(this.name, "' (no features matched)"));
|
|
@@ -1418,7 +1422,7 @@ var GeoJsonFeatureCollection = /*#__PURE__*/function () {
|
|
|
1418
1422
|
|
|
1419
1423
|
default:
|
|
1420
1424
|
{
|
|
1421
|
-
throw new Error(
|
|
1425
|
+
throw new Error("Unsupported projection: ".concat(projectionType));
|
|
1422
1426
|
}
|
|
1423
1427
|
}
|
|
1424
1428
|
|
|
@@ -1467,7 +1471,7 @@ var GeoJsonFeatureCollection = /*#__PURE__*/function () {
|
|
|
1467
1471
|
key: "resolveAlias",
|
|
1468
1472
|
value: function resolveAlias(alias) {
|
|
1469
1473
|
if (!this.aliases) {
|
|
1470
|
-
this.aliases = GeoJsonFeatureCollection.makeAliasMap(this.geoJson.features); //memoize
|
|
1474
|
+
this.aliases = GeoJsonFeatureCollection.makeAliasMap(this.geoJson.features); // memoize
|
|
1471
1475
|
}
|
|
1472
1476
|
|
|
1473
1477
|
var aliases = this.aliases;
|
|
@@ -1483,11 +1487,13 @@ var GeoJsonFeatureCollection = /*#__PURE__*/function () {
|
|
|
1483
1487
|
value: function makeAliasMap(features) {
|
|
1484
1488
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
1485
1489
|
return features.reduce(function (aliases, feature) {
|
|
1486
|
-
var geoJsonProperties = feature
|
|
1490
|
+
var geoJsonProperties = feature.properties;
|
|
1487
1491
|
var name = geoJsonProperties.iso_3166_2; // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
1488
1492
|
|
|
1489
1493
|
Object.keys(geoJsonProperties).forEach(function (k) {
|
|
1490
|
-
|
|
1494
|
+
if (k !== name) {
|
|
1495
|
+
aliases.set(geoJsonProperties[k].toLowerCase(), name); // alias all the other properies to the name property
|
|
1496
|
+
}
|
|
1491
1497
|
});
|
|
1492
1498
|
return aliases;
|
|
1493
1499
|
}, new Map());
|
|
@@ -1501,6 +1507,12 @@ exports.default = GeoJsonFeatureCollection;
|
|
|
1501
1507
|
|
|
1502
1508
|
/***/ }),
|
|
1503
1509
|
/* 47 */
|
|
1510
|
+
/***/ (function(module, exports) {
|
|
1511
|
+
|
|
1512
|
+
module.exports = require("@turf/bbox-clip");
|
|
1513
|
+
|
|
1514
|
+
/***/ }),
|
|
1515
|
+
/* 48 */
|
|
1504
1516
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1505
1517
|
|
|
1506
1518
|
"use strict";
|
|
@@ -1524,6 +1536,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1524
1536
|
value: true
|
|
1525
1537
|
});
|
|
1526
1538
|
exports.MercatorTransformation = void 0;
|
|
1539
|
+
/* eslint-disable class-methods-use-this */
|
|
1527
1540
|
|
|
1528
1541
|
var ICoordinateTransformation_1 = __webpack_require__(27);
|
|
1529
1542
|
|
|
@@ -1590,13 +1603,13 @@ var MercatorTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
|
|
|
1590
1603
|
exports.MercatorTransformation = MercatorTransformation;
|
|
1591
1604
|
|
|
1592
1605
|
/***/ }),
|
|
1593
|
-
/*
|
|
1606
|
+
/* 49 */
|
|
1594
1607
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1595
1608
|
|
|
1596
1609
|
"use strict";
|
|
1597
1610
|
|
|
1598
1611
|
|
|
1599
|
-
var _get = __webpack_require__(
|
|
1612
|
+
var _get = __webpack_require__(50);
|
|
1600
1613
|
|
|
1601
1614
|
var _classCallCheck = __webpack_require__(17);
|
|
1602
1615
|
|
|
@@ -1621,9 +1634,9 @@ var ICoordinateTransformation_1 = __webpack_require__(27);
|
|
|
1621
1634
|
|
|
1622
1635
|
var CoordinateTransformation_1 = __webpack_require__(30);
|
|
1623
1636
|
|
|
1624
|
-
var BoundsCollector_1 = __webpack_require__(
|
|
1637
|
+
var BoundsCollector_1 = __webpack_require__(51);
|
|
1625
1638
|
|
|
1626
|
-
var NodeTreeReactGenerator_1 = __webpack_require__(
|
|
1639
|
+
var NodeTreeReactGenerator_1 = __webpack_require__(52); // fixme TODO: should the identity transform really have different source and target spaces? That's a bit confusing
|
|
1627
1640
|
// as one would expect the identity transform could be inserted anywhere in a TransformationChain
|
|
1628
1641
|
|
|
1629
1642
|
|
|
@@ -1694,12 +1707,12 @@ var GeometryStreamSVGRenderer = /*#__PURE__*/function (_NodeTreeReactGenerat) {
|
|
|
1694
1707
|
|
|
1695
1708
|
var el = _get(_getPrototypeOf(GeometryStreamSVGRenderer.prototype), "peek", this).call(this);
|
|
1696
1709
|
|
|
1697
|
-
var points = el.attributes
|
|
1710
|
+
var points = el.attributes.points;
|
|
1698
1711
|
|
|
1699
1712
|
if (points) {
|
|
1700
|
-
el.attributes
|
|
1713
|
+
el.attributes.points += ' ';
|
|
1701
1714
|
} else {
|
|
1702
|
-
el.attributes
|
|
1715
|
+
el.attributes.points = ''; // initialize
|
|
1703
1716
|
}
|
|
1704
1717
|
|
|
1705
1718
|
var _this$transformer$tra = this.transformer.transform(p),
|
|
@@ -1712,7 +1725,7 @@ var GeometryStreamSVGRenderer = /*#__PURE__*/function (_NodeTreeReactGenerat) {
|
|
|
1712
1725
|
*/
|
|
1713
1726
|
|
|
1714
1727
|
|
|
1715
|
-
el.attributes
|
|
1728
|
+
el.attributes.points += "".concat(x, ",").concat(y); // FIXME TODO probably should not look for hard coded x and y in DataPoint
|
|
1716
1729
|
}
|
|
1717
1730
|
}, {
|
|
1718
1731
|
key: "beginNode",
|
|
@@ -1723,7 +1736,7 @@ var GeometryStreamSVGRenderer = /*#__PURE__*/function (_NodeTreeReactGenerat) {
|
|
|
1723
1736
|
return;
|
|
1724
1737
|
}
|
|
1725
1738
|
|
|
1726
|
-
|
|
1739
|
+
_get(_getPrototypeOf(GeometryStreamSVGRenderer.prototype), "beginNode", this).call(this, name, attributes);
|
|
1727
1740
|
}
|
|
1728
1741
|
}, {
|
|
1729
1742
|
key: "endNode",
|
|
@@ -1755,13 +1768,13 @@ var GeometryStreamSVGRenderer = /*#__PURE__*/function (_NodeTreeReactGenerat) {
|
|
|
1755
1768
|
exports.GeometryStreamSVGRenderer = GeometryStreamSVGRenderer;
|
|
1756
1769
|
|
|
1757
1770
|
/***/ }),
|
|
1758
|
-
/*
|
|
1771
|
+
/* 50 */
|
|
1759
1772
|
/***/ (function(module, exports) {
|
|
1760
1773
|
|
|
1761
1774
|
module.exports = require("@babel/runtime/helpers/get");
|
|
1762
1775
|
|
|
1763
1776
|
/***/ }),
|
|
1764
|
-
/*
|
|
1777
|
+
/* 51 */
|
|
1765
1778
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1766
1779
|
|
|
1767
1780
|
"use strict";
|
|
@@ -1822,7 +1835,7 @@ var BoundsCollector = /*#__PURE__*/function () {
|
|
|
1822
1835
|
exports.default = BoundsCollector;
|
|
1823
1836
|
|
|
1824
1837
|
/***/ }),
|
|
1825
|
-
/*
|
|
1838
|
+
/* 52 */
|
|
1826
1839
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1827
1840
|
|
|
1828
1841
|
"use strict";
|
|
@@ -1838,10 +1851,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1838
1851
|
value: true
|
|
1839
1852
|
});
|
|
1840
1853
|
exports.NodeTreeReactGenerator = exports.ElementStructure = void 0;
|
|
1854
|
+
/* eslint-disable max-classes-per-file */
|
|
1841
1855
|
|
|
1842
|
-
|
|
1856
|
+
/* eslint-disable no-underscore-dangle */
|
|
1857
|
+
|
|
1858
|
+
/* eslint-disable no-param-reassign */
|
|
1843
1859
|
|
|
1844
|
-
var
|
|
1860
|
+
var React = __webpack_require__(2); // eslint-disable-next-line import/order
|
|
1861
|
+
|
|
1862
|
+
|
|
1863
|
+
var camelCase = __webpack_require__(53);
|
|
1845
1864
|
/**
|
|
1846
1865
|
* This class represents the structure of a React element.
|
|
1847
1866
|
*/
|
|
@@ -1870,8 +1889,8 @@ var ElementStructure = /*#__PURE__*/function () {
|
|
|
1870
1889
|
_createClass(ElementStructure, null, [{
|
|
1871
1890
|
key: "processStyleAttributes",
|
|
1872
1891
|
value: function processStyleAttributes(a) {
|
|
1873
|
-
if (a
|
|
1874
|
-
a
|
|
1892
|
+
if (a.style) {
|
|
1893
|
+
a.style = ElementStructure.parseStyle(a.style);
|
|
1875
1894
|
}
|
|
1876
1895
|
|
|
1877
1896
|
return a;
|
|
@@ -2003,9 +2022,9 @@ var NodeTreeReactGenerator = /*#__PURE__*/function () {
|
|
|
2003
2022
|
value: function getRoot() {
|
|
2004
2023
|
if (this._root) {
|
|
2005
2024
|
return this._root;
|
|
2006
|
-
} else {
|
|
2007
|
-
throw new Error("Can't compute ReactElement until root node has been closed. Node stack: ".concat(this._stack));
|
|
2008
2025
|
}
|
|
2026
|
+
|
|
2027
|
+
throw new Error("Can't compute ReactElement until root node has been closed. Node stack: ".concat(this._stack));
|
|
2009
2028
|
}
|
|
2010
2029
|
/**
|
|
2011
2030
|
* Clears internal structures so this instance can be used to process a new tree.
|
|
@@ -2034,13 +2053,13 @@ var NodeTreeReactGenerator = /*#__PURE__*/function () {
|
|
|
2034
2053
|
exports.NodeTreeReactGenerator = NodeTreeReactGenerator;
|
|
2035
2054
|
|
|
2036
2055
|
/***/ }),
|
|
2037
|
-
/*
|
|
2056
|
+
/* 53 */
|
|
2038
2057
|
/***/ (function(module, exports) {
|
|
2039
2058
|
|
|
2040
2059
|
module.exports = require("lodash/camelCase");
|
|
2041
2060
|
|
|
2042
2061
|
/***/ }),
|
|
2043
|
-
/*
|
|
2062
|
+
/* 54 */
|
|
2044
2063
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2045
2064
|
|
|
2046
2065
|
"use strict";
|
|
@@ -2067,7 +2086,7 @@ exports.createBoundsInfo = void 0;
|
|
|
2067
2086
|
|
|
2068
2087
|
var lodash_1 = __webpack_require__(20);
|
|
2069
2088
|
|
|
2070
|
-
var Scale_1 = __webpack_require__(
|
|
2089
|
+
var Scale_1 = __webpack_require__(55);
|
|
2071
2090
|
|
|
2072
2091
|
var CoordinateTransformation_1 = __webpack_require__(30);
|
|
2073
2092
|
|
|
@@ -2132,9 +2151,9 @@ var LinearTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
|
|
|
2132
2151
|
value: function fit(sourceRanges, targetRanges) {
|
|
2133
2152
|
if (this.preserveAspectRatio) {
|
|
2134
2153
|
return this.fitUndistorted(sourceRanges, targetRanges);
|
|
2135
|
-
} else {
|
|
2136
|
-
return this.fitIndependently(sourceRanges, targetRanges);
|
|
2137
2154
|
}
|
|
2155
|
+
|
|
2156
|
+
return this.fitIndependently(sourceRanges, targetRanges);
|
|
2138
2157
|
}
|
|
2139
2158
|
}, {
|
|
2140
2159
|
key: "fitUndistorted",
|
|
@@ -2183,7 +2202,9 @@ var LinearTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
|
|
|
2183
2202
|
var _this4 = this;
|
|
2184
2203
|
|
|
2185
2204
|
var result = {};
|
|
2186
|
-
Object.keys(this.sourceSpace).forEach(
|
|
2205
|
+
Object.keys(this.sourceSpace).forEach( // TODO: move to explicit return
|
|
2206
|
+
// eslint-disable-next-line no-return-assign
|
|
2207
|
+
function (dimension) {
|
|
2187
2208
|
return result[_this4.targetCoordinate[dimension]] = _this4.scales[dimension].source2Target(sourcePoint[dimension]);
|
|
2188
2209
|
});
|
|
2189
2210
|
return result;
|
|
@@ -2215,7 +2236,7 @@ var LinearTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
|
|
|
2215
2236
|
value: function zoomAroundTarget(targetCenter, factor, minScale, maxScale) {
|
|
2216
2237
|
var _this6 = this;
|
|
2217
2238
|
|
|
2218
|
-
var currentScale = this.scales
|
|
2239
|
+
var currentScale = this.scales.x.scaleFactor;
|
|
2219
2240
|
var newScale = Math.min(maxScale || Number.MAX_VALUE, Math.max(currentScale * factor, minScale || 0));
|
|
2220
2241
|
var sourceCenter = this.transformBack(targetCenter);
|
|
2221
2242
|
['x', 'y'].forEach(function (axis) {
|
|
@@ -2254,7 +2275,7 @@ var LinearTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
|
|
|
2254
2275
|
exports.default = LinearTransformation;
|
|
2255
2276
|
|
|
2256
2277
|
/***/ }),
|
|
2257
|
-
/*
|
|
2278
|
+
/* 55 */
|
|
2258
2279
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2259
2280
|
|
|
2260
2281
|
"use strict";
|
|
@@ -2270,7 +2291,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2270
2291
|
exports.Scale = exports.toInterval = void 0;
|
|
2271
2292
|
|
|
2272
2293
|
var isInterval = function isInterval(object) {
|
|
2273
|
-
return object
|
|
2294
|
+
return object.min != null && object.max != null;
|
|
2274
2295
|
};
|
|
2275
2296
|
|
|
2276
2297
|
var toInterval = function toInterval(object) {
|
|
@@ -2364,12 +2385,6 @@ var Scale = /*#__PURE__*/function () {
|
|
|
2364
2385
|
|
|
2365
2386
|
exports.Scale = Scale;
|
|
2366
2387
|
|
|
2367
|
-
/***/ }),
|
|
2368
|
-
/* 55 */
|
|
2369
|
-
/***/ (function(module, exports) {
|
|
2370
|
-
|
|
2371
|
-
module.exports = require("@turf/bbox-clip");
|
|
2372
|
-
|
|
2373
2388
|
/***/ })
|
|
2374
2389
|
/******/ ]);
|
|
2375
2390
|
//# sourceMappingURL=GeoJsonChoropleth.js.map
|