|
|
@ -27,7 +27,9 @@ import useStyle from './style'; |
|
|
|
|
|
|
|
export type LegacyButtonType = ButtonType | 'danger'; |
|
|
|
|
|
|
|
export function convertLegacyProps(type?: LegacyButtonType): ButtonProps { |
|
|
|
export function convertLegacyProps( |
|
|
|
type?: LegacyButtonType, |
|
|
|
): Pick<BaseButtonProps, 'danger' | 'type'> { |
|
|
|
if (type === 'danger') { |
|
|
|
return { danger: true }; |
|
|
|
} |
|
|
@ -66,7 +68,9 @@ export type NativeButtonProps = { |
|
|
|
} & BaseButtonProps & |
|
|
|
Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'onClick'>; |
|
|
|
|
|
|
|
export type ButtonProps = Partial<AnchorButtonProps & NativeButtonProps>; |
|
|
|
export type ButtonProps = AnchorButtonProps | NativeButtonProps; |
|
|
|
|
|
|
|
type InternalButtonProps = Partial<AnchorButtonProps & NativeButtonProps>; |
|
|
|
|
|
|
|
type CompoundedComponent = React.ForwardRefExoticComponent< |
|
|
|
ButtonProps & React.RefAttributes<HTMLElement> |
|
|
@ -121,7 +125,7 @@ const InternalButton: React.ForwardRefRenderFunction< |
|
|
|
classNames: customClassNames, |
|
|
|
style: customStyle = {}, |
|
|
|
...rest |
|
|
|
} = props; |
|
|
|
} = props as InternalButtonProps; |
|
|
|
|
|
|
|
const { getPrefixCls, autoInsertSpaceInButton, direction, button } = useContext(ConfigContext); |
|
|
|
const prefixCls = getPrefixCls('btn', customizePrefixCls); |
|
|
@ -214,7 +218,7 @@ const InternalButton: React.ForwardRefRenderFunction< |
|
|
|
|
|
|
|
const iconType = innerLoading ? 'loading' : icon; |
|
|
|
|
|
|
|
const linkButtonRestProps = omit(rest as ButtonProps & { navigate: any }, ['navigate']); |
|
|
|
const linkButtonRestProps = omit(rest as InternalButtonProps & { navigate: any }, ['navigate']); |
|
|
|
|
|
|
|
const classes = classNames( |
|
|
|
prefixCls, |
|
|
|