99 lines
3.2 KiB
TypeScript
99 lines
3.2 KiB
TypeScript
import { IpcRegistryDescription, Registry } from "tc-shared/events";
|
|
import { VideoViewerEvents } from "tc-shared/video-viewer/Definitions";
|
|
import { ChannelEditEvents } from "tc-shared/ui/modal/channel-edit/Definitions";
|
|
import { EchoTestEvents } from "tc-shared/ui/modal/echo-test/Definitions";
|
|
import { ModalGlobalSettingsEditorEvents } from "tc-shared/ui/modal/global-settings-editor/Definitions";
|
|
import { InviteUiEvents, InviteUiVariables } from "tc-shared/ui/modal/invite/Definitions";
|
|
import { ReactElement } from "react";
|
|
import * as React from "react";
|
|
import { IpcVariableDescriptor } from "tc-shared/ui/utils/IpcVariable";
|
|
export declare type ModalType = "error" | "warning" | "info" | "none";
|
|
export declare type ModalRenderType = "page" | "dialog";
|
|
export interface ModalOptions {
|
|
/**
|
|
* Unique modal id.
|
|
*/
|
|
uniqueId?: string;
|
|
/**
|
|
* Destroy the modal if it has been closed.
|
|
* If the value is `false` it *might* destroy the modal anyways.
|
|
* Default: `true`.
|
|
*/
|
|
destroyOnClose?: boolean;
|
|
/**
|
|
* Default size of the modal in pixel.
|
|
* This value might or might not be respected.
|
|
*/
|
|
defaultSize?: {
|
|
width: number;
|
|
height: number;
|
|
};
|
|
/**
|
|
* Determines if the modal is resizeable or now.
|
|
* Some browsers might not support non resizeable modals.
|
|
* Default: `both`
|
|
*/
|
|
resizeable?: "none" | "vertical" | "horizontal" | "both";
|
|
/**
|
|
* If the modal should be popoutable.
|
|
* Default: `false`
|
|
*/
|
|
popoutable?: boolean;
|
|
/**
|
|
* The default popout state.
|
|
* Default: `false`
|
|
*/
|
|
popedOut?: boolean;
|
|
}
|
|
export interface ModalFunctionController {
|
|
minimize(): any;
|
|
supportMinimize(): boolean;
|
|
maximize(): any;
|
|
supportMaximize(): boolean;
|
|
close(): any;
|
|
}
|
|
export interface ModalEvents {
|
|
"open": {};
|
|
"close": {};
|
|
"destroy": {};
|
|
}
|
|
export declare enum ModalState {
|
|
SHOWN = 0,
|
|
HIDDEN = 1,
|
|
DESTROYED = 2
|
|
}
|
|
export interface ModalController {
|
|
getOptions(): Readonly<ModalOptions>;
|
|
getEvents(): Registry<ModalEvents>;
|
|
getState(): ModalState;
|
|
show(): Promise<void>;
|
|
hide(): Promise<void>;
|
|
destroy(): any;
|
|
}
|
|
export declare abstract class AbstractModal {
|
|
protected constructor();
|
|
abstract renderBody(): ReactElement;
|
|
abstract renderTitle(): string | React.ReactElement;
|
|
type(): ModalType;
|
|
color(): "none" | "blue";
|
|
verticalAlignment(): "top" | "center" | "bottom";
|
|
protected onInitialize(): void;
|
|
protected onDestroy(): void;
|
|
protected onClose(): void;
|
|
protected onOpen(): void;
|
|
}
|
|
export interface ModalRenderer {
|
|
renderModal(modal: AbstractModal | undefined): any;
|
|
}
|
|
export interface ModalConstructorArguments {
|
|
"video-viewer": [IpcRegistryDescription<VideoViewerEvents>, string];
|
|
"channel-edit": [IpcRegistryDescription<ChannelEditEvents>, boolean];
|
|
"echo-test": [IpcRegistryDescription<EchoTestEvents>];
|
|
"global-settings-editor": [IpcRegistryDescription<ModalGlobalSettingsEditorEvents>];
|
|
"conversation": any;
|
|
"css-editor": any;
|
|
"channel-tree": any;
|
|
"modal-connect": any;
|
|
"modal-invite": [IpcRegistryDescription<InviteUiEvents>, IpcVariableDescriptor<InviteUiVariables>, string];
|
|
}
|