choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
91 lines (90 loc) • 2.54 kB
TypeScript
import { ReactNode } from 'react';
import { Cancelable } 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';
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?: ButtonTooltip;
/**
* 按钮类型
* @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;
};
get loading(): boolean;
set loading(loading: boolean);
isTooltipShown?: boolean;
handleClickWait: Function & Cancelable;
constructor(props: any, context: any);
getObservableProps(props: any, context: any): any;
componentWillReceiveProps(nextProps: any, nextContext: any): void;
componentWillUnmount(): void;
getHandleClick(props: any): Function & Cancelable;
handleClickIfBubble(e: any): void;
handleClick(e: any): Promise<void>;
handleMouseEnter(e: any): void;
handleMouseLeave(e: any): void;
getOmitPropsKeys(): string[];
getOtherProps(): any;
getClassName(...props: any[]): string | undefined;
render(): JSX.Element;
}