Skip to content

Commit

Permalink
Merge branch 'master' of github.com:oceanbase/oceanbase-design into h…
Browse files Browse the repository at this point in the history
…jg-style
  • Loading branch information
Vanleehao committed Jan 12, 2024
2 parents b5dac62 + d99fa52 commit 6d864f9
Show file tree
Hide file tree
Showing 17 changed files with 13,866 additions and 4,625 deletions.
6 changes: 6 additions & 0 deletions docs/charts/charts-CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ group: 可视化图表

---

## 0.2.21

`2024-01-12`

- 🐞 修复 Pie 在环图模式下计算总和时浮点数精度不正确的问题。[#406](https://github.com/oceanbase/oceanbase-design/pull/406)

## 0.2.20

`2023-12-28`
Expand Down
9 changes: 9 additions & 0 deletions docs/design/design-CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ group: 基础组件

---

## 0.2.34

`2024-01-12`

- Drawer
- 🆕 新增 `footerExtra` 属性,用于设置抽屉底部的额外内容,仅默认页脚生效。[#408](https://github.com/oceanbase/oceanbase-design/pull/408)
- 📢 调整页脚的 DOM 结构,并将原先的 `.ant-drawer-footer-content` 类名改为 `.ant-drawer-footer-container`[#408](https://github.com/oceanbase/oceanbase-design/pull/408)
- 🐞 修复 Tooltip `title` 为空时仍然展示的问题。[#405](https://github.com/oceanbase/oceanbase-design/pull/405) [@linhf123](https://github.com/linhf123)

## 0.2.33

`2023-12-28`
Expand Down
6 changes: 6 additions & 0 deletions docs/ui/ui-CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ group: 业务组件

---

## 0.2.35

`2024-01-12`

- 🌐 Highlight 支持国际化,之前为固定的英文文案。[#409](https://github.com/oceanbase/oceanbase-design/pull/409) [@linhf123](https://github.com/linhf123)

## 0.2.34

`2023-12-28`
Expand Down
2 changes: 1 addition & 1 deletion packages/charts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oceanbase/charts",
"version": "0.2.20",
"version": "0.2.21",
"description": "The Chart library for OceanBase",
"homepage": "https://github.com/oceanbase/oceanbase-design/packages/charts",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oceanbase/codemod",
"version": "0.2.14",
"version": "0.2.15",
"description": "Codemod for OceanBase Design upgrade",
"keywords": [
"oceanbase",
Expand Down
2 changes: 1 addition & 1 deletion packages/design/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oceanbase/design",
"version": "0.2.33",
"version": "0.2.34",
"description": "The Design System of OceanBase",
"keywords": [
"oceanbase",
Expand Down
44 changes: 43 additions & 1 deletion packages/design/src/tooltip/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { render, fireEvent } from '@testing-library/react';
import { Tooltip } from '@oceanbase/design';
import { waitFakeTimer } from '../../../../../tests/util';
import { waitFakeTimer, isTooltipOpen } from '../../../../../tests/util';
import { CloseCircleOutlined } from '@oceanbase/icons';

describe('Tooltip', () => {
Expand Down Expand Up @@ -136,4 +136,46 @@ describe('Tooltip', () => {
await waitFakeTimer();
expect(container.querySelector('.ant-tooltip-open')).toBeNull();
});

it('should hide when title is none', async () => {
const onOpenChange = jest.fn();

const { container, rerender } = render(
<Tooltip
title="Have a nice day!"
mouseEnterDelay={0}
mouseLeaveDelay={0}
onOpenChange={onOpenChange}
>
<div id="hello">Hello world!</div>
</Tooltip>
);

const divElement = container.querySelector('#hello');
fireEvent.mouseEnter(divElement!);
await waitFakeTimer();
expect(onOpenChange).toHaveBeenCalled();
expect(isTooltipOpen()).toBeTruthy();
expect(container.querySelector('.ant-tooltip-open')).not.toBeNull();

fireEvent.mouseLeave(divElement!);
await waitFakeTimer();
expect(onOpenChange).toHaveBeenCalled();
expect(isTooltipOpen()).toBeFalsy();
expect(container.querySelector('.ant-tooltip-open')).toBeNull();

// update `title` value.
rerender(
<Tooltip title="" mouseEnterDelay={0} mouseLeaveDelay={0} onOpenChange={onOpenChange}>
<div id="hello">Hello world!</div>
</Tooltip>
);

onOpenChange.mockClear();
fireEvent.mouseEnter(divElement!);
await waitFakeTimer();
expect(onOpenChange).not.toHaveBeenCalled();
expect(isTooltipOpen()).toBeFalsy();
expect(container.querySelector('.ant-tooltip-open')).toBeNull();
});
});
15 changes: 6 additions & 9 deletions packages/design/src/tooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const Tooltip = React.forwardRef<TooltipRef, TooltipProps>(
onVisibleChange,
overlayInnerStyle,
className,
overlay,
...restProps
},
ref
Expand All @@ -62,15 +63,9 @@ const Tooltip = React.forwardRef<TooltipRef, TooltipProps>(
const tooltipCls = classNames(className, hashId);
const [innerOpen, setInnerOpen] = useState(open ?? visible ?? defaultOpen ?? defaultVisible);

const newOpen = open ?? visible ?? innerOpen;

useEffect(() => {
if (!isNil(open)) {
setInnerOpen(open);
} else if (!isNil(visible)) {
setInnerOpen(visible);
}
}, [open, visible]);
// 同步 ant-design noTitle 逻辑
const noTitle = !title && !overlay && title !== 0; // overlay for old version compatibility
const newOpen = open ?? visible ?? (noTitle ? false : innerOpen);

const handleCloseClick = (e: React.MouseEvent<HTMLElement>) => {
e.stopPropagation();
Expand Down Expand Up @@ -115,6 +110,7 @@ const Tooltip = React.forwardRef<TooltipRef, TooltipProps>(
...overlayInnerStyle,
}}
className={tooltipCls}
overlay={overlay}
{...restProps}
>
{children}
Expand All @@ -136,6 +132,7 @@ const Tooltip = React.forwardRef<TooltipRef, TooltipProps>(
...overlayInnerStyle,
}}
className={tooltipCls}
overlay={overlay}
{...restProps}
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion packages/icons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oceanbase/icons",
"version": "0.2.9",
"version": "0.2.10",
"description": "The Icon Library for OceanBase",
"keywords": [
"oceanbase",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oceanbase/ui",
"version": "0.2.34",
"version": "0.2.35",
"description": "The UI library based on OceanBase Design",
"keywords": [
"oceanbase",
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/Highlight/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const Highlight: React.FC<HighlightProps> = props => {
theme = THEME_LIGHT,
onCopyChange = () => {},
language,
locale,
} = props;

const prefixCls = getPrefix('highlight');
Expand Down Expand Up @@ -247,7 +248,7 @@ const Highlight: React.FC<HighlightProps> = props => {
onCopy={value => {
onCopyChange(value);
setCopied(true);
message.success('Copied');
message.success(locale.copied);
const tempCopyId = window.setTimeout(() => {
setCopied(false);
}, 2000);
Expand Down
4 changes: 3 additions & 1 deletion packages/ui/src/Highlight/locale/en-US.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export default {};
export default {
copied: 'Copied',
};
4 changes: 3 additions & 1 deletion packages/ui/src/Highlight/locale/zh-CN.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export default {};
export default {
copied: '复制成功',
};
4 changes: 3 additions & 1 deletion packages/ui/src/Highlight/locale/zh-TW.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export default {};
export default {
copied: '複製成功',
};
2 changes: 1 addition & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oceanbase/util",
"version": "0.2.12",
"version": "0.2.13",
"description": "The Util Library for OceanBase",
"keywords": [
"oceanbase",
Expand Down
Loading

0 comments on commit 6d864f9

Please sign in to comment.