/**
 * SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
 * Copyright (C) 2021 SalesAgility Ltd.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
 * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 *
 * 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 Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License
 * version 3, these Appropriate Legal Notices must retain the display of the
 * "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
 * feasible for technical reasons, the Appropriate Legal Notices must display
 * the words "Supercharged by SuiteCRM".
 */
import { Component } from '@angular/core';
import { DataTypeFormatter } from '../../services/formatters/data-type.formatter.service';
import { StandardFieldRegistry } from '../standard-field.registry';
import { RecordManager } from '../../services/record/record.manager';
import { BaseComposite } from '../base/base-composite.component';
import { FieldLogicManager } from '../field-logic/field-logic.manager';
import { FieldLogicDisplayManager } from '../field-logic-display/field-logic-display.manager';
import * as i0 from "@angular/core";
import * as i1 from "../../services/formatters/data-type.formatter.service";
import * as i2 from "../standard-field.registry";
import * as i3 from "../../services/record/record.manager";
import * as i4 from "../field-logic/field-logic.manager";
import * as i5 from "../field-logic-display/field-logic-display.manager";
import * as i6 from "@angular/common";
import * as i7 from "../../components/label/label.component";
import * as i8 from "../dynamic-field/dynamic-field.component";
function CompositeComponent_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelement(1, "scrm-label", 1);
    i0.ɵɵelementContainerEnd();
} }
function CompositeComponent_ng_container_1_div_2_label_2_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "span", 7);
    i0.ɵɵtext(2, "*");
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} }
const _c0 = function () { return ["edit", "create"]; };
function CompositeComponent_ng_container_1_div_2_label_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "label");
    i0.ɵɵelement(1, "scrm-label", 6);
    i0.ɵɵtemplate(2, CompositeComponent_ng_container_1_div_2_label_2_ng_container_2_Template, 3, 0, "ng-container", 0);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const attribute_r3 = i0.ɵɵnextContext().$implicit;
    const ctx_r4 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("labelKey", attribute_r3.labelKey)("module", ctx_r4.getModule());
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", attribute_r3.definition.required && i0.ɵɵpureFunction0(3, _c0).includes(ctx_r4.mode));
} }
function CompositeComponent_ng_container_1_div_2_span_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 8);
    i0.ɵɵelement(1, "scrm-dynamic-field", 9);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const attribute_r3 = i0.ɵɵnextContext().$implicit;
    const ctx_r5 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("componentType", ctx_r5.getComponentType(attribute_r3.type, attribute_r3.definition))("field", attribute_r3)("klass", ctx_r5.klass)("mode", ctx_r5.getMode())("originalMode", ctx_r5.originalMode)("record", ctx_r5.record)("parent", ctx_r5.parent)("type", attribute_r3.type);
} }
function CompositeComponent_ng_container_1_div_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 3)(1, "span", 4);
    i0.ɵɵtemplate(2, CompositeComponent_ng_container_1_div_2_label_2_Template, 3, 4, "label", 0);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(3, CompositeComponent_ng_container_1_div_2_span_3_Template, 2, 8, "span", 5);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const attribute_r3 = ctx.$implicit;
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵclassProp("flex-fill", ctx_r2.mode === "edit" && ctx_r2.getDirection() === "flex-row")("align-self-start", ctx_r2.getDirection() === "flex-row" && attribute_r3.labelKey && ctx_r2.showLabel(attribute_r3));
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", attribute_r3.labelKey && ctx_r2.showLabel(attribute_r3));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", attribute_r3.type);
} }
function CompositeComponent_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "div");
    i0.ɵɵtemplate(2, CompositeComponent_ng_container_1_div_2_Template, 4, 6, "div", 2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵclassMapInterpolate1("d-flex ", ctx_r1.getDirection(), " justify-content-start align-items-end field-group h-100 composite-field-wrapper");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngForOf", ctx_r1.getAttributes());
} }
class CompositeComponent extends BaseComposite {
    constructor(typeFormatter, registry, recordManager, logic, logicDisplay) {
        super(typeFormatter, registry, recordManager, logic, logicDisplay);
        this.typeFormatter = typeFormatter;
        this.registry = registry;
        this.recordManager = recordManager;
        this.logic = logic;
        this.logicDisplay = logicDisplay;
    }
    static { this.ɵfac = function CompositeComponent_Factory(t) { return new (t || CompositeComponent)(i0.ɵɵdirectiveInject(i1.DataTypeFormatter), i0.ɵɵdirectiveInject(i2.StandardFieldRegistry), i0.ɵɵdirectiveInject(i3.RecordManager), i0.ɵɵdirectiveInject(i4.FieldLogicManager), i0.ɵɵdirectiveInject(i5.FieldLogicDisplayManager)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CompositeComponent, selectors: [["scrm-composite-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 2, vars: 2, consts: [[4, "ngIf"], ["labelKey", "LBL_BAD_GROUP_FIELD_CONFIG"], ["class", "field-group-item d-flex flex-column justify-content-end h-100 w-100", 3, "flex-fill", "align-self-start", 4, "ngFor", "ngForOf"], [1, "field-group-item", "d-flex", "flex-column", "justify-content-end", "h-100", "w-100"], [1, "field-group-label", "pt-2", "pr-1"], ["class", "field-group-field pr-1 pb-1 composite-field", 4, "ngIf"], [3, "labelKey", "module"], [1, "required"], [1, "field-group-field", "pr-1", "pb-1", "composite-field"], [3, "componentType", "field", "klass", "mode", "originalMode", "record", "parent", "type"]], template: function CompositeComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵtemplate(0, CompositeComponent_ng_container_0_Template, 2, 0, "ng-container", 0);
            i0.ɵɵtemplate(1, CompositeComponent_ng_container_1_Template, 3, 4, "ng-container", 0);
        } if (rf & 2) {
            i0.ɵɵproperty("ngIf", !ctx.isConfigured());
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngIf", ctx.isConfigured());
        } }, dependencies: [i6.NgForOf, i6.NgIf, i7.LabelComponent, i8.DynamicFieldComponent], encapsulation: 2 }); }
}
export { CompositeComponent };
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CompositeComponent, [{
        type: Component,
        args: [{ selector: 'scrm-composite-field', template: "<! --\n/**\n* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.\n* Copyright (C) 2021 SalesAgility Ltd.\n*\n* This program is free software; you can redistribute it and/or modify it under\n* the terms of the GNU Affero General Public License version 3 as published by the\n* Free Software Foundation with the addition of the following permission added\n* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK\n* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE\n* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.\n*\n* This program is distributed in the hope that it will be useful, but WITHOUT\n* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more\n* details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program.  If not, see http://www.gnu.org/licenses.\n*\n* In accordance with Section 7(b) of the GNU Affero General Public License\n* version 3, these Appropriate Legal Notices must retain the display of the\n* \"Supercharged by SuiteCRM\" logo. If the display of the logos is not reasonably\n* feasible for technical reasons, the Appropriate Legal Notices must display\n* the words \"Supercharged by SuiteCRM\".\n*/\n-->\n<ng-container *ngIf=\"!isConfigured()\">\n    <scrm-label labelKey=\"LBL_BAD_GROUP_FIELD_CONFIG\"></scrm-label>\n</ng-container>\n\n<ng-container *ngIf=\"isConfigured()\">\n    <div class=\"d-flex {{getDirection()}} justify-content-start align-items-end field-group h-100 composite-field-wrapper\">\n\n        <div *ngFor=\"let attribute of getAttributes()\"\n             [class.flex-fill]=\"mode ==='edit' && getDirection() === 'flex-row'\"\n             [class.align-self-start]=\"getDirection() === 'flex-row' && attribute.labelKey && showLabel(attribute)\"\n             class=\"field-group-item d-flex flex-column justify-content-end h-100 w-100\">\n\n            <!-- LABEL -->\n            <span class=\"field-group-label pt-2 pr-1\">\n                <label *ngIf=\"attribute.labelKey && showLabel(attribute)\">\n                    <scrm-label [labelKey]=\"attribute.labelKey\" [module]=\"getModule()\"></scrm-label>\n                    <ng-container *ngIf=\"attribute.definition.required && (['edit', 'create'].includes(mode))\">\n                        <span class=\"required\">*</span>\n                    </ng-container>\n                </label>\n            </span>\n\n            <!-- VALUE -->\n            <span *ngIf=\"attribute.type\" class=\"field-group-field pr-1 pb-1 composite-field\">\n\n                <scrm-dynamic-field [componentType]=\"getComponentType(attribute.type, attribute.definition)\"\n                                    [field]=\"attribute\"\n                                    [klass]=\"klass\"\n                                    [mode]=\"getMode()\"\n                                    [originalMode]=\"originalMode\"\n                                    [record]=\"record\"\n                                    [parent]=\"parent\"\n                                    [type]=\"attribute.type\">\n                </scrm-dynamic-field>\n\n            </span>\n        </div>\n    </div>\n</ng-container>\n" }]
    }], function () { return [{ type: i1.DataTypeFormatter }, { type: i2.StandardFieldRegistry }, { type: i3.RecordManager }, { type: i4.FieldLogicManager }, { type: i5.FieldLogicDisplayManager }]; }, null); })();
//# sourceMappingURL=data:application/json;base64, 