@splunk/visualizations 26.1.1 → 26.2.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 +2 -1
- package/Area.config.js.map +1 -1
- package/Area.js +1562 -433
- package/Area.js.map +1 -1
- package/Bar.config.js +1 -0
- package/Bar.config.js.map +1 -1
- package/Bar.js +1555 -430
- package/Bar.js.map +1 -1
- package/Bubble.config.js +1 -0
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +1580 -455
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +1 -0
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +1418 -351
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +2 -1
- package/Column.config.js.map +1 -1
- package/Column.js +1564 -435
- package/Column.js.map +1 -1
- package/Ellipse.config.js +1 -0
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +1342 -297
- package/Ellipse.js.map +1 -1
- package/Events.config.js +4 -0
- package/Events.config.js.map +1 -1
- package/Events.js +1503 -489
- package/Events.js.map +1 -1
- package/FEATUREFLAGS.md +3 -0
- package/FillerGauge.config.js +1 -0
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +1406 -345
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +1 -0
- package/Image.config.js.map +1 -1
- package/Image.js +2355 -1183
- package/Image.js.map +1 -1
- package/Line.config.js +2 -1
- package/Line.config.js.map +1 -1
- package/Line.js +1562 -433
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +1 -0
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +2013 -968
- package/LinkGraph.js.map +1 -1
- package/Map.config.js +1 -0
- package/Map.config.js.map +1 -1
- package/Map.js +2556 -1527
- package/Map.js.map +1 -1
- package/Markdown.config.js +1 -0
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +1952 -883
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +1 -0
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +4049 -2965
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +1 -0
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +3286 -2215
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +1 -0
- package/Pie.config.js.map +1 -1
- package/Pie.js +2187 -1036
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +1 -0
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +3397 -2299
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +1 -0
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +2181 -1112
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +1 -0
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +3275 -2199
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +1 -0
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +3551 -2400
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +27 -0
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +5551 -4397
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +1227 -1209
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +27 -0
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +2850 -1696
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +1 -0
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +6334 -5215
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +96 -96
- package/SparkLine.js.map +1 -1
- package/Table.config.js +172 -7
- package/Table.config.js.map +1 -1
- package/Table.js +3517 -2212
- package/Table.js.map +1 -1
- package/common/Charting.js +1009 -82
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +4 -4
- package/common/ChartingApi.js.map +1 -1
- package/common/DocExampleWithVizSandbox.js +54 -57
- package/common/DocExampleWithVizSandbox.js.map +1 -1
- package/common/EventsDoc.js +40 -40
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +15 -13
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +12 -12
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +34 -34
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +124 -103
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +49 -49
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +4 -4
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +31 -31
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +24 -8
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +4 -4
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +16 -16
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +36 -36
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +48 -47
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +832 -6
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/featureFlagUtils.js +139 -0
- package/common/utils/featureFlagUtils.js.map +1 -0
- package/common/utils/hocUtils.js +2 -2
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +2 -2
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +77 -54
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +28 -19
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +10 -10
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +6 -6
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -2
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +1313 -235
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +13 -12
- package/__mocks__/fileMock.js +0 -2
- package/__mocks__/styleMock.js +0 -2
- package/babel.config.js +0 -11
- package/jest.config.js +0 -8
- package/loki.config.js +0 -14
|
@@ -87,7 +87,7 @@ module.exports =
|
|
|
87
87
|
/******/
|
|
88
88
|
/******/
|
|
89
89
|
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 14);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ([
|
|
@@ -103,29 +103,68 @@ module.exports = require("lodash");
|
|
|
103
103
|
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
104
104
|
|
|
105
105
|
/***/ }),
|
|
106
|
-
/* 2
|
|
106
|
+
/* 2 */,
|
|
107
|
+
/* 3 */
|
|
107
108
|
/***/ (function(module, exports) {
|
|
108
109
|
|
|
109
110
|
module.exports = require("@babel/runtime/helpers/toConsumableArray");
|
|
110
111
|
|
|
111
112
|
/***/ }),
|
|
112
|
-
/* 3 */,
|
|
113
113
|
/* 4 */,
|
|
114
114
|
/* 5 */,
|
|
115
115
|
/* 6 */,
|
|
116
|
-
/* 7
|
|
116
|
+
/* 7 */
|
|
117
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
118
|
+
|
|
119
|
+
"use strict";
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
Object.defineProperty(exports, "__esModule", {
|
|
123
|
+
value: true
|
|
124
|
+
});
|
|
125
|
+
exports.VizBehavior = void 0;
|
|
126
|
+
var VizBehavior;
|
|
127
|
+
|
|
128
|
+
(function (VizBehavior) {
|
|
129
|
+
/**
|
|
130
|
+
* Dynamic Options Behavior.
|
|
131
|
+
* This allows visualization options to be powered by data
|
|
132
|
+
*
|
|
133
|
+
* **Example**
|
|
134
|
+
*
|
|
135
|
+
* sparklineValues: ">primary|seriesByIndex(0)"
|
|
136
|
+
* would configure sparklineValues with an array of data points
|
|
137
|
+
* coming from the first series in the primary datasource
|
|
138
|
+
*
|
|
139
|
+
*/
|
|
140
|
+
VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
|
|
141
|
+
VizBehavior["EVENTS"] = "events";
|
|
142
|
+
VizBehavior["DOWNSAMPLING"] = "downsampling";
|
|
143
|
+
/**
|
|
144
|
+
* Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
|
|
145
|
+
* missing.
|
|
146
|
+
* @type {string}
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
150
|
+
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
151
|
+
VizBehavior["TRELLIS"] = "trellis";
|
|
152
|
+
})(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
|
|
153
|
+
|
|
154
|
+
/***/ }),
|
|
117
155
|
/* 8 */,
|
|
118
156
|
/* 9 */,
|
|
119
157
|
/* 10 */,
|
|
120
158
|
/* 11 */,
|
|
121
159
|
/* 12 */,
|
|
122
|
-
/* 13
|
|
160
|
+
/* 13 */,
|
|
161
|
+
/* 14 */
|
|
123
162
|
/***/ (function(module, exports, __webpack_require__) {
|
|
124
163
|
|
|
125
164
|
"use strict";
|
|
126
165
|
|
|
127
166
|
|
|
128
|
-
var _toConsumableArray = __webpack_require__(
|
|
167
|
+
var _toConsumableArray = __webpack_require__(3);
|
|
129
168
|
|
|
130
169
|
var _defineProperty = __webpack_require__(1);
|
|
131
170
|
|
|
@@ -149,9 +188,9 @@ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig
|
|
|
149
188
|
|
|
150
189
|
var lodash_1 = __webpack_require__(0);
|
|
151
190
|
|
|
152
|
-
var schemaUtils_1 = __webpack_require__(
|
|
191
|
+
var schemaUtils_1 = __webpack_require__(15);
|
|
153
192
|
|
|
154
|
-
var VizBehavior_1 = __webpack_require__(
|
|
193
|
+
var VizBehavior_1 = __webpack_require__(7);
|
|
155
194
|
|
|
156
195
|
var dynamicOptionsDSLType = {
|
|
157
196
|
type: 'string',
|
|
@@ -355,49 +394,11 @@ var insertLayout = function insertLayout(layout, index) {
|
|
|
355
394
|
exports.insertLayout = insertLayout;
|
|
356
395
|
|
|
357
396
|
/***/ }),
|
|
358
|
-
/*
|
|
397
|
+
/* 15 */
|
|
359
398
|
/***/ (function(module, exports) {
|
|
360
399
|
|
|
361
400
|
module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
362
401
|
|
|
363
|
-
/***/ }),
|
|
364
|
-
/* 15 */
|
|
365
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
366
|
-
|
|
367
|
-
"use strict";
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
Object.defineProperty(exports, "__esModule", {
|
|
371
|
-
value: true
|
|
372
|
-
});
|
|
373
|
-
exports.VizBehavior = void 0;
|
|
374
|
-
var VizBehavior;
|
|
375
|
-
|
|
376
|
-
(function (VizBehavior) {
|
|
377
|
-
/**
|
|
378
|
-
* Dynamic Options Behavior.
|
|
379
|
-
* This allows visualization options to be powered by data
|
|
380
|
-
*
|
|
381
|
-
* **Example**
|
|
382
|
-
*
|
|
383
|
-
* sparklineValues: ">primary|seriesByIndex(0)"
|
|
384
|
-
* would configure sparklineValues with an array of data points
|
|
385
|
-
* coming from the first series in the primary datasource
|
|
386
|
-
*
|
|
387
|
-
*/
|
|
388
|
-
VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
|
|
389
|
-
VizBehavior["EVENTS"] = "events";
|
|
390
|
-
/**
|
|
391
|
-
* Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
|
|
392
|
-
* missing.
|
|
393
|
-
* @type {string}
|
|
394
|
-
*/
|
|
395
|
-
|
|
396
|
-
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
397
|
-
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
398
|
-
VizBehavior["TRELLIS"] = "trellis";
|
|
399
|
-
})(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
|
|
400
|
-
|
|
401
402
|
/***/ })
|
|
402
403
|
/******/ ]);
|
|
403
404
|
//# sourceMappingURL=configUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"lodash\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/toConsumableArray\"","webpack:///./src/common/utils/configUtils.ts","webpack:///external \"@splunk/visualizations-shared/schemaUtils\"","webpack:///./src/common/interfaces/VizBehavior.ts"],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFA,mC;;;;;;ACAA,kE;;;;;;ACAA,qE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;AACA;;AAGA;;AAWA,IAAM,qBAAqB,GAAG;AAC1B,MAAI,EAAE,QADoB;AAE1B,SAAO,EAAE;AAFiB,CAA9B;AAKA;;;;AAIG;;AACH,SAAS,sCAAT,CACI,aADJ,EACwD;AAEpD,MAAM,qBAAqB,GAAkB,EAA7C;AACA,QAAM,CAAC,IAAP,CAAY,aAAZ,EAA2B,OAA3B,CAAmC,UAAC,GA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ent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 13);\n","module.exports = require(\"lodash\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/toConsumableArray\");","import { get, range } from 'lodash';\nimport { DYNAMIC_OPTIONS_DSL_PATTERN } from '@splunk/visualizations-shared/schemaUtils';\nimport type { JSONSchema7Definition } from 'json-schema';\nimport { isDynamicOption } from '@splunk/visualizations-shared/configUtils';\nimport { VizBehavior } from '../interfaces/VizBehavior';\nimport { VizConfig } from '../interfaces/VizConfig';\nimport { OptionsSchema } from '../interfaces/OptionsSchema';\nimport { EditorLayoutConfig, EditorConfig } from '../interfaces/Editor';\n\nexport interface PresetEntry {\n name: string;\n value: any;\n label: string;\n}\n\nconst dynamicOptionsDSLType = {\n type: 'string',\n pattern: DYNAMIC_OPTIONS_DSL_PATTERN,\n} as const;\n\n/**\n * Helper function to extend an options schema with dynamic options DSL\n * @param optionsSchema a visualization's options schema\n * @returns an updated options schema that additionally allows strings starting with > for each option\n */\nfunction enhanceOptionsSchemaWithDynamicOptions(\n optionsSchema: OptionsSchema | JSONSchema7Definition\n): OptionsSchema {\n const enhancedOptionsSchema: OptionsSchema = {};\n Object.keys(optionsSchema).forEach((key): void => {\n const {\n // The next a few are schema annotations, we should leave them as is.\n // Note: in reality we don't use `readOnly`, `writeOnly` or `examples`, but they are listed here for completeness.\n // Ref: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01\n title,\n description,\n readOnly,\n writeOnly,\n examples,\n default: defaultValue,\n // The next a few need special care\n type,\n properties,\n patternProperties,\n // The rest should be handled together\n ...remainingSchemaEntry\n } = optionsSchema[key];\n\n const annotations = {\n ...(title !== undefined && { title }),\n ...(description !== undefined && { description }),\n ...(readOnly !== undefined && { readOnly }),\n ...(writeOnly !== undefined && { writeOnly }),\n ...(examples !== undefined && { examples }),\n ...(defaultValue !== undefined && { default: defaultValue }),\n };\n\n if (type === 'object') {\n enhancedOptionsSchema[key] = {\n ...remainingSchemaEntry,\n ...annotations,\n type,\n ...(properties && { properties: enhanceOptionsSchemaWithDynamicOptions(properties) }),\n };\n if (patternProperties) {\n let enhancedPatternProperties = {};\n Object.keys(patternProperties).forEach((opt): void => {\n enhancedPatternProperties = {\n ...enhancedPatternProperties,\n ...enhanceOptionsSchemaWithDynamicOptions({ [opt]: patternProperties[opt] }),\n };\n });\n enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;\n }\n } else {\n enhancedOptionsSchema[key] = {\n ...annotations,\n anyOf: [\n // we can't assume `type` is always there because there are `enum` and `const`.\n { ...(type !== undefined && { type }), ...remainingSchemaEntry },\n dynamicOptionsDSLType,\n ],\n };\n }\n });\n return enhancedOptionsSchema;\n}\n\n/**\n * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block\n * this function also collapse all editor panels\n * @param vizConfig a Visualization Config\n * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports\n * and containing `open: false` for all editor panels in editorConfig\n */\nfunction enhanceConfig(vizConfig: VizConfig): VizConfig {\n const enhancedConfig: VizConfig = { ...vizConfig };\n if (vizConfig.supports.indexOf(VizBehavior.DYNAMIC_OPTIONS) !== -1) {\n enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);\n }\n enhancedConfig.editorConfig = vizConfig.editorConfig.map(\n (config: EditorConfig): EditorConfig => {\n return { ...config, open: config.open || false };\n }\n );\n return enhancedConfig;\n}\n\n/**\n * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig\n * Created for editor unit tests\n * @param vizConfig a Visualization Config\n * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig\n */\nfunction uncollapseEditorConfig(vizConfig: VizConfig): VizConfig {\n const editorPanelUncollapsedConfig: VizConfig = { ...vizConfig };\n editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(\n (config: EditorConfig): EditorConfig => {\n return { ...config, open: true };\n }\n );\n return editorPanelUncollapsedConfig;\n}\n\nfunction isDynamicOption(option?: string): boolean {\n return (option && typeof option === 'string' && option.trim().startsWith('>')) || false;\n}\n\n// private helpers to improve readability of getInitialPreset\n// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset\n\n/**\n * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset\n * 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\n * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext\n * 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\n *\n * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values\n */\nfunction hasCompatibleContexts(\n vizContext: { [configKey: string]: any },\n presetContext: { [configKey: string]: any }\n): boolean {\n const presetContextKeys = Object.keys(presetContext);\n return presetContextKeys.every(\n (contextKey): boolean =>\n (presetContext[contextKey] === undefined && vizContext[contextKey] === undefined) ||\n (presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined)\n );\n}\n\n/**\n * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions\n */\nfunction hasCompatibleOptions(\n vizOptions: { [configKey: string]: any },\n presetOptions: { [configKey: string]: any }\n): boolean {\n const presetOptionKeys = Object.keys(presetOptions);\n return presetOptionKeys.every(\n (optionKey): boolean =>\n isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey])\n );\n}\n\n/**\n * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions\n * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure\n *\n * @param {Object} vizContext - the current vizContext definition\n * @param {Object} vizOptions - the current vizOptions definition\n * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset\n */\nfunction getInitialPreset(\n vizContext: { [configKey: string]: any },\n vizOptions: { [configKey: string]: any },\n presets: PresetEntry[]\n): PresetEntry | null {\n return presets.find((preset): boolean => {\n const presetContext = get(preset, ['value', 'context'], {});\n const presetOptions = get(preset, ['value', 'options'], {});\n const presetContextKeys = Object.keys(presetContext);\n const presetOptionKeys = Object.keys(presetOptions);\n\n // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)\n // if not, then the preset is invalid in config.ts\n if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;\n\n return (\n hasCompatibleContexts(vizContext, presetContext) &&\n hasCompatibleOptions(vizOptions, presetOptions)\n );\n });\n}\n\ninterface PrecisionOption {\n label: string;\n value: number;\n}\n\n/**\n * generates number precision values for a Select editor\n *\n * @param {Number} numPrecisionValues - number of integer precision values to generate\n * @returns {{ label: string; value; string }[]} array of { label, value } tuples\n */\nfunction generatePrecisionValues(numPrecisionValues: number): PrecisionOption[] {\n return range(0, numPrecisionValues + 1).map(\n (i): PrecisionOption => ({\n label: `${i} (0${i > 0 ? '.' : ''}${'0'.repeat(i)})`, // e.g. 0.000 for numPrecisionValues = 3\n value: i,\n })\n );\n}\n\nexport {\n enhanceConfig,\n enhanceOptionsSchemaWithDynamicOptions,\n getInitialPreset,\n generatePrecisionValues,\n uncollapseEditorConfig,\n isDynamicOption,\n};\n\n/**\n * insert layout in layout array, return a new layout array instead of updating the original\n *\n * @param {EditorLayoutConfig[][]} layout - editor layout\n * @param {Number} index - the index to insert layout item(s)\n * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert\n * @returns {EditorLayoutConfig[][]} new editor layout with insertion\n */\nexport const insertLayout = (\n layout: EditorLayoutConfig[][],\n index: number,\n ...layoutItems: EditorLayoutConfig[][]\n): EditorLayoutConfig[][] => [\n // copy part of the array before the specified index\n ...layout.slice(0, index),\n // inserted layout item\n ...layoutItems,\n // copy part of the array after the specified index\n ...layout.slice(index),\n];\n","module.exports = require(\"@splunk/visualizations-shared/schemaUtils\");","export enum VizBehavior {\n /**\n * Dynamic Options Behavior.\n * This allows visualization options to be powered by data\n *\n * **Example**\n *\n * sparklineValues: \">primary|seriesByIndex(0)\"\n * would configure sparklineValues with an array of data points\n * coming from the first series in the primary datasource\n *\n */\n DYNAMIC_OPTIONS = 'dynamic-options',\n EVENTS = 'events',\n /**\n * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is\n * missing.\n * @type {string}\n */\n PLACEHOLDER = 'placeholder',\n PAGE_AND_SORT = 'page-and-sort',\n TRELLIS = 'trellis',\n}\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"lodash\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/toConsumableArray\"","webpack:///./src/common/interfaces/VizBehavior.ts","webpack:///./src/common/utils/configUtils.ts","webpack:///external \"@splunk/visualizations-shared/schemaUtils\""],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAi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AAc,EAA1B,SAA+B,IAAI,MAAJ,CAAW,CAAX,CAA/B,MADgB;AAErB,WAAK,EAAE;AAFc,KAAzB;AAAA,GADG,CAAP;AAMH;;AAMG;AAKJ;;;;;;;AAOG;;AACI,IAAM,YAAY,GAAG,SAAf,YAAe,CACxB,MADwB,EAExB,KAFwB;AAAA,oCAGrB,WAHqB;AAGrB,eAHqB;AAAA;;AAAA,sCAMrB,MAAM,CAAC,KAAP,CAAa,CAAb,EAAgB,KAAhB,CANqB,GAQrB,WARqB,qBAUrB,MAAM,CAAC,KAAP,CAAa,KAAb,CAVqB;AAAA,CAArB;;AAAM,uBAAY,YAAZ,C;;;;;;ACxOb,sE","file":"configUtils.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 14);\n","module.exports = require(\"lodash\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/toConsumableArray\");","export enum VizBehavior {\n /**\n * Dynamic Options Behavior.\n * This allows visualization options to be powered by data\n *\n * **Example**\n *\n * sparklineValues: \">primary|seriesByIndex(0)\"\n * would configure sparklineValues with an array of data points\n * coming from the first series in the primary datasource\n *\n */\n DYNAMIC_OPTIONS = 'dynamic-options',\n EVENTS = 'events',\n DOWNSAMPLING = 'downsampling',\n /**\n * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is\n * missing.\n * @type {string}\n */\n PLACEHOLDER = 'placeholder',\n PAGE_AND_SORT = 'page-and-sort',\n TRELLIS = 'trellis',\n}\n","import { get, range } from 'lodash';\nimport { DYNAMIC_OPTIONS_DSL_PATTERN } from '@splunk/visualizations-shared/schemaUtils';\nimport type { JSONSchema7Definition } from 'json-schema';\nimport { isDynamicOption } from '@splunk/visualizations-shared/configUtils';\nimport { VizBehavior } from '../interfaces/VizBehavior';\nimport { VizConfig } from '../interfaces/VizConfig';\nimport { OptionsSchema } from '../interfaces/OptionsSchema';\nimport { EditorLayoutConfig, EditorConfig } from '../interfaces/Editor';\n\nexport interface PresetEntry {\n name: string;\n value: any;\n label: string;\n}\n\nconst dynamicOptionsDSLType = {\n type: 'string',\n pattern: DYNAMIC_OPTIONS_DSL_PATTERN,\n} as const;\n\n/**\n * Helper function to extend an options schema with dynamic options DSL\n * @param optionsSchema a visualization's options schema\n * @returns an updated options schema that additionally allows strings starting with > for each option\n */\nfunction enhanceOptionsSchemaWithDynamicOptions(\n optionsSchema: OptionsSchema | JSONSchema7Definition\n): OptionsSchema {\n const enhancedOptionsSchema: OptionsSchema = {};\n Object.keys(optionsSchema).forEach((key): void => {\n const {\n // The next a few are schema annotations, we should leave them as is.\n // Note: in reality we don't use `readOnly`, `writeOnly` or `examples`, but they are listed here for completeness.\n // Ref: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01\n title,\n description,\n readOnly,\n writeOnly,\n examples,\n default: defaultValue,\n // The next a few need special care\n type,\n properties,\n patternProperties,\n // The rest should be handled together\n ...remainingSchemaEntry\n } = optionsSchema[key];\n\n const annotations = {\n ...(title !== undefined && { title }),\n ...(description !== undefined && { description }),\n ...(readOnly !== undefined && { readOnly }),\n ...(writeOnly !== undefined && { writeOnly }),\n ...(examples !== undefined && { examples }),\n ...(defaultValue !== undefined && { default: defaultValue }),\n };\n\n if (type === 'object') {\n enhancedOptionsSchema[key] = {\n ...remainingSchemaEntry,\n ...annotations,\n type,\n ...(properties && { properties: enhanceOptionsSchemaWithDynamicOptions(properties) }),\n };\n if (patternProperties) {\n let enhancedPatternProperties = {};\n Object.keys(patternProperties).forEach((opt): void => {\n enhancedPatternProperties = {\n ...enhancedPatternProperties,\n ...enhanceOptionsSchemaWithDynamicOptions({ [opt]: patternProperties[opt] }),\n };\n });\n enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;\n }\n } else {\n enhancedOptionsSchema[key] = {\n ...annotations,\n anyOf: [\n // we can't assume `type` is always there because there are `enum` and `const`.\n { ...(type !== undefined && { type }), ...remainingSchemaEntry },\n dynamicOptionsDSLType,\n ],\n };\n }\n });\n return enhancedOptionsSchema;\n}\n\n/**\n * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block\n * this function also collapse all editor panels\n * @param vizConfig a Visualization Config\n * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports\n * and containing `open: false` for all editor panels in editorConfig\n */\nfunction enhanceConfig(vizConfig: VizConfig): VizConfig {\n const enhancedConfig: VizConfig = { ...vizConfig };\n if (vizConfig.supports.indexOf(VizBehavior.DYNAMIC_OPTIONS) !== -1) {\n enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);\n }\n enhancedConfig.editorConfig = vizConfig.editorConfig.map(\n (config: EditorConfig): EditorConfig => {\n return { ...config, open: config.open || false };\n }\n );\n return enhancedConfig;\n}\n\n/**\n * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig\n * Created for editor unit tests\n * @param vizConfig a Visualization Config\n * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig\n */\nfunction uncollapseEditorConfig(vizConfig: VizConfig): VizConfig {\n const editorPanelUncollapsedConfig: VizConfig = { ...vizConfig };\n editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(\n (config: EditorConfig): EditorConfig => {\n return { ...config, open: true };\n }\n );\n return editorPanelUncollapsedConfig;\n}\n\nfunction isDynamicOption(option?: string): boolean {\n return (option && typeof option === 'string' && option.trim().startsWith('>')) || false;\n}\n\n// private helpers to improve readability of getInitialPreset\n// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset\n\n/**\n * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset\n * 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\n * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext\n * 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\n *\n * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values\n */\nfunction hasCompatibleContexts(\n vizContext: { [configKey: string]: any },\n presetContext: { [configKey: string]: any }\n): boolean {\n const presetContextKeys = Object.keys(presetContext);\n return presetContextKeys.every(\n (contextKey): boolean =>\n (presetContext[contextKey] === undefined && vizContext[contextKey] === undefined) ||\n (presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined)\n );\n}\n\n/**\n * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions\n */\nfunction hasCompatibleOptions(\n vizOptions: { [configKey: string]: any },\n presetOptions: { [configKey: string]: any }\n): boolean {\n const presetOptionKeys = Object.keys(presetOptions);\n return presetOptionKeys.every(\n (optionKey): boolean =>\n isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey])\n );\n}\n\n/**\n * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions\n * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure\n *\n * @param {Object} vizContext - the current vizContext definition\n * @param {Object} vizOptions - the current vizOptions definition\n * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset\n */\nfunction getInitialPreset(\n vizContext: { [configKey: string]: any },\n vizOptions: { [configKey: string]: any },\n presets: PresetEntry[]\n): PresetEntry | null {\n return presets.find((preset): boolean => {\n const presetContext = get(preset, ['value', 'context'], {});\n const presetOptions = get(preset, ['value', 'options'], {});\n const presetContextKeys = Object.keys(presetContext);\n const presetOptionKeys = Object.keys(presetOptions);\n\n // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)\n // if not, then the preset is invalid in config.ts\n if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;\n\n return (\n hasCompatibleContexts(vizContext, presetContext) &&\n hasCompatibleOptions(vizOptions, presetOptions)\n );\n });\n}\n\ninterface PrecisionOption {\n label: string;\n value: number;\n}\n\n/**\n * generates number precision values for a Select editor\n *\n * @param {Number} numPrecisionValues - number of integer precision values to generate\n * @returns {{ label: string; value; string }[]} array of { label, value } tuples\n */\nfunction generatePrecisionValues(numPrecisionValues: number): PrecisionOption[] {\n return range(0, numPrecisionValues + 1).map(\n (i): PrecisionOption => ({\n label: `${i} (0${i > 0 ? '.' : ''}${'0'.repeat(i)})`, // e.g. 0.000 for numPrecisionValues = 3\n value: i,\n })\n );\n}\n\nexport {\n enhanceConfig,\n enhanceOptionsSchemaWithDynamicOptions,\n getInitialPreset,\n generatePrecisionValues,\n uncollapseEditorConfig,\n isDynamicOption,\n};\n\n/**\n * insert layout in layout array, return a new layout array instead of updating the original\n *\n * @param {EditorLayoutConfig[][]} layout - editor layout\n * @param {Number} index - the index to insert layout item(s)\n * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert\n * @returns {EditorLayoutConfig[][]} new editor layout with insertion\n */\nexport const insertLayout = (\n layout: EditorLayoutConfig[][],\n index: number,\n ...layoutItems: EditorLayoutConfig[][]\n): EditorLayoutConfig[][] => [\n // copy part of the array before the specified index\n ...layout.slice(0, index),\n // inserted layout item\n ...layoutItems,\n // copy part of the array after the specified index\n ...layout.slice(index),\n];\n","module.exports = require(\"@splunk/visualizations-shared/schemaUtils\");"],"sourceRoot":""}
|