From 5f092d8cd5c37c7f56108b7ec70e46b70ff8058f Mon Sep 17 00:00:00 2001
From: muxin <434980373@qq.com>
Date: Tue, 27 Jun 2023 17:12:36 +0800
Subject: [PATCH] feat: config-provider support Select className and style
properties (#43217)
* feat: config-provider support Select className and style properties
* feat: config-provider support Modal className and style properties
* Revert "feat: config-provider support Modal className and style properties"
This reverts commit 3a39d872518616ef41063447a4a8049ce7311a15.
---
.../config-provider/__tests__/style.test.tsx | 17 +++++++++++++++++
components/config-provider/context.ts | 2 +-
components/config-provider/index.en-US.md | 2 +-
components/config-provider/index.tsx | 2 +-
components/config-provider/index.zh-CN.md | 2 +-
components/select/index.tsx | 3 +++
6 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/components/config-provider/__tests__/style.test.tsx b/components/config-provider/__tests__/style.test.tsx
index 7f0531770d..f3ce03a205 100644
--- a/components/config-provider/__tests__/style.test.tsx
+++ b/components/config-provider/__tests__/style.test.tsx
@@ -13,6 +13,7 @@ import Pagination from '../../pagination';
import Radio from '../../radio';
import Result from '../../result';
import Segmented from '../../segmented';
+import Select from '../../select';
import Slider from '../../slider';
import Space from '../../space';
import Spin from '../../spin';
@@ -162,6 +163,22 @@ describe('ConfigProvider support style and className props', () => {
expect(element).toHaveStyle({ backgroundColor: 'red' });
});
+ it('Should Select className & style works', () => {
+ const { container } = render(
+
+
+ ,
+ );
+ const element = container.querySelector('.ant-select');
+ expect(element).toHaveClass('cp-select');
+ expect(element).toHaveStyle({ backgroundColor: 'red' });
+ });
+
it('Should Steps className & style works', () => {
const { container } = render(
,
ref: React.Ref,
@@ -191,6 +192,7 @@ const InternalSelect = <
},
getStatusClassNames(prefixCls, mergedStatus, hasFeedback),
compactItemClassnames,
+ select?.className,
className,
rootClassName,
hashId,
@@ -228,6 +230,7 @@ const InternalSelect = <
virtual={virtual}
showSearch={select?.showSearch}
{...selectProps}
+ style={{ ...select?.style, ...style }}
dropdownMatchSelectWidth={mergedPopupMatchSelectWidth}
builtinPlacements={mergedBuiltinPlacements}
transitionName={getTransitionName(