@jrj-front-end/tools
Version:
jrj前端工具包
76 lines (75 loc) • 2.46 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CascaderOption = exports.JrjGraphNode = exports.JrjGraph = void 0;
var index_1 = require("../Jrjobject/index");
var JrjGraph = /** @class */ (function () {
function JrjGraph(graph) {
var _this = this;
var _a;
this.roots = [];
if (graph != null) {
(_a = graph.roots) === null || _a === void 0 ? void 0 : _a.forEach(function (root) {
var rootNode = new JrjGraphNode();
var rootObj = new index_1.Jrjobject();
rootObj.copy(root.entity);
rootNode.entity = rootObj;
if (root.bindImgFiles) {
rootNode.bindImgFiles = root.bindImgFiles;
}
_this.RecAddNode(root, rootNode);
_this.roots.push(rootNode);
});
}
}
JrjGraph.prototype.RecAddNode = function (sNode, dNode) {
var _this = this;
sNode.children.forEach(function (ssNode) {
var ddNode = new JrjGraphNode();
var ddObj = new index_1.Jrjobject();
ddObj.copy(ssNode.entity);
ddNode.entity = ddObj;
dNode.children.push(ddNode);
_this.RecAddNode(ssNode, ddNode);
});
};
return JrjGraph;
}());
exports.JrjGraph = JrjGraph;
var JrjGraphNode = /** @class */ (function () {
function JrjGraphNode() {
this.entity = new index_1.Jrjobject();
this.children = [];
this.bindImgFiles = [];
}
JrjGraphNode.prototype.ContainsChild = function (id) {
if (this.entity.id == id) {
return true;
}
else {
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
var child = _a[_i];
if (child.ContainsChild(id)) {
return true;
}
}
return false;
}
};
return JrjGraphNode;
}());
exports.JrjGraphNode = JrjGraphNode;
var CascaderOption = /** @class */ (function () {
function CascaderOption(val) {
this.value = val;
this.label = val;
this.children = [];
}
CascaderOption.prototype.Add = function (chi) {
if (this.children == null) {
this.children = [];
}
this.children.push(chi);
};
return CascaderOption;
}());
exports.CascaderOption = CascaderOption;