import { Field } from '../controls/fields/field'; import { EntityLiteral, FieldsMdMap } from '../../core/types'; import { FieldValidationResult } from './types'; import { FieldTriggers } from './field-triggers'; /** * Baseclass of CardDataUI and ListRowDataUI as an interface between the user-in- and outputs * and an entityservice or other outputs like a dialog. * For validation and triggers the EntityPage as baseclass from Card- and ListPage will be consulted * It contains the data * - an original entity as recordreference to the entityservice (xRecRef) * - an entity to be displayed as object-properties (datasource) (pretty format, string) (uiRec) * - a status-column to display the status "new" and "dirty" * - the field-componenents corresponding to the datafields * * Data flow: * 1. Initialize the PageData-Object with an original record [xRecRef] * (fe. read by a service or programmatically set for a dialog) * 2. Copy the initial entity into the vRec * 2. Create the fieldcomponents to display the data based on xRecRef * 3. Get the input from the fieldcomponent (Field.inputvalueToPageData(...) ) * 4. Validate the input * 5. Run the trigger with the input and store the result(s) in vRec * 6. The vRec can be picked up to be stored. * 7. The pick-up waits until a positive acknowledge (f.e. stored in database) * with the written and perhaps modified entity to begin the next cycle of dataflow */ export declare class EntityUI { [key: string]: any; constructor(entityName: string); protected fieldTriggers: FieldTriggers; protected fieldsMdMap: FieldsMdMap; protected dirtyMap: Map; protected _targetRec: EntityLiteral; protected _xRecRef?: EntityLiteral; protected fieldComponents: Field[]; protected fieldComponentMap: Map; protected _prepared: boolean; protected _new: boolean; get prepared(): boolean; set prepared(value: boolean); get isNew(): boolean; setNew(): void; resetNew(): void; get isDirty(): boolean; get isValid(): boolean; get firstInvalid(): Field | undefined; isDirtyAndValid(): boolean; /** * Set the targetrec-values to the incoming rec-values. * The targetrec will then mapped to own properties, where undefined values will be preset with default-values * and values to be formatted were formatted * Clears the dirtymap * @param recRef */ initialize(recRef: EntityLiteral): EntityUI; /** * Maps the targetrec to own properties, where undefined values will be preset with default-values * and values to be formatted are formatted */ protected fromTargetRec(): EntityUI; /** * This funcion is called once from the field, when it has got the field-context * * @param field */ afterFieldComponentInit(field: Field): void; validateField(field: Field, silent?: boolean): void; validate(silent?: boolean): void; afterFieldvalueChanged(value: boolean | string, field: Field | string): Promise; toApi(): EntityLiteral; pickEntityFields(pickList?: string[]): EntityLiteral; }