UNPKG

@eclipse-scout/core

Version:
85 lines 5.41 kB
/// <reference types="jquery" /> import { AnyDoEntity, Event, EventHandler, EventListener, EventMapOf, Form, HybridActionContextElements, HybridManagerEventMap, InitModelOf, ObjectOrChildModel, Session, Widget } from '../../index'; /** * A utility to invoke remote Java actions to simplify the interaction of Scout JS and Scout Classic code * to facilitate the creation of hybrid applications. */ export declare class HybridManager extends Widget { eventMap: HybridManagerEventMap; self: HybridManager; widgets: Record<string, Widget>; constructor(); static get(session?: Session, wait?: false): HybridManager; static get(session?: Session, wait?: true): JQuery.Promise<HybridManager>; protected _init(model: InitModelOf<this>): void; protected _setWidgets(widgets: Record<string, ObjectOrChildModel<Widget>>): void; protected _ensureWidgets(modelsOrWidgets: Record<string, ObjectOrChildModel<Widget>>): Record<string, Widget>; protected _triggerWidgetAdd(id: string, widget: Widget): void; protected _triggerWidgetRemove(id: string, widget: Widget): void; /** @internal */ onHybridEvent(id: string, eventType: string, data: AnyDoEntity, contextElements: HybridActionContextElements): void; /** @internal */ onHybridWidgetEvent(id: string, eventType: string, data: AnyDoEntity): void; protected _onHybridWidgetEvent(widget: Widget, eventType: string, data: AnyDoEntity): void; protected _onHybridFormEvent(form: HybridManagerForm, eventType: string, data: AnyDoEntity): void; protected _createEventId(): string; /** * Calls the hybrid action that matches the given action type. * * @returns the id of the triggered hybrid action * @see IHybridAction.java */ callAction(actionType: string, data?: AnyDoEntity, contextElements?: HybridActionContextElements): string; /** * Calls the hybrid action that matches the given action type and returns a promise that will be resolved once the corresponding hybridActionEnd event arrives. * The resolved value consist of the `data` value sent back from the server. To access the `contextElements`, use {@link callActionAndWaitWithContext} instead. * * @returns a promise that will be resolved with the result `data` once the corresponding hybridActionEnd event arrives. * @see IHybridAction * @see AbstractHybridAction.fireHybridActionEndEvent */ callActionAndWait(actionType: string, data?: AnyDoEntity, contextElements?: HybridActionContextElements): JQuery.Promise<AnyDoEntity>; /** * Calls the hybrid action that matches the given action type and returns a promise that will be resolved once the corresponding hybridActionEnd event arrives. * The resolved value is an object with the `data` and `contextElements` values sent back from the user. {@link callActionAndWait} can be used instead if only * the content of the `data` attribute is relevant. * * @returns a promise that will be resolved with the entire result object once the corresponding hybridActionEnd event arrives. * @see IHybridAction * @see AbstractHybridAction.fireHybridActionEndEvent */ callActionAndWaitWithContext(actionType: string, data?: AnyDoEntity, contextElements?: HybridActionContextElements): JQuery.Promise<HybridManagerActionEndEventResult>; /** * Calls the form hybrid action with the action type `openForm:${modelVariant}` to create, start and show the requested form. * * @param modelVariant the suffix for the actionType so the correct hybrid action can be resolved * @param data a data object that will be passed to the hybrid action * @returns a promise that will be resolved once the form has been created */ openForm(modelVariant: string, data?: AnyDoEntity): JQuery.Promise<Form>; /** * Calls the form hybrid action with the action type `createForm:${modelVariant}` to create and start the requested form without showing it. * * @param modelVariant the suffix for the actionType so the correct hybrid action can be resolved * @param data a data object that will be passed to the hybrid action * @returns a promise that will be resolved once the form has been created */ createForm(modelVariant: string, data?: AnyDoEntity): JQuery.Promise<Form>; protected _onFormAdd(form: HybridManagerForm): HybridManagerForm; one<K extends string & keyof EventMapOf<this['self']>>(type: K | `${K}:${string}`, handler: EventHandler<EventMapOf<this>[K] & Event<this>>): void; on<K extends string & keyof EventMapOf<this['self']>>(type: K | `${K}:${string}`, handler: EventHandler<EventMapOf<this>[K] & Event<this>>): EventListener; off<K extends string & keyof EventMapOf<this['self']>>(type: K | `${K}:${string}`, handler?: EventHandler<EventMapOf<this>[K] & Event<this>>): void; when<K extends string & keyof EventMapOf<this['self']>>(type: K | `${K}:${string}`): JQuery.Promise<EventMapOf<this>[K] & Event<this>>; } export interface HybridManagerActionEndEventResult { data: AnyDoEntity; contextElements?: HybridActionContextElements; } interface HybridManagerForm extends Form { /** * @returns true if {@link FormEventMap.close} event was triggered at least once for this form. */ __closeTriggered?: boolean; } export {}; //# sourceMappingURL=HybridManager.d.ts.map