import { Component, Inject, NgModule, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
import { CommonModule } from '@angular/common';
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 { UxControlFeedbackComponentModule, } from '@eui/components/legacy/ux-control-feedback';
import { TranslateModule } from '@ngx-translate/core';
import * as i0 from "@angular/core";
import * as i1 from "@eui/components/legacy/ux-control-feedback";
import * as i2 from "../../core/form-child-container/form-child-container.component";
import * as i3 from "@angular/common";
import * as i4 from "../../../directives/native-element-provider.directive";
import * as i5 from "@ngx-translate/core";
export class HiddenGroupContainerComponent 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 */ HiddenGroupContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.10", ngImport: i0, type: HiddenGroupContainerComponent, deps: [{ token: DYNAMIC_COMPONENT_CONFIG }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
/** @nocollapse */ HiddenGroupContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.10", type: HiddenGroupContainerComponent, selector: "ux-dyn-hidden-group-container", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"inputs&&inputs.errorFeedback&&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                         [dynFormItem]=\"dynFormGroup\"\n                         [dynFormItemIsReadOnly]=\"true\"\n                         dynTargetedElement=\"div\"\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", styles: [""], components: [{ type: i1.UxControlFeedbackComponent, selector: "ux-control-feedback", inputs: ["styleClass", "typeClass", "e2eAttr"] }, { type: i2.FormChildContainerComponent, selector: "ux-dyn-form-child-container", inputs: ["config", "frameId", "parent", "parentData"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NativeElementProviderDirective, selector: "[dynFormItem]", inputs: ["dynFormItem", "dynTargetedElement", "dynFormItemIsReadOnly"] }], pipes: { "translate": i5.TranslatePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.10", ngImport: i0, type: HiddenGroupContainerComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ux-dyn-hidden-group-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"inputs&&inputs.errorFeedback&&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                         [dynFormItem]=\"dynFormGroup\"\n                         [dynFormItemIsReadOnly]=\"true\"\n                         dynTargetedElement=\"div\"\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", styles: [""] }]
        }], ctorParameters: function () { return [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [DYNAMIC_COMPONENT_CONFIG]
                }] }, { type: i0.ChangeDetectorRef }]; } });
export class UxDynHiddenGroupContainerComponentModule {
}
/** @nocollapse */ UxDynHiddenGroupContainerComponentModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.10", ngImport: i0, type: UxDynHiddenGroupContainerComponentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
/** @nocollapse */ UxDynHiddenGroupContainerComponentModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.10", ngImport: i0, type: UxDynHiddenGroupContainerComponentModule, declarations: [HiddenGroupContainerComponent], imports: [CommonModule,
        UxDynFormChildContainerComponentModule,
        UxDynNativeElementProviderDirectiveModule,
        UxControlFeedbackComponentModule,
        TranslateModule], exports: [HiddenGroupContainerComponent] });
/** @nocollapse */ UxDynHiddenGroupContainerComponentModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.10", ngImport: i0, type: UxDynHiddenGroupContainerComponentModule, imports: [[
            CommonModule,
            UxDynFormChildContainerComponentModule,
            UxDynNativeElementProviderDirectiveModule,
            UxControlFeedbackComponentModule,
            TranslateModule,
        ]] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.10", ngImport: i0, type: UxDynHiddenGroupContainerComponentModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        CommonModule,
                        UxDynFormChildContainerComponentModule,
                        UxDynNativeElementProviderDirectiveModule,
                        UxControlFeedbackComponentModule,
                        TranslateModule,
                    ],
                    exports: [HiddenGroupContainerComponent],
                    declarations: [HiddenGroupContainerComponent],
                }]
        }] });
//# sourceMappingURL=data:application/json;base64, 