/** Core */ import { CoreComponent } from "cmf.core/src/core"; import Cmf from "cmf.lbos"; /** Angular2 */ import * as ng from "@angular/core"; /** Nested components */ import * as RelationsModel from "./relationsModel"; import { ColumnViewSelectedArgs, ColumnViewRemoveArgs, ColumnViewAddArgs } from "cmf.core.controls/src/components/columnView/columnView"; import * as ColumnViewStructure from "cmf.core.controls/src/components/columnView/columnViewStructure"; import { OnValidateArgs, OnValidate } from "cmf.core.controls/src/directives/validator/validatorDef"; import { ValidatorModel } from "cmf.core.controls/src/directives/validator/validator"; /** * HandleOutput interface - used to generate the data (object array) based on the lbo call output. * The parent component must implement this method. */ export declare type ColumnViewLeafBuilder = (relationInstance: Cmf.Foundation.BusinessObjects.EntityRelation) => { name: string; value: string; }; export declare class RelationsAccessor { /** * Gets or sets the perform instance component. */ relationsComponent: Relations; } /** * Relations viewer generic component. | Relations | Relation instances | Relation instance properties | * * ## Examples * * ```html * * ``` */ export declare class Relations extends CoreComponent implements ng.OnChanges, OnValidate { private validatorModel; private _ngZone; private _elementRef; private _validatorModel; private _accessor; /** * The name of column view root */ private static ROOT_NAME; /** * The name of the main property of the relation - used to fetch the icon class and to set the name of the column view leaf */ private static MAIN_PROPERTY; /** * ColumnView model */ _columnViewModel: ColumnViewStructure.ColumnViewColumnModel; /** * Selected relation */ _selectedRelation: ColumnViewStructure.ColumnViewNode; /** * Selected relation index */ private _selectedRelationIndex; /** * Selected relation instance */ _selectedRelationInstance: ColumnViewStructure.ColumnViewLeaf; /** * ColumnView container classes */ _columnViewContainerClasses: { [key: string]: boolean; }; /** * ColumnView maximum column */ _columnViewMaxColumns: number; /** * Determines if its possible to add new relations */ _canAddRelations: boolean; /** * Relations Changes Model */ private _changedRelationsModel; /** * Entity instance */ instance: Cmf.Foundation.BusinessObjects.Entity; /** * Relations Model */ model: RelationsModel.RelationsModel; /** * Relations change event, so the component can inform the upper components that the relations have changed (added, updated, deleted) */ relationsChanged: ng.EventEmitter; constructor(validatorModel: ValidatorModel, _ngZone: ng.NgZone, _elementRef: ng.ElementRef, _validatorModel: ValidatorModel, _accessor: RelationsAccessor); /** * Build properties relations */ private buildRelationPropertiesInfo; private addBlankRow; /** * Given a entity instance and a relations model, build column view model */ private buildColumnViewModel; /** * Based on Column View nodes state, build relations changes model */ private processRelation; /** * Based on Column View nodes state, build relations changes model */ private updateChanges; /** * Based on the current changes model, checks for adding relations */ private isAddingRelations; /** * Remove row from list (ColumnView) */ private removeRow; /** * Default function used to build the column view leaf. */ columnViewLeafBuilder: ColumnViewLeafBuilder; /** * Get current changes */ getChanges(): RelationsModel.RelationsChangesModel; /** * Relations may be saved and after save, the previous references need to be updated, as they can be changed again */ syncChangesAfterSave(refreshedRelations: Array): void; /** * On ColumnView item selected - set properties */ onSelect(args: ColumnViewSelectedArgs): void; /** * Add a new property */ onAdd(args: ColumnViewAddArgs): void; /** * Based on columnView remove args, perform row removal */ onRemove(args: ColumnViewRemoveArgs): void; /** * On Property editor value change - update selected item instance, add/update leaf, */ onPropertyChange(value: any, property: { relationProperty: RelationsModel.RelationProperty; entityTypeProperty: Cmf.Foundation.BusinessObjects.EntityTypeProperty; }): void; /** * On changes method - set column view model */ ngOnChanges(changes: any): void; /** * onValidate - just check if its adding relations */ onValidate(context: OnValidateArgs): Promise; } export declare class RelationsModule { }