Skip to content

Commit 87debac

Browse files
authored
chore: rename variables merge => merged (ant-design#48048)
1 parent 611993b commit 87debac

File tree

9 files changed

+45
-35
lines changed

9 files changed

+45
-35
lines changed

components/alert/Alert.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ const Alert: React.FC<AlertProps> = (props) => {
202202
return alert?.closeIcon;
203203
}, [closeIcon, closable, closeText, alert?.closeIcon]);
204204

205-
const mergeAriaProps = React.useMemo(() => {
205+
const mergedAriaProps = React.useMemo<React.AriaAttributes>(() => {
206206
const merged = closable ?? alert?.closable;
207207
if (typeof merged === 'object') {
208208
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -251,7 +251,7 @@ const Alert: React.FC<AlertProps> = (props) => {
251251
prefixCls={prefixCls}
252252
closeIcon={mergedCloseIcon}
253253
handleClose={handleClose}
254-
ariaProps={mergeAriaProps}
254+
ariaProps={mergedAriaProps}
255255
/>
256256
</div>
257257
)}

components/avatar/avatar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import type { Breakpoint } from '../_util/responsiveObserver';
77
import { responsiveArray } from '../_util/responsiveObserver';
88
import { devUseWarning } from '../_util/warning';
99
import { ConfigContext } from '../config-provider';
10+
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
1011
import useSize from '../config-provider/hooks/useSize';
1112
import useBreakpoint from '../grid/hooks/useBreakpoint';
1213
import type { AvatarContextType, AvatarSize } from './AvatarContext';
1314
import AvatarContext from './AvatarContext';
1415
import useStyle from './style';
15-
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
1616

1717
export interface AvatarProps {
1818
/** Shape of avatar, options: `circle`, `square` */
@@ -53,7 +53,7 @@ const InternalAvatar: React.ForwardRefRenderFunction<HTMLSpanElement, AvatarProp
5353

5454
const avatarNodeRef = React.useRef<HTMLSpanElement>(null);
5555
const avatarChildrenRef = React.useRef<HTMLSpanElement>(null);
56-
const avatarNodeMergeRef = composeRef<HTMLSpanElement>(ref, avatarNodeRef);
56+
const avatarNodeMergedRef = composeRef<HTMLSpanElement>(ref, avatarNodeRef);
5757

5858
const { getPrefixCls, avatar } = React.useContext(ConfigContext);
5959

@@ -234,7 +234,7 @@ const InternalAvatar: React.ForwardRefRenderFunction<HTMLSpanElement, AvatarProp
234234
{...others}
235235
style={{ ...sizeStyle, ...responsiveSizeStyle, ...avatar?.style, ...others.style }}
236236
className={classString}
237-
ref={avatarNodeMergeRef}
237+
ref={avatarNodeMergedRef}
238238
>
239239
{childrenToRender}
240240
</span>,

components/color-picker/ColorPicker.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,19 @@ const ColorPicker: CompoundedComponent = (props) => {
138138
const rootCls = useCSSVarCls(prefixCls);
139139
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);
140140
const rtlCls = { [`${prefixCls}-rtl`]: direction };
141-
const mergeRootCls = classNames(rootClassName, cssVarCls, rootCls, rtlCls);
142-
const mergeCls = classNames(
141+
const mergedRootCls = classNames(rootClassName, cssVarCls, rootCls, rtlCls);
142+
const mergedCls = classNames(
143143
getStatusClassNames(prefixCls, contextStatus),
144144
{
145145
[`${prefixCls}-sm`]: mergedSize === 'small',
146146
[`${prefixCls}-lg`]: mergedSize === 'large',
147147
},
148148
colorPicker?.className,
149-
mergeRootCls,
149+
mergedRootCls,
150150
className,
151151
hashId,
152152
);
153-
const mergePopupCls = classNames(prefixCls, mergeRootCls);
153+
const mergedPopupCls = classNames(prefixCls, mergedRootCls);
154154

155155
const popupAllowCloseRef = useRef(true);
156156

@@ -254,13 +254,13 @@ const ColorPicker: CompoundedComponent = (props) => {
254254
/>
255255
</NoFormStyle>
256256
}
257-
overlayClassName={mergePopupCls}
257+
overlayClassName={mergedPopupCls}
258258
{...popoverProps}
259259
>
260260
{children || (
261261
<ColorTrigger
262262
open={popupOpen}
263-
className={mergeCls}
263+
className={mergedCls}
264264
style={mergedStyle}
265265
color={value ? generateColor(value) : colorValue}
266266
prefixCls={prefixCls}

components/color-picker/hooks/useColorState.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useEffect, useState } from 'react';
2+
23
import type { Color } from '../color';
34
import type { ColorValueType } from '../interface';
45
import { generateColor } from '../util';
@@ -13,15 +14,15 @@ const useColorState = (
1314
): readonly [Color, React.Dispatch<React.SetStateAction<Color>>] => {
1415
const { defaultValue, value } = option;
1516
const [colorValue, setColorValue] = useState<Color>(() => {
16-
let mergeState: ColorValueType | undefined;
17+
let mergedState: ColorValueType | undefined;
1718
if (hasValue(value)) {
18-
mergeState = value;
19+
mergedState = value;
1920
} else if (hasValue(defaultValue)) {
20-
mergeState = defaultValue;
21+
mergedState = defaultValue;
2122
} else {
22-
mergeState = defaultStateValue;
23+
mergedState = defaultStateValue;
2324
}
24-
return generateColor(mergeState || '');
25+
return generateColor(mergedState || '');
2526
});
2627

2728
useEffect(() => {

components/float-button/BackTop.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,15 @@ const BackTop = React.forwardRef<FloatButtonRef, BackTopProps>((props, ref) => {
7575

7676
const groupShape = useContext<FloatButtonShape | undefined>(FloatButtonGroupContext);
7777

78-
const mergeShape = groupShape || shape;
79-
80-
const contentProps: FloatButtonProps = { prefixCls, icon, type, shape: mergeShape, ...restProps };
78+
const mergedShape = groupShape || shape;
79+
80+
const contentProps: FloatButtonProps = {
81+
prefixCls,
82+
icon,
83+
type,
84+
shape: mergedShape,
85+
...restProps,
86+
};
8187

8288
return (
8389
<CSSMotion visible={visible} motionName={`${rootPrefixCls}-fade`}>

components/float-button/FloatButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { devUseWarning } from '../_util/warning';
66
import Badge from '../badge';
77
import type { ConfigConsumerProps } from '../config-provider';
88
import { ConfigContext } from '../config-provider';
9+
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
910
import Tooltip from '../tooltip';
1011
import FloatButtonGroupContext from './context';
1112
import Content from './FloatButtonContent';
@@ -18,7 +19,6 @@ import type {
1819
FloatButtonShape,
1920
} from './interface';
2021
import useStyle from './style';
21-
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
2222

2323
export const floatButtonPrefixCls = 'float-btn';
2424

@@ -41,7 +41,7 @@ const FloatButton = React.forwardRef<FloatButtonElement, FloatButtonProps>((prop
4141
const rootCls = useCSSVarCls(prefixCls);
4242
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);
4343

44-
const mergeShape = groupShape || shape;
44+
const mergedShape = groupShape || shape;
4545

4646
const classString = classNames(
4747
hashId,
@@ -51,7 +51,7 @@ const FloatButton = React.forwardRef<FloatButtonElement, FloatButtonProps>((prop
5151
className,
5252
rootClassName,
5353
`${prefixCls}-${type}`,
54-
`${prefixCls}-${mergeShape}`,
54+
`${prefixCls}-${mergedShape}`,
5555
{
5656
[`${prefixCls}-rtl`]: direction === 'rtl',
5757
},

components/grid/row.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ export interface RowProps extends React.HTMLAttributes<HTMLDivElement> {
3636
wrap?: boolean;
3737
}
3838

39-
function useMergePropByScreen(oriProp: RowProps['align'] | RowProps['justify'], screen: ScreenMap) {
39+
function useMergedPropByScreen(
40+
oriProp: RowProps['align'] | RowProps['justify'],
41+
screen: ScreenMap,
42+
) {
4043
const [prop, setProp] = React.useState(typeof oriProp === 'string' ? oriProp : '');
4144

42-
const calcMergeAlignOrJustify = () => {
45+
const calcMergedAlignOrJustify = () => {
4346
if (typeof oriProp === 'string') {
4447
setProp(oriProp);
4548
}
@@ -61,7 +64,7 @@ function useMergePropByScreen(oriProp: RowProps['align'] | RowProps['justify'],
6164
};
6265

6366
React.useEffect(() => {
64-
calcMergeAlignOrJustify();
67+
calcMergedAlignOrJustify();
6568
}, [JSON.stringify(oriProp), screen]);
6669

6770
return prop;
@@ -101,9 +104,9 @@ const Row = React.forwardRef<HTMLDivElement, RowProps>((props, ref) => {
101104
});
102105

103106
// ================================== calc responsive data ==================================
104-
const mergeAlign = useMergePropByScreen(align, curScreens);
107+
const mergedAlign = useMergedPropByScreen(align, curScreens);
105108

106-
const mergeJustify = useMergePropByScreen(justify, curScreens);
109+
const mergedJustify = useMergedPropByScreen(justify, curScreens);
107110

108111
const gutterRef = React.useRef<Gutter | [Gutter, Gutter]>(gutter);
109112

@@ -154,8 +157,8 @@ const Row = React.forwardRef<HTMLDivElement, RowProps>((props, ref) => {
154157
prefixCls,
155158
{
156159
[`${prefixCls}-no-wrap`]: wrap === false,
157-
[`${prefixCls}-${mergeJustify}`]: mergeJustify,
158-
[`${prefixCls}-${mergeAlign}`]: mergeAlign,
160+
[`${prefixCls}-${mergedJustify}`]: mergedJustify,
161+
[`${prefixCls}-${mergedAlign}`]: mergedAlign,
159162
[`${prefixCls}-rtl`]: direction === 'rtl',
160163
},
161164
className,

components/table/demo/resizable-column.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const App: React.FC = () => {
108108
setColumns(newColumns);
109109
};
110110

111-
const mergeColumns: TableColumnsType<DataType> = columns.map((col, index) => ({
111+
const mergedColumns = columns.map<TableColumnsType<DataType>[number]>((col, index) => ({
112112
...col,
113113
onHeaderCell: (column: TableColumnsType<DataType>[number]) => ({
114114
width: column.width,
@@ -124,7 +124,7 @@ const App: React.FC = () => {
124124
cell: ResizableTitle,
125125
},
126126
}}
127-
columns={mergeColumns}
127+
columns={mergedColumns}
128128
dataSource={data}
129129
/>
130130
);

components/tour/panelRender.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ const TourPanel: React.FC<TourPanelProps> = (props) => {
8686

8787
const coverNode = isValidNode(cover) ? <div className={`${prefixCls}-cover`}>{cover}</div> : null;
8888

89-
let mergeIndicatorNode: ReactNode;
89+
let mergedIndicatorNode: ReactNode;
9090

9191
if (indicatorsRender) {
92-
mergeIndicatorNode = indicatorsRender(current, total);
92+
mergedIndicatorNode = indicatorsRender(current, total);
9393
} else {
94-
mergeIndicatorNode = [...Array.from({ length: total }).keys()].map<ReactNode>(
94+
mergedIndicatorNode = [...Array.from({ length: total }).keys()].map<ReactNode>(
9595
(stepItem, index) => (
9696
<span
9797
key={stepItem}
@@ -121,7 +121,7 @@ const TourPanel: React.FC<TourPanelProps> = (props) => {
121121
{headerNode}
122122
{descriptionNode}
123123
<div className={`${prefixCls}-footer`}>
124-
{total > 1 && <div className={`${prefixCls}-indicators`}>{mergeIndicatorNode}</div>}
124+
{total > 1 && <div className={`${prefixCls}-indicators`}>{mergedIndicatorNode}</div>}
125125
<div className={`${prefixCls}-buttons`}>
126126
{current !== 0 ? (
127127
<Button

0 commit comments

Comments
 (0)