@teamix/pro-action
Version:
action组件
118 lines (117 loc) • 4.4 kB
TypeScript
import { TooltipProps } from '@alicloudfe/components/types/balloon';
import { ButtonProps } from '@alicloudfe/components/types/button';
import { MenuButtonProps } from '@alicloudfe/components/types/menu-button';
import React, { ReactNode } from 'react';
import { DialogAction } from './dialog';
import { DialogFormAction } from './dialog-form';
import { DialogInfoAction } from './dialog-info';
import { DialogTableAction } from './dialog-table';
import './index.scss';
import { LinkAction } from './link';
import { PopConfirmAction } from './pop-confirm';
import { RequestAction } from './request';
export declare type ProActionConfig = ({
type: 'dialog-form' | 'drawer-form';
} & DialogFormAction) | ({
type: 'dialog-table' | 'drawer-table';
} & DialogTableAction) | ({
type: 'dialog-info' | 'drawer-info';
} & DialogInfoAction) | ({
type: 'pop-confirm' | 'danger-pop-confirm';
} & PopConfirmAction) | ({
type: 'dialog' | 'drawer' | 'confirm' | 'danger-confirm' | 'notice' | 'error';
} & DialogAction) | ({
type: 'request';
} & RequestAction) | ({
type: 'link';
} & LinkAction);
export declare function registerActionHandler(id: string, extendActionId: string, defaultConfig: any): void;
export declare function useAction(config?: ProActionConfig, context?: any): any;
export interface ProActionButtonProps extends ProActionCommonProps, ButtonProps {
config?: ProActionConfig;
disabled?: any;
tooltip?: ReactNode;
disabledTooltip?: ReactNode;
icon?: string;
tooltipProps?: TooltipProps;
onClick?: (event: React.MouseEvent<Element, MouseEvent>, context?: any) => void;
}
export declare const ProActionButton: (props: ProActionButtonProps) => JSX.Element;
export interface ProActionCommonProps {
key?: string | number;
visible?: any;
context?: any;
'data-teamix-spm'?: string;
}
export interface ProActionMenuButtonProps extends ProActionCommonProps, Omit<MenuButtonProps, 'visible'> {
actions: ProActionProps[];
icon?: string;
noArrow?: boolean;
'data-teamix-spm'?: string;
}
export declare const ProActionMenuButton: (props: ProActionMenuButtonProps) => JSX.Element;
export interface ProActionDividerProps extends ProActionCommonProps {
type: 'divider';
}
export declare type ProActionProps = ProActionButtonProps | ProActionMenuButtonProps | ProActionDividerProps;
export declare type ProActionGroupProps = {
/** 操作组类型:按钮、文字按钮 */
type?: 'button' | 'text';
/** 上下文 */
context?: any;
/** 操作项配置 */
actions: ProActionProps[];
/** 操作按钮最长数量,超出后折叠,默认为4 */
max?: number;
/**
* @deprecated 建议使用 more 代替
*/
moreText?: string;
/** 更多按钮的配置,只有在actions数量超过max时才有效 */
more?: string | Omit<ProActionMenuButtonProps, 'actions'>;
/** 是否有分割线,只有type="text"时生效,默认有分割线 */
divider?: boolean;
/** 用于埋点 */
['data-teamix-spm']?: string;
/** icon */
icon?: React.ReactNode;
} & React.HTMLAttributes<HTMLElement>;
export declare function ProActionGroup(props: ProActionGroupProps): JSX.Element;
declare const ProAction: {
(props: ProActionProps): JSX.Element;
ProActionGroup: typeof ProActionGroup;
};
export default ProAction;
export * from './quick';
/**
* @deprecated 建议使用 ProActionGroup 代替
*/
export declare const ActionGroup: typeof ProActionGroup;
/**
* @deprecated 建议使用 ProActionButton 代替
*/
export declare const ActionButton: (props: ProActionButtonProps) => JSX.Element;
/**
* @deprecated 建议使用 ProActionMenuButton 代替
*/
export declare const ActionMenuButton: (props: ProActionMenuButtonProps) => JSX.Element;
/**
* @deprecated 建议使用 ProActionConfig 代替
*/
export declare type ActionConfig = ProActionConfig;
/**
* @deprecated 建议使用 ProActionButtonProps 代替
*/
export declare type IActionButton = ProActionButtonProps;
/**
* @deprecated 建议使用 ProActionMenuButtonProps 代替
*/
export declare type IActionMenuButton = ProActionMenuButtonProps;
/**
* @deprecated 建议使用 ProActionGroupProps 代替
*/
export declare type ActionGroupProps = ProActionGroupProps;
/**
* @deprecated 建议使用 ProActionProps 代替
*/
export declare type ICommonActionButton = ProActionProps;