1 line
27 KiB
JSON
1 line
27 KiB
JSON
{"ast":null,"code":"import \"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 * as modelUtil from '../../util/model.js';\nimport ComponentModel from '../../model/Component.js';\nimport { copyLayoutParams, mergeLayoutParam } from '../../util/layout.js';\n;\n;\n;\nexport function setKeyInfoToNewElOption(resultItem, newElOption) {\n var existElOption = resultItem.existing; // Set id and type after id assigned.\n\n newElOption.id = resultItem.keyInfo.id;\n !newElOption.type && existElOption && (newElOption.type = existElOption.type); // Set parent id if not specified\n\n if (newElOption.parentId == null) {\n var newElParentOption = newElOption.parentOption;\n\n if (newElParentOption) {\n newElOption.parentId = newElParentOption.id;\n } else if (existElOption) {\n newElOption.parentId = existElOption.parentId;\n }\n } // Clear\n\n\n newElOption.parentOption = null;\n}\n\nfunction isSetLoc(obj, props) {\n var isSet;\n zrUtil.each(props, function (prop) {\n obj[prop] != null && obj[prop] !== 'auto' && (isSet = true);\n });\n return isSet;\n}\n\nfunction mergeNewElOptionToExist(existList, index, newElOption) {\n // Update existing options, for `getOption` feature.\n var newElOptCopy = zrUtil.extend({}, newElOption);\n var existElOption = existList[index];\n var $action = newElOption.$action || 'merge';\n\n if ($action === 'merge') {\n if (existElOption) {\n if (process.env.NODE_ENV !== 'production') {\n var newType = newElOption.type;\n zrUtil.assert(!newType || existElOption.type === newType, 'Please set $action: \"replace\" to change `type`');\n } // We can ensure that newElOptCopy and existElOption are not\n // the same object, so `merge` will not change newElOptCopy.\n\n\n zrUtil.merge(existElOption, newElOptCopy, true); // Rigid body, use ignoreSize.\n\n mergeLayoutParam(existElOption, newElOptCopy, {\n ignoreSize: true\n }); // Will be used in render.\n\n copyLayoutParams(newElOption, existElOption); // Copy transition info to new option so it can be used in the transition.\n // DO IT AFTER merge\n\n copyTransitionInfo(newElOption, existElOption);\n copyTransitionInfo(newElOption, existElOption, 'shape');\n copyTransitionInfo(newElOption, existElOption, 'style');\n copyTransitionInfo(newElOption, existElOption, 'extra'); // Copy clipPath\n\n newElOption.clipPath = existElOption.clipPath;\n } else {\n existList[index] = newElOptCopy;\n }\n } else if ($action === 'replace') {\n existList[index] = newElOptCopy;\n } else if ($action === 'remove') {\n // null will be cleaned later.\n existElOption && (existList[index] = null);\n }\n}\n\nvar TRANSITION_PROPS_TO_COPY = ['transition', 'enterFrom', 'leaveTo'];\nvar ROOT_TRANSITION_PROPS_TO_COPY = TRANSITION_PROPS_TO_COPY.concat(['enterAnimation', 'updateAnimation', 'leaveAnimation']);\n\nfunction copyTransitionInfo(target, source, targetProp) {\n if (targetProp) {\n if (!target[targetProp] && source[targetProp]) {\n // TODO avoid creating this empty object when there is no transition configuration.\n target[targetProp] = {};\n }\n\n target = target[targetProp];\n source = source[targetProp];\n }\n\n if (!target || !source) {\n return;\n }\n\n var props = targetProp ? TRANSITION_PROPS_TO_COPY : ROOT_TRANSITION_PROPS_TO_COPY;\n\n for (var i = 0; i < props.length; i++) {\n var prop = props[i];\n\n if (target[prop] == null && source[prop] != null) {\n target[prop] = source[prop];\n }\n }\n}\n\nfunction setLayoutInfoToExist(existItem, newElOption) {\n if (!existItem) {\n return;\n }\n\n existItem.hv = newElOption.hv = [// Rigid body, dont care `width`.\n isSetLoc(newElOption, ['left', 'right']), // Rigid body, dont care `height`.\n isSetLoc(newElOption, ['top', 'bottom'])]; // Give default group size. Otherwise layout error may occur.\n\n if (existItem.type === 'group') {\n var existingGroupOpt = existItem;\n var newGroupOpt = newElOption;\n existingGroupOpt.width == null && (existingGroupOpt.width = newGroupOpt.width = 0);\n existingGroupOpt.height == null && (existingGroupOpt.height = newGroupOpt.height = 0);\n }\n}\n\nvar GraphicComponentModel =\n/** @class */\nfunction (_super) {\n __extends(GraphicComponentModel, _super);\n\n function GraphicComponentModel() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = GraphicComponentModel.type;\n _this.preventAutoZ = true;\n return _this;\n }\n\n GraphicComponentModel.prototype.mergeOption = function (option, ecModel) {\n // Prevent default merge to elements\n var elements = this.option.elements;\n this.option.elements = null;\n\n _super.prototype.mergeOption.call(this, option, ecModel);\n\n this.option.elements = elements;\n };\n\n GraphicComponentModel.prototype.optionUpdated = function (newOption, isInit) {\n var thisOption = this.option;\n var newList = (isInit ? thisOption : newOption).elements;\n var existList = thisOption.elements = isInit ? [] : thisOption.elements;\n var flattenedList = [];\n\n this._flatten(newList, flattenedList, null);\n\n var mappingResult = modelUtil.mappingToExists(existList, flattenedList, 'normalMerge'); // Clear elOptionsToUpdate\n\n var elOptionsToUpdate = this._elOptionsToUpdate = [];\n zrUtil.each(mappingResult, function (resultItem, index) {\n var newElOption = resultItem.newOption;\n\n if (process.env.NODE_ENV !== 'production') {\n zrUtil.assert(zrUtil.isObject(newElOption) || resultItem.existing, 'Empty graphic option definition');\n }\n\n if (!newElOption) {\n return;\n }\n\n elOptionsToUpdate.push(newElOption);\n setKeyInfoToNewElOption(resultItem, newElOption);\n mergeNewElOptionToExist(existList, index, newElOption);\n setLayoutInfoToExist(existList[index], newElOption);\n }, this); // Clean\n\n thisOption.elements = zrUtil.filter(existList, function (item) {\n // $action should be volatile, otherwise option gotten from\n // `getOption` will contain unexpected $action.\n item && delete item.$action;\n return item != null;\n });\n };\n /**\r\n * Convert\r\n * [{\r\n * type: 'group',\r\n * id: 'xx',\r\n * children: [{type: 'circle'}, {type: 'polygon'}]\r\n * }]\r\n * to\r\n * [\r\n * {type: 'group', id: 'xx'},\r\n * {type: 'circle', parentId: 'xx'},\r\n * {type: 'polygon', parentId: 'xx'}\r\n * ]\r\n */\n\n\n GraphicComponentModel.prototype._flatten = function (optionList, result, parentOption) {\n zrUtil.each(optionList, function (option) {\n if (!option) {\n return;\n }\n\n if (parentOption) {\n option.parentOption = parentOption;\n }\n\n result.push(option);\n var children = option.children;\n\n if (option.type === 'group' && children) {\n this._flatten(children, result, option);\n } // Deleting for JSON output, and for not affecting group creation.\n\n\n delete option.children;\n }, this);\n }; // FIXME\n // Pass to view using payload? setOption has a payload?\n\n\n GraphicComponentModel.prototype.useElOptionsToUpdate = function () {\n var els = this._elOptionsToUpdate; // Clear to avoid render duplicately when zooming.\n\n this._elOptionsToUpdate = null;\n return els;\n };\n\n GraphicComponentModel.type = 'graphic';\n GraphicComponentModel.defaultOption = {\n elements: [] // parentId: null\n\n };\n return GraphicComponentModel;\n}(ComponentModel);\n\nexport { GraphicComponentModel };","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/qingge-Market/qingge-vue/node_modules/echarts/lib/component/graphic/GraphicModel.js"],"names":["__extends","zrUtil","modelUtil","ComponentModel","copyLayoutParams","mergeLayoutParam","setKeyInfoToNewElOption","resultItem","newElOption","existElOption","existing","id","keyInfo","type","parentId","newElParentOption","parentOption","isSetLoc","obj","props","isSet","each","prop","mergeNewElOptionToExist","existList","index","newElOptCopy","extend","$action","process","env","NODE_ENV","newType","assert","merge","ignoreSize","copyTransitionInfo","clipPath","TRANSITION_PROPS_TO_COPY","ROOT_TRANSITION_PROPS_TO_COPY","concat","target","source","targetProp","i","length","setLayoutInfoToExist","existItem","hv","existingGroupOpt","newGroupOpt","width","height","GraphicComponentModel","_super","_this","apply","arguments","preventAutoZ","prototype","mergeOption","option","ecModel","elements","call","optionUpdated","newOption","isInit","thisOption","newList","flattenedList","_flatten","mappingResult","mappingToExists","elOptionsToUpdate","_elOptionsToUpdate","isObject","push","filter","item","optionList","result","children","useElOptionsToUpdate","els","defaultOption"],"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,KAAKC,SAAZ,MAA2B,qBAA3B;AACA,OAAOC,cAAP,MAA2B,0BAA3B;AACA,SAASC,gBAAT,EAA2BC,gBAA3B,QAAmD,sBAAnD;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAT,CAAiCC,UAAjC,EAA6CC,WAA7C,EAA0D;AAC/D,MAAIC,aAAa,GAAGF,UAAU,CAACG,QAA/B,CAD+D,CACtB;;AAEzCF,EAAAA,WAAW,CAACG,EAAZ,GAAiBJ,UAAU,CAACK,OAAX,CAAmBD,EAApC;AACA,GAACH,WAAW,CAACK,IAAb,IAAqBJ,aAArB,KAAuCD,WAA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C;AACpCtB,IAAAA,QAAQ,EAAE,EAD0B,CACvB;;AADuB,GAAtC;AAIA,SAAOV,qBAAP;AACD,CA7GD,CA6GElD,cA7GF,CAFA;;AAiHA,SAASkD,qBAAT","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 modelUtil from '../../util/model.js';\r\nimport ComponentModel from '../../model/Component.js';\r\nimport { copyLayoutParams, mergeLayoutParam } from '../../util/layout.js';\r\n;\r\n;\r\n;\r\nexport function setKeyInfoToNewElOption(resultItem, newElOption) {\r\n var existElOption = resultItem.existing; // Set id and type after id assigned.\r\n\r\n newElOption.id = resultItem.keyInfo.id;\r\n !newElOption.type && existElOption && (newElOption.type = existElOption.type); // Set parent id if not specified\r\n\r\n if (newElOption.parentId == null) {\r\n var newElParentOption = newElOption.parentOption;\r\n\r\n if (newElParentOption) {\r\n newElOption.parentId = newElParentOption.id;\r\n } else if (existElOption) {\r\n newElOption.parentId = existElOption.parentId;\r\n }\r\n } // Clear\r\n\r\n\r\n newElOption.parentOption = null;\r\n}\r\n\r\nfunction isSetLoc(obj, props) {\r\n var isSet;\r\n zrUtil.each(props, function (prop) {\r\n obj[prop] != null && obj[prop] !== 'auto' && (isSet = true);\r\n });\r\n return isSet;\r\n}\r\n\r\nfunction mergeNewElOptionToExist(existList, index, newElOption) {\r\n // Update existing options, for `getOption` feature.\r\n var newElOptCopy = zrUtil.extend({}, newElOption);\r\n var existElOption = existList[index];\r\n var $action = newElOption.$action || 'merge';\r\n\r\n if ($action === 'merge') {\r\n if (existElOption) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n var newType = newElOption.type;\r\n zrUtil.assert(!newType || existElOption.type === newType, 'Please set $action: \"replace\" to change `type`');\r\n } // We can ensure that newElOptCopy and existElOption are not\r\n // the same object, so `merge` will not change newElOptCopy.\r\n\r\n\r\n zrUtil.merge(existElOption, newElOptCopy, true); // Rigid body, use ignoreSize.\r\n\r\n mergeLayoutParam(existElOption, newElOptCopy, {\r\n ignoreSize: true\r\n }); // Will be used in render.\r\n\r\n copyLayoutParams(newElOption, existElOption); // Copy transition info to new option so it can be used in the transition.\r\n // DO IT AFTER merge\r\n\r\n copyTransitionInfo(newElOption, existElOption);\r\n copyTransitionInfo(newElOption, existElOption, 'shape');\r\n copyTransitionInfo(newElOption, existElOption, 'style');\r\n copyTransitionInfo(newElOption, existElOption, 'extra'); // Copy clipPath\r\n\r\n newElOption.clipPath = existElOption.clipPath;\r\n } else {\r\n existList[index] = newElOptCopy;\r\n }\r\n } else if ($action === 'replace') {\r\n existList[index] = newElOptCopy;\r\n } else if ($action === 'remove') {\r\n // null will be cleaned later.\r\n existElOption && (existList[index] = null);\r\n }\r\n}\r\n\r\nvar TRANSITION_PROPS_TO_COPY = ['transition', 'enterFrom', 'leaveTo'];\r\nvar ROOT_TRANSITION_PROPS_TO_COPY = TRANSITION_PROPS_TO_COPY.concat(['enterAnimation', 'updateAnimation', 'leaveAnimation']);\r\n\r\nfunction copyTransitionInfo(target, source, targetProp) {\r\n if (targetProp) {\r\n if (!target[targetProp] && source[targetProp]) {\r\n // TODO avoid creating this empty object when there is no transition configuration.\r\n target[targetProp] = {};\r\n }\r\n\r\n target = target[targetProp];\r\n source = source[targetProp];\r\n }\r\n\r\n if (!target || !source) {\r\n return;\r\n }\r\n\r\n var props = targetProp ? TRANSITION_PROPS_TO_COPY : ROOT_TRANSITION_PROPS_TO_COPY;\r\n\r\n for (var i = 0; i < props.length; i++) {\r\n var prop = props[i];\r\n\r\n if (target[prop] == null && source[prop] != null) {\r\n target[prop] = source[prop];\r\n }\r\n }\r\n}\r\n\r\nfunction setLayoutInfoToExist(existItem, newElOption) {\r\n if (!existItem) {\r\n return;\r\n }\r\n\r\n existItem.hv = newElOption.hv = [// Rigid body, dont care `width`.\r\n isSetLoc(newElOption, ['left', 'right']), // Rigid body, dont care `height`.\r\n isSetLoc(newElOption, ['top', 'bottom'])]; // Give default group size. Otherwise layout error may occur.\r\n\r\n if (existItem.type === 'group') {\r\n var existingGroupOpt = existItem;\r\n var newGroupOpt = newElOption;\r\n existingGroupOpt.width == null && (existingGroupOpt.width = newGroupOpt.width = 0);\r\n existingGroupOpt.height == null && (existingGroupOpt.height = newGroupOpt.height = 0);\r\n }\r\n}\r\n\r\nvar GraphicComponentModel =\r\n/** @class */\r\nfunction (_super) {\r\n __extends(GraphicComponentModel, _super);\r\n\r\n function GraphicComponentModel() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n\r\n _this.type = GraphicComponentModel.type;\r\n _this.preventAutoZ = true;\r\n return _this;\r\n }\r\n\r\n GraphicComponentModel.prototype.mergeOption = function (option, ecModel) {\r\n // Prevent default merge to elements\r\n var elements = this.option.elements;\r\n this.option.elements = null;\r\n\r\n _super.prototype.mergeOption.call(this, option, ecModel);\r\n\r\n this.option.elements = elements;\r\n };\r\n\r\n GraphicComponentModel.prototype.optionUpdated = function (newOption, isInit) {\r\n var thisOption = this.option;\r\n var newList = (isInit ? thisOption : newOption).elements;\r\n var existList = thisOption.elements = isInit ? [] : thisOption.elements;\r\n var flattenedList = [];\r\n\r\n this._flatten(newList, flattenedList, null);\r\n\r\n var mappingResult = modelUtil.mappingToExists(existList, flattenedList, 'normalMerge'); // Clear elOptionsToUpdate\r\n\r\n var elOptionsToUpdate = this._elOptionsToUpdate = [];\r\n zrUtil.each(mappingResult, function (resultItem, index) {\r\n var newElOption = resultItem.newOption;\r\n\r\n if (process.env.NODE_ENV !== 'production') {\r\n zrUtil.assert(zrUtil.isObject(newElOption) || resultItem.existing, 'Empty graphic option definition');\r\n }\r\n\r\n if (!newElOption) {\r\n return;\r\n }\r\n\r\n elOptionsToUpdate.push(newElOption);\r\n setKeyInfoToNewElOption(resultItem, newElOption);\r\n mergeNewElOptionToExist(existList, index, newElOption);\r\n setLayoutInfoToExist(existList[index], newElOption);\r\n }, this); // Clean\r\n\r\n thisOption.elements = zrUtil.filter(existList, function (item) {\r\n // $action should be volatile, otherwise option gotten from\r\n // `getOption` will contain unexpected $action.\r\n item && delete item.$action;\r\n return item != null;\r\n });\r\n };\r\n /**\r\n * Convert\r\n * [{\r\n * type: 'group',\r\n * id: 'xx',\r\n * children: [{type: 'circle'}, {type: 'polygon'}]\r\n * }]\r\n * to\r\n * [\r\n * {type: 'group', id: 'xx'},\r\n * {type: 'circle', parentId: 'xx'},\r\n * {type: 'polygon', parentId: 'xx'}\r\n * ]\r\n */\r\n\r\n\r\n GraphicComponentModel.prototype._flatten = function (optionList, result, parentOption) {\r\n zrUtil.each(optionList, function (option) {\r\n if (!option) {\r\n return;\r\n }\r\n\r\n if (parentOption) {\r\n option.parentOption = parentOption;\r\n }\r\n\r\n result.push(option);\r\n var children = option.children;\r\n\r\n if (option.type === 'group' && children) {\r\n this._flatten(children, result, option);\r\n } // Deleting for JSON output, and for not affecting group creation.\r\n\r\n\r\n delete option.children;\r\n }, this);\r\n }; // FIXME\r\n // Pass to view using payload? setOption has a payload?\r\n\r\n\r\n GraphicComponentModel.prototype.useElOptionsToUpdate = function () {\r\n var els = this._elOptionsToUpdate; // Clear to avoid render duplicately when zooming.\r\n\r\n this._elOptionsToUpdate = null;\r\n return els;\r\n };\r\n\r\n GraphicComponentModel.type = 'graphic';\r\n GraphicComponentModel.defaultOption = {\r\n elements: [] // parentId: null\r\n\r\n };\r\n return GraphicComponentModel;\r\n}(ComponentModel);\r\n\r\nexport { GraphicComponentModel };"]},"metadata":{},"sourceType":"module"} |