1 line
24 KiB
JSON
1 line
24 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.js';\nimport * as componentUtil from '../util/component.js';\nimport { enableClassManagement, parseClassType, isExtendedClass, mountExtend } from '../util/clazz.js';\nimport { makeInner, queryReferringComponents } from '../util/model.js';\nimport * as layout from '../util/layout.js';\nvar inner = makeInner();\n\nvar ComponentModel =\n/** @class */\nfunction (_super) {\n __extends(ComponentModel, _super);\n\n function ComponentModel(option, parentModel, ecModel) {\n var _this = _super.call(this, option, parentModel, ecModel) || this;\n\n _this.uid = componentUtil.getUID('ec_cpt_model');\n return _this;\n }\n\n ComponentModel.prototype.init = function (option, parentModel, ecModel) {\n this.mergeDefaultAndTheme(option, ecModel);\n };\n\n ComponentModel.prototype.mergeDefaultAndTheme = function (option, ecModel) {\n var layoutMode = layout.fetchLayoutMode(this);\n var inputPositionParams = layoutMode ? layout.getLayoutParams(option) : {};\n var themeModel = ecModel.getTheme();\n zrUtil.merge(option, themeModel.get(this.mainType));\n zrUtil.merge(option, this.getDefaultOption());\n\n if (layoutMode) {\n layout.mergeLayoutParam(option, inputPositionParams, layoutMode);\n }\n };\n\n ComponentModel.prototype.mergeOption = function (option, ecModel) {\n zrUtil.merge(this.option, option, true);\n var layoutMode = layout.fetchLayoutMode(this);\n\n if (layoutMode) {\n layout.mergeLayoutParam(this.option, option, layoutMode);\n }\n };\n /**\r\n * Called immediately after `init` or `mergeOption` of this instance called.\r\n */\n\n\n ComponentModel.prototype.optionUpdated = function (newCptOption, isInit) {};\n /**\r\n * [How to declare defaultOption]:\r\n *\r\n * (A) If using class declaration in typescript (since echarts 5):\r\n * ```ts\r\n * import {ComponentOption} from '../model/option.js';\r\n * export interface XxxOption extends ComponentOption {\r\n * aaa: number\r\n * }\r\n * export class XxxModel extends Component {\r\n * static type = 'xxx';\r\n * static defaultOption: XxxOption = {\r\n * aaa: 123\r\n * }\r\n * }\r\n * Component.registerClass(XxxModel);\r\n * ```\r\n * ```ts\r\n * import {inheritDefaultOption} from '../util/component.js';\r\n * import {XxxModel, XxxOption} from './XxxModel.js';\r\n * export interface XxxSubOption extends XxxOption {\r\n * bbb: number\r\n * }\r\n * class XxxSubModel extends XxxModel {\r\n * static defaultOption: XxxSubOption = inheritDefaultOption(XxxModel.defaultOption, {\r\n * bbb: 456\r\n * })\r\n * fn() {\r\n * let opt = this.getDefaultOption();\r\n * // opt is {aaa: 123, bbb: 456}\r\n * }\r\n * }\r\n * ```\r\n *\r\n * (B) If using class extend (previous approach in echarts 3 & 4):\r\n * ```js\r\n * let XxxComponent = Component.extend({\r\n * defaultOption: {\r\n * xx: 123\r\n * }\r\n * })\r\n * ```\r\n * ```js\r\n * let XxxSubComponent = XxxComponent.extend({\r\n * defaultOption: {\r\n * yy: 456\r\n * },\r\n * fn: function () {\r\n * let opt = this.getDefaultOption();\r\n * // opt is {xx: 123, yy: 456}\r\n * }\r\n * })\r\n * ```\r\n */\n\n\n ComponentModel.prototype.getDefaultOption = function () {\n var ctor = this.constructor; // If using class declaration, it is different to travel super class\n // in legacy env and auto merge defaultOption. So if using class\n // declaration, defaultOption should be merged manually.\n\n if (!isExtendedClass(ctor)) {\n // When using ts class, defaultOption must be declared as static.\n return ctor.defaultOption;\n } // FIXME: remove this approach?\n\n\n var fields = inner(this);\n\n if (!fields.defaultOption) {\n var optList = [];\n var clz = ctor;\n\n while (clz) {\n var opt = clz.prototype.defaultOption;\n opt && optList.push(opt);\n clz = clz.superClass;\n }\n\n var defaultOption = {};\n\n for (var i = optList.length - 1; i >= 0; i--) {\n defaultOption = zrUtil.merge(defaultOption, optList[i], true);\n }\n\n fields.defaultOption = defaultOption;\n }\n\n return fields.defaultOption;\n };\n /**\r\n * Notice: always force to input param `useDefault` in case that forget to consider it.\r\n * The same behavior as `modelUtil.parseFinder`.\r\n *\r\n * @param useDefault In many cases like series refer axis and axis refer grid,\r\n * If axis index / axis id not specified, use the first target as default.\r\n * In other cases like dataZoom refer axis, if not specified, measn no refer.\r\n */\n\n\n ComponentModel.prototype.getReferringComponents = function (mainType, opt) {\n var indexKey = mainType + 'Index';\n var idKey = mainType + 'Id';\n return queryReferringComponents(this.ecModel, mainType, {\n index: this.get(indexKey, true),\n id: this.get(idKey, true)\n }, opt);\n };\n\n ComponentModel.prototype.getBoxLayoutParams = function () {\n // Consider itself having box layout configs.\n var boxLayoutModel = this;\n return {\n left: boxLayoutModel.get('left'),\n top: boxLayoutModel.get('top'),\n right: boxLayoutModel.get('right'),\n bottom: boxLayoutModel.get('bottom'),\n width: boxLayoutModel.get('width'),\n height: boxLayoutModel.get('height')\n };\n };\n /**\r\n * Get key for zlevel.\r\n * If developers don't configure zlevel. We will assign zlevel to series based on the key.\r\n * For example, lines with trail effect and progressive series will in an individual zlevel.\r\n */\n\n\n ComponentModel.prototype.getZLevelKey = function () {\n return '';\n };\n\n ComponentModel.prototype.setZLevel = function (zlevel) {\n this.option.zlevel = zlevel;\n };\n\n ComponentModel.protoInitialize = function () {\n var proto = ComponentModel.prototype;\n proto.type = 'component';\n proto.id = '';\n proto.name = '';\n proto.mainType = '';\n proto.subType = '';\n proto.componentIndex = 0;\n }();\n\n return ComponentModel;\n}(Model);\n\nmountExtend(ComponentModel, Model);\nenableClassManagement(ComponentModel);\ncomponentUtil.enableSubTypeDefaulter(ComponentModel);\ncomponentUtil.enableTopologicalTravel(ComponentModel, getDependencies);\n\nfunction getDependencies(componentType) {\n var deps = [];\n zrUtil.each(ComponentModel.getClassesByMainType(componentType), function (clz) {\n deps = deps.concat(clz.dependencies || clz.prototype.dependencies || []);\n }); // Ensure main type.\n\n deps = zrUtil.map(deps, function (type) {\n return parseClassType(type).main;\n }); // Hack dataset for convenience.\n\n if (componentType !== 'dataset' && zrUtil.indexOf(deps, 'dataset') <= 0) {\n deps.unshift('dataset');\n }\n\n return deps;\n}\n\nexport default ComponentModel;","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/qingge-Market/qingge-vue/node_modules/echarts/lib/model/Component.js"],"names":["__extends","zrUtil","Model","componentUtil","enableClassManagement","parseClassType","isExtendedClass","mountExtend","makeInner","queryReferringComponents","layout","inner","ComponentModel","_super","option","parentModel","ecModel","_this","call","uid","getUID","prototype","init","mergeDefaultAndTheme","layoutMode","fetchLayoutMode","inputPositionParams","getLayoutParams","themeModel","getTheme","merge","get","mainType","getDefaultOption","mergeLayoutParam","mergeOption","optionUpdated","newCptOption","isInit","ctor","constructor","defaultOption","fields","optList","clz","opt","push","superClass","i","length","getReferringComponents","indexKey","idKey","index","id","getBoxLayoutParams","boxLayoutModel","left","top","right","bottom","width","height","getZLevelKey","setZLevel","zlevel","protoInitialize","proto","type","name","subType","componentIndex","enableSubTypeDefaulter","enableTopologicalTravel","getDependencies","componentType","deps","each","getClassesByMainType","concat","dependencies","map","main","indexOf","unshift"],"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,KAAP,MAAkB,YAAlB;AACA,OAAO,KAAKC,aAAZ,MAA+B,sBAA/B;AACA,SAASC,qBAAT,EAAgCC,cAAhC,EAAgDC,eAAhD,EAAiEC,WAAjE,QAAoF,kBAApF;AACA,SAASC,SAAT,EAAoBC,wBAApB,QAAoD,kBAApD;AACA,OAAO,KAAKC,MAAZ,MAAwB,mBAAxB;AACA,IAAIC,KAAK,GAAGH,SAAS,EAArB;;AAEA,IAAII,cAAc;AAClB;AACA,UAAUC,MAAV,EAAkB;AAChBb,EAAAA,SAAS,CAACY,cAAD,EAAiBC,MAAjB,CAAT;;AAEA,WAASD,cAAT,CAAwBE,MAAxB,EAAgCC,WAAhC,EAA6CC,OAA7C,EAAsD;AACpD,QAAIC,KAAK,GAAGJ,MAAM,CAACK,IAAP,CAAY,IAAZ,EAAkBJ,MAAlB,EAA0BC,WAA1B,EAAuCC,OAAvC,KAAmD,IAA/D;;AAEAC,IAAAA,KAAK,CAACE,GAAN,GAAYhB,aAAa,CAACiB,MAAd,CAAqB,cAArB,CAAZ;AACA,WAAOH,KAAP;AACD;;AAEDL,EAAAA,cAAc,CAACS,SAAf,CAAyBC,I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;;AAEJ,MAAIP,aAAa,KAAK,SAAlB,IAA+B1E,MAAM,CAACkF,OAAP,CAAeP,IAAf,EAAqB,SAArB,KAAmC,CAAtE,EAAyE;AACvEA,IAAAA,IAAI,CAACQ,OAAL,CAAa,SAAb;AACD;;AAED,SAAOR,IAAP;AACD;;AAED,eAAehE,cAAf","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.js';\r\nimport * as componentUtil from '../util/component.js';\r\nimport { enableClassManagement, parseClassType, isExtendedClass, mountExtend } from '../util/clazz.js';\r\nimport { makeInner, queryReferringComponents } from '../util/model.js';\r\nimport * as layout from '../util/layout.js';\r\nvar inner = makeInner();\r\n\r\nvar ComponentModel =\r\n/** @class */\r\nfunction (_super) {\r\n __extends(ComponentModel, _super);\r\n\r\n function ComponentModel(option, parentModel, ecModel) {\r\n var _this = _super.call(this, option, parentModel, ecModel) || this;\r\n\r\n _this.uid = componentUtil.getUID('ec_cpt_model');\r\n return _this;\r\n }\r\n\r\n ComponentModel.prototype.init = function (option, parentModel, ecModel) {\r\n this.mergeDefaultAndTheme(option, ecModel);\r\n };\r\n\r\n ComponentModel.prototype.mergeDefaultAndTheme = function (option, ecModel) {\r\n var layoutMode = layout.fetchLayoutMode(this);\r\n var inputPositionParams = layoutMode ? layout.getLayoutParams(option) : {};\r\n var themeModel = ecModel.getTheme();\r\n zrUtil.merge(option, themeModel.get(this.mainType));\r\n zrUtil.merge(option, this.getDefaultOption());\r\n\r\n if (layoutMode) {\r\n layout.mergeLayoutParam(option, inputPositionParams, layoutMode);\r\n }\r\n };\r\n\r\n ComponentModel.prototype.mergeOption = function (option, ecModel) {\r\n zrUtil.merge(this.option, option, true);\r\n var layoutMode = layout.fetchLayoutMode(this);\r\n\r\n if (layoutMode) {\r\n layout.mergeLayoutParam(this.option, option, layoutMode);\r\n }\r\n };\r\n /**\r\n * Called immediately after `init` or `mergeOption` of this instance called.\r\n */\r\n\r\n\r\n ComponentModel.prototype.optionUpdated = function (newCptOption, isInit) {};\r\n /**\r\n * [How to declare defaultOption]:\r\n *\r\n * (A) If using class declaration in typescript (since echarts 5):\r\n * ```ts\r\n * import {ComponentOption} from '../model/option.js';\r\n * export interface XxxOption extends ComponentOption {\r\n * aaa: number\r\n * }\r\n * export class XxxModel extends Component {\r\n * static type = 'xxx';\r\n * static defaultOption: XxxOption = {\r\n * aaa: 123\r\n * }\r\n * }\r\n * Component.registerClass(XxxModel);\r\n * ```\r\n * ```ts\r\n * import {inheritDefaultOption} from '../util/component.js';\r\n * import {XxxModel, XxxOption} from './XxxModel.js';\r\n * export interface XxxSubOption extends XxxOption {\r\n * bbb: number\r\n * }\r\n * class XxxSubModel extends XxxModel {\r\n * static defaultOption: XxxSubOption = inheritDefaultOption(XxxModel.defaultOption, {\r\n * bbb: 456\r\n * })\r\n * fn() {\r\n * let opt = this.getDefaultOption();\r\n * // opt is {aaa: 123, bbb: 456}\r\n * }\r\n * }\r\n * ```\r\n *\r\n * (B) If using class extend (previous approach in echarts 3 & 4):\r\n * ```js\r\n * let XxxComponent = Component.extend({\r\n * defaultOption: {\r\n * xx: 123\r\n * }\r\n * })\r\n * ```\r\n * ```js\r\n * let XxxSubComponent = XxxComponent.extend({\r\n * defaultOption: {\r\n * yy: 456\r\n * },\r\n * fn: function () {\r\n * let opt = this.getDefaultOption();\r\n * // opt is {xx: 123, yy: 456}\r\n * }\r\n * })\r\n * ```\r\n */\r\n\r\n\r\n ComponentModel.prototype.getDefaultOption = function () {\r\n var ctor = this.constructor; // If using class declaration, it is different to travel super class\r\n // in legacy env and auto merge defaultOption. So if using class\r\n // declaration, defaultOption should be merged manually.\r\n\r\n if (!isExtendedClass(ctor)) {\r\n // When using ts class, defaultOption must be declared as static.\r\n return ctor.defaultOption;\r\n } // FIXME: remove this approach?\r\n\r\n\r\n var fields = inner(this);\r\n\r\n if (!fields.defaultOption) {\r\n var optList = [];\r\n var clz = ctor;\r\n\r\n while (clz) {\r\n var opt = clz.prototype.defaultOption;\r\n opt && optList.push(opt);\r\n clz = clz.superClass;\r\n }\r\n\r\n var defaultOption = {};\r\n\r\n for (var i = optList.length - 1; i >= 0; i--) {\r\n defaultOption = zrUtil.merge(defaultOption, optList[i], true);\r\n }\r\n\r\n fields.defaultOption = defaultOption;\r\n }\r\n\r\n return fields.defaultOption;\r\n };\r\n /**\r\n * Notice: always force to input param `useDefault` in case that forget to consider it.\r\n * The same behavior as `modelUtil.parseFinder`.\r\n *\r\n * @param useDefault In many cases like series refer axis and axis refer grid,\r\n * If axis index / axis id not specified, use the first target as default.\r\n * In other cases like dataZoom refer axis, if not specified, measn no refer.\r\n */\r\n\r\n\r\n ComponentModel.prototype.getReferringComponents = function (mainType, opt) {\r\n var indexKey = mainType + 'Index';\r\n var idKey = mainType + 'Id';\r\n return queryReferringComponents(this.ecModel, mainType, {\r\n index: this.get(indexKey, true),\r\n id: this.get(idKey, true)\r\n }, opt);\r\n };\r\n\r\n ComponentModel.prototype.getBoxLayoutParams = function () {\r\n // Consider itself having box layout configs.\r\n var boxLayoutModel = this;\r\n return {\r\n left: boxLayoutModel.get('left'),\r\n top: boxLayoutModel.get('top'),\r\n right: boxLayoutModel.get('right'),\r\n bottom: boxLayoutModel.get('bottom'),\r\n width: boxLayoutModel.get('width'),\r\n height: boxLayoutModel.get('height')\r\n };\r\n };\r\n /**\r\n * Get key for zlevel.\r\n * If developers don't configure zlevel. We will assign zlevel to series based on the key.\r\n * For example, lines with trail effect and progressive series will in an individual zlevel.\r\n */\r\n\r\n\r\n ComponentModel.prototype.getZLevelKey = function () {\r\n return '';\r\n };\r\n\r\n ComponentModel.prototype.setZLevel = function (zlevel) {\r\n this.option.zlevel = zlevel;\r\n };\r\n\r\n ComponentModel.protoInitialize = function () {\r\n var proto = ComponentModel.prototype;\r\n proto.type = 'component';\r\n proto.id = '';\r\n proto.name = '';\r\n proto.mainType = '';\r\n proto.subType = '';\r\n proto.componentIndex = 0;\r\n }();\r\n\r\n return ComponentModel;\r\n}(Model);\r\n\r\nmountExtend(ComponentModel, Model);\r\nenableClassManagement(ComponentModel);\r\ncomponentUtil.enableSubTypeDefaulter(ComponentModel);\r\ncomponentUtil.enableTopologicalTravel(ComponentModel, getDependencies);\r\n\r\nfunction getDependencies(componentType) {\r\n var deps = [];\r\n zrUtil.each(ComponentModel.getClassesByMainType(componentType), function (clz) {\r\n deps = deps.concat(clz.dependencies || clz.prototype.dependencies || []);\r\n }); // Ensure main type.\r\n\r\n deps = zrUtil.map(deps, function (type) {\r\n return parseClassType(type).main;\r\n }); // Hack dataset for convenience.\r\n\r\n if (componentType !== 'dataset' && zrUtil.indexOf(deps, 'dataset') <= 0) {\r\n deps.unshift('dataset');\r\n }\r\n\r\n return deps;\r\n}\r\n\r\nexport default ComponentModel;"]},"metadata":{},"sourceType":"module"} |