import * as i0 from '@angular/core'; import { InjectionToken, TemplateRef, ElementRef, EventEmitter, Signal, AfterViewInit, OnDestroy, DestroyRef, WritableSignal, ModuleWithProviders } from '@angular/core'; import { ValidationErrors, NgForm, FormGroupDirective, NgControl } from '@angular/forms'; import { PlatformFormFieldControl } from '@fundamental-ngx/platform/shared'; import { Subject } from 'rxjs'; import { FormStates } from '@fundamental-ngx/cdk/forms'; import { ObjectStatus } from '@fundamental-ngx/core/object-status'; import { Nullable, TabbableElementService } from '@fundamental-ngx/cdk/utils'; import { PopoverComponent } from '@fundamental-ngx/core/popover'; interface MessagePopoverErrorConfig { heading: string; description?: string; type: FormStates; } interface MessagePopoverConfig { /** * Errors object where key is error type and value is i18n string. */ errors: Record; } declare const FDP_MESSAGE_POPOVER_DEFAULT_CONFIG: MessagePopoverConfig; declare const FDP_MESSAGE_POPOVER_CONFIG: InjectionToken; interface MessagePopoverEntry { heading: MessagePopoverErrorText; type: FormStates; state: ObjectStatus; group?: string; description: MessagePopoverErrorText; name: string; fieldName: string; errors: ValidationErrors | null; element?: ElementRef; formField?: PlatformFormFieldControl; } interface MessagePopoverError { group: FormStates | 'all'; state: ObjectStatus; count: number; } interface MessagePopoverErrorText { message?: TemplateRef | string | null; type: 'templateRef' | 'directive' | 'string'; error?: any; } interface MessagePopoverErrorGroup { group?: string; errors: MessagePopoverEntry[]; } type MessagePopoverState = Omit | 'information' | 'success' | 'neutral'; interface MessagePopover { focusItem: EventEmitter; } interface MessagePopoverWrapper { formFields: PlatformFormFieldControl[]; errors$: Signal; setMessagePopover: (messagePopover: MessagePopover) => void; } type MessagePopoverForm = NgForm | FormGroupDirective; declare class MessagePopoverFormWrapperComponent implements MessagePopoverWrapper, AfterViewInit, OnDestroy { private readonly _destroyRef; private readonly _config; /** @hidden */ private readonly _projectedForm; /** @hidden */ private readonly _projectedFormFieldControls; /** @hidden */ private readonly _directiveItems; /** Message Popover instance. */ messagePopover$: Subject; /** * User-passed forms. */ set forms(forms: MessagePopoverForm | MessagePopoverForm[]); /** User-passed form fields. */ set formFields(value: PlatformFormFieldControl[]); get formFields(): PlatformFormFieldControl[]; /** * Error models Signal. Emitted when form submitted and contains invalid fields. */ readonly errors$: i0.WritableSignal; /** @hidden */ private _formFields; /** @hidden */ private _formErrorsSubscription; /** @hidden */ private _ngForms; /** @hidden */ private _formItemErrorsSubscription; /** @hidden */ private _formSubmitted; /** @hidden */ constructor(_destroyRef: DestroyRef, _config: MessagePopoverConfig); /** @hidden */ ngAfterViewInit(): void; /** * Sets Message Popover component instance. */ setMessagePopover(messagePopover: MessagePopover): void; /** * Programmatically add new form to array of forms. * @param forms */ addForms(forms: MessagePopoverForm | MessagePopoverForm[]): void; /** * Programmatically add new form fields to array of listened form fields. * @param formFields */ addFormFields(formFields: PlatformFormFieldControl[]): void; /** @hidden */ ngOnDestroy(): void; /** * @hidden * Listens to the form submission and collects form control errors. */ private _startListeningForErrors; /** @hidden */ private _listenToFormFieldErrors; /** @hidden */ private _collectPlainFormData; /** @hidden */ private _collectAdvancedFormData; /** * @hidden * Creates error model */ private _getErrorModel; /** * @hidden * Creates error text based on the type of the error. * @param field Form Field Control. * @param errorDirective Optional Error directive * @param section Section where text should be rendered. * @param errorKey * @param error */ private _getErrorText; /** @hidden */ private _getGroupName; /** @hidden */ private _getConfigErrorModel; /** @hidden */ private _isAdvancedError; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class MessageViewComponent implements AfterViewInit { private readonly _destroyRef; private readonly _tabbableService; private readonly _document; /** Current Message Popover screen. Can be either `list` or `details`. */ set currentScreen(value: 'list' | 'details'); get currentScreen(): 'list' | 'details'; /** Filtered errors to render. */ filteredErrors: MessagePopoverErrorGroup[]; /** Current error entry. Used for details view. */ currentEntry: Nullable; /** Event emitted when user clicks on error entry containing additional description. */ openDetails: EventEmitter; /** Event emitted when user clicks on error entry and item's element should be focused. */ focusItem: EventEmitter; /** Event emitted when user clicks on the field link to focus on the field itself. */ closePopover: EventEmitter; /** @hidden */ protected _listView: ElementRef; /** @hidden */ protected _detailsView: ElementRef; /** @hidden */ protected _listSection: ElementRef; /** @hidden */ protected _detailsSection: ElementRef; /** @hidden */ private _currentScreen; /** @hidden */ private _activeListElement; /** @hidden */ private _listAnimation; /** @hidden */ private _detailsAnimation; /** @hidden */ constructor(_destroyRef: DestroyRef, _tabbableService: TabbableElementService, _document: Document); /** @hidden */ ngAfterViewInit(): void; /** @hidden */ _showDetails(entry: MessagePopoverEntry): void; /** @hidden */ _focusElement(event?: MouseEvent, item?: MessagePopoverEntry): void; /** @hidden Animate the transition between list and details screens. */ private _animateScreenTransition; /** @hidden Slide list out left, details in from right. */ private _animateListToDetails; /** @hidden Slide details out right, list in from left. */ private _animateDetailsToList; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class MessagePopoverFormItemDirective { readonly elementRef: ElementRef; readonly control: NgControl; /** Form item name. */ label: string; /** Error type definition. */ errorTypes: MessagePopoverConfig['errors']; /** @hidden */ constructor(elementRef: ElementRef, control: NgControl); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class MessagePopoverComponent implements MessagePopover { /** @hidden */ readonly _popover: PopoverComponent; /** Message Popover Wrapper component. */ set wrapper(value: Nullable); get wrapper(): Nullable; /** Event emits when user clicks on error entry and item's element needs to be focused. */ focusItem: EventEmitter; /** Current message popover screen. Can be `list` or `details`. */ currentScreen: 'list' | 'details'; /** Current error entry. */ currentEntry: Nullable; /** @hidden */ _currentErrorType$: WritableSignal; /** @hidden */ _errorTypes$: i0.Signal; /** @hidden */ _priorityStateItemsCount$: i0.Signal; /** @hidden */ _priorityFormState$: i0.Signal<"success" | "error" | "warning" | "default" | "information">; /** @hidden */ _priorityState$: i0.Signal>; /** @hidden */ readonly _filteredErrors$: i0.Signal; private readonly _groupedErrors$; private readonly _wrapper$; private readonly _countedErrors$; /** @hidden */ _showList(): void; /** @hidden */ _showDetails(entry: MessagePopoverEntry): void; /** @hidden */ _closePopover(focusLast?: boolean): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** * @deprecated * Use direct imports of components and directives. */ declare class PlatformMessagePopoverModule { /** * Method allows users to apply custom configuration. * @param config Object containing error definitions. */ static withConfig(config: MessagePopoverConfig): ModuleWithProviders; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } /** * Converts Object Status into Message Popover State * @param status Object status * @returns Message Popover State. */ declare function convertFormStateToMessagePopoverState(state: FormStates): MessagePopoverState; /** * Converts Form State into Object status type. * @param type Form state. * @returns `ObjectStatus` type. */ declare function convertFormState(type: FormStates): ObjectStatus; export { FDP_MESSAGE_POPOVER_CONFIG, FDP_MESSAGE_POPOVER_DEFAULT_CONFIG, MessagePopoverComponent, MessagePopoverFormItemDirective, MessagePopoverFormWrapperComponent, MessageViewComponent, PlatformMessagePopoverModule, convertFormState, convertFormStateToMessagePopoverState }; export type { MessagePopover, MessagePopoverConfig, MessagePopoverEntry, MessagePopoverError, MessagePopoverErrorConfig, MessagePopoverErrorGroup, MessagePopoverErrorText, MessagePopoverForm, MessagePopoverState, MessagePopoverWrapper };