@splunk/visualizations-shared 26.2.1 → 26.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Downloader.js +2 -2
- package/Downloader.js.map +1 -1
- package/FileDownloader.js +6 -6
- package/FileDownloader.js.map +1 -1
- package/JSONSchemaUtils.js +4 -4
- package/JSONSchemaUtils.js.map +1 -1
- package/Message.js +4 -4
- package/Message.js.map +1 -1
- package/RemoteIcon.js +16 -18
- package/RemoteIcon.js.map +1 -1
- package/RemoteImage.js +16 -18
- package/RemoteImage.js.map +1 -1
- package/SanitizeProps.js +26 -351
- package/SanitizeProps.js.map +1 -1
- package/SizeAwareWrapper.js +4 -4
- package/SizeAwareWrapper.js.map +1 -1
- package/SizeAwareWrapperDeprecated.js +11 -11
- package/SizeAwareWrapperDeprecated.js.map +1 -1
- package/VisualizationDocPage.js +79 -60
- package/VisualizationDocPage.js.map +1 -1
- package/colorConstants.js +4 -4
- package/colorConstants.js.map +1 -1
- package/colorUtils.js +22 -347
- package/colorUtils.js.map +1 -1
- package/configUtils.js +2 -2
- package/configUtils.js.map +1 -1
- package/console.js +8 -8
- package/console.js.map +1 -1
- package/dataSourceUtils.js +2 -2
- package/dataSourceUtils.js.map +1 -1
- package/domUtils.js +4 -4
- package/domUtils.js.map +1 -1
- package/hocUtils.js +11 -120
- package/hocUtils.js.map +1 -1
- package/i18n.js +4 -4
- package/i18n.js.map +1 -1
- package/iconUtils.js +2 -2
- package/iconUtils.js.map +1 -1
- package/mapUtils.js +12 -40
- package/mapUtils.js.map +1 -1
- package/numberUtils.js +6 -6
- package/numberUtils.js.map +1 -1
- package/package.json +14 -13
- package/previewVizMessage.js +2 -2
- package/previewVizMessage.js.map +1 -1
- package/propUtils.js +4 -4
- package/propUtils.js.map +1 -1
- package/schemaUtils.js +79 -266
- package/schemaUtils.js.map +1 -1
- package/simpleXMLOptions.js +4 -4
- package/simpleXMLOptions.js.map +1 -1
- package/testHelper.js +2 -2
- package/testHelper.js.map +1 -1
- package/themeUtils.js +6 -6
- package/themeUtils.js.map +1 -1
- package/trellisUtils.js +4 -4
- package/trellisUtils.js.map +1 -1
- package/namedColors.js +0 -110
- package/namedColors.js.map +0 -1
package/numberUtils.js.map
CHANGED
|
@@ -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","STARTS_WITH_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;;;;;;;;;;;;;;;;;;;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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;;;;;;;ACtJD,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]+)?)$)/;\nconst STARTS_WITH_NUMBER_REGEX = /^[-+]?\\d/;\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 * Returns whether a string starts with a number.\n * @param {string} value\n * @returns boolean\n */\nexport function startsWithNumber(value) {\n return STARTS_WITH_NUMBER_REGEX.test(value);\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","STARTS_WITH_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,IAAMC,wBAAwB,GAA9B;;AACA,8BAA8B;AAC1B,SAAOF,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,SAAOE,eAAe,CAAfA,GAAe,CAAfA,IAAwBC,sBAAsB,CAArD,GAA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A,EAN6C;AAAA;AAAA,MAOtDC,gBAPsD;AAAA;AAAA,MAQtDC,aARsD,+DAW1D;;;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;;;;;;;ACtJD,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 = 60);\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]+)?)$)/;\nconst STARTS_WITH_NUMBER_REGEX = /^[-+]?\\d/;\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 * Returns whether a string starts with a number.\n * @param {string} value\n * @returns boolean\n */\nexport function startsWithNumber(value) {\n return STARTS_WITH_NUMBER_REGEX.test(value);\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.
|
|
6
|
+
"version": "26.4.0",
|
|
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",
|
|
@@ -26,13 +26,15 @@
|
|
|
26
26
|
"test:visual:update": "yarn loki approve"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/runtime": "^7.
|
|
29
|
+
"@babel/runtime": "^7.25.9",
|
|
30
30
|
"@splunk/moment": "^0.6.1",
|
|
31
|
-
"@splunk/react-icons": "^4.
|
|
32
|
-
"@splunk/react-ui": "^4.
|
|
33
|
-
"@splunk/themes": "^0.
|
|
34
|
-
"@splunk/ui-utils": "^1.
|
|
35
|
-
"
|
|
31
|
+
"@splunk/react-icons": "^4.8.0",
|
|
32
|
+
"@splunk/react-ui": "^4.38.0",
|
|
33
|
+
"@splunk/themes": "^0.22.0",
|
|
34
|
+
"@splunk/ui-utils": "^1.7.1",
|
|
35
|
+
"@splunk/visualization-encoding": "^26.4.0",
|
|
36
|
+
"@splunk/visualization-schemas": "^26.4.0",
|
|
37
|
+
"element-resize-detector": "^1.2.4",
|
|
36
38
|
"lodash": "^4.17.21",
|
|
37
39
|
"numeral": "^2.0.6",
|
|
38
40
|
"xmlserializer": "^0.6.1"
|
|
@@ -45,14 +47,13 @@
|
|
|
45
47
|
"devDependencies": {
|
|
46
48
|
"@babel/cli": "^7.13.0",
|
|
47
49
|
"@babel/core": "^7.13.0",
|
|
48
|
-
"@splunk/react-docs": "1.0.0-beta.
|
|
49
|
-
"@splunk/visualization-build-tools": "^26.
|
|
50
|
-
"@splunk/visualization-context": "^26.
|
|
50
|
+
"@splunk/react-docs": "1.0.0-beta.18",
|
|
51
|
+
"@splunk/visualization-build-tools": "^26.4.0",
|
|
52
|
+
"@splunk/visualization-context": "^26.4.0",
|
|
51
53
|
"@storybook/addon-actions": "^6.4.0",
|
|
52
54
|
"@storybook/addons": "^6.4.0",
|
|
53
|
-
"@storybook/react": "^6.
|
|
54
|
-
"ajv": "^6.
|
|
55
|
-
"raf": "^3.4.0",
|
|
55
|
+
"@storybook/react": "^6.5.16",
|
|
56
|
+
"ajv": "^6.12.6",
|
|
56
57
|
"react": "^16.13.1",
|
|
57
58
|
"react-dom": "^16.13.1",
|
|
58
59
|
"styled-components": "^5.3.10",
|
package/previewVizMessage.js
CHANGED
|
@@ -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 =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 61);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ({
|
|
94
94
|
|
|
95
|
-
/***/
|
|
95
|
+
/***/ 61:
|
|
96
96
|
/***/ (function(module, exports, __webpack_require__) {
|
|
97
97
|
|
|
98
98
|
"use strict";
|
package/previewVizMessage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 =
|
|
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 = 61);\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,19 +87,19 @@ module.exports =
|
|
|
87
87
|
/******/
|
|
88
88
|
/******/
|
|
89
89
|
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 62);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ({
|
|
94
94
|
|
|
95
|
-
/***/
|
|
95
|
+
/***/ 4:
|
|
96
96
|
/***/ (function(module, exports) {
|
|
97
97
|
|
|
98
98
|
module.exports = require("lodash");
|
|
99
99
|
|
|
100
100
|
/***/ }),
|
|
101
101
|
|
|
102
|
-
/***/
|
|
102
|
+
/***/ 62:
|
|
103
103
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
104
104
|
|
|
105
105
|
"use strict";
|
|
@@ -108,7 +108,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
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
110
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "adjustOptionsToSchema", function() { return adjustOptionsToSchema; });
|
|
111
|
-
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
111
|
+
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
|
112
112
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
|
|
113
113
|
|
|
114
114
|
/**
|
package/propUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,CAA1B;;AACA,QAAII,KAAK,CAALA,sBAA4BC,4DAAa,CAA7C,SAA6C,CAA7C,EAA0D;AACtDH,uBAAiB,CAAjBA,QAAiB,CAAjBA,GAA8BI,IAAI,CAAJA,UAA9B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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 = 61);\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":""}
|
|
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;QAC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DM,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 = 62);\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
|
@@ -87,284 +87,97 @@ module.exports =
|
|
|
87
87
|
/******/
|
|
88
88
|
/******/
|
|
89
89
|
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 63);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ({
|
|
94
94
|
|
|
95
|
-
/***/
|
|
96
|
-
/***/ (function(module,
|
|
95
|
+
/***/ 63:
|
|
96
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
97
97
|
|
|
98
98
|
"use strict";
|
|
99
|
-
__webpack_require__.r(__webpack_exports__);
|
|
100
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTestSchema", function() { return createTestSchema; });
|
|
101
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TOKEN_PATTERN", function() { return TOKEN_PATTERN; });
|
|
102
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rgbColorPattern", function() { return rgbColorPattern; });
|
|
103
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rgbaColorPattern", function() { return rgbaColorPattern; });
|
|
104
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "colorPattern", function() { return colorPattern; });
|
|
105
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "colorPatternWithRGBA", function() { return colorPatternWithRGBA; });
|
|
106
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COLOR_OR_TOKEN_PATTERN", function() { return COLOR_OR_TOKEN_PATTERN; });
|
|
107
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COLOR_OR_TOKEN_PATTERN_WITH_RGBA", function() { return COLOR_OR_TOKEN_PATTERN_WITH_RGBA; });
|
|
108
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DYNAMIC_OPTIONS_DSL_PATTERN", function() { return DYNAMIC_OPTIONS_DSL_PATTERN; });
|
|
109
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPattern", function() { return getPattern; });
|
|
110
|
-
/* harmony default export */ __webpack_exports__["default"] = ({
|
|
111
|
-
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
112
|
-
$id: 'http://json-schema.org/draft-07/schema#',
|
|
113
|
-
title: 'Core schema meta-schema',
|
|
114
|
-
definitions: {
|
|
115
|
-
schemaArray: {
|
|
116
|
-
type: 'array',
|
|
117
|
-
minItems: 1,
|
|
118
|
-
items: {
|
|
119
|
-
$ref: '#'
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
nonNegativeInteger: {
|
|
123
|
-
type: 'integer',
|
|
124
|
-
minimum: 0
|
|
125
|
-
},
|
|
126
|
-
nonNegativeIntegerDefault0: {
|
|
127
|
-
allOf: [{
|
|
128
|
-
$ref: '#/definitions/nonNegativeInteger'
|
|
129
|
-
}, {
|
|
130
|
-
default: 0
|
|
131
|
-
}]
|
|
132
|
-
},
|
|
133
|
-
simpleTypes: {
|
|
134
|
-
enum: ['array', 'boolean', 'integer', 'null', 'number', 'object', 'string']
|
|
135
|
-
},
|
|
136
|
-
stringArray: {
|
|
137
|
-
type: 'array',
|
|
138
|
-
items: {
|
|
139
|
-
type: 'string'
|
|
140
|
-
},
|
|
141
|
-
uniqueItems: true,
|
|
142
|
-
default: []
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
type: ['object', 'boolean'],
|
|
146
|
-
properties: {
|
|
147
|
-
$id: {
|
|
148
|
-
type: 'string',
|
|
149
|
-
format: 'uri-reference'
|
|
150
|
-
},
|
|
151
|
-
$schema: {
|
|
152
|
-
type: 'string',
|
|
153
|
-
format: 'uri'
|
|
154
|
-
},
|
|
155
|
-
$ref: {
|
|
156
|
-
type: 'string',
|
|
157
|
-
format: 'uri-reference'
|
|
158
|
-
},
|
|
159
|
-
$comment: {
|
|
160
|
-
type: 'string'
|
|
161
|
-
},
|
|
162
|
-
title: {
|
|
163
|
-
type: 'string'
|
|
164
|
-
},
|
|
165
|
-
description: {
|
|
166
|
-
type: 'string'
|
|
167
|
-
},
|
|
168
|
-
default: true,
|
|
169
|
-
readOnly: {
|
|
170
|
-
type: 'boolean',
|
|
171
|
-
default: false
|
|
172
|
-
},
|
|
173
|
-
examples: {
|
|
174
|
-
type: 'array',
|
|
175
|
-
items: true
|
|
176
|
-
},
|
|
177
|
-
multipleOf: {
|
|
178
|
-
type: 'number',
|
|
179
|
-
exclusiveMinimum: 0
|
|
180
|
-
},
|
|
181
|
-
maximum: {
|
|
182
|
-
type: 'number'
|
|
183
|
-
},
|
|
184
|
-
exclusiveMaximum: {
|
|
185
|
-
type: 'number'
|
|
186
|
-
},
|
|
187
|
-
minimum: {
|
|
188
|
-
type: 'number'
|
|
189
|
-
},
|
|
190
|
-
exclusiveMinimum: {
|
|
191
|
-
type: 'number'
|
|
192
|
-
},
|
|
193
|
-
maxLength: {
|
|
194
|
-
$ref: '#/definitions/nonNegativeInteger'
|
|
195
|
-
},
|
|
196
|
-
minLength: {
|
|
197
|
-
$ref: '#/definitions/nonNegativeIntegerDefault0'
|
|
198
|
-
},
|
|
199
|
-
pattern: {
|
|
200
|
-
type: 'string',
|
|
201
|
-
format: 'regex'
|
|
202
|
-
},
|
|
203
|
-
additionalItems: {
|
|
204
|
-
$ref: '#'
|
|
205
|
-
},
|
|
206
|
-
items: {
|
|
207
|
-
anyOf: [{
|
|
208
|
-
$ref: '#'
|
|
209
|
-
}, {
|
|
210
|
-
$ref: '#/definitions/schemaArray'
|
|
211
|
-
}],
|
|
212
|
-
default: true
|
|
213
|
-
},
|
|
214
|
-
maxItems: {
|
|
215
|
-
$ref: '#/definitions/nonNegativeInteger'
|
|
216
|
-
},
|
|
217
|
-
minItems: {
|
|
218
|
-
$ref: '#/definitions/nonNegativeIntegerDefault0'
|
|
219
|
-
},
|
|
220
|
-
uniqueItems: {
|
|
221
|
-
type: 'boolean',
|
|
222
|
-
default: false
|
|
223
|
-
},
|
|
224
|
-
contains: {
|
|
225
|
-
$ref: '#'
|
|
226
|
-
},
|
|
227
|
-
maxProperties: {
|
|
228
|
-
$ref: '#/definitions/nonNegativeInteger'
|
|
229
|
-
},
|
|
230
|
-
minProperties: {
|
|
231
|
-
$ref: '#/definitions/nonNegativeIntegerDefault0'
|
|
232
|
-
},
|
|
233
|
-
required: {
|
|
234
|
-
$ref: '#/definitions/stringArray'
|
|
235
|
-
},
|
|
236
|
-
additionalProperties: {
|
|
237
|
-
$ref: '#'
|
|
238
|
-
},
|
|
239
|
-
definitions: {
|
|
240
|
-
type: 'object',
|
|
241
|
-
additionalProperties: {
|
|
242
|
-
$ref: '#'
|
|
243
|
-
},
|
|
244
|
-
default: {}
|
|
245
|
-
},
|
|
246
|
-
properties: {
|
|
247
|
-
type: 'object',
|
|
248
|
-
additionalProperties: {
|
|
249
|
-
$ref: '#'
|
|
250
|
-
},
|
|
251
|
-
default: {}
|
|
252
|
-
},
|
|
253
|
-
patternProperties: {
|
|
254
|
-
type: 'object',
|
|
255
|
-
additionalProperties: {
|
|
256
|
-
$ref: '#'
|
|
257
|
-
},
|
|
258
|
-
propertyNames: {
|
|
259
|
-
format: 'regex'
|
|
260
|
-
},
|
|
261
|
-
default: {}
|
|
262
|
-
},
|
|
263
|
-
dependencies: {
|
|
264
|
-
type: 'object',
|
|
265
|
-
additionalProperties: {
|
|
266
|
-
anyOf: [{
|
|
267
|
-
$ref: '#'
|
|
268
|
-
}, {
|
|
269
|
-
$ref: '#/definitions/stringArray'
|
|
270
|
-
}]
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
propertyNames: {
|
|
274
|
-
$ref: '#'
|
|
275
|
-
},
|
|
276
|
-
const: true,
|
|
277
|
-
enum: {
|
|
278
|
-
type: 'array',
|
|
279
|
-
items: true,
|
|
280
|
-
minItems: 1,
|
|
281
|
-
uniqueItems: true
|
|
282
|
-
},
|
|
283
|
-
type: {
|
|
284
|
-
anyOf: [{
|
|
285
|
-
$ref: '#/definitions/simpleTypes'
|
|
286
|
-
}, {
|
|
287
|
-
type: 'array',
|
|
288
|
-
items: {
|
|
289
|
-
$ref: '#/definitions/simpleTypes'
|
|
290
|
-
},
|
|
291
|
-
minItems: 1,
|
|
292
|
-
uniqueItems: true
|
|
293
|
-
}]
|
|
294
|
-
},
|
|
295
|
-
format: {
|
|
296
|
-
type: 'string'
|
|
297
|
-
},
|
|
298
|
-
contentMediaType: {
|
|
299
|
-
type: 'string'
|
|
300
|
-
},
|
|
301
|
-
contentEncoding: {
|
|
302
|
-
type: 'string'
|
|
303
|
-
},
|
|
304
|
-
if: {
|
|
305
|
-
$ref: '#'
|
|
306
|
-
},
|
|
307
|
-
then: {
|
|
308
|
-
$ref: '#'
|
|
309
|
-
},
|
|
310
|
-
else: {
|
|
311
|
-
$ref: '#'
|
|
312
|
-
},
|
|
313
|
-
allOf: {
|
|
314
|
-
$ref: '#/definitions/schemaArray'
|
|
315
|
-
},
|
|
316
|
-
anyOf: {
|
|
317
|
-
$ref: '#/definitions/schemaArray'
|
|
318
|
-
},
|
|
319
|
-
oneOf: {
|
|
320
|
-
$ref: '#/definitions/schemaArray'
|
|
321
|
-
},
|
|
322
|
-
not: {
|
|
323
|
-
$ref: '#'
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
default: true
|
|
327
|
-
});
|
|
328
|
-
var createTestSchema = function createTestSchema(optionsSchema) {
|
|
329
|
-
return {
|
|
330
|
-
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
331
|
-
$id: 'http://www.splunk.com/dashboard.schema.json',
|
|
332
|
-
title: 'Dashboard Definition',
|
|
333
|
-
description: 'Dashboard Definition',
|
|
334
|
-
type: 'object',
|
|
335
|
-
properties: optionsSchema
|
|
336
|
-
};
|
|
337
|
-
}; // Below 2 regexs are copied from dashboard-framework/packages/dashboard-utils/src/token.jsc
|
|
338
99
|
|
|
339
|
-
var TOKEN_NAMESPACE_PREFIX_PATTERN = /(\w+:)?/.source; // ex: token.name|suh (old-style filter chain)
|
|
340
|
-
// ex: token.name|lower|capitalize (new-style filter chain)
|
|
341
100
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
//
|
|
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
|
|
101
|
+
Object.defineProperty(exports, "__esModule", {
|
|
102
|
+
value: true
|
|
103
|
+
});
|
|
104
|
+
exports.getPattern = exports.DYNAMIC_OPTIONS_DSL_PATTERN = exports.COLOR_OR_TOKEN_PATTERN_WITH_RGBA = exports.COLOR_OR_TOKEN_PATTERN = exports.colorPatternWithRGBA = exports.colorPattern = exports.rgbaColorPattern = exports.rgbColorPattern = exports.TOKEN_PATTERN = exports.createTestSchema = exports.default = void 0; // Re-exported for backwards compatibility. Deprecate and remove in a future major release.
|
|
347
105
|
|
|
348
|
-
var
|
|
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.
|
|
106
|
+
var visualization_schemas_1 = __webpack_require__(64);
|
|
350
107
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
108
|
+
Object.defineProperty(exports, "default", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function get() {
|
|
111
|
+
return visualization_schemas_1.schemaDraft07;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "createTestSchema", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function get() {
|
|
117
|
+
return visualization_schemas_1.createTestSchema;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "TOKEN_PATTERN", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function get() {
|
|
123
|
+
return visualization_schemas_1.TOKEN_PATTERN;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "rgbColorPattern", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function get() {
|
|
129
|
+
return visualization_schemas_1.rgbColorPattern;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "rgbaColorPattern", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function get() {
|
|
135
|
+
return visualization_schemas_1.rgbaColorPattern;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "colorPattern", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function get() {
|
|
141
|
+
return visualization_schemas_1.colorPattern;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(exports, "colorPatternWithRGBA", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function get() {
|
|
147
|
+
return visualization_schemas_1.colorPatternWithRGBA;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "COLOR_OR_TOKEN_PATTERN", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function get() {
|
|
153
|
+
return visualization_schemas_1.COLOR_OR_TOKEN_PATTERN;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "COLOR_OR_TOKEN_PATTERN_WITH_RGBA", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function get() {
|
|
159
|
+
return visualization_schemas_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "DYNAMIC_OPTIONS_DSL_PATTERN", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function get() {
|
|
165
|
+
return visualization_schemas_1.DYNAMIC_OPTIONS_DSL_PATTERN;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(exports, "getPattern", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function get() {
|
|
171
|
+
return visualization_schemas_1.getPattern;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
355
174
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
* @returns {string}
|
|
361
|
-
*/
|
|
175
|
+
/***/ }),
|
|
176
|
+
|
|
177
|
+
/***/ 64:
|
|
178
|
+
/***/ (function(module, exports) {
|
|
362
179
|
|
|
363
|
-
|
|
364
|
-
return values.reduce(function (accumulator, value) {
|
|
365
|
-
return "".concat(accumulator, "|^").concat(value, "$");
|
|
366
|
-
}, TOKEN_PATTERN);
|
|
367
|
-
};
|
|
180
|
+
module.exports = require("@splunk/visualization-schemas");
|
|
368
181
|
|
|
369
182
|
/***/ })
|
|
370
183
|
|