UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

97 lines (96 loc) 2.88 kB
import { ReactNode } from 'react'; import { DebouncedFunc } from 'lodash'; import FormContext from '../form/FormContext'; import { ButtonColor, ButtonTooltip, ButtonType, FuncType } from './enum'; import { WaitType } from '../core/enum'; import DataSetComponent, { DataSetComponentProps } from '../data-set/DataSetComponent'; import { TooltipProps } from '../tooltip/Tooltip'; export interface ButtonProps extends DataSetComponentProps { /** * 按钮展现形式 * @default 'raised' */ funcType?: FuncType; /** * 按钮颜色风格 * @default 'default' */ color?: ButtonColor; /** * 按钮是否是加载状态 */ loading?: boolean; /** * 按钮图标 */ icon?: string; /** * 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 */ href?: string; /** * 相当于 a 链接的 target 属性,href 存在时生效 */ target?: string; /** * 点击间隔时间 */ wait?: number; /** * 点击间隔类型,可选值:throttle | debounce * @default throttle */ waitType?: WaitType; /** * 用tooltip显示按钮内容 * 可选值:`none` `always` `overflow` 或自定义 tooltip * 配置自定义tooltip属性:tooltip={['always', { theme: 'light', ... }]} */ tooltip?: ButtonTooltip | [ButtonTooltip, TooltipProps]; /** * 按钮类型 * @default 'button' */ type?: ButtonType; block?: boolean; name?: string; value?: any; form?: string; formAction?: string; formEncType?: string; formMethod?: string; formNoValidate?: boolean; formTarget?: string; children?: ReactNode; } export default class Button extends DataSetComponent<ButtonProps> { static displayName: string; static __PRO_BUTTON: boolean; static get contextType(): typeof FormContext; static defaultProps: { suffixCls: string; type: ButtonType; waitType: WaitType; }; hasTwoCNChar: boolean; get loading(): boolean; set loading(loading: boolean); isTooltipShown?: boolean; handleClickWait: DebouncedFunc<(e: any) => Promise<void>>; constructor(props: any, context: any); getObservableProps(props: any, context: any): any; fixTwoCNChar(): void; componentDidMount(): void; componentWillReceiveProps(nextProps: any, nextContext: any): void; componentWillUnmount(): void; getHandleClick(props: any): DebouncedFunc<(e: any) => Promise<void>>; handleClickIfBubble(e: any): void; handleClick(e: any): Promise<void>; handleMouseEnter(e: any): void; handleMouseLeave(e: any): void; getOmitPropsKeys(): string[]; getOtherProps(): any; isNeedInserted(): boolean; getClassName(...props: any[]): string | undefined; render(): JSX.Element; }