@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.
- package/Area.config.js +91 -594
- package/Area.config.js.map +1 -1
- package/Area.js +184 -689
- package/Area.js.map +1 -1
- package/Bar.config.js +92 -561
- package/Bar.config.js.map +1 -1
- package/Bar.js +184 -655
- package/Bar.js.map +1 -1
- package/Bubble.config.js +83 -482
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +177 -578
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +76 -201
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +173 -301
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +92 -599
- package/Column.config.js.map +1 -1
- package/Column.js +184 -693
- package/Column.js.map +1 -1
- package/Ellipse.config.js +82 -200
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +137 -262
- package/Ellipse.js.map +1 -1
- package/Events.config.js +61 -282
- package/Events.config.js.map +1 -1
- package/Events.js +222 -428
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +90 -219
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +163 -299
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +61 -157
- package/Image.config.js.map +1 -1
- package/Image.js +130 -242
- package/Image.js.map +1 -1
- package/Line.config.js +91 -606
- package/Line.config.js.map +1 -1
- package/Line.js +184 -701
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +74 -256
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +17198 -24224
- package/LinkGraph.js.map +1 -1
- package/Map.config.js +128 -1123
- package/Map.config.js.map +1 -1
- package/Map.js +309 -680
- package/Map.js.map +1 -1
- package/Markdown.config.js +61 -188
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +190 -323
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +137 -297
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +1038 -1203
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +71 -191
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +218 -343
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +72 -240
- package/Pie.config.js.map +1 -1
- package/Pie.js +214 -381
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +71 -305
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +246 -477
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +211 -347
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +274 -416
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +71 -213
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +246 -382
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +85 -463
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +825 -1202
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +114 -409
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +287 -582
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +30 -30
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +113 -378
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +268 -533
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +110 -382
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +272 -543
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +24 -24
- package/SparkLine.js.map +1 -1
- package/Table.config.js +74 -496
- package/Table.config.js.map +1 -1
- package/Table.js +302 -720
- package/Table.js.map +1 -1
- package/common/Charting.js +22 -34
- package/common/Charting.js.map +1 -1
- package/common/DocExampleWithVizSandbox.js +21 -21
- package/common/DocExampleWithVizSandbox.js.map +1 -1
- package/common/EventsDoc.js +18 -18
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +4 -4
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +2 -2
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +4 -4
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +39 -40
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +2 -2
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +2 -2
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +19 -19
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +2 -2
- package/common/chartingUtils.js.map +1 -1
- package/common/gaugeUtils.js +10 -10
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +10 -10
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +25 -155
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +75 -87
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/featureFlagUtils.js +4 -4
- package/common/utils/featureFlagUtils.js.map +1 -1
- package/common/utils/hocUtils.js +2 -2
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/mapUtils.js +51 -54
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +7 -7
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +7 -36
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +7 -6
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -2
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +65 -77
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +46 -49
- package/common/utils/layoutUtils.js +0 -115
- package/common/utils/layoutUtils.js.map +0 -1
package/Rectangle.config.js
CHANGED
|
@@ -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 =
|
|
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
|
-
/***/
|
|
109
|
+
/***/ 11:
|
|
110
110
|
/***/ (function(module, exports) {
|
|
111
111
|
|
|
112
112
|
module.exports = require("@splunk/visualization-icons");
|
|
113
113
|
|
|
114
114
|
/***/ }),
|
|
115
115
|
|
|
116
|
-
/***/
|
|
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.
|
|
133
|
-
var VizBehavior;
|
|
148
|
+
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceConfig = exports.enhanceOptionsSchemaWithDynamicOptions = void 0;
|
|
134
149
|
|
|
135
|
-
|
|
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
|
-
|
|
164
|
-
|
|
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
|
-
|
|
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
|
-
|
|
171
|
-
|
|
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
|
-
|
|
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
|
-
/***/
|
|
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__(
|
|
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
|
-
/***/
|
|
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__(
|
|
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
|
-
/***/
|
|
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__(
|
|
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
|
-
/***/
|
|
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__(
|
|
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
|
|
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
|
|
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("
|
|
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
|
-
|
|
477
|
+
"use strict";
|
|
591
478
|
|
|
592
|
-
/***/ }),
|
|
593
479
|
|
|
594
|
-
|
|
595
|
-
|
|
480
|
+
Object.defineProperty(exports, "__esModule", {
|
|
481
|
+
value: true
|
|
482
|
+
});
|
|
483
|
+
exports.VizBehavior = void 0;
|
|
484
|
+
var VizBehavior;
|
|
596
485
|
|
|
597
|
-
|
|
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
|
-
/***/
|
|
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__(
|
|
524
|
+
var visualization_icons_1 = __webpack_require__(11);
|
|
613
525
|
|
|
614
|
-
var
|
|
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__(
|
|
530
|
+
var PresetPalettes_1 = __webpack_require__(13);
|
|
619
531
|
|
|
620
|
-
var themes_1 = __webpack_require__(
|
|
532
|
+
var themes_1 = __webpack_require__(19);
|
|
621
533
|
|
|
622
|
-
var VizBehavior_1 = __webpack_require__(
|
|
534
|
+
var VizBehavior_1 = __webpack_require__(6);
|
|
623
535
|
|
|
624
|
-
var VizCategory_1 = __webpack_require__(
|
|
536
|
+
var VizCategory_1 = __webpack_require__(7);
|
|
625
537
|
|
|
626
|
-
var configUtils_1 = __webpack_require__(
|
|
538
|
+
var configUtils_1 = __webpack_require__(3);
|
|
627
539
|
|
|
628
|
-
var DynamicFillColorEditor_1 = __webpack_require__(
|
|
540
|
+
var DynamicFillColorEditor_1 = __webpack_require__(32);
|
|
629
541
|
|
|
630
|
-
var DynamicStrokeColorEditor_1 = __webpack_require__(
|
|
542
|
+
var DynamicStrokeColorEditor_1 = __webpack_require__(33);
|
|
631
543
|
|
|
632
|
-
var StaticFillColorEditor_1 = __webpack_require__(
|
|
544
|
+
var StaticFillColorEditor_1 = __webpack_require__(34);
|
|
633
545
|
|
|
634
|
-
var StaticStrokeColorEditor_1 = __webpack_require__(
|
|
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:
|
|
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
|
-
/***/
|
|
809
|
+
/***/ 7:
|
|
946
810
|
/***/ (function(module, exports, __webpack_require__) {
|
|
947
811
|
|
|
948
812
|
"use strict";
|