diff --git a/docs/design/design-CHANGELOG.md b/docs/design/design-CHANGELOG.md
index dc113e207..7c3625039 100644
--- a/docs/design/design-CHANGELOG.md
+++ b/docs/design/design-CHANGELOG.md
@@ -8,6 +8,19 @@ group: 基础组件
---
+## 0.4.9
+
+`2025-02-20`
+
+- 📖 Table 设计文档新增 高亮显式 规范。[#986](https://github.com/oceanbase/oceanbase-design/pull/986)
+- 📖 Typography 新增可复制和在 Modal 中编辑的示例。[#985](https://github.com/oceanbase/oceanbase-design/pull/985)
+- ⭐️ ConfigProvider 移除 `injectStaticFunction` 属性,改为自动判断是否注入可消费全局配置的静态方法。[#981](https://github.com/oceanbase/oceanbase-design/pull/981)
+- Table
+ - 🐞 修复 Table 可展开&固定列时的间距问题。[#982](https://github.com/oceanbase/oceanbase-design/pull/982)
+ - 🐞 修复 Table 可展开&可滚动时不应该展示斑马条的问题。[#983](https://github.com/oceanbase/oceanbase-design/pull/983)
+- 💄 Alert 改为使用线性图标,以对齐最新的设计规范。[#987](https://github.com/oceanbase/oceanbase-design/pull/987)
+- 💄 Dropdown.Button 默认图标改为 `DownOutlined` 向下箭头。[#984](https://github.com/oceanbase/oceanbase-design/pull/984)
+
## 0.4.8
`2025-02-13`
diff --git a/packages/codemod/package.json b/packages/codemod/package.json
index 7495d553c..6d4009c27 100644
--- a/packages/codemod/package.json
+++ b/packages/codemod/package.json
@@ -1,6 +1,6 @@
{
"name": "@oceanbase/codemod",
- "version": "0.4.8",
+ "version": "0.4.9",
"description": "Codemod for OceanBase Design upgrade",
"keywords": [
"oceanbase",
diff --git a/packages/design/package.json b/packages/design/package.json
index 393528b1c..caa0e74dc 100644
--- a/packages/design/package.json
+++ b/packages/design/package.json
@@ -1,6 +1,6 @@
{
"name": "@oceanbase/design",
- "version": "0.4.8",
+ "version": "0.4.9",
"description": "The Design System of OceanBase",
"keywords": [
"oceanbase",
diff --git a/packages/design/src/alert/index.tsx b/packages/design/src/alert/index.tsx
index c941446d9..978426001 100644
--- a/packages/design/src/alert/index.tsx
+++ b/packages/design/src/alert/index.tsx
@@ -1,7 +1,13 @@
+import React, { useContext } from 'react';
import { Alert as AntAlert } from 'antd';
import type { AlertProps as AntAlertProps } from 'antd/es/alert';
+import {
+ CheckCircleOutlined,
+ CloseCircleOutlined,
+ ExclamationCircleOutlined,
+ InfoCircleOutlined,
+} from '@oceanbase/icons';
import classNames from 'classnames';
-import React, { useContext } from 'react';
import ConfigProvider from '../config-provider';
import useStyle from './style';
@@ -12,7 +18,15 @@ export interface AlertProps extends AntAlertProps {
colored?: boolean;
}
+const iconMapOutlined = {
+ success: ,
+ info: ,
+ error: ,
+ warning: ,
+};
+
const Alert = ({
+ type,
ghost,
colored,
prefixCls: customizePrefixCls,
@@ -29,7 +43,15 @@ const Alert = ({
},
className
);
- return wrapSSR();
+ return wrapSSR(
+
+ );
};
Alert.ErrorBoundary = AntAlert.ErrorBoundary;
diff --git a/packages/design/src/config-provider/index.md b/packages/design/src/config-provider/index.md
index 69f2f1221..acbc331d4 100644
--- a/packages/design/src/config-provider/index.md
+++ b/packages/design/src/config-provider/index.md
@@ -12,10 +12,6 @@ nav:
- 🆕 新增 `card.divided` 属性,用于配置 Card 是否展示分割线。
- 🆕 新增 `locale.Input.placeholder` 属性,用于配置 Input 的默认 `placeholder`。
- 🆕 新增 `table.selectionColumnWidth` 属性,用于配置表格的展开列宽度。
-- 🆕 新增 `injectStaticFunction` 属性,用于配置 `message`, `notification` 和 `Modal` 静态方法是否可以消费全局配置,默认开启。
-
-
-
- 🆕 新增 `styleProviderProps` 属性,一般用于配置 [StyleProvider](https://github.com/ant-design/cssinjs#styleprovider) 的 `hashPriority` 和 `transformers` 属性实现样式降级,来兼容 Chrome 88 以下的低版本浏览器,详见 [antd v5 样式兼容说明](https://ant-design.antgroup.com/docs/react/compatible-style-cn)。
- 🆕 新增 `appProps` 属性,用于配置内嵌的 [App 组件属性](https://ant-design.antgroup.com/components/app-cn#app)。
@@ -57,7 +53,6 @@ export default App;
| card | Card 全局配置 | `{ divided?: boolean; classNames?: Record; styles?: Record; }` | - | - |
| spin | Spin 全局配置 | `{ indicator?: ReactNode; className?: string; style?: React.CSSProperties; }` | - | - |
| table | Table 全局配置 | `{ selectionColumnWidth?: width; className?: string; style?: React.CSSProperties; }` | - | - |
-| injectStaticFunction | 用于配置 `message`, `notification` 和 `Modal` 静态方法是否可以消费全局配置 | boolean | true | - |
| styleProviderProps | [StyleProvider 配置](https://github.com/ant-design/cssinjs#styleprovider),一般用于配置 `hashPriority` 和 `transformers` 属性实现样式降级 | [StyleProviderProps](https://github.com/ant-design/cssinjs/blob/master/src/StyleContext.tsx#L88) | - | - |
| appProps | 内嵌的 App 组件属性 | [AppProps](https://ant-design.antgroup.com/components/app-cn#app) | - | - |
diff --git a/packages/design/src/config-provider/index.tsx b/packages/design/src/config-provider/index.tsx
index 4d8f76a94..0b314cca8 100644
--- a/packages/design/src/config-provider/index.tsx
+++ b/packages/design/src/config-provider/index.tsx
@@ -73,8 +73,6 @@ export interface ConfigProviderProps extends AntConfigProviderProps {
pagination?: PaginationConfig;
spin?: SpinConfig;
table?: TableConfig;
- // inject static function to consume ConfigProvider
- injectStaticFunction?: boolean;
// StyleProvider props
styleProviderProps?: StyleProviderProps;
appProps?: AppProps;
@@ -83,11 +81,14 @@ export interface ConfigProviderProps extends AntConfigProviderProps {
export interface ExtendedConfigConsumerProps {
navigate?: NavigateFunction;
hideOnSinglePage?: boolean;
+ // inject static function to ConfigProvider
+ injectStaticFunction?: boolean;
}
const ExtendedConfigContext = React.createContext({
navigate: undefined,
hideOnSinglePage: false,
+ injectStaticFunction: true,
});
export type ConfigProviderType = React.FC & {
@@ -111,7 +112,6 @@ const ConfigProvider: ConfigProviderType = ({
spin,
table,
tabs,
- injectStaticFunction = true,
styleProviderProps,
appProps,
...restProps
@@ -194,6 +194,8 @@ const ConfigProvider: ConfigProviderType = ({
: hideOnSinglePage !== undefined
? hideOnSinglePage
: parentExtendedContext.hideOnSinglePage,
+ // inject static function to outermost ConfigProvider only
+ injectStaticFunction: false,
}}
>
@@ -201,7 +203,7 @@ const ConfigProvider: ConfigProviderType = ({
{/* ref: https://ant.design/components/app */}
{children}
- {injectStaticFunction && }
+ {parentExtendedContext.injectStaticFunction && }
diff --git a/packages/design/src/dropdown/demo/dropdown-button.tsx b/packages/design/src/dropdown/demo/dropdown-button.tsx
index fde2536f3..21f9fa47b 100644
--- a/packages/design/src/dropdown/demo/dropdown-button.tsx
+++ b/packages/design/src/dropdown/demo/dropdown-button.tsx
@@ -1,7 +1,7 @@
import React from 'react';
-import { Button, Dropdown, message, Space, Tooltip } from '@oceanbase/design';
+import { Dropdown, message, Space, Tooltip } from '@oceanbase/design';
import type { MenuProps } from '@oceanbase/design';
-import { DownOutlined, UserOutlined } from '@oceanbase/icons';
+import { UserOutlined } from '@oceanbase/icons';
const handleButtonClick = (e: React.MouseEvent) => {
message.info('Click on left button.');
@@ -72,22 +72,6 @@ const App: React.FC = () => (
Danger
-
-
-
-
-
-
);
diff --git a/packages/design/src/dropdown/demo/dropdown-with-button.tsx b/packages/design/src/dropdown/demo/dropdown-with-button.tsx
new file mode 100644
index 000000000..1bb4ba9b1
--- /dev/null
+++ b/packages/design/src/dropdown/demo/dropdown-with-button.tsx
@@ -0,0 +1,66 @@
+import React from 'react';
+import { Button, Dropdown, message, Space, Tooltip } from '@oceanbase/design';
+import type { MenuProps } from '@oceanbase/design';
+import { DownOutlined, EllipsisOutlined, UserOutlined } from '@oceanbase/icons';
+
+const handleMenuClick: MenuProps['onClick'] = e => {
+ message.info('Click on menu item.');
+ console.log('click', e);
+};
+
+const items: MenuProps['items'] = [
+ {
+ label: '1st menu item',
+ key: '1',
+ icon: ,
+ },
+ {
+ label: '2nd menu item',
+ key: '2',
+ icon: ,
+ },
+ {
+ label: '3rd menu item',
+ key: '3',
+ icon: ,
+ danger: true,
+ },
+ {
+ label: '4rd menu item',
+ key: '4',
+ icon: ,
+ danger: true,
+ disabled: true,
+ },
+];
+
+const menuProps = {
+ items,
+ onClick: handleMenuClick,
+};
+
+const App: React.FC = () => (
+
+
+ }>
+
+
+
+
+
+
+
+
+);
+
+export default App;
diff --git a/packages/design/src/dropdown/dropdown-button.tsx b/packages/design/src/dropdown/dropdown-button.tsx
new file mode 100644
index 000000000..2dbc89787
--- /dev/null
+++ b/packages/design/src/dropdown/dropdown-button.tsx
@@ -0,0 +1,17 @@
+import React from 'react';
+import { Dropdown } from 'antd';
+import type { DropdownButtonProps } from 'antd/es/dropdown';
+import { DownOutlined } from '@oceanbase/icons';
+
+type CompoundedComponent = React.FC & {
+ /** @internal */
+ __ANT_BUTTON: boolean;
+};
+
+const DropdownButton: CompoundedComponent = ({ icon = , ...restProps }) => {
+ return ;
+};
+
+DropdownButton.__ANT_BUTTON = true;
+
+export default DropdownButton;
diff --git a/packages/design/src/dropdown/index.md b/packages/design/src/dropdown/index.md
index 82c9ea1b0..dc2bdd045 100644
--- a/packages/design/src/dropdown/index.md
+++ b/packages/design/src/dropdown/index.md
@@ -14,7 +14,8 @@ demo:
-
+
+
## API
diff --git a/packages/design/src/dropdown/index.ts b/packages/design/src/dropdown/index.ts
deleted file mode 100644
index c28ea7fe9..000000000
--- a/packages/design/src/dropdown/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from 'antd/es/dropdown';
diff --git a/packages/design/src/dropdown/index.tsx b/packages/design/src/dropdown/index.tsx
new file mode 100644
index 000000000..8e745734c
--- /dev/null
+++ b/packages/design/src/dropdown/index.tsx
@@ -0,0 +1,22 @@
+import React from 'react';
+import { Dropdown as AntDropdown } from 'antd';
+import type { DropDownProps } from 'antd/es/dropdown';
+import DropdownButton from './dropdown-button';
+
+export * from 'antd/es/dropdown';
+
+type CompoundedComponent = React.FC & {
+ Button: typeof DropdownButton;
+ _InternalPanelDoNotUseOrYouWillBeFired: typeof AntDropdown._InternalPanelDoNotUseOrYouWillBeFired;
+};
+
+const Dropdown: CompoundedComponent = props => {
+ return ;
+};
+
+Dropdown._InternalPanelDoNotUseOrYouWillBeFired =
+ AntDropdown._InternalPanelDoNotUseOrYouWillBeFired;
+
+Dropdown.Button = DropdownButton;
+
+export default Dropdown;
diff --git a/packages/design/src/index.ts b/packages/design/src/index.ts
index d7c45a2b4..41a4d903a 100644
--- a/packages/design/src/index.ts
+++ b/packages/design/src/index.ts
@@ -90,6 +90,9 @@ export type { SegmentedProps } from './segmented';
export { default as Breadcrumb } from './breadcrumb';
export type { BreadcrumbProps, BreadcrumbItemProps } from './breadcrumb';
+export { default as Dropdown } from './dropdown';
+export type { DropdownProps, DropdownButtonProps, DropdownButtonType } from './dropdown';
+
export { default as Result } from './result';
export type { ResultProps, ResultType, ResultStatusType } from './result';
diff --git a/packages/design/src/table/demo/dynamic-settings.tsx b/packages/design/src/table/demo/dynamic-settings.tsx
index 8ac9781a1..f85301de5 100644
--- a/packages/design/src/table/demo/dynamic-settings.tsx
+++ b/packages/design/src/table/demo/dynamic-settings.tsx
@@ -158,12 +158,12 @@ const App: React.FC = () => {
scroll.y = 240;
}
if (xScroll) {
- scroll.x = '100vw';
+ scroll.x = '1000px';
}
const tableColumns = columns.map(item => ({ ...item, ellipsis }));
if (xScroll === 'fixed') {
- tableColumns[0].fixed = true;
+ tableColumns[0].fixed = 'left';
tableColumns[tableColumns.length - 1].fixed = 'right';
}
diff --git a/packages/design/src/table/index.$tab-design.md b/packages/design/src/table/index.$tab-design.md
index 494d71b37..cdbd7c7e4 100644
--- a/packages/design/src/table/index.$tab-design.md
+++ b/packages/design/src/table/index.$tab-design.md
@@ -92,6 +92,15 @@

+### 高亮显示
+
+表格中需要重点关注的单元格/行/列高亮 3s 进行提示,默认使用绿色背景色,需要警示的场景使用黄色背景色。
+
+| | 默认 | 警示 |
+| --- | --- | --- |
+| 单元格
|  |  |
+| 行或列 |  |  |
+
### 操作列
支持「次按钮」和「文字按钮」两种类型,默认使用次按钮。
diff --git a/packages/design/src/table/index.tsx b/packages/design/src/table/index.tsx
index 5386ef634..ae48cf963 100644
--- a/packages/design/src/table/index.tsx
+++ b/packages/design/src/table/index.tsx
@@ -44,6 +44,7 @@ export interface TableProps extends AntTableProps {
function Table>(props: TableProps, ref: React.Ref) {
const {
locale: customLocale,
+ size,
columns,
footer,
pagination: customPagination,
@@ -223,6 +224,7 @@ function Table>(props: TableProps, ref: React.R
),
}}
+ size={size}
columns={newColumns}
rowClassName={(...args) => {
return classNames(
@@ -235,7 +237,7 @@ function Table>(props: TableProps, ref: React.R
expandable={
expandable
? {
- columnWidth: 32,
+ columnWidth: !size || size === 'large' ? 40 : 32,
...expandable,
}
: undefined
diff --git a/packages/design/src/table/style/index.ts b/packages/design/src/table/style/index.ts
index 3d2bbebd6..111fb878d 100644
--- a/packages/design/src/table/style/index.ts
+++ b/packages/design/src/table/style/index.ts
@@ -223,7 +223,7 @@ export const genTableStyle = (token: TableToken): CSSObject => {
[`${componentCls}`]: {
[`${componentCls}-tbody`]: {
// 去掉斑马纹
- [`tr:nth-child(2n):not(${componentCls}-placeholder):not(${componentCls}-row-selected):not(${componentCls}-expanded-row)`]:
+ [`tr:nth-child(n):not(${componentCls}-placeholder):not(${componentCls}-row-selected):not(${componentCls}-expanded-row)`]:
{
['& > td']: {
backgroundColor: colorBgBase,
@@ -236,9 +236,12 @@ export const genTableStyle = (token: TableToken): CSSObject => {
},
[`${componentCls}-expanded-row > td`]: {
// 除内嵌子表格外,设置其他内嵌元素样式
- [`& > *:not(${componentCls}-wrapper)`]: {
+ [`& > *:not(${componentCls}-wrapper):not(${componentCls}-expanded-row-fixed)`]: {
marginLeft: token.marginXL + token.lineWidth * 2,
},
+ [`& > *${componentCls}-expanded-row-fixed`]: {
+ paddingLeft: token.marginXL + token.lineWidth * 2 + token.padding,
+ },
},
// 嵌套子表格和父表格第一列对齐
[`tr > td > ${componentCls}-wrapper:only-child ${componentCls}`]: {
@@ -262,9 +265,12 @@ export const genTableStyle = (token: TableToken): CSSObject => {
[`${componentCls}-tbody`]: {
[`${componentCls}-expanded-row > td`]: {
// 除内嵌子表格外,设置其他内嵌元素样式
- [`& > *:not(${componentCls}-wrapper)`]: {
+ [`& > *:not(${componentCls}-wrapper):not(${componentCls}-expanded-row-fixed)`]: {
marginLeft: token.marginXL + token.marginXL + token.lineWidth * 2,
},
+ [`& > *${componentCls}-expanded-row-fixed`]: {
+ paddingLeft: token.marginXL + token.marginXL + token.lineWidth * 2 + token.padding,
+ },
},
// 嵌套子表格和父表格第一列对齐
[`tr > td > ${componentCls}-wrapper:only-child ${componentCls}`]: {
diff --git a/packages/design/src/typography/demo/copyable.tsx b/packages/design/src/typography/demo/copyable.tsx
new file mode 100644
index 000000000..fe7a38b8e
--- /dev/null
+++ b/packages/design/src/typography/demo/copyable.tsx
@@ -0,0 +1,23 @@
+import React from 'react';
+import { Space, Typography } from '@oceanbase/design';
+import { SmileFilled, SmileOutlined } from '@oceanbase/icons';
+
+const { Text } = Typography;
+
+const App: React.FC = () => (
+
+ This is a copyable text.
+ Custom copy text.
+ , ],
+ tooltips: ['click here', 'you clicked!!'],
+ }}
+ >
+ Custom copy icon and tooltips text.
+
+
+
+);
+
+export default App;
diff --git a/packages/design/src/typography/demo/editable-modal.tsx b/packages/design/src/typography/demo/editable-modal.tsx
new file mode 100644
index 000000000..5a5a03425
--- /dev/null
+++ b/packages/design/src/typography/demo/editable-modal.tsx
@@ -0,0 +1,45 @@
+import React, { useState } from 'react';
+import { Input, Modal, Typography } from '@oceanbase/design';
+
+const { Paragraph } = Typography;
+
+const App: React.FC = () => {
+ const [editableStr, setEditableStr] = useState('This is an editable text.');
+ const [inputValue, setInputValue] = useState(editableStr);
+ const [open, setOpen] = useState(false);
+
+ return (
+ <>
+ {
+ setOpen(true);
+ },
+ }}
+ >
+ {editableStr}
+
+ {
+ setOpen(false);
+ }}
+ onOk={() => {
+ setEditableStr(inputValue);
+ setOpen(false);
+ }}
+ >
+ {
+ setInputValue(e.target.value);
+ }}
+ />
+
+ >
+ );
+};
+
+export default App;
diff --git a/packages/design/src/typography/demo/editable.tsx b/packages/design/src/typography/demo/editable.tsx
index 9e26369a4..c2e121481 100644
--- a/packages/design/src/typography/demo/editable.tsx
+++ b/packages/design/src/typography/demo/editable.tsx
@@ -134,19 +134,19 @@ const App: React.FC = () => {
{lengthLimitedStr}
- h1. Ant Design
+ h1. OceanBase Design
- h2. Ant Design
+ h2. OceanBase Design
- h3. Ant Design
+ h3. OceanBase Design
- h4. Ant Design
+ h4. OceanBase Design
- h5. Ant Design
+ h5. OceanBase Design
>
);
diff --git a/packages/design/src/typography/index.md b/packages/design/src/typography/index.md
index 467e2f1ac..8a2b2c37f 100644
--- a/packages/design/src/typography/index.md
+++ b/packages/design/src/typography/index.md
@@ -14,7 +14,9 @@ nav:
+
+
diff --git a/packages/ui/package.json b/packages/ui/package.json
index a4b36f655..3fe2ab74e 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -1,6 +1,6 @@
{
"name": "@oceanbase/ui",
- "version": "0.4.9",
+ "version": "0.4.10",
"description": "The UI library based on OceanBase Design",
"keywords": [
"oceanbase",
diff --git a/packages/ui/src/ProTable/index.tsx b/packages/ui/src/ProTable/index.tsx
index 6430b74c9..a1514f762 100644
--- a/packages/ui/src/ProTable/index.tsx
+++ b/packages/ui/src/ProTable/index.tsx
@@ -16,6 +16,7 @@ const ProTable: typeof AntProTable = ({
optionsRender,
toolbar,
toolBarRender,
+ size,
expandable,
rowSelection,
pagination: customPagination,
@@ -62,6 +63,7 @@ const ProTable: typeof AntProTable = ({