@splunk/visualizations 25.13.1 → 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 +318 -234
- package/Area.config.js.map +1 -1
- package/Area.js +1131 -766
- package/Area.js.map +1 -1
- package/Bar.config.js +317 -233
- package/Bar.config.js.map +1 -1
- package/Bar.js +1007 -594
- package/Bar.js.map +1 -1
- package/Bubble.config.js +234 -160
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +912 -509
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +80 -29
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +691 -319
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +308 -223
- package/Column.config.js.map +1 -1
- package/Column.js +1011 -587
- package/Column.js.map +1 -1
- package/Ellipse.config.js +127 -62
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +576 -286
- package/Ellipse.js.map +1 -1
- package/Events.config.js +111 -29
- package/Events.config.js.map +1 -1
- package/Events.js +998 -527
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +142 -73
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +962 -572
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +70 -26
- package/Image.config.js.map +1 -1
- package/Image.js +524 -253
- package/Image.js.map +1 -1
- package/Line.config.js +326 -242
- package/Line.config.js.map +1 -1
- package/Line.js +1022 -606
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +99 -49
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +1184 -762
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +311 -167
- package/Map.config.js.map +1 -1
- package/Map.js +1479 -873
- package/Map.js.map +1 -1
- package/Markdown.config.js +93 -43
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +603 -332
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +163 -105
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +1025 -628
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +95 -41
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +993 -622
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +99 -46
- package/Pie.config.js.map +1 -1
- package/Pie.js +847 -442
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +114 -62
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +1097 -633
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +131 -65
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +580 -288
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +103 -41
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +1128 -586
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +231 -157
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +904 -504
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +212 -142
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1506 -956
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +294 -233
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +208 -138
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +1375 -914
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +252 -137
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +2194 -1069
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +172 -83
- package/SparkLine.js.map +1 -1
- package/Table.config.js +123 -70
- package/Table.config.js.map +1 -1
- package/Table.js +1094 -590
- package/Table.js.map +1 -1
- package/common/Charting.js +147 -75
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +91 -36
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +70 -60
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +45 -36
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +177 -86
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +65 -32
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +34 -7
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +10 -4
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +41 -28
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +56 -24
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +15 -5
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +238 -155
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +34 -16
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +59 -23
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +9 -4
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +5 -3
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +3 -2
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +370 -206
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +243 -198
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +36 -9
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +87 -26
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +4 -2
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +375 -193
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +25 -27
package/ChoroplethSvg.js
CHANGED
|
@@ -87,7 +87,7 @@ module.exports =
|
|
|
87
87
|
/******/
|
|
88
88
|
/******/
|
|
89
89
|
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 185);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ([
|
|
@@ -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,40 +205,46 @@ 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 {
|
|
214
222
|
style: {
|
|
215
|
-
width: style_1.toPx(width)
|
|
223
|
+
width: (0, style_1.toPx)(width)
|
|
216
224
|
}
|
|
217
225
|
};
|
|
218
226
|
}).withConfig({
|
|
219
227
|
displayName: "FixedSizeContainer__Item",
|
|
220
228
|
componentId: "sc-1yhgpod-0"
|
|
221
229
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
222
|
-
return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
223
|
-
});
|
|
224
|
-
|
|
230
|
+
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
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
|
-
width: style_1.toPx(width)
|
|
238
|
+
width: (0, style_1.toPx)(width)
|
|
231
239
|
}), height && {
|
|
232
|
-
height: style_1.toPx(height)
|
|
240
|
+
height: (0, style_1.toPx)(height)
|
|
233
241
|
})
|
|
234
242
|
};
|
|
235
243
|
}).withConfig({
|
|
236
244
|
displayName: "FixedSizeContainer__FixSizeItem",
|
|
237
245
|
componentId: "sc-1yhgpod-1"
|
|
238
246
|
})(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
|
|
239
|
-
return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
247
|
+
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
240
248
|
});
|
|
241
249
|
var ItemContent = styled_components_1.default.div.withConfig({
|
|
242
250
|
displayName: "FixedSizeContainer__ItemContent",
|
|
@@ -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": "
|
|
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
|
-
var presetContext = lodash_1.get(preset, ['value', 'context'], {});
|
|
503
|
-
var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
|
|
544
|
+
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
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,14 +559,16 @@ 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
|
-
return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
|
|
564
|
+
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
521
565
|
return {
|
|
522
566
|
label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
|
|
523
567
|
value: i
|
|
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
|
/***/ }),
|
|
@@ -564,30 +612,36 @@ module.exports = require("@splunk/themes/pick");
|
|
|
564
612
|
/* 25 */
|
|
565
613
|
/***/ (function(module, exports) {
|
|
566
614
|
|
|
567
|
-
module.exports = require("@splunk/
|
|
615
|
+
module.exports = require("@splunk/ui-utils/id");
|
|
568
616
|
|
|
569
617
|
/***/ }),
|
|
570
618
|
/* 26 */
|
|
571
619
|
/***/ (function(module, exports) {
|
|
572
620
|
|
|
573
|
-
module.exports = require("@splunk/
|
|
621
|
+
module.exports = require("@splunk/visualization-context/TimezoneContext");
|
|
574
622
|
|
|
575
623
|
/***/ }),
|
|
576
624
|
/* 27 */
|
|
577
625
|
/***/ (function(module, exports) {
|
|
578
626
|
|
|
627
|
+
module.exports = require("@splunk/visualizations-shared/hocUtils");
|
|
628
|
+
|
|
629
|
+
/***/ }),
|
|
630
|
+
/* 28 */
|
|
631
|
+
/***/ (function(module, exports) {
|
|
632
|
+
|
|
579
633
|
module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
|
|
580
634
|
|
|
581
635
|
/***/ }),
|
|
582
|
-
/*
|
|
583
|
-
/*
|
|
636
|
+
/* 29 */,
|
|
637
|
+
/* 30 */
|
|
584
638
|
/***/ (function(module, exports) {
|
|
585
639
|
|
|
586
640
|
module.exports = require("@splunk/visualization-encoding/Options");
|
|
587
641
|
|
|
588
642
|
/***/ }),
|
|
589
|
-
/*
|
|
590
|
-
/*
|
|
643
|
+
/* 31 */,
|
|
644
|
+
/* 32 */
|
|
591
645
|
/***/ (function(module, exports, __webpack_require__) {
|
|
592
646
|
|
|
593
647
|
"use strict";
|
|
@@ -597,11 +651,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
597
651
|
value: true
|
|
598
652
|
});
|
|
599
653
|
exports.shouldShowIconPlaceholder = void 0;
|
|
654
|
+
|
|
600
655
|
var React = __webpack_require__(1);
|
|
656
|
+
|
|
601
657
|
var T = __webpack_require__(0);
|
|
658
|
+
|
|
602
659
|
var lodash_1 = __webpack_require__(3);
|
|
660
|
+
|
|
603
661
|
var i18n_1 = __webpack_require__(2);
|
|
662
|
+
|
|
604
663
|
var Message_1 = __webpack_require__(10);
|
|
664
|
+
|
|
605
665
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
606
666
|
/**
|
|
607
667
|
* @method shouldShowIconPlaceholder
|
|
@@ -609,14 +669,17 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
609
669
|
* @param {boolean} loading
|
|
610
670
|
* @returns {boolean}
|
|
611
671
|
*/
|
|
672
|
+
|
|
673
|
+
|
|
612
674
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
613
675
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
614
|
-
var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
|
|
676
|
+
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
615
677
|
var noData = data === undefined;
|
|
616
|
-
var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
|
|
678
|
+
var fields = (0, lodash_1.get)(dataSources, 'primary.data.fields[0]', undefined);
|
|
617
679
|
var noFields = fields === undefined;
|
|
618
680
|
return loading || noData || noFields;
|
|
619
681
|
};
|
|
682
|
+
|
|
620
683
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
621
684
|
var propTypes = {
|
|
622
685
|
icon: T.func,
|
|
@@ -631,11 +694,13 @@ var propTypes = {
|
|
|
631
694
|
* @param {IconPlaceholderProps} props
|
|
632
695
|
* @returns {React.ReactElement}
|
|
633
696
|
*/
|
|
697
|
+
|
|
634
698
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
635
699
|
var width = props.width,
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
700
|
+
height = props.height,
|
|
701
|
+
icon = props.icon,
|
|
702
|
+
iconColor = props.iconColor;
|
|
703
|
+
|
|
639
704
|
if (icon) {
|
|
640
705
|
return React.createElement(icon, {
|
|
641
706
|
style: {
|
|
@@ -650,25 +715,21 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
650
715
|
height: '50%'
|
|
651
716
|
});
|
|
652
717
|
}
|
|
718
|
+
|
|
653
719
|
return React.createElement(Message_1.default, {
|
|
654
720
|
width: width,
|
|
655
721
|
height: height,
|
|
656
722
|
level: "warning",
|
|
657
|
-
message: i18n_1._('No DataSource Connected')
|
|
723
|
+
message: (0, i18n_1._)('No DataSource Connected')
|
|
658
724
|
});
|
|
659
725
|
};
|
|
726
|
+
|
|
660
727
|
IconPlaceholder.propTypes = propTypes;
|
|
661
728
|
IconPlaceholder.defaultProps = {
|
|
662
729
|
width: '100%',
|
|
663
730
|
height: 250
|
|
664
731
|
};
|
|
665
|
-
exports.default = FixedSizeContainer_1.default(IconPlaceholder);
|
|
666
|
-
|
|
667
|
-
/***/ }),
|
|
668
|
-
/* 32 */
|
|
669
|
-
/***/ (function(module, exports) {
|
|
670
|
-
|
|
671
|
-
module.exports = require("@splunk/ui-utils/id");
|
|
732
|
+
exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
672
733
|
|
|
673
734
|
/***/ }),
|
|
674
735
|
/* 33 */
|
|
@@ -678,21 +739,27 @@ module.exports = require("@splunk/ui-utils/id");
|
|
|
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,17 +768,20 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
701
768
|
none: 'asc'
|
|
702
769
|
};
|
|
703
770
|
var onSort;
|
|
771
|
+
|
|
704
772
|
if (typeof onRequestParamsChange === 'function') {
|
|
705
|
-
if (requestParams && lodash_1.has(requestParams, 'sort')) {
|
|
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
|
-
var nextSortDir = lodash_1.has(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
784
|
+
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
715
785
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
716
786
|
offset: 0,
|
|
717
787
|
sort: _defineProperty({}, sortKey, nextSortDir)
|
|
@@ -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
|
-
|
|
764
|
-
var newParams = lodash_1.cloneDeep(requestParams);
|
|
855
|
+
countArg = _ref2.count;
|
|
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
|
-
|
|
826
|
-
var
|
|
827
|
-
|
|
828
|
-
var
|
|
829
|
-
|
|
927
|
+
|
|
928
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
929
|
+
|
|
930
|
+
var Options_1 = __webpack_require__(30);
|
|
931
|
+
|
|
932
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
933
|
+
|
|
934
|
+
var TimezoneContext_1 = __webpack_require__(26);
|
|
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);
|
|
832
|
-
|
|
833
|
-
var
|
|
834
|
-
|
|
835
|
-
var
|
|
836
|
-
|
|
941
|
+
|
|
942
|
+
var hocUtils_1 = __webpack_require__(27);
|
|
943
|
+
|
|
944
|
+
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
945
|
+
|
|
946
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
947
|
+
|
|
948
|
+
var id_1 = __webpack_require__(25);
|
|
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
|
-
|
|
856
|
-
|
|
857
|
-
var
|
|
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
|
+
|
|
980
|
+
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
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,44 +1012,58 @@ 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');
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
1023
|
+
|
|
1024
|
+
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
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);
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1040
|
+
|
|
1041
|
+
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
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
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
1051
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1052
|
+
dataFramesInState = _React$useState8[0],
|
|
1053
|
+
setDataFramesInState = _React$useState8[1];
|
|
1054
|
+
|
|
1055
|
+
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
1056
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1057
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1058
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1059
|
+
|
|
1060
|
+
var isMounted = React.useRef(true);
|
|
1061
|
+
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
920
1062
|
try {
|
|
921
1063
|
if (useAsyncEvaluatedOptions) {
|
|
922
1064
|
var optionsToEvaluate = {
|
|
923
|
-
context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
|
|
924
|
-
options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
|
|
1065
|
+
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1066
|
+
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
925
1067
|
};
|
|
926
1068
|
var asyncDynamicOptionsEvaluatorParams = {
|
|
927
1069
|
visualizationID: visualizationID,
|
|
@@ -932,21 +1074,23 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
932
1074
|
};
|
|
933
1075
|
async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
|
|
934
1076
|
setEvaluatedOptionsAsync(results.results);
|
|
935
|
-
}).catch(function (
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
1077
|
+
}).catch(function () {
|
|
1078
|
+
if (isMounted.current) {
|
|
1079
|
+
setUseAsyncEvaluatedOptions(false);
|
|
1080
|
+
}
|
|
939
1081
|
});
|
|
940
1082
|
} else {
|
|
941
1083
|
var dataFrames = dataFramesInState;
|
|
1084
|
+
|
|
942
1085
|
if (dataSources !== dataSourcesInState) {
|
|
943
1086
|
setDataSourcesInState(dataSources);
|
|
944
1087
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
945
1088
|
setDataFramesInState(dataFrames);
|
|
946
1089
|
}
|
|
1090
|
+
|
|
947
1091
|
return Options_1.Options.evaluate({
|
|
948
|
-
context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
|
|
949
|
-
options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
|
|
1092
|
+
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1093
|
+
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
950
1094
|
}, dataSources, themeFunc, dataFrames);
|
|
951
1095
|
}
|
|
952
1096
|
} catch (e) {
|
|
@@ -954,67 +1098,76 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
954
1098
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
955
1099
|
return {};
|
|
956
1100
|
}
|
|
1101
|
+
|
|
957
1102
|
return {};
|
|
958
1103
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
959
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
960
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1104
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
961
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
|
|
962
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
|
+
|
|
963
1108
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
964
1109
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1110
|
+
|
|
965
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) {
|
|
966
1112
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
967
1113
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
968
1114
|
});
|
|
969
|
-
}
|
|
970
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1115
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
971
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
|
+
|
|
972
1119
|
React.useEffect(function () {
|
|
973
1120
|
onComputedProps(clonedEvaluatedOptions);
|
|
974
1121
|
});
|
|
975
1122
|
React.useEffect(function () {
|
|
976
1123
|
return function () {
|
|
977
1124
|
if (useAsyncEvaluatedOptions) {
|
|
1125
|
+
isMounted.current = false;
|
|
978
1126
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
979
1127
|
}
|
|
980
|
-
};
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
// 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
|
+
|
|
984
1131
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
var missing = MissingPropsMessage_1.missingKeys(requiredProps, evaluatedOptionsToUse);
|
|
1132
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1133
|
+
supports = vizConfig.supports;
|
|
1134
|
+
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1135
|
+
|
|
988
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
|
|
989
1137
|
) {
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
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
|
+
|
|
999
1148
|
var eventCallbackProps = {};
|
|
1149
|
+
|
|
1000
1150
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1001
1151
|
var supportedEvents = vizConfig.events;
|
|
1002
1152
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1003
|
-
var eventCallbackPropName = lodash_1.camelCase("on.".concat(eventName));
|
|
1004
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
1005
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
1153
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
1154
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
1006
1155
|
// then remove these lines
|
|
1156
|
+
|
|
1007
1157
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
1008
1158
|
var payload = {};
|
|
1159
|
+
|
|
1009
1160
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1010
1161
|
payloadKeys.forEach(function (p) {
|
|
1011
1162
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1012
1163
|
});
|
|
1013
1164
|
}
|
|
1165
|
+
|
|
1014
1166
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1015
1167
|
if (ev && ev.payload) {
|
|
1016
1168
|
payload = ev.payload;
|
|
1017
1169
|
}
|
|
1170
|
+
|
|
1018
1171
|
return onEventTrigger({
|
|
1019
1172
|
originalEvent: ev,
|
|
1020
1173
|
payload: payload,
|
|
@@ -1022,8 +1175,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1022
1175
|
});
|
|
1023
1176
|
};
|
|
1024
1177
|
});
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1178
|
+
} // compute pure viz props which are not from options
|
|
1179
|
+
|
|
1180
|
+
|
|
1027
1181
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1028
1182
|
themeFunc: themeFunc
|
|
1029
1183
|
}));
|
|
@@ -1041,21 +1195,25 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1041
1195
|
* In future, we could automatically detect which all datasources are being used
|
|
1042
1196
|
* and bind those magically to pagination/sorting behavior.
|
|
1043
1197
|
*/
|
|
1198
|
+
|
|
1044
1199
|
var dataSourceMetadata = {};
|
|
1045
1200
|
var OptionKey = 'paginateDataSourceKey';
|
|
1046
|
-
var paginateDataSourceKey = lodash_1.has(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
var
|
|
1201
|
+
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1202
|
+
|
|
1203
|
+
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1204
|
+
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1205
|
+
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1206
|
+
|
|
1050
1207
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1051
1208
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1052
1209
|
};
|
|
1053
|
-
|
|
1210
|
+
|
|
1211
|
+
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1054
1212
|
requestParams: requestParams,
|
|
1055
1213
|
meta: meta,
|
|
1056
1214
|
onRequestParamsChange: handleRequestParamsChange
|
|
1057
1215
|
});
|
|
1058
|
-
var paginatorParams = getPagination_1.getPaginationParams({
|
|
1216
|
+
var paginatorParams = (0, getPagination_1.getPaginationParams)({
|
|
1059
1217
|
requestParams: requestParams,
|
|
1060
1218
|
meta: meta,
|
|
1061
1219
|
onRequestParamsChange: handleRequestParamsChange
|
|
@@ -1064,103 +1222,120 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1064
1222
|
sortParams: sortParams,
|
|
1065
1223
|
paginatorParams: paginatorParams
|
|
1066
1224
|
};
|
|
1067
|
-
}
|
|
1068
|
-
|
|
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
|
+
|
|
1069
1228
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1070
1229
|
return null;
|
|
1071
1230
|
}
|
|
1231
|
+
|
|
1072
1232
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1073
1233
|
mode: mode,
|
|
1074
1234
|
width: width,
|
|
1075
1235
|
height: height
|
|
1076
1236
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1077
1237
|
};
|
|
1238
|
+
|
|
1078
1239
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1079
1240
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1080
1241
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1081
1242
|
theme: {}
|
|
1082
|
-
});
|
|
1083
|
-
|
|
1084
|
-
DashboardViz.config = vizConfig;
|
|
1085
|
-
|
|
1086
|
-
return styled_components_1.withTheme(withPlaceholder_1.default(withEditModeCover_1.default(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1243
|
+
}); // attach viz config
|
|
1244
|
+
|
|
1245
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
1246
|
+
|
|
1247
|
+
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1087
1248
|
};
|
|
1249
|
+
|
|
1088
1250
|
exports.default = withDashboardViz;
|
|
1089
1251
|
|
|
1090
1252
|
/***/ }),
|
|
1091
|
-
/*
|
|
1253
|
+
/* 38 */
|
|
1092
1254
|
/***/ (function(module, exports) {
|
|
1093
1255
|
|
|
1094
1256
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1095
1257
|
|
|
1096
1258
|
/***/ }),
|
|
1097
|
-
/*
|
|
1259
|
+
/* 39 */
|
|
1098
1260
|
/***/ (function(module, exports) {
|
|
1099
1261
|
|
|
1100
1262
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1101
1263
|
|
|
1102
1264
|
/***/ }),
|
|
1103
|
-
/*
|
|
1265
|
+
/* 40 */
|
|
1104
1266
|
/***/ (function(module, exports) {
|
|
1105
1267
|
|
|
1106
1268
|
module.exports = require("@splunk/moment");
|
|
1107
1269
|
|
|
1108
1270
|
/***/ }),
|
|
1109
|
-
/*
|
|
1271
|
+
/* 41 */
|
|
1110
1272
|
/***/ (function(module, exports) {
|
|
1111
1273
|
|
|
1112
1274
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1113
1275
|
|
|
1114
1276
|
/***/ }),
|
|
1115
|
-
/*
|
|
1277
|
+
/* 42 */
|
|
1116
1278
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1117
1279
|
|
|
1118
1280
|
"use strict";
|
|
1119
1281
|
|
|
1120
1282
|
|
|
1121
1283
|
var _classCallCheck = __webpack_require__(9);
|
|
1284
|
+
|
|
1122
1285
|
Object.defineProperty(exports, "__esModule", {
|
|
1123
1286
|
value: true
|
|
1124
1287
|
});
|
|
1125
1288
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1126
1289
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1290
|
+
|
|
1127
1291
|
var T = __webpack_require__(0);
|
|
1292
|
+
|
|
1128
1293
|
var lodash_1 = __webpack_require__(3);
|
|
1129
|
-
|
|
1130
|
-
// 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
|
+
|
|
1131
1298
|
exports.INITIAL_WIDTH = 250;
|
|
1132
1299
|
exports.INITIAL_HEIGHT = 250;
|
|
1133
1300
|
/**
|
|
1134
1301
|
* A Splunk visualization
|
|
1135
1302
|
*/
|
|
1303
|
+
|
|
1136
1304
|
var SplunkVisualization = function SplunkVisualization() {
|
|
1137
1305
|
_classCallCheck(this, SplunkVisualization);
|
|
1138
1306
|
};
|
|
1307
|
+
|
|
1139
1308
|
SplunkVisualization.propTypes = {
|
|
1140
1309
|
/**
|
|
1141
1310
|
* display mode
|
|
1142
1311
|
*/
|
|
1143
1312
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1313
|
+
|
|
1144
1314
|
/**
|
|
1145
1315
|
* width in pixel or string, defaults to 100%
|
|
1146
1316
|
*/
|
|
1147
1317
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1318
|
+
|
|
1148
1319
|
/**
|
|
1149
1320
|
* height in pixel or string
|
|
1150
1321
|
*/
|
|
1151
1322
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1323
|
+
|
|
1152
1324
|
/**
|
|
1153
1325
|
* visualization context used for dynamic option evaluation
|
|
1154
1326
|
*/
|
|
1155
1327
|
context: T.object,
|
|
1328
|
+
|
|
1156
1329
|
/**
|
|
1157
1330
|
* visualization formatting options
|
|
1158
1331
|
*/
|
|
1159
1332
|
options: T.object,
|
|
1333
|
+
|
|
1160
1334
|
/**
|
|
1161
1335
|
* A callback to update formatting options
|
|
1162
1336
|
*/
|
|
1163
1337
|
onOptionsChange: T.func,
|
|
1338
|
+
|
|
1164
1339
|
/**
|
|
1165
1340
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1166
1341
|
*/
|
|
@@ -1169,6 +1344,7 @@ SplunkVisualization.propTypes = {
|
|
|
1169
1344
|
* current request params
|
|
1170
1345
|
*/
|
|
1171
1346
|
requestParams: T.object,
|
|
1347
|
+
|
|
1172
1348
|
/**
|
|
1173
1349
|
* current dataset
|
|
1174
1350
|
*/
|
|
@@ -1176,6 +1352,7 @@ SplunkVisualization.propTypes = {
|
|
|
1176
1352
|
fields: T.array,
|
|
1177
1353
|
columns: T.array
|
|
1178
1354
|
}),
|
|
1355
|
+
|
|
1179
1356
|
/**
|
|
1180
1357
|
* error
|
|
1181
1358
|
*/
|
|
@@ -1183,29 +1360,35 @@ SplunkVisualization.propTypes = {
|
|
|
1183
1360
|
level: T.string,
|
|
1184
1361
|
message: T.string
|
|
1185
1362
|
}),
|
|
1363
|
+
|
|
1186
1364
|
/**
|
|
1187
1365
|
* meta data that came with the dataset
|
|
1188
1366
|
*/
|
|
1189
1367
|
meta: T.object
|
|
1190
1368
|
})),
|
|
1369
|
+
|
|
1191
1370
|
/**
|
|
1192
1371
|
* A callback to trigger event
|
|
1193
1372
|
*/
|
|
1194
1373
|
onEventTrigger: T.func,
|
|
1374
|
+
|
|
1195
1375
|
/**
|
|
1196
1376
|
* Inform viz if there are handlers listening to events
|
|
1197
1377
|
*/
|
|
1198
1378
|
hasEventHandlers: T.bool,
|
|
1379
|
+
|
|
1199
1380
|
/**
|
|
1200
1381
|
* A callback to communicate computed props to a consumer
|
|
1201
1382
|
*/
|
|
1202
1383
|
onComputedProps: T.func,
|
|
1384
|
+
|
|
1203
1385
|
/**
|
|
1204
1386
|
* A callback to obtain visualization api
|
|
1205
1387
|
*/
|
|
1206
1388
|
vizActionHandlerRef: T.func,
|
|
1207
1389
|
loading: T.bool,
|
|
1208
1390
|
theme: T.object,
|
|
1391
|
+
|
|
1209
1392
|
/**
|
|
1210
1393
|
* A callback to request new data with updated request params
|
|
1211
1394
|
*/
|
|
@@ -1214,6 +1397,7 @@ SplunkVisualization.propTypes = {
|
|
|
1214
1397
|
/**
|
|
1215
1398
|
*
|
|
1216
1399
|
*/
|
|
1400
|
+
|
|
1217
1401
|
SplunkVisualization.defaultProps = {
|
|
1218
1402
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1219
1403
|
width: '100%',
|
|
@@ -1241,26 +1425,29 @@ SplunkVisualization.defaultProps = {
|
|
|
1241
1425
|
exports.default = SplunkVisualization;
|
|
1242
1426
|
|
|
1243
1427
|
/***/ }),
|
|
1244
|
-
/*
|
|
1428
|
+
/* 43 */
|
|
1245
1429
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1246
1430
|
|
|
1247
1431
|
"use strict";
|
|
1248
1432
|
|
|
1249
1433
|
|
|
1250
1434
|
var _classCallCheck = __webpack_require__(9);
|
|
1435
|
+
|
|
1251
1436
|
var _createClass = __webpack_require__(18);
|
|
1437
|
+
|
|
1252
1438
|
Object.defineProperty(exports, "__esModule", {
|
|
1253
1439
|
value: true
|
|
1254
1440
|
});
|
|
1255
1441
|
exports.DefaultVizActionHandler = void 0;
|
|
1442
|
+
|
|
1256
1443
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1257
1444
|
function DefaultVizActionHandler() {
|
|
1258
1445
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
1259
1446
|
}
|
|
1447
|
+
|
|
1260
1448
|
_createClass(DefaultVizActionHandler, [{
|
|
1261
1449
|
key: "focus",
|
|
1262
|
-
value: function focus() {
|
|
1263
|
-
// noop
|
|
1450
|
+
value: function focus() {// noop
|
|
1264
1451
|
}
|
|
1265
1452
|
}, {
|
|
1266
1453
|
key: "snapshot",
|
|
@@ -1268,22 +1455,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
1268
1455
|
return null; // noop
|
|
1269
1456
|
}
|
|
1270
1457
|
}]);
|
|
1458
|
+
|
|
1271
1459
|
return DefaultVizActionHandler;
|
|
1272
1460
|
}();
|
|
1273
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1274
1461
|
|
|
1275
|
-
|
|
1276
|
-
/* 43 */
|
|
1277
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1278
|
-
|
|
1279
|
-
"use strict";
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1283
|
-
value: true
|
|
1284
|
-
});
|
|
1285
|
-
exports.validSortDirs = void 0;
|
|
1286
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1462
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1287
1463
|
|
|
1288
1464
|
/***/ }),
|
|
1289
1465
|
/* 44 */
|
|
@@ -1296,7 +1472,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1296
1472
|
value: true
|
|
1297
1473
|
});
|
|
1298
1474
|
exports.useDeepMemo = void 0;
|
|
1475
|
+
|
|
1299
1476
|
var react_1 = __webpack_require__(1);
|
|
1477
|
+
|
|
1300
1478
|
var lodash_1 = __webpack_require__(3);
|
|
1301
1479
|
/**
|
|
1302
1480
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -1311,16 +1489,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
1311
1489
|
* @param fn the function to be executed and
|
|
1312
1490
|
* @param dependencies an array of dependencies
|
|
1313
1491
|
*/
|
|
1492
|
+
|
|
1493
|
+
|
|
1314
1494
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1315
|
-
var ref = react_1.useRef();
|
|
1316
|
-
|
|
1495
|
+
var ref = (0, react_1.useRef)();
|
|
1496
|
+
|
|
1497
|
+
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1317
1498
|
ref.current = {
|
|
1318
1499
|
dependencies: dependencies,
|
|
1319
1500
|
value: fn()
|
|
1320
1501
|
};
|
|
1321
1502
|
}
|
|
1503
|
+
|
|
1322
1504
|
return ref.current.value;
|
|
1323
1505
|
};
|
|
1506
|
+
|
|
1324
1507
|
exports.useDeepMemo = useDeepMemo;
|
|
1325
1508
|
|
|
1326
1509
|
/***/ }),
|
|
@@ -1334,19 +1517,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1334
1517
|
value: true
|
|
1335
1518
|
});
|
|
1336
1519
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
1520
|
+
|
|
1337
1521
|
var React = __webpack_require__(1);
|
|
1522
|
+
|
|
1338
1523
|
var T = __webpack_require__(0);
|
|
1524
|
+
|
|
1339
1525
|
var i18n_1 = __webpack_require__(2);
|
|
1526
|
+
|
|
1340
1527
|
var Message_1 = __webpack_require__(10);
|
|
1528
|
+
|
|
1341
1529
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
1342
1530
|
/**
|
|
1343
1531
|
* @method isMissing
|
|
1344
1532
|
* @param {any} v
|
|
1345
1533
|
* @returns {boolean} true if the input value === null or undefined
|
|
1346
1534
|
*/
|
|
1535
|
+
|
|
1536
|
+
|
|
1347
1537
|
var isMissing = function isMissing(v) {
|
|
1348
1538
|
return v === null || v === undefined;
|
|
1349
1539
|
};
|
|
1540
|
+
|
|
1350
1541
|
exports.isMissing = isMissing;
|
|
1351
1542
|
/**
|
|
1352
1543
|
* @method misskingKeys
|
|
@@ -1354,11 +1545,13 @@ exports.isMissing = isMissing;
|
|
|
1354
1545
|
* @param {object} target
|
|
1355
1546
|
* @returns {string[]} the keys of missing required props
|
|
1356
1547
|
*/
|
|
1548
|
+
|
|
1357
1549
|
var missingKeys = function missingKeys(keys, target) {
|
|
1358
1550
|
return keys.filter(function (k) {
|
|
1359
|
-
return exports.isMissing(target[k]);
|
|
1551
|
+
return (0, exports.isMissing)(target[k]);
|
|
1360
1552
|
});
|
|
1361
1553
|
};
|
|
1554
|
+
|
|
1362
1555
|
exports.missingKeys = missingKeys;
|
|
1363
1556
|
var propTypes = {
|
|
1364
1557
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -1372,24 +1565,26 @@ var propTypes = {
|
|
|
1372
1565
|
* @param {MissingPropsProps} props
|
|
1373
1566
|
* @returns {React.ReactElement}
|
|
1374
1567
|
*/
|
|
1568
|
+
|
|
1375
1569
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
1376
1570
|
var width = props.width,
|
|
1377
|
-
|
|
1378
|
-
|
|
1571
|
+
height = props.height,
|
|
1572
|
+
missingProps = props.missingProps;
|
|
1379
1573
|
return React.createElement(Message_1.default, {
|
|
1380
1574
|
"data-test": "message",
|
|
1381
1575
|
width: width,
|
|
1382
1576
|
height: height,
|
|
1383
|
-
message: i18n_1._("Missing property: ".concat(missingProps.join(', ')))
|
|
1577
|
+
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
1384
1578
|
});
|
|
1385
1579
|
};
|
|
1580
|
+
|
|
1386
1581
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
1387
1582
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
1388
1583
|
exports.MissingPropsMessage.defaultProps = {
|
|
1389
1584
|
width: '100%',
|
|
1390
1585
|
height: 250
|
|
1391
1586
|
};
|
|
1392
|
-
exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
|
|
1587
|
+
exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage);
|
|
1393
1588
|
|
|
1394
1589
|
/***/ }),
|
|
1395
1590
|
/* 46 */
|
|
@@ -1401,15 +1596,19 @@ exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
|
|
|
1401
1596
|
Object.defineProperty(exports, "__esModule", {
|
|
1402
1597
|
value: true
|
|
1403
1598
|
});
|
|
1599
|
+
|
|
1404
1600
|
var React = __webpack_require__(1);
|
|
1601
|
+
|
|
1405
1602
|
var styled_components_1 = __webpack_require__(4);
|
|
1603
|
+
|
|
1406
1604
|
var hocUtils_1 = __webpack_require__(15);
|
|
1605
|
+
|
|
1407
1606
|
var Cover = styled_components_1.default.div.withConfig({
|
|
1408
1607
|
displayName: "withEditModeCover__Cover",
|
|
1409
1608
|
componentId: "sc-1gsbnxb-0"
|
|
1410
1609
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
1411
1610
|
var Blocker = styled_components_1.default.div.attrs({
|
|
1412
|
-
'data-splunk-visualization-version': "
|
|
1611
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
1413
1612
|
}).withConfig({
|
|
1414
1613
|
displayName: "withEditModeCover__Blocker",
|
|
1415
1614
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -1420,6 +1619,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
1420
1619
|
* @param {ExtendedDashViz} Visualization
|
|
1421
1620
|
* @returns {ExtendedDashViz} Wrapper
|
|
1422
1621
|
*/
|
|
1622
|
+
|
|
1423
1623
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
1424
1624
|
var Wrapper = function Wrapper(props) {
|
|
1425
1625
|
var mode = props.mode;
|
|
@@ -1428,12 +1628,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
1428
1628
|
"data-test": "edit-mode-cover"
|
|
1429
1629
|
}));
|
|
1430
1630
|
};
|
|
1431
|
-
|
|
1631
|
+
|
|
1632
|
+
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1432
1633
|
Wrapper: Wrapper,
|
|
1433
1634
|
Visualization: Visualization
|
|
1434
1635
|
});
|
|
1435
1636
|
return Wrapper;
|
|
1436
1637
|
};
|
|
1638
|
+
|
|
1437
1639
|
exports.default = withEditModeCover;
|
|
1438
1640
|
|
|
1439
1641
|
/***/ }),
|
|
@@ -1446,27 +1648,37 @@ exports.default = withEditModeCover;
|
|
|
1446
1648
|
Object.defineProperty(exports, "__esModule", {
|
|
1447
1649
|
value: true
|
|
1448
1650
|
});
|
|
1651
|
+
|
|
1449
1652
|
var React = __webpack_require__(1);
|
|
1653
|
+
|
|
1450
1654
|
var colorUtils_1 = __webpack_require__(12);
|
|
1655
|
+
|
|
1451
1656
|
var variables_1 = __webpack_require__(11);
|
|
1452
|
-
|
|
1657
|
+
|
|
1658
|
+
var IconPlaceholder_1 = __webpack_require__(32);
|
|
1659
|
+
|
|
1453
1660
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1661
|
+
|
|
1454
1662
|
var hocUtils_1 = __webpack_require__(15);
|
|
1663
|
+
|
|
1455
1664
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
1456
1665
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
1457
1666
|
var config = Visualization.config;
|
|
1458
1667
|
var themes = config.themes;
|
|
1668
|
+
|
|
1459
1669
|
var Wrapper = function Wrapper(props) {
|
|
1460
1670
|
var _a, _b;
|
|
1671
|
+
|
|
1461
1672
|
var dataSources = props.dataSources,
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1673
|
+
loading = props.loading,
|
|
1674
|
+
options = props.options,
|
|
1675
|
+
height = props.height,
|
|
1676
|
+
width = props.width;
|
|
1466
1677
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
1467
|
-
var bgColorFromTheme = colorUtils_1.isColor(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
|
|
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);
|
|
1468
1679
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
1469
1680
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
1681
|
+
|
|
1470
1682
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
1471
1683
|
return React.createElement(IconPlaceholder_1.default, {
|
|
1472
1684
|
"data-test": "icon-placeholder",
|
|
@@ -1477,25 +1689,28 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
1477
1689
|
iconColor: iconColor
|
|
1478
1690
|
});
|
|
1479
1691
|
}
|
|
1692
|
+
|
|
1480
1693
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
1481
1694
|
};
|
|
1482
|
-
|
|
1695
|
+
|
|
1696
|
+
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1483
1697
|
Wrapper: Wrapper,
|
|
1484
1698
|
Visualization: Visualization
|
|
1485
1699
|
});
|
|
1486
1700
|
return Wrapper;
|
|
1487
1701
|
};
|
|
1702
|
+
|
|
1488
1703
|
exports.default = withPlaceholder;
|
|
1489
1704
|
|
|
1490
1705
|
/***/ }),
|
|
1491
1706
|
/* 48 */,
|
|
1492
|
-
/* 49
|
|
1707
|
+
/* 49 */,
|
|
1708
|
+
/* 50 */
|
|
1493
1709
|
/***/ (function(module, exports) {
|
|
1494
1710
|
|
|
1495
1711
|
module.exports = require("@splunk/visualization-icons/placeholders");
|
|
1496
1712
|
|
|
1497
1713
|
/***/ }),
|
|
1498
|
-
/* 50 */,
|
|
1499
1714
|
/* 51 */,
|
|
1500
1715
|
/* 52 */
|
|
1501
1716
|
/***/ (function(module, exports) {
|
|
@@ -1510,39 +1725,40 @@ module.exports = require("@splunk/visualization-icons");
|
|
|
1510
1725
|
/* 57 */,
|
|
1511
1726
|
/* 58 */,
|
|
1512
1727
|
/* 59 */,
|
|
1513
|
-
/* 60
|
|
1728
|
+
/* 60 */,
|
|
1729
|
+
/* 61 */
|
|
1514
1730
|
/***/ (function(module, exports) {
|
|
1515
1731
|
|
|
1516
1732
|
module.exports = require("@splunk/visualization-color-palettes/editors/PresetPalettes");
|
|
1517
1733
|
|
|
1518
1734
|
/***/ }),
|
|
1519
|
-
/*
|
|
1520
|
-
/*
|
|
1735
|
+
/* 62 */,
|
|
1736
|
+
/* 63 */
|
|
1521
1737
|
/***/ (function(module, exports) {
|
|
1522
1738
|
|
|
1523
1739
|
module.exports = require("@babel/runtime/helpers/getPrototypeOf");
|
|
1524
1740
|
|
|
1525
1741
|
/***/ }),
|
|
1526
|
-
/* 63 */,
|
|
1527
1742
|
/* 64 */,
|
|
1528
1743
|
/* 65 */,
|
|
1529
1744
|
/* 66 */,
|
|
1530
1745
|
/* 67 */,
|
|
1531
1746
|
/* 68 */,
|
|
1532
1747
|
/* 69 */,
|
|
1533
|
-
/* 70
|
|
1748
|
+
/* 70 */,
|
|
1749
|
+
/* 71 */
|
|
1534
1750
|
/***/ (function(module, exports) {
|
|
1535
1751
|
|
|
1536
1752
|
module.exports = require("@babel/runtime/helpers/inherits");
|
|
1537
1753
|
|
|
1538
1754
|
/***/ }),
|
|
1539
|
-
/*
|
|
1755
|
+
/* 72 */
|
|
1540
1756
|
/***/ (function(module, exports) {
|
|
1541
1757
|
|
|
1542
1758
|
module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
|
|
1543
1759
|
|
|
1544
1760
|
/***/ }),
|
|
1545
|
-
/*
|
|
1761
|
+
/* 73 */
|
|
1546
1762
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1547
1763
|
|
|
1548
1764
|
"use strict";
|
|
@@ -1566,7 +1782,6 @@ VizStyleWrapper.displayName = 'VizStyleWrapper';
|
|
|
1566
1782
|
/* harmony default export */ __webpack_exports__["default"] = (VizStyleWrapper);
|
|
1567
1783
|
|
|
1568
1784
|
/***/ }),
|
|
1569
|
-
/* 73 */,
|
|
1570
1785
|
/* 74 */,
|
|
1571
1786
|
/* 75 */,
|
|
1572
1787
|
/* 76 */,
|
|
@@ -1582,7 +1797,9 @@ VizStyleWrapper.displayName = 'VizStyleWrapper';
|
|
|
1582
1797
|
/* 86 */,
|
|
1583
1798
|
/* 87 */,
|
|
1584
1799
|
/* 88 */,
|
|
1585
|
-
/* 89
|
|
1800
|
+
/* 89 */,
|
|
1801
|
+
/* 90 */,
|
|
1802
|
+
/* 91 */
|
|
1586
1803
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1587
1804
|
|
|
1588
1805
|
"use strict";
|
|
@@ -1605,8 +1822,6 @@ var StaticBackgroundColorEditor = {
|
|
|
1605
1822
|
/* harmony default export */ __webpack_exports__["default"] = (StaticBackgroundColorEditor);
|
|
1606
1823
|
|
|
1607
1824
|
/***/ }),
|
|
1608
|
-
/* 90 */,
|
|
1609
|
-
/* 91 */,
|
|
1610
1825
|
/* 92 */,
|
|
1611
1826
|
/* 93 */,
|
|
1612
1827
|
/* 94 */,
|
|
@@ -1659,25 +1874,38 @@ var StaticBackgroundColorEditor = {
|
|
|
1659
1874
|
/* 141 */,
|
|
1660
1875
|
/* 142 */,
|
|
1661
1876
|
/* 143 */,
|
|
1662
|
-
/* 144
|
|
1877
|
+
/* 144 */,
|
|
1878
|
+
/* 145 */,
|
|
1879
|
+
/* 146 */,
|
|
1880
|
+
/* 147 */
|
|
1663
1881
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1664
1882
|
|
|
1665
1883
|
"use strict";
|
|
1666
1884
|
|
|
1667
1885
|
|
|
1668
1886
|
var _classCallCheck = __webpack_require__(9);
|
|
1887
|
+
|
|
1669
1888
|
var _createClass = __webpack_require__(18);
|
|
1670
|
-
|
|
1671
|
-
var
|
|
1672
|
-
|
|
1889
|
+
|
|
1890
|
+
var _inherits = __webpack_require__(71);
|
|
1891
|
+
|
|
1892
|
+
var _possibleConstructorReturn = __webpack_require__(72);
|
|
1893
|
+
|
|
1894
|
+
var _getPrototypeOf = __webpack_require__(63);
|
|
1895
|
+
|
|
1673
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
|
+
|
|
1674
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
|
+
|
|
1675
1900
|
Object.defineProperty(exports, "__esModule", {
|
|
1676
1901
|
value: true
|
|
1677
1902
|
});
|
|
1903
|
+
|
|
1678
1904
|
var React = __webpack_require__(1);
|
|
1905
|
+
|
|
1679
1906
|
var lodash_1 = __webpack_require__(3);
|
|
1680
|
-
|
|
1907
|
+
|
|
1908
|
+
var SvgMutator_1 = __webpack_require__(190);
|
|
1681
1909
|
/**
|
|
1682
1910
|
* This react component simply take an SVG document, and mutates it by applying data to the document according to
|
|
1683
1911
|
* dataBindings. The data (data prop) is processed by performing the mutation once for each 'row' of the data even though the data is formatted as columns.
|
|
@@ -1686,13 +1914,20 @@ var SvgMutator_1 = __webpack_require__(187);
|
|
|
1686
1914
|
* The first mutation has $i=0, the second has $1=1, the third has $i=2.
|
|
1687
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
|
|
1688
1916
|
*/
|
|
1917
|
+
|
|
1918
|
+
|
|
1689
1919
|
var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
|
|
1690
1920
|
_inherits(SvgChoroplethDynamic, _React$Component);
|
|
1921
|
+
|
|
1691
1922
|
var _super = _createSuper(SvgChoroplethDynamic);
|
|
1923
|
+
|
|
1692
1924
|
function SvgChoroplethDynamic(props, context) {
|
|
1693
1925
|
var _this;
|
|
1926
|
+
|
|
1694
1927
|
_classCallCheck(this, SvgChoroplethDynamic);
|
|
1928
|
+
|
|
1695
1929
|
_this = _super.call(this, props, context);
|
|
1930
|
+
|
|
1696
1931
|
_this.handleAreaClick = function (ev) {
|
|
1697
1932
|
if (typeof _this.props.onAreaClick === 'function') {
|
|
1698
1933
|
_this.props.onAreaClick(Object.assign(Object.assign({}, ev), {
|
|
@@ -1700,21 +1935,25 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
|
|
|
1700
1935
|
}));
|
|
1701
1936
|
}
|
|
1702
1937
|
};
|
|
1938
|
+
|
|
1703
1939
|
_this.areaClickRef = function (node) {
|
|
1704
1940
|
if (!node) {
|
|
1705
1941
|
return;
|
|
1706
1942
|
}
|
|
1943
|
+
|
|
1707
1944
|
node.addEventListener('areaClick', function (ev) {
|
|
1708
1945
|
return _this.handleAreaClick(ev);
|
|
1709
1946
|
});
|
|
1710
1947
|
_this.node = node;
|
|
1711
1948
|
};
|
|
1949
|
+
|
|
1712
1950
|
_this.state = {
|
|
1713
1951
|
svgNode: null
|
|
1714
1952
|
};
|
|
1715
1953
|
_this.node = null;
|
|
1716
1954
|
return _this;
|
|
1717
1955
|
}
|
|
1956
|
+
|
|
1718
1957
|
_createClass(SvgChoroplethDynamic, [{
|
|
1719
1958
|
key: "componentDidMount",
|
|
1720
1959
|
value: function componentDidMount() {
|
|
@@ -1723,14 +1962,13 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
|
|
|
1723
1962
|
}, {
|
|
1724
1963
|
key: "shouldComponentUpdate",
|
|
1725
1964
|
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
1726
|
-
return nextProps.svg !== this.props.svg || !lodash_1.isEqual(nextProps.data, this.props.data) ||
|
|
1727
|
-
|
|
1728
|
-
nextState.svgNode !== this.state.svgNode || !lodash_1.isEqual(nextProps.width, this.props.width) || !lodash_1.isEqual(nextProps.height, this.props.height);
|
|
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
|
|
1966
|
+
nextState.svgNode !== this.state.svgNode || !(0, lodash_1.isEqual)(nextProps.width, this.props.width) || !(0, lodash_1.isEqual)(nextProps.height, this.props.height);
|
|
1729
1967
|
}
|
|
1730
1968
|
}, {
|
|
1731
1969
|
key: "componentDidUpdate",
|
|
1732
1970
|
value: function componentDidUpdate(prevProps) {
|
|
1733
|
-
if (prevProps.svg !== this.props.svg || !lodash_1.isEqual(prevProps.data, this.props.data) || !lodash_1.isEqual(prevProps.width, this.props.width) || !lodash_1.isEqual(prevProps.height, this.props.height)) {
|
|
1971
|
+
if (prevProps.svg !== this.props.svg || !(0, lodash_1.isEqual)(prevProps.data, this.props.data) || !(0, lodash_1.isEqual)(prevProps.width, this.props.width) || !(0, lodash_1.isEqual)(prevProps.height, this.props.height)) {
|
|
1734
1972
|
this.mutate();
|
|
1735
1973
|
}
|
|
1736
1974
|
}
|
|
@@ -1745,8 +1983,10 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
|
|
|
1745
1983
|
key: "mutate",
|
|
1746
1984
|
value: function mutate() {
|
|
1747
1985
|
var svg = this.props.svg;
|
|
1986
|
+
|
|
1748
1987
|
if (svg) {
|
|
1749
1988
|
var m = new SvgMutator_1.SvgMutator(this.props);
|
|
1989
|
+
|
|
1750
1990
|
try {
|
|
1751
1991
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
1752
1992
|
this.setState({
|
|
@@ -1761,11 +2001,12 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
|
|
|
1761
2001
|
key: "render",
|
|
1762
2002
|
value: function render() {
|
|
1763
2003
|
var _this$props = this.props,
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
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;
|
|
1768
2008
|
var svgNode = this.state.svgNode;
|
|
2009
|
+
|
|
1769
2010
|
if (svgNode) {
|
|
1770
2011
|
return React.createElement("div", {
|
|
1771
2012
|
style: {
|
|
@@ -1775,20 +2016,20 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
|
|
|
1775
2016
|
ref: this.areaClickRef
|
|
1776
2017
|
}, svgNode);
|
|
1777
2018
|
}
|
|
2019
|
+
|
|
1778
2020
|
return null;
|
|
1779
2021
|
}
|
|
1780
2022
|
}]);
|
|
2023
|
+
|
|
1781
2024
|
return SvgChoroplethDynamic;
|
|
1782
2025
|
}(React.Component);
|
|
2026
|
+
|
|
1783
2027
|
exports.default = SvgChoroplethDynamic;
|
|
1784
2028
|
SvgChoroplethDynamic.defaultProps = {
|
|
1785
2029
|
svg: ''
|
|
1786
2030
|
};
|
|
1787
2031
|
|
|
1788
2032
|
/***/ }),
|
|
1789
|
-
/* 145 */,
|
|
1790
|
-
/* 146 */,
|
|
1791
|
-
/* 147 */,
|
|
1792
2033
|
/* 148 */,
|
|
1793
2034
|
/* 149 */,
|
|
1794
2035
|
/* 150 */,
|
|
@@ -1823,7 +2064,10 @@ SvgChoroplethDynamic.defaultProps = {
|
|
|
1823
2064
|
/* 179 */,
|
|
1824
2065
|
/* 180 */,
|
|
1825
2066
|
/* 181 */,
|
|
1826
|
-
/* 182
|
|
2067
|
+
/* 182 */,
|
|
2068
|
+
/* 183 */,
|
|
2069
|
+
/* 184 */,
|
|
2070
|
+
/* 185 */
|
|
1827
2071
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1828
2072
|
|
|
1829
2073
|
"use strict";
|
|
@@ -1831,35 +2075,53 @@ SvgChoroplethDynamic.defaultProps = {
|
|
|
1831
2075
|
|
|
1832
2076
|
var __rest = this && this.__rest || function (s, e) {
|
|
1833
2077
|
var t = {};
|
|
2078
|
+
|
|
1834
2079
|
for (var p in s) {
|
|
1835
2080
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1836
2081
|
}
|
|
2082
|
+
|
|
1837
2083
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1838
2084
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1839
2085
|
}
|
|
1840
2086
|
return t;
|
|
1841
2087
|
};
|
|
2088
|
+
|
|
1842
2089
|
Object.defineProperty(exports, "__esModule", {
|
|
1843
2090
|
value: true
|
|
1844
2091
|
});
|
|
1845
2092
|
exports.useIconPlaceholder = exports.createProtocolHandlers = exports.PureSvgChoroplethDynamic = exports.PureChoroplethSvg = exports.config = void 0;
|
|
2093
|
+
|
|
1846
2094
|
var React = __webpack_require__(1);
|
|
2095
|
+
|
|
1847
2096
|
var T = __webpack_require__(0);
|
|
2097
|
+
|
|
1848
2098
|
var lodash_1 = __webpack_require__(3);
|
|
2099
|
+
|
|
1849
2100
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
1850
|
-
|
|
1851
|
-
var
|
|
1852
|
-
|
|
1853
|
-
var
|
|
1854
|
-
|
|
1855
|
-
var
|
|
1856
|
-
|
|
1857
|
-
var
|
|
1858
|
-
|
|
1859
|
-
var
|
|
2101
|
+
|
|
2102
|
+
var ImageContext_1 = __webpack_require__(186);
|
|
2103
|
+
|
|
2104
|
+
var FileDownloader_1 = __webpack_require__(187);
|
|
2105
|
+
|
|
2106
|
+
var Downloader_1 = __webpack_require__(188);
|
|
2107
|
+
|
|
2108
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
2109
|
+
|
|
2110
|
+
var PureChoroplethSvg_1 = __webpack_require__(189);
|
|
2111
|
+
|
|
2112
|
+
var SvgChoroplethDynamic_1 = __webpack_require__(147);
|
|
2113
|
+
|
|
2114
|
+
var config_1 = __webpack_require__(194);
|
|
2115
|
+
|
|
2116
|
+
var IconPlaceholder_1 = __webpack_require__(32);
|
|
2117
|
+
|
|
2118
|
+
var urlUtils_1 = __webpack_require__(195);
|
|
2119
|
+
|
|
2120
|
+
var ErrorMessage_1 = __webpack_require__(196);
|
|
2121
|
+
|
|
1860
2122
|
exports.config = config_1.default;
|
|
1861
|
-
exports.PureChoroplethSvg = PureChoroplethSvg_1.default;
|
|
1862
|
-
|
|
2123
|
+
exports.PureChoroplethSvg = PureChoroplethSvg_1.default; // todo: need remove when deleting @splunk/react-visualizations package
|
|
2124
|
+
|
|
1863
2125
|
exports.PureSvgChoroplethDynamic = SvgChoroplethDynamic_1.default;
|
|
1864
2126
|
/**
|
|
1865
2127
|
* This function generates the protocol handlers
|
|
@@ -1869,49 +2131,61 @@ exports.PureSvgChoroplethDynamic = SvgChoroplethDynamic_1.default;
|
|
|
1869
2131
|
* @param {ImageContext} imageContext
|
|
1870
2132
|
* @returns {object}
|
|
1871
2133
|
*/
|
|
2134
|
+
|
|
1872
2135
|
var createProtocolHandlers = function createProtocolHandlers() {
|
|
1873
2136
|
var featureFlagContext = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1874
2137
|
var imageContext = arguments.length > 1 ? arguments[1] : undefined;
|
|
1875
2138
|
var handlers = {
|
|
1876
2139
|
data: new Downloader_1.URLDownloader()
|
|
1877
2140
|
};
|
|
2141
|
+
|
|
1878
2142
|
if (imageContext) {
|
|
1879
2143
|
imageContext.listProviders().forEach(function (_ref) {
|
|
1880
2144
|
var type = _ref.type;
|
|
1881
2145
|
handlers[type] = new Downloader_1.ImageRegistryFetcher(imageContext);
|
|
1882
2146
|
});
|
|
1883
2147
|
}
|
|
2148
|
+
|
|
1884
2149
|
var enableSvgHttpDownloader = featureFlagContext.enableSvgHttpDownloader;
|
|
2150
|
+
|
|
1885
2151
|
if (enableSvgHttpDownloader) {
|
|
1886
2152
|
handlers.http = new Downloader_1.URLDownloader();
|
|
1887
2153
|
handlers.https = new Downloader_1.URLDownloader();
|
|
1888
2154
|
}
|
|
2155
|
+
|
|
1889
2156
|
return handlers;
|
|
1890
2157
|
};
|
|
2158
|
+
|
|
1891
2159
|
exports.createProtocolHandlers = createProtocolHandlers;
|
|
2160
|
+
|
|
1892
2161
|
var ChoroplethSvg = function ChoroplethSvg(_a) {
|
|
1893
2162
|
var props = __rest(_a, []);
|
|
2163
|
+
|
|
1894
2164
|
var svg = props.svg;
|
|
1895
2165
|
var url = React.useMemo(function () {
|
|
1896
2166
|
if (!svg) {
|
|
1897
2167
|
return svg;
|
|
1898
2168
|
}
|
|
2169
|
+
|
|
1899
2170
|
var trimmed = svg.trim();
|
|
1900
|
-
|
|
2171
|
+
|
|
2172
|
+
if ((0, urlUtils_1.isValidUrl)(trimmed)) {
|
|
1901
2173
|
return trimmed;
|
|
1902
2174
|
}
|
|
2175
|
+
|
|
1903
2176
|
if (/.*<svg.*/i.test(trimmed)) {
|
|
1904
2177
|
return trimmed;
|
|
1905
2178
|
}
|
|
2179
|
+
|
|
1906
2180
|
return "".concat(window.location.origin, "/").concat(trimmed);
|
|
1907
|
-
}, [svg]);
|
|
1908
|
-
// 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
|
|
1909
2182
|
// the svg argument is not a url.
|
|
2183
|
+
|
|
1910
2184
|
return React.createElement(ImageContext_1.default.Consumer, null, function (imageContext) {
|
|
1911
2185
|
return React.createElement(FeatureFlagContext_1.default.Consumer, null, function (featureFlagContext) {
|
|
1912
2186
|
return React.createElement(FileDownloader_1.FileDownloader, {
|
|
1913
2187
|
url: url,
|
|
1914
|
-
protocolHandlers: exports.createProtocolHandlers(featureFlagContext, imageContext),
|
|
2188
|
+
protocolHandlers: (0, exports.createProtocolHandlers)(featureFlagContext, imageContext),
|
|
1915
2189
|
renderContent: function renderContent(svgString) {
|
|
1916
2190
|
var pureVizProps = Object.assign(Object.assign({}, props), {
|
|
1917
2191
|
svg: svgString
|
|
@@ -1927,44 +2201,47 @@ var ChoroplethSvg = function ChoroplethSvg(_a) {
|
|
|
1927
2201
|
});
|
|
1928
2202
|
});
|
|
1929
2203
|
};
|
|
2204
|
+
|
|
1930
2205
|
ChoroplethSvg.propTypes = {
|
|
1931
2206
|
svg: T.string
|
|
1932
2207
|
};
|
|
2208
|
+
|
|
1933
2209
|
function useIconPlaceholder(dataSources, loading, options) {
|
|
1934
|
-
var svg = lodash_1.get(options, 'svg');
|
|
1935
|
-
var missingData = IconPlaceholder_1.shouldShowIconPlaceholder(dataSources, loading);
|
|
2210
|
+
var svg = (0, lodash_1.get)(options, 'svg');
|
|
2211
|
+
var missingData = (0, IconPlaceholder_1.shouldShowIconPlaceholder)(dataSources, loading);
|
|
1936
2212
|
return missingData && !svg;
|
|
1937
2213
|
}
|
|
2214
|
+
|
|
1938
2215
|
exports.useIconPlaceholder = useIconPlaceholder;
|
|
1939
|
-
var platformViz = withDashboardViz_1.default({
|
|
2216
|
+
var platformViz = (0, withDashboardViz_1.default)({
|
|
1940
2217
|
ReactViz: ChoroplethSvg,
|
|
1941
2218
|
vizConfig: config_1.default,
|
|
1942
2219
|
useIconPlaceholder: useIconPlaceholder
|
|
1943
|
-
});
|
|
1944
|
-
// (platformViz as any).defaultProps.width = '100%';
|
|
2220
|
+
}); // (platformViz as any).defaultProps.width = '100%';
|
|
1945
2221
|
// (platformViz as any).defaultProps.height = '100%';
|
|
2222
|
+
|
|
1946
2223
|
exports.default = platformViz;
|
|
1947
2224
|
|
|
1948
2225
|
/***/ }),
|
|
1949
|
-
/*
|
|
2226
|
+
/* 186 */
|
|
1950
2227
|
/***/ (function(module, exports) {
|
|
1951
2228
|
|
|
1952
2229
|
module.exports = require("@splunk/visualization-context/ImageContext");
|
|
1953
2230
|
|
|
1954
2231
|
/***/ }),
|
|
1955
|
-
/*
|
|
2232
|
+
/* 187 */
|
|
1956
2233
|
/***/ (function(module, exports) {
|
|
1957
2234
|
|
|
1958
2235
|
module.exports = require("@splunk/visualizations-shared/FileDownloader");
|
|
1959
2236
|
|
|
1960
2237
|
/***/ }),
|
|
1961
|
-
/*
|
|
2238
|
+
/* 188 */
|
|
1962
2239
|
/***/ (function(module, exports) {
|
|
1963
2240
|
|
|
1964
2241
|
module.exports = require("@splunk/visualizations-shared/Downloader");
|
|
1965
2242
|
|
|
1966
2243
|
/***/ }),
|
|
1967
|
-
/*
|
|
2244
|
+
/* 189 */
|
|
1968
2245
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1969
2246
|
|
|
1970
2247
|
"use strict";
|
|
@@ -1972,62 +2249,79 @@ module.exports = require("@splunk/visualizations-shared/Downloader");
|
|
|
1972
2249
|
|
|
1973
2250
|
var __rest = this && this.__rest || function (s, e) {
|
|
1974
2251
|
var t = {};
|
|
2252
|
+
|
|
1975
2253
|
for (var p in s) {
|
|
1976
2254
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1977
2255
|
}
|
|
2256
|
+
|
|
1978
2257
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1979
2258
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1980
2259
|
}
|
|
1981
2260
|
return t;
|
|
1982
2261
|
};
|
|
2262
|
+
|
|
1983
2263
|
Object.defineProperty(exports, "__esModule", {
|
|
1984
2264
|
value: true
|
|
1985
2265
|
});
|
|
1986
2266
|
exports.computeSvgDynamicProps = void 0;
|
|
2267
|
+
|
|
1987
2268
|
var React = __webpack_require__(1);
|
|
2269
|
+
|
|
1988
2270
|
var styled_components_1 = __webpack_require__(4);
|
|
2271
|
+
|
|
1989
2272
|
var lodash_1 = __webpack_require__(3);
|
|
2273
|
+
|
|
1990
2274
|
var style_1 = __webpack_require__(14);
|
|
2275
|
+
|
|
1991
2276
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
1992
|
-
|
|
1993
|
-
var
|
|
2277
|
+
|
|
2278
|
+
var SvgChoroplethDynamic_1 = __webpack_require__(147);
|
|
2279
|
+
|
|
2280
|
+
var VizStyleWrapper_1 = __webpack_require__(73);
|
|
2281
|
+
|
|
1994
2282
|
var Container = styled_components_1.default.div.withConfig({
|
|
1995
2283
|
displayName: "PureChoroplethSvg__Container",
|
|
1996
2284
|
componentId: "m24jrf-0"
|
|
1997
2285
|
})(["position:relative;flex-direction:column;flex:1;display:flex;", ";"], function (props) {
|
|
1998
|
-
return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
|
|
2286
|
+
return (0, style_1.toDimension)((0, lodash_1.pick)(props, ['width', 'height']));
|
|
1999
2287
|
});
|
|
2000
2288
|
var ChoroplethSvgWrapper = styled_components_1.default.div.withConfig({
|
|
2001
2289
|
displayName: "PureChoroplethSvg__ChoroplethSvgWrapper",
|
|
2002
2290
|
componentId: "m24jrf-1"
|
|
2003
2291
|
})(["min-height:0px;flex:1;position:relative;"]);
|
|
2292
|
+
|
|
2004
2293
|
var computeSvgDynamicProps = function computeSvgDynamicProps(_a) {
|
|
2005
2294
|
var props = __rest(_a, []);
|
|
2295
|
+
|
|
2006
2296
|
var data = {
|
|
2007
2297
|
featureIDs: props.areaIds || [],
|
|
2008
2298
|
values: props.areaValues || [],
|
|
2009
2299
|
fill: props.areaColors || []
|
|
2010
|
-
};
|
|
2011
|
-
|
|
2300
|
+
}; // current implementation is limited to only setting the fill attribute
|
|
2301
|
+
|
|
2012
2302
|
var dataBinding = [{
|
|
2013
2303
|
xPath: "'//*[@id=\"'+featureIDs[$i]+'\"]/@fill'",
|
|
2014
2304
|
value: 'fill[$i]'
|
|
2015
2305
|
}];
|
|
2016
|
-
return Object.assign(Object.assign({}, lodash_1.omit(props, ['areaIds', 'areaValues', 'areaColors'])), {
|
|
2306
|
+
return Object.assign(Object.assign({}, (0, lodash_1.omit)(props, ['areaIds', 'areaValues', 'areaColors'])), {
|
|
2017
2307
|
data: data,
|
|
2018
2308
|
dataBinding: dataBinding
|
|
2019
2309
|
});
|
|
2020
2310
|
};
|
|
2311
|
+
|
|
2021
2312
|
exports.computeSvgDynamicProps = computeSvgDynamicProps;
|
|
2313
|
+
|
|
2022
2314
|
var PureChoroplethSvg = function PureChoroplethSvg(_a) {
|
|
2023
2315
|
var props = __rest(_a, []);
|
|
2316
|
+
|
|
2024
2317
|
var width = props.width,
|
|
2025
|
-
|
|
2026
|
-
|
|
2318
|
+
height = props.height,
|
|
2319
|
+
backgroundColor = props.backgroundColor;
|
|
2320
|
+
|
|
2027
2321
|
var renderVisualization = function renderVisualization(_ref) {
|
|
2028
2322
|
var containerWidth = _ref.width,
|
|
2029
|
-
|
|
2030
|
-
var svgProps = exports.computeSvgDynamicProps(Object.assign(Object.assign({}, props), {
|
|
2323
|
+
containerHeight = _ref.height;
|
|
2324
|
+
var svgProps = (0, exports.computeSvgDynamicProps)(Object.assign(Object.assign({}, props), {
|
|
2031
2325
|
width: containerWidth,
|
|
2032
2326
|
height: containerHeight
|
|
2033
2327
|
}));
|
|
@@ -2036,6 +2330,7 @@ var PureChoroplethSvg = function PureChoroplethSvg(_a) {
|
|
|
2036
2330
|
dataTestKey: "ChoroplethSvgWrapper"
|
|
2037
2331
|
}, React.createElement(SvgChoroplethDynamic_1.default, Object.assign({}, svgProps)));
|
|
2038
2332
|
};
|
|
2333
|
+
|
|
2039
2334
|
return React.createElement(Container, {
|
|
2040
2335
|
width: width,
|
|
2041
2336
|
height: height
|
|
@@ -2043,35 +2338,44 @@ var PureChoroplethSvg = function PureChoroplethSvg(_a) {
|
|
|
2043
2338
|
return renderVisualization(containerDimension);
|
|
2044
2339
|
})));
|
|
2045
2340
|
};
|
|
2341
|
+
|
|
2046
2342
|
PureChoroplethSvg.defaultProps = {
|
|
2047
2343
|
width: '100%',
|
|
2048
2344
|
height: 250,
|
|
2049
2345
|
onAreaClick: function onAreaClick() {}
|
|
2050
2346
|
};
|
|
2051
|
-
exports.default = styled_components_1.withTheme(PureChoroplethSvg);
|
|
2347
|
+
exports.default = (0, styled_components_1.withTheme)(PureChoroplethSvg);
|
|
2052
2348
|
|
|
2053
2349
|
/***/ }),
|
|
2054
|
-
/*
|
|
2350
|
+
/* 190 */
|
|
2055
2351
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2056
2352
|
|
|
2057
2353
|
"use strict";
|
|
2058
2354
|
|
|
2059
2355
|
|
|
2060
2356
|
var _classCallCheck = __webpack_require__(9);
|
|
2357
|
+
|
|
2061
2358
|
var _createClass = __webpack_require__(18);
|
|
2359
|
+
|
|
2062
2360
|
Object.defineProperty(exports, "__esModule", {
|
|
2063
2361
|
value: true
|
|
2064
2362
|
});
|
|
2065
2363
|
exports.SvgMutator = exports.ERROR_NON_ATTRIBUTE_MUTATION = void 0;
|
|
2066
2364
|
/* eslint-disable no-param-reassign */
|
|
2365
|
+
|
|
2067
2366
|
var React = __webpack_require__(1);
|
|
2068
|
-
|
|
2069
|
-
var
|
|
2070
|
-
|
|
2367
|
+
|
|
2368
|
+
var XPath = __webpack_require__(191);
|
|
2369
|
+
|
|
2370
|
+
var xmldom_1 = __webpack_require__(192);
|
|
2371
|
+
|
|
2372
|
+
var jexl = __webpack_require__(193);
|
|
2071
2373
|
/**
|
|
2072
2374
|
* An error message indicating that a mutation has attempted to target anything other than SVG attribute(s)
|
|
2073
2375
|
* @type {string}
|
|
2074
2376
|
*/
|
|
2377
|
+
|
|
2378
|
+
|
|
2075
2379
|
exports.ERROR_NON_ATTRIBUTE_MUTATION = 'mutations only allowed on attribute nodes';
|
|
2076
2380
|
/**
|
|
2077
2381
|
* This class takes columnar data and mutates an SVG document by applying rules defined in DataBindings. This class
|
|
@@ -2079,6 +2383,7 @@ exports.ERROR_NON_ATTRIBUTE_MUTATION = 'mutations only allowed on attribute node
|
|
|
2079
2383
|
* animation delays. This class parses an SVG document into an internal dom (NOT THE BROWSER DOM), which is then
|
|
2080
2384
|
* converted into a ReactNode.
|
|
2081
2385
|
*/
|
|
2386
|
+
|
|
2082
2387
|
var SvgMutator = /*#__PURE__*/function () {
|
|
2083
2388
|
/**
|
|
2084
2389
|
* parses the svg and stores the parsed Document in a local field. Keeps a copy of the props.
|
|
@@ -2086,6 +2391,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2086
2391
|
*/
|
|
2087
2392
|
function SvgMutator(props) {
|
|
2088
2393
|
_classCallCheck(this, SvgMutator);
|
|
2394
|
+
|
|
2089
2395
|
var svg = props.svg;
|
|
2090
2396
|
this.svgDoc = new xmldom_1.DOMParser().parseFromString(svg);
|
|
2091
2397
|
this.props = Object.assign({}, props);
|
|
@@ -2097,6 +2403,8 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2097
2403
|
* @param {(node: Node) => void} refCallback
|
|
2098
2404
|
* @returns {React.ReactNode}
|
|
2099
2405
|
*/
|
|
2406
|
+
|
|
2407
|
+
|
|
2100
2408
|
_createClass(SvgMutator, [{
|
|
2101
2409
|
key: "mutate",
|
|
2102
2410
|
value: function mutate() {
|
|
@@ -2113,6 +2421,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2113
2421
|
* @param {number} i
|
|
2114
2422
|
* @param {Node} target
|
|
2115
2423
|
*/
|
|
2424
|
+
|
|
2116
2425
|
}, {
|
|
2117
2426
|
key: "applyMutations",
|
|
2118
2427
|
value:
|
|
@@ -2123,22 +2432,26 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2123
2432
|
*/
|
|
2124
2433
|
function applyMutations(prototypicalNode) {
|
|
2125
2434
|
var _this$props = this.props,
|
|
2126
|
-
|
|
2127
|
-
|
|
2435
|
+
dataBinding = _this$props.dataBinding,
|
|
2436
|
+
data = _this$props.data;
|
|
2128
2437
|
var target = prototypicalNode.cloneNode(true);
|
|
2438
|
+
|
|
2129
2439
|
if (data) {
|
|
2130
2440
|
var anyKey = Object.keys(data)[0];
|
|
2131
2441
|
var len = data[anyKey].length;
|
|
2442
|
+
|
|
2132
2443
|
var _loop = function _loop(i) {
|
|
2133
2444
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
2134
2445
|
dataBinding.forEach(function (db) {
|
|
2135
2446
|
return SvgMutator.applyMutation(db, data, i, target);
|
|
2136
2447
|
});
|
|
2137
2448
|
};
|
|
2449
|
+
|
|
2138
2450
|
for (var i = 0; i < len; i += 1) {
|
|
2139
2451
|
_loop(i);
|
|
2140
2452
|
}
|
|
2141
2453
|
}
|
|
2454
|
+
|
|
2142
2455
|
return target;
|
|
2143
2456
|
}
|
|
2144
2457
|
/**
|
|
@@ -2149,26 +2462,29 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2149
2462
|
* @param height
|
|
2150
2463
|
* @returns {React.ReactElement}
|
|
2151
2464
|
*/
|
|
2465
|
+
|
|
2152
2466
|
}], [{
|
|
2153
2467
|
key: "applyMutation",
|
|
2154
2468
|
value: function applyMutation(dataBinding, data, i, target) {
|
|
2155
2469
|
var xPath = dataBinding.xPath;
|
|
2470
|
+
|
|
2156
2471
|
if (!xPath) {
|
|
2157
2472
|
throw new Error('xPath property not defined');
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2473
|
+
} // use xpath expression to seek out places to make changes
|
|
2474
|
+
|
|
2475
|
+
|
|
2160
2476
|
var hits = SvgMutator.evaluateXPath(xPath, target, Object.assign(Object.assign({}, data), {
|
|
2161
2477
|
$i: i
|
|
2162
2478
|
}));
|
|
2163
2479
|
var hit;
|
|
2480
|
+
|
|
2164
2481
|
for (hit = hits.iterateNext(); hit; hit = hits.iterateNext()) {
|
|
2165
2482
|
SvgMutator.mutateNode(hit, dataBinding, data, i);
|
|
2166
2483
|
}
|
|
2167
2484
|
}
|
|
2168
2485
|
}, {
|
|
2169
2486
|
key: "getSandboxedIframe",
|
|
2170
|
-
value: function getSandboxedIframe(refCallback,
|
|
2171
|
-
// fixme get rid of?
|
|
2487
|
+
value: function getSandboxedIframe(refCallback, // fixme get rid of?
|
|
2172
2488
|
node, currentProps) {
|
|
2173
2489
|
var svgNode = SvgMutator.getSvgElementFromDoc(node);
|
|
2174
2490
|
svgNode.setAttribute('width', currentProps.width || '100%');
|
|
@@ -2182,6 +2498,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2182
2498
|
* Alternatively, Chrome has a higher size limit for Blobs (500Mib? - https://source.chromium.org/chromium/chromium/src/+/main:storage/browser/blob/README.md)
|
|
2183
2499
|
* and we can create Blob URLs via URL.createObjectURL(), using the URL API together with blobs via the File API
|
|
2184
2500
|
*/
|
|
2501
|
+
|
|
2185
2502
|
var blob = new Blob([html], {
|
|
2186
2503
|
type: 'text/html'
|
|
2187
2504
|
});
|
|
@@ -2196,8 +2513,8 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2196
2513
|
padding: '0',
|
|
2197
2514
|
pointerEvents: 'auto',
|
|
2198
2515
|
colorScheme: 'light' // iframe adds a white background when using 'dark' theme, hacking to set scheme to 'light'
|
|
2199
|
-
},
|
|
2200
2516
|
|
|
2517
|
+
},
|
|
2201
2518
|
frameBorder: 0,
|
|
2202
2519
|
sandbox: 'allow-scripts',
|
|
2203
2520
|
id: 'svgChoroplethIframe'
|
|
@@ -2217,23 +2534,28 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2217
2534
|
if (!div) {
|
|
2218
2535
|
// called on unmount
|
|
2219
2536
|
SvgMutator.removeIframeEventListener(div, messageListener, intervalID, refCallback);
|
|
2537
|
+
|
|
2220
2538
|
if (blobURL) {
|
|
2221
2539
|
URL.revokeObjectURL(blobURL);
|
|
2222
2540
|
}
|
|
2541
|
+
|
|
2223
2542
|
return;
|
|
2224
2543
|
}
|
|
2544
|
+
|
|
2225
2545
|
messageListener = SvgMutator.createIframeMessageListener(NONCE, intervalID, div);
|
|
2226
2546
|
window.addEventListener('message', messageListener);
|
|
2547
|
+
|
|
2227
2548
|
function sendSetupMessage() {
|
|
2228
|
-
var svgIframe = div.querySelector('#svgChoroplethIframe');
|
|
2229
|
-
|
|
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
|
+
|
|
2230
2551
|
if (svgIframe) {
|
|
2231
2552
|
svgIframe.contentWindow.postMessage({
|
|
2232
2553
|
parentIdentity: PARENT_ID
|
|
2233
2554
|
}, '*');
|
|
2234
2555
|
}
|
|
2235
|
-
}
|
|
2236
|
-
|
|
2556
|
+
} // continuously send an initialization message to the iframe until it ack's back
|
|
2557
|
+
|
|
2558
|
+
|
|
2237
2559
|
intervalID = setInterval(sendSetupMessage, 500);
|
|
2238
2560
|
refCallback(div);
|
|
2239
2561
|
}
|
|
@@ -2245,18 +2567,21 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2245
2567
|
value: function getSvgElementFromDoc(node) {
|
|
2246
2568
|
if (node.nodeName === '#document') {
|
|
2247
2569
|
var kids = node.childNodes;
|
|
2570
|
+
|
|
2248
2571
|
for (var i = 0; i < kids.length; i += 1) {
|
|
2249
|
-
node = kids.item(i);
|
|
2250
|
-
// 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
|
|
2251
2573
|
// nodeName 'svg', but only the actualy <svg> element has nodeType 1 (ELEMENT_NODE)
|
|
2574
|
+
|
|
2252
2575
|
if (node.nodeName === 'svg' && node.nodeType && node.nodeType === 1) {
|
|
2253
2576
|
break;
|
|
2254
2577
|
}
|
|
2255
2578
|
}
|
|
2256
2579
|
}
|
|
2580
|
+
|
|
2257
2581
|
if (node.nodeName !== 'svg') {
|
|
2258
2582
|
throw new Error("Could not find an <svg> element");
|
|
2259
2583
|
}
|
|
2584
|
+
|
|
2260
2585
|
return node;
|
|
2261
2586
|
}
|
|
2262
2587
|
/**
|
|
@@ -2267,6 +2592,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2267
2592
|
* @param {object} context
|
|
2268
2593
|
* @returns {XPathResult}
|
|
2269
2594
|
*/
|
|
2595
|
+
|
|
2270
2596
|
}, {
|
|
2271
2597
|
key: "evaluateXPath",
|
|
2272
2598
|
value: function evaluateXPath(xpathExpr, doc) {
|
|
@@ -2283,12 +2609,15 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2283
2609
|
key: "getTitle",
|
|
2284
2610
|
value: function getTitle(data, i) {
|
|
2285
2611
|
var title = '';
|
|
2612
|
+
|
|
2286
2613
|
if (data.featureIDs && data.featureIDs[i]) {
|
|
2287
2614
|
title += "name: ".concat(data.featureIDs[i]);
|
|
2288
2615
|
}
|
|
2616
|
+
|
|
2289
2617
|
if (data.values && data.values[i] !== undefined) {
|
|
2290
2618
|
title += "\nvalue: ".concat(data.values[i]);
|
|
2291
2619
|
}
|
|
2620
|
+
|
|
2292
2621
|
return title;
|
|
2293
2622
|
}
|
|
2294
2623
|
/**
|
|
@@ -2303,6 +2632,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2303
2632
|
* @param {number} i
|
|
2304
2633
|
* @returns {any}
|
|
2305
2634
|
*/
|
|
2635
|
+
|
|
2306
2636
|
}, {
|
|
2307
2637
|
key: "mutateNode",
|
|
2308
2638
|
value: function mutateNode(n, dataBinding, data, i) {
|
|
@@ -2310,38 +2640,47 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2310
2640
|
if (n.nodeType && n.nodeType != Node.ATTRIBUTE_NODE) {
|
|
2311
2641
|
throw new Error(exports.ERROR_NON_ATTRIBUTE_MUTATION);
|
|
2312
2642
|
}
|
|
2643
|
+
|
|
2313
2644
|
var context = Object.assign(Object.assign({
|
|
2314
2645
|
$oldValue: n.nodeValue
|
|
2315
2646
|
}, data), {
|
|
2316
2647
|
$i: i
|
|
2317
2648
|
});
|
|
2318
2649
|
var computed;
|
|
2650
|
+
|
|
2319
2651
|
try {
|
|
2320
2652
|
computed = jexl.evalSync(dataBinding.value, context);
|
|
2321
2653
|
} catch (error) {
|
|
2322
2654
|
return;
|
|
2323
|
-
}
|
|
2324
|
-
|
|
2655
|
+
} // this is the actual mutation: we change the attributes value
|
|
2656
|
+
|
|
2657
|
+
|
|
2325
2658
|
n.nodeValue = computed;
|
|
2326
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
|
|
2327
2660
|
// we also add data-* attributes to the node and a title that behaves like a hover
|
|
2661
|
+
|
|
2328
2662
|
var parent = n.ownerElement;
|
|
2329
2663
|
var title = SvgMutator.getTitle(data, i);
|
|
2664
|
+
|
|
2330
2665
|
if (data.featureIDs && data.featureIDs[i]) {
|
|
2331
2666
|
parent.setAttribute('data-name', data.featureIDs[i]);
|
|
2332
2667
|
}
|
|
2668
|
+
|
|
2333
2669
|
if (data.values && data.values[i] !== undefined) {
|
|
2334
2670
|
parent.setAttribute('data-value', data.values[i]);
|
|
2335
2671
|
}
|
|
2672
|
+
|
|
2336
2673
|
if (title !== '') {
|
|
2337
2674
|
var titleElem = n.ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'title');
|
|
2338
2675
|
titleElem.textContent = title;
|
|
2339
2676
|
parent.appendChild(titleElem);
|
|
2340
2677
|
}
|
|
2678
|
+
|
|
2341
2679
|
if (data.featureIDs) {
|
|
2342
2680
|
parent.setAttribute('data-name', data.featureIDs[i]);
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2681
|
+
} // eslint-disable-next-line consistent-return
|
|
2682
|
+
|
|
2683
|
+
|
|
2345
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.
|
|
2346
2685
|
}
|
|
2347
2686
|
}, {
|
|
@@ -2365,12 +2704,13 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2365
2704
|
var jsdom = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2366
2705
|
return function (m) {
|
|
2367
2706
|
var _m$data = m.data,
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
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
|
+
|
|
2374
2714
|
if (nonce !== expectedNonce || !jsdom && m.origin !== 'null') {
|
|
2375
2715
|
// yes, m.origin IS actually supposed to be a string 'null'. That is origin for opaque URL
|
|
2376
2716
|
return; // If message did not contain expected nonce, then ignore (comms will not be stablished).
|
|
@@ -2381,6 +2721,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2381
2721
|
}
|
|
2382
2722
|
|
|
2383
2723
|
var boundingRect = div.getBoundingClientRect();
|
|
2724
|
+
|
|
2384
2725
|
if (eventType && clientX && clientY) {
|
|
2385
2726
|
var mEvent;
|
|
2386
2727
|
var realClientX = Math.round(clientX + boundingRect.left);
|
|
@@ -2389,8 +2730,8 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2389
2730
|
bubbles: true,
|
|
2390
2731
|
cancelable: true,
|
|
2391
2732
|
composed: true
|
|
2392
|
-
};
|
|
2393
|
-
|
|
2733
|
+
}; // only dispatch customEvent for click because value and name are needed to bubble up
|
|
2734
|
+
|
|
2394
2735
|
if (eventType === 'click') {
|
|
2395
2736
|
mEvent = new CustomEvent('areaClick', Object.assign({
|
|
2396
2737
|
detail: {
|
|
@@ -2406,6 +2747,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2406
2747
|
clientY: realClientY
|
|
2407
2748
|
}, eventSetting));
|
|
2408
2749
|
}
|
|
2750
|
+
|
|
2409
2751
|
div.dispatchEvent(mEvent);
|
|
2410
2752
|
}
|
|
2411
2753
|
};
|
|
@@ -2416,6 +2758,7 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2416
2758
|
if (messageListener) {
|
|
2417
2759
|
window.removeEventListener('message', messageListener);
|
|
2418
2760
|
}
|
|
2761
|
+
|
|
2419
2762
|
if (intervalID) {
|
|
2420
2763
|
clearInterval(intervalID); // stop sending setup message
|
|
2421
2764
|
}
|
|
@@ -2423,31 +2766,33 @@ var SvgMutator = /*#__PURE__*/function () {
|
|
|
2423
2766
|
refCallback(element);
|
|
2424
2767
|
}
|
|
2425
2768
|
}]);
|
|
2769
|
+
|
|
2426
2770
|
return SvgMutator;
|
|
2427
2771
|
}();
|
|
2772
|
+
|
|
2428
2773
|
exports.SvgMutator = SvgMutator;
|
|
2429
2774
|
SvgMutator.serializer = new xmldom_1.XMLSerializer();
|
|
2430
2775
|
|
|
2431
2776
|
/***/ }),
|
|
2432
|
-
/*
|
|
2777
|
+
/* 191 */
|
|
2433
2778
|
/***/ (function(module, exports) {
|
|
2434
2779
|
|
|
2435
2780
|
module.exports = require("xpath");
|
|
2436
2781
|
|
|
2437
2782
|
/***/ }),
|
|
2438
|
-
/*
|
|
2783
|
+
/* 192 */
|
|
2439
2784
|
/***/ (function(module, exports) {
|
|
2440
2785
|
|
|
2441
2786
|
module.exports = require("@xmldom/xmldom");
|
|
2442
2787
|
|
|
2443
2788
|
/***/ }),
|
|
2444
|
-
/*
|
|
2789
|
+
/* 193 */
|
|
2445
2790
|
/***/ (function(module, exports) {
|
|
2446
2791
|
|
|
2447
2792
|
module.exports = require("jexl");
|
|
2448
2793
|
|
|
2449
2794
|
/***/ }),
|
|
2450
|
-
/*
|
|
2795
|
+
/* 194 */
|
|
2451
2796
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2452
2797
|
|
|
2453
2798
|
"use strict";
|
|
@@ -2456,17 +2801,29 @@ module.exports = require("jexl");
|
|
|
2456
2801
|
Object.defineProperty(exports, "__esModule", {
|
|
2457
2802
|
value: true
|
|
2458
2803
|
});
|
|
2804
|
+
|
|
2459
2805
|
var i18n_1 = __webpack_require__(2);
|
|
2806
|
+
|
|
2460
2807
|
var pick_1 = __webpack_require__(23);
|
|
2808
|
+
|
|
2461
2809
|
var variables_1 = __webpack_require__(11);
|
|
2810
|
+
|
|
2462
2811
|
var schemaUtils_1 = __webpack_require__(16);
|
|
2463
|
-
|
|
2812
|
+
|
|
2813
|
+
var PresetPalettes_1 = __webpack_require__(61);
|
|
2814
|
+
|
|
2464
2815
|
var visualization_icons_1 = __webpack_require__(52);
|
|
2465
|
-
|
|
2816
|
+
|
|
2817
|
+
var placeholders_1 = __webpack_require__(50);
|
|
2818
|
+
|
|
2466
2819
|
var VizBehavior_1 = __webpack_require__(6);
|
|
2820
|
+
|
|
2467
2821
|
var configUtils_1 = __webpack_require__(20);
|
|
2468
|
-
|
|
2469
|
-
var
|
|
2822
|
+
|
|
2823
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
2824
|
+
|
|
2825
|
+
var StaticBackgroundColorEditor_1 = __webpack_require__(91);
|
|
2826
|
+
|
|
2470
2827
|
var dataContract = {
|
|
2471
2828
|
requiredDataSources: [],
|
|
2472
2829
|
optionalDataSources: [{
|
|
@@ -2551,7 +2908,7 @@ var optionsSchema = {
|
|
|
2551
2908
|
};
|
|
2552
2909
|
var themes = {
|
|
2553
2910
|
defaultBackgroundColor: function defaultBackgroundColor(props) {
|
|
2554
|
-
return pick_1.default({
|
|
2911
|
+
return (0, pick_1.default)({
|
|
2555
2912
|
enterprise: {
|
|
2556
2913
|
dark: variables_1.default.black(props),
|
|
2557
2914
|
light: variables_1.default.backgroundColor(props)
|
|
@@ -2561,7 +2918,7 @@ var themes = {
|
|
|
2561
2918
|
}
|
|
2562
2919
|
};
|
|
2563
2920
|
var editorConfig = [{
|
|
2564
|
-
label: i18n_1._('Data configurations'),
|
|
2921
|
+
label: (0, i18n_1._)('Data configurations'),
|
|
2565
2922
|
layout: [[{
|
|
2566
2923
|
label: 'Area IDs',
|
|
2567
2924
|
editor: 'editor.columnSelector',
|
|
@@ -2580,31 +2937,31 @@ var editorConfig = [{
|
|
|
2580
2937
|
}
|
|
2581
2938
|
}]]
|
|
2582
2939
|
}, {
|
|
2583
|
-
label: i18n_1._('Color and style'),
|
|
2940
|
+
label: (0, i18n_1._)('Color and style'),
|
|
2584
2941
|
layout: [[{
|
|
2585
|
-
label: i18n_1._('Areas'),
|
|
2942
|
+
label: (0, i18n_1._)('Areas'),
|
|
2586
2943
|
option: 'areaColors',
|
|
2587
2944
|
context: 'defaultContext',
|
|
2588
2945
|
editor: 'editor.dynamicColor',
|
|
2589
2946
|
editorProps: {
|
|
2590
2947
|
labelPosition: 'top',
|
|
2591
|
-
flyoutTitle: i18n_1._('Dynamic coloring: value'),
|
|
2948
|
+
flyoutTitle: (0, i18n_1._)('Dynamic coloring: value'),
|
|
2592
2949
|
formatters: [{
|
|
2593
|
-
label: i18n_1._('Ranges'),
|
|
2950
|
+
label: (0, i18n_1._)('Ranges'),
|
|
2594
2951
|
value: 'rangeValue',
|
|
2595
2952
|
isDefault: true,
|
|
2596
2953
|
defaults: {
|
|
2597
2954
|
areaValues: defaultContext.areaColorsRangeConfig
|
|
2598
2955
|
}
|
|
2599
2956
|
}, {
|
|
2600
|
-
label: i18n_1._('Matches'),
|
|
2957
|
+
label: (0, i18n_1._)('Matches'),
|
|
2601
2958
|
value: 'matchValue',
|
|
2602
2959
|
defaults: {
|
|
2603
2960
|
areaValues: defaultContext.areaColorsMatchConfig
|
|
2604
2961
|
}
|
|
2605
2962
|
}],
|
|
2606
2963
|
dataSelectors: [{
|
|
2607
|
-
label: i18n_1._('Value'),
|
|
2964
|
+
label: (0, i18n_1._)('Value'),
|
|
2608
2965
|
value: 'areaValues'
|
|
2609
2966
|
}],
|
|
2610
2967
|
defaultPalettesConfig: PresetPalettes_1.defaultPalettesConfig
|
|
@@ -2615,9 +2972,9 @@ var editorConfig = [{
|
|
|
2615
2972
|
}
|
|
2616
2973
|
})]]
|
|
2617
2974
|
}, {
|
|
2618
|
-
label: i18n_1._('SVG content'),
|
|
2975
|
+
label: (0, i18n_1._)('SVG content'),
|
|
2619
2976
|
layout: [[{
|
|
2620
|
-
label: i18n_1._('SVG file'),
|
|
2977
|
+
label: (0, i18n_1._)('SVG file'),
|
|
2621
2978
|
option: 'svg',
|
|
2622
2979
|
editor: 'editor.image',
|
|
2623
2980
|
editorProps: {
|
|
@@ -2629,16 +2986,19 @@ var editorConfig = [{
|
|
|
2629
2986
|
/**
|
|
2630
2987
|
* visualization configuration
|
|
2631
2988
|
*/
|
|
2989
|
+
|
|
2632
2990
|
var config = {
|
|
2633
2991
|
/**
|
|
2634
2992
|
* unique viz key
|
|
2635
2993
|
*/
|
|
2636
2994
|
key: 'splunk.choropleth.svg',
|
|
2995
|
+
|
|
2637
2996
|
/**
|
|
2638
2997
|
* viz name
|
|
2639
2998
|
*/
|
|
2640
|
-
name: i18n_1._('Choropleth SVG'),
|
|
2999
|
+
name: (0, i18n_1._)('Choropleth SVG'),
|
|
2641
3000
|
category: VizCategory_1.VizCategory.SPATIAL,
|
|
3001
|
+
|
|
2642
3002
|
/**
|
|
2643
3003
|
* viz icon
|
|
2644
3004
|
*/
|
|
@@ -2659,10 +3019,10 @@ var config = {
|
|
|
2659
3019
|
supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS, VizBehavior_1.VizBehavior.PLACEHOLDER],
|
|
2660
3020
|
themes: themes
|
|
2661
3021
|
};
|
|
2662
|
-
exports.default = configUtils_1.enhanceConfig(config);
|
|
3022
|
+
exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
2663
3023
|
|
|
2664
3024
|
/***/ }),
|
|
2665
|
-
/*
|
|
3025
|
+
/* 195 */
|
|
2666
3026
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2667
3027
|
|
|
2668
3028
|
"use strict";
|
|
@@ -2672,6 +3032,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2672
3032
|
value: true
|
|
2673
3033
|
});
|
|
2674
3034
|
exports.isValidUrl = void 0;
|
|
3035
|
+
|
|
2675
3036
|
var isValidUrl = function isValidUrl(value) {
|
|
2676
3037
|
try {
|
|
2677
3038
|
var url = new URL(value);
|
|
@@ -2680,10 +3041,11 @@ var isValidUrl = function isValidUrl(value) {
|
|
|
2680
3041
|
return false;
|
|
2681
3042
|
}
|
|
2682
3043
|
};
|
|
3044
|
+
|
|
2683
3045
|
exports.isValidUrl = isValidUrl;
|
|
2684
3046
|
|
|
2685
3047
|
/***/ }),
|
|
2686
|
-
/*
|
|
3048
|
+
/* 196 */
|
|
2687
3049
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2688
3050
|
|
|
2689
3051
|
"use strict";
|
|
@@ -2691,20 +3053,27 @@ exports.isValidUrl = isValidUrl;
|
|
|
2691
3053
|
|
|
2692
3054
|
var __rest = this && this.__rest || function (s, e) {
|
|
2693
3055
|
var t = {};
|
|
3056
|
+
|
|
2694
3057
|
for (var p in s) {
|
|
2695
3058
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2696
3059
|
}
|
|
3060
|
+
|
|
2697
3061
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2698
3062
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2699
3063
|
}
|
|
2700
3064
|
return t;
|
|
2701
3065
|
};
|
|
3066
|
+
|
|
2702
3067
|
Object.defineProperty(exports, "__esModule", {
|
|
2703
3068
|
value: true
|
|
2704
3069
|
});
|
|
3070
|
+
|
|
2705
3071
|
var React = __webpack_require__(1);
|
|
3072
|
+
|
|
2706
3073
|
var styled_components_1 = __webpack_require__(4);
|
|
3074
|
+
|
|
2707
3075
|
var visualization_icons_1 = __webpack_require__(52);
|
|
3076
|
+
|
|
2708
3077
|
var Container = styled_components_1.default.div.withConfig({
|
|
2709
3078
|
displayName: "ErrorMessage__Container",
|
|
2710
3079
|
componentId: "sc-190iqnz-0"
|
|
@@ -2713,14 +3082,17 @@ var Message = styled_components_1.default.div.withConfig({
|
|
|
2713
3082
|
displayName: "ErrorMessage__Message",
|
|
2714
3083
|
componentId: "sc-190iqnz-1"
|
|
2715
3084
|
})(["width:100%;word-break:break-all;"]);
|
|
3085
|
+
|
|
2716
3086
|
var ErrorMessage = function ErrorMessage(_a) {
|
|
2717
3087
|
var props = __rest(_a, []);
|
|
3088
|
+
|
|
2718
3089
|
var error = props.error;
|
|
2719
3090
|
return React.createElement(Container, null, React.createElement(visualization_icons_1.Image, {
|
|
2720
3091
|
"data-testid": "image-icon"
|
|
2721
3092
|
}), React.createElement(Message, null, error));
|
|
2722
3093
|
};
|
|
2723
|
-
|
|
3094
|
+
|
|
3095
|
+
exports.default = (0, styled_components_1.withTheme)(ErrorMessage);
|
|
2724
3096
|
|
|
2725
3097
|
/***/ })
|
|
2726
3098
|
/******/ ]);
|