import { FocusOrigin } from '@angular/cdk/a11y'; import { BooleanInput, NumberInput } from '@angular/cdk/coercion'; import { ChangeDetectorRef, ElementRef } from '@angular/core'; import { ControlValueAccessor, NgControl } from '@angular/forms'; import { CanColor } from '@angular/material/core'; import { MatFormFieldAppearance } from '@angular/material/form-field'; import { MtnaI18nDefaultOptions, MtnaI18nLanguageOption, MtnaI18nString, MtnaLocaleIds } from '@mtna/lib-ui/i18n'; import { MtnaInlineEditorAction, MtnaInlineEditorControlsAnimation } from '@mtna/lib-ui/inline-editor'; import { MtnaI18nEditorDefaultOptions } from './i18n-editor-token.model'; import { I18nEditorLayout } from './layout.model'; import * as i0 from "@angular/core"; declare const _i18nEditorBase: import("@angular/material/core/common-behaviors/constructor").Constructor & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor & { new (_elementRef: ElementRef): { _elementRef: ElementRef; }; }; /** * An editor that can handle editing a single string value across multiple languages. */ export declare class MtnaI18nEditorComponent extends _i18nEditorBase implements CanColor, ControlValueAccessor { protected _cdr: ChangeDetectorRef; protected locale: string; ngControl?: NgControl | undefined; static ngAcceptInputType_alwaysShowOtherLanguages: BooleanInput; static ngAcceptInputType_applyOnBlur: BooleanInput; static ngAcceptInputType_disabled: BooleanInput; static ngAcceptInputType_inlineEditing: BooleanInput; static ngAcceptInputType_languages: MtnaI18nLanguageOption[] | null | undefined; static ngAcceptInputType_layout: I18nEditorLayout | null | undefined; static ngAcceptInputType_maxTabs: NumberInput; static ngAcceptInputType_readOnly: BooleanInput; static ngAcceptInputType_required: BooleanInput; static ngAcceptInputType_requiredSecondary: BooleanInput; static ngAcceptInputType_value: Array | null | undefined; /** Whether to always display the secondary language(s) input in view mode. Defaults to false. */ get alwaysShowOtherLanguages(): boolean; set alwaysShowOtherLanguages(s: boolean); private _alwaysShowOtherLanguages; /** Visual appearance of the input. Defaults to `outline` */ appearance: Extract; /** Whether to apply changes on blur when {@link inlineEditing} is true. Defaults to true. */ get applyOnBlur(): boolean; set applyOnBlur(applyOnBlur: boolean); private _applyOnBlur; /** Whether the control is disabled */ get disabled(): boolean; set disabled(value: boolean); private _disabled; /** Whether the i18n editor has inline editing. Defaults to false. */ get inlineEditing(): boolean; set inlineEditing(inlineEditing: boolean); private _inlineEditing; /** Label to set on the primary language input. */ get label(): string; set label(l: string); private _label; /** Available languages to display. */ get languages(): MtnaI18nLanguageOption[]; set languages(l: MtnaI18nLanguageOption[]); private _languages; /** Name of the {@link MtnaI18nString}'s language property. Defaults to `facetId` */ get langPropName(): string; set langPropName(t: string); private _langPropName; /** Direction to display the secondary editor. Defaults to `row` */ get layout(): I18nEditorLayout; set layout(layout: I18nEditorLayout); private _layout; /** The maximum number of tabs to display before converting to a dropdown. Defaults to 3. */ get maxTabs(): number; set maxTabs(m: number); private _maxTabs; /** Language to display as the primary/default input. * @remarks If none provided, defaults to {@link MtnaI18nString} with no langPropName or first {@link MtnaI18nString} */ defaultLocaleId: typeof MtnaLocaleIds.type | null | undefined; /** Optional placeholder for the primary language input */ placeholder: string | null | undefined; get readOnly(): boolean; set readOnly(value: boolean); private _readOnly; /** Whether this control is required */ get required(): boolean; set required(r: boolean); private _required; /** Whether the secondary inputs are required */ get requiredSecondary(): boolean; set requiredSecondary(r: boolean); private _requiredSecondary; /** Name of an {@link MtnaI18nString}'s value property. Defaults to `value` */ get valuePropName(): string; set valuePropName(t: string); private _valuePropName; /** The internationalized string array to edit. */ get value(): Array; set value(v: Array); private _value; /** The derrived animation to use based on the the position of the controls. */ _controlsAnimation: MtnaInlineEditorControlsAnimation; /** Tracks focus on this component */ _focused: FocusOrigin | null | undefined; /** Keep track of the current value in the editor for inline editing. This will allow for reverting to the original value. */ _internalValue: Array; /** Whether to ignore the next blur event for inline editing. */ private _ignoreNextBlur; private _onTouched; private _onChange; constructor(_elementRef: ElementRef, _cdr: ChangeDetectorRef, locale: string, _defaults: MtnaI18nDefaultOptions, _editorDefaults: MtnaI18nEditorDefaultOptions, ngControl?: NgControl | undefined); registerOnChange(fn: (value: unknown) => void): void; registerOnTouched(fn: () => void): void; setDisabledState(isDisabled: boolean): void; writeValue(obj: Array | null | undefined): void; _valueChange(lang: string, newValue: string): void; _handleFocusChange(origin: FocusOrigin): void; _handleInlineEditAction(action: MtnaInlineEditorAction): void; /** * Handles the keydown event on enter. * When inline editing, the enter key should behave the same as clicking the apply button. */ _handleInputEnterKeyEvent(event: Event, primary: boolean): void; /** Given an updated value, applies it to the component `value` and triggers `_onChange`, if a change was detected. */ protected _applyChanges(values: MtnaI18nString[]): void; /** * Returns whether a change has occured between 2 values. * Stringifies 2 objects and returns whether they are equal. * @param o1 an object to compare * @param o2 an object to compare * @returns whether 2 values are equal */ protected _compareValues(o1: unknown, o2: unknown): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export {};