var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Component, Input, Output } from "@angular/core";
import { PageElement } from "../page-element";
var ButtonGroupComponent = /** @class */ (function () {
    function ButtonGroupComponent() {
    }
    __decorate([
        Input("buttonGroup"),
        Output("buttonGroup"),
        __metadata("design:type", ButtonGroup)
    ], ButtonGroupComponent.prototype, "buttonGroup", void 0);
    ButtonGroupComponent = __decorate([
        Component({
            selector: "path-button-group",
            templateUrl: "button-group.component.html"
        })
    ], ButtonGroupComponent);
    return ButtonGroupComponent;
}());
export { ButtonGroupComponent };
var ButtonGroup = /** @class */ (function (_super) {
    __extends(ButtonGroup, _super);
    function ButtonGroup(app) {
        var _this = _super.call(this, app) || this;
        _this._buttons = [];
        _this._mobilePageBreak = false;
        return _this;
    }
    Object.defineProperty(ButtonGroup.prototype, "buttons", {
        get: function () {
            return this._buttons;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ButtonGroup.prototype, "mobilePageBreak", {
        get: function () {
            return this._mobilePageBreak;
        },
        enumerable: false,
        configurable: true
    });
    ButtonGroup.prototype.addButton = function (button) {
        this._buttons.push(button);
        var length = 0;
        for (var _i = 0, _a = this.buttons; _i < _a.length; _i++) {
            var currentButton = _a[_i];
            length += (currentButton.width >= 2 ? 2 : 1);
        }
        this._mobilePageBreak = length > 1 && this.buttons.length >= 2;
    };
    ButtonGroup.prototype.updateButtonBorders = function () {
        if (this._buttons.length === 1) {
            // single button has no special border
            this._buttons[0].cssGroupBorder = "";
        }
        else {
            for (var _i = 0, _a = this._buttons; _i < _a.length; _i++) {
                var button = _a[_i];
                button.cssGroupBorder = "tile-grouped-middle";
            }
            if (this._buttons.length >= 1) {
                // set first and last button border
                this._buttons[0].cssGroupBorder = "tile-grouped-left";
                this._buttons[this._buttons.length - 1].cssGroupBorder = "tile-grouped-right";
            }
        }
    };
    ButtonGroup.prototype.fromJson = function (modelElement) {
        _super.prototype.fromJson.call(this, modelElement);
        this.type = "buttonGroup";
    };
    return ButtonGroup;
}(PageElement));
export { ButtonGroup };
//# sourceMappingURL=button-group.component.js.map