+
@@ -24,5 +24,8 @@ nav:
| :-- | :-- | :-- | :-- | :-- |
| type | 类型 | default \| light \| info \| success \| warning \| error | default | - |
| mouseFollow | 是否跟随鼠标移动,开启后会去掉箭头,并且 `placement`、`open` 和 `trigger` 等属性也将失效 | boolean | false | - |
+| closeIcon | 自定义关闭按钮 | boolean | ReactNode | false | - |
+| closeTitle | 自定义关闭标题 | ReactNode | - | - |
+| onClose | 关闭时的回调(可通过 e.preventDefault() 来阻止默认行为) | (e) => void | - | - |
- 更多 API 详见 antd Tooltip 文档: https://ant.design/components/tooltip-cn
diff --git a/packages/design/src/tooltip/index.tsx b/packages/design/src/tooltip/index.tsx
index 1f19c3ed9..898a98355 100644
--- a/packages/design/src/tooltip/index.tsx
+++ b/packages/design/src/tooltip/index.tsx
@@ -1,8 +1,11 @@
-import { Tooltip as AntTooltip } from 'antd';
+import { Tooltip as AntTooltip, Space } from 'antd';
import type { TooltipPropsWithTitle as AntTooltipPropsWithTitle } from 'antd/es/tooltip';
-import React from 'react';
+import React, { useContext, useEffect, useMemo } from 'react';
+import { CloseCircleTwoTone, CloseOutlined } from '@oceanbase/icons';
import { token } from '../static-function';
import MouseTooltip from './MouseTooltip';
+import ConfigProvider from '../config-provider';
+import useToken from 'antd/lib/theme/useToken';
export * from 'antd/es/tooltip';
@@ -11,6 +14,9 @@ export type TooltipType = 'default' | 'light' | 'success' | 'info' | 'warning' |
export interface TooltipProps extends AntTooltipPropsWithTitle {
type?: TooltipType;
mouseFollow?: boolean;
+ closeIcon?: boolean | React.ReactNode;
+ closeTitle?: React.ReactNode;
+ onClose?: (e: React.MouseEvent
+
+
+
From 497b0a39a6ed85aeb8121352705b4b0b3596a125 Mon Sep 17 00:00:00 2001
From: linhf <1959099976@qq.com>
Date: Sun, 6 Aug 2023 18:44:41 +0800
Subject: [PATCH 007/102] chore: fix style
---
packages/design/src/tooltip/index.tsx | 4 +---
packages/design/src/tooltip/style/index.ts | 18 ++++++++++--------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/packages/design/src/tooltip/index.tsx b/packages/design/src/tooltip/index.tsx
index 3b169dc22..e2116b844 100644
--- a/packages/design/src/tooltip/index.tsx
+++ b/packages/design/src/tooltip/index.tsx
@@ -83,10 +83,9 @@ const Tooltip: CompoundedComponent = ({
return null
}
- const IconNode = closeIcon === true ?
+
+
+
+## API
+
+| 参数 | 说明 | 类型 | 默认值 | 版本 |
+| :--- | :------------------------------------------- | :------ | :----- | :--- |
+| icon | 状态标识是否为图标形势,传入true采用默认icon,传入Icon可自定义icon | boolean | React.ReactNode | false | - |
+
+- 更多 API 详见 antd Badge 文档: https://ant.design/components/badge-cn
diff --git a/packages/design/src/badge/index.ts b/packages/design/src/badge/index.ts
deleted file mode 100644
index 3074837f2..000000000
--- a/packages/design/src/badge/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from 'antd/es/badge';
diff --git a/packages/design/src/badge/index.tsx b/packages/design/src/badge/index.tsx
new file mode 100644
index 000000000..f4e93dfc6
--- /dev/null
+++ b/packages/design/src/badge/index.tsx
@@ -0,0 +1,60 @@
+import { Badge as AntBadge } from 'antd';
+import type { BadgeProps as AntBadgeProps } from 'antd/es/badge';
+import classNames from 'classnames';
+import React, { useContext } from 'react';
+import ConfigProvider from '../config-provider';
+import IconBadge from './IconBadge';
+import useStyle from './style';
+
+export * from 'antd/es/badge';
+
+export interface BadgeProps extends AntBadgeProps {
+ gray?: boolean;
+ icon?: boolean | React.ReactNode;
+}
+
+const Badge = ({
+ prefixCls: customizePrefixCls,
+ className,
+ gray,
+ icon,
+ ...restProps
+}: BadgeProps) => {
+ const { getPrefixCls, badge } = useContext(ConfigProvider.ConfigContext);
+
+ const prefixCls = getPrefixCls('badge', customizePrefixCls);
+
+ const { wrapSSR } = useStyle(prefixCls);
+
+ const badgeCls = classNames(
+ {
+ [`${prefixCls}-oceanbase`]: true,
+ [`${prefixCls}-oceanbase-gray`]: gray,
+ },
+ className
+ );
+
+ return wrapSSR(<>
+ {
+ icon ?