/** Core */ import { CoreComponent } from "cmf.core/src/core"; import { Cmf } from "cmf.lbos"; import { PageBag } from "cmf.core.controls/src/components/page/pageBag"; /** Angular */ import * as ng from "@angular/core"; import { DatagridType } from "./steps/stepSelectItems"; import { OnValidateArgs, OnValidate } from "cmf.core.controls/src/directives/validator/validator"; import { WizardEventArgs } from "../createEditEntity/createEditEntity"; import { Wizard } from "cmf.core.controls/src/components/wizard/wizardBase"; export { DatagridType }; /** * Interface for the context object that is passed to the Export * wizard via the PageBag. */ export interface ContextForExportWizard { /** * The object to be exported by the wizard. * * If no object is provided, then the Export Wizard will display * the "Select Items" step where the user can select what objects * will be exported by the wizard. */ object: any | null; /** * The type of object to export. */ type: DatagridType; /** * The EntityType of the object being exported. If the user is * trying to export something that is not an entity type (e.g. a * QueryObject) then this field is "null". */ entityType: Cmf.Foundation.BusinessObjects.EntityType | null; } /** * @whatItDoes * * Provides a wizard that can be used to export objects from the system. * * This wizard has two steps: * * - A "Select Items" step where the user can select which items to * export. * * - A "File" step where the user can give the name of the file that * should be created by the export service. * * This wizard can receive via the context object a object to * export. If no such object is provided, then the wizard shows a * "Select Items" step where the user can select what items to * export. If the context already has the object to export then the * wizard will skip the "Select Items" step and go directly to the * "File" step. * * @howToUse * * This component is used with the inputs and outputs mentioned below. * * ### Inputs * `any[] | null` : **objectsToExport** - The objects to be exported * from this wizard. This value is transmited to the wizard via the * "context" PageBag. If the value is "null" then the step "Select * Items" is shown to the user so that they can select what items to * export, otherwise the wizard skips the "Select Items" step and goes * directly to the "File" step. * `DatagridType` : **type** - The type of object to export. * `Cmf.Foundation.BusinessObjects.EntityType` : **entityType** - The * entity type of the objects to export. This field is null when the * wizard is exporting an object that isn't a EntityType (e.g. the * QueryObjects). * * ### Outputs * None. * * ### Example * To use the component, assume this HTML Template as an example: * * ```HTML * * ``` * * @description * * ## WizardExport Component * * ### Dependencies * * #### Components * Wizard : `cmf.core.controls` * WizardStep : `cmf.core.controls` * StepFile : `cmf.core.business.controls` * StepSelectItems : `cmf.core.business.controls` * * #### Services * * _This component does not depend on any service_ * * #### Directives * * Validator : `cmf.core.controls` * * TransactionWizard : `cmf.core.business.controls` */ export declare class WizardExport extends CoreComponent implements OnValidate { private _pageBag; /** * Wizard component being used on the template. */ wizard: Wizard; /** * Flag that indicates if the "Select Item" step of the export * wizard should be shown to the user. * * This step is skipped if the PageBag context already specifies * the objects to export. */ showSelectItemWizardStep: boolean; /** * Entity that will be exported by this wizard. * * This is used to show the entity on the EntityBasicInfoSlim component * that is on the export wizard. This component is only shown to the user * if the Button Context that triggered the Export Wizard passed an item * to be export and that item is an Entity object. */ object: Cmf.Foundation.BusinessObjects.Entity; /** * The type of the entity that will be exported by this wizard. */ objectType: Cmf.Foundation.BusinessObjects.EntityType; /** * The array of objects that will be exported by this wizard. */ objectsToExport: Cmf.Foundation.Common.Base.CoreBase[] | null; /** * Name of the file that will be used to store the exported * objects. */ fileToExport: string | null; /** * Type of datagrid to use in the "Select Items" step. */ datagridType: DatagridType; /** * Flag indicating if the export service should compress the * output by creating a zip file instead of an xml file. */ compressFile: boolean; constructor(viewContainerRef: ng.ViewContainerRef, _pageBag: PageBag); /** * Helper method that will load the latest data of the objects * that are being exported. * * This is used to workaround some issues that happen with the * backend where the export functionality of some of the Entity * types will not correctly load all of the fields of the object * being exported. This results in the export file not having all * of the data of the object, making it so that the object cannot * be imported into another system. * * This method can only be used if the Export Wizard is exporting * Entity objects. * * @returns A Promise that is fulfilled with the fully loaded Entity objects to export. */ private loadObjectsToExport; /** * Send the request to the export backend. * * This request will cause the export backend send a file via the HTTP response that will be downloaded by the user's browser. * * @returns A Promise that is fulfilled with the file returned by the HTTP response. */ private exportObjects; /** * Callback that is called when the user clicks on the "Finish" button of the Export Wizard. * * This callback is reponsible for: * - Sending the export request to the backend; * - Closing the wizard * * @param args The payload of the wizard "finish" event. * * @returns Nothing. */ onWizardFinish(args: WizardEventArgs): void; /** * Callback that is called when the user changes the items to be * exported. * * @param event An array containing the items that will be * exported by the Export Wizard. * * @returns Nothing. */ onSelectedEntitiesChanged(event: any[]): void; /** * Callback that is called when the user changes the file name of * the file generated by the backend export service when exporting * the objects. * * @param event A string containing the name of the file to use, * or "null" if no file name is provided. * * @returns Nothing. */ onFileNameChange(event: string | null): void; /** * Callback that is called when the user changes the flag that * specifies if the attachment returned by the Export Wizard will * be compressed into a zip format, or if it will be exported in * the a normal Xml format. * * @param event "true" if the attachment created by the export * backend should be compressed into a zip, "false" if the export * backend should create a xml file. * * @returns Nothing. */ onCompressFileChange(event: boolean): void; /** * On Validate callback. */ onValidate(args: OnValidateArgs): Promise; } export declare class WizardExportModule { }