import { AnyDecision, StringOrFunction, ValueOrFunction } from '@moxb/util'; import { Bind } from './Bind'; /** * Used to set up {Bind} objects */ export interface BindOptions { id: string; /** * If label is a function it assumes that the function returns a translated label. * If label is a string, the assumption is that this is the default translation and the translation key is `id.label` */ label?: StringOrFunction; /** * Note: you can either specify a `disabled` or an `enabled` function! * * @returns {boolean} `true` if the element should be disabled */ disabled?(): AnyDecision; /** * Note: you can either specify a `disabled` or an `enabled` function! * @returns {boolean} `false` if the element should be disabled */ enabled?(): AnyDecision; /** * If true the associated UI element does not show up in the UI (as if it would be `null`) * @returns {boolean} */ invisible?(): boolean; /** * Can the structure be edited -- to not confuse with the typescript keyword `readonly`, we use camelCase * @returns {boolean} */ readOnly?(): boolean; /** * If help is a function it assumes that the function returns a translated help. * If help is a string, the assumption is that this is the default translation and the translation key is `id.help` */ help?: StringOrFunction; getErrors?(): string[] | undefined; setError?(error: string | undefined | null): void; clearErrors?(): void; validateField?(): void; customData?: ValueOrFunction; } export declare class BindImpl, CustomData = undefined> implements Bind { readonly id: string; readonly domId: string; protected readonly impl: Options; _errors?: string[] | undefined | null; constructor(impl: Options); get label(): string | undefined; protected getLabel(): string | undefined; get disabled(): boolean; protected getDisabled(): boolean; get enabled(): boolean; get reason(): string | undefined; protected getReason(): string | undefined; get invisible(): boolean; protected getInvisible(): boolean; get readOnly(): boolean; protected getReadonly(): boolean; get help(): string | undefined; protected getHelp(): string | undefined; get errors(): string[]; get errorMessage(): string | undefined; /** @deprecated since version v0.2.0-beta.7 */ get error(): string | undefined; get hasErrors(): boolean; setError(error: string | undefined | null): void; protected getErrors(): string[]; clearErrors(): void; /** @deprecated since version v0.2.0-beta.7 */ clearError(): void; protected doClearErrors(): void; validateField(): void; protected doOnValidate(): void; get customData(): CustomData | undefined; }