1 line
15 KiB
JSON
1 line
15 KiB
JSON
{"ast":null,"code":"import \"core-js/modules/es.array.sort.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 { keys, filter, each, isArray, indexOf } from 'zrender/lib/core/util.js';\nimport { ELEMENT_ANIMATABLE_PROPS } from './customGraphicTransition.js';\nimport { getAnimationConfig } from './basicTransition.js';\nimport { warn } from '../util/log.js';\nimport { makeInner } from '../util/model.js';\nvar getStateToRestore = makeInner();\nvar KEYFRAME_EXCLUDE_KEYS = ['percent', 'easing', 'shape', 'style', 'extra'];\n/**\n * Stop previous keyframe animation and restore the attributes.\n * Avoid new keyframe animation starts with wrong internal state when the percent: 0 is not set.\n */\n\nexport function stopPreviousKeyframeAnimationAndRestore(el) {\n // Stop previous keyframe animation.\n el.stopAnimation('keyframe'); // Restore\n\n el.attr(getStateToRestore(el));\n}\nexport function applyKeyframeAnimation(el, animationOpts, animatableModel) {\n if (!animatableModel.isAnimationEnabled() || !animationOpts) {\n return;\n }\n\n if (isArray(animationOpts)) {\n each(animationOpts, function (singleAnimationOpts) {\n applyKeyframeAnimation(el, singleAnimationOpts, animatableModel);\n });\n return;\n }\n\n var keyframes = animationOpts.keyframes;\n var duration = animationOpts.duration;\n\n if (animatableModel && duration == null) {\n // Default to use duration of config.\n // NOTE: animation config from payload will be ignored because they are mainly for transitions.\n var config = getAnimationConfig('enter', animatableModel, 0);\n duration = config && config.duration;\n }\n\n if (!keyframes || !duration) {\n return;\n }\n\n var stateToRestore = getStateToRestore(el);\n each(ELEMENT_ANIMATABLE_PROPS, function (targetPropName) {\n if (targetPropName && !el[targetPropName]) {\n return;\n }\n\n var animator;\n var endFrameIsSet = false; // Sort keyframes by percent.\n\n keyframes.sort(function (a, b) {\n return a.percent - b.percent;\n });\n each(keyframes, function (kf) {\n // Stop current animation.\n var animators = el.animators;\n var kfValues = targetPropName ? kf[targetPropName] : kf;\n\n if (process.env.NODE_ENV !== 'production') {\n if (kf.percent >= 1) {\n endFrameIsSet = true;\n }\n }\n\n if (!kfValues) {\n return;\n }\n\n var propKeys = keys(kfValues);\n\n if (!targetPropName) {\n // PENDING performance?\n propKeys = filter(propKeys, function (key) {\n return indexOf(KEYFRAME_EXCLUDE_KEYS, key) < 0;\n });\n }\n\n if (!propKeys.length) {\n return;\n }\n\n if (!animator) {\n animator = el.animate(targetPropName, animationOpts.loop, true);\n animator.scope = 'keyframe';\n }\n\n for (var i = 0; i < animators.length; i++) {\n // Stop all other animation that is not keyframe.\n if (animators[i] !== animator && animators[i].targetName === animator.targetName) {\n animators[i].stopTracks(propKeys);\n }\n }\n\n targetPropName && (stateToRestore[targetPropName] = stateToRestore[targetPropName] || {});\n var savedTarget = targetPropName ? stateToRestore[targetPropName] : stateToRestore;\n each(propKeys, function (key) {\n // Save original value.\n savedTarget[key] = ((targetPropName ? el[targetPropName] : el) || {})[key];\n });\n animator.whenWithKeys(duration * kf.percent, kfValues, propKeys, kf.easing);\n });\n\n if (!animator) {\n return;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (!endFrameIsSet) {\n warn('End frame with percent: 1 is missing in the keyframeAnimation.', true);\n }\n }\n\n animator.delay(animationOpts.delay || 0).duration(duration).start(animationOpts.easing);\n });\n}","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/ElectronicMallVue/node_modules/echarts/lib/animation/customGraphicKeyframeAnimation.js"],"names":["keys","filter","each","isArray","indexOf","ELEMENT_ANIMATABLE_PROPS","getAnimationConfig","warn","makeInner","getStateToRestore","KEYFRAME_EXCLUDE_KEYS","stopPreviousKeyframeAnimationAndRestore","el","stopAnimation","attr","applyKeyframeAnimation","animationOpts","animatableModel","isAnimationEnabled","singleAnimationOpts","keyframes","duration","config","stateToRestore","targetPropName","animator","endFrameIsSet","sort","a","b","percent","kf","animators","kfValues","process","env","NODE_ENV","propKeys","key","length","animate","loop","scope","i","targetName","stopTracks","savedTarget","whenWithKeys","easing","delay","start"],"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,IAAT,EAAeC,MAAf,EAAuBC,IAAvB,EAA6BC,OAA7B,EAAsCC,OAAtC,QAAqD,0BAArD;AACA,SAASC,wBAAT,QAAyC,8BAAzC;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AACA,SAASC,IAAT,QAAqB,gBAArB;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,IAAIC,iBAAiB,GAAGD,SAAS,EAAjC;AACA,IAAIE,qBAAqB,GAAG,CAAC,SAAD,EAAY,QAA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KAAiBlB,QAAjB,IAA6BO,SAAS,CAACW,CAAD,CAAT,CAAaC,UAAb,KAA4BnB,QAAQ,CAACmB,UAAtE,EAAkF;AAChFZ,UAAAA,SAAS,CAACW,CAAD,CAAT,CAAaE,UAAb,CAAwBR,QAAxB;AACD;AACF;;AAEDb,MAAAA,cAAc,KAAKD,cAAc,CAACC,cAAD,CAAd,GAAiCD,cAAc,CAACC,cAAD,CAAd,IAAkC,EAAxE,CAAd;AACA,UAAIsB,WAAW,GAAGtB,cAAc,GAAGD,cAAc,CAACC,cAAD,CAAjB,GAAoCD,cAApE;AACArB,MAAAA,IAAI,CAACmC,QAAD,EAAW,UAAUC,GAAV,EAAe;AAC5B;AACAQ,QAAAA,WAAW,CAACR,GAAD,CAAX,GAAmB,CAAC,CAACd,cAAc,GAAGZ,EAAE,CAACY,cAAD,CAAL,GAAwBZ,EAAvC,KAA8C,EAA/C,EAAmD0B,GAAnD,CAAnB;AACD,OAHG,CAAJ;AAIAb,MAAAA,QAAQ,CAACsB,YAAT,CAAsB1B,QAAQ,GAAGU,EAAE,CAACD,OAApC,EAA6CG,QAA7C,EAAuDI,QAAvD,EAAiEN,EAAE,CAACiB,MAApE;AACD,KA/CG,CAAJ;;AAiDA,QAAI,CAACvB,QAAL,EAAe;AACb;AACD;;AAED,QAAIS,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;AACzC,UAAI,CAACV,aAAL,EAAoB;AAClBnB,QAAAA,IAAI,CAAC,gEAAD,EAAmE,IAAnE,CAAJ;AACD;AACF;;AAEDkB,IAAAA,QAAQ,CAACwB,KAAT,CAAejC,aAAa,CAACiC,KAAd,IAAuB,CAAtC,EAAyC5B,QAAzC,CAAkDA,QAAlD,EAA4D6B,KAA5D,CAAkElC,aAAa,CAACgC,MAAhF;AACD,GAvEG,CAAJ;AAwED","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 { keys, filter, each, isArray, indexOf } from 'zrender/lib/core/util.js';\nimport { ELEMENT_ANIMATABLE_PROPS } from './customGraphicTransition.js';\nimport { getAnimationConfig } from './basicTransition.js';\nimport { warn } from '../util/log.js';\nimport { makeInner } from '../util/model.js';\nvar getStateToRestore = makeInner();\nvar KEYFRAME_EXCLUDE_KEYS = ['percent', 'easing', 'shape', 'style', 'extra'];\n/**\n * Stop previous keyframe animation and restore the attributes.\n * Avoid new keyframe animation starts with wrong internal state when the percent: 0 is not set.\n */\n\nexport function stopPreviousKeyframeAnimationAndRestore(el) {\n // Stop previous keyframe animation.\n el.stopAnimation('keyframe'); // Restore\n\n el.attr(getStateToRestore(el));\n}\nexport function applyKeyframeAnimation(el, animationOpts, animatableModel) {\n if (!animatableModel.isAnimationEnabled() || !animationOpts) {\n return;\n }\n\n if (isArray(animationOpts)) {\n each(animationOpts, function (singleAnimationOpts) {\n applyKeyframeAnimation(el, singleAnimationOpts, animatableModel);\n });\n return;\n }\n\n var keyframes = animationOpts.keyframes;\n var duration = animationOpts.duration;\n\n if (animatableModel && duration == null) {\n // Default to use duration of config.\n // NOTE: animation config from payload will be ignored because they are mainly for transitions.\n var config = getAnimationConfig('enter', animatableModel, 0);\n duration = config && config.duration;\n }\n\n if (!keyframes || !duration) {\n return;\n }\n\n var stateToRestore = getStateToRestore(el);\n each(ELEMENT_ANIMATABLE_PROPS, function (targetPropName) {\n if (targetPropName && !el[targetPropName]) {\n return;\n }\n\n var animator;\n var endFrameIsSet = false; // Sort keyframes by percent.\n\n keyframes.sort(function (a, b) {\n return a.percent - b.percent;\n });\n each(keyframes, function (kf) {\n // Stop current animation.\n var animators = el.animators;\n var kfValues = targetPropName ? kf[targetPropName] : kf;\n\n if (process.env.NODE_ENV !== 'production') {\n if (kf.percent >= 1) {\n endFrameIsSet = true;\n }\n }\n\n if (!kfValues) {\n return;\n }\n\n var propKeys = keys(kfValues);\n\n if (!targetPropName) {\n // PENDING performance?\n propKeys = filter(propKeys, function (key) {\n return indexOf(KEYFRAME_EXCLUDE_KEYS, key) < 0;\n });\n }\n\n if (!propKeys.length) {\n return;\n }\n\n if (!animator) {\n animator = el.animate(targetPropName, animationOpts.loop, true);\n animator.scope = 'keyframe';\n }\n\n for (var i = 0; i < animators.length; i++) {\n // Stop all other animation that is not keyframe.\n if (animators[i] !== animator && animators[i].targetName === animator.targetName) {\n animators[i].stopTracks(propKeys);\n }\n }\n\n targetPropName && (stateToRestore[targetPropName] = stateToRestore[targetPropName] || {});\n var savedTarget = targetPropName ? stateToRestore[targetPropName] : stateToRestore;\n each(propKeys, function (key) {\n // Save original value.\n savedTarget[key] = ((targetPropName ? el[targetPropName] : el) || {})[key];\n });\n animator.whenWithKeys(duration * kf.percent, kfValues, propKeys, kf.easing);\n });\n\n if (!animator) {\n return;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (!endFrameIsSet) {\n warn('End frame with percent: 1 is missing in the keyframeAnimation.', true);\n }\n }\n\n animator.delay(animationOpts.delay || 0).duration(duration).start(animationOpts.easing);\n });\n}"]},"metadata":{},"sourceType":"module"} |