@splunk/visualizations 26.0.0 → 26.1.1
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 +103 -19
- package/Area.config.js.map +1 -1
- package/Area.js +646 -243
- package/Area.js.map +1 -1
- package/Bar.config.js +105 -21
- package/Bar.config.js.map +1 -1
- package/Bar.js +653 -237
- package/Bar.js.map +1 -1
- package/Bubble.config.js +95 -21
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +635 -229
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +66 -15
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +589 -211
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +104 -19
- package/Column.config.js.map +1 -1
- package/Column.js +666 -239
- package/Column.js.map +1 -1
- package/Ellipse.config.js +83 -18
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +444 -156
- package/Ellipse.js.map +1 -1
- package/Events.config.js +101 -19
- package/Events.config.js.map +1 -1
- package/Events.js +792 -322
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +97 -28
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +786 -390
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +63 -19
- package/Image.config.js.map +1 -1
- package/Image.js +439 -164
- package/Image.js.map +1 -1
- package/Line.config.js +107 -23
- package/Line.config.js.map +1 -1
- package/Line.js +841 -456
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +73 -23
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +653 -230
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +244 -99
- package/Map.config.js.map +1 -1
- package/Map.js +1223 -612
- package/Map.js.map +1 -1
- package/Markdown.config.js +71 -21
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +477 -202
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +80 -22
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +819 -418
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +73 -19
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +870 -491
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +76 -23
- package/Pie.config.js.map +1 -1
- package/Pie.js +643 -233
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +82 -30
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +863 -387
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +86 -20
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +449 -159
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +85 -23
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +895 -349
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +97 -23
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +639 -234
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +95 -25
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1198 -656
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +287 -226
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +93 -23
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +991 -522
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +100 -27
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1185 -624
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +127 -68
- package/SparkLine.js.map +1 -1
- package/Table.config.js +74 -21
- package/Table.config.js.map +1 -1
- package/Table.js +827 -329
- package/Table.js.map +1 -1
- package/common/Charting.js +152 -69
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +25 -14
- package/common/ChartingApi.js.map +1 -1
- package/common/DocExampleWithVizSandbox.js +530 -0
- package/common/DocExampleWithVizSandbox.js.map +1 -0
- package/common/EventsDoc.js +139 -104
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +79 -69
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +54 -45
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +178 -87
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +530 -68
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +47 -20
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +15 -9
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +57 -44
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +52 -20
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +139 -7
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +185 -102
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +28 -16
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +50 -15
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +8 -3
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +4 -2
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +2 -1
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +288 -128
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +242 -197
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +10 -1
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +62 -1
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +3 -1
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +389 -192
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +18 -26
package/ParallelCoordinates.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Splunk Inc.
|
|
3
3
|
* SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
4
4
|
* in part without a valid written license from Splunk Inc. is PROHIBITED.
|
|
5
5
|
*/
|
|
@@ -136,11 +136,17 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
|
136
136
|
Object.defineProperty(exports, "__esModule", {
|
|
137
137
|
value: true
|
|
138
138
|
});
|
|
139
|
+
|
|
139
140
|
var React = __webpack_require__(1);
|
|
141
|
+
|
|
140
142
|
var styled_components_1 = __webpack_require__(4);
|
|
143
|
+
|
|
141
144
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
145
|
+
|
|
142
146
|
var style_1 = __webpack_require__(14);
|
|
147
|
+
|
|
143
148
|
var colorUtils_1 = __webpack_require__(12);
|
|
149
|
+
|
|
144
150
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
145
151
|
var width = _ref.width;
|
|
146
152
|
return {
|
|
@@ -153,11 +159,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
|
153
159
|
componentId: "sc-1yhgpod-0"
|
|
154
160
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
155
161
|
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
156
|
-
});
|
|
157
|
-
|
|
162
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
163
|
+
|
|
158
164
|
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
159
165
|
var width = _ref2.width,
|
|
160
|
-
|
|
166
|
+
height = _ref2.height;
|
|
161
167
|
return {
|
|
162
168
|
style: Object.assign(Object.assign({}, width && {
|
|
163
169
|
width: (0, style_1.toPx)(width)
|
|
@@ -179,11 +185,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
|
179
185
|
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
180
186
|
componentId: "sc-1yhgpod-3"
|
|
181
187
|
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
188
|
+
|
|
182
189
|
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
183
190
|
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
184
191
|
var width = props.width,
|
|
185
|
-
|
|
186
|
-
|
|
192
|
+
height = props.height,
|
|
193
|
+
backgroundColor = props.backgroundColor;
|
|
194
|
+
|
|
187
195
|
if (!height) {
|
|
188
196
|
return React.createElement(Item, {
|
|
189
197
|
"data-test": "item",
|
|
@@ -191,24 +199,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
191
199
|
backgroundColor: backgroundColor
|
|
192
200
|
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
193
201
|
}
|
|
202
|
+
|
|
194
203
|
return React.createElement(FixSizeItem, {
|
|
195
204
|
"data-test": "fix-size-item",
|
|
196
|
-
"data-splunk-visualization-version": "26.
|
|
205
|
+
"data-splunk-visualization-version": "26.1.1 - b6df0a015",
|
|
197
206
|
width: width,
|
|
198
207
|
height: height,
|
|
199
208
|
backgroundColor: backgroundColor
|
|
200
209
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
201
210
|
var newWidth = _ref3.width,
|
|
202
|
-
|
|
211
|
+
newHeight = _ref3.height;
|
|
203
212
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
204
213
|
width: newWidth,
|
|
205
214
|
height: newHeight
|
|
206
215
|
}));
|
|
207
216
|
})));
|
|
208
217
|
};
|
|
218
|
+
|
|
209
219
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
210
220
|
return FixedSizeContainer;
|
|
211
221
|
};
|
|
222
|
+
|
|
212
223
|
exports.default = withFixedSizeContainer;
|
|
213
224
|
|
|
214
225
|
/***/ }),
|
|
@@ -236,9 +247,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
236
247
|
* @param {DashboardVizType} props.Wrapper
|
|
237
248
|
* @param {DashboardVizType} props.Visualization
|
|
238
249
|
*/
|
|
250
|
+
|
|
239
251
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
240
252
|
var Wrapper = _ref.Wrapper,
|
|
241
|
-
|
|
253
|
+
Visualization = _ref.Visualization;
|
|
242
254
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
243
255
|
extendProperties.forEach(function (prop) {
|
|
244
256
|
if (Visualization[prop]) {
|
|
@@ -247,6 +259,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
247
259
|
}
|
|
248
260
|
});
|
|
249
261
|
};
|
|
262
|
+
|
|
250
263
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
251
264
|
|
|
252
265
|
/***/ }),
|
|
@@ -258,7 +271,7 @@ module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
|
258
271
|
|
|
259
272
|
/***/ }),
|
|
260
273
|
|
|
261
|
-
/***/
|
|
274
|
+
/***/ 164:
|
|
262
275
|
/***/ (function(module, exports) {
|
|
263
276
|
|
|
264
277
|
module.exports = require("@mdhnpm/rgb-hex-converter");
|
|
@@ -300,24 +313,33 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
300
313
|
|
|
301
314
|
|
|
302
315
|
var _toConsumableArray = __webpack_require__(8);
|
|
316
|
+
|
|
303
317
|
var _defineProperty = __webpack_require__(7);
|
|
318
|
+
|
|
304
319
|
var __rest = this && this.__rest || function (s, e) {
|
|
305
320
|
var t = {};
|
|
321
|
+
|
|
306
322
|
for (var p in s) {
|
|
307
323
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
308
324
|
}
|
|
325
|
+
|
|
309
326
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
310
327
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
311
328
|
}
|
|
312
329
|
return t;
|
|
313
330
|
};
|
|
331
|
+
|
|
314
332
|
Object.defineProperty(exports, "__esModule", {
|
|
315
333
|
value: true
|
|
316
334
|
});
|
|
317
335
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
336
|
+
|
|
318
337
|
var lodash_1 = __webpack_require__(3);
|
|
338
|
+
|
|
319
339
|
var schemaUtils_1 = __webpack_require__(16);
|
|
340
|
+
|
|
320
341
|
var VizBehavior_1 = __webpack_require__(6);
|
|
342
|
+
|
|
321
343
|
var dynamicOptionsDSLType = {
|
|
322
344
|
type: 'string',
|
|
323
345
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -327,20 +349,22 @@ var dynamicOptionsDSLType = {
|
|
|
327
349
|
* @param optionsSchema a visualization's options schema
|
|
328
350
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
329
351
|
*/
|
|
352
|
+
|
|
330
353
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
331
354
|
var enhancedOptionsSchema = {};
|
|
332
355
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
333
356
|
var _a = optionsSchema[key],
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
357
|
+
title = _a.title,
|
|
358
|
+
description = _a.description,
|
|
359
|
+
readOnly = _a.readOnly,
|
|
360
|
+
writeOnly = _a.writeOnly,
|
|
361
|
+
examples = _a.examples,
|
|
362
|
+
defaultValue = _a.default,
|
|
363
|
+
type = _a.type,
|
|
364
|
+
properties = _a.properties,
|
|
365
|
+
patternProperties = _a.patternProperties,
|
|
366
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
367
|
+
|
|
344
368
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
345
369
|
title: title
|
|
346
370
|
}), description !== undefined && {
|
|
@@ -354,12 +378,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
354
378
|
}), defaultValue !== undefined && {
|
|
355
379
|
default: defaultValue
|
|
356
380
|
});
|
|
381
|
+
|
|
357
382
|
if (type === 'object') {
|
|
358
383
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
359
384
|
type: type
|
|
360
385
|
}), properties && {
|
|
361
386
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
362
387
|
});
|
|
388
|
+
|
|
363
389
|
if (patternProperties) {
|
|
364
390
|
var enhancedPatternProperties = {};
|
|
365
391
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -377,6 +403,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
377
403
|
});
|
|
378
404
|
return enhancedOptionsSchema;
|
|
379
405
|
}
|
|
406
|
+
|
|
380
407
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
381
408
|
/**
|
|
382
409
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -385,11 +412,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
385
412
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
386
413
|
* and containing `open: false` for all editor panels in editorConfig
|
|
387
414
|
*/
|
|
415
|
+
|
|
388
416
|
function enhanceConfig(vizConfig) {
|
|
389
417
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
418
|
+
|
|
390
419
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
391
420
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
392
421
|
}
|
|
422
|
+
|
|
393
423
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
394
424
|
return Object.assign(Object.assign({}, config), {
|
|
395
425
|
open: config.open || false
|
|
@@ -397,6 +427,7 @@ function enhanceConfig(vizConfig) {
|
|
|
397
427
|
});
|
|
398
428
|
return enhancedConfig;
|
|
399
429
|
}
|
|
430
|
+
|
|
400
431
|
exports.enhanceConfig = enhanceConfig;
|
|
401
432
|
/**
|
|
402
433
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -404,6 +435,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
404
435
|
* @param vizConfig a Visualization Config
|
|
405
436
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
406
437
|
*/
|
|
438
|
+
|
|
407
439
|
function uncollapseEditorConfig(vizConfig) {
|
|
408
440
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
409
441
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -413,13 +445,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
413
445
|
});
|
|
414
446
|
return editorPanelUncollapsedConfig;
|
|
415
447
|
}
|
|
448
|
+
|
|
416
449
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
450
|
+
|
|
417
451
|
function isDynamicOption(option) {
|
|
418
452
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
419
453
|
}
|
|
420
|
-
|
|
421
|
-
// private helpers to improve readability of getInitialPreset
|
|
454
|
+
|
|
455
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
422
456
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
457
|
+
|
|
423
458
|
/**
|
|
424
459
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
425
460
|
* 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
|
|
@@ -428,6 +463,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
428
463
|
*
|
|
429
464
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
430
465
|
*/
|
|
466
|
+
|
|
431
467
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
432
468
|
var presetContextKeys = Object.keys(presetContext);
|
|
433
469
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -437,6 +473,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
437
473
|
/**
|
|
438
474
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
439
475
|
*/
|
|
476
|
+
|
|
477
|
+
|
|
440
478
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
441
479
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
442
480
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -451,18 +489,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
451
489
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
452
490
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
453
491
|
*/
|
|
492
|
+
|
|
493
|
+
|
|
454
494
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
455
495
|
return presets.find(function (preset) {
|
|
456
496
|
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
457
497
|
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
458
498
|
var presetContextKeys = Object.keys(presetContext);
|
|
459
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
460
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
499
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
461
500
|
// if not, then the preset is invalid in config.ts
|
|
501
|
+
|
|
462
502
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
463
503
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
464
504
|
});
|
|
465
505
|
}
|
|
506
|
+
|
|
466
507
|
exports.getInitialPreset = getInitialPreset;
|
|
467
508
|
/**
|
|
468
509
|
* generates number precision values for a Select editor
|
|
@@ -470,6 +511,7 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
470
511
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
471
512
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
472
513
|
*/
|
|
514
|
+
|
|
473
515
|
function generatePrecisionValues(numPrecisionValues) {
|
|
474
516
|
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
475
517
|
return {
|
|
@@ -478,6 +520,7 @@ function generatePrecisionValues(numPrecisionValues) {
|
|
|
478
520
|
};
|
|
479
521
|
});
|
|
480
522
|
}
|
|
523
|
+
|
|
481
524
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
482
525
|
/**
|
|
483
526
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -487,12 +530,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
487
530
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
488
531
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
489
532
|
*/
|
|
533
|
+
|
|
490
534
|
var insertLayout = function insertLayout(layout, index) {
|
|
491
535
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
492
536
|
layoutItems[_key - 2] = arguments[_key];
|
|
493
537
|
}
|
|
538
|
+
|
|
494
539
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
495
540
|
};
|
|
541
|
+
|
|
496
542
|
exports.insertLayout = insertLayout;
|
|
497
543
|
|
|
498
544
|
/***/ }),
|
|
@@ -559,25 +605,38 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
559
605
|
/* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(49);
|
|
560
606
|
/* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__);
|
|
561
607
|
|
|
608
|
+
|
|
562
609
|
function ownKeys(object, enumerableOnly) {
|
|
563
610
|
var keys = Object.keys(object);
|
|
611
|
+
|
|
564
612
|
if (Object.getOwnPropertySymbols) {
|
|
565
613
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
566
|
-
enumerableOnly
|
|
614
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
567
615
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
568
|
-
})
|
|
616
|
+
});
|
|
617
|
+
keys.push.apply(keys, symbols);
|
|
569
618
|
}
|
|
619
|
+
|
|
570
620
|
return keys;
|
|
571
621
|
}
|
|
622
|
+
|
|
572
623
|
function _objectSpread(target) {
|
|
573
624
|
for (var i = 1; i < arguments.length; i++) {
|
|
574
|
-
var source =
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
625
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
626
|
+
|
|
627
|
+
if (i % 2) {
|
|
628
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
629
|
+
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]);
|
|
630
|
+
});
|
|
631
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
632
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
633
|
+
} else {
|
|
634
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
635
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
636
|
+
});
|
|
637
|
+
}
|
|
580
638
|
}
|
|
639
|
+
|
|
581
640
|
return target;
|
|
582
641
|
}
|
|
583
642
|
|
|
@@ -585,6 +644,7 @@ function _objectSpread(target) {
|
|
|
585
644
|
|
|
586
645
|
|
|
587
646
|
|
|
647
|
+
|
|
588
648
|
var DEFAULT_FONT = 12;
|
|
589
649
|
var DEFAULT_FONT_FAMILY = '"Splunk Platform Sans", "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans-serif';
|
|
590
650
|
var SVR_PADDING = {
|
|
@@ -593,28 +653,27 @@ var SVR_PADDING = {
|
|
|
593
653
|
left: 16,
|
|
594
654
|
right: 16
|
|
595
655
|
};
|
|
596
|
-
|
|
597
656
|
/**
|
|
598
657
|
* @method shouldShowTrend
|
|
599
658
|
* @param {String} trendDisplay
|
|
600
659
|
* @returns {Bool}
|
|
601
660
|
*/
|
|
661
|
+
|
|
602
662
|
var shouldShowTrend = function shouldShowTrend(trendDisplay) {
|
|
603
663
|
return trendDisplay === 'absolute' || trendDisplay === 'percent';
|
|
604
664
|
};
|
|
605
|
-
|
|
606
665
|
/**
|
|
607
666
|
* @method isLoadingOrNoColumns
|
|
608
667
|
* @param {Object} dataSources
|
|
609
668
|
* @param {Boolean} loading
|
|
610
669
|
* @returns {Boolean} return true if loading or without columns in dataSources
|
|
611
670
|
*/
|
|
671
|
+
|
|
612
672
|
var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
|
|
613
673
|
var data = Object(lodash__WEBPACK_IMPORTED_MODULE_1__["get"])(dataSources, 'primary.data.columns[0]', undefined);
|
|
614
674
|
var noColumns = data === undefined;
|
|
615
675
|
return loading || noColumns;
|
|
616
676
|
};
|
|
617
|
-
|
|
618
677
|
/**
|
|
619
678
|
* Retrieve the valid formatted color
|
|
620
679
|
* @method getFormattedColor
|
|
@@ -622,30 +681,30 @@ var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
|
|
|
622
681
|
* @param {String} defaultColor
|
|
623
682
|
* @returns {String} the formatted color
|
|
624
683
|
*/
|
|
684
|
+
|
|
625
685
|
var getFormattedColor = function getFormattedColor(color, defaultColor) {
|
|
626
686
|
return Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(color) || Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(defaultColor);
|
|
627
687
|
};
|
|
628
|
-
|
|
629
688
|
/**
|
|
630
689
|
* Determines if there is a background color
|
|
631
690
|
* @method hasBackground
|
|
632
691
|
* @param {String} backgroundColor
|
|
633
692
|
* @returns true for non-transparent background color
|
|
634
693
|
*/
|
|
694
|
+
|
|
635
695
|
var hasBackground = function hasBackground(backgroundColor) {
|
|
636
696
|
return !!backgroundColor && backgroundColor !== 'transparent';
|
|
637
697
|
};
|
|
638
|
-
|
|
639
698
|
/**
|
|
640
699
|
* @method isIdenticalColor
|
|
641
700
|
* @param {String} colorA
|
|
642
701
|
* @param {String} colorB
|
|
643
702
|
* @returns {Boolean}
|
|
644
703
|
*/
|
|
704
|
+
|
|
645
705
|
var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
|
|
646
706
|
return !!colorA && !!colorB && Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(colorA.toLowerCase()) === Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(colorB.toLowerCase());
|
|
647
707
|
};
|
|
648
|
-
|
|
649
708
|
/*
|
|
650
709
|
* @method getDefaultColorWithBg
|
|
651
710
|
* @param {Object} props
|
|
@@ -654,13 +713,13 @@ var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
|
|
|
654
713
|
* @param {String} props.defaultBlockFontColor
|
|
655
714
|
* @returns {String} defaultColor
|
|
656
715
|
*/
|
|
716
|
+
|
|
657
717
|
var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
|
|
658
718
|
var backgroundColor = _ref.backgroundColor,
|
|
659
|
-
|
|
660
|
-
|
|
719
|
+
defaultFontColor = _ref.defaultFontColor,
|
|
720
|
+
defaultBlockFontColor = _ref.defaultBlockFontColor;
|
|
661
721
|
return isIdenticalColor(backgroundColor, defaultBlockFontColor) ? defaultFontColor : defaultBlockFontColor;
|
|
662
722
|
};
|
|
663
|
-
|
|
664
723
|
/*
|
|
665
724
|
* @method getMajorColor
|
|
666
725
|
* return formatted majorColor.
|
|
@@ -671,15 +730,16 @@ var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
|
|
|
671
730
|
* @param {String} props.defaultBlockFontColor
|
|
672
731
|
* @returns {String} majorColor
|
|
673
732
|
*/
|
|
733
|
+
|
|
674
734
|
var getMajorColor = function getMajorColor(_ref2) {
|
|
675
735
|
var majorColor = _ref2.majorColor,
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
// If backgroundColor is set, but no majorColor,
|
|
736
|
+
backgroundColor = _ref2.backgroundColor,
|
|
737
|
+
defaultFontColor = _ref2.defaultFontColor,
|
|
738
|
+
defaultBlockFontColor = _ref2.defaultBlockFontColor; // If backgroundColor is set, but no majorColor,
|
|
680
739
|
// the default majorColor will turn to be defaultBlockFontColor.
|
|
681
740
|
// eg: major color will turn to be white in enterprise mode.
|
|
682
741
|
// however, if the bgColor is the same as defaultBlockFontColor, use defaultFontColor.
|
|
742
|
+
|
|
683
743
|
if (hasBackground(backgroundColor) && !majorColor) {
|
|
684
744
|
return getDefaultColorWithBg({
|
|
685
745
|
backgroundColor: backgroundColor,
|
|
@@ -687,9 +747,9 @@ var getMajorColor = function getMajorColor(_ref2) {
|
|
|
687
747
|
defaultBlockFontColor: defaultBlockFontColor
|
|
688
748
|
});
|
|
689
749
|
}
|
|
750
|
+
|
|
690
751
|
return getFormattedColor(majorColor, defaultFontColor);
|
|
691
752
|
};
|
|
692
|
-
|
|
693
753
|
/**
|
|
694
754
|
* Get the color for the trend components
|
|
695
755
|
* @method getTrendColor
|
|
@@ -702,35 +762,41 @@ var getMajorColor = function getMajorColor(_ref2) {
|
|
|
702
762
|
* @param {Object} defaultColors
|
|
703
763
|
* @returns {String} trendColor
|
|
704
764
|
*/
|
|
765
|
+
|
|
705
766
|
var getTrendColor = function getTrendColor(_ref3) {
|
|
706
767
|
var trendColor = _ref3.trendColor,
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
768
|
+
trendValue = _ref3.trendValue,
|
|
769
|
+
majorValue = _ref3.majorValue,
|
|
770
|
+
customizedBgColor = _ref3.customizedBgColor,
|
|
771
|
+
trendDisplay = _ref3.trendDisplay,
|
|
772
|
+
defaultColors = _ref3.defaultColors;
|
|
773
|
+
|
|
712
774
|
if (trendColor) {
|
|
713
775
|
return trendColor;
|
|
714
776
|
}
|
|
777
|
+
|
|
715
778
|
if (Number.isNaN(Number(trendValue))) {
|
|
716
779
|
return undefined;
|
|
717
780
|
}
|
|
781
|
+
|
|
718
782
|
var defaultFontColor = defaultColors.defaultFontColor,
|
|
719
|
-
|
|
720
|
-
|
|
783
|
+
defaultBlockFontColor = defaultColors.defaultBlockFontColor,
|
|
784
|
+
defaultBackgroundColor = defaultColors.defaultBackgroundColor; // if user defined a backgroundColor, the default trend color will be defaultBlockFontColor
|
|
785
|
+
|
|
721
786
|
if (hasBackground(customizedBgColor) && !isIdenticalColor(customizedBgColor, defaultBackgroundColor) && !isIdenticalColor(customizedBgColor, defaultBlockFontColor)) {
|
|
722
787
|
return defaultBlockFontColor;
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
// if trendDisplay is percent, and trendValue === value
|
|
788
|
+
} // if trendDisplay is percent, and trendValue === value
|
|
726
789
|
// the trend percent = trendValue / (value - trendValue) will return Infinity
|
|
790
|
+
|
|
791
|
+
|
|
727
792
|
var isInvalidTrend = trendDisplay === 'percent' && trendValue === parseFloat(majorValue);
|
|
793
|
+
|
|
728
794
|
if (trendValue === 0 || isInvalidTrend) {
|
|
729
795
|
return defaultFontColor;
|
|
730
796
|
}
|
|
797
|
+
|
|
731
798
|
return trendValue > 0 ? _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_GREEN"] : _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_RED"];
|
|
732
799
|
};
|
|
733
|
-
|
|
734
800
|
/**
|
|
735
801
|
* Computes visualization properties for display component
|
|
736
802
|
* @method computeColors
|
|
@@ -743,6 +809,7 @@ var getTrendColor = function getTrendColor(_ref3) {
|
|
|
743
809
|
* @returns {String} trendColor
|
|
744
810
|
* @returns {String} underLabelColor
|
|
745
811
|
*/
|
|
812
|
+
|
|
746
813
|
var computeColors = function computeColors(props, defaultColors) {
|
|
747
814
|
var backgroundColor = getFormattedColor(props.backgroundColor, defaultColors.defaultBackgroundColor);
|
|
748
815
|
var backgroundEnabled = hasBackground(backgroundColor);
|
|
@@ -759,8 +826,8 @@ var computeColors = function computeColors(props, defaultColors) {
|
|
|
759
826
|
customizedBgColor: props.backgroundColor,
|
|
760
827
|
trendDisplay: props.trendDisplay,
|
|
761
828
|
defaultColors: defaultColors
|
|
762
|
-
});
|
|
763
|
-
|
|
829
|
+
}); // todo: need change it to not depend on majorColor
|
|
830
|
+
|
|
764
831
|
var underLabelColor = majorColor;
|
|
765
832
|
return {
|
|
766
833
|
backgroundColor: backgroundColor,
|
|
@@ -770,7 +837,6 @@ var computeColors = function computeColors(props, defaultColors) {
|
|
|
770
837
|
underLabelColor: underLabelColor
|
|
771
838
|
};
|
|
772
839
|
};
|
|
773
|
-
|
|
774
840
|
/**
|
|
775
841
|
* Format and return the value (major/trend)
|
|
776
842
|
* @method computeText
|
|
@@ -781,21 +847,21 @@ var computeColors = function computeColors(props, defaultColors) {
|
|
|
781
847
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
782
848
|
* @returns {Number} major or trend text
|
|
783
849
|
*/
|
|
850
|
+
|
|
784
851
|
var computeText = function computeText(_ref4) {
|
|
785
852
|
var value = _ref4.value,
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
853
|
+
numberPrecision = _ref4.numberPrecision,
|
|
854
|
+
shouldUseThousandSeparators = _ref4.shouldUseThousandSeparators,
|
|
855
|
+
shouldAbbreviateTrendValue = _ref4.shouldAbbreviateTrendValue;
|
|
789
856
|
var text = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(value) ? Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["formatNumber"])(value, numberPrecision, {
|
|
790
857
|
useThousandSeparators: shouldUseThousandSeparators,
|
|
791
858
|
// todo: need update formatNumber
|
|
792
859
|
useTrendUnits: shouldAbbreviateTrendValue
|
|
793
|
-
}) : value;
|
|
794
|
-
|
|
860
|
+
}) : value; // When text is undefined, return empty string
|
|
861
|
+
|
|
795
862
|
text = text || '';
|
|
796
863
|
return text;
|
|
797
864
|
};
|
|
798
|
-
|
|
799
865
|
/*
|
|
800
866
|
* @method getMajorText
|
|
801
867
|
* @param {Object} props
|
|
@@ -804,10 +870,11 @@ var computeText = function computeText(_ref4) {
|
|
|
804
870
|
* @param {Bool} props.shouldUseThousandSeparators
|
|
805
871
|
* @returns {String} majorText
|
|
806
872
|
*/
|
|
873
|
+
|
|
807
874
|
var getMajorText = function getMajorText(_ref5) {
|
|
808
875
|
var majorValue = _ref5.majorValue,
|
|
809
|
-
|
|
810
|
-
|
|
876
|
+
numberPrecision = _ref5.numberPrecision,
|
|
877
|
+
shouldUseThousandSeparators = _ref5.shouldUseThousandSeparators;
|
|
811
878
|
return computeText({
|
|
812
879
|
value: majorValue === null ? 'N/A' : majorValue,
|
|
813
880
|
// if majorValue is null, use `N/A`.
|
|
@@ -816,7 +883,6 @@ var getMajorText = function getMajorText(_ref5) {
|
|
|
816
883
|
shouldAbbreviateTrendValue: false
|
|
817
884
|
});
|
|
818
885
|
};
|
|
819
|
-
|
|
820
886
|
/*
|
|
821
887
|
* @method getTrendText
|
|
822
888
|
* @param {Object} props
|
|
@@ -828,13 +894,15 @@ var getMajorText = function getMajorText(_ref5) {
|
|
|
828
894
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
829
895
|
* @returns {String} trendText
|
|
830
896
|
*/
|
|
897
|
+
|
|
831
898
|
var getTrendText = function getTrendText(_ref6) {
|
|
832
899
|
var majorValue = _ref6.majorValue,
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
900
|
+
trendValue = _ref6.trendValue,
|
|
901
|
+
trendDisplay = _ref6.trendDisplay,
|
|
902
|
+
numberPrecision = _ref6.numberPrecision,
|
|
903
|
+
shouldUseThousandSeparators = _ref6.shouldUseThousandSeparators,
|
|
904
|
+
shouldAbbreviateTrendValue = _ref6.shouldAbbreviateTrendValue;
|
|
905
|
+
|
|
838
906
|
var compute = function compute(value) {
|
|
839
907
|
return computeText({
|
|
840
908
|
value: value,
|
|
@@ -843,25 +911,31 @@ var getTrendText = function getTrendText(_ref6) {
|
|
|
843
911
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
844
912
|
});
|
|
845
913
|
};
|
|
914
|
+
|
|
846
915
|
if (trendValue === '' || !Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue)) {
|
|
847
916
|
return '';
|
|
848
917
|
}
|
|
918
|
+
|
|
849
919
|
var showPercent = trendDisplay === 'percent';
|
|
920
|
+
|
|
850
921
|
if (!showPercent) {
|
|
851
922
|
return compute(trendValue);
|
|
852
923
|
}
|
|
924
|
+
|
|
853
925
|
var diff = Math.abs(trendValue - majorValue);
|
|
854
926
|
var val = Math.round(trendValue / diff * 100);
|
|
927
|
+
|
|
855
928
|
if (trendValue === 0 && diff === 0) {
|
|
856
929
|
val = 0;
|
|
857
930
|
}
|
|
931
|
+
|
|
858
932
|
if (!Number.isFinite(val)) {
|
|
859
933
|
return 'N/A';
|
|
860
934
|
}
|
|
935
|
+
|
|
861
936
|
var text = compute(val);
|
|
862
937
|
return "".concat(text, "%");
|
|
863
938
|
};
|
|
864
|
-
|
|
865
939
|
/**
|
|
866
940
|
* Helper to determine the font size for an element
|
|
867
941
|
* @method computeFontSize
|
|
@@ -873,16 +947,16 @@ var getTrendText = function getTrendText(_ref6) {
|
|
|
873
947
|
* @param {String} [fontWeight='normal'] Boldness of font
|
|
874
948
|
* @returns {Number} The size to use for fontSize styles
|
|
875
949
|
*/
|
|
950
|
+
|
|
876
951
|
var computeFontSize = function computeFontSize(text, _ref7) {
|
|
877
952
|
var width = _ref7.width,
|
|
878
|
-
|
|
953
|
+
height = _ref7.height;
|
|
879
954
|
var fontFamily = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_FONT_FAMILY;
|
|
880
955
|
var fontWeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'normal';
|
|
881
956
|
var widthInDefaultFont = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(DEFAULT_FONT, "px ").concat(fontFamily));
|
|
882
957
|
var fontSize = Math.min(width / widthInDefaultFont * DEFAULT_FONT, height / DEFAULT_FONT * DEFAULT_FONT);
|
|
883
958
|
return parseInt(fontSize, 10);
|
|
884
959
|
};
|
|
885
|
-
|
|
886
960
|
/*
|
|
887
961
|
* @method getMajorFontSize
|
|
888
962
|
* @param {Object} props
|
|
@@ -893,20 +967,20 @@ var computeFontSize = function computeFontSize(text, _ref7) {
|
|
|
893
967
|
* @param {Number} props.spaceRatio
|
|
894
968
|
* @returns {Number} majorFontSize
|
|
895
969
|
*/
|
|
970
|
+
|
|
896
971
|
var getMajorFontSize = function getMajorFontSize(_ref8) {
|
|
897
972
|
var width = _ref8.width,
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
973
|
+
height = _ref8.height,
|
|
974
|
+
unit = _ref8.unit,
|
|
975
|
+
majorText = _ref8.majorText,
|
|
976
|
+
_ref8$spaceRatio = _ref8.spaceRatio,
|
|
977
|
+
spaceRatio = _ref8$spaceRatio === void 0 ? 1 : _ref8$spaceRatio;
|
|
903
978
|
var majorTextCalc = unit ? "".concat(unit).concat(majorText) : majorText;
|
|
904
979
|
return computeFontSize(majorTextCalc, {
|
|
905
980
|
width: width * spaceRatio,
|
|
906
981
|
height: height
|
|
907
982
|
});
|
|
908
983
|
};
|
|
909
|
-
|
|
910
984
|
/*
|
|
911
985
|
* @method getTrendFontSize
|
|
912
986
|
* @param {Object} props
|
|
@@ -916,13 +990,15 @@ var getMajorFontSize = function getMajorFontSize(_ref8) {
|
|
|
916
990
|
* @param {Number} props.spaceRatio
|
|
917
991
|
* @returns {Number} trendFontSize
|
|
918
992
|
*/
|
|
993
|
+
|
|
919
994
|
var getTrendFontSize = function getTrendFontSize(_ref9) {
|
|
920
995
|
var width = _ref9.width,
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
996
|
+
height = _ref9.height,
|
|
997
|
+
trendText = _ref9.trendText,
|
|
998
|
+
_ref9$spaceRatio = _ref9.spaceRatio,
|
|
999
|
+
spaceRatio = _ref9$spaceRatio === void 0 ? 1 : _ref9$spaceRatio;
|
|
925
1000
|
var trendFontSize = 12;
|
|
1001
|
+
|
|
926
1002
|
if (spaceRatio > 0) {
|
|
927
1003
|
trendFontSize = computeFontSize(trendText, {
|
|
928
1004
|
width: width * spaceRatio,
|
|
@@ -930,18 +1006,18 @@ var getTrendFontSize = function getTrendFontSize(_ref9) {
|
|
|
930
1006
|
});
|
|
931
1007
|
trendFontSize = parseInt(trendFontSize, 10) * spaceRatio;
|
|
932
1008
|
}
|
|
1009
|
+
|
|
933
1010
|
return trendFontSize;
|
|
934
1011
|
};
|
|
935
|
-
|
|
936
1012
|
/*
|
|
937
1013
|
* The height of underLabel should no more than 12px
|
|
938
1014
|
* @param {Number} height
|
|
939
1015
|
* @return {Number} height || DEFAULT_FONT
|
|
940
1016
|
*/
|
|
1017
|
+
|
|
941
1018
|
var getUnderLabelHeight = function getUnderLabelHeight(height) {
|
|
942
1019
|
return height > DEFAULT_FONT ? DEFAULT_FONT : height;
|
|
943
1020
|
};
|
|
944
|
-
|
|
945
1021
|
/*
|
|
946
1022
|
* @param {Object} config
|
|
947
1023
|
* @param {String} underLabel
|
|
@@ -949,19 +1025,18 @@ var getUnderLabelHeight = function getUnderLabelHeight(height) {
|
|
|
949
1025
|
* @param {Number} height height of underLabel
|
|
950
1026
|
* @param {Number} fond size of underLabel
|
|
951
1027
|
*/
|
|
1028
|
+
|
|
952
1029
|
var getUnderLabel = function getUnderLabel(_ref10) {
|
|
953
1030
|
var underLabel = _ref10.underLabel,
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
return (
|
|
957
|
-
// todo: may need truncate underLabel later
|
|
1031
|
+
width = _ref10.width,
|
|
1032
|
+
height = _ref10.height;
|
|
1033
|
+
return (// todo: may need truncate underLabel later
|
|
958
1034
|
computeFontSize(underLabel, {
|
|
959
1035
|
width: width,
|
|
960
1036
|
height: height
|
|
961
1037
|
})
|
|
962
1038
|
);
|
|
963
1039
|
};
|
|
964
|
-
|
|
965
1040
|
/**
|
|
966
1041
|
* Compute value and font size for major and trend
|
|
967
1042
|
* @method getMajorAndTrend
|
|
@@ -979,18 +1054,19 @@ var getUnderLabel = function getUnderLabel(_ref10) {
|
|
|
979
1054
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
980
1055
|
* @returns {Number, Number, Number, Number} Major text, trend text, major text size, trend text size
|
|
981
1056
|
*/
|
|
1057
|
+
|
|
982
1058
|
var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
983
1059
|
var width = _ref11.width,
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1060
|
+
height = _ref11.height,
|
|
1061
|
+
majorValue = _ref11.majorValue,
|
|
1062
|
+
trendValue = _ref11.trendValue,
|
|
1063
|
+
majorFontSize = _ref11.majorFontSize,
|
|
1064
|
+
trendFontSize = _ref11.trendFontSize,
|
|
1065
|
+
trendDisplay = _ref11.trendDisplay,
|
|
1066
|
+
unit = _ref11.unit,
|
|
1067
|
+
numberPrecision = _ref11.numberPrecision,
|
|
1068
|
+
shouldUseThousandSeparators = _ref11.shouldUseThousandSeparators,
|
|
1069
|
+
shouldAbbreviateTrendValue = _ref11.shouldAbbreviateTrendValue;
|
|
994
1070
|
var majorTextSpaceRatio = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue) && shouldShowTrend(trendDisplay) ? 0.6 : 1;
|
|
995
1071
|
var textContentWidth = width * 0.9;
|
|
996
1072
|
var textContentHeight = height * 0.9;
|
|
@@ -1027,7 +1103,6 @@ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
|
1027
1103
|
trendTextFontSize: trendTextFontSize
|
|
1028
1104
|
};
|
|
1029
1105
|
};
|
|
1030
|
-
|
|
1031
1106
|
/*
|
|
1032
1107
|
* @method updateVizInSmallSpace
|
|
1033
1108
|
* @param {Object} props
|
|
@@ -1047,25 +1122,26 @@ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
|
1047
1122
|
* @returns {Object} results.newMajorAndTrend
|
|
1048
1123
|
* @returns {Object} results.updatedProps
|
|
1049
1124
|
*/
|
|
1125
|
+
|
|
1050
1126
|
var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
1051
1127
|
var width = _ref12.width,
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1128
|
+
height = _ref12.height,
|
|
1129
|
+
toRemoveList = _ref12.toRemoveList,
|
|
1130
|
+
majorValue = _ref12.majorValue,
|
|
1131
|
+
trendValue = _ref12.trendValue,
|
|
1132
|
+
majorFontSize = _ref12.majorFontSize,
|
|
1133
|
+
trendFontSize = _ref12.trendFontSize,
|
|
1134
|
+
majorTextFontSize = _ref12.majorTextFontSize,
|
|
1135
|
+
unit = _ref12.unit,
|
|
1136
|
+
numberPrecision = _ref12.numberPrecision,
|
|
1137
|
+
shouldUseThousandSeparators = _ref12.shouldUseThousandSeparators,
|
|
1138
|
+
shouldAbbreviateTrendValue = _ref12.shouldAbbreviateTrendValue;
|
|
1063
1139
|
var removeIndex = 0;
|
|
1064
1140
|
var newProps = {}; // options need to be updated
|
|
1141
|
+
|
|
1065
1142
|
var newMajorAndTrend = {};
|
|
1066
|
-
var newTextSize = majorTextFontSize;
|
|
1143
|
+
var newTextSize = majorTextFontSize; // remove info on viz to make textFontSize >= 12px;
|
|
1067
1144
|
|
|
1068
|
-
// remove info on viz to make textFontSize >= 12px;
|
|
1069
1145
|
while (newTextSize < 12 && removeIndex < toRemoveList.length) {
|
|
1070
1146
|
var toRemove = toRemoveList[removeIndex];
|
|
1071
1147
|
newProps = _objectSpread(_objectSpread({}, newProps), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, toRemove.key, toRemove.value));
|
|
@@ -1083,9 +1159,9 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
|
1083
1159
|
}, newProps));
|
|
1084
1160
|
newTextSize = newMajorAndTrend.majorTextFontSize;
|
|
1085
1161
|
removeIndex += 1;
|
|
1086
|
-
}
|
|
1162
|
+
} // truncate text if textFontSize is still less than 12
|
|
1163
|
+
|
|
1087
1164
|
|
|
1088
|
-
// truncate text if textFontSize is still less than 12
|
|
1089
1165
|
if (newTextSize < 12) {
|
|
1090
1166
|
var truncateValue = "".concat(majorValue.toString().slice(0, 3), "...");
|
|
1091
1167
|
newMajorAndTrend = getMajorAndTrend(_objectSpread({
|
|
@@ -1101,12 +1177,12 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
|
1101
1177
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
1102
1178
|
}, newProps));
|
|
1103
1179
|
}
|
|
1180
|
+
|
|
1104
1181
|
return {
|
|
1105
1182
|
newMajorAndTrend: newMajorAndTrend,
|
|
1106
1183
|
updatedProps: newProps
|
|
1107
1184
|
};
|
|
1108
1185
|
};
|
|
1109
|
-
|
|
1110
1186
|
/*
|
|
1111
1187
|
* @method computeSingleValueContent
|
|
1112
1188
|
* @param {Object} props
|
|
@@ -1132,67 +1208,71 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
|
1132
1208
|
* @returns {String} results.majorValueTitle
|
|
1133
1209
|
* @returns {Object} results.smallVizProps
|
|
1134
1210
|
*/
|
|
1211
|
+
|
|
1135
1212
|
var computeSingleValueContent = function computeSingleValueContent(_ref13) {
|
|
1136
1213
|
var contentWidth = _ref13.contentWidth,
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1214
|
+
contentHeight = _ref13.contentHeight,
|
|
1215
|
+
containerWidth = _ref13.containerWidth,
|
|
1216
|
+
containerHeight = _ref13.containerHeight,
|
|
1217
|
+
majorValue = _ref13.majorValue,
|
|
1218
|
+
trendValue = _ref13.trendValue,
|
|
1219
|
+
majorFontSize = _ref13.majorFontSize,
|
|
1220
|
+
trendFontSize = _ref13.trendFontSize,
|
|
1221
|
+
trendDisplay = _ref13.trendDisplay,
|
|
1222
|
+
unit = _ref13.unit,
|
|
1223
|
+
numberPrecision = _ref13.numberPrecision,
|
|
1224
|
+
shouldUseThousandSeparators = _ref13.shouldUseThousandSeparators,
|
|
1225
|
+
shouldAbbreviateTrendValue = _ref13.shouldAbbreviateTrendValue,
|
|
1226
|
+
toRemoveList = _ref13.toRemoveList;
|
|
1227
|
+
|
|
1150
1228
|
var _getMajorAndTrend = getMajorAndTrend({
|
|
1229
|
+
majorValue: majorValue,
|
|
1230
|
+
trendValue: trendValue,
|
|
1231
|
+
majorFontSize: majorFontSize,
|
|
1232
|
+
trendFontSize: trendFontSize,
|
|
1233
|
+
trendDisplay: trendDisplay,
|
|
1234
|
+
width: contentWidth,
|
|
1235
|
+
height: contentHeight,
|
|
1236
|
+
unit: unit,
|
|
1237
|
+
numberPrecision: numberPrecision,
|
|
1238
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
1239
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
1240
|
+
}),
|
|
1241
|
+
majorText = _getMajorAndTrend.majorText,
|
|
1242
|
+
trendText = _getMajorAndTrend.trendText,
|
|
1243
|
+
majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
|
|
1244
|
+
trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
|
|
1245
|
+
|
|
1246
|
+
var majorValueTitle = majorText;
|
|
1247
|
+
var smallVizProps = {}; // update viz in small space
|
|
1248
|
+
// if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
|
|
1249
|
+
// or truncate major value to make the major font size >= 12
|
|
1250
|
+
|
|
1251
|
+
if (majorTextFontSize < 12) {
|
|
1252
|
+
var _updateVizInSmallSpac = updateVizInSmallSpace({
|
|
1253
|
+
width: containerWidth,
|
|
1254
|
+
height: containerHeight,
|
|
1255
|
+
toRemoveList: toRemoveList,
|
|
1151
1256
|
majorValue: majorValue,
|
|
1152
1257
|
trendValue: trendValue,
|
|
1153
1258
|
majorFontSize: majorFontSize,
|
|
1154
1259
|
trendFontSize: trendFontSize,
|
|
1155
|
-
|
|
1156
|
-
width: contentWidth,
|
|
1157
|
-
height: contentHeight,
|
|
1260
|
+
majorTextFontSize: majorTextFontSize,
|
|
1158
1261
|
unit: unit,
|
|
1159
1262
|
numberPrecision: numberPrecision,
|
|
1160
1263
|
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
1161
1264
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
1162
1265
|
}),
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
|
|
1166
|
-
trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
|
|
1167
|
-
var majorValueTitle = majorText;
|
|
1168
|
-
var smallVizProps = {};
|
|
1266
|
+
newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
|
|
1267
|
+
updatedProps = _updateVizInSmallSpac.updatedProps;
|
|
1169
1268
|
|
|
1170
|
-
// update viz in small space
|
|
1171
|
-
// if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
|
|
1172
|
-
// or truncate major value to make the major font size >= 12
|
|
1173
|
-
if (majorTextFontSize < 12) {
|
|
1174
|
-
var _updateVizInSmallSpac = updateVizInSmallSpace({
|
|
1175
|
-
width: containerWidth,
|
|
1176
|
-
height: containerHeight,
|
|
1177
|
-
toRemoveList: toRemoveList,
|
|
1178
|
-
majorValue: majorValue,
|
|
1179
|
-
trendValue: trendValue,
|
|
1180
|
-
majorFontSize: majorFontSize,
|
|
1181
|
-
trendFontSize: trendFontSize,
|
|
1182
|
-
majorTextFontSize: majorTextFontSize,
|
|
1183
|
-
unit: unit,
|
|
1184
|
-
numberPrecision: numberPrecision,
|
|
1185
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
1186
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
1187
|
-
}),
|
|
1188
|
-
newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
|
|
1189
|
-
updatedProps = _updateVizInSmallSpac.updatedProps;
|
|
1190
1269
|
majorText = newMajorAndTrend.majorText;
|
|
1191
1270
|
trendText = newMajorAndTrend.trendText;
|
|
1192
1271
|
majorTextFontSize = newMajorAndTrend.majorTextFontSize;
|
|
1193
1272
|
trendTextFontSize = newMajorAndTrend.trendTextFontSize;
|
|
1194
1273
|
smallVizProps = updatedProps;
|
|
1195
1274
|
}
|
|
1275
|
+
|
|
1196
1276
|
return {
|
|
1197
1277
|
majorText: majorText,
|
|
1198
1278
|
trendText: trendText,
|
|
@@ -1204,17 +1284,17 @@ var computeSingleValueContent = function computeSingleValueContent(_ref13) {
|
|
|
1204
1284
|
};
|
|
1205
1285
|
var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_ref14) {
|
|
1206
1286
|
var text = _ref14.text,
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1287
|
+
_ref14$fontSize = _ref14.fontSize,
|
|
1288
|
+
fontSize = _ref14$fontSize === void 0 ? DEFAULT_FONT : _ref14$fontSize,
|
|
1289
|
+
_ref14$fontFamily = _ref14.fontFamily,
|
|
1290
|
+
fontFamily = _ref14$fontFamily === void 0 ? DEFAULT_FONT_FAMILY : _ref14$fontFamily,
|
|
1291
|
+
_ref14$fontWeight = _ref14.fontWeight,
|
|
1292
|
+
fontWeight = _ref14$fontWeight === void 0 ? 'normal' : _ref14$fontWeight,
|
|
1293
|
+
containerWidth = _ref14.containerWidth;
|
|
1214
1294
|
var textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
|
|
1215
1295
|
var modifiedText = text;
|
|
1216
|
-
var ellipsesLength = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])('...', "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
|
|
1217
|
-
|
|
1296
|
+
var ellipsesLength = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])('...', "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily)); // `containerWidth - ellipsesLength > 0` condition ensures space even exists for text.
|
|
1297
|
+
|
|
1218
1298
|
if (containerWidth - ellipsesLength > 0 && textWidth > containerWidth) {
|
|
1219
1299
|
// Truncates the content such that the truncated value + ellipses fit within the allocated space for the ellipses.
|
|
1220
1300
|
// `textWidth > containerWidth - ellipsesLength` condition checks if text + ellipses exceeds container width.
|
|
@@ -1223,11 +1303,12 @@ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_re
|
|
|
1223
1303
|
modifiedText = modifiedText.substring(0, modifiedText.length - 1);
|
|
1224
1304
|
textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(modifiedText, "normal ".concat(fontSize, "px ").concat(fontFamily));
|
|
1225
1305
|
}
|
|
1306
|
+
|
|
1226
1307
|
modifiedText = "".concat(modifiedText, "...");
|
|
1227
1308
|
}
|
|
1309
|
+
|
|
1228
1310
|
return modifiedText;
|
|
1229
1311
|
};
|
|
1230
|
-
|
|
1231
1312
|
/*
|
|
1232
1313
|
* @method computeSingleValueRadialContent
|
|
1233
1314
|
* @param {Object} props
|
|
@@ -1254,44 +1335,46 @@ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_re
|
|
|
1254
1335
|
* @returns {String} results.majorValueTitle
|
|
1255
1336
|
* @returns {Object} results.smallVizProps
|
|
1256
1337
|
*/
|
|
1338
|
+
|
|
1257
1339
|
var computeSingleValueRadialContent = function computeSingleValueRadialContent(_ref15) {
|
|
1258
1340
|
var contentWidth = _ref15.contentWidth,
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1341
|
+
contentHeight = _ref15.contentHeight,
|
|
1342
|
+
containerWidth = _ref15.containerWidth,
|
|
1343
|
+
containerHeight = _ref15.containerHeight,
|
|
1344
|
+
majorValue = _ref15.majorValue,
|
|
1345
|
+
trendValue = _ref15.trendValue,
|
|
1346
|
+
majorFontSize = _ref15.majorFontSize,
|
|
1347
|
+
trendFontSize = _ref15.trendFontSize,
|
|
1348
|
+
trendDisplay = _ref15.trendDisplay,
|
|
1349
|
+
unit = _ref15.unit,
|
|
1350
|
+
numberPrecision = _ref15.numberPrecision,
|
|
1351
|
+
shouldUseThousandSeparators = _ref15.shouldUseThousandSeparators,
|
|
1352
|
+
shouldAbbreviateTrendValue = _ref15.shouldAbbreviateTrendValue,
|
|
1353
|
+
smallViz = _ref15.smallViz;
|
|
1354
|
+
|
|
1272
1355
|
var _getMajorAndTrend2 = getMajorAndTrend({
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
var majorValueTitle = majorText;
|
|
1290
|
-
var smallVizProps = {};
|
|
1356
|
+
majorValue: majorValue,
|
|
1357
|
+
trendValue: trendValue,
|
|
1358
|
+
majorFontSize: majorFontSize,
|
|
1359
|
+
trendFontSize: trendFontSize,
|
|
1360
|
+
trendDisplay: trendDisplay,
|
|
1361
|
+
width: contentWidth,
|
|
1362
|
+
height: contentHeight,
|
|
1363
|
+
unit: unit,
|
|
1364
|
+
numberPrecision: numberPrecision,
|
|
1365
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
1366
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
1367
|
+
}),
|
|
1368
|
+
majorText = _getMajorAndTrend2.majorText,
|
|
1369
|
+
trendText = _getMajorAndTrend2.trendText,
|
|
1370
|
+
majorTextFontSize = _getMajorAndTrend2.majorTextFontSize,
|
|
1371
|
+
trendTextFontSize = _getMajorAndTrend2.trendTextFontSize;
|
|
1291
1372
|
|
|
1292
|
-
|
|
1373
|
+
var majorValueTitle = majorText;
|
|
1374
|
+
var smallVizProps = {}; // custom logic for viz in small space
|
|
1293
1375
|
// if not showing the radial graph (if `smallViz` is true), then compute truncated major value
|
|
1294
1376
|
// and font sizes
|
|
1377
|
+
|
|
1295
1378
|
if (smallViz) {
|
|
1296
1379
|
var truncateValue = minimallyTruncateStringToWidth({
|
|
1297
1380
|
text: majorValue,
|
|
@@ -1299,6 +1382,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
1299
1382
|
fontSize: 12,
|
|
1300
1383
|
containerWidth: containerWidth
|
|
1301
1384
|
});
|
|
1385
|
+
|
|
1302
1386
|
var _getMajorAndTrend3 = getMajorAndTrend({
|
|
1303
1387
|
majorValue: truncateValue,
|
|
1304
1388
|
trendValue: trendValue,
|
|
@@ -1312,6 +1396,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
1312
1396
|
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
1313
1397
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
1314
1398
|
});
|
|
1399
|
+
|
|
1315
1400
|
majorText = _getMajorAndTrend3.majorText;
|
|
1316
1401
|
trendText = _getMajorAndTrend3.trendText;
|
|
1317
1402
|
majorTextFontSize = _getMajorAndTrend3.majorTextFontSize;
|
|
@@ -1321,6 +1406,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
1321
1406
|
unit: unit
|
|
1322
1407
|
};
|
|
1323
1408
|
}
|
|
1409
|
+
|
|
1324
1410
|
return {
|
|
1325
1411
|
majorText: majorText,
|
|
1326
1412
|
trendText: trendText,
|
|
@@ -1330,7 +1416,6 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
1330
1416
|
smallVizProps: smallVizProps
|
|
1331
1417
|
};
|
|
1332
1418
|
};
|
|
1333
|
-
|
|
1334
1419
|
/**
|
|
1335
1420
|
* Get the colors for a graph
|
|
1336
1421
|
*
|
|
@@ -1343,21 +1428,22 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
1343
1428
|
* @returns {Object} { background, stroke } colors
|
|
1344
1429
|
* @private
|
|
1345
1430
|
*/
|
|
1431
|
+
|
|
1346
1432
|
var getGraphColors = function getGraphColors(_ref16) {
|
|
1347
1433
|
var backgroundEnabled = _ref16.backgroundEnabled,
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1434
|
+
backgroundColor = _ref16.backgroundColor,
|
|
1435
|
+
defaultColors = _ref16.defaultColors,
|
|
1436
|
+
customColorFormatter = _ref16.customColorFormatter; // Only do custom colors in block mode
|
|
1437
|
+
|
|
1352
1438
|
if (backgroundEnabled) {
|
|
1353
1439
|
// Check if the user defined colors to use
|
|
1354
1440
|
if (backgroundColor && typeof customColorFormatter === 'function') {
|
|
1355
1441
|
return customColorFormatter(backgroundColor);
|
|
1356
1442
|
}
|
|
1357
1443
|
}
|
|
1444
|
+
|
|
1358
1445
|
return defaultColors.none;
|
|
1359
1446
|
};
|
|
1360
|
-
|
|
1361
1447
|
/**
|
|
1362
1448
|
* Adjust rgb value if it equals to 0 or 255
|
|
1363
1449
|
* @method adjustRGB
|
|
@@ -1366,16 +1452,18 @@ var getGraphColors = function getGraphColors(_ref16) {
|
|
|
1366
1452
|
* @returns {Number} adjusted rgb
|
|
1367
1453
|
* @private
|
|
1368
1454
|
*/
|
|
1455
|
+
|
|
1369
1456
|
var adjustRGB = function adjustRGB(rgb, delta) {
|
|
1370
1457
|
if (rgb === 255) {
|
|
1371
1458
|
return rgb - delta;
|
|
1372
1459
|
}
|
|
1460
|
+
|
|
1373
1461
|
if (rgb === 0) {
|
|
1374
1462
|
return rgb + delta;
|
|
1375
1463
|
}
|
|
1464
|
+
|
|
1376
1465
|
return rgb;
|
|
1377
1466
|
};
|
|
1378
|
-
|
|
1379
1467
|
/**
|
|
1380
1468
|
* Modifies colors by multiplying by a given ratio
|
|
1381
1469
|
* @method changeColor
|
|
@@ -1384,18 +1472,16 @@ var adjustRGB = function adjustRGB(rgb, delta) {
|
|
|
1384
1472
|
* @returns {String} new color
|
|
1385
1473
|
* @private
|
|
1386
1474
|
*/
|
|
1475
|
+
|
|
1387
1476
|
var changeColor = function changeColor(color, ratio) {
|
|
1388
1477
|
var hex = color.replace(/(0x|#)/, '');
|
|
1389
1478
|
var r = parseInt(hex.substr(0, 2), 16);
|
|
1390
1479
|
var g = parseInt(hex.substr(2, 2), 16);
|
|
1391
|
-
var b = parseInt(hex.substr(4, 2), 16);
|
|
1480
|
+
var b = parseInt(hex.substr(4, 2), 16); // Multiply by given ratio, make sure is between 0 and 255;
|
|
1392
1481
|
|
|
1393
|
-
// Multiply by given ratio, make sure is between 0 and 255;
|
|
1394
1482
|
var newR = Math.max(Math.min(Math.floor(r * ratio), 255), 0);
|
|
1395
1483
|
var newG = Math.max(Math.min(Math.floor(g * ratio), 255), 0);
|
|
1396
|
-
var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0);
|
|
1397
|
-
|
|
1398
|
-
// If the color is not changed
|
|
1484
|
+
var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0); // If the color is not changed
|
|
1399
1485
|
// case 1: the color is (0, 0 0)
|
|
1400
1486
|
// lighten color (80, 80, 80)
|
|
1401
1487
|
// darken color (40, 40, 40)
|
|
@@ -1404,6 +1490,7 @@ var changeColor = function changeColor(color, ratio) {
|
|
|
1404
1490
|
// darken color (175, 175, 175)
|
|
1405
1491
|
// case 3: the color is e.g. (0, 255, 0)
|
|
1406
1492
|
// new color (20, 235, 20)
|
|
1493
|
+
|
|
1407
1494
|
if (newR === r && newG === g && newB === b) {
|
|
1408
1495
|
if (newR === 0 && newG === 0 && newB === 0) {
|
|
1409
1496
|
if (ratio > 1) {
|
|
@@ -1431,9 +1518,9 @@ var changeColor = function changeColor(color, ratio) {
|
|
|
1431
1518
|
newB = adjustRGB(newB, 20);
|
|
1432
1519
|
}
|
|
1433
1520
|
}
|
|
1521
|
+
|
|
1434
1522
|
return "#".concat(newR.toString(16).padStart(2, 0)) + "".concat(newG.toString(16).padStart(2, 0)) + "".concat(newB.toString(16).padStart(2, 0));
|
|
1435
1523
|
};
|
|
1436
|
-
|
|
1437
1524
|
/**
|
|
1438
1525
|
* Lighten a given color
|
|
1439
1526
|
* @method lighten
|
|
@@ -1441,10 +1528,11 @@ var changeColor = function changeColor(color, ratio) {
|
|
|
1441
1528
|
* @returns {String}
|
|
1442
1529
|
* @private
|
|
1443
1530
|
*/
|
|
1531
|
+
|
|
1532
|
+
|
|
1444
1533
|
var lighten = function lighten(color) {
|
|
1445
1534
|
return changeColor(color, 1.3);
|
|
1446
1535
|
};
|
|
1447
|
-
|
|
1448
1536
|
/**
|
|
1449
1537
|
* Darkens a given color
|
|
1450
1538
|
* @method darken
|
|
@@ -1452,10 +1540,10 @@ var lighten = function lighten(color) {
|
|
|
1452
1540
|
* @returns {String}
|
|
1453
1541
|
* @private
|
|
1454
1542
|
*/
|
|
1543
|
+
|
|
1455
1544
|
var darken = function darken(color) {
|
|
1456
1545
|
return changeColor(color, 0.5);
|
|
1457
1546
|
};
|
|
1458
|
-
|
|
1459
1547
|
/** consistent token structure: handle callback to add value and name in event payload
|
|
1460
1548
|
* @method handleValueClickCallback
|
|
1461
1549
|
* @param {Object} ev
|
|
@@ -1464,6 +1552,7 @@ var darken = function darken(color) {
|
|
|
1464
1552
|
* @param {Number} trendValue
|
|
1465
1553
|
* @param {Function} onValueClick
|
|
1466
1554
|
*/
|
|
1555
|
+
|
|
1467
1556
|
var handleValueClickCallback = function handleValueClickCallback(ev, majorValue, majorValueField, trendValue, onValueClick) {
|
|
1468
1557
|
var trellisEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
1469
1558
|
var trellisSplityBy = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
|
|
@@ -1473,12 +1562,14 @@ var handleValueClickCallback = function handleValueClickCallback(ev, majorValue,
|
|
|
1473
1562
|
value: majorValue,
|
|
1474
1563
|
name: majorValueField
|
|
1475
1564
|
};
|
|
1565
|
+
|
|
1476
1566
|
if (trellisEnabled) {
|
|
1477
1567
|
payload = _objectSpread(_objectSpread({}, payload), {}, {
|
|
1478
1568
|
'trellis.name': trellisSplityBy,
|
|
1479
1569
|
'trellis.value': trellisKey
|
|
1480
1570
|
});
|
|
1481
1571
|
}
|
|
1572
|
+
|
|
1482
1573
|
return onValueClick(_objectSpread(_objectSpread({}, ev), {}, {
|
|
1483
1574
|
payload: payload
|
|
1484
1575
|
}));
|
|
@@ -1552,11 +1643,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1552
1643
|
value: true
|
|
1553
1644
|
});
|
|
1554
1645
|
exports.shouldShowIconPlaceholder = void 0;
|
|
1646
|
+
|
|
1555
1647
|
var React = __webpack_require__(1);
|
|
1648
|
+
|
|
1556
1649
|
var T = __webpack_require__(0);
|
|
1650
|
+
|
|
1557
1651
|
var lodash_1 = __webpack_require__(3);
|
|
1652
|
+
|
|
1558
1653
|
var i18n_1 = __webpack_require__(2);
|
|
1654
|
+
|
|
1559
1655
|
var Message_1 = __webpack_require__(10);
|
|
1656
|
+
|
|
1560
1657
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
1561
1658
|
/**
|
|
1562
1659
|
* @method shouldShowIconPlaceholder
|
|
@@ -1564,6 +1661,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
1564
1661
|
* @param {boolean} loading
|
|
1565
1662
|
* @returns {boolean}
|
|
1566
1663
|
*/
|
|
1664
|
+
|
|
1665
|
+
|
|
1567
1666
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
1568
1667
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1569
1668
|
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
@@ -1572,6 +1671,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
|
|
|
1572
1671
|
var noFields = fields === undefined;
|
|
1573
1672
|
return loading || noData || noFields;
|
|
1574
1673
|
};
|
|
1674
|
+
|
|
1575
1675
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
1576
1676
|
var propTypes = {
|
|
1577
1677
|
icon: T.func,
|
|
@@ -1586,11 +1686,13 @@ var propTypes = {
|
|
|
1586
1686
|
* @param {IconPlaceholderProps} props
|
|
1587
1687
|
* @returns {React.ReactElement}
|
|
1588
1688
|
*/
|
|
1689
|
+
|
|
1589
1690
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
1590
1691
|
var width = props.width,
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1692
|
+
height = props.height,
|
|
1693
|
+
icon = props.icon,
|
|
1694
|
+
iconColor = props.iconColor;
|
|
1695
|
+
|
|
1594
1696
|
if (icon) {
|
|
1595
1697
|
return React.createElement(icon, {
|
|
1596
1698
|
style: {
|
|
@@ -1602,9 +1704,11 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
1602
1704
|
transform: 'translate(-50%, -50%)'
|
|
1603
1705
|
},
|
|
1604
1706
|
width: '50%',
|
|
1605
|
-
height: '50%'
|
|
1707
|
+
height: '50%',
|
|
1708
|
+
'data-test': 'icon-placeholder'
|
|
1606
1709
|
});
|
|
1607
1710
|
}
|
|
1711
|
+
|
|
1608
1712
|
return React.createElement(Message_1.default, {
|
|
1609
1713
|
width: width,
|
|
1610
1714
|
height: height,
|
|
@@ -1612,6 +1716,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
1612
1716
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
1613
1717
|
});
|
|
1614
1718
|
};
|
|
1719
|
+
|
|
1615
1720
|
IconPlaceholder.propTypes = propTypes;
|
|
1616
1721
|
IconPlaceholder.defaultProps = {
|
|
1617
1722
|
width: '100%',
|
|
@@ -1628,21 +1733,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
1628
1733
|
|
|
1629
1734
|
|
|
1630
1735
|
var _defineProperty = __webpack_require__(7);
|
|
1736
|
+
|
|
1631
1737
|
Object.defineProperty(exports, "__esModule", {
|
|
1632
1738
|
value: true
|
|
1633
1739
|
});
|
|
1634
1740
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
1741
|
+
|
|
1635
1742
|
var T = __webpack_require__(0);
|
|
1743
|
+
|
|
1636
1744
|
var lodash_1 = __webpack_require__(3);
|
|
1637
|
-
|
|
1745
|
+
|
|
1746
|
+
var DataSource_1 = __webpack_require__(34);
|
|
1747
|
+
|
|
1638
1748
|
exports.SortParamsPropTypes = T.shape({
|
|
1639
1749
|
currentSortKey: T.string,
|
|
1640
1750
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
1641
1751
|
onSort: T.func
|
|
1642
1752
|
});
|
|
1753
|
+
|
|
1643
1754
|
var getSortingParams = function getSortingParams(_ref) {
|
|
1644
1755
|
var requestParams = _ref.requestParams,
|
|
1645
|
-
|
|
1756
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
1646
1757
|
var currentSortKey;
|
|
1647
1758
|
var currentSortDir;
|
|
1648
1759
|
var nextSortDirMap = {
|
|
@@ -1651,15 +1762,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
1651
1762
|
none: 'asc'
|
|
1652
1763
|
};
|
|
1653
1764
|
var onSort;
|
|
1765
|
+
|
|
1654
1766
|
if (typeof onRequestParamsChange === 'function') {
|
|
1655
1767
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
1656
1768
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
1657
1769
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1770
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
1771
|
+
|
|
1772
|
+
|
|
1660
1773
|
onSort = function onSort(e, _ref2) {
|
|
1661
1774
|
var sortKey = _ref2.sortKey,
|
|
1662
|
-
|
|
1775
|
+
sortDir = _ref2.sortDir;
|
|
1776
|
+
|
|
1663
1777
|
if (typeof sortKey === 'string') {
|
|
1664
1778
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
1665
1779
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -1671,12 +1785,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
1671
1785
|
}
|
|
1672
1786
|
};
|
|
1673
1787
|
}
|
|
1788
|
+
|
|
1674
1789
|
return {
|
|
1675
1790
|
currentSortKey: currentSortKey,
|
|
1676
1791
|
currentSortDir: currentSortDir,
|
|
1677
1792
|
onSort: onSort
|
|
1678
1793
|
};
|
|
1679
1794
|
};
|
|
1795
|
+
|
|
1680
1796
|
exports.getSortingParams = getSortingParams;
|
|
1681
1797
|
|
|
1682
1798
|
/***/ }),
|
|
@@ -1687,43 +1803,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
1687
1803
|
"use strict";
|
|
1688
1804
|
|
|
1689
1805
|
|
|
1806
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1807
|
+
value: true
|
|
1808
|
+
});
|
|
1809
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
1810
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1811
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
1812
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
1813
|
+
|
|
1814
|
+
/***/ }),
|
|
1815
|
+
|
|
1816
|
+
/***/ 35:
|
|
1817
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1818
|
+
|
|
1819
|
+
"use strict";
|
|
1820
|
+
|
|
1821
|
+
|
|
1690
1822
|
Object.defineProperty(exports, "__esModule", {
|
|
1691
1823
|
value: true
|
|
1692
1824
|
});
|
|
1693
1825
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
1826
|
+
|
|
1694
1827
|
var T = __webpack_require__(0);
|
|
1828
|
+
|
|
1695
1829
|
var lodash_1 = __webpack_require__(3);
|
|
1830
|
+
|
|
1696
1831
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
1697
1832
|
isPaging: T.bool,
|
|
1698
1833
|
current: T.number,
|
|
1699
1834
|
totalPages: T.number,
|
|
1700
1835
|
onChange: T.func
|
|
1701
1836
|
});
|
|
1837
|
+
|
|
1702
1838
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
1703
1839
|
var requestParams = _ref.requestParams,
|
|
1704
|
-
|
|
1705
|
-
|
|
1840
|
+
meta = _ref.meta,
|
|
1841
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
1706
1842
|
var totalCount = meta && meta.totalCount || 0;
|
|
1707
1843
|
var offset = requestParams && requestParams.offset || 0;
|
|
1708
1844
|
var count = requestParams && requestParams.count;
|
|
1709
1845
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
1710
1846
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
1711
1847
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
1848
|
+
|
|
1712
1849
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
1713
1850
|
var page = _ref2.page,
|
|
1714
|
-
|
|
1851
|
+
countArg = _ref2.count;
|
|
1715
1852
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
1853
|
+
|
|
1716
1854
|
if (typeof countArg === 'number') {
|
|
1717
1855
|
newParams.count = countArg;
|
|
1718
1856
|
newParams.offset = 0;
|
|
1719
1857
|
}
|
|
1858
|
+
|
|
1720
1859
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
1860
|
+
|
|
1721
1861
|
if (typeof page === 'number' && page > 0) {
|
|
1722
1862
|
newParams.count = pageCount;
|
|
1723
1863
|
newParams.offset = (page - 1) * pageCount;
|
|
1724
1864
|
}
|
|
1865
|
+
|
|
1725
1866
|
onRequestParamsChange(newParams);
|
|
1726
1867
|
};
|
|
1868
|
+
|
|
1727
1869
|
return {
|
|
1728
1870
|
isPaging: isPaging,
|
|
1729
1871
|
current: current,
|
|
@@ -1731,11 +1873,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
1731
1873
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
1732
1874
|
};
|
|
1733
1875
|
};
|
|
1876
|
+
|
|
1734
1877
|
exports.getPaginationParams = getPaginationParams;
|
|
1735
1878
|
|
|
1736
1879
|
/***/ }),
|
|
1737
1880
|
|
|
1738
|
-
/***/
|
|
1881
|
+
/***/ 36:
|
|
1739
1882
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1740
1883
|
|
|
1741
1884
|
"use strict";
|
|
@@ -1746,6 +1889,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1746
1889
|
});
|
|
1747
1890
|
exports.VizCategory = void 0;
|
|
1748
1891
|
var VizCategory;
|
|
1892
|
+
|
|
1749
1893
|
(function (VizCategory) {
|
|
1750
1894
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
1751
1895
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -1763,67 +1907,96 @@ var VizCategory;
|
|
|
1763
1907
|
|
|
1764
1908
|
/***/ }),
|
|
1765
1909
|
|
|
1766
|
-
/***/
|
|
1910
|
+
/***/ 37:
|
|
1767
1911
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1768
1912
|
|
|
1769
1913
|
"use strict";
|
|
1770
1914
|
|
|
1771
1915
|
|
|
1772
1916
|
var _slicedToArray = __webpack_require__(17);
|
|
1917
|
+
|
|
1773
1918
|
Object.defineProperty(exports, "__esModule", {
|
|
1774
1919
|
value: true
|
|
1775
1920
|
});
|
|
1921
|
+
|
|
1776
1922
|
var React = __webpack_require__(1);
|
|
1923
|
+
|
|
1777
1924
|
var lodash_1 = __webpack_require__(3);
|
|
1778
|
-
|
|
1925
|
+
|
|
1926
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
1927
|
+
|
|
1779
1928
|
var Options_1 = __webpack_require__(30);
|
|
1780
|
-
|
|
1929
|
+
|
|
1930
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
1931
|
+
|
|
1781
1932
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
1782
|
-
|
|
1933
|
+
|
|
1934
|
+
var moment_1 = __webpack_require__(40);
|
|
1935
|
+
|
|
1783
1936
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
1937
|
+
|
|
1784
1938
|
var styled_components_1 = __webpack_require__(4);
|
|
1939
|
+
|
|
1785
1940
|
var hocUtils_1 = __webpack_require__(27);
|
|
1941
|
+
|
|
1786
1942
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
1787
|
-
|
|
1943
|
+
|
|
1944
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
1945
|
+
|
|
1788
1946
|
var id_1 = __webpack_require__(25);
|
|
1789
|
-
|
|
1947
|
+
|
|
1948
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
1949
|
+
|
|
1790
1950
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1951
|
+
|
|
1791
1952
|
var getSorting_1 = __webpack_require__(33);
|
|
1792
|
-
|
|
1953
|
+
|
|
1954
|
+
var getPagination_1 = __webpack_require__(35);
|
|
1955
|
+
|
|
1793
1956
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
1957
|
+
|
|
1794
1958
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
1959
|
+
|
|
1795
1960
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
1961
|
+
|
|
1796
1962
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
1797
1963
|
/**
|
|
1798
1964
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
1799
1965
|
* @param {DashboardVizOpts} opts
|
|
1800
1966
|
* @returns {HOC}
|
|
1801
1967
|
*/
|
|
1968
|
+
|
|
1969
|
+
|
|
1802
1970
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
1803
1971
|
var ReactViz = opts.ReactViz,
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1972
|
+
vizConfig = opts.vizConfig,
|
|
1973
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
1974
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
1975
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
1976
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
1977
|
+
|
|
1809
1978
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
1810
1979
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
1980
|
+
|
|
1811
1981
|
var DashboardViz = function DashboardViz(props) {
|
|
1812
1982
|
var _a;
|
|
1983
|
+
|
|
1813
1984
|
var mode = props.mode,
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1985
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
1986
|
+
dataSources = props.dataSources,
|
|
1987
|
+
options = props.options,
|
|
1988
|
+
_props$context = props.context,
|
|
1989
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
1990
|
+
width = props.width,
|
|
1991
|
+
height = props.height,
|
|
1992
|
+
onComputedProps = props.onComputedProps,
|
|
1993
|
+
onEventTrigger = props.onEventTrigger,
|
|
1994
|
+
theme = props.theme,
|
|
1995
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
1996
|
+
|
|
1825
1997
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
1826
|
-
|
|
1998
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
1999
|
+
|
|
1827
2000
|
if (serializedTimezone) {
|
|
1828
2001
|
/*
|
|
1829
2002
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -1837,38 +2010,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1837
2010
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
1838
2011
|
}
|
|
1839
2012
|
}
|
|
2013
|
+
|
|
1840
2014
|
var themeFunc = function themeFunc(themeVar) {
|
|
1841
2015
|
var _a, _b;
|
|
2016
|
+
|
|
1842
2017
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
1843
2018
|
};
|
|
2019
|
+
|
|
1844
2020
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
2021
|
+
|
|
1845
2022
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
2023
|
+
theme: theme
|
|
2024
|
+
}),
|
|
2025
|
+
currentThemeFamily = _ref.family,
|
|
2026
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
2027
|
+
currentThemeDensity = _ref.density;
|
|
2028
|
+
|
|
1851
2029
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
2030
|
+
|
|
1852
2031
|
var _React$useState = React.useState({}),
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
2032
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2033
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
2034
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
2035
|
+
|
|
2036
|
+
|
|
1856
2037
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
2038
|
+
|
|
1857
2039
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
1858
|
-
|
|
1859
|
-
|
|
2040
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
2041
|
+
visualizationID = _React$useState4[0];
|
|
2042
|
+
|
|
1860
2043
|
var _React$useState5 = React.useState({}),
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
2044
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
2045
|
+
dataSourcesInState = _React$useState6[0],
|
|
2046
|
+
setDataSourcesInState = _React$useState6[1];
|
|
2047
|
+
|
|
1864
2048
|
var _React$useState7 = React.useState(),
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
2049
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
2050
|
+
dataFramesInState = _React$useState8[0],
|
|
2051
|
+
setDataFramesInState = _React$useState8[1];
|
|
2052
|
+
|
|
1868
2053
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
2054
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
2055
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
2056
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
2057
|
+
|
|
1872
2058
|
var isMounted = React.useRef(true);
|
|
1873
2059
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
1874
2060
|
try {
|
|
@@ -1893,11 +2079,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1893
2079
|
});
|
|
1894
2080
|
} else {
|
|
1895
2081
|
var dataFrames = dataFramesInState;
|
|
2082
|
+
|
|
1896
2083
|
if (dataSources !== dataSourcesInState) {
|
|
1897
2084
|
setDataSourcesInState(dataSources);
|
|
1898
2085
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
1899
2086
|
setDataFramesInState(dataFrames);
|
|
1900
2087
|
}
|
|
2088
|
+
|
|
1901
2089
|
return Options_1.Options.evaluate({
|
|
1902
2090
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1903
2091
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -1908,21 +2096,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1908
2096
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
1909
2097
|
return {};
|
|
1910
2098
|
}
|
|
2099
|
+
|
|
1911
2100
|
return {};
|
|
1912
2101
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
1913
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
1914
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
2102
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
1915
2103
|
// 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
|
|
1916
2104
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
2105
|
+
|
|
1917
2106
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
1918
2107
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
2108
|
+
|
|
1919
2109
|
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) {
|
|
1920
2110
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
1921
2111
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
1922
2112
|
});
|
|
1923
|
-
}
|
|
1924
|
-
// useEffect hook needs to be initialized before any early returns
|
|
2113
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
1925
2114
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
2115
|
+
|
|
2116
|
+
|
|
1926
2117
|
React.useEffect(function () {
|
|
1927
2118
|
onComputedProps(clonedEvaluatedOptions);
|
|
1928
2119
|
});
|
|
@@ -1932,53 +2123,68 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1932
2123
|
isMounted.current = false;
|
|
1933
2124
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
1934
2125
|
}
|
|
1935
|
-
};
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
// present warning message if any required props are missing
|
|
2126
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2127
|
+
}, []); // present warning message if any required props are missing
|
|
2128
|
+
|
|
1939
2129
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
1940
|
-
|
|
1941
|
-
|
|
2130
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
2131
|
+
supports = vizConfig.supports;
|
|
1942
2132
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
2133
|
+
|
|
1943
2134
|
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
|
|
1944
2135
|
) {
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
2136
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
2137
|
+
"data-test": "missing-props-message",
|
|
2138
|
+
width: width,
|
|
2139
|
+
height: height,
|
|
2140
|
+
missingProps: missing,
|
|
2141
|
+
backgroundColor: bgColorFromTheme
|
|
2142
|
+
});
|
|
2143
|
+
} // events
|
|
2144
|
+
|
|
2145
|
+
|
|
1954
2146
|
var eventCallbackProps = {};
|
|
2147
|
+
|
|
1955
2148
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1956
2149
|
var supportedEvents = vizConfig.events;
|
|
1957
2150
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1958
|
-
var
|
|
1959
|
-
|
|
1960
|
-
|
|
2151
|
+
var _supportedEvents$even = supportedEvents[eventName],
|
|
2152
|
+
parentKeys = _supportedEvents$even.parentKeys,
|
|
2153
|
+
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
2154
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
1961
2155
|
// then remove these lines
|
|
1962
|
-
|
|
2156
|
+
|
|
1963
2157
|
var payload = {};
|
|
2158
|
+
|
|
1964
2159
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1965
2160
|
payloadKeys.forEach(function (p) {
|
|
1966
2161
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1967
2162
|
});
|
|
1968
2163
|
}
|
|
2164
|
+
|
|
1969
2165
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1970
2166
|
if (ev && ev.payload) {
|
|
1971
2167
|
payload = ev.payload;
|
|
1972
2168
|
}
|
|
2169
|
+
|
|
1973
2170
|
return onEventTrigger({
|
|
1974
2171
|
originalEvent: ev,
|
|
1975
2172
|
payload: payload,
|
|
1976
2173
|
type: eventName
|
|
1977
2174
|
});
|
|
1978
2175
|
};
|
|
2176
|
+
|
|
2177
|
+
if (parentKeys) {
|
|
2178
|
+
for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
2179
|
+
var newObject = {};
|
|
2180
|
+
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
2181
|
+
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
1979
2184
|
});
|
|
1980
|
-
}
|
|
1981
|
-
|
|
2185
|
+
} // compute pure viz props which are not from options
|
|
2186
|
+
|
|
2187
|
+
|
|
1982
2188
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1983
2189
|
themeFunc: themeFunc
|
|
1984
2190
|
}));
|
|
@@ -1996,15 +2202,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1996
2202
|
* In future, we could automatically detect which all datasources are being used
|
|
1997
2203
|
* and bind those magically to pagination/sorting behavior.
|
|
1998
2204
|
*/
|
|
2205
|
+
|
|
1999
2206
|
var dataSourceMetadata = {};
|
|
2000
2207
|
var OptionKey = 'paginateDataSourceKey';
|
|
2001
2208
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
2209
|
+
|
|
2002
2210
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
2003
2211
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
2004
2212
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
2213
|
+
|
|
2005
2214
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
2006
2215
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
2007
2216
|
};
|
|
2217
|
+
|
|
2008
2218
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
2009
2219
|
requestParams: requestParams,
|
|
2010
2220
|
meta: meta,
|
|
@@ -2019,115 +2229,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
2019
2229
|
sortParams: sortParams,
|
|
2020
2230
|
paginatorParams: paginatorParams
|
|
2021
2231
|
};
|
|
2022
|
-
}
|
|
2023
|
-
|
|
2232
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
2233
|
+
|
|
2234
|
+
|
|
2024
2235
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
2025
2236
|
return null;
|
|
2026
2237
|
}
|
|
2238
|
+
|
|
2027
2239
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
2028
2240
|
mode: mode,
|
|
2029
2241
|
width: width,
|
|
2030
2242
|
height: height
|
|
2031
2243
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
2032
2244
|
};
|
|
2245
|
+
|
|
2033
2246
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
2034
2247
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
2035
2248
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
2036
2249
|
theme: {}
|
|
2037
|
-
});
|
|
2038
|
-
|
|
2039
|
-
DashboardViz.config = vizConfig;
|
|
2040
|
-
|
|
2250
|
+
}); // attach viz config
|
|
2251
|
+
|
|
2252
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
2253
|
+
|
|
2041
2254
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
2042
2255
|
};
|
|
2256
|
+
|
|
2043
2257
|
exports.default = withDashboardViz;
|
|
2044
2258
|
|
|
2045
2259
|
/***/ }),
|
|
2046
2260
|
|
|
2047
|
-
/***/
|
|
2261
|
+
/***/ 38:
|
|
2048
2262
|
/***/ (function(module, exports) {
|
|
2049
2263
|
|
|
2050
2264
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
2051
2265
|
|
|
2052
2266
|
/***/ }),
|
|
2053
2267
|
|
|
2054
|
-
/***/
|
|
2268
|
+
/***/ 39:
|
|
2055
2269
|
/***/ (function(module, exports) {
|
|
2056
2270
|
|
|
2057
2271
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
2058
2272
|
|
|
2059
2273
|
/***/ }),
|
|
2060
2274
|
|
|
2061
|
-
/***/
|
|
2275
|
+
/***/ 4:
|
|
2062
2276
|
/***/ (function(module, exports) {
|
|
2063
2277
|
|
|
2064
|
-
module.exports = require("
|
|
2278
|
+
module.exports = require("styled-components");
|
|
2065
2279
|
|
|
2066
2280
|
/***/ }),
|
|
2067
2281
|
|
|
2068
|
-
/***/
|
|
2282
|
+
/***/ 40:
|
|
2069
2283
|
/***/ (function(module, exports) {
|
|
2070
2284
|
|
|
2071
|
-
module.exports = require("
|
|
2285
|
+
module.exports = require("@splunk/moment");
|
|
2072
2286
|
|
|
2073
2287
|
/***/ }),
|
|
2074
2288
|
|
|
2075
|
-
/***/
|
|
2289
|
+
/***/ 41:
|
|
2076
2290
|
/***/ (function(module, exports) {
|
|
2077
2291
|
|
|
2078
2292
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
2079
2293
|
|
|
2080
2294
|
/***/ }),
|
|
2081
2295
|
|
|
2082
|
-
/***/
|
|
2296
|
+
/***/ 42:
|
|
2083
2297
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2084
2298
|
|
|
2085
2299
|
"use strict";
|
|
2086
2300
|
|
|
2087
2301
|
|
|
2088
2302
|
var _classCallCheck = __webpack_require__(9);
|
|
2303
|
+
|
|
2089
2304
|
Object.defineProperty(exports, "__esModule", {
|
|
2090
2305
|
value: true
|
|
2091
2306
|
});
|
|
2092
2307
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
2093
2308
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
2309
|
+
|
|
2094
2310
|
var T = __webpack_require__(0);
|
|
2311
|
+
|
|
2095
2312
|
var lodash_1 = __webpack_require__(3);
|
|
2096
|
-
|
|
2097
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
2313
|
+
|
|
2314
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
2315
|
+
|
|
2316
|
+
|
|
2098
2317
|
exports.INITIAL_WIDTH = 250;
|
|
2099
2318
|
exports.INITIAL_HEIGHT = 250;
|
|
2100
2319
|
/**
|
|
2101
2320
|
* A Splunk visualization
|
|
2102
2321
|
*/
|
|
2322
|
+
|
|
2103
2323
|
var SplunkVisualization = function SplunkVisualization() {
|
|
2104
2324
|
_classCallCheck(this, SplunkVisualization);
|
|
2105
2325
|
};
|
|
2326
|
+
|
|
2106
2327
|
SplunkVisualization.propTypes = {
|
|
2107
2328
|
/**
|
|
2108
2329
|
* display mode
|
|
2109
2330
|
*/
|
|
2110
2331
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
2332
|
+
|
|
2111
2333
|
/**
|
|
2112
2334
|
* width in pixel or string, defaults to 100%
|
|
2113
2335
|
*/
|
|
2114
2336
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
2337
|
+
|
|
2115
2338
|
/**
|
|
2116
2339
|
* height in pixel or string
|
|
2117
2340
|
*/
|
|
2118
2341
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
2342
|
+
|
|
2119
2343
|
/**
|
|
2120
2344
|
* visualization context used for dynamic option evaluation
|
|
2121
2345
|
*/
|
|
2122
2346
|
context: T.object,
|
|
2347
|
+
|
|
2123
2348
|
/**
|
|
2124
2349
|
* visualization formatting options
|
|
2125
2350
|
*/
|
|
2126
2351
|
options: T.object,
|
|
2352
|
+
|
|
2127
2353
|
/**
|
|
2128
2354
|
* A callback to update formatting options
|
|
2129
2355
|
*/
|
|
2130
2356
|
onOptionsChange: T.func,
|
|
2357
|
+
|
|
2131
2358
|
/**
|
|
2132
2359
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
2133
2360
|
*/
|
|
@@ -2136,6 +2363,7 @@ SplunkVisualization.propTypes = {
|
|
|
2136
2363
|
* current request params
|
|
2137
2364
|
*/
|
|
2138
2365
|
requestParams: T.object,
|
|
2366
|
+
|
|
2139
2367
|
/**
|
|
2140
2368
|
* current dataset
|
|
2141
2369
|
*/
|
|
@@ -2143,6 +2371,7 @@ SplunkVisualization.propTypes = {
|
|
|
2143
2371
|
fields: T.array,
|
|
2144
2372
|
columns: T.array
|
|
2145
2373
|
}),
|
|
2374
|
+
|
|
2146
2375
|
/**
|
|
2147
2376
|
* error
|
|
2148
2377
|
*/
|
|
@@ -2150,29 +2379,35 @@ SplunkVisualization.propTypes = {
|
|
|
2150
2379
|
level: T.string,
|
|
2151
2380
|
message: T.string
|
|
2152
2381
|
}),
|
|
2382
|
+
|
|
2153
2383
|
/**
|
|
2154
2384
|
* meta data that came with the dataset
|
|
2155
2385
|
*/
|
|
2156
2386
|
meta: T.object
|
|
2157
2387
|
})),
|
|
2388
|
+
|
|
2158
2389
|
/**
|
|
2159
2390
|
* A callback to trigger event
|
|
2160
2391
|
*/
|
|
2161
2392
|
onEventTrigger: T.func,
|
|
2393
|
+
|
|
2162
2394
|
/**
|
|
2163
2395
|
* Inform viz if there are handlers listening to events
|
|
2164
2396
|
*/
|
|
2165
2397
|
hasEventHandlers: T.bool,
|
|
2398
|
+
|
|
2166
2399
|
/**
|
|
2167
2400
|
* A callback to communicate computed props to a consumer
|
|
2168
2401
|
*/
|
|
2169
2402
|
onComputedProps: T.func,
|
|
2403
|
+
|
|
2170
2404
|
/**
|
|
2171
2405
|
* A callback to obtain visualization api
|
|
2172
2406
|
*/
|
|
2173
2407
|
vizActionHandlerRef: T.func,
|
|
2174
2408
|
loading: T.bool,
|
|
2175
2409
|
theme: T.object,
|
|
2410
|
+
|
|
2176
2411
|
/**
|
|
2177
2412
|
* A callback to request new data with updated request params
|
|
2178
2413
|
*/
|
|
@@ -2181,6 +2416,7 @@ SplunkVisualization.propTypes = {
|
|
|
2181
2416
|
/**
|
|
2182
2417
|
*
|
|
2183
2418
|
*/
|
|
2419
|
+
|
|
2184
2420
|
SplunkVisualization.defaultProps = {
|
|
2185
2421
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
2186
2422
|
width: '100%',
|
|
@@ -2209,26 +2445,29 @@ exports.default = SplunkVisualization;
|
|
|
2209
2445
|
|
|
2210
2446
|
/***/ }),
|
|
2211
2447
|
|
|
2212
|
-
/***/
|
|
2448
|
+
/***/ 43:
|
|
2213
2449
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2214
2450
|
|
|
2215
2451
|
"use strict";
|
|
2216
2452
|
|
|
2217
2453
|
|
|
2218
2454
|
var _classCallCheck = __webpack_require__(9);
|
|
2455
|
+
|
|
2219
2456
|
var _createClass = __webpack_require__(18);
|
|
2457
|
+
|
|
2220
2458
|
Object.defineProperty(exports, "__esModule", {
|
|
2221
2459
|
value: true
|
|
2222
2460
|
});
|
|
2223
2461
|
exports.DefaultVizActionHandler = void 0;
|
|
2462
|
+
|
|
2224
2463
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
2225
2464
|
function DefaultVizActionHandler() {
|
|
2226
2465
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
2227
2466
|
}
|
|
2467
|
+
|
|
2228
2468
|
_createClass(DefaultVizActionHandler, [{
|
|
2229
2469
|
key: "focus",
|
|
2230
|
-
value: function focus() {
|
|
2231
|
-
// noop
|
|
2470
|
+
value: function focus() {// noop
|
|
2232
2471
|
}
|
|
2233
2472
|
}, {
|
|
2234
2473
|
key: "snapshot",
|
|
@@ -2236,23 +2475,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
2236
2475
|
return null; // noop
|
|
2237
2476
|
}
|
|
2238
2477
|
}]);
|
|
2478
|
+
|
|
2239
2479
|
return DefaultVizActionHandler;
|
|
2240
2480
|
}();
|
|
2241
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
2242
2481
|
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
/***/ 43:
|
|
2246
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2247
|
-
|
|
2248
|
-
"use strict";
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2252
|
-
value: true
|
|
2253
|
-
});
|
|
2254
|
-
exports.validSortDirs = void 0;
|
|
2255
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
2482
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
2256
2483
|
|
|
2257
2484
|
/***/ }),
|
|
2258
2485
|
|
|
@@ -2264,36 +2491,47 @@ exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
|
2264
2491
|
|
|
2265
2492
|
var __rest = this && this.__rest || function (s, e) {
|
|
2266
2493
|
var t = {};
|
|
2494
|
+
|
|
2267
2495
|
for (var p in s) {
|
|
2268
2496
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2269
2497
|
}
|
|
2498
|
+
|
|
2270
2499
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2271
2500
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2272
2501
|
}
|
|
2273
2502
|
return t;
|
|
2274
2503
|
};
|
|
2504
|
+
|
|
2275
2505
|
Object.defineProperty(exports, "__esModule", {
|
|
2276
2506
|
value: true
|
|
2277
2507
|
});
|
|
2278
2508
|
exports.themes = exports.computeVizProps = exports.PureParallelCoordinates = exports.config = void 0;
|
|
2509
|
+
|
|
2279
2510
|
var PureParallelCoordinates_1 = __webpack_require__(432);
|
|
2280
|
-
|
|
2511
|
+
|
|
2512
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
2513
|
+
|
|
2281
2514
|
var config_1 = __webpack_require__(439);
|
|
2515
|
+
|
|
2282
2516
|
var singleValueUtils_1 = __webpack_require__(24);
|
|
2517
|
+
|
|
2283
2518
|
exports.config = config_1.default;
|
|
2284
2519
|
exports.PureParallelCoordinates = PureParallelCoordinates_1.default;
|
|
2520
|
+
|
|
2285
2521
|
var computeVizProps = function computeVizProps(_a) {
|
|
2286
2522
|
var themeFunc = _a.themeFunc,
|
|
2287
|
-
|
|
2523
|
+
props = __rest(_a, ["themeFunc"]);
|
|
2524
|
+
|
|
2288
2525
|
var defaultThemeColorVariables = ['defaultBackgroundColor', 'axisLineColor', 'axisLineHighlightColor', 'axisLabelColor', 'axisTitleColor', 'filterButtonDisabledColor', 'filterButtonActiveColor', 'filterTextColor', 'truncatedTextColor', 'filterSelectionColor', 'textShadowColor'];
|
|
2289
2526
|
var defaultThemeColors = {};
|
|
2290
2527
|
defaultThemeColorVariables.forEach(function (variable) {
|
|
2291
2528
|
defaultThemeColors[variable] = themeFunc(variable);
|
|
2292
2529
|
});
|
|
2530
|
+
|
|
2293
2531
|
if (props.dataSources) {
|
|
2294
2532
|
var _props$dataSources$pr = props.dataSources.primary.data,
|
|
2295
|
-
|
|
2296
|
-
|
|
2533
|
+
fields = _props$dataSources$pr.fields,
|
|
2534
|
+
columns = _props$dataSources$pr.columns;
|
|
2297
2535
|
return Object.assign({
|
|
2298
2536
|
fields: fields.map(function (field) {
|
|
2299
2537
|
return field.name ? field.name : field;
|
|
@@ -2301,8 +2539,10 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
2301
2539
|
columns: columns
|
|
2302
2540
|
}, defaultThemeColors);
|
|
2303
2541
|
}
|
|
2542
|
+
|
|
2304
2543
|
return defaultThemeColors;
|
|
2305
2544
|
};
|
|
2545
|
+
|
|
2306
2546
|
exports.computeVizProps = computeVizProps;
|
|
2307
2547
|
var viz = (0, withDashboardViz_1.default)({
|
|
2308
2548
|
ReactViz: exports.PureParallelCoordinates,
|
|
@@ -2324,49 +2564,63 @@ exports.default = viz;
|
|
|
2324
2564
|
|
|
2325
2565
|
|
|
2326
2566
|
var _toConsumableArray = __webpack_require__(8);
|
|
2567
|
+
|
|
2327
2568
|
var __rest = this && this.__rest || function (s, e) {
|
|
2328
2569
|
var t = {};
|
|
2570
|
+
|
|
2329
2571
|
for (var p in s) {
|
|
2330
2572
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2331
2573
|
}
|
|
2574
|
+
|
|
2332
2575
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2333
2576
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2334
2577
|
}
|
|
2335
2578
|
return t;
|
|
2336
2579
|
};
|
|
2580
|
+
|
|
2337
2581
|
Object.defineProperty(exports, "__esModule", {
|
|
2338
2582
|
value: true
|
|
2339
2583
|
});
|
|
2584
|
+
|
|
2340
2585
|
var React = __webpack_require__(1);
|
|
2586
|
+
|
|
2341
2587
|
var d3_array_1 = __webpack_require__(64);
|
|
2342
|
-
|
|
2588
|
+
|
|
2589
|
+
var d3_scale_1 = __webpack_require__(93);
|
|
2590
|
+
|
|
2343
2591
|
var T = __webpack_require__(0);
|
|
2592
|
+
|
|
2344
2593
|
var i18n_1 = __webpack_require__(2);
|
|
2594
|
+
|
|
2345
2595
|
var Message_1 = __webpack_require__(10);
|
|
2596
|
+
|
|
2346
2597
|
var ParallelCoordinatesChart_1 = __webpack_require__(433);
|
|
2598
|
+
|
|
2347
2599
|
var PureParallelCoordinates = function PureParallelCoordinates(_a) {
|
|
2348
2600
|
var props = __rest(_a, []);
|
|
2601
|
+
|
|
2349
2602
|
var width = props.width,
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2603
|
+
height = props.height,
|
|
2604
|
+
columns = props.columns,
|
|
2605
|
+
fields = props.fields,
|
|
2606
|
+
showNullAxis = props.showNullAxis,
|
|
2607
|
+
lineColor = props.lineColor,
|
|
2608
|
+
backgroundColor = props.backgroundColor,
|
|
2609
|
+
axisLineHighlightColor = props.axisLineHighlightColor,
|
|
2610
|
+
axisLineColor = props.axisLineColor,
|
|
2611
|
+
axisTitleColor = props.axisTitleColor,
|
|
2612
|
+
axisLabelColor = props.axisLabelColor,
|
|
2613
|
+
lineOpacity = props.lineOpacity,
|
|
2614
|
+
filterButtonDisabledColor = props.filterButtonDisabledColor,
|
|
2615
|
+
filterButtonActiveColor = props.filterButtonActiveColor,
|
|
2616
|
+
filterTextColor = props.filterTextColor,
|
|
2617
|
+
truncatedTextColor = props.truncatedTextColor,
|
|
2618
|
+
filterSelectionColor = props.filterSelectionColor,
|
|
2619
|
+
textShadowColor = props.textShadowColor,
|
|
2620
|
+
mode = props.mode;
|
|
2368
2621
|
var minWidth = 200;
|
|
2369
2622
|
var minHieght = 150;
|
|
2623
|
+
|
|
2370
2624
|
if (width < minWidth || height < minHieght) {
|
|
2371
2625
|
return React.createElement(Message_1.default, {
|
|
2372
2626
|
width: width,
|
|
@@ -2375,24 +2629,28 @@ var PureParallelCoordinates = function PureParallelCoordinates(_a) {
|
|
|
2375
2629
|
level: "info"
|
|
2376
2630
|
});
|
|
2377
2631
|
}
|
|
2632
|
+
|
|
2378
2633
|
var nullOffsetHeight = 30;
|
|
2379
2634
|
var axisPadding = 0.3;
|
|
2380
2635
|
var minLabelHeight = 16;
|
|
2381
|
-
var truncatedCategoriesFlag = false;
|
|
2382
|
-
|
|
2636
|
+
var truncatedCategoriesFlag = false; // Set up chart margins
|
|
2637
|
+
|
|
2383
2638
|
var margin = {
|
|
2384
2639
|
top: 27,
|
|
2385
2640
|
right: 20,
|
|
2386
2641
|
bottom: 40,
|
|
2387
2642
|
left: 40
|
|
2388
2643
|
};
|
|
2644
|
+
|
|
2389
2645
|
if (showNullAxis) {
|
|
2390
2646
|
margin.bottom += nullOffsetHeight;
|
|
2391
2647
|
}
|
|
2648
|
+
|
|
2392
2649
|
var chartWidth = +width - margin.left - margin.right;
|
|
2393
|
-
var chartHeight = +height - margin.top - margin.bottom;
|
|
2394
|
-
|
|
2650
|
+
var chartHeight = +height - margin.top - margin.bottom; // Data processing logic:
|
|
2651
|
+
|
|
2395
2652
|
var data = [];
|
|
2653
|
+
|
|
2396
2654
|
var _loop = function _loop(i) {
|
|
2397
2655
|
var newObj = {};
|
|
2398
2656
|
fields.forEach(function (field, index) {
|
|
@@ -2404,22 +2662,26 @@ var PureParallelCoordinates = function PureParallelCoordinates(_a) {
|
|
|
2404
2662
|
});
|
|
2405
2663
|
data.push(newObj);
|
|
2406
2664
|
};
|
|
2665
|
+
|
|
2407
2666
|
for (var i = 0; i < columns[0].length; i += 1) {
|
|
2408
2667
|
_loop(i);
|
|
2409
|
-
}
|
|
2410
|
-
|
|
2668
|
+
} // Calculate horizontal and vertical scales
|
|
2669
|
+
|
|
2670
|
+
|
|
2411
2671
|
var keys = Object.keys(data[0]);
|
|
2412
|
-
var yPositionScale = {};
|
|
2413
|
-
|
|
2672
|
+
var yPositionScale = {}; // check whether the value is numeric
|
|
2673
|
+
|
|
2414
2674
|
var quantVal = function quantVal(v) {
|
|
2415
2675
|
return !Number.isNaN(Number(v)) || v === null;
|
|
2416
|
-
};
|
|
2417
|
-
|
|
2676
|
+
}; // const dimensions = keys.filter(key => key !== 'name');
|
|
2677
|
+
|
|
2678
|
+
|
|
2418
2679
|
var dimensions = [].concat(keys);
|
|
2419
2680
|
dimensions.forEach(function (d) {
|
|
2420
2681
|
var val = data.map(function (p) {
|
|
2421
2682
|
return p[d];
|
|
2422
2683
|
});
|
|
2684
|
+
|
|
2423
2685
|
if (val.every(quantVal)) {
|
|
2424
2686
|
// set numeric axis scale
|
|
2425
2687
|
yPositionScale[d] = (0, d3_scale_1.scaleLinear)().domain((0, d3_array_1.extent)(data, function (p) {
|
|
@@ -2431,6 +2693,7 @@ var PureParallelCoordinates = function PureParallelCoordinates(_a) {
|
|
|
2431
2693
|
return val.indexOf(v) === i;
|
|
2432
2694
|
});
|
|
2433
2695
|
var updatedDomain;
|
|
2696
|
+
|
|
2434
2697
|
if (chartHeight / categoryDomain.length > minLabelHeight) {
|
|
2435
2698
|
updatedDomain = _toConsumableArray(categoryDomain);
|
|
2436
2699
|
} else {
|
|
@@ -2440,6 +2703,7 @@ var PureParallelCoordinates = function PureParallelCoordinates(_a) {
|
|
|
2440
2703
|
return updatedDomain.includes(row[d]);
|
|
2441
2704
|
});
|
|
2442
2705
|
}
|
|
2706
|
+
|
|
2443
2707
|
yPositionScale[d] = (0, d3_scale_1.scalePoint)().domain(updatedDomain).range([chartHeight, 0]);
|
|
2444
2708
|
}
|
|
2445
2709
|
});
|
|
@@ -2474,6 +2738,7 @@ var PureParallelCoordinates = function PureParallelCoordinates(_a) {
|
|
|
2474
2738
|
mode: mode
|
|
2475
2739
|
});
|
|
2476
2740
|
};
|
|
2741
|
+
|
|
2477
2742
|
PureParallelCoordinates.propTypes = {
|
|
2478
2743
|
backgroundColor: T.string,
|
|
2479
2744
|
width: T.number,
|
|
@@ -2528,28 +2793,42 @@ exports.default = PureParallelCoordinates;
|
|
|
2528
2793
|
|
|
2529
2794
|
|
|
2530
2795
|
var _toConsumableArray = __webpack_require__(8);
|
|
2796
|
+
|
|
2531
2797
|
var _slicedToArray = __webpack_require__(17);
|
|
2798
|
+
|
|
2532
2799
|
var __rest = this && this.__rest || function (s, e) {
|
|
2533
2800
|
var t = {};
|
|
2801
|
+
|
|
2534
2802
|
for (var p in s) {
|
|
2535
2803
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2536
2804
|
}
|
|
2805
|
+
|
|
2537
2806
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2538
2807
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2539
2808
|
}
|
|
2540
2809
|
return t;
|
|
2541
2810
|
};
|
|
2811
|
+
|
|
2542
2812
|
Object.defineProperty(exports, "__esModule", {
|
|
2543
2813
|
value: true
|
|
2544
2814
|
});
|
|
2815
|
+
|
|
2545
2816
|
var React = __webpack_require__(1);
|
|
2817
|
+
|
|
2546
2818
|
var styled_components_1 = __webpack_require__(4);
|
|
2819
|
+
|
|
2547
2820
|
var d3_selection_1 = __webpack_require__(434);
|
|
2821
|
+
|
|
2548
2822
|
var d3_brush_1 = __webpack_require__(435);
|
|
2823
|
+
|
|
2549
2824
|
var d3_axis_1 = __webpack_require__(436);
|
|
2825
|
+
|
|
2550
2826
|
var d3_drag_1 = __webpack_require__(437);
|
|
2551
|
-
|
|
2827
|
+
|
|
2828
|
+
var rgb_hex_converter_1 = __webpack_require__(164);
|
|
2829
|
+
|
|
2552
2830
|
var ParallelCoordinatesCanvas_1 = __webpack_require__(438);
|
|
2831
|
+
|
|
2553
2832
|
var ChartDiv = styled_components_1.default.div.withConfig({
|
|
2554
2833
|
displayName: "ParallelCoordinatesChart__ChartDiv",
|
|
2555
2834
|
componentId: "sc-1oivyc-0"
|
|
@@ -2576,112 +2855,129 @@ var FilterButton = styled_components_1.default.button.attrs({
|
|
|
2576
2855
|
})(["margin-left:16px;display:flex;border:none;background:none;color:", ";cursor:pointer;font-size:12px;padding-top:0;padding-bottom:0;padding-left:0;"], function (props) {
|
|
2577
2856
|
return props.filterButtonColor;
|
|
2578
2857
|
});
|
|
2858
|
+
|
|
2579
2859
|
var ParallelCoordinatesChart = function ParallelCoordinatesChart(_a) {
|
|
2580
2860
|
var props = __rest(_a, []);
|
|
2861
|
+
|
|
2581
2862
|
var width = props.width,
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2863
|
+
height = props.height,
|
|
2864
|
+
margin = props.margin,
|
|
2865
|
+
axisPadding = props.axisPadding,
|
|
2866
|
+
data = props.data,
|
|
2867
|
+
dimensions = props.dimensions,
|
|
2868
|
+
xPositionScale = props.xPositionScale,
|
|
2869
|
+
yPositionScale = props.yPositionScale,
|
|
2870
|
+
showNullAxis = props.showNullAxis,
|
|
2871
|
+
nullOffsetHeight = props.nullOffsetHeight,
|
|
2872
|
+
nullAxisScale = props.nullAxisScale,
|
|
2873
|
+
lineColor = props.lineColor,
|
|
2874
|
+
lineOpacity = props.lineOpacity,
|
|
2875
|
+
backgroundColor = props.backgroundColor,
|
|
2876
|
+
axisLineHighlightColor = props.axisLineHighlightColor,
|
|
2877
|
+
axisLineColor = props.axisLineColor,
|
|
2878
|
+
axisTitleColor = props.axisTitleColor,
|
|
2879
|
+
axisLabelColor = props.axisLabelColor,
|
|
2880
|
+
filterButtonDisabledColor = props.filterButtonDisabledColor,
|
|
2881
|
+
filterButtonActiveColor = props.filterButtonActiveColor,
|
|
2882
|
+
filterTextColor = props.filterTextColor,
|
|
2883
|
+
truncatedCategoriesFlag = props.truncatedCategoriesFlag,
|
|
2884
|
+
truncatedTextColor = props.truncatedTextColor,
|
|
2885
|
+
filterSelectionColor = props.filterSelectionColor,
|
|
2886
|
+
textShadowColor = props.textShadowColor;
|
|
2606
2887
|
var brushWidth = 16;
|
|
2607
|
-
var maxStrLength = 7;
|
|
2608
|
-
|
|
2609
|
-
var dragging = {};
|
|
2610
|
-
|
|
2888
|
+
var maxStrLength = 7; // axis dragging storage variable
|
|
2889
|
+
|
|
2890
|
+
var dragging = {}; // brushing event handling variables
|
|
2891
|
+
|
|
2611
2892
|
var brush = (0, d3_brush_1.brushY)().extent([[-brushWidth / 2, 0], [brushWidth / 2, height]]);
|
|
2612
|
-
var updatedTextShadowColor = backgroundColor === 'transparent' ? textShadowColor : backgroundColor;
|
|
2613
|
-
|
|
2893
|
+
var updatedTextShadowColor = backgroundColor === 'transparent' ? textShadowColor : backgroundColor; // axis dragging feature state declaration
|
|
2894
|
+
|
|
2614
2895
|
var _React$useState = React.useState(dimensions),
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2896
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2897
|
+
currentDimensions = _React$useState2[0],
|
|
2898
|
+
setCurrentDimensions = _React$useState2[1];
|
|
2899
|
+
|
|
2618
2900
|
var _React$useState3 = React.useState(false),
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2901
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
2902
|
+
dragStatus = _React$useState4[0],
|
|
2903
|
+
setDragStatus = _React$useState4[1]; // brushing feature state declaration
|
|
2904
|
+
|
|
2905
|
+
|
|
2622
2906
|
var _React$useState5 = React.useState(data),
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2907
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
2908
|
+
selectedData = _React$useState6[0],
|
|
2909
|
+
setSelectedData = _React$useState6[1];
|
|
2910
|
+
|
|
2626
2911
|
var _React$useState7 = React.useState(new Map()),
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2912
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
2913
|
+
selections = _React$useState8[0],
|
|
2914
|
+
setSelections = _React$useState8[1];
|
|
2915
|
+
|
|
2630
2916
|
var _React$useState9 = React.useState(false),
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2917
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
2918
|
+
filterPromptState = _React$useState10[0],
|
|
2919
|
+
setFilterPromptState = _React$useState10[1];
|
|
2920
|
+
|
|
2634
2921
|
var _React$useState11 = React.useState(filterButtonDisabledColor),
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
// update xPositionScale
|
|
2922
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
2923
|
+
filterButtonColor = _React$useState12[0],
|
|
2924
|
+
setFilterButtonColor = _React$useState12[1];
|
|
2925
|
+
|
|
2926
|
+
var svgRef = React.useRef(null); // update xPositionScale
|
|
2927
|
+
|
|
2640
2928
|
xPositionScale.domain(currentDimensions);
|
|
2641
|
-
nullAxisScale.domain(currentDimensions).range([0, width - 2 * axisPadding * xPositionScale.step()]);
|
|
2642
|
-
|
|
2929
|
+
nullAxisScale.domain(currentDimensions).range([0, width - 2 * axisPadding * xPositionScale.step()]); // axis dragging helper functions
|
|
2930
|
+
|
|
2643
2931
|
var position = function position(d) {
|
|
2644
2932
|
var v = dragging[d];
|
|
2645
2933
|
return v == null ? xPositionScale(d) : v;
|
|
2646
2934
|
};
|
|
2935
|
+
|
|
2647
2936
|
var transition = function transition(g) {
|
|
2648
2937
|
return g.transition().duration(500);
|
|
2649
|
-
};
|
|
2650
|
-
|
|
2938
|
+
}; // clear filter button
|
|
2939
|
+
|
|
2940
|
+
|
|
2651
2941
|
var clearAllFilters = function clearAllFilters() {
|
|
2652
2942
|
(0, d3_selection_1.select)(svgRef.current).selectAll('.brush').call(brush.move, null);
|
|
2653
2943
|
setSelections(new Map());
|
|
2654
2944
|
setSelectedData(data);
|
|
2655
2945
|
setFilterPromptState(false);
|
|
2656
2946
|
setFilterButtonColor(filterButtonDisabledColor);
|
|
2657
|
-
};
|
|
2658
|
-
|
|
2947
|
+
}; // truncated string to a length for categorical axis label
|
|
2948
|
+
|
|
2949
|
+
|
|
2659
2950
|
var truncate = function truncate(str, maxLength) {
|
|
2660
2951
|
var updatedSuffix = '...';
|
|
2661
2952
|
var updateStr = str || 'null';
|
|
2953
|
+
|
|
2662
2954
|
if (Array.isArray(updateStr)) {
|
|
2663
2955
|
updateStr = updateStr.join(', ');
|
|
2664
2956
|
}
|
|
2957
|
+
|
|
2665
2958
|
if (typeof updateStr === 'string' && updateStr.length > maxLength) {
|
|
2666
2959
|
updateStr = updateStr.substring(0, maxLength - 1);
|
|
2667
2960
|
updateStr += updatedSuffix;
|
|
2668
2961
|
}
|
|
2962
|
+
|
|
2669
2963
|
return updateStr;
|
|
2670
2964
|
};
|
|
2965
|
+
|
|
2671
2966
|
React.useEffect(function () {
|
|
2672
2967
|
// clean svg before drawing
|
|
2673
|
-
var svg = (0, d3_selection_1.select)(svgRef.current).html('').attr('height', height + margin.top + margin.bottom).attr('width', width + margin.left + margin.right).append('g').attr('transform', "translate(".concat(margin.left, ",").concat(margin.top, ")"));
|
|
2674
|
-
|
|
2968
|
+
var svg = (0, d3_selection_1.select)(svgRef.current).html('').attr('height', height + margin.top + margin.bottom).attr('width', width + margin.left + margin.right).append('g').attr('transform', "translate(".concat(margin.left, ",").concat(margin.top, ")")); // Add a group element for each dimension
|
|
2969
|
+
|
|
2675
2970
|
var g = svg.selectAll('.dimension').data(currentDimensions).join('g').attr('class', 'dimension').attr('data-test', 'dimension').attr('transform', function (d) {
|
|
2676
2971
|
return "translate(".concat(xPositionScale(d), ")");
|
|
2677
|
-
}).style('cursor', 'ew-resize');
|
|
2678
|
-
|
|
2972
|
+
}).style('cursor', 'ew-resize'); // axis dragging event handling
|
|
2973
|
+
|
|
2679
2974
|
var dragstarted = function dragstarted(event, d) {
|
|
2680
2975
|
(0, d3_selection_1.select)(event.sourceEvent.currentTarget).selectAll('.axis path').style('stroke', axisLineHighlightColor);
|
|
2681
2976
|
(0, d3_selection_1.select)(event.sourceEvent.currentTarget).selectAll('.axis line').style('stroke', axisLineHighlightColor);
|
|
2682
2977
|
dragging[d] = xPositionScale(d);
|
|
2683
2978
|
setDragStatus(true);
|
|
2684
2979
|
};
|
|
2980
|
+
|
|
2685
2981
|
var dragged = function dragged(event, d) {
|
|
2686
2982
|
dragging[d] = Math.min(width, Math.max(0, event.x));
|
|
2687
2983
|
currentDimensions.sort(function (a, b) {
|
|
@@ -2693,14 +2989,16 @@ var ParallelCoordinatesChart = function ParallelCoordinatesChart(_a) {
|
|
|
2693
2989
|
return "translate(".concat(position(p), ")");
|
|
2694
2990
|
});
|
|
2695
2991
|
};
|
|
2992
|
+
|
|
2696
2993
|
function dragended(_event, d) {
|
|
2697
2994
|
delete dragging[d];
|
|
2698
2995
|
(0, d3_selection_1.select)(this).select('.axis path').style('stroke', axisLineColor);
|
|
2699
2996
|
(0, d3_selection_1.select)(this).selectAll('.axis line').style('stroke', axisLineColor);
|
|
2700
2997
|
transition((0, d3_selection_1.select)(this).attr('transform', "translate(".concat(xPositionScale(d), ")")));
|
|
2701
2998
|
setDragStatus(false);
|
|
2702
|
-
}
|
|
2703
|
-
|
|
2999
|
+
} // Add vertical axis and title.
|
|
3000
|
+
|
|
3001
|
+
|
|
2704
3002
|
g.append('g').attr('class', 'axis vertical-axis').each(function (d, i, nodes) {
|
|
2705
3003
|
if (yPositionScale[d].ticks) {
|
|
2706
3004
|
// numerical axis
|
|
@@ -2711,8 +3009,7 @@ var ParallelCoordinatesChart = function ParallelCoordinatesChart(_a) {
|
|
|
2711
3009
|
// categorical axis and truncated long labels
|
|
2712
3010
|
(0, d3_selection_1.select)(nodes[i]).call((0, d3_axis_1.axisLeft)(yPositionScale[d]).tickFormat(function (p) {
|
|
2713
3011
|
return truncate(p, maxStrLength);
|
|
2714
|
-
}))
|
|
2715
|
-
// add title to show full value upon hover
|
|
3012
|
+
})) // add title to show full value upon hover
|
|
2716
3013
|
.selectAll('text').append('title').text(function (datum) {
|
|
2717
3014
|
return datum && datum.toString();
|
|
2718
3015
|
});
|
|
@@ -2720,37 +3017,42 @@ var ParallelCoordinatesChart = function ParallelCoordinatesChart(_a) {
|
|
|
2720
3017
|
}).selectAll('text').attr('fill', axisLabelColor).clone(true).lower().attr('fill', 'none').attr('stroke-width', 2).attr('stroke-linejoin', 'round').attr('stroke', "rgba(".concat((0, rgb_hex_converter_1.convertHexToRgb)(updatedTextShadowColor)[0], ",").concat((0, rgb_hex_converter_1.convertHexToRgb)(updatedTextShadowColor)[1], ",").concat((0, rgb_hex_converter_1.convertHexToRgb)(updatedTextShadowColor)[2], ", ", 0.8, ")"));
|
|
2721
3018
|
g.append('text').attr('class', 'axisTitle').attr('fill', axisTitleColor).attr('font-size', '12px').attr('text-anchor', 'middle').attr('y', -9).text(function (d) {
|
|
2722
3019
|
return d;
|
|
2723
|
-
});
|
|
2724
|
-
|
|
3020
|
+
}); // drawing the null axis
|
|
3021
|
+
|
|
2725
3022
|
if (showNullAxis) {
|
|
2726
|
-
var nullAxisOffsetHeight = yPositionScale[currentDimensions[0]].range()[0] + nullOffsetHeight;
|
|
2727
|
-
|
|
3023
|
+
var nullAxisOffsetHeight = yPositionScale[currentDimensions[0]].range()[0] + nullOffsetHeight; // append null axis and title
|
|
3024
|
+
|
|
2728
3025
|
svg.append('g').attr('class', 'axis null-axis').attr('transform', "translate(".concat(xPositionScale.step() * axisPadding, ", ").concat(nullAxisOffsetHeight, ")")).attr('fill', 'none').call((0, d3_axis_1.axisTop)(nullAxisScale).tickFormat(function () {
|
|
2729
3026
|
return '';
|
|
2730
3027
|
}));
|
|
2731
3028
|
svg.append('text').attr('text-anchor', 'end').attr('font-size', '11px').attr('x', axisPadding * xPositionScale.step() - 9).attr('y', height + nullOffsetHeight).text('null').attr('fill', axisLabelColor);
|
|
2732
|
-
}
|
|
2733
|
-
|
|
3029
|
+
} // customize axis line and ticks based on themes
|
|
3030
|
+
|
|
3031
|
+
|
|
2734
3032
|
(0, d3_selection_1.selectAll)('.axis .domain').style('stroke', axisLineColor);
|
|
2735
|
-
(0, d3_selection_1.selectAll)('.axis line').style('stroke', axisLineColor);
|
|
2736
|
-
|
|
2737
|
-
svg.selectAll('.dimension').call((0, d3_drag_1.drag)().on('start', dragstarted).on('drag', dragged).on('end', dragended));
|
|
2738
|
-
|
|
3033
|
+
(0, d3_selection_1.selectAll)('.axis line').style('stroke', axisLineColor); // added dragging event functions to each dimension
|
|
3034
|
+
|
|
3035
|
+
svg.selectAll('.dimension').call((0, d3_drag_1.drag)().on('start', dragstarted).on('drag', dragged).on('end', dragended)); // brushing event handling
|
|
3036
|
+
|
|
2739
3037
|
var brushStart = function brushStart(event) {
|
|
2740
3038
|
// prevent brushing event trigger clicking event
|
|
2741
3039
|
if (event.sourceEvent) {
|
|
2742
3040
|
event.sourceEvent.stopPropagation();
|
|
2743
3041
|
}
|
|
3042
|
+
|
|
2744
3043
|
setFilterPromptState(true);
|
|
2745
|
-
setFilterButtonColor(filterButtonActiveColor);
|
|
2746
|
-
|
|
3044
|
+
setFilterButtonColor(filterButtonActiveColor); // style filter selection box rect
|
|
3045
|
+
|
|
2747
3046
|
(0, d3_selection_1.selectAll)('rect.selection').attr('fill', filterSelectionColor).attr('fill-opacity', '0.3').attr('stroke', 'none').attr('rx', '4px');
|
|
2748
|
-
};
|
|
2749
|
-
|
|
3047
|
+
}; // updated selectedData after brushing
|
|
3048
|
+
|
|
3049
|
+
|
|
2750
3050
|
var brushed = function brushed(_ref, key) {
|
|
2751
3051
|
var selection = _ref.selection;
|
|
3052
|
+
|
|
2752
3053
|
if (selection === null) {
|
|
2753
3054
|
selections.delete(key);
|
|
3055
|
+
|
|
2754
3056
|
if (selections.size === 0) {
|
|
2755
3057
|
setFilterButtonColor(filterButtonDisabledColor);
|
|
2756
3058
|
setFilterPromptState(false);
|
|
@@ -2765,27 +3067,31 @@ var ParallelCoordinatesChart = function ParallelCoordinatesChart(_a) {
|
|
|
2765
3067
|
// categorical scale (aka scalePoint)
|
|
2766
3068
|
selections.set(key, [selection[1], selection[0]]);
|
|
2767
3069
|
}
|
|
3070
|
+
|
|
2768
3071
|
var selected = [];
|
|
2769
3072
|
data.forEach(function (d) {
|
|
2770
3073
|
// Categorical Axis: convert ordinal dimension's values to pixels
|
|
2771
3074
|
// Numerical Axis: compare numerical values with dataSources
|
|
2772
3075
|
var active = Array.from(selections).every(function (_ref2) {
|
|
2773
3076
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
3077
|
+
activeKey = _ref3[0],
|
|
3078
|
+
_ref3$ = _slicedToArray(_ref3[1], 2),
|
|
3079
|
+
max = _ref3$[0],
|
|
3080
|
+
min = _ref3$[1];
|
|
3081
|
+
|
|
2778
3082
|
var newP = yPositionScale[activeKey].ticks ? d[activeKey] : yPositionScale[activeKey](d[activeKey]);
|
|
2779
3083
|
return newP >= min && newP <= max;
|
|
2780
3084
|
});
|
|
3085
|
+
|
|
2781
3086
|
if (active) {
|
|
2782
3087
|
selected.push(d);
|
|
2783
3088
|
}
|
|
2784
3089
|
});
|
|
2785
3090
|
setSelectedData(selected);
|
|
2786
3091
|
};
|
|
2787
|
-
|
|
2788
|
-
// add and store a brush for each axis.
|
|
3092
|
+
|
|
3093
|
+
brush.on('start', brushStart).on('brush end', brushed); // add and store a brush for each axis.
|
|
3094
|
+
|
|
2789
3095
|
g.append('g').attr('class', 'brush').each(function (_d, i, nodes) {
|
|
2790
3096
|
(0, d3_selection_1.select)(nodes[i]).call(brush);
|
|
2791
3097
|
});
|
|
@@ -2844,6 +3150,7 @@ var ParallelCoordinatesChart = function ParallelCoordinatesChart(_a) {
|
|
|
2844
3150
|
"data-testid": "truncated-data-warning"
|
|
2845
3151
|
}, "Note: Your data is currently truncated due to a high amount of categorical values"))));
|
|
2846
3152
|
};
|
|
3153
|
+
|
|
2847
3154
|
exports.default = ParallelCoordinatesChart;
|
|
2848
3155
|
|
|
2849
3156
|
/***/ }),
|
|
@@ -2884,45 +3191,53 @@ module.exports = require("d3-drag");
|
|
|
2884
3191
|
|
|
2885
3192
|
var __rest = this && this.__rest || function (s, e) {
|
|
2886
3193
|
var t = {};
|
|
3194
|
+
|
|
2887
3195
|
for (var p in s) {
|
|
2888
3196
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2889
3197
|
}
|
|
3198
|
+
|
|
2890
3199
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2891
3200
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2892
3201
|
}
|
|
2893
3202
|
return t;
|
|
2894
3203
|
};
|
|
3204
|
+
|
|
2895
3205
|
Object.defineProperty(exports, "__esModule", {
|
|
2896
3206
|
value: true
|
|
2897
3207
|
});
|
|
3208
|
+
|
|
2898
3209
|
var React = __webpack_require__(1);
|
|
2899
|
-
|
|
3210
|
+
|
|
3211
|
+
var rgb_hex_converter_1 = __webpack_require__(164);
|
|
3212
|
+
|
|
2900
3213
|
var ParallelCoordinatesCanvas = function ParallelCoordinatesCanvas(_a) {
|
|
2901
3214
|
var props = __rest(_a, []);
|
|
3215
|
+
|
|
2902
3216
|
var width = props.width,
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
3217
|
+
height = props.height,
|
|
3218
|
+
margin = props.margin,
|
|
3219
|
+
data = props.data,
|
|
3220
|
+
selectedData = props.selectedData,
|
|
3221
|
+
currentDimensions = props.currentDimensions,
|
|
3222
|
+
xPositionScale = props.xPositionScale,
|
|
3223
|
+
yPositionScale = props.yPositionScale,
|
|
3224
|
+
dragStatus = props.dragStatus,
|
|
3225
|
+
showNullAxis = props.showNullAxis,
|
|
3226
|
+
nullOffsetHeight = props.nullOffsetHeight,
|
|
3227
|
+
lineColor = props.lineColor,
|
|
3228
|
+
lineOpacity = props.lineOpacity,
|
|
3229
|
+
backgroundColor = props.backgroundColor;
|
|
2916
3230
|
var foregroundRef = React.useRef(null);
|
|
2917
|
-
var backgroundRef = React.useRef(null);
|
|
2918
|
-
|
|
2919
|
-
var dpr = window.devicePixelRatio || 1;
|
|
2920
|
-
|
|
3231
|
+
var backgroundRef = React.useRef(null); // Get the device pixel ratio, falling back to 1.
|
|
3232
|
+
|
|
3233
|
+
var dpr = window.devicePixelRatio || 1; // draw path on two layers of canvas
|
|
3234
|
+
|
|
2921
3235
|
var path = function path(d, ctx, dimensions) {
|
|
2922
3236
|
if (showNullAxis) {
|
|
2923
3237
|
ctx.beginPath();
|
|
2924
3238
|
dimensions.forEach(function (p, i) {
|
|
2925
3239
|
var updatedYPosition;
|
|
3240
|
+
|
|
2926
3241
|
if (d[p] == null) {
|
|
2927
3242
|
// add nullOffsetHeight to the bottom position of each axes and make it as the new yPosition of the null data
|
|
2928
3243
|
updatedYPosition = yPositionScale[p].range()[0] + nullOffsetHeight;
|
|
@@ -2930,6 +3245,7 @@ var ParallelCoordinatesCanvas = function ParallelCoordinatesCanvas(_a) {
|
|
|
2930
3245
|
// otherwise, yPosition stays at the same scale
|
|
2931
3246
|
updatedYPosition = yPositionScale[p](d[p]);
|
|
2932
3247
|
}
|
|
3248
|
+
|
|
2933
3249
|
if (i === 0) {
|
|
2934
3250
|
ctx.moveTo(xPositionScale(p), updatedYPosition);
|
|
2935
3251
|
} else {
|
|
@@ -2947,6 +3263,7 @@ var ParallelCoordinatesCanvas = function ParallelCoordinatesCanvas(_a) {
|
|
|
2947
3263
|
ctx.lineTo(xPositionScale(p), yPositionScale[p](d[p]));
|
|
2948
3264
|
ctx.stroke();
|
|
2949
3265
|
}
|
|
3266
|
+
|
|
2950
3267
|
if (d[p] !== null) {
|
|
2951
3268
|
prev = p;
|
|
2952
3269
|
} else {
|
|
@@ -2954,23 +3271,25 @@ var ParallelCoordinatesCanvas = function ParallelCoordinatesCanvas(_a) {
|
|
|
2954
3271
|
}
|
|
2955
3272
|
});
|
|
2956
3273
|
}
|
|
2957
|
-
};
|
|
2958
|
-
|
|
3274
|
+
}; // draw all the lines on background canvas
|
|
3275
|
+
|
|
3276
|
+
|
|
2959
3277
|
React.useEffect(function () {
|
|
2960
3278
|
var backgroundCanvas = backgroundRef.current;
|
|
2961
3279
|
var background = backgroundCanvas.getContext('2d');
|
|
2962
3280
|
backgroundCanvas.width = (width + margin.left + margin.right) * dpr;
|
|
2963
|
-
backgroundCanvas.height = (height + margin.top + margin.bottom) * dpr;
|
|
2964
|
-
|
|
3281
|
+
backgroundCanvas.height = (height + margin.top + margin.bottom) * dpr; // ensure all drawing operations are scaled
|
|
3282
|
+
|
|
2965
3283
|
background.scale(dpr, dpr);
|
|
2966
3284
|
background.clearRect(0, 0, width + margin.left + margin.right, height + margin.top + margin.bottom);
|
|
2967
3285
|
background.translate(margin.left, margin.top);
|
|
3286
|
+
|
|
2968
3287
|
if (backgroundColor !== 'transparent') {
|
|
2969
3288
|
background.strokeStyle = "rgba(".concat((0, rgb_hex_converter_1.convertHexToRgb)(lineColor)[0], ", ").concat((0, rgb_hex_converter_1.convertHexToRgb)(lineColor)[1], ", ").concat((0, rgb_hex_converter_1.convertHexToRgb)(lineColor)[2], ", ").concat(lineOpacity, ")");
|
|
2970
3289
|
data.forEach(function (d) {
|
|
2971
3290
|
return path(d, background, currentDimensions);
|
|
2972
|
-
});
|
|
2973
|
-
|
|
3291
|
+
}); // backgroundColor-ed or default page color mask btw background and foreground lines
|
|
3292
|
+
|
|
2974
3293
|
background.globalAlpha = 0.7;
|
|
2975
3294
|
background.fillStyle = backgroundColor;
|
|
2976
3295
|
background.fillRect(-10, -10, width + margin.right, height + margin.bottom);
|
|
@@ -2981,15 +3300,15 @@ var ParallelCoordinatesCanvas = function ParallelCoordinatesCanvas(_a) {
|
|
|
2981
3300
|
return path(d, background, currentDimensions);
|
|
2982
3301
|
});
|
|
2983
3302
|
}
|
|
2984
|
-
}, [data, height, margin, width, currentDimensions, showNullAxis, nullOffsetHeight, lineColor, lineOpacity, backgroundColor, dpr]);
|
|
2985
|
-
// draw lines on the foreground canvas
|
|
3303
|
+
}, [data, height, margin, width, currentDimensions, showNullAxis, nullOffsetHeight, lineColor, lineOpacity, backgroundColor, dpr]); // draw lines on the foreground canvas
|
|
2986
3304
|
// when selectedData is updated via brushing, re-draw the foreground canvas
|
|
3305
|
+
|
|
2987
3306
|
React.useEffect(function () {
|
|
2988
3307
|
var foregroundCanvas = foregroundRef.current;
|
|
2989
3308
|
var foreground = foregroundCanvas.getContext('2d');
|
|
2990
3309
|
foregroundCanvas.width = (width + margin.left + margin.right) * dpr;
|
|
2991
|
-
foregroundCanvas.height = (height + margin.top + margin.bottom) * dpr;
|
|
2992
|
-
|
|
3310
|
+
foregroundCanvas.height = (height + margin.top + margin.bottom) * dpr; // ensure all drawing operations are scaled
|
|
3311
|
+
|
|
2993
3312
|
foreground.scale(dpr, dpr);
|
|
2994
3313
|
foreground.clearRect(0, 0, width + margin.left + margin.right, height + margin.top + margin.bottom);
|
|
2995
3314
|
foreground.translate(margin.left, margin.top);
|
|
@@ -3020,6 +3339,7 @@ var ParallelCoordinatesCanvas = function ParallelCoordinatesCanvas(_a) {
|
|
|
3020
3339
|
}
|
|
3021
3340
|
}));
|
|
3022
3341
|
};
|
|
3342
|
+
|
|
3023
3343
|
exports.default = ParallelCoordinatesCanvas;
|
|
3024
3344
|
|
|
3025
3345
|
/***/ }),
|
|
@@ -3033,17 +3353,29 @@ exports.default = ParallelCoordinatesCanvas;
|
|
|
3033
3353
|
Object.defineProperty(exports, "__esModule", {
|
|
3034
3354
|
value: true
|
|
3035
3355
|
});
|
|
3356
|
+
|
|
3036
3357
|
var i18n_1 = __webpack_require__(2);
|
|
3358
|
+
|
|
3037
3359
|
var schemaUtils_1 = __webpack_require__(16);
|
|
3360
|
+
|
|
3038
3361
|
var pick_1 = __webpack_require__(23);
|
|
3362
|
+
|
|
3039
3363
|
var variables_1 = __webpack_require__(11);
|
|
3364
|
+
|
|
3040
3365
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
3366
|
+
|
|
3041
3367
|
var visualization_icons_1 = __webpack_require__(52);
|
|
3368
|
+
|
|
3042
3369
|
var placeholders_1 = __webpack_require__(50);
|
|
3370
|
+
|
|
3043
3371
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3372
|
+
|
|
3044
3373
|
var configUtils_1 = __webpack_require__(20);
|
|
3045
|
-
|
|
3374
|
+
|
|
3375
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
3376
|
+
|
|
3046
3377
|
var BackgroundColor_1 = __webpack_require__(53);
|
|
3378
|
+
|
|
3047
3379
|
var dataContract = {
|
|
3048
3380
|
requiredDataSources: [{
|
|
3049
3381
|
name: 'primary',
|
|
@@ -3215,17 +3547,20 @@ var editorConfig = [{
|
|
|
3215
3547
|
/**
|
|
3216
3548
|
* visualization configuration
|
|
3217
3549
|
*/
|
|
3550
|
+
|
|
3218
3551
|
var config = {
|
|
3219
3552
|
/**
|
|
3220
3553
|
* unique viz key
|
|
3221
3554
|
*/
|
|
3222
3555
|
key: 'splunk.parallelcoordinates',
|
|
3556
|
+
|
|
3223
3557
|
/**
|
|
3224
3558
|
* viz name
|
|
3225
3559
|
*/
|
|
3226
3560
|
name: (0, i18n_1._)('Parallel coordinates'),
|
|
3227
3561
|
category: VizCategory_1.VizCategory.CORRELATION,
|
|
3228
3562
|
status: 'preview',
|
|
3563
|
+
|
|
3229
3564
|
/**
|
|
3230
3565
|
* viz icon
|
|
3231
3566
|
*/
|
|
@@ -3254,7 +3589,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3254
3589
|
value: true
|
|
3255
3590
|
});
|
|
3256
3591
|
exports.useDeepMemo = void 0;
|
|
3592
|
+
|
|
3257
3593
|
var react_1 = __webpack_require__(1);
|
|
3594
|
+
|
|
3258
3595
|
var lodash_1 = __webpack_require__(3);
|
|
3259
3596
|
/**
|
|
3260
3597
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -3269,16 +3606,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
3269
3606
|
* @param fn the function to be executed and
|
|
3270
3607
|
* @param dependencies an array of dependencies
|
|
3271
3608
|
*/
|
|
3609
|
+
|
|
3610
|
+
|
|
3272
3611
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
3273
3612
|
var ref = (0, react_1.useRef)();
|
|
3613
|
+
|
|
3274
3614
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
3275
3615
|
ref.current = {
|
|
3276
3616
|
dependencies: dependencies,
|
|
3277
3617
|
value: fn()
|
|
3278
3618
|
};
|
|
3279
3619
|
}
|
|
3620
|
+
|
|
3280
3621
|
return ref.current.value;
|
|
3281
3622
|
};
|
|
3623
|
+
|
|
3282
3624
|
exports.useDeepMemo = useDeepMemo;
|
|
3283
3625
|
|
|
3284
3626
|
/***/ }),
|
|
@@ -3293,19 +3635,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3293
3635
|
value: true
|
|
3294
3636
|
});
|
|
3295
3637
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
3638
|
+
|
|
3296
3639
|
var React = __webpack_require__(1);
|
|
3640
|
+
|
|
3297
3641
|
var T = __webpack_require__(0);
|
|
3642
|
+
|
|
3298
3643
|
var i18n_1 = __webpack_require__(2);
|
|
3644
|
+
|
|
3299
3645
|
var Message_1 = __webpack_require__(10);
|
|
3646
|
+
|
|
3300
3647
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
3301
3648
|
/**
|
|
3302
3649
|
* @method isMissing
|
|
3303
3650
|
* @param {any} v
|
|
3304
3651
|
* @returns {boolean} true if the input value === null or undefined
|
|
3305
3652
|
*/
|
|
3653
|
+
|
|
3654
|
+
|
|
3306
3655
|
var isMissing = function isMissing(v) {
|
|
3307
3656
|
return v === null || v === undefined;
|
|
3308
3657
|
};
|
|
3658
|
+
|
|
3309
3659
|
exports.isMissing = isMissing;
|
|
3310
3660
|
/**
|
|
3311
3661
|
* @method misskingKeys
|
|
@@ -3313,11 +3663,13 @@ exports.isMissing = isMissing;
|
|
|
3313
3663
|
* @param {object} target
|
|
3314
3664
|
* @returns {string[]} the keys of missing required props
|
|
3315
3665
|
*/
|
|
3666
|
+
|
|
3316
3667
|
var missingKeys = function missingKeys(keys, target) {
|
|
3317
3668
|
return keys.filter(function (k) {
|
|
3318
3669
|
return (0, exports.isMissing)(target[k]);
|
|
3319
3670
|
});
|
|
3320
3671
|
};
|
|
3672
|
+
|
|
3321
3673
|
exports.missingKeys = missingKeys;
|
|
3322
3674
|
var propTypes = {
|
|
3323
3675
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -3331,10 +3683,11 @@ var propTypes = {
|
|
|
3331
3683
|
* @param {MissingPropsProps} props
|
|
3332
3684
|
* @returns {React.ReactElement}
|
|
3333
3685
|
*/
|
|
3686
|
+
|
|
3334
3687
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
3335
3688
|
var width = props.width,
|
|
3336
|
-
|
|
3337
|
-
|
|
3689
|
+
height = props.height,
|
|
3690
|
+
missingProps = props.missingProps;
|
|
3338
3691
|
return React.createElement(Message_1.default, {
|
|
3339
3692
|
"data-test": "message",
|
|
3340
3693
|
width: width,
|
|
@@ -3342,6 +3695,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
3342
3695
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
3343
3696
|
});
|
|
3344
3697
|
};
|
|
3698
|
+
|
|
3345
3699
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
3346
3700
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
3347
3701
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -3361,15 +3715,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
3361
3715
|
Object.defineProperty(exports, "__esModule", {
|
|
3362
3716
|
value: true
|
|
3363
3717
|
});
|
|
3718
|
+
|
|
3364
3719
|
var React = __webpack_require__(1);
|
|
3720
|
+
|
|
3365
3721
|
var styled_components_1 = __webpack_require__(4);
|
|
3722
|
+
|
|
3366
3723
|
var hocUtils_1 = __webpack_require__(15);
|
|
3724
|
+
|
|
3367
3725
|
var Cover = styled_components_1.default.div.withConfig({
|
|
3368
3726
|
displayName: "withEditModeCover__Cover",
|
|
3369
3727
|
componentId: "sc-1gsbnxb-0"
|
|
3370
3728
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
3371
3729
|
var Blocker = styled_components_1.default.div.attrs({
|
|
3372
|
-
'data-splunk-visualization-version': "26.
|
|
3730
|
+
'data-splunk-visualization-version': "26.1.1 - b6df0a015"
|
|
3373
3731
|
}).withConfig({
|
|
3374
3732
|
displayName: "withEditModeCover__Blocker",
|
|
3375
3733
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -3380,6 +3738,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
3380
3738
|
* @param {ExtendedDashViz} Visualization
|
|
3381
3739
|
* @returns {ExtendedDashViz} Wrapper
|
|
3382
3740
|
*/
|
|
3741
|
+
|
|
3383
3742
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
3384
3743
|
var Wrapper = function Wrapper(props) {
|
|
3385
3744
|
var mode = props.mode;
|
|
@@ -3388,12 +3747,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
3388
3747
|
"data-test": "edit-mode-cover"
|
|
3389
3748
|
}));
|
|
3390
3749
|
};
|
|
3750
|
+
|
|
3391
3751
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3392
3752
|
Wrapper: Wrapper,
|
|
3393
3753
|
Visualization: Visualization
|
|
3394
3754
|
});
|
|
3395
3755
|
return Wrapper;
|
|
3396
3756
|
};
|
|
3757
|
+
|
|
3397
3758
|
exports.default = withEditModeCover;
|
|
3398
3759
|
|
|
3399
3760
|
/***/ }),
|
|
@@ -3407,27 +3768,37 @@ exports.default = withEditModeCover;
|
|
|
3407
3768
|
Object.defineProperty(exports, "__esModule", {
|
|
3408
3769
|
value: true
|
|
3409
3770
|
});
|
|
3771
|
+
|
|
3410
3772
|
var React = __webpack_require__(1);
|
|
3773
|
+
|
|
3411
3774
|
var colorUtils_1 = __webpack_require__(12);
|
|
3775
|
+
|
|
3412
3776
|
var variables_1 = __webpack_require__(11);
|
|
3777
|
+
|
|
3413
3778
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
3779
|
+
|
|
3414
3780
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3781
|
+
|
|
3415
3782
|
var hocUtils_1 = __webpack_require__(15);
|
|
3783
|
+
|
|
3416
3784
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
3417
3785
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
3418
3786
|
var config = Visualization.config;
|
|
3419
3787
|
var themes = config.themes;
|
|
3788
|
+
|
|
3420
3789
|
var Wrapper = function Wrapper(props) {
|
|
3421
3790
|
var _a, _b;
|
|
3791
|
+
|
|
3422
3792
|
var dataSources = props.dataSources,
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3793
|
+
loading = props.loading,
|
|
3794
|
+
options = props.options,
|
|
3795
|
+
height = props.height,
|
|
3796
|
+
width = props.width;
|
|
3427
3797
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
3428
3798
|
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);
|
|
3429
3799
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
3430
3800
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
3801
|
+
|
|
3431
3802
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
3432
3803
|
return React.createElement(IconPlaceholder_1.default, {
|
|
3433
3804
|
"data-test": "icon-placeholder",
|
|
@@ -3438,14 +3809,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
3438
3809
|
iconColor: iconColor
|
|
3439
3810
|
});
|
|
3440
3811
|
}
|
|
3812
|
+
|
|
3441
3813
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
3442
3814
|
};
|
|
3815
|
+
|
|
3443
3816
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3444
3817
|
Wrapper: Wrapper,
|
|
3445
3818
|
Visualization: Visualization
|
|
3446
3819
|
});
|
|
3447
3820
|
return Wrapper;
|
|
3448
3821
|
};
|
|
3822
|
+
|
|
3449
3823
|
exports.default = withPlaceholder;
|
|
3450
3824
|
|
|
3451
3825
|
/***/ }),
|
|
@@ -3487,11 +3861,13 @@ module.exports = require("@splunk/visualization-icons");
|
|
|
3487
3861
|
Object.defineProperty(exports, "__esModule", {
|
|
3488
3862
|
value: true
|
|
3489
3863
|
});
|
|
3864
|
+
|
|
3490
3865
|
var i18n_1 = __webpack_require__(2);
|
|
3866
|
+
|
|
3491
3867
|
var background = function background(_ref) {
|
|
3492
3868
|
var label = _ref.label,
|
|
3493
|
-
|
|
3494
|
-
|
|
3869
|
+
themes = _ref.themes,
|
|
3870
|
+
labelPosition = _ref.labelPosition;
|
|
3495
3871
|
return [{
|
|
3496
3872
|
label: (0, i18n_1._)(label || 'Background'),
|
|
3497
3873
|
option: 'backgroundColor',
|
|
@@ -3502,6 +3878,7 @@ var background = function background(_ref) {
|
|
|
3502
3878
|
}
|
|
3503
3879
|
}];
|
|
3504
3880
|
};
|
|
3881
|
+
|
|
3505
3882
|
exports.default = background;
|
|
3506
3883
|
|
|
3507
3884
|
/***/ }),
|
|
@@ -3524,6 +3901,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3524
3901
|
});
|
|
3525
3902
|
exports.VizBehavior = void 0;
|
|
3526
3903
|
var VizBehavior;
|
|
3904
|
+
|
|
3527
3905
|
(function (VizBehavior) {
|
|
3528
3906
|
/**
|
|
3529
3907
|
* Dynamic Options Behavior.
|
|
@@ -3543,6 +3921,7 @@ var VizBehavior;
|
|
|
3543
3921
|
* missing.
|
|
3544
3922
|
* @type {string}
|
|
3545
3923
|
*/
|
|
3924
|
+
|
|
3546
3925
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
3547
3926
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
3548
3927
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -3578,7 +3957,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
3578
3957
|
|
|
3579
3958
|
/***/ }),
|
|
3580
3959
|
|
|
3581
|
-
/***/
|
|
3960
|
+
/***/ 93:
|
|
3582
3961
|
/***/ (function(module, exports) {
|
|
3583
3962
|
|
|
3584
3963
|
module.exports = require("d3-scale");
|