import { EventEmitter } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { EntityMetadata } from '../../metadata/entities'; import { CardfieldContext, PageModes, PageTypes } from './types'; import { FieldsMdMap, FieldMetadata, PagePermissions } from '../../core/types'; import { EntityUI } from './entityUI'; import * as i0 from "@angular/core"; export interface IPagemodeChanged { newMode: PageModes; prevMode?: PageModes; } /** * Baseclass for all pages and dialogs wich contains an entity * Derivied Classes --> ServicePage * --> ListPage * --> ListRouted * --> all routed entityspecific lists * --> ListPart * --> all entityspecific lists as a part of a card * --> Card * --> all routed entityspecific cards * --> CardPart * --> all entityspecific cards as as part of a card * --> Dialog * --> specific Input-Dialogs with a temporary entity * The derivied classes must: * - implement the abstract methods, * - set the permissions by the permissions-property * - set the pagetype by the pageType-property * the derivied classes could: * - set a viewfilter (initial filters an sort-order) * - lock the page by the lock-property to prevent modifications * Initialization: * The constructor is provided by the TranslateService to realize translation and the entityName for injecting * the Entity-Trigger * The metadata for the entity will be established and the Entity-Trigger injected * * Inputhandling, validation and trigger: * For this task, there are 4 players: * 1. This Entitypage in a controllerrole which contains: * 2. the EntityUI as datasource, * 3. the EntityTrigger and * 4. the fieldcomponents (Field) in the template * * The EntityUI is responsible for the fieldcomponents and contains * - refences to all fieldcomponents, * - the reference to the initial entity (xRec), * - the fieldvalues as properties which are currently displayed * - the entity-states: dirty, valid, new, prepared * - will be notified by the EntityTrigger * * The EntityTrigger-Class is responsible for * - validation (of all entityfields) * - fieldtriggering (for all entityfields) and contains * - the target-entity to be stored after * * The FieldComponent contains it's states "touched", "dirty" and "valid" * - displays the value, * - notify the EntitiUI about changes and * * In the initialization-phase of the template, the each entity-field get a context-block as [context] with value, * metadata and observers (see FieldContext). The context is stored and the function * EntityPage."afterFieldComponentInit" is called once. The EntityPage provides the EntityUI with * the reference to the FieldComponent. * * In the processing-phase, the field-component fires the onChange-event when an editable field is left. * The EntityUI which has subscribed this event by the context instruct the EntityTrigger to validate and run the * customized fieldtrigger. The result will be received * and stored in his validationEntity. The fieldcomponent will be notified about the result * * Exit: * The page get a save * */ export declare abstract class EntityPage { private _entityName; translate: TranslateService; abstract get title(): string; abstract get pageType(): PageTypes; constructor(_entityName: string, translate: TranslateService); protected _metadata: EntityMetadata; protected entityUI: EntityUI; protected _permissions: PagePermissions; protected pagemodeChanged: EventEmitter; protected mode: PageModes; locked: boolean; protected get caption(): string; get entityName(): string; get metadata(): EntityMetadata; get singularName(): string; get pluralName(): string; get captionSingular(): string; get captionPlural(): string; get primaryKeys(): string[]; get fieldsMdMap(): FieldsMdMap; get isCard(): boolean; get isList(): boolean; get isPart(): boolean; get isListPart(): boolean; get isRoutedList(): boolean; get isDialog(): boolean; get insertPermission(): boolean; get modifyPermission(): boolean; get deletePermission(): boolean; get insertAllowed(): boolean; get modifyAllowed(): boolean; get deleteAllowed(): boolean; get insertDelayed(): boolean; get canInsert(): boolean; get isViewMode(): boolean; get isEditMode(): boolean; get isInsertMode(): boolean; get isErrorMode(): boolean; get permissions(): PagePermissions; set permissions(perm: PagePermissions); /** * The imput-context for a field * @param fieldName Name of the field * @returns the fieldcontext */ context(fieldName: string): CardfieldContext; getFieldMd(key: string): FieldMetadata; fieldCaption(fieldName: string): string; protected setViewMode(): void; protected setEditMode(): boolean; protected setErrorMode(): void; protected setInsertMode(): boolean; protected resetPageMode(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, never, never, { "permissions": "permissions"; }, {}, never>; }