@splunk/visualizations 24.0.0 → 24.3.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_PureVisualizations_PureFillerGauge_Orientation_horizontal_height_90_show_placeholder.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureFillerGauge_Too_Small_to_Render.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Background_Color.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Field_Order.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Field_Order_First_And_Last.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Field_Order_Some.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Fields_Columns.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Handles_Large_Data_Set.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Link_Color.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Link_Width.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Node_Color.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Node_Height.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Node_Highlight_Color.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Node_Spacing_X.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Node_Spacing_Y.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Node_Width.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Result_Limit.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Show_Node_Counts_False.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Show_Value_Counts_False.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Width_Height.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_Dark.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_Hover.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_Light.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_base_map_light.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_basic.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_dynamic_color.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_geostats_by.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_static_color.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_static_color_with_no_seriesColors.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_center_seattle.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_dynamic_color.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_static_color.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_static_color_with_no_seriesColors.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_PureVisualizations_PureMap_zoom_9.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_duplicate_entries_from.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_duplicate_entries_to.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_invalid_entries_discontinuous_ranges.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_invalid_entries_from_equals_to_to.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_invalid_entries_from_is_larger_than_to.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_missing_entries.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Orientation_horizontal_width_150_show_placeholder.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Too_Small_to_Render.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureSankey_dimensions_less_than_minWidth_300_and_minHeight_200.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureSankey_invalid_columns_data.png +0 -0
- package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Map_Editor.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Choropleth_Svg_Choropleth_Svg_Missing_Props_Message_When_No_Svg.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Filler_Gauge_Filler_Gauge_Orientation_horizontal_height_90_show_placeholder.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Line_Line_Basic_Line_with_offset_IANA_timezone.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Line_Line_Basic_Line_with_offset_serialized_timezone.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Line_Line_Basic_Line_with_offset_utc_timezone.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Basic_LinkGraph.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Field_Order_First_and_Last_Fields.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Field_Order_From_the_First_to_the_Last_Fields.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Field_Order_From_the_Last_to_the_First_Fields.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Node_Text_Color.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Node_Text_Highlight_Color.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Result_Limit_3.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Basic_Map.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_GET.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_GET_Dynamic_Coloring.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Static_Coloring.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_Dynamic_Coloring.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_Dynamic_coloring.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_Result_Limit_Set_To_3.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_with_geostats_data_No_render.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Set_Map_tiles.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Pie_Pie_Missing_Column.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Sankey_Sankey_Dimension_Too_Small.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_By_Type_Custom.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Default.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Kitchen_Sink.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Right.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Single_Column.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Color_light_blue.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_No_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table_With_No_Click.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Cell_Types.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Gradient.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Override.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Count_2.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Header_Colors.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Row_Colors.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_No_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number_Adv.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Visibility_fixed.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Visibility_none.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage_100_no_paginator.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Invalid_Background_Color.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Multi_Value_Field.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes_Row_Numbers.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_false.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_true_default.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Row_Numbers_true.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Custom.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Width.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparklines_Adv.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Formatting.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Gradient.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Time_Formatting.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Height.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Percentage.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Px.png +0 -0
- package/Area.config.js +19 -15
- package/Area.config.js.map +1 -1
- package/Area.js +102 -82
- package/Area.js.map +1 -1
- package/Bar.config.js +15 -15
- package/Bar.config.js.map +1 -1
- package/Bar.js +91 -75
- package/Bar.js.map +1 -1
- package/Bubble.config.js +8 -8
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +82 -66
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +11 -9
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +92 -82
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +15 -15
- package/Column.config.js.map +1 -1
- package/Column.js +91 -75
- package/Column.js.map +1 -1
- package/Ellipse.config.js +22 -6
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +80 -56
- package/Ellipse.js.map +1 -1
- package/FillerGauge.config.js +8 -8
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +64 -56
- package/FillerGauge.js.map +1 -1
- package/Image.js +46 -41
- package/Image.js.map +1 -1
- package/Line.config.js +8 -8
- package/Line.config.js.map +1 -1
- package/Line.js +89 -73
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +52 -5
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +161 -90
- package/LinkGraph.js.map +1 -1
- package/Map.config.js +740 -0
- package/Map.config.js.map +1 -0
- package/Map.js +3137 -0
- package/Map.js.map +1 -0
- package/Markdown.config.js +12 -16
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +57 -56
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +6 -6
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +2960 -3046
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +11 -11
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +97 -78
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +13 -17
- package/Pie.config.js.map +1 -1
- package/Pie.js +917 -999
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +11 -11
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +114 -95
- package/Punchcard.js.map +1 -1
- package/README.internal.md +36 -3
- package/README.md +7 -9
- package/Rectangle.config.js +32 -16
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +153 -132
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +35 -25
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +2951 -3045
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +11 -11
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +301 -286
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +23 -22
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +271 -266
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +14 -14
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +33 -34
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +156 -140
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +22 -22
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +301 -296
- package/SingleValueRadial.js.map +1 -1
- package/Table.config.js +28 -8
- package/Table.config.js.map +1 -1
- package/Table.js +427 -259
- package/Table.js.map +1 -1
- package/common/Charting.js +19 -10
- package/common/Charting.js.map +1 -1
- package/common/EventsDoc.js +3 -2
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +2 -2
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +2 -2
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +10 -9
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +22 -22
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualizationApi.js +2 -2
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +2 -2
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +2 -2
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +4 -4
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +7 -7
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +8 -8
- package/common/shapeUtils.js.map +1 -1
- package/common/withDashboardViz.js +38 -32
- package/common/withDashboardViz.js.map +1 -1
- package/loki.config.js +2 -0
- package/package.json +20 -15
- package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValueRadial_Trend_Indicator_Position_pushed_below_value_does_not_fit_inside_of_radial.png +0 -0
package/Map.js
ADDED
|
@@ -0,0 +1,3137 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright © 2018 Splunk Inc.
|
|
3
|
+
* SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
4
|
+
* in part without a valid written license from Splunk Inc. is PROHIBITED.
|
|
5
|
+
*/
|
|
6
|
+
module.exports =
|
|
7
|
+
/******/ (function(modules) { // webpackBootstrap
|
|
8
|
+
/******/ // The module cache
|
|
9
|
+
/******/ var installedModules = {};
|
|
10
|
+
/******/
|
|
11
|
+
/******/ // The require function
|
|
12
|
+
/******/ function __webpack_require__(moduleId) {
|
|
13
|
+
/******/
|
|
14
|
+
/******/ // Check if module is in cache
|
|
15
|
+
/******/ if(installedModules[moduleId]) {
|
|
16
|
+
/******/ return installedModules[moduleId].exports;
|
|
17
|
+
/******/ }
|
|
18
|
+
/******/ // Create a new module (and put it into the cache)
|
|
19
|
+
/******/ var module = installedModules[moduleId] = {
|
|
20
|
+
/******/ i: moduleId,
|
|
21
|
+
/******/ l: false,
|
|
22
|
+
/******/ exports: {}
|
|
23
|
+
/******/ };
|
|
24
|
+
/******/
|
|
25
|
+
/******/ // Execute the module function
|
|
26
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
27
|
+
/******/
|
|
28
|
+
/******/ // Flag the module as loaded
|
|
29
|
+
/******/ module.l = true;
|
|
30
|
+
/******/
|
|
31
|
+
/******/ // Return the exports of the module
|
|
32
|
+
/******/ return module.exports;
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/
|
|
35
|
+
/******/
|
|
36
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
37
|
+
/******/ __webpack_require__.m = modules;
|
|
38
|
+
/******/
|
|
39
|
+
/******/ // expose the module cache
|
|
40
|
+
/******/ __webpack_require__.c = installedModules;
|
|
41
|
+
/******/
|
|
42
|
+
/******/ // define getter function for harmony exports
|
|
43
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
44
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
45
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
46
|
+
/******/ }
|
|
47
|
+
/******/ };
|
|
48
|
+
/******/
|
|
49
|
+
/******/ // define __esModule on exports
|
|
50
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
51
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
52
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
53
|
+
/******/ }
|
|
54
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
55
|
+
/******/ };
|
|
56
|
+
/******/
|
|
57
|
+
/******/ // create a fake namespace object
|
|
58
|
+
/******/ // mode & 1: value is a module id, require it
|
|
59
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
60
|
+
/******/ // mode & 4: return value when already ns object
|
|
61
|
+
/******/ // mode & 8|1: behave like require
|
|
62
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
63
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
64
|
+
/******/ if(mode & 8) return value;
|
|
65
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
66
|
+
/******/ var ns = Object.create(null);
|
|
67
|
+
/******/ __webpack_require__.r(ns);
|
|
68
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
69
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
70
|
+
/******/ return ns;
|
|
71
|
+
/******/ };
|
|
72
|
+
/******/
|
|
73
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
74
|
+
/******/ __webpack_require__.n = function(module) {
|
|
75
|
+
/******/ var getter = module && module.__esModule ?
|
|
76
|
+
/******/ function getDefault() { return module['default']; } :
|
|
77
|
+
/******/ function getModuleExports() { return module; };
|
|
78
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
79
|
+
/******/ return getter;
|
|
80
|
+
/******/ };
|
|
81
|
+
/******/
|
|
82
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
83
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
84
|
+
/******/
|
|
85
|
+
/******/ // __webpack_public_path__
|
|
86
|
+
/******/ __webpack_require__.p = "";
|
|
87
|
+
/******/
|
|
88
|
+
/******/
|
|
89
|
+
/******/ // Load entry module and return exports
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 189);
|
|
91
|
+
/******/ })
|
|
92
|
+
/************************************************************************/
|
|
93
|
+
/******/ ([
|
|
94
|
+
/* 0 */
|
|
95
|
+
/***/ (function(module, exports) {
|
|
96
|
+
|
|
97
|
+
module.exports = require("prop-types");
|
|
98
|
+
|
|
99
|
+
/***/ }),
|
|
100
|
+
/* 1 */
|
|
101
|
+
/***/ (function(module, exports) {
|
|
102
|
+
|
|
103
|
+
module.exports = require("react");
|
|
104
|
+
|
|
105
|
+
/***/ }),
|
|
106
|
+
/* 2 */
|
|
107
|
+
/***/ (function(module, exports) {
|
|
108
|
+
|
|
109
|
+
module.exports = require("lodash");
|
|
110
|
+
|
|
111
|
+
/***/ }),
|
|
112
|
+
/* 3 */
|
|
113
|
+
/***/ (function(module, exports) {
|
|
114
|
+
|
|
115
|
+
module.exports = require("@splunk/ui-utils/i18n");
|
|
116
|
+
|
|
117
|
+
/***/ }),
|
|
118
|
+
/* 4 */
|
|
119
|
+
/***/ (function(module, exports) {
|
|
120
|
+
|
|
121
|
+
module.exports = require("styled-components");
|
|
122
|
+
|
|
123
|
+
/***/ }),
|
|
124
|
+
/* 5 */
|
|
125
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
126
|
+
|
|
127
|
+
"use strict";
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
Object.defineProperty(exports, "__esModule", {
|
|
131
|
+
value: true
|
|
132
|
+
});
|
|
133
|
+
exports.VizBehavior = void 0;
|
|
134
|
+
var VizBehavior;
|
|
135
|
+
|
|
136
|
+
(function (VizBehavior) {
|
|
137
|
+
/**
|
|
138
|
+
* Dynamic Options Behavior.
|
|
139
|
+
* This allows visualization options to be powered by data
|
|
140
|
+
*
|
|
141
|
+
* **Example**
|
|
142
|
+
*
|
|
143
|
+
* sparklineValues: ">primary|seriesByIndex(0)"
|
|
144
|
+
* would configure sparklineValues with an array of data points
|
|
145
|
+
* coming from the first series in the primary datasource
|
|
146
|
+
*
|
|
147
|
+
*/
|
|
148
|
+
VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
|
|
149
|
+
VizBehavior["EVENTS"] = "events";
|
|
150
|
+
/**
|
|
151
|
+
* Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
|
|
152
|
+
* missing.
|
|
153
|
+
* @type {string}
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
157
|
+
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
158
|
+
})(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
|
|
159
|
+
|
|
160
|
+
/***/ }),
|
|
161
|
+
/* 6 */
|
|
162
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
163
|
+
|
|
164
|
+
"use strict";
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
var _defineProperty = __webpack_require__(8);
|
|
168
|
+
|
|
169
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
170
|
+
var t = {};
|
|
171
|
+
|
|
172
|
+
for (var p in s) {
|
|
173
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
177
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
178
|
+
}
|
|
179
|
+
return t;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
Object.defineProperty(exports, "__esModule", {
|
|
183
|
+
value: true
|
|
184
|
+
});
|
|
185
|
+
exports.generatePrecisionValues = exports.getInitialPreset = exports.isDynamicOption = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
186
|
+
|
|
187
|
+
var lodash_1 = __webpack_require__(2);
|
|
188
|
+
|
|
189
|
+
var schemaUtils_1 = __webpack_require__(14);
|
|
190
|
+
|
|
191
|
+
var VizBehavior_1 = __webpack_require__(5);
|
|
192
|
+
|
|
193
|
+
var dynamicOptionsDSLType = {
|
|
194
|
+
type: 'string',
|
|
195
|
+
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Helper function to extend an options schema with dynamic options DSL
|
|
199
|
+
* @param optionsSchema a visualization's options schema
|
|
200
|
+
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
204
|
+
var enhancedOptionsSchema = {};
|
|
205
|
+
Object.keys(optionsSchema).forEach(function (key) {
|
|
206
|
+
var _a = optionsSchema[key],
|
|
207
|
+
title = _a.title,
|
|
208
|
+
description = _a.description,
|
|
209
|
+
readOnly = _a.readOnly,
|
|
210
|
+
writeOnly = _a.writeOnly,
|
|
211
|
+
examples = _a.examples,
|
|
212
|
+
defaultValue = _a.default,
|
|
213
|
+
type = _a.type,
|
|
214
|
+
properties = _a.properties,
|
|
215
|
+
patternProperties = _a.patternProperties,
|
|
216
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
217
|
+
|
|
218
|
+
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
219
|
+
title: title
|
|
220
|
+
}), description !== undefined && {
|
|
221
|
+
description: description
|
|
222
|
+
}), readOnly !== undefined && {
|
|
223
|
+
readOnly: readOnly
|
|
224
|
+
}), writeOnly !== undefined && {
|
|
225
|
+
writeOnly: writeOnly
|
|
226
|
+
}), examples !== undefined && {
|
|
227
|
+
examples: examples
|
|
228
|
+
}), defaultValue !== undefined && {
|
|
229
|
+
default: defaultValue
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
if (type === 'object') {
|
|
233
|
+
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
234
|
+
type: type
|
|
235
|
+
}), properties && {
|
|
236
|
+
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
if (patternProperties) {
|
|
240
|
+
var enhancedPatternProperties = {};
|
|
241
|
+
Object.keys(patternProperties).forEach(function (opt) {
|
|
242
|
+
enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
|
|
243
|
+
});
|
|
244
|
+
enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
|
|
245
|
+
}
|
|
246
|
+
} else {
|
|
247
|
+
enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
|
|
248
|
+
anyOf: [Object.assign(Object.assign({}, type !== undefined && {
|
|
249
|
+
type: type
|
|
250
|
+
}), remainingSchemaEntry), dynamicOptionsDSLType]
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
return enhancedOptionsSchema;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
258
|
+
/**
|
|
259
|
+
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
260
|
+
* @param vizConfig a Visualization Config
|
|
261
|
+
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
262
|
+
*/
|
|
263
|
+
|
|
264
|
+
function enhanceConfig(vizConfig) {
|
|
265
|
+
var enhancedConfig = vizConfig;
|
|
266
|
+
|
|
267
|
+
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
268
|
+
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return enhancedConfig;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
exports.enhanceConfig = enhanceConfig;
|
|
275
|
+
|
|
276
|
+
function isDynamicOption(option) {
|
|
277
|
+
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
281
|
+
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
285
|
+
* if a preset has explicitly specified a key as being undefined, the vizContext must also has that key as undefined, or else this CANNOT be the initialPreset
|
|
286
|
+
* the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
|
|
287
|
+
* the internal config contents are irrelevant (as the user could customize them in source), just as long as the presence of `undefined`s match up
|
|
288
|
+
*
|
|
289
|
+
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
290
|
+
*/
|
|
291
|
+
|
|
292
|
+
function hasCompatibleContexts(vizContext, presetContext) {
|
|
293
|
+
var presetContextKeys = Object.keys(presetContext);
|
|
294
|
+
return presetContextKeys.every(function (contextKey) {
|
|
295
|
+
return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
300
|
+
*/
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
304
|
+
var presetOptionKeys = Object.keys(presetOptions);
|
|
305
|
+
return presetOptionKeys.every(function (optionKey) {
|
|
306
|
+
return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
|
|
311
|
+
* This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
|
|
312
|
+
*
|
|
313
|
+
* @param {Object} vizContext - the current vizContext definition
|
|
314
|
+
* @param {Object} vizOptions - the current vizOptions definition
|
|
315
|
+
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
316
|
+
*/
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
320
|
+
return presets.find(function (preset) {
|
|
321
|
+
var presetContext = lodash_1.get(preset, ['value', 'context'], {});
|
|
322
|
+
var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
|
|
323
|
+
var presetContextKeys = Object.keys(presetContext);
|
|
324
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
325
|
+
// if not, then the preset is invalid in config.ts
|
|
326
|
+
|
|
327
|
+
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
328
|
+
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
exports.getInitialPreset = getInitialPreset;
|
|
333
|
+
/**
|
|
334
|
+
* generates number precision values for a Select editor
|
|
335
|
+
*
|
|
336
|
+
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
337
|
+
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
338
|
+
*/
|
|
339
|
+
|
|
340
|
+
function generatePrecisionValues(numPrecisionValues) {
|
|
341
|
+
return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
|
|
342
|
+
return {
|
|
343
|
+
label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
|
|
344
|
+
value: i
|
|
345
|
+
};
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
exports.generatePrecisionValues = generatePrecisionValues;
|
|
350
|
+
|
|
351
|
+
/***/ }),
|
|
352
|
+
/* 7 */
|
|
353
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
354
|
+
|
|
355
|
+
"use strict";
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
var _typeof = __webpack_require__(20);
|
|
359
|
+
|
|
360
|
+
Object.defineProperty(exports, "__esModule", {
|
|
361
|
+
value: true
|
|
362
|
+
});
|
|
363
|
+
exports.deepMergeWithArrayOverrides = exports.extendStaticWrapperProps = void 0;
|
|
364
|
+
|
|
365
|
+
var lodash_1 = __webpack_require__(2);
|
|
366
|
+
/**
|
|
367
|
+
* @method extendStaticWrapperProps
|
|
368
|
+
* @param {Object} props
|
|
369
|
+
* @param {DashboardVizType} props.Wrapper
|
|
370
|
+
* @param {DashboardVizType} props.Visualization
|
|
371
|
+
*/
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
375
|
+
var Wrapper = _ref.Wrapper,
|
|
376
|
+
Visualization = _ref.Visualization;
|
|
377
|
+
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
378
|
+
extendProperties.forEach(function (prop) {
|
|
379
|
+
if (Visualization[prop]) {
|
|
380
|
+
// eslint-disable-next-line no-param-reassign
|
|
381
|
+
Wrapper[prop] = Visualization[prop];
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
387
|
+
/**
|
|
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)
|
|
391
|
+
*
|
|
392
|
+
* @method deepMergeWithArrayOverrides
|
|
393
|
+
* @param {Object} initial - target object to merge values into
|
|
394
|
+
* @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
|
+
*
|
|
396
|
+
* @returns {Object}
|
|
397
|
+
*/
|
|
398
|
+
|
|
399
|
+
var deepMergeWithArrayOverrides = function deepMergeWithArrayOverrides(initial) {
|
|
400
|
+
var clone = lodash_1.cloneDeep(initial);
|
|
401
|
+
|
|
402
|
+
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
403
|
+
sources[_key - 1] = arguments[_key];
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
sources.forEach(function (sourceToApply) {
|
|
407
|
+
Object.keys(sourceToApply).forEach(function (sourceKey) {
|
|
408
|
+
if (!Object.prototype.hasOwnProperty.call(clone, sourceKey)) {
|
|
409
|
+
clone[sourceKey] = lodash_1.cloneDeep(sourceToApply[sourceKey]);
|
|
410
|
+
} // object merging excluding arrays
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
if (clone[sourceKey] && _typeof(clone[sourceKey]) === 'object' && !Array.isArray(clone[sourceKey]) && _typeof(sourceToApply[sourceKey]) === 'object') {
|
|
414
|
+
clone[sourceKey] = exports.deepMergeWithArrayOverrides(clone[sourceKey], sourceToApply[sourceKey]);
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
return clone;
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
exports.deepMergeWithArrayOverrides = deepMergeWithArrayOverrides;
|
|
422
|
+
|
|
423
|
+
/***/ }),
|
|
424
|
+
/* 8 */
|
|
425
|
+
/***/ (function(module, exports) {
|
|
426
|
+
|
|
427
|
+
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
428
|
+
|
|
429
|
+
/***/ }),
|
|
430
|
+
/* 9 */
|
|
431
|
+
/***/ (function(module, exports) {
|
|
432
|
+
|
|
433
|
+
module.exports = require("@splunk/visualizations-shared/Message");
|
|
434
|
+
|
|
435
|
+
/***/ }),
|
|
436
|
+
/* 10 */
|
|
437
|
+
/***/ (function(module, exports) {
|
|
438
|
+
|
|
439
|
+
module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
440
|
+
|
|
441
|
+
/***/ }),
|
|
442
|
+
/* 11 */
|
|
443
|
+
/***/ (function(module, exports) {
|
|
444
|
+
|
|
445
|
+
module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
446
|
+
|
|
447
|
+
/***/ }),
|
|
448
|
+
/* 12 */
|
|
449
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
450
|
+
|
|
451
|
+
"use strict";
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
Object.defineProperty(exports, "__esModule", {
|
|
455
|
+
value: true
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
var React = __webpack_require__(1);
|
|
459
|
+
|
|
460
|
+
var styled_components_1 = __webpack_require__(4);
|
|
461
|
+
|
|
462
|
+
var SizeAwareWrapper_1 = __webpack_require__(16);
|
|
463
|
+
|
|
464
|
+
var style_1 = __webpack_require__(13);
|
|
465
|
+
|
|
466
|
+
var colorUtils_1 = __webpack_require__(11);
|
|
467
|
+
|
|
468
|
+
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
469
|
+
var width = _ref.width;
|
|
470
|
+
return {
|
|
471
|
+
style: {
|
|
472
|
+
width: style_1.toPx(width)
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
}).withConfig({
|
|
476
|
+
displayName: "FixedSizeContainer__Item",
|
|
477
|
+
componentId: "sc-1yhgpod-0"
|
|
478
|
+
})(["position:relative;background-color:", "};"], function (props) {
|
|
479
|
+
return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
480
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
481
|
+
|
|
482
|
+
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
483
|
+
var width = _ref2.width,
|
|
484
|
+
height = _ref2.height;
|
|
485
|
+
return {
|
|
486
|
+
style: Object.assign(Object.assign({}, width && {
|
|
487
|
+
width: style_1.toPx(width)
|
|
488
|
+
}), height && {
|
|
489
|
+
height: style_1.toPx(height)
|
|
490
|
+
})
|
|
491
|
+
};
|
|
492
|
+
}).withConfig({
|
|
493
|
+
displayName: "FixedSizeContainer__FixSizeItem",
|
|
494
|
+
componentId: "sc-1yhgpod-1"
|
|
495
|
+
})(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
|
|
496
|
+
return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
497
|
+
});
|
|
498
|
+
var ItemContent = styled_components_1.default.div.withConfig({
|
|
499
|
+
displayName: "FixedSizeContainer__ItemContent",
|
|
500
|
+
componentId: "sc-1yhgpod-2"
|
|
501
|
+
})(["position:relative;min-height:100px;width:100%;"]);
|
|
502
|
+
var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
503
|
+
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
504
|
+
componentId: "sc-1yhgpod-3"
|
|
505
|
+
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
506
|
+
|
|
507
|
+
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
508
|
+
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
509
|
+
var width = props.width,
|
|
510
|
+
height = props.height,
|
|
511
|
+
backgroundColor = props.backgroundColor;
|
|
512
|
+
|
|
513
|
+
if (!height) {
|
|
514
|
+
return React.createElement(Item, {
|
|
515
|
+
"data-test": "item",
|
|
516
|
+
width: width,
|
|
517
|
+
backgroundColor: backgroundColor
|
|
518
|
+
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
return React.createElement(FixSizeItem, {
|
|
522
|
+
"data-test": "fix-size-item",
|
|
523
|
+
"data-splunk-visualization-version": "24.3.0 - 1c1ae4b3c",
|
|
524
|
+
width: width,
|
|
525
|
+
height: height,
|
|
526
|
+
backgroundColor: backgroundColor
|
|
527
|
+
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
528
|
+
var newWidth = _ref3.width,
|
|
529
|
+
newHeight = _ref3.height;
|
|
530
|
+
return React.createElement(Viz, Object.assign({}, props, {
|
|
531
|
+
width: newWidth,
|
|
532
|
+
height: newHeight
|
|
533
|
+
}));
|
|
534
|
+
})));
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
538
|
+
return FixedSizeContainer;
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
exports.default = withFixedSizeContainer;
|
|
542
|
+
|
|
543
|
+
/***/ }),
|
|
544
|
+
/* 13 */
|
|
545
|
+
/***/ (function(module, exports) {
|
|
546
|
+
|
|
547
|
+
module.exports = require("@splunk/visualizations-shared/style");
|
|
548
|
+
|
|
549
|
+
/***/ }),
|
|
550
|
+
/* 14 */
|
|
551
|
+
/***/ (function(module, exports) {
|
|
552
|
+
|
|
553
|
+
module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
554
|
+
|
|
555
|
+
/***/ }),
|
|
556
|
+
/* 15 */
|
|
557
|
+
/***/ (function(module, exports) {
|
|
558
|
+
|
|
559
|
+
module.exports = require("@babel/runtime/helpers/createClass");
|
|
560
|
+
|
|
561
|
+
/***/ }),
|
|
562
|
+
/* 16 */
|
|
563
|
+
/***/ (function(module, exports) {
|
|
564
|
+
|
|
565
|
+
module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
|
|
566
|
+
|
|
567
|
+
/***/ }),
|
|
568
|
+
/* 17 */,
|
|
569
|
+
/* 18 */,
|
|
570
|
+
/* 19 */,
|
|
571
|
+
/* 20 */
|
|
572
|
+
/***/ (function(module, exports) {
|
|
573
|
+
|
|
574
|
+
module.exports = require("@babel/runtime/helpers/typeof");
|
|
575
|
+
|
|
576
|
+
/***/ }),
|
|
577
|
+
/* 21 */,
|
|
578
|
+
/* 22 */,
|
|
579
|
+
/* 23 */
|
|
580
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
581
|
+
|
|
582
|
+
"use strict";
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
var _defineProperty = __webpack_require__(8);
|
|
586
|
+
|
|
587
|
+
Object.defineProperty(exports, "__esModule", {
|
|
588
|
+
value: true
|
|
589
|
+
});
|
|
590
|
+
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
591
|
+
|
|
592
|
+
var T = __webpack_require__(0);
|
|
593
|
+
|
|
594
|
+
var lodash_1 = __webpack_require__(2);
|
|
595
|
+
|
|
596
|
+
var DataSource_1 = __webpack_require__(33);
|
|
597
|
+
|
|
598
|
+
exports.SortParamsPropTypes = T.shape({
|
|
599
|
+
currentSortKey: T.string,
|
|
600
|
+
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
601
|
+
onSort: T.func
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
var getSortingParams = function getSortingParams(_ref) {
|
|
605
|
+
var requestParams = _ref.requestParams,
|
|
606
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
607
|
+
var currentSortKey;
|
|
608
|
+
var currentSortDir;
|
|
609
|
+
var nextSortDirMap = {
|
|
610
|
+
asc: 'desc',
|
|
611
|
+
desc: 'asc',
|
|
612
|
+
none: 'asc'
|
|
613
|
+
};
|
|
614
|
+
var onSort;
|
|
615
|
+
|
|
616
|
+
if (lodash_1.isFunction(onRequestParamsChange)) {
|
|
617
|
+
if (requestParams && lodash_1.has(requestParams, 'sort')) {
|
|
618
|
+
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
619
|
+
currentSortDir = requestParams.sort[currentSortKey];
|
|
620
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
onSort = function onSort(e, _ref2) {
|
|
624
|
+
var sortKey = _ref2.sortKey,
|
|
625
|
+
sortDir = _ref2.sortDir;
|
|
626
|
+
|
|
627
|
+
if (typeof sortKey === 'string') {
|
|
628
|
+
var nextSortDir = lodash_1.has(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
629
|
+
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
630
|
+
offset: 0,
|
|
631
|
+
sort: _defineProperty({}, sortKey, nextSortDir)
|
|
632
|
+
}));
|
|
633
|
+
} else {
|
|
634
|
+
onRequestParamsChange(requestParams);
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
return {
|
|
640
|
+
currentSortKey: currentSortKey,
|
|
641
|
+
currentSortDir: currentSortDir,
|
|
642
|
+
onSort: onSort
|
|
643
|
+
};
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
exports.getSortingParams = getSortingParams;
|
|
647
|
+
|
|
648
|
+
/***/ }),
|
|
649
|
+
/* 24 */
|
|
650
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
651
|
+
|
|
652
|
+
"use strict";
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
Object.defineProperty(exports, "__esModule", {
|
|
656
|
+
value: true
|
|
657
|
+
});
|
|
658
|
+
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
659
|
+
|
|
660
|
+
var T = __webpack_require__(0);
|
|
661
|
+
|
|
662
|
+
var lodash_1 = __webpack_require__(2);
|
|
663
|
+
|
|
664
|
+
exports.PaginatorParamsPropTypes = T.shape({
|
|
665
|
+
isPaging: T.bool,
|
|
666
|
+
current: T.number,
|
|
667
|
+
totalPages: T.number,
|
|
668
|
+
onChange: T.func
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
var getPaginationParams = function getPaginationParams(_ref) {
|
|
672
|
+
var requestParams = _ref.requestParams,
|
|
673
|
+
meta = _ref.meta,
|
|
674
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
675
|
+
var totalCount = meta && meta.totalCount || 0;
|
|
676
|
+
var offset = requestParams && requestParams.offset || 0;
|
|
677
|
+
var count = requestParams && requestParams.count;
|
|
678
|
+
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
679
|
+
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
680
|
+
var isPaging = totalPages > 1 && lodash_1.isFunction(onRequestParamsChange);
|
|
681
|
+
|
|
682
|
+
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
683
|
+
var page = _ref2.page,
|
|
684
|
+
countArg = _ref2.count;
|
|
685
|
+
var newParams = lodash_1.cloneDeep(requestParams);
|
|
686
|
+
|
|
687
|
+
if (typeof countArg === 'number') {
|
|
688
|
+
newParams.count = countArg;
|
|
689
|
+
newParams.offset = 0;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
693
|
+
|
|
694
|
+
if (typeof page === 'number' && page > 0) {
|
|
695
|
+
newParams.count = pageCount;
|
|
696
|
+
newParams.offset = (page - 1) * pageCount;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
onRequestParamsChange(newParams);
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
return {
|
|
703
|
+
isPaging: isPaging,
|
|
704
|
+
current: current,
|
|
705
|
+
totalPages: totalPages,
|
|
706
|
+
onChange: lodash_1.isFunction(onRequestParamsChange) ? onChangeHandler : lodash_1.noop
|
|
707
|
+
};
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
exports.getPaginationParams = getPaginationParams;
|
|
711
|
+
|
|
712
|
+
/***/ }),
|
|
713
|
+
/* 25 */
|
|
714
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
715
|
+
|
|
716
|
+
"use strict";
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
Object.defineProperty(exports, "__esModule", {
|
|
720
|
+
value: true
|
|
721
|
+
});
|
|
722
|
+
exports.shouldShowIconPlaceholder = void 0;
|
|
723
|
+
|
|
724
|
+
var React = __webpack_require__(1);
|
|
725
|
+
|
|
726
|
+
var T = __webpack_require__(0);
|
|
727
|
+
|
|
728
|
+
var lodash_1 = __webpack_require__(2);
|
|
729
|
+
|
|
730
|
+
var i18n_1 = __webpack_require__(3);
|
|
731
|
+
|
|
732
|
+
var Message_1 = __webpack_require__(9);
|
|
733
|
+
|
|
734
|
+
var FixedSizeContainer_1 = __webpack_require__(12);
|
|
735
|
+
/**
|
|
736
|
+
* @method shouldShowIconPlaceholder
|
|
737
|
+
* @param {object} dataSources
|
|
738
|
+
* @param {boolean} loading
|
|
739
|
+
* @returns {boolean}
|
|
740
|
+
*/
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
744
|
+
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
745
|
+
var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
|
|
746
|
+
var noData = data === undefined;
|
|
747
|
+
var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
|
|
748
|
+
var noFields = fields === undefined;
|
|
749
|
+
return loading || noData || noFields;
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
753
|
+
var propTypes = {
|
|
754
|
+
icon: T.func,
|
|
755
|
+
width: T.oneOfType([T.string, T.number]),
|
|
756
|
+
height: T.oneOfType([T.string, T.number]),
|
|
757
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
758
|
+
backgroundColor: T.string
|
|
759
|
+
};
|
|
760
|
+
/**
|
|
761
|
+
* @method IconPlaceholder
|
|
762
|
+
* @param {IconPlaceholderProps} props
|
|
763
|
+
* @returns {React.ReactElement}
|
|
764
|
+
*/
|
|
765
|
+
|
|
766
|
+
var IconPlaceholder = function IconPlaceholder(props) {
|
|
767
|
+
var width = props.width,
|
|
768
|
+
height = props.height,
|
|
769
|
+
icon = props.icon;
|
|
770
|
+
|
|
771
|
+
if (icon) {
|
|
772
|
+
return React.createElement(icon, {
|
|
773
|
+
style: {
|
|
774
|
+
left: '50%',
|
|
775
|
+
top: '50%',
|
|
776
|
+
color: 'grey',
|
|
777
|
+
position: 'absolute',
|
|
778
|
+
transform: 'translate(-50%, -50%)'
|
|
779
|
+
},
|
|
780
|
+
width: '50%',
|
|
781
|
+
height: '50%'
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
return React.createElement(Message_1.default, {
|
|
786
|
+
width: width,
|
|
787
|
+
height: height,
|
|
788
|
+
level: "warning",
|
|
789
|
+
message: i18n_1._('No DataSource Connected')
|
|
790
|
+
});
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
IconPlaceholder.propTypes = propTypes;
|
|
794
|
+
IconPlaceholder.defaultProps = {
|
|
795
|
+
width: '100%',
|
|
796
|
+
height: 250
|
|
797
|
+
};
|
|
798
|
+
exports.default = FixedSizeContainer_1.default(IconPlaceholder);
|
|
799
|
+
|
|
800
|
+
/***/ }),
|
|
801
|
+
/* 26 */
|
|
802
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
803
|
+
|
|
804
|
+
"use strict";
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
Object.defineProperty(exports, "__esModule", {
|
|
808
|
+
value: true
|
|
809
|
+
});
|
|
810
|
+
exports.VizCategory = void 0;
|
|
811
|
+
var VizCategory;
|
|
812
|
+
|
|
813
|
+
(function (VizCategory) {
|
|
814
|
+
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
815
|
+
VizCategory["TRENDS"] = "Trends";
|
|
816
|
+
VizCategory["COMPARISONS"] = "Comparisons";
|
|
817
|
+
VizCategory["TABLE"] = "Table";
|
|
818
|
+
VizCategory["GAUGE"] = "Gauge";
|
|
819
|
+
VizCategory["DISTRIBUTIONS"] = "Distributions";
|
|
820
|
+
VizCategory["CHOROPLETH"] = "Choropleth Maps";
|
|
821
|
+
VizCategory["SHAPES"] = "Shapes";
|
|
822
|
+
VizCategory["MISC"] = "misc";
|
|
823
|
+
VizCategory["FLOW"] = "Flow";
|
|
824
|
+
VizCategory["CORRELATION"] = "Correlation";
|
|
825
|
+
VizCategory["SPATIAL"] = "Spatial";
|
|
826
|
+
})(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
|
|
827
|
+
|
|
828
|
+
/***/ }),
|
|
829
|
+
/* 27 */
|
|
830
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
831
|
+
|
|
832
|
+
"use strict";
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
Object.defineProperty(exports, "__esModule", {
|
|
836
|
+
value: true
|
|
837
|
+
});
|
|
838
|
+
|
|
839
|
+
var React = __webpack_require__(1);
|
|
840
|
+
|
|
841
|
+
var lodash_1 = __webpack_require__(2);
|
|
842
|
+
|
|
843
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(28);
|
|
844
|
+
|
|
845
|
+
var Options_1 = __webpack_require__(29);
|
|
846
|
+
|
|
847
|
+
var SanitizeProps_1 = __webpack_require__(30);
|
|
848
|
+
|
|
849
|
+
var styled_components_1 = __webpack_require__(4);
|
|
850
|
+
|
|
851
|
+
var SplunkVisualization_1 = __webpack_require__(31);
|
|
852
|
+
|
|
853
|
+
var VizBehavior_1 = __webpack_require__(5);
|
|
854
|
+
|
|
855
|
+
var getSorting_1 = __webpack_require__(23);
|
|
856
|
+
|
|
857
|
+
var getPagination_1 = __webpack_require__(24);
|
|
858
|
+
|
|
859
|
+
var useDeepMemo_1 = __webpack_require__(34);
|
|
860
|
+
|
|
861
|
+
var JSONSchemaUtils_1 = __webpack_require__(35);
|
|
862
|
+
|
|
863
|
+
var MissingPropsMessage_1 = __webpack_require__(36);
|
|
864
|
+
|
|
865
|
+
var withEditModeCover_1 = __webpack_require__(37);
|
|
866
|
+
|
|
867
|
+
var withPlaceholder_1 = __webpack_require__(38);
|
|
868
|
+
|
|
869
|
+
var hocUtils_1 = __webpack_require__(7);
|
|
870
|
+
/**
|
|
871
|
+
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
872
|
+
* @param {DashboardVizOpts} opts
|
|
873
|
+
* @returns {HOC}
|
|
874
|
+
*/
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
var withDashboardViz = function withDashboardViz(opts) {
|
|
878
|
+
var ReactViz = opts.ReactViz,
|
|
879
|
+
vizConfig = opts.vizConfig,
|
|
880
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
881
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
882
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
883
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
884
|
+
|
|
885
|
+
var SanitizedReactViz = SanitizeProps_1.withSanitizedProps(ReactViz);
|
|
886
|
+
var defaultOptions = JSONSchemaUtils_1.pickFieldFromJSONSchema(vizConfig.optionsSchema, 'default');
|
|
887
|
+
|
|
888
|
+
var DashboardViz = function DashboardViz(props) {
|
|
889
|
+
var mode = props.mode,
|
|
890
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
891
|
+
dataSources = props.dataSources,
|
|
892
|
+
options = props.options,
|
|
893
|
+
_props$context = props.context,
|
|
894
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
895
|
+
width = props.width,
|
|
896
|
+
height = props.height,
|
|
897
|
+
onComputedProps = props.onComputedProps,
|
|
898
|
+
onEventTrigger = props.onEventTrigger,
|
|
899
|
+
theme = props.theme,
|
|
900
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
901
|
+
|
|
902
|
+
var themeFunc = function themeFunc(themeVar) {
|
|
903
|
+
var _a, _b;
|
|
904
|
+
|
|
905
|
+
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
909
|
+
|
|
910
|
+
var _getSettingsFromTheme = getSettingsFromThemedProps_1.default({
|
|
911
|
+
theme: theme
|
|
912
|
+
}),
|
|
913
|
+
currentThemeFamily = _getSettingsFromTheme.family,
|
|
914
|
+
currentThemeColorScheme = _getSettingsFromTheme.colorScheme,
|
|
915
|
+
currentThemeDensity = _getSettingsFromTheme.density;
|
|
916
|
+
|
|
917
|
+
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
918
|
+
|
|
919
|
+
evaluatedOptions = useDeepMemo_1.useDeepMemo(function () {
|
|
920
|
+
try {
|
|
921
|
+
return Options_1.Options.evaluate({
|
|
922
|
+
context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
|
|
923
|
+
options: hocUtils_1.deepMergeWithArrayOverrides({}, options, defaultOptions)
|
|
924
|
+
}, dataSources, themeFunc);
|
|
925
|
+
} catch (e) {
|
|
926
|
+
// eslint-disable-next-line no-console
|
|
927
|
+
console.error("unexpected error evaluating options: + ".concat(e.message));
|
|
928
|
+
return {};
|
|
929
|
+
}
|
|
930
|
+
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources]); // useEffect hook needs to be initialized before any early returns
|
|
931
|
+
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
932
|
+
|
|
933
|
+
React.useEffect(function () {
|
|
934
|
+
onComputedProps(evaluatedOptions);
|
|
935
|
+
}); // present warning message if any required props are missing
|
|
936
|
+
|
|
937
|
+
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
938
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
939
|
+
supports = vizConfig.supports;
|
|
940
|
+
var missing = MissingPropsMessage_1.missingKeys(requiredProps, evaluatedOptions);
|
|
941
|
+
|
|
942
|
+
if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER)) {
|
|
943
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
944
|
+
"data-test": "missing-props-message",
|
|
945
|
+
width: width,
|
|
946
|
+
height: height,
|
|
947
|
+
missingProps: missing,
|
|
948
|
+
backgroundColor: bgColorFromTheme
|
|
949
|
+
});
|
|
950
|
+
} // events
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
var eventCallbackProps = {};
|
|
954
|
+
|
|
955
|
+
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
956
|
+
var supportedEvents = vizConfig.events;
|
|
957
|
+
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
958
|
+
var eventCallbackPropName = lodash_1.camelCase("on.".concat(eventName));
|
|
959
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
960
|
+
// then remove these lines
|
|
961
|
+
|
|
962
|
+
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
963
|
+
var payload = {};
|
|
964
|
+
|
|
965
|
+
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
966
|
+
payloadKeys.forEach(function (p) {
|
|
967
|
+
payload[p] = evaluatedOptions[p];
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
972
|
+
if (ev && ev.payload) {
|
|
973
|
+
payload = ev.payload;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
return onEventTrigger({
|
|
977
|
+
originalEvent: ev,
|
|
978
|
+
payload: payload,
|
|
979
|
+
type: eventName
|
|
980
|
+
});
|
|
981
|
+
};
|
|
982
|
+
});
|
|
983
|
+
} // compute pure viz props which are not from options
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptions), eventCallbackProps), {
|
|
987
|
+
themeFunc: themeFunc
|
|
988
|
+
}));
|
|
989
|
+
/**
|
|
990
|
+
* PAGE_AND_SORT behavior
|
|
991
|
+
*
|
|
992
|
+
* Some visualizations, like table, requires metadata about the datasource,
|
|
993
|
+
* like total number of results, current count, offset, and sort, for rendering
|
|
994
|
+
* paginator and sorting direction. In this approach, the visualization
|
|
995
|
+
* allow users to set 'paginateDataSourceKey' to select which datasource
|
|
996
|
+
* should the visualization extract the metadata from. It defaults to 'primary' datasource.
|
|
997
|
+
* The visualization config should set the PAGE_AND_SORT behavior to receive
|
|
998
|
+
* 'requestParams', 'meta' and onRequestParams callback as props.
|
|
999
|
+
*
|
|
1000
|
+
* In future, we could automatically detect which all datasources are being used
|
|
1001
|
+
* and bind those magically to pagination/sorting behavior.
|
|
1002
|
+
*/
|
|
1003
|
+
|
|
1004
|
+
var dataSourceMetadata = {};
|
|
1005
|
+
var OptionKey = 'paginateDataSourceKey';
|
|
1006
|
+
var paginateDataSourceKey = lodash_1.has(evaluatedOptions, OptionKey) && evaluatedOptions[OptionKey] || 'primary';
|
|
1007
|
+
|
|
1008
|
+
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && lodash_1.has(dataSources, paginateDataSourceKey)) {
|
|
1009
|
+
var requestParams = lodash_1.get(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1010
|
+
var meta = lodash_1.get(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1011
|
+
|
|
1012
|
+
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1013
|
+
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
var sortParams = getSorting_1.getSortingParams({
|
|
1017
|
+
requestParams: requestParams,
|
|
1018
|
+
meta: meta,
|
|
1019
|
+
onRequestParamsChange: handleRequestParamsChange
|
|
1020
|
+
});
|
|
1021
|
+
var paginatorParams = getPagination_1.getPaginationParams({
|
|
1022
|
+
requestParams: requestParams,
|
|
1023
|
+
meta: meta,
|
|
1024
|
+
onRequestParamsChange: handleRequestParamsChange
|
|
1025
|
+
});
|
|
1026
|
+
dataSourceMetadata = {
|
|
1027
|
+
sortParams: sortParams,
|
|
1028
|
+
paginatorParams: paginatorParams
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1033
|
+
mode: mode,
|
|
1034
|
+
width: width,
|
|
1035
|
+
height: height
|
|
1036
|
+
}, evaluatedOptions, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1040
|
+
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1041
|
+
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1042
|
+
theme: {}
|
|
1043
|
+
}); // attach viz config
|
|
1044
|
+
|
|
1045
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
1046
|
+
|
|
1047
|
+
return styled_components_1.withTheme(withPlaceholder_1.default(withEditModeCover_1.default(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
exports.default = withDashboardViz;
|
|
1051
|
+
|
|
1052
|
+
/***/ }),
|
|
1053
|
+
/* 28 */
|
|
1054
|
+
/***/ (function(module, exports) {
|
|
1055
|
+
|
|
1056
|
+
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1057
|
+
|
|
1058
|
+
/***/ }),
|
|
1059
|
+
/* 29 */
|
|
1060
|
+
/***/ (function(module, exports) {
|
|
1061
|
+
|
|
1062
|
+
module.exports = require("@splunk/visualization-encoding/Options");
|
|
1063
|
+
|
|
1064
|
+
/***/ }),
|
|
1065
|
+
/* 30 */
|
|
1066
|
+
/***/ (function(module, exports) {
|
|
1067
|
+
|
|
1068
|
+
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1069
|
+
|
|
1070
|
+
/***/ }),
|
|
1071
|
+
/* 31 */
|
|
1072
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1073
|
+
|
|
1074
|
+
"use strict";
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
var _classCallCheck = __webpack_require__(10);
|
|
1078
|
+
|
|
1079
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1080
|
+
value: true
|
|
1081
|
+
});
|
|
1082
|
+
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1083
|
+
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1084
|
+
|
|
1085
|
+
var T = __webpack_require__(0);
|
|
1086
|
+
|
|
1087
|
+
var lodash_1 = __webpack_require__(2);
|
|
1088
|
+
|
|
1089
|
+
var VizActionHandler_1 = __webpack_require__(32); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
exports.INITIAL_WIDTH = 250;
|
|
1093
|
+
exports.INITIAL_HEIGHT = 250;
|
|
1094
|
+
/**
|
|
1095
|
+
* A Splunk visualization
|
|
1096
|
+
*/
|
|
1097
|
+
|
|
1098
|
+
var SplunkVisualization = function SplunkVisualization() {
|
|
1099
|
+
_classCallCheck(this, SplunkVisualization);
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
SplunkVisualization.propTypes = {
|
|
1103
|
+
/**
|
|
1104
|
+
* display mode
|
|
1105
|
+
*/
|
|
1106
|
+
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* width in pixel or string, defaults to 100%
|
|
1110
|
+
*/
|
|
1111
|
+
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* height in pixel or string
|
|
1115
|
+
*/
|
|
1116
|
+
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* visualization context used for dynamic option evaluation
|
|
1120
|
+
*/
|
|
1121
|
+
context: T.object,
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* visualization formatting options
|
|
1125
|
+
*/
|
|
1126
|
+
options: T.object,
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* A callback to update formatting options
|
|
1130
|
+
*/
|
|
1131
|
+
onOptionsChange: T.func,
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1135
|
+
*/
|
|
1136
|
+
dataSources: T.objectOf(T.shape({
|
|
1137
|
+
/**
|
|
1138
|
+
* current request params
|
|
1139
|
+
*/
|
|
1140
|
+
requestParams: T.object,
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* current dataset
|
|
1144
|
+
*/
|
|
1145
|
+
data: T.shape({
|
|
1146
|
+
fields: T.array,
|
|
1147
|
+
columns: T.array
|
|
1148
|
+
}),
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* error
|
|
1152
|
+
*/
|
|
1153
|
+
error: T.shape({
|
|
1154
|
+
level: T.string,
|
|
1155
|
+
message: T.string
|
|
1156
|
+
}),
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* meta data that came with the dataset
|
|
1160
|
+
*/
|
|
1161
|
+
meta: T.object
|
|
1162
|
+
})),
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* A callback to trigger event
|
|
1166
|
+
*/
|
|
1167
|
+
onEventTrigger: T.func,
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* Inform viz if there are handlers listening to events
|
|
1171
|
+
*/
|
|
1172
|
+
hasEventHandlers: T.bool,
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* A callback to communicate computed props to a consumer
|
|
1176
|
+
*/
|
|
1177
|
+
onComputedProps: T.func,
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* A callback to obtain visualization api
|
|
1181
|
+
*/
|
|
1182
|
+
vizActionHandlerRef: T.func,
|
|
1183
|
+
loading: T.bool,
|
|
1184
|
+
theme: T.object,
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* A callback to request new data with updated request params
|
|
1188
|
+
*/
|
|
1189
|
+
onRequestParamsChange: T.func
|
|
1190
|
+
};
|
|
1191
|
+
/**
|
|
1192
|
+
*
|
|
1193
|
+
*/
|
|
1194
|
+
|
|
1195
|
+
SplunkVisualization.defaultProps = {
|
|
1196
|
+
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1197
|
+
width: '100%',
|
|
1198
|
+
height: exports.INITIAL_HEIGHT,
|
|
1199
|
+
dataSources: {},
|
|
1200
|
+
onEventTrigger: function onEventTrigger() {
|
|
1201
|
+
return {};
|
|
1202
|
+
},
|
|
1203
|
+
mode: 'view',
|
|
1204
|
+
hasEventHandlers: false,
|
|
1205
|
+
options: {},
|
|
1206
|
+
context: {},
|
|
1207
|
+
onOptionsChange: function onOptionsChange() {
|
|
1208
|
+
return {};
|
|
1209
|
+
},
|
|
1210
|
+
vizActionHandlerRef: function vizActionHandlerRef() {
|
|
1211
|
+
return new VizActionHandler_1.DefaultVizActionHandler();
|
|
1212
|
+
},
|
|
1213
|
+
onComputedProps: function onComputedProps() {
|
|
1214
|
+
return {};
|
|
1215
|
+
},
|
|
1216
|
+
loading: false,
|
|
1217
|
+
onRequestParamsChange: lodash_1.noop
|
|
1218
|
+
};
|
|
1219
|
+
exports.default = SplunkVisualization;
|
|
1220
|
+
|
|
1221
|
+
/***/ }),
|
|
1222
|
+
/* 32 */
|
|
1223
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1224
|
+
|
|
1225
|
+
"use strict";
|
|
1226
|
+
|
|
1227
|
+
|
|
1228
|
+
var _classCallCheck = __webpack_require__(10);
|
|
1229
|
+
|
|
1230
|
+
var _createClass = __webpack_require__(15);
|
|
1231
|
+
|
|
1232
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1233
|
+
value: true
|
|
1234
|
+
});
|
|
1235
|
+
exports.DefaultVizActionHandler = void 0;
|
|
1236
|
+
|
|
1237
|
+
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1238
|
+
function DefaultVizActionHandler() {
|
|
1239
|
+
_classCallCheck(this, DefaultVizActionHandler);
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
_createClass(DefaultVizActionHandler, [{
|
|
1243
|
+
key: "focus",
|
|
1244
|
+
value: function focus() {// noop
|
|
1245
|
+
}
|
|
1246
|
+
}, {
|
|
1247
|
+
key: "snapshot",
|
|
1248
|
+
value: function snapshot() {
|
|
1249
|
+
return null; // noop
|
|
1250
|
+
}
|
|
1251
|
+
}]);
|
|
1252
|
+
|
|
1253
|
+
return DefaultVizActionHandler;
|
|
1254
|
+
}();
|
|
1255
|
+
|
|
1256
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1257
|
+
|
|
1258
|
+
/***/ }),
|
|
1259
|
+
/* 33 */
|
|
1260
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1261
|
+
|
|
1262
|
+
"use strict";
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1266
|
+
value: true
|
|
1267
|
+
});
|
|
1268
|
+
exports.validSortDirs = void 0;
|
|
1269
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1270
|
+
|
|
1271
|
+
/***/ }),
|
|
1272
|
+
/* 34 */
|
|
1273
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1274
|
+
|
|
1275
|
+
"use strict";
|
|
1276
|
+
|
|
1277
|
+
|
|
1278
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1279
|
+
value: true
|
|
1280
|
+
});
|
|
1281
|
+
exports.useDeepMemo = void 0;
|
|
1282
|
+
|
|
1283
|
+
var react_1 = __webpack_require__(1);
|
|
1284
|
+
|
|
1285
|
+
var lodash_1 = __webpack_require__(2);
|
|
1286
|
+
/**
|
|
1287
|
+
* This hook evaluates and stores the result of a passed function and only
|
|
1288
|
+
* re-evaluates the function when passed dependencies change.
|
|
1289
|
+
*
|
|
1290
|
+
* It is different from the internal React useMemo in the following aspects:
|
|
1291
|
+
* - it only stores the last evaluated result
|
|
1292
|
+
* - it uses a deep equality check to determine if dependencies have changed
|
|
1293
|
+
*
|
|
1294
|
+
* Inspired by apollo-client's useDeepMemo
|
|
1295
|
+
*
|
|
1296
|
+
* @param fn the function to be executed and
|
|
1297
|
+
* @param dependencies an array of dependencies
|
|
1298
|
+
*/
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1302
|
+
var ref = react_1.useRef();
|
|
1303
|
+
|
|
1304
|
+
if (!ref.current || !lodash_1.isEqual(dependencies, ref.current.dependencies)) {
|
|
1305
|
+
ref.current = {
|
|
1306
|
+
dependencies: dependencies,
|
|
1307
|
+
value: fn()
|
|
1308
|
+
};
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
return ref.current.value;
|
|
1312
|
+
};
|
|
1313
|
+
|
|
1314
|
+
exports.useDeepMemo = useDeepMemo;
|
|
1315
|
+
|
|
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
|
+
/***/ }),
|
|
1350
|
+
/* 36 */
|
|
1351
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1352
|
+
|
|
1353
|
+
"use strict";
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1357
|
+
value: true
|
|
1358
|
+
});
|
|
1359
|
+
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
1360
|
+
|
|
1361
|
+
var React = __webpack_require__(1);
|
|
1362
|
+
|
|
1363
|
+
var T = __webpack_require__(0);
|
|
1364
|
+
|
|
1365
|
+
var i18n_1 = __webpack_require__(3);
|
|
1366
|
+
|
|
1367
|
+
var Message_1 = __webpack_require__(9);
|
|
1368
|
+
|
|
1369
|
+
var FixedSizeContainer_1 = __webpack_require__(12);
|
|
1370
|
+
/**
|
|
1371
|
+
* @method isMissing
|
|
1372
|
+
* @param {any} v
|
|
1373
|
+
* @returns {boolean} true if the input value === null or undefined
|
|
1374
|
+
*/
|
|
1375
|
+
|
|
1376
|
+
|
|
1377
|
+
var isMissing = function isMissing(v) {
|
|
1378
|
+
return v === null || v === undefined;
|
|
1379
|
+
};
|
|
1380
|
+
|
|
1381
|
+
exports.isMissing = isMissing;
|
|
1382
|
+
/**
|
|
1383
|
+
* @method misskingKeys
|
|
1384
|
+
* @param {string[]} keys
|
|
1385
|
+
* @param {object} target
|
|
1386
|
+
* @returns {string[]} the keys of missing required props
|
|
1387
|
+
*/
|
|
1388
|
+
|
|
1389
|
+
var missingKeys = function missingKeys(keys, target) {
|
|
1390
|
+
return keys.filter(function (k) {
|
|
1391
|
+
return exports.isMissing(target[k]);
|
|
1392
|
+
});
|
|
1393
|
+
};
|
|
1394
|
+
|
|
1395
|
+
exports.missingKeys = missingKeys;
|
|
1396
|
+
var propTypes = {
|
|
1397
|
+
width: T.oneOfType([T.string, T.number]),
|
|
1398
|
+
height: T.oneOfType([T.string, T.number]),
|
|
1399
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
1400
|
+
backgroundColor: T.string,
|
|
1401
|
+
missingProps: T.arrayOf(T.string)
|
|
1402
|
+
};
|
|
1403
|
+
/**
|
|
1404
|
+
* @method MissingPropsMessage
|
|
1405
|
+
* @param {MissingPropsProps} props
|
|
1406
|
+
* @returns {React.ReactElement}
|
|
1407
|
+
*/
|
|
1408
|
+
|
|
1409
|
+
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
1410
|
+
var width = props.width,
|
|
1411
|
+
height = props.height,
|
|
1412
|
+
missingProps = props.missingProps;
|
|
1413
|
+
return React.createElement(Message_1.default, {
|
|
1414
|
+
"data-test": "message",
|
|
1415
|
+
width: width,
|
|
1416
|
+
height: height,
|
|
1417
|
+
message: i18n_1._("Missing property: ".concat(missingProps.join(', ')))
|
|
1418
|
+
});
|
|
1419
|
+
};
|
|
1420
|
+
|
|
1421
|
+
exports.MissingPropsMessage = MissingPropsMessage;
|
|
1422
|
+
exports.MissingPropsMessage.propTypes = propTypes;
|
|
1423
|
+
exports.MissingPropsMessage.defaultProps = {
|
|
1424
|
+
width: '100%',
|
|
1425
|
+
height: 250
|
|
1426
|
+
};
|
|
1427
|
+
exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
|
|
1428
|
+
|
|
1429
|
+
/***/ }),
|
|
1430
|
+
/* 37 */
|
|
1431
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1432
|
+
|
|
1433
|
+
"use strict";
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1437
|
+
value: true
|
|
1438
|
+
});
|
|
1439
|
+
|
|
1440
|
+
var React = __webpack_require__(1);
|
|
1441
|
+
|
|
1442
|
+
var styled_components_1 = __webpack_require__(4);
|
|
1443
|
+
|
|
1444
|
+
var hocUtils_1 = __webpack_require__(7);
|
|
1445
|
+
|
|
1446
|
+
var Cover = styled_components_1.default.div.withConfig({
|
|
1447
|
+
displayName: "withEditModeCover__Cover",
|
|
1448
|
+
componentId: "sc-1gsbnxb-0"
|
|
1449
|
+
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
1450
|
+
var Blocker = styled_components_1.default.div.attrs({
|
|
1451
|
+
'data-splunk-visualization-version': "24.3.0 - 1c1ae4b3c"
|
|
1452
|
+
}).withConfig({
|
|
1453
|
+
displayName: "withEditModeCover__Blocker",
|
|
1454
|
+
componentId: "sc-1gsbnxb-1"
|
|
1455
|
+
})(["position:relative;width:100%;height:100%;"]);
|
|
1456
|
+
/**
|
|
1457
|
+
* HOC that renders a cover layer in edit mode
|
|
1458
|
+
* @method withEditModeCover
|
|
1459
|
+
* @param {ExtendedDashViz} Visualization
|
|
1460
|
+
* @returns {ExtendedDashViz} Wrapper
|
|
1461
|
+
*/
|
|
1462
|
+
|
|
1463
|
+
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
1464
|
+
var Wrapper = function Wrapper(props) {
|
|
1465
|
+
var mode = props.mode;
|
|
1466
|
+
var showEditCover = mode === 'edit' && !disableEditModeCover;
|
|
1467
|
+
return React.createElement(Blocker, null, React.createElement(Visualization, Object.assign({}, props)), showEditCover && React.createElement(Cover, {
|
|
1468
|
+
"data-test": "edit-mode-cover"
|
|
1469
|
+
}));
|
|
1470
|
+
};
|
|
1471
|
+
|
|
1472
|
+
hocUtils_1.extendStaticWrapperProps({
|
|
1473
|
+
Wrapper: Wrapper,
|
|
1474
|
+
Visualization: Visualization
|
|
1475
|
+
});
|
|
1476
|
+
return Wrapper;
|
|
1477
|
+
};
|
|
1478
|
+
|
|
1479
|
+
exports.default = withEditModeCover;
|
|
1480
|
+
|
|
1481
|
+
/***/ }),
|
|
1482
|
+
/* 38 */
|
|
1483
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1484
|
+
|
|
1485
|
+
"use strict";
|
|
1486
|
+
|
|
1487
|
+
|
|
1488
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1489
|
+
value: true
|
|
1490
|
+
});
|
|
1491
|
+
|
|
1492
|
+
var React = __webpack_require__(1);
|
|
1493
|
+
|
|
1494
|
+
var colorUtils_1 = __webpack_require__(11);
|
|
1495
|
+
|
|
1496
|
+
var IconPlaceholder_1 = __webpack_require__(25);
|
|
1497
|
+
|
|
1498
|
+
var VizBehavior_1 = __webpack_require__(5);
|
|
1499
|
+
|
|
1500
|
+
var hocUtils_1 = __webpack_require__(7);
|
|
1501
|
+
|
|
1502
|
+
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
1503
|
+
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
1504
|
+
var config = Visualization.config;
|
|
1505
|
+
var themes = config.themes;
|
|
1506
|
+
|
|
1507
|
+
var Wrapper = function Wrapper(props) {
|
|
1508
|
+
var _a;
|
|
1509
|
+
|
|
1510
|
+
var dataSources = props.dataSources,
|
|
1511
|
+
loading = props.loading,
|
|
1512
|
+
options = props.options,
|
|
1513
|
+
height = props.height,
|
|
1514
|
+
width = props.width;
|
|
1515
|
+
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
1516
|
+
var bgColorFromTheme = colorUtils_1.isColor(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
|
|
1517
|
+
|
|
1518
|
+
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
1519
|
+
return React.createElement(IconPlaceholder_1.default, {
|
|
1520
|
+
"data-test": "icon-placeholder",
|
|
1521
|
+
icon: config.icon,
|
|
1522
|
+
width: width,
|
|
1523
|
+
height: height,
|
|
1524
|
+
backgroundColor: bgColorFromTheme
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
return React.createElement(Visualization, Object.assign({}, props));
|
|
1529
|
+
};
|
|
1530
|
+
|
|
1531
|
+
hocUtils_1.extendStaticWrapperProps({
|
|
1532
|
+
Wrapper: Wrapper,
|
|
1533
|
+
Visualization: Visualization
|
|
1534
|
+
});
|
|
1535
|
+
return Wrapper;
|
|
1536
|
+
};
|
|
1537
|
+
|
|
1538
|
+
exports.default = withPlaceholder;
|
|
1539
|
+
|
|
1540
|
+
/***/ }),
|
|
1541
|
+
/* 39 */
|
|
1542
|
+
/***/ (function(module, exports) {
|
|
1543
|
+
|
|
1544
|
+
module.exports = require("@babel/runtime/helpers/toConsumableArray");
|
|
1545
|
+
|
|
1546
|
+
/***/ }),
|
|
1547
|
+
/* 40 */,
|
|
1548
|
+
/* 41 */
|
|
1549
|
+
/***/ (function(module, exports) {
|
|
1550
|
+
|
|
1551
|
+
module.exports = require("@splunk/visualization-color-palettes");
|
|
1552
|
+
|
|
1553
|
+
/***/ }),
|
|
1554
|
+
/* 42 */
|
|
1555
|
+
/***/ (function(module, exports) {
|
|
1556
|
+
|
|
1557
|
+
module.exports = require("@splunk/visualization-icons");
|
|
1558
|
+
|
|
1559
|
+
/***/ }),
|
|
1560
|
+
/* 43 */,
|
|
1561
|
+
/* 44 */,
|
|
1562
|
+
/* 45 */,
|
|
1563
|
+
/* 46 */,
|
|
1564
|
+
/* 47 */,
|
|
1565
|
+
/* 48 */
|
|
1566
|
+
/***/ (function(module, exports) {
|
|
1567
|
+
|
|
1568
|
+
module.exports = require("@babel/runtime/helpers/slicedToArray");
|
|
1569
|
+
|
|
1570
|
+
/***/ }),
|
|
1571
|
+
/* 49 */,
|
|
1572
|
+
/* 50 */,
|
|
1573
|
+
/* 51 */,
|
|
1574
|
+
/* 52 */,
|
|
1575
|
+
/* 53 */,
|
|
1576
|
+
/* 54 */,
|
|
1577
|
+
/* 55 */,
|
|
1578
|
+
/* 56 */,
|
|
1579
|
+
/* 57 */,
|
|
1580
|
+
/* 58 */,
|
|
1581
|
+
/* 59 */,
|
|
1582
|
+
/* 60 */,
|
|
1583
|
+
/* 61 */,
|
|
1584
|
+
/* 62 */,
|
|
1585
|
+
/* 63 */,
|
|
1586
|
+
/* 64 */,
|
|
1587
|
+
/* 65 */,
|
|
1588
|
+
/* 66 */,
|
|
1589
|
+
/* 67 */,
|
|
1590
|
+
/* 68 */,
|
|
1591
|
+
/* 69 */
|
|
1592
|
+
/***/ (function(module, exports) {
|
|
1593
|
+
|
|
1594
|
+
module.exports = require("d3-scale");
|
|
1595
|
+
|
|
1596
|
+
/***/ }),
|
|
1597
|
+
/* 70 */
|
|
1598
|
+
/***/ (function(module, exports) {
|
|
1599
|
+
|
|
1600
|
+
module.exports = require("@splunk/themes");
|
|
1601
|
+
|
|
1602
|
+
/***/ }),
|
|
1603
|
+
/* 71 */,
|
|
1604
|
+
/* 72 */,
|
|
1605
|
+
/* 73 */,
|
|
1606
|
+
/* 74 */,
|
|
1607
|
+
/* 75 */,
|
|
1608
|
+
/* 76 */,
|
|
1609
|
+
/* 77 */,
|
|
1610
|
+
/* 78 */,
|
|
1611
|
+
/* 79 */,
|
|
1612
|
+
/* 80 */,
|
|
1613
|
+
/* 81 */,
|
|
1614
|
+
/* 82 */,
|
|
1615
|
+
/* 83 */,
|
|
1616
|
+
/* 84 */,
|
|
1617
|
+
/* 85 */,
|
|
1618
|
+
/* 86 */,
|
|
1619
|
+
/* 87 */,
|
|
1620
|
+
/* 88 */,
|
|
1621
|
+
/* 89 */,
|
|
1622
|
+
/* 90 */,
|
|
1623
|
+
/* 91 */,
|
|
1624
|
+
/* 92 */,
|
|
1625
|
+
/* 93 */,
|
|
1626
|
+
/* 94 */,
|
|
1627
|
+
/* 95 */,
|
|
1628
|
+
/* 96 */,
|
|
1629
|
+
/* 97 */,
|
|
1630
|
+
/* 98 */,
|
|
1631
|
+
/* 99 */,
|
|
1632
|
+
/* 100 */
|
|
1633
|
+
/***/ (function(module, exports) {
|
|
1634
|
+
|
|
1635
|
+
module.exports = require("@splunk/react-ui/Popover");
|
|
1636
|
+
|
|
1637
|
+
/***/ }),
|
|
1638
|
+
/* 101 */,
|
|
1639
|
+
/* 102 */,
|
|
1640
|
+
/* 103 */,
|
|
1641
|
+
/* 104 */,
|
|
1642
|
+
/* 105 */,
|
|
1643
|
+
/* 106 */,
|
|
1644
|
+
/* 107 */,
|
|
1645
|
+
/* 108 */,
|
|
1646
|
+
/* 109 */,
|
|
1647
|
+
/* 110 */,
|
|
1648
|
+
/* 111 */,
|
|
1649
|
+
/* 112 */,
|
|
1650
|
+
/* 113 */,
|
|
1651
|
+
/* 114 */,
|
|
1652
|
+
/* 115 */,
|
|
1653
|
+
/* 116 */,
|
|
1654
|
+
/* 117 */,
|
|
1655
|
+
/* 118 */,
|
|
1656
|
+
/* 119 */,
|
|
1657
|
+
/* 120 */,
|
|
1658
|
+
/* 121 */,
|
|
1659
|
+
/* 122 */,
|
|
1660
|
+
/* 123 */
|
|
1661
|
+
/***/ (function(module, exports) {
|
|
1662
|
+
|
|
1663
|
+
module.exports = require("maplibre-gl");
|
|
1664
|
+
|
|
1665
|
+
/***/ }),
|
|
1666
|
+
/* 124 */,
|
|
1667
|
+
/* 125 */,
|
|
1668
|
+
/* 126 */,
|
|
1669
|
+
/* 127 */,
|
|
1670
|
+
/* 128 */,
|
|
1671
|
+
/* 129 */,
|
|
1672
|
+
/* 130 */,
|
|
1673
|
+
/* 131 */,
|
|
1674
|
+
/* 132 */,
|
|
1675
|
+
/* 133 */,
|
|
1676
|
+
/* 134 */,
|
|
1677
|
+
/* 135 */,
|
|
1678
|
+
/* 136 */,
|
|
1679
|
+
/* 137 */,
|
|
1680
|
+
/* 138 */,
|
|
1681
|
+
/* 139 */,
|
|
1682
|
+
/* 140 */,
|
|
1683
|
+
/* 141 */,
|
|
1684
|
+
/* 142 */,
|
|
1685
|
+
/* 143 */,
|
|
1686
|
+
/* 144 */,
|
|
1687
|
+
/* 145 */,
|
|
1688
|
+
/* 146 */,
|
|
1689
|
+
/* 147 */,
|
|
1690
|
+
/* 148 */,
|
|
1691
|
+
/* 149 */,
|
|
1692
|
+
/* 150 */,
|
|
1693
|
+
/* 151 */,
|
|
1694
|
+
/* 152 */,
|
|
1695
|
+
/* 153 */,
|
|
1696
|
+
/* 154 */,
|
|
1697
|
+
/* 155 */,
|
|
1698
|
+
/* 156 */,
|
|
1699
|
+
/* 157 */,
|
|
1700
|
+
/* 158 */,
|
|
1701
|
+
/* 159 */,
|
|
1702
|
+
/* 160 */,
|
|
1703
|
+
/* 161 */,
|
|
1704
|
+
/* 162 */,
|
|
1705
|
+
/* 163 */,
|
|
1706
|
+
/* 164 */,
|
|
1707
|
+
/* 165 */,
|
|
1708
|
+
/* 166 */,
|
|
1709
|
+
/* 167 */,
|
|
1710
|
+
/* 168 */,
|
|
1711
|
+
/* 169 */,
|
|
1712
|
+
/* 170 */,
|
|
1713
|
+
/* 171 */,
|
|
1714
|
+
/* 172 */,
|
|
1715
|
+
/* 173 */,
|
|
1716
|
+
/* 174 */,
|
|
1717
|
+
/* 175 */,
|
|
1718
|
+
/* 176 */,
|
|
1719
|
+
/* 177 */,
|
|
1720
|
+
/* 178 */,
|
|
1721
|
+
/* 179 */,
|
|
1722
|
+
/* 180 */,
|
|
1723
|
+
/* 181 */,
|
|
1724
|
+
/* 182 */,
|
|
1725
|
+
/* 183 */,
|
|
1726
|
+
/* 184 */,
|
|
1727
|
+
/* 185 */,
|
|
1728
|
+
/* 186 */,
|
|
1729
|
+
/* 187 */,
|
|
1730
|
+
/* 188 */,
|
|
1731
|
+
/* 189 */
|
|
1732
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1733
|
+
|
|
1734
|
+
"use strict";
|
|
1735
|
+
|
|
1736
|
+
|
|
1737
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1738
|
+
value: true
|
|
1739
|
+
});
|
|
1740
|
+
exports.PureMap = exports.config = exports.themes = exports.computeVizProps = void 0;
|
|
1741
|
+
|
|
1742
|
+
var colorUtils_1 = __webpack_require__(11);
|
|
1743
|
+
|
|
1744
|
+
var types_1 = __webpack_require__(190);
|
|
1745
|
+
|
|
1746
|
+
var PureMap_1 = __webpack_require__(191);
|
|
1747
|
+
|
|
1748
|
+
exports.PureMap = PureMap_1.default;
|
|
1749
|
+
|
|
1750
|
+
var config_1 = __webpack_require__(199);
|
|
1751
|
+
|
|
1752
|
+
exports.config = config_1.default;
|
|
1753
|
+
|
|
1754
|
+
var withDashboardViz_1 = __webpack_require__(27);
|
|
1755
|
+
|
|
1756
|
+
var computeVizProps = function computeVizProps(_ref) {
|
|
1757
|
+
var themeFunc = _ref.themeFunc,
|
|
1758
|
+
theme = _ref.theme,
|
|
1759
|
+
layers = _ref.layers,
|
|
1760
|
+
dataSources = _ref.dataSources;
|
|
1761
|
+
var themeColorVariables = ['controlBackgroundColor', 'controlForegroundColor'];
|
|
1762
|
+
var themeColors = {};
|
|
1763
|
+
themeColorVariables.forEach(function (variable) {
|
|
1764
|
+
themeColors[variable] = themeFunc(variable);
|
|
1765
|
+
}); // Markers use different icons, Bubbles has different styles for light and dark theme
|
|
1766
|
+
// this prop is passed for that
|
|
1767
|
+
|
|
1768
|
+
var themeColorScheme = (theme === null || theme === void 0 ? void 0 : theme.splunkThemeV1) ? theme === null || theme === void 0 ? void 0 : theme.splunkThemeV1.colorScheme : 'dark';
|
|
1769
|
+
layers.forEach(function (l) {
|
|
1770
|
+
var _a, _b, _c, _d; // add key `geobin` to the layer object if the data is returned from geostats commands
|
|
1771
|
+
// to distinguish geostats commands from table commands
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
var dataSourceData = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : {};
|
|
1775
|
+
var geobinIdx = ((_c = dataSourceData.fields) !== null && _c !== void 0 ? _c : []).map(function (field) {
|
|
1776
|
+
return typeof field === 'string' ? field : field.name;
|
|
1777
|
+
}).indexOf('geobin');
|
|
1778
|
+
var layer = l;
|
|
1779
|
+
|
|
1780
|
+
if (geobinIdx > -1) {
|
|
1781
|
+
layer.geobin = dataSourceData.columns[geobinIdx];
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
layer.bubbleSizeFields = ((_d = dataSourceData.fields) !== null && _d !== void 0 ? _d : []).map(function (field) {
|
|
1785
|
+
return typeof field === 'string' ? field : field.name;
|
|
1786
|
+
}).filter(function (field, index) {
|
|
1787
|
+
var _a, _b;
|
|
1788
|
+
|
|
1789
|
+
return !['latitude', 'longitude', 'geobin'].includes(field) && types_1.inferDataTypeFromData((_b = (_a = dataSourceData.columns) === null || _a === void 0 ? void 0 : _a[index]) !== null && _b !== void 0 ? _b : []) === 'number';
|
|
1790
|
+
}); // Sanitize colors within layers
|
|
1791
|
+
|
|
1792
|
+
layer.seriesColors = Array.isArray(layer.seriesColors) ? colorUtils_1.sanitizeArrayOfColors(layer.seriesColors) : undefined;
|
|
1793
|
+
layer.dataColors = Array.isArray(layer.dataColors) ? colorUtils_1.sanitizeArrayOfColors(layer.dataColors) : undefined;
|
|
1794
|
+
});
|
|
1795
|
+
return Object.assign(Object.assign(Object.assign({}, themeColors), {
|
|
1796
|
+
themeColorScheme: themeColorScheme
|
|
1797
|
+
}), layers);
|
|
1798
|
+
};
|
|
1799
|
+
|
|
1800
|
+
exports.computeVizProps = computeVizProps;
|
|
1801
|
+
var Map = withDashboardViz_1.default({
|
|
1802
|
+
ReactViz: PureMap_1.default,
|
|
1803
|
+
vizConfig: config_1.default,
|
|
1804
|
+
computeVizProps: exports.computeVizProps,
|
|
1805
|
+
disableEditModeCover: true,
|
|
1806
|
+
useIconPlaceholder: function useIconPlaceholder() {
|
|
1807
|
+
return false;
|
|
1808
|
+
}
|
|
1809
|
+
});
|
|
1810
|
+
var themes = config_1.default.themes;
|
|
1811
|
+
exports.themes = themes;
|
|
1812
|
+
exports.default = Map;
|
|
1813
|
+
|
|
1814
|
+
/***/ }),
|
|
1815
|
+
/* 190 */
|
|
1816
|
+
/***/ (function(module, exports) {
|
|
1817
|
+
|
|
1818
|
+
module.exports = require("@splunk/visualization-encoding/utils/types");
|
|
1819
|
+
|
|
1820
|
+
/***/ }),
|
|
1821
|
+
/* 191 */
|
|
1822
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1823
|
+
|
|
1824
|
+
"use strict";
|
|
1825
|
+
|
|
1826
|
+
|
|
1827
|
+
var _slicedToArray = __webpack_require__(48);
|
|
1828
|
+
|
|
1829
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1830
|
+
value: true
|
|
1831
|
+
});
|
|
1832
|
+
exports.isLatLng = exports.formatColor = exports.DEFAULT_ZOOM = exports.DEFAULT_SHOW_SCALE = exports.DEFAULT_SCALE_UNIT = exports.DEFAULT_CONTROL_FOREGROUND_COLOR = exports.DEFAULT_CONTROL_BACKGROUND_COLOR = exports.DEFAULT_CENTER = void 0;
|
|
1833
|
+
|
|
1834
|
+
var React = __webpack_require__(1);
|
|
1835
|
+
|
|
1836
|
+
var lodash_1 = __webpack_require__(2);
|
|
1837
|
+
|
|
1838
|
+
var react_1 = __webpack_require__(1);
|
|
1839
|
+
|
|
1840
|
+
var T = __webpack_require__(0);
|
|
1841
|
+
|
|
1842
|
+
var chroma = __webpack_require__(192);
|
|
1843
|
+
|
|
1844
|
+
var maplibre_gl_1 = __webpack_require__(123);
|
|
1845
|
+
|
|
1846
|
+
var MapContext_1 = __webpack_require__(193);
|
|
1847
|
+
|
|
1848
|
+
var PureMapContainer_1 = __webpack_require__(194);
|
|
1849
|
+
|
|
1850
|
+
__webpack_require__(195);
|
|
1851
|
+
|
|
1852
|
+
var MapUtils_1 = __webpack_require__(196);
|
|
1853
|
+
|
|
1854
|
+
var Tooltip_1 = __webpack_require__(198);
|
|
1855
|
+
|
|
1856
|
+
exports.DEFAULT_CENTER = [0, 0];
|
|
1857
|
+
exports.DEFAULT_CONTROL_BACKGROUND_COLOR = '#2b3033';
|
|
1858
|
+
exports.DEFAULT_CONTROL_FOREGROUND_COLOR = '#B5B5B5';
|
|
1859
|
+
exports.DEFAULT_SCALE_UNIT = 'imperial';
|
|
1860
|
+
exports.DEFAULT_SHOW_SCALE = true;
|
|
1861
|
+
exports.DEFAULT_ZOOM = 0; // convert rgb/rgba/hex color to encoded color & opacity for SVG strings
|
|
1862
|
+
|
|
1863
|
+
var formatColor = function formatColor(color) {
|
|
1864
|
+
var chromaColor = chroma(color);
|
|
1865
|
+
return {
|
|
1866
|
+
color: chroma(chromaColor.rgb()).hex().replace('#', '%23'),
|
|
1867
|
+
opacity: chromaColor.alpha()
|
|
1868
|
+
};
|
|
1869
|
+
};
|
|
1870
|
+
|
|
1871
|
+
exports.formatColor = formatColor;
|
|
1872
|
+
PureMapContainer_1.default.displayName = 'PureMapContainer';
|
|
1873
|
+
|
|
1874
|
+
var PureMap = function PureMap(props) {
|
|
1875
|
+
var width = props.width,
|
|
1876
|
+
height = props.height,
|
|
1877
|
+
backgroundColor = props.backgroundColor,
|
|
1878
|
+
baseLayerTileServer = props.baseLayerTileServer,
|
|
1879
|
+
baseLayerTileServerType = props.baseLayerTileServerType,
|
|
1880
|
+
center = props.center,
|
|
1881
|
+
controlBackgroundColor = props.controlBackgroundColor,
|
|
1882
|
+
controlForegroundColor = props.controlForegroundColor,
|
|
1883
|
+
layers = props.layers,
|
|
1884
|
+
scaleUnit = props.scaleUnit,
|
|
1885
|
+
showScale = props.showScale,
|
|
1886
|
+
themeColorScheme = props.themeColorScheme,
|
|
1887
|
+
zoom = props.zoom,
|
|
1888
|
+
onMapLoad = props.onMapLoad;
|
|
1889
|
+
|
|
1890
|
+
var _react_1$useContext = react_1.useContext(MapContext_1.default),
|
|
1891
|
+
defaultTileConfig = _react_1$useContext.defaultTileConfig,
|
|
1892
|
+
customTileConfig = _react_1$useContext.customTileConfig;
|
|
1893
|
+
|
|
1894
|
+
var basemapContainer = react_1.useRef(null);
|
|
1895
|
+
var map = react_1.useRef(null);
|
|
1896
|
+
var scaleControl = react_1.useRef(null);
|
|
1897
|
+
var zoomControl = react_1.useRef(null);
|
|
1898
|
+
|
|
1899
|
+
var _react_1$useMemo = react_1.useMemo(function () {
|
|
1900
|
+
return MapUtils_1.getTilePreset({
|
|
1901
|
+
defaultTileConfig: defaultTileConfig,
|
|
1902
|
+
customTileConfig: customTileConfig
|
|
1903
|
+
});
|
|
1904
|
+
}, [defaultTileConfig, customTileConfig]),
|
|
1905
|
+
tilePreset = _react_1$useMemo.tilePreset,
|
|
1906
|
+
defaultTileLight = _react_1$useMemo.defaultTileLight,
|
|
1907
|
+
defaultTileDark = _react_1$useMemo.defaultTileDark;
|
|
1908
|
+
|
|
1909
|
+
var _React$useState = React.useState({}),
|
|
1910
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1911
|
+
tooltipProps = _React$useState2[0],
|
|
1912
|
+
setTooltipProps = _React$useState2[1];
|
|
1913
|
+
|
|
1914
|
+
var lngLatCenter = react_1.useMemo(function () {
|
|
1915
|
+
return [center[1], center[0]];
|
|
1916
|
+
}, [center]);
|
|
1917
|
+
var initializeMap = react_1.useCallback(function (mapStyle) {
|
|
1918
|
+
map.current = new maplibre_gl_1.Map({
|
|
1919
|
+
container: basemapContainer.current,
|
|
1920
|
+
style: mapStyle,
|
|
1921
|
+
center: lngLatCenter,
|
|
1922
|
+
zoom: zoom
|
|
1923
|
+
}); // Fired immediately after all necessary resources have been downloaded
|
|
1924
|
+
// and the first visually complete rendering of the map has occurred.
|
|
1925
|
+
|
|
1926
|
+
map.current.on('load', function () {
|
|
1927
|
+
onMapLoad();
|
|
1928
|
+
}); // zoom
|
|
1929
|
+
|
|
1930
|
+
zoomControl.current = new maplibre_gl_1.NavigationControl({
|
|
1931
|
+
showCompass: false
|
|
1932
|
+
});
|
|
1933
|
+
map.current.addControl(zoomControl.current, 'top-left');
|
|
1934
|
+
}, [lngLatCenter, zoom]);
|
|
1935
|
+
var initializeScale = react_1.useCallback(function () {
|
|
1936
|
+
scaleControl.current = new maplibre_gl_1.ScaleControl({
|
|
1937
|
+
maxWidth: 70,
|
|
1938
|
+
unit: scaleUnit
|
|
1939
|
+
});
|
|
1940
|
+
map.current.addControl(scaleControl.current);
|
|
1941
|
+
}, [scaleUnit]);
|
|
1942
|
+
var updateScale = react_1.useCallback(function () {
|
|
1943
|
+
var _a;
|
|
1944
|
+
|
|
1945
|
+
if (showScale) {
|
|
1946
|
+
(_a = scaleControl === null || scaleControl === void 0 ? void 0 : scaleControl.current) === null || _a === void 0 ? void 0 : _a.setUnit(scaleUnit);
|
|
1947
|
+
}
|
|
1948
|
+
}, [scaleUnit, showScale]);
|
|
1949
|
+
react_1.useEffect(function () {
|
|
1950
|
+
if (map.current) {
|
|
1951
|
+
map.current.resize();
|
|
1952
|
+
}
|
|
1953
|
+
}, [width, height]);
|
|
1954
|
+
react_1.useEffect(function () {
|
|
1955
|
+
// do not render when defaultTileConfig, customTileConfig and tileset are not configured
|
|
1956
|
+
if (Object.keys(tilePreset).length === 0 && (!baseLayerTileServer || !baseLayerTileServerType)) {
|
|
1957
|
+
// eslint-disable-next-line no-console
|
|
1958
|
+
console.warn('Map Tile Server configuration is missing or invalid. Please provide a valid configuration');
|
|
1959
|
+
return;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
var mapStyle = MapUtils_1.getMapStyle({
|
|
1963
|
+
baseLayerTileServer: baseLayerTileServer,
|
|
1964
|
+
baseLayerTileServerType: baseLayerTileServerType,
|
|
1965
|
+
tilePreset: tilePreset,
|
|
1966
|
+
colorScheme: themeColorScheme,
|
|
1967
|
+
defaultTileLight: defaultTileLight,
|
|
1968
|
+
defaultTileDark: defaultTileDark
|
|
1969
|
+
});
|
|
1970
|
+
mapStyle.version = MapUtils_1.MAP_STYLE_VERSION_NUMBER; // If the map has already been initialized, we update the styles
|
|
1971
|
+
|
|
1972
|
+
if (map.current) {
|
|
1973
|
+
// Refer to https://maplibre.org/maplibre-gl-js-docs/api/map/#setstyle-example for options.diff (default is true)
|
|
1974
|
+
map.current.setStyle(lodash_1.omit(mapStyle, ['theme', 'name', 'key']));
|
|
1975
|
+
updateScale();
|
|
1976
|
+
} else {
|
|
1977
|
+
// initialize the map only once with a constructed style from user configured options
|
|
1978
|
+
// or default configs from the map context
|
|
1979
|
+
initializeMap(lodash_1.omit(mapStyle, ['theme', 'name', 'key']));
|
|
1980
|
+
initializeScale();
|
|
1981
|
+
return;
|
|
1982
|
+
} // eslint-disable-next-line consistent-return
|
|
1983
|
+
|
|
1984
|
+
|
|
1985
|
+
return function () {
|
|
1986
|
+
// free resources
|
|
1987
|
+
map === null || map === void 0 ? void 0 : map.current.remove();
|
|
1988
|
+
map.current = undefined;
|
|
1989
|
+
};
|
|
1990
|
+
}, [tilePreset, initializeMap, initializeScale, updateScale, defaultTileLight, defaultTileDark, baseLayerTileServer, baseLayerTileServerType, themeColorScheme]);
|
|
1991
|
+
react_1.useEffect(function () {
|
|
1992
|
+
if (map.current) {
|
|
1993
|
+
map.current.flyTo({
|
|
1994
|
+
center: lngLatCenter,
|
|
1995
|
+
zoom: zoom
|
|
1996
|
+
});
|
|
1997
|
+
}
|
|
1998
|
+
}, [lngLatCenter, zoom]);
|
|
1999
|
+
react_1.useEffect(function () {
|
|
2000
|
+
var cleanupLayer = function cleanupLayer() {};
|
|
2001
|
+
|
|
2002
|
+
var markers = [];
|
|
2003
|
+
var bubbles = [];
|
|
2004
|
+
|
|
2005
|
+
if (map.current && layers && layers.length && map.current.isStyleLoaded) {
|
|
2006
|
+
if (layers[0].type === 'marker' && !('geobin' in layers[0])) {
|
|
2007
|
+
// support for only single layer
|
|
2008
|
+
var markerLayer = layers[0];
|
|
2009
|
+
markerLayer.seriesColors = markerLayer.seriesColors ? markerLayer.seriesColors : MapUtils_1.DEFAULT_SERIES_COLORS;
|
|
2010
|
+
|
|
2011
|
+
cleanupLayer = function cleanupLayer() {
|
|
2012
|
+
if (markers) {
|
|
2013
|
+
markers.forEach(function (marker) {
|
|
2014
|
+
return marker === null || marker === void 0 ? void 0 : marker.remove();
|
|
2015
|
+
});
|
|
2016
|
+
markers = [];
|
|
2017
|
+
}
|
|
2018
|
+
};
|
|
2019
|
+
|
|
2020
|
+
if (markerLayer) {
|
|
2021
|
+
// Remove any existing markers
|
|
2022
|
+
cleanupLayer();
|
|
2023
|
+
var renderedMarkerLayer = MapUtils_1.renderMarkerLayer(markerLayer, themeColorScheme, map, setTooltipProps);
|
|
2024
|
+
markers = renderedMarkerLayer && renderedMarkerLayer.markers;
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
if (layers[0].type === 'bubble') {
|
|
2029
|
+
// support for only single layer
|
|
2030
|
+
var bubbleLayer = layers[0];
|
|
2031
|
+
bubbleLayer.seriesColors = bubbleLayer.seriesColors ? bubbleLayer.seriesColors : MapUtils_1.DEFAULT_SERIES_COLORS; // update bubbles on events
|
|
2032
|
+
|
|
2033
|
+
cleanupLayer = function cleanupLayer() {
|
|
2034
|
+
if (bubbles && bubbles.length) {
|
|
2035
|
+
bubbles.forEach(function (bubble) {
|
|
2036
|
+
return bubble.remove();
|
|
2037
|
+
});
|
|
2038
|
+
bubbles = [];
|
|
2039
|
+
}
|
|
2040
|
+
}; // render bubbles with data returned from geostats cmds
|
|
2041
|
+
|
|
2042
|
+
|
|
2043
|
+
if (bubbleLayer.geobin && bubbleLayer.bubbleSize) {
|
|
2044
|
+
bubbleLayer.seriesColors = bubbleLayer.seriesColors ? bubbleLayer.seriesColors : MapUtils_1.DEFAULT_SERIES_COLORS;
|
|
2045
|
+
var data = MapUtils_1.bakeBubbleData(bubbleLayer);
|
|
2046
|
+
var staticColors = MapUtils_1.getStaticColors(bubbleLayer.bubbleSize.length, bubbleLayer.seriesColors);
|
|
2047
|
+
|
|
2048
|
+
if (data && staticColors && staticColors.length) {
|
|
2049
|
+
// render bubbles when layers options get update
|
|
2050
|
+
bubbles = MapUtils_1.updateBubbles(data, zoom, staticColors, bubbleLayer.dataColors, themeColorScheme, map, setTooltipProps); // render bubbles on zoom
|
|
2051
|
+
|
|
2052
|
+
map.current.on('zoomend', function () {
|
|
2053
|
+
cleanupLayer();
|
|
2054
|
+
bubbles = MapUtils_1.updateBubbles(data, map.current.getZoom(), staticColors, bubbleLayer.dataColors, themeColorScheme, map, setTooltipProps);
|
|
2055
|
+
});
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
return function () {
|
|
2062
|
+
cleanupLayer();
|
|
2063
|
+
};
|
|
2064
|
+
}, [layers, width, height, zoom, themeColorScheme]);
|
|
2065
|
+
var baseMapLayer = React.createElement(React.Fragment, null, React.createElement(PureMapContainer_1.default, {
|
|
2066
|
+
className: "puremap",
|
|
2067
|
+
width: width,
|
|
2068
|
+
height: height,
|
|
2069
|
+
backgroundColor: backgroundColor,
|
|
2070
|
+
controlBackgroundColor: controlBackgroundColor,
|
|
2071
|
+
controlForegroundColor: controlForegroundColor,
|
|
2072
|
+
controlIconColorEncoded: exports.formatColor(controlForegroundColor),
|
|
2073
|
+
ref: basemapContainer,
|
|
2074
|
+
showScale: showScale
|
|
2075
|
+
}), React.createElement(Tooltip_1.default, Object.assign({}, tooltipProps)));
|
|
2076
|
+
return baseMapLayer;
|
|
2077
|
+
};
|
|
2078
|
+
|
|
2079
|
+
var isLatLng = function isLatLng(props, propName, componentName) {
|
|
2080
|
+
if (props[propName][0] >= -180 && props[propName][0] <= 180 && props[propName][1] >= -90 && props[propName][1] <= 90) {
|
|
2081
|
+
throw new Error("".concat(componentName, " ").concat(propName, " may have reversed [lat, lon] ranges."));
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
if (props[propName][0] < -90 || props[propName][0] > 90 || props[propName][1] < -180 || props[propName][1] > 180) {
|
|
2085
|
+
throw new Error("".concat(componentName, " ").concat(propName, " incorrect [lat, lon] ranges."));
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
return null;
|
|
2089
|
+
};
|
|
2090
|
+
|
|
2091
|
+
exports.isLatLng = isLatLng;
|
|
2092
|
+
PureMap.propTypes = {
|
|
2093
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
2094
|
+
mode: T.string,
|
|
2095
|
+
width: T.oneOfType([T.string, T.number]),
|
|
2096
|
+
height: T.oneOfType([T.string, T.number]),
|
|
2097
|
+
backgroundColor: T.string,
|
|
2098
|
+
baseLayerTileServer: T.string,
|
|
2099
|
+
baseLayerTileServerType: T.string,
|
|
2100
|
+
center: exports.isLatLng,
|
|
2101
|
+
controlBackgroundColor: T.string,
|
|
2102
|
+
controlForegroundColor: T.string,
|
|
2103
|
+
layers: T.arrayOf(T.shape({
|
|
2104
|
+
type: T.string,
|
|
2105
|
+
latitude: T.arrayOf(T.number),
|
|
2106
|
+
longitude: T.arrayOf(T.number),
|
|
2107
|
+
label: T.string,
|
|
2108
|
+
showInLegend: T.bool,
|
|
2109
|
+
dataColors: T.oneOfType([T.string, T.arrayOf(T.string)]),
|
|
2110
|
+
seriesColors: T.arrayOf(T.string),
|
|
2111
|
+
tooltipFields: T.arrayOf(T.string),
|
|
2112
|
+
resultLimit: T.number
|
|
2113
|
+
})),
|
|
2114
|
+
scaleUnit: T.string,
|
|
2115
|
+
showScale: T.bool,
|
|
2116
|
+
themeColorScheme: T.string,
|
|
2117
|
+
zoom: T.number,
|
|
2118
|
+
onMapLoad: T.func
|
|
2119
|
+
};
|
|
2120
|
+
PureMap.defaultProps = {
|
|
2121
|
+
mode: 'view',
|
|
2122
|
+
width: 800,
|
|
2123
|
+
height: 500,
|
|
2124
|
+
backgroundColor: '#0b0c0e',
|
|
2125
|
+
center: exports.DEFAULT_CENTER,
|
|
2126
|
+
controlBackgroundColor: exports.DEFAULT_CONTROL_BACKGROUND_COLOR,
|
|
2127
|
+
controlForegroundColor: exports.DEFAULT_CONTROL_FOREGROUND_COLOR,
|
|
2128
|
+
scaleUnit: exports.DEFAULT_SCALE_UNIT,
|
|
2129
|
+
showScale: exports.DEFAULT_SHOW_SCALE,
|
|
2130
|
+
layers: [],
|
|
2131
|
+
themeColorScheme: 'dark',
|
|
2132
|
+
zoom: exports.DEFAULT_ZOOM,
|
|
2133
|
+
onMapLoad: lodash_1.noop
|
|
2134
|
+
};
|
|
2135
|
+
exports.default = PureMap;
|
|
2136
|
+
|
|
2137
|
+
/***/ }),
|
|
2138
|
+
/* 192 */
|
|
2139
|
+
/***/ (function(module, exports) {
|
|
2140
|
+
|
|
2141
|
+
module.exports = require("chroma-js");
|
|
2142
|
+
|
|
2143
|
+
/***/ }),
|
|
2144
|
+
/* 193 */
|
|
2145
|
+
/***/ (function(module, exports) {
|
|
2146
|
+
|
|
2147
|
+
module.exports = require("@splunk/visualization-context/MapContext");
|
|
2148
|
+
|
|
2149
|
+
/***/ }),
|
|
2150
|
+
/* 194 */
|
|
2151
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2152
|
+
|
|
2153
|
+
"use strict";
|
|
2154
|
+
|
|
2155
|
+
|
|
2156
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2157
|
+
value: true
|
|
2158
|
+
});
|
|
2159
|
+
|
|
2160
|
+
var styled_components_1 = __webpack_require__(4);
|
|
2161
|
+
|
|
2162
|
+
var lodash_1 = __webpack_require__(2);
|
|
2163
|
+
|
|
2164
|
+
var style_1 = __webpack_require__(13);
|
|
2165
|
+
|
|
2166
|
+
var PureMapContainer = styled_components_1.default.div.withConfig({
|
|
2167
|
+
displayName: "PureMapContainer",
|
|
2168
|
+
componentId: "sc-1gjwxfv-0"
|
|
2169
|
+
})(["overflow:hidden;position:relative;z-index:0;background-color:", ";", ";.custom-marker{width:22px;height:28px;cursor:pointer;}.custom-bubble{cursor:pointer;}.maplibregl-ctrl-top-left{position:absolute;top:12px;left:16px;.maplibregl-ctrl-group{width:40px !important;height:87px !important;border-radius:4px;margin:8px 0px;background-color:", ";box-shadow:0px 26px 103px rgba(0,0,0,0.64),0px 11px 18px rgba(0,0,0,0.32),0px 3px 6px rgba(0,0,0,0.3);& button{width:40px;height:43px;border-top:0;}.mapboxgl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url('data:image/svg+xml;charset=UTF-8,<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M9 1C9 0.447715 8.55229 0 8 0C7.44772 0 7 0.447715 7 1V7H1C0.447715 7 0 7.44772 0 8C0 8.55229 0.447715 9 1 9H7V15C7 15.5523 7.44772 16 8 16C8.55229 16 9 15.5523 9 15V9H15C15.5523 9 16 8.55229 16 8C16 7.44772 15.5523 7 15 7H9V1Z\" fill=\"", "\" fill-opacity=\"", "\" /></svg>');}.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url('data:image/svg+xml;charset=UTF-8,<svg width=\"14\" height=\"3\" viewBox=\"0 0 14 3\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M0 1.99707C0 1.44479 0.447715 0.99707 1 0.99707H13C13.5523 0.99707 14 1.44479 14 1.99707C14 2.54936 13.5523 2.99707 13 2.99707H1C0.447715 2.99707 0 2.54936 0 1.99707Z\" fill=\"", "\" fill-opacity=\"", "\" /></svg>');}}}.maplibregl-ctrl-bottom-left{display:", ";position:absolute;z-index:0;bottom:16px;left:12px;width:86px;height:29px;border-radius:4px;margin:0;background-color:", ";box-shadow:0px 26px 103px rgba(0,0,0,0.13),0px 11px 18px rgba(0,0,0,0.06),0px 3px 6px rgba(0,0,0,0.06);.maplibregl-ctrl-scale{background-color:", ";color:", ";border:2px solid ", ";border-top:0;border-left:0;border-right:0;padding:0;margin:6px 8px 8px 8px;line-height:13px;letter-spacing:0.02em;font-family:sans-serif;font-size:10px;}}"], function (props) {
|
|
2170
|
+
return props.backgroundColor;
|
|
2171
|
+
}, function (props) {
|
|
2172
|
+
return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
|
|
2173
|
+
}, function (props) {
|
|
2174
|
+
return props.controlBackgroundColor;
|
|
2175
|
+
}, function (props) {
|
|
2176
|
+
return props.controlIconColorEncoded.color;
|
|
2177
|
+
}, function (props) {
|
|
2178
|
+
return props.controlIconColorEncoded.opacity;
|
|
2179
|
+
}, function (props) {
|
|
2180
|
+
return props.controlIconColorEncoded.color;
|
|
2181
|
+
}, function (props) {
|
|
2182
|
+
return props.controlIconColorEncoded.opacity;
|
|
2183
|
+
}, function (props) {
|
|
2184
|
+
return props.showScale ? 'inline' : 'none';
|
|
2185
|
+
}, function (props) {
|
|
2186
|
+
return props.controlBackgroundColor;
|
|
2187
|
+
}, function (props) {
|
|
2188
|
+
return props.controlBackgroundColor;
|
|
2189
|
+
}, function (props) {
|
|
2190
|
+
return props.controlForegroundColor;
|
|
2191
|
+
}, function (props) {
|
|
2192
|
+
return props.controlForegroundColor;
|
|
2193
|
+
});
|
|
2194
|
+
exports.default = PureMapContainer;
|
|
2195
|
+
|
|
2196
|
+
/***/ }),
|
|
2197
|
+
/* 195 */
|
|
2198
|
+
/***/ (function(module, exports) {
|
|
2199
|
+
|
|
2200
|
+
module.exports = require("maplibre-gl/dist/maplibre-gl.css");
|
|
2201
|
+
|
|
2202
|
+
/***/ }),
|
|
2203
|
+
/* 196 */
|
|
2204
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2205
|
+
|
|
2206
|
+
"use strict";
|
|
2207
|
+
|
|
2208
|
+
|
|
2209
|
+
var _slicedToArray = __webpack_require__(48);
|
|
2210
|
+
|
|
2211
|
+
var _toConsumableArray = __webpack_require__(39);
|
|
2212
|
+
|
|
2213
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2214
|
+
value: true
|
|
2215
|
+
});
|
|
2216
|
+
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;
|
|
2217
|
+
|
|
2218
|
+
var maplibre_gl_1 = __webpack_require__(123);
|
|
2219
|
+
|
|
2220
|
+
var lodash_1 = __webpack_require__(2);
|
|
2221
|
+
|
|
2222
|
+
var d3_scale_1 = __webpack_require__(69);
|
|
2223
|
+
|
|
2224
|
+
var colorUtils_1 = __webpack_require__(11);
|
|
2225
|
+
|
|
2226
|
+
var visualization_color_palettes_1 = __webpack_require__(41);
|
|
2227
|
+
|
|
2228
|
+
var MarkerIcons_1 = __webpack_require__(197);
|
|
2229
|
+
|
|
2230
|
+
exports.DEFAULT_RESULT_LIMIT = 1000;
|
|
2231
|
+
exports.DEFAULT_CLUSTER_COLOR = '#909090';
|
|
2232
|
+
exports.DEFAULT_SERIES_COLORS = visualization_color_palettes_1.VIZ_CATEGORICAL; // MapLibre requires a map style specification number which is always 8
|
|
2233
|
+
|
|
2234
|
+
exports.MAP_STYLE_VERSION_NUMBER = 8;
|
|
2235
|
+
exports.MIN_BUBBLE_RADIUS = 4;
|
|
2236
|
+
exports.MAX_BUBBLE_RADIUS = 50; // 58
|
|
2237
|
+
// Returns marker background img with the requiref fillColor based on the theme
|
|
2238
|
+
|
|
2239
|
+
var getMarkerSVGBackgroundImg = function getMarkerSVGBackgroundImg(color, theme) {
|
|
2240
|
+
var fillColor = color.replace('#', '%23');
|
|
2241
|
+
return theme === 'light' ? MarkerIcons_1.defaultMarkerLightTheme(fillColor) : MarkerIcons_1.defaultMarkerDarkTheme(fillColor);
|
|
2242
|
+
};
|
|
2243
|
+
|
|
2244
|
+
exports.getMarkerSVGBackgroundImg = getMarkerSVGBackgroundImg; // Given a map instance and marker layer inputs, this method adds marker layers
|
|
2245
|
+
// Note :- Separated this as a util function for better testability
|
|
2246
|
+
|
|
2247
|
+
var renderMarkerLayer = function renderMarkerLayer(markerLayer, themeColorScheme, map, setTooltipProps) {
|
|
2248
|
+
if (!markerLayer || !map || !map.current || !Array.isArray(markerLayer.latitude) || !Array.isArray(markerLayer.longitude)) {
|
|
2249
|
+
return null;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
var lat = markerLayer.latitude;
|
|
2253
|
+
var lon = markerLayer.longitude;
|
|
2254
|
+
var isStaticColor = !markerLayer.dataColors;
|
|
2255
|
+
var limit = Math.min(lat.length, lon.length, markerLayer.resultLimit ? markerLayer.resultLimit : exports.DEFAULT_RESULT_LIMIT);
|
|
2256
|
+
var markers = [];
|
|
2257
|
+
var colors = [];
|
|
2258
|
+
|
|
2259
|
+
var _loop = function _loop(i) {
|
|
2260
|
+
var staticColor = markerLayer.seriesColors && colorUtils_1.isColor(markerLayer.seriesColors[0]) ? markerLayer.seriesColors[0] : exports.DEFAULT_CLUSTER_COLOR;
|
|
2261
|
+
var dynamicColor = markerLayer.dataColors && colorUtils_1.isColor(markerLayer.dataColors[i]) ? markerLayer.dataColors[i] : exports.DEFAULT_CLUSTER_COLOR;
|
|
2262
|
+
var color = isStaticColor ? staticColor : dynamicColor;
|
|
2263
|
+
colors.push(color); // create a HTML element for each marker
|
|
2264
|
+
|
|
2265
|
+
var el = document.createElement('div');
|
|
2266
|
+
el.className = 'custom-marker';
|
|
2267
|
+
el.style.backgroundImage = "url('data:image/svg+xml;charset=UTF-8,".concat(exports.getMarkerSVGBackgroundImg(color, themeColorScheme), "')");
|
|
2268
|
+
el.addEventListener('mouseover', function () {
|
|
2269
|
+
setTooltipProps({
|
|
2270
|
+
anchor: el,
|
|
2271
|
+
longitude: lon[i],
|
|
2272
|
+
latitude: lat[i]
|
|
2273
|
+
});
|
|
2274
|
+
});
|
|
2275
|
+
el.addEventListener('mouseleave', function () {
|
|
2276
|
+
setTooltipProps({
|
|
2277
|
+
longitude: lon[i],
|
|
2278
|
+
latitude: lat[i]
|
|
2279
|
+
});
|
|
2280
|
+
}); // make a marker for each [lon,lat] and add to the map
|
|
2281
|
+
|
|
2282
|
+
markers.push(new maplibre_gl_1.Marker(el).setLngLat([lon[i], lat[i]]).addTo(map.current));
|
|
2283
|
+
};
|
|
2284
|
+
|
|
2285
|
+
for (var i = 0; i < limit; i += 1) {
|
|
2286
|
+
_loop(i);
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
return {
|
|
2290
|
+
markers: markers,
|
|
2291
|
+
colors: colors
|
|
2292
|
+
};
|
|
2293
|
+
};
|
|
2294
|
+
|
|
2295
|
+
exports.renderMarkerLayer = renderMarkerLayer;
|
|
2296
|
+
/**
|
|
2297
|
+
* Construct a tile preset {key: config} by combining the default + custom tile configs
|
|
2298
|
+
* Also returns the default tile config for each theme - light/dark
|
|
2299
|
+
* @param {MapContextInterface} args
|
|
2300
|
+
* @param {BaseTileConfig[]} args.defaultTileConfig
|
|
2301
|
+
* @param {BaseTileConfig[]} args.customTileConfig
|
|
2302
|
+
* @returns {Object} tile preset
|
|
2303
|
+
*/
|
|
2304
|
+
|
|
2305
|
+
var getTilePreset = function getTilePreset(_ref) {
|
|
2306
|
+
var _ref$defaultTileConfi = _ref.defaultTileConfig,
|
|
2307
|
+
defaultTileConfig = _ref$defaultTileConfi === void 0 ? [] : _ref$defaultTileConfi,
|
|
2308
|
+
_ref$customTileConfig = _ref.customTileConfig,
|
|
2309
|
+
customTileConfig = _ref$customTileConfig === void 0 ? [] : _ref$customTileConfig;
|
|
2310
|
+
|
|
2311
|
+
var _a, _b;
|
|
2312
|
+
|
|
2313
|
+
var tilePreset = {};
|
|
2314
|
+
var defaultTileLight = {};
|
|
2315
|
+
var defaultTileDark = {};
|
|
2316
|
+
var tileConfigs = [].concat(defaultTileConfig).concat(customTileConfig);
|
|
2317
|
+
lodash_1.forEach(tileConfigs, function (tileConfig) {
|
|
2318
|
+
var key = tileConfig === null || tileConfig === void 0 ? void 0 : tileConfig.key;
|
|
2319
|
+
var updatedConfig = Object.assign(Object.assign({
|
|
2320
|
+
theme: 'all'
|
|
2321
|
+
}, tileConfig), {
|
|
2322
|
+
version: exports.MAP_STYLE_VERSION_NUMBER
|
|
2323
|
+
});
|
|
2324
|
+
tilePreset[key] = updatedConfig;
|
|
2325
|
+
});
|
|
2326
|
+
|
|
2327
|
+
if (defaultTileConfig.length > 0) {
|
|
2328
|
+
defaultTileLight = (_a = defaultTileConfig.find(function (config) {
|
|
2329
|
+
return config.theme === 'light';
|
|
2330
|
+
})) !== null && _a !== void 0 ? _a : defaultTileConfig.find(function (config) {
|
|
2331
|
+
return config.theme === undefined;
|
|
2332
|
+
});
|
|
2333
|
+
defaultTileDark = (_b = defaultTileConfig.find(function (config) {
|
|
2334
|
+
return config.theme === 'dark';
|
|
2335
|
+
})) !== null && _b !== void 0 ? _b : defaultTileConfig.find(function (config) {
|
|
2336
|
+
return config.theme === undefined;
|
|
2337
|
+
});
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
return {
|
|
2341
|
+
tilePreset: tilePreset,
|
|
2342
|
+
defaultTileLight: defaultTileLight,
|
|
2343
|
+
defaultTileDark: defaultTileDark
|
|
2344
|
+
};
|
|
2345
|
+
};
|
|
2346
|
+
|
|
2347
|
+
exports.getTilePreset = getTilePreset;
|
|
2348
|
+
/**
|
|
2349
|
+
* Check if baseLayerTileServer is in tilePreset and config matches current theme, if yes, return.
|
|
2350
|
+
* If no, construct a mapStyle with baseLayerTilerServer and baseLayerTileServerType
|
|
2351
|
+
* Else return default tile config based on current theme
|
|
2352
|
+
* @param {Object} args
|
|
2353
|
+
* @param {BaseTileConfig[]} args.tilePreset
|
|
2354
|
+
* @param {String} args.baseLayerTilerServer
|
|
2355
|
+
* @param {String} args.baseLayerTileServerType
|
|
2356
|
+
* @param {String} args.colorScheme
|
|
2357
|
+
* @param {BaseTileConfig} args.defaultTileDark
|
|
2358
|
+
* @param {BaseTileConfig} args.defaultTileLight
|
|
2359
|
+
* @returns {BaseTileConfig} mapStyle
|
|
2360
|
+
*/
|
|
2361
|
+
|
|
2362
|
+
var getMapStyle = function getMapStyle(_ref2) {
|
|
2363
|
+
var _ref2$baseLayerTileSe = _ref2.baseLayerTileServer,
|
|
2364
|
+
baseLayerTileServer = _ref2$baseLayerTileSe === void 0 ? '' : _ref2$baseLayerTileSe,
|
|
2365
|
+
_ref2$baseLayerTileSe2 = _ref2.baseLayerTileServerType,
|
|
2366
|
+
baseLayerTileServerType = _ref2$baseLayerTileSe2 === void 0 ? '' : _ref2$baseLayerTileSe2,
|
|
2367
|
+
_ref2$tilePreset = _ref2.tilePreset,
|
|
2368
|
+
tilePreset = _ref2$tilePreset === void 0 ? {} : _ref2$tilePreset,
|
|
2369
|
+
_ref2$colorScheme = _ref2.colorScheme,
|
|
2370
|
+
colorScheme = _ref2$colorScheme === void 0 ? 'light' : _ref2$colorScheme,
|
|
2371
|
+
_ref2$defaultTileLigh = _ref2.defaultTileLight,
|
|
2372
|
+
defaultTileLight = _ref2$defaultTileLigh === void 0 ? {} : _ref2$defaultTileLigh,
|
|
2373
|
+
_ref2$defaultTileDark = _ref2.defaultTileDark,
|
|
2374
|
+
defaultTileDark = _ref2$defaultTileDark === void 0 ? {} : _ref2$defaultTileDark;
|
|
2375
|
+
|
|
2376
|
+
if (baseLayerTileServer && tilePreset[baseLayerTileServer] && (tilePreset[baseLayerTileServer].theme === colorScheme || tilePreset[baseLayerTileServer].theme === 'all')) {
|
|
2377
|
+
return tilePreset[baseLayerTileServer];
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
if (baseLayerTileServer && baseLayerTileServerType) {
|
|
2381
|
+
var tiles = [];
|
|
2382
|
+
/**
|
|
2383
|
+
* Tile Server URLs (eg: http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png) can specify the variable {s} which refers to a subdomain
|
|
2384
|
+
* Subdomains are used to help with browser parallel requests per domain limitation. These subdomains are typically single letters 'a', 'b' and 'c'
|
|
2385
|
+
* Refer to https://leafletjs.com/SlavaUkraini/reference.html#tilelayer and https://wiki.openstreetmap.org/wiki/Tile_servers
|
|
2386
|
+
*/
|
|
2387
|
+
|
|
2388
|
+
if (baseLayerTileServer.match(/^(https?):\/\/{(s|S)}\../)) {
|
|
2389
|
+
/**
|
|
2390
|
+
* sXML (Leaflet) allows users to define their own tile server URLs + list of available subdomains
|
|
2391
|
+
* In order to preserve this behavior during conversion to splunk.map,
|
|
2392
|
+
* if the variable {s} or {S} is detected, replace it with 'a', 'b' and 'c' - default values for subdomains
|
|
2393
|
+
* TODO: in the future, add an additional prop - baseLayerTileServerSubdomains: ['x', 'y', 'z'], default being ['a', 'b', 'c']
|
|
2394
|
+
*/
|
|
2395
|
+
tiles = [baseLayerTileServer.replace(/{(s|S)}/, 'a'), baseLayerTileServer.replace(/{(s|S)}/, 'b'), baseLayerTileServer.replace(/{(s|S)}/, 'c')];
|
|
2396
|
+
} else {
|
|
2397
|
+
tiles = [baseLayerTileServer];
|
|
2398
|
+
} // TODO: remove hardcoded style when we allow users to pass in layer style through Viz options
|
|
2399
|
+
|
|
2400
|
+
|
|
2401
|
+
var mapStyle = {
|
|
2402
|
+
version: exports.MAP_STYLE_VERSION_NUMBER,
|
|
2403
|
+
sources: {
|
|
2404
|
+
'base-tiles': {
|
|
2405
|
+
type: baseLayerTileServerType,
|
|
2406
|
+
tiles: tiles,
|
|
2407
|
+
tileSize: 256
|
|
2408
|
+
}
|
|
2409
|
+
},
|
|
2410
|
+
layers: [{
|
|
2411
|
+
id: 'base-layer',
|
|
2412
|
+
type: 'raster',
|
|
2413
|
+
source: 'base-tiles',
|
|
2414
|
+
minzoom: 0,
|
|
2415
|
+
maxzoom: 10
|
|
2416
|
+
}]
|
|
2417
|
+
};
|
|
2418
|
+
return mapStyle;
|
|
2419
|
+
} // if tile server is not present in the preset AND we can't construct a mapStyle, fall back on defaults
|
|
2420
|
+
|
|
2421
|
+
|
|
2422
|
+
return colorScheme === 'light' ? defaultTileLight : defaultTileDark;
|
|
2423
|
+
};
|
|
2424
|
+
|
|
2425
|
+
exports.getMapStyle = getMapStyle;
|
|
2426
|
+
|
|
2427
|
+
var getZoomLevelFromGeobin = function getZoomLevelFromGeobin(geobinStr) {
|
|
2428
|
+
if (!geobinStr) {
|
|
2429
|
+
return null;
|
|
2430
|
+
} // geostats cmds return geobin with zoom level 0-18, 0-99 in the geobinPattern covers the range
|
|
2431
|
+
|
|
2432
|
+
|
|
2433
|
+
var geobinPattern = /(?<=bin_id_zl_).([0-9]{0,2})?(?=_y_)/g;
|
|
2434
|
+
var match = geobinStr.match(geobinPattern);
|
|
2435
|
+
return match && parseInt(match[0], 10);
|
|
2436
|
+
};
|
|
2437
|
+
|
|
2438
|
+
exports.getZoomLevelFromGeobin = getZoomLevelFromGeobin; // Bubble colors - static
|
|
2439
|
+
|
|
2440
|
+
var getStaticColors = function getStaticColors(colorCount, colorArray) {
|
|
2441
|
+
if (colorCount < 0 || !colorCount) {
|
|
2442
|
+
return [exports.DEFAULT_CLUSTER_COLOR];
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
if (!colorArray || !colorArray.length) {
|
|
2446
|
+
return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
|
|
2447
|
+
return exports.DEFAULT_SERIES_COLORS[i];
|
|
2448
|
+
});
|
|
2449
|
+
} // loop through colorArray to pick the first $colorCount colors
|
|
2450
|
+
// start from begining again if colorCount > colorArray.length
|
|
2451
|
+
|
|
2452
|
+
|
|
2453
|
+
return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
|
|
2454
|
+
return colorUtils_1.isColor(colorArray[i % colorArray.length]) ? colorArray[i % colorArray.length] : exports.DEFAULT_CLUSTER_COLOR;
|
|
2455
|
+
});
|
|
2456
|
+
};
|
|
2457
|
+
|
|
2458
|
+
exports.getStaticColors = getStaticColors; // Bubble size
|
|
2459
|
+
|
|
2460
|
+
var matchSize = function matchSize(dataRange, data) {
|
|
2461
|
+
var size = d3_scale_1.scalePow().exponent(0.2).domain(dataRange).range([exports.MIN_BUBBLE_RADIUS, exports.MAX_BUBBLE_RADIUS])(data);
|
|
2462
|
+
|
|
2463
|
+
if (size > exports.MAX_BUBBLE_RADIUS) {
|
|
2464
|
+
return exports.MAX_BUBBLE_RADIUS;
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
if (size < exports.MIN_BUBBLE_RADIUS) {
|
|
2468
|
+
return exports.MIN_BUBBLE_RADIUS;
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
return size;
|
|
2472
|
+
};
|
|
2473
|
+
|
|
2474
|
+
exports.matchSize = matchSize;
|
|
2475
|
+
|
|
2476
|
+
var transposeArray = function transposeArray(array) {
|
|
2477
|
+
if (!array || !array.length || !array[0] || !array[0].length) {
|
|
2478
|
+
return [];
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
return array[0].map(function (_, i) {
|
|
2482
|
+
return array.map(function (row) {
|
|
2483
|
+
return row[i];
|
|
2484
|
+
});
|
|
2485
|
+
});
|
|
2486
|
+
};
|
|
2487
|
+
|
|
2488
|
+
exports.transposeArray = transposeArray;
|
|
2489
|
+
|
|
2490
|
+
var bakeBubbleData = function bakeBubbleData(layer) {
|
|
2491
|
+
var _a;
|
|
2492
|
+
|
|
2493
|
+
if (!layer || !((_a = layer.bubbleSize) === null || _a === void 0 ? void 0 : _a.length) || !layer.geobin || !layer.geobin.length || !layer.latitude || !layer.latitude.length || !layer.longitude || !layer.longitude.length) {
|
|
2494
|
+
return null;
|
|
2495
|
+
} // if bubbleSize is passed as an array of single number array (data series)
|
|
2496
|
+
// e.g. [value0, value1, ...]
|
|
2497
|
+
// format each value as an array to unify data operations for data series and frames
|
|
2498
|
+
|
|
2499
|
+
|
|
2500
|
+
var transposedBubbleSize = layer.bubbleSize.map(function (n) {
|
|
2501
|
+
return [n];
|
|
2502
|
+
});
|
|
2503
|
+
var isPie = false; // format array if bubbleSize is passed as an array of array (data frame)
|
|
2504
|
+
|
|
2505
|
+
if (typeof layer.bubbleSize[0] !== 'number') {
|
|
2506
|
+
// one-time array transpose,
|
|
2507
|
+
// e.g. from [column0data, column0data] (multi series)
|
|
2508
|
+
// to [[column0datum0, column1datum0], [column0datum1, column1data1], ...]
|
|
2509
|
+
// or e.g. from [column0data] (single series)
|
|
2510
|
+
// to [[column0data]]
|
|
2511
|
+
// for easy access of values at each geo location,
|
|
2512
|
+
// and min max pie size computation
|
|
2513
|
+
transposedBubbleSize = exports.transposeArray(layer.bubbleSize); // if multiple series in the dataframe, set isPie to true
|
|
2514
|
+
|
|
2515
|
+
if (layer.bubbleSize.length > 1) {
|
|
2516
|
+
isPie = true;
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
if (!transposedBubbleSize || !transposedBubbleSize.length) {
|
|
2521
|
+
return null;
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
var data = layer.latitude.map(function (lat, i) {
|
|
2525
|
+
return {
|
|
2526
|
+
zoom: exports.getZoomLevelFromGeobin(layer.geobin[i]),
|
|
2527
|
+
values: transposedBubbleSize[i],
|
|
2528
|
+
coordinates: [layer.longitude[i], lat]
|
|
2529
|
+
};
|
|
2530
|
+
}); // compute the min/max value to encode min/max pie or bubble size
|
|
2531
|
+
|
|
2532
|
+
var min = lodash_1.sum(transposedBubbleSize[0]);
|
|
2533
|
+
var max = lodash_1.sum(transposedBubbleSize[1]);
|
|
2534
|
+
transposedBubbleSize.forEach(function (row) {
|
|
2535
|
+
var bubbleSize = lodash_1.sum(row);
|
|
2536
|
+
max = bubbleSize > max ? bubbleSize : max;
|
|
2537
|
+
min = bubbleSize < min ? bubbleSize : min;
|
|
2538
|
+
});
|
|
2539
|
+
return {
|
|
2540
|
+
data: data,
|
|
2541
|
+
dataRange: [min, max],
|
|
2542
|
+
isPie: isPie,
|
|
2543
|
+
resultLimit: layer.resultLimit,
|
|
2544
|
+
transposedBubbleSize: transposedBubbleSize,
|
|
2545
|
+
bubbleSizeFields: layer.bubbleSizeFields
|
|
2546
|
+
};
|
|
2547
|
+
};
|
|
2548
|
+
|
|
2549
|
+
exports.bakeBubbleData = bakeBubbleData; // Update bubbles on each zoom level
|
|
2550
|
+
|
|
2551
|
+
var updateBubbles = function updateBubbles(dataObj, zoomLevel, staticColors, dynamicColors, theme, map, setTooltipProps) {
|
|
2552
|
+
if (!dataObj || !dataObj.data.length || !map || !map.current) {
|
|
2553
|
+
return null;
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
var data = dataObj.data,
|
|
2557
|
+
dataRange = dataObj.dataRange,
|
|
2558
|
+
resultLimit = dataObj.resultLimit,
|
|
2559
|
+
transposedBubbleSize = dataObj.transposedBubbleSize,
|
|
2560
|
+
bubbleSizeFields = dataObj.bubbleSizeFields,
|
|
2561
|
+
isPie = dataObj.isPie;
|
|
2562
|
+
|
|
2563
|
+
if (!data || !data.length || !dataRange || !dataRange.length) {
|
|
2564
|
+
return null;
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
var roundedZoom = Math.round(zoomLevel);
|
|
2568
|
+
var themeColor = theme === 'light' ? '#ffffff' : '#1a1c20'; // filter data for the current zoom level and sort base on values
|
|
2569
|
+
|
|
2570
|
+
var dataToRender = data.reduce(function (acc, datum, i) {
|
|
2571
|
+
if (datum.zoom === roundedZoom) {
|
|
2572
|
+
acc.push({
|
|
2573
|
+
data: datum,
|
|
2574
|
+
idx: i
|
|
2575
|
+
});
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
return acc;
|
|
2579
|
+
}, []).slice(0, resultLimit || exports.DEFAULT_RESULT_LIMIT).sort(function (a, b) {
|
|
2580
|
+
return lodash_1.sum(b.data.values) - lodash_1.sum(a.data.values);
|
|
2581
|
+
});
|
|
2582
|
+
return dataToRender.map(function (datum, i) {
|
|
2583
|
+
// create an HTML element for each bubble
|
|
2584
|
+
var colors = dynamicColors ? [dataToRender.map(function (obj) {
|
|
2585
|
+
return colorUtils_1.isColor(dynamicColors[obj.idx]) ? dynamicColors[obj.idx] : exports.DEFAULT_CLUSTER_COLOR;
|
|
2586
|
+
})[i]] : staticColors;
|
|
2587
|
+
var el = exports.createPieChart(datum.data.values, dataRange, colors, themeColor, isPie);
|
|
2588
|
+
|
|
2589
|
+
var _datum$data$coordinat = _slicedToArray(datum.data.coordinates, 2),
|
|
2590
|
+
longitude = _datum$data$coordinat[0],
|
|
2591
|
+
latitude = _datum$data$coordinat[1];
|
|
2592
|
+
|
|
2593
|
+
var bubbleSize = transposedBubbleSize[i].map(function (count, index) {
|
|
2594
|
+
return {
|
|
2595
|
+
name: bubbleSizeFields[index],
|
|
2596
|
+
count: count,
|
|
2597
|
+
color: colors[index]
|
|
2598
|
+
};
|
|
2599
|
+
});
|
|
2600
|
+
el.addEventListener('mouseover', function () {
|
|
2601
|
+
setTooltipProps({
|
|
2602
|
+
anchor: el,
|
|
2603
|
+
longitude: longitude,
|
|
2604
|
+
latitude: latitude,
|
|
2605
|
+
bubbleSize: bubbleSize
|
|
2606
|
+
});
|
|
2607
|
+
});
|
|
2608
|
+
el.addEventListener('mouseleave', function () {
|
|
2609
|
+
setTooltipProps({
|
|
2610
|
+
longitude: longitude,
|
|
2611
|
+
latitude: latitude,
|
|
2612
|
+
bubbleSize: bubbleSize
|
|
2613
|
+
});
|
|
2614
|
+
});
|
|
2615
|
+
return new maplibre_gl_1.Marker({
|
|
2616
|
+
element: el
|
|
2617
|
+
}).setLngLat(datum.data.coordinates).addTo(map.current);
|
|
2618
|
+
});
|
|
2619
|
+
};
|
|
2620
|
+
|
|
2621
|
+
exports.updateBubbles = updateBubbles; // Create an SVG pie from column values
|
|
2622
|
+
|
|
2623
|
+
var createPieChart = function createPieChart(values, valueRange, colors, themeColor, isPie) {
|
|
2624
|
+
var offsets = [];
|
|
2625
|
+
var total = 0;
|
|
2626
|
+
values.forEach(function (count) {
|
|
2627
|
+
offsets.push(total);
|
|
2628
|
+
total += count;
|
|
2629
|
+
});
|
|
2630
|
+
var radius = exports.matchSize(valueRange, total);
|
|
2631
|
+
var width = radius * 2; // create bubble svg
|
|
2632
|
+
|
|
2633
|
+
var html = "<div>\n <svg width=\"".concat(width, "\" height=\"").concat(width, "\" viewbox=\"-3 -3 ").concat(width + 6, " ").concat(width + 6, "\" >"); // add border for pie
|
|
2634
|
+
|
|
2635
|
+
if (isPie) {
|
|
2636
|
+
html += "<circle cx=".concat(radius, " cy=").concat(radius, " r=").concat(radius, " fill='none' stroke-width=\"2\" stroke=").concat(themeColor, " stroke-opacity=\"0.3\"/>");
|
|
2637
|
+
} // create pie segments
|
|
2638
|
+
|
|
2639
|
+
|
|
2640
|
+
values.forEach(function (v, i) {
|
|
2641
|
+
html += exports.pieSegment(offsets[i] / total, (offsets[i] + v) / total, radius, colors[i], themeColor);
|
|
2642
|
+
});
|
|
2643
|
+
html += "</svg>\n </div>";
|
|
2644
|
+
var el = document.createElement('div');
|
|
2645
|
+
el.className = 'custom-bubble';
|
|
2646
|
+
el.innerHTML = html;
|
|
2647
|
+
return el;
|
|
2648
|
+
};
|
|
2649
|
+
|
|
2650
|
+
exports.createPieChart = createPieChart; // Create a pie segment
|
|
2651
|
+
|
|
2652
|
+
var pieSegment = function pieSegment(start, end, radius, color, themeColor) {
|
|
2653
|
+
if (end - start === 1) {
|
|
2654
|
+
return "<circle cx=".concat(radius, " cy=").concat(radius, " r=").concat(radius - 1, " fill=").concat(color, " fill-opacity=\"0.5\" stroke-width=\"1.5\" stroke=").concat(color, " />");
|
|
2655
|
+
}
|
|
2656
|
+
|
|
2657
|
+
var a0 = 2 * Math.PI * (start - 0.25);
|
|
2658
|
+
var a1 = 2 * Math.PI * (end - 0.25);
|
|
2659
|
+
var x0 = Math.cos(a0);
|
|
2660
|
+
var y0 = Math.sin(a0);
|
|
2661
|
+
var x1 = Math.cos(a1);
|
|
2662
|
+
var y1 = Math.sin(a1);
|
|
2663
|
+
var arc = end - start > 0.5 ? 1 : 0;
|
|
2664
|
+
return "<path d=\"M ".concat(radius, " ").concat(radius, " L ").concat(radius + radius * x0, " ").concat(radius + radius * y0, " A ").concat(radius, " ").concat(radius, " 0 ").concat(arc, " 1 ").concat(radius + radius * x1, " ").concat(radius + radius * y1, " L ").concat(radius, " ").concat(radius, " A 0 0 0 ").concat(arc, " 0 ").concat(radius, " ").concat(radius, "\" fill=\"").concat(color, "\" fill-opacity=\"0.8\" stroke=\"").concat(themeColor, "\" stroke-width=\"2\" stroke-opacity=\"0.3\" />");
|
|
2665
|
+
};
|
|
2666
|
+
|
|
2667
|
+
exports.pieSegment = pieSegment;
|
|
2668
|
+
|
|
2669
|
+
/***/ }),
|
|
2670
|
+
/* 197 */
|
|
2671
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2672
|
+
|
|
2673
|
+
"use strict";
|
|
2674
|
+
|
|
2675
|
+
|
|
2676
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2677
|
+
value: true
|
|
2678
|
+
});
|
|
2679
|
+
exports.defaultMarkerDarkTheme = exports.defaultMarkerLightTheme = void 0;
|
|
2680
|
+
|
|
2681
|
+
var defaultMarkerLightTheme = function defaultMarkerLightTheme(fillColor) {
|
|
2682
|
+
return "<svg width=\"22\" height=\"28\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11 .5C5.201.5.5 5.201.5 11c0 3.136 1.376 5.952 3.555 7.875 2.839 2.506 4.144 4.58 4.893 6.02.183.35.334.665.469.946l.014.03c.136.285.263.548.387.766.235.412.571.863 1.182.863.61 0 .947-.45 1.182-.863.124-.218.25-.48.387-.765l.014-.03c.135-.282.286-.597.469-.947.75-1.44 2.054-3.514 4.893-6.02A10.476 10.476 0 0 0 21.5 11C21.5 5.201 16.799.5 11 .5Z\" fill=\"".concat(fillColor, "\"/><path d=\"M11 .5C5.201.5.5 5.201.5 11c0 3.136 1.376 5.952 3.555 7.875 2.839 2.506 4.144 4.58 4.893 6.02.183.35.334.665.469.946l.014.03c.136.285.263.548.387.766.235.412.571.863 1.182.863.61 0 .947-.45 1.182-.863.124-.218.25-.48.387-.765l.014-.03c.135-.282.286-.597.469-.947.75-1.44 2.054-3.514 4.893-6.02A10.476 10.476 0 0 0 21.5 11C21.5 5.201 16.799.5 11 .5Z\" stroke=\"%2308090A\"/><path d=\"M11 .5C5.201.5.5 5.201.5 11c0 3.136 1.376 5.952 3.555 7.875 2.839 2.506 4.144 4.58 4.893 6.02.183.35.334.665.469.946l.014.03c.136.285.263.548.387.766.235.412.571.863 1.182.863.61 0 .947-.45 1.182-.863.124-.218.25-.48.387-.765l.014-.03c.135-.282.286-.597.469-.947.75-1.44 2.054-3.514 4.893-6.02A10.476 10.476 0 0 0 21.5 11C21.5 5.201 16.799.5 11 .5Z\" stroke=\"").concat(fillColor, "\" stroke-opacity=\".7\"/></svg>");
|
|
2683
|
+
};
|
|
2684
|
+
|
|
2685
|
+
exports.defaultMarkerLightTheme = defaultMarkerLightTheme;
|
|
2686
|
+
|
|
2687
|
+
var defaultMarkerDarkTheme = function defaultMarkerDarkTheme(fillColor) {
|
|
2688
|
+
return "<svg width=\"22\" height=\"28\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11 .5C5.201.5.5 5.201.5 11c0 3.136 1.376 5.952 3.555 7.875 2.839 2.506 4.144 4.58 4.893 6.02.183.35.334.665.469.946l.014.03c.136.285.263.548.387.766.235.412.571.863 1.182.863.61 0 .947-.45 1.182-.863.124-.218.25-.48.387-.765l.014-.03c.135-.282.286-.597.469-.947.75-1.44 2.054-3.514 4.893-6.02A10.476 10.476 0 0 0 21.5 11C21.5 5.201 16.799.5 11 .5Z\" fill=\"".concat(fillColor, "\"/><path d=\"M11 .5C5.201.5.5 5.201.5 11c0 3.136 1.376 5.952 3.555 7.875 2.839 2.506 4.144 4.58 4.893 6.02.183.35.334.665.469.946l.014.03c.136.285.263.548.387.766.235.412.571.863 1.182.863.61 0 .947-.45 1.182-.863.124-.218.25-.48.387-.765l.014-.03c.135-.282.286-.597.469-.947.75-1.44 2.054-3.514 4.893-6.02A10.476 10.476 0 0 0 21.5 11C21.5 5.201 16.799.5 11 .5Z\" stroke=\"%2308090A\"/><path d=\"M11 .5C5.201.5.5 5.201.5 11c0 3.136 1.376 5.952 3.555 7.875 2.839 2.506 4.144 4.58 4.893 6.02.183.35.334.665.469.946l.014.03c.136.285.263.548.387.766.235.412.571.863 1.182.863.61 0 .947-.45 1.182-.863.124-.218.25-.48.387-.765l.014-.03c.135-.282.286-.597.469-.947.75-1.44 2.054-3.514 4.893-6.02A10.476 10.476 0 0 0 21.5 11C21.5 5.201 16.799.5 11 .5Z\" stroke=\"").concat(fillColor, "\" stroke-opacity=\".15\"/></svg>");
|
|
2689
|
+
};
|
|
2690
|
+
|
|
2691
|
+
exports.defaultMarkerDarkTheme = defaultMarkerDarkTheme;
|
|
2692
|
+
|
|
2693
|
+
/***/ }),
|
|
2694
|
+
/* 198 */
|
|
2695
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2696
|
+
|
|
2697
|
+
"use strict";
|
|
2698
|
+
|
|
2699
|
+
|
|
2700
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2701
|
+
value: true
|
|
2702
|
+
});
|
|
2703
|
+
exports.convertDegToDMS = void 0;
|
|
2704
|
+
|
|
2705
|
+
var React = __webpack_require__(1);
|
|
2706
|
+
|
|
2707
|
+
var styled_components_1 = __webpack_require__(4);
|
|
2708
|
+
|
|
2709
|
+
var Popover_1 = __webpack_require__(100);
|
|
2710
|
+
|
|
2711
|
+
var i18n_1 = __webpack_require__(3);
|
|
2712
|
+
|
|
2713
|
+
var StyledPopover = styled_components_1.default(Popover_1.default).withConfig({
|
|
2714
|
+
displayName: "Tooltip__StyledPopover",
|
|
2715
|
+
componentId: "xwewsa-0"
|
|
2716
|
+
})(["width:250px;font-size:12px;"]);
|
|
2717
|
+
var StyledTable = styled_components_1.default.table.withConfig({
|
|
2718
|
+
displayName: "Tooltip__StyledTable",
|
|
2719
|
+
componentId: "xwewsa-1"
|
|
2720
|
+
})(["padding:2px 6px 2px 6px;width:100%;"]);
|
|
2721
|
+
var StyledTitleColumn = styled_components_1.default.td.withConfig({
|
|
2722
|
+
displayName: "Tooltip__StyledTitleColumn",
|
|
2723
|
+
componentId: "xwewsa-2"
|
|
2724
|
+
})(["opacity:0.85;"]);
|
|
2725
|
+
var StyledValueColumn = styled_components_1.default.td.withConfig({
|
|
2726
|
+
displayName: "Tooltip__StyledValueColumn",
|
|
2727
|
+
componentId: "xwewsa-3"
|
|
2728
|
+
})(["text-align:right;"]);
|
|
2729
|
+
var BubbleSizeColorBlock = styled_components_1.default.div.withConfig({
|
|
2730
|
+
displayName: "Tooltip__BubbleSizeColorBlock",
|
|
2731
|
+
componentId: "xwewsa-4"
|
|
2732
|
+
})(["background-color:", ";display:inline-block;margin-right:4px;border-radius:2px;width:6px;height:11px;transform:translateY(1px);"], function (props) {
|
|
2733
|
+
return props.color;
|
|
2734
|
+
});
|
|
2735
|
+
|
|
2736
|
+
var convertDegToDMS = function convertDegToDMS(deg, type) {
|
|
2737
|
+
var direction;
|
|
2738
|
+
|
|
2739
|
+
if (type === 'longitude') {
|
|
2740
|
+
direction = deg < 0 ? 'W' : 'E';
|
|
2741
|
+
} else if (type === 'latitude') {
|
|
2742
|
+
direction = deg < 0 ? 'S' : 'N';
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
var degrees = Math.floor(deg);
|
|
2746
|
+
var minfloat = Math.abs((deg - degrees) * 60);
|
|
2747
|
+
var minutes = Math.floor(minfloat);
|
|
2748
|
+
var secfloat = (minfloat - minutes) * 60;
|
|
2749
|
+
var seconds = Math.round(secfloat);
|
|
2750
|
+
degrees = Math.abs(degrees);
|
|
2751
|
+
|
|
2752
|
+
if (seconds === 60) {
|
|
2753
|
+
minutes += 1;
|
|
2754
|
+
seconds = 0;
|
|
2755
|
+
}
|
|
2756
|
+
|
|
2757
|
+
if (minutes === 60) {
|
|
2758
|
+
degrees += 1;
|
|
2759
|
+
minutes = 0;
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2762
|
+
return "".concat(degrees, "\xB0 ").concat(minutes, "' ").concat(seconds, "\" ").concat(direction);
|
|
2763
|
+
};
|
|
2764
|
+
|
|
2765
|
+
exports.convertDegToDMS = convertDegToDMS;
|
|
2766
|
+
|
|
2767
|
+
var Tooltip = function Tooltip(_ref) {
|
|
2768
|
+
var anchor = _ref.anchor,
|
|
2769
|
+
latitude = _ref.latitude,
|
|
2770
|
+
longitude = _ref.longitude,
|
|
2771
|
+
_ref$bubbleSize = _ref.bubbleSize,
|
|
2772
|
+
bubbleSize = _ref$bubbleSize === void 0 ? [] : _ref$bubbleSize;
|
|
2773
|
+
return React.createElement(StyledPopover, {
|
|
2774
|
+
open: !!anchor,
|
|
2775
|
+
anchor: anchor,
|
|
2776
|
+
"data-test": "map-marker-tooltip",
|
|
2777
|
+
defaultPlacement: "above"
|
|
2778
|
+
}, React.createElement(StyledTable, null, React.createElement("tbody", null, React.createElement("tr", null, React.createElement(StyledTitleColumn, null, i18n_1._('Latitude')), React.createElement(StyledValueColumn, {
|
|
2779
|
+
"data-test": "latitude"
|
|
2780
|
+
}, exports.convertDegToDMS(latitude, 'latitude'))), React.createElement("tr", null, React.createElement(StyledTitleColumn, null, i18n_1._('Longitude')), React.createElement(StyledValueColumn, {
|
|
2781
|
+
"data-test": "longitude"
|
|
2782
|
+
}, exports.convertDegToDMS(longitude, 'longitude'))), bubbleSize.map(function (_ref2) {
|
|
2783
|
+
var name = _ref2.name,
|
|
2784
|
+
count = _ref2.count,
|
|
2785
|
+
color = _ref2.color;
|
|
2786
|
+
return React.createElement("tr", {
|
|
2787
|
+
key: color
|
|
2788
|
+
}, React.createElement(StyledTitleColumn, {
|
|
2789
|
+
"data-test": "count-title"
|
|
2790
|
+
}, React.createElement(BubbleSizeColorBlock, {
|
|
2791
|
+
color: color
|
|
2792
|
+
}), name), React.createElement(StyledValueColumn, {
|
|
2793
|
+
"data-test": "count-value"
|
|
2794
|
+
}, count));
|
|
2795
|
+
}))));
|
|
2796
|
+
};
|
|
2797
|
+
|
|
2798
|
+
exports.default = Tooltip;
|
|
2799
|
+
|
|
2800
|
+
/***/ }),
|
|
2801
|
+
/* 199 */
|
|
2802
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2803
|
+
|
|
2804
|
+
"use strict";
|
|
2805
|
+
|
|
2806
|
+
|
|
2807
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2808
|
+
value: true
|
|
2809
|
+
});
|
|
2810
|
+
|
|
2811
|
+
var visualization_icons_1 = __webpack_require__(42);
|
|
2812
|
+
|
|
2813
|
+
var schemaUtils_1 = __webpack_require__(14);
|
|
2814
|
+
|
|
2815
|
+
var visualization_color_palettes_1 = __webpack_require__(41);
|
|
2816
|
+
|
|
2817
|
+
var themes_1 = __webpack_require__(70);
|
|
2818
|
+
|
|
2819
|
+
var i18n_1 = __webpack_require__(3);
|
|
2820
|
+
|
|
2821
|
+
var VizBehavior_1 = __webpack_require__(5);
|
|
2822
|
+
|
|
2823
|
+
var VizCategory_1 = __webpack_require__(26);
|
|
2824
|
+
|
|
2825
|
+
var configUtils_1 = __webpack_require__(6);
|
|
2826
|
+
|
|
2827
|
+
var defaultContext = {
|
|
2828
|
+
colorRangeConfig: [{
|
|
2829
|
+
to: 20,
|
|
2830
|
+
value: '#D41F1F'
|
|
2831
|
+
}, {
|
|
2832
|
+
from: 20,
|
|
2833
|
+
to: 40,
|
|
2834
|
+
value: '#D94E17'
|
|
2835
|
+
}, {
|
|
2836
|
+
from: 40,
|
|
2837
|
+
to: 60,
|
|
2838
|
+
value: '#CBA700'
|
|
2839
|
+
}, {
|
|
2840
|
+
from: 60,
|
|
2841
|
+
to: 80,
|
|
2842
|
+
value: '#669922'
|
|
2843
|
+
}, {
|
|
2844
|
+
from: 80,
|
|
2845
|
+
value: '#118832'
|
|
2846
|
+
}]
|
|
2847
|
+
};
|
|
2848
|
+
var dataContract = {
|
|
2849
|
+
requiredDataSources: [],
|
|
2850
|
+
optionalDataSources: [{
|
|
2851
|
+
name: 'primary',
|
|
2852
|
+
description: 'DataSource that powers the visualization.'
|
|
2853
|
+
}],
|
|
2854
|
+
initialRequestParams: {
|
|
2855
|
+
primary: {
|
|
2856
|
+
offset: 0,
|
|
2857
|
+
count: 10000
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
};
|
|
2861
|
+
var size = {
|
|
2862
|
+
initialWidth: 800,
|
|
2863
|
+
initialHeight: 600
|
|
2864
|
+
};
|
|
2865
|
+
var optionsSchema = {
|
|
2866
|
+
backgroundColor: {
|
|
2867
|
+
default: '> themes.defaultBackgroundColor',
|
|
2868
|
+
description: 'Specify the color for the background. You may use a dataSource to apply the color. The default for enterprise light is "#ffffff". The default for enterprise dark is "#000000". The default for prisma dark is "#0b0c0e".',
|
|
2869
|
+
pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA,
|
|
2870
|
+
type: 'string'
|
|
2871
|
+
},
|
|
2872
|
+
center: {
|
|
2873
|
+
default: [37.7749, -122.4194],
|
|
2874
|
+
type: 'array',
|
|
2875
|
+
description: 'Specify the center of the map in coordinates, in the form of [latitude, longitude]. When not provided, will automatically calculate map center based on available location data. When no location data available will fall back to [37.7749, -122.4194].',
|
|
2876
|
+
items: {
|
|
2877
|
+
type: 'number'
|
|
2878
|
+
}
|
|
2879
|
+
},
|
|
2880
|
+
layers: {
|
|
2881
|
+
default: [{
|
|
2882
|
+
type: 'bubble',
|
|
2883
|
+
latitude: '> primary | seriesByName("latitude")',
|
|
2884
|
+
longitude: '> primary | seriesByName("longitude")',
|
|
2885
|
+
seriesColors: visualization_color_palettes_1.VIZ_CATEGORICAL,
|
|
2886
|
+
bubbleSize: '> primary | frameWithoutSeriesNames("geobin", "latitude", "longitude") | frameBySeriesTypes("number")',
|
|
2887
|
+
tooltipFields: []
|
|
2888
|
+
}],
|
|
2889
|
+
type: 'array',
|
|
2890
|
+
description: 'Specify the data visualization layers on top of the base map. Can be empty to only show the base map.',
|
|
2891
|
+
items: {
|
|
2892
|
+
anyOf: [{
|
|
2893
|
+
type: 'object',
|
|
2894
|
+
properties: {
|
|
2895
|
+
type: {
|
|
2896
|
+
description: 'Specify the type of data layer method to display points on the map. For example, “bubble” or “marker”.',
|
|
2897
|
+
type: 'string',
|
|
2898
|
+
pattern: schemaUtils_1.getPattern(['marker']),
|
|
2899
|
+
default: 'marker'
|
|
2900
|
+
},
|
|
2901
|
+
latitude: {
|
|
2902
|
+
description: 'Specify a dataSource series to apply latitude coordinates for data points displayed on the map.',
|
|
2903
|
+
type: ['string', 'array'],
|
|
2904
|
+
default: '> primary | seriesByName("latitude")'
|
|
2905
|
+
},
|
|
2906
|
+
longitude: {
|
|
2907
|
+
description: 'Specify a dataSource series to apply longitude coordinates for data points displayed on the map.',
|
|
2908
|
+
type: ['string', 'array'],
|
|
2909
|
+
default: '> primary | seriesByName("longitude")'
|
|
2910
|
+
},
|
|
2911
|
+
dataColors: {
|
|
2912
|
+
description: 'Specify the colors used for data points. You may use an array of colors to be picked from, or you may use a dataSource to apply dynamic coloring. For example, “> primary | seriesByName("status") | matchValue(colorMatchConfig)”. ',
|
|
2913
|
+
type: ['string', 'array']
|
|
2914
|
+
},
|
|
2915
|
+
seriesColors: {
|
|
2916
|
+
default: visualization_color_palettes_1.VIZ_CATEGORICAL,
|
|
2917
|
+
description: 'Specify the colors used for data points.',
|
|
2918
|
+
type: 'array',
|
|
2919
|
+
items: {
|
|
2920
|
+
type: 'string',
|
|
2921
|
+
pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA
|
|
2922
|
+
}
|
|
2923
|
+
},
|
|
2924
|
+
tooltipFields: {
|
|
2925
|
+
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.',
|
|
2926
|
+
type: 'array',
|
|
2927
|
+
items: {
|
|
2928
|
+
type: 'string'
|
|
2929
|
+
},
|
|
2930
|
+
default: []
|
|
2931
|
+
},
|
|
2932
|
+
resultLimit: {
|
|
2933
|
+
description: 'Specify the maximum number of data points rendered on the map to improve performance.',
|
|
2934
|
+
type: 'number',
|
|
2935
|
+
default: 1000
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
}, {
|
|
2939
|
+
type: 'object',
|
|
2940
|
+
properties: {
|
|
2941
|
+
type: {
|
|
2942
|
+
description: 'Specify the type of data layer method to display points on the map. For example, “bubble” or “marker”.',
|
|
2943
|
+
type: 'string',
|
|
2944
|
+
pattern: schemaUtils_1.getPattern(['bubble']),
|
|
2945
|
+
default: 'bubble'
|
|
2946
|
+
},
|
|
2947
|
+
bubbleSize: {
|
|
2948
|
+
description: 'Specify the data column to encode bubble size',
|
|
2949
|
+
type: ['string', 'array'],
|
|
2950
|
+
default: '> primary | frameWithoutSeriesNames("geobin", "latitude", "longitude") | frameBySeriesTypes("number")'
|
|
2951
|
+
},
|
|
2952
|
+
latitude: {
|
|
2953
|
+
description: 'Specify a dataSource series to apply latitude coordinates for data points displayed on the map.',
|
|
2954
|
+
type: ['string', 'array'],
|
|
2955
|
+
items: {
|
|
2956
|
+
type: 'number'
|
|
2957
|
+
},
|
|
2958
|
+
default: '> primary | seriesByName("latitude")'
|
|
2959
|
+
},
|
|
2960
|
+
longitude: {
|
|
2961
|
+
description: 'Specify a dataSource series to apply longitude coordinates for data points displayed on the map.',
|
|
2962
|
+
type: ['string', 'array'],
|
|
2963
|
+
items: {
|
|
2964
|
+
type: 'number'
|
|
2965
|
+
},
|
|
2966
|
+
default: '> primary | seriesByName("longitude")'
|
|
2967
|
+
},
|
|
2968
|
+
dataColors: {
|
|
2969
|
+
description: 'Specify the colors used for data points. You may use an array of colors to be picked from, or you may use a dataSource to apply dynamic coloring. For example, “> primary | seriesByName("status") | matchValue(colorMatchConfig)”. ',
|
|
2970
|
+
type: ['string', 'array']
|
|
2971
|
+
},
|
|
2972
|
+
seriesColors: {
|
|
2973
|
+
default: visualization_color_palettes_1.VIZ_CATEGORICAL,
|
|
2974
|
+
description: "Specify the colors used for data points. For example, [\"#FF0000\", \"#0000FF\", \"#008000\"].",
|
|
2975
|
+
type: 'array',
|
|
2976
|
+
items: {
|
|
2977
|
+
type: 'string',
|
|
2978
|
+
pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA
|
|
2979
|
+
}
|
|
2980
|
+
},
|
|
2981
|
+
tooltipFields: {
|
|
2982
|
+
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.',
|
|
2983
|
+
type: 'array',
|
|
2984
|
+
items: {
|
|
2985
|
+
type: 'string'
|
|
2986
|
+
},
|
|
2987
|
+
default: []
|
|
2988
|
+
},
|
|
2989
|
+
resultLimit: {
|
|
2990
|
+
description: 'Specify the maximum number of data points rendered on the map to improve performance.',
|
|
2991
|
+
type: 'number',
|
|
2992
|
+
default: 1000
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
}]
|
|
2996
|
+
}
|
|
2997
|
+
},
|
|
2998
|
+
scaleUnit: {
|
|
2999
|
+
default: 'metric',
|
|
3000
|
+
type: 'string',
|
|
3001
|
+
description: 'Specify which scale unit to use.',
|
|
3002
|
+
pattern: schemaUtils_1.getPattern(['metric', 'imperial'])
|
|
3003
|
+
},
|
|
3004
|
+
// TODO: choropleth map retain old design
|
|
3005
|
+
// showBaseLayer: {
|
|
3006
|
+
// default: true,
|
|
3007
|
+
// type: 'boolean',
|
|
3008
|
+
// description: 'Specify if showing the base map.',
|
|
3009
|
+
// },
|
|
3010
|
+
showScale: {
|
|
3011
|
+
default: true,
|
|
3012
|
+
type: 'boolean',
|
|
3013
|
+
description: 'Specify whether the scale on the bottom left is shown.'
|
|
3014
|
+
},
|
|
3015
|
+
baseLayerTileServer: {
|
|
3016
|
+
type: 'string',
|
|
3017
|
+
description: 'Specify the tile set URL for the base map.'
|
|
3018
|
+
},
|
|
3019
|
+
baseLayerTileServerType: {
|
|
3020
|
+
type: 'string',
|
|
3021
|
+
description: 'Specify the type of tile set for the base map.',
|
|
3022
|
+
pattern: schemaUtils_1.getPattern(['vector', 'raster'])
|
|
3023
|
+
},
|
|
3024
|
+
zoom: {
|
|
3025
|
+
default: 5,
|
|
3026
|
+
description: 'Specify the zoom level of the map.',
|
|
3027
|
+
type: 'number'
|
|
3028
|
+
}
|
|
3029
|
+
};
|
|
3030
|
+
var themes = {
|
|
3031
|
+
defaultBackgroundColor: function defaultBackgroundColor(props) {
|
|
3032
|
+
return themes_1.pick({
|
|
3033
|
+
enterprise: {
|
|
3034
|
+
dark: themes_1.variables.black(props),
|
|
3035
|
+
light: themes_1.variables.backgroundColor(props)
|
|
3036
|
+
},
|
|
3037
|
+
prisma: themes_1.variables.backgroundColorSidebar(props)
|
|
3038
|
+
})(props);
|
|
3039
|
+
},
|
|
3040
|
+
controlBackgroundColor: function controlBackgroundColor(props) {
|
|
3041
|
+
return themes_1.pick({
|
|
3042
|
+
enterprise: {
|
|
3043
|
+
dark: themes_1.variables.gray22(props),
|
|
3044
|
+
light: themes_1.variables.white(props)
|
|
3045
|
+
},
|
|
3046
|
+
prisma: themes_1.variables.backgroundColorPopup(props)
|
|
3047
|
+
})(props);
|
|
3048
|
+
},
|
|
3049
|
+
controlForegroundColor: function controlForegroundColor(props) {
|
|
3050
|
+
return themes_1.pick({
|
|
3051
|
+
enterprise: themes_1.variables.textColor(props),
|
|
3052
|
+
prisma: themes_1.variables.contentColorDefault(props)
|
|
3053
|
+
})(props);
|
|
3054
|
+
}
|
|
3055
|
+
};
|
|
3056
|
+
var editorConfig = [{
|
|
3057
|
+
label: i18n_1._('Data Layer Formatting'),
|
|
3058
|
+
layout: [[{
|
|
3059
|
+
label: i18n_1._('Layer Type'),
|
|
3060
|
+
option: 'layers[0].type',
|
|
3061
|
+
editor: 'editor.select',
|
|
3062
|
+
editorProps: {
|
|
3063
|
+
values: [{
|
|
3064
|
+
label: i18n_1._('Marker'),
|
|
3065
|
+
value: 'marker'
|
|
3066
|
+
}, {
|
|
3067
|
+
label: i18n_1._('Bubble'),
|
|
3068
|
+
value: 'bubble'
|
|
3069
|
+
}]
|
|
3070
|
+
}
|
|
3071
|
+
}], [{
|
|
3072
|
+
label: i18n_1._('Latitude'),
|
|
3073
|
+
option: 'layers[0].latitude',
|
|
3074
|
+
editor: 'editor.columnSelector',
|
|
3075
|
+
editorProps: {
|
|
3076
|
+
dataSourceKey: 'primary'
|
|
3077
|
+
}
|
|
3078
|
+
}], [{
|
|
3079
|
+
label: i18n_1._('Longitude'),
|
|
3080
|
+
option: 'layers[0].longitude',
|
|
3081
|
+
editor: 'editor.columnSelector',
|
|
3082
|
+
editorProps: {
|
|
3083
|
+
dataSourceKey: 'primary'
|
|
3084
|
+
}
|
|
3085
|
+
}], [{
|
|
3086
|
+
label: i18n_1._('Size'),
|
|
3087
|
+
option: 'layers[0].bubbleSize',
|
|
3088
|
+
editor: 'editor.columnSelector',
|
|
3089
|
+
showEditor: function showEditor(_ref) {
|
|
3090
|
+
var options = _ref.options;
|
|
3091
|
+
return options.layers && options.layers.length && options.layers[0].type === 'bubble';
|
|
3092
|
+
},
|
|
3093
|
+
editorProps: {
|
|
3094
|
+
dataSourceKey: 'primary'
|
|
3095
|
+
}
|
|
3096
|
+
}]]
|
|
3097
|
+
}];
|
|
3098
|
+
/**
|
|
3099
|
+
* visualization configuration
|
|
3100
|
+
*/
|
|
3101
|
+
|
|
3102
|
+
var config = {
|
|
3103
|
+
/**
|
|
3104
|
+
* unique viz key
|
|
3105
|
+
*/
|
|
3106
|
+
key: 'splunk.map',
|
|
3107
|
+
|
|
3108
|
+
/**
|
|
3109
|
+
* viz name
|
|
3110
|
+
*/
|
|
3111
|
+
name: 'Map',
|
|
3112
|
+
category: VizCategory_1.VizCategory.CHOROPLETH,
|
|
3113
|
+
status: 'preview',
|
|
3114
|
+
|
|
3115
|
+
/**
|
|
3116
|
+
* viz icon
|
|
3117
|
+
*/
|
|
3118
|
+
icon: visualization_icons_1.Map,
|
|
3119
|
+
dataContract: dataContract,
|
|
3120
|
+
size: size,
|
|
3121
|
+
defaultContext: defaultContext,
|
|
3122
|
+
optionsSchema: optionsSchema,
|
|
3123
|
+
editorConfig: editorConfig,
|
|
3124
|
+
events: {
|
|
3125
|
+
'map.load': {
|
|
3126
|
+
description: 'triggered when map is fully loaded'
|
|
3127
|
+
}
|
|
3128
|
+
},
|
|
3129
|
+
supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS, VizBehavior_1.VizBehavior.PLACEHOLDER],
|
|
3130
|
+
themes: themes,
|
|
3131
|
+
requiredProps: []
|
|
3132
|
+
};
|
|
3133
|
+
exports.default = configUtils_1.enhanceConfig(config);
|
|
3134
|
+
|
|
3135
|
+
/***/ })
|
|
3136
|
+
/******/ ]);
|
|
3137
|
+
//# sourceMappingURL=Map.js.map
|