UNPKG

@docsvision/webclient

Version:

Type definitions for DocsVision WebClient scripts and extensions.

154 lines (153 loc) 8.24 kB
import { GenModels } from "@docsvision/webclient/Generated/DocsVision.WebClient.Models"; import { $SearchPanel } from "@docsvision/webclient/Legacy/$SearchPanel"; import { ILegacyRouter } from "@docsvision/webclient/Legacy/ILegacyRouter"; import { $EnableRouterLogging } from "@docsvision/webclient/StandardServices"; import { IBasicEvent } from "@docsvision/webclient/System/IBasicEvent"; import { IRouteHandler } from "@docsvision/webclient/System/IRouteHandler"; import { IRouteInfo } from "@docsvision/webclient/System/IRouteInfo"; import { IRouteTypeMapper } from "@docsvision/webclient/System/IRouteTypeMapper"; import { RouteType } from "@docsvision/webclient/System/RouteType"; import { IRouter, IRouterNavigation } from "@docsvision/webclient/System/$Router"; import { ICancelableEvent } from '@docsvision/webclient/System/ICancelableEvent'; import { $LayoutManager } from '@docsvision/webclient/System/$LayoutManager'; import { $RoutingService } from '@docsvision/web/core/routing'; import { $CompanyLogo } from '@docsvision/webclient/Platform/$CompanyLogo'; import { RouteFamilySubtype } from '@docsvision/webclient/System/RouteFamilySubtype'; import { IRouteFamily } from '@docsvision/webclient/System/IRouteFamily'; export declare const CANCELED_ERROR = "canceledError"; /** Реализация роутинга в Web-клиенте. */ export declare class Router implements IRouter, ILegacyRouter, IRouterNavigation { private services; private routeFamilyList; private requestData; private get searchPanel(); private currentRouteInfo; private previousRoutePath; currentProcessingRouteInfo: IRouteInfo<any>; private currentRouteInfoChangedEvent; private routeHandlers; private pendingRouteTypeMappers; private routeTypeMappers; private lastMapper; static MainContentElementId: string; private static MainContentElementDefaultClasses; private mainContentChangingListeners; private runHandlersUpdate; private runHandlersWorking; private internalLocationUpdate; private lastRouteProcessing; private lastRouteProcessingId; private lastSetMainContentProcessing; private currentUnmountingRoute; private currentRouteHandlers; private isBack; /** * Please, don't use it. Really. */ private currentUrl; private isReplacingUrlWithoutNotification; static CurrentRouteStoreKey: string; static RouterInitialization: IBasicEvent<void>; constructor(services: $SearchPanel & $EnableRouterLogging & $LayoutManager & $RoutingService & $CompanyLogo); registerRouteFamily(routeFamily: IRouteFamily): void; getNextRoute(subtype: RouteFamilySubtype): any; back(isCancel?: boolean): Promise<void>; /** @internal */ get dangerouslyUrl(): string; get previousUrl(): string; getLastRouteProcessingId(): string; /** @internal */ addHandler<T>(routeType: RouteType, handler: IRouteHandler<T>, order?: number): void; /** @internal */ removeHandler<T>(routeType: RouteType, handler: IRouteHandler<T>): void; /** @internal */ getHandlers<T>(routeType: RouteType): IRouteHandler<T>[]; /** @internal */ addRouteTypeMapper(mapper: IRouteTypeMapper<any>): void; /** @internal */ getCurrentRoute<T>(): IRouteInfo<T>; /** @internal */ setCurrentRoute<T>(info: IRouteInfo<T>): Promise<void>; /** @internal */ get currentRouteInfoChanged(): ICancelableEvent<IRouteInfo<any>>; private onCurrentRouteInfoChanged; private runHandlers; private runHandlersWith; private reportError; private shutdownCurrentRoute; private processRoute; private updateLocation; private processRouteImpl; private unmountCurrentRoute; private getPathFromRouteMapper; /** * Открыть страницу по указанному адресу в Web-клиенте. * @param route Адрес, начинающийся с символа решетки. */ goTo(route: string, refresh?: boolean, callback?: Function): Promise<void>; /** * Подготовка страницы к открытию в новой вкладке/в новом окне браузера */ prepareWindowForOpenUrl: (mode: GenModels.OpenMode) => Window | undefined; /** * Открыть страницу (в зависимости от заданного режима): * в текущей вкладке/новой вкладке/новом окне браузера */ openUrl: (url: string, mode: GenModels.OpenMode) => Promise<any>; /** Возвращает текущий адрес (без домена). */ GetLocation(): string; /** Возвращает полный адрес на основе значения, возвращенного {@link GetLocation}. */ getLocationFromRoute(route: string): string; /** Перезагружает текущий роут Web-клиента. */ refresh(callback?: Function): Promise<void>; /** @internal */ LoadContent(url: string, requestData: any, contentElement: HTMLElement, showOverlay?: boolean, callback?: Function): void; /** @internal */ LoadMainContent(url: string, requestData: any, showOverlay?: boolean, get?: boolean, callback?: (isError?: boolean) => void): void; /** @internal */ LoadContentFromRoute(cardId: any): Promise<any>; /** Устанавливает основное содержимое Web-клиента. */ SetMainContentElement(elem: HTMLElement, doneCallback?: Function, newContentCssClass?: string): Promise<void>; /** Устанавливает основное содержимое Web-клиента. */ SetMainContentHtml(html: string, doneCallback?: Function, newContentCssClass?: string): Promise<any>; /** Уведомляет подписчиков об изменении основного содержимого. */ PrepareMainContentChange(isClear?: boolean): Promise<any>; /** Регистрирует подписчика на событие изменения основного содержимого. */ AddMainContentChangingListener(listener: (isClear?: boolean) => Promise<any>): void; /** Отменяет регистрацию подписчика на событие изменения основного содержимого. */ RemoveMainContentChangingListener(listener: (isClear?: boolean) => Promise<any>): void; /** Вызывает addEventListener для главного элемента содержимого Web-клиента. */ AddMainContentEventListener(eventType: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; /** Вызывает removeEventListener для главного элемента содержимого Web-клиента. */ RemoveMainContentEventListener(eventType: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; private LoadData; private SetContent; private OnMainContentChanging; private ClearAndGetMainContent; private renderMainContentLoader; /** Скрывает загрузчик приложения. */ static HideMainLoader(): void; /** @internal */ LoadCardContent(url: string): void; /** Устанавливает общий стиль Web-клиента на основе настроек типа карточки. */ SetTopPanelCardStyle(cardTypeWeb: GenModels.CardTypeWeb): void; private ClearFromFolderView; private showNotFound; /** * Меняет URL без оповещения об этом (т.е. привязанные на адреса обработчики не сработают) */ replaceUrlWithoutNotification(url: string): void; registerRoutes: (mapper: IRouteTypeMapper<any>) => void; locationHashChanged: (e: any) => void; /** @internal */ initialize(): void; private log; } /** Синоним {@link Router}. */ export declare type SammyHelper = Router; /** Синоним {@link Router}. */ export declare const SammyHelper: typeof Router; export interface RouteHandlerMapItem { routeType: RouteType; handlers: IRouteHandler<any>[]; }