"use strict";
/* TODO auto-generated eslint ignore, please fix! */
/* eslint no-var: "off" */
/**
 * Group UI rendering only the first index
 *
 *  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.FlatGroupUi = void 0;
var GroupUi_1 = require("./GroupUi");
/**
 * Renders only the first index of fields in a flat group that does not
 * support any means of adding or removing indexes.
 */
var FlatGroupUi = /** @class */ (function (_super) {
    __extends(FlatGroupUi, _super);
    function FlatGroupUi() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * Process group before initial display
     */
    FlatGroupUi.prototype.processContent = function (_quote) {
        // Sets the parent element
        this.fieldContentParent[0] = this.content.querySelector('dl');
        this.context.createFieldCache();
    };
    /**
     * This group does not support multiple indexes
     *
     * @return false
     */
    FlatGroupUi.prototype.supportsMultipleIndex = function () {
        return false;
    };
    /**
     * Permit adding only a single index
     *
     * @param index - index that has been added
     */
    FlatGroupUi.prototype.addIndex = function (index) {
        if (index > 0) {
            return this;
        }
        return _super.prototype.addIndex.call(this, index);
    };
    /**
     * Permit removing only the first index
     *
     * This follows from #addIndex, since only one will ever exist.
     *
     * @param index - index that has been removed
     */
    FlatGroupUi.prototype.removeIndex = function (index) {
        if (index > 0) {
            return this;
        }
        return _super.prototype.removeIndex.call(this, index);
    };
    return FlatGroupUi;
}(GroupUi_1.GroupUi));
exports.FlatGroupUi = FlatGroupUi;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRmxhdEdyb3VwVWkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJGbGF0R3JvdXBVaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsb0RBQW9EO0FBQ3BELDBCQUEwQjtBQUMxQjs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQW1CRzs7Ozs7Ozs7Ozs7Ozs7OztBQUVILHFDQUFrQztBQUdsQzs7O0dBR0c7QUFDSDtJQUFpQywrQkFBTztJQUF4Qzs7SUErQ0EsQ0FBQztJQTlDQzs7T0FFRztJQUNPLG9DQUFjLEdBQXhCLFVBQXlCLE1BQW9CO1FBQzNDLDBCQUEwQjtRQUMxQixJQUFJLENBQUMsa0JBQWtCLENBQUMsQ0FBQyxDQUFDLEdBQWdCLElBQUksQ0FBQyxPQUFPLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxDQUFDO1FBRTNFLElBQUksQ0FBQyxPQUFPLENBQUMsZ0JBQWdCLEVBQUUsQ0FBQztJQUNsQyxDQUFDO0lBRUQ7Ozs7T0FJRztJQUNPLDJDQUFxQixHQUEvQjtRQUNFLE9BQU8sS0FBSyxDQUFDO0lBQ2YsQ0FBQztJQUVEOzs7O09BSUc7SUFDTyw4QkFBUSxHQUFsQixVQUFtQixLQUFhO1FBQzlCLElBQUksS0FBSyxHQUFHLENBQUMsRUFBRTtZQUNiLE9BQU8sSUFBSSxDQUFDO1NBQ2I7UUFFRCxPQUFPLGlCQUFN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