import { OnDestroy, OnInit } from '@angular/core';
import { FormGroupDirective } from '@angular/forms';
import { QdFormGroupManagerService } from '../services/form-group-manager.service';
import * as i0 from "@angular/core";
/**
 * The **QdConnectFormStateToPageDirective** registers a `FormGroup` with the surrounding **QdPage**, enabling page-level aggregation of validity, change tracking, and value access for actions and unsaved-changes protection.
 *
 * ### **What it enables in QdPage**
 * - Aggregated validity across all registered form groups: submit/save can be disabled or show an “invalid form” hint until all registered groups are valid.
 * - Aggregated change detection across all registered form groups: cancel/close can trigger an “unsaved changes” confirmation when any registered group differs from the snapshot.
 * - Bundled values for handlers: page actions (e.g. submit/save) receive a keyed object { [key]: formGroupValue } when at least one form group is registered.
 *
 * ### **Snapshots / restore (unsaved changes)**
 * - Snapshots store only raw values and are taken by the page/header workflow (e.g. on init, edit, save). The confirmation dialog may restore all registered form groups from the snapshot.
 * - FormArrays are restored with dynamic resizing (length is aligned to snapshot before values are reset).
 *
 * ### **Page-Dialog (FullWidth) – Unsaved-Changes Close Contract**
 * - When a QdPage is embedded in a full-width page dialog, the directive’s registered form groups are also used to guard dialog closing.
 * - The page dialog can only close (e.g. via ESC or backdrop) if no unsaved changes are detected ($hasValuesChanged() is false).
 * - If there are unsaved changes, closing is blocked and the same unsaved-changes confirmation flow applies as for cancel / view-edit switching.
 *
 * It works with both `FormGroupDirective` and `QdQuickEditComponent` as the host. The directive requires a host that provides a FormGroupDirective (i.e. an element with [formGroup]). Otherwise it will log an error and not register anything.
 * The directive requires a unique key to identify each form group instance within the `QdFormGroupManagerService`. The key must be unique within the same QdPage instance; duplicate keys are rejected.
 *
 * ### **Usage with regular FormGroup**
 * ```html
 * <qd-page [config]="pageConfig">
 *   <qd-section [config]="sectionConfig">
 *     <qd-grid [formGroup]="myFormGroup" qdConnectFormStateToPage="myFormGroup">
 *       My Section
 *     </qd-grid>
 *   </qd-section>
 * </qd-page>
 * ```
 *
 * ### **Usage with QdQuickEditComponent**
 * ```html
 * <qd-page [config]="pageConfig">
 *   <qd-quick-edit
 *     qdConnectFormStateToPage="myQuickEditKey"
 *     [config]="quickEditConfig"
 *     [data]="quickEditData">
 *   </qd-quick-edit>
 * </qd-page>
 * ```
 */
export declare class QdConnectFormStateToPageDirective implements OnInit, OnDestroy {
    private formGroupManagerService;
    private formGroupDirective;
    /**
     * This key is used to manage and track the form state within the page. It has to be unique for each FormGroup Connector. Use the property name of the FormGroup in your component.
     */
    qdConnectFormStateToPage: string;
    constructor(formGroupManagerService: QdFormGroupManagerService, formGroupDirective: FormGroupDirective);
    ngOnInit(): void;
    ngOnDestroy(): void;
    isValid(): boolean;
    static ɵfac: i0.ɵɵFactoryDeclaration<QdConnectFormStateToPageDirective, [{ optional: true; }, { optional: true; host: true; }]>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<QdConnectFormStateToPageDirective, "[qdConnectFormStateToPage]", never, { "qdConnectFormStateToPage": { "alias": "qdConnectFormStateToPage"; "required": false; }; }, {}, never, never, false, never>;
}
//# sourceMappingURL=connect-form-state-to-page.directive.d.ts.map