import type { Dispatch, HTMLAttributes, ReactNode, SetStateAction } from 'react';
import type { ReactElement } from 'react-markdown/lib/react-markdown';
import { type TooltipProps } from '@douyinfe/semi-ui/lib/es/tooltip/index.js';
import { type TableProps as SemiTableProps } from '@douyinfe/semi-ui/lib/es/table/index.js';
import { type PopconfirmProps } from '@douyinfe/semi-ui/lib/es/popconfirm/index.js';
export interface IndicatorState {
done: boolean;
}
export interface IndicatorProps {
onIntersecting: (isIntersecting: boolean) => void;
loadingText: string;
loadedText: string;
}
export interface IndicatorMethods {
changeState: Dispatch>;
}
export interface TableProps extends HTMLAttributes {
offsetY?: number;
scrollX?: number;
tableProps?: SemiTableProps;
bySearch?: boolean;
empty?: ReactElement;
enableLoad?: boolean;
loadMode?: 'page' | 'cursor';
hasMore?: boolean;
total?: number;
onLoad?: () => void;
wrapperClassName?: string;
useHoverStyle?: boolean;
strictDataSourceProp?: boolean;
/**
* rowSelection样式为:checkbox和序号相互切换。
* 注意:获取值变化属性等仍然需要通过tableProps.rowSelection传参,注意不要覆盖ableProps.rowSelection.renderCell
* */
indexRowSelection?: boolean;
/** 空状态也展示表格 */
showTableWhenEmpty?: boolean;
}
export interface TableMethods {
reset: () => void;
getTableList: () => Array;
}
export interface TableMetaProps {
className?: string;
avatarClassName?: string;
icon_url?: string;
icon?: ReactElement;
name?: string;
nameIcon?: ReactElement;
description?: string;
suffix?: ReactElement;
}
export interface ActionItemProps {
/** 操作标识 */
actionKey: string;
/** 操作名称 */
actionText: string;
extActionDom?: ReactElement;
disabled?: boolean;
handler?: (() => void) | (() => Promise);
/** @deprecated */
handleClick?: () => void;
hide?: boolean;
/** @deprecated */
popconfirm?: PopconfirmProps;
/** @deprecated */
tooltip?: TooltipProps;
}
export interface TableActionProps {
editProps?: Omit;
copyProps?: Omit;
deleteProps: Omit & {
/** 配置删除弹窗描述 */
deleteDesc?: string;
/** 禁用二次确认 */
disableConfirm?: boolean;
};
enableProps?: Omit;
/** 扩展操作 */
actionList?: (ActionItemProps | {
customRender: ReactNode;
})[];
}