@splunk/visualization-context 24.1.0 → 24.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DataSourceContext.js +9 -8
- package/DataSourceContext.js.map +1 -1
- package/FeatureFlagContext.js +10 -8
- package/FeatureFlagContext.js.map +1 -1
- package/GeoContext.js +10 -8
- package/GeoContext.js.map +1 -1
- package/IconContext.js +10 -8
- package/IconContext.js.map +1 -1
- package/IconRegistry.js +3 -3
- package/IconRegistry.js.map +1 -1
- package/ImageContext.js +10 -8
- package/ImageContext.js.map +1 -1
- package/ImageRegistry.js +3 -3
- package/ImageRegistry.js.map +1 -1
- package/LocalIconProvider.js +3 -3
- package/LocalIconProvider.js.map +1 -1
- package/LocalImageProvider.js +3 -3
- package/LocalImageProvider.js.map +1 -1
- package/MapContext.js +163 -0
- package/MapContext.js.map +1 -0
- package/MessageContext.js +123 -0
- package/MessageContext.js.map +1 -0
- package/MockedProvider.js +17 -17
- package/MockedProvider.js.map +1 -1
- package/Provider.js +9 -9
- package/Provider.js.map +1 -1
- package/TimezoneContext.js +11 -10
- package/TimezoneContext.js.map +1 -1
- package/package.json +3 -3
- package/testDataURIs.js +2 -2
- package/testDataURIs.js.map +1 -1
- package/testSVG.js +2 -2
- package/testSVG.js.map +1 -1
package/LocalIconProvider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"uuid-v4\"","webpack:///./src/LocalIconProvider.js"],"names":["b64EncodeUnicode","btoa","String","parseInt","KEY","LocalIconProvider","fetch","response","text","parser","xmlDoc","svg","_","serializer","svgStr","iconDataURI","icon","dataURI","metaData","id","uuid","icons","JSON","localStorage","offset","count","meta","search","results","Object","iconMeta","isSearchedIcon","iconMetaValue","Provider"],"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,kD;;;;;;ACAA,uD;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;ACAA,oE;;;;;;ACAA,kE;;;;;;ACAA,mE;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;ACAA,kE;;;;;;;;;;ACAA,oC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;AACA;AACA;AACA;AAEO,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,MAAG;AAAA,SAC/B;AACA;AACA;AACAC,QAAI,CACA,kBAAkB,CAAlB,GAAkB,CAAlB,4BAAmD;AA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;;AAOA,cAAIL,MAAM,IAANA,QAAJ,gBAAsC;AAClC,gBAAID,IAAI,IAAIA,IAAI,CAAhB,QAAyB;AACrBV,kBAAI,CAAJA;AACAU,kBAAI,CAAJA,QAAa,gBAAQ;AACjB,oBAAII,QAAQ,CAARA,IAAQ,CAARA,IAAJ,MAA4B;AACxBd,sBAAI,CAAJA,iBAAsBc,QAAQ,CAA9Bd,IAA8B,CAA9BA;AACH;AAHLU;AAKH;;AAEDE,mBAAO,CAAPA;AACH;AAxBTC;AA2BA;AA/BJ,QAgCE,cAAc;AACZ,cAAM,UAAUjB,+DAAC,CAAjB,gCAAiB,CAAX,CAAN;AACH;AACJ;AAED;AACJ;AACA;;;;WACI,wBAAe;AACX,UAAI;AACA,YAAMI,IAAI,GAAG,aAAb,EAAa,CAAb;AACA,YAAMK,KAAK,GAAGC,IAAI,CAAJA,MAAWC,YAAY,CAAZA,QAAzB,GAAyBA,CAAXD,CAAd;AACA,eAAOD,KAAK,CAAZ,EAAY,CAAZ;AACAE,oBAAY,CAAZA,aAA0BD,IAAI,CAAJA,UAA1BC,KAA0BD,CAA1BC;AACA;AALJ,QAME,cAAc;AACZ,cAAM,UAAUX,+DAAC,CAAjB,6BAAiB,CAAX,CAAN;AACH;AACJ;;;;EAtH2BqB,8E;;AAyHhC,kF","file":"LocalIconProvider.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 = 26);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"uuid-v4\");","/* eslint-disable class-methods-use-this,no-useless-constructor */\nimport uuid from 'uuid-v4';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\nexport const b64EncodeUnicode = str =>\n // first we use encodeURIComponent to get percent-encoded UTF-8,\n // then we convert the percent encodings into raw bytes which\n // can be fed into btoa.\n btoa(\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) =>\n String.fromCharCode(parseInt(`0x${p1}`, 16))\n )\n );\n\nexport const KEY = '__icons__';\n\n/**\n * a local icon provider\n */\nclass LocalIconProvider extends Provider {\n constructor() {\n super();\n }\n\n /**\n * return provider type\n * @return {String} 'local'\n */\n getType() {\n return 'local';\n }\n\n /**\n * upload one new icon\n */\n async upload(dataURI, metaData) {\n // get svg from dataURI\n const response = await fetch(dataURI);\n const text = await response.text();\n const parser = new DOMParser();\n const xmlDoc = parser.parseFromString(text, 'text/xml');\n const svg = xmlDoc.getElementsByTagName('svg')[0];\n\n if (!svg.getAttribute('viewBox')) {\n throw new Error(_('Please upload a valid svg with viewBox attribute.'));\n }\n\n // reset svg attributes\n svg.setAttribute('preserveAspectRatio', 'none');\n // convert back to dataURI\n const serializer = new XMLSerializer();\n const svgStr = b64EncodeUnicode(serializer.serializeToString(svg));\n const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;\n\n // save to localStorage\n try {\n const icon = { dataURI: iconDataURI, metaData };\n const id = uuid();\n let icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n icons = { ...icons, [id]: icon };\n localStorage.setItem(KEY, JSON.stringify(icons));\n return id;\n } catch (error) {\n throw new Error(\n _('The icon cannot be uploaded. Please check whether your localStorage is full.')\n );\n }\n }\n\n /**\n * get one icon by icon id\n */\n getById(id) {\n const icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n if (icons[id]) {\n return icons[id];\n }\n throw new Error(_('The icon is not found.'));\n }\n\n /**\n * get all icon ids\n * @params options\n * @params options.meta a list of meta data attribute that would be returned with each id\n * @params options.search a search string to filter the returned icons\n */\n listIds({ offset = 0, count = 100, meta = [], search = null }) {\n try {\n const icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n const results = [];\n\n Object.keys(icons)\n .slice(offset, count)\n .forEach(id => {\n const icon = { id };\n const iconMeta = icons[id].metaData || {};\n // If search is a valid string, return the icon with matched meta data\n const isSearchedIcon =\n search != null &&\n Object.keys(iconMeta).some(attr => {\n const iconMetaValue = iconMeta[attr].toLowerCase();\n return iconMetaValue.indexOf(search.toLowerCase()) > -1;\n });\n\n if (search == null || isSearchedIcon) {\n if (meta && meta.length) {\n icon.metaData = {};\n meta.forEach(attr => {\n if (iconMeta[attr] != null) {\n icon.metaData[attr] = iconMeta[attr];\n }\n });\n }\n\n results.push(icon);\n }\n });\n\n return results;\n } catch (error) {\n throw new Error(_('The icon ids cannot be listed.'));\n }\n }\n\n /**\n * delete an icon by icon id\n */\n deleteById(id) {\n try {\n const icon = this.getById(id);\n const icons = JSON.parse(localStorage.getItem(KEY));\n delete icons[id];\n localStorage.setItem(KEY, JSON.stringify(icons));\n return icon;\n } catch (error) {\n throw new Error(_('The icon cannot be deleted.'));\n }\n }\n}\n\nexport default LocalIconProvider;\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"uuid-v4\"","webpack:///./src/LocalIconProvider.js"],"names":["b64EncodeUnicode","btoa","String","parseInt","KEY","LocalIconProvider","fetch","response","text","parser","xmlDoc","svg","_","serializer","svgStr","iconDataURI","icon","dataURI","metaData","id","uuid","icons","JSON","localStorage","offset","count","meta","search","results","Object","iconMeta","isSearchedIcon","iconMetaValue","Provider"],"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,kD;;;;;;ACAA,uD;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;ACAA,oE;;;;;;ACAA,kE;;;;;;ACAA,mE;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;;ACAA,kE;;;;;;;;;ACAA,oC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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J,MAAM,IAANA,QACA,MAAM,CAAN,oBAA2B,gBAAQ;AAC/B,gBAAMK,aAAa,GAAGF,QAAQ,CAARA,IAAQ,CAARA,CAAtB,WAAsBA,EAAtB;AACA,mBAAOE,aAAa,CAAbA,QAAsBL,MAAM,CAA5BK,WAAsBL,EAAtBK,IAA8C,CAArD;AAJR,WAEI,CAFJ;;AAOA,cAAIL,MAAM,IAANA,QAAJ,gBAAsC;AAClC,gBAAID,IAAI,IAAIA,IAAI,CAAhB,QAAyB;AACrBV,kBAAI,CAAJA;AACAU,kBAAI,CAAJA,QAAa,gBAAQ;AACjB,oBAAII,QAAQ,CAARA,IAAQ,CAARA,IAAJ,MAA4B;AACxBd,sBAAI,CAAJA,iBAAsBc,QAAQ,CAA9Bd,IAA8B,CAA9BA;AACH;AAHLU;AAKH;;AAEDE,mBAAO,CAAPA;AACH;AAxBTC;AA2BA;AA/BJ,QAgCE,cAAc;AACZ,cAAM,UAAUjB,+DAAC,CAAjB,gCAAiB,CAAX,CAAN;AACH;AACJ;AAED;AACJ;AACA;;;;WACI,wBAAe;AACX,UAAI;AACA,YAAMI,IAAI,GAAG,aAAb,EAAa,CAAb;AACA,YAAMK,KAAK,GAAGC,IAAI,CAAJA,MAAWC,YAAY,CAAZA,QAAzB,GAAyBA,CAAXD,CAAd;AACA,eAAOD,KAAK,CAAZ,EAAY,CAAZ;AACAE,oBAAY,CAAZA,aAA0BD,IAAI,CAAJA,UAA1BC,KAA0BD,CAA1BC;AACA;AALJ,QAME,cAAc;AACZ,cAAM,UAAUX,+DAAC,CAAjB,6BAAiB,CAAX,CAAN;AACH;AACJ;;;;EAtH2BqB,8E;;AAyHhC,kF","file":"LocalIconProvider.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 = 26);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"uuid-v4\");","/* eslint-disable class-methods-use-this,no-useless-constructor */\nimport uuid from 'uuid-v4';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\nexport const b64EncodeUnicode = str =>\n // first we use encodeURIComponent to get percent-encoded UTF-8,\n // then we convert the percent encodings into raw bytes which\n // can be fed into btoa.\n btoa(\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) =>\n String.fromCharCode(parseInt(`0x${p1}`, 16))\n )\n );\n\nexport const KEY = '__icons__';\n\n/**\n * a local icon provider\n */\nclass LocalIconProvider extends Provider {\n constructor() {\n super();\n }\n\n /**\n * return provider type\n * @return {String} 'local'\n */\n getType() {\n return 'local';\n }\n\n /**\n * upload one new icon\n */\n async upload(dataURI, metaData) {\n // get svg from dataURI\n const response = await fetch(dataURI);\n const text = await response.text();\n const parser = new DOMParser();\n const xmlDoc = parser.parseFromString(text, 'text/xml');\n const svg = xmlDoc.getElementsByTagName('svg')[0];\n\n if (!svg.getAttribute('viewBox')) {\n throw new Error(_('Please upload a valid svg with viewBox attribute.'));\n }\n\n // reset svg attributes\n svg.setAttribute('preserveAspectRatio', 'none');\n // convert back to dataURI\n const serializer = new XMLSerializer();\n const svgStr = b64EncodeUnicode(serializer.serializeToString(svg));\n const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;\n\n // save to localStorage\n try {\n const icon = { dataURI: iconDataURI, metaData };\n const id = uuid();\n let icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n icons = { ...icons, [id]: icon };\n localStorage.setItem(KEY, JSON.stringify(icons));\n return id;\n } catch (error) {\n throw new Error(\n _('The icon cannot be uploaded. Please check whether your localStorage is full.')\n );\n }\n }\n\n /**\n * get one icon by icon id\n */\n getById(id) {\n const icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n if (icons[id]) {\n return icons[id];\n }\n throw new Error(_('The icon is not found.'));\n }\n\n /**\n * get all icon ids\n * @params options\n * @params options.meta a list of meta data attribute that would be returned with each id\n * @params options.search a search string to filter the returned icons\n */\n listIds({ offset = 0, count = 100, meta = [], search = null }) {\n try {\n const icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n const results = [];\n\n Object.keys(icons)\n .slice(offset, count)\n .forEach(id => {\n const icon = { id };\n const iconMeta = icons[id].metaData || {};\n // If search is a valid string, return the icon with matched meta data\n const isSearchedIcon =\n search != null &&\n Object.keys(iconMeta).some(attr => {\n const iconMetaValue = iconMeta[attr].toLowerCase();\n return iconMetaValue.indexOf(search.toLowerCase()) > -1;\n });\n\n if (search == null || isSearchedIcon) {\n if (meta && meta.length) {\n icon.metaData = {};\n meta.forEach(attr => {\n if (iconMeta[attr] != null) {\n icon.metaData[attr] = iconMeta[attr];\n }\n });\n }\n\n results.push(icon);\n }\n });\n\n return results;\n } catch (error) {\n throw new Error(_('The icon ids cannot be listed.'));\n }\n }\n\n /**\n * delete an icon by icon id\n */\n deleteById(id) {\n try {\n const icon = this.getById(id);\n const icons = JSON.parse(localStorage.getItem(KEY));\n delete icons[id];\n localStorage.setItem(KEY, JSON.stringify(icons));\n return icon;\n } catch (error) {\n throw new Error(_('The icon cannot be deleted.'));\n }\n }\n}\n\nexport default LocalIconProvider;\n"],"sourceRoot":""}
|
package/LocalImageProvider.js
CHANGED
|
@@ -135,13 +135,13 @@ module.exports = require("@babel/runtime/helpers/inherits");
|
|
|
135
135
|
module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
|
|
136
136
|
|
|
137
137
|
/***/ }),
|
|
138
|
-
/* 9
|
|
138
|
+
/* 9 */,
|
|
139
|
+
/* 10 */
|
|
139
140
|
/***/ (function(module, exports) {
|
|
140
141
|
|
|
141
142
|
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
142
143
|
|
|
143
144
|
/***/ }),
|
|
144
|
-
/* 10 */,
|
|
145
145
|
/* 11 */,
|
|
146
146
|
/* 12 */,
|
|
147
147
|
/* 13 */,
|
|
@@ -169,7 +169,7 @@ module.exports = require("uuid-v4");
|
|
|
169
169
|
"use strict";
|
|
170
170
|
__webpack_require__.r(__webpack_exports__);
|
|
171
171
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KEY", function() { return KEY; });
|
|
172
|
-
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
172
|
+
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
|
|
173
173
|
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);
|
|
174
174
|
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
175
175
|
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"uuid-v4\"","webpack:///./src/LocalImageProvider.js"],"names":["KEY","LocalImageProvider","id","uuid","imageObject","dataURI","metaData","images","JSON","localStorage","_","offset","count","imageIDS","Object","Provider"],"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,kD;;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;;ACAA,kE;;;;;;ACAA,mE;;;;;;ACAA,4D;;;;;;ACAA,6E
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"uuid-v4\"","webpack:///./src/LocalImageProvider.js"],"names":["KEY","LocalImageProvider","id","uuid","imageObject","dataURI","metaData","images","JSON","localStorage","_","offset","count","imageIDS","Object","Provider"],"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,kD;;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;;ACAA,kE;;;;;;ACAA,mE;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;;ACAA,kE;;;;;;;;;ACAA,oC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;AACA;AACA;AACA;AAEO,IAAMA,GAAG,GAAT;AAEP;AACA;AACA;;IACMC,kB;;;;;AACF,gCAAc;AAAA;;AAAA;AAEb;AAED;AACJ;AACA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AA0BA,CAAXD,CAAf;AACA,eAAOD,MAAM,CAAb,OAAa,CAAb;AACAE,oBAAY,CAAZA,aAA0BD,IAAI,CAAJA,UAA1BC,MAA0BD,CAA1BC;AACA;AALJ,QAME,cAAc;AACZ,cAAM,UAAUC,+DAAC,CAAjB,8BAAiB,CAAX,CAAN;AACH;AACJ;;;;EApE4BK,6E;;AAuEjC,mF","file":"LocalImageProvider.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 = 27);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"uuid-v4\");","/* eslint-disable class-methods-use-this,no-useless-constructor */\nimport uuid from 'uuid-v4';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\nexport const KEY = '__images__';\n\n/**\n * a pure frontend local image provider\n */\nclass LocalImageProvider extends Provider {\n constructor() {\n super();\n }\n\n /**\n * return provider type\n */\n getType() {\n return 'local';\n }\n\n /**\n * add a new image\n */\n upload(dataURI, metaData) {\n try {\n const id = uuid();\n const imageObject = { dataURI, metaData };\n let images = JSON.parse(localStorage.getItem(KEY) || '{}');\n images = { ...images, [id]: imageObject };\n localStorage.setItem(KEY, JSON.stringify(images));\n return id;\n } catch (error) {\n throw new Error(\n _('The image cannot be uploaded. Please check whether your localStorage is full.')\n );\n }\n }\n\n /**\n * get image by imageID\n */\n getById(imageID) {\n const images = JSON.parse(localStorage.getItem(KEY) || '{}');\n const imageObject = images[imageID];\n if (imageObject) {\n return imageObject;\n }\n throw new Error(_('The image is not found.'));\n }\n\n /**\n * get all imageIDs\n */\n listIds({ offset, count }) {\n try {\n const images = JSON.parse(localStorage.getItem(KEY) || '{}');\n const imageIDS = Object.keys(images);\n return imageIDS.slice(offset, count);\n } catch (error) {\n throw new Error(_('The image ids cannot be listed.'));\n }\n }\n\n /**\n * delete an image by dataID\n */\n deleteById(imageID) {\n try {\n const imageObject = this.getById(imageID);\n const images = JSON.parse(localStorage.getItem(KEY));\n delete images[imageID];\n localStorage.setItem(KEY, JSON.stringify(images));\n return imageObject;\n } catch (error) {\n throw new Error(_('The image cannot be deleted.'));\n }\n }\n}\n\nexport default LocalImageProvider;\n"],"sourceRoot":""}
|
package/MapContext.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright © 2018 Splunk Inc.
|
|
3
|
+
* SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
4
|
+
* in part without a valid written license from Splunk Inc. is PROHIBITED.
|
|
5
|
+
*/
|
|
6
|
+
module.exports =
|
|
7
|
+
/******/ (function(modules) { // webpackBootstrap
|
|
8
|
+
/******/ // The module cache
|
|
9
|
+
/******/ var installedModules = {};
|
|
10
|
+
/******/
|
|
11
|
+
/******/ // The require function
|
|
12
|
+
/******/ function __webpack_require__(moduleId) {
|
|
13
|
+
/******/
|
|
14
|
+
/******/ // Check if module is in cache
|
|
15
|
+
/******/ if(installedModules[moduleId]) {
|
|
16
|
+
/******/ return installedModules[moduleId].exports;
|
|
17
|
+
/******/ }
|
|
18
|
+
/******/ // Create a new module (and put it into the cache)
|
|
19
|
+
/******/ var module = installedModules[moduleId] = {
|
|
20
|
+
/******/ i: moduleId,
|
|
21
|
+
/******/ l: false,
|
|
22
|
+
/******/ exports: {}
|
|
23
|
+
/******/ };
|
|
24
|
+
/******/
|
|
25
|
+
/******/ // Execute the module function
|
|
26
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
27
|
+
/******/
|
|
28
|
+
/******/ // Flag the module as loaded
|
|
29
|
+
/******/ module.l = true;
|
|
30
|
+
/******/
|
|
31
|
+
/******/ // Return the exports of the module
|
|
32
|
+
/******/ return module.exports;
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/
|
|
35
|
+
/******/
|
|
36
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
37
|
+
/******/ __webpack_require__.m = modules;
|
|
38
|
+
/******/
|
|
39
|
+
/******/ // expose the module cache
|
|
40
|
+
/******/ __webpack_require__.c = installedModules;
|
|
41
|
+
/******/
|
|
42
|
+
/******/ // define getter function for harmony exports
|
|
43
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
44
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
45
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
46
|
+
/******/ }
|
|
47
|
+
/******/ };
|
|
48
|
+
/******/
|
|
49
|
+
/******/ // define __esModule on exports
|
|
50
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
51
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
52
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
53
|
+
/******/ }
|
|
54
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
55
|
+
/******/ };
|
|
56
|
+
/******/
|
|
57
|
+
/******/ // create a fake namespace object
|
|
58
|
+
/******/ // mode & 1: value is a module id, require it
|
|
59
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
60
|
+
/******/ // mode & 4: return value when already ns object
|
|
61
|
+
/******/ // mode & 8|1: behave like require
|
|
62
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
63
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
64
|
+
/******/ if(mode & 8) return value;
|
|
65
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
66
|
+
/******/ var ns = Object.create(null);
|
|
67
|
+
/******/ __webpack_require__.r(ns);
|
|
68
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
69
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
70
|
+
/******/ return ns;
|
|
71
|
+
/******/ };
|
|
72
|
+
/******/
|
|
73
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
74
|
+
/******/ __webpack_require__.n = function(module) {
|
|
75
|
+
/******/ var getter = module && module.__esModule ?
|
|
76
|
+
/******/ function getDefault() { return module['default']; } :
|
|
77
|
+
/******/ function getModuleExports() { return module; };
|
|
78
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
79
|
+
/******/ return getter;
|
|
80
|
+
/******/ };
|
|
81
|
+
/******/
|
|
82
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
83
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
84
|
+
/******/
|
|
85
|
+
/******/ // __webpack_public_path__
|
|
86
|
+
/******/ __webpack_require__.p = "";
|
|
87
|
+
/******/
|
|
88
|
+
/******/
|
|
89
|
+
/******/ // Load entry module and return exports
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 28);
|
|
91
|
+
/******/ })
|
|
92
|
+
/************************************************************************/
|
|
93
|
+
/******/ ({
|
|
94
|
+
|
|
95
|
+
/***/ 28:
|
|
96
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
97
|
+
|
|
98
|
+
"use strict";
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
Object.defineProperty(exports, "__esModule", {
|
|
102
|
+
value: true
|
|
103
|
+
});
|
|
104
|
+
exports.testTileConfig = exports.MapContextConsumer = exports.MapContextProvider = void 0;
|
|
105
|
+
|
|
106
|
+
var React = __webpack_require__(9);
|
|
107
|
+
|
|
108
|
+
var MapContext = React.createContext({
|
|
109
|
+
defaultTileConfig: []
|
|
110
|
+
});
|
|
111
|
+
MapContext.displayName = "data-splunk-visualization-version-MapContext-".concat("24.3.1 - da5652d2c");
|
|
112
|
+
exports.MapContextProvider = MapContext.Provider;
|
|
113
|
+
exports.MapContextConsumer = MapContext.Consumer;
|
|
114
|
+
exports.default = MapContext;
|
|
115
|
+
exports.testTileConfig = [{
|
|
116
|
+
name: 'Carto Base Map - Light',
|
|
117
|
+
key: 'carto.base.map.light',
|
|
118
|
+
theme: 'light',
|
|
119
|
+
sources: {
|
|
120
|
+
'base-tiles': {
|
|
121
|
+
type: 'raster',
|
|
122
|
+
tiles: ['https://a.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}.png'],
|
|
123
|
+
tileSize: 256
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
layers: [{
|
|
127
|
+
id: 'base-layer',
|
|
128
|
+
type: 'raster',
|
|
129
|
+
source: 'base-tiles',
|
|
130
|
+
minzoom: 0,
|
|
131
|
+
maxzoom: 12
|
|
132
|
+
}]
|
|
133
|
+
}, {
|
|
134
|
+
name: 'Cart Base Map - dark',
|
|
135
|
+
key: 'carto.base.map.dark',
|
|
136
|
+
theme: 'dark',
|
|
137
|
+
sources: {
|
|
138
|
+
'base-tiles': {
|
|
139
|
+
type: 'raster',
|
|
140
|
+
tiles: ['https://a.basemaps.cartocdn.com/rastertiles/dark_all/{z}/{x}/{y}.png'],
|
|
141
|
+
tileSize: 256
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
layers: [{
|
|
145
|
+
id: 'base-layer',
|
|
146
|
+
type: 'raster',
|
|
147
|
+
source: 'base-tiles',
|
|
148
|
+
minzoom: 0,
|
|
149
|
+
maxzoom: 12
|
|
150
|
+
}]
|
|
151
|
+
}];
|
|
152
|
+
|
|
153
|
+
/***/ }),
|
|
154
|
+
|
|
155
|
+
/***/ 9:
|
|
156
|
+
/***/ (function(module, exports) {
|
|
157
|
+
|
|
158
|
+
module.exports = require("react");
|
|
159
|
+
|
|
160
|
+
/***/ })
|
|
161
|
+
|
|
162
|
+
/******/ });
|
|
163
|
+
//# sourceMappingURL=MapContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/MapContext.tsx","webpack:///external \"react\""],"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;;AA+BA,IAAM,UAAU,GAAG,KAAK,CAAC,aAAN,CAAyC;AAAE,mBAAiB,EAAE;AAArB,CAAzC,CAAnB;AACA,UAAU,CAAC,WAAX,0DAAyE,oBAAzE;AAEa,6BAAqB,UAAU,CAAC,QAAhC;AACA,6BAAqB,UAAU,CAAC,QAAhC;AACb,kBAAe,UAAf;AAEa,yBAAmC,CAC5C;AACI,MAAI,EAAE,wBADV;AAEI,KAAG,EAAE,sBAFT;AAGI,OAAK,EAAE,OAHX;AAII,SAAO,EAAE;AACL,kBAAc;AACV,UAAI,EAAE,QADI;AAEV,WAAK,EAAE,CAAC,kFAAD,CAFG;AAGV,cAAQ,EAAE;AAHA;AADT,GAJb;AAWI,QAAM,EAAE,CACJ;AACI,MAAE,EAAE,YADR;AAEI,QAAI,EAAE,QAFV;AAGI,UAAM,EAAE,YAHZ;AAII,WAAO,EAAE,CAJb;AAKI,WAAO,EAAE;AALb,GADI;AAXZ,CAD4C,EAsB5C;AACI,MAAI,EAAE,sBADV;AAEI,KAAG,EAAE,qBAFT;AAGI,OAAK,EAAE,MAHX;AAII,SAAO,EAAE;AACL,kBAAc;AACV,UAAI,EAAE,QADI;AAEV,WAAK,EAAE,CAAC,sEAAD,CAFG;AAGV,cAAQ,EAAE;AAHA;AADT,GAJb;AAWI,QAAM,EAAE,CACJ;AACI,MAAE,EAAE,YADR;AAEI,QAAI,EAAE,QAFV;AAGI,UAAM,EAAE,YAHZ;AAII,WAAO,EAAE,CAJb;AAKI,WAAO,EAAE;AALb,GADI;AAXZ,CAtB4C,CAAnC,C;;;;;;;ACtCb,kC","file":"MapContext.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 = 28);\n","import * as React from 'react';\nimport type { Style, VectorSource, RasterSource, AnyLayer } from 'maplibre-gl';\n\n// Global provided via webpack\n// eslint-disable-next-line no-underscore-dangle\ndeclare const __VISION_VERSION__: string;\n\n/**\n * We are omitting the `sources`, `layers`, `verison` properties, and re-adding them with some constraint\n * 1. Changing `sources` and `layers` from optional to required\n * 2. Limiting `sources` type to `VectorSource` and `RasterSource` for MVP\n * 3. `version` property is specific to MapLibre and is always an 8. We will add this internally in the\n * Viz map component and not let the consumers bother\n */\nexport interface BaseTileConfig extends Omit<Style, 'sources' | 'layers' | 'version'> {\n name: string; // used to populate the tile server dropdown in editor, eg: 'Mapbox Streets V8 tileset'\n key: string; // sets the Viz map option - 'baseLayerTileServer'\n theme?: 'light' | 'dark'; // if no theme is specified, the tileserver is available for all themes\n sources: {\n [sourceName: string]: VectorSource | RasterSource;\n };\n layers: AnyLayer[];\n version?: number;\n}\n\nexport interface MapContextInterface {\n defaultTileConfig: BaseTileConfig[];\n customTileConfig?: BaseTileConfig[];\n mapboxAccessToken?: string;\n}\n\nconst MapContext = React.createContext<MapContextInterface>({ defaultTileConfig: [] });\nMapContext.displayName = `data-splunk-visualization-version-MapContext-${__VISION_VERSION__}`;\n\nexport const MapContextProvider = MapContext.Provider;\nexport const MapContextConsumer = MapContext.Consumer;\nexport default MapContext;\n\nexport const testTileConfig: BaseTileConfig[] = [\n {\n name: 'Carto Base Map - Light',\n key: 'carto.base.map.light',\n theme: 'light',\n sources: {\n 'base-tiles': {\n type: 'raster',\n tiles: ['https://a.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}.png'],\n tileSize: 256,\n },\n },\n layers: [\n {\n id: 'base-layer',\n type: 'raster',\n source: 'base-tiles',\n minzoom: 0,\n maxzoom: 12,\n },\n ],\n },\n {\n name: 'Cart Base Map - dark',\n key: 'carto.base.map.dark',\n theme: 'dark',\n sources: {\n 'base-tiles': {\n type: 'raster',\n tiles: ['https://a.basemaps.cartocdn.com/rastertiles/dark_all/{z}/{x}/{y}.png'],\n tileSize: 256,\n },\n },\n layers: [\n {\n id: 'base-layer',\n type: 'raster',\n source: 'base-tiles',\n minzoom: 0,\n maxzoom: 12,\n },\n ],\n },\n];\n","module.exports = require(\"react\");"],"sourceRoot":""}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright © 2018 Splunk Inc.
|
|
3
|
+
* SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
4
|
+
* in part without a valid written license from Splunk Inc. is PROHIBITED.
|
|
5
|
+
*/
|
|
6
|
+
module.exports =
|
|
7
|
+
/******/ (function(modules) { // webpackBootstrap
|
|
8
|
+
/******/ // The module cache
|
|
9
|
+
/******/ var installedModules = {};
|
|
10
|
+
/******/
|
|
11
|
+
/******/ // The require function
|
|
12
|
+
/******/ function __webpack_require__(moduleId) {
|
|
13
|
+
/******/
|
|
14
|
+
/******/ // Check if module is in cache
|
|
15
|
+
/******/ if(installedModules[moduleId]) {
|
|
16
|
+
/******/ return installedModules[moduleId].exports;
|
|
17
|
+
/******/ }
|
|
18
|
+
/******/ // Create a new module (and put it into the cache)
|
|
19
|
+
/******/ var module = installedModules[moduleId] = {
|
|
20
|
+
/******/ i: moduleId,
|
|
21
|
+
/******/ l: false,
|
|
22
|
+
/******/ exports: {}
|
|
23
|
+
/******/ };
|
|
24
|
+
/******/
|
|
25
|
+
/******/ // Execute the module function
|
|
26
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
27
|
+
/******/
|
|
28
|
+
/******/ // Flag the module as loaded
|
|
29
|
+
/******/ module.l = true;
|
|
30
|
+
/******/
|
|
31
|
+
/******/ // Return the exports of the module
|
|
32
|
+
/******/ return module.exports;
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/
|
|
35
|
+
/******/
|
|
36
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
37
|
+
/******/ __webpack_require__.m = modules;
|
|
38
|
+
/******/
|
|
39
|
+
/******/ // expose the module cache
|
|
40
|
+
/******/ __webpack_require__.c = installedModules;
|
|
41
|
+
/******/
|
|
42
|
+
/******/ // define getter function for harmony exports
|
|
43
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
44
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
45
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
46
|
+
/******/ }
|
|
47
|
+
/******/ };
|
|
48
|
+
/******/
|
|
49
|
+
/******/ // define __esModule on exports
|
|
50
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
51
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
52
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
53
|
+
/******/ }
|
|
54
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
55
|
+
/******/ };
|
|
56
|
+
/******/
|
|
57
|
+
/******/ // create a fake namespace object
|
|
58
|
+
/******/ // mode & 1: value is a module id, require it
|
|
59
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
60
|
+
/******/ // mode & 4: return value when already ns object
|
|
61
|
+
/******/ // mode & 8|1: behave like require
|
|
62
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
63
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
64
|
+
/******/ if(mode & 8) return value;
|
|
65
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
66
|
+
/******/ var ns = Object.create(null);
|
|
67
|
+
/******/ __webpack_require__.r(ns);
|
|
68
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
69
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
70
|
+
/******/ return ns;
|
|
71
|
+
/******/ };
|
|
72
|
+
/******/
|
|
73
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
74
|
+
/******/ __webpack_require__.n = function(module) {
|
|
75
|
+
/******/ var getter = module && module.__esModule ?
|
|
76
|
+
/******/ function getDefault() { return module['default']; } :
|
|
77
|
+
/******/ function getModuleExports() { return module; };
|
|
78
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
79
|
+
/******/ return getter;
|
|
80
|
+
/******/ };
|
|
81
|
+
/******/
|
|
82
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
83
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
84
|
+
/******/
|
|
85
|
+
/******/ // __webpack_public_path__
|
|
86
|
+
/******/ __webpack_require__.p = "";
|
|
87
|
+
/******/
|
|
88
|
+
/******/
|
|
89
|
+
/******/ // Load entry module and return exports
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 29);
|
|
91
|
+
/******/ })
|
|
92
|
+
/************************************************************************/
|
|
93
|
+
/******/ ({
|
|
94
|
+
|
|
95
|
+
/***/ 29:
|
|
96
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
97
|
+
|
|
98
|
+
"use strict";
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
Object.defineProperty(exports, "__esModule", {
|
|
102
|
+
value: true
|
|
103
|
+
});
|
|
104
|
+
exports.MessageContextConsumer = exports.MessageContextProvider = void 0;
|
|
105
|
+
|
|
106
|
+
var React = __webpack_require__(9);
|
|
107
|
+
|
|
108
|
+
var MessageContext = React.createContext({});
|
|
109
|
+
exports.MessageContextProvider = MessageContext.Provider;
|
|
110
|
+
exports.MessageContextConsumer = MessageContext.Consumer;
|
|
111
|
+
exports.default = MessageContext;
|
|
112
|
+
|
|
113
|
+
/***/ }),
|
|
114
|
+
|
|
115
|
+
/***/ 9:
|
|
116
|
+
/***/ (function(module, exports) {
|
|
117
|
+
|
|
118
|
+
module.exports = require("react");
|
|
119
|
+
|
|
120
|
+
/***/ })
|
|
121
|
+
|
|
122
|
+
/******/ });
|
|
123
|
+
//# sourceMappingURL=MessageContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/MessageContext.ts","webpack:///external \"react\""],"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;;AAMA,IAAM,cAAc,GAAG,KAAK,CAAC,aAAN,CAA6C,EAA7C,CAAvB;AAEa,iCAAyB,cAAc,CAAC,QAAxC;AACA,iCAAyB,cAAc,CAAC,QAAxC;AACb,kBAAe,cAAf,C;;;;;;;ACVA,kC","file":"MessageContext.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 = 29);\n","import * as React from 'react';\n\ninterface MessageContextInterface {\n cspMessageLink?: string;\n}\n\nconst MessageContext = React.createContext<MessageContextInterface>({});\n\nexport const MessageContextProvider = MessageContext.Provider;\nexport const MessageContextConsumer = MessageContext.Consumer;\nexport default MessageContext;\n","module.exports = require(\"react\");"],"sourceRoot":""}
|
package/MockedProvider.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 =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 30);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ({
|
|
@@ -99,6 +99,13 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
99
99
|
|
|
100
100
|
/***/ }),
|
|
101
101
|
|
|
102
|
+
/***/ 10:
|
|
103
|
+
/***/ (function(module, exports) {
|
|
104
|
+
|
|
105
|
+
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
106
|
+
|
|
107
|
+
/***/ }),
|
|
108
|
+
|
|
102
109
|
/***/ 2:
|
|
103
110
|
/***/ (function(module, exports) {
|
|
104
111
|
|
|
@@ -106,12 +113,19 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
106
113
|
|
|
107
114
|
/***/ }),
|
|
108
115
|
|
|
109
|
-
/***/
|
|
116
|
+
/***/ 3:
|
|
117
|
+
/***/ (function(module, exports) {
|
|
118
|
+
|
|
119
|
+
module.exports = require("@babel/runtime/helpers/createClass");
|
|
120
|
+
|
|
121
|
+
/***/ }),
|
|
122
|
+
|
|
123
|
+
/***/ 30:
|
|
110
124
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
111
125
|
|
|
112
126
|
"use strict";
|
|
113
127
|
__webpack_require__.r(__webpack_exports__);
|
|
114
|
-
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
128
|
+
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
|
|
115
129
|
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);
|
|
116
130
|
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
117
131
|
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
|
|
@@ -341,13 +355,6 @@ var MockedProvider = /*#__PURE__*/function (_Provider) {
|
|
|
341
355
|
|
|
342
356
|
/***/ }),
|
|
343
357
|
|
|
344
|
-
/***/ 3:
|
|
345
|
-
/***/ (function(module, exports) {
|
|
346
|
-
|
|
347
|
-
module.exports = require("@babel/runtime/helpers/createClass");
|
|
348
|
-
|
|
349
|
-
/***/ }),
|
|
350
|
-
|
|
351
358
|
/***/ 5:
|
|
352
359
|
/***/ (function(module, exports) {
|
|
353
360
|
|
|
@@ -374,13 +381,6 @@ module.exports = require("@babel/runtime/helpers/inherits");
|
|
|
374
381
|
|
|
375
382
|
module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
|
|
376
383
|
|
|
377
|
-
/***/ }),
|
|
378
|
-
|
|
379
|
-
/***/ 9:
|
|
380
|
-
/***/ (function(module, exports) {
|
|
381
|
-
|
|
382
|
-
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
383
|
-
|
|
384
384
|
/***/ })
|
|
385
385
|
|
|
386
386
|
/******/ });
|
package/MockedProvider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///./src/MockedProvider.js","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\""],"names":["MockedProvider","obj","dataURI","metaData","id","items","_","offset","count","meta","search","icons","results","Object","icon","iconMeta","isSearchedIcon","iconMetaValue","Provider"],"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,kD;;;;;;;ACAA,kE;;;;;;;ACAA,kE;;;;;;;ACAA,+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;AACA;AACA;AAEA;AACA;AACA;;IACMA,c;;;;;AACF,4BAAc;AAAA;;AAAA;;AACV;AACA;AACA;AAHU;AAIb;AAED;AACJ;AACA;;;;;WACI,mB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AI,IAAIA,IAAI,CAAhB,QAAyB;AACrBK,kBAAI,CAAJA;AACAL,kBAAI,CAAJA,QAAa,gBAAQ;AACjB,oBAAIM,QAAQ,CAARA,IAAQ,CAARA,IAAJ,MAA4B;AACxBD,sBAAI,CAAJA,iBAAsBC,QAAQ,CAA9BD,IAA8B,CAA9BA;AACH;AAHLL;AAKH;;AAEDG,mBAAO,CAAPA;AACH;AAvBTC;AA0BA;AA9BJ,QA+BE,cAAc;AACZ,cAAM,UAAUP,+DAAC,CAAjB,2BAAiB,CAAX,CAAN;AACH;AACJ;AAED;AACJ;AACA;;;;WACI,wBAAe;AACX,UAAI;AACA,YAAML,GAAG,GAAG,aAAZ,EAAY,CAAZ;AACA,eAAO,WAAP,EAAO,CAAP;AACA;AAHJ,QAIE,cAAc;AACZ,cAAM,UAAUK,+DAAC,CAAjB,4BAAiB,CAAX,CAAN;AACH;AACJ;;;WAED,iBAAQ;AACJ;AACA;AACH;;;;EA9FwBY,6E;;AAiG7B,+E;;;;;;;ACxGA,kE;;;;;;;ACAA,mE;;;;;;;ACAA,4D;;;;;;;ACAA,6E","file":"MockedProvider.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 = 30);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","/* eslint-disable class-methods-use-this,no-useless-constructor */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\n/**\n * a local icon/image provider\n */\nclass MockedProvider extends Provider {\n constructor() {\n super();\n this.id = 0;\n this.items = {};\n }\n\n /**\n * return provider type\n */\n getType() {\n return 'mock';\n }\n\n upload(dataURI, metaData) {\n try {\n const obj = { dataURI, metaData };\n const { id, items } = this;\n\n this.items = { ...items, [id]: obj };\n this.id += 1;\n\n return id;\n } catch (error) {\n throw new Error(_('The obj cannot be uploaded.'));\n }\n }\n\n /**\n * get by id\n */\n getById(id) {\n if (this.items[id]) {\n return this.items[id];\n }\n throw new Error(_('The obj is not found.'));\n }\n\n /**\n * get all obj ids\n */\n listIds({ offset = 0, count = 100, meta = [], search = null }) {\n try {\n const icons = { ...this.items };\n const results = [];\n\n Object.keys(icons)\n .slice(offset, count)\n .forEach(id => {\n const icon = { id };\n const iconMeta = icons[id].metaData || {};\n const isSearchedIcon =\n search != null &&\n Object.keys(iconMeta).some(attr => {\n const iconMetaValue = iconMeta[attr].toLowerCase();\n return iconMetaValue.indexOf(search.toLowerCase()) > -1;\n });\n\n if (search == null || isSearchedIcon) {\n if (meta && meta.length) {\n icon.metaData = {};\n meta.forEach(attr => {\n if (iconMeta[attr] != null) {\n icon.metaData[attr] = iconMeta[attr];\n }\n });\n }\n\n results.push(icon);\n }\n });\n\n return results;\n } catch (error) {\n throw new Error(_('The ids cannot be listed.'));\n }\n }\n\n /**\n * delete by id\n */\n deleteById(id) {\n try {\n const obj = this.getById(id);\n delete this.items[id];\n return obj;\n } catch (error) {\n throw new Error(_('The obj cannot be deleted.'));\n }\n }\n\n clean() {\n this.id = 0;\n this.items = {};\n }\n}\n\nexport default MockedProvider;\n","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");"],"sourceRoot":""}
|
package/Provider.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 =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 31);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ({
|
|
@@ -106,7 +106,14 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
106
106
|
|
|
107
107
|
/***/ }),
|
|
108
108
|
|
|
109
|
-
/***/
|
|
109
|
+
/***/ 3:
|
|
110
|
+
/***/ (function(module, exports) {
|
|
111
|
+
|
|
112
|
+
module.exports = require("@babel/runtime/helpers/createClass");
|
|
113
|
+
|
|
114
|
+
/***/ }),
|
|
115
|
+
|
|
116
|
+
/***/ 31:
|
|
110
117
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
111
118
|
|
|
112
119
|
"use strict";
|
|
@@ -262,13 +269,6 @@ var Provider = /*#__PURE__*/function () {
|
|
|
262
269
|
|
|
263
270
|
/***/ }),
|
|
264
271
|
|
|
265
|
-
/***/ 3:
|
|
266
|
-
/***/ (function(module, exports) {
|
|
267
|
-
|
|
268
|
-
module.exports = require("@babel/runtime/helpers/createClass");
|
|
269
|
-
|
|
270
|
-
/***/ }),
|
|
271
|
-
|
|
272
272
|
/***/ 4:
|
|
273
273
|
/***/ (function(module, exports) {
|
|
274
274
|
|