@splunk/visualizations 26.4.1 → 27.0.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.
Files changed (152) hide show
  1. package/Area.config.js +1262 -1600
  2. package/Area.config.js.map +7 -1
  3. package/Area.js +3002 -4930
  4. package/Area.js.map +7 -1
  5. package/Bar.config.js +1247 -1574
  6. package/Bar.config.js.map +7 -1
  7. package/Bar.js +2921 -4843
  8. package/Bar.js.map +7 -1
  9. package/Bubble.config.js +896 -1213
  10. package/Bubble.config.js.map +7 -1
  11. package/Bubble.js +2517 -4483
  12. package/Bubble.js.map +7 -1
  13. package/ChoroplethSvg.config.js +282 -582
  14. package/ChoroplethSvg.config.js.map +7 -1
  15. package/ChoroplethSvg.js +2004 -3810
  16. package/ChoroplethSvg.js.map +7 -1
  17. package/Column.config.js +1208 -1541
  18. package/Column.config.js.map +7 -1
  19. package/Column.js +2930 -4886
  20. package/Column.js.map +7 -1
  21. package/Ellipse.config.js +443 -774
  22. package/Ellipse.config.js.map +7 -1
  23. package/Ellipse.js +1651 -3341
  24. package/Ellipse.js.map +7 -1
  25. package/Events.config.js +207 -492
  26. package/Events.config.js.map +7 -1
  27. package/Events.js +2615 -4649
  28. package/Events.js.map +7 -1
  29. package/FillerGauge.config.js +420 -775
  30. package/FillerGauge.config.js.map +7 -1
  31. package/FillerGauge.js +2137 -4578
  32. package/FillerGauge.js.map +7 -1
  33. package/Image.config.js +144 -411
  34. package/Image.config.js.map +7 -1
  35. package/Image.js +1395 -3048
  36. package/Image.js.map +7 -1
  37. package/Line.config.js +1278 -1625
  38. package/Line.config.js.map +7 -1
  39. package/Line.js +2954 -4926
  40. package/Line.js.map +7 -1
  41. package/LinkGraph.config.js +390 -632
  42. package/LinkGraph.config.js.map +7 -1
  43. package/LinkGraph.js +5243 -6190
  44. package/LinkGraph.js.map +7 -1
  45. package/MIGRATION.md +6 -0
  46. package/Map.config.js +501 -801
  47. package/Map.config.js.map +7 -1
  48. package/Map.js +3369 -5676
  49. package/Map.js.map +7 -1
  50. package/Markdown.config.js +232 -528
  51. package/Markdown.config.js.map +7 -1
  52. package/Markdown.js +1645 -3216
  53. package/Markdown.js.map +7 -1
  54. package/MarkerGauge.config.js +308 -613
  55. package/MarkerGauge.config.js.map +7 -1
  56. package/MarkerGauge.js +2189 -4535
  57. package/MarkerGauge.js.map +7 -1
  58. package/ParallelCoordinates.config.js +282 -581
  59. package/ParallelCoordinates.config.js.map +7 -1
  60. package/ParallelCoordinates.js +2023 -4720
  61. package/ParallelCoordinates.js.map +7 -1
  62. package/Pie.config.js +278 -547
  63. package/Pie.config.js.map +7 -1
  64. package/Pie.js +1996 -3990
  65. package/Pie.js.map +7 -1
  66. package/Punchcard.config.js +291 -578
  67. package/Punchcard.config.js.map +7 -1
  68. package/Punchcard.js +2709 -5042
  69. package/Punchcard.js.map +7 -1
  70. package/Rectangle.config.js +455 -770
  71. package/Rectangle.config.js.map +7 -1
  72. package/Rectangle.js +1638 -3262
  73. package/Rectangle.js.map +7 -1
  74. package/Sankey.config.js +291 -626
  75. package/Sankey.config.js.map +7 -1
  76. package/Sankey.js +2737 -4909
  77. package/Sankey.js.map +7 -1
  78. package/Scatter.config.js +876 -1194
  79. package/Scatter.config.js.map +7 -1
  80. package/Scatter.js +2529 -4477
  81. package/Scatter.js.map +7 -1
  82. package/SingleValue.config.js +819 -1251
  83. package/SingleValue.config.js.map +7 -1
  84. package/SingleValue.js +4203 -7413
  85. package/SingleValue.js.map +7 -1
  86. package/SingleValueBasic.js +382 -1527
  87. package/SingleValueBasic.js.map +7 -1
  88. package/SingleValueIcon.config.js +781 -1207
  89. package/SingleValueIcon.config.js.map +7 -1
  90. package/SingleValueIcon.js +3350 -6285
  91. package/SingleValueIcon.js.map +7 -1
  92. package/SingleValueRadial.config.js +708 -1119
  93. package/SingleValueRadial.config.js.map +7 -1
  94. package/SingleValueRadial.js +3808 -6965
  95. package/SingleValueRadial.js.map +7 -1
  96. package/SparkLine.js +439 -746
  97. package/SparkLine.js.map +7 -1
  98. package/Table.config.js +565 -879
  99. package/Table.config.js.map +7 -1
  100. package/Table.js +3277 -5381
  101. package/Table.js.map +7 -1
  102. package/common/Charting.js +481 -1468
  103. package/common/Charting.js.map +7 -1
  104. package/common/ChartingApi.js +46 -170
  105. package/common/ChartingApi.js.map +7 -1
  106. package/common/DocExampleWithVizSandbox.js +270 -473
  107. package/common/DocExampleWithVizSandbox.js.map +7 -1
  108. package/common/EventsDoc.js +172 -464
  109. package/common/EventsDoc.js.map +7 -1
  110. package/common/GaugeMajorTicks.js +249 -347
  111. package/common/GaugeMajorTicks.js.map +7 -1
  112. package/common/GaugeValueMarker.js +201 -311
  113. package/common/GaugeValueMarker.js.map +7 -1
  114. package/common/OptionsDoc.js +347 -912
  115. package/common/OptionsDoc.js.map +7 -1
  116. package/common/OverviewDoc.js +435 -769
  117. package/common/OverviewDoc.js.map +7 -1
  118. package/common/SplunkVisualization.js +116 -259
  119. package/common/SplunkVisualization.js.map +7 -1
  120. package/common/SplunkVisualizationApi.js +40 -156
  121. package/common/SplunkVisualizationApi.js.map +7 -1
  122. package/common/ThemesDoc.js +271 -420
  123. package/common/ThemesDoc.js.map +7 -1
  124. package/common/chartingUtils.js +140 -312
  125. package/common/chartingUtils.js.map +7 -1
  126. package/common/docUtils.js +148 -266
  127. package/common/docUtils.js.map +7 -1
  128. package/common/gaugeUtils.js +280 -808
  129. package/common/gaugeUtils.js.map +7 -1
  130. package/common/shapeUtils.js +106 -211
  131. package/common/shapeUtils.js.map +7 -1
  132. package/common/utils/configUtils.js +126 -252
  133. package/common/utils/configUtils.js.map +7 -1
  134. package/common/utils/dataUtils.js +217 -812
  135. package/common/utils/dataUtils.js.map +7 -1
  136. package/common/utils/featureFlagUtils.js +53 -133
  137. package/common/utils/featureFlagUtils.js.map +7 -1
  138. package/common/utils/hocUtils.js +32 -122
  139. package/common/utils/hocUtils.js.map +7 -1
  140. package/common/utils/mapUtils.js +502 -1337
  141. package/common/utils/mapUtils.js.map +7 -1
  142. package/common/utils/singleValueUtils.js +462 -1010
  143. package/common/utils/singleValueUtils.js.map +7 -1
  144. package/common/utils/testHelper.js +92 -146
  145. package/common/utils/testHelper.js.map +7 -1
  146. package/common/utils/trellisUtils.js +237 -489
  147. package/common/utils/trellisUtils.js.map +7 -1
  148. package/common/utils/urlUtils.js +28 -112
  149. package/common/utils/urlUtils.js.map +7 -1
  150. package/common/withDashboardViz.js +1168 -2438
  151. package/common/withDashboardViz.js.map +7 -1
  152. package/package.json +52 -43
package/Pie.config.js CHANGED
@@ -1,366 +1,177 @@
1
- /*!
2
- * Copyright © 2024 Splunk Inc.
3
- * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
- * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
- */
6
- module.exports =
7
- /******/ (function(modules) { // webpackBootstrap
8
- /******/ // The module cache
9
- /******/ var installedModules = {};
10
- /******/
11
- /******/ // The require function
12
- /******/ function __webpack_require__(moduleId) {
13
- /******/
14
- /******/ // Check if module is in cache
15
- /******/ if(installedModules[moduleId]) {
16
- /******/ return installedModules[moduleId].exports;
17
- /******/ }
18
- /******/ // Create a new module (and put it into the cache)
19
- /******/ var module = installedModules[moduleId] = {
20
- /******/ i: moduleId,
21
- /******/ l: false,
22
- /******/ exports: {}
23
- /******/ };
24
- /******/
25
- /******/ // Execute the module function
26
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
27
- /******/
28
- /******/ // Flag the module as loaded
29
- /******/ module.l = true;
30
- /******/
31
- /******/ // Return the exports of the module
32
- /******/ return module.exports;
33
- /******/ }
34
- /******/
35
- /******/
36
- /******/ // expose the modules object (__webpack_modules__)
37
- /******/ __webpack_require__.m = modules;
38
- /******/
39
- /******/ // expose the module cache
40
- /******/ __webpack_require__.c = installedModules;
41
- /******/
42
- /******/ // define getter function for harmony exports
43
- /******/ __webpack_require__.d = function(exports, name, getter) {
44
- /******/ if(!__webpack_require__.o(exports, name)) {
45
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
46
- /******/ }
47
- /******/ };
48
- /******/
49
- /******/ // define __esModule on exports
50
- /******/ __webpack_require__.r = function(exports) {
51
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
52
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
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 = 59);
91
- /******/ })
92
- /************************************************************************/
93
- /******/ ({
94
-
95
- /***/ 0:
96
- /***/ (function(module, exports) {
97
-
98
- module.exports = require("@splunk/ui-utils/i18n");
99
-
100
- /***/ }),
101
-
102
- /***/ 1:
103
- /***/ (function(module, exports) {
104
-
105
- module.exports = require("@babel/runtime/helpers/toConsumableArray");
106
-
107
- /***/ }),
108
-
109
- /***/ 10:
110
- /***/ (function(module, exports) {
111
-
112
- module.exports = require("@splunk/visualization-icons/placeholders");
113
-
114
- /***/ }),
115
-
116
- /***/ 12:
117
- /***/ (function(module, exports, __webpack_require__) {
118
-
119
- "use strict";
120
-
121
-
122
- Object.defineProperty(exports, "__esModule", {
123
- value: true
124
- });
125
-
126
- var i18n_1 = __webpack_require__(0);
127
-
128
- var background = function background(_ref) {
129
- var label = _ref.label,
130
- themes = _ref.themes,
131
- labelPosition = _ref.labelPosition;
132
- return [{
133
- label: (0, i18n_1._)(label || 'Background color'),
134
- option: 'backgroundColor',
135
- editor: 'editor.color',
136
- editorProps: {
137
- labelPosition: labelPosition || 'top',
138
- themes: themes
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 __defProps = Object.defineProperties;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
11
+ var __getProtoOf = Object.getPrototypeOf;
12
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
13
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
14
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15
+ var __spreadValues = (a, b) => {
16
+ for (var prop in b || (b = {}))
17
+ if (__hasOwnProp.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ if (__getOwnPropSymbols)
20
+ for (var prop of __getOwnPropSymbols(b)) {
21
+ if (__propIsEnum.call(b, prop))
22
+ __defNormalProp(a, prop, b[prop]);
139
23
  }
140
- }];
24
+ return a;
141
25
  };
142
-
143
- exports.default = background;
144
-
145
- /***/ }),
146
-
147
- /***/ 2:
148
- /***/ (function(module, exports) {
149
-
150
- module.exports = require("@splunk/visualization-schemas");
151
-
152
- /***/ }),
153
-
154
- /***/ 3:
155
- /***/ (function(module, exports, __webpack_require__) {
156
-
157
- "use strict";
158
-
159
-
160
- var _toConsumableArray = __webpack_require__(1);
161
-
162
- Object.defineProperty(exports, "__esModule", {
163
- value: true
26
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27
+ var __export = (target, all) => {
28
+ for (var name in all)
29
+ __defProp(target, name, { get: all[name], enumerable: true });
30
+ };
31
+ var __copyProps = (to, from, except, desc) => {
32
+ if (from && typeof from === "object" || typeof from === "function") {
33
+ for (let key of __getOwnPropNames(from))
34
+ if (!__hasOwnProp.call(to, key) && key !== except)
35
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
36
+ }
37
+ return to;
38
+ };
39
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
40
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
41
+ // If the importer is in node compatibility mode or this is not an ESM
42
+ // file that has been converted to a CommonJS file using a Babel-
43
+ // compatible transform (i.e. "__esModule" has not been set), then set
44
+ // "default" to the CommonJS "module.exports" for node compatibility.
45
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
46
+ mod
47
+ ));
48
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
49
+
50
+ // src/Pie/config.ts
51
+ var config_exports = {};
52
+ __export(config_exports, {
53
+ default: () => config_default
164
54
  });
165
- exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceConfig = exports.enhanceOptionsSchemaWithDynamicOptions = void 0;
166
-
167
- var lodash_1 = __webpack_require__(5); // included for backwards compatibility
55
+ module.exports = __toCommonJS(config_exports);
168
56
 
169
-
170
- var visualization_schemas_1 = __webpack_require__(2);
171
-
172
- Object.defineProperty(exports, "enhanceOptionsSchemaWithDynamicOptions", {
173
- enumerable: true,
174
- get: function get() {
175
- return visualization_schemas_1.enhanceOptionsSchemaWithDynamicOptions;
176
- }
57
+ // esm-externals:@splunk/visualization-icons
58
+ var visualization_icons_exports = {};
59
+ __export(visualization_icons_exports, {
60
+ default: () => visualization_icons_default
61
+ });
62
+ var defaultImport = __toESM(require("@splunk/visualization-icons"));
63
+ __reExport(visualization_icons_exports, require("@splunk/visualization-icons"));
64
+ var visualization_icons_default = "default" in defaultImport ? defaultImport.default : defaultImport;
65
+
66
+ // esm-externals:@splunk/visualization-icons/placeholders
67
+ var placeholders_exports = {};
68
+ __export(placeholders_exports, {
69
+ default: () => placeholders_default
177
70
  });
178
- /**
179
- * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
180
- * this function also collapse all editor panels
181
- * @param vizConfig a Visualization Config
182
- * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
183
- * and containing `open: false` for all editor panels in editorConfig
184
- */
71
+ var defaultImport2 = __toESM(require("@splunk/visualization-icons/placeholders"));
72
+ __reExport(placeholders_exports, require("@splunk/visualization-icons/placeholders"));
73
+ var placeholders_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
74
+
75
+ // esm-externals:@splunk/ui-utils/i18n
76
+ var i18n_exports = {};
77
+ __export(i18n_exports, {
78
+ default: () => i18n_default
79
+ });
80
+ var defaultImport3 = __toESM(require("@splunk/ui-utils/i18n"));
81
+ __reExport(i18n_exports, require("@splunk/ui-utils/i18n"));
82
+ var i18n_default = "default" in defaultImport3 ? defaultImport3.default : defaultImport3;
83
+
84
+ // esm-externals:@splunk/visualization-schemas
85
+ var visualization_schemas_exports = {};
86
+ __export(visualization_schemas_exports, {
87
+ default: () => visualization_schemas_default
88
+ });
89
+ var defaultImport4 = __toESM(require("@splunk/visualization-schemas"));
90
+ __reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
91
+ var visualization_schemas_default = "default" in defaultImport4 ? defaultImport4.default : defaultImport4;
92
+
93
+ // esm-externals:@splunk/themes/pick
94
+ var pick_exports = {};
95
+ __export(pick_exports, {
96
+ default: () => pick_default
97
+ });
98
+ var defaultImport5 = __toESM(require("@splunk/themes/pick"));
99
+ __reExport(pick_exports, require("@splunk/themes/pick"));
100
+ var pick_default = "default" in defaultImport5 ? defaultImport5.default : defaultImport5;
101
+
102
+ // esm-externals:@splunk/themes/variables
103
+ var variables_exports = {};
104
+ __export(variables_exports, {
105
+ default: () => variables_default
106
+ });
107
+ var defaultImport6 = __toESM(require("@splunk/themes/variables"));
108
+ __reExport(variables_exports, require("@splunk/themes/variables"));
109
+ var variables_default = "default" in defaultImport6 ? defaultImport6.default : defaultImport6;
110
+
111
+ // esm-externals:lodash
112
+ var lodash_exports = {};
113
+ __export(lodash_exports, {
114
+ default: () => lodash_default
115
+ });
116
+ var defaultImport7 = __toESM(require("lodash"));
117
+ __reExport(lodash_exports, require("lodash"));
118
+ var lodash_default = "default" in defaultImport7 ? defaultImport7.default : defaultImport7;
119
+
120
+ // esm-externals:@splunk/visualizations-shared/configUtils
121
+ var configUtils_exports = {};
122
+ __export(configUtils_exports, {
123
+ default: () => configUtils_default
124
+ });
125
+ var defaultImport8 = __toESM(require("@splunk/visualizations-shared/configUtils"));
126
+ __reExport(configUtils_exports, require("@splunk/visualizations-shared/configUtils"));
127
+ var configUtils_default = "default" in defaultImport8 ? defaultImport8.default : defaultImport8;
185
128
 
129
+ // src/common/utils/configUtils.ts
186
130
  function enhanceConfig(vizConfig) {
187
- var enhancedConfig = Object.assign({}, vizConfig);
188
- enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
189
- return Object.assign(Object.assign({}, config), {
190
- open: config.open || false
191
- });
192
- });
131
+ const enhancedConfig = __spreadValues({}, vizConfig);
132
+ enhancedConfig.editorConfig = vizConfig.editorConfig.map(
133
+ (config2) => {
134
+ return __spreadProps(__spreadValues({}, config2), { open: config2.open || false });
135
+ }
136
+ );
193
137
  return enhancedConfig;
194
138
  }
195
139
 
196
- exports.enhanceConfig = enhanceConfig;
197
- /**
198
- * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
199
- * Created for editor unit tests
200
- * @param vizConfig a Visualization Config
201
- * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
202
- */
203
-
204
- function uncollapseEditorConfig(vizConfig) {
205
- var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
206
- editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
207
- return Object.assign(Object.assign({}, config), {
208
- open: true
209
- });
210
- });
211
- return editorPanelUncollapsedConfig;
212
- }
213
-
214
- exports.uncollapseEditorConfig = uncollapseEditorConfig;
215
-
216
- function isDynamicOption(option) {
217
- return option && typeof option === 'string' && option.trim().startsWith('>') || false;
218
- }
219
-
220
- exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
221
- // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
222
-
223
- /**
224
- * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
225
- * 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
226
- * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
227
- * the internal config contents are irrelevant (as the user could customize them in source), just as long as the presence of `undefined`s match up
228
- *
229
- * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
230
- */
231
-
232
- function hasCompatibleContexts(vizContext, presetContext) {
233
- var presetContextKeys = Object.keys(presetContext);
234
- return presetContextKeys.every(function (contextKey) {
235
- return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
236
- });
237
- }
238
- /**
239
- * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
240
- */
241
-
242
-
243
- function hasCompatibleOptions(vizOptions, presetOptions) {
244
- var presetOptionKeys = Object.keys(presetOptions);
245
- return presetOptionKeys.every(function (optionKey) {
246
- return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
247
- });
248
- }
249
- /**
250
- * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
251
- * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
252
- *
253
- * @param {Object} vizContext - the current vizContext definition
254
- * @param {Object} vizOptions - the current vizOptions definition
255
- * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
256
- */
257
-
258
-
259
- function getInitialPreset(vizContext, vizOptions, presets) {
260
- return presets.find(function (preset) {
261
- var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
262
- var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
263
- var presetContextKeys = Object.keys(presetContext);
264
- var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
265
- // if not, then the preset is invalid in config.ts
266
-
267
- if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
268
- return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
269
- });
270
- }
271
-
272
- exports.getInitialPreset = getInitialPreset;
273
- /**
274
- * generates number precision values for a Select editor
275
- *
276
- * @param {Number} numPrecisionValues - number of integer precision values to generate
277
- * @returns {{ label: string; value; string }[]} array of { label, value } tuples
278
- */
279
-
280
- function generatePrecisionValues(numPrecisionValues) {
281
- return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
282
- return {
283
- label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
284
- value: i
285
- };
286
- });
287
- }
288
-
289
- exports.generatePrecisionValues = generatePrecisionValues;
290
- /**
291
- * insert layout in layout array, return a new layout array instead of updating the original
292
- *
293
- * @param {EditorLayoutConfig[][]} layout - editor layout
294
- * @param {Number} index - the index to insert layout item(s)
295
- * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
296
- * @returns {EditorLayoutConfig[][]} new editor layout with insertion
297
- */
298
-
299
- var insertLayout = function insertLayout(layout, index) {
300
- for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
301
- layoutItems[_key - 2] = arguments[_key];
140
+ // src/common/editorConfig/BackgroundColor.ts
141
+ var background = ({
142
+ label,
143
+ themes: themes2,
144
+ labelPosition
145
+ }) => [
146
+ {
147
+ label: (0, i18n_exports._)(label || "Background color"),
148
+ option: "backgroundColor",
149
+ editor: "editor.color",
150
+ editorProps: {
151
+ labelPosition: labelPosition || "top",
152
+ themes: themes2
153
+ }
302
154
  }
155
+ ];
156
+ var BackgroundColor_default = background;
303
157
 
304
- return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
305
- };
306
-
307
- exports.insertLayout = insertLayout;
308
-
309
- /***/ }),
310
-
311
- /***/ 5:
312
- /***/ (function(module, exports) {
313
-
314
- module.exports = require("lodash");
315
-
316
- /***/ }),
317
-
318
- /***/ 59:
319
- /***/ (function(module, exports, __webpack_require__) {
320
-
321
- "use strict";
322
-
323
-
324
- Object.defineProperty(exports, "__esModule", {
325
- value: true
326
- });
327
-
328
- var ChartPie_1 = __webpack_require__(60);
329
-
330
- var placeholders_1 = __webpack_require__(10);
331
-
332
- var i18n_1 = __webpack_require__(0);
333
-
334
- var visualization_schemas_1 = __webpack_require__(2);
335
-
336
- var pick_1 = __webpack_require__(8);
337
-
338
- var variables_1 = __webpack_require__(9);
339
-
340
- var VizBehavior_1 = __webpack_require__(6);
341
-
342
- var VizCategory_1 = __webpack_require__(7);
343
-
344
- var configUtils_1 = __webpack_require__(3);
345
-
346
- var BackgroundColor_1 = __webpack_require__(12);
347
-
158
+ // src/Pie/config.ts
348
159
  var dataContract = {
349
- requiredDataSources: [{
350
- name: 'primary',
351
- description: 'DataSource that powers the visualization'
352
- }],
353
- optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
160
+ requiredDataSources: [
161
+ {
162
+ name: "primary",
163
+ description: "DataSource that powers the visualization"
164
+ }
165
+ ],
166
+ optionalDataSources: [
167
+ // Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
354
168
  // {
355
169
  // name: 'annotation',
356
170
  // description: 'DataSource that populate event annotations',
357
171
  // },
358
172
  ],
359
173
  initialRequestParams: {
360
- primary: {
361
- offset: 0,
362
- count: 10000
363
- }
174
+ primary: { offset: 0, count: 1e4 }
364
175
  }
365
176
  };
366
177
  var size = {
@@ -369,221 +180,141 @@ var size = {
369
180
  };
370
181
  var defaultContext = {};
371
182
  var themes = {
372
- defaultBackgroundColor: function defaultBackgroundColor(props) {
373
- return (0, pick_1.default)({
374
- enterprise: {
375
- dark: variables_1.default.black(props),
376
- light: variables_1.default.backgroundColor(props)
377
- },
378
- prisma: variables_1.default.backgroundColorSidebar(props)
379
- })(props);
380
- }
183
+ defaultBackgroundColor: (props) => pick_default({
184
+ enterprise: {
185
+ dark: variables_default.black(props),
186
+ light: variables_default.backgroundColor(props)
187
+ },
188
+ prisma: variables_default.backgroundColorSidebar(props)
189
+ })(props)
381
190
  };
382
- var editorConfig = [{
383
- label: (0, i18n_1._)('Data configurations'),
384
- layout: [[{
385
- label: (0, i18n_1._)('Label'),
386
- editor: 'editor.columnSelector',
387
- option: 'label',
388
- context: 'valuesContext',
389
- editorProps: {
390
- dataSourceKey: 'primary'
391
- }
392
- }], [{
393
- label: (0, i18n_1._)('Value'),
394
- editor: 'editor.columnSelector',
395
- option: 'value',
396
- context: 'valuesContext',
397
- editorProps: {
398
- dataSourceKey: 'primary'
399
- }
400
- }]]
401
- }, {
402
- label: (0, i18n_1._)('Data display'),
403
- layout: [[{
404
- label: (0, i18n_1._)('Display type'),
405
- option: 'showDonutHole',
406
- editor: 'editor.radioBar',
407
- editorProps: {
408
- values: [{
409
- label: (0, i18n_1._)('Pie'),
410
- value: false
411
- }, {
412
- label: (0, i18n_1._)('Donut'),
413
- value: true
414
- }]
415
- }
416
- }], [{
417
- label: (0, i18n_1._)('Label display'),
418
- option: 'labelDisplay',
419
- editor: 'editor.select',
420
- editorProps: {
421
- values: [{
422
- label: (0, i18n_1._)('Values'),
423
- value: 'values'
424
- }, {
425
- label: (0, i18n_1._)('Values & Percent'),
426
- value: 'valuesAndPercentage'
427
- }, {
428
- label: (0, i18n_1._)('Off'),
429
- value: 'off'
430
- }]
431
- }
432
- }], [{
433
- label: (0, i18n_1._)('Collapse threshold'),
434
- option: 'collapseThreshold',
435
- editor: 'editor.number',
436
- editorProps: {
437
- min: 0,
438
- max: 1,
439
- step: 0.01
440
- }
441
- }], [{
442
- label: (0, i18n_1._)('Exclude zeros in the collapsed slice'),
443
- option: 'collapseExcludeZero',
444
- editor: 'editor.toggle'
445
- }], [{
446
- label: (0, i18n_1._)('Collapsed slice label'),
447
- option: 'collapseLabel',
448
- editor: 'editor.text'
449
- }]]
450
- }, {
451
- label: (0, i18n_1._)('Color and style'),
452
- layout: [[{
453
- label: (0, i18n_1._)('Series colors'),
454
- option: 'seriesColors',
455
- editor: 'editor.seriesColors'
456
- }], (0, BackgroundColor_1.default)({
457
- themes: themes
458
- })]
459
- }];
460
- /**
461
- * visualization configuration
462
- */
463
-
191
+ var editorConfig = [
192
+ {
193
+ label: (0, i18n_exports._)("Data configurations"),
194
+ layout: [
195
+ [
196
+ {
197
+ label: (0, i18n_exports._)("Label"),
198
+ editor: "editor.columnSelector",
199
+ option: "label",
200
+ context: "valuesContext",
201
+ editorProps: {
202
+ dataSourceKey: "primary"
203
+ }
204
+ }
205
+ ],
206
+ [
207
+ {
208
+ label: (0, i18n_exports._)("Value"),
209
+ editor: "editor.columnSelector",
210
+ option: "value",
211
+ context: "valuesContext",
212
+ editorProps: {
213
+ dataSourceKey: "primary"
214
+ }
215
+ }
216
+ ]
217
+ ]
218
+ },
219
+ {
220
+ label: (0, i18n_exports._)("Data display"),
221
+ layout: [
222
+ [
223
+ {
224
+ label: (0, i18n_exports._)("Display type"),
225
+ option: "showDonutHole",
226
+ editor: "editor.radioBar",
227
+ editorProps: {
228
+ values: [
229
+ { label: (0, i18n_exports._)("Pie"), value: false },
230
+ { label: (0, i18n_exports._)("Donut"), value: true }
231
+ ]
232
+ }
233
+ }
234
+ ],
235
+ [
236
+ {
237
+ label: (0, i18n_exports._)("Label display"),
238
+ option: "labelDisplay",
239
+ editor: "editor.select",
240
+ editorProps: {
241
+ values: [
242
+ { label: (0, i18n_exports._)("Values"), value: "values" },
243
+ { label: (0, i18n_exports._)("Values & Percent"), value: "valuesAndPercentage" },
244
+ { label: (0, i18n_exports._)("Off"), value: "off" }
245
+ ]
246
+ }
247
+ }
248
+ ],
249
+ [
250
+ {
251
+ label: (0, i18n_exports._)("Collapse threshold"),
252
+ option: "collapseThreshold",
253
+ editor: "editor.number",
254
+ editorProps: {
255
+ min: 0,
256
+ max: 1,
257
+ step: 0.01
258
+ }
259
+ }
260
+ ],
261
+ [
262
+ {
263
+ label: (0, i18n_exports._)("Exclude zeros in the collapsed slice"),
264
+ option: "collapseExcludeZero",
265
+ editor: "editor.toggle"
266
+ }
267
+ ],
268
+ [
269
+ {
270
+ label: (0, i18n_exports._)("Collapsed slice label"),
271
+ option: "collapseLabel",
272
+ editor: "editor.text"
273
+ }
274
+ ]
275
+ ]
276
+ },
277
+ {
278
+ label: (0, i18n_exports._)("Color and style"),
279
+ layout: [
280
+ [
281
+ {
282
+ label: (0, i18n_exports._)("Series colors"),
283
+ option: "seriesColors",
284
+ editor: "editor.seriesColors"
285
+ }
286
+ ],
287
+ BackgroundColor_default({ themes })
288
+ ]
289
+ }
290
+ ];
464
291
  var config = {
465
292
  /**
466
293
  * unique viz key
467
294
  */
468
- key: 'splunk.pie',
469
-
295
+ key: "splunk.pie",
470
296
  /**
471
297
  * viz name
472
298
  */
473
- name: (0, i18n_1._)('Pie'),
474
- category: VizCategory_1.VizCategory.COMPARISONS,
475
-
299
+ name: (0, i18n_exports._)("Pie"),
300
+ category: "Comparisons" /* COMPARISONS */,
476
301
  /**
477
302
  * viz icon
478
303
  */
479
- icon: ChartPie_1.default,
480
- placeholderIcon: placeholders_1.Pie,
481
- dataContract: dataContract,
482
- size: size,
483
- defaultContext: defaultContext,
484
- optionsSchema: visualization_schemas_1.pieOptionsSchema,
485
- editorConfig: editorConfig,
304
+ icon: visualization_icons_exports.Pie,
305
+ placeholderIcon: placeholders_exports.Pie,
306
+ dataContract,
307
+ size,
308
+ defaultContext,
309
+ optionsSchema: visualization_schemas_exports.pieOptionsSchema,
310
+ editorConfig,
486
311
  events: {
487
- 'point.click': {
488
- description: 'triggered when user clicks on a point in the pie chart'
312
+ "point.click": {
313
+ description: "triggered when user clicks on a point in the pie chart"
489
314
  }
490
315
  },
491
- supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER, VizBehavior_1.VizBehavior.EVENTS],
492
- themes: themes
316
+ supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "placeholder" /* PLACEHOLDER */, "events" /* EVENTS */],
317
+ themes
493
318
  };
494
- exports.default = (0, configUtils_1.enhanceConfig)(config);
495
-
496
- /***/ }),
497
-
498
- /***/ 6:
499
- /***/ (function(module, exports, __webpack_require__) {
500
-
501
- "use strict";
502
-
503
-
504
- Object.defineProperty(exports, "__esModule", {
505
- value: true
506
- });
507
- exports.VizBehavior = void 0;
508
- var VizBehavior;
509
-
510
- (function (VizBehavior) {
511
- /**
512
- * Dynamic Options Behavior.
513
- * This allows visualization options to be powered by data
514
- *
515
- * **Example**
516
- *
517
- * sparklineValues: ">primary|seriesByIndex(0)"
518
- * would configure sparklineValues with an array of data points
519
- * coming from the first series in the primary datasource
520
- *
521
- */
522
- VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
523
- VizBehavior["EVENTS"] = "events";
524
- VizBehavior["DOWNSAMPLING"] = "downsampling";
525
- /**
526
- * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
527
- * missing.
528
- * @type {string}
529
- */
530
-
531
- VizBehavior["PLACEHOLDER"] = "placeholder";
532
- VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
533
- VizBehavior["TRELLIS"] = "trellis";
534
- })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
535
-
536
- /***/ }),
537
-
538
- /***/ 60:
539
- /***/ (function(module, exports) {
540
-
541
- module.exports = require("@splunk/react-icons/enterprise/ChartPie");
542
-
543
- /***/ }),
544
-
545
- /***/ 7:
546
- /***/ (function(module, exports, __webpack_require__) {
547
-
548
- "use strict";
549
-
550
-
551
- Object.defineProperty(exports, "__esModule", {
552
- value: true
553
- });
554
- exports.VizCategory = void 0;
555
- var VizCategory;
556
-
557
- (function (VizCategory) {
558
- VizCategory["SINGLE_VALUE"] = "Single Value";
559
- VizCategory["TRENDS"] = "Trends";
560
- VizCategory["COMPARISONS"] = "Comparisons";
561
- VizCategory["TABLE"] = "Table";
562
- VizCategory["GAUGE"] = "Gauge";
563
- VizCategory["DISTRIBUTIONS"] = "Distributions";
564
- VizCategory["CHOROPLETH"] = "Choropleth Maps";
565
- VizCategory["SHAPES"] = "Shapes";
566
- VizCategory["MISC"] = "misc";
567
- VizCategory["FLOW"] = "Flow";
568
- VizCategory["CORRELATION"] = "Correlation";
569
- VizCategory["SPATIAL"] = "Spatial";
570
- })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
571
-
572
- /***/ }),
573
-
574
- /***/ 8:
575
- /***/ (function(module, exports) {
576
-
577
- module.exports = require("@splunk/themes/pick");
578
-
579
- /***/ }),
580
-
581
- /***/ 9:
582
- /***/ (function(module, exports) {
583
-
584
- module.exports = require("@splunk/themes/variables");
585
-
586
- /***/ })
587
-
588
- /******/ });
589
- //# sourceMappingURL=Pie.config.js.map
319
+ var config_default = enhanceConfig(config);
320
+ //# sourceMappingURL=Pie.config.js.map