mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-11 11:32:52 +08:00
feat: ConfigProvider support popconfirm (#52126)
Some checks are pending
Publish Any Commit / build (push) Waiting to run
🔀 Sync mirror to Gitee / mirror (push) Waiting to run
✅ test / lint (push) Waiting to run
✅ test / test-react-legacy (16, 1/2) (push) Waiting to run
✅ test / test-react-legacy (16, 2/2) (push) Waiting to run
✅ test / test-react-legacy (17, 1/2) (push) Waiting to run
✅ test / test-react-legacy (17, 2/2) (push) Waiting to run
✅ test / test-node (push) Waiting to run
✅ test / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test / test-coverage (push) Blocked by required conditions
✅ test / build (push) Waiting to run
✅ test / test lib/es module (es, 1/2) (push) Waiting to run
✅ test / test lib/es module (es, 2/2) (push) Waiting to run
✅ test / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
Some checks are pending
Publish Any Commit / build (push) Waiting to run
🔀 Sync mirror to Gitee / mirror (push) Waiting to run
✅ test / lint (push) Waiting to run
✅ test / test-react-legacy (16, 1/2) (push) Waiting to run
✅ test / test-react-legacy (16, 2/2) (push) Waiting to run
✅ test / test-react-legacy (17, 1/2) (push) Waiting to run
✅ test / test-react-legacy (17, 2/2) (push) Waiting to run
✅ test / test-node (push) Waiting to run
✅ test / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test / test-coverage (push) Blocked by required conditions
✅ test / build (push) Waiting to run
✅ test / test lib/es module (es, 1/2) (push) Waiting to run
✅ test / test lib/es module (es, 2/2) (push) Waiting to run
✅ test / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
* feat: ConfigProvider support popcomfirm * replace api
This commit is contained in:
parent
ca1ab9bf47
commit
8b15b0fbad
@ -157,7 +157,7 @@ const SubTokenTable: React.FC<SubTokenTableProps> = (props) => {
|
|||||||
{title}
|
{title}
|
||||||
<Popover
|
<Popover
|
||||||
title={null}
|
title={null}
|
||||||
overlayStyle={{ width: 400 }}
|
styles={{ root: { width: 400 } }}
|
||||||
content={
|
content={
|
||||||
<Typography>
|
<Typography>
|
||||||
{/* <SourceCode lang="jsx">{code}</SourceCode> */}
|
{/* <SourceCode lang="jsx">{code}</SourceCode> */}
|
||||||
|
@ -357,7 +357,7 @@ const Header: React.FC = () => {
|
|||||||
<header className={headerClassName}>
|
<header className={headerClassName}>
|
||||||
{isMobile && (
|
{isMobile && (
|
||||||
<Popover
|
<Popover
|
||||||
overlayClassName={styles.popoverMenu}
|
classNames={{ root: styles.popoverMenu }}
|
||||||
placement="bottomRight"
|
placement="bottomRight"
|
||||||
content={menu}
|
content={menu}
|
||||||
trigger="click"
|
trigger="click"
|
||||||
|
@ -271,8 +271,8 @@ describe('Avatar Render', () => {
|
|||||||
count: 2,
|
count: 2,
|
||||||
popover: {
|
popover: {
|
||||||
placement: 'bottomRight',
|
placement: 'bottomRight',
|
||||||
overlayClassName: 'wanpan-111',
|
classNames: { root: 'wanpan-111' },
|
||||||
overlayStyle: { background: 'red' },
|
styles: { root: { background: 'red' } },
|
||||||
content: 'Avatar.Group',
|
content: 'Avatar.Group',
|
||||||
open: true,
|
open: true,
|
||||||
},
|
},
|
||||||
|
@ -121,7 +121,7 @@ const Group: React.FC<GroupProps> = (props) => {
|
|||||||
const mergeProps = {
|
const mergeProps = {
|
||||||
content: childrenHidden,
|
content: childrenHidden,
|
||||||
...max?.popover,
|
...max?.popover,
|
||||||
overlayClassName: classNames(`${groupPrefixCls}-popover`, max?.popover?.overlayClassName),
|
classNames: { root: classNames(`${groupPrefixCls}-popover`, max?.popover?.classNames?.root) },
|
||||||
placement: mergePopoverPlacement,
|
placement: mergePopoverPlacement,
|
||||||
trigger: mergePopoverTrigger,
|
trigger: mergePopoverTrigger,
|
||||||
};
|
};
|
||||||
|
@ -221,7 +221,7 @@ const ColorPicker: CompoundedComponent = (props) => {
|
|||||||
return wrapCSSVar(
|
return wrapCSSVar(
|
||||||
<Popover
|
<Popover
|
||||||
style={styles?.popup}
|
style={styles?.popup}
|
||||||
overlayInnerStyle={styles?.popupOverlayInner}
|
styles={{ body: styles?.popupOverlayInner }}
|
||||||
onOpenChange={(visible) => {
|
onOpenChange={(visible) => {
|
||||||
if (!visible || !mergedDisabled) {
|
if (!visible || !mergedDisabled) {
|
||||||
setPopupOpen(visible);
|
setPopupOpen(visible);
|
||||||
@ -253,7 +253,7 @@ const ColorPicker: CompoundedComponent = (props) => {
|
|||||||
/>
|
/>
|
||||||
</ContextIsolator>
|
</ContextIsolator>
|
||||||
}
|
}
|
||||||
overlayClassName={mergedPopupCls}
|
classNames={{ root: mergedPopupCls }}
|
||||||
{...popoverProps}
|
{...popoverProps}
|
||||||
>
|
>
|
||||||
{children || (
|
{children || (
|
||||||
|
@ -36,6 +36,7 @@ import type { TreeSelectProps } from '../tree-select';
|
|||||||
import type { RenderEmptyHandler } from './defaultRenderEmpty';
|
import type { RenderEmptyHandler } from './defaultRenderEmpty';
|
||||||
import type { TooltipProps } from '../tooltip';
|
import type { TooltipProps } from '../tooltip';
|
||||||
import type { PopoverProps } from '../popover';
|
import type { PopoverProps } from '../popover';
|
||||||
|
import type { PopconfirmProps } from '../popconfirm';
|
||||||
|
|
||||||
export const defaultPrefixCls = 'ant';
|
export const defaultPrefixCls = 'ant';
|
||||||
export const defaultIconPrefixCls = 'anticon';
|
export const defaultIconPrefixCls = 'anticon';
|
||||||
@ -182,6 +183,11 @@ export type TooltipConfig = Pick<TooltipProps, 'className' | 'style' | 'styles'
|
|||||||
|
|
||||||
export type PopoverConfig = Pick<PopoverProps, 'className' | 'style' | 'styles' | 'classNames'>;
|
export type PopoverConfig = Pick<PopoverProps, 'className' | 'style' | 'styles' | 'classNames'>;
|
||||||
|
|
||||||
|
export type PopconfirmConfig = Pick<
|
||||||
|
PopconfirmProps,
|
||||||
|
'className' | 'style' | 'styles' | 'classNames'
|
||||||
|
>;
|
||||||
|
|
||||||
export type SpinConfig = ComponentStyleConfig & Pick<SpinProps, 'indicator'>;
|
export type SpinConfig = ComponentStyleConfig & Pick<SpinProps, 'indicator'>;
|
||||||
|
|
||||||
export type InputNumberConfig = ComponentStyleConfig & Pick<InputNumberProps, 'variant'>;
|
export type InputNumberConfig = ComponentStyleConfig & Pick<InputNumberProps, 'variant'>;
|
||||||
@ -297,6 +303,7 @@ export interface ConfigConsumerProps {
|
|||||||
tour?: TourConfig;
|
tour?: TourConfig;
|
||||||
tooltip?: TooltipConfig;
|
tooltip?: TooltipConfig;
|
||||||
popover?: PopoverConfig;
|
popover?: PopoverConfig;
|
||||||
|
popconfirm?: PopconfirmConfig;
|
||||||
upload?: ComponentStyleConfig;
|
upload?: ComponentStyleConfig;
|
||||||
notification?: NotificationConfig;
|
notification?: NotificationConfig;
|
||||||
tree?: ComponentStyleConfig;
|
tree?: ComponentStyleConfig;
|
||||||
|
@ -164,6 +164,7 @@ const {
|
|||||||
| tour | Set Tour common props | { closeIcon?: React.ReactNode } | - | 5.14.0 |
|
| tour | Set Tour common props | { closeIcon?: React.ReactNode } | - | 5.14.0 |
|
||||||
| tooltip | Set Tooltip common props | { className?: string, style?: React.CSSProperties, classNames?:[Tooltip\["classNames"\]](/components/tooltip#api), styles?: [Tooltip\["styles"\]](/components/tooltip#api) } | - | 5.23.0 |
|
| tooltip | Set Tooltip common props | { className?: string, style?: React.CSSProperties, classNames?:[Tooltip\["classNames"\]](/components/tooltip#api), styles?: [Tooltip\["styles"\]](/components/tooltip#api) } | - | 5.23.0 |
|
||||||
| popover | Set Popover common props | { className?: string, style?: React.CSSProperties, classNames?:[Popover\["classNames"\]](/components/popover#api), styles?: [Popover\["styles"\]](/components/popover#api) } | - | 5.23.0 |
|
| popover | Set Popover common props | { className?: string, style?: React.CSSProperties, classNames?:[Popover\["classNames"\]](/components/popover#api), styles?: [Popover\["styles"\]](/components/popover#api) } | - | 5.23.0 |
|
||||||
|
| popconfirm | Set Popconfirm common props | { className?: string, style?: React.CSSProperties, classNames?:[Popconfirm\["classNames"\]](/components/popconfirm#api), styles?: [Popconfirm\["styles"\]](/components/popconfirm#api) } | - | 5.23.0 |
|
||||||
| transfer | Set Transfer common props | { className?: string, style?: React.CSSProperties, selectionsIcon?: React.ReactNode } | - | 5.7.0, selectionsIcon: 5.14.0 |
|
| transfer | Set Transfer common props | { className?: string, style?: React.CSSProperties, selectionsIcon?: React.ReactNode } | - | 5.7.0, selectionsIcon: 5.14.0 |
|
||||||
| tree | Set Tree common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| tree | Set Tree common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
| typography | Set Typography common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| typography | Set Typography common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
|
@ -53,6 +53,7 @@ import type {
|
|||||||
TimePickerConfig,
|
TimePickerConfig,
|
||||||
TooltipConfig,
|
TooltipConfig,
|
||||||
PopoverConfig,
|
PopoverConfig,
|
||||||
|
PopconfirmConfig,
|
||||||
TourConfig,
|
TourConfig,
|
||||||
TransferConfig,
|
TransferConfig,
|
||||||
TreeSelectConfig,
|
TreeSelectConfig,
|
||||||
@ -239,6 +240,7 @@ export interface ConfigProviderProps {
|
|||||||
tour?: TourConfig;
|
tour?: TourConfig;
|
||||||
tooltip?: TooltipConfig;
|
tooltip?: TooltipConfig;
|
||||||
popover?: PopoverConfig;
|
popover?: PopoverConfig;
|
||||||
|
popconfirm?: PopconfirmConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ProviderChildrenProps extends ConfigProviderProps {
|
interface ProviderChildrenProps extends ConfigProviderProps {
|
||||||
@ -395,6 +397,7 @@ const ProviderChildren: React.FC<ProviderChildrenProps> = (props) => {
|
|||||||
tour,
|
tour,
|
||||||
tooltip,
|
tooltip,
|
||||||
popover,
|
popover,
|
||||||
|
popconfirm,
|
||||||
floatButtonGroup,
|
floatButtonGroup,
|
||||||
variant,
|
variant,
|
||||||
inputNumber,
|
inputNumber,
|
||||||
@ -497,6 +500,7 @@ const ProviderChildren: React.FC<ProviderChildrenProps> = (props) => {
|
|||||||
tour,
|
tour,
|
||||||
tooltip,
|
tooltip,
|
||||||
popover,
|
popover,
|
||||||
|
popconfirm,
|
||||||
floatButtonGroup,
|
floatButtonGroup,
|
||||||
variant,
|
variant,
|
||||||
inputNumber,
|
inputNumber,
|
||||||
|
@ -166,6 +166,7 @@ const {
|
|||||||
| tour | 设置 Tour 组件的通用属性 | { closeIcon?: React.ReactNode } | - | 5.14.0 |
|
| tour | 设置 Tour 组件的通用属性 | { closeIcon?: React.ReactNode } | - | 5.14.0 |
|
||||||
| tooltip | 设置 Tooltip 组件的通用属性 | { className?: string, style?: React.CSSProperties, classNames?:[Tooltip\["classNames"\]](/components/tooltip-cn#api), styles?: [Tooltip\["styles"\]](/components/tooltip-cn#api) } | - | 5.23.0 |
|
| tooltip | 设置 Tooltip 组件的通用属性 | { className?: string, style?: React.CSSProperties, classNames?:[Tooltip\["classNames"\]](/components/tooltip-cn#api), styles?: [Tooltip\["styles"\]](/components/tooltip-cn#api) } | - | 5.23.0 |
|
||||||
| popover | 设置 Popover 组件的通用属性 | { className?: string, style?: React.CSSProperties, classNames?:[Popover\["classNames"\]](/components/popover-cn#api), styles?: [Popover\["styles"\]](/components/popover-cn#api) } | - | 5.23.0 |
|
| popover | 设置 Popover 组件的通用属性 | { className?: string, style?: React.CSSProperties, classNames?:[Popover\["classNames"\]](/components/popover-cn#api), styles?: [Popover\["styles"\]](/components/popover-cn#api) } | - | 5.23.0 |
|
||||||
|
| popconfirm | 设置 Popconfirm 组件的通用属性 | { className?: string, style?: React.CSSProperties, classNames?:[Popconfirm\["classNames"\]](/components/popconfirm-cn#api), styles?: [Popconfirm\["styles"\]](/components/popconfirm-cn#api) } | - | 5.23.0 |
|
||||||
| transfer | 设置 Transfer 组件的通用属性 | { className?: string, style?: React.CSSProperties, selectionsIcon?: React.ReactNode } | - | 5.7.0, selectionsIcon: 5.14.0 |
|
| transfer | 设置 Transfer 组件的通用属性 | { className?: string, style?: React.CSSProperties, selectionsIcon?: React.ReactNode } | - | 5.7.0, selectionsIcon: 5.14.0 |
|
||||||
| tree | 设置 Tree 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| tree | 设置 Tree 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
| typography | 设置 Typography 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| typography | 设置 Typography 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
|
@ -36,7 +36,12 @@ const NumericInput = (props: NumericInputProps) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip trigger={['focus']} title={title} placement="topLeft" overlayClassName="numeric-input">
|
<Tooltip
|
||||||
|
trigger={['focus']}
|
||||||
|
title={title}
|
||||||
|
placement="topLeft"
|
||||||
|
classNames={{ root: 'numeric-input' }}
|
||||||
|
>
|
||||||
<Input
|
<Input
|
||||||
{...props}
|
{...props}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
|
@ -378,4 +378,33 @@ describe('Popconfirm', () => {
|
|||||||
expect(document.body.querySelectorAll('.ant-btn')[0].textContent).toBe('Cancel');
|
expect(document.body.querySelectorAll('.ant-btn')[0].textContent).toBe('Cancel');
|
||||||
expect(document.body.querySelectorAll('.ant-btn')[1].textContent).toBe('OK');
|
expect(document.body.querySelectorAll('.ant-btn')[1].textContent).toBe('OK');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should apply custom styles to Popconfirm', () => {
|
||||||
|
const customClassNames = {
|
||||||
|
body: 'custom-body',
|
||||||
|
root: 'custom-root',
|
||||||
|
};
|
||||||
|
|
||||||
|
const customStyles = {
|
||||||
|
body: { color: 'red' },
|
||||||
|
root: { backgroundColor: 'blue' },
|
||||||
|
};
|
||||||
|
|
||||||
|
const { container } = render(
|
||||||
|
<Popconfirm classNames={customClassNames} title="" styles={customStyles} open>
|
||||||
|
<span />
|
||||||
|
</Popconfirm>,
|
||||||
|
);
|
||||||
|
|
||||||
|
const popconfirmElement = container.querySelector('.ant-popconfirm') as HTMLElement;
|
||||||
|
const popconfirmBodyElement = container.querySelector('.ant-popover-inner') as HTMLElement;
|
||||||
|
|
||||||
|
// 验证 classNames
|
||||||
|
expect(popconfirmElement.classList).toContain('custom-root');
|
||||||
|
expect(popconfirmBodyElement.classList).toContain('custom-body');
|
||||||
|
|
||||||
|
// 验证 styles
|
||||||
|
expect(popconfirmElement.style.backgroundColor).toBe('blue');
|
||||||
|
expect(popconfirmBodyElement.style.color).toBe('red');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
49
components/popconfirm/demo/_semantic.tsx
Normal file
49
components/popconfirm/demo/_semantic.tsx
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Popconfirm } from 'antd';
|
||||||
|
|
||||||
|
import SemanticPreview from '../../../.dumi/components/SemanticPreview';
|
||||||
|
import useLocale from '../../../.dumi/hooks/useLocale';
|
||||||
|
|
||||||
|
const locales = {
|
||||||
|
cn: {
|
||||||
|
root: '根节点 (包含箭头、内容元素)',
|
||||||
|
body: '内容元素',
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
root: 'Root element (including arrows, content elements)',
|
||||||
|
body: 'Body element',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const BlockList: React.FC<React.PropsWithChildren> = (props: any) => {
|
||||||
|
const divRef = React.useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={divRef} style={{ position: 'absolute', marginTop: 60 }}>
|
||||||
|
<Popconfirm
|
||||||
|
title="prompt text"
|
||||||
|
open
|
||||||
|
placement="top"
|
||||||
|
autoAdjustOverflow={false}
|
||||||
|
getPopupContainer={() => divRef.current}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const App: React.FC = () => {
|
||||||
|
const [locale] = useLocale(locales);
|
||||||
|
return (
|
||||||
|
<SemanticPreview
|
||||||
|
semantics={[
|
||||||
|
{ name: 'root', desc: locale.root, version: '5.23.0' },
|
||||||
|
{ name: 'body', desc: locale.body, version: '5.23.0' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<BlockList />
|
||||||
|
</SemanticPreview>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default App;
|
@ -53,6 +53,10 @@ Common props ref:[Common props](/docs/react/common-props)
|
|||||||
|
|
||||||
<embed src="../tooltip/shared/sharedProps.en-US.md"></embed>
|
<embed src="../tooltip/shared/sharedProps.en-US.md"></embed>
|
||||||
|
|
||||||
|
## Semantic DOM
|
||||||
|
|
||||||
|
<code src="./demo/_semantic.tsx" simplify="true"></code>
|
||||||
|
|
||||||
## Design Token
|
## Design Token
|
||||||
|
|
||||||
<ComponentTokenTable component="Popconfirm"></ComponentTokenTable>
|
<ComponentTokenTable component="Popconfirm"></ComponentTokenTable>
|
||||||
|
@ -48,10 +48,13 @@ const InternalPopconfirm = React.forwardRef<TooltipRef, PopconfirmProps>((props,
|
|||||||
overlayClassName,
|
overlayClassName,
|
||||||
onOpenChange,
|
onOpenChange,
|
||||||
onVisibleChange,
|
onVisibleChange,
|
||||||
|
overlayStyle,
|
||||||
|
styles,
|
||||||
|
classNames: popconfirmClassNames,
|
||||||
...restProps
|
...restProps
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { getPrefixCls } = React.useContext(ConfigContext);
|
const { getPrefixCls, popconfirm } = React.useContext(ConfigContext);
|
||||||
const [open, setOpen] = useMergedState(false, {
|
const [open, setOpen] = useMergedState(false, {
|
||||||
value: props.open ?? props.visible,
|
value: props.open ?? props.visible,
|
||||||
defaultValue: props.defaultOpen ?? props.defaultVisible,
|
defaultValue: props.defaultOpen ?? props.defaultVisible,
|
||||||
@ -83,7 +86,13 @@ const InternalPopconfirm = React.forwardRef<TooltipRef, PopconfirmProps>((props,
|
|||||||
};
|
};
|
||||||
|
|
||||||
const prefixCls = getPrefixCls('popconfirm', customizePrefixCls);
|
const prefixCls = getPrefixCls('popconfirm', customizePrefixCls);
|
||||||
const overlayClassNames = classNames(prefixCls, overlayClassName);
|
const rootClassNames = classNames(
|
||||||
|
prefixCls,
|
||||||
|
overlayClassName,
|
||||||
|
popconfirm?.classNames?.root,
|
||||||
|
popconfirmClassNames?.root,
|
||||||
|
);
|
||||||
|
const bodyClassNames = classNames(popconfirm?.classNames?.body, popconfirmClassNames?.body);
|
||||||
|
|
||||||
const [wrapCSSVar] = useStyle(prefixCls);
|
const [wrapCSSVar] = useStyle(prefixCls);
|
||||||
|
|
||||||
@ -95,7 +104,19 @@ const InternalPopconfirm = React.forwardRef<TooltipRef, PopconfirmProps>((props,
|
|||||||
onOpenChange={onInternalOpenChange}
|
onOpenChange={onInternalOpenChange}
|
||||||
open={open}
|
open={open}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
overlayClassName={overlayClassNames}
|
classNames={{ root: rootClassNames, body: bodyClassNames }}
|
||||||
|
styles={{
|
||||||
|
root: {
|
||||||
|
...popconfirm?.styles?.root,
|
||||||
|
...popconfirm?.style,
|
||||||
|
...overlayStyle,
|
||||||
|
...styles?.root,
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
...popconfirm?.styles?.body,
|
||||||
|
...styles?.body,
|
||||||
|
},
|
||||||
|
}}
|
||||||
content={
|
content={
|
||||||
<Overlay
|
<Overlay
|
||||||
okType={okType}
|
okType={okType}
|
||||||
|
@ -54,6 +54,10 @@ demo:
|
|||||||
|
|
||||||
<embed src="../tooltip/shared/sharedProps.zh-CN.md"></embed>
|
<embed src="../tooltip/shared/sharedProps.zh-CN.md"></embed>
|
||||||
|
|
||||||
|
## Semantic DOM
|
||||||
|
|
||||||
|
<code src="./demo/_semantic.tsx" simplify="true"></code>
|
||||||
|
|
||||||
## 主题变量(Design Token)
|
## 主题变量(Design Token)
|
||||||
|
|
||||||
<ComponentTokenTable component="Popconfirm"></ComponentTokenTable>
|
<ComponentTokenTable component="Popconfirm"></ComponentTokenTable>
|
||||||
|
@ -42,7 +42,7 @@ const App: React.FC = () => {
|
|||||||
{...selectProps}
|
{...selectProps}
|
||||||
maxTagPlaceholder={(omittedValues) => (
|
maxTagPlaceholder={(omittedValues) => (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
overlayStyle={{ pointerEvents: 'none' }}
|
styles={{ root: { pointerEvents: 'none' } }}
|
||||||
title={omittedValues.map(({ label }) => label).join(', ')}
|
title={omittedValues.map(({ label }) => label).join(', ')}
|
||||||
>
|
>
|
||||||
<span>Hover Me</span>
|
<span>Hover Me</span>
|
||||||
|
@ -55,7 +55,7 @@ exports[`Slider should render in RTL direction 1`] = `
|
|||||||
tabindex="0"
|
tabindex="0"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="ant-tooltip ant-zoom-big-fast-appear ant-zoom-big-fast-appear-prepare ant-zoom-big-fast ant-slider-tooltip ant-tooltip-rtl ant-tooltip-placement-top"
|
class="ant-tooltip ant-zoom-big-fast-appear ant-zoom-big-fast-appear-prepare ant-zoom-big-fast ant-tooltip-rtl ant-slider-tooltip ant-tooltip-placement-top"
|
||||||
style="--arrow-x: 0px; --arrow-y: 0px; left: -1000vw; top: -1000vh; box-sizing: border-box;"
|
style="--arrow-x: 0px; --arrow-y: 0px; left: -1000vw; top: -1000vh; box-sizing: border-box;"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
@ -10,9 +10,9 @@ import { devUseWarning } from '../_util/warning';
|
|||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import DisabledContext from '../config-provider/DisabledContext';
|
import DisabledContext from '../config-provider/DisabledContext';
|
||||||
import type { AbstractTooltipProps, TooltipPlacement } from '../tooltip';
|
import type { AbstractTooltipProps, TooltipPlacement } from '../tooltip';
|
||||||
|
import SliderInternalContext from './Context';
|
||||||
import SliderTooltip from './SliderTooltip';
|
import SliderTooltip from './SliderTooltip';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import SliderInternalContext from './Context';
|
|
||||||
import useRafLock from './useRafLock';
|
import useRafLock from './useRafLock';
|
||||||
|
|
||||||
export type SliderMarks = RcSliderProps['marks'];
|
export type SliderMarks = RcSliderProps['marks'];
|
||||||
@ -319,7 +319,7 @@ const Slider = React.forwardRef<SliderRef, SliderSingleProps | SliderRangeProps>
|
|||||||
open={open}
|
open={open}
|
||||||
placement={getTooltipPlacement(tooltipPlacement ?? legacyTooltipPlacement, vertical)}
|
placement={getTooltipPlacement(tooltipPlacement ?? legacyTooltipPlacement, vertical)}
|
||||||
key={index}
|
key={index}
|
||||||
overlayClassName={`${prefixCls}-tooltip`}
|
classNames={{ root: `${prefixCls}-tooltip` }}
|
||||||
getPopupContainer={
|
getPopupContainer={
|
||||||
getTooltipPopupContainer || legacyGetTooltipPopupContainer || getPopupContainer
|
getTooltipPopupContainer || legacyGetTooltipPopupContainer || getPopupContainer
|
||||||
}
|
}
|
||||||
@ -350,7 +350,7 @@ const Slider = React.forwardRef<SliderRef, SliderSingleProps | SliderRangeProps>
|
|||||||
open={mergedTipFormatter !== null && activeOpen}
|
open={mergedTipFormatter !== null && activeOpen}
|
||||||
placement={getTooltipPlacement(tooltipPlacement ?? legacyTooltipPlacement, vertical)}
|
placement={getTooltipPlacement(tooltipPlacement ?? legacyTooltipPlacement, vertical)}
|
||||||
key="tooltip"
|
key="tooltip"
|
||||||
overlayClassName={`${prefixCls}-tooltip`}
|
classNames={{ root: `${prefixCls}-tooltip` }}
|
||||||
getPopupContainer={
|
getPopupContainer={
|
||||||
getTooltipPopupContainer || legacyGetTooltipPopupContainer || getPopupContainer
|
getTooltipPopupContainer || legacyGetTooltipPopupContainer || getPopupContainer
|
||||||
}
|
}
|
||||||
|
@ -514,7 +514,7 @@ describe('Table.sorter', () => {
|
|||||||
rerender(
|
rerender(
|
||||||
createTable({
|
createTable({
|
||||||
showSorterTooltip: {
|
showSorterTooltip: {
|
||||||
overlayClassName: 'custom-tooltip',
|
classNames: { root: 'custom-tooltip' },
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
@ -215,7 +215,7 @@ describe('Tooltip', () => {
|
|||||||
mouseLeaveDelay={0}
|
mouseLeaveDelay={0}
|
||||||
placement="bottomLeft"
|
placement="bottomLeft"
|
||||||
arrowPointAtCenter
|
arrowPointAtCenter
|
||||||
overlayClassName="point-center-element"
|
classNames={{ root: 'point-center-element' }}
|
||||||
>
|
>
|
||||||
<button type="button">Hello world!</button>
|
<button type="button">Hello world!</button>
|
||||||
</Tooltip>,
|
</Tooltip>,
|
||||||
@ -232,7 +232,7 @@ describe('Tooltip', () => {
|
|||||||
mouseLeaveDelay={0}
|
mouseLeaveDelay={0}
|
||||||
placement="bottomLeft"
|
placement="bottomLeft"
|
||||||
arrow={{ arrowPointAtCenter: true }}
|
arrow={{ arrowPointAtCenter: true }}
|
||||||
overlayClassName="point-center-element"
|
classNames={{ root: 'point-center-element' }}
|
||||||
>
|
>
|
||||||
<button type="button">Hello world!</button>
|
<button type="button">Hello world!</button>
|
||||||
</Tooltip>,
|
</Tooltip>,
|
||||||
@ -402,9 +402,9 @@ describe('Tooltip', () => {
|
|||||||
expect(document.querySelector('.ant-tooltip')).not.toBeNull();
|
expect(document.querySelector('.ant-tooltip')).not.toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should pass overlayInnerStyle through to the inner component', () => {
|
it('should pass styles={{ body: {} }} through to the inner component', () => {
|
||||||
const { container } = render(
|
const { container } = render(
|
||||||
<Tooltip overlayInnerStyle={{ color: 'red' }} title="xxxxx" open>
|
<Tooltip styles={{ body: { color: 'red' } }} title="xxxxx" open>
|
||||||
<div />
|
<div />
|
||||||
</Tooltip>,
|
</Tooltip>,
|
||||||
);
|
);
|
||||||
|
@ -189,10 +189,9 @@ const InternalTooltip = React.forwardRef<TooltipRef, TooltipProps>((props, ref)
|
|||||||
['onVisibleChange', 'onOpenChange'],
|
['onVisibleChange', 'onOpenChange'],
|
||||||
['afterVisibleChange', 'afterOpenChange'],
|
['afterVisibleChange', 'afterOpenChange'],
|
||||||
['arrowPointAtCenter', 'arrow={{ pointAtCenter: true }}'],
|
['arrowPointAtCenter', 'arrow={{ pointAtCenter: true }}'],
|
||||||
// todo: Warnings are not available yet, because popover and popconfirm are still in use. Wait until they are merged before processing.
|
['overlayStyle', 'styles={{ root: {} }}'],
|
||||||
// ['overlayStyle', 'styles={{ root: {} }}'],
|
['overlayInnerStyle', 'styles={{ body: {} }}'],
|
||||||
// ['overlayInnerStyle', 'styles={{ body: {} }}'],
|
['overlayClassName', 'classNames={{ root: {} }}'],
|
||||||
// ['overlayClassName', 'classNames={{ root: {} }}'],
|
|
||||||
].forEach(([deprecatedName, newName]) => {
|
].forEach(([deprecatedName, newName]) => {
|
||||||
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
|
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user