/** Core */ import { ActionTrigger } from "cmf.core/src/domain/metadata/action"; import { ModuleLoaderComponent } from "cmf.core/src/domain/extensions/module.loader"; import { ComponentFramework } from "cmf.core/src/core"; /** Angular2 */ import { ElementRef, EventEmitter } from "@angular/core"; import { ActivatedRoute, ActivatedRouteSnapshot } from "@angular/router"; import { ModalMode } from "cmf.core/src/domain/extensions/modal"; import { ResultMessageBag } from "../resultMessage/resultMessageBag"; export declare const BAG_OUTPUTS: Symbol; export declare const BAG_OUTPUTS_HANDLER: Symbol; /** * Page before leave handler, to be associated with the page bag * Note that, for the leave operation to proceed and if this method exists * It must return true */ export declare type PageBeforeLeaveHandler = () => Promise; export interface ModalHandler { modals: PageBag[]; modalMode: ModalMode; } /** * This class is a simple POJO that can help in keeping track of a page * * @class PageSwitcherBag */ export declare class PageBag { /** * If the page bag is placeholder (temporary state of page bag) */ isPlaceholder: boolean; /** * If the page is in bookmarks */ isBookmarked: boolean; /** * If the page is to be opened on start */ isToOpenOnStart: boolean; /** * When page is being dragged */ dragging: boolean; /** * When page is being highlighted by drag over */ highlighted: boolean; /** * Just a unique id for the switcher */ id: string; /** * Whether the page bag has been marked for removal. This flag will signal an attempt to remove the pag between event loops */ isBeingRemoved: boolean; /** * Marks the process of creation within the routing navigation routine. */ isBeingAdded: boolean; /** * The header object which defines the title for the page and icon class */ header: PageBagHeader; /** * Context is a loose object where we can augment at will. The idea is to have a certain degree of flexibility in what we can delegate to sub components. */ context: any; /** * The module and component information that must be loaded. */ component: ModuleLoaderComponent; /** * Easy access to the page's url */ url: string; /** * Route containing all the relevant route information for the root page */ route: ActivatedRoute | ActivatedRouteSnapshot; /** * Component reference */ componentRef: ModalHandler; /** * Element Ref to anchor of this page */ anchor: ElementRef; /** * ActionTrigger that triggered this page. * @see {ActionTrigger} */ trigger: ActionTrigger; /** * Refresh event where all interested components can register so they are notified when a refresh happens */ refreshEvent: EventEmitter; /** * Double-click event where all interested components can register so they are notified when a double-click happens */ tabDblClickEvent: EventEmitter; /** * Feedback event when some component is interested in notifying other components in the page of some feedback to be shown */ feedbackEvent: EventEmitter; /** * Event where all interested components can register so they are notified when this page is opened */ enterPageEvent: EventEmitter; /** * Event where all interested components can register so they are notified when this page is closed */ exitPageEvent: EventEmitter; /** * Page events current handlers */ pageEvents: PageEvents; /** * Evaluates the page bag context pre-conditions using the supplied additional context * @param framework Current framework * @param pageBag Page bag being evaluated * @param additionalContext Object containing the changes that should be considered on the context, such as {'instance': newInstance} * so that the validation can use the new data * @returns An array of messages, on error, or null if no validation function is found or the validation resolves to true */ static evaluateCanExecute(framework: ComponentFramework, pageBag: PageBag, additionalContext?: any): Promise; /** * Assigns to a page bag context outputs the outputs object, * @param pageBag PageBag to be modified, where the outputs will be added * @param outputs Outputs object that will be assigned on top of the current outputs. If null, it will clear the outputs */ static appendOutputs(pageBag: PageBag, outputs: { [s: string]: any; }): void; /** * Adds a callback function to a given context to handle the output result * @param context Context to append the callback to * @param callback Function that receives the results as an object with string keys and returns an empty promise */ static addOutputsHandler(context: any, callback: (results: { [s: string]: any; }) => void): void; /** * Triggers the output function on a pagebag context, if it exists * @param pageBag PageBag to trigger outputs on */ static triggerOutputs(pageBag: PageBag): void; } /** * Page bag header definition - used in the page header representation */ export interface PageBagHeader { /** * Title of the page */ title: string; /** * Indicates the icon class for the page defined in the metadata */ iconClass: string; /** * Indicates if the page is outdated or not, normally used for visual purposes to give the user the indication * that a given view has changed */ isOutdated: boolean; } /** * Page events handlers */ export interface PageEvents { /** * Page before leave handler, to be associated with the page bag * Note that, for the leave operation to proceed and if this method exists * It must return true */ beforeLeaveHandler?: PageBeforeLeaveHandler; }