qauMaWeb/node_modules/.cache/babel-loader/023f3169295e599ae3de6e5fcf1...

1 line
23 KiB
JSON

{"ast":null,"code":"/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport ZRText from 'zrender/lib/graphic/Text.js';\nimport { getPaddingFromTooltipModel } from './tooltipMarkup.js';\nimport { throwError } from '../../util/log.js';\n\nvar TooltipRichContent =\n/** @class */\nfunction () {\n function TooltipRichContent(api) {\n this._show = false;\n this._styleCoord = [0, 0, 0, 0];\n this._alwaysShowContent = false;\n this._enterable = true;\n this._zr = api.getZr();\n makeStyleCoord(this._styleCoord, this._zr, api.getWidth() / 2, api.getHeight() / 2);\n }\n /**\n * Update when tooltip is rendered\n */\n\n\n TooltipRichContent.prototype.update = function (tooltipModel) {\n var alwaysShowContent = tooltipModel.get('alwaysShowContent');\n alwaysShowContent && this._moveIfResized(); // update alwaysShowContent\n\n this._alwaysShowContent = alwaysShowContent;\n };\n\n TooltipRichContent.prototype.show = function () {\n if (this._hideTimeout) {\n clearTimeout(this._hideTimeout);\n }\n\n this.el.show();\n this._show = true;\n };\n /**\n * Set tooltip content\n */\n\n\n TooltipRichContent.prototype.setContent = function (content, markupStyleCreator, tooltipModel, borderColor, arrowPosition) {\n var _this = this;\n\n if (zrUtil.isObject(content)) {\n throwError(process.env.NODE_ENV !== 'production' ? 'Passing DOM nodes as content is not supported in richText tooltip!' : '');\n }\n\n if (this.el) {\n this._zr.remove(this.el);\n }\n\n var textStyleModel = tooltipModel.getModel('textStyle');\n this.el = new ZRText({\n style: {\n rich: markupStyleCreator.richTextStyles,\n text: content,\n lineHeight: 22,\n borderWidth: 1,\n borderColor: borderColor,\n textShadowColor: textStyleModel.get('textShadowColor'),\n fill: tooltipModel.get(['textStyle', 'color']),\n padding: getPaddingFromTooltipModel(tooltipModel, 'richText'),\n verticalAlign: 'top',\n align: 'left'\n },\n z: tooltipModel.get('z')\n });\n zrUtil.each(['backgroundColor', 'borderRadius', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY'], function (propName) {\n _this.el.style[propName] = tooltipModel.get(propName);\n });\n zrUtil.each(['textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY'], function (propName) {\n _this.el.style[propName] = textStyleModel.get(propName) || 0;\n });\n\n this._zr.add(this.el);\n\n var self = this;\n this.el.on('mouseover', function () {\n // clear the timeout in hideLater and keep showing tooltip\n if (self._enterable) {\n clearTimeout(self._hideTimeout);\n self._show = true;\n }\n\n self._inContent = true;\n });\n this.el.on('mouseout', function () {\n if (self._enterable) {\n if (self._show) {\n self.hideLater(self._hideDelay);\n }\n }\n\n self._inContent = false;\n });\n };\n\n TooltipRichContent.prototype.setEnterable = function (enterable) {\n this._enterable = enterable;\n };\n\n TooltipRichContent.prototype.getSize = function () {\n var el = this.el;\n var bounding = this.el.getBoundingRect(); // bounding rect does not include shadow. For renderMode richText,\n // if overflow, it will be cut. So calculate them accurately.\n\n var shadowOuterSize = calcShadowOuterSize(el.style);\n return [bounding.width + shadowOuterSize.left + shadowOuterSize.right, bounding.height + shadowOuterSize.top + shadowOuterSize.bottom];\n };\n\n TooltipRichContent.prototype.moveTo = function (x, y) {\n var el = this.el;\n\n if (el) {\n var styleCoord = this._styleCoord;\n makeStyleCoord(styleCoord, this._zr, x, y);\n x = styleCoord[0];\n y = styleCoord[1];\n var style = el.style;\n var borderWidth = mathMaxWith0(style.borderWidth || 0);\n var shadowOuterSize = calcShadowOuterSize(style); // rich text x, y do not include border.\n\n el.x = x + borderWidth + shadowOuterSize.left;\n el.y = y + borderWidth + shadowOuterSize.top;\n el.markRedraw();\n }\n };\n /**\n * when `alwaysShowContent` is true,\n * move the tooltip after chart resized\n */\n\n\n TooltipRichContent.prototype._moveIfResized = function () {\n // The ratio of left to width\n var ratioX = this._styleCoord[2]; // The ratio of top to height\n\n var ratioY = this._styleCoord[3];\n this.moveTo(ratioX * this._zr.getWidth(), ratioY * this._zr.getHeight());\n };\n\n TooltipRichContent.prototype.hide = function () {\n if (this.el) {\n this.el.hide();\n }\n\n this._show = false;\n };\n\n TooltipRichContent.prototype.hideLater = function (time) {\n if (this._show && !(this._inContent && this._enterable) && !this._alwaysShowContent) {\n if (time) {\n this._hideDelay = time; // Set show false to avoid invoke hideLater multiple times\n\n this._show = false;\n this._hideTimeout = setTimeout(zrUtil.bind(this.hide, this), time);\n } else {\n this.hide();\n }\n }\n };\n\n TooltipRichContent.prototype.isShow = function () {\n return this._show;\n };\n\n TooltipRichContent.prototype.dispose = function () {\n this._zr.remove(this.el);\n };\n\n return TooltipRichContent;\n}();\n\nfunction mathMaxWith0(val) {\n return Math.max(0, val);\n}\n\nfunction calcShadowOuterSize(style) {\n var shadowBlur = mathMaxWith0(style.shadowBlur || 0);\n var shadowOffsetX = mathMaxWith0(style.shadowOffsetX || 0);\n var shadowOffsetY = mathMaxWith0(style.shadowOffsetY || 0);\n return {\n left: mathMaxWith0(shadowBlur - shadowOffsetX),\n right: mathMaxWith0(shadowBlur + shadowOffsetX),\n top: mathMaxWith0(shadowBlur - shadowOffsetY),\n bottom: mathMaxWith0(shadowBlur + shadowOffsetY)\n };\n}\n\nfunction makeStyleCoord(out, zr, zrX, zrY) {\n out[0] = zrX;\n out[1] = zrY;\n out[2] = out[0] / zr.getWidth();\n out[3] = out[1] / zr.getHeight();\n}\n\nexport default TooltipRichContent;","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/ElectronicMallVue/node_modules/echarts/lib/component/tooltip/TooltipRichContent.js"],"names":["zrUtil","ZRText","getPaddingFromTooltipModel","throwError","TooltipRichContent","api","_show","_styleCoord","_alwaysShowContent","_enterable","_zr","getZr","makeStyleCoord","getWidth","getHeight","prototype","update","tooltipModel","alwaysShowContent","get","_moveIfResized","show","_hideTimeout","clearTimeout","el","setContent","content","markupStyleCreator","borderColor","arrowPosition","_this","isObject","process","env","NODE_ENV","remove","textStyleModel","getModel","style","rich","richTextStyles","text","lineHeight","borderWidth","textShadowColor","fill","padding","verticalAlign","align","z","each","propName","add","self","on","_inContent","hideLater","_hideDelay","setEnterable","enterable","getSize","bounding","getBoundingRect","shadowOuterSize","calcShadowOuterSize","width","left","right","height","top","bottom","moveTo","x","y","styleCoord","mathMaxWith0","markRedraw","ratioX","ratioY","hide","time","setTimeout","bind","isShow","dispose","val","Math","max","shadowBlur","shadowOffsetX","shadowOffsetY","out","zr","zrX","zrY"],"mappings":"AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,MAAZ,MAA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AASuE,YAAT,CAAsBU,GAAtB,EAA2B;AACzB,SAAOC,IAAI,CAACC,GAAL,CAAS,CAAT,EAAYF,GAAZ,CAAP;AACD;;AAED,SAASrB,mBAAT,CAA6B1B,KAA7B,EAAoC;AAClC,MAAIkD,UAAU,GAAGb,YAAY,CAACrC,KAAK,CAACkD,UAAN,IAAoB,CAArB,CAA7B;AACA,MAAIC,aAAa,GAAGd,YAAY,CAACrC,KAAK,CAACmD,aAAN,IAAuB,CAAxB,CAAhC;AACA,MAAIC,aAAa,GAAGf,YAAY,CAACrC,KAAK,CAACoD,aAAN,IAAuB,CAAxB,CAAhC;AACA,SAAO;AACLxB,IAAAA,IAAI,EAAES,YAAY,CAACa,UAAU,GAAGC,aAAd,CADb;AAELtB,IAAAA,KAAK,EAAEQ,YAAY,CAACa,UAAU,GAAGC,aAAd,CAFd;AAGLpB,IAAAA,GAAG,EAAEM,YAAY,CAACa,UAAU,GAAGE,aAAd,CAHZ;AAILpB,IAAAA,MAAM,EAAEK,YAAY,CAACa,UAAU,GAAGE,aAAd;AAJf,GAAP;AAMD;;AAED,SAAS9E,cAAT,CAAwB+E,GAAxB,EAA6BC,EAA7B,EAAiCC,GAAjC,EAAsCC,GAAtC,EAA2C;AACzCH,EAAAA,GAAG,CAAC,CAAD,CAAH,GAASE,GAAT;AACAF,EAAAA,GAAG,CAAC,CAAD,CAAH,GAASG,GAAT;AACAH,EAAAA,GAAG,CAAC,CAAD,CAAH,GAASA,GAAG,CAAC,CAAD,CAAH,GAASC,EAAE,CAAC/E,QAAH,EAAlB;AACA8E,EAAAA,GAAG,CAAC,CAAD,CAAH,GAASA,GAAG,CAAC,CAAD,CAAH,GAASC,EAAE,CAAC9E,SAAH,EAAlB;AACD;;AAED,eAAeV,kBAAf","sourcesContent":["\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport ZRText from 'zrender/lib/graphic/Text.js';\nimport { getPaddingFromTooltipModel } from './tooltipMarkup.js';\nimport { throwError } from '../../util/log.js';\n\nvar TooltipRichContent =\n/** @class */\nfunction () {\n function TooltipRichContent(api) {\n this._show = false;\n this._styleCoord = [0, 0, 0, 0];\n this._alwaysShowContent = false;\n this._enterable = true;\n this._zr = api.getZr();\n makeStyleCoord(this._styleCoord, this._zr, api.getWidth() / 2, api.getHeight() / 2);\n }\n /**\n * Update when tooltip is rendered\n */\n\n\n TooltipRichContent.prototype.update = function (tooltipModel) {\n var alwaysShowContent = tooltipModel.get('alwaysShowContent');\n alwaysShowContent && this._moveIfResized(); // update alwaysShowContent\n\n this._alwaysShowContent = alwaysShowContent;\n };\n\n TooltipRichContent.prototype.show = function () {\n if (this._hideTimeout) {\n clearTimeout(this._hideTimeout);\n }\n\n this.el.show();\n this._show = true;\n };\n /**\n * Set tooltip content\n */\n\n\n TooltipRichContent.prototype.setContent = function (content, markupStyleCreator, tooltipModel, borderColor, arrowPosition) {\n var _this = this;\n\n if (zrUtil.isObject(content)) {\n throwError(process.env.NODE_ENV !== 'production' ? 'Passing DOM nodes as content is not supported in richText tooltip!' : '');\n }\n\n if (this.el) {\n this._zr.remove(this.el);\n }\n\n var textStyleModel = tooltipModel.getModel('textStyle');\n this.el = new ZRText({\n style: {\n rich: markupStyleCreator.richTextStyles,\n text: content,\n lineHeight: 22,\n borderWidth: 1,\n borderColor: borderColor,\n textShadowColor: textStyleModel.get('textShadowColor'),\n fill: tooltipModel.get(['textStyle', 'color']),\n padding: getPaddingFromTooltipModel(tooltipModel, 'richText'),\n verticalAlign: 'top',\n align: 'left'\n },\n z: tooltipModel.get('z')\n });\n zrUtil.each(['backgroundColor', 'borderRadius', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY'], function (propName) {\n _this.el.style[propName] = tooltipModel.get(propName);\n });\n zrUtil.each(['textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY'], function (propName) {\n _this.el.style[propName] = textStyleModel.get(propName) || 0;\n });\n\n this._zr.add(this.el);\n\n var self = this;\n this.el.on('mouseover', function () {\n // clear the timeout in hideLater and keep showing tooltip\n if (self._enterable) {\n clearTimeout(self._hideTimeout);\n self._show = true;\n }\n\n self._inContent = true;\n });\n this.el.on('mouseout', function () {\n if (self._enterable) {\n if (self._show) {\n self.hideLater(self._hideDelay);\n }\n }\n\n self._inContent = false;\n });\n };\n\n TooltipRichContent.prototype.setEnterable = function (enterable) {\n this._enterable = enterable;\n };\n\n TooltipRichContent.prototype.getSize = function () {\n var el = this.el;\n var bounding = this.el.getBoundingRect(); // bounding rect does not include shadow. For renderMode richText,\n // if overflow, it will be cut. So calculate them accurately.\n\n var shadowOuterSize = calcShadowOuterSize(el.style);\n return [bounding.width + shadowOuterSize.left + shadowOuterSize.right, bounding.height + shadowOuterSize.top + shadowOuterSize.bottom];\n };\n\n TooltipRichContent.prototype.moveTo = function (x, y) {\n var el = this.el;\n\n if (el) {\n var styleCoord = this._styleCoord;\n makeStyleCoord(styleCoord, this._zr, x, y);\n x = styleCoord[0];\n y = styleCoord[1];\n var style = el.style;\n var borderWidth = mathMaxWith0(style.borderWidth || 0);\n var shadowOuterSize = calcShadowOuterSize(style); // rich text x, y do not include border.\n\n el.x = x + borderWidth + shadowOuterSize.left;\n el.y = y + borderWidth + shadowOuterSize.top;\n el.markRedraw();\n }\n };\n /**\n * when `alwaysShowContent` is true,\n * move the tooltip after chart resized\n */\n\n\n TooltipRichContent.prototype._moveIfResized = function () {\n // The ratio of left to width\n var ratioX = this._styleCoord[2]; // The ratio of top to height\n\n var ratioY = this._styleCoord[3];\n this.moveTo(ratioX * this._zr.getWidth(), ratioY * this._zr.getHeight());\n };\n\n TooltipRichContent.prototype.hide = function () {\n if (this.el) {\n this.el.hide();\n }\n\n this._show = false;\n };\n\n TooltipRichContent.prototype.hideLater = function (time) {\n if (this._show && !(this._inContent && this._enterable) && !this._alwaysShowContent) {\n if (time) {\n this._hideDelay = time; // Set show false to avoid invoke hideLater multiple times\n\n this._show = false;\n this._hideTimeout = setTimeout(zrUtil.bind(this.hide, this), time);\n } else {\n this.hide();\n }\n }\n };\n\n TooltipRichContent.prototype.isShow = function () {\n return this._show;\n };\n\n TooltipRichContent.prototype.dispose = function () {\n this._zr.remove(this.el);\n };\n\n return TooltipRichContent;\n}();\n\nfunction mathMaxWith0(val) {\n return Math.max(0, val);\n}\n\nfunction calcShadowOuterSize(style) {\n var shadowBlur = mathMaxWith0(style.shadowBlur || 0);\n var shadowOffsetX = mathMaxWith0(style.shadowOffsetX || 0);\n var shadowOffsetY = mathMaxWith0(style.shadowOffsetY || 0);\n return {\n left: mathMaxWith0(shadowBlur - shadowOffsetX),\n right: mathMaxWith0(shadowBlur + shadowOffsetX),\n top: mathMaxWith0(shadowBlur - shadowOffsetY),\n bottom: mathMaxWith0(shadowBlur + shadowOffsetY)\n };\n}\n\nfunction makeStyleCoord(out, zr, zrX, zrY) {\n out[0] = zrX;\n out[1] = zrY;\n out[2] = out[0] / zr.getWidth();\n out[3] = out[1] / zr.getHeight();\n}\n\nexport default TooltipRichContent;"]},"metadata":{},"sourceType":"module"}