Base.d.ts
3.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import * as React from 'react';
import { AutoSizeType } from 'rc-textarea/lib/ResizableTextArea';
import { ConfigConsumerProps } from '../config-provider';
import { TypographyProps } from './Typography';
export declare type BaseType = 'secondary' | 'success' | 'warning' | 'danger';
interface CopyConfig {
text?: string;
onCopy?: () => void;
icon?: React.ReactNode;
tooltips?: boolean | React.ReactNode;
}
interface EditConfig {
editing?: boolean;
icon?: React.ReactNode;
tooltip?: boolean | React.ReactNode;
onStart?: () => void;
onChange?: (value: string) => void;
maxLength?: number;
autoSize?: boolean | AutoSizeType;
}
interface EllipsisConfig {
rows?: number;
expandable?: boolean;
suffix?: string;
symbol?: React.ReactNode;
onExpand?: React.MouseEventHandler<HTMLElement>;
onEllipsis?: (ellipsis: boolean) => void;
}
export interface BlockProps extends TypographyProps {
title?: string;
editable?: boolean | EditConfig;
copyable?: boolean | CopyConfig;
type?: BaseType;
disabled?: boolean;
ellipsis?: boolean | EllipsisConfig;
code?: boolean;
mark?: boolean;
underline?: boolean;
delete?: boolean;
strong?: boolean;
keyboard?: boolean;
}
interface InternalBlockProps extends BlockProps {
component: string;
}
interface BaseState {
edit: boolean;
copied: boolean;
ellipsisText: string;
ellipsisContent: React.ReactNode;
isEllipsis: boolean;
expanded: boolean;
clientRendered: boolean;
}
declare class Base extends React.Component<InternalBlockProps, BaseState> {
static contextType: React.Context<ConfigConsumerProps>;
static defaultProps: {
children: string;
};
static getDerivedStateFromProps(nextProps: BlockProps): {};
context: ConfigConsumerProps;
editIcon?: HTMLDivElement;
contentRef: React.RefObject<HTMLElement>;
copyId?: number;
rafId?: number;
expandStr?: string;
copyStr?: string;
copiedStr?: string;
editStr?: string;
state: BaseState;
componentDidMount(): void;
componentDidUpdate(prevProps: BlockProps): void;
componentWillUnmount(): void;
getPrefixCls: () => string;
onExpandClick: React.MouseEventHandler<HTMLElement>;
onEditClick: () => void;
onEditChange: (value: string) => void;
onEditCancel: () => void;
onCopyClick: (e: React.MouseEvent<HTMLDivElement>) => void;
getEditable(props?: BlockProps): EditConfig;
getEllipsis(props?: BlockProps): EllipsisConfig;
setEditRef: (node: HTMLDivElement) => void;
triggerEdit: (edit: boolean) => void;
resizeOnNextFrame: () => void;
canUseCSSEllipsis(): boolean;
syncEllipsis(): void;
renderExpand(forceRender?: boolean): JSX.Element | null;
renderEdit(): JSX.Element | undefined;
renderCopy(): JSX.Element | undefined;
renderEditInput(): JSX.Element;
renderOperations(forceRenderExpanded?: boolean): (JSX.Element | null | undefined)[];
renderContent(): JSX.Element;
render(): JSX.Element;
}
export default Base;