Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CP support Drawer closeIcon #46894

Merged
merged 13 commits into from
Jan 26, 2024
9 changes: 9 additions & 0 deletions components/config-provider/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@ export interface ConfigConsumerProps {
flex?: FlexConfig;
wave?: WaveConfig;
warning?: WarningContextProps;
icons?: Partial<
Record<
| 'closeIcon' // Alert、Drawer、FloatButton、Modal、Notification、Tag、Tour
| 'clearIcon' // Cascader、DatePicker、TimePicker、Input、Mentions、Select、TreeSelect
| 'suffixIcon' // Cascader、Select、TreeSelect
li-jia-nan marked this conversation as resolved.
Show resolved Hide resolved
| 'removeIcon', // Cascader、Upload、Select、TreeSelect,
React.ReactNode
>
>;
}

const defaultGetPrefixCls = (suffixCls?: string, customizePrefixCls?: string) => {
Expand Down
8 changes: 6 additions & 2 deletions components/config-provider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import useMemo from 'rc-util/lib/hooks/useMemo';
import { merge } from 'rc-util/lib/utils/set';
import type { Options } from 'scroll-into-view-if-needed';

import warning, { WarningContext, type WarningContextProps } from '../_util/warning';
import warning, { WarningContext } from '../_util/warning';
import type { WarningContextProps } from '../_util/warning';
import type { RequiredMark } from '../form/Form';
import ValidateMessagesContext from '../form/validateMessagesContext';
import type { InputProps } from '../input';
Expand Down Expand Up @@ -205,6 +206,7 @@ export interface ConfigProviderProps {
* Wave is special component which only patch on the effect of component interaction.
*/
wave?: WaveConfig;
icons?: ConfigConsumerProps['icons'];
}

interface ProviderChildrenProps extends ConfigProviderProps {
Expand Down Expand Up @@ -351,6 +353,7 @@ const ProviderChildren: React.FC<ProviderChildrenProps> = (props) => {
wave,
dropdown,
warning: warningConfig,
icons,
} = props;

// =================================== Context ===================================
Expand Down Expand Up @@ -444,9 +447,10 @@ const ProviderChildren: React.FC<ProviderChildrenProps> = (props) => {
wave,
dropdown,
warning: warningConfig,
icons,
};

const config = {
const config: ConfigConsumerProps = {
...parentContext,
};

Expand Down