mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +08:00
feat(ColorPicker): add destroyTooltipOnHide (#42645)
* feat(ColorPicker): add destroyTooltipOnHide * fix: interface -> type
This commit is contained in:
parent
4af6a526e2
commit
2c20dcd4cc
@ -26,8 +26,10 @@ import type {
|
|||||||
import useStyle from './style/index';
|
import useStyle from './style/index';
|
||||||
import { customizePrefixCls, generateColor } from './util';
|
import { customizePrefixCls, generateColor } from './util';
|
||||||
|
|
||||||
export interface ColorPickerProps
|
export type ColorPickerProps = Omit<
|
||||||
extends Omit<RcColorPickerProps, 'onChange' | 'value' | 'defaultValue' | 'panelRender'> {
|
RcColorPickerProps,
|
||||||
|
'onChange' | 'value' | 'defaultValue' | 'panelRender'
|
||||||
|
> & {
|
||||||
value?: Color | string;
|
value?: Color | string;
|
||||||
defaultValue?: Color | string;
|
defaultValue?: Color | string;
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
@ -45,9 +47,7 @@ export interface ColorPickerProps
|
|||||||
onFormatChange?: (format: ColorFormat) => void;
|
onFormatChange?: (format: ColorFormat) => void;
|
||||||
onChange?: (value: Color, hex: string) => void;
|
onChange?: (value: Color, hex: string) => void;
|
||||||
onClear?: () => void;
|
onClear?: () => void;
|
||||||
getPopupContainer?: PopoverProps['getPopupContainer'];
|
} & Pick<PopoverProps, 'getPopupContainer' | 'autoAdjustOverflow' | 'destroyTooltipOnHide'>;
|
||||||
autoAdjustOverflow?: PopoverProps['autoAdjustOverflow'];
|
|
||||||
}
|
|
||||||
|
|
||||||
type CompoundedComponent = React.FC<ColorPickerProps> & {
|
type CompoundedComponent = React.FC<ColorPickerProps> & {
|
||||||
_InternalPanelDoNotUseOrYouWillBeFired: typeof PurePanel;
|
_InternalPanelDoNotUseOrYouWillBeFired: typeof PurePanel;
|
||||||
@ -76,6 +76,7 @@ const ColorPicker: CompoundedComponent = (props) => {
|
|||||||
onOpenChange,
|
onOpenChange,
|
||||||
getPopupContainer,
|
getPopupContainer,
|
||||||
autoAdjustOverflow = true,
|
autoAdjustOverflow = true,
|
||||||
|
destroyTooltipOnHide,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { getPrefixCls, direction } = useContext<ConfigConsumerProps>(ConfigContext);
|
const { getPrefixCls, direction } = useContext<ConfigConsumerProps>(ConfigContext);
|
||||||
@ -140,6 +141,7 @@ const ColorPicker: CompoundedComponent = (props) => {
|
|||||||
rootClassName,
|
rootClassName,
|
||||||
getPopupContainer,
|
getPopupContainer,
|
||||||
autoAdjustOverflow,
|
autoAdjustOverflow,
|
||||||
|
destroyTooltipOnHide,
|
||||||
};
|
};
|
||||||
|
|
||||||
const colorBaseProps: ColorPickerBaseProps = {
|
const colorBaseProps: ColorPickerBaseProps = {
|
||||||
|
@ -47,6 +47,7 @@ Used when the user needs to customize the color selection.
|
|||||||
| disabled | Disable ColorPicker | boolean | - |
|
| disabled | Disable ColorPicker | boolean | - |
|
||||||
| placement | Placement of popup | `top` \| `topLeft` \| `topRight` \| `bottom` \| `bottomLeft` \| `bottomRight` | `bottomLeft` |
|
| placement | Placement of popup | `top` \| `topLeft` \| `topRight` \| `bottom` \| `bottomLeft` \| `bottomRight` | `bottomLeft` |
|
||||||
| arrow | Configuration for popup arrow | `boolean \| { pointAtCenter: boolean }` | `true` | - |
|
| arrow | Configuration for popup arrow | `boolean \| { pointAtCenter: boolean }` | `true` | - |
|
||||||
|
| destroyTooltipOnHide | Whether destroy popover when hidden | `boolean` | `false` |
|
||||||
| onChange | Callback when `value` is changed | `(value: Color, hex: string) => void` | - |
|
| onChange | Callback when `value` is changed | `(value: Color, hex: string) => void` | - |
|
||||||
| onFormatChange | Callback when `format` is changed | `(format: 'hex' \| 'rgb' \| 'hsb') => void` | - |
|
| onFormatChange | Callback when `format` is changed | `(format: 'hex' \| 'rgb' \| 'hsb') => void` | - |
|
||||||
| onOpenChange | Callback when `open` is changed | `(open: boolean) => void` | - |
|
| onOpenChange | Callback when `open` is changed | `(open: boolean) => void` | - |
|
||||||
|
@ -48,6 +48,7 @@ group:
|
|||||||
| disabled | 禁用颜色选择器 | boolean | - |
|
| disabled | 禁用颜色选择器 | boolean | - |
|
||||||
| placement | 弹出窗口的位置 | `top` \| `topLeft` \| `topRight` \| `bottom` \| `bottomLeft` \| `bottomRight` | `bottomLeft` |
|
| placement | 弹出窗口的位置 | `top` \| `topLeft` \| `topRight` \| `bottom` \| `bottomLeft` \| `bottomRight` | `bottomLeft` |
|
||||||
| arrow | 配置弹出的箭头 | `boolean \| { pointAtCenter: boolean }` | `true` | - |
|
| arrow | 配置弹出的箭头 | `boolean \| { pointAtCenter: boolean }` | `true` | - |
|
||||||
|
| destroyTooltipOnHide | 关闭后是否销毁弹窗 | `boolean` | `false` |
|
||||||
| onChange | 颜色变化的回调 | `(value: Color, hex: string) => void` | - |
|
| onChange | 颜色变化的回调 | `(value: Color, hex: string) => void` | - |
|
||||||
| onFormatChange | 颜色格式变化的回调 | `(format: 'hex' \| 'rgb' \| 'hsb') => void` | - |
|
| onFormatChange | 颜色格式变化的回调 | `(format: 'hex' \| 'rgb' \| 'hsb') => void` | - |
|
||||||
| onOpenChange | 当 `open` 被改变时的回调 | `(open: boolean) => void` | - |
|
| onOpenChange | 当 `open` 被改变时的回调 | `(open: boolean) => void` | - |
|
||||||
|
Loading…
Reference in New Issue
Block a user