Notification.d.ts
2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import * as React from 'react';
import { Component, ReactText } from 'react';
import { NoticeProps } from './Notice';
export interface NoticeContent extends Omit<NoticeProps, 'prefixCls' | 'children' | 'noticeKey' | 'onClose'> {
prefixCls?: string;
key?: React.Key;
updateMark?: string;
content?: React.ReactNode;
onClose?: () => void;
}
export declare type NoticeFunc = (noticeProps: NoticeContent) => void;
export declare type HolderReadyCallback = (div: HTMLDivElement, noticeProps: NoticeProps & {
key: React.Key;
}) => void;
export interface NotificationInstance {
notice: NoticeFunc;
removeNotice: (key: React.Key) => void;
destroy: () => void;
component: Notification;
useNotification: () => [NoticeFunc, React.ReactElement];
}
export interface NotificationProps {
prefixCls?: string;
className?: string;
style?: React.CSSProperties;
transitionName?: string;
animation?: string | object;
maxCount?: number;
closeIcon?: React.ReactNode;
}
interface NotificationState {
notices: {
notice: NoticeContent & {
userPassKey?: React.Key;
};
holderCallback?: HolderReadyCallback;
}[];
}
declare class Notification extends Component<NotificationProps, NotificationState> {
static newInstance: (properties: NotificationProps & {
getContainer?: () => HTMLElement;
}, callback: (instance: NotificationInstance) => void) => void;
static defaultProps: {
prefixCls: string;
animation: string;
style: {
top: number;
left: string;
};
};
state: NotificationState;
private hookRefs;
getTransitionName(): string;
add: (originNotice: NoticeContent, holderCallback?: HolderReadyCallback) => void;
remove: (removeKey: React.Key) => void;
noticePropsMap: Record<React.Key, {
props: NoticeProps & {
key: ReactText;
};
holderCallback?: HolderReadyCallback;
}>;
render(): JSX.Element;
}
export default Notification;