@splunk/visualizations 26.4.1 → 27.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +1399 -1590
- package/Area.config.js.map +7 -1
- package/Area.js +3750 -4822
- package/Area.js.map +7 -1
- package/Bar.config.js +1423 -1566
- package/Bar.config.js.map +7 -1
- package/Bar.js +3856 -4884
- package/Bar.js.map +7 -1
- package/Bubble.config.js +1009 -1200
- package/Bubble.config.js.map +7 -1
- package/Bubble.js +2768 -4491
- package/Bubble.js.map +7 -1
- package/ChoroplethSvg.config.js +282 -582
- package/ChoroplethSvg.config.js.map +7 -1
- package/ChoroplethSvg.js +2032 -3808
- package/ChoroplethSvg.js.map +7 -1
- package/Column.config.js +1390 -1534
- package/Column.config.js.map +7 -1
- package/Column.js +3849 -4906
- package/Column.js.map +7 -1
- package/Ellipse.config.js +443 -774
- package/Ellipse.config.js.map +7 -1
- package/Ellipse.js +1667 -3327
- package/Ellipse.js.map +7 -1
- package/Events.config.js +207 -492
- package/Events.config.js.map +7 -1
- package/Events.js +2643 -4647
- package/Events.js.map +7 -1
- package/FillerGauge.config.js +420 -775
- package/FillerGauge.config.js.map +7 -1
- package/FillerGauge.js +2164 -4575
- package/FillerGauge.js.map +7 -1
- package/Image.config.js +144 -411
- package/Image.config.js.map +7 -1
- package/Image.js +1423 -3046
- package/Image.js.map +7 -1
- package/Line.config.js +1421 -1616
- package/Line.config.js.map +7 -1
- package/Line.js +3790 -4901
- package/Line.js.map +7 -1
- package/LinkGraph.config.js +390 -632
- package/LinkGraph.config.js.map +7 -1
- package/LinkGraph.js +5272 -6185
- package/LinkGraph.js.map +7 -1
- package/MIGRATION.md +6 -0
- package/Map.config.js +501 -801
- package/Map.config.js.map +7 -1
- package/Map.js +3382 -5659
- package/Map.js.map +7 -1
- package/Markdown.config.js +232 -528
- package/Markdown.config.js.map +7 -1
- package/Markdown.js +1671 -3212
- package/Markdown.js.map +7 -1
- package/MarkerGauge.config.js +308 -613
- package/MarkerGauge.config.js.map +7 -1
- package/MarkerGauge.js +2215 -4531
- package/MarkerGauge.js.map +7 -1
- package/ParallelCoordinates.config.js +282 -581
- package/ParallelCoordinates.config.js.map +7 -1
- package/ParallelCoordinates.js +2057 -4718
- package/ParallelCoordinates.js.map +7 -1
- package/Pie.config.js +278 -547
- package/Pie.config.js.map +7 -1
- package/Pie.js +2107 -3984
- package/Pie.js.map +7 -1
- package/Punchcard.config.js +291 -578
- package/Punchcard.config.js.map +7 -1
- package/Punchcard.js +2734 -5037
- package/Punchcard.js.map +7 -1
- package/Rectangle.config.js +455 -770
- package/Rectangle.config.js.map +7 -1
- package/Rectangle.js +1664 -3258
- package/Rectangle.js.map +7 -1
- package/Sankey.config.js +291 -626
- package/Sankey.config.js.map +7 -1
- package/Sankey.js +2766 -4908
- package/Sankey.js.map +7 -1
- package/Scatter.config.js +988 -1180
- package/Scatter.config.js.map +7 -1
- package/Scatter.js +2801 -4506
- package/Scatter.js.map +7 -1
- package/SingleValue.config.js +794 -1250
- package/SingleValue.config.js.map +7 -1
- package/SingleValue.js +4185 -7327
- package/SingleValue.js.map +7 -1
- package/SingleValueBasic.js +382 -1527
- package/SingleValueBasic.js.map +7 -1
- package/SingleValueIcon.config.js +757 -1207
- package/SingleValueIcon.config.js.map +7 -1
- package/SingleValueIcon.js +3427 -6293
- package/SingleValueIcon.js.map +7 -1
- package/SingleValueRadial.config.js +686 -1121
- package/SingleValueRadial.config.js.map +7 -1
- package/SingleValueRadial.js +3923 -6994
- package/SingleValueRadial.js.map +7 -1
- package/SparkLine.js +439 -746
- package/SparkLine.js.map +7 -1
- package/TRELLIS.md +16 -15
- package/Table.config.js +565 -879
- package/Table.config.js.map +7 -1
- package/Table.js +3260 -5334
- package/Table.js.map +7 -1
- package/common/Charting.js +617 -1498
- package/common/Charting.js.map +7 -1
- package/common/ChartingApi.js +46 -170
- package/common/ChartingApi.js.map +7 -1
- package/common/DocExampleWithVizSandbox.js +270 -473
- package/common/DocExampleWithVizSandbox.js.map +7 -1
- package/common/EventsDoc.js +172 -464
- package/common/EventsDoc.js.map +7 -1
- package/common/GaugeMajorTicks.js +249 -347
- package/common/GaugeMajorTicks.js.map +7 -1
- package/common/GaugeValueMarker.js +201 -311
- package/common/GaugeValueMarker.js.map +7 -1
- package/common/OptionsDoc.js +351 -911
- package/common/OptionsDoc.js.map +7 -1
- package/common/OverviewDoc.js +435 -769
- package/common/OverviewDoc.js.map +7 -1
- package/common/SplunkVisualization.js +116 -259
- package/common/SplunkVisualization.js.map +7 -1
- package/common/SplunkVisualizationApi.js +40 -156
- package/common/SplunkVisualizationApi.js.map +7 -1
- package/common/ThemesDoc.js +271 -420
- package/common/ThemesDoc.js.map +7 -1
- package/common/chartingUtils.js +140 -312
- package/common/chartingUtils.js.map +7 -1
- package/common/docUtils.js +148 -266
- package/common/docUtils.js.map +7 -1
- package/common/gaugeUtils.js +280 -808
- package/common/gaugeUtils.js.map +7 -1
- package/common/shapeUtils.js +106 -211
- package/common/shapeUtils.js.map +7 -1
- package/common/utils/configUtils.js +126 -252
- package/common/utils/configUtils.js.map +7 -1
- package/common/utils/dataUtils.js +217 -812
- package/common/utils/dataUtils.js.map +7 -1
- package/common/utils/featureFlagUtils.js +53 -133
- package/common/utils/featureFlagUtils.js.map +7 -1
- package/common/utils/hocUtils.js +32 -122
- package/common/utils/hocUtils.js.map +7 -1
- package/common/utils/mapUtils.js +502 -1337
- package/common/utils/mapUtils.js.map +7 -1
- package/common/utils/singleValueUtils.js +466 -1013
- package/common/utils/singleValueUtils.js.map +7 -1
- package/common/utils/testHelper.js +92 -146
- package/common/utils/testHelper.js.map +7 -1
- package/common/utils/trellisUtils.js +277 -489
- package/common/utils/trellisUtils.js.map +7 -1
- package/common/utils/urlUtils.js +28 -112
- package/common/utils/urlUtils.js.map +7 -1
- package/common/withDashboardViz.js +1191 -2431
- package/common/withDashboardViz.js.map +7 -1
- package/package.json +53 -45
package/SingleValueBasic.js
CHANGED
|
@@ -1,1554 +1,409 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
55
|
-
/******/ };
|
|
56
|
-
/******/
|
|
57
|
-
/******/ // create a fake namespace object
|
|
58
|
-
/******/ // mode & 1: value is a module id, require it
|
|
59
|
-
/******/ // mode & 2: merge all properties of value into the ns
|
|
60
|
-
/******/ // mode & 4: return value when already ns object
|
|
61
|
-
/******/ // mode & 8|1: behave like require
|
|
62
|
-
/******/ __webpack_require__.t = function(value, mode) {
|
|
63
|
-
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
64
|
-
/******/ if(mode & 8) return value;
|
|
65
|
-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
66
|
-
/******/ var ns = Object.create(null);
|
|
67
|
-
/******/ __webpack_require__.r(ns);
|
|
68
|
-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
69
|
-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
70
|
-
/******/ return ns;
|
|
71
|
-
/******/ };
|
|
72
|
-
/******/
|
|
73
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
74
|
-
/******/ __webpack_require__.n = function(module) {
|
|
75
|
-
/******/ var getter = module && module.__esModule ?
|
|
76
|
-
/******/ function getDefault() { return module['default']; } :
|
|
77
|
-
/******/ function getModuleExports() { return module; };
|
|
78
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
79
|
-
/******/ return getter;
|
|
80
|
-
/******/ };
|
|
81
|
-
/******/
|
|
82
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
|
83
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
84
|
-
/******/
|
|
85
|
-
/******/ // __webpack_public_path__
|
|
86
|
-
/******/ __webpack_require__.p = "";
|
|
87
|
-
/******/
|
|
88
|
-
/******/
|
|
89
|
-
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s = 101);
|
|
91
|
-
/******/ })
|
|
92
|
-
/************************************************************************/
|
|
93
|
-
/******/ ({
|
|
94
|
-
|
|
95
|
-
/***/ 0:
|
|
96
|
-
/***/ (function(module, exports) {
|
|
97
|
-
|
|
98
|
-
module.exports = require("prop-types");
|
|
99
|
-
|
|
100
|
-
/***/ }),
|
|
101
|
-
|
|
102
|
-
/***/ 1:
|
|
103
|
-
/***/ (function(module, exports) {
|
|
104
|
-
|
|
105
|
-
module.exports = require("react");
|
|
106
|
-
|
|
107
|
-
/***/ }),
|
|
108
|
-
|
|
109
|
-
/***/ 10:
|
|
110
|
-
/***/ (function(module, exports) {
|
|
111
|
-
|
|
112
|
-
module.exports = require("@splunk/visualizations-shared/numberUtils");
|
|
113
|
-
|
|
114
|
-
/***/ }),
|
|
115
|
-
|
|
116
|
-
/***/ 101:
|
|
117
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
118
|
-
|
|
119
|
-
"use strict";
|
|
120
|
-
// ESM COMPAT FLAG
|
|
121
|
-
__webpack_require__.r(__webpack_exports__);
|
|
122
|
-
|
|
123
|
-
// EXPORTS
|
|
124
|
-
__webpack_require__.d(__webpack_exports__, "SingleValueTrendValue", function() { return /* binding */ SingleValueTrendValue; });
|
|
125
|
-
|
|
126
|
-
// EXTERNAL MODULE: external "@babel/runtime/helpers/extends"
|
|
127
|
-
var extends_ = __webpack_require__(68);
|
|
128
|
-
var extends_default = /*#__PURE__*/__webpack_require__.n(extends_);
|
|
129
|
-
|
|
130
|
-
// EXTERNAL MODULE: external "react"
|
|
131
|
-
var external_react_ = __webpack_require__(1);
|
|
132
|
-
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
133
|
-
|
|
134
|
-
// EXTERNAL MODULE: external "prop-types"
|
|
135
|
-
var external_prop_types_ = __webpack_require__(0);
|
|
136
|
-
var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
|
|
137
|
-
|
|
138
|
-
// EXTERNAL MODULE: external "styled-components"
|
|
139
|
-
var external_styled_components_ = __webpack_require__(4);
|
|
140
|
-
var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
|
|
141
|
-
|
|
142
|
-
// EXTERNAL MODULE: ./src/common/utils/singleValueUtils.js
|
|
143
|
-
var singleValueUtils = __webpack_require__(19);
|
|
144
|
-
|
|
145
|
-
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ArrowUp"
|
|
146
|
-
var ArrowUp_ = __webpack_require__(105);
|
|
147
|
-
var ArrowUp_default = /*#__PURE__*/__webpack_require__.n(ArrowUp_);
|
|
148
|
-
|
|
149
|
-
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ArrowDown"
|
|
150
|
-
var ArrowDown_ = __webpack_require__(106);
|
|
151
|
-
var ArrowDown_default = /*#__PURE__*/__webpack_require__.n(ArrowDown_);
|
|
152
|
-
|
|
153
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
|
|
154
|
-
var i18n_ = __webpack_require__(3);
|
|
155
|
-
|
|
156
|
-
// CONCATENATED MODULE: ./src/SingleValueBasic/TrendValue.jsx
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
1
|
+
/* Copyright © 2020 Splunk Inc.
|
|
2
|
+
SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
3
|
+
in part without a valid written license from Splunk Inc. is PROHIBITED. */
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __objRest = (source, exclude) => {
|
|
13
|
+
var target = {};
|
|
14
|
+
for (var prop in source)
|
|
15
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
16
|
+
target[prop] = source[prop];
|
|
17
|
+
if (source != null && __getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
19
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
20
|
+
target[prop] = source[prop];
|
|
21
|
+
}
|
|
22
|
+
return target;
|
|
23
|
+
};
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
38
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
39
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
40
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
41
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
42
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
43
|
+
mod
|
|
44
|
+
));
|
|
45
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
|
+
|
|
47
|
+
// src/SingleValueBasic/SingleValueBasic.jsx
|
|
48
|
+
var SingleValueBasic_exports = {};
|
|
49
|
+
__export(SingleValueBasic_exports, {
|
|
50
|
+
SingleValueTrendValue: () => SingleValueTrendValue,
|
|
51
|
+
default: () => SingleValueBasic_default
|
|
52
|
+
});
|
|
53
|
+
module.exports = __toCommonJS(SingleValueBasic_exports);
|
|
163
54
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
55
|
+
// esm-externals:react
|
|
56
|
+
var react_exports = {};
|
|
57
|
+
__export(react_exports, {
|
|
58
|
+
default: () => react_default
|
|
59
|
+
});
|
|
60
|
+
var defaultImport = __toESM(require("react"));
|
|
61
|
+
__reExport(react_exports, require("react"));
|
|
62
|
+
var react_default = "default" in defaultImport ? defaultImport.default : defaultImport;
|
|
63
|
+
|
|
64
|
+
// esm-externals:prop-types
|
|
65
|
+
var prop_types_exports = {};
|
|
66
|
+
__export(prop_types_exports, {
|
|
67
|
+
default: () => prop_types_default
|
|
68
|
+
});
|
|
69
|
+
var defaultImport2 = __toESM(require("prop-types"));
|
|
70
|
+
__reExport(prop_types_exports, require("prop-types"));
|
|
71
|
+
var prop_types_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
|
|
72
|
+
|
|
73
|
+
// esm-externals:styled-components
|
|
74
|
+
var styled_components_exports = {};
|
|
75
|
+
__export(styled_components_exports, {
|
|
76
|
+
default: () => styled_components_default
|
|
173
77
|
});
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return props.size || 12;
|
|
183
|
-
}, function (props) {
|
|
184
|
-
return props.size || 12;
|
|
185
|
-
}, function (props) {
|
|
186
|
-
return props.size ? "margin-left: ".concat(parseInt(props.size, 10) * 0.2 || 5, "px;") : '';
|
|
78
|
+
var defaultImport3 = __toESM(require("styled-components"));
|
|
79
|
+
__reExport(styled_components_exports, require("styled-components"));
|
|
80
|
+
var styled_components_default = "default" in defaultImport3 ? defaultImport3.default : defaultImport3;
|
|
81
|
+
|
|
82
|
+
// esm-externals:lodash
|
|
83
|
+
var lodash_exports = {};
|
|
84
|
+
__export(lodash_exports, {
|
|
85
|
+
default: () => lodash_default
|
|
187
86
|
});
|
|
87
|
+
var defaultImport4 = __toESM(require("lodash"));
|
|
88
|
+
__reExport(lodash_exports, require("lodash"));
|
|
89
|
+
var lodash_default = "default" in defaultImport4 ? defaultImport4.default : defaultImport4;
|
|
90
|
+
|
|
91
|
+
// esm-externals:@splunk/visualizations-shared/numberUtils
|
|
92
|
+
var numberUtils_exports = {};
|
|
93
|
+
__export(numberUtils_exports, {
|
|
94
|
+
default: () => numberUtils_default
|
|
95
|
+
});
|
|
96
|
+
var defaultImport5 = __toESM(require("@splunk/visualizations-shared/numberUtils"));
|
|
97
|
+
__reExport(numberUtils_exports, require("@splunk/visualizations-shared/numberUtils"));
|
|
98
|
+
var numberUtils_default = "default" in defaultImport5 ? defaultImport5.default : defaultImport5;
|
|
99
|
+
|
|
100
|
+
// esm-externals:@splunk/visualizations-shared/domUtils
|
|
101
|
+
var domUtils_exports = {};
|
|
102
|
+
__export(domUtils_exports, {
|
|
103
|
+
default: () => domUtils_default
|
|
104
|
+
});
|
|
105
|
+
var defaultImport6 = __toESM(require("@splunk/visualizations-shared/domUtils"));
|
|
106
|
+
__reExport(domUtils_exports, require("@splunk/visualizations-shared/domUtils"));
|
|
107
|
+
var domUtils_default = "default" in defaultImport6 ? defaultImport6.default : defaultImport6;
|
|
108
|
+
|
|
109
|
+
// esm-externals:@splunk/visualizations-shared/propUtils
|
|
110
|
+
var propUtils_exports = {};
|
|
111
|
+
__export(propUtils_exports, {
|
|
112
|
+
default: () => propUtils_default
|
|
113
|
+
});
|
|
114
|
+
var defaultImport7 = __toESM(require("@splunk/visualizations-shared/propUtils"));
|
|
115
|
+
__reExport(propUtils_exports, require("@splunk/visualizations-shared/propUtils"));
|
|
116
|
+
var propUtils_default = "default" in defaultImport7 ? defaultImport7.default : defaultImport7;
|
|
117
|
+
|
|
118
|
+
// esm-externals:@splunk/visualizations-shared/colorConstants
|
|
119
|
+
var colorConstants_exports = {};
|
|
120
|
+
__export(colorConstants_exports, {
|
|
121
|
+
default: () => colorConstants_default
|
|
122
|
+
});
|
|
123
|
+
var defaultImport8 = __toESM(require("@splunk/visualizations-shared/colorConstants"));
|
|
124
|
+
__reExport(colorConstants_exports, require("@splunk/visualizations-shared/colorConstants"));
|
|
125
|
+
var colorConstants_default = "default" in defaultImport8 ? defaultImport8.default : defaultImport8;
|
|
188
126
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
127
|
+
// src/common/utils/singleValueUtils.js
|
|
128
|
+
var DEFAULT_FONT_FAMILY = '"Splunk Platform Sans", "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans-serif';
|
|
129
|
+
var getAligment = (align) => {
|
|
130
|
+
const alignMap = {
|
|
131
|
+
left: "start",
|
|
132
|
+
center: "center",
|
|
133
|
+
right: "end"
|
|
134
|
+
};
|
|
135
|
+
return alignMap[align] || "center";
|
|
136
|
+
};
|
|
196
137
|
|
|
138
|
+
// esm-externals:@splunk/react-icons/enterprise/ArrowUp
|
|
139
|
+
var ArrowUp_exports = {};
|
|
140
|
+
__export(ArrowUp_exports, {
|
|
141
|
+
default: () => ArrowUp_default
|
|
142
|
+
});
|
|
143
|
+
var defaultImport9 = __toESM(require("@splunk/react-icons/enterprise/ArrowUp"));
|
|
144
|
+
__reExport(ArrowUp_exports, require("@splunk/react-icons/enterprise/ArrowUp"));
|
|
145
|
+
var ArrowUp_default = "default" in defaultImport9 ? defaultImport9.default : defaultImport9;
|
|
146
|
+
|
|
147
|
+
// esm-externals:@splunk/react-icons/enterprise/ArrowDown
|
|
148
|
+
var ArrowDown_exports = {};
|
|
149
|
+
__export(ArrowDown_exports, {
|
|
150
|
+
default: () => ArrowDown_default
|
|
151
|
+
});
|
|
152
|
+
var defaultImport10 = __toESM(require("@splunk/react-icons/enterprise/ArrowDown"));
|
|
153
|
+
__reExport(ArrowDown_exports, require("@splunk/react-icons/enterprise/ArrowDown"));
|
|
154
|
+
var ArrowDown_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
|
|
155
|
+
|
|
156
|
+
// esm-externals:@splunk/ui-utils/i18n
|
|
157
|
+
var i18n_exports = {};
|
|
158
|
+
__export(i18n_exports, {
|
|
159
|
+
default: () => i18n_default
|
|
160
|
+
});
|
|
161
|
+
var defaultImport11 = __toESM(require("@splunk/ui-utils/i18n"));
|
|
162
|
+
__reExport(i18n_exports, require("@splunk/ui-utils/i18n"));
|
|
163
|
+
var i18n_default = "default" in defaultImport11 ? defaultImport11.default : defaultImport11;
|
|
164
|
+
|
|
165
|
+
// src/SingleValueBasic/TrendValue.jsx
|
|
166
|
+
var Column = styled_components_default.div`
|
|
167
|
+
display: flex;
|
|
168
|
+
flex-direction: row;
|
|
169
|
+
justify-content: ${(props) => props.justify || "flex-end"};
|
|
170
|
+
height: ${(props) => props.size || 12}px;
|
|
171
|
+
${(props) => props.size ? `margin: 0 ${parseInt(props.size, 10) * 0.2 || 5}px;` : ""};
|
|
172
|
+
`;
|
|
173
|
+
var Text = styled_components_default.div`
|
|
174
|
+
white-space: nowrap;
|
|
175
|
+
font-size: ${(props) => props.size || 12}px;
|
|
176
|
+
color: ${(props) => props.color || "#000"};
|
|
177
|
+
font-family: ${DEFAULT_FONT_FAMILY};
|
|
178
|
+
height: ${(props) => props.size || 12}px;
|
|
179
|
+
line-height: ${(props) => props.size || 12}px;
|
|
180
|
+
display: flex;
|
|
181
|
+
align-self: baseline;
|
|
182
|
+
${(props) => props.size ? `margin-left: ${parseInt(props.size, 10) * 0.2 || 5}px;` : ""};
|
|
183
|
+
`;
|
|
184
|
+
var TrendValue = ({ fontSize, color, value, text }) => {
|
|
185
|
+
let TrendIndicator = false;
|
|
186
|
+
let ariaLabel = false;
|
|
197
187
|
if (parseFloat(value, 10) > 0) {
|
|
198
|
-
TrendIndicator = ArrowUp_default
|
|
199
|
-
ariaLabel =
|
|
188
|
+
TrendIndicator = ArrowUp_default;
|
|
189
|
+
ariaLabel = (0, i18n_exports._)("increase");
|
|
200
190
|
} else if (parseFloat(value, 10) < 0) {
|
|
201
|
-
TrendIndicator = ArrowDown_default
|
|
202
|
-
ariaLabel =
|
|
191
|
+
TrendIndicator = ArrowDown_default;
|
|
192
|
+
ariaLabel = (0, i18n_exports._)("decrease");
|
|
203
193
|
}
|
|
204
|
-
|
|
205
|
-
return /*#__PURE__*/external_react_default.a.createElement(Column, {
|
|
206
|
-
justify: "flex-end",
|
|
207
|
-
size: fontSize
|
|
208
|
-
}, /*#__PURE__*/external_react_default.a.createElement(Text, {
|
|
209
|
-
"data-test": "trendValueIndicator",
|
|
210
|
-
size: fontSize,
|
|
211
|
-
color: color
|
|
212
|
-
}, TrendIndicator && /*#__PURE__*/external_react_default.a.createElement(TrendIndicator, {
|
|
213
|
-
"aria-label": ariaLabel
|
|
214
|
-
})), /*#__PURE__*/external_react_default.a.createElement(Text, {
|
|
215
|
-
"data-test": "trendValue",
|
|
216
|
-
size: fontSize,
|
|
217
|
-
color: color
|
|
218
|
-
}, "".concat(text)));
|
|
194
|
+
return /* @__PURE__ */ react_default.createElement(Column, { justify: "flex-end", size: fontSize }, /* @__PURE__ */ react_default.createElement(Text, { "data-test": "trendValueIndicator", size: fontSize, color }, TrendIndicator && /* @__PURE__ */ react_default.createElement(TrendIndicator, { "aria-label": ariaLabel })), /* @__PURE__ */ react_default.createElement(Text, { "data-test": "trendValue", size: fontSize, color }, `${text}`));
|
|
219
195
|
};
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
text: external_prop_types_default.a.string
|
|
196
|
+
TrendValue.propTypes = {
|
|
197
|
+
fontSize: prop_types_default.number,
|
|
198
|
+
color: prop_types_default.string,
|
|
199
|
+
value: prop_types_default.oneOfType([prop_types_default.string, prop_types_default.number]),
|
|
200
|
+
text: prop_types_default.string
|
|
226
201
|
};
|
|
227
|
-
|
|
228
|
-
// EXTERNAL MODULE: external "cssesc"
|
|
229
|
-
var external_cssesc_ = __webpack_require__(107);
|
|
230
|
-
var external_cssesc_default = /*#__PURE__*/__webpack_require__.n(external_cssesc_);
|
|
231
|
-
|
|
232
|
-
// CONCATENATED MODULE: ./src/SingleValueBasic/MajorValue.jsx
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
202
|
+
var TrendValue_default = TrendValue;
|
|
237
203
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
return props.size;
|
|
243
|
-
}, function (props) {
|
|
244
|
-
return props.size;
|
|
204
|
+
// esm-externals:cssesc
|
|
205
|
+
var cssesc_exports = {};
|
|
206
|
+
__export(cssesc_exports, {
|
|
207
|
+
default: () => cssesc_default
|
|
245
208
|
});
|
|
246
|
-
var
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
209
|
+
var defaultImport12 = __toESM(require("cssesc"));
|
|
210
|
+
__reExport(cssesc_exports, require("cssesc"));
|
|
211
|
+
var cssesc_default = "default" in defaultImport12 ? defaultImport12.default : defaultImport12;
|
|
212
|
+
|
|
213
|
+
// src/SingleValueBasic/MajorValue.jsx
|
|
214
|
+
var Row = styled_components_default.div`
|
|
215
|
+
display: flex;
|
|
216
|
+
flex-direction: row;
|
|
217
|
+
align-items: flex-end;
|
|
218
|
+
justify-content: left;
|
|
219
|
+
height: ${(props) => props.size}px;
|
|
220
|
+
line-height: ${(props) => props.size}px;
|
|
221
|
+
`;
|
|
222
|
+
var Text2 = styled_components_default.div`
|
|
223
|
+
white-space: nowrap;
|
|
224
|
+
height: 100%;
|
|
225
|
+
font-size: ${(props) => props.size || 12}px;
|
|
226
|
+
color: ${(props) => props.color};
|
|
227
|
+
font-family: ${DEFAULT_FONT_FAMILY};
|
|
228
|
+
font-weight: bold;
|
|
229
|
+
&:hover {
|
|
230
|
+
text-decoration: ${(props) => props.showUnderline ? "underline" : "inherit"};
|
|
231
|
+
cursor: ${(props) => props.showUnderline ? "pointer" : "inherit"};
|
|
232
|
+
}
|
|
233
|
+
${(props) => {
|
|
258
234
|
if (!props.pseudoContent || !props.pseudoContentPosition) {
|
|
259
|
-
return
|
|
235
|
+
return "";
|
|
260
236
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
if (typeof unitPosition === 'string' && validUnitPositions.includes(unitPosition)) {
|
|
237
|
+
return `&:${props.pseudoContentPosition} {
|
|
238
|
+
// by default this pseudo element would inherit text-decoration from main element
|
|
239
|
+
// and text-decoration could not be overwritten.
|
|
240
|
+
// adding display: inline-block makes text decoration independent from main element.
|
|
241
|
+
// => the unit will not be underlined if a user hovers over the main value
|
|
242
|
+
display: inline-block;
|
|
243
|
+
font-size: ${props.pseudoContentFontSize}px;
|
|
244
|
+
position: relative;
|
|
245
|
+
font-weight: normal;
|
|
246
|
+
content: ${props.pseudoContent};
|
|
247
|
+
}`;
|
|
248
|
+
}}
|
|
249
|
+
`;
|
|
250
|
+
var validUnitPositions = ["before", "after"];
|
|
251
|
+
var MajorValue = ({ color, fontSize, unitPosition, title, value, onValueClick, unit }) => {
|
|
252
|
+
let sanitizedUnit;
|
|
253
|
+
let sanitizedUnitPosition;
|
|
254
|
+
if (typeof unit === "string") {
|
|
255
|
+
sanitizedUnit = cssesc_default(unit, { wrap: true, quotes: "double" });
|
|
256
|
+
if (typeof unitPosition === "string" && validUnitPositions.includes(unitPosition)) {
|
|
284
257
|
sanitizedUnitPosition = unitPosition;
|
|
285
258
|
} else {
|
|
286
|
-
sanitizedUnitPosition =
|
|
259
|
+
sanitizedUnitPosition = "after";
|
|
287
260
|
}
|
|
288
261
|
}
|
|
289
|
-
|
|
290
|
-
var handleKeyDown = function handleKeyDown(e) {
|
|
262
|
+
const handleKeyDown = (e) => {
|
|
291
263
|
if (e.keyCode !== 13) {
|
|
292
264
|
return;
|
|
293
265
|
}
|
|
294
|
-
|
|
295
266
|
e.preventDefault();
|
|
296
267
|
onValueClick(e);
|
|
297
268
|
};
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
269
|
+
return /* @__PURE__ */ react_default.createElement(Row, { size: fontSize }, /* @__PURE__ */ react_default.createElement(
|
|
270
|
+
Text2,
|
|
271
|
+
{
|
|
272
|
+
"data-test": "majorValue",
|
|
273
|
+
color,
|
|
274
|
+
onClick: (e) => typeof onValueClick === "function" && onValueClick(e),
|
|
275
|
+
showUnderline: !!onValueClick,
|
|
276
|
+
size: fontSize,
|
|
277
|
+
title,
|
|
278
|
+
pseudoContent: sanitizedUnit,
|
|
279
|
+
pseudoContentPosition: sanitizedUnitPosition,
|
|
280
|
+
pseudoContentFontSize: fontSize * 0.6,
|
|
281
|
+
tabIndex: "0",
|
|
282
|
+
role: "button",
|
|
283
|
+
onKeyDown: handleKeyDown
|
|
306
284
|
},
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
return /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_Column, null, /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_Row, {
|
|
382
|
-
alignItems: "baseline",
|
|
383
|
-
align: align,
|
|
384
|
-
"data-test": "single-value-row-align-".concat(Object(singleValueUtils["getAligment"])(align))
|
|
385
|
-
}, /*#__PURE__*/external_react_default.a.createElement(MajorValue, {
|
|
386
|
-
color: majorColor,
|
|
387
|
-
fontSize: majorTextFontSize,
|
|
388
|
-
unit: unit,
|
|
389
|
-
unitPosition: unitPosition,
|
|
390
|
-
value: majorText,
|
|
391
|
-
title: majorValueTitle,
|
|
392
|
-
onValueClick: onValueClick
|
|
393
|
-
}), trendIndicatorEnabled &&
|
|
394
|
-
/*#__PURE__*/
|
|
395
|
-
// Passing the same value for value and text is a temporary hold until completion of https://jira.splunk.com/browse/SCP-21371
|
|
396
|
-
external_react_default.a.createElement(TrendValue, {
|
|
397
|
-
fontSize: trendTextFontSize,
|
|
398
|
-
color: trendColor,
|
|
399
|
-
value: trendText,
|
|
400
|
-
text: trendText
|
|
401
|
-
})), underLabel && /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_Row, {
|
|
402
|
-
justify: "center",
|
|
403
|
-
align: align,
|
|
404
|
-
"data-test": "single-value-row-align-".concat(Object(singleValueUtils["getAligment"])(align))
|
|
405
|
-
}, /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_Text, {
|
|
406
|
-
"data-test": "underLabel",
|
|
407
|
-
size: underLabelFontSize,
|
|
408
|
-
color: underLabelColor,
|
|
409
|
-
margin: "0 6px"
|
|
410
|
-
}, underLabel)));
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
SingleValueBasic_SingleValueBasic.propTypes = {
|
|
414
|
-
majorText: external_prop_types_default.a.string,
|
|
415
|
-
majorColor: external_prop_types_default.a.string,
|
|
416
|
-
majorTextFontSize: external_prop_types_default.a.number,
|
|
417
|
-
majorValueTitle: external_prop_types_default.a.string,
|
|
418
|
-
trendText: external_prop_types_default.a.string,
|
|
419
|
-
trendTextFontSize: external_prop_types_default.a.number,
|
|
420
|
-
trendColor: external_prop_types_default.a.string,
|
|
421
|
-
showTrendIndicator: external_prop_types_default.a.bool,
|
|
422
|
-
unit: external_prop_types_default.a.string,
|
|
423
|
-
unitPosition: external_prop_types_default.a.oneOf(['before', 'after']),
|
|
424
|
-
underLabel: external_prop_types_default.a.string,
|
|
425
|
-
underLabelFontSize: external_prop_types_default.a.number,
|
|
426
|
-
underLabelColor: external_prop_types_default.a.string,
|
|
427
|
-
onValueClick: external_prop_types_default.a.oneOfType([external_prop_types_default.a.bool, external_prop_types_default.a.func]),
|
|
428
|
-
align: external_prop_types_default.a.string
|
|
429
|
-
};
|
|
430
|
-
var SingleValueTrendValue = TrendValue;
|
|
431
|
-
/* harmony default export */ var src_SingleValueBasic_SingleValueBasic = __webpack_exports__["default"] = (SingleValueBasic_SingleValueBasic);
|
|
432
|
-
|
|
433
|
-
/***/ }),
|
|
434
|
-
|
|
435
|
-
/***/ 105:
|
|
436
|
-
/***/ (function(module, exports) {
|
|
437
|
-
|
|
438
|
-
module.exports = require("@splunk/react-icons/enterprise/ArrowUp");
|
|
439
|
-
|
|
440
|
-
/***/ }),
|
|
441
|
-
|
|
442
|
-
/***/ 106:
|
|
443
|
-
/***/ (function(module, exports) {
|
|
444
|
-
|
|
445
|
-
module.exports = require("@splunk/react-icons/enterprise/ArrowDown");
|
|
446
|
-
|
|
447
|
-
/***/ }),
|
|
448
|
-
|
|
449
|
-
/***/ 107:
|
|
450
|
-
/***/ (function(module, exports) {
|
|
451
|
-
|
|
452
|
-
module.exports = require("cssesc");
|
|
453
|
-
|
|
454
|
-
/***/ }),
|
|
455
|
-
|
|
456
|
-
/***/ 12:
|
|
457
|
-
/***/ (function(module, exports) {
|
|
458
|
-
|
|
459
|
-
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
460
|
-
|
|
461
|
-
/***/ }),
|
|
462
|
-
|
|
463
|
-
/***/ 19:
|
|
464
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
465
|
-
|
|
466
|
-
"use strict";
|
|
467
|
-
__webpack_require__.r(__webpack_exports__);
|
|
468
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_FONT", function() { return DEFAULT_FONT; });
|
|
469
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_FONT_FAMILY", function() { return DEFAULT_FONT_FAMILY; });
|
|
470
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SVR_PADDING", function() { return SVR_PADDING; });
|
|
471
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAligment", function() { return getAligment; });
|
|
472
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shouldShowTrend", function() { return shouldShowTrend; });
|
|
473
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isLoadingOrNoColumns", function() { return isLoadingOrNoColumns; });
|
|
474
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFormattedColor", function() { return getFormattedColor; });
|
|
475
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasBackground", function() { return hasBackground; });
|
|
476
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isIdenticalColor", function() { return isIdenticalColor; });
|
|
477
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDefaultColorWithBg", function() { return getDefaultColorWithBg; });
|
|
478
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMajorColor", function() { return getMajorColor; });
|
|
479
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTrendColor", function() { return getTrendColor; });
|
|
480
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeColors", function() { return computeColors; });
|
|
481
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeText", function() { return computeText; });
|
|
482
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMajorText", function() { return getMajorText; });
|
|
483
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTrendText", function() { return getTrendText; });
|
|
484
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeFontSize", function() { return computeFontSize; });
|
|
485
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMajorFontSize", function() { return getMajorFontSize; });
|
|
486
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTrendFontSize", function() { return getTrendFontSize; });
|
|
487
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUnderLabelHeight", function() { return getUnderLabelHeight; });
|
|
488
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUnderLabel", function() { return getUnderLabel; });
|
|
489
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMajorAndTrend", function() { return getMajorAndTrend; });
|
|
490
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateVizInSmallSpace", function() { return updateVizInSmallSpace; });
|
|
491
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeSingleValueContent", function() { return computeSingleValueContent; });
|
|
492
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "minimallyTruncateStringToWidth", function() { return minimallyTruncateStringToWidth; });
|
|
493
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeSingleValueRadialContent", function() { return computeSingleValueRadialContent; });
|
|
494
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getGraphColors", function() { return getGraphColors; });
|
|
495
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "adjustRGB", function() { return adjustRGB; });
|
|
496
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lighten", function() { return lighten; });
|
|
497
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "darken", function() { return darken; });
|
|
498
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "handleValueClickCallback", function() { return handleValueClickCallback; });
|
|
499
|
-
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12);
|
|
500
|
-
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);
|
|
501
|
-
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
502
|
-
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);
|
|
503
|
-
/* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(10);
|
|
504
|
-
/* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__);
|
|
505
|
-
/* harmony import */ var _splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(73);
|
|
506
|
-
/* harmony import */ var _splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__);
|
|
507
|
-
/* harmony import */ var _splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(35);
|
|
508
|
-
/* harmony import */ var _splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__);
|
|
509
|
-
/* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(69);
|
|
510
|
-
/* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__);
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
function ownKeys(object, enumerableOnly) {
|
|
514
|
-
var keys = Object.keys(object);
|
|
515
|
-
|
|
516
|
-
if (Object.getOwnPropertySymbols) {
|
|
517
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
518
|
-
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
519
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
520
|
-
});
|
|
521
|
-
keys.push.apply(keys, symbols);
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
return keys;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
function _objectSpread(target) {
|
|
528
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
529
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
530
|
-
|
|
531
|
-
if (i % 2) {
|
|
532
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
|
533
|
-
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]);
|
|
534
|
-
});
|
|
535
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
536
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
537
|
-
} else {
|
|
538
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
539
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
return target;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
var DEFAULT_FONT = 12;
|
|
553
|
-
var DEFAULT_FONT_FAMILY = '"Splunk Platform Sans", "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans-serif';
|
|
554
|
-
var SVR_PADDING = {
|
|
555
|
-
top: 12,
|
|
556
|
-
bottom: 12,
|
|
557
|
-
left: 16,
|
|
558
|
-
right: 16
|
|
559
|
-
};
|
|
560
|
-
var getAligment = function getAligment(align) {
|
|
561
|
-
var alignMap = {
|
|
562
|
-
left: 'start',
|
|
563
|
-
center: 'center',
|
|
564
|
-
right: 'end'
|
|
565
|
-
};
|
|
566
|
-
return alignMap[align] || 'center';
|
|
567
|
-
};
|
|
568
|
-
/**
|
|
569
|
-
* @method shouldShowTrend
|
|
570
|
-
* @param {String} trendDisplay
|
|
571
|
-
* @returns {Bool}
|
|
572
|
-
*/
|
|
573
|
-
|
|
574
|
-
var shouldShowTrend = function shouldShowTrend(trendDisplay) {
|
|
575
|
-
return trendDisplay === 'absolute' || trendDisplay === 'percent';
|
|
576
|
-
};
|
|
577
|
-
/**
|
|
578
|
-
* @method isLoadingOrNoColumns
|
|
579
|
-
* @param {Object} dataSources
|
|
580
|
-
* @param {Boolean} loading
|
|
581
|
-
* @returns {Boolean} return true if loading or without columns in dataSources
|
|
582
|
-
*/
|
|
583
|
-
|
|
584
|
-
var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
|
|
585
|
-
var data = Object(lodash__WEBPACK_IMPORTED_MODULE_1__["get"])(dataSources, 'primary.data.columns[0]', undefined);
|
|
586
|
-
var noColumns = data === undefined;
|
|
587
|
-
return loading || noColumns;
|
|
588
|
-
};
|
|
589
|
-
/**
|
|
590
|
-
* Retrieve the valid formatted color
|
|
591
|
-
* @method getFormattedColor
|
|
592
|
-
* @param {String} color
|
|
593
|
-
* @param {String} defaultColor
|
|
594
|
-
* @returns {String} the formatted color
|
|
595
|
-
*/
|
|
596
|
-
|
|
597
|
-
var getFormattedColor = function getFormattedColor(color, defaultColor) {
|
|
598
|
-
return Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(color) || Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(defaultColor);
|
|
599
|
-
};
|
|
600
|
-
/**
|
|
601
|
-
* Determines if there is a background color
|
|
602
|
-
* @method hasBackground
|
|
603
|
-
* @param {String} backgroundColor
|
|
604
|
-
* @returns true for non-transparent background color
|
|
605
|
-
*/
|
|
606
|
-
|
|
607
|
-
var hasBackground = function hasBackground(backgroundColor) {
|
|
608
|
-
return !!backgroundColor && backgroundColor !== 'transparent';
|
|
609
|
-
};
|
|
610
|
-
/**
|
|
611
|
-
* @method isIdenticalColor
|
|
612
|
-
* @param {String} colorA
|
|
613
|
-
* @param {String} colorB
|
|
614
|
-
* @returns {Boolean}
|
|
615
|
-
*/
|
|
616
|
-
|
|
617
|
-
var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
|
|
618
|
-
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());
|
|
619
|
-
};
|
|
620
|
-
/*
|
|
621
|
-
* @method getDefaultColorWithBg
|
|
622
|
-
* @param {Object} props
|
|
623
|
-
* @param {String} props.backgroundColor
|
|
624
|
-
* @param {String} props.defaultFontColor
|
|
625
|
-
* @param {String} props.defaultBlockFontColor
|
|
626
|
-
* @returns {String} defaultColor
|
|
627
|
-
*/
|
|
628
|
-
|
|
629
|
-
var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
|
|
630
|
-
var backgroundColor = _ref.backgroundColor,
|
|
631
|
-
defaultFontColor = _ref.defaultFontColor,
|
|
632
|
-
defaultBlockFontColor = _ref.defaultBlockFontColor;
|
|
633
|
-
return isIdenticalColor(backgroundColor, defaultBlockFontColor) ? defaultFontColor : defaultBlockFontColor;
|
|
634
|
-
};
|
|
635
|
-
/*
|
|
636
|
-
* @method getMajorColor
|
|
637
|
-
* return formatted majorColor.
|
|
638
|
-
* @param {Object} props
|
|
639
|
-
* @param {String} props.majorColor
|
|
640
|
-
* @param {String} props.backgroundColor
|
|
641
|
-
* @param {String} props.defaultFontColor
|
|
642
|
-
* @param {String} props.defaultBlockFontColor
|
|
643
|
-
* @returns {String} majorColor
|
|
644
|
-
*/
|
|
645
|
-
|
|
646
|
-
var getMajorColor = function getMajorColor(_ref2) {
|
|
647
|
-
var majorColor = _ref2.majorColor,
|
|
648
|
-
backgroundColor = _ref2.backgroundColor,
|
|
649
|
-
defaultFontColor = _ref2.defaultFontColor,
|
|
650
|
-
defaultBlockFontColor = _ref2.defaultBlockFontColor; // If backgroundColor is set, but no majorColor,
|
|
651
|
-
// the default majorColor will turn to be defaultBlockFontColor.
|
|
652
|
-
// eg: major color will turn to be white in enterprise mode.
|
|
653
|
-
// however, if the bgColor is the same as defaultBlockFontColor, use defaultFontColor.
|
|
654
|
-
|
|
655
|
-
if (hasBackground(backgroundColor) && !majorColor) {
|
|
656
|
-
return getDefaultColorWithBg({
|
|
657
|
-
backgroundColor: backgroundColor,
|
|
658
|
-
defaultFontColor: defaultFontColor,
|
|
659
|
-
defaultBlockFontColor: defaultBlockFontColor
|
|
660
|
-
});
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
return getFormattedColor(majorColor, defaultFontColor);
|
|
664
|
-
};
|
|
665
|
-
/**
|
|
666
|
-
* Get the color for the trend components
|
|
667
|
-
* @method getTrendColor
|
|
668
|
-
* @param {Object} props
|
|
669
|
-
* @param {String} props.trendColor The trendColor value determined from encoding
|
|
670
|
-
* @param {Number} props.trendValue
|
|
671
|
-
* @param {Number} props.majorValue
|
|
672
|
-
* @param {String} props.customizedBgColor
|
|
673
|
-
* @param {String} props.trendDisplay absolute || percent || off
|
|
674
|
-
* @param {Object} defaultColors
|
|
675
|
-
* @returns {String} trendColor
|
|
676
|
-
*/
|
|
677
|
-
|
|
678
|
-
var getTrendColor = function getTrendColor(_ref3) {
|
|
679
|
-
var trendColor = _ref3.trendColor,
|
|
680
|
-
trendValue = _ref3.trendValue,
|
|
681
|
-
majorValue = _ref3.majorValue,
|
|
682
|
-
customizedBgColor = _ref3.customizedBgColor,
|
|
683
|
-
trendDisplay = _ref3.trendDisplay,
|
|
684
|
-
defaultColors = _ref3.defaultColors;
|
|
685
|
-
|
|
686
|
-
if (trendColor) {
|
|
687
|
-
return trendColor;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
if (Number.isNaN(Number(trendValue))) {
|
|
691
|
-
return undefined;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
var defaultFontColor = defaultColors.defaultFontColor,
|
|
695
|
-
defaultBlockFontColor = defaultColors.defaultBlockFontColor,
|
|
696
|
-
defaultBackgroundColor = defaultColors.defaultBackgroundColor; // if user defined a backgroundColor, the default trend color will be defaultBlockFontColor
|
|
697
|
-
|
|
698
|
-
if (hasBackground(customizedBgColor) && !isIdenticalColor(customizedBgColor, defaultBackgroundColor) && !isIdenticalColor(customizedBgColor, defaultBlockFontColor)) {
|
|
699
|
-
return defaultBlockFontColor;
|
|
700
|
-
} // if trendDisplay is percent, and trendValue === value
|
|
701
|
-
// the trend percent = trendValue / (value - trendValue) will return Infinity
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
var isInvalidTrend = trendDisplay === 'percent' && trendValue === parseFloat(majorValue);
|
|
705
|
-
|
|
706
|
-
if (trendValue === 0 || isInvalidTrend) {
|
|
707
|
-
return defaultFontColor;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
return trendValue > 0 ? _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_GREEN"] : _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_RED"];
|
|
711
|
-
};
|
|
712
|
-
/**
|
|
713
|
-
* Computes visualization properties for display component
|
|
714
|
-
* @method computeColors
|
|
715
|
-
* @param {Object} props all viz props
|
|
716
|
-
* @param {Object} defaultColors defaultColors from theme
|
|
717
|
-
* @returns {Object} result
|
|
718
|
-
* @returns {Boolean} backgroundEnabled
|
|
719
|
-
* @returns {String} backgroundColor
|
|
720
|
-
* @returns {String} majorColor
|
|
721
|
-
* @returns {String} trendColor
|
|
722
|
-
* @returns {String} underLabelColor
|
|
723
|
-
*/
|
|
724
|
-
|
|
725
|
-
var computeColors = function computeColors(props, defaultColors) {
|
|
726
|
-
var backgroundColor = getFormattedColor(props.backgroundColor, defaultColors.defaultBackgroundColor);
|
|
727
|
-
var backgroundEnabled = hasBackground(backgroundColor);
|
|
728
|
-
var majorColor = getMajorColor({
|
|
729
|
-
majorColor: props.majorColor,
|
|
730
|
-
backgroundColor: backgroundColor,
|
|
731
|
-
defaultFontColor: defaultColors.defaultFontColor,
|
|
732
|
-
defaultBlockFontColor: defaultColors.defaultBlockFontColor
|
|
733
|
-
});
|
|
734
|
-
var trendColor = getTrendColor({
|
|
735
|
-
trendColor: props.trendColor,
|
|
736
|
-
trendValue: props.trendValue,
|
|
737
|
-
majorValue: props.majorValue,
|
|
738
|
-
customizedBgColor: props.backgroundColor,
|
|
739
|
-
trendDisplay: props.trendDisplay,
|
|
740
|
-
defaultColors: defaultColors
|
|
741
|
-
}); // todo: need change it to not depend on majorColor
|
|
742
|
-
|
|
743
|
-
var underLabelColor = majorColor;
|
|
744
|
-
return {
|
|
745
|
-
backgroundColor: backgroundColor,
|
|
746
|
-
backgroundEnabled: backgroundEnabled,
|
|
747
|
-
majorColor: majorColor,
|
|
748
|
-
trendColor: trendColor,
|
|
749
|
-
underLabelColor: underLabelColor
|
|
750
|
-
};
|
|
751
|
-
};
|
|
752
|
-
/**
|
|
753
|
-
* Format and return the value (major/trend)
|
|
754
|
-
* @method computeText
|
|
755
|
-
* @param {Object} props
|
|
756
|
-
* @param {Number} props.value // The major/trend value
|
|
757
|
-
* @param {Number} props.numberPrecision
|
|
758
|
-
* @param {Bool} props.shouldUseThousandSeparators
|
|
759
|
-
* @param {Bool} props.shouldAbbreviateValue
|
|
760
|
-
* @returns {Number} major or trend text
|
|
761
|
-
*/
|
|
762
|
-
|
|
763
|
-
var computeText = function computeText(_ref4) {
|
|
764
|
-
var value = _ref4.value,
|
|
765
|
-
numberPrecision = _ref4.numberPrecision,
|
|
766
|
-
shouldUseThousandSeparators = _ref4.shouldUseThousandSeparators,
|
|
767
|
-
shouldAbbreviateValue = _ref4.shouldAbbreviateValue;
|
|
768
|
-
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, {
|
|
769
|
-
useThousandSeparators: shouldUseThousandSeparators,
|
|
770
|
-
// todo: need update formatNumber
|
|
771
|
-
useTrendUnits: shouldAbbreviateValue
|
|
772
|
-
}) : value; // When text is undefined, return empty string
|
|
773
|
-
|
|
774
|
-
text = text || '';
|
|
775
|
-
return text;
|
|
776
|
-
};
|
|
777
|
-
/*
|
|
778
|
-
* @method getMajorText
|
|
779
|
-
* @param {Object} props
|
|
780
|
-
* @param {Number} props.majorValue
|
|
781
|
-
* @param {Number} props.numberPrecision
|
|
782
|
-
* @param {Bool} props.shouldUseThousandSeparators
|
|
783
|
-
* @param {Bool} props.shouldAbbreviateMajorValue
|
|
784
|
-
* @returns {String} majorText
|
|
785
|
-
*/
|
|
786
|
-
|
|
787
|
-
var getMajorText = function getMajorText(_ref5) {
|
|
788
|
-
var majorValue = _ref5.majorValue,
|
|
789
|
-
numberPrecision = _ref5.numberPrecision,
|
|
790
|
-
shouldUseThousandSeparators = _ref5.shouldUseThousandSeparators,
|
|
791
|
-
shouldAbbreviateMajorValue = _ref5.shouldAbbreviateMajorValue;
|
|
792
|
-
return computeText({
|
|
793
|
-
value: majorValue === null ? 'N/A' : majorValue,
|
|
794
|
-
// if majorValue is null, use `N/A`.
|
|
795
|
-
numberPrecision: numberPrecision,
|
|
796
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
797
|
-
shouldAbbreviateValue: shouldAbbreviateMajorValue
|
|
798
|
-
});
|
|
799
|
-
};
|
|
800
|
-
/*
|
|
801
|
-
* @method getTrendText
|
|
802
|
-
* @param {Object} props
|
|
803
|
-
* @param {Number} props.majorValue
|
|
804
|
-
* @param {Number} props.trendValue
|
|
805
|
-
* @param {String} props.trendDisplay
|
|
806
|
-
* @param {Number} props.numberPrecision
|
|
807
|
-
* @param {Bool} props.shouldUseThousandSeparators
|
|
808
|
-
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
809
|
-
* @returns {String} trendText
|
|
810
|
-
*/
|
|
811
|
-
|
|
812
|
-
var getTrendText = function getTrendText(_ref6) {
|
|
813
|
-
var majorValue = _ref6.majorValue,
|
|
814
|
-
trendValue = _ref6.trendValue,
|
|
815
|
-
trendDisplay = _ref6.trendDisplay,
|
|
816
|
-
numberPrecision = _ref6.numberPrecision,
|
|
817
|
-
shouldUseThousandSeparators = _ref6.shouldUseThousandSeparators,
|
|
818
|
-
shouldAbbreviateTrendValue = _ref6.shouldAbbreviateTrendValue;
|
|
819
|
-
|
|
820
|
-
var compute = function compute(value) {
|
|
821
|
-
return computeText({
|
|
822
|
-
value: value,
|
|
823
|
-
numberPrecision: numberPrecision,
|
|
824
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
825
|
-
shouldAbbreviateValue: shouldAbbreviateTrendValue
|
|
826
|
-
});
|
|
827
|
-
};
|
|
828
|
-
|
|
829
|
-
if (trendValue === '' || !Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue)) {
|
|
830
|
-
return '';
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
var showPercent = trendDisplay === 'percent';
|
|
834
|
-
|
|
835
|
-
if (!showPercent) {
|
|
836
|
-
return compute(trendValue);
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
var diff = Math.abs(trendValue - majorValue);
|
|
840
|
-
var val = Math.round(trendValue / diff * 100);
|
|
841
|
-
|
|
842
|
-
if (trendValue === 0 && diff === 0) {
|
|
843
|
-
val = 0;
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
if (!Number.isFinite(val)) {
|
|
847
|
-
return 'N/A';
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
var text = compute(val);
|
|
851
|
-
return "".concat(text, "%");
|
|
852
|
-
};
|
|
853
|
-
/**
|
|
854
|
-
* Helper to determine the font size for an element
|
|
855
|
-
* @method computeFontSize
|
|
856
|
-
* @param {String} text The string to find a size for
|
|
857
|
-
* @param {Object} dimensions
|
|
858
|
-
* @param {Number} dimensions.width The width of the container
|
|
859
|
-
* @param {Number} dimensions.height The height of the container
|
|
860
|
-
* @param {String} [fontFamily='"Splunk Platform Sans" ...'] The font being used
|
|
861
|
-
* @param {String} [fontWeight='normal'] Boldness of font
|
|
862
|
-
* @returns {Number} The size to use for fontSize styles
|
|
863
|
-
*/
|
|
864
|
-
|
|
865
|
-
var computeFontSize = function computeFontSize(text, _ref7) {
|
|
866
|
-
var width = _ref7.width,
|
|
867
|
-
height = _ref7.height;
|
|
868
|
-
var fontFamily = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_FONT_FAMILY;
|
|
869
|
-
var fontWeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'normal';
|
|
870
|
-
var widthInDefaultFont = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(DEFAULT_FONT, "px ").concat(fontFamily));
|
|
871
|
-
var fontSize = Math.min(width / widthInDefaultFont * DEFAULT_FONT, height / DEFAULT_FONT * DEFAULT_FONT);
|
|
872
|
-
return parseInt(fontSize, 10);
|
|
873
|
-
};
|
|
874
|
-
/*
|
|
875
|
-
* @method getMajorFontSize
|
|
876
|
-
* @param {Object} props
|
|
877
|
-
* @param {Number} props.width
|
|
878
|
-
* @param {Number} props.height
|
|
879
|
-
* @param {String} props.unit
|
|
880
|
-
* @param {String} props.majorText
|
|
881
|
-
* @param {Number} props.spaceRatio
|
|
882
|
-
* @returns {Number} majorFontSize
|
|
883
|
-
*/
|
|
884
|
-
|
|
885
|
-
var getMajorFontSize = function getMajorFontSize(_ref8) {
|
|
886
|
-
var width = _ref8.width,
|
|
887
|
-
height = _ref8.height,
|
|
888
|
-
unit = _ref8.unit,
|
|
889
|
-
majorText = _ref8.majorText,
|
|
890
|
-
_ref8$spaceRatio = _ref8.spaceRatio,
|
|
891
|
-
spaceRatio = _ref8$spaceRatio === void 0 ? 1 : _ref8$spaceRatio;
|
|
892
|
-
var majorTextCalc = unit ? "".concat(unit).concat(majorText) : majorText;
|
|
893
|
-
return computeFontSize(majorTextCalc, {
|
|
894
|
-
width: width * spaceRatio,
|
|
895
|
-
height: height
|
|
896
|
-
});
|
|
897
|
-
};
|
|
898
|
-
/*
|
|
899
|
-
* @method getTrendFontSize
|
|
900
|
-
* @param {Object} props
|
|
901
|
-
* @param {Number} props.width
|
|
902
|
-
* @param {Number} props.height
|
|
903
|
-
* @param {String} props.trendText
|
|
904
|
-
* @param {Number} props.spaceRatio
|
|
905
|
-
* @returns {Number} trendFontSize
|
|
906
|
-
*/
|
|
907
|
-
|
|
908
|
-
var getTrendFontSize = function getTrendFontSize(_ref9) {
|
|
909
|
-
var width = _ref9.width,
|
|
910
|
-
height = _ref9.height,
|
|
911
|
-
trendText = _ref9.trendText,
|
|
912
|
-
_ref9$spaceRatio = _ref9.spaceRatio,
|
|
913
|
-
spaceRatio = _ref9$spaceRatio === void 0 ? 1 : _ref9$spaceRatio;
|
|
914
|
-
var trendFontSize = 12;
|
|
915
|
-
|
|
916
|
-
if (spaceRatio > 0) {
|
|
917
|
-
trendFontSize = computeFontSize(trendText, {
|
|
918
|
-
width: width * spaceRatio,
|
|
919
|
-
height: height
|
|
920
|
-
});
|
|
921
|
-
trendFontSize = parseInt(trendFontSize, 10) * spaceRatio;
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
return trendFontSize;
|
|
925
|
-
};
|
|
926
|
-
/*
|
|
927
|
-
* The height of underLabel should no more than 12px
|
|
928
|
-
* @param {Number} height
|
|
929
|
-
* @return {Number} height || DEFAULT_FONT
|
|
930
|
-
*/
|
|
931
|
-
|
|
932
|
-
var getUnderLabelHeight = function getUnderLabelHeight(height) {
|
|
933
|
-
return height > DEFAULT_FONT ? DEFAULT_FONT : height;
|
|
934
|
-
};
|
|
935
|
-
/*
|
|
936
|
-
* @param {Object} config
|
|
937
|
-
* @param {String} underLabel
|
|
938
|
-
* @param {Number} width width of underLabel
|
|
939
|
-
* @param {Number} height height of underLabel
|
|
940
|
-
* @param {Number} fond size of underLabel
|
|
941
|
-
*/
|
|
942
|
-
|
|
943
|
-
var getUnderLabel = function getUnderLabel(_ref10) {
|
|
944
|
-
var underLabel = _ref10.underLabel,
|
|
945
|
-
width = _ref10.width,
|
|
946
|
-
height = _ref10.height;
|
|
947
|
-
return (// todo: may need truncate underLabel later
|
|
948
|
-
computeFontSize(underLabel, {
|
|
949
|
-
width: width,
|
|
950
|
-
height: height
|
|
951
|
-
})
|
|
952
|
-
);
|
|
953
|
-
};
|
|
954
|
-
/**
|
|
955
|
-
* Compute value and font size for major and trend
|
|
956
|
-
* @method getMajorAndTrend
|
|
957
|
-
* @param {Object} props
|
|
958
|
-
* @param {Number} props.width // Width of the text container
|
|
959
|
-
* @param {Number} props.height // Height of the text container
|
|
960
|
-
* @param {Number} props.majorValue // Major value
|
|
961
|
-
* @param {Number} props.trendValue // Trend value
|
|
962
|
-
* @param {Number} props.majorFontSize
|
|
963
|
-
* @param {Number} props.trendFontSize
|
|
964
|
-
* @param {String} props.trendDisplay
|
|
965
|
-
* @param {String} props.unit // Unit for the value
|
|
966
|
-
* @param {Number} props.numberPrecision
|
|
967
|
-
* @param {Bool} props.shouldUseThousandSeparators
|
|
968
|
-
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
969
|
-
* @param {Bool} props.shouldAbbreviateMajorValue
|
|
970
|
-
* @returns {Number, Number, Number, Number} Major text, trend text, major text size, trend text size
|
|
971
|
-
*/
|
|
972
|
-
|
|
973
|
-
var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
974
|
-
var width = _ref11.width,
|
|
975
|
-
height = _ref11.height,
|
|
976
|
-
majorValue = _ref11.majorValue,
|
|
977
|
-
trendValue = _ref11.trendValue,
|
|
978
|
-
majorFontSize = _ref11.majorFontSize,
|
|
979
|
-
trendFontSize = _ref11.trendFontSize,
|
|
980
|
-
trendDisplay = _ref11.trendDisplay,
|
|
981
|
-
unit = _ref11.unit,
|
|
982
|
-
numberPrecision = _ref11.numberPrecision,
|
|
983
|
-
shouldUseThousandSeparators = _ref11.shouldUseThousandSeparators,
|
|
984
|
-
shouldAbbreviateTrendValue = _ref11.shouldAbbreviateTrendValue,
|
|
985
|
-
shouldAbbreviateMajorValue = _ref11.shouldAbbreviateMajorValue;
|
|
986
|
-
var majorTextSpaceRatio = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue) && shouldShowTrend(trendDisplay) ? 0.6 : 1;
|
|
987
|
-
var textContentWidth = width * 0.9;
|
|
988
|
-
var textContentHeight = height * 0.9;
|
|
989
|
-
var majorText = getMajorText({
|
|
990
|
-
majorValue: majorValue,
|
|
991
|
-
numberPrecision: numberPrecision,
|
|
992
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
993
|
-
shouldAbbreviateMajorValue: shouldAbbreviateMajorValue
|
|
994
|
-
});
|
|
995
|
-
var majorTextFontSize = majorFontSize || getMajorFontSize({
|
|
996
|
-
width: textContentWidth,
|
|
997
|
-
height: textContentHeight,
|
|
998
|
-
unit: unit,
|
|
999
|
-
majorText: majorText,
|
|
1000
|
-
spaceRatio: majorTextSpaceRatio
|
|
1001
|
-
});
|
|
1002
|
-
var trendText = getTrendText({
|
|
1003
|
-
majorValue: majorValue,
|
|
1004
|
-
trendValue: trendValue,
|
|
1005
|
-
trendDisplay: trendDisplay,
|
|
1006
|
-
numberPrecision: numberPrecision,
|
|
1007
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
1008
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
1009
|
-
});
|
|
1010
|
-
var trendTextFontSize = trendFontSize || getTrendFontSize({
|
|
1011
|
-
width: textContentWidth,
|
|
1012
|
-
height: textContentHeight,
|
|
1013
|
-
trendText: trendText,
|
|
1014
|
-
spaceRatio: 1 - majorTextSpaceRatio
|
|
1015
|
-
});
|
|
1016
|
-
return {
|
|
1017
|
-
majorText: majorText,
|
|
1018
|
-
majorTextFontSize: majorTextFontSize,
|
|
1019
|
-
trendText: trendText,
|
|
1020
|
-
trendTextFontSize: trendTextFontSize
|
|
1021
|
-
};
|
|
1022
|
-
};
|
|
1023
|
-
/*
|
|
1024
|
-
* @method updateVizInSmallSpace
|
|
1025
|
-
* @param {Object} props
|
|
1026
|
-
* @param {Number} props.width // Width of the text container
|
|
1027
|
-
* @param {Number} props.height // Height of the text container
|
|
1028
|
-
* @param {Object} props.toRemoveList
|
|
1029
|
-
* @param {Number} props.majorValue // Major value
|
|
1030
|
-
* @param {Number} props.trendValue // Trend value
|
|
1031
|
-
* @param {Number} props.majorFontSize
|
|
1032
|
-
* @param {Number} props.trendFontSize
|
|
1033
|
-
* @param {Number} props.majorTextFontSize
|
|
1034
|
-
* @param {String} props.unit // Unit for the value
|
|
1035
|
-
* @param {Number} props.numberPrecision
|
|
1036
|
-
* @param {Bool} props.shouldUseThousandSeparators
|
|
1037
|
-
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
1038
|
-
* @returns {Object} results
|
|
1039
|
-
* @returns {Object} results.newMajorAndTrend
|
|
1040
|
-
* @returns {Object} results.updatedProps
|
|
1041
|
-
*/
|
|
1042
|
-
|
|
1043
|
-
var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
1044
|
-
var width = _ref12.width,
|
|
1045
|
-
height = _ref12.height,
|
|
1046
|
-
toRemoveList = _ref12.toRemoveList,
|
|
1047
|
-
majorValue = _ref12.majorValue,
|
|
1048
|
-
trendValue = _ref12.trendValue,
|
|
1049
|
-
majorFontSize = _ref12.majorFontSize,
|
|
1050
|
-
trendFontSize = _ref12.trendFontSize,
|
|
1051
|
-
majorTextFontSize = _ref12.majorTextFontSize,
|
|
1052
|
-
unit = _ref12.unit,
|
|
1053
|
-
numberPrecision = _ref12.numberPrecision,
|
|
1054
|
-
shouldUseThousandSeparators = _ref12.shouldUseThousandSeparators,
|
|
1055
|
-
shouldAbbreviateTrendValue = _ref12.shouldAbbreviateTrendValue;
|
|
1056
|
-
var removeIndex = 0;
|
|
1057
|
-
var newProps = {}; // options need to be updated
|
|
1058
|
-
|
|
1059
|
-
var newMajorAndTrend = {};
|
|
1060
|
-
var newTextSize = majorTextFontSize; // remove info on viz to make textFontSize >= 12px;
|
|
1061
|
-
|
|
1062
|
-
while (newTextSize < 12 && removeIndex < toRemoveList.length) {
|
|
1063
|
-
var toRemove = toRemoveList[removeIndex];
|
|
1064
|
-
newProps = _objectSpread(_objectSpread({}, newProps), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, toRemove.key, toRemove.value));
|
|
1065
|
-
newMajorAndTrend = getMajorAndTrend(_objectSpread({
|
|
1066
|
-
majorValue: majorValue,
|
|
1067
|
-
trendValue: trendValue,
|
|
1068
|
-
majorFontSize: majorFontSize,
|
|
1069
|
-
trendFontSize: trendFontSize,
|
|
1070
|
-
width: width,
|
|
1071
|
-
height: height,
|
|
1072
|
-
unit: unit,
|
|
1073
|
-
numberPrecision: numberPrecision,
|
|
1074
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
1075
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
1076
|
-
}, newProps));
|
|
1077
|
-
newTextSize = newMajorAndTrend.majorTextFontSize;
|
|
1078
|
-
removeIndex += 1;
|
|
1079
|
-
} // truncate text if textFontSize is still less than 12
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
if (newTextSize < 12) {
|
|
1083
|
-
var truncateValue = "".concat(majorValue.toString().slice(0, 3), "...");
|
|
1084
|
-
newMajorAndTrend = getMajorAndTrend(_objectSpread({
|
|
1085
|
-
majorValue: truncateValue,
|
|
1086
|
-
trendValue: trendValue,
|
|
1087
|
-
majorFontSize: majorFontSize,
|
|
1088
|
-
trendFontSize: trendFontSize,
|
|
1089
|
-
width: width,
|
|
1090
|
-
height: height,
|
|
1091
|
-
unit: unit,
|
|
1092
|
-
numberPrecision: numberPrecision,
|
|
1093
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
1094
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
1095
|
-
}, newProps));
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
return {
|
|
1099
|
-
newMajorAndTrend: newMajorAndTrend,
|
|
1100
|
-
updatedProps: newProps
|
|
1101
|
-
};
|
|
1102
|
-
};
|
|
1103
|
-
/*
|
|
1104
|
-
* @method computeSingleValueContent
|
|
1105
|
-
* @param {Object} props
|
|
1106
|
-
* @param {Number} props.contentWidth
|
|
1107
|
-
* @param {Number} props.contentHeight
|
|
1108
|
-
* @param {Number} props.containerWidth
|
|
1109
|
-
* @param {Number} props.containerHeight
|
|
1110
|
-
* @param {Number} props.majorValue // Major value
|
|
1111
|
-
* @param {Number} props.trendValue // Trend value
|
|
1112
|
-
* @param {Number} props.majorFontSize
|
|
1113
|
-
* @param {Number} props.trendFontSize
|
|
1114
|
-
* @param {String} props.trendDisplay
|
|
1115
|
-
* @param {String} props.unit // Unit for the value
|
|
1116
|
-
* @param {Number} props.numberPrecision
|
|
1117
|
-
* @param {Bool} props.shouldUseThousandSeparators
|
|
1118
|
-
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
1119
|
-
* @param {Bool} props.shouldAbbreviateMajorValue
|
|
1120
|
-
* @param {Object} props.toRemoveList
|
|
1121
|
-
* @returns {Object} results
|
|
1122
|
-
* @returns {String} results.majorText
|
|
1123
|
-
* @returns {String} results.trendText
|
|
1124
|
-
* @returns {Number} results.majorTextFontSize
|
|
1125
|
-
* @returns {Number} results.trendTextFontSize
|
|
1126
|
-
* @returns {String} results.majorValueTitle
|
|
1127
|
-
* @returns {Object} results.smallVizProps
|
|
1128
|
-
*/
|
|
1129
|
-
|
|
1130
|
-
var computeSingleValueContent = function computeSingleValueContent(_ref13) {
|
|
1131
|
-
var contentWidth = _ref13.contentWidth,
|
|
1132
|
-
contentHeight = _ref13.contentHeight,
|
|
1133
|
-
containerWidth = _ref13.containerWidth,
|
|
1134
|
-
containerHeight = _ref13.containerHeight,
|
|
1135
|
-
majorValue = _ref13.majorValue,
|
|
1136
|
-
trendValue = _ref13.trendValue,
|
|
1137
|
-
majorFontSize = _ref13.majorFontSize,
|
|
1138
|
-
trendFontSize = _ref13.trendFontSize,
|
|
1139
|
-
trendDisplay = _ref13.trendDisplay,
|
|
1140
|
-
unit = _ref13.unit,
|
|
1141
|
-
numberPrecision = _ref13.numberPrecision,
|
|
1142
|
-
shouldUseThousandSeparators = _ref13.shouldUseThousandSeparators,
|
|
1143
|
-
shouldAbbreviateTrendValue = _ref13.shouldAbbreviateTrendValue,
|
|
1144
|
-
shouldAbbreviateMajorValue = _ref13.shouldAbbreviateMajorValue,
|
|
1145
|
-
toRemoveList = _ref13.toRemoveList;
|
|
1146
|
-
|
|
1147
|
-
var _getMajorAndTrend = getMajorAndTrend({
|
|
1148
|
-
majorValue: majorValue,
|
|
1149
|
-
trendValue: trendValue,
|
|
1150
|
-
majorFontSize: majorFontSize,
|
|
1151
|
-
trendFontSize: trendFontSize,
|
|
1152
|
-
trendDisplay: trendDisplay,
|
|
1153
|
-
width: contentWidth,
|
|
1154
|
-
height: contentHeight,
|
|
1155
|
-
unit: unit,
|
|
1156
|
-
numberPrecision: numberPrecision,
|
|
1157
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
1158
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
|
|
1159
|
-
shouldAbbreviateMajorValue: shouldAbbreviateMajorValue
|
|
1160
|
-
}),
|
|
1161
|
-
majorText = _getMajorAndTrend.majorText,
|
|
1162
|
-
trendText = _getMajorAndTrend.trendText,
|
|
1163
|
-
majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
|
|
1164
|
-
trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
|
|
1165
|
-
|
|
1166
|
-
var majorValueTitle = majorText;
|
|
1167
|
-
var smallVizProps = {}; // update viz in small space
|
|
1168
|
-
// if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
|
|
1169
|
-
// or truncate major value to make the major font size >= 12
|
|
1170
|
-
|
|
1171
|
-
if (majorTextFontSize < 12) {
|
|
1172
|
-
var _updateVizInSmallSpac = updateVizInSmallSpace({
|
|
1173
|
-
width: containerWidth,
|
|
1174
|
-
height: containerHeight,
|
|
1175
|
-
toRemoveList: toRemoveList,
|
|
1176
|
-
majorValue: majorValue,
|
|
1177
|
-
trendValue: trendValue,
|
|
1178
|
-
majorFontSize: majorFontSize,
|
|
1179
|
-
trendFontSize: trendFontSize,
|
|
1180
|
-
majorTextFontSize: majorTextFontSize,
|
|
1181
|
-
unit: unit,
|
|
1182
|
-
numberPrecision: numberPrecision,
|
|
1183
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
1184
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
1185
|
-
}),
|
|
1186
|
-
newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
|
|
1187
|
-
updatedProps = _updateVizInSmallSpac.updatedProps;
|
|
1188
|
-
|
|
1189
|
-
majorText = newMajorAndTrend.majorText;
|
|
1190
|
-
trendText = newMajorAndTrend.trendText;
|
|
1191
|
-
majorTextFontSize = newMajorAndTrend.majorTextFontSize;
|
|
1192
|
-
trendTextFontSize = newMajorAndTrend.trendTextFontSize;
|
|
1193
|
-
smallVizProps = updatedProps;
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
return {
|
|
1197
|
-
majorText: majorText,
|
|
1198
|
-
trendText: trendText,
|
|
1199
|
-
majorTextFontSize: majorTextFontSize,
|
|
1200
|
-
trendTextFontSize: trendTextFontSize,
|
|
1201
|
-
majorValueTitle: majorValueTitle,
|
|
1202
|
-
smallVizProps: smallVizProps
|
|
1203
|
-
};
|
|
1204
|
-
};
|
|
1205
|
-
var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_ref14) {
|
|
1206
|
-
var text = _ref14.text,
|
|
1207
|
-
_ref14$fontSize = _ref14.fontSize,
|
|
1208
|
-
fontSize = _ref14$fontSize === void 0 ? DEFAULT_FONT : _ref14$fontSize,
|
|
1209
|
-
_ref14$fontFamily = _ref14.fontFamily,
|
|
1210
|
-
fontFamily = _ref14$fontFamily === void 0 ? DEFAULT_FONT_FAMILY : _ref14$fontFamily,
|
|
1211
|
-
_ref14$fontWeight = _ref14.fontWeight,
|
|
1212
|
-
fontWeight = _ref14$fontWeight === void 0 ? 'normal' : _ref14$fontWeight,
|
|
1213
|
-
containerWidth = _ref14.containerWidth;
|
|
1214
|
-
var textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
|
|
1215
|
-
var modifiedText = text;
|
|
1216
|
-
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.
|
|
1217
|
-
|
|
1218
|
-
if (containerWidth - ellipsesLength > 0 && textWidth > containerWidth) {
|
|
1219
|
-
// Truncates the content such that the truncated value + ellipses fit within the allocated space for the ellipses.
|
|
1220
|
-
// `textWidth > containerWidth - ellipsesLength` condition checks if text + ellipses exceeds container width.
|
|
1221
|
-
// `text.length > 1` condition included to keep at least the first number.
|
|
1222
|
-
while (textWidth + ellipsesLength > containerWidth && modifiedText.length > 1) {
|
|
1223
|
-
modifiedText = modifiedText.substring(0, modifiedText.length - 1);
|
|
1224
|
-
textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(modifiedText, "normal ".concat(fontSize, "px ").concat(fontFamily));
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
modifiedText = "".concat(modifiedText, "...");
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
return modifiedText;
|
|
1231
|
-
};
|
|
1232
|
-
/*
|
|
1233
|
-
* @method computeSingleValueRadialContent
|
|
1234
|
-
* @param {Object} props
|
|
1235
|
-
* @param {Number} props.contentWidth
|
|
1236
|
-
* @param {Number} props.contentHeight
|
|
1237
|
-
* @param {Number} props.containerWidth
|
|
1238
|
-
* @param {Number} props.containerHeight
|
|
1239
|
-
* @param {Number} props.majorValue // Major value
|
|
1240
|
-
* @param {Number} props.trendValue // Trend value
|
|
1241
|
-
* @param {Number} props.majorFontSize
|
|
1242
|
-
* @param {Number} props.trendFontSize
|
|
1243
|
-
* @param {String} props.trendDisplay
|
|
1244
|
-
* @param {String} props.unit // Unit for the value
|
|
1245
|
-
* @param {Number} props.numberPrecision
|
|
1246
|
-
* @param {Bool} props.shouldUseThousandSeparators
|
|
1247
|
-
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
1248
|
-
* @param {Bool} props.shouldAbbreviateMajorValue,
|
|
1249
|
-
* @param {Object} props.toRemoveList
|
|
1250
|
-
* @param {Bool} props.smallViz
|
|
1251
|
-
* @returns {Object} results
|
|
1252
|
-
* @returns {String} results.majorText
|
|
1253
|
-
* @returns {String} results.trendText
|
|
1254
|
-
* @returns {Number} results.majorTextFontSize
|
|
1255
|
-
* @returns {Number} results.trendTextFontSize
|
|
1256
|
-
* @returns {String} results.majorValueTitle
|
|
1257
|
-
* @returns {Object} results.smallVizProps
|
|
1258
|
-
*/
|
|
1259
|
-
|
|
1260
|
-
var computeSingleValueRadialContent = function computeSingleValueRadialContent(_ref15) {
|
|
1261
|
-
var contentWidth = _ref15.contentWidth,
|
|
1262
|
-
contentHeight = _ref15.contentHeight,
|
|
1263
|
-
containerWidth = _ref15.containerWidth,
|
|
1264
|
-
containerHeight = _ref15.containerHeight,
|
|
1265
|
-
majorValue = _ref15.majorValue,
|
|
1266
|
-
trendValue = _ref15.trendValue,
|
|
1267
|
-
majorFontSize = _ref15.majorFontSize,
|
|
1268
|
-
trendFontSize = _ref15.trendFontSize,
|
|
1269
|
-
trendDisplay = _ref15.trendDisplay,
|
|
1270
|
-
unit = _ref15.unit,
|
|
1271
|
-
numberPrecision = _ref15.numberPrecision,
|
|
1272
|
-
shouldUseThousandSeparators = _ref15.shouldUseThousandSeparators,
|
|
1273
|
-
shouldAbbreviateTrendValue = _ref15.shouldAbbreviateTrendValue,
|
|
1274
|
-
shouldAbbreviateMajorValue = _ref15.shouldAbbreviateMajorValue,
|
|
1275
|
-
smallViz = _ref15.smallViz;
|
|
1276
|
-
|
|
1277
|
-
var _getMajorAndTrend2 = getMajorAndTrend({
|
|
1278
|
-
majorValue: majorValue,
|
|
1279
|
-
trendValue: trendValue,
|
|
1280
|
-
majorFontSize: majorFontSize,
|
|
1281
|
-
trendFontSize: trendFontSize,
|
|
1282
|
-
trendDisplay: trendDisplay,
|
|
1283
|
-
width: contentWidth,
|
|
1284
|
-
height: contentHeight,
|
|
1285
|
-
unit: unit,
|
|
1286
|
-
numberPrecision: numberPrecision,
|
|
1287
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
1288
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
|
|
1289
|
-
shouldAbbreviateMajorValue: shouldAbbreviateMajorValue
|
|
1290
|
-
}),
|
|
1291
|
-
majorText = _getMajorAndTrend2.majorText,
|
|
1292
|
-
trendText = _getMajorAndTrend2.trendText,
|
|
1293
|
-
majorTextFontSize = _getMajorAndTrend2.majorTextFontSize,
|
|
1294
|
-
trendTextFontSize = _getMajorAndTrend2.trendTextFontSize;
|
|
1295
|
-
|
|
1296
|
-
var majorValueTitle = majorText;
|
|
1297
|
-
var smallVizProps = {}; // custom logic for viz in small space
|
|
1298
|
-
// if not showing the radial graph (if `smallViz` is true), then compute truncated major value
|
|
1299
|
-
// and font sizes
|
|
1300
|
-
|
|
1301
|
-
if (smallViz) {
|
|
1302
|
-
var truncateValue = minimallyTruncateStringToWidth({
|
|
1303
|
-
text: majorValue,
|
|
1304
|
-
fontWeight: 'bold',
|
|
1305
|
-
fontSize: 12,
|
|
1306
|
-
containerWidth: containerWidth
|
|
1307
|
-
});
|
|
1308
|
-
|
|
1309
|
-
var _getMajorAndTrend3 = getMajorAndTrend({
|
|
1310
|
-
majorValue: truncateValue,
|
|
1311
|
-
trendValue: trendValue,
|
|
1312
|
-
majorFontSize: majorFontSize,
|
|
1313
|
-
trendFontSize: trendFontSize,
|
|
1314
|
-
width: containerWidth,
|
|
1315
|
-
height: containerHeight,
|
|
1316
|
-
unit: unit,
|
|
1317
|
-
trendDisplay: trendDisplay,
|
|
1318
|
-
numberPrecision: numberPrecision,
|
|
1319
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
1320
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
|
|
1321
|
-
shouldAbbreviateMajorValue: shouldAbbreviateMajorValue
|
|
1322
|
-
});
|
|
1323
|
-
|
|
1324
|
-
majorText = _getMajorAndTrend3.majorText;
|
|
1325
|
-
trendText = _getMajorAndTrend3.trendText;
|
|
1326
|
-
majorTextFontSize = _getMajorAndTrend3.majorTextFontSize;
|
|
1327
|
-
trendTextFontSize = _getMajorAndTrend3.trendTextFontSize;
|
|
1328
|
-
smallVizProps = {
|
|
1329
|
-
trendDisplay: trendDisplay,
|
|
1330
|
-
unit: unit
|
|
1331
|
-
};
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
|
-
return {
|
|
1335
|
-
majorText: majorText,
|
|
1336
|
-
trendText: trendText,
|
|
1337
|
-
majorTextFontSize: majorTextFontSize,
|
|
1338
|
-
trendTextFontSize: trendTextFontSize,
|
|
1339
|
-
majorValueTitle: majorValueTitle,
|
|
1340
|
-
smallVizProps: smallVizProps
|
|
1341
|
-
};
|
|
1342
|
-
};
|
|
1343
|
-
/**
|
|
1344
|
-
* Get the colors for a graph
|
|
1345
|
-
*
|
|
1346
|
-
* @method getGraphColors
|
|
1347
|
-
* @param {Object} options
|
|
1348
|
-
* @param {Bool} options.backgroundEnabled // Flag to turn on color mode
|
|
1349
|
-
* @param {String} options.backgroundColor // The current background color, overrides trend background color
|
|
1350
|
-
* @param {Object} options.defaultColors // Default colors by severity
|
|
1351
|
-
* @param {Function} options.customColorFormatter // must return { background, stroke } given a color
|
|
1352
|
-
* @returns {Object} { background, stroke } colors
|
|
1353
|
-
* @private
|
|
1354
|
-
*/
|
|
1355
|
-
|
|
1356
|
-
var getGraphColors = function getGraphColors(_ref16) {
|
|
1357
|
-
var backgroundEnabled = _ref16.backgroundEnabled,
|
|
1358
|
-
backgroundColor = _ref16.backgroundColor,
|
|
1359
|
-
defaultColors = _ref16.defaultColors,
|
|
1360
|
-
customColorFormatter = _ref16.customColorFormatter; // Only do custom colors in block mode
|
|
1361
|
-
|
|
1362
|
-
if (backgroundEnabled) {
|
|
1363
|
-
// Check if the user defined colors to use
|
|
1364
|
-
if (backgroundColor && typeof customColorFormatter === 'function') {
|
|
1365
|
-
return customColorFormatter(backgroundColor);
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
return defaultColors.none;
|
|
1370
|
-
};
|
|
1371
|
-
/**
|
|
1372
|
-
* Adjust rgb value if it equals to 0 or 255
|
|
1373
|
-
* @method adjustRGB
|
|
1374
|
-
* @param {Number} rgb [0 - 255]
|
|
1375
|
-
* @param {Number} delta
|
|
1376
|
-
* @returns {Number} adjusted rgb
|
|
1377
|
-
* @private
|
|
1378
|
-
*/
|
|
1379
|
-
|
|
1380
|
-
var adjustRGB = function adjustRGB(rgb, delta) {
|
|
1381
|
-
if (rgb === 255) {
|
|
1382
|
-
return rgb - delta;
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
if (rgb === 0) {
|
|
1386
|
-
return rgb + delta;
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
return rgb;
|
|
1390
|
-
};
|
|
1391
|
-
/**
|
|
1392
|
-
* Modifies colors by multiplying by a given ratio
|
|
1393
|
-
* @method changeColor
|
|
1394
|
-
* @param {String} color // Color to modify
|
|
1395
|
-
* @param {Number} ratio // Float to modify color
|
|
1396
|
-
* @returns {String} new color
|
|
1397
|
-
* @private
|
|
1398
|
-
*/
|
|
1399
|
-
|
|
1400
|
-
var changeColor = function changeColor(color, ratio) {
|
|
1401
|
-
var hex = color.replace(/(0x|#)/, '');
|
|
1402
|
-
var r = parseInt(hex.substr(0, 2), 16);
|
|
1403
|
-
var g = parseInt(hex.substr(2, 2), 16);
|
|
1404
|
-
var b = parseInt(hex.substr(4, 2), 16); // Multiply by given ratio, make sure is between 0 and 255;
|
|
1405
|
-
|
|
1406
|
-
var newR = Math.max(Math.min(Math.floor(r * ratio), 255), 0);
|
|
1407
|
-
var newG = Math.max(Math.min(Math.floor(g * ratio), 255), 0);
|
|
1408
|
-
var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0); // If the color is not changed
|
|
1409
|
-
// case 1: the color is (0, 0 0)
|
|
1410
|
-
// lighten color (80, 80, 80)
|
|
1411
|
-
// darken color (40, 40, 40)
|
|
1412
|
-
// case 2: the color is (255, 255, 255)
|
|
1413
|
-
// lighten color (235, 235, 235)
|
|
1414
|
-
// darken color (175, 175, 175)
|
|
1415
|
-
// case 3: the color is e.g. (0, 255, 0)
|
|
1416
|
-
// new color (20, 235, 20)
|
|
1417
|
-
|
|
1418
|
-
if (newR === r && newG === g && newB === b) {
|
|
1419
|
-
if (newR === 0 && newG === 0 && newB === 0) {
|
|
1420
|
-
if (ratio > 1) {
|
|
1421
|
-
newR = adjustRGB(newR, 80);
|
|
1422
|
-
newG = adjustRGB(newG, 80);
|
|
1423
|
-
newB = adjustRGB(newB, 80);
|
|
1424
|
-
} else {
|
|
1425
|
-
newR = adjustRGB(newR, 40);
|
|
1426
|
-
newG = adjustRGB(newG, 40);
|
|
1427
|
-
newB = adjustRGB(newB, 40);
|
|
285
|
+
value
|
|
286
|
+
));
|
|
287
|
+
};
|
|
288
|
+
MajorValue.propTypes = {
|
|
289
|
+
color: prop_types_default.string,
|
|
290
|
+
fontSize: prop_types_default.number,
|
|
291
|
+
unit: prop_types_default.string,
|
|
292
|
+
unitPosition: prop_types_default.oneOf(validUnitPositions),
|
|
293
|
+
value: prop_types_default.oneOfType([prop_types_default.string, prop_types_default.number]),
|
|
294
|
+
title: prop_types_default.oneOfType([prop_types_default.string, prop_types_default.number]),
|
|
295
|
+
onValueClick: prop_types_default.oneOfType([prop_types_default.bool, prop_types_default.func])
|
|
296
|
+
};
|
|
297
|
+
var MajorValue_default = MajorValue;
|
|
298
|
+
|
|
299
|
+
// src/SingleValueBasic/SingleValueBasic.jsx
|
|
300
|
+
var Column2 = styled_components_default.div`
|
|
301
|
+
display: flex;
|
|
302
|
+
flex-direction: column;
|
|
303
|
+
align-self: center;
|
|
304
|
+
justify-content: center;
|
|
305
|
+
`;
|
|
306
|
+
var Row2 = styled_components_default.div`
|
|
307
|
+
display: flex;
|
|
308
|
+
flex-direction: row;
|
|
309
|
+
align-items: ${(props) => props.alignItems || "center"};
|
|
310
|
+
justify-content: ${(props) => getAligment(props.align)};
|
|
311
|
+
`;
|
|
312
|
+
var Text3 = styled_components_default.div`
|
|
313
|
+
font-weight: normal;
|
|
314
|
+
white-space: nowrap;
|
|
315
|
+
font-size: ${(props) => props.size || 12}px;
|
|
316
|
+
color: ${(props) => props.color || "#000"};
|
|
317
|
+
font-family: ${DEFAULT_FONT_FAMILY};
|
|
318
|
+
height: ${(props) => props.size || 12}px;
|
|
319
|
+
line-height: 1.2;
|
|
320
|
+
margin: ${(props) => props.margin || "inherit"};
|
|
321
|
+
`;
|
|
322
|
+
var SingleValueBasic = (_a) => {
|
|
323
|
+
var props = __objRest(_a, []);
|
|
324
|
+
const {
|
|
325
|
+
majorColor,
|
|
326
|
+
majorTextFontSize,
|
|
327
|
+
majorText,
|
|
328
|
+
majorValueTitle,
|
|
329
|
+
trendColor,
|
|
330
|
+
trendTextFontSize,
|
|
331
|
+
trendText,
|
|
332
|
+
showTrendIndicator,
|
|
333
|
+
unit,
|
|
334
|
+
unitPosition,
|
|
335
|
+
underLabel,
|
|
336
|
+
underLabelFontSize,
|
|
337
|
+
underLabelColor,
|
|
338
|
+
onValueClick,
|
|
339
|
+
align
|
|
340
|
+
} = props;
|
|
341
|
+
const trendIndicatorEnabled = trendText !== "" && showTrendIndicator;
|
|
342
|
+
return /* @__PURE__ */ react_default.createElement(Column2, null, /* @__PURE__ */ react_default.createElement(
|
|
343
|
+
Row2,
|
|
344
|
+
{
|
|
345
|
+
alignItems: "baseline",
|
|
346
|
+
align,
|
|
347
|
+
"data-test": `single-value-row-align-${getAligment(align)}`
|
|
348
|
+
},
|
|
349
|
+
/* @__PURE__ */ react_default.createElement(
|
|
350
|
+
MajorValue_default,
|
|
351
|
+
{
|
|
352
|
+
color: majorColor,
|
|
353
|
+
fontSize: majorTextFontSize,
|
|
354
|
+
unit,
|
|
355
|
+
unitPosition,
|
|
356
|
+
value: majorText,
|
|
357
|
+
title: majorValueTitle,
|
|
358
|
+
onValueClick
|
|
1428
359
|
}
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
360
|
+
),
|
|
361
|
+
trendIndicatorEnabled && // Passing the same value for value and text is a temporary hold until completion of https://jira.splunk.com/browse/SCP-21371
|
|
362
|
+
/* @__PURE__ */ react_default.createElement(
|
|
363
|
+
TrendValue_default,
|
|
364
|
+
{
|
|
365
|
+
fontSize: trendTextFontSize,
|
|
366
|
+
color: trendColor,
|
|
367
|
+
value: trendText,
|
|
368
|
+
text: trendText
|
|
1438
369
|
}
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
var handleValueClickCallback = function handleValueClickCallback(ev, majorValue, majorValueField, trendValue, onValueClick) {
|
|
1481
|
-
var trellisEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
1482
|
-
var trellisSplityBy = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
|
|
1483
|
-
var trellisKey = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : '';
|
|
1484
|
-
var payload = {
|
|
1485
|
-
trendValue: trendValue,
|
|
1486
|
-
value: majorValue,
|
|
1487
|
-
name: majorValueField
|
|
1488
|
-
};
|
|
1489
|
-
|
|
1490
|
-
if (trellisEnabled) {
|
|
1491
|
-
payload = _objectSpread(_objectSpread({}, payload), {}, {
|
|
1492
|
-
'trellis.name': trellisSplityBy,
|
|
1493
|
-
'trellis.value': trellisKey
|
|
1494
|
-
});
|
|
1495
|
-
}
|
|
1496
|
-
|
|
1497
|
-
return onValueClick(_objectSpread(_objectSpread({}, ev), {}, {
|
|
1498
|
-
payload: payload
|
|
1499
|
-
}));
|
|
1500
|
-
};
|
|
1501
|
-
|
|
1502
|
-
/***/ }),
|
|
1503
|
-
|
|
1504
|
-
/***/ 2:
|
|
1505
|
-
/***/ (function(module, exports) {
|
|
1506
|
-
|
|
1507
|
-
module.exports = require("lodash");
|
|
1508
|
-
|
|
1509
|
-
/***/ }),
|
|
1510
|
-
|
|
1511
|
-
/***/ 3:
|
|
1512
|
-
/***/ (function(module, exports) {
|
|
1513
|
-
|
|
1514
|
-
module.exports = require("@splunk/ui-utils/i18n");
|
|
1515
|
-
|
|
1516
|
-
/***/ }),
|
|
1517
|
-
|
|
1518
|
-
/***/ 35:
|
|
1519
|
-
/***/ (function(module, exports) {
|
|
1520
|
-
|
|
1521
|
-
module.exports = require("@splunk/visualizations-shared/propUtils");
|
|
1522
|
-
|
|
1523
|
-
/***/ }),
|
|
1524
|
-
|
|
1525
|
-
/***/ 4:
|
|
1526
|
-
/***/ (function(module, exports) {
|
|
1527
|
-
|
|
1528
|
-
module.exports = require("styled-components");
|
|
1529
|
-
|
|
1530
|
-
/***/ }),
|
|
1531
|
-
|
|
1532
|
-
/***/ 68:
|
|
1533
|
-
/***/ (function(module, exports) {
|
|
1534
|
-
|
|
1535
|
-
module.exports = require("@babel/runtime/helpers/extends");
|
|
1536
|
-
|
|
1537
|
-
/***/ }),
|
|
1538
|
-
|
|
1539
|
-
/***/ 69:
|
|
1540
|
-
/***/ (function(module, exports) {
|
|
1541
|
-
|
|
1542
|
-
module.exports = require("@splunk/visualizations-shared/colorConstants");
|
|
1543
|
-
|
|
1544
|
-
/***/ }),
|
|
1545
|
-
|
|
1546
|
-
/***/ 73:
|
|
1547
|
-
/***/ (function(module, exports) {
|
|
1548
|
-
|
|
1549
|
-
module.exports = require("@splunk/visualizations-shared/domUtils");
|
|
1550
|
-
|
|
1551
|
-
/***/ })
|
|
1552
|
-
|
|
1553
|
-
/******/ });
|
|
1554
|
-
//# sourceMappingURL=SingleValueBasic.js.map
|
|
370
|
+
)
|
|
371
|
+
), underLabel && /* @__PURE__ */ react_default.createElement(
|
|
372
|
+
Row2,
|
|
373
|
+
{
|
|
374
|
+
justify: "center",
|
|
375
|
+
align,
|
|
376
|
+
"data-test": `single-value-row-align-${getAligment(align)}`
|
|
377
|
+
},
|
|
378
|
+
/* @__PURE__ */ react_default.createElement(
|
|
379
|
+
Text3,
|
|
380
|
+
{
|
|
381
|
+
"data-test": "underLabel",
|
|
382
|
+
size: underLabelFontSize,
|
|
383
|
+
color: underLabelColor,
|
|
384
|
+
margin: "0 6px"
|
|
385
|
+
},
|
|
386
|
+
underLabel
|
|
387
|
+
)
|
|
388
|
+
));
|
|
389
|
+
};
|
|
390
|
+
SingleValueBasic.propTypes = {
|
|
391
|
+
majorText: prop_types_default.string,
|
|
392
|
+
majorColor: prop_types_default.string,
|
|
393
|
+
majorTextFontSize: prop_types_default.number,
|
|
394
|
+
majorValueTitle: prop_types_default.string,
|
|
395
|
+
trendText: prop_types_default.string,
|
|
396
|
+
trendTextFontSize: prop_types_default.number,
|
|
397
|
+
trendColor: prop_types_default.string,
|
|
398
|
+
showTrendIndicator: prop_types_default.bool,
|
|
399
|
+
unit: prop_types_default.string,
|
|
400
|
+
unitPosition: prop_types_default.oneOf(["before", "after"]),
|
|
401
|
+
underLabel: prop_types_default.string,
|
|
402
|
+
underLabelFontSize: prop_types_default.number,
|
|
403
|
+
underLabelColor: prop_types_default.string,
|
|
404
|
+
onValueClick: prop_types_default.oneOfType([prop_types_default.bool, prop_types_default.func]),
|
|
405
|
+
align: prop_types_default.string
|
|
406
|
+
};
|
|
407
|
+
var SingleValueTrendValue = TrendValue_default;
|
|
408
|
+
var SingleValueBasic_default = SingleValueBasic;
|
|
409
|
+
//# sourceMappingURL=SingleValueBasic.js.map
|