@splunk/visualizations 26.2.0 → 26.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.
Files changed (149) hide show
  1. package/Area.config.js +91 -594
  2. package/Area.config.js.map +1 -1
  3. package/Area.js +184 -689
  4. package/Area.js.map +1 -1
  5. package/Bar.config.js +92 -561
  6. package/Bar.config.js.map +1 -1
  7. package/Bar.js +184 -655
  8. package/Bar.js.map +1 -1
  9. package/Bubble.config.js +83 -482
  10. package/Bubble.config.js.map +1 -1
  11. package/Bubble.js +177 -578
  12. package/Bubble.js.map +1 -1
  13. package/ChoroplethSvg.config.js +76 -201
  14. package/ChoroplethSvg.config.js.map +1 -1
  15. package/ChoroplethSvg.js +173 -301
  16. package/ChoroplethSvg.js.map +1 -1
  17. package/Column.config.js +92 -599
  18. package/Column.config.js.map +1 -1
  19. package/Column.js +184 -693
  20. package/Column.js.map +1 -1
  21. package/Ellipse.config.js +82 -200
  22. package/Ellipse.config.js.map +1 -1
  23. package/Ellipse.js +137 -262
  24. package/Ellipse.js.map +1 -1
  25. package/Events.config.js +61 -282
  26. package/Events.config.js.map +1 -1
  27. package/Events.js +222 -428
  28. package/Events.js.map +1 -1
  29. package/FillerGauge.config.js +90 -219
  30. package/FillerGauge.config.js.map +1 -1
  31. package/FillerGauge.js +163 -299
  32. package/FillerGauge.js.map +1 -1
  33. package/Image.config.js +61 -157
  34. package/Image.config.js.map +1 -1
  35. package/Image.js +130 -242
  36. package/Image.js.map +1 -1
  37. package/Line.config.js +91 -606
  38. package/Line.config.js.map +1 -1
  39. package/Line.js +184 -701
  40. package/Line.js.map +1 -1
  41. package/LinkGraph.config.js +74 -256
  42. package/LinkGraph.config.js.map +1 -1
  43. package/LinkGraph.js +17198 -24224
  44. package/LinkGraph.js.map +1 -1
  45. package/Map.config.js +128 -1123
  46. package/Map.config.js.map +1 -1
  47. package/Map.js +309 -680
  48. package/Map.js.map +1 -1
  49. package/Markdown.config.js +61 -188
  50. package/Markdown.config.js.map +1 -1
  51. package/Markdown.js +190 -323
  52. package/Markdown.js.map +1 -1
  53. package/MarkerGauge.config.js +137 -297
  54. package/MarkerGauge.config.js.map +1 -1
  55. package/MarkerGauge.js +1038 -1203
  56. package/MarkerGauge.js.map +1 -1
  57. package/ParallelCoordinates.config.js +71 -191
  58. package/ParallelCoordinates.config.js.map +1 -1
  59. package/ParallelCoordinates.js +218 -343
  60. package/ParallelCoordinates.js.map +1 -1
  61. package/Pie.config.js +72 -240
  62. package/Pie.config.js.map +1 -1
  63. package/Pie.js +214 -381
  64. package/Pie.js.map +1 -1
  65. package/Punchcard.config.js +71 -305
  66. package/Punchcard.config.js.map +1 -1
  67. package/Punchcard.js +246 -477
  68. package/Punchcard.js.map +1 -1
  69. package/Rectangle.config.js +211 -347
  70. package/Rectangle.config.js.map +1 -1
  71. package/Rectangle.js +274 -416
  72. package/Rectangle.js.map +1 -1
  73. package/Sankey.config.js +71 -213
  74. package/Sankey.config.js.map +1 -1
  75. package/Sankey.js +246 -382
  76. package/Sankey.js.map +1 -1
  77. package/Scatter.config.js +85 -463
  78. package/Scatter.config.js.map +1 -1
  79. package/Scatter.js +825 -1202
  80. package/Scatter.js.map +1 -1
  81. package/SingleValue.config.js +114 -409
  82. package/SingleValue.config.js.map +1 -1
  83. package/SingleValue.js +287 -582
  84. package/SingleValue.js.map +1 -1
  85. package/SingleValueBasic.js +30 -30
  86. package/SingleValueBasic.js.map +1 -1
  87. package/SingleValueIcon.config.js +113 -378
  88. package/SingleValueIcon.config.js.map +1 -1
  89. package/SingleValueIcon.js +268 -533
  90. package/SingleValueIcon.js.map +1 -1
  91. package/SingleValueRadial.config.js +110 -382
  92. package/SingleValueRadial.config.js.map +1 -1
  93. package/SingleValueRadial.js +272 -543
  94. package/SingleValueRadial.js.map +1 -1
  95. package/SparkLine.js +24 -24
  96. package/SparkLine.js.map +1 -1
  97. package/Table.config.js +74 -496
  98. package/Table.config.js.map +1 -1
  99. package/Table.js +302 -720
  100. package/Table.js.map +1 -1
  101. package/common/Charting.js +22 -34
  102. package/common/Charting.js.map +1 -1
  103. package/common/DocExampleWithVizSandbox.js +21 -21
  104. package/common/DocExampleWithVizSandbox.js.map +1 -1
  105. package/common/EventsDoc.js +18 -18
  106. package/common/EventsDoc.js.map +1 -1
  107. package/common/GaugeMajorTicks.js +4 -4
  108. package/common/GaugeMajorTicks.js.map +1 -1
  109. package/common/GaugeValueMarker.js +2 -2
  110. package/common/GaugeValueMarker.js.map +1 -1
  111. package/common/OptionsDoc.js +4 -4
  112. package/common/OptionsDoc.js.map +1 -1
  113. package/common/OverviewDoc.js +39 -40
  114. package/common/OverviewDoc.js.map +1 -1
  115. package/common/SplunkVisualization.js +2 -2
  116. package/common/SplunkVisualization.js.map +1 -1
  117. package/common/SplunkVisualizationApi.js +2 -2
  118. package/common/SplunkVisualizationApi.js.map +1 -1
  119. package/common/ThemesDoc.js +19 -19
  120. package/common/ThemesDoc.js.map +1 -1
  121. package/common/chartingUtils.js +2 -2
  122. package/common/chartingUtils.js.map +1 -1
  123. package/common/gaugeUtils.js +10 -10
  124. package/common/gaugeUtils.js.map +1 -1
  125. package/common/shapeUtils.js +10 -10
  126. package/common/shapeUtils.js.map +1 -1
  127. package/common/utils/configUtils.js +25 -155
  128. package/common/utils/configUtils.js.map +1 -1
  129. package/common/utils/dataUtils.js +75 -87
  130. package/common/utils/dataUtils.js.map +1 -1
  131. package/common/utils/featureFlagUtils.js +4 -4
  132. package/common/utils/featureFlagUtils.js.map +1 -1
  133. package/common/utils/hocUtils.js +2 -2
  134. package/common/utils/hocUtils.js.map +1 -1
  135. package/common/utils/mapUtils.js +51 -54
  136. package/common/utils/mapUtils.js.map +1 -1
  137. package/common/utils/singleValueUtils.js +7 -7
  138. package/common/utils/singleValueUtils.js.map +1 -1
  139. package/common/utils/testHelper.js +7 -36
  140. package/common/utils/testHelper.js.map +1 -1
  141. package/common/utils/trellisUtils.js +7 -6
  142. package/common/utils/trellisUtils.js.map +1 -1
  143. package/common/utils/urlUtils.js +2 -2
  144. package/common/utils/urlUtils.js.map +1 -1
  145. package/common/withDashboardViz.js +65 -77
  146. package/common/withDashboardViz.js.map +1 -1
  147. package/package.json +46 -49
  148. package/common/utils/layoutUtils.js +0 -115
  149. package/common/utils/layoutUtils.js.map +0 -1
package/Map.config.js CHANGED
@@ -87,23 +87,40 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 57);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 54);
91
91
  /******/ })
92
92
  /************************************************************************/
93
- /******/ ([
94
- /* 0 */
93
+ /******/ ({
94
+
95
+ /***/ 0:
95
96
  /***/ (function(module, exports) {
96
97
 
97
98
  module.exports = require("@splunk/ui-utils/i18n");
98
99
 
99
100
  /***/ }),
100
- /* 1 */
101
+
102
+ /***/ 1:
101
103
  /***/ (function(module, exports) {
102
104
 
103
105
  module.exports = require("@babel/runtime/helpers/toConsumableArray");
104
106
 
105
107
  /***/ }),
106
- /* 2 */
108
+
109
+ /***/ 10:
110
+ /***/ (function(module, exports) {
111
+
112
+ module.exports = require("@splunk/visualization-icons/placeholders");
113
+
114
+ /***/ }),
115
+
116
+ /***/ 11:
117
+ /***/ (function(module, exports) {
118
+
119
+ module.exports = require("@splunk/visualization-icons");
120
+
121
+ /***/ }),
122
+
123
+ /***/ 12:
107
124
  /***/ (function(module, exports, __webpack_require__) {
108
125
 
109
126
  "use strict";
@@ -112,141 +129,66 @@ module.exports = require("@babel/runtime/helpers/toConsumableArray");
112
129
  Object.defineProperty(exports, "__esModule", {
113
130
  value: true
114
131
  });
115
- exports.VizBehavior = void 0;
116
- var VizBehavior;
117
132
 
118
- (function (VizBehavior) {
119
- /**
120
- * Dynamic Options Behavior.
121
- * This allows visualization options to be powered by data
122
- *
123
- * **Example**
124
- *
125
- * sparklineValues: ">primary|seriesByIndex(0)"
126
- * would configure sparklineValues with an array of data points
127
- * coming from the first series in the primary datasource
128
- *
129
- */
130
- VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
131
- VizBehavior["EVENTS"] = "events";
132
- VizBehavior["DOWNSAMPLING"] = "downsampling";
133
- /**
134
- * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
135
- * missing.
136
- * @type {string}
137
- */
133
+ var i18n_1 = __webpack_require__(0);
138
134
 
139
- VizBehavior["PLACEHOLDER"] = "placeholder";
140
- VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
141
- VizBehavior["TRELLIS"] = "trellis";
142
- })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
135
+ var background = function background(_ref) {
136
+ var label = _ref.label,
137
+ themes = _ref.themes,
138
+ labelPosition = _ref.labelPosition;
139
+ return [{
140
+ label: (0, i18n_1._)(label || 'Background'),
141
+ option: 'backgroundColor',
142
+ editor: 'editor.color',
143
+ editorProps: {
144
+ labelPosition: labelPosition || 'top',
145
+ themes: themes
146
+ }
147
+ }];
148
+ };
149
+
150
+ exports.default = background;
143
151
 
144
152
  /***/ }),
145
- /* 3 */
153
+
154
+ /***/ 19:
146
155
  /***/ (function(module, exports) {
147
156
 
148
- module.exports = require("@splunk/visualizations-shared/schemaUtils");
157
+ module.exports = require("@splunk/themes");
149
158
 
150
159
  /***/ }),
151
- /* 4 */
152
- /***/ (function(module, exports, __webpack_require__) {
153
160
 
154
- "use strict";
161
+ /***/ 2:
162
+ /***/ (function(module, exports) {
155
163
 
164
+ module.exports = require("@splunk/visualization-schemas");
156
165
 
157
- var _toConsumableArray = __webpack_require__(1);
166
+ /***/ }),
158
167
 
159
- var _defineProperty = __webpack_require__(7);
168
+ /***/ 3:
169
+ /***/ (function(module, exports, __webpack_require__) {
160
170
 
161
- var __rest = this && this.__rest || function (s, e) {
162
- var t = {};
171
+ "use strict";
163
172
 
164
- for (var p in s) {
165
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
166
- }
167
173
 
168
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
169
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
170
- }
171
- return t;
172
- };
174
+ var _toConsumableArray = __webpack_require__(1);
173
175
 
174
176
  Object.defineProperty(exports, "__esModule", {
175
177
  value: true
176
178
  });
177
- exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
178
-
179
- var lodash_1 = __webpack_require__(6);
179
+ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceConfig = exports.enhanceOptionsSchemaWithDynamicOptions = void 0;
180
180
 
181
- var schemaUtils_1 = __webpack_require__(3);
181
+ var lodash_1 = __webpack_require__(5); // included for backwards compatibility
182
182
 
183
- var VizBehavior_1 = __webpack_require__(2);
184
-
185
- var dynamicOptionsDSLType = {
186
- type: 'string',
187
- pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
188
- };
189
- /**
190
- * Helper function to extend an options schema with dynamic options DSL
191
- * @param optionsSchema a visualization's options schema
192
- * @returns an updated options schema that additionally allows strings starting with > for each option
193
- */
194
-
195
- function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
196
- var enhancedOptionsSchema = {};
197
- Object.keys(optionsSchema).forEach(function (key) {
198
- var _a = optionsSchema[key],
199
- title = _a.title,
200
- description = _a.description,
201
- readOnly = _a.readOnly,
202
- writeOnly = _a.writeOnly,
203
- examples = _a.examples,
204
- defaultValue = _a.default,
205
- type = _a.type,
206
- properties = _a.properties,
207
- patternProperties = _a.patternProperties,
208
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
209
-
210
- var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
211
- title: title
212
- }), description !== undefined && {
213
- description: description
214
- }), readOnly !== undefined && {
215
- readOnly: readOnly
216
- }), writeOnly !== undefined && {
217
- writeOnly: writeOnly
218
- }), examples !== undefined && {
219
- examples: examples
220
- }), defaultValue !== undefined && {
221
- default: defaultValue
222
- });
223
183
 
224
- if (type === 'object') {
225
- enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
226
- type: type
227
- }), properties && {
228
- properties: enhanceOptionsSchemaWithDynamicOptions(properties)
229
- });
230
-
231
- if (patternProperties) {
232
- var enhancedPatternProperties = {};
233
- Object.keys(patternProperties).forEach(function (opt) {
234
- enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
235
- });
236
- enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
237
- }
238
- } else {
239
- enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
240
- anyOf: [Object.assign(Object.assign({}, type !== undefined && {
241
- type: type
242
- }), remainingSchemaEntry), dynamicOptionsDSLType]
243
- });
244
- }
245
- });
246
- return enhancedOptionsSchema;
247
- }
184
+ var visualization_schemas_1 = __webpack_require__(2);
248
185
 
249
- exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
186
+ Object.defineProperty(exports, "enhanceOptionsSchemaWithDynamicOptions", {
187
+ enumerable: true,
188
+ get: function get() {
189
+ return visualization_schemas_1.enhanceOptionsSchemaWithDynamicOptions;
190
+ }
191
+ });
250
192
  /**
251
193
  * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
252
194
  * this function also collapse all editor panels
@@ -257,11 +199,6 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
257
199
 
258
200
  function enhanceConfig(vizConfig) {
259
201
  var enhancedConfig = Object.assign({}, vizConfig);
260
-
261
- if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
262
- enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
263
- }
264
-
265
202
  enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
266
203
  return Object.assign(Object.assign({}, config), {
267
204
  open: config.open || false
@@ -384,145 +321,15 @@ var insertLayout = function insertLayout(layout, index) {
384
321
  exports.insertLayout = insertLayout;
385
322
 
386
323
  /***/ }),
387
- /* 5 */,
388
- /* 6 */
389
- /***/ (function(module, exports) {
390
-
391
- module.exports = require("lodash");
392
-
393
- /***/ }),
394
- /* 7 */
395
- /***/ (function(module, exports) {
396
-
397
- module.exports = require("@babel/runtime/helpers/defineProperty");
398
-
399
- /***/ }),
400
- /* 8 */
401
- /***/ (function(module, exports, __webpack_require__) {
402
-
403
- "use strict";
404
-
405
-
406
- Object.defineProperty(exports, "__esModule", {
407
- value: true
408
- });
409
- exports.VizCategory = void 0;
410
- var VizCategory;
411
-
412
- (function (VizCategory) {
413
- VizCategory["SINGLE_VALUE"] = "Single Value";
414
- VizCategory["TRENDS"] = "Trends";
415
- VizCategory["COMPARISONS"] = "Comparisons";
416
- VizCategory["TABLE"] = "Table";
417
- VizCategory["GAUGE"] = "Gauge";
418
- VizCategory["DISTRIBUTIONS"] = "Distributions";
419
- VizCategory["CHOROPLETH"] = "Choropleth Maps";
420
- VizCategory["SHAPES"] = "Shapes";
421
- VizCategory["MISC"] = "misc";
422
- VizCategory["FLOW"] = "Flow";
423
- VizCategory["CORRELATION"] = "Correlation";
424
- VizCategory["SPATIAL"] = "Spatial";
425
- })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
426
-
427
- /***/ }),
428
- /* 9 */,
429
- /* 10 */,
430
- /* 11 */
431
- /***/ (function(module, exports) {
432
-
433
- module.exports = require("@splunk/visualization-icons/placeholders");
434
-
435
- /***/ }),
436
- /* 12 */
437
- /***/ (function(module, exports) {
438
-
439
- module.exports = require("@splunk/visualization-icons");
440
-
441
- /***/ }),
442
- /* 13 */
443
- /***/ (function(module, exports, __webpack_require__) {
444
-
445
- "use strict";
446
-
447
-
448
- Object.defineProperty(exports, "__esModule", {
449
- value: true
450
- });
451
-
452
- var i18n_1 = __webpack_require__(0);
453
-
454
- var background = function background(_ref) {
455
- var label = _ref.label,
456
- themes = _ref.themes,
457
- labelPosition = _ref.labelPosition;
458
- return [{
459
- label: (0, i18n_1._)(label || 'Background'),
460
- option: 'backgroundColor',
461
- editor: 'editor.color',
462
- editorProps: {
463
- labelPosition: labelPosition || 'top',
464
- themes: themes
465
- }
466
- }];
467
- };
468
-
469
- exports.default = background;
470
324
 
471
- /***/ }),
472
- /* 14 */
325
+ /***/ 5:
473
326
  /***/ (function(module, exports) {
474
327
 
475
- module.exports = require("@splunk/visualization-color-palettes");
328
+ module.exports = require("lodash");
476
329
 
477
330
  /***/ }),
478
- /* 15 */,
479
- /* 16 */,
480
- /* 17 */,
481
- /* 18 */,
482
- /* 19 */,
483
- /* 20 */,
484
- /* 21 */
485
- /***/ (function(module, exports) {
486
331
 
487
- module.exports = require("@splunk/themes");
488
-
489
- /***/ }),
490
- /* 22 */,
491
- /* 23 */,
492
- /* 24 */,
493
- /* 25 */,
494
- /* 26 */,
495
- /* 27 */,
496
- /* 28 */,
497
- /* 29 */,
498
- /* 30 */,
499
- /* 31 */,
500
- /* 32 */,
501
- /* 33 */,
502
- /* 34 */,
503
- /* 35 */,
504
- /* 36 */,
505
- /* 37 */,
506
- /* 38 */,
507
- /* 39 */,
508
- /* 40 */,
509
- /* 41 */,
510
- /* 42 */,
511
- /* 43 */,
512
- /* 44 */,
513
- /* 45 */,
514
- /* 46 */,
515
- /* 47 */,
516
- /* 48 */,
517
- /* 49 */,
518
- /* 50 */,
519
- /* 51 */,
520
- /* 52 */,
521
- /* 53 */,
522
- /* 54 */,
523
- /* 55 */,
524
- /* 56 */,
525
- /* 57 */
332
+ /***/ 54:
526
333
  /***/ (function(module, exports, __webpack_require__) {
527
334
 
528
335
  "use strict";
@@ -532,27 +339,23 @@ Object.defineProperty(exports, "__esModule", {
532
339
  value: true
533
340
  });
534
341
 
535
- var visualization_icons_1 = __webpack_require__(12);
342
+ var visualization_icons_1 = __webpack_require__(11);
536
343
 
537
- var placeholders_1 = __webpack_require__(11);
344
+ var placeholders_1 = __webpack_require__(10);
538
345
 
539
- var schemaUtils_1 = __webpack_require__(3);
346
+ var visualization_schemas_1 = __webpack_require__(2);
540
347
 
541
- var visualization_color_palettes_1 = __webpack_require__(14);
542
-
543
- var themes_1 = __webpack_require__(21);
348
+ var themes_1 = __webpack_require__(19);
544
349
 
545
350
  var i18n_1 = __webpack_require__(0);
546
351
 
547
- var VizBehavior_1 = __webpack_require__(2);
548
-
549
- var VizCategory_1 = __webpack_require__(8);
352
+ var VizBehavior_1 = __webpack_require__(6);
550
353
 
551
- var configUtils_1 = __webpack_require__(4);
354
+ var VizCategory_1 = __webpack_require__(7);
552
355
 
553
- var MapUtils_1 = __webpack_require__(58);
356
+ var configUtils_1 = __webpack_require__(3);
554
357
 
555
- var BackgroundColor_1 = __webpack_require__(13);
358
+ var BackgroundColor_1 = __webpack_require__(12);
556
359
 
557
360
  var defaultContext = {
558
361
  colorRangeConfig: [{
@@ -592,277 +395,6 @@ var size = {
592
395
  initialWidth: 800,
593
396
  initialHeight: 600
594
397
  };
595
- var optionsSchema = {
596
- backgroundColor: {
597
- default: '> themes.defaultBackgroundColor',
598
- description: 'Specify a color for the background. You might 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".',
599
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA,
600
- type: 'string'
601
- },
602
- baseLayerTileServer: {
603
- type: 'string',
604
- description: 'Specify the URL for the set of tiles that make up the base map.'
605
- },
606
- baseLayerTileServerType: {
607
- type: 'string',
608
- description: 'Specify the type of tile set for the base map.',
609
- pattern: (0, schemaUtils_1.getPattern)(['vector', 'raster'])
610
- },
611
- center: {
612
- type: 'array',
613
- description: 'Specify the center of the map in coordinates, in the form of [latitude, longitude]. If you don’t provide coordinates, the map automatically centers, based on available location data. If there is no available location data, the center of the map defaults to [37.7749, -122.4194].',
614
- items: {
615
- type: 'number'
616
- }
617
- },
618
- layers: {
619
- // The option merging of defaults and data binding with editing UI happens with the default defined below.
620
- // The inner defaults for properties within anyOf objects is used only for code intellisense in UDF to populate options.
621
- default: [{
622
- type: MapUtils_1.LAYER_TYPE.Bubble,
623
- latitude: '> primary | seriesByName("latitude")',
624
- longitude: '> primary | seriesByName("longitude")',
625
- seriesColors: visualization_color_palettes_1.VIZ_CATEGORICAL,
626
- bubbleSize: '> primary | frameWithoutSeriesNames("geobin", "latitude", "longitude") | frameBySeriesTypes("number")',
627
- additionalTooltipFields: [],
628
- resultLimit: 1000
629
- }, {
630
- type: MapUtils_1.LAYER_TYPE.Marker,
631
- latitude: '> primary | seriesByName("latitude")',
632
- longitude: '> primary | seriesByName("longitude")',
633
- seriesColors: visualization_color_palettes_1.VIZ_CATEGORICAL,
634
- additionalTooltipFields: [],
635
- resultLimit: 1000
636
- }, {
637
- type: MapUtils_1.LAYER_TYPE.Choropleth,
638
- areaIds: '> primary | seriesByType("string")',
639
- areaValues: '> primary | seriesByType("number")',
640
- dataColors: '> areaValues | gradient()',
641
- additionalTooltipFields: [],
642
- resultLimit: 1000,
643
- choroplethEmptyAreaColor: '> themes.defaultChoroplethEmptyAreaColor',
644
- choroplethStrokeColor: 'transparent',
645
- choroplethOpacity: 0.8
646
- }],
647
- type: 'array',
648
- description: 'Specify the optional data visualization layers over the base map. If empty, only the base map appears.',
649
- items: {
650
- anyOf: [{
651
- type: 'object',
652
- properties: {
653
- type: {
654
- description: 'Specify the type of data layer method to display points on the map. For example, “bubble”, “marker”, or "choropleth".',
655
- type: 'string',
656
- pattern: (0, schemaUtils_1.getPattern)([MapUtils_1.LAYER_TYPE.Marker, MapUtils_1.LAYER_TYPE.Bubble, MapUtils_1.LAYER_TYPE.Choropleth]),
657
- default: MapUtils_1.LAYER_TYPE.Marker
658
- },
659
- latitude: {
660
- description: 'Specify a dataSource series to apply latitude coordinates for data points displayed on the map. This applies to layers where type: "bubble" or type: "marker".',
661
- type: ['string', 'array'],
662
- items: {
663
- type: 'number'
664
- },
665
- default: '> primary | seriesByName("latitude")'
666
- },
667
- longitude: {
668
- description: 'Specify a dataSource series to apply longitude coordinates for data points displayed on the map. This applies to layers where type: "bubble" or type: "marker".',
669
- type: ['string', 'array'],
670
- items: {
671
- type: 'number'
672
- },
673
- default: '> primary | seriesByName("longitude")'
674
- },
675
- seriesColors: {
676
- description: 'Specify the colors to use for data points. If the dataColors option is specified, the seriesColors option is ignored. The seriesColors option applies to layers where type: "bubble" or type: "marker".',
677
- type: 'array',
678
- items: {
679
- type: 'string',
680
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA
681
- },
682
- default: visualization_color_palettes_1.VIZ_CATEGORICAL
683
- },
684
- dataColors: {
685
- description: 'Specify the colors to use for data points. You can use an array of colors to be picked from, or you can use a dataSource to apply dynamic coloring. For example, “> primary | seriesByName("status") | matchValue(colorMatchConfig)”. When type: "choropleth", dataColors is defined by default, and the opacities are shown at 80% of maximum to allow textual information to be visible in the map. By default, the dataColors option is not defined for type "bubble" or "marker". If type: "bubble", dataColors requires bubbleSize to have only a single series configured.',
686
- type: ['string', 'array'],
687
- items: {
688
- type: 'string'
689
- }
690
- },
691
- additionalTooltipFields: {
692
- description: 'Specify the fields to add to the default set of tooltips. Tooltips appear when you hover over data points. These fields and their corresponding values are shown in addition to the ones displayed by default.',
693
- type: 'array',
694
- items: {
695
- type: 'string'
696
- },
697
- default: []
698
- },
699
- resultLimit: {
700
- description: 'Specify the maximum number of data points to render on the map. Adjust the value to improve performance.',
701
- type: 'number',
702
- default: 1000
703
- }
704
- }
705
- }, {
706
- type: 'object',
707
- properties: {
708
- type: {
709
- description: 'Specify the type of data layer method to display points on the map. For example, “bubble”, “marker”, or "choropleth".',
710
- type: 'string',
711
- pattern: (0, schemaUtils_1.getPattern)([MapUtils_1.LAYER_TYPE.Marker, MapUtils_1.LAYER_TYPE.Bubble, MapUtils_1.LAYER_TYPE.Choropleth]),
712
- default: MapUtils_1.LAYER_TYPE.Choropleth
713
- },
714
- areaIds: {
715
- description: 'Specify a dataSource series to identify each area in the choropleth map layer. This applies to layers where type: "choropleth".',
716
- type: 'array',
717
- items: {
718
- type: 'string'
719
- },
720
- default: '> primary | seriesByType("string")'
721
- },
722
- areaValues: {
723
- description: 'Specify a dataSource series that indicates the values for the choropleth map areas. This applies to layers where type: "choropleth".',
724
- type: 'array',
725
- items: {
726
- type: 'number'
727
- },
728
- default: '> primary | seriesByType("number")'
729
- },
730
- dataColors: {
731
- description: 'Specify the colors to use for data points. You can use an array of colors to be picked from, or you can use a dataSource to apply dynamic coloring. For example, “> primary | seriesByName("status") | matchValue(colorMatchConfig)”. When type: "choropleth", dataColors is defined by default. By default, the dataColors option is not defined for type "bubble" or "marker".',
732
- type: ['string', 'array'],
733
- items: {
734
- type: 'string'
735
- },
736
- default: '> areaValues | gradient()'
737
- },
738
- additionalTooltipFields: {
739
- description: 'Specify the fields to add to the default set of tooltips. Tooltips appear when you hover over data points. These fields and their corresponding values are shown in addition to the ones displayed by default.',
740
- type: 'array',
741
- items: {
742
- type: 'string'
743
- },
744
- default: []
745
- },
746
- resultLimit: {
747
- description: 'Specify the maximum number of data points to render on the map. Adjust the value to improve performance.',
748
- type: 'number',
749
- default: 1000
750
- },
751
- source: {
752
- description: 'Source for the geodata for choropleth layer: "us" or "world", and will override data specified in the SPL geom command.',
753
- pattern: (0, schemaUtils_1.getPattern)(['geo://default/us', 'geo://default/world']),
754
- type: 'string'
755
- },
756
- choroplethEmptyAreaColor: {
757
- description: 'Specify the color used for empty choropleth areas when "type": "choropleth", and will only work when "source" option is correctly configured.',
758
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA,
759
- type: 'string',
760
- default: '> themes.defaultChoroplethEmptyAreaColor'
761
- },
762
- choroplethStrokeColor: {
763
- description: 'Specify the stroke color for choropleth area outlines. The hex value format should be "#FFFFFF".',
764
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA,
765
- type: 'string',
766
- default: 'transparent'
767
- },
768
- choroplethOpacity: {
769
- description: 'Specify the opacity of choropleth areas. Choose a number in the range of 0 - 1 (inclusive). You can also express the value as a percentage. For example, "0.8" in code or "80%" in UI.',
770
- type: 'number',
771
- default: 0.8
772
- }
773
- }
774
- }, {
775
- type: 'object',
776
- properties: {
777
- type: {
778
- description: 'Specify the type of data layer method to display points on the map. For example, “bubble”, “marker”, or "choropleth".',
779
- type: 'string',
780
- pattern: (0, schemaUtils_1.getPattern)([MapUtils_1.LAYER_TYPE.Marker, MapUtils_1.LAYER_TYPE.Bubble, MapUtils_1.LAYER_TYPE.Choropleth]),
781
- default: MapUtils_1.LAYER_TYPE.Bubble
782
- },
783
- bubbleSize: {
784
- description: 'Specify the data column to encode bubble size. This applies to layers where type: "bubble".',
785
- type: ['string', 'array'],
786
- items: {
787
- type: 'number'
788
- },
789
- default: '> primary | frameWithoutSeriesNames("geobin", "latitude", "longitude") | frameBySeriesTypes("number")'
790
- },
791
- latitude: {
792
- description: 'Specify a dataSource series to apply latitude coordinates for data points displayed on the map. This applies to layers where type: "bubble" or type: "marker".',
793
- type: ['string', 'array'],
794
- items: {
795
- type: 'number'
796
- },
797
- default: '> primary | seriesByName("latitude")'
798
- },
799
- longitude: {
800
- description: 'Specify a dataSource series to apply longitude coordinates for data points displayed on the map. This applies to layers where type: "bubble" or type: "marker".',
801
- type: ['string', 'array'],
802
- items: {
803
- type: 'number'
804
- },
805
- default: '> primary | seriesByName("longitude")'
806
- },
807
- seriesColors: {
808
- description: 'Specify the colors to use for data points. If the dataColors option is specified, the seriesColors option is ignored. The seriesColors option applies to layers where type: "bubble" or type: "marker".',
809
- type: 'array',
810
- items: {
811
- type: 'string',
812
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA
813
- },
814
- default: visualization_color_palettes_1.VIZ_CATEGORICAL
815
- },
816
- dataColors: {
817
- description: 'Specify the colors to use for data points. You can use an array of colors to be picked from, or you can use a dataSource to apply dynamic coloring. For example, “> primary | seriesByName("status") | matchValue(colorMatchConfig)”. When type: "choropleth", dataColors is defined by default, and the opacities are shown at 80% of maximum to allow textual information to be visible in the map. By default, the dataColors option is not defined for type "bubble" or "marker". If type: "bubble", dataColors requires bubbleSize to have only a single series configured.',
818
- type: ['string', 'array'],
819
- items: {
820
- type: 'string'
821
- }
822
- },
823
- additionalTooltipFields: {
824
- description: 'Specify the fields to add to the default set of tooltips. Tooltips appear when you hover over data points. These fields and their corresponding values are shown in addition to the ones displayed by default.',
825
- type: 'array',
826
- items: {
827
- type: 'string'
828
- },
829
- default: []
830
- },
831
- resultLimit: {
832
- description: 'Specify the maximum number of data points to render on the map. Adjust the value to improve performance.',
833
- type: 'number',
834
- default: 1000
835
- }
836
- }
837
- }]
838
- }
839
- },
840
- scaleUnit: {
841
- default: 'metric',
842
- type: 'string',
843
- description: 'Specify the scale unit to use.',
844
- pattern: (0, schemaUtils_1.getPattern)(['metric', 'imperial'])
845
- },
846
- showBaseLayer: {
847
- default: true,
848
- type: 'boolean',
849
- description: 'Specify if showing the base map.'
850
- },
851
- showScale: {
852
- default: true,
853
- type: 'boolean',
854
- description: 'Specify whether to display the scale on the bottom left.'
855
- },
856
- showZoomControls: {
857
- default: true,
858
- type: 'boolean',
859
- description: 'Specify whether to display the control panel of zoom on the top left.'
860
- },
861
- zoom: {
862
- description: 'Specify the zoom level of the map.',
863
- type: 'number'
864
- }
865
- };
866
398
  var themes = {
867
399
  defaultBackgroundColor: function defaultBackgroundColor(props) {
868
400
  return (0, themes_1.pick)({
@@ -915,11 +447,11 @@ var themes = {
915
447
  };
916
448
 
917
449
  var checkTypeIsChoropleth = function checkTypeIsChoropleth(options) {
918
- return options.layers && options.layers.length && options.layers[0].type === MapUtils_1.LAYER_TYPE.Choropleth;
450
+ return options.layers && options.layers.length && options.layers[0].type === visualization_schemas_1.LAYER_TYPE.Choropleth;
919
451
  };
920
452
 
921
453
  var checkTypeIsLocalChoropleth = function checkTypeIsLocalChoropleth(options) {
922
- return options.layers && options.layers.length && options.layers[0].type === MapUtils_1.LAYER_TYPE.Choropleth && (options.layers[0].source === 'geo://default/us' || options.layers[0].source === 'geo://default/world');
454
+ return options.layers && options.layers.length && options.layers[0].type === visualization_schemas_1.LAYER_TYPE.Choropleth && (options.layers[0].source === 'geo://default/us' || options.layers[0].source === 'geo://default/world');
923
455
  };
924
456
 
925
457
  var EDITOR_LABEL_WIDTH = 140;
@@ -932,13 +464,13 @@ var editorConfig = [{
932
464
  editorProps: {
933
465
  values: [{
934
466
  label: (0, i18n_1._)('Bubble'),
935
- value: MapUtils_1.LAYER_TYPE.Bubble
467
+ value: visualization_schemas_1.LAYER_TYPE.Bubble
936
468
  }, {
937
469
  label: (0, i18n_1._)('Marker'),
938
- value: MapUtils_1.LAYER_TYPE.Marker
470
+ value: visualization_schemas_1.LAYER_TYPE.Marker
939
471
  }, {
940
472
  label: (0, i18n_1._)('Choropleth'),
941
- value: MapUtils_1.LAYER_TYPE.Choropleth
473
+ value: visualization_schemas_1.LAYER_TYPE.Choropleth
942
474
  }]
943
475
  }
944
476
  }], [{
@@ -1223,7 +755,7 @@ var config = {
1223
755
  dataContract: dataContract,
1224
756
  size: size,
1225
757
  defaultContext: defaultContext,
1226
- optionsSchema: optionsSchema,
758
+ optionsSchema: visualization_schemas_1.mapOptionsSchema,
1227
759
  editorConfig: editorConfig,
1228
760
  events: {
1229
761
  'map.load': {
@@ -1241,602 +773,75 @@ var config = {
1241
773
  exports.default = (0, configUtils_1.enhanceConfig)(config);
1242
774
 
1243
775
  /***/ }),
1244
- /* 58 */
776
+
777
+ /***/ 6:
1245
778
  /***/ (function(module, exports, __webpack_require__) {
1246
779
 
1247
780
  "use strict";
1248
781
 
1249
782
 
1250
- var _defineProperty = __webpack_require__(7);
1251
-
1252
- var _slicedToArray = __webpack_require__(59);
1253
-
1254
- var _toConsumableArray = __webpack_require__(1);
1255
-
1256
783
  Object.defineProperty(exports, "__esModule", {
1257
784
  value: true
1258
785
  });
1259
- exports.formatMetadata = exports.compareBaseStyles = exports.getScaledOpacities = exports.getGlobalLayerBoundaries = exports.isValidLatLon = exports.bakeBubbleData = exports.sanitizeValues = exports.transposeArray = exports.matchBubbleSize = exports.getStaticColors = exports.getZoomLevelFromGeobin = exports.getZoomConstraintsFromTileConfig = exports.getMapStyle = exports.getTilePreset = exports.LAYER_TYPE = exports.DEFAULT_OPACITY = 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 = exports.MIN_LONGITUDE = exports.MAX_LONGITUDE = exports.MIN_LATITUDE = exports.MAX_LATITUDE = void 0;
1260
-
1261
- var lodash_1 = __webpack_require__(6);
1262
-
1263
- var d3_scale_1 = __webpack_require__(60);
1264
-
1265
- var chroma = __webpack_require__(61);
1266
-
1267
- var colorUtils_1 = __webpack_require__(62);
1268
-
1269
- var visualization_color_palettes_1 = __webpack_require__(14);
1270
-
1271
- var types_1 = __webpack_require__(63);
1272
-
1273
- exports.MAX_LATITUDE = 90;
1274
- exports.MIN_LATITUDE = -90;
1275
- exports.MAX_LONGITUDE = 180;
1276
- exports.MIN_LONGITUDE = -180;
1277
- exports.DEFAULT_RESULT_LIMIT = 1000;
1278
- exports.DEFAULT_CLUSTER_COLOR = '#909090';
1279
- exports.DEFAULT_SERIES_COLORS = visualization_color_palettes_1.VIZ_CATEGORICAL; // MapLibre requires a map style specification number which is always 8
1280
-
1281
- exports.MAP_STYLE_VERSION_NUMBER = 8; // currently using one [min, max] value set for bubbles across all zoom levels
1282
- // TODO: design choices on [min, max] bubble size for different zoom levels
1283
-
1284
- exports.MIN_BUBBLE_RADIUS = 7.11; // 10px
1285
-
1286
- exports.MAX_BUBBLE_RADIUS = 45.26; // 85px
1287
-
1288
- exports.DEFAULT_OPACITY = 0.8;
1289
- var LONGITUDE = 'longitude';
1290
- var LATITUDE = 'latitude';
1291
- var LAYER_TYPE;
1292
-
1293
- (function (LAYER_TYPE) {
1294
- LAYER_TYPE["Marker"] = "marker";
1295
- LAYER_TYPE["Bubble"] = "bubble";
1296
- LAYER_TYPE["Choropleth"] = "choropleth";
1297
- })(LAYER_TYPE = exports.LAYER_TYPE || (exports.LAYER_TYPE = {}));
1298
- /**
1299
- * Construct a tile preset {key: config} by combining the default + custom tile configs
1300
- * Also returns the default tile config for each theme - light/dark
1301
- * @param {MapContextInterface} args
1302
- * @param {BaseTileConfig[]} args.defaultTileConfig
1303
- * @param {BaseTileConfig[]} args.customTileConfig
1304
- * @returns {Object} tile preset
1305
- */
1306
-
1307
-
1308
- var getTilePreset = function getTilePreset(_ref) {
1309
- var _ref$defaultTileConfi = _ref.defaultTileConfig,
1310
- defaultTileConfig = _ref$defaultTileConfi === void 0 ? [] : _ref$defaultTileConfi,
1311
- _ref$customTileConfig = _ref.customTileConfig,
1312
- customTileConfig = _ref$customTileConfig === void 0 ? [] : _ref$customTileConfig;
1313
-
1314
- var _a, _b;
1315
-
1316
- var tilePreset = {};
1317
- var defaultTileLight = {};
1318
- var defaultTileDark = {};
1319
- var tileConfigs = [].concat(defaultTileConfig).concat(customTileConfig);
1320
- (0, lodash_1.forEach)(tileConfigs, function (tileConfig) {
1321
- var key = tileConfig === null || tileConfig === void 0 ? void 0 : tileConfig.key;
1322
- var updatedConfig = Object.assign(Object.assign({
1323
- theme: 'all'
1324
- }, tileConfig), {
1325
- version: exports.MAP_STYLE_VERSION_NUMBER
1326
- });
1327
- tilePreset[key] = updatedConfig;
1328
- });
1329
-
1330
- if (defaultTileConfig.length > 0) {
1331
- defaultTileLight = (_a = defaultTileConfig.find(function (config) {
1332
- return config.theme === 'light';
1333
- })) !== null && _a !== void 0 ? _a : defaultTileConfig.find(function (config) {
1334
- return config.theme === undefined;
1335
- });
1336
- defaultTileDark = (_b = defaultTileConfig.find(function (config) {
1337
- return config.theme === 'dark';
1338
- })) !== null && _b !== void 0 ? _b : defaultTileConfig.find(function (config) {
1339
- return config.theme === undefined;
1340
- });
1341
- }
1342
-
1343
- return {
1344
- tilePreset: tilePreset,
1345
- defaultTileLight: defaultTileLight,
1346
- defaultTileDark: defaultTileDark
1347
- };
1348
- };
1349
-
1350
- exports.getTilePreset = getTilePreset;
1351
- /**
1352
- * Check if baseLayerTileServer is in tilePreset and config matches current theme, if yes, return.
1353
- * If no, construct a mapStyle with baseLayerTilerServer and baseLayerTileServerType
1354
- * Else return default tile config based on current theme
1355
- * @param {Object} args
1356
- * @param {BaseTileConfig[]} args.tilePreset
1357
- * @param {String} args.baseLayerTilerServer
1358
- * @param {String} args.baseLayerTileServerType
1359
- * @param {String} args.colorScheme
1360
- * @param {BaseTileConfig} args.defaultTileDark
1361
- * @param {BaseTileConfig} args.defaultTileLight
1362
- * @returns {BaseTileConfig} mapStyle
1363
- */
1364
-
1365
- var getMapStyle = function getMapStyle(_ref2) {
1366
- var showBaseLayer = _ref2.showBaseLayer,
1367
- _ref2$baseLayerTileSe = _ref2.baseLayerTileServer,
1368
- baseLayerTileServer = _ref2$baseLayerTileSe === void 0 ? '' : _ref2$baseLayerTileSe,
1369
- _ref2$baseLayerTileSe2 = _ref2.baseLayerTileServerType,
1370
- baseLayerTileServerType = _ref2$baseLayerTileSe2 === void 0 ? '' : _ref2$baseLayerTileSe2,
1371
- _ref2$tilePreset = _ref2.tilePreset,
1372
- tilePreset = _ref2$tilePreset === void 0 ? {} : _ref2$tilePreset,
1373
- _ref2$colorScheme = _ref2.colorScheme,
1374
- colorScheme = _ref2$colorScheme === void 0 ? 'light' : _ref2$colorScheme,
1375
- _ref2$defaultTileLigh = _ref2.defaultTileLight,
1376
- defaultTileLight = _ref2$defaultTileLigh === void 0 ? {} : _ref2$defaultTileLigh,
1377
- _ref2$defaultTileDark = _ref2.defaultTileDark,
1378
- defaultTileDark = _ref2$defaultTileDark === void 0 ? {} : _ref2$defaultTileDark;
1379
-
1380
- if (!showBaseLayer) {
1381
- return {
1382
- version: exports.MAP_STYLE_VERSION_NUMBER,
1383
- sources: {
1384
- 'base-tiles': {
1385
- type: 'raster',
1386
- tiles: ['data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='],
1387
- tileSize: 256
1388
- }
1389
- },
1390
- layers: [{
1391
- id: 'base-layer',
1392
- type: 'raster',
1393
- source: 'base-tiles',
1394
- minzoom: 0,
1395
- maxzoom: 22
1396
- }]
1397
- };
1398
- }
1399
-
1400
- if (baseLayerTileServer && tilePreset[baseLayerTileServer] && (tilePreset[baseLayerTileServer].theme === colorScheme || tilePreset[baseLayerTileServer].theme === 'all')) {
1401
- return tilePreset[baseLayerTileServer];
1402
- }
1403
-
1404
- if (baseLayerTileServer && baseLayerTileServerType) {
1405
- var tiles = [];
1406
- /**
1407
- * Tile Server URLs (eg: http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png) can specify the variable {s} which refers to a subdomain
1408
- * Subdomains are used to help with browser parallel requests per domain limitation. These subdomains are typically single letters 'a', 'b' and 'c'
1409
- * Refer to https://leafletjs.com/SlavaUkraini/reference.html#tilelayer and https://wiki.openstreetmap.org/wiki/Tile_servers
1410
- */
1411
-
1412
- if (baseLayerTileServer.match(/^(https?):\/\/{(s|S)}\../)) {
1413
- /**
1414
- * sXML (Leaflet) allows users to define their own tile server URLs + list of available subdomains
1415
- * In order to preserve this behavior during conversion to splunk.map,
1416
- * if the variable {s} or {S} is detected, replace it with 'a', 'b' and 'c' - default values for subdomains
1417
- * TODO: in the future, add an additional prop - baseLayerTileServerSubdomains: ['x', 'y', 'z'], default being ['a', 'b', 'c']
1418
- */
1419
- tiles = [baseLayerTileServer.replace(/{(s|S)}/, 'a'), baseLayerTileServer.replace(/{(s|S)}/, 'b'), baseLayerTileServer.replace(/{(s|S)}/, 'c')];
1420
- } else {
1421
- tiles = [baseLayerTileServer];
1422
- } // TODO: remove hardcoded style when we allow users to pass in layer style through Viz options
1423
-
1424
-
1425
- var mapStyle = {
1426
- version: exports.MAP_STYLE_VERSION_NUMBER,
1427
- sources: {
1428
- 'base-tiles': {
1429
- type: baseLayerTileServerType,
1430
- tiles: tiles,
1431
- tileSize: 256
1432
- }
1433
- },
1434
- layers: [{
1435
- id: 'base-layer',
1436
- type: 'raster',
1437
- source: 'base-tiles',
1438
- minzoom: 0,
1439
- maxzoom: 24 // https://maplibre.org/maplibre-gl-js-docs/api/map/
1440
-
1441
- }]
1442
- };
1443
- return mapStyle;
1444
- } // if tile server is not present in the preset AND we can't construct a mapStyle, fall back on defaults
1445
-
1446
-
1447
- return colorScheme === 'light' ? defaultTileLight : defaultTileDark;
1448
- };
1449
-
1450
- exports.getMapStyle = getMapStyle;
1451
-
1452
- var getZoomConstraintsFromTileConfig = function getZoomConstraintsFromTileConfig(tileConfig, baseLayerTileServer) {
1453
- var sources = tileConfig.sources,
1454
- layers = tileConfig.layers;
1455
- var matchedBaseLayerTileServer = false; // check sources for minzoom maxzoom first
1456
-
1457
- var sourceKeys = Object.keys(sources);
1458
-
1459
- for (var i = 0; i < sourceKeys.length; i += 1) {
1460
- var _sources$sourceKeys$i = sources[sourceKeys[i]],
1461
- minzoom = _sources$sourceKeys$i.minzoom,
1462
- maxzoom = _sources$sourceKeys$i.maxzoom;
1463
-
1464
- if (baseLayerTileServer && sources[sourceKeys[i]].tiles.indexOf(baseLayerTileServer) !== -1) {
1465
- matchedBaseLayerTileServer = true;
1466
- }
1467
-
1468
- if ((baseLayerTileServer && matchedBaseLayerTileServer || !baseLayerTileServer) && (0, lodash_1.isNumber)(minzoom) && (0, lodash_1.isNumber)(maxzoom)) {
1469
- return {
1470
- minZoom: minzoom,
1471
- maxZoom: maxzoom
1472
- };
1473
- }
1474
- } // then check layers
1475
-
1476
-
1477
- for (var _i = 0; _i < layers.length; _i += 1) {
1478
- var _layers$_i = layers[_i],
1479
- _minzoom = _layers$_i.minzoom,
1480
- _maxzoom = _layers$_i.maxzoom;
1481
-
1482
- if ((baseLayerTileServer && matchedBaseLayerTileServer || !baseLayerTileServer) && (0, lodash_1.isNumber)(_minzoom) && (0, lodash_1.isNumber)(_maxzoom)) {
1483
- return {
1484
- minZoom: _minzoom,
1485
- maxZoom: _maxzoom
1486
- };
1487
- }
1488
- } // Maplibre default - would reset previous min/maxZoom https://maplibre.org/maplibre-gl-js-docs/api/map/
1489
-
1490
-
1491
- return {
1492
- minZoom: 0,
1493
- maxZoom: 24
1494
- };
1495
- };
1496
-
1497
- exports.getZoomConstraintsFromTileConfig = getZoomConstraintsFromTileConfig;
1498
-
1499
- var getZoomLevelFromGeobin = function getZoomLevelFromGeobin(geobinStr) {
1500
- var _a;
1501
-
1502
- if (!geobinStr) {
1503
- return null;
1504
- } // geostats cmds return geobin with zoom level 0-18, 0-99 in the geobinPattern covers the range
1505
-
1506
-
1507
- var geobinPattern = /bin_id_zl_([0-9]{0,2})?_y_/g;
1508
- var match = geobinPattern.exec(geobinStr);
1509
- return (_a = (match === null || match === void 0 ? void 0 : match.length) && parseInt(match[1], 10)) !== null && _a !== void 0 ? _a : null;
1510
- };
1511
-
1512
- exports.getZoomLevelFromGeobin = getZoomLevelFromGeobin; // Bubble colors - static
1513
-
1514
- var getStaticColors = function getStaticColors(colorCount, colorArray) {
1515
- if (colorCount < 0 || !colorCount) {
1516
- return [exports.DEFAULT_CLUSTER_COLOR];
1517
- }
1518
-
1519
- if (!colorArray || !colorArray.length) {
1520
- return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
1521
- return exports.DEFAULT_SERIES_COLORS[i];
1522
- });
1523
- } // loop through colorArray to pick the first $colorCount colors
1524
- // start from begining again if colorCount > colorArray.length
1525
-
1526
-
1527
- return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
1528
- return (0, colorUtils_1.isColor)(colorArray[i % colorArray.length]) ? colorArray[i % colorArray.length] : exports.DEFAULT_CLUSTER_COLOR;
1529
- });
1530
- };
1531
-
1532
- exports.getStaticColors = getStaticColors; // Bubble size
1533
-
1534
- var matchBubbleSize = function matchBubbleSize(dataRange, data) {
1535
- var size = (0, d3_scale_1.scalePow)().exponent(0.2).domain(dataRange).range([exports.MIN_BUBBLE_RADIUS, exports.MAX_BUBBLE_RADIUS])(data);
1536
-
1537
- if (size > exports.MAX_BUBBLE_RADIUS) {
1538
- return exports.MAX_BUBBLE_RADIUS;
1539
- }
1540
-
1541
- if (size < exports.MIN_BUBBLE_RADIUS) {
1542
- return exports.MIN_BUBBLE_RADIUS;
1543
- }
1544
-
1545
- return size;
1546
- };
1547
-
1548
- exports.matchBubbleSize = matchBubbleSize;
1549
-
1550
- var transposeArray = function transposeArray(array) {
1551
- if (!array || !array.length || !array[0] || !array[0].length) {
1552
- return [];
1553
- }
1554
-
1555
- return array[0].map(function (_, i) {
1556
- return array.map(function (row) {
1557
- return row[i];
1558
- });
1559
- });
1560
- };
1561
-
1562
- exports.transposeArray = transposeArray; // sanitize values: update all null, undefined, or negative values to 0
1563
-
1564
- var sanitizeValues = function sanitizeValues(values) {
1565
- // null / undefined
1566
- if (!values) {
1567
- return 0;
1568
- } // number
1569
-
1570
-
1571
- if (!Array.isArray(values)) {
1572
- return values > 0 ? values : 0;
1573
- } // array
1574
-
1575
-
1576
- return values.map(function (arr) {
1577
- return (0, exports.sanitizeValues)(arr);
1578
- });
1579
- };
1580
-
1581
- exports.sanitizeValues = sanitizeValues;
1582
-
1583
- var bakeBubbleData = function bakeBubbleData(layer) {
1584
- var _a;
1585
-
1586
- 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) {
1587
- return null;
1588
- } // if bubbleSize is passed as an array of single number array (data series)
1589
- // e.g. [value0, value1, ...]
1590
- // format each value as an array to unify data operations for data series and frames
1591
-
1592
-
1593
- var sanitizedBubbleSize = (0, exports.sanitizeValues)(layer.bubbleSize);
1594
- var transposedBubbleSize;
1595
- var transposedSanitizedBubbleSize;
1596
- var isPie = false; // format array if bubbleSize is passed as an array of array (data frame)
1597
-
1598
- if (Array.isArray(layer.bubbleSize[0])) {
1599
- // one-time array transpose,
1600
- // e.g. from [column0data, column0data] (multi series)
1601
- // to [[column0datum0, column1datum0], [column0datum1, column1data1], ...]
1602
- // or e.g. from [column0data] (single series)
1603
- // to [[column0data]]
1604
- // for easy access of values at each geo location,
1605
- // and min max pie size computation
1606
- transposedBubbleSize = (0, exports.transposeArray)(layer.bubbleSize);
1607
- transposedSanitizedBubbleSize = (0, exports.transposeArray)(sanitizedBubbleSize); // if multiple series in the dataframe, set isPie to true
1608
-
1609
- if (layer.bubbleSize.length > 1) {
1610
- isPie = true;
1611
- }
1612
- } else {
1613
- transposedBubbleSize = layer.bubbleSize.map(function (n) {
1614
- return [n];
1615
- });
1616
- transposedSanitizedBubbleSize = sanitizedBubbleSize.map(function (n) {
1617
- return [n];
1618
- });
1619
- }
1620
-
1621
- if (!transposedBubbleSize || !transposedBubbleSize.length) {
1622
- return null;
1623
- }
1624
-
1625
- var data = layer.latitude.map(function (lat, i) {
1626
- return {
1627
- zoom: (0, exports.getZoomLevelFromGeobin)(layer.geobin[i]),
1628
- values: transposedBubbleSize[i],
1629
- sanitizedValues: transposedSanitizedBubbleSize[i],
1630
- coordinates: [layer.longitude[i], lat],
1631
- metadata: layer.metadata ? layer.metadata[i] : {}
1632
- };
1633
- }).filter(function (d) {
1634
- return Boolean(d.values);
1635
- }); // compute the min/max value to encode min/max pie or bubble size
1636
-
1637
- var min = (0, lodash_1.sum)(transposedSanitizedBubbleSize[0]);
1638
- var max = (0, lodash_1.sum)(transposedSanitizedBubbleSize[1]);
1639
- transposedSanitizedBubbleSize.forEach(function (row) {
1640
- var bubbleSize = (0, lodash_1.sum)(row);
1641
- max = bubbleSize > max ? bubbleSize : max;
1642
- min = bubbleSize < min ? bubbleSize : min;
1643
- });
1644
- return {
1645
- data: data,
1646
- dataRange: [min, max],
1647
- isPie: isPie,
1648
- resultLimit: layer.resultLimit,
1649
- bubbleSizeFields: layer.bubbleSizeFields
1650
- };
1651
- };
1652
-
1653
- exports.bakeBubbleData = bakeBubbleData;
1654
-
1655
- var isValidLatLon = function isValidLatLon(latlon) {
1656
- if (!latlon || !Array.isArray(latlon) || latlon.length !== 2) {
1657
- return false;
1658
- }
1659
-
1660
- var _latlon = _slicedToArray(latlon, 2),
1661
- lat = _latlon[0],
1662
- lon = _latlon[1];
1663
-
1664
- if (!(0, types_1.isNumber)(lat) || !(lat >= exports.MIN_LATITUDE && lat <= exports.MAX_LATITUDE)) {
1665
- return false;
1666
- }
1667
-
1668
- if (!(0, types_1.isNumber)(lon) || !(lon >= exports.MIN_LONGITUDE && lon <= exports.MAX_LONGITUDE)) {
1669
- return false;
1670
- }
1671
-
1672
- return true;
1673
- };
1674
-
1675
- exports.isValidLatLon = isValidLatLon;
1676
- /**
1677
- * Returns a list of all lat or lon coordinates used in a specified layer
1678
- * @param {LayerType[]} layer
1679
- * @param {string} field
1680
- * @returns {number[]} list of lat coordinates or lon coordinates
1681
- */
1682
-
1683
- var getLatOrLonCoordinates = function getLatOrLonCoordinates(layer, field) {
1684
- var getClusterValues = function getClusterValues(clusterLayer) {
1685
- return (0, lodash_1.get)(clusterLayer, field, []).slice(0, clusterLayer.type === LAYER_TYPE.Marker && clusterLayer.resultLimit ? clusterLayer.resultLimit : exports.DEFAULT_RESULT_LIMIT);
1686
- };
1687
-
1688
- var getChoroplethValues = function getChoroplethValues(choroplethLayer) {
1689
- var slicedGeomList = choroplethLayer.geom.slice(0, choroplethLayer.resultLimit);
1690
- var flatCoordinates = slicedGeomList.flatMap(function (geomObject) {
1691
- return geomObject.coordinates.flat(2);
1692
- });
1693
- return flatCoordinates.map(function (coord) {
1694
- return coord[field === LONGITUDE ? 0 : 1];
1695
- });
1696
- };
1697
-
1698
- return layer.type === LAYER_TYPE.Choropleth ? getChoroplethValues(layer) : getClusterValues(layer);
1699
- };
1700
- /**
1701
- * Returns the min and max LongLat pairs to determine the layer boundaries to fit all markers/bubbles
1702
- * @param {LayerType[]} layers
1703
- * @returns {LngLatBoundsLike}
1704
- */
1705
-
1706
-
1707
- var getGlobalLayerBoundaries = function getGlobalLayerBoundaries(layers) {
1708
- var isLayerValid = function isLayerValid(field) {
1709
- return layers.every(function (layer) {
1710
- return layer[field] || layer.geom;
1711
- });
1712
- };
1713
-
1714
- var getDefaultMax = function getDefaultMax(field) {
1715
- return field === LONGITUDE ? exports.MAX_LONGITUDE : exports.MAX_LATITUDE;
1716
- };
1717
-
1718
- var getDefaultMin = function getDefaultMin(field) {
1719
- return field === LONGITUDE ? exports.MIN_LONGITUDE : exports.MIN_LATITUDE;
1720
- };
1721
-
1722
- if (!layers || !Array.isArray(layers) || !layers.length) {
1723
- return null;
1724
- }
1725
-
1726
- var getMin = function getMin(field) {
1727
- if (!isLayerValid(field)) {
1728
- return getDefaultMin(field);
1729
- }
1730
-
1731
- return layers.reduce(function (prevVal, layer) {
1732
- var coordinatesNumArr = getLatOrLonCoordinates(layer, field).map(function (x) {
1733
- return +x;
1734
- });
1735
- return (0, lodash_1.min)([prevVal].concat(_toConsumableArray(coordinatesNumArr)));
1736
- }, getDefaultMax(field));
1737
- };
1738
-
1739
- var getMax = function getMax(field) {
1740
- if (!isLayerValid(field)) {
1741
- return getDefaultMax(field);
1742
- }
1743
-
1744
- return layers.reduce(function (prevVal, layer) {
1745
- var coordinatesNumArr = getLatOrLonCoordinates(layer, field).map(Number);
1746
- return (0, lodash_1.max)([prevVal].concat(_toConsumableArray(coordinatesNumArr)));
1747
- }, getDefaultMin(field));
1748
- };
1749
-
1750
- return [[getMin(LONGITUDE), getMin(LATITUDE)], [getMax(LONGITUDE), getMax(LATITUDE)]];
1751
- };
1752
-
1753
- exports.getGlobalLayerBoundaries = getGlobalLayerBoundaries;
1754
-
1755
- var getScaledOpacities = function getScaledOpacities(colors, cfgOpacity) {
1756
- // extract opacity information from 8 digit hex codes
1757
- var opacities = colors === null || colors === void 0 ? void 0 : colors.map(function (color) {
1758
- var _a;
1759
-
1760
- return (color === null || color === void 0 ? void 0 : color.length) === 9 ? (_a = chroma(color).alpha()) !== null && _a !== void 0 ? _a : 1 : 1;
1761
- }); // opacity cannot be greater than configured opacity
1762
-
1763
- return opacities === null || opacities === void 0 ? void 0 : opacities.map(function (opacity) {
1764
- return opacity * cfgOpacity;
1765
- });
1766
- };
1767
-
1768
- exports.getScaledOpacities = getScaledOpacities;
1769
-
1770
- var compareBaseStyles = function compareBaseStyles(curr, next) {
1771
- var _a, _b, _c, _d;
1772
-
1773
- var currBaseLayer = (_a = curr === null || curr === void 0 ? void 0 : curr.layers) === null || _a === void 0 ? void 0 : _a.find(function (layer) {
1774
- return (layer === null || layer === void 0 ? void 0 : layer.id) === 'base-layer';
1775
- });
1776
- var nextBaseLayer = (_b = next === null || next === void 0 ? void 0 : next.layers) === null || _b === void 0 ? void 0 : _b.find(function (layer) {
1777
- return (layer === null || layer === void 0 ? void 0 : layer.id) === 'base-layer';
1778
- });
1779
- var currBaseSource = (0, lodash_1.get)(curr === null || curr === void 0 ? void 0 : curr.sources, (_c = currBaseLayer === null || currBaseLayer === void 0 ? void 0 : currBaseLayer.source) !== null && _c !== void 0 ? _c : '');
1780
- var nextBaseSource = (0, lodash_1.get)(next === null || next === void 0 ? void 0 : next.sources, (_d = nextBaseLayer === null || nextBaseLayer === void 0 ? void 0 : nextBaseLayer.source) !== null && _d !== void 0 ? _d : '');
1781
-
1782
- if (!currBaseLayer || !nextBaseLayer || !currBaseSource || !nextBaseSource) {
1783
- return false;
1784
- }
1785
-
1786
- return (0, lodash_1.isEqual)(currBaseLayer, nextBaseLayer) && (0, lodash_1.isEqual)(currBaseSource, nextBaseSource);
1787
- };
1788
-
1789
- exports.compareBaseStyles = compareBaseStyles;
1790
-
1791
- var formatMetadata = function formatMetadata(choroplethLayer, i) {
1792
- if (!choroplethLayer || !choroplethLayer.areaIds || !choroplethLayer.areaValues) return {};
1793
- if (i >= choroplethLayer.areaIds.length) return {};
1794
- var metadata = choroplethLayer.metadata ? choroplethLayer.metadata[i] : {};
1795
- var name = choroplethLayer.areaIds[i];
1796
- var value = choroplethLayer.areaValues[i];
1797
- var base = {
1798
- name: name,
1799
- value: String(value)
1800
- };
1801
- return Object.keys(metadata).reduce(function (result, curr) {
1802
- var key = "row.".concat(curr, ".value");
1803
- var val = (0, lodash_1.isObject)(metadata[curr]) ? JSON.stringify(metadata[curr]) : String(metadata[curr]);
1804
- return Object.assign(Object.assign({}, result), _defineProperty({}, key, val));
1805
- }, base);
1806
- };
1807
-
1808
- exports.formatMetadata = formatMetadata;
1809
-
1810
- /***/ }),
1811
- /* 59 */
1812
- /***/ (function(module, exports) {
1813
-
1814
- module.exports = require("@babel/runtime/helpers/slicedToArray");
786
+ exports.VizBehavior = void 0;
787
+ var VizBehavior;
1815
788
 
1816
- /***/ }),
1817
- /* 60 */
1818
- /***/ (function(module, exports) {
789
+ (function (VizBehavior) {
790
+ /**
791
+ * Dynamic Options Behavior.
792
+ * This allows visualization options to be powered by data
793
+ *
794
+ * **Example**
795
+ *
796
+ * sparklineValues: ">primary|seriesByIndex(0)"
797
+ * would configure sparklineValues with an array of data points
798
+ * coming from the first series in the primary datasource
799
+ *
800
+ */
801
+ VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
802
+ VizBehavior["EVENTS"] = "events";
803
+ VizBehavior["DOWNSAMPLING"] = "downsampling";
804
+ /**
805
+ * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
806
+ * missing.
807
+ * @type {string}
808
+ */
1819
809
 
1820
- module.exports = require("d3-scale");
810
+ VizBehavior["PLACEHOLDER"] = "placeholder";
811
+ VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
812
+ VizBehavior["TRELLIS"] = "trellis";
813
+ })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
1821
814
 
1822
815
  /***/ }),
1823
- /* 61 */
1824
- /***/ (function(module, exports) {
1825
816
 
1826
- module.exports = require("chroma-js");
817
+ /***/ 7:
818
+ /***/ (function(module, exports, __webpack_require__) {
1827
819
 
1828
- /***/ }),
1829
- /* 62 */
1830
- /***/ (function(module, exports) {
820
+ "use strict";
1831
821
 
1832
- module.exports = require("@splunk/visualizations-shared/colorUtils");
1833
822
 
1834
- /***/ }),
1835
- /* 63 */
1836
- /***/ (function(module, exports) {
823
+ Object.defineProperty(exports, "__esModule", {
824
+ value: true
825
+ });
826
+ exports.VizCategory = void 0;
827
+ var VizCategory;
1837
828
 
1838
- module.exports = require("@splunk/visualization-encoding/utils/types");
829
+ (function (VizCategory) {
830
+ VizCategory["SINGLE_VALUE"] = "Single Value";
831
+ VizCategory["TRENDS"] = "Trends";
832
+ VizCategory["COMPARISONS"] = "Comparisons";
833
+ VizCategory["TABLE"] = "Table";
834
+ VizCategory["GAUGE"] = "Gauge";
835
+ VizCategory["DISTRIBUTIONS"] = "Distributions";
836
+ VizCategory["CHOROPLETH"] = "Choropleth Maps";
837
+ VizCategory["SHAPES"] = "Shapes";
838
+ VizCategory["MISC"] = "misc";
839
+ VizCategory["FLOW"] = "Flow";
840
+ VizCategory["CORRELATION"] = "Correlation";
841
+ VizCategory["SPATIAL"] = "Spatial";
842
+ })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
1839
843
 
1840
844
  /***/ })
1841
- /******/ ]);
845
+
846
+ /******/ });
1842
847
  //# sourceMappingURL=Map.config.js.map