@splunk/visualizations-shared 26.0.0 → 26.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/Downloader.js +63 -8
  2. package/Downloader.js.map +1 -1
  3. package/FileDownloader.js +98 -24
  4. package/FileDownloader.js.map +1 -1
  5. package/JSONSchemaUtils.js +6 -1
  6. package/JSONSchemaUtils.js.map +1 -1
  7. package/Message.js +22 -11
  8. package/Message.js.map +1 -1
  9. package/RemoteIcon.js +87 -34
  10. package/RemoteIcon.js.map +1 -1
  11. package/RemoteImage.js +45 -9
  12. package/RemoteImage.js.map +1 -1
  13. package/SanitizeProps.js +40 -15
  14. package/SanitizeProps.js.map +1 -1
  15. package/SizeAwareWrapper.js +35 -7
  16. package/SizeAwareWrapper.js.map +1 -1
  17. package/VisualizationDocPage.js +65 -19
  18. package/VisualizationDocPage.js.map +1 -1
  19. package/colorConstants.js +1 -1
  20. package/colorConstants.js.map +1 -1
  21. package/colorUtils.js +28 -15
  22. package/colorUtils.js.map +1 -1
  23. package/configUtils.js +3 -1
  24. package/configUtils.js.map +1 -1
  25. package/console.js +13 -1
  26. package/console.js.map +1 -1
  27. package/dataSourceUtils.js +11 -2
  28. package/dataSourceUtils.js.map +1 -1
  29. package/domUtils.js +1 -1
  30. package/domUtils.js.map +1 -1
  31. package/hocUtils.js +15 -1
  32. package/hocUtils.js.map +1 -1
  33. package/i18n.js +3 -1
  34. package/i18n.js.map +1 -1
  35. package/iconUtils.js +12 -13
  36. package/iconUtils.js.map +1 -1
  37. package/mapUtils.js +5 -1
  38. package/mapUtils.js.map +1 -1
  39. package/namedColors.js +3 -3
  40. package/namedColors.js.map +1 -1
  41. package/numberUtils.js +28 -18
  42. package/numberUtils.js.map +1 -1
  43. package/package.json +8 -16
  44. package/previewVizMessage.js +1 -1
  45. package/previewVizMessage.js.map +1 -1
  46. package/propUtils.js +37 -16
  47. package/propUtils.js.map +1 -1
  48. package/schemaUtils.js +11 -11
  49. package/schemaUtils.js.map +1 -1
  50. package/simpleXMLOptions.js +3 -3
  51. package/simpleXMLOptions.js.map +1 -1
  52. package/style.js +12 -7
  53. package/style.js.map +1 -1
  54. package/testHelper.js +1 -1
  55. package/testHelper.js.map +1 -1
  56. package/themeUtils.js +9 -8
  57. package/themeUtils.js.map +1 -1
  58. package/trellisUtils.js +63 -19
  59. package/trellisUtils.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/namedColors.ts"],"names":["exports","default"],"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;AACAA,OAAA,CAAAC,OAAA,GAAe,CACX,aAAa,EACb,WAAW,EACX,cAAc,EACd,MAAM,EACN,YAAY,EACZ,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,MAAM,EACN,YAAY,EACZ,OAAO,EACP,WAAW,EACX,WAAW,EACX,YAAY,EACZ,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,MAAM,EACN,UAAU,EACV,UAAU,EACV,eAAe,EACf,UAAU,EACV,W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WAAW,EACX,MAAM,EACN,aAAa,EACb,WAAW,EACX,KAAK,EACL,MAAM,EACN,SAAS,EACT,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,OAAO,EACP,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,aAAa,CAChB,C","file":"namedColors.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 = 23);\n","// Reference - https://www.w3.org/TR/css-color-4/#named-colors\nexport default [\n 'transparent',\n 'aliceblue',\n 'antiquewhite',\n 'aqua',\n 'aquamarine',\n 'azure',\n 'beige',\n 'bisque',\n 'black',\n 'blanchedalmond',\n 'blue',\n 'blueviolet',\n 'brown',\n 'burlywood',\n 'cadetblue',\n 'chartreuse',\n 'chocolate',\n 'coral',\n 'cornflowerblue',\n 'cornsilk',\n 'crimson',\n 'cyan',\n 'darkblue',\n 'darkcyan',\n 'darkgoldenrod',\n 'darkgray',\n 'darkgreen',\n 'darkgrey',\n 'darkkhaki',\n 'darkmagenta',\n 'darkolivegreen',\n 'darkorange',\n 'darkorchid',\n 'darkred',\n 'darksalmon',\n 'darkseagreen',\n 'darkslateblue',\n 'darkslategray',\n 'darkslategrey',\n 'darkturquoise',\n 'darkviolet',\n 'deeppink',\n 'deepskyblue',\n 'dimgray',\n 'dimgrey',\n 'dodgerblue',\n 'firebrick',\n 'floralwhite',\n 'forestgreen',\n 'fuchsia',\n 'gainsboro',\n 'ghostwhite',\n 'gold',\n 'goldenrod',\n 'gray',\n 'green',\n 'greenyellow',\n 'grey',\n 'honeydew',\n 'hotpink',\n 'indianred',\n 'indigo',\n 'ivory',\n 'khaki',\n 'lavender',\n 'lavenderblush',\n 'lawngreen',\n 'lemonchiffon',\n 'lightblue',\n 'lightcoral',\n 'lightcyan',\n 'lightgoldenrodyellow',\n 'lightgray',\n 'lightgreen',\n 'lightgrey',\n 'lightpink',\n 'lightsalmon',\n 'lightseagreen',\n 'lightskyblue',\n 'lightslategray',\n 'lightslategrey',\n 'lightsteelblue',\n 'lightyellow',\n 'lime',\n 'limegreen',\n 'linen',\n 'magenta',\n 'maroon',\n 'mediumaquamarine',\n 'mediumblue',\n 'mediumorchid',\n 'mediumpurple',\n 'mediumseagreen',\n 'mediumslateblue',\n 'mediumspringgreen',\n 'mediumturquoise',\n 'mediumvioletred',\n 'midnightblue',\n 'mintcream',\n 'mistyrose',\n 'moccasin',\n 'navajowhite',\n 'navy',\n 'oldlace',\n 'olive',\n 'olivedrab',\n 'orange',\n 'orangered',\n 'orchid',\n 'palegoldenrod',\n 'palegreen',\n 'paleturquoise',\n 'palevioletred',\n 'papayawhip',\n 'peachpuff',\n 'peru',\n 'pink',\n 'plum',\n 'powderblue',\n 'purple',\n 'rebeccapurple',\n 'red',\n 'rosybrown',\n 'royalblue',\n 'saddlebrown',\n 'salmon',\n 'sandybrown',\n 'seagreen',\n 'seashell',\n 'sienna',\n 'silver',\n 'skyblue',\n 'slateblue',\n 'slategray',\n 'slategrey',\n 'snow',\n 'springgreen',\n 'steelblue',\n 'tan',\n 'teal',\n 'thistle',\n 'tomato',\n 'turquoise',\n 'violet',\n 'wheat',\n 'white',\n 'whitesmoke',\n 'yellow',\n 'yellowgreen',\n];\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/namedColors.ts"],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA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/IW,EAgJX,QAhJW,EAiJX,OAjJW,EAkJX,OAlJW,EAmJX,YAnJW,EAoJX,QApJW,EAqJX,aArJW,CAAf,C","file":"namedColors.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 = 23);\n","// Reference - https://www.w3.org/TR/css-color-4/#named-colors\nexport default [\n 'transparent',\n 'aliceblue',\n 'antiquewhite',\n 'aqua',\n 'aquamarine',\n 'azure',\n 'beige',\n 'bisque',\n 'black',\n 'blanchedalmond',\n 'blue',\n 'blueviolet',\n 'brown',\n 'burlywood',\n 'cadetblue',\n 'chartreuse',\n 'chocolate',\n 'coral',\n 'cornflowerblue',\n 'cornsilk',\n 'crimson',\n 'cyan',\n 'darkblue',\n 'darkcyan',\n 'darkgoldenrod',\n 'darkgray',\n 'darkgreen',\n 'darkgrey',\n 'darkkhaki',\n 'darkmagenta',\n 'darkolivegreen',\n 'darkorange',\n 'darkorchid',\n 'darkred',\n 'darksalmon',\n 'darkseagreen',\n 'darkslateblue',\n 'darkslategray',\n 'darkslategrey',\n 'darkturquoise',\n 'darkviolet',\n 'deeppink',\n 'deepskyblue',\n 'dimgray',\n 'dimgrey',\n 'dodgerblue',\n 'firebrick',\n 'floralwhite',\n 'forestgreen',\n 'fuchsia',\n 'gainsboro',\n 'ghostwhite',\n 'gold',\n 'goldenrod',\n 'gray',\n 'green',\n 'greenyellow',\n 'grey',\n 'honeydew',\n 'hotpink',\n 'indianred',\n 'indigo',\n 'ivory',\n 'khaki',\n 'lavender',\n 'lavenderblush',\n 'lawngreen',\n 'lemonchiffon',\n 'lightblue',\n 'lightcoral',\n 'lightcyan',\n 'lightgoldenrodyellow',\n 'lightgray',\n 'lightgreen',\n 'lightgrey',\n 'lightpink',\n 'lightsalmon',\n 'lightseagreen',\n 'lightskyblue',\n 'lightslategray',\n 'lightslategrey',\n 'lightsteelblue',\n 'lightyellow',\n 'lime',\n 'limegreen',\n 'linen',\n 'magenta',\n 'maroon',\n 'mediumaquamarine',\n 'mediumblue',\n 'mediumorchid',\n 'mediumpurple',\n 'mediumseagreen',\n 'mediumslateblue',\n 'mediumspringgreen',\n 'mediumturquoise',\n 'mediumvioletred',\n 'midnightblue',\n 'mintcream',\n 'mistyrose',\n 'moccasin',\n 'navajowhite',\n 'navy',\n 'oldlace',\n 'olive',\n 'olivedrab',\n 'orange',\n 'orangered',\n 'orchid',\n 'palegoldenrod',\n 'palegreen',\n 'paleturquoise',\n 'palevioletred',\n 'papayawhip',\n 'peachpuff',\n 'peru',\n 'pink',\n 'plum',\n 'powderblue',\n 'purple',\n 'rebeccapurple',\n 'red',\n 'rosybrown',\n 'royalblue',\n 'saddlebrown',\n 'salmon',\n 'sandybrown',\n 'seagreen',\n 'seashell',\n 'sienna',\n 'silver',\n 'skyblue',\n 'slateblue',\n 'slategray',\n 'slategrey',\n 'snow',\n 'springgreen',\n 'steelblue',\n 'tan',\n 'teal',\n 'thistle',\n 'tomato',\n 'turquoise',\n 'violet',\n 'wheat',\n 'white',\n 'whitesmoke',\n 'yellow',\n 'yellowgreen',\n];\n"],"sourceRoot":""}
package/numberUtils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright © 2018 Splunk Inc.
2
+ * Copyright © 2024 Splunk Inc.
3
3
  * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
4
  * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
5
  */
@@ -133,22 +133,23 @@ __webpack_require__.r(__webpack_exports__);
133
133
 
134
134
 
135
135
 
136
+ // Todo: need break out this utils after breaking out all visualizations
136
137
 
137
-
138
- // Todo: need break out this utils after breaking out all visualizations
139
138
  /**
140
139
  * @file
141
140
  * A set of number formatting function used in Table
142
141
  */
142
+
143
143
  var DECIMAL_OR_SCIENTIFIC_REGEX = /(^[-+]?[0-9]*[.]?[0-9]*$)|(^[-+]?[0-9][.]?[0-9]*e[-+]?[0-9][0-9]*$)/i;
144
144
  var COMMA_SEPARATED_NUMBER_REGEX = /(^[-+]?([0]|([1-9][0-9]{0,2})|(([1-9][0-9]{0,2}[,])([0-9]{3}[,])*[0-9]{3}))(([.][0-9]+)?)$)/;
145
+
145
146
  function isDecimalOrExpo(str) {
146
147
  return DECIMAL_OR_SCIENTIFIC_REGEX.test(str);
147
148
  }
149
+
148
150
  function isCommaSeparatedNumber(str) {
149
151
  return COMMA_SEPARATED_NUMBER_REGEX.test(str);
150
152
  }
151
-
152
153
  /**
153
154
  * Check if a string can be considered as numeric, this includes decimal, scientific number and number with comma separator
154
155
  *
@@ -161,10 +162,11 @@ function isCommaSeparatedNumber(str) {
161
162
  * @return {Boolean}
162
163
  * @public
163
164
  */
165
+
166
+
164
167
  function isNumerialStr(str) {
165
168
  return isDecimalOrExpo(str) || isCommaSeparatedNumber(str);
166
169
  }
167
-
168
170
  /**
169
171
  * Check if a value can be considered as numeric
170
172
  *
@@ -177,30 +179,33 @@ function isNumerialStr(str) {
177
179
  * @return {Boolean}
178
180
  * @public
179
181
  */
182
+
180
183
  function isNumerial(value) {
181
184
  return Object(lodash__WEBPACK_IMPORTED_MODULE_2__["isFinite"])(value) || Object(lodash__WEBPACK_IMPORTED_MODULE_2__["isString"])(value) && isNumerialStr(value);
182
185
  }
183
-
184
186
  /**
185
187
  * Parse input value into number, return NaN for not numercial value
186
188
  * @param {*} value input value
187
189
  * @return {Number}
188
190
  * @public
189
191
  */
192
+
190
193
  function parseNumber(value) {
191
194
  if (Object(lodash__WEBPACK_IMPORTED_MODULE_2__["isFinite"])(value) || Object(lodash__WEBPACK_IMPORTED_MODULE_2__["isString"])(value) && isDecimalOrExpo(value)) {
192
195
  // only parses the value consider as numeric.
193
196
  return parseFloat(value);
194
197
  }
198
+
195
199
  if (Object(lodash__WEBPACK_IMPORTED_MODULE_2__["isString"])(value) && isCommaSeparatedNumber(value)) {
196
200
  return parseFloat(value.replace(/,/g, ''));
197
201
  }
202
+
198
203
  return NaN;
199
204
  }
200
-
201
205
  /**
202
206
  *
203
207
  */
208
+
204
209
  var getThousandSeparatorDecimalPrecisionFormatter = Object(lodash__WEBPACK_IMPORTED_MODULE_2__["memoize"])(function () {
205
210
  var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'en';
206
211
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -208,7 +213,6 @@ var getThousandSeparatorDecimalPrecisionFormatter = Object(lodash__WEBPACK_IMPOR
208
213
  }, function (locale, options) {
209
214
  return "".concat(locale).concat(JSON.stringify(options));
210
215
  });
211
-
212
216
  /**
213
217
  - * Format number into string with precision and/or grouping
214
218
  - *
@@ -227,20 +231,22 @@ var getThousandSeparatorDecimalPrecisionFormatter = Object(lodash__WEBPACK_IMPOR
227
231
  - * @return {String}
228
232
  - * @public
229
233
  - */
234
+
230
235
  function formatNumber(number, precision) {
231
236
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
232
- var formatOptions = {};
237
+ var formatOptions = {}; // Precision is optional, so check if precision is an object, and use it as the options, otherwise load from options
233
238
 
234
- // Precision is optional, so check if precision is an object, and use it as the options, otherwise load from options
235
239
  var _ref = precision && _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(precision) === 'object' ? precision : options,
236
- _ref$useThousandSepar = _ref.useThousandSeparators,
237
- useThousandSeparators = _ref$useThousandSepar === void 0 ? false : _ref$useThousandSepar,
238
- _ref$locale = _ref.locale,
239
- locale = _ref$locale === void 0 ? _splunk_moment__WEBPACK_IMPORTED_MODULE_1___default.a.locale() : _ref$locale,
240
- _ref$defaultPrecision = _ref.defaultPrecision,
241
- defaultPrecision = _ref$defaultPrecision === void 0 ? 0 : _ref$defaultPrecision,
242
- _ref$useTrendUnits = _ref.useTrendUnits,
243
- useTrendUnits = _ref$useTrendUnits === void 0 ? false : _ref$useTrendUnits; // Apply precision only when it is a positive integer
240
+ _ref$useThousandSepar = _ref.useThousandSeparators,
241
+ useThousandSeparators = _ref$useThousandSepar === void 0 ? false : _ref$useThousandSepar,
242
+ _ref$locale = _ref.locale,
243
+ locale = _ref$locale === void 0 ? _splunk_moment__WEBPACK_IMPORTED_MODULE_1___default.a.locale() : _ref$locale,
244
+ _ref$defaultPrecision = _ref.defaultPrecision,
245
+ defaultPrecision = _ref$defaultPrecision === void 0 ? 0 : _ref$defaultPrecision,
246
+ _ref$useTrendUnits = _ref.useTrendUnits,
247
+ useTrendUnits = _ref$useTrendUnits === void 0 ? false : _ref$useTrendUnits; // Apply precision only when it is a positive integer
248
+
249
+
244
250
  if (Object(lodash__WEBPACK_IMPORTED_MODULE_2__["isInteger"])(precision) && precision >= 0) {
245
251
  // Validate precision is within acceptable bounds
246
252
  var p = precision > 20 ? 20 : precision;
@@ -249,6 +255,7 @@ function formatNumber(number, precision) {
249
255
  } else {
250
256
  formatOptions.maximumFractionDigits = defaultPrecision;
251
257
  }
258
+
252
259
  formatOptions.useGrouping = useThousandSeparators === true;
253
260
  var trendUnit = '';
254
261
  var value = number;
@@ -265,10 +272,12 @@ function formatNumber(number, precision) {
265
272
  letter: 'K',
266
273
  power: 3
267
274
  }];
275
+
268
276
  if (useTrendUnits) {
269
277
  var found = units.find(function (unit) {
270
278
  return Math.abs(value) > Math.pow(10, unit.power);
271
279
  });
280
+
272
281
  if (found) {
273
282
  value /= Math.pow(10, found.power);
274
283
  trendUnit = found.letter;
@@ -276,6 +285,7 @@ function formatNumber(number, precision) {
276
285
  formatOptions.minimumFractionDigits = 0;
277
286
  }
278
287
  }
288
+
279
289
  var formatter = getThousandSeparatorDecimalPrecisionFormatter(locale, formatOptions);
280
290
  return "".concat(formatter.format(value)).concat(trendUnit ? Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_3__["_"])(trendUnit) : '');
281
291
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/moment\"","webpack:///external \"@babel/runtime/helpers/typeof\"","webpack:///external \"lodash\"","webpack:///./src/numberUtils.js","webpack:///external \"@splunk/ui-utils/i18n\""],"names":["DECIMAL_OR_SCIENTIFIC_REGEX","COMMA_SEPARATED_NUMBER_REGEX","isDecimalOrExpo","str","test","isCommaSeparatedNumber","isNumerialStr","isNumerial","value","isFinite","isString","parseNumber","parseFloat","replace","NaN","getThousandSeparatorDecimalPrecisionFormatter","memoize","locale","arguments","length","undefined","options","Intl","NumberFormat","concat","JSON","stringify","formatNumber","number","precision","formatOptions","_ref","_typeof","_ref$useThousandSepar","useThousandSeparators","_ref$locale","moment","_ref$defaultPrecision","defaultPrecision","_ref$useTrendUnits","useTrendUnits","isInteger","p","minimumFractionDigits","maximumFractionDigits","useGrouping","trendUnit","units","letter","power","found","find","unit","Math","abs","pow","formatter","format","_"],"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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AAM,EAAEa,aAAa,CAAC;EAEtF,UAAAN,MAAA,CAAUgC,SAAS,CAACC,MAAM,CAACjD,KAAK,CAAC,EAAAgB,MAAA,CAAGsB,SAAS,GAAGY,+DAAC,CAACZ,SAAS,CAAC,GAAG,EAAE;AACrE,C;;;;;;;AC5IA,kD","file":"numberUtils.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 = 58);\n","module.exports = require(\"@splunk/moment\");","module.exports = require(\"@babel/runtime/helpers/typeof\");","module.exports = require(\"lodash\");","import moment from '@splunk/moment';\nimport { isFinite, isString, isInteger, memoize } from 'lodash';\nimport { _ } from '@splunk/ui-utils/i18n';\n\n// Todo: need break out this utils after breaking out all visualizations\n/**\n * @file\n * A set of number formatting function used in Table\n */\nconst DECIMAL_OR_SCIENTIFIC_REGEX = /(^[-+]?[0-9]*[.]?[0-9]*$)|(^[-+]?[0-9][.]?[0-9]*e[-+]?[0-9][0-9]*$)/i;\nconst COMMA_SEPARATED_NUMBER_REGEX = /(^[-+]?([0]|([1-9][0-9]{0,2})|(([1-9][0-9]{0,2}[,])([0-9]{3}[,])*[0-9]{3}))(([.][0-9]+)?)$)/;\nfunction isDecimalOrExpo(str) {\n return DECIMAL_OR_SCIENTIFIC_REGEX.test(str);\n}\nfunction isCommaSeparatedNumber(str) {\n return COMMA_SEPARATED_NUMBER_REGEX.test(str);\n}\n\n/**\n * Check if a string can be considered as numeric, this includes decimal, scientific number and number with comma separator\n *\n * Examples:\n * ```js\n * const { isNumerialStr } from '@splunk/react-visualizations/utils/numberUtils';\n * assert.ok(isNumerialStr('11.123'));\n * ```\n * @param {String} str input value\n * @return {Boolean}\n * @public\n */\nexport function isNumerialStr(str) {\n return isDecimalOrExpo(str) || isCommaSeparatedNumber(str);\n}\n\n/**\n * Check if a value can be considered as numeric\n *\n * Examples:\n * ```js\n * const { isNumerial } from '@splunk/react-visualizations/utils/numberUtils';\n * assert.equal(isNumerial('11.123') == 11.123);\n * ```\n * @param {any} value input value\n * @return {Boolean}\n * @public\n */\nexport function isNumerial(value) {\n return isFinite(value) || (isString(value) && isNumerialStr(value));\n}\n\n/**\n * Parse input value into number, return NaN for not numercial value\n * @param {*} value input value\n * @return {Number}\n * @public\n */\nexport function parseNumber(value) {\n if (isFinite(value) || (isString(value) && isDecimalOrExpo(value))) {\n // only parses the value consider as numeric.\n return parseFloat(value);\n }\n if (isString(value) && isCommaSeparatedNumber(value)) {\n return parseFloat(value.replace(/,/g, ''));\n }\n return NaN;\n}\n\n/**\n *\n */\nconst getThousandSeparatorDecimalPrecisionFormatter = memoize(\n (locale = 'en', options = {}) => new Intl.NumberFormat(locale, options),\n (locale, options) => `${locale}${JSON.stringify(options)}`\n);\n\n/**\n- * Format number into string with precision and/or grouping\n- *\n- * Examples:\n- * ```js\n- * const { formatNumber } from '@splunk/react-visualizations/utils/numberUtils';\n- * assert.equal(formatNumber('1100’, 2, { useThousandSeparators: true }), '1,100.00’)\n- * ```\n- * @param {Number} number // value to format\n- * @param {Number} [precision] // number of digits after the decimal point\n- * @param {Object} [options]\n- * @param {Boolean} [options.useThousandSeparators=false] // flag to determine if grouping is desired\n- * @param {Object} [options.locale=moment.locale()] // Locale of the user for determinining how numbers are grouped\n- * @param {Number} [options.defaultPrecision=0] // The default precision to use if none is defined\n- * @param {Number} [options.useTrendUnits=false] // Add K, M, B, T to end of value, and divide by the appropriate order of magnitude\n- * @return {String}\n- * @public\n- */\nexport function formatNumber(number, precision, options = {}) {\n const formatOptions = {};\n\n // Precision is optional, so check if precision is an object, and use it as the options, otherwise load from options\n const {\n useThousandSeparators = false,\n locale = moment.locale(),\n defaultPrecision = 0,\n useTrendUnits = false,\n } = precision && typeof precision === 'object' ? precision : options;\n\n // Apply precision only when it is a positive integer\n if (isInteger(precision) && precision >= 0) {\n // Validate precision is within acceptable bounds\n const p = precision > 20 ? 20 : precision;\n\n formatOptions.minimumFractionDigits = p;\n formatOptions.maximumFractionDigits = p;\n } else {\n formatOptions.maximumFractionDigits = defaultPrecision;\n }\n\n formatOptions.useGrouping = useThousandSeparators === true;\n\n let trendUnit = '';\n let value = number;\n const units = [\n { letter: 'T', power: 12 },\n { letter: 'B', power: 9 },\n { letter: 'M', power: 6 },\n { letter: 'K', power: 3 },\n ];\n\n if (useTrendUnits) {\n const found = units.find(unit => Math.abs(value) > 10 ** unit.power);\n\n if (found) {\n value /= 10 ** found.power;\n trendUnit = found.letter;\n formatOptions.maximumFractionDigits = 2;\n formatOptions.minimumFractionDigits = 0;\n }\n }\n\n const formatter = getThousandSeparatorDecimalPrecisionFormatter(locale, formatOptions);\n\n return `${formatter.format(value)}${trendUnit ? _(trendUnit) : ''}`;\n}\n","module.exports = require(\"@splunk/ui-utils/i18n\");"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/moment\"","webpack:///external \"@babel/runtime/helpers/typeof\"","webpack:///external \"lodash\"","webpack:///./src/numberUtils.js","webpack:///external \"@splunk/ui-utils/i18n\""],"names":["DECIMAL_OR_SCIENTIFIC_REGEX","COMMA_SEPARATED_NUMBER_REGEX","isDecimalOrExpo","isCommaSeparatedNumber","isFinite","isString","isNumerialStr","parseFloat","value","getThousandSeparatorDecimalPrecisionFormatter","memoize","locale","options","Intl","JSON","formatOptions","precision","useThousandSeparators","moment","defaultPrecision","useTrendUnits","isInteger","p","trendUnit","units","letter","power","found","Math","unit","formatter","_"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QAC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ACV;AAAEC,UAAM,EAAR;AAAeC,SAAK,EAAE;AAAtB,GADU,EAEV;AAAED,UAAM,EAAR;AAAeC,SAAK,EAAE;AAAtB,GAFU,EAGV;AAAED,UAAM,EAAR;AAAeC,SAAK,EAAE;AAAtB,GAHU,EAIV;AAAED,UAAM,EAAR;AAAeC,SAAK,EAAE;AAAtB,GAJU,CAAd;;AAOA,qBAAmB;AACf,QAAMC,KAAK,GAAG,KAAK,CAAL,KAAW,gBAAI;AAAA,aAAIC,IAAI,CAAJA,0BAAwBC,IAAI,CAAhC,KAAID,CAAJ;AAA7B,KAAc,CAAd;;AAEA,eAAW;AACPpB,WAAK,iBAAUmB,KAAK,CAApBnB,KAAK,CAALA;AACAe,eAAS,GAAGI,KAAK,CAAjBJ;AACAR,mBAAa,CAAbA;AACAA,mBAAa,CAAbA;AACH;AACJ;;AAED,MAAMe,SAAS,GAAGrB,6CAA6C,SAA/D,aAA+D,CAA/D;AAEA,mBAAUqB,SAAS,CAATA,OAAV,KAAUA,CAAV,SAAoCP,SAAS,GAAGQ,+DAAC,CAAJ,SAAI,CAAJ,GAA7C;AACH,C;;;;;;;AC5ID,kD","file":"numberUtils.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 = 58);\n","module.exports = require(\"@splunk/moment\");","module.exports = require(\"@babel/runtime/helpers/typeof\");","module.exports = require(\"lodash\");","import moment from '@splunk/moment';\nimport { isFinite, isString, isInteger, memoize } from 'lodash';\nimport { _ } from '@splunk/ui-utils/i18n';\n\n// Todo: need break out this utils after breaking out all visualizations\n/**\n * @file\n * A set of number formatting function used in Table\n */\nconst DECIMAL_OR_SCIENTIFIC_REGEX = /(^[-+]?[0-9]*[.]?[0-9]*$)|(^[-+]?[0-9][.]?[0-9]*e[-+]?[0-9][0-9]*$)/i;\nconst COMMA_SEPARATED_NUMBER_REGEX = /(^[-+]?([0]|([1-9][0-9]{0,2})|(([1-9][0-9]{0,2}[,])([0-9]{3}[,])*[0-9]{3}))(([.][0-9]+)?)$)/;\nfunction isDecimalOrExpo(str) {\n return DECIMAL_OR_SCIENTIFIC_REGEX.test(str);\n}\nfunction isCommaSeparatedNumber(str) {\n return COMMA_SEPARATED_NUMBER_REGEX.test(str);\n}\n\n/**\n * Check if a string can be considered as numeric, this includes decimal, scientific number and number with comma separator\n *\n * Examples:\n * ```js\n * const { isNumerialStr } from '@splunk/react-visualizations/utils/numberUtils';\n * assert.ok(isNumerialStr('11.123'));\n * ```\n * @param {String} str input value\n * @return {Boolean}\n * @public\n */\nexport function isNumerialStr(str) {\n return isDecimalOrExpo(str) || isCommaSeparatedNumber(str);\n}\n\n/**\n * Check if a value can be considered as numeric\n *\n * Examples:\n * ```js\n * const { isNumerial } from '@splunk/react-visualizations/utils/numberUtils';\n * assert.equal(isNumerial('11.123') == 11.123);\n * ```\n * @param {any} value input value\n * @return {Boolean}\n * @public\n */\nexport function isNumerial(value) {\n return isFinite(value) || (isString(value) && isNumerialStr(value));\n}\n\n/**\n * Parse input value into number, return NaN for not numercial value\n * @param {*} value input value\n * @return {Number}\n * @public\n */\nexport function parseNumber(value) {\n if (isFinite(value) || (isString(value) && isDecimalOrExpo(value))) {\n // only parses the value consider as numeric.\n return parseFloat(value);\n }\n if (isString(value) && isCommaSeparatedNumber(value)) {\n return parseFloat(value.replace(/,/g, ''));\n }\n return NaN;\n}\n\n/**\n *\n */\nconst getThousandSeparatorDecimalPrecisionFormatter = memoize(\n (locale = 'en', options = {}) => new Intl.NumberFormat(locale, options),\n (locale, options) => `${locale}${JSON.stringify(options)}`\n);\n\n/**\n- * Format number into string with precision and/or grouping\n- *\n- * Examples:\n- * ```js\n- * const { formatNumber } from '@splunk/react-visualizations/utils/numberUtils';\n- * assert.equal(formatNumber('1100’, 2, { useThousandSeparators: true }), '1,100.00’)\n- * ```\n- * @param {Number} number // value to format\n- * @param {Number} [precision] // number of digits after the decimal point\n- * @param {Object} [options]\n- * @param {Boolean} [options.useThousandSeparators=false] // flag to determine if grouping is desired\n- * @param {Object} [options.locale=moment.locale()] // Locale of the user for determinining how numbers are grouped\n- * @param {Number} [options.defaultPrecision=0] // The default precision to use if none is defined\n- * @param {Number} [options.useTrendUnits=false] // Add K, M, B, T to end of value, and divide by the appropriate order of magnitude\n- * @return {String}\n- * @public\n- */\nexport function formatNumber(number, precision, options = {}) {\n const formatOptions = {};\n\n // Precision is optional, so check if precision is an object, and use it as the options, otherwise load from options\n const {\n useThousandSeparators = false,\n locale = moment.locale(),\n defaultPrecision = 0,\n useTrendUnits = false,\n } = precision && typeof precision === 'object' ? precision : options;\n\n // Apply precision only when it is a positive integer\n if (isInteger(precision) && precision >= 0) {\n // Validate precision is within acceptable bounds\n const p = precision > 20 ? 20 : precision;\n\n formatOptions.minimumFractionDigits = p;\n formatOptions.maximumFractionDigits = p;\n } else {\n formatOptions.maximumFractionDigits = defaultPrecision;\n }\n\n formatOptions.useGrouping = useThousandSeparators === true;\n\n let trendUnit = '';\n let value = number;\n const units = [\n { letter: 'T', power: 12 },\n { letter: 'B', power: 9 },\n { letter: 'M', power: 6 },\n { letter: 'K', power: 3 },\n ];\n\n if (useTrendUnits) {\n const found = units.find(unit => Math.abs(value) > 10 ** unit.power);\n\n if (found) {\n value /= 10 ** found.power;\n trendUnit = found.letter;\n formatOptions.maximumFractionDigits = 2;\n formatOptions.minimumFractionDigits = 0;\n }\n }\n\n const formatter = getThousandSeparatorDecimalPrecisionFormatter(locale, formatOptions);\n\n return `${formatter.format(value)}${trendUnit ? _(trendUnit) : ''}`;\n}\n","module.exports = require(\"@splunk/ui-utils/i18n\");"],"sourceRoot":""}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Visualizations Shared Files",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "author": "Splunk",
6
- "version": "26.0.0",
6
+ "version": "26.1.1",
7
7
  "scripts": {
8
8
  "build": "export NODE_OPTIONS=--openssl-legacy-provider && NODE_ENV=production webpack --config ./webpack.config.js --bail",
9
9
  "build-storybook": "export NODE_OPTIONS=--openssl-legacy-provider && build-storybook -c .storybook -s fonts -o .storybook-bundle",
@@ -30,7 +30,7 @@
30
30
  "@splunk/moment": "^0.6.1",
31
31
  "@splunk/react-icons": "^4.0.1",
32
32
  "@splunk/react-ui": "^4.17.1",
33
- "@splunk/themes": "^0.16.1",
33
+ "@splunk/themes": "^0.19.0",
34
34
  "@splunk/ui-utils": "^1.2.1",
35
35
  "element-resize-detector": "^1.1.14",
36
36
  "lodash": "^4.17.21",
@@ -45,26 +45,18 @@
45
45
  "devDependencies": {
46
46
  "@babel/cli": "^7.13.0",
47
47
  "@babel/core": "^7.13.0",
48
- "@splunk/react-docs": "^0.11.0",
49
- "@splunk/visualization-build-tools": "^26.0.0",
50
- "@splunk/visualization-context": "^26.0.0",
51
- "@storybook/addon-actions": "^6.1.20",
52
- "@storybook/addons": "^6.1.20",
53
- "@storybook/react": "^6.1.20",
48
+ "@splunk/react-docs": "1.0.0-beta.16",
49
+ "@splunk/visualization-build-tools": "^26.1.1",
50
+ "@splunk/visualization-context": "^26.1.1",
51
+ "@storybook/addon-actions": "^6.4.0",
52
+ "@storybook/addons": "^6.4.0",
53
+ "@storybook/react": "^6.4.0",
54
54
  "ajv": "^6.5.4",
55
- "babel-jest": "^26.0.0",
56
- "jest": "^26.0.0",
57
- "jest-canvas-mock": "^2.2.0",
58
- "jest-junit": "^12.0.0",
59
- "jest-styled-components": "^7.0.3",
60
- "loki": "^0.34.0",
61
55
  "raf": "^3.4.0",
62
56
  "react": "^16.13.1",
63
57
  "react-dom": "^16.13.1",
64
58
  "styled-components": "^5.3.10",
65
59
  "text-encoding": "^0.7.0",
66
- "ts-jest": "^26.0.0",
67
- "typescript": "^4.1.2",
68
60
  "webpack": "^4.29.6",
69
61
  "webpack-merge": "^4.2.1"
70
62
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright © 2018 Splunk Inc.
2
+ * Copyright © 2024 Splunk Inc.
3
3
  * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
4
  * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/previewVizMessage.ts"],"names":["previewVizMessage","exports","default"],"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,IAAMA,iBAAiB,GACnB,wGAAwG;AAE5GC,OAAA,CAAAC,OAAA,GAAeF,iBAAiB,C","file":"previewVizMessage.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 = 59);\n","const previewVizMessage =\n '⚠️ This is a preview of a new visualization component. Minor updates and bug fixes should be expected.';\n\nexport default previewVizMessage;\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/previewVizMessage.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,IAAM,iBAAiB,GACnB,wGADJ;AAGA,kBAAe,iBAAf,C","file":"previewVizMessage.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 = 59);\n","const previewVizMessage =\n '⚠️ This is a preview of a new visualization component. Minor updates and bug fixes should be expected.';\n\nexport default previewVizMessage;\n"],"sourceRoot":""}
package/propUtils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright © 2018 Splunk Inc.
2
+ * Copyright © 2024 Splunk Inc.
3
3
  * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
4
  * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
5
  */
@@ -107,10 +107,10 @@ __webpack_require__.r(__webpack_exports__);
107
107
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertPropsToString", function() { return convertPropsToString; });
108
108
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatColor", function() { return formatColor; });
109
109
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertToSCProperties", function() { return convertToSCProperties; });
110
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "adjustOptionsToSchema", function() { return adjustOptionsToSchema; });
110
111
  /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
111
112
  /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
112
113
 
113
-
114
114
  /**
115
115
  * convert props of type 'array/object' to 'string', based on the list of props to be converted in vizProps
116
116
  * @method convertPropsToString
@@ -118,14 +118,16 @@ __webpack_require__.r(__webpack_exports__);
118
118
  * @param {Array} propNames
119
119
  * @return {Object} convertedVizProps
120
120
  */
121
+
121
122
  var convertPropsToString = function convertPropsToString(_ref) {
122
123
  var _ref$vizProps = _ref.vizProps,
123
- vizProps = _ref$vizProps === void 0 ? {} : _ref$vizProps,
124
- _ref$propNames = _ref.propNames,
125
- propNames = _ref$propNames === void 0 ? [] : _ref$propNames;
124
+ vizProps = _ref$vizProps === void 0 ? {} : _ref$vizProps,
125
+ _ref$propNames = _ref.propNames,
126
+ propNames = _ref$propNames === void 0 ? [] : _ref$propNames;
126
127
  var convertedVizProps = {};
127
128
  propNames.forEach(function (propName) {
128
129
  var propValue = vizProps[propName];
130
+
129
131
  if (Array.isArray(propValue) || Object(lodash__WEBPACK_IMPORTED_MODULE_0__["isPlainObject"])(propValue)) {
130
132
  convertedVizProps[propName] = JSON.stringify(propValue);
131
133
  } else if (propValue && typeof propValue === 'string') {
@@ -135,20 +137,20 @@ var convertPropsToString = function convertPropsToString(_ref) {
135
137
  });
136
138
  return convertedVizProps;
137
139
  };
138
-
139
140
  /**
140
141
  * Convert a hex value to a color
141
142
  * @method formatColor
142
143
  * @param {String} color
143
144
  * @returns {String}
144
145
  */
146
+
145
147
  var formatColor = function formatColor(color) {
146
148
  if (!color || typeof color !== 'string') {
147
149
  return '';
148
150
  }
151
+
149
152
  return color.replace('0x', '#');
150
153
  };
151
-
152
154
  /**
153
155
  * Helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
154
156
  * This is for options that has new key name and can not directly be mapped with SimpleXML or
@@ -160,46 +162,48 @@ var formatColor = function formatColor(color) {
160
162
  * @param {Array} stringValues
161
163
  * @returns {Object}
162
164
  */
165
+
163
166
  var convertToSCProperties = function convertToSCProperties(originalOptions, optionsSCMapping, optionValuesSCMapping, stringValues) {
164
167
  var returnOptions = {};
165
168
  var y2Fields = originalOptions.y2Fields,
166
- overlayFields = originalOptions.overlayFields; // mapToOldKey
169
+ overlayFields = originalOptions.overlayFields; // mapToOldKey
170
+
167
171
  Object.keys(originalOptions).forEach(function (key) {
168
172
  var newKey = optionsSCMapping[key] ? optionsSCMapping[key] : key;
169
173
  returnOptions[newKey] = originalOptions[key];
170
- });
174
+ }); // mapToValues
171
175
 
172
- // mapToValues
173
176
  Object.keys(optionValuesSCMapping).forEach(function (key) {
174
177
  if (Object(lodash__WEBPACK_IMPORTED_MODULE_0__["has"])(returnOptions, key)) {
175
178
  var updatedValue = optionValuesSCMapping[key][returnOptions[key]];
179
+
176
180
  if (!Object(lodash__WEBPACK_IMPORTED_MODULE_0__["isUndefined"])(updatedValue)) {
177
181
  returnOptions[key] = updatedValue;
178
182
  }
179
183
  }
180
- });
184
+ }); // convertY2AxisOptions
181
185
 
182
- // convertY2AxisOptions
183
186
  if (y2Fields) {
184
187
  delete returnOptions.y2Fields;
185
188
  returnOptions['axisY2.enabled'] = true;
186
189
  returnOptions['axisY2.fields'] = Array.isArray(y2Fields) ? y2Fields.filter(function (name) {
187
190
  return name;
188
191
  }).join(',') : y2Fields;
189
- }
192
+ } // convertOverlayFields
193
+
190
194
 
191
- // convertOverlayFields
192
195
  if (overlayFields) {
193
196
  returnOptions.overlayFields = Array.isArray(overlayFields) ? overlayFields.filter(function (field) {
194
197
  return field;
195
198
  }).map(function (field) {
196
199
  return field.trim();
197
200
  }).join(',') : overlayFields;
198
- }
201
+ } // convertToStringValues
202
+
199
203
 
200
- // convertToStringValues
201
204
  stringValues.forEach(function (propName) {
202
205
  var propValue = returnOptions[propName];
206
+
203
207
  if (Array.isArray(propValue) || Object(lodash__WEBPACK_IMPORTED_MODULE_0__["isPlainObject"])(propValue)) {
204
208
  returnOptions[propName] = JSON.stringify(propValue);
205
209
  } else if (propValue && typeof propValue === 'string') {
@@ -209,6 +213,23 @@ var convertToSCProperties = function convertToSCProperties(originalOptions, opti
209
213
  });
210
214
  return returnOptions;
211
215
  };
216
+ /**
217
+ * Helper for removing the option properties (and values) that are not part of schema
218
+ * @method adjustOptionsToSchema
219
+ * @param {Object} originalOptions
220
+ * @param {Object} optionsSchema
221
+ * @returns {Object}
222
+ */
223
+
224
+ var adjustOptionsToSchema = function adjustOptionsToSchema(originalOptions, optionsSchema) {
225
+ var returnOptions = {};
226
+ Object.keys(optionsSchema).forEach(function (key) {
227
+ if (Object.hasOwn(originalOptions, key)) {
228
+ returnOptions[key] = originalOptions[key];
229
+ }
230
+ });
231
+ return returnOptions;
232
+ };
212
233
 
213
234
  /***/ })
214
235
 
package/propUtils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"lodash\"","webpack:///./src/propUtils.js"],"names":["convertPropsToString","_ref","_ref$vizProps","vizProps","_ref$propNames","propNames","convertedVizProps","forEach","propName","propValue","Array","isArray","isPlainObject","JSON","stringify","console","warn","concat","formatColor","color","replace","convertToSCProperties","originalOptions","optionsSCMapping","optionValuesSCMapping","stringValues","returnOptions","y2Fields","overlayFields","Object","keys","key","newKey","has","updatedValue","isUndefined","filter","name","join","field","map","trim"],"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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAyD;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAAC,IAAA,EAA0C;EAAA,IAAAC,aAAA,GAAAD,IAAA,CAApCE,QAAQ;IAARA,QAAQ,GAAAD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AAO,CAAC,UAAAC,QAAQ,EAAI;IAC7B,IAAMC,SAAS,GAAGiB,aAAa,CAAClB,QAAQ,CAAC;IACzC,IAAIE,KAAK,CAACC,OAAO,CAACF,SAAS,CAAC,IAAIG,4DAAa,CAACH,SAAS,CAAC,EAAE;MACtDiB,aAAa,CAAClB,QAAQ,CAAC,GAAGK,IAAI,CAACC,SAAS,CAACL,SAAS,CAAC;IACvD,CAAC,MAAM,IAAIA,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;MACnD;MACAM,OAAO,CAACC,IAAI,kCAAAC,MAAA,CAAkCT,QAAQ,4BAAyB;IACnF;EACJ,CAAC,CAAC;EACF,OAAOkB,aAAa;AACxB,CAAC,C","file":"propUtils.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 = 60);\n","module.exports = require(\"lodash\");","import { isPlainObject, has, isUndefined } from 'lodash';\n\n/**\n * convert props of type 'array/object' to 'string', based on the list of props to be converted in vizProps\n * @method convertPropsToString\n * @param {Object} vizProps\n * @param {Array} propNames\n * @return {Object} convertedVizProps\n */\nexport const convertPropsToString = ({ vizProps = {}, propNames = [] }) => {\n const convertedVizProps = {};\n\n propNames.forEach(propName => {\n const propValue = vizProps[propName];\n if (Array.isArray(propValue) || isPlainObject(propValue)) {\n convertedVizProps[propName] = JSON.stringify(propValue);\n } else if (propValue && typeof propValue === 'string') {\n // eslint-disable-next-line no-console\n console.warn(`The option type 'string' for '${propName}' has been deprecated.`);\n }\n });\n\n return convertedVizProps;\n};\n\n/**\n * Convert a hex value to a color\n * @method formatColor\n * @param {String} color\n * @returns {String}\n */\nexport const formatColor = color => {\n if (!color || typeof color !== 'string') {\n return '';\n }\n\n return color.replace('0x', '#');\n};\n\n/**\n * Helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts\n * This is for options that has new key name and can not directly be mapped with SimpleXML or\n * don't have a 1-1 mapping in SimpleXML (i.e. a straightforward name mapping where values are preserved)\n * @method convertToAreaSCProperties\n * @param {Object} originalOptions\n * @param {Object} optionsSCMapping\n * @param {Object} optionValuesSCMapping\n * @param {Array} stringValues\n * @returns {Object}\n */\nexport const convertToSCProperties = (\n originalOptions,\n optionsSCMapping,\n optionValuesSCMapping,\n stringValues\n) => {\n const returnOptions = {};\n const { y2Fields, overlayFields } = originalOptions;\n\n // mapToOldKey\n Object.keys(originalOptions).forEach(key => {\n const newKey = optionsSCMapping[key] ? optionsSCMapping[key] : key;\n returnOptions[newKey] = originalOptions[key];\n });\n\n // mapToValues\n Object.keys(optionValuesSCMapping).forEach(key => {\n if (has(returnOptions, key)) {\n const updatedValue = optionValuesSCMapping[key][returnOptions[key]];\n if (!isUndefined(updatedValue)) {\n returnOptions[key] = updatedValue;\n }\n }\n });\n\n // convertY2AxisOptions\n if (y2Fields) {\n delete returnOptions.y2Fields;\n returnOptions['axisY2.enabled'] = true;\n returnOptions['axisY2.fields'] = Array.isArray(y2Fields)\n ? y2Fields.filter(name => name).join(',')\n : y2Fields;\n }\n\n // convertOverlayFields\n if (overlayFields) {\n returnOptions.overlayFields = Array.isArray(overlayFields)\n ? overlayFields\n .filter(field => field)\n .map(field => field.trim())\n .join(',')\n : overlayFields;\n }\n\n // convertToStringValues\n stringValues.forEach(propName => {\n const propValue = returnOptions[propName];\n if (Array.isArray(propValue) || isPlainObject(propValue)) {\n returnOptions[propName] = JSON.stringify(propValue);\n } else if (propValue && typeof propValue === 'string') {\n // eslint-disable-next-line no-console\n console.warn(`The option type 'string' for '${propName}' has been deprecated.`);\n }\n });\n return returnOptions;\n};\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"lodash\"","webpack:///./src/propUtils.js"],"names":["convertPropsToString","vizProps","propNames","convertedVizProps","propValue","Array","isPlainObject","JSON","console","formatColor","color","convertToSCProperties","returnOptions","y2Fields","originalOptions","overlayFields","Object","newKey","optionsSCMapping","has","updatedValue","optionValuesSCMapping","isUndefined","field","stringValues","adjustOptionsToSchema"],"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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAuB,OAAuC;AAAA,2BAApCC,QAAoC;AAAA,MAApCA,QAAoC,8BAAzB,EAAyB;AAAA,4BAArBC,SAAqB;AAAA,MAArBA,SAAqB,+BAAT,EAAS;AACvE,MAAMC,iBAAiB,GAAvB;AAEAD,WAAS,CAATA,QAAkB,oBAAY;AAC1B,QAAME,SAAS,GAAGH,QAAQ,CAA1B,QAA0B,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iBAAa,CAAbA,gBAAa,CAAbA;AACAA,iBAAa,CAAbA,eAAa,CAAbA,GAAiC,KAAK,CAAL,oBAC3B,QAAQ,CAAR,OAAgB,gBAAI;AAAA;AAApB,YAD2B,GAC3B,CAD2B,GAAjCA;AAxBH,IA6BD;;;AACA,qBAAmB;AACfA,iBAAa,CAAbA,gBAA8B,KAAK,CAAL,yBACxB,aAAa,CAAb,OACY,iBAAK;AAAA;AADjB,WAES,iBAAK;AAAA,aAAIW,KAAK,CAAT,IAAIA,EAAJ;AAFd,YADwB,GACxB,CADwB,GAA9BX;AA/BH,IAuCD;;;AACAY,cAAY,CAAZA,QAAqB,oBAAY;AAC7B,QAAMpB,SAAS,GAAGQ,aAAa,CAA/B,QAA+B,CAA/B;;AACA,QAAIP,KAAK,CAALA,sBAA4BC,4DAAa,CAA7C,SAA6C,CAA7C,EAA0D;AACtDM,mBAAa,CAAbA,QAAa,CAAbA,GAA0BL,IAAI,CAAJA,UAA1BK,SAA0BL,CAA1BK;AADJ,WAEO,IAAIR,SAAS,IAAI,qBAAjB,UAAgD;AACnD;AACAI,aAAO,CAAPA;AACH;AAPLgB;AASA;AAtDG;AAyDP;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAwB,iCAAoC;AACrE,MAAMb,aAAa,GAAnB;AACAI,QAAM,CAANA,4BAAmC,eAAO;AACtC,QAAIA,MAAM,CAANA,wBAAJ,GAAIA,CAAJ,EAAyC;AACrCJ,mBAAa,CAAbA,GAAa,CAAbA,GAAqBE,eAAe,CAApCF,GAAoC,CAApCA;AACH;AAHLI;AAKA;AAPG,E","file":"propUtils.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 = 60);\n","module.exports = require(\"lodash\");","import { isPlainObject, has, isUndefined } from 'lodash';\n\n/**\n * convert props of type 'array/object' to 'string', based on the list of props to be converted in vizProps\n * @method convertPropsToString\n * @param {Object} vizProps\n * @param {Array} propNames\n * @return {Object} convertedVizProps\n */\nexport const convertPropsToString = ({ vizProps = {}, propNames = [] }) => {\n const convertedVizProps = {};\n\n propNames.forEach(propName => {\n const propValue = vizProps[propName];\n if (Array.isArray(propValue) || isPlainObject(propValue)) {\n convertedVizProps[propName] = JSON.stringify(propValue);\n } else if (propValue && typeof propValue === 'string') {\n // eslint-disable-next-line no-console\n console.warn(`The option type 'string' for '${propName}' has been deprecated.`);\n }\n });\n\n return convertedVizProps;\n};\n\n/**\n * Convert a hex value to a color\n * @method formatColor\n * @param {String} color\n * @returns {String}\n */\nexport const formatColor = color => {\n if (!color || typeof color !== 'string') {\n return '';\n }\n\n return color.replace('0x', '#');\n};\n\n/**\n * Helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts\n * This is for options that has new key name and can not directly be mapped with SimpleXML or\n * don't have a 1-1 mapping in SimpleXML (i.e. a straightforward name mapping where values are preserved)\n * @method convertToAreaSCProperties\n * @param {Object} originalOptions\n * @param {Object} optionsSCMapping\n * @param {Object} optionValuesSCMapping\n * @param {Array} stringValues\n * @returns {Object}\n */\nexport const convertToSCProperties = (\n originalOptions,\n optionsSCMapping,\n optionValuesSCMapping,\n stringValues\n) => {\n const returnOptions = {};\n const { y2Fields, overlayFields } = originalOptions;\n\n // mapToOldKey\n Object.keys(originalOptions).forEach(key => {\n const newKey = optionsSCMapping[key] ? optionsSCMapping[key] : key;\n returnOptions[newKey] = originalOptions[key];\n });\n\n // mapToValues\n Object.keys(optionValuesSCMapping).forEach(key => {\n if (has(returnOptions, key)) {\n const updatedValue = optionValuesSCMapping[key][returnOptions[key]];\n if (!isUndefined(updatedValue)) {\n returnOptions[key] = updatedValue;\n }\n }\n });\n\n // convertY2AxisOptions\n if (y2Fields) {\n delete returnOptions.y2Fields;\n returnOptions['axisY2.enabled'] = true;\n returnOptions['axisY2.fields'] = Array.isArray(y2Fields)\n ? y2Fields.filter(name => name).join(',')\n : y2Fields;\n }\n\n // convertOverlayFields\n if (overlayFields) {\n returnOptions.overlayFields = Array.isArray(overlayFields)\n ? overlayFields\n .filter(field => field)\n .map(field => field.trim())\n .join(',')\n : overlayFields;\n }\n\n // convertToStringValues\n stringValues.forEach(propName => {\n const propValue = returnOptions[propName];\n if (Array.isArray(propValue) || isPlainObject(propValue)) {\n returnOptions[propName] = JSON.stringify(propValue);\n } else if (propValue && typeof propValue === 'string') {\n // eslint-disable-next-line no-console\n console.warn(`The option type 'string' for '${propName}' has been deprecated.`);\n }\n });\n return returnOptions;\n};\n\n/**\n * Helper for removing the option properties (and values) that are not part of schema\n * @method adjustOptionsToSchema\n * @param {Object} originalOptions\n * @param {Object} optionsSchema\n * @returns {Object}\n */\nexport const adjustOptionsToSchema = (originalOptions, optionsSchema) => {\n const returnOptions = {};\n Object.keys(optionsSchema).forEach(key => {\n if (Object.hasOwn(originalOptions, key)) {\n returnOptions[key] = originalOptions[key];\n }\n });\n return returnOptions;\n};\n"],"sourceRoot":""}
package/schemaUtils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright © 2018 Splunk Inc.
2
+ * Copyright © 2024 Splunk Inc.
3
3
  * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
4
  * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
5
  */
@@ -334,32 +334,32 @@ var createTestSchema = function createTestSchema(optionsSchema) {
334
334
  type: 'object',
335
335
  properties: optionsSchema
336
336
  };
337
- };
337
+ }; // Below 2 regexs are copied from dashboard-framework/packages/dashboard-utils/src/token.jsc
338
338
 
339
- // Below 2 regexs are copied from dashboard-framework/packages/dashboard-utils/src/token.jsc
340
- var TOKEN_NAMESPACE_PREFIX_PATTERN = /(\w+:)?/.source;
341
- // ex: token.name|suh (old-style filter chain)
339
+ var TOKEN_NAMESPACE_PREFIX_PATTERN = /(\w+:)?/.source; // ex: token.name|suh (old-style filter chain)
342
340
  // ex: token.name|lower|capitalize (new-style filter chain)
341
+
343
342
  var TOKEN_NAME_CHARS_PATTERN = /([^$|:]+?)(\|[|\w]+)?/.source;
344
- var TOKEN_PATTERN = /\$/.source + TOKEN_NAMESPACE_PREFIX_PATTERN + TOKEN_NAME_CHARS_PATTERN + /\$/.source;
345
- // rgb and rgba regexes were derived from:
343
+ var TOKEN_PATTERN = /\$/.source + TOKEN_NAMESPACE_PREFIX_PATTERN + TOKEN_NAME_CHARS_PATTERN + /\$/.source; // rgb and rgba regexes were derived from:
346
344
  // https://stackoverflow.com/questions/9585973/javascript-regular-expression-for-rgb-values/9586150
347
345
  // https://github.com/regexhq/rgba-regex
348
346
  // NOTE: this will incorrectly accept values like rgb(999,999,999), but may be overkill to specify a regex that limits values to <= 255
347
+
349
348
  var rgbColorPattern = /^rgb\(\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/;
350
- var rgbaColorPattern = /^rgba\(\s*(\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d*(?:\.\d+)?)\)$/;
351
- // todo: rename this to COLOR_PATTERN and replace all occurences.
349
+ var rgbaColorPattern = /^rgba\(\s*(\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d*(?:\.\d+)?)\)$/; // todo: rename this to COLOR_PATTERN and replace all occurences.
350
+
352
351
  var colorPattern = '^#[0-9a-fA-F]{6}$|transparent';
353
352
  var colorPatternWithRGBA = "".concat(colorPattern, "|").concat(rgbColorPattern.source, "|").concat(rgbaColorPattern.source);
354
353
  var COLOR_OR_TOKEN_PATTERN = "".concat(colorPattern, "|").concat(TOKEN_PATTERN);
355
- var COLOR_OR_TOKEN_PATTERN_WITH_RGBA = "".concat(colorPatternWithRGBA, "|").concat(TOKEN_PATTERN);
356
- // dynamic option DSL expressions always start with a >
354
+ var COLOR_OR_TOKEN_PATTERN_WITH_RGBA = "".concat(colorPatternWithRGBA, "|").concat(TOKEN_PATTERN); // dynamic option DSL expressions always start with a >
355
+
357
356
  var DYNAMIC_OPTIONS_DSL_PATTERN = /^>.*/.source;
358
357
  /**
359
358
  * Returns the regex string that matches each passed in value as well as tokens.
360
359
  * @param {Array.<string>} values
361
360
  * @returns {string}
362
361
  */
362
+
363
363
  var getPattern = function getPattern(values) {
364
364
  return values.reduce(function (accumulator, value) {
365
365
  return "".concat(accumulator, "|^").concat(value, "$");