mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
refactor(color-picker): rename defaultCollapsed
=> defaultOpen
(#45655)
This commit is contained in:
parent
321dfd8cc9
commit
f3c37a3be4
@ -248,7 +248,7 @@ describe('ColorPicker', () => {
|
||||
{
|
||||
label: 'Recent',
|
||||
colors: ['#f00d', '#0f0d', '#00fd'],
|
||||
defaultCollapsed: true,
|
||||
defaultOpen: false,
|
||||
},
|
||||
]}
|
||||
/>,
|
||||
|
@ -48,9 +48,8 @@ const ColorPresets: FC<ColorPresetsProps> = ({ prefixCls, presets, value: color,
|
||||
const activeKeys = useMemo(
|
||||
() =>
|
||||
presetsValue.reduce<string[]>((acc, preset) => {
|
||||
if (!preset.defaultCollapsed) {
|
||||
acc.push(genCollapsePanelKey(preset));
|
||||
}
|
||||
const { defaultOpen = true } = preset;
|
||||
if (defaultOpen) acc.push(genCollapsePanelKey(preset));
|
||||
return acc;
|
||||
}, []),
|
||||
[presetsValue],
|
||||
|
@ -53,7 +53,7 @@ Common props ref:[Common props](/docs/react/common-props)
|
||||
| destroyTooltipOnHide | Whether destroy popover when hidden | `boolean` | false | 5.7.0 |
|
||||
| format | Format of color | `rgb` \| `hex` \| `hsb` | `hex` | |
|
||||
| open | Whether to show popup | boolean | - | |
|
||||
| presets | Preset colors | `{ label: ReactNode, colors: Array<string \| Color>, defaultCollapsed?: boolean }[]` | - | `defaultCollapsed: 5.11.0` |
|
||||
| presets | Preset colors | `{ label: ReactNode, colors: Array<string \| Color>, defaultOpen?: boolean }[]` | - | `defaultOpen: 5.11.0` |
|
||||
| placement | Placement of popup | `top` \| `topLeft` \| `topRight` \| `bottom` \| `bottomLeft` \| `bottomRight` | `bottomLeft` | |
|
||||
| panelRender | Custom Render Panel | `(panel: React.ReactNode, extra: { components: { Picker: FC; Presets: FC } }) => React.ReactNode` | - | 5.7.0 |
|
||||
| showText | Show color text | boolean \| `(color: Color) => React.ReactNode` | - | 5.7.0 |
|
||||
|
@ -54,7 +54,7 @@ group:
|
||||
| destroyTooltipOnHide | 关闭后是否销毁弹窗 | `boolean` | false | 5.7.0 |
|
||||
| format | 颜色格式 | `rgb` \| `hex` \| `hsb` | `hex` | |
|
||||
| open | 是否显示弹出窗口 | boolean | - | |
|
||||
| presets | 预设的颜色 | `{ label: ReactNode, colors: Array<string \| Color>, defaultCollapsed?: boolean }[]` | - | `defaultCollapsed: 5.11.0` |
|
||||
| presets | 预设的颜色 | `{ label: ReactNode, colors: Array<string \| Color>, defaultOpen?: boolean }[]` | - | `defaultOpen: 5.11.0` |
|
||||
| placement | 弹出窗口的位置 | `top` \| `topLeft` \| `topRight` \| `bottom` \| `bottomLeft` \| `bottomRight` | `bottomLeft` | |
|
||||
| panelRender | 自定义渲染面板 | `(panel: React.ReactNode, extra: { components: { Picker: FC; Presets: FC } }) => React.ReactNode` | - | 5.7.0 |
|
||||
| showText | 显示颜色文本 | boolean \| `(color: Color) => React.ReactNode` | - | 5.7.0 |
|
||||
|
@ -14,8 +14,9 @@ export interface PresetsItem {
|
||||
/**
|
||||
* Whether the initial state is collapsed
|
||||
* @since 5.11.0
|
||||
* @default true
|
||||
*/
|
||||
defaultCollapsed?: boolean;
|
||||
defaultOpen?: boolean;
|
||||
}
|
||||
export type TriggerType = 'click' | 'hover';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user