META-INF.resources.butterfaces-dist-js.butterfaces-treebox.js Maven / Gradle / Ivy
var ButterFaces;
(function (ButterFaces) {
var TreeBox = /** @class */ (function () {
function TreeBox() {
}
TreeBox.removeTrivialTreeDropDown = function (treeBoxId) {
this.removeTrivialTreeDropDownById(treeBoxId);
this.removeUnAssociatedTrivialTreeDropDowns();
};
TreeBox.removeUnAssociatedTrivialTreeDropDowns = function () {
var dropdowns = document.querySelectorAll(".tr-dropdown[data-tree-box-id]");
Array.prototype.slice.call(dropdowns, 0).forEach(function (dropdown) {
var dropdownId = dropdown.getAttribute("data-tree-box-id");
if (document.querySelectorAll(".butter-component-treebox[data-tree-box-id=" + dropdownId + "]").length === 0) {
dropdown.parentNode.removeChild(dropdown);
}
});
};
TreeBox.removeTrivialTreeDropDownById = function (treeBoxId) {
// in jQuery: $(".tr-dropdown[data-tree-box-id=" + treeBoxId + "]").remove();
// plain javascript:
var dropdowns = document.querySelectorAll(".tr-dropdown[data-tree-box-id=" + treeBoxId + "]");
Array.prototype.slice.call(dropdowns, 0).forEach(function (dropdown) {
dropdown.parentNode.removeChild(dropdown);
});
};
return TreeBox;
}());
ButterFaces.TreeBox = TreeBox;
})(ButterFaces || (ButterFaces = {}));
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJ1dHRlcmZhY2VzLXRyZWVib3gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBVSxXQUFXLENBOEJwQjtBQTlCRCxXQUFVLFdBQVc7SUFFakI7UUFBQTtRQTBCQSxDQUFDO1FBeEJpQixpQ0FBeUIsR0FBdkMsVUFBd0MsU0FBaUI7WUFDckQsSUFBSSxDQUFDLDZCQUE2QixDQUFDLFNBQVMsQ0FBQyxDQUFDO1lBQzlDLElBQUksQ0FBQyxzQ0FBc0MsRUFBRSxDQUFDO1FBQ2xELENBQUM7UUFFYyw4Q0FBc0MsR0FBckQ7WUFDSSxJQUFNLFNBQ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oZHJvcGRvd24pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgcmVtb3ZlVHJpdmlhbFRyZWVEcm9wRG93bkJ5SWQodHJlZUJveElkOiBzdHJpbmcpIHtcbiAgICAgICAgICAgIC8vIGluIGpRdWVyeTogJChcIi50ci1kcm9wZG93bltkYXRhLXRyZWUtYm94LWlkPVwiICsgdHJlZUJveElkICsgXCJdXCIpLnJlbW92ZSgpO1xuICAgICAgICAgICAgLy8gcGxhaW4gamF2YXNjcmlwdDpcbiAgICAgICAgICAgIGNvbnN0IGRyb3Bkb3ducyA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoXCIudHItZHJvcGRvd25bZGF0YS10cmVlLWJveC1pZD1cIiArIHRyZWVCb3hJZCArIFwiXVwiKTtcbiAgICAgICAgICAgIEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGRyb3Bkb3ducywgMCkuZm9yRWFjaCgoZHJvcGRvd246IGFueSkgPT4ge1xuICAgICAgICAgICAgICAgIGRyb3Bkb3duLnBhcmVudE5vZGUucmVtb3ZlQ2hpbGQoZHJvcGRvd24pO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9XG5cbn0iXX0=