@splunk/visualizations 26.0.0 → 26.1.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 +102 -18
- package/Area.config.js.map +1 -1
- package/Area.js +618 -221
- package/Area.js.map +1 -1
- package/Bar.config.js +104 -20
- package/Bar.config.js.map +1 -1
- package/Bar.js +624 -219
- package/Bar.js.map +1 -1
- package/Bubble.config.js +94 -20
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +606 -211
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +65 -14
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +550 -183
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +103 -18
- package/Column.config.js.map +1 -1
- package/Column.js +637 -221
- package/Column.js.map +1 -1
- package/Ellipse.config.js +82 -17
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +425 -148
- package/Ellipse.js.map +1 -1
- package/Events.config.js +100 -18
- package/Events.config.js.map +1 -1
- package/Events.js +752 -293
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +96 -27
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +759 -374
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +62 -18
- package/Image.config.js.map +1 -1
- package/Image.js +419 -154
- package/Image.js.map +1 -1
- package/Line.config.js +106 -22
- package/Line.config.js.map +1 -1
- package/Line.js +631 -223
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +72 -22
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +632 -219
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +241 -97
- package/Map.config.js.map +1 -1
- package/Map.js +1195 -595
- package/Map.js.map +1 -1
- package/Markdown.config.js +70 -20
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +460 -195
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +79 -21
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +802 -411
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +72 -18
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +853 -484
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +75 -22
- package/Pie.config.js.map +1 -1
- package/Pie.js +612 -212
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +81 -29
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +844 -379
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +85 -19
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +432 -152
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +84 -22
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +878 -342
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +96 -22
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +607 -212
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +94 -24
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1182 -650
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +286 -225
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +92 -22
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +965 -506
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +99 -26
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1167 -616
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +126 -67
- package/SparkLine.js.map +1 -1
- package/Table.config.js +73 -20
- package/Table.config.js.map +1 -1
- package/Table.js +810 -322
- package/Table.js.map +1 -1
- package/common/Charting.js +107 -35
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +76 -22
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +68 -58
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +43 -34
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +156 -65
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +33 -5
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +31 -4
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +8 -2
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +27 -14
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +44 -12
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +11 -1
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +173 -90
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +14 -2
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +49 -14
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +7 -2
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +3 -1
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +1 -0
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +287 -127
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +241 -196
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +9 -0
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +61 -0
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -0
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +274 -95
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +16 -18
package/ChoroplethSvg.js
CHANGED
|
@@ -133,6 +133,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
133
133
|
});
|
|
134
134
|
exports.VizBehavior = void 0;
|
|
135
135
|
var VizBehavior;
|
|
136
|
+
|
|
136
137
|
(function (VizBehavior) {
|
|
137
138
|
/**
|
|
138
139
|
* Dynamic Options Behavior.
|
|
@@ -152,6 +153,7 @@ var VizBehavior;
|
|
|
152
153
|
* missing.
|
|
153
154
|
* @type {string}
|
|
154
155
|
*/
|
|
156
|
+
|
|
155
157
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
156
158
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
157
159
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -203,11 +205,17 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
|
203
205
|
Object.defineProperty(exports, "__esModule", {
|
|
204
206
|
value: true
|
|
205
207
|
});
|
|
208
|
+
|
|
206
209
|
var React = __webpack_require__(1);
|
|
210
|
+
|
|
207
211
|
var styled_components_1 = __webpack_require__(4);
|
|
212
|
+
|
|
208
213
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
214
|
+
|
|
209
215
|
var style_1 = __webpack_require__(14);
|
|
216
|
+
|
|
210
217
|
var colorUtils_1 = __webpack_require__(12);
|
|
218
|
+
|
|
211
219
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
212
220
|
var width = _ref.width;
|
|
213
221
|
return {
|
|
@@ -220,11 +228,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
|
220
228
|
componentId: "sc-1yhgpod-0"
|
|
221
229
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
222
230
|
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
223
|
-
});
|
|
224
|
-
|
|
231
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
232
|
+
|
|
225
233
|
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
226
234
|
var width = _ref2.width,
|
|
227
|
-
|
|
235
|
+
height = _ref2.height;
|
|
228
236
|
return {
|
|
229
237
|
style: Object.assign(Object.assign({}, width && {
|
|
230
238
|
width: (0, style_1.toPx)(width)
|
|
@@ -246,11 +254,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
|
246
254
|
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
247
255
|
componentId: "sc-1yhgpod-3"
|
|
248
256
|
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
257
|
+
|
|
249
258
|
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
250
259
|
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
251
260
|
var width = props.width,
|
|
252
|
-
|
|
253
|
-
|
|
261
|
+
height = props.height,
|
|
262
|
+
backgroundColor = props.backgroundColor;
|
|
263
|
+
|
|
254
264
|
if (!height) {
|
|
255
265
|
return React.createElement(Item, {
|
|
256
266
|
"data-test": "item",
|
|
@@ -258,24 +268,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
258
268
|
backgroundColor: backgroundColor
|
|
259
269
|
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
260
270
|
}
|
|
271
|
+
|
|
261
272
|
return React.createElement(FixSizeItem, {
|
|
262
273
|
"data-test": "fix-size-item",
|
|
263
|
-
"data-splunk-visualization-version": "26.
|
|
274
|
+
"data-splunk-visualization-version": "26.1.0 - fc8bf8d77",
|
|
264
275
|
width: width,
|
|
265
276
|
height: height,
|
|
266
277
|
backgroundColor: backgroundColor
|
|
267
278
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
268
279
|
var newWidth = _ref3.width,
|
|
269
|
-
|
|
280
|
+
newHeight = _ref3.height;
|
|
270
281
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
271
282
|
width: newWidth,
|
|
272
283
|
height: newHeight
|
|
273
284
|
}));
|
|
274
285
|
})));
|
|
275
286
|
};
|
|
287
|
+
|
|
276
288
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
277
289
|
return FixedSizeContainer;
|
|
278
290
|
};
|
|
291
|
+
|
|
279
292
|
exports.default = withFixedSizeContainer;
|
|
280
293
|
|
|
281
294
|
/***/ }),
|
|
@@ -301,9 +314,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
301
314
|
* @param {DashboardVizType} props.Wrapper
|
|
302
315
|
* @param {DashboardVizType} props.Visualization
|
|
303
316
|
*/
|
|
317
|
+
|
|
304
318
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
305
319
|
var Wrapper = _ref.Wrapper,
|
|
306
|
-
|
|
320
|
+
Visualization = _ref.Visualization;
|
|
307
321
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
308
322
|
extendProperties.forEach(function (prop) {
|
|
309
323
|
if (Visualization[prop]) {
|
|
@@ -312,6 +326,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
312
326
|
}
|
|
313
327
|
});
|
|
314
328
|
};
|
|
329
|
+
|
|
315
330
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
316
331
|
|
|
317
332
|
/***/ }),
|
|
@@ -346,24 +361,33 @@ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
|
|
|
346
361
|
|
|
347
362
|
|
|
348
363
|
var _toConsumableArray = __webpack_require__(8);
|
|
364
|
+
|
|
349
365
|
var _defineProperty = __webpack_require__(7);
|
|
366
|
+
|
|
350
367
|
var __rest = this && this.__rest || function (s, e) {
|
|
351
368
|
var t = {};
|
|
369
|
+
|
|
352
370
|
for (var p in s) {
|
|
353
371
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
354
372
|
}
|
|
373
|
+
|
|
355
374
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
356
375
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
357
376
|
}
|
|
358
377
|
return t;
|
|
359
378
|
};
|
|
379
|
+
|
|
360
380
|
Object.defineProperty(exports, "__esModule", {
|
|
361
381
|
value: true
|
|
362
382
|
});
|
|
363
383
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
384
|
+
|
|
364
385
|
var lodash_1 = __webpack_require__(3);
|
|
386
|
+
|
|
365
387
|
var schemaUtils_1 = __webpack_require__(16);
|
|
388
|
+
|
|
366
389
|
var VizBehavior_1 = __webpack_require__(6);
|
|
390
|
+
|
|
367
391
|
var dynamicOptionsDSLType = {
|
|
368
392
|
type: 'string',
|
|
369
393
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -373,20 +397,22 @@ var dynamicOptionsDSLType = {
|
|
|
373
397
|
* @param optionsSchema a visualization's options schema
|
|
374
398
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
375
399
|
*/
|
|
400
|
+
|
|
376
401
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
377
402
|
var enhancedOptionsSchema = {};
|
|
378
403
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
379
404
|
var _a = optionsSchema[key],
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
405
|
+
title = _a.title,
|
|
406
|
+
description = _a.description,
|
|
407
|
+
readOnly = _a.readOnly,
|
|
408
|
+
writeOnly = _a.writeOnly,
|
|
409
|
+
examples = _a.examples,
|
|
410
|
+
defaultValue = _a.default,
|
|
411
|
+
type = _a.type,
|
|
412
|
+
properties = _a.properties,
|
|
413
|
+
patternProperties = _a.patternProperties,
|
|
414
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
415
|
+
|
|
390
416
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
391
417
|
title: title
|
|
392
418
|
}), description !== undefined && {
|
|
@@ -400,12 +426,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
400
426
|
}), defaultValue !== undefined && {
|
|
401
427
|
default: defaultValue
|
|
402
428
|
});
|
|
429
|
+
|
|
403
430
|
if (type === 'object') {
|
|
404
431
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
405
432
|
type: type
|
|
406
433
|
}), properties && {
|
|
407
434
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
408
435
|
});
|
|
436
|
+
|
|
409
437
|
if (patternProperties) {
|
|
410
438
|
var enhancedPatternProperties = {};
|
|
411
439
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -423,6 +451,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
423
451
|
});
|
|
424
452
|
return enhancedOptionsSchema;
|
|
425
453
|
}
|
|
454
|
+
|
|
426
455
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
427
456
|
/**
|
|
428
457
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -431,11 +460,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
431
460
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
432
461
|
* and containing `open: false` for all editor panels in editorConfig
|
|
433
462
|
*/
|
|
463
|
+
|
|
434
464
|
function enhanceConfig(vizConfig) {
|
|
435
465
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
466
|
+
|
|
436
467
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
437
468
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
438
469
|
}
|
|
470
|
+
|
|
439
471
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
440
472
|
return Object.assign(Object.assign({}, config), {
|
|
441
473
|
open: config.open || false
|
|
@@ -443,6 +475,7 @@ function enhanceConfig(vizConfig) {
|
|
|
443
475
|
});
|
|
444
476
|
return enhancedConfig;
|
|
445
477
|
}
|
|
478
|
+
|
|
446
479
|
exports.enhanceConfig = enhanceConfig;
|
|
447
480
|
/**
|
|
448
481
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -450,6 +483,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
450
483
|
* @param vizConfig a Visualization Config
|
|
451
484
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
452
485
|
*/
|
|
486
|
+
|
|
453
487
|
function uncollapseEditorConfig(vizConfig) {
|
|
454
488
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
455
489
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -459,13 +493,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
459
493
|
});
|
|
460
494
|
return editorPanelUncollapsedConfig;
|
|
461
495
|
}
|
|
496
|
+
|
|
462
497
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
498
|
+
|
|
463
499
|
function isDynamicOption(option) {
|
|
464
500
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
465
501
|
}
|
|
466
|
-
|
|
467
|
-
// private helpers to improve readability of getInitialPreset
|
|
502
|
+
|
|
503
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
468
504
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
505
|
+
|
|
469
506
|
/**
|
|
470
507
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
471
508
|
* 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
|
|
@@ -474,6 +511,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
474
511
|
*
|
|
475
512
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
476
513
|
*/
|
|
514
|
+
|
|
477
515
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
478
516
|
var presetContextKeys = Object.keys(presetContext);
|
|
479
517
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -483,6 +521,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
483
521
|
/**
|
|
484
522
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
485
523
|
*/
|
|
524
|
+
|
|
525
|
+
|
|
486
526
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
487
527
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
488
528
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -497,18 +537,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
497
537
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
498
538
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
499
539
|
*/
|
|
540
|
+
|
|
541
|
+
|
|
500
542
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
501
543
|
return presets.find(function (preset) {
|
|
502
544
|
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
503
545
|
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
504
546
|
var presetContextKeys = Object.keys(presetContext);
|
|
505
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
506
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
547
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
507
548
|
// if not, then the preset is invalid in config.ts
|
|
549
|
+
|
|
508
550
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
509
551
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
510
552
|
});
|
|
511
553
|
}
|
|
554
|
+
|
|
512
555
|
exports.getInitialPreset = getInitialPreset;
|
|
513
556
|
/**
|
|
514
557
|
* generates number precision values for a Select editor
|
|
@@ -516,6 +559,7 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
516
559
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
517
560
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
518
561
|
*/
|
|
562
|
+
|
|
519
563
|
function generatePrecisionValues(numPrecisionValues) {
|
|
520
564
|
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
521
565
|
return {
|
|
@@ -524,6 +568,7 @@ function generatePrecisionValues(numPrecisionValues) {
|
|
|
524
568
|
};
|
|
525
569
|
});
|
|
526
570
|
}
|
|
571
|
+
|
|
527
572
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
528
573
|
/**
|
|
529
574
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -533,12 +578,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
533
578
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
534
579
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
535
580
|
*/
|
|
581
|
+
|
|
536
582
|
var insertLayout = function insertLayout(layout, index) {
|
|
537
583
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
538
584
|
layoutItems[_key - 2] = arguments[_key];
|
|
539
585
|
}
|
|
586
|
+
|
|
540
587
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
541
588
|
};
|
|
589
|
+
|
|
542
590
|
exports.insertLayout = insertLayout;
|
|
543
591
|
|
|
544
592
|
/***/ }),
|
|
@@ -603,11 +651,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
603
651
|
value: true
|
|
604
652
|
});
|
|
605
653
|
exports.shouldShowIconPlaceholder = void 0;
|
|
654
|
+
|
|
606
655
|
var React = __webpack_require__(1);
|
|
656
|
+
|
|
607
657
|
var T = __webpack_require__(0);
|
|
658
|
+
|
|
608
659
|
var lodash_1 = __webpack_require__(3);
|
|
660
|
+
|
|
609
661
|
var i18n_1 = __webpack_require__(2);
|
|
662
|
+
|
|
610
663
|
var Message_1 = __webpack_require__(10);
|
|
664
|
+
|
|
611
665
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
612
666
|
/**
|
|
613
667
|
* @method shouldShowIconPlaceholder
|
|
@@ -615,6 +669,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
615
669
|
* @param {boolean} loading
|
|
616
670
|
* @returns {boolean}
|
|
617
671
|
*/
|
|
672
|
+
|
|
673
|
+
|
|
618
674
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
619
675
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
620
676
|
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
@@ -623,6 +679,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
|
|
|
623
679
|
var noFields = fields === undefined;
|
|
624
680
|
return loading || noData || noFields;
|
|
625
681
|
};
|
|
682
|
+
|
|
626
683
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
627
684
|
var propTypes = {
|
|
628
685
|
icon: T.func,
|
|
@@ -637,11 +694,13 @@ var propTypes = {
|
|
|
637
694
|
* @param {IconPlaceholderProps} props
|
|
638
695
|
* @returns {React.ReactElement}
|
|
639
696
|
*/
|
|
697
|
+
|
|
640
698
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
641
699
|
var width = props.width,
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
700
|
+
height = props.height,
|
|
701
|
+
icon = props.icon,
|
|
702
|
+
iconColor = props.iconColor;
|
|
703
|
+
|
|
645
704
|
if (icon) {
|
|
646
705
|
return React.createElement(icon, {
|
|
647
706
|
style: {
|
|
@@ -656,6 +715,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
656
715
|
height: '50%'
|
|
657
716
|
});
|
|
658
717
|
}
|
|
718
|
+
|
|
659
719
|
return React.createElement(Message_1.default, {
|
|
660
720
|
width: width,
|
|
661
721
|
height: height,
|
|
@@ -663,6 +723,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
663
723
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
664
724
|
});
|
|
665
725
|
};
|
|
726
|
+
|
|
666
727
|
IconPlaceholder.propTypes = propTypes;
|
|
667
728
|
IconPlaceholder.defaultProps = {
|
|
668
729
|
width: '100%',
|
|
@@ -678,21 +739,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
678
739
|
|
|
679
740
|
|
|
680
741
|
var _defineProperty = __webpack_require__(7);
|
|
742
|
+
|
|
681
743
|
Object.defineProperty(exports, "__esModule", {
|
|
682
744
|
value: true
|
|
683
745
|
});
|
|
684
746
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
747
|
+
|
|
685
748
|
var T = __webpack_require__(0);
|
|
749
|
+
|
|
686
750
|
var lodash_1 = __webpack_require__(3);
|
|
687
|
-
|
|
751
|
+
|
|
752
|
+
var DataSource_1 = __webpack_require__(34);
|
|
753
|
+
|
|
688
754
|
exports.SortParamsPropTypes = T.shape({
|
|
689
755
|
currentSortKey: T.string,
|
|
690
756
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
691
757
|
onSort: T.func
|
|
692
758
|
});
|
|
759
|
+
|
|
693
760
|
var getSortingParams = function getSortingParams(_ref) {
|
|
694
761
|
var requestParams = _ref.requestParams,
|
|
695
|
-
|
|
762
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
696
763
|
var currentSortKey;
|
|
697
764
|
var currentSortDir;
|
|
698
765
|
var nextSortDirMap = {
|
|
@@ -701,15 +768,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
701
768
|
none: 'asc'
|
|
702
769
|
};
|
|
703
770
|
var onSort;
|
|
771
|
+
|
|
704
772
|
if (typeof onRequestParamsChange === 'function') {
|
|
705
773
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
706
774
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
707
775
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
708
|
-
}
|
|
709
|
-
|
|
776
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
777
|
+
|
|
778
|
+
|
|
710
779
|
onSort = function onSort(e, _ref2) {
|
|
711
780
|
var sortKey = _ref2.sortKey,
|
|
712
|
-
|
|
781
|
+
sortDir = _ref2.sortDir;
|
|
782
|
+
|
|
713
783
|
if (typeof sortKey === 'string') {
|
|
714
784
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
715
785
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -721,12 +791,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
721
791
|
}
|
|
722
792
|
};
|
|
723
793
|
}
|
|
794
|
+
|
|
724
795
|
return {
|
|
725
796
|
currentSortKey: currentSortKey,
|
|
726
797
|
currentSortDir: currentSortDir,
|
|
727
798
|
onSort: onSort
|
|
728
799
|
};
|
|
729
800
|
};
|
|
801
|
+
|
|
730
802
|
exports.getSortingParams = getSortingParams;
|
|
731
803
|
|
|
732
804
|
/***/ }),
|
|
@@ -736,43 +808,68 @@ exports.getSortingParams = getSortingParams;
|
|
|
736
808
|
"use strict";
|
|
737
809
|
|
|
738
810
|
|
|
811
|
+
Object.defineProperty(exports, "__esModule", {
|
|
812
|
+
value: true
|
|
813
|
+
});
|
|
814
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
815
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
816
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
817
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
818
|
+
|
|
819
|
+
/***/ }),
|
|
820
|
+
/* 35 */
|
|
821
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
822
|
+
|
|
823
|
+
"use strict";
|
|
824
|
+
|
|
825
|
+
|
|
739
826
|
Object.defineProperty(exports, "__esModule", {
|
|
740
827
|
value: true
|
|
741
828
|
});
|
|
742
829
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
830
|
+
|
|
743
831
|
var T = __webpack_require__(0);
|
|
832
|
+
|
|
744
833
|
var lodash_1 = __webpack_require__(3);
|
|
834
|
+
|
|
745
835
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
746
836
|
isPaging: T.bool,
|
|
747
837
|
current: T.number,
|
|
748
838
|
totalPages: T.number,
|
|
749
839
|
onChange: T.func
|
|
750
840
|
});
|
|
841
|
+
|
|
751
842
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
752
843
|
var requestParams = _ref.requestParams,
|
|
753
|
-
|
|
754
|
-
|
|
844
|
+
meta = _ref.meta,
|
|
845
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
755
846
|
var totalCount = meta && meta.totalCount || 0;
|
|
756
847
|
var offset = requestParams && requestParams.offset || 0;
|
|
757
848
|
var count = requestParams && requestParams.count;
|
|
758
849
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
759
850
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
760
851
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
852
|
+
|
|
761
853
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
762
854
|
var page = _ref2.page,
|
|
763
|
-
|
|
855
|
+
countArg = _ref2.count;
|
|
764
856
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
857
|
+
|
|
765
858
|
if (typeof countArg === 'number') {
|
|
766
859
|
newParams.count = countArg;
|
|
767
860
|
newParams.offset = 0;
|
|
768
861
|
}
|
|
862
|
+
|
|
769
863
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
864
|
+
|
|
770
865
|
if (typeof page === 'number' && page > 0) {
|
|
771
866
|
newParams.count = pageCount;
|
|
772
867
|
newParams.offset = (page - 1) * pageCount;
|
|
773
868
|
}
|
|
869
|
+
|
|
774
870
|
onRequestParamsChange(newParams);
|
|
775
871
|
};
|
|
872
|
+
|
|
776
873
|
return {
|
|
777
874
|
isPaging: isPaging,
|
|
778
875
|
current: current,
|
|
@@ -780,10 +877,11 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
780
877
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
781
878
|
};
|
|
782
879
|
};
|
|
880
|
+
|
|
783
881
|
exports.getPaginationParams = getPaginationParams;
|
|
784
882
|
|
|
785
883
|
/***/ }),
|
|
786
|
-
/*
|
|
884
|
+
/* 36 */
|
|
787
885
|
/***/ (function(module, exports, __webpack_require__) {
|
|
788
886
|
|
|
789
887
|
"use strict";
|
|
@@ -794,6 +892,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
794
892
|
});
|
|
795
893
|
exports.VizCategory = void 0;
|
|
796
894
|
var VizCategory;
|
|
895
|
+
|
|
797
896
|
(function (VizCategory) {
|
|
798
897
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
799
898
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -810,67 +909,96 @@ var VizCategory;
|
|
|
810
909
|
})(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
|
|
811
910
|
|
|
812
911
|
/***/ }),
|
|
813
|
-
/*
|
|
912
|
+
/* 37 */
|
|
814
913
|
/***/ (function(module, exports, __webpack_require__) {
|
|
815
914
|
|
|
816
915
|
"use strict";
|
|
817
916
|
|
|
818
917
|
|
|
819
918
|
var _slicedToArray = __webpack_require__(17);
|
|
919
|
+
|
|
820
920
|
Object.defineProperty(exports, "__esModule", {
|
|
821
921
|
value: true
|
|
822
922
|
});
|
|
923
|
+
|
|
823
924
|
var React = __webpack_require__(1);
|
|
925
|
+
|
|
824
926
|
var lodash_1 = __webpack_require__(3);
|
|
825
|
-
|
|
927
|
+
|
|
928
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
929
|
+
|
|
826
930
|
var Options_1 = __webpack_require__(30);
|
|
827
|
-
|
|
931
|
+
|
|
932
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
933
|
+
|
|
828
934
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
829
|
-
|
|
935
|
+
|
|
936
|
+
var moment_1 = __webpack_require__(40);
|
|
937
|
+
|
|
830
938
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
939
|
+
|
|
831
940
|
var styled_components_1 = __webpack_require__(4);
|
|
941
|
+
|
|
832
942
|
var hocUtils_1 = __webpack_require__(27);
|
|
943
|
+
|
|
833
944
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
834
|
-
|
|
945
|
+
|
|
946
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
947
|
+
|
|
835
948
|
var id_1 = __webpack_require__(25);
|
|
836
|
-
|
|
949
|
+
|
|
950
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
951
|
+
|
|
837
952
|
var VizBehavior_1 = __webpack_require__(6);
|
|
953
|
+
|
|
838
954
|
var getSorting_1 = __webpack_require__(33);
|
|
839
|
-
|
|
955
|
+
|
|
956
|
+
var getPagination_1 = __webpack_require__(35);
|
|
957
|
+
|
|
840
958
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
959
|
+
|
|
841
960
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
961
|
+
|
|
842
962
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
963
|
+
|
|
843
964
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
844
965
|
/**
|
|
845
966
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
846
967
|
* @param {DashboardVizOpts} opts
|
|
847
968
|
* @returns {HOC}
|
|
848
969
|
*/
|
|
970
|
+
|
|
971
|
+
|
|
849
972
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
850
973
|
var ReactViz = opts.ReactViz,
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
974
|
+
vizConfig = opts.vizConfig,
|
|
975
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
976
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
977
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
978
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
979
|
+
|
|
856
980
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
857
981
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
982
|
+
|
|
858
983
|
var DashboardViz = function DashboardViz(props) {
|
|
859
984
|
var _a;
|
|
985
|
+
|
|
860
986
|
var mode = props.mode,
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
987
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
988
|
+
dataSources = props.dataSources,
|
|
989
|
+
options = props.options,
|
|
990
|
+
_props$context = props.context,
|
|
991
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
992
|
+
width = props.width,
|
|
993
|
+
height = props.height,
|
|
994
|
+
onComputedProps = props.onComputedProps,
|
|
995
|
+
onEventTrigger = props.onEventTrigger,
|
|
996
|
+
theme = props.theme,
|
|
997
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
998
|
+
|
|
872
999
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
873
|
-
|
|
1000
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
1001
|
+
|
|
874
1002
|
if (serializedTimezone) {
|
|
875
1003
|
/*
|
|
876
1004
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -884,38 +1012,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
884
1012
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
885
1013
|
}
|
|
886
1014
|
}
|
|
1015
|
+
|
|
887
1016
|
var themeFunc = function themeFunc(themeVar) {
|
|
888
1017
|
var _a, _b;
|
|
1018
|
+
|
|
889
1019
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
890
1020
|
};
|
|
1021
|
+
|
|
891
1022
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
1023
|
+
|
|
892
1024
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
1025
|
+
theme: theme
|
|
1026
|
+
}),
|
|
1027
|
+
currentThemeFamily = _ref.family,
|
|
1028
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
1029
|
+
currentThemeDensity = _ref.density;
|
|
1030
|
+
|
|
898
1031
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
1032
|
+
|
|
899
1033
|
var _React$useState = React.useState({}),
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
1034
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1035
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
1036
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1037
|
+
|
|
1038
|
+
|
|
903
1039
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
1040
|
+
|
|
904
1041
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
905
|
-
|
|
906
|
-
|
|
1042
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
1043
|
+
visualizationID = _React$useState4[0];
|
|
1044
|
+
|
|
907
1045
|
var _React$useState5 = React.useState({}),
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1046
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1047
|
+
dataSourcesInState = _React$useState6[0],
|
|
1048
|
+
setDataSourcesInState = _React$useState6[1];
|
|
1049
|
+
|
|
911
1050
|
var _React$useState7 = React.useState(),
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
1051
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1052
|
+
dataFramesInState = _React$useState8[0],
|
|
1053
|
+
setDataFramesInState = _React$useState8[1];
|
|
1054
|
+
|
|
915
1055
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
1056
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1057
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1058
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1059
|
+
|
|
919
1060
|
var isMounted = React.useRef(true);
|
|
920
1061
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
921
1062
|
try {
|
|
@@ -940,11 +1081,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
940
1081
|
});
|
|
941
1082
|
} else {
|
|
942
1083
|
var dataFrames = dataFramesInState;
|
|
1084
|
+
|
|
943
1085
|
if (dataSources !== dataSourcesInState) {
|
|
944
1086
|
setDataSourcesInState(dataSources);
|
|
945
1087
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
946
1088
|
setDataFramesInState(dataFrames);
|
|
947
1089
|
}
|
|
1090
|
+
|
|
948
1091
|
return Options_1.Options.evaluate({
|
|
949
1092
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
950
1093
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -955,21 +1098,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
955
1098
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
956
1099
|
return {};
|
|
957
1100
|
}
|
|
1101
|
+
|
|
958
1102
|
return {};
|
|
959
1103
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
960
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
961
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1104
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
962
1105
|
// if trellis is enabled following these three criteria - 1) trellis feature flag is enabled 2) vizConfig supports array has 'trellis' 3) option 'splitByLayout' is set to 'trellis
|
|
963
1106
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1107
|
+
|
|
964
1108
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
965
1109
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1110
|
+
|
|
966
1111
|
if (isTrellisFeatureFlagOn && ((_a = vizConfig === null || vizConfig === void 0 ? void 0 : vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(VizBehavior_1.VizBehavior.TRELLIS)) && (clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.splitByLayout) === VizBehavior_1.VizBehavior.TRELLIS) {
|
|
967
1112
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
968
1113
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
969
1114
|
});
|
|
970
|
-
}
|
|
971
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1115
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
972
1116
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1117
|
+
|
|
1118
|
+
|
|
973
1119
|
React.useEffect(function () {
|
|
974
1120
|
onComputedProps(clonedEvaluatedOptions);
|
|
975
1121
|
});
|
|
@@ -979,44 +1125,49 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
979
1125
|
isMounted.current = false;
|
|
980
1126
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
981
1127
|
}
|
|
982
|
-
};
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
// present warning message if any required props are missing
|
|
1128
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1129
|
+
}, []); // present warning message if any required props are missing
|
|
1130
|
+
|
|
986
1131
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
987
|
-
|
|
988
|
-
|
|
1132
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1133
|
+
supports = vizConfig.supports;
|
|
989
1134
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1135
|
+
|
|
990
1136
|
if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && vizConfig.key !== 'splunk.singlevalue' // For SV missing props msg is not displayed if required props majorValue is missing, instead this will be handled from the component, instead handled within component
|
|
991
1137
|
) {
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1138
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
1139
|
+
"data-test": "missing-props-message",
|
|
1140
|
+
width: width,
|
|
1141
|
+
height: height,
|
|
1142
|
+
missingProps: missing,
|
|
1143
|
+
backgroundColor: bgColorFromTheme
|
|
1144
|
+
});
|
|
1145
|
+
} // events
|
|
1146
|
+
|
|
1147
|
+
|
|
1001
1148
|
var eventCallbackProps = {};
|
|
1149
|
+
|
|
1002
1150
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1003
1151
|
var supportedEvents = vizConfig.events;
|
|
1004
1152
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1005
1153
|
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
1006
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
1007
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
1154
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
1008
1155
|
// then remove these lines
|
|
1156
|
+
|
|
1009
1157
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
1010
1158
|
var payload = {};
|
|
1159
|
+
|
|
1011
1160
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1012
1161
|
payloadKeys.forEach(function (p) {
|
|
1013
1162
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1014
1163
|
});
|
|
1015
1164
|
}
|
|
1165
|
+
|
|
1016
1166
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1017
1167
|
if (ev && ev.payload) {
|
|
1018
1168
|
payload = ev.payload;
|
|
1019
1169
|
}
|
|
1170
|
+
|
|
1020
1171
|
return onEventTrigger({
|
|
1021
1172
|
originalEvent: ev,
|
|
1022
1173
|
payload: payload,
|
|
@@ -1024,8 +1175,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1024
1175
|
});
|
|
1025
1176
|
};
|
|
1026
1177
|
});
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1178
|
+
} // compute pure viz props which are not from options
|
|
1179
|
+
|
|
1180
|
+
|
|
1029
1181
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1030
1182
|
themeFunc: themeFunc
|
|
1031
1183
|
}));
|
|
@@ -1043,15 +1195,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1043
1195
|
* In future, we could automatically detect which all datasources are being used
|
|
1044
1196
|
* and bind those magically to pagination/sorting behavior.
|
|
1045
1197
|
*/
|
|
1198
|
+
|
|
1046
1199
|
var dataSourceMetadata = {};
|
|
1047
1200
|
var OptionKey = 'paginateDataSourceKey';
|
|
1048
1201
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1202
|
+
|
|
1049
1203
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1050
1204
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1051
1205
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1206
|
+
|
|
1052
1207
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1053
1208
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1054
1209
|
};
|
|
1210
|
+
|
|
1055
1211
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1056
1212
|
requestParams: requestParams,
|
|
1057
1213
|
meta: meta,
|
|
@@ -1066,103 +1222,120 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1066
1222
|
sortParams: sortParams,
|
|
1067
1223
|
paginatorParams: paginatorParams
|
|
1068
1224
|
};
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1225
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
1226
|
+
|
|
1227
|
+
|
|
1071
1228
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1072
1229
|
return null;
|
|
1073
1230
|
}
|
|
1231
|
+
|
|
1074
1232
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1075
1233
|
mode: mode,
|
|
1076
1234
|
width: width,
|
|
1077
1235
|
height: height
|
|
1078
1236
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1079
1237
|
};
|
|
1238
|
+
|
|
1080
1239
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1081
1240
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1082
1241
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1083
1242
|
theme: {}
|
|
1084
|
-
});
|
|
1085
|
-
|
|
1086
|
-
DashboardViz.config = vizConfig;
|
|
1087
|
-
|
|
1243
|
+
}); // attach viz config
|
|
1244
|
+
|
|
1245
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
1246
|
+
|
|
1088
1247
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1089
1248
|
};
|
|
1249
|
+
|
|
1090
1250
|
exports.default = withDashboardViz;
|
|
1091
1251
|
|
|
1092
1252
|
/***/ }),
|
|
1093
|
-
/*
|
|
1253
|
+
/* 38 */
|
|
1094
1254
|
/***/ (function(module, exports) {
|
|
1095
1255
|
|
|
1096
1256
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1097
1257
|
|
|
1098
1258
|
/***/ }),
|
|
1099
|
-
/*
|
|
1259
|
+
/* 39 */
|
|
1100
1260
|
/***/ (function(module, exports) {
|
|
1101
1261
|
|
|
1102
1262
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1103
1263
|
|
|
1104
1264
|
/***/ }),
|
|
1105
|
-
/*
|
|
1265
|
+
/* 40 */
|
|
1106
1266
|
/***/ (function(module, exports) {
|
|
1107
1267
|
|
|
1108
1268
|
module.exports = require("@splunk/moment");
|
|
1109
1269
|
|
|
1110
1270
|
/***/ }),
|
|
1111
|
-
/*
|
|
1271
|
+
/* 41 */
|
|
1112
1272
|
/***/ (function(module, exports) {
|
|
1113
1273
|
|
|
1114
1274
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1115
1275
|
|
|
1116
1276
|
/***/ }),
|
|
1117
|
-
/*
|
|
1277
|
+
/* 42 */
|
|
1118
1278
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1119
1279
|
|
|
1120
1280
|
"use strict";
|
|
1121
1281
|
|
|
1122
1282
|
|
|
1123
1283
|
var _classCallCheck = __webpack_require__(9);
|
|
1284
|
+
|
|
1124
1285
|
Object.defineProperty(exports, "__esModule", {
|
|
1125
1286
|
value: true
|
|
1126
1287
|
});
|
|
1127
1288
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1128
1289
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1290
|
+
|
|
1129
1291
|
var T = __webpack_require__(0);
|
|
1292
|
+
|
|
1130
1293
|
var lodash_1 = __webpack_require__(3);
|
|
1131
|
-
|
|
1132
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1294
|
+
|
|
1295
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1296
|
+
|
|
1297
|
+
|
|
1133
1298
|
exports.INITIAL_WIDTH = 250;
|
|
1134
1299
|
exports.INITIAL_HEIGHT = 250;
|
|
1135
1300
|
/**
|
|
1136
1301
|
* A Splunk visualization
|
|
1137
1302
|
*/
|
|
1303
|
+
|
|
1138
1304
|
var SplunkVisualization = function SplunkVisualization() {
|
|
1139
1305
|
_classCallCheck(this, SplunkVisualization);
|
|
1140
1306
|
};
|
|
1307
|
+
|
|
1141
1308
|
SplunkVisualization.propTypes = {
|
|
1142
1309
|
/**
|
|
1143
1310
|
* display mode
|
|
1144
1311
|
*/
|
|
1145
1312
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1313
|
+
|
|
1146
1314
|
/**
|
|
1147
1315
|
* width in pixel or string, defaults to 100%
|
|
1148
1316
|
*/
|
|
1149
1317
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1318
|
+
|
|
1150
1319
|
/**
|
|
1151
1320
|
* height in pixel or string
|
|
1152
1321
|
*/
|
|
1153
1322
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1323
|
+
|
|
1154
1324
|
/**
|
|
1155
1325
|
* visualization context used for dynamic option evaluation
|
|
1156
1326
|
*/
|
|
1157
1327
|
context: T.object,
|
|
1328
|
+
|
|
1158
1329
|
/**
|
|
1159
1330
|
* visualization formatting options
|
|
1160
1331
|
*/
|
|
1161
1332
|
options: T.object,
|
|
1333
|
+
|
|
1162
1334
|
/**
|
|
1163
1335
|
* A callback to update formatting options
|
|
1164
1336
|
*/
|
|
1165
1337
|
onOptionsChange: T.func,
|
|
1338
|
+
|
|
1166
1339
|
/**
|
|
1167
1340
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1168
1341
|
*/
|
|
@@ -1171,6 +1344,7 @@ SplunkVisualization.propTypes = {
|
|
|
1171
1344
|
* current request params
|
|
1172
1345
|
*/
|
|
1173
1346
|
requestParams: T.object,
|
|
1347
|
+
|
|
1174
1348
|
/**
|
|
1175
1349
|
* current dataset
|
|
1176
1350
|
*/
|
|
@@ -1178,6 +1352,7 @@ SplunkVisualization.propTypes = {
|
|
|
1178
1352
|
fields: T.array,
|
|
1179
1353
|
columns: T.array
|
|
1180
1354
|
}),
|
|
1355
|
+
|
|
1181
1356
|
/**
|
|
1182
1357
|
* error
|
|
1183
1358
|
*/
|
|
@@ -1185,29 +1360,35 @@ SplunkVisualization.propTypes = {
|
|
|
1185
1360
|
level: T.string,
|
|
1186
1361
|
message: T.string
|
|
1187
1362
|
}),
|
|
1363
|
+
|
|
1188
1364
|
/**
|
|
1189
1365
|
* meta data that came with the dataset
|
|
1190
1366
|
*/
|
|
1191
1367
|
meta: T.object
|
|
1192
1368
|
})),
|
|
1369
|
+
|
|
1193
1370
|
/**
|
|
1194
1371
|
* A callback to trigger event
|
|
1195
1372
|
*/
|
|
1196
1373
|
onEventTrigger: T.func,
|
|
1374
|
+
|
|
1197
1375
|
/**
|
|
1198
1376
|
* Inform viz if there are handlers listening to events
|
|
1199
1377
|
*/
|
|
1200
1378
|
hasEventHandlers: T.bool,
|
|
1379
|
+
|
|
1201
1380
|
/**
|
|
1202
1381
|
* A callback to communicate computed props to a consumer
|
|
1203
1382
|
*/
|
|
1204
1383
|
onComputedProps: T.func,
|
|
1384
|
+
|
|
1205
1385
|
/**
|
|
1206
1386
|
* A callback to obtain visualization api
|
|
1207
1387
|
*/
|
|
1208
1388
|
vizActionHandlerRef: T.func,
|
|
1209
1389
|
loading: T.bool,
|
|
1210
1390
|
theme: T.object,
|
|
1391
|
+
|
|
1211
1392
|
/**
|
|
1212
1393
|
* A callback to request new data with updated request params
|
|
1213
1394
|
*/
|
|
@@ -1216,6 +1397,7 @@ SplunkVisualization.propTypes = {
|
|
|
1216
1397
|
/**
|
|
1217
1398
|
*
|
|
1218
1399
|
*/
|
|
1400
|
+
|
|
1219
1401
|
SplunkVisualization.defaultProps = {
|
|
1220
1402
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1221
1403
|
width: '100%',
|
|
@@ -1243,26 +1425,29 @@ SplunkVisualization.defaultProps = {
|
|
|
1243
1425
|
exports.default = SplunkVisualization;
|
|
1244
1426
|
|
|
1245
1427
|
/***/ }),
|
|
1246
|
-
/*
|
|
1428
|
+
/* 43 */
|
|
1247
1429
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1248
1430
|
|
|
1249
1431
|
"use strict";
|
|
1250
1432
|
|
|
1251
1433
|
|
|
1252
1434
|
var _classCallCheck = __webpack_require__(9);
|
|
1435
|
+
|
|
1253
1436
|
var _createClass = __webpack_require__(18);
|
|
1437
|
+
|
|
1254
1438
|
Object.defineProperty(exports, "__esModule", {
|
|
1255
1439
|
value: true
|
|
1256
1440
|
});
|
|
1257
1441
|
exports.DefaultVizActionHandler = void 0;
|
|
1442
|
+
|
|
1258
1443
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1259
1444
|
function DefaultVizActionHandler() {
|
|
1260
1445
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
1261
1446
|
}
|
|
1447
|
+
|
|
1262
1448
|
_createClass(DefaultVizActionHandler, [{
|
|
1263
1449
|
key: "focus",
|
|
1264
|
-
value: function focus() {
|
|
1265
|
-
// noop
|
|
1450
|
+
value: function focus() {// noop
|
|
1266
1451
|
}
|
|
1267
1452
|
}, {
|
|
1268
1453
|
key: "snapshot",
|
|
@@ -1270,22 +1455,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
1270
1455
|
return null; // noop
|
|
1271
1456
|
}
|
|
1272
1457
|
}]);
|
|
1458
|
+
|
|
1273
1459
|
return DefaultVizActionHandler;
|
|
1274
1460
|
}();
|
|
1275
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1276
|
-
|
|
1277
|
-
/***/ }),
|
|
1278
|
-
/* 43 */
|
|
1279
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1280
|
-
|
|
1281
|
-
"use strict";
|
|
1282
|
-
|
|
1283
1461
|
|
|
1284
|
-
|
|
1285
|
-
value: true
|
|
1286
|
-
});
|
|
1287
|
-
exports.validSortDirs = void 0;
|
|
1288
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1462
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1289
1463
|
|
|
1290
1464
|
/***/ }),
|
|
1291
1465
|
/* 44 */
|
|
@@ -1298,7 +1472,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1298
1472
|
value: true
|
|
1299
1473
|
});
|
|
1300
1474
|
exports.useDeepMemo = void 0;
|
|
1475
|
+
|
|
1301
1476
|
var react_1 = __webpack_require__(1);
|
|
1477
|
+
|
|
1302
1478
|
var lodash_1 = __webpack_require__(3);
|
|
1303
1479
|
/**
|
|
1304
1480
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -1313,16 +1489,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
1313
1489
|
* @param fn the function to be executed and
|
|
1314
1490
|
* @param dependencies an array of dependencies
|
|
1315
1491
|
*/
|
|
1492
|
+
|
|
1493
|
+
|
|
1316
1494
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1317
1495
|
var ref = (0, react_1.useRef)();
|
|
1496
|
+
|
|
1318
1497
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1319
1498
|
ref.current = {
|
|
1320
1499
|
dependencies: dependencies,
|
|
1321
1500
|
value: fn()
|
|
1322
1501
|
};
|
|
1323
1502
|
}
|
|
1503
|
+
|
|
1324
1504
|
return ref.current.value;
|
|
1325
1505
|
};
|
|
1506
|
+
|
|
1326
1507
|
exports.useDeepMemo = useDeepMemo;
|
|
1327
1508
|
|
|
1328
1509
|
/***/ }),
|
|
@@ -1336,19 +1517,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1336
1517
|
value: true
|
|
1337
1518
|
});
|
|
1338
1519
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
1520
|
+
|
|
1339
1521
|
var React = __webpack_require__(1);
|
|
1522
|
+
|
|
1340
1523
|
var T = __webpack_require__(0);
|
|
1524
|
+
|
|
1341
1525
|
var i18n_1 = __webpack_require__(2);
|
|
1526
|
+
|
|
1342
1527
|
var Message_1 = __webpack_require__(10);
|
|
1528
|
+
|
|
1343
1529
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
1344
1530
|
/**
|
|
1345
1531
|
* @method isMissing
|
|
1346
1532
|
* @param {any} v
|
|
1347
1533
|
* @returns {boolean} true if the input value === null or undefined
|
|
1348
1534
|
*/
|
|
1535
|
+
|
|
1536
|
+
|
|
1349
1537
|
var isMissing = function isMissing(v) {
|
|
1350
1538
|
return v === null || v === undefined;
|
|
1351
1539
|
};
|
|
1540
|
+
|
|
1352
1541
|
exports.isMissing = isMissing;
|
|
1353
1542
|
/**
|
|
1354
1543
|
* @method misskingKeys
|
|
@@ -1356,11 +1545,13 @@ exports.isMissing = isMissing;
|
|
|
1356
1545
|
* @param {object} target
|
|
1357
1546
|
* @returns {string[]} the keys of missing required props
|
|
1358
1547
|
*/
|
|
1548
|
+
|
|
1359
1549
|
var missingKeys = function missingKeys(keys, target) {
|
|
1360
1550
|
return keys.filter(function (k) {
|
|
1361
1551
|
return (0, exports.isMissing)(target[k]);
|
|
1362
1552
|
});
|
|
1363
1553
|
};
|
|
1554
|
+
|
|
1364
1555
|
exports.missingKeys = missingKeys;
|
|
1365
1556
|
var propTypes = {
|
|
1366
1557
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -1374,10 +1565,11 @@ var propTypes = {
|
|
|
1374
1565
|
* @param {MissingPropsProps} props
|
|
1375
1566
|
* @returns {React.ReactElement}
|
|
1376
1567
|
*/
|
|
1568
|
+
|
|
1377
1569
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
1378
1570
|
var width = props.width,
|
|
1379
|
-
|
|
1380
|
-
|
|
1571
|
+
height = props.height,
|
|
1572
|
+
missingProps = props.missingProps;
|
|
1381
1573
|
return React.createElement(Message_1.default, {
|
|
1382
1574
|
"data-test": "message",
|
|
1383
1575
|
width: width,
|
|
@@ -1385,6 +1577,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
1385
1577
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
1386
1578
|
});
|
|
1387
1579
|
};
|
|
1580
|
+
|
|
1388
1581
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
1389
1582
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
1390
1583
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -1403,15 +1596,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
1403
1596
|
Object.defineProperty(exports, "__esModule", {
|
|
1404
1597
|
value: true
|
|
1405
1598
|
});
|
|
1599
|
+
|
|
1406
1600
|
var React = __webpack_require__(1);
|
|
1601
|
+
|
|
1407
1602
|
var styled_components_1 = __webpack_require__(4);
|
|
1603
|
+
|
|
1408
1604
|
var hocUtils_1 = __webpack_require__(15);
|
|
1605
|
+
|
|
1409
1606
|
var Cover = styled_components_1.default.div.withConfig({
|
|
1410
1607
|
displayName: "withEditModeCover__Cover",
|
|
1411
1608
|
componentId: "sc-1gsbnxb-0"
|
|
1412
1609
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
1413
1610
|
var Blocker = styled_components_1.default.div.attrs({
|
|
1414
|
-
'data-splunk-visualization-version': "26.
|
|
1611
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
1415
1612
|
}).withConfig({
|
|
1416
1613
|
displayName: "withEditModeCover__Blocker",
|
|
1417
1614
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -1422,6 +1619,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
1422
1619
|
* @param {ExtendedDashViz} Visualization
|
|
1423
1620
|
* @returns {ExtendedDashViz} Wrapper
|
|
1424
1621
|
*/
|
|
1622
|
+
|
|
1425
1623
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
1426
1624
|
var Wrapper = function Wrapper(props) {
|
|
1427
1625
|
var mode = props.mode;
|
|
@@ -1430,12 +1628,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
1430
1628
|
"data-test": "edit-mode-cover"
|
|
1431
1629
|
}));
|
|
1432
1630
|
};
|
|
1631
|
+
|
|
1433
1632
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1434
1633
|
Wrapper: Wrapper,
|
|
1435
1634
|
Visualization: Visualization
|
|
1436
1635
|
});
|
|
1437
1636
|
return Wrapper;
|
|
1438
1637
|
};
|
|
1638
|
+
|
|
1439
1639
|
exports.default = withEditModeCover;
|
|
1440
1640
|
|
|
1441
1641
|
/***/ }),
|
|
@@ -1448,27 +1648,37 @@ exports.default = withEditModeCover;
|
|
|
1448
1648
|
Object.defineProperty(exports, "__esModule", {
|
|
1449
1649
|
value: true
|
|
1450
1650
|
});
|
|
1651
|
+
|
|
1451
1652
|
var React = __webpack_require__(1);
|
|
1653
|
+
|
|
1452
1654
|
var colorUtils_1 = __webpack_require__(12);
|
|
1655
|
+
|
|
1453
1656
|
var variables_1 = __webpack_require__(11);
|
|
1657
|
+
|
|
1454
1658
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
1659
|
+
|
|
1455
1660
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1661
|
+
|
|
1456
1662
|
var hocUtils_1 = __webpack_require__(15);
|
|
1663
|
+
|
|
1457
1664
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
1458
1665
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
1459
1666
|
var config = Visualization.config;
|
|
1460
1667
|
var themes = config.themes;
|
|
1668
|
+
|
|
1461
1669
|
var Wrapper = function Wrapper(props) {
|
|
1462
1670
|
var _a, _b;
|
|
1671
|
+
|
|
1463
1672
|
var dataSources = props.dataSources,
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1673
|
+
loading = props.loading,
|
|
1674
|
+
options = props.options,
|
|
1675
|
+
height = props.height,
|
|
1676
|
+
width = props.width;
|
|
1468
1677
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
1469
1678
|
var bgColorFromTheme = (0, colorUtils_1.isColor)(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
|
|
1470
1679
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
1471
1680
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
1681
|
+
|
|
1472
1682
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
1473
1683
|
return React.createElement(IconPlaceholder_1.default, {
|
|
1474
1684
|
"data-test": "icon-placeholder",
|
|
@@ -1479,14 +1689,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
1479
1689
|
iconColor: iconColor
|
|
1480
1690
|
});
|
|
1481
1691
|
}
|
|
1692
|
+
|
|
1482
1693
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
1483
1694
|
};
|
|
1695
|
+
|
|
1484
1696
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1485
1697
|
Wrapper: Wrapper,
|
|
1486
1698
|
Visualization: Visualization
|
|
1487
1699
|
});
|
|
1488
1700
|
return Wrapper;
|
|
1489
1701
|
};
|
|
1702
|
+
|
|
1490
1703
|
exports.default = withPlaceholder;
|
|
1491
1704
|
|
|
1492
1705
|
/***/ }),
|
|
@@ -1585,7 +1798,8 @@ VizStyleWrapper.displayName = 'VizStyleWrapper';
|
|
|
1585
1798
|
/* 87 */,
|
|
1586
1799
|
/* 88 */,
|
|
1587
1800
|
/* 89 */,
|
|
1588
|
-
/* 90
|
|
1801
|
+
/* 90 */,
|
|
1802
|
+
/* 91 */
|
|
1589
1803
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1590
1804
|
|
|
1591
1805
|
"use strict";
|
|
@@ -1608,7 +1822,6 @@ var StaticBackgroundColorEditor = {
|
|
|
1608
1822
|
/* harmony default export */ __webpack_exports__["default"] = (StaticBackgroundColorEditor);
|
|
1609
1823
|
|
|
1610
1824
|
/***/ }),
|
|
1611
|
-
/* 91 */,
|
|
1612
1825
|
/* 92 */,
|
|
1613
1826
|
/* 93 */,
|
|
1614
1827
|
/* 94 */,
|
|
@@ -1671,17 +1884,27 @@ var StaticBackgroundColorEditor = {
|
|
|
1671
1884
|
|
|
1672
1885
|
|
|
1673
1886
|
var _classCallCheck = __webpack_require__(9);
|
|
1887
|
+
|
|
1674
1888
|
var _createClass = __webpack_require__(18);
|
|
1889
|
+
|
|
1675
1890
|
var _inherits = __webpack_require__(71);
|
|
1891
|
+
|
|
1676
1892
|
var _possibleConstructorReturn = __webpack_require__(72);
|
|
1893
|
+
|
|
1677
1894
|
var _getPrototypeOf = __webpack_require__(63);
|
|
1895
|
+
|
|
1678
1896
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
1897
|
+
|
|
1679
1898
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
1899
|
+
|
|
1680
1900
|
Object.defineProperty(exports, "__esModule", {
|
|
1681
1901
|
value: true
|
|
1682
1902
|
});
|
|
1903
|
+
|
|
1683
1904
|
var React = __webpack_require__(1);
|
|
1905
|
+
|
|
1684
1906
|
var lodash_1 = __webpack_require__(3);
|
|
1907
|
+
|
|
1685
1908
|
var SvgMutator_1 = __webpack_require__(190);
|
|
1686
1909
|
/**
|
|
1687
1910
|
* This react component simply take an SVG document, and mutates it by applying data to the document according to
|
|
@@ -1691,13 +1914,20 @@ var SvgMutator_1 = __webpack_require__(190);
|
|
|
1691
1914
|
* The first mutation has $i=0, the second has $1=1, the third has $i=2.
|
|
1692
1915
|
* This allows for JEXL expressions to access the data in a row-like fashion via expressions such as 'foo[$i] + bar[$i]' which will return "ax" for the first row mutation, "by" for the second, and "cz" for the third mutation
|
|
1693
1916
|
*/
|
|
1917
|
+
|
|
1918
|
+
|
|
1694
1919
|
var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
|
|
1695
1920
|
_inherits(SvgChoroplethDynamic, _React$Component);
|
|
1921
|
+
|
|
1696
1922
|
var _super = _createSuper(SvgChoroplethDynamic);
|
|
1923
|
+
|
|
1697
1924
|
function SvgChoroplethDynamic(props, context) {
|
|
1698
1925
|
var _this;
|
|
1926
|
+
|
|
1699
1927
|
_classCallCheck(this, SvgChoroplethDynamic);
|
|
1928
|
+
|
|
1700
1929
|
_this = _super.call(this, props, context);
|
|
1930
|
+
|
|
1701
1931
|
_this.handleAreaClick = function (ev) {
|
|
1702
1932
|
if (typeof _this.props.onAreaClick === 'function') {
|
|
1703
1933
|
_this.props.onAreaClick(Object.assign(Object.assign({}, ev), {
|
|
@@ -1705,21 +1935,25 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
|
|
|
1705
1935
|
}));
|
|
1706
1936
|
}
|
|
1707
1937
|
};
|
|
1938
|
+
|
|
1708
1939
|
_this.areaClickRef = function (node) {
|
|
1709
1940
|
if (!node) {
|
|
1710
1941
|
return;
|
|
1711
1942
|
}
|
|
1943
|
+
|
|
1712
1944
|
node.addEventListener('areaClick', function (ev) {
|
|
1713
1945
|
return _this.handleAreaClick(ev);
|
|
1714
1946
|
});
|
|
1715
1947
|
_this.node = node;
|
|
1716
1948
|
};
|
|
1949
|
+
|
|
1717
1950
|
_this.state = {
|
|
1718
1951
|
svgNode: null
|
|
1719
1952
|
};
|
|
1720
1953
|
_this.node = null;
|
|
1721
1954
|
return _this;
|
|
1722
1955
|
}
|
|
1956
|
+
|
|
1723
1957
|
_createClass(SvgChoroplethDynamic, [{
|
|
1724
1958
|
key: "componentDidMount",
|
|
1725
1959
|
value: function componentDidMount() {
|
|
@@ -1728,8 +1962,7 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
|
|
|
1728
1962
|
}, {
|
|
1729
1963
|
key: "shouldComponentUpdate",
|
|
1730
1964
|
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
1731
|
-
return nextProps.svg !== this.props.svg || !(0, lodash_1.isEqual)(nextProps.data, this.props.data) ||
|
|
1732
|
-
// must do deep equal on data because when no data is passed we do 'let data = { featureIDs: [], values: [], fill: [] };' in ChoroplethSVG which looks to react like different data every time
|
|
1965
|
+
return nextProps.svg !== this.props.svg || !(0, lodash_1.isEqual)(nextProps.data, this.props.data) || // must do deep equal on data because when no data is passed we do 'let data = { featureIDs: [], values: [], fill: [] };' in ChoroplethSVG which looks to react like different data every time
|
|
1733
1966
|
nextState.svgNode !== this.state.svgNode || !(0, lodash_1.isEqual)(nextProps.width, this.props.width) || !(0, lodash_1.isEqual)(nextProps.height, this.props.height);
|
|
1734
1967
|
}
|
|
1735
1968
|
}, {
|
|
@@ -1750,8 +1983,10 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
|
|
|
1750
1983
|
key: "mutate",
|
|
1751
1984
|
value: function mutate() {
|
|
1752
1985
|
var svg = this.props.svg;
|
|
1986
|
+
|
|
1753
1987
|
if (svg) {
|
|
1754
1988
|
var m = new SvgMutator_1.SvgMutator(this.props);
|
|
1989
|
+
|
|
1755
1990
|
try {
|
|
1756
1991
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
1757
1992
|
this.setState({
|
|
@@ -1766,11 +2001,12 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
|
|
|
1766
2001
|
key: "render",
|
|
1767
2002
|
value: function render() {
|
|
1768
2003
|
var _this$props = this.props,
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
2004
|
+
_this$props$width = _this$props.width,
|
|
2005
|
+
width = _this$props$width === void 0 ? '100%' : _this$props$width,
|
|
2006
|
+
_this$props$height = _this$props.height,
|
|
2007
|
+
height = _this$props$height === void 0 ? '100%' : _this$props$height;
|
|
1773
2008
|
var svgNode = this.state.svgNode;
|
|
2009
|
+
|
|
1774
2010
|
if (svgNode) {
|
|
1775
2011
|
return React.createElement("div", {
|
|
1776
2012
|
style: {
|
|
@@ -1780,11 +2016,14 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
|
|
|
1780
2016
|
ref: this.areaClickRef
|
|
1781
2017
|
}, svgNode);
|
|
1782
2018
|
}
|
|
2019
|
+
|
|
1783
2020
|
return null;
|
|
1784
2021
|
}
|
|
1785
2022
|
}]);
|
|
2023
|
+
|
|
1786
2024
|
return SvgChoroplethDynamic;
|
|
1787
2025
|
}(React.Component);
|
|
2026
|
+
|
|
1788
2027
|
exports.default = SvgChoroplethDynamic;
|
|
1789
2028
|
SvgChoroplethDynamic.defaultProps = {
|
|
1790
2029
|
svg: ''
|
|
@@ -1836,35 +2075,53 @@ SvgChoroplethDynamic.defaultProps = {
|
|
|
1836
2075
|
|
|
1837
2076
|
var __rest = this && this.__rest || function (s, e) {
|
|
1838
2077
|
var t = {};
|
|
2078
|
+
|
|
1839
2079
|
for (var p in s) {
|
|
1840
2080
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1841
2081
|
}
|
|
2082
|
+
|
|
1842
2083
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1843
2084
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1844
2085
|
}
|
|
1845
2086
|
return t;
|
|
1846
2087
|
};
|
|
2088
|
+
|
|
1847
2089
|
Object.defineProperty(exports, "__esModule", {
|
|
1848
2090
|
value: true
|
|
1849
2091
|
});
|
|
1850
2092
|
exports.useIconPlaceholder = exports.createProtocolHandlers = exports.PureSvgChoroplethDynamic = exports.PureChoroplethSvg = exports.config = void 0;
|
|
2093
|
+
|
|
1851
2094
|
var React = __webpack_require__(1);
|
|
2095
|
+
|
|
1852
2096
|
var T = __webpack_require__(0);
|
|
2097
|
+
|
|
1853
2098
|
var lodash_1 = __webpack_require__(3);
|
|
2099
|
+
|
|
1854
2100
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
2101
|
+
|
|
1855
2102
|
var ImageContext_1 = __webpack_require__(186);
|
|
2103
|
+
|
|
1856
2104
|
var FileDownloader_1 = __webpack_require__(187);
|
|
2105
|
+
|
|
1857
2106
|
var Downloader_1 = __webpack_require__(188);
|
|
1858
|
-
|
|
2107
|
+
|
|
2108
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
2109
|
+
|
|
1859
2110
|
var PureChoroplethSvg_1 = __webpack_require__(189);
|
|
2111
|
+
|
|
1860
2112
|
var SvgChoroplethDynamic_1 = __webpack_require__(147);
|
|
2113
|
+
|
|
1861
2114
|
var config_1 = __webpack_require__(194);
|
|
2115
|
+
|
|
1862
2116
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
2117
|
+
|
|
1863
2118
|
var urlUtils_1 = __webpack_require__(195);
|
|
2119
|
+
|
|
1864
2120
|
var ErrorMessage_1 = __webpack_require__(196);
|
|
2121
|
+
|
|
1865
2122
|
exports.config = config_1.default;
|
|
1866
|
-
exports.PureChoroplethSvg = PureChoroplethSvg_1.default;
|
|
1867
|
-
|
|
2123
|
+
exports.PureChoroplethSvg = PureChoroplethSvg_1.default; // todo: need remove when deleting @splunk/react-visualizations package
|
|
2124
|
+
|
|
1868
2125
|
exports.PureSvgChoroplethDynamic = SvgChoroplethDynamic_1.default;
|
|
1869
2126
|
/**
|
|
1870
2127
|
* This function generates the protocol handlers
|
|
@@ -1874,44 +2131,56 @@ exports.PureSvgChoroplethDynamic = SvgChoroplethDynamic_1.default;
|
|
|
1874
2131
|
* @param {ImageContext} imageContext
|
|
1875
2132
|
* @returns {object}
|
|
1876
2133
|
*/
|
|
2134
|
+
|
|
1877
2135
|
var createProtocolHandlers = function createProtocolHandlers() {
|
|
1878
2136
|
var featureFlagContext = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1879
2137
|
var imageContext = arguments.length > 1 ? arguments[1] : undefined;
|
|
1880
2138
|
var handlers = {
|
|
1881
2139
|
data: new Downloader_1.URLDownloader()
|
|
1882
2140
|
};
|
|
2141
|
+
|
|
1883
2142
|
if (imageContext) {
|
|
1884
2143
|
imageContext.listProviders().forEach(function (_ref) {
|
|
1885
2144
|
var type = _ref.type;
|
|
1886
2145
|
handlers[type] = new Downloader_1.ImageRegistryFetcher(imageContext);
|
|
1887
2146
|
});
|
|
1888
2147
|
}
|
|
2148
|
+
|
|
1889
2149
|
var enableSvgHttpDownloader = featureFlagContext.enableSvgHttpDownloader;
|
|
2150
|
+
|
|
1890
2151
|
if (enableSvgHttpDownloader) {
|
|
1891
2152
|
handlers.http = new Downloader_1.URLDownloader();
|
|
1892
2153
|
handlers.https = new Downloader_1.URLDownloader();
|
|
1893
2154
|
}
|
|
2155
|
+
|
|
1894
2156
|
return handlers;
|
|
1895
2157
|
};
|
|
2158
|
+
|
|
1896
2159
|
exports.createProtocolHandlers = createProtocolHandlers;
|
|
2160
|
+
|
|
1897
2161
|
var ChoroplethSvg = function ChoroplethSvg(_a) {
|
|
1898
2162
|
var props = __rest(_a, []);
|
|
2163
|
+
|
|
1899
2164
|
var svg = props.svg;
|
|
1900
2165
|
var url = React.useMemo(function () {
|
|
1901
2166
|
if (!svg) {
|
|
1902
2167
|
return svg;
|
|
1903
2168
|
}
|
|
2169
|
+
|
|
1904
2170
|
var trimmed = svg.trim();
|
|
2171
|
+
|
|
1905
2172
|
if ((0, urlUtils_1.isValidUrl)(trimmed)) {
|
|
1906
2173
|
return trimmed;
|
|
1907
2174
|
}
|
|
2175
|
+
|
|
1908
2176
|
if (/.*<svg.*/i.test(trimmed)) {
|
|
1909
2177
|
return trimmed;
|
|
1910
2178
|
}
|
|
2179
|
+
|
|
1911
2180
|
return "".concat(window.location.origin, "/").concat(trimmed);
|
|
1912
|
-
}, [svg]);
|
|
1913
|
-
// note that the FileDownloader will just immediately pass through literal (non-url) content in the case that
|
|
2181
|
+
}, [svg]); // note that the FileDownloader will just immediately pass through literal (non-url) content in the case that
|
|
1914
2182
|
// the svg argument is not a url.
|
|
2183
|
+
|
|
1915
2184
|
return React.createElement(ImageContext_1.default.Consumer, null, function (imageContext) {
|
|
1916
2185
|
return React.createElement(FeatureFlagContext_1.default.Consumer, null, function (featureFlagContext) {
|
|
1917
2186
|
return React.createElement(FileDownloader_1.FileDownloader, {
|
|
@@ -1932,22 +2201,25 @@ var ChoroplethSvg = function ChoroplethSvg(_a) {
|
|
|
1932
2201
|
});
|
|
1933
2202
|
});
|
|
1934
2203
|
};
|
|
2204
|
+
|
|
1935
2205
|
ChoroplethSvg.propTypes = {
|
|
1936
2206
|
svg: T.string
|
|
1937
2207
|
};
|
|
2208
|
+
|
|
1938
2209
|
function useIconPlaceholder(dataSources, loading, options) {
|
|
1939
2210
|
var svg = (0, lodash_1.get)(options, 'svg');
|
|
1940
2211
|
var missingData = (0, IconPlaceholder_1.shouldShowIconPlaceholder)(dataSources, loading);
|
|
1941
2212
|
return missingData && !svg;
|
|
1942
2213
|
}
|
|
2214
|
+
|
|
1943
2215
|
exports.useIconPlaceholder = useIconPlaceholder;
|
|
1944
2216
|
var platformViz = (0, withDashboardViz_1.default)({
|
|
1945
2217
|
ReactViz: ChoroplethSvg,
|
|
1946
2218
|
vizConfig: config_1.default,
|
|
1947
2219
|
useIconPlaceholder: useIconPlaceholder
|
|
1948
|
-
});
|
|
1949
|
-
// (platformViz as any).defaultProps.width = '100%';
|
|
2220
|
+
}); // (platformViz as any).defaultProps.width = '100%';
|
|
1950
2221
|
// (platformViz as any).defaultProps.height = '100%';
|
|
2222
|
+
|
|
1951
2223
|
exports.default = platformViz;
|
|
1952
2224
|
|
|
1953
2225
|
/***/ }),
|
|
@@ -1977,25 +2249,36 @@ module.exports = require("@splunk/visualizations-shared/Downloader");
|
|
|
1977
2249
|
|
|
1978
2250
|
var __rest = this && this.__rest || function (s, e) {
|
|
1979
2251
|
var t = {};
|
|
2252
|
+
|
|
1980
2253
|
for (var p in s) {
|
|
1981
2254
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1982
2255
|
}
|
|
2256
|
+
|
|
1983
2257
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1984
2258
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1985
2259
|
}
|
|
1986
2260
|
return t;
|
|
1987
2261
|
};
|
|
2262
|
+
|
|
1988
2263
|
Object.defineProperty(exports, "__esModule", {
|
|
1989
2264
|
value: true
|
|
1990
2265
|
});
|
|
1991
2266
|
exports.computeSvgDynamicProps = void 0;
|
|
2267
|
+
|
|
1992
2268
|
var React = __webpack_require__(1);
|
|
2269
|
+
|
|
1993
2270
|
var styled_components_1 = __webpack_require__(4);
|
|
2271
|
+
|
|
1994
2272
|
var lodash_1 = __webpack_require__(3);
|
|
2273
|
+
|
|
1995
2274
|
var style_1 = __webpack_require__(14);
|
|
2275
|
+
|
|
1996
2276
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
2277
|
+
|
|
1997
2278
|
var SvgChoroplethDynamic_1 = __webpack_require__(147);
|
|
2279
|
+
|
|
1998
2280
|
var VizStyleWrapper_1 = __webpack_require__(73);
|
|
2281
|
+
|
|
1999
2282
|
var Container = styled_components_1.default.div.withConfig({
|
|
2000
2283
|
displayName: "PureChoroplethSvg__Container",
|
|
2001
2284
|
componentId: "m24jrf-0"
|
|
@@ -2006,14 +2289,16 @@ var ChoroplethSvgWrapper = styled_components_1.default.div.withConfig({
|
|
|
2006
2289
|
displayName: "PureChoroplethSvg__ChoroplethSvgWrapper",
|
|
2007
2290
|
componentId: "m24jrf-1"
|
|
2008
2291
|
})(["min-height:0px;flex:1;position:relative;"]);
|
|
2292
|
+
|
|
2009
2293
|
var computeSvgDynamicProps = function computeSvgDynamicProps(_a) {
|
|
2010
2294
|
var props = __rest(_a, []);
|
|
2295
|
+
|
|
2011
2296
|
var data = {
|
|
2012
2297
|
featureIDs: props.areaIds || [],
|
|
2013
2298
|
values: props.areaValues || [],
|
|
2014
2299
|
fill: props.areaColors || []
|
|
2015
|
-
};
|
|
2016
|
-
|
|
2300
|
+
}; // current implementation is limited to only setting the fill attribute
|
|
2301
|
+
|
|
2017
2302
|
var dataBinding = [{
|
|
2018
2303
|
xPath: "'//*[@id=\"'+featureIDs[$i]+'\"]/@fill'",
|
|
2019
2304
|
value: 'fill[$i]'
|
|
@@ -2023,15 +2308,19 @@ var computeSvgDynamicProps = function computeSvgDynamicProps(_a) {
|
|
|
2023
2308
|
dataBinding: dataBinding
|
|
2024
2309
|
});
|
|
2025
2310
|
};
|
|
2311
|
+
|
|
2026
2312
|
exports.computeSvgDynamicProps = computeSvgDynamicProps;
|
|
2313
|
+
|
|
2027
2314
|
var PureChoroplethSvg = function PureChoroplethSvg(_a) {
|
|
2028
2315
|
var props = __rest(_a, []);
|
|
2316
|
+
|
|
2029
2317
|
var width = props.width,
|
|
2030
|
-
|
|
2031
|
-
|
|
2318
|
+
height = props.height,
|
|
2319
|
+
backgroundColor = props.backgroundColor;
|
|
2320
|
+
|
|
2032
2321
|
var renderVisualization = function renderVisualization(_ref) {
|
|
2033
2322
|
var containerWidth = _ref.width,
|
|
2034
|
-
|
|
2323
|
+
containerHeight = _ref.height;
|
|
2035
2324
|
var svgProps = (0, exports.computeSvgDynamicProps)(Object.assign(Object.assign({}, props), {
|
|
2036
2325
|
width: containerWidth,
|
|
2037
2326
|
height: containerHeight
|
|
@@ -2041,6 +2330,7 @@ var PureChoroplethSvg = function PureChoroplethSvg(_a) {
|
|
|
2041
2330
|
dataTestKey: "ChoroplethSvgWrapper"
|
|
2042
2331
|
}, React.createElement(SvgChoroplethDynamic_1.default, Object.assign({}, svgProps)));
|
|
2043
2332
|
};
|
|
2333
|
+
|
|
2044
2334
|
return React.createElement(Container, {
|
|
2045
2335
|
width: width,
|
|
2046
2336
|
height: height
|
|
@@ -2048,6 +2338,7 @@ var PureChoroplethSvg = function PureChoroplethSvg(_a) {
|
|
|
2048
2338
|
return renderVisualization(containerDimension);
|
|
2049
2339
|
})));
|
|
2050
2340
|
};
|
|
2341
|
+
|
|
2051
2342
|
PureChoroplethSvg.defaultProps = {
|
|
2052
2343
|
width: '100%',
|
|
2053
2344
|
height: 250,
|
|
@@ -2063,20 +2354,28 @@ exports.default = (0, styled_components_1.withTheme)(PureChoroplethSvg);
|
|
|
2063
2354
|
|
|
2064
2355
|
|
|
2065
2356
|
var _classCallCheck = __webpack_require__(9);
|
|
2357
|
+
|
|
2066
2358
|
var _createClass = __webpack_require__(18);
|
|
2359
|
+
|
|
2067
2360
|
Object.defineProperty(exports, "__esModule", {
|
|
2068
2361
|
value: true
|
|
2069
2362
|
});
|
|
2070
2363
|
exports.SvgMutator = exports.ERROR_NON_ATTRIBUTE_MUTATION = void 0;
|
|
2071
2364
|
/* eslint-disable no-param-reassign */
|
|
2365
|
+
|
|
2072
2366
|
var React = __webpack_require__(1);
|
|
2367
|
+
|
|
2073
2368
|
var XPath = __webpack_require__(191);
|
|
2369
|
+
|
|
2074
2370
|
var xmldom_1 = __webpack_require__(192);
|
|
2371
|
+
|
|
2075
2372
|
var jexl = __webpack_require__(193);
|
|
2076
2373
|
/**
|
|
2077
2374
|
* An error message indicating that a mutation has attempted to target anything other than SVG attribute(s)
|
|
2078
2375
|
* @type {string}
|
|
2079
2376
|
*/
|
|
2377
|
+
|
|
2378
|
+
|
|
2080
2379
|
exports.ERROR_NON_ATTRIBUTE_MUTATION = 'mutations only allowed on attribute nodes';
|
|
2081
2380
|
/**
|
|
2082
2381
|
* This class takes columnar data and mutates an SVG document by applying rules defined in DataBindings. This class
|
|
@@ -2084,6 +2383,7 @@ exports.ERROR_NON_ATTRIBUTE_MUTATION = 'mutations only allowed on attribute node
|
|
|
2084
2383
|
* animation delays. This class parses an SVG document into an internal dom (NOT THE BROWSER DOM), which is then
|
|
2085
2384
|
* converted into a ReactNode.
|
|
2086
2385
|
*/
|
|
2386
|
+
|
|
2087
2387
|
var SvgMutator = /*#__PURE__*/function () {
|
|
2088
2388
|
/**
|
|
2089
2389
|
* parses the svg and stores the parsed Document in a local field. Keeps a copy of the props.
|
|
@@ -2091,6 +2391,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2091
2391
|
*/
|
|
2092
2392
|
function SvgMutator(props) {
|
|
2093
2393
|
_classCallCheck(this, SvgMutator);
|
|
2394
|
+
|
|
2094
2395
|
var svg = props.svg;
|
|
2095
2396
|
this.svgDoc = new xmldom_1.DOMParser().parseFromString(svg);
|
|
2096
2397
|
this.props = Object.assign({}, props);
|
|
@@ -2102,6 +2403,8 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2102
2403
|
* @param {(node: Node) => void} refCallback
|
|
2103
2404
|
* @returns {React.ReactNode}
|
|
2104
2405
|
*/
|
|
2406
|
+
|
|
2407
|
+
|
|
2105
2408
|
_createClass(SvgMutator, [{
|
|
2106
2409
|
key: "mutate",
|
|
2107
2410
|
value: function mutate() {
|
|
@@ -2118,6 +2421,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2118
2421
|
* @param {number} i
|
|
2119
2422
|
* @param {Node} target
|
|
2120
2423
|
*/
|
|
2424
|
+
|
|
2121
2425
|
}, {
|
|
2122
2426
|
key: "applyMutations",
|
|
2123
2427
|
value:
|
|
@@ -2128,22 +2432,26 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2128
2432
|
*/
|
|
2129
2433
|
function applyMutations(prototypicalNode) {
|
|
2130
2434
|
var _this$props = this.props,
|
|
2131
|
-
|
|
2132
|
-
|
|
2435
|
+
dataBinding = _this$props.dataBinding,
|
|
2436
|
+
data = _this$props.data;
|
|
2133
2437
|
var target = prototypicalNode.cloneNode(true);
|
|
2438
|
+
|
|
2134
2439
|
if (data) {
|
|
2135
2440
|
var anyKey = Object.keys(data)[0];
|
|
2136
2441
|
var len = data[anyKey].length;
|
|
2442
|
+
|
|
2137
2443
|
var _loop = function _loop(i) {
|
|
2138
2444
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
2139
2445
|
dataBinding.forEach(function (db) {
|
|
2140
2446
|
return SvgMutator.applyMutation(db, data, i, target);
|
|
2141
2447
|
});
|
|
2142
2448
|
};
|
|
2449
|
+
|
|
2143
2450
|
for (var i = 0; i < len; i += 1) {
|
|
2144
2451
|
_loop(i);
|
|
2145
2452
|
}
|
|
2146
2453
|
}
|
|
2454
|
+
|
|
2147
2455
|
return target;
|
|
2148
2456
|
}
|
|
2149
2457
|
/**
|
|
@@ -2154,26 +2462,29 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2154
2462
|
* @param height
|
|
2155
2463
|
* @returns {React.ReactElement}
|
|
2156
2464
|
*/
|
|
2465
|
+
|
|
2157
2466
|
}], [{
|
|
2158
2467
|
key: "applyMutation",
|
|
2159
2468
|
value: function applyMutation(dataBinding, data, i, target) {
|
|
2160
2469
|
var xPath = dataBinding.xPath;
|
|
2470
|
+
|
|
2161
2471
|
if (!xPath) {
|
|
2162
2472
|
throw new Error('xPath property not defined');
|
|
2163
|
-
}
|
|
2164
|
-
|
|
2473
|
+
} // use xpath expression to seek out places to make changes
|
|
2474
|
+
|
|
2475
|
+
|
|
2165
2476
|
var hits = SvgMutator.evaluateXPath(xPath, target, Object.assign(Object.assign({}, data), {
|
|
2166
2477
|
$i: i
|
|
2167
2478
|
}));
|
|
2168
2479
|
var hit;
|
|
2480
|
+
|
|
2169
2481
|
for (hit = hits.iterateNext(); hit; hit = hits.iterateNext()) {
|
|
2170
2482
|
SvgMutator.mutateNode(hit, dataBinding, data, i);
|
|
2171
2483
|
}
|
|
2172
2484
|
}
|
|
2173
2485
|
}, {
|
|
2174
2486
|
key: "getSandboxedIframe",
|
|
2175
|
-
value: function getSandboxedIframe(refCallback,
|
|
2176
|
-
// fixme get rid of?
|
|
2487
|
+
value: function getSandboxedIframe(refCallback, // fixme get rid of?
|
|
2177
2488
|
node, currentProps) {
|
|
2178
2489
|
var svgNode = SvgMutator.getSvgElementFromDoc(node);
|
|
2179
2490
|
svgNode.setAttribute('width', currentProps.width || '100%');
|
|
@@ -2187,6 +2498,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2187
2498
|
* Alternatively, Chrome has a higher size limit for Blobs (500Mib? - https://source.chromium.org/chromium/chromium/src/+/main:storage/browser/blob/README.md)
|
|
2188
2499
|
* and we can create Blob URLs via URL.createObjectURL(), using the URL API together with blobs via the File API
|
|
2189
2500
|
*/
|
|
2501
|
+
|
|
2190
2502
|
var blob = new Blob([html], {
|
|
2191
2503
|
type: 'text/html'
|
|
2192
2504
|
});
|
|
@@ -2201,8 +2513,8 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2201
2513
|
padding: '0',
|
|
2202
2514
|
pointerEvents: 'auto',
|
|
2203
2515
|
colorScheme: 'light' // iframe adds a white background when using 'dark' theme, hacking to set scheme to 'light'
|
|
2204
|
-
},
|
|
2205
2516
|
|
|
2517
|
+
},
|
|
2206
2518
|
frameBorder: 0,
|
|
2207
2519
|
sandbox: 'allow-scripts',
|
|
2208
2520
|
id: 'svgChoroplethIframe'
|
|
@@ -2222,23 +2534,28 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2222
2534
|
if (!div) {
|
|
2223
2535
|
// called on unmount
|
|
2224
2536
|
SvgMutator.removeIframeEventListener(div, messageListener, intervalID, refCallback);
|
|
2537
|
+
|
|
2225
2538
|
if (blobURL) {
|
|
2226
2539
|
URL.revokeObjectURL(blobURL);
|
|
2227
2540
|
}
|
|
2541
|
+
|
|
2228
2542
|
return;
|
|
2229
2543
|
}
|
|
2544
|
+
|
|
2230
2545
|
messageListener = SvgMutator.createIframeMessageListener(NONCE, intervalID, div);
|
|
2231
2546
|
window.addEventListener('message', messageListener);
|
|
2547
|
+
|
|
2232
2548
|
function sendSetupMessage() {
|
|
2233
|
-
var svgIframe = div.querySelector('#svgChoroplethIframe');
|
|
2234
|
-
|
|
2549
|
+
var svgIframe = div.querySelector('#svgChoroplethIframe'); // send single message to iframe content so that content can "learn" the targetOrigin for it's reply messages
|
|
2550
|
+
|
|
2235
2551
|
if (svgIframe) {
|
|
2236
2552
|
svgIframe.contentWindow.postMessage({
|
|
2237
2553
|
parentIdentity: PARENT_ID
|
|
2238
2554
|
}, '*');
|
|
2239
2555
|
}
|
|
2240
|
-
}
|
|
2241
|
-
|
|
2556
|
+
} // continuously send an initialization message to the iframe until it ack's back
|
|
2557
|
+
|
|
2558
|
+
|
|
2242
2559
|
intervalID = setInterval(sendSetupMessage, 500);
|
|
2243
2560
|
refCallback(div);
|
|
2244
2561
|
}
|
|
@@ -2250,18 +2567,21 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2250
2567
|
value: function getSvgElementFromDoc(node) {
|
|
2251
2568
|
if (node.nodeName === '#document') {
|
|
2252
2569
|
var kids = node.childNodes;
|
|
2570
|
+
|
|
2253
2571
|
for (var i = 0; i < kids.length; i += 1) {
|
|
2254
|
-
node = kids.item(i);
|
|
2255
|
-
// re https://jira.splunk.com/browse/SPL-188348 DOCTYPE nodes that we want to skip would have
|
|
2572
|
+
node = kids.item(i); // re https://jira.splunk.com/browse/SPL-188348 DOCTYPE nodes that we want to skip would have
|
|
2256
2573
|
// nodeName 'svg', but only the actualy <svg> element has nodeType 1 (ELEMENT_NODE)
|
|
2574
|
+
|
|
2257
2575
|
if (node.nodeName === 'svg' && node.nodeType && node.nodeType === 1) {
|
|
2258
2576
|
break;
|
|
2259
2577
|
}
|
|
2260
2578
|
}
|
|
2261
2579
|
}
|
|
2580
|
+
|
|
2262
2581
|
if (node.nodeName !== 'svg') {
|
|
2263
2582
|
throw new Error("Could not find an <svg> element");
|
|
2264
2583
|
}
|
|
2584
|
+
|
|
2265
2585
|
return node;
|
|
2266
2586
|
}
|
|
2267
2587
|
/**
|
|
@@ -2272,6 +2592,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2272
2592
|
* @param {object} context
|
|
2273
2593
|
* @returns {XPathResult}
|
|
2274
2594
|
*/
|
|
2595
|
+
|
|
2275
2596
|
}, {
|
|
2276
2597
|
key: "evaluateXPath",
|
|
2277
2598
|
value: function evaluateXPath(xpathExpr, doc) {
|
|
@@ -2288,12 +2609,15 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2288
2609
|
key: "getTitle",
|
|
2289
2610
|
value: function getTitle(data, i) {
|
|
2290
2611
|
var title = '';
|
|
2612
|
+
|
|
2291
2613
|
if (data.featureIDs && data.featureIDs[i]) {
|
|
2292
2614
|
title += "name: ".concat(data.featureIDs[i]);
|
|
2293
2615
|
}
|
|
2616
|
+
|
|
2294
2617
|
if (data.values && data.values[i] !== undefined) {
|
|
2295
2618
|
title += "\nvalue: ".concat(data.values[i]);
|
|
2296
2619
|
}
|
|
2620
|
+
|
|
2297
2621
|
return title;
|
|
2298
2622
|
}
|
|
2299
2623
|
/**
|
|
@@ -2308,6 +2632,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2308
2632
|
* @param {number} i
|
|
2309
2633
|
* @returns {any}
|
|
2310
2634
|
*/
|
|
2635
|
+
|
|
2311
2636
|
}, {
|
|
2312
2637
|
key: "mutateNode",
|
|
2313
2638
|
value: function mutateNode(n, dataBinding, data, i) {
|
|
@@ -2315,38 +2640,47 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2315
2640
|
if (n.nodeType && n.nodeType != Node.ATTRIBUTE_NODE) {
|
|
2316
2641
|
throw new Error(exports.ERROR_NON_ATTRIBUTE_MUTATION);
|
|
2317
2642
|
}
|
|
2643
|
+
|
|
2318
2644
|
var context = Object.assign(Object.assign({
|
|
2319
2645
|
$oldValue: n.nodeValue
|
|
2320
2646
|
}, data), {
|
|
2321
2647
|
$i: i
|
|
2322
2648
|
});
|
|
2323
2649
|
var computed;
|
|
2650
|
+
|
|
2324
2651
|
try {
|
|
2325
2652
|
computed = jexl.evalSync(dataBinding.value, context);
|
|
2326
2653
|
} catch (error) {
|
|
2327
2654
|
return;
|
|
2328
|
-
}
|
|
2329
|
-
|
|
2655
|
+
} // this is the actual mutation: we change the attributes value
|
|
2656
|
+
|
|
2657
|
+
|
|
2330
2658
|
n.nodeValue = computed;
|
|
2331
2659
|
n.value = computed; // So you may ask...why do we set BOTH the nodeValue and the Attr value. The nodeValue seems to be the one that "shows up" as reflecting the change. We use nodeValue down in addSubtree. Yet XMLSerializer will only see the changes from Attr.value. So what the heck, we use BOTH
|
|
2332
2660
|
// we also add data-* attributes to the node and a title that behaves like a hover
|
|
2661
|
+
|
|
2333
2662
|
var parent = n.ownerElement;
|
|
2334
2663
|
var title = SvgMutator.getTitle(data, i);
|
|
2664
|
+
|
|
2335
2665
|
if (data.featureIDs && data.featureIDs[i]) {
|
|
2336
2666
|
parent.setAttribute('data-name', data.featureIDs[i]);
|
|
2337
2667
|
}
|
|
2668
|
+
|
|
2338
2669
|
if (data.values && data.values[i] !== undefined) {
|
|
2339
2670
|
parent.setAttribute('data-value', data.values[i]);
|
|
2340
2671
|
}
|
|
2672
|
+
|
|
2341
2673
|
if (title !== '') {
|
|
2342
2674
|
var titleElem = n.ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'title');
|
|
2343
2675
|
titleElem.textContent = title;
|
|
2344
2676
|
parent.appendChild(titleElem);
|
|
2345
2677
|
}
|
|
2678
|
+
|
|
2346
2679
|
if (data.featureIDs) {
|
|
2347
2680
|
parent.setAttribute('data-name', data.featureIDs[i]);
|
|
2348
|
-
}
|
|
2349
|
-
|
|
2681
|
+
} // eslint-disable-next-line consistent-return
|
|
2682
|
+
|
|
2683
|
+
|
|
2350
2684
|
return computed; // makes this method more testable to return the updated node value, though real callers don't need to use the returned value.
|
|
2351
2685
|
}
|
|
2352
2686
|
}, {
|
|
@@ -2370,12 +2704,13 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2370
2704
|
var jsdom = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2371
2705
|
return function (m) {
|
|
2372
2706
|
var _m$data = m.data,
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2707
|
+
nonce = _m$data.nonce,
|
|
2708
|
+
eventType = _m$data.eventType,
|
|
2709
|
+
clientX = _m$data.clientX,
|
|
2710
|
+
clientY = _m$data.clientY,
|
|
2711
|
+
value = _m$data.value,
|
|
2712
|
+
name = _m$data.name;
|
|
2713
|
+
|
|
2379
2714
|
if (nonce !== expectedNonce || !jsdom && m.origin !== 'null') {
|
|
2380
2715
|
// yes, m.origin IS actually supposed to be a string 'null'. That is origin for opaque URL
|
|
2381
2716
|
return; // If message did not contain expected nonce, then ignore (comms will not be stablished).
|
|
@@ -2386,6 +2721,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2386
2721
|
}
|
|
2387
2722
|
|
|
2388
2723
|
var boundingRect = div.getBoundingClientRect();
|
|
2724
|
+
|
|
2389
2725
|
if (eventType && clientX && clientY) {
|
|
2390
2726
|
var mEvent;
|
|
2391
2727
|
var realClientX = Math.round(clientX + boundingRect.left);
|
|
@@ -2394,8 +2730,8 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2394
2730
|
bubbles: true,
|
|
2395
2731
|
cancelable: true,
|
|
2396
2732
|
composed: true
|
|
2397
|
-
};
|
|
2398
|
-
|
|
2733
|
+
}; // only dispatch customEvent for click because value and name are needed to bubble up
|
|
2734
|
+
|
|
2399
2735
|
if (eventType === 'click') {
|
|
2400
2736
|
mEvent = new CustomEvent('areaClick', Object.assign({
|
|
2401
2737
|
detail: {
|
|
@@ -2411,6 +2747,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2411
2747
|
clientY: realClientY
|
|
2412
2748
|
}, eventSetting));
|
|
2413
2749
|
}
|
|
2750
|
+
|
|
2414
2751
|
div.dispatchEvent(mEvent);
|
|
2415
2752
|
}
|
|
2416
2753
|
};
|
|
@@ -2421,6 +2758,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2421
2758
|
if (messageListener) {
|
|
2422
2759
|
window.removeEventListener('message', messageListener);
|
|
2423
2760
|
}
|
|
2761
|
+
|
|
2424
2762
|
if (intervalID) {
|
|
2425
2763
|
clearInterval(intervalID); // stop sending setup message
|
|
2426
2764
|
}
|
|
@@ -2428,8 +2766,10 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2428
2766
|
refCallback(element);
|
|
2429
2767
|
}
|
|
2430
2768
|
}]);
|
|
2769
|
+
|
|
2431
2770
|
return SvgMutator;
|
|
2432
2771
|
}();
|
|
2772
|
+
|
|
2433
2773
|
exports.SvgMutator = SvgMutator;
|
|
2434
2774
|
SvgMutator.serializer = new xmldom_1.XMLSerializer();
|
|
2435
2775
|
|
|
@@ -2461,17 +2801,29 @@ module.exports = require("jexl");
|
|
|
2461
2801
|
Object.defineProperty(exports, "__esModule", {
|
|
2462
2802
|
value: true
|
|
2463
2803
|
});
|
|
2804
|
+
|
|
2464
2805
|
var i18n_1 = __webpack_require__(2);
|
|
2806
|
+
|
|
2465
2807
|
var pick_1 = __webpack_require__(23);
|
|
2808
|
+
|
|
2466
2809
|
var variables_1 = __webpack_require__(11);
|
|
2810
|
+
|
|
2467
2811
|
var schemaUtils_1 = __webpack_require__(16);
|
|
2812
|
+
|
|
2468
2813
|
var PresetPalettes_1 = __webpack_require__(61);
|
|
2814
|
+
|
|
2469
2815
|
var visualization_icons_1 = __webpack_require__(52);
|
|
2816
|
+
|
|
2470
2817
|
var placeholders_1 = __webpack_require__(50);
|
|
2818
|
+
|
|
2471
2819
|
var VizBehavior_1 = __webpack_require__(6);
|
|
2820
|
+
|
|
2472
2821
|
var configUtils_1 = __webpack_require__(20);
|
|
2473
|
-
|
|
2474
|
-
var
|
|
2822
|
+
|
|
2823
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
2824
|
+
|
|
2825
|
+
var StaticBackgroundColorEditor_1 = __webpack_require__(91);
|
|
2826
|
+
|
|
2475
2827
|
var dataContract = {
|
|
2476
2828
|
requiredDataSources: [],
|
|
2477
2829
|
optionalDataSources: [{
|
|
@@ -2634,16 +2986,19 @@ var editorConfig = [{
|
|
|
2634
2986
|
/**
|
|
2635
2987
|
* visualization configuration
|
|
2636
2988
|
*/
|
|
2989
|
+
|
|
2637
2990
|
var config = {
|
|
2638
2991
|
/**
|
|
2639
2992
|
* unique viz key
|
|
2640
2993
|
*/
|
|
2641
2994
|
key: 'splunk.choropleth.svg',
|
|
2995
|
+
|
|
2642
2996
|
/**
|
|
2643
2997
|
* viz name
|
|
2644
2998
|
*/
|
|
2645
2999
|
name: (0, i18n_1._)('Choropleth SVG'),
|
|
2646
3000
|
category: VizCategory_1.VizCategory.SPATIAL,
|
|
3001
|
+
|
|
2647
3002
|
/**
|
|
2648
3003
|
* viz icon
|
|
2649
3004
|
*/
|
|
@@ -2677,6 +3032,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2677
3032
|
value: true
|
|
2678
3033
|
});
|
|
2679
3034
|
exports.isValidUrl = void 0;
|
|
3035
|
+
|
|
2680
3036
|
var isValidUrl = function isValidUrl(value) {
|
|
2681
3037
|
try {
|
|
2682
3038
|
var url = new URL(value);
|
|
@@ -2685,6 +3041,7 @@ var isValidUrl = function isValidUrl(value) {
|
|
|
2685
3041
|
return false;
|
|
2686
3042
|
}
|
|
2687
3043
|
};
|
|
3044
|
+
|
|
2688
3045
|
exports.isValidUrl = isValidUrl;
|
|
2689
3046
|
|
|
2690
3047
|
/***/ }),
|
|
@@ -2696,20 +3053,27 @@ exports.isValidUrl = isValidUrl;
|
|
|
2696
3053
|
|
|
2697
3054
|
var __rest = this && this.__rest || function (s, e) {
|
|
2698
3055
|
var t = {};
|
|
3056
|
+
|
|
2699
3057
|
for (var p in s) {
|
|
2700
3058
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2701
3059
|
}
|
|
3060
|
+
|
|
2702
3061
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2703
3062
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2704
3063
|
}
|
|
2705
3064
|
return t;
|
|
2706
3065
|
};
|
|
3066
|
+
|
|
2707
3067
|
Object.defineProperty(exports, "__esModule", {
|
|
2708
3068
|
value: true
|
|
2709
3069
|
});
|
|
3070
|
+
|
|
2710
3071
|
var React = __webpack_require__(1);
|
|
3072
|
+
|
|
2711
3073
|
var styled_components_1 = __webpack_require__(4);
|
|
3074
|
+
|
|
2712
3075
|
var visualization_icons_1 = __webpack_require__(52);
|
|
3076
|
+
|
|
2713
3077
|
var Container = styled_components_1.default.div.withConfig({
|
|
2714
3078
|
displayName: "ErrorMessage__Container",
|
|
2715
3079
|
componentId: "sc-190iqnz-0"
|
|
@@ -2718,13 +3082,16 @@ var Message = styled_components_1.default.div.withConfig({
|
|
|
2718
3082
|
displayName: "ErrorMessage__Message",
|
|
2719
3083
|
componentId: "sc-190iqnz-1"
|
|
2720
3084
|
})(["width:100%;word-break:break-all;"]);
|
|
3085
|
+
|
|
2721
3086
|
var ErrorMessage = function ErrorMessage(_a) {
|
|
2722
3087
|
var props = __rest(_a, []);
|
|
3088
|
+
|
|
2723
3089
|
var error = props.error;
|
|
2724
3090
|
return React.createElement(Container, null, React.createElement(visualization_icons_1.Image, {
|
|
2725
3091
|
"data-testid": "image-icon"
|
|
2726
3092
|
}), React.createElement(Message, null, error));
|
|
2727
3093
|
};
|
|
3094
|
+
|
|
2728
3095
|
exports.default = (0, styled_components_1.withTheme)(ErrorMessage);
|
|
2729
3096
|
|
|
2730
3097
|
/***/ })
|