choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
135 lines (134 loc) • 6.01 kB
TypeScript
import React, { CSSProperties, Key, MouseEvent as ReactMouseEvent, ReactElement, ReactNode } from 'react';
import ViewComponent, { ViewComponentProps } from '../core/ViewComponent';
import Button, { ButtonProps } from '../button/Button';
import EventManager from '../_util/EventManager';
import { AsyncCmpLoadingFunction } from '../_util/AsyncComponent';
import { ModalChildrenProps, ModalCustomized } from './interface';
import { MousePosition } from '../_util/DocumentUtils';
export declare type DrawerTransitionName = 'slide-up' | 'slide-right' | 'slide-down' | 'slide-left';
export interface ModalProps extends ViewComponentProps {
__deprecate__?: boolean;
eventKey?: Key;
children?: AsyncCmpLoadingFunction | ReactNode;
closable?: boolean;
movable?: boolean;
fullScreen?: boolean;
maskClosable?: boolean | 'click' | 'dblclick';
maskStyle?: CSSProperties;
autoCenter?: boolean;
mask?: boolean;
maskClassName?: string;
keyboardClosable?: boolean;
modalTitle?: ReactNode;
header?: ((title: ReactNode, closeBtn: ReactNode, okBtn: ReactElement<ButtonProps>, cancelBtn: ReactElement<ButtonProps>) => ReactNode) | ReactNode | boolean;
footer?: ((okBtn: ReactElement<ButtonProps>, cancelBtn: ReactElement<ButtonProps>, modalChildrenProps: any) => ReactNode) | ReactNode | boolean;
destroyOnClose?: boolean;
okText?: ReactNode;
cancelText?: ReactNode;
okProps?: ButtonProps;
cancelProps?: ButtonProps;
onClose?: () => Promise<boolean | undefined> | boolean | undefined | void;
onOk?: () => Promise<boolean | undefined> | boolean | undefined | void;
onCancel?: () => Promise<boolean | undefined> | boolean | undefined | void;
afterClose?: () => void;
close?: () => void;
update?: (props?: ModalProps) => void;
okButton?: boolean;
cancelButton?: boolean;
/**
* @deprecated
*/
okCancel?: boolean;
drawer?: boolean;
drawerOffset?: number;
drawerTransitionName?: DrawerTransitionName;
transitionAppear?: boolean;
key?: Key;
border?: boolean;
drawerBorder?: boolean;
okFirst?: boolean;
active?: boolean;
onTop?: (key?: Key) => void;
mousePosition?: MousePosition | null;
contentStyle?: CSSProperties;
bodyStyle?: CSSProperties;
closeOnLocationChange?: boolean;
resizable?: boolean;
customizable?: boolean;
customizedCode?: string;
}
export default class Modal extends ViewComponent<ModalProps> {
static displayName: string;
static defaultProps: {
suffixCls: string;
closable: boolean;
mask: boolean;
okButton: boolean;
okCancel: boolean;
destroyOnClose: boolean;
fullScreen: boolean;
drawer: boolean;
drawerOffset: number;
autoFocus: boolean;
closeOnLocationChange: boolean;
};
static key: any;
static open: any;
static preview: any;
static confirm: any;
static info: any;
static success: any;
static error: any;
static warning: any;
static destroyAll: () => void;
mousePosition?: MousePosition | null;
moveEvent: EventManager;
okCancelEvent: EventManager;
resizeEvent: EventManager;
offset?: [number | string | undefined, number | string | undefined];
cancelButton: Button | null;
minWidth: number;
minHeight: number;
tempCustomized: ModalCustomized | null | undefined;
get okBtn(): ReactElement<ButtonProps>;
get cancelBtn(): ReactElement<ButtonProps>;
get drawerTransitionName(): DrawerTransitionName;
get doc(): Document;
contentNode: HTMLElement;
childrenProps: ModalChildrenProps;
constructor(props: any, context: any);
componentDidMount(): void;
componentWillReceiveProps(nextProps: ModalProps, nextContext: any): void;
saveCancelRef(node: any): void;
handleKeyDown(e: any): void;
getOmitPropsKeys(): string[];
loadCustomized(): Promise<void>;
saveCustomized(): void;
getOtherProps(): any;
contentReference(node: any): void;
getClassName(): string | undefined;
handleResize(e: any): void;
handleModalMouseResize(e: any): (me: any) => void;
handleDrawerMouseResize(e: any): (me: any) => void;
render(): JSX.Element;
componentWillUpdate({ hidden }: {
hidden: any;
}): void;
componentWillUnmount(): void;
handleMouseDown(e: any): void;
handleHeaderMouseDown(downEvent: ReactMouseEvent<HTMLDivElement, MouseEvent>): void;
handleOk(): Promise<void>;
handleCancel(): Promise<void>;
getHeader(): ReactNode;
getWrappedHeader(header: ReactNode): ReactNode;
getCloseButton(): ReactNode;
getBody(): ReactNode;
getFooter(): ReactNode;
getWrappedFooter(footer: ReactNode): JSX.Element;
getDefaultHeader: (title: any, closeButton: React.ReactNode, _okBtn: React.ReactElement<ButtonProps, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>, _cancelBtn: React.ReactElement<ButtonProps, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) => JSX.Element | undefined;
getDefaultFooter: (okBtn: React.ReactElement<ButtonProps, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>, cancelBtn: React.ReactElement<ButtonProps, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>, _modalChildrenProps: ModalChildrenProps) => JSX.Element;
registerOk: (ok: any) => void;
registerCancel: (cancel: any) => void;
renderChildren(children: ReactNode): ReactNode;
close(): void;
}