qauMaWeb/node_modules/.cache/babel-loader/11dfcde1718276b7ba574c19f37...

1 line
24 KiB
JSON

{"ast":null,"code":"import \"core-js/modules/es.array.fill.js\";\n\n/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\n\n/**\r\n * AUTO-GENERATED FILE. DO NOT MODIFY.\r\n */\n\n/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { __extends } from \"tslib\";\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport * as graphic from '../../util/graphic.js';\nimport { getECData } from '../../util/innerStore.js';\nimport { createTextStyle } from '../../label/labelStyle.js';\nimport { getLayoutRect } from '../../util/layout.js';\nimport ComponentModel from '../../model/Component.js';\nimport ComponentView from '../../view/Component.js';\nimport { windowOpen } from '../../util/format.js';\n\nvar TitleModel =\n/** @class */\nfunction (_super) {\n __extends(TitleModel, _super);\n\n function TitleModel() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = TitleModel.type;\n _this.layoutMode = {\n type: 'box',\n ignoreSize: true\n };\n return _this;\n }\n\n TitleModel.type = 'title';\n TitleModel.defaultOption = {\n // zlevel: 0,\n z: 6,\n show: true,\n text: '',\n target: 'blank',\n subtext: '',\n subtarget: 'blank',\n left: 0,\n top: 0,\n backgroundColor: 'rgba(0,0,0,0)',\n borderColor: '#ccc',\n borderWidth: 0,\n padding: 5,\n itemGap: 10,\n textStyle: {\n fontSize: 18,\n fontWeight: 'bold',\n color: '#464646'\n },\n subtextStyle: {\n fontSize: 12,\n color: '#6E7079'\n }\n };\n return TitleModel;\n}(ComponentModel); // View\n\n\nvar TitleView =\n/** @class */\nfunction (_super) {\n __extends(TitleView, _super);\n\n function TitleView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = TitleView.type;\n return _this;\n }\n\n TitleView.prototype.render = function (titleModel, ecModel, api) {\n this.group.removeAll();\n\n if (!titleModel.get('show')) {\n return;\n }\n\n var group = this.group;\n var textStyleModel = titleModel.getModel('textStyle');\n var subtextStyleModel = titleModel.getModel('subtextStyle');\n var textAlign = titleModel.get('textAlign');\n var textVerticalAlign = zrUtil.retrieve2(titleModel.get('textBaseline'), titleModel.get('textVerticalAlign'));\n var textEl = new graphic.Text({\n style: createTextStyle(textStyleModel, {\n text: titleModel.get('text'),\n fill: textStyleModel.getTextColor()\n }, {\n disableBox: true\n }),\n z2: 10\n });\n var textRect = textEl.getBoundingRect();\n var subText = titleModel.get('subtext');\n var subTextEl = new graphic.Text({\n style: createTextStyle(subtextStyleModel, {\n text: subText,\n fill: subtextStyleModel.getTextColor(),\n y: textRect.height + titleModel.get('itemGap'),\n verticalAlign: 'top'\n }, {\n disableBox: true\n }),\n z2: 10\n });\n var link = titleModel.get('link');\n var sublink = titleModel.get('sublink');\n var triggerEvent = titleModel.get('triggerEvent', true);\n textEl.silent = !link && !triggerEvent;\n subTextEl.silent = !sublink && !triggerEvent;\n\n if (link) {\n textEl.on('click', function () {\n windowOpen(link, '_' + titleModel.get('target'));\n });\n }\n\n if (sublink) {\n subTextEl.on('click', function () {\n windowOpen(sublink, '_' + titleModel.get('subtarget'));\n });\n }\n\n getECData(textEl).eventData = getECData(subTextEl).eventData = triggerEvent ? {\n componentType: 'title',\n componentIndex: titleModel.componentIndex\n } : null;\n group.add(textEl);\n subText && group.add(subTextEl); // If no subText, but add subTextEl, there will be an empty line.\n\n var groupRect = group.getBoundingRect();\n var layoutOption = titleModel.getBoxLayoutParams();\n layoutOption.width = groupRect.width;\n layoutOption.height = groupRect.height;\n var layoutRect = getLayoutRect(layoutOption, {\n width: api.getWidth(),\n height: api.getHeight()\n }, titleModel.get('padding')); // Adjust text align based on position\n\n if (!textAlign) {\n // Align left if title is on the left. center and right is same\n textAlign = titleModel.get('left') || titleModel.get('right'); // @ts-ignore\n\n if (textAlign === 'middle') {\n textAlign = 'center';\n } // Adjust layout by text align\n\n\n if (textAlign === 'right') {\n layoutRect.x += layoutRect.width;\n } else if (textAlign === 'center') {\n layoutRect.x += layoutRect.width / 2;\n }\n }\n\n if (!textVerticalAlign) {\n textVerticalAlign = titleModel.get('top') || titleModel.get('bottom'); // @ts-ignore\n\n if (textVerticalAlign === 'center') {\n textVerticalAlign = 'middle';\n }\n\n if (textVerticalAlign === 'bottom') {\n layoutRect.y += layoutRect.height;\n } else if (textVerticalAlign === 'middle') {\n layoutRect.y += layoutRect.height / 2;\n }\n\n textVerticalAlign = textVerticalAlign || 'top';\n }\n\n group.x = layoutRect.x;\n group.y = layoutRect.y;\n group.markRedraw();\n var alignStyle = {\n align: textAlign,\n verticalAlign: textVerticalAlign\n };\n textEl.setStyle(alignStyle);\n subTextEl.setStyle(alignStyle); // Render background\n // Get groupRect again because textAlign has been changed\n\n groupRect = group.getBoundingRect();\n var padding = layoutRect.margin;\n var style = titleModel.getItemStyle(['color', 'opacity']);\n style.fill = titleModel.get('backgroundColor');\n var rect = new graphic.Rect({\n shape: {\n x: groupRect.x - padding[3],\n y: groupRect.y - padding[0],\n width: groupRect.width + padding[1] + padding[3],\n height: groupRect.height + padding[0] + padding[2],\n r: titleModel.get('borderRadius')\n },\n style: style,\n subPixelOptimize: true,\n silent: true\n });\n group.add(rect);\n };\n\n TitleView.type = 'title';\n return TitleView;\n}(ComponentView);\n\nexport function install(registers) {\n registers.registerComponentModel(TitleModel);\n registers.registerComponentView(TitleView);\n}","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/qingge-Market/qingge-vue/node_modules/echarts/lib/component/title/install.js"],"names":["__extends","zrUtil","graphic","getECData","createTextStyle","getLayoutRect","ComponentModel","ComponentView","windowOpen","TitleModel","_super","_this","apply","arguments","type","layoutMode","ignoreSize","defaultOption","z","show","text","target","subtext","subtarget","left","top","backgroundColor","borderColor","borderWidth","padding","itemGap","textStyle","fontSize","fontWeight","color","subtextStyle","TitleView","prototype","render","titleModel","ecModel","api","group","removeAll","get","textStyleModel","getModel","subtextStyleModel","textAlign","textVerticalAlign","retrieve2","textEl","Text","style","fill","getTextColor","disableBox","z2","textRect","getBoundingRect","subText","subTextEl","y","height","verticalAlign","link","sublink","triggerEvent","silent","on","eventData","componentType","componentIndex","add","groupRect","layoutOption","getBoxLayoutParams","width","layoutRect","getWidth","getHeight","x","markRedraw","alignStyle","align","setStyle","margin","getItemStyle","rect","Rect","shape","r","subPixelOptimize","install","registers","registerComponentModel","registerComponentView"],"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,SAASA,SAAT,QAA0B,OAA1B;AACA,OAAO,KAAKC,MAAZ,MAAwB,0BAAxB;AACA,OAAO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SAAOsB,SAAP;AACD,CA9ID,CA8IE7B,aA9IF,CAFA;;AAkJA,OAAO,SAASsF,OAAT,CAAiBC,SAAjB,EAA4B;AACjCA,EAAAA,SAAS,CAACC,sBAAV,CAAiCtF,UAAjC;AACAqF,EAAAA,SAAS,CAACE,qBAAV,CAAgC5D,SAAhC;AACD","sourcesContent":["\r\n/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\r\n\r\n\r\n/**\r\n * AUTO-GENERATED FILE. DO NOT MODIFY.\r\n */\r\n\r\n/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\r\nimport { __extends } from \"tslib\";\r\nimport * as zrUtil from 'zrender/lib/core/util.js';\r\nimport * as graphic from '../../util/graphic.js';\r\nimport { getECData } from '../../util/innerStore.js';\r\nimport { createTextStyle } from '../../label/labelStyle.js';\r\nimport { getLayoutRect } from '../../util/layout.js';\r\nimport ComponentModel from '../../model/Component.js';\r\nimport ComponentView from '../../view/Component.js';\r\nimport { windowOpen } from '../../util/format.js';\r\n\r\nvar TitleModel =\r\n/** @class */\r\nfunction (_super) {\r\n __extends(TitleModel, _super);\r\n\r\n function TitleModel() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n\r\n _this.type = TitleModel.type;\r\n _this.layoutMode = {\r\n type: 'box',\r\n ignoreSize: true\r\n };\r\n return _this;\r\n }\r\n\r\n TitleModel.type = 'title';\r\n TitleModel.defaultOption = {\r\n // zlevel: 0,\r\n z: 6,\r\n show: true,\r\n text: '',\r\n target: 'blank',\r\n subtext: '',\r\n subtarget: 'blank',\r\n left: 0,\r\n top: 0,\r\n backgroundColor: 'rgba(0,0,0,0)',\r\n borderColor: '#ccc',\r\n borderWidth: 0,\r\n padding: 5,\r\n itemGap: 10,\r\n textStyle: {\r\n fontSize: 18,\r\n fontWeight: 'bold',\r\n color: '#464646'\r\n },\r\n subtextStyle: {\r\n fontSize: 12,\r\n color: '#6E7079'\r\n }\r\n };\r\n return TitleModel;\r\n}(ComponentModel); // View\r\n\r\n\r\nvar TitleView =\r\n/** @class */\r\nfunction (_super) {\r\n __extends(TitleView, _super);\r\n\r\n function TitleView() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n\r\n _this.type = TitleView.type;\r\n return _this;\r\n }\r\n\r\n TitleView.prototype.render = function (titleModel, ecModel, api) {\r\n this.group.removeAll();\r\n\r\n if (!titleModel.get('show')) {\r\n return;\r\n }\r\n\r\n var group = this.group;\r\n var textStyleModel = titleModel.getModel('textStyle');\r\n var subtextStyleModel = titleModel.getModel('subtextStyle');\r\n var textAlign = titleModel.get('textAlign');\r\n var textVerticalAlign = zrUtil.retrieve2(titleModel.get('textBaseline'), titleModel.get('textVerticalAlign'));\r\n var textEl = new graphic.Text({\r\n style: createTextStyle(textStyleModel, {\r\n text: titleModel.get('text'),\r\n fill: textStyleModel.getTextColor()\r\n }, {\r\n disableBox: true\r\n }),\r\n z2: 10\r\n });\r\n var textRect = textEl.getBoundingRect();\r\n var subText = titleModel.get('subtext');\r\n var subTextEl = new graphic.Text({\r\n style: createTextStyle(subtextStyleModel, {\r\n text: subText,\r\n fill: subtextStyleModel.getTextColor(),\r\n y: textRect.height + titleModel.get('itemGap'),\r\n verticalAlign: 'top'\r\n }, {\r\n disableBox: true\r\n }),\r\n z2: 10\r\n });\r\n var link = titleModel.get('link');\r\n var sublink = titleModel.get('sublink');\r\n var triggerEvent = titleModel.get('triggerEvent', true);\r\n textEl.silent = !link && !triggerEvent;\r\n subTextEl.silent = !sublink && !triggerEvent;\r\n\r\n if (link) {\r\n textEl.on('click', function () {\r\n windowOpen(link, '_' + titleModel.get('target'));\r\n });\r\n }\r\n\r\n if (sublink) {\r\n subTextEl.on('click', function () {\r\n windowOpen(sublink, '_' + titleModel.get('subtarget'));\r\n });\r\n }\r\n\r\n getECData(textEl).eventData = getECData(subTextEl).eventData = triggerEvent ? {\r\n componentType: 'title',\r\n componentIndex: titleModel.componentIndex\r\n } : null;\r\n group.add(textEl);\r\n subText && group.add(subTextEl); // If no subText, but add subTextEl, there will be an empty line.\r\n\r\n var groupRect = group.getBoundingRect();\r\n var layoutOption = titleModel.getBoxLayoutParams();\r\n layoutOption.width = groupRect.width;\r\n layoutOption.height = groupRect.height;\r\n var layoutRect = getLayoutRect(layoutOption, {\r\n width: api.getWidth(),\r\n height: api.getHeight()\r\n }, titleModel.get('padding')); // Adjust text align based on position\r\n\r\n if (!textAlign) {\r\n // Align left if title is on the left. center and right is same\r\n textAlign = titleModel.get('left') || titleModel.get('right'); // @ts-ignore\r\n\r\n if (textAlign === 'middle') {\r\n textAlign = 'center';\r\n } // Adjust layout by text align\r\n\r\n\r\n if (textAlign === 'right') {\r\n layoutRect.x += layoutRect.width;\r\n } else if (textAlign === 'center') {\r\n layoutRect.x += layoutRect.width / 2;\r\n }\r\n }\r\n\r\n if (!textVerticalAlign) {\r\n textVerticalAlign = titleModel.get('top') || titleModel.get('bottom'); // @ts-ignore\r\n\r\n if (textVerticalAlign === 'center') {\r\n textVerticalAlign = 'middle';\r\n }\r\n\r\n if (textVerticalAlign === 'bottom') {\r\n layoutRect.y += layoutRect.height;\r\n } else if (textVerticalAlign === 'middle') {\r\n layoutRect.y += layoutRect.height / 2;\r\n }\r\n\r\n textVerticalAlign = textVerticalAlign || 'top';\r\n }\r\n\r\n group.x = layoutRect.x;\r\n group.y = layoutRect.y;\r\n group.markRedraw();\r\n var alignStyle = {\r\n align: textAlign,\r\n verticalAlign: textVerticalAlign\r\n };\r\n textEl.setStyle(alignStyle);\r\n subTextEl.setStyle(alignStyle); // Render background\r\n // Get groupRect again because textAlign has been changed\r\n\r\n groupRect = group.getBoundingRect();\r\n var padding = layoutRect.margin;\r\n var style = titleModel.getItemStyle(['color', 'opacity']);\r\n style.fill = titleModel.get('backgroundColor');\r\n var rect = new graphic.Rect({\r\n shape: {\r\n x: groupRect.x - padding[3],\r\n y: groupRect.y - padding[0],\r\n width: groupRect.width + padding[1] + padding[3],\r\n height: groupRect.height + padding[0] + padding[2],\r\n r: titleModel.get('borderRadius')\r\n },\r\n style: style,\r\n subPixelOptimize: true,\r\n silent: true\r\n });\r\n group.add(rect);\r\n };\r\n\r\n TitleView.type = 'title';\r\n return TitleView;\r\n}(ComponentView);\r\n\r\nexport function install(registers) {\r\n registers.registerComponentModel(TitleModel);\r\n registers.registerComponentView(TitleView);\r\n}"]},"metadata":{},"sourceType":"module"}