/** Core */
import { CoreComponent } from "cmf.core/src/core";
import { ActionButtonBuildContextHandler } from "cmf.core/src/domain/metadata/action";
import Cmf from "cmf.lbos";
import { PageSection } from "cmf.core.controls/src/components/pageSection/pageSection";
import { PropertyOptions } from "../entityPropertiesViewer/entityPropertiesViewer";
/** Entity Page contract and service */
import * as ep from "./entityPageInterfaces";
import { EntityPageService } from "./entityPageService";
import { PageBag } from "cmf.core.controls/src/components/page/pageBag";
import { ResultMessageBag } from "cmf.core.controls/src/components/resultMessage/resultMessageBag";
/** Angular2 */
import * as ng from "@angular/core";
import { MetadataTableType } from "cmf.core/src/domain/metadata/table";
/**
* Table Section Item.
*/
interface TableSectionItem {
sectionId: string;
name: string;
label: string;
instance: Cmf.Foundation.BusinessObjects.Entity;
type: MetadataTableType;
}
/**
* @whatItDoes
*
* Entity page witch has uses default behavior to manage an entity's page life cycle.
* This component should bu used by other components that intend to display an entity by using the default
* behavior provided by the EntityPage or using a customized one injected by the parent component.
*
* @howToUse
*
* This component is used with the inputs and outputs mentioned below.
*
*
* ### Inputs
* `string` : **mainTitle** - Title for the page
* `string` : **subTitle** - subtitle for the page (if necessary)
* `string` : **entityTypeName** - The name of the entity type already translated (for example: Maintenance Activity Order)
* `string` : **entityType** - The entity type object name (for example: MaintenanceActivityOrder)
* which will be used to get the entity from the server as it will be used as the type to send
* `Cmf.Foundation.BusinessObjects.EntityType` : **entityTypeObject** - Some consumers may have already loaded their own EntityType object,
* so it can be injected already an be used
* `string` : **requiredFunctionalities** - The required functionalities that can be passed to the Entity Page. If this is set, this required functionality
* should the one used by the entity page and passed to the according directive to be evaluated.
* If not passed, by default it uses the _entityType.show.
* The system will check which functionality to use and will set the _requiredFunctionalitiesToEvaluate property
* `boolean` : **hideDetailsSection** - If true doesn't render the details section.
* `boolean` : **hideTablesSections** - If true doesn't render any Table section.
* `boolean` : **hideHistorySection** - If true doesn't render the history section.
* `boolean` : **hideAttributesSection** - If true doesn't render the attributes section.
* `boolean` : **hideAttachmentsSection** - If true doesn't render the attachments section.
* `boolean` : **hideWhereUsedSection** - If true doesn't render the "where used" section.
* `Object` : **extraBasicInfoProperties** - Extra properties to be added to basic info
* `boolean` : **hideDefaultSections** - Whether or not we want to hide the default sections (Details, Attachments, History and Relations)
* `boolean` : **showSystemRelations** - Whether or not we want to show system relations under the "Relations" section
*
* ### Example
* To use the component, assume this HTML Template as an example:
*
* ```HTML
*
*
*
*
*
*
*
*
*
*
*
* ```
*
* @description
*
* ## EntityPage Component
*
* ### Dependencies
*
* #### Components
* * ActionButton : `cmf.core.controls`
* * ActionButtonGroup : `cmf.core.controls`
* * ResultMessage : `cmf.core.controls`
* * VersionDropdown : `cmf.core.business.controls`
* * PageBag : `cmf.core.controls`
*
* #### Services
* * EntityPageService : `cmf.core.business.controls`
* * ServiceB : `package` (Ex: `cmf.core.controls`)
*
* #### Directives
* * RequiredFunctionalities : `cmf.core.controls`
* * DirectiveB : `package` (Ex: `cmf.core.controls`)
*
*/
export declare class EntityPage extends CoreComponent implements ng.OnInit, ng.OnDestroy, ng.OnChanges, ng.AfterViewInit {
private _viewContainerRef;
private _changeDetector;
_pageBag: PageBag;
_entityPageService: EntityPageService;
/**
* Used for leave page confirm
*/
private _util;
/**
* Deprecated title input
*/
private title;
/**
* Title for the page
*/
private _title;
/**
* Subtitle for the page (if necessary)
*/
private _subTitle;
/**
* Focus interval for sections.
*/
private _focusInterval;
/**
* The name of the entity type already translated (for example: Maintenance Activity Order)
*/
_entityTypeName: string;
/**
* The entity type object name (for example: MaintenanceActivityOrder)
which will be used to get the entity from the server as it will be used as the type to send
*/
_entityType: string;
/**
* Some consumers may have already loaded their own EntityType object, so it can be injected already an be used
*/
_entityTypeObject: Cmf.Foundation.BusinessObjects.EntityType;
/**
* The required functionalities that can be passed to the Entity Page. If this is set, this required functionality
should the one used by the entity page and passed to the according directive to be evaluated.
* If not passed, by default it uses the _entityType.show.
* The system will check which functionality to use and will set the _requiredFunctionalitiesToEvaluate property
*/
private _requiredFunctionalitiesProp;
/**
* If true doesn't render the details section.
*/
_hideDetailsSection: boolean;
/**
* If true doesn't render any Table section.
*/
_hideTablesSections: boolean;
/**
* If true doesn't render the history section.
*/
_hideHistorySection: boolean;
/**
* If true doesn't render the attributes section.
*/
_hideAttributesSection: boolean;
/**
* If true doesn't render the attachments section.
*/
_hideAttachmentsSection: boolean;
/**
* If true doesn't render the relations section.
*/
_hideRelationsSection: boolean;
/**
* If true doesn't render the "where used" section.
*/
_hideWhereUsedSection: boolean;
/**
* Extra Properties to be used in basic info
*/
_extraBasicInfoProperties: {
[key: string]: string | PropertyOptions;
};
/**
* Properties to Remove from the basic info
*/
_propertiesToRemove: string[];
/**
* Whether or not we want to hide all default sections
*/
hideDefaultSections: boolean;
/**
* Whether or not we show the system relations
*/
showSystemRelations: boolean;
/**
* Shared button visibility. May be used to hide buttons by parent components.
* It won't affect the visibility logic that already exists
*/
sharedButtonsVisibility: ep.EntityPageSharedButtonsVisibility;
/**
* Table Sections array
*/
tableSections: TableSectionItem[];
/**
* This is the required functionality that will be used by the entity page
*/
private _requiredFunctionalitiesToEvaluate;
/**
* Action Bar Id to be accessible through metadata.
*/
_actionBarId: string;
/**
* The entity's id
*/
private _entityId;
/**
* Will allow the action to update when the entity changes
*/
private _isEntityChanged;
/**
* Will allow the change state action
*/
_canChangeState: boolean;
/**
* Will allow the lock action
*/
_canEntityPageAlterIsLocked: boolean;
/**
* Will allow the state adjust action
*/
_canAdjustState: boolean;
/**
* Will allow the lock action
*/
_entityPageIsLocked: boolean;
/**
* Will allow the special lock action
*/
_entityPageSpecialUnLock: boolean;
/**
* Will allow the un-terminate action
*/
_entityVersionIsTerminated: boolean;
/**
* Marks if the entity page is blocked or not. By default it is not blocked,
but can be if certain business conditions are not not present, such as:
* - User does not have the required functionality so access the entity page
* - An unknown entity type was provided
* - If the entity type is correct, the actual entity to display may not exist on the system
* - User does not have the necessary privileges to access the entity page
*
* In all of the above cases, the base page is not displayed and instead we provide a result message to the user
*/
_isEntityPageBlocked: boolean;
/**
* In case the entity is not valid, then this Array will be used to feed the messages
to display to the user via the ResultMessage component
*/
_resultMessages: Array;
/**
* The title for the details section (by default is DETAILS)
*/
_detailsSectionTitle: string;
/**
* Title for the history section
*/
_historySectionTitle: string;
/**
* Title for the attributes section
*/
_attributesSectionTitle: string;
/**
* Title for the attachments section
*/
_attachmentsSectionTitle: string;
/**
* Title for the relations section
*/
_relationsSectionTitle: string;
/**
* Title for the "where used" section
*/
_whereUsedSectionTitle: string;
/**
* Will allow entity to be cloned
*/
_canBeCloned: boolean;
/**
* Current user has permission to see history feature
*/
hasHistoryFeature: boolean;
/**
* EntityType Metadata IsHistoryEnabled property
*/
_isHistoryEnabled: boolean;
private _actionBar;
private _actionButtonGroups;
private _actionButtonGroupButtons;
private _actionButtons;
private _refreshEventSubscription;
private _entity;
_isCreatedVersionVisible: boolean;
_isSetEffectiveVisible: boolean;
isEditVisible: boolean;
/**
* Defined if the connect button will appear in the action bar
*/
isConnectButtonVisible: boolean;
/**
* Controller which this instance is connect to
*/
connectedAutomation: Cmf.Foundation.BusinessObjects.AutomationController;
/**
* Explicitly set scroll sections
*/
_scrollSections: PageSection[];
/**
* Placeholders (lazyload)
*/
placeholderLoadType: Object;
relationsAvailable: boolean;
attributesAvailable: boolean;
/**
* Sections component
*/
private _sections;
/**
* Table sections
*/
private _tableSections;
/**
* Details section
*/
private _detailsSection;
/**
* History section
*/
private _historySection;
/**
* Attributes section
*/
private _attributesSection;
/**
* Attachments section
*/
private _attachmentsSection;
/**
* Relations section
*/
private _relationsSection;
/**
* Where Used section
*/
private _whereUsedSection;
/**
* Inner page sections
*/
private childrenSections;
/**
* Reference to the parent component which may have specialized behavior that will be called by the EntityPage life cycle
*/
private _parentComponent;
constructor(_viewContainerRef: ng.ViewContainerRef, _changeDetector: ng.ChangeDetectorRef, _pageBag: PageBag, _entityPageService: EntityPageService);
/**
* This is a simple generic method that will return a member to invoke in case it's callable,
* otherwise returns a value in case it's a getter or sets a value, in case it's a setter
* @param methodName
*/
private invokeService;
/**
* This method evaluates the actions buttons and action button groups that are projected to the EntityPage
* and which the ActionBar can't handle
*/
evaluateActions(): Promise;
/**
* If there is an business rule not met prior to the entity load, we block the page
*/
private blockEntityPage;
/**
* Update the scroll sections
* This includes to read the projected sections and order everything back
*/
private updateScrollSections;
/**
* Loads the entity
*/
private loadEntity;
/**
* Load the Context Tables set on the metadata.
* @param entity instance.
*/
private loadTablesFromMetadata;
private addTableSections;
private createContextForCreationWizard;
/**
* Refresh entity page
*/
refresh(): void;
/**
* SetEffective click event
*/
btnSetEffectiveClick(): void;
/**
* Will kick-off by loading the entity after any required functionality has been evaluated
* @param isRequiredFunctionalitiesPass
*/
requiredFunctionalitiesEvaluated(isRequiredFunctionalitiesPass: boolean): void;
/**
* Called when the entity the entity page is displayed has been updated. It will give the indication that the page can be refreshed.
* If the update was done in the same page, the refresh event will make a
* complete update of the page invalidating the indication performed by this method.
* @param args
*/
private onEntityChanged;
/**
* Will compute some properties after the component's inputs are set
*/
ngOnInit(): void;
/**
* Will forget about the entity
*/
ngOnDestroy(): void;
/**
* On Changes method
* @param changes
*/
ngOnChanges(changes: ng.SimpleChanges): void;
ngAfterViewInit(): Promise;
/**
* Selects the first available property editor input
*/
private selectSection;
/**
* When action is evaluated and requires context
*/
onBuildContextHandlerForWizard: ActionButtonBuildContextHandler;
/**
* Build context for generic connect wizard.
*/
onBuildContextHandlerForConnectWizard: ActionButtonBuildContextHandler;
/**
* Build context for Edit Button
*/
onBuildContextForEditHandlerForWizard: ActionButtonBuildContextHandler;
/**
* Build context for Create new version Button
*/
onBuildContextForCreateVersionHandlerForWizard: ActionButtonBuildContextHandler;
/**
* Build context for Export wizard button.
*
* The context of the Export Wizard is setup so that the wizard
* skips the "Select Items" step and automatically goes into the
* "File" step.
*
* @param framework The framework object.
* @param context The context passed to the the Export Wizard.
*
* @returns A promise that is fulfilled with the context object
* needed to start the Export Wizard in the "export entity" mode.
*/
onBuildContextHandlerForExportWizard: ActionButtonBuildContextHandler;
}
export {};