@splunk/visualizations 24.3.2 → 24.3.3
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_PureVisualizations_PureMap_Tooltip_Dark.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_basic.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_geostats_by.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_off.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_unit_metric.png +0 -0
- package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Map_Editor.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Additional_Cases.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Internal_Fields.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Mostly_null.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Restricted_Zoom.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Set_Map_tiles.png +0 -0
- package/Area.js +121 -65
- package/Area.js.map +1 -1
- package/Bar.js +121 -65
- package/Bar.js.map +1 -1
- package/Bubble.js +121 -65
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.js +142 -73
- package/ChoroplethSvg.js.map +1 -1
- package/Column.js +121 -65
- package/Column.js.map +1 -1
- package/Ellipse.js +121 -65
- package/Ellipse.js.map +1 -1
- package/FillerGauge.js +121 -65
- package/FillerGauge.js.map +1 -1
- package/Image.js +125 -69
- package/Image.js.map +1 -1
- package/Line.js +121 -65
- package/Line.js.map +1 -1
- package/LinkGraph.js +121 -65
- package/LinkGraph.js.map +1 -1
- package/Map.config.js +16 -6
- package/Map.config.js.map +1 -1
- package/Map.js +430 -126
- package/Map.js.map +1 -1
- package/Markdown.js +131 -75
- package/Markdown.js.map +1 -1
- package/MarkerGauge.js +135 -79
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.js +140 -83
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.js +133 -77
- package/Pie.js.map +1 -1
- package/Punchcard.js +144 -87
- package/Punchcard.js.map +1 -1
- package/Rectangle.js +129 -73
- package/Rectangle.js.map +1 -1
- package/Sankey.js +204 -148
- package/Sankey.js.map +1 -1
- package/Scatter.js +131 -75
- package/Scatter.js.map +1 -1
- package/SingleValue.js +160 -104
- package/SingleValue.js.map +1 -1
- package/SingleValueIcon.js +135 -78
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.js +202 -146
- package/SingleValueRadial.js.map +1 -1
- package/Table.js +236 -180
- package/Table.js.map +1 -1
- package/common/utils/hocUtils.js +65 -9
- package/common/utils/hocUtils.js.map +1 -1
- package/common/withDashboardViz.js +68 -12
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +9 -9
package/Map.js
CHANGED
|
@@ -360,7 +360,7 @@ var _typeof = __webpack_require__(20);
|
|
|
360
360
|
Object.defineProperty(exports, "__esModule", {
|
|
361
361
|
value: true
|
|
362
362
|
});
|
|
363
|
-
exports.
|
|
363
|
+
exports.findClosestMatchFromDefaultList = exports.deepMergeWithArrayPrimitiveOverrides = exports.extendStaticWrapperProps = void 0;
|
|
364
364
|
|
|
365
365
|
var lodash_1 = __webpack_require__(2);
|
|
366
366
|
/**
|
|
@@ -386,17 +386,19 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
386
386
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
387
387
|
/**
|
|
388
388
|
* helper to deeply merge objects while preserving arrays in earlier source objects
|
|
389
|
-
* deeply nested primitive keys are merged similarly to lodash's defaultsDeep, while keys with arrays will be preserved if already present in the resultant merged object
|
|
390
|
-
* this prevents default arrays from appending values to user-defined arrays (this occurs if the default array is longer than the user-defined one)
|
|
389
|
+
* deeply nested primitive keys are merged similarly to lodash's defaultsDeep, while keys with arrays of primitives will be preserved if already present in the resultant merged object
|
|
390
|
+
* this prevents default arrays of primitives from appending values to user-defined arrays (this occurs if the default array is longer than the user-defined one).
|
|
391
|
+
* Array of objects gets merged with the defaults, where the defaults can be an array of objects. Closest matching default object from the defaults list based on key - value pair
|
|
392
|
+
* will be used for merging defaults for each object in the array. If no closest match found, first object in default array list used for merging.
|
|
391
393
|
*
|
|
392
|
-
* @method
|
|
394
|
+
* @method deepMergeWithArrayPrimitiveOverrides
|
|
393
395
|
* @param {Object} initial - target object to merge values into
|
|
394
396
|
* @param {Object[]} sources - other default options to be merged into the resultant object if no explicit value is provided, with earlier args taking precedence over later ones
|
|
395
397
|
*
|
|
396
398
|
* @returns {Object}
|
|
397
399
|
*/
|
|
398
400
|
|
|
399
|
-
var
|
|
401
|
+
var deepMergeWithArrayPrimitiveOverrides = function deepMergeWithArrayPrimitiveOverrides(initial) {
|
|
400
402
|
var clone = lodash_1.cloneDeep(initial);
|
|
401
403
|
|
|
402
404
|
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
@@ -407,18 +409,72 @@ var deepMergeWithArrayOverrides = function deepMergeWithArrayOverrides(initial)
|
|
|
407
409
|
Object.keys(sourceToApply).forEach(function (sourceKey) {
|
|
408
410
|
if (!Object.prototype.hasOwnProperty.call(clone, sourceKey)) {
|
|
409
411
|
clone[sourceKey] = lodash_1.cloneDeep(sourceToApply[sourceKey]);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
+
}
|
|
412
413
|
|
|
413
414
|
if (clone[sourceKey] && _typeof(clone[sourceKey]) === 'object' && !Array.isArray(clone[sourceKey]) && _typeof(sourceToApply[sourceKey]) === 'object') {
|
|
414
|
-
clone[sourceKey] = exports.
|
|
415
|
+
clone[sourceKey] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey], sourceToApply[sourceKey]);
|
|
416
|
+
} else if (Array.isArray(clone[sourceKey]) && _typeof(clone[sourceKey][0]) === 'object' && !Array.isArray(clone[sourceKey][0])) {
|
|
417
|
+
// If option is an array of objects
|
|
418
|
+
for (var i = 0; i < clone[sourceKey].length; i += 1) {
|
|
419
|
+
if (_typeof(clone[sourceKey][i]) === 'object') {
|
|
420
|
+
var closestMatchIdx = exports.findClosestMatchFromDefaultList(sourceToApply[sourceKey], clone[sourceKey][i]);
|
|
421
|
+
|
|
422
|
+
if (closestMatchIdx > -1) {
|
|
423
|
+
clone[sourceKey][i] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey][i], sourceToApply[sourceKey][closestMatchIdx]);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
415
427
|
}
|
|
416
428
|
});
|
|
417
429
|
});
|
|
418
430
|
return clone;
|
|
419
431
|
};
|
|
420
432
|
|
|
421
|
-
exports.
|
|
433
|
+
exports.deepMergeWithArrayPrimitiveOverrides = deepMergeWithArrayPrimitiveOverrides;
|
|
434
|
+
/**
|
|
435
|
+
* Finds the closest matching object from the list, which has the max same key value pairs.
|
|
436
|
+
* Returns the index of match if found, or -1
|
|
437
|
+
* For eg :-
|
|
438
|
+
const list = [{
|
|
439
|
+
type: "marker",
|
|
440
|
+
lat: "value1"
|
|
441
|
+
}, {
|
|
442
|
+
type: "bubble",
|
|
443
|
+
size: "value2"
|
|
444
|
+
}];
|
|
445
|
+
|
|
446
|
+
const obj = {
|
|
447
|
+
type: 'bubble'
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
findClosestMatch(list, obj) -> returns index 1.
|
|
451
|
+
*/
|
|
452
|
+
|
|
453
|
+
var findClosestMatchFromDefaultList = function findClosestMatchFromDefaultList(searchList, inputObj) {
|
|
454
|
+
if (!Array.isArray(searchList) || searchList.length === 0) {
|
|
455
|
+
return -1;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
var keys = Object.keys(inputObj);
|
|
459
|
+
var maxMatchCnt = 0;
|
|
460
|
+
var maxMatchIdx = 0;
|
|
461
|
+
searchList.forEach(function (item, idx) {
|
|
462
|
+
var matchCnt = 0;
|
|
463
|
+
keys.forEach(function (key) {
|
|
464
|
+
if (item[key] === inputObj[key]) {
|
|
465
|
+
matchCnt += 1;
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
if (Math.max(maxMatchCnt, matchCnt) > maxMatchCnt) {
|
|
470
|
+
maxMatchCnt = matchCnt;
|
|
471
|
+
maxMatchIdx = idx;
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
return maxMatchIdx;
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
exports.findClosestMatchFromDefaultList = findClosestMatchFromDefaultList;
|
|
422
478
|
|
|
423
479
|
/***/ }),
|
|
424
480
|
/* 8 */
|
|
@@ -520,7 +576,7 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
520
576
|
|
|
521
577
|
return React.createElement(FixSizeItem, {
|
|
522
578
|
"data-test": "fix-size-item",
|
|
523
|
-
"data-splunk-visualization-version": "24.3.
|
|
579
|
+
"data-splunk-visualization-version": "24.3.3 - 8d441d88c",
|
|
524
580
|
width: width,
|
|
525
581
|
height: height,
|
|
526
582
|
backgroundColor: backgroundColor
|
|
@@ -593,7 +649,7 @@ var T = __webpack_require__(0);
|
|
|
593
649
|
|
|
594
650
|
var lodash_1 = __webpack_require__(2);
|
|
595
651
|
|
|
596
|
-
var DataSource_1 = __webpack_require__(
|
|
652
|
+
var DataSource_1 = __webpack_require__(34);
|
|
597
653
|
|
|
598
654
|
exports.SortParamsPropTypes = T.shape({
|
|
599
655
|
currentSortKey: T.string,
|
|
@@ -716,6 +772,39 @@ exports.getPaginationParams = getPaginationParams;
|
|
|
716
772
|
"use strict";
|
|
717
773
|
|
|
718
774
|
|
|
775
|
+
Object.defineProperty(exports, "__esModule", {
|
|
776
|
+
value: true
|
|
777
|
+
});
|
|
778
|
+
exports.pickFieldFromJSONSchema = void 0;
|
|
779
|
+
|
|
780
|
+
var lodash_1 = __webpack_require__(2);
|
|
781
|
+
|
|
782
|
+
var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
|
|
783
|
+
var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
|
784
|
+
return Object.keys(optionsSchema).reduce(function (accum, k) {
|
|
785
|
+
if (lodash_1.has(optionsSchema[k], fieldName)) {
|
|
786
|
+
accum[k] = optionsSchema[k][fieldName];
|
|
787
|
+
} else if (lodash_1.get(optionsSchema, [k, 'type']) === 'object' && lodash_1.has(optionsSchema[k], 'properties')) {
|
|
788
|
+
var nestedSchema = exports.pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);
|
|
789
|
+
|
|
790
|
+
if (!lodash_1.isEmpty(nestedSchema)) {
|
|
791
|
+
accum[k] = nestedSchema;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
return accum;
|
|
796
|
+
}, {});
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
|
|
800
|
+
|
|
801
|
+
/***/ }),
|
|
802
|
+
/* 26 */
|
|
803
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
804
|
+
|
|
805
|
+
"use strict";
|
|
806
|
+
|
|
807
|
+
|
|
719
808
|
Object.defineProperty(exports, "__esModule", {
|
|
720
809
|
value: true
|
|
721
810
|
});
|
|
@@ -798,7 +887,7 @@ IconPlaceholder.defaultProps = {
|
|
|
798
887
|
exports.default = FixedSizeContainer_1.default(IconPlaceholder);
|
|
799
888
|
|
|
800
889
|
/***/ }),
|
|
801
|
-
/*
|
|
890
|
+
/* 27 */
|
|
802
891
|
/***/ (function(module, exports, __webpack_require__) {
|
|
803
892
|
|
|
804
893
|
"use strict";
|
|
@@ -826,7 +915,7 @@ var VizCategory;
|
|
|
826
915
|
})(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
|
|
827
916
|
|
|
828
917
|
/***/ }),
|
|
829
|
-
/*
|
|
918
|
+
/* 28 */
|
|
830
919
|
/***/ (function(module, exports, __webpack_require__) {
|
|
831
920
|
|
|
832
921
|
"use strict";
|
|
@@ -840,15 +929,15 @@ var React = __webpack_require__(1);
|
|
|
840
929
|
|
|
841
930
|
var lodash_1 = __webpack_require__(2);
|
|
842
931
|
|
|
843
|
-
var getSettingsFromThemedProps_1 = __webpack_require__(
|
|
932
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(29);
|
|
844
933
|
|
|
845
|
-
var Options_1 = __webpack_require__(
|
|
934
|
+
var Options_1 = __webpack_require__(30);
|
|
846
935
|
|
|
847
|
-
var SanitizeProps_1 = __webpack_require__(
|
|
936
|
+
var SanitizeProps_1 = __webpack_require__(31);
|
|
848
937
|
|
|
849
938
|
var styled_components_1 = __webpack_require__(4);
|
|
850
939
|
|
|
851
|
-
var SplunkVisualization_1 = __webpack_require__(
|
|
940
|
+
var SplunkVisualization_1 = __webpack_require__(32);
|
|
852
941
|
|
|
853
942
|
var VizBehavior_1 = __webpack_require__(5);
|
|
854
943
|
|
|
@@ -856,9 +945,9 @@ var getSorting_1 = __webpack_require__(23);
|
|
|
856
945
|
|
|
857
946
|
var getPagination_1 = __webpack_require__(24);
|
|
858
947
|
|
|
859
|
-
var useDeepMemo_1 = __webpack_require__(
|
|
948
|
+
var useDeepMemo_1 = __webpack_require__(35);
|
|
860
949
|
|
|
861
|
-
var JSONSchemaUtils_1 = __webpack_require__(
|
|
950
|
+
var JSONSchemaUtils_1 = __webpack_require__(25);
|
|
862
951
|
|
|
863
952
|
var MissingPropsMessage_1 = __webpack_require__(36);
|
|
864
953
|
|
|
@@ -920,7 +1009,7 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
920
1009
|
try {
|
|
921
1010
|
return Options_1.Options.evaluate({
|
|
922
1011
|
context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
|
|
923
|
-
options: hocUtils_1.
|
|
1012
|
+
options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
|
|
924
1013
|
}, dataSources, themeFunc);
|
|
925
1014
|
} catch (e) {
|
|
926
1015
|
// eslint-disable-next-line no-console
|
|
@@ -1050,25 +1139,25 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1050
1139
|
exports.default = withDashboardViz;
|
|
1051
1140
|
|
|
1052
1141
|
/***/ }),
|
|
1053
|
-
/*
|
|
1142
|
+
/* 29 */
|
|
1054
1143
|
/***/ (function(module, exports) {
|
|
1055
1144
|
|
|
1056
1145
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1057
1146
|
|
|
1058
1147
|
/***/ }),
|
|
1059
|
-
/*
|
|
1148
|
+
/* 30 */
|
|
1060
1149
|
/***/ (function(module, exports) {
|
|
1061
1150
|
|
|
1062
1151
|
module.exports = require("@splunk/visualization-encoding/Options");
|
|
1063
1152
|
|
|
1064
1153
|
/***/ }),
|
|
1065
|
-
/*
|
|
1154
|
+
/* 31 */
|
|
1066
1155
|
/***/ (function(module, exports) {
|
|
1067
1156
|
|
|
1068
1157
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1069
1158
|
|
|
1070
1159
|
/***/ }),
|
|
1071
|
-
/*
|
|
1160
|
+
/* 32 */
|
|
1072
1161
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1073
1162
|
|
|
1074
1163
|
"use strict";
|
|
@@ -1086,7 +1175,7 @@ var T = __webpack_require__(0);
|
|
|
1086
1175
|
|
|
1087
1176
|
var lodash_1 = __webpack_require__(2);
|
|
1088
1177
|
|
|
1089
|
-
var VizActionHandler_1 = __webpack_require__(
|
|
1178
|
+
var VizActionHandler_1 = __webpack_require__(33); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1090
1179
|
|
|
1091
1180
|
|
|
1092
1181
|
exports.INITIAL_WIDTH = 250;
|
|
@@ -1219,7 +1308,7 @@ SplunkVisualization.defaultProps = {
|
|
|
1219
1308
|
exports.default = SplunkVisualization;
|
|
1220
1309
|
|
|
1221
1310
|
/***/ }),
|
|
1222
|
-
/*
|
|
1311
|
+
/* 33 */
|
|
1223
1312
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1224
1313
|
|
|
1225
1314
|
"use strict";
|
|
@@ -1256,7 +1345,7 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
1256
1345
|
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1257
1346
|
|
|
1258
1347
|
/***/ }),
|
|
1259
|
-
/*
|
|
1348
|
+
/* 34 */
|
|
1260
1349
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1261
1350
|
|
|
1262
1351
|
"use strict";
|
|
@@ -1269,7 +1358,7 @@ exports.validSortDirs = void 0;
|
|
|
1269
1358
|
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1270
1359
|
|
|
1271
1360
|
/***/ }),
|
|
1272
|
-
/*
|
|
1361
|
+
/* 35 */
|
|
1273
1362
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1274
1363
|
|
|
1275
1364
|
"use strict";
|
|
@@ -1313,39 +1402,6 @@ var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
|
1313
1402
|
|
|
1314
1403
|
exports.useDeepMemo = useDeepMemo;
|
|
1315
1404
|
|
|
1316
|
-
/***/ }),
|
|
1317
|
-
/* 35 */
|
|
1318
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1319
|
-
|
|
1320
|
-
"use strict";
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1324
|
-
value: true
|
|
1325
|
-
});
|
|
1326
|
-
exports.pickFieldFromJSONSchema = void 0;
|
|
1327
|
-
|
|
1328
|
-
var lodash_1 = __webpack_require__(2);
|
|
1329
|
-
|
|
1330
|
-
var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
|
|
1331
|
-
var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
|
1332
|
-
return Object.keys(optionsSchema).reduce(function (accum, k) {
|
|
1333
|
-
if (lodash_1.has(optionsSchema[k], fieldName)) {
|
|
1334
|
-
accum[k] = optionsSchema[k][fieldName];
|
|
1335
|
-
} else if (lodash_1.get(optionsSchema, [k, 'type']) === 'object' && lodash_1.has(optionsSchema[k], 'properties')) {
|
|
1336
|
-
var nestedSchema = exports.pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);
|
|
1337
|
-
|
|
1338
|
-
if (!lodash_1.isEmpty(nestedSchema)) {
|
|
1339
|
-
accum[k] = nestedSchema;
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
return accum;
|
|
1344
|
-
}, {});
|
|
1345
|
-
};
|
|
1346
|
-
|
|
1347
|
-
exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
|
|
1348
|
-
|
|
1349
1405
|
/***/ }),
|
|
1350
1406
|
/* 36 */
|
|
1351
1407
|
/***/ (function(module, exports, __webpack_require__) {
|
|
@@ -1448,7 +1504,7 @@ var Cover = styled_components_1.default.div.withConfig({
|
|
|
1448
1504
|
componentId: "sc-1gsbnxb-0"
|
|
1449
1505
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
1450
1506
|
var Blocker = styled_components_1.default.div.attrs({
|
|
1451
|
-
'data-splunk-visualization-version': "24.3.
|
|
1507
|
+
'data-splunk-visualization-version': "24.3.3 - 8d441d88c"
|
|
1452
1508
|
}).withConfig({
|
|
1453
1509
|
displayName: "withEditModeCover__Blocker",
|
|
1454
1510
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -1493,7 +1549,7 @@ var React = __webpack_require__(1);
|
|
|
1493
1549
|
|
|
1494
1550
|
var colorUtils_1 = __webpack_require__(11);
|
|
1495
1551
|
|
|
1496
|
-
var IconPlaceholder_1 = __webpack_require__(
|
|
1552
|
+
var IconPlaceholder_1 = __webpack_require__(26);
|
|
1497
1553
|
|
|
1498
1554
|
var VizBehavior_1 = __webpack_require__(5);
|
|
1499
1555
|
|
|
@@ -1734,24 +1790,46 @@ module.exports = require("maplibre-gl");
|
|
|
1734
1790
|
"use strict";
|
|
1735
1791
|
|
|
1736
1792
|
|
|
1793
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
1794
|
+
var t = {};
|
|
1795
|
+
|
|
1796
|
+
for (var p in s) {
|
|
1797
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1801
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1802
|
+
}
|
|
1803
|
+
return t;
|
|
1804
|
+
};
|
|
1805
|
+
|
|
1737
1806
|
Object.defineProperty(exports, "__esModule", {
|
|
1738
1807
|
value: true
|
|
1739
1808
|
});
|
|
1740
1809
|
exports.PureMap = exports.config = exports.themes = exports.computeVizProps = void 0;
|
|
1810
|
+
/* eslint-disable no-sequences */
|
|
1811
|
+
|
|
1812
|
+
var React = __webpack_require__(1);
|
|
1741
1813
|
|
|
1742
1814
|
var colorUtils_1 = __webpack_require__(11);
|
|
1743
1815
|
|
|
1744
1816
|
var types_1 = __webpack_require__(190);
|
|
1745
1817
|
|
|
1746
|
-
var
|
|
1818
|
+
var dsl_1 = __webpack_require__(191);
|
|
1819
|
+
|
|
1820
|
+
var JSONSchemaUtils_1 = __webpack_require__(25);
|
|
1821
|
+
|
|
1822
|
+
var hocUtils_1 = __webpack_require__(7);
|
|
1823
|
+
|
|
1824
|
+
var PureMap_1 = __webpack_require__(192);
|
|
1747
1825
|
|
|
1748
1826
|
exports.PureMap = PureMap_1.default;
|
|
1749
1827
|
|
|
1750
|
-
var config_1 = __webpack_require__(
|
|
1828
|
+
var config_1 = __webpack_require__(200);
|
|
1751
1829
|
|
|
1752
1830
|
exports.config = config_1.default;
|
|
1753
1831
|
|
|
1754
|
-
var withDashboardViz_1 = __webpack_require__(
|
|
1832
|
+
var withDashboardViz_1 = __webpack_require__(28);
|
|
1755
1833
|
|
|
1756
1834
|
var computeVizProps = function computeVizProps(_ref) {
|
|
1757
1835
|
var themeFunc = _ref.themeFunc,
|
|
@@ -1797,8 +1875,121 @@ var computeVizProps = function computeVizProps(_ref) {
|
|
|
1797
1875
|
}), layers);
|
|
1798
1876
|
};
|
|
1799
1877
|
|
|
1800
|
-
exports.computeVizProps = computeVizProps;
|
|
1801
|
-
|
|
1878
|
+
exports.computeVizProps = computeVizProps; // HOC for stripping the internal fields for Maps
|
|
1879
|
+
|
|
1880
|
+
var withoutInternalFields = function withoutInternalFields(Viz) {
|
|
1881
|
+
// eslint-disable-next-line react/display-name
|
|
1882
|
+
var VizWithoutInternalFields = function VizWithoutInternalFields(_a) {
|
|
1883
|
+
var dataSources = _a.dataSources,
|
|
1884
|
+
otherProps = __rest(_a, ["dataSources"]);
|
|
1885
|
+
|
|
1886
|
+
if (!dataSources || !dataSources.primary || !dataSources.primary.data) {
|
|
1887
|
+
return React.createElement(Viz, Object.assign({}, otherProps));
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
var primary = dataSources.primary;
|
|
1891
|
+
var _primary$data = primary.data,
|
|
1892
|
+
columns = _primary$data.columns,
|
|
1893
|
+
fields = _primary$data.fields;
|
|
1894
|
+
var newColumns = [];
|
|
1895
|
+
var newFields = [];
|
|
1896
|
+
|
|
1897
|
+
if (fields && columns && fields.length === columns.length) {
|
|
1898
|
+
// computed sorted index for removal
|
|
1899
|
+
var indicesToRemove = new Set(fields.reduce(function (arr, e, i) {
|
|
1900
|
+
return (typeof e === 'string' ? e.startsWith('_') : e.name.toString().startsWith('_')) && arr.push(i), arr;
|
|
1901
|
+
}, []));
|
|
1902
|
+
newFields = fields.filter(function (d, i) {
|
|
1903
|
+
return !indicesToRemove.has(i);
|
|
1904
|
+
});
|
|
1905
|
+
newColumns = columns.filter(function (d, i) {
|
|
1906
|
+
return !indicesToRemove.has(i);
|
|
1907
|
+
});
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
var modifiedDatasources = Object.assign(Object.assign({}, dataSources), {
|
|
1911
|
+
primary: Object.assign(Object.assign({}, primary), {
|
|
1912
|
+
data: Object.assign(Object.assign({}, primary.data), {
|
|
1913
|
+
columns: newColumns,
|
|
1914
|
+
fields: newFields
|
|
1915
|
+
})
|
|
1916
|
+
})
|
|
1917
|
+
});
|
|
1918
|
+
return React.createElement(Viz, Object.assign({
|
|
1919
|
+
dataSources: modifiedDatasources
|
|
1920
|
+
}, otherProps));
|
|
1921
|
+
};
|
|
1922
|
+
|
|
1923
|
+
VizWithoutInternalFields.propTypes = Viz.propTypes;
|
|
1924
|
+
VizWithoutInternalFields.defaultProps = Viz.defaultProps;
|
|
1925
|
+
VizWithoutInternalFields.config = Viz.config;
|
|
1926
|
+
return VizWithoutInternalFields;
|
|
1927
|
+
}; // HOC for updating all null values in data columns to zeros
|
|
1928
|
+
// excluding 'latitude', 'longitude' and 'geobin'
|
|
1929
|
+
|
|
1930
|
+
|
|
1931
|
+
var withNullToZeros = function withNullToZeros(Viz) {
|
|
1932
|
+
// eslint-disable-next-line react/display-name
|
|
1933
|
+
var VizWithColumnsNullToZeros = function VizWithColumnsNullToZeros(_a) {
|
|
1934
|
+
var dataSources = _a.dataSources,
|
|
1935
|
+
options = _a.options,
|
|
1936
|
+
otherProps = __rest(_a, ["dataSources", "options"]);
|
|
1937
|
+
|
|
1938
|
+
if (!dataSources || !dataSources.primary || !dataSources.primary.data) {
|
|
1939
|
+
return React.createElement(Viz, Object.assign({}, otherProps));
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
var primary = dataSources.primary;
|
|
1943
|
+
var _primary$data2 = primary.data,
|
|
1944
|
+
columns = _primary$data2.columns,
|
|
1945
|
+
fields = _primary$data2.fields;
|
|
1946
|
+
var newColumns = columns;
|
|
1947
|
+
var mergedOptions = hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, JSONSchemaUtils_1.pickFieldFromJSONSchema(config_1.default.optionsSchema, 'default'));
|
|
1948
|
+
|
|
1949
|
+
if (mergedOptions.layers && mergedOptions.layers.length && mergedOptions.layers[0].type === 'bubble') {
|
|
1950
|
+
var latitudeField = dsl_1.getFieldsFromDSL(mergedOptions.layers[0].latitude, dataSources)[0] || '';
|
|
1951
|
+
var longitudeField = dsl_1.getFieldsFromDSL(mergedOptions.layers[0].longitude, dataSources)[0] || '';
|
|
1952
|
+
var excludedFields = [latitudeField, longitudeField, 'geobin'];
|
|
1953
|
+
var indicesToEvaluate = new Set(fields.reduce(function (arr, e, i) {
|
|
1954
|
+
var field = typeof e === 'string' ? e : e.name.toString();
|
|
1955
|
+
|
|
1956
|
+
if (!excludedFields.includes(field)) {
|
|
1957
|
+
arr.push(i);
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
return arr;
|
|
1961
|
+
}, []));
|
|
1962
|
+
newColumns = columns.map(function (column, i) {
|
|
1963
|
+
if (indicesToEvaluate.has(i)) {
|
|
1964
|
+
return column.map(function (value) {
|
|
1965
|
+
return !value ? 0 : value;
|
|
1966
|
+
});
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
return column;
|
|
1970
|
+
});
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
var modifiedDatasources = Object.assign(Object.assign({}, dataSources), {
|
|
1974
|
+
primary: Object.assign(Object.assign({}, primary), {
|
|
1975
|
+
data: Object.assign(Object.assign({}, primary.data), {
|
|
1976
|
+
columns: newColumns
|
|
1977
|
+
})
|
|
1978
|
+
})
|
|
1979
|
+
});
|
|
1980
|
+
return React.createElement(Viz, Object.assign({
|
|
1981
|
+
dataSources: modifiedDatasources,
|
|
1982
|
+
options: options
|
|
1983
|
+
}, otherProps));
|
|
1984
|
+
};
|
|
1985
|
+
|
|
1986
|
+
VizWithColumnsNullToZeros.propTypes = Viz.propTypes;
|
|
1987
|
+
VizWithColumnsNullToZeros.defaultProps = Viz.defaultProps;
|
|
1988
|
+
VizWithColumnsNullToZeros.config = Viz.config;
|
|
1989
|
+
return VizWithColumnsNullToZeros;
|
|
1990
|
+
};
|
|
1991
|
+
|
|
1992
|
+
var Map = withoutInternalFields(withNullToZeros(withDashboardViz_1.default({
|
|
1802
1993
|
ReactViz: PureMap_1.default,
|
|
1803
1994
|
vizConfig: config_1.default,
|
|
1804
1995
|
computeVizProps: exports.computeVizProps,
|
|
@@ -1806,7 +1997,7 @@ var Map = withDashboardViz_1.default({
|
|
|
1806
1997
|
useIconPlaceholder: function useIconPlaceholder() {
|
|
1807
1998
|
return false;
|
|
1808
1999
|
}
|
|
1809
|
-
});
|
|
2000
|
+
})));
|
|
1810
2001
|
var themes = config_1.default.themes;
|
|
1811
2002
|
exports.themes = themes;
|
|
1812
2003
|
exports.default = Map;
|
|
@@ -1819,6 +2010,12 @@ module.exports = require("@splunk/visualization-encoding/utils/types");
|
|
|
1819
2010
|
|
|
1820
2011
|
/***/ }),
|
|
1821
2012
|
/* 191 */
|
|
2013
|
+
/***/ (function(module, exports) {
|
|
2014
|
+
|
|
2015
|
+
module.exports = require("@splunk/visualization-encoding/utils/dsl");
|
|
2016
|
+
|
|
2017
|
+
/***/ }),
|
|
2018
|
+
/* 192 */
|
|
1822
2019
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1823
2020
|
|
|
1824
2021
|
"use strict";
|
|
@@ -1839,19 +2036,19 @@ var react_1 = __webpack_require__(1);
|
|
|
1839
2036
|
|
|
1840
2037
|
var T = __webpack_require__(0);
|
|
1841
2038
|
|
|
1842
|
-
var chroma = __webpack_require__(
|
|
2039
|
+
var chroma = __webpack_require__(193);
|
|
1843
2040
|
|
|
1844
2041
|
var maplibre_gl_1 = __webpack_require__(123);
|
|
1845
2042
|
|
|
1846
|
-
var MapContext_1 = __webpack_require__(
|
|
2043
|
+
var MapContext_1 = __webpack_require__(194);
|
|
1847
2044
|
|
|
1848
|
-
var PureMapContainer_1 = __webpack_require__(
|
|
2045
|
+
var PureMapContainer_1 = __webpack_require__(195);
|
|
1849
2046
|
|
|
1850
|
-
__webpack_require__(
|
|
2047
|
+
__webpack_require__(196);
|
|
1851
2048
|
|
|
1852
|
-
var MapUtils_1 = __webpack_require__(
|
|
2049
|
+
var MapUtils_1 = __webpack_require__(197);
|
|
1853
2050
|
|
|
1854
|
-
var Tooltip_1 = __webpack_require__(
|
|
2051
|
+
var Tooltip_1 = __webpack_require__(199);
|
|
1855
2052
|
|
|
1856
2053
|
exports.DEFAULT_CENTER = [0, 0];
|
|
1857
2054
|
exports.DEFAULT_CONTROL_BACKGROUND_COLOR = '#2b3033';
|
|
@@ -1915,12 +2112,12 @@ var PureMap = function PureMap(props) {
|
|
|
1915
2112
|
return [center[1], center[0]];
|
|
1916
2113
|
}, [center]);
|
|
1917
2114
|
var initializeMap = react_1.useCallback(function (mapStyle) {
|
|
1918
|
-
map.current = new maplibre_gl_1.Map({
|
|
2115
|
+
map.current = new maplibre_gl_1.Map(Object.assign({
|
|
1919
2116
|
container: basemapContainer.current,
|
|
1920
2117
|
style: mapStyle,
|
|
1921
2118
|
center: lngLatCenter,
|
|
1922
2119
|
zoom: zoom
|
|
1923
|
-
}); // Fired immediately after all necessary resources have been downloaded
|
|
2120
|
+
}, MapUtils_1.getZoomConstraintsFromTileConfig(mapStyle))); // Fired immediately after all necessary resources have been downloaded
|
|
1924
2121
|
// and the first visually complete rendering of the map has occurred.
|
|
1925
2122
|
|
|
1926
2123
|
map.current.on('load', function () {
|
|
@@ -1972,6 +2169,13 @@ var PureMap = function PureMap(props) {
|
|
|
1972
2169
|
if (map.current) {
|
|
1973
2170
|
// Refer to https://maplibre.org/maplibre-gl-js-docs/api/map/#setstyle-example for options.diff (default is true)
|
|
1974
2171
|
map.current.setStyle(lodash_1.omit(mapStyle, ['theme', 'name', 'key']));
|
|
2172
|
+
|
|
2173
|
+
var _MapUtils_1$getZoomCo = MapUtils_1.getZoomConstraintsFromTileConfig(mapStyle),
|
|
2174
|
+
minZoom = _MapUtils_1$getZoomCo.minZoom,
|
|
2175
|
+
maxZoom = _MapUtils_1$getZoomCo.maxZoom;
|
|
2176
|
+
|
|
2177
|
+
map.current.setMinZoom(minZoom);
|
|
2178
|
+
map.current.setMaxZoom(maxZoom);
|
|
1975
2179
|
updateScale();
|
|
1976
2180
|
} else {
|
|
1977
2181
|
// initialize the map only once with a constructed style from user configured options
|
|
@@ -2047,7 +2251,8 @@ var PureMap = function PureMap(props) {
|
|
|
2047
2251
|
var staticColors = MapUtils_1.getStaticColors(bubbleLayer.bubbleSize.length, bubbleLayer.seriesColors);
|
|
2048
2252
|
|
|
2049
2253
|
if (data && staticColors && staticColors.length) {
|
|
2050
|
-
// render bubbles when layers options get update
|
|
2254
|
+
cleanupLayer(); // render bubbles when layers options get update
|
|
2255
|
+
|
|
2051
2256
|
bubbles = MapUtils_1.updateBubbles(data, zoom, staticColors, bubbleLayer.dataColors, themeColorScheme, map, setTooltipProps); // render bubbles on zoom
|
|
2052
2257
|
|
|
2053
2258
|
map.current.on('zoomend', function () {
|
|
@@ -2139,19 +2344,19 @@ PureMap.defaultProps = {
|
|
|
2139
2344
|
exports.default = PureMap;
|
|
2140
2345
|
|
|
2141
2346
|
/***/ }),
|
|
2142
|
-
/*
|
|
2347
|
+
/* 193 */
|
|
2143
2348
|
/***/ (function(module, exports) {
|
|
2144
2349
|
|
|
2145
2350
|
module.exports = require("chroma-js");
|
|
2146
2351
|
|
|
2147
2352
|
/***/ }),
|
|
2148
|
-
/*
|
|
2353
|
+
/* 194 */
|
|
2149
2354
|
/***/ (function(module, exports) {
|
|
2150
2355
|
|
|
2151
2356
|
module.exports = require("@splunk/visualization-context/MapContext");
|
|
2152
2357
|
|
|
2153
2358
|
/***/ }),
|
|
2154
|
-
/*
|
|
2359
|
+
/* 195 */
|
|
2155
2360
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2156
2361
|
|
|
2157
2362
|
"use strict";
|
|
@@ -2198,13 +2403,13 @@ var PureMapContainer = styled_components_1.default.div.withConfig({
|
|
|
2198
2403
|
exports.default = PureMapContainer;
|
|
2199
2404
|
|
|
2200
2405
|
/***/ }),
|
|
2201
|
-
/*
|
|
2406
|
+
/* 196 */
|
|
2202
2407
|
/***/ (function(module, exports) {
|
|
2203
2408
|
|
|
2204
2409
|
module.exports = require("maplibre-gl/dist/maplibre-gl.css");
|
|
2205
2410
|
|
|
2206
2411
|
/***/ }),
|
|
2207
|
-
/*
|
|
2412
|
+
/* 197 */
|
|
2208
2413
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2209
2414
|
|
|
2210
2415
|
"use strict";
|
|
@@ -2217,7 +2422,7 @@ var _toConsumableArray = __webpack_require__(39);
|
|
|
2217
2422
|
Object.defineProperty(exports, "__esModule", {
|
|
2218
2423
|
value: true
|
|
2219
2424
|
});
|
|
2220
|
-
exports.pieSegment = exports.createPieChart = exports.updateBubbles = exports.bakeBubbleData = exports.transposeArray = exports.matchSize = exports.getStaticColors = exports.getZoomLevelFromGeobin = exports.getMapStyle = exports.getTilePreset = exports.renderMarkerLayer = exports.getMarkerSVGBackgroundImg = exports.MAX_BUBBLE_RADIUS = exports.MIN_BUBBLE_RADIUS = exports.MAP_STYLE_VERSION_NUMBER = exports.DEFAULT_SERIES_COLORS = exports.DEFAULT_CLUSTER_COLOR = exports.DEFAULT_RESULT_LIMIT = void 0;
|
|
2425
|
+
exports.pieSegment = exports.createPieChart = exports.updateBubbles = exports.bakeBubbleData = exports.sanitizeValues = exports.transposeArray = exports.matchSize = exports.getStaticColors = exports.getZoomLevelFromGeobin = exports.getZoomConstraintsFromTileConfig = exports.getMapStyle = exports.getTilePreset = exports.renderMarkerLayer = exports.getMarkerSVGBackgroundImg = exports.MAX_BUBBLE_RADIUS = exports.MIN_BUBBLE_RADIUS = exports.MAP_STYLE_VERSION_NUMBER = exports.DEFAULT_SERIES_COLORS = exports.DEFAULT_CLUSTER_COLOR = exports.DEFAULT_RESULT_LIMIT = void 0;
|
|
2221
2426
|
|
|
2222
2427
|
var maplibre_gl_1 = __webpack_require__(123);
|
|
2223
2428
|
|
|
@@ -2229,16 +2434,17 @@ var colorUtils_1 = __webpack_require__(11);
|
|
|
2229
2434
|
|
|
2230
2435
|
var visualization_color_palettes_1 = __webpack_require__(41);
|
|
2231
2436
|
|
|
2232
|
-
var MarkerIcons_1 = __webpack_require__(
|
|
2437
|
+
var MarkerIcons_1 = __webpack_require__(198);
|
|
2233
2438
|
|
|
2234
2439
|
exports.DEFAULT_RESULT_LIMIT = 1000;
|
|
2235
2440
|
exports.DEFAULT_CLUSTER_COLOR = '#909090';
|
|
2236
2441
|
exports.DEFAULT_SERIES_COLORS = visualization_color_palettes_1.VIZ_CATEGORICAL; // MapLibre requires a map style specification number which is always 8
|
|
2237
2442
|
|
|
2238
|
-
exports.MAP_STYLE_VERSION_NUMBER = 8;
|
|
2443
|
+
exports.MAP_STYLE_VERSION_NUMBER = 8; // currently using one [min, max] value set for bubbles across all zoom levels
|
|
2444
|
+
// TODO: design choices on [min, max] bubble size for different zoom levels
|
|
2445
|
+
|
|
2239
2446
|
exports.MIN_BUBBLE_RADIUS = 4;
|
|
2240
|
-
exports.MAX_BUBBLE_RADIUS = 50; //
|
|
2241
|
-
// Returns marker background img with the requiref fillColor based on the theme
|
|
2447
|
+
exports.MAX_BUBBLE_RADIUS = 50; // Returns marker background img with the requiref fillColor based on the theme
|
|
2242
2448
|
|
|
2243
2449
|
var getMarkerSVGBackgroundImg = function getMarkerSVGBackgroundImg(color, theme) {
|
|
2244
2450
|
var fillColor = color.replace('#', '%23');
|
|
@@ -2428,15 +2634,59 @@ var getMapStyle = function getMapStyle(_ref2) {
|
|
|
2428
2634
|
|
|
2429
2635
|
exports.getMapStyle = getMapStyle;
|
|
2430
2636
|
|
|
2637
|
+
var getZoomConstraintsFromTileConfig = function getZoomConstraintsFromTileConfig(tileConfig) {
|
|
2638
|
+
var sources = tileConfig.sources,
|
|
2639
|
+
layers = tileConfig.layers; // check sources for minzoom maxzoom first
|
|
2640
|
+
|
|
2641
|
+
var sourceKeys = Object.keys(sources);
|
|
2642
|
+
|
|
2643
|
+
for (var i = 0; i < sourceKeys.length; i += 1) {
|
|
2644
|
+
var _sources$sourceKeys$i = sources[sourceKeys[i]],
|
|
2645
|
+
minzoom = _sources$sourceKeys$i.minzoom,
|
|
2646
|
+
maxzoom = _sources$sourceKeys$i.maxzoom;
|
|
2647
|
+
|
|
2648
|
+
if (lodash_1.isNumber(minzoom) && lodash_1.isNumber(maxzoom)) {
|
|
2649
|
+
return {
|
|
2650
|
+
minZoom: minzoom,
|
|
2651
|
+
maxZoom: maxzoom
|
|
2652
|
+
};
|
|
2653
|
+
}
|
|
2654
|
+
} // then check layers
|
|
2655
|
+
|
|
2656
|
+
|
|
2657
|
+
for (var _i = 0; _i < layers.length; _i += 1) {
|
|
2658
|
+
var _layers$_i = layers[_i],
|
|
2659
|
+
_minzoom = _layers$_i.minzoom,
|
|
2660
|
+
_maxzoom = _layers$_i.maxzoom;
|
|
2661
|
+
|
|
2662
|
+
if (lodash_1.isNumber(_minzoom) && lodash_1.isNumber(_maxzoom)) {
|
|
2663
|
+
return {
|
|
2664
|
+
minZoom: _minzoom,
|
|
2665
|
+
maxZoom: _maxzoom
|
|
2666
|
+
};
|
|
2667
|
+
}
|
|
2668
|
+
} // Maplibre default - would reset previous min/maxZoom
|
|
2669
|
+
|
|
2670
|
+
|
|
2671
|
+
return {
|
|
2672
|
+
minZoom: 0,
|
|
2673
|
+
maxZoom: 22
|
|
2674
|
+
};
|
|
2675
|
+
};
|
|
2676
|
+
|
|
2677
|
+
exports.getZoomConstraintsFromTileConfig = getZoomConstraintsFromTileConfig;
|
|
2678
|
+
|
|
2431
2679
|
var getZoomLevelFromGeobin = function getZoomLevelFromGeobin(geobinStr) {
|
|
2680
|
+
var _a;
|
|
2681
|
+
|
|
2432
2682
|
if (!geobinStr) {
|
|
2433
2683
|
return null;
|
|
2434
2684
|
} // geostats cmds return geobin with zoom level 0-18, 0-99 in the geobinPattern covers the range
|
|
2435
2685
|
|
|
2436
2686
|
|
|
2437
|
-
var geobinPattern = /
|
|
2438
|
-
var match =
|
|
2439
|
-
return match && parseInt(match[
|
|
2687
|
+
var geobinPattern = /bin_id_zl_([0-9]{0,2})?_y_/g;
|
|
2688
|
+
var match = geobinPattern.exec(geobinStr);
|
|
2689
|
+
return (_a = (match === null || match === void 0 ? void 0 : match.length) && parseInt(match[1], 10)) !== null && _a !== void 0 ? _a : null;
|
|
2440
2690
|
};
|
|
2441
2691
|
|
|
2442
2692
|
exports.getZoomLevelFromGeobin = getZoomLevelFromGeobin; // Bubble colors - static
|
|
@@ -2489,7 +2739,26 @@ var transposeArray = function transposeArray(array) {
|
|
|
2489
2739
|
});
|
|
2490
2740
|
};
|
|
2491
2741
|
|
|
2492
|
-
exports.transposeArray = transposeArray;
|
|
2742
|
+
exports.transposeArray = transposeArray; // sanitize values: update all null, undefined, or negative values to 0
|
|
2743
|
+
|
|
2744
|
+
var sanitizeValues = function sanitizeValues(values) {
|
|
2745
|
+
// null / undefined
|
|
2746
|
+
if (!values) {
|
|
2747
|
+
return 0;
|
|
2748
|
+
} // number
|
|
2749
|
+
|
|
2750
|
+
|
|
2751
|
+
if (!Array.isArray(values)) {
|
|
2752
|
+
return values > 0 ? values : 0;
|
|
2753
|
+
} // array
|
|
2754
|
+
|
|
2755
|
+
|
|
2756
|
+
return values.map(function (arr) {
|
|
2757
|
+
return exports.sanitizeValues(arr);
|
|
2758
|
+
});
|
|
2759
|
+
};
|
|
2760
|
+
|
|
2761
|
+
exports.sanitizeValues = sanitizeValues;
|
|
2493
2762
|
|
|
2494
2763
|
var bakeBubbleData = function bakeBubbleData(layer) {
|
|
2495
2764
|
var _a;
|
|
@@ -2501,9 +2770,13 @@ var bakeBubbleData = function bakeBubbleData(layer) {
|
|
|
2501
2770
|
// format each value as an array to unify data operations for data series and frames
|
|
2502
2771
|
|
|
2503
2772
|
|
|
2773
|
+
var sanitizedBubbleSize = exports.sanitizeValues(layer.bubbleSize);
|
|
2504
2774
|
var transposedBubbleSize = layer.bubbleSize.map(function (n) {
|
|
2505
2775
|
return [n];
|
|
2506
2776
|
});
|
|
2777
|
+
var transposedSanitizedBubbleSize = sanitizedBubbleSize.map(function (n) {
|
|
2778
|
+
return [n];
|
|
2779
|
+
});
|
|
2507
2780
|
var isPie = false; // format array if bubbleSize is passed as an array of array (data frame)
|
|
2508
2781
|
|
|
2509
2782
|
if (typeof layer.bubbleSize[0] !== 'number') {
|
|
@@ -2514,7 +2787,8 @@ var bakeBubbleData = function bakeBubbleData(layer) {
|
|
|
2514
2787
|
// to [[column0data]]
|
|
2515
2788
|
// for easy access of values at each geo location,
|
|
2516
2789
|
// and min max pie size computation
|
|
2517
|
-
transposedBubbleSize = exports.transposeArray(layer.bubbleSize);
|
|
2790
|
+
transposedBubbleSize = exports.transposeArray(layer.bubbleSize);
|
|
2791
|
+
transposedSanitizedBubbleSize = exports.transposeArray(sanitizedBubbleSize); // if multiple series in the dataframe, set isPie to true
|
|
2518
2792
|
|
|
2519
2793
|
if (layer.bubbleSize.length > 1) {
|
|
2520
2794
|
isPie = true;
|
|
@@ -2529,13 +2803,16 @@ var bakeBubbleData = function bakeBubbleData(layer) {
|
|
|
2529
2803
|
return {
|
|
2530
2804
|
zoom: exports.getZoomLevelFromGeobin(layer.geobin[i]),
|
|
2531
2805
|
values: transposedBubbleSize[i],
|
|
2806
|
+
sanitizedValues: transposedSanitizedBubbleSize[i],
|
|
2532
2807
|
coordinates: [layer.longitude[i], lat]
|
|
2533
2808
|
};
|
|
2809
|
+
}).filter(function (d) {
|
|
2810
|
+
return Boolean(d.values);
|
|
2534
2811
|
}); // compute the min/max value to encode min/max pie or bubble size
|
|
2535
2812
|
|
|
2536
|
-
var min = lodash_1.sum(
|
|
2537
|
-
var max = lodash_1.sum(
|
|
2538
|
-
|
|
2813
|
+
var min = lodash_1.sum(transposedSanitizedBubbleSize[0]);
|
|
2814
|
+
var max = lodash_1.sum(transposedSanitizedBubbleSize[1]);
|
|
2815
|
+
transposedSanitizedBubbleSize.forEach(function (row) {
|
|
2539
2816
|
var bubbleSize = lodash_1.sum(row);
|
|
2540
2817
|
max = bubbleSize > max ? bubbleSize : max;
|
|
2541
2818
|
min = bubbleSize < min ? bubbleSize : min;
|
|
@@ -2545,7 +2822,6 @@ var bakeBubbleData = function bakeBubbleData(layer) {
|
|
|
2545
2822
|
dataRange: [min, max],
|
|
2546
2823
|
isPie: isPie,
|
|
2547
2824
|
resultLimit: layer.resultLimit,
|
|
2548
|
-
transposedBubbleSize: transposedBubbleSize,
|
|
2549
2825
|
bubbleSizeFields: layer.bubbleSizeFields
|
|
2550
2826
|
};
|
|
2551
2827
|
};
|
|
@@ -2560,7 +2836,6 @@ var updateBubbles = function updateBubbles(dataObj, zoomLevel, staticColors, dyn
|
|
|
2560
2836
|
var data = dataObj.data,
|
|
2561
2837
|
dataRange = dataObj.dataRange,
|
|
2562
2838
|
resultLimit = dataObj.resultLimit,
|
|
2563
|
-
transposedBubbleSize = dataObj.transposedBubbleSize,
|
|
2564
2839
|
bubbleSizeFields = dataObj.bubbleSizeFields,
|
|
2565
2840
|
isPie = dataObj.isPie;
|
|
2566
2841
|
|
|
@@ -2588,13 +2863,13 @@ var updateBubbles = function updateBubbles(dataObj, zoomLevel, staticColors, dyn
|
|
|
2588
2863
|
var colors = dynamicColors ? [dataToRender.map(function (obj) {
|
|
2589
2864
|
return colorUtils_1.isColor(dynamicColors[obj.idx]) ? dynamicColors[obj.idx] : exports.DEFAULT_CLUSTER_COLOR;
|
|
2590
2865
|
})[i]] : staticColors;
|
|
2591
|
-
var el = exports.createPieChart(datum.data.
|
|
2866
|
+
var el = exports.createPieChart(datum.data.sanitizedValues, dataRange, colors, themeColor, isPie);
|
|
2592
2867
|
|
|
2593
2868
|
var _datum$data$coordinat = _slicedToArray(datum.data.coordinates, 2),
|
|
2594
2869
|
longitude = _datum$data$coordinat[0],
|
|
2595
2870
|
latitude = _datum$data$coordinat[1];
|
|
2596
2871
|
|
|
2597
|
-
var bubbleSize =
|
|
2872
|
+
var bubbleSize = datum.data.values.map(function (count, index) {
|
|
2598
2873
|
return {
|
|
2599
2874
|
name: bubbleSizeFields[index],
|
|
2600
2875
|
count: count,
|
|
@@ -2624,7 +2899,25 @@ var updateBubbles = function updateBubbles(dataObj, zoomLevel, staticColors, dyn
|
|
|
2624
2899
|
|
|
2625
2900
|
exports.updateBubbles = updateBubbles; // Create an SVG pie from column values
|
|
2626
2901
|
|
|
2627
|
-
var createPieChart = function createPieChart(
|
|
2902
|
+
var createPieChart = function createPieChart(orginalValues, valueRange, colors, themeColor, isPie) {
|
|
2903
|
+
// create a div for pie (bubble)
|
|
2904
|
+
var el = document.createElement('div');
|
|
2905
|
+
var allZeros = true;
|
|
2906
|
+
orginalValues.forEach(function (v) {
|
|
2907
|
+
if (v !== 0) {
|
|
2908
|
+
allZeros = false;
|
|
2909
|
+
}
|
|
2910
|
+
});
|
|
2911
|
+
|
|
2912
|
+
if (allZeros || !orginalValues || !orginalValues.length) {
|
|
2913
|
+
return el;
|
|
2914
|
+
} // sanitize values
|
|
2915
|
+
|
|
2916
|
+
|
|
2917
|
+
var values = orginalValues.map(function (v) {
|
|
2918
|
+
return v > 0 ? v : 0;
|
|
2919
|
+
}); // compute offsets for pie segments
|
|
2920
|
+
|
|
2628
2921
|
var offsets = [];
|
|
2629
2922
|
var total = 0;
|
|
2630
2923
|
values.forEach(function (count) {
|
|
@@ -2645,7 +2938,6 @@ var createPieChart = function createPieChart(values, valueRange, colors, themeCo
|
|
|
2645
2938
|
html += exports.pieSegment(offsets[i] / total, (offsets[i] + v) / total, radius, colors[i], themeColor);
|
|
2646
2939
|
});
|
|
2647
2940
|
html += "</svg>\n </div>";
|
|
2648
|
-
var el = document.createElement('div');
|
|
2649
2941
|
el.className = 'custom-bubble';
|
|
2650
2942
|
el.innerHTML = html;
|
|
2651
2943
|
return el;
|
|
@@ -2671,7 +2963,7 @@ var pieSegment = function pieSegment(start, end, radius, color, themeColor) {
|
|
|
2671
2963
|
exports.pieSegment = pieSegment;
|
|
2672
2964
|
|
|
2673
2965
|
/***/ }),
|
|
2674
|
-
/*
|
|
2966
|
+
/* 198 */
|
|
2675
2967
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2676
2968
|
|
|
2677
2969
|
"use strict";
|
|
@@ -2695,7 +2987,7 @@ var defaultMarkerDarkTheme = function defaultMarkerDarkTheme(fillColor) {
|
|
|
2695
2987
|
exports.defaultMarkerDarkTheme = defaultMarkerDarkTheme;
|
|
2696
2988
|
|
|
2697
2989
|
/***/ }),
|
|
2698
|
-
/*
|
|
2990
|
+
/* 199 */
|
|
2699
2991
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2700
2992
|
|
|
2701
2993
|
"use strict";
|
|
@@ -2737,21 +3029,15 @@ var BubbleSizeColorBlock = styled_components_1.default.div.withConfig({
|
|
|
2737
3029
|
return props.color;
|
|
2738
3030
|
});
|
|
2739
3031
|
|
|
2740
|
-
var convertDegToDMS = function convertDegToDMS(
|
|
2741
|
-
var
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
direction = deg < 0 ? 'W' : 'E';
|
|
2745
|
-
} else if (type === 'latitude') {
|
|
2746
|
-
direction = deg < 0 ? 'S' : 'N';
|
|
2747
|
-
}
|
|
3032
|
+
var convertDegToDMS = function convertDegToDMS(decimalDegree, type) {
|
|
3033
|
+
var truncate = function truncate(n) {
|
|
3034
|
+
return n > 0 ? Math.floor(n) : Math.ceil(n);
|
|
3035
|
+
};
|
|
2748
3036
|
|
|
2749
|
-
var
|
|
2750
|
-
var
|
|
2751
|
-
var minutes =
|
|
2752
|
-
var
|
|
2753
|
-
var seconds = Math.round(secfloat);
|
|
2754
|
-
degrees = Math.abs(degrees);
|
|
3037
|
+
var absoluteDegree = Math.abs(decimalDegree);
|
|
3038
|
+
var degrees = truncate(absoluteDegree);
|
|
3039
|
+
var minutes = truncate((absoluteDegree - degrees) * 60);
|
|
3040
|
+
var seconds = Math.round((absoluteDegree - degrees - minutes / 60) * 3600);
|
|
2755
3041
|
|
|
2756
3042
|
if (seconds === 60) {
|
|
2757
3043
|
minutes += 1;
|
|
@@ -2763,6 +3049,14 @@ var convertDegToDMS = function convertDegToDMS(deg, type) {
|
|
|
2763
3049
|
minutes = 0;
|
|
2764
3050
|
}
|
|
2765
3051
|
|
|
3052
|
+
var direction;
|
|
3053
|
+
|
|
3054
|
+
if (type === 'longitude') {
|
|
3055
|
+
direction = decimalDegree < 0 ? 'W' : 'E';
|
|
3056
|
+
} else if (type === 'latitude') {
|
|
3057
|
+
direction = decimalDegree < 0 ? 'S' : 'N';
|
|
3058
|
+
}
|
|
3059
|
+
|
|
2766
3060
|
return "".concat(degrees, "\xB0 ").concat(minutes, "' ").concat(seconds, "\" ").concat(direction);
|
|
2767
3061
|
};
|
|
2768
3062
|
|
|
@@ -2802,7 +3096,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
2802
3096
|
exports.default = Tooltip;
|
|
2803
3097
|
|
|
2804
3098
|
/***/ }),
|
|
2805
|
-
/*
|
|
3099
|
+
/* 200 */
|
|
2806
3100
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2807
3101
|
|
|
2808
3102
|
"use strict";
|
|
@@ -2824,7 +3118,7 @@ var i18n_1 = __webpack_require__(3);
|
|
|
2824
3118
|
|
|
2825
3119
|
var VizBehavior_1 = __webpack_require__(5);
|
|
2826
3120
|
|
|
2827
|
-
var VizCategory_1 = __webpack_require__(
|
|
3121
|
+
var VizCategory_1 = __webpack_require__(27);
|
|
2828
3122
|
|
|
2829
3123
|
var configUtils_1 = __webpack_require__(6);
|
|
2830
3124
|
|
|
@@ -2882,13 +3176,23 @@ var optionsSchema = {
|
|
|
2882
3176
|
}
|
|
2883
3177
|
},
|
|
2884
3178
|
layers: {
|
|
3179
|
+
// The option merging of defaults and data binding with editing UI happens with the default defined below.
|
|
3180
|
+
// The inner defaults for properties within anyOf objects is used only for code intellisense in UDF to populate options.
|
|
2885
3181
|
default: [{
|
|
2886
3182
|
type: 'bubble',
|
|
2887
3183
|
latitude: '> primary | seriesByName("latitude")',
|
|
2888
3184
|
longitude: '> primary | seriesByName("longitude")',
|
|
2889
3185
|
seriesColors: visualization_color_palettes_1.VIZ_CATEGORICAL,
|
|
2890
3186
|
bubbleSize: '> primary | frameWithoutSeriesNames("geobin", "latitude", "longitude") | frameBySeriesTypes("number")',
|
|
2891
|
-
tooltipFields: []
|
|
3187
|
+
tooltipFields: [],
|
|
3188
|
+
resultLimit: 1000
|
|
3189
|
+
}, {
|
|
3190
|
+
type: 'marker',
|
|
3191
|
+
latitude: '> primary | seriesByName("latitude")',
|
|
3192
|
+
longitude: '> primary | seriesByName("longitude")',
|
|
3193
|
+
seriesColors: visualization_color_palettes_1.VIZ_CATEGORICAL,
|
|
3194
|
+
tooltipFields: [],
|
|
3195
|
+
resultLimit: 1000
|
|
2892
3196
|
}],
|
|
2893
3197
|
type: 'array',
|
|
2894
3198
|
description: 'Specify the data visualization layers on top of the base map. Can be empty to only show the base map.',
|
|
@@ -2917,13 +3221,13 @@ var optionsSchema = {
|
|
|
2917
3221
|
type: ['string', 'array']
|
|
2918
3222
|
},
|
|
2919
3223
|
seriesColors: {
|
|
2920
|
-
default: visualization_color_palettes_1.VIZ_CATEGORICAL,
|
|
2921
3224
|
description: 'Specify the colors used for data points.',
|
|
2922
3225
|
type: 'array',
|
|
2923
3226
|
items: {
|
|
2924
3227
|
type: 'string',
|
|
2925
3228
|
pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA
|
|
2926
|
-
}
|
|
3229
|
+
},
|
|
3230
|
+
default: visualization_color_palettes_1.VIZ_CATEGORICAL
|
|
2927
3231
|
},
|
|
2928
3232
|
tooltipFields: {
|
|
2929
3233
|
description: 'Specify the fields to add to tooltips shown while hovering over data points. These fields and their corresponding values will be shown in addition to the ones displayed by default.',
|
|
@@ -2974,13 +3278,13 @@ var optionsSchema = {
|
|
|
2974
3278
|
type: ['string', 'array']
|
|
2975
3279
|
},
|
|
2976
3280
|
seriesColors: {
|
|
2977
|
-
default: visualization_color_palettes_1.VIZ_CATEGORICAL,
|
|
2978
3281
|
description: "Specify the colors used for data points. For example, [\"#FF0000\", \"#0000FF\", \"#008000\"].",
|
|
2979
3282
|
type: 'array',
|
|
2980
3283
|
items: {
|
|
2981
3284
|
type: 'string',
|
|
2982
3285
|
pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA
|
|
2983
|
-
}
|
|
3286
|
+
},
|
|
3287
|
+
default: visualization_color_palettes_1.VIZ_CATEGORICAL
|
|
2984
3288
|
},
|
|
2985
3289
|
tooltipFields: {
|
|
2986
3290
|
description: 'Specify the fields to add to tooltips shown while hovering over data points. These fields and their corresponding values will be shown in addition to the ones displayed by default.',
|
|
@@ -3092,7 +3396,7 @@ var editorConfig = [{
|
|
|
3092
3396
|
editor: 'editor.columnSelector',
|
|
3093
3397
|
showEditor: function showEditor(_ref) {
|
|
3094
3398
|
var options = _ref.options;
|
|
3095
|
-
return options.layers && options.layers.length && options.layers[0].type === '
|
|
3399
|
+
return !(options.layers && options.layers.length && options.layers[0].type === 'marker');
|
|
3096
3400
|
},
|
|
3097
3401
|
editorProps: {
|
|
3098
3402
|
dataSourceKey: 'primary'
|