1 line
17 KiB
JSON
1 line
17 KiB
JSON
{"ast":null,"code":"/*\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 { indexOf, createHashMap, assert } from 'zrender/lib/core/util.js';\nexport var DATA_ZOOM_AXIS_DIMENSIONS = ['x', 'y', 'radius', 'angle', 'single']; // Supported coords.\n// FIXME: polar has been broken (but rarely used).\n\nvar SERIES_COORDS = ['cartesian2d', 'polar', 'singleAxis'];\nexport function isCoordSupported(seriesModel) {\n var coordType = seriesModel.get('coordinateSystem');\n return indexOf(SERIES_COORDS, coordType) >= 0;\n}\nexport function getAxisMainType(axisDim) {\n if (process.env.NODE_ENV !== 'production') {\n assert(axisDim);\n }\n\n return axisDim + 'Axis';\n}\nexport function getAxisIndexPropName(axisDim) {\n if (process.env.NODE_ENV !== 'production') {\n assert(axisDim);\n }\n\n return axisDim + 'AxisIndex';\n}\nexport function getAxisIdPropName(axisDim) {\n if (process.env.NODE_ENV !== 'production') {\n assert(axisDim);\n }\n\n return axisDim + 'AxisId';\n}\n/**\r\n * If two dataZoomModels has the same axis controlled, we say that they are 'linked'.\r\n * This function finds all linked dataZoomModels start from the given payload.\r\n */\n\nexport function findEffectedDataZooms(ecModel, payload) {\n // Key: `DataZoomAxisDimension`\n var axisRecords = createHashMap();\n var effectedModels = []; // Key: uid of dataZoomModel\n\n var effectedModelMap = createHashMap(); // Find the dataZooms specified by payload.\n\n ecModel.eachComponent({\n mainType: 'dataZoom',\n query: payload\n }, function (dataZoomModel) {\n if (!effectedModelMap.get(dataZoomModel.uid)) {\n addToEffected(dataZoomModel);\n }\n }); // Start from the given dataZoomModels, travel the graph to find\n // all of the linked dataZoom models.\n\n var foundNewLink;\n\n do {\n foundNewLink = false;\n ecModel.eachComponent('dataZoom', processSingle);\n } while (foundNewLink);\n\n function processSingle(dataZoomModel) {\n if (!effectedModelMap.get(dataZoomModel.uid) && isLinked(dataZoomModel)) {\n addToEffected(dataZoomModel);\n foundNewLink = true;\n }\n }\n\n function addToEffected(dataZoom) {\n effectedModelMap.set(dataZoom.uid, true);\n effectedModels.push(dataZoom);\n markAxisControlled(dataZoom);\n }\n\n function isLinked(dataZoomModel) {\n var isLink = false;\n dataZoomModel.eachTargetAxis(function (axisDim, axisIndex) {\n var axisIdxArr = axisRecords.get(axisDim);\n\n if (axisIdxArr && axisIdxArr[axisIndex]) {\n isLink = true;\n }\n });\n return isLink;\n }\n\n function markAxisControlled(dataZoomModel) {\n dataZoomModel.eachTargetAxis(function (axisDim, axisIndex) {\n (axisRecords.get(axisDim) || axisRecords.set(axisDim, []))[axisIndex] = true;\n });\n }\n\n return effectedModels;\n}\n/**\r\n * Find the first target coordinate system.\r\n * Available after model built.\r\n *\r\n * @return Like {\r\n * grid: [\r\n * {model: coord0, axisModels: [axis1, axis3], coordIndex: 1},\r\n * {model: coord1, axisModels: [axis0, axis2], coordIndex: 0},\r\n * ...\r\n * ], // cartesians must not be null/undefined.\r\n * polar: [\r\n * {model: coord0, axisModels: [axis4], coordIndex: 0},\r\n * ...\r\n * ], // polars must not be null/undefined.\r\n * singleAxis: [\r\n * {model: coord0, axisModels: [], coordIndex: 0}\r\n * ]\r\n * }\r\n */\n\nexport function collectReferCoordSysModelInfo(dataZoomModel) {\n var ecModel = dataZoomModel.ecModel;\n var coordSysInfoWrap = {\n infoList: [],\n infoMap: createHashMap()\n };\n dataZoomModel.eachTargetAxis(function (axisDim, axisIndex) {\n var axisModel = ecModel.getComponent(getAxisMainType(axisDim), axisIndex);\n\n if (!axisModel) {\n return;\n }\n\n var coordSysModel = axisModel.getCoordSysModel();\n\n if (!coordSysModel) {\n return;\n }\n\n var coordSysUid = coordSysModel.uid;\n var coordSysInfo = coordSysInfoWrap.infoMap.get(coordSysUid);\n\n if (!coordSysInfo) {\n coordSysInfo = {\n model: coordSysModel,\n axisModels: []\n };\n coordSysInfoWrap.infoList.push(coordSysInfo);\n coordSysInfoWrap.infoMap.set(coordSysUid, coordSysInfo);\n }\n\n coordSysInfo.axisModels.push(axisModel);\n });\n return coordSysInfoWrap;\n}","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/qingge-Market/qingge-vue/node_modules/echarts/lib/component/dataZoom/helper.js"],"names":["indexOf","createHashMap","assert","DATA_ZOOM_AXIS_DIMENSIONS","SERIES_COORDS","isCoordSupported","seriesModel","coordType","get","getAxisMainType","axisDim","process","env","NODE_ENV","getAxisIndexPropName","getAxisIdPropName","findEffectedDataZooms","ecModel","payload","axisRecords","effectedModels","effectedModelMap","eachComponent","mainType","query","dataZoomModel","uid","addToEffected","foundNewLink","processSingle","isLinked","dataZoom","set","push","markAxisControlled","isLink","eachTargetAxis","axisIndex","axisIdxArr","collectReferCoordSysModelInfo","coordSysInfoWrap","infoList","infoMap","axisModel","getComponent","coordSysModel","getCoordSysModel","coordSysUid","coordSysInfo","model","axisModels"],"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,OAAT,EAAkBC,aAAlB,EAAiCC,MAAjC,QAA+C,0BAA/C;AACA,OAAO,IAAIC,yBAAyB,GAAG,CAAC,GAAD,EAAM,GAAN,EAAW,QAAX,EAAqB,OAArB,EAA8B,QAA9B,CAAhC,C,CAAyE;AAChF;;AAEA,IAAIC,aAAa,GAAG,CAAC,aAAD,EAAgB,OAAhB,EAAyB,YAAzB,CAApB;AACA,OAAO,SAASC,gBAAT,CAA0BC,WAA1B,EAAuC;AAC5C,MAAIC,SAAS,GAAGD,WAAW,CAACE,GAAZ,CAAgB,kBAAhB,CAAhB;AACA,SAAOR,OAAO,CAACI,aAAD,EAAgBG,SAAhB,CAAP,IAAqC,CAA5C;AACD;AACD,OAAO,SAASE,eAAT,CAAyBC,OAAzB,EAAkC;AACvC,MAAIC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;AACzCX,IAAAA,MAAM,CAACQ,OAAD,CAAN;AACD;;AAED,SAAOA,OAAO,GAAG,MAAjB;AACD;AACD,OAAO,SAASI,oBAAT,CAA8BJ,OAA9B,EAAuC;AAC5C,MAAIC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;AACzCX,IAAAA,MAAM,CAACQ,OAAD,CAAN;AACD;;AAED,SAAOA,OAAO,GAAG,WAAjB;AACD;AACD,OAAO,SAASK,iBAAT,CAA2BL,OAA3B,EAAoC;AACzC,MAAIC,OAAO,CAACC,GAAR,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AGF,SAAS,CAACG,gBAAV,EAApB;;AAEA,QAAI,CAACD,aAAL,EAAoB;AAClB;AACD;;AAED,QAAIE,WAAW,GAAGF,aAAa,CAACnB,GAAhC;AACA,QAAIsB,YAAY,GAAGR,gBAAgB,CAACE,OAAjB,CAAyBlC,GAAzB,CAA6BuC,WAA7B,CAAnB;;AAEA,QAAI,CAACC,YAAL,EAAmB;AACjBA,MAAAA,YAAY,GAAG;AACbC,QAAAA,KAAK,EAAEJ,aADM;AAEbK,QAAAA,UAAU,EAAE;AAFC,OAAf;AAIAV,MAAAA,gBAAgB,CAACC,QAAjB,CAA0BR,IAA1B,CAA+Be,YAA/B;AACAR,MAAAA,gBAAgB,CAACE,OAAjB,CAAyBV,GAAzB,CAA6Be,WAA7B,EAA0CC,YAA1C;AACD;;AAEDA,IAAAA,YAAY,CAACE,UAAb,CAAwBjB,IAAxB,CAA6BU,SAA7B;AACD,GA1BD;AA2BA,SAAOH,gBAAP;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 { indexOf, createHashMap, assert } from 'zrender/lib/core/util.js';\r\nexport var DATA_ZOOM_AXIS_DIMENSIONS = ['x', 'y', 'radius', 'angle', 'single']; // Supported coords.\r\n// FIXME: polar has been broken (but rarely used).\r\n\r\nvar SERIES_COORDS = ['cartesian2d', 'polar', 'singleAxis'];\r\nexport function isCoordSupported(seriesModel) {\r\n var coordType = seriesModel.get('coordinateSystem');\r\n return indexOf(SERIES_COORDS, coordType) >= 0;\r\n}\r\nexport function getAxisMainType(axisDim) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n assert(axisDim);\r\n }\r\n\r\n return axisDim + 'Axis';\r\n}\r\nexport function getAxisIndexPropName(axisDim) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n assert(axisDim);\r\n }\r\n\r\n return axisDim + 'AxisIndex';\r\n}\r\nexport function getAxisIdPropName(axisDim) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n assert(axisDim);\r\n }\r\n\r\n return axisDim + 'AxisId';\r\n}\r\n/**\r\n * If two dataZoomModels has the same axis controlled, we say that they are 'linked'.\r\n * This function finds all linked dataZoomModels start from the given payload.\r\n */\r\n\r\nexport function findEffectedDataZooms(ecModel, payload) {\r\n // Key: `DataZoomAxisDimension`\r\n var axisRecords = createHashMap();\r\n var effectedModels = []; // Key: uid of dataZoomModel\r\n\r\n var effectedModelMap = createHashMap(); // Find the dataZooms specified by payload.\r\n\r\n ecModel.eachComponent({\r\n mainType: 'dataZoom',\r\n query: payload\r\n }, function (dataZoomModel) {\r\n if (!effectedModelMap.get(dataZoomModel.uid)) {\r\n addToEffected(dataZoomModel);\r\n }\r\n }); // Start from the given dataZoomModels, travel the graph to find\r\n // all of the linked dataZoom models.\r\n\r\n var foundNewLink;\r\n\r\n do {\r\n foundNewLink = false;\r\n ecModel.eachComponent('dataZoom', processSingle);\r\n } while (foundNewLink);\r\n\r\n function processSingle(dataZoomModel) {\r\n if (!effectedModelMap.get(dataZoomModel.uid) && isLinked(dataZoomModel)) {\r\n addToEffected(dataZoomModel);\r\n foundNewLink = true;\r\n }\r\n }\r\n\r\n function addToEffected(dataZoom) {\r\n effectedModelMap.set(dataZoom.uid, true);\r\n effectedModels.push(dataZoom);\r\n markAxisControlled(dataZoom);\r\n }\r\n\r\n function isLinked(dataZoomModel) {\r\n var isLink = false;\r\n dataZoomModel.eachTargetAxis(function (axisDim, axisIndex) {\r\n var axisIdxArr = axisRecords.get(axisDim);\r\n\r\n if (axisIdxArr && axisIdxArr[axisIndex]) {\r\n isLink = true;\r\n }\r\n });\r\n return isLink;\r\n }\r\n\r\n function markAxisControlled(dataZoomModel) {\r\n dataZoomModel.eachTargetAxis(function (axisDim, axisIndex) {\r\n (axisRecords.get(axisDim) || axisRecords.set(axisDim, []))[axisIndex] = true;\r\n });\r\n }\r\n\r\n return effectedModels;\r\n}\r\n/**\r\n * Find the first target coordinate system.\r\n * Available after model built.\r\n *\r\n * @return Like {\r\n * grid: [\r\n * {model: coord0, axisModels: [axis1, axis3], coordIndex: 1},\r\n * {model: coord1, axisModels: [axis0, axis2], coordIndex: 0},\r\n * ...\r\n * ], // cartesians must not be null/undefined.\r\n * polar: [\r\n * {model: coord0, axisModels: [axis4], coordIndex: 0},\r\n * ...\r\n * ], // polars must not be null/undefined.\r\n * singleAxis: [\r\n * {model: coord0, axisModels: [], coordIndex: 0}\r\n * ]\r\n * }\r\n */\r\n\r\nexport function collectReferCoordSysModelInfo(dataZoomModel) {\r\n var ecModel = dataZoomModel.ecModel;\r\n var coordSysInfoWrap = {\r\n infoList: [],\r\n infoMap: createHashMap()\r\n };\r\n dataZoomModel.eachTargetAxis(function (axisDim, axisIndex) {\r\n var axisModel = ecModel.getComponent(getAxisMainType(axisDim), axisIndex);\r\n\r\n if (!axisModel) {\r\n return;\r\n }\r\n\r\n var coordSysModel = axisModel.getCoordSysModel();\r\n\r\n if (!coordSysModel) {\r\n return;\r\n }\r\n\r\n var coordSysUid = coordSysModel.uid;\r\n var coordSysInfo = coordSysInfoWrap.infoMap.get(coordSysUid);\r\n\r\n if (!coordSysInfo) {\r\n coordSysInfo = {\r\n model: coordSysModel,\r\n axisModels: []\r\n };\r\n coordSysInfoWrap.infoList.push(coordSysInfo);\r\n coordSysInfoWrap.infoMap.set(coordSysUid, coordSysInfo);\r\n }\r\n\r\n coordSysInfo.axisModels.push(axisModel);\r\n });\r\n return coordSysInfoWrap;\r\n}"]},"metadata":{},"sourceType":"module"} |