@splunk/visualizations-shared 25.13.1 → 26.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/Downloader.js +66 -11
  2. package/Downloader.js.map +1 -1
  3. package/FileDownloader.js +105 -31
  4. package/FileDownloader.js.map +1 -1
  5. package/JSONSchemaUtils.js +13 -8
  6. package/JSONSchemaUtils.js.map +1 -1
  7. package/Message.js +23 -12
  8. package/Message.js.map +1 -1
  9. package/RemoteIcon.js +93 -41
  10. package/RemoteIcon.js.map +1 -1
  11. package/RemoteImage.js +51 -16
  12. package/RemoteImage.js.map +1 -1
  13. package/SanitizeProps.js +50 -25
  14. package/SanitizeProps.js.map +1 -1
  15. package/SizeAwareWrapper.js +47 -19
  16. package/SizeAwareWrapper.js.map +1 -1
  17. package/VisualizationDocPage.js +72 -26
  18. package/VisualizationDocPage.js.map +1 -1
  19. package/colorConstants.js +2 -2
  20. package/colorConstants.js.map +1 -1
  21. package/colorUtils.js +27 -14
  22. package/colorUtils.js.map +1 -1
  23. package/configUtils.js +4 -2
  24. package/configUtils.js.map +1 -1
  25. package/console.js +14 -2
  26. package/console.js.map +1 -1
  27. package/dataSourceUtils.js +12 -3
  28. package/dataSourceUtils.js.map +1 -1
  29. package/domUtils.js +2 -2
  30. package/domUtils.js.map +1 -1
  31. package/hocUtils.js +29 -15
  32. package/hocUtils.js.map +1 -1
  33. package/i18n.js +4 -2
  34. package/i18n.js.map +1 -1
  35. package/iconUtils.js +11 -12
  36. package/iconUtils.js.map +1 -1
  37. package/mapUtils.js +4 -0
  38. package/mapUtils.js.map +1 -1
  39. package/namedColors.js +2 -2
  40. package/namedColors.js.map +1 -1
  41. package/numberUtils.js +31 -21
  42. package/numberUtils.js.map +1 -1
  43. package/package.json +12 -14
  44. package/previewVizMessage.js +2 -2
  45. package/previewVizMessage.js.map +1 -1
  46. package/propUtils.js +77 -12
  47. package/propUtils.js.map +1 -1
  48. package/schemaUtils.js +10 -10
  49. package/schemaUtils.js.map +1 -1
  50. package/simpleXMLOptions.js +6 -6
  51. package/simpleXMLOptions.js.map +1 -1
  52. package/style.js +11 -6
  53. package/style.js.map +1 -1
  54. package/testHelper.js +2 -2
  55. package/testHelper.js.map +1 -1
  56. package/themeUtils.js +14 -13
  57. package/themeUtils.js.map +1 -1
  58. package/trellisUtils.js +77 -33
  59. package/trellisUtils.js.map +1 -1
package/numberUtils.js CHANGED
@@ -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 = 59);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 58);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -106,14 +106,14 @@ module.exports = require("@babel/runtime/helpers/typeof");
106
106
 
107
107
  /***/ }),
108
108
 
109
- /***/ 4:
109
+ /***/ 2:
110
110
  /***/ (function(module, exports) {
111
111
 
112
112
  module.exports = require("lodash");
113
113
 
114
114
  /***/ }),
115
115
 
116
- /***/ 59:
116
+ /***/ 58:
117
117
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
118
118
 
119
119
  "use strict";
@@ -126,29 +126,30 @@ __webpack_require__.r(__webpack_exports__);
126
126
  /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);
127
127
  /* harmony import */ var _splunk_moment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14);
128
128
  /* harmony import */ var _splunk_moment__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_splunk_moment__WEBPACK_IMPORTED_MODULE_1__);
129
- /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
129
+ /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
130
130
  /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);
131
131
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7);
132
132
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_3__);
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,0CAA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,EAAIH,IAAI,CAACH,KAAK;IAAA,EAAC;IAEpE,IAAIC,KAAK,EAAE;MACP1C,KAAK,IAAA6C,IAAA,CAAAE,GAAA,CAAI,EAAE,EAAIL,KAAK,CAACD,KAAK;MAC1BH,SAAS,GAAGI,KAAK,CAACF,MAAM;MACxBlB,aAAa,CAACc,qBAAqB,GAAG,CAAC;MACvCd,aAAa,CAACa,qBAAqB,GAAG,CAAC;IAC3C;EACJ;EAEA,IAAMa,SAAS,GAAGzC,6CAA6C,CAACE,MAAM,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 = 59);\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;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,2C;;;;;;;ACAA,0D;;;;;;;ACAA,mC;;;;;;;;;;;;;;;;;;;;;;ACAA;AACA;CAGA;;AACA;AACA;AACA;AACA;;AACA,IAAMA,2BAA2B,GAAjC;AACA,IAAMC,4BAA4B,GAAlC;;AACA,8BAA8B;AAC1B,SAAOD,2BAA2B,CAA3BA,KAAP,GAAOA,CAAP;AACH;;AACD,qCAAqC;AACjC,SAAOC,4BAA4B,CAA5BA,KAAP,GAAOA,CAAP;AACH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,4BAA4B;AAC/B,SAAOC,eAAe,CAAfA,GAAe,CAAfA,IAAwB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;;AACA,MAAIC,wDAAS,CAATA,SAAS,CAATA,IAAwBL,SAAS,IAArC,GAA4C;AACxC;AACA,QAAMM,CAAC,GAAGN,SAAS,GAATA,UAAV;AAEAD,iBAAa,CAAbA;AACAA,iBAAa,CAAbA;AALJ,SAMO;AACHA,iBAAa,CAAbA;AACH;;AAEDA,eAAa,CAAbA,cAA4BE,qBAAqB,KAAjDF;AAEA,MAAIQ,SAAS,GAAb;AACA,MAAIf,KAAK,GAAT;AACA,MAAMgB,KAAK,GAAG,CACV;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,16 +3,16 @@
3
3
  "description": "Visualizations Shared Files",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "author": "Splunk",
6
- "version": "25.13.1",
6
+ "version": "26.1.0",
7
7
  "scripts": {
8
- "build": "NODE_ENV=production webpack --config ./webpack.config.js --bail",
9
- "build-storybook": "build-storybook -c .storybook -s fonts -o .storybook-bundle",
8
+ "build": "export NODE_OPTIONS=--openssl-legacy-provider && NODE_ENV=production webpack --config ./webpack.config.js --bail",
9
+ "build-storybook": "export NODE_OPTIONS=--openssl-legacy-provider && build-storybook -c .storybook -s fonts -o .storybook-bundle",
10
10
  "clean": "yarn clean:storybook && yarn clean:webpack && yarn clean:test-reports",
11
11
  "clean:storybook": "rm -rf .storybook-bundle",
12
12
  "clean:webpack": "git ls-files --others -i --exclude-standard *.js *.map | xargs rm",
13
13
  "clean:test-reports": "rm -rf ./test-reports",
14
- "dev": "NODE_ENV=development webpack --config ./webpack.config.js --watch",
15
- "storybook": "start-storybook -p 9001 -c .storybook",
14
+ "dev": "export NODE_OPTIONS=--openssl-legacy-provider && NODE_ENV=development webpack --config ./webpack.config.js --watch",
15
+ "storybook": "export NODE_OPTIONS=--openssl-legacy-provider && start-storybook -p 9001 -c .storybook",
16
16
  "lint": "eslint src --ext \".js,.jsx,.es,.ts,.tsx\"",
17
17
  "lint:fix": "yarn run lint --fix",
18
18
  "test": "yarn run test:unit && yarn run test:integration",
@@ -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.18.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,24 @@
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": "^25.13.1",
50
- "@splunk/visualization-context": "^25.13.1",
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.13",
49
+ "@splunk/visualization-build-tools": "^26.1.0",
50
+ "@splunk/visualization-context": "^26.1.0",
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
55
  "babel-jest": "^26.0.0",
56
56
  "jest": "^26.0.0",
57
57
  "jest-canvas-mock": "^2.2.0",
58
58
  "jest-junit": "^12.0.0",
59
59
  "jest-styled-components": "^7.0.3",
60
- "loki": "^0.34.0",
61
60
  "raf": "^3.4.0",
62
61
  "react": "^16.13.1",
63
62
  "react-dom": "^16.13.1",
64
63
  "styled-components": "^5.3.10",
65
64
  "text-encoding": "^0.7.0",
66
65
  "ts-jest": "^26.0.0",
67
- "typescript": "^4.1.2",
68
66
  "webpack": "^4.29.6",
69
67
  "webpack-merge": "^4.2.1"
70
68
  }
@@ -87,12 +87,12 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 60);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 59);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
94
94
 
95
- /***/ 60:
95
+ /***/ 59:
96
96
  /***/ (function(module, exports, __webpack_require__) {
97
97
 
98
98
  "use strict";
@@ -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 = 60);\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
@@ -87,28 +87,28 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 61);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 60);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
94
94
 
95
- /***/ 40:
95
+ /***/ 2:
96
96
  /***/ (function(module, exports) {
97
97
 
98
- module.exports = require("lodash/isPlainObject");
98
+ module.exports = require("lodash");
99
99
 
100
100
  /***/ }),
101
101
 
102
- /***/ 61:
102
+ /***/ 60:
103
103
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
104
104
 
105
105
  "use strict";
106
106
  __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
- /* harmony import */ var lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40);
110
- /* harmony import */ var lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_0__);
111
-
109
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertToSCProperties", function() { return convertToSCProperties; });
110
+ /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
111
+ /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
112
112
 
113
113
  /**
114
114
  * convert props of type 'array/object' to 'string', based on the list of props to be converted in vizProps
@@ -117,15 +117,17 @@ __webpack_require__.r(__webpack_exports__);
117
117
  * @param {Array} propNames
118
118
  * @return {Object} convertedVizProps
119
119
  */
120
+
120
121
  var convertPropsToString = function convertPropsToString(_ref) {
121
122
  var _ref$vizProps = _ref.vizProps,
122
- vizProps = _ref$vizProps === void 0 ? {} : _ref$vizProps,
123
- _ref$propNames = _ref.propNames,
124
- propNames = _ref$propNames === void 0 ? [] : _ref$propNames;
123
+ vizProps = _ref$vizProps === void 0 ? {} : _ref$vizProps,
124
+ _ref$propNames = _ref.propNames,
125
+ propNames = _ref$propNames === void 0 ? [] : _ref$propNames;
125
126
  var convertedVizProps = {};
126
127
  propNames.forEach(function (propName) {
127
128
  var propValue = vizProps[propName];
128
- if (Array.isArray(propValue) || lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_0___default()(propValue)) {
129
+
130
+ if (Array.isArray(propValue) || Object(lodash__WEBPACK_IMPORTED_MODULE_0__["isPlainObject"])(propValue)) {
129
131
  convertedVizProps[propName] = JSON.stringify(propValue);
130
132
  } else if (propValue && typeof propValue === 'string') {
131
133
  // eslint-disable-next-line no-console
@@ -134,19 +136,82 @@ var convertPropsToString = function convertPropsToString(_ref) {
134
136
  });
135
137
  return convertedVizProps;
136
138
  };
137
-
138
139
  /**
139
140
  * Convert a hex value to a color
140
141
  * @method formatColor
141
142
  * @param {String} color
142
143
  * @returns {String}
143
144
  */
145
+
144
146
  var formatColor = function formatColor(color) {
145
147
  if (!color || typeof color !== 'string') {
146
148
  return '';
147
149
  }
150
+
148
151
  return color.replace('0x', '#');
149
152
  };
153
+ /**
154
+ * Helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
155
+ * This is for options that has new key name and can not directly be mapped with SimpleXML or
156
+ * don't have a 1-1 mapping in SimpleXML (i.e. a straightforward name mapping where values are preserved)
157
+ * @method convertToAreaSCProperties
158
+ * @param {Object} originalOptions
159
+ * @param {Object} optionsSCMapping
160
+ * @param {Object} optionValuesSCMapping
161
+ * @param {Array} stringValues
162
+ * @returns {Object}
163
+ */
164
+
165
+ var convertToSCProperties = function convertToSCProperties(originalOptions, optionsSCMapping, optionValuesSCMapping, stringValues) {
166
+ var returnOptions = {};
167
+ var y2Fields = originalOptions.y2Fields,
168
+ overlayFields = originalOptions.overlayFields; // mapToOldKey
169
+
170
+ Object.keys(originalOptions).forEach(function (key) {
171
+ var newKey = optionsSCMapping[key] ? optionsSCMapping[key] : key;
172
+ returnOptions[newKey] = originalOptions[key];
173
+ }); // mapToValues
174
+
175
+ Object.keys(optionValuesSCMapping).forEach(function (key) {
176
+ if (Object(lodash__WEBPACK_IMPORTED_MODULE_0__["has"])(returnOptions, key)) {
177
+ var updatedValue = optionValuesSCMapping[key][returnOptions[key]];
178
+
179
+ if (!Object(lodash__WEBPACK_IMPORTED_MODULE_0__["isUndefined"])(updatedValue)) {
180
+ returnOptions[key] = updatedValue;
181
+ }
182
+ }
183
+ }); // convertY2AxisOptions
184
+
185
+ if (y2Fields) {
186
+ delete returnOptions.y2Fields;
187
+ returnOptions['axisY2.enabled'] = true;
188
+ returnOptions['axisY2.fields'] = Array.isArray(y2Fields) ? y2Fields.filter(function (name) {
189
+ return name;
190
+ }).join(',') : y2Fields;
191
+ } // convertOverlayFields
192
+
193
+
194
+ if (overlayFields) {
195
+ returnOptions.overlayFields = Array.isArray(overlayFields) ? overlayFields.filter(function (field) {
196
+ return field;
197
+ }).map(function (field) {
198
+ return field.trim();
199
+ }).join(',') : overlayFields;
200
+ } // convertToStringValues
201
+
202
+
203
+ stringValues.forEach(function (propName) {
204
+ var propValue = returnOptions[propName];
205
+
206
+ if (Array.isArray(propValue) || Object(lodash__WEBPACK_IMPORTED_MODULE_0__["isPlainObject"])(propValue)) {
207
+ returnOptions[propName] = JSON.stringify(propValue);
208
+ } else if (propValue && typeof propValue === 'string') {
209
+ // eslint-disable-next-line no-console
210
+ console.warn("The option type 'string' for '".concat(propName, "' has been deprecated."));
211
+ }
212
+ });
213
+ return returnOptions;
214
+ };
150
215
 
151
216
  /***/ })
152
217
 
package/propUtils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"lodash/isPlainObject\"","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"],"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,iD;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAiD;;AAEjD;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,aAAA,cAAG,CAAC,CAAC,GAAAA,aAAA;IAAAE,cAAA,GAAAH,IAAA,CAAEI,SAAS;IAATA,SAAS,GAAAD,cAAA,cAAG,EAAE,GAAAA,cAAA;EAChE,IAAME,iBAAiB,GAAG,CAAC,CAAC;EAE5BD,SAAS,CAACE,OAAO,CAAC,UAAAC,QAAQ,EAAI;IAC1B,IAAMC,SAAS,GAAGN,QAAQ,CAACK,QAAQ,CAAC;IACpC,IAAIE,KAAK,CAACC,OAAO,CAACF,SAAS,CAAC,IAAIG,2DAAa,CAACH,SAAS,CAAC,EAAE;MACtDH,iBAAiB,CAACE,QAAQ,CAAC,GAAGK,IAAI,CAACC,SAAS,CAACL,SAAS,CAAC;IAC3D,CAAC,MAAM,IAAIA,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;MACnD;MACAM,OAAO,CAACC,IAAI,kCAAAC,MAAA,CAAkCT,QAAQ,4BAAyB;IACnF;EACJ,CAAC,CAAC;EAEF,OAAOF,iBAAiB;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACO,IAAMY,WAAW,GAAG,SAAdA,WAAWA,CAAGC,KAAK,EAAI;EAChC,IAAI,CAACA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IACrC,OAAO,EAAE;EACb;EAEA,OAAOA,KAAK,CAACC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;AACnC,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 = 61);\n","module.exports = require(\"lodash/isPlainObject\");","import isPlainObject from 'lodash/isPlainObject';\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"],"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"],"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;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAuB,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AAqB,CAArBA,CAA2BT,aAAa,CAA7D,GAA6D,CAAxCS,CAArB;;AACA,UAAI,CAACC,0DAAW,CAAhB,YAAgB,CAAhB,EAAgC;AAC5BV,qBAAa,CAAbA,GAAa,CAAbA;AACH;AACJ;AAjBJ,GAWDI,EAXC,CAoBD;;AACA,gBAAc;AACV,WAAOJ,aAAa,CAApB;AACAA,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,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"],"sourceRoot":""}
package/schemaUtils.js CHANGED
@@ -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, "$");