diff --git a/packages/design/src/config-provider/__tests__/theme.test.tsx b/packages/design/src/config-provider/__tests__/theme.test.tsx
new file mode 100644
index 000000000..c145d7751
--- /dev/null
+++ b/packages/design/src/config-provider/__tests__/theme.test.tsx
@@ -0,0 +1,40 @@
+import React from 'react';
+import { render } from '@testing-library/react';
+import { ConfigProvider, useToken } from '@oceanbase/design';
+
+describe('ConfigProvider theme', () => {
+ it('ConfigProvider theme token', () => {
+ const Child1 = () => {
+ const { token } = useToken();
+ expect(token.colorBgLayout).toBe('#F5F8FE');
+ return
;
+ };
+ const Child2 = () => {
+ const { token } = useToken();
+ expect(token.colorBgLayout).toBe('#ff0000');
+ return ;
+ };
+ const Child3 = () => {
+ const { token } = useToken();
+ expect(token.colorBgLayout).toBe('#ff0000');
+ return ;
+ };
+ render(
+
+
+
+
+
+
+
+
+
+ );
+ });
+});
diff --git a/packages/design/src/config-provider/index.tsx b/packages/design/src/config-provider/index.tsx
index 446504002..466e4e433 100644
--- a/packages/design/src/config-provider/index.tsx
+++ b/packages/design/src/config-provider/index.tsx
@@ -7,6 +7,7 @@ import type {
} from 'antd/es/config-provider';
import type { ComponentStyleConfig } from 'antd/es/config-provider/context';
import type { SpinIndicator } from 'antd/es/spin';
+import { merge } from 'lodash';
import StaticFunction from '../static-function';
import defaultTheme from '../theme';
import defaultThemeToken from '../theme/default';
@@ -46,44 +47,45 @@ const ExtendedConfigContext = React.createContext({
const { defaultSeed, components } = defaultTheme;
-// ConfigProvider 默认设置主题和内嵌 App,支持 message, notification 和 Modal 等静态方法消费 ConfigProvider 配置
-// ref: https://ant.design/components/app-cn
const ConfigProvider = ({ children, theme, navigate, spin, ...restProps }: ConfigProviderProps) => {
// inherit from parent ConfigProvider
- const parentContext = React.useContext(ExtendedConfigContext);
+ const parentContext = React.useContext(AntConfigProvider.ConfigContext);
+ const parentExtendedContext =
+ React.useContext(ExtendedConfigContext);
return (
+ {/* Nested App component for static function of message, notification and Modal to consume ConfigProvider config */}
+ {/* ref: https://ant.design/components/app */}
{children}
@@ -96,7 +98,7 @@ const ConfigProvider = ({ children, theme, navigate, spin, ...restProps }: Confi
ConfigProvider.ConfigContext =
AntConfigProvider.ConfigContext as React.Context;
ConfigProvider.ExtendedConfigContext = ExtendedConfigContext;
-// “SizeContext”已弃用。ts(6385)
+// SizeContext is deprecated
// ConfigProvider.SizeContext = AntConfigProvider.SizeContext;
ConfigProvider.config = AntConfigProvider.config;
ConfigProvider.useConfig = AntConfigProvider.useConfig;
diff --git a/packages/design/src/config-provider/navigate.ts b/packages/design/src/config-provider/navigate.ts
index 113b32035..7a36d41a8 100644
--- a/packages/design/src/config-provider/navigate.ts
+++ b/packages/design/src/config-provider/navigate.ts
@@ -20,7 +20,7 @@ export interface Path {
hash: string;
}
-export type To = string | Partial;
+export type To = string | Partial | any;
export type RelativeRoutingType = 'route' | 'path';
@@ -33,5 +33,5 @@ export interface NavigateOptions {
export interface NavigateFunction {
(to: To, options?: NavigateOptions): void;
- (delta: number): void;
+ (delta: number | any): void;
}