/** Core */ import { CoreComponent } from "cmf.core/src/core"; import Cmf from "cmf.lbos"; /** Nested modules */ import { ColumnViewActionArgs, ColumnViewSelectedArgs } from "cmf.core.controls/src/components/columnView/columnView"; import { ColumnViewModel } from "cmf.core.controls/src/components/columnView/columnViewStructure"; /** Angular */ import * as ng from "@angular/core"; /** * Entity property with the join it is used to connect (in case of reference) */ export interface EntityPropertyJoin { /** * Entity type property */ entityProperty: Cmf.Foundation.BusinessObjects.EntityTypeProperty; /** * Type of join */ joinType?: Cmf.Foundation.BusinessObjects.QueryObject.Enums.JoinType; } /** * Type of joins (class and value) */ export declare const JOIN_TYPES: { class: string; titleClass: string; value: Cmf.Foundation.BusinessObjects.QueryObject.Enums.JoinType; }[]; /** * @whatItDoes * * This component allows the user to select a property and join type of an entity type * It displays all the properties of that entity type as a navigation column view * It requires the name of the entity type to list the properties. * * @howToUse * * To use this simply pass the entityTypeName and handle the dataChange event. * * ### Inputs * `string` : **entityTypeName** - The name of the entity type * `number` : **maxColumns** - Max columns of the inner column view * `string` : **mainTitle** - Main title of the picker. If not set, will be set as the entity type name * `boolean`: **selectJoins** - Controls wether the user can select the joins for the references. defaults to true * `boolean`: **multiSelection** - Allows selection of multiple properties. * This will disable showing the icon for each element and will show the checkbox of the selection instead. * `EntityPropertyJoin[]`: **selected** - Pre-selected values of the entity property picker. Applicable only for multi selection. * Defaults to false * `boolean`: **includeRelations** - Boolean value that controls wether relations appear to be picked. Defaults to true. * `EntityPropertyJoin[][] | boolean` : **joins** - Joins that hold the information for the properties for the entity property modal. * Set to False to not display joins at all * `string[]` : **baseDisabledProperties** - Properties of the base level that have the selection disabled. * `boolean` : **showJoins** - Boolean value that controls wether joins are shown. Defaults to true * * ### Outputs * `EntityPropertyJoin[]` : **dataChange** - Array that represents the selected path * `{property: EntityPropertyJoin[], value: boolean}` : selectionChange** - Triggered when the multi selection of a value is altered * * ### Example * To use the component, assume this HTML Template as an example: * * ```HTML * * ``` * * @description * * ## EntityPropertyPicker Component * * ### Dependencies * * #### Components * * ColumnView : `cmf.core.controls` (Ex: `cmf.core.controls`) * */ export declare class EntityPropertyPicker extends CoreComponent implements ng.OnChanges { private _viewContainerRef; private _ngZone; /** * Entity type to mark the start of the properties */ entityTypeName: string; /** * Data change event that is triggered when the user selects a row */ dataChange: ng.EventEmitter; /** * Event that triggers when an element selection value changes */ selectionChange: ng.EventEmitter<{ property: EntityPropertyJoin[]; value: boolean; }>; /** * Max columns of the inner column view */ maxColumns: number; /** * Main title of the picker */ mainTitle: string; /** * Controls wether the user can select the joins for the references. */ selectJoins: boolean; /** * Allows selection of multiple properties */ multiSelection: boolean; /** * Holds the currently selected properties */ selected: EntityPropertyJoin[][]; /** * Holds the current join information. * Set to False to not display joins at all */ joins: EntityPropertyJoin[][]; /** * Properties of the base level that have the selection disabled */ baseDisabledProperties: string[]; /** * Boolean value that controls wether the relations will appear to be picked. */ includeRelations: boolean; /** * Column view model used to support the inner column view */ _model: ColumnViewModel; /** * Boolean value that controls wether joins are shown */ showJoins: boolean; /** * Store the join type by connection */ private _propertyDataMap; /** * Currently selected path of properties */ private _selectedPathData; /** * Keeps the EntityTypes already fetched from cache */ private _cachedEntities; /** * Keeps relation EntityTypeName - Relations already fetched from cache */ private _cachedEntityRelations; private _pickerContainer; private _selectedItems; /** * Constructor * * @param viewContainerRef the reference to the component view container */ constructor(_viewContainerRef: ng.ViewContainerRef, _ngZone: ng.NgZone); /** * On changes method build a new model * @param changes the changes made to the component properties */ ngOnChanges(changes: ng.SimpleChanges): void; /** * Build the model and send it to the column view */ buildColumnViewModel(): void; /** * Get a column view node for the entity type specified * @param entityTypeName Name of the entity type to fetch the properties from * @param id Id of the node to return * @param depth Depth of this node in the tree, used to generate unique Ids * @param path Path so far */ private getColumnViewNodeByEntityType; /** * Returns the promise for the child related to the specified connection * @param connection Connection that is going to be represented as a node or a leaf * @param depth */ private prepareChildPromise; /** * Gets the join type for a specific path * @param path path to the property * @param index index of the search */ private getJoinInfo; /** * Checks if the property defined by the path is currently multi selected * @param path Path to the entity type property * @param index Depth of the property * @returns boolean value indicating if this path is selected */ private isMultiSelected; /** * Defines if a property has multi selection enable by comparing with the base locked properties * @param path path to the variable * @param index index of the property in the tree of properties * @returns boolean value indicating if the selection is disabled */ private isMultiSelectionDisabled; /** * When the action is clicked switch the type of join * @param args column view action args */ onActionClick(args: ColumnViewActionArgs): void; /** * When a row is selected handle the property * @param args column view selection args */ onRowSelect(args: ColumnViewSelectedArgs): void; /** * Emit the data change event when the property changes * @param property data of the property that changed * @param newSelection boolean that ensures the trigger of the change event * @param multiSelectionValue new value of the selection for this property */ private handlePropertyChange; /** * Converts the inner path to the exterior representation * @param pathData Inner path data */ private pathDataToEntityPropertyJoin; /** * For each EntityTypeProperty, add reference to its EntityTypeName. * This helps to maintain track to which EntityType a property belongs to. * @param entities EntityTypes which properties will be modified */ private addEntityReferenceToProperty; /** * Returns information about an EntityType from id or name. * It also saves fetched EntityTypes for performance reasons (Avoid access EntityType cache all the time) * @param target EntityType Id or Name (Id has precedence) */ private getEntityType; /** * Returns the relations of a given EntityType. * Saves the fetched relation for performance reasons (Avoid access EntityType cache too many times) * @param id Target EntityType Id */ private getEntityTypeRelationById; } export declare class EntityPropertyPickerModule { }