@web-atoms/core
Version:
77 lines • 2.9 kB
TypeScript
import { AtomDisposableList } from "../../core/AtomDisposableList";
import { CancelToken } from "../../core/types";
import XNode from "../../core/XNode";
import { AtomControl } from "../controls/AtomControl";
import "./PopupService.global.css";
import PopupWindowA from "./PopupWindow";
export declare const PopupWindow: typeof PopupWindowA;
export interface IPopupOptions {
/**
* Popup alignment, default is auto starting with right and below
*/
alignment?: "bottomLeft" | "bottomRight" | "topRight" | "right" | "auto" | "above" | "below" | "centerOfScreen";
popupStyle?: string;
cancelToken?: CancelToken;
/**
* Default is "close" for popup control to avoid cancel exceptions.
*/
onClick?: "close" | "cancel" | null | undefined;
/**
* Used by PopupControl to overwrite parent Element
*/
parentElement?: HTMLElement;
}
export interface IPopup {
element: HTMLElement;
disposables: AtomDisposableList;
dispose(): any;
registerDisposable(f: any): any;
}
export interface IDialogOptions {
title?: string;
parameters?: {
[key: string]: any;
};
cancelToken?: CancelToken;
modal?: boolean;
width?: number | string;
height?: number | string;
maxWidth?: number | string;
maxHeight?: number | string;
minWidth?: number | string;
minHeight?: number | string;
maximize?: boolean;
}
export declare class PopupControl extends AtomControl {
static showControl<T>(opener: HTMLElement | AtomControl, { onClick, ...options }?: IPopupOptions): Promise<T>;
close: (r?: any) => void;
cancel: (r?: any) => void;
}
export declare const disableContain: (ce: HTMLElement) => () => void;
export interface IPopupAlertOptions {
message: string | XNode;
title?: string;
detail?: string | XNode;
yesLabel?: string;
noLabel?: string;
cancelLabel?: string;
}
export default class PopupService {
static defaultElementTarget: HTMLElement;
static get lastTarget(): HTMLElement;
static set lastTarget(element: HTMLElement);
static alert({ message, detail, title, yesLabel }: IPopupAlertOptions): Promise<boolean>;
static confirm({ message, title, yesLabel, noLabel, cancelLabel }: IPopupAlertOptions): Promise<boolean>;
static showWindow<T>(opener: HTMLElement, popupClass: typeof PopupWindow, popupOptions?: IDialogOptions): Promise<T>;
/**
* Display given popup attached to given opener and returns
* disposable that can be used to dispose the popup
* @param opener Element which opens this popup
* @param popup Popup Element, it must be rendered within the opener's parent
* @param options IPopupOptions
* @returns IDisposable
*/
static show(opener: HTMLElement, popup: HTMLElement | XNode, options?: IPopupOptions): IPopup;
private static targetPath;
}
//# sourceMappingURL=PopupService.d.ts.map