Skip to content

Commit c840fec

Browse files
authored
docs: align open-state callback parameter names (#59236)
1 parent 23207f0 commit c840fec

20 files changed

Lines changed: 59 additions & 59 deletions

File tree

‎.dumi/theme/builtins/InlinePopover/index.tsx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ export interface InlinePopoverProps {
2121
const InlinePopover: React.FC<InlinePopoverProps> = (props) => {
2222
const { previewURL } = props;
2323
const [locale] = useLocale(locales);
24-
const [visible, setVisible] = React.useState(false);
24+
const [open, setOpen] = React.useState(false);
2525

2626
return (
2727
<>
2828
<Tooltip title={locale.tip}>
29-
<Typography.Link onClick={() => setVisible(true)}>
29+
<Typography.Link onClick={() => setOpen(true)}>
3030
<PictureOutlined />
3131
</Typography.Link>
3232
</Tooltip>
@@ -36,10 +36,10 @@ const InlinePopover: React.FC<InlinePopoverProps> = (props) => {
3636
style={{ display: 'none' }}
3737
src={previewURL}
3838
preview={{
39-
visible,
39+
open,
4040
src: previewURL,
41-
onVisibleChange: (value) => {
42-
setVisible(value);
41+
onOpenChange: (nextOpen) => {
42+
setOpen(nextOpen);
4343
},
4444
}}
4545
/>

‎.dumi/theme/slots/Header/index.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ const Header: React.FC = () => {
241241
setHeaderState((prev) => ({ ...prev, windowWidth: window.innerWidth }));
242242
}, []);
243243

244-
const onMenuVisibleChange = useCallback((visible: boolean) => {
245-
setHeaderState((prev) => ({ ...prev, menuVisible: visible }));
244+
const onMenuOpenChange = useCallback((open: boolean) => {
245+
setHeaderState((prev) => ({ ...prev, menuVisible: open }));
246246
}, []);
247247

248248
const onDirectionChange = () => {
@@ -422,7 +422,7 @@ const Header: React.FC = () => {
422422
trigger="click"
423423
open={menuVisible}
424424
arrow={{ pointAtCenter: true }}
425-
onOpenChange={onMenuVisibleChange}
425+
onOpenChange={onMenuOpenChange}
426426
>
427427
<MenuOutlined className="nav-phone-icon" />
428428
</Popover>

‎components/auto-complete/AutoComplete.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export interface AutoCompleteProps<
8787
dropdownStyle?: React.CSSProperties;
8888
/** @deprecated Please use `onOpenChange` instead */
8989
onDropdownVisibleChange?: (visible: boolean) => void;
90-
onOpenChange?: (visible: boolean) => void;
90+
onOpenChange?: (open: boolean) => void;
9191
showSearch?:
9292
| boolean
9393
| Pick<

‎components/cascader/index.en-US.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Common props ref:[Common props](/docs/react/common-props)
9393
| onChange | Callback when finishing cascader select | (value, selectedOptions) => void | - | | × |
9494
| onClear | Called when clear | () => void | - | - | × |
9595
| ~~onDropdownVisibleChange~~ | Callback when popup shown or hidden, use `onOpenChange` instead | (value) => void | - | 4.17.0 | × |
96-
| onOpenChange | Callback when popup shown or hidden | (value) => void | - | | × |
96+
| onOpenChange | Callback when popup shown or hidden | (open: boolean) => void | - | | × |
9797
| ~~onPopupVisibleChange~~ | Callback when popup shown or hidden, please use `onOpenChange` instead | (value) => void | - | - | × |
9898
| multiple | Support multiple or not | boolean | - | 4.17.0 | × |
9999
| removeIcon | The custom remove icon | ReactNode | - | | 6.4.0 |

‎components/cascader/index.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export interface CascaderProps<
181181
onDropdownVisibleChange?: (visible: boolean) => void;
182182
/** @deprecated Please use `onOpenChange` instead */
183183
onPopupVisibleChange?: (visible: boolean) => void;
184-
onOpenChange?: (visible: boolean) => void;
184+
onOpenChange?: (open: boolean) => void;
185185
/**
186186
* @since 5.13.0
187187
* @default "outlined"

‎components/cascader/index.zh-CN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ demo:
9494
| onChange | 选择完成后的回调 | (value, selectedOptions) => void | - | | × |
9595
| onClear | 清除内容时回调 | () => void | - | - | × |
9696
| ~~onDropdownVisibleChange~~ | 显示/隐藏浮层的回调,请使用 `onOpenChange` 替换 | (value) => void | - | 4.17.0 | × |
97-
| onOpenChange | 显示/隐藏浮层的回调 | (value) => void | - | | × |
97+
| onOpenChange | 显示/隐藏浮层的回调 | (open: boolean) => void | - | | × |
9898
| ~~onPopupVisibleChange~~ | 显示或隐藏浮层的回调,请使用 `onOpenChange` 替代 | (value) => void | - | - | × |
9999
| multiple | 支持多选节点 | boolean | - | 4.17.0 | × |
100100
| removeIcon | 自定义的多选框清除图标 | ReactNode | - | | 6.4.0 |

‎components/color-picker/ColorPicker.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ const ColorPicker: CompoundedComponent = (props) => {
139139
}
140140
};
141141

142-
const triggerOpenChange = (visible: boolean) => {
143-
if (!visible || !mergedDisabled) {
144-
setPopupOpen(visible);
145-
onOpenChange?.(visible);
142+
const triggerOpenChange = (open: boolean) => {
143+
if (!open || !mergedDisabled) {
144+
setPopupOpen(open);
145+
onOpenChange?.(open);
146146
}
147147
};
148148

‎components/image/demo/controlled-preview.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ const App: React.FC = () => {
3030
open,
3131
scaleStep,
3232
src: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
33-
onOpenChange: (value) => {
34-
setOpen(value);
33+
onOpenChange: (nextOpen) => {
34+
setOpen(nextOpen);
3535
},
3636
}}
3737
/>

‎components/image/index.en-US.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Other Property ref [&lt;img>](https://developer.mozilla.org/en-US/docs/Web/HTML/
9393
| wheel | Whether to enable mouse wheel zoom | boolean | true | 6.6.0 |
9494
| ~~toolbarRender~~ | Custom toolbar; please use 'actionsRender' instead | (originalNode: React.ReactElement, info: Omit<ToolbarRenderInfoType, 'current' \| 'total'>) => React.ReactNode | - | |
9595
| ~~visible~~ | Whether to show; please use 'open' instead | boolean | - | |
96-
| onOpenChange | Callback when preview open state changes | (visible: boolean) => void | - | |
96+
| onOpenChange | Callback when preview open state changes | (open: boolean) => void | - | |
9797
| onTransform | Callback for preview transform changes | { transform: [TransformType](#transformtype), action: [TransformAction](#transformaction) } | - | |
9898
| ~~onVisibleChange~~ | Callback when 'visible' changes; please use 'onOpenChange' instead | (visible: boolean, prevVisible: boolean) => void | - | |
9999

@@ -130,7 +130,7 @@ Other Property ref [&lt;img>](https://developer.mozilla.org/en-US/docs/Web/HTML/
130130
| scaleStep | Each step's zoom multiplier is 1 + scaleStep | number | 0.5 | |
131131
| ~~toolbarRender~~ | Custom toolbar; please use 'actionsRender' instead | (originalNode: React.ReactElement, info: ToolbarRenderInfoType) => React.ReactNode | - | |
132132
| ~~visible~~ | Whether to show; please use 'open' instead | boolean | - | |
133-
| onOpenChange | Callback when preview open state changes, includes current preview index | (visible: boolean, info: { current: number }) => void | - | |
133+
| onOpenChange | Callback when preview open state changes, includes current preview index | (open: boolean, info: { current: number }) => void | - | |
134134
| onChange | Callback when changing preview image | (current: number, prevCurrent: number) => void | - | |
135135
| onTransform | Callback for preview transform changes | { transform: [TransformType](#transformtype), action: [TransformAction](#transformaction) } | - | |
136136
| ~~onVisibleChange~~ | Callback when 'visible' changes; please use 'onOpenChange' instead | (visible: boolean, prevVisible: boolean, current: number) => void | - | |

‎components/image/index.zh-CN.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*LVQ3R5JjjJEAAA
9494
| wheel | 是否启用鼠标滚轮缩放 | boolean | true | 6.6.0 |
9595
| ~~toolbarRender~~ | 自定义工具栏,请使用 `actionsRender` 替换 | (originalNode: React.ReactElement, info: Omit<ToolbarRenderInfoType, 'current' \| 'total'>) => React.ReactNode | - | |
9696
| ~~visible~~ | 是否显示,请使用 `open` 替换 | boolean | - | |
97-
| onOpenChange | 预览打开状态变化的回调 | (visible: boolean) => void | - | |
97+
| onOpenChange | 预览打开状态变化的回调 | (open: boolean) => void | - | |
9898
| onTransform | 预览图 transform 变化的回调 | { transform: [TransformType](#transformtype), action: [TransformAction](#transformaction) } | - | |
9999
| ~~onVisibleChange~~ | 当 `visible` 发生改变时的回调,请使用 `onOpenChange` 替换 | (visible: boolean, prevVisible: boolean) => void | - | |
100100

@@ -131,7 +131,7 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*LVQ3R5JjjJEAAA
131131
| scaleStep | `1 + scaleStep` 为缩放放大的每步倍数 | number | 0.5 | |
132132
| ~~toolbarRender~~ | 自定义工具栏,请使用 `actionsRender` 替换 | (originalNode: React.ReactElement, info: ToolbarRenderInfoType) => React.ReactNode | - | |
133133
| ~~visible~~ | 是否显示,请使用 `open` 替换 | boolean | - | |
134-
| onOpenChange | 预览打开状态变化回调,额外携带当前预览图索引 | (visible: boolean, info: { current: number }) => void | - | |
134+
| onOpenChange | 预览打开状态变化回调,额外携带当前预览图索引 | (open: boolean, info: { current: number }) => void | - | |
135135
| onChange | 切换预览图的回调 | (current: number, prevCurrent: number) => void | - | |
136136
| onTransform | 预览图 transform 变化的回调 | { transform: [TransformType](#transformtype), action: [TransformAction](#transformaction) } | - | |
137137
| ~~onVisibleChange~~ | 当 `visible` 发生改变时的回调,请使用 `onOpenChange` 替换 | (visible: boolean, prevVisible: boolean, current: number) => void | - | |

0 commit comments

Comments
 (0)