qauMaWeb/node_modules/.cache/babel-loader/85bcbabb11fc8625933b2ad80f8...

1 line
19 KiB
JSON
Raw Normal View History

2024-10-13 18:02:27 +08:00
{"ast":null,"code":"import \"core-js/modules/es.array.slice.js\";\nimport \"core-js/modules/es.function.name.js\";\nimport \"core-js/modules/es.array.splice.js\";\nimport \"core-js/modules/es.regexp.exec.js\";\nimport \"core-js/modules/es.string.replace.js\";\nimport { __extends } from \"tslib\";\nimport * as zrUtil from '../core/util.js';\nimport Element from '../Element.js';\nimport BoundingRect from '../core/BoundingRect.js';\n\nvar Group = function (_super) {\n __extends(Group, _super);\n\n function Group(opts) {\n var _this = _super.call(this) || this;\n\n _this.isGroup = true;\n _this._children = [];\n\n _this.attr(opts);\n\n return _this;\n }\n\n Group.prototype.childrenRef = function () {\n return this._children;\n };\n\n Group.prototype.children = function () {\n return this._children.slice();\n };\n\n Group.prototype.childAt = function (idx) {\n return this._children[idx];\n };\n\n Group.prototype.childOfName = function (name) {\n var children = this._children;\n\n for (var i = 0; i < children.length; i++) {\n if (children[i].name === name) {\n return children[i];\n }\n }\n };\n\n Group.prototype.childCount = function () {\n return this._children.length;\n };\n\n Group.prototype.add = function (child) {\n if (child) {\n if (child !== this && child.parent !== this) {\n this._children.push(child);\n\n this._doAdd(child);\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (child.__hostTarget) {\n throw 'This elemenet has been used as an attachment';\n }\n }\n }\n\n return this;\n };\n\n Group.prototype.addBefore = function (child, nextSibling) {\n if (child && child !== this && child.parent !== this && nextSibling && nextSibling.parent === this) {\n var children = this._children;\n var idx = children.indexOf(nextSibling);\n\n if (idx >= 0) {\n children.splice(idx, 0, child);\n\n this._doAdd(child);\n }\n }\n\n return this;\n };\n\n Group.prototype.replace = function (oldChild, newChild) {\n var idx = zrUtil.indexOf(this._children, oldChild);\n\n if (idx >= 0) {\n this.replaceAt(newChild, idx);\n }\n\n return this;\n };\n\n Group.prototype.replaceAt = function (child, index) {\n var children = this._children;\n var old = children[index];\n\n if (child && child !== this && child.parent !== this && child !== old) {\n children[index] = child;\n old.parent = null;\n var zr = this.__zr;\n\n if (zr) {\n old.removeSelfFromZr(zr);\n }\n\n this._doAdd(child);\n }\n\n return this;\n };\n\n Group.prototype._doAdd = function (child) {\n if (child.parent) {\n child.parent.remove(child);\n }\n\n child.parent = this;\n var zr = this.__zr;\n\n if (zr && zr !== child.__zr) {\n child.addSelfToZr(zr);\n }\n\n zr && zr.refresh();\n };\n\n Group.prototype.remove = function (child) {\n var zr = this.__zr;\n var children = this._children;\n var idx = zrUtil.indexOf(children, child);\n\n if (idx < 0) {\n return this;\n }\n\n children.splice(idx, 1);\n child.parent = null;\n\n if (zr) {\n child.removeSelfFromZr(zr);\n }\n\n zr && zr.refresh();\n return this;\n };\n\n Group.prototype.removeAll = function () {\n var children = this._children;\n var zr = this.__zr;\n\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n\n if (zr) {\n child.removeSelfFromZr(zr);\n }\n\n child.parent = null;\n }\n\n children.length = 0;\n return this;\n };\n\n Group.prototype.eachChild = function (cb, context) {\n var children = this._children;\n\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n cb.call(context, child, i);\n }\n\n return this;\n };\n\n Group.prototype.traverse = function (cb, context) {\n for (var i = 0; i < this._children.length; i++) {\n var child = this._children[i];\n var stopped