"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UITreePanelConfigAction = exports.UITreePanelConfig = void 0;
var ui_tree_model_1 = require("./../ui-tree-model");
var UITreePanelConfig = (function () {
    function UITreePanelConfig(init) {
        this.id = 'id';
        this.withLines = false;
        this.autoExpand = true;
        this.actions = [];
        Object.assign(this, init);
    }
    return UITreePanelConfig;
}());
exports.UITreePanelConfig = UITreePanelConfig;
var UITreePanelConfigAction = (function () {
    function UITreePanelConfigAction(init) {
        this.asDropdown = true;
        Object.assign(this, init);
    }
    UITreePanelConfigAction.prototype.transformToTreeAction = function () {
        var _this = this;
        var action = new ui_tree_model_1.UITreeAction({
            label: isFunction(this.label) ? null : this.label,
            generateLabel: isFunction(this.label) ? function (node) { return _this.label(node.model); } : null,
            icon: this.icon,
            color: this.color,
            asDropdown: this.asDropdown,
            this: this.this,
            fn: function (node) { return _this.fn(node.model, node); },
        });
        if (this.display == null) {
            action.display = true;
        }
        else if (typeof this.display == 'boolean') {
            action.display = this.display;
        }
        else {
            action.display = function (node) {
                if (isFunction(_this.display)) {
                    return _this.display(node.model, node);
                }
            };
        }
        return action;
    };
    return UITreePanelConfigAction;
}());
exports.UITreePanelConfigAction = UITreePanelConfigAction;

//# sourceMappingURL=ui-tree-panel-config.js.map
