index.js.map 4.1 KB

1
  1. {"version":3,"file":"index.js","sources":["../lib/index.js"],"sourcesContent":["\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*/\nexport function hydrate(dom, options) {\n var svgRoot = dom.querySelector('svg');\n if (!svgRoot) {\n console.error('No SVG element found in the DOM.');\n return;\n }\n function getIndex(child, attr) {\n var index = child.getAttribute(attr);\n if (index) {\n return parseInt(index, 10);\n } else {\n return undefined;\n }\n }\n var listeners = options.on || {};\n var _loop_1 = function (rawEvtName) {\n if (!listeners.hasOwnProperty(rawEvtName)) {\n return \"continue\";\n }\n var eventName = rawEvtName;\n var listener = listeners[eventName];\n if (!isFunction(listener)) {\n return \"continue\";\n }\n svgRoot.addEventListener(eventName, function (event) {\n var targetEl = event.target;\n if (!targetEl || !isFunction(targetEl.getAttribute)) {\n return;\n }\n var type = targetEl.getAttribute('ecmeta_ssr_type');\n var silent = targetEl.getAttribute('ecmeta_silent') === 'true';\n if (!type || silent) {\n return;\n }\n listener({\n type: eventName,\n ssrType: type,\n seriesIndex: getIndex(targetEl, 'ecmeta_series_index'),\n dataIndex: getIndex(targetEl, 'ecmeta_data_index'),\n event: event\n });\n });\n };\n for (var rawEvtName in listeners) {\n _loop_1(rawEvtName);\n }\n}\nfunction isFunction(value) {\n return typeof value === 'function';\n}"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EACA;EACA;EACA;A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