1 line
21 KiB
JSON
1 line
21 KiB
JSON
{"ast":null,"code":"import \"core-js/modules/es.array.fill.js\";\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*/\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 { __extends } from \"tslib\";\nimport * as graphic from '../../util/graphic.js';\nimport { setStatesStylesFromModel, toggleHoverEmphasis } from '../../util/states.js';\nimport ChartView from '../../view/Chart.js';\nimport { setLabelLineStyle, getLabelLineStatesModels } from '../../label/labelGuideHelper.js';\nimport { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';\nimport { saveOldStyle } from '../../animation/basicTransition.js';\nvar opacityAccessPath = ['itemStyle', 'opacity'];\n/**\n * Piece of pie including Sector, Label, LabelLine\n */\n\nvar FunnelPiece =\n/** @class */\nfunction (_super) {\n __extends(FunnelPiece, _super);\n\n function FunnelPiece(data, idx) {\n var _this = _super.call(this) || this;\n\n var polygon = _this;\n var labelLine = new graphic.Polyline();\n var text = new graphic.Text();\n polygon.setTextContent(text);\n\n _this.setTextGuideLine(labelLine);\n\n _this.updateData(data, idx, true);\n\n return _this;\n }\n\n FunnelPiece.prototype.updateData = function (data, idx, firstCreate) {\n var polygon = this;\n var seriesModel = data.hostModel;\n var itemModel = data.getItemModel(idx);\n var layout = data.getItemLayout(idx);\n var emphasisModel = itemModel.getModel('emphasis');\n var opacity = itemModel.get(opacityAccessPath);\n opacity = opacity == null ? 1 : opacity;\n\n if (!firstCreate) {\n saveOldStyle(polygon);\n } // Update common style\n\n\n polygon.useStyle(data.getItemVisual(idx, 'style'));\n polygon.style.lineJoin = 'round';\n\n if (firstCreate) {\n polygon.setShape({\n points: layout.points\n });\n polygon.style.opacity = 0;\n graphic.initProps(polygon, {\n style: {\n opacity: opacity\n }\n }, seriesModel, idx);\n } else {\n graphic.updateProps(polygon, {\n style: {\n opacity: opacity\n },\n shape: {\n points: layout.points\n }\n }, seriesModel, idx);\n }\n\n setStatesStylesFromModel(polygon, itemModel);\n\n this._updateLabel(data, idx);\n\n toggleHoverEmphasis(this, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));\n };\n\n FunnelPiece.prototype._updateLabel = function (data, idx) {\n var polygon = this;\n var labelLine = this.getTextGuideLine();\n var labelText = polygon.getTextContent();\n var seriesModel = data.hostModel;\n var itemModel = data.getItemModel(idx);\n var layout = data.getItemLayout(idx);\n var labelLayout = layout.label;\n var style = data.getItemVisual(idx, 'style');\n var visualColor = style.fill;\n setLabelStyle( // position will not be used in setLabelStyle\n labelText, getLabelStatesModels(itemModel), {\n labelFetcher: data.hostModel,\n labelDataIndex: idx,\n defaultOpacity: style.opacity,\n defaultText: data.getName(idx)\n }, {\n normal: {\n align: labelLayout.textAlign,\n verticalAlign: labelLayout.verticalAlign\n }\n });\n polygon.setTextConfig({\n local: true,\n inside: !!labelLayout.inside,\n insideStroke: visualColor,\n // insideFill: 'auto',\n outsideFill: visualColor\n });\n var linePoints = labelLayout.linePoints;\n labelLine.setShape({\n points: linePoints\n });\n polygon.textGuideLineConfig = {\n anchor: linePoints ? new graphic.Point(linePoints[0][0], linePoints[0][1]) : null\n }; // Make sure update style on labelText after setLabelStyle.\n // Because setLabelStyle will replace a new style on it.\n\n graphic.updateProps(labelText, {\n style: {\n x: labelLayout.x,\n y: labelLayout.y\n }\n }, seriesModel, idx);\n labelText.attr({\n rotation: labelLayout.rotation,\n originX: labelLayout.x,\n originY: labelLayout.y,\n z2: 10\n });\n setLabelLineStyle(polygon, getLabelLineStatesModels(itemModel), {\n // Default use item visual color\n stroke: visualColor\n });\n };\n\n return FunnelPiece;\n}(graphic.Polygon);\n\nvar FunnelView =\n/** @class */\nfunction (_super) {\n __extends(FunnelView, _super);\n\n function FunnelView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = FunnelView.type;\n _this.ignoreLabelLineUpdate = true;\n return _this;\n }\n\n FunnelView.prototype.render = function (seriesModel, ecModel, api) {\n var data = seriesModel.getData();\n var oldData = this._data;\n var group = this.group;\n data.diff(oldData).add(function (idx) {\n var funnelPiece = new FunnelPiece(data, idx);\n data.setItemGraphicEl(idx, funnelPiece);\n group.add(funnelPiece);\n }).update(function (newIdx, oldIdx) {\n var piece = oldData.getItemGraphicEl(oldIdx);\n piece.updateData(data, newIdx);\n group.add(piece);\n data.setItemGraphicEl(newIdx, piece);\n }).remove(function (idx) {\n var piece = oldData.getItemGraphicEl(idx);\n graphic.removeElementWithFadeOut(piece, seriesModel, idx);\n }).execute();\n this._data = data;\n };\n\n FunnelView.prototype.remove = function () {\n this.group.removeAll();\n this._data = null;\n };\n\n FunnelView.prototype.dispose = function () {};\n\n FunnelView.type = 'funnel';\n return FunnelView;\n}(ChartView);\n\nexport default FunnelView;","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/ElectronicMallVue/node_modules/echarts/lib/chart/funnel/FunnelView.js"],"names":["__extends","graphic","setStatesStylesFromModel","toggleHoverEmphasis","ChartView","setLabelLineStyle","getLabelLineStatesModels","setLabelStyle","getLabelStatesModels","saveOldStyle","opacityAccessPath","FunnelPiece","_super","data","idx","_this","call","polygon","labelLine","Polyline","text","Text","setTextContent","setTextGuideLine","updateData","prototype","firstCreate","seriesModel","hostModel","itemModel","getItemModel","layout","getItemLayout","emphasisModel","getModel","opacity","get","useStyle","getItemVisual","style","lineJoin","setShape","points","initProps","updateProps","shape","_updateLabel","getTextGuideLine","labelText","getTextContent","labelLayout","label","visualColor","fill","labelFetcher","labelDataIndex","defaultOpacity","defaultText","getName","normal","align","textAlign","verticalAlign","setTextConfig","local","inside","insideStroke","outsideFill","linePoints","textGuideLineConfig","anchor","Point","x","y","attr","rotation","originX","originY","z2","stroke","Polygon","FunnelView","apply","arguments","type","ignoreLabelLineUpdate","render","ecModel","api","getData","oldData","_data","group","diff","add","funnelPiece","setItemGraphicEl","update","newIdx","oldIdx","piece","getItemGraphicEl","remove","removeElementWithFadeOut","execute","removeAll","dispose"],"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,OAAZ,MAAyB,uBAAzB;AACA,SAASC,wBAAT,EAAmCC,mBAAnC,QAA8D,sBAA9D;AACA,OAAOC,SAAP,MAAsB,qBAAtB;AACA,SAASC,iBAAT,EAA4BC,wBAA5B,QAA4D,iCAA5D;AACA,SAASC,aAAT,EAAwBC,oBAAxB,QAAoD,2BAApD;AACA,SAASC,YAAT,QAA6B,oCAA7B;AACA,IAAIC,iBAAiB,GAAG,CAAC,WAAD,EAAc,SAAd,CAAxB;AAC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qB6E,MAArB,GAA8B,YAAY;AACxC,SAAKV,KAAL,CAAWa,SAAX;AACA,SAAKd,KAAL,GAAa,IAAb;AACD,GAHD;;AAKAV,EAAAA,UAAU,CAACxD,SAAX,CAAqBiF,OAArB,GAA+B,YAAY,CAAE,CAA7C;;AAEAzB,EAAAA,UAAU,CAACG,IAAX,GAAkB,QAAlB;AACA,SAAOH,UAAP;AACD,CAxCD,CAwCE7E,SAxCF,CAFA;;AA4CA,eAAe6E,UAAf","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 { __extends } from \"tslib\";\nimport * as graphic from '../../util/graphic.js';\nimport { setStatesStylesFromModel, toggleHoverEmphasis } from '../../util/states.js';\nimport ChartView from '../../view/Chart.js';\nimport { setLabelLineStyle, getLabelLineStatesModels } from '../../label/labelGuideHelper.js';\nimport { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';\nimport { saveOldStyle } from '../../animation/basicTransition.js';\nvar opacityAccessPath = ['itemStyle', 'opacity'];\n/**\n * Piece of pie including Sector, Label, LabelLine\n */\n\nvar FunnelPiece =\n/** @class */\nfunction (_super) {\n __extends(FunnelPiece, _super);\n\n function FunnelPiece(data, idx) {\n var _this = _super.call(this) || this;\n\n var polygon = _this;\n var labelLine = new graphic.Polyline();\n var text = new graphic.Text();\n polygon.setTextContent(text);\n\n _this.setTextGuideLine(labelLine);\n\n _this.updateData(data, idx, true);\n\n return _this;\n }\n\n FunnelPiece.prototype.updateData = function (data, idx, firstCreate) {\n var polygon = this;\n var seriesModel = data.hostModel;\n var itemModel = data.getItemModel(idx);\n var layout = data.getItemLayout(idx);\n var emphasisModel = itemModel.getModel('emphasis');\n var opacity = itemModel.get(opacityAccessPath);\n opacity = opacity == null ? 1 : opacity;\n\n if (!firstCreate) {\n saveOldStyle(polygon);\n } // Update common style\n\n\n polygon.useStyle(data.getItemVisual(idx, 'style'));\n polygon.style.lineJoin = 'round';\n\n if (firstCreate) {\n polygon.setShape({\n points: layout.points\n });\n polygon.style.opacity = 0;\n graphic.initProps(polygon, {\n style: {\n opacity: opacity\n }\n }, seriesModel, idx);\n } else {\n graphic.updateProps(polygon, {\n style: {\n opacity: opacity\n },\n shape: {\n points: layout.points\n }\n }, seriesModel, idx);\n }\n\n setStatesStylesFromModel(polygon, itemModel);\n\n this._updateLabel(data, idx);\n\n toggleHoverEmphasis(this, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));\n };\n\n FunnelPiece.prototype._updateLabel = function (data, idx) {\n var polygon = this;\n var labelLine = this.getTextGuideLine();\n var labelText = polygon.getTextContent();\n var seriesModel = data.hostModel;\n var itemModel = data.getItemModel(idx);\n var layout = data.getItemLayout(idx);\n var labelLayout = layout.label;\n var style = data.getItemVisual(idx, 'style');\n var visualColor = style.fill;\n setLabelStyle( // position will not be used in setLabelStyle\n labelText, getLabelStatesModels(itemModel), {\n labelFetcher: data.hostModel,\n labelDataIndex: idx,\n defaultOpacity: style.opacity,\n defaultText: data.getName(idx)\n }, {\n normal: {\n align: labelLayout.textAlign,\n verticalAlign: labelLayout.verticalAlign\n }\n });\n polygon.setTextConfig({\n local: true,\n inside: !!labelLayout.inside,\n insideStroke: visualColor,\n // insideFill: 'auto',\n outsideFill: visualColor\n });\n var linePoints = labelLayout.linePoints;\n labelLine.setShape({\n points: linePoints\n });\n polygon.textGuideLineConfig = {\n anchor: linePoints ? new graphic.Point(linePoints[0][0], linePoints[0][1]) : null\n }; // Make sure update style on labelText after setLabelStyle.\n // Because setLabelStyle will replace a new style on it.\n\n graphic.updateProps(labelText, {\n style: {\n x: labelLayout.x,\n y: labelLayout.y\n }\n }, seriesModel, idx);\n labelText.attr({\n rotation: labelLayout.rotation,\n originX: labelLayout.x,\n originY: labelLayout.y,\n z2: 10\n });\n setLabelLineStyle(polygon, getLabelLineStatesModels(itemModel), {\n // Default use item visual color\n stroke: visualColor\n });\n };\n\n return FunnelPiece;\n}(graphic.Polygon);\n\nvar FunnelView =\n/** @class */\nfunction (_super) {\n __extends(FunnelView, _super);\n\n function FunnelView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = FunnelView.type;\n _this.ignoreLabelLineUpdate = true;\n return _this;\n }\n\n FunnelView.prototype.render = function (seriesModel, ecModel, api) {\n var data = seriesModel.getData();\n var oldData = this._data;\n var group = this.group;\n data.diff(oldData).add(function (idx) {\n var funnelPiece = new FunnelPiece(data, idx);\n data.setItemGraphicEl(idx, funnelPiece);\n group.add(funnelPiece);\n }).update(function (newIdx, oldIdx) {\n var piece = oldData.getItemGraphicEl(oldIdx);\n piece.updateData(data, newIdx);\n group.add(piece);\n data.setItemGraphicEl(newIdx, piece);\n }).remove(function (idx) {\n var piece = oldData.getItemGraphicEl(idx);\n graphic.removeElementWithFadeOut(piece, seriesModel, idx);\n }).execute();\n this._data = data;\n };\n\n FunnelView.prototype.remove = function () {\n this.group.removeAll();\n this._data = null;\n };\n\n FunnelView.prototype.dispose = function () {};\n\n FunnelView.type = 'funnel';\n return FunnelView;\n}(ChartView);\n\nexport default FunnelView;"]},"metadata":{},"sourceType":"module"} |