import { FocusMonitor } from '@angular/cdk/a11y'; import { BooleanInput } from '@angular/cdk/coercion'; import { Platform } from '@angular/cdk/platform'; import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, TemplateRef } from '@angular/core'; import { MatFormFieldAppearance } from '@angular/material/form-field'; import { CanDestroyNotify } from '@mtna/lib-ui'; import { MtnaEditModeDirective } from './edit-mode.directive'; import { MtnaInlineEditorAction } from './inline-editor-action.model'; import { MtnaInlineEditorControlsAnimation } from './inline-editor-controls-animation.model'; import { MtnaInlineEditorControlsPosition } from './inline-editor-controls-position.model'; import { MtnaInlineEditorDefaultOptions } from './inline-editor-default-options.model'; import { MtnaInlineEditorMode } from './inline-editor-mode.model'; import { MtnaInlineEditorMonitorService } from './inline-editor-monitor.service'; import { MtnaViewModeDirective } from './view-mode.directive'; import * as i0 from "@angular/core"; declare const MtnaInlineEditorBase: import("@mtna/lib-ui").CanDestroyNotifyCtor & { new (): {}; }; /** * Inline editor provides distict actions points for when the user has finalized editing a field. * There is a display, 'VIEW' mode, when clicked it will enter 'EDIT'. The user can edit the field * and confirm or cancel the changes. It is up to the consumer to persist data. * * @author Will Davis */ export declare class MtnaInlineEditorComponent extends MtnaInlineEditorBase implements AfterViewInit, CanDestroyNotify { private cdr; private document; private element; private focusMonitor; private monitorService; private platform; static ngAcceptInputType_applyOnBlur: BooleanInput; static ngAcceptInputType_disableApply: BooleanInput; static ngAcceptInputType_hideActionButtons: BooleanInput; static ngAcceptInputType_keepEditViewOnBlur: BooleanInput; static ngAcceptInputType_readonly: BooleanInput; /** Add a CSS class when in VIEW mode. */ get viewing(): boolean; /** Add a CSS class when in EDIT mode. */ get editing(): boolean; /** Add a CSS class when the control position is set to after. */ get controlsPositionAfter(): boolean; /** Add a CSS class when the control position is set to below. */ get controlsPositionBelow(): boolean; viewModeDir: MtnaViewModeDirective; editModeDir: MtnaEditModeDirective; /** Whether to apply changes on blur. Defaults to false. */ get applyOnBlur(): boolean; set applyOnBlur(applyOnBlur: boolean); private _applyOnBlur; /** The mat form field appearance the controls should align with. Defaults to outline. */ controlsAppearance: Extract; /** The position of the editor controls. Defaults to 'after'. */ get controlsPosition(): MtnaInlineEditorControlsPosition; set controlsPosition(position: MtnaInlineEditorControlsPosition); private _controlsPosition; /** Whether to disable the apply action button. Defaults to false. */ get disableApply(): boolean; set disableApply(disable: boolean); private _disableApply; /** Whether to hide the action buttons, defaults to false. */ get hideActionButtons(): boolean; set hideActionButtons(hideActionButtons: boolean); private _hideActionButtons; /** Whether to keep showing the edit view on blur. Defaults to false. */ get keepEditViewOnBlur(): boolean; set keepEditViewOnBlur(value: boolean); private _keepEditViewOnBlur; /** Whether to only show the view mode */ get readonly(): boolean; set readonly(value: boolean); private _readonly; /** Optional element ID to programmatically focus when switching to edit mode. */ get editElementIdToFocus(): string | undefined | null; set editElementIdToFocus(id: string | undefined | null); private _editElementIdToFocus; /** Emitted when the user has finished editing the field, indicates whether the user wants to canceled or apply changes. */ update: EventEmitter; /** The current template to render */ currentView: TemplateRef; /** Unique ID for the inline editor. */ readonly id: string; get mode(): MtnaInlineEditorMode; set mode(m: MtnaInlineEditorMode); private _mode; /** The tabindex of the inline-editor component. Defaults to 0. */ tabIndex: number | null | undefined; /** The derrived animation to use based on the `controlsPosition` input. */ _controlsAnimation: MtnaInlineEditorControlsAnimation; /** Maintain the subscription when monitoring the focus of edit mode. */ private _focusSub?; constructor(cdr: ChangeDetectorRef, _defaults: MtnaInlineEditorDefaultOptions, document: Document, element: ElementRef, focusMonitor: FocusMonitor, monitorService: MtnaInlineEditorMonitorService, platform: Platform); /** When clicking the component while in VIEW, switch to EDIT */ handleHostClick(): void; /** If the Escape key is pressed while in edit, switch to view, discarding changes */ handleHostEscape(): void; /** Stop propogation and default so this won't submit a form */ handleDownEnter(event: Event): void; /** When the enter key is pressed, toggle between VIEW and EDIT */ handleHostEnter(event: Event): void; ngAfterViewInit(): void; /** * Switch to VIEW mode. * * @param action the explicit action when transitioning to view mode, whether to apply or discard changes. * If not provided, the appropriate action will be determined based on various component parameters, see `_getDerrivedToViewModeAction()`. */ toViewMode(action?: MtnaInlineEditorAction): void; /** Switch to EDIT mode */ toEditMode(): void; /** * When the mode switches, update the focus monitor. * While in EDIT, watch for lost focus and switch to VIEW as long as `keepEditViewOnBlue` is false. */ updateFocusMonitor(): void; /** * Takes into account `applyOnBlur` and `disableApply` to determine the appropriate action. * * @returns a derrived/default {@link MtnaInlineEditorAction} based on various component parameters. */ private _getDerrivedToViewModeAction; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export {};