import * as i0 from '@angular/core'; import { InjectionToken, OnInit, EnvironmentProviders, Provider, TemplateRef, AfterViewInit, Injector } from '@angular/core'; import { LuTranslation } from '@lucca-front/ng/core'; import { AutoFocusTarget, DialogConfig, DialogRef } from '@angular/cdk/dialog'; import { ComponentType } from '@angular/cdk/overlay'; import { Observable, Subscription } from 'rxjs'; import { Route, CanDeactivateFn, DeprecatedGuard, Router, ActivatedRoute } from '@angular/router'; declare class DialogContentComponent { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class DialogFooterComponent { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare const LU_DIALOG_HEADER_TRANSLATIONS: InjectionToken>; interface LuDialogHeaderTranslations { close: string; } declare const luDialogHeaderTranslations: LuTranslation; declare class DialogHeaderAction { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class DialogHeaderComponent implements OnInit { #private; intl: LuDialogHeaderTranslations; dismissible: boolean; close(): void; optionalAction: i0.Signal; ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare function configureLuDialog(): EnvironmentProviders; declare function provideLuDialog(): Provider; declare const ɵdialogData: unique symbol; declare const ɵdialogResult: unique symbol; type ɵDialogDataFlag = { [ɵdialogData]: unknown; }; type ɵDialogResultFlag = { [ɵdialogResult]: R; }; type LuDialogData = { [K in keyof T]: T[K] extends ɵDialogDataFlag ? Omit : never; }[keyof T]; type DialogRefProps = { [K in keyof C]: C[K] extends ɵDialogResultFlag ? K : never; }[keyof C] & keyof C; type LuDialogResult = DialogRefProps extends never ? void : C[DialogRefProps] extends ɵDialogResultFlag ? T : void; interface BaseLuDialogConfig> { /** * The component or template to put inside the dialog container */ content: ComponentType | TemplateRef; /** * Data to pass to the component, will be required if the component used `injectDialogData` in a field, specifying the data that's needed. */ data: TData; /** * Should we put a backdrop? Defaults to true */ modal?: boolean; /** * Is this dialog a blocking popup that cannot be dismissed ? * * Defaults to false, setting this to true will also remove the close button in the header * if you're using `lu-dialog-header`. */ alert?: boolean; /** * Can be used if you don't have a header or aren't using the default one, to set an aria-label * instead of aria-labelledby on the dialog container */ ariaLabel?: string; /** * Autofocus target * * Defaults to the close button from the header, first-input is added by us to focus the first available input * or the first input that is contained inside a node that has the `.luDialog-autofocus` class */ autoFocus?: AutoFocusTarget | 'first-input' | string; /** * This provides a way to override any of the configuration parameters expected by cdk's `Dialog.open` method. * * WARNING: this will take full authority and override with your values no matter what's computed by LuDialogService, * use with caution. */ cdkConfigOverride?: DialogConfig; /** * A hook function to determine if the current dialog can be closed or not, if provided. * * @param comp the instance of the component that's inside the dialog box. */ canClose?: (comp: C) => boolean | Observable; /** * Determine if the current dialog can be close by a click on backdrop or escape key */ canCloseWithBackdrop?: boolean; /** * The size of the panel used for the dialog */ size?: 'XS' | 'S' | 'M' | 'L' | 'XL' | 'fitContent' | `maxContent` | 'fullScreen'; /** * Should it be a modal (default), a drawer? a drawer from bottom? */ mode?: 'default' | 'drawer' | 'drawer-from-bottom'; /** * Classes to add to the panel */ panelClasses?: string[]; } type LuDialogConfig> = [TData] extends [never] ? Omit, 'data'> : BaseLuDialogConfig; declare const DISMISSED_VALUE: {}; declare class LuDialogRef> { readonly cdkRef: DialogRef | typeof DISMISSED_VALUE, C>; readonly config: LuDialogConfig; /** * Instance of the component that's inside the dialog */ get instance(): C; /** * Subscription to the detachments of the dialog * This is used to close the dialog when it is detached */ detachSubscription: Subscription | null; /** * Emits when the dialog is closed * * Emits either the output of result$ or undefined depending on how it has been closed */ closed$: Observable | undefined>; /** * Emits void when the dialog is dismissed */ dismissed$: Observable; /** * Emits the result if it has a value that's not DISMISSED_VALUE */ result$: Observable>; constructor(cdkRef: DialogRef | typeof DISMISSED_VALUE, C>, config: LuDialogConfig); dismiss(): void; close(res: LuDialogResult): void; } type LuDialogSelfRef = { dismiss(): void; close(res: R): void; }; declare function injectDialogData(): TData & ɵDialogDataFlag; declare function injectDialogRef(): LuDialogSelfRef & ɵDialogResultFlag; declare class LuDialogService { #private; open>(config: LuDialogConfig>): LuDialogRef; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class DialogComponent implements AfterViewInit { #private; readonly dialogRef: LuDialogRef; close(): void; dismiss(): void; ngAfterViewInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class DialogCloseDirective { #private; close(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class DialogDismissDirective { #private; close(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class DialogOpenDirective { #private; dialog: TemplateRef; luDialogConfig: LuDialogConfig; click(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } type Deferrable = Promise | Observable | T; declare function deferrableToPromise(deferrable: Promise | Observable | T): Promise; declare function deferrableToObservable(deferrable: Promise | Observable | T): Observable; declare const DIALOG_ROUTE_CONFIG: InjectionToken>; declare function createDialogRoute(config: DialogRouteConfig): Route; type DialogFactoryResultOptions = { path: string; dialogRouteConfig?: Partial, 'path'>>; } & (LuDialogData extends never ? { dataFactory?: never; } : { dataFactory: () => Deferrable>; }); type DialogFactoryResult = (options: DialogFactoryResultOptions) => Route; type DialogFactoryConfig = Partial<{ dialogConfig: Omit, 'data' | 'content'>; dialogRouteConfig: Partial>; }>; declare function dialogRouteFactory(component: ComponentType, config?: DialogFactoryConfig): DialogFactoryResult; type DialogRouteConfig = { dialogConfigFactory: () => Deferrable>; /** * When the dialog is closed, this callback is called with the result of the dialog. * This callback is called within injection context, so you can inject services in it. */ onClosed?: (res: LuDialogResult) => unknown; /** * When the dialog is dismissed, this callback is called. * This callback is called within injection context, so you can inject services in it. */ onDismissed?: () => unknown; /** * Override canDeactivate to have a stricter type */ canDeactivate?: (CanDeactivateFn | DeprecatedGuard)[]; } & Omit; declare const defaultOnClosedFn: (router?: Router, route?: ActivatedRoute, config?: DialogRouteConfig) => void; declare class DialogRoutingComponent implements OnInit { #private; readonly injector: Injector; readonly dialogConfig: i0.Signal>>; readonly dialogTemplateContent: i0.Signal>; readonly dialogComponentContent: i0.Signal>; protected readonly dialogTemplate: i0.Signal>; readonly customInjector: i0.DestroyableInjector; readonly componentInstance: i0.WritableSignal; ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "lu-dialog-routing", never, {}, {}, never, never, true, never>; } export { DIALOG_ROUTE_CONFIG, DialogCloseDirective, DialogComponent, DialogContentComponent, DialogDismissDirective, DialogFooterComponent, DialogHeaderAction, DialogHeaderComponent, DialogOpenDirective, DialogRoutingComponent, LU_DIALOG_HEADER_TRANSLATIONS, LuDialogRef, LuDialogService, configureLuDialog, createDialogRoute, defaultOnClosedFn, deferrableToObservable, deferrableToPromise, dialogRouteFactory, injectDialogData, injectDialogRef, luDialogHeaderTranslations, provideLuDialog }; export type { Deferrable, DialogFactoryConfig, DialogFactoryResult, DialogFactoryResultOptions, DialogRouteConfig, LuDialogConfig, LuDialogData, LuDialogHeaderTranslations, LuDialogResult, LuDialogSelfRef, ɵDialogDataFlag, ɵDialogResultFlag };