import { __decorate } from "tslib";
import { Component, ChangeDetectionStrategy, Injector } from '@angular/core';
import { CommonModule } from '@angular/common';
import { LayoutComponentRendererSADirective } from '@anglr/dynamic/layout';
import { DescendantsGetter, LayoutEditorMetadata } from '@anglr/dynamic/layout-editor';
import { FormGroupLayoutMetadataLoader } from './formGroup.metadata';
import { FORM_COMPONENT_CONTROL } from '../../misc/tokens';
import { FormComponentBase } from '../../components';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
/**
 * Component used for displaying stack panel layout
 */
let FormGroupSAComponent = class FormGroupSAComponent extends FormComponentBase {
    //######################### protected methods #########################
    /**
     * Called on initialzation of component, options are already set
     */
    onInit() {
        this._formInjector = Injector.create({
            parent: this.injector,
            providers: [
                {
                    provide: FORM_COMPONENT_CONTROL,
                    useValue: this.options?.controlName ? this._parentControl?.get(this.options.controlName) : null,
                }
            ]
        });
    }
};
FormGroupSAComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: FormGroupSAComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
FormGroupSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.4", type: FormGroupSAComponent, isStandalone: true, selector: "form-group", usesInheritance: true, ngImport: i0, template: "<ng-container *ngFor=\"let type of options?.children\">\n    <ng-template [layoutComponentRenderer]=\"type\" [layoutComponentRendererInjector]=\"_formInjector\"></ng-template>\n</ng-container>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: LayoutComponentRendererSADirective, selector: "[layoutComponentRenderer]", inputs: ["layoutComponentRenderer", "layoutComponentRendererInjector", "layoutComponentRendererDisableTransformer"], outputs: ["layoutComponentRendererComponentChange", "componentElementChange"], exportAs: ["layoutComponentRenderer"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
FormGroupSAComponent = __decorate([
    DescendantsGetter(options => options?.children ?? []),
    LayoutEditorMetadata(FormGroupLayoutMetadataLoader)
], FormGroupSAComponent);
export { FormGroupSAComponent };
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: FormGroupSAComponent, decorators: [{
            type: Component,
            args: [{ selector: 'form-group', standalone: true, imports: [
                        CommonModule,
                        LayoutComponentRendererSADirective,
                    ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngFor=\"let type of options?.children\">\n    <ng-template [layoutComponentRenderer]=\"type\" [layoutComponentRendererInjector]=\"_formInjector\"></ng-template>\n</ng-container>" }]
        }] });
//# sourceMappingURL=formGroup.component.js.map