1 line
31 KiB
JSON
1 line
31 KiB
JSON
{"ast":null,"code":"import \"core-js/modules/es.function.name.js\";\nimport \"core-js/modules/es.array.concat.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 Model from '../../model/Model.js';\nimport { isNameSpecified } from '../../util/model.js';\nimport ComponentModel from '../../model/Component.js';\n\nvar getDefaultSelectorOptions = function getDefaultSelectorOptions(ecModel, type) {\n if (type === 'all') {\n return {\n type: 'all',\n title: ecModel.getLocaleModel().get(['legend', 'selector', 'all'])\n };\n } else if (type === 'inverse') {\n return {\n type: 'inverse',\n title: ecModel.getLocaleModel().get(['legend', 'selector', 'inverse'])\n };\n }\n};\n\nvar LegendModel =\n/** @class */\nfunction (_super) {\n __extends(LegendModel, _super);\n\n function LegendModel() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = LegendModel.type;\n _this.layoutMode = {\n type: 'box',\n // legend.width/height are maxWidth/maxHeight actually,\n // whereas realy width/height is calculated by its content.\n // (Setting {left: 10, right: 10} does not make sense).\n // So consider the case:\n // `setOption({legend: {left: 10});`\n // then `setOption({legend: {right: 10});`\n // The previous `left` should be cleared by setting `ignoreSize`.\n ignoreSize: true\n };\n return _this;\n }\n\n LegendModel.prototype.init = function (option, parentModel, ecModel) {\n this.mergeDefaultAndTheme(option, ecModel);\n option.selected = option.selected || {};\n\n this._updateSelector(option);\n };\n\n LegendModel.prototype.mergeOption = function (option, ecModel) {\n _super.prototype.mergeOption.call(this, option, ecModel);\n\n this._updateSelector(option);\n };\n\n LegendModel.prototype._updateSelector = function (option) {\n var selector = option.selector;\n var ecModel = this.ecModel;\n\n if (selector === true) {\n selector = option.selector = ['all', 'inverse'];\n }\n\n if (zrUtil.isArray(selector)) {\n zrUtil.each(selector, function (item, index) {\n zrUtil.isString(item) && (item = {\n type: item\n });\n selector[index] = zrUtil.merge(item, getDefaultSelectorOptions(ecModel, item.type));\n });\n }\n };\n\n LegendModel.prototype.optionUpdated = function () {\n this._updateData(this.ecModel);\n\n var legendData = this._data; // If selectedMode is single, try to select one\n\n if (legendData[0] && this.get('selectedMode') === 'single') {\n var hasSelected = false; // If has any selected in option.selected\n\n for (var i = 0; i < legendData.length; i++) {\n var name_1 = legendData[i].get('name');\n\n if (this.isSelected(name_1)) {\n // Force to unselect others\n this.select(name_1);\n hasSelected = true;\n break;\n }\n } // Try select the first if selectedMode is single\n\n\n !hasSelected && this.select(legendData[0].get('name'));\n }\n };\n\n LegendModel.prototype._updateData = function (ecModel) {\n var potentialData = [];\n var availableNames = [];\n ecModel.eachRawSeries(function (seriesModel) {\n var seriesName = seriesModel.name;\n availableNames.push(seriesName);\n var isPotential;\n\n if (seriesModel.legendVisualProvider) {\n var provider = seriesModel.legendVisualProvider;\n var names = provider.getAllNames();\n\n if (!ecModel.isSeriesFiltered(seriesModel)) {\n availableNames = availableNames.concat(names);\n }\n\n if (names.length) {\n potentialData = potentialData.concat(names);\n } else {\n isPotential = true;\n }\n } else {\n isPotential = true;\n }\n\n if (isPotential && isNameSpecified(seriesModel)) {\n potentialData.push(seriesModel.name);\n }\n });\n /**\r\n * @type {Array.<string>}\r\n * @private\r\n */\n\n this._availableNames = availableNames; // If legend.data not specified in option, use availableNames as data,\n // which is convinient for user preparing option.\n\n var rawData = this.get('data') || potentialData;\n var legendData = zrUtil.map(rawData, function (dataItem) {\n // Can be string or number\n if (zrUtil.isString(dataItem) || zrUtil.isNumber(dataItem)) {\n dataItem = {\n name: dataItem\n };\n }\n\n return new Model(dataItem, this, this.ecModel);\n }, this);\n /**\r\n * @type {Array.<module:echarts/model/Model>}\r\n * @private\r\n */\n\n this._data = legendData;\n };\n\n LegendModel.prototype.getData = function () {\n return this._data;\n };\n\n LegendModel.prototype.select = function (name) {\n var selected = this.option.selected;\n var selectedMode = this.get('selectedMode');\n\n if (selectedMode === 'single') {\n var data = this._data;\n zrUtil.each(data, function (dataItem) {\n selected[dataItem.get('name')] = false;\n });\n }\n\n selected[name] = true;\n };\n\n LegendModel.prototype.unSelect = function (name) {\n if (this.get('selectedMode') !== 'single') {\n this.option.selected[name] = false;\n }\n };\n\n LegendModel.prototype.toggleSelected = function (name) {\n var selected = this.option.selected; // Default is true\n\n if (!selected.hasOwnProperty(name)) {\n selected[name] = true;\n }\n\n this[selected[name] ? 'unSelect' : 'select'](name);\n };\n\n LegendModel.prototype.allSelect = function () {\n var data = this._data;\n var selected = this.option.selected;\n zrUtil.each(data, function (dataItem) {\n selected[dataItem.get('name', true)] = true;\n });\n };\n\n LegendModel.prototype.inverseSelect = function () {\n var data = this._data;\n var selected = this.option.selected;\n zrUtil.each(data, function (dataItem) {\n var name = dataItem.get('name', true); // Initially, default value is true\n\n if (!selected.hasOwnProperty(name)) {\n selected[name] = true;\n }\n\n selected[name] = !selected[name];\n });\n };\n\n LegendModel.prototype.isSelected = function (name) {\n var selected = this.option.selected;\n return !(selected.hasOwnProperty(name) && !selected[name]) && zrUtil.indexOf(this._availableNames, name) >= 0;\n };\n\n LegendModel.prototype.getOrient = function () {\n return this.get('orient') === 'vertical' ? {\n index: 1,\n name: 'vertical'\n } : {\n index: 0,\n name: 'horizontal'\n };\n };\n\n LegendModel.type = 'legend.plain';\n LegendModel.dependencies = ['series'];\n LegendModel.defaultOption = {\n // zlevel: 0,\n z: 4,\n show: true,\n orient: 'horizontal',\n left: 'center',\n // right: 'center',\n top: 0,\n // bottom: null,\n align: 'auto',\n backgroundColor: 'rgba(0,0,0,0)',\n borderColor: '#ccc',\n borderRadius: 0,\n borderWidth: 0,\n padding: 5,\n itemGap: 10,\n itemWidth: 25,\n itemHeight: 14,\n symbolRotate: 'inherit',\n symbolKeepAspect: true,\n inactiveColor: '#ccc',\n inactiveBorderColor: '#ccc',\n inactiveBorderWidth: 'auto',\n itemStyle: {\n color: 'inherit',\n opacity: 'inherit',\n borderColor: 'inherit',\n borderWidth: 'auto',\n borderCap: 'inherit',\n borderJoin: 'inherit',\n borderDashOffset: 'inherit',\n borderMiterLimit: 'inherit'\n },\n lineStyle: {\n width: 'auto',\n color: 'inherit',\n inactiveColor: '#ccc',\n inactiveWidth: 2,\n opacity: 'inherit',\n type: 'inherit',\n cap: 'inherit',\n join: 'inherit',\n dashOffset: 'inherit',\n miterLimit: 'inherit'\n },\n textStyle: {\n color: '#333'\n },\n selectedMode: true,\n selector: false,\n selectorLabel: {\n show: true,\n borderRadius: 10,\n padding: [3, 5, 3, 5],\n fontSize: 12,\n fontFamily: 'sans-serif',\n color: '#666',\n borderWidth: 1,\n borderColor: '#666'\n },\n emphasis: {\n selectorLabel: {\n show: true,\n color: '#eee',\n backgroundColor: '#666'\n }\n },\n selectorPosition: 'auto',\n selectorItemGap: 7,\n selectorButtonGap: 10,\n tooltip: {\n show: false\n }\n };\n return LegendModel;\n}(ComponentModel);\n\nexport default LegendModel;","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/qingge-Market/qingge-vue/node_modules/echarts/lib/component/legend/LegendModel.js"],"names":["__extends","zrUtil","Model","isNameSpecified","ComponentModel","getDefaultSelectorOptions","ecModel","type","title","getLocaleModel","get","LegendModel","_super","_this","apply","arguments","layoutMode","ignoreSize","prototype","init","option","parentModel","mergeDefaultAndTheme","selected","_updateSelector","mergeOption","call","selector","isArray","each","item","index","isString","merge","optionUpdated","_updateData","legendData","_data","hasSelected","i","length","name_1","isSelected","select","potentialData","availableNames","eachRawSeries","seriesModel","seriesName","name","push","isPotential","legendVisualProvider","provider","names","getAllNames","isSeriesFiltered","concat","_availableNames","rawData","map","dataItem","isNumber","getData","selectedMode","data","unSelect","toggleSelected","hasOwnProperty","allSelect","inverseSelect","indexOf","getOrient","dependencies","defaultOption","z","show","orient","left","top","align","backgroundColor","borderColor","borderRadius","borderWidth","padding","itemGap","itemWidth","itemHeight","symbolRotate","symbolKeepAspect","inactiveColor","inactiveBorderColor","inactiveBorderWidth","itemStyle","color","opacity","borderCap","borderJoin","borderDashOffset","borderMiterLimit","lineStyle","width","inactiveWidth","cap","join","dashOffset","miterLimit","textStyle","selectorLabel","fontSize","fontFamily","emphasis","selectorPosition","selectorItemGap","selectorButtonGap","tooltip"],"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,OAAOC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B,GAA5B;AA0EA,SAAOjE,WAAP;AACD,CAxRD,CAwREP,cAxRF,CAFA;;AA4RA,eAAeO,WAAf","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 Model from '../../model/Model.js';\r\nimport { isNameSpecified } from '../../util/model.js';\r\nimport ComponentModel from '../../model/Component.js';\r\n\r\nvar getDefaultSelectorOptions = function (ecModel, type) {\r\n if (type === 'all') {\r\n return {\r\n type: 'all',\r\n title: ecModel.getLocaleModel().get(['legend', 'selector', 'all'])\r\n };\r\n } else if (type === 'inverse') {\r\n return {\r\n type: 'inverse',\r\n title: ecModel.getLocaleModel().get(['legend', 'selector', 'inverse'])\r\n };\r\n }\r\n};\r\n\r\nvar LegendModel =\r\n/** @class */\r\nfunction (_super) {\r\n __extends(LegendModel, _super);\r\n\r\n function LegendModel() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n\r\n _this.type = LegendModel.type;\r\n _this.layoutMode = {\r\n type: 'box',\r\n // legend.width/height are maxWidth/maxHeight actually,\r\n // whereas realy width/height is calculated by its content.\r\n // (Setting {left: 10, right: 10} does not make sense).\r\n // So consider the case:\r\n // `setOption({legend: {left: 10});`\r\n // then `setOption({legend: {right: 10});`\r\n // The previous `left` should be cleared by setting `ignoreSize`.\r\n ignoreSize: true\r\n };\r\n return _this;\r\n }\r\n\r\n LegendModel.prototype.init = function (option, parentModel, ecModel) {\r\n this.mergeDefaultAndTheme(option, ecModel);\r\n option.selected = option.selected || {};\r\n\r\n this._updateSelector(option);\r\n };\r\n\r\n LegendModel.prototype.mergeOption = function (option, ecModel) {\r\n _super.prototype.mergeOption.call(this, option, ecModel);\r\n\r\n this._updateSelector(option);\r\n };\r\n\r\n LegendModel.prototype._updateSelector = function (option) {\r\n var selector = option.selector;\r\n var ecModel = this.ecModel;\r\n\r\n if (selector === true) {\r\n selector = option.selector = ['all', 'inverse'];\r\n }\r\n\r\n if (zrUtil.isArray(selector)) {\r\n zrUtil.each(selector, function (item, index) {\r\n zrUtil.isString(item) && (item = {\r\n type: item\r\n });\r\n selector[index] = zrUtil.merge(item, getDefaultSelectorOptions(ecModel, item.type));\r\n });\r\n }\r\n };\r\n\r\n LegendModel.prototype.optionUpdated = function () {\r\n this._updateData(this.ecModel);\r\n\r\n var legendData = this._data; // If selectedMode is single, try to select one\r\n\r\n if (legendData[0] && this.get('selectedMode') === 'single') {\r\n var hasSelected = false; // If has any selected in option.selected\r\n\r\n for (var i = 0; i < legendData.length; i++) {\r\n var name_1 = legendData[i].get('name');\r\n\r\n if (this.isSelected(name_1)) {\r\n // Force to unselect others\r\n this.select(name_1);\r\n hasSelected = true;\r\n break;\r\n }\r\n } // Try select the first if selectedMode is single\r\n\r\n\r\n !hasSelected && this.select(legendData[0].get('name'));\r\n }\r\n };\r\n\r\n LegendModel.prototype._updateData = function (ecModel) {\r\n var potentialData = [];\r\n var availableNames = [];\r\n ecModel.eachRawSeries(function (seriesModel) {\r\n var seriesName = seriesModel.name;\r\n availableNames.push(seriesName);\r\n var isPotential;\r\n\r\n if (seriesModel.legendVisualProvider) {\r\n var provider = seriesModel.legendVisualProvider;\r\n var names = provider.getAllNames();\r\n\r\n if (!ecModel.isSeriesFiltered(seriesModel)) {\r\n availableNames = availableNames.concat(names);\r\n }\r\n\r\n if (names.length) {\r\n potentialData = potentialData.concat(names);\r\n } else {\r\n isPotential = true;\r\n }\r\n } else {\r\n isPotential = true;\r\n }\r\n\r\n if (isPotential && isNameSpecified(seriesModel)) {\r\n potentialData.push(seriesModel.name);\r\n }\r\n });\r\n /**\r\n * @type {Array.<string>}\r\n * @private\r\n */\r\n\r\n this._availableNames = availableNames; // If legend.data not specified in option, use availableNames as data,\r\n // which is convinient for user preparing option.\r\n\r\n var rawData = this.get('data') || potentialData;\r\n var legendData = zrUtil.map(rawData, function (dataItem) {\r\n // Can be string or number\r\n if (zrUtil.isString(dataItem) || zrUtil.isNumber(dataItem)) {\r\n dataItem = {\r\n name: dataItem\r\n };\r\n }\r\n\r\n return new Model(dataItem, this, this.ecModel);\r\n }, this);\r\n /**\r\n * @type {Array.<module:echarts/model/Model>}\r\n * @private\r\n */\r\n\r\n this._data = legendData;\r\n };\r\n\r\n LegendModel.prototype.getData = function () {\r\n return this._data;\r\n };\r\n\r\n LegendModel.prototype.select = function (name) {\r\n var selected = this.option.selected;\r\n var selectedMode = this.get('selectedMode');\r\n\r\n if (selectedMode === 'single') {\r\n var data = this._data;\r\n zrUtil.each(data, function (dataItem) {\r\n selected[dataItem.get('name')] = false;\r\n });\r\n }\r\n\r\n selected[name] = true;\r\n };\r\n\r\n LegendModel.prototype.unSelect = function (name) {\r\n if (this.get('selectedMode') !== 'single') {\r\n this.option.selected[name] = false;\r\n }\r\n };\r\n\r\n LegendModel.prototype.toggleSelected = function (name) {\r\n var selected = this.option.selected; // Default is true\r\n\r\n if (!selected.hasOwnProperty(name)) {\r\n selected[name] = true;\r\n }\r\n\r\n this[selected[name] ? 'unSelect' : 'select'](name);\r\n };\r\n\r\n LegendModel.prototype.allSelect = function () {\r\n var data = this._data;\r\n var selected = this.option.selected;\r\n zrUtil.each(data, function (dataItem) {\r\n selected[dataItem.get('name', true)] = true;\r\n });\r\n };\r\n\r\n LegendModel.prototype.inverseSelect = function () {\r\n var data = this._data;\r\n var selected = this.option.selected;\r\n zrUtil.each(data, function (dataItem) {\r\n var name = dataItem.get('name', true); // Initially, default value is true\r\n\r\n if (!selected.hasOwnProperty(name)) {\r\n selected[name] = true;\r\n }\r\n\r\n selected[name] = !selected[name];\r\n });\r\n };\r\n\r\n LegendModel.prototype.isSelected = function (name) {\r\n var selected = this.option.selected;\r\n return !(selected.hasOwnProperty(name) && !selected[name]) && zrUtil.indexOf(this._availableNames, name) >= 0;\r\n };\r\n\r\n LegendModel.prototype.getOrient = function () {\r\n return this.get('orient') === 'vertical' ? {\r\n index: 1,\r\n name: 'vertical'\r\n } : {\r\n index: 0,\r\n name: 'horizontal'\r\n };\r\n };\r\n\r\n LegendModel.type = 'legend.plain';\r\n LegendModel.dependencies = ['series'];\r\n LegendModel.defaultOption = {\r\n // zlevel: 0,\r\n z: 4,\r\n show: true,\r\n orient: 'horizontal',\r\n left: 'center',\r\n // right: 'center',\r\n top: 0,\r\n // bottom: null,\r\n align: 'auto',\r\n backgroundColor: 'rgba(0,0,0,0)',\r\n borderColor: '#ccc',\r\n borderRadius: 0,\r\n borderWidth: 0,\r\n padding: 5,\r\n itemGap: 10,\r\n itemWidth: 25,\r\n itemHeight: 14,\r\n symbolRotate: 'inherit',\r\n symbolKeepAspect: true,\r\n inactiveColor: '#ccc',\r\n inactiveBorderColor: '#ccc',\r\n inactiveBorderWidth: 'auto',\r\n itemStyle: {\r\n color: 'inherit',\r\n opacity: 'inherit',\r\n borderColor: 'inherit',\r\n borderWidth: 'auto',\r\n borderCap: 'inherit',\r\n borderJoin: 'inherit',\r\n borderDashOffset: 'inherit',\r\n borderMiterLimit: 'inherit'\r\n },\r\n lineStyle: {\r\n width: 'auto',\r\n color: 'inherit',\r\n inactiveColor: '#ccc',\r\n inactiveWidth: 2,\r\n opacity: 'inherit',\r\n type: 'inherit',\r\n cap: 'inherit',\r\n join: 'inherit',\r\n dashOffset: 'inherit',\r\n miterLimit: 'inherit'\r\n },\r\n textStyle: {\r\n color: '#333'\r\n },\r\n selectedMode: true,\r\n selector: false,\r\n selectorLabel: {\r\n show: true,\r\n borderRadius: 10,\r\n padding: [3, 5, 3, 5],\r\n fontSize: 12,\r\n fontFamily: 'sans-serif',\r\n color: '#666',\r\n borderWidth: 1,\r\n borderColor: '#666'\r\n },\r\n emphasis: {\r\n selectorLabel: {\r\n show: true,\r\n color: '#eee',\r\n backgroundColor: '#666'\r\n }\r\n },\r\n selectorPosition: 'auto',\r\n selectorItemGap: 7,\r\n selectorButtonGap: 10,\r\n tooltip: {\r\n show: false\r\n }\r\n };\r\n return LegendModel;\r\n}(ComponentModel);\r\n\r\nexport default LegendModel;"]},"metadata":{},"sourceType":"module"} |