import { Component, Inject, NgModule, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
import { CommonModule } from '@angular/common';
import { UxFormGroupComponentModule, } from '@eui/components/legacy/ux-form-group';
import { UxFieldsetComponentModule, } from '@eui/components/legacy/ux-fieldset';
import { UxControlFeedbackComponentModule, } from '@eui/components/legacy/ux-control-feedback';
import { UxDynResolveLabelPipeModule } from '../../../pipes/resolve-label.pipe';
import { BaseGroupComponent } from '../../../core/base-group/base-group.component';
import { DYNAMIC_COMPONENT_CONFIG } from '@eui/core';
import { UxDynFormChildContainerComponentModule } from '../../core/form-child-container/form-child-container.component';
import { UxDynNativeElementProviderDirectiveModule } from '../../../directives/native-element-provider.directive';
import { TranslateModule } from '@ngx-translate/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@eui/components/legacy/ux-fieldset";
import * as i3 from "../../core/form-child-container/form-child-container.component";
import * as i4 from "@eui/components/legacy/ux-form-group";
import * as i5 from "../../../directives/native-element-provider.directive";
import * as i6 from "@eui/components/legacy/ux-control-feedback";
import * as i7 from "../../../pipes/resolve-label.pipe";
import * as i8 from "@ngx-translate/core";
export class FieldsetContainerComponent extends BaseGroupComponent {
    constructor(config, cdRef) {
        super(config);
        this.cdRef = cdRef;
        this.inputs = this.context.inputs;
        this.manualHandleChangeDetection();
    }
    ngOnInit() {
    }
    ngOnDestroy() {
        if (this.statusSubs) {
            this.statusSubs.unsubscribe();
        }
        if (this.modeSubs) {
            this.modeSubs.unsubscribe();
        }
    }
    manualHandleChangeDetection() {
        this.statusSubs = this.dynFormGroup?.statusChanges.subscribe((status) => {
            if (status === 'INVALID' || status === 'VALID') {
                this.cdRef.markForCheck();
            }
        });
        this.modeSubs = this.dynFormApi.getMode().subscribe(() => {
            this.cdRef.markForCheck();
        });
    }
}
/** @nocollapse */ FieldsetContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: FieldsetContainerComponent, deps: [{ token: DYNAMIC_COMPONENT_CONFIG }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
/** @nocollapse */ FieldsetContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: FieldsetContainerComponent, selector: "ux-dyn-fieldset-container", usesInheritance: true, ngImport: i0, template: "<ux-fieldset label=\" \" *ngIf=\"!inputs.notHeader\"\n             [dynFormItem]=\"dynFormGroup\"\n             [dynFormItemIsReadOnly]=\"true\"\n             dynTargetedElement=\"div\">\n    <uxFieldsetLabelExtraContent>\n        <div class=\"ux-fieldset__header-label\" [innerHtml]=\"inputs.label | resolveLabel | async\"></div>\n       <!-- <span *ngIf=\"inputs.tooltip\" class=\"eui-icon eui-icon-info-circle eui-u-color-info ml-3\"\n              euiTooltip=\"{{inputs.tooltip}}\" euiTooltipSecondary></span>-->\n       <span *ngIf=\"inputs.tooltip\" class=\"ux-form-group__info-label ux-icon ux-icon-info-circle ux-u-color-info\"\n        [class.ux-u-cursor-help]=\"inputs.tooltip !== ''\" title=\"{{inputs.tooltip | resolveLabel | async}}\">\n       </span>\n        <span *ngIf=\"inputs.required && inputs.tooltip\" class=\"ux-u-color-danger\">*</span>\n        <span *ngIf=\"inputs.required && !inputs.tooltip\" class=\"ux-u-color-danger\">{{' * '}}</span>\n    </uxFieldsetLabelExtraContent>\n    <ng-container *ngIf=\"dynFormGroup&&dynFormGroup.invalid && dynFormGroup.touched\">\n        <ux-control-feedback *ngIf=\"dynFormGroup.errors&&dynFormGroup.errors.uxValidationError\"\n                             typeClass=\"{{dynFormGroup.errors.uxValidationError.type ? dynFormGroup.errors.uxValidationError.type : 'danger' }}\"\n        >\n            {{dynFormGroup.errors.uxValidationError.message && dynFormGroup.errors.uxValidationError.message.id ?\n            (dynFormGroup.errors.uxValidationError.message.id|translate:dynFormGroup.errors.uxValidationError.message.params) :\n            dynFormGroup.errors.uxValidationError.message}}\n        </ux-control-feedback>\n    </ng-container>\n    <ux-dyn-form-child-container [config]=\"childrenConfig\" [frameId]=\"frameId\" [parent]=\"dynFormGroup\">\n    </ux-dyn-form-child-container>\n</ux-fieldset>\n<ux-fieldset *ngIf=\"inputs.notHeader\">\n    <ux-form-group [label]=\"'<b>'+ (inputs.label | resolveLabel | async) +':</b>'\" [isRenderHTML]=\"true\" labelWidthClass=\"col-4\"\n                   inputWidthClass=\"col-8\" [infoLabel]=\"inputs.tooltip | resolveLabel | async\" iconTypeClass=\"info\" [isRequired]=\"inputs.required\"\n                   [dynFormItem]=\"dynFormGroup\"\n                   [dynFormItemIsReadOnly]=\"true\"\n                   dynTargetedElement=\"div\">\n        <ng-container *ngIf=\"dynFormGroup&&dynFormGroup.invalid && dynFormGroup.touched\">\n            <ux-control-feedback *ngIf=\"dynFormGroup.errors&&dynFormGroup.errors.uxValidationError\"\n                                 typeClass=\"{{dynFormGroup.errors.uxValidationError.type ? dynFormGroup.errors.uxValidationError.type : 'danger' }}\"\n            >\n                {{dynFormGroup.errors.uxValidationError.message && dynFormGroup.errors.uxValidationError.message.id ?\n                (dynFormGroup.errors.uxValidationError.message.id|translate:dynFormGroup.errors.uxValidationError.message.params) :\n                dynFormGroup.errors.uxValidationError.message}}\n            </ux-control-feedback>\n        </ng-container>\n    </ux-form-group>\n    <ux-dyn-form-child-container [config]=\"childrenConfig\" [frameId]=\"frameId\" [parent]=\"dynFormGroup\">\n    </ux-dyn-form-child-container>\n</ux-fieldset>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.UxFieldsetComponent, selector: "ux-fieldset", inputs: ["id", "label", "typeClass", "iconClass", "labelWidthClass", "inputWidthClass", "styleClass", "isFirst", "isLarge", "isCompactFields", "isVerticalFields", "isHighlighted", "isExpandable", "isExpanded", "e2eAttr"], outputs: ["expanded"] }, { kind: "directive", type: i2.UxFieldsetLabelExtraContentTagDirective, selector: "uxFieldsetLabelExtraContent" }, { kind: "component", type: i3.FormChildContainerComponent, selector: "ux-dyn-form-child-container", inputs: ["config", "frameId", "parent", "parentData"] }, { kind: "component", type: i4.UxFormGroupComponent, selector: "ux-form-group", inputs: ["id", "label", "isVertical", "isRequired", "isRequiredTooltipTypeClass", "feedbackTypeClass", "labelWidthClass", "inputWidthClass", "isReadOnly", "styleClass", "validationErrorMessage", "validationErrorFeedbackClass", "infoLabel", "isValid", "isLoadingIndicatorActive", "isCompact", "isUltraCompact", "isRenderHTML", "iconClass", "iconTypeClass", "isInline", "e2eAttr"] }, { kind: "directive", type: i5.NativeElementProviderDirective, selector: "[dynFormItem]", inputs: ["dynFormItem", "dynTargetedElement", "dynFormItemIsReadOnly"] }, { kind: "component", type: i6.UxControlFeedbackComponent, selector: "ux-control-feedback", inputs: ["styleClass", "typeClass", "e2eAttr"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i7.ResolveLabelPipe, name: "resolveLabel" }, { kind: "pipe", type: i8.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: FieldsetContainerComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ux-dyn-fieldset-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ux-fieldset label=\" \" *ngIf=\"!inputs.notHeader\"\n             [dynFormItem]=\"dynFormGroup\"\n             [dynFormItemIsReadOnly]=\"true\"\n             dynTargetedElement=\"div\">\n    <uxFieldsetLabelExtraContent>\n        <div class=\"ux-fieldset__header-label\" [innerHtml]=\"inputs.label | resolveLabel | async\"></div>\n       <!-- <span *ngIf=\"inputs.tooltip\" class=\"eui-icon eui-icon-info-circle eui-u-color-info ml-3\"\n              euiTooltip=\"{{inputs.tooltip}}\" euiTooltipSecondary></span>-->\n       <span *ngIf=\"inputs.tooltip\" class=\"ux-form-group__info-label ux-icon ux-icon-info-circle ux-u-color-info\"\n        [class.ux-u-cursor-help]=\"inputs.tooltip !== ''\" title=\"{{inputs.tooltip | resolveLabel | async}}\">\n       </span>\n        <span *ngIf=\"inputs.required && inputs.tooltip\" class=\"ux-u-color-danger\">*</span>\n        <span *ngIf=\"inputs.required && !inputs.tooltip\" class=\"ux-u-color-danger\">{{' * '}}</span>\n    </uxFieldsetLabelExtraContent>\n    <ng-container *ngIf=\"dynFormGroup&&dynFormGroup.invalid && dynFormGroup.touched\">\n        <ux-control-feedback *ngIf=\"dynFormGroup.errors&&dynFormGroup.errors.uxValidationError\"\n                             typeClass=\"{{dynFormGroup.errors.uxValidationError.type ? dynFormGroup.errors.uxValidationError.type : 'danger' }}\"\n        >\n            {{dynFormGroup.errors.uxValidationError.message && dynFormGroup.errors.uxValidationError.message.id ?\n            (dynFormGroup.errors.uxValidationError.message.id|translate:dynFormGroup.errors.uxValidationError.message.params) :\n            dynFormGroup.errors.uxValidationError.message}}\n        </ux-control-feedback>\n    </ng-container>\n    <ux-dyn-form-child-container [config]=\"childrenConfig\" [frameId]=\"frameId\" [parent]=\"dynFormGroup\">\n    </ux-dyn-form-child-container>\n</ux-fieldset>\n<ux-fieldset *ngIf=\"inputs.notHeader\">\n    <ux-form-group [label]=\"'<b>'+ (inputs.label | resolveLabel | async) +':</b>'\" [isRenderHTML]=\"true\" labelWidthClass=\"col-4\"\n                   inputWidthClass=\"col-8\" [infoLabel]=\"inputs.tooltip | resolveLabel | async\" iconTypeClass=\"info\" [isRequired]=\"inputs.required\"\n                   [dynFormItem]=\"dynFormGroup\"\n                   [dynFormItemIsReadOnly]=\"true\"\n                   dynTargetedElement=\"div\">\n        <ng-container *ngIf=\"dynFormGroup&&dynFormGroup.invalid && dynFormGroup.touched\">\n            <ux-control-feedback *ngIf=\"dynFormGroup.errors&&dynFormGroup.errors.uxValidationError\"\n                                 typeClass=\"{{dynFormGroup.errors.uxValidationError.type ? dynFormGroup.errors.uxValidationError.type : 'danger' }}\"\n            >\n                {{dynFormGroup.errors.uxValidationError.message && dynFormGroup.errors.uxValidationError.message.id ?\n                (dynFormGroup.errors.uxValidationError.message.id|translate:dynFormGroup.errors.uxValidationError.message.params) :\n                dynFormGroup.errors.uxValidationError.message}}\n            </ux-control-feedback>\n        </ng-container>\n    </ux-form-group>\n    <ux-dyn-form-child-container [config]=\"childrenConfig\" [frameId]=\"frameId\" [parent]=\"dynFormGroup\">\n    </ux-dyn-form-child-container>\n</ux-fieldset>\n" }]
        }], ctorParameters: function () { return [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [DYNAMIC_COMPONENT_CONFIG]
                }] }, { type: i0.ChangeDetectorRef }]; } });
export class UxDynFieldsetContainerComponentModule {
}
/** @nocollapse */ UxDynFieldsetContainerComponentModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: UxDynFieldsetContainerComponentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
/** @nocollapse */ UxDynFieldsetContainerComponentModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.3", ngImport: i0, type: UxDynFieldsetContainerComponentModule, declarations: [FieldsetContainerComponent], imports: [CommonModule,
        UxFieldsetComponentModule,
        UxDynFormChildContainerComponentModule,
        // EuiTooltipDirectiveModule,
        UxFormGroupComponentModule,
        UxDynNativeElementProviderDirectiveModule,
        UxControlFeedbackComponentModule,
        UxDynResolveLabelPipeModule,
        TranslateModule], exports: [FieldsetContainerComponent] });
/** @nocollapse */ UxDynFieldsetContainerComponentModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: UxDynFieldsetContainerComponentModule, imports: [CommonModule,
        UxFieldsetComponentModule,
        UxDynFormChildContainerComponentModule,
        // EuiTooltipDirectiveModule,
        UxFormGroupComponentModule,
        UxDynNativeElementProviderDirectiveModule,
        UxControlFeedbackComponentModule,
        UxDynResolveLabelPipeModule,
        TranslateModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: UxDynFieldsetContainerComponentModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        CommonModule,
                        UxFieldsetComponentModule,
                        UxDynFormChildContainerComponentModule,
                        // EuiTooltipDirectiveModule,
                        UxFormGroupComponentModule,
                        UxDynNativeElementProviderDirectiveModule,
                        UxControlFeedbackComponentModule,
                        UxDynResolveLabelPipeModule,
                        TranslateModule,
                    ],
                    exports: [FieldsetContainerComponent],
                    declarations: [FieldsetContainerComponent],
                }]
        }] });
//# sourceMappingURL=data:application/json;base64, 