@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
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 71);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 62);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -106,75 +106,192 @@ module.exports = require("@babel/runtime/helpers/toConsumableArray");
106
106
 
107
107
  /***/ }),
108
108
 
109
- /***/ 12:
109
+ /***/ 11:
110
110
  /***/ (function(module, exports) {
111
111
 
112
112
  module.exports = require("@splunk/visualization-icons");
113
113
 
114
114
  /***/ }),
115
115
 
116
- /***/ 15:
116
+ /***/ 13:
117
117
  /***/ (function(module, exports) {
118
118
 
119
119
  module.exports = require("@splunk/visualization-color-palettes/editors/PresetPalettes");
120
120
 
121
121
  /***/ }),
122
122
 
123
+ /***/ 19:
124
+ /***/ (function(module, exports) {
125
+
126
+ module.exports = require("@splunk/themes");
127
+
128
+ /***/ }),
129
+
123
130
  /***/ 2:
131
+ /***/ (function(module, exports) {
132
+
133
+ module.exports = require("@splunk/visualization-schemas");
134
+
135
+ /***/ }),
136
+
137
+ /***/ 3:
124
138
  /***/ (function(module, exports, __webpack_require__) {
125
139
 
126
140
  "use strict";
127
141
 
128
142
 
143
+ var _toConsumableArray = __webpack_require__(1);
144
+
129
145
  Object.defineProperty(exports, "__esModule", {
130
146
  value: true
131
147
  });
132
- exports.VizBehavior = void 0;
133
- var VizBehavior;
148
+ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceConfig = exports.enhanceOptionsSchemaWithDynamicOptions = void 0;
134
149
 
135
- (function (VizBehavior) {
136
- /**
137
- * Dynamic Options Behavior.
138
- * This allows visualization options to be powered by data
139
- *
140
- * **Example**
141
- *
142
- * sparklineValues: ">primary|seriesByIndex(0)"
143
- * would configure sparklineValues with an array of data points
144
- * coming from the first series in the primary datasource
145
- *
146
- */
147
- VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
148
- VizBehavior["EVENTS"] = "events";
149
- VizBehavior["DOWNSAMPLING"] = "downsampling";
150
- /**
151
- * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
152
- * missing.
153
- * @type {string}
154
- */
150
+ var lodash_1 = __webpack_require__(5); // included for backwards compatibility
155
151
 
156
- VizBehavior["PLACEHOLDER"] = "placeholder";
157
- VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
158
- VizBehavior["TRELLIS"] = "trellis";
159
- })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
160
152
 
161
- /***/ }),
153
+ var visualization_schemas_1 = __webpack_require__(2);
162
154
 
163
- /***/ 21:
164
- /***/ (function(module, exports) {
155
+ Object.defineProperty(exports, "enhanceOptionsSchemaWithDynamicOptions", {
156
+ enumerable: true,
157
+ get: function get() {
158
+ return visualization_schemas_1.enhanceOptionsSchemaWithDynamicOptions;
159
+ }
160
+ });
161
+ /**
162
+ * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
163
+ * this function also collapse all editor panels
164
+ * @param vizConfig a Visualization Config
165
+ * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
166
+ * and containing `open: false` for all editor panels in editorConfig
167
+ */
165
168
 
166
- module.exports = require("@splunk/themes");
169
+ function enhanceConfig(vizConfig) {
170
+ var enhancedConfig = Object.assign({}, vizConfig);
171
+ enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
172
+ return Object.assign(Object.assign({}, config), {
173
+ open: config.open || false
174
+ });
175
+ });
176
+ return enhancedConfig;
177
+ }
167
178
 
168
- /***/ }),
179
+ exports.enhanceConfig = enhanceConfig;
180
+ /**
181
+ * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
182
+ * Created for editor unit tests
183
+ * @param vizConfig a Visualization Config
184
+ * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
185
+ */
169
186
 
170
- /***/ 3:
171
- /***/ (function(module, exports) {
187
+ function uncollapseEditorConfig(vizConfig) {
188
+ var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
189
+ editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
190
+ return Object.assign(Object.assign({}, config), {
191
+ open: true
192
+ });
193
+ });
194
+ return editorPanelUncollapsedConfig;
195
+ }
196
+
197
+ exports.uncollapseEditorConfig = uncollapseEditorConfig;
172
198
 
173
- module.exports = require("@splunk/visualizations-shared/schemaUtils");
199
+ function isDynamicOption(option) {
200
+ return option && typeof option === 'string' && option.trim().startsWith('>') || false;
201
+ }
202
+
203
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
204
+ // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
205
+
206
+ /**
207
+ * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
208
+ * 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
209
+ * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
210
+ * 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
211
+ *
212
+ * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
213
+ */
214
+
215
+ function hasCompatibleContexts(vizContext, presetContext) {
216
+ var presetContextKeys = Object.keys(presetContext);
217
+ return presetContextKeys.every(function (contextKey) {
218
+ return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
219
+ });
220
+ }
221
+ /**
222
+ * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
223
+ */
224
+
225
+
226
+ function hasCompatibleOptions(vizOptions, presetOptions) {
227
+ var presetOptionKeys = Object.keys(presetOptions);
228
+ return presetOptionKeys.every(function (optionKey) {
229
+ return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
230
+ });
231
+ }
232
+ /**
233
+ * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
234
+ * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
235
+ *
236
+ * @param {Object} vizContext - the current vizContext definition
237
+ * @param {Object} vizOptions - the current vizOptions definition
238
+ * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
239
+ */
240
+
241
+
242
+ function getInitialPreset(vizContext, vizOptions, presets) {
243
+ return presets.find(function (preset) {
244
+ var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
245
+ var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
246
+ var presetContextKeys = Object.keys(presetContext);
247
+ var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
248
+ // if not, then the preset is invalid in config.ts
249
+
250
+ if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
251
+ return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
252
+ });
253
+ }
254
+
255
+ exports.getInitialPreset = getInitialPreset;
256
+ /**
257
+ * generates number precision values for a Select editor
258
+ *
259
+ * @param {Number} numPrecisionValues - number of integer precision values to generate
260
+ * @returns {{ label: string; value; string }[]} array of { label, value } tuples
261
+ */
262
+
263
+ function generatePrecisionValues(numPrecisionValues) {
264
+ return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
265
+ return {
266
+ label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
267
+ value: i
268
+ };
269
+ });
270
+ }
271
+
272
+ exports.generatePrecisionValues = generatePrecisionValues;
273
+ /**
274
+ * insert layout in layout array, return a new layout array instead of updating the original
275
+ *
276
+ * @param {EditorLayoutConfig[][]} layout - editor layout
277
+ * @param {Number} index - the index to insert layout item(s)
278
+ * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
279
+ * @returns {EditorLayoutConfig[][]} new editor layout with insertion
280
+ */
281
+
282
+ var insertLayout = function insertLayout(layout, index) {
283
+ for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
284
+ layoutItems[_key - 2] = arguments[_key];
285
+ }
286
+
287
+ return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
288
+ };
289
+
290
+ exports.insertLayout = insertLayout;
174
291
 
175
292
  /***/ }),
176
293
 
177
- /***/ 35:
294
+ /***/ 32:
178
295
  /***/ (function(module, exports, __webpack_require__) {
179
296
 
180
297
  "use strict";
@@ -187,7 +304,7 @@ exports.getDynamicFillColorEditor = void 0;
187
304
 
188
305
  var i18n_1 = __webpack_require__(0);
189
306
 
190
- var configUtils_1 = __webpack_require__(5);
307
+ var configUtils_1 = __webpack_require__(4);
191
308
 
192
309
  var getDynamicFillColorEditor = function getDynamicFillColorEditor(_ref) {
193
310
  var defaultContext = _ref.defaultContext,
@@ -230,7 +347,7 @@ exports.getDynamicFillColorEditor = getDynamicFillColorEditor;
230
347
 
231
348
  /***/ }),
232
349
 
233
- /***/ 36:
350
+ /***/ 33:
234
351
  /***/ (function(module, exports, __webpack_require__) {
235
352
 
236
353
  "use strict";
@@ -243,7 +360,7 @@ exports.getDynamicStrokeColorEditor = void 0;
243
360
 
244
361
  var i18n_1 = __webpack_require__(0);
245
362
 
246
- var configUtils_1 = __webpack_require__(5);
363
+ var configUtils_1 = __webpack_require__(4);
247
364
 
248
365
  var getDynamicStrokeColorEditor = function getDynamicStrokeColorEditor(_ref) {
249
366
  var defaultContext = _ref.defaultContext,
@@ -286,7 +403,7 @@ exports.getDynamicStrokeColorEditor = getDynamicStrokeColorEditor;
286
403
 
287
404
  /***/ }),
288
405
 
289
- /***/ 37:
406
+ /***/ 34:
290
407
  /***/ (function(module, exports, __webpack_require__) {
291
408
 
292
409
  "use strict";
@@ -298,7 +415,7 @@ Object.defineProperty(exports, "__esModule", {
298
415
 
299
416
  var i18n_1 = __webpack_require__(0);
300
417
 
301
- var configUtils_1 = __webpack_require__(5);
418
+ var configUtils_1 = __webpack_require__(4);
302
419
 
303
420
  var StaticFillColorEditor = {
304
421
  label: (0, i18n_1._)('Fill'),
@@ -313,7 +430,7 @@ exports.default = StaticFillColorEditor;
313
430
 
314
431
  /***/ }),
315
432
 
316
- /***/ 38:
433
+ /***/ 35:
317
434
  /***/ (function(module, exports, __webpack_require__) {
318
435
 
319
436
  "use strict";
@@ -325,7 +442,7 @@ Object.defineProperty(exports, "__esModule", {
325
442
 
326
443
  var i18n_1 = __webpack_require__(0);
327
444
 
328
- var configUtils_1 = __webpack_require__(5);
445
+ var configUtils_1 = __webpack_require__(4);
329
446
 
330
447
  var StaticStrokeColorEditor = {
331
448
  label: (0, i18n_1._)('Stroke'),
@@ -341,264 +458,60 @@ exports.default = StaticStrokeColorEditor;
341
458
  /***/ }),
342
459
 
343
460
  /***/ 4:
344
- /***/ (function(module, exports, __webpack_require__) {
345
-
346
- "use strict";
347
-
348
-
349
- var _toConsumableArray = __webpack_require__(1);
350
-
351
- var _defineProperty = __webpack_require__(7);
352
-
353
- var __rest = this && this.__rest || function (s, e) {
354
- var t = {};
355
-
356
- for (var p in s) {
357
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
358
- }
359
-
360
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
361
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
362
- }
363
- return t;
364
- };
365
-
366
- Object.defineProperty(exports, "__esModule", {
367
- value: true
368
- });
369
- exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
370
-
371
- var lodash_1 = __webpack_require__(6);
372
-
373
- var schemaUtils_1 = __webpack_require__(3);
374
-
375
- var VizBehavior_1 = __webpack_require__(2);
376
-
377
- var dynamicOptionsDSLType = {
378
- type: 'string',
379
- pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
380
- };
381
- /**
382
- * Helper function to extend an options schema with dynamic options DSL
383
- * @param optionsSchema a visualization's options schema
384
- * @returns an updated options schema that additionally allows strings starting with > for each option
385
- */
386
-
387
- function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
388
- var enhancedOptionsSchema = {};
389
- Object.keys(optionsSchema).forEach(function (key) {
390
- var _a = optionsSchema[key],
391
- title = _a.title,
392
- description = _a.description,
393
- readOnly = _a.readOnly,
394
- writeOnly = _a.writeOnly,
395
- examples = _a.examples,
396
- defaultValue = _a.default,
397
- type = _a.type,
398
- properties = _a.properties,
399
- patternProperties = _a.patternProperties,
400
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
401
-
402
- var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
403
- title: title
404
- }), description !== undefined && {
405
- description: description
406
- }), readOnly !== undefined && {
407
- readOnly: readOnly
408
- }), writeOnly !== undefined && {
409
- writeOnly: writeOnly
410
- }), examples !== undefined && {
411
- examples: examples
412
- }), defaultValue !== undefined && {
413
- default: defaultValue
414
- });
415
-
416
- if (type === 'object') {
417
- enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
418
- type: type
419
- }), properties && {
420
- properties: enhanceOptionsSchemaWithDynamicOptions(properties)
421
- });
422
-
423
- if (patternProperties) {
424
- var enhancedPatternProperties = {};
425
- Object.keys(patternProperties).forEach(function (opt) {
426
- enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
427
- });
428
- enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
429
- }
430
- } else {
431
- enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
432
- anyOf: [Object.assign(Object.assign({}, type !== undefined && {
433
- type: type
434
- }), remainingSchemaEntry), dynamicOptionsDSLType]
435
- });
436
- }
437
- });
438
- return enhancedOptionsSchema;
439
- }
440
-
441
- exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
442
- /**
443
- * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
444
- * this function also collapse all editor panels
445
- * @param vizConfig a Visualization Config
446
- * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
447
- * and containing `open: false` for all editor panels in editorConfig
448
- */
449
-
450
- function enhanceConfig(vizConfig) {
451
- var enhancedConfig = Object.assign({}, vizConfig);
452
-
453
- if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
454
- enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
455
- }
456
-
457
- enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
458
- return Object.assign(Object.assign({}, config), {
459
- open: config.open || false
460
- });
461
- });
462
- return enhancedConfig;
463
- }
464
-
465
- exports.enhanceConfig = enhanceConfig;
466
- /**
467
- * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
468
- * Created for editor unit tests
469
- * @param vizConfig a Visualization Config
470
- * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
471
- */
472
-
473
- function uncollapseEditorConfig(vizConfig) {
474
- var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
475
- editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
476
- return Object.assign(Object.assign({}, config), {
477
- open: true
478
- });
479
- });
480
- return editorPanelUncollapsedConfig;
481
- }
482
-
483
- exports.uncollapseEditorConfig = uncollapseEditorConfig;
484
-
485
- function isDynamicOption(option) {
486
- return option && typeof option === 'string' && option.trim().startsWith('>') || false;
487
- }
488
-
489
- exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
490
- // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
491
-
492
- /**
493
- * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
494
- * 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
495
- * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
496
- * 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
497
- *
498
- * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
499
- */
500
-
501
- function hasCompatibleContexts(vizContext, presetContext) {
502
- var presetContextKeys = Object.keys(presetContext);
503
- return presetContextKeys.every(function (contextKey) {
504
- return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
505
- });
506
- }
507
- /**
508
- * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
509
- */
510
-
511
-
512
- function hasCompatibleOptions(vizOptions, presetOptions) {
513
- var presetOptionKeys = Object.keys(presetOptions);
514
- return presetOptionKeys.every(function (optionKey) {
515
- return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
516
- });
517
- }
518
- /**
519
- * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
520
- * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
521
- *
522
- * @param {Object} vizContext - the current vizContext definition
523
- * @param {Object} vizOptions - the current vizOptions definition
524
- * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
525
- */
526
-
527
-
528
- function getInitialPreset(vizContext, vizOptions, presets) {
529
- return presets.find(function (preset) {
530
- var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
531
- var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
532
- var presetContextKeys = Object.keys(presetContext);
533
- var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
534
- // if not, then the preset is invalid in config.ts
535
-
536
- if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
537
- return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
538
- });
539
- }
540
-
541
- exports.getInitialPreset = getInitialPreset;
542
- /**
543
- * generates number precision values for a Select editor
544
- *
545
- * @param {Number} numPrecisionValues - number of integer precision values to generate
546
- * @returns {{ label: string; value; string }[]} array of { label, value } tuples
547
- */
548
-
549
- function generatePrecisionValues(numPrecisionValues) {
550
- return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
551
- return {
552
- label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
553
- value: i
554
- };
555
- });
556
- }
557
-
558
- exports.generatePrecisionValues = generatePrecisionValues;
559
- /**
560
- * insert layout in layout array, return a new layout array instead of updating the original
561
- *
562
- * @param {EditorLayoutConfig[][]} layout - editor layout
563
- * @param {Number} index - the index to insert layout item(s)
564
- * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
565
- * @returns {EditorLayoutConfig[][]} new editor layout with insertion
566
- */
567
-
568
- var insertLayout = function insertLayout(layout, index) {
569
- for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
570
- layoutItems[_key - 2] = arguments[_key];
571
- }
572
-
573
- return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
574
- };
461
+ /***/ (function(module, exports) {
575
462
 
576
- exports.insertLayout = insertLayout;
463
+ module.exports = require("@splunk/visualizations-shared/configUtils");
577
464
 
578
465
  /***/ }),
579
466
 
580
467
  /***/ 5:
581
468
  /***/ (function(module, exports) {
582
469
 
583
- module.exports = require("@splunk/visualizations-shared/configUtils");
470
+ module.exports = require("lodash");
584
471
 
585
472
  /***/ }),
586
473
 
587
474
  /***/ 6:
588
- /***/ (function(module, exports) {
475
+ /***/ (function(module, exports, __webpack_require__) {
589
476
 
590
- module.exports = require("lodash");
477
+ "use strict";
591
478
 
592
- /***/ }),
593
479
 
594
- /***/ 7:
595
- /***/ (function(module, exports) {
480
+ Object.defineProperty(exports, "__esModule", {
481
+ value: true
482
+ });
483
+ exports.VizBehavior = void 0;
484
+ var VizBehavior;
596
485
 
597
- module.exports = require("@babel/runtime/helpers/defineProperty");
486
+ (function (VizBehavior) {
487
+ /**
488
+ * Dynamic Options Behavior.
489
+ * This allows visualization options to be powered by data
490
+ *
491
+ * **Example**
492
+ *
493
+ * sparklineValues: ">primary|seriesByIndex(0)"
494
+ * would configure sparklineValues with an array of data points
495
+ * coming from the first series in the primary datasource
496
+ *
497
+ */
498
+ VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
499
+ VizBehavior["EVENTS"] = "events";
500
+ VizBehavior["DOWNSAMPLING"] = "downsampling";
501
+ /**
502
+ * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
503
+ * missing.
504
+ * @type {string}
505
+ */
506
+
507
+ VizBehavior["PLACEHOLDER"] = "placeholder";
508
+ VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
509
+ VizBehavior["TRELLIS"] = "trellis";
510
+ })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
598
511
 
599
512
  /***/ }),
600
513
 
601
- /***/ 71:
514
+ /***/ 62:
602
515
  /***/ (function(module, exports, __webpack_require__) {
603
516
 
604
517
  "use strict";
@@ -607,31 +520,30 @@ module.exports = require("@babel/runtime/helpers/defineProperty");
607
520
  Object.defineProperty(exports, "__esModule", {
608
521
  value: true
609
522
  });
610
- exports.optionsSchema = void 0;
611
523
 
612
- var visualization_icons_1 = __webpack_require__(12);
524
+ var visualization_icons_1 = __webpack_require__(11);
613
525
 
614
- var schemaUtils_1 = __webpack_require__(3);
526
+ var visualization_schemas_1 = __webpack_require__(2);
615
527
 
616
528
  var i18n_1 = __webpack_require__(0);
617
529
 
618
- var PresetPalettes_1 = __webpack_require__(15);
530
+ var PresetPalettes_1 = __webpack_require__(13);
619
531
 
620
- var themes_1 = __webpack_require__(21);
532
+ var themes_1 = __webpack_require__(19);
621
533
 
622
- var VizBehavior_1 = __webpack_require__(2);
534
+ var VizBehavior_1 = __webpack_require__(6);
623
535
 
624
- var VizCategory_1 = __webpack_require__(8);
536
+ var VizCategory_1 = __webpack_require__(7);
625
537
 
626
- var configUtils_1 = __webpack_require__(4);
538
+ var configUtils_1 = __webpack_require__(3);
627
539
 
628
- var DynamicFillColorEditor_1 = __webpack_require__(35);
540
+ var DynamicFillColorEditor_1 = __webpack_require__(32);
629
541
 
630
- var DynamicStrokeColorEditor_1 = __webpack_require__(36);
542
+ var DynamicStrokeColorEditor_1 = __webpack_require__(33);
631
543
 
632
- var StaticFillColorEditor_1 = __webpack_require__(37);
544
+ var StaticFillColorEditor_1 = __webpack_require__(34);
633
545
 
634
- var StaticStrokeColorEditor_1 = __webpack_require__(38);
546
+ var StaticStrokeColorEditor_1 = __webpack_require__(35);
635
547
 
636
548
  var dataContract = {
637
549
  requiredDataSources: [],
@@ -714,54 +626,6 @@ var defaultContext = {
714
626
  value: '#5C33FF'
715
627
  }]
716
628
  };
717
- exports.optionsSchema = {
718
- fillColor: {
719
- default: '> themes.defaultFillColor',
720
- description: 'Specify the fill color. You may use a dataSource to apply the color. The hex value format should be "#FFFFFF". The default for enterprise light mode is "#C3CBD4". The default for enterprise dark mode is "#31373E". The default for prisma dark mode is "#0B0C0E".',
721
- type: 'string'
722
- },
723
- fillOpacity: {
724
- description: 'Specify the opacity of the fill. Choose a number in the range of 0 - 1 (inclusive). You can also express the value as a percentage. For example, "0.80" in source or "80%" in UI.',
725
- type: 'number',
726
- default: 1
727
- },
728
- rx: {
729
- description: 'Specify the curvature of the horizontal corner (or border) radius with an integer or a percent greater than or equal to zero.',
730
- type: 'number',
731
- default: 0
732
- },
733
- ry: {
734
- description: 'Specify the curvature of the vertical corner (or border) radius with an integer or a percent greater than or equal to zero.',
735
- type: 'number',
736
- default: '> rx'
737
- },
738
- strokeColor: {
739
- default: '> themes.defaultStrokeColor',
740
- description: 'Specify the stroke color. You may use a dataSource to apply the color. The hex value format should be "#FFFFFF". The default for enterprise light mode is "#3C444D". The default for enterprise dark mode is "#C3CBD4". The default for prisma dark mode is "#ACACAD".',
741
- type: 'string'
742
- },
743
- strokeDashStyle: {
744
- description: 'Specify the size, in pixels, of dashes and spaces used to create a custom stitched outline. The value you specify applies to both the dashes and the spaces between them.',
745
- type: 'number',
746
- default: 0
747
- },
748
- strokeJoinStyle: {
749
- description: 'Specifies the shape to be used at the corners of paths when they are joined.',
750
- type: 'string',
751
- default: 'miter',
752
- pattern: (0, schemaUtils_1.getPattern)(['arcs', 'bevel', 'miter', 'miter-clip', 'round'])
753
- },
754
- strokeOpacity: {
755
- description: 'Specify the opacity of the stroke. Choose a number in the range of 0 - 1 (inclusive). You can also express the value as a percentage. For example, "0.80" in source or "80%" in UI.',
756
- type: 'number',
757
- default: 1
758
- },
759
- strokeWidth: {
760
- description: 'Specify the width of the stroke, in pixels, in the range of 1 - 25 (inclusive).',
761
- type: 'number',
762
- default: 1
763
- }
764
- };
765
629
  var themes = {
766
630
  defaultFillColor: function defaultFillColor(props) {
767
631
  return (0, themes_1.pick)({
@@ -927,7 +791,7 @@ var config = {
927
791
  dataContract: dataContract,
928
792
  size: size,
929
793
  defaultContext: defaultContext,
930
- optionsSchema: exports.optionsSchema,
794
+ optionsSchema: visualization_schemas_1.rectangleOptionsSchema,
931
795
  editorConfig: editorConfig,
932
796
  supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS],
933
797
  themes: themes,
@@ -942,7 +806,7 @@ exports.default = (0, configUtils_1.enhanceConfig)(config);
942
806
 
943
807
  /***/ }),
944
808
 
945
- /***/ 8:
809
+ /***/ 7:
946
810
  /***/ (function(module, exports, __webpack_require__) {
947
811
 
948
812
  "use strict";