import { Component, Input } from '@angular/core';
import { FieldType } from '../../../form-field/configurations/field-type';
import * as i0 from "@angular/core";
import * as i1 from "@seniorsistemas/angular-components/button";
import * as i2 from "@angular/common";
import * as i3 from "@seniorsistemas/angular-components/control-errors";
import * as i4 from "@angular/forms";
import * as i5 from "@seniorsistemas/angular-components/info-sign";
import * as i6 from "../../../dynamic-form.directive";
export class RowComponent {
    id;
    config;
    group;
    errorMessages;
    FieldType = FieldType;
    getErrorMessages(errorMessages) {
        if (errorMessages)
            return this.isFunction(errorMessages) ? errorMessages() : errorMessages;
        return this.errorMessages;
    }
    isFunction(value) {
        return value instanceof Function;
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: RowComponent, selector: "s-row", inputs: { id: "id", config: "config", group: "group", errorMessages: "errorMessages" }, ngImport: i0, template: "<div\n    class=\"p-fluid\"\n    [formGroup]=\"group\"\n>\n    <div class=\"ui-g\">\n        @for (field of config.fields; let i = $index; track i) {\n            @if (field.visible && field.visible()) {\n                <div [ngClass]=\"field.gridClass\">\n                    <ng-container *sDynamicForm=\"{ id: id, config: field, group: group }\"></ng-container>\n\n                    @if (field.type === FieldType.Custom && field.label) {\n                        <label\n                            *sInfoSign=\"\n                                field.infoSign ?? '';\n                                displayTime: field.displayTimeInfoSign ?? 5000;\n                                useFocusedInputRef: field.useInfoSignFocusedInputRef ?? false\n                            \"\n                            [for]=\"field.name\"\n                            [ngClass]=\"{ required: field.required ? field.required() : false }\"\n                        >\n                            {{ field.label }}\n                        </label>\n                    }\n\n                    @if (field.name) {\n                        <s-control-errors\n                            [form]=\"group\"\n                            [control]=\"group.controls[field.name]\"\n                            [errorMessages]=\"getErrorMessages(field.errorMessages)\"\n                        ></s-control-errors>\n                    }\n\n                    @if (field.footer) {\n                        @if (field.footer.help) {\n                            @if (\n                                field.name &&\n                                field.footer.help.visible &&\n                                field.footer.help.visible({\n                                    abstractControl: group.controls[field.name],\n                                    formField: field,\n                                })\n                            ) {\n                                <span style=\"color: #888b99\">\n                                    {{ field.footer.help.text }}\n                                </span>\n                            }\n                        }\n                    }\n\n                    @if (field.footer) {\n                        @if (\n                            field.name &&\n                            field.footer.link?.visible({\n                                abstractControl: group.controls[field.name],\n                                formField: field,\n                            })\n                        ) {\n                            <div\n                                class=\"ui-g\"\n                                style=\"margin-left: -17px\"\n                            >\n                                <s-button\n                                    [label]=\"field.footer.link?.label\"\n                                    priority=\"link\"\n                                    (clicked)=\"\n                                        field.footer.link?.onClick({\n                                            abstractControl: group.controls[field.name],\n                                            formField: field,\n                                        })\n                                    \"\n                                    [auxiliary]=\"true\"\n                                ></s-button>\n                            </div>\n                        }\n                    }\n                    @if (field.bottomTemplate) {\n                        <ng-template [ngTemplateOutlet]=\"field.bottomTemplate\"></ng-template>\n                    }\n                </div>\n            }\n        }\n    </div>\n</div>\n\n", dependencies: [{ kind: "component", type: i1.ButtonComponent, selector: "s-button", inputs: ["id", "label", "tooltip", "tooltipPosition", "iconClass", "rightIconClass", "caret", "styleClass", "baseZIndex", "disabled", "auxiliary", "type", "priority", "menuOptions", "size", "slide", "animation", "badge", "iconColor"], outputs: ["clicked"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.ControlErrorsComponent, selector: "s-control-errors", inputs: ["id", "control", "errorMessages", "form"] }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i5.InfoSignDirective, selector: "[sInfoSign]", inputs: ["sInfoSign", "sInfoSignDisplayTime", "sInfoSignFocusedInputRef", "sInfoSignUseFocusedInputRef"] }, { kind: "directive", type: i6.DynamicFormDirective, selector: "[sDynamicForm]", inputs: ["sDynamicForm"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RowComponent, decorators: [{
            type: Component,
            args: [{ selector: 's-row', template: "<div\n    class=\"p-fluid\"\n    [formGroup]=\"group\"\n>\n    <div class=\"ui-g\">\n        @for (field of config.fields; let i = $index; track i) {\n            @if (field.visible && field.visible()) {\n                <div [ngClass]=\"field.gridClass\">\n                    <ng-container *sDynamicForm=\"{ id: id, config: field, group: group }\"></ng-container>\n\n                    @if (field.type === FieldType.Custom && field.label) {\n                        <label\n                            *sInfoSign=\"\n                                field.infoSign ?? '';\n                                displayTime: field.displayTimeInfoSign ?? 5000;\n                                useFocusedInputRef: field.useInfoSignFocusedInputRef ?? false\n                            \"\n                            [for]=\"field.name\"\n                            [ngClass]=\"{ required: field.required ? field.required() : false }\"\n                        >\n                            {{ field.label }}\n                        </label>\n                    }\n\n                    @if (field.name) {\n                        <s-control-errors\n                            [form]=\"group\"\n                            [control]=\"group.controls[field.name]\"\n                            [errorMessages]=\"getErrorMessages(field.errorMessages)\"\n                        ></s-control-errors>\n                    }\n\n                    @if (field.footer) {\n                        @if (field.footer.help) {\n                            @if (\n                                field.name &&\n                                field.footer.help.visible &&\n                                field.footer.help.visible({\n                                    abstractControl: group.controls[field.name],\n                                    formField: field,\n                                })\n                            ) {\n                                <span style=\"color: #888b99\">\n                                    {{ field.footer.help.text }}\n                                </span>\n                            }\n                        }\n                    }\n\n                    @if (field.footer) {\n                        @if (\n                            field.name &&\n                            field.footer.link?.visible({\n                                abstractControl: group.controls[field.name],\n                                formField: field,\n                            })\n                        ) {\n                            <div\n                                class=\"ui-g\"\n                                style=\"margin-left: -17px\"\n                            >\n                                <s-button\n                                    [label]=\"field.footer.link?.label\"\n                                    priority=\"link\"\n                                    (clicked)=\"\n                                        field.footer.link?.onClick({\n                                            abstractControl: group.controls[field.name],\n                                            formField: field,\n                                        })\n                                    \"\n                                    [auxiliary]=\"true\"\n                                ></s-button>\n                            </div>\n                        }\n                    }\n                    @if (field.bottomTemplate) {\n                        <ng-template [ngTemplateOutlet]=\"field.bottomTemplate\"></ng-template>\n                    }\n                </div>\n            }\n        }\n    </div>\n</div>\n\n" }]
        }], propDecorators: { id: [{
                type: Input
            }], config: [{
                type: Input,
                args: [{ required: true }]
            }], group: [{
                type: Input,
                args: [{ required: true }]
            }], errorMessages: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 