/** Core */ import { CoreComponent } from "cmf.core/src/core"; import Cmf from "cmf.lbos"; import { EntitiesSlimListing } from "./entitiesSlimListing"; import { ValidObjectDisplay, WhereUsedData, EntityTypeWhereUsedData } from "./entityWhereUsedDef"; /** Angular */ import * as ng from "@angular/core"; /** * Types of objects that can be displayed in the WhereUsed section. */ export { ValidObjectDisplay, WhereUsedData, EntityTypeWhereUsedData }; /** * @whatItDoes * * Implements the Where Used section for use with an entity instance. * * This component displays to the user a list of all of the entities * that are using this main entity. * * @howToUse * * This component is used with the inputs and outputs mentioned below. * * ### Inputs * `Cmf.Foundation.BusinessObjects.Entity | null` : **instance** - The * main entity object whose references will be displayed by this * component. * * ### Outputs * _None._ * * ### Example * To use the component, assume this HTML Template as an example: * * ```HTML * * * ``` * * @description * * ## EntityWhereUsed Component * * ### Dependencies * * #### Components * * Checkbox : `cmf.core.controls` * * Searchbox : `cmf.core.controls` * * EntitiesSlimListing : `cmf.core.business.controls` * * DropdownEntitySelect : `cmf.core.business.controls` * * #### Services * _This component does not depend on any service._ * * #### Directives * * ProgressIndicator : `cmf.core.controls` * */ export declare class EntityWhereUsed extends CoreComponent implements ng.OnChanges { private _elementRef; /** * A clone of the original list of entity types that were returned * from the server backend. * * This object is a clone of the field "entityTypesAvailable"- * * This list is used so that it's possible to know what entity * types where original available, even when the field * "entityTypesAvailable" is reduced due to the filters that were * provided by the user. */ private originalEntityTypes; /** * Quantity of each entity type that has been loaded so far by * this component. * * Each key of the map is a string representing an entity name * and their value are the number of entity objects that have * been loaded. */ private quantityLoaded; /** * The element ref of the
that contains the * entitiesSlimListing component. * * This field is only used to setup a progress indicator when the * user changes the search. */ private entitiesSlimDisplayDiv; /** * Amount of entities to load with each "Load more" event. */ private loadMorePageSize; /** * Boolean flag indicating if the backend service should return * the entities that are Terminated. */ private isToShowTerminated; /** * Main Entity instance. */ instance: Cmf.Foundation.BusinessObjects.Entity | null; /** * A string representing the contents of the SearchBox component * shown on the template. This string is used by the backend * service to restrict the name of the entities that are returned. */ searchValue: string | null; /** * An array of strings containing the entity types that are * available on the backend service. */ entityTypesAvailable: string[]; /** * An array of strings containing the entity types that are * currently being filtered. * * Entity types that are not in this array are not shown to the * user. As an exception, if this array is empty then all of the * entity types are displayed to the user. */ entityTypesSelectedForDisplay: string[]; /** * The parsed data that was retrieved from the backend. */ data: EntityTypeWhereUsedData[]; /** * Flag that indicates if the main instance of this component has * any references to display in this entityWhereUsed component. * * This flag is only changed when fetching the initial data of the * instance and is used to display a message in the template that * informs the user if the instance has no references. */ mainInstanceHasReferences: boolean; /** * Constructor * * @param viewContainerRef the reference to the component view * container */ constructor(viewContainerRef: ng.ViewContainerRef, _elementRef: ng.ElementRef); /** * Check if there is an entity type filter enabled. * * @returns "true" if there is an entity type filter active, * "false" otherwise. */ private hasEntityTypeFilter; /** * Reload all of the currently displayed data from the backend * taking into account any new search filter. * * This component will attempt to load the same number of entities * objects that are being displayed, e.g. if there are currently * 20 Materials being displayed, then this method will try to load * 20 materials from the backend service. If there are not 20 * materials available then all of the material will be loaded. * * @returns A Promise that is fulfilled when the data has been * loaded and parsed. */ private refreshAllDataFromServer; /** * Load more entity objects of a given entity type from the * backend server. * * @param entityTypeName The Entity Type to load. * * @param quantityToLoad The quantity of entity objects that the * backend should return. If the backend has less entities than * the ones requested, then return all entities. * * @returns A Promise that is fulfilled when the data is loaded * and parsed from the backend. */ private loadMoreFromServer; /** * Create an Entity object by parsing a row returned from the * backend service. * * This method will take into account if the row represents an * EntityVersion object and create that object instead of creating * an Entity object. * * @param row The row returned from the backend service. * * @returns A Promise that is fulfilled with the * Entity/EntityVersion object that was stored in the row or * "null" if the parse wasn't successful. */ private createdEntityObjectFromDatasetRow; /** * Parse an array of rows returned from the backend service. * * @param type A string representing the type stored in the rows * that are being parsed. E.g. "Material", "SmartTable", etc. * * @param rows The dataset rows returned from the backend service. * * @returns A Promise that is fulfilled with the parsed dataset. */ private parseBackendDatasetRows; /** * Parse a backend service response. * * @param output The LBO output object returned from the backend * service. * * @returns A Promise that is fulfilled when all of the output * data is processed. */ private parseBackendResponse; /** * Get the value to use as the Page Size of the "Load more" * functionality. * * This value is used to calculate how many new entries the * backend service should return with each successive use of the * "Load more". * * @returns A Promise that is fulfilled with the value to use as * the "Load More" page size. */ private getLoadMorePageSize; /** * Helper method to store the quantity of objects of a given type that are being loaded in the "this.quantityLoaded" map. * @param entityTypeName The entity type name whose quantity is being updated. * @param newQuantityLoaded The quantity of objects loaded with this entity type. */ private setQuantityLoaded; /** * Reset the filters to their default state. * * @returns Nothing. */ private clearFilters; /** * Get the title to display for a list of objects of a given type. * * See also @see convertTitleToObjectType for the method that * performs the reverse transformation. * * @param typeName A string representing the type whose header * title will be calculated. * * @returns A string containing the title that should be used by * this component as the header for the list of objects of the * given type. */ private getHeaderTitleForObject; /** * Get the type of an object based on its title. * * See also @see getHeaderTitleForObject for the method that * performs the reverse transformation. * * @param typeName A string representing the header title to be * converted. * * @returns A string containing the type of the object that * represents the object type with the given title. */ private convertTitleToObjectType; /** * Callback that is called when the user changes the value of the * "Terminated" checkbox that is shown on the template of this * component. * * @param args The event sent from the Checkbox component. * * @returns Nothing. */ onTerminatedChange(args: any): void; /** * Callback that is called when the user changes the value of the * SearchBox that is shown on the template of this component. * * @param args The event sent from the SearchBox component. * * @returns Nothing. */ onSearchChange(args: any): void; /** * Callback that is called when the user changes the list of * entity types to filter on the DropdownEntitySelect component * that is shown on the template of this component. * * @param args The event sent from the DropdownEntitySelect * component. * * @returns Nothing. */ onEntityTypeDropdownChange(args: any): void; /** * Callback that is called when the user clicks on the "Load more" * link on one of the EntitiesSlimListing component that is shown * on the template of this component. * * @param args The event that is sent from the EntitiesSlimListing * component. * * @param entitySlimListingComponent The EntitiesSlimListing * component that triggered the event. This needed in order to * display a progress indicator over it while the data is being * loaded. * * @returns Nothing. */ onLoadMoreClick(args: any, entitySlimListingComponent: EntitiesSlimListing): void; /** * Angular On Changes method. */ ngOnChanges(changes: ng.SimpleChanges): void; } export declare class EntityWhereUsedModule { }