/** Core */
import { CoreComponent } from "cmf.core/src/core";
import * as ngRouter from "@angular/router";
import { ExecutionViewTabDef } from "cmf.core.controls/src/components/executionViewTab/executionViewTab";
import { Wizard } from "cmf.core.controls/src/components/wizard/wizardBase";
import { WizardEventArgs } from "cmf.core.controls/src/components/wizard/wizardDef";
import { CreateEditStep } from "./createEditStep";
import * as TransactionWizardPackage from "../../directives/transactionWizard/transactionWizard";
import * as TransactionExecutionViewPackage from "../../directives/transactionExecutionView/transactionExecutionView";
import { ChangeSetSelectedArgs } from "../changeSetSelector/changeSetSelector";
import { EditMode } from "../entityPropertiesEditor/entityPropertiesEditor";
import Cmf from "cmf.lbos";
/** Angular */
import * as ng from "@angular/core";
/**
* Enum with the EditModes accepted by this component
*/
export { EditMode, WizardEventArgs, ExecutionViewTabDef, ChangeSetSelectedArgs };
/**
* @whatItDoes
*
* This components serves as a support component to create and edit entities.
* If EditMode is Create or CreateNewVersion it will behave as a Wizard. If EditMode is Edit, it will behave as an ExecutionView.
* By default, the wizard calls the generic service to each operation. It is possible to override this behavior by passing a BaseInput object in inputObj.
* The steps of the wizard/ExecutionView are passed by the user.
* The goal is to use the same steps for both situations without having to create different components.
*
* @howToUse
*
* This component is meant to be used when creating/editing entities.
* This components receives the instance, the EditMode, steps to show and deals with rendering of the Wizard/ExecutionView and calling services.
*
* ### Inputs
* `string | EditMode` : **editMode** - The editMode of the component.
* `string` : **mainTitle** - The main title of the Wizard/ExecutionView
* `string` : **actionName** - The action name of the Wizard/ExecutionView
* `any` : **instance** - The instance of the entity that is being created/updated
* `string` : **entityTypeName** - The name of the entityType.
* `Cmf.Foundation.BusinessOrchestration.BaseInput` : **inputObj** - The input object to be used to override the default behavior of the component.
* `Function` : **onInitialSetupStart** - A callback to do stuff on the wizard prepare data input
* `Function` : **onInitialSetupFinish** - A callback to do stuff on the wizard handle data output
* `Function` : **onBeforeServiceCall** - A callback to do stuff before calling the service
* `Function` : **onAfterServiceCall** - A callback to do stuff after calling the service
* `boolean` : **navigateOnFinish** - When using the default services and if true, navigates to the instance entity page
* `boolean` : **showSecondaryButtonOnEditMode** - By default "Save Now" button is hidden. This allow to show it
* `boolean` : **hideAttributesStep** - By default, "Edit Attributes" step is shown. This allows us to hide it
* `Cmf.Foundation.BusinessObjects.EntityInstance` : **headerInstance** - Entity to display on the top of the wizard
*
* ### Outputs
* `Cmf.Foundation.BusinessOrchestration.BaseOutput` : **onServiceFinished** - Emits the output of the service when the input is override.
* `Object`: **onStepChanged** - Emits the on step change event
* `Cmf.Foundation.BusinessObjects.Entity` : **entityUpdate** - Emits the updated entity after an edit. Please bear in mind that, for editing,
* you *must* subscribe to this event and provide the fresh entity instance to the instance input again. Otherwise, Save Now will break your instance state.
*
* ### Example
* To use the component, assume this HTML Template as an example:
*
* ```HTML
*
* ```
*
* @description
*
* ## CreateEditEntity Component
*
* ### Dependencies
*
* #### Components
* * ExecutionView: `cmf.core.controls`
* * Wizard: `cmf.core.controls`
* * ChangeSetSelector: `cmf.core.business.controls`
*
* #### Directives
* * TransactionWizard : `cmf.core.business.controls`
* * TransactionExecutionView : `cmf.core.business.controls`
* * Validator : `cmf.core.controls`
*/
export declare class CreateEditEntity extends CoreComponent implements ng.AfterViewInit, ng.OnChanges, TransactionWizardPackage.TransactionWizardInterface, TransactionExecutionViewPackage.TransactionExecutionViewInterface {
private _ngRouter;
private _elementRef;
private _editMode;
_entityType: Cmf.Foundation.BusinessObjects.EntityType;
private _executionView;
private _executionViewSteps;
private _wizardSteps;
/**
* By default, wizard calls Create/CreateNewVersion/FullUpdate depending of editMode.
* If this input is passed, the wizard will call it
*/
private inputObj;
private _changeSetArgs;
private _isProgressIndicadorInDom;
_steps: ng.QueryList;
/**
* Edit mode. If Create, assume wizard.
* If Edit assumes ExecutionView
*/
editMode: any;
/**
* Main title
*/
mainTitle: string;
/**
* Action Name
*/
actionName: string;
/**
* Instance to create/update
* When updating, its assumed that its already initialized
*/
instance: any;
/**
* EntityType Name
*/
entityTypeName: string;
/**
* Entity to display on top of the wizard
*/
headerInstance: Cmf.Foundation.BusinessObjects.EntityInstance;
/**
* Before service call action callback
*/
onBeforeServiceCall: (instance: any, changeSetArgs?: ChangeSetSelectedArgs) => Cmf.Foundation.BusinessOrchestration.BaseInput;
/**
* After service call action callback
*/
onAfterServiceCall: (instance: Cmf.Foundation.BusinessOrchestration.BaseOutput) => void;
/**
* Before transaction finish
*/
onBeforeFinish: (instance: any) => void;
/**
* On initial setup start
*/
onInitialSetupStart: (instance: any) => Cmf.Foundation.BusinessOrchestration.BaseInput[];
/**
* After calling the service, if true navigate to instance entity page.
* This behavior is only used if using default services.
*/
navigateOnFinish: boolean;
/**
* Show "Save Now" button on execution view.
*/
showSecondaryButtonOnEditMode: boolean;
/**
* Whether or not we want to hide the Edit Attributes Step
*/
hideAttributesStep: boolean;
/**
* Whether or not we want to declare the Attributes step as optional
*/
isAttributeStepOptional: boolean;
/**
* On initial setup finish
*/
onInitialSetupFinish: (instance: any, outputs: Cmf.Foundation.BusinessOrchestration.BaseOutput[]) => void;
/**
* Emits the output of the service when the input is overridden
*/
onServiceFinished: ng.EventEmitter;
/**
* Emits on step changed event.
*/
onStepChanged: ng.EventEmitter;
entityUpdate: ng.EventEmitter;
entityChange: ng.EventEmitter;
/**
* Inner wizard component, if available
*/
wizard: Wizard;
/**
* Whether it is to show success message on wizard finish
*/
showSuccessMessages: boolean;
/**
* Constructor
*
* @param viewContainerRef the reference to the component view container
*/
constructor(viewContainerRef: ng.ViewContainerRef, _ngRouter: ngRouter.Router, _elementRef: ng.ElementRef);
/**
* Handles a change in the steps.
* When the steps change, we need to get the Wizard or ExecutionView step also
* to change its validator, so the validation chain would work well.
* Since the Step is a ValidatorModel node, we set the validator model
* of each step to the validator model of the CreateEditStep.
* Element (validator) -> CreateEditStep (validator model) -> Wizard/ExecutionView (validator model)
*/
onStepsChange: () => void;
/**
* Subscribes for events for step changes
*/
ngAfterViewInit(): void;
/**
* Loads the EntityType when the instance changes
* The load may be done from instance or from the name of the entityType
* Assuming that the EntityType once loaded do not change
*/
ngOnChanges(changes: ng.SimpleChanges): void;
/**
* Prepare data input
*/
prepareDataInput(): Promise;
/**
* Handle data output
*/
handleDataOutput(outputs: Cmf.Foundation.BusinessOrchestration.BaseOutput[]): Promise;
/**
* Prepare Input for Wizard
*/
prepareTransactionInput(args: TransactionWizardPackage.TransactionWizardArgs): Promise;
/**
* Redirects to entity page of the created instance
*/
handleTransactionOutput(output: Cmf.Foundation.BusinessOrchestration.BaseOutput): Promise;
/**
* On changeSet updated, keep changes
*/
onChangeSetUpdated(args: ChangeSetSelectedArgs): void;
/**
* Handles a change of the step.
* When a step became visible, mark every steps as not visible.
* This will be used by the differInstantiation directive to show the step.
* Then, emit the event.
* @param event Event args
*/
onActiveStepChanged(event: ExecutionViewTabDef | WizardEventArgs): void;
}
export declare class CreateEditEntityModule {
}