@splunk/visualizations-shared 26.0.0 → 26.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Downloader.js +63 -8
- package/Downloader.js.map +1 -1
- package/FileDownloader.js +98 -24
- package/FileDownloader.js.map +1 -1
- package/JSONSchemaUtils.js +6 -1
- package/JSONSchemaUtils.js.map +1 -1
- package/Message.js +22 -11
- package/Message.js.map +1 -1
- package/RemoteIcon.js +87 -34
- package/RemoteIcon.js.map +1 -1
- package/RemoteImage.js +45 -9
- package/RemoteImage.js.map +1 -1
- package/SanitizeProps.js +40 -15
- package/SanitizeProps.js.map +1 -1
- package/SizeAwareWrapper.js +35 -7
- package/SizeAwareWrapper.js.map +1 -1
- package/VisualizationDocPage.js +65 -19
- package/VisualizationDocPage.js.map +1 -1
- package/colorConstants.js +1 -1
- package/colorConstants.js.map +1 -1
- package/colorUtils.js +28 -15
- package/colorUtils.js.map +1 -1
- package/configUtils.js +3 -1
- package/configUtils.js.map +1 -1
- package/console.js +13 -1
- package/console.js.map +1 -1
- package/dataSourceUtils.js +11 -2
- package/dataSourceUtils.js.map +1 -1
- package/domUtils.js +1 -1
- package/domUtils.js.map +1 -1
- package/hocUtils.js +15 -1
- package/hocUtils.js.map +1 -1
- package/i18n.js +3 -1
- package/i18n.js.map +1 -1
- package/iconUtils.js +12 -13
- package/iconUtils.js.map +1 -1
- package/mapUtils.js +5 -1
- package/mapUtils.js.map +1 -1
- package/namedColors.js +3 -3
- package/namedColors.js.map +1 -1
- package/numberUtils.js +28 -18
- package/numberUtils.js.map +1 -1
- package/package.json +8 -16
- package/previewVizMessage.js +1 -1
- package/previewVizMessage.js.map +1 -1
- package/propUtils.js +37 -16
- package/propUtils.js.map +1 -1
- package/schemaUtils.js +11 -11
- package/schemaUtils.js.map +1 -1
- package/simpleXMLOptions.js +3 -3
- package/simpleXMLOptions.js.map +1 -1
- package/style.js +12 -7
- package/style.js.map +1 -1
- package/testHelper.js +1 -1
- package/testHelper.js.map +1 -1
- package/themeUtils.js +9 -8
- package/themeUtils.js.map +1 -1
- package/trellisUtils.js +63 -19
- package/trellisUtils.js.map +1 -1
package/RemoteIcon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///external \"react\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///external \"@babel/runtime/helpers/taggedTemplateLiteral\"","webpack:///external \"styled-components\"","webpack:///./src/style.js","webpack:///external \"lodash/isNumber\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///./src/iconUtils.js","webpack:///external \"xmlserializer\"","webpack:///external \"@splunk/visualization-context/IconContext\"","webpack:///./src/RemoteIcon.jsx"],"names":["toPx","number","defaultNumber","arguments","length","undefined","isNumber","concat","toDimension","_ref","width","height","css","arrayToCSSProp","prop","vals","Array","isArray","toMargin","margins","toPadding","paddings","isRemoteIcon","icon","indexOf","isDataURI","startsWith","shouldChangeFill","fillAttr","fillStyle","strokeAttr","strokeStyle","noneFillAttr","noneFillStyle","noFillHasStroke","shouldChangeStroke","_ref2","noneStrokeAttr","noneStrokeStyle","hasFill","noStroke","b64EncodeUnicode","str","btoa","encodeURIComponent","replace","match","p1","String","fromCharCode","IconContainer","styled","div","_templateObject","_taggedTemplateLiteral","props","onClick","ColoredIcon","img","_templateObject2","opacity","RemoteIcon","_PureComponent","_inherits","_super","_createSuper","_this","_classCallCheck","call","state","iconDataURI","_createClass","key","value","UNSAFE_componentWillMount","getIcon","iconURL","color","componentDidUpdate","prevProps","_getIcon","_asyncToGenerator","_regeneratorRuntime","mark","_callee2","_this2","getIconDataURI","wrap","_callee2$","_context2","prev","next","_callee","iconRegistry","_callee$","_context","isRegistryURL","context","getByURL","sent","abrupt","dataURI","t0","console","error","_","stop","apply","colorIcon","setState","_x","_x2","src","_src$split","split","_src$split2","_slicedToArray","type","_this3","fetch","then","response","text","parser","DOMParser","xmlDoc","parseFromString","svg","getElementsByTagName","children","querySelectorAll","style","i","child","BASIC_SHAPES","includes","tagName","getAttribute","fill","stroke","setAttribute","svgStr","xmlserializer","serializeToString","catch","render","_this$props","onIconClick","React","createElement","alt","referrerPolicy","PureComponent","_defineProperty","IconContext","T","string","func"],"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,uC;;;;;;ACAA,kC;;;;;;;ACAA,kE;;;;;;ACAA,kE;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;ACAA,kD;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;ACAA,uD;;;;;;ACAA,iE;;;;;;ACAA,yE;;;;;;ACAA,8C;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;A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QACRuD,GAAG,EAAE1C,WAAY;QACjBgF,GAAG,EAAC,aAAa;QACjB5I,KAAK,EAAEA,KAAM;QACbC,MAAM,EAAEA,MAAO;QACfiD,OAAO,EAAEA,OAAQ;QACjB2F,cAAc,EAAC;MAAa,EAC9B,CACU;IAExB;EAAC;EAAA,OAAA1F,UAAA;AAAA,EAxJoB2F,oDAAa;AAAAC,4EAAA,CAAhC5F,UAAU,iBACS6F,iFAAW;AAAAD,4EAAA,CAD9B5F,UAAU,eAGO;EACfe,OAAO,EAAE+E,kDAAC,CAACC,MAAM;EACjB/E,KAAK,EAAE8E,kDAAC,CAACC,MAAM;EACflJ,KAAK,EAAEiJ,kDAAC,CAAC1J,MAAM;EACfU,MAAM,EAAEgJ,kDAAC,CAAC1J,MAAM;EAChB2D,OAAO,EAAE+F,kDAAC,CAAC1J,MAAM;EACjBkJ,WAAW,EAAEQ,kDAAC,CAACE;AACnB,CAAC;AAAAJ,4EAAA,CAVC5F,UAAU,kBAYU;EAClBnD,KAAK,EAAE,GAAG;EACVC,MAAM,EAAE,GAAG;EACXiD,OAAO,EAAE;AACb,CAAC;AAAA6F,4EAAA,CAhBC5F,UAAU,kBAkBU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC;AAyI/EA,yEAAU,E","file":"RemoteIcon.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 = 46);\n","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","module.exports = require(\"@babel/runtime/helpers/taggedTemplateLiteral\");","module.exports = require(\"styled-components\");","import isNumber from 'lodash/isNumber';\n\n/**\n * convert number to px\n * @param {*} number\n */\nexport const toPx = (number, defaultNumber = 0) =>\n isNumber(number) ? `${number}px` : number || toPx(defaultNumber);\n\n/**\n * generate width/height css properties\n * @param {*} param0\n */\nexport const toDimension = ({ width, height }) => {\n let css = '';\n if (width) {\n css = `width: ${toPx(width)};`;\n }\n if (height) {\n // only add a linebreak if width was also set\n css = `${css}${width ? '\\n' : ''}height: ${toPx(height)};`;\n }\n return css;\n};\n\n/**\n * generate margin css property\n */\nexport const arrayToCSSProp = (prop, vals = [0, 0, 0, 0]) => {\n if (Array.isArray(vals)) {\n return `\n ${prop}: ${toPx(vals[0])} ${toPx(vals[1])} ${toPx(vals[2])} ${toPx(vals[3])};\n `;\n }\n\n return `${prop}: ${toPx(vals)};`;\n};\n\n/**\n * generate margin css property\n */\nexport const toMargin = (margins = [0, 0, 0, 0]) => arrayToCSSProp('margin', margins);\n\n/**\n * generate padding css property\n */\nexport const toPadding = (paddings = [0, 0, 0, 0]) => arrayToCSSProp('padding', paddings);\n","module.exports = require(\"lodash/isNumber\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","/**\n * check if an icon is considered as remote icon\n * @param {*} icon\n */\nexport const isRemoteIcon = (icon = '') => icon.indexOf('://') > -1;\n\n/**\n * check if an icon is a dataURI\n * @param {*} icon\n */\nexport const isDataURI = (icon = '') => icon.startsWith('data:image/svg+xml;base64');\n\n/*\n * check whether need update fill for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove fill style and change the fill attribute <path fill=\"currentColor\" />\n */\nexport const shouldChangeFill = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneFillAttr = !!fillAttr && (fillAttr === 'none' || fillAttr === 'transparent');\n const noneFillStyle = !!fillStyle && (fillStyle === 'none' || fillStyle === 'transparent');\n const noFillHasStroke = !fillAttr && !fillStyle && (!!strokeAttr || !!strokeStyle);\n return !(noneFillAttr || noneFillStyle || noFillHasStroke);\n};\n\n/*\n * check whether need update stroke for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove stroke style and change the stroke attribute <path stroke=\"currentColor\" />\n */\nexport const shouldChangeStroke = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneStrokeAttr = !!strokeAttr && (strokeAttr === 'none' || strokeAttr === 'transparent');\n const noneStrokeStyle = !!strokeStyle && (strokeStyle === 'none' || strokeStyle === 'transparent');\n const hasFill = !!fillAttr || !!fillStyle;\n const noStroke = !strokeAttr && !strokeStyle;\n return !(noneStrokeAttr || noneStrokeStyle || hasFill || noStroke);\n};\n\n/*\n * base64 encoding\n * @param {String} str\n * @return {Base64} string using based-64 encoding\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(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode(`0x${p1}`)));\n","module.exports = require(\"xmlserializer\");","module.exports = require(\"@splunk/visualization-context/IconContext\");","/* eslint-disable class-methods-use-this */\nimport React, { PureComponent } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport xmlserializer from 'xmlserializer';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport IconContext from '@splunk/visualization-context/IconContext';\nimport { toDimension } from './style';\nimport { shouldChangeFill, shouldChangeStroke, b64EncodeUnicode } from './iconUtils';\n\nconst IconContainer = styled.div`\n ${props => toDimension({ width: props.width, height: props.height })};\n margin: auto;\n cursor: ${props => (props.onClick ? 'pointer' : 'inherit')};\n`;\nconst ColoredIcon = styled.img`\n ${props => toDimension({ width: props.width, height: props.height })};\n opacity: ${props => props.opacity || 1.0};\n`;\n\nclass RemoteIcon extends PureComponent {\n static contextType = IconContext;\n\n static propTypes = {\n iconURL: T.string,\n color: T.string,\n width: T.number,\n height: T.number,\n opacity: T.number,\n onIconClick: T.func,\n };\n\n static defaultProps = {\n width: 100,\n height: 100,\n opacity: 1.0,\n };\n\n static BASIC_SHAPES = ['path', 'rect', 'circle', 'ellipse', 'line', 'polyline', 'polygon'];\n\n constructor(props) {\n super(props);\n this.state = { iconDataURI: null };\n }\n\n // eslint-disable-next-line camelcase\n UNSAFE_componentWillMount() {\n this.getIcon(this.props.iconURL, this.props.color);\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.iconURL !== this.props.iconURL || prevProps.color !== this.props.color) {\n this.getIcon(this.props.iconURL, this.props.color);\n }\n }\n\n /**\n * Check if the iconURL is a registry URL/dataURI/direct URL and fetch from the registry when required\n * @param {String} iconURL\n * @param {String} color\n */\n async getIcon(iconURL, color) {\n const getIconDataURI = async () => {\n if (this.isRegistryURL(iconURL)) {\n const iconRegistry = this.context;\n if (iconRegistry) {\n try {\n const icon = await iconRegistry.getByURL(iconURL);\n return icon.dataURI;\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(_(error));\n }\n }\n } else {\n return iconURL;\n }\n return null;\n };\n\n const iconDataURI = await getIconDataURI();\n\n if (color) {\n this.colorIcon(iconDataURI, color);\n } else {\n this.setState({ iconDataURI });\n }\n }\n\n /**\n * check if icon is a registry url\n * @param {String} src\n */\n isRegistryURL(src = '') {\n const [type] = src.split('://');\n return type !== 'http' && type !== 'https' && !src.startsWith('data:image/svg+xml;base64');\n }\n\n /*\n * Color the icon:\n * parse svg elements from the dataURI, change color style of svg, and change fill/stroke attribute/style of each svg basic shapes\n * in the svg element to currentColor. At the end, convert the modified svg back to dataURI string.\n *\n * Limitation:\n * if the svg is created with multiple pathes with different fill attributes, this method would\n * convert all pathes' fill attribute to the color prop. It may change the view of the svg icon.\n *\n * @method colorIcon\n * @params {DataURI} dataURI\n * @params {String} color e.g. 'red' || '#ffffff'\n */\n colorIcon(dataURI, color) {\n fetch(dataURI)\n .then(response => response.text())\n .then(text => {\n const parser = new DOMParser();\n const xmlDoc = parser.parseFromString(text, 'text/xml');\n const svg = xmlDoc.getElementsByTagName('svg')[0];\n const children = svg.querySelectorAll('*');\n svg.style.color = color;\n\n // Todo: need move this to IconRegistry after figure out the jest issue with XMLSerializer\n for (let i = 0; i < children.length; i += 1) {\n const child = children[i];\n\n if (RemoteIcon.BASIC_SHAPES.includes(child.tagName)) {\n const fillAttr = child.getAttribute('fill');\n const fillStyle = child.style && child.style.fill;\n const strokeAttr = child.getAttribute('stroke');\n const strokeStyle = child.style && child.style.stroke;\n\n if (shouldChangeFill({ fillAttr, fillStyle, strokeAttr, strokeStyle })) {\n child.style.fill = '';\n child.setAttribute('fill', 'currentColor');\n }\n\n if (shouldChangeStroke({ fillAttr, fillStyle, strokeAttr, strokeStyle })) {\n child.style.stroke = '';\n child.setAttribute('stroke', 'currentColor');\n }\n }\n }\n\n const svgStr = b64EncodeUnicode(xmlserializer.serializeToString(svg));\n const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;\n this.setState({ iconDataURI });\n })\n .catch(() => {\n // eslint-disable-next-line no-console\n console.error(_('The icon cannot be colored properly.'));\n });\n }\n\n render() {\n const { iconDataURI } = this.state;\n const { width, height, opacity, onIconClick } = this.props;\n\n if (!iconDataURI) {\n return null;\n }\n return (\n <IconContainer width={width} height={height} onClick={onIconClick}>\n <ColoredIcon\n src={iconDataURI}\n alt=\"Remote Icon\"\n width={width}\n height={height}\n opacity={opacity}\n referrerPolicy=\"no-referrer\"\n />\n </IconContainer>\n );\n }\n}\n\nexport default RemoteIcon;\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///external \"react\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///external \"@babel/runtime/helpers/taggedTemplateLiteral\"","webpack:///external \"styled-components\"","webpack:///./src/style.js","webpack:///external \"lodash/isNumber\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///./src/iconUtils.js","webpack:///external \"xmlserializer\"","webpack:///external \"@splunk/visualization-context/IconContext\"","webpack:///./src/RemoteIcon.jsx"],"names":["toPx","defaultNumber","isNumber","number","toDimension","width","height","css","arrayToCSSProp","vals","Array","toMargin","margins","toPadding","paddings","isRemoteIcon","icon","isDataURI","shouldChangeFill","fillAttr","fillStyle","strokeAttr","strokeStyle","noneFillAttr","noneFillStyle","noFillHasStroke","shouldChangeStroke","noneStrokeAttr","noneStrokeStyle","hasFill","noStroke","b64EncodeUnicode","btoa","String","IconContainer","styled","props","ColoredIcon","RemoteIcon","iconDataURI","prevProps","getIconDataURI","iconRegistry","console","_","src","type","fetch","response","parser","xmlDoc","svg","children","i","child","svgStr","xmlserializer","opacity","onIconClick","PureComponent","IconContext","iconURL","T","color","func"],"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,uC;;;;;;ACAA,kC;;;;;;;ACAA,kE;;;;;;ACAA,kE;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;ACAA,kD;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;ACAA,uD;;;;;;ACAA,iE;;;;;;ACAA,yE;;;;;;ACAA,8C;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;;AACO,IAAMA,IAAI,GAAG,SAAPA,IAAO;AAAA,MAASC,aAAT;AAAA,SAChBC,sDAAQ,CAARA,MAAQ,CAARA,6BAAmCC,MAAM,IAAIH,IAAI,CADjC,aACiC,CADjC;AAAb;AAGP;AACA;AACA;AACA;;AACO,IAAMI,WAAW,GAAG,SAAdA,WAAc,OAAuB;AAAA,MAApBC,KAAoB,QAApBA,KAAoB;AAAA,MAAbC,MAAa,QAAbA,MAAa;AA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qDAAa,CAAbA,kBAAhC,GAAgCA,CAAD,CAA/B;AACA,YAAMjB,WAAW,uCAAjB,MAAiB,CAAjB;;AACA,cAAI,CAAJ,SAAc;AAAEA,qBAAW,EAAXA;AAAF,SAAd;AAjCRQ,eAmCW,YAAM;AACT;AACAJ,eAAO,CAAPA,MAAcC,gEAAC,CAAfD,sCAAe,CAAfA;AArCRI;AAuCH;;;WAED,kBAAS;AAAA,UACGR,WADH,GACmB,KADnB,KACmB,CADnB;AAAA,wBAE2C,KAF3C;AAAA,UAEGlC,KAFH;AAAA,UAEUC,MAFV;AAAA,UAEkBmD,OAFlB;AAAA,UAE2BC,WAF3B;;AAIL,UAAI,CAAJ,aAAkB;AACd;AACH;;AACD,0BACI;AAAe,aAAK,EAApB;AAA6B,cAAM,EAAnC;AAA6C,eAAO,EAAEA;AAAtD,sBACI;AACI,WAAG,EADP;AAEI,WAAG,EAFP;AAGI,aAAK,EAHT;AAII,cAAM,EAJV;AAKI,eAAO,EALX;AAMI,sBAAc,EAAC;AANnB,QADJ,CADJ;AAYH;;;;EAxJoBC,oD;;6EAAnBrB,U,iBACmBsB,iF;;6EADnBtB,U,eAGiB;AACfuB,SAAO,EAAEC,kDAAC,CADK;AAEfC,OAAK,EAAED,kDAAC,CAFO;AAGfzD,OAAK,EAAEyD,kDAAC,CAHO;AAIfxD,QAAM,EAAEwD,kDAAC,CAJM;AAKfL,SAAO,EAAEK,kDAAC,CALK;AAMfJ,aAAW,EAAEI,kDAAC,CAACE;AANA,C;;6EAHjB1B,U,kBAYoB;AAClBjC,OAAK,EADa;AAElBC,QAAM,EAFY;AAGlBmD,SAAO,EAAE;AAHS,C;;6EAZpBnB,U,kBAkBoB,oE;;AAyI1B,2E","file":"RemoteIcon.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 = 46);\n","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","module.exports = require(\"@babel/runtime/helpers/taggedTemplateLiteral\");","module.exports = require(\"styled-components\");","import isNumber from 'lodash/isNumber';\n\n/**\n * convert number to px\n * @param {*} number\n */\nexport const toPx = (number, defaultNumber = 0) =>\n isNumber(number) ? `${number}px` : number || toPx(defaultNumber);\n\n/**\n * generate width/height css properties\n * @param {*} param0\n */\nexport const toDimension = ({ width, height }) => {\n let css = '';\n if (width) {\n css = `width: ${toPx(width)};`;\n }\n if (height) {\n // only add a linebreak if width was also set\n css = `${css}${width ? '\\n' : ''}height: ${toPx(height)};`;\n }\n return css;\n};\n\n/**\n * generate margin css property\n */\nexport const arrayToCSSProp = (prop, vals = [0, 0, 0, 0]) => {\n if (Array.isArray(vals)) {\n return `\n ${prop}: ${toPx(vals[0])} ${toPx(vals[1])} ${toPx(vals[2])} ${toPx(vals[3])};\n `;\n }\n\n return `${prop}: ${toPx(vals)};`;\n};\n\n/**\n * generate margin css property\n */\nexport const toMargin = (margins = [0, 0, 0, 0]) => arrayToCSSProp('margin', margins);\n\n/**\n * generate padding css property\n */\nexport const toPadding = (paddings = [0, 0, 0, 0]) => arrayToCSSProp('padding', paddings);\n","module.exports = require(\"lodash/isNumber\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","/**\n * check if an icon is considered as remote icon\n * @param {*} icon\n */\nexport const isRemoteIcon = (icon = '') => icon.indexOf('://') > -1;\n\n/**\n * check if an icon is a dataURI\n * @param {*} icon\n */\nexport const isDataURI = (icon = '') => icon.startsWith('data:image/svg+xml;base64');\n\n/*\n * check whether need update fill for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove fill style and change the fill attribute <path fill=\"currentColor\" />\n */\nexport const shouldChangeFill = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneFillAttr = !!fillAttr && (fillAttr === 'none' || fillAttr === 'transparent');\n const noneFillStyle = !!fillStyle && (fillStyle === 'none' || fillStyle === 'transparent');\n const noFillHasStroke = !fillAttr && !fillStyle && (!!strokeAttr || !!strokeStyle);\n return !(noneFillAttr || noneFillStyle || noFillHasStroke);\n};\n\n/*\n * check whether need update stroke for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove stroke style and change the stroke attribute <path stroke=\"currentColor\" />\n */\nexport const shouldChangeStroke = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneStrokeAttr = !!strokeAttr && (strokeAttr === 'none' || strokeAttr === 'transparent');\n const noneStrokeStyle = !!strokeStyle && (strokeStyle === 'none' || strokeStyle === 'transparent');\n const hasFill = !!fillAttr || !!fillStyle;\n const noStroke = !strokeAttr && !strokeStyle;\n return !(noneStrokeAttr || noneStrokeStyle || hasFill || noStroke);\n};\n\n/*\n * base64 encoding\n * @param {String} str\n * @return {Base64} string using based-64 encoding\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(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode(`0x${p1}`)));\n","module.exports = require(\"xmlserializer\");","module.exports = require(\"@splunk/visualization-context/IconContext\");","/* eslint-disable class-methods-use-this */\nimport React, { PureComponent } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport xmlserializer from 'xmlserializer';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport IconContext from '@splunk/visualization-context/IconContext';\nimport { toDimension } from './style';\nimport { shouldChangeFill, shouldChangeStroke, b64EncodeUnicode } from './iconUtils';\n\nconst IconContainer = styled.div`\n ${props => toDimension({ width: props.width, height: props.height })};\n margin: auto;\n cursor: ${props => (props.onClick ? 'pointer' : 'inherit')};\n`;\nconst ColoredIcon = styled.img`\n ${props => toDimension({ width: props.width, height: props.height })};\n opacity: ${props => props.opacity || 1.0};\n`;\n\nclass RemoteIcon extends PureComponent {\n static contextType = IconContext;\n\n static propTypes = {\n iconURL: T.string,\n color: T.string,\n width: T.number,\n height: T.number,\n opacity: T.number,\n onIconClick: T.func,\n };\n\n static defaultProps = {\n width: 100,\n height: 100,\n opacity: 1.0,\n };\n\n static BASIC_SHAPES = ['path', 'rect', 'circle', 'ellipse', 'line', 'polyline', 'polygon'];\n\n constructor(props) {\n super(props);\n this.state = { iconDataURI: null };\n }\n\n // eslint-disable-next-line camelcase\n UNSAFE_componentWillMount() {\n this.getIcon(this.props.iconURL, this.props.color);\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.iconURL !== this.props.iconURL || prevProps.color !== this.props.color) {\n this.getIcon(this.props.iconURL, this.props.color);\n }\n }\n\n /**\n * Check if the iconURL is a registry URL/dataURI/direct URL and fetch from the registry when required\n * @param {String} iconURL\n * @param {String} color\n */\n async getIcon(iconURL, color) {\n const getIconDataURI = async () => {\n if (this.isRegistryURL(iconURL)) {\n const iconRegistry = this.context;\n if (iconRegistry) {\n try {\n const icon = await iconRegistry.getByURL(iconURL);\n return icon.dataURI;\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(_(error));\n }\n }\n } else {\n return iconURL;\n }\n return null;\n };\n\n const iconDataURI = await getIconDataURI();\n\n if (color) {\n this.colorIcon(iconDataURI, color);\n } else {\n this.setState({ iconDataURI });\n }\n }\n\n /**\n * check if icon is a registry url\n * @param {String} src\n */\n isRegistryURL(src = '') {\n const [type] = src.split('://');\n return type !== 'http' && type !== 'https' && !src.startsWith('data:image/svg+xml;base64');\n }\n\n /*\n * Color the icon:\n * parse svg elements from the dataURI, change color style of svg, and change fill/stroke attribute/style of each svg basic shapes\n * in the svg element to currentColor. At the end, convert the modified svg back to dataURI string.\n *\n * Limitation:\n * if the svg is created with multiple pathes with different fill attributes, this method would\n * convert all pathes' fill attribute to the color prop. It may change the view of the svg icon.\n *\n * @method colorIcon\n * @params {DataURI} dataURI\n * @params {String} color e.g. 'red' || '#ffffff'\n */\n colorIcon(dataURI, color) {\n fetch(dataURI)\n .then(response => response.text())\n .then(text => {\n const parser = new DOMParser();\n const xmlDoc = parser.parseFromString(text, 'text/xml');\n const svg = xmlDoc.getElementsByTagName('svg')[0];\n const children = svg.querySelectorAll('*');\n svg.style.color = color;\n\n // Todo: need move this to IconRegistry after figure out the jest issue with XMLSerializer\n for (let i = 0; i < children.length; i += 1) {\n const child = children[i];\n\n if (RemoteIcon.BASIC_SHAPES.includes(child.tagName)) {\n const fillAttr = child.getAttribute('fill');\n const fillStyle = child.style && child.style.fill;\n const strokeAttr = child.getAttribute('stroke');\n const strokeStyle = child.style && child.style.stroke;\n\n if (shouldChangeFill({ fillAttr, fillStyle, strokeAttr, strokeStyle })) {\n child.style.fill = '';\n child.setAttribute('fill', 'currentColor');\n }\n\n if (shouldChangeStroke({ fillAttr, fillStyle, strokeAttr, strokeStyle })) {\n child.style.stroke = '';\n child.setAttribute('stroke', 'currentColor');\n }\n }\n }\n\n const svgStr = b64EncodeUnicode(xmlserializer.serializeToString(svg));\n const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;\n this.setState({ iconDataURI });\n })\n .catch(() => {\n // eslint-disable-next-line no-console\n console.error(_('The icon cannot be colored properly.'));\n });\n }\n\n render() {\n const { iconDataURI } = this.state;\n const { width, height, opacity, onIconClick } = this.props;\n\n if (!iconDataURI) {\n return null;\n }\n return (\n <IconContainer width={width} height={height} onClick={onIconClick}>\n <ColoredIcon\n src={iconDataURI}\n alt=\"Remote Icon\"\n width={width}\n height={height}\n opacity={opacity}\n referrerPolicy=\"no-referrer\"\n />\n </IconContainer>\n );\n }\n}\n\nexport default RemoteIcon;\n"],"sourceRoot":""}
|
package/RemoteImage.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Splunk Inc.
|
|
3
3
|
* SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
4
4
|
* in part without a valid written license from Splunk Inc. is PROHIBITED.
|
|
5
5
|
*/
|
|
@@ -272,26 +272,35 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
272
272
|
|
|
273
273
|
|
|
274
274
|
|
|
275
|
+
|
|
275
276
|
var _templateObject;
|
|
276
277
|
|
|
278
|
+
|
|
279
|
+
|
|
277
280
|
function _createSuper(Derived) {
|
|
278
281
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
282
|
+
|
|
279
283
|
return function _createSuperInternal() {
|
|
280
284
|
var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(Derived),
|
|
281
|
-
|
|
285
|
+
result;
|
|
286
|
+
|
|
282
287
|
if (hasNativeReflectConstruct) {
|
|
283
288
|
var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(this).constructor;
|
|
289
|
+
|
|
284
290
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
285
291
|
} else {
|
|
286
292
|
result = Super.apply(this, arguments);
|
|
287
293
|
}
|
|
294
|
+
|
|
288
295
|
return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, result);
|
|
289
296
|
};
|
|
290
297
|
}
|
|
298
|
+
|
|
291
299
|
function _isNativeReflectConstruct() {
|
|
292
300
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
293
301
|
if (Reflect.construct.sham) return false;
|
|
294
302
|
if (typeof Proxy === "function") return true;
|
|
303
|
+
|
|
295
304
|
try {
|
|
296
305
|
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
297
306
|
return true;
|
|
@@ -311,28 +320,39 @@ function _isNativeReflectConstruct() {
|
|
|
311
320
|
* check if an image is considered as remote image
|
|
312
321
|
* @param {*} src
|
|
313
322
|
*/
|
|
323
|
+
|
|
314
324
|
var isRemoteImage = function isRemoteImage() {
|
|
315
325
|
var src = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
326
|
+
|
|
316
327
|
var _src$split = src.split('://'),
|
|
317
|
-
|
|
318
|
-
|
|
328
|
+
_src$split2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_8___default()(_src$split, 1),
|
|
329
|
+
type = _src$split2[0];
|
|
330
|
+
|
|
319
331
|
return src.indexOf('://') > -1 && type !== 'http' && type !== 'https';
|
|
320
332
|
};
|
|
333
|
+
|
|
321
334
|
var toImageDimensions = function toImageDimensions(props) {
|
|
322
335
|
if (props.shouldPreserveAspectRatio) {
|
|
323
336
|
return "\n max-width: 100%;\n max-height: 100%;\n width: auto;\n height: auto;\n ";
|
|
324
337
|
}
|
|
338
|
+
|
|
325
339
|
return Object(_splunk_visualizations_shared_style__WEBPACK_IMPORTED_MODULE_16__["toDimension"])(lodash_pick__WEBPACK_IMPORTED_MODULE_13___default()(props, ['width', 'height']));
|
|
326
340
|
};
|
|
341
|
+
|
|
327
342
|
var Image = styled_components__WEBPACK_IMPORTED_MODULE_12___default.a.img(_templateObject || (_templateObject = _babel_runtime_helpers_taggedTemplateLiteral__WEBPACK_IMPORTED_MODULE_7___default()(["\n display: block;\n ", ";\n"])), function (props) {
|
|
328
343
|
return toImageDimensions(props);
|
|
329
344
|
});
|
|
345
|
+
|
|
330
346
|
var RemoteImage = /*#__PURE__*/function (_PureComponent) {
|
|
331
347
|
_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default()(RemoteImage, _PureComponent);
|
|
348
|
+
|
|
332
349
|
var _super = _createSuper(RemoteImage);
|
|
350
|
+
|
|
333
351
|
function RemoteImage(props) {
|
|
334
352
|
var _this;
|
|
353
|
+
|
|
335
354
|
_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, RemoteImage);
|
|
355
|
+
|
|
336
356
|
_this = _super.call(this, props);
|
|
337
357
|
_this.state = {
|
|
338
358
|
imageDataURI: null,
|
|
@@ -340,6 +360,7 @@ var RemoteImage = /*#__PURE__*/function (_PureComponent) {
|
|
|
340
360
|
};
|
|
341
361
|
return _this;
|
|
342
362
|
}
|
|
363
|
+
|
|
343
364
|
_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(RemoteImage, [{
|
|
344
365
|
key: "componentDidMount",
|
|
345
366
|
value: function componentDidMount() {
|
|
@@ -351,6 +372,7 @@ var RemoteImage = /*#__PURE__*/function (_PureComponent) {
|
|
|
351
372
|
if (prevProps.imageURL !== this.props.imageURL) {
|
|
352
373
|
this.getImage(this.props.imageURL);
|
|
353
374
|
}
|
|
375
|
+
|
|
354
376
|
if (prevProps.preserveAspectRatio !== this.props.preserveAspectRatio) {
|
|
355
377
|
// eslint-disable-next-line react/no-did-update-set-state
|
|
356
378
|
this.setState({
|
|
@@ -368,13 +390,16 @@ var RemoteImage = /*#__PURE__*/function (_PureComponent) {
|
|
|
368
390
|
switch (_context.prev = _context.next) {
|
|
369
391
|
case 0:
|
|
370
392
|
imageRegistry = this.context;
|
|
393
|
+
|
|
371
394
|
if (!imageRegistry) {
|
|
372
395
|
_context.next = 12;
|
|
373
396
|
break;
|
|
374
397
|
}
|
|
398
|
+
|
|
375
399
|
_context.prev = 2;
|
|
376
400
|
_context.next = 5;
|
|
377
401
|
return imageRegistry.getByURL(imageURL);
|
|
402
|
+
|
|
378
403
|
case 5:
|
|
379
404
|
image = _context.sent;
|
|
380
405
|
this.setState({
|
|
@@ -382,11 +407,13 @@ var RemoteImage = /*#__PURE__*/function (_PureComponent) {
|
|
|
382
407
|
});
|
|
383
408
|
_context.next = 12;
|
|
384
409
|
break;
|
|
410
|
+
|
|
385
411
|
case 9:
|
|
386
412
|
_context.prev = 9;
|
|
387
|
-
_context.t0 = _context["catch"](2);
|
|
388
|
-
|
|
413
|
+
_context.t0 = _context["catch"](2); // eslint-disable-next-line no-console
|
|
414
|
+
|
|
389
415
|
console.error(_context.t0);
|
|
416
|
+
|
|
390
417
|
case 12:
|
|
391
418
|
case "end":
|
|
392
419
|
return _context.stop();
|
|
@@ -394,9 +421,11 @@ var RemoteImage = /*#__PURE__*/function (_PureComponent) {
|
|
|
394
421
|
}
|
|
395
422
|
}, _callee, this, [[2, 9]]);
|
|
396
423
|
}));
|
|
424
|
+
|
|
397
425
|
function getImage(_x) {
|
|
398
426
|
return _getImage.apply(this, arguments);
|
|
399
427
|
}
|
|
428
|
+
|
|
400
429
|
return getImage;
|
|
401
430
|
}()
|
|
402
431
|
}, {
|
|
@@ -404,12 +433,14 @@ var RemoteImage = /*#__PURE__*/function (_PureComponent) {
|
|
|
404
433
|
value: function render() {
|
|
405
434
|
var imageDataURI = this.state.imageDataURI;
|
|
406
435
|
var _this$props = this.props,
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
436
|
+
width = _this$props.width,
|
|
437
|
+
height = _this$props.height,
|
|
438
|
+
title = _this$props.title;
|
|
439
|
+
|
|
410
440
|
if (!imageDataURI) {
|
|
411
441
|
return null;
|
|
412
442
|
}
|
|
443
|
+
|
|
413
444
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_10___default.a.createElement(Image, {
|
|
414
445
|
src: imageDataURI,
|
|
415
446
|
shouldPreserveAspectRatio: this.state.preserveAspectRatio,
|
|
@@ -422,9 +453,12 @@ var RemoteImage = /*#__PURE__*/function (_PureComponent) {
|
|
|
422
453
|
});
|
|
423
454
|
}
|
|
424
455
|
}]);
|
|
456
|
+
|
|
425
457
|
return RemoteImage;
|
|
426
458
|
}(react__WEBPACK_IMPORTED_MODULE_10__["PureComponent"]);
|
|
459
|
+
|
|
427
460
|
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(RemoteImage, "contextType", _splunk_visualization_context_ImageContext__WEBPACK_IMPORTED_MODULE_15___default.a);
|
|
461
|
+
|
|
428
462
|
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(RemoteImage, "propTypes", {
|
|
429
463
|
imageURL: prop_types__WEBPACK_IMPORTED_MODULE_11___default.a.string,
|
|
430
464
|
width: prop_types__WEBPACK_IMPORTED_MODULE_11___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_11___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_11___default.a.number]),
|
|
@@ -432,9 +466,11 @@ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(Rem
|
|
|
432
466
|
preserveAspectRatio: prop_types__WEBPACK_IMPORTED_MODULE_11___default.a.bool,
|
|
433
467
|
title: prop_types__WEBPACK_IMPORTED_MODULE_11___default.a.string
|
|
434
468
|
});
|
|
469
|
+
|
|
435
470
|
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(RemoteImage, "defaultProps", {
|
|
436
471
|
preserveAspectRatio: false
|
|
437
472
|
});
|
|
473
|
+
|
|
438
474
|
/* harmony default export */ __webpack_exports__["default"] = (RemoteImage);
|
|
439
475
|
|
|
440
476
|
/***/ })
|
package/RemoteImage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///external \"react\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///external \"@babel/runtime/helpers/taggedTemplateLiteral\"","webpack:///external \"styled-components\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"lodash/pick\"","webpack:///external \"@splunk/visualization-context/ImageContext\"","webpack:///external \"@splunk/visualizations-shared/style\"","webpack:///./src/RemoteImage.jsx"],"names":["isRemoteImage","src","arguments","length","undefined","_src$split","split","_src$split2","_slicedToArray","type","indexOf","toImageDimensions","props","shouldPreserveAspectRatio","toDimension","pick","Image","styled","img","_templateObject","_taggedTemplateLiteral","RemoteImage","_PureComponent","_inherits","_super","_createSuper","_this","_classCallCheck","call","state","imageDataURI","preserveAspectRatio","_createClass","key","value","componentDidMount","getImage","imageURL","componentDidUpdate","prevProps","setState","_getImage","_asyncToGenerator","_regeneratorRuntime","mark","_callee","imageRegistry","image","wrap","_callee$","_context","prev","next","context","getByURL","sent","dataURI","t0","console","error","stop","_x","apply","render","_this$props","width","height","title","React","createElement","alt","_","onError","e","target","PureComponent","_defineProperty","ImageContext","T","string","oneOfType","number","bool"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA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,EAAE;AACzB,CAAC;AAwDUV,0EAAW,E","file":"RemoteImage.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 = 47);\n","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","module.exports = require(\"@babel/runtime/helpers/taggedTemplateLiteral\");","module.exports = require(\"styled-components\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"lodash/pick\");","module.exports = require(\"@splunk/visualization-context/ImageContext\");","module.exports = require(\"@splunk/visualizations-shared/style\");","import React, { PureComponent } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport pick from 'lodash/pick';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageContext from '@splunk/visualization-context/ImageContext';\nimport { toDimension } from '@splunk/visualizations-shared/style';\n\n/**\n * check if an image is considered as remote image\n * @param {*} src\n */\nexport const isRemoteImage = (src = '') => {\n const [type] = src.split('://');\n return src.indexOf('://') > -1 && type !== 'http' && type !== 'https';\n};\n\nconst toImageDimensions = props => {\n if (props.shouldPreserveAspectRatio) {\n return `\n max-width: 100%;\n max-height: 100%;\n width: auto;\n height: auto;\n `;\n }\n return toDimension(pick(props, ['width', 'height']));\n};\n\nconst Image = styled.img`\n display: block;\n ${props => toImageDimensions(props)};\n`;\n\nclass RemoteImage extends PureComponent {\n static contextType = ImageContext;\n\n static propTypes = {\n imageURL: T.string,\n width: T.oneOfType([T.string, T.number]),\n height: T.oneOfType([T.string, T.number]),\n preserveAspectRatio: T.bool,\n title: T.string,\n };\n\n static defaultProps = {\n preserveAspectRatio: false,\n };\n\n constructor(props) {\n super(props);\n this.state = { imageDataURI: null, preserveAspectRatio: props.preserveAspectRatio };\n }\n\n componentDidMount() {\n this.getImage(this.props.imageURL);\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.imageURL !== this.props.imageURL) {\n this.getImage(this.props.imageURL);\n }\n if (prevProps.preserveAspectRatio !== this.props.preserveAspectRatio) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({ preserveAspectRatio: this.props.preserveAspectRatio });\n }\n }\n\n async getImage(imageURL) {\n const imageRegistry = this.context;\n if (imageRegistry) {\n try {\n const image = await imageRegistry.getByURL(imageURL);\n this.setState({ imageDataURI: image.dataURI });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error);\n }\n }\n }\n\n render() {\n const { imageDataURI } = this.state;\n const { width, height, title } = this.props;\n\n if (!imageDataURI) {\n return null;\n }\n return (\n <Image\n src={imageDataURI}\n shouldPreserveAspectRatio={this.state.preserveAspectRatio}\n width={width}\n height={height}\n alt={_(title)}\n onError={e => {\n e.target.alt = _('Image not found');\n }}\n />\n );\n }\n}\n\nexport default RemoteImage;\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///external \"react\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///external \"@babel/runtime/helpers/taggedTemplateLiteral\"","webpack:///external \"styled-components\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"lodash/pick\"","webpack:///external \"@splunk/visualization-context/ImageContext\"","webpack:///external \"@splunk/visualizations-shared/style\"","webpack:///./src/RemoteImage.jsx"],"names":["isRemoteImage","src","type","toImageDimensions","props","toDimension","pick","Image","styled","RemoteImage","imageDataURI","preserveAspectRatio","prevProps","imageRegistry","image","dataURI","console","width","height","title","_","e","PureComponent","ImageContext","imageURL","T","string"],"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,uC;;;;;;ACAA,kC;;;;;;;ACAA,kE;;;;;;ACAA,kE;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;ACAA,kD;;;;;;ACAA,4D;;;;;;ACA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mB,EAAE;AADH,C;;AA0D1B,4E","file":"RemoteImage.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 = 47);\n","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","module.exports = require(\"@babel/runtime/helpers/taggedTemplateLiteral\");","module.exports = require(\"styled-components\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"lodash/pick\");","module.exports = require(\"@splunk/visualization-context/ImageContext\");","module.exports = require(\"@splunk/visualizations-shared/style\");","import React, { PureComponent } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport pick from 'lodash/pick';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageContext from '@splunk/visualization-context/ImageContext';\nimport { toDimension } from '@splunk/visualizations-shared/style';\n\n/**\n * check if an image is considered as remote image\n * @param {*} src\n */\nexport const isRemoteImage = (src = '') => {\n const [type] = src.split('://');\n return src.indexOf('://') > -1 && type !== 'http' && type !== 'https';\n};\n\nconst toImageDimensions = props => {\n if (props.shouldPreserveAspectRatio) {\n return `\n max-width: 100%;\n max-height: 100%;\n width: auto;\n height: auto;\n `;\n }\n return toDimension(pick(props, ['width', 'height']));\n};\n\nconst Image = styled.img`\n display: block;\n ${props => toImageDimensions(props)};\n`;\n\nclass RemoteImage extends PureComponent {\n static contextType = ImageContext;\n\n static propTypes = {\n imageURL: T.string,\n width: T.oneOfType([T.string, T.number]),\n height: T.oneOfType([T.string, T.number]),\n preserveAspectRatio: T.bool,\n title: T.string,\n };\n\n static defaultProps = {\n preserveAspectRatio: false,\n };\n\n constructor(props) {\n super(props);\n this.state = { imageDataURI: null, preserveAspectRatio: props.preserveAspectRatio };\n }\n\n componentDidMount() {\n this.getImage(this.props.imageURL);\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.imageURL !== this.props.imageURL) {\n this.getImage(this.props.imageURL);\n }\n if (prevProps.preserveAspectRatio !== this.props.preserveAspectRatio) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({ preserveAspectRatio: this.props.preserveAspectRatio });\n }\n }\n\n async getImage(imageURL) {\n const imageRegistry = this.context;\n if (imageRegistry) {\n try {\n const image = await imageRegistry.getByURL(imageURL);\n this.setState({ imageDataURI: image.dataURI });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error);\n }\n }\n }\n\n render() {\n const { imageDataURI } = this.state;\n const { width, height, title } = this.props;\n\n if (!imageDataURI) {\n return null;\n }\n return (\n <Image\n src={imageDataURI}\n shouldPreserveAspectRatio={this.state.preserveAspectRatio}\n width={width}\n height={height}\n alt={_(title)}\n onError={e => {\n e.target.alt = _('Image not found');\n }}\n />\n );\n }\n}\n\nexport default RemoteImage;\n"],"sourceRoot":""}
|
package/SanitizeProps.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Splunk Inc.
|
|
3
3
|
* SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
4
4
|
* in part without a valid written license from Splunk Inc. is PROHIBITED.
|
|
5
5
|
*/
|
|
@@ -348,32 +348,32 @@ var createTestSchema = function createTestSchema(optionsSchema) {
|
|
|
348
348
|
type: 'object',
|
|
349
349
|
properties: optionsSchema
|
|
350
350
|
};
|
|
351
|
-
};
|
|
351
|
+
}; // Below 2 regexs are copied from dashboard-framework/packages/dashboard-utils/src/token.jsc
|
|
352
352
|
|
|
353
|
-
|
|
354
|
-
var TOKEN_NAMESPACE_PREFIX_PATTERN = /(\w+:)?/.source;
|
|
355
|
-
// ex: token.name|suh (old-style filter chain)
|
|
353
|
+
var TOKEN_NAMESPACE_PREFIX_PATTERN = /(\w+:)?/.source; // ex: token.name|suh (old-style filter chain)
|
|
356
354
|
// ex: token.name|lower|capitalize (new-style filter chain)
|
|
355
|
+
|
|
357
356
|
var TOKEN_NAME_CHARS_PATTERN = /([^$|:]+?)(\|[|\w]+)?/.source;
|
|
358
|
-
var TOKEN_PATTERN = /\$/.source + TOKEN_NAMESPACE_PREFIX_PATTERN + TOKEN_NAME_CHARS_PATTERN + /\$/.source;
|
|
359
|
-
// rgb and rgba regexes were derived from:
|
|
357
|
+
var TOKEN_PATTERN = /\$/.source + TOKEN_NAMESPACE_PREFIX_PATTERN + TOKEN_NAME_CHARS_PATTERN + /\$/.source; // rgb and rgba regexes were derived from:
|
|
360
358
|
// https://stackoverflow.com/questions/9585973/javascript-regular-expression-for-rgb-values/9586150
|
|
361
359
|
// https://github.com/regexhq/rgba-regex
|
|
362
360
|
// NOTE: this will incorrectly accept values like rgb(999,999,999), but may be overkill to specify a regex that limits values to <= 255
|
|
361
|
+
|
|
363
362
|
var rgbColorPattern = /^rgb\(\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/;
|
|
364
|
-
var rgbaColorPattern = /^rgba\(\s*(\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d*(?:\.\d+)?)\)$/;
|
|
365
|
-
|
|
363
|
+
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.
|
|
364
|
+
|
|
366
365
|
var colorPattern = '^#[0-9a-fA-F]{6}$|transparent';
|
|
367
366
|
var colorPatternWithRGBA = "".concat(colorPattern, "|").concat(rgbColorPattern.source, "|").concat(rgbaColorPattern.source);
|
|
368
367
|
var COLOR_OR_TOKEN_PATTERN = "".concat(colorPattern, "|").concat(TOKEN_PATTERN);
|
|
369
|
-
var COLOR_OR_TOKEN_PATTERN_WITH_RGBA = "".concat(colorPatternWithRGBA, "|").concat(TOKEN_PATTERN);
|
|
370
|
-
|
|
368
|
+
var COLOR_OR_TOKEN_PATTERN_WITH_RGBA = "".concat(colorPatternWithRGBA, "|").concat(TOKEN_PATTERN); // dynamic option DSL expressions always start with a >
|
|
369
|
+
|
|
371
370
|
var DYNAMIC_OPTIONS_DSL_PATTERN = /^>.*/.source;
|
|
372
371
|
/**
|
|
373
372
|
* Returns the regex string that matches each passed in value as well as tokens.
|
|
374
373
|
* @param {Array.<string>} values
|
|
375
374
|
* @returns {string}
|
|
376
375
|
*/
|
|
376
|
+
|
|
377
377
|
var getPattern = function getPattern(values) {
|
|
378
378
|
return values.reduce(function (accumulator, value) {
|
|
379
379
|
return "".concat(accumulator, "|^").concat(value, "$");
|
|
@@ -390,8 +390,8 @@ var getPattern = function getPattern(values) {
|
|
|
390
390
|
|
|
391
391
|
Object.defineProperty(exports, "__esModule", {
|
|
392
392
|
value: true
|
|
393
|
-
});
|
|
394
|
-
|
|
393
|
+
}); // Reference - https://www.w3.org/TR/css-color-4/#named-colors
|
|
394
|
+
|
|
395
395
|
exports.default = ['transparent', 'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightslategrey', 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'rebeccapurple', 'red', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen'];
|
|
396
396
|
|
|
397
397
|
/***/ }),
|
|
@@ -406,7 +406,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
406
406
|
value: true
|
|
407
407
|
});
|
|
408
408
|
exports.sanitizeArrayOfColors = exports.isArrayOfColors = exports.isColor = void 0;
|
|
409
|
+
|
|
409
410
|
var schemaUtils_1 = __webpack_require__(22);
|
|
411
|
+
|
|
410
412
|
var namedColors_1 = __webpack_require__(23);
|
|
411
413
|
/**
|
|
412
414
|
* Validates if a given string is a valid color
|
|
@@ -414,21 +416,28 @@ var namedColors_1 = __webpack_require__(23);
|
|
|
414
416
|
* @param {string} color
|
|
415
417
|
* @returns {boolean}
|
|
416
418
|
*/
|
|
419
|
+
|
|
420
|
+
|
|
417
421
|
function isColor() {
|
|
418
422
|
var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
423
|
+
|
|
419
424
|
if (typeof color !== 'string') {
|
|
420
425
|
return false;
|
|
421
426
|
}
|
|
427
|
+
|
|
422
428
|
if (color.charAt(0) === '#') {
|
|
423
429
|
color = color.substring(1); // eslint-disable-line no-param-reassign
|
|
430
|
+
|
|
424
431
|
return [3, 4, 6, 8].indexOf(color.length) > -1 && !Number.isNaN(parseInt(color, 16));
|
|
425
432
|
}
|
|
433
|
+
|
|
426
434
|
var trimmedColor = color.trim();
|
|
435
|
+
|
|
427
436
|
if (schemaUtils_1.rgbColorPattern.test(trimmedColor) || schemaUtils_1.rgbaColorPattern.test(trimmedColor)) {
|
|
428
437
|
return true;
|
|
429
438
|
}
|
|
430
|
-
|
|
431
|
-
// for future when we want to support rgb | hsl
|
|
439
|
+
|
|
440
|
+
return namedColors_1.default.includes(color.toLowerCase()); // for future when we want to support rgb | hsl
|
|
432
441
|
// return /^(rgb|hsl)a?\((\d+%?(deg|rad|grad|turn)?[,\s]+){2,3}[\s\/]*[\d\.]+%?\)$/i.test(color);
|
|
433
442
|
}
|
|
434
443
|
|
|
@@ -438,9 +447,11 @@ exports.isColor = isColor;
|
|
|
438
447
|
* @param colors
|
|
439
448
|
* @returns
|
|
440
449
|
*/
|
|
450
|
+
|
|
441
451
|
var isArrayOfColors = function isArrayOfColors(colors) {
|
|
442
452
|
return Array.isArray(colors) && colors.every(isColor);
|
|
443
453
|
};
|
|
454
|
+
|
|
444
455
|
exports.isArrayOfColors = isArrayOfColors;
|
|
445
456
|
/**
|
|
446
457
|
* Sanitizes an array of colors `arr` to replace any non-color values with undefined,
|
|
@@ -450,11 +461,13 @@ exports.isArrayOfColors = isArrayOfColors;
|
|
|
450
461
|
* @param {string} fallback
|
|
451
462
|
* @returns {string[]} sanitized array any non-color values replaced with `fallback`
|
|
452
463
|
*/
|
|
464
|
+
|
|
453
465
|
var sanitizeArrayOfColors = function sanitizeArrayOfColors(arr, fallback) {
|
|
454
466
|
return arr.map(function (entry) {
|
|
455
467
|
return isColor(entry) ? entry : fallback;
|
|
456
468
|
});
|
|
457
469
|
};
|
|
470
|
+
|
|
458
471
|
exports.sanitizeArrayOfColors = sanitizeArrayOfColors;
|
|
459
472
|
|
|
460
473
|
/***/ }),
|
|
@@ -470,9 +483,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
470
483
|
});
|
|
471
484
|
exports.withSanitizedProps = exports.sanitize = void 0;
|
|
472
485
|
/* eslint-disable no-param-reassign */
|
|
486
|
+
|
|
473
487
|
var React = __webpack_require__(1);
|
|
488
|
+
|
|
474
489
|
var lodash_1 = __webpack_require__(2);
|
|
490
|
+
|
|
475
491
|
var colorUtils_1 = __webpack_require__(27);
|
|
492
|
+
|
|
476
493
|
var propsKeyValidators = {
|
|
477
494
|
backgroundColor: colorUtils_1.isColor,
|
|
478
495
|
deltaColor: colorUtils_1.isColor,
|
|
@@ -515,6 +532,7 @@ var propsKeyValidators = {
|
|
|
515
532
|
* @param {string} value
|
|
516
533
|
* @returns {boolean}
|
|
517
534
|
*/
|
|
535
|
+
|
|
518
536
|
function isValidProperty(key, value) {
|
|
519
537
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
520
538
|
return hasOwnProperty.call(propsKeyValidators, key) ? propsKeyValidators[key](value) : true;
|
|
@@ -528,6 +546,8 @@ function isValidProperty(key, value) {
|
|
|
528
546
|
* @param {T} props
|
|
529
547
|
* @returns {Partial<T>}
|
|
530
548
|
*/
|
|
549
|
+
|
|
550
|
+
|
|
531
551
|
function sanitize(props) {
|
|
532
552
|
return Object.keys(props).reduce(function (accum, key) {
|
|
533
553
|
if (key === 'options' && (0, lodash_1.isPlainObject)(props.options)) {
|
|
@@ -535,9 +555,11 @@ function sanitize(props) {
|
|
|
535
555
|
} else if (isValidProperty(key, props[key])) {
|
|
536
556
|
accum[key] = props[key];
|
|
537
557
|
}
|
|
558
|
+
|
|
538
559
|
return accum;
|
|
539
560
|
}, {});
|
|
540
561
|
}
|
|
562
|
+
|
|
541
563
|
exports.sanitize = sanitize;
|
|
542
564
|
/**
|
|
543
565
|
* Helper HOC which will sanitize invalid props
|
|
@@ -546,13 +568,16 @@ exports.sanitize = sanitize;
|
|
|
546
568
|
* @param {React.ComponentType} WrappedComponent
|
|
547
569
|
* @returns {React.ComponentType}
|
|
548
570
|
*/
|
|
571
|
+
|
|
549
572
|
function withSanitizedProps(WrappedComponent) {
|
|
550
573
|
var Wrapper = function Wrapper(props) {
|
|
551
574
|
var sanitizedProps = sanitize(props);
|
|
552
575
|
return React.createElement(WrappedComponent, Object.assign({}, sanitizedProps));
|
|
553
576
|
};
|
|
577
|
+
|
|
554
578
|
return Wrapper;
|
|
555
579
|
}
|
|
580
|
+
|
|
556
581
|
exports.withSanitizedProps = withSanitizedProps;
|
|
557
582
|
|
|
558
583
|
/***/ })
|