import { BaseClass } from '../utils/BaseClass'; import { FieldDef, FieldBind, FieldTypeOptions } from '../types/fields/Field'; import { BaseModel } from '../models'; import Dictionary from '../types/Dictionary'; export declare class Field extends BaseClass { /** * Field definition */ protected _def: FieldDef; /** * Field name */ protected _name: (string | null); /** * Model instance */ protected _model: BaseModel | null; /** * Data structure when using field without model */ protected _data: Dictionary | null; constructor(def?: FieldDef | null, fieldBind?: FieldBind); /** * Clone field instance */ clone(): Field; /** * Bind field with field name and return a new instance */ bind(fieldBind: FieldBind): Field; /** * Field name * Returns field name (Which has been set as key at fieldsDef) * Will throw FieldNotBoundException in case field has not been bound */ get name(): string; /** * Name of attribute in data */ get attributeName(): string; /** * Field definition */ get definition(): FieldDef; /** * Assigned model * Will throw FieldNotBoundException in case field has not been bound to a model */ get model(): BaseModel; /** * Return bound data or data from bound model * Will throw FieldNotBoundException if field is not bound to data or model */ get data(): Dictionary; /** * Property mapper for getValue */ get value(): any; /** * Field value * Returns async field value from data by calling valueGetter with data */ getValue(): Promise; /** * Property mapper for setValue */ set value(value: any); /** * Field value setter * Sets field value to model data by calling valueSetter with data */ setValue(value: any): void; /** * Parses raw value with valueParser and sets field value by calling valueSetter */ setParseValue(rawValue: any): Promise; /** * Field label */ get label(): Promise; /** * Returns async field options with validation and default values depending on field type */ get options(): Promise; /** * Validate field options and set default values depending on field type */ protected validateOptions(options: FieldTypeOptions): Promise; /** * Returns boolean whether field is a primary key */ get isPrimaryKey(): boolean; /** * Returns boolean whether attribute is an nested data structure */ get isNestedAttribute(): boolean; /** * Retrieve value from data structure according to attributeName * Uses nested syntax from attributeName (e.g. "address.city" -> {address: {city: 'New York'}}) * Will return null if value is not available */ valueGetter(data: any): any; /** * Set value of field to data by using attributeName * Will create nested structure from attributeName (e.g. "address.city" -> {address: {city: 'New York'}}) */ valueSetter(value: any, data: Dictionary): void; /** * Parse a raw value and return the parsed value with valid data type */ valueParser(rawValue: any): Promise; /** * Map value from a data structure to another data structure */ mapFieldValue(fromData: Dictionary, toData: Dictionary): void; }