import React, { useContext, useMemo } from 'react'; import { Popconfirm as OldPopconfirm, PopconfirmProps, ConfigProvider, } from 'antd'; import { getRenderPropValue } from 'antd/lib/_util/getRenderPropValue'; import './index.less'; import { Icon } from '../Icon'; import { getIconName } from './constant'; import classNames from 'classnames'; import { translate } from '../utils/index'; type confirmType = 'primary' | 'warning' | 'error'; interface PopoverExtraProps { content?: React.ReactNode; type?: confirmType; } const Popconfirm = (props: PopconfirmProps & PopoverExtraProps) => { // 为了与 antd 的生态保持兼容性,我们要求必须要使用 `.@{ant-prefix}` 变量来生成类名 const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const prefixCls = getPrefixCls('btri-popover'); const { content, cancelText, okText, title, type, icon } = props; const contentNodes = useMemo(() => { return (