"use strict";
/**
 * Flat UI group with accordion display
 *
 *  Copyright (C) 2010-2019 R-T Specialty, LLC.
 *
 *  This file is part of liza.
 *
 *  liza is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
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) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccordionGroupUi = void 0;
var StackedGroupUi_1 = require("./StackedGroupUi");
/**
 * Collapsable stacked group
 */
var AccordionGroupUi = /** @class */ (function (_super) {
    __extends(AccordionGroupUi, _super);
    function AccordionGroupUi() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * Make stack body collapsable when header is clicked
     *
     * @param $dl   - definition list for group
     * @param index - index to make clickable
     */
    AccordionGroupUi.prototype.postAddRow = function ($dl, index) {
        var header = $dl[0].firstElementChild;
        header.addEventListener('click', function () {
            header.parentElement.classList.toggle('liza-collapsed');
        });
        return _super.prototype.postAddRow.call(this, $dl, index);
    };
    return AccordionGroupUi;
}(StackedGroupUi_1.StackedGroupUi));
exports.AccordionGroupUi = AccordionGroupUi;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWNjb3JkaW9uR3JvdXBVaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkFjY29yZGlvbkdyb3VwVWkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBbUJHOzs7Ozs7Ozs7Ozs7Ozs7O0FBRUgsbURBQWdEO0FBSWhEOztHQUVHO0FBQ0g7SUFBc0Msb0NBQWM7SUFBcEQ7O0lBZ0JBLENBQUM7SUFmQzs7Ozs7T0FLRztJQUNPLHFDQUFVLEdBQXBCLFVBQXFCLEdBQVcsRUFBRSxLQUFhO1FBQzdDLElBQU0sTUFBTSxHQUFHLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxpQkFBaUIsQ0FBQztRQUV4QyxNQUFNLENBQUMsZ0JBQWdCLENBQUMsT0FBTyxFQUFFO1lBQy9CLE1BQU0sQ0FBQyxhQUFhLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDO1FBQzFELENBQUMsQ0FBQyxDQUFDO1FBRUgsT0FBTyxpQkFBTSxVQUFVLFlBQUMsR0FBRyxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQ3RDLENBQUM7SUFDSCx1QkFBQztBQUFELENBQUMsQUFoQkQsQ0FBc0MsK0JBQWMsR0FnQm5EO0FBaEJZLDRDQUFnQiJ9